ocean-brain 0.13.3 → 0.15.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 (177) hide show
  1. package/README.md +66 -2
  2. package/dist/mcp.js +439 -480
  3. package/package.json +3 -2
  4. package/server/client/dist/assets/ArrowClockwise.es-BwtKWcmj.js +1 -0
  5. package/server/client/dist/assets/{ArrowRight.es-BlNsZQFs.js → ArrowRight.es-E09Lfefr.js} +1 -1
  6. package/server/client/dist/assets/{AuxiliaryPanelHeader-HAttwVby.js → AuxiliaryPanelHeader-Bys98BJJ.js} +1 -1
  7. package/server/client/dist/assets/Calendar-BOhJYi8K.js +25 -0
  8. package/server/client/dist/assets/Callout-CAH1ua9B.js +1 -0
  9. package/server/client/dist/assets/{CaretUp.es-C8iY5OlB.js → CaretUp.es-DSWjIa-J.js} +1 -1
  10. package/server/client/dist/assets/{CheckCircle.es-Dqr3WImn.js → CheckCircle.es-Cou6rItm.js} +1 -1
  11. package/server/client/dist/assets/{Copy.es-fMv0ETir.js → Copy.es-ftEldGIL.js} +1 -1
  12. package/server/client/dist/assets/{File.es-CHtXXafR.js → File.es-DlKAX1uO.js} +1 -1
  13. package/server/client/dist/assets/{FileText.es-DPIwDCEe.js → FileText.es-D6JM_MqM.js} +1 -1
  14. package/server/client/dist/assets/{FlowArrow.es-Dxee98ir.js → FlowArrow.es-BRWXqf9A.js} +1 -1
  15. package/server/client/dist/assets/{Graph-hVj6vAYJ.js → Graph-BaqGi3M7.js} +1 -1
  16. package/server/client/dist/assets/{Graph-CdEu8eAn.js → Graph-L-d0cdMk.js} +1 -1
  17. package/server/client/dist/assets/{Image.es-CjXY1JVf.js → Image.es-Bh2mTNtr.js} +1 -1
  18. package/server/client/dist/assets/{Info.es-CYxg-Vku.js → Info.es-Bwz4CSvS.js} +1 -1
  19. package/server/client/dist/assets/Integration-C-rva2X9.js +1 -0
  20. package/server/client/dist/assets/{LinkSimple.es-B-P-7Iem.js → LinkSimple.es-iJvLf-MB.js} +1 -1
  21. package/server/client/dist/assets/Note-OO_uh2a7.js +19 -0
  22. package/server/client/dist/assets/{NotePropertiesPanel-6P7UfRBR.js → NotePropertiesPanel-BFWjxL_w.js} +1 -1
  23. package/server/client/dist/assets/{Plus.es-Dy6onD-Z.js → Plus.es-Dmb3oijD.js} +1 -1
  24. package/server/client/dist/assets/{Reminders-DnuALBL6.js → Reminders-CtpFtvu6.js} +1 -1
  25. package/server/client/dist/assets/{Search-AaD1Mt0d.js → Search-t48pkUg-.js} +2 -2
  26. package/server/client/dist/assets/{SurfaceCard-D5QxOte_.js → SurfaceCard-zdJ8k1o0.js} +1 -1
  27. package/server/client/dist/assets/{Tag-B2Qiq1Hv.js → Tag-BL2h3ZaX.js} +1 -1
  28. package/server/client/dist/assets/TagNotes-BpRTCEBf.js +1 -0
  29. package/server/client/dist/assets/Trash.es-DFnO8iF5.js +1 -0
  30. package/server/client/dist/assets/{ViewChip-BVkZAXyx.js → ViewChip-BdPhSEvG.js} +1 -1
  31. package/server/client/dist/assets/{Views-B5oh8GVM.js → Views-BoO6vgnF.js} +1 -1
  32. package/server/client/dist/assets/WarningCircle.es-BAvgGuQK.js +1 -0
  33. package/server/client/dist/assets/{abnfDiagram-N423BO3Z-D44O4T7q.js → abnfDiagram-N423BO3Z-CPgGmCbn.js} +1 -1
  34. package/server/client/dist/assets/app-OGsLwSqJ.js +151 -0
  35. package/server/client/dist/assets/app-yYMsgUrz.css +1 -0
  36. package/server/client/dist/assets/{arc-Cil9fXuW.js → arc-DqTgRpuF.js} +1 -1
  37. package/server/client/dist/assets/{architectureDiagram-T3A2C74G-Cjq6ayF2.js → architectureDiagram-T3A2C74G-rTYMAQ-J.js} +1 -1
  38. package/server/client/dist/assets/{blockDiagram-VBNYF7ZC-B2Xm5N0i.js → blockDiagram-VBNYF7ZC-BOluytVz.js} +1 -1
  39. package/server/client/dist/assets/{c4Diagram-5PPSVZJV-Dp0y-lCR.js → c4Diagram-5PPSVZJV-C8gbPpcb.js} +1 -1
  40. package/server/client/dist/assets/{calendar-data-wB0ifXdo.js → calendar-data-CwVF7Pz3.js} +1 -1
  41. package/server/client/dist/assets/channel--aI9fJWX.js +1 -0
  42. package/server/client/dist/assets/{chunk-2GRJ4B5K-CWaaNkFx.js → chunk-2GRJ4B5K-CRER5Ka0.js} +1 -1
  43. package/server/client/dist/assets/{chunk-2Q5K7J3B-Ces-xz2S.js → chunk-2Q5K7J3B-hxmJWGu_.js} +1 -1
  44. package/server/client/dist/assets/{chunk-5RXB4S5H-B-4Chlfc.js → chunk-5RXB4S5H-Bpr5Us8Y.js} +1 -1
  45. package/server/client/dist/assets/{chunk-5VM5RSS4-C8_HVwuz.js → chunk-5VM5RSS4-CKUz9fAb.js} +1 -1
  46. package/server/client/dist/assets/{chunk-6Q2QTUOP-xZ8ofRqk.js → chunk-6Q2QTUOP-B8XEOHPN.js} +1 -1
  47. package/server/client/dist/assets/{chunk-GF5L2VYU-Bpa43a7s.js → chunk-GF5L2VYU-BBUD-HJi.js} +1 -1
  48. package/server/client/dist/assets/{chunk-JWPE2WC7-DsyTXbuq.js → chunk-JWPE2WC7-Dq6_B8-d.js} +1 -1
  49. package/server/client/dist/assets/{chunk-KBJHAD2P-BDhjm9-8.js → chunk-KBJHAD2P--2VZEwNJ.js} +1 -1
  50. package/server/client/dist/assets/{chunk-RYQCIY6F-Cn-jdp6I.js → chunk-RYQCIY6F-CKCwnKiC.js} +1 -1
  51. package/server/client/dist/assets/{chunk-XXDRQBXY-BKsc_0wh.js → chunk-XXDRQBXY-VDufR1Oi.js} +1 -1
  52. package/server/client/dist/assets/classDiagram-JCYQIIEL-BsbwE38V.js +1 -0
  53. package/server/client/dist/assets/classDiagram-v2-OCEON4UE-BsbwE38V.js +1 -0
  54. package/server/client/dist/assets/{cose-bilkent-JH36ORCC-jmn3Q4zj.js → cose-bilkent-JH36ORCC-D4nqOx8S.js} +1 -1
  55. package/server/client/dist/assets/{cynefinDiagram-MW4NZA55-BpLstuBJ.js → cynefinDiagram-MW4NZA55-CUuLMs-6.js} +1 -1
  56. package/server/client/dist/assets/{dagre-VZM6K2ZE-B5ft5Yzm.js → dagre-VZM6K2ZE-CUSkhZgS.js} +1 -1
  57. package/server/client/dist/assets/{diagram-7IWD3JNH-B_W9IsWZ.js → diagram-7IWD3JNH-D95eVcKx.js} +4 -4
  58. package/server/client/dist/assets/{diagram-B4RE2ZJO-32chS3GX.js → diagram-B4RE2ZJO-7OH_fb0K.js} +1 -1
  59. package/server/client/dist/assets/{diagram-LBJQPF4R-Bqupdb3-.js → diagram-LBJQPF4R-D9UwEIMd.js} +1 -1
  60. package/server/client/dist/assets/{diagram-Q27KOJAE-BD8jKBsv.js → diagram-Q27KOJAE-Dx7WFDuX.js} +1 -1
  61. package/server/client/dist/assets/{diagram-UB23O5K3-C40jAU8D.js → diagram-UB23O5K3-D2BYwAKT.js} +1 -1
  62. package/server/client/dist/assets/{ebnfDiagram-BXEA7PRR-BQfW9mFA.js → ebnfDiagram-BXEA7PRR-DbeA-fk4.js} +1 -1
  63. package/server/client/dist/assets/{erDiagram-JOGREHBK-ILZnLzz2.js → erDiagram-JOGREHBK-jWW-ICGO.js} +1 -1
  64. package/server/client/dist/assets/{flowDiagram-UKHOOZJN-CDmwr2dI.js → flowDiagram-UKHOOZJN-68iZdxxw.js} +1 -1
  65. package/server/client/dist/assets/{ganttDiagram-PKOTCBZU-DBcrUc49.js → ganttDiagram-PKOTCBZU-CxwY3VXg.js} +1 -1
  66. package/server/client/dist/assets/{gitGraphDiagram-DS77QQ5N-_xO6__FK.js → gitGraphDiagram-DS77QQ5N-Ci6o5MfZ.js} +1 -1
  67. package/server/client/dist/assets/{image.api-ChvlfuZg.js → image.api-CHuhmq_G.js} +1 -1
  68. package/server/client/dist/assets/index-CuCzOHJ6.js +1 -0
  69. package/server/client/dist/assets/{infoDiagram-6WML65LV-CuIIcu-L.js → infoDiagram-6WML65LV-DY7aMdjV.js} +1 -1
  70. package/server/client/dist/assets/integrations-B5SIEnG_.js +1 -0
  71. package/server/client/dist/assets/{ishikawaDiagram-WSZJBQD7-BVtRGTOj.js → ishikawaDiagram-WSZJBQD7-Bh5qKh1d.js} +1 -1
  72. package/server/client/dist/assets/{journeyDiagram-NVQOT4AX-D5-Nzb2N.js → journeyDiagram-NVQOT4AX-B_svXTTT.js} +1 -1
  73. package/server/client/dist/assets/{kanban-definition-27J2QSJJ-DmOhgC8H.js → kanban-definition-27J2QSJJ-CaJslHGg.js} +1 -1
  74. package/server/client/dist/assets/manage-image-Kd-7IGfB.js +1 -0
  75. package/server/client/dist/assets/{manage-image-detail-Dw3tAW3h.js → manage-image-detail-HU0QLP-t.js} +1 -1
  76. package/server/client/dist/assets/mcp-BQ418pyx.js +5 -0
  77. package/server/client/dist/assets/{mcp-admin-adapter-D0R8p9az.js → mcp-admin-adapter-CUakQ_Xm.js} +1 -1
  78. package/server/client/dist/assets/{mermaid.core-C2tL9tq7.js → mermaid.core-BfUQM5vF.js} +4 -4
  79. package/server/client/dist/assets/{mindmap-definition-FAOFIHXS-DuvsPqrh.js → mindmap-definition-FAOFIHXS-DGbkJda2.js} +1 -1
  80. package/server/client/dist/assets/{note-core-YhYEmI_R.js → note-core-DRBsBf9H.js} +9 -9
  81. package/server/client/dist/assets/{note-runtime-B3ats-dC.js → note-runtime-ztZvXRIu.js} +16 -16
  82. package/server/client/dist/assets/{note-ui-BtzPk8gA.js → note-ui-CRcP5BjO.js} +1 -1
  83. package/server/client/dist/assets/{pegDiagram-VL7TDLO6-D64crEZV.js → pegDiagram-VL7TDLO6-Bip6zQct.js} +1 -1
  84. package/server/client/dist/assets/{pieDiagram-7S7Q4E2Y--kl7vopC.js → pieDiagram-7S7Q4E2Y-CjfjGY8Y.js} +1 -1
  85. package/server/client/dist/assets/{placeholder-B5uPsE7-.js → placeholder-D7JKnpuh.js} +1 -1
  86. package/server/client/dist/assets/{properties-B7Fv95qY.js → properties-CtagYHMr.js} +1 -1
  87. package/server/client/dist/assets/{quadrantDiagram-CIZ2JOQS-DuvJ4M2y.js → quadrantDiagram-CIZ2JOQS-B6F1yUT-.js} +1 -1
  88. package/server/client/dist/assets/{railroadDiagram-AXF67PYL-BMKmCOY7.js → railroadDiagram-AXF67PYL-D-0fLe0F.js} +1 -1
  89. package/server/client/dist/assets/{requirementDiagram-LRYGKXZP-DY1eJcy0.js → requirementDiagram-LRYGKXZP-tm4mnCyJ.js} +1 -1
  90. package/server/client/dist/assets/route-preload.js +2 -2
  91. package/server/client/dist/assets/{sankeyDiagram-W5VNT64P-C3Ka4GKM.js → sankeyDiagram-W5VNT64P-DSBWFurb.js} +1 -1
  92. package/server/client/dist/assets/search-B5tCkhwj.js +1 -0
  93. package/server/client/dist/assets/{search-admin-adapter-Daf7e2YQ.js → search-admin-adapter-Be9xSY88.js} +1 -1
  94. package/server/client/dist/assets/{sequenceDiagram-SI44F4Z6-Bhpwtk2s.js → sequenceDiagram-SI44F4Z6-KrwjjJIV.js} +1 -1
  95. package/server/client/dist/assets/{sizeCapture-X5ZJPWSS-BFta71TW.js → sizeCapture-X5ZJPWSS-DL2cn_Q6.js} +1 -1
  96. package/server/client/dist/assets/{stateDiagram-OKZ733FA-D6GCn1io.js → stateDiagram-OKZ733FA-CKuNDH85.js} +1 -1
  97. package/server/client/dist/assets/{stateDiagram-v2-UEYNNEHI-g4yinGDn.js → stateDiagram-v2-UEYNNEHI-BFaj2wbM.js} +1 -1
  98. package/server/client/dist/assets/{swimlanes-SLNWSIFB-DLFvOjUl.js → swimlanes-SLNWSIFB-5S17nqhK.js} +2 -2
  99. package/server/client/dist/assets/swimlanesDiagram-ULZ7WXOC-dexsHJq2.js +8 -0
  100. package/server/client/dist/assets/{tag.api-DEUROVKQ.js → tag.api-DGfi8hWL.js} +1 -1
  101. package/server/client/dist/assets/time-Kh6oav5R.js +361 -0
  102. package/server/client/dist/assets/{timeline-definition-Z64GVDOM-DTSIekSM.js → timeline-definition-Z64GVDOM-CU1hp_7d.js} +3 -3
  103. package/server/client/dist/assets/{trash-BHida7BG.js → trash-Di2BWyUO.js} +1 -1
  104. package/server/client/dist/assets/url-Bp8sXMb4.js +1 -0
  105. package/server/client/dist/assets/{useNoteMutate-BjvZUmtX.js → useNoteMutate-BQj6jHhV.js} +3 -3
  106. package/server/client/dist/assets/{useReminderMutate-C5n-5LM-.js → useReminderMutate-jubqwSD9.js} +1 -1
  107. package/server/client/dist/assets/{vennDiagram-T6HMQDX7-CMNqSI2X.js → vennDiagram-T6HMQDX7-MoiVLnil.js} +1 -1
  108. package/server/client/dist/assets/{wardleyDiagram-T6FBY63Y-DV-JOYqB.js → wardleyDiagram-T6FBY63Y-cZkfdI6C.js} +1 -1
  109. package/server/client/dist/assets/{xychartDiagram-ELKLHX3M-BUIniF4m.js → xychartDiagram-ELKLHX3M-B63hxD-r.js} +1 -1
  110. package/server/client/dist/index.html +6 -6
  111. package/server/dist/app.js +11 -1
  112. package/server/dist/features/app-gateway/access.js +73 -0
  113. package/server/dist/features/app-gateway/database.js +20 -0
  114. package/server/dist/features/app-gateway/gateway.js +208 -0
  115. package/server/dist/features/integration/access-events.js +17 -0
  116. package/server/dist/features/integration/auth.js +21 -0
  117. package/server/dist/features/integration/manifest.js +116 -0
  118. package/server/dist/features/integration/note-sync.js +156 -0
  119. package/server/dist/features/integration/schema.js +54 -0
  120. package/server/dist/features/integration/service.js +246 -0
  121. package/server/dist/features/integration/status-report.js +22 -0
  122. package/server/dist/features/mcp-admin/service.js +19 -83
  123. package/server/dist/features/note/graphql/note.field.resolver.js +1 -1
  124. package/server/dist/features/note/graphql/note.mutation.resolver.js +20 -12
  125. package/server/dist/features/note/graphql/note.query.resolver.js +10 -1
  126. package/server/dist/features/note/graphql/note.type-defs.js +13 -1
  127. package/server/dist/features/note/http/authoring.js +493 -0
  128. package/server/dist/features/note/http/mcp.js +15 -463
  129. package/server/dist/features/note/services/authoring.js +17 -1
  130. package/server/dist/features/note/services/change-events.js +26 -0
  131. package/server/dist/features/note/services/markdown-intent-write.js +1 -0
  132. package/server/dist/features/note/services/markdown-read.js +85 -0
  133. package/server/dist/features/note/services/properties.js +36 -30
  134. package/server/dist/features/note/services/search.js +17 -0
  135. package/server/dist/features/search/graphql/resolver.js +10 -1
  136. package/server/dist/features/search/graphql/type-defs.js +3 -0
  137. package/server/dist/features/search/search-manager.js +4 -7
  138. package/server/dist/features/tag/graphql/tag.query.resolver.js +10 -0
  139. package/server/dist/features/tag/graphql/tag.type-defs.js +1 -0
  140. package/server/dist/features/view/graphql/mcp.query.resolver.js +22 -0
  141. package/server/dist/features/view/graphql/view.query.resolver.js +2 -0
  142. package/server/dist/features/view/graphql/view.type-defs.js +27 -0
  143. package/server/dist/features/view/services/mcp-read.js +142 -0
  144. package/server/dist/features/view/services/workspace.js +12 -4
  145. package/server/dist/modules/auth-guard.js +24 -1
  146. package/server/dist/modules/integration-token.js +27 -0
  147. package/server/dist/modules/mcp-auth.js +37 -23
  148. package/server/dist/modules/mcp-token.js +6 -25
  149. package/server/dist/modules/server-events.js +3 -0
  150. package/server/dist/routes/api.js +2 -0
  151. package/server/dist/routes/apps.js +163 -0
  152. package/server/dist/routes/graphql.js +2 -1
  153. package/server/dist/routes/index.js +2 -0
  154. package/server/dist/routes/integrations.js +137 -0
  155. package/server/dist/routes/mcp.js +29 -9
  156. package/server/prisma/migrations/20260917120000_0020_plugin_installations/migration.sql +39 -0
  157. package/server/prisma/migrations/20260917150000_0021_integration_connections/migration.sql +29 -0
  158. package/server/prisma/migrations/20260919090000_0022_integration_proxy_url/migration.sql +2 -0
  159. package/server/prisma/schema.prisma +36 -10
  160. package/server/client/dist/assets/Calendar-DwQBllfw.js +0 -25
  161. package/server/client/dist/assets/Callout-CcYyvHQP.js +0 -1
  162. package/server/client/dist/assets/Note-CpzLtGVM.js +0 -19
  163. package/server/client/dist/assets/TagNotes-B27G1ZVg.js +0 -1
  164. package/server/client/dist/assets/Trash.es-XEcWG_aq.js +0 -1
  165. package/server/client/dist/assets/app-EwvT7bMw.css +0 -1
  166. package/server/client/dist/assets/app-NgiBDISG.js +0 -151
  167. package/server/client/dist/assets/channel-DZFalh-h.js +0 -1
  168. package/server/client/dist/assets/classDiagram-JCYQIIEL-CkEhFvVV.js +0 -1
  169. package/server/client/dist/assets/classDiagram-v2-OCEON4UE-CkEhFvVV.js +0 -1
  170. package/server/client/dist/assets/index-CIEap4bu.js +0 -1
  171. package/server/client/dist/assets/manage-image-CSJ3Flgc.js +0 -1
  172. package/server/client/dist/assets/mcp-D8footel.js +0 -5
  173. package/server/client/dist/assets/search-ddYl3qH-.js +0 -1
  174. package/server/client/dist/assets/swimlanesDiagram-ULZ7WXOC-Ci4mcvmo.js +0 -8
  175. package/server/client/dist/assets/time-PxWila4-.js +0 -361
  176. package/server/client/dist/assets/url-DKUMNVCI.js +0 -1
  177. package/server/dist/features/search/note-change.js +0 -16
@@ -1 +1 @@
1
- import{r as s,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{A as V,K,T as m,D as k,N as Y,P as G,Q,a as W,b as I,x as J,y as C,h as X,i as F,q as $,E as q,B,k as ee,l as M}from"./time-PxWila4-.js";import{h as te,d as w,u as ae}from"./useNoteMutate-BjvZUmtX.js";import{u as re,R as se,f as ne,a as oe}from"./useReminderMutate-C5n-5LM-.js";import{N as L,R as ie}from"./url-DKUMNVCI.js";import{s as le}from"./ArrowRight.es-BlNsZQFs.js";const de=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M112,56V200L40,128Z",opacity:"0.2"}),s.createElement("path",{d:"M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z"}))]]),P=s.forwardRef((t,a)=>s.createElement(V,{ref:a,...t,weights:de}));P.displayName="ArrowLeftIcon";const ce=P,me={high:"bg-priority-high",medium:"bg-priority-medium",low:"bg-priority-low"};function pe({reminder:t,onUpdate:a,onDelete:r,onEdit:n}){const d=E=>{const v=w(Number(E)),b=w();return v.isSame(b,"day")?`Today at ${v.format("HH:mm")}`:v.isSame(b.add(1,"day"),"day")?`Tomorrow at ${v.format("HH:mm")}`:v.format("YYYY-MM-DD HH:mm")},i=E=>{const v=w(Number(E)),b=w(),O=v.diff(b,"hour"),T=v.diff(b,"minute")%60;return O<0||T<0?"Overdue":O===0?`${T}m remaining`:`${O}h ${T}m remaining`},x=t.completed?"Completed":i(t.reminderDate),p=x==="Overdue",h=t.priority||"low",g=h==="high"?"High":h==="medium"?"Medium":"Low",l=me[h],u=t.noteId.toString(),j=p?"text-fg-error":"text-fg-tertiary",f=t.content?.trim(),y=f||t.note?.title||"Untitled reminder",o=t.note?.title||"Untitled note",c=!!(f&&t.note?.title),R=d(t.reminderDate),H=[...!t.completed&&n?[{name:"Edit",onClick:()=>n(t)}]:[],...t.completed?[{name:"Reopen",onClick:()=>a(t.id,u,{completed:!1})}]:[]],U=[...H,...H.length>0?[{type:"separator",key:"destructive-actions"}]:[],{name:"Delete",onClick:()=>r(t.id,u)}];return e.jsxs("div",{className:"surface-base grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-2.5 gap-y-2 px-4 py-3 sm:grid-cols-[auto_minmax(0,1fr)_auto_auto] sm:items-center sm:gap-x-4 sm:gap-y-0",children:[e.jsx(K,{checked:t.completed,onChange:()=>a(t.id,u,{completed:!t.completed}),size:"sm","aria-label":`${t.completed?"Reopen":"Complete"} reminder: ${y}`}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(m,{as:"p",variant:"body",weight:"semibold",className:t.completed?"truncate text-fg-tertiary line-through":"truncate",children:!f&&t.note?e.jsx(k,{to:L,params:{id:String(t.note.id)},className:"transition-colors hover:text-fg-default hover:underline",children:y}):y}),c&&e.jsx(m,{as:"div",variant:"meta",tone:"secondary",className:t.completed?"mt-0.5 truncate text-fg-tertiary":"mt-0.5 truncate",children:e.jsx(k,{to:L,params:{id:String(t.note?.id??t.noteId)},className:"transition-colors hover:text-fg-default hover:underline",children:o})})]}),e.jsxs("div",{className:"col-start-2 row-start-2 flex flex-wrap items-center gap-x-2 gap-y-1 sm:col-start-auto sm:row-start-auto sm:shrink-0",children:[e.jsx("span",{className:`h-3 w-3 shrink-0 rounded-full border border-border-subtle ${l}`,"aria-label":`${g} priority`,title:`${g} priority`}),e.jsx(m,{as:"span",variant:"meta",weight:"medium",tone:"secondary",className:t.completed?"text-fg-tertiary":void 0,children:R}),e.jsx("span",{className:"h-1 w-1 rounded-full bg-border-secondary"}),e.jsx(m,{as:"span",variant:"label",weight:"medium",className:t.completed?"text-accent-success":j,children:x})]}),e.jsx("div",{className:"col-start-3 row-start-1 flex items-center justify-end gap-1.5 sm:col-start-auto sm:row-start-auto sm:shrink-0",children:e.jsx(Y,{button:e.jsx(te,{label:"Reminder actions",iconClassName:"h-5 w-5 text-current"}),items:U})})]})}const A=X(ie),D=25,_=5,Z={overdue:{title:"Overdue",description:"Recently missed reminders that still need a decision.",empty:"Nothing overdue"},today:{title:"Today",description:"Open reminders due before the day ends.",empty:"Nothing else due today"},upcoming:{title:"Upcoming",description:"Reminders scheduled after today.",empty:"Nothing upcoming"}},N=t=>t==="all"?void 0:t,ue=(t,a,r)=>{const n={status:"open",...N(a)?{priority:N(a)}:{},sortBy:"reminderDate"};return t==="overdue"?{...n,end:r.now,sortOrder:"desc"}:t==="today"?{...n,start:r.now,end:r.tomorrow,sortOrder:"asc"}:{...n,start:r.tomorrow,sortOrder:"asc"}};function he(){return e.jsxs("div",{role:"status","aria-label":"Loading reminders",className:"flex flex-col gap-2.5",children:[e.jsx(M,{height:"72px"}),e.jsx(M,{height:"72px"}),e.jsx(M,{height:"72px"})]})}function z({reminders:t,actions:a}){return e.jsx("div",{className:"flex flex-col gap-2.5",children:t.map(r=>e.jsx(pe,{reminder:r,onUpdate:a.onUpdate,onDelete:a.onDelete,onEdit:a.onEdit},r.id))})}function S({scope:t,collection:a,actions:r,onViewAll:n}){const d=Z[t],i=`reminder-${t}-heading`;return e.jsxs("section",{"aria-labelledby":i,className:"border-b border-border-subtle pb-5 last:border-b-0 last:pb-0",children:[e.jsxs("div",{className:"mb-3 flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{as:"h2",id:i,variant:"body",weight:"bold",children:d.title}),e.jsx(m,{as:"span",variant:"label",weight:"semibold",tone:"tertiary",className:"rounded-full bg-hover-subtle px-2 py-0.5",children:a.totalCount})]}),e.jsx(m,{as:"p",variant:"meta",tone:"tertiary",className:"mt-0.5",children:d.description})]}),a.totalCount>_?e.jsxs(B,{type:"button",variant:"ghost",size:"sm",onClick:()=>n(t),children:["View all",e.jsx(le,{className:"size-3.5","aria-hidden":"true"})]}):null]}),a.reminders.length>0?e.jsx(z,{reminders:a.reminders,actions:r}):e.jsx("div",{className:"rounded-[16px] border border-dashed border-border-subtle px-4 py-4",children:e.jsx(m,{as:"p",variant:"meta",weight:"medium",tone:"tertiary",children:d.empty})})]})}function ge({priority:t,boundaries:a,actions:r,onViewAll:n}){const d={now:a.now,tomorrow:a.tomorrow,priority:N(t),limit:_},{data:i}=F({queryKey:$.reminders.overview(d),queryFn:async()=>{const p=await ne(d);if(p.type==="error")throw p;return{overdue:p.overdue,today:p.today,upcoming:p.upcoming}}});return i.overdue.totalCount+i.today.totalCount+i.upcoming.totalCount===0?e.jsx(q,{title:"No open reminders",description:t==="all"?"Add a reminder inside any note to see it here.":"Try another priority or add a matching reminder."}):e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsx(S,{scope:"overdue",collection:i.overdue,actions:r,onViewAll:n}),e.jsx(S,{scope:"today",collection:i.today,actions:r,onViewAll:n}),e.jsx(S,{scope:"upcoming",collection:i.upcoming,actions:r,onViewAll:n})]})}function xe({status:t,scope:a,priority:r,page:n,boundaries:d,actions:i,onPageChange:x,onBackToOverview:p}){const g={filter:t==="completed"?{status:"completed",...N(r)?{priority:N(r)}:{},sortBy:"updatedAt",sortOrder:"desc"}:ue(a,r,d),limit:D,offset:(n-1)*D},{data:l}=F({queryKey:$.reminders.list(g),queryFn:async()=>{const y=await oe(g);if(y.type==="error")throw y;return y.reminders}}),u=Math.max(1,Math.ceil(l.totalCount/D));s.useEffect(()=>{n>u&&x(u)},[u,x,n]);const j=t==="completed"?null:Z[a],f=t==="completed"?"Completed":j?.title??"Open reminders";return e.jsxs("section",{"aria-labelledby":"reminder-list-heading",children:[e.jsxs("div",{className:"mb-3 flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{children:[t==="open"?e.jsxs(B,{type:"button",variant:"ghost",size:"sm",className:"-ml-3 mb-1",onClick:p,children:[e.jsx(ce,{className:"size-3.5","aria-hidden":"true"}),"All open reminders"]}):null,e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{as:"h2",id:"reminder-list-heading",variant:"body",weight:"bold",children:f}),e.jsx(m,{as:"span",variant:"label",weight:"semibold",tone:"tertiary",className:"rounded-full bg-hover-subtle px-2 py-0.5",children:l.totalCount})]}),e.jsx(m,{as:"p",variant:"meta",tone:"tertiary",className:"mt-0.5",children:t==="completed"?"Completed reminders can be reopened or permanently deleted.":j?.description})]}),l.totalCount>0?e.jsxs(m,{as:"span",variant:"label",tone:"tertiary",children:[Math.min(g.offset+1,l.totalCount),"–",Math.min(g.offset+l.reminders.length,l.totalCount)," of ",l.totalCount]}):null]}),l.reminders.length>0?e.jsxs(e.Fragment,{children:[e.jsx(z,{reminders:l.reminders,actions:i}),u>1?e.jsx(ee,{page:n,last:u,onChange:x}):null]}):e.jsx(q,{title:t==="completed"?"No completed reminders":j?.empty,description:r==="all"?"There is nothing to manage in this list yet.":"Try another priority to see more reminders."})]})}function Ne(){const t=A.useNavigate(),{status:a,scope:r,priority:n,page:d}=A.useSearch(),{onUpdate:i,onDelete:x}=re(),p=ae(),[h,g]=s.useState(),[l]=s.useState(()=>{const o=w();return{now:o.toISOString(),tomorrow:o.add(1,"day").startOf("day").toISOString()}}),u=o=>{t({search:c=>({...c,page:o})})},f={onUpdate:i,onDelete:async(o,c)=>{await p("Delete this reminder? This cannot be undone.")&&await x(o,c)},onEdit:g},y=e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(W,{type:"single",variant:"quiet",size:"sm",value:a,onValueChange:o=>{o&&t({search:c=>({...c,status:o,scope:"all",page:1})})},children:[e.jsx(I,{value:"open",children:"Open"}),e.jsx(I,{value:"completed",children:"Completed"})]}),e.jsxs(J,{value:n,size:"sm",ariaLabel:"Filter reminders by priority",className:"w-[148px]",onValueChange:o=>{t({search:c=>({...c,priority:o,page:1})})},children:[e.jsx(C,{value:"all",children:"All priorities"}),e.jsx(C,{value:"high",children:"High priority"}),e.jsx(C,{value:"medium",children:"Medium priority"}),e.jsx(C,{value:"low",children:"Low priority"})]})]});return e.jsxs(e.Fragment,{children:[e.jsx(G,{title:"Reminders",description:a==="completed"?"Review completed reminders and reopen anything that still needs attention.":"Act on what is overdue, due today, and coming next.",headerRight:y,children:e.jsx(Q,{fallback:e.jsx(he,{}),errorTitle:"Failed to load reminders",errorDescription:"Retry loading the reminder workspace.",resetKeys:[a,r,n,d,l.now],children:a==="open"&&r==="all"?e.jsx(ge,{priority:n,boundaries:l,actions:f,onViewAll:o=>{t({search:c=>({...c,scope:o,page:1})})}}):e.jsx(xe,{status:a,scope:r,priority:n,page:d,boundaries:l,actions:f,onPageChange:u,onBackToOverview:()=>{t({search:o=>({...o,scope:"all",page:1})})}})})}),e.jsx(se,{isOpen:!!h,mode:"edit",reminder:h,onClose:()=>g(void 0),onSave:(o,c,R)=>{h&&i(h.id,String(h.noteId),{reminderDate:o,priority:c,content:R})}})]})}export{Ne as default};
1
+ import{r as n,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{C as V,K,T as m,F as k,N as Y,P as G,Q,a as W,b as I,h as J,i as C,k as X,l as F,q as $,E as q,B,n as ee,o as M}from"./time-Kh6oav5R.js";import{h as te,d as w,u as ae}from"./useNoteMutate-BQj6jHhV.js";import{u as re,R as ne,f as se,a as oe}from"./useReminderMutate-jubqwSD9.js";import{N as L,R as ie}from"./url-Bp8sXMb4.js";import{s as le}from"./ArrowRight.es-E09Lfefr.js";const de=new Map([["bold",n.createElement(n.Fragment,null,n.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z"}))],["duotone",n.createElement(n.Fragment,null,n.createElement("path",{d:"M112,56V200L40,128Z",opacity:"0.2"}),n.createElement("path",{d:"M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z"}))],["fill",n.createElement(n.Fragment,null,n.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z"}))],["light",n.createElement(n.Fragment,null,n.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z"}))],["regular",n.createElement(n.Fragment,null,n.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"}))],["thin",n.createElement(n.Fragment,null,n.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z"}))]]),P=n.forwardRef((t,a)=>n.createElement(V,{ref:a,...t,weights:de}));P.displayName="ArrowLeftIcon";const ce=P,me={high:"bg-priority-high",medium:"bg-priority-medium",low:"bg-priority-low"};function pe({reminder:t,onUpdate:a,onDelete:r,onEdit:s}){const d=E=>{const v=w(Number(E)),b=w();return v.isSame(b,"day")?`Today at ${v.format("HH:mm")}`:v.isSame(b.add(1,"day"),"day")?`Tomorrow at ${v.format("HH:mm")}`:v.format("YYYY-MM-DD HH:mm")},i=E=>{const v=w(Number(E)),b=w(),O=v.diff(b,"hour"),T=v.diff(b,"minute")%60;return O<0||T<0?"Overdue":O===0?`${T}m remaining`:`${O}h ${T}m remaining`},x=t.completed?"Completed":i(t.reminderDate),p=x==="Overdue",h=t.priority||"low",g=h==="high"?"High":h==="medium"?"Medium":"Low",l=me[h],u=t.noteId.toString(),j=p?"text-fg-error":"text-fg-tertiary",f=t.content?.trim(),y=f||t.note?.title||"Untitled reminder",o=t.note?.title||"Untitled note",c=!!(f&&t.note?.title),R=d(t.reminderDate),H=[...!t.completed&&s?[{name:"Edit",onClick:()=>s(t)}]:[],...t.completed?[{name:"Reopen",onClick:()=>a(t.id,u,{completed:!1})}]:[]],U=[...H,...H.length>0?[{type:"separator",key:"destructive-actions"}]:[],{name:"Delete",onClick:()=>r(t.id,u)}];return e.jsxs("div",{className:"surface-base grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-2.5 gap-y-2 px-4 py-3 sm:grid-cols-[auto_minmax(0,1fr)_auto_auto] sm:items-center sm:gap-x-4 sm:gap-y-0",children:[e.jsx(K,{checked:t.completed,onChange:()=>a(t.id,u,{completed:!t.completed}),size:"sm","aria-label":`${t.completed?"Reopen":"Complete"} reminder: ${y}`}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(m,{as:"p",variant:"body",weight:"semibold",className:t.completed?"truncate text-fg-tertiary line-through":"truncate",children:!f&&t.note?e.jsx(k,{to:L,params:{id:String(t.note.id)},className:"transition-colors hover:text-fg-default hover:underline",children:y}):y}),c&&e.jsx(m,{as:"div",variant:"meta",tone:"secondary",className:t.completed?"mt-0.5 truncate text-fg-tertiary":"mt-0.5 truncate",children:e.jsx(k,{to:L,params:{id:String(t.note?.id??t.noteId)},className:"transition-colors hover:text-fg-default hover:underline",children:o})})]}),e.jsxs("div",{className:"col-start-2 row-start-2 flex flex-wrap items-center gap-x-2 gap-y-1 sm:col-start-auto sm:row-start-auto sm:shrink-0",children:[e.jsx("span",{className:`h-3 w-3 shrink-0 rounded-full border border-border-subtle ${l}`,"aria-label":`${g} priority`,title:`${g} priority`}),e.jsx(m,{as:"span",variant:"meta",weight:"medium",tone:"secondary",className:t.completed?"text-fg-tertiary":void 0,children:R}),e.jsx("span",{className:"h-1 w-1 rounded-full bg-border-secondary"}),e.jsx(m,{as:"span",variant:"label",weight:"medium",className:t.completed?"text-accent-success":j,children:x})]}),e.jsx("div",{className:"col-start-3 row-start-1 flex items-center justify-end gap-1.5 sm:col-start-auto sm:row-start-auto sm:shrink-0",children:e.jsx(Y,{button:e.jsx(te,{label:"Reminder actions",iconClassName:"h-5 w-5 text-current"}),items:U})})]})}const A=X(ie),S=25,_=5,Z={overdue:{title:"Overdue",description:"Recently missed reminders that still need a decision.",empty:"Nothing overdue"},today:{title:"Today",description:"Open reminders due before the day ends.",empty:"Nothing else due today"},upcoming:{title:"Upcoming",description:"Reminders scheduled after today.",empty:"Nothing upcoming"}},N=t=>t==="all"?void 0:t,ue=(t,a,r)=>{const s={status:"open",...N(a)?{priority:N(a)}:{},sortBy:"reminderDate"};return t==="overdue"?{...s,end:r.now,sortOrder:"desc"}:t==="today"?{...s,start:r.now,end:r.tomorrow,sortOrder:"asc"}:{...s,start:r.tomorrow,sortOrder:"asc"}};function he(){return e.jsxs("div",{role:"status","aria-label":"Loading reminders",className:"flex flex-col gap-2.5",children:[e.jsx(M,{height:"72px"}),e.jsx(M,{height:"72px"}),e.jsx(M,{height:"72px"})]})}function z({reminders:t,actions:a}){return e.jsx("div",{className:"flex flex-col gap-2.5",children:t.map(r=>e.jsx(pe,{reminder:r,onUpdate:a.onUpdate,onDelete:a.onDelete,onEdit:a.onEdit},r.id))})}function D({scope:t,collection:a,actions:r,onViewAll:s}){const d=Z[t],i=`reminder-${t}-heading`;return e.jsxs("section",{"aria-labelledby":i,className:"border-b border-border-subtle pb-5 last:border-b-0 last:pb-0",children:[e.jsxs("div",{className:"mb-3 flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{as:"h2",id:i,variant:"body",weight:"bold",children:d.title}),e.jsx(m,{as:"span",variant:"label",weight:"semibold",tone:"tertiary",className:"rounded-full bg-hover-subtle px-2 py-0.5",children:a.totalCount})]}),e.jsx(m,{as:"p",variant:"meta",tone:"tertiary",className:"mt-0.5",children:d.description})]}),a.totalCount>_?e.jsxs(B,{type:"button",variant:"ghost",size:"sm",onClick:()=>s(t),children:["View all",e.jsx(le,{className:"size-3.5","aria-hidden":"true"})]}):null]}),a.reminders.length>0?e.jsx(z,{reminders:a.reminders,actions:r}):e.jsx("div",{className:"rounded-[16px] border border-dashed border-border-subtle px-4 py-4",children:e.jsx(m,{as:"p",variant:"meta",weight:"medium",tone:"tertiary",children:d.empty})})]})}function ge({priority:t,boundaries:a,actions:r,onViewAll:s}){const d={now:a.now,tomorrow:a.tomorrow,priority:N(t),limit:_},{data:i}=F({queryKey:$.reminders.overview(d),queryFn:async()=>{const p=await se(d);if(p.type==="error")throw p;return{overdue:p.overdue,today:p.today,upcoming:p.upcoming}}});return i.overdue.totalCount+i.today.totalCount+i.upcoming.totalCount===0?e.jsx(q,{title:"No open reminders",description:t==="all"?"Add a reminder inside any note to see it here.":"Try another priority or add a matching reminder."}):e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsx(D,{scope:"overdue",collection:i.overdue,actions:r,onViewAll:s}),e.jsx(D,{scope:"today",collection:i.today,actions:r,onViewAll:s}),e.jsx(D,{scope:"upcoming",collection:i.upcoming,actions:r,onViewAll:s})]})}function xe({status:t,scope:a,priority:r,page:s,boundaries:d,actions:i,onPageChange:x,onBackToOverview:p}){const g={filter:t==="completed"?{status:"completed",...N(r)?{priority:N(r)}:{},sortBy:"updatedAt",sortOrder:"desc"}:ue(a,r,d),limit:S,offset:(s-1)*S},{data:l}=F({queryKey:$.reminders.list(g),queryFn:async()=>{const y=await oe(g);if(y.type==="error")throw y;return y.reminders}}),u=Math.max(1,Math.ceil(l.totalCount/S));n.useEffect(()=>{s>u&&x(u)},[u,x,s]);const j=t==="completed"?null:Z[a],f=t==="completed"?"Completed":j?.title??"Open reminders";return e.jsxs("section",{"aria-labelledby":"reminder-list-heading",children:[e.jsxs("div",{className:"mb-3 flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{children:[t==="open"?e.jsxs(B,{type:"button",variant:"ghost",size:"sm",className:"-ml-3 mb-1",onClick:p,children:[e.jsx(ce,{className:"size-3.5","aria-hidden":"true"}),"All open reminders"]}):null,e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{as:"h2",id:"reminder-list-heading",variant:"body",weight:"bold",children:f}),e.jsx(m,{as:"span",variant:"label",weight:"semibold",tone:"tertiary",className:"rounded-full bg-hover-subtle px-2 py-0.5",children:l.totalCount})]}),e.jsx(m,{as:"p",variant:"meta",tone:"tertiary",className:"mt-0.5",children:t==="completed"?"Completed reminders can be reopened or permanently deleted.":j?.description})]}),l.totalCount>0?e.jsxs(m,{as:"span",variant:"label",tone:"tertiary",children:[Math.min(g.offset+1,l.totalCount),"–",Math.min(g.offset+l.reminders.length,l.totalCount)," of ",l.totalCount]}):null]}),l.reminders.length>0?e.jsxs(e.Fragment,{children:[e.jsx(z,{reminders:l.reminders,actions:i}),u>1?e.jsx(ee,{page:s,last:u,onChange:x}):null]}):e.jsx(q,{title:t==="completed"?"No completed reminders":j?.empty,description:r==="all"?"There is nothing to manage in this list yet.":"Try another priority to see more reminders."})]})}function Ne(){const t=A.useNavigate(),{status:a,scope:r,priority:s,page:d}=A.useSearch(),{onUpdate:i,onDelete:x}=re(),p=ae(),[h,g]=n.useState(),[l]=n.useState(()=>{const o=w();return{now:o.toISOString(),tomorrow:o.add(1,"day").startOf("day").toISOString()}}),u=o=>{t({search:c=>({...c,page:o})})},f={onUpdate:i,onDelete:async(o,c)=>{await p("Delete this reminder? This cannot be undone.")&&await x(o,c)},onEdit:g},y=e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(W,{type:"single",variant:"quiet",size:"sm",value:a,onValueChange:o=>{o&&t({search:c=>({...c,status:o,scope:"all",page:1})})},children:[e.jsx(I,{value:"open",children:"Open"}),e.jsx(I,{value:"completed",children:"Completed"})]}),e.jsxs(J,{value:s,size:"sm",ariaLabel:"Filter reminders by priority",className:"w-[148px]",onValueChange:o=>{t({search:c=>({...c,priority:o,page:1})})},children:[e.jsx(C,{value:"all",children:"All priorities"}),e.jsx(C,{value:"high",children:"High priority"}),e.jsx(C,{value:"medium",children:"Medium priority"}),e.jsx(C,{value:"low",children:"Low priority"})]})]});return e.jsxs(e.Fragment,{children:[e.jsx(G,{title:"Reminders",description:a==="completed"?"Review completed reminders and reopen anything that still needs attention.":"Act on what is overdue, due today, and coming next.",headerRight:y,children:e.jsx(Q,{fallback:e.jsx(he,{}),errorTitle:"Failed to load reminders",errorDescription:"Retry loading the reminder workspace.",resetKeys:[a,r,s,d,l.now],children:a==="open"&&r==="all"?e.jsx(ge,{priority:s,boundaries:l,actions:f,onViewAll:o=>{t({search:c=>({...c,scope:o,page:1})})}}):e.jsx(xe,{status:a,scope:r,priority:s,page:d,boundaries:l,actions:f,onPageChange:u,onBackToOverview:()=>{t({search:o=>({...o,scope:"all",page:1})})}})})}),e.jsx(ne,{isOpen:!!h,mode:"edit",reminder:h,onClose:()=>g(void 0),onSave:(o,c,R)=>{h&&i(h.id,String(h.noteId),{reminderDate:o,priority:c,content:R})}})]})}export{Ne as default};
@@ -1,4 +1,4 @@
1
- import{j as e,r as g}from"./floating-ui.react-dom-BWTnA00G.js";import{a as L,m as Q}from"./useNoteMutate-BjvZUmtX.js";import{g as q,x as G,y as V,c as X,F as J,B as Y,T as m,q as k,P as W,E as A,Q as Z,D as C,k as ee,h as te,l as w,i as re,s as se,O as ae}from"./time-PxWila4-.js";import{A as ne}from"./AuxiliaryPanelHeader-HAttwVby.js";import{N as P,f as ie,g as oe,T as le}from"./url-DKUMNVCI.js";import{f as ce}from"./Graph-hVj6vAYJ.js";import{s as de}from"./ArrowRight.es-BlNsZQFs.js";import{V as R}from"./ViewChip-BVkZAXyx.js";import"./app-NgiBDISG.js";import{f as me}from"./search-admin-adapter-Daf7e2YQ.js";import{p as he}from"./LinkSimple.es-B-P-7Iem.js";import{s as ue}from"./File.es-CHtXXafR.js";import"./preload-helper-BXl3LOEh.js";const xe=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),O=({children:t,match:s})=>{const r=s.trim();if(!r)return e.jsx("span",{children:t});const a=xe(r),n=new RegExp(`(${a})`,"gi"),o=new RegExp(`^${a}$`,"i"),i=t.split(n);return e.jsx("span",{children:i.map((c,d)=>o.test(c)?e.jsx("mark",{children:c},d):e.jsx(g.Fragment,{children:c},d))})},pe={hybrid:"HYBRID",lexical:"LEXICAL",semantic:"SEMANTIC"};function fe({query:t,limit:s=25,offset:r=0,mode:a="hybrid"}){return q(`query FetchSearchNotes($query: String!, $pagination: PaginationInput!, $mode: SearchMode!) {
1
+ import{j as e,r as g}from"./floating-ui.react-dom-BWTnA00G.js";import{a as L,m as Q}from"./useNoteMutate-BQj6jHhV.js";import{g as q,h as G,i as V,c as X,G as J,B as Y,T as m,q as k,P as W,E as A,Q as Z,F as C,n as ee,k as te,o as w,l as re,s as se,O as ae}from"./time-Kh6oav5R.js";import{A as ne}from"./AuxiliaryPanelHeader-Bys98BJJ.js";import{N as P,g as ie,h as oe,T as le}from"./url-Bp8sXMb4.js";import{f as ce}from"./Graph-BaqGi3M7.js";import{s as de}from"./ArrowRight.es-E09Lfefr.js";import{V as R}from"./ViewChip-BdPhSEvG.js";import"./app-OGsLwSqJ.js";import{f as me}from"./search-admin-adapter-Be9xSY88.js";import{p as he}from"./LinkSimple.es-iJvLf-MB.js";import{s as ue}from"./File.es-DlKAX1uO.js";import"./preload-helper-BXl3LOEh.js";const xe=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),O=({children:t,match:s})=>{const r=s.trim();if(!r)return e.jsx("span",{children:t});const a=xe(r),n=new RegExp(`(${a})`,"gi"),o=new RegExp(`^${a}$`,"i"),i=t.split(n);return e.jsx("span",{children:i.map((c,d)=>o.test(c)?e.jsx("mark",{children:c},d):e.jsx(g.Fragment,{children:c},d))})},pe={hybrid:"HYBRID",lexical:"LEXICAL",semantic:"SEMANTIC"};function fe({query:t,limit:s=25,offset:r=0,mode:a="hybrid"}){return q(`query FetchSearchNotes($query: String!, $pagination: PaginationInput!, $mode: SearchMode!) {
2
2
  searchNotes(query: $query, pagination: $pagination, mode: $mode) {
3
3
  totalCount
4
4
  semanticAvailable
@@ -28,4 +28,4 @@ import{j as e,r as g}from"./floating-ui.react-dom-BWTnA00G.js";import{a as L,m a
28
28
  title
29
29
  reasons
30
30
  }
31
- }`,{noteId:t,limit:s})}const M=[{value:"hybrid",label:"Keyword + Meaning"},{value:"lexical",label:"Keyword only"},{value:"semantic",label:"Meaning only"}],be=({value:t,onChange:s,className:r})=>e.jsx(G,{value:t,ariaLabel:"Search mode",variant:"ghost",size:"md",className:X("max-w-[12rem] shrink-0",r),onValueChange:a=>{M.some(n=>n.value===a)&&s(a)},children:M.map(a=>e.jsx(V,{value:a.value,children:a.label},a.value))}),ye=({value:t,onChange:s,onSubmit:r,onClear:a,onCompositionChange:n,mode:o,onModeChange:i,autoFocus:c=!1,placeholder:d="Describe what you remember"})=>{const l=h=>{h.preventDefault(),r()};return e.jsx("form",{role:"search",className:"flex w-full",onSubmit:l,children:e.jsxs("div",{className:"flex min-h-14 min-w-0 flex-1 flex-wrap items-center overflow-hidden rounded-[16px] border border-border-subtle bg-elevated px-2 py-1 transition-colors focus-within:border-border-focus focus-within:shadow-[0_0_0_4px_color-mix(in_srgb,var(--accent-soft-primary)_90%,transparent)]",children:[o&&i&&e.jsxs("div",{className:"flex w-full items-center border-b border-border-subtle/70 pb-1 md:w-auto md:border-b-0 md:pb-0",children:[e.jsx(be,{value:o,onChange:i,className:"max-w-full"}),e.jsx("span",{className:"mx-1 hidden h-6 w-px shrink-0 bg-divider md:block","aria-hidden":"true"})]}),e.jsxs("div",{className:"flex min-w-0 flex-1 basis-full items-center md:basis-auto",children:[e.jsx("span",{className:"flex h-11 w-10 shrink-0 items-center justify-center text-fg-tertiary","aria-hidden":"true",children:e.jsx(ce,{className:"h-[18px] w-[18px]",weight:"bold"})}),e.jsx("input",{type:"text",role:"searchbox","aria-label":"Search notes",autoFocus:c,autoComplete:"off",placeholder:d,value:t,onChange:h=>s(h.target.value),onCompositionStart:()=>n?.(!0),onCompositionEnd:h=>{s(h.currentTarget.value),n?.(!1)},className:"h-11 min-w-0 flex-1 bg-transparent px-1 text-base text-fg-default outline-none placeholder:text-fg-placeholder"}),t&&e.jsx("button",{type:"button","aria-label":"Clear search",className:"focus-ring-soft flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] text-fg-tertiary transition-colors hover:bg-hover-subtle hover:text-fg-default",onClick:()=>{s(""),a?.()},children:e.jsx(J,{className:"h-4 w-4",weight:"bold"})}),e.jsxs(Y,{type:"submit",variant:t.trim()?"primary":"ghost",size:"icon-sm","aria-label":"Search",disabled:!t.trim(),className:"my-1 shrink-0 max-sm:disabled:opacity-100 sm:h-11 sm:w-auto sm:rounded-[16px] sm:px-5 sm:text-body",children:[e.jsx(de,{className:"h-4 w-4 sm:hidden",weight:"bold","aria-hidden":"true"}),e.jsx("span",{className:"hidden sm:inline",children:"Search"})]})]})]})})},je=t=>t?.lexical&&t.semantic?"Keyword + Meaning":t?.semantic?"Meaning match":t?.lexical?"Keyword match":null,Ne=({match:t,className:s})=>{const r=je(t);return r?e.jsx(m,{as:"span",variant:"meta",weight:"semibold",tone:"tertiary",className:`shrink-0 rounded-full bg-muted px-2 py-1 ${s??""}`.trim(),children:r}):null},ve=()=>{const t=L({queryKey:k.search.adminStatus(),queryFn:me,staleTime:6e4,retry:1});return{status:t.data,isLoading:t.isPending,isError:t.isError,isSemanticSearchEnabled:t.data?.config.enabled===!0,isSemanticSearchAvailable:t.data?.available===!0}},I=180,T=t=>t.replace(/\s+/g," ").trim(),B=t=>T(t).toLowerCase().split(" ").filter(Boolean),Se=(t,s)=>{const r=T(t),a=T(s).toLowerCase();if(!a)return r;const n=r.toLowerCase();let o=a,i=n.indexOf(a);if(i===-1){const h=B(s).map(f=>({term:f,index:n.indexOf(f)})).filter(f=>f.index>=0).sort((f,v)=>f.index-v.index||v.term.length-f.term.length)[0];h&&(o=h.term,i=h.index)}if(i===-1)return r.length>I?`${r.slice(0,I-1).trimEnd()}…`:r;const c=Math.max(0,i-56),d=Math.min(r.length,i+o.length+84);let l=r.slice(c,d).trim();return c>0&&(l=`…${l}`),d<r.length&&(l=`${l}…`),l},we=t=>Array.isArray(t)?t.map(s=>{if(!s||typeof s!="object")return"";const r=s.text;return typeof r=="string"?r:""}).join(""):"",Ee=t=>t==="heading"?"heading":t==="bulletListItem"||t==="numberedListItem"?"list":t==="checkListItem"?"checklist":t==="quote"?"quote":t==="codeBlock"?"code":"content",z=(t,s)=>{Array.isArray(t)&&t.forEach(r=>{if(!r||typeof r!="object")return;const a=typeof r.type=="string"?r.type:void 0,n=T(we(r.content));n&&s.push({kind:Ee(a),text:n});const o=r.children;Array.isArray(o)&&z(o,s)})},Te=(t,s)=>{try{const r=JSON.parse(t),a=[];if(z(r,a),a.length===0)return[];const n=B(s),o=n.length>0?a.filter(c=>n.some(d=>c.text.toLowerCase().includes(d))):a;return(o.length>0?o:a).slice(0,2).map(c=>({...c,text:Se(c.text,s)}))}catch{return[]}},_=te(ie),E=10,Ce=400,U=3e4,ke=t=>t===1?"1 result":`${t} results`,Ae=t=>{const s=Number(t),r=Number.isFinite(s)?s:Date.parse(t);return Number.isFinite(r)?`Updated ${ae(r)}`:"Updated recently"},Re=({searchParams:t,render:s})=>{const{data:r}=re({queryKey:k.search.results(t),async queryFn(){const a=await fe(t);if(a.type==="error")throw a;return a.searchNotes},staleTime:U});return s(r)},$=()=>e.jsx("main",{className:"mt-5 flex flex-col gap-3","aria-label":"Searching notes",children:Array.from({length:2},(t,s)=>e.jsxs("div",{className:"surface-base flex flex-col gap-3 p-4",children:[e.jsx(w,{width:"34%",height:18,className:"rounded-full"}),e.jsx("div",{className:"rounded-[14px] bg-muted px-3 py-3",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(w,{width:84,height:12,className:"rounded-full"}),e.jsx(w,{width:"100%",height:14,className:"rounded-full"}),e.jsx(w,{width:"82%",height:14,className:"rounded-full"})]})})]},s))}),Me=({note:t})=>{const s=t.tags.slice(0,2),r=t.tags.length-s.length;return e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1.5 sm:col-start-1 sm:row-start-2",children:[t.pinned&&e.jsxs("span",{className:"inline-flex items-center text-fg-tertiary",title:"Pinned note",children:[e.jsx(Q,{className:"h-3.5 w-3.5",weight:"fill","aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:"Pinned note"})]}),e.jsx(m,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:Ae(t.updatedAt)}),s.map(a=>e.jsx(C,{to:le,params:{id:a.id},search:{page:1},children:e.jsx(R,{size:"compact",className:"border-border-subtle bg-transparent text-fg-secondary transition-colors hover:bg-hover-subtle hover:text-fg-default",children:a.name})},a.id)),r>0&&e.jsxs(R,{size:"compact",className:"border-border-subtle bg-subtle text-fg-tertiary",children:["+",r]})]})},Ie=t=>t==="list"?"•":t==="checklist"?"☐":null,_e=t=>{if(t==="quote")return"border-l-2 border-border-secondary pl-3 italic";if(t==="code")return"rounded-[10px] bg-subtle/70 px-2.5 py-2 font-mono text-sm"},$e=({blocks:t,query:s})=>e.jsx("div",{className:"rounded-[14px] border border-border-subtle/80 bg-muted/40 px-3.5 py-3",children:t.map((r,a)=>{const n=Ie(r.kind);return e.jsx("div",{className:a>0?"mt-2 border-t border-border-subtle/70 pt-2":void 0,children:e.jsxs("div",{className:"flex items-start gap-2",children:[n&&e.jsx("span",{className:"mt-0.5 w-4 shrink-0 text-center text-fg-tertiary","aria-hidden":"true",children:n}),e.jsx(m,{as:"p",variant:"body",weight:r.kind==="heading"?"semibold":"regular",tone:r.kind==="heading"?"default":"secondary",className:_e(r.kind)??"leading-[1.65]",children:e.jsx(O,{match:s,children:r.text})})]})},`${r.kind}:${a}`)})}),Le=({noteId:t})=>{const[s,r]=g.useState(!1),{data:a,isError:n,isLoading:o}=L({queryKey:k.search.related(t),queryFn:async()=>{const i=await ge(t);if(i.type==="error")throw i;return i.searchRelatedNotes},enabled:s,staleTime:U});return e.jsxs("details",{className:"group border-t border-border-subtle/70 pt-3",onToggle:i=>r(i.currentTarget.open),children:[e.jsxs("summary",{className:"focus-ring-soft flex cursor-pointer list-none items-center justify-between gap-3 rounded-[10px] border border-transparent px-2.5 py-1.5 outline-none transition-colors hover:bg-hover-subtle marker:hidden",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(ne,{icon:e.jsx(he,{className:"h-3.5 w-3.5"}),title:"Related notes",className:"text-fg-tertiary"}),a&&e.jsx(m,{as:"span",variant:"meta",weight:"medium",tone:"tertiary",children:a.length})]}),e.jsx(se,{className:"h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-open:rotate-180","aria-hidden":"true"})]}),e.jsxs("div",{className:"mt-2",children:[o&&e.jsx(m,{as:"p",variant:"meta",tone:"tertiary",className:"px-2 py-1.5",children:"Looking for related notes…"}),n&&e.jsx(m,{as:"p",variant:"meta",tone:"error",className:"px-2 py-1.5",children:"Related notes could not be loaded."}),!o&&!n&&a?.length===0&&e.jsx(m,{as:"p",variant:"meta",tone:"tertiary",className:"px-2 py-1.5",children:"No direct connections found yet."}),!o&&!n&&a&&a.length>0&&e.jsx("ul",{className:"flex flex-col",children:a.map(i=>e.jsx("li",{children:e.jsxs(C,{to:P,params:{id:i.id},className:"flex min-w-0 items-start gap-2 rounded-[10px] px-2.5 py-1.5 text-fg-secondary transition-colors hover:bg-hover-subtle hover:text-fg-default",children:[e.jsx(ue,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-fg-tertiary","aria-hidden":"true"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx(m,{as:"span",variant:"body",weight:"medium",className:"text-current line-clamp-1",children:i.title||"Untitled"}),e.jsx(m,{as:"span",variant:"meta",tone:"tertiary",className:"mt-0.5 block line-clamp-1",children:i.reasons.join(" · ")})]})]})},i.id))})]})]})},qe=({result:t,mode:s})=>s==="lexical"||t.semanticAvailable&&!t.semanticError?null:e.jsx(m,{as:"p",variant:"body",tone:"tertiary",className:"rounded-[14px] border border-border-subtle bg-muted px-3.5 py-2.5",children:s==="semantic"?"Meaning search is not ready. Configure an embedding API and build the index in Search settings.":"Meaning search is not ready, so these results use keyword search only."}),Pe=({isVisible:t})=>t?e.jsxs(m,{as:"p",variant:"meta",tone:"tertiary",className:"mx-auto mt-5 max-w-[34rem] text-center",children:[e.jsx("span",{className:"font-semibold text-fg-secondary",children:"Tip:"})," Search by meaning when the exact words are fuzzy."," ",e.jsx(C,{to:oe,className:"font-semibold text-fg-secondary underline decoration-border-secondary underline-offset-2 transition-colors hover:text-fg-default",children:"Enable meaning search"})]}):null;function Ye(){const t=_.useNavigate(),{page:s,query:r,mode:a}=_.useSearch(),[n,o]=g.useState(r),[i,c]=g.useState(!1),d=g.useRef(null),l=r.trim(),{isLoading:h,isError:f,isSemanticSearchEnabled:v,isSemanticSearchAvailable:j}=ve(),p=h||j?a:"lexical",D=j?"Use exact words or describe a half-remembered note":"Search notes by exact words";g.useEffect(()=>{o(r)},[r]);const b=g.useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null)},[]),N=g.useCallback((u,x=p,y=!1)=>{const S={query:u.trim(),page:1,mode:x};if(y){t({search:S,replace:!0});return}t({search:S})},[p,t]);g.useEffect(()=>{if(b(),!(i||n.trim()===l))return d.current=setTimeout(()=>{d.current=null,N(n,p,!0)},Ce),b},[p,b,n,i,l,N]);const H=()=>{i||(b(),N(n))},F=u=>{b(),N(n,u)};return e.jsx(W,{title:"Search",description:D,variant:"default",children:e.jsxs("main",{children:[e.jsx("section",{"aria-label":"Search controls",className:"border-b border-border-subtle pb-5",children:e.jsx(ye,{value:n,onChange:o,onCompositionChange:c,mode:j?p:void 0,onModeChange:j?F:void 0,placeholder:j?"Search or describe a memory":"Search notes by keyword",onSubmit:H,onClear:()=>{b(),N("")},autoFocus:!l})}),l?h?e.jsx($,{}):e.jsx(Z,{fallback:e.jsx($,{}),errorTitle:"Failed to load search results",errorDescription:`Retry loading results for "${l}".`,resetKeys:[l,s,p],children:e.jsx(Re,{searchParams:{query:l,limit:E,offset:(s-1)*E,mode:p},render:u=>e.jsxs("div",{className:"mt-5 flex flex-col gap-3",children:[e.jsx("div",{className:"flex min-h-7 items-center justify-between gap-3",children:e.jsx(m,{as:"p",variant:"body",weight:"semibold",tone:"secondary",children:ke(u.totalCount)})}),e.jsx(qe,{result:u,mode:p}),u.notes.length>0?e.jsx("div",{className:"grid gap-3",children:u.notes.map(x=>{const y=Te(x.content,l),S=u.matches.find(K=>K.noteId===x.id);return e.jsxs("article",{className:"surface-base flex flex-col gap-3.5 rounded-[16px] p-4 transition-colors hover:border-border-secondary/70 hover:bg-hover-subtle/25 sm:p-5",children:[e.jsxs("div",{className:"grid min-w-0 gap-x-3 gap-y-2 sm:grid-cols-[minmax(0,1fr)_auto]",children:[e.jsx(m,{as:"h2",variant:"body",weight:"semibold",tracking:"tight",className:"min-w-0",children:e.jsx(C,{to:P,params:{id:x.id},className:"line-clamp-2 transition-colors hover:text-fg-default/85",children:e.jsx(O,{match:l,children:x.title||"Untitled"})})}),e.jsx(Me,{note:x}),e.jsx(Ne,{match:S,className:"justify-self-start sm:col-start-2 sm:row-start-1 sm:justify-self-end"})]}),y.length>0?e.jsx($e,{blocks:y,query:l}):e.jsx("div",{className:"rounded-[14px] border border-dashed border-border-subtle/80 bg-muted/25 px-3.5 py-3",children:e.jsx(m,{as:"p",variant:"body",tone:"tertiary",className:"leading-[1.65]",children:"Open the note to inspect matching content."})}),e.jsx(Le,{noteId:x.id})]},x.id)})}):e.jsx(A,{title:"No results found",description:p==="semantic"&&!u.semanticAvailable?"Meaning search must be configured before it can find related notes.":"Try another phrase or a different search method."}),u.totalCount>E&&e.jsx(ee,{page:s,last:Math.ceil(u.totalCount/E),onChange:x=>{t({search:y=>({...y,page:x,mode:p})})}})]})})}):e.jsxs("div",{className:"py-10",children:[e.jsx(A,{title:"Start with anything you remember",description:"A name, phrase, rough date, or description all work."}),e.jsx(Pe,{isVisible:!h&&!f&&!v})]})]})})}export{Ye as default};
31
+ }`,{noteId:t,limit:s})}const M=[{value:"hybrid",label:"Keyword + Meaning"},{value:"lexical",label:"Keyword only"},{value:"semantic",label:"Meaning only"}],be=({value:t,onChange:s,className:r})=>e.jsx(G,{value:t,ariaLabel:"Search mode",variant:"ghost",size:"md",className:X("max-w-[12rem] shrink-0",r),onValueChange:a=>{M.some(n=>n.value===a)&&s(a)},children:M.map(a=>e.jsx(V,{value:a.value,children:a.label},a.value))}),ye=({value:t,onChange:s,onSubmit:r,onClear:a,onCompositionChange:n,mode:o,onModeChange:i,autoFocus:c=!1,placeholder:d="Describe what you remember"})=>{const l=h=>{h.preventDefault(),r()};return e.jsx("form",{role:"search",className:"flex w-full",onSubmit:l,children:e.jsxs("div",{className:"flex min-h-14 min-w-0 flex-1 flex-wrap items-center overflow-hidden rounded-[16px] border border-border-subtle bg-elevated px-2 py-1 transition-colors focus-within:border-border-focus focus-within:shadow-[0_0_0_4px_color-mix(in_srgb,var(--accent-soft-primary)_90%,transparent)]",children:[o&&i&&e.jsxs("div",{className:"flex w-full items-center border-b border-border-subtle/70 pb-1 md:w-auto md:border-b-0 md:pb-0",children:[e.jsx(be,{value:o,onChange:i,className:"max-w-full"}),e.jsx("span",{className:"mx-1 hidden h-6 w-px shrink-0 bg-divider md:block","aria-hidden":"true"})]}),e.jsxs("div",{className:"flex min-w-0 flex-1 basis-full items-center md:basis-auto",children:[e.jsx("span",{className:"flex h-11 w-10 shrink-0 items-center justify-center text-fg-tertiary","aria-hidden":"true",children:e.jsx(ce,{className:"h-[18px] w-[18px]",weight:"bold"})}),e.jsx("input",{type:"text",role:"searchbox","aria-label":"Search notes",autoFocus:c,autoComplete:"off",placeholder:d,value:t,onChange:h=>s(h.target.value),onCompositionStart:()=>n?.(!0),onCompositionEnd:h=>{s(h.currentTarget.value),n?.(!1)},className:"h-11 min-w-0 flex-1 bg-transparent px-1 text-base text-fg-default outline-none placeholder:text-fg-placeholder"}),t&&e.jsx("button",{type:"button","aria-label":"Clear search",className:"focus-ring-soft flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] text-fg-tertiary transition-colors hover:bg-hover-subtle hover:text-fg-default",onClick:()=>{s(""),a?.()},children:e.jsx(J,{className:"h-4 w-4",weight:"bold"})}),e.jsxs(Y,{type:"submit",variant:t.trim()?"primary":"ghost",size:"icon-sm","aria-label":"Search",disabled:!t.trim(),className:"my-1 shrink-0 max-sm:disabled:opacity-100 sm:h-11 sm:w-auto sm:rounded-[16px] sm:px-5 sm:text-body",children:[e.jsx(de,{className:"h-4 w-4 sm:hidden",weight:"bold","aria-hidden":"true"}),e.jsx("span",{className:"hidden sm:inline",children:"Search"})]})]})]})})},je=t=>t?.lexical&&t.semantic?"Keyword + Meaning":t?.semantic?"Meaning match":t?.lexical?"Keyword match":null,Ne=({match:t,className:s})=>{const r=je(t);return r?e.jsx(m,{as:"span",variant:"meta",weight:"semibold",tone:"tertiary",className:`shrink-0 rounded-full bg-muted px-2 py-1 ${s??""}`.trim(),children:r}):null},ve=()=>{const t=L({queryKey:k.search.adminStatus(),queryFn:me,staleTime:6e4,retry:1});return{status:t.data,isLoading:t.isPending,isError:t.isError,isSemanticSearchEnabled:t.data?.config.enabled===!0,isSemanticSearchAvailable:t.data?.available===!0}},I=180,T=t=>t.replace(/\s+/g," ").trim(),B=t=>T(t).toLowerCase().split(" ").filter(Boolean),Se=(t,s)=>{const r=T(t),a=T(s).toLowerCase();if(!a)return r;const n=r.toLowerCase();let o=a,i=n.indexOf(a);if(i===-1){const h=B(s).map(f=>({term:f,index:n.indexOf(f)})).filter(f=>f.index>=0).sort((f,v)=>f.index-v.index||v.term.length-f.term.length)[0];h&&(o=h.term,i=h.index)}if(i===-1)return r.length>I?`${r.slice(0,I-1).trimEnd()}…`:r;const c=Math.max(0,i-56),d=Math.min(r.length,i+o.length+84);let l=r.slice(c,d).trim();return c>0&&(l=`…${l}`),d<r.length&&(l=`${l}…`),l},we=t=>Array.isArray(t)?t.map(s=>{if(!s||typeof s!="object")return"";const r=s.text;return typeof r=="string"?r:""}).join(""):"",Ee=t=>t==="heading"?"heading":t==="bulletListItem"||t==="numberedListItem"?"list":t==="checkListItem"?"checklist":t==="quote"?"quote":t==="codeBlock"?"code":"content",z=(t,s)=>{Array.isArray(t)&&t.forEach(r=>{if(!r||typeof r!="object")return;const a=typeof r.type=="string"?r.type:void 0,n=T(we(r.content));n&&s.push({kind:Ee(a),text:n});const o=r.children;Array.isArray(o)&&z(o,s)})},Te=(t,s)=>{try{const r=JSON.parse(t),a=[];if(z(r,a),a.length===0)return[];const n=B(s),o=n.length>0?a.filter(c=>n.some(d=>c.text.toLowerCase().includes(d))):a;return(o.length>0?o:a).slice(0,2).map(c=>({...c,text:Se(c.text,s)}))}catch{return[]}},_=te(ie),E=10,Ce=400,U=3e4,ke=t=>t===1?"1 result":`${t} results`,Ae=t=>{const s=Number(t),r=Number.isFinite(s)?s:Date.parse(t);return Number.isFinite(r)?`Updated ${ae(r)}`:"Updated recently"},Re=({searchParams:t,render:s})=>{const{data:r}=re({queryKey:k.search.results(t),async queryFn(){const a=await fe(t);if(a.type==="error")throw a;return a.searchNotes},staleTime:U});return s(r)},$=()=>e.jsx("main",{className:"mt-5 flex flex-col gap-3","aria-label":"Searching notes",children:Array.from({length:2},(t,s)=>e.jsxs("div",{className:"surface-base flex flex-col gap-3 p-4",children:[e.jsx(w,{width:"34%",height:18,className:"rounded-full"}),e.jsx("div",{className:"rounded-[14px] bg-muted px-3 py-3",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(w,{width:84,height:12,className:"rounded-full"}),e.jsx(w,{width:"100%",height:14,className:"rounded-full"}),e.jsx(w,{width:"82%",height:14,className:"rounded-full"})]})})]},s))}),Me=({note:t})=>{const s=t.tags.slice(0,2),r=t.tags.length-s.length;return e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1.5 sm:col-start-1 sm:row-start-2",children:[t.pinned&&e.jsxs("span",{className:"inline-flex items-center text-fg-tertiary",title:"Pinned note",children:[e.jsx(Q,{className:"h-3.5 w-3.5",weight:"fill","aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:"Pinned note"})]}),e.jsx(m,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:Ae(t.updatedAt)}),s.map(a=>e.jsx(C,{to:le,params:{id:a.id},search:{page:1},children:e.jsx(R,{size:"compact",className:"border-border-subtle bg-transparent text-fg-secondary transition-colors hover:bg-hover-subtle hover:text-fg-default",children:a.name})},a.id)),r>0&&e.jsxs(R,{size:"compact",className:"border-border-subtle bg-subtle text-fg-tertiary",children:["+",r]})]})},Ie=t=>t==="list"?"•":t==="checklist"?"☐":null,_e=t=>{if(t==="quote")return"border-l-2 border-border-secondary pl-3 italic";if(t==="code")return"rounded-[10px] bg-subtle/70 px-2.5 py-2 font-mono text-sm"},$e=({blocks:t,query:s})=>e.jsx("div",{className:"rounded-[14px] border border-border-subtle/80 bg-muted/40 px-3.5 py-3",children:t.map((r,a)=>{const n=Ie(r.kind);return e.jsx("div",{className:a>0?"mt-2 border-t border-border-subtle/70 pt-2":void 0,children:e.jsxs("div",{className:"flex items-start gap-2",children:[n&&e.jsx("span",{className:"mt-0.5 w-4 shrink-0 text-center text-fg-tertiary","aria-hidden":"true",children:n}),e.jsx(m,{as:"p",variant:"body",weight:r.kind==="heading"?"semibold":"regular",tone:r.kind==="heading"?"default":"secondary",className:_e(r.kind)??"leading-[1.65]",children:e.jsx(O,{match:s,children:r.text})})]})},`${r.kind}:${a}`)})}),Le=({noteId:t})=>{const[s,r]=g.useState(!1),{data:a,isError:n,isLoading:o}=L({queryKey:k.search.related(t),queryFn:async()=>{const i=await ge(t);if(i.type==="error")throw i;return i.searchRelatedNotes},enabled:s,staleTime:U});return e.jsxs("details",{className:"group border-t border-border-subtle/70 pt-3",onToggle:i=>r(i.currentTarget.open),children:[e.jsxs("summary",{className:"focus-ring-soft flex cursor-pointer list-none items-center justify-between gap-3 rounded-[10px] border border-transparent px-2.5 py-1.5 outline-none transition-colors hover:bg-hover-subtle marker:hidden",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(ne,{icon:e.jsx(he,{className:"h-3.5 w-3.5"}),title:"Related notes",className:"text-fg-tertiary"}),a&&e.jsx(m,{as:"span",variant:"meta",weight:"medium",tone:"tertiary",children:a.length})]}),e.jsx(se,{className:"h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-open:rotate-180","aria-hidden":"true"})]}),e.jsxs("div",{className:"mt-2",children:[o&&e.jsx(m,{as:"p",variant:"meta",tone:"tertiary",className:"px-2 py-1.5",children:"Looking for related notes…"}),n&&e.jsx(m,{as:"p",variant:"meta",tone:"error",className:"px-2 py-1.5",children:"Related notes could not be loaded."}),!o&&!n&&a?.length===0&&e.jsx(m,{as:"p",variant:"meta",tone:"tertiary",className:"px-2 py-1.5",children:"No direct connections found yet."}),!o&&!n&&a&&a.length>0&&e.jsx("ul",{className:"flex flex-col",children:a.map(i=>e.jsx("li",{children:e.jsxs(C,{to:P,params:{id:i.id},className:"flex min-w-0 items-start gap-2 rounded-[10px] px-2.5 py-1.5 text-fg-secondary transition-colors hover:bg-hover-subtle hover:text-fg-default",children:[e.jsx(ue,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-fg-tertiary","aria-hidden":"true"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx(m,{as:"span",variant:"body",weight:"medium",className:"text-current line-clamp-1",children:i.title||"Untitled"}),e.jsx(m,{as:"span",variant:"meta",tone:"tertiary",className:"mt-0.5 block line-clamp-1",children:i.reasons.join(" · ")})]})]})},i.id))})]})]})},qe=({result:t,mode:s})=>s==="lexical"||t.semanticAvailable&&!t.semanticError?null:e.jsx(m,{as:"p",variant:"body",tone:"tertiary",className:"rounded-[14px] border border-border-subtle bg-muted px-3.5 py-2.5",children:s==="semantic"?"Meaning search is not ready. Configure an embedding API and build the index in Search settings.":"Meaning search is not ready, so these results use keyword search only."}),Pe=({isVisible:t})=>t?e.jsxs(m,{as:"p",variant:"meta",tone:"tertiary",className:"mx-auto mt-5 max-w-[34rem] text-center",children:[e.jsx("span",{className:"font-semibold text-fg-secondary",children:"Tip:"})," Search by meaning when the exact words are fuzzy."," ",e.jsx(C,{to:oe,className:"font-semibold text-fg-secondary underline decoration-border-secondary underline-offset-2 transition-colors hover:text-fg-default",children:"Enable meaning search"})]}):null;function Ye(){const t=_.useNavigate(),{page:s,query:r,mode:a}=_.useSearch(),[n,o]=g.useState(r),[i,c]=g.useState(!1),d=g.useRef(null),l=r.trim(),{isLoading:h,isError:f,isSemanticSearchEnabled:v,isSemanticSearchAvailable:j}=ve(),p=h||j?a:"lexical",H=j?"Use exact words or describe a half-remembered note":"Search notes by exact words";g.useEffect(()=>{o(r)},[r]);const b=g.useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null)},[]),N=g.useCallback((u,x=p,y=!1)=>{const S={query:u.trim(),page:1,mode:x};if(y){t({search:S,replace:!0});return}t({search:S})},[p,t]);g.useEffect(()=>{if(b(),!(i||n.trim()===l))return d.current=setTimeout(()=>{d.current=null,N(n,p,!0)},Ce),b},[p,b,n,i,l,N]);const D=()=>{i||(b(),N(n))},F=u=>{b(),N(n,u)};return e.jsx(W,{title:"Search",description:H,variant:"default",children:e.jsxs("main",{children:[e.jsx("section",{"aria-label":"Search controls",className:"border-b border-border-subtle pb-5",children:e.jsx(ye,{value:n,onChange:o,onCompositionChange:c,mode:j?p:void 0,onModeChange:j?F:void 0,placeholder:j?"Search or describe a memory":"Search notes by keyword",onSubmit:D,onClear:()=>{b(),N("")},autoFocus:!l})}),l?h?e.jsx($,{}):e.jsx(Z,{fallback:e.jsx($,{}),errorTitle:"Failed to load search results",errorDescription:`Retry loading results for "${l}".`,resetKeys:[l,s,p],children:e.jsx(Re,{searchParams:{query:l,limit:E,offset:(s-1)*E,mode:p},render:u=>e.jsxs("div",{className:"mt-5 flex flex-col gap-3",children:[e.jsx("div",{className:"flex min-h-7 items-center justify-between gap-3",children:e.jsx(m,{as:"p",variant:"body",weight:"semibold",tone:"secondary",children:ke(u.totalCount)})}),e.jsx(qe,{result:u,mode:p}),u.notes.length>0?e.jsx("div",{className:"grid gap-3",children:u.notes.map(x=>{const y=Te(x.content,l),S=u.matches.find(K=>K.noteId===x.id);return e.jsxs("article",{className:"surface-base flex flex-col gap-3.5 rounded-[16px] p-4 transition-colors hover:border-border-secondary/70 hover:bg-hover-subtle/25 sm:p-5",children:[e.jsxs("div",{className:"grid min-w-0 gap-x-3 gap-y-2 sm:grid-cols-[minmax(0,1fr)_auto]",children:[e.jsx(m,{as:"h2",variant:"body",weight:"semibold",tracking:"tight",className:"min-w-0",children:e.jsx(C,{to:P,params:{id:x.id},className:"line-clamp-2 transition-colors hover:text-fg-default/85",children:e.jsx(O,{match:l,children:x.title||"Untitled"})})}),e.jsx(Me,{note:x}),e.jsx(Ne,{match:S,className:"justify-self-start sm:col-start-2 sm:row-start-1 sm:justify-self-end"})]}),y.length>0?e.jsx($e,{blocks:y,query:l}):e.jsx("div",{className:"rounded-[14px] border border-dashed border-border-subtle/80 bg-muted/25 px-3.5 py-3",children:e.jsx(m,{as:"p",variant:"body",tone:"tertiary",className:"leading-[1.65]",children:"Open the note to inspect matching content."})}),e.jsx(Le,{noteId:x.id})]},x.id)})}):e.jsx(A,{title:"No results found",description:p==="semantic"&&!u.semanticAvailable?"Meaning search must be configured before it can find related notes.":"Try another phrase or a different search method."}),u.totalCount>E&&e.jsx(ee,{page:s,last:Math.ceil(u.totalCount/E),onChange:x=>{t({search:y=>({...y,page:x,mode:p})})}})]})})}):e.jsxs("div",{className:"py-10",children:[e.jsx(A,{title:"Start with anything you remember",description:"A name, phrase, rough date, or description all work."}),e.jsx(Pe,{isVisible:!h&&!f&&!v})]})]})})}export{Ye as default};
@@ -1 +1 @@
1
- import{j as f}from"./floating-ui.react-dom-BWTnA00G.js";import{z as o}from"./time-PxWila4-.js";const n=o("surface-base",{variants:{tone:{default:"",elevated:"surface-elevated"},padding:{default:"p-4",compact:"px-3 py-2.5",roomy:"p-6",flush:"overflow-hidden"}},defaultVariants:{tone:"default",padding:"default"}});function i({children:a,className:e,flush:t=!1,padding:d="default",tone:s="default"}){const r=t?"flush":d;return f.jsx("div",{className:n({tone:s,padding:r,className:e}),children:a})}export{i as S};
1
+ import{j as f}from"./floating-ui.react-dom-BWTnA00G.js";import{A as o}from"./time-Kh6oav5R.js";const n=o("surface-base",{variants:{tone:{default:"",elevated:"surface-elevated"},padding:{default:"p-4",compact:"px-3 py-2.5",roomy:"p-6",flush:"overflow-hidden"}},defaultVariants:{tone:"default",padding:"default"}});function i({children:a,className:e,flush:t=!1,padding:d="default",tone:s="default"}){const r=t?"flush":d;return f.jsx("div",{className:n({tone:s,padding:r,className:e}),children:a})}export{i as S};
@@ -1 +1 @@
1
- import{r as c,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{i as T,q as S,P as k,T as f,F as P,x as j,y as g,Q as E,D as R,k as q,E as C,l as x,h as I}from"./time-PxWila4-.js";import{s as A,T as O,a as L,i as F,b as Q,F as v}from"./app-NgiBDISG.js";import{T as _,e as D}from"./url-DKUMNVCI.js";import{f as M}from"./tag.api-DEUROVKQ.js";import{f as B}from"./Graph-hVj6vAYJ.js";import"./useNoteMutate-BjvZUmtX.js";import"./preload-helper-BXl3LOEh.js";const z=s=>{const{data:d}=T({queryKey:S.tags.list(s.searchParams),async queryFn(){const t=await M({query:s.searchParams.query,offset:s.searchParams.offset,limit:s.searchParams.limit,sortBy:s.searchParams.sortBy,sortOrder:s.searchParams.sortOrder});if(t.type==="error")throw t;return t.allTags}});return s.render(d)},G=s=>{const[d,t]=c.useState(!1),r=c.useRef(null),n=c.useRef(!0),u=c.useRef(0),o=c.useCallback(()=>{r.current!==null&&(clearTimeout(r.current),r.current=null)},[]);c.useEffect(()=>(n.current=!0,()=>{n.current=!1,o()}),[o]);const m=c.useCallback(p=>{u.current+=1;const i=u.current;o(),n.current&&t(!0),r.current=setTimeout(()=>{r.current=null,Promise.resolve().then(p).catch(()=>{}).finally(()=>{n.current&&u.current===i&&t(!1)})},s)},[o,s]);return[d,m]},b=I(D);function X(){const s=b.useNavigate(),{page:d,query:t,limit:r,sortBy:n,sortOrder:u}=b.useSearch(),[o,m]=c.useState(t),[,p]=G(350),i=t.trim();c.useEffect(()=>{m(t)},[t]),c.useEffect(()=>{const a=o.trim();a!==i&&p(()=>{s({search:l=>({...l,page:1,query:a})})})},[o,s,i,p]);const y=a=>{s({search:l=>({...l,...a})})},w=()=>{m(""),y({page:1,query:""})};return e.jsxs(k,{title:"Tags",description:"Find tags you added with @ across your notes",children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{className:"surface-base flex min-w-0 items-center gap-2 rounded-[16px] px-3.5 py-2.5 lg:w-72",children:[e.jsx(B,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Search"}),e.jsx("div",{className:"h-5 w-px bg-divider"}),e.jsx("input",{"aria-label":"Search tags",placeholder:"Search tags",value:o,onChange:a=>m(a.target.value),className:"h-8 min-w-0 flex-1 bg-transparent text-sm font-medium text-fg-default outline-none placeholder:text-xs placeholder:font-medium placeholder:text-fg-placeholder"}),(o||i)&&e.jsx("button",{type:"button","aria-label":"Clear tag search",className:"focus-ring-soft flex h-7 w-7 shrink-0 items-center justify-center rounded-[10px] text-fg-tertiary outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default",onClick:w,children:e.jsx(P,{className:"h-3.5 w-3.5",weight:"bold"})})]}),e.jsxs("div",{className:"surface-base inline-flex flex-wrap items-center gap-3 rounded-[16px] px-3.5 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Items"}),e.jsx(j,{value:String(r),onValueChange:a=>{const l=Number(a);F(l)&&y({limit:l,page:1})},variant:"ghost",size:"sm",children:O.map(a=>e.jsx(g,{value:String(a),children:a===L?`Default (${a})`:a},a))})]}),e.jsx("div",{className:"h-5 w-px bg-divider"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Sort"}),e.jsxs(j,{value:n,onValueChange:a=>y({sortBy:a,page:1}),variant:"ghost",size:"sm",children:[e.jsx(g,{value:"referenceCount",children:"Usage"}),e.jsx(g,{value:"name",children:"Name"})]}),e.jsxs(j,{value:u,onValueChange:a=>y({sortOrder:a,page:1}),variant:"ghost",size:"sm",children:[e.jsx(g,{value:"desc",children:n==="name"?"Z to A":"Most used"}),e.jsx(g,{value:"asc",children:n==="name"?"A to Z":"Least used"})]})]})]})]}),e.jsx(E,{fallback:e.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[e.jsx(x,{width:"90px",height:"36px"}),e.jsx(x,{width:"120px",height:"36px"}),e.jsx(x,{width:"80px",height:"36px"}),e.jsx(x,{width:"100px",height:"36px"}),e.jsx(x,{width:"110px",height:"36px"}),e.jsx(x,{width:"70px",height:"36px"})]}),errorTitle:"Failed to load tags",errorDescription:"Retry loading the tag catalog",resetKeys:[d,r,i,n,u],children:e.jsx(z,{searchParams:{query:i,offset:(d-1)*r,limit:r,sortBy:n,sortOrder:u},render:({tags:a,totalCount:l})=>e.jsx(v,{fallback:e.jsx(C,{title:i?"No matching tags":"No tags yet",description:i?"Try another tag name":"Add @tags inside notes and they will appear here"}),children:a.length>0&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"flex flex-wrap gap-2.5",children:a.map(h=>e.jsxs(R,{to:_,params:{id:h.id},search:{page:1},className:"inline-flex items-center gap-1.5 rounded-full border border-border-subtle bg-hover-subtle px-3 py-1.5 text-fg-secondary transition-colors hover:border-border-secondary hover:bg-hover hover:text-fg-default",children:[e.jsx(f,{as:"span",variant:"meta",weight:"medium",className:"text-current",children:h.name}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",className:"text-current/70",children:h.referenceCount})]},h.id))}),e.jsx(v,{fallback:null,children:l&&r<l&&e.jsx(q,{page:d,last:Math.ceil(l/r),onChange:h=>{s({search:N=>({...N,page:h,query:i,limit:r,sortBy:n,sortOrder:u})})}})})]})})})})]})}export{X as default};
1
+ import{r as c,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{l as T,q as S,P as k,T as f,G as P,h as j,i as g,Q as E,F as R,n as q,E as C,o as x,k as I}from"./time-Kh6oav5R.js";import{s as A,T as O,a as L,i as F,b as Q,F as v}from"./app-OGsLwSqJ.js";import{T as _,f as M}from"./url-Bp8sXMb4.js";import{f as B}from"./tag.api-DGfi8hWL.js";import{f as D}from"./Graph-BaqGi3M7.js";import"./useNoteMutate-BQj6jHhV.js";import"./preload-helper-BXl3LOEh.js";const G=s=>{const{data:d}=T({queryKey:S.tags.list(s.searchParams),async queryFn(){const t=await B({query:s.searchParams.query,offset:s.searchParams.offset,limit:s.searchParams.limit,sortBy:s.searchParams.sortBy,sortOrder:s.searchParams.sortOrder});if(t.type==="error")throw t;return t.allTags}});return s.render(d)},z=s=>{const[d,t]=c.useState(!1),r=c.useRef(null),n=c.useRef(!0),u=c.useRef(0),o=c.useCallback(()=>{r.current!==null&&(clearTimeout(r.current),r.current=null)},[]);c.useEffect(()=>(n.current=!0,()=>{n.current=!1,o()}),[o]);const m=c.useCallback(p=>{u.current+=1;const i=u.current;o(),n.current&&t(!0),r.current=setTimeout(()=>{r.current=null,Promise.resolve().then(p).catch(()=>{}).finally(()=>{n.current&&u.current===i&&t(!1)})},s)},[o,s]);return[d,m]},b=I(M);function X(){const s=b.useNavigate(),{page:d,query:t,limit:r,sortBy:n,sortOrder:u}=b.useSearch(),[o,m]=c.useState(t),[,p]=z(350),i=t.trim();c.useEffect(()=>{m(t)},[t]),c.useEffect(()=>{const a=o.trim();a!==i&&p(()=>{s({search:l=>({...l,page:1,query:a})})})},[o,s,i,p]);const y=a=>{s({search:l=>({...l,...a})})},w=()=>{m(""),y({page:1,query:""})};return e.jsxs(k,{title:"Tags",description:"Find tags you added with @ across your notes",children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{className:"surface-base flex min-w-0 items-center gap-2 rounded-[16px] px-3.5 py-2.5 lg:w-72",children:[e.jsx(D,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Search"}),e.jsx("div",{className:"h-5 w-px bg-divider"}),e.jsx("input",{"aria-label":"Search tags",placeholder:"Search tags",value:o,onChange:a=>m(a.target.value),className:"h-8 min-w-0 flex-1 bg-transparent text-sm font-medium text-fg-default outline-none placeholder:text-xs placeholder:font-medium placeholder:text-fg-placeholder"}),(o||i)&&e.jsx("button",{type:"button","aria-label":"Clear tag search",className:"focus-ring-soft flex h-7 w-7 shrink-0 items-center justify-center rounded-[10px] text-fg-tertiary outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default",onClick:w,children:e.jsx(P,{className:"h-3.5 w-3.5",weight:"bold"})})]}),e.jsxs("div",{className:"surface-base inline-flex flex-wrap items-center gap-3 rounded-[16px] px-3.5 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Items"}),e.jsx(j,{value:String(r),onValueChange:a=>{const l=Number(a);F(l)&&y({limit:l,page:1})},variant:"ghost",size:"sm",children:O.map(a=>e.jsx(g,{value:String(a),children:a===L?`Default (${a})`:a},a))})]}),e.jsx("div",{className:"h-5 w-px bg-divider"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Sort"}),e.jsxs(j,{value:n,onValueChange:a=>y({sortBy:a,page:1}),variant:"ghost",size:"sm",children:[e.jsx(g,{value:"referenceCount",children:"Usage"}),e.jsx(g,{value:"name",children:"Name"})]}),e.jsxs(j,{value:u,onValueChange:a=>y({sortOrder:a,page:1}),variant:"ghost",size:"sm",children:[e.jsx(g,{value:"desc",children:n==="name"?"Z to A":"Most used"}),e.jsx(g,{value:"asc",children:n==="name"?"A to Z":"Least used"})]})]})]})]}),e.jsx(E,{fallback:e.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[e.jsx(x,{width:"90px",height:"36px"}),e.jsx(x,{width:"120px",height:"36px"}),e.jsx(x,{width:"80px",height:"36px"}),e.jsx(x,{width:"100px",height:"36px"}),e.jsx(x,{width:"110px",height:"36px"}),e.jsx(x,{width:"70px",height:"36px"})]}),errorTitle:"Failed to load tags",errorDescription:"Retry loading the tag catalog",resetKeys:[d,r,i,n,u],children:e.jsx(G,{searchParams:{query:i,offset:(d-1)*r,limit:r,sortBy:n,sortOrder:u},render:({tags:a,totalCount:l})=>e.jsx(v,{fallback:e.jsx(C,{title:i?"No matching tags":"No tags yet",description:i?"Try another tag name":"Add @tags inside notes and they will appear here"}),children:a.length>0&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"flex flex-wrap gap-2.5",children:a.map(h=>e.jsxs(R,{to:_,params:{id:h.id},search:{page:1},className:"inline-flex items-center gap-1.5 rounded-full border border-border-subtle bg-hover-subtle px-3 py-1.5 text-fg-secondary transition-colors hover:border-border-secondary hover:bg-hover hover:text-fg-default",children:[e.jsx(f,{as:"span",variant:"meta",weight:"medium",className:"text-current",children:h.name}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",className:"text-current/70",children:h.referenceCount})]},h.id))}),e.jsx(v,{fallback:null,children:l&&r<l&&e.jsx(q,{page:d,last:Math.ceil(l/r),onChange:h=>{s({search:N=>({...N,page:h,query:i,limit:r,sortBy:n,sortOrder:u})})}})})]})})})})]})}export{X as default};
@@ -0,0 +1 @@
1
+ import{j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{l as x,D as N,q as j,Q as y,P as c,n as P,E as T,o,k as v}from"./time-Kh6oav5R.js";import{F as h,N as k}from"./app-OGsLwSqJ.js";import{T as q}from"./url-Bp8sXMb4.js";import"./NotePropertiesPanel-BFWjxL_w.js";import{e as w}from"./useNoteMutate-BQj6jHhV.js";import"./preload-helper-BXl3LOEh.js";import"./Graph-BaqGi3M7.js";import"./AuxiliaryPanelHeader-Bys98BJJ.js";import"./LinkSimple.es-iJvLf-MB.js";import"./Plus.es-Dmb3oijD.js";const R=s=>{const{data:r}=x({queryKey:j.notes.tagList(s.searchParams),async queryFn(){const t=await N({query:s.searchParams.query,offset:s.searchParams.offset,limit:s.searchParams.limit});if(t.type==="error")throw t;return t.tagNotes}});return s.render(r)},g=v(q);function B(){const s=g.useNavigate(),{id:r}=g.useParams(),{page:t}=g.useSearch(),i=25,{onDelete:m,onPinned:u,deleteWarningDialog:f}=w();return e.jsxs(y,{fallback:e.jsx(c,{title:"Tagged Notes",heading:e.jsx(o,{width:148,height:24,className:"rounded-full"}),description:e.jsx(o,{width:196,height:16,className:"rounded-full"}),variant:"default",children:e.jsxs("div",{className:"grid-auto-cards grid gap-5",children:[e.jsx(o,{height:"112px"}),e.jsx(o,{height:"112px"}),e.jsx(o,{height:"112px"})]})}),errorTitle:"Failed to load tagged notes",errorDescription:"Retry loading notes for this tag",resetKeys:[r,t,i],children:[e.jsx(R,{searchParams:{query:r,offset:(t-1)*i,limit:i},render:({notes:l,totalCount:n})=>{const d=l.flatMap(a=>a.tags).find(a=>a.id===r)?.name;return e.jsx(c,{title:d??"Tagged Notes",heading:d?n>0?`${d} (${n})`:d:"Tagged Notes",description:"Browse every note linked to this tag",variant:"default",children:e.jsx(h,{fallback:e.jsx(T,{title:"No tagged notes yet",description:"Notes tagged with this label will appear here"}),children:l.length>0&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"grid-auto-cards grid gap-5",children:l.map(a=>e.jsx(k,{...a,onPinned:()=>u(a.id,a.pinned),onDelete:()=>m(a.id)},a.id))}),e.jsx(h,{fallback:null,children:n&&i<n&&e.jsx(P,{page:t,last:Math.ceil(n/i),onChange:a=>{s({search:p=>({...p,page:a})})}})})]})})})}}),f]})}export{B as default};
@@ -0,0 +1 @@
1
+ import{r as a}from"./floating-ui.react-dom-BWTnA00G.js";import{C as H}from"./time-Kh6oav5R.js";const m=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"}))]]),e=a.forwardRef((t,V)=>a.createElement(H,{ref:V,...t,weights:m}));e.displayName="TrashIcon";const l=e;export{l as n};
@@ -1 +1 @@
1
- import{j as s}from"./floating-ui.react-dom-BWTnA00G.js";import{c as a}from"./time-PxWila4-.js";const m={compact:"h-[22px] px-2",regular:"h-7 px-2.5"};function c({children:e,className:n,contentClassName:r,size:t="regular",truncateContent:i=!0,...o}){return s.jsx("span",{className:a("inline-flex min-w-0 items-center overflow-hidden whitespace-nowrap rounded-full border text-xs font-medium leading-none",m[t],n),...o,children:i?s.jsx("span",{className:a("min-w-0 truncate",r),children:e}):e})}export{c as V};
1
+ import{j as s}from"./floating-ui.react-dom-BWTnA00G.js";import{c as a}from"./time-Kh6oav5R.js";const m={compact:"h-[22px] px-2",regular:"h-7 px-2.5"};function c({children:e,className:n,contentClassName:r,size:t="regular",truncateContent:i=!0,...o}){return s.jsx("span",{className:a("inline-flex min-w-0 items-center overflow-hidden whitespace-nowrap rounded-full border text-xs font-medium leading-none",m[t],n),...o,children:i?s.jsx("span",{className:a("min-w-0 truncate",r),children:e}):e})}export{c as V};