typerighter 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of typerighter might be problematic. Click here for more details.

@@ -1,370 +0,0 @@
1
- import { l as e } from "./shared-CpPZZ8IH.js";
2
- import { Fragment as t, computed as n, createApp as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, h as l, inject as u, markRaw as d, mergeProps as f, nextTick as p, openBlock as m, provide as h, reactive as g, readonly as _, ref as v, renderList as y, renderSlot as b, shallowRef as x, toDisplayString as S, unref as C, watch as ee, withKeys as w, withModifiers as T } from "vue";
3
- //#region ../../node_modules/.pnpm/@lucide+vue@1.30.0_vue@3.5.40_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/shared/src/utils/isEmptyString.mjs
4
- var E = (e) => e === "", te = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), D = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ne = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), re = (e) => {
5
- let t = ne(e);
6
- return t.charAt(0).toUpperCase() + t.slice(1);
7
- }, O = {
8
- xmlns: "http://www.w3.org/2000/svg",
9
- width: 24,
10
- height: 24,
11
- viewBox: "0 0 24 24",
12
- fill: "none",
13
- stroke: "currentColor",
14
- "stroke-width": 2,
15
- "stroke-linecap": "round",
16
- "stroke-linejoin": "round"
17
- }, ie = /* @__PURE__ */ Symbol("lucide-icons");
18
- function ae() {
19
- return u(ie, {});
20
- }
21
- //#endregion
22
- //#region ../../node_modules/.pnpm/@lucide+vue@1.30.0_vue@3.5.40_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/Icon.mjs
23
- var oe = ({ name: e, iconNode: t, "icon-node": r, absoluteStrokeWidth: i, "absolute-stroke-width": a, strokeWidth: o, "stroke-width": s, size: c, color: u, ...d }, { slots: f }) => {
24
- let { size: p, color: m, strokeWidth: h = 2, absoluteStrokeWidth: g = !1, class: _ = "" } = ae(), v = n(() => {
25
- let e = E(i) || E(a) || i === !0 || a === !0 || g === !0, t = o || s || h || O["stroke-width"];
26
- return e ? Number(t) * 24 / Number(c ?? p ?? O.width) : t;
27
- });
28
- return l("svg", {
29
- ...O,
30
- ...d,
31
- width: c ?? p ?? O.width,
32
- height: c ?? p ?? O.height,
33
- stroke: u ?? m ?? O.stroke,
34
- "stroke-width": v.value,
35
- class: te("lucide", _, ...e ? [`lucide-${D(re(e))}-icon`, `lucide-${D(e)}`] : ["lucide-icon"])
36
- }, [...(t ?? r ?? []).map((e) => l(...e)), ...f.default ? [f.default()] : []]);
37
- }, k = (e, t) => (n, { slots: r, attrs: i }) => l(oe, {
38
- ...i,
39
- ...n,
40
- iconNode: t,
41
- name: e
42
- }, r.default ? { default: r.default } : void 0), se = k("corner-left-up", [["path", {
43
- d: "M14 9 9 4 4 9",
44
- key: "1af5af"
45
- }], ["path", {
46
- d: "M20 20h-7a4 4 0 0 1-4-4V4",
47
- key: "1blwi3"
48
- }]]), A = k("file", [["path", {
49
- d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
50
- key: "1oefj6"
51
- }], ["path", {
52
- d: "M14 2v5a1 1 0 0 0 1 1h5",
53
- key: "wfsgrz"
54
- }]]), j = k("folder", [["path", {
55
- d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",
56
- key: "1kt360"
57
- }]]), ce = ["href"], le = { key: 1 }, ue = ["href"], de = { class: "td-dir-name" }, fe = { class: "td-dir-count" }, pe = { key: 2 }, me = ["href"], he = { class: "td-dir-name" }, ge = /*@__PURE__*/ c({
58
- __name: "TdDirectoryIndex",
59
- setup(r) {
60
- let c = R(), l = $(), u = n(() => {
61
- let t = e(c.path), n = l.directoryListings[t] ?? l.directoryListings[t + "/"];
62
- return {
63
- url: t,
64
- subdirectories: n?.subdirectories ?? [],
65
- items: n?.items ?? []
66
- };
67
- }), d = n(() => u.value.url === "/"), f = n(() => {
68
- let t = e(u.value.url);
69
- return t === "/" ? "/index" : t + "/index";
70
- });
71
- return (e, n) => (m(), a("div", null, [
72
- d.value ? i("", !0) : (m(), a("a", {
73
- key: 0,
74
- href: f.value,
75
- class: "td-dir-row"
76
- }, [s(C(se), {
77
- size: 16,
78
- class: "td-dir-icon"
79
- }), n[0] ||= o("span", { class: "td-dir-parent" }, "..", -1)], 8, ce)),
80
- u.value.subdirectories.length > 0 ? (m(), a("div", le, [(m(!0), a(t, null, y(u.value.subdirectories, (e) => (m(), a("a", {
81
- key: e.url,
82
- href: e.url,
83
- class: "td-dir-row"
84
- }, [
85
- s(C(j), {
86
- size: 16,
87
- class: "td-dir-icon"
88
- }),
89
- o("span", de, S(e.name), 1),
90
- o("span", fe, S(e.count), 1)
91
- ], 8, ue))), 128))])) : i("", !0),
92
- u.value.items.length > 0 ? (m(), a("div", pe, [(m(!0), a(t, null, y(u.value.items, (e) => (m(), a("a", {
93
- key: e.url,
94
- href: e.url,
95
- class: "td-dir-row"
96
- }, [s(C(A), {
97
- size: 16,
98
- class: "td-dir-icon"
99
- }), o("span", he, S(e.name), 1)], 8, me))), 128))])) : i("", !0)
100
- ]));
101
- }
102
- }), M = (e, t) => {
103
- let n = e.__vccOpts || e;
104
- for (let [e, r] of t) n[e] = r;
105
- return n;
106
- }, N = /*#__PURE__*/ M(ge, [["__scopeId", "data-v-0a816569"]]), _e = [
107
- "id",
108
- "tabindex",
109
- "aria-pressed",
110
- "aria-label",
111
- "onKeydown"
112
- ], ve = { class: "td-flashcard-face td-flashcard-face-question" }, ye = { class: "td-flashcard-label" }, be = { class: "td-flashcard-body" }, xe = { class: "td-flashcard-face td-flashcard-face-key" }, Se = { class: "td-flashcard-label" }, Ce = { class: "td-flashcard-body" }, we = /*#__PURE__*/ M(/* @__PURE__ */ c({
113
- inheritAttrs: !1,
114
- __name: "TdFlashcard",
115
- props: {
116
- id: { default: () => void 0 },
117
- revealed: {
118
- type: Boolean,
119
- default: !1
120
- },
121
- disabled: {
122
- type: Boolean,
123
- default: !1
124
- },
125
- questionLabel: { default: "Question" },
126
- keyLabel: { default: "Answer" }
127
- },
128
- setup(e, { expose: t }) {
129
- let n = v(e.revealed);
130
- ee(() => e.revealed, () => {
131
- n.value = e.revealed;
132
- });
133
- function r() {
134
- if (e.disabled) return n.value;
135
- let t = n.value;
136
- return n.value = !n.value, t;
137
- }
138
- function i() {
139
- let e = n.value;
140
- return n.value = !0, e;
141
- }
142
- function s() {
143
- let e = n.value;
144
- return n.value = !1, e;
145
- }
146
- return t({
147
- flip: r,
148
- showQuestion: s,
149
- showKey: i,
150
- state: _(n)
151
- }), (t, i) => (m(), a("div", f(t.$attrs, {
152
- id: e.id,
153
- class: ["td-flashcard", {
154
- "is-revealed": n.value,
155
- "is-disabled": e.disabled
156
- }],
157
- role: "button",
158
- tabindex: e.disabled ? -1 : 0,
159
- "aria-pressed": n.value,
160
- "aria-label": n.value ? e.keyLabel : e.questionLabel,
161
- onClick: r,
162
- onKeydown: [w(T(r, ["prevent"]), ["enter"]), w(T(r, ["prevent"]), ["space"])]
163
- }), [o("div", ve, [o("p", ye, S(e.questionLabel), 1), o("div", be, [b(t.$slots, "default")])]), o("div", xe, [o("p", Se, S(e.keyLabel), 1), o("div", Ce, [b(t.$slots, "key")])])], 16, _e));
164
- }
165
- }), [["__scopeId", "data-v-95dfbffd"]]), P = typeof window < "u", F = Symbol("typedown-router"), I = {
166
- frontmatter: {},
167
- headings: [],
168
- title: "Not Found"
169
- };
170
- function Te(e, t) {
171
- let n = g({
172
- path: "/",
173
- hash: "",
174
- query: "",
175
- contentSfc: void 0,
176
- data: I
177
- }), r = {
178
- route: n,
179
- async go(e, t) {
180
- e = B(e), await r.onBeforeRouteChange?.(e) !== !1 && ((!P || t?.initialLoad || Ee(e, t)) && await a(e), o(), await r.onAfterRouteChange?.(e));
181
- }
182
- }, i;
183
- async function a(r) {
184
- let a = new URL(r, "http://a.com"), s = i = a.pathname;
185
- try {
186
- let t = await e(s);
187
- if (!t) throw Error(`Page not found: ${s}`);
188
- if (i === s) {
189
- i = void 0;
190
- let { default: e, __pageData: r } = t;
191
- n.path = s, n.contentSfc = d(e), n.data = d(r), o(a), P && p(() => {
192
- L(a.hash);
193
- });
194
- }
195
- } catch {
196
- i === s && (i = void 0, n.path = s, n.contentSfc = t ? d(t) : void 0, n.data = I, o(a));
197
- }
198
- }
199
- function o(e = P ? location : {
200
- search: "",
201
- hash: ""
202
- }) {
203
- n.query = e.search, n.hash = decodeURIComponent(e.hash);
204
- }
205
- return P && (history.state ?? history.replaceState({}, ""), window.addEventListener("click", (e) => {
206
- if (e.defaultPrevented || !(e.target instanceof Element) || e.button !== 0 || e.ctrlKey || e.shiftKey || e.altKey || e.metaKey) return;
207
- let t = e.target.closest("a");
208
- if (!t || t.hasAttribute("download") || t.hasAttribute("target")) return;
209
- let n = t.getAttribute("href");
210
- if (n === null) return;
211
- let { href: i, origin: a, pathname: o } = new URL(n, t.baseURI);
212
- a === location.origin && !o.match(/\.\w+$/) && (e.preventDefault(), r.go(i));
213
- }, { capture: !0 }), window.addEventListener("popstate", async (e) => {
214
- if (e.state == null) return;
215
- let t = B(location.href);
216
- await a(t), o(), await r.onAfterRouteChange?.(t);
217
- }), window.addEventListener("hashchange", (e) => {
218
- e.preventDefault(), o();
219
- })), r;
220
- }
221
- function L(e) {
222
- if (!e) return;
223
- let t;
224
- try {
225
- t = document.getElementById(decodeURIComponent(e).slice(1)) ?? void 0;
226
- } catch {
227
- return;
228
- }
229
- t?.scrollIntoView({ block: "start" });
230
- }
231
- function R() {
232
- return z().route;
233
- }
234
- function z() {
235
- let e = u(F);
236
- if (!e) throw Error("useRouter() called outside of Typedown app");
237
- return e;
238
- }
239
- function Ee(e, { replace: t = !1 } = {}) {
240
- let n = B(location.href);
241
- if (e === n) return L(new URL(e, "http://a.com").hash), !1;
242
- t ? history.replaceState({}, "", e) : (history.replaceState({ scrollPosition: window.scrollY }, ""), history.pushState({}, "", e));
243
- let r = new URL(e, location.origin), i = new URL(n, location.origin);
244
- return r.pathname === i.pathname ? (L(r.hash), !1) : !0;
245
- }
246
- function B(e) {
247
- let t = new URL(e, "http://a.com");
248
- return t.pathname = t.pathname.replace(/\.html$/, ""), t.pathname === "/" && (t.pathname = "/index"), t.pathname + t.search + t.hash;
249
- }
250
- //#endregion
251
- //#region src/client/app/components/Content.ts
252
- var V = c({
253
- name: "TypedownContent",
254
- setup() {
255
- let e = R();
256
- return () => e.contentSfc ? l(e.contentSfc) : void 0;
257
- }
258
- }), H = "td-theme";
259
- function U(e) {
260
- if (typeof document > "u") return;
261
- let t = e === "system" ? W() : e;
262
- document.documentElement.classList.toggle("dark", t === "dark");
263
- }
264
- function W() {
265
- return typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
266
- }
267
- var G = v("system"), K = v(W()), q = !1;
268
- function J() {
269
- De();
270
- let e = n(() => G.value === "system" ? K.value : G.value), t = n(() => e.value === "dark");
271
- function r(e) {
272
- G.value = e, U(e), typeof localStorage < "u" && localStorage.setItem(H, e);
273
- }
274
- function i() {
275
- r(e.value === "light" ? "dark" : "light");
276
- }
277
- return {
278
- theme: _(G),
279
- effectiveTheme: e,
280
- isDark: t,
281
- setTheme: r,
282
- toggle: i
283
- };
284
- }
285
- function De() {
286
- if (!q) {
287
- if (q = !0, typeof localStorage < "u") {
288
- let e = localStorage.getItem(H);
289
- (e === "light" || e === "dark" || e === "system") && (G.value = e);
290
- }
291
- U(G.value), typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
292
- K.value = W(), G.value === "system" && U("system");
293
- });
294
- }
295
- }
296
- //#endregion
297
- //#region src/client/app/composables/useTdContent.ts
298
- var Y = Symbol("td-content");
299
- function Oe(e) {
300
- let t = J(), r = {
301
- page: n(() => e.data),
302
- frontmatter: n(() => e.data.frontmatter),
303
- title: n(() => e.data.title),
304
- isDark: n(() => t.isDark.value)
305
- };
306
- return h(Y, r), r;
307
- }
308
- function ke() {
309
- let e = u(Y);
310
- if (e === void 0) throw Error("useTdContent() called without a parent provideTdContent()");
311
- return e;
312
- }
313
- //#endregion
314
- //#region src/client/app/index.ts
315
- var X = Symbol("typedown-site-config"), Z = Symbol("typedown-site-data"), Q = Symbol("typedown-page-loader"), Ae = Symbol("typedown-search-index");
316
- async function je(e, t, n = {}, i = {}) {
317
- let a = {
318
- title: n.title ?? "",
319
- description: n.description ?? "",
320
- basePath: n.basePath ?? "/",
321
- repo: n.repo
322
- }, o = {
323
- contentTree: i.contentTree ?? {
324
- rootItems: [],
325
- children: []
326
- },
327
- schemas: i.schemas ?? {},
328
- directoryListings: i.directoryListings ?? {}
329
- }, s = Te(e), u = r(c({
330
- name: "TypedownApp",
331
- setup() {
332
- return Oe(s.route), () => l(t);
333
- }
334
- }));
335
- u.provide(F, s), u.provide(X, a), u.provide(Z, o), u.provide(Q, e);
336
- let d = x(i.searchIndex);
337
- return u.provide(Ae, d), u.component("TypedownContent", V), u.component("DirectoryIndex", N), u.component("Flashcard", we), typeof window < "u" && await s.go(location.href, {
338
- replace: !0,
339
- initialLoad: !0
340
- }), {
341
- app: u,
342
- router: s,
343
- searchIndex: d
344
- };
345
- }
346
- function Me() {
347
- return u(Q, void 0);
348
- }
349
- function Ne() {
350
- return u(Ae, x(void 0));
351
- }
352
- function Pe() {
353
- return u(X, {
354
- title: "",
355
- description: "",
356
- basePath: "/"
357
- });
358
- }
359
- function $() {
360
- return u(Z, {
361
- contentTree: {
362
- rootItems: [],
363
- children: []
364
- },
365
- schemas: {},
366
- directoryListings: {}
367
- });
368
- }
369
- //#endregion
370
- export { $ as a, V as c, N as d, M as f, k as h, Pe as i, R as l, A as m, Me as n, ke as o, j as p, Ne as r, J as s, je as t, z as u };
@@ -1,12 +0,0 @@
1
- //#region src/shared/utils/html.ts
2
- function e(e) {
3
- return e.replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
4
- }
5
- function t(e) {
6
- return e.replace(/<(style|script)[^>]*>[\s\S]*?<\/\1>/gi, "").replace(/<[^>]*>/g, "").replace(/\s+/g, " ").trim();
7
- }
8
- //#endregion
9
- //#region src/shared/brand.ts
10
- var n = "m15 10c-2.7614 0-5 2.2386-5 5v98c0 2.761 2.2386 5 5 5h178c2.761 0 5-2.239 5-5v-98c0-2.7614-2.239-5-5-5zm-15 5c0-8.28427 6.71573-15 15-15h178c8.284 0 15 6.71573 15 15v98c0 8.284-6.716 15-15 15h-178c-8.28427 0-15-6.716-15-15z", r = "M30 30h70v16h-27v52h-16v-52h-27z", i = "m155 98-30-33h20v-35h20v35h20z", a = "0 0 208 128", o = "#a0522d", s = `<svg fill='none' viewBox='${a}' xmlns='http://www.w3.org/2000/svg'><path clip-rule='evenodd' d='${n}' fill-rule='evenodd' fill='${o}'/><path d='${r}' fill='${o}'/><path d='${i}' fill='${o}'/></svg>`, c = `data:image/svg+xml,${encodeURIComponent(s)}`;
11
- //#endregion
12
- export { a, r as i, n, e as o, c as r, t as s, i as t };
@@ -1,6 +0,0 @@
1
- export declare function useUrl(): {
2
- url: (path: string) => string;
3
- homeUrl: () => string;
4
- indexUrl: (directoryPath: string) => string;
5
- };
6
- //# sourceMappingURL=useUrl.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useUrl.d.ts","sourceRoot":"","sources":["../../../../src/client/app/composables/useUrl.ts"],"names":[],"mappings":"AAKA,wBAAgB,MAAM;gBAIA,MAAM,KAAG,MAAM;mBAId,MAAM;8BAIO,MAAM,KAAG,MAAM;EASlD"}
@@ -1,196 +0,0 @@
1
- //#region src/shared/constants.ts
2
- var e = "index", t = [".td", ".md"], n = "**/*.{td,md}", r = [
3
- "title",
4
- "titles",
5
- "text"
6
- ], i = ["title", "titles"], a = /^[a-z]+:/i;
7
- //#endregion
8
- //#region src/shared/utils/format.ts
9
- function o(e) {
10
- let t = e.match(/^(\d+)[-_](.+)$/);
11
- return t ? {
12
- order: Number(t[1]),
13
- rest: t[2]
14
- } : {
15
- order: Infinity,
16
- rest: e
17
- };
18
- }
19
- function s(e) {
20
- let { rest: t } = o(e), n = t.replace(/[-_]/g, " ").split(" ");
21
- return 0 < n.length && (n[0] = n[0].charAt(0).toUpperCase() + n[0].slice(1)), n.join(" ");
22
- }
23
- //#endregion
24
- //#region src/shared/utils/path.ts
25
- function c(e, t) {
26
- let n = h(e).split("/").pop() ?? "";
27
- return t !== void 0 && n.endsWith(t) ? n.slice(0, -t.length) : n;
28
- }
29
- function l(e) {
30
- let t = h(e).split("/");
31
- return t.pop(), t.join("/");
32
- }
33
- function u(e) {
34
- let t = c(e), n = t.lastIndexOf(".");
35
- return n <= 0 ? "" : t.slice(n);
36
- }
37
- function d(e) {
38
- let t = c(e), n = t.lastIndexOf(".");
39
- return n <= 0 ? t : t.slice(0, n);
40
- }
41
- function f(e) {
42
- return t.includes(u(e));
43
- }
44
- function p(...e) {
45
- return e.filter(Boolean).join("/").replace(/\\+/g, "/").replace(/\/+/g, "/").replace(/\/$/, "") || "/";
46
- }
47
- function m(e) {
48
- let t = u(e);
49
- return t ? e.slice(0, -t.length) : e;
50
- }
51
- function h(e) {
52
- return e.replace(/\\/g, "/");
53
- }
54
- //#endregion
55
- //#region src/shared/utils/url.ts
56
- var g = new Set("3g2,3gp,aac,ai,apng,au,avif,bin,bmp,cer,class,conf,crl,css,csv,dll,doc,eps,epub,exe,gif,gz,ics,ief,jar,jpe,jpeg,jpg,js,json,jsonld,m4a,man,mid,midi,mjs,mov,mp2,mp3,mp4,mpe,mpeg,mpg,mpp,oga,ogg,ogv,ogx,opus,otf,p10,p7c,p7m,p7s,pdf,png,ps,qt,roff,rtf,rtx,ser,svg,t,tif,tiff,tr,ts,tsv,ttf,txt,vtt,wav,weba,webm,webp,woff,woff2,xhtml,xml,yaml,yml,zip".split(","));
57
- function _(e, t) {
58
- return `${e}/${t}`;
59
- }
60
- function v(e) {
61
- return l(e.replace(/\/$/, "")) || "/";
62
- }
63
- function y(e) {
64
- let t = d(e);
65
- return "/" + p(l(e), t);
66
- }
67
- function b(e, t) {
68
- return t.startsWith(e + "/") || t === e;
69
- }
70
- function x(e) {
71
- return a.test(e);
72
- }
73
- function S(e) {
74
- let t = u(e).slice(1);
75
- return t === "" || !g.has(t.toLowerCase());
76
- }
77
- function C(e) {
78
- let t = e.indexOf("#");
79
- return 0 <= t ? e.slice(0, t) : e;
80
- }
81
- //#endregion
82
- //#region src/shared/utils/content.ts
83
- function w(e) {
84
- let t = {
85
- name: "",
86
- children: [],
87
- items: []
88
- };
89
- for (let n of e) {
90
- let e = n.filepath.split("/").slice(0, -1), r = t;
91
- for (let t of e) {
92
- let e = r.children.find((e) => e.name === t);
93
- e || (e = {
94
- name: t,
95
- children: [],
96
- items: []
97
- }, r.children.push(e)), r = e;
98
- }
99
- r.items.push(n);
100
- }
101
- return O(t), {
102
- rootItems: t.items,
103
- children: t.children
104
- };
105
- }
106
- function T(t, n) {
107
- let r = {};
108
- function i(e) {
109
- let t = e.items.length;
110
- for (let n of e.children) t += i(n);
111
- return t;
112
- }
113
- function a(t, n) {
114
- let r = t.items.find((t) => d(t.filepath) === e);
115
- return r ? y(r.filepath) : `${n}/${t.name}/index`;
116
- }
117
- function o(e, t) {
118
- for (let n of e) {
119
- let e = t ? `${t}/${n.name}` : `/${n.name}`;
120
- r[e] = {
121
- title: s(n.name),
122
- url: e,
123
- subdirectories: n.children.map((t) => ({
124
- name: s(t.name),
125
- url: a(t, e),
126
- count: i(t)
127
- })),
128
- items: n.items.map((e) => ({
129
- name: D(e.header, e.filepath),
130
- url: y(e.filepath)
131
- }))
132
- }, o(n.children, e);
133
- }
134
- }
135
- return r["/"] = {
136
- title: n,
137
- url: "/",
138
- subdirectories: t.map((e) => ({
139
- name: s(e.name),
140
- url: a(e, ""),
141
- count: i(e)
142
- })),
143
- items: []
144
- }, o(t, ""), r;
145
- }
146
- function E(e, t) {
147
- let n = c(l(e));
148
- return n ? s(n) : t;
149
- }
150
- function D(e, t) {
151
- if (e._label !== void 0) return String(e._label);
152
- let n = d(t);
153
- if (n === "index") {
154
- let e = c(l(t));
155
- return e ? s(e) : n;
156
- }
157
- return s(n);
158
- }
159
- function O(e) {
160
- e.children.sort((e, t) => {
161
- let n = o(e.name), r = o(t.name);
162
- return n.order === r.order ? n.rest.localeCompare(r.rest) : n.order - r.order;
163
- }), e.items.sort((e, t) => {
164
- let n = o(d(e.filepath)), r = o(d(t.filepath));
165
- return n.order === r.order ? D(e.header, e.filepath).localeCompare(D(t.header, t.filepath)) : n.order - r.order;
166
- });
167
- for (let t of e.children) O(t);
168
- }
169
- //#endregion
170
- //#region src/shared/utils/time.ts
171
- var k = 60, A = 60 * k, j = 24 * A, M = 7 * j, N = 30 * j, P = 365 * j, F = 2 * M;
172
- function I(e) {
173
- return (/* @__PURE__ */ new Date(e * 1e3)).toLocaleDateString("en-US", {
174
- year: "numeric",
175
- month: "short",
176
- day: "numeric"
177
- });
178
- }
179
- function L(e, t) {
180
- return Math.floor(Date.now() / 1e3) - e < F ? `${t} ${R(e)}` : `${t} at ${I(e)}`;
181
- }
182
- function R(e) {
183
- let t = Math.floor(Date.now() / 1e3) - e;
184
- return t < k ? "just now" : t < A ? `${Math.floor(t / k)}m ago` : t < j ? `${Math.floor(t / A)}h ago` : t < M ? `${Math.floor(t / j)}d ago` : t < N ? `${Math.floor(t / M)}w ago` : t < P ? `${Math.floor(t / N)}mo ago` : `${Math.floor(t / P)}y ago`;
185
- }
186
- var z = new Intl.DateTimeFormat("en-US", {
187
- year: "numeric",
188
- month: "short",
189
- day: "numeric"
190
- });
191
- function B(e) {
192
- let t = new Date(e);
193
- return Number.isNaN(t.getTime()) ? e : z.format(t);
194
- }
195
- //#endregion
196
- export { r as C, e as S, m as _, T as a, t as b, _ as c, b as d, x as f, f as g, d as h, w as i, v as l, C as m, L as n, E as o, S as p, R as r, D as s, B as t, y as u, s as v, i as w, n as x, a as y };