@pstdio/workbench 0.43.1 → 0.44.0-nightly.20261015030224

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,31 +1,31 @@
1
1
  import { c as e, t } from "./workbench-renderers-Bj4sazP5.js";
2
- import { a as n, at as r, o as i, s as a } from "./react-BsyyXmgz.js";
3
- import { resourceKey as o } from "@pstdio/sdk/extensions";
4
- import { c as s } from "react/compiler-runtime";
5
- import { Box as c, Button as l, Center as u, Flex as d, Image as f, Spinner as p, Text as m } from "@chakra-ui/react";
6
- import { AlertMessage as h, EmptyState as g, Header as _, resolveFileIconElement as v, useFileIconThemePreference as y } from "@pstdio/ui";
7
- import { jsx as b, jsxs as x } from "react/jsx-runtime";
8
- import { useEffect as S, useLayoutEffect as C, useRef as w, useState as T } from "react";
9
- import { CodeEditor as E } from "@pstdio/ui/diff";
2
+ import { a as n, o as r, ot as i, s as a, z as o } from "./react-DITDrArT.js";
3
+ import { resourceKey as s } from "@pstdio/sdk/extensions";
4
+ import { c } from "react/compiler-runtime";
5
+ import { Box as l, Button as u, Center as d, Flex as f, Image as p, Spinner as m, Text as h } from "@chakra-ui/react";
6
+ import { AlertMessage as g, EmptyState as _, Header as v, resolveFileIconElement as y, useFileIconThemePreference as b } from "@pstdio/ui";
7
+ import { jsx as x, jsxs as S } from "react/jsx-runtime";
8
+ import { useEffect as C, useLayoutEffect as w, useRef as T, useState as E } from "react";
9
+ import { CodeEditor as D } from "@pstdio/ui/diff";
10
10
  import { MarkdownEditor as ee } from "@pstdio/ui/rich-text";
11
11
  //#region src/core/registries/renderers/file-section-navigation.ts
12
- var D = "pstdio.fileSectionNavigation", O = (e) => {
12
+ var O = "pstdio.fileSectionNavigation", k = (e) => {
13
13
  if (!e || typeof e != "object") return !1;
14
14
  let t = e, n = t.occurrence === void 0 || typeof t.occurrence == "number" && Number.isInteger(t.occurrence) && t.occurrence >= 0;
15
15
  return typeof t.id == "string" && typeof t.heading == "string" && n;
16
- }, k = (e) => {
17
- let t = e?.metadata?.[D];
16
+ }, A = (e) => {
17
+ let t = e?.metadata?.[O];
18
18
  if (!t || typeof t != "object") return;
19
19
  let n = t;
20
- if (typeof n.treeId == "string" && typeof n.targetNodeId == "string" && Array.isArray(n.anchors) && n.anchors.every(O)) return {
20
+ if (typeof n.treeId == "string" && typeof n.targetNodeId == "string" && Array.isArray(n.anchors) && n.anchors.every(k)) return {
21
21
  treeId: n.treeId,
22
22
  targetNodeId: n.targetNodeId,
23
23
  anchors: n.anchors
24
24
  };
25
- }, A = (e, t) => t && e.anchors.some((e) => e.id === t) ? t : e.targetNodeId, j = (e) => {
25
+ }, j = (e, t) => t && e.anchors.some((e) => e.id === t) ? t : e.targetNodeId, te = (e) => {
26
26
  let { previous: t, current: n, currentResourceKey: r, selectedNodeId: i } = e;
27
27
  return !t || !i || !t.anchorIds.includes(i) || n?.targetNodeId === i ? !1 : !n || t.treeId !== n.treeId || t.resourceKey !== r;
28
- }, te = /* @__PURE__ */ new Set([
28
+ }, M = /* @__PURE__ */ new Set([
29
29
  "png",
30
30
  "jpg",
31
31
  "jpeg",
@@ -35,7 +35,7 @@ var D = "pstdio.fileSectionNavigation", O = (e) => {
35
35
  "avif",
36
36
  "bmp",
37
37
  "ico"
38
- ]), M = /* @__PURE__ */ new Set([
38
+ ]), ne = /* @__PURE__ */ new Set([
39
39
  "md",
40
40
  "markdown",
41
41
  "txt"
@@ -85,11 +85,11 @@ var D = "pstdio.fileSectionNavigation", O = (e) => {
85
85
  if (!e) return "";
86
86
  let t = e.lastIndexOf(".");
87
87
  return t < 0 || t === e.length - 1 ? "" : e.slice(t + 1).toLowerCase();
88
- }, F = (e, t) => t?.startsWith("image/") ? !0 : te.has(P(e)), I = (e, t) => {
88
+ }, F = (e, t) => t?.startsWith("image/") ? !0 : M.has(P(e)), I = (e, t) => {
89
89
  if (F(e, t)) return "image";
90
90
  let n = P(e);
91
- return !M.has(n) && n in N ? "code" : "markdown";
92
- }, L = (e) => N[P(e)] ?? "plaintext", ne = (e, t) => {
91
+ return !ne.has(n) && n in N ? "code" : "markdown";
92
+ }, L = (e) => N[P(e)] ?? "plaintext", R = (e, t) => {
93
93
  if (e.emptyState) return {
94
94
  kind: "empty",
95
95
  isEditable: !1
@@ -109,10 +109,10 @@ var D = "pstdio.fileSectionNavigation", O = (e) => {
109
109
  isEditable: r
110
110
  };
111
111
  }, re = (e) => {
112
- let t = s(49), { content: n, position: r, editorKey: i, errorNotice: a, contributionCanSave: o, onActiveSectionChange: l, onChange: p, rendererRef: _, sectionNavigation: v, title: y } = e, S;
113
- t[0] !== n || t[1] !== o ? (S = ne(n, o), t[0] = n, t[1] = o, t[2] = S) : S = t[2];
114
- let C = S, w;
115
- t[3] !== r || t[4] !== C.kind ? (w = r && C.kind !== "code" && C.kind !== "empty" ? /* @__PURE__ */ b(h, {
112
+ let t = c(49), { content: n, position: r, editorKey: i, errorNotice: a, contributionCanSave: o, onActiveSectionChange: s, onChange: u, rendererRef: m, sectionNavigation: v, title: y } = e, b;
113
+ t[0] !== n || t[1] !== o ? (b = R(n, o), t[0] = n, t[1] = o, t[2] = b) : b = t[2];
114
+ let C = b, w;
115
+ t[3] !== r || t[4] !== C.kind ? (w = r && C.kind !== "code" && C.kind !== "empty" ? /* @__PURE__ */ x(g, {
116
116
  status: "info",
117
117
  title: "Source location unavailable",
118
118
  children: "This preview does not support source line selection."
@@ -120,14 +120,14 @@ var D = "pstdio.fileSectionNavigation", O = (e) => {
120
120
  let T = w;
121
121
  if (C.kind === "empty") {
122
122
  let e = n.emptyState?.title ?? "Select a file", r = n.emptyState?.description, i;
123
- t[6] !== e || t[7] !== r ? (i = /* @__PURE__ */ b(g, {
123
+ t[6] !== e || t[7] !== r ? (i = /* @__PURE__ */ x(_, {
124
124
  flex: "1",
125
125
  minH: "0",
126
126
  title: e,
127
127
  description: r
128
128
  }), t[6] = e, t[7] = r, t[8] = i) : i = t[8];
129
129
  let o;
130
- return t[9] !== a || t[10] !== T || t[11] !== i ? (o = /* @__PURE__ */ x(d, {
130
+ return t[9] !== a || t[10] !== T || t[11] !== i ? (o = /* @__PURE__ */ S(f, {
131
131
  direction: "column",
132
132
  h: "full",
133
133
  minH: "0",
@@ -142,19 +142,19 @@ var D = "pstdio.fileSectionNavigation", O = (e) => {
142
142
  if (C.kind === "image") {
143
143
  if (!n.dataUrl) {
144
144
  let e;
145
- return t[13] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ b(u, {
145
+ return t[13] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ x(d, {
146
146
  h: "full",
147
147
  minH: "0",
148
148
  bg: "bg",
149
149
  p: "md",
150
- children: /* @__PURE__ */ b(m, {
150
+ children: /* @__PURE__ */ x(h, {
151
151
  color: "fg.muted",
152
152
  children: "This image preview is unavailable."
153
153
  })
154
154
  }), t[13] = e) : e = t[13], e;
155
155
  }
156
156
  let e = n.fileName ?? y, r;
157
- t[14] !== n.dataUrl || t[15] !== e ? (r = /* @__PURE__ */ b(f, {
157
+ t[14] !== n.dataUrl || t[15] !== e ? (r = /* @__PURE__ */ x(p, {
158
158
  src: n.dataUrl,
159
159
  alt: e,
160
160
  maxW: "100%",
@@ -162,16 +162,16 @@ var D = "pstdio.fileSectionNavigation", O = (e) => {
162
162
  objectFit: "contain"
163
163
  }), t[14] = n.dataUrl, t[15] = e, t[16] = r) : r = t[16];
164
164
  let i;
165
- t[17] !== _ || t[18] !== r ? (i = /* @__PURE__ */ b(u, {
166
- ref: _,
165
+ t[17] !== m || t[18] !== r ? (i = /* @__PURE__ */ x(d, {
166
+ ref: m,
167
167
  flex: "1",
168
168
  minH: "0",
169
169
  p: "md",
170
170
  overflow: "auto",
171
171
  children: r
172
- }), t[17] = _, t[18] = r, t[19] = i) : i = t[19];
172
+ }), t[17] = m, t[18] = r, t[19] = i) : i = t[19];
173
173
  let o;
174
- return t[20] !== a || t[21] !== T || t[22] !== i ? (o = /* @__PURE__ */ x(d, {
174
+ return t[20] !== a || t[21] !== T || t[22] !== i ? (o = /* @__PURE__ */ S(f, {
175
175
  direction: "column",
176
176
  h: "full",
177
177
  minH: "0",
@@ -184,11 +184,11 @@ var D = "pstdio.fileSectionNavigation", O = (e) => {
184
184
  }), t[20] = a, t[21] = T, t[22] = i, t[23] = o) : o = t[23], o;
185
185
  }
186
186
  if (C.kind === "code") {
187
- let e = n.content ?? "", o = C.isEditable ? p : void 0, s;
188
- t[24] !== n.fileName || t[25] !== i || t[26] !== r || t[27] !== C.isEditable || t[28] !== C.language || t[29] !== e || t[30] !== o ? (s = /* @__PURE__ */ b(c, {
187
+ let e = n.content ?? "", o = C.isEditable ? u : void 0, s;
188
+ t[24] !== n.fileName || t[25] !== i || t[26] !== r || t[27] !== C.isEditable || t[28] !== C.language || t[29] !== e || t[30] !== o ? (s = /* @__PURE__ */ x(l, {
189
189
  flex: "1",
190
190
  minH: "0",
191
- children: /* @__PURE__ */ b(E, {
191
+ children: /* @__PURE__ */ x(D, {
192
192
  language: C.language,
193
193
  position: r,
194
194
  fileName: n.fileName,
@@ -198,8 +198,8 @@ var D = "pstdio.fileSectionNavigation", O = (e) => {
198
198
  onChange: o
199
199
  }, i)
200
200
  }), t[24] = n.fileName, t[25] = i, t[26] = r, t[27] = C.isEditable, t[28] = C.language, t[29] = e, t[30] = o, t[31] = s) : s = t[31];
201
- let l;
202
- return t[32] !== a || t[33] !== T || t[34] !== s ? (l = /* @__PURE__ */ x(d, {
201
+ let c;
202
+ return t[32] !== a || t[33] !== T || t[34] !== s ? (c = /* @__PURE__ */ S(f, {
203
203
  direction: "column",
204
204
  h: "full",
205
205
  minH: "0",
@@ -209,25 +209,25 @@ var D = "pstdio.fileSectionNavigation", O = (e) => {
209
209
  T,
210
210
  s
211
211
  ]
212
- }), t[32] = a, t[33] = T, t[34] = s, t[35] = l) : l = t[35], l;
212
+ }), t[32] = a, t[33] = T, t[34] = s, t[35] = c) : c = t[35], c;
213
213
  }
214
- let D = n.content ?? "", O = C.isEditable ? n.placeholder ?? "Write…" : void 0, k = C.isEditable ? p : void 0, A;
215
- t[36] !== i || t[37] !== l || t[38] !== C.isEditable || t[39] !== v || t[40] !== D || t[41] !== O || t[42] !== k ? (A = /* @__PURE__ */ b(c, {
214
+ let E = n.content ?? "", O = C.isEditable ? n.placeholder ?? "Write…" : void 0, k = C.isEditable ? u : void 0, A;
215
+ t[36] !== i || t[37] !== s || t[38] !== C.isEditable || t[39] !== v || t[40] !== E || t[41] !== O || t[42] !== k ? (A = /* @__PURE__ */ x(l, {
216
216
  flex: "1",
217
217
  minH: "0",
218
218
  overflowY: "auto",
219
- children: /* @__PURE__ */ b(ee, {
220
- defaultState: D,
219
+ children: /* @__PURE__ */ x(ee, {
220
+ defaultState: E,
221
221
  isEditable: C.isEditable,
222
222
  sectionNavigation: v,
223
223
  placeholder: O,
224
- onActiveSectionChange: l,
224
+ onActiveSectionChange: s,
225
225
  onChange: k
226
226
  }, i)
227
- }), t[36] = i, t[37] = l, t[38] = C.isEditable, t[39] = v, t[40] = D, t[41] = O, t[42] = k, t[43] = A) : A = t[43];
227
+ }), t[36] = i, t[37] = s, t[38] = C.isEditable, t[39] = v, t[40] = E, t[41] = O, t[42] = k, t[43] = A) : A = t[43];
228
228
  let j;
229
- return t[44] !== a || t[45] !== T || t[46] !== _ || t[47] !== A ? (j = /* @__PURE__ */ x(d, {
230
- ref: _,
229
+ return t[44] !== a || t[45] !== T || t[46] !== m || t[47] !== A ? (j = /* @__PURE__ */ S(f, {
230
+ ref: m,
231
231
  direction: "column",
232
232
  h: "full",
233
233
  minH: "0",
@@ -238,7 +238,7 @@ var D = "pstdio.fileSectionNavigation", O = (e) => {
238
238
  T,
239
239
  A
240
240
  ]
241
- }), t[44] = a, t[45] = T, t[46] = _, t[47] = A, t[48] = j) : j = t[48], j;
241
+ }), t[44] = a, t[45] = T, t[46] = m, t[47] = A, t[48] = j) : j = t[48], j;
242
242
  }, ie = (e) => {
243
243
  let t, n = !1, r, i = null, a = null, o, s, c = !1, l = null, u = 0, d = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set(), p = (e) => e instanceof Error ? e.message : "Failed to save file.", m = () => ({
244
244
  dirty: i !== null || a !== null && a.value !== t,
@@ -349,21 +349,21 @@ var D = "pstdio.fileSectionNavigation", O = (e) => {
349
349
  }
350
350
  };
351
351
  }, ae = (e) => {
352
- let t = s(7), { message: n, onRetry: r } = e, i;
353
- t[0] === n ? i = t[1] : (i = /* @__PURE__ */ b(m, {
352
+ let t = c(7), { message: n, onRetry: r } = e, i;
353
+ t[0] === n ? i = t[1] : (i = /* @__PURE__ */ x(h, {
354
354
  color: "fg.muted",
355
355
  textStyle: "label/S/regular",
356
356
  children: n
357
357
  }), t[0] = n, t[1] = i);
358
358
  let a;
359
- t[2] === r ? a = t[3] : (a = r ? /* @__PURE__ */ b(l, {
359
+ t[2] === r ? a = t[3] : (a = r ? /* @__PURE__ */ x(u, {
360
360
  size: "2xs",
361
361
  variant: "subtle",
362
362
  onClick: r,
363
363
  children: "Retry"
364
364
  }) : null, t[2] = r, t[3] = a);
365
365
  let o;
366
- return t[4] !== i || t[5] !== a ? (o = /* @__PURE__ */ x(d, {
366
+ return t[4] !== i || t[5] !== a ? (o = /* @__PURE__ */ S(f, {
367
367
  flex: "none",
368
368
  alignItems: "center",
369
369
  justifyContent: "space-between",
@@ -375,33 +375,33 @@ var D = "pstdio.fileSectionNavigation", O = (e) => {
375
375
  py: "xs",
376
376
  children: [i, a]
377
377
  }), t[4] = i, t[5] = a, t[6] = o) : o = t[6], o;
378
- }, R = (e) => Array.isArray(e) ? e.map(R) : !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).sort(([e], [t]) => e.localeCompare(t)).map(([e, t]) => [e, R(t)])), oe = (e) => {
379
- let { fileRendererId: t, resource: n } = e, r = n ? R({
378
+ }, z = (e) => Array.isArray(e) ? e.map(z) : !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).sort(([e], [t]) => e.localeCompare(t)).map(([e, t]) => [e, z(t)])), oe = (e) => {
379
+ let { fileRendererId: t, resource: n } = e, r = n ? z({
380
380
  id: n.id,
381
381
  type: n.type,
382
382
  metadata: n.metadata
383
- }) : null;
384
- return `${JSON.stringify(o(n))}:${t}:${JSON.stringify(r)}`;
385
- }, se = (e, t) => e?.loadKey === t, z = (e) => {
386
- let t = s(9), { fileName: n, filePath: r } = e, { activeFileIconTheme: i } = y(), a;
387
- t[0] !== i || t[1] !== n ? (a = v(n, { theme: i }), t[0] = i, t[1] = n, t[2] = a) : a = t[2];
388
- let o = `File path ${r}`, c;
389
- t[3] !== r || t[4] !== o ? (c = /* @__PURE__ */ b(m, {
383
+ }) : null, i = `${JSON.stringify(s(n))}:${t}:${JSON.stringify(r)}`;
384
+ return e.pageParams ? `${i}:${JSON.stringify(z(e.pageParams))}` : i;
385
+ }, se = (e, t) => e?.loadKey === t, ce = (e) => {
386
+ let t = c(9), { fileName: n, filePath: r } = e, { activeFileIconTheme: i } = b(), a;
387
+ t[0] !== i || t[1] !== n ? (a = y(n, { theme: i }), t[0] = i, t[1] = n, t[2] = a) : a = t[2];
388
+ let o = `File path ${r}`, s;
389
+ t[3] !== r || t[4] !== o ? (s = /* @__PURE__ */ x(h, {
390
390
  "aria-label": o,
391
391
  textStyle: "label/S/regular",
392
392
  color: "fg.muted",
393
393
  truncate: !0,
394
394
  children: r
395
- }), t[3] = r, t[4] = o, t[5] = c) : c = t[5];
395
+ }), t[3] = r, t[4] = o, t[5] = s) : s = t[5];
396
396
  let l;
397
- return t[6] !== a || t[7] !== c ? (l = /* @__PURE__ */ x(_, {
397
+ return t[6] !== a || t[7] !== s ? (l = /* @__PURE__ */ S(v, {
398
398
  variant: "narrow",
399
399
  flexShrink: 0,
400
400
  gap: "2xs",
401
401
  bg: "bg",
402
- children: [a, c]
403
- }), t[6] = a, t[7] = c, t[8] = l) : l = t[8], l;
404
- }, ce = 600, le = (e) => e instanceof Error ? e.message : "Failed to load file.", ue = (e) => {
402
+ children: [a, s]
403
+ }), t[6] = a, t[7] = s, t[8] = l) : l = t[8], l;
404
+ }, le = 600, ue = (e) => e instanceof Error ? e.message : "Failed to load file.", de = (e) => {
405
405
  let { workbench: n, navigation: r, sectionId: i } = e;
406
406
  if (!r || !t(n).getTreeRenderer(r.treeId)) return;
407
407
  if (i && r.anchors.some((e) => e.id === i)) {
@@ -410,156 +410,157 @@ var D = "pstdio.fileSectionNavigation", O = (e) => {
410
410
  }
411
411
  let a = t(n).getTreeState(r.treeId).selectedNodeId;
412
412
  a && r.anchors.some((e) => e.id === a) && t(n).setSelectedNode(r.treeId, void 0);
413
- }, de = (e, n) => {
413
+ }, fe = (e, n) => {
414
414
  if (!n) return;
415
415
  let r = t(e).getTreeRenderer(n.treeId) ? t(e).getTreeState(n.treeId).selectedNodeId : void 0;
416
416
  return {
417
417
  anchors: n.anchors,
418
- targetId: A(n, r)
418
+ targetId: j(n, r)
419
419
  };
420
- }, fe = (e, t) => {
421
- let n = s(2), i;
422
- return n[0] === t ? i = n[1] : (i = (e) => {
420
+ }, pe = (e, t) => {
421
+ let n = c(2), r;
422
+ return n[0] === t ? r = n[1] : (r = (e) => {
423
423
  let n = e.location;
424
- if (!n?.position || o(n.resource) !== o(t)) return;
424
+ if (!n?.position || s(n.resource) !== s(t)) return;
425
425
  let r = Object.values(e.pages).find((e) => e.ref.id === n.page.id && e.ref.extensionId === n.page.extensionId)?.document?.metadataKey;
426
426
  if (r && n.resource?.metadata?.[r] === t?.metadata?.[r]) return n.position;
427
- }, n[0] = t, n[1] = i), r(e.pages.store, i);
428
- }, pe = (e) => {
429
- let t = s(3), { file: n } = e, r;
430
- return t[0] !== n.fileName || t[1] !== n.filePath ? (r = n.filePath ? /* @__PURE__ */ b(z, {
427
+ }, n[0] = t, n[1] = r), i(e.pages.store, r);
428
+ }, me = (e) => {
429
+ let t = c(3), { file: n } = e, r;
430
+ return t[0] !== n.fileName || t[1] !== n.filePath ? (r = n.filePath ? /* @__PURE__ */ x(ce, {
431
431
  fileName: n.fileName ?? n.filePath,
432
432
  filePath: n.filePath
433
433
  }) : null, t[0] = n.fileName, t[1] = n.filePath, t[2] = r) : r = t[2], r;
434
- }, B = (r) => {
435
- let f = s(71), { workbench: h, contribution: g } = r, _ = r.placement?.resource, v = fe(h, _), y, E;
436
- f[0] !== _ || f[1] !== h ? (y = k(_), E = de(h, y), f[0] = _, f[1] = h, f[2] = y, f[3] = E) : (y = f[2], E = f[3]);
437
- let ee = E, D = oe({
438
- fileRendererId: g.id,
439
- resource: _
440
- }), [O, A] = T(null), [te, M] = T(null), N;
441
- f[4] === Symbol.for("react.memo_cache_sentinel") ? (N = {
434
+ }, B = (i) => {
435
+ let p = c(72), { workbench: g, contribution: _ } = i, v = i.placement?.resource, y = pe(g, v), b, D;
436
+ p[0] !== v || p[1] !== g ? (b = A(v), D = fe(g, b), p[0] = v, p[1] = g, p[2] = b, p[3] = D) : (b = p[2], D = p[3]);
437
+ let ee = D, O = o(g, i.placement), k = oe({
438
+ fileRendererId: _.id,
439
+ resource: v,
440
+ pageParams: O
441
+ }), [j, M] = E(null), [ne, N] = E(null), P;
442
+ p[4] === Symbol.for("react.memo_cache_sentinel") ? (P = {
442
443
  dirty: !1,
443
444
  saving: !1
444
- }, f[4] = N) : N = f[4];
445
- let [P, F] = T(N), I = w(null), L = w(void 0), ne = w(null), R = w(null), z, B;
446
- f[5] !== _ || f[6] !== y || f[7] !== h ? (z = () => {
447
- let e = R.current, n = e && t(h).getTreeRenderer(e.treeId) ? t(h).getTreeState(e.treeId).selectedNodeId : void 0;
448
- j({
445
+ }, p[4] = P) : P = p[4];
446
+ let [F, I] = E(P), L = T(null), R = T(void 0), z = T(null), ce = T(null), B, ge;
447
+ p[5] !== v || p[6] !== b || p[7] !== g ? (B = () => {
448
+ let e = ce.current, n = e && t(g).getTreeRenderer(e.treeId) ? t(g).getTreeState(e.treeId).selectedNodeId : void 0;
449
+ te({
449
450
  previous: e,
450
- current: y,
451
- currentResourceKey: o(_),
451
+ current: b,
452
+ currentResourceKey: s(v),
452
453
  selectedNodeId: n
453
- }) && e && t(h).setSelectedNode(e.treeId, void 0), R.current = y ? {
454
- resourceKey: o(_),
455
- treeId: y.treeId,
456
- anchorIds: y.anchors.map(me)
454
+ }) && e && t(g).setSelectedNode(e.treeId, void 0), ce.current = b ? {
455
+ resourceKey: s(v),
456
+ treeId: b.treeId,
457
+ anchorIds: b.anchors.map(he)
457
458
  } : null;
458
- }, B = [
459
- _,
460
- y,
461
- h
462
- ], f[5] = _, f[6] = y, f[7] = h, f[8] = z, f[9] = B) : (z = f[8], B = f[9]), S(z, B);
463
- let he = w(g), V = w(_), ge = w(r.placement), H;
464
- f[10] !== g || f[11] !== r.placement || f[12] !== _ ? (H = () => {
465
- he.current = g, V.current = _, ge.current = r.placement;
466
- }, f[10] = g, f[11] = r.placement, f[12] = _, f[13] = H) : H = f[13], S(H);
467
- let U = g.id, W = !!g.save, G = r.placement ? e(r.placement) : JSON.stringify([
459
+ }, ge = [
460
+ v,
461
+ b,
462
+ g
463
+ ], p[5] = v, p[6] = b, p[7] = g, p[8] = B, p[9] = ge) : (B = p[8], ge = p[9]), C(B, ge);
464
+ let _e = T(_), V = T(v), ve = T(O), ye = T(i.placement), be;
465
+ p[10] !== _ || p[11] !== O || p[12] !== i.placement || p[13] !== v ? (be = () => {
466
+ _e.current = _, V.current = v, ve.current = O, ye.current = i.placement;
467
+ }, p[10] = _, p[11] = O, p[12] = i.placement, p[13] = v, p[14] = be) : be = p[14], C(be);
468
+ let H = _.id, U = !!_.save, W = i.placement ? e(i.placement) : JSON.stringify([
468
469
  "file",
469
- U,
470
- D
471
- ]), K = r.placement?.instanceId ?? U, q;
472
- f[14] !== U || f[15] !== W || f[16] !== K || f[17] !== D || f[18] !== G || f[19] !== F || f[20] !== M || f[21] !== A || f[22] !== h ? (q = () => {
473
- let e = !1, r = !1, s = V.current, c = he.current, l = h.views.reads.bind(G), u = null;
474
- M(null);
475
- let d = i(D);
476
- A(d ? {
470
+ H,
471
+ k
472
+ ]), G = i.placement?.instanceId ?? H, xe;
473
+ p[15] !== H || p[16] !== U || p[17] !== G || p[18] !== k || p[19] !== W || p[20] !== I || p[21] !== N || p[22] !== M || p[23] !== g ? (xe = () => {
474
+ let e = !1, i = !1, o = V.current, c = _e.current, l = g.views.reads.bind(W), u = null;
475
+ N(null);
476
+ let d = r(k);
477
+ M(d ? {
477
478
  ...d,
478
479
  editorRevision: 1,
479
- loadKey: D
480
+ loadKey: k
480
481
  } : null);
481
482
  let f = (t) => {
482
- let i = t === void 0 ? "refresh" : t;
483
+ let r = t === void 0 ? "refresh" : t;
483
484
  l.request({
484
- queryKey: D,
485
- load: (e) => he.current.load(V.current, e),
485
+ queryKey: k,
486
+ load: (e) => _e.current.load(V.current, e, ve.current),
486
487
  onValue: (t) => {
487
- if (e || r) return;
488
- let i = n(t, D, u);
489
- i && (M(null), A(i));
488
+ if (e || i) return;
489
+ let r = n(t, k, u);
490
+ r && (N(null), M(r));
490
491
  },
491
492
  onError: (t) => {
492
- e || r || M({
493
- loadKey: D,
494
- message: le(t)
493
+ e || i || N({
494
+ loadKey: k,
495
+ message: ue(t)
495
496
  });
496
497
  }
497
- }, i);
498
+ }, r);
498
499
  };
499
- L.current = () => f("retry"), u = W ? ie({
500
+ R.current = () => f("retry"), u = U ? ie({
500
501
  binding: {
501
- rendererId: U,
502
- instanceId: K,
503
- resourceKey: o(V.current)
502
+ rendererId: H,
503
+ instanceId: G,
504
+ resourceKey: s(V.current)
504
505
  },
505
- debounceMs: ce,
506
+ debounceMs: le,
506
507
  load: () => f(),
507
508
  onStateChange: (t) => {
508
- e || F(t);
509
+ e || I(t);
509
510
  },
510
- save: (e, t) => Promise.resolve(c.save?.(s, e, t)).then((t) => {
511
- let n = i(D);
512
- return n && !r && a(D, {
511
+ save: (e, t) => Promise.resolve(c.save?.(o, e, t)).then((t) => {
512
+ let n = r(k);
513
+ return n && !i && a(k, {
513
514
  ...n,
514
515
  content: e
515
516
  }), t ?? void 0;
516
517
  })
517
- }) : null, I.current = u, d && I.current?.setBaseline(d.content, d.revision), F({
518
+ }) : null, L.current = u, d && L.current?.setBaseline(d.content, d.revision), I({
518
519
  dirty: !1,
519
520
  saving: !1
520
521
  }), f();
521
- let p = h.resources.onWillRemove((e) => {
522
- if (o(e) !== o(V.current)) return [];
523
- r = !0;
524
- let t = I.current?.markRemoved(), n = ge.current?.placementIdentity;
522
+ let p = g.resources.onWillRemove((e) => {
523
+ if (s(e) !== s(V.current)) return [];
524
+ i = !0;
525
+ let t = L.current?.markRemoved(), n = ye.current?.placementIdentity;
525
526
  return t && n ? [n] : [];
526
- }), m = t(h).onDidRefreshFileRenderer((e) => {
527
- if (r || e.fileRendererId !== U) return;
528
- let t = I.current;
527
+ }), m = t(g).onDidRefreshFileRenderer((e) => {
528
+ if (i || e.fileRendererId !== H) return;
529
+ let t = L.current;
529
530
  t ? t.handleRefreshEvent(e) : f();
530
531
  });
531
532
  return () => {
532
- e = !0, l.dispose(), L.current = void 0, m.dispose(), p.dispose(), u?.flush(), I.current === u && (I.current = null);
533
+ e = !0, l.dispose(), R.current = void 0, m.dispose(), p.dispose(), u?.flush(), L.current === u && (L.current = null);
533
534
  };
534
- }, f[14] = U, f[15] = W, f[16] = K, f[17] = D, f[18] = G, f[19] = F, f[20] = M, f[21] = A, f[22] = h, f[23] = q) : q = f[23];
535
- let _e;
536
- f[24] !== U || f[25] !== W || f[26] !== K || f[27] !== D || f[28] !== G || f[29] !== h ? (_e = [
535
+ }, p[15] = H, p[16] = U, p[17] = G, p[18] = k, p[19] = W, p[20] = I, p[21] = N, p[22] = M, p[23] = g, p[24] = xe) : xe = p[24];
536
+ let Se;
537
+ p[25] !== H || p[26] !== U || p[27] !== G || p[28] !== k || p[29] !== W || p[30] !== g ? (Se = [
538
+ H,
537
539
  U,
540
+ g,
541
+ k,
538
542
  W,
539
- h,
540
- D,
541
- G,
542
- K
543
- ], f[24] = U, f[25] = W, f[26] = K, f[27] = D, f[28] = G, f[29] = h, f[30] = _e) : _e = f[30], S(q, _e);
544
- let ve, ye;
545
- f[31] === Symbol.for("react.memo_cache_sentinel") ? (ve = () => {
546
- let e = () => I.current?.flush(), t = () => {
543
+ G
544
+ ], p[25] = H, p[26] = U, p[27] = G, p[28] = k, p[29] = W, p[30] = g, p[31] = Se) : Se = p[31], C(xe, Se);
545
+ let Ce, we;
546
+ p[32] === Symbol.for("react.memo_cache_sentinel") ? (Ce = () => {
547
+ let e = () => L.current?.flush(), t = () => {
547
548
  document.visibilityState === "hidden" && e();
548
549
  };
549
550
  return window.addEventListener("beforeunload", e), document.addEventListener("visibilitychange", t), () => {
550
551
  window.removeEventListener("beforeunload", e), document.removeEventListener("visibilitychange", t);
551
552
  };
552
- }, ye = [], f[31] = ve, f[32] = ye) : (ve = f[31], ye = f[32]), S(ve, ye);
553
- let be;
554
- f[33] === Symbol.for("react.memo_cache_sentinel") ? (be = (e) => {
555
- I.current?.handleChange(e);
556
- }, f[33] = be) : be = f[33];
557
- let xe = be, Se;
558
- f[34] !== D || f[35] !== O ? (Se = se(O, D) ? O : null, f[34] = D, f[35] = O, f[36] = Se) : Se = f[36];
559
- let J = Se, Ce = J ? `${J.loadKey}:${J.editorRevision}` : "", we, Te;
560
- f[37] !== Ce || f[38] !== y ? (we = () => {
561
- if (!Ce || y) return;
562
- let e = ne.current;
553
+ }, we = [], p[32] = Ce, p[33] = we) : (Ce = p[32], we = p[33]), C(Ce, we);
554
+ let Te;
555
+ p[34] === Symbol.for("react.memo_cache_sentinel") ? (Te = (e) => {
556
+ L.current?.handleChange(e);
557
+ }, p[34] = Te) : Te = p[34];
558
+ let Ee = Te, De;
559
+ p[35] !== k || p[36] !== j ? (De = se(j, k) ? j : null, p[35] = k, p[36] = j, p[37] = De) : De = p[37];
560
+ let K = De, Oe = K ? `${K.loadKey}:${K.editorRevision}` : "", ke, q;
561
+ p[38] !== Oe || p[39] !== b ? (ke = () => {
562
+ if (!Oe || b) return;
563
+ let e = z.current;
563
564
  e && requestAnimationFrame(() => {
564
565
  let t = e.parentElement;
565
566
  for (; t;) {
@@ -571,23 +572,23 @@ var D = "pstdio.fileSectionNavigation", O = (e) => {
571
572
  ].includes(e) && t.scrollHeight > t.clientHeight && (t.scrollTop = 0), t = t.parentElement;
572
573
  }
573
574
  });
574
- }, Te = [Ce, y], f[37] = Ce, f[38] = y, f[39] = we, f[40] = Te) : (we = f[39], Te = f[40]), C(we, Te);
575
- let Y = te?.loadKey === D ? te.message : void 0;
576
- if (Y && !J) {
575
+ }, q = [Oe, b], p[38] = Oe, p[39] = b, p[40] = ke, p[41] = q) : (ke = p[40], q = p[41]), w(ke, q);
576
+ let J = ne?.loadKey === k ? ne.message : void 0;
577
+ if (J && !K) {
577
578
  let e;
578
- f[41] === Y ? e = f[42] : (e = /* @__PURE__ */ b(m, {
579
+ p[42] === J ? e = p[43] : (e = /* @__PURE__ */ x(h, {
579
580
  color: "fg.muted",
580
- children: Y
581
- }), f[41] = Y, f[42] = e);
581
+ children: J
582
+ }), p[42] = J, p[43] = e);
582
583
  let t;
583
- f[43] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ b(l, {
584
+ p[44] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ x(u, {
584
585
  size: "xs",
585
586
  variant: "subtle",
586
- onClick: () => L.current?.(),
587
+ onClick: () => R.current?.(),
587
588
  children: "Retry"
588
- }), f[43] = t) : t = f[43];
589
+ }), p[44] = t) : t = p[44];
589
590
  let n;
590
- return f[44] === e ? n = f[45] : (n = /* @__PURE__ */ x(u, {
591
+ return p[45] === e ? n = p[46] : (n = /* @__PURE__ */ S(d, {
591
592
  h: "full",
592
593
  minH: "0",
593
594
  bg: "bg",
@@ -595,76 +596,76 @@ var D = "pstdio.fileSectionNavigation", O = (e) => {
595
596
  flexDirection: "column",
596
597
  gap: "sm",
597
598
  children: [e, t]
598
- }), f[44] = e, f[45] = n), n;
599
+ }), p[45] = e, p[46] = n), n;
599
600
  }
600
- if (!J) {
601
+ if (!K) {
601
602
  let e;
602
- return f[46] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ b(u, {
603
+ return p[47] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ x(d, {
603
604
  h: "full",
604
605
  minH: "0",
605
606
  bg: "bg",
606
- children: /* @__PURE__ */ b(p, { size: "sm" })
607
- }), f[46] = e) : e = f[46], e;
607
+ children: /* @__PURE__ */ x(m, { size: "sm" })
608
+ }), p[47] = e) : e = p[47], e;
608
609
  }
609
- let Ee = `${J.loadKey}:${J.editorRevision}`, X = null;
610
- if (P.removed) {
610
+ let Ae = `${K.loadKey}:${K.editorRevision}`, Y = null;
611
+ if (F.removed) {
611
612
  let e;
612
- f[47] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ b(ae, { message: "This resource was removed. Your draft is kept here. Copy it before closing this tab." }), f[47] = e) : e = f[47], X = e;
613
- } else if (Y) {
613
+ p[48] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ x(ae, { message: "This resource was removed. Your draft is kept here. Copy it before closing this tab." }), p[48] = e) : e = p[48], Y = e;
614
+ } else if (J) {
614
615
  let e;
615
- f[48] === Symbol.for("react.memo_cache_sentinel") ? (e = () => L.current?.(), f[48] = e) : e = f[48];
616
+ p[49] === Symbol.for("react.memo_cache_sentinel") ? (e = () => R.current?.(), p[49] = e) : e = p[49];
616
617
  let t;
617
- f[49] === Y ? t = f[50] : (t = /* @__PURE__ */ b(ae, {
618
- message: Y,
618
+ p[50] === J ? t = p[51] : (t = /* @__PURE__ */ x(ae, {
619
+ message: J,
619
620
  onRetry: e
620
- }), f[49] = Y, f[50] = t), X = t;
621
- } else if (P.saveError) {
621
+ }), p[50] = J, p[51] = t), Y = t;
622
+ } else if (F.saveError) {
622
623
  let e;
623
- f[51] === Symbol.for("react.memo_cache_sentinel") ? (e = () => I.current?.retry(), f[51] = e) : e = f[51];
624
+ p[52] === Symbol.for("react.memo_cache_sentinel") ? (e = () => L.current?.retry(), p[52] = e) : e = p[52];
624
625
  let t;
625
- f[52] === P.saveError ? t = f[53] : (t = /* @__PURE__ */ b(ae, {
626
- message: P.saveError,
626
+ p[53] === F.saveError ? t = p[54] : (t = /* @__PURE__ */ x(ae, {
627
+ message: F.saveError,
627
628
  onRetry: e
628
- }), f[52] = P.saveError, f[53] = t), X = t;
629
+ }), p[53] = F.saveError, p[54] = t), Y = t;
629
630
  }
630
- let Z;
631
- f[54] === J ? Z = f[55] : (Z = /* @__PURE__ */ b(pe, { file: J }), f[54] = J, f[55] = Z);
632
- let De = X, Oe = !!g.save, Q;
633
- f[56] !== y || f[57] !== h ? (Q = y ? (e) => ue({
634
- workbench: h,
635
- navigation: y,
631
+ let X;
632
+ p[55] === K ? X = p[56] : (X = /* @__PURE__ */ x(me, { file: K }), p[55] = K, p[56] = X);
633
+ let je = Y, Me = !!_.save, Z;
634
+ p[57] !== b || p[58] !== g ? (Z = b ? (e) => de({
635
+ workbench: g,
636
+ navigation: b,
636
637
  sectionId: e
637
- }) : void 0, f[56] = y, f[57] = h, f[58] = Q) : Q = f[58];
638
- let $;
639
- f[59] !== g.title || f[60] !== J || f[61] !== Ee || f[62] !== ee || f[63] !== X || f[64] !== v || f[65] !== Oe || f[66] !== Q ? ($ = /* @__PURE__ */ b(c, {
638
+ }) : void 0, p[57] = b, p[58] = g, p[59] = Z) : Z = p[59];
639
+ let Q;
640
+ p[60] !== _.title || p[61] !== K || p[62] !== Ae || p[63] !== ee || p[64] !== Y || p[65] !== y || p[66] !== Me || p[67] !== Z ? (Q = /* @__PURE__ */ x(l, {
640
641
  flex: "1",
641
642
  minH: "0",
642
- children: /* @__PURE__ */ b(re, {
643
- content: J,
644
- position: v,
645
- editorKey: Ee,
646
- errorNotice: De,
647
- contributionCanSave: Oe,
648
- onActiveSectionChange: Q,
649
- onChange: xe,
650
- rendererRef: ne,
643
+ children: /* @__PURE__ */ x(re, {
644
+ content: K,
645
+ position: y,
646
+ editorKey: Ae,
647
+ errorNotice: je,
648
+ contributionCanSave: Me,
649
+ onActiveSectionChange: Z,
650
+ onChange: Ee,
651
+ rendererRef: z,
651
652
  sectionNavigation: ee,
652
- title: g.title
653
+ title: _.title
653
654
  })
654
- }), f[59] = g.title, f[60] = J, f[61] = Ee, f[62] = ee, f[63] = X, f[64] = v, f[65] = Oe, f[66] = Q, f[67] = $) : $ = f[67];
655
- let ke;
656
- return f[68] !== Z || f[69] !== $ ? (ke = /* @__PURE__ */ x(d, {
655
+ }), p[60] = _.title, p[61] = K, p[62] = Ae, p[63] = ee, p[64] = Y, p[65] = y, p[66] = Me, p[67] = Z, p[68] = Q) : Q = p[68];
656
+ let $;
657
+ return p[69] !== X || p[70] !== Q ? ($ = /* @__PURE__ */ S(f, {
657
658
  direction: "column",
658
659
  h: "full",
659
660
  minH: "0",
660
661
  bg: "bg",
661
- children: [Z, $]
662
- }), f[68] = Z, f[69] = $, f[70] = ke) : ke = f[70], ke;
662
+ children: [X, Q]
663
+ }), p[69] = X, p[70] = Q, p[71] = $) : $ = p[71], $;
663
664
  };
664
- function me(e) {
665
+ function he(e) {
665
666
  return e.id;
666
667
  }
667
668
  //#endregion
668
669
  export { B as WorkbenchFileRendererView };
669
670
 
670
- //# sourceMappingURL=file-renderer-view-BRBYhjKd.js.map
671
+ //# sourceMappingURL=file-renderer-view-B93kU2ZC.js.map