@pstdio/workbench 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,85 +1,85 @@
1
- import { jsxs as pe, jsx as N } from "react/jsx-runtime";
2
- import { useRef as v, useState as be, useEffect as B, createElement as U } from "react";
3
- import { host as ot } from "rimless";
4
- import { F as ae } from "./file-section-navigation-CfYqVObc.js";
5
- import { r as je, d as de } from "./composition-resolver-types-CWykPyEK.js";
6
- import { c as he, w as st } from "./workbench-menu-paths-Bb0ICxeG.js";
7
- import { W as V } from "./icon-B9XolQG8.js";
8
- import { isLocalizedString as it, matchesResourceWhen as at } from "@pstdio/sdk/extensions";
9
- import { w as dt } from "./layout-types-DMoZz38-.js";
10
- const ce = 1, ct = ["commands.execute", "resource.open", "notification.show", "notification.action", "notification.resolve", "notification.dismiss", "preferences.get", "preferences.set", "extension.settings.all", "extension.settings.get", "extension.settings.set", "extension.settings.delete", "terminal.session", "files.upload", "files.list", "files.delete"], Se = ["host.dispatchKeyboardEvent"], lt = [...ct, ...Se], mt = new Set(lt), He = (e) => mt.has(e), ut = (e) => {
11
- const [t, r] = e.split("@"), n = r === void 0 ? ce : Number(r);
1
+ import { jsxs as Ee, jsx as G } from "react/jsx-runtime";
2
+ import { useRef as R, useState as Pe, useEffect as Q, createElement as K } from "react";
3
+ import { host as yt } from "rimless";
4
+ import { F as we } from "./file-section-navigation-CfYqVObc.js";
5
+ import { i as vt, c as Ae, w as kt } from "./workbench-menu-paths-D-e7iscN.js";
6
+ import { r as Le, d as Ie } from "./composition-resolver-types-CWykPyEK.js";
7
+ import { W as Y, a as Rt } from "./workflow-status-settings-DLiu9FZ0.js";
8
+ import { isLocalizedString as Ct, matchesResourceWhen as xt } from "@pstdio/sdk/extensions";
9
+ import { w as Et } from "./layout-types-DMoZz38-.js";
10
+ const ye = 1, Pt = ["commands.execute", "resource.open", "notification.show", "notification.action", "notification.resolve", "notification.dismiss", "preferences.get", "preferences.set", "extension.settings.all", "extension.settings.get", "extension.settings.set", "extension.settings.delete", "terminal.session", "files.upload", "files.list", "files.delete"], Ue = ["host.dispatchKeyboardEvent"], At = [...Pt, ...Ue], St = new Set(At), _e = (e) => St.has(e), Tt = (e) => {
11
+ const [t, n] = e.split("@"), r = n === void 0 ? ye : Number(n);
12
12
  return {
13
13
  capability: e,
14
14
  name: t ?? "",
15
- version: n
15
+ version: r
16
16
  };
17
- }, Y = (e) => ({
17
+ }, ne = (e) => ({
18
18
  capability: e,
19
19
  code: "unsupported_webview_capability",
20
20
  message: `Unsupported webview capability: ${e}`,
21
21
  severity: "error"
22
- }), ft = (e, t, r) => ({
22
+ }), jt = (e, t, n) => ({
23
23
  capability: e,
24
24
  code: "unsupported_webview_capability_version",
25
- message: `Unsupported webview capability version: ${t}@${r.toString()} (supported: ${ce.toString()})`,
25
+ message: `Unsupported webview capability version: ${t}@${n.toString()} (supported: ${ye.toString()})`,
26
26
  severity: "error"
27
- }), pt = (e) => ({
27
+ }), Wt = (e) => ({
28
28
  capability: e,
29
29
  code: "undeclared_webview_capability",
30
30
  message: `Webview did not declare host capability: ${e}`,
31
31
  severity: "error"
32
- }), bt = (e, t = {}) => {
33
- const r = [], n = /* @__PURE__ */ new Set();
34
- for (const o of Se)
35
- t[o] && n.add(o);
36
- for (const o of e ?? []) {
37
- const s = ut(o);
38
- if (!He(s.name)) {
39
- r.push(Y(o));
32
+ }), Mt = (e, t = {}) => {
33
+ const n = [], r = /* @__PURE__ */ new Set();
34
+ for (const s of Ue)
35
+ t[s] && r.add(s);
36
+ for (const s of e ?? []) {
37
+ const o = Tt(s);
38
+ if (!_e(o.name)) {
39
+ n.push(ne(s));
40
40
  continue;
41
41
  }
42
- if (s.version !== ce) {
43
- r.push(ft(o, s.name, s.version));
42
+ if (o.version !== ye) {
43
+ n.push(jt(s, o.name, o.version));
44
44
  continue;
45
45
  }
46
- if (!t[s.name]) {
47
- r.push(Y(o));
46
+ if (!t[o.name]) {
47
+ n.push(ne(s));
48
48
  continue;
49
49
  }
50
- n.add(s.name);
50
+ r.add(o.name);
51
51
  }
52
52
  return {
53
- allowed: n,
54
- diagnostics: r
53
+ allowed: r,
54
+ diagnostics: n
55
55
  };
56
- }, ht = (e) => {
56
+ }, Ot = (e) => {
57
57
  const {
58
58
  allowed: t,
59
- diagnostics: r
60
- } = bt(e.declaredCapabilities, e.capabilities), n = (o) => {
61
- e.onDiagnostic?.(o);
59
+ diagnostics: n
60
+ } = Mt(e.declaredCapabilities, e.capabilities), r = (s) => {
61
+ e.onDiagnostic?.(s);
62
62
  };
63
63
  return {
64
- diagnostics: r,
65
- async call(o) {
66
- if (!He(o.method)) {
67
- const i = Y(o.method);
68
- throw n(i), new Error(i.message);
64
+ diagnostics: n,
65
+ async call(s) {
66
+ if (!_e(s.method)) {
67
+ const i = ne(s.method);
68
+ throw r(i), new Error(i.message);
69
69
  }
70
- if (!t.has(o.method)) {
71
- const i = pt(o.method);
72
- throw n(i), new Error(i.message);
70
+ if (!t.has(s.method)) {
71
+ const i = Wt(s.method);
72
+ throw r(i), new Error(i.message);
73
73
  }
74
- const s = e.capabilities[o.method];
75
- if (!s) {
76
- const i = Y(o.method);
77
- throw n(i), new Error(i.message);
74
+ const o = e.capabilities[s.method];
75
+ if (!o) {
76
+ const i = ne(s.method);
77
+ throw r(i), new Error(i.message);
78
78
  }
79
- return await s(o.params);
79
+ return await o(s.params);
80
80
  }
81
81
  };
82
- }, gt = (e) => typeof e == "object" && e !== null, ge = (e) => {
82
+ }, Ht = (e) => typeof e == "object" && e !== null, Se = (e) => {
83
83
  try {
84
84
  const t = JSON.stringify(e);
85
85
  if (typeof t == "string" && t.length > 0) return t;
@@ -90,7 +90,7 @@ const ce = 1, ct = ["commands.execute", "resource.open", "notification.show", "n
90
90
  } catch {
91
91
  return "Unknown error";
92
92
  }
93
- }, wt = (e) => {
93
+ }, Kt = (e) => {
94
94
  if (e instanceof Error) return {
95
95
  message: e.message,
96
96
  stack: e.stack
@@ -98,50 +98,50 @@ const ce = 1, ct = ["commands.execute", "resource.open", "notification.show", "n
98
98
  if (typeof e == "string") return {
99
99
  message: e
100
100
  };
101
- if (gt(e)) {
102
- const t = typeof e.message == "string" ? e.message : null, r = typeof e.stack == "string" ? e.stack : void 0;
103
- return t ? r ? {
101
+ if (Ht(e)) {
102
+ const t = typeof e.message == "string" ? e.message : null, n = typeof e.stack == "string" ? e.stack : void 0;
103
+ return t ? n ? {
104
104
  message: t,
105
- stack: r
105
+ stack: n
106
106
  } : {
107
107
  message: t
108
108
  } : {
109
- message: ge(e)
109
+ message: Se(e)
110
110
  };
111
111
  }
112
112
  return e == null ? {
113
113
  message: "Unknown error"
114
114
  } : {
115
- message: ge(e)
115
+ message: Se(e)
116
116
  };
117
- }, te = () => {
117
+ }, de = () => {
118
118
  if (typeof document > "u") return {};
119
119
  const e = getComputedStyle(document.documentElement), t = {};
120
- for (let r = 0; r < e.length; r += 1) {
121
- const n = e.item(r);
122
- n.startsWith("--chakra-") && (t[n] = e.getPropertyValue(n).trim());
120
+ for (let n = 0; n < e.length; n += 1) {
121
+ const r = e.item(n);
122
+ r.startsWith("--chakra-") && (t[r] = e.getPropertyValue(r).trim());
123
123
  }
124
124
  return t;
125
- }, re = (e) => {
125
+ }, ce = (e) => {
126
126
  if (typeof document > "u") return e;
127
127
  const t = document.documentElement.getAttribute("data-theme");
128
128
  if (t === "dark" || t === "light") return t;
129
- const r = document.documentElement.getAttribute("data-color-mode");
130
- return r === "dark" || r === "light" ? r : e;
131
- }, It = {
129
+ const n = document.documentElement.getAttribute("data-color-mode");
130
+ return n === "dark" || n === "light" ? n : e;
131
+ }, $t = {
132
132
  border: 0,
133
133
  display: "block",
134
134
  flex: "1 1 0%",
135
135
  height: "100%",
136
136
  minHeight: 0,
137
137
  width: "100%"
138
- }, yt = {
138
+ }, Vt = {
139
139
  display: "flex",
140
140
  height: "100%",
141
141
  minHeight: 0,
142
142
  position: "relative",
143
143
  width: "100%"
144
- }, vt = {
144
+ }, Dt = {
145
145
  alignItems: "center",
146
146
  background: "rgba(255, 255, 255, 0.92)",
147
147
  color: "#7a1f12",
@@ -152,160 +152,160 @@ const ce = 1, ct = ["commands.execute", "resource.open", "notification.show", "n
152
152
  position: "absolute",
153
153
  textAlign: "center",
154
154
  zIndex: 1
155
- }, kt = "allow-scripts allow-forms allow-popups", Rt = (e) => {
155
+ }, Bt = "allow-scripts allow-forms allow-popups", Ft = (e) => {
156
156
  const {
157
157
  view: t,
158
- props: r,
159
- theme: n,
160
- capabilities: o,
161
- hostEvents: s,
158
+ props: n,
159
+ theme: r,
160
+ capabilities: s,
161
+ hostEvents: o,
162
162
  onReady: i,
163
163
  onError: a,
164
164
  onDiagnostics: d,
165
- title: m
166
- } = e, w = v(null), l = v(null), u = v(!1), c = v(null), p = v(r), h = v(n), k = v(o), $ = v(s), Q = v(t.webview.capabilities), b = v(i), I = v(a), R = v(d), [E, G] = be(null), [Z, me] = be(0);
167
- return p.current = r, h.current = n, k.current = o, $.current = s, Q.current = t.webview.capabilities, b.current = i, I.current = a, R.current = d, B(() => {
165
+ title: u
166
+ } = e, w = R(null), l = R(null), m = R(!1), c = R(null), f = R(n), h = R(r), C = R(s), j = R(o), _ = R(t.webview.capabilities), q = R(i), W = R(a), b = R(d), [y, E] = Pe(null), [x, A] = Pe(0);
167
+ return f.current = n, h.current = r, C.current = s, j.current = o, _.current = t.webview.capabilities, q.current = i, W.current = a, b.current = d, Q(() => {
168
168
  const g = w.current;
169
169
  if (!g) return;
170
- const T = () => {
171
- u.current && me((y) => y + 1);
170
+ const M = () => {
171
+ m.current && A((k) => k + 1);
172
172
  };
173
- g.addEventListener("load", T);
174
- const W = () => g.removeEventListener("load", T), F = `${Z}
173
+ g.addEventListener("load", M);
174
+ const O = () => g.removeEventListener("load", M), z = `${x}
175
175
  ${t.webview.runtimeUrl}
176
176
  ${t.webview.moduleUrl}`;
177
- if (c.current === F) return W;
178
- c.current = F;
179
- const et = t.webview.styles, tt = t.webview.moduleUrl, ue = (y) => {
180
- y.length > 0 && R.current?.(y);
181
- }, fe = () => ht({
182
- capabilities: k.current ?? {},
183
- declaredCapabilities: Q.current,
184
- onDiagnostic: (y) => ue([y])
177
+ if (c.current === z) return O;
178
+ c.current = z;
179
+ const gt = t.webview.styles, ht = t.webview.moduleUrl, Ce = (k) => {
180
+ k.length > 0 && b.current?.(k);
181
+ }, xe = () => Ot({
182
+ capabilities: C.current ?? {},
183
+ declaredCapabilities: _.current,
184
+ onDiagnostic: (k) => Ce([k])
185
185
  });
186
- ue(fe().diagnostics);
187
- const rt = {
186
+ Ce(xe().diagnostics);
187
+ const wt = {
188
188
  ready: () => {
189
189
  },
190
- runtimeError: (y) => {
191
- G(y.message), I.current?.(y);
190
+ runtimeError: (k) => {
191
+ E(k.message), W.current?.(k);
192
192
  },
193
- call: async (y) => await fe().call(y)
193
+ call: async (k) => await xe().call(k)
194
194
  };
195
195
  return (() => {
196
- u.current = !1, l.current = null;
197
- const y = ot.connect(g, rt);
198
- g.contentWindow?.location.replace(t.webview.runtimeUrl), y.then(async (ee) => {
199
- const j = ee.remote;
200
- l.current = j, $.current?.bind((nt) => j.hostEvent?.(nt)), await j.init({
201
- moduleUrl: tt,
202
- styles: et,
203
- props: p.current,
204
- theme: re(h.current),
205
- themeVariables: te(),
196
+ m.current = !1, l.current = null;
197
+ const k = yt.connect(g, wt);
198
+ g.contentWindow?.location.replace(t.webview.runtimeUrl), k.then(async (ae) => {
199
+ const H = ae.remote;
200
+ l.current = H, j.current?.bind((It) => H.hostEvent?.(It)), await H.init({
201
+ moduleUrl: ht,
202
+ styles: gt,
203
+ props: f.current,
204
+ theme: ce(h.current),
205
+ themeVariables: de(),
206
206
  extensionId: t.extensionId
207
- }), u.current = !0, G(null), b.current?.();
208
- }).catch((ee) => {
209
- const j = wt(ee);
210
- G(j.message), I.current?.(j);
207
+ }), m.current = !0, E(null), q.current?.();
208
+ }).catch((ae) => {
209
+ const H = Kt(ae);
210
+ E(H.message), W.current?.(H);
211
211
  });
212
- })(), W;
213
- }, [Z, t.extensionId, t.webview.runtimeUrl, t.webview.moduleUrl, t.webview.styles]), B(() => {
212
+ })(), O;
213
+ }, [x, t.extensionId, t.webview.runtimeUrl, t.webview.moduleUrl, t.webview.styles]), Q(() => {
214
214
  const g = l.current;
215
- if (!(!g || !s))
216
- return s.bind((T) => g.hostEvent?.(T)), () => s.unbind();
217
- }, [s]), B(() => {
218
- u.current && l.current?.propsUpdate({
219
- props: r
215
+ if (!(!g || !o))
216
+ return o.bind((M) => g.hostEvent?.(M)), () => o.unbind();
217
+ }, [o]), Q(() => {
218
+ m.current && l.current?.propsUpdate({
219
+ props: n
220
220
  });
221
- }, [r]), B(() => {
222
- u.current && l.current?.themeUpdate({
223
- theme: re(n),
224
- variables: te()
221
+ }, [n]), Q(() => {
222
+ m.current && l.current?.themeUpdate({
223
+ theme: ce(r),
224
+ variables: de()
225
225
  });
226
- }, [n]), B(() => {
226
+ }, [r]), Q(() => {
227
227
  if (typeof window > "u" || typeof MutationObserver > "u") return;
228
228
  let g = null;
229
- const T = () => {
229
+ const M = () => {
230
230
  g !== null && cancelAnimationFrame(g), g = requestAnimationFrame(() => {
231
- g = null, u.current && l.current?.themeUpdate({
232
- theme: re(h.current),
233
- variables: te()
231
+ g = null, m.current && l.current?.themeUpdate({
232
+ theme: ce(h.current),
233
+ variables: de()
234
234
  });
235
235
  });
236
- }, W = new MutationObserver(T), F = {
236
+ }, O = new MutationObserver(M), z = {
237
237
  attributeFilter: ["class", "data-color-mode", "data-theme", "style"],
238
238
  attributes: !0
239
239
  };
240
- return W.observe(document.documentElement, F), W.observe(document.body, F), () => {
241
- W.disconnect(), g !== null && cancelAnimationFrame(g);
240
+ return O.observe(document.documentElement, z), O.observe(document.body, z), () => {
241
+ O.disconnect(), g !== null && cancelAnimationFrame(g);
242
242
  };
243
- }, []), /* @__PURE__ */ pe("div", { style: yt, children: [
244
- E ? /* @__PURE__ */ N("div", { role: "alert", style: vt, children: /* @__PURE__ */ pe("div", { children: [
245
- /* @__PURE__ */ N("strong", { children: "Extension view failed to load." }),
246
- /* @__PURE__ */ N("div", { children: E })
243
+ }, []), /* @__PURE__ */ Ee("div", { style: Vt, children: [
244
+ y ? /* @__PURE__ */ G("div", { role: "alert", style: Dt, children: /* @__PURE__ */ Ee("div", { children: [
245
+ /* @__PURE__ */ G("strong", { children: "Extension view failed to load." }),
246
+ /* @__PURE__ */ G("div", { children: y })
247
247
  ] }) }) : null,
248
- /* @__PURE__ */ N(
248
+ /* @__PURE__ */ G(
249
249
  "iframe",
250
250
  {
251
251
  ref: w,
252
- title: m ?? t.label,
252
+ title: u ?? t.label,
253
253
  allow: "fullscreen",
254
254
  allowFullScreen: !0,
255
- sandbox: kt,
255
+ sandbox: Bt,
256
256
  style: {
257
- ...It,
258
- colorScheme: n
257
+ ...$t,
258
+ colorScheme: r
259
259
  },
260
260
  onLoad: () => {
261
- u.current && me((g) => g + 1);
261
+ m.current && A((g) => g + 1);
262
262
  },
263
263
  onError: () => {
264
264
  const g = `Failed to load extension runtime at ${t.webview.runtimeUrl}`;
265
- G(g), I.current?.({
265
+ E(g), W.current?.({
266
266
  message: g
267
267
  });
268
268
  }
269
269
  },
270
- Z
270
+ x
271
271
  )
272
272
  ] });
273
- }, Ct = () => {
273
+ }, Nt = () => {
274
274
  let e = null;
275
- const t = [], r = /* @__PURE__ */ new Set();
275
+ const t = [], n = /* @__PURE__ */ new Set();
276
276
  return {
277
- emit(n) {
278
- e ? e(n) : t.push(n);
277
+ emit(r) {
278
+ e ? e(r) : t.push(r);
279
279
  },
280
- bind(n) {
281
- for (e = n; t.length > 0; ) n(t.shift());
280
+ bind(r) {
281
+ for (e = r; t.length > 0; ) r(t.shift());
282
282
  },
283
- onDisconnect(n) {
284
- return r.add(n), () => r.delete(n);
283
+ onDisconnect(r) {
284
+ return n.add(r), () => n.delete(r);
285
285
  },
286
286
  unbind() {
287
287
  e = null;
288
- for (const n of r) n();
288
+ for (const r of n) r();
289
289
  }
290
290
  };
291
- }, Et = "terminal.session", Pt = (e) => {
291
+ }, Lt = "terminal.session", Ut = (e) => {
292
292
  const {
293
293
  terminal: t,
294
- hostEvents: r
295
- } = e, n = (o) => {
296
- r.emit({
297
- scope: Et,
298
- payload: o
294
+ hostEvents: n
295
+ } = e, r = (s) => {
296
+ n.emit({
297
+ scope: Lt,
298
+ payload: s
299
299
  });
300
300
  };
301
- return async (o) => {
302
- const s = o;
303
- switch (s.operation) {
301
+ return async (s) => {
302
+ const o = s;
303
+ switch (o.operation) {
304
304
  case "open": {
305
305
  const {
306
306
  sessionId: i
307
307
  } = await t.open({
308
- request: s.request
308
+ request: o.request
309
309
  });
310
310
  return {
311
311
  operation: "open",
@@ -314,25 +314,25 @@ ${t.webview.moduleUrl}`;
314
314
  }
315
315
  case "write":
316
316
  return t.write({
317
- sessionId: s.sessionId,
318
- data: s.data
317
+ sessionId: o.sessionId,
318
+ data: o.data
319
319
  }), {
320
320
  operation: "write",
321
321
  accepted: !0
322
322
  };
323
323
  case "resize":
324
324
  return t.resize({
325
- sessionId: s.sessionId,
326
- cols: s.cols,
327
- rows: s.rows
325
+ sessionId: o.sessionId,
326
+ cols: o.cols,
327
+ rows: o.rows
328
328
  }), {
329
329
  operation: "resize",
330
330
  accepted: !0
331
331
  };
332
332
  case "kill":
333
333
  return await t.kill({
334
- sessionId: s.sessionId,
335
- signal: s.signal
334
+ sessionId: o.sessionId,
335
+ signal: o.signal
336
336
  }), {
337
337
  operation: "kill",
338
338
  accepted: !0
@@ -340,35 +340,35 @@ ${t.webview.moduleUrl}`;
340
340
  case "subscribe": {
341
341
  const {
342
342
  sessionId: i
343
- } = s;
343
+ } = o;
344
344
  let a = () => {
345
345
  }, d = () => {
346
- }, m = !1;
346
+ }, u = !1;
347
347
  const w = () => {
348
- m || (m = !0, a(), d());
348
+ u || (u = !0, a(), d());
349
349
  };
350
350
  return a = t.subscribe(i, {
351
- onData: (l) => n({
351
+ onData: (l) => r({
352
352
  sessionId: i,
353
353
  kind: "data",
354
354
  chunk: l
355
355
  }),
356
356
  onExit: (l) => {
357
- n({
357
+ r({
358
358
  sessionId: i,
359
359
  kind: "exit",
360
360
  code: l.code,
361
361
  signal: l.signal
362
362
  }), w();
363
363
  }
364
- }), d = r.onDisconnect(w), {
364
+ }), d = n.onDisconnect(w), {
365
365
  operation: "subscribe",
366
366
  accepted: !0
367
367
  };
368
368
  }
369
369
  }
370
370
  };
371
- }, At = (e) => {
371
+ }, _t = (e) => {
372
372
  if (typeof document > "u") return;
373
373
  const t = new KeyboardEvent("keydown", {
374
374
  ...e,
@@ -376,78 +376,78 @@ ${t.webview.moduleUrl}`;
376
376
  cancelable: !0
377
377
  });
378
378
  document.dispatchEvent(t);
379
- }, Me = (e) => !e?.strategy || e.strategy === "persistent" ? {} : {
379
+ }, qe = (e) => !e?.strategy || e.strategy === "persistent" ? {} : {
380
380
  replaceActive: !0
381
- }, Oe = (e) => ({
381
+ }, ze = (e) => ({
382
382
  "commands.execute": (t) => {
383
- const r = t;
384
- return e.workbench.commands.executeCommand(r.commandId, r.params);
383
+ const n = t;
384
+ return e.workbench.commands.executeCommand(n.commandId, n.params);
385
385
  },
386
386
  "resource.open": (t) => {
387
- const r = t;
388
- if (!r.resource) throw new Error("resource.open requires a resource.");
389
- return e.workbench.resources.openResource(r.resource, Me(r.input));
387
+ const n = t;
388
+ if (!n.resource) throw new Error("resource.open requires a resource.");
389
+ return e.workbench.resources.openResource(n.resource, qe(n.input));
390
390
  },
391
391
  "notification.show": (t) => {
392
- const r = t;
392
+ const n = t;
393
393
  return e.workbench.notifications.show({
394
- level: r.level,
395
- message: r.message,
396
- title: r.title
394
+ level: n.level,
395
+ message: n.message,
396
+ title: n.title
397
397
  });
398
398
  },
399
399
  "preferences.get": (t) => {
400
- const r = t;
401
- return e.workbench.preferences.getValue(r.name, r.scope);
400
+ const n = t;
401
+ return e.workbench.preferences.getValue(n.name, n.scope);
402
402
  },
403
403
  "preferences.set": (t) => {
404
- const r = t;
405
- return e.workbench.preferences.setValue(r.name, r.value, r.scope ?? {
404
+ const n = t;
405
+ return e.workbench.preferences.setValue(n.name, n.value, n.scope ?? {
406
406
  scope: "user"
407
407
  }), {
408
- name: r.name,
409
- value: r.value
408
+ name: n.name,
409
+ value: n.value
410
410
  };
411
411
  },
412
- "host.dispatchKeyboardEvent": (t) => (e.dispatchKeyboardEvent ?? At)(t),
412
+ "host.dispatchKeyboardEvent": (t) => (e.dispatchKeyboardEvent ?? _t)(t),
413
413
  ...e.hostEvents ? {
414
- "terminal.session": Pt({
414
+ "terminal.session": Ut({
415
415
  terminal: e.workbench.terminal,
416
416
  hostEvents: e.hostEvents
417
417
  })
418
418
  } : {}
419
- }), xt = (e, t) => {
420
- for (const r of t)
421
- console.warn(`[workbench.webview:${e}] ${r.code}/${r.capability}: ${r.message}`);
422
- }, Tt = (e, t) => {
419
+ }), qt = (e, t) => {
420
+ for (const n of t)
421
+ console.warn(`[workbench.webview:${e}] ${n.code}/${n.capability}: ${n.message}`);
422
+ }, zt = (e, t) => {
423
423
  console.error(`[workbench.webview:${e}] runtime error: ${t}`);
424
- }, S = "webview:bridge", Wt = (e) => {
424
+ }, se = "webview:bridge", Qt = (e) => {
425
425
  if (typeof e != "object" || e === null || Array.isArray(e)) return !1;
426
426
  const t = e;
427
427
  return typeof t.runtimeUrl == "string" && typeof t.moduleUrl == "string";
428
- }, jt = ({
428
+ }, Gt = ({
429
429
  placement: e
430
430
  }) => ({
431
431
  placement: e,
432
432
  resource: e.resource
433
- }), Ke = () => "light", we = /* @__PURE__ */ new WeakMap(), De = (e, t) => {
434
- let r = we.get(e);
435
- r || (r = /* @__PURE__ */ new Map(), we.set(e, r));
436
- const n = t.instanceId;
437
- let o = r.get(n);
438
- return o || (o = Ct(), r.set(n, o)), o;
439
- }, $e = (e) => {
433
+ }), Qe = () => "light", Te = /* @__PURE__ */ new WeakMap(), Ge = (e, t) => {
434
+ let n = Te.get(e);
435
+ n || (n = /* @__PURE__ */ new Map(), Te.set(e, n));
436
+ const r = t.instanceId;
437
+ let s = n.get(r);
438
+ return s || (s = Nt(), n.set(r, s)), s;
439
+ }, Ye = (e) => {
440
440
  const {
441
441
  context: t,
442
- createHostCapabilities: r,
443
- createProps: n,
444
- createTheme: o = Ke,
445
- ownerId: s,
442
+ createHostCapabilities: n,
443
+ createProps: r,
444
+ createTheme: s = Qe,
445
+ ownerId: o,
446
446
  title: i,
447
447
  webview: a
448
448
  } = e;
449
- return /* @__PURE__ */ N(Rt, { view: {
450
- extensionId: s ?? "workbench",
449
+ return /* @__PURE__ */ G(Ft, { view: {
450
+ extensionId: o ?? "workbench",
451
451
  id: t.webviewId,
452
452
  label: a.title ?? i,
453
453
  webview: {
@@ -456,69 +456,104 @@ ${t.webview.moduleUrl}`;
456
456
  runtimeUrl: a.runtimeUrl,
457
457
  styles: a.styles ?? []
458
458
  }
459
- }, props: n(t), theme: o(t), capabilities: r(t), hostEvents: t.hostEvents, onDiagnostics: (d) => xt(t.webviewId, d), onError: (d) => Tt(t.webviewId, d.message) });
460
- }, St = (e, t, r, n) => {
459
+ }, props: r(t), theme: s(t), capabilities: n(t), hostEvents: t.hostEvents, onDiagnostics: (d) => qt(t.webviewId, d), onError: (d) => zt(t.webviewId, d.message) });
460
+ }, Yt = (e, t, n, r) => {
461
461
  const {
462
- workbench: o,
463
- panel: s,
462
+ workbench: s,
463
+ panel: o,
464
464
  instance: i
465
- } = e, a = Wt(s.config) ? s.config : null;
466
- return a ? $e({
465
+ } = e, a = Qt(o.config) ? o.config : null;
466
+ return a ? Ye({
467
467
  context: {
468
- workbench: o,
468
+ workbench: s,
469
469
  webviewId: i.panelId,
470
470
  placement: i,
471
- hostEvents: De(o, i)
471
+ hostEvents: Ge(s, i)
472
472
  },
473
473
  createHostCapabilities: t,
474
- createProps: r,
475
- createTheme: n,
476
- ownerId: "ownerId" in s ? s.ownerId : void 0,
477
- title: s.title,
474
+ createProps: n,
475
+ createTheme: r,
476
+ ownerId: "ownerId" in o ? o.ownerId : void 0,
477
+ title: o.title,
478
478
  webview: a
479
479
  }) : null;
480
- }, Ht = (e = {}) => {
481
- const t = e.createHostCapabilities ?? Oe, r = e.createProps ?? jt, n = e.createTheme ?? Ke;
480
+ }, Xt = (e = {}) => {
481
+ const t = e.createHostCapabilities ?? ze, n = e.createProps ?? Gt, r = e.createTheme ?? Qe;
482
482
  return {
483
- id: S,
484
- render: (o) => St(o, t, r, n)
483
+ id: se,
484
+ render: (s) => Yt(s, t, n, r)
485
485
  };
486
- }, C = (e, t) => ({
486
+ }, Jt = (e, t) => ({
487
+ extensionId: "pstdio",
488
+ kind: e,
489
+ id: t
490
+ }), le = (e, t, n) => ({
491
+ id: e,
492
+ ref: Jt("resource-kind", e),
493
+ surface: "primary",
494
+ label: t,
495
+ menuSlots: n
496
+ }), ue = [{
497
+ id: "headerPrimary",
498
+ placement: "header-primary",
499
+ access: "public"
500
+ }, {
501
+ id: "headerOverflow",
502
+ placement: "header-overflow",
503
+ access: "public"
504
+ }], me = {
505
+ project: le("project", "Extension", ue),
506
+ session: le("session", "Session", ue),
507
+ workspace: le("workspace", "Workspace", ue)
508
+ }, $ = {
509
+ project: me.project.ref,
510
+ session: me.session.ref,
511
+ workspace: me.workspace.ref
512
+ }, je = (e) => ({
513
+ ...e,
514
+ kind: "command"
515
+ });
516
+ Object.assign(je, {
517
+ forExtension: (e) => (t) => je({
518
+ extensionId: `${e.publisher}.${e.name}`,
519
+ id: t
520
+ })
521
+ });
522
+ const Zt = (e) => ({
523
+ ...e,
524
+ kind: "event"
525
+ }), re = (e, t) => ({
487
526
  id: e,
488
527
  kind: t.kind,
489
528
  label: t.label,
490
529
  description: t.description,
491
530
  metadata: t.metadata
531
+ }), I = (e) => Zt({
532
+ extensionId: "pstdio",
533
+ id: e
534
+ }), V = (e, t) => re(`${e.id}.${t}`, {
535
+ kind: "menu"
492
536
  });
493
- C("project.sidenav", {
537
+ re("project.sidenav", {
494
538
  kind: "panel"
495
- }), C("project.headerPrimary", {
496
- kind: "menu"
497
- }), C("project.headerOverflow", {
498
- kind: "menu"
499
- }), C("project.settingsPanels", {
539
+ }), V($.project, "headerPrimary"), V($.project, "headerOverflow"), re("project.settingsPanels", {
500
540
  kind: "settings"
501
541
  });
502
- C("session.headerPrimary", {
503
- kind: "menu"
504
- }), C("session.headerOverflow", {
505
- kind: "menu"
506
- }), C("session.transcriptActions", {
507
- kind: "menu"
508
- });
509
- C("workspace.headerPrimary", {
510
- kind: "menu"
511
- }), C("workspace.headerOverflow", {
512
- kind: "menu"
513
- }), C("workspace.sidenav", {
542
+ V($.session, "headerPrimary"), V($.session, "headerOverflow");
543
+ V($.workspace, "headerPrimary"), V($.workspace, "headerOverflow"), re("workspace.sidenav", {
514
544
  kind: "panel"
515
545
  });
516
- const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e.$l10n == "string", f = (e, t = "") => e === void 0 ? t : Mt(e) ? e.default ?? e.$l10n : e, X = (e) => {
546
+ I("project.opened");
547
+ I("session.started"), I("session.resumed"), I("session.awaitingInput"), I("session.succeeded"), I("session.failed"), I("session.completed");
548
+ I("workspace.created"), I("workspace.provision"), I("workspace.ready"), I("workspace.archived"), I("workspace.deleted");
549
+ I("worktree.removed");
550
+ I("git.committed"), I("git.rebased"), I("git.merged"), I("git.conflicted");
551
+ const en = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e.$l10n == "string", p = (e, t = "") => e === void 0 ? t : en(e) ? e.default ?? e.$l10n : e, ie = (e) => {
517
552
  const t = e;
518
553
  if (!t?.outcome) return e;
519
554
  if (t.outcome.status === "success") return t.outcome.value;
520
555
  throw new Error(t.outcome.reason ?? t.outcome.error?.message ?? "Extension command failed.");
521
- }, H = (e) => {
556
+ }, D = (e) => {
522
557
  if (e)
523
558
  return {
524
559
  type: e.kind,
@@ -526,8 +561,8 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
526
561
  label: e.label,
527
562
  metadata: e.metadata
528
563
  };
529
- }, _ = (e) => {
530
- const t = e.icon, r = e.projectId ? {
564
+ }, J = (e) => {
565
+ const t = e.icon, n = e.projectId ? {
531
566
  ...e.metadata,
532
567
  projectId: e.projectId
533
568
  } : e.metadata;
@@ -537,340 +572,386 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
537
572
  id: e.id,
538
573
  label: e.label,
539
574
  icon: typeof t == "string" ? t : void 0,
540
- metadata: r
575
+ metadata: n
541
576
  };
542
- }, M = (e) => ({
577
+ }, B = (e) => ({
543
578
  id: e.id,
544
579
  kind: e.kind,
545
580
  context: {
546
581
  projectId: e.projectId,
547
582
  ...e.context ?? {}
548
583
  }
549
- }), P = async (e, t, r = {}) => {
550
- const n = H(r.resource), o = await e.executeCommand(t, {
584
+ }), tn = (e) => typeof e == "object" && e !== null && !Array.isArray(e), nn = (e) => {
585
+ if (!(!tn(e) || e.deleted !== !0))
586
+ return typeof e.id == "string" ? e.id : void 0;
587
+ }, rn = async (e, t, n) => {
588
+ if (!t || nn(n) !== (t.id ?? t.uri) || (e.workbench.navigator.forgetResource(t.uri), e.workbench.getPrimaryResource()?.uri !== t.uri)) return;
589
+ const r = e.workbench.resources.walkHierarchy(t).at(-2);
590
+ if (r) {
591
+ if (vt(r)) {
592
+ await e.workbench.views.openView(r.viewId, {
593
+ strategy: {
594
+ kind: "replace-active"
595
+ }
596
+ });
597
+ return;
598
+ }
599
+ await e.workbench.resources.openResource(r, {
600
+ replaceActive: !0
601
+ });
602
+ }
603
+ }, P = async (e, t, n = {}) => {
604
+ const r = D(n.resource), s = await e.executeCommand(t, {
551
605
  projectId: e.projectId,
552
- ...r.params ? {
553
- params: r.params
606
+ ...n.params ? {
607
+ params: n.params
554
608
  } : {},
555
- ...n ? {
556
- resource: n
609
+ ...r ? {
610
+ resource: r
557
611
  } : {},
558
- ...r.slot ? {
559
- slot: r.slot
612
+ ...n.slot ? {
613
+ slot: n.slot
560
614
  } : {},
561
615
  source: "dashboard",
562
- ...r.metadata ? {
563
- metadata: r.metadata
616
+ ...n.metadata ? {
617
+ metadata: n.metadata
564
618
  } : {}
565
- });
566
- return X(o);
567
- }, x = (e) => !!(e && typeof e == "object" && !Array.isArray(e)), Ot = (e) => typeof e == "string" || x(e) && typeof e.id == "string", Kt = (e) => x(e) && typeof e.type == "string" && typeof e.id == "string", Dt = (e) => {
568
- if (!Kt(e.resource)) return !1;
619
+ }), o = ie(s);
620
+ return await rn(e, n.resource, o), o;
621
+ }, S = (e) => !!(e && typeof e == "object" && !Array.isArray(e)), Xe = (e, t) => S(e) && e.kind === t && typeof e.id == "string", on = (e) => S(e) && typeof e.type == "string" && typeof e.id == "string", sn = (e) => {
622
+ if (!on(e.resource)) return !1;
569
623
  if (e.input === void 0) return !0;
570
- if (!x(e.input)) return !1;
624
+ if (!S(e.input)) return !1;
571
625
  const t = e.input.strategy;
572
626
  return t === void 0 || t === "persistent" || t === "replace-active";
573
- }, $t = (e) => {
574
- if (typeof e.panel != "string") return !1;
627
+ }, an = (e) => {
628
+ if (!Xe(e.view, "view")) return !1;
575
629
  if (e.input === void 0) return !0;
576
- if (!x(e.input)) return !1;
577
- const t = e.input.strategy, r = e.input.region;
578
- return (r === void 0 || typeof r == "string") && (t === void 0 || t === "persistent" || t === "preview" || t === "replace-active" || t === "replace-invoking");
579
- }, Ie = (e) => x(e) ? e.kind === "resource" ? Dt(e) : e.kind === "panel" ? $t(e) : e.kind === "command" && Ot(e.command) && (e.params === void 0 || x(e.params)) : !1, Ft = (e) => Ie(e) ? !0 : x(e) && e.kind === "compound" && Array.isArray(e.targets) && e.targets.length > 0 && e.targets.every(Ie), Bt = (e, t) => !e || e === "persistent" ? {} : {
630
+ if (!S(e.input)) return !1;
631
+ const t = e.input.strategy;
632
+ return t === void 0 || t === "persistent" || t === "preview" || t === "replace-active" || t === "replace-invoking";
633
+ }, We = (e) => S(e) ? e.kind === "resource" ? sn(e) : e.kind === "view" ? an(e) : e.kind === "href" ? typeof e.href == "string" : e.kind === "command" && S(e.target) && Xe(e.target.command, "command") && (e.target.params === void 0 || S(e.target.params)) : !1, dn = (e) => We(e) ? !0 : S(e) && e.kind === "compound" && Array.isArray(e.targets) && e.targets.length > 0 && e.targets.every(We), cn = (e, t) => !e || e === "persistent" ? {} : {
580
634
  replaceActive: !0
581
- }, Nt = (e, t) => {
582
- const r = e?.strategy, n = e?.region ? {
583
- region: e.region
584
- } : {};
585
- if (!r) return n;
586
- if (r === "persistent" || r === "preview" || r === "replace-active")
635
+ }, ln = (e, t) => {
636
+ const n = e?.strategy;
637
+ if (!n) return {};
638
+ if (n === "persistent" || n === "preview" || n === "replace-active")
587
639
  return {
588
- ...n,
589
640
  strategy: {
590
- kind: r
641
+ kind: n
591
642
  }
592
643
  };
593
644
  if (!t) throw new Error("replace-invoking requires a live source placement.");
594
645
  return {
595
- ...n,
596
646
  strategy: {
597
647
  kind: "replace-panel",
598
648
  instanceId: t.instanceId
599
649
  }
600
650
  };
601
- }, Ut = (e, t) => {
602
- const r = t.commandTargetOf?.(e);
603
- return r || {
651
+ }, un = (e, t) => {
652
+ const n = t.commandTargetOf?.(e);
653
+ if (n) return n;
654
+ const r = e.target.command, s = r.extensionId ?? t.extensionId;
655
+ return {
604
656
  kind: "command",
605
- commandId: t.commandIdOf?.(e.command) ?? (typeof e.command == "string" ? e.command : e.command.id),
606
- args: e.params
657
+ commandId: t.commandIdOf?.(r) ?? (s && s !== "pstdio" ? `${s}.command.${r.id}` : r.id),
658
+ args: e.target.params
607
659
  };
608
- }, J = (e, t = {}) => {
660
+ }, mn = (e, t) => {
661
+ const n = e.view.extensionId ?? t;
662
+ return n ? `${n}.view.${e.view.id}` : e.view.id;
663
+ }, Z = (e, t = {}) => {
609
664
  if (e.kind === "resource") {
610
665
  if (e.section && !t.resourceOf)
611
666
  throw new Error("Resource targets with a section need a resourceOf translator that encodes the section.");
612
667
  return {
613
668
  kind: "resource",
614
- resource: t.resourceOf ? t.resourceOf(e.resource, e) : _(e.resource),
615
- input: Bt(e.input?.strategy, t.sourcePlacement)
669
+ resource: t.resourceOf ? t.resourceOf(e.resource, e) : J(e.resource),
670
+ input: cn(e.input?.strategy, t.sourcePlacement)
616
671
  };
617
672
  }
618
- return e.kind === "panel" ? {
619
- kind: "panel",
620
- panelId: e.panel,
621
- input: Nt(e.input, t.sourcePlacement)
622
- } : e.kind === "command" ? Ut(e, t) : {
673
+ return e.kind === "view" ? {
674
+ kind: "view",
675
+ viewId: mn(e, t.extensionId),
676
+ input: ln(e.input, t.sourcePlacement)
677
+ } : e.kind === "command" ? un(e, t) : e.kind === "href" ? e : {
623
678
  kind: "compound",
624
- targets: e.targets.map((r) => J(r, t))
679
+ targets: e.targets.map((n) => Z(n, t))
625
680
  };
626
- }, Fe = (e, t = {}) => {
681
+ }, Je = (e, t = {}) => {
627
682
  if (e != null) {
628
- if (!Ft(e)) throw new Error("Renderer callback returned an invalid navigation target.");
629
- return J(e, t);
683
+ if (!dn(e)) throw new Error("Renderer callback returned an invalid navigation target.");
684
+ return Z(e, t);
630
685
  }
631
- }, Vt = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Lt = (e) => typeof e == "string" ? e : e.id, _t = async (e, t, r) => {
686
+ }, pn = (e) => typeof e == "object" && e !== null && !Array.isArray(e), fn = (e, t) => `${e.extensionId ?? t}.command.${e.id}`, bn = async (e, t, n) => {
632
687
  const {
633
- target: n
634
- } = r;
635
- if (n.kind === "command") {
636
- await P(e, Lt(n.command), {
637
- params: n.params
688
+ target: r
689
+ } = n;
690
+ if (r.kind === "command") {
691
+ await P(e, fn(r.target.command, t.extensionId), {
692
+ params: r.target.params
638
693
  }), e.workbench.commandPaletteResources.refresh();
639
694
  return;
640
695
  }
641
- await e.workbench.navigation.openTarget(J(n, {
642
- resourceOf: (o, s) => {
643
- const i = _(o);
644
- return s.section ? {
696
+ await e.workbench.navigation.openTarget(Z(r, {
697
+ extensionId: t.extensionId,
698
+ resourceOf: (s, o) => {
699
+ const i = J(s);
700
+ return o.section ? {
645
701
  ...i,
646
702
  metadata: {
647
703
  ...i.metadata,
648
- [ae]: {
704
+ [we]: {
649
705
  treeId: t.id,
650
- targetNodeId: r.id,
651
- anchors: s.section.anchors
706
+ targetNodeId: n.id,
707
+ anchors: o.section.anchors
652
708
  }
653
709
  }
654
710
  } : i;
655
711
  }
656
712
  }));
657
- }, qt = (e, t, r, n) => ({
658
- id: `${t.id}:${n.id}`,
659
- label: n.label,
660
- description: n.description,
661
- icon: n.icon,
662
- keywords: n.keywords,
663
- group: r,
664
- activate: () => _t(e, t, n)
665
- }), zt = (e, t) => {
666
- const r = [];
667
- for (const n of t) {
668
- const o = f(n.title, n.id);
669
- r.push(e.workbench.commandPaletteResources.registerProvider({
670
- id: n.id,
671
- title: o,
672
- refreshEventIds: n.refreshEventIds,
713
+ }, gn = (e, t, n, r) => ({
714
+ id: `${t.id}:${r.id}`,
715
+ label: r.label,
716
+ description: r.description,
717
+ icon: r.icon,
718
+ keywords: r.keywords,
719
+ group: n,
720
+ activate: () => bn(e, t, r)
721
+ }), hn = (e, t) => {
722
+ const n = [];
723
+ for (const r of t) {
724
+ const s = p(r.title, r.id);
725
+ n.push(e.workbench.commandPaletteResources.registerProvider({
726
+ id: r.id,
727
+ title: s,
728
+ refreshEventIds: r.refreshEventIds,
673
729
  query: async ({
674
- query: s,
730
+ query: o,
675
731
  limit: i
676
732
  }) => {
677
- const a = e.workbench.getActiveResource(), d = await P(e, n.queryCommandId, {
733
+ const a = e.workbench.getActiveResource(), d = await P(e, r.queryHandlerId, {
678
734
  params: {
679
735
  projectId: e.projectId,
680
736
  modeId: e.workbench.modes.getActiveModeId(),
681
- activeResource: H(a),
682
- providerId: n.id,
683
- query: s,
737
+ activeResource: D(a),
738
+ providerId: r.id,
739
+ query: o,
684
740
  limit: i
685
741
  }
686
742
  });
687
- return Vt(d) ? (d.items ?? []).map((m) => qt(e, n, o, m)) : [];
743
+ return pn(d) ? (d.items ?? []).map((u) => gn(e, r, s, u)) : [];
688
744
  }
689
745
  }));
690
746
  }
691
747
  return {
692
748
  dispose() {
693
- for (let n = r.length - 1; n >= 0; n -= 1) r[n]?.dispose();
749
+ for (let r = n.length - 1; r >= 0; r -= 1) n[r]?.dispose();
694
750
  }
695
751
  };
696
- }, Qt = (e) => e ? (Array.isArray(e) ? e : [e]).map(({
697
- for: r,
698
- ...n
752
+ }, wn = (e) => e ? (Array.isArray(e) ? e : [e]).map(({
753
+ for: n,
754
+ ...r
699
755
  }) => ({
700
- ...n,
701
- resourceKind: r
702
- })) : [], Gt = () => {
703
- const e = [], t = [], r = [], n = /* @__PURE__ */ new Map(), o = (s, i) => he(() => {
704
- const a = s.indexOf(i);
705
- a >= 0 && s.splice(a, 1);
756
+ ...r,
757
+ resourceKind: n
758
+ })) : [], In = () => {
759
+ const e = [], t = [], n = [], r = /* @__PURE__ */ new Map(), s = (o, i) => Ae(() => {
760
+ const a = o.indexOf(i);
761
+ a >= 0 && o.splice(a, 1);
706
762
  });
707
763
  return {
708
- registerResourceKind(s) {
709
- return e.push(s), o(e, s);
764
+ registerResourceKind(o) {
765
+ return e.push(o), s(e, o);
710
766
  },
711
- registerPanelCapability(s) {
712
- return t.push(s), o(t, s);
767
+ registerPanelCapability(o) {
768
+ return t.push(o), s(t, o);
713
769
  },
714
- registerResourcePanel(s) {
715
- return r.push(s), o(r, s);
770
+ registerResourcePanel(o) {
771
+ return n.push(o), s(n, o);
716
772
  },
717
- registerModeComposition(s) {
718
- return n.set(s.id, s), he(() => {
719
- n.get(s.id) === s && n.delete(s.id);
773
+ registerModeComposition(o) {
774
+ return r.set(o.id, o), Ae(() => {
775
+ r.get(o.id) === o && r.delete(o.id);
720
776
  });
721
777
  },
722
778
  getComposition: () => ({
723
779
  resourceKinds: [...e],
724
780
  panels: [...t],
725
- resourcePanels: [...r]
781
+ resourcePanels: [...n]
726
782
  }),
727
- getModeComposition: (s) => n.get(s)
783
+ getModeComposition: (o) => r.get(o)
728
784
  };
729
- }, Be = (e, t) => {
730
- const r = {};
731
- for (const n of de) {
732
- const o = e.regions[n], s = o.widgets.filter((a) => t.has(a.contributionId)).map((a) => a.contributionId), i = o.widgets.find((a) => a.widgetId === o.activeWidgetId);
733
- r[n] = {
734
- order: s,
785
+ }, Ze = (e, t) => {
786
+ const n = {};
787
+ for (const r of Ie) {
788
+ const s = e.regions[r], o = s.widgets.filter((a) => t.has(a.contributionId)).map((a) => a.contributionId), i = s.widgets.find((a) => a.widgetId === s.activeWidgetId);
789
+ n[r] = {
790
+ order: o,
735
791
  activePanelId: i && t.has(i.contributionId) ? i.contributionId : void 0
736
792
  };
737
793
  }
738
794
  return {
739
- regions: r
795
+ regions: n
740
796
  };
741
- }, Yt = (e) => {
797
+ }, yn = (e) => {
742
798
  const t = e.registry.getModeComposition(e.modeId);
743
799
  if (!t) return [];
744
- const r = e.registry.getComposition(), n = new Set(r.panels.map((o) => o.id));
745
- return je({
800
+ const n = e.registry.getComposition(), r = new Set(n.panels.map((s) => s.id));
801
+ return Le({
746
802
  context: {
747
803
  modeId: e.modeId,
748
804
  resourceKind: e.resourceKind
749
805
  },
750
806
  mode: t,
751
- composition: r,
752
- persisted: Be(e.layout, n)
807
+ composition: n,
808
+ persisted: Ze(e.layout, r)
753
809
  }).addablePanels;
754
- }, ye = (e) => e === "main" ? "location" : "sub-panel", Xt = (e, t) => {
755
- const r = e.layout.getLayout(), n = de.find((d) => r.regions[d].widgets.some((m) => m.contributionId === t.panelId)), o = () => e.layout.openWidget(t.panelId, {
810
+ }, Me = (e) => e === "main" ? "location" : "sub-panel", vn = (e, t) => {
811
+ const n = e.layout.getLayout(), r = Ie.find((d) => n.regions[d].widgets.some((u) => u.contributionId === t.panelId)), s = () => e.layout.openWidget(t.panelId, {
756
812
  region: t.region,
757
813
  closable: !t.required,
758
814
  pinned: t.pinned,
759
- role: ye(t.region)
815
+ role: Me(t.region)
760
816
  });
761
- if (!n) {
762
- (t.origin === "persisted" || t.origin === "default" || t.required) && o();
817
+ if (!r) {
818
+ (t.origin === "persisted" || t.origin === "default" || t.required) && s();
763
819
  return;
764
820
  }
765
- if (!t.allowedRegions.includes(n)) {
766
- o();
821
+ if (!t.allowedRegions.includes(r)) {
822
+ s();
767
823
  return;
768
824
  }
769
- const s = r.regions[n].widgets.find((d) => d.contributionId === t.panelId);
770
- if (!s) return;
771
- const i = ye(n), a = !t.required;
772
- ((s.closable ?? !0) !== a || s.pinned !== t.pinned || s.role !== i) && e.layout.updateWidgetPlacement(s.widgetId, {
825
+ const o = n.regions[r].widgets.find((d) => d.contributionId === t.panelId);
826
+ if (!o) return;
827
+ const i = Me(r), a = !t.required;
828
+ ((o.closable ?? !0) !== a || o.pinned !== t.pinned || o.role !== i) && e.layout.updateWidgetPlacement(o.widgetId, {
773
829
  closable: a,
774
830
  pinned: t.pinned,
775
831
  role: i
776
832
  });
777
- }, Jt = (e, t) => {
778
- for (const [r, n] of t) {
779
- if (!n) continue;
780
- const o = e.layout.getLayout().regions[r];
781
- o.activeWidgetId !== n && o.widgets.some((s) => s.widgetId === n) && e.layout.setRegionActiveWidget(r, n);
833
+ }, kn = (e, t) => {
834
+ for (const [n, r] of t) {
835
+ if (!r) continue;
836
+ const s = e.layout.getLayout().regions[n];
837
+ s.activeWidgetId !== r && s.widgets.some((o) => o.widgetId === r) && e.layout.setRegionActiveWidget(n, r);
782
838
  }
783
- }, Zt = (e, t, r) => {
784
- const n = er(t);
785
- if (!r.requiredFallback) {
786
- e.notifications.dismiss(n);
839
+ }, Rn = (e, t, n) => {
840
+ const r = Cn(t);
841
+ if (!n.requiredFallback) {
842
+ e.notifications.dismiss(r);
787
843
  return;
788
844
  }
789
- const o = r.requiredFallback.panelId;
790
- e.layout.getLayout().regions.main.widgets.some((i) => i.contributionId === o) || e.layout.openWidget(o, {
845
+ const s = n.requiredFallback.panelId;
846
+ e.layout.getLayout().regions.main.widgets.some((i) => i.contributionId === s) || e.layout.openWidget(s, {
791
847
  region: "main",
792
848
  pinned: !0,
793
849
  role: "location"
794
850
  }), e.notifications.show({
795
- id: n,
851
+ id: r,
796
852
  level: "error",
797
853
  title: "A required panel could not be placed",
798
- message: r.diagnostics.map((i) => i.message).join(" ")
854
+ message: n.diagnostics.map((i) => i.message).join(" ")
799
855
  });
800
- }, er = (e) => `workbench.composition.required.${e}`, tr = (e, t) => {
801
- const r = t.registry.getModeComposition(t.modeId);
802
- if (!r) return;
803
- const n = t.registry.getComposition(), o = new Set(n.panels.map((m) => m.id)), s = e.layout.getLayout(), i = t.seeding ? void 0 : Be(s, o), a = je({
856
+ }, Cn = (e) => `workbench.composition.required.${e}`, xn = (e, t) => {
857
+ const n = t.registry.getModeComposition(t.modeId);
858
+ if (!n) return;
859
+ const r = t.registry.getComposition(), s = new Set(r.panels.map((u) => u.id)), o = e.layout.getLayout(), i = t.seeding ? void 0 : Ze(o, s), a = Le({
804
860
  context: {
805
861
  modeId: t.modeId,
806
862
  resourceKind: t.resourceKind
807
863
  },
808
- mode: r,
809
- composition: n,
864
+ mode: n,
865
+ composition: r,
810
866
  persisted: i
811
- }), d = new Map(de.map((m) => [m, e.layout.getLayout().regions[m].activeWidgetId]));
812
- for (const m of a.placements) Xt(e, m);
813
- return Jt(e, d), e.layout.reconcilePanelMenus(), Zt(e, t.modeId, a), a;
814
- }, q = (e) => ({
815
- title: f(e.title),
867
+ }), d = new Map(Ie.map((u) => [u, e.layout.getLayout().regions[u].activeWidgetId]));
868
+ for (const u of a.placements) vn(e, u);
869
+ return kn(e, d), e.layout.reconcilePanelMenus(), Rn(e, t.modeId, a), a;
870
+ }, ve = (e) => ({
871
+ title: p(e.title) || void 0,
816
872
  runtimeUrl: e.runtimeUrl,
817
873
  moduleUrl: e.moduleUrl,
818
874
  styles: e.styles,
819
875
  capabilities: e.capabilities
820
- }), rr = (e = 0) => ({
876
+ }), F = (e, t) => e?.({
877
+ id: t.id,
878
+ title: p(t.title, t.id),
879
+ icon: t.icon
880
+ }), En = (e = 0) => ({
821
881
  priority: -e
822
- }), nr = (e, t) => {
823
- const r = e.show ? Array.isArray(e.show) ? e.show : [e.show] : [];
824
- if (r.some((o) => o.for === void 0)) return;
825
- const n = [...r.flatMap((o) => o.for ? [o.for] : []), ...(t ?? []).filter((o) => o.panel === e.id).map((o) => o.resourceKind)].filter((o, s, i) => i.indexOf(o) === s);
826
- return n.length > 0 ? n : void 0;
827
- }, or = (e) => (e.show ? Array.isArray(e.show) ? e.show : [e.show] : [])[0]?.region ?? "main", O = (e) => ({
882
+ }), Pn = (e, t) => {
883
+ const n = e.show ? Array.isArray(e.show) ? e.show : [e.show] : [];
884
+ if (n.some((s) => s.for === void 0)) return;
885
+ const r = [...n.flatMap((s) => s.for ? [s.for] : []), ...(t ?? []).filter((s) => s.panel === e.id).map((s) => s.resourceKind)].filter((s, o, i) => i.indexOf(s) === o);
886
+ return r.length > 0 ? r : void 0;
887
+ }, An = (e) => (e.show ? Array.isArray(e.show) ? e.show : [e.show] : [])[0]?.region ?? "main", N = (e) => ({
828
888
  id: e.panel.id,
829
- title: f(e.panel.title, e.panel.id),
889
+ title: p(e.panel.title, e.panel.id),
830
890
  icon: e.panel.icon,
831
- region: or(e.panel),
891
+ region: An(e.panel),
832
892
  rendererId: e.rendererId,
833
893
  singleton: !0,
834
- resourceKinds: nr(e.panel, e.resourcePanels),
835
- panelMenus: ar(e.panel.panelMenus, e.menuDeclarationOffset),
894
+ resourceKinds: Pn(e.panel, e.resourcePanels),
895
+ panelMenus: jn(e.panel.panelMenus, e.menuDeclarationOffset),
836
896
  config: e.config,
837
- ...rr(e.declarationIndex)
838
- }), K = (e) => {
897
+ ...En(e.declarationIndex)
898
+ }), L = (e) => {
839
899
  const t = [];
840
- let r = 0;
841
- for (const n of e)
842
- t.push(r), r += n.panelMenus?.length ?? 0;
900
+ let n = 0;
901
+ for (const r of e)
902
+ t.push(n), n += r.panelMenus?.length ?? 0;
843
903
  return t;
844
- }, sr = (e) => {
845
- const t = e.renderer?.id ?? (e.webview ? S : void 0);
904
+ }, Sn = (e) => {
905
+ const t = e.renderer?.id ?? (e.webview ? se : void 0);
846
906
  if (!t) throw new Error(`Panel Menu has no renderer: ${e.id}`);
847
907
  return t;
848
- }, ir = {
908
+ }, Tn = {
849
909
  first: 1e6,
850
910
  default: 0,
851
911
  last: -1e6
852
- }, ar = (e, t = 0) => e?.map((r, n) => ({
853
- id: r.id,
854
- title: f(r.title, r.id),
855
- side: r.side,
856
- rendererId: sr(r),
857
- config: r.webview ? q(r.webview) : void 0,
858
- priority: ir[r.placement ?? "default"] - (t + n)
859
- })), D = (e) => e.workbench.layout.registerPanel(e.contribution), z = (e, t) => e.renderer?.kind === t ? e.renderer.id : void 0, ne = (e, t = "") => f(e, t), dr = (e) => !!e && typeof e == "object" && !Array.isArray(e), cr = (e, t, r) => {
860
- const n = M({
912
+ }, jn = (e, t = 0) => e?.map((n, r) => ({
913
+ id: n.id,
914
+ title: p(n.title, n.id),
915
+ side: n.side,
916
+ rendererId: Sn(n),
917
+ config: n.webview ? ve(n.webview) : void 0,
918
+ priority: Tn[n.placement ?? "default"] - (t + r)
919
+ })), U = (e) => {
920
+ const t = e.workbench.layout.registerPanel(e.contribution);
921
+ let n;
922
+ try {
923
+ n = e.workbench.views.registerView({
924
+ id: e.contribution.id,
925
+ panelId: e.contribution.id,
926
+ title: e.contribution.title,
927
+ icon: e.contribution.icon,
928
+ path: e.path,
929
+ aliases: e.aliases,
930
+ resolveInput: e.resolveInput
931
+ });
932
+ } catch (r) {
933
+ throw t.dispose(), r;
934
+ }
935
+ return {
936
+ dispose() {
937
+ n.dispose(), t.dispose();
938
+ }
939
+ };
940
+ }, ee = (e, t) => e.renderer?.kind === t ? e.renderer.id : void 0, pe = (e, t = "") => p(e, t), Wn = (e) => !!e && typeof e == "object" && !Array.isArray(e), Mn = (e, t, n) => {
941
+ const r = B({
861
942
  id: t.id,
862
943
  kind: "renderer",
863
944
  projectId: e.projectId,
864
945
  context: {
865
946
  controlsRendererId: t.id
866
947
  }
867
- }), o = (s, i, a) => s ? P(e, s, {
948
+ }), s = (o, i, a) => o ? P(e, o, {
868
949
  params: {
869
950
  renderer: {
870
951
  rendererId: t.id,
871
952
  projectId: e.projectId,
872
953
  ...a ? {
873
- resource: H(a)
954
+ resource: D(a)
874
955
  } : {},
875
956
  invocation: {
876
957
  placement: "visible"
@@ -879,93 +960,96 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
879
960
  ...i
880
961
  },
881
962
  resource: a,
882
- slot: n,
963
+ slot: r,
883
964
  metadata: {
884
965
  controlsRendererId: t.id
885
966
  }
886
967
  }) : Promise.resolve(void 0);
887
968
  return e.workbench.renderers.registerControlsRenderer({
888
969
  id: t.id,
889
- title: ne(t.title, t.id),
890
- emptyTitle: ne(t.emptyTitle, ""),
891
- emptyDescription: ne(t.emptyDescription, ""),
970
+ title: pe(t.title, t.id),
971
+ emptyTitle: pe(t.emptyTitle, ""),
972
+ emptyDescription: pe(t.emptyDescription, ""),
892
973
  defaultValues: t.defaultValues,
893
- executeQuery: async (s) => {
894
- const i = await o(t.queryHandlerId, {}, s ?? r.resolveResource?.(t));
895
- return dr(i) ? i : {};
974
+ executeQuery: async (o) => {
975
+ const i = await s(t.queryHandlerId, {}, o ?? n.resolveResource?.(t));
976
+ return Wn(i) ? i : {};
896
977
  },
897
978
  updateValue: t.valueChangeHandlerId ? ({
898
- controlId: s,
979
+ controlId: o,
899
980
  value: i,
900
981
  values: a,
901
982
  resource: d
902
- }) => o(t.valueChangeHandlerId, {
903
- controlId: s,
983
+ }) => s(t.valueChangeHandlerId, {
984
+ controlId: o,
904
985
  value: i,
905
986
  values: a
906
987
  }, d).then(() => {
907
988
  }) : void 0,
908
989
  apply: t.applyHandlerId ? ({
909
- values: s,
990
+ values: o,
910
991
  resource: i
911
- }) => o(t.applyHandlerId, {
912
- values: s
992
+ }) => s(t.applyHandlerId, {
993
+ values: o
913
994
  }, i).then(() => {
914
995
  }) : void 0,
915
996
  reset: t.resetHandlerId ? ({
916
- controlIds: s,
997
+ controlIds: o,
917
998
  resource: i
918
- }) => o(t.resetHandlerId, {
919
- controlIds: s
999
+ }) => s(t.resetHandlerId, {
1000
+ controlIds: o
920
1001
  }, i).then(() => {
921
1002
  }) : void 0
922
1003
  });
923
- }, lr = (e, t, r, n, o) => {
924
- const s = z(t, "controls");
925
- if (s)
926
- return D({
1004
+ }, On = (e, t, n, r, s, o) => {
1005
+ const i = ee(t, "controls");
1006
+ if (i)
1007
+ return U({
927
1008
  workbench: e.workbench,
928
- contribution: O({
1009
+ path: t.path,
1010
+ aliases: t.aliases,
1011
+ resolveInput: F(o.resolveViewInput, t),
1012
+ contribution: N({
929
1013
  panel: t,
930
- rendererId: s,
931
- declarationIndex: r,
932
- menuDeclarationOffset: n,
933
- resourcePanels: o
1014
+ rendererId: i,
1015
+ declarationIndex: n,
1016
+ menuDeclarationOffset: r,
1017
+ resourcePanels: s
934
1018
  })
935
1019
  });
936
- }, Xn = (e, t, r, n = {}, o = []) => {
937
- const s = [];
938
- for (const a of t) s.push(cr(e, a, n));
939
- const i = K(r);
940
- return r.forEach((a, d) => {
941
- const m = lr(e, a, d, i[d], o);
942
- m && s.push(m);
1020
+ }, Hn = (e, t, n, r = {}, s = []) => {
1021
+ const o = [];
1022
+ for (const a of t) o.push(Mn(e, a, r));
1023
+ const i = L(n);
1024
+ return n.forEach((a, d) => {
1025
+ const u = On(e, a, d, i[d], s, r);
1026
+ u && o.push(u);
943
1027
  }), {
944
1028
  dispose() {
945
- for (let a = s.length - 1; a >= 0; a -= 1) s[a]?.dispose();
1029
+ for (let a = o.length - 1; a >= 0; a -= 1) o[a]?.dispose();
946
1030
  }
947
1031
  };
948
- }, A = (e, t = "") => f(e, t), ve = (e) => ({
1032
+ }, T = (e, t = "") => p(e, t), Oe = (e) => ({
949
1033
  ...e,
950
- label: A(e.label, e.id),
951
- description: e.description ? A(e.description) : void 0,
952
- icon: e.icon ? U(V, {
1034
+ label: T(e.label, e.id),
1035
+ description: e.description ? T(e.description) : void 0,
1036
+ icon: e.icon ? K(Y, {
953
1037
  name: e.icon,
954
1038
  size: 14
955
1039
  }) : void 0
956
- }), mr = (e) => !!(e && typeof e == "object" && Array.isArray(e.rows)), ur = (e) => ({
1040
+ }), Kn = (e) => !!(e && typeof e == "object" && Array.isArray(e.rows)), $n = (e) => ({
957
1041
  id: e.id,
958
1042
  values: e.values,
959
- resource: e.resource ? _(e.resource) : void 0
960
- }), fr = (e, t) => {
961
- const r = /* @__PURE__ */ new WeakMap(), n = M({
1043
+ resource: e.resource ? J(e.resource) : void 0
1044
+ }), Vn = (e, t) => {
1045
+ const n = /* @__PURE__ */ new WeakMap(), r = B({
962
1046
  id: t.id,
963
1047
  kind: "dataTableRenderer",
964
1048
  projectId: e.projectId,
965
1049
  context: {
966
1050
  dataTableRendererId: t.id
967
1051
  }
968
- }), o = (s, i, a, d) => P(e, s, {
1052
+ }), s = (o, i, a, d) => P(e, o, {
969
1053
  params: {
970
1054
  renderer: {
971
1055
  rendererId: t.id,
@@ -974,7 +1058,7 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
974
1058
  modeId: d
975
1059
  } : {},
976
1060
  ...a ? {
977
- resource: H(a)
1061
+ resource: D(a)
978
1062
  } : {},
979
1063
  invocation: {
980
1064
  placement: "visible"
@@ -983,221 +1067,226 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
983
1067
  ...i
984
1068
  },
985
1069
  resource: a,
986
- slot: n,
1070
+ slot: r,
987
1071
  metadata: {
988
1072
  dataTableRendererId: t.id
989
1073
  }
990
1074
  });
991
1075
  return e.workbench.renderers.registerDataTableRenderer({
992
1076
  id: t.id,
993
- title: A(t.title, t.id),
1077
+ title: T(t.title, t.id),
994
1078
  resourceKind: t.resourceKind,
995
- columns: t.columns?.map(ve),
1079
+ columns: t.columns?.map(Oe),
996
1080
  initialPageSize: t.initialPageSize,
997
1081
  pageSizeOptions: t.pageSizeOptions,
998
1082
  selectionMode: t.selectionMode,
999
- selectionActions: t.selectionActions?.map((s) => ({
1000
- id: s.id,
1001
- label: A(s.label, s.id),
1002
- icon: s.icon ? U(V, {
1003
- name: s.icon,
1083
+ selectionActions: t.selectionActions?.map((o) => ({
1084
+ id: o.id,
1085
+ label: T(o.label, o.id),
1086
+ icon: o.icon ? K(Y, {
1087
+ name: o.icon,
1004
1088
  size: 16
1005
1089
  }) : void 0,
1006
- destructive: s.destructive,
1007
- run: (i) => o(s.commandId, {
1090
+ destructive: o.destructive,
1091
+ run: (i) => s(o.commandId, {
1008
1092
  rowIds: i.map((a) => a.id)
1009
1093
  }).then(() => {
1010
1094
  })
1011
1095
  })),
1012
- emptyTitle: t.emptyTitle ? A(t.emptyTitle) : void 0,
1013
- emptyDescription: t.emptyDescription ? A(t.emptyDescription) : void 0,
1096
+ emptyTitle: t.emptyTitle ? T(t.emptyTitle) : void 0,
1097
+ emptyDescription: t.emptyDescription ? T(t.emptyDescription) : void 0,
1014
1098
  executeQuery: async ({
1015
- resource: s,
1099
+ resource: o,
1016
1100
  modeId: i
1017
1101
  }) => {
1018
- const a = await o(t.queryHandlerId, {}, s, i);
1019
- return mr(a) ? {
1020
- rows: a.rows.map((m) => {
1021
- const w = ur(m);
1022
- return r.set(w, m), w;
1102
+ const a = await s(t.queryHandlerId, {}, o, i);
1103
+ return Kn(a) ? {
1104
+ rows: a.rows.map((u) => {
1105
+ const w = $n(u);
1106
+ return n.set(w, u), w;
1023
1107
  }),
1024
- columns: a.columns?.map(ve)
1108
+ columns: a.columns?.map(Oe)
1025
1109
  } : {
1026
1110
  rows: []
1027
1111
  };
1028
1112
  },
1029
- rowActions: t.rowActions?.map((s) => ({
1030
- id: s.id,
1031
- label: A(s.label, s.id),
1032
- icon: s.icon ? U(V, {
1033
- name: s.icon,
1113
+ rowActions: t.rowActions?.map((o) => ({
1114
+ id: o.id,
1115
+ label: T(o.label, o.id),
1116
+ icon: o.icon ? K(Y, {
1117
+ name: o.icon,
1034
1118
  size: 16
1035
1119
  }) : void 0,
1036
- destructive: s.destructive,
1120
+ destructive: o.destructive,
1037
1121
  run: async (i) => {
1038
- await o(s.commandId, {
1122
+ await s(o.commandId, {
1039
1123
  rowId: i.id
1040
1124
  }, i.resource), e.workbench.renderers.refreshDataTableRenderer(t.id);
1041
1125
  }
1042
1126
  })),
1043
- onRowActivate: t.rowActivationHandlerId ? async (s) => {
1044
- const i = await o(t.rowActivationHandlerId, {
1045
- row: r.get(s) ?? s
1046
- }, s.resource), a = Fe(i);
1127
+ onRowActivate: t.rowActivationHandlerId ? async (o) => {
1128
+ const i = await s(t.rowActivationHandlerId, {
1129
+ row: n.get(o) ?? o
1130
+ }, o.resource), a = Je(i, {
1131
+ extensionId: t.extensionId
1132
+ });
1047
1133
  a && await e.workbench.navigation.openTarget(a);
1048
1134
  } : void 0
1049
1135
  });
1050
- }, pr = (e, t, r, n, o) => {
1051
- const s = z(t, "dataTable");
1052
- if (s)
1053
- return D({
1136
+ }, Dn = (e, t, n, r, s, o) => {
1137
+ const i = ee(t, "dataTable");
1138
+ if (i)
1139
+ return U({
1054
1140
  workbench: e.workbench,
1055
- contribution: O({
1141
+ path: t.path,
1142
+ aliases: t.aliases,
1143
+ resolveInput: F(o, t),
1144
+ contribution: N({
1056
1145
  panel: t,
1057
- rendererId: s,
1058
- declarationIndex: r,
1059
- menuDeclarationOffset: n,
1060
- resourcePanels: o
1146
+ rendererId: i,
1147
+ declarationIndex: n,
1148
+ menuDeclarationOffset: r,
1149
+ resourcePanels: s
1061
1150
  })
1062
1151
  });
1063
- }, br = (e, t, r, n = []) => {
1064
- const o = t.map((i) => fr(e, i)), s = K(r);
1065
- return r.forEach((i, a) => {
1066
- const d = pr(e, i, a, s[a], n);
1067
- d && o.push(d);
1152
+ }, Bn = (e, t, n, r = [], s) => {
1153
+ const o = t.map((a) => Vn(e, a)), i = L(n);
1154
+ return n.forEach((a, d) => {
1155
+ const u = Dn(e, a, d, i[d], r, s);
1156
+ u && o.push(u);
1068
1157
  }), {
1069
1158
  dispose() {
1070
- for (let i = o.length - 1; i >= 0; i -= 1) o[i]?.dispose();
1159
+ for (let a = o.length - 1; a >= 0; a -= 1) o[a]?.dispose();
1071
1160
  }
1072
1161
  };
1073
- }, hr = {
1162
+ }, Fn = {
1074
1163
  first: 0,
1075
1164
  default: 1,
1076
1165
  last: 2
1077
- }, Jn = {
1166
+ }, Do = {
1078
1167
  commands: [],
1079
1168
  commandPaletteContributions: [],
1080
1169
  diagnostics: [],
1081
1170
  extensions: [],
1082
1171
  menuContributions: [],
1083
1172
  modes: [],
1084
- routes: [],
1085
- kanbanRenderers: [],
1086
- dataTableRenderers: [],
1087
- treeRenderers: [],
1088
- fileRenderers: [],
1173
+ views: [],
1174
+ viewMenus: [],
1175
+ placements: [],
1176
+ resourceKinds: [],
1177
+ resourceViews: [],
1178
+ navigationItems: [],
1179
+ statusBarItems: [],
1180
+ statuses: [],
1089
1181
  settingsPanels: [],
1090
- settingsDefinitions: [],
1091
- treeItems: [],
1092
- panels: []
1093
- }, gr = (e) => `workbench.extension.menu.${e.id}`, wr = (e) => `workbench.extension.palette.${e.id}`, Ne = (e, t) => hr[e.placement ?? "default"] * 1e3 + t, Ue = (e) => e === void 0 ? "" : it(e) ? e.default ?? e.$l10n : e, Ir = (e) => {
1182
+ settingsDefinitions: []
1183
+ }, Nn = (e) => `workbench.extension.menu.${e.id}`, Ln = (e) => `workbench.extension.palette.${e.id}`, et = (e, t) => Fn[e.placement ?? "default"] * 1e3 + t, tt = (e) => e === void 0 ? "" : Ct(e) ? e.default ?? e.$l10n : e, Un = (e) => {
1094
1184
  const {
1095
1185
  commandId: t,
1096
- contribution: r,
1097
- index: n,
1098
- resolveString: o,
1099
- slot: s,
1186
+ contribution: n,
1187
+ index: r,
1188
+ resolveString: s,
1189
+ slot: o,
1100
1190
  when: i
1101
1191
  } = e;
1102
1192
  return {
1103
1193
  commandId: t,
1104
- sourceCommandId: r.commandId,
1105
- label: o(r.label, r.extensionId),
1106
- icon: r.icon,
1107
- group: s.group ?? r.group,
1108
- args: r.params,
1109
- overflowLabel: s.overflowLabel,
1110
- order: Ne(r, n),
1194
+ sourceCommandId: n.commandId,
1195
+ label: s(n.label, n.extensionId),
1196
+ icon: n.icon,
1197
+ group: o.group ?? n.group,
1198
+ args: n.params,
1199
+ overflowLabel: o.overflowLabel,
1200
+ order: et(n, r),
1111
1201
  when: i
1112
1202
  };
1113
- }, yr = (e) => {
1203
+ }, _n = (e) => {
1114
1204
  const {
1115
1205
  commandId: t,
1116
- contribution: r,
1117
- index: n,
1118
- resolveString: o
1206
+ contribution: n,
1207
+ index: r,
1208
+ resolveString: s
1119
1209
  } = e;
1120
1210
  return {
1121
1211
  commandId: t,
1122
- label: o(r.label, r.extensionId),
1123
- icon: r.icon,
1124
- group: r.group,
1125
- args: r.params,
1126
- order: Ne(r, n)
1212
+ label: s(n.label, n.extensionId),
1213
+ icon: n.icon,
1214
+ group: n.group,
1215
+ args: n.params,
1216
+ order: et(n, r)
1127
1217
  };
1128
- }, vr = (e) => {
1218
+ }, qn = (e) => {
1129
1219
  const {
1130
- createCommandId: t = gr,
1131
- createWhenExpression: r,
1132
- menuSlotsById: n,
1133
- menuTargetsById: o,
1134
- metadata: s,
1135
- resolveString: i = Ue
1136
- } = e, a = [];
1137
- return s.menuContributions.forEach((d, m) => {
1138
- const w = d.target ? o?.get(d.target) : n.get(d.slotId);
1139
- if (!w) return;
1140
- const l = t(d), u = s.commands.find((c) => c.id === d.commandId);
1220
+ createCommandId: t = Nn,
1221
+ createWhenExpression: n,
1222
+ menuSlotsById: r,
1223
+ menuTargetsById: s,
1224
+ metadata: o,
1225
+ resolveString: i = tt
1226
+ } = e, a = [], d = [];
1227
+ return o.menuContributions.forEach((u, w) => {
1228
+ const l = u.target ? s?.get(u.target) : r.get(u.slotId);
1229
+ if (!l) {
1230
+ d.push({
1231
+ contribution: u,
1232
+ targetId: u.target ?? u.slotId
1233
+ });
1234
+ return;
1235
+ }
1236
+ const m = t(u), c = o.commands.find((f) => f.id === u.commandId);
1141
1237
  a.push({
1142
1238
  command: {
1143
- id: l,
1144
- label: i(d.label, d.extensionId),
1145
- category: d.group,
1146
- description: u ? i(u.description, u.extensionId) : void 0,
1147
- icon: d.icon,
1148
- params: u?.params
1239
+ id: m,
1240
+ label: i(u.label, u.extensionId),
1241
+ category: u.group,
1242
+ description: c ? i(c.description, c.extensionId) : void 0,
1243
+ icon: u.icon,
1244
+ params: c?.params
1149
1245
  },
1150
- contribution: d,
1151
- menuItem: Ir({
1152
- commandId: l,
1153
- contribution: d,
1154
- index: m,
1246
+ contribution: u,
1247
+ menuItem: Un({
1248
+ commandId: m,
1249
+ contribution: u,
1250
+ index: w,
1155
1251
  resolveString: i,
1156
- slot: w,
1157
- when: r?.(d)
1252
+ slot: l,
1253
+ when: n?.(u)
1158
1254
  }),
1159
- menuPath: w.menuPath,
1160
- targetCommandId: d.commandId
1255
+ menuPath: l.menuPath,
1256
+ targetCommandId: u.commandId
1161
1257
  });
1162
- }), a;
1163
- }, kr = (e) => {
1258
+ }), {
1259
+ registrations: a,
1260
+ unresolved: d
1261
+ };
1262
+ }, zn = (e) => {
1164
1263
  const {
1165
- createCommandId: t = wr,
1166
- metadata: r,
1167
- resolveString: n = Ue
1168
- } = e, o = [];
1169
- return (r.commandPaletteContributions ?? []).forEach((s, i) => {
1170
- const a = t(s), d = r.commands.find((m) => m.id === s.commandId);
1171
- o.push({
1264
+ createCommandId: t = Ln,
1265
+ metadata: n,
1266
+ resolveString: r = tt
1267
+ } = e, s = [];
1268
+ return (n.commandPaletteContributions ?? []).forEach((o, i) => {
1269
+ const a = t(o), d = n.commands.find((u) => u.id === o.commandId);
1270
+ s.push({
1172
1271
  command: {
1173
1272
  id: a,
1174
- label: n(s.label, s.extensionId),
1175
- category: s.group,
1176
- description: d ? n(d.description, d.extensionId) : void 0,
1177
- icon: s.icon,
1273
+ label: r(o.label, o.extensionId),
1274
+ category: o.group,
1275
+ description: d ? r(d.description, d.extensionId) : void 0,
1276
+ icon: o.icon,
1178
1277
  params: d?.params
1179
1278
  },
1180
- contribution: s,
1181
- menuItem: yr({
1279
+ contribution: o,
1280
+ menuItem: _n({
1182
1281
  commandId: a,
1183
- contribution: s,
1282
+ contribution: o,
1184
1283
  index: i,
1185
- resolveString: n
1284
+ resolveString: r
1186
1285
  }),
1187
- targetCommandId: s.commandId
1286
+ targetCommandId: o.commandId
1188
1287
  });
1189
- }), o;
1190
- }, Zn = (e) => {
1191
- const {
1192
- createResource: t,
1193
- metadata: r
1194
- } = e;
1195
- return r ? r.routes.map((n) => ({
1196
- resource: t({
1197
- route: n
1198
- })
1199
- })) : [];
1200
- }, Rr = (e) => {
1288
+ }), s;
1289
+ }, Qn = (e) => {
1201
1290
  if (e)
1202
1291
  return {
1203
1292
  type: e.kind,
@@ -1205,7 +1294,7 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1205
1294
  label: e.label,
1206
1295
  metadata: e.metadata
1207
1296
  };
1208
- }, Cr = (e) => ({
1297
+ }, Gn = (e) => ({
1209
1298
  id: e.rendererId,
1210
1299
  kind: "renderer",
1211
1300
  context: {
@@ -1215,8 +1304,8 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1215
1304
  resourceId: e.resource.id
1216
1305
  } : {}
1217
1306
  }
1218
- }), ke = async (e, t, r, n, o = {}, s) => {
1219
- const i = Rr(n), a = await e.executeCommand(r, {
1307
+ }), He = async (e, t, n, r, s = {}, o) => {
1308
+ const i = Qn(r), a = await e.executeCommand(n, {
1220
1309
  projectId: e.projectId,
1221
1310
  params: {
1222
1311
  renderer: {
@@ -1229,235 +1318,279 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1229
1318
  placement: "visible"
1230
1319
  }
1231
1320
  },
1232
- ...o
1321
+ ...s
1233
1322
  },
1234
1323
  resource: i,
1235
- slot: Cr({
1324
+ slot: Gn({
1236
1325
  projectId: e.projectId,
1237
1326
  rendererId: t,
1238
1327
  resource: i
1239
1328
  }),
1240
1329
  source: "dashboard",
1241
- ...s ? {
1242
- metadata: s
1330
+ ...o ? {
1331
+ metadata: o
1243
1332
  } : {}
1244
1333
  });
1245
- return X(a);
1246
- }, Ve = (e) => {
1334
+ return ie(a);
1335
+ }, nt = (e) => {
1247
1336
  if (!e || typeof e != "object") return;
1248
1337
  const t = e.revision;
1249
1338
  return typeof t == "string" ? t : void 0;
1250
- }, eo = (e, t) => {
1251
- const r = e.metadata, n = r?.fileRendererOrigin;
1252
- if (!n || typeof n != "object") return;
1253
- const o = n;
1254
- if (typeof o.rendererId != "string" || typeof o.instanceId != "string" || typeof o.operationId != "string")
1339
+ }, Bo = (e, t) => {
1340
+ const n = e.metadata, r = n?.fileRendererOrigin;
1341
+ if (!r || typeof r != "object") return;
1342
+ const s = r;
1343
+ if (typeof s.rendererId != "string" || typeof s.instanceId != "string" || typeof s.operationId != "string")
1255
1344
  return;
1256
- const s = r?.fileRendererResourceUri, i = Ve(t.outcome.value);
1345
+ const o = n?.fileRendererResourceUri, i = nt(t.outcome.value);
1257
1346
  return {
1258
1347
  origin: {
1259
- rendererId: o.rendererId,
1260
- instanceId: o.instanceId,
1261
- operationId: o.operationId
1348
+ rendererId: s.rendererId,
1349
+ instanceId: s.instanceId,
1350
+ operationId: s.operationId
1262
1351
  },
1263
- ...typeof s == "string" ? {
1264
- resourceUri: s
1352
+ ...typeof o == "string" ? {
1353
+ resourceUri: o
1265
1354
  } : {},
1266
1355
  ...i ? {
1267
1356
  revision: i
1268
1357
  } : {}
1269
1358
  };
1270
- }, Er = (e, t) => e.workbench.renderers.registerFileRenderer({
1359
+ }, Yn = (e, t) => e.workbench.renderers.registerFileRenderer({
1271
1360
  id: t.id,
1272
- title: f(t.title, t.id),
1361
+ title: p(t.title, t.id),
1273
1362
  resourceKind: t.resourceKind,
1274
- load: async (r) => await ke(e, t.id, t.loadHandlerId, r) ?? {},
1275
- save: t.saveHandlerId ? async (r, n, o) => {
1276
- const s = await ke(e, t.id, t.saveHandlerId, r, {
1277
- content: n
1363
+ load: async (n) => await He(e, t.id, t.loadHandlerId, n) ?? {},
1364
+ save: t.saveHandlerId ? async (n, r, s) => {
1365
+ const o = await He(e, t.id, t.saveHandlerId, n, {
1366
+ content: r
1278
1367
  }, {
1279
- ...o ? {
1280
- fileRendererOrigin: o
1368
+ ...s ? {
1369
+ fileRendererOrigin: s
1281
1370
  } : {},
1282
- ...r?.uri ? {
1283
- fileRendererResourceUri: r.uri
1371
+ ...n?.uri ? {
1372
+ fileRendererResourceUri: n.uri
1284
1373
  } : {}
1285
- }), i = Ve(s);
1374
+ }), i = nt(o);
1286
1375
  return i ? {
1287
1376
  revision: i
1288
1377
  } : void 0;
1289
1378
  } : void 0
1290
- }), Pr = (e, t, r, n) => {
1291
- const o = z(t, "file");
1292
- if (o)
1293
- return D({
1379
+ }), Xn = (e, t, n, r) => {
1380
+ const s = ee(t, "file");
1381
+ if (s)
1382
+ return U({
1294
1383
  workbench: e.workbench,
1295
- contribution: O({
1384
+ path: t.path,
1385
+ aliases: t.aliases,
1386
+ resolveInput: F(e.resolveViewInput, t),
1387
+ contribution: N({
1296
1388
  panel: t,
1297
- rendererId: o,
1298
- declarationIndex: r,
1299
- menuDeclarationOffset: n,
1389
+ rendererId: s,
1390
+ declarationIndex: n,
1391
+ menuDeclarationOffset: r,
1300
1392
  resourcePanels: e.metadata.resourcePanels
1301
1393
  })
1302
1394
  });
1303
- }, Ar = (e) => {
1395
+ }, Jn = (e) => {
1304
1396
  const t = [];
1305
- for (const n of e.metadata.fileRenderers ?? [])
1306
- t.push(Er(e, n));
1307
- const r = K(e.metadata.panels);
1308
- return e.metadata.panels.forEach((n, o) => {
1309
- const s = Pr(e, n, o, r[o]);
1310
- s && t.push(s);
1397
+ for (const r of e.metadata.fileRenderers ?? [])
1398
+ t.push(Yn(e, r));
1399
+ const n = L(e.metadata.panels);
1400
+ return e.metadata.panels.forEach((r, s) => {
1401
+ const o = Xn(e, r, s, n[s]);
1402
+ o && t.push(o);
1311
1403
  }), {
1312
1404
  dispose() {
1313
- for (let n = t.length - 1; n >= 0; n -= 1) t[n]?.dispose();
1405
+ for (let r = t.length - 1; r >= 0; r -= 1) t[r]?.dispose();
1314
1406
  }
1315
1407
  };
1316
- }, xr = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Re = (e, t, r, n) => (t ?? []).map((o) => {
1317
- const s = {
1408
+ }, Zn = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Ke = (e, t, n, r, s) => (t ?? []).map((o) => {
1409
+ const i = {
1318
1410
  ...o,
1319
- label: r(o.label, o.id),
1320
- type: o.type.kind === "enum" || o.type.kind === "enum-multi" ? {
1411
+ label: n(o.label, o.id),
1412
+ type: o.type.kind === "status" ? {
1413
+ kind: "enum",
1414
+ options: s(o.type.statuses)
1415
+ } : o.type.kind === "enum" || o.type.kind === "enum-multi" ? {
1321
1416
  ...o.type,
1322
- options: Array.isArray(o.type.options) ? o.type.options.map((i) => ({
1323
- ...i,
1324
- label: r(i.label, i.value)
1417
+ options: Array.isArray(o.type.options) ? o.type.options.map((a) => ({
1418
+ ...a,
1419
+ label: n(a.label, a.value)
1325
1420
  })) : o.type.options
1326
1421
  } : o.type
1327
1422
  };
1328
- return n(e, s);
1329
- }), Tr = (e, t, r, n) => {
1330
- let o = Re(e, t, r, n);
1331
- const s = /* @__PURE__ */ new Set();
1423
+ return r(e, i);
1424
+ }), er = (e, t, n, r, s = () => []) => {
1425
+ let o = Ke(e, t, n, r, s);
1426
+ const i = /* @__PURE__ */ new Set();
1332
1427
  return {
1333
1428
  source: {
1334
1429
  getSnapshot: () => o,
1335
- subscribe: (i) => (s.add(i), () => s.delete(i))
1430
+ subscribe: (a) => (i.add(a), () => i.delete(a))
1336
1431
  },
1337
- set(i) {
1338
- o = Re(e, i, r, n);
1339
- for (const a of s) a();
1432
+ set(a) {
1433
+ o = Ke(e, a, n, r, s);
1434
+ for (const d of i) d();
1340
1435
  }
1341
1436
  };
1342
- }, Wr = (e) => !!(e && typeof e == "object" && typeof e.kind == "string"), jr = (e) => !!(e && typeof e == "object" && typeof e.type == "string" && typeof e.id == "string"), Sr = (e, t) => `pstdio://extension-resource/${encodeURIComponent(e)}/${encodeURIComponent(t)}`, Le = (e, t) => {
1437
+ }, tr = (e) => !!(e && typeof e == "object" && typeof e.kind == "string"), nr = (e) => !!(e && typeof e == "object" && typeof e.type == "string" && typeof e.id == "string"), rr = (e, t) => `pstdio://extension-resource/${encodeURIComponent(e)}/${encodeURIComponent(t)}`, rt = (e, t) => {
1343
1438
  const {
1344
- resource: r
1439
+ resource: n
1345
1440
  } = t;
1346
- if (Wr(r)) return r;
1347
- if (jr(r)) return _(r);
1348
- }, Hr = (e, t) => {
1349
- const r = Le(e, t);
1350
- if (r) return r;
1441
+ if (tr(n)) return n;
1442
+ if (nr(n)) return J(n);
1443
+ }, or = (e, t) => {
1444
+ const n = rt(e, t);
1445
+ if (n) return n;
1351
1446
  if (e.resourceKind)
1352
1447
  return {
1353
1448
  kind: e.resourceKind,
1354
- uri: Sr(e.resourceKind, t.id),
1449
+ uri: rr(e.resourceKind, t.id),
1355
1450
  id: t.id,
1356
1451
  label: t.title
1357
1452
  };
1358
- }, Ce = (e, t) => {
1359
- const r = e, n = t(r);
1360
- return n === void 0 ? r : {
1361
- ...r,
1362
- resource: n
1453
+ }, $e = (e, t) => {
1454
+ const n = e, r = t(n);
1455
+ return r === void 0 ? n : {
1456
+ ...n,
1457
+ resource: r
1363
1458
  };
1364
- }, _e = (...e) => Object.assign({}, ...e.filter((t) => !!t)), Mr = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, Or = (e) => Object.keys(e ?? {}).length > 0, Kr = /* @__PURE__ */ new Set(["text", "longtext", "markdown", "number", "boolean", "select", "multi-select", "files"]), Dr = (e, t, r) => {
1365
- if (!Kr.has(t.type)) return;
1366
- const n = "options" in t && Array.isArray(t.options) ? t.options : [], o = t;
1459
+ }, ot = (...e) => Object.assign({}, ...e.filter((t) => !!t)), sr = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, ir = (e) => Object.keys(e ?? {}).length > 0, ar = /* @__PURE__ */ new Set(["text", "longtext", "markdown", "number", "boolean", "select", "multi-select", "files"]), dr = (e, t, n) => {
1460
+ if (!ar.has(t.type)) return;
1461
+ const r = "options" in t && Array.isArray(t.options) ? t.options : [], s = t;
1367
1462
  return {
1368
1463
  id: e,
1369
- label: r(t.label, e),
1370
- description: t.description === void 0 ? void 0 : r(t.description),
1371
- placeholder: o.placeholder === void 0 ? void 0 : r(o.placeholder),
1464
+ label: n(t.label, e),
1465
+ description: t.description === void 0 ? void 0 : n(t.description),
1466
+ placeholder: s.placeholder === void 0 ? void 0 : n(s.placeholder),
1372
1467
  type: t.type,
1373
1468
  required: t.required === !0,
1374
1469
  defaultValue: t.defaultValue,
1375
- options: t.type === "select" || t.type === "multi-select" ? n.map((s) => ({
1376
- value: s.value,
1377
- label: r(s.label, s.value),
1378
- icon: s.icon
1470
+ options: t.type === "select" || t.type === "multi-select" ? r.map((o) => ({
1471
+ value: o.value,
1472
+ label: n(o.label, o.value),
1473
+ icon: o.icon
1379
1474
  })) : void 0,
1380
- multiple: t.type === "files" ? o.multiple !== !1 : void 0,
1381
- accept: t.type === "files" && typeof o.accept == "string" ? o.accept : void 0
1475
+ multiple: t.type === "files" ? s.multiple !== !1 : void 0,
1476
+ accept: t.type === "files" && typeof s.accept == "string" ? s.accept : void 0
1382
1477
  };
1383
- }, $r = (e, t) => Object.entries(e.createRow?.params ?? {}).flatMap(([r, n]) => {
1384
- const o = Dr(r, n, t);
1385
- return o ? [o] : [];
1386
- }), Fr = (e, t) => M({
1478
+ }, cr = (e, t) => Object.entries(e.createRow?.params ?? {}).flatMap(([n, r]) => {
1479
+ const s = dr(n, r, t);
1480
+ return s ? [s] : [];
1481
+ }), lr = (e, t) => B({
1387
1482
  id: t.id,
1388
1483
  kind: "kanbanRenderer",
1389
1484
  projectId: e.projectId,
1390
1485
  context: {
1391
1486
  kanbanRendererId: t.id
1392
1487
  }
1393
- }), L = (e, t, r, n, o) => {
1394
- const s = o ?? e.workbench.getPrimaryResource();
1395
- return P(e, r, {
1488
+ }), X = (e, t, n, r, s) => {
1489
+ const o = s ?? e.workbench.getPrimaryResource();
1490
+ return P(e, n, {
1396
1491
  params: {
1397
1492
  renderer: {
1398
1493
  rendererId: t.id,
1399
1494
  projectId: e.projectId,
1400
- ...s ? {
1401
- resource: H(s)
1495
+ ...o ? {
1496
+ resource: D(o)
1402
1497
  } : {},
1403
1498
  invocation: {
1404
1499
  placement: "visible"
1405
1500
  }
1406
1501
  },
1407
- ...n
1502
+ ...r
1408
1503
  },
1409
- resource: s,
1410
- slot: Fr(e, t),
1504
+ resource: o,
1505
+ slot: lr(e, t),
1411
1506
  metadata: {
1412
1507
  kanbanRendererId: t.id
1413
1508
  }
1414
1509
  });
1415
- }, qe = (e, t) => `workbench.extension.kanbanRenderer.${e.id}.rowAction.${t.id}`, Br = (e, t, r) => (t.rowActions ?? []).map((n) => {
1416
- const o = e.workbench.commands.getCommand(n.commandId)?.command;
1510
+ }, st = (e, t) => `workbench.extension.kanbanRenderer.${e.id}.rowAction.${t.id}`, ur = (e, t, n) => (t.rowActions ?? []).map((r) => {
1511
+ const s = e.workbench.commands.getCommand(r.commandId)?.command;
1417
1512
  return e.workbench.commands.registerCommand({
1418
- id: qe(t, n),
1419
- label: r(n.label, n.id),
1420
- icon: n.icon,
1421
- params: o?.params
1513
+ id: st(t, r),
1514
+ label: n(r.label, r.id),
1515
+ icon: r.icon,
1516
+ params: s?.params
1422
1517
  }, {
1423
- execute: (s, i) => L(e, t, n.commandId, _e(Mr(s)), i?.resource)
1518
+ execute: (o, i) => X(e, t, r.commandId, ot(sr(o)), i?.resource)
1424
1519
  });
1425
- }), Nr = (e, t, r, n, o, s) => {
1426
- const i = qe(t, r), a = e.workbench.commands.getCommand(i), d = {
1427
- rowId: n.id
1428
- }, m = o ? {
1429
- resource: o
1430
- } : void 0, w = s(r.label, r.id);
1431
- return a && Or(a.command.params) ? (e.workbench.commandPalette.requestParams({
1520
+ }), mr = (e, t, n, r, s, o) => {
1521
+ const i = st(t, n), a = e.workbench.commands.getCommand(i), d = {
1522
+ rowId: r.id
1523
+ }, u = s ? {
1524
+ resource: s
1525
+ } : void 0, w = o(n.label, n.id);
1526
+ return a && ir(a.command.params) ? (e.workbench.commandPalette.requestParams({
1432
1527
  record: a,
1433
1528
  label: w,
1434
1529
  args: d,
1435
- context: m
1436
- }), Promise.resolve()) : a ? e.workbench.commands.executeCommand(a.command.id, d, m).then(() => {
1437
- }) : L(e, t, r.commandId, d, o).then(() => {
1530
+ context: u
1531
+ }), Promise.resolve()) : a ? e.workbench.commands.executeCommand(a.command.id, d, u).then(() => {
1532
+ }) : X(e, t, n.commandId, d, s).then(() => {
1438
1533
  });
1439
- }, Ur = (e) => (r) => U(V, {
1534
+ }, pr = (e) => (n) => K(Y, {
1440
1535
  name: e ?? "MoreHorizontal",
1441
- ...r
1442
- }), Vr = (e, t) => ({
1536
+ ...n
1537
+ }), fr = (e, t) => ({
1443
1538
  color: e?.color,
1444
1539
  canDragIn: e?.canDragIn,
1445
1540
  canDragOut: e?.canDragOut,
1446
1541
  canCreate: e?.canCreate,
1447
- actions: e?.actions?.map((r) => ({
1448
- id: r.id,
1449
- label: t(r.label, r.id),
1450
- icon: Ur(r.icon)
1542
+ actions: e?.actions?.map((n) => ({
1543
+ id: n.id,
1544
+ label: t(n.label, n.id),
1545
+ icon: pr(n.icon)
1451
1546
  }))
1452
- }), Lr = (e) => e ? U(V, {
1547
+ }), it = (e, t) => `${t.extensionId ?? e.extensionId}.status.${t.id}`, br = (e, t) => {
1548
+ const n = /* @__PURE__ */ new Map();
1549
+ return (r) => {
1550
+ const s = it(t, r), o = n.get(s);
1551
+ if (o) return o;
1552
+ const i = {
1553
+ getSnapshot: () => (e.workbench.statuses.getStatuses(s) ?? []).map((a) => ({
1554
+ value: a.id,
1555
+ label: a.label,
1556
+ color: a.color,
1557
+ icon: a.icon
1558
+ })),
1559
+ subscribe: (a) => e.workbench.statuses.store.subscribeSelector((d) => d.values[s], a)
1560
+ };
1561
+ return n.set(s, i), e.workbench.statuses.load(s).catch(() => {
1562
+ }), i;
1563
+ };
1564
+ }, gr = (e, t, n, r) => {
1565
+ for (const s of n ?? []) {
1566
+ if (s.type.kind !== "status") continue;
1567
+ const o = it(t, s.type.statuses), i = e.workbench.statuses.getStatuses(o)?.find((d) => d.id === r);
1568
+ if (!i) continue;
1569
+ const a = e.workbench.statuses.getStatusSet(o);
1570
+ return {
1571
+ color: i.color,
1572
+ canCreate: i.board?.canCreate,
1573
+ canDragIn: i.board?.canDragIn,
1574
+ canDragOut: i.board?.canDragOut,
1575
+ actions: i.board?.actions?.flatMap((d) => {
1576
+ const u = a?.actions?.find((w) => w.id === d);
1577
+ return u ? [{
1578
+ id: u.id,
1579
+ label: u.label,
1580
+ icon: u.icon
1581
+ }] : [];
1582
+ })
1583
+ };
1584
+ }
1585
+ }, hr = (e) => e ? K(Y, {
1453
1586
  name: e,
1454
1587
  size: 16
1455
- }) : void 0, _r = (e, t) => {
1588
+ }) : void 0, wr = (e, t) => {
1456
1589
  if (e.createRow)
1457
1590
  return {
1458
1591
  title: t(e.createRow.title, "Create row"),
1459
1592
  submitLabel: t(e.createRow.submitLabel, "Create"),
1460
- fields: $r(e, t),
1593
+ fields: cr(e, t),
1461
1594
  labels: {
1462
1595
  cancel: t(e.createRow.labels?.cancel, "Cancel"),
1463
1596
  properties: t(e.createRow.labels?.properties, "Properties"),
@@ -1465,69 +1598,72 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1465
1598
  removeFile: t(e.createRow.labels?.removeFile, "Remove file")
1466
1599
  }
1467
1600
  };
1468
- }, qr = (e, t, r, n, o) => {
1601
+ }, Ir = (e, t, n, r, s) => {
1469
1602
  if (t.rowActivationHandlerId)
1470
- return async (s) => {
1471
- const i = n(t, s), a = await L(e, t, t.rowActivationHandlerId, {
1472
- row: o(s)
1473
- }, i), d = Fe(a, {
1474
- resourceOf: r.resolveNavigationResource ? (m) => r.resolveNavigationResource(t, m) : void 0
1603
+ return async (o) => {
1604
+ const i = r(t, o), a = await X(e, t, t.rowActivationHandlerId, {
1605
+ row: s(o)
1606
+ }, i), d = Je(a, {
1607
+ extensionId: t.extensionId,
1608
+ resourceOf: n.resolveNavigationResource ? (u) => n.resolveNavigationResource(t, u) : void 0
1475
1609
  });
1476
1610
  d && await e.workbench.navigation.openTarget(d);
1477
1611
  };
1478
- if (r.onRowClick)
1479
- return (s) => r.onRowClick?.({
1612
+ if (n.onRowClick)
1613
+ return (o) => n.onRowClick?.({
1480
1614
  record: t,
1481
- row: s,
1482
- resource: n(t, s)
1615
+ row: o,
1616
+ resource: r(t, o)
1483
1617
  });
1484
- }, zr = (e, t, r) => {
1485
- const n = e.createRow;
1486
- if (n)
1487
- return async (o) => {
1488
- const s = _e(o.values, n.columnParam ? {
1489
- [n.columnParam]: o.columnId
1490
- } : void 0, n.attributesParam ? {
1491
- [n.attributesParam]: o.attributeValues
1492
- } : void 0), i = await r(e, n.commandId, s);
1618
+ }, yr = (e, t, n) => {
1619
+ const r = e.createRow;
1620
+ if (r)
1621
+ return async (s) => {
1622
+ const o = ot(s.values, r.columnParam ? {
1623
+ [r.columnParam]: s.columnId
1624
+ } : void 0, r.attributesParam ? {
1625
+ [r.attributesParam]: s.attributeValues
1626
+ } : void 0), i = await n(e, r.commandId, o);
1493
1627
  await t.onAfterCreate?.({
1494
1628
  record: e,
1495
1629
  created: i,
1496
- submission: o
1630
+ submission: s
1497
1631
  });
1498
1632
  };
1499
- }, Qr = (e, t, r, n, o) => {
1500
- const s = t.rowActions;
1501
- if (s?.length)
1502
- return (i) => s.map((a) => {
1503
- const d = o(t, i), m = () => Nr(e, t, a, i, d, n);
1633
+ }, vr = (e, t, n, r, s) => {
1634
+ const o = t.rowActions;
1635
+ if (o?.length)
1636
+ return (i) => o.map((a) => {
1637
+ const d = s(t, i), u = () => mr(e, t, a, i, d, r);
1504
1638
  return {
1505
1639
  key: a.id,
1506
- label: n(a.label, a.id),
1640
+ label: r(a.label, a.id),
1507
1641
  commandId: a.commandId,
1508
- icon: Lr(a.icon),
1509
- onClick: () => r.executeRowAction ? r.executeRowAction({
1642
+ icon: hr(a.icon),
1643
+ onClick: () => n.executeRowAction ? n.executeRowAction({
1510
1644
  record: t,
1511
1645
  action: a,
1512
1646
  row: i,
1513
1647
  resource: d,
1514
- runDefault: m
1515
- }) : m()
1648
+ runDefault: u
1649
+ }) : u()
1516
1650
  };
1517
1651
  });
1518
- }, Gr = (e, t, r = {}, n = [], o = []) => {
1519
- const s = [], i = r.resolveLabel ?? ((c, p) => f(c, p)), a = r.decorateAttribute ?? ((c, p) => p), d = r.resolveRowResource ?? Le, m = r.resolveRowActionResource ?? Hr, w = r.onAfterMutation ?? (() => {
1520
- }), l = (c, p, h) => L(e, c, p, h).then((k) => (w(c), k));
1652
+ }, kr = (e, t, n = {}, r = [], s = []) => {
1653
+ const o = [], i = n.resolveLabel ?? ((c, f) => p(c, f)), a = n.decorateAttribute ?? ((c, f) => f), d = n.resolveRowResource ?? rt, u = n.resolveRowActionResource ?? or, w = n.onAfterMutation ?? (() => {
1654
+ }), l = (c, f, h) => X(e, c, f, h).then((C) => (w(c), C));
1521
1655
  for (const c of t) {
1522
- const p = Tr(c, c.attributes, i, a), h = /* @__PURE__ */ new WeakMap();
1523
- let k;
1524
- const $ = (b) => d(c, b), Q = (b) => h.get(b) ?? b;
1525
- s.push(...Br(e, c, i)), s.push(e.workbench.renderers.registerKanbanRenderer({
1656
+ const f = br(e, c), h = er(c, c.attributes, i, a, f);
1657
+ let C = c.attributes;
1658
+ const j = /* @__PURE__ */ new WeakMap();
1659
+ let _;
1660
+ const q = (b) => d(c, b), W = (b) => j.get(b) ?? b;
1661
+ o.push(...ur(e, c, i)), o.push(e.workbench.renderers.registerKanbanRenderer({
1526
1662
  id: c.id,
1527
1663
  title: i(c.title, c.id),
1528
1664
  resourceKind: c.resourceKind,
1529
1665
  storageScope: e.projectId,
1530
- attributes: p.source,
1666
+ attributes: h.source,
1531
1667
  defaultSettings: c.defaultSettings,
1532
1668
  defaultFilters: c.defaultFilters,
1533
1669
  defaultViews: c.defaultViews?.map((b) => ({
@@ -1538,106 +1674,118 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1538
1674
  emptyTitle: i(c.emptyTitle, ""),
1539
1675
  emptyDescription: i(c.emptyDescription, ""),
1540
1676
  hideToolbar: c.hideToolbar,
1541
- createRow: _r(c, i),
1542
- getBoardColumnConfig: (b) => Vr(k?.[b], i),
1543
- onRowActivate: qr(e, c, r, d, Q),
1677
+ createRow: wr(c, i),
1678
+ getBoardColumnConfig: (b) => fr(_?.[b] ?? gr(e, c, C, b), i),
1679
+ onRowActivate: Ir(e, c, n, d, W),
1544
1680
  executeQuery: async (b) => {
1545
- const I = await L(e, c, c.queryHandlerId, {
1681
+ const y = await X(e, c, c.queryHandlerId, {
1546
1682
  settings: b.settings,
1547
1683
  filters: b.filters
1548
1684
  });
1549
- return Array.isArray(I) ? I.map((R) => {
1550
- const E = Ce(R, $);
1551
- return h.set(E, R), E;
1552
- }) : xr(I) ? (p.set(I.attributes), k = I.boardColumnConfigs, (I.rows ?? []).map((R) => {
1553
- const E = Ce(R, $);
1554
- return h.set(E, R), E;
1555
- })) : [];
1685
+ if (Array.isArray(y))
1686
+ return y.map((x) => {
1687
+ const A = $e(x, q);
1688
+ return j.set(A, x), A;
1689
+ });
1690
+ if (!Zn(y)) return [];
1691
+ const E = y.attributes ?? C;
1692
+ if (y.boardColumnConfigs && E?.some((x) => x.type.kind === "status"))
1693
+ throw new Error(`Status-backed Kanban renderer "${c.id}" cannot return boardColumnConfigs`);
1694
+ return C = E, h.set(E), _ = y.boardColumnConfigs, (y.rows ?? []).map((x) => {
1695
+ const A = $e(x, q);
1696
+ return j.set(A, x), A;
1697
+ });
1556
1698
  },
1557
- onAttributeChange: c.attributeChangeHandlerId ? (b, I, R) => l(c, c.attributeChangeHandlerId, {
1699
+ onAttributeChange: c.attributeChangeHandlerId ? (b, y, E) => l(c, c.attributeChangeHandlerId, {
1558
1700
  rowId: b,
1559
- attributeId: I,
1560
- value: R
1701
+ attributeId: y,
1702
+ value: E
1561
1703
  }).then(() => {
1562
1704
  }) : void 0,
1563
- onReorder: c.reorderHandlerId ? (b, I) => l(c, c.reorderHandlerId, {
1705
+ onReorder: c.reorderHandlerId ? (b, y) => l(c, c.reorderHandlerId, {
1564
1706
  rowId: b,
1565
- beforeRowId: I
1707
+ beforeRowId: y
1566
1708
  }).then(() => {
1567
1709
  }) : void 0,
1568
- onCreateRow: zr(c, r, l),
1569
- onColumnAction: c.columnActionHandlerId ? async (b, I) => {
1710
+ onCreateRow: yr(c, n, l),
1711
+ onColumnAction: c.columnActionHandlerId ? async (b, y) => {
1570
1712
  await l(c, c.columnActionHandlerId, {
1571
1713
  columnId: b,
1572
- actionId: I
1714
+ actionId: y
1573
1715
  });
1574
1716
  } : void 0,
1575
- getRowContextMenuActions: Qr(e, c, r, i, m)
1717
+ getRowContextMenuActions: vr(e, c, n, i, u)
1576
1718
  }));
1577
1719
  }
1578
- const u = K(n);
1579
- return n.forEach((c, p) => {
1580
- const h = z(c, "kanban");
1581
- h && s.push(D({
1720
+ const m = L(r);
1721
+ return r.forEach((c, f) => {
1722
+ const h = ee(c, "kanban");
1723
+ h && o.push(U({
1582
1724
  workbench: e.workbench,
1583
- contribution: O({
1725
+ path: c.path,
1726
+ aliases: c.aliases,
1727
+ resolveInput: F(n.resolveViewInput, c),
1728
+ contribution: N({
1584
1729
  panel: c,
1585
1730
  rendererId: h,
1586
- declarationIndex: p,
1587
- menuDeclarationOffset: u[p],
1588
- resourcePanels: o
1731
+ declarationIndex: f,
1732
+ menuDeclarationOffset: m[f],
1733
+ resourcePanels: s
1589
1734
  })
1590
1735
  }));
1591
1736
  }), {
1592
1737
  dispose() {
1593
- for (let c = s.length - 1; c >= 0; c -= 1) s[c]?.dispose();
1738
+ for (let c = o.length - 1; c >= 0; c -= 1) o[c]?.dispose();
1594
1739
  }
1595
1740
  };
1596
- }, Yr = (e, t) => {
1741
+ }, Rr = (e, t) => {
1597
1742
  if (e)
1598
- return Object.fromEntries(Object.entries(e).map(([r, n]) => [r, {
1599
- ...n,
1600
- label: n.label === void 0 ? void 0 : t(n.label, r),
1601
- description: n.description === void 0 ? void 0 : t(n.description)
1743
+ return Object.fromEntries(Object.entries(e).map(([n, r]) => [n, {
1744
+ ...r,
1745
+ label: r.label === void 0 ? void 0 : t(r.label, n),
1746
+ description: r.description === void 0 ? void 0 : t(r.description)
1602
1747
  }]));
1603
- }, Xr = (e, t) => e.panels.flatMap((r) => [r, ...r.panelMenus ?? []]).filter((r) => r.renderer?.kind === "tree" && r.renderer.id === t.id), ze = (e, t) => t.viewId ? e.find((r) => r.id === t.viewId) : e.length === 1 ? e[0] : void 0, Jr = async (e) => {
1748
+ }, Cr = (e, t) => e.panels.flatMap((n) => [n, ...n.panelMenus ?? []]).filter((n) => n.renderer?.kind === "tree" && n.renderer.id === t.id), at = (e, t) => t.viewId ? e.find((n) => n.id === t.viewId) : e.length === 1 ? e[0] : void 0, xr = async (e) => {
1604
1749
  const {
1605
1750
  ctx: t,
1606
- getHostTreeHeaderNodes: r,
1607
- record: n,
1608
- treeViews: o
1609
- } = e, s = ze(o, t);
1610
- return !s || !("hostTreeHeader" in s) || s.hostTreeHeader !== "default" ? [] : await r?.({
1751
+ getHostTreeHeaderNodes: n,
1752
+ record: r,
1753
+ treeViews: s
1754
+ } = e, o = at(s, t);
1755
+ return !o || !("hostTreeHeader" in o) || o.hostTreeHeader !== "default" ? [] : await n?.({
1611
1756
  ctx: t,
1612
- record: n,
1613
- panel: s
1757
+ record: r,
1758
+ panel: o
1614
1759
  }) ?? [];
1615
- }, Zr = async (e) => {
1760
+ }, Er = async (e) => {
1616
1761
  const {
1617
1762
  ctx: t,
1618
- getHostTreeFooterNodes: r,
1619
- record: n,
1620
- treeViews: o
1621
- } = e, s = ze(o, t);
1622
- return !s || !("hostTreeFooter" in s) || s.hostTreeFooter !== "default" ? [] : await r?.({
1763
+ getHostTreeFooterNodes: n,
1764
+ record: r,
1765
+ treeViews: s
1766
+ } = e, o = at(s, t);
1767
+ return !o || !("hostTreeFooter" in o) || o.hostTreeFooter !== "default" ? [] : await n?.({
1623
1768
  ctx: t,
1624
- record: n,
1625
- panel: s
1769
+ record: r,
1770
+ panel: o
1626
1771
  }) ?? [];
1627
- }, en = (e, t, r, n) => {
1628
- const o = z(t, "tree");
1629
- if (o)
1630
- return D({
1772
+ }, Pr = (e, t, n, r) => {
1773
+ const s = ee(t, "tree");
1774
+ if (s)
1775
+ return U({
1631
1776
  workbench: e.workbench,
1632
- contribution: O({
1777
+ path: t.path,
1778
+ aliases: t.aliases,
1779
+ resolveInput: F(e.resolveViewInput, t),
1780
+ contribution: N({
1633
1781
  panel: t,
1634
- rendererId: o,
1635
- declarationIndex: r,
1636
- menuDeclarationOffset: n,
1782
+ rendererId: s,
1783
+ declarationIndex: n,
1784
+ menuDeclarationOffset: r,
1637
1785
  resourcePanels: e.resourcePanels
1638
1786
  })
1639
1787
  });
1640
- }, ie = (e) => {
1788
+ }, ge = (e) => {
1641
1789
  if (e)
1642
1790
  return {
1643
1791
  type: e.kind,
@@ -1645,16 +1793,16 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1645
1793
  label: e.label,
1646
1794
  metadata: e.metadata
1647
1795
  };
1648
- }, tn = (e) => typeof e == "string" ? e : e?.id, rn = (e, t) => ({
1796
+ }, Ar = (e, t) => ({
1649
1797
  kind: e.type,
1650
1798
  uri: `pstdio://extension-resource/${encodeURIComponent(e.type)}/${encodeURIComponent(e.id)}`,
1651
1799
  id: e.id,
1652
1800
  label: e.label,
1653
1801
  metadata: t ? {
1654
1802
  ...e.metadata,
1655
- [ae]: t
1803
+ [we]: t
1656
1804
  } : e.metadata
1657
- }), Qe = (e) => ({
1805
+ }), dt = (e) => ({
1658
1806
  id: e.treeId,
1659
1807
  kind: "renderer",
1660
1808
  context: {
@@ -1668,68 +1816,68 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1668
1816
  resourceId: e.resource.id
1669
1817
  } : {}
1670
1818
  }
1671
- }), oe = (e, t, r, n) => {
1672
- const o = ie(r.resource), s = e.workbench.modes.getActiveModeId();
1819
+ }), fe = (e, t, n, r) => {
1820
+ const s = ge(n.resource), o = e.workbench.modes.getActiveModeId();
1673
1821
  return {
1674
1822
  renderer: {
1675
1823
  rendererId: t.id,
1676
1824
  projectId: e.projectId,
1677
- ...s ? {
1678
- modeId: s
1679
- } : {},
1680
1825
  ...o ? {
1681
- resource: o
1826
+ modeId: o
1827
+ } : {},
1828
+ ...s ? {
1829
+ resource: s
1682
1830
  } : {},
1683
1831
  invocation: {
1684
1832
  placement: "visible"
1685
1833
  }
1686
1834
  },
1687
1835
  state: e.workbench.renderers.getTreeState(t.id),
1688
- ...r.filter ? {
1689
- filter: r.filter
1836
+ ...n.filter ? {
1837
+ filter: n.filter
1690
1838
  } : {},
1691
- ...n ? {
1692
- node: n
1839
+ ...r ? {
1840
+ node: r
1693
1841
  } : {}
1694
1842
  };
1695
- }, se = async (e, t, r, n) => {
1696
- const o = n.renderer, s = o?.resource, i = await e.executeCommand(r, {
1843
+ }, be = async (e, t, n, r) => {
1844
+ const s = r.renderer, o = s?.resource, i = await e.executeCommand(n, {
1697
1845
  projectId: e.projectId,
1698
- params: n,
1699
- resource: s,
1700
- slot: Qe({
1701
- modeId: o?.modeId,
1846
+ params: r,
1847
+ resource: o,
1848
+ slot: dt({
1849
+ modeId: s?.modeId,
1702
1850
  projectId: e.projectId,
1703
- resource: s,
1851
+ resource: o,
1704
1852
  treeId: t.id
1705
1853
  }),
1706
1854
  source: "dashboard"
1707
1855
  });
1708
- return X(i);
1709
- }, Ge = async (e, t, r, n, o) => {
1710
- const s = e.workbench.modes.getActiveModeId(), i = {
1711
- ...n ?? {},
1856
+ return ie(i);
1857
+ }, ct = async (e, t, n, r, s) => {
1858
+ const o = e.workbench.modes.getActiveModeId(), i = {
1859
+ ...r ?? {},
1712
1860
  renderer: {
1713
1861
  rendererId: t.id,
1714
1862
  projectId: e.projectId,
1715
- ...s ? {
1716
- modeId: s
1717
- } : {},
1718
1863
  ...o ? {
1719
- resource: o
1864
+ modeId: o
1865
+ } : {},
1866
+ ...s ? {
1867
+ resource: s
1720
1868
  } : {},
1721
1869
  invocation: {
1722
1870
  placement: "visible"
1723
1871
  }
1724
1872
  }
1725
- }, a = await e.executeCommand(r, {
1873
+ }, a = await e.executeCommand(n, {
1726
1874
  projectId: e.projectId,
1727
1875
  params: i,
1728
- resource: o,
1729
- slot: Qe({
1730
- modeId: s,
1876
+ resource: s,
1877
+ slot: dt({
1878
+ modeId: o,
1731
1879
  projectId: e.projectId,
1732
- resource: o,
1880
+ resource: s,
1733
1881
  treeId: t.id
1734
1882
  }),
1735
1883
  source: "dashboard",
@@ -1737,754 +1885,979 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1737
1885
  treeId: t.id
1738
1886
  }
1739
1887
  });
1740
- return X(a);
1741
- }, nn = (e, t) => e && typeof e == "object" && !Array.isArray(e) ? e : t, Ee = (e) => e && !Array.isArray(e) ? e : void 0, on = (e, t) => {
1742
- const r = /* @__PURE__ */ new WeakMap(), n = `workbench.extensionTreeRenderer.${t.id}.command`, o = (l, u) => {
1888
+ return ie(a);
1889
+ }, Sr = (e, t) => e && typeof e == "object" && !Array.isArray(e) ? e : t, Ve = (e) => e && !Array.isArray(e) ? e : void 0, Tr = (e, t) => {
1890
+ const n = /* @__PURE__ */ new WeakMap(), r = `workbench.extensionTreeRenderer.${t.id}.command`, s = (l, m) => {
1743
1891
  const c = e.resolveNodeResource?.(l);
1744
- return c ? u ? {
1892
+ return c ? m ? {
1745
1893
  ...c,
1746
1894
  metadata: {
1747
1895
  ...c.metadata,
1748
- [ae]: u
1896
+ [we]: m
1749
1897
  }
1750
- } : c : rn(l, u);
1751
- }, s = (l) => {
1898
+ } : c : Ar(l, m);
1899
+ }, o = (l) => {
1752
1900
  if (l.emptyState)
1753
1901
  return {
1754
- title: f(l.emptyState.title),
1755
- description: f(l.emptyState.description),
1902
+ title: p(l.emptyState.title),
1903
+ description: p(l.emptyState.description),
1756
1904
  icon: l.emptyState.icon
1757
1905
  };
1758
- }, i = (l, u, c) => l ? J(l, {
1906
+ }, i = (l, m, c) => l ? Z(l, {
1759
1907
  commandTargetOf: (h) => ({
1760
1908
  kind: "command",
1761
- commandId: n,
1909
+ commandId: r,
1762
1910
  args: {
1763
- commandId: typeof h.command == "string" ? h.command : h.command.id,
1764
- nodeId: u.id,
1765
- params: h.params,
1766
- resource: u.resource ?? ie(c.resource),
1911
+ commandId: `${h.target.command.extensionId ?? t.extensionId}.command.${h.target.command.id}`,
1912
+ nodeId: m.id,
1913
+ params: h.target.params,
1914
+ resource: m.resource ?? ge(c.resource),
1767
1915
  treeId: t.id
1768
1916
  }
1769
1917
  }),
1770
- resourceOf: (h, k) => o(h, k.section ? {
1918
+ extensionId: t.extensionId,
1919
+ resourceOf: (h, C) => s(h, C.section ? {
1771
1920
  treeId: t.id,
1772
- targetNodeId: u.id,
1773
- anchors: k.section.anchors
1921
+ targetNodeId: m.id,
1922
+ anchors: C.section.anchors
1774
1923
  } : void 0)
1775
- }) : void 0, a = (l, u, c) => {
1776
- const p = tn(l.command);
1924
+ }) : void 0, a = (l, m, c) => {
1925
+ const f = l.command ? `${l.command.extensionId ?? t.extensionId}.command.${l.command.id}` : void 0;
1777
1926
  return {
1778
1927
  id: l.id,
1779
- label: f(l.label),
1928
+ label: p(l.label),
1780
1929
  icon: l.icon,
1781
- args: Ee(l.params),
1782
- params: Yr(l.input, f),
1930
+ args: Ve(l.params),
1931
+ params: Rr(l.input, p),
1783
1932
  submitLabel: l.submitLabel,
1784
1933
  when: l.when,
1785
1934
  disabled: l.disabled,
1786
1935
  // Actions mutate tree data (create/delete/...), so refresh afterwards. Plain
1787
1936
  // node-target navigation runs through the runner command and must not refetch.
1788
- run: p ? async (h) => {
1789
- await Ge(e, t, p, nn(h, Ee(l.params)), u?.resource ?? ie(c.resource)), e.workbench.renderers.refresh(t.id);
1937
+ run: f ? async (h) => {
1938
+ await ct(e, t, f, Sr(h, Ve(l.params)), m?.resource ?? ge(c.resource)), e.workbench.renderers.refresh(t.id);
1790
1939
  } : void 0
1791
1940
  };
1792
- }, d = (l, u) => {
1941
+ }, d = (l, m) => {
1793
1942
  const c = {
1794
1943
  id: l.id,
1795
- label: f(l.label),
1944
+ label: p(l.label),
1796
1945
  icon: l.icon,
1797
1946
  iconColor: l.iconColor,
1798
1947
  iconTooltip: l.iconTooltip,
1799
- resource: l.resource ? o(l.resource) : void 0,
1800
- target: i(l.target, l, u),
1948
+ resource: l.resource ? s(l.resource) : void 0,
1949
+ target: i(l.target, l, m),
1801
1950
  rowVariant: l.rowVariant,
1802
- actions: l.actions?.map((p) => a(p, l, u)),
1803
- contextMenuActions: l.contextMenuActions?.map((p) => a(p, l, u)),
1951
+ actions: l.actions?.map((f) => a(f, l, m)),
1952
+ contextMenuActions: l.contextMenuActions?.map((f) => a(f, l, m)),
1804
1953
  collapsible: l.collapsible,
1805
1954
  disabled: l.disabled,
1806
- children: l.children?.map((p) => d(p, u)),
1955
+ children: l.children?.map((f) => d(f, m)),
1807
1956
  description: l.description,
1808
1957
  contextValue: l.contextValue,
1809
1958
  hiddenByDefault: l.hiddenByDefault,
1810
1959
  canHide: l.canHide
1811
1960
  };
1812
- return r.set(c, l), c;
1961
+ return n.set(c, l), c;
1813
1962
  };
1814
1963
  return {
1815
- mapNodes: (l, u) => l.map((c) => d(c, u)),
1816
- mapSections: (l, u) => l.map((c) => ({
1964
+ mapNodes: (l, m) => l.map((c) => d(c, m)),
1965
+ mapSections: (l, m) => l.map((c) => ({
1817
1966
  id: c.id,
1818
- label: f(c.label),
1819
- actions: c.actions?.map((p) => a(p, void 0, u)),
1967
+ label: p(c.label),
1968
+ actions: c.actions?.map((f) => a(f, void 0, m)),
1820
1969
  collapsible: c.collapsible,
1821
- emptyState: s(c),
1822
- nodes: c.nodes.map((p) => d(p, u)),
1970
+ emptyState: o(c),
1971
+ nodes: c.nodes.map((f) => d(f, m)),
1823
1972
  hiddenByDefault: c.hiddenByDefault,
1824
1973
  canHide: c.canHide
1825
1974
  })),
1826
- originalNodes: r,
1827
- runnerCommandId: n
1975
+ originalNodes: n,
1976
+ runnerCommandId: r
1828
1977
  };
1829
- }, sn = (e) => Array.isArray(e) && e.every((t) => t && typeof t == "object" && "nodes" in t), Pe = (e) => Array.isArray(e) && e.every((t) => t && typeof t == "object" && "id" in t), Ye = (e) => {
1978
+ }, jr = (e) => Array.isArray(e) && e.every((t) => t && typeof t == "object" && "nodes" in t), De = (e) => Array.isArray(e) && e.every((t) => t && typeof t == "object" && "id" in t), lt = (e) => {
1830
1979
  for (const t of e) {
1831
1980
  if (t.selected) return t.id;
1832
- const r = Ye(t.children ?? []);
1833
- if (r) return r;
1981
+ const n = lt(t.children ?? []);
1982
+ if (n) return n;
1834
1983
  }
1835
- }, an = (e) => {
1984
+ }, Wr = (e) => {
1836
1985
  for (const t of e) {
1837
- const r = Ye(t.nodes);
1838
- if (r) return r;
1986
+ const n = lt(t.nodes);
1987
+ if (n) return n;
1839
1988
  }
1840
- }, dn = (e, t) => {
1841
- const r = on(e, t), n = Xr(e.metadata, t), o = e.workbench.commands.registerCommand({
1842
- id: r.runnerCommandId,
1843
- label: `${f(t.title, t.id)} tree command`
1989
+ }, Mr = (e, t) => {
1990
+ const n = Tr(e, t), r = Cr(e.metadata, t), s = e.workbench.commands.registerCommand({
1991
+ id: n.runnerCommandId,
1992
+ label: `${p(t.title, t.id)} tree command`
1844
1993
  }, {
1845
1994
  execute: async (i) => {
1846
1995
  const a = i;
1847
1996
  a.nodeId && e.workbench.renderers.setSelectedNode(t.id, a.nodeId);
1848
- const d = await Ge(e, t, a.commandId, a.params, a.resource);
1849
- for (const m of e.workbench.renderers.listFileRenderers())
1850
- e.workbench.renderers.refreshFileRenderer(m.id);
1997
+ const d = await ct(e, t, a.commandId, a.params, a.resource);
1998
+ for (const u of e.workbench.renderers.listFileRenderers())
1999
+ e.workbench.renderers.refreshFileRenderer(u.id);
1851
2000
  return d;
1852
2001
  }
1853
- }), s = e.workbench.renderers.registerTreeRenderer({
2002
+ }), o = e.workbench.renderers.registerTreeRenderer({
1854
2003
  id: t.id,
1855
- title: f(t.title, t.id),
2004
+ title: p(t.title, t.id),
1856
2005
  icon: t.icon,
1857
2006
  searchable: t.searchable,
1858
- searchPlaceholder: f(t.searchPlaceholder, "Search files"),
2007
+ searchPlaceholder: p(t.searchPlaceholder, "Search files"),
1859
2008
  defaultExpandedNodeIds: t.defaultExpandedNodeIds,
1860
2009
  defaultExpandedSectionIds: t.defaultExpandedSectionIds,
1861
- getHeader: (i) => Jr({
2010
+ getHeader: (i) => xr({
1862
2011
  ctx: i,
1863
2012
  getHostTreeHeaderNodes: e.getHostTreeHeaderNodes,
1864
2013
  record: t,
1865
- treeViews: n
2014
+ treeViews: r
1866
2015
  }),
1867
2016
  getBody: async (i) => {
1868
- const a = await se(e, t, t.bodyHandlerId, oe(e, t, i));
1869
- if (!sn(a)) return [];
1870
- const d = an(a);
1871
- return d && e.workbench.renderers.setSelectedNode(t.id, d), r.mapSections(a, i);
2017
+ const a = await be(e, t, t.bodyHandlerId, fe(e, t, i));
2018
+ if (!jr(a)) return [];
2019
+ const d = Wr(a);
2020
+ return d && e.workbench.renderers.setSelectedNode(t.id, d), n.mapSections(a, i);
1872
2021
  },
1873
2022
  getFooter: async (i) => {
1874
- const a = await Zr({
2023
+ const a = await Er({
1875
2024
  ctx: i,
1876
2025
  getHostTreeFooterNodes: e.getHostTreeFooterNodes,
1877
2026
  record: t,
1878
- treeViews: n
2027
+ treeViews: r
1879
2028
  });
1880
2029
  if (!t.footerHandlerId) return a;
1881
- const d = await se(e, t, t.footerHandlerId, oe(e, t, i));
1882
- return [...Pe(d) ? r.mapNodes(d, i) : [], ...a];
2030
+ const d = await be(e, t, t.footerHandlerId, fe(e, t, i));
2031
+ return [...De(d) ? n.mapNodes(d, i) : [], ...a];
1883
2032
  },
1884
2033
  getChildren: async (i, a) => {
1885
2034
  if (!t.childrenHandlerId) return i.children ?? [];
1886
- const d = r.originalNodes.get(i) ?? i, m = await se(e, t, t.childrenHandlerId, oe(e, t, a, d));
1887
- return Pe(m) ? r.mapNodes(m, a) : [];
2035
+ const d = n.originalNodes.get(i) ?? i, u = await be(e, t, t.childrenHandlerId, fe(e, t, a, d));
2036
+ return De(u) ? n.mapNodes(u, a) : [];
1888
2037
  }
1889
2038
  });
1890
2039
  return {
1891
2040
  dispose() {
1892
- s.dispose(), o.dispose();
2041
+ o.dispose(), s.dispose();
1893
2042
  }
1894
2043
  };
1895
- }, cn = (e) => {
2044
+ }, Or = (e) => {
1896
2045
  const t = [];
1897
- for (const n of e.metadata.treeRenderers ?? [])
1898
- t.push(dn(e, n));
1899
- const r = K(e.metadata.panels);
1900
- return e.metadata.panels.forEach((n, o) => {
1901
- const s = en({
2046
+ for (const r of e.metadata.treeRenderers ?? [])
2047
+ t.push(Mr(e, r));
2048
+ const n = L(e.metadata.panels);
2049
+ return e.metadata.panels.forEach((r, s) => {
2050
+ const o = Pr({
1902
2051
  workbench: e.workbench,
1903
- resourcePanels: e.metadata.resourcePanels
1904
- }, n, o, r[o]);
1905
- s && t.push(s);
2052
+ resourcePanels: e.metadata.resourcePanels,
2053
+ resolveViewInput: e.resolveViewInput
2054
+ }, r, s, n[s]);
2055
+ o && t.push(o);
1906
2056
  }), {
1907
2057
  dispose() {
1908
- for (let n = t.length - 1; n >= 0; n -= 1) t[n]?.dispose();
2058
+ for (let r = t.length - 1; r >= 0; r -= 1) t[r]?.dispose();
1909
2059
  }
1910
2060
  };
1911
- }, ln = (e) => (t) => ({
1912
- ...Oe({
1913
- workbench: t.workbench,
1914
- hostEvents: t.hostEvents
1915
- }),
1916
- // Extension guests speak the SDK resource shape (`type`); normalize to the
1917
- // workbench shape (`kind` + synthesized uri) the resource registry expects,
1918
- // mirroring how commands.execute and tree targets normalize their resources.
1919
- "resource.open": (n) => {
1920
- const o = n;
1921
- if (!o.resource) throw new Error("resource.open requires a resource.");
1922
- return t.workbench.resources.openResource(_(o.resource), Me(o.input));
1923
- },
1924
- "commands.execute": async (n) => {
1925
- const o = n, s = o.resource ?? H(t.placement.resource);
1926
- return e.executeCommand(o.commandId, {
1927
- projectId: e.projectId,
1928
- ...o.params ? {
1929
- params: o.params
1930
- } : {},
1931
- ...s ? {
1932
- resource: s
1933
- } : {},
1934
- slot: M({
1935
- id: t.webviewId,
1936
- kind: e.slotKind,
1937
- projectId: e.projectId,
1938
- context: {
1939
- panelId: t.webviewId
1940
- }
1941
- }),
1942
- source: "dashboard"
1943
- });
1944
- },
1945
- ...e.files ? {
1946
- "files.upload": e.files.upload,
1947
- "files.list": e.files.list,
1948
- "files.delete": e.files.delete
1949
- } : {}
1950
- }), Xe = (e, t) => ({
1951
- kind: t,
1952
- uri: `workbench://extension-route/${encodeURIComponent(e.id)}`,
2061
+ }, Hr = (e) => e.includes("main.right") ? "secondary" : (e.includes("main.left"), "sidenav"), Kr = (e, t) => (e.order ?? 0) - (t.order ?? 0) || e.id.localeCompare(t.id), $r = (e) => ({
1953
2062
  id: e.id,
1954
- label: f(e.label, e.id),
1955
- metadata: {
1956
- extensionId: e.extensionId,
1957
- extensionRouteId: e.id,
1958
- path: e.path
1959
- }
1960
- }), Ae = (e, t) => e.routes.find((r) => t.id === r.id || t.metadata?.extensionRouteId === r.id), mn = (e) => {
1961
- if (e.metadata.routes.length === 0) return [];
1962
- const t = [];
1963
- e.workbench.resources.getKind(e.routeResourceKind) || t.push(e.workbench.resources.registerKind({
1964
- kind: e.routeResourceKind,
1965
- label: "Extension route",
1966
- icon: "Component"
1967
- }));
1968
- for (const r of e.metadata.routes)
1969
- t.push(e.workbench.layout.registerPanel({
1970
- id: r.id,
1971
- title: f(r.label, r.id),
1972
- region: "main",
1973
- rendererId: S,
1974
- singleton: !0,
1975
- config: q(r.webview)
1976
- }));
1977
- return t.push(e.workbench.resources.registerProvider({
1978
- id: "workbench.extension.routes",
1979
- kind: e.routeResourceKind,
1980
- list: () => e.metadata.routes.map((r) => ({
1981
- resource: Xe(r, e.routeResourceKind)
1982
- }))
1983
- }), e.workbench.resources.registerPresenter({
1984
- id: "workbench.extension.routes",
1985
- canOpen: (r) => r.kind === e.routeResourceKind && !!Ae(e.metadata, r),
1986
- open: (r, n) => {
1987
- const o = Ae(e.metadata, r);
1988
- return e.workbench.layout.openPanel(o.id, {
1989
- strategy: n.replaceActive ? {
1990
- kind: "replace-active"
1991
- } : {
1992
- kind: "persistent"
1993
- },
1994
- title: f(o.label, o.id)
1995
- });
1996
- }
1997
- })), t;
1998
- }, un = {
1999
- "workbench.left.tree": "sidenav",
2000
- "workbench.main.left.tree": "main-left-menu",
2001
- "workbench.main.right.tree": "main-right-menu"
2002
- }, fn = (e) => e ? un[e] ?? "sidenav" : "sidenav", pn = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, bn = (e, t) => {
2003
- if (t.action.kind === "panel") return {
2004
- kind: "panel",
2005
- panelId: t.action.panelId
2006
- };
2007
- const r = t.action;
2008
- if (r.kind === "route") {
2009
- const n = e.metadata.routes.find((o) => o.id === r.route);
2010
- return n ? {
2011
- kind: "resource",
2012
- resource: Xe(n, e.routeResourceKind)
2013
- } : void 0;
2063
+ label: p(e.label, e.id),
2064
+ icon: e.icon,
2065
+ target: Z(e.action, {
2066
+ extensionId: e.extensionId
2067
+ })
2068
+ }), Vr = (e) => {
2069
+ const t = /* @__PURE__ */ new Map();
2070
+ for (const n of e) {
2071
+ const r = n.group ?? "Extensions";
2072
+ t.set(r, [...t.get(r) ?? [], n]);
2014
2073
  }
2015
- return r.kind === "command" ? {
2016
- kind: "command",
2017
- commandId: r.commandId,
2018
- args: r.args
2019
- } : r.kind === "resource" ? {
2020
- kind: "resource",
2021
- resource: {
2022
- kind: r.resource.type,
2023
- uri: `pstdio://extension-resource/${encodeURIComponent(r.resource.type)}/${encodeURIComponent(r.resource.id)}`,
2024
- id: r.resource.id,
2025
- label: r.resource.label ?? f(t.label, t.id),
2026
- icon: t.icon,
2027
- metadata: r.resource.metadata
2028
- }
2029
- } : {
2030
- kind: "command",
2031
- commandId: `workbench.extension.href.${t.id}`,
2032
- args: {
2033
- href: r.href
2034
- }
2035
- };
2036
- }, hn = (e) => {
2037
- const t = e.metadata.treeItems ?? [];
2038
- if (t.length === 0) return [];
2039
- const r = [], n = /* @__PURE__ */ new Map();
2040
- for (const o of t) n.set(o.target, [...n.get(o.target) ?? [], o]);
2041
- for (const [o, s] of n) {
2042
- const i = `workbench.extension.treeItems.${o}`;
2043
- r.push(e.workbench.renderers.registerTreeRenderer({
2044
- id: i,
2074
+ return t;
2075
+ }, Dr = (e) => {
2076
+ if (e.metadata.navigationItems.length === 0) return [];
2077
+ const t = [], n = /* @__PURE__ */ new Map();
2078
+ for (const r of e.metadata.navigationItems)
2079
+ n.set(r.slot.id, [...n.get(r.slot.id) ?? [], r]);
2080
+ for (const [r, s] of n) {
2081
+ const o = `workbench.extension.navigation.${r}`, i = Vr([...s].sort(Kr));
2082
+ t.push(e.workbench.renderers.registerTreeRenderer({
2083
+ id: o,
2045
2084
  title: "Extensions",
2046
2085
  getChildren: (a) => a.children ?? [],
2047
- getBody: () => [{
2048
- id: "extensions",
2049
- label: "Extensions",
2050
- nodes: s.map((a) => ({
2051
- id: a.id,
2052
- label: f(a.label, a.id),
2053
- icon: a.icon,
2054
- target: bn(e, a)
2055
- }))
2056
- }]
2086
+ getBody: () => [...i].map(([a, d]) => ({
2087
+ id: a,
2088
+ label: a,
2089
+ nodes: d.map($r)
2090
+ }))
2057
2091
  }), e.workbench.layout.registerPanel({
2058
- id: i,
2092
+ id: o,
2059
2093
  title: "Extensions",
2060
- region: fn(o),
2061
- rendererId: i,
2094
+ region: Hr(r),
2095
+ rendererId: o,
2062
2096
  singleton: !0
2063
2097
  }));
2064
2098
  }
2065
- for (const o of t.filter((s) => s.action.kind === "href")) {
2066
- const s = o.action;
2067
- s.kind === "href" && r.push(e.workbench.commands.registerCommand({
2068
- id: `workbench.extension.href.${o.id}`,
2069
- label: f(o.label, o.id)
2070
- }, {
2071
- execute: (i) => e.openHref?.(pn(i)?.href ?? s.href)
2072
- }));
2073
- }
2074
- return r;
2075
- }, xe = "extension-route", gn = "extensions", wn = (e) => {
2076
- for (let t = e.length - 1; t >= 0; t -= 1) e[t]?.dispose();
2077
- }, le = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, In = (e) => e === void 0 ? void 0 : e, yn = (e) => e === "global" ? "user" : "project", vn = (e, t) => t ? (r) => ({
2078
- ...e(r),
2079
- ...t(r)
2080
- }) : e, Je = (e, t) => {
2081
- const r = e.createWebviewHostCapabilities ?? ln({
2082
- executeCommand: e.executeCommand,
2083
- files: e.webviewFiles,
2084
- projectId: e.projectId,
2085
- slotKind: t
2086
- });
2087
- return vn(r, e.createWebviewHostCapabilityOverrides);
2088
- }, kn = (e, t) => {
2089
- e.workbench.renderers.getRenderer(S) || t.push(e.workbench.renderers.registerRenderer(Ht({
2090
- createHostCapabilities: Je(e, "panel"),
2091
- createProps: e.createWebviewProps,
2092
- createTheme: e.createWebviewTheme
2093
- })));
2094
- }, Rn = (e, t) => t.commands.map((r) => e.workbench.commands.registerCommand({
2095
- id: r.id,
2096
- label: f(r.title, r.id),
2097
- description: f(r.description),
2098
- params: r.params
2099
- }, {
2100
- execute: (n, o) => P(e, r.id, {
2101
- params: le(n),
2102
- resource: o?.resource
2103
- })
2104
- })), Ze = (e, t) => t?.resource ?? e.workbench.getPrimaryResource(), Cn = (e, t) => e.menuSlotsById ? vr({
2105
- metadata: e.metadata,
2106
- menuSlotsById: e.menuSlotsById,
2107
- menuTargetsById: e.menuTargetsById,
2108
- createWhenExpression: e.createMenuWhenExpression
2109
- }).flatMap((n) => [e.workbench.commands.registerCommand(n.command, {
2110
- execute: (o, s) => P(t, n.targetCommandId, {
2111
- params: {
2112
- ...n.contribution.params ?? {},
2113
- ...le(o) ?? {}
2114
- },
2115
- resource: Ze(e, s),
2116
- slot: M({
2117
- id: n.contribution.slotId,
2118
- kind: "menu",
2119
- projectId: e.projectId,
2120
- context: {
2121
- panelId: n.contribution.id
2122
- }
2123
- })
2124
- })
2125
- }), e.workbench.layout.registerMenuItem(n.menuPath, n.menuItem)]) : [], En = (e, t) => kr({
2126
- metadata: e.metadata
2127
- }).flatMap((n) => [e.workbench.commands.registerCommand(n.command, {
2128
- execute: (o, s) => P(t, n.targetCommandId, {
2129
- params: {
2130
- ...n.contribution.params ?? {},
2131
- ...le(o) ?? {}
2132
- },
2133
- resource: Ze(e, s),
2134
- slot: M({
2135
- id: "workbench.commandPalette",
2136
- kind: "menu",
2137
- projectId: e.projectId,
2138
- context: {
2139
- panelId: n.contribution.id
2140
- }
2141
- })
2142
- }),
2143
- isVisible: () => at(n.contribution.when, e.workbench.getPrimaryResource()?.kind)
2144
- }), e.workbench.layout.registerMenuItem(st, n.menuItem)]), Pn = (e) => {
2145
- const t = K(e.metadata.panels);
2146
- return e.metadata.panels.flatMap((r, n) => r.webview ? [D({
2147
- workbench: e.workbench,
2148
- contribution: O({
2149
- panel: r,
2150
- rendererId: S,
2151
- declarationIndex: n,
2152
- menuDeclarationOffset: t[n],
2153
- resourcePanels: e.metadata.resourcePanels,
2154
- config: q(r.webview)
2155
- })
2156
- })] : []);
2157
- }, An = (e) => {
2158
- const t = [];
2159
- for (const [r, n] of (e.metadata.statusItems ?? []).entries()) {
2160
- if (!n.webview) continue;
2161
- t.push(e.workbench.layout.registerWidget({
2162
- id: n.id,
2163
- title: f(n.title, n.id),
2164
- region: "status",
2165
- rendererId: S,
2166
- closable: !1,
2167
- priority: -r,
2168
- config: q(n.webview)
2169
- }));
2170
- const o = () => {
2171
- const i = n.when?.mode;
2172
- if (!i) return !0;
2173
- const a = e.workbench.modes.getActiveModeId() ?? "";
2174
- return Array.isArray(i) ? i.includes(a) : i === a;
2175
- }, s = () => {
2176
- const i = e.workbench.layout.getLayout().regions.status.widgets.find((a) => a.contributionId === n.id);
2177
- o() && !i ? e.workbench.layout.openWidget(n.id, {
2178
- region: "status"
2179
- }) : !o() && i && e.workbench.layout.removeWidgetPlacement(i.widgetId);
2180
- };
2181
- s(), t.push(e.workbench.modes.onDidChangeActive(s));
2182
- }
2183
2099
  return t;
2184
- }, xn = (e) => {
2185
- const t = [], r = e.settingsSectionId ?? gn;
2186
- e.workbench.settings.getSection(r) || t.push(e.workbench.settings.registerSection({
2187
- id: r,
2188
- title: e.settingsSectionTitle ?? "Extensions"
2189
- }));
2190
- const n = Object.fromEntries((e.metadata.settingsDefinitions ?? []).map((o) => [o.key, {
2191
- type: o.type,
2192
- scope: yn(o.scope),
2193
- default: In(o.default),
2194
- enum: o.enum,
2195
- description: f(o.description)
2196
- }]));
2197
- Object.keys(n).length > 0 && t.push(e.workbench.preferences.registerSchema({
2198
- properties: n
2199
- }));
2200
- for (const o of e.metadata.settingsPanels)
2201
- t.push(e.workbench.settings.registerPanel({
2202
- id: o.id,
2203
- title: f(o.title, o.id),
2204
- kind: "custom",
2205
- section: r,
2206
- scope: o.scope,
2207
- render: (s) => $e({
2208
- context: {
2209
- workbench: s.workbench,
2210
- webviewId: o.id,
2211
- placement: {
2212
- ...s.instance,
2213
- panelId: o.id
2214
- },
2215
- hostEvents: De(s.workbench, s.instance)
2216
- },
2217
- createHostCapabilities: Je(e, "settings"),
2218
- createProps: e.createWebviewProps ?? (({
2219
- placement: i
2220
- }) => ({
2221
- placement: i,
2222
- resource: i.resource
2223
- })),
2224
- createTheme: e.createWebviewTheme,
2225
- ownerId: o.extensionId,
2226
- title: f(o.title, o.id),
2227
- webview: q(o.webview)
2228
- })
2229
- }));
2230
- return t;
2231
- }, Tn = (e) => {
2100
+ }, Br = (e) => {
2232
2101
  const t = /* @__PURE__ */ new Map();
2233
- for (const r of e.resourceKinds ?? [])
2234
- t.set(r.id, {
2235
- surface: r.surface,
2236
- extensionId: r.extensionId,
2237
- label: r.label ? f(r.label, r.id) : void 0,
2238
- icon: r.icon
2102
+ for (const n of e.resourceKinds ?? [])
2103
+ t.set(n.id, {
2104
+ surface: n.surface,
2105
+ extensionId: n.extensionId,
2106
+ label: n.label ? p(n.label, n.id) : void 0,
2107
+ icon: n.icon
2239
2108
  });
2240
- for (const r of e.kanbanRenderers ?? [])
2241
- r.resourceKind && !t.has(r.resourceKind) && t.set(r.resourceKind, {
2109
+ for (const n of e.kanbanRenderers ?? [])
2110
+ n.resourceKind && !t.has(n.resourceKind) && t.set(n.resourceKind, {
2242
2111
  surface: "primary"
2243
2112
  });
2244
2113
  return t;
2245
- }, Wn = (e, t, r) => {
2246
- const o = (e.resourcePanels ?? []).filter((i) => i.resourceKind === t).flatMap((i) => {
2114
+ }, Fr = (e, t, n) => {
2115
+ const s = (e.resourcePanels ?? []).filter((i) => i.resourceKind === t).flatMap((i) => {
2247
2116
  const a = e.panels.find((d) => d.id === i.panel);
2248
2117
  return a ? [{
2249
2118
  edge: i,
2250
2119
  panel: a
2251
2120
  }] : [];
2252
- }), s = new Set(o.map(({
2121
+ }), o = new Set(s.map(({
2253
2122
  panel: i
2254
2123
  }) => i.id));
2255
2124
  for (const i of e.panels) {
2256
- if (s.has(i.id) || i.extensionId !== r) continue;
2257
- const d = (i.show ? Array.isArray(i.show) ? i.show : [i.show] : []).find((m) => m.for === t);
2258
- d && o.push({
2125
+ if (o.has(i.id) || i.extensionId !== n) continue;
2126
+ const d = (i.show ? Array.isArray(i.show) ? i.show : [i.show] : []).find((u) => u.for === t);
2127
+ d && s.push({
2259
2128
  panel: i,
2260
2129
  placement: d
2261
2130
  });
2262
2131
  }
2263
- return o;
2264
- }, jn = (e, t) => {
2265
- const r = e.workbench.layout.getLayout();
2266
- return ["sidenav", "main", "secondary", "side"].find((o) => r.regions[o].widgets.some((s) => s.contributionId === t));
2267
- }, Sn = (e, t, r) => {
2268
- const n = t.map(({
2269
- panel: s
2270
- }) => e.workbench.layout.openPanel(s.id, {
2271
- region: jn(e, s.id),
2272
- resource: r,
2273
- title: r.label ?? r.id ?? r.uri,
2132
+ return s;
2133
+ }, Be = (e, t) => {
2134
+ const n = e.workbench.layout.getLayout();
2135
+ return ["sidenav", "main", "secondary", "side"].find((s) => n.regions[s].widgets.some((o) => o.contributionId === t));
2136
+ }, Nr = (e, t, n) => {
2137
+ e.prepareResource?.(n);
2138
+ const r = t.map(({
2139
+ panel: o
2140
+ }) => e.workbench.layout.openPanel(o.id, {
2141
+ region: Be(e, o.id),
2142
+ resource: n,
2143
+ title: n.label ?? n.id ?? n.uri,
2274
2144
  strategy: {
2275
2145
  kind: "persistent"
2276
2146
  }
2277
- })), o = t.findIndex((s) => s.edge?.slot === "primary" || s.placement?.region === "main");
2278
- return n[o >= 0 ? o : 0];
2279
- }, Hn = (e, t, r) => {
2280
- const n = [];
2281
- e.workbench.resources.getKind(t) || n.push(e.workbench.resources.registerKind({
2147
+ }));
2148
+ e.workbench.sidePanel.getMode() === "closed" && t.some(({
2149
+ panel: o
2150
+ }) => Be(e, o.id) === "side") && e.workbench.sidePanel.setMode("attached");
2151
+ const s = t.findIndex((o) => o.edge?.slot === "primary" || o.placement?.region === "main");
2152
+ return r[s >= 0 ? s : 0];
2153
+ }, Lr = (e, t, n) => {
2154
+ const r = [];
2155
+ e.workbench.resources.getKind(t) || r.push(e.workbench.resources.registerKind({
2282
2156
  kind: t,
2283
- label: r.label ?? t,
2284
- icon: r.icon ?? "FileText",
2285
- surface: r.surface
2157
+ label: n.label ?? t,
2158
+ icon: n.icon ?? "FileText",
2159
+ surface: n.surface
2286
2160
  }));
2287
- const o = Wn(e.metadata, t, r.extensionId);
2288
- return o.length === 0 || n.push(e.workbench.resources.registerPresenter({
2161
+ const s = Fr(e.metadata, t, n.extensionId);
2162
+ return s.length === 0 || r.push(e.workbench.resources.registerPresenter({
2289
2163
  id: `workbench.extension.resource.${t}`,
2290
- canOpen: (s) => s.kind === t,
2291
- // Reuse a placement where the composition resolver or the user put it.
2292
- open: (s) => Sn(e, o, s)
2293
- })), n;
2294
- }, Mn = (e) => [...Tn(e.metadata)].flatMap(([t, r]) => Hn(e, t, r)), On = (e) => {
2295
- const t = Gt(), r = [];
2296
- for (const n of e.metadata.resourceKinds ?? [])
2297
- r.push(t.registerResourceKind({
2298
- id: n.id,
2299
- extensionId: n.extensionId,
2300
- surface: n.surface,
2301
- slots: n.slots
2164
+ canOpen: (o) => o.kind === t,
2165
+ open: (o) => Nr(e, s, o)
2166
+ })), r;
2167
+ }, Ur = (e) => [...Br(e.metadata)].flatMap(([t, n]) => Lr(e, t, n)), _r = (e) => {
2168
+ const t = In(), n = [];
2169
+ for (const r of e.metadata.resourceKinds ?? [])
2170
+ n.push(t.registerResourceKind({
2171
+ id: r.id,
2172
+ extensionId: r.extensionId,
2173
+ surface: r.surface,
2174
+ slots: r.slots
2302
2175
  }));
2303
- for (const n of e.metadata.panels)
2304
- r.push(t.registerPanelCapability({
2305
- id: n.id,
2306
- extensionId: n.extensionId,
2307
- title: f(n.title, n.id),
2308
- icon: n.icon,
2309
- show: Qt(n.show)
2176
+ for (const r of e.metadata.panels)
2177
+ n.push(t.registerPanelCapability({
2178
+ id: r.id,
2179
+ extensionId: r.extensionId,
2180
+ title: p(r.title, r.id),
2181
+ icon: r.icon,
2182
+ show: wn(r.show)
2310
2183
  }));
2311
- for (const n of e.metadata.resourcePanels ?? [])
2312
- r.push(t.registerResourcePanel({
2313
- id: n.id,
2314
- extensionId: n.extensionId,
2315
- resourceKind: n.resourceKind,
2316
- panel: n.panel,
2317
- slot: n.slot
2184
+ for (const r of e.metadata.resourcePanels ?? [])
2185
+ n.push(t.registerResourcePanel({
2186
+ id: r.id,
2187
+ extensionId: r.extensionId,
2188
+ resourceKind: r.resourceKind,
2189
+ panel: r.panel,
2190
+ slot: r.slot
2318
2191
  }));
2319
- for (const n of e.metadata.modes)
2320
- r.push(t.registerModeComposition({
2321
- id: n.modeId,
2322
- extensionId: n.extensionId,
2323
- resources: n.resources,
2324
- modePanels: n.modePanels
2192
+ for (const r of e.metadata.modes)
2193
+ n.push(t.registerModeComposition({
2194
+ id: r.modeId,
2195
+ extensionId: r.extensionId,
2196
+ resources: r.resources,
2197
+ modePanels: r.modePanels
2325
2198
  }));
2326
2199
  return {
2327
2200
  registry: t,
2328
- disposables: r
2201
+ disposables: n
2329
2202
  };
2330
- }, Te = (e, t) => `pstdio://extension-resource/${encodeURIComponent(e)}/${encodeURIComponent(t)}`, Kn = (e, t) => {
2203
+ }, Fe = (e, t) => `pstdio://extension-resource/${encodeURIComponent(e)}/${encodeURIComponent(t)}`, qr = (e, t) => {
2331
2204
  if (t)
2332
2205
  return "commandId" in t ? async () => {
2333
- const r = await e.executeCommand(t.commandId, {
2206
+ const n = await e.executeCommand(t.commandId, {
2334
2207
  projectId: e.projectId
2335
2208
  });
2336
- if (!(!r || typeof r.type != "string" || typeof r.id != "string"))
2209
+ if (!(!n || typeof n.type != "string" || typeof n.id != "string"))
2337
2210
  return {
2338
- kind: r.type,
2339
- uri: Te(r.type, r.id),
2340
- id: r.id,
2341
- label: r.label
2211
+ kind: n.type,
2212
+ uri: Fe(n.type, n.id),
2213
+ id: n.id,
2214
+ label: n.label
2342
2215
  };
2343
2216
  } : {
2344
2217
  kind: t.type,
2345
- uri: Te(t.type, t.id),
2218
+ uri: Fe(t.type, t.id),
2346
2219
  id: t.id,
2347
2220
  label: t.label
2348
2221
  };
2349
- }, Dn = (e, t) => e.metadata.modes.map((r) => {
2350
- const n = (o, s) => {
2351
- tr({
2352
- layout: o.layout,
2353
- notifications: o.notifications
2222
+ }, zr = (e, t) => e.metadata.modes.map((n) => {
2223
+ const r = (s, o) => {
2224
+ xn({
2225
+ layout: s.layout,
2226
+ notifications: s.notifications
2354
2227
  }, {
2355
2228
  registry: t,
2356
- modeId: r.modeId,
2357
- resourceKind: o.navigator.getSelectedResource()?.kind,
2358
- seeding: s
2359
- }), o.layout.getLayout().regions.side.widgets.length > 0 && o.shell.setSidePanelPresentation("attached");
2229
+ modeId: n.modeId,
2230
+ resourceKind: s.navigator.getSelectedResource()?.kind,
2231
+ seeding: o
2232
+ }), s.layout.getLayout().regions.side.widgets.length > 0 && s.shell.setSidePanelPresentation("attached");
2360
2233
  };
2361
2234
  return e.workbench.modes.registerMode({
2362
- id: r.modeId,
2363
- label: f(r.label, r.modeId),
2364
- panels: r.panelRegions,
2365
- resourceKinds: Object.keys(r.resources ?? {}),
2366
- defaultResource: Kn(e, r.defaultResource),
2235
+ id: n.modeId,
2236
+ label: p(n.label, n.modeId),
2237
+ panels: n.panelRegions,
2238
+ resourceKinds: Object.keys(n.resources ?? {}),
2239
+ defaultResource: qr(e, n.defaultResource),
2367
2240
  listAddablePanels: ({
2368
- layout: o,
2369
- resource: s
2370
- }) => Yt({
2241
+ layout: s,
2242
+ resource: o
2243
+ }) => yn({
2371
2244
  registry: t,
2372
- modeId: r.modeId,
2373
- layout: o,
2374
- resourceKind: s?.kind
2375
- }).filter((i) => dt.includes(i.region)),
2245
+ modeId: n.modeId,
2246
+ layout: s,
2247
+ resourceKind: o?.kind
2248
+ }).filter((i) => Et.includes(i.region)),
2376
2249
  activate: () => {
2377
2250
  },
2378
- seed: (o) => n(o, !0),
2379
- reconcile: (o) => n(o, !1)
2251
+ seed: (s) => r(s, !0),
2252
+ reconcile: (s) => r(s, !1)
2380
2253
  });
2381
- }), to = (e) => {
2382
- const t = [], r = e;
2383
- kn(e, t), t.push(...Rn(r, e.metadata)), t.push(...Cn(e, r)), t.push(...En(e, r)), t.push(cn(e)), t.push(Ar(e)), t.push(...Pn(e)), t.push(Gr(r, e.metadata.kanbanRenderers ?? [], void 0, e.metadata.panels, e.metadata.resourcePanels)), t.push(br(r, e.metadata.dataTableRenderers ?? [], e.metadata.panels, e.metadata.resourcePanels)), t.push(zt(r, e.metadata.commandPaletteResources ?? [])), t.push(...xn(e)), t.push(...mn({
2384
- metadata: e.metadata,
2385
- routeResourceKind: e.routeResourceKind ?? xe,
2386
- workbench: e.workbench
2387
- })), t.push(...hn({
2388
- metadata: e.metadata,
2389
- openHref: e.openHref,
2390
- routeResourceKind: e.routeResourceKind ?? xe,
2391
- workbench: e.workbench
2392
- })), t.push(...An(e)), t.push(...Mn(e));
2393
- const n = On(e);
2394
- return t.push(...n.disposables), t.push(...Dn(e, n.registry)), {
2395
- dispose() {
2396
- wn(t);
2397
- }
2254
+ }), Qr = () => {
2255
+ if (typeof navigator > "u") return;
2256
+ const e = `${navigator.platform} ${navigator.userAgent}`.toLowerCase();
2257
+ if (e.includes("mac")) return "mac";
2258
+ if (e.includes("win")) return "win";
2259
+ if (e.includes("linux")) return "linux";
2260
+ }, Gr = (e, t = Qr()) => (t ? e.platformOverrides?.[t] : void 0) ?? e.key, Yr = (e) => e.bindings.map((t) => e.workbench.keybindings.registerKeybinding({
2261
+ commandId: t.commandId,
2262
+ keybinding: Gr(t),
2263
+ when: e.createWhenExpression?.(t.when),
2264
+ args: t.args
2265
+ })), v = (e) => e.extensionId === "pstdio" ? e.id : `${e.extensionId}.${e.kind}.${e.id}`, oe = (e) => e.extensionId === "pstdio" ? e.id : `${e.extensionId}.command.${e.id}`, ut = (e) => {
2266
+ if (!e) return;
2267
+ const t = (n) => {
2268
+ if (n)
2269
+ return Array.isArray(n) ? n.map(v) : v(n);
2398
2270
  };
2399
- }, $n = (e, t, r = {}) => {
2400
- t.kind === "tree" && e.renderers.refresh(t.id), t.kind === "file" && e.renderers.refreshFileRenderer(t.id, r), t.kind === "controls" && e.renderers.refreshControlsRenderer(t.id), t.kind === "dataTable" && e.renderers.refreshDataTableRenderer(t.id), t.kind === "kanban" && e.renderers.refreshKanbanRenderer(t.id);
2401
- }, Fn = (e) => {
2402
- const t = /* @__PURE__ */ new Map(), r = (n, o) => {
2403
- for (const s of new Set(o.refreshEventIds ?? [])) {
2404
- const i = t.get(s) ?? [];
2405
- i.some((a) => a.kind === n && a.id === o.id) || i.push({
2406
- id: o.id,
2407
- kind: n
2408
- }), t.set(s, i);
2271
+ return {
2272
+ mode: t(e.mode),
2273
+ source: e.source,
2274
+ viewId: t(e.view),
2275
+ resourceType: e.resourceType?.map((n) => n.id),
2276
+ metadata: e.metadata
2277
+ };
2278
+ }, Fo = ut, te = (e, t) => e.resourceViews.find((n) => v(n.view) === t)?.resourceKind.id, Xr = (e, t) => {
2279
+ const n = e.placements.flatMap((o) => o.item.kind === "view" && v(o.item.view) === t ? [{
2280
+ region: o.region,
2281
+ allowedRegions: o.movableTo,
2282
+ required: o.required
2283
+ }] : []), s = e.resourceViews.filter((o) => v(o.view) === t).flatMap((o) => e.placements.flatMap((i) => i.item.kind === "resource-slot" && i.item.slot.id === o.slot.id && i.item.slot.resourceKind.id === o.resourceKind.id ? [{
2284
+ for: o.resourceKind.id,
2285
+ region: i.region,
2286
+ allowedRegions: i.movableTo,
2287
+ required: i.required
2288
+ }] : []));
2289
+ return [...n, ...s];
2290
+ }, mt = (e) => e.body.kind === "webview" ? {
2291
+ webview: e.body.webview
2292
+ } : {
2293
+ renderer: {
2294
+ kind: e.body.kind,
2295
+ id: e.id
2296
+ }
2297
+ }, Jr = (e, t) => e.viewMenus.flatMap((n) => {
2298
+ if (v(n.owner) !== t.id) return [];
2299
+ const r = e.views.find((s) => s.id === v(n.view));
2300
+ return r ? [{
2301
+ id: n.id,
2302
+ extensionId: n.extensionId,
2303
+ ownerPanelId: t.id,
2304
+ title: r.title,
2305
+ side: n.side,
2306
+ group: n.group,
2307
+ placement: n.placement,
2308
+ hostTreeHeader: n.hostTreeHeader,
2309
+ hostTreeFooter: n.hostTreeFooter,
2310
+ ...mt(r)
2311
+ }] : [];
2312
+ }), Zr = (e) => e.views.map((t) => {
2313
+ const n = Xr(e, t.id), r = Jr(e, t);
2314
+ return {
2315
+ id: t.id,
2316
+ extensionId: t.extensionId,
2317
+ title: t.title,
2318
+ path: t.path,
2319
+ icon: t.icon,
2320
+ show: n.length === 0 ? void 0 : n.length === 1 ? n[0] : n,
2321
+ panelMenus: r.length > 0 ? r : void 0,
2322
+ ...mt(t)
2323
+ };
2324
+ }), he = (e) => e?.map(({
2325
+ command: t,
2326
+ ...n
2327
+ }) => ({
2328
+ ...n,
2329
+ commandId: oe(t)
2330
+ })), eo = (e) => e.views.flatMap((t) => {
2331
+ const n = t.body;
2332
+ return n.kind !== "kanban" ? [] : [{
2333
+ ...n,
2334
+ id: t.id,
2335
+ extensionId: t.extensionId,
2336
+ title: t.title,
2337
+ icon: t.icon,
2338
+ resourceKind: te(e, t.id),
2339
+ createRow: n.createRow ? {
2340
+ title: n.createRow.title,
2341
+ submitLabel: n.createRow.submitLabel,
2342
+ columnParam: n.createRow.columnParam,
2343
+ params: n.createRow.params,
2344
+ attributesParam: n.createRow.attributesParam,
2345
+ labels: n.createRow.labels,
2346
+ commandId: oe(n.createRow.command),
2347
+ attachments: n.createRow.attachments ? {
2348
+ resourceParam: n.createRow.attachments.resourceParam,
2349
+ fileParam: n.createRow.attachments.fileParam,
2350
+ commandId: oe(n.createRow.attachments.command)
2351
+ } : void 0
2352
+ } : void 0,
2353
+ rowActions: he(n.rowActions)
2354
+ }];
2355
+ }), to = (e) => e.views.flatMap((t) => {
2356
+ const n = t.body;
2357
+ return n.kind !== "dataTable" ? [] : [{
2358
+ ...n,
2359
+ id: t.id,
2360
+ extensionId: t.extensionId,
2361
+ title: t.title,
2362
+ icon: t.icon,
2363
+ resourceKind: te(e, t.id),
2364
+ selectionActions: he(n.selectionActions),
2365
+ rowActions: he(n.rowActions)
2366
+ }];
2367
+ }), no = (e) => e.views.flatMap((t) => t.body.kind === "tree" ? [{
2368
+ ...t.body,
2369
+ id: t.id,
2370
+ extensionId: t.extensionId,
2371
+ title: t.title,
2372
+ icon: t.icon,
2373
+ resourceKind: te(e, t.id)
2374
+ }] : []), ro = (e) => e.views.flatMap((t) => t.body.kind === "file" ? [{
2375
+ ...t.body,
2376
+ id: t.id,
2377
+ extensionId: t.extensionId,
2378
+ title: t.title,
2379
+ icon: t.icon,
2380
+ resourceKind: te(e, t.id)
2381
+ }] : []), oo = (e) => e.views.flatMap((t) => t.body.kind === "controls" ? [{
2382
+ ...t.body,
2383
+ id: t.id,
2384
+ extensionId: t.extensionId,
2385
+ title: t.title,
2386
+ icon: t.icon,
2387
+ resourceKind: te(e, t.id)
2388
+ }] : []), so = (e) => e.modes.map((t) => {
2389
+ const n = e.placements.filter((i) => v(i.mode) === t.id), r = [...new Set(n.flatMap((i) => [i.region, ...i.movableTo ?? []]))].filter((i) => i !== "sidenav"), s = Object.fromEntries(n.flatMap((i) => i.item.kind === "view" ? [[v(i.item.view), {
2390
+ region: i.region,
2391
+ allowedRegions: i.movableTo,
2392
+ required: i.required,
2393
+ defaultOpen: i.required ? !0 : i.defaultOpen
2394
+ }]] : [])), o = Object.fromEntries(e.resourceKinds.flatMap((i) => {
2395
+ const a = Object.fromEntries(n.flatMap((d) => d.item.kind === "resource-slot" && d.item.slot.resourceKind.id === i.id ? [[d.item.slot.id, {
2396
+ region: d.region,
2397
+ allowedRegions: d.movableTo,
2398
+ required: d.required,
2399
+ defaultOpen: d.required ? !0 : d.defaultOpen
2400
+ }]] : []));
2401
+ return Object.keys(a).length > 0 ? [[i.id, {
2402
+ slots: a
2403
+ }]] : [];
2404
+ }));
2405
+ return {
2406
+ id: t.id,
2407
+ extensionId: t.extensionId,
2408
+ modeId: t.id,
2409
+ label: t.label,
2410
+ icon: t.icon,
2411
+ panelRegions: r.length > 0 ? r : void 0,
2412
+ resources: o,
2413
+ modePanels: s
2414
+ };
2415
+ }), io = (e) => {
2416
+ const t = Zr(e);
2417
+ return {
2418
+ extensions: e.extensions,
2419
+ commands: e.commands,
2420
+ menuContributions: e.menuContributions,
2421
+ commandPaletteContributions: e.commandPaletteContributions,
2422
+ modes: so(e),
2423
+ panels: t,
2424
+ resourceKinds: e.resourceKinds.map((n) => ({
2425
+ id: n.id,
2426
+ extensionId: n.extensionId,
2427
+ surface: n.surface,
2428
+ label: n.label,
2429
+ icon: n.icon,
2430
+ slots: Object.fromEntries((n.slots ?? []).map((r) => [r.id, {
2431
+ cardinality: r.cardinality,
2432
+ external: r.access === "public"
2433
+ }])),
2434
+ menuSlots: Object.fromEntries((n.menuSlots ?? []).map((r) => [r.id, {
2435
+ placement: r.placement,
2436
+ label: r.label,
2437
+ external: r.access === "public",
2438
+ order: r.order
2439
+ }]))
2440
+ })),
2441
+ resourcePanels: e.resourceViews.map((n) => ({
2442
+ id: n.id,
2443
+ extensionId: n.extensionId,
2444
+ resourceKind: n.resourceKind.id,
2445
+ panel: v(n.view),
2446
+ slot: n.slot.id
2447
+ })),
2448
+ resourceHierarchyProviders: (e.resourceHierarchyProviders ?? []).map((n) => ({
2449
+ id: n.id,
2450
+ extensionId: n.extensionId,
2451
+ resourceKind: n.resourceKind.id
2452
+ })),
2453
+ routes: [],
2454
+ treeItems: [],
2455
+ activityItems: (e.activityItems ?? []).map((n) => ({
2456
+ id: n.id,
2457
+ extensionId: n.extensionId,
2458
+ title: n.title,
2459
+ icon: n.icon,
2460
+ modes: n.modes.map(v),
2461
+ placement: n.placement,
2462
+ commandId: oe(n.command),
2463
+ params: n.params
2464
+ })),
2465
+ settingsSections: e.settingsSections ?? [],
2466
+ settingsPanels: e.settingsPanels.flatMap((n) => {
2467
+ const r = e.views.find((s) => s.id === v(n.view));
2468
+ return !r || r.body.kind !== "webview" ? [] : [{
2469
+ id: n.id,
2470
+ extensionId: n.extensionId,
2471
+ slotId: n.slot.id,
2472
+ scope: n.slot.id.includes("global") ? "global" : "project",
2473
+ title: r.title,
2474
+ icon: r.icon,
2475
+ section: n.section ? v(n.section) : void 0,
2476
+ webview: r.body.webview
2477
+ }];
2478
+ }),
2479
+ kanbanRenderers: eo(e),
2480
+ dataTableRenderers: to(e),
2481
+ commandPaletteResources: e.commandPaletteResources ?? [],
2482
+ treeRenderers: no(e),
2483
+ fileRenderers: ro(e),
2484
+ controlsRenderers: oo(e),
2485
+ keybindings: e.keybindings ?? [],
2486
+ settingsDefinitions: e.settingsDefinitions ?? [],
2487
+ statuses: e.statuses,
2488
+ statusBarItems: e.statusBarItems.map((n) => ({
2489
+ id: n.id,
2490
+ extensionId: n.extensionId,
2491
+ viewId: v(n.view),
2492
+ slot: n.slot.id.endsWith("leading") ? "leading" : "trailing",
2493
+ order: n.order,
2494
+ when: ut(n.when)
2495
+ })),
2496
+ diagnostics: e.diagnostics
2497
+ };
2498
+ }, ao = (e, t, n = {}) => {
2499
+ t.kind === "tree" && e.renderers.refresh(t.id), t.kind === "file" && e.renderers.refreshFileRenderer(t.id, n), t.kind === "controls" && e.renderers.refreshControlsRenderer(t.id), t.kind === "dataTable" && e.renderers.refreshDataTableRenderer(t.id), t.kind === "kanban" && e.renderers.refreshKanbanRenderer(t.id);
2500
+ }, co = (e) => {
2501
+ const t = /* @__PURE__ */ new Map(), n = (r, s) => {
2502
+ for (const o of new Set(s.refreshEventIds ?? [])) {
2503
+ const i = t.get(o) ?? [];
2504
+ i.some((a) => a.kind === r && a.id === s.id) || i.push({
2505
+ id: s.id,
2506
+ kind: r
2507
+ }), t.set(o, i);
2409
2508
  }
2410
2509
  };
2411
- for (const n of e.treeRenderers ?? []) r("tree", n);
2412
- for (const n of e.fileRenderers ?? []) r("file", n);
2413
- for (const n of e.controlsRenderers ?? []) r("controls", n);
2414
- for (const n of e.dataTableRenderers ?? []) r("dataTable", n);
2415
- for (const n of e.kanbanRenderers ?? []) r("kanban", n);
2510
+ for (const r of e.views)
2511
+ r.body.kind !== "webview" && n(r.body.kind, {
2512
+ id: r.id,
2513
+ refreshEventIds: r.body.refreshEventIds
2514
+ });
2416
2515
  return t;
2417
- }, ro = (e) => {
2418
- const t = Fn(e.metadata);
2419
- return e.subscribe((r) => {
2516
+ }, lo = (e) => {
2517
+ const t = co(e.metadata);
2518
+ return e.subscribe((n) => {
2420
2519
  const {
2421
- id: n,
2422
- ...o
2423
- } = r;
2424
- for (const s of t.get(n) ?? []) $n(e.workbench, s, o);
2520
+ id: r,
2521
+ ...s
2522
+ } = n;
2523
+ for (const o of t.get(r) ?? []) ao(e.workbench, o, s);
2425
2524
  });
2426
- }, We = (e, t) => e.layout.listPanelInstances().find((r) => r.panelId === t), Bn = (e, t) => {
2525
+ }, uo = (e, t) => e.layout.listPanelInstances().find((n) => n.panelId === t), mo = (e, t) => {
2427
2526
  if (t)
2428
2527
  try {
2429
2528
  e.layout.activatePanel(t);
2430
2529
  } catch {
2431
2530
  }
2432
- }, no = (e, t) => {
2433
- const r = e.layout.getLayout().activeWidgetId;
2434
- for (const n of t.panels) {
2435
- if (!n.webview) continue;
2436
- const o = We(e, n.id);
2437
- o && e.layout.openPanel(n.id, {
2438
- resource: o.resource,
2439
- title: f(n.title, o.title),
2531
+ }, No = (e, t) => {
2532
+ const n = e.layout.getLayout().activeWidgetId;
2533
+ for (const r of t.views) {
2534
+ if (r.body.kind !== "webview") continue;
2535
+ const s = uo(e, r.id);
2536
+ s && e.layout.openPanel(r.id, {
2537
+ resource: s.resource,
2538
+ title: p(r.title, s.title),
2440
2539
  strategy: {
2441
2540
  kind: "replace-panel",
2442
- instanceId: o.instanceId
2541
+ instanceId: s.instanceId
2443
2542
  }
2444
2543
  });
2445
2544
  }
2446
- for (const n of t.routes) {
2447
- if (!n.webview) continue;
2448
- const o = We(e, n.id);
2449
- o && e.layout.openPanel(n.id, {
2450
- resource: o.resource,
2451
- title: f(n.label, o.title),
2452
- strategy: {
2453
- kind: "replace-panel",
2454
- instanceId: o.instanceId
2455
- }
2545
+ mo(e, n);
2546
+ }, po = (e) => (t) => ({
2547
+ ...ze({
2548
+ workbench: t.workbench,
2549
+ hostEvents: t.hostEvents
2550
+ }),
2551
+ // Extension guests speak the SDK resource shape (`type`); normalize to the
2552
+ // workbench shape (`kind` + synthesized uri) the resource registry expects,
2553
+ // mirroring how commands.execute and tree targets normalize their resources.
2554
+ "resource.open": (r) => {
2555
+ const s = r;
2556
+ if (!s.resource) throw new Error("resource.open requires a resource.");
2557
+ return t.workbench.resources.openResource(J(s.resource), qe(s.input));
2558
+ },
2559
+ "commands.execute": async (r) => {
2560
+ const s = r, o = s.resource ?? D(t.placement.resource);
2561
+ return e.executeCommand(s.commandId, {
2562
+ projectId: e.projectId,
2563
+ ...s.params ? {
2564
+ params: s.params
2565
+ } : {},
2566
+ ...o ? {
2567
+ resource: o
2568
+ } : {},
2569
+ slot: B({
2570
+ id: t.webviewId,
2571
+ kind: e.slotKind,
2572
+ projectId: e.projectId,
2573
+ context: {
2574
+ panelId: t.webviewId
2575
+ }
2576
+ }),
2577
+ source: "dashboard"
2456
2578
  });
2457
- }
2458
- Bn(e, r);
2579
+ },
2580
+ ...e.files ? {
2581
+ "files.upload": e.files.upload,
2582
+ "files.list": e.files.list,
2583
+ "files.delete": e.files.delete
2584
+ } : {}
2585
+ }), pt = "extensions", fo = 1e3, bo = 25, go = (e) => e === void 0 ? void 0 : e, ho = (e) => e === "global" ? "user" : "project", wo = (e, t) => t ? (n) => ({
2586
+ ...e(n),
2587
+ ...t(n)
2588
+ }) : e, ft = (e, t) => {
2589
+ const n = e.createWebviewHostCapabilities ?? po({
2590
+ executeCommand: e.executeCommand,
2591
+ files: e.webviewFiles,
2592
+ projectId: e.projectId,
2593
+ slotKind: t
2594
+ });
2595
+ return wo(n, e.createWebviewHostCapabilityOverrides);
2596
+ }, Io = (e) => e.workbench.renderers.getRenderer(se) ? [] : [e.workbench.renderers.registerRenderer(Xt({
2597
+ createHostCapabilities: ft(e, "panel"),
2598
+ createProps: e.createWebviewProps,
2599
+ createTheme: e.createWebviewTheme
2600
+ }))], yo = (e) => {
2601
+ const t = L(e.metadata.panels);
2602
+ return e.metadata.panels.flatMap((n, r) => n.webview ? [U({
2603
+ workbench: e.workbench,
2604
+ path: n.path,
2605
+ aliases: n.aliases,
2606
+ resolveInput: F(e.resolveViewInput, n),
2607
+ contribution: N({
2608
+ panel: n,
2609
+ rendererId: se,
2610
+ declarationIndex: r,
2611
+ menuDeclarationOffset: t[r],
2612
+ resourcePanels: e.metadata.resourcePanels,
2613
+ config: ve(n.webview)
2614
+ })
2615
+ })] : []);
2616
+ }, Ne = (e) => {
2617
+ if (!e || typeof e != "object" || !("statuses" in e) || !Array.isArray(e.statuses))
2618
+ throw new Error("Status provider returned an invalid response");
2619
+ return e.statuses;
2620
+ }, vo = (e, t) => {
2621
+ const n = e.metadata.statuses ?? [];
2622
+ if (n.length === 0) return [];
2623
+ const r = n.map((s, o) => e.workbench.statuses.registerStatusSet({
2624
+ id: s.id,
2625
+ title: p(s.title, s.id),
2626
+ actions: s.actions?.map((i) => ({
2627
+ id: i.id,
2628
+ label: p(i.label, i.id),
2629
+ icon: i.icon
2630
+ })),
2631
+ query: async () => Ne(await P(t, s.queryHandlerId, {
2632
+ params: {}
2633
+ })),
2634
+ save: s.saveHandlerId ? async (i) => Ne(await P(t, s.saveHandlerId, {
2635
+ params: {
2636
+ statuses: i
2637
+ }
2638
+ })) : void 0
2639
+ }, {
2640
+ ownerId: s.extensionId,
2641
+ priority: -o
2642
+ }));
2643
+ return r.push(e.workbench.settings.registerPanel({
2644
+ id: "workbench.statuses",
2645
+ title: "Statuses",
2646
+ icon: "list-checks",
2647
+ kind: "custom",
2648
+ order: bo,
2649
+ section: e.settingsSectionId ?? pt,
2650
+ scope: "project",
2651
+ render: () => K(Rt, {
2652
+ workbench: e.workbench
2653
+ })
2654
+ })), r;
2655
+ }, ko = (e) => {
2656
+ const t = [], n = e.settingsSectionId ?? pt;
2657
+ e.workbench.settings.getSection(n) || t.push(e.workbench.settings.registerSection({
2658
+ id: n,
2659
+ title: e.settingsSectionTitle ?? "Extensions"
2660
+ }));
2661
+ const r = [...e.metadata.settingsSections].sort((i, a) => (i.order ?? 0) - (a.order ?? 0) || i.extensionId.localeCompare(a.extensionId) || i.id.localeCompare(a.id));
2662
+ for (const i of r)
2663
+ t.push(e.workbench.settings.registerSection({
2664
+ id: i.id,
2665
+ title: p(i.title, i.id),
2666
+ order: i.order,
2667
+ scope: i.scope
2668
+ }));
2669
+ const s = Object.fromEntries((e.metadata.settingsDefinitions ?? []).map((i) => [i.key, {
2670
+ type: i.type,
2671
+ scope: ho(i.scope),
2672
+ default: go(i.default),
2673
+ enum: i.enum,
2674
+ description: p(i.description)
2675
+ }]));
2676
+ Object.keys(s).length > 0 && t.push(e.workbench.preferences.registerSchema({
2677
+ properties: s
2678
+ }));
2679
+ const o = [...e.metadata.settingsPanels].sort((i, a) => i.extensionId.localeCompare(a.extensionId) || i.id.localeCompare(a.id));
2680
+ for (const [i, a] of o.entries())
2681
+ t.push(e.workbench.settings.registerPanel({
2682
+ id: a.id,
2683
+ title: p(a.title, a.id),
2684
+ icon: a.icon,
2685
+ kind: "custom",
2686
+ order: fo + i,
2687
+ section: a.section ?? n,
2688
+ scope: a.scope,
2689
+ render: (d) => Ye({
2690
+ context: {
2691
+ workbench: d.workbench,
2692
+ webviewId: a.id,
2693
+ placement: {
2694
+ ...d.instance,
2695
+ panelId: a.id
2696
+ },
2697
+ hostEvents: Ge(d.workbench, d.instance)
2698
+ },
2699
+ createHostCapabilities: ft(e, "settings"),
2700
+ createProps: e.createWebviewProps ?? (({
2701
+ placement: u
2702
+ }) => ({
2703
+ placement: u,
2704
+ resource: u.resource
2705
+ })),
2706
+ createTheme: e.createWebviewTheme,
2707
+ ownerId: a.extensionId,
2708
+ title: p(a.title, a.id),
2709
+ webview: ve(a.webview)
2710
+ })
2711
+ }));
2712
+ return t;
2713
+ }, Ro = (e) => {
2714
+ for (let t = e.length - 1; t >= 0; t -= 1) e[t]?.dispose();
2715
+ }, ke = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, Re = (e, t, n, r, s) => e.prepareCommandArgs?.(t, n, r, s) ?? n, Co = (e, t) => t.commands.map((n) => e.workbench.commands.registerCommand({
2716
+ id: n.id,
2717
+ label: p(n.title, n.id),
2718
+ description: p(n.description),
2719
+ params: n.params
2720
+ }, {
2721
+ prepareArgs: (r, s, o) => Re(e, n.id, r, s, o),
2722
+ execute: (r, s) => P(e, n.id, {
2723
+ params: ke(r),
2724
+ resource: s?.resource
2725
+ })
2726
+ })), bt = (e, t) => t?.resource ?? e.workbench.getPrimaryResource(), xo = (e, t) => {
2727
+ if (!e.menuSlotsById) return [];
2728
+ const {
2729
+ registrations: n
2730
+ } = qn({
2731
+ metadata: e.metadata,
2732
+ menuSlotsById: e.menuSlotsById,
2733
+ menuTargetsById: e.menuTargetsById,
2734
+ createWhenExpression: e.createMenuWhenExpression
2735
+ }), r = n.map(({
2736
+ menuItem: o,
2737
+ menuPath: i,
2738
+ ...a
2739
+ }) => ({
2740
+ ...a,
2741
+ menuItems: [{
2742
+ menuItem: o,
2743
+ menuPath: i
2744
+ }]
2745
+ }));
2746
+ return (e.menuRegistrations ?? r).flatMap((o) => [e.workbench.commands.registerCommand(o.command, {
2747
+ prepareArgs: (i, a, d) => Re(t, o.targetCommandId, i, a, d),
2748
+ execute: (i, a) => P(t, o.targetCommandId, {
2749
+ params: {
2750
+ ...o.contribution.params ?? {},
2751
+ ...ke(i) ?? {}
2752
+ },
2753
+ resource: bt(e, a),
2754
+ slot: B({
2755
+ id: o.contribution.slotId,
2756
+ kind: "menu",
2757
+ projectId: e.projectId,
2758
+ context: {
2759
+ panelId: o.contribution.id
2760
+ }
2761
+ })
2762
+ })
2763
+ }), ...o.menuItems.map(({
2764
+ menuPath: i,
2765
+ menuItem: a
2766
+ }) => e.workbench.layout.registerMenuItem(i, a))]);
2767
+ }, Eo = (e, t) => zn({
2768
+ metadata: e.metadata
2769
+ }).flatMap((r) => [e.workbench.commands.registerCommand(r.command, {
2770
+ prepareArgs: (s, o, i) => Re(t, r.targetCommandId, s, o, i),
2771
+ execute: (s, o) => P(t, r.targetCommandId, {
2772
+ params: {
2773
+ ...r.contribution.params ?? {},
2774
+ ...ke(s) ?? {}
2775
+ },
2776
+ resource: bt(e, o),
2777
+ slot: B({
2778
+ id: "workbench.commandPalette",
2779
+ kind: "menu",
2780
+ projectId: e.projectId,
2781
+ context: {
2782
+ panelId: r.contribution.id
2783
+ }
2784
+ })
2785
+ }),
2786
+ isVisible: () => xt(r.contribution.when, e.workbench.getPrimaryResource()?.kind)
2787
+ }), e.workbench.layout.registerMenuItem(kt, r.menuItem)]), Po = (e, t) => {
2788
+ const n = t?.mode;
2789
+ if (!n) return !0;
2790
+ const r = e.workbench.modes.getActiveModeId() ?? "";
2791
+ return Array.isArray(n) ? n.includes(r) : n === r;
2792
+ }, Ao = (e) => (e.metadata.statusBarItems ?? []).map((t) => e.workbench.statusBar.registerItem({
2793
+ id: t.id,
2794
+ viewId: t.viewId,
2795
+ slot: t.slot,
2796
+ order: t.order,
2797
+ isVisible: () => Po(e, t.when)
2798
+ })), Lo = (e) => {
2799
+ const t = {
2800
+ ...e,
2801
+ metadata: io(e.metadata)
2802
+ }, n = [], r = t;
2803
+ n.push(...Io(t)), n.push(...Co(r, t.metadata)), n.push(...Yr({
2804
+ bindings: t.metadata.keybindings,
2805
+ createWhenExpression: t.createKeybindingWhenExpression,
2806
+ workbench: t.workbench
2807
+ })), n.push(...xo(t, r)), n.push(...Eo(t, r)), n.push(Or({
2808
+ ...t,
2809
+ resolveNodeResource: t.resolveTreeNodeResource
2810
+ })), n.push(Jn(t)), n.push(Hn(r, t.metadata.controlsRenderers ?? [], t.metadata.panels, {
2811
+ resolveViewInput: t.resolveViewInput
2812
+ }, t.metadata.resourcePanels)), n.push(...yo(t)), n.push(...ko(t)), n.push(...vo(t, r)), n.push(kr(r, t.metadata.kanbanRenderers ?? [], {
2813
+ ...t.kanbanAdapter,
2814
+ resolveViewInput: t.resolveViewInput
2815
+ }, t.metadata.panels, t.metadata.resourcePanels)), n.push(Bn(r, t.metadata.dataTableRenderers ?? [], t.metadata.panels, t.metadata.resourcePanels, t.resolveViewInput)), n.push(hn(r, t.metadata.commandPaletteResources ?? [])), n.push(...Dr({
2816
+ metadata: e.metadata,
2817
+ workbench: e.workbench
2818
+ })), e.subscribeRefreshEvents && n.push(lo({
2819
+ metadata: e.metadata,
2820
+ subscribe: e.subscribeRefreshEvents,
2821
+ workbench: e.workbench
2822
+ })), n.push(...Ao(t)), n.push(...Ur(t));
2823
+ const s = _r(t);
2824
+ return n.push(...s.disposables), n.push(...zr(t, s.registry)), {
2825
+ dispose() {
2826
+ Ro(n);
2827
+ }
2828
+ };
2459
2829
  };
2460
2830
  export {
2461
- S as BRIDGE_WEBVIEW_RENDERER_ID,
2462
- kr as buildWorkbenchExtensionCommandPaletteRegistrations,
2463
- vr as buildWorkbenchExtensionMenuRegistrations,
2464
- Zn as buildWorkbenchExtensionRouteEntries,
2465
- er as compositionRequiredNotificationId,
2466
- Ht as createBridgeWebviewRenderer,
2467
- Pt as createTerminalSessionCapability,
2468
- Gt as createWorkbenchCompositionRegistry,
2469
- Oe as createWorkbenchWebviewHostCapabilities,
2470
- Jn as emptyWorkbenchExtensionMetadata,
2471
- eo as fileRendererRefreshEnvelopeFromCommand,
2472
- Yt as listCompositionAddablePanels,
2473
- K as panelMenuDeclarationOffsets,
2474
- tr as reconcileCompositionLayout,
2475
- no as refreshOpenWorkbenchExtensionWebviews,
2476
- $n as refreshWorkbenchExtensionRenderer,
2477
- zt as registerWorkbenchExtensionCommandPaletteResources,
2478
- to as registerWorkbenchExtensionContributions,
2479
- Xn as registerWorkbenchExtensionControlsRenderers,
2480
- br as registerWorkbenchExtensionDataTableRenderers,
2481
- Ar as registerWorkbenchExtensionFileRenderers,
2482
- Gr as registerWorkbenchExtensionKanbanRenderers,
2483
- D as registerWorkbenchExtensionPanel,
2484
- ro as registerWorkbenchExtensionRendererRefreshEvents,
2485
- cn as registerWorkbenchExtensionTreeRenderers,
2486
- $e as renderBridgeWebviewFrame,
2487
- Qt as toPanelPlacements,
2488
- O as toWorkbenchCompositionPanelContribution
2831
+ se as BRIDGE_WEBVIEW_RENDERER_ID,
2832
+ zn as buildWorkbenchExtensionCommandPaletteRegistrations,
2833
+ qn as buildWorkbenchExtensionMenuRegistrations,
2834
+ Cn as compositionRequiredNotificationId,
2835
+ Xt as createBridgeWebviewRenderer,
2836
+ Ut as createTerminalSessionCapability,
2837
+ In as createWorkbenchCompositionRegistry,
2838
+ ze as createWorkbenchWebviewHostCapabilities,
2839
+ Do as emptyWorkbenchExtensionMetadata,
2840
+ Bo as fileRendererRefreshEnvelopeFromCommand,
2841
+ dn as isExtensionNavigationTarget,
2842
+ yn as listCompositionAddablePanels,
2843
+ L as panelMenuDeclarationOffsets,
2844
+ xn as reconcileCompositionLayout,
2845
+ No as refreshOpenWorkbenchExtensionWebviews,
2846
+ ao as refreshWorkbenchExtensionRenderer,
2847
+ hn as registerWorkbenchExtensionCommandPaletteResources,
2848
+ Lo as registerWorkbenchExtensionContributions,
2849
+ Hn as registerWorkbenchExtensionControlsRenderers,
2850
+ Bn as registerWorkbenchExtensionDataTableRenderers,
2851
+ Jn as registerWorkbenchExtensionFileRenderers,
2852
+ kr as registerWorkbenchExtensionKanbanRenderers,
2853
+ U as registerWorkbenchExtensionPanel,
2854
+ lo as registerWorkbenchExtensionRendererRefreshEvents,
2855
+ Or as registerWorkbenchExtensionTreeRenderers,
2856
+ Ye as renderBridgeWebviewFrame,
2857
+ wn as toPanelPlacements,
2858
+ N as toWorkbenchCompositionPanelContribution,
2859
+ Z as toWorkbenchNavigationTarget,
2860
+ Je as toWorkbenchNavigationTargetResult,
2861
+ Fo as toWorkbenchWhenExpression
2489
2862
  };
2490
2863
  //# sourceMappingURL=extensions.js.map