ocean-brain 0.2.2 → 0.3.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.
Files changed (113) hide show
  1. package/dist/index.js +73 -41
  2. package/dist/mcp.js +587 -26
  3. package/package.json +6 -1
  4. package/scripts/postinstall-prisma.mjs +41 -0
  5. package/server/client/dist/assets/Calendar-DRv2aEl8.js +28 -0
  6. package/server/client/dist/assets/Callout-B2kPcDrq.js +1 -0
  7. package/server/client/dist/assets/Graph-DotbTrZR.js +1 -0
  8. package/server/client/dist/assets/Image-B5R7gF2P.js +1 -0
  9. package/server/client/dist/assets/Image.es-Dld9r9MJ.js +1 -0
  10. package/server/client/dist/assets/ModalActionRow-CES9L_Gy.js +1 -0
  11. package/server/client/dist/assets/Note-SK4hDhEM.css +1 -0
  12. package/server/client/dist/assets/Note-cIbXJc1v.js +1 -0
  13. package/server/client/dist/assets/Reminders-4LunlZRb.js +1 -0
  14. package/server/client/dist/assets/{Search-BANPp2ZV.js → Search-Cp17DGR6.js} +1 -1
  15. package/server/client/dist/assets/SurfaceCard-yzVU4Qkx.js +1 -0
  16. package/server/client/dist/assets/Tag-CwmuMPmo.js +1 -0
  17. package/server/client/dist/assets/TagNotes-gGroWMtT.js +1 -0
  18. package/server/client/dist/assets/Trash.es-B3KWD8_C.js +1 -0
  19. package/server/client/dist/assets/color-wpu7wT_s.js +1 -0
  20. package/server/client/dist/assets/{image.api-rBH0OSWJ.js → image.api-DJgOBt8S.js} +1 -1
  21. package/server/client/dist/assets/index-40Y2UsVr.js +205 -0
  22. package/server/client/dist/assets/index-BnxpTwtL.css +1 -0
  23. package/server/client/dist/assets/index-DYUg2N-6.js +1 -0
  24. package/server/client/dist/assets/manage-image-ByY1mRZx.js +1 -0
  25. package/server/client/dist/assets/manage-image-detail-BVaDZHRu.js +1 -0
  26. package/server/client/dist/assets/mcp-Jj3061aI.js +1 -0
  27. package/server/client/dist/assets/placeholder-4P_GK7fV.js +34 -0
  28. package/server/client/dist/assets/trash-CPBwY07S.js +1 -0
  29. package/server/client/dist/assets/{useReminderMutate-CU-UinGn.js → useReminderMutate-1YVndM2T.js} +1 -1
  30. package/server/client/dist/index.html +2 -2
  31. package/server/dist/app.js +97 -9
  32. package/server/dist/app.js.map +1 -1
  33. package/server/dist/main.js +16 -2
  34. package/server/dist/main.js.map +1 -1
  35. package/server/dist/modules/auth-guard.js +73 -0
  36. package/server/dist/modules/auth-guard.js.map +1 -0
  37. package/server/dist/modules/auth-mode.js +51 -0
  38. package/server/dist/modules/auth-mode.js.map +1 -0
  39. package/server/dist/modules/auth.js +9 -0
  40. package/server/dist/modules/auth.js.map +1 -1
  41. package/server/dist/modules/blocknote.js +7 -1
  42. package/server/dist/modules/blocknote.js.map +1 -1
  43. package/server/dist/modules/error-handler.js +41 -0
  44. package/server/dist/modules/error-handler.js.map +1 -0
  45. package/server/dist/modules/image-upload.js +114 -0
  46. package/server/dist/modules/image-upload.js.map +1 -0
  47. package/server/dist/modules/mcp-admin.js +88 -0
  48. package/server/dist/modules/mcp-admin.js.map +1 -0
  49. package/server/dist/modules/mcp-auth.js +71 -0
  50. package/server/dist/modules/mcp-auth.js.map +1 -0
  51. package/server/dist/modules/mcp-token.js +28 -0
  52. package/server/dist/modules/mcp-token.js.map +1 -0
  53. package/server/dist/modules/note-authoring.js +140 -0
  54. package/server/dist/modules/note-authoring.js.map +1 -0
  55. package/server/dist/modules/note-cleanup.js +207 -0
  56. package/server/dist/modules/note-cleanup.js.map +1 -0
  57. package/server/dist/modules/note-snapshot.js +223 -0
  58. package/server/dist/modules/note-snapshot.js.map +1 -0
  59. package/server/dist/modules/note-trash.js +262 -0
  60. package/server/dist/modules/note-trash.js.map +1 -0
  61. package/server/dist/modules/prisma-runtime.js +46 -0
  62. package/server/dist/modules/prisma-runtime.js.map +1 -0
  63. package/server/dist/modules/recovery-retention.js +26 -0
  64. package/server/dist/modules/recovery-retention.js.map +1 -0
  65. package/server/dist/modules/remote-image.js +176 -0
  66. package/server/dist/modules/remote-image.js.map +1 -0
  67. package/server/dist/modules/tag-organization.js +66 -0
  68. package/server/dist/modules/tag-organization.js.map +1 -0
  69. package/server/dist/modules/use-async.js +2 -4
  70. package/server/dist/modules/use-async.js.map +1 -1
  71. package/server/dist/schema/note/index.js +150 -6
  72. package/server/dist/schema/note/index.js.map +1 -1
  73. package/server/dist/start.js +11 -0
  74. package/server/dist/start.js.map +1 -0
  75. package/server/dist/types/index.js.map +1 -1
  76. package/server/dist/urls.js +3 -2
  77. package/server/dist/urls.js.map +1 -1
  78. package/server/dist/views/auth.js +305 -0
  79. package/server/dist/views/auth.js.map +1 -0
  80. package/server/dist/views/image.js +24 -81
  81. package/server/dist/views/image.js.map +1 -1
  82. package/server/dist/views/index.js +4 -0
  83. package/server/dist/views/index.js.map +1 -1
  84. package/server/dist/views/mcp-admin.js +42 -0
  85. package/server/dist/views/mcp-admin.js.map +1 -0
  86. package/server/dist/views/note.js +124 -0
  87. package/server/dist/views/note.js.map +1 -0
  88. package/server/dist/views/tag.js +23 -0
  89. package/server/dist/views/tag.js.map +1 -0
  90. package/server/prisma/migrations/20260331183000_0010_note_snapshot/migration.sql +13 -0
  91. package/server/prisma/migrations/20260331195000_0011_note_trash_entities/migration.sql +35 -0
  92. package/server/prisma/migrations/20260331213000_0012_image_hash_unique/migration.sql +49 -0
  93. package/server/prisma/migrations/20260404000000_0013_mcp_admin_control/migration.sql +9 -0
  94. package/server/prisma/schema.prisma +66 -1
  95. package/server/client/dist/assets/Calendar-ST5q_8KT.js +0 -48
  96. package/server/client/dist/assets/Callout-CrWW3bg0.js +0 -1
  97. package/server/client/dist/assets/Graph-CzJjt6rP.js +0 -1
  98. package/server/client/dist/assets/Image-Dxg1qqZw.js +0 -1
  99. package/server/client/dist/assets/Image.es-DZ0H6wH1.js +0 -1
  100. package/server/client/dist/assets/Note-Bu7fN3B6.js +0 -6
  101. package/server/client/dist/assets/Note-CCvXqPzv.css +0 -1
  102. package/server/client/dist/assets/Plus.es-CS3WVMDq.js +0 -1
  103. package/server/client/dist/assets/PriorityLegend-D61iBwNW.js +0 -1
  104. package/server/client/dist/assets/Reminders-BjirJMOR.css +0 -1
  105. package/server/client/dist/assets/Reminders-DjWRombU.js +0 -1
  106. package/server/client/dist/assets/Tag-DbKSLTj0.js +0 -1
  107. package/server/client/dist/assets/TagNotes-B6s7jtL7.js +0 -1
  108. package/server/client/dist/assets/index-BzWwEDoL.js +0 -1
  109. package/server/client/dist/assets/index-CF5_ZCYN.js +0 -162
  110. package/server/client/dist/assets/index-DjZk2Gpg.css +0 -1
  111. package/server/client/dist/assets/manage-image-detail-DOx6QsCl.js +0 -1
  112. package/server/client/dist/assets/manage-image-g-MC6Fkc.js +0 -1
  113. package/server/client/dist/assets/placeholder-DV3u6MrA.js +0 -34
@@ -0,0 +1,124 @@
1
+ import { createAppError } from "../modules/error-handler.js";
2
+ import {
3
+ createNoteFromMarkdown,
4
+ InvalidNoteAuthoringInputError,
5
+ updateNoteFromMarkdown
6
+ } from "../modules/note-authoring.js";
7
+ import { deleteNoteById } from "../modules/note-cleanup.js";
8
+ import { MCP_SNAPSHOT_META } from "../modules/note-snapshot.js";
9
+ const NOTE_LAYOUTS = /* @__PURE__ */ new Set(["narrow", "wide", "full"]);
10
+ const resolveNoteLayout = (value) => {
11
+ if (value === void 0) {
12
+ return void 0;
13
+ }
14
+ if (typeof value === "string" && NOTE_LAYOUTS.has(value)) {
15
+ return value;
16
+ }
17
+ return null;
18
+ };
19
+ const createMcpCreateNoteHandler = (createNote = createNoteFromMarkdown) => {
20
+ return async (req, res) => {
21
+ const { title, markdown, layout } = req.body ?? {};
22
+ const resolvedLayout = resolveNoteLayout(layout);
23
+ if (typeof title !== "string") {
24
+ throw createAppError(400, "INVALID_NOTE_TITLE", "A note title is required.");
25
+ }
26
+ if (markdown !== void 0 && typeof markdown !== "string") {
27
+ throw createAppError(400, "INVALID_NOTE_MARKDOWN", "Note markdown must be a string.");
28
+ }
29
+ if (layout !== void 0 && resolvedLayout === null) {
30
+ throw createAppError(400, "INVALID_NOTE_LAYOUT", "Note layout must be one of narrow, wide, or full.");
31
+ }
32
+ try {
33
+ const note = await createNote({
34
+ title,
35
+ ...markdown !== void 0 ? { markdown } : {},
36
+ ...resolvedLayout ? { layout: resolvedLayout } : {}
37
+ });
38
+ res.status(200).json({
39
+ created: true,
40
+ note
41
+ }).end();
42
+ } catch (error) {
43
+ if (error instanceof InvalidNoteAuthoringInputError) {
44
+ throw createAppError(400, "INVALID_NOTE_INPUT", error.message);
45
+ }
46
+ throw error;
47
+ }
48
+ };
49
+ };
50
+ const createMcpUpdateNoteHandler = (updateNote = updateNoteFromMarkdown) => {
51
+ return async (req, res) => {
52
+ const {
53
+ id,
54
+ title,
55
+ markdown,
56
+ layout,
57
+ editSessionId
58
+ } = req.body ?? {};
59
+ const noteId = Number(id);
60
+ const resolvedLayout = resolveNoteLayout(layout);
61
+ if (!Number.isInteger(noteId) || noteId <= 0) {
62
+ throw createAppError(400, "INVALID_NOTE_ID", "A valid note id is required.");
63
+ }
64
+ if (title !== void 0 && typeof title !== "string") {
65
+ throw createAppError(400, "INVALID_NOTE_TITLE", "Note title must be a string.");
66
+ }
67
+ if (markdown !== void 0 && typeof markdown !== "string") {
68
+ throw createAppError(400, "INVALID_NOTE_MARKDOWN", "Note markdown must be a string.");
69
+ }
70
+ if (layout !== void 0 && resolvedLayout === null) {
71
+ throw createAppError(400, "INVALID_NOTE_LAYOUT", "Note layout must be one of narrow, wide, or full.");
72
+ }
73
+ if (editSessionId !== void 0 && typeof editSessionId !== "string") {
74
+ throw createAppError(400, "INVALID_EDIT_SESSION_ID", "Edit session id must be a string.");
75
+ }
76
+ if (title === void 0 && markdown === void 0 && layout === void 0) {
77
+ throw createAppError(400, "INVALID_NOTE_INPUT", "At least one note field must be provided for update.");
78
+ }
79
+ try {
80
+ const note = await updateNote({
81
+ id: noteId,
82
+ ...title !== void 0 ? { title } : {},
83
+ ...markdown !== void 0 ? { markdown } : {},
84
+ ...resolvedLayout ? { layout: resolvedLayout } : {},
85
+ ...editSessionId !== void 0 ? { editSessionId } : {},
86
+ snapshotMeta: MCP_SNAPSHOT_META
87
+ });
88
+ if (!note) {
89
+ throw createAppError(404, "NOTE_NOT_FOUND", "The requested note was not found.");
90
+ }
91
+ res.status(200).json({
92
+ updated: true,
93
+ note
94
+ }).end();
95
+ } catch (error) {
96
+ if (error instanceof InvalidNoteAuthoringInputError) {
97
+ throw createAppError(400, "INVALID_NOTE_INPUT", error.message);
98
+ }
99
+ throw error;
100
+ }
101
+ };
102
+ };
103
+ const createMcpDeleteNoteHandler = (deleteNote = deleteNoteById) => {
104
+ return async (req, res) => {
105
+ const id = Number(req.body?.id);
106
+ if (!Number.isInteger(id) || id <= 0) {
107
+ throw createAppError(400, "INVALID_NOTE_ID", "A valid note id is required.");
108
+ }
109
+ const deletedNote = await deleteNote(id);
110
+ if (!deletedNote) {
111
+ throw createAppError(404, "NOTE_NOT_FOUND", "The requested note was not found.");
112
+ }
113
+ res.status(200).json({
114
+ deleted: true,
115
+ note: deletedNote
116
+ }).end();
117
+ };
118
+ };
119
+ export {
120
+ createMcpCreateNoteHandler,
121
+ createMcpDeleteNoteHandler,
122
+ createMcpUpdateNoteHandler
123
+ };
124
+ //# sourceMappingURL=note.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/views/note.ts"],"sourcesContent":["import type { Controller } from '~/types/index.js';\nimport { createAppError } from '~/modules/error-handler.js';\nimport {\n createNoteFromMarkdown,\n InvalidNoteAuthoringInputError,\n updateNoteFromMarkdown\n} from '~/modules/note-authoring.js';\nimport { deleteNoteById } from '~/modules/note-cleanup.js';\nimport { MCP_SNAPSHOT_META } from '~/modules/note-snapshot.js';\nimport type { NoteLayout } from '~/models.js';\n\nconst NOTE_LAYOUTS = new Set<NoteLayout>(['narrow', 'wide', 'full']);\n\nconst resolveNoteLayout = (value: unknown): NoteLayout | null | undefined => {\n if (value === undefined) {\n return undefined;\n }\n\n if (typeof value === 'string' && NOTE_LAYOUTS.has(value as NoteLayout)) {\n return value as NoteLayout;\n }\n\n return null;\n};\n\nexport const createMcpCreateNoteHandler = (\n createNote = createNoteFromMarkdown\n): Controller => {\n return async (req, res) => {\n const { title, markdown, layout } = req.body ?? {};\n const resolvedLayout = resolveNoteLayout(layout);\n\n if (typeof title !== 'string') {\n throw createAppError(400, 'INVALID_NOTE_TITLE', 'A note title is required.');\n }\n\n if (markdown !== undefined && typeof markdown !== 'string') {\n throw createAppError(400, 'INVALID_NOTE_MARKDOWN', 'Note markdown must be a string.');\n }\n\n if (layout !== undefined && resolvedLayout === null) {\n throw createAppError(400, 'INVALID_NOTE_LAYOUT', 'Note layout must be one of narrow, wide, or full.');\n }\n\n try {\n const note = await createNote({\n title,\n ...(markdown !== undefined ? { markdown } : {}),\n ...(resolvedLayout ? { layout: resolvedLayout } : {})\n });\n\n res.status(200).json({\n created: true,\n note\n }).end();\n } catch (error) {\n if (error instanceof InvalidNoteAuthoringInputError) {\n throw createAppError(400, 'INVALID_NOTE_INPUT', error.message);\n }\n\n throw error;\n }\n };\n};\n\nexport const createMcpUpdateNoteHandler = (\n updateNote = updateNoteFromMarkdown\n): Controller => {\n return async (req, res) => {\n const {\n id, title, markdown, layout, editSessionId\n } = req.body ?? {};\n const noteId = Number(id);\n const resolvedLayout = resolveNoteLayout(layout);\n\n if (!Number.isInteger(noteId) || noteId <= 0) {\n throw createAppError(400, 'INVALID_NOTE_ID', 'A valid note id is required.');\n }\n\n if (title !== undefined && typeof title !== 'string') {\n throw createAppError(400, 'INVALID_NOTE_TITLE', 'Note title must be a string.');\n }\n\n if (markdown !== undefined && typeof markdown !== 'string') {\n throw createAppError(400, 'INVALID_NOTE_MARKDOWN', 'Note markdown must be a string.');\n }\n\n if (layout !== undefined && resolvedLayout === null) {\n throw createAppError(400, 'INVALID_NOTE_LAYOUT', 'Note layout must be one of narrow, wide, or full.');\n }\n\n if (editSessionId !== undefined && typeof editSessionId !== 'string') {\n throw createAppError(400, 'INVALID_EDIT_SESSION_ID', 'Edit session id must be a string.');\n }\n\n if (\n title === undefined &&\n markdown === undefined &&\n layout === undefined\n ) {\n throw createAppError(400, 'INVALID_NOTE_INPUT', 'At least one note field must be provided for update.');\n }\n\n try {\n const note = await updateNote({\n id: noteId,\n ...(title !== undefined ? { title } : {}),\n ...(markdown !== undefined ? { markdown } : {}),\n ...(resolvedLayout ? { layout: resolvedLayout } : {}),\n ...(editSessionId !== undefined ? { editSessionId } : {}),\n snapshotMeta: MCP_SNAPSHOT_META\n });\n\n if (!note) {\n throw createAppError(404, 'NOTE_NOT_FOUND', 'The requested note was not found.');\n }\n\n res.status(200).json({\n updated: true,\n note\n }).end();\n } catch (error) {\n if (error instanceof InvalidNoteAuthoringInputError) {\n throw createAppError(400, 'INVALID_NOTE_INPUT', error.message);\n }\n\n throw error;\n }\n };\n};\n\nexport const createMcpDeleteNoteHandler = (\n deleteNote = deleteNoteById\n): Controller => {\n return async (req, res) => {\n const id = Number(req.body?.id);\n\n if (!Number.isInteger(id) || id <= 0) {\n throw createAppError(400, 'INVALID_NOTE_ID', 'A valid note id is required.');\n }\n\n const deletedNote = await deleteNote(id);\n\n if (!deletedNote) {\n throw createAppError(404, 'NOTE_NOT_FOUND', 'The requested note was not found.');\n }\n\n res.status(200).json({\n deleted: true,\n note: deletedNote\n }).end();\n };\n};\n"],"mappings":"AACA,SAAS,sBAAsB;AAC/B;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,sBAAsB;AAC/B,SAAS,yBAAyB;AAGlC,MAAM,eAAe,oBAAI,IAAgB,CAAC,UAAU,QAAQ,MAAM,CAAC;AAEnE,MAAM,oBAAoB,CAAC,UAAkD;AACzE,MAAI,UAAU,QAAW;AACrB,WAAO;AAAA,EACX;AAEA,MAAI,OAAO,UAAU,YAAY,aAAa,IAAI,KAAmB,GAAG;AACpE,WAAO;AAAA,EACX;AAEA,SAAO;AACX;AAEO,MAAM,6BAA6B,CACtC,aAAa,2BACA;AACb,SAAO,OAAO,KAAK,QAAQ;AACvB,UAAM,EAAE,OAAO,UAAU,OAAO,IAAI,IAAI,QAAQ,CAAC;AACjD,UAAM,iBAAiB,kBAAkB,MAAM;AAE/C,QAAI,OAAO,UAAU,UAAU;AAC3B,YAAM,eAAe,KAAK,sBAAsB,2BAA2B;AAAA,IAC/E;AAEA,QAAI,aAAa,UAAa,OAAO,aAAa,UAAU;AACxD,YAAM,eAAe,KAAK,yBAAyB,iCAAiC;AAAA,IACxF;AAEA,QAAI,WAAW,UAAa,mBAAmB,MAAM;AACjD,YAAM,eAAe,KAAK,uBAAuB,mDAAmD;AAAA,IACxG;AAEA,QAAI;AACA,YAAM,OAAO,MAAM,WAAW;AAAA,QAC1B;AAAA,QACA,GAAI,aAAa,SAAY,EAAE,SAAS,IAAI,CAAC;AAAA,QAC7C,GAAI,iBAAiB,EAAE,QAAQ,eAAe,IAAI,CAAC;AAAA,MACvD,CAAC;AAED,UAAI,OAAO,GAAG,EAAE,KAAK;AAAA,QACjB,SAAS;AAAA,QACT;AAAA,MACJ,CAAC,EAAE,IAAI;AAAA,IACX,SAAS,OAAO;AACZ,UAAI,iBAAiB,gCAAgC;AACjD,cAAM,eAAe,KAAK,sBAAsB,MAAM,OAAO;AAAA,MACjE;AAEA,YAAM;AAAA,IACV;AAAA,EACJ;AACJ;AAEO,MAAM,6BAA6B,CACtC,aAAa,2BACA;AACb,SAAO,OAAO,KAAK,QAAQ;AACvB,UAAM;AAAA,MACF;AAAA,MAAI;AAAA,MAAO;AAAA,MAAU;AAAA,MAAQ;AAAA,IACjC,IAAI,IAAI,QAAQ,CAAC;AACjB,UAAM,SAAS,OAAO,EAAE;AACxB,UAAM,iBAAiB,kBAAkB,MAAM;AAE/C,QAAI,CAAC,OAAO,UAAU,MAAM,KAAK,UAAU,GAAG;AAC1C,YAAM,eAAe,KAAK,mBAAmB,8BAA8B;AAAA,IAC/E;AAEA,QAAI,UAAU,UAAa,OAAO,UAAU,UAAU;AAClD,YAAM,eAAe,KAAK,sBAAsB,8BAA8B;AAAA,IAClF;AAEA,QAAI,aAAa,UAAa,OAAO,aAAa,UAAU;AACxD,YAAM,eAAe,KAAK,yBAAyB,iCAAiC;AAAA,IACxF;AAEA,QAAI,WAAW,UAAa,mBAAmB,MAAM;AACjD,YAAM,eAAe,KAAK,uBAAuB,mDAAmD;AAAA,IACxG;AAEA,QAAI,kBAAkB,UAAa,OAAO,kBAAkB,UAAU;AAClE,YAAM,eAAe,KAAK,2BAA2B,mCAAmC;AAAA,IAC5F;AAEA,QACI,UAAU,UACV,aAAa,UACb,WAAW,QACb;AACE,YAAM,eAAe,KAAK,sBAAsB,sDAAsD;AAAA,IAC1G;AAEA,QAAI;AACA,YAAM,OAAO,MAAM,WAAW;AAAA,QAC1B,IAAI;AAAA,QACJ,GAAI,UAAU,SAAY,EAAE,MAAM,IAAI,CAAC;AAAA,QACvC,GAAI,aAAa,SAAY,EAAE,SAAS,IAAI,CAAC;AAAA,QAC7C,GAAI,iBAAiB,EAAE,QAAQ,eAAe,IAAI,CAAC;AAAA,QACnD,GAAI,kBAAkB,SAAY,EAAE,cAAc,IAAI,CAAC;AAAA,QACvD,cAAc;AAAA,MAClB,CAAC;AAED,UAAI,CAAC,MAAM;AACP,cAAM,eAAe,KAAK,kBAAkB,mCAAmC;AAAA,MACnF;AAEA,UAAI,OAAO,GAAG,EAAE,KAAK;AAAA,QACjB,SAAS;AAAA,QACT;AAAA,MACJ,CAAC,EAAE,IAAI;AAAA,IACX,SAAS,OAAO;AACZ,UAAI,iBAAiB,gCAAgC;AACjD,cAAM,eAAe,KAAK,sBAAsB,MAAM,OAAO;AAAA,MACjE;AAEA,YAAM;AAAA,IACV;AAAA,EACJ;AACJ;AAEO,MAAM,6BAA6B,CACtC,aAAa,mBACA;AACb,SAAO,OAAO,KAAK,QAAQ;AACvB,UAAM,KAAK,OAAO,IAAI,MAAM,EAAE;AAE9B,QAAI,CAAC,OAAO,UAAU,EAAE,KAAK,MAAM,GAAG;AAClC,YAAM,eAAe,KAAK,mBAAmB,8BAA8B;AAAA,IAC/E;AAEA,UAAM,cAAc,MAAM,WAAW,EAAE;AAEvC,QAAI,CAAC,aAAa;AACd,YAAM,eAAe,KAAK,kBAAkB,mCAAmC;AAAA,IACnF;AAEA,QAAI,OAAO,GAAG,EAAE,KAAK;AAAA,MACjB,SAAS;AAAA,MACT,MAAM;AAAA,IACV,CAAC,EAAE,IAAI;AAAA,EACX;AACJ;","names":[]}
@@ -0,0 +1,23 @@
1
+ import { createAppError } from "../modules/error-handler.js";
2
+ import { InvalidTagNameError, ensureTagByName } from "../modules/tag-organization.js";
3
+ const createMcpCreateTagHandler = (ensureTag = ensureTagByName) => {
4
+ return async (req, res) => {
5
+ const name = req.body?.name;
6
+ if (typeof name !== "string") {
7
+ throw createAppError(400, "INVALID_TAG_NAME", "A tag name is required.");
8
+ }
9
+ try {
10
+ const result = await ensureTag(name);
11
+ res.status(200).json(result).end();
12
+ } catch (error) {
13
+ if (error instanceof InvalidTagNameError) {
14
+ throw createAppError(400, "INVALID_TAG_NAME", error.message);
15
+ }
16
+ throw error;
17
+ }
18
+ };
19
+ };
20
+ export {
21
+ createMcpCreateTagHandler
22
+ };
23
+ //# sourceMappingURL=tag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/views/tag.ts"],"sourcesContent":["import type { Controller } from '~/types/index.js';\nimport { createAppError } from '~/modules/error-handler.js';\nimport { InvalidTagNameError, ensureTagByName } from '~/modules/tag-organization.js';\n\nexport const createMcpCreateTagHandler = (\n ensureTag = ensureTagByName\n): Controller => {\n return async (req, res) => {\n const name = req.body?.name;\n\n if (typeof name !== 'string') {\n throw createAppError(400, 'INVALID_TAG_NAME', 'A tag name is required.');\n }\n\n try {\n const result = await ensureTag(name);\n res.status(200).json(result).end();\n } catch (error) {\n if (error instanceof InvalidTagNameError) {\n throw createAppError(400, 'INVALID_TAG_NAME', error.message);\n }\n\n throw error;\n }\n };\n};\n"],"mappings":"AACA,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB,uBAAuB;AAE9C,MAAM,4BAA4B,CACrC,YAAY,oBACC;AACb,SAAO,OAAO,KAAK,QAAQ;AACvB,UAAM,OAAO,IAAI,MAAM;AAEvB,QAAI,OAAO,SAAS,UAAU;AAC1B,YAAM,eAAe,KAAK,oBAAoB,yBAAyB;AAAA,IAC3E;AAEA,QAAI;AACA,YAAM,SAAS,MAAM,UAAU,IAAI;AACnC,UAAI,OAAO,GAAG,EAAE,KAAK,MAAM,EAAE,IAAI;AAAA,IACrC,SAAS,OAAO;AACZ,UAAI,iBAAiB,qBAAqB;AACtC,cAAM,eAAe,KAAK,oBAAoB,MAAM,OAAO;AAAA,MAC/D;AAEA,YAAM;AAAA,IACV;AAAA,EACJ;AACJ;","names":[]}
@@ -0,0 +1,13 @@
1
+ CREATE TABLE "NoteSnapshot" (
2
+ "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
3
+ "noteId" INTEGER NOT NULL,
4
+ "title" TEXT NOT NULL,
5
+ "payload" TEXT NOT NULL,
6
+ "editSessionId" TEXT,
7
+ "meta" TEXT,
8
+ "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
9
+ CONSTRAINT "NoteSnapshot_noteId_fkey" FOREIGN KEY ("noteId") REFERENCES "Note" ("id") ON DELETE CASCADE ON UPDATE CASCADE
10
+ );
11
+
12
+ CREATE INDEX "NoteSnapshot_noteId_createdAt_idx" ON "NoteSnapshot"("noteId", "createdAt");
13
+ CREATE UNIQUE INDEX "NoteSnapshot_noteId_editSessionId_key" ON "NoteSnapshot"("noteId", "editSessionId");
@@ -0,0 +1,35 @@
1
+ CREATE TABLE "DeletedNote" (
2
+ "id" INTEGER NOT NULL PRIMARY KEY,
3
+ "title" TEXT NOT NULL,
4
+ "content" TEXT NOT NULL,
5
+ "createdAt" DATETIME NOT NULL,
6
+ "updatedAt" DATETIME NOT NULL,
7
+ "deletedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
8
+ "pinned" BOOLEAN NOT NULL DEFAULT false,
9
+ "order" INTEGER NOT NULL DEFAULT 0,
10
+ "layout" TEXT NOT NULL DEFAULT 'wide'
11
+ );
12
+
13
+ CREATE TABLE "DeletedNoteTag" (
14
+ "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
15
+ "deletedNoteId" INTEGER NOT NULL,
16
+ "name" TEXT NOT NULL,
17
+ CONSTRAINT "DeletedNoteTag_deletedNoteId_fkey" FOREIGN KEY ("deletedNoteId") REFERENCES "DeletedNote" ("id") ON DELETE CASCADE ON UPDATE CASCADE
18
+ );
19
+
20
+ CREATE TABLE "DeletedReminder" (
21
+ "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
22
+ "deletedNoteId" INTEGER NOT NULL,
23
+ "originalId" INTEGER,
24
+ "reminderDate" DATETIME NOT NULL,
25
+ "completed" BOOLEAN NOT NULL DEFAULT false,
26
+ "priority" TEXT NOT NULL DEFAULT 'medium',
27
+ "content" TEXT,
28
+ "createdAt" DATETIME NOT NULL,
29
+ "updatedAt" DATETIME NOT NULL,
30
+ CONSTRAINT "DeletedReminder_deletedNoteId_fkey" FOREIGN KEY ("deletedNoteId") REFERENCES "DeletedNote" ("id") ON DELETE CASCADE ON UPDATE CASCADE
31
+ );
32
+
33
+ CREATE INDEX "DeletedNote_deletedAt_updatedAt_idx" ON "DeletedNote"("deletedAt", "updatedAt");
34
+ CREATE INDEX "DeletedNoteTag_deletedNoteId_idx" ON "DeletedNoteTag"("deletedNoteId");
35
+ CREATE INDEX "DeletedReminder_deletedNoteId_idx" ON "DeletedReminder"("deletedNoteId");
@@ -0,0 +1,49 @@
1
+ CREATE TEMP TABLE "_ImageDuplicateMap" AS
2
+ SELECT
3
+ duplicate."id" AS "duplicateId",
4
+ duplicate."url" AS "duplicateUrl",
5
+ canonical."id" AS "canonicalId",
6
+ canonical."url" AS "canonicalUrl",
7
+ ROW_NUMBER() OVER (ORDER BY duplicate."id") AS "position"
8
+ FROM "Image" AS duplicate
9
+ JOIN (
10
+ SELECT "hash", MIN("id") AS "canonicalId"
11
+ FROM "Image"
12
+ GROUP BY "hash"
13
+ ) AS grouped
14
+ ON grouped."hash" = duplicate."hash"
15
+ JOIN "Image" AS canonical
16
+ ON canonical."id" = grouped."canonicalId"
17
+ WHERE duplicate."id" <> grouped."canonicalId";
18
+
19
+ WITH RECURSIVE "rewritten"("noteId", "position", "content") AS (
20
+ SELECT "id", 0, "content"
21
+ FROM "Note"
22
+ UNION ALL
23
+ SELECT
24
+ "rewritten"."noteId",
25
+ "_ImageDuplicateMap"."position",
26
+ replace("rewritten"."content", "_ImageDuplicateMap"."duplicateUrl", "_ImageDuplicateMap"."canonicalUrl")
27
+ FROM "rewritten"
28
+ JOIN "_ImageDuplicateMap"
29
+ ON "_ImageDuplicateMap"."position" = "rewritten"."position" + 1
30
+ )
31
+ UPDATE "Note"
32
+ SET "content" = (
33
+ SELECT "rewritten"."content"
34
+ FROM "rewritten"
35
+ WHERE "rewritten"."noteId" = "Note"."id"
36
+ ORDER BY "rewritten"."position" DESC
37
+ LIMIT 1
38
+ )
39
+ WHERE EXISTS (SELECT 1 FROM "_ImageDuplicateMap");
40
+
41
+ DELETE FROM "Image"
42
+ WHERE "id" IN (
43
+ SELECT "duplicateId"
44
+ FROM "_ImageDuplicateMap"
45
+ );
46
+
47
+ CREATE UNIQUE INDEX "Image_hash_key" ON "Image"("hash");
48
+
49
+ DROP TABLE "_ImageDuplicateMap";
@@ -0,0 +1,9 @@
1
+ CREATE TABLE "McpToken" (
2
+ "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
3
+ "tokenHash" TEXT NOT NULL,
4
+ "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
5
+ "lastUsedAt" DATETIME,
6
+ "revokedAt" DATETIME
7
+ );
8
+
9
+ CREATE INDEX "McpToken_revokedAt_createdAt_idx" ON "McpToken"("revokedAt", "createdAt");
@@ -15,6 +15,16 @@ model Cache {
15
15
  updatedAt DateTime @updatedAt
16
16
  }
17
17
 
18
+ model McpToken {
19
+ id Int @id @default(autoincrement())
20
+ tokenHash String
21
+ createdAt DateTime @default(now())
22
+ lastUsedAt DateTime?
23
+ revokedAt DateTime?
24
+
25
+ @@index([revokedAt, createdAt])
26
+ }
27
+
18
28
  model Note {
19
29
  id Int @id @default(autoincrement())
20
30
  title String
@@ -26,12 +36,67 @@ model Note {
26
36
  layout NoteLayout @default(wide)
27
37
  tags Tag[] @relation("NoteToTag")
28
38
  reminders Reminder[] @relation("NoteToReminder")
39
+ snapshots NoteSnapshot[]
40
+ }
41
+
42
+ model NoteSnapshot {
43
+ id Int @id @default(autoincrement())
44
+ noteId Int
45
+ note Note @relation(fields: [noteId], references: [id], onDelete: Cascade)
46
+ title String
47
+ payload String
48
+ editSessionId String?
49
+ meta String?
50
+ createdAt DateTime @default(now())
51
+
52
+ @@index([noteId, createdAt])
53
+ @@unique([noteId, editSessionId])
54
+ }
55
+
56
+ model DeletedNote {
57
+ id Int @id
58
+ title String
59
+ content String
60
+ createdAt DateTime
61
+ updatedAt DateTime
62
+ deletedAt DateTime @default(now())
63
+ pinned Boolean @default(false)
64
+ order Int @default(0)
65
+ layout NoteLayout @default(wide)
66
+ tags DeletedNoteTag[]
67
+ reminders DeletedReminder[]
68
+
69
+ @@index([deletedAt, updatedAt])
70
+ }
71
+
72
+ model DeletedNoteTag {
73
+ id Int @id @default(autoincrement())
74
+ deletedNoteId Int
75
+ deletedNote DeletedNote @relation(fields: [deletedNoteId], references: [id], onDelete: Cascade)
76
+ name String
77
+
78
+ @@index([deletedNoteId])
79
+ }
80
+
81
+ model DeletedReminder {
82
+ id Int @id @default(autoincrement())
83
+ deletedNoteId Int
84
+ deletedNote DeletedNote @relation(fields: [deletedNoteId], references: [id], onDelete: Cascade)
85
+ originalId Int?
86
+ reminderDate DateTime
87
+ completed Boolean @default(false)
88
+ priority ReminderPriority @default(medium)
89
+ content String?
90
+ createdAt DateTime
91
+ updatedAt DateTime
92
+
93
+ @@index([deletedNoteId])
29
94
  }
30
95
 
31
96
  model Image {
32
97
  id Int @id @default(autoincrement())
33
98
  url String
34
- hash String
99
+ hash String @unique
35
100
  createdAt DateTime @default(now())
36
101
  updatedAt DateTime @updatedAt
37
102
  }
@@ -1,48 +0,0 @@
1
- import{j as e}from"./note-vendor-BofYbzmZ.js";import{L as q,N as F,d as x,g as K,o as W,p as J,s as V,M as C,B as S,a as G,b as X,u as _,q as A,c as H,P as Z,S as ee,T as te,e as L,f as se,C as ne}from"./index-CF5_ZCYN.js";import{a as j}from"./graph-vendor-CUxe67Lr.js";import{P as ae}from"./PriorityLegend-D61iBwNW.js";import{C as re}from"./Callout-CrWW3bg0.js";import"./note-core-BCgMq5QA.js";const oe=({note:s,type:t})=>e.jsx(q,{to:F,params:{id:s.id},className:"block min-h-[44px]",children:e.jsxs("div",{className:`
2
- ${K(s.title)}
3
- rounded-sketchy-sm
4
- px-2 py-1.5
5
- hover:brightness-95 dark:hover:brightness-110
6
- transition-all
7
- h-full flex flex-col justify-center
8
- `,children:[e.jsx("div",{className:"font-bold text-xs line-clamp-1 text-fg-default",children:s.title}),e.jsx("div",{className:"text-fg-secondary text-[10px] font-medium",children:x(Number(t==="create"?s.createdAt:s.updatedAt)).format("HH:mm")})]})}),ie=({reminder:s,isPast:t})=>{const n=t&&!s.completed,o=s.priority||"medium";return e.jsx(q,{to:F,params:{id:String(s.note?.id??s.noteId)},className:"block min-h-[44px]",children:e.jsxs("div",{className:`
9
- rounded-sketchy-sm
10
- px-2 py-1.5
11
- hover:brightness-95 dark:hover:brightness-110
12
- transition-all
13
- h-full flex flex-col justify-center
14
- ${n?W:J[o]}
15
- ${s.completed?"opacity-40":""}
16
- `,children:[e.jsxs("div",{className:"flex items-center gap-1 mb-0.5",children:[e.jsx(V,{size:12,className:"text-fg-muted"}),n&&e.jsx("span",{className:"text-[9px] font-bold text-fg-error",children:"!"})]}),e.jsx("div",{className:`font-bold line-clamp-1 text-xs text-fg-default ${s.completed?"line-through":""}`,children:s.content||s.note?.title||"No title"}),e.jsx("div",{className:"text-fg-secondary text-[10px] font-medium",children:x(Number(s.reminderDate)).format("HH:mm")})]})})},k=3,Y=(s,t,n)=>s.map(o=>o.type==="note"?e.jsx(oe,{note:o.item,type:t},`note-${o.item.id}`):e.jsx(ie,{reminder:o.item,isPast:n},`reminder-${o.item.id}`)),de=({day:s,isCurrentMonth:t,isSunday:n,isToday:o,isPast:d,notes:u,reminders:p,type:h})=>{const[y,v]=j.useState(!1),g=j.useMemo(()=>{const b=u.map(N=>({type:"note",item:N})),M=p.map(N=>({type:"reminder",item:N}));return d?[...b,...M]:[...M,...b]},[d,u,p]),D=g.length>k,$=j.useCallback(()=>v(!0),[]),a=j.useCallback(()=>v(!1),[]),i=()=>t?o?"border-border outline outline-1 outline-border":"bg-surface border-border-subtle":"bg-muted/30 border-border-subtle",l=()=>o?"bg-accent-primary text-fg-on-accent border-2 border-border font-bold":t?n?"text-fg-weekend font-bold":"text-fg-secondary font-bold":"text-fg-disabled";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`min-h-[140px] rounded-sketchy-sm border p-2 ${i()}`,children:[e.jsx("div",{className:"flex justify-end mb-2",children:e.jsx("span",{className:`
17
- flex items-center justify-center
18
- w-7 h-7 text-sm
19
- rounded-sketchy-xs
20
- ${l()}
21
- `,children:s})}),t&&g.length>0&&e.jsxs("div",{className:"flex flex-col gap-1",children:[Y(g.slice(0,k),h,d),D&&e.jsxs("button",{type:"button",onClick:$,className:"text-center text-[10px] font-bold text-fg-tertiary py-1 cursor-pointer hover:text-fg-muted hover:bg-hover-subtle rounded-sketchy-xs transition-colors",children:["+",g.length-k," more"]})]})]}),D&&e.jsxs(C,{isOpen:y,onClose:a,children:[e.jsx(C.Header,{title:`${s}일`,onClose:a}),e.jsx(C.Body,{children:e.jsx("div",{className:"flex flex-col gap-2 max-h-[60vh] overflow-y-auto",children:Y(g,h,d)})})]})]})},ce=j.memo(de),le=["January","February","March","April","May","June","July","August","September","October","November","December"],me=({month:s,year:t,onPrevMonth:n,onNextMonth:o,onToday:d})=>e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:le[s-1]}),e.jsx("span",{className:"text-xl sm:text-2xl text-fg-placeholder",children:t})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"ghost",size:"sm",onClick:d,children:"Today"}),e.jsx(S,{variant:"ghost",size:"icon-sm",onClick:n,children:e.jsx(G,{width:18,height:18})}),e.jsx(S,{variant:"ghost",size:"icon-sm",onClick:o,children:e.jsx(X,{width:18,height:18})})]})]}),xe=`
22
- query NotesInDateRange($dateRange: DateRangeInput) {
23
- notesInDateRange(dateRange: $dateRange) {
24
- id
25
- title
26
- createdAt
27
- updatedAt
28
- }
29
- }
30
- `,he=`
31
- query RemindersInDateRange($dateRange: DateRangeInput) {
32
- remindersInDateRange(dateRange: $dateRange) {
33
- id
34
- noteId
35
- reminderDate
36
- completed
37
- priority
38
- content
39
- note {
40
- id
41
- title
42
- }
43
- }
44
- }
45
- `,ue=async s=>{const t=await H(xe,{dateRange:s});if(t.type==="error")throw t;return t.notesInDateRange},pe=async s=>{const t=await H(he,{dateRange:s});if(t.type==="error")throw t;return t.remindersInDateRange},ye=({year:s,month:t})=>{const n=`${s}-${String(t).padStart(2,"0")}-01`,o=t===12?1:t+1,u=`${t===12?s+1:s}-${String(o).padStart(2,"0")}-01`,p={start:n,end:u},h=_({queryKey:A.calendar.notesInDateRange(s,t),queryFn:()=>ue(p)}),y=_({queryKey:A.reminders.inDateRange(s,t),queryFn:()=>pe(p)});return{notes:h.data??[],reminders:y.data??[],isLoading:h.isLoading||y.isLoading,isError:h.isError||y.isError}},ge=["SUN","MON","TUE","WED","THU","FRI","SAT"],fe=[],be=[],P=se(ne);function $e(){const s=P.useNavigate(),{year:t,month:n,type:o}=P.useSearch(),{notes:d,reminders:u,isLoading:p,isError:h}=ye({year:t,month:n}),y=j.useMemo(()=>{const a=x(),i=`${a.year()}-${a.month()+1}-${a.date()}`,l=new Map;for(const r of d){const m=o==="create"?x(Number(r.createdAt)):x(Number(r.updatedAt)),c=`${m.year()}-${m.month()+1}-${m.date()}`,f=l.get(c)||[];f.push(r),l.set(c,f)}const b=new Map;for(const r of u){const m=x(Number(r.reminderDate)),c=`${m.year()}-${m.month()+1}-${m.date()}`,f=b.get(c)||[];f.push(r),b.set(c,f)}const M=new Date(t,n-1,1),N=new Date(t,n,0),E=M.getDay(),w=N.getDate(),R=[],T=n===1?12:n-1,I=n===1?t-1:t,U=new Date(I,T,0).getDate();for(let r=E-1;r>=0;r--)R.push({day:U-r,isCurrentMonth:!1,year:I,month:T});for(let r=1;r<=w;r++)R.push({day:r,isCurrentMonth:!0,year:t,month:n});const O=(E+w)%7,B=O===0?0:7-O,Q=n===12?1:n+1,z=n===12?t+1:t;for(let r=1;r<=B;r++)R.push({day:r,isCurrentMonth:!1,year:z,month:Q});return R.map((r,m)=>{const c=`${r.year}-${r.month}-${r.day}`,f=x(`${r.year}-${String(r.month).padStart(2,"0")}-${String(r.day).padStart(2,"0")}`);return{key:c,day:r.day,isCurrentMonth:r.isCurrentMonth,isSunday:m%7===0,isToday:c===i,isPast:f.isBefore(a,"day"),notes:l.get(c)||fe,reminders:b.get(c)||be}})},[t,n,d,u,o]),v=()=>{const a=n===1?12:n-1,i=n===1?t-1:t;s({search:l=>({...l,month:a,year:i})})},g=()=>{const a=n===12?1:n+1,i=n===12?t+1:t;s({search:l=>({...l,month:a,year:i})})},D=()=>{s({search:a=>({...a,month:x().month()+1,year:x().year()})})},$=a=>{a&&s({search:i=>({...i,type:a})})};return e.jsx(Z,{title:"Calendar",variant:"none",children:e.jsxs("div",{className:"w-full px-4 sm:px-6 py-6 sm:py-10 max-w-screen-2xl mx-auto",children:[h?e.jsx(re,{children:"Failed to load calendar data. Please try again later."}):e.jsxs("div",{className:"bg-surface rounded-[16px_5px_17px_5px/5px_13px_5px_15px] p-3 sm:p-4 border-2 border-border shadow-sketchy overflow-x-auto",children:[e.jsx(me,{month:n,year:t,onPrevMonth:v,onNextMonth:g,onToday:D}),e.jsxs("div",{className:"min-w-[900px]",children:[e.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:ge.map((a,i)=>e.jsx("div",{className:`
46
- py-2 text-center text-xs font-bold tracking-wider
47
- ${i===0?"text-fg-weekend":"text-fg-secondary"}
48
- `,children:a},a))}),p?e.jsx("div",{className:"grid grid-cols-7 gap-1",children:Array.from({length:35}).map((a,i)=>e.jsx(ee,{height:140},i))}):e.jsx("div",{className:"grid grid-cols-7 gap-1",children:y.map(a=>e.jsx(ce,{day:a.day,isCurrentMonth:a.isCurrentMonth,isSunday:a.isSunday,isToday:a.isToday,isPast:a.isPast,notes:a.notes,reminders:a.reminders,type:o},a.key))})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 mt-6",children:[e.jsx(ae,{}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm text-fg-tertiary font-bold",children:"Display by:"}),e.jsxs(te,{type:"single",variant:"pills",size:"sm",value:o,onValueChange:$,children:[e.jsx(L,{value:"create",children:"Create date"}),e.jsx(L,{value:"update",children:"Update date"})]})]})]})]})})}export{$e as default};
@@ -1 +0,0 @@
1
- import{j as a}from"./note-vendor-BofYbzmZ.js";import{a as e}from"./graph-vendor-CUxe67Lr.js";import{a4 as l}from"./index-CF5_ZCYN.js";const n=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),e.createElement("path",{d:"M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),r=e.forwardRef((t,m)=>e.createElement(l,{ref:m,...t,weights:n}));r.displayName="InfoIcon";const s=r,p=({children:t,className:m=""})=>a.jsx("div",{className:`bg-elevated py-3 px-4 rounded-[12px_4px_13px_3px/4px_10px_4px_12px] border-2 border-border-secondary shadow-sketchy ${m}`,children:a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsx(s,{className:"h-5 w-5 text-fg-muted"}),a.jsx("div",{className:"text-sm font-bold flex-1 text-fg-default",children:t})]})})});export{p as C};
@@ -1 +0,0 @@
1
- import{j as r}from"./note-vendor-BofYbzmZ.js";import{a as s,F as Q}from"./graph-vendor-CUxe67Lr.js";import{Q as U,P as N,i as V,S as Y,j as J,k as X,l as ee,m as te,q as ne,N as re,n as F,E as se}from"./index-CF5_ZCYN.js";import"./note-core-BCgMq5QA.js";const M=["#FCEBAF","#B2E0B2","#FFB3C1","#FFCCB3","#A4D8E1","#E1B7E1","#A4DBD6","#E1C6E7"],L=["#3f3f46","#404047","#42424a","#38383f","#3b3b42","#3d3d44","#393940","#414148"],oe=M.map(o=>O(o,.15)),ae=L.map(o=>O(o,.15));function O(o,l){const f=parseInt(o.slice(1,3),16),b=parseInt(o.slice(3,5),16),E=parseInt(o.slice(5,7),16);return`rgba(${f},${b},${E},${l})`}function P(o){return o<=1?3:o<=3?4:o<=5?5:Math.min(8,5+Math.sqrt(o)*.8)}const ie=r.jsx(N,{title:"Knowledge Graph",children:r.jsx("div",{className:"flex items-center justify-center",style:{height:"600px"},children:r.jsx(Y,{width:"100%",height:"100%"})})});function le(){const o=J(),l=s.useRef(null),f=s.useRef(null),[b,E]=s.useState({width:800,height:600}),[d,D]=s.useState(null),{theme:A}=X(t=>t),p=A==="dark",S=s.useRef(p);S.current=p;const{data:w}=ee({queryKey:ne.notes.graph(),queryFn:async()=>{const t=await te();if(t.type==="error")throw t;return t.noteGraph}}),i=s.useMemo(()=>{if(w.nodes.length===0)return null;const t=w.nodes.filter(n=>n.connections>0);if(t.length===0)return null;const e=new Set(t.map(n=>n.id));return{nodes:t,links:w.links.filter(n=>e.has(n.source)&&e.has(n.target))}},[w]);s.useEffect(()=>{if(!i)return;const t=()=>{if(!l.current)return;const e=l.current.getBoundingClientRect();E({width:e.width,height:Math.max(600,window.innerHeight-150)})};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[i]),s.useEffect(()=>{if(!i||!f.current)return;const t=window.setTimeout(()=>{f.current?.zoomToFit(400,50)},500);return()=>window.clearTimeout(t)},[i]);const x=s.useRef(d);x.current=d;const G=s.useCallback(t=>{if(x.current===t.id){o({to:re,params:{id:t.id}});return}D(t.id)},[o]),_=s.useCallback(()=>{D(null)},[]),K=s.useCallback(t=>{l.current&&(l.current.style.cursor=t?"pointer":"default")},[]),R=s.useRef(!1),$=s.useCallback(()=>{R.current||(R.current=!0,f.current?.enableZoomInteraction(!1))},[]),z=s.useCallback(()=>{R.current=!1,f.current?.enableZoomInteraction(!0)},[]),I=s.useRef(new Map),H=s.useMemo(()=>{const t=new Map;if(i)for(const e of i.links)t.has(e.source)||t.set(e.source,new Set),t.has(e.target)||t.set(e.target,new Set),t.get(e.source)?.add(e.target),t.get(e.target)?.add(e.source);return t},[i]);I.current=H;const W=s.useCallback((t,e,n)=>{const a=S.current,c=d,y=I.current,h=P(t.connections),g=t.x||0,k=t.y||0,m=c===t.id,j=c?y.get(c)?.has(t.id)??!1:!1,Z=c!==null&&!m&&!j;if(e.beginPath(),e.arc(g,k,h,0,Math.PI*2),Z){if(t.connections>3)e.fillStyle=a?"rgba(63,63,70,0.15)":"rgba(255,179,193,0.15)";else{const u=a?ae:oe;e.fillStyle=u[F(t.id)%u.length]}e.fill();return}if(m)e.fillStyle=a?"#a1a1aa":"#FFCCB3";else if(j)e.fillStyle=a?"#71717a":"#E1B7E1";else if(t.connections>3)e.fillStyle=a?"#52525b":"#FFB3C1";else{const u=a?L:M;e.fillStyle=u[F(t.id)%u.length]}if(e.fill(),e.strokeStyle=a?"#3f3f46":"#3d3d3d",e.lineWidth=(m?2:1)/n,e.stroke(),m&&(e.beginPath(),e.arc(g,k,h+2/n,0,Math.PI*2),e.strokeStyle=a?"#d4d4d8":"#27272a",e.lineWidth=1.5/n,e.stroke()),m||j||n>2.5){const u=t.title||"Untitled",T=Math.max(10/n,2.5);e.font=`${m||j?"bold ":""}${T}px Gaegu, cursive`,e.textAlign="center",e.textBaseline="top";const v=e.measureText(u).width,C=2/n,B=k+h+3/n;e.fillStyle=a?"rgba(24,24,27,0.85)":"rgba(255,252,247,0.9)",e.fillRect(g-v/2-C,B,v+C*2,T+C*2),e.fillStyle=a?"#f4f4f5":"#27272a",e.fillText(u,g,B+C)}},[d]),q=s.useCallback((t,e,n)=>{const a=S.current,c=d,y=t.source,h=t.target,g=c?y.id===c||h.id===c:!1,k=c!==null&&!g;e.beginPath(),e.moveTo(y.x||0,y.y||0),e.lineTo(h.x||0,h.y||0),k?(e.strokeStyle=a?"rgba(63,63,70,0.06)":"rgba(212,212,216,0.06)",e.lineWidth=.5/n):g?(e.strokeStyle=a?"#71717a":"#E1B7E1",e.lineWidth=2/n):(e.strokeStyle=a?"rgba(63,63,70,0.5)":"rgba(212,212,216,0.7)",e.lineWidth=.5/n),e.stroke()},[d]);return i?r.jsxs(N,{title:"Knowledge Graph",description:`${i.nodes.length} linked notes, ${i.links.length} connections`,children:[r.jsxs("div",{ref:l,className:"relative overflow-hidden border-2 border-border rounded-sketchy-lg shadow-sketchy",style:{background:p?"#1f1f23":"#fffcf7"},children:[d&&(()=>{const t=i.nodes.find(e=>e.id===d);return t?r.jsxs("div",{className:"absolute top-3 left-3 z-10 flex items-center gap-2 px-3 py-1.5 rounded-sketchy-md border-2 border-border bg-bg-primary shadow-sketchy text-sm",children:[r.jsx("span",{className:"font-bold truncate max-w-48",children:t.title}),r.jsxs("span",{className:"text-fg-tertiary",children:[t.connections," links"]}),r.jsx("button",{onClick:()=>D(null),className:"ml-1 text-fg-tertiary hover:text-fg-primary transition-colors cursor-pointer","aria-label":"Deselect node",children:"x"})]}):null})(),r.jsx(Q,{ref:f,graphData:i,width:b.width,height:b.height,nodeId:"id",nodeLabel:"",nodeCanvasObject:W,nodePointerAreaPaint:(t,e,n)=>{n.beginPath(),n.arc(t.x||0,t.y||0,Math.max(P(t.connections)+4,10),0,2*Math.PI),n.fillStyle=e,n.fill()},linkCanvasObject:q,linkCanvasObjectMode:()=>"replace",linkDirectionalParticles:0,onNodeClick:G,onNodeHover:K,onBackgroundClick:_,onNodeDrag:$,onNodeDragEnd:z,warmupTicks:30,cooldownTicks:80,d3AlphaDecay:.05,d3VelocityDecay:.3,enableZoomInteraction:!0,enablePanInteraction:!0,minZoom:.3,maxZoom:5})]}),r.jsxs("div",{className:"mt-4 flex flex-wrap gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-4 h-4 rounded-sketchy-xs border-2 border-border",style:{background:p?"#52525b":"#FFB3C1"}}),r.jsx("span",{className:"text-fg-tertiary font-medium",children:"Hub notes (4+ connections)"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-4 h-4 rounded-sketchy-xs border-2 border-border",style:{background:p?"#3f3f46":"#B2E0B2"}}),r.jsx("span",{className:"text-fg-tertiary font-medium",children:"Connected notes"})]})]})]}):r.jsx(N,{title:"Knowledge Graph",children:r.jsx(se,{icon:"🌌",title:"No constellations yet",description:"Link your notes together and watch your own starry sky unfold."})})}function he(){return r.jsx(U,{fallback:ie,errorTitle:"Failed to load graph",errorDescription:"Retry loading your linked note constellation.",renderError:({error:o,retry:l})=>r.jsx(N,{title:"Knowledge Graph",children:r.jsx(V,{title:"Failed to load graph",description:"Retry loading your linked note constellation.",error:o,onRetry:l})}),children:r.jsx(le,{})})}export{he as default};
@@ -1 +0,0 @@
1
- import{a}from"./graph-vendor-CUxe67Lr.js";import{a4 as o,k as Z}from"./index-CF5_ZCYN.js";import{j as n}from"./note-vendor-BofYbzmZ.js";const i=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),a.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z"}))]]),A=a.forwardRef((e,r)=>a.createElement(o,{ref:r,...e,weights:i}));A.displayName="TrashIcon";const M=A;function f({src:e,alt:r,loading:V="lazy",className:s}){const m=a.useRef(null),{theme:h}=Z(t=>t),l=h==="dark"?"brightness(0.85) saturate(0.9)":void 0;return a.useEffect(()=>{if(!m.current||V!=="lazy"||!e)return;const t=new IntersectionObserver(([c])=>{if(c.isIntersecting){const H=c.target;H.src=H.dataset.src,t.unobserve(H)}});return t.observe(m.current),()=>{t.disconnect()}},[V,e]),n.jsx(n.Fragment,{children:V!=="lazy"?n.jsx("img",{src:e,alt:r,className:s,style:{filter:l}}):n.jsx("img",{ref:m,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQIW2O4evXqfwAIgQN/QHwrfwAAAABJRU5ErkJggg==",alt:r,"data-src":e,className:s,style:{filter:l}})})}export{f as I,M as n};
@@ -1 +0,0 @@
1
- import{a}from"./graph-vendor-CUxe67Lr.js";import{a4 as m}from"./index-CF5_ZCYN.js";const n=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M144,96a16,16,0,1,1,16,16A16,16,0,0,1,144,96Zm92-40V200a20,20,0,0,1-20,20H40a20,20,0,0,1-20-20V56A20,20,0,0,1,40,36H216A20,20,0,0,1,236,56ZM44,60v79.72l33.86-33.86a20,20,0,0,1,28.28,0L147.31,147l17.18-17.17a20,20,0,0,1,28.28,0L212,149.09V60Zm0,136H162.34L92,125.66l-48,48Zm168,0V183l-33.37-33.37L164.28,164l32,32Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M224,56V178.06l-39.72-39.72a8,8,0,0,0-11.31,0L147.31,164,97.66,114.34a8,8,0,0,0-11.32,0L32,168.69V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z",opacity:"0.2"}),a.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM156,88a12,12,0,1,1-12,12A12,12,0,0,1,156,88Zm60,112H40V160.69l46.34-46.35a8,8,0,0,1,11.32,0h0L165,181.66a8,8,0,0,0,11.32-11.32l-17.66-17.65L173,138.34a8,8,0,0,1,11.31,0L216,170.07V200Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,42H40A14,14,0,0,0,26,56V200a14,14,0,0,0,14,14H216a14,14,0,0,0,14-14V56A14,14,0,0,0,216,42ZM40,54H216a2,2,0,0,1,2,2V163.57L188.53,134.1a14,14,0,0,0-19.8,0l-21.42,21.42L101.9,110.1a14,14,0,0,0-19.8,0L38,154.2V56A2,2,0,0,1,40,54ZM38,200V171.17l52.58-52.58a2,2,0,0,1,2.84,0L176.83,202H40A2,2,0,0,1,38,200Zm178,2H193.8l-38-38,21.41-21.42a2,2,0,0,1,2.83,0l38,38V200A2,2,0,0,1,216,202ZM146,100a10,10,0,1,1,10,10A10,10,0,0,1,146,100Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,44H40A12,12,0,0,0,28,56V200a12,12,0,0,0,12,12H216a12,12,0,0,0,12-12V56A12,12,0,0,0,216,44ZM40,52H216a4,4,0,0,1,4,4V168.4l-32.89-32.89a12,12,0,0,0-17,0l-22.83,22.83-46.82-46.83a12,12,0,0,0-17,0L36,159V56A4,4,0,0,1,40,52ZM36,200V170.34l53.17-53.17a4,4,0,0,1,5.66,0L181.66,204H40A4,4,0,0,1,36,200Zm180,4H193l-40-40,22.83-22.83a4,4,0,0,1,5.66,0L220,179.71V200A4,4,0,0,1,216,204ZM148,100a8,8,0,1,1,8,8A8,8,0,0,1,148,100Z"}))]]),e=a.forwardRef((l,t)=>a.createElement(m,{ref:t,...l,weights:n}));e.displayName="ImageIcon";const Z=e;export{Z as I};
@@ -1,6 +0,0 @@
1
- import{j as e,U as V,y as J,v as X,i as O,k as Z,X as ee,F as te}from"./note-vendor-BofYbzmZ.js";import{l as q,z as se,q as K,M as w,B as C,A as G,L as I,N as L,x as ne,D as A,G as ae,v as re,H as oe,k as le,I as M,J as ie,d as N,K as ce,T as de,e as $,b as me,O as xe,U as ue,V as fe,W as Q,X as W,Q as H,P,i as E,f as he,S as T,Y as pe,Z as ge,_ as be,$ as je,a0 as z}from"./index-CF5_ZCYN.js";import{a as m}from"./graph-vendor-CUxe67Lr.js";import{u as ye}from"./image.api-rBH0OSWJ.js";import{V as ve,a2 as Ne,a3 as we,A as Ce}from"./note-core-BCgMq5QA.js";import{u as ke,R as Te}from"./useReminderMutate-CU-UinGn.js";import{n as Re}from"./Plus.es-CS3WVMDq.js";const Se=t=>{const{data:n}=q({queryKey:K.notes.backReferences(t.noteId),async queryFn(){const r=await se(t.noteId);if(r.type==="error")throw r;return r.backReferences}});return t.render(n)},_e=[{value:"narrow",label:"Narrow",description:"Optimized for reading long-form content"},{value:"wide",label:"Wide",description:"Balanced width suitable for most content"},{value:"full",label:"Full Width",description:"Maximize screen space utilization"}];function De({isOpen:t,onClose:n,onSave:r,currentLayout:o="wide"}){const[s,l]=m.useState(o);m.useEffect(()=>{t&&l(o)},[t,o]);const a=()=>{r(s),n()};return e.jsxs(w,{isOpen:t,onClose:n,children:[e.jsx(w.Header,{title:"Layout Settings",onClose:n}),e.jsx(w.Body,{children:e.jsx("div",{className:"flex flex-col gap-3 sm:gap-4",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-xs sm:text-sm font-bold text-fg-muted",children:"Note Layout"}),e.jsx("div",{className:"flex flex-col gap-2",children:_e.map(d=>e.jsx(C,{variant:s===d.value?"primary":"ghost",className:`!justify-start !text-left !h-auto p-3 sm:p-4 ${s===d.value?"shadow-sketchy":""}`,onClick:()=>l(d.value),children:e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-sm sm:text-base text-fg-default",children:d.label}),e.jsx("div",{className:"text-xs sm:text-sm text-fg-tertiary mt-1 font-medium",children:d.description})]})},d.value))})]})})}),e.jsx(w.Footer,{children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(C,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),e.jsx(C,{size:"sm",onClick:a,children:"Apply"})]})})]})}const Me="_Reference_l9lqc_1",$e={Reference:Me},Ae=G.bind($e),He=V({type:"reference",propSchema:{id:{default:""},title:{default:"Unknown"}},content:"none"},{render:t=>e.jsx("span",{className:Ae("Reference"),children:e.jsx(I,{to:L,params:{id:t.inlineContent.props.id},children:e.jsxs("span",{className:"text-fg-default",children:["[",t.inlineContent.props.title,"]"]})})})}),Ee="_Tag_1o5du_1",Oe={Tag:Ee},Ie=G.bind(Oe),Le=V({type:"tag",propSchema:{id:{default:""},tag:{default:"@Unknown"}},content:"none"},{render:t=>e.jsx("span",{className:Ie("Tag"),children:e.jsx(I,{to:ne,params:{id:t.inlineContent.props.id},search:{page:1},children:e.jsx("span",{className:"text-fg-default",children:t.inlineContent.props.tag})})})}),Pe=()=>{const t=X(),[n,r]=m.useState([]);m.useEffect(()=>{const s=()=>{const a=t.document,d=[],p=v=>{for(const h of v){if(h.type==="heading"){const j=h,y=j.props.level||1,u=j.content?.map(k=>k.text||"").join("")||"";u.trim()&&d.push({id:h.id,level:y,text:u})}h.children&&Array.isArray(h.children)&&p(h.children)}};p(a),r(d)};s();const l=t.onChange?.(s);return()=>{l&&l()}},[t]);const o=s=>{t.setTextCursorPosition(s);const l=document.querySelector(`[data-id="${s}"]`);l&&l.scrollIntoView({behavior:"smooth",block:"center"})};return n.length===0?e.jsx("div",{className:"w-full rounded-sketchy-lg border-2 border-border bg-subtle p-6",children:e.jsxs("div",{className:"flex items-center gap-3 text-fg-tertiary",children:[e.jsx(A,{className:"text-2xl flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-base mb-1",children:"Table of Contents"}),e.jsx("div",{className:"text-sm opacity-75",children:"Add headings to your document to generate a table of contents"})]})]})}):e.jsxs("div",{className:"w-full rounded-sketchy-lg border-2 border-border bg-subtle p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(A,{className:"text-xl text-fg-muted"}),e.jsx("h3",{className:"text-base font-bold text-fg",children:"Table of Contents"})]}),e.jsx("nav",{className:"space-y-0.5",children:n.map(s=>{const l=(s.level-1)*16,a=s.level===1;return e.jsx("button",{onClick:()=>o(s.id),className:`
2
- block w-full text-left rounded-sketchy-sm px-3 py-2 transition-all duration-150
3
- hover:bg-hover
4
- hover:translate-x-1
5
- ${a?"text-sm font-semibold text-fg":"text-sm text-fg-muted"}
6
- `,style:{paddingLeft:`${12+l}px`},children:e.jsxs("span",{className:"flex items-center gap-2",children:[a&&e.jsx("span",{className:"w-2 h-2 rounded-sketchy-xs bg-fg-default flex-shrink-0"}),e.jsx("span",{className:"line-clamp-2",children:s.text})]})},s.id)})})]})},Ye=J({type:"tableOfContents",propSchema:{},content:"none"},{render:()=>e.jsx(Pe,{})})(),ze=ve.create({inlineContentSpecs:{...we,tag:Le,reference:He},blockSpecs:{...Ne,tableOfContents:Ye}}),Fe=({editor:t})=>e.jsx(O,{triggerCharacter:"/",getItems:async n=>Ce([...Z(t).filter(r=>r.title!=="Audio"&&r.title!=="Video"&&r.title!=="File"),{title:"Table of Contents",subtext:"Insert a table of contents based on headings",onItemClick:()=>{t.insertBlocks([{type:"tableOfContents"}],t.getTextCursorPosition().block,"after")},aliases:["toc","table of contents","contents","outline","index"],group:"Other",icon:e.jsx(A,{})}],n)}),Be=({onClick:t})=>e.jsx(O,{triggerCharacter:"[",getItems:async n=>{const r=await ae({query:n,limit:5});if(r.type==="error")return[];const{notes:o}=r.allNotes;return o.map(s=>({title:s.title,onItemClick:()=>t({type:"reference",props:{id:s.id,title:s.title}})}))}}),Ue=({onClick:t})=>e.jsx(O,{triggerCharacter:"@",getItems:async n=>{const r=await re({query:n,limit:5});if(r.type==="error")return[];const{tags:o}=r.allTags,s=o.some(a=>a.name!==`@${n}`),l=[{title:"Add a new tag",onItemClick:async()=>{const a=await oe({name:"@"+n});if(a.type==="error")return;const{id:d,name:p}=a.createTag;t({type:"tag",props:{id:d,tag:p}})}}];return o.length===0?l:o.map(a=>({title:a.name,onItemClick:()=>t({type:"tag",props:{id:a.id,tag:a.name}})})).concat(n&&s?l:[])}});async function Ve(t){return new Promise((n,r)=>{const o=new FileReader;o.readAsDataURL(t),o.onload=()=>n(o.result),o.onerror=s=>r(s)})}const qe=m.forwardRef(({content:t,editable:n,onChange:r},o)=>{const{theme:s}=le(a=>a),l=ee({schema:ze,initialContent:t&&JSON.parse(t)||void 0,uploadFile:async a=>ye({base64:await Ve(a)})},[]);return m.useImperativeHandle(o,()=>({getContent:()=>JSON.stringify(l.document)})),e.jsxs(te,{slashMenu:!1,theme:s,editor:l,editable:n,onChange:r,children:[e.jsx(Fe,{editor:l}),e.jsx(Be,{onClick:a=>{l.insertInlineContent([a," "])}}),e.jsx(Ue,{onClick:a=>{l.insertInlineContent([a," "])}})]})}),F={low:{active:"bg-accent-success text-fg-default border-2 border-border shadow-sketchy",inactive:"bg-subtle text-fg-muted border-2 border-transparent"},medium:{active:"bg-pastel-yellow-200 dark:bg-elevated text-fg-default border-2 border-border shadow-sketchy",inactive:"bg-subtle text-fg-muted border-2 border-transparent"},high:{active:"bg-accent-danger text-fg-default border-2 border-border shadow-sketchy",inactive:"bg-subtle text-fg-muted border-2 border-transparent"}};function Ke({isOpen:t,onClose:n,onSave:r,reminder:o,mode:s}){const[l,a]=m.useState(new Date),[d,p]=m.useState("medium"),[v,h]=m.useState("");m.useEffect(()=>{t&&s==="edit"&&o?(a(new Date(Number(o.reminderDate))),p(o.priority||"medium"),h(o.content||"")):t&&s==="create"&&(a(new Date),p("medium"),h(""))},[t,s,o]);const j=()=>{r(l,d,v||void 0),n()},y=u=>d===u?F[u].active:F[u].inactive;return e.jsxs(w,{isOpen:t,onClose:n,children:[e.jsx(w.Header,{title:s==="create"?"Create Reminder":"Edit Reminder",onClose:n}),e.jsx(w.Body,{children:e.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(M,{children:"Date & Time"}),e.jsx(ie,{type:"datetime-local",size:"sm",value:N(l).format("YYYY-MM-DDTHH:mm"),onChange:u=>a(new Date(u.target.value))})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(M,{children:"Content"}),e.jsx(ce,{size:"sm",placeholder:"Enter reminder content (optional)",value:v,onChange:u=>h(u.target.value)})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(M,{children:"Priority"}),e.jsxs(de,{type:"single",value:d,onValueChange:u=>u&&p(u),className:"border-none gap-1.5 sm:gap-2",children:[e.jsx($,{value:"low",className:`flex-1 rounded-[8px_3px_9px_2px/3px_6px_3px_7px] font-bold ${y("low")}`,children:"Low"}),e.jsx($,{value:"medium",className:`flex-1 rounded-[8px_3px_9px_2px/3px_6px_3px_7px] font-bold ${y("medium")}`,children:"Medium"}),e.jsx($,{value:"high",className:`flex-1 rounded-[8px_3px_9px_2px/3px_6px_3px_7px] font-bold ${y("high")}`,children:"High"})]})]})]})}),e.jsx(w.Footer,{children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(C,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),e.jsx(C,{size:"sm",onClick:j,children:s==="create"?"Create":"Save"})]})})]})}const Ge="_pulsingText_jjwi3_1",Qe="_urgent_jjwi3_7",B={pulsingText:Ge,urgent:Qe};function We({noteId:t}){const[n,r]=m.useState(!1),[o,s]=m.useState(!1),[l,a]=m.useState("create"),[d,p]=m.useState(void 0),{onCreate:v,onUpdate:h,onDelete:j}=ke(),y=()=>{a("create"),p(void 0),s(!0)},u=x=>{a("edit"),p(x),s(!0)},k=(x,f,i)=>{l==="create"?v(t,x,f,()=>{s(!1)},i):l==="edit"&&d&&h(d.id,t,{reminderDate:x,priority:f,content:i},()=>{s(!1)})},S=x=>{h(x.id,t,{completed:!x.completed})},_=x=>{const f=N(Number(x)),i=N();return f.isSame(i,"day")?`Today at ${f.format("HH:mm")}`:f.isSame(i.add(1,"day"),"day")?`Tomorrow at ${f.format("HH:mm")}`:f.format("YYYY-MM-DD HH:mm")},D=x=>{const f=N(Number(x)),i=N(),b=f.diff(i,"hour");return b<=6?"high":b<=24?"medium":"low"},R=x=>{const f=N(Number(x)),i=N(),b=f.diff(i,"hour"),c=f.diff(i,"minute")%60;return b<0||c<0?"Overdue":b===0?`${c}m remaining`:`${b}h ${c}m remaining`};return e.jsxs("div",{className:"p-4 rounded-sketchy-lg mb-5 border-2 border-border bg-surface/50",children:[e.jsxs("div",{className:"flex justify-between items-center mb-3",children:[e.jsxs("button",{onClick:()=>r(!n),className:"flex items-center gap-2 px-2 py-1 rounded-sketchy-sm hover:bg-hover-subtle transition-colors",children:[n?e.jsx(me,{size:14}):e.jsx(xe,{size:14}),e.jsx("p",{className:"text-sm font-bold",children:"Reminders"})]}),!n&&e.jsxs(C,{size:"sm",variant:"ghost",onClick:y,children:[e.jsx(Re,{className:"w-3 h-3"}),e.jsx("span",{className:"hidden sm:inline text-xs",children:"Add"})]})]}),!n&&e.jsx(Te,{noteId:t,searchParams:{offset:0,limit:9999},render:({reminders:x,totalCount:f})=>e.jsx("div",{className:"flex flex-col gap-2",children:x.length===0?e.jsx("p",{className:"text-fg-placeholder text-xs",children:f===0?"No reminders.":"No incomplete reminders."}):e.jsx("div",{className:"flex flex-col gap-1.5",children:x.map(i=>{const b=i.priority||D(i.reminderDate),c=R(i.reminderDate);return e.jsxs("div",{className:`flex items-start gap-2 p-2 rounded-sketchy-md transition-colors ${i.completed?"bg-muted":ue[b]}`,children:[e.jsx(fe,{checked:i.completed,onChange:()=>S(i),size:"sm"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:`font-bold text-xs text-fg-muted ${i.completed?"line-through opacity-50":""}`,children:_(i.reminderDate)}),i.content&&e.jsx("div",{className:`text-xs text-fg-tertiary ${i.completed?"line-through opacity-50":""} truncate`,children:i.content}),!i.completed&&e.jsx("span",{className:`text-[10px] font-medium ${B.pulsingText} ${b==="high"?B.urgent:"text-fg-placeholder"}`,children:c})]}),e.jsx(Q,{button:e.jsx(W,{size:14,className:"text-fg-placeholder"}),items:[{name:"Edit",onClick:()=>u(i)},{name:"Delete",onClick:()=>j(i.id,t)}]})]},i.id)})})})}),e.jsx(Ke,{isOpen:o,onClose:()=>s(!1),onSave:k,reminder:d,mode:l})]})}const Je=he(L),U=t=>N(Number(t)).format("YYYY-MM-DD HH:mm:ss"),Xe={narrow:"max-w-[640px]",wide:"max-w-[896px]",full:"max-w-full px-4"},Ze=e.jsx(P,{title:"Loading note",variant:"none",children:e.jsxs("main",{className:"mx-auto max-w-[896px]",children:[e.jsx(T,{className:"mb-8",height:"66px"}),e.jsx(T,{className:"ml-12 mb-8",height:"150px"}),e.jsx(T,{className:"mb-5",height:"80px"}),e.jsx(T,{height:"80px"})]})});function et({id:t}){const n=pe(),r=m.useRef(null),o=m.useRef(null),{data:s}=q({queryKey:K.notes.detail(t),queryFn:async()=>{const c=await ge(t);if(c.type==="error")throw c;return c.note},gcTime:0}),[l,a]=m.useState(s.title),[d,p]=m.useState(()=>U(s.updatedAt)),[v,h]=m.useState(s.pinned),[j,y]=m.useState(s.layout||"wide"),[u,k]=m.useState(!1),[S,_]=be(1e3);m.useEffect(()=>{a(s.title),h(s.pinned),y(s.layout||"wide"),p(U(s.updatedAt))},[s.layout,s.pinned,s.title,s.updatedAt]);const D=async({title:c="",content:g=""})=>{_(async()=>{const Y=await z({id:t,title:c,content:g});if(Y.type==="error"){n(Y.errors[0].message);return}a(c),p(N().format("YYYY-MM-DD HH:mm:ss"))})},R=()=>{D({title:o.current?.value,content:r.current?.getContent()})},x=async c=>{const g=await z({id:t,layout:c});if(g.type==="error"){n(g.errors[0].message);return}y(c),n("Layout has been updated.")},{onCreate:f,onDelete:i,onPinned:b}=je();return e.jsx(P,{title:l,variant:"none",children:e.jsxs("main",{className:`mx-auto ${Xe[j]}`,children:[e.jsxs("div",{style:{zIndex:"1001"},className:"sticky top-20 mb-8 flex items-center justify-between gap-3 p-3 px-4 border-2 border-border rounded-sketchy-lg bg-surface/90 backdrop-blur-sm shadow-sketchy",children:[e.jsxs("div",{className:"flex flex-col flex-1 gap-1",children:[e.jsx("input",{ref:o,placeholder:"Title",className:"text-md font-bold outline-none bg-transparent w-full",type:"text",defaultValue:s.title,onChange:R}),d&&e.jsxs("div",{className:"text-fg-placeholder text-xs",children:["Last saved at ",d]})]}),e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(Q,{button:e.jsx(W,{className:"w-5 h-5"}),items:[{name:v?"Unpin":"Pin",onClick:()=>b(t,v,()=>{h(c=>!c)})},{name:"Clone this note",onClick:()=>f(o.current?.value||"untitled",r.current?.getContent()||"",j)},{name:"Delete",onClick:()=>i(t,()=>{n("The note has been deleted.")})},{name:"Change layout",onClick:()=>k(!0)}]}),e.jsx(C,{size:"sm",isLoading:S,onClick:R,children:"Save"})]})]}),e.jsx(qe,{ref:r,content:s.content,onChange:R}),e.jsx(H,{fallback:e.jsx(T,{className:"mb-5",height:"80px"}),errorTitle:"Failed to load reminders",errorDescription:"Retry loading reminder details for this note.",renderError:({error:c,retry:g})=>e.jsx(E,{title:"Failed to load reminders",description:"Retry loading reminder details for this note.",error:c,onRetry:g,showBackAction:!1,showHomeAction:!1}),children:e.jsx(We,{noteId:t})}),e.jsx(H,{fallback:e.jsx(T,{height:"80px"}),errorTitle:"Failed to load back references",errorDescription:"Retry loading notes that link back here.",renderError:({error:c,retry:g})=>e.jsx(E,{title:"Failed to load back references",description:"Retry loading notes that link back here.",error:c,onRetry:g,showBackAction:!1,showHomeAction:!1}),children:e.jsx(Se,{noteId:t,render:c=>c&&c.length>0&&e.jsxs("div",{className:"p-4 rounded-sketchy-lg border-2 border-border bg-surface/50",children:[e.jsx("p",{className:"text-sm font-bold mb-2",children:"Back References"}),e.jsx("ul",{className:"text-sm flex flex-col gap-1",children:c.map(g=>e.jsx("li",{children:e.jsxs(I,{to:L,params:{id:g.id},className:"block px-2 py-1 rounded-sketchy-sm text-fg-secondary hover:bg-hover transition-colors",children:["- ",g.title]})},g.id))})]})})}),e.jsx(De,{isOpen:u,onClose:()=>k(!1),onSave:x,currentLayout:j})]})})}function it(){const{id:t}=Je.useParams();if(!t)throw new Error("Note id is required.");return e.jsx(H,{fallback:Ze,errorTitle:"Failed to load note",errorDescription:"Retry loading the note editor.",resetKeys:[t],renderError:({error:n,retry:r})=>e.jsx(P,{title:"Note",variant:"none",children:e.jsx(E,{title:"Failed to load note",description:"Retry loading the note editor.",error:n,onRetry:r})}),children:e.jsx(et,{id:t},t)})}export{it as default};
@@ -1 +0,0 @@
1
- ._Reference_l9lqc_1{display:inline-flex;align-items:center;font-size:.75rem;font-weight:700;padding:2px 8px;border-radius:6px 2px 7px/2px 5px 2px 6px;background:linear-gradient(135deg,#e1c6e7,#d4b3dc);border:1.5px solid #C9A3D2;box-shadow:0 1px 2px #c9a3d233;transition:all .15s ease}._Reference_l9lqc_1:hover{background:linear-gradient(135deg,#d4b3dc,#c9a3d2);box-shadow:0 2px 4px #c9a3d24d;transform:translateY(-.5px)}html.dark ._Reference_l9lqc_1{background:linear-gradient(135deg,#3f3f46,#27272a);border-color:var(--border-secondary);box-shadow:0 1px 2px #0000004d}html.dark ._Reference_l9lqc_1:hover{background:linear-gradient(135deg,#52525b,#3f3f46);box-shadow:0 2px 4px #0006}._Tag_1o5du_1{display:inline-flex;align-items:center;font-size:.75rem;font-weight:700;padding:2px 8px;border-radius:6px 2px 7px/2px 5px 2px 6px;background:linear-gradient(135deg,#a4dbd6,#8ecfc8);border:1.5px solid #7ABFB8;box-shadow:0 1px 2px #7abfb833;transition:all .15s ease}._Tag_1o5du_1:hover{background:linear-gradient(135deg,#8ecfc8,#7abfb8);box-shadow:0 2px 4px #7abfb84d;transform:translateY(-.5px)}html.dark ._Tag_1o5du_1{background:linear-gradient(135deg,#27272a,#1f1f23);border-color:var(--border);box-shadow:0 1px 2px #0000004d}html.dark ._Tag_1o5du_1:hover{background:linear-gradient(135deg,#3f3f46,#27272a);box-shadow:0 2px 4px #0006}._pulsingText_jjwi3_1{display:inline-block;animation:_pulse_jjwi3_1 2s infinite;color:var(--text-secondary)}._urgent_jjwi3_7{color:var(--text-danger);animation:_urgentPulse_jjwi3_1 1.5s infinite}@keyframes _pulse_jjwi3_1{0%{opacity:1}50%{opacity:.6}to{opacity:1}}@keyframes _urgentPulse_jjwi3_1{0%{opacity:1}50%{opacity:.7}to{opacity:1}}
@@ -1 +0,0 @@
1
- import{a as e}from"./graph-vendor-CUxe67Lr.js";import{a4 as l}from"./index-CF5_ZCYN.js";const r=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),e.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z"}))]]),a=e.forwardRef((t,n)=>e.createElement(l,{ref:n,...t,weights:r}));a.displayName="PlusIcon";const c=a;export{c as n};
@@ -1 +0,0 @@
1
- import{j as e}from"./note-vendor-BofYbzmZ.js";import{p as s,o as i}from"./index-CF5_ZCYN.js";const l=[{label:"High",className:s.high},{label:"Medium",className:s.medium},{label:"Low",className:s.low},{label:"Overdue",className:i}],o=()=>e.jsx("div",{className:"flex flex-wrap items-center gap-3 text-xs",children:l.map(({label:a,className:r})=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:`w-3 h-3 rounded-sketchy-xs ${r}`}),e.jsx("span",{className:"text-fg-tertiary font-medium",children:a})]},a))});export{o as P};
@@ -1 +0,0 @@
1
- @keyframes _pulse_1th0h_1{0%{opacity:1}50%{opacity:.6}to{opacity:1}}@keyframes _urgentPulse_1th0h_1{0%{opacity:1}50%{opacity:.4}to{opacity:1}}@keyframes _priorityHighlight_1th0h_1{0%{transform:translate(0)}5%{transform:translate(3px)}10%{transform:translate(-3px)}15%{transform:translate(3px)}20%{transform:translate(0)}to{transform:translate(0)}}._pulsing_1th0h_43{animation:_pulse_1th0h_1 2s infinite ease-in-out}._urgentPulsing_1th0h_47{animation:_urgentPulse_1th0h_1 1s infinite ease-in-out}._priorityHigh_1th0h_51{animation:_priorityHighlight_1th0h_1 5s infinite ease-in-out;position:relative}._priorityHigh_1th0h_51:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;border-radius:inherit;box-shadow:0 0 8px #ff00004d;pointer-events:none}._priorityMedium_1th0h_67{position:relative}._priorityMedium_1th0h_67:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;border-radius:inherit;box-shadow:0 0 5px #ffa50033;pointer-events:none}
@@ -1 +0,0 @@
1
- import{j as e}from"./note-vendor-BofYbzmZ.js";import{p as j,L as R,N,B as h,d as l,P as _,Q as v,F as f,h as b,E as H,S as c,f as M,R as D}from"./index-CF5_ZCYN.js";import"./graph-vendor-CUxe67Lr.js";import{u as P,R as $}from"./useReminderMutate-CU-UinGn.js";import{P as k}from"./PriorityLegend-D61iBwNW.js";import"./note-core-BCgMq5QA.js";const S="_urgentPulsing_1th0h_47",E="_priorityHigh_1th0h_51",T="_priorityMedium_1th0h_67",x={urgentPulsing:S,priorityHigh:E,priorityMedium:T};function w({reminder:t,onUpdate:o,onDelete:m}){const g=r=>{const s=l(Number(r)),a=l();return s.isSame(a,"day")?`Today at ${s.format("HH:mm")}`:s.isSame(a.add(1,"day"),"day")?`Tomorrow at ${s.format("HH:mm")}`:s.format("YYYY-MM-DD HH:mm")},i=r=>{const s=l(Number(r)),a=l(),p=s.diff(a,"hour"),u=s.diff(a,"minute")%60;return p<0||u<0?"Overdue":p===0?`${u}m remaining`:`${p}h ${u}m remaining`},d=i(t.reminderDate)==="Overdue",n=t.priority==="high"?x.priorityHigh:t.priority==="medium"?x.priorityMedium:"";return e.jsxs("div",{className:`flex justify-between items-center p-4 border-2 rounded-[12px_4px_13px_3px/4px_10px_4px_12px] shadow-sketchy ${j[t.priority||"low"]} border-border-secondary ${n}`,children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx(R,{to:N,params:{id:String(t.note?.id??t.noteId)},className:"font-bold hover:underline flex items-center gap-2 text-fg-default",children:t.note?.title||"Untitled Note"}),t.content&&e.jsx("p",{className:"text-sm text-fg-muted mt-1 mb-1 font-medium",children:t.content}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-fg-secondary font-medium",children:g(t.reminderDate)}),e.jsx("span",{className:`text-xs font-bold ${d?`text-fg-error ${x.urgentPulsing}`:"text-fg-tertiary"}`,children:i(t.reminderDate)})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(h,{variant:"soft-success",size:"sm",onClick:()=>o(t.id,t.noteId.toString(),{completed:!0}),children:"Complete"}),e.jsx(h,{variant:"soft-danger",size:"sm",onClick:()=>m(t.id,t.noteId.toString()),children:"Delete"})]})]})}const y=M(D);function B(){const t=y.useNavigate(),{page:o}=y.useSearch(),{onUpdate:m,onDelete:g}=P(),i=25;return e.jsx(_,{title:"Reminders",description:"Manage all your note reminders in one place",headerRight:e.jsx(k,{}),children:e.jsx(v,{fallback:e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsx(c,{height:"60px"}),e.jsx(c,{height:"60px"}),e.jsx(c,{height:"60px"}),e.jsx(c,{height:"60px"})]}),errorTitle:"Failed to load reminders",errorDescription:"Retry loading the upcoming reminder list.",resetKeys:[o,i],children:e.jsx($,{searchParams:{offset:(o-1)*i,limit:i},render:({reminders:d,totalCount:n})=>e.jsxs(f,{fallback:e.jsx(H,{icon:"🔔",title:"No upcoming reminders",description:"Add reminders to your notes to see them here"}),children:[d.length>0&&e.jsx("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:d.map(r=>e.jsx(w,{reminder:r,onUpdate:m,onDelete:g},r.id))}),e.jsx(f,{fallback:null,children:n&&i<n&&e.jsx(b,{page:o,last:Math.ceil(n/i),onChange:r=>{t({search:s=>({...s,page:r})})}})})]})})})})}export{B as default};
@@ -1 +0,0 @@
1
- import{j as e}from"./note-vendor-BofYbzmZ.js";import{l as d,v as p,q as g,w as m,P as f,Q as u,F as x,L as y,x as j,h as w,E as T,S as t,f as _,y as b}from"./index-CF5_ZCYN.js";import"./graph-vendor-CUxe67Lr.js";import"./note-core-BCgMq5QA.js";const v=a=>{const{data:r}=d({queryKey:g.tags.list(a.searchParams),async queryFn(){const i=await p({offset:a.searchParams.offset,limit:a.searchParams.limit});if(i.type==="error")throw i;return i.allTags}});return a.render(r)},k=100,R=8,P=12,c=_(b);function S(){const a=c.useNavigate(),{page:r}=c.useSearch(),{containerRef:i,limit:n}=m({minItemWidth:k,gap:R,rows:P});return e.jsx(f,{title:"Tags",description:"Organize and browse notes by tags",children:e.jsx("div",{ref:i,children:e.jsx(u,{fallback:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(t,{width:"90px",height:"36px"}),e.jsx(t,{width:"120px",height:"36px"}),e.jsx(t,{width:"80px",height:"36px"}),e.jsx(t,{width:"100px",height:"36px"}),e.jsx(t,{width:"110px",height:"36px"}),e.jsx(t,{width:"70px",height:"36px"})]}),errorTitle:"Failed to load tags",errorDescription:"Retry loading the tag catalog.",resetKeys:[r,n],children:e.jsx(v,{searchParams:{offset:(r-1)*n,limit:n},render:({tags:l,totalCount:o})=>e.jsx(x,{fallback:e.jsx(T,{icon:"🤔",title:"There are no tags",description:"Try to tag some notes using <@> key."}),children:l.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(s=>e.jsx(y,{to:j,params:{id:s.id},search:{page:1},children:e.jsxs("div",{className:"bg-pastel-teal-200 dark:bg-muted px-3 py-1.5 rounded-[8px_3px_9px_2px/3px_6px_3px_7px] border-2 border-border shadow-sketchy hover:shadow-sketchy-lg hover:-translate-y-0.5 active:translate-x-0.5 active:translate-y-0.5 active:shadow-none transition-all duration-200 font-bold text-sm text-fg-default whitespace-nowrap",children:[s.name," ",e.jsxs("span",{className:"text-fg-tertiary text-xs",children:["(",s.referenceCount,")"]})]})},s.id))}),e.jsx(x,{fallback:null,children:o&&n<o&&e.jsx(w,{page:r,last:Math.ceil(o/n),onChange:s=>{a({search:h=>({...h,page:s})})}})})]})})})})})})}export{S as default};
@@ -1 +0,0 @@
1
- import{j as e}from"./note-vendor-BofYbzmZ.js";import{l as h,a2 as x,q as f,$ as p,P as y,Q as j,F as d,a3 as P,h as N,E as T,S as l,f as q,x as k}from"./index-CF5_ZCYN.js";import"./graph-vendor-CUxe67Lr.js";import"./note-core-BCgMq5QA.js";const v=a=>{const{data:i}=h({queryKey:f.notes.tagList(a.searchParams),async queryFn(){const s=await x({query:a.searchParams.query,offset:a.searchParams.offset,limit:a.searchParams.limit});if(s.type==="error")throw s;return s.tagNotes}});return a.render(i)},o=q(k);function S(){const a=o.useNavigate(),{id:i}=o.useParams(),{page:s}=o.useSearch(),r=25,{onDelete:m,onPinned:g}=p();return e.jsx(y,{title:"Tag",variant:"subtle",children:e.jsx(j,{fallback:e.jsxs("div",{className:"grid gap-6 mt-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))"},children:[e.jsx(l,{height:"112px"}),e.jsx(l,{height:"112px"}),e.jsx(l,{height:"112px"})]}),errorTitle:"Failed to load tagged notes",errorDescription:"Retry loading notes for this tag.",resetKeys:[i,s,r],children:e.jsx(v,{searchParams:{query:i,offset:(s-1)*r,limit:r},render:({notes:c,totalCount:n})=>e.jsx(d,{fallback:e.jsx(T,{icon:"🧠",title:"Ocean is calm",description:"Capture anything and make waves in the ocean!"}),children:c.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid gap-6 mt-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))"},children:c.map(t=>e.jsx(P,{...t,onPinned:()=>g(t.id,t.pinned),onDelete:()=>m(t.id)},t.id))}),e.jsx(d,{fallback:null,children:n&&r<n&&e.jsx(N,{page:s,last:Math.ceil(n/r),onChange:t=>{a({search:u=>({...u,page:t})})}})})]})})})})})}export{S as default};
@@ -1 +0,0 @@
1
- import{j as e}from"./note-vendor-BofYbzmZ.js";import{a4 as n,k as c,P as d,L as r,a5 as p,a6 as i,a7 as Z}from"./index-CF5_ZCYN.js";import{a}from"./graph-vendor-CUxe67Lr.js";import{I as h}from"./Image.es-DZ0H6wH1.js";import"./note-core-BCgMq5QA.js";const x=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M236.37,139.4a12,12,0,0,0-12-3A84.07,84.07,0,0,1,119.6,31.59a12,12,0,0,0-15-15A108.86,108.86,0,0,0,49.69,55.07,108,108,0,0,0,136,228a107.09,107.09,0,0,0,64.93-21.69,108.86,108.86,0,0,0,38.44-54.94A12,12,0,0,0,236.37,139.4Zm-49.88,47.74A84,84,0,0,1,68.86,69.51,84.93,84.93,0,0,1,92.27,48.29Q92,52.13,92,56A108.12,108.12,0,0,0,200,164q3.87,0,7.71-.27A84.79,84.79,0,0,1,186.49,187.14Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M227.89,147.89A96,96,0,1,1,108.11,28.11,96.09,96.09,0,0,0,227.89,147.89Z",opacity:"0.2"}),a.createElement("path",{d:"M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M235.54,150.21a104.84,104.84,0,0,1-37,52.91A104,104,0,0,1,32,120,103.09,103.09,0,0,1,52.88,57.48a104.84,104.84,0,0,1,52.91-37,8,8,0,0,1,10,10,88.08,88.08,0,0,0,109.8,109.8,8,8,0,0,1,10,10Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M232.13,143.64a6,6,0,0,0-6-1.49A90.07,90.07,0,0,1,113.86,29.85a6,6,0,0,0-7.49-7.48A102.88,102.88,0,0,0,54.48,58.68,102,102,0,0,0,197.32,201.52a102.88,102.88,0,0,0,36.31-51.89A6,6,0,0,0,232.13,143.64Zm-42,48.29a90,90,0,0,1-126-126A90.9,90.9,0,0,1,99.65,37.66,102.06,102.06,0,0,0,218.34,156.35,90.9,90.9,0,0,1,190.1,191.93Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M230.72,145.06a4,4,0,0,0-4-1A92.08,92.08,0,0,1,111.94,29.27a4,4,0,0,0-5-5A100.78,100.78,0,0,0,56.08,59.88a100,100,0,0,0,140,140,100.78,100.78,0,0,0,35.59-50.87A4,4,0,0,0,230.72,145.06ZM191.3,193.53A92,92,0,0,1,62.47,64.7a93,93,0,0,1,39.88-30.35,100.09,100.09,0,0,0,119.3,119.3A93,93,0,0,1,191.3,193.53Z"}))]]),A=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M116,36V20a12,12,0,0,1,24,0V36a12,12,0,0,1-24,0Zm80,92a68,68,0,1,1-68-68A68.07,68.07,0,0,1,196,128Zm-24,0a44,44,0,1,0-44,44A44.05,44.05,0,0,0,172,128ZM51.51,68.49a12,12,0,1,0,17-17l-12-12a12,12,0,0,0-17,17Zm0,119-12,12a12,12,0,0,0,17,17l12-12a12,12,0,1,0-17-17ZM196,72a12,12,0,0,0,8.49-3.51l12-12a12,12,0,0,0-17-17l-12,12A12,12,0,0,0,196,72Zm8.49,115.51a12,12,0,0,0-17,17l12,12a12,12,0,0,0,17-17ZM48,128a12,12,0,0,0-12-12H20a12,12,0,0,0,0,24H36A12,12,0,0,0,48,128Zm80,80a12,12,0,0,0-12,12v16a12,12,0,0,0,24,0V220A12,12,0,0,0,128,208Zm108-92H220a12,12,0,0,0,0,24h16a12,12,0,0,0,0-24Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z",opacity:"0.2"}),a.createElement("path",{d:"M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm8,24a64,64,0,1,0,64,64A64.07,64.07,0,0,0,128,64ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M122,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm68,88a62,62,0,1,1-62-62A62.07,62.07,0,0,1,190,128Zm-12,0a50,50,0,1,0-50,50A50.06,50.06,0,0,0,178,128ZM59.76,68.24a6,6,0,1,0,8.48-8.48l-16-16a6,6,0,0,0-8.48,8.48Zm0,119.52-16,16a6,6,0,1,0,8.48,8.48l16-16a6,6,0,1,0-8.48-8.48ZM192,70a6,6,0,0,0,4.24-1.76l16-16a6,6,0,0,0-8.48-8.48l-16,16A6,6,0,0,0,192,70Zm4.24,117.76a6,6,0,0,0-8.48,8.48l16,16a6,6,0,0,0,8.48-8.48ZM46,128a6,6,0,0,0-6-6H16a6,6,0,0,0,0,12H40A6,6,0,0,0,46,128Zm82,82a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V216A6,6,0,0,0,128,210Zm112-88H216a6,6,0,0,0,0,12h24a6,6,0,0,0,0-12Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M124,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm64,88a60,60,0,1,1-60-60A60.07,60.07,0,0,1,188,128Zm-8,0a52,52,0,1,0-52,52A52.06,52.06,0,0,0,180,128ZM61.17,66.83a4,4,0,0,0,5.66-5.66l-16-16a4,4,0,0,0-5.66,5.66Zm0,122.34-16,16a4,4,0,0,0,5.66,5.66l16-16a4,4,0,0,0-5.66-5.66ZM192,68a4,4,0,0,0,2.83-1.17l16-16a4,4,0,1,0-5.66-5.66l-16,16A4,4,0,0,0,192,68Zm2.83,121.17a4,4,0,0,0-5.66,5.66l16,16a4,4,0,0,0,5.66-5.66ZM40,124H16a4,4,0,0,0,0,8H40a4,4,0,0,0,0-8Zm88,88a4,4,0,0,0-4,4v24a4,4,0,0,0,8,0V216A4,4,0,0,0,128,212Zm112-88H216a4,4,0,0,0,0,8h24a4,4,0,0,0,0-8Z"}))]]),s=a.forwardRef((t,l)=>a.createElement(n,{ref:l,...t,weights:x}));s.displayName="MoonIcon";const g=s,m=a.forwardRef((t,l)=>a.createElement(n,{ref:l,...t,weights:A}));m.displayName="SunIcon";const M=m,_=()=>{const{theme:t,toggleTheme:l}=c(o=>o);return e.jsx(d,{title:"Settings",description:"Customize your Ocean Brain experience",children:e.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsxs("button",{type:"button",className:"flex flex-col items-center gap-3 bg-subtle p-6 rounded-[12px_4px_13px_3px/4px_10px_4px_12px] border-2 border-border-secondary font-bold hover:shadow-sketchy hover:-translate-y-0.5 active:translate-y-0 active:shadow-none transition-all",onClick:l,children:[e.jsx("span",{className:"text-3xl",children:t==="dark"?e.jsx(g,{className:"h-8 w-8 text-pastel-yellow-200",weight:"fill"}):e.jsx(M,{className:"h-8 w-8 text-pastel-orange-200",weight:"fill"})}),e.jsx("span",{children:"Theme"}),e.jsx("span",{className:"text-xs text-fg-tertiary font-medium",children:t==="dark"?"Dark mode":"Light mode"})]}),e.jsxs(r,{to:p,search:{page:1},className:"flex flex-col items-center gap-3 bg-subtle p-6 rounded-[12px_4px_13px_3px/4px_10px_4px_12px] border-2 border-border-secondary font-bold hover:shadow-sketchy hover:-translate-y-0.5 active:translate-y-0 active:shadow-none transition-all",children:[e.jsx(h,{className:"h-8 w-8 text-fg-secondary"}),e.jsx("span",{children:"Manage Image"}),e.jsx("span",{className:"text-xs text-fg-tertiary font-medium",children:"Upload and organize images"})]}),e.jsxs(r,{to:i,search:{page:1},className:"flex flex-col items-center gap-3 bg-subtle p-6 rounded-[12px_4px_13px_3px/4px_10px_4px_12px] border-2 border-border-secondary font-bold hover:shadow-sketchy hover:-translate-y-0.5 active:translate-y-0 active:shadow-none transition-all",children:[e.jsx(Z,{className:"h-8 w-8 text-fg-secondary"}),e.jsx("span",{children:"Placeholder"}),e.jsx("span",{className:"text-xs text-fg-tertiary font-medium",children:"Manage template variables"})]})]})})};export{_ as default};