@shellraining/dsh-plugin-updates 0.2.0 → 0.2.2

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/lib/client.js CHANGED
@@ -4,1741 +4,1450 @@ window.__ModuleLoader__.load({
4
4
  factory: (require) => {
5
5
  var module = { exports: {} };
6
6
  var exports = module.exports;
7
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
+ // \0rolldown/runtime.js
7
9
  var __create = Object.create;
8
10
  var __defProp = Object.defineProperty;
9
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
10
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
11
13
  var __getProtoOf = Object.getPrototypeOf;
12
14
  var __hasOwnProp = Object.prototype.hasOwnProperty;
13
- var __commonJS = (cb, mod) => function __require() {
14
- try {
15
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
- } catch (e) {
17
- throw mod = 0, e;
18
- }
15
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
18
+ key = keys[i];
19
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
20
+ get: ((k) => from[k]).bind(null, key),
21
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
22
+ });
23
+ }
24
+ return to;
19
25
  };
20
- var __export = (target, all) => {
21
- for (var name2 in all)
22
- __defProp(target, name2, { get: all[name2], enumerable: true });
26
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
27
+ value: mod,
28
+ enumerable: true
29
+ }) : target, mod));
30
+ let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
31
+ let react = require("react");
32
+ let react_dom = require("react-dom");
33
+ let react_jsx_runtime = require("react/jsx-runtime");
34
+ // src/client/locale.ts
35
+ var LOCALE_NS = "dshPluginUpdates";
36
+ var ZH = {
37
+ "updateAllCount": "全部更新({count})",
38
+ "updateLabel": "把 {name} 更新到 {version}",
39
+ "updating": "更新中…",
40
+ "updateTo": "更新到 {version}",
41
+ "install": "安装",
42
+ "status.update": "可更新 {version}",
43
+ "versions.loading": "正在读取版本…",
44
+ "version.current": "当前 {version}",
45
+ "versions.title": "版本",
46
+ "versions.registry": "来自 {registry}",
47
+ "versions.showAll": "显示全部 {count} 个版本",
48
+ "versions.empty": "没有可用的版本信息",
49
+ "versions.failed": "无法从 npm 读取版本:{reason}",
50
+ "tag.current": "当前",
51
+ "tag.prerelease": "预发布",
52
+ "tag.deprecated": "已废弃",
53
+ "tag.incompatible": "不兼容",
54
+ "tag.fresh": "新发布",
55
+ "hint.fresh": "发布不足 24 小时:pnpm 默认不安装这么新的版本,安装可能失败",
56
+ "hint.incompatible": "与当前 DSH 版本不兼容,安装会被拒绝",
57
+ "self.body": "可以更新到 {version}。更新在宿主后台进行,期间本插件的界面会暂时消失",
58
+ "self.confirmTitle": "把本插件更新到 {version}?",
59
+ "self.confirmBody": "宿主会先卸载当前版本,再安装新版本。期间插件页上的更新按钮会暂时消失,装好后自动回来;新版本装不上时会装回当前版本。如果连当前版本也装不回,可以退出 DSH 后在终端运行下面的命令手动安装:",
60
+ "self.cancel": "取消",
61
+ "self.copy": "复制命令",
62
+ "self.copied": "已复制",
63
+ "error.policy": "pnpm 处理 minimumReleaseAge 时发生内部错误。请升级宿主附带的 pnpm,或等发布等待期结束后重试;完整错误见下方日志",
64
+ "error.inconsistent": "安装声明与实际版本不一致,请先用宿主插件管理器或 CLI 修复安装,再重试更新",
65
+ "error.stateChanged": "插件安装状态已变化,请刷新插件列表后重试",
66
+ "error.interrupted": "宿主在更新完成前退出了,请检查插件列表里的版本",
67
+ "error.selfBusy": "已有一个自更新在进行",
68
+ "op.checking": "正在核对 {name} 的安装状态…",
69
+ "op.checkFailed": "无法确认 {name} 的安装状态,已停止操作:{reason}",
70
+ "op.current": "{name} 已是 {to},无需重复安装",
71
+ "op.removing": "正在卸载 {name} {from}…",
72
+ "op.installing": "正在安装 {name} {to}…",
73
+ "op.restoring": "正在恢复 {name} {to}…",
74
+ "op.done": "{name} 已切换到 {to}",
75
+ "op.restart": "{name} 已切换到 {to},重启 DSH 后生效",
76
+ "op.failed": "{name} 安装 {to} 失败:{reason}",
77
+ "op.restored": "{name} 安装 {to} 失败,已装回 {from}:{reason}",
78
+ "op.selfFailed": "{name} 更新到 {to} 失败:{reason}",
79
+ "op.removeFailed": "{name} 卸载未完成,已停止后续安装:{reason}",
80
+ "op.restore": "恢复 {from}",
81
+ "op.dismiss": "关闭",
82
+ "op.log": "日志:{path}"
23
83
  };
24
- var __copyProps = (to, from, except, desc) => {
25
- if (from && typeof from === "object" || typeof from === "function") {
26
- for (let key of __getOwnPropNames(from))
27
- if (!__hasOwnProp.call(to, key) && key !== except)
28
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
29
- }
30
- return to;
84
+ var EN = {
85
+ "updateAllCount": "Update all ({count})",
86
+ "updateLabel": "Update {name} to {version}",
87
+ "updating": "Updating…",
88
+ "updateTo": "Update to {version}",
89
+ "install": "Install",
90
+ "status.update": "Update {version}",
91
+ "versions.loading": "Reading versions…",
92
+ "version.current": "Current {version}",
93
+ "versions.title": "Versions",
94
+ "versions.registry": "From {registry}",
95
+ "versions.showAll": "Show all {count} versions",
96
+ "versions.empty": "No version information",
97
+ "versions.failed": "Could not read versions from npm: {reason}",
98
+ "tag.current": "Current",
99
+ "tag.prerelease": "Prerelease",
100
+ "tag.deprecated": "Deprecated",
101
+ "tag.incompatible": "Incompatible",
102
+ "tag.fresh": "New",
103
+ "hint.fresh": "Published less than 24 hours ago: pnpm does not install versions this new by default, so installing may fail",
104
+ "hint.incompatible": "Not compatible with this DSH version; the installation would be refused",
105
+ "self.body": "Version {version} is available. The host updates this plugin in the background, and its controls disappear meanwhile",
106
+ "self.confirmTitle": "Update this plugin to {version}?",
107
+ "self.confirmBody": "The host uninstalls the current version, then installs the new one. The update controls on the Plugins page disappear meanwhile and come back once it is installed; if the new version cannot be installed, the current one is put back. If even that fails, quit DSH and run this command in a terminal to install it by hand:",
108
+ "self.cancel": "Cancel",
109
+ "self.copy": "Copy command",
110
+ "self.copied": "Copied",
111
+ "error.policy": "pnpm hit an internal error while handling minimumReleaseAge. Upgrade the pnpm bundled with the host, or retry after the release-age waiting period; see the full error below",
112
+ "error.inconsistent": "The declared and installed versions differ. Repair the installation with the host plugin manager or CLI before retrying",
113
+ "error.stateChanged": "The installed state has changed. Refresh the plugin list and retry",
114
+ "error.interrupted": "The host stopped before the update finished; check the version in the plugin list",
115
+ "error.selfBusy": "A self-update is already running",
116
+ "op.checking": "Checking the installed version of {name}…",
117
+ "op.checkFailed": "Could not confirm the installed state of {name}; stopped: {reason}",
118
+ "op.current": "{name} is already at {to}; no reinstall needed",
119
+ "op.removing": "Uninstalling {name} {from}…",
120
+ "op.installing": "Installing {name} {to}…",
121
+ "op.restoring": "Restoring {name} {to}…",
122
+ "op.done": "{name} is now at {to}",
123
+ "op.restart": "{name} is now at {to}; restart DSH to apply it",
124
+ "op.failed": "Could not install {name} {to}: {reason}",
125
+ "op.restored": "Could not install {name} {to}; {from} was put back: {reason}",
126
+ "op.selfFailed": "Could not update {name} to {to}: {reason}",
127
+ "op.removeFailed": "Uninstalling {name} did not finish; installation was not started: {reason}",
128
+ "op.restore": "Restore {from}",
129
+ "op.dismiss": "Dismiss",
130
+ "op.log": "Log: {path}"
31
131
  };
32
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
33
- // If the importer is in node compatibility mode or this is not an ESM
34
- // file that has been converted to a CommonJS file using a Babel-
35
- // compatible transform (i.e. "__esModule" has not been set), then set
36
- // "default" to the CommonJS "module.exports" for node compatibility.
37
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
38
- mod
39
- ));
40
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
41
-
42
132
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/debug.js
43
- var require_debug = __commonJS({
44
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/debug.js"(exports, module2) {
45
- "use strict";
46
- var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
47
- };
48
- module2.exports = debug;
49
- }
50
- });
51
-
133
+ var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
134
+ module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
135
+ }));
52
136
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/constants.js
53
- var require_constants = __commonJS({
54
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/constants.js"(exports, module2) {
55
- "use strict";
56
- var SEMVER_SPEC_VERSION = "2.0.0";
57
- var MAX_LENGTH = 256;
58
- var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
59
- 9007199254740991;
60
- var MAX_SAFE_COMPONENT_LENGTH = 16;
61
- var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
62
- var RELEASE_TYPES = [
63
- "major",
64
- "premajor",
65
- "minor",
66
- "preminor",
67
- "patch",
68
- "prepatch",
69
- "prerelease"
70
- ];
71
- module2.exports = {
72
- MAX_LENGTH,
73
- MAX_SAFE_COMPONENT_LENGTH,
74
- MAX_SAFE_BUILD_LENGTH,
75
- MAX_SAFE_INTEGER,
76
- RELEASE_TYPES,
77
- SEMVER_SPEC_VERSION,
78
- FLAG_INCLUDE_PRERELEASE: 1,
79
- FLAG_LOOSE: 2
80
- };
81
- }
82
- });
83
-
137
+ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
138
+ module.exports = {
139
+ MAX_LENGTH: 256,
140
+ MAX_SAFE_COMPONENT_LENGTH: 16,
141
+ MAX_SAFE_BUILD_LENGTH: 250,
142
+ MAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER ||
143
+ /* istanbul ignore next */ 9007199254740991,
144
+ RELEASE_TYPES: [
145
+ "major",
146
+ "premajor",
147
+ "minor",
148
+ "preminor",
149
+ "patch",
150
+ "prepatch",
151
+ "prerelease"
152
+ ],
153
+ SEMVER_SPEC_VERSION: "2.0.0",
154
+ FLAG_INCLUDE_PRERELEASE: 1,
155
+ FLAG_LOOSE: 2
156
+ };
157
+ }));
84
158
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/re.js
85
- var require_re = __commonJS({
86
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/re.js"(exports, module2) {
87
- "use strict";
88
- var {
89
- MAX_SAFE_COMPONENT_LENGTH,
90
- MAX_SAFE_BUILD_LENGTH,
91
- MAX_LENGTH
92
- } = require_constants();
93
- var debug = require_debug();
94
- exports = module2.exports = {};
95
- var re = exports.re = [];
96
- var safeRe = exports.safeRe = [];
97
- var src = exports.src = [];
98
- var safeSrc = exports.safeSrc = [];
99
- var t = exports.t = {};
100
- var R = 0;
101
- var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
102
- var safeRegexReplacements = [
103
- ["\\s", 1],
104
- ["\\d", MAX_LENGTH],
105
- [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
106
- ];
107
- var makeSafeRegex = (value) => {
108
- for (const [token, max] of safeRegexReplacements) {
109
- value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
110
- }
111
- return value;
112
- };
113
- var createToken = (name2, value, isGlobal) => {
114
- const safe = makeSafeRegex(value);
115
- const index = R++;
116
- debug(name2, index, value);
117
- t[name2] = index;
118
- src[index] = value;
119
- safeSrc[index] = safe;
120
- re[index] = new RegExp(value, isGlobal ? "g" : void 0);
121
- safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
122
- };
123
- createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
124
- createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
125
- createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
126
- createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
127
- createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
128
- createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
129
- createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
130
- createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
131
- createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
132
- createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
133
- createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
134
- createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
135
- createToken("FULL", `^${src[t.FULLPLAIN]}$`);
136
- createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
137
- createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
138
- createToken("GTLT", "((?:<|>)?=?)");
139
- createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
140
- createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
141
- createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
142
- createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
143
- createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
144
- createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
145
- createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
146
- createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
147
- createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
148
- createToken("COERCERTL", src[t.COERCE], true);
149
- createToken("COERCERTLFULL", src[t.COERCEFULL], true);
150
- createToken("LONETILDE", "(?:~>?)");
151
- createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
152
- exports.tildeTrimReplace = "$1~";
153
- createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
154
- createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
155
- createToken("LONECARET", "(?:\\^)");
156
- createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
157
- exports.caretTrimReplace = "$1^";
158
- createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
159
- createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
160
- createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
161
- createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
162
- createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
163
- exports.comparatorTrimReplace = "$1$2$3";
164
- createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
165
- createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
166
- createToken("STAR", "(<|>)?=?\\s*\\*");
167
- createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
168
- createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
169
- }
170
- });
171
-
159
+ var require_re = /* @__PURE__ */ __commonJSMin(((exports, module) => {
160
+ var { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
161
+ var debug = require_debug();
162
+ exports = module.exports = {};
163
+ var re = exports.re = [];
164
+ var safeRe = exports.safeRe = [];
165
+ var src = exports.src = [];
166
+ var safeSrc = exports.safeSrc = [];
167
+ var t = exports.t = {};
168
+ var R = 0;
169
+ var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
170
+ var safeRegexReplacements = [
171
+ ["\\s", 1],
172
+ ["\\d", MAX_LENGTH],
173
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
174
+ ];
175
+ var makeSafeRegex = (value) => {
176
+ for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
177
+ return value;
178
+ };
179
+ var createToken = (name, value, isGlobal) => {
180
+ const safe = makeSafeRegex(value);
181
+ const index = R++;
182
+ debug(name, index, value);
183
+ t[name] = index;
184
+ src[index] = value;
185
+ safeSrc[index] = safe;
186
+ re[index] = new RegExp(value, isGlobal ? "g" : void 0);
187
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
188
+ };
189
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
190
+ createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
191
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
192
+ createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
193
+ createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
194
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
195
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
196
+ createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
197
+ createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
198
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
199
+ createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
200
+ createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
201
+ createToken("FULL", `^${src[t.FULLPLAIN]}$`);
202
+ createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
203
+ createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
204
+ createToken("GTLT", "((?:<|>)?=?)");
205
+ createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
206
+ createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
207
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
208
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
209
+ createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
210
+ createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
211
+ createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
212
+ createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
213
+ createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
214
+ createToken("COERCERTL", src[t.COERCE], true);
215
+ createToken("COERCERTLFULL", src[t.COERCEFULL], true);
216
+ createToken("LONETILDE", "(?:~>?)");
217
+ createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
218
+ exports.tildeTrimReplace = "$1~";
219
+ createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
220
+ createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
221
+ createToken("LONECARET", "(?:\\^)");
222
+ createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
223
+ exports.caretTrimReplace = "$1^";
224
+ createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
225
+ createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
226
+ createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
227
+ createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
228
+ createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
229
+ exports.comparatorTrimReplace = "$1$2$3";
230
+ createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
231
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
232
+ createToken("STAR", "(<|>)?=?\\s*\\*");
233
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
234
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
235
+ }));
172
236
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/parse-options.js
173
- var require_parse_options = __commonJS({
174
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/parse-options.js"(exports, module2) {
175
- "use strict";
176
- var looseOption = Object.freeze({ loose: true });
177
- var emptyOpts = Object.freeze({});
178
- var parseOptions = (options) => {
179
- if (!options) {
180
- return emptyOpts;
181
- }
182
- if (typeof options !== "object") {
183
- return looseOption;
184
- }
185
- return options;
186
- };
187
- module2.exports = parseOptions;
188
- }
189
- });
190
-
237
+ var require_parse_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
238
+ var looseOption = Object.freeze({ loose: true });
239
+ var emptyOpts = Object.freeze({});
240
+ var parseOptions = (options) => {
241
+ if (!options) return emptyOpts;
242
+ if (typeof options !== "object") return looseOption;
243
+ return options;
244
+ };
245
+ module.exports = parseOptions;
246
+ }));
191
247
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/identifiers.js
192
- var require_identifiers = __commonJS({
193
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/identifiers.js"(exports, module2) {
194
- "use strict";
195
- var numeric = /^[0-9]+$/;
196
- var compareIdentifiers = (a, b) => {
197
- if (typeof a === "number" && typeof b === "number") {
198
- return a === b ? 0 : a < b ? -1 : 1;
199
- }
200
- const anum = numeric.test(a);
201
- const bnum = numeric.test(b);
202
- if (anum && bnum) {
203
- a = +a;
204
- b = +b;
205
- }
206
- return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
207
- };
208
- var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
209
- module2.exports = {
210
- compareIdentifiers,
211
- rcompareIdentifiers
212
- };
213
- }
214
- });
215
-
248
+ var require_identifiers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
249
+ var numeric = /^[0-9]+$/;
250
+ var compareIdentifiers = (a, b) => {
251
+ if (typeof a === "number" && typeof b === "number") return a === b ? 0 : a < b ? -1 : 1;
252
+ const anum = numeric.test(a);
253
+ const bnum = numeric.test(b);
254
+ if (anum && bnum) {
255
+ a = +a;
256
+ b = +b;
257
+ }
258
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
259
+ };
260
+ var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
261
+ module.exports = {
262
+ compareIdentifiers,
263
+ rcompareIdentifiers
264
+ };
265
+ }));
216
266
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/semver.js
217
- var require_semver = __commonJS({
218
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/semver.js"(exports, module2) {
219
- "use strict";
220
- var debug = require_debug();
221
- var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
222
- var { safeRe: re, t } = require_re();
223
- var parseOptions = require_parse_options();
224
- var { compareIdentifiers } = require_identifiers();
225
- var isPrereleaseIdentifier = (prerelease2, identifier) => {
226
- const identifiers = identifier.split(".");
227
- if (identifiers.length > prerelease2.length) {
228
- return false;
229
- }
230
- for (let i = 0; i < identifiers.length; i++) {
231
- if (compareIdentifiers(prerelease2[i], identifiers[i]) !== 0) {
232
- return false;
233
- }
234
- }
235
- return true;
236
- };
237
- var SemVer = class _SemVer {
238
- constructor(version, options) {
239
- options = parseOptions(options);
240
- if (version instanceof _SemVer) {
241
- if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
242
- return version;
243
- } else {
244
- version = version.version;
245
- }
246
- } else if (typeof version !== "string") {
247
- throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
248
- }
249
- if (version.length > MAX_LENGTH) {
250
- throw new TypeError(
251
- `version is longer than ${MAX_LENGTH} characters`
252
- );
253
- }
254
- debug("SemVer", version, options);
255
- this.options = options;
256
- this.loose = !!options.loose;
257
- this.includePrerelease = !!options.includePrerelease;
258
- const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
259
- if (!m) {
260
- throw new TypeError(`Invalid Version: ${version}`);
261
- }
262
- this.raw = version;
263
- this.major = +m[1];
264
- this.minor = +m[2];
265
- this.patch = +m[3];
266
- if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
267
- throw new TypeError("Invalid major version");
268
- }
269
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
270
- throw new TypeError("Invalid minor version");
271
- }
272
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
273
- throw new TypeError("Invalid patch version");
274
- }
275
- if (!m[4]) {
276
- this.prerelease = [];
277
- } else {
278
- this.prerelease = m[4].split(".").map((id) => {
279
- if (/^[0-9]+$/.test(id)) {
280
- const num = +id;
281
- if (num >= 0 && num < MAX_SAFE_INTEGER) {
282
- return num;
283
- }
284
- }
285
- return id;
286
- });
287
- }
288
- this.build = m[5] ? m[5].split(".") : [];
289
- this.format();
290
- }
291
- format() {
292
- this.version = `${this.major}.${this.minor}.${this.patch}`;
293
- if (this.prerelease.length) {
294
- this.version += `-${this.prerelease.join(".")}`;
295
- }
296
- return this.version;
297
- }
298
- toString() {
299
- return this.version;
300
- }
301
- compare(other) {
302
- debug("SemVer.compare", this.version, this.options, other);
303
- if (!(other instanceof _SemVer)) {
304
- if (typeof other === "string" && other === this.version) {
305
- return 0;
306
- }
307
- other = new _SemVer(other, this.options);
308
- }
309
- if (other.version === this.version) {
310
- return 0;
311
- }
312
- return this.compareMain(other) || this.comparePre(other);
313
- }
314
- compareMain(other) {
315
- if (!(other instanceof _SemVer)) {
316
- other = new _SemVer(other, this.options);
317
- }
318
- if (this.major < other.major) {
319
- return -1;
320
- }
321
- if (this.major > other.major) {
322
- return 1;
323
- }
324
- if (this.minor < other.minor) {
325
- return -1;
326
- }
327
- if (this.minor > other.minor) {
328
- return 1;
329
- }
330
- if (this.patch < other.patch) {
331
- return -1;
332
- }
333
- if (this.patch > other.patch) {
334
- return 1;
335
- }
336
- return 0;
337
- }
338
- comparePre(other) {
339
- if (!(other instanceof _SemVer)) {
340
- other = new _SemVer(other, this.options);
341
- }
342
- if (this.prerelease.length && !other.prerelease.length) {
343
- return -1;
344
- } else if (!this.prerelease.length && other.prerelease.length) {
345
- return 1;
346
- } else if (!this.prerelease.length && !other.prerelease.length) {
347
- return 0;
348
- }
349
- let i = 0;
350
- do {
351
- const a = this.prerelease[i];
352
- const b = other.prerelease[i];
353
- debug("prerelease compare", i, a, b);
354
- if (a === void 0 && b === void 0) {
355
- return 0;
356
- } else if (b === void 0) {
357
- return 1;
358
- } else if (a === void 0) {
359
- return -1;
360
- } else if (a === b) {
361
- continue;
362
- } else {
363
- return compareIdentifiers(a, b);
364
- }
365
- } while (++i);
366
- }
367
- compareBuild(other) {
368
- if (!(other instanceof _SemVer)) {
369
- other = new _SemVer(other, this.options);
370
- }
371
- let i = 0;
372
- do {
373
- const a = this.build[i];
374
- const b = other.build[i];
375
- debug("build compare", i, a, b);
376
- if (a === void 0 && b === void 0) {
377
- return 0;
378
- } else if (b === void 0) {
379
- return 1;
380
- } else if (a === void 0) {
381
- return -1;
382
- } else if (a === b) {
383
- continue;
384
- } else {
385
- return compareIdentifiers(a, b);
386
- }
387
- } while (++i);
388
- }
389
- // preminor will bump the version up to the next minor release, and immediately
390
- // down to pre-release. premajor and prepatch work the same way.
391
- inc(release, identifier, identifierBase) {
392
- if (release.startsWith("pre")) {
393
- if (!identifier && identifierBase === false) {
394
- throw new Error("invalid increment argument: identifier is empty");
395
- }
396
- if (identifier) {
397
- const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
398
- if (!match || match[1] !== identifier) {
399
- throw new Error(`invalid identifier: ${identifier}`);
400
- }
401
- }
402
- }
403
- switch (release) {
404
- case "premajor":
405
- this.prerelease.length = 0;
406
- this.patch = 0;
407
- this.minor = 0;
408
- this.major++;
409
- this.inc("pre", identifier, identifierBase);
410
- break;
411
- case "preminor":
412
- this.prerelease.length = 0;
413
- this.patch = 0;
414
- this.minor++;
415
- this.inc("pre", identifier, identifierBase);
416
- break;
417
- case "prepatch":
418
- this.prerelease.length = 0;
419
- this.inc("patch", identifier, identifierBase);
420
- this.inc("pre", identifier, identifierBase);
421
- break;
422
- // If the input is a non-prerelease version, this acts the same as
423
- // prepatch.
424
- case "prerelease":
425
- if (this.prerelease.length === 0) {
426
- this.inc("patch", identifier, identifierBase);
427
- }
428
- this.inc("pre", identifier, identifierBase);
429
- break;
430
- case "release":
431
- if (this.prerelease.length === 0) {
432
- throw new Error(`version ${this.raw} is not a prerelease`);
433
- }
434
- this.prerelease.length = 0;
435
- break;
436
- case "major":
437
- if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
438
- this.major++;
439
- }
440
- this.minor = 0;
441
- this.patch = 0;
442
- this.prerelease = [];
443
- break;
444
- case "minor":
445
- if (this.patch !== 0 || this.prerelease.length === 0) {
446
- this.minor++;
447
- }
448
- this.patch = 0;
449
- this.prerelease = [];
450
- break;
451
- case "patch":
452
- if (this.prerelease.length === 0) {
453
- this.patch++;
454
- }
455
- this.prerelease = [];
456
- break;
457
- // This probably shouldn't be used publicly.
458
- // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
459
- case "pre": {
460
- const base = Number(identifierBase) ? 1 : 0;
461
- if (this.prerelease.length === 0) {
462
- this.prerelease = [base];
463
- } else {
464
- let i = this.prerelease.length;
465
- while (--i >= 0) {
466
- if (typeof this.prerelease[i] === "number") {
467
- this.prerelease[i]++;
468
- i = -2;
469
- }
470
- }
471
- if (i === -1) {
472
- if (identifier === this.prerelease.join(".") && identifierBase === false) {
473
- throw new Error("invalid increment argument: identifier already exists");
474
- }
475
- this.prerelease.push(base);
476
- }
477
- }
478
- if (identifier) {
479
- let prerelease2 = [identifier, base];
480
- if (identifierBase === false) {
481
- prerelease2 = [identifier];
482
- }
483
- if (isPrereleaseIdentifier(this.prerelease, identifier)) {
484
- const prereleaseBase = this.prerelease[identifier.split(".").length];
485
- if (isNaN(prereleaseBase)) {
486
- this.prerelease = prerelease2;
487
- }
488
- } else {
489
- this.prerelease = prerelease2;
490
- }
491
- }
492
- break;
493
- }
494
- default:
495
- throw new Error(`invalid increment argument: ${release}`);
496
- }
497
- this.raw = this.format();
498
- if (this.build.length) {
499
- this.raw += `+${this.build.join(".")}`;
500
- }
501
- return this;
502
- }
503
- };
504
- module2.exports = SemVer;
505
- }
506
- });
507
-
267
+ var require_semver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
268
+ var debug = require_debug();
269
+ var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
270
+ var { safeRe: re, t } = require_re();
271
+ var parseOptions = require_parse_options();
272
+ var { compareIdentifiers } = require_identifiers();
273
+ var isPrereleaseIdentifier = (prerelease, identifier) => {
274
+ const identifiers = identifier.split(".");
275
+ if (identifiers.length > prerelease.length) return false;
276
+ for (let i = 0; i < identifiers.length; i++) if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) return false;
277
+ return true;
278
+ };
279
+ module.exports = class SemVer {
280
+ constructor(version, options) {
281
+ options = parseOptions(options);
282
+ if (version instanceof SemVer) {
283
+ if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
284
+ else version = version.version;
285
+ } else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
286
+ if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
287
+ debug("SemVer", version, options);
288
+ this.options = options;
289
+ this.loose = !!options.loose;
290
+ this.includePrerelease = !!options.includePrerelease;
291
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
292
+ if (!m) throw new TypeError(`Invalid Version: ${version}`);
293
+ this.raw = version;
294
+ this.major = +m[1];
295
+ this.minor = +m[2];
296
+ this.patch = +m[3];
297
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
298
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
299
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
300
+ if (!m[4]) this.prerelease = [];
301
+ else this.prerelease = m[4].split(".").map((id) => {
302
+ if (/^[0-9]+$/.test(id)) {
303
+ const num = +id;
304
+ if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
305
+ }
306
+ return id;
307
+ });
308
+ this.build = m[5] ? m[5].split(".") : [];
309
+ this.format();
310
+ }
311
+ format() {
312
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
313
+ if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
314
+ return this.version;
315
+ }
316
+ toString() {
317
+ return this.version;
318
+ }
319
+ compare(other) {
320
+ debug("SemVer.compare", this.version, this.options, other);
321
+ if (!(other instanceof SemVer)) {
322
+ if (typeof other === "string" && other === this.version) return 0;
323
+ other = new SemVer(other, this.options);
324
+ }
325
+ if (other.version === this.version) return 0;
326
+ return this.compareMain(other) || this.comparePre(other);
327
+ }
328
+ compareMain(other) {
329
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
330
+ if (this.major < other.major) return -1;
331
+ if (this.major > other.major) return 1;
332
+ if (this.minor < other.minor) return -1;
333
+ if (this.minor > other.minor) return 1;
334
+ if (this.patch < other.patch) return -1;
335
+ if (this.patch > other.patch) return 1;
336
+ return 0;
337
+ }
338
+ comparePre(other) {
339
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
340
+ if (this.prerelease.length && !other.prerelease.length) return -1;
341
+ else if (!this.prerelease.length && other.prerelease.length) return 1;
342
+ else if (!this.prerelease.length && !other.prerelease.length) return 0;
343
+ let i = 0;
344
+ do {
345
+ const a = this.prerelease[i];
346
+ const b = other.prerelease[i];
347
+ debug("prerelease compare", i, a, b);
348
+ if (a === void 0 && b === void 0) return 0;
349
+ else if (b === void 0) return 1;
350
+ else if (a === void 0) return -1;
351
+ else if (a === b) continue;
352
+ else return compareIdentifiers(a, b);
353
+ } while (++i);
354
+ }
355
+ compareBuild(other) {
356
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
357
+ let i = 0;
358
+ do {
359
+ const a = this.build[i];
360
+ const b = other.build[i];
361
+ debug("build compare", i, a, b);
362
+ if (a === void 0 && b === void 0) return 0;
363
+ else if (b === void 0) return 1;
364
+ else if (a === void 0) return -1;
365
+ else if (a === b) continue;
366
+ else return compareIdentifiers(a, b);
367
+ } while (++i);
368
+ }
369
+ inc(release, identifier, identifierBase) {
370
+ if (release.startsWith("pre")) {
371
+ if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
372
+ if (identifier) {
373
+ const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
374
+ if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
375
+ }
376
+ }
377
+ switch (release) {
378
+ case "premajor":
379
+ this.prerelease.length = 0;
380
+ this.patch = 0;
381
+ this.minor = 0;
382
+ this.major++;
383
+ this.inc("pre", identifier, identifierBase);
384
+ break;
385
+ case "preminor":
386
+ this.prerelease.length = 0;
387
+ this.patch = 0;
388
+ this.minor++;
389
+ this.inc("pre", identifier, identifierBase);
390
+ break;
391
+ case "prepatch":
392
+ this.prerelease.length = 0;
393
+ this.inc("patch", identifier, identifierBase);
394
+ this.inc("pre", identifier, identifierBase);
395
+ break;
396
+ case "prerelease":
397
+ if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
398
+ this.inc("pre", identifier, identifierBase);
399
+ break;
400
+ case "release":
401
+ if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
402
+ this.prerelease.length = 0;
403
+ break;
404
+ case "major":
405
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
406
+ this.minor = 0;
407
+ this.patch = 0;
408
+ this.prerelease = [];
409
+ break;
410
+ case "minor":
411
+ if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
412
+ this.patch = 0;
413
+ this.prerelease = [];
414
+ break;
415
+ case "patch":
416
+ if (this.prerelease.length === 0) this.patch++;
417
+ this.prerelease = [];
418
+ break;
419
+ case "pre": {
420
+ const base = Number(identifierBase) ? 1 : 0;
421
+ if (this.prerelease.length === 0) this.prerelease = [base];
422
+ else {
423
+ let i = this.prerelease.length;
424
+ while (--i >= 0) if (typeof this.prerelease[i] === "number") {
425
+ this.prerelease[i]++;
426
+ i = -2;
427
+ }
428
+ if (i === -1) {
429
+ if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
430
+ this.prerelease.push(base);
431
+ }
432
+ }
433
+ if (identifier) {
434
+ let prerelease = [identifier, base];
435
+ if (identifierBase === false) prerelease = [identifier];
436
+ if (isPrereleaseIdentifier(this.prerelease, identifier)) {
437
+ const prereleaseBase = this.prerelease[identifier.split(".").length];
438
+ if (isNaN(prereleaseBase)) this.prerelease = prerelease;
439
+ } else this.prerelease = prerelease;
440
+ }
441
+ break;
442
+ }
443
+ default: throw new Error(`invalid increment argument: ${release}`);
444
+ }
445
+ this.raw = this.format();
446
+ if (this.build.length) this.raw += `+${this.build.join(".")}`;
447
+ return this;
448
+ }
449
+ };
450
+ }));
508
451
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare.js
509
- var require_compare = __commonJS({
510
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare.js"(exports, module2) {
511
- "use strict";
512
- var SemVer = require_semver();
513
- var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
514
- module2.exports = compare;
515
- }
516
- });
517
-
452
+ var require_compare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
453
+ var SemVer = require_semver();
454
+ var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
455
+ module.exports = compare;
456
+ }));
518
457
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gt.js
519
- var require_gt = __commonJS({
520
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gt.js"(exports, module2) {
521
- "use strict";
522
- var compare = require_compare();
523
- var gt2 = (a, b, loose) => compare(a, b, loose) > 0;
524
- module2.exports = gt2;
525
- }
526
- });
527
-
458
+ var require_gt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
459
+ var compare = require_compare();
460
+ var gt = (a, b, loose) => compare(a, b, loose) > 0;
461
+ module.exports = gt;
462
+ }));
528
463
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/parse.js
529
- var require_parse = __commonJS({
530
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/parse.js"(exports, module2) {
531
- "use strict";
532
- var SemVer = require_semver();
533
- var parse = (version, options, throwErrors = false) => {
534
- if (version instanceof SemVer) {
535
- return version;
536
- }
537
- try {
538
- return new SemVer(version, options);
539
- } catch (er) {
540
- if (!throwErrors) {
541
- return null;
542
- }
543
- throw er;
544
- }
545
- };
546
- module2.exports = parse;
547
- }
548
- });
549
-
464
+ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
465
+ var SemVer = require_semver();
466
+ var parse = (version, options, throwErrors = false) => {
467
+ if (version instanceof SemVer) return version;
468
+ try {
469
+ return new SemVer(version, options);
470
+ } catch (er) {
471
+ if (!throwErrors) return null;
472
+ throw er;
473
+ }
474
+ };
475
+ module.exports = parse;
476
+ }));
550
477
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/prerelease.js
551
- var require_prerelease = __commonJS({
552
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/prerelease.js"(exports, module2) {
553
- "use strict";
554
- var parse = require_parse();
555
- var prerelease2 = (version, options) => {
556
- const parsed = parse(version, options);
557
- return parsed && parsed.prerelease.length ? parsed.prerelease : null;
558
- };
559
- module2.exports = prerelease2;
560
- }
561
- });
562
-
478
+ var require_prerelease = /* @__PURE__ */ __commonJSMin(((exports, module) => {
479
+ var parse = require_parse();
480
+ var prerelease = (version, options) => {
481
+ const parsed = parse(version, options);
482
+ return parsed && parsed.prerelease.length ? parsed.prerelease : null;
483
+ };
484
+ module.exports = prerelease;
485
+ }));
563
486
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/rcompare.js
564
- var require_rcompare = __commonJS({
565
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/rcompare.js"(exports, module2) {
566
- "use strict";
567
- var compare = require_compare();
568
- var rcompare2 = (a, b, loose) => compare(b, a, loose);
569
- module2.exports = rcompare2;
570
- }
571
- });
572
-
487
+ var require_rcompare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
488
+ var compare = require_compare();
489
+ var rcompare = (a, b, loose) => compare(b, a, loose);
490
+ module.exports = rcompare;
491
+ }));
573
492
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/lrucache.js
574
- var require_lrucache = __commonJS({
575
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/lrucache.js"(exports, module2) {
576
- "use strict";
577
- var LRUCache = class {
578
- constructor() {
579
- this.max = 1e3;
580
- this.map = /* @__PURE__ */ new Map();
581
- }
582
- get(key) {
583
- const value = this.map.get(key);
584
- if (value === void 0) {
585
- return void 0;
586
- } else {
587
- this.map.delete(key);
588
- this.map.set(key, value);
589
- return value;
590
- }
591
- }
592
- delete(key) {
593
- return this.map.delete(key);
594
- }
595
- set(key, value) {
596
- const deleted = this.delete(key);
597
- if (!deleted && value !== void 0) {
598
- if (this.map.size >= this.max) {
599
- const firstKey = this.map.keys().next().value;
600
- this.delete(firstKey);
601
- }
602
- this.map.set(key, value);
603
- }
604
- return this;
605
- }
606
- };
607
- module2.exports = LRUCache;
608
- }
609
- });
610
-
493
+ var require_lrucache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
494
+ var LRUCache = class {
495
+ constructor() {
496
+ this.max = 1e3;
497
+ this.map = /* @__PURE__ */ new Map();
498
+ }
499
+ get(key) {
500
+ const value = this.map.get(key);
501
+ if (value === void 0) return;
502
+ else {
503
+ this.map.delete(key);
504
+ this.map.set(key, value);
505
+ return value;
506
+ }
507
+ }
508
+ delete(key) {
509
+ return this.map.delete(key);
510
+ }
511
+ set(key, value) {
512
+ if (!this.delete(key) && value !== void 0) {
513
+ if (this.map.size >= this.max) {
514
+ const firstKey = this.map.keys().next().value;
515
+ this.delete(firstKey);
516
+ }
517
+ this.map.set(key, value);
518
+ }
519
+ return this;
520
+ }
521
+ };
522
+ module.exports = LRUCache;
523
+ }));
611
524
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/eq.js
612
- var require_eq = __commonJS({
613
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/eq.js"(exports, module2) {
614
- "use strict";
615
- var compare = require_compare();
616
- var eq = (a, b, loose) => compare(a, b, loose) === 0;
617
- module2.exports = eq;
618
- }
619
- });
620
-
525
+ var require_eq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
526
+ var compare = require_compare();
527
+ var eq = (a, b, loose) => compare(a, b, loose) === 0;
528
+ module.exports = eq;
529
+ }));
621
530
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/neq.js
622
- var require_neq = __commonJS({
623
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/neq.js"(exports, module2) {
624
- "use strict";
625
- var compare = require_compare();
626
- var neq = (a, b, loose) => compare(a, b, loose) !== 0;
627
- module2.exports = neq;
628
- }
629
- });
630
-
531
+ var require_neq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
532
+ var compare = require_compare();
533
+ var neq = (a, b, loose) => compare(a, b, loose) !== 0;
534
+ module.exports = neq;
535
+ }));
631
536
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gte.js
632
- var require_gte = __commonJS({
633
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gte.js"(exports, module2) {
634
- "use strict";
635
- var compare = require_compare();
636
- var gte = (a, b, loose) => compare(a, b, loose) >= 0;
637
- module2.exports = gte;
638
- }
639
- });
640
-
537
+ var require_gte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
538
+ var compare = require_compare();
539
+ var gte = (a, b, loose) => compare(a, b, loose) >= 0;
540
+ module.exports = gte;
541
+ }));
641
542
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lt.js
642
- var require_lt = __commonJS({
643
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lt.js"(exports, module2) {
644
- "use strict";
645
- var compare = require_compare();
646
- var lt = (a, b, loose) => compare(a, b, loose) < 0;
647
- module2.exports = lt;
648
- }
649
- });
650
-
543
+ var require_lt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
544
+ var compare = require_compare();
545
+ var lt = (a, b, loose) => compare(a, b, loose) < 0;
546
+ module.exports = lt;
547
+ }));
651
548
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lte.js
652
- var require_lte = __commonJS({
653
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lte.js"(exports, module2) {
654
- "use strict";
655
- var compare = require_compare();
656
- var lte = (a, b, loose) => compare(a, b, loose) <= 0;
657
- module2.exports = lte;
658
- }
659
- });
660
-
549
+ var require_lte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
550
+ var compare = require_compare();
551
+ var lte = (a, b, loose) => compare(a, b, loose) <= 0;
552
+ module.exports = lte;
553
+ }));
661
554
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/cmp.js
662
- var require_cmp = __commonJS({
663
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/cmp.js"(exports, module2) {
664
- "use strict";
665
- var eq = require_eq();
666
- var neq = require_neq();
667
- var gt2 = require_gt();
668
- var gte = require_gte();
669
- var lt = require_lt();
670
- var lte = require_lte();
671
- var cmp = (a, op, b, loose) => {
672
- switch (op) {
673
- case "===":
674
- if (typeof a === "object") {
675
- a = a.version;
676
- }
677
- if (typeof b === "object") {
678
- b = b.version;
679
- }
680
- return a === b;
681
- case "!==":
682
- if (typeof a === "object") {
683
- a = a.version;
684
- }
685
- if (typeof b === "object") {
686
- b = b.version;
687
- }
688
- return a !== b;
689
- case "":
690
- case "=":
691
- case "==":
692
- return eq(a, b, loose);
693
- case "!=":
694
- return neq(a, b, loose);
695
- case ">":
696
- return gt2(a, b, loose);
697
- case ">=":
698
- return gte(a, b, loose);
699
- case "<":
700
- return lt(a, b, loose);
701
- case "<=":
702
- return lte(a, b, loose);
703
- default:
704
- throw new TypeError(`Invalid operator: ${op}`);
705
- }
706
- };
707
- module2.exports = cmp;
708
- }
709
- });
710
-
555
+ var require_cmp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
556
+ var eq = require_eq();
557
+ var neq = require_neq();
558
+ var gt = require_gt();
559
+ var gte = require_gte();
560
+ var lt = require_lt();
561
+ var lte = require_lte();
562
+ var cmp = (a, op, b, loose) => {
563
+ switch (op) {
564
+ case "===":
565
+ if (typeof a === "object") a = a.version;
566
+ if (typeof b === "object") b = b.version;
567
+ return a === b;
568
+ case "!==":
569
+ if (typeof a === "object") a = a.version;
570
+ if (typeof b === "object") b = b.version;
571
+ return a !== b;
572
+ case "":
573
+ case "=":
574
+ case "==": return eq(a, b, loose);
575
+ case "!=": return neq(a, b, loose);
576
+ case ">": return gt(a, b, loose);
577
+ case ">=": return gte(a, b, loose);
578
+ case "<": return lt(a, b, loose);
579
+ case "<=": return lte(a, b, loose);
580
+ default: throw new TypeError(`Invalid operator: ${op}`);
581
+ }
582
+ };
583
+ module.exports = cmp;
584
+ }));
711
585
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/comparator.js
712
- var require_comparator = __commonJS({
713
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/comparator.js"(exports, module2) {
714
- "use strict";
715
- var ANY = /* @__PURE__ */ Symbol("SemVer ANY");
716
- var Comparator = class _Comparator {
717
- static get ANY() {
718
- return ANY;
719
- }
720
- constructor(comp, options) {
721
- options = parseOptions(options);
722
- if (comp instanceof _Comparator) {
723
- if (comp.loose === !!options.loose) {
724
- return comp;
725
- } else {
726
- comp = comp.value;
727
- }
728
- }
729
- comp = comp.trim().split(/\s+/).join(" ");
730
- debug("comparator", comp, options);
731
- this.options = options;
732
- this.loose = !!options.loose;
733
- this.parse(comp);
734
- if (this.semver === ANY) {
735
- this.value = "";
736
- } else {
737
- this.value = this.operator + this.semver.version;
738
- }
739
- debug("comp", this);
740
- }
741
- parse(comp) {
742
- const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
743
- const m = comp.match(r);
744
- if (!m) {
745
- throw new TypeError(`Invalid comparator: ${comp}`);
746
- }
747
- this.operator = m[1] !== void 0 ? m[1] : "";
748
- if (this.operator === "=") {
749
- this.operator = "";
750
- }
751
- if (!m[2]) {
752
- this.semver = ANY;
753
- } else {
754
- this.semver = new SemVer(m[2], this.options.loose);
755
- }
756
- }
757
- toString() {
758
- return this.value;
759
- }
760
- test(version) {
761
- debug("Comparator.test", version, this.options.loose);
762
- if (this.semver === ANY || version === ANY) {
763
- return true;
764
- }
765
- if (typeof version === "string") {
766
- try {
767
- version = new SemVer(version, this.options);
768
- } catch (er) {
769
- return false;
770
- }
771
- }
772
- return cmp(version, this.operator, this.semver, this.options);
773
- }
774
- intersects(comp, options) {
775
- if (!(comp instanceof _Comparator)) {
776
- throw new TypeError("a Comparator is required");
777
- }
778
- if (this.operator === "") {
779
- if (this.value === "") {
780
- return true;
781
- }
782
- return new Range(comp.value, options).test(this.value);
783
- } else if (comp.operator === "") {
784
- if (comp.value === "") {
785
- return true;
786
- }
787
- return new Range(this.value, options).test(comp.semver);
788
- }
789
- options = parseOptions(options);
790
- if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
791
- return false;
792
- }
793
- if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
794
- return false;
795
- }
796
- if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
797
- return true;
798
- }
799
- if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
800
- return true;
801
- }
802
- if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
803
- return true;
804
- }
805
- if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
806
- return true;
807
- }
808
- if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
809
- return true;
810
- }
811
- return false;
812
- }
813
- };
814
- module2.exports = Comparator;
815
- var parseOptions = require_parse_options();
816
- var { safeRe: re, t } = require_re();
817
- var cmp = require_cmp();
818
- var debug = require_debug();
819
- var SemVer = require_semver();
820
- var Range = require_range();
821
- }
822
- });
823
-
586
+ var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
587
+ var ANY = Symbol("SemVer ANY");
588
+ module.exports = class Comparator {
589
+ static get ANY() {
590
+ return ANY;
591
+ }
592
+ constructor(comp, options) {
593
+ options = parseOptions(options);
594
+ if (comp instanceof Comparator) {
595
+ if (comp.loose === !!options.loose) return comp;
596
+ else comp = comp.value;
597
+ }
598
+ comp = comp.trim().split(/\s+/).join(" ");
599
+ debug("comparator", comp, options);
600
+ this.options = options;
601
+ this.loose = !!options.loose;
602
+ this.parse(comp);
603
+ if (this.semver === ANY) this.value = "";
604
+ else this.value = this.operator + this.semver.version;
605
+ debug("comp", this);
606
+ }
607
+ parse(comp) {
608
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
609
+ const m = comp.match(r);
610
+ if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
611
+ this.operator = m[1] !== void 0 ? m[1] : "";
612
+ if (this.operator === "=") this.operator = "";
613
+ if (!m[2]) this.semver = ANY;
614
+ else this.semver = new SemVer(m[2], this.options.loose);
615
+ }
616
+ toString() {
617
+ return this.value;
618
+ }
619
+ test(version) {
620
+ debug("Comparator.test", version, this.options.loose);
621
+ if (this.semver === ANY || version === ANY) return true;
622
+ if (typeof version === "string") try {
623
+ version = new SemVer(version, this.options);
624
+ } catch (er) {
625
+ return false;
626
+ }
627
+ return cmp(version, this.operator, this.semver, this.options);
628
+ }
629
+ intersects(comp, options) {
630
+ if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
631
+ if (this.operator === "") {
632
+ if (this.value === "") return true;
633
+ return new Range(comp.value, options).test(this.value);
634
+ } else if (comp.operator === "") {
635
+ if (comp.value === "") return true;
636
+ return new Range(this.value, options).test(comp.semver);
637
+ }
638
+ options = parseOptions(options);
639
+ if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
640
+ if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
641
+ if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
642
+ if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
643
+ if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
644
+ if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
645
+ if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
646
+ return false;
647
+ }
648
+ };
649
+ var parseOptions = require_parse_options();
650
+ var { safeRe: re, t } = require_re();
651
+ var cmp = require_cmp();
652
+ var debug = require_debug();
653
+ var SemVer = require_semver();
654
+ var Range = require_range();
655
+ }));
824
656
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/range.js
825
- var require_range = __commonJS({
826
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/range.js"(exports, module2) {
827
- "use strict";
828
- var SPACE_CHARACTERS = /\s+/g;
829
- var Range = class _Range {
830
- constructor(range, options) {
831
- options = parseOptions(options);
832
- if (range instanceof _Range) {
833
- if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
834
- return range;
835
- } else {
836
- return new _Range(range.raw, options);
837
- }
838
- }
839
- if (range instanceof Comparator) {
840
- this.raw = range.value;
841
- this.set = [[range]];
842
- this.formatted = void 0;
843
- return this;
844
- }
845
- this.options = options;
846
- this.loose = !!options.loose;
847
- this.includePrerelease = !!options.includePrerelease;
848
- this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
849
- this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
850
- if (!this.set.length) {
851
- throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
852
- }
853
- if (this.set.length > 1) {
854
- const first = this.set[0];
855
- this.set = this.set.filter((c) => !isNullSet(c[0]));
856
- if (this.set.length === 0) {
857
- this.set = [first];
858
- } else if (this.set.length > 1) {
859
- for (const c of this.set) {
860
- if (c.length === 1 && isAny(c[0])) {
861
- this.set = [c];
862
- break;
863
- }
864
- }
865
- }
866
- }
867
- this.formatted = void 0;
868
- }
869
- get range() {
870
- if (this.formatted === void 0) {
871
- this.formatted = "";
872
- for (let i = 0; i < this.set.length; i++) {
873
- if (i > 0) {
874
- this.formatted += "||";
875
- }
876
- const comps = this.set[i];
877
- for (let k = 0; k < comps.length; k++) {
878
- if (k > 0) {
879
- this.formatted += " ";
880
- }
881
- this.formatted += comps[k].toString().trim();
882
- }
883
- }
884
- }
885
- return this.formatted;
886
- }
887
- format() {
888
- return this.range;
889
- }
890
- toString() {
891
- return this.range;
892
- }
893
- parseRange(range) {
894
- range = range.replace(BUILDSTRIPRE, "");
895
- const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
896
- const memoKey = memoOpts + ":" + range;
897
- const cached = cache.get(memoKey);
898
- if (cached) {
899
- return cached;
900
- }
901
- const loose = this.options.loose;
902
- const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
903
- range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
904
- debug("hyphen replace", range);
905
- range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
906
- debug("comparator trim", range);
907
- range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
908
- debug("tilde trim", range);
909
- range = range.replace(re[t.CARETTRIM], caretTrimReplace);
910
- debug("caret trim", range);
911
- let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
912
- if (loose) {
913
- rangeList = rangeList.filter((comp) => {
914
- debug("loose invalid filter", comp, this.options);
915
- return !!comp.match(re[t.COMPARATORLOOSE]);
916
- });
917
- }
918
- debug("range list", rangeList);
919
- const rangeMap = /* @__PURE__ */ new Map();
920
- const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
921
- for (const comp of comparators) {
922
- if (isNullSet(comp)) {
923
- return [comp];
924
- }
925
- rangeMap.set(comp.value, comp);
926
- }
927
- if (rangeMap.size > 1 && rangeMap.has("")) {
928
- rangeMap.delete("");
929
- }
930
- const result = [...rangeMap.values()];
931
- cache.set(memoKey, result);
932
- return result;
933
- }
934
- intersects(range, options) {
935
- if (!(range instanceof _Range)) {
936
- throw new TypeError("a Range is required");
937
- }
938
- return this.set.some((thisComparators) => {
939
- return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
940
- return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
941
- return rangeComparators.every((rangeComparator) => {
942
- return thisComparator.intersects(rangeComparator, options);
943
- });
944
- });
945
- });
946
- });
947
- }
948
- // if ANY of the sets match ALL of its comparators, then pass
949
- test(version) {
950
- if (!version) {
951
- return false;
952
- }
953
- if (typeof version === "string") {
954
- try {
955
- version = new SemVer(version, this.options);
956
- } catch (er) {
957
- return false;
958
- }
959
- }
960
- for (let i = 0; i < this.set.length; i++) {
961
- if (testSet(this.set[i], version, this.options)) {
962
- return true;
963
- }
964
- }
965
- return false;
966
- }
967
- };
968
- module2.exports = Range;
969
- var LRU = require_lrucache();
970
- var cache = new LRU();
971
- var parseOptions = require_parse_options();
972
- var Comparator = require_comparator();
973
- var debug = require_debug();
974
- var SemVer = require_semver();
975
- var {
976
- safeRe: re,
977
- src,
978
- t,
979
- comparatorTrimReplace,
980
- tildeTrimReplace,
981
- caretTrimReplace
982
- } = require_re();
983
- var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
984
- var BUILDSTRIPRE = new RegExp(src[t.BUILD], "g");
985
- var isNullSet = (c) => c.value === "<0.0.0-0";
986
- var isAny = (c) => c.value === "";
987
- var isSatisfiable = (comparators, options) => {
988
- let result = true;
989
- const remainingComparators = comparators.slice();
990
- let testComparator = remainingComparators.pop();
991
- while (result && remainingComparators.length) {
992
- result = remainingComparators.every((otherComparator) => {
993
- return testComparator.intersects(otherComparator, options);
994
- });
995
- testComparator = remainingComparators.pop();
996
- }
997
- return result;
998
- };
999
- var parseComparator = (comp, options) => {
1000
- comp = comp.replace(re[t.BUILD], "");
1001
- debug("comp", comp, options);
1002
- comp = replaceCarets(comp, options);
1003
- debug("caret", comp);
1004
- comp = replaceTildes(comp, options);
1005
- debug("tildes", comp);
1006
- comp = replaceXRanges(comp, options);
1007
- debug("xrange", comp);
1008
- comp = replaceStars(comp, options);
1009
- debug("stars", comp);
1010
- return comp;
1011
- };
1012
- var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
1013
- var invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p);
1014
- var replaceTildes = (comp, options) => {
1015
- return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
1016
- };
1017
- var replaceTilde = (comp, options) => {
1018
- const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1019
- const z = options.includePrerelease ? "-0" : "";
1020
- return comp.replace(r, (_, M, m, p, pr) => {
1021
- debug("tilde", comp, _, M, m, p, pr);
1022
- let ret;
1023
- if (isX(M)) {
1024
- ret = "";
1025
- } else if (isX(m)) {
1026
- ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
1027
- } else if (isX(p)) {
1028
- ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
1029
- } else if (pr) {
1030
- debug("replaceTilde pr", pr);
1031
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1032
- } else {
1033
- ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
1034
- }
1035
- debug("tilde return", ret);
1036
- return ret;
1037
- });
1038
- };
1039
- var replaceCarets = (comp, options) => {
1040
- return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
1041
- };
1042
- var replaceCaret = (comp, options) => {
1043
- debug("caret", comp, options);
1044
- const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
1045
- const z = options.includePrerelease ? "-0" : "";
1046
- return comp.replace(r, (_, M, m, p, pr) => {
1047
- debug("caret", comp, _, M, m, p, pr);
1048
- let ret;
1049
- if (isX(M)) {
1050
- ret = "";
1051
- } else if (isX(m)) {
1052
- ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
1053
- } else if (isX(p)) {
1054
- if (M === "0") {
1055
- ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
1056
- } else {
1057
- ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
1058
- }
1059
- } else if (pr) {
1060
- debug("replaceCaret pr", pr);
1061
- if (M === "0") {
1062
- if (m === "0") {
1063
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
1064
- } else {
1065
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1066
- }
1067
- } else {
1068
- ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
1069
- }
1070
- } else {
1071
- debug("no pr");
1072
- if (M === "0") {
1073
- if (m === "0") {
1074
- ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
1075
- } else {
1076
- ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
1077
- }
1078
- } else {
1079
- ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
1080
- }
1081
- }
1082
- debug("caret return", ret);
1083
- return ret;
1084
- });
1085
- };
1086
- var replaceXRanges = (comp, options) => {
1087
- debug("replaceXRanges", comp, options);
1088
- return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
1089
- };
1090
- var replaceXRange = (comp, options) => {
1091
- comp = comp.trim();
1092
- const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
1093
- return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
1094
- debug("xRange", comp, ret, gtlt, M, m, p, pr);
1095
- if (invalidXRangeOrder(M, m, p)) {
1096
- return comp;
1097
- }
1098
- const xM = isX(M);
1099
- const xm = xM || isX(m);
1100
- const xp = xm || isX(p);
1101
- const anyX = xp;
1102
- if (gtlt === "=" && anyX) {
1103
- gtlt = "";
1104
- }
1105
- pr = options.includePrerelease ? "-0" : "";
1106
- if (xM) {
1107
- if (gtlt === ">" || gtlt === "<") {
1108
- ret = "<0.0.0-0";
1109
- } else {
1110
- ret = "*";
1111
- }
1112
- } else if (gtlt && anyX) {
1113
- if (xm) {
1114
- m = 0;
1115
- }
1116
- p = 0;
1117
- if (gtlt === ">") {
1118
- gtlt = ">=";
1119
- if (xm) {
1120
- M = +M + 1;
1121
- m = 0;
1122
- p = 0;
1123
- } else {
1124
- m = +m + 1;
1125
- p = 0;
1126
- }
1127
- } else if (gtlt === "<=") {
1128
- gtlt = "<";
1129
- if (xm) {
1130
- M = +M + 1;
1131
- } else {
1132
- m = +m + 1;
1133
- }
1134
- }
1135
- if (gtlt === "<") {
1136
- pr = "-0";
1137
- }
1138
- ret = `${gtlt + M}.${m}.${p}${pr}`;
1139
- } else if (xm) {
1140
- ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
1141
- } else if (xp) {
1142
- ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
1143
- }
1144
- debug("xRange return", ret);
1145
- return ret;
1146
- });
1147
- };
1148
- var replaceStars = (comp, options) => {
1149
- debug("replaceStars", comp, options);
1150
- return comp.trim().replace(re[t.STAR], "");
1151
- };
1152
- var replaceGTE0 = (comp, options) => {
1153
- debug("replaceGTE0", comp, options);
1154
- return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
1155
- };
1156
- var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
1157
- if (isX(fM)) {
1158
- from = "";
1159
- } else if (isX(fm)) {
1160
- from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
1161
- } else if (isX(fp)) {
1162
- from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
1163
- } else if (fpr) {
1164
- from = `>=${from}`;
1165
- } else {
1166
- from = `>=${from}${incPr ? "-0" : ""}`;
1167
- }
1168
- if (isX(tM)) {
1169
- to = "";
1170
- } else if (isX(tm)) {
1171
- to = `<${+tM + 1}.0.0-0`;
1172
- } else if (isX(tp)) {
1173
- to = `<${tM}.${+tm + 1}.0-0`;
1174
- } else if (tpr) {
1175
- to = `<=${tM}.${tm}.${tp}-${tpr}`;
1176
- } else if (incPr) {
1177
- to = `<${tM}.${tm}.${+tp + 1}-0`;
1178
- } else {
1179
- to = `<=${to}`;
1180
- }
1181
- return `${from} ${to}`.trim();
1182
- };
1183
- var testSet = (set, version, options) => {
1184
- for (let i = 0; i < set.length; i++) {
1185
- if (!set[i].test(version)) {
1186
- return false;
1187
- }
1188
- }
1189
- if (version.prerelease.length && !options.includePrerelease) {
1190
- for (let i = 0; i < set.length; i++) {
1191
- debug(set[i].semver);
1192
- if (set[i].semver === Comparator.ANY) {
1193
- continue;
1194
- }
1195
- if (set[i].semver.prerelease.length > 0) {
1196
- const allowed = set[i].semver;
1197
- if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
1198
- return true;
1199
- }
1200
- }
1201
- }
1202
- return false;
1203
- }
1204
- return true;
1205
- };
1206
- }
1207
- });
1208
-
657
+ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
658
+ var SPACE_CHARACTERS = /\s+/g;
659
+ module.exports = class Range {
660
+ constructor(range, options) {
661
+ options = parseOptions(options);
662
+ if (range instanceof Range) {
663
+ if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
664
+ else return new Range(range.raw, options);
665
+ }
666
+ if (range instanceof Comparator) {
667
+ this.raw = range.value;
668
+ this.set = [[range]];
669
+ this.formatted = void 0;
670
+ return this;
671
+ }
672
+ this.options = options;
673
+ this.loose = !!options.loose;
674
+ this.includePrerelease = !!options.includePrerelease;
675
+ this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
676
+ this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
677
+ if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
678
+ if (this.set.length > 1) {
679
+ const first = this.set[0];
680
+ this.set = this.set.filter((c) => !isNullSet(c[0]));
681
+ if (this.set.length === 0) this.set = [first];
682
+ else if (this.set.length > 1) {
683
+ for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
684
+ this.set = [c];
685
+ break;
686
+ }
687
+ }
688
+ }
689
+ this.formatted = void 0;
690
+ }
691
+ get range() {
692
+ if (this.formatted === void 0) {
693
+ this.formatted = "";
694
+ for (let i = 0; i < this.set.length; i++) {
695
+ if (i > 0) this.formatted += "||";
696
+ const comps = this.set[i];
697
+ for (let k = 0; k < comps.length; k++) {
698
+ if (k > 0) this.formatted += " ";
699
+ this.formatted += comps[k].toString().trim();
700
+ }
701
+ }
702
+ }
703
+ return this.formatted;
704
+ }
705
+ format() {
706
+ return this.range;
707
+ }
708
+ toString() {
709
+ return this.range;
710
+ }
711
+ parseRange(range) {
712
+ range = range.replace(BUILDSTRIPRE, "");
713
+ const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
714
+ const cached = cache.get(memoKey);
715
+ if (cached) return cached;
716
+ const loose = this.options.loose;
717
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
718
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
719
+ debug("hyphen replace", range);
720
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
721
+ debug("comparator trim", range);
722
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
723
+ debug("tilde trim", range);
724
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
725
+ debug("caret trim", range);
726
+ let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
727
+ if (loose) rangeList = rangeList.filter((comp) => {
728
+ debug("loose invalid filter", comp, this.options);
729
+ return !!comp.match(re[t.COMPARATORLOOSE]);
730
+ });
731
+ debug("range list", rangeList);
732
+ const rangeMap = /* @__PURE__ */ new Map();
733
+ const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
734
+ for (const comp of comparators) {
735
+ if (isNullSet(comp)) return [comp];
736
+ rangeMap.set(comp.value, comp);
737
+ }
738
+ if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
739
+ const result = [...rangeMap.values()];
740
+ cache.set(memoKey, result);
741
+ return result;
742
+ }
743
+ intersects(range, options) {
744
+ if (!(range instanceof Range)) throw new TypeError("a Range is required");
745
+ return this.set.some((thisComparators) => {
746
+ return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
747
+ return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
748
+ return rangeComparators.every((rangeComparator) => {
749
+ return thisComparator.intersects(rangeComparator, options);
750
+ });
751
+ });
752
+ });
753
+ });
754
+ }
755
+ test(version) {
756
+ if (!version) return false;
757
+ if (typeof version === "string") try {
758
+ version = new SemVer(version, this.options);
759
+ } catch (er) {
760
+ return false;
761
+ }
762
+ for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
763
+ return false;
764
+ }
765
+ };
766
+ var cache = new (require_lrucache())();
767
+ var parseOptions = require_parse_options();
768
+ var Comparator = require_comparator();
769
+ var debug = require_debug();
770
+ var SemVer = require_semver();
771
+ var { safeRe: re, src, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re();
772
+ var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
773
+ var BUILDSTRIPRE = new RegExp(src[t.BUILD], "g");
774
+ var isNullSet = (c) => c.value === "<0.0.0-0";
775
+ var isAny = (c) => c.value === "";
776
+ var isSatisfiable = (comparators, options) => {
777
+ let result = true;
778
+ const remainingComparators = comparators.slice();
779
+ let testComparator = remainingComparators.pop();
780
+ while (result && remainingComparators.length) {
781
+ result = remainingComparators.every((otherComparator) => {
782
+ return testComparator.intersects(otherComparator, options);
783
+ });
784
+ testComparator = remainingComparators.pop();
785
+ }
786
+ return result;
787
+ };
788
+ var parseComparator = (comp, options) => {
789
+ comp = comp.replace(re[t.BUILD], "");
790
+ debug("comp", comp, options);
791
+ comp = replaceCarets(comp, options);
792
+ debug("caret", comp);
793
+ comp = replaceTildes(comp, options);
794
+ debug("tildes", comp);
795
+ comp = replaceXRanges(comp, options);
796
+ debug("xrange", comp);
797
+ comp = replaceStars(comp, options);
798
+ debug("stars", comp);
799
+ return comp;
800
+ };
801
+ var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
802
+ var invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p);
803
+ var replaceTildes = (comp, options) => {
804
+ return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
805
+ };
806
+ var replaceTilde = (comp, options) => {
807
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
808
+ const z = options.includePrerelease ? "-0" : "";
809
+ return comp.replace(r, (_, M, m, p, pr) => {
810
+ debug("tilde", comp, _, M, m, p, pr);
811
+ let ret;
812
+ if (isX(M)) ret = "";
813
+ else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
814
+ else if (isX(p)) ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
815
+ else if (pr) {
816
+ debug("replaceTilde pr", pr);
817
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
818
+ } else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
819
+ debug("tilde return", ret);
820
+ return ret;
821
+ });
822
+ };
823
+ var replaceCarets = (comp, options) => {
824
+ return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
825
+ };
826
+ var replaceCaret = (comp, options) => {
827
+ debug("caret", comp, options);
828
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
829
+ const z = options.includePrerelease ? "-0" : "";
830
+ return comp.replace(r, (_, M, m, p, pr) => {
831
+ debug("caret", comp, _, M, m, p, pr);
832
+ let ret;
833
+ if (isX(M)) ret = "";
834
+ else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
835
+ else if (isX(p)) {
836
+ if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
837
+ else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
838
+ } else if (pr) {
839
+ debug("replaceCaret pr", pr);
840
+ if (M === "0") {
841
+ if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
842
+ else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
843
+ } else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
844
+ } else {
845
+ debug("no pr");
846
+ if (M === "0") {
847
+ if (m === "0") ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
848
+ else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
849
+ } else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
850
+ }
851
+ debug("caret return", ret);
852
+ return ret;
853
+ });
854
+ };
855
+ var replaceXRanges = (comp, options) => {
856
+ debug("replaceXRanges", comp, options);
857
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
858
+ };
859
+ var replaceXRange = (comp, options) => {
860
+ comp = comp.trim();
861
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
862
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
863
+ debug("xRange", comp, ret, gtlt, M, m, p, pr);
864
+ if (invalidXRangeOrder(M, m, p)) return comp;
865
+ const xM = isX(M);
866
+ const xm = xM || isX(m);
867
+ const xp = xm || isX(p);
868
+ const anyX = xp;
869
+ if (gtlt === "=" && anyX) gtlt = "";
870
+ pr = options.includePrerelease ? "-0" : "";
871
+ if (xM) {
872
+ if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
873
+ else ret = "*";
874
+ } else if (gtlt && anyX) {
875
+ if (xm) m = 0;
876
+ p = 0;
877
+ if (gtlt === ">") {
878
+ gtlt = ">=";
879
+ if (xm) {
880
+ M = +M + 1;
881
+ m = 0;
882
+ p = 0;
883
+ } else {
884
+ m = +m + 1;
885
+ p = 0;
886
+ }
887
+ } else if (gtlt === "<=") {
888
+ gtlt = "<";
889
+ if (xm) M = +M + 1;
890
+ else m = +m + 1;
891
+ }
892
+ if (gtlt === "<") pr = "-0";
893
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
894
+ } else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
895
+ else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
896
+ debug("xRange return", ret);
897
+ return ret;
898
+ });
899
+ };
900
+ var replaceStars = (comp, options) => {
901
+ debug("replaceStars", comp, options);
902
+ return comp.trim().replace(re[t.STAR], "");
903
+ };
904
+ var replaceGTE0 = (comp, options) => {
905
+ debug("replaceGTE0", comp, options);
906
+ return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
907
+ };
908
+ var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
909
+ if (isX(fM)) from = "";
910
+ else if (isX(fm)) from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
911
+ else if (isX(fp)) from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
912
+ else if (fpr) from = `>=${from}`;
913
+ else from = `>=${from}${incPr ? "-0" : ""}`;
914
+ if (isX(tM)) to = "";
915
+ else if (isX(tm)) to = `<${+tM + 1}.0.0-0`;
916
+ else if (isX(tp)) to = `<${tM}.${+tm + 1}.0-0`;
917
+ else if (tpr) to = `<=${tM}.${tm}.${tp}-${tpr}`;
918
+ else if (incPr) to = `<${tM}.${tm}.${+tp + 1}-0`;
919
+ else to = `<=${to}`;
920
+ return `${from} ${to}`.trim();
921
+ };
922
+ var testSet = (set, version, options) => {
923
+ for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
924
+ if (version.prerelease.length && !options.includePrerelease) {
925
+ for (let i = 0; i < set.length; i++) {
926
+ debug(set[i].semver);
927
+ if (set[i].semver === Comparator.ANY) continue;
928
+ if (set[i].semver.prerelease.length > 0) {
929
+ const allowed = set[i].semver;
930
+ if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
931
+ }
932
+ }
933
+ return false;
934
+ }
935
+ return true;
936
+ };
937
+ }));
1209
938
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/satisfies.js
1210
- var require_satisfies = __commonJS({
1211
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/satisfies.js"(exports, module2) {
1212
- "use strict";
1213
- var Range = require_range();
1214
- var satisfies2 = (version, range, options) => {
1215
- try {
1216
- range = new Range(range, options);
1217
- } catch (er) {
1218
- return false;
1219
- }
1220
- return range.test(version);
1221
- };
1222
- module2.exports = satisfies2;
1223
- }
1224
- });
1225
-
939
+ var require_satisfies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
940
+ var Range = require_range();
941
+ var satisfies = (version, range, options) => {
942
+ try {
943
+ range = new Range(range, options);
944
+ } catch (er) {
945
+ return false;
946
+ }
947
+ return range.test(version);
948
+ };
949
+ module.exports = satisfies;
950
+ }));
1226
951
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/valid.js
1227
- var require_valid = __commonJS({
1228
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/valid.js"(exports, module2) {
1229
- "use strict";
1230
- var parse = require_parse();
1231
- var valid2 = (version, options) => {
1232
- const v = parse(version, options);
1233
- return v ? v.version : null;
1234
- };
1235
- module2.exports = valid2;
1236
- }
1237
- });
1238
-
952
+ var require_valid$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
953
+ var parse = require_parse();
954
+ var valid = (version, options) => {
955
+ const v = parse(version, options);
956
+ return v ? v.version : null;
957
+ };
958
+ module.exports = valid;
959
+ }));
1239
960
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/valid.js
1240
- var require_valid2 = __commonJS({
1241
- "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/valid.js"(exports, module2) {
1242
- "use strict";
1243
- var Range = require_range();
1244
- var validRange2 = (range, options) => {
1245
- try {
1246
- return new Range(range, options).range || "*";
1247
- } catch (er) {
1248
- return null;
1249
- }
1250
- };
1251
- module2.exports = validRange2;
1252
- }
1253
- });
1254
-
1255
- // src/client/index.tsx
1256
- var index_exports = {};
1257
- __export(index_exports, {
1258
- apply: () => apply,
1259
- inject: () => inject,
1260
- name: () => name
1261
- });
1262
- module.exports = __toCommonJS(index_exports);
1263
-
1264
- // src/client/locale.ts
1265
- var LOCALE_NS = "dshPluginUpdates";
1266
- var ZH = {
1267
- "updateAllCount": "\u5168\u90E8\u66F4\u65B0\uFF08{count}\uFF09",
1268
- "updateLabel": "\u628A {name} \u66F4\u65B0\u5230 {version}",
1269
- "updating": "\u66F4\u65B0\u4E2D\u2026",
1270
- "updateTo": "\u66F4\u65B0\u5230 {version}",
1271
- "install": "\u5B89\u88C5",
1272
- "status.update": "\u53EF\u66F4\u65B0 {version}",
1273
- "versions.loading": "\u6B63\u5728\u8BFB\u53D6\u7248\u672C\u2026",
1274
- "version.current": "\u5F53\u524D {version}",
1275
- "versions.title": "\u7248\u672C",
1276
- "versions.registry": "\u6765\u81EA {registry}",
1277
- "versions.showAll": "\u663E\u793A\u5168\u90E8 {count} \u4E2A\u7248\u672C",
1278
- "versions.empty": "\u6CA1\u6709\u53EF\u7528\u7684\u7248\u672C\u4FE1\u606F",
1279
- "versions.failed": "\u65E0\u6CD5\u4ECE npm \u8BFB\u53D6\u7248\u672C\uFF1A{reason}",
1280
- "tag.current": "\u5F53\u524D",
1281
- "tag.prerelease": "\u9884\u53D1\u5E03",
1282
- "tag.deprecated": "\u5DF2\u5E9F\u5F03",
1283
- "tag.incompatible": "\u4E0D\u517C\u5BB9",
1284
- "tag.fresh": "\u65B0\u53D1\u5E03",
1285
- "hint.fresh": "\u53D1\u5E03\u4E0D\u8DB3 24 \u5C0F\u65F6\uFF1Apnpm \u9ED8\u8BA4\u4E0D\u5B89\u88C5\u8FD9\u4E48\u65B0\u7684\u7248\u672C\uFF0C\u5B89\u88C5\u53EF\u80FD\u5931\u8D25",
1286
- "hint.incompatible": "\u4E0E\u5F53\u524D DSH \u7248\u672C\u4E0D\u517C\u5BB9\uFF0C\u5B89\u88C5\u4F1A\u88AB\u62D2\u7EDD",
1287
- "self.body": "\u53EF\u4EE5\u66F4\u65B0\u5230 {version}\u3002\u66F4\u65B0\u5728\u5BBF\u4E3B\u540E\u53F0\u8FDB\u884C\uFF0C\u671F\u95F4\u672C\u63D2\u4EF6\u7684\u754C\u9762\u4F1A\u6682\u65F6\u6D88\u5931",
1288
- "self.confirmTitle": "\u628A\u672C\u63D2\u4EF6\u66F4\u65B0\u5230 {version}\uFF1F",
1289
- "self.confirmBody": "\u5BBF\u4E3B\u4F1A\u5148\u5378\u8F7D\u5F53\u524D\u7248\u672C\uFF0C\u518D\u5B89\u88C5\u65B0\u7248\u672C\u3002\u671F\u95F4\u63D2\u4EF6\u9875\u4E0A\u7684\u66F4\u65B0\u6309\u94AE\u4F1A\u6682\u65F6\u6D88\u5931\uFF0C\u88C5\u597D\u540E\u81EA\u52A8\u56DE\u6765\uFF1B\u65B0\u7248\u672C\u88C5\u4E0D\u4E0A\u65F6\u4F1A\u88C5\u56DE\u5F53\u524D\u7248\u672C\u3002\u5982\u679C\u8FDE\u5F53\u524D\u7248\u672C\u4E5F\u88C5\u4E0D\u56DE\uFF0C\u53EF\u4EE5\u9000\u51FA DSH \u540E\u5728\u7EC8\u7AEF\u8FD0\u884C\u4E0B\u9762\u7684\u547D\u4EE4\u624B\u52A8\u5B89\u88C5\uFF1A",
1290
- "self.cancel": "\u53D6\u6D88",
1291
- "self.copy": "\u590D\u5236\u547D\u4EE4",
1292
- "self.copied": "\u5DF2\u590D\u5236",
1293
- "error.policy": "pnpm \u5904\u7406 minimumReleaseAge \u65F6\u53D1\u751F\u5185\u90E8\u9519\u8BEF\u3002\u8BF7\u5347\u7EA7\u5BBF\u4E3B\u9644\u5E26\u7684 pnpm\uFF0C\u6216\u7B49\u53D1\u5E03\u7B49\u5F85\u671F\u7ED3\u675F\u540E\u91CD\u8BD5\uFF1B\u5B8C\u6574\u9519\u8BEF\u89C1\u4E0B\u65B9\u65E5\u5FD7",
1294
- "error.inconsistent": "\u5B89\u88C5\u58F0\u660E\u4E0E\u5B9E\u9645\u7248\u672C\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u5148\u7528\u5BBF\u4E3B\u63D2\u4EF6\u7BA1\u7406\u5668\u6216 CLI \u4FEE\u590D\u5B89\u88C5\uFF0C\u518D\u91CD\u8BD5\u66F4\u65B0",
1295
- "error.stateChanged": "\u63D2\u4EF6\u5B89\u88C5\u72B6\u6001\u5DF2\u53D8\u5316\uFF0C\u8BF7\u5237\u65B0\u63D2\u4EF6\u5217\u8868\u540E\u91CD\u8BD5",
1296
- "error.interrupted": "\u5BBF\u4E3B\u5728\u66F4\u65B0\u5B8C\u6210\u524D\u9000\u51FA\u4E86\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u5217\u8868\u91CC\u7684\u7248\u672C",
1297
- "error.selfBusy": "\u5DF2\u6709\u4E00\u4E2A\u81EA\u66F4\u65B0\u5728\u8FDB\u884C",
1298
- "op.checking": "\u6B63\u5728\u6838\u5BF9 {name} \u7684\u5B89\u88C5\u72B6\u6001\u2026",
1299
- "op.checkFailed": "\u65E0\u6CD5\u786E\u8BA4 {name} \u7684\u5B89\u88C5\u72B6\u6001\uFF0C\u5DF2\u505C\u6B62\u64CD\u4F5C\uFF1A{reason}",
1300
- "op.current": "{name} \u5DF2\u662F {to}\uFF0C\u65E0\u9700\u91CD\u590D\u5B89\u88C5",
1301
- "op.removing": "\u6B63\u5728\u5378\u8F7D {name} {from}\u2026",
1302
- "op.installing": "\u6B63\u5728\u5B89\u88C5 {name} {to}\u2026",
1303
- "op.restoring": "\u6B63\u5728\u6062\u590D {name} {to}\u2026",
1304
- "op.done": "{name} \u5DF2\u5207\u6362\u5230 {to}",
1305
- "op.restart": "{name} \u5DF2\u5207\u6362\u5230 {to}\uFF0C\u91CD\u542F DSH \u540E\u751F\u6548",
1306
- "op.failed": "{name} \u5B89\u88C5 {to} \u5931\u8D25\uFF1A{reason}",
1307
- "op.restored": "{name} \u5B89\u88C5 {to} \u5931\u8D25\uFF0C\u5DF2\u88C5\u56DE {from}\uFF1A{reason}",
1308
- "op.selfFailed": "{name} \u66F4\u65B0\u5230 {to} \u5931\u8D25\uFF1A{reason}",
1309
- "op.removeFailed": "{name} \u5378\u8F7D\u672A\u5B8C\u6210\uFF0C\u5DF2\u505C\u6B62\u540E\u7EED\u5B89\u88C5\uFF1A{reason}",
1310
- "op.restore": "\u6062\u590D {from}",
1311
- "op.dismiss": "\u5173\u95ED",
1312
- "op.log": "\u65E5\u5FD7\uFF1A{path}"
1313
- };
1314
- var EN = {
1315
- "updateAllCount": "Update all ({count})",
1316
- "updateLabel": "Update {name} to {version}",
1317
- "updating": "Updating\u2026",
1318
- "updateTo": "Update to {version}",
1319
- "install": "Install",
1320
- "status.update": "Update {version}",
1321
- "versions.loading": "Reading versions\u2026",
1322
- "version.current": "Current {version}",
1323
- "versions.title": "Versions",
1324
- "versions.registry": "From {registry}",
1325
- "versions.showAll": "Show all {count} versions",
1326
- "versions.empty": "No version information",
1327
- "versions.failed": "Could not read versions from npm: {reason}",
1328
- "tag.current": "Current",
1329
- "tag.prerelease": "Prerelease",
1330
- "tag.deprecated": "Deprecated",
1331
- "tag.incompatible": "Incompatible",
1332
- "tag.fresh": "New",
1333
- "hint.fresh": "Published less than 24 hours ago: pnpm does not install versions this new by default, so installing may fail",
1334
- "hint.incompatible": "Not compatible with this DSH version; the installation would be refused",
1335
- "self.body": "Version {version} is available. The host updates this plugin in the background, and its controls disappear meanwhile",
1336
- "self.confirmTitle": "Update this plugin to {version}?",
1337
- "self.confirmBody": "The host uninstalls the current version, then installs the new one. The update controls on the Plugins page disappear meanwhile and come back once it is installed; if the new version cannot be installed, the current one is put back. If even that fails, quit DSH and run this command in a terminal to install it by hand:",
1338
- "self.cancel": "Cancel",
1339
- "self.copy": "Copy command",
1340
- "self.copied": "Copied",
1341
- "error.policy": "pnpm hit an internal error while handling minimumReleaseAge. Upgrade the pnpm bundled with the host, or retry after the release-age waiting period; see the full error below",
1342
- "error.inconsistent": "The declared and installed versions differ. Repair the installation with the host plugin manager or CLI before retrying",
1343
- "error.stateChanged": "The installed state has changed. Refresh the plugin list and retry",
1344
- "error.interrupted": "The host stopped before the update finished; check the version in the plugin list",
1345
- "error.selfBusy": "A self-update is already running",
1346
- "op.checking": "Checking the installed version of {name}\u2026",
1347
- "op.checkFailed": "Could not confirm the installed state of {name}; stopped: {reason}",
1348
- "op.current": "{name} is already at {to}; no reinstall needed",
1349
- "op.removing": "Uninstalling {name} {from}\u2026",
1350
- "op.installing": "Installing {name} {to}\u2026",
1351
- "op.restoring": "Restoring {name} {to}\u2026",
1352
- "op.done": "{name} is now at {to}",
1353
- "op.restart": "{name} is now at {to}; restart DSH to apply it",
1354
- "op.failed": "Could not install {name} {to}: {reason}",
1355
- "op.restored": "Could not install {name} {to}; {from} was put back: {reason}",
1356
- "op.selfFailed": "Could not update {name} to {to}: {reason}",
1357
- "op.removeFailed": "Uninstalling {name} did not finish; installation was not started: {reason}",
1358
- "op.restore": "Restore {from}",
1359
- "op.dismiss": "Dismiss",
1360
- "op.log": "Log: {path}"
1361
- };
1362
-
1363
- // src/client/model.ts
1364
- var import_gt = __toESM(require_gt(), 1);
1365
- var import_prerelease = __toESM(require_prerelease(), 1);
1366
- var import_rcompare = __toESM(require_rcompare(), 1);
1367
- var import_satisfies = __toESM(require_satisfies(), 1);
1368
- var import_valid = __toESM(require_valid(), 1);
1369
- var import_valid2 = __toESM(require_valid2(), 1);
1370
-
961
+ var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
962
+ var Range = require_range();
963
+ var validRange = (range, options) => {
964
+ try {
965
+ return new Range(range, options).range || "*";
966
+ } catch (er) {
967
+ return null;
968
+ }
969
+ };
970
+ module.exports = validRange;
971
+ }));
1371
972
  // src/shared/protocol.ts
973
+ var import_gt = /* @__PURE__ */ __toESM(require_gt(), 1);
974
+ var import_prerelease = /* @__PURE__ */ __toESM(require_prerelease(), 1);
975
+ var import_rcompare = /* @__PURE__ */ __toESM(require_rcompare(), 1);
976
+ var import_satisfies = /* @__PURE__ */ __toESM(require_satisfies(), 1);
977
+ var import_valid = /* @__PURE__ */ __toESM(require_valid$1(), 1);
978
+ var import_valid$1 = /* @__PURE__ */ __toESM(require_valid(), 1);
1372
979
  var SELF = "@shellraining/dsh-plugin-updates";
980
+ /**
981
+ * Authenticated Connection route: GET reads the last self-update, POST starts
982
+ * one. Browser-relative, like the host's own `/api/*` routes.
983
+ */
1373
984
  var SELF_UPDATE_PATH = "/api/dsh-plugin-updates.self-update";
1374
985
  function isRunning(status) {
1375
- return status?.phase === "removing" || status?.phase === "installing" || status?.phase === "restoring";
986
+ return status?.phase === "removing" || status?.phase === "installing" || status?.phase === "restoring";
1376
987
  }
988
+ /** pnpm may print successful checks before the actual error; pick the first error line. */
1377
989
  function errorLine(text) {
1378
- return text.split("\n").map((line) => line.trim()).filter(Boolean).find((line) => /\bERR[_!\s]|\berror\b|\bfatal\b/i.test(line));
990
+ return text.split("\n").map((line) => line.trim()).filter(Boolean).find((line) => /\bERR[_!\s]|\berror\b|\bfatal\b/i.test(line));
1379
991
  }
1380
-
1381
992
  // src/client/model.ts
1382
993
  var DEFAULT_REGISTRY = "https://registry.npmjs.org/";
1383
- var CACHE_MS = 10 * 6e4;
1384
- var FRESH_MS = 24 * 60 * 6e4;
994
+ var CACHE_MS = 6e5;
995
+ var FRESH_MS = 864e5;
1385
996
  var POLL_MS = 1e3;
1386
997
  var SEEN_KEY = `${SELF}:self-update-seen`;
998
+ /** The newest stable, compatible, non-deprecated version above the installed one. */
1387
999
  function updateTarget(candidate, lookup) {
1388
- if (lookup?.status !== "ready") return void 0;
1389
- const best = lookup.versions.find((info) => info.compatible && !info.prerelease && !info.deprecated);
1390
- return best !== void 0 && (0, import_gt.default)(best.version, candidate.version) ? best.version : void 0;
1000
+ if (lookup?.status !== "ready") return void 0;
1001
+ const best = lookup.versions.find((info) => info.compatible && !info.prerelease && !info.deprecated);
1002
+ return best !== void 0 && (0, import_gt.default)(best.version, candidate.version) ? best.version : void 0;
1391
1003
  }
1392
1004
  function isBusy(operation) {
1393
- return operation?.phase === "checking" || operation?.phase === "removing" || operation?.phase === "installing";
1005
+ return operation?.phase === "checking" || operation?.phase === "removing" || operation?.phase === "installing";
1394
1006
  }
1395
1007
  function record(value) {
1396
- return typeof value === "object" && value !== null ? value : {};
1008
+ return typeof value === "object" && value !== null ? value : {};
1397
1009
  }
1398
1010
  function errorText(error) {
1399
- return error instanceof Error ? error.message : String(error);
1011
+ return error instanceof Error ? error.message : String(error);
1400
1012
  }
1013
+ /** pnpm may print successful checks before the actual error. Keep the full output separately. */
1401
1014
  function failureReason(result) {
1402
- if (!result.ok) return result.error.message;
1403
- const { error, packageResult, application } = result.value;
1404
- const diagnostic = error?.diagnostic?.trim();
1405
- const lines = diagnostic || packageResult?.output || "";
1406
- return errorLine(lines) ?? error?.code ?? diagnostic ?? application;
1015
+ if (!result.ok) return result.error.message;
1016
+ const { error, packageResult, application } = result.value;
1017
+ const diagnostic = error?.diagnostic?.trim();
1018
+ return errorLine(diagnostic || packageResult?.output || "") ?? error?.code ?? diagnostic ?? application;
1407
1019
  }
1020
+ /** The host half's self-update route, document-relative like the host's own `/api/*` routes. */
1408
1021
  async function selfRequest(init) {
1409
- const response = await fetch(SELF_UPDATE_PATH.slice(1), { credentials: "same-origin", cache: "no-store", ...init });
1410
- if (!response.ok) throw new Error(`HTTP ${response.status}`);
1411
- const body = record(await response.json());
1412
- if (body["ok"] === true) {
1413
- const status = record(body["status"]);
1414
- const valid2 = typeof status["id"] === "string" && typeof status["from"] === "string" && typeof status["to"] === "string" && typeof status["phase"] === "string";
1415
- return { ok: true, status: valid2 ? status : null };
1416
- }
1417
- const code = body["code"];
1418
- return { ok: false, code: code === "invalid-version" || code === "busy" || code === "not-npm" || code === "current" ? code : "internal", ...typeof body["message"] === "string" ? { message: body["message"] } : {} };
1022
+ const response = await fetch(SELF_UPDATE_PATH.slice(1), {
1023
+ credentials: "same-origin",
1024
+ cache: "no-store",
1025
+ ...init
1026
+ });
1027
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
1028
+ const body = record(await response.json());
1029
+ if (body["ok"] === true) {
1030
+ const status = record(body["status"]);
1031
+ return {
1032
+ ok: true,
1033
+ status: typeof status["id"] === "string" && typeof status["from"] === "string" && typeof status["to"] === "string" && typeof status["phase"] === "string" ? status : null
1034
+ };
1035
+ }
1036
+ const code = body["code"];
1037
+ return {
1038
+ ok: false,
1039
+ code: code === "invalid-version" || code === "busy" || code === "not-npm" || code === "current" ? code : "internal",
1040
+ ...typeof body["message"] === "string" ? { message: body["message"] } : {}
1041
+ };
1419
1042
  }
1043
+ /** A self-update as the operation banner and toast show it. */
1420
1044
  function selfOperation(status, toast) {
1421
- const phase = status.phase === "restoring" ? "installing" : status.phase;
1422
- return {
1423
- name: SELF,
1424
- from: status.from,
1425
- to: status.phase === "restoring" ? status.from : status.to,
1426
- enabled: true,
1427
- phase,
1428
- restoring: status.phase === "restoring",
1429
- ...status.reason === void 0 ? {} : { reason: status.reason },
1430
- ...status.output === void 0 ? {} : { output: status.output },
1431
- ...status.logPath === void 0 ? {} : { logPath: status.logPath },
1432
- ...toast ? { toast: Date.now() } : {}
1433
- };
1045
+ const phase = status.phase === "restoring" ? "installing" : status.phase;
1046
+ return {
1047
+ name: SELF,
1048
+ from: status.from,
1049
+ to: status.phase === "restoring" ? status.from : status.to,
1050
+ enabled: true,
1051
+ phase,
1052
+ restoring: status.phase === "restoring",
1053
+ ...status.reason === void 0 ? {} : { reason: status.reason },
1054
+ ...status.output === void 0 ? {} : { output: status.output },
1055
+ ...status.logPath === void 0 ? {} : { logPath: status.logPath },
1056
+ ...toast ? { toast: Date.now() } : {}
1057
+ };
1434
1058
  }
1435
1059
  function seen(id) {
1436
- try {
1437
- return localStorage.getItem(SEEN_KEY) === id;
1438
- } catch {
1439
- return false;
1440
- }
1060
+ try {
1061
+ return localStorage.getItem(SEEN_KEY) === id;
1062
+ } catch {
1063
+ return false;
1064
+ }
1441
1065
  }
1442
1066
  function markSeen(id) {
1443
- try {
1444
- localStorage.setItem(SEEN_KEY, id);
1445
- } catch {
1446
- }
1067
+ try {
1068
+ localStorage.setItem(SEEN_KEY, id);
1069
+ } catch {}
1447
1070
  }
1071
+ /** `name@range` as pnpm records a registry dependency; git, link, file and tarball sources do not parse. */
1448
1072
  function npmInstalled(bundle) {
1449
- const prefix = `${bundle.name}@`;
1450
- return bundle.installed && !bundle.official && bundle.availability === "profile" && bundle.removable && bundle.readOnlyReason === void 0 && (0, import_valid.default)(bundle.version ?? "") !== null && bundle.source?.startsWith(prefix) === true && (0, import_valid2.default)(bundle.source.slice(prefix.length)) !== null;
1073
+ const prefix = `${bundle.name}@`;
1074
+ return bundle.installed && !bundle.official && bundle.availability === "profile" && bundle.removable && bundle.readOnlyReason === void 0 && (0, import_valid.default)(bundle.version ?? "") !== null && bundle.source?.startsWith(prefix) === true && (0, import_valid$1.default)(bundle.source.slice(prefix.length)) !== null;
1451
1075
  }
1076
+ /** The DSH requirements check app-boot applies: an own `engines.dsh`, otherwise every DSH peer. */
1452
1077
  function compatibleWith(manifest, runtime) {
1453
- if (runtime === void 0) return true;
1454
- const fits = (range) => typeof range === "string" && range.trim() !== "" && (0, import_satisfies.default)(runtime, range, { includePrerelease: true });
1455
- const engines = record(manifest["engines"]);
1456
- if (Object.hasOwn(engines, "dsh")) return fits(engines["dsh"]);
1457
- return Object.entries(record(manifest["peerDependencies"])).filter(([name2]) => name2 === "@deepseek-ai/dsh" || name2.startsWith("@deepseek-ai/dsh-")).every(([, range]) => typeof range === "string" && range.startsWith("workspace:") ? true : fits(range));
1078
+ if (runtime === void 0) return true;
1079
+ const fits = (range) => typeof range === "string" && range.trim() !== "" && (0, import_satisfies.default)(runtime, range, { includePrerelease: true });
1080
+ const engines = record(manifest["engines"]);
1081
+ if (Object.hasOwn(engines, "dsh")) return fits(engines["dsh"]);
1082
+ return Object.entries(record(manifest["peerDependencies"])).filter(([name]) => name === "@deepseek-ai/dsh" || name.startsWith("@deepseek-ai/dsh-")).every(([, range]) => typeof range === "string" && range.startsWith("workspace:") ? true : fits(range));
1458
1083
  }
1459
- function packumentUrl(registry, name2) {
1460
- return `${registry.endsWith("/") ? registry : `${registry}/`}${name2.replace("/", "%2f")}`;
1084
+ function packumentUrl(registry, name) {
1085
+ return `${registry.endsWith("/") ? registry : `${registry}/`}${name.replace("/", "%2f")}`;
1461
1086
  }
1087
+ /** The running DSH version: the boot graph's release, which shares the CLI's version number. */
1462
1088
  function runtimeVersion(ctx) {
1463
- const modules = record(ctx.get("modules"));
1464
- const version = record(record(modules["manifest"])["release"])["version"];
1465
- return typeof version === "string" && (0, import_valid.default)(version) !== null ? version : void 0;
1089
+ const version = record(record(record(ctx.get("modules"))["manifest"])["release"])["version"];
1090
+ return typeof version === "string" && (0, import_valid.default)(version) !== null ? version : void 0;
1466
1091
  }
1467
1092
  var UpdatesStore = class {
1468
- constructor(ctx) {
1469
- this.ctx = ctx;
1470
- }
1471
- ctx;
1472
- state = { status: "idle", candidates: [], lookups: {} };
1473
- listeners = /* @__PURE__ */ new Set();
1474
- generation = 0;
1475
- disposed = false;
1476
- registries;
1477
- exemptions = {};
1478
- pollTimer;
1479
- getSnapshot = () => this.state;
1480
- subscribe = (listener) => {
1481
- this.listeners.add(listener);
1482
- return () => {
1483
- this.listeners.delete(listener);
1484
- };
1485
- };
1486
- dispose() {
1487
- this.disposed = true;
1488
- if (this.pollTimer !== void 0) clearTimeout(this.pollTimer);
1489
- this.listeners.clear();
1490
- }
1491
- /** Read the last self-update once per load: report a result this page has not shown, follow one still running. */
1492
- watchSelf = async () => {
1493
- let response;
1494
- try {
1495
- response = await selfRequest();
1496
- } catch {
1497
- if (!this.disposed && this.state.operation?.name === SELF && isBusy(this.state.operation)) {
1498
- this.pollTimer = setTimeout(() => {
1499
- void this.watchSelf();
1500
- }, POLL_MS);
1501
- }
1502
- return;
1503
- }
1504
- if (this.disposed || !response.ok || response.status === null) return;
1505
- const status = response.status;
1506
- if (isRunning(status)) {
1507
- this.patch({ operation: selfOperation(status, false) });
1508
- this.pollTimer = setTimeout(() => {
1509
- void this.watchSelf();
1510
- }, POLL_MS);
1511
- return;
1512
- }
1513
- if (seen(status.id)) return;
1514
- markSeen(status.id);
1515
- this.patch({ operation: selfOperation(status, true) });
1516
- };
1517
- /** Ask the host half to update this plugin; the page loses this plugin while it runs. */
1518
- updateSelf = async (version) => {
1519
- if (this.disposed || isBusy(this.state.operation) || (0, import_valid.default)(version) === null) return false;
1520
- const from = this.state.candidates.find((item) => item.name === SELF)?.version ?? "";
1521
- const base = { name: SELF, from, to: version, enabled: true, restoring: false };
1522
- this.patch({ operation: { ...base, phase: "checking" } });
1523
- let response;
1524
- try {
1525
- response = await selfRequest({ method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ version }) });
1526
- } catch (error) {
1527
- response = { ok: false, code: "internal", message: errorText(error) };
1528
- }
1529
- if (this.disposed) return false;
1530
- if (!response.ok) {
1531
- const phase = response.code === "current" ? "current" : "check-failed";
1532
- this.patch({ operation: { ...base, phase, reason: response.message ?? `self-${response.code}`, toast: Date.now() } });
1533
- return false;
1534
- }
1535
- if (response.status !== null) this.patch({ operation: selfOperation(response.status, false) });
1536
- this.pollTimer = setTimeout(() => {
1537
- void this.watchSelf();
1538
- }, POLL_MS);
1539
- return true;
1540
- };
1541
- patch(next) {
1542
- if (this.disposed) return;
1543
- this.state = { ...this.state, ...next };
1544
- for (const listener of [...this.listeners]) listener();
1545
- }
1546
- setLookup(name2, lookup) {
1547
- this.patch({ lookups: { ...this.state.lookups, [name2]: lookup } });
1548
- }
1549
- /** A page opened: read the list the first time, after a failure, and once a lookup is older than the cache. */
1550
- ensure = () => {
1551
- const now = Date.now();
1552
- const stale = Object.values(this.state.lookups).some((lookup) => lookup.status === "ready" && now - lookup.at > CACHE_MS);
1553
- if (this.state.status === "idle" || this.state.status === "error" || this.state.status === "ready" && stale) void this.load();
1554
- };
1555
- /** Re-read the list after a Host change; lookups stay cached. */
1556
- bundlesChanged = () => {
1557
- if (this.state.status !== "idle") void this.load();
1558
- };
1559
- async load() {
1560
- try {
1561
- await this.loadBundles();
1562
- } catch {
1563
- if (!this.disposed) this.patch({ status: "error" });
1564
- }
1565
- }
1566
- async loadBundles() {
1567
- const generation = ++this.generation;
1568
- this.patch({ status: this.state.status === "ready" ? "ready" : "loading" });
1569
- const pm = this.ctx.remote.pluginManager;
1570
- if (this.registries === void 0) {
1571
- const [registries, exemptions] = await Promise.all([pm.registries(), pm.listVersionExemptions()]);
1572
- if (registries.ok) {
1573
- const first = registries.value.registry ?? registries.value.resolved ?? DEFAULT_REGISTRY;
1574
- this.registries = [.../* @__PURE__ */ new Set([first, ...registries.value.fallbackRegistries])];
1575
- }
1576
- if (exemptions.ok) this.exemptions = exemptions.value.exemptions;
1577
- }
1578
- const listed = await pm.listBundles();
1579
- if (generation !== this.generation) return;
1580
- if (!listed.ok) {
1581
- this.patch({ status: "error" });
1582
- return;
1583
- }
1584
- const resolve = (text) => text === void 0 ? void 0 : this.ctx.locale.resolveText(text);
1585
- const npm = listed.value.filter(npmInstalled);
1586
- const candidates = npm.map((bundle) => {
1587
- const icon = bundle.meta?.icon;
1588
- return {
1589
- name: bundle.name,
1590
- title: resolve(bundle.meta?.title) ?? bundle.name,
1591
- version: bundle.version ?? "",
1592
- enabled: bundle.enabled,
1593
- ...icon === void 0 ? {} : { icon }
1594
- };
1595
- }).sort((a, b) => a.title.localeCompare(b.title));
1596
- this.patch({ status: "ready", candidates });
1597
- const now = Date.now();
1598
- for (const candidate of candidates) {
1599
- const lookup = this.state.lookups[candidate.name];
1600
- const stale = lookup === void 0 || lookup.status === "error" || lookup.status === "ready" && now - lookup.at > CACHE_MS;
1601
- if (stale) void this.lookup(candidate.name);
1602
- }
1603
- }
1604
- async lookup(name2) {
1605
- this.setLookup(name2, { status: "loading" });
1606
- const runtime = runtimeVersion(this.ctx);
1607
- let reason = "";
1608
- for (const registry of this.registries ?? [DEFAULT_REGISTRY]) {
1609
- try {
1610
- const response = await fetch(packumentUrl(registry, name2), { headers: { accept: "application/json" }, credentials: "omit" });
1611
- if (!response.ok) throw new Error(`HTTP ${response.status}`);
1612
- const body = record(await response.json());
1613
- const times = record(body["time"]);
1614
- const now = Date.now();
1615
- const versions = Object.entries(record(body["versions"])).filter(([version]) => (0, import_valid.default)(version) !== null).map(([version, manifest]) => {
1616
- const fields = record(manifest);
1617
- const stamp = typeof times[version] === "string" ? Date.parse(times[version]) : Number.NaN;
1618
- const exempted = runtime !== void 0 && this.exemptions[`${name2}@${version}`]?.includes(runtime) === true;
1619
- return {
1620
- version,
1621
- ...Number.isNaN(stamp) ? {} : { published: stamp },
1622
- deprecated: typeof fields["deprecated"] === "string",
1623
- prerelease: (0, import_prerelease.default)(version) !== null,
1624
- compatible: exempted || compatibleWith(fields, runtime),
1625
- fresh: !Number.isNaN(stamp) && now - stamp < FRESH_MS
1626
- };
1627
- }).sort((a, b) => (0, import_rcompare.default)(a.version, b.version));
1628
- const latest = record(body["dist-tags"])["latest"];
1629
- this.setLookup(name2, { status: "ready", registry, versions, at: now, ...typeof latest === "string" ? { latest } : {} });
1630
- return;
1631
- } catch (error) {
1632
- reason = `${new URL(registry).host}: ${errorText(error)}`;
1633
- }
1634
- }
1635
- this.setLookup(name2, { status: "error", reason });
1636
- }
1637
- /** Switch one plugin to `version`: uninstall it, then install that exact version with its enabled state. */
1638
- install = async (name2, version) => {
1639
- const candidate = this.state.candidates.find((item) => item.name === name2);
1640
- if (this.disposed || candidate === void 0 || name2 === SELF || isBusy(this.state.operation) || (0, import_valid.default)(version) === null) return false;
1641
- return this.run({ name: name2, from: candidate.version, to: version, enabled: candidate.enabled, restoring: false }, true);
1642
- };
1643
- /** Put back the version a failed switch removed; the plugin is no longer installed, so only install. */
1644
- restore = async () => {
1645
- const failed = this.state.operation;
1646
- if (this.disposed || failed?.phase !== "failed" || !failed.recoverable) return;
1647
- await this.run({ name: failed.name, from: failed.from, to: failed.from, enabled: failed.enabled, restoring: true }, false);
1648
- };
1649
- /** The outcome toast finished; the banner in the tab keeps the result. */
1650
- toastDone = () => {
1651
- const operation = this.state.operation;
1652
- if (operation?.toast !== void 0) {
1653
- const { toast: _toast, ...rest } = operation;
1654
- this.patch({ operation: rest });
1655
- }
1656
- };
1657
- dismiss = () => {
1658
- if (!isBusy(this.state.operation)) this.patch({ operation: void 0 });
1659
- };
1660
- /** Update every plugin with a newer version, one at a time; stops at the first failure. */
1661
- updateAll = async () => {
1662
- for (const candidate of this.state.candidates) {
1663
- const target = updateTarget(candidate, this.state.lookups[candidate.name]);
1664
- if (target === void 0 || candidate.name === SELF) continue;
1665
- if (!await this.install(candidate.name, target)) return;
1666
- }
1667
- };
1668
- async run(base, remove) {
1669
- const pm = this.ctx.remote.pluginManager;
1670
- let failurePhase = "check-failed";
1671
- let recoverable = false;
1672
- const fail = (result) => {
1673
- const value = result.ok ? result.value : void 0;
1674
- const output = value?.packageResult?.output.trim() || value?.error?.diagnostic;
1675
- const logPath = value?.packageResult?.logPath;
1676
- this.patch({ operation: {
1677
- ...base,
1678
- phase: failurePhase,
1679
- recoverable,
1680
- reason: failureReason(result),
1681
- toast: Date.now(),
1682
- ...output ? { output } : {},
1683
- ...logPath ? { logPath } : {}
1684
- } });
1685
- return false;
1686
- };
1687
- this.patch({ operation: { ...base, phase: "checking" } });
1688
- try {
1689
- const listed = await pm.listBundles();
1690
- if (this.disposed) return false;
1691
- if (!listed.ok) return fail(listed);
1692
- const current = listed.value.find((bundle) => bundle.name === base.name && bundle.installed);
1693
- if (current !== void 0 && (0, import_valid.default)(current.version ?? "") === (0, import_valid.default)(base.to)) {
1694
- this.patch({ operation: { ...base, phase: "current", toast: Date.now() } });
1695
- return true;
1696
- }
1697
- if (remove) {
1698
- if (current === void 0 || !npmInstalled(current)) {
1699
- return fail({ ok: true, value: { application: "failed", error: { code: "plugin-state-changed" } } });
1700
- }
1701
- const declared = (0, import_valid.default)(current.source?.slice(`${base.name}@`.length) ?? "");
1702
- if (declared !== null && declared !== (0, import_valid.default)(current.version ?? "")) {
1703
- return fail({ ok: true, value: { application: "failed", error: { code: "installation-inconsistent" } } });
1704
- }
1705
- base = { ...base, from: current.version ?? base.from, enabled: current.enabled };
1706
- failurePhase = "remove-failed";
1707
- this.patch({ operation: { ...base, phase: "removing" } });
1708
- const removed = await pm.removeBundle(base.name);
1709
- const stopProfile = removed.ok && removed.value.error?.code === "stop-profile";
1710
- if (!stopProfile && (!removed.ok || removed.value.application === "failed" || removed.value.application === "cancelled")) {
1711
- return fail(removed);
1712
- }
1713
- recoverable = !stopProfile;
1714
- } else {
1715
- if (current !== void 0) {
1716
- return fail({ ok: true, value: { application: "failed", error: { code: "plugin-state-changed" } } });
1717
- }
1718
- recoverable = true;
1719
- }
1720
- if (this.disposed) return false;
1721
- failurePhase = "failed";
1722
- this.patch({ operation: { ...base, phase: "installing" } });
1723
- const installed = await pm.installBundle(`${base.name}@${base.to}`, {
1724
- enabled: base.enabled,
1725
- saveExact: true,
1726
- requestId: `${SELF}:${Date.now()}`
1727
- });
1728
- if (!installed.ok || installed.value.application === "failed" || installed.value.application === "cancelled") {
1729
- return fail(installed);
1730
- }
1731
- const to = installed.value.version ?? base.to;
1732
- this.patch({ operation: { ...base, to, toast: Date.now(), phase: installed.value.application === "restart-required" ? "restart" : "done" } });
1733
- return true;
1734
- } catch (error) {
1735
- return fail({ ok: false, error: { message: errorText(error) } });
1736
- } finally {
1737
- if (!this.disposed) await this.load();
1738
- }
1739
- }
1093
+ ctx;
1094
+ state = {
1095
+ status: "idle",
1096
+ candidates: [],
1097
+ lookups: {}
1098
+ };
1099
+ listeners = /* @__PURE__ */ new Set();
1100
+ generation = 0;
1101
+ disposed = false;
1102
+ registries;
1103
+ exemptions = {};
1104
+ pollTimer;
1105
+ constructor(ctx) {
1106
+ this.ctx = ctx;
1107
+ }
1108
+ getSnapshot = () => this.state;
1109
+ subscribe = (listener) => {
1110
+ this.listeners.add(listener);
1111
+ return () => {
1112
+ this.listeners.delete(listener);
1113
+ };
1114
+ };
1115
+ dispose() {
1116
+ this.disposed = true;
1117
+ if (this.pollTimer !== void 0) clearTimeout(this.pollTimer);
1118
+ this.listeners.clear();
1119
+ }
1120
+ /** Read the last self-update once per load: report a result this page has not shown, follow one still running. */
1121
+ watchSelf = async () => {
1122
+ let response;
1123
+ try {
1124
+ response = await selfRequest();
1125
+ } catch {
1126
+ if (!this.disposed && this.state.operation?.name === "@shellraining/dsh-plugin-updates" && isBusy(this.state.operation)) this.pollTimer = setTimeout(() => {
1127
+ this.watchSelf();
1128
+ }, POLL_MS);
1129
+ return;
1130
+ }
1131
+ if (this.disposed || !response.ok || response.status === null) return;
1132
+ const status = response.status;
1133
+ if (isRunning(status)) {
1134
+ this.patch({ operation: selfOperation(status, false) });
1135
+ this.pollTimer = setTimeout(() => {
1136
+ this.watchSelf();
1137
+ }, POLL_MS);
1138
+ return;
1139
+ }
1140
+ if (seen(status.id)) return;
1141
+ markSeen(status.id);
1142
+ this.patch({ operation: selfOperation(status, true) });
1143
+ };
1144
+ /** Ask the host half to update this plugin; the page loses this plugin while it runs. */
1145
+ updateSelf = async (version) => {
1146
+ if (this.disposed || isBusy(this.state.operation) || (0, import_valid.default)(version) === null) return false;
1147
+ const base = {
1148
+ name: SELF,
1149
+ from: this.state.candidates.find((item) => item.name === "@shellraining/dsh-plugin-updates")?.version ?? "",
1150
+ to: version,
1151
+ enabled: true,
1152
+ restoring: false
1153
+ };
1154
+ this.patch({ operation: {
1155
+ ...base,
1156
+ phase: "checking"
1157
+ } });
1158
+ let response;
1159
+ try {
1160
+ response = await selfRequest({
1161
+ method: "POST",
1162
+ headers: { "content-type": "application/json" },
1163
+ body: JSON.stringify({ version })
1164
+ });
1165
+ } catch (error) {
1166
+ response = {
1167
+ ok: false,
1168
+ code: "internal",
1169
+ message: errorText(error)
1170
+ };
1171
+ }
1172
+ if (this.disposed) return false;
1173
+ if (!response.ok) {
1174
+ const phase = response.code === "current" ? "current" : "check-failed";
1175
+ this.patch({ operation: {
1176
+ ...base,
1177
+ phase,
1178
+ reason: response.message ?? `self-${response.code}`,
1179
+ toast: Date.now()
1180
+ } });
1181
+ return false;
1182
+ }
1183
+ if (response.status !== null) this.patch({ operation: selfOperation(response.status, false) });
1184
+ this.pollTimer = setTimeout(() => {
1185
+ this.watchSelf();
1186
+ }, POLL_MS);
1187
+ return true;
1188
+ };
1189
+ patch(next) {
1190
+ if (this.disposed) return;
1191
+ this.state = {
1192
+ ...this.state,
1193
+ ...next
1194
+ };
1195
+ for (const listener of [...this.listeners]) listener();
1196
+ }
1197
+ setLookup(name, lookup) {
1198
+ this.patch({ lookups: {
1199
+ ...this.state.lookups,
1200
+ [name]: lookup
1201
+ } });
1202
+ }
1203
+ /** A page opened: read the list the first time, after a failure, and once a lookup is older than the cache. */
1204
+ ensure = () => {
1205
+ const now = Date.now();
1206
+ const stale = Object.values(this.state.lookups).some((lookup) => lookup.status === "ready" && now - lookup.at > CACHE_MS);
1207
+ if (this.state.status === "idle" || this.state.status === "error" || this.state.status === "ready" && stale) this.load();
1208
+ };
1209
+ /** Re-read the list after a Host change; lookups stay cached. */
1210
+ bundlesChanged = () => {
1211
+ if (this.state.status !== "idle") this.load();
1212
+ };
1213
+ async load() {
1214
+ try {
1215
+ await this.loadBundles();
1216
+ } catch {
1217
+ if (!this.disposed) this.patch({ status: "error" });
1218
+ }
1219
+ }
1220
+ async loadBundles() {
1221
+ const generation = ++this.generation;
1222
+ this.patch({ status: this.state.status === "ready" ? "ready" : "loading" });
1223
+ const pm = this.ctx.remote.pluginManager;
1224
+ if (this.registries === void 0) {
1225
+ const [registries, exemptions] = await Promise.all([pm.registries(), pm.listVersionExemptions()]);
1226
+ if (registries.ok) {
1227
+ const first = registries.value.registry ?? registries.value.resolved ?? DEFAULT_REGISTRY;
1228
+ this.registries = [.../* @__PURE__ */ new Set([first, ...registries.value.fallbackRegistries])];
1229
+ }
1230
+ if (exemptions.ok) this.exemptions = exemptions.value.exemptions;
1231
+ }
1232
+ const listed = await pm.listBundles();
1233
+ if (generation !== this.generation) return;
1234
+ if (!listed.ok) {
1235
+ this.patch({ status: "error" });
1236
+ return;
1237
+ }
1238
+ const resolve = (text) => text === void 0 ? void 0 : this.ctx.locale.resolveText(text);
1239
+ const candidates = listed.value.filter(npmInstalled).map((bundle) => {
1240
+ const icon = bundle.meta?.icon;
1241
+ return {
1242
+ name: bundle.name,
1243
+ title: resolve(bundle.meta?.title) ?? bundle.name,
1244
+ version: bundle.version ?? "",
1245
+ enabled: bundle.enabled,
1246
+ ...icon === void 0 ? {} : { icon }
1247
+ };
1248
+ }).sort((a, b) => a.title.localeCompare(b.title));
1249
+ this.patch({
1250
+ status: "ready",
1251
+ candidates
1252
+ });
1253
+ const now = Date.now();
1254
+ for (const candidate of candidates) {
1255
+ const lookup = this.state.lookups[candidate.name];
1256
+ if (lookup === void 0 || lookup.status === "error" || lookup.status === "ready" && now - lookup.at > CACHE_MS) this.lookup(candidate.name);
1257
+ }
1258
+ }
1259
+ async lookup(name) {
1260
+ this.setLookup(name, { status: "loading" });
1261
+ const runtime = runtimeVersion(this.ctx);
1262
+ let reason = "";
1263
+ for (const registry of this.registries ?? [DEFAULT_REGISTRY]) try {
1264
+ const response = await fetch(packumentUrl(registry, name), {
1265
+ headers: { accept: "application/json" },
1266
+ credentials: "omit"
1267
+ });
1268
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
1269
+ const body = record(await response.json());
1270
+ const times = record(body["time"]);
1271
+ const now = Date.now();
1272
+ const versions = Object.entries(record(body["versions"])).filter(([version]) => (0, import_valid.default)(version) !== null).map(([version, manifest]) => {
1273
+ const fields = record(manifest);
1274
+ const stamp = typeof times[version] === "string" ? Date.parse(times[version]) : NaN;
1275
+ const exempted = runtime !== void 0 && this.exemptions[`${name}@${version}`]?.includes(runtime) === true;
1276
+ return {
1277
+ version,
1278
+ ...Number.isNaN(stamp) ? {} : { published: stamp },
1279
+ deprecated: typeof fields["deprecated"] === "string",
1280
+ prerelease: (0, import_prerelease.default)(version) !== null,
1281
+ compatible: exempted || compatibleWith(fields, runtime),
1282
+ fresh: !Number.isNaN(stamp) && now - stamp < FRESH_MS
1283
+ };
1284
+ }).sort((a, b) => (0, import_rcompare.default)(a.version, b.version));
1285
+ const latest = record(body["dist-tags"])["latest"];
1286
+ this.setLookup(name, {
1287
+ status: "ready",
1288
+ registry,
1289
+ versions,
1290
+ at: now,
1291
+ ...typeof latest === "string" ? { latest } : {}
1292
+ });
1293
+ return;
1294
+ } catch (error) {
1295
+ reason = `${new URL(registry).host}: ${errorText(error)}`;
1296
+ }
1297
+ this.setLookup(name, {
1298
+ status: "error",
1299
+ reason
1300
+ });
1301
+ }
1302
+ /** Switch one plugin to `version`: uninstall it, then install that exact version with its enabled state. */
1303
+ install = async (name, version) => {
1304
+ const candidate = this.state.candidates.find((item) => item.name === name);
1305
+ if (this.disposed || candidate === void 0 || name === "@shellraining/dsh-plugin-updates" || isBusy(this.state.operation) || (0, import_valid.default)(version) === null) return false;
1306
+ return this.run({
1307
+ name,
1308
+ from: candidate.version,
1309
+ to: version,
1310
+ enabled: candidate.enabled,
1311
+ restoring: false
1312
+ }, true);
1313
+ };
1314
+ /** Put back the version a failed switch removed; the plugin is no longer installed, so only install. */
1315
+ restore = async () => {
1316
+ const failed = this.state.operation;
1317
+ if (this.disposed || failed?.phase !== "failed" || !failed.recoverable) return;
1318
+ await this.run({
1319
+ name: failed.name,
1320
+ from: failed.from,
1321
+ to: failed.from,
1322
+ enabled: failed.enabled,
1323
+ restoring: true
1324
+ }, false);
1325
+ };
1326
+ /** The outcome toast finished; the banner in the tab keeps the result. */
1327
+ toastDone = () => {
1328
+ const operation = this.state.operation;
1329
+ if (operation?.toast !== void 0) {
1330
+ const { toast: _toast, ...rest } = operation;
1331
+ this.patch({ operation: rest });
1332
+ }
1333
+ };
1334
+ dismiss = () => {
1335
+ if (!isBusy(this.state.operation)) this.patch({ operation: void 0 });
1336
+ };
1337
+ /** Update every plugin with a newer version, one at a time; stops at the first failure. */
1338
+ updateAll = async () => {
1339
+ for (const candidate of this.state.candidates) {
1340
+ const target = updateTarget(candidate, this.state.lookups[candidate.name]);
1341
+ if (target === void 0 || candidate.name === "@shellraining/dsh-plugin-updates") continue;
1342
+ if (!await this.install(candidate.name, target)) return;
1343
+ }
1344
+ };
1345
+ async run(base, remove) {
1346
+ const pm = this.ctx.remote.pluginManager;
1347
+ let failurePhase = "check-failed";
1348
+ let recoverable = false;
1349
+ const fail = (result) => {
1350
+ const value = result.ok ? result.value : void 0;
1351
+ const output = value?.packageResult?.output.trim() || value?.error?.diagnostic;
1352
+ const logPath = value?.packageResult?.logPath;
1353
+ this.patch({ operation: {
1354
+ ...base,
1355
+ phase: failurePhase,
1356
+ recoverable,
1357
+ reason: failureReason(result),
1358
+ toast: Date.now(),
1359
+ ...output ? { output } : {},
1360
+ ...logPath ? { logPath } : {}
1361
+ } });
1362
+ return false;
1363
+ };
1364
+ this.patch({ operation: {
1365
+ ...base,
1366
+ phase: "checking"
1367
+ } });
1368
+ try {
1369
+ const listed = await pm.listBundles();
1370
+ if (this.disposed) return false;
1371
+ if (!listed.ok) return fail(listed);
1372
+ const current = listed.value.find((bundle) => bundle.name === base.name && bundle.installed);
1373
+ if (current !== void 0 && (0, import_valid.default)(current.version ?? "") === (0, import_valid.default)(base.to)) {
1374
+ this.patch({ operation: {
1375
+ ...base,
1376
+ phase: "current",
1377
+ toast: Date.now()
1378
+ } });
1379
+ return true;
1380
+ }
1381
+ if (remove) {
1382
+ if (current === void 0 || !npmInstalled(current)) return fail({
1383
+ ok: true,
1384
+ value: {
1385
+ application: "failed",
1386
+ error: { code: "plugin-state-changed" }
1387
+ }
1388
+ });
1389
+ const declared = (0, import_valid.default)(current.source?.slice(`${base.name}@`.length) ?? "");
1390
+ if (declared !== null && declared !== (0, import_valid.default)(current.version ?? "")) return fail({
1391
+ ok: true,
1392
+ value: {
1393
+ application: "failed",
1394
+ error: { code: "installation-inconsistent" }
1395
+ }
1396
+ });
1397
+ base = {
1398
+ ...base,
1399
+ from: current.version ?? base.from,
1400
+ enabled: current.enabled
1401
+ };
1402
+ failurePhase = "remove-failed";
1403
+ this.patch({ operation: {
1404
+ ...base,
1405
+ phase: "removing"
1406
+ } });
1407
+ const removed = await pm.removeBundle(base.name);
1408
+ const stopProfile = removed.ok && removed.value.error?.code === "stop-profile";
1409
+ if (!stopProfile && (!removed.ok || removed.value.application === "failed" || removed.value.application === "cancelled")) return fail(removed);
1410
+ recoverable = !stopProfile;
1411
+ } else {
1412
+ if (current !== void 0) return fail({
1413
+ ok: true,
1414
+ value: {
1415
+ application: "failed",
1416
+ error: { code: "plugin-state-changed" }
1417
+ }
1418
+ });
1419
+ recoverable = true;
1420
+ }
1421
+ if (this.disposed) return false;
1422
+ failurePhase = "failed";
1423
+ this.patch({ operation: {
1424
+ ...base,
1425
+ phase: "installing"
1426
+ } });
1427
+ const installed = await pm.installBundle(`${base.name}@${base.to}`, {
1428
+ enabled: base.enabled,
1429
+ saveExact: true,
1430
+ requestId: `${SELF}:${Date.now()}`
1431
+ });
1432
+ if (!installed.ok || installed.value.application === "failed" || installed.value.application === "cancelled") return fail(installed);
1433
+ const to = installed.value.version ?? base.to;
1434
+ this.patch({ operation: {
1435
+ ...base,
1436
+ to,
1437
+ toast: Date.now(),
1438
+ phase: installed.value.application === "restart-required" ? "restart" : "done"
1439
+ } });
1440
+ return true;
1441
+ } catch (error) {
1442
+ return fail({
1443
+ ok: false,
1444
+ error: { message: errorText(error) }
1445
+ });
1446
+ } finally {
1447
+ if (!this.disposed) await this.load();
1448
+ }
1449
+ }
1740
1450
  };
1741
-
1742
1451
  // src/client/styles.ts
1743
1452
  var STYLE_ID = "@shellraining/dsh-plugin-updates";
1744
1453
  var CSS = `
@@ -1761,379 +1470,511 @@ var CSS = `
1761
1470
  .dpu-error { color: var(--dsw-alias-state-error-primary); font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }
1762
1471
  @media (forced-colors: active) { .dpu-banner { border-color: CanvasText; } }
1763
1472
  `;
1764
- function installStyle(document2) {
1765
- const node = document2.createElement("style");
1766
- node.dataset.plugin = STYLE_ID;
1767
- node.textContent = CSS;
1768
- document2.head.append(node);
1769
- return () => node.remove();
1473
+ function installStyle(document) {
1474
+ const node = document.createElement("style");
1475
+ node.dataset.plugin = STYLE_ID;
1476
+ node.textContent = CSS;
1477
+ document.head.append(node);
1478
+ return () => node.remove();
1770
1479
  }
1771
-
1772
- // src/client/view.tsx
1773
- var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
1774
- var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
1775
- var import_react = require("react");
1776
- var import_react_dom = require("react-dom");
1777
-
1778
1480
  // src/client/anchors.ts
1779
- var GROUP = 'section[data-plugin-group="bundles"]';
1481
+ var GROUP = "section[data-plugin-group=\"bundles\"]";
1780
1482
  var MOUNT = "data-plugin-updates-mount";
1781
1483
  var NO_ANCHORS = { cards: /* @__PURE__ */ new Map() };
1782
1484
  function mountIn(parent, key, first) {
1783
- for (const child of parent.children) {
1784
- if (child instanceof HTMLElement && child.getAttribute(MOUNT) === key) return child;
1785
- }
1786
- const node = parent.ownerDocument.createElement("span");
1787
- node.setAttribute(MOUNT, key);
1788
- node.style.display = "contents";
1789
- if (first) parent.prepend(node);
1790
- else parent.append(node);
1791
- return node;
1485
+ for (const child of parent.children) if (child instanceof HTMLElement && child.getAttribute(MOUNT) === key) return child;
1486
+ const node = parent.ownerDocument.createElement("span");
1487
+ node.setAttribute(MOUNT, key);
1488
+ node.style.display = "contents";
1489
+ if (first) parent.prepend(node);
1490
+ else parent.append(node);
1491
+ return node;
1792
1492
  }
1793
- function scan(document2) {
1794
- const group = document2.querySelector(GROUP);
1795
- if (group === null) return NO_ANCHORS;
1796
- const row = group.firstElementChild;
1797
- const head = row?.querySelector(":scope > h3") ? mountIn(row, "head", false) : void 0;
1798
- const cards = /* @__PURE__ */ new Map();
1799
- for (const card of group.querySelectorAll("li[data-plugin-package]")) {
1800
- const name2 = card.getAttribute("data-plugin-package");
1801
- const end = card.querySelector('[role="switch"]')?.parentElement;
1802
- if (name2 && end) cards.set(name2, mountIn(end, "card", true));
1803
- }
1804
- const status = mountIn(group, "status", false);
1805
- return { ...head === void 0 ? {} : { head }, status, cards };
1493
+ function scan(document) {
1494
+ const group = document.querySelector(GROUP);
1495
+ if (group === null) return NO_ANCHORS;
1496
+ const row = group.firstElementChild;
1497
+ const head = row?.querySelector(":scope > h3") ? mountIn(row, "head", false) : void 0;
1498
+ const cards = /* @__PURE__ */ new Map();
1499
+ for (const card of group.querySelectorAll("li[data-plugin-package]")) {
1500
+ const name = card.getAttribute("data-plugin-package");
1501
+ const end = card.querySelector("[role=\"switch\"]")?.parentElement;
1502
+ if (name && end) cards.set(name, mountIn(end, "card", true));
1503
+ }
1504
+ const status = mountIn(group, "status", false);
1505
+ return {
1506
+ ...head === void 0 ? {} : { head },
1507
+ status,
1508
+ cards
1509
+ };
1806
1510
  }
1807
1511
  function same(a, b) {
1808
- if (a.head !== b.head || a.status !== b.status || a.cards.size !== b.cards.size) return false;
1809
- for (const [name2, node] of a.cards) if (b.cards.get(name2) !== node) return false;
1810
- return true;
1512
+ if (a.head !== b.head || a.status !== b.status || a.cards.size !== b.cards.size) return false;
1513
+ for (const [name, node] of a.cards) if (b.cards.get(name) !== node) return false;
1514
+ return true;
1811
1515
  }
1812
- function watchAnchors(document2, onChange) {
1813
- const view = document2.defaultView;
1814
- if (view === null) return () => {
1815
- };
1816
- let current = NO_ANCHORS;
1817
- let frame = 0;
1818
- const run = () => {
1819
- frame = 0;
1820
- const next = scan(document2);
1821
- if (same(current, next)) return;
1822
- current = next;
1823
- onChange(next);
1824
- };
1825
- const observer = new view.MutationObserver(() => {
1826
- if (frame === 0) frame = view.requestAnimationFrame(run);
1827
- });
1828
- observer.observe(document2.body, { childList: true, subtree: true });
1829
- run();
1830
- return () => {
1831
- observer.disconnect();
1832
- if (frame !== 0) view.cancelAnimationFrame(frame);
1833
- for (const node of document2.querySelectorAll(`[${MOUNT}]`)) node.remove();
1834
- };
1516
+ /** Report the anchors now and whenever the page re-renders them; the disposer removes every mount node. */
1517
+ function watchAnchors(document, onChange) {
1518
+ const view = document.defaultView;
1519
+ if (view === null) return () => {};
1520
+ let current = NO_ANCHORS;
1521
+ let frame = 0;
1522
+ const run = () => {
1523
+ frame = 0;
1524
+ const next = scan(document);
1525
+ if (same(current, next)) return;
1526
+ current = next;
1527
+ onChange(next);
1528
+ };
1529
+ const observer = new view.MutationObserver(() => {
1530
+ if (frame === 0) frame = view.requestAnimationFrame(run);
1531
+ });
1532
+ observer.observe(document.body, {
1533
+ childList: true,
1534
+ subtree: true
1535
+ });
1536
+ run();
1537
+ return () => {
1538
+ observer.disconnect();
1539
+ if (frame !== 0) view.cancelAnimationFrame(frame);
1540
+ for (const node of document.querySelectorAll(`[${MOUNT}]`)) node.remove();
1541
+ };
1835
1542
  }
1836
-
1837
1543
  // src/client/view.tsx
1838
- var import_jsx_runtime = require("react/jsx-runtime");
1839
1544
  var VISIBLE_VERSIONS = 12;
1545
+ /** The CLI command that updates this plugin, for the profile the page runs in. */
1840
1546
  function selfCommand(version) {
1841
- const profile = document.documentElement.dataset["platform"] === void 0 ? "web" : "desktop";
1842
- return `dsh plugin --profile ${profile} add ${SELF}@${version} --save-exact`;
1547
+ return `dsh plugin --profile ${document.documentElement.dataset["platform"] === void 0 ? "web" : "desktop"} add ${SELF}@${version} --save-exact`;
1843
1548
  }
1844
1549
  function dateText(stamp) {
1845
- return stamp === void 0 ? "" : new Date(stamp).toLocaleDateString();
1550
+ return stamp === void 0 ? "" : new Date(stamp).toLocaleDateString();
1846
1551
  }
1847
1552
  function SelfNotice({ t, version, busy, onUpdate }) {
1848
- const [open, setOpen] = (0, import_react.useState)(false);
1849
- const [copied, setCopied] = (0, import_react.useState)(false);
1850
- const command = selfCommand(version);
1851
- const close = () => {
1852
- setOpen(false);
1853
- };
1854
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dpu-banner", children: [
1855
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dpu-banner-row", children: [
1856
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t("self.body", { version }) }),
1857
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "primary", disabled: busy, onClick: () => {
1858
- setOpen(true);
1859
- }, children: t("updateTo", { version }) })
1860
- ] }),
1861
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1862
- import_dsh_client_ui_primitives.Modal,
1863
- {
1864
- open,
1865
- onClose: close,
1866
- title: t("self.confirmTitle", { version }),
1867
- description: t("self.confirmBody"),
1868
- closeLabel: t("op.dismiss"),
1869
- footer: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1870
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "ghost", onClick: close, children: t("self.cancel") }),
1871
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "primary", "data-modal-autofocus": "", onClick: () => {
1872
- close();
1873
- onUpdate();
1874
- }, children: t("updateTo", { version }) })
1875
- ] }),
1876
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dpu-banner-row", children: [
1877
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { className: "dpu-pre dpu-command", children: command }),
1878
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "outline", onClick: () => {
1879
- void (0, import_dsh_client_ui_primitives.writeClipboard)(command).then(setCopied);
1880
- }, children: copied ? t("self.copied") : t("self.copy") })
1881
- ] })
1882
- }
1883
- )
1884
- ] });
1553
+ const [open, setOpen] = (0, react.useState)(false);
1554
+ const [copied, setCopied] = (0, react.useState)(false);
1555
+ const command = selfCommand(version);
1556
+ const close = () => {
1557
+ setOpen(false);
1558
+ };
1559
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1560
+ className: "dpu-banner",
1561
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1562
+ className: "dpu-banner-row",
1563
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("self.body", { version }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1564
+ size: "sm",
1565
+ variant: "primary",
1566
+ disabled: busy,
1567
+ onClick: () => {
1568
+ setOpen(true);
1569
+ },
1570
+ children: t("updateTo", { version })
1571
+ })]
1572
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
1573
+ open,
1574
+ onClose: close,
1575
+ title: t("self.confirmTitle", { version }),
1576
+ description: t("self.confirmBody"),
1577
+ closeLabel: t("op.dismiss"),
1578
+ footer: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1579
+ size: "sm",
1580
+ variant: "ghost",
1581
+ onClick: close,
1582
+ children: t("self.cancel")
1583
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1584
+ size: "sm",
1585
+ variant: "primary",
1586
+ "data-modal-autofocus": "",
1587
+ onClick: () => {
1588
+ close();
1589
+ onUpdate();
1590
+ },
1591
+ children: t("updateTo", { version })
1592
+ })] }),
1593
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1594
+ className: "dpu-banner-row",
1595
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
1596
+ className: "dpu-pre dpu-command",
1597
+ children: command
1598
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1599
+ size: "sm",
1600
+ variant: "outline",
1601
+ onClick: () => {
1602
+ (0, _deepseek_ai_dsh_client_ui_primitives.writeClipboard)(command).then(setCopied);
1603
+ },
1604
+ children: copied ? t("self.copied") : t("self.copy")
1605
+ })]
1606
+ })
1607
+ })]
1608
+ });
1885
1609
  }
1886
1610
  function operationText(t, operation) {
1887
- const raw = operation.reason ?? "";
1888
- const reason = raw.includes("ERR_PNPM_RESOLUTION_POLICY_VIOLATIONS_UNHANDLED") ? t("error.policy") : raw === "installation-inconsistent" ? t("error.inconsistent") : raw === "plugin-state-changed" ? t("error.stateChanged") : raw === "interrupted" ? t("error.interrupted") : raw === "self-busy" ? t("error.selfBusy") : raw === "self-not-npm" ? t("error.stateChanged") : raw;
1889
- const params = { name: operation.name, from: operation.from, to: operation.to, reason };
1890
- switch (operation.phase) {
1891
- case "checking":
1892
- return t("op.checking", params);
1893
- case "check-failed":
1894
- return t("op.checkFailed", params);
1895
- case "current":
1896
- return t("op.current", params);
1897
- case "removing":
1898
- return t("op.removing", params);
1899
- case "installing":
1900
- return t(operation.restoring ? "op.restoring" : "op.installing", params);
1901
- case "done":
1902
- return t("op.done", params);
1903
- case "restart":
1904
- return t("op.restart", params);
1905
- case "restored":
1906
- return t("op.restored", params);
1907
- case "failed":
1908
- return t(operation.name === SELF ? "op.selfFailed" : "op.failed", params);
1909
- case "remove-failed":
1910
- return t("op.removeFailed", params);
1911
- }
1611
+ const raw = operation.reason ?? "";
1612
+ const reason = raw.includes("ERR_PNPM_RESOLUTION_POLICY_VIOLATIONS_UNHANDLED") ? t("error.policy") : raw === "installation-inconsistent" ? t("error.inconsistent") : raw === "plugin-state-changed" ? t("error.stateChanged") : raw === "interrupted" ? t("error.interrupted") : raw === "self-busy" ? t("error.selfBusy") : raw === "self-not-npm" ? t("error.stateChanged") : raw;
1613
+ const params = {
1614
+ name: operation.name,
1615
+ from: operation.from,
1616
+ to: operation.to,
1617
+ reason
1618
+ };
1619
+ switch (operation.phase) {
1620
+ case "checking": return t("op.checking", params);
1621
+ case "check-failed": return t("op.checkFailed", params);
1622
+ case "current": return t("op.current", params);
1623
+ case "removing": return t("op.removing", params);
1624
+ case "installing": return t(operation.restoring ? "op.restoring" : "op.installing", params);
1625
+ case "done": return t("op.done", params);
1626
+ case "restart": return t("op.restart", params);
1627
+ case "restored": return t("op.restored", params);
1628
+ case "failed": return t(operation.name === "@shellraining/dsh-plugin-updates" ? "op.selfFailed" : "op.failed", params);
1629
+ case "remove-failed": return t("op.removeFailed", params);
1630
+ }
1912
1631
  }
1913
1632
  function isFailure(operation) {
1914
- return operation.phase === "failed" || operation.phase === "remove-failed" || operation.phase === "check-failed" || operation.phase === "restored";
1633
+ return operation.phase === "failed" || operation.phase === "remove-failed" || operation.phase === "check-failed" || operation.phase === "restored";
1915
1634
  }
1635
+ /**
1636
+ * The outcome as a toast in the app overlay: a switch uninstalls the plugin
1637
+ * first, which takes the plugin page back to its list, so the detail page that
1638
+ * started it may be gone by the time it finishes.
1639
+ */
1916
1640
  function OperationToast({ t, useUpdates, actions }) {
1917
- const operation = useUpdates((state) => state.operation);
1918
- if (operation?.toast === void 0) return null;
1919
- const failed = isFailure(operation);
1920
- const restorable = operation.phase === "failed" && operation.recoverable;
1921
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1922
- import_dsh_client_ui_primitives.Toast,
1923
- {
1924
- text: operationText(t, operation),
1925
- ...failed ? { icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives2.IconWarningOutlineRegular, {}) } : { tone: "success" },
1926
- holdMs: failed ? 8e3 : 4e3,
1927
- ...restorable ? { actions: [{ label: t("op.restore", { from: operation.from }), onClick: () => {
1928
- void actions.restore();
1929
- } }] } : {},
1930
- onDone: actions.toastDone
1931
- },
1932
- operation.toast
1933
- );
1641
+ const operation = useUpdates((state) => state.operation);
1642
+ if (operation?.toast === void 0) return null;
1643
+ const failed = isFailure(operation);
1644
+ const restorable = operation.phase === "failed" && operation.recoverable;
1645
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Toast, {
1646
+ text: operationText(t, operation),
1647
+ ...failed ? { icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconWarningOutlineRegular, {}) } : { tone: "success" },
1648
+ holdMs: failed ? 8e3 : 4e3,
1649
+ ...restorable ? { actions: [{
1650
+ label: t("op.restore", { from: operation.from }),
1651
+ onClick: () => {
1652
+ actions.restore();
1653
+ }
1654
+ }] } : {},
1655
+ onDone: actions.toastDone
1656
+ }, operation.toast);
1934
1657
  }
1658
+ /** Progress and outcome of the running or last package operation. */
1935
1659
  function OperationBanner({ t, operation, actions }) {
1936
- const params = { from: operation.from };
1937
- const busy = isBusy(operation);
1938
- const failed = isFailure(operation);
1939
- const text = operationText(t, operation);
1940
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dpu-banner", role: failed ? "alert" : "status", ...failed ? { "data-tone": "error" } : {}, children: [
1941
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dpu-banner-row", children: [
1942
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: text }),
1943
- operation.phase === "failed" && operation.recoverable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "outline", onClick: () => {
1944
- void actions.restore();
1945
- }, children: t("op.restore", params) }) : null,
1946
- busy ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "ghost", onClick: actions.dismiss, children: t("op.dismiss") })
1947
- ] }),
1948
- failed && operation.output !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { className: "dpu-pre", children: operation.output }) : null,
1949
- failed && operation.logPath !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpu-caption", children: t("op.log", { path: operation.logPath }) }) : null
1950
- ] });
1660
+ const params = { from: operation.from };
1661
+ const busy = isBusy(operation);
1662
+ const failed = isFailure(operation);
1663
+ const text = operationText(t, operation);
1664
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1665
+ className: "dpu-banner",
1666
+ role: failed ? "alert" : "status",
1667
+ ...failed ? { "data-tone": "error" } : {},
1668
+ children: [
1669
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1670
+ className: "dpu-banner-row",
1671
+ children: [
1672
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: text }),
1673
+ operation.phase === "failed" && operation.recoverable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1674
+ size: "sm",
1675
+ variant: "outline",
1676
+ onClick: () => {
1677
+ actions.restore();
1678
+ },
1679
+ children: t("op.restore", params)
1680
+ }) : null,
1681
+ busy ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1682
+ size: "sm",
1683
+ variant: "ghost",
1684
+ onClick: actions.dismiss,
1685
+ children: t("op.dismiss")
1686
+ })
1687
+ ]
1688
+ }),
1689
+ failed && operation.output !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
1690
+ className: "dpu-pre",
1691
+ children: operation.output
1692
+ }) : null,
1693
+ failed && operation.logPath !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1694
+ className: "dpu-caption",
1695
+ children: t("op.log", { path: operation.logPath })
1696
+ }) : null
1697
+ ]
1698
+ });
1951
1699
  }
1700
+ /** The npm candidate a detail page shows, or undefined for rows, official items and other sources. */
1952
1701
  function useSubject({ subject, useUpdates, actions }) {
1953
- const name2 = subject.kind === "bundle" ? subject.pkg.name : void 0;
1954
- const candidate = useUpdates((state) => state.candidates.find((item) => item.name === name2));
1955
- const lookup = useUpdates((state) => name2 === void 0 ? void 0 : state.lookups[name2]);
1956
- const operation = useUpdates((state) => state.operation);
1957
- (0, import_react.useEffect)(() => {
1958
- if (name2 !== void 0) actions.ensure();
1959
- }, [actions, name2]);
1960
- return candidate === void 0 ? void 0 : { candidate, lookup, operation };
1702
+ const name = subject.kind === "bundle" ? subject.pkg.name : void 0;
1703
+ const candidate = useUpdates((state) => state.candidates.find((item) => item.name === name));
1704
+ const lookup = useUpdates((state) => name === void 0 ? void 0 : state.lookups[name]);
1705
+ const operation = useUpdates((state) => state.operation);
1706
+ (0, react.useEffect)(() => {
1707
+ if (name !== void 0) actions.ensure();
1708
+ }, [actions, name]);
1709
+ return candidate === void 0 ? void 0 : {
1710
+ candidate,
1711
+ lookup,
1712
+ operation
1713
+ };
1961
1714
  }
1962
1715
  function DetailBadge(props) {
1963
- const found = useSubject(props);
1964
- const target = found === void 0 ? void 0 : updateTarget(found.candidate, found.lookup);
1965
- return target === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tag, { tone: "info", children: props.t("status.update", { version: target }) });
1716
+ const found = useSubject(props);
1717
+ const target = found === void 0 ? void 0 : updateTarget(found.candidate, found.lookup);
1718
+ return target === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
1719
+ tone: "info",
1720
+ children: props.t("status.update", { version: target })
1721
+ });
1966
1722
  }
1967
1723
  function DetailAction(props) {
1968
- const found = useSubject(props);
1969
- const target = found === void 0 ? void 0 : updateTarget(found.candidate, found.lookup);
1970
- if (found === void 0 || target === void 0 || found.candidate.name === SELF) return null;
1971
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "primary", icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives2.IconDownloadOutlineRegular, { size: 13 }), disabled: isBusy(found.operation), onClick: () => {
1972
- void props.actions.install(found.candidate.name, target);
1973
- }, children: props.t("updateTo", { version: target }) });
1724
+ const found = useSubject(props);
1725
+ const target = found === void 0 ? void 0 : updateTarget(found.candidate, found.lookup);
1726
+ if (found === void 0 || target === void 0 || found.candidate.name === "@shellraining/dsh-plugin-updates") return null;
1727
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1728
+ size: "sm",
1729
+ variant: "primary",
1730
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconDownloadOutlineRegular, { size: 13 }),
1731
+ disabled: isBusy(found.operation),
1732
+ onClick: () => {
1733
+ props.actions.install(found.candidate.name, target);
1734
+ },
1735
+ children: props.t("updateTo", { version: target })
1736
+ });
1974
1737
  }
1975
1738
  function VersionRow({ t, info, current, disabled, onInstall }) {
1976
- const hint = !info.compatible ? t("hint.incompatible") : info.fresh ? t("hint.fresh") : void 0;
1977
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: "dpu-row", ...hint === void 0 ? {} : { title: hint }, children: [
1978
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpu-row-version dpu-mono", children: info.version }),
1979
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dpu-row-tags", children: [
1980
- current ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tag, { tone: "success", children: t("tag.current") }) : null,
1981
- info.prerelease ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tag, { tone: "neutral", children: t("tag.prerelease") }) : null,
1982
- info.deprecated ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tag, { tone: "warning", children: t("tag.deprecated") }) : null,
1983
- !info.compatible ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tag, { tone: "danger", children: t("tag.incompatible") }) : null,
1984
- info.fresh ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tag, { tone: "warning", children: t("tag.fresh") }) : null
1985
- ] }),
1986
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpu-caption", children: dateText(info.published) }),
1987
- current || onInstall === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "ghost", disabled: disabled || !info.compatible, onClick: onInstall, children: t("install") })
1988
- ] });
1739
+ const hint = !info.compatible ? t("hint.incompatible") : info.fresh ? t("hint.fresh") : void 0;
1740
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
1741
+ className: "dpu-row",
1742
+ ...hint === void 0 ? {} : { title: hint },
1743
+ children: [
1744
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1745
+ className: "dpu-row-version dpu-mono",
1746
+ children: info.version
1747
+ }),
1748
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1749
+ className: "dpu-row-tags",
1750
+ children: [
1751
+ current ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
1752
+ tone: "success",
1753
+ children: t("tag.current")
1754
+ }) : null,
1755
+ info.prerelease ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
1756
+ tone: "neutral",
1757
+ children: t("tag.prerelease")
1758
+ }) : null,
1759
+ info.deprecated ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
1760
+ tone: "warning",
1761
+ children: t("tag.deprecated")
1762
+ }) : null,
1763
+ !info.compatible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
1764
+ tone: "danger",
1765
+ children: t("tag.incompatible")
1766
+ }) : null,
1767
+ info.fresh ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
1768
+ tone: "warning",
1769
+ children: t("tag.fresh")
1770
+ }) : null
1771
+ ]
1772
+ }),
1773
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1774
+ className: "dpu-caption",
1775
+ children: dateText(info.published)
1776
+ }),
1777
+ current || onInstall === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1778
+ size: "sm",
1779
+ variant: "ghost",
1780
+ disabled: disabled || !info.compatible,
1781
+ onClick: onInstall,
1782
+ children: t("install")
1783
+ })
1784
+ ]
1785
+ });
1989
1786
  }
1990
1787
  function DetailSection(props) {
1991
- const found = useSubject(props);
1992
- const [all, setAll] = (0, import_react.useState)(false);
1993
- if (found === void 0) return null;
1994
- const { t, actions } = props;
1995
- const { candidate, lookup, operation } = found;
1996
- const self = candidate.name === SELF;
1997
- const target = updateTarget(candidate, lookup);
1998
- let body;
1999
- if (lookup === void 0 || lookup.status === "loading") body = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpu-caption", children: t("versions.loading") });
2000
- else if (lookup.status === "error") body = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpu-error", children: t("versions.failed", { reason: lookup.reason }) });
2001
- else if (lookup.versions.length === 0) body = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpu-caption", children: t("versions.empty") });
2002
- else {
2003
- const shown = all ? lookup.versions : lookup.versions.slice(0, VISIBLE_VERSIONS);
2004
- body = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
2005
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "dpu-rows", children: shown.map((info) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2006
- VersionRow,
2007
- {
2008
- t,
2009
- info,
2010
- current: info.version === candidate.version,
2011
- disabled: isBusy(operation),
2012
- onInstall: self ? void 0 : () => {
2013
- void actions.install(candidate.name, info.version);
2014
- }
2015
- },
2016
- info.version
2017
- )) }),
2018
- shown.length < lookup.versions.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "ghost", onClick: () => setAll(true), children: t("versions.showAll", { count: lookup.versions.length }) }) }) : null
2019
- ] });
2020
- }
2021
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dpu-section", "data-plugin-updates-versions": candidate.name, children: [
2022
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dpu-head", children: [
2023
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "dpu-title", children: t("versions.title") }),
2024
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dpu-summary", children: [
2025
- t("version.current", { version: candidate.version }),
2026
- lookup?.status === "ready" ? ` \xB7 ${t("versions.registry", { registry: new URL(lookup.registry).host })}` : ""
2027
- ] })
2028
- ] }),
2029
- operation?.name === candidate.name ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OperationBanner, { t, operation, actions }) : null,
2030
- self && target !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelfNotice, { t, version: target, busy: isBusy(operation), onUpdate: () => {
2031
- void actions.updateSelf(target);
2032
- } }) : null,
2033
- body
2034
- ] });
1788
+ const found = useSubject(props);
1789
+ const [all, setAll] = (0, react.useState)(false);
1790
+ if (found === void 0) return null;
1791
+ const { t, actions } = props;
1792
+ const { candidate, lookup, operation } = found;
1793
+ const self = candidate.name === SELF;
1794
+ const target = updateTarget(candidate, lookup);
1795
+ let body;
1796
+ if (lookup === void 0 || lookup.status === "loading") body = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1797
+ className: "dpu-caption",
1798
+ children: t("versions.loading")
1799
+ });
1800
+ else if (lookup.status === "error") body = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1801
+ className: "dpu-error",
1802
+ children: t("versions.failed", { reason: lookup.reason })
1803
+ });
1804
+ else if (lookup.versions.length === 0) body = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1805
+ className: "dpu-caption",
1806
+ children: t("versions.empty")
1807
+ });
1808
+ else {
1809
+ const shown = all ? lookup.versions : lookup.versions.slice(0, VISIBLE_VERSIONS);
1810
+ body = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
1811
+ className: "dpu-rows",
1812
+ children: shown.map((info) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VersionRow, {
1813
+ t,
1814
+ info,
1815
+ current: info.version === candidate.version,
1816
+ disabled: isBusy(operation),
1817
+ onInstall: self ? void 0 : () => {
1818
+ actions.install(candidate.name, info.version);
1819
+ }
1820
+ }, info.version))
1821
+ }), shown.length < lookup.versions.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1822
+ size: "sm",
1823
+ variant: "ghost",
1824
+ onClick: () => setAll(true),
1825
+ children: t("versions.showAll", { count: lookup.versions.length })
1826
+ }) }) : null] });
1827
+ }
1828
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1829
+ className: "dpu-section",
1830
+ "data-plugin-updates-versions": candidate.name,
1831
+ children: [
1832
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1833
+ className: "dpu-head",
1834
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
1835
+ className: "dpu-title",
1836
+ children: t("versions.title")
1837
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1838
+ className: "dpu-summary",
1839
+ children: [t("version.current", { version: candidate.version }), lookup?.status === "ready" ? ` · ${t("versions.registry", { registry: new URL(lookup.registry).host })}` : ""]
1840
+ })]
1841
+ }),
1842
+ operation?.name === candidate.name ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OperationBanner, {
1843
+ t,
1844
+ operation,
1845
+ actions
1846
+ }) : null,
1847
+ self && target !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelfNotice, {
1848
+ t,
1849
+ version: target,
1850
+ busy: isBusy(operation),
1851
+ onUpdate: () => {
1852
+ actions.updateSelf(target);
1853
+ }
1854
+ }) : null,
1855
+ body
1856
+ ]
1857
+ });
2035
1858
  }
1859
+ /**
1860
+ * Update controls on the Plugins page's own "Installed plugins" list: "Update
1861
+ * all" beside the group heading and an update button on each card with a newer
1862
+ * version. Rendered from the app overlay into mount nodes the adapter keeps.
1863
+ */
2036
1864
  function ListControls({ t, useUpdates, actions }) {
2037
- const [anchors, setAnchors] = (0, import_react.useState)(NO_ANCHORS);
2038
- (0, import_react.useEffect)(() => watchAnchors(document, setAnchors), []);
2039
- const visible = anchors.head !== void 0 || anchors.cards.size > 0;
2040
- (0, import_react.useEffect)(() => {
2041
- if (visible) actions.ensure();
2042
- }, [actions, visible]);
2043
- const candidates = useUpdates((state) => state.candidates);
2044
- const lookups = useUpdates((state) => state.lookups);
2045
- const operation = useUpdates((state) => state.operation);
2046
- const busy = isBusy(operation);
2047
- const targets = /* @__PURE__ */ new Map();
2048
- for (const candidate of candidates) {
2049
- const target = updateTarget(candidate, lookups[candidate.name]);
2050
- if (target !== void 0 && candidate.name !== SELF) targets.set(candidate.name, target);
2051
- }
2052
- const portals = [];
2053
- if (anchors.status !== void 0 && operation !== void 0) {
2054
- portals.push((0, import_react_dom.createPortal)(
2055
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OperationBanner, { t, operation, actions }),
2056
- anchors.status,
2057
- "operation"
2058
- ));
2059
- }
2060
- if (anchors.head !== void 0 && targets.size > 0) {
2061
- portals.push((0, import_react_dom.createPortal)(
2062
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "outline", icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives2.IconDownloadOutlineRegular, { size: 13 }), disabled: busy, onClick: () => {
2063
- void actions.updateAll();
2064
- }, children: t("updateAllCount", { count: targets.size }) }),
2065
- anchors.head,
2066
- "head"
2067
- ));
2068
- }
2069
- for (const [name2, node] of anchors.cards) {
2070
- const target = targets.get(name2);
2071
- if (target === void 0) continue;
2072
- const running = busy && operation?.name === name2;
2073
- portals.push((0, import_react_dom.createPortal)(
2074
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "outline", disabled: busy, "aria-label": t("updateLabel", { name: name2, version: target }), onClick: () => {
2075
- void actions.install(name2, target);
2076
- }, children: running ? t("updating") : t("updateTo", { version: target }) }),
2077
- node,
2078
- name2
2079
- ));
2080
- }
2081
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: portals });
1865
+ const [anchors, setAnchors] = (0, react.useState)(NO_ANCHORS);
1866
+ (0, react.useEffect)(() => watchAnchors(document, setAnchors), []);
1867
+ const visible = anchors.head !== void 0 || anchors.cards.size > 0;
1868
+ (0, react.useEffect)(() => {
1869
+ if (visible) actions.ensure();
1870
+ }, [actions, visible]);
1871
+ const candidates = useUpdates((state) => state.candidates);
1872
+ const lookups = useUpdates((state) => state.lookups);
1873
+ const operation = useUpdates((state) => state.operation);
1874
+ const busy = isBusy(operation);
1875
+ const targets = /* @__PURE__ */ new Map();
1876
+ for (const candidate of candidates) {
1877
+ const target = updateTarget(candidate, lookups[candidate.name]);
1878
+ if (target !== void 0 && candidate.name !== "@shellraining/dsh-plugin-updates") targets.set(candidate.name, target);
1879
+ }
1880
+ const portals = [];
1881
+ if (anchors.status !== void 0 && operation !== void 0) portals.push((0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(OperationBanner, {
1882
+ t,
1883
+ operation,
1884
+ actions
1885
+ }), anchors.status, "operation"));
1886
+ if (anchors.head !== void 0 && targets.size > 0) portals.push((0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1887
+ size: "sm",
1888
+ variant: "outline",
1889
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconDownloadOutlineRegular, { size: 13 }),
1890
+ disabled: busy,
1891
+ onClick: () => {
1892
+ actions.updateAll();
1893
+ },
1894
+ children: t("updateAllCount", { count: targets.size })
1895
+ }), anchors.head, "head"));
1896
+ for (const [name, node] of anchors.cards) {
1897
+ const target = targets.get(name);
1898
+ if (target === void 0) continue;
1899
+ const running = busy && operation?.name === name;
1900
+ portals.push((0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1901
+ size: "sm",
1902
+ variant: "outline",
1903
+ disabled: busy,
1904
+ "aria-label": t("updateLabel", {
1905
+ name,
1906
+ version: target
1907
+ }),
1908
+ onClick: () => {
1909
+ actions.install(name, target);
1910
+ },
1911
+ children: running ? t("updating") : t("updateTo", { version: target })
1912
+ }), node, name));
1913
+ }
1914
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: portals });
2082
1915
  }
2083
-
2084
1916
  // src/client/index.tsx
2085
1917
  var name = "@shellraining/dsh-plugin-updates";
2086
- var inject = ["slots", "locale", "remote", "remote.pluginManager"];
1918
+ var inject = [
1919
+ "slots",
1920
+ "locale",
1921
+ "remote",
1922
+ "remote.pluginManager"
1923
+ ];
2087
1924
  function apply(ctx) {
2088
- ctx.effect(() => ctx.locale.register(LOCALE_NS, { zh: ZH, en: EN }), `${name}: copy`);
2089
- ctx.effect(() => installStyle(document), `${name}: stylesheet`);
2090
- const store = new UpdatesStore(ctx);
2091
- ctx.effect(() => () => store.dispose(), `${name}: store`);
2092
- ctx.effect(() => {
2093
- const offs = [ctx.remote.$on("plugin-manager/changed", store.bundlesChanged), ctx.on("connection/reset", store.bundlesChanged)];
2094
- return () => {
2095
- for (const off of offs) off();
2096
- };
2097
- }, `${name}: host invalidations`);
2098
- void store.watchSelf();
2099
- const t = ctx.locale.bind(LOCALE_NS);
2100
- const face = {
2101
- hooks: { updates: store },
2102
- actions: {
2103
- ensure: store.ensure,
2104
- install: store.install,
2105
- updateSelf: store.updateSelf,
2106
- updateAll: store.updateAll,
2107
- restore: store.restore,
2108
- dismiss: store.dismiss,
2109
- toastDone: store.toastDone
2110
- }
2111
- };
2112
- ctx.slots.inject("shell.overlay", () => ctx.slots.register({
2113
- name: "shell.overlay",
2114
- id: "plugin-updates.toast",
2115
- locale: LOCALE_NS,
2116
- inject: () => face
2117
- }, OperationToast));
2118
- ctx.slots.inject("shell.overlay", () => ctx.slots.register({
2119
- name: "shell.overlay",
2120
- id: "plugin-updates.list",
2121
- locale: LOCALE_NS,
2122
- inject: () => face
2123
- }, ListControls));
2124
- for (const [slot, component] of [
2125
- ["plugins.detail.badge", DetailBadge],
2126
- ["plugins.detail.actions", DetailAction],
2127
- ["plugins.detail.section", DetailSection]
2128
- ]) {
2129
- ctx.slots.inject(slot, () => ctx.slots.register({
2130
- name: slot,
2131
- id: "plugin-updates",
2132
- locale: LOCALE_NS,
2133
- inject: () => face
2134
- }, component));
2135
- }
1925
+ ctx.effect(() => ctx.locale.register(LOCALE_NS, {
1926
+ zh: ZH,
1927
+ en: EN
1928
+ }), `${name}: copy`);
1929
+ ctx.effect(() => installStyle(document), `${name}: stylesheet`);
1930
+ const store = new UpdatesStore(ctx);
1931
+ ctx.effect(() => () => store.dispose(), `${name}: store`);
1932
+ ctx.effect(() => {
1933
+ const offs = [ctx.remote.$on("plugin-manager/changed", store.bundlesChanged), ctx.on("connection/reset", store.bundlesChanged)];
1934
+ return () => {
1935
+ for (const off of offs) off();
1936
+ };
1937
+ }, `${name}: host invalidations`);
1938
+ store.watchSelf();
1939
+ ctx.locale.bind(LOCALE_NS);
1940
+ const face = {
1941
+ hooks: { updates: store },
1942
+ actions: {
1943
+ ensure: store.ensure,
1944
+ install: store.install,
1945
+ updateSelf: store.updateSelf,
1946
+ updateAll: store.updateAll,
1947
+ restore: store.restore,
1948
+ dismiss: store.dismiss,
1949
+ toastDone: store.toastDone
1950
+ }
1951
+ };
1952
+ ctx.slots.inject("shell.overlay", () => ctx.slots.register({
1953
+ name: "shell.overlay",
1954
+ id: "plugin-updates.toast",
1955
+ locale: LOCALE_NS,
1956
+ inject: () => face
1957
+ }, OperationToast));
1958
+ ctx.slots.inject("shell.overlay", () => ctx.slots.register({
1959
+ name: "shell.overlay",
1960
+ id: "plugin-updates.list",
1961
+ locale: LOCALE_NS,
1962
+ inject: () => face
1963
+ }, ListControls));
1964
+ for (const [slot, component] of [
1965
+ ["plugins.detail.badge", DetailBadge],
1966
+ ["plugins.detail.actions", DetailAction],
1967
+ ["plugins.detail.section", DetailSection]
1968
+ ]) ctx.slots.inject(slot, () => ctx.slots.register({
1969
+ name: slot,
1970
+ id: "plugin-updates",
1971
+ locale: LOCALE_NS,
1972
+ inject: () => face
1973
+ }, component));
2136
1974
  }
1975
+ exports.apply = apply;
1976
+ exports.inject = inject;
1977
+ exports.name = name;
2137
1978
 
2138
1979
  return module.exports;
2139
1980
  },