ocean-brain 0.10.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/mcp.js +58 -32
  2. package/package.json +2 -2
  3. package/server/client/dist/assets/{ArrowRight.es-Bm-ZXpEC.js → ArrowRight.es-BEhnlwfe.js} +1 -1
  4. package/server/client/dist/assets/AuxiliaryPanelHeader-B1k7pZpn.js +1 -0
  5. package/server/client/dist/assets/Calendar-BR83066I.js +25 -0
  6. package/server/client/dist/assets/{Callout-CviyPHKO.js → Callout-BTd1BYtV.js} +1 -1
  7. package/server/client/dist/assets/{Copy.es-BPreRnP9.js → Copy.es-BoLjilxv.js} +1 -1
  8. package/server/client/dist/assets/File.es-Ct7fscBg.js +1 -0
  9. package/server/client/dist/assets/{Graph-yPE3ljW0.js → Graph-DYUb7gQb.js} +1 -1
  10. package/server/client/dist/assets/{Graph-vXQQ0a-Q.js → Graph-LY_IgMYy.js} +1 -1
  11. package/server/client/dist/assets/{Image.es-DnR3qc_c.js → Image.es-OYyN3BYt.js} +1 -1
  12. package/server/client/dist/assets/Note-DnXDfDTk.js +25 -0
  13. package/server/client/dist/assets/NotePropertiesPanel-CsaNhRnE.js +2 -0
  14. package/server/client/dist/assets/{PencilLine.es-B9V6u64t.js → PencilLine.es-0JpEgxFY.js} +1 -1
  15. package/server/client/dist/assets/{Plus.es-CRRp2u5J.js → Plus.es-DRfLW_bI.js} +1 -1
  16. package/server/client/dist/assets/{Reminders-BOtfNeYD.js → Reminders-COr1OHvF.js} +1 -1
  17. package/server/client/dist/assets/Search-BqPROwkA.js +31 -0
  18. package/server/client/dist/assets/{SurfaceCard-GMt5xM7v.js → SurfaceCard-t7pdfhEe.js} +1 -1
  19. package/server/client/dist/assets/Tag-C4fNi3KQ.js +1 -0
  20. package/server/client/dist/assets/TagNotes-BXgkwXMd.js +1 -0
  21. package/server/client/dist/assets/{Trash.es-svHOb5LN.js → Trash.es-Bo1VyK9Q.js} +1 -1
  22. package/server/client/dist/assets/ViewChip-DlCkL4z4.js +1 -0
  23. package/server/client/dist/assets/ViewNotes-BJPiV66I.js +1 -0
  24. package/server/client/dist/assets/ViewSectionDialog-DhH8harC.js +102 -0
  25. package/server/client/dist/assets/Views-DMizFO-d.js +1 -0
  26. package/server/client/dist/assets/app-1lOWtkRA.js +26 -0
  27. package/server/client/dist/assets/app-BHmwRmwM.css +1 -0
  28. package/server/client/dist/assets/{image.api-QmHYjp3z.js → image.api-CyQisInP.js} +1 -1
  29. package/server/client/dist/assets/index-BBzpADtD.js +1 -0
  30. package/server/client/dist/assets/manage-image-azmo5iVw.js +1 -0
  31. package/server/client/dist/assets/manage-image-detail-ojV6kSsu.js +1 -0
  32. package/server/client/dist/assets/{mcp-uFZkdhCi.js → mcp-CCaFd0zm.js} +1 -1
  33. package/server/client/dist/assets/mcp-admin-adapter-PMmgPupc.js +1 -0
  34. package/server/client/dist/assets/{note-ui-CxK8ymUc.js → note-ui-CtijppHK.js} +1 -1
  35. package/server/client/dist/assets/{note.api-BQovzEzd.js → note.api-D3oJmG3q.js} +2 -2
  36. package/server/client/dist/assets/{placeholder-D3b8lZGE.js → placeholder-DR75IAi_.js} +2 -2
  37. package/server/client/dist/assets/{properties-M-yWq1D7.js → properties-BrNJLkxR.js} +1 -1
  38. package/server/client/dist/assets/route-preload.js +2 -2
  39. package/server/client/dist/assets/search-D-xKTPdO.js +1 -0
  40. package/server/client/dist/assets/search-admin-adapter-CJnJmL6w.js +1 -0
  41. package/server/client/dist/assets/{tag.api-DUfjr8bg.js → tag.api-DNSQpqwk.js} +1 -1
  42. package/server/client/dist/assets/{time-CfAYZipR.js → time-D5LRMumI.js} +3 -3
  43. package/server/client/dist/assets/trash-X_dnKA9T.js +1 -0
  44. package/server/client/dist/assets/{useReminderMutate--omDLmBV.js → useReminderMutate-BrGO9M0o.js} +1 -1
  45. package/server/client/dist/index.html +5 -5
  46. package/server/dist/features/note/graphql/note.field.resolver.js +2 -0
  47. package/server/dist/features/note/graphql/note.mutation.resolver.js +19 -14
  48. package/server/dist/features/note/graphql/note.query.resolver.js +34 -14
  49. package/server/dist/features/note/graphql/note.type-defs.js +1 -0
  50. package/server/dist/features/note/services/authoring.js +15 -10
  51. package/server/dist/features/note/services/content-blocks.js +18 -20
  52. package/server/dist/features/note/services/note-reference-index.js +98 -0
  53. package/server/dist/features/note/services/search.js +5 -0
  54. package/server/dist/features/note/services/snapshot.js +4 -0
  55. package/server/dist/features/note/services/trash.js +2 -0
  56. package/server/dist/features/note/services/write.js +10 -3
  57. package/server/dist/features/search/graphql/resolver.js +13 -1
  58. package/server/dist/features/search/graphql/type-defs.js +7 -0
  59. package/server/dist/features/search/hybrid-ranking.js +4 -2
  60. package/server/dist/features/search/hybrid-search.js +4 -2
  61. package/server/dist/features/search/related-notes.js +186 -0
  62. package/server/dist/main.js +10 -3
  63. package/server/dist/paths.js +0 -1
  64. package/server/dist/routes/client.js +1 -1
  65. package/server/prisma/migrations/20260728090000_0019_note_reference_index/migration.sql +15 -0
  66. package/server/prisma/schema.prisma +16 -0
  67. package/server/client/dist/assets/Calendar-BsNs3NzO.js +0 -25
  68. package/server/client/dist/assets/Note-CmreVzvQ.js +0 -25
  69. package/server/client/dist/assets/NotePropertiesPanel-DXYgE8h2.js +0 -2
  70. package/server/client/dist/assets/Search-C-FB3pKf.js +0 -1
  71. package/server/client/dist/assets/Tag-lBxDRE77.js +0 -1
  72. package/server/client/dist/assets/TagNotes-Bgorp_rC.js +0 -1
  73. package/server/client/dist/assets/ViewNotes-C7d10VFf.js +0 -1
  74. package/server/client/dist/assets/ViewSectionDialog-Bhw-ILop.js +0 -102
  75. package/server/client/dist/assets/Views-C7V3saUo.js +0 -1
  76. package/server/client/dist/assets/app-DQBV36r_.js +0 -50
  77. package/server/client/dist/assets/app-ZgwR5t_I.css +0 -1
  78. package/server/client/dist/assets/index-CaF9d-zG.js +0 -1
  79. package/server/client/dist/assets/manage-image-DCDF8AM9.js +0 -1
  80. package/server/client/dist/assets/manage-image-detail-e0ViRAj-.js +0 -1
  81. package/server/client/dist/assets/mcp-admin-adapter-D39G3udJ.js +0 -1
  82. package/server/client/dist/assets/search-DFnzZKLd.js +0 -1
  83. package/server/client/dist/assets/trash-CClKfP1x.js +0 -1
@@ -0,0 +1,31 @@
1
+ import{j as e,r as g}from"./floating-ui.react-dom-BWTnA00G.js";import{a as L,m as Q,t as G}from"./time-D5LRMumI.js";import{g as q,x as V,y as X,c as J,H as Y,B as W,T as m,q as k,P as Z,E as A,Q as ee,F as C,k as te,h as re,l as w,i as se,s as ae}from"./note.api-D3oJmG3q.js";import{A as ne,p as ie}from"./AuxiliaryPanelHeader-B1k7pZpn.js";import{N as P,g as oe,h as le,T as ce}from"./url-9nrbQs7Z.js";import{f as de}from"./Graph-LY_IgMYy.js";import{V as R}from"./ViewChip-DlCkL4z4.js";import"./app-1lOWtkRA.js";import{f as me}from"./search-admin-adapter-CJnJmL6w.js";import{s as he}from"./File.es-Ct7fscBg.js";import"./preload-helper-BXl3LOEh.js";const ue=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=({children:t,match:s})=>{const r=s.trim();if(!r)return e.jsx("span",{children:t});const a=ue(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))})},xe={hybrid:"HYBRID",lexical:"LEXICAL",semantic:"SEMANTIC"};function pe({query:t,limit:s=25,offset:r=0,mode:a="hybrid"}){return q(`query FetchSearchNotes($query: String!, $pagination: PaginationInput!, $mode: SearchMode!) {
2
+ searchNotes(query: $query, pagination: $pagination, mode: $mode) {
3
+ totalCount
4
+ semanticAvailable
5
+ semanticUsed
6
+ semanticError
7
+ matches {
8
+ noteId
9
+ lexical
10
+ semantic
11
+ }
12
+ notes {
13
+ id
14
+ title
15
+ content
16
+ pinned
17
+ tags {
18
+ id
19
+ name
20
+ }
21
+ createdAt
22
+ updatedAt
23
+ }
24
+ }
25
+ }`,{query:t,mode:xe[a],pagination:{limit:s,offset:r}})}function fe(t,s=5){return q(`query FetchSearchRelatedNotes($noteId: ID!, $limit: Int!) {
26
+ searchRelatedNotes(noteId: $noteId, limit: $limit) {
27
+ id
28
+ title
29
+ reasons
30
+ }
31
+ }`,{noteId:t,limit:s})}const M=[{value:"hybrid",label:"Keyword + Meaning"},{value:"lexical",label:"Keyword only"},{value:"semantic",label:"Meaning only"}],ge=({value:t,onChange:s,className:r})=>e.jsx(V,{value:t,ariaLabel:"Search mode",variant:"ghost",size:"md",className:J("max-w-[12rem] shrink-0",r),onValueChange:a=>{M.some(n=>n.value===a)&&s(a)},children:M.map(a=>e.jsx(X,{value:a.value,children:a.label},a.value))}),be=({value:t,onChange:s,onSubmit:r,onClear:a,onCompositionChange:n,mode:o,onModeChange:i,autoFocus:c=!1,placeholder:d="Describe what you remember"})=>{const l=h=>{h.preventDefault(),r()};return e.jsx("form",{role:"search",className:"flex w-full",onSubmit:l,children:e.jsxs("div",{className:"flex min-h-14 min-w-0 flex-1 flex-wrap items-center overflow-hidden rounded-[16px] border border-border-subtle bg-elevated px-2 py-1 transition-colors focus-within:border-border-focus focus-within:shadow-[0_0_0_4px_color-mix(in_srgb,var(--accent-soft-primary)_90%,transparent)]",children:[o&&i&&e.jsxs("div",{className:"flex w-full items-center border-b border-border-subtle/70 pb-1 md:w-auto md:border-b-0 md:pb-0",children:[e.jsx(ge,{value:o,onChange:i,className:"max-w-full"}),e.jsx("span",{className:"mx-1 hidden h-6 w-px shrink-0 bg-divider md:block","aria-hidden":"true"})]}),e.jsxs("div",{className:"flex min-w-0 flex-1 basis-full items-center md:basis-auto",children:[e.jsx("span",{className:"flex h-11 w-10 shrink-0 items-center justify-center text-fg-tertiary","aria-hidden":"true",children:e.jsx(de,{className:"h-[18px] w-[18px]",weight:"bold"})}),e.jsx("input",{type:"text",role:"searchbox","aria-label":"Search notes",autoFocus:c,autoComplete:"off",placeholder:d,value:t,onChange:h=>s(h.target.value),onCompositionStart:()=>n?.(!0),onCompositionEnd:h=>{s(h.currentTarget.value),n?.(!1)},className:"h-11 min-w-0 flex-1 bg-transparent px-1 text-base text-fg-default outline-none placeholder:text-fg-placeholder"}),t&&e.jsx("button",{type:"button","aria-label":"Clear search",className:"focus-ring-soft flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] text-fg-tertiary transition-colors hover:bg-hover-subtle hover:text-fg-default",onClick:()=>{s(""),a?.()},children:e.jsx(Y,{className:"h-4 w-4",weight:"bold"})}),e.jsx(W,{type:"submit",size:"lg",disabled:!t.trim(),className:"my-1 px-4 sm:px-5",children:"Search"})]})]})})},ye=t=>t?.lexical&&t.semantic?"Keyword + Meaning":t?.semantic?"Meaning match":t?.lexical?"Keyword match":null,je=({match:t})=>{const s=ye(t);return s?e.jsx(m,{as:"span",variant:"meta",weight:"semibold",tone:"tertiary",className:"shrink-0 rounded-full bg-muted px-2 py-1",children:s}):null},Ne=()=>{const t=L({queryKey:k.search.adminStatus(),queryFn:me,staleTime:6e4,retry:1});return{status:t.data,isLoading:t.isPending,isError:t.isError,isSemanticSearchEnabled:t.data?.config.enabled===!0,isSemanticSearchAvailable:t.data?.available===!0}},I=180,T=t=>t.replace(/\s+/g," ").trim(),O=t=>T(t).toLowerCase().split(" ").filter(Boolean),ve=(t,s)=>{const r=T(t),a=T(s).toLowerCase();if(!a)return r;const n=r.toLowerCase();let o=a,i=n.indexOf(a);if(i===-1){const h=O(s).map(f=>({term:f,index:n.indexOf(f)})).filter(f=>f.index>=0).sort((f,v)=>f.index-v.index||v.term.length-f.term.length)[0];h&&(o=h.term,i=h.index)}if(i===-1)return r.length>I?`${r.slice(0,I-1).trimEnd()}…`:r;const c=Math.max(0,i-56),d=Math.min(r.length,i+o.length+84);let l=r.slice(c,d).trim();return c>0&&(l=`…${l}`),d<r.length&&(l=`${l}…`),l},Se=t=>Array.isArray(t)?t.map(s=>{if(!s||typeof s!="object")return"";const r=s.text;return typeof r=="string"?r:""}).join(""):"",we=t=>t==="heading"?"heading":t==="bulletListItem"||t==="numberedListItem"?"list":t==="checkListItem"?"checklist":t==="quote"?"quote":t==="codeBlock"?"code":"content",z=(t,s)=>{Array.isArray(t)&&t.forEach(r=>{if(!r||typeof r!="object")return;const a=typeof r.type=="string"?r.type:void 0,n=T(Se(r.content));n&&s.push({kind:we(a),text:n});const o=r.children;Array.isArray(o)&&z(o,s)})},Ee=(t,s)=>{try{const r=JSON.parse(t),a=[];if(z(r,a),a.length===0)return[];const n=O(s),o=n.length>0?a.filter(c=>n.some(d=>c.text.toLowerCase().includes(d))):a;return(o.length>0?o:a).slice(0,2).map(c=>({...c,text:ve(c.text,s)}))}catch{return[]}},_=re(oe),E=10,Te=400,H=3e4,Ce=t=>t===1?"1 result":`${t} results`,ke=t=>{const s=Number(t),r=Number.isFinite(s)?s:Date.parse(t);return Number.isFinite(r)?`Updated ${G(r)}`:"Updated recently"},Ae=({searchParams:t,render:s})=>{const{data:r}=se({queryKey:k.search.results(t),async queryFn(){const a=await pe(t);if(a.type==="error")throw a;return a.searchNotes},staleTime:H});return s(r)},$=()=>e.jsx("main",{className:"mt-5 flex flex-col gap-3","aria-label":"Searching notes",children:Array.from({length:2},(t,s)=>e.jsxs("div",{className:"surface-base flex flex-col gap-3 p-4",children:[e.jsx(w,{width:"34%",height:18,className:"rounded-full"}),e.jsx("div",{className:"rounded-[14px] bg-muted px-3 py-3",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(w,{width:84,height:12,className:"rounded-full"}),e.jsx(w,{width:"100%",height:14,className:"rounded-full"}),e.jsx(w,{width:"82%",height:14,className:"rounded-full"})]})})]},s))}),Re=({note:t})=>{const s=t.tags.slice(0,2),r=t.tags.length-s.length;return e.jsxs("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1.5",children:[t.pinned&&e.jsxs("span",{className:"inline-flex items-center text-fg-tertiary",title:"Pinned note",children:[e.jsx(Q,{className:"h-3.5 w-3.5",weight:"fill","aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:"Pinned note"})]}),e.jsx(m,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:ke(t.updatedAt)}),s.map(a=>e.jsx(C,{to:ce,params:{id:a.id},search:{page:1},children:e.jsx(R,{size:"compact",className:"border-border-subtle bg-transparent text-fg-secondary transition-colors hover:bg-hover-subtle hover:text-fg-default",children:a.name})},a.id)),r>0&&e.jsxs(R,{size:"compact",className:"border-border-subtle bg-subtle text-fg-tertiary",children:["+",r]})]})},Me=t=>t==="list"?"•":t==="checklist"?"☐":null,Ie=t=>{if(t==="quote")return"border-l-2 border-border-secondary pl-3 italic";if(t==="code")return"rounded-[10px] bg-subtle/70 px-2.5 py-2 font-mono text-sm"},_e=({blocks:t,query:s})=>e.jsx("div",{className:"rounded-[14px] border border-border-subtle/80 bg-muted/40 px-3.5 py-3",children:t.map((r,a)=>{const n=Me(r.kind);return e.jsx("div",{className:a>0?"mt-2 border-t border-border-subtle/70 pt-2":void 0,children:e.jsxs("div",{className:"flex items-start gap-2",children:[n&&e.jsx("span",{className:"mt-0.5 w-4 shrink-0 text-center text-fg-tertiary","aria-hidden":"true",children:n}),e.jsx(m,{as:"p",variant:"body",weight:r.kind==="heading"?"semibold":"regular",tone:r.kind==="heading"?"default":"secondary",className:Ie(r.kind)??"leading-[1.65]",children:e.jsx(B,{match:s,children:r.text})})]})},`${r.kind}:${a}`)})}),$e=({noteId:t})=>{const[s,r]=g.useState(!1),{data:a,isError:n,isLoading:o}=L({queryKey:k.search.related(t),queryFn:async()=>{const i=await fe(t);if(i.type==="error")throw i;return i.searchRelatedNotes},enabled:s,staleTime:H});return e.jsxs("details",{className:"group border-t border-border-subtle/70 pt-3",onToggle:i=>r(i.currentTarget.open),children:[e.jsxs("summary",{className:"focus-ring-soft flex cursor-pointer list-none items-center justify-between gap-3 rounded-[10px] border border-transparent px-2.5 py-1.5 outline-none transition-colors hover:bg-hover-subtle marker:hidden",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(ne,{icon:e.jsx(ie,{className:"h-3.5 w-3.5"}),title:"Related notes",className:"text-fg-tertiary"}),a&&e.jsx(m,{as:"span",variant:"meta",weight:"medium",tone:"tertiary",children:a.length})]}),e.jsx(ae,{className:"h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-open:rotate-180","aria-hidden":"true"})]}),e.jsxs("div",{className:"mt-2",children:[o&&e.jsx(m,{as:"p",variant:"meta",tone:"tertiary",className:"px-2 py-1.5",children:"Looking for related notes…"}),n&&e.jsx(m,{as:"p",variant:"meta",tone:"error",className:"px-2 py-1.5",children:"Related notes could not be loaded."}),!o&&!n&&a?.length===0&&e.jsx(m,{as:"p",variant:"meta",tone:"tertiary",className:"px-2 py-1.5",children:"No direct connections found yet."}),!o&&!n&&a&&a.length>0&&e.jsx("ul",{className:"flex flex-col",children:a.map(i=>e.jsx("li",{children:e.jsxs(C,{to:P,params:{id:i.id},className:"flex min-w-0 items-start gap-2 rounded-[10px] px-2.5 py-1.5 text-fg-secondary transition-colors hover:bg-hover-subtle hover:text-fg-default",children:[e.jsx(he,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-fg-tertiary","aria-hidden":"true"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx(m,{as:"span",variant:"body",weight:"medium",className:"text-current line-clamp-1",children:i.title||"Untitled"}),e.jsx(m,{as:"span",variant:"meta",tone:"tertiary",className:"mt-0.5 block line-clamp-1",children:i.reasons.join(" · ")})]})]})},i.id))})]})]})},Le=({result:t,mode:s})=>s==="lexical"||t.semanticAvailable&&!t.semanticError?null:e.jsx(m,{as:"p",variant:"body",tone:"tertiary",className:"rounded-[14px] border border-border-subtle bg-muted px-3.5 py-2.5",children:s==="semantic"?"Meaning search is not ready. Configure an embedding API and build the index in Search settings.":"Meaning search is not ready, so these results use keyword search only."}),qe=({isVisible:t})=>t?e.jsxs(m,{as:"p",variant:"meta",tone:"tertiary",className:"mx-auto mt-5 max-w-[34rem] text-center",children:[e.jsx("span",{className:"font-semibold text-fg-secondary",children:"Tip:"})," Search by meaning when the exact words are fuzzy."," ",e.jsx(C,{to:le,className:"font-semibold text-fg-secondary underline decoration-border-secondary underline-offset-2 transition-colors hover:text-fg-default",children:"Enable meaning search"})]}):null;function Ve(){const t=_.useNavigate(),{page:s,query:r,mode:a}=_.useSearch(),[n,o]=g.useState(r),[i,c]=g.useState(!1),d=g.useRef(null),l=r.trim(),{isLoading:h,isError:f,isSemanticSearchEnabled:v,isSemanticSearchAvailable:j}=Ne(),p=h||j?a:"lexical",U=j?"Use exact words or describe a half-remembered note":"Search notes by exact words";g.useEffect(()=>{o(r)},[r]);const b=g.useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null)},[]),N=g.useCallback((u,x=p,y=!1)=>{const S={query:u.trim(),page:1,mode:x};if(y){t({search:S,replace:!0});return}t({search:S})},[p,t]);g.useEffect(()=>{if(b(),!(i||n.trim()===l))return d.current=setTimeout(()=>{d.current=null,N(n,p,!0)},Te),b},[p,b,n,i,l,N]);const D=()=>{i||(b(),N(n))},F=u=>{b(),N(n,u)};return e.jsx(Z,{title:"Search",description:U,variant:"default",children:e.jsxs("main",{children:[e.jsx("section",{"aria-label":"Search controls",className:"border-b border-border-subtle pb-5",children:e.jsx(be,{value:n,onChange:o,onCompositionChange:c,mode:j?p:void 0,onModeChange:j?F:void 0,placeholder:j?"Search or describe a memory":"Search notes by keyword",onSubmit:D,onClear:()=>{b(),N("")},autoFocus:!l})}),l?h?e.jsx($,{}):e.jsx(ee,{fallback:e.jsx($,{}),errorTitle:"Failed to load search results",errorDescription:`Retry loading results for "${l}".`,resetKeys:[l,s,p],children:e.jsx(Ae,{searchParams:{query:l,limit:E,offset:(s-1)*E,mode:p},render:u=>e.jsxs("div",{className:"mt-5 flex flex-col gap-3",children:[e.jsx("div",{className:"flex min-h-7 items-center justify-between gap-3",children:e.jsx(m,{as:"p",variant:"body",weight:"semibold",tone:"secondary",children:Ce(u.totalCount)})}),e.jsx(Le,{result:u,mode:p}),u.notes.length>0?e.jsx("div",{className:"grid gap-3",children:u.notes.map(x=>{const y=Ee(x.content,l),S=u.matches.find(K=>K.noteId===x.id);return e.jsxs("article",{className:"surface-base flex flex-col gap-3.5 rounded-[16px] p-4 transition-colors hover:border-border-secondary/70 hover:bg-hover-subtle/25 sm:p-5",children:[e.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(m,{as:"h2",variant:"body",weight:"semibold",tracking:"tight",className:"min-w-0",children:e.jsx(C,{to:P,params:{id:x.id},className:"line-clamp-2 transition-colors hover:text-fg-default/85",children:e.jsx(B,{match:l,children:x.title||"Untitled"})})}),e.jsx(Re,{note:x})]}),e.jsx(je,{match:S})]}),y.length>0?e.jsx(_e,{blocks:y,query:l}):e.jsx("div",{className:"rounded-[14px] border border-dashed border-border-subtle/80 bg-muted/25 px-3.5 py-3",children:e.jsx(m,{as:"p",variant:"body",tone:"tertiary",className:"leading-[1.65]",children:"Open the note to inspect matching content."})}),e.jsx($e,{noteId:x.id})]},x.id)})}):e.jsx(A,{title:"No results found",description:p==="semantic"&&!u.semanticAvailable?"Meaning search must be configured before it can find related notes.":"Try another phrase or a different search method."}),u.totalCount>E&&e.jsx(te,{page:s,last:Math.ceil(u.totalCount/E),onChange:x=>{t({search:y=>({...y,page:x,mode:p})})}})]})})}):e.jsxs("div",{className:"py-10",children:[e.jsx(A,{title:"Start with anything you remember",description:"A name, phrase, rough date, or description all work."}),e.jsx(qe,{isVisible:!h&&!f&&!v})]})]})})}export{Ve as default};
@@ -1 +1 @@
1
- import{j as f}from"./floating-ui.react-dom-BWTnA00G.js";import{y as o}from"./note.api-BQovzEzd.js";const n=o("surface-base",{variants:{tone:{default:"",elevated:"surface-elevated"},padding:{default:"p-4",compact:"px-3 py-2.5",roomy:"p-6",flush:"overflow-hidden"}},defaultVariants:{tone:"default",padding:"default"}});function i({children:a,className:e,flush:t=!1,padding:d="default",tone:s="default"}){const r=t?"flush":d;return f.jsx("div",{className:n({tone:s,padding:r,className:e}),children:a})}export{i as S};
1
+ import{j as f}from"./floating-ui.react-dom-BWTnA00G.js";import{z as o}from"./note.api-D3oJmG3q.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};
@@ -0,0 +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,H as P,x as j,y as g,Q as E,F as R,k as q,E as C,l as x,h as I}from"./note.api-D3oJmG3q.js";import{s as A,T as O,a as L,i as F,b as Q,F as v}from"./app-1lOWtkRA.js";import{T as _,b as M}from"./url-9nrbQs7Z.js";import{f as B}from"./tag.api-DNSQpqwk.js";import{f as D}from"./Graph-LY_IgMYy.js";import"./time-D5LRMumI.js";import"./preload-helper-BXl3LOEh.js";const z=s=>{const{data:d}=T({queryKey:S.tags.list(s.searchParams),async queryFn(){const t=await B({query:s.searchParams.query,offset:s.searchParams.offset,limit:s.searchParams.limit,sortBy:s.searchParams.sortBy,sortOrder:s.searchParams.sortOrder});if(t.type==="error")throw t;return t.allTags}});return s.render(d)},G=s=>{const[d,t]=c.useState(!1),r=c.useRef(null),n=c.useRef(!0),u=c.useRef(0),o=c.useCallback(()=>{r.current!==null&&(clearTimeout(r.current),r.current=null)},[]);c.useEffect(()=>(n.current=!0,()=>{n.current=!1,o()}),[o]);const m=c.useCallback(p=>{u.current+=1;const i=u.current;o(),n.current&&t(!0),r.current=setTimeout(()=>{r.current=null,Promise.resolve().then(p).catch(()=>{}).finally(()=>{n.current&&u.current===i&&t(!1)})},s)},[o,s]);return[d,m]},b=I(M);function X(){const s=b.useNavigate(),{page:d,query:t,limit:r,sortBy:n,sortOrder:u}=b.useSearch(),[o,m]=c.useState(t),[,p]=G(350),i=t.trim();c.useEffect(()=>{m(t)},[t]),c.useEffect(()=>{const a=o.trim();a!==i&&p(()=>{s({search:l=>({...l,page:1,query:a})})})},[o,s,i,p]);const y=a=>{s({search:l=>({...l,...a})})},w=()=>{m(""),y({page:1,query:""})};return e.jsxs(k,{title:"Tags",description:"Find tags you added with @ across your notes",children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{className:"surface-base flex min-w-0 items-center gap-2 rounded-[16px] px-3.5 py-2.5 lg:w-72",children:[e.jsx(D,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Search"}),e.jsx("div",{className:"h-5 w-px bg-divider"}),e.jsx("input",{"aria-label":"Search tags",placeholder:"Search tags",value:o,onChange:a=>m(a.target.value),className:"h-8 min-w-0 flex-1 bg-transparent text-sm font-medium text-fg-default outline-none placeholder:text-xs placeholder:font-medium placeholder:text-fg-placeholder"}),(o||i)&&e.jsx("button",{type:"button","aria-label":"Clear tag search",className:"focus-ring-soft flex h-7 w-7 shrink-0 items-center justify-center rounded-[10px] text-fg-tertiary outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default",onClick:w,children:e.jsx(P,{className:"h-3.5 w-3.5",weight:"bold"})})]}),e.jsxs("div",{className:"surface-base inline-flex flex-wrap items-center gap-3 rounded-[16px] px-3.5 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Items"}),e.jsx(j,{value:String(r),onValueChange:a=>{const l=Number(a);F(l)&&y({limit:l,page:1})},variant:"ghost",size:"sm",children:O.map(a=>e.jsx(g,{value:String(a),children:a===L?`Default (${a})`:a},a))})]}),e.jsx("div",{className:"h-5 w-px bg-divider"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Sort"}),e.jsxs(j,{value:n,onValueChange:a=>y({sortBy:a,page:1}),variant:"ghost",size:"sm",children:[e.jsx(g,{value:"referenceCount",children:"Usage"}),e.jsx(g,{value:"name",children:"Name"})]}),e.jsxs(j,{value:u,onValueChange:a=>y({sortOrder:a,page:1}),variant:"ghost",size:"sm",children:[e.jsx(g,{value:"desc",children:n==="name"?"Z to A":"Most used"}),e.jsx(g,{value:"asc",children:n==="name"?"A to Z":"Least used"})]})]})]})]}),e.jsx(E,{fallback:e.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[e.jsx(x,{width:"90px",height:"36px"}),e.jsx(x,{width:"120px",height:"36px"}),e.jsx(x,{width:"80px",height:"36px"}),e.jsx(x,{width:"100px",height:"36px"}),e.jsx(x,{width:"110px",height:"36px"}),e.jsx(x,{width:"70px",height:"36px"})]}),errorTitle:"Failed to load tags",errorDescription:"Retry loading the tag catalog",resetKeys:[d,r,i,n,u],children:e.jsx(z,{searchParams:{query:i,offset:(d-1)*r,limit:r,sortBy:n,sortOrder:u},render:({tags:a,totalCount:l})=>e.jsx(v,{fallback:e.jsx(C,{title:i?"No matching tags":"No tags yet",description:i?"Try another tag name":"Add @tags inside notes and they will appear here"}),children:a.length>0&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"flex flex-wrap gap-2.5",children:a.map(h=>e.jsxs(R,{to:_,params:{id:h.id},search:{page:1},className:"inline-flex items-center gap-1.5 rounded-full border border-border-subtle bg-hover-subtle px-3 py-1.5 text-fg-secondary transition-colors hover:border-border-secondary hover:bg-hover hover:text-fg-default",children:[e.jsx(f,{as:"span",variant:"meta",weight:"medium",className:"text-current",children:h.name}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",className:"text-current/70",children:h.referenceCount})]},h.id))}),e.jsx(v,{fallback:null,children:l&&r<l&&e.jsx(q,{page:d,last:Math.ceil(l/r),onChange:h=>{s({search:N=>({...N,page:h,query:i,limit:r,sortBy:n,sortOrder:u})})}})})]})})})})]})}export{X as default};
@@ -0,0 +1 @@
1
+ import{j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{i as x,C as N,q as j,Q as y,P as c,k as P,E as T,l as o,h as v}from"./note.api-D3oJmG3q.js";import{F as h,N as k}from"./app-1lOWtkRA.js";import{T as q}from"./url-9nrbQs7Z.js";import"./NotePropertiesPanel-CsaNhRnE.js";import{e as w}from"./time-D5LRMumI.js";import"./preload-helper-BXl3LOEh.js";import"./Graph-LY_IgMYy.js";import"./AuxiliaryPanelHeader-B1k7pZpn.js";import"./Plus.es-DRfLW_bI.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{z as l}from"./note.api-BQovzEzd.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
+ import{r as a}from"./floating-ui.react-dom-BWTnA00G.js";import{A as l}from"./note.api-D3oJmG3q.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};
@@ -0,0 +1 @@
1
+ import{j as s}from"./floating-ui.react-dom-BWTnA00G.js";import{c as a}from"./note.api-D3oJmG3q.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};
@@ -0,0 +1 @@
1
+ import{r as s,j as t}from"./floating-ui.react-dom-BWTnA00G.js";import{e as z,a as P}from"./time-D5LRMumI.js";import{A as G,P as j,E as K,Q as J,l as p,h as X,u as Y,i as T,q as l,o as ee,k as te,B as q,F as se,T as ae,e as re}from"./note.api-D3oJmG3q.js";import{f as ie}from"./tag.api-DNSQpqwk.js";import{f as ne,a as oe,g as le,V as ce,b as de,c as pe,u as C,d as ue}from"./ViewSectionDialog-DhH8harC.js";import{F as A,N as he}from"./app-1lOWtkRA.js";import{V as me,c as ge}from"./url-9nrbQs7Z.js";import"./NotePropertiesPanel-CsaNhRnE.js";import{V as v}from"./ViewChip-DlCkL4z4.js";import{m as fe}from"./PencilLine.es-0JpEgxFY.js";import"./preload-helper-BXl3LOEh.js";import"./Graph-LY_IgMYy.js";import"./AuxiliaryPanelHeader-B1k7pZpn.js";import"./Plus.es-DRfLW_bI.js";const ye=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"}))]]),M=s.forwardRef((n,o)=>s.createElement(G,{ref:o,...n,weights:ye}));M.displayName="ArrowLeftIcon";const xe=M,b=X(me);function we(){const n=b.useNavigate(),o=Y(),N=re(),{page:u,sectionId:d}=b.useSearch(),{onDelete:k,onPinned:L,deleteWarningDialog:R}=z(),[S,g]=s.useState(!1),[f,y]=s.useState(!1),i=25,{data:a}=T({queryKey:l.views.section(d),async queryFn(){const e=await ne(d);if(e.type==="error")throw e;if(!e.viewSection)throw new Error("View section not found.");return e.viewSection}}),{data:r}=T({queryKey:l.views.sectionNotes(d,{limit:i,offset:(u-1)*i}),async queryFn(){const e=await oe(d,{limit:i,offset:(u-1)*i});if(e.type==="error")throw e;return e.viewSectionNotes}}),{data:D,isPending:H}=P({queryKey:l.tags.list({limit:200}),enabled:f,async queryFn(){const e=await ie({limit:200});if(e.type==="error")throw e;return e.allTags}}),{data:I,isPending:O}=P({queryKey:l.notes.propertyKeys({limit:100}),enabled:f,async queryFn(){const e=await ee({limit:100});if(e.type==="error")throw e;return e.notePropertyKeys}}),x=a.title,h=a.tagNames,Q=a.mode,w=a.propertyFilters,Z=h.length>0,E=w.length>0,V=h.length>1?` · ${le(Q)}`:"",$=Z?E?`Property and tag filters${V}`:`Tag filters${V}`:E?"Property filters":"All notes",F=t.jsx(A,{fallback:null,children:r.totalCount&&i<r.totalCount&&t.jsx(te,{page:u,last:Math.ceil(r.totalCount/i),onChange:e=>{n({search:c=>({...c,page:e})})}})}),B=D?.tags??[],U=I?.keys??[],W=async e=>{if(S)return;const c=a.sortBy===e?a.sortOrder==="asc"?"desc":"asc":e==="title"?"asc":"desc";g(!0);const m=await C(a.id,ue(a,{sortBy:e,sortOrder:c}));if(m.type==="error"){N(m.errors[0]?.message??"Failed to update table sort."),g(!1);return}await o.invalidateQueries({queryKey:l.views.all(),exact:!1}),g(!1)},_=async e=>{const c=await C(a.id,e);if(c.type==="error"){N(c.errors[0]?.message??"Failed to update section.");return}await o.invalidateQueries({queryKey:l.views.all(),exact:!1}),n({search:m=>({...m,page:1})}),y(!1)};return t.jsxs(t.Fragment,{children:[t.jsxs(j,{title:x,heading:r.totalCount>0?`${x} (${r.totalCount})`:x,description:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(ae,{as:"span",variant:"meta",tone:"tertiary",children:$}),t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[h.map(e=>t.jsx(v,{className:"max-w-full border-border-subtle bg-hover-subtle text-fg-secondary",children:e},e)),w.map(e=>t.jsx(v,{className:"max-w-full border-border-subtle bg-hover-subtle text-fg-secondary",children:de(e)},`${e.key}-${e.operator}-${e.value??""}`)),h.length===0&&w.length===0&&t.jsx(v,{className:"max-w-full border-border-subtle bg-hover-subtle text-fg-secondary",children:"All notes"})]})]}),headerRight:t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx(q,{asChild:!0,variant:"ghost",size:"sm",children:t.jsxs(se,{to:ge,children:[t.jsx(xe,{className:"h-4 w-4"}),"Back to Views"]})}),t.jsxs(q,{type:"button",variant:"subtle",size:"sm",onClick:()=>y(!0),children:[t.jsx(fe,{className:"h-4 w-4"}),"Edit section"]})]}),children:[t.jsx(A,{fallback:t.jsx(K,{title:"No notes match this saved view",description:"Adjust this view's filters or keep writing until matching notes appear."}),children:r.notes.length>0&&a.displayType==="table"?t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(ce,{section:a,notes:r.notes,isPending:!1,isError:!1,surface:"card",onRetry:()=>{o.invalidateQueries({queryKey:l.views.sectionNotes(d,{limit:i,offset:(u-1)*i})})},onSortChange:W,isSortPending:S}),F]}):r.notes.length>0?t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx("div",{className:"grid-auto-cards grid gap-5",children:r.notes.map(e=>t.jsx(he,{...e,onPinned:()=>L(e.id,e.pinned),onDelete:()=>k(e.id)},e.id))}),F]}):null}),R]}),t.jsx(pe,{open:f,mode:"edit",initialSection:a,availableTags:B,availableProperties:U,isTagsLoading:H,isPropertiesLoading:O,onClose:()=>y(!1),onSubmit:_})]})}function Me(){const{sectionId:n,page:o}=b.useSearch();return n?t.jsx(J,{fallback:t.jsx(j,{title:"View Notes",heading:t.jsx(p,{width:180,height:24,className:"rounded-full"}),description:t.jsx(p,{width:220,height:16,className:"rounded-full"}),children:t.jsxs("div",{className:"grid-auto-cards grid gap-5",children:[t.jsx(p,{height:"112px"}),t.jsx(p,{height:"112px"}),t.jsx(p,{height:"112px"})]})}),errorTitle:"Failed to load view notes",errorDescription:"Retry loading notes for this saved view section",resetKeys:[o,n],children:t.jsx(we,{})}):t.jsx(j,{title:"View Notes",description:"Saved view note lists require a section id.",children:t.jsx(K,{title:"No section selected",description:"Return to Views and open a section from there."})})}export{Me as default};
@@ -0,0 +1,102 @@
1
+ import{g as v,T as d,B as V,F as ze,M as P,L as f,I as ae,a as re,b as R,D as _e,x as T,y as m,d as Me}from"./note.api-D3oJmG3q.js";import{j as t,r as g}from"./floating-ui.react-dom-BWTnA00G.js";import{t as ne,M as qe}from"./time-D5LRMumI.js";import{N as Be}from"./url-9nrbQs7Z.js";import{V as W}from"./ViewChip-DlCkL4z4.js";const Z=`
2
+ id
3
+ tabId
4
+ title
5
+ displayType
6
+ displayOptions {
7
+ tableColumns
8
+ }
9
+ tagNames
10
+ mode
11
+ propertyFilters {
12
+ key
13
+ name
14
+ valueType
15
+ operator
16
+ value
17
+ }
18
+ sortBy
19
+ sortOrder
20
+ limit
21
+ order
22
+ `;function lt(){return v(`query FetchViewWorkspace {
23
+ viewWorkspace {
24
+ activeTabId
25
+ tabs {
26
+ id
27
+ title
28
+ order
29
+ sections {
30
+ ${Z}
31
+ }
32
+ }
33
+ }
34
+ }`)}function ot(e){return v(`query FetchViewSection($id: ID!) {
35
+ viewSection(id: $id) {
36
+ ${Z}
37
+ }
38
+ }`,{id:e})}function dt(e,{limit:a=25,offset:s=0}={}){return v(`query FetchViewSectionNotes($id: ID!, $pagination: PaginationInput) {
39
+ viewSectionNotes(id: $id, pagination: $pagination) {
40
+ totalCount
41
+ notes {
42
+ id
43
+ title
44
+ pinned
45
+ tags {
46
+ id
47
+ name
48
+ }
49
+ createdAt
50
+ updatedAt
51
+ properties {
52
+ key
53
+ name
54
+ value
55
+ valueType
56
+ option { id label value color order }
57
+ createdAt
58
+ updatedAt
59
+ }
60
+ }
61
+ }
62
+ }`,{id:e,pagination:{limit:a,offset:s}})}function ct(e){return v(`mutation CreateViewTab($title: String!) {
63
+ createViewTab(title: $title) {
64
+ id
65
+ }
66
+ }`,{title:e})}function ut(e,a){return v(`mutation UpdateViewTab($id: ID!, $title: String!) {
67
+ updateViewTab(id: $id, title: $title) {
68
+ id
69
+ }
70
+ }`,{id:e,title:a})}function pt(e){return v(`mutation DeleteViewTab($id: ID!) {
71
+ deleteViewTab(id: $id)
72
+ }`,{id:e})}function mt(e){return v(`mutation SetActiveViewTab($id: ID!) {
73
+ setActiveViewTab(id: $id) {
74
+ activeTabId
75
+ tabs {
76
+ id
77
+ title
78
+ order
79
+ sections {
80
+ ${Z}
81
+ }
82
+ }
83
+ }
84
+ }`,{id:e})}function bt(e){return v(`mutation ReorderViewTabs($tabIds: [ID!]!) {
85
+ reorderViewTabs(tabIds: $tabIds) {
86
+ id
87
+ }
88
+ }`,{tabIds:e})}function xt(e,a){return v(`mutation CreateViewSection($tabId: ID!, $input: ViewSectionInput!) {
89
+ createViewSection(tabId: $tabId, input: $input) {
90
+ id
91
+ }
92
+ }`,{tabId:e,input:a})}function ht(e,a){return v(`mutation UpdateViewSection($id: ID!, $input: ViewSectionInput!) {
93
+ updateViewSection(id: $id, input: $input) {
94
+ id
95
+ }
96
+ }`,{id:e,input:a})}function gt(e){return v(`mutation DeleteViewSection($id: ID!) {
97
+ deleteViewSection(id: $id)
98
+ }`,{id:e})}function vt(e,a){return v(`mutation ReorderViewSections($tabId: ID!, $sectionIds: [ID!]!) {
99
+ reorderViewSections(tabId: $tabId, sectionIds: $sectionIds) {
100
+ id
101
+ }
102
+ }`,{tabId:e,sectionIds:a})}const X=["title","tags","properties","createdAt","updatedAt"],yt={activeTabId:null,tabs:[]},Pe=e=>{const a=e.trim();return a?a.startsWith("@")?a:a.startsWith("#")?"":`@${a}`:""},ye=(e,a,s)=>{if(a===s)return e;const n=e.findIndex(x=>x.id===a),l=e.findIndex(x=>x.id===s);if(n<0||l<0)return e;const b=[...e],[j]=b.splice(n,1);return b.splice(l,0,j),b},fe=(e,a,s)=>{const n=e.findIndex(b=>b.id===a),l=n+(s==="previous"?-1:1);return n>=0&&l>=0&&l<e.length?e[l]?.id:void 0},ie=e=>{const a=e.flatMap(s=>typeof s=="string"?s.split(","):[]);return Array.from(new Set(a.map(Pe).filter(Boolean)))},ft=e=>e.tabs.length===0?null:e.activeTabId?e.tabs.find(a=>a.id===e.activeTabId)??e.tabs[0]??null:e.tabs[0]??null,jt=(e,a)=>e.tabs.some(s=>s.id===a)?{...e,activeTabId:a}:e,Re=(e,a,s)=>({...e,tabs:ye(e.tabs,a,s)}),We=(e,a,s,n)=>({...e,tabs:e.tabs.map(l=>l.id===a?{...l,sections:ye(l.sections,s,n)}:l)}),wt=(e,a,s)=>{const n=fe(e.tabs,a,s);return n?Re(e,a,n):e},Nt=(e,a,s,n)=>{const l=e.tabs.find(j=>j.id===a)?.sections??[],b=fe(l,s,n);return b?We(e,a,s,b):e},le=e=>e==="or"?"OR — any selected tag":"AND — all selected tags",Tt=e=>e==="or"?"OR":"AND",je=e=>{switch(e){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"}},Ue=e=>{switch(e){case"table":return"Table";case"calendar":return"Unavailable";default:return"List"}},we=e=>{switch(e){case"tags":return"Tags";case"properties":return"Properties";case"createdAt":return"Created";case"updatedAt":return"Updated";default:return"Title"}},U=e=>{const a=new Set(X),s=(e??[]).filter(l=>a.has(l)),n=Array.from(new Set(s));return n.length===0?[...X]:n.includes("title")?n:["title",...n]},Ne=e=>({tableColumns:U(e?.tableColumns)}),Vt=e=>{const a=je(e.operator);return e.operator==="exists"||e.operator==="notExists"?`${e.name} ${a}`:`${e.name} ${a} ${e.value??""}`.trim()},It=(e,a={})=>{const s={...e,...a};return{title:s.title,displayType:s.displayType,displayOptions:Ne(s.displayOptions),tagNames:s.tagNames,mode:s.mode,propertyFilters:s.propertyFilters.map(n=>({key:n.key,valueType:n.valueType,operator:n.operator,value:n.value})),sortBy:s.sortBy,sortOrder:s.sortOrder,limit:s.limit}},Ct=e=>({page:1,sectionId:e.id}),He=e=>e.valueType==="select"?e.option?.label??e.value:e.valueType==="boolean"?e.value==="true"?"True":"False":e.value,Ye=e=>(e.properties??[]).slice(0,3),Te={title:280,tags:190,properties:260,createdAt:132,updatedAt:132},Ge={title:"title",createdAt:"createdAt",updatedAt:"updatedAt"},Ve="flex h-[22px] min-w-0 max-w-full items-center gap-1.5 overflow-hidden whitespace-nowrap",Ie="text-xs leading-5 text-fg-tertiary",Ke=e=>{const a=e.reduce((s,n)=>s+Te[n],0);return Math.max(520,a)},Qe=(e,a={})=>{if(e.tags.length===0)return a.hideEmpty?null:t.jsx("span",{className:Ie,children:"—"});const s=e.tags.slice(0,3),n=e.tags.length-s.length;return t.jsxs("div",{className:Ve,children:[s.map(l=>t.jsx(W,{size:"compact",className:"max-w-[132px] shrink-0 border-border-subtle bg-transparent text-fg-secondary",children:l.name},l.id)),n>0&&t.jsxs(W,{size:"compact",className:"shrink-0 border-border-subtle bg-subtle text-fg-tertiary",children:["+",n]})]})},Je=(e,a={})=>{const s=Ye(e);if(s.length===0)return a.hideEmpty?null:t.jsx("span",{className:Ie,children:"—"});const n=(e.properties?.length??0)-s.length;return t.jsxs("div",{className:Ve,children:[s.map(l=>t.jsxs(W,{size:"compact",truncateContent:!1,className:"max-w-[190px] shrink-0 gap-1 border-border-subtle bg-subtle text-fg-secondary",children:[t.jsx("span",{className:"min-w-0 max-w-[76px] shrink truncate text-fg-tertiary",children:l.name}),t.jsx("span",{className:"min-w-0 truncate",children:He(l)||"—"})]},l.key)),n>0&&t.jsxs(W,{size:"compact",className:"shrink-0 border-border-subtle bg-subtle text-fg-tertiary",children:["+",n]})]})};function St({section:e,notes:a,isPending:s,isError:n,onRetry:l,onSortChange:b,isSortPending:j,surface:x="flush"}){const I=U(e.displayOptions?.tableColumns),L=Ke(I),z=x==="card"?"overflow-x-auto rounded-[16px] border border-border-subtle bg-elevated":"overflow-x-auto bg-transparent",C=x==="card"?"overflow-hidden rounded-[16px] border border-border-subtle bg-elevated":"overflow-hidden bg-transparent",S=x==="card"?"bg-elevated":"bg-transparent",F=x==="card"?"bg-subtle/65":"bg-subtle/45",_=x==="card"?"bg-elevated":"bg-transparent",E=c=>{const u=Ge[c],O=we(c),k=u?e.sortBy===u:!1;return t.jsx("th",{"aria-sort":k?e.sortOrder==="asc"?"ascending":"descending":void 0,className:"px-3 py-2.5 text-xs font-semibold text-fg-tertiary",children:u?t.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:j,onClick:()=>b(u),children:[t.jsx("span",{children:O}),t.jsx("span",{"aria-hidden":"true",className:"text-[10px] text-fg-tertiary",children:k?e.sortOrder==="asc"?"↑":"↓":"↕"})]}):O},c)},A=(c,u)=>{switch(u){case"tags":return t.jsx("td",{className:"overflow-hidden px-3 py-2.5 align-middle",children:Qe(c)},u);case"properties":return t.jsx("td",{className:"overflow-hidden px-3 py-2.5 align-middle",children:Je(c)},u);case"createdAt":return t.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 align-middle",children:t.jsx(d,{as:"span",variant:"meta",tone:"tertiary",children:ne(Number(c.createdAt))})},u);case"updatedAt":return t.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 align-middle",children:t.jsx(d,{as:"span",variant:"meta",tone:"tertiary",children:ne(Number(c.updatedAt))})},u);default:return t.jsx("td",{className:"px-3 py-2.5 align-middle",children:t.jsx(d,{as:"div",variant:"body",weight:"semibold",className:"line-clamp-1",children:t.jsx(ze,{to:Be,params:{id:c.id},className:"focus-ring-soft rounded-[6px] outline-none transition-colors hover:text-fg-default/85",children:c.title||"Untitled"})})},u)}};return s?t.jsxs("div",{className:C,children:[t.jsx("div",{className:"h-11 animate-pulse bg-subtle/50"}),t.jsx("div",{className:`h-14 animate-pulse border-t border-border-subtle ${S}`}),t.jsx("div",{className:`h-14 animate-pulse border-t border-border-subtle ${S}`}),t.jsx("div",{className:`h-14 animate-pulse border-t border-border-subtle ${S}`})]}):n?t.jsxs("div",{className:"rounded-[16px] border border-border-subtle bg-subtle/30 p-4",children:[t.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"Failed to load this table"}),t.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Retry to refresh this saved query."}),t.jsx("div",{className:"mt-3",children:t.jsx(V,{type:"button",variant:"ghost",size:"sm",onClick:l,children:"Retry"})})]}):a.length===0?t.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle px-4 py-5",children:[t.jsx(d,{as:"p",variant:"body",weight:"semibold",children:"No rows yet"}),t.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Add matching notes, or edit this view query."})]}):t.jsx("div",{className:z,children:t.jsxs("table",{className:"w-full table-fixed border-collapse text-left",style:{minWidth:L},children:[t.jsx("caption",{className:"sr-only",children:"View query results as a table"}),t.jsx("colgroup",{children:I.map(c=>t.jsx("col",{style:{width:Te[c]}},c))}),t.jsx("thead",{className:F,children:t.jsx("tr",{className:"border-b border-border-subtle",children:I.map(E)})}),t.jsx("tbody",{className:_,children:a.map(c=>t.jsx("tr",{className:"h-12 border-b border-border-subtle/70 last:border-b-0",children:I.map(u=>A(c,u))},c.id))})]})})}const Q="__choose_property__",Xe=["title","tags","properties","createdAt","updatedAt"],oe=e=>String(e?.limit??5),de=e=>e?.displayType==="table"?"table":"list",ce=e=>U(e?.displayOptions?.tableColumns??X),ue=e=>e?.mode??"and",pe=e=>e?e.tagNames.join(", "):"",me=e=>e?.title??"",be=e=>e?.sortBy??"updatedAt",xe=e=>e?.sortOrder??"desc",Ce=e=>`property-filter-${Date.now()}-${e}`,he=e=>(e?.propertyFilters??[]).map((a,s)=>({id:Ce(s),key:a.key,operator:a.operator,value:a.value??""})),ge=e=>e?e.valueType==="date"||e.valueType==="number"?["equals","notEquals","before","after","exists","notExists"]:e.valueType==="text"||e.valueType==="url"?["equals","notEquals","contains","notContains","exists","notExists"]:["equals","notEquals","exists","notExists"]:["exists","notExists"],ve=e=>e?"equals":"exists",Ze=e=>e?e.valueType==="boolean"?"true":e.valueType==="select"?e.options[0]?.value??"":"":"",J=e=>e!=="exists"&&e!=="notExists",Se=e=>e==="contains"||e==="notContains",et=(e,a)=>e.valueType==="date"?"date":e.valueType==="number"?"number":e.valueType==="url"&&!Se(a)?"url":"text",tt=(e,a)=>{if(e.valueType==="url")return Se(a)?"example.com":"https://example.com";if(e.valueType==="text")return"Value"};function At({open:e,mode:a,initialSection:s=null,availableTags:n,availableProperties:l,isTagsLoading:b=!1,isPropertiesLoading:j=!1,onClose:x,onSubmit:I}){const[L,z]=g.useState(me(s)),[C,S]=g.useState(de(s)),[F,_]=g.useState(ce(s)),[E,A]=g.useState(pe(s)),[c,u]=g.useState(ue(s)),[O,k]=g.useState(be(s)),[ee,te]=g.useState(xe(s)),[H,se]=g.useState(oe(s)),[$,M]=g.useState(he(s)),[Ae,Y]=g.useState((s?.tagNames.length??0)>0),[G,h]=g.useState(""),q=g.useMemo(()=>new Map(l.map(r=>[r.key,r])),[l]);g.useEffect(()=>{e&&(z(me(s)),S(de(s)),_(ce(s)),A(pe(s)),u(ue(s)),k(be(s)),te(xe(s)),se(oe(s)),M(he(s)),Y((s?.tagNames.length??0)>0),h(""))},[s,e]);const w=ie([E]),B=Ae||w.length>0,$e=w.length===0&&$.length===0,Fe=r=>{r!=="title"&&(_(o=>{if(o.includes(r)){const y=o.filter(i=>i!==r);return y.length>0?y:o}return U([...o,r])}),h(""))},Ee=r=>{const o=w.includes(r)?w.filter(y=>y!==r):[...w,r];A(o.join(", ")),h("")},Oe=()=>{Y(!0),h("")},ke=()=>{A(""),u("and"),Y(!1),h("")},De=()=>{if(l.length===0){h("Create a shared property before adding a filter.");return}M(r=>[...r,{id:Ce(r.length),key:"",operator:"exists",value:""}]),h("")},D=(r,o)=>{M(y=>y.map(i=>{if(i.id!==r)return i;const N={...i,...o},p=q.get(N.key);return ge(p).includes(N.operator)||(N.operator=ve(p)),"key"in o&&(N.value=Ze(p),N.operator=ve(p)),N})),h("")},Le=r=>{M(o=>o.filter(y=>y.id!==r)),h("")};return t.jsxs(P,{isOpen:e,onClose:x,variant:"form",className:"sm:max-w-[720px]",children:[t.jsx(P.Header,{title:a==="create"?"Create section":"Edit section",onClose:x}),t.jsx(P.Body,{children:t.jsxs("form",{id:"view-section-form",className:"flex flex-col gap-5",onSubmit:r=>{r.preventDefault();const o=ie([E]);if(B&&o.length===0){h("Choose at least one tag, or remove this tag filter.");return}if($.find(p=>!p.key||!q.has(p.key))){h("Choose a property for every filter.");return}const i=$.map(p=>{const K=q.get(p.key);return{key:K?.key??p.key,valueType:K?.valueType??"text",operator:p.operator,value:J(p.operator)?p.value:null}});if(i.some(p=>J(p.operator)&&!p.value?.trim())){h("Fill every filter value, or switch it to is set / is empty.");return}I({title:L,displayType:C,displayOptions:Ne({tableColumns:F}),tagNames:o,mode:c,propertyFilters:i,sortBy:O,sortOrder:ee,limit:Number(H)})},children:[t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(f,{htmlFor:"view-section-title",size:"md",children:"Section name"}),t.jsx(ae,{id:"view-section-title",value:L,onChange:r=>z(r.target.value),placeholder:"Doing notes",autoFocus:!0})]}),t.jsxs("section",{className:"flex flex-col gap-3 rounded-[18px] border border-border-subtle bg-elevated px-4 py-3",children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx(f,{size:"md",children:"Display"}),t.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Show the same query as a compact list or a table."})]}),t.jsx(d,{as:"span",variant:"meta",tone:"tertiary",children:Ue(C)})]}),t.jsxs(re,{type:"single",value:C,onValueChange:r=>{(r==="list"||r==="table")&&S(r)},variant:"quiet",size:"sm",className:"self-start",children:[t.jsx(R,{value:"list","aria-label":"Show as list",children:"List"}),t.jsx(R,{value:"table","aria-label":"Show as table",children:"Table"})]}),C==="table"?t.jsxs("div",{className:"rounded-[16px] border border-border-subtle bg-subtle/45 p-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsx(f,{size:"sm",children:"Table columns"}),t.jsxs(d,{as:"span",variant:"meta",tone:"tertiary",children:[F.length," shown"]})]}),t.jsx("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:Xe.map(r=>{const o=we(r);return t.jsxs("div",{className:"flex items-center gap-2 rounded-[12px] border border-border-subtle bg-elevated px-3 py-2",children:[t.jsx(_e,{size:"sm",checked:F.includes(r),disabled:r==="title","aria-label":`Show ${o} column`,onChange:()=>Fe(r)}),t.jsx(d,{as:"span",variant:"label",tone:"secondary",children:o})]},r)})}),t.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-2",children:"Title is always shown because it opens the note."})]}):null]}),t.jsxs("section",{className:"flex flex-col gap-3 rounded-[20px] border border-border-subtle bg-subtle/40 p-4",children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx(f,{size:"md",children:"Filters"}),t.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Use properties for structured fields, and tags for loose topics or context."})]}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(V,{type:"button",variant:"subtle",size:"sm",onClick:De,children:"Add property filter"}),!B&&t.jsx(V,{type:"button",variant:"subtle",size:"sm",onClick:Oe,children:"Add tag filter"})]})]}),$.length===0&&!B?t.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle bg-elevated/60 px-4 py-3",children:[t.jsx(d,{as:"p",variant:"label",tone:"default",children:$e?"All notes":"No filters"}),t.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,$.length>0?t.jsx("div",{className:"flex flex-col gap-2.5",children:$.map(r=>{const o=q.get(r.key),y=ge(o);return t.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:[t.jsxs(T,{value:r.key||Q,ariaLabel:"Property filter property",className:"w-full min-w-0",onValueChange:i=>{i!==Q&&D(r.id,{key:i})},children:[t.jsx(m,{value:Q,disabled:!0,children:"Choose property"}),l.map(i=>t.jsx(m,{value:i.key,children:i.name},i.key))]}),t.jsx(T,{value:r.operator,disabled:!o,ariaLabel:"Property filter operator",className:"w-full min-w-0",onValueChange:i=>D(r.id,{operator:i}),children:y.map(i=>t.jsx(m,{value:i,children:je(i)},i))}),J(r.operator)&&o?o.valueType==="select"?t.jsx(T,{value:r.value,ariaLabel:"Property filter value",className:"w-full min-w-0",onValueChange:i=>D(r.id,{value:i}),children:o.options.map(i=>t.jsx(m,{value:i.value,children:i.label},i.value))}):o.valueType==="boolean"?t.jsxs(T,{value:r.value||"true",ariaLabel:"Property filter value",className:"w-full min-w-0",onValueChange:i=>D(r.id,{value:i}),children:[t.jsx(m,{value:"true",children:"True"}),t.jsx(m,{value:"false",children:"False"})]}):t.jsx(ae,{type:et(o,r.operator),value:r.value,onChange:i=>D(r.id,{value:i.target.value}),placeholder:tt(o,r.operator),"aria-label":"Property filter value"}):t.jsx(d,{as:"span",variant:"label",tone:"tertiary",children:o?"No value needed":"Choose a property first"}),t.jsx(V,{type:"button",variant:"ghost",size:"sm",onClick:()=>Le(r.id),children:"Remove"})]},r.id)})}):null,B?t.jsxs("div",{className:"flex flex-col gap-3 rounded-[16px] border border-border-subtle bg-elevated p-3",children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx(d,{as:"p",variant:"label",tone:"default",children:"Tag filter"}),t.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Match notes by selected tags."})]}),t.jsx(V,{type:"button",variant:"ghost",size:"sm",onClick:ke,children:"Remove"})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(f,{htmlFor:"view-section-tags",size:"sm",children:"Tag names"}),t.jsx(Me,{id:"view-section-tags",value:E,onChange:r=>{A(r.target.value),h("")},placeholder:"@OceanBrain, @todo",size:"sm"}),t.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"You can use tags only, properties only, both together, or no filters."})]}),w.length>1?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(f,{size:"sm",children:"Tag match"}),t.jsxs(re,{type:"single",value:c,onValueChange:r=>{(r==="and"||r==="or")&&u(r)},variant:"quiet",size:"sm",className:"self-start",children:[t.jsx(R,{value:"and","aria-label":le("and"),children:"AND"}),t.jsx(R,{value:"or","aria-label":le("or"),children:"OR"})]}),t.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"AND requires every selected tag. OR accepts any selected tag."})]}):null,t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(f,{size:"sm",children:"Existing tags"}),t.jsx(d,{as:"span",variant:"meta",tone:"tertiary",children:b?"Loading...":`${n.length} available`})]}),n.length>0?t.jsx("div",{className:"max-h-44 overflow-y-auto rounded-[16px] border border-border-subtle bg-hover-subtle/60 p-3",children:t.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(r=>{const o=w.includes(r.name);return t.jsx("button",{type:"button",className:`inline-flex items-center rounded-full border px-3 py-1.5 text-sm font-medium transition-colors ${o?"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":o,onClick:()=>Ee(r.name),children:r.name},r.id)})})}):t.jsx(d,{as:"p",variant:"meta",tone:"tertiary",children:"No tags yet. You can still type tag names manually."})]}):null,t.jsx(d,{as:"p",variant:"meta",tone:G?"default":"tertiary",className:G?"text-fg-error":void 0,children:G||(j||b?"Loading filter options...":`${l.length} properties · ${n.length} tags available`)})]}),t.jsxs("details",{className:"group rounded-[18px] border border-border-subtle bg-elevated px-4 py-3",children:[t.jsx("summary",{className:"cursor-pointer list-none",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx(d,{as:"span",variant:"label",tone:"default",children:"Sort and limit"}),t.jsx(d,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Controls how many matching notes appear on the Views page preview."})]}),t.jsxs(d,{as:"span",variant:"meta",tone:"tertiary",children:[H," notes"]})]})}),t.jsxs("div",{className:"mt-4 grid gap-4 md:grid-cols-3",children:[t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(f,{id:"view-section-sort-by-label",htmlFor:"view-section-sort-by",size:"sm",children:"Sort by"}),t.jsxs(T,{id:"view-section-sort-by",value:O,"aria-labelledby":"view-section-sort-by-label",onValueChange:r=>k(r),children:[t.jsx(m,{value:"updatedAt",children:"Updated time"}),t.jsx(m,{value:"createdAt",children:"Created time"}),t.jsx(m,{value:"title",children:"Title"})]})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(f,{id:"view-section-sort-order-label",htmlFor:"view-section-sort-order",size:"sm",children:"Order"}),t.jsxs(T,{id:"view-section-sort-order",value:ee,"aria-labelledby":"view-section-sort-order-label",onValueChange:r=>te(r),children:[t.jsx(m,{value:"desc",children:"Descending"}),t.jsx(m,{value:"asc",children:"Ascending"})]})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(f,{id:"view-section-limit-label",htmlFor:"view-section-limit",size:"sm",children:"Preview rows"}),t.jsxs(T,{id:"view-section-limit",value:H,"aria-labelledby":"view-section-limit-label",onValueChange:se,children:[t.jsx(m,{value:"3",children:"3 rows"}),t.jsx(m,{value:"5",children:"5 rows"}),t.jsx(m,{value:"8",children:"8 rows"}),t.jsx(m,{value:"10",children:"10 rows"}),t.jsx(m,{value:"12",children:"12 rows"})]})]})]})]})]})}),t.jsx(P.Footer,{children:t.jsxs(qe,{children:[t.jsx(V,{type:"button",variant:"ghost",size:"sm",onClick:x,children:"Cancel"}),t.jsx(V,{type:"submit",size:"sm",form:"view-section-form",children:a==="create"?"Create section":"Save section"})]})})]})}export{yt as E,St as V,dt as a,Vt as b,At as c,It as d,Ct as e,ot as f,le as g,Tt as h,Ue as i,lt as j,ft as k,mt as l,wt as m,We as n,Nt as o,ct as p,ut as q,Re as r,jt as s,pt as t,ht as u,xt as v,gt as w,bt as x,vt as y};
@@ -0,0 +1 @@
1
+ import{j as e,r as T}from"./floating-ui.react-dom-BWTnA00G.js";import{u as G,d as E,e as H,K as Y,M as ge,D as J,r as we,f as X,S as Z,h as ye,g as ee,C as te,P as ve,j as je,v as Ne,m as Se}from"./app-1lOWtkRA.js";import{t as ke,a as D,f as se,M as Te,u as Ce}from"./time-D5LRMumI.js";import{T as h,B as y,F as K,u as ae,q as g,G as re,e as ie,c as z,M as V,L as Ve,I as De,o as Ee,P as Re,l as I,E as _}from"./note.api-D3oJmG3q.js";import{f as We}from"./tag.api-DNSQpqwk.js";import{V as qe,e as Ae,a as Fe,h as Pe,i as Ie,b as Ke,u as ne,d as oe,j as ze,k as Me,E as Le,c as Oe,r as Qe,m as $e,s as _e,l as Ue,n as Be,o as Ge,p as He,q as Ye,t as Je,v as U,w as Xe,x as Ze,y as et}from"./ViewSectionDialog-DhH8harC.js";import{S as M}from"./SurfaceCard-t7pdfhEe.js";import{N as tt,V as B}from"./url-9nrbQs7Z.js";import{V as S}from"./ViewChip-DlCkL4z4.js";import{s as st}from"./ArrowRight.es-BEhnlwfe.js";import{n as L}from"./Plus.es-DRfLW_bI.js";import"./preload-helper-BXl3LOEh.js";import"./Graph-LY_IgMYy.js";const at="group flex min-h-[64px] items-start justify-between gap-3 px-3 py-2.5 transition-colors hover:bg-hover-subtle",rt=s=>{const i=s.tags.slice(0,2),n=s.tags.length-i.length;return i.length===0?null:e.jsxs(e.Fragment,{children:[i.map(c=>e.jsx(S,{size:"compact",className:"max-w-[116px] shrink-0 border-border-subtle bg-transparent text-fg-secondary",children:c.name},c.id)),n>0&&e.jsxs(S,{size:"compact",className:"shrink-0 border-border-subtle bg-subtle text-fg-tertiary",children:["+",n]})]})};function it({notes:s,isPending:i,isError:n,onRetry:c}){return i?e.jsxs("div",{className:"overflow-hidden bg-transparent",children:[e.jsx("div",{className:"h-[64px] animate-pulse bg-subtle/35"}),e.jsx("div",{className:"h-[64px] animate-pulse border-t border-border-subtle/70 bg-subtle/35"}),e.jsx("div",{className:"h-[64px] animate-pulse border-t border-border-subtle/70 bg-subtle/35"})]}):n?e.jsxs("div",{className:"rounded-[16px] border border-border-subtle bg-subtle/30 p-4",children:[e.jsx(h,{as:"p",variant:"body",weight:"semibold",children:"Failed to load this section"}),e.jsx(h,{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(y,{type:"button",variant:"ghost",size:"sm",onClick:c,children:"Retry"})})]}):s.length===0?e.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle px-4 py-5",children:[e.jsx(h,{as:"p",variant:"body",weight:"semibold",children:"No notes match yet"}),e.jsx(h,{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:s.map(o=>e.jsxs(K,{to:tt,params:{id:o.id},className:at,children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(h,{as:"div",variant:"body",weight:"semibold",className:"line-clamp-1",children:o.title||"Untitled"}),e.jsxs("div",{className:"mt-1.5 flex min-w-0 flex-wrap items-center gap-1.5",children:[e.jsxs(h,{as:"span",variant:"label",weight:"medium",tone:"secondary",className:"mr-0.5",children:["Updated ",ke(Number(o.updatedAt))]}),rt(o)]})]}),e.jsx(st,{className:"mt-0.5 h-4 w-4 shrink-0 text-fg-tertiary transition-transform group-hover:translate-x-0.5"})]},o.id))})}function nt({onEdit:s}){return e.jsxs("div",{className:"rounded-[16px] border border-dashed border-border-subtle bg-subtle/40 px-4 py-5",children:[e.jsx(h,{as:"p",variant:"body",weight:"semibold",children:"This display type is unavailable"}),e.jsx(h,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:"Switch this section to List or Table to preview the saved query here."}),e.jsx("div",{className:"mt-3",children:e.jsx(y,{type:"button",variant:"ghost",size:"sm",onClick:s,children:"Change display"})})]})}function ot({section:s,notes:i,isPending:n,isError:c,onRetry:o,onEdit:d,onSortChange:l,isSortPending:b}){return s.displayType==="table"?e.jsx(qe,{section:s,notes:i,isPending:n,isError:c,onRetry:o,onSortChange:l,isSortPending:b}):s.displayType==="calendar"?e.jsx(nt,{onEdit:d}):e.jsx(it,{notes:i,isPending:n,isError:c,onRetry:o})}function lt({section:s,onEdit:i,onDuplicate:n,onDelete:c,onMoveUp:o,onMoveDown:d,dragHandle:l}){const b=ae(),v=ie(),[w,j]=T.useState(!1),u=Ae(s),{data:r,isPending:N,isError:R,refetch:W}=D({queryKey:g.views.sectionNotes(s.id,{limit:s.limit,offset:0}),async queryFn(){const m=await Fe(s.id,{limit:s.limit,offset:0});if(m.type==="error")throw m;return m.viewSectionNotes}}),C=r?.notes??[],q=r?.totalCount??0,A=Pe(s.mode),F=s.tagNames.length>0||s.propertyFilters.length>0,P=async m=>{if(w)return;const f=s.sortBy===m?s.sortOrder==="asc"?"desc":"asc":m==="title"?"asc":"desc";j(!0);const k=await ne(s.id,oe(s,{sortBy:m,sortOrder:f}));if(k.type==="error"){v(k.errors[0]?.message??"Failed to update table sort."),j(!1);return}await b.invalidateQueries({queryKey:g.views.all(),exact:!1}),j(!1)};return e.jsxs(M,{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:[l&&e.jsx("div",{className:"-mr-1 shrink-0 self-center",children:l}),e.jsx("div",{className:"min-w-0",children:e.jsx(h,{as:"h2",variant:"subheading",weight:"semibold",tracking:"tight",className:"min-w-0",children:e.jsx(K,{to:B,search:u,className:"truncate hover:text-fg-default/85",children:s.title})})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-1.5",children:[e.jsx(S,{className:"max-w-full border-border-subtle/80 bg-elevated text-fg-secondary",children:Ie(s.displayType)}),s.tagNames.map((m,f)=>e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[f>0&&e.jsx("span",{className:"px-0.5 text-[10px] font-semibold tracking-[0.08em] text-fg-tertiary/85",children:A}),e.jsx(S,{className:"max-w-full border-border-subtle/80 bg-transparent text-fg-secondary",children:m})]},m)),s.propertyFilters.map(m=>e.jsx(S,{className:"max-w-full border-border-subtle/80 bg-subtle text-fg-secondary",children:Ke(m)},`${m.key}-${m.operator}-${m.value??""}`)),!F&&e.jsx(S,{className:"max-w-full border-border-subtle/80 bg-transparent text-fg-tertiary",children:"All notes"})]})]}),e.jsx(re,{button:e.jsx(se,{label:"Section actions"}),items:[...o?[{name:"Move up",onClick:o}]:[],...d?[{name:"Move down",onClick:d}]:[],...o||d?[{type:"separator"}]:[],{name:"Edit section",onClick:i},{name:"Duplicate section",onClick:n},{type:"separator"},{name:"Delete section",onClick:c}]})]}),e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsx(ot,{section:s,notes:C,isPending:N,isError:R,onRetry:()=>{W()},onEdit:i,onSortChange:P,isSortPending:w})}),e.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-border-subtle/75 px-4 py-3",children:[e.jsx(h,{as:"p",variant:"meta",tone:"tertiary",children:N?"Loading notes...":`Showing ${C.length} of ${q} notes`}),e.jsx(y,{asChild:!0,variant:"subtle",size:"sm",children:e.jsx(K,{to:B,search:u,children:"Open results"})})]})]})}const ct="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]",dt="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 mt({tab:s,isActive:i,onSelect:n}){const{attributes:c,listeners:o,setNodeRef:d,setActivatorNodeRef:l,transform:b,transition:v,isDragging:w}=ee({id:s.id});return e.jsx("div",{ref:d,style:{transform:te.Translate.toString(b),transition:v,opacity:w?.6:1},className:z(ct,i?"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:l,...c,...o,role:"tab","aria-selected":i,title:`${s.title}. Drag to reorder.`,className:z(dt,i?"text-fg-default":"text-fg-secondary group-hover:text-fg-default",w?"cursor-grabbing":"cursor-pointer"),onClick:n,children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.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:s.sections.length})]})})}function pt({tabs:s,activeTabId:i,onSelectTab:n,onReorderTabs:c,onCreateTab:o}){const d=G(E(ge,{activationConstraint:{distance:8}}),E(Y,{coordinateGetter:H}));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(J,{sensors:d,collisionDetection:X,modifiers:[we],autoScroll:!1,onDragEnd:l=>{c(l)},children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Z,{items:s.map(l=>l.id),strategy:ye,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:s.map(l=>e.jsx(mt,{tab:l,isActive:l.id===i,onSelect:()=>{n(l)}},l.id))})}),e.jsxs(y,{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:o,children:[e.jsx(L,{className:"h-5 w-5 shrink-0"}),e.jsx("span",{className:"hidden sm:inline",children:"New view tab"})]})]})})})}function ut({open:s,mode:i,initialTitle:n="",onClose:c,onSubmit:o}){const[d,l]=T.useState(n);return T.useEffect(()=>{s&&l(n)},[n,s]),e.jsxs(V,{isOpen:s,onClose:c,variant:"form",className:"sm:max-w-[480px]",children:[e.jsx(V.Header,{title:i==="create"?"Create view tab":"Rename view tab",onClose:c}),e.jsx(V.Body,{children:e.jsxs("form",{id:"view-tab-form",className:"flex flex-col gap-4",onSubmit:b=>{b.preventDefault(),o(d)},children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(Ve,{htmlFor:"view-tab-title",size:"md",children:"Tab name"}),e.jsx(De,{id:"view-tab-title",value:d,onChange:b=>l(b.target.value),placeholder:"Now",autoFocus:!0})]}),e.jsx(h,{as:"p",variant:"meta",tone:"tertiary",children:"Each tab is one saved view inside the Views page."})]})}),e.jsx(V.Footer,{children:e.jsxs(Te,{children:[e.jsx(y,{type:"button",variant:"ghost",size:"sm",onClick:c,children:"Cancel"}),e.jsx(y,{type:"submit",size:"sm",form:"view-tab-form",children:i==="create"?"Create tab":"Save tab"})]})})]})}const xt="Save reusable note queries with tags, shared properties, and sorting.",ht="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",bt=({section:s,onEdit:i,onDuplicate:n,onDelete:c,onMoveUp:o,onMoveDown:d})=>{const{attributes:l,listeners:b,setNodeRef:v,setActivatorNodeRef:w,transform:j,transition:u,isDragging:r}=ee({id:s.id});return e.jsx("div",{ref:v,style:{transform:te.Translate.toString(j),transition:u,opacity:r?.6:1},children:e.jsx(lt,{section:s,onEdit:i,onDuplicate:n,onDelete:c,onMoveUp:o,onMoveDown:d,dragHandle:e.jsx("button",{type:"button",ref:w,"aria-label":`Reorder section ${s.title}`,...l,...b,className:z(ht,r?"cursor-grabbing":"cursor-grab"),children:e.jsx(Se,{className:"size-4"})})})})};function Et(){const s=Ce(),i=ie(),n=ae(),[c,o]=T.useState(null),[d,l]=T.useState(null),{data:b,isPending:v,isError:w,refetch:j}=D({queryKey:g.views.workspace(),async queryFn(){const t=await ze();if(t.type==="error")throw t;return t.viewWorkspace}}),u=b??Le,r=Me(u),N=r?u.tabs.findIndex(t=>t.id===r.id):-1,{data:R,isPending:W}=D({queryKey:g.tags.list({limit:200}),async queryFn(){const t=await We({limit:200});if(t.type==="error")throw t;return t.allTags}}),C=G(E(ve,{activationConstraint:{distance:8}}),E(Y,{coordinateGetter:H})),q=R?.tags??[],{data:A,isPending:F}=D({queryKey:g.notes.propertyKeys({limit:100}),async queryFn(){const t=await Ee({limit:100});if(t.type==="error")throw t;return t.notePropertyKeys}}),P=A?.keys??[],m=t=>{n.setQueryData(g.views.workspace(),t)},f=async()=>{await n.invalidateQueries({queryKey:g.views.all(),exact:!1})},k=async(t,a)=>{m(a);const p=await Ze(a.tabs.map(x=>x.id));if(p.type==="error"){m(t),i(p.errors[0].message);return}await f()},le=async({active:t,over:a})=>{if(!a||t.id===a.id)return;const p=n.getQueryData(g.views.workspace())??u,x=Qe(p,String(t.id),String(a.id));await k(p,x)},O=async t=>{if(!r)return;const a=n.getQueryData(g.views.workspace())??u,p=$e(a,r.id,t);p!==a&&await k(a,p)},ce=async t=>{const a=n.getQueryData(g.views.workspace())??u,p=_e(a,t.id);m(p);const x=await Ue(t.id);if(x.type==="error"){m(a),i(x.errors[0].message);return}m(x.setActiveViewTab)},Q=async(t,a)=>{if(!r)return;m(a);const p=await et(r.id,a.tabs.find(x=>x.id===r.id)?.sections.map(x=>x.id)??[]);if(p.type==="error"){m(t),i(p.errors[0].message);return}await f()},de=async({active:t,over:a})=>{if(!r||!a||t.id===a.id)return;const p=n.getQueryData(g.views.workspace())??u,x=Be(p,r.id,String(t.id),String(a.id));await Q(p,x)},$=async(t,a)=>{if(!r)return;const p=n.getQueryData(g.views.workspace())??u,x=Ge(p,r.id,t,a);x!==p&&await Q(p,x)},me=async t=>{const a=await He(t);if(a.type==="error"){i(a.errors[0].message);return}await f(),o(null)},pe=async t=>{if(!r)return;const a=await Ye(r.id,t);if(a.type==="error"){i(a.errors[0].message);return}await f(),o(null)},ue=async()=>{if(!r||!await s("Delete this view tab and all of its sections?"))return;const t=await Je(r.id);if(t.type==="error"){i(t.errors[0].message);return}await f()},xe=async t=>{if(!r)return;const a=await U(r.id,t);if(a.type==="error"){i(a.errors[0].message);return}await f(),l(null)},he=async t=>{if(!r||!d||d.mode!=="edit")return;const a=await ne(d.section.id,t);if(a.type==="error"){i(a.errors[0].message);return}await f(),l(null)},be=async t=>{const a=await U(t.tabId,{...oe(t),title:`${t.title} copy`});if(a.type==="error"){i(a.errors[0].message);return}await f(),i("Section duplicated.")},fe=async t=>{if(!r||!await s("Delete this section from the current view tab?"))return;const a=await Xe(t);if(a.type==="error"){i(a.errors[0].message);return}await f()};return e.jsxs(e.Fragment,{children:[e.jsx(Re,{title:"Views",description:xt,children:v&&!b?e.jsx(M,{className:"px-6 py-8 sm:px-8 sm:py-10",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(I,{height:20,width:180,className:"rounded-full"}),e.jsx(I,{height:16,width:260,className:"rounded-full"}),e.jsx(I,{height:44,width:140,className:"rounded-[12px]"})]})}):w?e.jsxs(M,{className:"px-6 py-8 sm:px-8 sm:py-10",children:[e.jsx(h,{as:"p",variant:"body",weight:"semibold",children:"Failed to load saved views"}),e.jsx(h,{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(y,{type:"button",variant:"ghost",size:"sm",onClick:()=>{j()},children:"Retry"})})]}):u.tabs.length===0?e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(_,{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(y,{type:"button",onClick:()=>o({mode:"create"}),children:[e.jsx(L,{className:"h-4 w-4"}),"Create first tab"]})})]}):e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsx(pt,{tabs:u.tabs,activeTabId:r?.id??null,onSelectTab:ce,onReorderTabs:le,onCreateTab:()=>o({mode:"create"})}),r&&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(h,{as:"h2",variant:"subheading",weight:"semibold",tracking:"tight",truncate:!0,children:r.title}),e.jsx(h,{as:"p",variant:"meta",tone:"tertiary",className:"mt-1",children:r.sections.length>0?`${r.sections.length} section${r.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(y,{type:"button",size:"sm",onClick:()=>l({mode:"create"}),children:[e.jsx(L,{className:"h-4 w-4"}),"Add section"]}),e.jsx(re,{button:e.jsx(se,{label:"View tab actions"}),items:[...N>0?[{name:"Move tab left",onClick:()=>{O("previous")}}]:[],...N>=0&&N<u.tabs.length-1?[{name:"Move tab right",onClick:()=>{O("next")}}]:[],...u.tabs.length>1?[{type:"separator"}]:[],{name:"Rename tab",onClick:()=>o({mode:"edit",tab:r})},{type:"separator"},{name:"Delete tab",onClick:()=>{ue()}}]})]})]}),r.sections.length===0?e.jsx(_,{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(J,{sensors:C,collisionDetection:X,modifiers:[je],onDragEnd:de,children:e.jsx(Z,{items:r.sections.map(t=>t.id),strategy:Ne,children:e.jsx("div",{className:"flex flex-col gap-4",children:r.sections.map((t,a)=>e.jsx(bt,{section:t,onEdit:()=>l({mode:"edit",section:t}),onDuplicate:()=>{be(t)},onDelete:()=>{fe(t.id)},onMoveUp:a>0?()=>{$(t.id,"previous")}:void 0,onMoveDown:a<r.sections.length-1?()=>{$(t.id,"next")}:void 0},t.id))})})})})]})]})}),e.jsx(ut,{open:c!==null,mode:c?.mode??"create",initialTitle:c?.mode==="edit"?c.tab.title:"",onClose:()=>o(null),onSubmit:t=>{if(c?.mode==="edit"){pe(t);return}me(t)}}),e.jsx(Oe,{open:d!==null,mode:d?.mode??"create",initialSection:d?.mode==="edit"?d.section:null,availableTags:q,availableProperties:P,isTagsLoading:W,isPropertiesLoading:F,onClose:()=>l(null),onSubmit:t=>{if(d?.mode==="edit"){he(t);return}xe(t)}})]})}export{Et as default};