ocean-brain 0.12.0 → 0.12.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/README.md +1 -1
- package/package.json +4 -2
- package/server/client/dist/assets/{ArrowRight.es-DZTjsBaI.js → ArrowRight.es-CD1IMhU2.js} +1 -1
- package/server/client/dist/assets/{AuxiliaryPanelHeader-Bp3iRjm6.js → AuxiliaryPanelHeader-zoJGsYWR.js} +1 -1
- package/server/client/dist/assets/Calendar-6otw_EJn.js +25 -0
- package/server/client/dist/assets/{Callout-Cye6_6BM.js → Callout-C1QiCWCa.js} +1 -1
- package/server/client/dist/assets/{CheckCircle.es-BTloiuti.js → CheckCircle.es-C7fkzE3t.js} +1 -1
- package/server/client/dist/assets/{Copy.es-CkLUgwY-.js → Copy.es-D6rl6b78.js} +1 -1
- package/server/client/dist/assets/{File.es-c83QExqr.js → File.es-CcjtzE38.js} +1 -1
- package/server/client/dist/assets/{FlowArrow.es-DWiIXWQG.js → FlowArrow.es-CAIThqWk.js} +1 -1
- package/server/client/dist/assets/{Graph-jbPLcne9.js → Graph-BHsmPDPh.js} +1 -1
- package/server/client/dist/assets/{Image.es-vY-nTyOe.js → Image.es-BDpo5R66.js} +1 -1
- package/server/client/dist/assets/Note-Dq2Szaxd.js +19 -0
- package/server/client/dist/assets/{NotePropertiesPanel-uO-JKy19.js → NotePropertiesPanel-Cu3RgDic.js} +2 -2
- package/server/client/dist/assets/{Plus.es-CaRgmXc_.js → Plus.es-P9Fjwtud.js} +1 -1
- package/server/client/dist/assets/{Reminders-BAgZEUwV.js → Reminders-DKm0GFI2.js} +1 -1
- package/server/client/dist/assets/{Search-BxozUWkC.js → Search-DVROxY_B.js} +1 -1
- package/server/client/dist/assets/{SurfaceCard-BAlcul6z.js → SurfaceCard-D_OU_Oy6.js} +1 -1
- package/server/client/dist/assets/{Tag-BhCf_mil.js → Tag-wMHTRwlF.js} +1 -1
- package/server/client/dist/assets/{TagNotes-BIzhXqwp.js → TagNotes-BRza6i14.js} +1 -1
- package/server/client/dist/assets/{Trash.es-prxIxo9c.js → Trash.es-BeR1sZMe.js} +1 -1
- package/server/client/dist/assets/{ViewChip-Cq_YzRvB.js → ViewChip-D-Ax5PdL.js} +1 -1
- package/server/client/dist/assets/{Views-C26uWznP.js → Views-CL7rC05G.js} +1 -1
- package/server/client/dist/assets/{abnfDiagram-VRR7QNED-2cuaaDg0.js → abnfDiagram-N423BO3Z-D44O4T7q.js} +1 -1
- package/server/client/dist/assets/{app-DbQdHfMb.js → app-CyQtGTtn.js} +3 -3
- package/server/client/dist/assets/app-DGFNtdpS.css +1 -0
- package/server/client/dist/assets/{arc-Cr-oYJoQ.js → arc-Cil9fXuW.js} +1 -1
- package/server/client/dist/assets/architectureDiagram-T3A2C74G-Cjq6ayF2.js +36 -0
- package/server/client/dist/assets/{blockDiagram-677ZJIJ3-evR8rlpQ.js → blockDiagram-VBNYF7ZC-B2Xm5N0i.js} +1 -1
- package/server/client/dist/assets/{c4Diagram-LMCZKHZV-zCjuWUmC.js → c4Diagram-5PPSVZJV-Dp0y-lCR.js} +1 -1
- package/server/client/dist/assets/channel-DZFalh-h.js +1 -0
- package/server/client/dist/assets/{chunk-32BRIVSS-102-EyWU.js → chunk-2GRJ4B5K-CWaaNkFx.js} +1 -1
- package/server/client/dist/assets/{chunk-2Q5K7J3B-P0v1gRui.js → chunk-2Q5K7J3B-Ces-xz2S.js} +1 -1
- package/server/client/dist/assets/{chunk-EX3LRPZG-k5hlNinR.js → chunk-5RXB4S5H-B-4Chlfc.js} +1 -1
- package/server/client/dist/assets/{chunk-5VM5RSS4-uqI_1K1p.js → chunk-5VM5RSS4-C8_HVwuz.js} +1 -1
- package/server/client/dist/assets/{chunk-MOJQB5TN-B-LmIwhJ.js → chunk-6Q2QTUOP-xZ8ofRqk.js} +1 -1
- package/server/client/dist/assets/{chunk-V7JOEXUC-CmSzAkUx.js → chunk-GF5L2VYU-Bpa43a7s.js} +1 -1
- package/server/client/dist/assets/{chunk-JWPE2WC7-PLvgEy_B.js → chunk-JWPE2WC7-DsyTXbuq.js} +1 -1
- package/server/client/dist/assets/{chunk-VR4S4FIN-IiOfWaBG.js → chunk-KBJHAD2P-BDhjm9-8.js} +1 -1
- package/server/client/dist/assets/{chunk-RYQCIY6F-CaNSMki0.js → chunk-RYQCIY6F-Cn-jdp6I.js} +1 -1
- package/server/client/dist/assets/{chunk-XXDRQBXY-DRXrI6SM.js → chunk-XXDRQBXY-BKsc_0wh.js} +1 -1
- package/server/client/dist/assets/classDiagram-JCYQIIEL-CkEhFvVV.js +1 -0
- package/server/client/dist/assets/classDiagram-v2-OCEON4UE-CkEhFvVV.js +1 -0
- package/server/client/dist/assets/{cose-bilkent-JH36ORCC-COcEaZRS.js → cose-bilkent-JH36ORCC-jmn3Q4zj.js} +1 -1
- package/server/client/dist/assets/{cynefinDiagram-TSTJHNR4-CSHqcg9K.js → cynefinDiagram-MW4NZA55-BpLstuBJ.js} +1 -1
- package/server/client/dist/assets/{dagre-VKFMJZFB-XAWCPOS0.js → dagre-VZM6K2ZE-B5ft5Yzm.js} +1 -1
- package/server/client/dist/assets/{diagram-OA4YK3LP-CXTlHB5A.js → diagram-7IWD3JNH-B_W9IsWZ.js} +1 -1
- package/server/client/dist/assets/{diagram-FQU43EPY-scBCDUnE.js → diagram-B4RE2ZJO-32chS3GX.js} +1 -1
- package/server/client/dist/assets/{diagram-NH7WQ7WH-DcWalY4j.js → diagram-LBJQPF4R-Bqupdb3-.js} +1 -1
- package/server/client/dist/assets/{diagram-G47NLZAW-nPKP5kd8.js → diagram-Q27KOJAE-BD8jKBsv.js} +1 -1
- package/server/client/dist/assets/diagram-UB23O5K3-C40jAU8D.js +41 -0
- package/server/client/dist/assets/{ebnfDiagram-CCIWWBDH-nHt3vRNt.js → ebnfDiagram-BXEA7PRR-BQfW9mFA.js} +1 -1
- package/server/client/dist/assets/{erDiagram-Q63AITRT-K6stUUV2.js → erDiagram-JOGREHBK-ILZnLzz2.js} +1 -1
- package/server/client/dist/assets/{flowDiagram-23GEKE2U-DDWtKrEp.js → flowDiagram-UKHOOZJN-CDmwr2dI.js} +4 -4
- package/server/client/dist/assets/{ganttDiagram-NO4QXBWP-Daqh7b4I.js → ganttDiagram-PKOTCBZU-DBcrUc49.js} +1 -1
- package/server/client/dist/assets/{gitGraphDiagram-IHSO6WYX-D73CLkcG.js → gitGraphDiagram-DS77QQ5N-_xO6__FK.js} +1 -1
- package/server/client/dist/assets/{image.api-Bbwmcw0T.js → image.api-CtfyPwkV.js} +1 -1
- package/server/client/dist/assets/{index-8bsOoxxg.js → index-BEfKfbvr.js} +1 -1
- package/server/client/dist/assets/{infoDiagram-FWYZ7A6U-Bc1YI5Iu.js → infoDiagram-6WML65LV-CuIIcu-L.js} +1 -1
- package/server/client/dist/assets/{ishikawaDiagram-FXEZZL3T-BJDXbmaY.js → ishikawaDiagram-WSZJBQD7-BVtRGTOj.js} +1 -1
- package/server/client/dist/assets/{journeyDiagram-5HDEW3XC-DlyJx4xT.js → journeyDiagram-NVQOT4AX-D5-Nzb2N.js} +1 -1
- package/server/client/dist/assets/{kanban-definition-HUTT4EX6-AmTeXesc.js → kanban-definition-27J2QSJJ-DmOhgC8H.js} +1 -1
- package/server/client/dist/assets/{manage-image-detail-CPpeRZD4.js → manage-image-detail-BNYOCSmu.js} +1 -1
- package/server/client/dist/assets/{manage-image-DCBgglLx.js → manage-image-m-7v_Z1W.js} +1 -1
- package/server/client/dist/assets/{mcp-Y2p95Lm9.js → mcp-B-aGeAQD.js} +1 -1
- package/server/client/dist/assets/{mcp-admin-adapter-z9OaMVrl.js → mcp-admin-adapter-Cw6w5mfg.js} +1 -1
- package/server/client/dist/assets/mermaid.core-C2tL9tq7.js +308 -0
- package/server/client/dist/assets/{mindmap-definition-LN4V7U3C-C_6tKVmY.js → mindmap-definition-FAOFIHXS-DuvsPqrh.js} +1 -1
- package/server/client/dist/assets/{note-ui-Cv6quEYh.js → note-ui-CYsZc3DI.js} +1 -1
- package/server/client/dist/assets/{pegDiagram-2B236MQR-CGKCNdrV.js → pegDiagram-VL7TDLO6-D64crEZV.js} +1 -1
- package/server/client/dist/assets/{pieDiagram-ENE6RG2P-C3cMh7d5.js → pieDiagram-7S7Q4E2Y--kl7vopC.js} +1 -1
- package/server/client/dist/assets/{placeholder-CHRQt_T8.js → placeholder-C5fNzKrL.js} +1 -1
- package/server/client/dist/assets/{properties-CwxDtivz.js → properties-B93_V2uD.js} +1 -1
- package/server/client/dist/assets/{quadrantDiagram-ABIIQ3AL-CVVzGxBd.js → quadrantDiagram-CIZ2JOQS-DuvJ4M2y.js} +1 -1
- package/server/client/dist/assets/{railroadDiagram-RFXS5EU6-wa-4aJR9.js → railroadDiagram-AXF67PYL-BMKmCOY7.js} +1 -1
- package/server/client/dist/assets/{requirementDiagram-TGXJPOKE-DyuC9W7q.js → requirementDiagram-LRYGKXZP-DY1eJcy0.js} +1 -1
- package/server/client/dist/assets/route-preload.js +2 -2
- package/server/client/dist/assets/{sankeyDiagram-HTMAVEWB-B70y-MQg.js → sankeyDiagram-W5VNT64P-C3Ka4GKM.js} +1 -1
- package/server/client/dist/assets/{search-DCLnUWYd.js → search-BmXuuK26.js} +1 -1
- package/server/client/dist/assets/{search-admin-adapter-BLMYNm9w.js → search-admin-adapter-Dj0KKKrJ.js} +1 -1
- package/server/client/dist/assets/{sequenceDiagram-DBY2YBRQ-mGkh3IEy.js → sequenceDiagram-SI44F4Z6-Bhpwtk2s.js} +1 -1
- package/server/client/dist/assets/{sizeCapture-X5ZJPWSS-BhnCNP5z.js → sizeCapture-X5ZJPWSS-BFta71TW.js} +1 -1
- package/server/client/dist/assets/{stateDiagram-2N3HPSRC-BqSKSfKi.js → stateDiagram-OKZ733FA-D6GCn1io.js} +1 -1
- package/server/client/dist/assets/{stateDiagram-v2-6OUMAXLB-Wl7lGTf3.js → stateDiagram-v2-UEYNNEHI-g4yinGDn.js} +1 -1
- package/server/client/dist/assets/{swimlanes-5IMT3BWC-CZ7ckdmY.js → swimlanes-SLNWSIFB-DLFvOjUl.js} +2 -2
- package/server/client/dist/assets/swimlanesDiagram-ULZ7WXOC-Ci4mcvmo.js +8 -0
- package/server/client/dist/assets/{tag.api-bU52U0tT.js → tag.api-BJ6eaHui.js} +1 -1
- package/server/client/dist/assets/{time-DZKkPFUi.js → time-DI902Sxa.js} +1 -1
- package/server/client/dist/assets/{timeline-definition-FHXFAJF6-C-t9-x4M.js → timeline-definition-Z64GVDOM-DTSIekSM.js} +1 -1
- package/server/client/dist/assets/{trash-BNeUFJnC.js → trash-GulvRh9f.js} +1 -1
- package/server/client/dist/assets/{useNoteMutate-VJYw0Vt_.js → useNoteMutate-xEIypxi5.js} +1 -1
- package/server/client/dist/assets/{useReminderMutate-DaO0QssD.js → useReminderMutate-kTBRSjYc.js} +1 -1
- package/server/client/dist/assets/{vennDiagram-L72KCM5P-CP014Nl5.js → vennDiagram-T6HMQDX7-CMNqSI2X.js} +1 -1
- package/server/client/dist/assets/{wardleyDiagram-EHGQE667-B7Ghd-94.js → wardleyDiagram-T6FBY63Y-DV-JOYqB.js} +1 -1
- package/server/client/dist/assets/{xychartDiagram-FW5EYKEG-C4YGS0YJ.js → xychartDiagram-ELKLHX3M-BUIniF4m.js} +4 -4
- package/server/client/dist/index.html +4 -4
- package/server/dist/app.js +5 -5
- package/server/dist/features/note/graphql/note.query.resolver.js +18 -16
- package/server/dist/features/placeholder/graphql/placeholder.mutation.resolver.js +2 -3
- package/server/dist/features/placeholder/graphql/placeholder.query.resolver.js +4 -3
- package/server/dist/features/search/sqlite-vector-index.js +71 -138
- package/server/dist/features/view/graphql/view.query.resolver.js +15 -7
- package/server/dist/main.js +1 -35
- package/server/dist/modules/blocknote.js +33 -17
- package/server/dist/routes/api.js +6 -1
- package/server/dist/routes/client.js +15 -4
- package/server/dist/server.js +40 -0
- package/server/client/dist/assets/Calendar-BLiViCGr.js +0 -25
- package/server/client/dist/assets/Note-BTQLB80Y.js +0 -25
- package/server/client/dist/assets/app-CEkicO08.css +0 -1
- package/server/client/dist/assets/architectureDiagram-ZJ3FMSHR-HF8-bEM0.js +0 -36
- package/server/client/dist/assets/channel-Cq5ZBtfo.js +0 -1
- package/server/client/dist/assets/classDiagram-OUVF2IWQ-BqUaa8a6.js +0 -1
- package/server/client/dist/assets/classDiagram-v2-EOCWNBFH-BqUaa8a6.js +0 -1
- package/server/client/dist/assets/diagram-WEI45ONY-D1uvaJub.js +0 -41
- package/server/client/dist/assets/mermaid.core-B528P54n.js +0 -308
- package/server/client/dist/assets/swimlanesDiagram-G3AALYLV-BZL3DQ-c.js +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{C as V,J as K,T as m,F as k,K as Y,m as w,P as G,Q,a as J,b as I,y as W,z as C,h as X,i as F,q as $,E as q,B,k as ee,l as M}from"./time-DZKkPFUi.js";import{u as te,R as ae,f as re,a as se}from"./useReminderMutate-DaO0QssD.js";import{f as ne,u as oe}from"./useNoteMutate-VJYw0Vt_.js";import{N as L,R as ie}from"./url-BvjSC8PU.js";import{s as le}from"./ArrowRight.es-DZTjsBaI.js";const de=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M112,56V200L40,128Z",opacity:"0.2"}),s.createElement("path",{d:"M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z"}))]]),P=s.forwardRef((t,a)=>s.createElement(V,{ref:a,...t,weights:de}));P.displayName="ArrowLeftIcon";const ce=P,me={high:"bg-priority-high",medium:"bg-priority-medium",low:"bg-priority-low"};function pe({reminder:t,onUpdate:a,onDelete:r,onEdit:n}){const d=E=>{const v=w(Number(E)),b=w();return v.isSame(b,"day")?`Today at ${v.format("HH:mm")}`:v.isSame(b.add(1,"day"),"day")?`Tomorrow at ${v.format("HH:mm")}`:v.format("YYYY-MM-DD HH:mm")},i=E=>{const v=w(Number(E)),b=w(),O=v.diff(b,"hour"),T=v.diff(b,"minute")%60;return O<0||T<0?"Overdue":O===0?`${T}m remaining`:`${O}h ${T}m remaining`},x=t.completed?"Completed":i(t.reminderDate),p=x==="Overdue",h=t.priority||"low",g=h==="high"?"High":h==="medium"?"Medium":"Low",l=me[h],u=t.noteId.toString(),j=p?"text-fg-error":"text-fg-tertiary",f=t.content?.trim(),y=f||t.note?.title||"Untitled reminder",o=t.note?.title||"Untitled note",c=!!(f&&t.note?.title),R=d(t.reminderDate),H=[...!t.completed&&n?[{name:"Edit",onClick:()=>n(t)}]:[],...t.completed?[{name:"Reopen",onClick:()=>a(t.id,u,{completed:!1})}]:[]],U=[...H,...H.length>0?[{type:"separator",key:"destructive-actions"}]:[],{name:"Delete",onClick:()=>r(t.id,u)}];return e.jsxs("div",{className:"surface-base grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-2.5 gap-y-2 px-4 py-3 sm:grid-cols-[auto_minmax(0,1fr)_auto_auto] sm:items-center sm:gap-x-4 sm:gap-y-0",children:[e.jsx(K,{checked:t.completed,onChange:()=>a(t.id,u,{completed:!t.completed}),size:"sm","aria-label":`${t.completed?"Reopen":"Complete"} reminder: ${y}`}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(m,{as:"p",variant:"body",weight:"semibold",className:t.completed?"truncate text-fg-tertiary line-through":"truncate",children:!f&&t.note?e.jsx(k,{to:L,params:{id:String(t.note.id)},className:"transition-colors hover:text-fg-default hover:underline",children:y}):y}),c&&e.jsx(m,{as:"div",variant:"meta",tone:"secondary",className:t.completed?"mt-0.5 truncate text-fg-tertiary":"mt-0.5 truncate",children:e.jsx(k,{to:L,params:{id:String(t.note?.id??t.noteId)},className:"transition-colors hover:text-fg-default hover:underline",children:o})})]}),e.jsxs("div",{className:"col-start-2 row-start-2 flex flex-wrap items-center gap-x-2 gap-y-1 sm:col-start-auto sm:row-start-auto sm:shrink-0",children:[e.jsx("span",{className:`h-3 w-3 shrink-0 rounded-full border border-border-subtle ${l}`,"aria-label":`${g} priority`,title:`${g} priority`}),e.jsx(m,{as:"span",variant:"meta",weight:"medium",tone:"secondary",className:t.completed?"text-fg-tertiary":void 0,children:R}),e.jsx("span",{className:"h-1 w-1 rounded-full bg-border-secondary"}),e.jsx(m,{as:"span",variant:"label",weight:"medium",className:t.completed?"text-accent-success":j,children:x})]}),e.jsx("div",{className:"col-start-3 row-start-1 flex items-center justify-end gap-1.5 sm:col-start-auto sm:row-start-auto sm:shrink-0",children:e.jsx(Y,{button:e.jsx(ne,{label:"Reminder actions",iconClassName:"h-5 w-5 text-current"}),items:U})})]})}const A=X(ie),S=25,_=5,z={overdue:{title:"Overdue",description:"Recently missed reminders that still need a decision.",empty:"Nothing overdue"},today:{title:"Today",description:"Open reminders due before the day ends.",empty:"Nothing else due today"},upcoming:{title:"Upcoming",description:"Reminders scheduled after today.",empty:"Nothing upcoming"}},N=t=>t==="all"?void 0:t,ue=(t,a,r)=>{const n={status:"open",...N(a)?{priority:N(a)}:{},sortBy:"reminderDate"};return t==="overdue"?{...n,end:r.now,sortOrder:"desc"}:t==="today"?{...n,start:r.now,end:r.tomorrow,sortOrder:"asc"}:{...n,start:r.tomorrow,sortOrder:"asc"}};function he(){return e.jsxs("div",{role:"status","aria-label":"Loading reminders",className:"flex flex-col gap-2.5",children:[e.jsx(M,{height:"72px"}),e.jsx(M,{height:"72px"}),e.jsx(M,{height:"72px"})]})}function Z({reminders:t,actions:a}){return e.jsx("div",{className:"flex flex-col gap-2.5",children:t.map(r=>e.jsx(pe,{reminder:r,onUpdate:a.onUpdate,onDelete:a.onDelete,onEdit:a.onEdit},r.id))})}function D({scope:t,collection:a,actions:r,onViewAll:n}){const d=z[t],i=`reminder-${t}-heading`;return e.jsxs("section",{"aria-labelledby":i,className:"border-b border-border-subtle pb-5 last:border-b-0 last:pb-0",children:[e.jsxs("div",{className:"mb-3 flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{as:"h2",id:i,variant:"body",weight:"bold",children:d.title}),e.jsx(m,{as:"span",variant:"label",weight:"semibold",tone:"tertiary",className:"rounded-full bg-hover-subtle px-2 py-0.5",children:a.totalCount})]}),e.jsx(m,{as:"p",variant:"meta",tone:"tertiary",className:"mt-0.5",children:d.description})]}),a.totalCount>_?e.jsxs(B,{type:"button",variant:"ghost",size:"sm",onClick:()=>n(t),children:["View all",e.jsx(le,{className:"size-3.5","aria-hidden":"true"})]}):null]}),a.reminders.length>0?e.jsx(Z,{reminders:a.reminders,actions:r}):e.jsx("div",{className:"rounded-[16px] border border-dashed border-border-subtle px-4 py-4",children:e.jsx(m,{as:"p",variant:"meta",weight:"medium",tone:"tertiary",children:d.empty})})]})}function ge({priority:t,boundaries:a,actions:r,onViewAll:n}){const d={now:a.now,tomorrow:a.tomorrow,priority:N(t),limit:_},{data:i}=F({queryKey:$.reminders.overview(d),queryFn:async()=>{const p=await re(d);if(p.type==="error")throw p;return{overdue:p.overdue,today:p.today,upcoming:p.upcoming}}});return i.overdue.totalCount+i.today.totalCount+i.upcoming.totalCount===0?e.jsx(q,{title:"No open reminders",description:t==="all"?"Add a reminder inside any note to see it here.":"Try another priority or add a matching reminder."}):e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsx(D,{scope:"overdue",collection:i.overdue,actions:r,onViewAll:n}),e.jsx(D,{scope:"today",collection:i.today,actions:r,onViewAll:n}),e.jsx(D,{scope:"upcoming",collection:i.upcoming,actions:r,onViewAll:n})]})}function xe({status:t,scope:a,priority:r,page:n,boundaries:d,actions:i,onPageChange:x,onBackToOverview:p}){const g={filter:t==="completed"?{status:"completed",...N(r)?{priority:N(r)}:{},sortBy:"updatedAt",sortOrder:"desc"}:ue(a,r,d),limit:S,offset:(n-1)*S},{data:l}=F({queryKey:$.reminders.list(g),queryFn:async()=>{const y=await se(g);if(y.type==="error")throw y;return y.reminders}}),u=Math.max(1,Math.ceil(l.totalCount/S));s.useEffect(()=>{n>u&&x(u)},[u,x,n]);const j=t==="completed"?null:z[a],f=t==="completed"?"Completed":j?.title??"Open reminders";return e.jsxs("section",{"aria-labelledby":"reminder-list-heading",children:[e.jsxs("div",{className:"mb-3 flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{children:[t==="open"?e.jsxs(B,{type:"button",variant:"ghost",size:"sm",className:"-ml-3 mb-1",onClick:p,children:[e.jsx(ce,{className:"size-3.5","aria-hidden":"true"}),"All open reminders"]}):null,e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{as:"h2",id:"reminder-list-heading",variant:"body",weight:"bold",children:f}),e.jsx(m,{as:"span",variant:"label",weight:"semibold",tone:"tertiary",className:"rounded-full bg-hover-subtle px-2 py-0.5",children:l.totalCount})]}),e.jsx(m,{as:"p",variant:"meta",tone:"tertiary",className:"mt-0.5",children:t==="completed"?"Completed reminders can be reopened or permanently deleted.":j?.description})]}),l.totalCount>0?e.jsxs(m,{as:"span",variant:"label",tone:"tertiary",children:[Math.min(g.offset+1,l.totalCount),"–",Math.min(g.offset+l.reminders.length,l.totalCount)," of ",l.totalCount]}):null]}),l.reminders.length>0?e.jsxs(e.Fragment,{children:[e.jsx(Z,{reminders:l.reminders,actions:i}),u>1?e.jsx(ee,{page:n,last:u,onChange:x}):null]}):e.jsx(q,{title:t==="completed"?"No completed reminders":j?.empty,description:r==="all"?"There is nothing to manage in this list yet.":"Try another priority to see more reminders."})]})}function Ne(){const t=A.useNavigate(),{status:a,scope:r,priority:n,page:d}=A.useSearch(),{onUpdate:i,onDelete:x}=te(),p=oe(),[h,g]=s.useState(),[l]=s.useState(()=>{const o=w();return{now:o.toISOString(),tomorrow:o.add(1,"day").startOf("day").toISOString()}}),u=o=>{t({search:c=>({...c,page:o})})},f={onUpdate:i,onDelete:async(o,c)=>{await p("Delete this reminder? This cannot be undone.")&&await x(o,c)},onEdit:g},y=e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(J,{type:"single",variant:"quiet",size:"sm",value:a,onValueChange:o=>{o&&t({search:c=>({...c,status:o,scope:"all",page:1})})},children:[e.jsx(I,{value:"open",children:"Open"}),e.jsx(I,{value:"completed",children:"Completed"})]}),e.jsxs(W,{value:n,size:"sm",ariaLabel:"Filter reminders by priority",className:"w-[148px]",onValueChange:o=>{t({search:c=>({...c,priority:o,page:1})})},children:[e.jsx(C,{value:"all",children:"All priorities"}),e.jsx(C,{value:"high",children:"High priority"}),e.jsx(C,{value:"medium",children:"Medium priority"}),e.jsx(C,{value:"low",children:"Low priority"})]})]});return e.jsxs(e.Fragment,{children:[e.jsx(G,{title:"Reminders",description:a==="completed"?"Review completed reminders and reopen anything that still needs attention.":"Act on what is overdue, due today, and coming next.",headerRight:y,children:e.jsx(Q,{fallback:e.jsx(he,{}),errorTitle:"Failed to load reminders",errorDescription:"Retry loading the reminder workspace.",resetKeys:[a,r,n,d,l.now],children:a==="open"&&r==="all"?e.jsx(ge,{priority:n,boundaries:l,actions:f,onViewAll:o=>{t({search:c=>({...c,scope:o,page:1})})}}):e.jsx(xe,{status:a,scope:r,priority:n,page:d,boundaries:l,actions:f,onPageChange:u,onBackToOverview:()=>{t({search:o=>({...o,scope:"all",page:1})})}})})}),e.jsx(ae,{isOpen:!!h,mode:"edit",reminder:h,onClose:()=>g(void 0),onSave:(o,c,R)=>{h&&i(h.id,String(h.noteId),{reminderDate:o,priority:c,content:R})}})]})}export{Ne as default};
|
|
1
|
+
import{r as s,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{C as V,J as K,T as m,F as k,K as Y,m as w,P as G,Q,a as J,b as I,y as W,z as C,h as X,i as F,q as $,E as q,B,k as ee,l as M}from"./time-DI902Sxa.js";import{u as te,R as ae,f as re,a as se}from"./useReminderMutate-kTBRSjYc.js";import{f as ne,u as oe}from"./useNoteMutate-xEIypxi5.js";import{N as L,R as ie}from"./url-BvjSC8PU.js";import{s as le}from"./ArrowRight.es-CD1IMhU2.js";const de=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M112,56V200L40,128Z",opacity:"0.2"}),s.createElement("path",{d:"M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z"}))]]),P=s.forwardRef((t,a)=>s.createElement(V,{ref:a,...t,weights:de}));P.displayName="ArrowLeftIcon";const ce=P,me={high:"bg-priority-high",medium:"bg-priority-medium",low:"bg-priority-low"};function pe({reminder:t,onUpdate:a,onDelete:r,onEdit:n}){const d=E=>{const v=w(Number(E)),b=w();return v.isSame(b,"day")?`Today at ${v.format("HH:mm")}`:v.isSame(b.add(1,"day"),"day")?`Tomorrow at ${v.format("HH:mm")}`:v.format("YYYY-MM-DD HH:mm")},i=E=>{const v=w(Number(E)),b=w(),O=v.diff(b,"hour"),T=v.diff(b,"minute")%60;return O<0||T<0?"Overdue":O===0?`${T}m remaining`:`${O}h ${T}m remaining`},x=t.completed?"Completed":i(t.reminderDate),p=x==="Overdue",h=t.priority||"low",g=h==="high"?"High":h==="medium"?"Medium":"Low",l=me[h],u=t.noteId.toString(),j=p?"text-fg-error":"text-fg-tertiary",f=t.content?.trim(),y=f||t.note?.title||"Untitled reminder",o=t.note?.title||"Untitled note",c=!!(f&&t.note?.title),R=d(t.reminderDate),H=[...!t.completed&&n?[{name:"Edit",onClick:()=>n(t)}]:[],...t.completed?[{name:"Reopen",onClick:()=>a(t.id,u,{completed:!1})}]:[]],U=[...H,...H.length>0?[{type:"separator",key:"destructive-actions"}]:[],{name:"Delete",onClick:()=>r(t.id,u)}];return e.jsxs("div",{className:"surface-base grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-2.5 gap-y-2 px-4 py-3 sm:grid-cols-[auto_minmax(0,1fr)_auto_auto] sm:items-center sm:gap-x-4 sm:gap-y-0",children:[e.jsx(K,{checked:t.completed,onChange:()=>a(t.id,u,{completed:!t.completed}),size:"sm","aria-label":`${t.completed?"Reopen":"Complete"} reminder: ${y}`}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(m,{as:"p",variant:"body",weight:"semibold",className:t.completed?"truncate text-fg-tertiary line-through":"truncate",children:!f&&t.note?e.jsx(k,{to:L,params:{id:String(t.note.id)},className:"transition-colors hover:text-fg-default hover:underline",children:y}):y}),c&&e.jsx(m,{as:"div",variant:"meta",tone:"secondary",className:t.completed?"mt-0.5 truncate text-fg-tertiary":"mt-0.5 truncate",children:e.jsx(k,{to:L,params:{id:String(t.note?.id??t.noteId)},className:"transition-colors hover:text-fg-default hover:underline",children:o})})]}),e.jsxs("div",{className:"col-start-2 row-start-2 flex flex-wrap items-center gap-x-2 gap-y-1 sm:col-start-auto sm:row-start-auto sm:shrink-0",children:[e.jsx("span",{className:`h-3 w-3 shrink-0 rounded-full border border-border-subtle ${l}`,"aria-label":`${g} priority`,title:`${g} priority`}),e.jsx(m,{as:"span",variant:"meta",weight:"medium",tone:"secondary",className:t.completed?"text-fg-tertiary":void 0,children:R}),e.jsx("span",{className:"h-1 w-1 rounded-full bg-border-secondary"}),e.jsx(m,{as:"span",variant:"label",weight:"medium",className:t.completed?"text-accent-success":j,children:x})]}),e.jsx("div",{className:"col-start-3 row-start-1 flex items-center justify-end gap-1.5 sm:col-start-auto sm:row-start-auto sm:shrink-0",children:e.jsx(Y,{button:e.jsx(ne,{label:"Reminder actions",iconClassName:"h-5 w-5 text-current"}),items:U})})]})}const A=X(ie),S=25,_=5,z={overdue:{title:"Overdue",description:"Recently missed reminders that still need a decision.",empty:"Nothing overdue"},today:{title:"Today",description:"Open reminders due before the day ends.",empty:"Nothing else due today"},upcoming:{title:"Upcoming",description:"Reminders scheduled after today.",empty:"Nothing upcoming"}},N=t=>t==="all"?void 0:t,ue=(t,a,r)=>{const n={status:"open",...N(a)?{priority:N(a)}:{},sortBy:"reminderDate"};return t==="overdue"?{...n,end:r.now,sortOrder:"desc"}:t==="today"?{...n,start:r.now,end:r.tomorrow,sortOrder:"asc"}:{...n,start:r.tomorrow,sortOrder:"asc"}};function he(){return e.jsxs("div",{role:"status","aria-label":"Loading reminders",className:"flex flex-col gap-2.5",children:[e.jsx(M,{height:"72px"}),e.jsx(M,{height:"72px"}),e.jsx(M,{height:"72px"})]})}function Z({reminders:t,actions:a}){return e.jsx("div",{className:"flex flex-col gap-2.5",children:t.map(r=>e.jsx(pe,{reminder:r,onUpdate:a.onUpdate,onDelete:a.onDelete,onEdit:a.onEdit},r.id))})}function D({scope:t,collection:a,actions:r,onViewAll:n}){const d=z[t],i=`reminder-${t}-heading`;return e.jsxs("section",{"aria-labelledby":i,className:"border-b border-border-subtle pb-5 last:border-b-0 last:pb-0",children:[e.jsxs("div",{className:"mb-3 flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{as:"h2",id:i,variant:"body",weight:"bold",children:d.title}),e.jsx(m,{as:"span",variant:"label",weight:"semibold",tone:"tertiary",className:"rounded-full bg-hover-subtle px-2 py-0.5",children:a.totalCount})]}),e.jsx(m,{as:"p",variant:"meta",tone:"tertiary",className:"mt-0.5",children:d.description})]}),a.totalCount>_?e.jsxs(B,{type:"button",variant:"ghost",size:"sm",onClick:()=>n(t),children:["View all",e.jsx(le,{className:"size-3.5","aria-hidden":"true"})]}):null]}),a.reminders.length>0?e.jsx(Z,{reminders:a.reminders,actions:r}):e.jsx("div",{className:"rounded-[16px] border border-dashed border-border-subtle px-4 py-4",children:e.jsx(m,{as:"p",variant:"meta",weight:"medium",tone:"tertiary",children:d.empty})})]})}function ge({priority:t,boundaries:a,actions:r,onViewAll:n}){const d={now:a.now,tomorrow:a.tomorrow,priority:N(t),limit:_},{data:i}=F({queryKey:$.reminders.overview(d),queryFn:async()=>{const p=await re(d);if(p.type==="error")throw p;return{overdue:p.overdue,today:p.today,upcoming:p.upcoming}}});return i.overdue.totalCount+i.today.totalCount+i.upcoming.totalCount===0?e.jsx(q,{title:"No open reminders",description:t==="all"?"Add a reminder inside any note to see it here.":"Try another priority or add a matching reminder."}):e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsx(D,{scope:"overdue",collection:i.overdue,actions:r,onViewAll:n}),e.jsx(D,{scope:"today",collection:i.today,actions:r,onViewAll:n}),e.jsx(D,{scope:"upcoming",collection:i.upcoming,actions:r,onViewAll:n})]})}function xe({status:t,scope:a,priority:r,page:n,boundaries:d,actions:i,onPageChange:x,onBackToOverview:p}){const g={filter:t==="completed"?{status:"completed",...N(r)?{priority:N(r)}:{},sortBy:"updatedAt",sortOrder:"desc"}:ue(a,r,d),limit:S,offset:(n-1)*S},{data:l}=F({queryKey:$.reminders.list(g),queryFn:async()=>{const y=await se(g);if(y.type==="error")throw y;return y.reminders}}),u=Math.max(1,Math.ceil(l.totalCount/S));s.useEffect(()=>{n>u&&x(u)},[u,x,n]);const j=t==="completed"?null:z[a],f=t==="completed"?"Completed":j?.title??"Open reminders";return e.jsxs("section",{"aria-labelledby":"reminder-list-heading",children:[e.jsxs("div",{className:"mb-3 flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{children:[t==="open"?e.jsxs(B,{type:"button",variant:"ghost",size:"sm",className:"-ml-3 mb-1",onClick:p,children:[e.jsx(ce,{className:"size-3.5","aria-hidden":"true"}),"All open reminders"]}):null,e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{as:"h2",id:"reminder-list-heading",variant:"body",weight:"bold",children:f}),e.jsx(m,{as:"span",variant:"label",weight:"semibold",tone:"tertiary",className:"rounded-full bg-hover-subtle px-2 py-0.5",children:l.totalCount})]}),e.jsx(m,{as:"p",variant:"meta",tone:"tertiary",className:"mt-0.5",children:t==="completed"?"Completed reminders can be reopened or permanently deleted.":j?.description})]}),l.totalCount>0?e.jsxs(m,{as:"span",variant:"label",tone:"tertiary",children:[Math.min(g.offset+1,l.totalCount),"–",Math.min(g.offset+l.reminders.length,l.totalCount)," of ",l.totalCount]}):null]}),l.reminders.length>0?e.jsxs(e.Fragment,{children:[e.jsx(Z,{reminders:l.reminders,actions:i}),u>1?e.jsx(ee,{page:n,last:u,onChange:x}):null]}):e.jsx(q,{title:t==="completed"?"No completed reminders":j?.empty,description:r==="all"?"There is nothing to manage in this list yet.":"Try another priority to see more reminders."})]})}function Ne(){const t=A.useNavigate(),{status:a,scope:r,priority:n,page:d}=A.useSearch(),{onUpdate:i,onDelete:x}=te(),p=oe(),[h,g]=s.useState(),[l]=s.useState(()=>{const o=w();return{now:o.toISOString(),tomorrow:o.add(1,"day").startOf("day").toISOString()}}),u=o=>{t({search:c=>({...c,page:o})})},f={onUpdate:i,onDelete:async(o,c)=>{await p("Delete this reminder? This cannot be undone.")&&await x(o,c)},onEdit:g},y=e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(J,{type:"single",variant:"quiet",size:"sm",value:a,onValueChange:o=>{o&&t({search:c=>({...c,status:o,scope:"all",page:1})})},children:[e.jsx(I,{value:"open",children:"Open"}),e.jsx(I,{value:"completed",children:"Completed"})]}),e.jsxs(W,{value:n,size:"sm",ariaLabel:"Filter reminders by priority",className:"w-[148px]",onValueChange:o=>{t({search:c=>({...c,priority:o,page:1})})},children:[e.jsx(C,{value:"all",children:"All priorities"}),e.jsx(C,{value:"high",children:"High priority"}),e.jsx(C,{value:"medium",children:"Medium priority"}),e.jsx(C,{value:"low",children:"Low priority"})]})]});return e.jsxs(e.Fragment,{children:[e.jsx(G,{title:"Reminders",description:a==="completed"?"Review completed reminders and reopen anything that still needs attention.":"Act on what is overdue, due today, and coming next.",headerRight:y,children:e.jsx(Q,{fallback:e.jsx(he,{}),errorTitle:"Failed to load reminders",errorDescription:"Retry loading the reminder workspace.",resetKeys:[a,r,n,d,l.now],children:a==="open"&&r==="all"?e.jsx(ge,{priority:n,boundaries:l,actions:f,onViewAll:o=>{t({search:c=>({...c,scope:o,page:1})})}}):e.jsx(xe,{status:a,scope:r,priority:n,page:d,boundaries:l,actions:f,onPageChange:u,onBackToOverview:()=>{t({search:o=>({...o,scope:"all",page:1})})}})})}),e.jsx(ae,{isOpen:!!h,mode:"edit",reminder:h,onClose:()=>g(void 0),onSave:(o,c,R)=>{h&&i(h.id,String(h.noteId),{reminderDate:o,priority:c,content:R})}})]})}export{Ne as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,r as g}from"./floating-ui.react-dom-BWTnA00G.js";import{a as L,m as Q}from"./useNoteMutate-
|
|
1
|
+
import{j as e,r as g}from"./floating-ui.react-dom-BWTnA00G.js";import{a as L,m as Q}from"./useNoteMutate-xEIypxi5.js";import{g as q,y as G,z as V,c as X,G as J,B as Y,T as m,q as k,P as W,E as A,Q as Z,F as C,k as ee,h as te,l as w,i as re,s as se,N as ae}from"./time-DI902Sxa.js";import{A as ne,p as ie}from"./AuxiliaryPanelHeader-zoJGsYWR.js";import{N as P,f as oe,g as le,T as ce}from"./url-BvjSC8PU.js";import{f as de}from"./app-CyQtGTtn.js";import{s as me}from"./ArrowRight.es-CD1IMhU2.js";import{V as R}from"./ViewChip-D-Ax5PdL.js";import"./sortable.esm-DgSW3bAA.js";import{f as he}from"./search-admin-adapter-Dj0KKKrJ.js";import{s as ue}from"./File.es-CcjtzE38.js";import"./preload-helper-BXl3LOEh.js";const xe=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=({children:t,match:s})=>{const r=s.trim();if(!r)return e.jsx("span",{children:t});const a=xe(r),n=new RegExp(`(${a})`,"gi"),o=new RegExp(`^${a}$`,"i"),i=t.split(n);return e.jsx("span",{children:i.map((c,d)=>o.test(c)?e.jsx("mark",{children:c},d):e.jsx(g.Fragment,{children:c},d))})},pe={hybrid:"HYBRID",lexical:"LEXICAL",semantic:"SEMANTIC"};function fe({query:t,limit:s=25,offset:r=0,mode:a="hybrid"}){return q(`query FetchSearchNotes($query: String!, $pagination: PaginationInput!, $mode: SearchMode!) {
|
|
2
2
|
searchNotes(query: $query, pagination: $pagination, mode: $mode) {
|
|
3
3
|
totalCount
|
|
4
4
|
semanticAvailable
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as f}from"./floating-ui.react-dom-BWTnA00G.js";import{A as o}from"./time-
|
|
1
|
+
import{j as f}from"./floating-ui.react-dom-BWTnA00G.js";import{A as o}from"./time-DI902Sxa.js";const n=o("surface-base",{variants:{tone:{default:"",elevated:"surface-elevated"},padding:{default:"p-4",compact:"px-3 py-2.5",roomy:"p-6",flush:"overflow-hidden"}},defaultVariants:{tone:"default",padding:"default"}});function i({children:a,className:e,flush:t=!1,padding:d="default",tone:s="default"}){const r=t?"flush":d;return f.jsx("div",{className:n({tone:s,padding:r,className:e}),children:a})}export{i as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{i as T,q as S,P as k,T as f,G as P,y as j,z as g,Q as E,F as R,k as q,E as C,l as x,h as I}from"./time-
|
|
1
|
+
import{r as c,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{i as T,q as S,P as k,T as f,G as P,y as j,z as g,Q as E,F as R,k as q,E as C,l as x,h as I}from"./time-DI902Sxa.js";import{f as A,s as O,T as L,a as F,i as Q,b as _,F as v}from"./app-CyQtGTtn.js";import{T as M,d as z}from"./url-BvjSC8PU.js";import{f as B}from"./tag.api-BJ6eaHui.js";import"./useNoteMutate-xEIypxi5.js";import"./preload-helper-BXl3LOEh.js";import"./sortable.esm-DgSW3bAA.js";const D=s=>{const{data:d}=T({queryKey:S.tags.list(s.searchParams),async queryFn(){const r=await B({query:s.searchParams.query,offset:s.searchParams.offset,limit:s.searchParams.limit,sortBy:s.searchParams.sortBy,sortOrder:s.searchParams.sortOrder});if(r.type==="error")throw r;return r.allTags}});return s.render(d)},G=s=>{const[d,r]=c.useState(!1),t=c.useRef(null),n=c.useRef(!0),u=c.useRef(0),o=c.useCallback(()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},[]);c.useEffect(()=>(n.current=!0,()=>{n.current=!1,o()}),[o]);const m=c.useCallback(p=>{u.current+=1;const i=u.current;o(),n.current&&r(!0),t.current=setTimeout(()=>{t.current=null,Promise.resolve().then(p).catch(()=>{}).finally(()=>{n.current&&u.current===i&&r(!1)})},s)},[o,s]);return[d,m]},b=I(z);function X(){const s=b.useNavigate(),{page:d,query:r,limit:t,sortBy:n,sortOrder:u}=b.useSearch(),[o,m]=c.useState(r),[,p]=G(350),i=r.trim();c.useEffect(()=>{m(r)},[r]),c.useEffect(()=>{const a=o.trim();a!==i&&p(()=>{s({search:l=>({...l,page:1,query:a})})})},[o,s,i,p]);const y=a=>{s({search:l=>({...l,...a})})},w=()=>{m(""),y({page:1,query:""})};return e.jsxs(k,{title:"Tags",description:"Find tags you added with @ across your notes",children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{className:"surface-base flex min-w-0 items-center gap-2 rounded-[16px] px-3.5 py-2.5 lg:w-72",children:[e.jsx(A,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Search"}),e.jsx("div",{className:"h-5 w-px bg-divider"}),e.jsx("input",{"aria-label":"Search tags",placeholder:"Search tags",value:o,onChange:a=>m(a.target.value),className:"h-8 min-w-0 flex-1 bg-transparent text-sm font-medium text-fg-default outline-none placeholder:text-xs placeholder:font-medium placeholder:text-fg-placeholder"}),(o||i)&&e.jsx("button",{type:"button","aria-label":"Clear tag search",className:"focus-ring-soft flex h-7 w-7 shrink-0 items-center justify-center rounded-[10px] text-fg-tertiary outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default",onClick:w,children:e.jsx(P,{className:"h-3.5 w-3.5",weight:"bold"})})]}),e.jsxs("div",{className:"surface-base inline-flex flex-wrap items-center gap-3 rounded-[16px] px-3.5 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Items"}),e.jsx(j,{value:String(t),onValueChange:a=>{const l=Number(a);Q(l)&&y({limit:l,page:1})},variant:"ghost",size:"sm",children:L.map(a=>e.jsx(g,{value:String(a),children:a===F?`Default (${a})`:a},a))})]}),e.jsx("div",{className:"h-5 w-px bg-divider"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Sort"}),e.jsxs(j,{value:n,onValueChange:a=>y({sortBy:a,page:1}),variant:"ghost",size:"sm",children:[e.jsx(g,{value:"referenceCount",children:"Usage"}),e.jsx(g,{value:"name",children:"Name"})]}),e.jsxs(j,{value:u,onValueChange:a=>y({sortOrder:a,page:1}),variant:"ghost",size:"sm",children:[e.jsx(g,{value:"desc",children:n==="name"?"Z to A":"Most used"}),e.jsx(g,{value:"asc",children:n==="name"?"A to Z":"Least used"})]})]})]})]}),e.jsx(E,{fallback:e.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[e.jsx(x,{width:"90px",height:"36px"}),e.jsx(x,{width:"120px",height:"36px"}),e.jsx(x,{width:"80px",height:"36px"}),e.jsx(x,{width:"100px",height:"36px"}),e.jsx(x,{width:"110px",height:"36px"}),e.jsx(x,{width:"70px",height:"36px"})]}),errorTitle:"Failed to load tags",errorDescription:"Retry loading the tag catalog",resetKeys:[d,t,i,n,u],children:e.jsx(D,{searchParams:{query:i,offset:(d-1)*t,limit:t,sortBy:n,sortOrder:u},render:({tags:a,totalCount:l})=>e.jsx(v,{fallback:e.jsx(C,{title:i?"No matching tags":"No tags yet",description:i?"Try another tag name":"Add @tags inside notes and they will appear here"}),children:a.length>0&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"flex flex-wrap gap-2.5",children:a.map(h=>e.jsxs(R,{to:M,params:{id:h.id},search:{page:1},className:"inline-flex items-center gap-1.5 rounded-full border border-border-subtle bg-hover-subtle px-3 py-1.5 text-fg-secondary transition-colors hover:border-border-secondary hover:bg-hover hover:text-fg-default",children:[e.jsx(f,{as:"span",variant:"meta",weight:"medium",className:"text-current",children:h.name}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",className:"text-current/70",children:h.referenceCount})]},h.id))}),e.jsx(v,{fallback:null,children:l&&t<l&&e.jsx(q,{page:d,last:Math.ceil(l/t),onChange:h=>{s({search:N=>({...N,page:h,query:i,limit:t,sortBy:n,sortOrder:u})})}})})]})})})})]})}export{X as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{i as x,D as N,q as j,Q as y,P as c,k as P,E as T,l as o,h as v}from"./time-
|
|
1
|
+
import{j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{i as x,D as N,q as j,Q as y,P as c,k as P,E as T,l as o,h as v}from"./time-DI902Sxa.js";import{F as h,N as k}from"./app-CyQtGTtn.js";import{T as q}from"./url-BvjSC8PU.js";import"./NotePropertiesPanel-Cu3RgDic.js";import{d as w}from"./useNoteMutate-xEIypxi5.js";import"./preload-helper-BXl3LOEh.js";import"./sortable.esm-DgSW3bAA.js";import"./AuxiliaryPanelHeader-zoJGsYWR.js";import"./Plus.es-P9Fjwtud.js";const R=s=>{const{data:r}=x({queryKey:j.notes.tagList(s.searchParams),async queryFn(){const t=await N({query:s.searchParams.query,offset:s.searchParams.offset,limit:s.searchParams.limit});if(t.type==="error")throw t;return t.tagNotes}});return s.render(r)},g=v(q);function A(){const s=g.useNavigate(),{id:r}=g.useParams(),{page:t}=g.useSearch(),i=25,{onDelete:m,onPinned:u,deleteWarningDialog:f}=w();return e.jsxs(y,{fallback:e.jsx(c,{title:"Tagged Notes",heading:e.jsx(o,{width:148,height:24,className:"rounded-full"}),description:e.jsx(o,{width:196,height:16,className:"rounded-full"}),variant:"default",children:e.jsxs("div",{className:"grid-auto-cards grid gap-5",children:[e.jsx(o,{height:"112px"}),e.jsx(o,{height:"112px"}),e.jsx(o,{height:"112px"})]})}),errorTitle:"Failed to load tagged notes",errorDescription:"Retry loading notes for this tag",resetKeys:[r,t,i],children:[e.jsx(R,{searchParams:{query:r,offset:(t-1)*i,limit:i},render:({notes:l,totalCount:n})=>{const d=l.flatMap(a=>a.tags).find(a=>a.id===r)?.name;return e.jsx(c,{title:d??"Tagged Notes",heading:d?n>0?`${d} (${n})`:d:"Tagged Notes",description:"Browse every note linked to this tag",variant:"default",children:e.jsx(h,{fallback:e.jsx(T,{title:"No tagged notes yet",description:"Notes tagged with this label will appear here"}),children:l.length>0&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"grid-auto-cards grid gap-5",children:l.map(a=>e.jsx(k,{...a,onPinned:()=>u(a.id,a.pinned),onDelete:()=>m(a.id)},a.id))}),e.jsx(h,{fallback:null,children:n&&i<n&&e.jsx(P,{page:t,last:Math.ceil(n/i),onChange:a=>{s({search:p=>({...p,page:a})})}})})]})})})}}),f]})}export{A as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a}from"./floating-ui.react-dom-BWTnA00G.js";import{C as l}from"./time-
|
|
1
|
+
import{r as a}from"./floating-ui.react-dom-BWTnA00G.js";import{C as l}from"./time-DI902Sxa.js";const r=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M117.18,188.74a12,12,0,0,1,0,17l-5.12,5.12A58.26,58.26,0,0,1,70.6,228h0A58.62,58.62,0,0,1,29.14,127.92L63.89,93.17a58.64,58.64,0,0,1,98.56,28.11,12,12,0,1,1-23.37,5.44,34.65,34.65,0,0,0-58.22-16.58L46.11,144.89A34.62,34.62,0,0,0,70.57,204h0a34.41,34.41,0,0,0,24.49-10.14l5.11-5.12A12,12,0,0,1,117.18,188.74ZM226.83,45.17a58.65,58.65,0,0,0-82.93,0l-5.11,5.11a12,12,0,0,0,17,17l5.12-5.12a34.63,34.63,0,1,1,49,49L175.1,145.86A34.39,34.39,0,0,1,150.61,156h0a34.63,34.63,0,0,1-33.69-26.72,12,12,0,0,0-23.38,5.44A58.64,58.64,0,0,0,150.56,180h.05a58.28,58.28,0,0,0,41.47-17.17l34.75-34.75a58.62,58.62,0,0,0,0-82.91Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M218.34,119.6,183.6,154.34a46.58,46.58,0,0,1-44.31,12.26c-.31.34-.62.67-.95,1L103.6,202.34A46.63,46.63,0,1,1,37.66,136.4L72.4,101.66A46.6,46.6,0,0,1,116.71,89.4c.31-.34.62-.67,1-1L152.4,53.66a46.63,46.63,0,0,1,65.94,65.94Z",opacity:"0.2"}),a.createElement("path",{d:"M240,88.23a54.43,54.43,0,0,1-16,37L189.25,160a54.27,54.27,0,0,1-38.63,16h-.05A54.63,54.63,0,0,1,96,119.84a8,8,0,0,1,16,.45A38.62,38.62,0,0,0,150.58,160h0a38.39,38.39,0,0,0,27.31-11.31l34.75-34.75a38.63,38.63,0,0,0-54.63-54.63l-11,11A8,8,0,0,1,135.7,59l11-11A54.65,54.65,0,0,1,224,48,54.86,54.86,0,0,1,240,88.23ZM109,185.66l-11,11A38.41,38.41,0,0,1,70.6,208h0a38.63,38.63,0,0,1-27.29-65.94L78,107.31A38.63,38.63,0,0,1,144,135.71a8,8,0,0,0,7.78,8.22H152a8,8,0,0,0,8-7.78A54.86,54.86,0,0,0,144,96a54.65,54.65,0,0,0-77.27,0L32,130.75A54.62,54.62,0,0,0,70.56,224h0a54.28,54.28,0,0,0,38.64-16l11-11A8,8,0,0,0,109,185.66Z"}))],["fill",a.createElement(a.Fragment,null,a.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,32ZM115.7,192.49a43.31,43.31,0,0,1-55-66.43l25.37-25.37a43.35,43.35,0,0,1,61.25,0,42.9,42.9,0,0,1,9.95,15.43,8,8,0,1,1-15,5.6A27.33,27.33,0,0,0,97.37,112L72,137.37a27.32,27.32,0,0,0,34.68,41.91,8,8,0,1,1,9,13.21Zm79.61-62.55-25.37,25.37A43,43,0,0,1,139.32,168h0a43.35,43.35,0,0,1-40.53-28.12,8,8,0,1,1,15-5.6A27.35,27.35,0,0,0,139.28,152h0a27.14,27.14,0,0,0,19.32-8L184,118.63a27.32,27.32,0,0,0-34.68-41.91,8,8,0,1,1-9-13.21,43.32,43.32,0,0,1,55,66.43Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M238,88.18a52.42,52.42,0,0,1-15.4,35.66l-34.75,34.75A52.28,52.28,0,0,1,150.62,174h-.05A52.63,52.63,0,0,1,98,119.9a6,6,0,0,1,6-5.84h.17a6,6,0,0,1,5.83,6.16A40.62,40.62,0,0,0,150.58,162h0a40.4,40.4,0,0,0,28.73-11.9l34.75-34.74A40.63,40.63,0,0,0,156.63,57.9l-11,11a6,6,0,0,1-8.49-8.49l11-11a52.62,52.62,0,0,1,74.43,0A52.83,52.83,0,0,1,238,88.18Zm-127.62,98.9-11,11A40.36,40.36,0,0,1,70.6,210h0a40.63,40.63,0,0,1-28.7-69.36L76.62,105.9A40.63,40.63,0,0,1,146,135.77a6,6,0,0,0,5.83,6.16H152a6,6,0,0,0,6-5.84A52.63,52.63,0,0,0,68.14,97.42L33.38,132.16A52.63,52.63,0,0,0,70.56,222h0a52.26,52.26,0,0,0,37.22-15.42l11-11a6,6,0,1,0-8.49-8.48Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M240,88.23a54.43,54.43,0,0,1-16,37L189.25,160a54.27,54.27,0,0,1-38.63,16h-.05A54.63,54.63,0,0,1,96,119.84a8,8,0,0,1,16,.45A38.62,38.62,0,0,0,150.58,160h0a38.39,38.39,0,0,0,27.31-11.31l34.75-34.75a38.63,38.63,0,0,0-54.63-54.63l-11,11A8,8,0,0,1,135.7,59l11-11A54.65,54.65,0,0,1,224,48,54.86,54.86,0,0,1,240,88.23ZM109,185.66l-11,11A38.41,38.41,0,0,1,70.6,208h0a38.63,38.63,0,0,1-27.29-65.94L78,107.31A38.63,38.63,0,0,1,144,135.71a8,8,0,0,0,16,.45A54.86,54.86,0,0,0,144,96a54.65,54.65,0,0,0-77.27,0L32,130.75A54.62,54.62,0,0,0,70.56,224h0a54.28,54.28,0,0,0,38.64-16l11-11A8,8,0,0,0,109,185.66Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M236,88.12a50.44,50.44,0,0,1-14.81,34.31l-34.75,34.74A50.33,50.33,0,0,1,150.62,172h-.05A50.63,50.63,0,0,1,100,120a4,4,0,0,1,4-3.89h.11a4,4,0,0,1,3.89,4.11A42.64,42.64,0,0,0,150.58,164h0a42.32,42.32,0,0,0,30.14-12.49l34.75-34.74a42.63,42.63,0,1,0-60.29-60.28l-11,11a4,4,0,0,1-5.66-5.65l11-11A50.64,50.64,0,0,1,236,88.12ZM111.78,188.49l-11,11A42.33,42.33,0,0,1,70.6,212h0a42.63,42.63,0,0,1-30.11-72.77l34.75-34.74A42.63,42.63,0,0,1,148,135.82a4,4,0,0,0,8,.23A50.64,50.64,0,0,0,69.55,98.83L34.8,133.57A50.63,50.63,0,0,0,70.56,220h0a50.33,50.33,0,0,0,35.81-14.83l11-11a4,4,0,1,0-5.65-5.66Z"}))]]),m=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),a.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z"}))]]),n=a.forwardRef((e,t)=>a.createElement(l,{ref:t,...e,weights:r}));n.displayName="LinkIcon";const V=n,h=a.forwardRef((e,t)=>a.createElement(l,{ref:t,...e,weights:m}));h.displayName="TrashIcon";const Z=h;export{V as c,Z as n};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./floating-ui.react-dom-BWTnA00G.js";import{c as a}from"./time-
|
|
1
|
+
import{j as s}from"./floating-ui.react-dom-BWTnA00G.js";import{c as a}from"./time-DI902Sxa.js";const m={compact:"h-[22px] px-2",regular:"h-7 px-2.5"};function c({children:e,className:n,contentClassName:r,size:t="regular",truncateContent:i=!0,...o}){return s.jsx("span",{className:a("inline-flex min-w-0 items-center overflow-hidden whitespace-nowrap rounded-full border text-xs font-medium leading-none",m[t],n),...o,children:i?s.jsx("span",{className:a("min-w-0 truncate",r),children:e}):e})}export{c as V};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as u,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{u as ke,a as re,K as Te,P as at,D as Ce,c as Se,b as At,d as Pt,C as Ae,s as rt,M as Vt,S as nt,h as Et,e as it,v as Dt}from"./sortable.esm-DgSW3bAA.js";import{g as Ft,m as lt,h as Mt,r as zt,j as Rt,u as Ot,k as It,l as Bt,n as ze,o as $t,p as Lt,q as Kt,t as Re,v as _t,w as qt,x as Wt,y as Ut}from"./app-DbQdHfMb.js";import{j as Qt,f as Pe,m as ot,a as ue,M as dt,u as Gt}from"./useNoteMutate-VJYw0Vt_.js";import{a3 as Yt,a4 as Oe,a5 as Zt,a6 as Ht,a7 as Jt,C as Xt,u as ct,q as W,W as es,e as ut,T as d,l as ce,B as $,c as ee,F as Ve,N as fe,K as Ee,m as mt,a8 as ts,k as ss,M as J,L as U,I as ve,a as Ie,b as de,J as Be,y as H,z as B,d as as,t as rs,P as ns,E as $e,h as is}from"./time-DZKkPFUi.js";import{f as ls}from"./tag.api-bU52U0tT.js";import{S as je}from"./SurfaceCard-BAlcul6z.js";import{V as Q}from"./ViewChip-Cq_YzRvB.js";import{N as De,V as os}from"./url-BvjSC8PU.js";import{s as ds}from"./ArrowRight.es-DZTjsBaI.js";import{s as cs}from"./CheckCircle.es-BTloiuti.js";import{n as we}from"./Plus.es-CaRgmXc_.js";import"./preload-helper-BXl3LOEh.js";var us=class extends Yt{constructor(t,s){super(t,s)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:Oe()})}getOptimisticResult(t){return t.behavior=Oe(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,s){const{state:a}=t,l=super.createResult(t,s),{isFetching:n,isRefetching:m,isError:x,isRefetchError:o}=l,v=a.fetchMeta?.fetchMore?.direction,j=x&&v==="forward",k=n&&v==="forward",p=x&&v==="backward",F=n&&v==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Ht(s,a.data),hasPreviousPage:Zt(s,a.data),isFetchNextPageError:j,isFetchingNextPage:k,isFetchPreviousPageError:p,isFetchingPreviousPage:F,isRefetchError:o&&!j&&!p,isRefetching:m&&!k&&!F}}};function ms(t,s){return Jt(t,us)}const ps=new Map([["bold",u.createElement(u.Fragment,null,u.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Z"}))],["duotone",u.createElement(u.Fragment,null,u.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),u.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z"}))],["fill",u.createElement(u.Fragment,null,u.createElement("path",{d:"M232,128A104,104,0,1,1,128,24,104.13,104.13,0,0,1,232,128Z"}))],["light",u.createElement(u.Fragment,null,u.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Z"}))],["regular",u.createElement(u.Fragment,null,u.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z"}))],["thin",u.createElement(u.Fragment,null,u.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Z"}))]]),pt=u.forwardRef((t,s)=>u.createElement(Xt,{ref:s,...t,weights:ps}));pt.displayName="CircleIcon";const hs=pt,me=6,Ne=["title","tags","properties","createdAt","updatedAt"],bs={activeTabId:null,tabs:[]},xs=t=>{const s=t.trim();return s?s.startsWith("@")?s:s.startsWith("#")?"":`@${s}`:""},ht=(t,s,a)=>{if(s===a)return t;const l=t.findIndex(o=>o.id===s),n=t.findIndex(o=>o.id===a);if(l<0||n<0)return t;const m=[...t],[x]=m.splice(l,1);return m.splice(n,0,x),m},bt=(t,s,a)=>{const l=t.findIndex(m=>m.id===s),n=l+(a==="previous"?-1:1);return l>=0&&n>=0&&n<t.length?t[n]?.id:void 0},Le=t=>{const s=t.flatMap(a=>typeof a=="string"?a.split(","):[]);return Array.from(new Set(s.map(xs).filter(Boolean)))},gs=t=>t.tabs.length===0?null:t.activeTabId?t.tabs.find(s=>s.id===t.activeTabId)??t.tabs[0]??null:t.tabs[0]??null,ys=(t,s)=>t.tabs.some(a=>a.id===s)?{...t,activeTabId:s}:t,xt=(t,s,a)=>({...t,tabs:ht(t.tabs,s,a)}),gt=(t,s,a,l)=>({...t,tabs:t.tabs.map(n=>n.id===s?{...n,sections:ht(n.sections,a,l)}:n)}),fs=(t,s,a)=>{const l=bt(t.tabs,s,a);return l?xt(t,s,l):t},vs=(t,s,a,l)=>{const n=t.tabs.find(x=>x.id===s)?.sections??[],m=bt(n,a,l);return m?gt(t,s,a,m):t},Ke=t=>t==="or"?"OR — any selected tag":"AND — all selected tags",js=t=>t==="or"?"OR":"AND",yt=t=>{switch(t){case"notEquals":return"is not";case"contains":return"contains";case"notContains":return"does not contain";case"before":return"before";case"after":return"after";case"exists":return"is set";case"notExists":return"is empty";default:return"is"}},ws=t=>{switch(t){case"table":return"Table";case"board":return"Board";case"calendar":return"Unavailable";default:return"List"}},ft=t=>{switch(t){case"tags":return"Tags";case"properties":return"Properties";case"createdAt":return"Created";case"updatedAt":return"Updated";default:return"Title"}},pe=t=>{const s=new Set(Ne),a=(t??[]).filter(n=>s.has(n)),l=Array.from(new Set(a));return l.length===0?[...Ne]:l.includes("title")?l:["title",...l]},Fe=t=>Array.from(new Set((t??[]).map(s=>s.trim()).filter(Boolean))).slice(0,me),vt=t=>({tableColumns:pe(t?.tableColumns),tablePropertyKeys:Fe(t?.tablePropertyKeys),boardGroupByPropertyKey:t?.boardGroupByPropertyKey?.trim()||null}),Ns=t=>{const s=yt(t.operator);return t.operator==="exists"||t.operator==="notExists"?`${t.name} ${s}`:`${t.name} ${s} ${t.value??""}`.trim()},ks=(t,s={})=>{const a={...t,...s};return{title:a.title,displayType:a.displayType,displayOptions:vt(a.displayOptions),tagNames:a.tagNames,mode:a.mode,propertyFilters:a.propertyFilters.map(l=>({key:l.key,valueType:l.valueType,operator:l.operator,value:l.value})),sortBy:a.sortBy,sortOrder:a.sortOrder,limit:a.limit}},jt="view-board-column:unassigned",Ts=t=>t===null?jt:`view-board-column:value:${encodeURIComponent(t)}`,Cs=t=>[...[...t].sort((s,a)=>s.order-a.order||s.label.localeCompare(a.label)).map(s=>({id:Ts(s.value),label:s.label,value:s.value,color:s.color??null})),{id:jt,label:"Unassigned",value:null,color:null}];function Ss({note:t,column:s,columns:a,isMoving:l,onMove:n}){const{attributes:m,listeners:x,setNodeRef:o,setActivatorNodeRef:v,transform:j,isDragging:k}=Pt({id:`view-board-note:${t.id}`,data:{note:t,sourceValue:s.value},disabled:l});return e.jsx("article",{ref:o,style:{transform:Ae.Translate.toString(j)},className:ee("group rounded-[14px] border border-border-subtle bg-elevated px-3 py-2.5 transition-[opacity,background-color,border-color] hover:border-border-secondary/80 hover:bg-hover-subtle/35",(k||l)&&"opacity-55",k&&"z-20 border-accent-primary/45 bg-elevated ring-2 ring-accent-primary/10"),children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("button",{type:"button",ref:v,"aria-label":`Drag ${t.title||"Untitled"} to another column`,...m,...x,className:"focus-ring-soft mt-0.5 hidden size-7 shrink-0 touch-none items-center justify-center rounded-[9px] text-fg-tertiary outline-none hover:bg-hover-subtle hover:text-fg-default sm:inline-flex",children:e.jsx(lt,{className:"size-3.5"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(d,{as:"div",variant:"body",weight:"semibold",tracking:"tight",className:"leading-[1.4]",children:e.jsx(Ve,{to:De,params:{id:t.id},className:"line-clamp-2 transition-colors hover:text-fg-default/80",children:t.title||"Untitled"})}),e.jsxs(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-2",children:["Updated ",fe(Number(t.updatedAt))]})]}),e.jsx(Ee,{button:e.jsx(Pe,{label:`Move ${t.title||"Untitled"}`,size:"sm"}),items:a.filter(p=>p.value!==s.value).map(p=>({name:`Move to ${p.label}`,onClick:()=>n(t,s.value,p.value)}))})]})})}function As({section:t,groupProperty:s,column:a,columns:l,index:n,scrollRootRef:m,movingNoteIds:x,onMove:o,pageCount:v,onPageCountChange:j}){const k=u.useRef(null),[p,F]=u.useState(n<4),{isOver:h,setNodeRef:c}=At({id:a.id,data:{optionValue:a.value}});u.useEffect(()=>{if(p||!k.current)return;if(typeof IntersectionObserver>"u"){F(!0);return}const N=new IntersectionObserver(O=>{O.some(A=>A.isIntersecting)&&(F(!0),N.disconnect())},{root:m.current,rootMargin:"0px 320px",threshold:.01});return N.observe(k.current),()=>N.disconnect()},[m,p]);const{data:g,isPending:D,isError:E,refetch:V,fetchNextPage:S,hasNextPage:z,isFetchingNextPage:y,isFetchNextPageError:w}=ms({queryKey:W.views.sectionBoardColumnPages(t.id,s.key,a.value,t.limit),enabled:p,initialPageParam:0,async queryFn({pageParam:N}){const O=await Ft(t.id,{optionValue:a.value,limit:t.limit,offset:N});if(O.type==="error")throw O;return O.viewSectionBoardColumn},getNextPageParam(N,O){return O.reduce((L,G)=>L+G.notes.length,0)<N.totalCount?O.length*t.limit:void 0}}),T=u.useMemo(()=>Array.from(new Map((g?.pages??[]).flatMap(N=>N.notes).map(N=>[N.id,N])).values()),[g?.pages]),M=g?.pages[0]?.totalCount;u.useEffect(()=>{!p||!g||g.pages.length>=v||!z||y||w||S()},[g,S,z,w,y,v,p]),u.useEffect(()=>{if(M===void 0)return;const N=Math.max(1,Math.ceil(M/t.limit));v>N&&j(N)},[j,v,t.limit,M]);const R=N=>{k.current=N,c(N)};return e.jsxs("section",{ref:R,"aria-label":`${a.label} column`,className:ee("flex min-h-[248px] w-[17rem] shrink-0 flex-col rounded-[18px] border bg-subtle/30 transition-[border-color,background-color] sm:w-[18rem]",h?"border-accent-primary/50 bg-accent-primary/6":"border-border-subtle"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border-subtle/75 px-3.5 py-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"size-2.5 shrink-0 rounded-full border border-black/5",style:{backgroundColor:a.color??"var(--color-fg-tertiary)"},"aria-hidden":"true"}),e.jsx(d,{as:"h3",variant:"label",weight:"semibold",className:"truncate",children:a.label})]}),e.jsx(d,{as:"span",variant:"meta",tone:"tertiary","aria-label":M===void 0?"Card count loading":`${M} cards`,className:"inline-flex min-w-6 justify-center rounded-full bg-elevated px-2 py-0.5 tabular-nums",children:M??"–"})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-2 p-2.5",children:[p?D&&!g?e.jsxs(e.Fragment,{children:[e.jsx(ce,{height:"76px",className:"rounded-[14px]"}),e.jsx(ce,{height:"76px",className:"rounded-[14px]"})]}):E?e.jsxs("div",{className:"rounded-[14px] border border-dashed border-border-subtle bg-elevated/60 p-3",children:[e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"Failed to load this column."}),e.jsx($,{type:"button",variant:"ghost",size:"sm",className:"mt-2",onClick:()=>{V()},children:"Retry"})]}):T.length===0?e.jsx("div",{className:"flex min-h-28 items-center justify-center rounded-[14px] border border-dashed border-border-subtle px-3 text-center",children:e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"Drop a note here"})}):T.map(N=>e.jsx(Ss,{note:N,column:a,columns:l,isMoving:x.has(N.id),onMove:o},N.id)):e.jsx("button",{type:"button",className:"focus-ring-soft flex min-h-28 items-center justify-center rounded-[14px] border border-dashed border-border-subtle px-3 text-sm text-fg-tertiary outline-none hover:bg-elevated",onClick:()=>F(!0),children:"Load cards"}),z?e.jsx($,{type:"button",variant:"ghost",size:"sm",className:"mt-auto w-full",disabled:y,onClick:()=>{w||j(v+1),S()},children:y?"Loading...":w?"Retry loading cards":`Load more (${Math.max(0,(M??0)-T.length)})`}):null]})]})}function Ps({section:t,groupProperty:s,navigationState:a={},onNavigationStateChange:l=()=>{}}){const n=ct(),m=ut(),x=u.useRef(null),[o,v]=u.useState(()=>new Set),j=u.useMemo(()=>Cs(s.options),[s.options]),k=ke(re(at,{activationConstraint:{distance:6}}),re(Te)),p=u.useCallback(async(h,c,g)=>{if(c===g||o.has(h.id))return;v(V=>new Set(V).add(h.id));const D=W.views.sectionBoardAll(t.id),E=n.getQueriesData({queryKey:D});for(const[V,S]of E){if(!S||!Array.isArray(S.pages))continue;const z=V[3];if(z?.groupPropertyKey!==s.key)continue;const y=z.optionValue===c,w=z.optionValue===g,T=z.pageSize??t.limit;let M=S.pages.flatMap(N=>N.notes).filter(N=>N.id!==h.id);w&&(M=[h,...M]);const R=Math.max(0,(S.pages[0]?.totalCount??0)-(y?1:0)+(w?1:0));n.setQueryData(V,{...S,pages:S.pages.map((N,O)=>({totalCount:R,notes:M.slice(O*T,(O+1)*T)}))})}try{const V=await es({id:h.id,expectedUpdatedAt:h.updatedAt,...g===null?{deleteKeys:[s.key]}:{set:[{key:s.key,name:s.name,value:g,valueType:"select"}]}});if(V.type==="error"){for(const[S,z]of E)n.setQueryData(S,z);m(V.errors[0]?.message??"Failed to move this note.");return}await Promise.all([Qt(n),n.invalidateQueries({queryKey:W.notes.propertyKeysAll(),exact:!1})])}catch{for(const[V,S]of E)n.setQueryData(V,S);m("Failed to move this note.")}finally{v(V=>{const S=new Set(V);return S.delete(h.id),S})}},[s.key,s.name,o,n,t.id,t.limit,m]),F=({active:h,over:c})=>{const g=h.data.current?.note,D=h.data.current?.sourceValue,E=c?.data.current?.optionValue;!g||D===void 0||E===void 0||p(g,D,E)};return e.jsx(Ce,{sensors:k,collisionDetection:Se,onDragEnd:F,children:e.jsx("div",{ref:x,"data-scroll-restoration-id":`view-board-${t.id}`,className:"overflow-x-auto overscroll-x-contain px-3 py-3.5 [scrollbar-gutter:stable] sm:px-4","aria-label":`Board grouped by ${s.name}`,children:e.jsx("div",{className:"flex min-w-max items-stretch gap-3 pb-1",children:j.map((h,c)=>e.jsx(As,{section:t,groupProperty:s,column:h,columns:j,index:c,scrollRootRef:x,movingNoteIds:o,pageCount:a.columns?.[h.id]??1,onPageCountChange:g=>l(D=>({...D,columns:{...D.columns,[h.id]:g}})),onMove:(g,D,E)=>{p(g,D,E)}},h.id))})})})}const Vs="group flex min-h-[72px] items-center justify-between gap-3 px-4 py-3 transition-colors hover:bg-hover-subtle",Es=t=>t.valueType==="select"?t.option?.label??t.value:t.valueType==="boolean"?t.value==="true"?"True":"False":t.value,Ds=t=>{const s=t.tags.slice(0,2),a=t.tags.length-s.length;return s.length===0?null:e.jsxs(e.Fragment,{children:[s.map(l=>e.jsx(Q,{size:"compact",className:"max-w-[116px] shrink-0 border-border-subtle bg-transparent text-fg-secondary",children:l.name},l.id)),a>0&&e.jsxs(Q,{size:"compact",className:"shrink-0 border-border-subtle bg-subtle text-fg-tertiary",children:["+",a]})]})},Fs=t=>{const s=t.properties??[],a=s.slice(0,2),l=s.length-a.length;return a.length===0?null:e.jsxs(e.Fragment,{children:[a.map(n=>e.jsxs(Q,{size:"compact",truncateContent:!1,className:"max-w-[220px] gap-1.5 border-border-subtle bg-subtle/55 text-fg-secondary",children:[n.valueType==="select"?e.jsx("span",{className:"size-2 shrink-0 rounded-full border border-black/5",style:{backgroundColor:n.option?.color??"var(--color-fg-tertiary)"},"aria-hidden":"true"}):null,e.jsx("span",{className:"max-w-[72px] shrink truncate text-fg-tertiary",children:n.name}),e.jsx("span",{className:"min-w-0 truncate",children:Es(n)||"—"})]},n.key)),l>0?e.jsxs(Q,{size:"compact",className:"shrink-0 border-border-subtle bg-subtle text-fg-tertiary",children:["+",l," properties"]}):null]})};function Ms({notes:t,isPending:s,isError:a,onRetry:l}){return s?e.jsxs("div",{className:"overflow-hidden bg-transparent",children:[e.jsx("div",{className:"h-[72px] animate-pulse bg-subtle/35"}),e.jsx("div",{className:"h-[72px] animate-pulse border-t border-border-subtle/70 bg-subtle/35"}),e.jsx("div",{className:"h-[72px] animate-pulse border-t border-border-subtle/70 bg-subtle/35"})]}):a?e.jsxs("div",{className:"rounded-[16px] border border-border-subtle bg-subtle/30 p-4",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"Failed to load this section"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Retry to refresh this saved query."}),e.jsx("div",{className:"mt-3",children:e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:l,children:"Retry"})})]}):t.length===0?e.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle px-4 py-5",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"No notes match yet"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Add matching notes, or edit this view query."})]}):e.jsx("div",{className:"divide-y divide-border-subtle/70 bg-transparent",children:t.map(n=>e.jsxs(Ve,{to:De,params:{id:n.id},className:Vs,children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.pinned?e.jsx(ot,{className:"size-3.5 shrink-0 text-fg-tertiary",weight:"fill","aria-label":"Pinned"}):null,e.jsx(d,{as:"div",variant:"body",weight:"semibold",tracking:"tight",className:"line-clamp-1",children:n.title||"Untitled"})]}),e.jsxs("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5",children:[Fs(n),Ds(n),e.jsxs(d,{as:"span",variant:"label",weight:"medium",tone:"tertiary",className:"sm:hidden",children:["Updated ",fe(Number(n.updatedAt))]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2 pl-2",children:[e.jsx(d,{as:"span",variant:"label",weight:"medium",tone:"tertiary",className:"hidden sm:inline",children:fe(Number(n.updatedAt))}),e.jsx(ds,{className:"size-4 text-fg-tertiary transition-transform group-hover:translate-x-0.5"})]})]},n.id))})}const zs={title:300,tags:200,createdAt:148,updatedAt:148},Rs={title:"title",createdAt:"createdAt",updatedAt:"updatedAt"},Os="flex h-[24px] min-w-0 max-w-full items-center gap-1.5 overflow-hidden whitespace-nowrap",wt="text-xs leading-5 text-fg-tertiary",Is=t=>mt(Number(t)).format("MMM D, YYYY"),Bs=t=>t==="text"||t==="url"?220:t==="date"?168:156,Nt=t=>t.kind==="property"?Bs(t.valueType):zs[t.key],$s=(t,s,a)=>{const l=new Map(a.map(o=>[o.key,o])),n=new Map(s.flatMap(o=>o.properties??[]).map(o=>[o.key,o])),m=Fe(t.displayOptions.tablePropertyKeys),x=Array.from(new Set([...t.propertyFilters.map(o=>o.key),...s.flatMap(o=>(o.properties??[]).map(v=>v.key))])).slice(0,3);return(m.length>0?m:x).flatMap(o=>{const v=l.get(o),j=n.get(o);return!v&&!j?[]:[{kind:"property",key:o,name:v?.name??j?.name??o,valueType:v?.valueType??j?.valueType??"text"}]})},Ls=(t,s,a)=>{const l=$s(t,s,a);return pe(t.displayOptions.tableColumns).reduce((n,m)=>(m==="properties"?n.push(...l):n.push({kind:"base",key:m}),n),[])},Ks=t=>t.reduce((s,a)=>s+Nt(a),0),_s=t=>{if(t.tags.length===0)return e.jsx("span",{className:wt,children:"—"});const s=t.tags.slice(0,3),a=t.tags.length-s.length;return e.jsxs("div",{className:Os,children:[s.map(l=>e.jsx(Q,{size:"compact",className:"max-w-[132px] shrink-0 border-border-subtle bg-transparent text-fg-secondary",children:l.name},l.id)),a>0?e.jsxs(Q,{size:"compact",className:"shrink-0 border-border-subtle bg-subtle text-fg-tertiary",children:["+",a]}):null]})},qs=t=>{if(!t)return e.jsx("span",{className:wt,children:"—"});if(t.valueType==="select")return e.jsx(Q,{size:"compact",className:"max-w-full border-border-subtle bg-subtle/65 text-fg-secondary",truncateContent:!1,children:e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"size-2 shrink-0 rounded-full border border-black/5",style:{backgroundColor:t.option?.color??"var(--color-fg-tertiary)"},"aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 truncate",children:t.option?.label??t.value})]})});if(t.valueType==="boolean"){const s=t.value==="true",a=s?cs:hs;return e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-sm text-fg-secondary",children:[e.jsx(a,{className:"size-3.5 text-fg-tertiary",weight:s?"fill":"regular"}),s?"True":"False"]})}return e.jsx("span",{className:ee("block truncate text-sm text-fg-secondary",t.valueType==="number"&&"tabular-nums"),title:t.value,children:t.value||"—"})};function Ws({section:t,notes:s,isPending:a,isError:l,onRetry:n,onSortChange:m,isSortPending:x,activeSortBy:o=t.sortBy,activeSortOrder:v=t.sortOrder,availableProperties:j=[],surface:k="flush"}){const p=Ls(t,s,j),F=Ks(p),h=k==="card"?"overflow-x-auto rounded-[16px] border border-border-subtle bg-elevated":"overflow-x-auto bg-transparent",c=k==="card"?"overflow-hidden rounded-[16px] border border-border-subtle bg-elevated":"overflow-hidden bg-transparent",g=k==="card"?"bg-elevated":"bg-transparent",D=k==="card"?"bg-subtle/65":"bg-subtle/45",E=k==="card"?"bg-elevated":"bg-transparent",V=k==="card"?"var(--elevated)":"var(--surface)",S=y=>{if(y.kind==="property")return e.jsxs("th",{className:"px-3 py-2 text-left",children:[e.jsx(d,{as:"p",variant:"label",weight:"semibold",className:"truncate",title:y.name,children:y.name}),e.jsx(d,{as:"p",variant:"micro",tone:"tertiary",className:"mt-0.5 capitalize",children:y.valueType})]},`property:${y.key}`);const w=Rs[y.key],T=ft(y.key),M=w?o===w:!1,R=y.key==="title";return e.jsx("th",{"aria-sort":M?v==="asc"?"ascending":"descending":void 0,className:ee("px-3 py-2.5 text-xs font-semibold text-fg-tertiary",R&&"lg:sticky lg:left-0 lg:z-20"),style:R?{background:`linear-gradient(var(--subtle), var(--subtle)), ${V}`}:void 0,children:w?e.jsxs("button",{type:"button",className:"focus-ring-soft -ml-1 inline-flex items-center gap-1 rounded-[8px] px-1 py-0.5 outline-none transition-colors hover:bg-hover-subtle hover:text-fg-secondary disabled:cursor-wait disabled:opacity-60",disabled:x,onClick:()=>m(w),children:[e.jsx("span",{children:T}),e.jsx("span",{"aria-hidden":"true",className:"text-[10px] text-fg-tertiary",children:M?v==="asc"?"↑":"↓":"↕"})]}):T},y.key)},z=(y,w)=>{if(w.kind==="property")return e.jsx("td",{className:"overflow-hidden px-3 py-2.5 align-middle transition-colors group-hover:bg-hover-subtle",children:qs(y.properties?.find(T=>T.key===w.key))},`property:${w.key}`);switch(w.key){case"tags":return e.jsx("td",{className:"overflow-hidden px-3 py-2.5 align-middle transition-colors group-hover:bg-hover-subtle",children:_s(y)},w.key);case"createdAt":case"updatedAt":{const T=w.key==="createdAt"?y.createdAt:y.updatedAt;return e.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 align-middle transition-colors group-hover:bg-hover-subtle",children:e.jsx(d,{as:"span",variant:"meta",tone:"tertiary",title:mt(Number(T)).format("MMM D, YYYY h:mm A"),children:Is(T)})},w.key)}default:return e.jsxs("td",{className:"relative px-3 py-2.5 align-middle lg:sticky lg:left-0 lg:z-10",style:{background:V},children:[e.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 bg-hover-subtle opacity-0 transition-opacity group-hover:opacity-100"}),e.jsxs("div",{className:"relative z-10 flex min-w-0 items-center gap-2",children:[y.pinned?e.jsx(ot,{className:"size-3.5 shrink-0 text-fg-tertiary",weight:"fill","aria-label":"Pinned"}):null,e.jsx(d,{as:"div",variant:"body",weight:"semibold",className:"min-w-0 line-clamp-1",children:e.jsx(Ve,{to:De,params:{id:y.id},className:"focus-ring-soft rounded-[6px] outline-none transition-colors hover:text-fg-default/80",children:y.title||"Untitled"})})]})]},w.key)}};return a?e.jsxs("div",{className:c,children:[e.jsx("div",{className:"h-11 animate-pulse bg-subtle/50"}),e.jsx("div",{className:`h-14 animate-pulse border-t border-border-subtle ${g}`}),e.jsx("div",{className:`h-14 animate-pulse border-t border-border-subtle ${g}`}),e.jsx("div",{className:`h-14 animate-pulse border-t border-border-subtle ${g}`})]}):l?e.jsxs("div",{className:"rounded-[16px] border border-border-subtle bg-subtle/30 p-4",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"Failed to load this table"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Retry to refresh this saved query."}),e.jsx("div",{className:"mt-3",children:e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:n,children:"Retry"})})]}):s.length===0?e.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle px-4 py-5",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"No rows yet"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Add matching notes, or edit this view query."})]}):e.jsx("div",{className:h,"data-scroll-restoration-id":`view-table-${t.id}`,"aria-label":"Scrollable view table",children:e.jsxs("table",{className:"w-full table-fixed border-collapse text-left",style:{minWidth:F},children:[e.jsx("caption",{className:"sr-only",children:"View query results as a table"}),e.jsx("colgroup",{children:p.map(y=>e.jsx("col",{style:{width:`${Nt(y)/F*100}%`}},y.kind==="property"?`property:${y.key}`:y.key))}),e.jsx("thead",{className:D,children:e.jsx("tr",{className:"border-b border-border-subtle",children:p.map(S)})}),e.jsx("tbody",{className:E,children:s.map(y=>e.jsx("tr",{className:"group h-12 border-b border-border-subtle/70 last:border-b-0",children:p.map(w=>z(y,w))},y.id))})]})})}function Us({onEdit:t}){return e.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle bg-subtle/40 px-4 py-5",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"This display type is unavailable"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Switch this section to List, Table, or Board to show the saved query here."}),e.jsx("div",{className:"mt-3",children:e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:t,children:"Change display"})})]})}function Qs({section:t,notes:s,isPending:a,isError:l,onRetry:n,onEdit:m,onSortChange:x,isSortPending:o,activeSortBy:v=t.sortBy,activeSortOrder:j=t.sortOrder,availableProperties:k=[],isPropertiesLoading:p=!1,navigationState:F={},onNavigationStateChange:h=()=>{}}){if(t.displayType==="board"){const c=k.find(g=>g.key===t.displayOptions.boardGroupByPropertyKey&&g.valueType==="select");return!c&&p?e.jsxs("div",{className:"flex gap-3 overflow-hidden px-4 py-3.5",children:[e.jsx("div",{className:"h-[248px] w-[18rem] shrink-0 animate-pulse rounded-[18px] bg-subtle/50"}),e.jsx("div",{className:"h-[248px] w-[18rem] shrink-0 animate-pulse rounded-[18px] bg-subtle/50"}),e.jsx("div",{className:"h-[248px] w-[18rem] shrink-0 animate-pulse rounded-[18px] bg-subtle/50"})]}):!c||c.options.length===0?e.jsxs("div",{className:"m-4 rounded-[16px] border border-dashed border-border-subtle bg-subtle/40 px-4 py-5",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"Board grouping is unavailable"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Choose an existing select property with options to restore this board."}),e.jsx("div",{className:"mt-3",children:e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:m,children:"Edit board"})})]}):e.jsx(Ps,{section:t,groupProperty:c,navigationState:F,onNavigationStateChange:h})}return t.displayType==="table"?e.jsx(Ws,{section:t,notes:s,isPending:a,isError:l,onRetry:n,onSortChange:x,isSortPending:o,activeSortBy:v,activeSortOrder:j,availableProperties:k}):t.displayType==="calendar"?e.jsx(Us,{onEdit:m}):e.jsx(Ms,{notes:s,isPending:a,isError:l,onRetry:n})}function Gs({section:t,onEdit:s,onDuplicate:a,onDelete:l,onMoveUp:n,onMoveDown:m,dragHandle:x,availableProperties:o=[],isPropertiesLoading:v=!1,navigationState:j={},onNavigationStateChange:k=()=>{}}){const p=t.displayType==="board",F=j.page??1,h=(F-1)*t.limit,c=j.sort?.by??t.sortBy,g=j.sort?.order??t.sortOrder,{data:D,isPending:E,isError:V,isPlaceholderData:S,refetch:z}=ue({queryKey:W.views.sectionNotes(t.id,{limit:t.limit,offset:h,sortBy:c,sortOrder:g}),enabled:!p,placeholderData:ts,async queryFn(){const A=await Mt(t.id,{limit:t.limit,offset:h,sortBy:c,sortOrder:g});if(A.type==="error")throw A;return A.viewSectionNotes}}),y=D?.notes??[],w=D?.totalCount??0,T=Math.max(1,Math.ceil(w/t.limit)),M=js(t.mode),R=t.tagNames.length>0||t.propertyFilters.length>0,N=p?o.find(A=>A.key===t.displayOptions.boardGroupByPropertyKey):null,O=A=>{const L=c===A?g==="asc"?"desc":"asc":A==="title"?"asc":"desc";k(G=>({...G,page:1,sort:{by:A,order:L}}))};return u.useEffect(()=>{p||E||V||S||!D||F<=T||k(A=>({...A,page:T}))},[D,p,V,E,S,T,k,F]),e.jsxs(je,{flush:!0,className:"flex h-full flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border-subtle/75 px-4 py-3.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[x&&e.jsx("div",{className:"-mr-1 shrink-0 self-center",children:x}),e.jsx("div",{className:"min-w-0",children:e.jsx(d,{as:"h2",variant:"subheading",weight:"semibold",tracking:"tight",className:"min-w-0",children:e.jsx("span",{className:"truncate",children:t.title})})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-1.5",children:[e.jsx(Q,{className:"max-w-full border-border-subtle/80 bg-elevated text-fg-secondary",children:ws(t.displayType)}),p&&t.displayOptions.boardGroupByPropertyKey?e.jsxs(Q,{className:"max-w-full border-border-subtle/80 bg-subtle text-fg-secondary",children:["Grouped by ",N?.name??t.displayOptions.boardGroupByPropertyKey]}):null,t.tagNames.map((A,L)=>e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[L>0&&e.jsx("span",{className:"px-0.5 text-[10px] font-semibold tracking-[0.08em] text-fg-tertiary/85",children:M}),e.jsx(Q,{className:"max-w-full border-border-subtle/80 bg-transparent text-fg-secondary",children:A})]},A)),t.propertyFilters.map(A=>e.jsx(Q,{className:"max-w-full border-border-subtle/80 bg-subtle text-fg-secondary",children:Ns(A)},`${A.key}-${A.operator}-${A.value??""}`)),!R&&e.jsx(Q,{className:"max-w-full border-border-subtle/80 bg-transparent text-fg-tertiary",children:"All notes"})]})]}),e.jsx(Ee,{button:e.jsx(Pe,{label:"Section actions"}),items:[...n?[{name:"Move up",onClick:n}]:[],...m?[{name:"Move down",onClick:m}]:[],...n||m?[{type:"separator"}]:[],{name:"Edit section",onClick:s},{name:"Duplicate section",onClick:a},{type:"separator"},{name:"Delete section",onClick:l}]})]}),e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsx(Qs,{section:t,notes:y,isPending:E,isError:V,onRetry:()=>{z()},onEdit:s,onSortChange:O,isSortPending:S,activeSortBy:c,activeSortOrder:g,availableProperties:o,isPropertiesLoading:v,navigationState:j,onNavigationStateChange:k})}),e.jsxs("div",{className:"flex flex-col gap-3 border-t border-border-subtle/75 px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:p?`${t.limit} cards per column load`:E||S?"Loading notes...":w===0?"No matching notes":`Showing ${h+1}–${Math.min(h+y.length,w)} of ${w} notes`}),!p&&T>1?e.jsx(ss,{page:Math.min(F,T),last:T,className:"!mt-0 shrink-0 sm:justify-end",onChange:A=>k(L=>({...L,page:A}))}):null]})]})}const xe="__choose_property__",ge="__choose_board_group__",Ys=["title","tags","properties","createdAt","updatedAt"],_e=t=>String(t?.limit??5),qe=t=>t?.displayType==="table"||t?.displayType==="board"?t.displayType:"list",We=t=>pe(t?.displayOptions?.tableColumns??Ne),Ue=t=>Fe(t?.displayOptions?.tablePropertyKeys),Qe=t=>t?.displayOptions?.boardGroupByPropertyKey??"",Ge=t=>t?.mode??"and",Ye=t=>t?t.tagNames.join(", "):"",Ze=t=>t?.title??"",He=t=>t?.sortBy??"updatedAt",Je=t=>t?.sortOrder??"desc",kt=t=>`property-filter-${Date.now()}-${t}`,Xe=t=>(t?.propertyFilters??[]).map((s,a)=>({id:kt(a),key:s.key,operator:s.operator,value:s.value??""})),et=t=>t?t.valueType==="date"||t.valueType==="number"?["equals","notEquals","before","after","exists","notExists"]:t.valueType==="text"||t.valueType==="url"?["equals","notEquals","contains","notContains","exists","notExists"]:["equals","notEquals","exists","notExists"]:["exists","notExists"],tt=t=>t?"equals":"exists",Zs=t=>t?t.valueType==="boolean"?"true":t.valueType==="select"?t.options[0]?.value??"":"":"",ye=t=>t!=="exists"&&t!=="notExists",Tt=t=>t==="contains"||t==="notContains",Hs=(t,s)=>t.valueType==="date"?"date":t.valueType==="number"?"number":t.valueType==="url"&&!Tt(s)?"url":"text",Js=(t,s)=>{if(t.valueType==="url")return Tt(s)?"example.com":"https://example.com";if(t.valueType==="text")return"Value"};function Xs({open:t,mode:s,initialSection:a=null,availableTags:l,availableProperties:n,isTagsLoading:m=!1,isPropertiesLoading:x=!1,onClose:o,onSubmit:v}){const[j,k]=u.useState(Ze(a)),[p,F]=u.useState(qe(a)),[h,c]=u.useState(We(a)),[g,D]=u.useState(Ue(a)),[E,V]=u.useState(Qe(a)),[S,z]=u.useState(Ye(a)),[y,w]=u.useState(Ge(a)),[T,M]=u.useState(He(a)),[R,N]=u.useState(Je(a)),[O,A]=u.useState(_e(a)),[L,G]=u.useState(Xe(a)),[he,te]=u.useState((a?.tagNames.length??0)>0),[ne,I]=u.useState(""),X=u.useMemo(()=>new Map(n.map(r=>[r.key,r])),[n]);u.useEffect(()=>{t&&(k(Ze(a)),F(qe(a)),c(We(a)),D(Ue(a)),V(Qe(a)),z(Ye(a)),w(Ge(a)),M(He(a)),N(Je(a)),A(_e(a)),G(Xe(a)),te((a?.tagNames.length??0)>0),I(""))},[a,t]);const Y=Le([S]),se=he||Y.length>0,be=Y.length===0&&L.length===0,ae=n.filter(r=>r.valueType==="select"&&r.options.length>0),i=r=>{r!=="title"&&(c(f=>{if(f.includes(r)){const _=f.filter(C=>C!==r);return _.length>0?_:f}return pe([...f,r])}),I(""))},b=r=>{D(f=>f.includes(r)?f.filter(_=>_!==r):f.length>=me?f:[...f,r])},P=r=>{const f=Y.includes(r)?Y.filter(_=>_!==r):[...Y,r];z(f.join(", ")),I("")},K=()=>{te(!0),I("")},ie=()=>{z(""),w("and"),te(!1),I("")},Ct=()=>{if(n.length===0){I("Create a shared property before adding a filter.");return}G(r=>[...r,{id:kt(r.length),key:"",operator:"exists",value:""}]),I("")},le=(r,f)=>{G(_=>_.map(C=>{if(C.id!==r)return C;const Z={...C,...f},oe=X.get(Z.key);return et(oe).includes(Z.operator)||(Z.operator=tt(oe)),"key"in f&&(Z.value=Zs(oe),Z.operator=tt(oe)),Z})),I("")},St=r=>{G(f=>f.filter(_=>_.id!==r)),I("")};return e.jsxs(J,{isOpen:t,onClose:o,variant:"form",className:"sm:max-w-[720px]",children:[e.jsx(J.Header,{title:s==="create"?"Create section":"Edit section",onClose:o}),e.jsx(J.Body,{children:e.jsxs("form",{id:"view-section-form",className:"flex flex-col gap-5",onSubmit:r=>{r.preventDefault();const f=Le([S]);if(se&&f.length===0){I("Choose at least one tag, or remove this tag filter.");return}if(L.find(q=>!q.key||!X.has(q.key))){I("Choose a property for every filter.");return}const C=X.get(E);if(p==="board"&&(!C||C.valueType!=="select"||C.options.length===0)){I("Choose a select property with at least one option for the board columns.");return}if(p==="board"&&L.some(q=>q.key===E)){I("Use different properties for the board columns and the section filter.");return}const Z=L.map(q=>{const Me=X.get(q.key);return{key:Me?.key??q.key,valueType:Me?.valueType??"text",operator:q.operator,value:ye(q.operator)?q.value:null}});if(Z.some(q=>ye(q.operator)&&!q.value?.trim())){I("Fill every filter value, or switch it to is set / is empty.");return}v({title:j,displayType:p,displayOptions:vt({tableColumns:h,tablePropertyKeys:g,boardGroupByPropertyKey:E}),tagNames:f,mode:y,propertyFilters:Z,sortBy:T,sortOrder:R,limit:Number(O)})},children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{htmlFor:"view-section-title",size:"md",children:"Section name"}),e.jsx(ve,{id:"view-section-title",value:j,onChange:r=>k(r.target.value),placeholder:"Doing notes",autoFocus:!0})]}),e.jsxs("section",{className:"flex flex-col gap-3 border-b border-border-subtle pb-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(U,{size:"md",children:"Display"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Show the same note set as a list, table, or property board."})]}),e.jsxs(Ie,{type:"single",value:p,onValueChange:r=>{(r==="list"||r==="table"||r==="board")&&(F(r),r==="board"&&!ae.some(f=>f.key===E)&&V(ae[0]?.key??""),I(""))},variant:"quiet",size:"sm",className:"self-start",children:[e.jsx(de,{value:"list","aria-label":"Show as list",children:"List"}),e.jsx(de,{value:"table","aria-label":"Show as table",children:"Table"}),e.jsx(de,{value:"board","aria-label":"Show as board",children:"Board"})]}),p==="table"?e.jsxs("div",{className:"border-t border-border-subtle/80 pt-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx(U,{size:"sm",children:"Table columns"}),e.jsx(d,{as:"span",variant:"meta",tone:"tertiary",children:h.includes("properties")&&g.length===0?"Properties automatic":`${h.length-(h.includes("properties")?1:0)+(h.includes("properties")?g.length:0)} shown`})]}),e.jsx("div",{className:"mt-3 grid grid-cols-2 gap-2",children:Ys.map(r=>{const f=ft(r);return e.jsxs("div",{className:"flex items-center gap-2 px-1 py-2",children:[e.jsx(Be,{size:"sm",checked:h.includes(r),disabled:r==="title","aria-label":`Show ${f} column`,onChange:()=>i(r)}),e.jsx(d,{as:"span",variant:"label",tone:"secondary",children:f})]},r)})}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-2",children:"Title is always shown because it opens the note."}),h.includes("properties")?e.jsxs("div",{className:"mt-3 border-t border-border-subtle/80 pt-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx(d,{as:"p",variant:"label",weight:"semibold",children:"Property columns"}),e.jsxs(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-0.5",children:["Select up to ",me," properties to compare."]})]}),e.jsx(d,{as:"span",variant:"meta",tone:"tertiary",children:g.length>0?`${g.length} selected`:"Automatic"})]}),n.length>0?e.jsx("div",{className:"mt-3 grid grid-cols-2 gap-2",children:n.map(r=>{const f=g.includes(r.key),_=g.length>=me;return e.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-1 py-2",children:[e.jsx(Be,{size:"sm",checked:f,disabled:!f&&_,"aria-label":`Show ${r.name} property column`,onChange:()=>b(r.key)}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(d,{as:"p",variant:"label",tone:"secondary",truncate:!0,children:r.name}),e.jsx(d,{as:"p",variant:"micro",tone:"tertiary",children:r.valueType})]})]},r.key)})}):e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-3",children:"Shared properties will appear here after you create them."}),g.length===0&&n.length>0?e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-2",children:"Automatic mode shows up to three properties relevant to the current notes."}):null]}):null]}):null,p==="board"?e.jsx("div",{className:"border-t border-border-subtle/80 pt-3",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{id:"view-section-board-group-label",htmlFor:"view-section-board-group",size:"sm",children:"Board columns"}),e.jsxs(H,{id:"view-section-board-group",value:E||ge,"aria-labelledby":"view-section-board-group-label",className:"w-full",onValueChange:r=>{r!==ge&&(V(r),I(""))},children:[e.jsx(B,{value:ge,disabled:!0,children:"Choose a select property"}),ae.map(r=>e.jsxs(B,{value:r.key,children:[r.name," · ",r.options.length," columns"]},r.key))]}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"Moving a card changes this property. Notes without a value stay in Unassigned."}),ae.length===0&&!x?e.jsx(d,{as:"p",variant:"meta",className:"text-fg-error",children:"Create a shared select property with options before using a board."}):null]})}):null]}),e.jsxs("section",{className:"flex flex-col gap-3 border-b border-border-subtle pb-5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(U,{size:"md",children:"Filters"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Use properties for structured fields, and tags for loose topics or context."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx($,{type:"button",variant:"subtle",size:"sm",onClick:Ct,children:"Add property filter"}),!se&&e.jsx($,{type:"button",variant:"subtle",size:"sm",onClick:K,children:"Add tag filter"})]})]}),L.length===0&&!se?e.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle bg-elevated/60 px-4 py-3",children:[e.jsx(d,{as:"p",variant:"label",tone:"default",children:be?"All notes":"No filters"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Add a property filter, a tag filter, or leave this view open to all notes."})]}):null,L.length>0?e.jsx("div",{className:"flex flex-col gap-2.5",children:L.map(r=>{const f=X.get(r.key),_=et(f);return e.jsxs("div",{className:"grid gap-2 rounded-[16px] border border-border-subtle bg-elevated p-3 md:grid-cols-[minmax(0,1fr)_minmax(10.5rem,12rem)_minmax(0,1fr)_auto] md:items-center",children:[e.jsxs(H,{value:r.key||xe,ariaLabel:"Property filter property",className:"w-full min-w-0",onValueChange:C=>{C!==xe&&le(r.id,{key:C})},children:[e.jsx(B,{value:xe,disabled:!0,children:"Choose property"}),n.map(C=>e.jsx(B,{value:C.key,children:C.name},C.key))]}),e.jsx(H,{value:r.operator,disabled:!f,ariaLabel:"Property filter operator",className:"w-full min-w-0",onValueChange:C=>le(r.id,{operator:C}),children:_.map(C=>e.jsx(B,{value:C,children:yt(C)},C))}),ye(r.operator)&&f?f.valueType==="select"?e.jsx(H,{value:r.value,ariaLabel:"Property filter value",className:"w-full min-w-0",onValueChange:C=>le(r.id,{value:C}),children:f.options.map(C=>e.jsx(B,{value:C.value,children:C.label},C.value))}):f.valueType==="boolean"?e.jsxs(H,{value:r.value||"true",ariaLabel:"Property filter value",className:"w-full min-w-0",onValueChange:C=>le(r.id,{value:C}),children:[e.jsx(B,{value:"true",children:"True"}),e.jsx(B,{value:"false",children:"False"})]}):e.jsx(ve,{type:Hs(f,r.operator),value:r.value,onChange:C=>le(r.id,{value:C.target.value}),placeholder:Js(f,r.operator),"aria-label":"Property filter value"}):e.jsx(d,{as:"span",variant:"label",tone:"tertiary",children:f?"No value needed":"Choose a property first"}),e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:()=>St(r.id),children:"Remove"})]},r.id)})}):null,se?e.jsxs("div",{className:"flex flex-col gap-3 rounded-[16px] border border-border-subtle bg-elevated p-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(d,{as:"p",variant:"label",tone:"default",children:"Tag filter"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Match notes by selected tags."})]}),e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:ie,children:"Remove"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{htmlFor:"view-section-tags",size:"sm",children:"Tag names"}),e.jsx(as,{id:"view-section-tags",value:S,onChange:r=>{z(r.target.value),I("")},placeholder:"@OceanBrain, @todo",size:"sm"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"You can use tags only, properties only, both together, or no filters."})]}),Y.length>1?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{size:"sm",children:"Tag match"}),e.jsxs(Ie,{type:"single",value:y,onValueChange:r=>{(r==="and"||r==="or")&&w(r)},variant:"quiet",size:"sm",className:"self-start",children:[e.jsx(de,{value:"and","aria-label":Ke("and"),children:"AND"}),e.jsx(de,{value:"or","aria-label":Ke("or"),children:"OR"})]}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"AND requires every selected tag. OR accepts any selected tag."})]}):null,e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(U,{size:"sm",children:"Existing tags"}),e.jsx(d,{as:"span",variant:"meta",tone:"tertiary",children:m?"Loading...":`${l.length} available`})]}),l.length>0?e.jsx("div",{className:"max-h-44 overflow-y-auto rounded-[16px] border border-border-subtle bg-hover-subtle/60 p-3",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(r=>{const f=Y.includes(r.name);return e.jsx("button",{type:"button",className:`inline-flex items-center rounded-full border px-3 py-1.5 text-sm font-medium transition-colors ${f?"border-border-secondary bg-elevated text-fg-default":"border-border-subtle bg-transparent text-fg-secondary hover:border-border-secondary hover:bg-elevated hover:text-fg-default"}`,"aria-pressed":f,onClick:()=>P(r.name),children:r.name},r.id)})})}):e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"No tags yet. You can still type tag names manually."})]}):null,e.jsx(d,{as:"p",variant:"meta",tone:ne?"default":"tertiary",className:ne?"text-fg-error":void 0,children:ne||(x||m?"Loading filter options...":`${n.length} properties · ${l.length} tags available`)})]}),e.jsxs("details",{className:"group pb-1",children:[e.jsx("summary",{className:"cursor-pointer list-none",children:e.jsxs("div",{className:"grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-1",children:[e.jsx(d,{as:"span",variant:"label",tone:"default",children:"Sort and page size"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"col-start-1 row-start-2",children:p==="board"?"Controls how many cards each board column loads at a time.":"Controls how many matching notes appear on each section page."}),e.jsx(d,{as:"span",variant:"meta",tone:"tertiary",className:"col-start-2 row-span-2 row-start-1 whitespace-nowrap",children:p==="board"?`${O} per column`:`${O} notes`})]})}),e.jsxs("div",{className:"mt-4 grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{id:"view-section-sort-by-label",htmlFor:"view-section-sort-by",size:"sm",children:"Sort by"}),e.jsxs(H,{id:"view-section-sort-by",value:T,"aria-labelledby":"view-section-sort-by-label",onValueChange:r=>M(r),children:[e.jsx(B,{value:"updatedAt",children:"Updated time"}),e.jsx(B,{value:"createdAt",children:"Created time"}),e.jsx(B,{value:"title",children:"Title"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{id:"view-section-sort-order-label",htmlFor:"view-section-sort-order",size:"sm",children:"Order"}),e.jsxs(H,{id:"view-section-sort-order",value:R,"aria-labelledby":"view-section-sort-order-label",onValueChange:r=>N(r),children:[e.jsx(B,{value:"desc",children:"Descending"}),e.jsx(B,{value:"asc",children:"Ascending"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{id:"view-section-limit-label",htmlFor:"view-section-limit",size:"sm",children:p==="board"?"Cards per load":"Rows per page"}),e.jsxs(H,{id:"view-section-limit",value:O,"aria-labelledby":"view-section-limit-label",onValueChange:A,children:[e.jsxs(B,{value:"3",children:["3 ",p==="board"?"cards":"rows"]}),e.jsxs(B,{value:"5",children:["5 ",p==="board"?"cards":"rows"]}),e.jsxs(B,{value:"8",children:["8 ",p==="board"?"cards":"rows"]}),e.jsxs(B,{value:"10",children:["10 ",p==="board"?"cards":"rows"]}),e.jsxs(B,{value:"12",children:["12 ",p==="board"?"cards":"rows"]})]})]})]})]})]})}),e.jsx(J.Footer,{children:e.jsxs(dt,{children:[e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:o,children:"Cancel"}),e.jsx($,{type:"submit",size:"sm",form:"view-section-form",children:s==="create"?"Create section":"Save section"})]})})]})}const ea="group flex h-10 max-w-[72vw] shrink-0 items-center rounded-[12px] border transition-[background-color,border-color,color,box-shadow] sm:max-w-[176px]",ta="focus-ring-soft inline-flex h-full min-w-0 flex-1 touch-pan-x items-center gap-1 rounded-[11px] px-3 text-[13px] font-medium outline-none transition-colors";function sa({tab:t,isActive:s,onSelect:a}){const{attributes:l,listeners:n,setNodeRef:m,setActivatorNodeRef:x,transform:o,transition:v,isDragging:j}=it({id:t.id});return e.jsx("div",{ref:m,style:{transform:Ae.Translate.toString(o),transition:v,opacity:j?.6:1},className:ee(ea,s?"border-border-secondary/80 bg-elevated text-fg-default shadow-[0_8px_18px_-18px_rgba(15,18,24,0.28)]":"border-transparent bg-transparent text-fg-secondary hover:border-border-subtle/80 hover:bg-hover-subtle hover:text-fg-default"),children:e.jsxs("button",{type:"button",ref:x,...l,...n,role:"tab","aria-selected":s,title:`${t.title}. Drag to reorder.`,className:ee(ta,s?"text-fg-default":"text-fg-secondary group-hover:text-fg-default",j?"cursor-grabbing":"cursor-pointer"),onClick:a,children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.title}),e.jsx("span",{className:"inline-flex min-w-4 shrink-0 items-center justify-center rounded-full bg-hover-subtle/75 px-1 py-0 text-[10px] leading-4 text-current/70",children:t.sections.length})]})})}function aa({tabs:t,activeTabId:s,onSelectTab:a,onReorderTabs:l,onCreateTab:n}){const m=ke(re(Vt,{activationConstraint:{distance:8}}),re(Te,{coordinateGetter:rt}));return e.jsx("div",{className:"-mx-1 rounded-[16px] border border-border-subtle/75 bg-subtle/50 p-1 sm:mx-0",children:e.jsx(Ce,{sensors:m,collisionDetection:Se,modifiers:[zt],autoScroll:!1,onDragEnd:x=>{l(x)},children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(nt,{items:t.map(x=>x.id),strategy:Et,children:e.jsx("div",{role:"tablist","aria-label":"Views tab list",className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto overflow-y-hidden",children:t.map(x=>e.jsx(sa,{tab:x,isActive:x.id===s,onSelect:()=>{a(x)}},x.id))})}),e.jsxs($,{type:"button","aria-label":"New view tab",variant:"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-[12px] border-transparent bg-transparent px-0 text-[13px] text-fg-secondary hover:border-border-subtle/80 hover:bg-hover-subtle hover:text-fg-default sm:w-auto sm:px-2.5",onClick:n,children:[e.jsx(we,{className:"h-5 w-5 shrink-0"}),e.jsx("span",{className:"hidden sm:inline",children:"New view tab"})]})]})})})}function ra({open:t,mode:s,initialTitle:a="",onClose:l,onSubmit:n}){const[m,x]=u.useState(a);return u.useEffect(()=>{t&&x(a)},[a,t]),e.jsxs(J,{isOpen:t,onClose:l,variant:"form",className:"sm:max-w-[480px]",children:[e.jsx(J.Header,{title:s==="create"?"Create view tab":"Rename view tab",onClose:l}),e.jsx(J.Body,{children:e.jsxs("form",{id:"view-tab-form",className:"flex flex-col gap-4",onSubmit:o=>{o.preventDefault(),n(m)},children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{htmlFor:"view-tab-title",size:"md",children:"Tab name"}),e.jsx(ve,{id:"view-tab-title",value:m,onChange:o=>x(o.target.value),placeholder:"Now",autoFocus:!0})]}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"Each tab is one saved view inside the Views page."})]})}),e.jsx(J.Footer,{children:e.jsxs(dt,{children:[e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:l,children:"Cancel"}),e.jsx($,{type:"submit",size:"sm",form:"view-tab-form",children:s==="create"?"Create tab":"Save tab"})]})})]})}const st=is(os),na="Save reusable note queries with tags, shared properties, and sorting.",ia="focus-ring-soft hidden h-8 w-8 items-center justify-center rounded-[10px] text-fg-default/70 outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default sm:inline-flex touch-none",la=({section:t,availableProperties:s,isPropertiesLoading:a,onEdit:l,onDuplicate:n,onDelete:m,onMoveUp:x,onMoveDown:o,navigationState:v,onNavigationStateChange:j})=>{const{attributes:k,listeners:p,setNodeRef:F,setActivatorNodeRef:h,transform:c,transition:g,isDragging:D}=it({id:t.id}),E=u.useCallback(V=>j(t.id,V),[j,t.id]);return e.jsx("div",{ref:F,style:{transform:Ae.Translate.toString(c),transition:g,opacity:D?.6:1},children:e.jsx(Gs,{section:t,availableProperties:s,isPropertiesLoading:a,onEdit:l,onDuplicate:n,onDelete:m,onMoveUp:x,onMoveDown:o,navigationState:v,onNavigationStateChange:E,dragHandle:e.jsx("button",{type:"button",ref:h,"aria-label":`Reorder section ${t.title}`,...k,...p,className:ee(ia,D?"cursor-grabbing":"cursor-grab"),children:e.jsx(lt,{className:"size-4"})})})})};function ja(){const t=Gt(),s=ut(),a=ct(),l=st.useSearch(),n=st.useNavigate(),[m,x]=u.useState(null),[o,v]=u.useState(null),{data:j,isPending:k,isError:p,refetch:F}=ue({queryKey:W.views.workspace(),async queryFn(){const i=await Rt();if(i.type==="error")throw i;return i.viewWorkspace}}),h=j??bs,c=h.tabs.find(i=>i.id===l.tab)??gs(h),g=c?h.tabs.findIndex(i=>i.id===c.id):-1,{data:D,isPending:E}=ue({queryKey:W.tags.list({limit:200}),async queryFn(){const i=await ls({limit:200});if(i.type==="error")throw i;return i.allTags}}),V=ke(re(at,{activationConstraint:{distance:8}}),re(Te,{coordinateGetter:rt})),S=D?.tags??[],{data:z,isPending:y}=ue({queryKey:W.notes.propertyKeys({limit:100}),async queryFn(){const i=await rs({limit:100});if(i.type==="error")throw i;return i.notePropertyKeys}}),w=z?.keys??[],T=i=>{a.setQueryData(W.views.workspace(),i)},M=u.useCallback((i,b)=>{n({search:P=>({...P,state:Ot(P.state,i,b)}),replace:!0,resetScroll:!1})},[n]),R=async()=>{await a.invalidateQueries({queryKey:W.views.all(),exact:!1})},N=async(i,b)=>{T(b);const P=await Wt(b.tabs.map(K=>K.id));if(P.type==="error"){T(i),s(P.errors[0].message);return}await R()},O=async({active:i,over:b})=>{if(!b||i.id===b.id)return;const P=a.getQueryData(W.views.workspace())??h,K=xt(P,String(i.id),String(b.id));await N(P,K)},A=async i=>{if(!c)return;const b=a.getQueryData(W.views.workspace())??h,P=fs(b,c.id,i);P!==b&&await N(b,P)},L=async i=>{const b=a.getQueryData(W.views.workspace())??h,P=l,K=ys(b,i.id);T(K),await n({search:{tab:i.id,state:void 0},resetScroll:!1});const ie=await ze(i.id);if(ie.type==="error"){T(b),await n({search:P,replace:!0,resetScroll:!1}),s(ie.errors[0].message);return}T(ie.setActiveViewTab)},G=async(i,b)=>{if(!c)return;T(b);const P=await Ut(c.id,b.tabs.find(K=>K.id===c.id)?.sections.map(K=>K.id)??[]);if(P.type==="error"){T(i),s(P.errors[0].message);return}await R()},he=async({active:i,over:b})=>{if(!c||!b||i.id===b.id)return;const P=a.getQueryData(W.views.workspace())??h,K=gt(P,c.id,String(i.id),String(b.id));await G(P,K)},te=async(i,b)=>{if(!c)return;const P=a.getQueryData(W.views.workspace())??h,K=vs(P,c.id,i,b);K!==P&&await G(P,K)},ne=async i=>{const b=await $t(i);if(b.type==="error"){s(b.errors[0].message);return}const P=await ze(b.createViewTab.id);P.type==="success"?T(P.setActiveViewTab):s(P.errors[0].message),await R(),await n({search:{tab:b.createViewTab.id,state:void 0},resetScroll:!1}),x(null)},I=async i=>{if(!c)return;const b=await Lt(c.id,i);if(b.type==="error"){s(b.errors[0].message);return}await R(),x(null)},X=async()=>{if(!c||!await t("Delete this view tab and all of its sections?"))return;const i=await Kt(c.id);if(i.type==="error"){s(i.errors[0].message);return}await R(),await n({search:{tab:void 0,state:void 0},replace:!0,resetScroll:!1})},Y=async i=>{if(!c)return;const b=await Re(c.id,i);if(b.type==="error"){s(b.errors[0].message);return}await R(),v(null)},se=async i=>{if(!c||!o||o.mode!=="edit")return;const b=await _t(o.section.id,i);if(b.type==="error"){s(b.errors[0].message);return}M(o.section.id,{}),await R(),v(null)},be=async i=>{const b=await Re(i.tabId,{...ks(i),title:`${i.title} copy`});if(b.type==="error"){s(b.errors[0].message);return}await R(),s("Section duplicated.")},ae=async i=>{if(!c||!await t("Delete this section from the current view tab?"))return;const b=await qt(i);if(b.type==="error"){s(b.errors[0].message);return}M(i,{}),await R()};return e.jsxs(e.Fragment,{children:[e.jsx(ns,{title:"Views",description:na,children:k&&!j?e.jsx(je,{className:"px-6 py-8 sm:px-8 sm:py-10",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(ce,{height:20,width:180,className:"rounded-full"}),e.jsx(ce,{height:16,width:260,className:"rounded-full"}),e.jsx(ce,{height:44,width:140,className:"rounded-[12px]"})]})}):p?e.jsxs(je,{className:"px-6 py-8 sm:px-8 sm:py-10",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"Failed to load saved views"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Retry loading your saved view tabs."}),e.jsx("div",{className:"mt-4",children:e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:()=>{F()},children:"Retry"})})]}):h.tabs.length===0?e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx($e,{title:"Create your first view tab",description:"Start with a saved view tab, then add sections that query notes by tags, properties, or both.",className:"h-[320px]"}),e.jsx("div",{className:"flex justify-center",children:e.jsxs($,{type:"button",onClick:()=>x({mode:"create"}),children:[e.jsx(we,{className:"h-4 w-4"}),"Create first tab"]})})]}):e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsx(aa,{tabs:h.tabs,activeTabId:c?.id??null,onSelectTab:L,onReorderTabs:O,onCreateTab:()=>x({mode:"create"})}),c&&e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{className:"flex flex-col gap-3 border-b border-border-subtle/80 px-1 pb-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(d,{as:"h2",variant:"subheading",weight:"semibold",tracking:"tight",truncate:!0,children:c.title}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:c.sections.length>0?`${c.sections.length} section${c.sections.length===1?"":"s"} in this view`:"Add sections to build this view"})]}),e.jsxs("div",{className:"inline-flex flex-wrap items-center gap-2 self-start sm:self-center",children:[e.jsxs($,{type:"button",size:"sm",onClick:()=>v({mode:"create"}),children:[e.jsx(we,{className:"h-4 w-4"}),"Add section"]}),e.jsx(Ee,{button:e.jsx(Pe,{label:"View tab actions"}),items:[...g>0?[{name:"Move tab left",onClick:()=>{A("previous")}}]:[],...g>=0&&g<h.tabs.length-1?[{name:"Move tab right",onClick:()=>{A("next")}}]:[],...h.tabs.length>1?[{type:"separator"}]:[],{name:"Rename tab",onClick:()=>x({mode:"edit",tab:c})},{type:"separator"},{name:"Delete tab",onClick:()=>{X()}}]})]})]}),c.sections.length===0?e.jsx($e,{title:"Add the first section to this tab",description:"Sections can pull notes by tags, properties, or both.",className:"h-[300px]"}):e.jsx("div",{className:"flex flex-col",children:e.jsx(Ce,{sensors:V,collisionDetection:Se,modifiers:[It],onDragEnd:he,children:e.jsx(nt,{items:c.sections.map(i=>i.id),strategy:Dt,children:e.jsx("div",{className:"flex flex-col gap-4",children:c.sections.map((i,b)=>e.jsx(la,{section:i,availableProperties:w,isPropertiesLoading:y,navigationState:Bt(l.state,i.id),onNavigationStateChange:M,onEdit:()=>v({mode:"edit",section:i}),onDuplicate:()=>{be(i)},onDelete:()=>{ae(i.id)},onMoveUp:b>0?()=>{te(i.id,"previous")}:void 0,onMoveDown:b<c.sections.length-1?()=>{te(i.id,"next")}:void 0},i.id))})})})})]})]})}),e.jsx(ra,{open:m!==null,mode:m?.mode??"create",initialTitle:m?.mode==="edit"?m.tab.title:"",onClose:()=>x(null),onSubmit:i=>{if(m?.mode==="edit"){I(i);return}ne(i)}}),e.jsx(Xs,{open:o!==null,mode:o?.mode??"create",initialSection:o?.mode==="edit"?o.section:null,availableTags:S,availableProperties:w,isTagsLoading:E,isPropertiesLoading:y,onClose:()=>v(null),onSubmit:i=>{if(o?.mode==="edit"){se(i);return}Y(i)}})]})}export{ja as default};
|
|
1
|
+
import{r as u,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{u as ke,a as re,K as Te,P as at,D as Ce,c as Se,b as At,d as Pt,C as Ae,s as rt,M as Vt,S as nt,h as Et,e as it,v as Dt}from"./sortable.esm-DgSW3bAA.js";import{g as Ft,m as lt,h as Mt,r as zt,j as Rt,u as Ot,k as It,l as Bt,n as ze,o as $t,p as Lt,q as Kt,t as Re,v as _t,w as qt,x as Wt,y as Ut}from"./app-CyQtGTtn.js";import{j as Qt,f as Pe,m as ot,a as ue,M as dt,u as Gt}from"./useNoteMutate-xEIypxi5.js";import{a3 as Yt,a4 as Oe,a5 as Zt,a6 as Ht,a7 as Jt,C as Xt,u as ct,q as W,W as es,e as ut,T as d,l as ce,B as $,c as ee,F as Ve,N as fe,K as Ee,m as mt,a8 as ts,k as ss,M as J,L as U,I as ve,a as Ie,b as de,J as Be,y as H,z as B,d as as,t as rs,P as ns,E as $e,h as is}from"./time-DI902Sxa.js";import{f as ls}from"./tag.api-BJ6eaHui.js";import{S as je}from"./SurfaceCard-D_OU_Oy6.js";import{V as Q}from"./ViewChip-D-Ax5PdL.js";import{N as De,V as os}from"./url-BvjSC8PU.js";import{s as ds}from"./ArrowRight.es-CD1IMhU2.js";import{s as cs}from"./CheckCircle.es-C7fkzE3t.js";import{n as we}from"./Plus.es-P9Fjwtud.js";import"./preload-helper-BXl3LOEh.js";var us=class extends Yt{constructor(t,s){super(t,s)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:Oe()})}getOptimisticResult(t){return t.behavior=Oe(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,s){const{state:a}=t,l=super.createResult(t,s),{isFetching:n,isRefetching:m,isError:x,isRefetchError:o}=l,v=a.fetchMeta?.fetchMore?.direction,j=x&&v==="forward",k=n&&v==="forward",p=x&&v==="backward",F=n&&v==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Ht(s,a.data),hasPreviousPage:Zt(s,a.data),isFetchNextPageError:j,isFetchingNextPage:k,isFetchPreviousPageError:p,isFetchingPreviousPage:F,isRefetchError:o&&!j&&!p,isRefetching:m&&!k&&!F}}};function ms(t,s){return Jt(t,us)}const ps=new Map([["bold",u.createElement(u.Fragment,null,u.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Z"}))],["duotone",u.createElement(u.Fragment,null,u.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),u.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z"}))],["fill",u.createElement(u.Fragment,null,u.createElement("path",{d:"M232,128A104,104,0,1,1,128,24,104.13,104.13,0,0,1,232,128Z"}))],["light",u.createElement(u.Fragment,null,u.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Z"}))],["regular",u.createElement(u.Fragment,null,u.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z"}))],["thin",u.createElement(u.Fragment,null,u.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Z"}))]]),pt=u.forwardRef((t,s)=>u.createElement(Xt,{ref:s,...t,weights:ps}));pt.displayName="CircleIcon";const hs=pt,me=6,Ne=["title","tags","properties","createdAt","updatedAt"],bs={activeTabId:null,tabs:[]},xs=t=>{const s=t.trim();return s?s.startsWith("@")?s:s.startsWith("#")?"":`@${s}`:""},ht=(t,s,a)=>{if(s===a)return t;const l=t.findIndex(o=>o.id===s),n=t.findIndex(o=>o.id===a);if(l<0||n<0)return t;const m=[...t],[x]=m.splice(l,1);return m.splice(n,0,x),m},bt=(t,s,a)=>{const l=t.findIndex(m=>m.id===s),n=l+(a==="previous"?-1:1);return l>=0&&n>=0&&n<t.length?t[n]?.id:void 0},Le=t=>{const s=t.flatMap(a=>typeof a=="string"?a.split(","):[]);return Array.from(new Set(s.map(xs).filter(Boolean)))},gs=t=>t.tabs.length===0?null:t.activeTabId?t.tabs.find(s=>s.id===t.activeTabId)??t.tabs[0]??null:t.tabs[0]??null,ys=(t,s)=>t.tabs.some(a=>a.id===s)?{...t,activeTabId:s}:t,xt=(t,s,a)=>({...t,tabs:ht(t.tabs,s,a)}),gt=(t,s,a,l)=>({...t,tabs:t.tabs.map(n=>n.id===s?{...n,sections:ht(n.sections,a,l)}:n)}),fs=(t,s,a)=>{const l=bt(t.tabs,s,a);return l?xt(t,s,l):t},vs=(t,s,a,l)=>{const n=t.tabs.find(x=>x.id===s)?.sections??[],m=bt(n,a,l);return m?gt(t,s,a,m):t},Ke=t=>t==="or"?"OR — any selected tag":"AND — all selected tags",js=t=>t==="or"?"OR":"AND",yt=t=>{switch(t){case"notEquals":return"is not";case"contains":return"contains";case"notContains":return"does not contain";case"before":return"before";case"after":return"after";case"exists":return"is set";case"notExists":return"is empty";default:return"is"}},ws=t=>{switch(t){case"table":return"Table";case"board":return"Board";case"calendar":return"Unavailable";default:return"List"}},ft=t=>{switch(t){case"tags":return"Tags";case"properties":return"Properties";case"createdAt":return"Created";case"updatedAt":return"Updated";default:return"Title"}},pe=t=>{const s=new Set(Ne),a=(t??[]).filter(n=>s.has(n)),l=Array.from(new Set(a));return l.length===0?[...Ne]:l.includes("title")?l:["title",...l]},Fe=t=>Array.from(new Set((t??[]).map(s=>s.trim()).filter(Boolean))).slice(0,me),vt=t=>({tableColumns:pe(t?.tableColumns),tablePropertyKeys:Fe(t?.tablePropertyKeys),boardGroupByPropertyKey:t?.boardGroupByPropertyKey?.trim()||null}),Ns=t=>{const s=yt(t.operator);return t.operator==="exists"||t.operator==="notExists"?`${t.name} ${s}`:`${t.name} ${s} ${t.value??""}`.trim()},ks=(t,s={})=>{const a={...t,...s};return{title:a.title,displayType:a.displayType,displayOptions:vt(a.displayOptions),tagNames:a.tagNames,mode:a.mode,propertyFilters:a.propertyFilters.map(l=>({key:l.key,valueType:l.valueType,operator:l.operator,value:l.value})),sortBy:a.sortBy,sortOrder:a.sortOrder,limit:a.limit}},jt="view-board-column:unassigned",Ts=t=>t===null?jt:`view-board-column:value:${encodeURIComponent(t)}`,Cs=t=>[...[...t].sort((s,a)=>s.order-a.order||s.label.localeCompare(a.label)).map(s=>({id:Ts(s.value),label:s.label,value:s.value,color:s.color??null})),{id:jt,label:"Unassigned",value:null,color:null}];function Ss({note:t,column:s,columns:a,isMoving:l,onMove:n}){const{attributes:m,listeners:x,setNodeRef:o,setActivatorNodeRef:v,transform:j,isDragging:k}=Pt({id:`view-board-note:${t.id}`,data:{note:t,sourceValue:s.value},disabled:l});return e.jsx("article",{ref:o,style:{transform:Ae.Translate.toString(j)},className:ee("group rounded-[14px] border border-border-subtle bg-elevated px-3 py-2.5 transition-[opacity,background-color,border-color] hover:border-border-secondary/80 hover:bg-hover-subtle/35",(k||l)&&"opacity-55",k&&"z-20 border-accent-primary/45 bg-elevated ring-2 ring-accent-primary/10"),children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("button",{type:"button",ref:v,"aria-label":`Drag ${t.title||"Untitled"} to another column`,...m,...x,className:"focus-ring-soft mt-0.5 hidden size-7 shrink-0 touch-none items-center justify-center rounded-[9px] text-fg-tertiary outline-none hover:bg-hover-subtle hover:text-fg-default sm:inline-flex",children:e.jsx(lt,{className:"size-3.5"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(d,{as:"div",variant:"body",weight:"semibold",tracking:"tight",className:"leading-[1.4]",children:e.jsx(Ve,{to:De,params:{id:t.id},className:"line-clamp-2 transition-colors hover:text-fg-default/80",children:t.title||"Untitled"})}),e.jsxs(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-2",children:["Updated ",fe(Number(t.updatedAt))]})]}),e.jsx(Ee,{button:e.jsx(Pe,{label:`Move ${t.title||"Untitled"}`,size:"sm"}),items:a.filter(p=>p.value!==s.value).map(p=>({name:`Move to ${p.label}`,onClick:()=>n(t,s.value,p.value)}))})]})})}function As({section:t,groupProperty:s,column:a,columns:l,index:n,scrollRootRef:m,movingNoteIds:x,onMove:o,pageCount:v,onPageCountChange:j}){const k=u.useRef(null),[p,F]=u.useState(n<4),{isOver:h,setNodeRef:c}=At({id:a.id,data:{optionValue:a.value}});u.useEffect(()=>{if(p||!k.current)return;if(typeof IntersectionObserver>"u"){F(!0);return}const N=new IntersectionObserver(O=>{O.some(A=>A.isIntersecting)&&(F(!0),N.disconnect())},{root:m.current,rootMargin:"0px 320px",threshold:.01});return N.observe(k.current),()=>N.disconnect()},[m,p]);const{data:g,isPending:D,isError:E,refetch:V,fetchNextPage:S,hasNextPage:z,isFetchingNextPage:y,isFetchNextPageError:w}=ms({queryKey:W.views.sectionBoardColumnPages(t.id,s.key,a.value,t.limit),enabled:p,initialPageParam:0,async queryFn({pageParam:N}){const O=await Ft(t.id,{optionValue:a.value,limit:t.limit,offset:N});if(O.type==="error")throw O;return O.viewSectionBoardColumn},getNextPageParam(N,O){return O.reduce((L,G)=>L+G.notes.length,0)<N.totalCount?O.length*t.limit:void 0}}),T=u.useMemo(()=>Array.from(new Map((g?.pages??[]).flatMap(N=>N.notes).map(N=>[N.id,N])).values()),[g?.pages]),M=g?.pages[0]?.totalCount;u.useEffect(()=>{!p||!g||g.pages.length>=v||!z||y||w||S()},[g,S,z,w,y,v,p]),u.useEffect(()=>{if(M===void 0)return;const N=Math.max(1,Math.ceil(M/t.limit));v>N&&j(N)},[j,v,t.limit,M]);const R=N=>{k.current=N,c(N)};return e.jsxs("section",{ref:R,"aria-label":`${a.label} column`,className:ee("flex min-h-[248px] w-[17rem] shrink-0 flex-col rounded-[18px] border bg-subtle/30 transition-[border-color,background-color] sm:w-[18rem]",h?"border-accent-primary/50 bg-accent-primary/6":"border-border-subtle"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border-subtle/75 px-3.5 py-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"size-2.5 shrink-0 rounded-full border border-black/5",style:{backgroundColor:a.color??"var(--color-fg-tertiary)"},"aria-hidden":"true"}),e.jsx(d,{as:"h3",variant:"label",weight:"semibold",className:"truncate",children:a.label})]}),e.jsx(d,{as:"span",variant:"meta",tone:"tertiary","aria-label":M===void 0?"Card count loading":`${M} cards`,className:"inline-flex min-w-6 justify-center rounded-full bg-elevated px-2 py-0.5 tabular-nums",children:M??"–"})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-2 p-2.5",children:[p?D&&!g?e.jsxs(e.Fragment,{children:[e.jsx(ce,{height:"76px",className:"rounded-[14px]"}),e.jsx(ce,{height:"76px",className:"rounded-[14px]"})]}):E?e.jsxs("div",{className:"rounded-[14px] border border-dashed border-border-subtle bg-elevated/60 p-3",children:[e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"Failed to load this column."}),e.jsx($,{type:"button",variant:"ghost",size:"sm",className:"mt-2",onClick:()=>{V()},children:"Retry"})]}):T.length===0?e.jsx("div",{className:"flex min-h-28 items-center justify-center rounded-[14px] border border-dashed border-border-subtle px-3 text-center",children:e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"Drop a note here"})}):T.map(N=>e.jsx(Ss,{note:N,column:a,columns:l,isMoving:x.has(N.id),onMove:o},N.id)):e.jsx("button",{type:"button",className:"focus-ring-soft flex min-h-28 items-center justify-center rounded-[14px] border border-dashed border-border-subtle px-3 text-sm text-fg-tertiary outline-none hover:bg-elevated",onClick:()=>F(!0),children:"Load cards"}),z?e.jsx($,{type:"button",variant:"ghost",size:"sm",className:"mt-auto w-full",disabled:y,onClick:()=>{w||j(v+1),S()},children:y?"Loading...":w?"Retry loading cards":`Load more (${Math.max(0,(M??0)-T.length)})`}):null]})]})}function Ps({section:t,groupProperty:s,navigationState:a={},onNavigationStateChange:l=()=>{}}){const n=ct(),m=ut(),x=u.useRef(null),[o,v]=u.useState(()=>new Set),j=u.useMemo(()=>Cs(s.options),[s.options]),k=ke(re(at,{activationConstraint:{distance:6}}),re(Te)),p=u.useCallback(async(h,c,g)=>{if(c===g||o.has(h.id))return;v(V=>new Set(V).add(h.id));const D=W.views.sectionBoardAll(t.id),E=n.getQueriesData({queryKey:D});for(const[V,S]of E){if(!S||!Array.isArray(S.pages))continue;const z=V[3];if(z?.groupPropertyKey!==s.key)continue;const y=z.optionValue===c,w=z.optionValue===g,T=z.pageSize??t.limit;let M=S.pages.flatMap(N=>N.notes).filter(N=>N.id!==h.id);w&&(M=[h,...M]);const R=Math.max(0,(S.pages[0]?.totalCount??0)-(y?1:0)+(w?1:0));n.setQueryData(V,{...S,pages:S.pages.map((N,O)=>({totalCount:R,notes:M.slice(O*T,(O+1)*T)}))})}try{const V=await es({id:h.id,expectedUpdatedAt:h.updatedAt,...g===null?{deleteKeys:[s.key]}:{set:[{key:s.key,name:s.name,value:g,valueType:"select"}]}});if(V.type==="error"){for(const[S,z]of E)n.setQueryData(S,z);m(V.errors[0]?.message??"Failed to move this note.");return}await Promise.all([Qt(n),n.invalidateQueries({queryKey:W.notes.propertyKeysAll(),exact:!1})])}catch{for(const[V,S]of E)n.setQueryData(V,S);m("Failed to move this note.")}finally{v(V=>{const S=new Set(V);return S.delete(h.id),S})}},[s.key,s.name,o,n,t.id,t.limit,m]),F=({active:h,over:c})=>{const g=h.data.current?.note,D=h.data.current?.sourceValue,E=c?.data.current?.optionValue;!g||D===void 0||E===void 0||p(g,D,E)};return e.jsx(Ce,{sensors:k,collisionDetection:Se,onDragEnd:F,children:e.jsx("div",{ref:x,"data-scroll-restoration-id":`view-board-${t.id}`,className:"overflow-x-auto overscroll-x-contain px-3 py-3.5 [scrollbar-gutter:stable] sm:px-4","aria-label":`Board grouped by ${s.name}`,children:e.jsx("div",{className:"flex min-w-max items-stretch gap-3 pb-1",children:j.map((h,c)=>e.jsx(As,{section:t,groupProperty:s,column:h,columns:j,index:c,scrollRootRef:x,movingNoteIds:o,pageCount:a.columns?.[h.id]??1,onPageCountChange:g=>l(D=>({...D,columns:{...D.columns,[h.id]:g}})),onMove:(g,D,E)=>{p(g,D,E)}},h.id))})})})}const Vs="group flex min-h-[72px] items-center justify-between gap-3 px-4 py-3 transition-colors hover:bg-hover-subtle",Es=t=>t.valueType==="select"?t.option?.label??t.value:t.valueType==="boolean"?t.value==="true"?"True":"False":t.value,Ds=t=>{const s=t.tags.slice(0,2),a=t.tags.length-s.length;return s.length===0?null:e.jsxs(e.Fragment,{children:[s.map(l=>e.jsx(Q,{size:"compact",className:"max-w-[116px] shrink-0 border-border-subtle bg-transparent text-fg-secondary",children:l.name},l.id)),a>0&&e.jsxs(Q,{size:"compact",className:"shrink-0 border-border-subtle bg-subtle text-fg-tertiary",children:["+",a]})]})},Fs=t=>{const s=t.properties??[],a=s.slice(0,2),l=s.length-a.length;return a.length===0?null:e.jsxs(e.Fragment,{children:[a.map(n=>e.jsxs(Q,{size:"compact",truncateContent:!1,className:"max-w-[220px] gap-1.5 border-border-subtle bg-subtle/55 text-fg-secondary",children:[n.valueType==="select"?e.jsx("span",{className:"size-2 shrink-0 rounded-full border border-black/5",style:{backgroundColor:n.option?.color??"var(--color-fg-tertiary)"},"aria-hidden":"true"}):null,e.jsx("span",{className:"max-w-[72px] shrink truncate text-fg-tertiary",children:n.name}),e.jsx("span",{className:"min-w-0 truncate",children:Es(n)||"—"})]},n.key)),l>0?e.jsxs(Q,{size:"compact",className:"shrink-0 border-border-subtle bg-subtle text-fg-tertiary",children:["+",l," properties"]}):null]})};function Ms({notes:t,isPending:s,isError:a,onRetry:l}){return s?e.jsxs("div",{className:"overflow-hidden bg-transparent",children:[e.jsx("div",{className:"h-[72px] animate-pulse bg-subtle/35"}),e.jsx("div",{className:"h-[72px] animate-pulse border-t border-border-subtle/70 bg-subtle/35"}),e.jsx("div",{className:"h-[72px] animate-pulse border-t border-border-subtle/70 bg-subtle/35"})]}):a?e.jsxs("div",{className:"rounded-[16px] border border-border-subtle bg-subtle/30 p-4",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"Failed to load this section"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Retry to refresh this saved query."}),e.jsx("div",{className:"mt-3",children:e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:l,children:"Retry"})})]}):t.length===0?e.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle px-4 py-5",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"No notes match yet"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Add matching notes, or edit this view query."})]}):e.jsx("div",{className:"divide-y divide-border-subtle/70 bg-transparent",children:t.map(n=>e.jsxs(Ve,{to:De,params:{id:n.id},className:Vs,children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.pinned?e.jsx(ot,{className:"size-3.5 shrink-0 text-fg-tertiary",weight:"fill","aria-label":"Pinned"}):null,e.jsx(d,{as:"div",variant:"body",weight:"semibold",tracking:"tight",className:"line-clamp-1",children:n.title||"Untitled"})]}),e.jsxs("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5",children:[Fs(n),Ds(n),e.jsxs(d,{as:"span",variant:"label",weight:"medium",tone:"tertiary",className:"sm:hidden",children:["Updated ",fe(Number(n.updatedAt))]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2 pl-2",children:[e.jsx(d,{as:"span",variant:"label",weight:"medium",tone:"tertiary",className:"hidden sm:inline",children:fe(Number(n.updatedAt))}),e.jsx(ds,{className:"size-4 text-fg-tertiary transition-transform group-hover:translate-x-0.5"})]})]},n.id))})}const zs={title:300,tags:200,createdAt:148,updatedAt:148},Rs={title:"title",createdAt:"createdAt",updatedAt:"updatedAt"},Os="flex h-[24px] min-w-0 max-w-full items-center gap-1.5 overflow-hidden whitespace-nowrap",wt="text-xs leading-5 text-fg-tertiary",Is=t=>mt(Number(t)).format("MMM D, YYYY"),Bs=t=>t==="text"||t==="url"?220:t==="date"?168:156,Nt=t=>t.kind==="property"?Bs(t.valueType):zs[t.key],$s=(t,s,a)=>{const l=new Map(a.map(o=>[o.key,o])),n=new Map(s.flatMap(o=>o.properties??[]).map(o=>[o.key,o])),m=Fe(t.displayOptions.tablePropertyKeys),x=Array.from(new Set([...t.propertyFilters.map(o=>o.key),...s.flatMap(o=>(o.properties??[]).map(v=>v.key))])).slice(0,3);return(m.length>0?m:x).flatMap(o=>{const v=l.get(o),j=n.get(o);return!v&&!j?[]:[{kind:"property",key:o,name:v?.name??j?.name??o,valueType:v?.valueType??j?.valueType??"text"}]})},Ls=(t,s,a)=>{const l=$s(t,s,a);return pe(t.displayOptions.tableColumns).reduce((n,m)=>(m==="properties"?n.push(...l):n.push({kind:"base",key:m}),n),[])},Ks=t=>t.reduce((s,a)=>s+Nt(a),0),_s=t=>{if(t.tags.length===0)return e.jsx("span",{className:wt,children:"—"});const s=t.tags.slice(0,3),a=t.tags.length-s.length;return e.jsxs("div",{className:Os,children:[s.map(l=>e.jsx(Q,{size:"compact",className:"max-w-[132px] shrink-0 border-border-subtle bg-transparent text-fg-secondary",children:l.name},l.id)),a>0?e.jsxs(Q,{size:"compact",className:"shrink-0 border-border-subtle bg-subtle text-fg-tertiary",children:["+",a]}):null]})},qs=t=>{if(!t)return e.jsx("span",{className:wt,children:"—"});if(t.valueType==="select")return e.jsx(Q,{size:"compact",className:"max-w-full border-border-subtle bg-subtle/65 text-fg-secondary",truncateContent:!1,children:e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"size-2 shrink-0 rounded-full border border-black/5",style:{backgroundColor:t.option?.color??"var(--color-fg-tertiary)"},"aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 truncate",children:t.option?.label??t.value})]})});if(t.valueType==="boolean"){const s=t.value==="true",a=s?cs:hs;return e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-sm text-fg-secondary",children:[e.jsx(a,{className:"size-3.5 text-fg-tertiary",weight:s?"fill":"regular"}),s?"True":"False"]})}return e.jsx("span",{className:ee("block truncate text-sm text-fg-secondary",t.valueType==="number"&&"tabular-nums"),title:t.value,children:t.value||"—"})};function Ws({section:t,notes:s,isPending:a,isError:l,onRetry:n,onSortChange:m,isSortPending:x,activeSortBy:o=t.sortBy,activeSortOrder:v=t.sortOrder,availableProperties:j=[],surface:k="flush"}){const p=Ls(t,s,j),F=Ks(p),h=k==="card"?"overflow-x-auto rounded-[16px] border border-border-subtle bg-elevated":"overflow-x-auto bg-transparent",c=k==="card"?"overflow-hidden rounded-[16px] border border-border-subtle bg-elevated":"overflow-hidden bg-transparent",g=k==="card"?"bg-elevated":"bg-transparent",D=k==="card"?"bg-subtle/65":"bg-subtle/45",E=k==="card"?"bg-elevated":"bg-transparent",V=k==="card"?"var(--elevated)":"var(--surface)",S=y=>{if(y.kind==="property")return e.jsxs("th",{className:"px-3 py-2 text-left",children:[e.jsx(d,{as:"p",variant:"label",weight:"semibold",className:"truncate",title:y.name,children:y.name}),e.jsx(d,{as:"p",variant:"micro",tone:"tertiary",className:"mt-0.5 capitalize",children:y.valueType})]},`property:${y.key}`);const w=Rs[y.key],T=ft(y.key),M=w?o===w:!1,R=y.key==="title";return e.jsx("th",{"aria-sort":M?v==="asc"?"ascending":"descending":void 0,className:ee("px-3 py-2.5 text-xs font-semibold text-fg-tertiary",R&&"lg:sticky lg:left-0 lg:z-20"),style:R?{background:`linear-gradient(var(--subtle), var(--subtle)), ${V}`}:void 0,children:w?e.jsxs("button",{type:"button",className:"focus-ring-soft -ml-1 inline-flex items-center gap-1 rounded-[8px] px-1 py-0.5 outline-none transition-colors hover:bg-hover-subtle hover:text-fg-secondary disabled:cursor-wait disabled:opacity-60",disabled:x,onClick:()=>m(w),children:[e.jsx("span",{children:T}),e.jsx("span",{"aria-hidden":"true",className:"text-[10px] text-fg-tertiary",children:M?v==="asc"?"↑":"↓":"↕"})]}):T},y.key)},z=(y,w)=>{if(w.kind==="property")return e.jsx("td",{className:"overflow-hidden px-3 py-2.5 align-middle transition-colors group-hover:bg-hover-subtle",children:qs(y.properties?.find(T=>T.key===w.key))},`property:${w.key}`);switch(w.key){case"tags":return e.jsx("td",{className:"overflow-hidden px-3 py-2.5 align-middle transition-colors group-hover:bg-hover-subtle",children:_s(y)},w.key);case"createdAt":case"updatedAt":{const T=w.key==="createdAt"?y.createdAt:y.updatedAt;return e.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 align-middle transition-colors group-hover:bg-hover-subtle",children:e.jsx(d,{as:"span",variant:"meta",tone:"tertiary",title:mt(Number(T)).format("MMM D, YYYY h:mm A"),children:Is(T)})},w.key)}default:return e.jsxs("td",{className:"relative px-3 py-2.5 align-middle lg:sticky lg:left-0 lg:z-10",style:{background:V},children:[e.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 bg-hover-subtle opacity-0 transition-opacity group-hover:opacity-100"}),e.jsxs("div",{className:"relative z-10 flex min-w-0 items-center gap-2",children:[y.pinned?e.jsx(ot,{className:"size-3.5 shrink-0 text-fg-tertiary",weight:"fill","aria-label":"Pinned"}):null,e.jsx(d,{as:"div",variant:"body",weight:"semibold",className:"min-w-0 line-clamp-1",children:e.jsx(Ve,{to:De,params:{id:y.id},className:"focus-ring-soft rounded-[6px] outline-none transition-colors hover:text-fg-default/80",children:y.title||"Untitled"})})]})]},w.key)}};return a?e.jsxs("div",{className:c,children:[e.jsx("div",{className:"h-11 animate-pulse bg-subtle/50"}),e.jsx("div",{className:`h-14 animate-pulse border-t border-border-subtle ${g}`}),e.jsx("div",{className:`h-14 animate-pulse border-t border-border-subtle ${g}`}),e.jsx("div",{className:`h-14 animate-pulse border-t border-border-subtle ${g}`})]}):l?e.jsxs("div",{className:"rounded-[16px] border border-border-subtle bg-subtle/30 p-4",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"Failed to load this table"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Retry to refresh this saved query."}),e.jsx("div",{className:"mt-3",children:e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:n,children:"Retry"})})]}):s.length===0?e.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle px-4 py-5",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"No rows yet"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Add matching notes, or edit this view query."})]}):e.jsx("div",{className:h,"data-scroll-restoration-id":`view-table-${t.id}`,"aria-label":"Scrollable view table",children:e.jsxs("table",{className:"w-full table-fixed border-collapse text-left",style:{minWidth:F},children:[e.jsx("caption",{className:"sr-only",children:"View query results as a table"}),e.jsx("colgroup",{children:p.map(y=>e.jsx("col",{style:{width:`${Nt(y)/F*100}%`}},y.kind==="property"?`property:${y.key}`:y.key))}),e.jsx("thead",{className:D,children:e.jsx("tr",{className:"border-b border-border-subtle",children:p.map(S)})}),e.jsx("tbody",{className:E,children:s.map(y=>e.jsx("tr",{className:"group h-12 border-b border-border-subtle/70 last:border-b-0",children:p.map(w=>z(y,w))},y.id))})]})})}function Us({onEdit:t}){return e.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle bg-subtle/40 px-4 py-5",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"This display type is unavailable"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Switch this section to List, Table, or Board to show the saved query here."}),e.jsx("div",{className:"mt-3",children:e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:t,children:"Change display"})})]})}function Qs({section:t,notes:s,isPending:a,isError:l,onRetry:n,onEdit:m,onSortChange:x,isSortPending:o,activeSortBy:v=t.sortBy,activeSortOrder:j=t.sortOrder,availableProperties:k=[],isPropertiesLoading:p=!1,navigationState:F={},onNavigationStateChange:h=()=>{}}){if(t.displayType==="board"){const c=k.find(g=>g.key===t.displayOptions.boardGroupByPropertyKey&&g.valueType==="select");return!c&&p?e.jsxs("div",{className:"flex gap-3 overflow-hidden px-4 py-3.5",children:[e.jsx("div",{className:"h-[248px] w-[18rem] shrink-0 animate-pulse rounded-[18px] bg-subtle/50"}),e.jsx("div",{className:"h-[248px] w-[18rem] shrink-0 animate-pulse rounded-[18px] bg-subtle/50"}),e.jsx("div",{className:"h-[248px] w-[18rem] shrink-0 animate-pulse rounded-[18px] bg-subtle/50"})]}):!c||c.options.length===0?e.jsxs("div",{className:"m-4 rounded-[16px] border border-dashed border-border-subtle bg-subtle/40 px-4 py-5",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"Board grouping is unavailable"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Choose an existing select property with options to restore this board."}),e.jsx("div",{className:"mt-3",children:e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:m,children:"Edit board"})})]}):e.jsx(Ps,{section:t,groupProperty:c,navigationState:F,onNavigationStateChange:h})}return t.displayType==="table"?e.jsx(Ws,{section:t,notes:s,isPending:a,isError:l,onRetry:n,onSortChange:x,isSortPending:o,activeSortBy:v,activeSortOrder:j,availableProperties:k}):t.displayType==="calendar"?e.jsx(Us,{onEdit:m}):e.jsx(Ms,{notes:s,isPending:a,isError:l,onRetry:n})}function Gs({section:t,onEdit:s,onDuplicate:a,onDelete:l,onMoveUp:n,onMoveDown:m,dragHandle:x,availableProperties:o=[],isPropertiesLoading:v=!1,navigationState:j={},onNavigationStateChange:k=()=>{}}){const p=t.displayType==="board",F=j.page??1,h=(F-1)*t.limit,c=j.sort?.by??t.sortBy,g=j.sort?.order??t.sortOrder,{data:D,isPending:E,isError:V,isPlaceholderData:S,refetch:z}=ue({queryKey:W.views.sectionNotes(t.id,{limit:t.limit,offset:h,sortBy:c,sortOrder:g}),enabled:!p,placeholderData:ts,async queryFn(){const A=await Mt(t.id,{limit:t.limit,offset:h,sortBy:c,sortOrder:g});if(A.type==="error")throw A;return A.viewSectionNotes}}),y=D?.notes??[],w=D?.totalCount??0,T=Math.max(1,Math.ceil(w/t.limit)),M=js(t.mode),R=t.tagNames.length>0||t.propertyFilters.length>0,N=p?o.find(A=>A.key===t.displayOptions.boardGroupByPropertyKey):null,O=A=>{const L=c===A?g==="asc"?"desc":"asc":A==="title"?"asc":"desc";k(G=>({...G,page:1,sort:{by:A,order:L}}))};return u.useEffect(()=>{p||E||V||S||!D||F<=T||k(A=>({...A,page:T}))},[D,p,V,E,S,T,k,F]),e.jsxs(je,{flush:!0,className:"flex h-full flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border-subtle/75 px-4 py-3.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[x&&e.jsx("div",{className:"-mr-1 shrink-0 self-center",children:x}),e.jsx("div",{className:"min-w-0",children:e.jsx(d,{as:"h2",variant:"subheading",weight:"semibold",tracking:"tight",className:"min-w-0",children:e.jsx("span",{className:"truncate",children:t.title})})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-1.5",children:[e.jsx(Q,{className:"max-w-full border-border-subtle/80 bg-elevated text-fg-secondary",children:ws(t.displayType)}),p&&t.displayOptions.boardGroupByPropertyKey?e.jsxs(Q,{className:"max-w-full border-border-subtle/80 bg-subtle text-fg-secondary",children:["Grouped by ",N?.name??t.displayOptions.boardGroupByPropertyKey]}):null,t.tagNames.map((A,L)=>e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[L>0&&e.jsx("span",{className:"px-0.5 text-[10px] font-semibold tracking-[0.08em] text-fg-tertiary/85",children:M}),e.jsx(Q,{className:"max-w-full border-border-subtle/80 bg-transparent text-fg-secondary",children:A})]},A)),t.propertyFilters.map(A=>e.jsx(Q,{className:"max-w-full border-border-subtle/80 bg-subtle text-fg-secondary",children:Ns(A)},`${A.key}-${A.operator}-${A.value??""}`)),!R&&e.jsx(Q,{className:"max-w-full border-border-subtle/80 bg-transparent text-fg-tertiary",children:"All notes"})]})]}),e.jsx(Ee,{button:e.jsx(Pe,{label:"Section actions"}),items:[...n?[{name:"Move up",onClick:n}]:[],...m?[{name:"Move down",onClick:m}]:[],...n||m?[{type:"separator"}]:[],{name:"Edit section",onClick:s},{name:"Duplicate section",onClick:a},{type:"separator"},{name:"Delete section",onClick:l}]})]}),e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsx(Qs,{section:t,notes:y,isPending:E,isError:V,onRetry:()=>{z()},onEdit:s,onSortChange:O,isSortPending:S,activeSortBy:c,activeSortOrder:g,availableProperties:o,isPropertiesLoading:v,navigationState:j,onNavigationStateChange:k})}),e.jsxs("div",{className:"flex flex-col gap-3 border-t border-border-subtle/75 px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:p?`${t.limit} cards per column load`:E||S?"Loading notes...":w===0?"No matching notes":`Showing ${h+1}–${Math.min(h+y.length,w)} of ${w} notes`}),!p&&T>1?e.jsx(ss,{page:Math.min(F,T),last:T,className:"!mt-0 shrink-0 sm:justify-end",onChange:A=>k(L=>({...L,page:A}))}):null]})]})}const xe="__choose_property__",ge="__choose_board_group__",Ys=["title","tags","properties","createdAt","updatedAt"],_e=t=>String(t?.limit??5),qe=t=>t?.displayType==="table"||t?.displayType==="board"?t.displayType:"list",We=t=>pe(t?.displayOptions?.tableColumns??Ne),Ue=t=>Fe(t?.displayOptions?.tablePropertyKeys),Qe=t=>t?.displayOptions?.boardGroupByPropertyKey??"",Ge=t=>t?.mode??"and",Ye=t=>t?t.tagNames.join(", "):"",Ze=t=>t?.title??"",He=t=>t?.sortBy??"updatedAt",Je=t=>t?.sortOrder??"desc",kt=t=>`property-filter-${Date.now()}-${t}`,Xe=t=>(t?.propertyFilters??[]).map((s,a)=>({id:kt(a),key:s.key,operator:s.operator,value:s.value??""})),et=t=>t?t.valueType==="date"||t.valueType==="number"?["equals","notEquals","before","after","exists","notExists"]:t.valueType==="text"||t.valueType==="url"?["equals","notEquals","contains","notContains","exists","notExists"]:["equals","notEquals","exists","notExists"]:["exists","notExists"],tt=t=>t?"equals":"exists",Zs=t=>t?t.valueType==="boolean"?"true":t.valueType==="select"?t.options[0]?.value??"":"":"",ye=t=>t!=="exists"&&t!=="notExists",Tt=t=>t==="contains"||t==="notContains",Hs=(t,s)=>t.valueType==="date"?"date":t.valueType==="number"?"number":t.valueType==="url"&&!Tt(s)?"url":"text",Js=(t,s)=>{if(t.valueType==="url")return Tt(s)?"example.com":"https://example.com";if(t.valueType==="text")return"Value"};function Xs({open:t,mode:s,initialSection:a=null,availableTags:l,availableProperties:n,isTagsLoading:m=!1,isPropertiesLoading:x=!1,onClose:o,onSubmit:v}){const[j,k]=u.useState(Ze(a)),[p,F]=u.useState(qe(a)),[h,c]=u.useState(We(a)),[g,D]=u.useState(Ue(a)),[E,V]=u.useState(Qe(a)),[S,z]=u.useState(Ye(a)),[y,w]=u.useState(Ge(a)),[T,M]=u.useState(He(a)),[R,N]=u.useState(Je(a)),[O,A]=u.useState(_e(a)),[L,G]=u.useState(Xe(a)),[he,te]=u.useState((a?.tagNames.length??0)>0),[ne,I]=u.useState(""),X=u.useMemo(()=>new Map(n.map(r=>[r.key,r])),[n]);u.useEffect(()=>{t&&(k(Ze(a)),F(qe(a)),c(We(a)),D(Ue(a)),V(Qe(a)),z(Ye(a)),w(Ge(a)),M(He(a)),N(Je(a)),A(_e(a)),G(Xe(a)),te((a?.tagNames.length??0)>0),I(""))},[a,t]);const Y=Le([S]),se=he||Y.length>0,be=Y.length===0&&L.length===0,ae=n.filter(r=>r.valueType==="select"&&r.options.length>0),i=r=>{r!=="title"&&(c(f=>{if(f.includes(r)){const _=f.filter(C=>C!==r);return _.length>0?_:f}return pe([...f,r])}),I(""))},b=r=>{D(f=>f.includes(r)?f.filter(_=>_!==r):f.length>=me?f:[...f,r])},P=r=>{const f=Y.includes(r)?Y.filter(_=>_!==r):[...Y,r];z(f.join(", ")),I("")},K=()=>{te(!0),I("")},ie=()=>{z(""),w("and"),te(!1),I("")},Ct=()=>{if(n.length===0){I("Create a shared property before adding a filter.");return}G(r=>[...r,{id:kt(r.length),key:"",operator:"exists",value:""}]),I("")},le=(r,f)=>{G(_=>_.map(C=>{if(C.id!==r)return C;const Z={...C,...f},oe=X.get(Z.key);return et(oe).includes(Z.operator)||(Z.operator=tt(oe)),"key"in f&&(Z.value=Zs(oe),Z.operator=tt(oe)),Z})),I("")},St=r=>{G(f=>f.filter(_=>_.id!==r)),I("")};return e.jsxs(J,{isOpen:t,onClose:o,variant:"form",className:"sm:max-w-[720px]",children:[e.jsx(J.Header,{title:s==="create"?"Create section":"Edit section",onClose:o}),e.jsx(J.Body,{children:e.jsxs("form",{id:"view-section-form",className:"flex flex-col gap-5",onSubmit:r=>{r.preventDefault();const f=Le([S]);if(se&&f.length===0){I("Choose at least one tag, or remove this tag filter.");return}if(L.find(q=>!q.key||!X.has(q.key))){I("Choose a property for every filter.");return}const C=X.get(E);if(p==="board"&&(!C||C.valueType!=="select"||C.options.length===0)){I("Choose a select property with at least one option for the board columns.");return}if(p==="board"&&L.some(q=>q.key===E)){I("Use different properties for the board columns and the section filter.");return}const Z=L.map(q=>{const Me=X.get(q.key);return{key:Me?.key??q.key,valueType:Me?.valueType??"text",operator:q.operator,value:ye(q.operator)?q.value:null}});if(Z.some(q=>ye(q.operator)&&!q.value?.trim())){I("Fill every filter value, or switch it to is set / is empty.");return}v({title:j,displayType:p,displayOptions:vt({tableColumns:h,tablePropertyKeys:g,boardGroupByPropertyKey:E}),tagNames:f,mode:y,propertyFilters:Z,sortBy:T,sortOrder:R,limit:Number(O)})},children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{htmlFor:"view-section-title",size:"md",children:"Section name"}),e.jsx(ve,{id:"view-section-title",value:j,onChange:r=>k(r.target.value),placeholder:"Doing notes",autoFocus:!0})]}),e.jsxs("section",{className:"flex flex-col gap-3 border-b border-border-subtle pb-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(U,{size:"md",children:"Display"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Show the same note set as a list, table, or property board."})]}),e.jsxs(Ie,{type:"single",value:p,onValueChange:r=>{(r==="list"||r==="table"||r==="board")&&(F(r),r==="board"&&!ae.some(f=>f.key===E)&&V(ae[0]?.key??""),I(""))},variant:"quiet",size:"sm",className:"self-start",children:[e.jsx(de,{value:"list","aria-label":"Show as list",children:"List"}),e.jsx(de,{value:"table","aria-label":"Show as table",children:"Table"}),e.jsx(de,{value:"board","aria-label":"Show as board",children:"Board"})]}),p==="table"?e.jsxs("div",{className:"border-t border-border-subtle/80 pt-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx(U,{size:"sm",children:"Table columns"}),e.jsx(d,{as:"span",variant:"meta",tone:"tertiary",children:h.includes("properties")&&g.length===0?"Properties automatic":`${h.length-(h.includes("properties")?1:0)+(h.includes("properties")?g.length:0)} shown`})]}),e.jsx("div",{className:"mt-3 grid grid-cols-2 gap-2",children:Ys.map(r=>{const f=ft(r);return e.jsxs("div",{className:"flex items-center gap-2 px-1 py-2",children:[e.jsx(Be,{size:"sm",checked:h.includes(r),disabled:r==="title","aria-label":`Show ${f} column`,onChange:()=>i(r)}),e.jsx(d,{as:"span",variant:"label",tone:"secondary",children:f})]},r)})}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-2",children:"Title is always shown because it opens the note."}),h.includes("properties")?e.jsxs("div",{className:"mt-3 border-t border-border-subtle/80 pt-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx(d,{as:"p",variant:"label",weight:"semibold",children:"Property columns"}),e.jsxs(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-0.5",children:["Select up to ",me," properties to compare."]})]}),e.jsx(d,{as:"span",variant:"meta",tone:"tertiary",children:g.length>0?`${g.length} selected`:"Automatic"})]}),n.length>0?e.jsx("div",{className:"mt-3 grid grid-cols-2 gap-2",children:n.map(r=>{const f=g.includes(r.key),_=g.length>=me;return e.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-1 py-2",children:[e.jsx(Be,{size:"sm",checked:f,disabled:!f&&_,"aria-label":`Show ${r.name} property column`,onChange:()=>b(r.key)}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(d,{as:"p",variant:"label",tone:"secondary",truncate:!0,children:r.name}),e.jsx(d,{as:"p",variant:"micro",tone:"tertiary",children:r.valueType})]})]},r.key)})}):e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-3",children:"Shared properties will appear here after you create them."}),g.length===0&&n.length>0?e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-2",children:"Automatic mode shows up to three properties relevant to the current notes."}):null]}):null]}):null,p==="board"?e.jsx("div",{className:"border-t border-border-subtle/80 pt-3",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{id:"view-section-board-group-label",htmlFor:"view-section-board-group",size:"sm",children:"Board columns"}),e.jsxs(H,{id:"view-section-board-group",value:E||ge,"aria-labelledby":"view-section-board-group-label",className:"w-full",onValueChange:r=>{r!==ge&&(V(r),I(""))},children:[e.jsx(B,{value:ge,disabled:!0,children:"Choose a select property"}),ae.map(r=>e.jsxs(B,{value:r.key,children:[r.name," · ",r.options.length," columns"]},r.key))]}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"Moving a card changes this property. Notes without a value stay in Unassigned."}),ae.length===0&&!x?e.jsx(d,{as:"p",variant:"meta",className:"text-fg-error",children:"Create a shared select property with options before using a board."}):null]})}):null]}),e.jsxs("section",{className:"flex flex-col gap-3 border-b border-border-subtle pb-5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(U,{size:"md",children:"Filters"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Use properties for structured fields, and tags for loose topics or context."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx($,{type:"button",variant:"subtle",size:"sm",onClick:Ct,children:"Add property filter"}),!se&&e.jsx($,{type:"button",variant:"subtle",size:"sm",onClick:K,children:"Add tag filter"})]})]}),L.length===0&&!se?e.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle bg-elevated/60 px-4 py-3",children:[e.jsx(d,{as:"p",variant:"label",tone:"default",children:be?"All notes":"No filters"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Add a property filter, a tag filter, or leave this view open to all notes."})]}):null,L.length>0?e.jsx("div",{className:"flex flex-col gap-2.5",children:L.map(r=>{const f=X.get(r.key),_=et(f);return e.jsxs("div",{className:"grid gap-2 rounded-[16px] border border-border-subtle bg-elevated p-3 md:grid-cols-[minmax(0,1fr)_minmax(10.5rem,12rem)_minmax(0,1fr)_auto] md:items-center",children:[e.jsxs(H,{value:r.key||xe,ariaLabel:"Property filter property",className:"w-full min-w-0",onValueChange:C=>{C!==xe&&le(r.id,{key:C})},children:[e.jsx(B,{value:xe,disabled:!0,children:"Choose property"}),n.map(C=>e.jsx(B,{value:C.key,children:C.name},C.key))]}),e.jsx(H,{value:r.operator,disabled:!f,ariaLabel:"Property filter operator",className:"w-full min-w-0",onValueChange:C=>le(r.id,{operator:C}),children:_.map(C=>e.jsx(B,{value:C,children:yt(C)},C))}),ye(r.operator)&&f?f.valueType==="select"?e.jsx(H,{value:r.value,ariaLabel:"Property filter value",className:"w-full min-w-0",onValueChange:C=>le(r.id,{value:C}),children:f.options.map(C=>e.jsx(B,{value:C.value,children:C.label},C.value))}):f.valueType==="boolean"?e.jsxs(H,{value:r.value||"true",ariaLabel:"Property filter value",className:"w-full min-w-0",onValueChange:C=>le(r.id,{value:C}),children:[e.jsx(B,{value:"true",children:"True"}),e.jsx(B,{value:"false",children:"False"})]}):e.jsx(ve,{type:Hs(f,r.operator),value:r.value,onChange:C=>le(r.id,{value:C.target.value}),placeholder:Js(f,r.operator),"aria-label":"Property filter value"}):e.jsx(d,{as:"span",variant:"label",tone:"tertiary",children:f?"No value needed":"Choose a property first"}),e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:()=>St(r.id),children:"Remove"})]},r.id)})}):null,se?e.jsxs("div",{className:"flex flex-col gap-3 rounded-[16px] border border-border-subtle bg-elevated p-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(d,{as:"p",variant:"label",tone:"default",children:"Tag filter"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Match notes by selected tags."})]}),e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:ie,children:"Remove"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{htmlFor:"view-section-tags",size:"sm",children:"Tag names"}),e.jsx(as,{id:"view-section-tags",value:S,onChange:r=>{z(r.target.value),I("")},placeholder:"@OceanBrain, @todo",size:"sm"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"You can use tags only, properties only, both together, or no filters."})]}),Y.length>1?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{size:"sm",children:"Tag match"}),e.jsxs(Ie,{type:"single",value:y,onValueChange:r=>{(r==="and"||r==="or")&&w(r)},variant:"quiet",size:"sm",className:"self-start",children:[e.jsx(de,{value:"and","aria-label":Ke("and"),children:"AND"}),e.jsx(de,{value:"or","aria-label":Ke("or"),children:"OR"})]}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"AND requires every selected tag. OR accepts any selected tag."})]}):null,e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(U,{size:"sm",children:"Existing tags"}),e.jsx(d,{as:"span",variant:"meta",tone:"tertiary",children:m?"Loading...":`${l.length} available`})]}),l.length>0?e.jsx("div",{className:"max-h-44 overflow-y-auto rounded-[16px] border border-border-subtle bg-hover-subtle/60 p-3",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(r=>{const f=Y.includes(r.name);return e.jsx("button",{type:"button",className:`inline-flex items-center rounded-full border px-3 py-1.5 text-sm font-medium transition-colors ${f?"border-border-secondary bg-elevated text-fg-default":"border-border-subtle bg-transparent text-fg-secondary hover:border-border-secondary hover:bg-elevated hover:text-fg-default"}`,"aria-pressed":f,onClick:()=>P(r.name),children:r.name},r.id)})})}):e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"No tags yet. You can still type tag names manually."})]}):null,e.jsx(d,{as:"p",variant:"meta",tone:ne?"default":"tertiary",className:ne?"text-fg-error":void 0,children:ne||(x||m?"Loading filter options...":`${n.length} properties · ${l.length} tags available`)})]}),e.jsxs("details",{className:"group pb-1",children:[e.jsx("summary",{className:"cursor-pointer list-none",children:e.jsxs("div",{className:"grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-1",children:[e.jsx(d,{as:"span",variant:"label",tone:"default",children:"Sort and page size"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"col-start-1 row-start-2",children:p==="board"?"Controls how many cards each board column loads at a time.":"Controls how many matching notes appear on each section page."}),e.jsx(d,{as:"span",variant:"meta",tone:"tertiary",className:"col-start-2 row-span-2 row-start-1 whitespace-nowrap",children:p==="board"?`${O} per column`:`${O} notes`})]})}),e.jsxs("div",{className:"mt-4 grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{id:"view-section-sort-by-label",htmlFor:"view-section-sort-by",size:"sm",children:"Sort by"}),e.jsxs(H,{id:"view-section-sort-by",value:T,"aria-labelledby":"view-section-sort-by-label",onValueChange:r=>M(r),children:[e.jsx(B,{value:"updatedAt",children:"Updated time"}),e.jsx(B,{value:"createdAt",children:"Created time"}),e.jsx(B,{value:"title",children:"Title"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{id:"view-section-sort-order-label",htmlFor:"view-section-sort-order",size:"sm",children:"Order"}),e.jsxs(H,{id:"view-section-sort-order",value:R,"aria-labelledby":"view-section-sort-order-label",onValueChange:r=>N(r),children:[e.jsx(B,{value:"desc",children:"Descending"}),e.jsx(B,{value:"asc",children:"Ascending"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{id:"view-section-limit-label",htmlFor:"view-section-limit",size:"sm",children:p==="board"?"Cards per load":"Rows per page"}),e.jsxs(H,{id:"view-section-limit",value:O,"aria-labelledby":"view-section-limit-label",onValueChange:A,children:[e.jsxs(B,{value:"3",children:["3 ",p==="board"?"cards":"rows"]}),e.jsxs(B,{value:"5",children:["5 ",p==="board"?"cards":"rows"]}),e.jsxs(B,{value:"8",children:["8 ",p==="board"?"cards":"rows"]}),e.jsxs(B,{value:"10",children:["10 ",p==="board"?"cards":"rows"]}),e.jsxs(B,{value:"12",children:["12 ",p==="board"?"cards":"rows"]})]})]})]})]})]})}),e.jsx(J.Footer,{children:e.jsxs(dt,{children:[e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:o,children:"Cancel"}),e.jsx($,{type:"submit",size:"sm",form:"view-section-form",children:s==="create"?"Create section":"Save section"})]})})]})}const ea="group flex h-10 max-w-[72vw] shrink-0 items-center rounded-[12px] border transition-[background-color,border-color,color,box-shadow] sm:max-w-[176px]",ta="focus-ring-soft inline-flex h-full min-w-0 flex-1 touch-pan-x items-center gap-1 rounded-[11px] px-3 text-[13px] font-medium outline-none transition-colors";function sa({tab:t,isActive:s,onSelect:a}){const{attributes:l,listeners:n,setNodeRef:m,setActivatorNodeRef:x,transform:o,transition:v,isDragging:j}=it({id:t.id});return e.jsx("div",{ref:m,style:{transform:Ae.Translate.toString(o),transition:v,opacity:j?.6:1},className:ee(ea,s?"border-border-secondary/80 bg-elevated text-fg-default shadow-[0_8px_18px_-18px_rgba(15,18,24,0.28)]":"border-transparent bg-transparent text-fg-secondary hover:border-border-subtle/80 hover:bg-hover-subtle hover:text-fg-default"),children:e.jsxs("button",{type:"button",ref:x,...l,...n,role:"tab","aria-selected":s,title:`${t.title}. Drag to reorder.`,className:ee(ta,s?"text-fg-default":"text-fg-secondary group-hover:text-fg-default",j?"cursor-grabbing":"cursor-pointer"),onClick:a,children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.title}),e.jsx("span",{className:"inline-flex min-w-4 shrink-0 items-center justify-center rounded-full bg-hover-subtle/75 px-1 py-0 text-[10px] leading-4 text-current/70",children:t.sections.length})]})})}function aa({tabs:t,activeTabId:s,onSelectTab:a,onReorderTabs:l,onCreateTab:n}){const m=ke(re(Vt,{activationConstraint:{distance:8}}),re(Te,{coordinateGetter:rt}));return e.jsx("div",{className:"-mx-1 rounded-[16px] border border-border-subtle/75 bg-subtle/50 p-1 sm:mx-0",children:e.jsx(Ce,{sensors:m,collisionDetection:Se,modifiers:[zt],autoScroll:!1,onDragEnd:x=>{l(x)},children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(nt,{items:t.map(x=>x.id),strategy:Et,children:e.jsx("div",{role:"tablist","aria-label":"Views tab list",className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto overflow-y-hidden",children:t.map(x=>e.jsx(sa,{tab:x,isActive:x.id===s,onSelect:()=>{a(x)}},x.id))})}),e.jsxs($,{type:"button","aria-label":"New view tab",variant:"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-[12px] border-transparent bg-transparent px-0 text-[13px] text-fg-secondary hover:border-border-subtle/80 hover:bg-hover-subtle hover:text-fg-default sm:w-auto sm:px-2.5",onClick:n,children:[e.jsx(we,{className:"h-5 w-5 shrink-0"}),e.jsx("span",{className:"hidden sm:inline",children:"New view tab"})]})]})})})}function ra({open:t,mode:s,initialTitle:a="",onClose:l,onSubmit:n}){const[m,x]=u.useState(a);return u.useEffect(()=>{t&&x(a)},[a,t]),e.jsxs(J,{isOpen:t,onClose:l,variant:"form",className:"sm:max-w-[480px]",children:[e.jsx(J.Header,{title:s==="create"?"Create view tab":"Rename view tab",onClose:l}),e.jsx(J.Body,{children:e.jsxs("form",{id:"view-tab-form",className:"flex flex-col gap-4",onSubmit:o=>{o.preventDefault(),n(m)},children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(U,{htmlFor:"view-tab-title",size:"md",children:"Tab name"}),e.jsx(ve,{id:"view-tab-title",value:m,onChange:o=>x(o.target.value),placeholder:"Now",autoFocus:!0})]}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"Each tab is one saved view inside the Views page."})]})}),e.jsx(J.Footer,{children:e.jsxs(dt,{children:[e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:l,children:"Cancel"}),e.jsx($,{type:"submit",size:"sm",form:"view-tab-form",children:s==="create"?"Create tab":"Save tab"})]})})]})}const st=is(os),na="Save reusable note queries with tags, shared properties, and sorting.",ia="focus-ring-soft hidden h-8 w-8 items-center justify-center rounded-[10px] text-fg-default/70 outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default sm:inline-flex touch-none",la=({section:t,availableProperties:s,isPropertiesLoading:a,onEdit:l,onDuplicate:n,onDelete:m,onMoveUp:x,onMoveDown:o,navigationState:v,onNavigationStateChange:j})=>{const{attributes:k,listeners:p,setNodeRef:F,setActivatorNodeRef:h,transform:c,transition:g,isDragging:D}=it({id:t.id}),E=u.useCallback(V=>j(t.id,V),[j,t.id]);return e.jsx("div",{ref:F,style:{transform:Ae.Translate.toString(c),transition:g,opacity:D?.6:1},children:e.jsx(Gs,{section:t,availableProperties:s,isPropertiesLoading:a,onEdit:l,onDuplicate:n,onDelete:m,onMoveUp:x,onMoveDown:o,navigationState:v,onNavigationStateChange:E,dragHandle:e.jsx("button",{type:"button",ref:h,"aria-label":`Reorder section ${t.title}`,...k,...p,className:ee(ia,D?"cursor-grabbing":"cursor-grab"),children:e.jsx(lt,{className:"size-4"})})})})};function ja(){const t=Gt(),s=ut(),a=ct(),l=st.useSearch(),n=st.useNavigate(),[m,x]=u.useState(null),[o,v]=u.useState(null),{data:j,isPending:k,isError:p,refetch:F}=ue({queryKey:W.views.workspace(),async queryFn(){const i=await Rt();if(i.type==="error")throw i;return i.viewWorkspace}}),h=j??bs,c=h.tabs.find(i=>i.id===l.tab)??gs(h),g=c?h.tabs.findIndex(i=>i.id===c.id):-1,{data:D,isPending:E}=ue({queryKey:W.tags.list({limit:200}),async queryFn(){const i=await ls({limit:200});if(i.type==="error")throw i;return i.allTags}}),V=ke(re(at,{activationConstraint:{distance:8}}),re(Te,{coordinateGetter:rt})),S=D?.tags??[],{data:z,isPending:y}=ue({queryKey:W.notes.propertyKeys({limit:100}),async queryFn(){const i=await rs({limit:100});if(i.type==="error")throw i;return i.notePropertyKeys}}),w=z?.keys??[],T=i=>{a.setQueryData(W.views.workspace(),i)},M=u.useCallback((i,b)=>{n({search:P=>({...P,state:Ot(P.state,i,b)}),replace:!0,resetScroll:!1})},[n]),R=async()=>{await a.invalidateQueries({queryKey:W.views.all(),exact:!1})},N=async(i,b)=>{T(b);const P=await Wt(b.tabs.map(K=>K.id));if(P.type==="error"){T(i),s(P.errors[0].message);return}await R()},O=async({active:i,over:b})=>{if(!b||i.id===b.id)return;const P=a.getQueryData(W.views.workspace())??h,K=xt(P,String(i.id),String(b.id));await N(P,K)},A=async i=>{if(!c)return;const b=a.getQueryData(W.views.workspace())??h,P=fs(b,c.id,i);P!==b&&await N(b,P)},L=async i=>{const b=a.getQueryData(W.views.workspace())??h,P=l,K=ys(b,i.id);T(K),await n({search:{tab:i.id,state:void 0},resetScroll:!1});const ie=await ze(i.id);if(ie.type==="error"){T(b),await n({search:P,replace:!0,resetScroll:!1}),s(ie.errors[0].message);return}T(ie.setActiveViewTab)},G=async(i,b)=>{if(!c)return;T(b);const P=await Ut(c.id,b.tabs.find(K=>K.id===c.id)?.sections.map(K=>K.id)??[]);if(P.type==="error"){T(i),s(P.errors[0].message);return}await R()},he=async({active:i,over:b})=>{if(!c||!b||i.id===b.id)return;const P=a.getQueryData(W.views.workspace())??h,K=gt(P,c.id,String(i.id),String(b.id));await G(P,K)},te=async(i,b)=>{if(!c)return;const P=a.getQueryData(W.views.workspace())??h,K=vs(P,c.id,i,b);K!==P&&await G(P,K)},ne=async i=>{const b=await $t(i);if(b.type==="error"){s(b.errors[0].message);return}const P=await ze(b.createViewTab.id);P.type==="success"?T(P.setActiveViewTab):s(P.errors[0].message),await R(),await n({search:{tab:b.createViewTab.id,state:void 0},resetScroll:!1}),x(null)},I=async i=>{if(!c)return;const b=await Lt(c.id,i);if(b.type==="error"){s(b.errors[0].message);return}await R(),x(null)},X=async()=>{if(!c||!await t("Delete this view tab and all of its sections?"))return;const i=await Kt(c.id);if(i.type==="error"){s(i.errors[0].message);return}await R(),await n({search:{tab:void 0,state:void 0},replace:!0,resetScroll:!1})},Y=async i=>{if(!c)return;const b=await Re(c.id,i);if(b.type==="error"){s(b.errors[0].message);return}await R(),v(null)},se=async i=>{if(!c||!o||o.mode!=="edit")return;const b=await _t(o.section.id,i);if(b.type==="error"){s(b.errors[0].message);return}M(o.section.id,{}),await R(),v(null)},be=async i=>{const b=await Re(i.tabId,{...ks(i),title:`${i.title} copy`});if(b.type==="error"){s(b.errors[0].message);return}await R(),s("Section duplicated.")},ae=async i=>{if(!c||!await t("Delete this section from the current view tab?"))return;const b=await qt(i);if(b.type==="error"){s(b.errors[0].message);return}M(i,{}),await R()};return e.jsxs(e.Fragment,{children:[e.jsx(ns,{title:"Views",description:na,children:k&&!j?e.jsx(je,{className:"px-6 py-8 sm:px-8 sm:py-10",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(ce,{height:20,width:180,className:"rounded-full"}),e.jsx(ce,{height:16,width:260,className:"rounded-full"}),e.jsx(ce,{height:44,width:140,className:"rounded-[12px]"})]})}):p?e.jsxs(je,{className:"px-6 py-8 sm:px-8 sm:py-10",children:[e.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"Failed to load saved views"}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Retry loading your saved view tabs."}),e.jsx("div",{className:"mt-4",children:e.jsx($,{type:"button",variant:"ghost",size:"sm",onClick:()=>{F()},children:"Retry"})})]}):h.tabs.length===0?e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx($e,{title:"Create your first view tab",description:"Start with a saved view tab, then add sections that query notes by tags, properties, or both.",className:"h-[320px]"}),e.jsx("div",{className:"flex justify-center",children:e.jsxs($,{type:"button",onClick:()=>x({mode:"create"}),children:[e.jsx(we,{className:"h-4 w-4"}),"Create first tab"]})})]}):e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsx(aa,{tabs:h.tabs,activeTabId:c?.id??null,onSelectTab:L,onReorderTabs:O,onCreateTab:()=>x({mode:"create"})}),c&&e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{className:"flex flex-col gap-3 border-b border-border-subtle/80 px-1 pb-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(d,{as:"h2",variant:"subheading",weight:"semibold",tracking:"tight",truncate:!0,children:c.title}),e.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:c.sections.length>0?`${c.sections.length} section${c.sections.length===1?"":"s"} in this view`:"Add sections to build this view"})]}),e.jsxs("div",{className:"inline-flex flex-wrap items-center gap-2 self-start sm:self-center",children:[e.jsxs($,{type:"button",size:"sm",onClick:()=>v({mode:"create"}),children:[e.jsx(we,{className:"h-4 w-4"}),"Add section"]}),e.jsx(Ee,{button:e.jsx(Pe,{label:"View tab actions"}),items:[...g>0?[{name:"Move tab left",onClick:()=>{A("previous")}}]:[],...g>=0&&g<h.tabs.length-1?[{name:"Move tab right",onClick:()=>{A("next")}}]:[],...h.tabs.length>1?[{type:"separator"}]:[],{name:"Rename tab",onClick:()=>x({mode:"edit",tab:c})},{type:"separator"},{name:"Delete tab",onClick:()=>{X()}}]})]})]}),c.sections.length===0?e.jsx($e,{title:"Add the first section to this tab",description:"Sections can pull notes by tags, properties, or both.",className:"h-[300px]"}):e.jsx("div",{className:"flex flex-col",children:e.jsx(Ce,{sensors:V,collisionDetection:Se,modifiers:[It],onDragEnd:he,children:e.jsx(nt,{items:c.sections.map(i=>i.id),strategy:Dt,children:e.jsx("div",{className:"flex flex-col gap-4",children:c.sections.map((i,b)=>e.jsx(la,{section:i,availableProperties:w,isPropertiesLoading:y,navigationState:Bt(l.state,i.id),onNavigationStateChange:M,onEdit:()=>v({mode:"edit",section:i}),onDuplicate:()=>{be(i)},onDelete:()=>{ae(i.id)},onMoveUp:b>0?()=>{te(i.id,"previous")}:void 0,onMoveDown:b<c.sections.length-1?()=>{te(i.id,"next")}:void 0},i.id))})})})})]})]})}),e.jsx(ra,{open:m!==null,mode:m?.mode??"create",initialTitle:m?.mode==="edit"?m.tab.title:"",onClose:()=>x(null),onSubmit:i=>{if(m?.mode==="edit"){I(i);return}ne(i)}}),e.jsx(Xs,{open:o!==null,mode:o?.mode??"create",initialSection:o?.mode==="edit"?o.section:null,availableTags:S,availableProperties:w,isTagsLoading:E,isPropertiesLoading:y,onClose:()=>v(null),onSubmit:i=>{if(o?.mode==="edit"){se(i);return}Y(i)}})]})}export{ja as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-6Q2QTUOP-xZ8ofRqk.js";import{p as f}from"./chunk-JWPE2WC7-DsyTXbuq.js";import{_ as n,l as o}from"./mermaid.core-C2tL9tq7.js";import"./transform-BUB79_za.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-DU_G4Atc.js";import"./preload-helper-BXl3LOEh.js";import"./floating-ui.react-dom-BWTnA00G.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},I={parser:R,db:a,renderer:u,styles:p};export{I as diagram};
|