@hiai-gg/docsmint 0.7.1 → 0.7.4

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.
Files changed (109) hide show
  1. package/README.md +25 -1
  2. package/dist/backend/index.js +1 -1
  3. package/dist/frontend/CategoryDialog-bQKMpVFD.js +631 -0
  4. package/dist/frontend/ConfirmDialog-DF7kgkyq.js +139 -0
  5. package/dist/frontend/CreateSnapshotDialog-CojnWChs.js +222 -0
  6. package/dist/frontend/{DatePicker-CAw0wZZK.js → DatePicker-7FAbIOGg.js} +3 -3
  7. package/dist/frontend/DeleteDialog-BIlqRb1u.js +179 -0
  8. package/dist/frontend/{FolderNode-DzTqitR8.js → FolderNode-Cf443LBa.js} +1 -1
  9. package/dist/frontend/{HiAiEditor-B7MK19_j.js → HiAiEditor-CMZ-eL8s.js} +960 -954
  10. package/dist/frontend/SettingsDialog-DatuxOVX.js +980 -0
  11. package/dist/frontend/{ShareDialog-CwFa8mlk.js → ShareDialog-Bwz2y3Le.js} +1 -1
  12. package/dist/frontend/Sidebar-C_t5RrOJ.js +2101 -0
  13. package/dist/frontend/TagCreateDialog-Ch21yuWV.js +266 -0
  14. package/dist/frontend/app-shell.d.ts +3 -1
  15. package/dist/frontend/app-shell.js +155 -152
  16. package/dist/frontend/components/category-dialog.js +1 -1
  17. package/dist/frontend/components/create-snapshot-dialog.js +1 -1
  18. package/dist/frontend/components/delete-dialog.js +1 -1
  19. package/dist/frontend/components/editor/compact-editor.js +1 -1
  20. package/dist/frontend/components/editor/document-editor.js +1 -1
  21. package/dist/frontend/components/editor/extensions.js +1 -1
  22. package/dist/frontend/components/editor/markdown-toggle.js +1 -1
  23. package/dist/frontend/components/editor/markdown.js +1 -1
  24. package/dist/frontend/components/folder-node.js +1 -1
  25. package/dist/frontend/components/save-as-dialog.js +231 -226
  26. package/dist/frontend/components/settings.js +1 -1
  27. package/dist/frontend/components/share-dialog.js +1 -1
  28. package/dist/frontend/components/sidebar.js +1 -1
  29. package/dist/frontend/components/tag-create-dialog.js +1 -1
  30. package/dist/frontend/components/version-history.js +2 -2
  31. package/dist/frontend/confirm-dialog-8T6vsWL7.js +265 -0
  32. package/dist/frontend/dashboard.js +600 -592
  33. package/dist/frontend/dialog-CiSwD-_v.js +253 -0
  34. package/dist/frontend/{dropdown-menu-BXIl2E26.js → dropdown-menu-Bi5Iipwf.js} +6 -6
  35. package/dist/frontend/editor-content-sanitizer-CC_A8aaI.js +112 -0
  36. package/dist/frontend/{editorExtensions-BmINh76i.js → editorExtensions--HusV819.js} +3356 -3423
  37. package/dist/frontend/frontend.css +1 -1
  38. package/dist/frontend/{input-eHFb2qiL.js → input-N9dNSOWF.js} +2 -2
  39. package/dist/frontend/{label-_I1iiaNU.js → label-CK72_fw8.js} +2 -2
  40. package/dist/frontend/{markdown-A5xji16P.js → markdown-H6QB53zu.js} +1 -1
  41. package/dist/frontend/search.js +2 -2
  42. package/dist/frontend/{select-value-CtMyrvDJ.js → select-value-BD1DToYs.js} +6 -6
  43. package/dist/frontend/shared-document.js +95 -92
  44. package/dist/frontend/{textarea-2eslfANY.js → textarea-pl_fDBre.js} +2 -2
  45. package/dist/frontend/theme.js +1 -1
  46. package/dist/frontend/theme.svelte-DG3RS7wv.js +101 -0
  47. package/dist/frontend/{utils-CDBqTgoV.js → utils-CMQRlxbx.js} +1 -1
  48. package/dist/frontend-ssr/app-shell.js +8 -4
  49. package/dist/frontend-ssr/assets/CategoryDialog-DsXe54EF.js +608 -0
  50. package/dist/frontend-ssr/assets/ConfirmDialog-DrH653ua.js +136 -0
  51. package/dist/frontend-ssr/assets/{CreateSnapshotDialog-NM0n1Whr.js → CreateSnapshotDialog-D3-PjXVr.js} +92 -87
  52. package/dist/frontend-ssr/assets/{DatePicker-Dcok9XVm.js → DatePicker-C9suIA1S.js} +3 -3
  53. package/dist/frontend-ssr/assets/DeleteDialog-DxtMrS1O.js +159 -0
  54. package/dist/frontend-ssr/assets/{FolderNode-B84NL8Rg.js → FolderNode-ChD10Elp.js} +1 -1
  55. package/dist/frontend-ssr/assets/{HiAiEditor-tU0jmp6L.js → HiAiEditor-2X3Uyg1B.js} +59 -53
  56. package/dist/frontend-ssr/assets/{SettingsDialog-Dkp79L1B.js → SettingsDialog-DDy0hN8x.js} +372 -360
  57. package/dist/frontend-ssr/assets/{ShareDialog-B1-30sRR.js → ShareDialog-BwW_wF4G.js} +1 -1
  58. package/dist/frontend-ssr/assets/{Sidebar-CGp45ngo.js → Sidebar-Dy-5gXOf.js} +169 -128
  59. package/dist/frontend-ssr/assets/{TagCreateDialog-CGGtYSso.js → TagCreateDialog-BPzgOaX8.js} +93 -88
  60. package/dist/frontend-ssr/assets/{confirm-dialog-B-oV5wYk.js → confirm-dialog-wYC07DPx.js} +108 -88
  61. package/dist/frontend-ssr/assets/{dialog-1SB5neow.js → dialog-ClcuF7nD.js} +47 -12
  62. package/dist/frontend-ssr/assets/{dropdown-menu-DqoOkdqB.js → dropdown-menu-BKMGVNLL.js} +6 -6
  63. package/dist/frontend-ssr/assets/editor-content-sanitizer-Gjm93iR-.js +145 -0
  64. package/dist/frontend-ssr/assets/{editorExtensions-BwGeSPuX.js → editorExtensions-qNlZVP98.js} +2 -88
  65. package/dist/frontend-ssr/assets/{input-Df-QP3Km.js → input-DcDR8L8M.js} +2 -2
  66. package/dist/frontend-ssr/assets/{label-CbUOUz6L.js → label-Cz0_svJx.js} +2 -2
  67. package/dist/frontend-ssr/assets/{markdown-CB8DZ-LT.js → markdown-MhPwNWrC.js} +1 -1
  68. package/dist/frontend-ssr/assets/{select-value-CXEDWrZg.js → select-value-CaDktvDW.js} +6 -6
  69. package/dist/frontend-ssr/assets/{textarea-CHh8NuSS.js → textarea-BGrjPOgU.js} +2 -2
  70. package/dist/frontend-ssr/assets/theme.svelte-CN3BUhJG.js +136 -0
  71. package/dist/frontend-ssr/assets/{utils-DtX0ta7y.js → utils-Cg_R05dR.js} +1 -1
  72. package/dist/frontend-ssr/components/category-dialog.js +1 -1
  73. package/dist/frontend-ssr/components/create-snapshot-dialog.js +1 -1
  74. package/dist/frontend-ssr/components/delete-dialog.js +1 -1
  75. package/dist/frontend-ssr/components/editor/compact-editor.js +1 -1
  76. package/dist/frontend-ssr/components/editor/document-editor.js +1 -1
  77. package/dist/frontend-ssr/components/editor/extensions.js +1 -1
  78. package/dist/frontend-ssr/components/editor/markdown-toggle.js +1 -1
  79. package/dist/frontend-ssr/components/editor/markdown.js +1 -1
  80. package/dist/frontend-ssr/components/folder-node.js +1 -1
  81. package/dist/frontend-ssr/components/save-as-dialog.js +176 -171
  82. package/dist/frontend-ssr/components/settings.js +1 -1
  83. package/dist/frontend-ssr/components/share-dialog.js +1 -1
  84. package/dist/frontend-ssr/components/sidebar.js +1 -1
  85. package/dist/frontend-ssr/components/tag-create-dialog.js +1 -1
  86. package/dist/frontend-ssr/components/version-history.js +2 -2
  87. package/dist/frontend-ssr/dashboard.js +101 -94
  88. package/dist/frontend-ssr/search.js +2 -2
  89. package/dist/frontend-ssr/shared-document.js +3 -0
  90. package/dist/frontend-ssr/theme.js +1 -1
  91. package/dist/mcp-cli.js +1 -1
  92. package/dist/mcp-server.js +1 -1
  93. package/package.json +1 -1
  94. package/packages/cli/src/index.ts +1 -1
  95. package/server.json +3 -3
  96. package/dist/frontend/CategoryDialog-t_WIvFAG.js +0 -626
  97. package/dist/frontend/ConfirmDialog-_LlrA--f.js +0 -134
  98. package/dist/frontend/CreateSnapshotDialog-DW3PwAt5.js +0 -217
  99. package/dist/frontend/DeleteDialog-L1A3FhMM.js +0 -174
  100. package/dist/frontend/SettingsDialog-CS5L4nnU.js +0 -969
  101. package/dist/frontend/Sidebar-CDaFFmaQ.js +0 -2060
  102. package/dist/frontend/TagCreateDialog-C7Avn2_h.js +0 -261
  103. package/dist/frontend/confirm-dialog-BW2h2NE8.js +0 -250
  104. package/dist/frontend/dialog-C2iKObEu.js +0 -213
  105. package/dist/frontend/theme.svelte-DKfCy12k.js +0 -49
  106. package/dist/frontend-ssr/assets/CategoryDialog-B3MrZUho.js +0 -603
  107. package/dist/frontend-ssr/assets/ConfirmDialog-D1BDXXll.js +0 -131
  108. package/dist/frontend-ssr/assets/DeleteDialog-oHT_p_vG.js +0 -154
  109. package/dist/frontend-ssr/assets/theme.svelte-Co0-ssaD.js +0 -67
package/README.md CHANGED
@@ -45,6 +45,30 @@ server.
45
45
  - **Own the full stack**: application data, vectors, graph, queue, and files run
46
46
  on infrastructure you control.
47
47
 
48
+ ## What's new in 0.7.4?
49
+
50
+ - **MCP Registry description fits the 100-character limit**, so official
51
+ catalog publication can complete after 0.7.3 reached npm.
52
+
53
+ ## What's new in 0.7.3?
54
+
55
+ - **One public-link share dialog in OSS.** Dashboard, sidebar (including Recent),
56
+ and the editor open the same public token share. Hosts can opt into restricted
57
+ admission from `DocsmintAppShellHost`.
58
+ - **Dialogs stay in their overlays** after hiai-ui 0.1, and nested routes load
59
+ CSS from `/_app` instead of `./_app`.
60
+ - **hiai-ui 0.1.3** for circular theme spread; Inter remains the product UI
61
+ typeface.
62
+
63
+ ## What's new in 0.7.2?
64
+
65
+ - **Share view matches the editor.** Twitter/Twemoji SVG emoji images no longer
66
+ expand across the public share column; they render as ordinary glyphs.
67
+ - **Inter in the workspace chrome.** The sidebar uses the same Inter UI typeface
68
+ as docsmint.com instead of the operating-system sans stack.
69
+ - **MCP catalog 0.7.2.** Registry, LobeHub, and runtime metadata ship the dark
70
+ catalog logo and the current product-aligned description.
71
+
48
72
  ## What's new in 0.7.0?
49
73
 
50
74
  - **Signed workspace assertions.** Trusted server-to-server hosts can restrict
@@ -113,7 +137,7 @@ docker pull vgalibov/docsmint:web-latest
113
137
  docker pull vgalibov/docsmint:caddy-latest
114
138
  ```
115
139
 
116
- Use versioned tags such as `api-v0.7.1` for reproducible deploys. The
140
+ Use versioned tags such as `api-v0.7.4` for reproducible deploys. The
117
141
  quickstart still builds the Compose stack from this repository so PostgreSQL,
118
142
  Redis, and SeaweedFS start together with the application.
119
143
 
@@ -237154,7 +237154,7 @@ var swaggerConfig = {
237154
237154
  },
237155
237155
  info: {
237156
237156
  title: "DocsMint API",
237157
- version: "0.7.1",
237157
+ version: "0.7.4",
237158
237158
  description: "Self-hosted AI-native knowledge workspace and installable PWA with hybrid search, GraphRAG, REST, SDK, CLI, and MCP access for people and AI agents.",
237159
237159
  contact: { name: "HiAi-gg", url: "https://github.com/HiAi-gg/docsmint" },
237160
237160
  license: {
@@ -0,0 +1,631 @@
1
+ import { t as e } from "./copy-CvCh4ZVt.js";
2
+ import { t } from "./circle-check-BrqfiQH1.js";
3
+ import { n } from "./dist-DQa_OHOa.js";
4
+ import { C as r, S as i, _ as a, b as o, er as s, g as c, h as l, ir as u, m as d, nr as f, rr as p, v as m, x as h, y as g } from "./messages-DTRe4U2V.js";
5
+ import { a as ee } from "./route-context-DYQlUfzL.js";
6
+ import { a as te, i as _, n as ne, o as re, r as ie, s as v, t as ae } from "./dialog-CiSwD-_v.js";
7
+ import { t as oe } from "./input-N9dNSOWF.js";
8
+ import { t as y } from "./label-CK72_fw8.js";
9
+ import { a as se, n as ce, o as le, r as b, s as ue, t as de } from "./api-keys-DIwAdYkg.js";
10
+ import { a as fe, i as pe, n as me, r as he, t as ge } from "./select-value-BD1DToYs.js";
11
+ import "svelte/internal/disclose-version";
12
+ import * as x from "svelte/internal/client";
13
+ //#region src/lib/components/sidebar/category-api-key-flow.ts
14
+ async function _e(e) {
15
+ if (!e.draft.name.trim()) throw Error("Name is required");
16
+ if (e.draft.apiMode !== "category") throw Error("Select Category API access");
17
+ if (!e.draft.apiPermissionRead && !e.draft.apiPermissionEdit && !e.draft.apiPermissionWrite) throw Error("Select at least one permission");
18
+ let t = await e.save(e.draft);
19
+ if (!t || t.id !== e.categoryId) throw Error("Failed to save Category API access");
20
+ return e.issue(e.categoryId);
21
+ }
22
+ //#endregion
23
+ //#region src/lib/components/sidebar/category-dialog-feedback.ts
24
+ function S(e, t) {
25
+ return typeof e == "object" && e && "status" in e && e.status === 409 ? "A category with this name already exists." : e instanceof Error && e.message.trim().length > 0 ? e.message : t;
26
+ }
27
+ //#endregion
28
+ //#region src/lib/components/sidebar/CategoryDialog.svelte
29
+ var ve = x.from_html("<span class=\"font-medium text-foreground\"> </span> ", 1), ye = x.from_html("Delete <span class=\"font-medium text-foreground\"> </span> ", 1), C = x.from_html("<!> <!>", 1), be = x.from_html("<div class=\"flex items-start gap-3 rounded-lg border border-primary/30 bg-primary/10 p-4\" role=\"status\" aria-live=\"polite\"><!> <div><p class=\"text-sm font-medium text-foreground\"> </p> <p class=\"text-sm text-muted-foreground\"><span class=\"font-medium text-foreground\"> </span> </p></div></div>"), xe = x.from_html("<!> Copy API key", 1), Se = x.from_html("<div class=\"rounded-md border border-primary/20 bg-background/80 p-3\"><p class=\"text-xs font-medium text-foreground\">Copy the API key now. It remains available in Settings → API.</p> <code class=\"mt-2 block break-all rounded bg-muted p-2 text-xs text-foreground\"> </code> <!></div>"), w = x.from_html("<p class=\"text-xs text-destructive\" role=\"alert\"> </p>"), Ce = x.from_html("<div class=\"space-y-3 rounded-lg border border-primary/30 bg-primary/10 p-4\" role=\"status\" aria-live=\"polite\"><div class=\"flex items-start gap-3\"><!> <div><p class=\"text-sm font-medium text-foreground\">Category created</p> <p class=\"text-sm text-muted-foreground\"> </p></div></div> <!> <!></div>"), we = x.from_html("<p id=\"category-dialog-name-error\" class=\"text-xs text-destructive\" role=\"alert\"> </p>"), T = x.from_html("<!> <!> <!>", 1), Te = x.from_html("<div class=\"space-y-3 rounded-md border border-border/70 bg-muted/30 p-3\"><div class=\"flex flex-wrap items-center justify-between gap-2\"><!> <div class=\"flex flex-wrap gap-2\"><!> <!></div></div> <div class=\"grid gap-2 sm:grid-cols-3\"><label class=\"flex items-center gap-2 rounded-md border border-border/60 bg-background px-3 py-2 text-sm\"><input type=\"checkbox\" class=\"size-4 rounded border-input\"/> <span>Read</span></label> <label class=\"flex items-center gap-2 rounded-md border border-border/60 bg-background px-3 py-2 text-sm\"><input type=\"checkbox\" class=\"size-4 rounded border-input\"/> <span>Edit</span></label> <label class=\"flex items-center gap-2 rounded-md border border-border/60 bg-background px-3 py-2 text-sm\"><input type=\"checkbox\" class=\"size-4 rounded border-input\"/> <span>Write</span></label></div></div>"), Ee = x.from_html("<div class=\"rounded-lg border border-primary/30 bg-primary/10 p-3 text-primary\"><p class=\"text-xs font-medium\">Copy now — this raw key is shown once.</p> <code class=\"mt-1 block break-all rounded bg-background/80 p-2 text-xs text-foreground\"> </code> <!></div>"), De = x.from_html("<div class=\"flex items-center justify-between gap-3 rounded-md bg-muted/40 px-3 py-2 text-xs\"><span> </span> <div class=\"flex shrink-0 gap-2\"><!> <!></div></div>"), Oe = x.from_html("<div class=\"space-y-3 rounded-md border border-border/70 p-3\"><div class=\"flex items-center justify-between gap-2 max-sm:flex-col max-sm:items-stretch\"><div><!> <p class=\"text-xs text-muted-foreground\">The current permissions are saved before the key is issued.</p></div> <!></div> <!> <div class=\"max-h-48 space-y-2 overflow-y-auto pr-1\"></div></div>"), ke = x.from_html("<form data-category-dialog-scroll=\"\" class=\"max-h-[calc(100dvh-12rem)] space-y-4 overflow-y-auto overscroll-contain px-1\"><div class=\"space-y-2\"><!> <!> <!></div> <div class=\"space-y-2\"><!> <!></div> <!> <!></form>"), Ae = x.from_html("<!> ", 1);
30
+ function E(E, D) {
31
+ x.push(D, !0);
32
+ let O = {
33
+ Root: fe,
34
+ Content: pe,
35
+ Item: he,
36
+ Trigger: me,
37
+ Value: ge
38
+ }, k = ee(), A = x.prop(D, "open", 15, !1), j = x.state(""), M = x.state(null), N = x.state(!1), P = x.state("unavailable"), F = x.state(!1), I = x.state(!1), L = x.state(!1), R = x.state(x.proxy([])), z = x.state(x.proxy({})), B = x.state(null), V = x.state(!1), H = x.state(null), U = x.state(null), W = x.state(null), G = x.derived(() => x.get(B) ? x.get(z)[x.get(B)] : void 0);
39
+ async function K(e) {
40
+ let t = await se(k.fetch);
41
+ x.set(R, t.keys.filter((t) => ce(t.scopes) === e), !0);
42
+ }
43
+ async function je() {
44
+ if (!(!D.category?.id || !D.onSave)) {
45
+ x.set(V, !0), x.set(M, null);
46
+ try {
47
+ let e = await _e({
48
+ categoryId: D.category.id,
49
+ draft: {
50
+ name: x.get(q),
51
+ apiMode: X(x.get(P)),
52
+ apiPermissionRead: x.get(F),
53
+ apiPermissionEdit: x.get(I),
54
+ apiPermissionWrite: x.get(L)
55
+ },
56
+ save: async (e) => D.onSave(e),
57
+ issue: async (e) => b(e, void 0, k.fetch)
58
+ });
59
+ x.set(z, {
60
+ ...x.get(z),
61
+ [e.id]: e.key
62
+ }, !0), x.set(B, e.id, !0), await K(D.category.id);
63
+ } catch (e) {
64
+ x.set(M, e instanceof Error ? e.message : "Failed to create category API key", !0);
65
+ } finally {
66
+ x.set(V, !1);
67
+ }
68
+ }
69
+ }
70
+ async function Me(e) {
71
+ if (D.category?.id) {
72
+ x.set(V, !0);
73
+ try {
74
+ await ue(e, k.fetch);
75
+ let { [e]: t, ...n } = x.get(z);
76
+ x.set(z, n, !0), x.get(B) === e && x.set(B, null), await K(D.category.id);
77
+ } finally {
78
+ x.set(V, !1);
79
+ }
80
+ }
81
+ }
82
+ async function Ne(e) {
83
+ let t = x.get(z)[e.id] ?? await le(e.id, k.fetch);
84
+ await navigator.clipboard.writeText(de(e, t));
85
+ }
86
+ x.user_effect(() => {
87
+ if (!A()) return;
88
+ x.set(j, D.category?.name ?? "", !0);
89
+ let e = D.category?.apiMode === "category" ? "category" : D.category?.apiMode === "global" ? "global" : "unavailable";
90
+ x.set(P, e, !0), x.set(F, !!D.category?.apiPermissionRead, !0), x.set(I, !!D.category?.apiPermissionEdit, !0), x.set(L, !!D.category?.apiPermissionWrite, !0), e === "unavailable" && (x.set(F, !1), x.set(I, !1), x.set(L, !1)), x.set(z, {}, !0), x.set(B, null), x.set(R, [], !0), x.set(H, null), x.set(U, null), x.set(W, null), D.mode === "edit" && D.category?.id && K(D.category.id), x.set(M, null);
91
+ });
92
+ let q = x.derived(() => x.get(j).trim()), J = x.derived(() => D.mode === "delete"), Y = x.derived(() => x.get(F) || x.get(I) || x.get(L)), Pe = x.derived(() => x.get(W) ? l() : x.get(J) ? a() : D.mode === "edit" ? i() : r()), Fe = x.derived(() => x.get(J) ? f() : D.mode === "edit" ? u() : s());
93
+ function X(e) {
94
+ return e === "category" ? "category" : e === "global" ? "global" : "unavailable";
95
+ }
96
+ function Z(e) {
97
+ if (e === "read") {
98
+ x.set(F, !0), x.set(I, !1), x.set(L, !1);
99
+ return;
100
+ }
101
+ if (e === "write") {
102
+ x.set(F, !1), x.set(I, !1), x.set(L, !0);
103
+ return;
104
+ }
105
+ if (e === "read-write") {
106
+ x.set(F, !0), x.set(I, !1), x.set(L, !0);
107
+ return;
108
+ }
109
+ x.set(F, !0), x.set(I, !0), x.set(L, !0);
110
+ }
111
+ async function Q(e) {
112
+ if (e?.preventDefault(), !x.get(N)) {
113
+ if (x.get(J)) {
114
+ if (!D.onDelete) {
115
+ $();
116
+ return;
117
+ }
118
+ x.set(N, !0);
119
+ try {
120
+ await D.onDelete(), x.set(W, D.category?.name ?? "Category", !0);
121
+ } catch (e) {
122
+ console.error("CategoryDialog: delete failed", e), x.set(M, e instanceof Error ? e.message : m(), !0);
123
+ } finally {
124
+ x.set(N, !1);
125
+ }
126
+ return;
127
+ }
128
+ if (x.get(q).length === 0) {
129
+ x.set(M, "Name is required");
130
+ return;
131
+ }
132
+ if (x.get(P) !== "unavailable" && !x.get(Y)) {
133
+ x.set(M, "Select at least one permission");
134
+ return;
135
+ }
136
+ if (!D.onSave) {
137
+ $();
138
+ return;
139
+ }
140
+ x.set(M, null), x.set(N, !0);
141
+ try {
142
+ let e = await D.onSave({
143
+ name: x.get(q),
144
+ apiMode: X(x.get(P)),
145
+ apiPermissionRead: x.get(P) === "unavailable" ? !1 : x.get(F),
146
+ apiPermissionEdit: x.get(P) === "unavailable" ? !1 : x.get(I),
147
+ apiPermissionWrite: x.get(P) === "unavailable" ? !1 : x.get(L)
148
+ });
149
+ if (D.mode === "create" && e) {
150
+ if (x.set(H, e.name, !0), x.get(P) === "category") try {
151
+ let t = await b(e.id, void 0, k.fetch);
152
+ x.set(U, t.key, !0);
153
+ } catch (e) {
154
+ x.set(M, `Category created, but its API key could not be created: ${S(e, "Unknown error")}`);
155
+ }
156
+ return;
157
+ }
158
+ $();
159
+ } catch (e) {
160
+ console.error("CategoryDialog: save failed", e), x.set(M, S(e, D.mode === "edit" ? g() : o()), !0);
161
+ } finally {
162
+ x.set(N, !1);
163
+ }
164
+ }
165
+ }
166
+ function $() {
167
+ x.get(N) || (A(!1), D.onClose?.());
168
+ }
169
+ function Ie(e) {
170
+ if (!e && x.get(N)) {
171
+ A(!0);
172
+ return;
173
+ }
174
+ e || $();
175
+ }
176
+ re(E, {
177
+ onOpenChange: Ie,
178
+ get open() {
179
+ return A();
180
+ },
181
+ set open(e) {
182
+ A(e);
183
+ },
184
+ children: (r, i) => {
185
+ te(r, {
186
+ children: (r, i) => {
187
+ var a = T(), o = x.first_child(a);
188
+ ne(o, {
189
+ children: (e, t) => {
190
+ var n = C(), r = x.first_child(n);
191
+ ae(r, {
192
+ children: (e, t) => {
193
+ x.next();
194
+ var n = x.text();
195
+ x.template_effect(() => x.set_text(n, x.get(Pe))), x.append(e, n);
196
+ },
197
+ $$slots: { default: !0 }
198
+ });
199
+ var i = x.sibling(r, 2), a = (e) => {
200
+ _(e, {
201
+ children: (e, t) => {
202
+ var n = ve(), r = x.first_child(n), i = x.child(r);
203
+ x.reset(r);
204
+ var a = x.sibling(r);
205
+ x.template_effect((e) => {
206
+ x.set_text(i, `“${x.get(W) ?? ""}”`), x.set_text(a, ` ${e ?? ""}`);
207
+ }, [() => d()]), x.append(e, n);
208
+ },
209
+ $$slots: { default: !0 }
210
+ });
211
+ }, o = (e) => {
212
+ _(e, {
213
+ children: (e, t) => {
214
+ x.next();
215
+ var n = ye(), r = x.sibling(x.first_child(n)), i = x.child(r);
216
+ x.reset(r);
217
+ var a = x.sibling(r);
218
+ x.template_effect((e) => {
219
+ x.set_text(i, `“${D.category?.name ?? "Category" ?? ""}”`), x.set_text(a, `?
220
+ ${e ?? ""}`);
221
+ }, [() => c()]), x.append(e, n);
222
+ },
223
+ $$slots: { default: !0 }
224
+ });
225
+ }, s = (e) => {
226
+ _(e, {
227
+ children: (e, t) => {
228
+ x.next();
229
+ var n = x.text();
230
+ x.template_effect((e) => x.set_text(n, e), [() => h()]), x.append(e, n);
231
+ },
232
+ $$slots: { default: !0 }
233
+ });
234
+ };
235
+ x.if(i, (e) => {
236
+ x.get(W) ? e(a) : x.get(J) ? e(o, 1) : e(s, -1);
237
+ }), x.append(e, n);
238
+ },
239
+ $$slots: { default: !0 }
240
+ });
241
+ var s = x.sibling(o, 2), u = (e) => {
242
+ var n = be(), r = x.child(n);
243
+ t(r, { class: "mt-0.5 size-5 shrink-0 text-primary" });
244
+ var i = x.sibling(r, 2), a = x.child(i), o = x.child(a, !0);
245
+ x.reset(a);
246
+ var s = x.sibling(a, 2), c = x.child(s), u = x.child(c);
247
+ x.reset(c);
248
+ var f = x.sibling(c);
249
+ x.reset(s), x.reset(i), x.reset(n), x.template_effect((e, t) => {
250
+ x.set_text(o, e), x.set_text(u, `“${x.get(W) ?? ""}”`), x.set_text(f, ` ${t ?? ""}`);
251
+ }, [() => l(), () => d()]), x.append(e, n);
252
+ }, f = (n) => {
253
+ var r = Ce(), i = x.child(r), a = x.child(i);
254
+ t(a, { class: "mt-0.5 size-5 shrink-0 text-primary" });
255
+ var o = x.sibling(a, 2), s = x.sibling(x.child(o), 2), c = x.child(s);
256
+ x.reset(s), x.reset(o), x.reset(i);
257
+ var l = x.sibling(i, 2), u = (t) => {
258
+ var n = Se(), r = x.sibling(x.child(n), 2), i = x.child(r, !0);
259
+ x.reset(r), v(x.sibling(r, 2), {
260
+ type: "button",
261
+ size: "sm",
262
+ variant: "outline",
263
+ class: "mt-2",
264
+ onclick: () => navigator.clipboard.writeText(x.get(U) ?? ""),
265
+ children: (t, n) => {
266
+ var r = xe();
267
+ e(x.first_child(r), { class: "mr-1 size-3.5" }), x.next(), x.append(t, r);
268
+ },
269
+ $$slots: { default: !0 }
270
+ }), x.reset(n), x.template_effect(() => x.set_text(i, x.get(U))), x.append(t, n);
271
+ };
272
+ x.if(l, (e) => {
273
+ x.get(U) && e(u);
274
+ });
275
+ var d = x.sibling(l, 2), f = (e) => {
276
+ var t = w(), n = x.child(t, !0);
277
+ x.reset(t), x.template_effect(() => x.set_text(n, x.get(M))), x.append(e, t);
278
+ };
279
+ x.if(d, (e) => {
280
+ x.get(M) && e(f);
281
+ }), x.reset(r), x.template_effect(() => x.set_text(c, `${x.get(H) ?? ""} is ready to use.`)), x.append(n, r);
282
+ }, m = (e) => {
283
+ var t = ke(), n = x.child(t), r = x.child(n);
284
+ y(r, {
285
+ for: "category-dialog-name",
286
+ children: (e, t) => {
287
+ x.next();
288
+ var n = x.text();
289
+ x.template_effect((e) => x.set_text(n, e), [() => h()]), x.append(e, n);
290
+ },
291
+ $$slots: { default: !0 }
292
+ });
293
+ var i = x.sibling(r, 2);
294
+ {
295
+ let e = x.derived(() => h()), t = x.derived(() => x.get(M) ? "true" : void 0), n = x.derived(() => x.get(M) ? "category-dialog-name-error" : void 0);
296
+ oe(i, {
297
+ id: "category-dialog-name",
298
+ name: "name",
299
+ type: "text",
300
+ get placeholder() {
301
+ return x.get(e);
302
+ },
303
+ maxlength: 255,
304
+ required: !0,
305
+ get disabled() {
306
+ return x.get(N);
307
+ },
308
+ get "aria-invalid"() {
309
+ return x.get(t);
310
+ },
311
+ get "aria-describedby"() {
312
+ return x.get(n);
313
+ },
314
+ autocomplete: "off",
315
+ get value() {
316
+ return x.get(j);
317
+ },
318
+ set value(e) {
319
+ x.set(j, e, !0);
320
+ }
321
+ });
322
+ }
323
+ var a = x.sibling(i, 2), o = (e) => {
324
+ var t = we(), n = x.child(t, !0);
325
+ x.reset(t), x.template_effect(() => x.set_text(n, x.get(M))), x.append(e, t);
326
+ };
327
+ x.if(a, (e) => {
328
+ x.get(M) && e(o);
329
+ }), x.reset(n);
330
+ var s = x.sibling(n, 2), c = x.child(s);
331
+ y(c, {
332
+ for: "category-dialog-api-mode",
333
+ children: (e, t) => {
334
+ x.next();
335
+ var n = x.text("API access");
336
+ x.append(e, n);
337
+ },
338
+ $$slots: { default: !0 }
339
+ });
340
+ var l = x.sibling(c, 2);
341
+ x.component(l, () => O.Root, (e, t) => {
342
+ t(e, {
343
+ type: "single",
344
+ get value() {
345
+ return x.get(P);
346
+ },
347
+ get disabled() {
348
+ return x.get(N);
349
+ },
350
+ onValueChange: (e) => {
351
+ (e === "unavailable" || e === "global" || e === "category") && x.set(P, e, !0);
352
+ },
353
+ children: (e, t) => {
354
+ var n = C(), r = x.first_child(n);
355
+ x.component(r, () => O.Trigger, (e, t) => {
356
+ t(e, {
357
+ id: "category-dialog-api-mode",
358
+ class: "h-10 w-full",
359
+ children: (e, t) => {
360
+ var n = x.comment(), r = x.first_child(n);
361
+ x.component(r, () => O.Value, (e, t) => {
362
+ t(e, {
363
+ placeholder: "Select API access",
364
+ children: (e, t) => {
365
+ x.next();
366
+ var n = x.text();
367
+ x.template_effect(() => x.set_text(n, x.get(P) === "unavailable" ? "Unavailable" : x.get(P) === "global" ? "Global" : "Category API")), x.append(e, n);
368
+ },
369
+ $$slots: { default: !0 }
370
+ });
371
+ }), x.append(e, n);
372
+ },
373
+ $$slots: { default: !0 }
374
+ });
375
+ });
376
+ var i = x.sibling(r, 2);
377
+ x.component(i, () => O.Content, (e, t) => {
378
+ t(e, {
379
+ children: (e, t) => {
380
+ var n = T(), r = x.first_child(n);
381
+ x.component(r, () => O.Item, (e, t) => {
382
+ t(e, {
383
+ value: "unavailable",
384
+ children: (e, t) => {
385
+ x.next();
386
+ var n = x.text("Unavailable");
387
+ x.append(e, n);
388
+ },
389
+ $$slots: { default: !0 }
390
+ });
391
+ });
392
+ var i = x.sibling(r, 2);
393
+ x.component(i, () => O.Item, (e, t) => {
394
+ t(e, {
395
+ value: "global",
396
+ children: (e, t) => {
397
+ x.next();
398
+ var n = x.text("Global");
399
+ x.append(e, n);
400
+ },
401
+ $$slots: { default: !0 }
402
+ });
403
+ });
404
+ var a = x.sibling(i, 2);
405
+ x.component(a, () => O.Item, (e, t) => {
406
+ t(e, {
407
+ value: "category",
408
+ children: (e, t) => {
409
+ x.next();
410
+ var n = x.text("Category API");
411
+ x.append(e, n);
412
+ },
413
+ $$slots: { default: !0 }
414
+ });
415
+ }), x.append(e, n);
416
+ },
417
+ $$slots: { default: !0 }
418
+ });
419
+ }), x.append(e, n);
420
+ },
421
+ $$slots: { default: !0 }
422
+ });
423
+ }), x.reset(s);
424
+ var u = x.sibling(s, 2), d = (e) => {
425
+ var t = Te(), n = x.child(t), r = x.child(n);
426
+ y(r, {
427
+ class: "text-sm",
428
+ children: (e, t) => {
429
+ x.next();
430
+ var n = x.text("Permissions");
431
+ x.append(e, n);
432
+ },
433
+ $$slots: { default: !0 }
434
+ });
435
+ var i = x.sibling(r, 2), a = x.child(i);
436
+ v(a, {
437
+ type: "button",
438
+ variant: "outline",
439
+ size: "sm",
440
+ onclick: () => Z("read-write"),
441
+ children: (e, t) => {
442
+ x.next();
443
+ var n = x.text("Read / Write");
444
+ x.append(e, n);
445
+ },
446
+ $$slots: { default: !0 }
447
+ }), v(x.sibling(a, 2), {
448
+ type: "button",
449
+ variant: "outline",
450
+ size: "sm",
451
+ onclick: () => Z("read-edit-write"),
452
+ children: (e, t) => {
453
+ x.next();
454
+ var n = x.text("Read / Edit / Write");
455
+ x.append(e, n);
456
+ },
457
+ $$slots: { default: !0 }
458
+ }), x.reset(i), x.reset(n);
459
+ var o = x.sibling(n, 2), s = x.child(o), c = x.child(s);
460
+ x.remove_input_defaults(c), x.next(2), x.reset(s);
461
+ var l = x.sibling(s, 2), u = x.child(l);
462
+ x.remove_input_defaults(u), x.next(2), x.reset(l);
463
+ var d = x.sibling(l, 2), f = x.child(d);
464
+ x.remove_input_defaults(f), x.next(2), x.reset(d), x.reset(o), x.reset(t), x.template_effect(() => {
465
+ c.disabled = x.get(N), u.disabled = x.get(N), f.disabled = x.get(N);
466
+ }), x.bind_checked(c, () => x.get(F), (e) => x.set(F, e)), x.bind_checked(u, () => x.get(I), (e) => x.set(I, e)), x.bind_checked(f, () => x.get(L), (e) => x.set(L, e)), x.append(e, t);
467
+ };
468
+ x.if(u, (e) => {
469
+ x.get(P) !== "unavailable" && e(d);
470
+ });
471
+ var f = x.sibling(u, 2), p = (e) => {
472
+ var t = Oe(), n = x.child(t), r = x.child(n);
473
+ y(x.child(r), {
474
+ children: (e, t) => {
475
+ x.next();
476
+ var n = x.text("Category API keys");
477
+ x.append(e, n);
478
+ },
479
+ $$slots: { default: !0 }
480
+ }), x.next(2), x.reset(r);
481
+ var i = x.sibling(r, 2);
482
+ {
483
+ let e = x.derived(() => x.get(N) || x.get(V) || !x.get(q) || !x.get(Y));
484
+ v(i, {
485
+ type: "button",
486
+ size: "sm",
487
+ onclick: je,
488
+ get disabled() {
489
+ return x.get(e);
490
+ },
491
+ children: (e, t) => {
492
+ x.next();
493
+ var n = x.text("Create key");
494
+ x.append(e, n);
495
+ },
496
+ $$slots: { default: !0 }
497
+ });
498
+ }
499
+ x.reset(n);
500
+ var a = x.sibling(n, 2), o = (e) => {
501
+ var t = Ee(), n = x.sibling(x.child(t), 2), r = x.child(n, !0);
502
+ x.reset(n), v(x.sibling(n, 2), {
503
+ type: "button",
504
+ size: "sm",
505
+ variant: "outline",
506
+ class: "mt-2",
507
+ onclick: () => navigator.clipboard.writeText(x.get(G)),
508
+ children: (e, t) => {
509
+ x.next();
510
+ var n = x.text("Copy key");
511
+ x.append(e, n);
512
+ },
513
+ $$slots: { default: !0 }
514
+ }), x.reset(t), x.template_effect(() => x.set_text(r, x.get(G))), x.append(e, t);
515
+ };
516
+ x.if(a, (e) => {
517
+ x.get(G) && e(o);
518
+ });
519
+ var s = x.sibling(a, 2);
520
+ x.each(s, 21, () => x.get(R), (e) => e.id, (e, t) => {
521
+ var n = De(), r = x.child(n), i = x.child(r);
522
+ x.reset(r);
523
+ var a = x.sibling(r, 2), o = x.child(a);
524
+ {
525
+ let e = x.derived(() => !x.get(t).recoverable && !x.get(z)[x.get(t).id]);
526
+ v(o, {
527
+ type: "button",
528
+ size: "sm",
529
+ variant: "outline",
530
+ onclick: () => Ne(x.get(t)),
531
+ get disabled() {
532
+ return x.get(e);
533
+ },
534
+ children: (e, n) => {
535
+ x.next();
536
+ var r = x.text();
537
+ x.template_effect(() => x.set_text(r, x.get(t).recoverable || x.get(z)[x.get(t).id] ? "Copy key" : "Rotate to enable copy")), x.append(e, r);
538
+ },
539
+ $$slots: { default: !0 }
540
+ });
541
+ }
542
+ v(x.sibling(o, 2), {
543
+ type: "button",
544
+ size: "sm",
545
+ variant: "destructive",
546
+ onclick: () => Me(x.get(t).id),
547
+ get disabled() {
548
+ return x.get(V);
549
+ },
550
+ children: (e, t) => {
551
+ x.next();
552
+ var n = x.text("Revoke");
553
+ x.append(e, n);
554
+ },
555
+ $$slots: { default: !0 }
556
+ }), x.reset(a), x.reset(n), x.template_effect(() => x.set_text(i, `${x.get(t).name ?? ""} · ${x.get(t).prefix ?? ""}…`)), x.append(e, n);
557
+ }), x.reset(s), x.reset(t), x.append(e, t);
558
+ };
559
+ x.if(f, (e) => {
560
+ D.mode === "edit" && x.get(P) === "category" && D.category?.id && e(p);
561
+ }), x.reset(t), x.event("submit", t, Q), x.append(e, t);
562
+ }, g = (e) => {
563
+ var t = w(), n = x.child(t, !0);
564
+ x.reset(t), x.template_effect(() => x.set_text(n, x.get(M))), x.append(e, t);
565
+ };
566
+ x.if(s, (e) => {
567
+ x.get(W) ? e(u) : x.get(H) ? e(f, 1) : x.get(J) ? x.get(M) && e(g, 3) : e(m, 2);
568
+ }), ie(x.sibling(s, 2), {
569
+ class: "gap-2 max-sm:flex-col max-sm:items-stretch",
570
+ children: (e, t) => {
571
+ var r = C(), i = x.first_child(r), a = (e) => {
572
+ v(e, {
573
+ variant: "outline",
574
+ type: "button",
575
+ onclick: $,
576
+ get disabled() {
577
+ return x.get(N);
578
+ },
579
+ children: (e, t) => {
580
+ x.next();
581
+ var n = x.text();
582
+ x.template_effect((e) => x.set_text(n, e), [() => p()]), x.append(e, n);
583
+ },
584
+ $$slots: { default: !0 }
585
+ });
586
+ };
587
+ x.if(i, (e) => {
588
+ !x.get(H) && !x.get(W) && e(a);
589
+ });
590
+ var o = x.sibling(i, 2);
591
+ {
592
+ let e = x.derived(() => x.get(J) ? "button" : "submit"), t = x.derived(() => x.get(J) ? "destructive" : "default"), r = x.derived(() => x.get(H) || x.get(W) ? $ : Q), i = x.derived(() => x.get(N) || !x.get(J) && !x.get(H) && !x.get(W) && x.get(q).length === 0);
593
+ v(o, {
594
+ get type() {
595
+ return x.get(e);
596
+ },
597
+ get variant() {
598
+ return x.get(t);
599
+ },
600
+ get onclick() {
601
+ return x.get(r);
602
+ },
603
+ get disabled() {
604
+ return x.get(i);
605
+ },
606
+ children: (e, t) => {
607
+ var r = Ae(), i = x.first_child(r), a = (e) => {
608
+ n(e, { class: "mr-1 size-4 animate-spin" });
609
+ };
610
+ x.if(i, (e) => {
611
+ x.get(N) && e(a);
612
+ });
613
+ var o = x.sibling(i);
614
+ x.template_effect(() => x.set_text(o, ` ${(x.get(H) || x.get(W) ? "Done" : x.get(Fe)) ?? ""}`)), x.append(e, r);
615
+ },
616
+ $$slots: { default: !0 }
617
+ });
618
+ }
619
+ x.append(e, r);
620
+ },
621
+ $$slots: { default: !0 }
622
+ }), x.append(r, a);
623
+ },
624
+ $$slots: { default: !0 }
625
+ });
626
+ },
627
+ $$slots: { default: !0 }
628
+ }), x.pop();
629
+ }
630
+ //#endregion
631
+ export { E as t };