ocean-brain 0.8.2 → 0.11.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.
- package/README.md +2 -0
- package/dist/mcp.js +103 -105
- package/package.json +3 -2
- package/server/client/dist/assets/{ArrowRight.es-g2YZTklZ.js → ArrowRight.es-BEhnlwfe.js} +1 -1
- package/server/client/dist/assets/AuxiliaryPanelHeader-B1k7pZpn.js +1 -0
- package/server/client/dist/assets/Calendar-D7QJsAlg.js +25 -0
- package/server/client/dist/assets/{Callout-B_IPSF_5.js → Callout-BTd1BYtV.js} +1 -1
- package/server/client/dist/assets/{Copy.es-CNxe4ujr.js → Copy.es-BoLjilxv.js} +1 -1
- package/server/client/dist/assets/File.es-Ct7fscBg.js +1 -0
- package/server/client/dist/assets/Graph-DYUb7gQb.js +46 -0
- package/server/client/dist/assets/{Graph-D9GeO71k.js → Graph-LY_IgMYy.js} +1 -1
- package/server/client/dist/assets/{Image.es-DnON8cv2.js → Image.es-OYyN3BYt.js} +1 -1
- package/server/client/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/server/client/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/server/client/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/server/client/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/server/client/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/server/client/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/server/client/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/server/client/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/server/client/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/server/client/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/server/client/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/server/client/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/server/client/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/server/client/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/server/client/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/server/client/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/server/client/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/server/client/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/server/client/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/server/client/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/server/client/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/server/client/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/server/client/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/server/client/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/server/client/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/server/client/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/server/client/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/server/client/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/server/client/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/server/client/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/server/client/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/server/client/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/server/client/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/server/client/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/server/client/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/server/client/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/server/client/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/server/client/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/server/client/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/server/client/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/server/client/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/server/client/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/server/client/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/server/client/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/server/client/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/server/client/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/server/client/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/server/client/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/server/client/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/server/client/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/server/client/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/server/client/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/server/client/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/server/client/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/server/client/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/server/client/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/server/client/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/server/client/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/server/client/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/server/client/dist/assets/Note-DsMhwrHw.js +25 -0
- package/server/client/dist/assets/NotePropertiesPanel-aCKXAe5F.js +2 -0
- package/server/client/dist/assets/PencilLine.es-0JpEgxFY.js +1 -0
- package/server/client/dist/assets/{Plus.es-CQ8wn2is.js → Plus.es-DRfLW_bI.js} +1 -1
- package/server/client/dist/assets/Reminders-COr1OHvF.js +1 -0
- package/server/client/dist/assets/Search-Ctkx0BQk.js +31 -0
- package/server/client/dist/assets/SurfaceCard-t7pdfhEe.js +1 -0
- package/server/client/dist/assets/Tag-BjxtrIQW.js +1 -0
- package/server/client/dist/assets/TagNotes-DV_fdRbg.js +1 -0
- package/server/client/dist/assets/{Trash.es-0aPpA-3S.js → Trash.es-Bo1VyK9Q.js} +1 -1
- package/server/client/dist/assets/ViewChip-DlCkL4z4.js +1 -0
- package/server/client/dist/assets/ViewNotes-wWWeFJyU.js +1 -0
- package/server/client/dist/assets/ViewSectionDialog-DhH8harC.js +102 -0
- package/server/client/dist/assets/Views-CWE99SnI.js +1 -0
- package/server/client/dist/assets/abnfDiagram-VRR7QNED-CWlV5dXw.js +1 -0
- package/server/client/dist/assets/app-B9WZRrAH.css +1 -0
- package/server/client/dist/assets/app-BpSMjzET.js +26 -0
- package/server/client/dist/assets/arc-BV-n6RUX.js +1 -0
- package/server/client/dist/assets/architectureDiagram-ZJ3FMSHR-CekzMXdu.js +36 -0
- package/server/client/dist/assets/blockDiagram-677ZJIJ3-B49yHoxq.js +132 -0
- package/server/client/dist/assets/c4Diagram-LMCZKHZV-0AfB9NBC.js +10 -0
- package/server/client/dist/assets/channel-CigOulR-.js +1 -0
- package/server/client/dist/assets/chunk-2Q5K7J3B-DaPQAU1q.js +1 -0
- package/server/client/dist/assets/chunk-32BRIVSS-CfL3kZAg.js +1 -0
- package/server/client/dist/assets/chunk-5VM5RSS4-DeOwWPE_.js +15 -0
- package/server/client/dist/assets/chunk-EX3LRPZG-C3W1oc9y.js +231 -0
- package/server/client/dist/assets/chunk-JWPE2WC7-_Oqh79OY.js +1 -0
- package/server/client/dist/assets/chunk-MOJQB5TN-DDKNNzI6.js +88 -0
- package/server/client/dist/assets/chunk-RYQCIY6F-DCHah7CC.js +1 -0
- package/server/client/dist/assets/chunk-V7JOEXUC-uUOIzgxj.js +206 -0
- package/server/client/dist/assets/chunk-VR4S4FIN-DDVw2WPs.js +1 -0
- package/server/client/dist/assets/chunk-XXDRQBXY-Coo4UFm2.js +1 -0
- package/server/client/dist/assets/classDiagram-OUVF2IWQ-D13ISIOW.js +1 -0
- package/server/client/dist/assets/classDiagram-v2-EOCWNBFH-D13ISIOW.js +1 -0
- package/server/client/dist/assets/colors-Cc3OSVma.js +1 -0
- package/server/client/dist/assets/cose-bilkent-JH36ORCC-C3pHmHpD.js +1 -0
- package/server/client/dist/assets/cynefin-VYW2F7L2-DU_G4Atc.js +166 -0
- package/server/client/dist/assets/cynefinDiagram-TSTJHNR4-DZ6iiJFo.js +62 -0
- package/server/client/dist/assets/cytoscape.esm-D3_iZ_3b.js +321 -0
- package/server/client/dist/assets/dagre-VKFMJZFB-DNELbhwC.js +4 -0
- package/server/client/dist/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/server/client/dist/assets/diagram-FQU43EPY-CMEvZJ61.js +3 -0
- package/server/client/dist/assets/diagram-G47NLZAW-BYDtf6j9.js +24 -0
- package/server/client/dist/assets/diagram-NH7WQ7WH-CmXfcCQA.js +24 -0
- package/server/client/dist/assets/diagram-OA4YK3LP-BflTKJxU.js +30 -0
- package/server/client/dist/assets/diagram-WEI45ONY-KW3fKqna.js +41 -0
- package/server/client/dist/assets/ebnfDiagram-CCIWWBDH-CbyhY5Nj.js +1 -0
- package/server/client/dist/assets/erDiagram-Q63AITRT-CC2eZV8g.js +85 -0
- package/server/client/dist/assets/{floating-ui.react-dom-wWLZ1CdM.js → floating-ui.react-dom-BWTnA00G.js} +1 -1
- package/server/client/dist/assets/flowDiagram-23GEKE2U-unplo7Qm.js +156 -0
- package/server/client/dist/assets/ganttDiagram-NO4QXBWP-BcBK5HcZ.js +292 -0
- package/server/client/dist/assets/gitGraphDiagram-IHSO6WYX-DgVbbb5k.js +106 -0
- package/server/client/dist/assets/graph-C5DFNLrC.js +1 -0
- package/server/client/dist/assets/image-delete-confirmation-D7xrODQV.js +1 -0
- package/server/client/dist/assets/image.api-CyQisInP.js +17 -0
- package/server/client/dist/assets/index-B-E1Ilh9.js +1 -0
- package/server/client/dist/assets/infoDiagram-FWYZ7A6U-N_D9RdfG.js +2 -0
- package/server/client/dist/assets/init-Gi6I4Gst.js +1 -0
- package/server/client/dist/assets/isObject-U9U2HXiq.js +1 -0
- package/server/client/dist/assets/ishikawaDiagram-FXEZZL3T-BBKrzmB2.js +70 -0
- package/server/client/dist/assets/journeyDiagram-5HDEW3XC-NdCxLmQB.js +139 -0
- package/server/client/dist/assets/kanban-definition-HUTT4EX6-Ck7t4-tt.js +89 -0
- package/server/client/dist/assets/katex-DywYRkvg.css +1 -0
- package/server/client/dist/assets/katex-HP8lGamR.js +257 -0
- package/server/client/dist/assets/katex-x288kqHd.js +257 -0
- package/server/client/dist/assets/layout-Cz0MDlGi.js +1 -0
- package/server/client/dist/assets/linear-D6yRgDLq.js +1 -0
- package/server/client/dist/assets/manage-image-azmo5iVw.js +1 -0
- package/server/client/dist/assets/manage-image-detail-BF-uSqb_.js +1 -0
- package/server/client/dist/assets/map-Mm1V-_Na.js +1 -0
- package/server/client/dist/assets/{mcp-CT_9IV2c.js → mcp-CCaFd0zm.js} +4 -4
- package/server/client/dist/assets/{mcp-admin-adapter-xAuyZc_M.js → mcp-admin-adapter-PMmgPupc.js} +1 -1
- package/server/client/dist/assets/mermaid.core-B14ZAmWA.js +308 -0
- package/server/client/dist/assets/min-tv6RD-6E.js +1 -0
- package/server/client/dist/assets/mindmap-definition-LN4V7U3C-BTUqSdcP.js +96 -0
- package/server/client/dist/assets/{note-core-Buwzyxi7.js → note-core-DUTqUh5N.js} +2 -2
- package/server/client/dist/assets/{note-runtime-CPDVOFEo.js → note-runtime-zN5ddTba.js} +1 -1
- package/server/client/dist/assets/{note-ui-CHI-tzj-.js → note-ui-CtijppHK.js} +1 -1
- package/server/client/dist/assets/{note.api-D_00ZzJC.js → note.api-D3oJmG3q.js} +6 -6
- package/server/client/dist/assets/ordinal-Cboi1Yqb.js +1 -0
- package/server/client/dist/assets/pegDiagram-2B236MQR-Cjcu3mVz.js +1 -0
- package/server/client/dist/assets/pieDiagram-ENE6RG2P-BxI_c22Z.js +39 -0
- package/server/client/dist/assets/{placeholder-DbdGiYGL.js → placeholder-AusSo8p9.js} +4 -4
- package/server/client/dist/assets/properties-BrNJLkxR.js +1 -0
- package/server/client/dist/assets/quadrantDiagram-ABIIQ3AL-DGm0a-yR.js +7 -0
- package/server/client/dist/assets/railroadDiagram-RFXS5EU6-DmCDu89O.js +1 -0
- package/server/client/dist/assets/requirementDiagram-TGXJPOKE-CBpUt7Ig.js +84 -0
- package/server/client/dist/assets/route-preload.js +2 -2
- package/server/client/dist/assets/sankeyDiagram-HTMAVEWB-BjGnDZlp.js +40 -0
- package/server/client/dist/assets/search-D-xKTPdO.js +1 -0
- package/server/client/dist/assets/search-admin-adapter-CJnJmL6w.js +1 -0
- package/server/client/dist/assets/sequenceDiagram-DBY2YBRQ-B7rpCfS6.js +162 -0
- package/server/client/dist/assets/sizeCapture-X5ZJPWSS-CUJhD0uW.js +1 -0
- package/server/client/dist/assets/stateDiagram-2N3HPSRC-Y9-3XqRX.js +1 -0
- package/server/client/dist/assets/stateDiagram-v2-6OUMAXLB-DbHXhT02.js +1 -0
- package/server/client/dist/assets/swimlanes-5IMT3BWC-Cs1NO9ng.js +2 -0
- package/server/client/dist/assets/swimlanesDiagram-G3AALYLV-DQnrq2ZC.js +8 -0
- package/server/client/dist/assets/{tag.api-CX0SE06J.js → tag.api-DNSQpqwk.js} +3 -3
- package/server/client/dist/assets/time-D5LRMumI.js +9 -0
- package/server/client/dist/assets/timeline-definition-FHXFAJF6-8fqD4WNL.js +120 -0
- package/server/client/dist/assets/toNumber-DE3J3kMD.js +1 -0
- package/server/client/dist/assets/transform-BUB79_za.js +1 -0
- package/server/client/dist/assets/trash-D4-9sv8q.js +1 -0
- package/server/client/dist/assets/url-9nrbQs7Z.js +1 -0
- package/server/client/dist/assets/{useReminderMutate-CLK1tHvT.js → useReminderMutate-BrGO9M0o.js} +4 -4
- package/server/client/dist/assets/vennDiagram-L72KCM5P-BPqKkd5a.js +34 -0
- package/server/client/dist/assets/wardleyDiagram-EHGQE667-Cq11kU2M.js +78 -0
- package/server/client/dist/assets/xychartDiagram-FW5EYKEG-DJ6UzFj-.js +7 -0
- package/server/client/dist/index.html +7 -7
- package/server/dist/features/image/services/delete.js +25 -1
- package/server/dist/features/note/graphql/note.field.resolver.js +2 -0
- package/server/dist/features/note/graphql/note.mutation.resolver.js +54 -23
- package/server/dist/features/note/graphql/note.query.resolver.js +15 -5
- package/server/dist/features/note/graphql/note.type-defs.js +2 -1
- package/server/dist/features/note/http/mcp.js +1 -60
- package/server/dist/features/note/services/authoring.js +17 -80
- package/server/dist/features/note/services/markdown-patch.js +80 -8
- package/server/dist/features/note/services/note-reference-index.js +98 -0
- package/server/dist/features/note/services/properties.js +21 -1
- package/server/dist/features/note/services/property-restore.js +26 -0
- package/server/dist/features/note/services/search.js +5 -0
- package/server/dist/features/note/services/snapshot.js +82 -58
- package/server/dist/features/note/services/trash.js +18 -31
- package/server/dist/features/note/services/write.js +10 -3
- package/server/dist/features/search/embedding-api-key-store.js +57 -0
- package/server/dist/features/search/embedding-client.js +179 -0
- package/server/dist/features/search/graphql/index.js +6 -0
- package/server/dist/features/search/graphql/resolver.js +32 -0
- package/server/dist/features/search/graphql/type-defs.js +37 -0
- package/server/dist/features/search/http/handlers.js +108 -0
- package/server/dist/features/search/hybrid-ranking.js +57 -0
- package/server/dist/features/search/hybrid-search.js +176 -0
- package/server/dist/features/search/note-change.js +16 -0
- package/server/dist/features/search/note-chunking.js +75 -0
- package/server/dist/features/search/related-notes.js +186 -0
- package/server/dist/features/search/search-config.js +150 -0
- package/server/dist/features/search/search-manager.js +431 -0
- package/server/dist/features/search/semantic-indexer.js +138 -0
- package/server/dist/features/search/sqlite-vector-index.js +636 -0
- package/server/dist/features/search/url-normalization.js +10 -0
- package/server/dist/features/tag/services/organization.js +3 -0
- package/server/dist/features/view/services/workspace.js +1 -1
- package/server/dist/main.js +12 -3
- package/server/dist/modules/blocknote.js +4 -5
- package/server/dist/paths.js +7 -2
- package/server/dist/routes/api.js +37 -0
- package/server/dist/routes/mcp.js +0 -5
- package/server/dist/schema/index.js +3 -0
- package/server/prisma/migrations/20260728090000_0019_note_reference_index/migration.sql +15 -0
- package/server/prisma/schema.prisma +16 -0
- package/server/client/dist/assets/Calendar-BP6HTuSn.js +0 -25
- package/server/client/dist/assets/Graph-Xha3fwhp.js +0 -46
- package/server/client/dist/assets/Image-BLEjLUqd.js +0 -1
- package/server/client/dist/assets/Note-DjrCYtat.js +0 -24
- package/server/client/dist/assets/NotePropertiesPanel-2DgXEM4B.js +0 -2
- package/server/client/dist/assets/Reminders-B4l3KdlK.js +0 -1
- package/server/client/dist/assets/Search-BN5sf7bE.js +0 -1
- package/server/client/dist/assets/SurfaceCard-BZm73nyS.js +0 -1
- package/server/client/dist/assets/Tag-oSnmViVp.js +0 -1
- package/server/client/dist/assets/TagNotes-BDTCcJcL.js +0 -1
- package/server/client/dist/assets/ViewNotes-CiZtGJNE.js +0 -1
- package/server/client/dist/assets/ViewSectionDialog-Ctl_694Y.js +0 -102
- package/server/client/dist/assets/Views-D-zlatYD.js +0 -1
- package/server/client/dist/assets/app-DmqIOMWF.css +0 -1
- package/server/client/dist/assets/app-cTRcKMGc.js +0 -26
- package/server/client/dist/assets/image.api-CVuuvTBk.js +0 -17
- package/server/client/dist/assets/index-DKJChPr4.js +0 -1
- package/server/client/dist/assets/manage-image-BZjaxp-f.js +0 -1
- package/server/client/dist/assets/manage-image-detail-DPv0FQ2m.js +0 -1
- package/server/client/dist/assets/properties-D447wsWk.js +0 -1
- package/server/client/dist/assets/time-B3pt8vt4.js +0 -9
- package/server/client/dist/assets/trash-8sH7EZgc.js +0 -1
- package/server/client/dist/assets/url-BSnWpmJx.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as On,w as kn,e as Z,x as nn,y as Pn,z as Qn,A as Zn,m as ne,B as ee,q as F,C as re,D as cn,E as te,F as Ln,S as ie,u as T,k as ae,H as oe,I as Nn,J as _n,K as ue,L as en,M as Cn,N as de,O as Rn,v as D,l as fe,P as se,Q as ce,G as g,R as c,T as le,i as m,V as I,W as E,X as j}from"./graph-C5DFNLrC.js";import{a as N,b as he,c as ve,i as H}from"./isObject-U9U2HXiq.js";import{g as pe,b as we,k as G,a as Tn,c as be,d as me,e as ge,f as ye,i as xe,h as In,j as Ee,m as w}from"./map-Mm1V-_Na.js";import{t as Oe}from"./toNumber-DE3J3kMD.js";var ln=1/0,ke=17976931348623157e292;function S(n){if(!n)return n===0?n:0;if(n=Oe(n),n===ln||n===-ln){var e=n<0?-1:1;return e*ke}return n===n?n:0}function Pe(n){var e=S(n),r=e%1;return e===e?r?e-r:e:0}function _(n,e,r){if(!N(r))return!1;var t=typeof e;return(t=="number"?On(r)&&kn(e,r.length):t=="string"&&e in r)?Z(r[e],n):!1}function Le(n){return nn(function(e,r){var t=-1,i=r.length,o=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=n.length>3&&typeof o=="function"?(i--,o):void 0,a&&_(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),e=Object(e);++t<i;){var u=r[t];u&&n(e,u,t,o)}return e})}function k(n){var e=n==null?0:n.length;return e?Pn(n):[]}function Ne(n){return Qn(Zn(n,void 0,k),n+"")}var _e="[object Object]",Ce=Function.prototype,Re=Object.prototype,Mn=Ce.toString,Te=Re.hasOwnProperty,Ie=Mn.call(Object);function Me(n){if(!he(n)||ve(n)!=_e)return!1;var e=pe(n);if(e===null)return!0;var r=Te.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Mn.call(r)==Ie}var Se=1,Fe=4;function Ae(n){return we(n,Se|Fe)}var Sn=Object.prototype,Be=Sn.hasOwnProperty,je=nn(function(n,e){n=Object(n);var r=-1,t=e.length,i=t>2?e[2]:void 0;for(i&&_(e[0],e[1],i)&&(t=1);++r<t;)for(var o=e[r],a=G(o),u=-1,d=a.length;++u<d;){var f=a[u],s=n[f];(s===void 0||Z(s,Sn[f])&&!Be.call(n,f))&&(n[f]=o[f])}return n});function U(n,e,r){(r!==void 0&&!Z(n[e],r)||r===void 0&&!(e in n))&&Tn(n,e,r)}function J(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}function Ge(n){return be(n,G(n))}function Ve(n,e,r,t,i,o,a){var u=J(n,r),d=J(e,r),f=a.get(d);if(f){U(n,r,f);return}var s=o?o(u,d,r+"",n,e,a):void 0,l=s===void 0;if(l){var h=F(d),v=!h&&ne(d),p=!h&&!v&&ee(d);s=d,h||v||p?F(u)?s=u:re(u)?s=me(u):v?(l=!1,s=ge(d,!0)):p?(l=!1,s=ye(d,!0)):s=[]:Me(d)||cn(d)?(s=u,cn(u)?s=Ge(u):(!N(u)||te(u))&&(s=xe(d))):l=!1}l&&(a.set(d,s),i(s,d,t,o,a),a.delete(d)),U(n,r,s)}function Fn(n,e,r,t,i){n!==e&&Ln(e,function(o,a){if(i||(i=new ie),N(o))Ve(n,e,a,r,Fn,t,i);else{var u=t?t(J(n,a),o,a+"",n,e,i):void 0;u===void 0&&(u=o),U(n,a,u)}},G)}function A(n){var e=n==null?0:n.length;return e?n[e-1]:void 0}function Ye(n){return function(e,r,t){var i=Object(e);if(!On(e)){var o=T(r);e=ae(e),r=function(u){return o(i[u],u,i)}}var a=n(e,r,t);return a>-1?i[o?e[a]:a]:void 0}}var De=Math.max;function $e(n,e,r){var t=n==null?0:n.length;if(!t)return-1;var i=r==null?0:Pe(r);return i<0&&(i=De(t+i,0)),oe(n,T(e),i)}var rn=Ye($e);function qe(n,e){return n==null?n:Ln(n,Nn(e),G)}function We(n,e){return n&&_n(n,Nn(e))}function Xe(n,e){return n>e}var ze=Object.prototype,He=ze.hasOwnProperty;function Ue(n,e){return n!=null&&He.call(n,e)}function An(n,e){return n!=null&&ue(n,e,Ue)}function Bn(n,e){return n<e}function V(n,e){var r={};return e=T(e),_n(n,function(t,i,o){Tn(r,i,e(t,i,o))}),r}function tn(n,e,r){for(var t=-1,i=n.length;++t<i;){var o=n[t],a=e(o);if(a!=null&&(u===void 0?a===a&&!H(a):r(a,u)))var u=a,d=o}return d}function y(n){return n&&n.length?tn(n,en,Xe):void 0}var K=Le(function(n,e,r){Fn(n,e,r)});function C(n){return n&&n.length?tn(n,en,Bn):void 0}function an(n,e){return n&&n.length?tn(n,T(e),Bn):void 0}function Je(n,e,r,t){if(!N(n))return n;e=Cn(e,n);for(var i=-1,o=e.length,a=o-1,u=n;u!=null&&++i<o;){var d=de(e[i]),f=r;if(d==="__proto__"||d==="constructor"||d==="prototype")return n;if(i!=a){var s=u[d];f=void 0,f===void 0&&(f=N(s)?s:kn(e[i+1])?[]:{})}In(u,d,f),u=u[d]}return n}function Ke(n,e,r){for(var t=-1,i=e.length,o={};++t<i;){var a=e[t],u=Rn(n,a);r(u,a)&&Je(o,Cn(a,n),u)}return o}function Qe(n,e){var r=n.length;for(n.sort(e);r--;)n[r]=n[r].value;return n}function Ze(n,e){if(n!==e){var r=n!==void 0,t=n===null,i=n===n,o=H(n),a=e!==void 0,u=e===null,d=e===e,f=H(e);if(!u&&!f&&!o&&n>e||o&&a&&d&&!u&&!f||t&&a&&d||!r&&d||!i)return 1;if(!t&&!o&&!f&&n<e||f&&r&&i&&!t&&!o||u&&r&&i||!a&&i||!d)return-1}return 0}function nr(n,e,r){for(var t=-1,i=n.criteria,o=e.criteria,a=i.length,u=r.length;++t<a;){var d=Ze(i[t],o[t]);if(d){if(t>=u)return d;var f=r[t];return d*(f=="desc"?-1:1)}}return n.index-e.index}function er(n,e,r){e.length?e=D(e,function(o){return F(o)?function(a){return Rn(a,o.length===1?o[0]:o)}:o}):e=[en];var t=-1;e=D(e,fe(T));var i=Ee(n,function(o,a,u){var d=D(e,function(f){return f(o)});return{criteria:d,index:++t,value:o}});return Qe(i,function(o,a){return nr(o,a,r)})}function rr(n,e){return Ke(n,e,function(r,t){return se(n,t)})}var B=Ne(function(n,e){return n==null?{}:rr(n,e)}),tr=Math.ceil,ir=Math.max;function ar(n,e,r,t){for(var i=-1,o=ir(tr((e-n)/(r||1)),0),a=Array(o);o--;)a[++i]=n,n+=r;return a}function or(n){return function(e,r,t){return t&&typeof t!="number"&&_(e,r,t)&&(r=t=void 0),e=S(e),r===void 0?(r=e,e=0):r=S(r),t=t===void 0?e<r?1:-1:S(t),ar(e,r,t)}}var O=or(),M=nn(function(n,e){if(n==null)return[];var r=e.length;return r>1&&_(n,e[0],e[1])?e=[]:r>2&&_(e[0],e[1],e[2])&&(e=[e[0]]),er(n,Pn(e),[])}),ur=0;function on(n){var e=++ur;return ce(n)+e}function dr(n,e,r){for(var t=-1,i=n.length,o=e.length,a={};++t<i;){var u=t<o?e[t]:void 0;r(a,n[t],u)}return a}function fr(n,e){return dr(n||[],e||[],In)}class sr{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,r=e._prev;if(r!==e)return hn(r),r}enqueue(e){var r=this._sentinel;e._prev&&e._next&&hn(e),e._next=r._next,r._next._prev=e,r._next=e,e._prev=r}toString(){for(var e=[],r=this._sentinel,t=r._prev;t!==r;)e.push(JSON.stringify(t,cr)),t=t._prev;return"["+e.join(", ")+"]"}}function hn(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function cr(n,e){if(n!=="_next"&&n!=="_prev")return e}var lr=le(1);function hr(n,e){if(n.nodeCount()<=1)return[];var r=pr(n,e||lr),t=vr(r.graph,r.buckets,r.zeroIdx);return k(w(t,function(i){return n.outEdges(i.v,i.w)}))}function vr(n,e,r){for(var t=[],i=e[e.length-1],o=e[0],a;n.nodeCount();){for(;a=o.dequeue();)$(n,e,r,a);for(;a=i.dequeue();)$(n,e,r,a);if(n.nodeCount()){for(var u=e.length-2;u>0;--u)if(a=e[u].dequeue(),a){t=t.concat($(n,e,r,a,!0));break}}}return t}function $(n,e,r,t,i){var o=i?[]:void 0;return c(n.inEdges(t.v),function(a){var u=n.edge(a),d=n.node(a.v);i&&o.push({v:a.v,w:a.w}),d.out-=u,Q(e,r,d)}),c(n.outEdges(t.v),function(a){var u=n.edge(a),d=a.w,f=n.node(d);f.in-=u,Q(e,r,f)}),n.removeNode(t.v),o}function pr(n,e){var r=new g,t=0,i=0;c(n.nodes(),function(u){r.setNode(u,{v:u,in:0,out:0})}),c(n.edges(),function(u){var d=r.edge(u.v,u.w)||0,f=e(u),s=d+f;r.setEdge(u.v,u.w,s),i=Math.max(i,r.node(u.v).out+=f),t=Math.max(t,r.node(u.w).in+=f)});var o=O(i+t+3).map(function(){return new sr}),a=t+1;return c(r.nodes(),function(u){Q(o,a,r.node(u))}),{graph:r,buckets:o,zeroIdx:a}}function Q(n,e,r){r.out?r.in?n[r.out-r.in+e].enqueue(r):n[n.length-1].enqueue(r):n[0].enqueue(r)}function wr(n){var e=n.graph().acyclicer==="greedy"?hr(n,r(n)):br(n);c(e,function(t){var i=n.edge(t);n.removeEdge(t),i.forwardName=t.name,i.reversed=!0,n.setEdge(t.w,t.v,i,on("rev"))});function r(t){return function(i){return t.edge(i).weight}}}function br(n){var e=[],r={},t={};function i(o){Object.prototype.hasOwnProperty.call(t,o)||(t[o]=!0,r[o]=!0,c(n.outEdges(o),function(a){Object.prototype.hasOwnProperty.call(r,a.w)?e.push(a):i(a.w)}),delete r[o])}return c(n.nodes(),i),e}function mr(n){c(n.edges(),function(e){var r=n.edge(e);if(r.reversed){n.removeEdge(e);var t=r.forwardName;delete r.reversed,delete r.forwardName,n.setEdge(e.w,e.v,r,t)}})}function P(n,e,r,t){var i;do i=on(t);while(n.hasNode(i));return r.dummy=e,n.setNode(i,r),i}function gr(n){var e=new g().setGraph(n.graph());return c(n.nodes(),function(r){e.setNode(r,n.node(r))}),c(n.edges(),function(r){var t=e.edge(r.v,r.w)||{weight:0,minlen:1},i=n.edge(r);e.setEdge(r.v,r.w,{weight:t.weight+i.weight,minlen:Math.max(t.minlen,i.minlen)})}),e}function jn(n){var e=new g({multigraph:n.isMultigraph()}).setGraph(n.graph());return c(n.nodes(),function(r){n.children(r).length||e.setNode(r,n.node(r))}),c(n.edges(),function(r){e.setEdge(r,n.edge(r))}),e}function vn(n,e){var r=n.x,t=n.y,i=e.x-r,o=e.y-t,a=n.width/2,u=n.height/2;if(!i&&!o)throw new Error("Not possible to find intersection inside of the rectangle");var d,f;return Math.abs(o)*a>Math.abs(i)*u?(o<0&&(u=-u),d=u*i/o,f=u):(i<0&&(a=-a),d=a,f=a*o/i),{x:r+d,y:t+f}}function Y(n){var e=w(O(Gn(n)+1),function(){return[]});return c(n.nodes(),function(r){var t=n.node(r),i=t.rank;m(i)||(e[i][t.order]=r)}),e}function yr(n){var e=C(w(n.nodes(),function(r){return n.node(r).rank}));c(n.nodes(),function(r){var t=n.node(r);An(t,"rank")&&(t.rank-=e)})}function xr(n){var e=C(w(n.nodes(),function(o){return n.node(o).rank})),r=[];c(n.nodes(),function(o){var a=n.node(o).rank-e;r[a]||(r[a]=[]),r[a].push(o)});var t=0,i=n.graph().nodeRankFactor;c(r,function(o,a){m(o)&&a%i!==0?--t:t&&c(o,function(u){n.node(u).rank+=t})})}function pn(n,e,r,t){var i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=t),P(n,"border",i,e)}function Gn(n){return y(w(n.nodes(),function(e){var r=n.node(e).rank;if(!m(r))return r}))}function Er(n,e){var r={lhs:[],rhs:[]};return c(n,function(t){e(t)?r.lhs.push(t):r.rhs.push(t)}),r}function Or(n,e){return e()}function kr(n){function e(r){var t=n.children(r),i=n.node(r);if(t.length&&c(t,e),Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var o=i.minRank,a=i.maxRank+1;o<a;++o)wn(n,"borderLeft","_bl",r,i,o),wn(n,"borderRight","_br",r,i,o)}}c(n.children(),e)}function wn(n,e,r,t,i,o){var a={width:0,height:0,rank:o,borderType:e},u=i[e][o-1],d=P(n,"border",a,r);i[e][o]=d,n.setParent(d,t),u&&n.setEdge(u,d,{weight:1})}function Pr(n){var e=n.graph().rankdir.toLowerCase();(e==="lr"||e==="rl")&&Vn(n)}function Lr(n){var e=n.graph().rankdir.toLowerCase();(e==="bt"||e==="rl")&&Nr(n),(e==="lr"||e==="rl")&&(_r(n),Vn(n))}function Vn(n){c(n.nodes(),function(e){bn(n.node(e))}),c(n.edges(),function(e){bn(n.edge(e))})}function bn(n){var e=n.width;n.width=n.height,n.height=e}function Nr(n){c(n.nodes(),function(e){q(n.node(e))}),c(n.edges(),function(e){var r=n.edge(e);c(r.points,q),Object.prototype.hasOwnProperty.call(r,"y")&&q(r)})}function q(n){n.y=-n.y}function _r(n){c(n.nodes(),function(e){W(n.node(e))}),c(n.edges(),function(e){var r=n.edge(e);c(r.points,W),Object.prototype.hasOwnProperty.call(r,"x")&&W(r)})}function W(n){var e=n.x;n.x=n.y,n.y=e}function Cr(n){n.graph().dummyChains=[],c(n.edges(),function(e){Rr(n,e)})}function Rr(n,e){var r=e.v,t=n.node(r).rank,i=e.w,o=n.node(i).rank,a=e.name,u=n.edge(e),d=u.labelRank;if(o!==t+1){n.removeEdge(e);var f=void 0,s,l;for(l=0,++t;t<o;++l,++t)u.points=[],f={width:0,height:0,edgeLabel:u,edgeObj:e,rank:t},s=P(n,"edge",f,"_d"),t===d&&(f.width=u.width,f.height=u.height,f.dummy="edge-label",f.labelpos=u.labelpos),n.setEdge(r,s,{weight:u.weight},a),l===0&&n.graph().dummyChains.push(s),r=s;n.setEdge(r,i,{weight:u.weight},a)}}function Tr(n){c(n.graph().dummyChains,function(e){var r=n.node(e),t=r.edgeLabel,i;for(n.setEdge(r.edgeObj,t);r.dummy;)i=n.successors(e)[0],n.removeNode(e),t.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(t.x=r.x,t.y=r.y,t.width=r.width,t.height=r.height),e=i,r=n.node(e)})}function un(n){var e={};function r(t){var i=n.node(t);if(Object.prototype.hasOwnProperty.call(e,t))return i.rank;e[t]=!0;var o=C(w(n.outEdges(t),function(a){return r(a.w)-n.edge(a).minlen}));return(o===Number.POSITIVE_INFINITY||o===void 0||o===null)&&(o=0),i.rank=o}c(n.sources(),r)}function R(n,e){return n.node(e.w).rank-n.node(e.v).rank-n.edge(e).minlen}function Yn(n){var e=new g({directed:!1}),r=n.nodes()[0],t=n.nodeCount();e.setNode(r,{});for(var i,o;Ir(e,n)<t;)i=Mr(e,n),o=e.hasNode(i.v)?R(n,i):-R(n,i),Sr(e,n,o);return e}function Ir(n,e){function r(t){c(e.nodeEdges(t),function(i){var o=i.v,a=t===o?i.w:o;!n.hasNode(a)&&!R(e,i)&&(n.setNode(a,{}),n.setEdge(t,a,{}),r(a))})}return c(n.nodes(),r),n.nodeCount()}function Mr(n,e){return an(e.edges(),function(r){if(n.hasNode(r.v)!==n.hasNode(r.w))return R(e,r)})}function Sr(n,e,r){c(n.nodes(),function(t){e.node(t).rank+=r})}function Fr(){}Fr.prototype=new Error;function Dn(n,e,r){F(e)||(e=[e]);var t=(n.isDirected()?n.successors:n.neighbors).bind(n),i=[],o={};return c(e,function(a){if(!n.hasNode(a))throw new Error("Graph does not have node: "+a);$n(n,a,r==="post",o,t,i)}),i}function $n(n,e,r,t,i,o){Object.prototype.hasOwnProperty.call(t,e)||(t[e]=!0,r||o.push(e),c(i(e),function(a){$n(n,a,r,t,i,o)}),r&&o.push(e))}function Ar(n,e){return Dn(n,e,"post")}function Br(n,e){return Dn(n,e,"pre")}x.initLowLimValues=fn;x.initCutValues=dn;x.calcCutValue=qn;x.leaveEdge=Xn;x.enterEdge=zn;x.exchangeEdges=Hn;function x(n){n=gr(n),un(n);var e=Yn(n);fn(e),dn(e,n);for(var r,t;r=Xn(e);)t=zn(e,n,r),Hn(e,n,r,t)}function dn(n,e){var r=Ar(n,n.nodes());r=r.slice(0,r.length-1),c(r,function(t){jr(n,e,t)})}function jr(n,e,r){var t=n.node(r),i=t.parent;n.edge(r,i).cutvalue=qn(n,e,r)}function qn(n,e,r){var t=n.node(r),i=t.parent,o=!0,a=e.edge(r,i),u=0;return a||(o=!1,a=e.edge(i,r)),u=a.weight,c(e.nodeEdges(r),function(d){var f=d.v===r,s=f?d.w:d.v;if(s!==i){var l=f===o,h=e.edge(d).weight;if(u+=l?h:-h,Vr(n,r,s)){var v=n.edge(r,s).cutvalue;u+=l?-v:v}}}),u}function fn(n,e){arguments.length<2&&(e=n.nodes()[0]),Wn(n,{},1,e)}function Wn(n,e,r,t,i){var o=r,a=n.node(t);return e[t]=!0,c(n.neighbors(t),function(u){Object.prototype.hasOwnProperty.call(e,u)||(r=Wn(n,e,r,u,t))}),a.low=o,a.lim=r++,i?a.parent=i:delete a.parent,r}function Xn(n){return rn(n.edges(),function(e){return n.edge(e).cutvalue<0})}function zn(n,e,r){var t=r.v,i=r.w;e.hasEdge(t,i)||(t=r.w,i=r.v);var o=n.node(t),a=n.node(i),u=o,d=!1;o.lim>a.lim&&(u=a,d=!0);var f=I(e.edges(),function(s){return d===mn(n,n.node(s.v),u)&&d!==mn(n,n.node(s.w),u)});return an(f,function(s){return R(e,s)})}function Hn(n,e,r,t){var i=r.v,o=r.w;n.removeEdge(i,o),n.setEdge(t.v,t.w,{}),fn(n),dn(n,e),Gr(n,e)}function Gr(n,e){var r=rn(n.nodes(),function(i){return!e.node(i).parent}),t=Br(n,r);t=t.slice(1),c(t,function(i){var o=n.node(i).parent,a=e.edge(i,o),u=!1;a||(a=e.edge(o,i),u=!0),e.node(i).rank=e.node(o).rank+(u?a.minlen:-a.minlen)})}function Vr(n,e,r){return n.hasEdge(e,r)}function mn(n,e,r){return r.low<=e.lim&&e.lim<=r.lim}function Yr(n){switch(n.graph().ranker){case"network-simplex":gn(n);break;case"tight-tree":$r(n);break;case"longest-path":Dr(n);break;default:gn(n)}}var Dr=un;function $r(n){un(n),Yn(n)}function gn(n){x(n)}function qr(n){var e=P(n,"root",{},"_root"),r=Wr(n),t=y(E(r))-1,i=2*t+1;n.graph().nestingRoot=e,c(n.edges(),function(a){n.edge(a).minlen*=i});var o=Xr(n)+1;c(n.children(),function(a){Un(n,e,i,o,t,r,a)}),n.graph().nodeRankFactor=i}function Un(n,e,r,t,i,o,a){var u=n.children(a);if(!u.length){a!==e&&n.setEdge(e,a,{weight:0,minlen:r});return}var d=pn(n,"_bt"),f=pn(n,"_bb"),s=n.node(a);n.setParent(d,a),s.borderTop=d,n.setParent(f,a),s.borderBottom=f,c(u,function(l){Un(n,e,r,t,i,o,l);var h=n.node(l),v=h.borderTop?h.borderTop:l,p=h.borderBottom?h.borderBottom:l,b=h.borderTop?t:2*t,L=v!==p?1:i-o[a]+1;n.setEdge(d,v,{weight:b,minlen:L,nestingEdge:!0}),n.setEdge(p,f,{weight:b,minlen:L,nestingEdge:!0})}),n.parent(a)||n.setEdge(e,d,{weight:0,minlen:i+o[a]})}function Wr(n){var e={};function r(t,i){var o=n.children(t);o&&o.length&&c(o,function(a){r(a,i+1)}),e[t]=i}return c(n.children(),function(t){r(t,1)}),e}function Xr(n){return j(n.edges(),function(e,r){return e+n.edge(r).weight},0)}function zr(n){var e=n.graph();n.removeNode(e.nestingRoot),delete e.nestingRoot,c(n.edges(),function(r){var t=n.edge(r);t.nestingEdge&&n.removeEdge(r)})}function Hr(n,e,r){var t={},i;c(r,function(o){for(var a=n.parent(o),u,d;a;){if(u=n.parent(a),u?(d=t[u],t[u]=a):(d=i,i=a),d&&d!==a){e.setEdge(d,a);return}a=u}})}function Ur(n,e,r){var t=Jr(n),i=new g({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(o){return n.node(o)});return c(n.nodes(),function(o){var a=n.node(o),u=n.parent(o);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(i.setNode(o),i.setParent(o,u||t),c(n[r](o),function(d){var f=d.v===o?d.w:d.v,s=i.edge(f,o),l=m(s)?0:s.weight;i.setEdge(f,o,{weight:n.edge(d).weight+l})}),Object.prototype.hasOwnProperty.call(a,"minRank")&&i.setNode(o,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))}),i}function Jr(n){for(var e;n.hasNode(e=on("_root")););return e}function Kr(n,e){for(var r=0,t=1;t<e.length;++t)r+=Qr(n,e[t-1],e[t]);return r}function Qr(n,e,r){for(var t=fr(r,w(r,function(f,s){return s})),i=k(w(e,function(f){return M(w(n.outEdges(f),function(s){return{pos:t[s.w],weight:n.edge(s).weight}}),"pos")})),o=1;o<r.length;)o<<=1;var a=2*o-1;o-=1;var u=w(new Array(a),function(){return 0}),d=0;return c(i.forEach(function(f){var s=f.pos+o;u[s]+=f.weight;for(var l=0;s>0;)s%2&&(l+=u[s+1]),s=s-1>>1,u[s]+=f.weight;d+=f.weight*l})),d}function Zr(n){var e={},r=I(n.nodes(),function(u){return!n.children(u).length}),t=y(w(r,function(u){return n.node(u).rank})),i=w(O(t+1),function(){return[]});function o(u){if(!An(e,u)){e[u]=!0;var d=n.node(u);i[d.rank].push(u),c(n.successors(u),o)}}var a=M(r,function(u){return n.node(u).rank});return c(a,o),i}function nt(n,e){return w(e,function(r){var t=n.inEdges(r);if(t.length){var i=j(t,function(o,a){var u=n.edge(a),d=n.node(a.v);return{sum:o.sum+u.weight*d.order,weight:o.weight+u.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}function et(n,e){var r={};c(n,function(i,o){var a=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:o};m(i.barycenter)||(a.barycenter=i.barycenter,a.weight=i.weight)}),c(e.edges(),function(i){var o=r[i.v],a=r[i.w];!m(o)&&!m(a)&&(a.indegree++,o.out.push(r[i.w]))});var t=I(r,function(i){return!i.indegree});return rt(t)}function rt(n){var e=[];function r(o){return function(a){a.merged||(m(a.barycenter)||m(o.barycenter)||a.barycenter>=o.barycenter)&&tt(o,a)}}function t(o){return function(a){a.in.push(o),--a.indegree===0&&n.push(a)}}for(;n.length;){var i=n.pop();e.push(i),c(i.in.reverse(),r(i)),c(i.out,t(i))}return w(I(e,function(o){return!o.merged}),function(o){return B(o,["vs","i","barycenter","weight"])})}function tt(n,e){var r=0,t=0;n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.vs=e.vs.concat(n.vs),n.barycenter=r/t,n.weight=t,n.i=Math.min(e.i,n.i),e.merged=!0}function it(n,e){var r=Er(n,function(s){return Object.prototype.hasOwnProperty.call(s,"barycenter")}),t=r.lhs,i=M(r.rhs,function(s){return-s.i}),o=[],a=0,u=0,d=0;t.sort(at(!!e)),d=yn(o,i,d),c(t,function(s){d+=s.vs.length,o.push(s.vs),a+=s.barycenter*s.weight,u+=s.weight,d=yn(o,i,d)});var f={vs:k(o)};return u&&(f.barycenter=a/u,f.weight=u),f}function yn(n,e,r){for(var t;e.length&&(t=A(e)).i<=r;)e.pop(),n.push(t.vs),r++;return r}function at(n){return function(e,r){return e.barycenter<r.barycenter?-1:e.barycenter>r.barycenter?1:n?r.i-e.i:e.i-r.i}}function Jn(n,e,r,t){var i=n.children(e),o=n.node(e),a=o?o.borderLeft:void 0,u=o?o.borderRight:void 0,d={};a&&(i=I(i,function(p){return p!==a&&p!==u}));var f=nt(n,i);c(f,function(p){if(n.children(p.v).length){var b=Jn(n,p.v,r,t);d[p.v]=b,Object.prototype.hasOwnProperty.call(b,"barycenter")&&ut(p,b)}});var s=et(f,r);ot(s,d);var l=it(s,t);if(a&&(l.vs=k([a,l.vs,u]),n.predecessors(a).length)){var h=n.node(n.predecessors(a)[0]),v=n.node(n.predecessors(u)[0]);Object.prototype.hasOwnProperty.call(l,"barycenter")||(l.barycenter=0,l.weight=0),l.barycenter=(l.barycenter*l.weight+h.order+v.order)/(l.weight+2),l.weight+=2}return l}function ot(n,e){c(n,function(r){r.vs=k(r.vs.map(function(t){return e[t]?e[t].vs:t}))})}function ut(n,e){m(n.barycenter)?(n.barycenter=e.barycenter,n.weight=e.weight):(n.barycenter=(n.barycenter*n.weight+e.barycenter*e.weight)/(n.weight+e.weight),n.weight+=e.weight)}function dt(n){var e=Gn(n),r=xn(n,O(1,e+1),"inEdges"),t=xn(n,O(e-1,-1,-1),"outEdges"),i=Zr(n);En(n,i);for(var o=Number.POSITIVE_INFINITY,a,u=0,d=0;d<4;++u,++d){ft(u%2?r:t,u%4>=2),i=Y(n);var f=Kr(n,i);f<o&&(d=0,a=Ae(i),o=f)}En(n,a)}function xn(n,e,r){return w(e,function(t){return Ur(n,t,r)})}function ft(n,e){var r=new g;c(n,function(t){var i=t.graph().root,o=Jn(t,i,r,e);c(o.vs,function(a,u){t.node(a).order=u}),Hr(t,r,o.vs)})}function En(n,e){c(e,function(r){c(r,function(t,i){n.node(t).order=i})})}function st(n){var e=lt(n);c(n.graph().dummyChains,function(r){for(var t=n.node(r),i=t.edgeObj,o=ct(n,e,i.v,i.w),a=o.path,u=o.lca,d=0,f=a[d],s=!0;r!==i.w;){if(t=n.node(r),s){for(;(f=a[d])!==u&&n.node(f).maxRank<t.rank;)d++;f===u&&(s=!1)}if(!s){for(;d<a.length-1&&n.node(f=a[d+1]).minRank<=t.rank;)d++;f=a[d]}n.setParent(r,f),r=n.successors(r)[0]}})}function ct(n,e,r,t){var i=[],o=[],a=Math.min(e[r].low,e[t].low),u=Math.max(e[r].lim,e[t].lim),d,f;d=r;do d=n.parent(d),i.push(d);while(d&&(e[d].low>a||u>e[d].lim));for(f=d,d=t;(d=n.parent(d))!==f;)o.push(d);return{path:i.concat(o.reverse()),lca:f}}function lt(n){var e={},r=0;function t(i){var o=r;c(n.children(i),t),e[i]={low:o,lim:r++}}return c(n.children(),t),e}function ht(n,e){var r={};function t(i,o){var a=0,u=0,d=i.length,f=A(o);return c(o,function(s,l){var h=pt(n,s),v=h?n.node(h).order:d;(h||s===f)&&(c(o.slice(u,l+1),function(p){c(n.predecessors(p),function(b){var L=n.node(b),sn=L.order;(sn<a||v<sn)&&!(L.dummy&&n.node(p).dummy)&&Kn(r,b,p)})}),u=l+1,a=v)}),o}return j(e,t),r}function vt(n,e){var r={};function t(o,a,u,d,f){var s;c(O(a,u),function(l){s=o[l],n.node(s).dummy&&c(n.predecessors(s),function(h){var v=n.node(h);v.dummy&&(v.order<d||v.order>f)&&Kn(r,h,s)})})}function i(o,a){var u=-1,d,f=0;return c(a,function(s,l){if(n.node(s).dummy==="border"){var h=n.predecessors(s);h.length&&(d=n.node(h[0]).order,t(a,f,l,u,d),f=l,u=d)}t(a,f,a.length,d,o.length)}),a}return j(e,i),r}function pt(n,e){if(n.node(e).dummy)return rn(n.predecessors(e),function(r){return n.node(r).dummy})}function Kn(n,e,r){if(e>r){var t=e;e=r,r=t}Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=n[e];Object.defineProperty(i,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function wt(n,e,r){if(e>r){var t=e;e=r,r=t}return!!n[e]&&Object.prototype.hasOwnProperty.call(n[e],r)}function bt(n,e,r,t){var i={},o={},a={};return c(e,function(u){c(u,function(d,f){i[d]=d,o[d]=d,a[d]=f})}),c(e,function(u){var d=-1;c(u,function(f){var s=t(f);if(s.length){s=M(s,function(b){return a[b]});for(var l=(s.length-1)/2,h=Math.floor(l),v=Math.ceil(l);h<=v;++h){var p=s[h];o[f]===f&&d<a[p]&&!wt(r,f,p)&&(o[p]=f,o[f]=i[f]=i[p],d=a[p])}}})}),{root:i,align:o}}function mt(n,e,r,t,i){var o={},a=gt(n,e,r,i),u=i?"borderLeft":"borderRight";function d(l,h){for(var v=a.nodes(),p=v.pop(),b={};p;)b[p]?l(p):(b[p]=!0,v.push(p),v=v.concat(h(p))),p=v.pop()}function f(l){o[l]=a.inEdges(l).reduce(function(h,v){return Math.max(h,o[v.v]+a.edge(v))},0)}function s(l){var h=a.outEdges(l).reduce(function(p,b){return Math.min(p,o[b.w]-a.edge(b))},Number.POSITIVE_INFINITY),v=n.node(l);h!==Number.POSITIVE_INFINITY&&v.borderType!==u&&(o[l]=Math.max(o[l],h))}return d(f,a.predecessors.bind(a)),d(s,a.successors.bind(a)),c(t,function(l){o[l]=o[r[l]]}),o}function gt(n,e,r,t){var i=new g,o=n.graph(),a=kt(o.nodesep,o.edgesep,t);return c(e,function(u){var d;c(u,function(f){var s=r[f];if(i.setNode(s),d){var l=r[d],h=i.edge(l,s);i.setEdge(l,s,Math.max(a(n,f,d),h||0))}d=f})}),i}function yt(n,e){return an(E(e),function(r){var t=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return qe(r,function(o,a){var u=Pt(n,a)/2;t=Math.max(o+u,t),i=Math.min(o-u,i)}),t-i})}function xt(n,e){var r=E(e),t=C(r),i=y(r);c(["u","d"],function(o){c(["l","r"],function(a){var u=o+a,d=n[u],f;if(d!==e){var s=E(d);f=a==="l"?t-C(s):i-y(s),f&&(n[u]=V(d,function(l){return l+f}))}})})}function Et(n,e){return V(n.ul,function(r,t){if(e)return n[e.toLowerCase()][t];var i=M(w(n,t));return(i[1]+i[2])/2})}function Ot(n){var e=Y(n),r=K(ht(n,e),vt(n,e)),t={},i;c(["u","d"],function(a){i=a==="u"?e:E(e).reverse(),c(["l","r"],function(u){u==="r"&&(i=w(i,function(l){return E(l).reverse()}));var d=(a==="u"?n.predecessors:n.successors).bind(n),f=bt(n,i,r,d),s=mt(n,i,f.root,f.align,u==="r");u==="r"&&(s=V(s,function(l){return-l})),t[a+u]=s})});var o=yt(n,t);return xt(t,o),Et(t,n.graph().align)}function kt(n,e,r){return function(t,i,o){var a=t.node(i),u=t.node(o),d=0,f;if(d+=a.width/2,Object.prototype.hasOwnProperty.call(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":f=-a.width/2;break;case"r":f=a.width/2;break}if(f&&(d+=r?f:-f),f=0,d+=(a.dummy?e:n)/2,d+=(u.dummy?e:n)/2,d+=u.width/2,Object.prototype.hasOwnProperty.call(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":f=u.width/2;break;case"r":f=-u.width/2;break}return f&&(d+=r?f:-f),f=0,d}}function Pt(n,e){return n.node(e).width}function Lt(n){n=jn(n),Nt(n),We(Ot(n),function(e,r){n.node(r).x=e})}function Nt(n){var e=Y(n),r=n.graph().ranksep,t=0;c(e,function(i){var o=y(w(i,function(a){return n.node(a).height}));c(i,function(a){n.node(a).y=t+o/2}),t+=o+r})}function ei(n,e){var r=Or;r("layout",()=>{var t=r(" buildLayoutGraph",()=>jt(n));r(" runLayout",()=>_t(t,r)),r(" updateInputGraph",()=>Ct(n,t))})}function _t(n,e){e(" makeSpaceForEdgeLabels",()=>Gt(n)),e(" removeSelfEdges",()=>Ht(n)),e(" acyclic",()=>wr(n)),e(" nestingGraph.run",()=>qr(n)),e(" rank",()=>Yr(jn(n))),e(" injectEdgeLabelProxies",()=>Vt(n)),e(" removeEmptyRanks",()=>xr(n)),e(" nestingGraph.cleanup",()=>zr(n)),e(" normalizeRanks",()=>yr(n)),e(" assignRankMinMax",()=>Yt(n)),e(" removeEdgeLabelProxies",()=>Dt(n)),e(" normalize.run",()=>Cr(n)),e(" parentDummyChains",()=>st(n)),e(" addBorderSegments",()=>kr(n)),e(" order",()=>dt(n)),e(" insertSelfEdges",()=>Ut(n)),e(" adjustCoordinateSystem",()=>Pr(n)),e(" position",()=>Lt(n)),e(" positionSelfEdges",()=>Jt(n)),e(" removeBorderNodes",()=>zt(n)),e(" normalize.undo",()=>Tr(n)),e(" fixupEdgeLabelCoords",()=>Wt(n)),e(" undoCoordinateSystem",()=>Lr(n)),e(" translateGraph",()=>$t(n)),e(" assignNodeIntersects",()=>qt(n)),e(" reversePoints",()=>Xt(n)),e(" acyclic.undo",()=>mr(n))}function Ct(n,e){c(n.nodes(),function(r){var t=n.node(r),i=e.node(r);t&&(t.x=i.x,t.y=i.y,e.children(r).length&&(t.width=i.width,t.height=i.height))}),c(n.edges(),function(r){var t=n.edge(r),i=e.edge(r);t.points=i.points,Object.prototype.hasOwnProperty.call(i,"x")&&(t.x=i.x,t.y=i.y)}),n.graph().width=e.graph().width,n.graph().height=e.graph().height}var Rt=["nodesep","edgesep","ranksep","marginx","marginy"],Tt={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},It=["acyclicer","ranker","rankdir","align"],Mt=["width","height"],St={width:0,height:0},Ft=["minlen","weight","width","height","labeloffset"],At={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Bt=["labelpos"];function jt(n){var e=new g({multigraph:!0,compound:!0}),r=z(n.graph());return e.setGraph(K({},Tt,X(r,Rt),B(r,It))),c(n.nodes(),function(t){var i=z(n.node(t));e.setNode(t,je(X(i,Mt),St)),e.setParent(t,n.parent(t))}),c(n.edges(),function(t){var i=z(n.edge(t));e.setEdge(t,K({},At,X(i,Ft),B(i,Bt)))}),e}function Gt(n){var e=n.graph();e.ranksep/=2,c(n.edges(),function(r){var t=n.edge(r);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}function Vt(n){c(n.edges(),function(e){var r=n.edge(e);if(r.width&&r.height){var t=n.node(e.v),i=n.node(e.w),o={rank:(i.rank-t.rank)/2+t.rank,e};P(n,"edge-proxy",o,"_ep")}})}function Yt(n){var e=0;c(n.nodes(),function(r){var t=n.node(r);t.borderTop&&(t.minRank=n.node(t.borderTop).rank,t.maxRank=n.node(t.borderBottom).rank,e=y(e,t.maxRank))}),n.graph().maxRank=e}function Dt(n){c(n.nodes(),function(e){var r=n.node(e);r.dummy==="edge-proxy"&&(n.edge(r.e).labelRank=r.rank,n.removeNode(e))})}function $t(n){var e=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,i=0,o=n.graph(),a=o.marginx||0,u=o.marginy||0;function d(f){var s=f.x,l=f.y,h=f.width,v=f.height;e=Math.min(e,s-h/2),r=Math.max(r,s+h/2),t=Math.min(t,l-v/2),i=Math.max(i,l+v/2)}c(n.nodes(),function(f){d(n.node(f))}),c(n.edges(),function(f){var s=n.edge(f);Object.prototype.hasOwnProperty.call(s,"x")&&d(s)}),e-=a,t-=u,c(n.nodes(),function(f){var s=n.node(f);s.x-=e,s.y-=t}),c(n.edges(),function(f){var s=n.edge(f);c(s.points,function(l){l.x-=e,l.y-=t}),Object.prototype.hasOwnProperty.call(s,"x")&&(s.x-=e),Object.prototype.hasOwnProperty.call(s,"y")&&(s.y-=t)}),o.width=r-e+a,o.height=i-t+u}function qt(n){c(n.edges(),function(e){var r=n.edge(e),t=n.node(e.v),i=n.node(e.w),o,a;r.points?(o=r.points[0],a=r.points[r.points.length-1]):(r.points=[],o=i,a=t),r.points.unshift(vn(t,o)),r.points.push(vn(i,a))})}function Wt(n){c(n.edges(),function(e){var r=n.edge(e);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function Xt(n){c(n.edges(),function(e){var r=n.edge(e);r.reversed&&r.points.reverse()})}function zt(n){c(n.nodes(),function(e){if(n.children(e).length){var r=n.node(e),t=n.node(r.borderTop),i=n.node(r.borderBottom),o=n.node(A(r.borderLeft)),a=n.node(A(r.borderRight));r.width=Math.abs(a.x-o.x),r.height=Math.abs(i.y-t.y),r.x=o.x+r.width/2,r.y=t.y+r.height/2}}),c(n.nodes(),function(e){n.node(e).dummy==="border"&&n.removeNode(e)})}function Ht(n){c(n.edges(),function(e){if(e.v===e.w){var r=n.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e,label:n.edge(e)}),n.removeEdge(e)}})}function Ut(n){var e=Y(n);c(e,function(r){var t=0;c(r,function(i,o){var a=n.node(i);a.order=o+t,c(a.selfEdges,function(u){P(n,"selfedge",{width:u.label.width,height:u.label.height,rank:a.rank,order:o+ ++t,e:u.e,label:u.label},"_se")}),delete a.selfEdges})})}function Jt(n){c(n.nodes(),function(e){var r=n.node(e);if(r.dummy==="selfedge"){var t=n.node(r.e.v),i=t.x+t.width/2,o=t.y,a=r.x-i,u=t.height/2;n.setEdge(r.e,r.label),n.removeNode(e),r.label.points=[{x:i+2*a/3,y:o-u},{x:i+5*a/6,y:o-u},{x:i+a,y:o},{x:i+5*a/6,y:o+u},{x:i+2*a/3,y:o+u}],r.label.x=r.x,r.label.y=r.y}})}function X(n,e){return V(B(n,e),Number)}function z(n){var e={};return c(n,function(r,t){e[t.toLowerCase()]=r}),e}export{ei as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as j,i as p,a as w,b as k,d as q}from"./transform-BUB79_za.js";import{i as D}from"./init-Gi6I4Gst.js";import{e as g,f as F,a as z,b as B}from"./defaultLocale-DX6XiGOO.js";function I(n,r){r||(r=[]);var t=n?Math.min(r.length,n.length):0,e=r.slice(),u;return function(f){for(u=0;u<t;++u)e[u]=n[u]*(1-f)+r[u]*f;return e}}function P(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function V(n,r){var t=r?r.length:0,e=n?Math.min(t,n.length):0,u=new Array(e),f=new Array(t),a;for(a=0;a<e;++a)u[a]=N(n[a],r[a]);for(;a<t;++a)f[a]=r[a];return function(o){for(a=0;a<e;++a)f[a]=u[a](o);return f}}function $(n,r){var t=new Date;return n=+n,r=+r,function(e){return t.setTime(n*(1-e)+r*e),t}}function x(n,r){var t={},e={},u;(n===null||typeof n!="object")&&(n={}),(r===null||typeof r!="object")&&(r={});for(u in r)u in n?t[u]=N(n[u],r[u]):e[u]=r[u];return function(f){for(u in t)e[u]=t[u](f);return e}}function N(n,r){var t=typeof r,e;return r==null||t==="boolean"?j(r):(t==="number"?p:t==="string"?(e=w(r))?(r=e,k):q:r instanceof w?k:r instanceof Date?$:P(r)?I:Array.isArray(r)?V:typeof r.valueOf!="function"&&typeof r.toString!="function"||isNaN(r)?x:p)(n,r)}function O(n,r){return n=+n,r=+r,function(t){return Math.round(n*(1-t)+r*t)}}function M(n,r){return n==null||r==null?NaN:n<r?-1:n>r?1:n>=r?0:NaN}function T(n,r){return n==null||r==null?NaN:r<n?-1:r>n?1:r>=n?0:NaN}function R(n){let r,t,e;n.length!==2?(r=M,t=(o,c)=>M(n(o),c),e=(o,c)=>n(o)-c):(r=n===M||n===T?n:C,t=n,e=n);function u(o,c,i=0,h=o.length){if(i<h){if(r(c,c)!==0)return h;do{const l=i+h>>>1;t(o[l],c)<0?i=l+1:h=l}while(i<h)}return i}function f(o,c,i=0,h=o.length){if(i<h){if(r(c,c)!==0)return h;do{const l=i+h>>>1;t(o[l],c)<=0?i=l+1:h=l}while(i<h)}return i}function a(o,c,i=0,h=o.length){const l=u(o,c,i,h-1);return l>i&&e(o[l-1],c)>-e(o[l],c)?l-1:l}return{left:u,center:a,right:f}}function C(){return 0}function E(n){return n===null?NaN:+n}const G=R(M),H=G.right;R(E).center;const J=Math.sqrt(50),K=Math.sqrt(10),L=Math.sqrt(2);function v(n,r,t){const e=(r-n)/Math.max(0,t),u=Math.floor(Math.log10(e)),f=e/Math.pow(10,u),a=f>=J?10:f>=K?5:f>=L?2:1;let o,c,i;return u<0?(i=Math.pow(10,-u)/a,o=Math.round(n*i),c=Math.round(r*i),o/i<n&&++o,c/i>r&&--c,i=-i):(i=Math.pow(10,u)*a,o=Math.round(n/i),c=Math.round(r/i),o*i<n&&++o,c*i>r&&--c),c<o&&.5<=t&&t<2?v(n,r,t*2):[o,c,i]}function Q(n,r,t){if(r=+r,n=+n,t=+t,!(t>0))return[];if(n===r)return[n];const e=r<n,[u,f,a]=e?v(r,n,t):v(n,r,t);if(!(f>=u))return[];const o=f-u+1,c=new Array(o);if(e)if(a<0)for(let i=0;i<o;++i)c[i]=(f-i)/-a;else for(let i=0;i<o;++i)c[i]=(f-i)*a;else if(a<0)for(let i=0;i<o;++i)c[i]=(u+i)/-a;else for(let i=0;i<o;++i)c[i]=(u+i)*a;return c}function y(n,r,t){return r=+r,n=+n,t=+t,v(n,r,t)[2]}function U(n,r,t){r=+r,n=+n,t=+t;const e=r<n,u=e?y(r,n,t):y(n,r,t);return(e?-1:1)*(u<0?1/-u:u)}function W(n){return function(){return n}}function X(n){return+n}var A=[0,1];function m(n){return n}function d(n,r){return(r-=n=+n)?function(t){return(t-n)/r}:W(isNaN(r)?NaN:.5)}function Y(n,r){var t;return n>r&&(t=n,n=r,r=t),function(e){return Math.max(n,Math.min(r,e))}}function Z(n,r,t){var e=n[0],u=n[1],f=r[0],a=r[1];return u<e?(e=d(u,e),f=t(a,f)):(e=d(e,u),f=t(f,a)),function(o){return f(e(o))}}function _(n,r,t){var e=Math.min(n.length,r.length)-1,u=new Array(e),f=new Array(e),a=-1;for(n[e]<n[0]&&(n=n.slice().reverse(),r=r.slice().reverse());++a<e;)u[a]=d(n[a],n[a+1]),f[a]=t(r[a],r[a+1]);return function(o){var c=H(n,o,1,e)-1;return f[c](u[c](o))}}function b(n,r){return r.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function nn(){var n=A,r=A,t=N,e,u,f,a=m,o,c,i;function h(){var s=Math.min(n.length,r.length);return a!==m&&(a=Y(n[0],n[s-1])),o=s>2?_:Z,c=i=null,l}function l(s){return s==null||isNaN(s=+s)?f:(c||(c=o(n.map(e),r,t)))(e(a(s)))}return l.invert=function(s){return a(u((i||(i=o(r,n.map(e),p)))(s)))},l.domain=function(s){return arguments.length?(n=Array.from(s,X),h()):n.slice()},l.range=function(s){return arguments.length?(r=Array.from(s),h()):r.slice()},l.rangeRound=function(s){return r=Array.from(s),t=O,h()},l.clamp=function(s){return arguments.length?(a=s?!0:m,h()):a!==m},l.interpolate=function(s){return arguments.length?(t=s,h()):t},l.unknown=function(s){return arguments.length?(f=s,l):f},function(s,S){return e=s,u=S,h()}}function rn(){return nn()(m,m)}function en(n){return Math.max(0,-g(Math.abs(n)))}function tn(n,r){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(g(r)/3)))*3-g(Math.abs(n)))}function un(n,r){return n=Math.abs(n),r=Math.abs(r)-n,Math.max(0,g(r)-g(n))+1}function an(n,r,t,e){var u=U(n,r,t),f;switch(e=F(e??",f"),e.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(r));return e.precision==null&&!isNaN(f=tn(u,a))&&(e.precision=f),z(e,a)}case"":case"e":case"g":case"p":case"r":{e.precision==null&&!isNaN(f=un(u,Math.max(Math.abs(n),Math.abs(r))))&&(e.precision=f-(e.type==="e"));break}case"f":case"%":{e.precision==null&&!isNaN(f=en(u))&&(e.precision=f-(e.type==="%")*2);break}}return B(e)}function on(n){var r=n.domain;return n.ticks=function(t){var e=r();return Q(e[0],e[e.length-1],t??10)},n.tickFormat=function(t,e){var u=r();return an(u[0],u[u.length-1],t??10,e)},n.nice=function(t){t==null&&(t=10);var e=r(),u=0,f=e.length-1,a=e[u],o=e[f],c,i,h=10;for(o<a&&(i=a,a=o,o=i,i=u,u=f,f=i);h-- >0;){if(i=y(a,o,t),i===c)return e[u]=a,e[f]=o,r(e);if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else if(i<0)a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i;else break;c=i}return n},n}function fn(){var n=rn();return n.copy=function(){return b(n,fn())},D.apply(n,arguments),on(n)}export{b as a,R as b,rn as c,fn as l,U as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as h,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{i as G,q as T,u as L,Q as C,P as N,E as S,F,T as k,B as q,k as B,l as x,h as D}from"./note.api-D3oJmG3q.js";import{u as O,b as z}from"./time-D5LRMumI.js";import{f as K,d as Q}from"./image.api-CyQisInP.js";import{I as U,g as W}from"./image-delete-confirmation-D7xrODQV.js";import{S as b}from"./SurfaceCard-t7pdfhEe.js";import{d as H,e as $}from"./url-9nrbQs7Z.js";import{c as V,n as X}from"./Trash.es-Bo1VyK9Q.js";const J=n=>{const{data:a}=G({queryKey:T.images.list(n.searchParams),async queryFn(){const s=await K({offset:n.searchParams.offset,limit:n.searchParams.limit});if(s.type==="error")throw s;return s.allImages}});return n.render(a)},M=16;function Y(n,a,s){return Math.max(Math.floor((Math.max(n,0)+s)/(a+s)),1)}function _(n,a,s){return n*a+(n-1)*s}function Z({minItemWidth:n,gap:a,rows:s,fallback:c,override:g}){const[o,p]=h.useState(null),[v,j]=h.useState(c??s),r=h.useRef(null),i=h.useCallback(t=>{p(t)},[]),d=g==null,y=d?v:g;return h.useLayoutEffect(()=>{if(!d){r.current=null;return}if(!o){r.current=null,j(l=>l===(c??s)?l:c??s);return}let t=null;const E=()=>{const l=o.offsetWidth,I=Y(l,n,a),u=r.current;let w=I;if(u!==null&&u!==I)if(I>u){const f=_(u+1,n,a);l<f+M&&(w=u)}else{const f=_(u,n,a);l>f-M&&(w=u)}r.current=w;const A=Math.max(w*s,s);j(f=>f===A?f:A)},m=()=>{t===null&&(t=window.requestAnimationFrame(()=>{t=null,E()}))};if(m(),typeof ResizeObserver<"u"){const l=new ResizeObserver(()=>{m()});return l.observe(o),()=>{l.disconnect(),t!==null&&window.cancelAnimationFrame(t)}}return window.addEventListener("resize",m),window.addEventListener("orientationchange",m),()=>{window.removeEventListener("resize",m),window.removeEventListener("orientationchange",m),t!==null&&window.cancelAnimationFrame(t)}},[o,c,a,d,n,s]),{containerRef:i,limit:y,isAutoLimit:d}}const ee=240,te=20,se=4,R=192,P=D($),ue=()=>{const n=O(),a=L(),s=P.useNavigate(),{page:c}=P.useSearch(),{containerRef:g,limit:o}=Z({minItemWidth:ee,gap:te,rows:se}),p=z({mutationFn:Q,onSuccess:r=>{if(r.type==="error")throw r;a.invalidateQueries({queryKey:T.images.listAll(),exact:!1})}}),v=async(r,i)=>{await n(W(i))&&p.mutate(r)},j=r=>r===1?"1 reference":`${r} references`;return e.jsx("div",{ref:g,children:e.jsx(C,{fallback:e.jsx(N,{title:"Images",variant:"default",heading:e.jsx(x,{width:136,height:24,className:"rounded-full"}),description:e.jsx(x,{width:232,height:16,className:"rounded-full"}),children:e.jsx("div",{className:"flex flex-col gap-4",children:e.jsx("div",{className:"grid-auto-cards grid gap-4",children:Array.from({length:3},(r,i)=>e.jsxs(b,{flush:!0,children:[e.jsx("div",{className:"flex items-center justify-center bg-muted/25 p-3",style:{height:R},children:e.jsx(x,{width:"100%",height:R-24,className:"rounded-[12px]"})}),e.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-border-subtle px-3 py-2.5",children:[e.jsx(x,{width:92,height:14,className:"rounded-full"}),e.jsx(x,{width:32,height:32,className:"rounded-[12px]"})]})]},i))})})}),errorTitle:"Failed to load images",errorDescription:"Retry loading uploaded image metadata",resetKeys:[c,o],children:e.jsx(J,{searchParams:{offset:(c-1)*o,limit:o},render:({images:r,totalCount:i})=>{const d=i>0?`Images (${i})`:void 0,y="Review and manage the images you uploaded inside notes";return r.length===0?e.jsx(N,{title:"Images",variant:"default",heading:d,description:y,children:e.jsx(S,{title:"There are no images",description:"Upload an image in any note and it will appear here"})}):e.jsx(N,{title:"Images",variant:"default",heading:d,description:y,children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"grid-auto-cards grid gap-4",children:r.map(t=>e.jsxs(b,{flush:!0,children:[e.jsx(F,{to:H,params:{id:t.id},className:"focus-ring-soft block overflow-hidden rounded-t-[18px] outline-none",children:e.jsx("div",{className:"flex items-center justify-center bg-muted/25 p-3",style:{height:R},children:e.jsx(U,{className:"h-full w-full rounded-[12px] object-contain transition-transform duration-200 hover:scale-[1.02]",src:t.url,alt:t.id})})}),e.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-border-subtle px-3 py-2.5",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-fg-secondary",children:[e.jsx(V,{className:"h-3.5 w-3.5 shrink-0 text-fg-tertiary"}),e.jsx(k,{as:"span",variant:"meta",weight:"medium",tone:"secondary",className:"truncate",children:j(t.referenceCount)})]}),e.jsx(q,{variant:"ghost",size:"icon-sm",disabled:p.isPending,"aria-label":`Delete image ${t.id}`,onClick:()=>v(t.id,t.referenceCount),children:e.jsx(X,{className:"h-4 w-4"})})]})]},t.id))}),i&&o<i&&e.jsx(B,{page:c,last:Math.ceil(i/o),onChange:t=>{s({search:E=>({...E,page:t})})}})]})})}})})})};export{ue as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{A as F,T as r,F as f,K as k,N as D,Q as R,h as _,u as Z,i as y,q as h,O as q,R as B,B as b,l as c,e as G}from"./note.api-D3oJmG3q.js";import{t as O,u as z,b as v}from"./time-D5LRMumI.js";import{a as H,d as K}from"./image.api-CyQisInP.js";import{c as L}from"./app-BpSMjzET.js";import{I as Q,g as P}from"./image-delete-confirmation-D7xrODQV.js";import{S as x}from"./SurfaceCard-t7pdfhEe.js";import{N as U,T as $,e as C,d as V}from"./url-9nrbQs7Z.js";import"./NotePropertiesPanel-aCKXAe5F.js";import{c as W,n as J}from"./Trash.es-Bo1VyK9Q.js";import{I as X}from"./Image.es-OYyN3BYt.js";import"./preload-helper-BXl3LOEh.js";import"./Graph-LY_IgMYy.js";import"./AuxiliaryPanelHeader-B1k7pZpn.js";import"./Plus.es-DRfLW_bI.js";const Y=new Map([["bold",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,36c-20.09,0-37.92,7.93-50,21.56C115.92,43.93,98.09,36,78,36a66.08,66.08,0,0,0-66,66c0,72.34,105.81,130.14,110.31,132.57a12,12,0,0,0,11.38,0C138.19,232.14,244,174.34,244,102A66.08,66.08,0,0,0,178,36Zm-5.49,142.36A328.69,328.69,0,0,1,128,210.16a328.69,328.69,0,0,1-44.51-31.8C61.82,159.77,36,131.42,36,102A42,42,0,0,1,78,60c17.8,0,32.7,9.4,38.89,24.54a12,12,0,0,0,22.22,0C145.3,69.4,160.2,60,178,60a42,42,0,0,1,42,42C220,131.42,194.18,159.77,172.51,178.36Z"}))],["duotone",t.createElement(t.Fragment,null,t.createElement("path",{d:"M232,102c0,66-104,122-104,122S24,168,24,102A54,54,0,0,1,78,48c22.59,0,41.94,12.31,50,32,8.06-19.69,27.41-32,50-32A54,54,0,0,1,232,102Z",opacity:"0.2"}),t.createElement("path",{d:"M178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,70,103.79,126.66,108.21,129a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40ZM128,214.8C109.74,204.16,32,155.69,32,102A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46C224,155.61,146.24,204.15,128,214.8Z"}))],["fill",t.createElement(t.Fragment,null,t.createElement("path",{d:"M240,102c0,70-103.79,126.66-108.21,129a8,8,0,0,1-7.58,0C119.79,228.66,16,172,16,102A62.07,62.07,0,0,1,78,40c20.65,0,38.73,8.88,50,23.89C139.27,48.88,157.35,40,178,40A62.07,62.07,0,0,1,240,102Z"}))],["light",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,42c-21,0-39.26,9.47-50,25.34C117.26,51.47,99,42,78,42a60.07,60.07,0,0,0-60,60c0,29.2,18.2,59.59,54.1,90.31a334.68,334.68,0,0,0,53.06,37,6,6,0,0,0,5.68,0,334.68,334.68,0,0,0,53.06-37C219.8,161.59,238,131.2,238,102A60.07,60.07,0,0,0,178,42ZM128,217.11C111.59,207.64,30,157.72,30,102A48.05,48.05,0,0,1,78,54c20.28,0,37.31,10.83,44.45,28.27a6,6,0,0,0,11.1,0C140.69,64.83,157.72,54,178,54a48.05,48.05,0,0,1,48,48C226,157.72,144.41,207.64,128,217.11Z"}))],["regular",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,70,103.79,126.66,108.21,129a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40ZM128,214.8C109.74,204.16,32,155.69,32,102A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46C224,155.61,146.24,204.15,128,214.8Z"}))],["thin",t.createElement(t.Fragment,null,t.createElement("path",{d:"M178,44c-21.44,0-39.92,10.19-50,27.07C117.92,54.19,99.44,44,78,44a58.07,58.07,0,0,0-58,58c0,28.59,18,58.47,53.4,88.79a333.81,333.81,0,0,0,52.7,36.73,4,4,0,0,0,3.8,0,333.81,333.81,0,0,0,52.7-36.73C218,160.47,236,130.59,236,102A58.07,58.07,0,0,0,178,44ZM128,219.42c-14-8-100-59.35-100-117.42A50.06,50.06,0,0,1,78,52c21.11,0,38.85,11.31,46.3,29.51a4,4,0,0,0,7.4,0C139.15,63.31,156.89,52,178,52a50.06,50.06,0,0,1,50,50C228,160,142,211.46,128,219.42Z"}))]]),E=t.forwardRef((a,n)=>t.createElement(F,{ref:n,...a,weights:Y}));E.displayName="HeartIcon";const ee=E;function ae({name:a}){return e.jsx(r,{as:"div",variant:"label",weight:"medium",tone:"secondary",className:"inline-flex items-center rounded-full border border-border-subtle bg-hover-subtle px-2.5 py-1",children:a})}function se({id:a,title:n,tags:i,createdAt:g,updatedAt:d}){const o=new Date(Number(g)),m=O(Number(d));return e.jsx("div",{className:"border-b-2 border-dashed border-border-subtle last:border-b-0",children:e.jsxs("div",{className:"py-4 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(r,{variant:"label",weight:"medium",tone:"tertiary",children:m}),e.jsxs(r,{variant:"label",tone:"placeholder",children:["(",o.toDateString(),")"]})]}),e.jsx(r,{as:"div",variant:"body",weight:"bold",tracking:"tight",children:e.jsx(f,{className:"transition-colors hover:text-accent-primary",to:U,params:{id:a},children:n||"Untitled"})}),i&&i.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map(l=>e.jsx(f,{to:$,params:{id:l.id},search:{page:1},children:e.jsx(ae,{name:l.name})},l.id))})]})})}const A=_(V),p=352,te="mb-4 inline-flex items-center gap-1 text-fg-secondary transition-colors hover:text-fg-default",I="flex items-center justify-center bg-muted/25 p-3",re="h-full w-full rounded-[12px] object-contain",T="mb-3 flex flex-wrap items-start justify-between gap-3 border-b border-border-subtle pb-3",M="space-y-1",ne=a=>a===1?"1 reference":`${a} references`,w=(a,n)=>typeof a=="object"&&a!==null&&"errors"in a&&Array.isArray(a.errors)&&typeof a.errors[0]?.message=="string"?a.errors[0].message:a instanceof Error&&a.message?a.message:n,ie=()=>e.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row",children:[e.jsx("div",{className:"w-full lg:w-[400px] lg:flex-shrink-0",children:e.jsxs(x,{flush:!0,children:[e.jsx("div",{className:I,style:{height:p},children:e.jsx(c,{width:"100%",height:p-24,className:"rounded-[12px]"})}),e.jsxs("div",{className:"flex flex-col gap-4 border-t border-border-subtle p-4",children:[e.jsx(c,{width:96,height:14,className:"rounded-full"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(c,{height:32,className:"flex-1 rounded-[12px]"}),e.jsx(c,{height:32,className:"flex-1 rounded-[12px]"})]})]})]})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs(x,{children:[e.jsxs("div",{className:T,children:[e.jsxs("div",{className:M,children:[e.jsx(c,{width:140,height:18}),e.jsx(c,{width:220,height:14,className:"rounded-full"})]}),e.jsx(c,{width:84,height:14,className:"rounded-full"})]}),e.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:3},(a,n)=>e.jsx(c,{height:72,className:"rounded-[16px]"},n))})]})})]}),le=({id:a})=>{const n=z(),i=G(),g=A.useNavigate(),d=Z(),{data:o}=y({queryKey:h.images.detail(a),queryFn:async()=>{const s=await H(a);if(s.type==="error")throw s;return s.image}}),{data:m}=y({queryKey:h.images.notes(a),queryFn:async()=>{const s=await q(o.url);if(s.type==="error")throw s;return s.imageNotes}}),l=m.length,j=ne(l),u=v({mutationFn:async()=>{const s=await K(a);if(s.type==="error")throw s;if(!s.deleteImage)throw new Error("Failed to delete image");return s.deleteImage},onSuccess:async()=>{await d.invalidateQueries({queryKey:h.images.listAll(),exact:!1}),i("Image deleted"),g({to:C,search:{page:1}})},onError:s=>{i(w(s,"Failed to delete image"))}}),N=v({mutationFn:async()=>{const s=await L("heroBanner",o.url);if(s.type==="error")throw s},onSuccess:async()=>{await d.invalidateQueries({queryKey:h.ui.heroBanner(),exact:!0}),i("Hero banner updated")},onError:s=>{i(w(s,"Failed to update hero banner"))}}),S=async()=>{u.isPending||await n(P(l))&&u.mutate()};return e.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row",children:[e.jsx("div",{className:"w-full lg:w-[400px] lg:flex-shrink-0",children:e.jsxs(x,{flush:!0,children:[e.jsx("div",{className:I,style:{height:p},children:e.jsx(Q,{className:re,src:o.url,alt:`Image ${o.id}`})}),e.jsxs("div",{className:"flex flex-col gap-4 border-t border-border-subtle p-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{size:14,className:"text-fg-tertiary"}),e.jsx(r,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:j})]}),e.jsx(r,{as:"p",variant:"meta",tone:"tertiary",children:l>0?"Deleting this image will break it in the referenced notes":"No notes currently reference this image"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(B,{content:"Delete this image",side:"bottom",children:e.jsxs(b,{variant:"soft-danger",size:"sm",className:"flex-1",isLoading:u.isPending,onClick:S,children:[e.jsx(J,{size:16}),"Delete"]})}),e.jsxs(b,{variant:"primary",size:"sm",className:"flex-1",isLoading:N.isPending,onClick:()=>N.mutate(),children:[e.jsx(ee,{size:16}),"Set hero banner"]})]})]})]})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs(x,{children:[e.jsxs("div",{className:T,children:[e.jsxs("div",{className:M,children:[e.jsx(r,{as:"h2",variant:"subheading",weight:"medium",tracking:"tight",children:"Referenced Notes"}),e.jsx(r,{as:"p",variant:"meta",tone:"secondary",children:"Notes currently using this image"})]}),e.jsx(r,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:j})]}),l>0?e.jsx("ul",{className:"flex flex-col",children:m.map(s=>e.jsx("li",{children:e.jsx(se,{...s})},s.id))}):e.jsxs("div",{className:"flex items-start gap-3 py-1",children:[e.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-[10px] bg-muted/25 text-fg-disabled",children:e.jsx(X,{size:18})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(r,{as:"p",variant:"body",weight:"medium",tone:"secondary",children:"No notes reference this image"}),e.jsx(r,{as:"p",variant:"meta",tone:"secondary",children:"This image can be deleted or reused in another note"})]})]})]})})]})},we=()=>{const{id:a}=A.useParams();return e.jsxs(e.Fragment,{children:[e.jsx(k,{children:e.jsx("title",{children:"Image Detail | Ocean Brain"})}),e.jsxs(f,{to:C,search:{page:1},className:te,children:[e.jsx(D,{size:16}),e.jsx(r,{as:"span",variant:"meta",weight:"medium",className:"text-current",children:"Back to Images"})]}),e.jsx(r,{as:"h1",variant:"heading",weight:"bold",tracking:"tighter",className:"sr-only",children:"Image Detail"}),e.jsx(R,{fallback:e.jsx(ie,{}),errorTitle:"Failed to load image detail",errorDescription:"Retry loading the image preview and its referenced notes",resetKeys:[a],children:e.jsx(le,{id:a})})]})};export{we as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as w,e as V,a as M,b as B,c as k,o as rr,k as _,g as D,s as er,f as tr,h as nr,U as $,j as T,l as G,n as l,m as ar,S as or,p as sr,q as K,r as ir,t as cr,u as fr,v as ur}from"./graph-C5DFNLrC.js";import{a as d,r as gr,S,b as N}from"./isObject-U9U2HXiq.js";var I=Object.create,br=(function(){function r(){}return function(e){if(!d(e))return{};if(I)return I(e);r.prototype=e;var t=new r;return r.prototype=void 0,t}})();function lr(r,e){var t=-1,a=r.length;for(e||(e=Array(a));++t<a;)e[t]=r[t];return e}function R(r,e,t){e=="__proto__"&&w?w(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t}var pr=Object.prototype,yr=pr.hasOwnProperty;function q(r,e,t){var a=r[e];(!(yr.call(r,e)&&V(a,t))||t===void 0&&!(e in r))&&R(r,e,t)}function p(r,e,t,a){var g=!t;t||(t={});for(var s=-1,o=e.length;++s<o;){var c=e[s],i=void 0;i===void 0&&(i=r[c]),g?R(t,c,i):q(t,c,i)}return t}function Tr(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}var dr=Object.prototype,jr=dr.hasOwnProperty;function Ar(r){if(!d(r))return Tr(r);var e=M(r),t=[];for(var a in r)a=="constructor"&&(e||!jr.call(r,a))||t.push(a);return t}function j(r){return B(r)?k(r,!0):Ar(r)}var W=rr(Object.getPrototypeOf,Object);function mr(r,e){return r&&p(e,_(e),r)}function hr(r,e){return r&&p(e,j(e),r)}var Y=typeof exports=="object"&&exports&&!exports.nodeType&&exports,x=Y&&typeof module=="object"&&module&&!module.nodeType&&module,vr=x&&x.exports===Y,P=vr?gr.Buffer:void 0,E=P?P.allocUnsafe:void 0;function Or(r,e){if(e)return r.slice();var t=r.length,a=E?E(t):new r.constructor(t);return r.copy(a),a}function wr(r,e){return p(r,D(r),e)}var $r=Object.getOwnPropertySymbols,H=$r?function(r){for(var e=[];r;)tr(e,D(r)),r=W(r);return e}:er;function Sr(r,e){return p(r,H(r),e)}function Ir(r){return nr(r,j,H)}var xr=Object.prototype,Pr=xr.hasOwnProperty;function Er(r){var e=r.length,t=new r.constructor(e);return e&&typeof r[0]=="string"&&Pr.call(r,"index")&&(t.index=r.index,t.input=r.input),t}function A(r){var e=new r.constructor(r.byteLength);return new $(e).set(new $(r)),e}function Cr(r,e){var t=e?A(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.byteLength)}var Ur=/\w*$/;function Fr(r){var e=new r.constructor(r.source,Ur.exec(r));return e.lastIndex=r.lastIndex,e}var C=S?S.prototype:void 0,U=C?C.valueOf:void 0;function Lr(r){return U?Object(U.call(r)):{}}function Mr(r,e){var t=e?A(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.length)}var Br="[object Boolean]",_r="[object Date]",Dr="[object Map]",Gr="[object Number]",Kr="[object RegExp]",Nr="[object Set]",Rr="[object String]",qr="[object Symbol]",Wr="[object ArrayBuffer]",Yr="[object DataView]",Hr="[object Float32Array]",Jr="[object Float64Array]",Qr="[object Int8Array]",Xr="[object Int16Array]",Zr="[object Int32Array]",zr="[object Uint8Array]",Vr="[object Uint8ClampedArray]",kr="[object Uint16Array]",re="[object Uint32Array]";function ee(r,e,t){var a=r.constructor;switch(e){case Wr:return A(r);case Br:case _r:return new a(+r);case Yr:return Cr(r,t);case Hr:case Jr:case Qr:case Xr:case Zr:case zr:case Vr:case kr:case re:return Mr(r,t);case Dr:return new a;case Gr:case Rr:return new a(r);case Kr:return Fr(r);case Nr:return new a;case qr:return Lr(r)}}function te(r){return typeof r.constructor=="function"&&!M(r)?br(W(r)):{}}var ne="[object Map]";function ae(r){return N(r)&&T(r)==ne}var F=l&&l.isMap,oe=F?G(F):ae,se="[object Set]";function ie(r){return N(r)&&T(r)==se}var L=l&&l.isSet,ce=L?G(L):ie,fe=1,ue=2,ge=4,J="[object Arguments]",be="[object Array]",le="[object Boolean]",pe="[object Date]",ye="[object Error]",Q="[object Function]",Te="[object GeneratorFunction]",de="[object Map]",je="[object Number]",X="[object Object]",Ae="[object RegExp]",me="[object Set]",he="[object String]",ve="[object Symbol]",Oe="[object WeakMap]",we="[object ArrayBuffer]",$e="[object DataView]",Se="[object Float32Array]",Ie="[object Float64Array]",xe="[object Int8Array]",Pe="[object Int16Array]",Ee="[object Int32Array]",Ce="[object Uint8Array]",Ue="[object Uint8ClampedArray]",Fe="[object Uint16Array]",Le="[object Uint32Array]",n={};n[J]=n[be]=n[we]=n[$e]=n[le]=n[pe]=n[Se]=n[Ie]=n[xe]=n[Pe]=n[Ee]=n[de]=n[je]=n[X]=n[Ae]=n[me]=n[he]=n[ve]=n[Ce]=n[Ue]=n[Fe]=n[Le]=!0;n[ye]=n[Q]=n[Oe]=!1;function y(r,e,t,a,g,s){var o,c=e&fe,i=e&ue,Z=e≥if(o!==void 0)return o;if(!d(r))return r;var m=K(r);if(m){if(o=Er(r),!c)return lr(r,o)}else{var b=T(r),h=b==Q||b==Te;if(ar(r))return Or(r,c);if(b==X||b==J||h&&!g){if(o=i||h?{}:te(r),!c)return i?Sr(r,hr(o,r)):wr(r,mr(o,r))}else{if(!n[b])return g?r:{};o=ee(r,b,c)}}s||(s=new or);var v=s.get(r);if(v)return v;s.set(r,o),ce(r)?r.forEach(function(f){o.add(y(f,e,t,f,r,s))}):oe(r)&&r.forEach(function(f,u){o.set(u,y(f,e,t,u,r,s))});var z=Z?i?Ir:ir:i?j:_,O=m?void 0:z(r);return sr(O||r,function(f,u){O&&(u=f,f=r[u]),q(o,u,y(f,e,t,u,r,s))}),o}function Me(r,e){var t=-1,a=B(r)?Array(r.length):[];return cr(r,function(g,s,o){a[++t]=e(g,s,o)}),a}function De(r,e){var t=K(r)?ur:Me;return t(r,fr(e))}export{R as a,y as b,p as c,lr as d,Or as e,Mr as f,W as g,q as h,te as i,Me as j,j as k,De as m};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as u,j as e}from"./floating-ui.react-dom-
|
|
2
|
-
`)},A=(t,
|
|
3
|
-
`):["# 1. Create the token file",
|
|
4
|
-
`)},ue=t=>!t||t==="unknown"?"MCP compatibility":`MCP compatibility ${t}`,pe={codex:"Codex",claude:"Claude",json:"JSON"},
|
|
1
|
+
import{r as u,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{u as Z,a as W,b as k}from"./time-D5LRMumI.js";import{u as X,P as Y,T as o,a as ee,b as j,L as p,B as x,d as $,s as te,I as O,S as ne,e as ae}from"./note.api-D3oJmG3q.js";import{f as se,s as oe,r as ie,a as ce}from"./mcp-admin-adapter-PMmgPupc.js";import{s as E}from"./Copy.es-BoLjilxv.js";import"./url-9nrbQs7Z.js";const h=["mcp-admin","status"],f=t=>/^[A-Za-z0-9_./:@$-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`,L="$HOME/.config/ocean-brain/mcp-token",R=(t,n)=>{const s=f(t);return[`mkdir -p "$(dirname ${s})"`,`printf '%s' ${f(n)} > ${s}`,`chmod 600 ${s}`].join(`
|
|
2
|
+
`)},A=(t,n)=>`npx -y ocean-brain mcp --server ${f(t)} --token-file ${f(n)}`,re=(t,n)=>`codex mcp add ocean-brain -- ${A(t,n)}`,le=(t,n)=>`claude mcp add --transport stdio ocean-brain -- ${A(t,n)}`,de=(t,n)=>JSON.stringify({mcpServers:{"ocean-brain":{command:"npx",args:["-y","ocean-brain","mcp","--server",t,"--token-file",n]}}},null,2),me=(t,n,s,c)=>{const d=t==="codex"?re(n,s):t==="claude"?le(n,s):de(n,s);return t==="json"?["# 1. Create the token file",R(s,c),"","# 2. Add this MCP JSON",d].join(`
|
|
3
|
+
`):["# 1. Create the token file",R(s,c),"",`# 2. Add Ocean Brain to ${t}`,d].join(`
|
|
4
|
+
`)},ue=t=>!t||t==="unknown"?"MCP compatibility":`MCP compatibility ${t}`,pe={codex:"Codex",claude:"Claude",json:"JSON"},je=()=>{const t=Z(),n=ae(),s=X(),[c,d]=u.useState(()=>window.location.origin),[r,C]=u.useState(""),[v,F]=u.useState(L),[i,J]=u.useState("codex"),{data:y,isLoading:z}=W({queryKey:h,queryFn:se}),w=k({mutationFn:oe,onSuccess:a=>{s.setQueryData(h,a),n(a.enabled?"MCP access enabled.":"MCP access disabled.")}}),N=k({mutationFn:ie,onSuccess:async({token:a})=>{C(a),n("New MCP token issued. Previous token is no longer valid."),await s.invalidateQueries({queryKey:h})}}),T=k({mutationFn:ce,onSuccess:a=>{C(""),s.setQueryData(h,a),n("MCP token revoked. Existing client configs will stop working.")}}),b=y?.enabled??!1,l=y?.hasActiveToken??!1,Q=!z&&!w.isPending,B=v.trim()||L,q=ue(y?.server.mcpVersionRequirement),I=l?"1 active token":"No active token",K=i==="json"?"Token file and MCP JSON":`${pe[i]} setup`,M=me(i,c,B,r||"PASTE_TOKEN_HERE"),_="Copy setup",P="text-fg-tertiary",m="font-medium text-fg-tertiary",g="surface-base px-4 py-3.5",S="space-y-2",H="max-w-full overflow-x-auto whitespace-pre font-mono text-xs leading-5 text-fg-secondary",V=async()=>{try{await navigator.clipboard.writeText(r),n("Copied token.")}catch{n("Failed to copy token.")}},G=async()=>{try{await navigator.clipboard.writeText(M),n(i==="json"?"Copied MCP JSON.":"Copied MCP command.")}catch{n(`Could not copy. Select the ${i==="json"?"JSON":"command"} and copy it manually.`)}},D=async()=>{l&&!await t("Rotate the MCP token? Existing MCP clients will stop working until they use the new token.")||N.mutate(void 0)},U=async()=>{await t("Revoke the MCP token? Existing MCP clients will stop working immediately.")&&T.mutate()};return e.jsx(Y,{title:"MCP",variant:"default",description:"Connect this Ocean Brain instance to MCP clients.",headerRight:e.jsxs("div",{className:"inline-flex items-center gap-3 rounded-[14px] border border-border-subtle bg-muted px-3 py-2",children:[e.jsxs(o,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:["MCP access ",b?"on":"off"]}),e.jsx(ne,{"aria-label":"MCP access",checked:b,disabled:!Q,onCheckedChange:()=>{w.mutate(!b)}})]}),children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("section",{className:"flex flex-col gap-3","aria-labelledby":"mcp-connect-heading",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(o,{id:"mcp-connect-heading",as:"h2",variant:"label",weight:"medium",className:P,children:"Connect a client"}),e.jsx(o,{as:"p",variant:"meta",tone:"secondary",children:"Save your token in a local file, then copy the command for your client."})]}),e.jsx(o,{as:"span",variant:"meta",weight:"medium",tone:"tertiary",className:"rounded-full border border-border-subtle bg-hover-subtle px-2.5 py-1",children:q})]}),e.jsxs("div",{className:`${g} flex flex-col gap-3`,children:[e.jsx("div",{className:"flex flex-wrap items-center gap-3",children:e.jsxs(ee,{type:"single",variant:"quiet",size:"sm",value:i,onValueChange:a=>{(a==="codex"||a==="claude"||a==="json")&&J(a)},children:[e.jsx(j,{value:"codex",children:"Codex"}),e.jsx(j,{value:"claude",children:"Claude"}),e.jsx(j,{value:"json",children:"JSON"})]})}),e.jsxs("div",{className:"min-w-0 space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx(p,{htmlFor:"mcp-connection-output",className:m,children:K}),e.jsxs(x,{type:"button",variant:"subtle",size:"sm",onClick:G,children:[e.jsx(E,{className:"h-4 w-4"}),_]})]}),e.jsx($,{id:"mcp-connection-output",readOnly:!0,rows:i==="json"?13:9,wrap:"off",value:M,className:H}),e.jsx(o,{as:"p",variant:"meta",tone:"tertiary",children:r?"The new token is already included in the token file step.":"Replace PASTE_TOKEN_HERE before running. The MCP client reads the token from that file."})]}),e.jsxs("details",{className:"group rounded-[12px] border border-border-subtle bg-muted",children:[e.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2.5 marker:hidden",children:[e.jsx(o,{as:"span",variant:"meta",weight:"medium",tone:"secondary",children:"Connection options"}),e.jsx(te,{className:"h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-open:rotate-180","aria-hidden":"true"})]}),e.jsxs("div",{className:"space-y-3 border-t border-border-subtle px-3 py-3",children:[e.jsxs("div",{className:S,children:[e.jsx(p,{htmlFor:"mcp-server-url",className:m,children:"Ocean Brain URL"}),e.jsx(O,{id:"mcp-server-url",value:c,onChange:a=>d(a.target.value)})]}),e.jsxs("div",{className:S,children:[e.jsx(p,{htmlFor:"mcp-token-file-path",className:m,children:"Token file path"}),e.jsx(O,{id:"mcp-token-file-path",placeholder:"/absolute/path/to/ocean-brain-mcp-token.txt",value:v,onChange:a=>F(a.target.value)})]})]})]})]})]}),e.jsxs("section",{className:"flex flex-col gap-3","aria-labelledby":"mcp-token-heading",children:[e.jsxs("div",{className:`${g} flex flex-wrap items-center justify-between gap-3`,children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx(o,{id:"mcp-token-heading",as:"h2",variant:"label",weight:"medium",className:P,children:"Token"}),e.jsxs(o,{as:"p",variant:"meta",tone:"tertiary",children:[I,". New tokens are shown once."]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(x,{type:"button",size:"sm",variant:l?"subtle":"primary",onClick:D,isLoading:N.isPending,children:l?"Rotate token":"Issue token"}),e.jsx(x,{type:"button",size:"sm",variant:"soft-danger",onClick:U,isLoading:T.isPending,disabled:!l,children:"Revoke token"})]})]}),r&&e.jsxs("div",{className:`${g} border-dashed`,children:[e.jsxs("div",{className:"mb-3 flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(p,{htmlFor:"issued-mcp-token",className:m,children:"New token"}),e.jsx(o,{as:"p",variant:"meta",tone:"secondary",children:"Copy this token now and save it in your token file."})]}),e.jsxs(x,{type:"button",variant:"subtle",size:"sm",onClick:V,children:[e.jsx(E,{className:"h-4 w-4"}),"Copy token"]})]}),e.jsx($,{id:"issued-mcp-token",rows:3,readOnly:!0,value:r})]})]})]})})};export{je as default};
|
package/server/client/dist/assets/{mcp-admin-adapter-xAuyZc_M.js → mcp-admin-adapter-PMmgPupc.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{f as t}from"./note.api-D3oJmG3q.js";const o=async()=>{const{data:a}=await t.get("/api/mcp-admin/status");return a},c=async a=>{const{data:n}=await t.post("/api/mcp-admin/enabled",{enabled:a});return n},e=async()=>{const{data:a}=await t.post("/api/mcp-admin/token/rotate");return a},p=async()=>{const{data:a}=await t.post("/api/mcp-admin/token/revoke");return a};export{p as a,o as f,e as r,c as s};
|