@parallelworks/tandem-web 0.139.0 → 0.139.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/pages/areas.js CHANGED
@@ -1,9 +1,9 @@
1
- import { Link as e } from "../lib/router.js";
2
- import { areasQuery as t, countsQuery as n, docsQuery as r, inboxQuery as i, teamsQuery as a, unfiledQuery as o, workspaceQuery as s } from "../api/queries.js";
3
- import { AddIcon as c, AreaIcon as l, ChevronRightIcon as u, FileTextIcon as d, GridIcon as f, ListViewIcon as p } from "../components/icons.js";
4
- import { docRef as m } from "../lib/docs.js";
5
- import { usePeople as h } from "../lib/people.js";
6
- import { usePageTitle as g } from "../lib/pageTitle.js";
1
+ import { usePageTitle as e } from "../lib/pageTitle.js";
2
+ import { Link as t } from "../lib/router.js";
3
+ import { areasQuery as n, countsQuery as r, docsQuery as i, inboxQuery as a, teamsQuery as o, unfiledQuery as s, workspaceQuery as c } from "../api/queries.js";
4
+ import { AddIcon as l, AreaIcon as u, ChevronRightIcon as d, FileTextIcon as f, GridIcon as p, ListViewIcon as m } from "../components/icons.js";
5
+ import { docRef as h } from "../lib/docs.js";
6
+ import { usePeople as g } from "../lib/people.js";
7
7
  import { EntityIcon as _ } from "../components/EntityIcon.js";
8
8
  import { DocIcon as v } from "../components/DocIcon.js";
9
9
  import { actorAvatar as y } from "../lib/avatar.js";
@@ -22,15 +22,15 @@ import { MoreButton as ne } from "@parallelworks/ui/list";
22
22
  // src/pages/areas.tsx
23
23
  var re = (...e) => e.filter(Boolean).join(" ");
24
24
  function ie() {
25
- let e = q("areas"), { workspace: r, key: i } = V({ strict: !1 }), { team: u = i } = H({ strict: !1 }), { data: d } = Q(t(r)), { data: m } = Q(a(r)), h = m.find((e) => e.key === u);
26
- g(e("title"), h?.name);
27
- let v = h ? d.filter((e) => e.teamId === h.id) : d, { data: y } = Q(s(r)), { data: C } = Q(n(r)), [w, T] = G(null), { data: E } = Z(o(r, h?.key)), D = (E?.proposed.length ?? 0) + (E?.notInDocs.length ?? 0), O = v.filter((e) => e.status === "proposed"), A = [...!h && d.some((e) => !e.teamId) ? [{
25
+ let t = q("areas"), { workspace: i, key: a } = V({ strict: !1 }), { team: d = a } = H({ strict: !1 }), { data: f } = Q(n(i)), { data: h } = Q(o(i)), g = h.find((e) => e.key === d);
26
+ e(t("title"), g?.name);
27
+ let v = g ? f.filter((e) => e.teamId === g.id) : f, { data: y } = Q(c(i)), { data: C } = Q(r(i)), [w, T] = G(null), { data: E } = Z(s(i, g?.key)), D = (E?.proposed.length ?? 0) + (E?.notInDocs.length ?? 0), O = v.filter((e) => e.status === "proposed"), A = [...!g && f.some((e) => !e.teamId) ? [{
28
28
  id: "",
29
29
  key: "workspace",
30
30
  name: y.name,
31
31
  icon: y.icon,
32
32
  color: y.color
33
- }] : [], ...m.filter((e) => !e.archivedAt && (!h || e.id === h.id)).map((e) => ({
33
+ }] : [], ...h.filter((e) => !e.archivedAt && (!g || e.id === g.id)).map((e) => ({
34
34
  id: e.id,
35
35
  key: e.key,
36
36
  name: e.name,
@@ -39,19 +39,19 @@ function ie() {
39
39
  team: e
40
40
  }))], M = (e) => A.find((t) => t.id === (e.teamId ?? "")), P = () => T({
41
41
  kind: "create",
42
- ...h && { space: h.key }
43
- }), F = de(r, (e) => T({
42
+ ...g && { space: g.key }
43
+ }), F = de(i, (e) => T({
44
44
  kind: "edit",
45
45
  area: e
46
46
  }), (e) => T({
47
47
  kind: "create",
48
48
  parent: e
49
49
  })), [I, L] = G(se), R = E && /* @__PURE__ */ X(J, { children: [E.proposed.map((e) => /* @__PURE__ */ Y(x, {
50
- workspace: r,
50
+ workspace: i,
51
51
  entry: e,
52
52
  isNew: !1
53
53
  }, e.id)), E.notInDocs.map((e) => /* @__PURE__ */ Y(b, {
54
- workspace: r,
54
+ workspace: i,
55
55
  decision: e,
56
56
  isNew: !1,
57
57
  notInDocs: !0
@@ -64,21 +64,21 @@ function ie() {
64
64
  children: [
65
65
  /* @__PURE__ */ Y("h1", {
66
66
  className: "text-sm font-semibold",
67
- children: h ? e("teamTitle", { team: h.name }) : e("title")
67
+ children: g ? t("teamTitle", { team: g.name }) : t("title")
68
68
  }),
69
69
  /* @__PURE__ */ Y("span", {
70
70
  className: "text-xs text-muted-foreground tabular-nums",
71
- children: e("count", { count: v.length })
71
+ children: t("count", { count: v.length })
72
72
  }),
73
73
  /* @__PURE__ */ Y(S, {
74
- counts: h ? C.teams[h.id] : C.workspace,
75
- teamId: h?.id,
74
+ counts: g ? C.teams[g.id] : C.workspace,
75
+ teamId: g?.id,
76
76
  className: "max-sm:hidden"
77
77
  }),
78
78
  /* @__PURE__ */ Y("div", {
79
79
  className: "ml-auto",
80
80
  children: /* @__PURE__ */ Y(ee, {
81
- label: e("view"),
81
+ label: t("view"),
82
82
  size: "sm",
83
83
  value: I,
84
84
  onValueChange: (e) => {
@@ -86,21 +86,21 @@ function ie() {
86
86
  },
87
87
  options: [{
88
88
  value: "icons",
89
- label: e("icons"),
90
- icon: /* @__PURE__ */ Y(f, {})
89
+ label: t("icons"),
90
+ icon: /* @__PURE__ */ Y(p, {})
91
91
  }, {
92
92
  value: "list",
93
- label: e("list"),
94
- icon: /* @__PURE__ */ Y(p, {})
93
+ label: t("list"),
94
+ icon: /* @__PURE__ */ Y(m, {})
95
95
  }]
96
96
  })
97
97
  }),
98
98
  /* @__PURE__ */ Y(k, {
99
99
  variant: "primary",
100
100
  size: "sm",
101
- icon: /* @__PURE__ */ Y(c, { className: "size-3.5" }),
101
+ icon: /* @__PURE__ */ Y(l, { className: "size-3.5" }),
102
102
  onClick: P,
103
- children: e("new")
103
+ children: t("new")
104
104
  })
105
105
  ]
106
106
  }),
@@ -110,22 +110,22 @@ function ie() {
110
110
  v.length === 0 ? /* @__PURE__ */ Y("div", {
111
111
  className: "p-6",
112
112
  children: /* @__PURE__ */ Y(j, {
113
- icon: /* @__PURE__ */ Y(l, {}),
114
- title: e("none"),
115
- description: e("description"),
113
+ icon: /* @__PURE__ */ Y(u, {}),
114
+ title: t("none"),
115
+ description: t("description"),
116
116
  action: /* @__PURE__ */ Y(k, {
117
117
  variant: "primary",
118
118
  size: "sm",
119
119
  onClick: P,
120
- children: e("new")
120
+ children: t("new")
121
121
  })
122
122
  })
123
123
  }) : /* @__PURE__ */ X(J, { children: [O.length > 0 && /* @__PURE__ */ Y($, {
124
- title: e("toReview"),
124
+ title: t("toReview"),
125
125
  count: O.length,
126
- icon: /* @__PURE__ */ Y(l, { className: "size-4 text-warning" }),
126
+ icon: /* @__PURE__ */ Y(u, { className: "size-4 text-warning" }),
127
127
  children: O.map((e) => /* @__PURE__ */ Y(pe, {
128
- workspace: r,
128
+ workspace: i,
129
129
  area: e,
130
130
  counts: C.areas[e.id],
131
131
  siblings: v.filter((t) => (t.teamId ?? "") === (e.teamId ?? "")),
@@ -134,62 +134,62 @@ function ie() {
134
134
  areaMenu: F
135
135
  }, e.id))
136
136
  }), I === "icons" ? /* @__PURE__ */ Y(ue, {
137
- workspace: r,
137
+ workspace: i,
138
138
  spaces: A,
139
139
  areas: v,
140
140
  unfiledCount: D,
141
141
  unfiledRows: R,
142
142
  areaMenu: F,
143
143
  onCreate: T
144
- }, h?.id ?? "") : A.map((t) => {
145
- let n = v.filter((e) => (e.teamId ?? "") === t.id);
144
+ }, g?.id ?? "") : A.map((e) => {
145
+ let n = v.filter((t) => (t.teamId ?? "") === e.id);
146
146
  return /* @__PURE__ */ Y($, {
147
- title: t.name,
147
+ title: e.name,
148
148
  count: n.length,
149
149
  icon: /* @__PURE__ */ Y(_, {
150
- icon: t.icon,
151
- color: t.color,
152
- name: t.name
150
+ icon: e.icon,
151
+ color: e.color,
152
+ name: e.name
153
153
  }),
154
- extra: t.team && /* @__PURE__ */ Y(S, {
155
- counts: C.teams[t.team.id],
156
- teamId: t.team.id,
154
+ extra: e.team && /* @__PURE__ */ Y(S, {
155
+ counts: C.teams[e.team.id],
156
+ teamId: e.team.id,
157
157
  className: "max-sm:hidden"
158
158
  }),
159
- action: t.team && /* @__PURE__ */ Y(N, {
159
+ action: e.team && /* @__PURE__ */ Y(N, {
160
160
  variant: "ghost",
161
161
  size: "xs",
162
- icon: /* @__PURE__ */ Y(c, { className: "size-3.5" }),
163
- label: e("newIn", { space: t.name }),
162
+ icon: /* @__PURE__ */ Y(l, { className: "size-3.5" }),
163
+ label: t("newIn", { space: e.name }),
164
164
  onClick: () => T({
165
165
  kind: "create",
166
- space: t.key
166
+ space: e.key
167
167
  })
168
168
  }),
169
169
  children: /* @__PURE__ */ Y(ae, {
170
- workspace: r,
170
+ workspace: i,
171
171
  areas: n,
172
172
  counts: C.areas,
173
173
  parent: void 0,
174
174
  depth: 0,
175
175
  areaMenu: F
176
176
  })
177
- }, t.key);
177
+ }, e.key);
178
178
  })] }),
179
179
  I === "list" && D > 0 && /* @__PURE__ */ Y($, {
180
- title: e("unfiled"),
180
+ title: t("unfiled"),
181
181
  count: D,
182
- icon: /* @__PURE__ */ Y(l, { className: "size-4 text-muted-foreground" }),
182
+ icon: /* @__PURE__ */ Y(u, { className: "size-4 text-muted-foreground" }),
183
183
  children: R
184
184
  }),
185
- /* @__PURE__ */ Y(me, { workspace: r })
185
+ /* @__PURE__ */ Y(me, { workspace: i })
186
186
  ]
187
187
  }),
188
188
  w && /* @__PURE__ */ Y(ge, {
189
- workspace: r,
189
+ workspace: i,
190
190
  editing: w,
191
191
  spaces: A.filter((e) => e.team),
192
- areas: d,
192
+ areas: f,
193
193
  onClose: () => T(null)
194
194
  })
195
195
  ]
@@ -250,28 +250,28 @@ function ce(e) {
250
250
  } catch {}
251
251
  }
252
252
  var le = /* @__PURE__ */ new Map();
253
- function ue({ workspace: t, spaces: n, areas: r, unfiledCount: a, unfiledRows: o, areaMenu: s, onCreate: u }) {
254
- let d = q("areas"), { data: f = [] } = Z(i(t)), p = `${t}/${n.map((e) => e.id).join(",")}`, [m, h] = G(() => le.get(p) ?? null), g = (e) => {
253
+ function ue({ workspace: e, spaces: n, areas: r, unfiledCount: i, unfiledRows: o, areaMenu: s, onCreate: c }) {
254
+ let d = q("areas"), { data: f = [] } = Z(a(e)), p = `${e}/${n.map((e) => e.id).join(",")}`, [m, h] = G(() => le.get(p) ?? null), g = (e) => {
255
255
  le.set(p, e), h(e);
256
256
  }, v = W(() => {
257
257
  let e = /* @__PURE__ */ new Map();
258
258
  for (let t of f) t.area && e.set(t.area.id, (e.get(t.area.id) ?? 0) + 1);
259
259
  let t = (n) => (e.get(n) ?? 0) + r.filter((e) => e.parentId === n).reduce((e, n) => e + t(n.id), 0);
260
260
  return t;
261
- }, [f, r]), y = (e) => r.filter((t) => t.parentId === e), b = (e, n) => e.map((e) => /* @__PURE__ */ Y(w, {
262
- workspace: t,
263
- area: e,
264
- inside: y(e.id).length,
265
- decisions: v(e.id),
266
- menu: () => s(e, n),
261
+ }, [f, r]), y = (e) => r.filter((t) => t.parentId === e), b = (t, n) => t.map((t) => /* @__PURE__ */ Y(w, {
262
+ workspace: e,
263
+ area: t,
264
+ inside: y(t.id).length,
265
+ decisions: v(t.id),
266
+ menu: () => s(t, n),
267
267
  onOpen: (e) => g({
268
268
  kind: "area",
269
269
  trail: [...m?.kind === "area" ? m.trail : [], e]
270
270
  })
271
- }, e.id)), x = a > 0 && /* @__PURE__ */ Y(E, {
271
+ }, t.id)), x = i > 0 && /* @__PURE__ */ Y(E, {
272
272
  name: d("unfiled"),
273
- icon: /* @__PURE__ */ Y(l, { className: "size-7 opacity-60" }),
274
- hint: a,
273
+ icon: /* @__PURE__ */ Y(u, { className: "size-7 opacity-60" }),
274
+ hint: i,
275
275
  onOpen: () => g({ kind: "unfiled" })
276
276
  });
277
277
  if (!m) return n.map((e, t) => {
@@ -293,7 +293,7 @@ function ue({ workspace: t, spaces: n, areas: r, unfiledCount: a, unfiledRows: o
293
293
  });
294
294
  let S = m.kind === "area" ? m.trail.at(-1) : void 0, C = S && r.find((e) => e.id === S.id), D = C ? y(C.id) : [], k = [{
295
295
  label: d("title"),
296
- icon: /* @__PURE__ */ Y(l, { className: "size-4" })
296
+ icon: /* @__PURE__ */ Y(u, { className: "size-4" })
297
297
  }, ...m.kind === "area" ? m.trail.map((e) => ({ label: r.find((t) => t.id === e.id)?.title ?? e.title })) : [{ label: d("unfiled") }]];
298
298
  return /* @__PURE__ */ X("section", {
299
299
  "aria-label": k.at(-1)?.label,
@@ -307,10 +307,10 @@ function ue({ workspace: t, spaces: n, areas: r, unfiledCount: a, unfiledRows: o
307
307
  trail: m.trail.slice(0, t)
308
308
  }),
309
309
  className: "min-w-0 flex-1"
310
- }), C && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(e, {
310
+ }), C && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(t, {
311
311
  to: "/$workspace/areas/$area",
312
312
  params: {
313
- workspace: t,
313
+ workspace: e,
314
314
  area: C.key
315
315
  },
316
316
  className: te({
@@ -321,9 +321,9 @@ function ue({ workspace: t, spaces: n, areas: r, unfiledCount: a, unfiledRows: o
321
321
  }), /* @__PURE__ */ Y(N, {
322
322
  variant: "ghost",
323
323
  size: "xs",
324
- icon: /* @__PURE__ */ Y(c, { className: "size-3.5" }),
324
+ icon: /* @__PURE__ */ Y(l, { className: "size-3.5" }),
325
325
  label: d("addInside"),
326
- onClick: () => u({
326
+ onClick: () => c({
327
327
  kind: "create",
328
328
  parent: C
329
329
  })
@@ -331,7 +331,7 @@ function ue({ workspace: t, spaces: n, areas: r, unfiledCount: a, unfiledRows: o
331
331
  }), m.kind === "unfiled" ? /* @__PURE__ */ Y("ul", { children: o }) : D.length === 0 ? /* @__PURE__ */ Y("div", {
332
332
  className: "p-6",
333
333
  children: /* @__PURE__ */ Y(j, {
334
- icon: /* @__PURE__ */ Y(l, {}),
334
+ icon: /* @__PURE__ */ Y(u, {}),
335
335
  title: d("emptyArea")
336
336
  })
337
337
  }) : /* @__PURE__ */ Y(T, {
@@ -377,27 +377,27 @@ function de(e, t, n) {
377
377
  };
378
378
  }
379
379
  var fe = 20;
380
- function pe({ workspace: t, area: n, counts: r, siblings: i, depth: a, review: o, areaMenu: s }) {
381
- let c = q("areas"), u = q("common"), f = B(), p = C(t), m = K(), { nameOf: g, avatarOf: _ } = h(t), b = n.status === "proposed", x = () => s(n, i), w = p.accept.error ?? p.merge.error ?? p.archive.error, T = n.creator;
380
+ function pe({ workspace: e, area: n, counts: r, siblings: i, depth: a, review: o, areaMenu: s }) {
381
+ let c = q("areas"), l = q("common"), d = B(), p = C(e), m = K(), { nameOf: h, avatarOf: _ } = g(e), b = n.status === "proposed", x = () => s(n, i), w = p.accept.error ?? p.merge.error ?? p.archive.error, T = n.creator;
382
382
  return /* @__PURE__ */ X("li", {
383
383
  className: "group flex min-h-10 items-center gap-2 border-b border-border/60 pr-2 hover:bg-muted/60",
384
384
  children: [
385
- /* @__PURE__ */ X(e, {
385
+ /* @__PURE__ */ X(t, {
386
386
  to: "/$workspace/areas/$area",
387
387
  params: {
388
- workspace: t,
388
+ workspace: e,
389
389
  area: n.key
390
390
  },
391
- onContextMenu: (e) => f(e, x()),
391
+ onContextMenu: (e) => d(e, x()),
392
392
  style: { paddingLeft: `calc(var(--row-start) + ${a * fe}px)` },
393
393
  className: "flex min-w-0 flex-1 items-center gap-2 self-stretch py-2 [--row-start:1rem] md:[--row-start:1.25rem]",
394
394
  children: [
395
- n.icon ? /* @__PURE__ */ Y(v, { icon: n.icon }) : /* @__PURE__ */ Y(l, { className: "size-4 shrink-0 text-muted-foreground" }),
395
+ n.icon ? /* @__PURE__ */ Y(v, { icon: n.icon }) : /* @__PURE__ */ Y(u, { className: "size-4 shrink-0 text-muted-foreground" }),
396
396
  /* @__PURE__ */ Y("span", {
397
397
  className: "min-w-0 truncate text-sm font-medium",
398
398
  children: n.title
399
399
  }),
400
- n.homeDocId && /* @__PURE__ */ Y(d, {
400
+ n.homeDocId && /* @__PURE__ */ Y(f, {
401
401
  className: "size-3.5 shrink-0 text-muted-foreground",
402
402
  "aria-label": c("hasHomeDoc")
403
403
  }),
@@ -426,17 +426,17 @@ function pe({ workspace: t, area: n, counts: r, siblings: i, depth: a, review: o
426
426
  children: c("proposed")
427
427
  }),
428
428
  o && T && /* @__PURE__ */ Y(R, {
429
- content: c("proposedBy", { name: g(T.kind, T.handle) }),
429
+ content: c("proposedBy", { name: h(T.kind, T.handle) }),
430
430
  describesAnchor: !0,
431
431
  children: /* @__PURE__ */ X("span", {
432
432
  className: "flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground max-sm:hidden",
433
433
  children: [/* @__PURE__ */ Y(D, {
434
434
  ...y(T.kind),
435
- name: g(T.kind, T.handle),
435
+ name: h(T.kind, T.handle),
436
436
  src: _(T.kind, T.handle),
437
437
  size: "xs",
438
438
  decorative: !0
439
- }), g(T.kind, T.handle)]
439
+ }), h(T.kind, T.handle)]
440
440
  })
441
441
  }),
442
442
  /* @__PURE__ */ Y("span", {
@@ -452,18 +452,18 @@ function pe({ workspace: t, area: n, counts: r, siblings: i, depth: a, review: o
452
452
  }),
453
453
  /* @__PURE__ */ Y(ne, {
454
454
  items: x,
455
- label: u("moreActionsFor", { name: n.title })
455
+ label: l("moreActionsFor", { name: n.title })
456
456
  })
457
457
  ]
458
458
  });
459
459
  }
460
460
  function me({ workspace: e }) {
461
- let n = q("areas"), r = C(e), [i, a] = G(!1), { data: o = [], isPending: s } = Z({
462
- ...t(e, !0),
461
+ let t = q("areas"), r = C(e), [i, a] = G(!1), { data: o = [], isPending: s } = Z({
462
+ ...n(e, !0),
463
463
  enabled: i
464
464
  });
465
465
  return /* @__PURE__ */ X("section", {
466
- "aria-label": n("archived"),
466
+ "aria-label": t("archived"),
467
467
  children: [/* @__PURE__ */ Y("h2", {
468
468
  className: "border-b border-border",
469
469
  children: /* @__PURE__ */ X("button", {
@@ -472,8 +472,8 @@ function me({ workspace: e }) {
472
472
  "aria-expanded": i,
473
473
  className: "flex h-9 w-full items-center gap-2 px-4 text-xs font-medium text-muted-foreground hover:bg-muted/60 hover:text-foreground md:px-5",
474
474
  children: [
475
- /* @__PURE__ */ Y(u, { className: re("size-3.5 transition-transform", i && "rotate-90") }),
476
- n("archived"),
475
+ /* @__PURE__ */ Y(d, { className: re("size-3.5 transition-transform", i && "rotate-90") }),
476
+ t("archived"),
477
477
  i && !s && /* @__PURE__ */ Y("span", {
478
478
  className: "tabular-nums",
479
479
  children: o.length
@@ -482,11 +482,11 @@ function me({ workspace: e }) {
482
482
  })
483
483
  }), i && !s && (o.length === 0 ? /* @__PURE__ */ Y("p", {
484
484
  className: "border-b border-border/60 px-4 py-2.5 pl-10 text-xs text-muted-foreground md:pl-11",
485
- children: n("noArchived")
485
+ children: t("noArchived")
486
486
  }) : /* @__PURE__ */ Y("ul", { children: o.map((e) => /* @__PURE__ */ X("li", {
487
487
  className: "flex min-h-10 items-center gap-2 border-b border-border/60 py-1.5 pr-2 pl-4 text-muted-foreground md:pl-5",
488
488
  children: [
489
- /* @__PURE__ */ Y(l, { className: "size-4 shrink-0" }),
489
+ /* @__PURE__ */ Y(u, { className: "size-4 shrink-0" }),
490
490
  /* @__PURE__ */ Y("span", {
491
491
  className: "min-w-0 truncate text-sm",
492
492
  children: e.title
@@ -500,7 +500,7 @@ function me({ workspace: e }) {
500
500
  size: "xs",
501
501
  loading: r.restore.isPending && r.restore.variables === e.key,
502
502
  onClick: () => r.restore.mutate(e.key),
503
- children: n("restore")
503
+ children: t("restore")
504
504
  }),
505
505
  /* @__PURE__ */ Y("span", {
506
506
  "aria-hidden": !0,
@@ -511,14 +511,14 @@ function me({ workspace: e }) {
511
511
  });
512
512
  }
513
513
  var he = (e) => e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 63);
514
- function ge({ workspace: t, editing: n, spaces: i, areas: a, onClose: o }) {
515
- let s = q("areas"), c = q("common"), l = K(), u = C(t), f = n.kind === "edit" ? n.area : void 0, p = n.kind === "create" ? n.parent : void 0, [h, g] = G(f?.title ?? ""), [_, v] = G(f?.key ?? ""), [y, b] = G(!!f), [x, S] = G((f?.aliases ?? []).join(", ")), w = n.kind === "create" && n.space || i.find((e) => e.id === (f?.teamId ?? p?.teamId ?? ""))?.key || i[0]?.key || "", [T, E] = G(w), D = i.find((e) => e.key === T)?.id ?? "", [O, j] = G(p?.key ?? a.find((e) => e.id === f?.parentId)?.key ?? ""), [N, ee] = G(""), [R, te] = G(!1), { data: z = [] } = Z({
516
- ...r(t),
517
- enabled: R || !!f?.homeDocId
518
- }), B = N ? z.find((e) => e.key === N) : z.find((e) => e.id === f?.homeDocId), V = !f || f.status === "proposed", H = u.create.isPending || u.update.isPending, U = u.create.error ?? u.update.error, J = W(() => a.filter((e) => (e.teamId ?? "") === D && e.id !== f?.id), [
514
+ function ge({ workspace: e, editing: n, spaces: r, areas: a, onClose: o }) {
515
+ let s = q("areas"), c = q("common"), l = K(), u = C(e), d = n.kind === "edit" ? n.area : void 0, p = n.kind === "create" ? n.parent : void 0, [m, g] = G(d?.title ?? ""), [_, v] = G(d?.key ?? ""), [y, b] = G(!!d), [x, S] = G((d?.aliases ?? []).join(", ")), w = n.kind === "create" && n.space || r.find((e) => e.id === (d?.teamId ?? p?.teamId ?? ""))?.key || r[0]?.key || "", [T, E] = G(w), D = r.find((e) => e.key === T)?.id ?? "", [O, j] = G(p?.key ?? a.find((e) => e.id === d?.parentId)?.key ?? ""), [N, ee] = G(""), [R, te] = G(!1), { data: z = [] } = Z({
516
+ ...i(e),
517
+ enabled: R || !!d?.homeDocId
518
+ }), B = N ? z.find((e) => e.key === N) : z.find((e) => e.id === d?.homeDocId), V = !d || d.status === "proposed", H = u.create.isPending || u.update.isPending, U = u.create.error ?? u.update.error, J = W(() => a.filter((e) => (e.teamId ?? "") === D && e.id !== d?.id), [
519
519
  a,
520
520
  D,
521
- f?.id
521
+ d?.id
522
522
  ]), Q = x.split(",").map((e) => e.trim()).filter(Boolean);
523
523
  return /* @__PURE__ */ Y(F, {
524
524
  open: !0,
@@ -526,18 +526,18 @@ function ge({ workspace: t, editing: n, spaces: i, areas: a, onClose: o }) {
526
526
  className: "max-h-[85vh] w-full max-w-md overflow-y-auto p-5",
527
527
  children: /* @__PURE__ */ X("form", {
528
528
  onSubmit: (e) => {
529
- e.preventDefault(), f ? u.update.mutate({
530
- area: f.key,
529
+ e.preventDefault(), d ? u.update.mutate({
530
+ area: d.key,
531
531
  body: {
532
- title: h,
532
+ title: m,
533
533
  aliases: Q,
534
- ...V && _ !== f.key && { key: _ },
535
- ...O !== (a.find((e) => e.id === f.parentId)?.key ?? "") && { parent: O },
534
+ ...V && _ !== d.key && { key: _ },
535
+ ...O !== (a.find((e) => e.id === d.parentId)?.key ?? "") && { parent: O },
536
536
  ...N && { homeDoc: N }
537
537
  }
538
538
  }, { onSuccess: o }) : u.create.mutate({
539
539
  key: _,
540
- title: h,
540
+ title: m,
541
541
  aliases: Q,
542
542
  space: T,
543
543
  ...O && { parent: O },
@@ -547,12 +547,12 @@ function ge({ workspace: t, editing: n, spaces: i, areas: a, onClose: o }) {
547
547
  children: [
548
548
  /* @__PURE__ */ Y(I, {
549
549
  className: "text-sm font-semibold",
550
- children: s(f ? "editTitle" : "newTitle")
550
+ children: s(d ? "editTitle" : "newTitle")
551
551
  }),
552
552
  /* @__PURE__ */ X("label", {
553
553
  className: "mt-4 block text-xs font-medium text-muted-foreground",
554
554
  children: [s("fieldTitle"), /* @__PURE__ */ Y(P, {
555
- value: h,
555
+ value: m,
556
556
  onChange: (e) => {
557
557
  g(e.target.value), y || v(he(e.target.value));
558
558
  },
@@ -594,13 +594,13 @@ function ge({ workspace: t, editing: n, spaces: i, areas: a, onClose: o }) {
594
594
  }),
595
595
  /* @__PURE__ */ X("div", {
596
596
  className: "mt-3 flex flex-wrap gap-3",
597
- children: [!f && !p && /* @__PURE__ */ X("div", {
597
+ children: [!d && !p && /* @__PURE__ */ X("div", {
598
598
  className: "text-xs font-medium text-muted-foreground",
599
599
  children: [s("fieldSpace"), /* @__PURE__ */ Y("div", {
600
600
  className: "mt-1",
601
601
  children: /* @__PURE__ */ Y(L, {
602
602
  value: T,
603
- items: i.map((e) => ({
603
+ items: r.map((e) => ({
604
604
  value: e.key,
605
605
  label: e.name
606
606
  })),
@@ -641,7 +641,7 @@ function ge({ workspace: t, editing: n, spaces: i, areas: a, onClose: o }) {
641
641
  items: z.map((e) => ({
642
642
  value: e.key,
643
643
  label: e.title,
644
- icon: /* @__PURE__ */ Y(d, { className: "size-3.5" })
644
+ icon: /* @__PURE__ */ Y(f, { className: "size-3.5" })
645
645
  })),
646
646
  value: B?.key ?? null,
647
647
  onValueChange: (e) => e !== null && ee(e),
@@ -650,16 +650,16 @@ function ge({ workspace: t, editing: n, spaces: i, areas: a, onClose: o }) {
650
650
  trigger: /* @__PURE__ */ X(k, {
651
651
  type: "button",
652
652
  className: "max-w-full font-normal",
653
- children: [/* @__PURE__ */ Y(d, { className: "size-3.5 text-muted-foreground" }), /* @__PURE__ */ Y("span", {
653
+ children: [/* @__PURE__ */ Y(f, { className: "size-3.5 text-muted-foreground" }), /* @__PURE__ */ Y("span", {
654
654
  className: "truncate",
655
655
  children: B?.title ?? s("noDoc")
656
656
  })]
657
657
  })
658
- }), B && /* @__PURE__ */ Y(e, {
658
+ }), B && /* @__PURE__ */ Y(t, {
659
659
  to: "/$workspace/docs/$doc",
660
660
  params: {
661
- workspace: t,
662
- doc: m(B)
661
+ workspace: e,
662
+ doc: h(B)
663
663
  },
664
664
  className: "ml-2 text-xs font-normal text-primary hover:underline",
665
665
  children: s("openDoc")
@@ -680,9 +680,9 @@ function ge({ workspace: t, editing: n, spaces: i, areas: a, onClose: o }) {
680
680
  }), /* @__PURE__ */ Y(k, {
681
681
  type: "submit",
682
682
  variant: "primary",
683
- disabled: !h.trim() || !_,
683
+ disabled: !m.trim() || !_,
684
684
  loading: H,
685
- children: f ? c("save") : s("create")
685
+ children: d ? c("save") : s("create")
686
686
  })]
687
687
  })
688
688
  ]