@pstdio/workbench 0.3.0 → 0.5.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,21 +1,21 @@
1
- import { w as y, r as Z } from "./layout-types-DMoZz38-.js";
2
- import { r as X, l as Y, g as ee } from "./surface-map-C1pOTUmF.js";
3
- import { devtools as te } from "zustand/middleware";
4
- import { createStore as ne } from "zustand/vanilla";
1
+ import { w as k, r as Y } from "./layout-types-DMoZz38-.js";
2
+ import { r as ee, l as te, g as ne } from "./surface-map-C1pOTUmF.js";
3
+ import { devtools as ie } from "zustand/middleware";
4
+ import { createStore as re } from "zustand/vanilla";
5
5
  const h = (e) => {
6
- let t = !1;
6
+ let n = !1;
7
7
  return {
8
8
  dispose() {
9
- t || (t = !0, e());
9
+ n || (n = !0, e());
10
10
  }
11
11
  };
12
- }, ie = (e, t) => Object.is(e, t), P = (e) => {
13
- const t = ne()(te(() => e.initialState, {
12
+ }, oe = (e, n) => Object.is(e, n), W = (e) => {
13
+ const n = re()(ie(() => e.initialState, {
14
14
  name: e.name ?? "workbench.store"
15
- })), n = (o, r, i = {}) => {
16
- const c = i.equalityFn ?? ie;
17
- let s = o(t.getState());
18
- return i.fireImmediately && r(s, s), t.subscribe((a) => {
15
+ })), t = (o, r, i = {}) => {
16
+ const c = i.equalityFn ?? oe;
17
+ let s = o(n.getState());
18
+ return i.fireImmediately && r(s, s), n.subscribe((a) => {
19
19
  const d = o(a);
20
20
  if (c(s, d)) return;
21
21
  const g = s;
@@ -23,111 +23,111 @@ const h = (e) => {
23
23
  });
24
24
  };
25
25
  return {
26
- getState: t.getState,
27
- getInitialState: t.getInitialState,
28
- subscribe: t.subscribe,
29
- subscribeSelector: n,
30
- setState: t.setState,
31
- api: t
26
+ getState: n.getState,
27
+ getInitialState: n.getInitialState,
28
+ subscribe: n.subscribe,
29
+ subscribeSelector: t,
30
+ setState: n.setState,
31
+ api: n
32
32
  };
33
- }, Re = (e, t) => {
34
- for (const n of Object.values(e.regions)) {
35
- const o = n.widgets.findIndex((r) => r.contributionId === t);
33
+ }, Le = (e, n) => {
34
+ for (const t of Object.values(e.regions)) {
35
+ const o = t.widgets.findIndex((r) => r.contributionId === n);
36
36
  if (o >= 0) return {
37
- regionId: n.id,
37
+ regionId: t.id,
38
38
  index: o,
39
- placement: n.widgets[o]
39
+ placement: t.widgets[o]
40
40
  };
41
41
  }
42
- }, Me = (e, t, n) => {
42
+ }, Oe = (e, n, t) => {
43
43
  for (const o of Object.values(e.regions)) {
44
- const r = o.widgets.findIndex((i) => i.contributionId === t && i.resourceUri === n);
44
+ const r = o.widgets.findIndex((i) => i.contributionId === n && i.resourceUri === t);
45
45
  if (r >= 0) return {
46
46
  regionId: o.id,
47
47
  index: r,
48
48
  placement: o.widgets[r]
49
49
  };
50
50
  }
51
- }, re = (e, t) => {
52
- for (const n of Object.values(e.regions)) {
53
- const o = n.widgets.findIndex((r) => r.widgetId === t);
51
+ }, se = (e, n) => {
52
+ for (const t of Object.values(e.regions)) {
53
+ const o = t.widgets.findIndex((r) => r.widgetId === n);
54
54
  if (o >= 0) return {
55
- regionId: n.id,
55
+ regionId: t.id,
56
56
  index: o,
57
- placement: n.widgets[o]
57
+ placement: t.widgets[o]
58
58
  };
59
59
  }
60
- }, Le = (e, t) => {
61
- const n = new Set(Object.values(e.regions).flatMap((o) => o.widgets.map((r) => r.widgetId)));
62
- return Z(n, t);
63
- }, A = (e) => e.widgets.find((t) => t.widgetId === e.activeWidgetId) ?? e.widgets[0], W = (e) => e.role === "location", _ = (e) => e.resourceUri ?? `${e.contributionId}:${e.widgetId}`, V = (e, t, n, o) => {
64
- if (!t) return e;
65
- const r = _(t), c = {
60
+ }, xe = (e, n) => {
61
+ const t = new Set(Object.values(e.regions).flatMap((o) => o.widgets.map((r) => r.widgetId)));
62
+ return Y(t, n);
63
+ }, K = (e) => e.widgets.find((n) => n.widgetId === e.activeWidgetId) ?? e.widgets[0], R = (e) => e.role === "location", V = (e) => e.resourceUri ?? `${e.contributionId}:${e.widgetId}`, T = (e, n, t, o) => {
64
+ if (!n) return e;
65
+ const r = V(n), c = {
66
66
  ...e.locationSubPanelSelections?.[r] ?? {}
67
67
  };
68
- return o ? c[n] = o : delete c[n], {
68
+ return o ? c[t] = o : delete c[t], {
69
69
  ...e,
70
70
  locationSubPanelSelections: {
71
71
  ...e.locationSubPanelSelections,
72
72
  [r]: c
73
73
  }
74
74
  };
75
- }, T = (e, t) => {
75
+ }, q = (e, n) => {
76
76
  if (!e.locationSubPanelSelections) return e;
77
- const n = Object.fromEntries(Object.entries(e.locationSubPanelSelections).map(([o, r]) => [o, Object.fromEntries(Object.entries(r).filter(([, i]) => i !== t))]));
77
+ const t = Object.fromEntries(Object.entries(e.locationSubPanelSelections).map(([o, r]) => [o, Object.fromEntries(Object.entries(r).filter(([, i]) => i !== n))]));
78
78
  return {
79
79
  ...e,
80
- locationSubPanelSelections: n
80
+ locationSubPanelSelections: t
81
81
  };
82
- }, k = (e) => {
83
- const t = e.regions.main.widgets.filter(W);
84
- return t.find((n) => n.widgetId === e.activeLocationWidgetId) ?? t.at(-1);
85
- }, Oe = (e, t, n) => {
82
+ }, P = (e) => {
83
+ const n = e.regions.main.widgets.filter(R);
84
+ return n.find((t) => t.widgetId === e.activeLocationWidgetId) ?? n.at(-1);
85
+ }, Ce = (e, n, t) => {
86
86
  const o = {
87
87
  ...e
88
88
  };
89
- return n.resource ? (o.resource = n.resource, o.resourceUri = n.resource.uri, o.title = n.title ?? n.resource.label ?? t.title) : n.title !== void 0 && (o.title = n.title), n.pinned !== void 0 && (o.pinned = n.pinned), n.closable !== void 0 && (o.closable = n.closable), n.mountStrategy !== void 0 && (o.mountStrategy = n.mountStrategy), n.hiddenByDefault !== void 0 && (o.hiddenByDefault = n.hiddenByDefault), n.tabRetention !== void 0 && (o.tabRetention = n.tabRetention), n.tab !== void 0 && (o.tab = n.tab), n.ownerId !== void 0 && (o.ownerId = n.ownerId), n.source !== void 0 && (o.source = n.source), o;
90
- }, xe = (e, t, n) => ({
89
+ return t.resource ? (o.resource = t.resource, o.resourceUri = t.resource.uri, o.title = t.title ?? t.resource.label ?? n.title) : t.title !== void 0 && (o.title = t.title), t.pinned !== void 0 && (o.pinned = t.pinned), t.closable !== void 0 && (o.closable = t.closable), t.mountStrategy !== void 0 && (o.mountStrategy = t.mountStrategy), t.hiddenByDefault !== void 0 && (o.hiddenByDefault = t.hiddenByDefault), t.tabRetention !== void 0 && (o.tabRetention = t.tabRetention), t.tab !== void 0 && (o.tab = t.tab), t.ownerId !== void 0 && (o.ownerId = t.ownerId), t.source !== void 0 && (o.source = t.source), o;
90
+ }, Ue = (e, n, t) => ({
91
91
  widgetId: e,
92
- contributionId: t.id,
93
- ownerId: n.ownerId ?? t.ownerId,
94
- source: n.source ?? t.source,
95
- resource: n.resource,
96
- resourceUri: n.resource?.uri,
97
- title: n.title ?? n.resource?.label ?? t.title,
98
- pinned: n.pinned,
92
+ contributionId: n.id,
93
+ ownerId: t.ownerId ?? n.ownerId,
94
+ source: t.source ?? n.source,
95
+ resource: t.resource,
96
+ resourceUri: t.resource?.uri,
97
+ title: t.title ?? t.resource?.label ?? n.title,
98
+ pinned: t.pinned,
99
99
  // Tabbed (non-singleton) widgets are closable unless they opt out; singleton
100
100
  // panels stay non-closable by default.
101
- closable: n.closable ?? t.closable ?? !t.singleton,
102
- mountStrategy: n.mountStrategy ?? t.mountStrategy,
103
- hiddenByDefault: n.hiddenByDefault ?? t.hiddenByDefault,
104
- tabRetention: n.tabRetention,
105
- tab: n.tab ?? t.tab,
106
- role: t.role
107
- }), Ce = (e, t, n, o = {}) => {
108
- const r = e.regions[t], i = n(r.widgets), c = o.activeWidgetId !== void 0 ? o.activeWidgetId : o.clearActiveWidget ? void 0 : r.activeWidgetId;
101
+ closable: t.closable ?? n.closable ?? !n.singleton,
102
+ mountStrategy: t.mountStrategy ?? n.mountStrategy,
103
+ hiddenByDefault: t.hiddenByDefault ?? n.hiddenByDefault,
104
+ tabRetention: t.tabRetention,
105
+ tab: t.tab ?? n.tab,
106
+ role: n.role
107
+ }), je = (e, n, t, o = {}) => {
108
+ const r = e.regions[n], i = t(r.widgets), c = o.activeWidgetId !== void 0 ? o.activeWidgetId : o.clearActiveWidget ? void 0 : r.activeWidgetId;
109
109
  return {
110
110
  ...e,
111
- activeLocationWidgetId: t === "main" && !i.some((s) => s.widgetId === e.activeLocationWidgetId) ? i.filter(W).at(-1)?.widgetId : e.activeLocationWidgetId,
111
+ activeLocationWidgetId: n === "main" && !i.some((s) => s.widgetId === e.activeLocationWidgetId) ? i.filter(R).at(-1)?.widgetId : e.activeLocationWidgetId,
112
112
  regions: {
113
113
  ...e.regions,
114
- [t]: {
114
+ [n]: {
115
115
  ...r,
116
116
  widgets: i,
117
117
  activeWidgetId: c
118
118
  }
119
119
  }
120
120
  };
121
- }, Ue = (e, t) => {
122
- let n = e;
121
+ }, Ae = (e, n) => {
122
+ let t = e;
123
123
  for (const r of Object.values(e.regions)) {
124
- const i = r.widgets.filter((a) => a.contributionId === t), c = r.widgets.filter((a) => a.contributionId !== t);
124
+ const i = r.widgets.filter((a) => a.contributionId === n), c = r.widgets.filter((a) => a.contributionId !== n);
125
125
  if (c.length === r.widgets.length) continue;
126
126
  const s = r.activeWidgetId && !c.some((a) => a.widgetId === r.activeWidgetId) ? void 0 : r.activeWidgetId;
127
- n = {
128
- ...n,
127
+ t = {
128
+ ...t,
129
129
  regions: {
130
- ...n.regions,
130
+ ...t.regions,
131
131
  [r.id]: {
132
132
  ...r,
133
133
  widgets: c,
@@ -136,161 +136,162 @@ const h = (e) => {
136
136
  }
137
137
  };
138
138
  for (const a of i)
139
- n = T(n, a.widgetId);
139
+ t = q(t, a.widgetId);
140
140
  }
141
- const o = Object.values(n.regions).some((r) => r.widgets.some((i) => i.widgetId === n.activeWidgetId));
142
- return n.activeWidgetId && (!o || n.activeWidgetId.startsWith(`${t}:`) || n.activeWidgetId === t) && (n = {
143
- ...n,
141
+ const o = Object.values(t.regions).some((r) => r.widgets.some((i) => i.widgetId === t.activeWidgetId));
142
+ return t.activeWidgetId && (!o || t.activeWidgetId.startsWith(`${n}:`) || t.activeWidgetId === n) && (t = {
143
+ ...t,
144
144
  activeWidgetId: void 0,
145
145
  activeResourceUri: void 0
146
- }), n.activeLocationWidgetId && !n.regions.main.widgets.some((r) => r.widgetId === n.activeLocationWidgetId) && (n = {
147
- ...n,
148
- activeLocationWidgetId: n.regions.main.widgets.filter(W).at(-1)?.widgetId
149
- }), n;
150
- }, je = (e, t) => {
151
- const n = re(e, t);
152
- if (!n) return;
153
- const o = e.regions[n.regionId], r = o.widgets.filter((u) => u.widgetId !== t), i = o.activeWidgetId === t || !o.activeWidgetId && n.index === 0, s = (n.placement.role === "sub-panel" ? r.find((u) => u.role === "sub-panel" && u.ownerResourceUri === n.placement.ownerResourceUri) : void 0) ?? (n.placement.role === "sub-panel" && n.regionId === "main" ? k(e) : r[n.index] ?? r[n.index - 1]), a = i ? s?.widgetId : o.activeWidgetId, d = {
146
+ }), t.activeLocationWidgetId && !t.regions.main.widgets.some((r) => r.widgetId === t.activeLocationWidgetId) && (t = {
147
+ ...t,
148
+ activeLocationWidgetId: t.regions.main.widgets.filter(R).at(-1)?.widgetId
149
+ }), t;
150
+ }, Ke = (e, n) => {
151
+ const t = se(e, n);
152
+ if (!t) return;
153
+ const o = e.regions[t.regionId], r = o.widgets.filter((u) => u.widgetId !== n), i = o.activeWidgetId === n || !o.activeWidgetId && t.index === 0, s = (t.placement.role === "sub-panel" ? r.find((u) => u.role === "sub-panel" && u.ownerResourceUri === t.placement.ownerResourceUri) : void 0) ?? (t.placement.role === "sub-panel" && t.regionId === "main" ? P(e) : r[t.index] ?? r[t.index - 1]), a = i ? s?.widgetId : o.activeWidgetId, d = {
154
154
  ...o,
155
155
  widgets: r,
156
156
  activeWidgetId: a
157
157
  };
158
- let g = T({
158
+ let g = q({
159
159
  ...e,
160
- activeLocationWidgetId: e.activeLocationWidgetId === t ? e.regions.main.widgets.filter((u) => u.widgetId !== t && W(u)).at(-1)?.widgetId : e.activeLocationWidgetId,
160
+ activeLocationWidgetId: e.activeLocationWidgetId === n ? e.regions.main.widgets.filter((u) => u.widgetId !== n && R(u)).at(-1)?.widgetId : e.activeLocationWidgetId,
161
161
  regions: {
162
162
  ...e.regions,
163
163
  [o.id]: d
164
164
  }
165
- }, t);
166
- return i && n.regionId !== "side" && y.includes(n.regionId) && (g = V(g, k(g), n.regionId, s?.role === "sub-panel" ? s.widgetId : void 0)), e.activeWidgetId === t && (g = {
165
+ }, n);
166
+ return i && t.regionId !== "side" && k.includes(t.regionId) && (g = T(g, P(g), t.regionId, s?.role === "sub-panel" ? s.widgetId : void 0)), e.activeWidgetId === n && (g = {
167
167
  ...g,
168
168
  activeWidgetId: s?.widgetId,
169
169
  activeResourceUri: s?.resourceUri
170
170
  }), {
171
- regionId: n.regionId,
172
- closedPlacement: n.placement,
173
- activePlacement: A(d),
171
+ regionId: t.regionId,
172
+ closedPlacement: t.placement,
173
+ activePlacement: K(d),
174
174
  layout: g
175
175
  };
176
- }, Ae = (e, t, n) => {
177
- const o = e.regions[t];
178
- if (t === "main" && W(n)) {
179
- const i = e.locationSubPanelSelections?.[_(n)] ?? {}, c = {
176
+ }, Ee = (e, n, t) => {
177
+ const o = e.regions[n];
178
+ if (n === "main" && R(t)) {
179
+ const i = e.locationSubPanelSelections?.[V(t)] ?? {}, c = {
180
180
  ...e.regions
181
181
  };
182
- for (const s of y) {
183
- const a = c[s], d = i[s], g = a.widgets.find((u) => u.widgetId === d && u.role === "sub-panel" && (!u.ownerResourceUri || u.ownerResourceUri === n.resourceUri));
182
+ for (const s of k) {
183
+ const a = c[s], d = i[s], g = a.widgets.find((u) => u.widgetId === d && u.role === "sub-panel" && (!u.ownerResourceUri || u.ownerResourceUri === t.resourceUri));
184
184
  c[s] = {
185
185
  ...a,
186
- activeWidgetId: s === "side" ? a.activeWidgetId : g?.widgetId ?? (s === "main" ? n.widgetId : void 0)
186
+ activeWidgetId: s === "side" ? a.activeWidgetId : g?.widgetId ?? (s === "main" ? t.widgetId : void 0)
187
187
  };
188
188
  }
189
189
  return {
190
190
  ...e,
191
- activeWidgetId: n.widgetId,
192
- activeLocationWidgetId: n.widgetId,
193
- activeResourceUri: n.resourceUri,
191
+ activeWidgetId: t.widgetId,
192
+ activeLocationWidgetId: t.widgetId,
193
+ activeResourceUri: t.resourceUri,
194
194
  regions: c
195
195
  };
196
196
  }
197
- const r = n.role === "sub-panel" && t !== "side" && y.includes(t) ? V(e, k(e), t, n.widgetId) : e;
197
+ const r = t.role === "sub-panel" && n !== "side" && k.includes(n) ? T(e, P(e), n, t.widgetId) : e;
198
198
  return {
199
199
  ...r,
200
- activeWidgetId: n.widgetId,
200
+ activeWidgetId: t.widgetId,
201
201
  activeLocationWidgetId: e.activeLocationWidgetId,
202
- activeResourceUri: n.resourceUri,
202
+ activeResourceUri: t.resourceUri,
203
203
  regions: {
204
204
  ...r.regions,
205
- [t]: {
205
+ [n]: {
206
206
  ...o,
207
- activeWidgetId: n.widgetId
207
+ activeWidgetId: t.widgetId
208
208
  }
209
209
  }
210
210
  };
211
- }, oe = (e, t) => e.region === t || e.fallbackRegion === t, q = (e, t) => !(e.resourceKinds?.length && (!t || !e.resourceKinds.includes(t.kind)) || e.canOpen && (!t || !e.canOpen(t))), Ke = (e, t, n, o = {}) => {
212
- const r = e.regions[t];
213
- return r.widgets.find((i) => i.widgetId === r.activeWidgetId && i.role === "sub-panel" && (o.ignoreOwnerResourceUri || !i.ownerResourceUri || i.ownerResourceUri === n?.uri));
214
- }, Ee = (e) => k(e), F = (e, t, n, o) => {
211
+ }, ce = (e, n) => e.region === n || e.fallbackRegion === n, F = (e, n) => !(e.resourceKinds?.length && (!n || !e.resourceKinds.includes(n.kind)) || e.canOpen && (!n || !e.canOpen(n))), $e = (e, n, t, o = {}) => {
212
+ const r = e.regions[n];
213
+ return r.widgets.find((i) => i.widgetId === r.activeWidgetId && i.role === "sub-panel" && (o.ignoreOwnerResourceUri || !i.ownerResourceUri || i.ownerResourceUri === t?.uri));
214
+ }, De = (e) => P(e), z = (e, n, t, o) => {
215
215
  const r = e.eligibleLocations;
216
- return !(!z(e, n) || r?.resourceKinds?.length && (!t || !r.resourceKinds.includes(t.kind)) || r?.resourceIds?.length && (!t?.id || !r.resourceIds.includes(t.id)) || r?.canOpen && (!t || !r.canOpen(t)) || o?.ownerResourceUri && o.ownerResourceUri !== t?.uri);
217
- }, z = (e, t) => {
218
- const n = e.eligibleLocations?.modeIds;
219
- return !n?.length || t !== void 0 && n.includes(t);
220
- }, $e = (e, t, n, o, r = {}) => q(e, o.resource ?? t) ? r.ignoreResourceLocation ? z(e, n) : F(e, t, n, o) : !1, De = (e, t) => {
221
- const n = e.regions.main.widgets.find((o) => o.widgetId === e.regions.main.activeWidgetId) ?? k(e);
222
- return n ? t.find((o) => o.id === n.contributionId)?.floatingPanels !== "hidden" : !0;
223
- }, He = (e, t) => {
224
- const n = e.panelMenuOwner ?? {
216
+ return !(!N(e, t) || r?.resourceKinds?.length && (!n || !r.resourceKinds.includes(n.kind)) || r?.resourceIds?.length && (!n?.id || !r.resourceIds.includes(n.id)) || r?.canOpen && (!n || !r.canOpen(n)) || o?.ownerResourceUri && o.ownerResourceUri !== n?.uri);
217
+ }, N = (e, n) => {
218
+ const t = e.eligibleLocations?.modeIds;
219
+ return !t?.length || n !== void 0 && t.includes(n);
220
+ }, He = (e, n, t, o, r = {}) => F(e, o.resource ?? n) ? r.ignoreResourceLocation ? N(e, t) : z(e, n, t, o) : !1, Be = (e, n) => {
221
+ const t = e.regions.main.widgets.find((o) => o.widgetId === e.regions.main.activeWidgetId) ?? P(e);
222
+ return t ? n.find((o) => o.id === t.contributionId)?.floatingPanels !== "hidden" : !0;
223
+ }, _e = (e, n) => {
224
+ const t = e.panelMenuOwner ?? {
225
225
  level: "panel"
226
226
  };
227
- return t.subPanel ? n.level === "sub-panel" && t.subPanel.contributionId === n.contributionId : n.level === "panel" ? !n.contributionId || t.locationPanel?.contributionId === n.contributionId : !1;
228
- }, se = (e, t, n) => e.singleton && Object.values(t.regions).some((o) => o.widgets.some((r) => r.contributionId === e.id && r.ownerResourceUri === n?.uri)), ce = (e) => e.widget.role === "sub-panel" && oe(e.widget, e.region) && q(e.widget, e.resource) && F(e.widget, e.resource, e.modeId) && !se(e.widget, e.layout, e.resource), Be = (e) => e.widgets.filter((t) => ce({
227
+ return n.subPanel ? t.level === "sub-panel" && n.subPanel.contributionId === t.contributionId : t.level === "panel" ? !t.contributionId || n.locationPanel?.contributionId === t.contributionId : !1;
228
+ }, ae = (e, n, t) => e.singleton && Object.values(n.regions).some((o) => o.widgets.some((r) => r.contributionId === e.id && r.ownerResourceUri === t?.uri)), de = (e) => e.widget.role === "sub-panel" && ce(e.widget, e.region) && F(e.widget, e.resource) && z(e.widget, e.resource, e.modeId) && !ae(e.widget, e.layout, e.resource), Ve = (e) => e.widgets.filter((n) => de({
229
229
  ...e,
230
- widget: t
231
- })), ae = "workbench.core", N = (e = {}) => ({
230
+ widget: n
231
+ })), le = "workbench.core", G = (e = {}) => ({
232
232
  source: e.source ?? "module",
233
- ownerId: e.ownerId ?? ae,
233
+ ownerId: e.ownerId ?? le,
234
234
  priority: e.priority ?? 0
235
- }), x = (e, t) => t.priority - e.priority || e.ownerId.localeCompare(t.ownerId), de = (e) => Array.isArray(e) ? e : e.trim().split(/\s+/).filter(Boolean), le = (e) => {
236
- const t = de(e);
237
- return t.length === 1 ? t[0] ?? "" : t;
238
- }, _e = (e) => {
239
- const t = P({
235
+ }), C = (e, n) => n.priority - e.priority || e.ownerId.localeCompare(n.ownerId), ge = (e) => Array.isArray(e) ? e : e.trim().split(/\s+/).filter(Boolean), ue = (e) => {
236
+ const n = ge(e);
237
+ return n.length === 1 ? n[0] ?? "" : n;
238
+ }, Te = (e) => {
239
+ const n = W({
240
240
  name: "workbench.keybindings",
241
241
  initialState: {
242
242
  keybindings: []
243
243
  }
244
244
  });
245
245
  return {
246
- store: t,
247
- registerKeybinding(n, o) {
248
- if (!e.commands.getCommand(n.commandId)) throw new Error(`Keybinding command not registered: ${n.commandId}`);
246
+ store: n,
247
+ registerKeybinding(t, o) {
248
+ if (!e.commands.getCommand(t.commandId)) throw new Error(`Keybinding command not registered: ${t.commandId}`);
249
249
  const r = {
250
- ...N(o),
251
- ...n,
252
- keybinding: le(n.keybinding)
253
- }, i = t.getState();
254
- return t.setState({
250
+ ...G(o),
251
+ ...t,
252
+ keybinding: ue(t.keybinding)
253
+ }, i = n.getState();
254
+ return n.setState({
255
255
  keybindings: [...i.keybindings, r]
256
256
  }, !1, "registerKeybinding"), h(() => {
257
- const c = t.getState(), s = c.keybindings.filter((a) => a !== r);
258
- s.length !== c.keybindings.length && t.setState({
257
+ const c = n.getState(), s = c.keybindings.filter((a) => a !== r);
258
+ s.length !== c.keybindings.length && n.setState({
259
259
  keybindings: s
260
260
  }, !1, "unregisterKeybinding");
261
261
  });
262
262
  },
263
263
  listKeybindings() {
264
- return [...t.getState().keybindings].sort(x);
264
+ return [...n.getState().keybindings].sort(C);
265
265
  },
266
266
  listActiveKeybindings() {
267
- return t.getState().keybindings.filter((n) => e.context.matches(n.when)).sort(x);
267
+ return n.getState().keybindings.filter((t) => e.context.matches(t.when)).sort(C);
268
268
  }
269
269
  };
270
- }, Ve = (e = {}) => {
270
+ }, qe = (e = {}, n) => {
271
271
  const {
272
272
  strategy: t,
273
- ...n
273
+ ...o
274
274
  } = e;
275
- return t ? t.kind === "activate-or-open" ? {
276
- ...n,
275
+ return t ? t.kind === "persistent" ? {
276
+ ...o,
277
277
  tabPosition: t.position,
278
278
  tabRetention: "persistent"
279
279
  } : t.kind === "replace-active" ? {
280
- ...n,
280
+ ...o,
281
281
  replaceActive: !0
282
282
  } : t.kind === "replace-panel" ? {
283
- ...n,
284
- replaceWidgetId: t.instanceId
283
+ ...o,
284
+ replaceWidgetId: t.instanceId,
285
+ tabRetention: t.retention
285
286
  } : {
286
- ...n,
287
+ ...o,
287
288
  tabRetention: "preview",
288
289
  tabPosition: t.position
289
290
  } : {
290
- ...n,
291
- tabRetention: "persistent"
291
+ ...o,
292
+ tabRetention: n
292
293
  };
293
- }, Te = (e) => ({
294
+ }, Fe = (e) => ({
294
295
  instanceId: e.widgetId,
295
296
  panelId: e.contributionId,
296
297
  ownerId: e.ownerId,
@@ -305,26 +306,26 @@ const h = (e) => {
305
306
  hiddenByDefault: e.hiddenByDefault,
306
307
  tabRetention: e.tabRetention,
307
308
  tab: e.tab
308
- }), qe = (e) => {
309
+ }), ze = (e) => {
309
310
  const {
310
- ownedPanelMenuIds: t,
311
- role: n,
311
+ ownedPanelMenuIds: n,
312
+ role: t,
312
313
  ...o
313
314
  } = e;
314
315
  return {
315
316
  ...o,
316
317
  closable: o.closable === !0
317
318
  };
318
- }, Fe = (e, t) => A(e.regions[X(t)])?.resource, ze = ({
319
+ }, Ne = (e, n) => K(e.regions[ee(n)])?.resource, Ge = ({
319
320
  layout: e,
320
- primary: t,
321
- isInScope: n
321
+ primary: n,
322
+ isInScope: t
322
323
  }) => {
323
324
  const o = [];
324
- for (const r of Y()) {
325
- const i = ee(r);
325
+ for (const r of te()) {
326
+ const i = ne(r);
326
327
  if (i.role !== "anchor" || i.persistence === "primary") continue;
327
- const c = A(e.regions[r]);
328
+ const c = K(e.regions[r]);
328
329
  if (c?.resource) {
329
330
  if (c.role === "sub-panel" && c.ownerResourceUri) {
330
331
  o.push({
@@ -342,60 +343,60 @@ const h = (e) => {
342
343
  }
343
344
  o.push({
344
345
  region: r,
345
- action: n(c.resource, t) ? "keep" : "clear"
346
+ action: t(c.resource, n) ? "keep" : "clear"
346
347
  });
347
348
  }
348
349
  }
349
350
  return o;
350
- }, E = (e) => e ? Array.isArray(e) ? [...e] : [e] : [], p = {
351
+ }, $ = (e) => e ? Array.isArray(e) ? [...e] : [e] : [], p = {
351
352
  main: ["main-header", "main-left-menu", "main", "main-right-menu"],
352
353
  secondary: ["secondary-header", "secondary-left-menu", "secondary", "secondary-right-menu"],
353
354
  side: ["side-header", "side-left-menu", "side", "side-right-menu"]
354
- }, $ = Object.values(p).flat(), C = (e) => e.panels ?? y, Ne = (e) => Object.keys(p).find((t) => p[t].some((n) => n === e)), Ge = (e, t) => !e || C(e).includes(t), m = (e, t) => {
355
- if (t)
356
- return Object.values(e.regions).flatMap((n) => n.widgets).find((n) => n.widgetId === t);
357
- }, U = (e, t) => {
358
- const n = t.find((o) => o && m(e, o.widgetId));
355
+ }, D = Object.values(p).flat(), U = (e) => e.panels ?? k, Je = (e) => Object.keys(p).find((n) => p[n].some((t) => t === e)), Qe = (e, n) => !e || U(e).includes(n), m = (e, n) => {
356
+ if (n)
357
+ return Object.values(e.regions).flatMap((t) => t.widgets).find((t) => t.widgetId === n);
358
+ }, j = (e, n) => {
359
+ const t = n.find((o) => o && m(e, o.widgetId));
359
360
  return {
360
361
  ...e,
361
- activeWidgetId: n?.widgetId,
362
- activeResourceUri: n?.resourceUri
362
+ activeWidgetId: t?.widgetId,
363
+ activeResourceUri: t?.resourceUri
363
364
  };
364
- }, ge = (e, t) => {
365
- if (t.length === 0) return e;
366
- const n = new Set(Object.keys(p).filter((a) => p[a].some((d) => t.includes(d)))), o = t.some((a) => {
365
+ }, fe = (e, n) => {
366
+ if (n.length === 0) return e;
367
+ const t = new Set(Object.keys(p).filter((a) => p[a].some((d) => n.includes(d)))), o = n.some((a) => {
367
368
  const d = e.regions[a];
368
369
  return d.widgets.length > 0 || d.activeWidgetId !== void 0 || d.visible;
369
- }), r = Object.values(e.locationSubPanelSelections ?? {}).some((a) => Object.keys(a).some((d) => n.has(d)));
370
+ }), r = Object.values(e.locationSubPanelSelections ?? {}).some((a) => Object.keys(a).some((d) => t.has(d)));
370
371
  if (!o && !r) return e;
371
372
  const i = {
372
373
  ...e.regions
373
374
  };
374
- for (const a of t)
375
+ for (const a of n)
375
376
  i[a] = {
376
377
  ...i[a],
377
378
  widgets: [],
378
379
  activeWidgetId: void 0,
379
380
  visible: !1
380
381
  };
381
- const c = Object.fromEntries(Object.entries(e.locationSubPanelSelections ?? {}).map(([a, d]) => [a, Object.fromEntries(Object.entries(d).filter(([g]) => !n.has(g)))])), s = {
382
+ const c = Object.fromEntries(Object.entries(e.locationSubPanelSelections ?? {}).map(([a, d]) => [a, Object.fromEntries(Object.entries(d).filter(([g]) => !t.has(g)))])), s = {
382
383
  ...e,
383
384
  regions: i
384
385
  };
385
386
  return {
386
- ...U(s, [m(s, e.activeWidgetId)]),
387
+ ...j(s, [m(s, e.activeWidgetId)]),
387
388
  activeLocationWidgetId: m(s, e.activeLocationWidgetId)?.widgetId,
388
389
  locationSubPanelSelections: c
389
390
  };
390
- }, j = (e, t) => {
391
- const n = new Set(t), o = Object.keys(p).filter((r) => !n.has(r)).flatMap((r) => p[r]);
392
- return ge(e, o);
393
- }, ue = (e, t, n) => {
394
- if (!t) {
391
+ }, A = (e, n) => {
392
+ const t = new Set(n), o = Object.keys(p).filter((r) => !t.has(r)).flatMap((r) => p[r]);
393
+ return fe(e, o);
394
+ }, ve = (e, n, t) => {
395
+ if (!n) {
395
396
  const s = {
396
397
  ...e.regions
397
398
  };
398
- for (const d of $) {
399
+ for (const d of D) {
399
400
  const g = s[d], u = g.widgets.filter((b) => b.role !== "content");
400
401
  s[d] = {
401
402
  ...g,
@@ -407,150 +408,152 @@ const h = (e) => {
407
408
  ...e,
408
409
  regions: s
409
410
  };
410
- return j({
411
- ...U(a, [m(a, e.activeWidgetId)]),
411
+ return A({
412
+ ...j(a, [m(a, e.activeWidgetId)]),
412
413
  activeLocationWidgetId: m(a, e.activeLocationWidgetId)?.widgetId
413
- }, n);
414
+ }, t);
414
415
  }
415
416
  const o = {
416
417
  ...e.regions
417
418
  };
418
- for (const s of $) o[s] = t.regions[s];
419
- const r = j({
419
+ for (const s of D) o[s] = n.regions[s];
420
+ const r = A({
420
421
  ...e,
421
422
  regions: o
422
- }, n), i = m(r, t.activeWidgetId), c = m(r, e.activeWidgetId);
423
+ }, t), i = m(r, n.activeWidgetId), c = m(r, e.activeWidgetId);
423
424
  return {
424
- ...U(r, [i, c]),
425
- activeLocationWidgetId: m(r, t.activeLocationWidgetId)?.widgetId ?? m(r, e.activeLocationWidgetId)?.widgetId,
426
- locationSubPanelSelections: t.locationSubPanelSelections
425
+ ...j(r, [i, c]),
426
+ activeLocationWidgetId: m(r, n.activeLocationWidgetId)?.widgetId ?? m(r, e.activeLocationWidgetId)?.widgetId,
427
+ locationSubPanelSelections: n.locationSubPanelSelections
427
428
  };
428
- }, O = (e) => {
429
- for (let t = e.length - 1; t >= 0; t -= 1)
430
- e[t]?.dispose();
431
- }, D = (e, t) => {
432
- t !== e.layout.getLayout() && e.layout.restoreLayout(t);
433
- for (const n of y) e.panels.setOpen(n, t.regions[n].visible);
434
- }, Je = (e) => {
435
- const t = P({
429
+ }, x = (e) => {
430
+ for (let n = e.length - 1; n >= 0; n -= 1)
431
+ e[n]?.dispose();
432
+ }, H = (e, n) => {
433
+ n !== e.layout.getLayout() && e.layout.restoreLayout(n);
434
+ for (const t of k) e.panels.setOpen(t, n.regions[t].visible);
435
+ }, Ze = (e) => {
436
+ const n = W({
436
437
  name: "workbench.modes",
437
438
  initialState: {
438
439
  modes: {},
439
440
  activeModeId: void 0
440
441
  }
441
- }), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map();
442
+ }), t = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map();
442
443
  let i = [], c, s, a = !1;
443
444
  const d = (l) => {
444
- if (n.has(l.id)) return;
445
- const f = E(l.activate(e.resolveContext()));
446
- n.set(l.id, f);
445
+ if (t.has(l.id)) return;
446
+ const f = $(l.activate(e.resolveContext()));
447
+ t.set(l.id, f);
447
448
  }, g = (l) => {
448
- const f = e.resolveContext(), v = `${l.id}\0${f.layout.getPersistenceScope() ?? "unscoped"}`, S = f.layout.getLayout(), w = j(S, C(l));
449
- if (D(f, w), o.has(v)) return;
449
+ const f = e.resolveContext(), v = `${l.id}\0${f.layout.getPersistenceScope() ?? "unscoped"}`, S = f.layout.getLayout(), w = A(S, U(l));
450
+ if (H(f, w), o.has(v)) return;
450
451
  let I = !1, L = () => {
451
452
  };
452
- const K = () => {
453
+ const E = () => {
453
454
  if (I) return;
454
- const R = f.layout.getActivePanel("main");
455
- R && (I = !0, L(), e.establishLocation?.(R.instanceId));
455
+ const y = f.layout.getActivePanel("main");
456
+ if (!y) return;
457
+ const O = f.layout.getLayout().regions.main.widgets.find((X) => X.widgetId === y.instanceId);
458
+ O && (O.role === "sub-panel" || O.role === "panel-menu") || (I = !0, L(), e.establishLocation?.(y.instanceId));
456
459
  };
457
- L = f.layout.store.subscribeSelector((R) => R.layout.regions.main, K);
460
+ L = f.layout.store.subscribeSelector((y) => y.layout.regions.main, E);
458
461
  try {
459
- l.seed?.(f), K(), o.add(v);
462
+ l.seed?.(f), E(), o.add(v);
460
463
  } finally {
461
464
  L();
462
465
  }
463
466
  }, u = () => {
464
- O(i), i = [], c?.dispose(), c = void 0;
467
+ x(i), i = [], c?.dispose(), c = void 0;
465
468
  }, b = (l, f) => {
466
- const v = e.resolveContext(), S = t.getState().modes[l];
469
+ const v = e.resolveContext(), S = n.getState().modes[l];
467
470
  if (!S) throw new Error(`Workbench mode not registered: ${l}`);
468
471
  const w = v.context.createScope("workbench.mode");
469
472
  w.set("activeWorkbenchMode", l), w.set(`workbenchMode.${l}`, !0), c = w;
470
473
  try {
471
- d(S), t.setState({
472
- ...t.getState(),
474
+ d(S), n.setState({
475
+ ...n.getState(),
473
476
  activeModeId: l
474
- }, !1, "activateMode"), f.seed && g(S), i = E(S.enter?.(v));
477
+ }, !1, "activateMode"), f.seed && g(S), i = $(S.enter?.(v));
475
478
  } catch (I) {
476
- throw u(), t.setState({
477
- ...t.getState(),
479
+ throw u(), n.setState({
480
+ ...n.getState(),
478
481
  activeModeId: void 0
479
482
  }, !1, "deactivateMode"), I;
480
483
  }
481
- }, J = e.resolveContext().layout.onDidChangePersistenceScope(() => {
482
- const l = t.getState().activeModeId;
484
+ }, Q = e.resolveContext().layout.onDidChangePersistenceScope(() => {
485
+ const l = n.getState().activeModeId;
483
486
  if (l === s) return;
484
- const f = l ? t.getState().modes[l] : void 0;
487
+ const f = l ? n.getState().modes[l] : void 0;
485
488
  f && g(f);
486
- }), Q = h(() => {
487
- J.dispose(), u();
488
- for (const l of n.values()) O(l);
489
- n.clear(), o.clear(), r.clear(), t.setState({
489
+ }), Z = h(() => {
490
+ Q.dispose(), u();
491
+ for (const l of t.values()) x(l);
492
+ t.clear(), o.clear(), r.clear(), n.setState({
490
493
  modes: {},
491
494
  activeModeId: void 0
492
495
  }, !1, "disposeModes");
493
496
  });
494
497
  return {
495
- store: t,
498
+ store: n,
496
499
  dispose() {
497
- Q.dispose();
500
+ Z.dispose();
498
501
  },
499
502
  registerMode(l) {
500
- const f = t.getState();
503
+ const f = n.getState();
501
504
  if (f.modes[l.id]) throw new Error(`Workbench mode already registered: ${l.id}`);
502
- return t.setState({
505
+ return n.setState({
503
506
  ...f,
504
507
  modes: {
505
508
  ...f.modes,
506
509
  [l.id]: l
507
510
  }
508
511
  }, !1, "registerMode"), h(() => {
509
- const v = t.getState();
512
+ const v = n.getState();
510
513
  if (v.modes[l.id] !== l) return;
511
- v.activeModeId === l.id && (u(), t.setState({
512
- ...t.getState(),
514
+ v.activeModeId === l.id && (u(), n.setState({
515
+ ...n.getState(),
513
516
  activeModeId: void 0
514
- }, !1, "deactivateMode")), O(n.get(l.id) ?? []), n.delete(l.id), r.delete(l.id);
517
+ }, !1, "deactivateMode")), x(t.get(l.id) ?? []), t.delete(l.id), r.delete(l.id);
515
518
  for (const I of o)
516
519
  I.startsWith(`${l.id}\0`) && o.delete(I);
517
520
  const {
518
521
  [l.id]: S,
519
522
  ...w
520
523
  } = v.modes;
521
- t.setState({
522
- ...t.getState(),
524
+ n.setState({
525
+ ...n.getState(),
523
526
  modes: w
524
527
  }, !1, "unregisterMode");
525
528
  });
526
529
  },
527
530
  getMode(l) {
528
- return t.getState().modes[l];
531
+ return n.getState().modes[l];
529
532
  },
530
533
  listModes() {
531
- return Object.values(t.getState().modes);
534
+ return Object.values(n.getState().modes);
532
535
  },
533
536
  getActiveModeId() {
534
- return t.getState().activeModeId;
537
+ return n.getState().activeModeId;
535
538
  },
536
539
  isTransitioning() {
537
540
  return a;
538
541
  },
539
542
  setActiveMode(l, f = {}) {
540
- if (l !== t.getState().activeModeId) {
543
+ if (l !== n.getState().activeModeId) {
541
544
  a = !0, s = f.deferSeed ? l : void 0;
542
545
  try {
543
- const v = e.resolveContext(), S = t.getState().activeModeId;
546
+ const v = e.resolveContext(), S = n.getState().activeModeId;
544
547
  if (S && v.layout.getPersistenceScope() === void 0 && r.set(S, v.layout.getLayout()), u(), l === void 0) {
545
- t.setState({
546
- ...t.getState(),
548
+ n.setState({
549
+ ...n.getState(),
547
550
  activeModeId: void 0
548
551
  }, !1, "deactivateMode");
549
552
  return;
550
553
  }
551
- const w = t.getState().modes[l];
554
+ const w = n.getState().modes[l];
552
555
  if (!w) throw new Error(`Workbench mode not registered: ${l}`);
553
- v.layout.getPersistenceScope() === void 0 && D(v, ue(v.layout.getLayout(), r.get(l), C(w))), b(l, {
556
+ v.layout.getPersistenceScope() === void 0 && H(v, ve(v.layout.getLayout(), r.get(l), U(w))), b(l, {
554
557
  seed: s !== l
555
558
  });
556
559
  } finally {
@@ -559,27 +562,27 @@ const h = (e) => {
559
562
  }
560
563
  },
561
564
  seedActiveMode() {
562
- const l = t.getState().activeModeId, f = l ? t.getState().modes[l] : void 0;
565
+ const l = n.getState().activeModeId, f = l ? n.getState().modes[l] : void 0;
563
566
  s = void 0, f && g(f);
564
567
  },
565
568
  onDidChangeActive(l) {
566
- const f = t.subscribeSelector((v) => v.activeModeId, () => l());
569
+ const f = n.subscribeSelector((v) => v.activeModeId, () => l());
567
570
  return h(f);
568
571
  }
569
572
  };
570
- }, M = (e, t) => {
573
+ }, M = (e, n) => {
571
574
  const {
572
- [t]: n,
575
+ [n]: t,
573
576
  ...o
574
577
  } = e;
575
578
  return o;
576
- }, fe = () => {
579
+ }, be = () => {
577
580
  if (typeof document > "u")
578
581
  throw new Error("workbench.renderers.registerRenderer({ keepAlive: true }): no DOM available. The default host factory uses document.createElement. In a non-browser environment (Bun tests, SSR), pass a custom factory via createWorkbenchCore({ renderers: { createHost: () => myHost } }).");
579
582
  const e = document.createElement("div");
580
583
  return e.style.display = "contents", e.dataset.workbenchKeepAliveHost = "", e;
581
- }, Qe = (e = {}) => {
582
- const t = e.createHost ?? fe, n = P({
584
+ }, Xe = (e = {}) => {
585
+ const n = e.createHost ?? be, t = W({
583
586
  name: "workbench.renderers",
584
587
  initialState: {
585
588
  renderers: {},
@@ -587,8 +590,8 @@ const h = (e) => {
587
590
  claims: {}
588
591
  }
589
592
  }), o = (i) => {
590
- const c = n.getState(), s = c.hosts[i], a = s?.attachedTo;
591
- !s || !a || (a.contains(s.host) && a.removeChild(s.host), n.setState({
593
+ const c = t.getState(), s = c.hosts[i], a = s?.attachedTo;
594
+ !s || !a || (a.contains(s.host) && a.removeChild(s.host), t.setState({
592
595
  ...c,
593
596
  hosts: {
594
597
  ...c.hosts,
@@ -600,18 +603,18 @@ const h = (e) => {
600
603
  claims: M(c.claims, i)
601
604
  }, !1, "renderers.detach"));
602
605
  }, r = {
603
- store: n,
606
+ store: t,
604
607
  registerRenderer(i) {
605
- const c = n.getState();
608
+ const c = t.getState();
606
609
  if (c.renderers[i.id]) throw new Error(`Renderer already registered: ${i.id}`);
607
- const s = i.keepAlive ? t() : void 0, a = s ? {
610
+ const s = i.keepAlive ? n() : void 0, a = s ? {
608
611
  ...c.hosts,
609
612
  [i.id]: {
610
613
  rendererId: i.id,
611
614
  host: s
612
615
  }
613
616
  } : c.hosts;
614
- return n.setState({
617
+ return t.setState({
615
618
  ...c,
616
619
  renderers: {
617
620
  ...c.renderers,
@@ -619,10 +622,10 @@ const h = (e) => {
619
622
  },
620
623
  hosts: a
621
624
  }, !1, "registerRenderer"), h(() => {
622
- if (n.getState().renderers[i.id] !== i) return;
625
+ if (t.getState().renderers[i.id] !== i) return;
623
626
  i.keepAlive && o(i.id);
624
- const g = n.getState();
625
- n.setState({
627
+ const g = t.getState();
628
+ t.setState({
626
629
  ...g,
627
630
  renderers: M(g.renderers, i.id),
628
631
  hosts: M(g.hosts, i.id),
@@ -631,23 +634,23 @@ const h = (e) => {
631
634
  });
632
635
  },
633
636
  getRenderer(i) {
634
- return n.getState().renderers[i];
637
+ return t.getState().renderers[i];
635
638
  },
636
639
  listRenderers() {
637
- return Object.values(n.getState().renderers);
640
+ return Object.values(t.getState().renderers);
638
641
  },
639
642
  onDidChange(i) {
640
- const c = n.subscribeSelector((s) => s.renderers, () => i());
643
+ const c = t.subscribeSelector((s) => s.renderers, () => i());
641
644
  return h(c);
642
645
  },
643
646
  claim(i, c, s) {
644
- const a = n.getState(), d = a.renderers[i];
647
+ const a = t.getState(), d = a.renderers[i];
645
648
  if (!d) throw new Error(`Renderer is not registered: ${i}`);
646
649
  if (!d.keepAlive) throw new Error(`Renderer ${i} is not keep-alive; cannot claim`);
647
650
  const g = a.hosts[i];
648
651
  if (!g) throw new Error(`Renderer ${i} has no host`);
649
652
  if (g.attachedTo === c)
650
- n.setState({
653
+ t.setState({
651
654
  ...a,
652
655
  claims: {
653
656
  ...a.claims,
@@ -656,8 +659,8 @@ const h = (e) => {
656
659
  }, !1, "renderers.updateClaim");
657
660
  else {
658
661
  o(i);
659
- const u = n.getState(), b = u.hosts[i];
660
- c.appendChild(b.host), n.setState({
662
+ const u = t.getState(), b = u.hosts[i];
663
+ c.appendChild(b.host), t.setState({
661
664
  ...u,
662
665
  hosts: {
663
666
  ...u.hosts,
@@ -673,44 +676,44 @@ const h = (e) => {
673
676
  }, !1, "renderers.attach");
674
677
  }
675
678
  return h(() => {
676
- const b = n.getState().hosts[i];
679
+ const b = t.getState().hosts[i];
677
680
  !b || b.attachedTo !== c || o(i);
678
681
  });
679
682
  },
680
683
  getHost(i) {
681
- return n.getState().hosts[i]?.host;
684
+ return t.getState().hosts[i]?.host;
682
685
  },
683
686
  getClaim(i) {
684
- return n.getState().claims[i];
687
+ return t.getState().claims[i];
685
688
  }
686
689
  };
687
690
  for (const i of e.initialRenderers ?? []) r.registerRenderer(i);
688
691
  return r;
689
- }, Ze = {
692
+ }, Ye = {
690
693
  project: "folder-root",
691
694
  workspace: "computer",
692
695
  worktree: "git-pull-request-draft",
693
696
  settings: "settings",
694
697
  kanbanRenderer: "table-properties"
695
- }, ve = "workbench.resource.kind", be = "workbench.resource.id", he = (e) => `workbench.resource.metadata.${e}`, G = "workbench.selectionResourceUri", Se = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean", Xe = (e) => {
698
+ }, he = "workbench.resource.kind", Se = "workbench.resource.id", we = (e) => `workbench.resource.metadata.${e}`, J = "workbench.selectionResourceUri", me = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean", et = (e) => {
696
699
  if (!e) return {};
697
- const t = {
698
- [ve]: e.kind,
699
- [be]: e.id ?? e.uri
700
+ const n = {
701
+ [he]: e.kind,
702
+ [Se]: e.id ?? e.uri
700
703
  };
701
- for (const [n, o] of Object.entries(e.metadata ?? {}))
702
- Se(o) && (t[he(n)] = o);
703
- return t;
704
- }, Ye = (e) => ({
705
- [G]: e.uri
706
- }), et = (e) => {
704
+ for (const [t, o] of Object.entries(e.metadata ?? {}))
705
+ me(o) && (n[we(t)] = o);
706
+ return n;
707
+ }, tt = (e) => ({
708
+ [J]: e.uri
709
+ }), nt = (e) => {
707
710
  if (!e) return [];
708
- const t = e.metadata?.[G];
709
- return typeof t != "string" || t === e.uri ? [e.uri] : [e.uri, t];
710
- }, H = (e) => [...e].sort((t, n) => n.priority - t.priority || t.id.localeCompare(n.id)), B = (e) => [...e].sort((t, n) => n.priority - t.priority || t.id.localeCompare(n.id)), we = (e) => (typeof e == "object" || typeof e == "function") && e !== null && "then" in e && typeof e.then == "function", tt = (e = {}) => {
711
- const t = /* @__PURE__ */ new Set(), n = e.establishLocation;
711
+ const n = e.metadata?.[J];
712
+ return typeof n != "string" || n === e.uri ? [e.uri] : [e.uri, n];
713
+ }, B = (e) => [...e].sort((n, t) => t.priority - n.priority || n.id.localeCompare(t.id)), _ = (e) => [...e].sort((n, t) => t.priority - n.priority || n.id.localeCompare(t.id)), Ie = (e) => (typeof e == "object" || typeof e == "function") && e !== null && "then" in e && typeof e.then == "function", it = (e = {}) => {
714
+ const n = /* @__PURE__ */ new Set(), t = e.establishLocation;
712
715
  let o = 0;
713
- const r = P({
716
+ const r = W({
714
717
  name: "workbench.resources",
715
718
  initialState: {
716
719
  kinds: {},
@@ -725,7 +728,7 @@ const h = (e) => {
725
728
  const s = r.getState();
726
729
  if (s.kinds[i.kind]) throw new Error(`Resource kind already registered: ${i.kind}`);
727
730
  const a = {
728
- ...N(c),
731
+ ...G(c),
729
732
  ...i
730
733
  };
731
734
  return r.setState({
@@ -754,7 +757,7 @@ const h = (e) => {
754
757
  return r.getState().kinds[i.kind]?.surface;
755
758
  },
756
759
  listKinds() {
757
- return Object.values(r.getState().kinds).sort(x);
760
+ return Object.values(r.getState().kinds).sort(C);
758
761
  },
759
762
  registerPresenter(i) {
760
763
  const c = r.getState();
@@ -783,7 +786,7 @@ const h = (e) => {
783
786
  });
784
787
  },
785
788
  listPresenters() {
786
- return H(Object.values(r.getState().presenters));
789
+ return B(Object.values(r.getState().presenters));
787
790
  },
788
791
  registerProvider(i) {
789
792
  const c = r.getState();
@@ -846,11 +849,11 @@ const h = (e) => {
846
849
  });
847
850
  },
848
851
  listHierarchyProviders() {
849
- return B(Object.values(r.getState().hierarchyProviders));
852
+ return _(Object.values(r.getState().hierarchyProviders));
850
853
  },
851
854
  walkHierarchy(i) {
852
855
  if (!i) return [];
853
- const c = B(Object.values(r.getState().hierarchyProviders)), s = [i], a = /* @__PURE__ */ new Set([i.uri]);
856
+ const c = _(Object.values(r.getState().hierarchyProviders)), s = [i], a = /* @__PURE__ */ new Set([i.uri]);
854
857
  let d = i;
855
858
  for (; ; ) {
856
859
  const u = c.find((b) => b.canResolve(d))?.getParent(d);
@@ -865,47 +868,47 @@ const h = (e) => {
865
868
  async openResource(i, c = {}) {
866
869
  const s = r.getState();
867
870
  if (!s.kinds[i.kind]) throw new Error(`Unknown resource kind: ${i.kind}`);
868
- const a = H(Object.values(s.presenters)).find((g) => g.canOpen(i));
871
+ const a = B(Object.values(s.presenters)).find((g) => g.canOpen(i));
869
872
  if (!a) throw new Error(`No presenter registered for resource kind: ${i.kind}`);
870
873
  o += 1;
871
874
  let d;
872
875
  try {
873
876
  const g = a.open(i, c);
874
- d = we(g) ? await g : g, d = n?.(d) ?? d;
877
+ d = Ie(g) ? await g : g, d = t?.(d) ?? d;
875
878
  } finally {
876
879
  o -= 1;
877
880
  }
878
- for (const g of t) g(i);
881
+ for (const g of n) g(i);
879
882
  return d;
880
883
  },
881
884
  onDidOpenResource(i) {
882
- return t.add(i), h(() => {
883
- t.delete(i);
885
+ return n.add(i), h(() => {
886
+ n.delete(i);
884
887
  });
885
888
  }
886
889
  };
887
- }, me = (e) => e.replace(/^['"]|['"]$/g, ""), Ie = (e, t) => {
888
- const n = t.trim();
889
- if (n.length === 0) return !0;
890
- const o = n.match(/^([A-Za-z0-9_.-]+)\s*(==|!=)\s*(.+)$/);
890
+ }, pe = (e) => e.replace(/^['"]|['"]$/g, ""), ye = (e, n) => {
891
+ const t = n.trim();
892
+ if (t.length === 0) return !0;
893
+ const o = t.match(/^([A-Za-z0-9_.-]+)\s*(==|!=)\s*(.+)$/);
891
894
  if (o) {
892
- const [, r, i, c] = o, s = e[r ?? ""], a = me(c ?? "");
895
+ const [, r, i, c] = o, s = e[r ?? ""], a = pe(c ?? "");
893
896
  return i === "==" ? String(s) === a : String(s) !== a;
894
897
  }
895
- return n.startsWith("!") ? !e[n.slice(1)] : !!e[n];
896
- }, pe = (e, t) => t ? t.split("||").some((n) => n.split("&&").every((o) => Ie(e, o))) : !0, nt = () => {
897
- const e = P({
898
+ return t.startsWith("!") ? !e[t.slice(1)] : !!e[t];
899
+ }, ke = (e, n) => n ? n.split("||").some((t) => t.split("&&").every((o) => ye(e, o))) : !0, rt = () => {
900
+ const e = W({
898
901
  name: "workbench.context",
899
902
  initialState: {
900
903
  values: {}
901
904
  }
902
905
  });
903
- let t = {};
904
- const n = /* @__PURE__ */ new Map(), o = () => {
906
+ let n = {};
907
+ const t = /* @__PURE__ */ new Map(), o = () => {
905
908
  const i = {
906
- ...t
909
+ ...n
907
910
  };
908
- for (const c of n.values()) Object.assign(i, c);
911
+ for (const c of t.values()) Object.assign(i, c);
909
912
  return i;
910
913
  }, r = (i) => {
911
914
  e.setState({
@@ -915,8 +918,8 @@ const h = (e) => {
915
918
  return {
916
919
  store: e,
917
920
  set(i, c) {
918
- t[i] !== c && (t = {
919
- ...t,
921
+ n[i] !== c && (n = {
922
+ ...n,
920
923
  [i]: c
921
924
  }, r("setContextKey"));
922
925
  },
@@ -924,15 +927,15 @@ const h = (e) => {
924
927
  return e.getState().values[i];
925
928
  },
926
929
  delete(i) {
927
- if (!(i in t)) return;
930
+ if (!(i in n)) return;
928
931
  const {
929
932
  [i]: c,
930
933
  ...s
931
- } = t;
932
- t = s, r("deleteContextKey");
934
+ } = n;
935
+ n = s, r("deleteContextKey");
933
936
  },
934
937
  createScope(i) {
935
- n.set(i, n.get(i) ?? {});
938
+ t.set(i, t.get(i) ?? {});
936
939
  let c = !1;
937
940
  const s = () => {
938
941
  if (c) throw new Error(`Context key scope disposed: ${i}`);
@@ -941,32 +944,32 @@ const h = (e) => {
941
944
  ownerId: i,
942
945
  set(a, d) {
943
946
  s();
944
- const g = n.get(i) ?? {};
945
- g[a] !== d && (n.set(i, {
947
+ const g = t.get(i) ?? {};
948
+ g[a] !== d && (t.set(i, {
946
949
  ...g,
947
950
  [a]: d
948
951
  }), r("setScopedContextKey"));
949
952
  },
950
953
  get(a) {
951
- return s(), n.get(i)?.[a];
954
+ return s(), t.get(i)?.[a];
952
955
  },
953
956
  delete(a) {
954
957
  s();
955
- const d = n.get(i);
958
+ const d = t.get(i);
956
959
  if (!d || !(a in d)) return;
957
960
  const {
958
961
  [a]: g,
959
962
  ...u
960
963
  } = d;
961
- n.set(i, u), r("deleteScopedContextKey");
964
+ t.set(i, u), r("deleteScopedContextKey");
962
965
  },
963
966
  dispose() {
964
- c || (c = !0, n.delete(i) && r("disposeContextKeyScope"));
967
+ c || (c = !0, t.delete(i) && r("disposeContextKeyScope"));
965
968
  }
966
969
  };
967
970
  },
968
971
  deleteOwner(i) {
969
- n.delete(i) && r("deleteContextKeyOwner");
972
+ t.delete(i) && r("deleteContextKeyOwner");
970
973
  },
971
974
  snapshot() {
972
975
  return {
@@ -974,58 +977,58 @@ const h = (e) => {
974
977
  };
975
978
  },
976
979
  matches(i) {
977
- return pe(e.getState().values, i);
980
+ return ke(e.getState().values, i);
978
981
  }
979
982
  };
980
983
  };
981
984
  export {
982
- tt as A,
983
- _e as B,
984
- Je as C,
985
- Xe as D,
986
- Ye as E,
987
- de as F,
988
- Ne as G,
989
- et as H,
990
- Ge as I,
991
- pe as J,
992
- Ze as K,
993
- be as L,
994
- ve as M,
995
- he as N,
996
- G as O,
997
- Be as P,
998
- Ke as Q,
999
- Ee as R,
1000
- z as S,
1001
- He as T,
1002
- $e as U,
1003
- De as V,
985
+ it as A,
986
+ Te as B,
987
+ Ze as C,
988
+ et as D,
989
+ tt as E,
990
+ ge as F,
991
+ Je as G,
992
+ nt as H,
993
+ Qe as I,
994
+ ke as J,
995
+ Ye as K,
996
+ Se as L,
997
+ he as M,
998
+ we as N,
999
+ J as O,
1000
+ Ve as P,
1001
+ $e as Q,
1002
+ De as R,
1003
+ N as S,
1004
+ _e as T,
1005
+ He as U,
1006
+ Be as V,
1004
1007
  h as a,
1005
- x as b,
1006
- P as c,
1007
- A as d,
1008
- Ce as e,
1009
- re as f,
1010
- k as g,
1011
- T as h,
1012
- Oe as i,
1013
- Me as j,
1014
- Re as k,
1015
- Le as l,
1016
- F as m,
1017
- N as n,
1018
- xe as o,
1019
- je as p,
1020
- Ve as q,
1021
- Ue as r,
1022
- qe as s,
1023
- Te as t,
1024
- V as u,
1025
- Ae as v,
1026
- Fe as w,
1027
- ze as x,
1028
- nt as y,
1029
- Qe as z
1008
+ C as b,
1009
+ W as c,
1010
+ K as d,
1011
+ je as e,
1012
+ se as f,
1013
+ P as g,
1014
+ q as h,
1015
+ Ce as i,
1016
+ Oe as j,
1017
+ Le as k,
1018
+ xe as l,
1019
+ z as m,
1020
+ G as n,
1021
+ Ue as o,
1022
+ Ke as p,
1023
+ qe as q,
1024
+ Ae as r,
1025
+ ze as s,
1026
+ Fe as t,
1027
+ T as u,
1028
+ Ee as v,
1029
+ Ne as w,
1030
+ Ge as x,
1031
+ rt as y,
1032
+ Xe as z
1030
1033
  };
1031
- //# sourceMappingURL=context-key-service-W4QEfVdN.js.map
1034
+ //# sourceMappingURL=context-key-service-B2K9LAec.js.map