ocean-brain 0.13.1 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ocean-brain",
3
- "version": "0.13.1",
3
+ "version": "0.13.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "engines": {
@@ -1,4 +1,4 @@
1
- import{j as e,r as j}from"./floating-ui.react-dom-BWTnA00G.js";import{T as p,x as H,y as E,M as C,q as S,g as Y,P as Q,h as V}from"./time-PxWila4-.js";import{d as b,s as F,a as $}from"./useNoteMutate-BjvZUmtX.js";import{C as U}from"./url-DKUMNVCI.js";import{C as z,a as P,b as B,c as J,g as G,s as W,d as X}from"./calendar-data-wB0ifXdo.js";import{d as K}from"./app-4M3jUhmd.js";import{s as Z}from"./FileText.es-DPIwDCEe.js";import{C as ee}from"./Callout-CcYyvHQP.js";import"./preload-helper-BXl3LOEh.js";import"./Graph-hVj6vAYJ.js";import"./Info.es-CYxg-Vku.js";const D=2,te=({year:t,month:a,day:n,isCurrentMonth:r,isSunday:l,isToday:m,isSelected:d,isPast:c,notes:h,reminders:g,onSelect:s})=>{const f=h.slice(0,D).map(y=>({key:`note-${y.id}`,type:"note",title:y.title})),N=g.slice(0,D).map(y=>({key:`reminder-${y.id}`,type:"reminder",title:y.content||y.note?.title||"No title",isCompleted:y.completed})),M=(c?[...f,...N]:[...N,...f]).slice(0,D),R=()=>r?d?"bg-elevated shadow-[inset_0_0_0_1px_var(--border-secondary)] hover:bg-surface":"bg-surface hover:bg-muted":"cursor-default bg-[var(--page-bg)] text-fg-disabled",k=()=>m?"bg-cta font-semibold text-fg-on-filled":r?l?"font-semibold text-fg-weekend":"font-semibold text-fg-secondary":"font-medium text-fg-tertiary";return e.jsx(z,{day:n,dateLabel:b(new Date(t,a-1,n)).format("dddd, MMMM D, YYYY"),cellClassName:R(),dayNumberClassName:k(),isCurrentMonth:r,isToday:m,isSelected:d,noteCount:h.length,reminderCount:g.length,previewItems:M,overflowCount:Math.max(0,h.length+g.length-D),onSelect:s})},ae=te,ne=({note:t,type:a})=>e.jsx(P,{params:{id:t.id},header:e.jsx(Z,{size:12}),title:t.title,meta:b(Number(a==="create"?t.createdAt:t.updatedAt)).format("HH:mm")}),se=({reminder:t})=>e.jsx(P,{params:{id:String(t.note?.id??t.noteId)},header:e.jsx(F,{size:12}),title:t.content||t.note?.title||"No title",titleClassName:t.completed?"line-through":"",meta:b(Number(t.reminderDate)).format("HH:mm")}),re=(t,a)=>t.map(n=>n.type==="note"?e.jsx(ne,{note:n.item,type:a},`note-${n.item.id}`):e.jsx(se,{reminder:n.item},`reminder-${n.item.id}`)),I=(t,a)=>`${t} ${t===1?a:`${a}s`}`,oe="mt-3 flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto overscroll-y-contain pr-2 [scrollbar-color:var(--border-secondary)_transparent] [scrollbar-width:thin] [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-border-secondary [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar]:w-1.5",L=t=>b(new Date(t.year,t.month-1,t.day)).format("dddd, MMMM D"),T=({day:t,type:a,isLoading:n,presentation:r="rail"})=>{const l=j.useMemo(()=>{if(!t)return[];const h=t.notes.map(s=>({type:"note",item:s})),g=t.reminders.map(s=>({type:"reminder",item:s}));return t.isPast?[...h,...g]:[...g,...h]},[t]);if(!t)return e.jsx("section",{"aria-label":"Day details",className:"flex h-full min-h-40 items-center justify-center text-center",children:e.jsx(p,{as:"p",variant:"meta",weight:"medium",tone:"secondary",children:"Select a day to see its activity."})});const m=L(t),d=n?"Loading activity...":[I(t.notes.length,"note"),I(t.reminders.length,"reminder")].join(" · "),c=n?null:e.jsx("div",{className:r==="rail"?oe:"flex flex-col gap-1",children:l.length>0?re(l,a):e.jsx(p,{as:"p",variant:"meta",weight:"medium",tone:"secondary",className:"py-8 text-center",children:"No activity on this day."})});return r==="modal"?e.jsxs("div",{"aria-label":`${m} activity`,children:[e.jsx(p,{as:"p",variant:"label",weight:"medium",tone:"secondary",className:"mb-3",children:d}),c]}):e.jsxs("section",{"aria-label":`${m} details`,className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"flex shrink-0 items-start gap-2 border-b border-border-subtle/80 pb-3",children:[e.jsx(K,{"aria-hidden":"true",className:"mt-0.5 shrink-0 text-fg-tertiary",size:15}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(p,{as:"h2",variant:"subheading",weight:"semibold",tracking:"tight",children:m}),e.jsx(p,{as:"p",variant:"label",weight:"medium",tone:"secondary",className:"mt-0.5",children:d})]})]}),c]})},ie=["January","February","March","April","May","June","July","August","September","October","November","December"],le=({month:t,year:a,type:n,onPrevMonth:r,onNextMonth:l,onToday:m,onTypeChange:d})=>e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex flex-wrap items-end gap-x-2.5 gap-y-1",children:[e.jsx(p,{as:"h1",variant:"display",weight:"bold",tracking:"tighter",className:"text-2xl leading-none sm:text-[2.15rem]",children:ie[t-1]}),e.jsx(p,{as:"span",variant:"subheading",weight:"medium",tone:"secondary",tracking:"tight",className:"pb-0.5",children:a})]}),e.jsx(p,{as:"p",variant:"meta",weight:"medium",tone:"secondary",className:"hidden sm:block",children:"Track note activity and reminders across the month"})]}),e.jsx("div",{className:"flex lg:justify-end",children:e.jsxs("div",{className:"flex w-full flex-col gap-2 sm:inline-flex sm:w-auto sm:flex-row sm:items-center sm:gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(K,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(p,{id:"calendar-note-date-label",as:"span",variant:"label",weight:"medium",tone:"secondary",children:"Note date"}),e.jsxs(H,{value:n,"aria-labelledby":"calendar-note-date-label",onValueChange:h=>d(h),variant:"ghost",size:"sm",children:[e.jsx(E,{value:"create",children:"Created"}),e.jsx(E,{value:"update",children:"Updated"})]})]}),e.jsx("div",{className:"hidden h-5 w-px bg-divider sm:block"}),e.jsx(B,{onPrevMonth:r,onNextMonth:l,onToday:m})]})})]}),_="(min-width: 1280px)",de=({days:t,type:a,isLoading:n,selectedDayKey:r,onSelectedDayChange:l})=>{const[m,d]=j.useState(!1),c=j.useMemo(()=>t.find(s=>s.key===r),[t,r]);j.useEffect(()=>{const s=window.matchMedia(_),f=N=>{N.matches&&d(!1)};return s.addEventListener("change",f),()=>s.removeEventListener("change",f)},[]);const h=s=>{l(s),window.matchMedia(_).matches||d(!0)},g=c?L(c):"Day details";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"min-w-0 xl:grid xl:grid-cols-[minmax(0,1fr)_20rem] 2xl:grid-cols-[minmax(0,1fr)_22rem]",children:[e.jsx(J,{isLoading:n,className:"xl:pr-5",children:t.map(s=>e.jsx(ae,{year:s.year,month:s.month,day:s.day,isCurrentMonth:s.isCurrentMonth,isSunday:s.isSunday,isToday:s.isToday,isSelected:s.key===r,isPast:s.isPast,notes:s.notes,reminders:s.reminders,onSelect:()=>h(s.key)},s.key))}),e.jsx("aside",{className:"relative hidden min-h-0 border-l border-border-subtle xl:block","aria-label":"Selected day",children:e.jsx("div",{className:"absolute inset-y-0 right-0 left-5",children:e.jsx(T,{day:c,type:a,isLoading:n})})})]}),e.jsxs(C,{isOpen:m&&!!c,onClose:()=>d(!1),variant:"inspect",className:"xl:hidden",children:[e.jsx(C.Header,{title:g,onClose:()=>d(!1)}),e.jsxs(C.Body,{children:[e.jsxs(C.Description,{className:"sr-only",children:["View notes and reminders for ",g,"."]}),e.jsx(T,{day:c,type:a,isLoading:n,presentation:"modal"})]})]})]})},ce=`
1
+ import{j as e,r as j}from"./floating-ui.react-dom-BWTnA00G.js";import{T as p,x as H,y as E,M as C,q as S,g as Y,P as Q,h as V}from"./time-PxWila4-.js";import{d as b,s as F,a as $}from"./useNoteMutate-BjvZUmtX.js";import{C as U}from"./url-DKUMNVCI.js";import{C as z,a as P,b as B,c as J,g as G,s as W,d as X}from"./calendar-data-wB0ifXdo.js";import{d as K}from"./app-BFM2V_Rx.js";import{s as Z}from"./FileText.es-DPIwDCEe.js";import{C as ee}from"./Callout-CcYyvHQP.js";import"./preload-helper-BXl3LOEh.js";import"./Graph-hVj6vAYJ.js";import"./Info.es-CYxg-Vku.js";const D=2,te=({year:t,month:a,day:n,isCurrentMonth:r,isSunday:l,isToday:m,isSelected:d,isPast:c,notes:h,reminders:g,onSelect:s})=>{const f=h.slice(0,D).map(y=>({key:`note-${y.id}`,type:"note",title:y.title})),N=g.slice(0,D).map(y=>({key:`reminder-${y.id}`,type:"reminder",title:y.content||y.note?.title||"No title",isCompleted:y.completed})),M=(c?[...f,...N]:[...N,...f]).slice(0,D),R=()=>r?d?"bg-elevated shadow-[inset_0_0_0_1px_var(--border-secondary)] hover:bg-surface":"bg-surface hover:bg-muted":"cursor-default bg-[var(--page-bg)] text-fg-disabled",k=()=>m?"bg-cta font-semibold text-fg-on-filled":r?l?"font-semibold text-fg-weekend":"font-semibold text-fg-secondary":"font-medium text-fg-tertiary";return e.jsx(z,{day:n,dateLabel:b(new Date(t,a-1,n)).format("dddd, MMMM D, YYYY"),cellClassName:R(),dayNumberClassName:k(),isCurrentMonth:r,isToday:m,isSelected:d,noteCount:h.length,reminderCount:g.length,previewItems:M,overflowCount:Math.max(0,h.length+g.length-D),onSelect:s})},ae=te,ne=({note:t,type:a})=>e.jsx(P,{params:{id:t.id},header:e.jsx(Z,{size:12}),title:t.title,meta:b(Number(a==="create"?t.createdAt:t.updatedAt)).format("HH:mm")}),se=({reminder:t})=>e.jsx(P,{params:{id:String(t.note?.id??t.noteId)},header:e.jsx(F,{size:12}),title:t.content||t.note?.title||"No title",titleClassName:t.completed?"line-through":"",meta:b(Number(t.reminderDate)).format("HH:mm")}),re=(t,a)=>t.map(n=>n.type==="note"?e.jsx(ne,{note:n.item,type:a},`note-${n.item.id}`):e.jsx(se,{reminder:n.item},`reminder-${n.item.id}`)),I=(t,a)=>`${t} ${t===1?a:`${a}s`}`,oe="mt-3 flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto overscroll-y-contain pr-2 [scrollbar-color:var(--border-secondary)_transparent] [scrollbar-width:thin] [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-border-secondary [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar]:w-1.5",L=t=>b(new Date(t.year,t.month-1,t.day)).format("dddd, MMMM D"),T=({day:t,type:a,isLoading:n,presentation:r="rail"})=>{const l=j.useMemo(()=>{if(!t)return[];const h=t.notes.map(s=>({type:"note",item:s})),g=t.reminders.map(s=>({type:"reminder",item:s}));return t.isPast?[...h,...g]:[...g,...h]},[t]);if(!t)return e.jsx("section",{"aria-label":"Day details",className:"flex h-full min-h-40 items-center justify-center text-center",children:e.jsx(p,{as:"p",variant:"meta",weight:"medium",tone:"secondary",children:"Select a day to see its activity."})});const m=L(t),d=n?"Loading activity...":[I(t.notes.length,"note"),I(t.reminders.length,"reminder")].join(" · "),c=n?null:e.jsx("div",{className:r==="rail"?oe:"flex flex-col gap-1",children:l.length>0?re(l,a):e.jsx(p,{as:"p",variant:"meta",weight:"medium",tone:"secondary",className:"py-8 text-center",children:"No activity on this day."})});return r==="modal"?e.jsxs("div",{"aria-label":`${m} activity`,children:[e.jsx(p,{as:"p",variant:"label",weight:"medium",tone:"secondary",className:"mb-3",children:d}),c]}):e.jsxs("section",{"aria-label":`${m} details`,className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"flex shrink-0 items-start gap-2 border-b border-border-subtle/80 pb-3",children:[e.jsx(K,{"aria-hidden":"true",className:"mt-0.5 shrink-0 text-fg-tertiary",size:15}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(p,{as:"h2",variant:"subheading",weight:"semibold",tracking:"tight",children:m}),e.jsx(p,{as:"p",variant:"label",weight:"medium",tone:"secondary",className:"mt-0.5",children:d})]})]}),c]})},ie=["January","February","March","April","May","June","July","August","September","October","November","December"],le=({month:t,year:a,type:n,onPrevMonth:r,onNextMonth:l,onToday:m,onTypeChange:d})=>e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex flex-wrap items-end gap-x-2.5 gap-y-1",children:[e.jsx(p,{as:"h1",variant:"display",weight:"bold",tracking:"tighter",className:"text-2xl leading-none sm:text-[2.15rem]",children:ie[t-1]}),e.jsx(p,{as:"span",variant:"subheading",weight:"medium",tone:"secondary",tracking:"tight",className:"pb-0.5",children:a})]}),e.jsx(p,{as:"p",variant:"meta",weight:"medium",tone:"secondary",className:"hidden sm:block",children:"Track note activity and reminders across the month"})]}),e.jsx("div",{className:"flex lg:justify-end",children:e.jsxs("div",{className:"flex w-full flex-col gap-2 sm:inline-flex sm:w-auto sm:flex-row sm:items-center sm:gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(K,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(p,{id:"calendar-note-date-label",as:"span",variant:"label",weight:"medium",tone:"secondary",children:"Note date"}),e.jsxs(H,{value:n,"aria-labelledby":"calendar-note-date-label",onValueChange:h=>d(h),variant:"ghost",size:"sm",children:[e.jsx(E,{value:"create",children:"Created"}),e.jsx(E,{value:"update",children:"Updated"})]})]}),e.jsx("div",{className:"hidden h-5 w-px bg-divider sm:block"}),e.jsx(B,{onPrevMonth:r,onNextMonth:l,onToday:m})]})})]}),_="(min-width: 1280px)",de=({days:t,type:a,isLoading:n,selectedDayKey:r,onSelectedDayChange:l})=>{const[m,d]=j.useState(!1),c=j.useMemo(()=>t.find(s=>s.key===r),[t,r]);j.useEffect(()=>{const s=window.matchMedia(_),f=N=>{N.matches&&d(!1)};return s.addEventListener("change",f),()=>s.removeEventListener("change",f)},[]);const h=s=>{l(s),window.matchMedia(_).matches||d(!0)},g=c?L(c):"Day details";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"min-w-0 xl:grid xl:grid-cols-[minmax(0,1fr)_20rem] 2xl:grid-cols-[minmax(0,1fr)_22rem]",children:[e.jsx(J,{isLoading:n,className:"xl:pr-5",children:t.map(s=>e.jsx(ae,{year:s.year,month:s.month,day:s.day,isCurrentMonth:s.isCurrentMonth,isSunday:s.isSunday,isToday:s.isToday,isSelected:s.key===r,isPast:s.isPast,notes:s.notes,reminders:s.reminders,onSelect:()=>h(s.key)},s.key))}),e.jsx("aside",{className:"relative hidden min-h-0 border-l border-border-subtle xl:block","aria-label":"Selected day",children:e.jsx("div",{className:"absolute inset-y-0 right-0 left-5",children:e.jsx(T,{day:c,type:a,isLoading:n})})})]}),e.jsxs(C,{isOpen:m&&!!c,onClose:()=>d(!1),variant:"inspect",className:"xl:hidden",children:[e.jsx(C.Header,{title:g,onClose:()=>d(!1)}),e.jsxs(C.Body,{children:[e.jsxs(C.Description,{className:"sr-only",children:["View notes and reminders for ",g,"."]}),e.jsx(T,{day:c,type:a,isLoading:n,presentation:"modal"})]})]})]})},ce=`
2
2
  query NotesInDateRange($dateRange: DateRangeInput) {
3
3
  notesInDateRange(dateRange: $dateRange) {
4
4
  id
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-C2tL9tq7.js","assets/preload-helper-BXl3LOEh.js","assets/floating-ui.react-dom-BWTnA00G.js","assets/transform-BUB79_za.js","assets/katex-DywYRkvg.css"])))=>i.map(i=>d[i]);
2
- import{r as o,j as a}from"./floating-ui.react-dom-BWTnA00G.js";import{al as jn,A as vt,T as S,i as Ye,m as An,q as L,M as B,B as k,am as En,an as kn,c as V,N as wt,K as Ct,V as Tn,e as je,u as Qe,ao as Mn,ap as Dn,aq as Ln,J as _n,s as Pn,ar as On,a1 as Nt,ah as St,as as ze,at as Bn,W as Fn,ai as Hn,aj as $n,au as In,Q as qe,P as Ge,av as Je,h as Un,l as ie,D as zn}from"./time-PxWila4-.js";import{M as Ae,h as Rt,m as Zn,a as Fe,b as Vn,d as G,s as Wn,l as jt,o as Kn,p as At,k as Et,q as Yn,r as rt,e as Qn}from"./useNoteMutate-BjvZUmtX.js";import{m as qn,C as st}from"./Callout-CcYyvHQP.js";import{J as kt,g as Gn,A as Tt,S as Jn,i as Xn,U as at,F as er,N as tr}from"./NotePropertiesPanel-6P7UfRBR.js";import{c as nr}from"./Info.es-CYxg-Vku.js";import{N as Ee,T as rr,S as sr}from"./url-DKUMNVCI.js";import{S as ar}from"./SurfaceCard-D5QxOte_.js";import{b as or,c as ir,u as cr,R as lr}from"./useReminderMutate-C5n-5LM-.js";import{n as dr}from"./Plus.es-Dy6onD-Z.js";import{h as Xe,m as ur,L as Mt,Z as Dt,M as fr,K as pr,a as mr}from"./note-ui-BaqzP-YU.js";import{u as hr}from"./image.api-ChvlfuZg.js";import{L as gr,t as ot,q as xr,B as he,G as br,y as it}from"./note-core-DUTqUh5N.js";import{s as Lt}from"./FlowArrow.es-Dxee98ir.js";import{_ as Ze}from"./preload-helper-BXl3LOEh.js";import{s as yr}from"./Copy.es-fMv0ETir.js";import{A as vr}from"./AuxiliaryPanelHeader-HAttwVby.js";import{f as wr,c as Cr}from"./tag.api-DEUROVKQ.js";import{cn as ct}from"./note-runtime-zN5ddTba.js";import{s as Nr}from"./File.es-CHtXXafR.js";import{p as Sr}from"./LinkSimple.es-B-P-7Iem.js";function Rr(e,n){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if("shouldBlockFn"in e)return e;if(typeof e=="function")return{shouldBlockFn:async()=>await e(),enableBeforeUnload:!0,withResolver:!1};const t=!!(e.condition??!0),s=e.blockerFn;return{shouldBlockFn:async()=>t&&s!==void 0?await s():t,enableBeforeUnload:t,withResolver:s===void 0}}function jr(e,n){const{shouldBlockFn:t,enableBeforeUnload:s=!0,disabled:r=!1,withResolver:i=!1}=Rr(e),c=jn(),{history:l}=c,[f,d]=o.useState({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return o.useEffect(()=>{const m=async x=>{function b(A){const w=c.parseLocation(A),p=c.getMatchedRoutes(w.pathname);return p.foundRoute===void 0?{routeId:"__notFound__",fullPath:w.pathname,pathname:w.pathname,params:p.routeParams,search:c.options.parseSearch(A.search)}:{routeId:p.foundRoute.id,fullPath:p.foundRoute.fullPath,pathname:w.pathname,params:p.routeParams,search:c.options.parseSearch(A.search)}}const u=b(x.currentLocation),h=b(x.nextLocation);if(u.routeId==="__notFound__"&&h.routeId!=="__notFound__")return!1;const v=await t({action:x.action,current:u,next:h});if(!i)return v;if(!v)return!1;const R=await new Promise(A=>{d({status:"blocked",current:u,next:h,action:x.action,proceed:()=>A(!1),reset:()=>A(!0)})});return d({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),R};return r?void 0:l.block({blockerFn:m,enableBeforeUnload:s})},[t,s,r,i,l,c]),f}const Ar=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M212,40a12,12,0,0,1-12,12H170.71A20,20,0,0,0,151,68.42L142.38,116H184a12,12,0,0,1,0,24H138l-9.44,51.87A44,44,0,0,1,85.29,228H56a12,12,0,0,1,0-24H85.29A20,20,0,0,0,105,187.58L113.62,140H72a12,12,0,0,1,0-24h46l9.44-51.87A44,44,0,0,1,170.71,28H200A12,12,0,0,1,212,40Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M200,40V200a16,16,0,0,1-16,16H56V56A16,16,0,0,1,72,40Z",opacity:"0.2"}),o.createElement("path",{d:"M208,40a8,8,0,0,1-8,8H170.71a24,24,0,0,0-23.62,19.71L137.59,120H184a8,8,0,0,1,0,16H134.68l-10,55.16A40,40,0,0,1,85.29,224H56a8,8,0,0,1,0-16H85.29a24,24,0,0,0,23.62-19.71l9.5-52.29H72a8,8,0,0,1,0-16h49.32l10-55.16A40,40,0,0,1,170.71,32H200A8,8,0,0,1,208,40Z"}))],["fill",o.createElement(o.Fragment,null,o.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,32ZM176,72H159.92a16,16,0,0,0-15.73,13l-6.55,35H168a8,8,0,0,1,0,16H134.64l-7.11,37.9A32,32,0,0,1,96.08,200H80a8,8,0,0,1,0-16H96.08A16,16,0,0,0,111.81,171L118.36,136H88a8,8,0,0,1,0-16h33.36l7.11-37.9A32,32,0,0,1,159.92,56H176a8,8,0,0,1,0,16Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M206,40a6,6,0,0,1-6,6H170.71a26,26,0,0,0-25.58,21.35L135.19,122H184a6,6,0,0,1,0,12H133l-10.33,56.8A38,38,0,0,1,85.29,222H56a6,6,0,0,1,0-12H85.29a26,26,0,0,0,25.58-21.35L120.81,134H72a6,6,0,0,1,0-12h51l10.33-56.8A38,38,0,0,1,170.71,34H200A6,6,0,0,1,206,40Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M208,40a8,8,0,0,1-8,8H170.71a24,24,0,0,0-23.62,19.71L137.59,120H184a8,8,0,0,1,0,16H134.68l-10,55.16A40,40,0,0,1,85.29,224H56a8,8,0,0,1,0-16H85.29a24,24,0,0,0,23.62-19.71l9.5-52.29H72a8,8,0,0,1,0-16h49.32l10-55.16A40,40,0,0,1,170.71,32H200A8,8,0,0,1,208,40Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M204,40a4,4,0,0,1-4,4H170.71a28,28,0,0,0-27.55,23l-10.37,57H184a4,4,0,0,1,0,8H131.34l-10.63,58.44A36,36,0,0,1,85.29,220H56a4,4,0,0,1,0-8H85.29a28,28,0,0,0,27.55-23l10.37-57H72a4,4,0,0,1,0-8h52.66l10.63-58.44A36,36,0,0,1,170.71,36H200A4,4,0,0,1,204,40Z"}))]]),Er=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M230.15,70.54,185.46,25.86a20,20,0,0,0-28.28,0L33.86,149.17A19.86,19.86,0,0,0,28,163.31V208a20,20,0,0,0,20,20H216a12,12,0,0,0,0-24H125L230.15,98.83A20,20,0,0,0,230.15,70.54ZM136,81l11,11L76,163,65,152ZM52,204V173l15.52,15.51h0L83,204Zm52-13L93,180l71-71,11,11Zm88-88L153,64l18.34-18.34,39,39Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z",opacity:"0.2"}),o.createElement("path",{d:"M227.32,73.37,182.63,28.69a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H216a8,8,0,0,0,0-16H115.32l112-112A16,16,0,0,0,227.32,73.37ZM79.32,188,164,103.31,180.69,120,96,204.69ZM68,176.69,51.31,160,136,75.31,152.69,92Zm-20,2.62L76.69,208H48Zm144-70.62L147.32,64l24-24L216,84.69Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M227.32,73.37,182.63,28.69a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H216a8,8,0,0,0,0-16H115.32l112-112A16,16,0,0,0,227.32,73.37ZM79.32,188l90.34-90.34,16.69,16.68L96,204.69Zm79-101.66h0L68,176.69,51.31,160l90.35-90.34ZM48,179.31,76.69,208H48Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M225.91,74.79,181.22,30.1a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H216a6,6,0,0,0,0-12H110.49L225.91,94.59A14,14,0,0,0,225.91,74.79ZM76.49,188,164,100.48,183.52,120,96,207.51ZM68,179.52,48.49,160,136,72.49,155.52,92ZM46,208V174.48L81.52,210H48A2,2,0,0,1,46,208ZM217.42,86.1,192,111.52,144.49,64,169.9,38.59a2,2,0,0,1,2.83,0l44.69,44.68A2,2,0,0,1,217.42,86.1Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M227.32,73.37,182.63,28.69a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H216a8,8,0,0,0,0-16H115.32l112-112A16,16,0,0,0,227.32,73.37ZM136,75.31,152.69,92,68,176.69,51.31,160ZM48,208V179.31L76.69,208Zm48-3.31L79.32,188,164,103.31,180.69,120Zm96-96L147.32,64l24-24L216,84.69Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L39.51,154.83A12,12,0,0,0,36,163.31V208a12,12,0,0,0,12,12H216a4,4,0,0,0,0-8H105.66L224.49,93.17A12,12,0,0,0,224.49,76.2ZM73.66,188,164,97.66,186.35,120,96,210.34ZM68,182.34,45.66,160,136,69.66,158.35,92ZM44,208V169.66l21.17,21.17h0L86.34,212H48A4,4,0,0,1,44,208ZM218.83,87.51,192,114.34,141.66,64l26.83-26.83a4,4,0,0,1,5.66,0l44.68,44.69A4,4,0,0,1,218.83,87.51Z"}))]]),_t=o.forwardRef((e,n)=>o.createElement(vt,{ref:n,...e,weights:Ar}));_t.displayName="FunctionIcon";const Pt=_t,Ot=o.forwardRef((e,n)=>o.createElement(vt,{ref:n,...e,weights:Er}));Ot.displayName="PencilLineIcon";const kr=Ot;function Tr({title:e,description:n,selected:t=!1,onClick:s,children:r}){return a.jsxs("button",{type:"button","aria-pressed":t,className:`focus-ring-soft flex w-full items-start justify-between gap-3 p-3 text-left transition-colors sm:p-4 ${t?"surface-floating bg-elevated":"rounded-[14px] border border-border-subtle bg-transparent hover:border-border-secondary hover:bg-hover-subtle"}`,onClick:s,children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx(S,{as:"div",variant:"body",weight:"semibold",tone:t?"default":"secondary",children:e}),a.jsx(S,{as:"div",variant:"meta",weight:"medium",tone:t?"secondary":"tertiary",className:"mt-1",children:n})]}),r?a.jsx("div",{className:"shrink-0",children:r}):null]})}const Mr=e=>{const{data:n}=Ye({queryKey:L.notes.backReferences(e.noteId),async queryFn(){const t=await An(e.noteId);if(t.type==="error")throw t;return t.backReferences}});return e.render(n)};function Dr({noteId:e,searchParams:n,render:t}){const{data:s}=Ye({queryKey:e?L.reminders.note(e,n):L.reminders.upcoming(n),queryFn:async()=>{if(e){const i=await or(e,n);if(i.type==="error")throw i;return i.noteReminders}const r=await ir(n);if(r.type==="error")throw r;return r.upcomingReminders}});return a.jsx(a.Fragment,{children:t(s)})}const Lr=[{value:"narrow",label:"Narrow",description:"Optimized for reading long-form content"},{value:"wide",label:"Wide",description:"Balanced width suitable for most content"},{value:"full",label:"Full Width",description:"Maximize screen space utilization"}];function _r({isOpen:e,onClose:n,onSave:t,currentLayout:s="wide"}){const[r,i]=o.useState(s);o.useEffect(()=>{e&&i(s)},[e,s]);const c=()=>{t(r),n()};return a.jsxs(B,{isOpen:e,onClose:n,variant:"compact",children:[a.jsx(B.Header,{title:"Layout Settings",onClose:n}),a.jsx(B.Body,{children:a.jsx("div",{className:"flex flex-col gap-3 sm:gap-4",children:a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsx(S,{as:"div",variant:"body",weight:"semibold",tone:"secondary",children:"Note layout"}),a.jsx("div",{className:"flex flex-col gap-2",children:Lr.map(l=>a.jsx(Tr,{title:l.label,description:l.description,selected:r===l.value,onClick:()=>i(l.value)},l.value))})]})})}),a.jsx(B.Footer,{children:a.jsxs(Ae,{children:[a.jsx(k,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),a.jsx(k,{variant:"primary",size:"sm",onClick:c,children:"Apply"})]})})]})}const ge=e=>{const n=/^\d+$/.test(e)?Number(e):Date.parse(e);return Number.isFinite(n)?n:null},Se=(e,n)=>{const t=ge(e),s=ge(n);return t===null||s===null?e===n?0:null:t===s?0:t<s?-1:1},Pr=2200;function Or({status:e,savedAt:n,savedVersion:t,confirmationRevision:s}){const[r,i]=o.useState(()=>Date.now()),[c,l]=o.useState(!1);o.useEffect(()=>{if(e!=="saved")return;const u=window.setTimeout(()=>i(Date.now()),En(ge(t),r));return()=>window.clearTimeout(u)},[r,t,e]),o.useEffect(()=>{if(s===0)return;l(!0);const u=window.setTimeout(()=>l(!1),Pr);return()=>window.clearTimeout(u)},[s]);const f=e==="saved"&&c,d=e==="pending"?"Saving...":e==="saving"?"Saving now...":e==="error"?"Save failed. Try again.":e==="conflict"?"Save paused: changed elsewhere":`Saved ${kn(ge(t),r)}`,m=V("inline-flex items-center gap-2 transition-colors",e==="saved"&&!f&&"text-fg-secondary",f&&"text-accent-success",(e==="pending"||e==="saving")&&"text-fg-default",(e==="error"||e==="conflict")&&"text-fg-error"),x=V("save-progress-ring flex h-4 w-4 shrink-0 items-center justify-center rounded-full",(e==="pending"||e==="saving")&&"save-progress-ring-active",e==="saved"&&f&&"save-progress-ring-complete",(e==="error"||e==="conflict")&&"save-progress-ring-error"),b=e==="error"||e==="conflict"?a.jsx(qn,{className:"h-3.5 w-3.5",weight:"fill"}):a.jsx("span",{className:x,"aria-hidden":!0,children:a.jsx("span",{className:"h-2 w-2 rounded-full bg-elevated"})});return a.jsxs(S,{as:"span",variant:"label",weight:"medium",className:m,role:"status","aria-live":"polite",title:n,children:[b,d]})}function Br({title:e,titleRef:n,isPinned:t,createdAt:s,saveStatus:r,savedAt:i,savedVersion:c,saveConfirmationRevision:l,onTitleChange:f,onCopyMarkdown:d,onDownloadDocument:m,onTogglePinned:x,onChangeLayout:b,onCloneNote:u,onRestoreVersion:h,onDelete:v,onSave:N}){return a.jsx("div",{className:"surface-floating sticky top-20 z-[1001] mb-7 px-5 pt-4 pb-3.5",children:a.jsxs("div",{className:"flex flex-col gap-3.5",children:[a.jsxs("div",{className:"flex items-start justify-between gap-5",children:[a.jsxs("div",{className:"min-w-0 flex-1 pt-0.5",children:[a.jsx(S,{as:"div",variant:"micro",weight:"semibold",tracking:"widest",transform:"uppercase",tone:"tertiary",className:"mb-1.5",children:"Thought in progress"}),a.jsx("input",{ref:n,"aria-label":"Note title",placeholder:"Title",className:"text-heading sm:text-display w-full bg-transparent font-semibold leading-[1.25] tracking-[-0.02em] outline-none",type:"text",value:e,onChange:R=>f(R.target.value)})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a.jsx(wt,{button:a.jsx(Rt,{label:"Note actions",size:"lg"}),items:[{name:"Copy Markdown",onClick:d},{name:"Download document",onClick:m},{type:"separator",key:"export-separator"},{name:t?"Unpin":"Pin",onClick:x},{name:"Change layout",onClick:b},{type:"separator"},{name:"Clone this note",onClick:u},{name:"Restore previous version",onClick:h},{type:"separator"},{name:"Delete",onClick:v}]}),a.jsx(k,{size:"sm",variant:"subtle",isLoading:r==="saving",disabled:r==="conflict",onClick:N,children:"Save"})]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-t border-border-subtle/80 pt-3",children:[t&&a.jsxs(S,{as:"span",variant:"label",weight:"medium",tone:"secondary",className:"inline-flex items-center gap-1.5",children:[a.jsx(Zn,{className:"h-3 w-3",weight:"fill"}),"Pinned"]}),t&&a.jsx("span",{className:"h-1 w-1 rounded-full bg-border-secondary"}),a.jsx(Or,{status:r,savedAt:i,savedVersion:c,confirmationRevision:l}),a.jsx("span",{className:"h-1 w-1 rounded-full bg-border-secondary"}),a.jsxs(S,{as:"span",variant:"micro",weight:"medium",tone:"tertiary",children:["Created ",s]})]})]})})}const Fr="/assets/images/",Hr=120,$r=100,Bt=/^(?:con|prn|aux|nul|com[1-9\u00b9\u00b2\u00b3]|lpt[1-9\u00b9\u00b2\u00b3])(?:\.|$)/i,Ft=e=>{const n=e.codePointAt(0)??0;return n<=31||n>=127&&n<=159},Ht=(e,n)=>{const t=new TextEncoder;let s=0,r="";for(const i of e){const c=t.encode(i).byteLength;if(s+c>n)break;r+=i,s+=c}return r},Ve=e=>e.replace(/^[.\s-]+|[.\s-]+$/g,""),Ir=e=>{let n=Array.from(e.normalize("NFC").trim().toLowerCase(),t=>Ft(t)||/[\\/:*?"<>|\s]/.test(t)?"-":t).join("").replace(/-+/g,"-").replace(/^[.-]+|[.-]+$/g,"");return Bt.test(n)&&(n=`note-${n}`),n=Ve(Ht(n,Hr)),n||"untitled-note"},Ce=e=>JSON.stringify(e),Ne=e=>{const n=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/--/g,"&#45;&#45;");return Array.from(n,t=>Ft(t)?`&#${t.codePointAt(0)};`:t).join("")},Re=e=>{if(!e)return;const n=Number(e);if(!Number.isFinite(n))return e;const t=new Date(n);return Number.isNaN(t.getTime())?e:t.toISOString()},et=()=>typeof window>"u"||!window.location?.origin?"http://localhost":window.location.origin,ke=(e,n=et())=>{try{const t=new URL(e,n);return t.origin===n&&t.pathname.startsWith(Fr)}catch{return!1}},$t=(e,n=et())=>{const t=new URL(e,n);return`${t.pathname}${t.search}`},Ur=e=>e.headers.get("content-type")?.split(";")[0]?.trim().toLowerCase()??"",zr=(e,n)=>{let t=e.normalize("NFC").trim().replace(/[^\p{L}\p{M}\p{N}._-]+/gu,"-").replace(/-+/g,"-");return t=Ve(t),Bt.test(t)&&(t=`image-${t}`),Ve(Ht(t,$r))||n},Zr=e=>{const n=e.lastIndexOf(".");return n<=0||n===e.length-1?{baseName:e,extension:""}:{baseName:e.slice(0,n),extension:e.slice(n)}},Vr=e=>{try{return decodeURIComponent(e)}catch{return e}},Wr=(e,n,t,s)=>{const i=new URL(e,et()).pathname.split("/").filter(Boolean),c=Vr(i[i.length-1]??""),l=`image-${n+1}`,{baseName:f}=Zr(c||l),d=zr(f,l);let m=`${d}.${t}`,x=2;for(;s.has(m.normalize("NFC").toLowerCase());)m=`${d}-${x}.${t}`,x+=1;return s.add(m.normalize("NFC").toLowerCase()),`assets/${m}`},It=e=>e.replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,"$1"),Ut=async(e,n,t,s,r)=>{const i=s.get(n);if(i)return i;const c=await t(n,{credentials:"same-origin"});if(!c.ok)throw new Error(`Failed to fetch image asset: ${n}`);const l=Gn(Ur(c));if(!l)throw new Error(`Image asset did not return image content: ${n}`);const f=Wr(n,s.size,l,r);return e.file(f,new Uint8Array(await c.arrayBuffer())),s.set(n,f),f},Kr=(e,n)=>{let t=null;for(let s=n;s<e.length;s+=1){const r=e[s];if(t){r===t&&(t=null);continue}if(r==='"'||r==="'"){t=r;continue}if(r===">")return s}return-1},Yr=(e,n)=>{let t=n;for(;t<e.length;){const s=e.toLowerCase().indexOf("<img",t);if(s===-1)return-1;const r=e[s+4],i=s===0?-1:e.lastIndexOf("<",s-1),c=s===0?-1:e.lastIndexOf(">",s-1);if(i<=c&&(!r||/[\s/>]/.test(r)))return s;t=s+4}return-1},Qr=(e,n,t,s)=>{let r=n;for(;r<t;){for(;r<t&&/[\s/]/.test(e[r]);)r+=1;const i=r;for(;r<t&&/[^\s=/>]/.test(e[r]);)r+=1;const c=e.slice(i,r).toLowerCase();for(;r<t&&/\s/.test(e[r]);)r+=1;if(e[r]!=="=")continue;for(r+=1;r<t&&/\s/.test(e[r]);)r+=1;const l=e[r];if(l==='"'||l==="'"){const d=r+1,m=e.indexOf(l,d);if(m===-1||m>t)return;if(r=m+1,c===s)return{end:m,start:d,value:e.slice(d,m)};continue}const f=r;for(;r<t&&/[^\s>]/.test(e[r]);)r+=1;if(c===s)return{end:r,start:f,value:e.slice(f,r)}}},zt=e=>{const n=[];let t=0;for(;t<e.length;){const s=Yr(e,t);if(s===-1)break;const r=Kr(e,s+4);if(r===-1)break;const i=Qr(e,s+4,r,"src");i&&n.push({end:r+1,source:i,start:s}),t=r+1}return n},Zt=(e,n)=>{let t=e;for(const s of[...n].sort((r,i)=>i.start-r.start))t=`${t.slice(0,s.start)}${s.value}${t.slice(s.end)}`;return t},Vt=(e,n)=>{let t=e;for(const s of[...n].sort((r,i)=>i.start-r.start))t=`${t.slice(0,s.start)}${s.value}${t.slice(s.end)}`;return t},Wt=e=>{const n=[];let t=0;for(;t<e.length;){const s=e.indexOf("![",t);if(s===-1)break;let r=s+2,i=1;for(;r<e.length&&i>0&&e[r]!==`
2
+ import{r as o,j as a}from"./floating-ui.react-dom-BWTnA00G.js";import{al as jn,A as vt,T as S,i as Ye,m as An,q as L,M as B,B as k,am as En,an as kn,c as V,N as wt,K as Ct,V as Tn,e as je,u as Qe,ao as Mn,ap as Dn,aq as Ln,J as _n,s as Pn,ar as On,a1 as Nt,ah as St,as as ze,at as Bn,W as Fn,ai as Hn,aj as $n,au as In,Q as qe,P as Ge,av as Je,h as Un,l as ie,D as zn}from"./time-PxWila4-.js";import{M as Ae,h as Rt,m as Zn,a as Fe,b as Vn,d as G,s as Wn,l as jt,o as Kn,p as At,k as Et,q as Yn,r as rt,e as Qn}from"./useNoteMutate-BjvZUmtX.js";import{m as qn,C as st}from"./Callout-CcYyvHQP.js";import{J as kt,g as Gn,A as Tt,S as Jn,i as Xn,U as at,F as er,N as tr}from"./NotePropertiesPanel-6P7UfRBR.js";import{c as nr}from"./Info.es-CYxg-Vku.js";import{N as Ee,T as rr,S as sr}from"./url-DKUMNVCI.js";import{S as ar}from"./SurfaceCard-D5QxOte_.js";import{b as or,c as ir,u as cr,R as lr}from"./useReminderMutate-C5n-5LM-.js";import{n as dr}from"./Plus.es-Dy6onD-Z.js";import{h as Xe,m as ur,L as Mt,Z as Dt,M as fr,K as pr,a as mr}from"./note-ui-BtzPk8gA.js";import{u as hr}from"./image.api-ChvlfuZg.js";import{L as gr,t as ot,q as xr,B as he,G as br,y as it}from"./note-core-YhYEmI_R.js";import{s as Lt}from"./FlowArrow.es-Dxee98ir.js";import{_ as Ze}from"./preload-helper-BXl3LOEh.js";import{s as yr}from"./Copy.es-fMv0ETir.js";import{A as vr}from"./AuxiliaryPanelHeader-HAttwVby.js";import{f as wr,c as Cr}from"./tag.api-DEUROVKQ.js";import{cn as ct}from"./note-runtime-B3ats-dC.js";import{s as Nr}from"./File.es-CHtXXafR.js";import{p as Sr}from"./LinkSimple.es-B-P-7Iem.js";function Rr(e,n){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if("shouldBlockFn"in e)return e;if(typeof e=="function")return{shouldBlockFn:async()=>await e(),enableBeforeUnload:!0,withResolver:!1};const t=!!(e.condition??!0),s=e.blockerFn;return{shouldBlockFn:async()=>t&&s!==void 0?await s():t,enableBeforeUnload:t,withResolver:s===void 0}}function jr(e,n){const{shouldBlockFn:t,enableBeforeUnload:s=!0,disabled:r=!1,withResolver:i=!1}=Rr(e),c=jn(),{history:l}=c,[f,d]=o.useState({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return o.useEffect(()=>{const m=async x=>{function b(A){const w=c.parseLocation(A),p=c.getMatchedRoutes(w.pathname);return p.foundRoute===void 0?{routeId:"__notFound__",fullPath:w.pathname,pathname:w.pathname,params:p.routeParams,search:c.options.parseSearch(A.search)}:{routeId:p.foundRoute.id,fullPath:p.foundRoute.fullPath,pathname:w.pathname,params:p.routeParams,search:c.options.parseSearch(A.search)}}const u=b(x.currentLocation),h=b(x.nextLocation);if(u.routeId==="__notFound__"&&h.routeId!=="__notFound__")return!1;const v=await t({action:x.action,current:u,next:h});if(!i)return v;if(!v)return!1;const R=await new Promise(A=>{d({status:"blocked",current:u,next:h,action:x.action,proceed:()=>A(!1),reset:()=>A(!0)})});return d({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),R};return r?void 0:l.block({blockerFn:m,enableBeforeUnload:s})},[t,s,r,i,l,c]),f}const Ar=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M212,40a12,12,0,0,1-12,12H170.71A20,20,0,0,0,151,68.42L142.38,116H184a12,12,0,0,1,0,24H138l-9.44,51.87A44,44,0,0,1,85.29,228H56a12,12,0,0,1,0-24H85.29A20,20,0,0,0,105,187.58L113.62,140H72a12,12,0,0,1,0-24h46l9.44-51.87A44,44,0,0,1,170.71,28H200A12,12,0,0,1,212,40Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M200,40V200a16,16,0,0,1-16,16H56V56A16,16,0,0,1,72,40Z",opacity:"0.2"}),o.createElement("path",{d:"M208,40a8,8,0,0,1-8,8H170.71a24,24,0,0,0-23.62,19.71L137.59,120H184a8,8,0,0,1,0,16H134.68l-10,55.16A40,40,0,0,1,85.29,224H56a8,8,0,0,1,0-16H85.29a24,24,0,0,0,23.62-19.71l9.5-52.29H72a8,8,0,0,1,0-16h49.32l10-55.16A40,40,0,0,1,170.71,32H200A8,8,0,0,1,208,40Z"}))],["fill",o.createElement(o.Fragment,null,o.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,32ZM176,72H159.92a16,16,0,0,0-15.73,13l-6.55,35H168a8,8,0,0,1,0,16H134.64l-7.11,37.9A32,32,0,0,1,96.08,200H80a8,8,0,0,1,0-16H96.08A16,16,0,0,0,111.81,171L118.36,136H88a8,8,0,0,1,0-16h33.36l7.11-37.9A32,32,0,0,1,159.92,56H176a8,8,0,0,1,0,16Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M206,40a6,6,0,0,1-6,6H170.71a26,26,0,0,0-25.58,21.35L135.19,122H184a6,6,0,0,1,0,12H133l-10.33,56.8A38,38,0,0,1,85.29,222H56a6,6,0,0,1,0-12H85.29a26,26,0,0,0,25.58-21.35L120.81,134H72a6,6,0,0,1,0-12h51l10.33-56.8A38,38,0,0,1,170.71,34H200A6,6,0,0,1,206,40Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M208,40a8,8,0,0,1-8,8H170.71a24,24,0,0,0-23.62,19.71L137.59,120H184a8,8,0,0,1,0,16H134.68l-10,55.16A40,40,0,0,1,85.29,224H56a8,8,0,0,1,0-16H85.29a24,24,0,0,0,23.62-19.71l9.5-52.29H72a8,8,0,0,1,0-16h49.32l10-55.16A40,40,0,0,1,170.71,32H200A8,8,0,0,1,208,40Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M204,40a4,4,0,0,1-4,4H170.71a28,28,0,0,0-27.55,23l-10.37,57H184a4,4,0,0,1,0,8H131.34l-10.63,58.44A36,36,0,0,1,85.29,220H56a4,4,0,0,1,0-8H85.29a28,28,0,0,0,27.55-23l10.37-57H72a4,4,0,0,1,0-8h52.66l10.63-58.44A36,36,0,0,1,170.71,36H200A4,4,0,0,1,204,40Z"}))]]),Er=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M230.15,70.54,185.46,25.86a20,20,0,0,0-28.28,0L33.86,149.17A19.86,19.86,0,0,0,28,163.31V208a20,20,0,0,0,20,20H216a12,12,0,0,0,0-24H125L230.15,98.83A20,20,0,0,0,230.15,70.54ZM136,81l11,11L76,163,65,152ZM52,204V173l15.52,15.51h0L83,204Zm52-13L93,180l71-71,11,11Zm88-88L153,64l18.34-18.34,39,39Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z",opacity:"0.2"}),o.createElement("path",{d:"M227.32,73.37,182.63,28.69a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H216a8,8,0,0,0,0-16H115.32l112-112A16,16,0,0,0,227.32,73.37ZM79.32,188,164,103.31,180.69,120,96,204.69ZM68,176.69,51.31,160,136,75.31,152.69,92Zm-20,2.62L76.69,208H48Zm144-70.62L147.32,64l24-24L216,84.69Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M227.32,73.37,182.63,28.69a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H216a8,8,0,0,0,0-16H115.32l112-112A16,16,0,0,0,227.32,73.37ZM79.32,188l90.34-90.34,16.69,16.68L96,204.69Zm79-101.66h0L68,176.69,51.31,160l90.35-90.34ZM48,179.31,76.69,208H48Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M225.91,74.79,181.22,30.1a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H216a6,6,0,0,0,0-12H110.49L225.91,94.59A14,14,0,0,0,225.91,74.79ZM76.49,188,164,100.48,183.52,120,96,207.51ZM68,179.52,48.49,160,136,72.49,155.52,92ZM46,208V174.48L81.52,210H48A2,2,0,0,1,46,208ZM217.42,86.1,192,111.52,144.49,64,169.9,38.59a2,2,0,0,1,2.83,0l44.69,44.68A2,2,0,0,1,217.42,86.1Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M227.32,73.37,182.63,28.69a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H216a8,8,0,0,0,0-16H115.32l112-112A16,16,0,0,0,227.32,73.37ZM136,75.31,152.69,92,68,176.69,51.31,160ZM48,208V179.31L76.69,208Zm48-3.31L79.32,188,164,103.31,180.69,120Zm96-96L147.32,64l24-24L216,84.69Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L39.51,154.83A12,12,0,0,0,36,163.31V208a12,12,0,0,0,12,12H216a4,4,0,0,0,0-8H105.66L224.49,93.17A12,12,0,0,0,224.49,76.2ZM73.66,188,164,97.66,186.35,120,96,210.34ZM68,182.34,45.66,160,136,69.66,158.35,92ZM44,208V169.66l21.17,21.17h0L86.34,212H48A4,4,0,0,1,44,208ZM218.83,87.51,192,114.34,141.66,64l26.83-26.83a4,4,0,0,1,5.66,0l44.68,44.69A4,4,0,0,1,218.83,87.51Z"}))]]),_t=o.forwardRef((e,n)=>o.createElement(vt,{ref:n,...e,weights:Ar}));_t.displayName="FunctionIcon";const Pt=_t,Ot=o.forwardRef((e,n)=>o.createElement(vt,{ref:n,...e,weights:Er}));Ot.displayName="PencilLineIcon";const kr=Ot;function Tr({title:e,description:n,selected:t=!1,onClick:s,children:r}){return a.jsxs("button",{type:"button","aria-pressed":t,className:`focus-ring-soft flex w-full items-start justify-between gap-3 p-3 text-left transition-colors sm:p-4 ${t?"surface-floating bg-elevated":"rounded-[14px] border border-border-subtle bg-transparent hover:border-border-secondary hover:bg-hover-subtle"}`,onClick:s,children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx(S,{as:"div",variant:"body",weight:"semibold",tone:t?"default":"secondary",children:e}),a.jsx(S,{as:"div",variant:"meta",weight:"medium",tone:t?"secondary":"tertiary",className:"mt-1",children:n})]}),r?a.jsx("div",{className:"shrink-0",children:r}):null]})}const Mr=e=>{const{data:n}=Ye({queryKey:L.notes.backReferences(e.noteId),async queryFn(){const t=await An(e.noteId);if(t.type==="error")throw t;return t.backReferences}});return e.render(n)};function Dr({noteId:e,searchParams:n,render:t}){const{data:s}=Ye({queryKey:e?L.reminders.note(e,n):L.reminders.upcoming(n),queryFn:async()=>{if(e){const i=await or(e,n);if(i.type==="error")throw i;return i.noteReminders}const r=await ir(n);if(r.type==="error")throw r;return r.upcomingReminders}});return a.jsx(a.Fragment,{children:t(s)})}const Lr=[{value:"narrow",label:"Narrow",description:"Optimized for reading long-form content"},{value:"wide",label:"Wide",description:"Balanced width suitable for most content"},{value:"full",label:"Full Width",description:"Maximize screen space utilization"}];function _r({isOpen:e,onClose:n,onSave:t,currentLayout:s="wide"}){const[r,i]=o.useState(s);o.useEffect(()=>{e&&i(s)},[e,s]);const c=()=>{t(r),n()};return a.jsxs(B,{isOpen:e,onClose:n,variant:"compact",children:[a.jsx(B.Header,{title:"Layout Settings",onClose:n}),a.jsx(B.Body,{children:a.jsx("div",{className:"flex flex-col gap-3 sm:gap-4",children:a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsx(S,{as:"div",variant:"body",weight:"semibold",tone:"secondary",children:"Note layout"}),a.jsx("div",{className:"flex flex-col gap-2",children:Lr.map(l=>a.jsx(Tr,{title:l.label,description:l.description,selected:r===l.value,onClick:()=>i(l.value)},l.value))})]})})}),a.jsx(B.Footer,{children:a.jsxs(Ae,{children:[a.jsx(k,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),a.jsx(k,{variant:"primary",size:"sm",onClick:c,children:"Apply"})]})})]})}const ge=e=>{const n=/^\d+$/.test(e)?Number(e):Date.parse(e);return Number.isFinite(n)?n:null},Se=(e,n)=>{const t=ge(e),s=ge(n);return t===null||s===null?e===n?0:null:t===s?0:t<s?-1:1},Pr=2200;function Or({status:e,savedAt:n,savedVersion:t,confirmationRevision:s}){const[r,i]=o.useState(()=>Date.now()),[c,l]=o.useState(!1);o.useEffect(()=>{if(e!=="saved")return;const u=window.setTimeout(()=>i(Date.now()),En(ge(t),r));return()=>window.clearTimeout(u)},[r,t,e]),o.useEffect(()=>{if(s===0)return;l(!0);const u=window.setTimeout(()=>l(!1),Pr);return()=>window.clearTimeout(u)},[s]);const f=e==="saved"&&c,d=e==="pending"?"Saving...":e==="saving"?"Saving now...":e==="error"?"Save failed. Try again.":e==="conflict"?"Save paused: changed elsewhere":`Saved ${kn(ge(t),r)}`,m=V("inline-flex items-center gap-2 transition-colors",e==="saved"&&!f&&"text-fg-secondary",f&&"text-accent-success",(e==="pending"||e==="saving")&&"text-fg-default",(e==="error"||e==="conflict")&&"text-fg-error"),x=V("save-progress-ring flex h-4 w-4 shrink-0 items-center justify-center rounded-full",(e==="pending"||e==="saving")&&"save-progress-ring-active",e==="saved"&&f&&"save-progress-ring-complete",(e==="error"||e==="conflict")&&"save-progress-ring-error"),b=e==="error"||e==="conflict"?a.jsx(qn,{className:"h-3.5 w-3.5",weight:"fill"}):a.jsx("span",{className:x,"aria-hidden":!0,children:a.jsx("span",{className:"h-2 w-2 rounded-full bg-elevated"})});return a.jsxs(S,{as:"span",variant:"label",weight:"medium",className:m,role:"status","aria-live":"polite",title:n,children:[b,d]})}function Br({title:e,titleRef:n,isPinned:t,createdAt:s,saveStatus:r,savedAt:i,savedVersion:c,saveConfirmationRevision:l,onTitleChange:f,onCopyMarkdown:d,onDownloadDocument:m,onTogglePinned:x,onChangeLayout:b,onCloneNote:u,onRestoreVersion:h,onDelete:v,onSave:N}){return a.jsx("div",{className:"surface-floating sticky top-20 z-[1001] mb-7 px-5 pt-4 pb-3.5",children:a.jsxs("div",{className:"flex flex-col gap-3.5",children:[a.jsxs("div",{className:"flex items-start justify-between gap-5",children:[a.jsxs("div",{className:"min-w-0 flex-1 pt-0.5",children:[a.jsx(S,{as:"div",variant:"micro",weight:"semibold",tracking:"widest",transform:"uppercase",tone:"tertiary",className:"mb-1.5",children:"Thought in progress"}),a.jsx("input",{ref:n,"aria-label":"Note title",placeholder:"Title",className:"text-heading sm:text-display w-full bg-transparent font-semibold leading-[1.25] tracking-[-0.02em] outline-none",type:"text",value:e,onChange:R=>f(R.target.value)})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a.jsx(wt,{button:a.jsx(Rt,{label:"Note actions",size:"lg"}),items:[{name:"Copy Markdown",onClick:d},{name:"Download document",onClick:m},{type:"separator",key:"export-separator"},{name:t?"Unpin":"Pin",onClick:x},{name:"Change layout",onClick:b},{type:"separator"},{name:"Clone this note",onClick:u},{name:"Restore previous version",onClick:h},{type:"separator"},{name:"Delete",onClick:v}]}),a.jsx(k,{size:"sm",variant:"subtle",isLoading:r==="saving",disabled:r==="conflict",onClick:N,children:"Save"})]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-t border-border-subtle/80 pt-3",children:[t&&a.jsxs(S,{as:"span",variant:"label",weight:"medium",tone:"secondary",className:"inline-flex items-center gap-1.5",children:[a.jsx(Zn,{className:"h-3 w-3",weight:"fill"}),"Pinned"]}),t&&a.jsx("span",{className:"h-1 w-1 rounded-full bg-border-secondary"}),a.jsx(Or,{status:r,savedAt:i,savedVersion:c,confirmationRevision:l}),a.jsx("span",{className:"h-1 w-1 rounded-full bg-border-secondary"}),a.jsxs(S,{as:"span",variant:"micro",weight:"medium",tone:"tertiary",children:["Created ",s]})]})]})})}const Fr="/assets/images/",Hr=120,$r=100,Bt=/^(?:con|prn|aux|nul|com[1-9\u00b9\u00b2\u00b3]|lpt[1-9\u00b9\u00b2\u00b3])(?:\.|$)/i,Ft=e=>{const n=e.codePointAt(0)??0;return n<=31||n>=127&&n<=159},Ht=(e,n)=>{const t=new TextEncoder;let s=0,r="";for(const i of e){const c=t.encode(i).byteLength;if(s+c>n)break;r+=i,s+=c}return r},Ve=e=>e.replace(/^[.\s-]+|[.\s-]+$/g,""),Ir=e=>{let n=Array.from(e.normalize("NFC").trim().toLowerCase(),t=>Ft(t)||/[\\/:*?"<>|\s]/.test(t)?"-":t).join("").replace(/-+/g,"-").replace(/^[.-]+|[.-]+$/g,"");return Bt.test(n)&&(n=`note-${n}`),n=Ve(Ht(n,Hr)),n||"untitled-note"},Ce=e=>JSON.stringify(e),Ne=e=>{const n=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/--/g,"&#45;&#45;");return Array.from(n,t=>Ft(t)?`&#${t.codePointAt(0)};`:t).join("")},Re=e=>{if(!e)return;const n=Number(e);if(!Number.isFinite(n))return e;const t=new Date(n);return Number.isNaN(t.getTime())?e:t.toISOString()},et=()=>typeof window>"u"||!window.location?.origin?"http://localhost":window.location.origin,ke=(e,n=et())=>{try{const t=new URL(e,n);return t.origin===n&&t.pathname.startsWith(Fr)}catch{return!1}},$t=(e,n=et())=>{const t=new URL(e,n);return`${t.pathname}${t.search}`},Ur=e=>e.headers.get("content-type")?.split(";")[0]?.trim().toLowerCase()??"",zr=(e,n)=>{let t=e.normalize("NFC").trim().replace(/[^\p{L}\p{M}\p{N}._-]+/gu,"-").replace(/-+/g,"-");return t=Ve(t),Bt.test(t)&&(t=`image-${t}`),Ve(Ht(t,$r))||n},Zr=e=>{const n=e.lastIndexOf(".");return n<=0||n===e.length-1?{baseName:e,extension:""}:{baseName:e.slice(0,n),extension:e.slice(n)}},Vr=e=>{try{return decodeURIComponent(e)}catch{return e}},Wr=(e,n,t,s)=>{const i=new URL(e,et()).pathname.split("/").filter(Boolean),c=Vr(i[i.length-1]??""),l=`image-${n+1}`,{baseName:f}=Zr(c||l),d=zr(f,l);let m=`${d}.${t}`,x=2;for(;s.has(m.normalize("NFC").toLowerCase());)m=`${d}-${x}.${t}`,x+=1;return s.add(m.normalize("NFC").toLowerCase()),`assets/${m}`},It=e=>e.replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,"$1"),Ut=async(e,n,t,s,r)=>{const i=s.get(n);if(i)return i;const c=await t(n,{credentials:"same-origin"});if(!c.ok)throw new Error(`Failed to fetch image asset: ${n}`);const l=Gn(Ur(c));if(!l)throw new Error(`Image asset did not return image content: ${n}`);const f=Wr(n,s.size,l,r);return e.file(f,new Uint8Array(await c.arrayBuffer())),s.set(n,f),f},Kr=(e,n)=>{let t=null;for(let s=n;s<e.length;s+=1){const r=e[s];if(t){r===t&&(t=null);continue}if(r==='"'||r==="'"){t=r;continue}if(r===">")return s}return-1},Yr=(e,n)=>{let t=n;for(;t<e.length;){const s=e.toLowerCase().indexOf("<img",t);if(s===-1)return-1;const r=e[s+4],i=s===0?-1:e.lastIndexOf("<",s-1),c=s===0?-1:e.lastIndexOf(">",s-1);if(i<=c&&(!r||/[\s/>]/.test(r)))return s;t=s+4}return-1},Qr=(e,n,t,s)=>{let r=n;for(;r<t;){for(;r<t&&/[\s/]/.test(e[r]);)r+=1;const i=r;for(;r<t&&/[^\s=/>]/.test(e[r]);)r+=1;const c=e.slice(i,r).toLowerCase();for(;r<t&&/\s/.test(e[r]);)r+=1;if(e[r]!=="=")continue;for(r+=1;r<t&&/\s/.test(e[r]);)r+=1;const l=e[r];if(l==='"'||l==="'"){const d=r+1,m=e.indexOf(l,d);if(m===-1||m>t)return;if(r=m+1,c===s)return{end:m,start:d,value:e.slice(d,m)};continue}const f=r;for(;r<t&&/[^\s>]/.test(e[r]);)r+=1;if(c===s)return{end:r,start:f,value:e.slice(f,r)}}},zt=e=>{const n=[];let t=0;for(;t<e.length;){const s=Yr(e,t);if(s===-1)break;const r=Kr(e,s+4);if(r===-1)break;const i=Qr(e,s+4,r,"src");i&&n.push({end:r+1,source:i,start:s}),t=r+1}return n},Zt=(e,n)=>{let t=e;for(const s of[...n].sort((r,i)=>i.start-r.start))t=`${t.slice(0,s.start)}${s.value}${t.slice(s.end)}`;return t},Vt=(e,n)=>{let t=e;for(const s of[...n].sort((r,i)=>i.start-r.start))t=`${t.slice(0,s.start)}${s.value}${t.slice(s.end)}`;return t},Wt=e=>{const n=[];let t=0;for(;t<e.length;){const s=e.indexOf("![",t);if(s===-1)break;let r=s+2,i=1;for(;r<e.length&&i>0&&e[r]!==`
3
3
  `;){if(e[r]==="\\"){r+=2;continue}e[r]==="["?i+=1:e[r]==="]"&&(i-=1),r+=1}if(i!==0||e[r]!=="("){t=s+2;continue}const c=r+1;let l=c;for(;l<e.length&&e[l]!==`
4
4
  `&&/\s/.test(e[l]);)l+=1;if(l>=e.length||e[l]===`
5
5
  `){t=s+2;continue}let f=l,d=l,m=l;if(e[l]==="<"){for(r=l+1;r<e.length&&e[r]!==">"&&e[r]!==`
@@ -1,4 +1,4 @@
1
- import{j as e,r as g}from"./floating-ui.react-dom-BWTnA00G.js";import{a as L,m as Q}from"./useNoteMutate-BjvZUmtX.js";import{g as q,x as G,y as V,c as X,F as J,B as Y,T as m,q as k,P as W,E as A,Q as Z,D as C,k as ee,h as te,l as w,i as re,s as se,O as ae}from"./time-PxWila4-.js";import{A as ne}from"./AuxiliaryPanelHeader-HAttwVby.js";import{N as P,f as ie,g as oe,T as le}from"./url-DKUMNVCI.js";import{f as ce}from"./Graph-hVj6vAYJ.js";import{s as de}from"./ArrowRight.es-BlNsZQFs.js";import{V as R}from"./ViewChip-BVkZAXyx.js";import"./app-4M3jUhmd.js";import{f as me}from"./search-admin-adapter-Daf7e2YQ.js";import{p as he}from"./LinkSimple.es-B-P-7Iem.js";import{s as ue}from"./File.es-CHtXXafR.js";import"./preload-helper-BXl3LOEh.js";const xe=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),O=({children:t,match:s})=>{const r=s.trim();if(!r)return e.jsx("span",{children:t});const a=xe(r),n=new RegExp(`(${a})`,"gi"),o=new RegExp(`^${a}$`,"i"),i=t.split(n);return e.jsx("span",{children:i.map((c,d)=>o.test(c)?e.jsx("mark",{children:c},d):e.jsx(g.Fragment,{children:c},d))})},pe={hybrid:"HYBRID",lexical:"LEXICAL",semantic:"SEMANTIC"};function fe({query:t,limit:s=25,offset:r=0,mode:a="hybrid"}){return q(`query FetchSearchNotes($query: String!, $pagination: PaginationInput!, $mode: SearchMode!) {
1
+ import{j as e,r as g}from"./floating-ui.react-dom-BWTnA00G.js";import{a as L,m as Q}from"./useNoteMutate-BjvZUmtX.js";import{g as q,x as G,y as V,c as X,F as J,B as Y,T as m,q as k,P as W,E as A,Q as Z,D as C,k as ee,h as te,l as w,i as re,s as se,O as ae}from"./time-PxWila4-.js";import{A as ne}from"./AuxiliaryPanelHeader-HAttwVby.js";import{N as P,f as ie,g as oe,T as le}from"./url-DKUMNVCI.js";import{f as ce}from"./Graph-hVj6vAYJ.js";import{s as de}from"./ArrowRight.es-BlNsZQFs.js";import{V as R}from"./ViewChip-BVkZAXyx.js";import"./app-BFM2V_Rx.js";import{f as me}from"./search-admin-adapter-Daf7e2YQ.js";import{p as he}from"./LinkSimple.es-B-P-7Iem.js";import{s as ue}from"./File.es-CHtXXafR.js";import"./preload-helper-BXl3LOEh.js";const xe=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),O=({children:t,match:s})=>{const r=s.trim();if(!r)return e.jsx("span",{children:t});const a=xe(r),n=new RegExp(`(${a})`,"gi"),o=new RegExp(`^${a}$`,"i"),i=t.split(n);return e.jsx("span",{children:i.map((c,d)=>o.test(c)?e.jsx("mark",{children:c},d):e.jsx(g.Fragment,{children:c},d))})},pe={hybrid:"HYBRID",lexical:"LEXICAL",semantic:"SEMANTIC"};function fe({query:t,limit:s=25,offset:r=0,mode:a="hybrid"}){return q(`query FetchSearchNotes($query: String!, $pagination: PaginationInput!, $mode: SearchMode!) {
2
2
  searchNotes(query: $query, pagination: $pagination, mode: $mode) {
3
3
  totalCount
4
4
  semanticAvailable
@@ -1 +1 @@
1
- import{r as c,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{i as T,q as S,P as k,T as f,F as P,x as j,y as g,Q as E,D as R,k as q,E as C,l as x,h as I}from"./time-PxWila4-.js";import{s as A,T as O,a as L,i as F,b as Q,F as v}from"./app-4M3jUhmd.js";import{T as _,e as D}from"./url-DKUMNVCI.js";import{f as M}from"./tag.api-DEUROVKQ.js";import{f as B}from"./Graph-hVj6vAYJ.js";import"./useNoteMutate-BjvZUmtX.js";import"./preload-helper-BXl3LOEh.js";const z=s=>{const{data:d}=T({queryKey:S.tags.list(s.searchParams),async queryFn(){const t=await M({query:s.searchParams.query,offset:s.searchParams.offset,limit:s.searchParams.limit,sortBy:s.searchParams.sortBy,sortOrder:s.searchParams.sortOrder});if(t.type==="error")throw t;return t.allTags}});return s.render(d)},G=s=>{const[d,t]=c.useState(!1),r=c.useRef(null),n=c.useRef(!0),u=c.useRef(0),o=c.useCallback(()=>{r.current!==null&&(clearTimeout(r.current),r.current=null)},[]);c.useEffect(()=>(n.current=!0,()=>{n.current=!1,o()}),[o]);const m=c.useCallback(p=>{u.current+=1;const i=u.current;o(),n.current&&t(!0),r.current=setTimeout(()=>{r.current=null,Promise.resolve().then(p).catch(()=>{}).finally(()=>{n.current&&u.current===i&&t(!1)})},s)},[o,s]);return[d,m]},b=I(D);function X(){const s=b.useNavigate(),{page:d,query:t,limit:r,sortBy:n,sortOrder:u}=b.useSearch(),[o,m]=c.useState(t),[,p]=G(350),i=t.trim();c.useEffect(()=>{m(t)},[t]),c.useEffect(()=>{const a=o.trim();a!==i&&p(()=>{s({search:l=>({...l,page:1,query:a})})})},[o,s,i,p]);const y=a=>{s({search:l=>({...l,...a})})},w=()=>{m(""),y({page:1,query:""})};return e.jsxs(k,{title:"Tags",description:"Find tags you added with @ across your notes",children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{className:"surface-base flex min-w-0 items-center gap-2 rounded-[16px] px-3.5 py-2.5 lg:w-72",children:[e.jsx(B,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Search"}),e.jsx("div",{className:"h-5 w-px bg-divider"}),e.jsx("input",{"aria-label":"Search tags",placeholder:"Search tags",value:o,onChange:a=>m(a.target.value),className:"h-8 min-w-0 flex-1 bg-transparent text-sm font-medium text-fg-default outline-none placeholder:text-xs placeholder:font-medium placeholder:text-fg-placeholder"}),(o||i)&&e.jsx("button",{type:"button","aria-label":"Clear tag search",className:"focus-ring-soft flex h-7 w-7 shrink-0 items-center justify-center rounded-[10px] text-fg-tertiary outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default",onClick:w,children:e.jsx(P,{className:"h-3.5 w-3.5",weight:"bold"})})]}),e.jsxs("div",{className:"surface-base inline-flex flex-wrap items-center gap-3 rounded-[16px] px-3.5 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Items"}),e.jsx(j,{value:String(r),onValueChange:a=>{const l=Number(a);F(l)&&y({limit:l,page:1})},variant:"ghost",size:"sm",children:O.map(a=>e.jsx(g,{value:String(a),children:a===L?`Default (${a})`:a},a))})]}),e.jsx("div",{className:"h-5 w-px bg-divider"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Sort"}),e.jsxs(j,{value:n,onValueChange:a=>y({sortBy:a,page:1}),variant:"ghost",size:"sm",children:[e.jsx(g,{value:"referenceCount",children:"Usage"}),e.jsx(g,{value:"name",children:"Name"})]}),e.jsxs(j,{value:u,onValueChange:a=>y({sortOrder:a,page:1}),variant:"ghost",size:"sm",children:[e.jsx(g,{value:"desc",children:n==="name"?"Z to A":"Most used"}),e.jsx(g,{value:"asc",children:n==="name"?"A to Z":"Least used"})]})]})]})]}),e.jsx(E,{fallback:e.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[e.jsx(x,{width:"90px",height:"36px"}),e.jsx(x,{width:"120px",height:"36px"}),e.jsx(x,{width:"80px",height:"36px"}),e.jsx(x,{width:"100px",height:"36px"}),e.jsx(x,{width:"110px",height:"36px"}),e.jsx(x,{width:"70px",height:"36px"})]}),errorTitle:"Failed to load tags",errorDescription:"Retry loading the tag catalog",resetKeys:[d,r,i,n,u],children:e.jsx(z,{searchParams:{query:i,offset:(d-1)*r,limit:r,sortBy:n,sortOrder:u},render:({tags:a,totalCount:l})=>e.jsx(v,{fallback:e.jsx(C,{title:i?"No matching tags":"No tags yet",description:i?"Try another tag name":"Add @tags inside notes and they will appear here"}),children:a.length>0&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"flex flex-wrap gap-2.5",children:a.map(h=>e.jsxs(R,{to:_,params:{id:h.id},search:{page:1},className:"inline-flex items-center gap-1.5 rounded-full border border-border-subtle bg-hover-subtle px-3 py-1.5 text-fg-secondary transition-colors hover:border-border-secondary hover:bg-hover hover:text-fg-default",children:[e.jsx(f,{as:"span",variant:"meta",weight:"medium",className:"text-current",children:h.name}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",className:"text-current/70",children:h.referenceCount})]},h.id))}),e.jsx(v,{fallback:null,children:l&&r<l&&e.jsx(q,{page:d,last:Math.ceil(l/r),onChange:h=>{s({search:N=>({...N,page:h,query:i,limit:r,sortBy:n,sortOrder:u})})}})})]})})})})]})}export{X as default};
1
+ import{r as c,j as e}from"./floating-ui.react-dom-BWTnA00G.js";import{i as T,q as S,P as k,T as f,F as P,x as j,y as g,Q as E,D as R,k as q,E as C,l as x,h as I}from"./time-PxWila4-.js";import{s as A,T as O,a as L,i as F,b as Q,F as v}from"./app-BFM2V_Rx.js";import{T as _,e as D}from"./url-DKUMNVCI.js";import{f as M}from"./tag.api-DEUROVKQ.js";import{f as B}from"./Graph-hVj6vAYJ.js";import"./useNoteMutate-BjvZUmtX.js";import"./preload-helper-BXl3LOEh.js";const z=s=>{const{data:d}=T({queryKey:S.tags.list(s.searchParams),async queryFn(){const t=await M({query:s.searchParams.query,offset:s.searchParams.offset,limit:s.searchParams.limit,sortBy:s.searchParams.sortBy,sortOrder:s.searchParams.sortOrder});if(t.type==="error")throw t;return t.allTags}});return s.render(d)},G=s=>{const[d,t]=c.useState(!1),r=c.useRef(null),n=c.useRef(!0),u=c.useRef(0),o=c.useCallback(()=>{r.current!==null&&(clearTimeout(r.current),r.current=null)},[]);c.useEffect(()=>(n.current=!0,()=>{n.current=!1,o()}),[o]);const m=c.useCallback(p=>{u.current+=1;const i=u.current;o(),n.current&&t(!0),r.current=setTimeout(()=>{r.current=null,Promise.resolve().then(p).catch(()=>{}).finally(()=>{n.current&&u.current===i&&t(!1)})},s)},[o,s]);return[d,m]},b=I(D);function X(){const s=b.useNavigate(),{page:d,query:t,limit:r,sortBy:n,sortOrder:u}=b.useSearch(),[o,m]=c.useState(t),[,p]=G(350),i=t.trim();c.useEffect(()=>{m(t)},[t]),c.useEffect(()=>{const a=o.trim();a!==i&&p(()=>{s({search:l=>({...l,page:1,query:a})})})},[o,s,i,p]);const y=a=>{s({search:l=>({...l,...a})})},w=()=>{m(""),y({page:1,query:""})};return e.jsxs(k,{title:"Tags",description:"Find tags you added with @ across your notes",children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{className:"surface-base flex min-w-0 items-center gap-2 rounded-[16px] px-3.5 py-2.5 lg:w-72",children:[e.jsx(B,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Search"}),e.jsx("div",{className:"h-5 w-px bg-divider"}),e.jsx("input",{"aria-label":"Search tags",placeholder:"Search tags",value:o,onChange:a=>m(a.target.value),className:"h-8 min-w-0 flex-1 bg-transparent text-sm font-medium text-fg-default outline-none placeholder:text-xs placeholder:font-medium placeholder:text-fg-placeholder"}),(o||i)&&e.jsx("button",{type:"button","aria-label":"Clear tag search",className:"focus-ring-soft flex h-7 w-7 shrink-0 items-center justify-center rounded-[10px] text-fg-tertiary outline-none transition-colors hover:bg-hover-subtle hover:text-fg-default",onClick:w,children:e.jsx(P,{className:"h-3.5 w-3.5",weight:"bold"})})]}),e.jsxs("div",{className:"surface-base inline-flex flex-wrap items-center gap-3 rounded-[16px] px-3.5 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Items"}),e.jsx(j,{value:String(r),onValueChange:a=>{const l=Number(a);F(l)&&y({limit:l,page:1})},variant:"ghost",size:"sm",children:O.map(a=>e.jsx(g,{value:String(a),children:a===L?`Default (${a})`:a},a))})]}),e.jsx("div",{className:"h-5 w-px bg-divider"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{className:"h-4 w-4 shrink-0 text-fg-tertiary"}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",children:"Sort"}),e.jsxs(j,{value:n,onValueChange:a=>y({sortBy:a,page:1}),variant:"ghost",size:"sm",children:[e.jsx(g,{value:"referenceCount",children:"Usage"}),e.jsx(g,{value:"name",children:"Name"})]}),e.jsxs(j,{value:u,onValueChange:a=>y({sortOrder:a,page:1}),variant:"ghost",size:"sm",children:[e.jsx(g,{value:"desc",children:n==="name"?"Z to A":"Most used"}),e.jsx(g,{value:"asc",children:n==="name"?"A to Z":"Least used"})]})]})]})]}),e.jsx(E,{fallback:e.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[e.jsx(x,{width:"90px",height:"36px"}),e.jsx(x,{width:"120px",height:"36px"}),e.jsx(x,{width:"80px",height:"36px"}),e.jsx(x,{width:"100px",height:"36px"}),e.jsx(x,{width:"110px",height:"36px"}),e.jsx(x,{width:"70px",height:"36px"})]}),errorTitle:"Failed to load tags",errorDescription:"Retry loading the tag catalog",resetKeys:[d,r,i,n,u],children:e.jsx(z,{searchParams:{query:i,offset:(d-1)*r,limit:r,sortBy:n,sortOrder:u},render:({tags:a,totalCount:l})=>e.jsx(v,{fallback:e.jsx(C,{title:i?"No matching tags":"No tags yet",description:i?"Try another tag name":"Add @tags inside notes and they will appear here"}),children:a.length>0&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"flex flex-wrap gap-2.5",children:a.map(h=>e.jsxs(R,{to:_,params:{id:h.id},search:{page:1},className:"inline-flex items-center gap-1.5 rounded-full border border-border-subtle bg-hover-subtle px-3 py-1.5 text-fg-secondary transition-colors hover:border-border-secondary hover:bg-hover hover:text-fg-default",children:[e.jsx(f,{as:"span",variant:"meta",weight:"medium",className:"text-current",children:h.name}),e.jsx(f,{as:"span",variant:"label",weight:"medium",tone:"tertiary",className:"text-current/70",children:h.referenceCount})]},h.id))}),e.jsx(v,{fallback:null,children:l&&r<l&&e.jsx(q,{page:d,last:Math.ceil(l/r),onChange:h=>{s({search:N=>({...N,page:h,query:i,limit:r,sortBy:n,sortOrder:u})})}})})]})})})})]})}export{X as default};
@@ -1 +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"./time-PxWila4-.js";import{F as h,N as k}from"./app-4M3jUhmd.js";import{T as q}from"./url-DKUMNVCI.js";import"./NotePropertiesPanel-6P7UfRBR.js";import{e as w}from"./useNoteMutate-BjvZUmtX.js";import"./preload-helper-BXl3LOEh.js";import"./Graph-hVj6vAYJ.js";import"./AuxiliaryPanelHeader-HAttwVby.js";import"./LinkSimple.es-B-P-7Iem.js";import"./Plus.es-Dy6onD-Z.js";const R=s=>{const{data:r}=x({queryKey:j.notes.tagList(s.searchParams),async queryFn(){const t=await N({query:s.searchParams.query,offset:s.searchParams.offset,limit:s.searchParams.limit});if(t.type==="error")throw t;return t.tagNotes}});return s.render(r)},g=v(q);function B(){const s=g.useNavigate(),{id:r}=g.useParams(),{page:t}=g.useSearch(),i=25,{onDelete:m,onPinned:u,deleteWarningDialog:f}=w();return e.jsxs(y,{fallback:e.jsx(c,{title:"Tagged Notes",heading:e.jsx(o,{width:148,height:24,className:"rounded-full"}),description:e.jsx(o,{width:196,height:16,className:"rounded-full"}),variant:"default",children:e.jsxs("div",{className:"grid-auto-cards grid gap-5",children:[e.jsx(o,{height:"112px"}),e.jsx(o,{height:"112px"}),e.jsx(o,{height:"112px"})]})}),errorTitle:"Failed to load tagged notes",errorDescription:"Retry loading notes for this tag",resetKeys:[r,t,i],children:[e.jsx(R,{searchParams:{query:r,offset:(t-1)*i,limit:i},render:({notes:l,totalCount:n})=>{const d=l.flatMap(a=>a.tags).find(a=>a.id===r)?.name;return e.jsx(c,{title:d??"Tagged Notes",heading:d?n>0?`${d} (${n})`:d:"Tagged Notes",description:"Browse every note linked to this tag",variant:"default",children:e.jsx(h,{fallback:e.jsx(T,{title:"No tagged notes yet",description:"Notes tagged with this label will appear here"}),children:l.length>0&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"grid-auto-cards grid gap-5",children:l.map(a=>e.jsx(k,{...a,onPinned:()=>u(a.id,a.pinned),onDelete:()=>m(a.id)},a.id))}),e.jsx(h,{fallback:null,children:n&&i<n&&e.jsx(P,{page:t,last:Math.ceil(n/i),onChange:a=>{s({search:p=>({...p,page:a})})}})})]})})})}}),f]})}export{B as default};
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"./time-PxWila4-.js";import{F as h,N as k}from"./app-BFM2V_Rx.js";import{T as q}from"./url-DKUMNVCI.js";import"./NotePropertiesPanel-6P7UfRBR.js";import{e as w}from"./useNoteMutate-BjvZUmtX.js";import"./preload-helper-BXl3LOEh.js";import"./Graph-hVj6vAYJ.js";import"./AuxiliaryPanelHeader-HAttwVby.js";import"./LinkSimple.es-B-P-7Iem.js";import"./Plus.es-Dy6onD-Z.js";const R=s=>{const{data:r}=x({queryKey:j.notes.tagList(s.searchParams),async queryFn(){const t=await N({query:s.searchParams.query,offset:s.searchParams.offset,limit:s.searchParams.limit});if(t.type==="error")throw t;return t.tagNotes}});return s.render(r)},g=v(q);function B(){const s=g.useNavigate(),{id:r}=g.useParams(),{page:t}=g.useSearch(),i=25,{onDelete:m,onPinned:u,deleteWarningDialog:f}=w();return e.jsxs(y,{fallback:e.jsx(c,{title:"Tagged Notes",heading:e.jsx(o,{width:148,height:24,className:"rounded-full"}),description:e.jsx(o,{width:196,height:16,className:"rounded-full"}),variant:"default",children:e.jsxs("div",{className:"grid-auto-cards grid gap-5",children:[e.jsx(o,{height:"112px"}),e.jsx(o,{height:"112px"}),e.jsx(o,{height:"112px"})]})}),errorTitle:"Failed to load tagged notes",errorDescription:"Retry loading notes for this tag",resetKeys:[r,t,i],children:[e.jsx(R,{searchParams:{query:r,offset:(t-1)*i,limit:i},render:({notes:l,totalCount:n})=>{const d=l.flatMap(a=>a.tags).find(a=>a.id===r)?.name;return e.jsx(c,{title:d??"Tagged Notes",heading:d?n>0?`${d} (${n})`:d:"Tagged Notes",description:"Browse every note linked to this tag",variant:"default",children:e.jsx(h,{fallback:e.jsx(T,{title:"No tagged notes yet",description:"Notes tagged with this label will appear here"}),children:l.length>0&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"grid-auto-cards grid gap-5",children:l.map(a=>e.jsx(k,{...a,onPinned:()=>u(a.id,a.pinned),onDelete:()=>m(a.id)},a.id))}),e.jsx(h,{fallback:null,children:n&&i<n&&e.jsx(P,{page:t,last:Math.ceil(n/i),onChange:a=>{s({search:p=>({...p,page:a})})}})})]})})})}}),f]})}export{B as default};