@linkdesk/ui 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import "./index.css";
2
- import { jsx as d, jsxs as F, Fragment as xe } from "react/jsx-runtime";
3
- import { useRef as H, useEffect as R, useState as P, useCallback as B, useLayoutEffect as re, useMemo as z, forwardRef as se, useImperativeHandle as Me, useContext as Ne, createContext as Ee, createElement as oe } from "react";
4
- import Ae, { createPortal as ce } from "react-dom";
2
+ import { jsx as f, jsxs as H, Fragment as xe } from "react/jsx-runtime";
3
+ import { useRef as F, useEffect as R, useState as P, useCallback as K, useLayoutEffect as oe, useMemo as z, forwardRef as ce, useImperativeHandle as Me, useContext as Ne, createContext as Ce, createElement as re } from "react";
4
+ import Ae, { createPortal as se } from "react-dom";
5
5
  import { useTranslation as j } from "react-i18next";
6
- function Ce({ children: t, onClick: n, disabled: e, title: o, type: r = "button" }) {
7
- return /* @__PURE__ */ d("button", { type: r, className: "button", onClick: n, disabled: e, title: o, children: t });
6
+ function Ee({ children: t, onClick: n, disabled: e, title: r, type: o = "button" }) {
7
+ return /* @__PURE__ */ f("button", { type: o, className: "button", onClick: n, disabled: e, title: r, children: t });
8
8
  }
9
9
  var q = {}, ae;
10
10
  function Ie() {
@@ -15,17 +15,17 @@ function Ie() {
15
15
  q.createRoot = t.createRoot, q.hydrateRoot = t.hydrateRoot;
16
16
  else {
17
17
  var n = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
18
- q.createRoot = function(e, o) {
18
+ q.createRoot = function(e, r) {
19
19
  n.usingClientEntryPoint = !0;
20
20
  try {
21
- return t.createRoot(e, o);
21
+ return t.createRoot(e, r);
22
22
  } finally {
23
23
  n.usingClientEntryPoint = !1;
24
24
  }
25
- }, q.hydrateRoot = function(e, o, r) {
25
+ }, q.hydrateRoot = function(e, r, o) {
26
26
  n.usingClientEntryPoint = !0;
27
27
  try {
28
- return t.hydrateRoot(e, o, r);
28
+ return t.hydrateRoot(e, r, o);
29
29
  } finally {
30
30
  n.usingClientEntryPoint = !1;
31
31
  }
@@ -39,45 +39,45 @@ function we() {
39
39
  return document.getElementById(_e) ?? document.body;
40
40
  }
41
41
  const le = 'a[href],button:not([disabled]),input:not([disabled]),textarea:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';
42
- function ie({ children: t, onClose: n, triggerRef: e, trapFocus: o, zIndex: r, rootId: c, open: s = !0 }) {
43
- const h = H(null);
42
+ function ie({ children: t, onClose: n, triggerRef: e, trapFocus: r, zIndex: o, rootId: s, open: c = !0 }) {
43
+ const i = F(null);
44
44
  R(() => {
45
- if (!s || !n) return;
46
- const l = (i) => {
47
- var a, x;
48
- const k = i.target, v = (a = h.current) == null ? void 0 : a.contains(k), m = ((x = e == null ? void 0 : e.current) == null ? void 0 : x.contains(k)) ?? !1;
45
+ if (!c || !n) return;
46
+ const a = (l) => {
47
+ var u, x;
48
+ const k = l.target, v = (u = i.current) == null ? void 0 : u.contains(k), m = ((x = e == null ? void 0 : e.current) == null ? void 0 : x.contains(k)) ?? !1;
49
49
  !v && !m && n();
50
50
  };
51
- return window.addEventListener("mousedown", l, !0), () => window.removeEventListener("mousedown", l, !0);
52
- }, [s, n, e]), R(() => {
53
- if (!s || !n) return;
54
- const l = (i) => {
55
- i.key === "Escape" && n();
51
+ return window.addEventListener("mousedown", a, !0), () => window.removeEventListener("mousedown", a, !0);
52
+ }, [c, n, e]), R(() => {
53
+ if (!c || !n) return;
54
+ const a = (l) => {
55
+ l.key === "Escape" && n();
56
56
  };
57
- return window.addEventListener("keydown", l), () => window.removeEventListener("keydown", l);
58
- }, [s, n]), R(() => {
59
- if (!s || !o) return;
60
- const l = h.current;
61
- if (!l) return;
62
- const i = l.querySelector(le);
63
- i ? i.focus() : (l.tabIndex = -1, l.focus());
57
+ return window.addEventListener("keydown", a), () => window.removeEventListener("keydown", a);
58
+ }, [c, n]), R(() => {
59
+ if (!c || !r) return;
60
+ const a = i.current;
61
+ if (!a) return;
62
+ const l = a.querySelector(le);
63
+ l ? l.focus() : (a.tabIndex = -1, a.focus());
64
64
  const k = (v) => {
65
65
  if (v.key !== "Tab") return;
66
- const m = Array.from(l.querySelectorAll(le));
66
+ const m = Array.from(a.querySelectorAll(le));
67
67
  if (m.length === 0) {
68
68
  v.preventDefault();
69
69
  return;
70
70
  }
71
- const a = m[0], x = m[m.length - 1];
72
- v.shiftKey && document.activeElement === a ? (v.preventDefault(), x.focus()) : !v.shiftKey && document.activeElement === x && (v.preventDefault(), a.focus());
71
+ const u = m[0], x = m[m.length - 1];
72
+ v.shiftKey && document.activeElement === u ? (v.preventDefault(), x.focus()) : !v.shiftKey && document.activeElement === x && (v.preventDefault(), u.focus());
73
73
  };
74
74
  return window.addEventListener("keydown", k), () => window.removeEventListener("keydown", k);
75
- }, [s, o]);
76
- const u = {
75
+ }, [c, r]);
76
+ const d = {
77
77
  position: "relative",
78
- ...r ? { zIndex: r } : {}
78
+ ...o ? { zIndex: o } : {}
79
79
  };
80
- return ce(
80
+ return se(
81
81
  // E5.8#109:data-overlay-wrapper 结构标记——浮层权威的「隔离地板」(index.css)用它排除本包装盒。
82
82
  // 包装盒是结构容器(ref/zIndex 载体)不是表面:若地板规则的深度 2 选择器给它的 backdrop-filter,
83
83
  // 它就成了 backdrop root,把内部真实表面的 backdrop 采样掐断(E5.8#103 地板因此从未对
@@ -86,23 +86,23 @@ function ie({ children: t, onClose: n, triggerRef: e, trapFocus: o, zIndex: r, r
86
86
  // 对外只算包装盒 z-auto(0),被 scrim 遮罩 z500 盖住 → 点在预期位置实中遮罩 onClose =「点一下自己退」。
87
87
  // 故包装盒必须保持零 stacking-context 属性(backdrop-filter/filter/transform/z-index 均禁;
88
88
  // zIndex 例外见 prop 契约——需 z-index 时必须 > scrim 遮罩 500)。
89
- /* @__PURE__ */ d("div", { ref: h, "data-overlay-wrapper": !0, style: Object.keys(u).length > 1 ? u : {}, children: t }),
89
+ /* @__PURE__ */ f("div", { ref: i, "data-overlay-wrapper": !0, style: Object.keys(d).length > 1 ? d : {}, children: t }),
90
90
  // E5.8#107 单一门:默认 → #overlay-root(浮层权威 surface 根);显式 rootId 优先;根缺失回退 body
91
- (c ? document.getElementById(c) : document.getElementById(Le)) ?? document.body
91
+ (s ? document.getElementById(s) : document.getElementById(Le)) ?? document.body
92
92
  );
93
93
  }
94
- const ue = 232, de = 224, fe = 263, $e = 8;
95
- function J(t, n, e, o, r = $e) {
96
- const c = Math.max(r, o.width - n - r), s = Math.max(r, o.height - e - r), h = Math.min(Math.max(
97
- t.x + n + r <= o.width ? t.x : t.x - n - r,
98
- r
99
- ), c), u = Math.min(Math.max(
100
- t.y + e + r <= o.height ? t.y : t.y - e - r,
101
- r
102
- ), s);
103
- return { left: h, top: u };
94
+ const ue = 232, de = 224, fe = 263, De = 8;
95
+ function J(t, n, e, r, o = De) {
96
+ const s = Math.max(o, r.width - n - o), c = Math.max(o, r.height - e - o), i = Math.min(Math.max(
97
+ t.x + n + o <= r.width ? t.x : t.x - n - o,
98
+ o
99
+ ), s), d = Math.min(Math.max(
100
+ t.y + e + o <= r.height ? t.y : t.y - e - o,
101
+ o
102
+ ), c);
103
+ return { left: i, top: d };
104
104
  }
105
- function De(t) {
105
+ function $e(t) {
106
106
  const n = t.replace("#", "");
107
107
  return [
108
108
  parseInt(n.substring(0, 2), 16),
@@ -110,112 +110,112 @@ function De(t) {
110
110
  parseInt(n.substring(4, 6), 16)
111
111
  ];
112
112
  }
113
- function Se(t, n, e) {
114
- return "#" + [t, n, e].map((o) => Math.max(0, Math.min(255, Math.round(o))).toString(16).padStart(2, "0")).join("");
115
- }
116
113
  function Re(t, n, e) {
117
- const o = e * n, r = o * (1 - Math.abs(t / 60 % 2 - 1)), c = e - o;
118
- let s = 0, h = 0, u = 0;
119
- return t < 60 ? (s = o, h = r) : t < 120 ? (s = r, h = o) : t < 180 ? (h = o, u = r) : t < 240 ? (h = r, u = o) : t < 300 ? (s = r, u = o) : (s = o, u = r), [Math.round((s + c) * 255), Math.round((h + c) * 255), Math.round((u + c) * 255)];
114
+ return "#" + [t, n, e].map((r) => Math.max(0, Math.min(255, Math.round(r))).toString(16).padStart(2, "0")).join("");
115
+ }
116
+ function Se(t, n, e) {
117
+ const r = e * n, o = r * (1 - Math.abs(t / 60 % 2 - 1)), s = e - r;
118
+ let c = 0, i = 0, d = 0;
119
+ return t < 60 ? (c = r, i = o) : t < 120 ? (c = o, i = r) : t < 180 ? (i = r, d = o) : t < 240 ? (i = o, d = r) : t < 300 ? (c = o, d = r) : (c = r, d = o), [Math.round((c + s) * 255), Math.round((i + s) * 255), Math.round((d + s) * 255)];
120
120
  }
121
121
  function Te(t, n, e) {
122
- const o = Math.max(t, n, e) / 255, r = Math.min(t, n, e) / 255, c = o - r;
123
- let s = 0;
124
- c > 0 && (o === t / 255 ? s = 60 * ((n / 255 - e / 255) / c % 6) : o === n / 255 ? s = 60 * ((e / 255 - t / 255) / c + 2) : s = 60 * ((t / 255 - n / 255) / c + 4)), s < 0 && (s += 360);
125
- const h = o === 0 ? 0 : c / o;
126
- return { h: s, s: h, v: o };
122
+ const r = Math.max(t, n, e) / 255, o = Math.min(t, n, e) / 255, s = r - o;
123
+ let c = 0;
124
+ s > 0 && (r === t / 255 ? c = 60 * ((n / 255 - e / 255) / s % 6) : r === n / 255 ? c = 60 * ((e / 255 - t / 255) / s + 2) : c = 60 * ((t / 255 - n / 255) / s + 4)), c < 0 && (c += 360);
125
+ const i = r === 0 ? 0 : s / r;
126
+ return { h: c, s: i, v: r };
127
127
  }
128
128
  function X(t) {
129
- const [n, e, o] = De(t);
130
- return Te(n, e, o);
129
+ const [n, e, r] = $e(t);
130
+ return Te(n, e, r);
131
131
  }
132
132
  function Q(t, n, e) {
133
- const [o, r, c] = Re(t, n, e);
134
- return Se(o, r, c);
133
+ const [r, o, s] = Se(t, n, e);
134
+ return Re(r, o, s);
135
135
  }
136
136
  function Pe(t) {
137
137
  let n = t.replace(/[^0-9a-fA-F]/g, "").slice(0, 6);
138
138
  return n.length > 0 && (n = "#" + n), n;
139
139
  }
140
- function At({ open: t, value: n, onChange: e, onClose: o, presets: r, anchor: c }) {
141
- const [s, h] = P(() => X(n)), [u, l] = P(n), i = H(null), k = H(null), v = H(null), m = H(null), a = H(s), [x, D] = P(null);
140
+ function At({ open: t, value: n, onChange: e, onClose: r, presets: o, anchor: s }) {
141
+ const [c, i] = P(() => X(n)), [d, a] = P(n), l = F(null), k = F(null), v = F(null), m = F(null), u = F(c), [x, $] = P(null);
142
142
  R(() => {
143
143
  if (t) {
144
144
  const p = X(n);
145
- a.current = p, h(p), l(n);
145
+ u.current = p, i(p), a(n);
146
146
  }
147
147
  }, [n, t]);
148
- const $ = B((p) => {
149
- const C = Pe(p);
150
- if (l(C), /^#[0-9a-fA-F]{6}$/.test(C)) {
151
- const K = X(C);
152
- return a.current = K, h(K), C;
148
+ const D = K((p) => {
149
+ const E = Pe(p);
150
+ if (a(E), /^#[0-9a-fA-F]{6}$/.test(E)) {
151
+ const W = X(E);
152
+ return u.current = W, i(W), E;
153
153
  }
154
154
  return null;
155
- }, []), A = B((p) => {
156
- var E;
157
- const C = (E = i.current) == null ? void 0 : E.getBoundingClientRect();
158
- if (!C) return;
159
- const K = Math.max(0, Math.min(1, (p.clientX - C.left) / C.width)), V = Math.max(0, Math.min(1, (p.clientY - C.top) / C.height)), w = { ...a.current, s: K, v: 1 - V };
160
- a.current = w, h(w), l(Q(w.h, w.s, w.v));
161
- }, []), _ = B((p) => {
155
+ }, []), A = K((p) => {
156
+ var C;
157
+ const E = (C = l.current) == null ? void 0 : C.getBoundingClientRect();
158
+ if (!E) return;
159
+ const W = Math.max(0, Math.min(1, (p.clientX - E.left) / E.width)), V = Math.max(0, Math.min(1, (p.clientY - E.top) / E.height)), w = { ...u.current, s: W, v: 1 - V };
160
+ u.current = w, i(w), a(Q(w.h, w.s, w.v));
161
+ }, []), _ = K((p) => {
162
162
  var w;
163
- const C = (w = k.current) == null ? void 0 : w.getBoundingClientRect();
164
- if (!C) return;
165
- const K = Math.max(0, Math.min(1, (p.clientX - C.left) / C.width)), y = { ...a.current, h: K * 360 };
166
- a.current = y, h(y), l(Q(y.h, y.s, y.v));
163
+ const E = (w = k.current) == null ? void 0 : w.getBoundingClientRect();
164
+ if (!E) return;
165
+ const W = Math.max(0, Math.min(1, (p.clientX - E.left) / E.width)), y = { ...u.current, h: W * 360 };
166
+ u.current = y, i(y), a(Q(y.h, y.s, y.v));
167
167
  }, []);
168
168
  if (R(() => {
169
169
  if (!t) return;
170
170
  const p = () => {
171
171
  m.current = null;
172
- }, C = (K) => {
173
- m.current === "sv" ? A(K) : m.current === "hue" && _(K);
172
+ }, E = (W) => {
173
+ m.current === "sv" ? A(W) : m.current === "hue" && _(W);
174
174
  };
175
- return window.addEventListener("mouseup", p), window.addEventListener("mousemove", C), () => {
176
- window.removeEventListener("mouseup", p), window.removeEventListener("mousemove", C);
175
+ return window.addEventListener("mouseup", p), window.addEventListener("mousemove", E), () => {
176
+ window.removeEventListener("mouseup", p), window.removeEventListener("mousemove", E);
177
177
  };
178
- }, [t, A, _]), re(() => {
179
- if (!t || !c) {
180
- D(null);
178
+ }, [t, A, _]), oe(() => {
179
+ if (!t || !s) {
180
+ $(null);
181
181
  return;
182
182
  }
183
- const p = v.current, C = { width: window.innerWidth, height: window.innerHeight }, K = p ? J(c, p.offsetWidth, p.offsetHeight, C) : J(c, ue, r != null && r.length ? fe : de, C);
184
- D((V) => V && V.left === K.left && V.top === K.top ? V : K);
185
- }, [t, c, r]), !t) return null;
186
- const I = Q(s.h, 1, 1), S = `${Math.round(s.s * 100)}%`, M = `${Math.round((1 - s.v) * 100)}%`, g = `${Math.round(s.h / 360 * 100)}%`, b = c && !x ? J(
187
- c,
183
+ const p = v.current, E = { width: window.innerWidth, height: window.innerHeight }, W = p ? J(s, p.offsetWidth, p.offsetHeight, E) : J(s, ue, o != null && o.length ? fe : de, E);
184
+ $((V) => V && V.left === W.left && V.top === W.top ? V : W);
185
+ }, [t, s, o]), !t) return null;
186
+ const I = Q(c.h, 1, 1), S = `${Math.round(c.s * 100)}%`, M = `${Math.round((1 - c.v) * 100)}%`, g = `${Math.round(c.h / 360 * 100)}%`, b = s && !x ? J(
187
+ s,
188
188
  ue,
189
- r != null && r.length ? fe : de,
189
+ o != null && o.length ? fe : de,
190
190
  { width: window.innerWidth, height: window.innerHeight }
191
- ) : null, f = x ?? b;
192
- return /* @__PURE__ */ F(ie, { onClose: o, children: [
193
- ce(/* @__PURE__ */ d("div", { className: "colorpicker-overlay", onClick: () => o() }), we()),
194
- /* @__PURE__ */ F(
191
+ ) : null, h = x ?? b;
192
+ return /* @__PURE__ */ H(ie, { onClose: r, children: [
193
+ se(/* @__PURE__ */ f("div", { className: "colorpicker-overlay", onClick: () => r() }), we()),
194
+ /* @__PURE__ */ H(
195
195
  "div",
196
196
  {
197
197
  ref: v,
198
198
  className: "colorpicker-panel",
199
- style: c && f ? { left: f.left, top: f.top } : void 0,
199
+ style: s && h ? { left: h.left, top: h.top } : void 0,
200
200
  onClick: (p) => p.stopPropagation(),
201
201
  children: [
202
- /* @__PURE__ */ F(
202
+ /* @__PURE__ */ H(
203
203
  "div",
204
204
  {
205
- ref: i,
205
+ ref: l,
206
206
  className: "colorpicker-sv",
207
207
  style: { background: I },
208
208
  onMouseDown: (p) => {
209
209
  m.current = "sv", A(p);
210
210
  },
211
211
  children: [
212
- /* @__PURE__ */ d("div", { className: "colorpicker-sv-white" }),
213
- /* @__PURE__ */ d("div", { className: "colorpicker-sv-black" }),
214
- /* @__PURE__ */ d("div", { className: "colorpicker-sv-cursor", style: { left: S, top: M } })
212
+ /* @__PURE__ */ f("div", { className: "colorpicker-sv-white" }),
213
+ /* @__PURE__ */ f("div", { className: "colorpicker-sv-black" }),
214
+ /* @__PURE__ */ f("div", { className: "colorpicker-sv-cursor", style: { left: S, top: M } })
215
215
  ]
216
216
  }
217
217
  ),
218
- /* @__PURE__ */ d(
218
+ /* @__PURE__ */ f(
219
219
  "div",
220
220
  {
221
221
  ref: k,
@@ -223,43 +223,43 @@ function At({ open: t, value: n, onChange: e, onClose: o, presets: r, anchor: c
223
223
  onMouseDown: (p) => {
224
224
  m.current = "hue", _(p);
225
225
  },
226
- children: /* @__PURE__ */ d("div", { className: "colorpicker-hue-cursor", style: { left: g } })
226
+ children: /* @__PURE__ */ f("div", { className: "colorpicker-hue-cursor", style: { left: g } })
227
227
  }
228
228
  ),
229
- /* @__PURE__ */ F("div", { className: "colorpicker-footer", children: [
230
- /* @__PURE__ */ d("div", { className: "colorpicker-preview", style: { background: u } }),
231
- /* @__PURE__ */ d(
229
+ /* @__PURE__ */ H("div", { className: "colorpicker-footer", children: [
230
+ /* @__PURE__ */ f("div", { className: "colorpicker-preview", style: { background: d } }),
231
+ /* @__PURE__ */ f(
232
232
  "input",
233
233
  {
234
234
  className: "colorpicker-hex",
235
235
  type: "text",
236
- value: u,
236
+ value: d,
237
237
  onChange: (p) => {
238
- const C = $(p.target.value);
239
- C && e(C);
238
+ const E = D(p.target.value);
239
+ E && e(E);
240
240
  },
241
241
  onKeyDown: (p) => {
242
242
  if (p.key === "Enter") {
243
- const C = $(u);
244
- C && e(C);
243
+ const E = D(d);
244
+ E && e(E);
245
245
  }
246
246
  },
247
247
  spellCheck: !1
248
248
  }
249
249
  ),
250
- /* @__PURE__ */ d("button", { className: "colorpicker-ok", onClick: () => {
251
- e(u), o();
250
+ /* @__PURE__ */ f("button", { className: "colorpicker-ok", onClick: () => {
251
+ e(d), r();
252
252
  }, children: "OK" })
253
253
  ] }),
254
- r && r.length > 0 && /* @__PURE__ */ d("div", { className: "colorpicker-presets", children: r.map((p) => /* @__PURE__ */ d(
254
+ o && o.length > 0 && /* @__PURE__ */ f("div", { className: "colorpicker-presets", children: o.map((p) => /* @__PURE__ */ f(
255
255
  "div",
256
256
  {
257
257
  className: "colorpicker-preset",
258
258
  style: { background: p },
259
259
  title: p,
260
260
  onClick: () => {
261
- const C = X(p);
262
- a.current = C, h(C), l(p), e(p);
261
+ const E = X(p);
262
+ u.current = E, i(E), a(p), e(p);
263
263
  }
264
264
  },
265
265
  p
@@ -270,47 +270,47 @@ function At({ open: t, value: n, onChange: e, onClose: o, presets: r, anchor: c
270
270
  ] });
271
271
  }
272
272
  const Fe = { left: 0, top: 0, width: 100, maxWidth: 300 };
273
- function ve({ containerRef: t, onClose: n, onKeyDown: e, listRef: o, search: r, children: c }) {
274
- const [s, h] = P(Fe), u = B(() => {
273
+ function ve({ containerRef: t, onClose: n, onKeyDown: e, listRef: r, search: o, children: s }) {
274
+ const [c, i] = P(Fe), d = K(() => {
275
275
  var k;
276
- const l = (k = t.current) == null ? void 0 : k.getBoundingClientRect();
277
- if (!l) return;
278
- const i = {
279
- left: Math.round(l.left),
280
- top: Math.round(l.bottom) + 2,
281
- width: Math.round(l.width),
282
- maxWidth: Math.round(window.innerWidth - l.left - 24)
276
+ const a = (k = t.current) == null ? void 0 : k.getBoundingClientRect();
277
+ if (!a) return;
278
+ const l = {
279
+ left: Math.round(a.left),
280
+ top: Math.round(a.bottom) + 2,
281
+ width: Math.round(a.width),
282
+ maxWidth: Math.round(window.innerWidth - a.left - 24)
283
283
  };
284
- h(
285
- (v) => v.left === i.left && v.top === i.top && v.width === i.width && v.maxWidth === i.maxWidth ? v : i
284
+ i(
285
+ (v) => v.left === l.left && v.top === l.top && v.width === l.width && v.maxWidth === l.maxWidth ? v : l
286
286
  );
287
287
  }, [t]);
288
- return re(() => (u(), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), () => {
289
- window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0);
290
- }), [u]), R(() => {
291
- t.current || u();
292
- }, [t, u]), /* @__PURE__ */ d(ie, { onClose: n, triggerRef: t, children: /* @__PURE__ */ F(
288
+ return oe(() => (d(), window.addEventListener("resize", d), window.addEventListener("scroll", d, !0), () => {
289
+ window.removeEventListener("resize", d), window.removeEventListener("scroll", d, !0);
290
+ }), [d]), R(() => {
291
+ t.current || d();
292
+ }, [t, d]), /* @__PURE__ */ f(ie, { onClose: n, triggerRef: t, children: /* @__PURE__ */ H(
293
293
  "div",
294
294
  {
295
295
  className: "selectbox-dropdown",
296
296
  onKeyDown: e,
297
297
  style: {
298
298
  position: "fixed",
299
- left: s.left,
300
- top: s.top,
301
- minWidth: s.width,
299
+ left: c.left,
300
+ top: c.top,
301
+ minWidth: c.width,
302
302
  // 动态 maxWidth——面板不超过窗口右边缘 - 24px 呼吸,不硬编码固定值
303
- maxWidth: s.maxWidth
303
+ maxWidth: c.maxWidth
304
304
  },
305
305
  children: [
306
- r,
307
- /* @__PURE__ */ d("ul", { ref: o, className: "selectbox-list", tabIndex: -1, children: c })
306
+ o,
307
+ /* @__PURE__ */ f("ul", { ref: r, className: "selectbox-list", tabIndex: -1, children: s })
308
308
  ]
309
309
  }
310
310
  ) });
311
311
  }
312
- function Ct({ value: t, options: n, onChange: e, disabled: o, placeholder: r, title: c, className: s, onOpen: h, inputMode: u = "text" }) {
313
- const { t: l } = j(), [i, k] = P(!1), [v, m] = P(t), [a, x] = P(-1), D = H(null), $ = H(null), A = H(!1);
312
+ function Et({ value: t, options: n, onChange: e, disabled: r, placeholder: o, title: s, className: c, onOpen: i, inputMode: d = "text" }) {
313
+ const { t: a } = j(), [l, k] = P(!1), [v, m] = P(t), [u, x] = P(-1), $ = F(null), D = F(null), A = F(!1);
314
314
  R(() => {
315
315
  A.current || m(t);
316
316
  }, [t]);
@@ -320,24 +320,24 @@ function Ct({ value: t, options: n, onChange: e, disabled: o, placeholder: r, ti
320
320
  return g ? n.filter((b) => b.toLowerCase().includes(g)) : n;
321
321
  }, [n, v, _]);
322
322
  R(() => {
323
- a >= I.length && x(Math.max(0, I.length - 1));
324
- }, [I.length, a]), R(() => {
325
- if (!i) return;
326
- h == null || h();
323
+ u >= I.length && x(Math.max(0, I.length - 1));
324
+ }, [I.length, u]), R(() => {
325
+ if (!l) return;
326
+ i == null || i();
327
327
  const g = I.findIndex((b) => b === t);
328
328
  x(g >= 0 ? g : 0);
329
- }, [i]), R(() => {
330
- if (!i || !$.current) return;
331
- const g = $.current.children[a];
329
+ }, [l]), R(() => {
330
+ if (!l || !D.current) return;
331
+ const g = D.current.children[u];
332
332
  g == null || g.scrollIntoView({ block: "nearest" });
333
- }, [a, i]);
334
- const S = B(
333
+ }, [u, l]);
334
+ const S = K(
335
335
  (g) => {
336
336
  const b = g.trim();
337
337
  k(!1), b && (m(b), b !== t && e(b));
338
338
  },
339
339
  [t, e]
340
- ), M = B(
340
+ ), M = K(
341
341
  (g) => {
342
342
  switch (g.key) {
343
343
  case "ArrowDown":
@@ -347,33 +347,33 @@ function Ct({ value: t, options: n, onChange: e, disabled: o, placeholder: r, ti
347
347
  g.preventDefault(), k(!0), x((b) => Math.max(b - 1, 0));
348
348
  break;
349
349
  case "Enter":
350
- g.preventDefault(), i && I[a] ? S(I[a]) : S(v);
350
+ g.preventDefault(), l && I[u] ? S(I[u]) : S(v);
351
351
  break;
352
352
  case "Escape":
353
353
  g.preventDefault(), m(t), k(!1);
354
354
  break;
355
355
  }
356
356
  },
357
- [i, I, a, S, v, t]
357
+ [l, I, u, S, v, t]
358
358
  );
359
- return /* @__PURE__ */ F(
359
+ return /* @__PURE__ */ H(
360
360
  "div",
361
361
  {
362
- className: `combobox ${i ? "selectbox-open" : ""} ${o ? "selectbox-disabled" : ""} ${s ?? ""}`,
363
- ref: D,
362
+ className: `combobox ${l ? "selectbox-open" : ""} ${r ? "selectbox-disabled" : ""} ${c ?? ""}`,
363
+ ref: $,
364
364
  children: [
365
- /* @__PURE__ */ F("div", { className: "combobox-field", children: [
366
- /* @__PURE__ */ d(
365
+ /* @__PURE__ */ H("div", { className: "combobox-field", children: [
366
+ /* @__PURE__ */ f(
367
367
  "input",
368
368
  {
369
369
  type: "text",
370
- inputMode: u,
370
+ inputMode: d,
371
371
  className: "combobox-input",
372
372
  value: v,
373
- title: c,
374
- "aria-label": c,
375
- placeholder: r,
376
- disabled: o,
373
+ title: s,
374
+ "aria-label": s,
375
+ placeholder: o,
376
+ disabled: r,
377
377
  onFocus: () => {
378
378
  A.current = !0, k(!0);
379
379
  },
@@ -386,20 +386,20 @@ function Ct({ value: t, options: n, onChange: e, disabled: o, placeholder: r, ti
386
386
  onKeyDown: M
387
387
  }
388
388
  ),
389
- /* @__PURE__ */ d("span", { className: `codicon codicon-chevron-down selectbox-arrow ${i ? "selectbox-arrow-up" : ""}` })
389
+ /* @__PURE__ */ f("span", { className: `codicon codicon-chevron-down selectbox-arrow ${l ? "selectbox-arrow-up" : ""}` })
390
390
  ] }),
391
- i && /* @__PURE__ */ d(
391
+ l && /* @__PURE__ */ f(
392
392
  ve,
393
393
  {
394
- containerRef: D,
394
+ containerRef: $,
395
395
  onClose: () => k(!1),
396
- listRef: $,
397
- children: I.length === 0 ? /* @__PURE__ */ d("li", { className: "selectbox-empty", children: l("无匹配项") }) : I.map((g, b) => /* @__PURE__ */ d(
396
+ listRef: D,
397
+ children: I.length === 0 ? /* @__PURE__ */ f("li", { className: "selectbox-empty", children: a("无匹配项") }) : I.map((g, b) => /* @__PURE__ */ f(
398
398
  "li",
399
399
  {
400
- className: `selectbox-item ${b === a ? "selectbox-item-focus" : ""} ${g === t ? "selectbox-item-selected" : ""}`,
401
- onMouseDown: (f) => {
402
- f.preventDefault(), S(g);
400
+ className: `selectbox-item ${b === u ? "selectbox-item-focus" : ""} ${g === t ? "selectbox-item-selected" : ""}`,
401
+ onMouseDown: (h) => {
402
+ h.preventDefault(), S(g);
403
403
  },
404
404
  onMouseEnter: () => x(b),
405
405
  children: g
@@ -419,44 +419,44 @@ function ee() {
419
419
  function ye(t, n) {
420
420
  return t.map((e) => {
421
421
  if (typeof e == "string") return { id: e, label: e, group: n };
422
- const o = e.children && e.children.length > 0 ? ye(e.children, n) : void 0;
422
+ const r = e.children && e.children.length > 0 ? ye(e.children, n) : void 0;
423
423
  return {
424
424
  id: e.command,
425
425
  label: e.label ?? e.command,
426
426
  group: n,
427
427
  checked: e.checked,
428
428
  commandArgs: e.commandArgs,
429
- ...o ? { children: o } : {}
429
+ ...r ? { children: r } : {}
430
430
  };
431
431
  });
432
432
  }
433
- function It({ menuId: t, anchor: n, context: e, onClose: o, resolveChildren: r, items: c, variant: s }) {
434
- const h = H(null), u = H(/* @__PURE__ */ new Map()), l = H(null), [i, k] = P([]), v = z(() => JSON.stringify(e ?? {}), [e]);
433
+ function It({ menuId: t, anchor: n, context: e, onClose: r, resolveChildren: o, items: s, variant: c }) {
434
+ const i = F(null), d = F(/* @__PURE__ */ new Map()), a = F(null), [l, k] = P([]), v = z(() => JSON.stringify(e ?? {}), [e]);
435
435
  R(() => {
436
- var w, E;
436
+ var w, C;
437
437
  let y = !1;
438
- return c ? (k(c), () => {
438
+ return s ? (k(s), () => {
439
439
  y = !0;
440
- }) : ((E = (w = ee().menu) == null ? void 0 : w.getItems) == null || E.call(w, t, e).then((N) => {
440
+ }) : ((C = (w = ee().menu) == null ? void 0 : w.getItems) == null || C.call(w, t, e).then((N) => {
441
441
  !y && N && k(N);
442
442
  }).catch(() => {
443
443
  }), () => {
444
444
  y = !0;
445
445
  });
446
- }, [t, v, c]);
446
+ }, [t, v, s]);
447
447
  const m = z(() => {
448
448
  const y = /* @__PURE__ */ new Map(), w = [];
449
- for (const N of i) {
449
+ for (const N of l) {
450
450
  const T = N.children;
451
451
  if (!N.command && !T) continue;
452
452
  const L = N.group ?? "__default";
453
453
  y.has(L) || (y.set(L, []), w.push(L));
454
- let W;
454
+ let B;
455
455
  if (T && T.length > 0)
456
- W = ye(T, L);
457
- else if (T && T.length === 0 && r) {
458
- const U = r(N.command, e ?? {});
459
- U && U.length > 0 && (W = U.map((Z) => ({ id: Z.id, label: Z.label, group: L })));
456
+ B = ye(T, L);
457
+ else if (T && T.length === 0 && o) {
458
+ const U = o(N.command, e ?? {});
459
+ U && U.length > 0 && (B = U.map((Z) => ({ id: Z.id, label: Z.label, group: L })));
460
460
  }
461
461
  y.get(L).push({
462
462
  id: N.command || N.label || "",
@@ -468,88 +468,88 @@ function It({ menuId: t, anchor: n, context: e, onClose: o, resolveChildren: r,
468
468
  shortcut: N.shortcut,
469
469
  checked: N.checked,
470
470
  commandArgs: N.commandArgs,
471
- children: W
471
+ children: B
472
472
  });
473
473
  }
474
- const E = [];
474
+ const C = [];
475
475
  for (let N = 0; N < w.length; N++)
476
- N > 0 && E.push({ type: "divider", group: w[N] }), E.push(...y.get(w[N]));
477
- return E;
478
- }, [i, e, r]), [a, x] = P([]), D = B(() => {
479
- l.current && (clearTimeout(l.current), l.current = null);
480
- }, []), $ = B((y) => {
481
- l.current && (clearTimeout(l.current), l.current = null), l.current = setTimeout(() => x((w) => w.slice(0, y)), 150);
482
- }, []), A = B((y, w, E) => {
483
- D();
476
+ N > 0 && C.push({ type: "divider", group: w[N] }), C.push(...y.get(w[N]));
477
+ return C;
478
+ }, [l, e, o]), [u, x] = P([]), $ = K(() => {
479
+ a.current && (clearTimeout(a.current), a.current = null);
480
+ }, []), D = K((y) => {
481
+ a.current && (clearTimeout(a.current), a.current = null), a.current = setTimeout(() => x((w) => w.slice(0, y)), 150);
482
+ }, []), A = K((y, w, C) => {
483
+ $();
484
484
  const N = y.getBoundingClientRect(), T = 160, L = N.right + T > window.innerWidth ? N.left - T - 4 : N.right + 4;
485
- x((W) => [...W.slice(0, E), { x: L, y: N.top, items: w }]);
486
- }, [D]), [_, I] = P({ left: n.x, top: n.y }), [S, M] = P(!1), g = S;
485
+ x((B) => [...B.slice(0, C), { x: L, y: N.top, items: w }]);
486
+ }, [$]), [_, I] = P({ left: n.x, top: n.y }), [S, M] = P(!1), g = S;
487
487
  R(() => {
488
488
  if (!g) return;
489
489
  const y = (T) => {
490
- T.key === "Escape" && (a.length > 0 ? x((L) => L.slice(0, L.length - 1)) : o());
491
- }, w = () => o(), E = () => o(), N = (T) => {
490
+ T.key === "Escape" && (u.length > 0 ? x((L) => L.slice(0, L.length - 1)) : r());
491
+ }, w = () => r(), C = () => r(), N = (T) => {
492
492
  var U;
493
493
  const L = T.target;
494
- (((U = h.current) == null ? void 0 : U.contains(L)) ?? !1) || [...u.current.values()].some((Z) => Z.contains(L)) || o();
494
+ (((U = i.current) == null ? void 0 : U.contains(L)) ?? !1) || [...d.current.values()].some((Z) => Z.contains(L)) || r();
495
495
  };
496
- return window.addEventListener("keydown", y), window.addEventListener("blur", w), window.addEventListener("wheel", E, !0), s !== "embedded" && window.addEventListener("mousedown", N, !0), () => {
497
- window.removeEventListener("keydown", y), window.removeEventListener("blur", w), window.removeEventListener("wheel", E, !0), s !== "embedded" && window.removeEventListener("mousedown", N, !0);
496
+ return window.addEventListener("keydown", y), window.addEventListener("blur", w), window.addEventListener("wheel", C, !0), c !== "embedded" && window.addEventListener("mousedown", N, !0), () => {
497
+ window.removeEventListener("keydown", y), window.removeEventListener("blur", w), window.removeEventListener("wheel", C, !0), c !== "embedded" && window.removeEventListener("mousedown", N, !0);
498
498
  };
499
- }, [o, a, g, s]);
500
- const [b, f] = P(-1), p = H(/* @__PURE__ */ new Map()), C = z(() => m.filter((y) => !("type" in y)), [m]);
499
+ }, [r, u, g, c]);
500
+ const [b, h] = P(-1), p = F(/* @__PURE__ */ new Map()), E = z(() => m.filter((y) => !("type" in y)), [m]);
501
501
  R(() => {
502
502
  if (!g) return;
503
503
  const y = (w) => {
504
- var E, N, T;
504
+ var C, N, T;
505
505
  if (w.key === "ArrowDown")
506
- w.preventDefault(), f((L) => Math.min(L + 1, C.length - 1));
506
+ w.preventDefault(), h((L) => Math.min(L + 1, E.length - 1));
507
507
  else if (w.key === "ArrowUp")
508
- w.preventDefault(), f((L) => Math.max(L - 1, 0));
508
+ w.preventDefault(), h((L) => Math.max(L - 1, 0));
509
509
  else if (w.key === "ArrowRight" && b >= 0) {
510
- const L = C[b];
511
- if ((E = L == null ? void 0 : L.children) != null && E.length) {
510
+ const L = E[b];
511
+ if ((C = L == null ? void 0 : L.children) != null && C.length) {
512
512
  w.preventDefault();
513
- const W = p.current.get(b);
514
- W && A(W, L.children, 0);
513
+ const B = p.current.get(b);
514
+ B && A(B, L.children, 0);
515
515
  }
516
516
  } else if (w.key === "ArrowLeft")
517
- a.length > 0 && (w.preventDefault(), x((L) => L.slice(0, L.length - 1)));
517
+ u.length > 0 && (w.preventDefault(), x((L) => L.slice(0, L.length - 1)));
518
518
  else if (w.key === "Enter" && b >= 0) {
519
519
  w.preventDefault();
520
- const L = C[b];
521
- L && ((T = (N = ee().commands) == null ? void 0 : N.executeCommand) == null || T.call(N, L.id, void 0, ...L.commandArgs ?? [], e), o());
520
+ const L = E[b];
521
+ L && ((T = (N = ee().commands) == null ? void 0 : N.executeCommand) == null || T.call(N, L.id, void 0, ...L.commandArgs ?? [], e), r());
522
522
  }
523
523
  };
524
524
  return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
525
- }, [C, b, e, o, g, a, A]), R(() => {
525
+ }, [E, b, e, r, g, u, A]), R(() => {
526
526
  var y;
527
527
  b >= 0 && ((y = p.current.get(b)) == null || y.scrollIntoView({ block: "nearest" }));
528
528
  }, [b]);
529
- const K = B(async (y) => {
530
- var w, E;
531
- o(), await ((E = (w = ee().commands) == null ? void 0 : w.executeCommand) == null ? void 0 : E.call(w, y.id, void 0, ...y.commandArgs ?? [], e));
532
- }, [e, o]);
533
- re(() => {
529
+ const W = K(async (y) => {
530
+ var w, C;
531
+ r(), await ((C = (w = ee().commands) == null ? void 0 : w.executeCommand) == null ? void 0 : C.call(w, y.id, void 0, ...y.commandArgs ?? [], e));
532
+ }, [e, r]);
533
+ oe(() => {
534
534
  I({ left: n.x, top: Math.max(30, n.y) }), M(!1);
535
535
  }, [n.x, n.y, m.length]), R(() => {
536
- const y = h.current;
536
+ const y = i.current;
537
537
  if (!y) return;
538
538
  const w = y.getBoundingClientRect();
539
- let E = n.x, N = Math.max(30, n.y);
540
- E + w.width > window.innerWidth && (E = Math.max(0, window.innerWidth - w.width - 4)), N + w.height > window.innerHeight && (N = Math.max(30, window.innerHeight - w.height - 4)), I({ left: E, top: N });
539
+ let C = n.x, N = Math.max(30, n.y);
540
+ C + w.width > window.innerWidth && (C = Math.max(0, window.innerWidth - w.width - 4)), N + w.height > window.innerHeight && (N = Math.max(30, window.innerHeight - w.height - 4)), I({ left: C, top: N });
541
541
  const T = requestAnimationFrame(() => {
542
542
  M(!0), y.classList.add("show");
543
543
  });
544
544
  return () => cancelAnimationFrame(T);
545
545
  }, [n.x, n.y, m.length]), R(() => {
546
546
  var y;
547
- S && ((y = h.current) == null || y.focus());
547
+ S && ((y = i.current) == null || y.focus());
548
548
  }, [S]);
549
549
  let V = 0;
550
- return /* @__PURE__ */ F(ie, { rootId: "context-menu-root", zIndex: String(Y), children: [
551
- s !== "embedded" && s !== "non-modal" && ce(
552
- /* @__PURE__ */ d(
550
+ return /* @__PURE__ */ H(ie, { rootId: "context-menu-root", zIndex: String(Y), children: [
551
+ c !== "embedded" && c !== "non-modal" && se(
552
+ /* @__PURE__ */ f(
553
553
  "div",
554
554
  {
555
555
  style: {
@@ -561,10 +561,10 @@ function It({ menuId: t, anchor: n, context: e, onClose: o, resolveChildren: r,
561
561
  ),
562
562
  we()
563
563
  ),
564
- /* @__PURE__ */ d(
564
+ /* @__PURE__ */ f(
565
565
  "div",
566
566
  {
567
- ref: h,
567
+ ref: i,
568
568
  className: "ctx-menu",
569
569
  tabIndex: -1,
570
570
  style: {
@@ -574,32 +574,32 @@ function It({ menuId: t, anchor: n, context: e, onClose: o, resolveChildren: r,
574
574
  visibility: S ? void 0 : "hidden"
575
575
  },
576
576
  children: m.map((y, w) => {
577
- if ("type" in y) return /* @__PURE__ */ d("div", { className: "ctx-divider" }, `div-${w}`);
578
- const E = V++, N = !!(y.children && y.children.length > 0), T = E === b, L = y.group === "delete";
577
+ if ("type" in y) return /* @__PURE__ */ f("div", { className: "ctx-divider" }, `div-${w}`);
578
+ const C = V++, N = !!(y.children && y.children.length > 0), T = C === b, L = y.group === "delete";
579
579
  return (
580
580
  // E5.8#37.7.1:复合 key——共享命令 id 的动态项(面板视图清单全用同一 toggle 命令)会撞 key;
581
581
  // 并入数组索引消歧(菜单项在菜单生命周期内静态,索引稳定)。
582
- /* @__PURE__ */ F(
582
+ /* @__PURE__ */ H(
583
583
  "div",
584
584
  {
585
- ref: (W) => {
586
- W ? p.current.set(E, W) : p.current.delete(E);
585
+ ref: (B) => {
586
+ B ? p.current.set(C, B) : p.current.delete(C);
587
587
  },
588
588
  className: `ctx-item${T ? " focused" : ""}${L ? " ctx-item-danger" : ""}`,
589
- onClick: (W) => {
590
- W.stopPropagation(), N || K(y);
589
+ onClick: (B) => {
590
+ B.stopPropagation(), N || W(y);
591
591
  },
592
- onMouseEnter: (W) => {
593
- f(E), N ? A(W.currentTarget, y.children, 0) : x((U) => U.slice(0, 0));
592
+ onMouseEnter: (B) => {
593
+ h(C), N ? A(B.currentTarget, y.children, 0) : x((U) => U.slice(0, 0));
594
594
  },
595
595
  onMouseLeave: () => {
596
- N && $(1);
596
+ N && D(1);
597
597
  },
598
598
  children: [
599
- /* @__PURE__ */ d("span", { className: "ctx-item-check", "aria-hidden": "true", children: y.checked ? "✓" : "" }),
600
- /* @__PURE__ */ d("span", { className: "ctx-item-label", children: y.label }),
601
- N && /* @__PURE__ */ d("span", { className: "ctx-item-chevron", children: "›" }),
602
- y.shortcut && /* @__PURE__ */ d("span", { className: "ctx-item-shortcut", children: y.shortcut })
599
+ /* @__PURE__ */ f("span", { className: "ctx-item-check", "aria-hidden": "true", children: y.checked ? "✓" : "" }),
600
+ /* @__PURE__ */ f("span", { className: "ctx-item-label", children: y.label }),
601
+ N && /* @__PURE__ */ f("span", { className: "ctx-item-chevron", children: "›" }),
602
+ y.shortcut && /* @__PURE__ */ f("span", { className: "ctx-item-shortcut", children: y.shortcut })
603
603
  ]
604
604
  },
605
605
  `${y.id}::${w}`
@@ -608,39 +608,39 @@ function It({ menuId: t, anchor: n, context: e, onClose: o, resolveChildren: r,
608
608
  })
609
609
  }
610
610
  ),
611
- a.map((y, w) => /* @__PURE__ */ d(
611
+ u.map((y, w) => /* @__PURE__ */ f(
612
612
  "div",
613
613
  {
614
- ref: (E) => {
615
- E ? u.current.set(w, E) : u.current.delete(w);
614
+ ref: (C) => {
615
+ C ? d.current.set(w, C) : d.current.delete(w);
616
616
  },
617
617
  className: "ctx-menu show",
618
618
  style: { left: y.x, top: y.y, zIndex: Y },
619
- onMouseEnter: D,
620
- onMouseLeave: () => $(w + 1),
621
- children: y.items.map((E, N) => {
622
- const T = !!(E.children && E.children.length > 0);
623
- return /* @__PURE__ */ F(
619
+ onMouseEnter: $,
620
+ onMouseLeave: () => D(w + 1),
621
+ children: y.items.map((C, N) => {
622
+ const T = !!(C.children && C.children.length > 0);
623
+ return /* @__PURE__ */ H(
624
624
  "div",
625
625
  {
626
626
  className: "ctx-item",
627
627
  onClick: (L) => {
628
- L.stopPropagation(), T || K(E);
628
+ L.stopPropagation(), T || W(C);
629
629
  },
630
630
  onMouseEnter: (L) => {
631
- T ? A(L.currentTarget, E.children, w + 1) : x((W) => W.slice(0, w + 1));
631
+ T ? A(L.currentTarget, C.children, w + 1) : x((B) => B.slice(0, w + 1));
632
632
  },
633
633
  onMouseLeave: () => {
634
- T && $(w + 2);
634
+ T && D(w + 2);
635
635
  },
636
636
  children: [
637
- /* @__PURE__ */ d("span", { className: "ctx-item-check", "aria-hidden": "true", children: E.checked ? "✓" : "" }),
638
- /* @__PURE__ */ d("span", { className: "ctx-item-label", children: E.label }),
639
- T && /* @__PURE__ */ d("span", { className: "ctx-item-chevron", children: "›" }),
640
- E.shortcut && /* @__PURE__ */ d("span", { className: "ctx-item-shortcut", children: E.shortcut })
637
+ /* @__PURE__ */ f("span", { className: "ctx-item-check", "aria-hidden": "true", children: C.checked ? "✓" : "" }),
638
+ /* @__PURE__ */ f("span", { className: "ctx-item-label", children: C.label }),
639
+ T && /* @__PURE__ */ f("span", { className: "ctx-item-chevron", children: "›" }),
640
+ C.shortcut && /* @__PURE__ */ f("span", { className: "ctx-item-shortcut", children: C.shortcut })
641
641
  ]
642
642
  },
643
- `${E.id}::${N}`
643
+ `${C.id}::${N}`
644
644
  );
645
645
  })
646
646
  },
@@ -651,109 +651,109 @@ function It({ menuId: t, anchor: n, context: e, onClose: o, resolveChildren: r,
651
651
  function He(t) {
652
652
  return typeof t == "object" && "value" in t && "label" in t;
653
653
  }
654
- function ge({ value: t, options: n, onChange: e, disabled: o, placeholder: r, title: c, className: s, onOpen: h }) {
655
- const { t: u } = j(), [l, i] = P(!1), [k, v] = P(""), [m, a] = P(-1), x = H(null), D = H(null), $ = H(null), A = z(
656
- () => n.map((f) => He(f) ? f : { value: f, label: f }),
654
+ function ge({ value: t, options: n, onChange: e, disabled: r, placeholder: o, title: s, className: c, onOpen: i }) {
655
+ const { t: d } = j(), [a, l] = P(!1), [k, v] = P(""), [m, u] = P(-1), x = F(null), $ = F(null), D = F(null), A = z(
656
+ () => n.map((h) => He(h) ? h : { value: h, label: h }),
657
657
  [n]
658
658
  ), _ = z(() => {
659
659
  if (!k) return A;
660
- const f = k.toLowerCase();
661
- return A.filter((p) => p.label.toLowerCase().includes(f));
662
- }, [A, k]), I = z(() => A.find((f) => f.value === t), [A, t]), S = z(() => I ? I.label : t !== "" ? t : r ?? t, [I, t, r]);
660
+ const h = k.toLowerCase();
661
+ return A.filter((p) => p.label.toLowerCase().includes(h));
662
+ }, [A, k]), I = z(() => A.find((h) => h.value === t), [A, t]), S = z(() => I ? I.label : t !== "" ? t : o ?? t, [I, t, o]);
663
663
  R(() => {
664
- m >= _.length && a(Math.max(0, _.length - 1));
664
+ m >= _.length && u(Math.max(0, _.length - 1));
665
665
  }, [_.length, m]), R(() => {
666
- var p, C;
667
- if (!l) {
668
- v(""), a(-1);
666
+ var p, E;
667
+ if (!a) {
668
+ v(""), u(-1);
669
669
  return;
670
670
  }
671
- h == null || h();
672
- const f = _.findIndex((K) => K.value === t);
673
- a(f >= 0 ? f : 0), A.length > 8 ? (p = D.current) == null || p.focus() : (C = $.current) == null || C.focus();
674
- }, [l]);
675
- const M = B(
676
- (f) => {
677
- e(f), i(!1);
671
+ i == null || i();
672
+ const h = _.findIndex((W) => W.value === t);
673
+ u(h >= 0 ? h : 0), A.length > 8 ? (p = $.current) == null || p.focus() : (E = D.current) == null || E.focus();
674
+ }, [a]);
675
+ const M = K(
676
+ (h) => {
677
+ e(h), l(!1);
678
678
  },
679
679
  [e]
680
- ), g = B(
681
- (f) => {
682
- switch (f.key) {
680
+ ), g = K(
681
+ (h) => {
682
+ switch (h.key) {
683
683
  case "ArrowDown":
684
- f.preventDefault(), a((p) => Math.min(p + 1, _.length - 1));
684
+ h.preventDefault(), u((p) => Math.min(p + 1, _.length - 1));
685
685
  break;
686
686
  case "ArrowUp":
687
- f.preventDefault(), a((p) => Math.max(p - 1, 0));
687
+ h.preventDefault(), u((p) => Math.max(p - 1, 0));
688
688
  break;
689
689
  case "Enter":
690
- f.preventDefault(), _[m] && M(_[m].value);
690
+ h.preventDefault(), _[m] && M(_[m].value);
691
691
  break;
692
692
  }
693
693
  },
694
694
  [_, m, M]
695
695
  );
696
696
  R(() => {
697
- if (!l || !$.current) return;
698
- const f = $.current.children[m];
699
- f == null || f.scrollIntoView({ block: "nearest" });
700
- }, [m, l]);
697
+ if (!a || !D.current) return;
698
+ const h = D.current.children[m];
699
+ h == null || h.scrollIntoView({ block: "nearest" });
700
+ }, [m, a]);
701
701
  const b = A.length > 8;
702
- return /* @__PURE__ */ F(
702
+ return /* @__PURE__ */ H(
703
703
  "div",
704
704
  {
705
- className: `selectbox ${l ? "selectbox-open" : ""} ${o ? "selectbox-disabled" : ""} ${s ?? ""}`,
705
+ className: `selectbox ${a ? "selectbox-open" : ""} ${r ? "selectbox-disabled" : ""} ${c ?? ""}`,
706
706
  ref: x,
707
707
  children: [
708
- /* @__PURE__ */ F(
708
+ /* @__PURE__ */ H(
709
709
  "button",
710
710
  {
711
711
  type: "button",
712
712
  className: "selectbox-trigger",
713
- disabled: o,
714
- title: c,
715
- onClick: () => i((f) => !f),
713
+ disabled: r,
714
+ title: s,
715
+ onClick: () => l((h) => !h),
716
716
  children: [
717
- /* @__PURE__ */ F("span", { className: "selectbox-label", children: [
718
- (I == null ? void 0 : I.preview) && /* @__PURE__ */ d("span", { className: "selectbox-swatch", style: { background: I.preview } }),
717
+ /* @__PURE__ */ H("span", { className: "selectbox-label", children: [
718
+ (I == null ? void 0 : I.preview) && /* @__PURE__ */ f("span", { className: "selectbox-swatch", style: { background: I.preview } }),
719
719
  S
720
720
  ] }),
721
- /* @__PURE__ */ d("span", { className: `codicon codicon-chevron-down selectbox-arrow ${l ? "selectbox-arrow-up" : ""}` })
721
+ /* @__PURE__ */ f("span", { className: `codicon codicon-chevron-down selectbox-arrow ${a ? "selectbox-arrow-up" : ""}` })
722
722
  ]
723
723
  }
724
724
  ),
725
- l && /* @__PURE__ */ d(
725
+ a && /* @__PURE__ */ f(
726
726
  ve,
727
727
  {
728
728
  containerRef: x,
729
- onClose: () => i(!1),
729
+ onClose: () => l(!1),
730
730
  onKeyDown: g,
731
- listRef: $,
732
- search: b ? /* @__PURE__ */ d("div", { className: "selectbox-search", children: /* @__PURE__ */ d(
731
+ listRef: D,
732
+ search: b ? /* @__PURE__ */ f("div", { className: "selectbox-search", children: /* @__PURE__ */ f(
733
733
  "input",
734
734
  {
735
- ref: D,
735
+ ref: $,
736
736
  type: "text",
737
737
  className: "selectbox-search-input",
738
- placeholder: u("筛选..."),
738
+ placeholder: d("筛选..."),
739
739
  value: k,
740
- onChange: (f) => {
741
- v(f.target.value), a(0);
740
+ onChange: (h) => {
741
+ v(h.target.value), u(0);
742
742
  }
743
743
  }
744
744
  ) }) : void 0,
745
- children: _.length === 0 ? /* @__PURE__ */ d("li", { className: "selectbox-empty", children: u("无匹配项") }) : _.map((f, p) => /* @__PURE__ */ F(
745
+ children: _.length === 0 ? /* @__PURE__ */ f("li", { className: "selectbox-empty", children: d("无匹配项") }) : _.map((h, p) => /* @__PURE__ */ H(
746
746
  "li",
747
747
  {
748
- className: `selectbox-item ${p === m ? "selectbox-item-focus" : ""} ${f.value === t ? "selectbox-item-selected" : ""}`,
749
- onClick: () => M(f.value),
750
- onMouseEnter: () => a(p),
748
+ className: `selectbox-item ${p === m ? "selectbox-item-focus" : ""} ${h.value === t ? "selectbox-item-selected" : ""}`,
749
+ onClick: () => M(h.value),
750
+ onMouseEnter: () => u(p),
751
751
  children: [
752
- f.preview && /* @__PURE__ */ d("span", { className: "selectbox-swatch", style: { background: f.preview } }),
753
- f.label
752
+ h.preview && /* @__PURE__ */ f("span", { className: "selectbox-swatch", style: { background: h.preview } }),
753
+ h.label
754
754
  ]
755
755
  },
756
- f.value
756
+ h.value
757
757
  ))
758
758
  }
759
759
  )
@@ -762,118 +762,118 @@ function ge({ value: t, options: n, onChange: e, disabled: o, placeholder: r, ti
762
762
  );
763
763
  }
764
764
  const he = "followTheme", te = [];
765
- function Lt({ value: t, onChange: n, optionsFrom: e, domain: o, disabled: r, placeholder: c, title: s }) {
766
- const { t: h } = j(), [u, l] = P(te), i = e === "theme.colorways" && o === "colors", [k, v] = P(void 0);
765
+ function Lt({ value: t, onChange: n, optionsFrom: e, domain: r, disabled: o, placeholder: s, title: c }) {
766
+ const { t: i } = j(), [d, a] = P(te), l = e === "theme.colorways" && r === "colors", [k, v] = P(void 0);
767
767
  R(() => {
768
- var $, A, _, I, S;
769
- if (!i) return;
768
+ var D, A, _, I, S;
769
+ if (!l) return;
770
770
  let x = !1;
771
- (A = ($ = window.linkdesk) == null ? void 0 : $.configuration) == null || A.get("app.appearanceMode").then((M) => {
771
+ (A = (D = window.linkdesk) == null ? void 0 : D.configuration) == null || A.get("app.appearanceMode").then((M) => {
772
772
  x || v(M);
773
773
  });
774
- const D = (S = (I = (_ = window.linkdesk) == null ? void 0 : _.configuration) == null ? void 0 : I.onChange) == null ? void 0 : S.call(I, "app.appearanceMode", (M) => v(M));
774
+ const $ = (S = (I = (_ = window.linkdesk) == null ? void 0 : _.configuration) == null ? void 0 : I.onChange) == null ? void 0 : S.call(I, "app.appearanceMode", (M) => v(M));
775
775
  return () => {
776
- x = !0, D == null || D();
776
+ x = !0, $ == null || $();
777
777
  };
778
- }, [i]);
779
- const m = i && k === "custom", a = B(async () => {
780
- var D, $, A, _;
781
- const x = ($ = (D = window.linkdesk) == null ? void 0 : D.theme) == null ? void 0 : $.listRecipes;
778
+ }, [l]);
779
+ const m = l && k === "custom", u = K(async () => {
780
+ var $, D, A, _;
781
+ const x = (D = ($ = window.linkdesk) == null ? void 0 : $.theme) == null ? void 0 : D.listRecipes;
782
782
  if (x)
783
783
  try {
784
784
  const I = await x() ?? [];
785
785
  if (e === "theme.sources" || m) {
786
- if (o === "colors") {
787
- l([
788
- { value: he, label: h("跟随主题") },
786
+ if (r === "colors") {
787
+ a([
788
+ { value: he, label: i("跟随主题") },
789
789
  ...I.flatMap(
790
- (f) => f.colorways.map((p) => {
791
- var C;
790
+ (h) => h.colorways.map((p) => {
791
+ var E;
792
792
  return {
793
793
  value: p.id,
794
- label: `${f.name}·${p.name}`,
795
- preview: ((C = p.preview) == null ? void 0 : C.accent) || void 0
794
+ label: `${h.name}·${p.name}`,
795
+ preview: ((E = p.preview) == null ? void 0 : E.accent) || void 0
796
796
  };
797
797
  })
798
798
  )
799
799
  ]);
800
800
  return;
801
801
  }
802
- const b = o ? I.filter((f) => f.domains.includes(o)) : I;
803
- l([
804
- { value: he, label: h("跟随主题") },
805
- ...b.map((f) => ({ value: f.id, label: f.name }))
802
+ const b = r ? I.filter((h) => h.domains.includes(r)) : I;
803
+ a([
804
+ { value: he, label: i("跟随主题") },
805
+ ...b.map((h) => ({ value: h.id, label: h.name }))
806
806
  ]);
807
807
  return;
808
808
  }
809
809
  const S = (_ = (A = window.linkdesk) == null ? void 0 : A.configuration) == null ? void 0 : _.get, M = S ? await S("app.theme") : "", g = I.find((b) => b.id === M);
810
- l(
810
+ a(
811
811
  g ? g.colorways.map((b) => {
812
- var f;
813
- return { value: b.id, label: b.name, preview: ((f = b.preview) == null ? void 0 : f.accent) || void 0 };
812
+ var h;
813
+ return { value: b.id, label: b.name, preview: ((h = b.preview) == null ? void 0 : h.accent) || void 0 };
814
814
  }) : te
815
815
  );
816
816
  } catch {
817
- l(te);
817
+ a(te);
818
818
  }
819
- }, [e, o, h, m]);
819
+ }, [e, r, i, m]);
820
820
  return R(() => {
821
- var $, A, _, I, S, M;
822
- a();
823
- const x = (_ = (A = ($ = window.linkdesk) == null ? void 0 : $.configuration) == null ? void 0 : A.onPluginLifecycleChange) == null ? void 0 : _.call(A, () => {
824
- a();
825
- }), D = e === "theme.colorways" ? (M = (S = (I = window.linkdesk) == null ? void 0 : I.configuration) == null ? void 0 : S.onChange) == null ? void 0 : M.call(S, "app.theme", () => {
826
- a();
821
+ var D, A, _, I, S, M;
822
+ u();
823
+ const x = (_ = (A = (D = window.linkdesk) == null ? void 0 : D.configuration) == null ? void 0 : A.onPluginLifecycleChange) == null ? void 0 : _.call(A, () => {
824
+ u();
825
+ }), $ = e === "theme.colorways" ? (M = (S = (I = window.linkdesk) == null ? void 0 : I.configuration) == null ? void 0 : S.onChange) == null ? void 0 : M.call(S, "app.theme", () => {
826
+ u();
827
827
  }) : void 0;
828
828
  return () => {
829
- x == null || x(), D == null || D();
829
+ x == null || x(), $ == null || $();
830
830
  };
831
- }, [a, e]), i && !m && u.length === 1 ? null : /* @__PURE__ */ d(
831
+ }, [u, e]), l && !m && d.length === 1 ? null : /* @__PURE__ */ f(
832
832
  ge,
833
833
  {
834
834
  value: t,
835
- options: u,
835
+ options: d,
836
836
  onChange: n,
837
- disabled: r,
838
- placeholder: c,
839
- title: s,
837
+ disabled: o,
838
+ placeholder: s,
839
+ title: c,
840
840
  onOpen: () => {
841
- a();
841
+ u();
842
842
  }
843
843
  }
844
844
  );
845
845
  }
846
846
  function _t({ value: t, onChange: n, dialogType: e }) {
847
- const { t: o } = j(), r = async () => {
848
- var h;
849
- const c = (h = window.linkdesk) == null ? void 0 : h.dialog;
850
- if (!c) return;
851
- const s = e === "directory" ? { directory: !0 } : {
852
- filters: [{ name: o("所有文件"), extensions: ["*"] }]
847
+ const { t: r } = j(), o = async () => {
848
+ var i;
849
+ const s = (i = window.linkdesk) == null ? void 0 : i.dialog;
850
+ if (!s) return;
851
+ const c = e === "directory" ? { directory: !0 } : {
852
+ filters: [{ name: r("所有文件"), extensions: ["*"] }]
853
853
  };
854
854
  try {
855
- const u = await c.open(s);
856
- u && n(u);
855
+ const d = await s.open(c);
856
+ d && n(d);
857
857
  } catch {
858
858
  }
859
859
  };
860
- return /* @__PURE__ */ F("div", { style: { display: "flex", gap: 4, alignItems: "center" }, children: [
861
- /* @__PURE__ */ d(
860
+ return /* @__PURE__ */ H("div", { style: { display: "flex", gap: 4, alignItems: "center" }, children: [
861
+ /* @__PURE__ */ f(
862
862
  "input",
863
863
  {
864
864
  className: "input",
865
865
  type: "text",
866
866
  value: t,
867
- onChange: (c) => n(c.target.value),
867
+ onChange: (s) => n(s.target.value),
868
868
  style: { flex: 1 },
869
- placeholder: o(e === "directory" ? "选择目录…" : "选择文件…")
869
+ placeholder: r(e === "directory" ? "选择目录…" : "选择文件…")
870
870
  }
871
871
  ),
872
- /* @__PURE__ */ d(
873
- Ce,
872
+ /* @__PURE__ */ f(
873
+ Ee,
874
874
  {
875
- onClick: r,
876
- title: o(e === "directory" ? "浏览目录…" : "浏览文件…"),
875
+ onClick: o,
876
+ title: r(e === "directory" ? "浏览目录…" : "浏览文件…"),
877
877
  children: "…"
878
878
  }
879
879
  )
@@ -926,8 +926,8 @@ function We(t) {
926
926
  const e = document.createElement("canvas").getContext("2d");
927
927
  if (!e) return !1;
928
928
  e.font = `16px "${t}"`;
929
- const o = e.measureText("i").width, r = e.measureText("W").width;
930
- return Math.abs(o - r) < 0.5;
929
+ const r = e.measureText("i").width, o = e.measureText("W").width;
930
+ return Math.abs(r - o) < 0.5;
931
931
  } catch {
932
932
  return !1;
933
933
  }
@@ -935,179 +935,179 @@ function We(t) {
935
935
  function Be(t) {
936
936
  const [n, e] = P([]);
937
937
  return R(() => {
938
- let o = !1;
939
- async function r() {
940
- var h;
941
- let c = [];
938
+ let r = !1;
939
+ async function o() {
940
+ var i;
941
+ let s = [];
942
942
  if ("queryLocalFonts" in window)
943
943
  try {
944
- const u = await ((h = window.queryLocalFonts) == null ? void 0 : h.call(window));
945
- o || (c = (u ?? []).map((l) => l.family).filter((l, i, k) => k.indexOf(l) === i));
944
+ const d = await ((i = window.queryLocalFonts) == null ? void 0 : i.call(window));
945
+ r || (s = (d ?? []).map((a) => a.family).filter((a, l, k) => k.indexOf(a) === l));
946
946
  } catch {
947
947
  }
948
- c.length === 0 && (c = t ? be : Ke);
949
- const s = t ? c.filter((u) => We(u)) : c;
950
- o || e(s.sort((u, l) => u.localeCompare(l)));
948
+ s.length === 0 && (s = t ? be : Ke);
949
+ const c = t ? s.filter((d) => We(d)) : s;
950
+ r || e(c.sort((d, a) => d.localeCompare(a)));
951
951
  }
952
- return r(), () => {
953
- o = !0;
952
+ return o(), () => {
953
+ r = !0;
954
954
  };
955
955
  }, [t]), n;
956
956
  }
957
- function $t({ value: t, onChange: n, monoOnly: e = !0 }) {
958
- const { t: o } = j(), r = Be(e), c = z(() => e ? r.map((s) => ({ value: s, label: s })) : [
959
- { value: "", label: o("跟随主题") },
960
- { value: "__none__", label: o("系统字体") },
961
- ...r.map((s) => ({ value: s, label: s }))
962
- ], [e, r, o]);
963
- return /* @__PURE__ */ d(
957
+ function Dt({ value: t, onChange: n, monoOnly: e = !0 }) {
958
+ const { t: r } = j(), o = Be(e), s = z(() => e ? o.map((c) => ({ value: c, label: c })) : [
959
+ { value: "", label: r("跟随主题") },
960
+ { value: "__none__", label: r("系统字体") },
961
+ ...o.map((c) => ({ value: c, label: c }))
962
+ ], [e, o, r]);
963
+ return /* @__PURE__ */ f(
964
964
  ge,
965
965
  {
966
966
  value: t,
967
- options: c,
967
+ options: s,
968
968
  onChange: n,
969
- placeholder: o(e ? "选择等宽字体…" : "跟随主题")
969
+ placeholder: r(e ? "选择等宽字体…" : "跟随主题")
970
970
  }
971
971
  );
972
972
  }
973
- function Dt({ label: t, children: n }) {
974
- return /* @__PURE__ */ F("div", { className: "form-row", children: [
975
- /* @__PURE__ */ d("label", { children: t }),
973
+ function $t({ label: t, children: n }) {
974
+ return /* @__PURE__ */ H("div", { className: "form-row", children: [
975
+ /* @__PURE__ */ f("label", { children: t }),
976
976
  n
977
977
  ] });
978
978
  }
979
- function St({ value: t, onChange: n, min: e, max: o, step: r = 1, unit: c, style: s }) {
980
- const { t: h } = j(), u = B(
979
+ function Rt({ value: t, onChange: n, min: e, max: r, step: o = 1, unit: s, style: c }) {
980
+ const { t: i } = j(), d = K(
981
981
  (m) => {
982
- let a = m;
983
- return e !== void 0 && (a = Math.max(e, a)), o !== void 0 && (a = Math.min(o, a)), a;
982
+ let u = m;
983
+ return e !== void 0 && (u = Math.max(e, u)), r !== void 0 && (u = Math.min(r, u)), u;
984
984
  },
985
- [e, o]
986
- ), l = () => n(u(t - r)), i = () => n(u(t + r)), k = e !== void 0 && t <= e, v = o !== void 0 && t >= o;
987
- return /* @__PURE__ */ F("div", { className: "number-input", style: s, children: [
988
- /* @__PURE__ */ d(
985
+ [e, r]
986
+ ), a = () => n(d(t - o)), l = () => n(d(t + o)), k = e !== void 0 && t <= e, v = r !== void 0 && t >= r;
987
+ return /* @__PURE__ */ H("div", { className: "number-input", style: c, children: [
988
+ /* @__PURE__ */ f(
989
989
  "button",
990
990
  {
991
991
  className: "number-input-btn",
992
- onClick: l,
992
+ onClick: a,
993
993
  disabled: k,
994
994
  tabIndex: -1,
995
- "aria-label": h("减少"),
995
+ "aria-label": i("减少"),
996
996
  children: "−"
997
997
  }
998
998
  ),
999
- /* @__PURE__ */ d(
999
+ /* @__PURE__ */ f(
1000
1000
  "input",
1001
1001
  {
1002
1002
  className: "input number-input-field",
1003
1003
  type: "text",
1004
1004
  value: t,
1005
1005
  onChange: (m) => {
1006
- const a = Number(m.target.value);
1007
- isNaN(a) || n(u(a));
1006
+ const u = Number(m.target.value);
1007
+ isNaN(u) || n(d(u));
1008
1008
  },
1009
1009
  style: { width: 56, textAlign: "center" }
1010
1010
  }
1011
1011
  ),
1012
- c ? /* @__PURE__ */ d("span", { className: "number-input-unit", children: c }) : null,
1013
- /* @__PURE__ */ d(
1012
+ s ? /* @__PURE__ */ f("span", { className: "number-input-unit", children: s }) : null,
1013
+ /* @__PURE__ */ f(
1014
1014
  "button",
1015
1015
  {
1016
1016
  className: "number-input-btn",
1017
- onClick: i,
1017
+ onClick: l,
1018
1018
  disabled: v,
1019
1019
  tabIndex: -1,
1020
- "aria-label": h("增加"),
1020
+ "aria-label": i("增加"),
1021
1021
  children: "+"
1022
1022
  }
1023
1023
  )
1024
1024
  ] });
1025
1025
  }
1026
- function Rt({ options: t, value: n, onChange: e, ariaLabel: o }) {
1027
- const r = H([]), c = (s, h) => {
1028
- var i;
1029
- if (!["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown"].includes(s.key)) return;
1030
- s.preventDefault();
1031
- const u = s.key === "ArrowRight" || s.key === "ArrowDown" ? 1 : -1, l = (h + u + t.length) % t.length;
1032
- (i = r.current[l]) == null || i.focus(), e(t[l].value);
1026
+ function St({ options: t, value: n, onChange: e, ariaLabel: r }) {
1027
+ const o = F([]), s = (c, i) => {
1028
+ var l;
1029
+ if (!["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown"].includes(c.key)) return;
1030
+ c.preventDefault();
1031
+ const d = c.key === "ArrowRight" || c.key === "ArrowDown" ? 1 : -1, a = (i + d + t.length) % t.length;
1032
+ (l = o.current[a]) == null || l.focus(), e(t[a].value);
1033
1033
  };
1034
- return /* @__PURE__ */ d("div", { className: "segmented-radio", role: "radiogroup", "aria-label": o, children: t.map((s, h) => {
1035
- const u = n === s.value;
1036
- return /* @__PURE__ */ F(
1034
+ return /* @__PURE__ */ f("div", { className: "segmented-radio", role: "radiogroup", "aria-label": r, children: t.map((c, i) => {
1035
+ const d = n === c.value;
1036
+ return /* @__PURE__ */ H(
1037
1037
  "button",
1038
1038
  {
1039
1039
  type: "button",
1040
- ref: (l) => {
1041
- r.current[h] = l;
1040
+ ref: (a) => {
1041
+ o.current[i] = a;
1042
1042
  },
1043
1043
  role: "radio",
1044
- "aria-checked": u,
1045
- tabIndex: u ? 0 : -1,
1046
- className: `segmented-radio__option${u ? " is-selected" : ""}`,
1047
- title: s.title ?? s.label,
1048
- onClick: () => e(s.value),
1049
- onKeyDown: (l) => c(l, h),
1044
+ "aria-checked": d,
1045
+ tabIndex: d ? 0 : -1,
1046
+ className: `segmented-radio__option${d ? " is-selected" : ""}`,
1047
+ title: c.title ?? c.label,
1048
+ onClick: () => e(c.value),
1049
+ onKeyDown: (a) => s(a, i),
1050
1050
  children: [
1051
- s.preview,
1052
- /* @__PURE__ */ d("span", { className: "segmented-radio__label", children: s.label })
1051
+ c.preview,
1052
+ /* @__PURE__ */ f("span", { className: "segmented-radio__label", children: c.label })
1053
1053
  ]
1054
1054
  },
1055
- s.value
1055
+ c.value
1056
1056
  );
1057
1057
  }) });
1058
1058
  }
1059
- function Tt({ value: t, onChange: n, min: e = 0, max: o = 100, step: r = 1, ariaLabel: c, disabled: s, style: h }) {
1060
- const u = (i) => Math.min(o, Math.max(e, i)), l = o > e ? (u(t) - e) / (o - e) * 100 : 0;
1061
- return /* @__PURE__ */ d(
1059
+ function Tt({ value: t, onChange: n, min: e = 0, max: r = 100, step: o = 1, ariaLabel: s, disabled: c, style: i }) {
1060
+ const d = (l) => Math.min(r, Math.max(e, l)), a = r > e ? (d(t) - e) / (r - e) * 100 : 0;
1061
+ return /* @__PURE__ */ f(
1062
1062
  "input",
1063
1063
  {
1064
1064
  type: "range",
1065
1065
  className: "slider",
1066
- value: u(t),
1066
+ value: d(t),
1067
1067
  min: e,
1068
- max: o,
1069
- step: r,
1070
- disabled: s,
1071
- "aria-label": c,
1072
- onChange: (i) => n(Number(i.target.value)),
1073
- style: { ...h, "--slider-pct": `${l}%` }
1068
+ max: r,
1069
+ step: o,
1070
+ disabled: c,
1071
+ "aria-label": s,
1072
+ onChange: (l) => n(Number(l.target.value)),
1073
+ style: { ...i, "--slider-pct": `${a}%` }
1074
1074
  }
1075
1075
  );
1076
1076
  }
1077
1077
  const Oe = 6, Ve = "color-mix(in srgb, var(--text-secondary) 45%, transparent)";
1078
1078
  function Pt({ value: t, onChange: n }) {
1079
- const { t: e } = j(), [o, r] = P([]), [c, s] = P(0), h = H([]), u = B((i) => {
1079
+ const { t: e } = j(), [r, o] = P([]), [s, c] = P(0), i = F([]), d = K((l) => {
1080
1080
  var v, m;
1081
1081
  const k = (m = (v = window.linkdesk) == null ? void 0 : v.theme) == null ? void 0 : m.listRecipes;
1082
- k && k().then((a) => {
1083
- i && !i() || r(a ?? []);
1082
+ k && k().then((u) => {
1083
+ l && !l() || o(u ?? []);
1084
1084
  }).catch(() => {
1085
1085
  });
1086
1086
  }, []);
1087
1087
  R(() => {
1088
- var m, a, x;
1089
- let i = !1;
1090
- u(() => !i);
1091
- const v = (x = (a = (m = window.linkdesk) == null ? void 0 : m.configuration) == null ? void 0 : a.onPluginLifecycleChange) == null ? void 0 : x.call(a, () => {
1092
- u();
1088
+ var m, u, x;
1089
+ let l = !1;
1090
+ d(() => !l);
1091
+ const v = (x = (u = (m = window.linkdesk) == null ? void 0 : m.configuration) == null ? void 0 : u.onPluginLifecycleChange) == null ? void 0 : x.call(u, () => {
1092
+ d();
1093
1093
  });
1094
1094
  return () => {
1095
- i = !0, v == null || v();
1095
+ l = !0, v == null || v();
1096
1096
  };
1097
- }, [u]);
1098
- const l = (i) => {
1097
+ }, [d]);
1098
+ const a = (l) => {
1099
1099
  var m;
1100
- const k = o.length;
1100
+ const k = r.length;
1101
1101
  if (k === 0) return;
1102
- let v = c;
1103
- switch (i.key) {
1102
+ let v = s;
1103
+ switch (l.key) {
1104
1104
  case "ArrowRight":
1105
1105
  case "ArrowDown":
1106
- v = Math.min(c + 1, k - 1);
1106
+ v = Math.min(s + 1, k - 1);
1107
1107
  break;
1108
1108
  case "ArrowLeft":
1109
1109
  case "ArrowUp":
1110
- v = Math.max(c - 1, 0);
1110
+ v = Math.max(s - 1, 0);
1111
1111
  break;
1112
1112
  case "Home":
1113
1113
  v = 0;
@@ -1118,44 +1118,44 @@ function Pt({ value: t, onChange: n }) {
1118
1118
  default:
1119
1119
  return;
1120
1120
  }
1121
- i.preventDefault(), s(v), (m = h.current[v]) == null || m.focus();
1121
+ l.preventDefault(), c(v), (m = i.current[v]) == null || m.focus();
1122
1122
  };
1123
- return o.length === 0 ? /* @__PURE__ */ d("span", { className: "theme-picker-empty", children: e("无可用主题配方") }) : /* @__PURE__ */ d(
1123
+ return r.length === 0 ? /* @__PURE__ */ f("span", { className: "theme-picker-empty", children: e("无可用主题配方") }) : /* @__PURE__ */ f(
1124
1124
  "div",
1125
1125
  {
1126
1126
  className: "theme-picker",
1127
1127
  role: "group",
1128
1128
  "aria-label": e("主题配方"),
1129
- onKeyDown: l,
1130
- children: o.map((i, k) => {
1131
- var D, $;
1132
- const v = i.colorways.length <= 1, m = (D = i.colorways[0]) == null ? void 0 : D.preview, a = (m == null ? void 0 : m.accent) || Ve, x = i.id === t;
1133
- return /* @__PURE__ */ F(
1129
+ onKeyDown: a,
1130
+ children: r.map((l, k) => {
1131
+ var $, D;
1132
+ const v = l.colorways.length <= 1, m = ($ = l.colorways[0]) == null ? void 0 : $.preview, u = (m == null ? void 0 : m.accent) || Ve, x = l.id === t;
1133
+ return /* @__PURE__ */ H(
1134
1134
  "button",
1135
1135
  {
1136
1136
  ref: (A) => {
1137
- h.current[k] = A;
1137
+ i.current[k] = A;
1138
1138
  },
1139
1139
  type: "button",
1140
1140
  className: `theme-card${x ? " active" : ""}`,
1141
- tabIndex: c === k ? 0 : -1,
1142
- "aria-label": i.name,
1141
+ tabIndex: s === k ? 0 : -1,
1142
+ "aria-label": l.name,
1143
1143
  "aria-pressed": x,
1144
- onClick: () => n(i.id),
1145
- onFocus: () => s(k),
1144
+ onClick: () => n(l.id),
1145
+ onFocus: () => c(k),
1146
1146
  children: [
1147
- /* @__PURE__ */ d("div", { className: "theme-preview", style: m != null && m.bgWindow ? { background: m.bgWindow } : void 0, children: v ? (
1147
+ /* @__PURE__ */ f("div", { className: "theme-preview", style: m != null && m.bgWindow ? { background: m.bgWindow } : void 0, children: v ? (
1148
1148
  // 单配色配方——3 条强调色预览条(mockup .pv-bar)
1149
- /* @__PURE__ */ F(xe, { children: [
1150
- /* @__PURE__ */ d("span", { className: "pv-bar", style: { background: a } }),
1151
- /* @__PURE__ */ d("span", { className: "pv-bar", style: { background: a } }),
1152
- /* @__PURE__ */ d("span", { className: "pv-bar", style: { background: a } })
1149
+ /* @__PURE__ */ H(xe, { children: [
1150
+ /* @__PURE__ */ f("span", { className: "pv-bar", style: { background: u } }),
1151
+ /* @__PURE__ */ f("span", { className: "pv-bar", style: { background: u } }),
1152
+ /* @__PURE__ */ f("span", { className: "pv-bar", style: { background: u } })
1153
1153
  ] })
1154
1154
  ) : (
1155
1155
  // 多配色配方——配色圆点色板(mockup .pv-dot)
1156
- /* @__PURE__ */ d("span", { className: "pv-dots", children: i.colorways.slice(0, Oe).map((A) => {
1156
+ /* @__PURE__ */ f("span", { className: "pv-dots", children: l.colorways.slice(0, Oe).map((A) => {
1157
1157
  var _;
1158
- return /* @__PURE__ */ d(
1158
+ return /* @__PURE__ */ f(
1159
1159
  "span",
1160
1160
  {
1161
1161
  className: "pv-dot",
@@ -1165,20 +1165,20 @@ function Pt({ value: t, onChange: n }) {
1165
1165
  );
1166
1166
  }) })
1167
1167
  ) }),
1168
- /* @__PURE__ */ F("div", { className: "tname", children: [
1169
- /* @__PURE__ */ d("span", { className: "tname-name", children: i.name }),
1170
- /* @__PURE__ */ d("span", { className: "badge", children: v ? (($ = i.colorways[0]) == null ? void 0 : $.name) ?? "" : e("{{count}} 配色", { count: i.colorways.length }) })
1168
+ /* @__PURE__ */ H("div", { className: "tname", children: [
1169
+ /* @__PURE__ */ f("span", { className: "tname-name", children: l.name }),
1170
+ /* @__PURE__ */ f("span", { className: "badge", children: v ? ((D = l.colorways[0]) == null ? void 0 : D.name) ?? "" : e("{{count}} 配色", { count: l.colorways.length }) })
1171
1171
  ] })
1172
1172
  ]
1173
1173
  },
1174
- i.id
1174
+ l.id
1175
1175
  );
1176
1176
  })
1177
1177
  }
1178
1178
  );
1179
1179
  }
1180
1180
  function Ft({ checked: t, onChange: n, disabled: e }) {
1181
- return /* @__PURE__ */ d(
1181
+ return /* @__PURE__ */ f(
1182
1182
  "div",
1183
1183
  {
1184
1184
  className: `toggle${t ? " on" : ""}${e ? " disabled" : ""}`,
@@ -1193,91 +1193,91 @@ function Ft({ checked: t, onChange: n, disabled: e }) {
1193
1193
  function G() {
1194
1194
  return window.linkdesk;
1195
1195
  }
1196
- const Ht = se(function({
1196
+ const Ht = ce(function({
1197
1197
  size: n,
1198
1198
  value: e,
1199
- onConfirm: o,
1200
- onCancel: r,
1201
- onChange: c,
1202
- selectMode: s = "all",
1203
- width: h,
1204
- autoFocus: u,
1205
- placeholder: l,
1206
- type: i = "text",
1199
+ onConfirm: r,
1200
+ onCancel: o,
1201
+ onChange: s,
1202
+ selectMode: c = "all",
1203
+ width: i,
1204
+ autoFocus: d,
1205
+ placeholder: a,
1206
+ type: l = "text",
1207
1207
  min: k,
1208
1208
  max: v
1209
1209
  }, m) {
1210
- const a = H(null), [x, D] = P(e), [$, A] = P(!0);
1210
+ const u = F(null), [x, $] = P(e), [D, A] = P(!0);
1211
1211
  Me(m, () => ({
1212
1212
  getValue: () => x
1213
1213
  }), [x]), R(() => {
1214
- if (!u || !a.current) return;
1215
- a.current.focus(), requestAnimationFrame(() => {
1216
- if (a.current)
1217
- if (s === "nameOnly") {
1214
+ if (!d || !u.current) return;
1215
+ u.current.focus(), requestAnimationFrame(() => {
1216
+ if (u.current)
1217
+ if (c === "nameOnly") {
1218
1218
  const g = e.lastIndexOf(".");
1219
- g > 0 ? a.current.setSelectionRange(0, g) : a.current.select();
1219
+ g > 0 ? u.current.setSelectionRange(0, g) : u.current.select();
1220
1220
  } else
1221
- a.current.select();
1221
+ u.current.select();
1222
1222
  });
1223
- }, [u]), R(() => {
1223
+ }, [d]), R(() => {
1224
1224
  var M, g;
1225
- if (!$) {
1225
+ if (!D) {
1226
1226
  (g = (M = G().contextKey) == null ? void 0 : M.set) == null || g.call(M, "inputFocus", !1);
1227
1227
  const b = requestAnimationFrame(() => {
1228
- var f, p;
1229
- (p = (f = G().keybindings) == null ? void 0 : f.setKeybindingCaptureActive) == null || p.call(f, !1);
1228
+ var h, p;
1229
+ (p = (h = G().keybindings) == null ? void 0 : h.setKeybindingCaptureActive) == null || p.call(h, !1);
1230
1230
  });
1231
1231
  return () => cancelAnimationFrame(b);
1232
1232
  }
1233
- }, [$]), R(() => () => {
1234
- var M, g, b, f;
1235
- (g = (M = G().contextKey) == null ? void 0 : M.set) == null || g.call(M, "inputFocus", !1), (f = (b = G().keybindings) == null ? void 0 : b.setKeybindingCaptureActive) == null || f.call(b, !1);
1233
+ }, [D]), R(() => () => {
1234
+ var M, g, b, h;
1235
+ (g = (M = G().contextKey) == null ? void 0 : M.set) == null || g.call(M, "inputFocus", !1), (h = (b = G().keybindings) == null ? void 0 : b.setKeybindingCaptureActive) == null || h.call(b, !1);
1236
1236
  }, []);
1237
1237
  const _ = (M) => {
1238
- M.key === "Enter" ? (M.preventDefault(), A(!1), o(x)) : M.key === "Escape" && (M.preventDefault(), A(!1), r()), M.stopPropagation();
1238
+ M.key === "Enter" ? (M.preventDefault(), A(!1), r(x)) : M.key === "Escape" && (M.preventDefault(), A(!1), o()), M.stopPropagation();
1239
1239
  }, I = () => {
1240
- $ && (A(!1), o(x));
1240
+ D && (A(!1), r(x));
1241
1241
  }, S = () => {
1242
- var M, g, b, f;
1243
- (g = (M = G().contextKey) == null ? void 0 : M.set) == null || g.call(M, "inputFocus", !0), (f = (b = G().keybindings) == null ? void 0 : b.setKeybindingCaptureActive) == null || f.call(b, !0);
1242
+ var M, g, b, h;
1243
+ (g = (M = G().contextKey) == null ? void 0 : M.set) == null || g.call(M, "inputFocus", !0), (h = (b = G().keybindings) == null ? void 0 : b.setKeybindingCaptureActive) == null || h.call(b, !0);
1244
1244
  };
1245
- return /* @__PURE__ */ d(
1245
+ return /* @__PURE__ */ f(
1246
1246
  "input",
1247
1247
  {
1248
- ref: a,
1248
+ ref: u,
1249
1249
  className: `inline-input inline-input--${n}`,
1250
- type: i,
1250
+ type: l,
1251
1251
  value: x,
1252
1252
  onChange: (M) => {
1253
- const g = i === "number" ? M.target.value.replace(/\D/g, "") : M.target.value;
1254
- D(g), c == null || c(g);
1253
+ const g = l === "number" ? M.target.value.replace(/\D/g, "") : M.target.value;
1254
+ $(g), s == null || s(g);
1255
1255
  },
1256
1256
  onKeyDown: _,
1257
1257
  onBlur: I,
1258
1258
  onFocus: S,
1259
1259
  onDragStart: (M) => M.preventDefault(),
1260
- placeholder: l,
1260
+ placeholder: a,
1261
1261
  min: k,
1262
1262
  max: v,
1263
- style: h ? { width: h } : void 0,
1263
+ style: i ? { width: i } : void 0,
1264
1264
  autoComplete: "off",
1265
1265
  spellCheck: !1
1266
1266
  }
1267
1267
  );
1268
1268
  });
1269
1269
  function ze(t, n) {
1270
- const e = n.icon, o = n.iconSource;
1271
- if (o === "lucide" && e)
1270
+ const e = n.icon, r = n.iconSource;
1271
+ if (r === "lucide" && e)
1272
1272
  return { lucide: e };
1273
- if (o === "codicon" && e)
1273
+ if (r === "codicon" && e)
1274
1274
  return { codicon: `codicon-${e}` };
1275
- if (e && (o === "svg" || o === "url"))
1275
+ if (e && (r === "svg" || r === "url"))
1276
1276
  return { src: e };
1277
1277
  if (e) {
1278
1278
  if (e.includes("/") || e.includes(".")) {
1279
- const r = e.includes(".") ? e : `${e}.png`;
1280
- return { src: `linkdesk://${t}/${r}` };
1279
+ const o = e.includes(".") ? e : `${e}.png`;
1280
+ return { src: `linkdesk://${t}/${o}` };
1281
1281
  }
1282
1282
  return { codicon: `codicon-${e}` };
1283
1283
  }
@@ -1289,7 +1289,7 @@ function ze(t, n) {
1289
1289
  * This source code is licensed under the ISC license.
1290
1290
  * See the LICENSE file in the root directory of this source tree.
1291
1291
  */
1292
- const ke = (...t) => t.filter((n, e, o) => !!n && n.trim() !== "" && o.indexOf(n) === e).join(" ").trim();
1292
+ const ke = (...t) => t.filter((n, e, r) => !!n && n.trim() !== "" && r.indexOf(n) === e).join(" ").trim();
1293
1293
  /**
1294
1294
  * @license lucide-react v1.29.0 - ISC
1295
1295
  *
@@ -1305,7 +1305,7 @@ const Ue = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1305
1305
  */
1306
1306
  const je = (t) => t.replace(
1307
1307
  /^([A-Z])|[\s-_]+(\w)/g,
1308
- (n, e, o) => o ? o.toUpperCase() : e.toLowerCase()
1308
+ (n, e, r) => r ? r.toUpperCase() : e.toLowerCase()
1309
1309
  );
1310
1310
  /**
1311
1311
  * @license lucide-react v1.29.0 - ISC
@@ -1345,31 +1345,31 @@ const qe = (t) => {
1345
1345
  if (n.startsWith("aria-") || n === "role" || n === "title")
1346
1346
  return !0;
1347
1347
  return !1;
1348
- }, Ge = Ee({}), Ze = () => Ne(Ge), Xe = se(
1349
- ({ color: t, size: n, strokeWidth: e, absoluteStrokeWidth: o, className: r = "", children: c, iconNode: s, ...h }, u) => {
1348
+ }, Ge = Ce({}), Ze = () => Ne(Ge), Xe = ce(
1349
+ ({ color: t, size: n, strokeWidth: e, absoluteStrokeWidth: r, className: o = "", children: s, iconNode: c, ...i }, d) => {
1350
1350
  const {
1351
- size: l = 24,
1352
- strokeWidth: i = 2,
1351
+ size: a = 24,
1352
+ strokeWidth: l = 2,
1353
1353
  absoluteStrokeWidth: k = !1,
1354
1354
  color: v = "currentColor",
1355
1355
  className: m = ""
1356
- } = Ze() ?? {}, a = o ?? k ? Number(e ?? i) * 24 / Number(n ?? l) : e ?? i;
1357
- return oe(
1356
+ } = Ze() ?? {}, u = r ?? k ? Number(e ?? l) * 24 / Number(n ?? a) : e ?? l;
1357
+ return re(
1358
1358
  "svg",
1359
1359
  {
1360
- ref: u,
1360
+ ref: d,
1361
1361
  ...ne,
1362
- width: n ?? l ?? ne.width,
1363
- height: n ?? l ?? ne.height,
1362
+ width: n ?? a ?? ne.width,
1363
+ height: n ?? a ?? ne.height,
1364
1364
  stroke: t ?? v,
1365
- strokeWidth: a,
1366
- className: ke("lucide", m, r),
1367
- ...!c && !qe(h) && { "aria-hidden": "true" },
1368
- ...h
1365
+ strokeWidth: u,
1366
+ className: ke("lucide", m, o),
1367
+ ...!s && !qe(i) && { "aria-hidden": "true" },
1368
+ ...i
1369
1369
  },
1370
1370
  [
1371
- ...s.map(([x, D]) => oe(x, D)),
1372
- ...Array.isArray(c) ? c : [c]
1371
+ ...c.map(([x, $]) => re(x, $)),
1372
+ ...Array.isArray(s) ? s : [s]
1373
1373
  ]
1374
1374
  );
1375
1375
  }
@@ -1381,16 +1381,16 @@ const qe = (t) => {
1381
1381
  * See the LICENSE file in the root directory of this source tree.
1382
1382
  */
1383
1383
  const O = (t, n) => {
1384
- const e = se(
1385
- ({ className: o, ...r }, c) => oe(Xe, {
1386
- ref: c,
1384
+ const e = ce(
1385
+ ({ className: r, ...o }, s) => re(Xe, {
1386
+ ref: s,
1387
1387
  iconNode: n,
1388
1388
  className: ke(
1389
1389
  `lucide-${Ue(me(t))}`,
1390
1390
  `lucide-${t}`,
1391
- o
1391
+ r
1392
1392
  ),
1393
- ...r
1393
+ ...o
1394
1394
  })
1395
1395
  );
1396
1396
  return e.displayName = me(t), e;
@@ -1445,7 +1445,7 @@ const tt = [
1445
1445
  * This source code is licensed under the ISC license.
1446
1446
  * See the LICENSE file in the root directory of this source tree.
1447
1447
  */
1448
- const ot = [
1448
+ const rt = [
1449
1449
  [
1450
1450
  "path",
1451
1451
  {
@@ -1453,14 +1453,14 @@ const ot = [
1453
1453
  key: "usdka0"
1454
1454
  }
1455
1455
  ]
1456
- ], rt = O("folder-open", ot);
1456
+ ], ot = O("folder-open", rt);
1457
1457
  /**
1458
1458
  * @license lucide-react v1.29.0 - ISC
1459
1459
  *
1460
1460
  * This source code is licensed under the ISC license.
1461
1461
  * See the LICENSE file in the root directory of this source tree.
1462
1462
  */
1463
- const st = [
1463
+ const ct = [
1464
1464
  [
1465
1465
  "path",
1466
1466
  {
@@ -1477,7 +1477,7 @@ const st = [
1477
1477
  ],
1478
1478
  ["path", { d: "M3 5a2 2 0 0 0 2 2h3", key: "f2jnh7" }],
1479
1479
  ["path", { d: "M3 3v13a2 2 0 0 0 2 2h3", key: "k8epm1" }]
1480
- ], ct = O("folder-tree", st);
1480
+ ], st = O("folder-tree", ct);
1481
1481
  /**
1482
1482
  * @license lucide-react v1.29.0 - ISC
1483
1483
  *
@@ -1584,8 +1584,8 @@ const gt = [
1584
1584
  ], bt = O("shopping-bag", gt), kt = {
1585
1585
  File: nt,
1586
1586
  Folder: at,
1587
- FolderOpen: rt,
1588
- FolderTree: ct,
1587
+ FolderOpen: ot,
1588
+ FolderTree: st,
1589
1589
  Package: wt,
1590
1590
  ShoppingBag: bt,
1591
1591
  Monitor: mt,
@@ -1595,35 +1595,76 @@ const gt = [
1595
1595
  Lightbulb: ut,
1596
1596
  Lock: ft
1597
1597
  }, pe = "📄";
1598
- function Kt({ pluginId: t, manifest: n, className: e, alt: o = "" }) {
1599
- const r = n ? ze(t, n) : { emoji: pe };
1600
- if (r.lucide) {
1601
- const c = kt[r.lucide];
1602
- if (c)
1603
- return /* @__PURE__ */ d(c, { className: `plugin-icon plugin-icon--lucide ${e ?? ""}` });
1598
+ function Kt({ pluginId: t, manifest: n, className: e, alt: r = "" }) {
1599
+ const o = n ? ze(t, n) : { emoji: pe };
1600
+ if (o.lucide) {
1601
+ const s = kt[o.lucide];
1602
+ if (s)
1603
+ return /* @__PURE__ */ f(s, { className: `plugin-icon plugin-icon--lucide ${e ?? ""}` });
1604
1604
  }
1605
- return r.codicon ? /* @__PURE__ */ d("span", { className: `codicon ${r.codicon} plugin-icon plugin-icon--codicon ${e ?? ""}` }) : r.src ? /* @__PURE__ */ d("img", { src: r.src, alt: o, className: `plugin-icon plugin-icon--img ${e ?? ""}`, draggable: !1 }) : /* @__PURE__ */ d("span", { className: `plugin-icon plugin-icon--emoji ${e ?? ""}`, children: r.emoji ?? pe });
1605
+ return o.codicon ? /* @__PURE__ */ f("span", { className: `codicon ${o.codicon} plugin-icon plugin-icon--codicon ${e ?? ""}` }) : o.src ? /* @__PURE__ */ f("img", { src: o.src, alt: r, className: `plugin-icon plugin-icon--img ${e ?? ""}`, draggable: !1 }) : /* @__PURE__ */ f("span", { className: `plugin-icon plugin-icon--emoji ${e ?? ""}`, children: o.emoji ?? pe });
1606
+ }
1607
+ function Wt({ onPreview: t, onPin: n, disabled: e, delay: r = 250 }) {
1608
+ const o = F(null);
1609
+ R(() => () => {
1610
+ o.current && clearTimeout(o.current);
1611
+ }, []);
1612
+ const s = K((i) => {
1613
+ e || i.button !== void 0 && i.button !== 0 || (o.current ? (clearTimeout(o.current), o.current = null) : o.current = setTimeout(() => {
1614
+ o.current = null, t();
1615
+ }, r));
1616
+ }, [e, r, t]), c = K((i) => {
1617
+ e || i.button !== void 0 && i.button !== 0 || i.detail === 2 && (o.current && (clearTimeout(o.current), o.current = null), n());
1618
+ }, [e, n]);
1619
+ return { handleMouseDown: s, handleClick: c };
1620
+ }
1621
+ function Bt(t) {
1622
+ const n = F(t);
1623
+ return n.current = t, K((e) => {
1624
+ var o, s, c, i, d, a;
1625
+ if (!(e.ctrlKey || e.metaKey)) return !1;
1626
+ const r = e.key.toLowerCase();
1627
+ return r !== "c" && r !== "x" && r !== "v" ? !1 : (e.preventDefault(), r === "c" ? (s = (o = n.current).onCopy) == null || s.call(o) : r === "x" ? (i = (c = n.current).onCut) == null || i.call(c) : (a = (d = n.current).onPaste) == null || a.call(d), !0);
1628
+ }, []);
1629
+ }
1630
+ function Ot(t, n = 150) {
1631
+ const [e, r] = P(""), o = F(null), s = K(
1632
+ (i) => {
1633
+ r(i), o.current && clearTimeout(o.current), o.current = setTimeout(() => {
1634
+ t(i);
1635
+ }, n);
1636
+ },
1637
+ [t, n]
1638
+ ), c = K(() => {
1639
+ o.current && clearTimeout(o.current), r(""), t("");
1640
+ }, [t]);
1641
+ return R(() => () => {
1642
+ o.current && clearTimeout(o.current);
1643
+ }, []), { value: e, onChange: s, onClear: c };
1606
1644
  }
1607
- function Wt(t, n) {
1645
+ function Vt(t, n) {
1608
1646
  const e = n - t;
1609
1647
  return !Number.isInteger(t) || !Number.isInteger(n) || e <= 2 ? 0.01 : 1;
1610
1648
  }
1611
1649
  export {
1612
- Ce as Button,
1650
+ Ee as Button,
1613
1651
  At as ColorPicker,
1614
- Ct as Combobox,
1652
+ Et as Combobox,
1615
1653
  It as ContextMenu,
1616
1654
  Lt as DynamicSelect,
1617
1655
  _t as FilePathInput,
1618
- $t as FontFamilySelect,
1619
- Dt as FormRow,
1656
+ Dt as FontFamilySelect,
1657
+ $t as FormRow,
1620
1658
  Ht as InlineInput,
1621
- St as NumberInput,
1659
+ Rt as NumberInput,
1622
1660
  Kt as PluginIcon,
1623
- Rt as SegmentedRadio,
1661
+ St as SegmentedRadio,
1624
1662
  ge as SelectBox,
1625
1663
  Tt as Slider,
1626
1664
  Pt as ThemePicker,
1627
1665
  Ft as Toggle,
1628
- Wt as inferSliderStep
1666
+ Vt as inferSliderStep,
1667
+ Wt as useClickPreview,
1668
+ Bt as useClipboardKeys,
1669
+ Ot as useDebouncedInput
1629
1670
  };