@parallelworks/tandem-web 0.188.0 → 0.189.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,19 +10,20 @@ import { usePropertyText as m } from "./DocProperties.js";
10
10
  import { SeriesMenu as h } from "./DocSeries.js";
11
11
  import { Board as g, groupable as _ } from "./DocTable.js";
12
12
  import { iconImageURL as v } from "./EntityIcon.js";
13
- import { AddIcon as y, ArticleIcon as b, BoardIcon as x, CalendarIcon as S, ChevronRightIcon as C, CycleIcon as w, GridIcon as T, ListViewIcon as E, SettingsIcon as D, SpreadsheetIcon as O, TimelineIcon as k } from "./icons.js";
14
- import { Button as A, ErrorText as j, Input as M, Popover as N, Select as P, cx as F } from "@parallelworks/ui";
15
- import { Link as I, useNavigate as L } from "@tanstack/react-router";
16
- import { useMemo as R, useState as z } from "react";
17
- import { useErrorMessage as B } from "@parallelworks/problem/react";
18
- import { useFormatter as V, useLocale as ee, useTranslations as H } from "use-intl";
19
- import { Fragment as U, jsx as W, jsxs as G } from "react/jsx-runtime";
20
- import { useQuery as K } from "@tanstack/react-query";
13
+ import { AddIcon as y, ArticleIcon as b, BoardIcon as x, CalendarIcon as S, ChevronRightIcon as C, CycleIcon as ee, GridIcon as w, ListViewIcon as T, SettingsIcon as E, SpreadsheetIcon as D, TimelineIcon as O } from "./icons.js";
14
+ import { Button as k, ErrorText as A, Input as te, Popover as j, Select as M, cx as N, useOpenMenu as P } from "@parallelworks/ui";
15
+ import { Link as F, useNavigate as ne } from "@tanstack/react-router";
16
+ import { useMemo as I, useRef as re, useState as ie } from "react";
17
+ import { useErrorMessage as L } from "@parallelworks/problem/react";
18
+ import { useFormatter as R, useLocale as ae, useTranslations as z } from "use-intl";
19
+ import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
20
+ import { keepPreviousData as oe, useQuery as U } from "@tanstack/react-query";
21
+ import { useVirtualizer as se } from "@tanstack/react-virtual";
21
22
  // src/components/SubpageViews.tsx
22
- var q = [
23
+ var W = [
23
24
  {
24
25
  layout: "table",
25
- icon: O,
26
+ icon: D,
26
27
  message: "tableView",
27
28
  database: !0
28
29
  },
@@ -34,13 +35,13 @@ var q = [
34
35
  },
35
36
  {
36
37
  layout: "list",
37
- icon: E,
38
+ icon: T,
38
39
  message: "listView",
39
40
  database: !0
40
41
  },
41
42
  {
42
43
  layout: "timeline",
43
- icon: k,
44
+ icon: O,
44
45
  message: "timelineView",
45
46
  database: !0
46
47
  },
@@ -52,7 +53,7 @@ var q = [
52
53
  },
53
54
  {
54
55
  layout: "gallery",
55
- icon: T,
56
+ icon: w,
56
57
  message: "galleryView",
57
58
  database: !0
58
59
  },
@@ -62,55 +63,55 @@ var q = [
62
63
  message: "feed",
63
64
  database: !1
64
65
  }
65
- ], J = (e) => q.find((t) => t.layout === e) ?? q[4], Y = (e) => e === "calendar" || e === "timeline", X = (e, t) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
66
- function te(e) {
66
+ ], G = (e) => W.find((t) => t.layout === e) ?? W[4], K = (e) => e === "calendar" || e === "timeline", q = (e, t) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
67
+ function ce(e) {
67
68
  let t = new Intl.Locale(e);
68
69
  return (t.getWeekInfo?.().firstDay ?? t.weekInfo?.firstDay ?? 7) % 7;
69
70
  }
70
- function Z({ workspace: e, doc: t, space: n }) {
71
- let r = H("subpages"), { data: i = [] } = K(d(e, t.key)), [a, o] = z(), s = l(e, "edit_docs", n === "workspace" ? void 0 : { team: n }), c = f(e);
71
+ function le({ workspace: e, doc: t, space: n }) {
72
+ let r = z("subpages"), { data: i = [] } = U(d(e, t.key)), [a, o] = ie(), s = l(e, "edit_docs", n === "workspace" ? void 0 : { team: n }), c = f(e);
72
73
  if (i.length === 0) return null;
73
74
  let p = i.find((e) => e.id === a) ?? i[0], m = (e) => c.addView.mutate({
74
75
  doc: t.key,
75
- name: r(J(e).message),
76
+ name: r(G(e).message),
76
77
  layout: e,
77
78
  config: { ...u(p.config) }
78
79
  }, { onSuccess: (e) => o(e.id) });
79
- return /* @__PURE__ */ G("section", {
80
+ return /* @__PURE__ */ H("section", {
80
81
  className: "not-prose my-4",
81
82
  "aria-label": r("views"),
82
- children: [/* @__PURE__ */ G("div", {
83
+ children: [/* @__PURE__ */ H("div", {
83
84
  className: "flex items-center gap-1 border-b border-border",
84
85
  children: [i.map((e) => {
85
- let t = J(e.layout).icon;
86
- return /* @__PURE__ */ G("button", {
86
+ let t = G(e.layout).icon;
87
+ return /* @__PURE__ */ H("button", {
87
88
  type: "button",
88
89
  onClick: () => o(e.id),
89
90
  "aria-pressed": e.id === p.id,
90
- className: F("-mb-px flex items-center gap-1.5 border-b-2 px-2 py-1.5 text-sm", e.id === p.id ? "border-foreground font-medium" : "border-transparent text-muted-foreground hover:text-foreground"),
91
- children: [/* @__PURE__ */ W(t, { className: "size-4" }), e.name]
91
+ className: N("-mb-px flex items-center gap-1.5 border-b-2 px-2 py-1.5 text-sm", e.id === p.id ? "border-foreground font-medium" : "border-transparent text-muted-foreground hover:text-foreground"),
92
+ children: [/* @__PURE__ */ V(t, { className: "size-4" }), e.name]
92
93
  }, e.id);
93
- }), s && /* @__PURE__ */ W(N, {
94
- trigger: /* @__PURE__ */ W(A, {
94
+ }), s && /* @__PURE__ */ V(j, {
95
+ trigger: /* @__PURE__ */ V(k, {
95
96
  size: "xs",
96
97
  variant: "ghost",
97
98
  "aria-label": r("addView"),
98
- children: /* @__PURE__ */ W(y, {})
99
+ children: /* @__PURE__ */ V(y, {})
99
100
  }),
100
101
  align: "start",
101
102
  "aria-label": r("addView"),
102
- children: /* @__PURE__ */ W("div", {
103
+ children: /* @__PURE__ */ V("div", {
103
104
  className: "flex flex-col gap-1",
104
- children: q.map(({ layout: e, icon: t, message: n }) => /* @__PURE__ */ G(A, {
105
+ children: W.map(({ layout: e, icon: t, message: n }) => /* @__PURE__ */ H(k, {
105
106
  size: "sm",
106
107
  variant: "ghost",
107
108
  className: "justify-start",
108
109
  onClick: () => m(e),
109
- children: [/* @__PURE__ */ W(t, {}), r(n)]
110
+ children: [/* @__PURE__ */ V(t, {}), r(n)]
110
111
  }, e))
111
112
  })
112
113
  })]
113
- }), /* @__PURE__ */ W(ne, {
114
+ }), /* @__PURE__ */ V(ue, {
114
115
  workspace: e,
115
116
  doc: t,
116
117
  space: n,
@@ -119,17 +120,17 @@ function Z({ workspace: e, doc: t, space: n }) {
119
120
  }, p.id)]
120
121
  });
121
122
  }
122
- function ne({ workspace: e, doc: a, space: o, view: s, canWrite: l }) {
123
- let d = H("subpages"), m = B(), v = L(), b = u(s.config), { data: x = [] } = K(t(e, { parent: a.key })), { data: S = [] } = K(i(e, o)), C = S.find((e) => e.id === b.dateProperty && e.kind === "date"), w = S.find((e) => e.id === b.groupBy && _(e)), [T, E] = z(""), D = f(e), O = T.trim().toLowerCase(), k = O ? x.filter((e) => e.title.toLowerCase().includes(O)) : x, P = (e) => {
123
+ function ue({ workspace: e, doc: a, space: o, view: s, canWrite: l }) {
124
+ let d = z("subpages"), m = L(), v = ne(), b = u(s.config), { data: x = [] } = U(t(e, { parent: a.key })), { data: S = [] } = U(i(e, o)), C = S.find((e) => e.id === b.dateProperty && e.kind === "date"), ee = S.find((e) => e.id === b.groupBy && _(e)), [w, T] = ie(""), E = f(e), D = w.trim().toLowerCase(), O = D ? x.filter((e) => e.title.toLowerCase().includes(D)) : x, M = (e) => {
124
125
  let t = C && e.properties?.[C.id];
125
126
  return typeof t == "string" && n(t) ? t : void 0;
126
- }, F = k.filter((e) => !P(e)), R = (t) => D.newSubpage.mutate({
127
+ }, N = O.filter((e) => !M(e)), P = (t, n) => E.newSubpage.mutate({
127
128
  parent: a,
128
129
  title: t ? d("titleOn", {
129
130
  title: a.title,
130
131
  date: t
131
132
  }) : d("untitled"),
132
- template: b.template,
133
+ template: n === void 0 ? b.template : n ?? void 0,
133
134
  dateProperty: C?.id,
134
135
  date: t
135
136
  }, { onSuccess: (t) => v({
@@ -138,52 +139,52 @@ function ne({ workspace: e, doc: a, space: o, view: s, canWrite: l }) {
138
139
  workspace: e,
139
140
  doc: c(t)
140
141
  }
141
- }) }), V = /* @__PURE__ */ G(U, { children: [
142
- C && Y(s.layout) && /* @__PURE__ */ W(N, {
143
- trigger: /* @__PURE__ */ W(A, {
142
+ }) }), I = /* @__PURE__ */ H(B, { children: [
143
+ C && K(s.layout) && /* @__PURE__ */ V(j, {
144
+ trigger: /* @__PURE__ */ V(k, {
144
145
  size: "xs",
145
146
  variant: "ghost",
146
- children: d("noDate", { count: F.length })
147
+ children: d("noDate", { count: N.length })
147
148
  }),
148
149
  align: "start",
149
150
  className: "max-h-80 w-72 overflow-y-auto",
150
151
  "aria-label": d("noDateTitle"),
151
- children: F.length === 0 ? /* @__PURE__ */ W("p", {
152
+ children: N.length === 0 ? /* @__PURE__ */ V("p", {
152
153
  className: "text-sm text-muted-foreground",
153
154
  children: d("allDated")
154
- }) : /* @__PURE__ */ W("ul", {
155
+ }) : /* @__PURE__ */ V("ul", {
155
156
  className: "space-y-1",
156
- children: F.map((t) => /* @__PURE__ */ W("li", { children: /* @__PURE__ */ G(I, {
157
+ children: N.map((t) => /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H(F, {
157
158
  to: "/$workspace/docs/$doc",
158
159
  params: {
159
160
  workspace: e,
160
161
  doc: c(t)
161
162
  },
162
163
  className: "flex items-center gap-1.5 truncate text-sm hover:underline",
163
- children: [/* @__PURE__ */ W(p, { icon: t.icon }), /* @__PURE__ */ W("span", {
164
+ children: [/* @__PURE__ */ V(p, { icon: t.icon }), /* @__PURE__ */ V("span", {
164
165
  className: "truncate",
165
166
  children: t.title
166
167
  })]
167
168
  }) }, t.id))
168
169
  })
169
170
  }),
170
- /* @__PURE__ */ W(M, {
171
+ /* @__PURE__ */ V(te, {
171
172
  type: "search",
172
173
  size: "sm",
173
- value: T,
174
- onChange: (e) => E(e.target.value),
174
+ value: w,
175
+ onChange: (e) => T(e.target.value),
175
176
  placeholder: d("search"),
176
177
  "aria-label": d("search"),
177
178
  className: "w-40"
178
179
  }),
179
- l && /* @__PURE__ */ G(U, { children: [
180
- /* @__PURE__ */ W(Q, {
180
+ l && /* @__PURE__ */ H(B, { children: [
181
+ /* @__PURE__ */ V(J, {
181
182
  workspace: e,
182
183
  space: o,
183
184
  view: s,
184
185
  config: b
185
186
  }),
186
- C && /* @__PURE__ */ W(h, {
187
+ C && /* @__PURE__ */ V(h, {
187
188
  workspace: e,
188
189
  space: o,
189
190
  dateProperty: C.id,
@@ -192,69 +193,70 @@ function ne({ workspace: e, doc: a, space: o, view: s, canWrite: l }) {
192
193
  key: a.key
193
194
  }
194
195
  }),
195
- /* @__PURE__ */ G(A, {
196
+ /* @__PURE__ */ H(k, {
196
197
  size: "xs",
197
198
  variant: "primary",
198
- loading: D.newSubpage.isPending,
199
- onClick: () => R(C ? r(/* @__PURE__ */ new Date()) : void 0),
200
- children: [/* @__PURE__ */ W(y, {}), d("new")]
199
+ loading: E.newSubpage.isPending,
200
+ onClick: () => P(C ? r(/* @__PURE__ */ new Date()) : void 0),
201
+ children: [/* @__PURE__ */ V(y, {}), d("new")]
201
202
  })
202
203
  ] })
203
204
  ] });
204
- return /* @__PURE__ */ G("div", {
205
+ return /* @__PURE__ */ H("div", {
205
206
  className: "pt-2",
206
- children: [D.newSubpage.error && /* @__PURE__ */ W(j, { children: m(D.newSubpage.error) }), s.layout === "feed" ? /* @__PURE__ */ W(ie, {
207
+ children: [E.newSubpage.error && /* @__PURE__ */ V(A, { children: m(E.newSubpage.error) }), s.layout === "feed" ? /* @__PURE__ */ V(Q, {
207
208
  workspace: e,
208
- docs: k,
209
- dateOf: P,
210
- toolbar: V
211
- }) : s.layout === "table" ? /* @__PURE__ */ W(oe, {
209
+ docs: O,
210
+ dateOf: M,
211
+ toolbar: I
212
+ }) : s.layout === "table" ? /* @__PURE__ */ V(he, {
212
213
  workspace: e,
213
- docs: k,
214
+ docs: O,
214
215
  props: S,
215
- toolbar: V
216
- }) : s.layout === "list" ? /* @__PURE__ */ W(se, {
216
+ toolbar: I
217
+ }) : s.layout === "list" ? /* @__PURE__ */ V(ge, {
217
218
  workspace: e,
218
- docs: k,
219
- toolbar: V
220
- }) : s.layout === "gallery" ? /* @__PURE__ */ W(ce, {
219
+ docs: O,
220
+ toolbar: I
221
+ }) : s.layout === "gallery" ? /* @__PURE__ */ V(_e, {
221
222
  workspace: e,
222
- docs: k,
223
- toolbar: V
224
- }) : s.layout === "board" ? w ? /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W("div", {
223
+ docs: O,
224
+ toolbar: I
225
+ }) : s.layout === "board" ? ee ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("div", {
225
226
  className: "flex flex-wrap items-center gap-1 py-2",
226
- children: V
227
- }), /* @__PURE__ */ W(g, {
227
+ children: I
228
+ }), /* @__PURE__ */ V(g, {
228
229
  workspace: e,
229
230
  space: o,
230
- docs: k,
231
+ docs: O,
231
232
  props: S,
232
- by: w
233
- })] }) : /* @__PURE__ */ G("div", {
233
+ by: ee
234
+ })] }) : /* @__PURE__ */ H("div", {
234
235
  className: "flex flex-wrap items-center gap-2 py-3 text-sm text-muted-foreground",
235
- children: [d("pickGroup"), l && /* @__PURE__ */ W(Q, {
236
+ children: [d("pickGroup"), l && /* @__PURE__ */ V(J, {
236
237
  workspace: e,
237
238
  space: o,
238
239
  view: s,
239
240
  config: b,
240
241
  open: !0
241
242
  })]
242
- }) : C ? s.layout === "timeline" ? /* @__PURE__ */ W(le, {
243
+ }) : C ? s.layout === "timeline" ? /* @__PURE__ */ V(ve, {
243
244
  workspace: e,
244
- docs: k,
245
- dateOf: P,
246
- toolbar: V
247
- }) : /* @__PURE__ */ W(re, {
245
+ docs: O,
246
+ dateOf: M,
247
+ toolbar: I
248
+ }) : /* @__PURE__ */ V(pe, {
248
249
  workspace: e,
249
- docs: k,
250
- dateOf: P,
251
- toolbar: V,
250
+ docs: O,
251
+ dateOf: M,
252
+ toolbar: I,
252
253
  parent: a,
253
254
  space: o,
254
- onNew: l ? (e) => R(e) : void 0
255
- }) : /* @__PURE__ */ G("div", {
255
+ viewTemplate: b.template,
256
+ onNew: l ? (e, t) => P(e, t) : void 0
257
+ }) : /* @__PURE__ */ H("div", {
256
258
  className: "flex flex-wrap items-center gap-2 py-3 text-sm text-muted-foreground",
257
- children: [s.layout === "timeline" ? d("pickTimelineDate") : d("pickDate"), l && /* @__PURE__ */ W(Q, {
259
+ children: [s.layout === "timeline" ? d("pickTimelineDate") : d("pickDate"), l && /* @__PURE__ */ V(J, {
258
260
  workspace: e,
259
261
  space: o,
260
262
  view: s,
@@ -264,32 +266,32 @@ function ne({ workspace: e, doc: a, space: o, view: s, canWrite: l }) {
264
266
  })]
265
267
  });
266
268
  }
267
- function Q({ workspace: t, space: n, view: r, config: o, open: s }) {
268
- let c = H("subpages"), l = B(), u = f(t), d = a(t), { data: p = [] } = K(i(t, n)), { data: m = [] } = K(e(t)), h = p.filter((e) => e.kind === "date"), g = p.filter(_), v = (e) => u.updateView.mutate({
269
+ function J({ workspace: t, space: n, view: r, config: o, open: s }) {
270
+ let c = z("subpages"), l = L(), u = f(t), d = a(t), { data: p = [] } = U(i(t, n)), { data: m = [] } = U(e(t)), h = p.filter((e) => e.kind === "date"), g = p.filter(_), v = (e) => u.updateView.mutate({
269
271
  view: r,
270
272
  config: { ...e }
271
273
  }), y = "block text-xs font-medium text-muted-foreground";
272
- return /* @__PURE__ */ W(N, {
273
- trigger: s ? /* @__PURE__ */ W(A, {
274
+ return /* @__PURE__ */ V(j, {
275
+ trigger: s ? /* @__PURE__ */ V(k, {
274
276
  size: "xs",
275
277
  children: c("settings")
276
- }) : /* @__PURE__ */ W(A, {
278
+ }) : /* @__PURE__ */ V(k, {
277
279
  size: "xs",
278
280
  variant: "ghost",
279
281
  "aria-label": c("settings"),
280
- children: /* @__PURE__ */ W(D, {})
282
+ children: /* @__PURE__ */ V(E, {})
281
283
  }),
282
284
  align: "end",
283
285
  className: "w-72",
284
286
  "aria-label": c("settings"),
285
- children: /* @__PURE__ */ G("div", {
287
+ children: /* @__PURE__ */ H("div", {
286
288
  className: "space-y-3",
287
289
  children: [
288
- r.layout === "board" && /* @__PURE__ */ G("div", {
290
+ r.layout === "board" && /* @__PURE__ */ H("div", {
289
291
  className: y,
290
- children: [c("groupBy"), /* @__PURE__ */ G("div", {
292
+ children: [c("groupBy"), /* @__PURE__ */ H("div", {
291
293
  className: "mt-1 flex items-center gap-2",
292
- children: [g.length > 0 && /* @__PURE__ */ W(P, {
294
+ children: [g.length > 0 && /* @__PURE__ */ V(M, {
293
295
  value: o.groupBy ?? "",
294
296
  items: [{
295
297
  value: "",
@@ -304,7 +306,7 @@ function Q({ workspace: t, space: n, view: r, config: o, open: s }) {
304
306
  }),
305
307
  "aria-label": c("groupBy"),
306
308
  size: "sm"
307
- }), /* @__PURE__ */ W(A, {
309
+ }), /* @__PURE__ */ V(k, {
308
310
  size: "xs",
309
311
  loading: d.create.isPending,
310
312
  onClick: async () => {
@@ -327,11 +329,11 @@ function Q({ workspace: t, space: n, view: r, config: o, open: s }) {
327
329
  })]
328
330
  })]
329
331
  }),
330
- (Y(r.layout) || r.layout === "feed") && /* @__PURE__ */ G("div", {
332
+ (K(r.layout) || r.layout === "feed") && /* @__PURE__ */ H("div", {
331
333
  className: y,
332
- children: [c("dateProperty"), /* @__PURE__ */ G("div", {
334
+ children: [c("dateProperty"), /* @__PURE__ */ H("div", {
333
335
  className: "mt-1 flex items-center gap-2",
334
- children: [h.length > 0 && /* @__PURE__ */ W(P, {
336
+ children: [h.length > 0 && /* @__PURE__ */ V(M, {
335
337
  value: o.dateProperty ?? "",
336
338
  items: [{
337
339
  value: "",
@@ -346,7 +348,7 @@ function Q({ workspace: t, space: n, view: r, config: o, open: s }) {
346
348
  }),
347
349
  "aria-label": c("dateProperty"),
348
350
  size: "sm"
349
- }), /* @__PURE__ */ W(A, {
351
+ }), /* @__PURE__ */ V(k, {
350
352
  size: "xs",
351
353
  loading: d.create.isPending,
352
354
  onClick: async () => {
@@ -364,11 +366,11 @@ function Q({ workspace: t, space: n, view: r, config: o, open: s }) {
364
366
  })]
365
367
  })]
366
368
  }),
367
- /* @__PURE__ */ G("div", {
369
+ /* @__PURE__ */ H("div", {
368
370
  className: y,
369
- children: [c("template"), /* @__PURE__ */ W("div", {
371
+ children: [c("template"), /* @__PURE__ */ V("div", {
370
372
  className: "mt-1",
371
- children: /* @__PURE__ */ W(P, {
373
+ children: /* @__PURE__ */ V(M, {
372
374
  value: o.template ?? "",
373
375
  items: [{
374
376
  value: "",
@@ -386,8 +388,8 @@ function Q({ workspace: t, space: n, view: r, config: o, open: s }) {
386
388
  })
387
389
  })]
388
390
  }),
389
- (u.updateView.error ?? d.create.error) && /* @__PURE__ */ W(j, { children: l(u.updateView.error ?? d.create.error) }),
390
- /* @__PURE__ */ W(A, {
391
+ (u.updateView.error ?? d.create.error) && /* @__PURE__ */ V(A, { children: l(u.updateView.error ?? d.create.error) }),
392
+ /* @__PURE__ */ V(k, {
391
393
  size: "xs",
392
394
  variant: "danger",
393
395
  onClick: () => u.removeView.mutate(r),
@@ -397,178 +399,241 @@ function Q({ workspace: t, space: n, view: r, config: o, open: s }) {
397
399
  })
398
400
  });
399
401
  }
400
- function re({ workspace: e, docs: t, dateOf: i, toolbar: a, parent: l, space: u, onNew: d }) {
401
- let f = H("subpages"), m = V(), h = ee(), g = L(), _ = R(() => /* @__PURE__ */ new Date(), []), [v, b] = z(_), x = new Date(v.getFullYear(), v.getMonth(), 1), S = te(h), T = X(x, -((x.getDay() - S + 7) % 7)), E = new Date(v.getFullYear(), v.getMonth() + 1, 0), D = Math.ceil(((E.getTime() - T.getTime()) / 864e5 + 1) / 7), O = Array.from({ length: D * 7 }, (e, t) => X(T, t)), { data: k = [] } = K(o(e, u, r(O[0]), r(O[O.length - 1]))), j = s(e), M = R(() => {
402
+ var Y = 128, de = 3, X = 32, Z = 5200, fe = (e, t) => Math.round((Date.UTC(t.getFullYear(), t.getMonth(), t.getDate()) - Date.UTC(e.getFullYear(), e.getMonth(), e.getDate())) / 864e5);
403
+ function pe({ workspace: t, docs: i, dateOf: a, toolbar: l, parent: u, space: d, viewTemplate: f, onNew: m }) {
404
+ let h = z("subpages"), g = R(), _ = ae(), v = ne(), b = P(), x = I(() => /* @__PURE__ */ new Date(), []), S = ce(_), w = I(() => q(x, -((x.getDay() - S + 7) % 7) - Z * 7), [x, S]), T = (e) => Math.floor(fe(w, e) / 7), E = (e) => q(w, e * 7), D = re(null), [O, A] = ie(() => new Date(x.getFullYear(), x.getMonth(), 1)), te = (e, t) => {
405
+ let n = Math.max(0, Math.floor((e + t / 2 - X) / Y)), r = q(E(n), 3);
406
+ return new Date(r.getFullYear(), r.getMonth(), 1);
407
+ }, M = se({
408
+ count: 10401,
409
+ getScrollElement: () => D.current,
410
+ estimateSize: () => Y,
411
+ overscan: 3,
412
+ scrollMargin: X,
413
+ initialOffset: 5199 * Y,
414
+ onChange: (e) => {
415
+ let t = te(e.scrollOffset ?? 0, e.scrollRect?.height ?? 0);
416
+ A((e) => e.getTime() === t.getTime() ? e : t);
417
+ }
418
+ }), L = (e) => {
419
+ A(e), M.scrollToIndex(T(e), { align: "start" });
420
+ }, B = M.getVirtualItems(), W = E(B[0]?.index ?? Z), G = q(E(B[B.length - 1]?.index ?? Z), 6), { data: K = [] } = U({
421
+ ...o(t, d, r(new Date(W.getFullYear(), W.getMonth(), 1)), r(new Date(G.getFullYear(), G.getMonth() + 1, 0))),
422
+ placeholderData: oe
423
+ }), le = s(t), { data: ue = [] } = U(e(t)), J = I(() => {
402
424
  let e = /* @__PURE__ */ new Map();
403
- for (let n of t) {
404
- let t = i(n);
405
- t && e.set(t, [...e.get(t) ?? [], n]);
425
+ for (let t of i) {
426
+ let n = a(t);
427
+ n && e.set(n, [...e.get(n) ?? [], t]);
406
428
  }
407
429
  return e;
408
- }, [t, i]), N = R(() => {
430
+ }, [i, a]), pe = I(() => {
409
431
  let e = /* @__PURE__ */ new Map();
410
- for (let t of k) if (t.parentId === l.id && !t.stoppedAt) for (let n of t.upcoming ?? []) e.set(n, [...e.get(n) ?? [], t]);
432
+ for (let t of K) if (t.parentId === u.id && !t.stoppedAt) for (let n of t.upcoming ?? []) e.set(n, [...e.get(n) ?? [], t]);
411
433
  return e;
412
- }, [k, l.id]), P = r(_), B = (t) => /* @__PURE__ */ G(I, {
434
+ }, [K, u.id]), Q = r(x), me = (e) => /* @__PURE__ */ H(F, {
413
435
  to: "/$workspace/docs/$doc",
414
436
  params: {
415
- workspace: e,
416
- doc: c(t)
437
+ workspace: t,
438
+ doc: c(e)
417
439
  },
418
440
  className: "flex min-w-0 items-center gap-1 rounded bg-card px-1.5 py-0.5 text-xs shadow-xs ring-1 ring-border hover:bg-accent",
419
- children: [/* @__PURE__ */ W(p, { icon: t.icon }), /* @__PURE__ */ W("span", {
441
+ children: [/* @__PURE__ */ V(p, { icon: e.icon }), /* @__PURE__ */ V("span", {
420
442
  className: "truncate",
421
- children: t.title
443
+ children: e.title
422
444
  })]
423
- }, t.id), U = (t, n) => /* @__PURE__ */ G("button", {
445
+ }, e.id), he = (e, n) => /* @__PURE__ */ H("button", {
424
446
  type: "button",
425
- disabled: !d || j.makeDoc.isPending,
426
- onClick: () => j.makeDoc.mutate({
427
- id: t.id,
447
+ disabled: !m || le.makeDoc.isPending,
448
+ onClick: () => le.makeDoc.mutate({
449
+ id: e.id,
428
450
  day: n
429
- }, { onSuccess: (t) => g({
451
+ }, { onSuccess: (e) => v({
430
452
  to: "/$workspace/docs/$doc",
431
453
  params: {
432
- workspace: e,
433
- doc: c(t)
454
+ workspace: t,
455
+ doc: c(e)
434
456
  }
435
457
  }) }),
436
- "aria-label": f("makeSeriesDoc", { series: t.title }),
458
+ "aria-label": h("makeSeriesDoc", { series: e.title }),
437
459
  className: "flex min-w-0 items-center gap-1 rounded border border-dashed border-border px-1.5 py-0.5 text-left text-xs text-muted-foreground enabled:hover:border-primary enabled:hover:text-foreground",
438
- children: [/* @__PURE__ */ W(w, { className: "size-3 shrink-0" }), /* @__PURE__ */ W("span", {
460
+ children: [/* @__PURE__ */ V(ee, { className: "size-3 shrink-0" }), /* @__PURE__ */ V("span", {
439
461
  className: "truncate",
440
- children: t.title
462
+ children: e.title
441
463
  })]
442
- }, `${t.id}-${n}`), q = (e, t = !1) => d && /* @__PURE__ */ W("button", {
464
+ }, `${e.id}-${n}`), ge = ue.filter((e) => e.starter || !e.teamId || e.teamId === u.teamId).sort((e, t) => Number(t.id === f) - Number(e.id === f)), _e = (e, t = !1) => m && /* @__PURE__ */ V("button", {
443
465
  type: "button",
444
- onClick: () => d(e),
445
- "aria-label": f("newOn", { date: m.dateTime(n(e), { dateStyle: "medium" }) }),
446
- className: F("rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:opacity-100", !t && "opacity-0 group-hover:opacity-100"),
447
- children: /* @__PURE__ */ W(y, { className: "size-3.5" })
448
- }), J = (e) => e.getDay() === 0 || e.getDay() === 6, Y = (e) => e.getMonth() === v.getMonth(), Z = O.filter((e) => Y(e) && (M.has(r(e)) || N.has(r(e)) || r(e) === P));
449
- return /* @__PURE__ */ G("div", {
466
+ onClick: (t) => b(t, [
467
+ ...ge.filter((e) => e.id === f).map((t) => ({
468
+ label: h("fromTemplateDefault", { template: t.title }),
469
+ onClick: () => m(e, t.id)
470
+ })),
471
+ {
472
+ label: h("emptyPage"),
473
+ onClick: () => m(e, null)
474
+ },
475
+ ...ge.filter((e) => e.id !== f).map((t) => ({
476
+ label: t.title,
477
+ onClick: () => m(e, t.id)
478
+ }))
479
+ ]),
480
+ "aria-label": h("newOn", { date: g.dateTime(n(e), { dateStyle: "medium" }) }),
481
+ className: N("rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:opacity-100", !t && "opacity-0 group-hover:opacity-100"),
482
+ children: /* @__PURE__ */ V(y, { className: "size-3.5" })
483
+ }), $ = (e) => e.getDay() === 0 || e.getDay() === 6, ve = (e) => e.getMonth() === O.getMonth() && e.getFullYear() === O.getFullYear(), ye = (e) => [...(J.get(e) ?? []).map(me), ...(pe.get(e) ?? []).map((t) => he(t, e))], be = Array.from({ length: new Date(O.getFullYear(), O.getMonth() + 1, 0).getDate() }, (e, t) => new Date(O.getFullYear(), O.getMonth(), t + 1)).filter((e) => J.has(r(e)) || pe.has(r(e)) || r(e) === Q);
484
+ return /* @__PURE__ */ H("div", {
450
485
  className: "flex flex-col",
451
486
  children: [
452
- /* @__PURE__ */ G("div", {
487
+ /* @__PURE__ */ H("div", {
453
488
  className: "flex flex-wrap items-center gap-2 py-2",
454
489
  children: [
455
- /* @__PURE__ */ W("h3", {
456
- className: "text-base font-semibold",
457
- children: m.dateTime(x, {
490
+ /* @__PURE__ */ H("h3", {
491
+ className: "grid text-base font-semibold tabular-nums",
492
+ "aria-live": "polite",
493
+ children: [Array.from({ length: 12 }, (e, t) => g.dateTime(new Date(O.getFullYear(), t, 1), {
458
494
  month: "long",
459
495
  year: "numeric"
460
- })
496
+ })).map((e) => /* @__PURE__ */ V("span", {
497
+ "aria-hidden": !0,
498
+ className: "invisible col-start-1 row-start-1",
499
+ children: e
500
+ }, e)), /* @__PURE__ */ V("span", {
501
+ className: "col-start-1 row-start-1",
502
+ children: g.dateTime(O, {
503
+ month: "long",
504
+ year: "numeric"
505
+ })
506
+ })]
461
507
  }),
462
- /* @__PURE__ */ W("span", {
508
+ /* @__PURE__ */ V("span", {
463
509
  className: "flex flex-wrap items-center gap-1",
464
- children: a
510
+ children: l
465
511
  }),
466
- /* @__PURE__ */ G("span", {
512
+ /* @__PURE__ */ H("span", {
467
513
  className: "ml-auto flex items-center gap-1",
468
514
  children: [
469
- /* @__PURE__ */ W(A, {
515
+ /* @__PURE__ */ V(k, {
470
516
  size: "xs",
471
517
  variant: "ghost",
472
- onClick: () => b(new Date(v.getFullYear(), v.getMonth() - 1, 1)),
473
- "aria-label": f("previousMonth"),
474
- children: /* @__PURE__ */ W(C, { className: "rotate-180" })
518
+ onClick: () => L(new Date(O.getFullYear(), O.getMonth() - 1, 1)),
519
+ "aria-label": h("previousMonth"),
520
+ children: /* @__PURE__ */ V(C, { className: "rotate-180" })
475
521
  }),
476
- /* @__PURE__ */ W(A, {
522
+ /* @__PURE__ */ V(k, {
477
523
  size: "xs",
478
524
  variant: "ghost",
479
- onClick: () => b(_),
480
- children: f("today")
525
+ onClick: () => L(new Date(x.getFullYear(), x.getMonth(), 1)),
526
+ children: h("today")
481
527
  }),
482
- /* @__PURE__ */ W(A, {
528
+ /* @__PURE__ */ V(k, {
483
529
  size: "xs",
484
530
  variant: "ghost",
485
- onClick: () => b(new Date(v.getFullYear(), v.getMonth() + 1, 1)),
486
- "aria-label": f("nextMonth"),
487
- children: /* @__PURE__ */ W(C, {})
531
+ onClick: () => L(new Date(O.getFullYear(), O.getMonth() + 1, 1)),
532
+ "aria-label": h("nextMonth"),
533
+ children: /* @__PURE__ */ V(C, {})
488
534
  })
489
535
  ]
490
536
  })
491
537
  ]
492
538
  }),
493
- /* @__PURE__ */ G("div", {
494
- className: "overflow-hidden rounded-md border border-border max-sm:hidden",
495
- children: [/* @__PURE__ */ W("div", {
496
- className: "grid grid-cols-7 border-b border-border text-xs text-muted-foreground",
497
- children: O.slice(0, 7).map((e) => /* @__PURE__ */ W("span", {
498
- className: F("px-2 py-1.5", J(e) && "bg-muted/40"),
499
- children: m.dateTime(e, { weekday: "short" })
539
+ /* @__PURE__ */ H("div", {
540
+ ref: D,
541
+ className: "h-[min(72vh,760px)] overflow-y-auto rounded-md border border-border max-sm:hidden",
542
+ children: [/* @__PURE__ */ V("div", {
543
+ className: "sticky top-0 z-10 grid grid-cols-7 border-b border-border bg-card text-xs text-muted-foreground",
544
+ style: { height: X },
545
+ children: Array.from({ length: 7 }, (e, t) => q(w, t)).map((e) => /* @__PURE__ */ V("span", {
546
+ className: N("flex items-center px-2", $(e) && "bg-muted/40"),
547
+ children: g.dateTime(e, { weekday: "short" })
500
548
  }, e.getDay()))
501
- }), /* @__PURE__ */ W("ol", {
502
- className: "grid grid-cols-7",
503
- "aria-label": f("calendarView"),
504
- children: O.map((e) => {
505
- let t = r(e);
506
- return /* @__PURE__ */ G("li", {
507
- "aria-label": m.dateTime(e, { dateStyle: "full" }),
508
- className: F("group flex min-h-28 min-w-0 flex-col gap-1 border-r border-b border-border p-1 [&:nth-child(7n)]:border-r-0", J(e) && "bg-muted/40", !Y(e) && "text-muted-foreground"),
509
- children: [
510
- /* @__PURE__ */ G("span", {
511
- className: "flex items-center justify-between",
512
- children: [q(t), /* @__PURE__ */ W("span", {
513
- className: F("ml-auto flex h-6 min-w-6 items-center justify-center whitespace-nowrap rounded-full px-1 text-xs tabular-nums", t === P && "bg-primary font-medium text-primary-foreground"),
514
- children: e.getDate() === 1 ? m.dateTime(e, {
515
- month: "short",
516
- day: "numeric"
517
- }) : e.getDate()
518
- })]
519
- }),
520
- (M.get(t) ?? []).map(B),
521
- (N.get(t) ?? []).map((e) => U(e, t))
522
- ]
523
- }, t);
524
- })
549
+ }), /* @__PURE__ */ V("ol", {
550
+ className: "relative",
551
+ style: { height: M.getTotalSize() - X },
552
+ "aria-label": h("calendarView"),
553
+ children: B.map((e) => /* @__PURE__ */ V("li", {
554
+ className: "absolute inset-x-0",
555
+ style: {
556
+ height: Y,
557
+ transform: `translateY(${e.start - X}px)`
558
+ },
559
+ children: /* @__PURE__ */ V("ol", {
560
+ className: "grid h-full grid-cols-7",
561
+ children: Array.from({ length: 7 }, (t, n) => q(E(e.index), n)).map((e) => {
562
+ let t = r(e), n = ye(t), i = n.length - de;
563
+ return /* @__PURE__ */ H("li", {
564
+ "aria-label": g.dateTime(e, { dateStyle: "full" }),
565
+ className: N("group flex min-w-0 flex-col gap-1 overflow-hidden border-r border-b border-border p-1 last:border-r-0", $(e) && "bg-muted/40", !ve(e) && "text-muted-foreground"),
566
+ children: [
567
+ /* @__PURE__ */ H("span", {
568
+ className: "flex items-center justify-between",
569
+ children: [_e(t), /* @__PURE__ */ V("span", {
570
+ className: N("ml-auto flex h-6 min-w-6 items-center justify-center whitespace-nowrap rounded-full px-1 text-xs tabular-nums", t === Q && "bg-primary font-medium text-primary-foreground", e.getDate() === 1 && t !== Q && "font-medium"),
571
+ children: e.getDate() === 1 ? g.dateTime(e, {
572
+ month: "short",
573
+ day: "numeric"
574
+ }) : e.getDate()
575
+ })]
576
+ }),
577
+ n.slice(0, i > 0 ? 2 : de),
578
+ i > 0 && /* @__PURE__ */ V(j, {
579
+ trigger: /* @__PURE__ */ V("button", {
580
+ type: "button",
581
+ className: "self-start rounded px-1 text-xs text-muted-foreground hover:bg-accent hover:text-foreground",
582
+ children: h("moreOnDay", { count: i + 1 })
583
+ }),
584
+ align: "start",
585
+ className: "max-h-80 w-64 space-y-1 overflow-y-auto",
586
+ "aria-label": g.dateTime(e, { dateStyle: "full" }),
587
+ children: n
588
+ })
589
+ ]
590
+ }, t);
591
+ })
592
+ })
593
+ }, e.key))
525
594
  })]
526
595
  }),
527
- /* @__PURE__ */ W("ol", {
596
+ /* @__PURE__ */ V("ol", {
528
597
  className: "divide-y divide-border rounded-md border border-border sm:hidden",
529
- children: Z.map((e) => {
598
+ children: be.map((e) => {
530
599
  let t = r(e);
531
- return /* @__PURE__ */ G("li", {
600
+ return /* @__PURE__ */ H("li", {
532
601
  className: "flex flex-col gap-1 px-3 py-2",
533
- children: [
534
- /* @__PURE__ */ G("span", {
535
- className: "flex items-center justify-between text-xs",
536
- children: [/* @__PURE__ */ W("span", {
537
- className: t === P ? "font-medium text-primary" : "text-muted-foreground",
538
- children: m.dateTime(e, {
539
- weekday: "long",
540
- month: "short",
541
- day: "numeric"
542
- })
543
- }), q(t, !0)]
544
- }),
545
- (M.get(t) ?? []).map(B),
546
- (N.get(t) ?? []).map((e) => U(e, t))
547
- ]
602
+ children: [/* @__PURE__ */ H("span", {
603
+ className: "flex items-center justify-between text-xs",
604
+ children: [/* @__PURE__ */ V("span", {
605
+ className: t === Q ? "font-medium text-primary" : "text-muted-foreground",
606
+ children: g.dateTime(e, {
607
+ weekday: "long",
608
+ month: "short",
609
+ day: "numeric"
610
+ })
611
+ }), _e(t, !0)]
612
+ }), ye(t)]
548
613
  }, t);
549
614
  })
550
615
  })
551
616
  ]
552
617
  });
553
618
  }
554
- function ie({ workspace: e, docs: t, dateOf: r, toolbar: i }) {
555
- let a = H("subpages"), o = V(), s = [...t].sort((e, t) => {
619
+ function Q({ workspace: e, docs: t, dateOf: r, toolbar: i }) {
620
+ let a = z("subpages"), o = R(), s = [...t].sort((e, t) => {
556
621
  let n = r(e) ?? "", i = r(t) ?? "";
557
622
  return n === i ? t.updatedAt < e.updatedAt ? -1 : 1 : n < i ? 1 : -1;
558
623
  });
559
- return /* @__PURE__ */ G("div", {
624
+ return /* @__PURE__ */ H("div", {
560
625
  className: "flex flex-col",
561
- children: [/* @__PURE__ */ W("div", {
626
+ children: [/* @__PURE__ */ V("div", {
562
627
  className: "flex flex-wrap items-center gap-1 py-2",
563
628
  children: i
564
- }), s.length === 0 ? /* @__PURE__ */ W("p", {
629
+ }), s.length === 0 ? /* @__PURE__ */ V("p", {
565
630
  className: "py-3 text-sm text-muted-foreground",
566
631
  children: a("none")
567
- }) : /* @__PURE__ */ W("ul", {
632
+ }) : /* @__PURE__ */ V("ul", {
568
633
  className: "divide-y divide-border",
569
634
  children: s.map((t) => {
570
635
  let i = r(t);
571
- return /* @__PURE__ */ W("li", { children: /* @__PURE__ */ G(I, {
636
+ return /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H(F, {
572
637
  to: "/$workspace/docs/$doc",
573
638
  params: {
574
639
  workspace: e,
@@ -576,16 +641,16 @@ function ie({ workspace: e, docs: t, dateOf: r, toolbar: i }) {
576
641
  },
577
642
  className: "flex items-center gap-3 py-2 text-sm hover:bg-accent/40",
578
643
  children: [
579
- /* @__PURE__ */ W("span", {
644
+ /* @__PURE__ */ V("span", {
580
645
  className: "w-28 shrink-0 text-xs text-muted-foreground tabular-nums",
581
646
  children: i ? o.dateTime(n(i), { dateStyle: "medium" }) : a("undated")
582
647
  }),
583
- /* @__PURE__ */ W(p, { icon: t.icon }),
584
- /* @__PURE__ */ W("span", {
648
+ /* @__PURE__ */ V(p, { icon: t.icon }),
649
+ /* @__PURE__ */ V("span", {
585
650
  className: "min-w-0 flex-1 truncate font-medium",
586
651
  children: t.title
587
652
  }),
588
- /* @__PURE__ */ W("span", {
653
+ /* @__PURE__ */ V("span", {
589
654
  className: "shrink-0 text-xs text-muted-foreground",
590
655
  children: o.relativeTime(new Date(t.updatedAt))
591
656
  })
@@ -595,49 +660,49 @@ function ie({ workspace: e, docs: t, dateOf: r, toolbar: i }) {
595
660
  })]
596
661
  });
597
662
  }
598
- var ae = "flex min-w-0 items-center gap-2 font-medium hover:underline";
599
- function oe({ workspace: e, docs: t, props: n, toolbar: r }) {
600
- let i = H("subpages"), a = H("docViews"), o = V(), s = m(e);
601
- return /* @__PURE__ */ G("div", {
663
+ var me = "flex min-w-0 items-center gap-2 font-medium hover:underline";
664
+ function he({ workspace: e, docs: t, props: n, toolbar: r }) {
665
+ let i = z("subpages"), a = z("docViews"), o = R(), s = m(e);
666
+ return /* @__PURE__ */ H("div", {
602
667
  className: "flex flex-col",
603
- children: [/* @__PURE__ */ W("div", {
668
+ children: [/* @__PURE__ */ V("div", {
604
669
  className: "flex flex-wrap items-center gap-1 py-2",
605
670
  children: r
606
- }), t.length === 0 ? /* @__PURE__ */ W("p", {
671
+ }), t.length === 0 ? /* @__PURE__ */ V("p", {
607
672
  className: "py-3 text-sm text-muted-foreground",
608
673
  children: i("none")
609
- }) : /* @__PURE__ */ W("div", {
674
+ }) : /* @__PURE__ */ V("div", {
610
675
  className: "overflow-x-auto",
611
- children: /* @__PURE__ */ G("table", {
676
+ children: /* @__PURE__ */ H("table", {
612
677
  className: "doc-table w-full min-w-max text-sm",
613
- children: [/* @__PURE__ */ W("thead", { children: /* @__PURE__ */ G("tr", { children: [
614
- /* @__PURE__ */ W("th", {
678
+ children: [/* @__PURE__ */ V("thead", { children: /* @__PURE__ */ H("tr", { children: [
679
+ /* @__PURE__ */ V("th", {
615
680
  scope: "col",
616
681
  children: a("docTitle")
617
682
  }),
618
- n.map((e) => /* @__PURE__ */ W("th", {
683
+ n.map((e) => /* @__PURE__ */ V("th", {
619
684
  scope: "col",
620
685
  children: e.name
621
686
  }, e.id)),
622
- /* @__PURE__ */ W("th", {
687
+ /* @__PURE__ */ V("th", {
623
688
  scope: "col",
624
689
  children: a("updated")
625
690
  })
626
- ] }) }), /* @__PURE__ */ W("tbody", { children: t.map((t) => /* @__PURE__ */ G("tr", { children: [
627
- /* @__PURE__ */ W("td", { children: /* @__PURE__ */ G(I, {
691
+ ] }) }), /* @__PURE__ */ V("tbody", { children: t.map((t) => /* @__PURE__ */ H("tr", { children: [
692
+ /* @__PURE__ */ V("td", { children: /* @__PURE__ */ H(F, {
628
693
  to: "/$workspace/docs/$doc",
629
694
  params: {
630
695
  workspace: e,
631
696
  doc: c(t)
632
697
  },
633
- className: ae,
634
- children: [/* @__PURE__ */ W(p, { icon: t.icon }), /* @__PURE__ */ W("span", {
698
+ className: me,
699
+ children: [/* @__PURE__ */ V(p, { icon: t.icon }), /* @__PURE__ */ V("span", {
635
700
  className: "truncate",
636
701
  children: t.title
637
702
  })]
638
703
  }) }),
639
- n.map((e) => /* @__PURE__ */ W("td", { children: s(e, t.properties?.[e.id]) }, e.id)),
640
- /* @__PURE__ */ W("td", {
704
+ n.map((e) => /* @__PURE__ */ V("td", { children: s(e, t.properties?.[e.id]) }, e.id)),
705
+ /* @__PURE__ */ V("td", {
641
706
  className: "text-muted-foreground",
642
707
  children: o.dateTime(new Date(t.updatedAt), { dateStyle: "medium" })
643
708
  })
@@ -646,19 +711,19 @@ function oe({ workspace: e, docs: t, props: n, toolbar: r }) {
646
711
  })]
647
712
  });
648
713
  }
649
- function se({ workspace: e, docs: t, toolbar: n }) {
650
- let r = H("subpages"), i = V();
651
- return /* @__PURE__ */ G("div", {
714
+ function ge({ workspace: e, docs: t, toolbar: n }) {
715
+ let r = z("subpages"), i = R();
716
+ return /* @__PURE__ */ H("div", {
652
717
  className: "flex flex-col",
653
- children: [/* @__PURE__ */ W("div", {
718
+ children: [/* @__PURE__ */ V("div", {
654
719
  className: "flex flex-wrap items-center gap-1 py-2",
655
720
  children: n
656
- }), t.length === 0 ? /* @__PURE__ */ W("p", {
721
+ }), t.length === 0 ? /* @__PURE__ */ V("p", {
657
722
  className: "py-3 text-sm text-muted-foreground",
658
723
  children: r("none")
659
- }) : /* @__PURE__ */ W("ul", {
724
+ }) : /* @__PURE__ */ V("ul", {
660
725
  className: "divide-y divide-border",
661
- children: t.map((t) => /* @__PURE__ */ W("li", { children: /* @__PURE__ */ G(I, {
726
+ children: t.map((t) => /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H(F, {
662
727
  to: "/$workspace/docs/$doc",
663
728
  params: {
664
729
  workspace: e,
@@ -666,12 +731,12 @@ function se({ workspace: e, docs: t, toolbar: n }) {
666
731
  },
667
732
  className: "flex items-center gap-2 py-2 text-sm hover:bg-accent/40",
668
733
  children: [
669
- /* @__PURE__ */ W(p, { icon: t.icon }),
670
- /* @__PURE__ */ W("span", {
734
+ /* @__PURE__ */ V(p, { icon: t.icon }),
735
+ /* @__PURE__ */ V("span", {
671
736
  className: "min-w-0 flex-1 truncate font-medium",
672
737
  children: t.title
673
738
  }),
674
- /* @__PURE__ */ W("span", {
739
+ /* @__PURE__ */ V("span", {
675
740
  className: "shrink-0 text-xs text-muted-foreground",
676
741
  children: i.relativeTime(new Date(t.updatedAt))
677
742
  })
@@ -680,43 +745,43 @@ function se({ workspace: e, docs: t, toolbar: n }) {
680
745
  })]
681
746
  });
682
747
  }
683
- function ce({ workspace: e, docs: t, toolbar: n }) {
684
- let r = H("subpages");
685
- return /* @__PURE__ */ G("div", {
748
+ function _e({ workspace: e, docs: t, toolbar: n }) {
749
+ let r = z("subpages");
750
+ return /* @__PURE__ */ H("div", {
686
751
  className: "flex flex-col",
687
- children: [/* @__PURE__ */ W("div", {
752
+ children: [/* @__PURE__ */ V("div", {
688
753
  className: "flex flex-wrap items-center gap-1 py-2",
689
754
  children: n
690
- }), t.length === 0 ? /* @__PURE__ */ W("p", {
755
+ }), t.length === 0 ? /* @__PURE__ */ V("p", {
691
756
  className: "py-3 text-sm text-muted-foreground",
692
757
  children: r("none")
693
- }) : /* @__PURE__ */ W("ul", {
758
+ }) : /* @__PURE__ */ V("ul", {
694
759
  className: "grid grid-cols-[repeat(auto-fill,minmax(13rem,1fr))] gap-3",
695
760
  "aria-label": r("galleryView"),
696
761
  children: t.map((t) => {
697
762
  let n = v(t.cover ?? "");
698
- return /* @__PURE__ */ W("li", { children: /* @__PURE__ */ G(I, {
763
+ return /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H(F, {
699
764
  to: "/$workspace/docs/$doc",
700
765
  params: {
701
766
  workspace: e,
702
767
  doc: c(t)
703
768
  },
704
769
  className: "flex h-full flex-col overflow-hidden rounded-lg border border-border bg-card text-sm hover:border-primary",
705
- children: [/* @__PURE__ */ W("span", {
770
+ children: [/* @__PURE__ */ V("span", {
706
771
  className: "flex h-28 items-center justify-center bg-muted/50",
707
- children: n ? /* @__PURE__ */ W("img", {
772
+ children: n ? /* @__PURE__ */ V("img", {
708
773
  src: n,
709
774
  alt: "",
710
775
  className: "size-full object-cover",
711
776
  style: { objectPosition: `50% ${t.coverPosition ?? 50}%` }
712
- }) : /* @__PURE__ */ W(p, {
777
+ }) : /* @__PURE__ */ V(p, {
713
778
  icon: t.icon,
714
779
  className: "size-8",
715
780
  emojiClassName: "text-3xl"
716
781
  })
717
- }), /* @__PURE__ */ G("span", {
782
+ }), /* @__PURE__ */ H("span", {
718
783
  className: "flex items-center gap-2 px-3 py-2 font-medium",
719
- children: [n && /* @__PURE__ */ W(p, { icon: t.icon }), /* @__PURE__ */ W("span", {
784
+ children: [n && /* @__PURE__ */ V(p, { icon: t.icon }), /* @__PURE__ */ V("span", {
720
785
  className: "truncate",
721
786
  children: t.title
722
787
  })]
@@ -727,48 +792,48 @@ function ce({ workspace: e, docs: t, toolbar: n }) {
727
792
  });
728
793
  }
729
794
  var $ = 32;
730
- function le({ workspace: e, docs: t, dateOf: i, toolbar: a }) {
731
- let o = H("subpages"), s = V(), l = R(() => /* @__PURE__ */ new Date(), []), u = t.flatMap((e) => {
795
+ function ve({ workspace: e, docs: t, dateOf: i, toolbar: a }) {
796
+ let o = z("subpages"), s = R(), l = I(() => /* @__PURE__ */ new Date(), []), u = t.flatMap((e) => {
732
797
  let t = i(e), r = t ? n(t) : void 0;
733
798
  return r ? [{
734
799
  doc: e,
735
800
  date: r
736
801
  }] : [];
737
- }).sort((e, t) => e.date.getTime() - t.date.getTime()), d = u[0]?.date ?? l, f = X(new Date(Math.min(d.getTime(), l.getTime())), -3), m = u[u.length - 1]?.date ?? l, h = X(new Date(Math.max(m.getTime(), l.getTime())), 4), g = Math.max(28, Math.round((h.getTime() - f.getTime()) / 864e5) + 1), _ = Array.from({ length: g }, (e, t) => X(f, t)), v = (e) => Math.round((e.getTime() - f.getTime()) / 864e5), y = r(l);
738
- return /* @__PURE__ */ G("div", {
802
+ }).sort((e, t) => e.date.getTime() - t.date.getTime()), d = u[0]?.date ?? l, f = q(new Date(Math.min(d.getTime(), l.getTime())), -3), m = u[u.length - 1]?.date ?? l, h = q(new Date(Math.max(m.getTime(), l.getTime())), 4), g = Math.max(28, Math.round((h.getTime() - f.getTime()) / 864e5) + 1), _ = Array.from({ length: g }, (e, t) => q(f, t)), v = (e) => Math.round((e.getTime() - f.getTime()) / 864e5), y = r(l);
803
+ return /* @__PURE__ */ H("div", {
739
804
  className: "flex flex-col",
740
- children: [/* @__PURE__ */ W("div", {
805
+ children: [/* @__PURE__ */ V("div", {
741
806
  className: "flex flex-wrap items-center gap-1 py-2",
742
807
  children: a
743
- }), /* @__PURE__ */ W("div", {
808
+ }), /* @__PURE__ */ V("div", {
744
809
  className: "overflow-x-auto rounded-md border border-border",
745
- children: /* @__PURE__ */ G("div", {
810
+ children: /* @__PURE__ */ H("div", {
746
811
  style: { width: g * $ },
747
812
  className: "relative",
748
- children: [/* @__PURE__ */ W("div", {
813
+ children: [/* @__PURE__ */ V("div", {
749
814
  className: "flex border-b border-border text-xs text-muted-foreground",
750
- children: _.map((e) => /* @__PURE__ */ W("span", {
815
+ children: _.map((e) => /* @__PURE__ */ V("span", {
751
816
  style: { width: $ },
752
- className: F("shrink-0 py-1.5 text-center tabular-nums", (e.getDay() === 0 || e.getDay() === 6) && "bg-muted/40", r(e) === y && "font-semibold text-primary"),
817
+ className: N("shrink-0 py-1.5 text-center tabular-nums", (e.getDay() === 0 || e.getDay() === 6) && "bg-muted/40", r(e) === y && "font-semibold text-primary"),
753
818
  title: s.dateTime(e, { dateStyle: "full" }),
754
819
  children: e.getDate() === 1 || r(e) === r(f) ? s.dateTime(e, {
755
820
  month: "short",
756
821
  day: "numeric"
757
822
  }) : e.getDate()
758
823
  }, r(e)))
759
- }), u.length === 0 ? /* @__PURE__ */ W("p", {
824
+ }), u.length === 0 ? /* @__PURE__ */ V("p", {
760
825
  className: "sticky left-0 px-3 py-4 text-sm text-muted-foreground",
761
826
  children: o("none")
762
- }) : /* @__PURE__ */ G("ol", {
827
+ }) : /* @__PURE__ */ H("ol", {
763
828
  className: "relative py-1",
764
829
  "aria-label": o("timelineView"),
765
- children: [/* @__PURE__ */ W("span", {
830
+ children: [/* @__PURE__ */ V("span", {
766
831
  "aria-hidden": !0,
767
832
  className: "absolute inset-y-0 w-px bg-primary/50",
768
833
  style: { left: v(l) * $ + $ / 2 }
769
- }), u.map(({ doc: t, date: n }) => /* @__PURE__ */ W("li", {
834
+ }), u.map(({ doc: t, date: n }) => /* @__PURE__ */ V("li", {
770
835
  className: "relative h-9",
771
- children: /* @__PURE__ */ G(I, {
836
+ children: /* @__PURE__ */ H(F, {
772
837
  to: "/$workspace/docs/$doc",
773
838
  params: {
774
839
  workspace: e,
@@ -777,7 +842,7 @@ function le({ workspace: e, docs: t, dateOf: i, toolbar: a }) {
777
842
  "aria-label": `${t.title}, ${s.dateTime(n, { dateStyle: "medium" })}`,
778
843
  style: { left: v(n) * $ + 2 },
779
844
  className: "absolute top-1.5 flex h-6 max-w-72 items-center gap-1 rounded bg-card px-1.5 text-xs shadow-xs ring-1 ring-border hover:bg-accent",
780
- children: [/* @__PURE__ */ W(p, { icon: t.icon }), /* @__PURE__ */ W("span", {
845
+ children: [/* @__PURE__ */ V(p, { icon: t.icon }), /* @__PURE__ */ V("span", {
781
846
  className: "truncate",
782
847
  children: t.title
783
848
  })]
@@ -788,4 +853,4 @@ function le({ workspace: e, docs: t, dateOf: i, toolbar: a }) {
788
853
  })]
789
854
  });
790
855
  }
791
- export { Z as SubpageViews, q as subpageLayouts };
856
+ export { le as SubpageViews, W as subpageLayouts };