ocean-brain 0.4.1 → 0.4.2
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.
- package/package.json +3 -1
- package/server/client/dist/assets/{Calendar-D4KkvcU8.js → Calendar-DI0PhQTq.js} +1 -1
- package/server/client/dist/assets/{Callout-CaSzc-1y.js → Callout-BAqbXI0L.js} +1 -1
- package/server/client/dist/assets/{Graph-C8pBdJzV.js → Graph-Dhuog4tc.js} +1 -1
- package/server/client/dist/assets/{Image.es-C8g5NwNt.js → Image.es-COwqkQuh.js} +1 -1
- package/server/client/dist/assets/Note-ChUWU3Su.js +21 -0
- package/server/client/dist/assets/{Plus.es-Bkl1ZXE0.js → Plus.es-KeV96R_e.js} +1 -1
- package/server/client/dist/assets/{Reminders-FrTR9ny8.js → Reminders-D7MCTNxb.js} +1 -1
- package/server/client/dist/assets/{Search-BPf2LO1Y.js → Search-B-fwTr5y.js} +1 -1
- package/server/client/dist/assets/{SurfaceCard-WSk7zWeM.js → SurfaceCard-CHjcCuqZ.js} +1 -1
- package/server/client/dist/assets/{Tag-uArdLjo1.js → Tag-BbV2z-Db.js} +1 -1
- package/server/client/dist/assets/{TagNotes-DDvXHB9I.js → TagNotes-2HKF09Jm.js} +1 -1
- package/server/client/dist/assets/{Trash.es-DumPfiUz.js → Trash.es-BqRTZPrI.js} +1 -1
- package/server/client/dist/assets/{ViewNotes-BVu9lEs-.js → ViewNotes-TfM3Uzbp.js} +1 -1
- package/server/client/dist/assets/{Views-D4LGh30P.js → Views-CUwtnfa8.js} +1 -1
- package/server/client/dist/assets/{image.api-D3Ei3fbf.js → image.api-CMdQbCyN.js} +1 -1
- package/server/client/dist/assets/index-B4l2UvuC.js +232 -0
- package/server/client/dist/assets/{index-C7YGbIuA.js → index-zhxZjg7V.js} +1 -1
- package/server/client/dist/assets/{manage-image-DiuREdeE.js → manage-image-DdXb5Bkj.js} +1 -1
- package/server/client/dist/assets/{manage-image-detail-D8Eorq3u.js → manage-image-detail-CrrXCQIX.js} +1 -1
- package/server/client/dist/assets/{mcp-CvCGaYSz.js → mcp-DqGLZv90.js} +1 -1
- package/server/client/dist/assets/{placeholder-znZDfNAE.js → placeholder-BXLtvdtN.js} +1 -1
- package/server/client/dist/assets/{trash-R0sww0ur.js → trash-3eUAjFRh.js} +1 -1
- package/server/client/dist/assets/{useReminderMutate-Bkj-oIm4.js → useReminderMutate-v1EXqM90.js} +1 -1
- package/server/client/dist/assets/{view-dashboard-ClpF_qLM.js → view-dashboard-T6gmohr-.js} +1 -1
- package/server/client/dist/index.html +1 -1
- package/server/dist/app.js +2 -2
- package/server/dist/app.js.map +1 -1
- package/server/dist/features/auth/http/login-page.js +11 -4
- package/server/dist/features/auth/http/login-page.js.map +1 -1
- package/server/dist/features/auth/http/pages.js +3 -2
- package/server/dist/features/auth/http/pages.js.map +1 -1
- package/server/dist/modules/auth-guard.js +18 -0
- package/server/dist/modules/auth-guard.js.map +1 -1
- package/server/dist/modules/error-handler.js +7 -0
- package/server/dist/modules/error-handler.js.map +1 -1
- package/server/dist/modules/rate-limit.js +18 -0
- package/server/dist/modules/rate-limit.js.map +1 -0
- package/server/dist/routes/api.js +2 -1
- package/server/dist/routes/api.js.map +1 -1
- package/server/dist/routes/auth-pages.js +2 -1
- package/server/dist/routes/auth-pages.js.map +1 -1
- package/server/client/dist/assets/Note-ODOESft3.js +0 -21
- package/server/client/dist/assets/index-46ZUXbW5.js +0 -232
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/routes/api.ts"],"sourcesContent":["import { Router } from 'express';\nimport { createLoginHandler, createLogoutHandler, createSessionStatusHandler } from '../features/auth/http/api.js';\nimport { createUploadImageFromSrcHandler, createUploadImageHandler } from '../features/image/http/upload.js';\nimport {\n createMcpAdminRevokeTokenHandler,\n createMcpAdminRotateTokenHandler,\n createMcpAdminSetEnabledHandler,\n createMcpAdminStatusHandler,\n} from '../features/mcp-admin/http/handlers.js';\nimport type { McpAdminService } from '../features/mcp-admin/service.js';\nimport { requireSessionForWrite } from '../modules/auth-guard.js';\nimport type { AuthConfig } from '../modules/auth-mode.js';\nimport { createServerEventsHandler } from '../modules/server-events-handler.js';\nimport useAsync from '../modules/use-async.js';\nimport { createMcpRouter } from './mcp.js';\n\ntype McpAdminApiService = Pick<\n McpAdminService,\n 'getStatus' | 'setEnabled' | 'rotateToken' | 'revokeActiveToken' | 'validatePresentedToken'\n>;\n\nexport const createApiRouter = (authConfig: AuthConfig, mcpAdminService: McpAdminApiService) =>\n Router()\n .use('/mcp', createMcpRouter(authConfig, mcpAdminService))\n .post('/auth/login', useAsync(createLoginHandler(authConfig)))\n .post('/auth/logout', useAsync(createLogoutHandler(authConfig)))\n .get('/auth/session', useAsync(createSessionStatusHandler(authConfig)))\n .get(\n '/mcp-admin/status',\n requireSessionForWrite(authConfig),\n useAsync(createMcpAdminStatusHandler(mcpAdminService)),\n )\n .post(\n '/mcp-admin/enabled',\n requireSessionForWrite(authConfig),\n useAsync(createMcpAdminSetEnabledHandler(mcpAdminService)),\n )\n .post(\n '/mcp-admin/token/rotate',\n requireSessionForWrite(authConfig),\n useAsync(createMcpAdminRotateTokenHandler(mcpAdminService)),\n )\n .post(\n '/mcp-admin/token/revoke',\n requireSessionForWrite(authConfig),\n useAsync(createMcpAdminRevokeTokenHandler(mcpAdminService)),\n )\n .post('/image', requireSessionForWrite(authConfig), useAsync(createUploadImageHandler()))\n .post('/image-from-src', requireSessionForWrite(authConfig), useAsync(createUploadImageFromSrcHandler()))\n .get('/events', requireSessionForWrite(authConfig), createServerEventsHandler());\n"],"mappings":"AAAA,SAAS,cAAc;AACvB,SAAS,oBAAoB,qBAAqB,kCAAkC;AACpF,SAAS,iCAAiC,gCAAgC;AAC1E;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAEP,SAAS,8BAA8B;AAEvC,SAAS,iCAAiC;AAC1C,OAAO,cAAc;AACrB,SAAS,uBAAuB;AAOzB,MAAM,kBAAkB,CAAC,YAAwB,oBACpD,OAAO,EACF,IAAI,QAAQ,gBAAgB,YAAY,eAAe,CAAC,EACxD,KAAK,eAAe,SAAS,mBAAmB,UAAU,CAAC,CAAC,
|
|
1
|
+
{"version":3,"sources":["../../src/routes/api.ts"],"sourcesContent":["import { Router } from 'express';\nimport { createLoginHandler, createLogoutHandler, createSessionStatusHandler } from '../features/auth/http/api.js';\nimport { createUploadImageFromSrcHandler, createUploadImageHandler } from '../features/image/http/upload.js';\nimport {\n createMcpAdminRevokeTokenHandler,\n createMcpAdminRotateTokenHandler,\n createMcpAdminSetEnabledHandler,\n createMcpAdminStatusHandler,\n} from '../features/mcp-admin/http/handlers.js';\nimport type { McpAdminService } from '../features/mcp-admin/service.js';\nimport { requireSessionForWrite } from '../modules/auth-guard.js';\nimport type { AuthConfig } from '../modules/auth-mode.js';\nimport { createAuthAttemptRateLimit } from '../modules/rate-limit.js';\nimport { createServerEventsHandler } from '../modules/server-events-handler.js';\nimport useAsync from '../modules/use-async.js';\nimport { createMcpRouter } from './mcp.js';\n\ntype McpAdminApiService = Pick<\n McpAdminService,\n 'getStatus' | 'setEnabled' | 'rotateToken' | 'revokeActiveToken' | 'validatePresentedToken'\n>;\n\nexport const createApiRouter = (authConfig: AuthConfig, mcpAdminService: McpAdminApiService) =>\n Router()\n .use('/mcp', createMcpRouter(authConfig, mcpAdminService))\n .post('/auth/login', createAuthAttemptRateLimit(), useAsync(createLoginHandler(authConfig)))\n .post('/auth/logout', useAsync(createLogoutHandler(authConfig)))\n .get('/auth/session', useAsync(createSessionStatusHandler(authConfig)))\n .get(\n '/mcp-admin/status',\n requireSessionForWrite(authConfig),\n useAsync(createMcpAdminStatusHandler(mcpAdminService)),\n )\n .post(\n '/mcp-admin/enabled',\n requireSessionForWrite(authConfig),\n useAsync(createMcpAdminSetEnabledHandler(mcpAdminService)),\n )\n .post(\n '/mcp-admin/token/rotate',\n requireSessionForWrite(authConfig),\n useAsync(createMcpAdminRotateTokenHandler(mcpAdminService)),\n )\n .post(\n '/mcp-admin/token/revoke',\n requireSessionForWrite(authConfig),\n useAsync(createMcpAdminRevokeTokenHandler(mcpAdminService)),\n )\n .post('/image', requireSessionForWrite(authConfig), useAsync(createUploadImageHandler()))\n .post('/image-from-src', requireSessionForWrite(authConfig), useAsync(createUploadImageFromSrcHandler()))\n .get('/events', requireSessionForWrite(authConfig), createServerEventsHandler());\n"],"mappings":"AAAA,SAAS,cAAc;AACvB,SAAS,oBAAoB,qBAAqB,kCAAkC;AACpF,SAAS,iCAAiC,gCAAgC;AAC1E;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAEP,SAAS,8BAA8B;AAEvC,SAAS,kCAAkC;AAC3C,SAAS,iCAAiC;AAC1C,OAAO,cAAc;AACrB,SAAS,uBAAuB;AAOzB,MAAM,kBAAkB,CAAC,YAAwB,oBACpD,OAAO,EACF,IAAI,QAAQ,gBAAgB,YAAY,eAAe,CAAC,EACxD,KAAK,eAAe,2BAA2B,GAAG,SAAS,mBAAmB,UAAU,CAAC,CAAC,EAC1F,KAAK,gBAAgB,SAAS,oBAAoB,UAAU,CAAC,CAAC,EAC9D,IAAI,iBAAiB,SAAS,2BAA2B,UAAU,CAAC,CAAC,EACrE;AAAA,EACG;AAAA,EACA,uBAAuB,UAAU;AAAA,EACjC,SAAS,4BAA4B,eAAe,CAAC;AACzD,EACC;AAAA,EACG;AAAA,EACA,uBAAuB,UAAU;AAAA,EACjC,SAAS,gCAAgC,eAAe,CAAC;AAC7D,EACC;AAAA,EACG;AAAA,EACA,uBAAuB,UAAU;AAAA,EACjC,SAAS,iCAAiC,eAAe,CAAC;AAC9D,EACC;AAAA,EACG;AAAA,EACA,uBAAuB,UAAU;AAAA,EACjC,SAAS,iCAAiC,eAAe,CAAC;AAC9D,EACC,KAAK,UAAU,uBAAuB,UAAU,GAAG,SAAS,yBAAyB,CAAC,CAAC,EACvF,KAAK,mBAAmB,uBAAuB,UAAU,GAAG,SAAS,gCAAgC,CAAC,CAAC,EACvG,IAAI,WAAW,uBAAuB,UAAU,GAAG,0BAA0B,CAAC;","names":[]}
|
|
@@ -4,7 +4,8 @@ import {
|
|
|
4
4
|
createLoginPageSubmitHandler,
|
|
5
5
|
createLogoutPageHandler
|
|
6
6
|
} from "../features/auth/http/pages.js";
|
|
7
|
-
|
|
7
|
+
import { createAuthAttemptRateLimit } from "../modules/rate-limit.js";
|
|
8
|
+
const createAuthPagesRouter = (authConfig) => Router().get("/login", createLoginPageHandler(authConfig)).post("/login", createAuthAttemptRateLimit(), createLoginPageSubmitHandler(authConfig)).post("/logout", createLogoutPageHandler(authConfig));
|
|
8
9
|
export {
|
|
9
10
|
createAuthPagesRouter
|
|
10
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/routes/auth-pages.ts"],"sourcesContent":["import { Router } from 'express';\nimport {\n createLoginPageHandler,\n createLoginPageSubmitHandler,\n createLogoutPageHandler,\n} from '../features/auth/http/pages.js';\nimport type { AuthConfig } from '../modules/auth-mode.js';\n\nexport const createAuthPagesRouter = (authConfig: AuthConfig) =>\n Router()\n .get('/login', createLoginPageHandler(authConfig))\n .post('/login', createLoginPageSubmitHandler(authConfig))\n .post('/logout', createLogoutPageHandler(authConfig));\n"],"mappings":"AAAA,SAAS,cAAc;AACvB;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,OACG;
|
|
1
|
+
{"version":3,"sources":["../../src/routes/auth-pages.ts"],"sourcesContent":["import { Router } from 'express';\nimport {\n createLoginPageHandler,\n createLoginPageSubmitHandler,\n createLogoutPageHandler,\n} from '../features/auth/http/pages.js';\nimport type { AuthConfig } from '../modules/auth-mode.js';\nimport { createAuthAttemptRateLimit } from '../modules/rate-limit.js';\n\nexport const createAuthPagesRouter = (authConfig: AuthConfig) =>\n Router()\n .get('/login', createLoginPageHandler(authConfig))\n .post('/login', createAuthAttemptRateLimit(), createLoginPageSubmitHandler(authConfig))\n .post('/logout', createLogoutPageHandler(authConfig));\n"],"mappings":"AAAA,SAAS,cAAc;AACvB;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAEP,SAAS,kCAAkC;AAEpC,MAAM,wBAAwB,CAAC,eAClC,OAAO,EACF,IAAI,UAAU,uBAAuB,UAAU,CAAC,EAChD,KAAK,UAAU,2BAA2B,GAAG,6BAA6B,UAAU,CAAC,EACrF,KAAK,WAAW,wBAAwB,UAAU,CAAC;","names":[]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{j as e,i as G,k as Ie,U as me,y as ue,v as Pe,X as _e,F as ze}from"./note-vendor-B0t5F04o.js";import{p as W,T as p,c as H,M as v,r as X,B as C,w as Ue,u as Ye,ae as qe,q as M,af as Ke,ag as Qe,d as N,W as pe,a5 as he,ah as Ge,l as _,I as We,m as Xe,n as Je,o as z,g as et,ai as tt,_ as fe,D as xe,k as ge,aj as ye,ak as at,al as be,a3 as ve,N as J,ac as nt,x as st,am as rt,a4 as ot,$ as K,P as ee,a2 as Q,j as lt,i as V,an as it,ao as ct,ap as dt,aq as mt,ar as oe,as as ut,L as pt,at as le}from"./index-46ZUXbW5.js";import{a as n}from"./graph-vendor-CUxe67Lr.js";import{C as ht}from"./Callout-CaSzc-1y.js";import{u as ft,R as xt}from"./useReminderMutate-Bkj-oIm4.js";import{n as gt}from"./Plus.es-Bkl1ZXE0.js";import{u as yt}from"./image.api-D3Ei3fbf.js";import{A as bt,F as vt,a2 as je,a3 as jt}from"./note-core-GgFcksAF.js";const wt=new Map([["bold",n.createElement(n.Fragment,null,n.createElement("path",{d:"M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z"}))],["duotone",n.createElement(n.Fragment,null,n.createElement("path",{d:"M216,40V168H168V88H88V40Z",opacity:"0.2"}),n.createElement("path",{d:"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"}))],["fill",n.createElement(n.Fragment,null,n.createElement("path",{d:"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32Zm-8,128H176V88a8,8,0,0,0-8-8H96V48H208Z"}))],["light",n.createElement(n.Fragment,null,n.createElement("path",{d:"M216,34H88a6,6,0,0,0-6,6V82H40a6,6,0,0,0-6,6V216a6,6,0,0,0,6,6H168a6,6,0,0,0,6-6V174h42a6,6,0,0,0,6-6V40A6,6,0,0,0,216,34ZM162,210H46V94H162Zm48-48H174V88a6,6,0,0,0-6-6H94V46H210Z"}))],["regular",n.createElement(n.Fragment,null,n.createElement("path",{d:"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"}))],["thin",n.createElement(n.Fragment,null,n.createElement("path",{d:"M216,36H88a4,4,0,0,0-4,4V84H40a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H168a4,4,0,0,0,4-4V172h44a4,4,0,0,0,4-4V40A4,4,0,0,0,216,36ZM164,212H44V92H164Zm48-48H172V88a4,4,0,0,0-4-4H92V44H212Z"}))]]),Ct=new Map([["bold",n.createElement(n.Fragment,null,n.createElement("path",{d:"M216.49,79.52l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40V216a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V88A12,12,0,0,0,216.49,79.52ZM160,57l23,23H160ZM60,212V44h76V92a12,12,0,0,0,12,12h48V212Z"}))],["duotone",n.createElement(n.Fragment,null,n.createElement("path",{d:"M208,88H152V32Z",opacity:"0.2"}),n.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Z"}))],["fill",n.createElement(n.Fragment,null,n.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM152,88V44l44,44Z"}))],["light",n.createElement(n.Fragment,null,n.createElement("path",{d:"M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40V216a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158ZM200,218H56a2,2,0,0,1-2-2V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V216A2,2,0,0,1,200,218Z"}))],["regular",n.createElement(n.Fragment,null,n.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Z"}))],["thin",n.createElement(n.Fragment,null,n.createElement("path",{d:"M210.83,85.17l-56-56A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40V216a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V88A4,4,0,0,0,210.83,85.17ZM156,41.65,198.34,84H156ZM200,220H56a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52V216A4,4,0,0,1,200,220Z"}))]]),Nt=new Map([["bold",n.createElement(n.Fragment,null,n.createElement("path",{d:"M87.5,151.52l64-64a12,12,0,0,1,17,17l-64,64a12,12,0,0,1-17-17Zm131-114a60.08,60.08,0,0,0-84.87,0L103.51,67.61a12,12,0,0,0,17,17l30.07-30.06a36,36,0,0,1,50.93,50.92L171.4,135.52a12,12,0,1,0,17,17l30.08-30.06A60.09,60.09,0,0,0,218.45,37.55ZM135.52,171.4l-30.07,30.08a36,36,0,0,1-50.92-50.93l30.06-30.07a12,12,0,0,0-17-17L37.55,133.58a60,60,0,0,0,84.88,84.87l30.06-30.07a12,12,0,0,0-17-17Z"}))],["duotone",n.createElement(n.Fragment,null,n.createElement("path",{d:"M209.94,113.94l-96,96a48,48,0,0,1-67.88-67.88l96-96a48,48,0,0,1,67.88,67.88Z",opacity:"0.2"}),n.createElement("path",{d:"M165.66,90.34a8,8,0,0,1,0,11.32l-64,64a8,8,0,0,1-11.32-11.32l64-64A8,8,0,0,1,165.66,90.34ZM215.6,40.4a56,56,0,0,0-79.2,0L106.34,70.45a8,8,0,0,0,11.32,11.32l30.06-30a40,40,0,0,1,56.57,56.56l-30.07,30.06a8,8,0,0,0,11.31,11.32L215.6,119.6a56,56,0,0,0,0-79.2ZM138.34,174.22l-30.06,30.06a40,40,0,1,1-56.56-56.57l30.05-30.05a8,8,0,0,0-11.32-11.32L40.4,136.4a56,56,0,0,0,79.2,79.2l30.06-30.07a8,8,0,0,0-11.32-11.31Z"}))],["fill",n.createElement(n.Fragment,null,n.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,32ZM144.56,173.66l-21.45,21.45a44,44,0,0,1-62.22-62.22l21.45-21.46a8,8,0,0,1,11.32,11.31L72.2,144.2a28,28,0,0,0,39.6,39.6l21.45-21.46a8,8,0,0,1,11.31,11.32Zm-34.9-16a8,8,0,0,1-11.32-11.32l48-48a8,8,0,0,1,11.32,11.32Zm85.45-34.55-21.45,21.45a8,8,0,0,1-11.32-11.31L183.8,111.8a28,28,0,0,0-39.6-39.6L122.74,93.66a8,8,0,0,1-11.31-11.32l21.46-21.45a44,44,0,0,1,62.22,62.22Z"}))],["light",n.createElement(n.Fragment,null,n.createElement("path",{d:"M164.25,91.75a6,6,0,0,1,0,8.49l-64,64a6,6,0,0,1-8.49-8.48l64-64A6,6,0,0,1,164.25,91.75ZM214.2,41.8a54.07,54.07,0,0,0-76.38,0L107.75,71.85a6,6,0,0,0,8.49,8.49l30.07-30.06a42,42,0,0,1,59.41,59.41l-30.08,30.07a6,6,0,1,0,8.49,8.49l30.07-30.07A54,54,0,0,0,214.2,41.8ZM139.76,175.64l-30.07,30.08a42,42,0,0,1-59.41-59.41l30.06-30.07a6,6,0,0,0-8.49-8.49l-30,30.07a54,54,0,0,0,76.38,76.39l30.07-30.08a6,6,0,0,0-8.49-8.49Z"}))],["regular",n.createElement(n.Fragment,null,n.createElement("path",{d:"M165.66,90.34a8,8,0,0,1,0,11.32l-64,64a8,8,0,0,1-11.32-11.32l64-64A8,8,0,0,1,165.66,90.34ZM215.6,40.4a56,56,0,0,0-79.2,0L106.34,70.45a8,8,0,0,0,11.32,11.32l30.06-30a40,40,0,0,1,56.57,56.56l-30.07,30.06a8,8,0,0,0,11.31,11.32L215.6,119.6a56,56,0,0,0,0-79.2ZM138.34,174.22l-30.06,30.06a40,40,0,1,1-56.56-56.57l30.05-30.05a8,8,0,0,0-11.32-11.32L40.4,136.4a56,56,0,0,0,79.2,79.2l30.06-30.07a8,8,0,0,0-11.32-11.31Z"}))],["thin",n.createElement(n.Fragment,null,n.createElement("path",{d:"M162.84,93.16a4,4,0,0,1,0,5.66l-64,64a4,4,0,0,1-5.66-5.66l64-64A4,4,0,0,1,162.84,93.16Zm49.95-49.95a52.07,52.07,0,0,0-73.56,0L109.17,73.27a4,4,0,0,0,5.65,5.66l30.07-30.06a44,44,0,0,1,62.24,62.24l-30.07,30.06a4,4,0,0,0,5.66,5.66l30.07-30.06A52.07,52.07,0,0,0,212.79,43.21ZM141.17,177.06l-30.06,30.07a44,44,0,0,1-62.24-62.24l30.06-30.06a4,4,0,0,0-5.66-5.66L43.21,139.23a52,52,0,0,0,73.56,73.56l30.06-30.07a4,4,0,1,0-5.66-5.66Z"}))]]),we=n.forwardRef((t,a)=>n.createElement(W,{ref:a,...t,weights:wt}));we.displayName="CopyIcon";const kt=we,Ce=n.forwardRef((t,a)=>n.createElement(W,{ref:a,...t,weights:Ct}));Ce.displayName="FileIcon";const Mt=Ce,Ne=n.forwardRef((t,a)=>n.createElement(W,{ref:a,...t,weights:Nt}));Ne.displayName="LinkSimpleIcon";const Ht=Ne;function te({icon:t,title:a,className:s}){return e.jsxs("div",{className:H("flex items-center gap-2",s),children:[e.jsx("div",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center text-current",children:t}),e.jsx(p,{as:"span",variant:"label",weight:"semibold",className:"text-current",children:a})]})}function D({title:t,description:a,selected:s=!1,onClick:o,children:r}){return e.jsxs("button",{type:"button","aria-pressed":s,className:`focus-ring-soft flex w-full items-start justify-between gap-3 p-3 text-left transition-colors sm:p-4 ${s?"surface-floating bg-elevated":"rounded-[14px] border border-border-subtle bg-transparent hover:border-border-secondary hover:bg-hover-subtle"}`,onClick:o,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(p,{as:"div",variant:"body",weight:"semibold",tone:s?"default":"secondary",children:t}),e.jsx(p,{as:"div",variant:"meta",weight:"medium",tone:s?"secondary":"tertiary",className:"mt-1",children:a})]}),r?e.jsx("div",{className:"shrink-0",children:r}):null]})}const Et=[{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 At({isOpen:t,onClose:a,onSave:s,currentLayout:o="wide"}){const[r,c]=n.useState(o);n.useEffect(()=>{t&&c(o)},[t,o]);const i=()=>{s(r),a()};return e.jsxs(v,{isOpen:t,onClose:a,variant:"compact",children:[e.jsx(v.Header,{title:"Layout Settings",onClose:a}),e.jsx(v.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(p,{as:"div",variant:"body",weight:"semibold",tone:"secondary",children:"Note layout"}),e.jsx("div",{className:"flex flex-col gap-2",children:Et.map(l=>e.jsx(D,{title:l.label,description:l.description,selected:r===l.value,onClick:()=>c(l.value)},l.value))})]})})}),e.jsx(v.Footer,{children:e.jsxs(X,{children:[e.jsx(C,{variant:"ghost",size:"sm",onClick:a,children:"Cancel"}),e.jsx(C,{variant:"primary",size:"sm",onClick:i,children:"Apply"})]})})]})}const Tt=(t,a)=>t||(a==="mobile"?"Mobile browser":a==="mcp"?"MCP":"Web browser");function Rt({isOpen:t,noteId:a,onClose:s,onRestored:o}){const r=pe(),c=Ue(),i=Ye({queryKey:M.notes.snapshots(a),queryFn:async()=>{const m=await qe(a);if(m.type==="error")throw m;return m.noteSnapshots},enabled:t}),l=Ke({mutationFn:Qe,onSuccess:async m=>{if(m.type==="error"){r(m.errors[0].message);return}await Promise.all([c.invalidateQueries({queryKey:M.notes.detail(a),exact:!0}),c.invalidateQueries({queryKey:M.notes.listAll(),exact:!1}),c.invalidateQueries({queryKey:M.notes.tagListAll(),exact:!1}),c.invalidateQueries({queryKey:M.notes.pinned(),exact:!0}),c.invalidateQueries({queryKey:M.notes.backReferences(a),exact:!0}),c.invalidateQueries({queryKey:M.notes.snapshots(a),exact:!1})]),r("Previous version restored."),o?.(m.restoreNoteSnapshot),s()}});return e.jsxs(v,{isOpen:t,onClose:s,variant:"inspect",children:[e.jsx(v.Header,{title:"Restore Previous Version",onClose:s}),e.jsx(v.Body,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(p,{as:"p",variant:"meta",tone:"secondary",children:"Choose a previous snapshot to restore this note back to that state."}),i.isLoading&&e.jsx(p,{as:"div",variant:"meta",tone:"secondary",children:"Loading previous versions..."}),!i.isLoading&&i.data?.length===0&&e.jsx(p,{as:"div",variant:"meta",tone:"secondary",className:"rounded-[14px] border border-border-subtle bg-hover-subtle/50 px-4 py-3",children:"A recovery snapshot appears before the first edit in a session. Up to five recent snapshots are kept automatically, and identical versions are skipped."}),!i.isLoading&&i.data&&i.data.length>0&&e.jsx("div",{className:"flex flex-col gap-2",children:i.data.map(m=>e.jsx("div",{className:"surface-base p-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs(p,{as:"p",variant:"body",weight:"semibold",children:["Before"," ",Tt(m.meta.label,m.meta.entrypoint)," ","edit"]}),e.jsx(p,{as:"p",variant:"meta",truncate:!0,tone:"secondary",children:m.title}),e.jsx(p,{as:"p",variant:"label",tone:"tertiary",children:N(m.createdAt).format("YYYY-MM-DD HH:mm:ss")})]}),e.jsx(C,{size:"sm",isLoading:l.isPending,onClick:()=>l.mutate(m.id),children:"Restore"})]})},m.id))})]})})]})}const St=t=>{const{data:a}=he({queryKey:M.notes.backReferences(t.noteId),async queryFn(){const s=await Ge(t.noteId);if(s.type==="error")throw s;return s.backReferences}});return t.render(a)},ie={low:{active:"border-border-secondary bg-elevated text-fg-default",inactive:"border-transparent bg-transparent text-fg-muted hover:bg-hover-subtle"},medium:{active:"border-border-secondary bg-elevated text-fg-default",inactive:"border-transparent bg-transparent text-fg-muted hover:bg-hover-subtle"},high:{active:"border-border-secondary bg-elevated text-fg-default",inactive:"border-transparent bg-transparent text-fg-muted hover:bg-hover-subtle"}};function Vt({isOpen:t,onClose:a,onSave:s,reminder:o,mode:r}){const[c,i]=n.useState(new Date),[l,m]=n.useState("medium"),[j,f]=n.useState("");n.useEffect(()=>{t&&r==="edit"&&o?(i(new Date(Number(o.reminderDate))),m(o.priority||"medium"),f(o.content||"")):t&&r==="create"&&(i(new Date),m("medium"),f(""))},[t,r,o]);const E=()=>{s(c,l,j||void 0),a()},y=x=>l===x?ie[x].active:ie[x].inactive;return e.jsxs(v,{isOpen:t,onClose:a,variant:"form",children:[e.jsx(v.Header,{title:r==="create"?"Create Reminder":"Edit Reminder",onClose:a}),e.jsx(v.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(_,{children:"Date & Time"}),e.jsx(We,{type:"datetime-local",size:"sm",value:N(c).format("YYYY-MM-DDTHH:mm"),onChange:x=>i(new Date(x.target.value))})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(_,{children:"Content"}),e.jsx(Xe,{size:"sm",placeholder:"Enter reminder content (optional)",value:j,onChange:x=>f(x.target.value)})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(_,{children:"Priority"}),e.jsxs(Je,{type:"single",value:l,onValueChange:x=>x&&m(x),className:"gap-1.5 border-none rounded-[14px] bg-muted/70 p-1 sm:gap-2",children:[e.jsx(z,{value:"low",className:`flex-1 rounded-[10px] border ${y("low")}`,children:e.jsx(p,{as:"span",weight:"medium",className:"text-current",children:"Low"})}),e.jsx(z,{value:"medium",className:`flex-1 rounded-[10px] border ${y("medium")}`,children:e.jsx(p,{as:"span",weight:"medium",className:"text-current",children:"Medium"})}),e.jsx(z,{value:"high",className:`flex-1 rounded-[10px] border ${y("high")}`,children:e.jsx(p,{as:"span",weight:"medium",className:"text-current",children:"High"})})]})]})]})}),e.jsx(v.Footer,{children:e.jsxs(X,{children:[e.jsx(C,{variant:"ghost",size:"sm",onClick:a,children:"Cancel"}),e.jsx(C,{variant:"primary",size:"sm",onClick:E,children:r==="create"?"Create":"Save"})]})})]})}function Lt({noteId:t}){const[a,s]=n.useState(!1),[o,r]=n.useState(!1),[c,i]=n.useState("create"),[l,m]=n.useState(void 0),{onCreate:j,onUpdate:f,onDelete:E}=ft(),y=()=>{i("create"),m(void 0),r(!0)},x=h=>{i("edit"),m(h),r(!0)},A=(h,b,u)=>{c==="create"?j(t,h,b,()=>{r(!1)},u):c==="edit"&&l&&f(l.id,t,{reminderDate:h,priority:b,content:u},()=>{r(!1)})},T=h=>{f(h.id,t,{completed:!h.completed})},S=h=>{const b=N(Number(h)),u=N();return b.isSame(u,"day")?`Today at ${b.format("HH:mm")}`:b.isSame(u.add(1,"day"),"day")?`Tomorrow at ${b.format("HH:mm")}`:b.format("YYYY-MM-DD HH:mm")},Z=h=>{const b=N(Number(h)),u=N(),w=b.diff(u,"hour");return w<=6?"high":w<=24?"medium":"low"},B=h=>{const b=N(Number(h)),u=N(),w=b.diff(u,"hour"),k=b.diff(u,"minute")%60;return w<0||k<0?"Overdue":w===0?`${k}m remaining`:`${w}h ${k}m remaining`};return e.jsxs("div",{className:"surface-base mb-5 p-4",children:[e.jsxs("div",{className:H("flex items-center justify-between",!a&&"mb-3"),children:[e.jsx("button",{type:"button",onClick:()=>s(!a),className:"focus-ring-soft flex items-center gap-2 rounded-[10px] px-2 py-1.5 text-fg-tertiary transition-colors hover:bg-hover-subtle hover:text-fg-default",children:e.jsx(te,{icon:a?e.jsx(et,{size:12}):e.jsx(tt,{size:12}),title:"Reminders"})}),!a&&e.jsxs(C,{size:"sm",variant:"ghost",onClick:y,children:[e.jsx(gt,{className:"w-3 h-3"}),e.jsx(p,{as:"span",variant:"label",className:"hidden sm:inline",children:"Add"})]})]}),!a&&e.jsx(xt,{noteId:t,searchParams:{offset:0,limit:9999},render:({reminders:h,totalCount:b})=>e.jsx("div",{className:"flex flex-col gap-2",children:h.length===0?e.jsx(p,{as:"p",variant:"meta",tone:"secondary",className:"py-3 text-center",children:b===0?"No reminders yet":"All reminders complete"}):e.jsx("div",{className:"flex flex-col",children:h.map(u=>{const w=u.priority||Z(u.reminderDate),k=B(u.reminderDate),L=k==="Overdue";return e.jsxs("div",{className:H("flex items-center gap-2.5 px-2 py-1.5"),children:[e.jsx(fe,{checked:u.completed,onChange:()=>T(u),size:"sm"}),e.jsx(p,{as:"div",variant:"body",weight:"medium",className:H("truncate flex-1 min-w-0",u.completed&&"line-through opacity-40"),children:u.content||S(u.reminderDate)}),e.jsxs("div",{className:H("shrink-0 flex items-center gap-1",u.completed&&"opacity-40"),children:[u.content&&e.jsx(p,{as:"span",variant:"meta",tone:"secondary",children:S(u.reminderDate)}),!u.completed&&e.jsx(p,{as:"span",variant:"label",weight:"medium",tone:L||w==="high"?"error":"tertiary",className:H(u.content&&'before:content-["·"] before:mr-1'),children:k})]}),e.jsx(xe,{button:e.jsx(ge,{label:"Reminder actions"}),items:[{name:"Edit",onClick:()=>x(u)},{name:"Delete",onClick:()=>E(u.id,t)}]})]},u.id)})})})}),e.jsx(Vt,{isOpen:o,onClose:()=>r(!1),onSave:A,reminder:l,mode:c})]})}const Ft=({editor:t})=>e.jsx(G,{triggerCharacter:"/",getItems:async a=>bt([...Ie(t).filter(s=>s.title!=="Audio"&&s.title!=="Video"&&s.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(ye,{})}],a)}),Dt=(t,a)=>a?t.filter(s=>s.id!==a):t,Zt=({currentNoteId:t,onClick:a})=>e.jsx(G,{triggerCharacter:"[",getItems:async s=>{const o=await at({query:s,limit:5});return o.type==="error"?[]:Dt(o.allNotes.notes,t).map(c=>({title:c.title,onItemClick:()=>a({type:"reference",props:{id:c.id,title:c.title}})}))}}),$t="pointer-events-auto inline-flex h-7 cursor-pointer select-none items-center gap-1.5 rounded-[8px] border border-white/10 bg-white/10 px-2.5 text-xs font-medium text-white/60 opacity-75 shadow-[0_8px_18px_-14px_rgba(0,0,0,0.45)] backdrop-blur-sm transition-colors hover:bg-white/20 hover:text-white/90 hover:opacity-100 focus-ring-soft focus:text-white/90 focus:opacity-100",Ot={idle:"",copied:"text-accent-success hover:text-accent-success focus:text-accent-success",failed:"text-fg-error hover:text-fg-error focus:text-fg-error"},Bt={idle:"Copy",copied:"Copied",failed:"Copy failed"},It=({getText:t,resetDelayMs:a=2e3})=>{const[s,o]=n.useState("idle"),r=n.useRef(null),c=n.useCallback(()=>{r.current&&(clearTimeout(r.current),r.current=null)},[]),i=n.useCallback(()=>{c(),r.current=setTimeout(()=>{o("idle"),r.current=null},a)},[c,a]);n.useEffect(()=>c,[c]);const l=f=>{f.stopPropagation()},m=f=>{f.preventDefault(),f.stopPropagation()},j=async f=>{l(f);try{await navigator.clipboard.writeText(t()),o("copied")}catch{o("failed")}i()};return e.jsx("div",{className:"pointer-events-none absolute right-3 top-2 z-[1]",contentEditable:!1,onMouseDown:m,children:e.jsxs("button",{type:"button",className:H($t,Ot[s]),contentEditable:!1,onClick:j,children:[e.jsx(kt,{className:"h-3.5 w-3.5"}),e.jsx("span",{"aria-live":"polite",children:Bt[s]})]})})},Pt=({contentRef:t})=>{const a=n.useRef(null),s=n.useCallback(o=>{a.current=o,t(o)},[t]);return e.jsxs(e.Fragment,{children:[e.jsx("pre",{children:e.jsx("code",{ref:s})}),e.jsx(It,{getText:()=>a.current?.textContent?.trimEnd()??""})]})},_t="_Reference_102im_1",zt={Reference:_t},Ut=be.bind(zt),Yt={type:"reference",propSchema:{id:{default:""},title:{default:"Unknown"}},content:"none"};function qt(t){const a=ve(),s=()=>{t.editor.blur(),a({to:J,params:{id:t.inlineContent.props.id}})},o=r=>{r.preventDefault(),r.stopPropagation()};return e.jsx("span",{role:"link",tabIndex:0,contentEditable:!1,className:Ut("Reference"),onMouseDown:o,onClick:r=>{o(r),s()},onKeyDown:r=>{r.key!=="Enter"&&r.key!==" "||(o(r),s())},children:e.jsxs("span",{children:["[",t.inlineContent.props.title,"]"]})})}const Kt=me(Yt,{render:t=>e.jsx(qt,{...t})}),Qt=()=>{const t=Pe(),[a,s]=n.useState([]),o={1:"pl-3",2:"pl-[26px]",3:"pl-[40px]",4:"pl-[54px]",5:"pl-[68px]",6:"pl-[82px]"};n.useEffect(()=>{const i=()=>{const m=t.document,j=[],f=E=>{for(const y of E){if(y.type==="heading"){const x=y,A=x.props.level||1,T=x.content?.map(S=>S.text||"").join("")||"";T.trim()&&j.push({id:y.id,level:A,text:T})}y.children&&Array.isArray(y.children)&&f(y.children)}};f(m),s(j)};i();const l=t.onChange?.(i);return()=>{l&&l()}},[t]);const r=i=>{t.setTextCursorPosition(i);const l=document.querySelector(`[data-id="${i}"]`);l&&l.scrollIntoView({behavior:"smooth",block:"center"})},c=e.jsx(te,{icon:e.jsx(ye,{className:"h-3.5 w-3.5"}),title:"Table of Contents",className:"text-fg-tertiary"});return a.length===0?e.jsxs("div",{className:"surface-base w-full p-4",children:[c,e.jsx(p,{as:"p",variant:"meta",tone:"secondary",className:"mt-2",children:"Add headings to your document to generate a table of contents"})]}):e.jsxs("div",{className:"surface-base w-full p-4",children:[e.jsx("div",{className:"mb-2",children:c}),e.jsx("nav",{className:"space-y-0.5",children:a.map(i=>{const l=i.level===1;return e.jsxs("button",{type:"button",onClick:()=>r(i.id),className:H("focus-ring-soft","flex","w-full","items-center","gap-2","rounded-[10px]","px-2.5","py-1.5",o[i.level]??"pl-2.5","text-left","transition-colors","hover:bg-hover-subtle",l?"text-fg-default":"text-fg-secondary"),children:[e.jsxs(p,{as:"span",variant:"label",weight:"medium",tone:"tertiary",className:"min-w-[1.5rem]",children:["H",i.level]}),e.jsx(p,{as:"span",variant:"body",weight:l?"semibold":"medium",className:"line-clamp-2 text-current",children:i.text})]},i.id)})})]})},Gt=ue({type:"tableOfContents",propSchema:{},content:"none"},{render:()=>e.jsx(Qt,{})})(),Wt="_Tag_1gb8h_1",Xt={Tag:Wt},Jt=be.bind(Xt),ea={type:"tag",propSchema:{id:{default:""},tag:{default:"@Unknown"}},content:"none"};function ta(t){const a=ve(),s=()=>{t.editor.blur(),a({to:nt,params:{id:t.inlineContent.props.id},search:{page:1}})},o=r=>{r.preventDefault(),r.stopPropagation()};return e.jsx("span",{role:"link",tabIndex:0,contentEditable:!1,className:Jt("Tag"),onMouseDown:o,onClick:r=>{o(r),s()},onKeyDown:r=>{r.key!=="Enter"&&r.key!==" "||(o(r),s())},children:e.jsx("span",{children:t.inlineContent.props.tag})})}const aa=me(ea,{render:t=>e.jsx(ta,{...t})}),na=t=>t,sa=t=>t,ra=na({tag:aa,reference:Kt}),oa=sa({tableOfContents:Gt}),R=je.codeBlock,ce=ue(R.config,{meta:R.implementation.meta,parse:R.implementation.parse,parseContent:R.implementation.parseContent,runsBefore:R.implementation.runsBefore,render:Pt})(),la={...ce,extensions:R.extensions,implementation:{...ce.implementation,toExternalHTML:R.implementation.toExternalHTML}},ia=vt.create({inlineContentSpecs:{...jt,...ra},blockSpecs:{...je,codeBlock:la,...oa}}),ca=(t,a)=>a.some(s=>s.name===`@${t}`),da=({onClick:t})=>e.jsx(G,{triggerCharacter:"@",getItems:async a=>{const s=await st({query:a,limit:5});if(s.type==="error")return[];const{tags:o}=s.allTags,r=ca(a,o),c=[{title:"Add a new tag",onItemClick:async()=>{const i=await rt({name:"@"+a});if(i.type==="error")return;const{id:l,name:m}=i.createTag;t({type:"tag",props:{id:l,tag:m}})}}];return o.length===0?c:o.map(i=>({title:i.name,onItemClick:()=>t({type:"tag",props:{id:i.id,tag:i.name}})})).concat(a&&!r?c:[])}}),ma=new Set(["tableOfContents"]),ua="OCEAN_BRAIN_TAG_",pa="_TOKEN",ha=t=>`${ua}${t}${pa}`,fa=t=>!Array.isArray(t)&&t?.type==="tableContent",xa=(t,a)=>Array.isArray(t)?t.map(a):fa(t)?{...t,rows:t.rows?.map(s=>({...s,cells:s.cells?.map(o=>({...o,content:o.content?.map(a)}))}))}:t,ke=(t,a)=>t.filter(s=>!ma.has(s.type)).map(s=>({...s,content:a(s.content),children:s.children?.length?ke(s.children,a):[]}));function ga(t){const a=new Map;let s=0;return{blocks:ke(t,r=>xa(r,c=>{if(c.type==="reference")return{type:"text",text:`[[${c.props?.title||c.props?.id||""}]]`,styles:{}};if(c.type==="tag"){const i=c.props?.tag||"",l=ha(s);return s+=1,a.set(l,i),{type:"text",text:l,styles:{}}}return c})),placeholderToTag:a}}function ya(t,a){let s=t;for(const[o,r]of a.entries())s=s.split(o).join(`[${r}]`);return s}async function ba(t){return new Promise((a,s)=>{const o=new FileReader;o.readAsDataURL(t),o.onload=()=>a(o.result),o.onerror=r=>s(r)})}const va=n.forwardRef(({content:t,currentNoteId:a,editable:s,onChange:o},r)=>{const{theme:c}=ot(l=>l),i=_e({schema:ia,initialContent:t&&JSON.parse(t)||void 0,uploadFile:async l=>yt({base64:await ba(l)})},[]);return n.useImperativeHandle(r,()=>({getContent:()=>JSON.stringify(i.document),getMarkdown:()=>{const l=ga(i.document),m=i.blocksToMarkdownLossy(l.blocks);return ya(m,l.placeholderToTag)},getHtml:()=>i.blocksToHTMLLossy(i.document)})),e.jsxs(ze,{slashMenu:!1,theme:c,editor:i,editable:s,onChange:o,children:[e.jsx(Ft,{editor:i}),e.jsx(Zt,{currentNoteId:a,onClick:l=>{i.insertInlineContent([l," "])}}),e.jsx(da,{onClick:l=>{i.insertInlineContent([l," "])}})]})}),ja=/[:{}[\],&*#?|<>=!%@`-]/,wa=t=>t.trim().toLowerCase().replace(/\s+/g,"-").replace(/[\\/:*?"<>|]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||"untitled-note",Ca=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),$=t=>t?ja.test(t)||/^\s|\s$/.test(t)?JSON.stringify(t):t:'""',O=t=>{if(!t)return;const a=Number(t);return Number.isFinite(a)?new Date(a).toISOString():t},U=(t,a)=>`${wa(t)}.${a}`,Na=({id:t,title:a,createdAt:s,updatedAt:o})=>{const r=["---",`title: ${$(a)}`,`note_id: ${$(t)}`],c=O(s),i=O(o);return c&&r.push(`created_at: ${$(c)}`),i&&r.push(`updated_at: ${$(i)}`),r.push("source: ocean-brain","---"),r.join(`
|
|
2
|
-
`)},ka=(t,a,s=!1)=>s?`${Na(a)}
|
|
3
|
-
|
|
4
|
-
${t}`:t,Ma=(t,a,{includeMetadata:s=!1,mode:o="fragment"}={})=>{const r=s?`<!--
|
|
5
|
-
source: ocean-brain
|
|
6
|
-
note_id: ${a.id}
|
|
7
|
-
title: ${a.title}
|
|
8
|
-
created_at: ${O(a.createdAt)??""}
|
|
9
|
-
updated_at: ${O(a.updatedAt)??""}
|
|
10
|
-
-->
|
|
11
|
-
`:"";return o==="fragment"?`${r}${t}`:`<!doctype html>
|
|
12
|
-
<html lang="ko">
|
|
13
|
-
<head>
|
|
14
|
-
<meta charset="utf-8" />
|
|
15
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
16
|
-
<title>${Ca(a.title)}</title>
|
|
17
|
-
</head>
|
|
18
|
-
<body>
|
|
19
|
-
${r}${t}
|
|
20
|
-
</body>
|
|
21
|
-
</html>`},Y=(t,a,s)=>{const o=new Blob([t],{type:s}),r=URL.createObjectURL(o),c=document.createElement("a");c.href=r,c.download=a,document.body.appendChild(c),c.click(),c.remove(),URL.revokeObjectURL(r)},Me=lt(J),de=t=>N(Number(t)).format("YYYY-MM-DD HH:mm:ss"),q=()=>typeof globalThis.crypto?.randomUUID=="function"?globalThis.crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`,Ha={narrow:"max-w-[640px]",wide:"max-w-[896px]",full:"max-w-full px-4"},Ea=e.jsx(ee,{title:"Loading note",variant:"none",children:e.jsxs("main",{className:"mx-auto max-w-[896px]",children:[e.jsx(V,{className:"mb-8",height:"66px"}),e.jsx(V,{className:"ml-12 mb-8",height:"150px"}),e.jsx(V,{className:"mb-5",height:"80px"}),e.jsx(V,{height:"80px"})]})});function Aa({id:t}){const a=pe(),s=Me.useNavigate(),o=n.useRef(null),r=n.useRef(null),c=n.useRef(q()),i=he({queryKey:M.notes.detail(t),queryFn:async()=>{const d=await it(t);if(d.type==="error")throw d;return d.note},gcTime:0}),l=i.data,[m,j]=n.useState(l.title),[f,E]=n.useState(()=>de(l.updatedAt)),[y,x]=n.useState(l.pinned),[A,T]=n.useState(l.layout||"wide"),[S,Z]=n.useState(!1),[B,h]=n.useState(!1),[b,u]=n.useState(!1),[w,k]=n.useState("markdown"),[L,He]=n.useState(!1),[I,ae]=n.useState("fragment"),[P,F]=n.useState(null),[Ee,Ae]=ct(1e3);n.useEffect(()=>{j(l.title),x(l.pinned),T(l.layout||"wide"),E(de(l.updatedAt))},[l.layout,l.pinned,l.title,l.updatedAt]),n.useEffect(()=>{c.current=q(),F(null)},[t]),n.useEffect(()=>{F(d=>d?.type==="updated"&&d.updatedAt===l.updatedAt?null:d)},[l.updatedAt]),n.useEffect(()=>dt(d=>{if(d.noteId===t){if(d.type==="mcp.note.updated"){if(d.updatedAt===l.updatedAt)return;F({type:"updated",updatedAt:d.updatedAt});return}d.type==="mcp.note.deleted"&&F({type:"deleted"})}}),[t,l.updatedAt]);const ne=async({title:d="",content:g=""})=>{Ae(async()=>{const re=await le({id:t,title:d,content:g,editSessionId:c.current});if(re.type==="error"){a(re.errors[0].message);return}j(d),E(N().format("YYYY-MM-DD HH:mm:ss"))})},se=()=>{ne({title:m,content:o.current?.getContent()})},Te=d=>{j(d),ne({title:d,content:o.current?.getContent()})},Re=async d=>{const g=await le({id:t,layout:d,editSessionId:c.current});if(g.type==="error"){a(g.errors[0].message);return}T(d),a("Layout has been updated.")},Se=()=>({id:t,title:m,createdAt:l.createdAt,updatedAt:l.updatedAt}),Ve=async()=>{const d=o.current?.getMarkdown();if(d===void 0){a("Markdown is not ready yet.");return}try{await navigator.clipboard.writeText(d),a("Copied note as Markdown.")}catch{a("Failed to copy Markdown.")}},Le=()=>{const d=o.current?.getMarkdown();if(d===void 0){a("Markdown is not ready yet.");return}try{Y(d,U(m,"md"),"text/markdown;charset=utf-8"),a("Downloaded note as Markdown.")}catch{a("Failed to download Markdown.")}},Fe=()=>{const d=Se();try{if(w==="markdown"){const g=o.current?.getMarkdown();if(g===void 0){a("Markdown is not ready yet.");return}Y(ka(g,d,L),U(m,"md"),"text/markdown;charset=utf-8")}else{const g=o.current?.getHtml();if(g===void 0){a("HTML is not ready yet.");return}Y(Ma(g,d,{includeMetadata:L,mode:I}),U(m,"html"),"text/html;charset=utf-8")}u(!1),a("Downloaded note.")}catch{a("Failed to download note.")}},De=async()=>{const d=await i.refetch();if(d.error||!d.data){a("Failed to reload the latest note state.");return}F(null)},{onCreate:Ze,onDelete:$e,onPinned:Oe,deleteWarningDialog:Be}=mt();return e.jsx(ee,{title:m,variant:"none",children:e.jsxs("main",{className:H("mx-auto",Ha[A]),children:[e.jsx("div",{className:"surface-floating sticky top-20 z-[1001] mb-7 px-5 pt-4 pb-3.5",children:e.jsxs("div",{className:"flex flex-col gap-3.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-5",children:[e.jsxs("div",{className:"min-w-0 flex-1 pt-0.5",children:[e.jsx(p,{as:"div",variant:"micro",weight:"semibold",tracking:"widest",transform:"uppercase",tone:"tertiary",className:"mb-1.5",children:"Thought in progress"}),e.jsx("input",{ref:r,placeholder:"Title",className:"text-heading sm:text-display w-full bg-transparent font-semibold leading-[1.25] tracking-[-0.02em] outline-none",type:"text",value:m,onChange:d=>Te(d.target.value)})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx(xe,{button:e.jsx(ge,{label:"Note actions",size:"lg"}),items:[{name:"Copy Markdown",onClick:Ve},{name:"Download Markdown",onClick:Le},{name:"Download in another format",onClick:()=>u(!0)},{type:"separator",key:"export-separator"},{name:y?"Unpin":"Pin",onClick:()=>Oe(t,y,()=>{x(d=>!d)})},{name:"Change layout",onClick:()=>Z(!0)},{type:"separator"},{name:"Clone this note",onClick:()=>Ze(r.current?.value||"untitled",o.current?.getContent()||"",A)},{name:"Restore previous version",onClick:()=>h(!0)},{type:"separator"},{name:"Delete",onClick:()=>$e(t,()=>{s({to:oe,search:{page:1}})})}]}),e.jsx(C,{size:"sm",variant:"subtle",isLoading:Ee,onClick:se,children:"Save"})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-t border-border-subtle/80 pt-3",children:[y&&e.jsxs(p,{as:"span",variant:"label",weight:"medium",tone:"secondary",className:"inline-flex items-center gap-1.5",children:[e.jsx(ut,{className:"h-3 w-3",weight:"fill"}),"Pinned"]}),y&&e.jsx("span",{className:"h-1 w-1 rounded-full bg-border-secondary"}),e.jsxs(p,{as:"span",variant:"label",weight:"medium",tone:"secondary",children:["Last saved ",f]})]})]})}),P&&e.jsx(ht,{className:"mb-6",children:e.jsxs("div",{className:"flex w-full flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("span",{children:P.type==="updated"?"This note changed in MCP. Reload to review the latest version.":"This note was moved to trash from MCP. Open trash to review it."}),P.type==="updated"?e.jsx(C,{type:"button",size:"sm",variant:"subtle",className:"self-start",isLoading:i.isRefetching,onClick:De,children:"Reload"}):e.jsx(C,{type:"button",size:"sm",variant:"subtle",className:"self-start",onClick:()=>s({to:oe,search:{page:1}}),children:"Open trash"})]})}),e.jsx(va,{ref:o,content:l.content,currentNoteId:t,onChange:se},`${t}:${l.updatedAt}`),e.jsx(K,{fallback:e.jsx(V,{className:"mb-5",height:"80px"}),errorTitle:"Failed to load reminders",errorDescription:"Retry loading reminder details for this note.",renderError:({error:d,retry:g})=>e.jsx(Q,{title:"Failed to load reminders",description:"Retry loading reminder details for this note.",error:d,onRetry:g,showBackAction:!1,showHomeAction:!1}),children:e.jsx(Lt,{noteId:t})}),e.jsx(K,{fallback:e.jsx(V,{height:"80px"}),errorTitle:"Failed to load back references",errorDescription:"Retry loading notes that link back here.",renderError:({error:d,retry:g})=>e.jsx(Q,{title:"Failed to load back references",description:"Retry loading notes that link back here.",error:d,onRetry:g,showBackAction:!1,showHomeAction:!1}),children:e.jsx(St,{noteId:t,render:d=>d&&d.length>0&&e.jsxs("div",{className:"surface-base p-4",children:[e.jsx(te,{icon:e.jsx(Ht,{className:"h-3.5 w-3.5"}),title:"Back References",className:"mb-3 text-fg-tertiary"}),e.jsx("ul",{className:"flex flex-col",children:d.map(g=>e.jsx("li",{children:e.jsxs(pt,{to:J,params:{id:g.id},className:"flex items-center 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(Mt,{className:"h-3.5 w-3.5 shrink-0 text-fg-tertiary"}),e.jsx(p,{as:"span",variant:"body",weight:"medium",className:"text-current",children:g.title})]})},g.id))})]})})}),e.jsx(At,{isOpen:S,onClose:()=>Z(!1),onSave:Re,currentLayout:A}),e.jsxs(v,{isOpen:b,onClose:()=>u(!1),variant:"compact",children:[e.jsx(v.Header,{title:"Download in another format",onClose:()=>u(!1)}),e.jsx(v.Body,{children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(p,{as:"div",variant:"body",weight:"semibold",tone:"secondary",children:"Format"}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[e.jsx(D,{title:"Markdown",description:"Good for GitHub, static blogs, and other note apps.",selected:w==="markdown",onClick:()=>k("markdown")}),e.jsx(D,{title:"HTML",description:"Good for web documents or CMS editors.",selected:w==="html",onClick:()=>k("html")})]})]}),e.jsxs("div",{className:"flex items-start gap-3 rounded-[14px] border border-border-subtle bg-subtle/60 p-3",children:[e.jsx(fe,{size:"sm",checked:L,onChange:d=>He(d.target.checked),className:"mt-0.5","aria-label":"Include metadata"}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(p,{as:"span",variant:"body",weight:"semibold",children:"Include metadata"}),e.jsx(p,{as:"span",variant:"label",tone:"tertiary",children:"Add the title, note id, timestamps, and Ocean Brain source information."})]})]}),w==="html"&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(p,{as:"div",variant:"body",weight:"semibold",tone:"secondary",children:"HTML style"}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[e.jsx(D,{title:"Content only",description:"Save only the note body HTML.",selected:I==="fragment",onClick:()=>ae("fragment")}),e.jsx(D,{title:"Full HTML document",description:"Save a complete HTML file that opens in a browser.",selected:I==="standalone",onClick:()=>ae("standalone")})]})]})]})}),e.jsx(v.Footer,{children:e.jsxs(X,{children:[e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>u(!1),children:"Cancel"}),e.jsx(C,{variant:"primary",size:"sm",onClick:Fe,children:"Download"})]})})]}),e.jsx(Rt,{isOpen:B,noteId:t,onClose:()=>h(!1),onRestored:()=>{c.current=q()}}),Be]})})}function $a(){const{id:t}=Me.useParams();if(!t)throw new Error("Note id is required.");return e.jsx(K,{fallback:Ea,errorTitle:"Failed to load note",errorDescription:"Retry loading the note editor.",resetKeys:[t],renderError:({error:a,retry:s})=>e.jsx(ee,{title:"Note",variant:"none",children:e.jsx(Q,{title:"Failed to load note",description:"Retry loading the note editor.",error:a,onRetry:s})}),children:e.jsx(Aa,{id:t},t)})}export{$a as default};
|