trybeacon 0.1.49 → 0.1.50

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 (101) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +12 -12
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  6. package/.next/server/app/_global-error.html +1 -1
  7. package/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/_not-found.html +1 -1
  16. package/.next/server/app/_not-found.rsc +1 -1
  17. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  18. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  19. package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  20. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  22. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  23. package/.next/server/app/api/context/feature/route.js +1 -1
  24. package/.next/server/app/api/entities/route.js +1 -1
  25. package/.next/server/app/api/map/start/route.js +1 -1
  26. package/.next/server/app/docs/page.js +1 -1
  27. package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
  28. package/.next/server/app/docs.html +1 -1
  29. package/.next/server/app/docs.rsc +2 -2
  30. package/.next/server/app/docs.segments/_full.segment.rsc +2 -2
  31. package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
  32. package/.next/server/app/docs.segments/_index.segment.rsc +1 -1
  33. package/.next/server/app/docs.segments/_tree.segment.rsc +1 -1
  34. package/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +2 -2
  35. package/.next/server/app/docs.segments/docs.segment.rsc +1 -1
  36. package/.next/server/app/feedback/page_client-reference-manifest.js +1 -1
  37. package/.next/server/app/feedback.html +1 -1
  38. package/.next/server/app/feedback.rsc +1 -1
  39. package/.next/server/app/feedback.segments/_full.segment.rsc +1 -1
  40. package/.next/server/app/feedback.segments/_head.segment.rsc +1 -1
  41. package/.next/server/app/feedback.segments/_index.segment.rsc +1 -1
  42. package/.next/server/app/feedback.segments/_tree.segment.rsc +1 -1
  43. package/.next/server/app/feedback.segments/feedback/__PAGE__.segment.rsc +1 -1
  44. package/.next/server/app/feedback.segments/feedback.segment.rsc +1 -1
  45. package/.next/server/app/help/page.js +1 -1
  46. package/.next/server/app/help/page_client-reference-manifest.js +1 -1
  47. package/.next/server/app/help.html +1 -1
  48. package/.next/server/app/help.rsc +3 -3
  49. package/.next/server/app/help.segments/_full.segment.rsc +3 -3
  50. package/.next/server/app/help.segments/_head.segment.rsc +1 -1
  51. package/.next/server/app/help.segments/_index.segment.rsc +1 -1
  52. package/.next/server/app/help.segments/_tree.segment.rsc +1 -1
  53. package/.next/server/app/help.segments/help/__PAGE__.segment.rsc +10 -12
  54. package/.next/server/app/help.segments/help.segment.rsc +1 -1
  55. package/.next/server/app/index.html +1 -1
  56. package/.next/server/app/index.rsc +1 -1
  57. package/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  58. package/.next/server/app/index.segments/_full.segment.rsc +1 -1
  59. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  60. package/.next/server/app/index.segments/_index.segment.rsc +1 -1
  61. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  62. package/.next/server/app/map/page.js +2 -2
  63. package/.next/server/app/map/page.js.nft.json +1 -1
  64. package/.next/server/app/map/page_client-reference-manifest.js +1 -1
  65. package/.next/server/app/page_client-reference-manifest.js +1 -1
  66. package/.next/server/app/plan/page.js +2 -2
  67. package/.next/server/app/plan/page.js.nft.json +1 -1
  68. package/.next/server/app/plan/page_client-reference-manifest.js +1 -1
  69. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  70. package/.next/server/app-paths-manifest.json +12 -12
  71. package/.next/server/chunks/1130.js +1 -1
  72. package/.next/server/chunks/3622.js +1 -1
  73. package/.next/server/chunks/9773.js +1 -0
  74. package/.next/server/middleware-build-manifest.js +1 -1
  75. package/.next/server/pages/404.html +1 -1
  76. package/.next/server/pages/500.html +1 -1
  77. package/.next/server/server-reference-manifest.js +1 -1
  78. package/.next/server/server-reference-manifest.json +1 -1
  79. package/.next/static/chunks/1487-13f43d25413ae041.js +1 -0
  80. package/.next/static/chunks/app/docs/page-ae19d2e91ec24771.js +1 -0
  81. package/.next/static/chunks/app/map/page-5074176a5e746ffb.js +1 -0
  82. package/.next/static/chunks/app/plan/page-3c4c1fc03275299f.js +1 -0
  83. package/.next/trace +39 -39
  84. package/.next/trace-build +1 -1
  85. package/dist/bin/doctor.js +16 -6
  86. package/dist/bin/hook.js +16 -6
  87. package/dist/bin/mcp.js +47 -37
  88. package/dist/bin/plan.js +22 -12
  89. package/dist/bin/prompt.js +1 -1
  90. package/dist/bin/uninstall.js +16 -6
  91. package/dist/lib/assets.js +16 -6
  92. package/dist/lib/codex-install.js +16 -6
  93. package/dist/lib/global-install.js +16 -6
  94. package/package.json +1 -1
  95. package/.next/server/chunks/7331.js +0 -1
  96. package/.next/static/chunks/7323-480fb88e9d24f9e9.js +0 -1
  97. package/.next/static/chunks/app/docs/page-0c841cb9a7aa2f9a.js +0 -1
  98. package/.next/static/chunks/app/map/page-66d71744ae3363d7.js +0 -1
  99. package/.next/static/chunks/app/plan/page-e7d16fa2a3713a92.js +0 -1
  100. /package/.next/static/{qeqVD-yeoYO_3C0pw9kHg → J1AU9kp6Vs1x9YOBkXMiR}/_buildManifest.js +0 -0
  101. /package/.next/static/{qeqVD-yeoYO_3C0pw9kHg → J1AU9kp6Vs1x9YOBkXMiR}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7323],{3958:(e,t,n)=>{n.d(t,{MapClient:()=>eL});var a=n(95155),r=n(12115),s=n(98112),o=n(6266),i=n(81750);n(53255);var l=n(17356),d=n(85618),c=n(2125),u=n(68319),m=n(15480),p=n(24413),x=n(17494),h=n(80846),f=n(45486),g=n(73321),b=n(95635),y=n(17918),v=n(9339);let j=(0,v.createServerReference)("40dade22d1caf1e2c69f66dd7451e0f082b76ed087",v.callServer,void 0,v.findSourceMapURL,"acceptSuggestionAction");var w=n(70299),k=n(22200),N=n(32133),C=n(65408),E=n(8962),A=n(84824),S=n(5736),I=n(86272),M=n(64577),T=n(9005),z=n(65738),R=n(40638),$=n(26518),D=n(43137),P=n(28161),O=n(12410);let F=(0,r.createContext)(null);function L(){let e=(0,r.useContext)(F);if(!e)throw Error("useNodeEdit must be used inside NodeEditContext");return e}var _=n(29523),B=n(60874),H=n(91337);let U=[{v:0,l:"P0 \xb7 critical"},{v:1,l:"P1 \xb7 high"},{v:2,l:"P2 \xb7 medium"},{v:3,l:"P3 \xb7 low"}],X="nodrag nopan";function G({layer:e}){let t=(0,P.jR)(e);return t?(0,a.jsx)("span",{"aria-hidden":!0,className:"absolute bottom-2 left-1 top-2 w-[3px] rounded-full",style:{background:(0,P.A6)(t)}}):null}function K({layer:e}){let t=(0,P.jR)(e);if(!t)return null;let n=P.YG[t];return(0,a.jsxs)("span",{title:`${n.label} — which side of the stack this lands on`,className:"flex shrink-0 items-center gap-1 rounded bg-white/10 px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-zinc-300",children:["backend"!==t&&(0,a.jsx)(w.A,{className:"size-2.5"}),"frontend"!==t&&(0,a.jsx)(k.A,{className:"size-2.5"}),n.short]})}function W({nodeId:e}){let t=(0,g.useRouter)(),[n,s]=(0,r.useState)(!1),[o,i]=(0,r.useState)(""),[l,d]=(0,r.useState)(!1),c=()=>{s(!1),i("")},m=async()=>{let n=o.trim();if(n&&!l){d(!0);try{(await fetch("/api/bug-flags",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({nodeId:e,by:"user",note:n})})).ok&&(c(),t.refresh())}finally{d(!1)}}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",title:"Flag a bug on this component",onClick:e=>{e.stopPropagation(),s(e=>!e)},className:(0,H.cn)(X,"absolute -right-3 top-[calc(50%-28px)] z-10 flex size-6 -translate-y-1/2 items-center justify-center rounded-full border border-white/15 bg-[#242428] text-muted-foreground shadow-md transition-all hover:border-rose-400/50 hover:text-rose-300",n?"border-rose-400/50 text-rose-300 opacity-100":"opacity-0 group-hover/nc:opacity-100"),children:(0,a.jsx)(u.A,{className:"size-3"})}),n&&(0,a.jsxs)("div",{onClick:e=>e.stopPropagation(),className:(0,H.cn)(X,"absolute -right-2 top-[calc(50%-28px)] z-20 w-60 translate-x-full rounded-xl border border-rose-400/25 bg-[#1c1c1f] p-2 shadow-xl"),children:[(0,a.jsxs)("div",{className:"mb-1.5 flex items-center justify-between",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wide text-rose-300",children:[(0,a.jsx)(u.A,{className:"size-3"})," Flag a bug"]}),(0,a.jsx)("button",{type:"button",title:"Cancel",onClick:c,className:"rounded p-0.5 text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground",children:(0,a.jsx)("span",{className:"block px-1 text-[11px] leading-none",children:"✕"})})]}),(0,a.jsx)("textarea",{autoFocus:!0,rows:2,value:o,placeholder:"What did you find?",onChange:e=>i(e.target.value),onKeyDown:e=>{e.stopPropagation(),"Escape"===e.key&&c(),"Enter"!==e.key||e.shiftKey||(e.preventDefault(),m())},className:"field-sizing-content max-h-40 min-h-12 w-full resize-none rounded-md bg-white/[0.04] px-1.5 py-1 text-xs outline-none placeholder:text-muted-foreground/50 focus:bg-white/[0.07]"}),(0,a.jsx)("button",{type:"button",disabled:l||!o.trim(),onClick:()=>void m(),className:"mt-1.5 w-full rounded-md bg-rose-500/15 py-1 text-[11px] font-semibold text-rose-300 transition-colors hover:bg-rose-500/25 disabled:opacity-50",children:l?"Flagging…":"Flag bug"})]})]})}let Y=["border-[#ff3860]/60 shadow-[0_0_0_1px_rgba(255,56,96,0.15)]","border-[#ff7a45]/50","border-amber-400/35","border-border"];function Z({id:e,data:t,selected:n}){let{categories:s,statuses:o,patch:i,isExpanded:l,toggleExpand:d,openDetailed:c,removeNode:m,editingTitleId:p,onAskAgent:x,hasFrontend:h}=L(),g=l(e),[v,w]=(0,r.useState)(!1),[k,F]=(0,r.useState)(!1),[q,V]=(0,r.useState)(t.title),[J,Q]=(0,r.useState)(t.cluster??""),[ee,et]=(0,r.useState)(t.plain??""),en="BUG"===t.kind&&"ROADMAP"===t.view,ea="ARCHITECTURE"===t.view,er=ea?"border-border":Y[t.priority]??"border-border",es=t.openBugs??0,eo="CANCELLED"===t.status||"DROP"===t.status,ei="DEPRIORITIZED"===t.status,el="DRAFT"===t.source,ed="IN_PROGRESS"===t.status,ec="INIT"===t.source&&"ROADMAP"===t.view,eu=e=>e.stopPropagation(),[em,ep]=(0,r.useTransition)(),ex=(0,_.k)();return"full"!==ex?(0,a.jsxs)("div",{className:(0,H.cn)("relative rounded-lg border bg-card px-3 py-2.5 text-card-foreground shadow-sm","w-fit max-w-[296px]",t.isChild?"min-w-56":"min-w-64",en?"border-rose-400/50 bg-rose-500/[0.05]":er,ed&&"border-sky-400/60",n&&"ring-2 ring-[var(--accent,#f5b942)]",eo&&"opacity-60","far"===ex&&"!opacity-0"),children:[(0,a.jsx)(b.x,{}),h&&(0,a.jsx)(G,{layer:t.layer}),(0,a.jsx)("div",{className:"break-words text-[15px] font-semibold leading-snug",children:t.title})]}):(0,a.jsxs)("div",{className:(0,H.cn)("group/nc relative rounded-lg border bg-card px-2.5 py-2 text-card-foreground shadow-sm transition","w-fit max-w-96",g?"min-w-80":"min-w-64",el?"border-dashed border-sky-400/50 bg-sky-500/[0.06]":ec?"border-dashed border-violet-400/60 bg-violet-500/[0.07] shadow-[0_0_0_1px_rgba(167,139,250,0.18)]":er,en&&!el&&"border-rose-400/50 bg-rose-500/[0.05]",ed&&"border-sky-400/60 shadow-[0_0_0_1px_rgba(56,160,255,0.25)]",t.isNext&&"border-emerald-400/70 shadow-[0_0_0_2px_rgba(52,211,153,0.35)]",null!=t.workOrderRank&&t.workOrderRank>1&&"border-emerald-400/25",n&&"ring-2 ring-[var(--accent,#f5b942)]",eo&&"opacity-60",ei&&"opacity-70 border-dashed"),children:[(0,a.jsx)(b.x,{}),h&&(0,a.jsx)(G,{layer:t.layer}),ea&&(0,a.jsx)(W,{nodeId:e}),(t.pins?.length??0)>0?(0,a.jsx)(y.e0,{pins:t.pins,onPinClick:t.onPinClick}):t.onComment&&(0,a.jsx)("button",{type:"button",title:`Annotate ${t.title}`,onClick:e=>{eu(e),t.onComment?.(t.title)},className:(0,H.cn)(X,"absolute -right-3 top-1/2 z-10 flex size-6 -translate-y-1/2 items-center justify-center rounded-full border border-white/15 bg-[#242428] text-muted-foreground opacity-0 shadow-md transition-all group-hover/nc:opacity-100 hover:border-[#ff7a45]/50 hover:text-[#ff7a45]"),children:(0,a.jsx)(N.A,{className:"size-3"})}),t.isNext&&(0,a.jsx)("div",{className:"mb-1 inline-flex items-center gap-1 rounded bg-emerald-500/15 px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-emerald-300",children:"work on next"}),null!=t.workOrderRank&&t.workOrderRank>1&&(0,a.jsxs)("div",{title:`#${t.workOrderRank} in the work order`,className:"mb-1 inline-flex items-center gap-1 rounded bg-white/5 px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground",children:["next \xb7 ",t.workOrderRank]}),(0,a.jsxs)("div",{className:"flex w-0 min-w-full items-start gap-1.5",children:[ed&&(0,a.jsx)("span",{title:"em andamento",className:"mt-1.5 inline-block size-2 shrink-0 animate-pulse rounded-full bg-sky-400"}),t.isCriterion&&!ed&&(0,a.jsx)("span",{title:"Success criterion",className:"mt-1.5 inline-block size-1.5 shrink-0 rounded-full bg-[var(--accent,#f5b942)]"}),(0,a.jsx)("textarea",{rows:1,value:q,autoFocus:p===e,placeholder:"Title…",onFocus:t=>{p===e&&t.currentTarget.select()},onChange:e=>V(e.target.value),onBlur:()=>{let n=q.trim();n&&n!==t.title&&i(e,{title:n},!0)},onKeyDown:e=>{eu(e),"Enter"!==e.key||e.shiftKey||(e.preventDefault(),e.currentTarget.blur())},className:(0,H.cn)(X,"field-sizing-content w-full resize-none bg-transparent text-sm font-medium leading-snug outline-none placeholder:text-muted-foreground/60",eo&&"line-through")}),(0,a.jsx)("button",{type:"button",onClick:t=>{eu(t),d(e)},title:g?"Collapse":"Expand",className:(0,H.cn)(X,"mt-0.5 shrink-0 text-muted-foreground hover:text-foreground"),children:g?(0,a.jsx)(C.A,{className:"size-3.5"}):(0,a.jsx)(E.A,{className:"size-3.5"})})]}),((t.signals?.untested??0)>0||t.signals?.auth||es>0)&&(0,a.jsxs)("div",{className:"mt-1 flex w-0 min-w-full flex-wrap items-center gap-1",children:[es>0&&(0,a.jsxs)("span",{title:`${es} open bug flag(s) — raised by you or an agent examining this code`,className:"flex items-center gap-1 rounded bg-rose-500/15 px-1 text-[9px] font-semibold uppercase tracking-wide text-rose-300",children:[(0,a.jsx)(u.A,{className:"size-2.5"}),es," ",1===es?"bug":"bugs"]}),(t.signals?.untested??0)>0&&(0,a.jsxs)("span",{title:`${t.signals.untested} of ${t.signals.total} attached file(s) have no test importing them`,className:"flex items-center gap-1 rounded bg-amber-500/15 px-1 text-[9px] font-semibold uppercase tracking-wide text-amber-300",children:[(0,a.jsx)(A.A,{className:"size-2.5"}),t.signals.untested," untested"]}),t.signals?.auth&&(0,a.jsxs)("span",{title:"touches auth-sensitive files",className:"flex items-center gap-1 rounded bg-red-500/15 px-1 text-[9px] font-semibold uppercase tracking-wide text-red-300",children:[(0,a.jsx)(S.A,{className:"size-2.5"})," auth"]})]}),t.role&&(0,a.jsx)("div",{className:(0,H.cn)("mt-0.5 w-0 min-w-full text-[10px] leading-snug text-muted-foreground",!g&&"line-clamp-1"),children:t.role}),(0,a.jsxs)("div",{className:"mt-2 flex items-center gap-1.5",children:["ROADMAP"===t.view?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("span",{title:en?"Bug — something to fix":t.isChild?"Sub-task of a feature":"Feature — top-level roadmap item",className:(0,H.cn)("flex shrink-0 items-center gap-1 rounded px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide",en?"bg-rose-500/15 text-rose-300":t.isChild?"bg-zinc-500/15 text-zinc-300":"bg-sky-500/15 text-sky-300"),children:[en&&(0,a.jsx)(u.A,{className:"size-2.5"}),en?"bug":t.isChild?"sub-task":"feature"]}),h&&(0,a.jsx)(K,{layer:t.layer}),ec&&(0,a.jsxs)("span",{className:(0,H.cn)("flex items-center gap-1 rounded bg-violet-500/15 px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-violet-300",em&&"opacity-50"),children:[(0,a.jsx)(I.A,{className:"size-2.5"})," IA",(0,a.jsx)("button",{type:"button",title:"Accept suggestion — turn it into your own feature",disabled:em,onClick:t=>{eu(t),ep(async()=>j(e))},className:(0,H.cn)(X,"-my-0.5 rounded p-0.5 hover:bg-emerald-500/20 hover:text-emerald-300"),children:(0,a.jsx)(M.A,{className:"size-2.5"})}),(0,a.jsx)("button",{type:"button",title:"Dismiss suggestion (deletes the card)",disabled:em,onClick:t=>{eu(t),m(e)},className:(0,H.cn)(X,"-my-0.5 -ml-0.5 rounded p-0.5 hover:bg-red-500/20 hover:text-red-300"),children:(0,a.jsx)(T.A,{className:"size-2.5"})})]}),(0,a.jsx)("input",{list:`cats-${e}`,value:J,placeholder:"category",onChange:e=>Q(e.target.value),onBlur:()=>{let n=J.trim()||null;n!==(t.cluster??null)&&i(e,{cluster:n},!0)},onKeyDown:e=>{eu(e),"Enter"===e.key&&e.currentTarget.blur()},className:(0,H.cn)(X,"field-sizing-content min-w-12 max-w-[65%] rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide outline-none focus:brightness-125 [&::-webkit-calendar-picker-indicator]:hidden",(0,O.a2)(J))})]}):(0,a.jsxs)(a.Fragment,{children:[t.isChild&&(0,a.jsx)("span",{title:"Sub-component",className:"shrink-0 rounded bg-zinc-500/15 px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-zinc-300",children:"sub"}),h&&(0,a.jsx)(K,{layer:t.layer}),(0,a.jsx)("input",{list:`cats-${e}`,value:J,placeholder:"domain",title:"Architecture domain — the lane this component lives in",onChange:e=>Q(e.target.value),onBlur:()=>{let n=J.trim()||null;n!==(t.cluster??null)&&i(e,{cluster:n},!0)},onKeyDown:e=>{eu(e),"Enter"===e.key&&e.currentTarget.blur()},className:(0,H.cn)(X,"field-sizing-content min-w-12 max-w-[65%] rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide outline-none focus:brightness-125 [&::-webkit-calendar-picker-indicator]:hidden",(0,O.a2)(J))})]}),(0,a.jsx)("datalist",{id:`cats-${e}`,children:s.map(e=>(0,a.jsx)("option",{value:e},e))}),(0,a.jsxs)($.l6,{value:t.status,onValueChange:t=>i(e,{status:t},!0),children:[(0,a.jsx)($.bq,{className:(0,H.cn)(X,"ml-auto h-6 shrink-0 gap-1 rounded border px-1.5 py-0 text-[10px] font-medium",D.nR[t.status]?.className??"border-white/10"),children:(0,a.jsx)($.yv,{children:e=>D.nR[e]?.label??e})}),(0,a.jsx)($.gC,{alignItemWithTrigger:!1,children:o.map(e=>(0,a.jsx)($.eb,{value:e,children:D.nR[e]?.label??e},e))})]})]}),g&&(0,a.jsxs)("div",{className:"mt-2 w-0 min-w-full space-y-2 border-t border-white/10 pt-2",children:[k||!ee.trim()?(0,a.jsx)("textarea",{autoFocus:k,value:ee,placeholder:"Description (markdown)…",onChange:e=>et(e.target.value),onBlur:()=>{F(!1);let n=ee.trim()||null;n!==(t.plain??null)&&i(e,{plain:n},!0)},onKeyDown:eu,rows:3,className:(0,H.cn)(X,"field-sizing-content max-h-[24rem] min-h-[4.5rem] w-full resize-y rounded bg-white/[0.04] px-1.5 py-1 text-xs outline-none placeholder:text-muted-foreground/50 focus:bg-white/[0.08]")}):(0,a.jsx)("div",{onClick:e=>{eu(e),F(!0)},title:"Click to edit",className:"cursor-text rounded bg-white/[0.02] px-1.5 py-1 text-xs hover:bg-white/[0.05]",children:(0,a.jsx)(B.pO,{markdown:ee,variant:"compact",className:"text-[12px]"})}),(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsxs)($.l6,{value:String(t.priority),onValueChange:t=>i(e,{priority:Number(t)},!0),children:[(0,a.jsx)($.bq,{className:(0,H.cn)(X,"h-6 gap-1 rounded border-white/10 px-1.5 py-0 text-[10px]"),children:(0,a.jsx)($.yv,{children:e=>U.find(t=>String(t.v)===e)?.l??e})}),(0,a.jsx)($.gC,{alignItemWithTrigger:!1,children:U.map(e=>(0,a.jsx)($.eb,{value:String(e.v),children:e.l},e.v))})]}),h&&(0,a.jsxs)($.l6,{value:(0,P.jR)(t.layer)??"none",onValueChange:t=>i(e,{layer:"none"===t?null:t},!0),children:[(0,a.jsx)($.bq,{title:"Which side of the stack this lands on",className:(0,H.cn)(X,"h-6 gap-1 rounded border-white/10 px-1.5 py-0 text-[10px]"),children:(0,a.jsx)($.yv,{children:e=>"none"===e?"layer \xb7 —":P.YG[e]?.label??e})}),(0,a.jsxs)($.gC,{alignItemWithTrigger:!1,children:[(0,a.jsx)($.eb,{value:"none",children:"—"}),Object.entries(P.YG).map(([e,t])=>(0,a.jsx)($.eb,{value:e,children:t.label},e))]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsxs)("button",{type:"button",onClick:t=>{eu(t),v?m(e):w(!0)},onBlur:()=>w(!1),title:"Delete node",className:(0,H.cn)(X,"flex items-center gap-1 rounded px-1.5 py-1 text-[10px] transition-colors",v?"bg-red-500/20 text-red-300":"text-muted-foreground hover:bg-white/5 hover:text-red-300"),children:[(0,a.jsx)(z.A,{className:"size-3"}),v&&"Delete?"]}),x&&(0,a.jsxs)("button",{type:"button",onClick:e=>{eu(e),x(`feature: ${t.title}`)},title:"Ask the agent a question about this feature (answered in its next round)",className:(0,H.cn)(X,"flex items-center gap-1 rounded px-1.5 py-1 text-[10px] text-sky-300/90 hover:bg-sky-500/15 hover:text-sky-300"),children:[(0,a.jsx)(R.A,{className:"size-3"})," Ask"]}),(0,a.jsxs)("button",{type:"button",onClick:t=>{eu(t),c(e)},className:(0,H.cn)(X,"flex items-center gap-1 rounded px-1.5 py-1 text-[10px] text-muted-foreground hover:bg-white/5 hover:text-foreground"),children:[(0,a.jsx)(f.A,{className:"size-3"})," Details"]})]})]})]})]})}var q=n(54698),V=n(24692),J=n(45437),Q=n(82099),ee=n(4474),et=n(70521),en=n(74350);function ea({className:e,type:t,...n}){return(0,a.jsx)("input",{type:t,"data-slot":"input",className:(0,H.cn)("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...n})}function er({className:e,...t}){return(0,a.jsx)("textarea",{"data-slot":"textarea",className:(0,H.cn)("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...t})}var es=n(61388);function eo({className:e,...t}){return(0,a.jsx)(es.b,{"data-slot":"label",className:(0,H.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}let ei=(0,v.createServerReference)("4052e70dcb91d194ef6890d4bdec87aec37c264e5c",v.callServer,void 0,v.findSourceMapURL,"createNodeAction"),el=(0,v.createServerReference)("60f01be7225607c95d9556a3dccf161af09e957386",v.callServer,void 0,v.findSourceMapURL,"updateNodeAction");function ed({open:e,onOpenChange:t,mode:n,view:s,heading:o,nodeId:i,parentId:l,position:d,defaults:c,hasFrontend:u=!1}){let m=(0,g.useRouter)(),[p,x]=(0,r.useState)(c?.title??""),[h,f]=(0,r.useState)(c?.role??""),[b,y]=(0,r.useState)(c?.plain??""),[v,j]=(0,r.useState)(c?.cluster??""),[w,k]=(0,r.useState)(c?.status??("ARCHITECTURE"===s?"REBUILD":"PENDING")),[N,C]=(0,r.useState)(c?.kind==="BUG"?"BUG":"FEATURE"),[E,A]=(0,r.useState)((0,P.jR)(c?.layer)??"none"),[S,I]=(0,r.useState)(!1),M="ARCHITECTURE"===s?D.m6:D.yl;async function T(){if(p.trim()){I(!0);try{let e="none"===E?null:E;"create"===n?await ei({view:s,..."ROADMAP"===s?{kind:N}:{},title:p.trim(),role:h.trim()||null,plain:b.trim()||null,cluster:v.trim()||null,...u?{layer:e}:{},parentId:l??null,status:w,x:d?.x??60,y:d?.y??60}):i&&await el(i,{..."ROADMAP"===s?{kind:N}:{},title:p.trim(),role:h.trim()||null,plain:b.trim()||null,cluster:v.trim()||null,...u?{layer:e}:{},status:w}),t(!1),m.refresh()}finally{I(!1)}}}return(0,a.jsx)(en.lG,{open:e,onOpenChange:t,children:(0,a.jsxs)(en.Cf,{children:[(0,a.jsx)(en.c7,{children:(0,a.jsx)(en.L3,{children:o})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)(eo,{htmlFor:"nf-title",children:"Title"}),(0,a.jsx)(ea,{id:"nf-title",value:p,autoFocus:!0,onChange:e=>x(e.target.value)})]}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)(eo,{htmlFor:"nf-role",children:"Role (one line)"}),(0,a.jsx)(ea,{id:"nf-role",value:h,onChange:e=>f(e.target.value)})]}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)(eo,{htmlFor:"nf-plain",children:"Description"}),(0,a.jsx)(er,{id:"nf-plain",rows:3,value:b,onChange:e=>y(e.target.value)})]}),"ROADMAP"===s&&(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)(eo,{children:"Kind"}),(0,a.jsxs)($.l6,{value:N,onValueChange:e=>null!=e&&C(e),children:[(0,a.jsx)($.bq,{children:(0,a.jsx)($.yv,{children:e=>"BUG"===e?"Bug":"Feature"})}),(0,a.jsxs)($.gC,{children:[(0,a.jsx)($.eb,{value:"FEATURE",children:"Feature"}),(0,a.jsx)($.eb,{value:"BUG",children:"Bug"})]})]})]}),u&&(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)(eo,{children:"Layer"}),(0,a.jsxs)($.l6,{value:E,onValueChange:e=>null!=e&&A(e),children:[(0,a.jsx)($.bq,{children:(0,a.jsx)($.yv,{children:e=>"none"===e?"—":P.YG[e]?.label??e})}),(0,a.jsxs)($.gC,{children:[(0,a.jsx)($.eb,{value:"none",children:"—"}),Object.keys(P.YG).map(e=>(0,a.jsx)($.eb,{value:e,children:P.YG[e].label},e))]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)(eo,{children:"Status"}),(0,a.jsxs)($.l6,{value:w,onValueChange:e=>null!=e&&k(e),children:[(0,a.jsx)($.bq,{children:(0,a.jsx)($.yv,{children:e=>D.nR[e]?.label??e})}),(0,a.jsx)($.gC,{children:M.map(e=>(0,a.jsx)($.eb,{value:e,children:D.nR[e]?.label??e},e))})]})]}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)(eo,{htmlFor:"nf-cluster",children:"Cluster / lane"}),(0,a.jsx)(ea,{id:"nf-cluster",value:v,onChange:e=>j(e.target.value)})]})]})]}),(0,a.jsxs)(en.Es,{children:[(0,a.jsx)(ee.$,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),(0,a.jsx)(ee.$,{onClick:T,disabled:S||!p.trim(),children:S?"Saving…":"Save"})]})]})})}let ec=(0,v.createServerReference)("40d1512578c31d2c46b08e11267b7350a6aa962839",v.callServer,void 0,v.findSourceMapURL,"deleteNodeAction"),eu=(0,v.createServerReference)("60514bc81e972d8416356766c29de2c353a04dbbe4",v.callServer,void 0,v.findSourceMapURL,"setStatusAction"),em=(0,v.createServerReference)("402ee1f8f27d2451545f049b445bf624d35068c96e",v.callServer,void 0,v.findSourceMapURL,"cancelAction"),ep=(0,v.createServerReference)("4039f6f515721e957d83735f83dce09976b099fc6c",v.callServer,void 0,v.findSourceMapURL,"deprioritizeAction");function ex({view:e,selected:t,allNodes:n,onClose:r,commentsContent:s,commentsCount:o=0,activeTab:i,onTabChange:l,onAddComment:d,topOffset:c}){let u=!!s,m=i??"details";return(0,a.jsxs)(Q.b,{className:"absolute right-3 z-10 flex w-80 flex-col rounded-2xl",style:{top:c??12,maxHeight:`calc(100% - ${(c??12)+12}px)`},children:[u?(0,a.jsxs)("div",{className:"flex items-center justify-between border-b border-white/10 px-1 py-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,a.jsx)(eh,{active:"details"===m,onClick:()=>l?.("details"),children:"Details"}),(0,a.jsxs)(eh,{active:"comments"===m,onClick:()=>l?.("comments"),children:["Comments",o>0&&(0,a.jsx)("span",{className:"ml-1 rounded-full bg-white/10 px-1 text-[9px] font-semibold leading-4",children:o})]})]}),(0,a.jsx)("button",{onClick:r,title:"Close panel",className:"mr-1 rounded-md p-1 text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground",children:(0,a.jsx)(T.A,{className:"size-4"})})]}):(0,a.jsxs)("div",{className:"flex items-center justify-between border-b border-white/10 px-3.5 py-2.5",children:[(0,a.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Details"}),(0,a.jsx)("button",{onClick:r,title:"Close panel",className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground",children:(0,a.jsx)(T.A,{className:"size-4"})})]}),(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:(0,a.jsx)("div",{className:"p-3",children:"comments"===m&&u?s:t?(0,a.jsxs)(a.Fragment,{children:[d&&(0,a.jsxs)("button",{type:"button",onClick:()=>d(t.title),className:"mb-3 flex w-full items-center justify-center gap-1.5 rounded-lg border border-white/10 bg-white/[0.03] px-3 py-1.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-white/[0.06] hover:text-foreground",children:[(0,a.jsx)(N.A,{className:"size-3.5"}),"Comment on this ","ARCHITECTURE"===e?"component":"feature"]}),(0,a.jsx)(ef,{node:t,view:e},t.id)]}):(0,a.jsx)(eb,{view:e,nodes:n})})})]})}function eh({active:e,onClick:t,children:n}){return(0,a.jsx)("button",{type:"button",onClick:t,className:(0,H.cn)("flex items-center gap-1 rounded-md px-2.5 py-1 text-[11px] font-medium transition-colors",e?"bg-white/10 text-foreground":"text-muted-foreground hover:text-foreground"),children:n})}function ef({node:e,view:t}){let n=(0,g.useRouter)(),[s,o]=(0,r.useTransition)(),[i,l]=(0,r.useState)(!1),[d,c]=(0,r.useState)(!1),{hasFrontend:u}=L(),m=(0,P.jR)(e.layer),p="ARCHITECTURE"===t?D.m6:D.yl,x=e=>o(async()=>{await e(),n.refresh()});return(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:[(0,D.Xf)(e.cluster),u&&m&&(0,a.jsxs)("span",{className:"ml-2 text-zinc-400",children:["\xb7 ",P.YG[m].label]}),0===e.priority&&(0,a.jsx)("span",{className:"ml-2 text-[#ff7a90]",children:"\xb7 critical path"})]}),(0,a.jsx)("h2",{className:"mt-1 text-lg font-semibold leading-tight",children:e.title})]}),"INIT"===e.source&&(0,a.jsxs)("div",{className:"rounded-lg border border-violet-400/30 bg-violet-500/[0.06] p-2.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-xs font-semibold text-violet-300",children:[(0,a.jsx)(I.A,{className:"size-3.5"})," AI suggestion"]}),(0,a.jsx)("p",{className:"mt-1 text-[11px] leading-snug text-muted-foreground",children:"Suggested direction surfaced when mapping the repo. Accept to turn it into your own feature, or dismiss."}),(0,a.jsxs)("div",{className:"mt-2 flex gap-1.5",children:[(0,a.jsx)(ee.$,{size:"sm",className:"h-7 px-2.5 text-xs",disabled:s,onClick:()=>x(()=>j(e.id)),children:"Accept"}),(0,a.jsx)(ee.$,{size:"sm",variant:"outline",className:"h-7 px-2.5 text-xs text-muted-foreground",disabled:s,onClick:()=>x(()=>ec(e.id)),children:"Dismiss"})]})]}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Status"}),(0,a.jsxs)($.l6,{value:e.status,onValueChange:t=>null!=t&&x(()=>eu(e.id,t)),children:[(0,a.jsx)($.bq,{className:"h-8",disabled:s,children:(0,a.jsx)($.yv,{children:e=>D.nR[e]?.label??e})}),(0,a.jsx)($.gC,{children:p.map(e=>(0,a.jsx)($.eb,{value:e,children:D.nR[e]?.label??e},e))})]})]}),e.plain&&(0,a.jsx)("div",{className:"rounded-md border border-white/5 bg-card/40 px-2.5 py-2 text-sm",children:(0,a.jsx)(B.pO,{markdown:e.plain,variant:"compact",className:"text-[12.5px]"})}),e.sourceRef&&(0,a.jsx)("div",{className:"rounded-md border border-border bg-card px-2 py-1.5 font-mono text-xs text-muted-foreground",children:e.sourceRef}),e.files.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("h3",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:["Files (",e.files.length,")"]}),(0,a.jsx)("ul",{className:"space-y-0.5",children:e.files.map(e=>(0,a.jsx)("li",{children:(0,a.jsx)("button",{onClick:()=>fetch(`/api/open?path=${encodeURIComponent(e)}`).catch(()=>{}),title:`Open ${e} in editor`,className:"block w-full truncate rounded px-1.5 py-0.5 text-left font-mono text-[11px] text-muted-foreground transition-colors hover:bg-white/5 hover:text-foreground",children:e})},e))})]}),"ARCHITECTURE"===t&&(0,a.jsx)(eg,{node:e}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-1.5 pt-1",children:[(0,a.jsx)(ee.$,{size:"sm",variant:"outline",onClick:()=>l(!0),children:"Edit"}),(0,a.jsx)(ee.$,{size:"sm",variant:"outline",onClick:()=>c(!0),children:"+ Sub-node"}),(0,a.jsx)(ee.$,{size:"sm",variant:"outline",disabled:s,onClick:()=>x(()=>em(e.id)),children:"Cancel"}),(0,a.jsx)(ee.$,{size:"sm",variant:"outline",disabled:s,onClick:()=>x(()=>ep(e.id)),children:"Deprioritize"}),(0,a.jsxs)(et.Lt,{children:[(0,a.jsx)(et.tv,{render:(0,a.jsx)(ee.$,{size:"sm",variant:"outline",className:"text-red-300",children:"Delete"})}),(0,a.jsxs)(et.EO,{children:[(0,a.jsxs)(et.wd,{children:[(0,a.jsxs)(et.r7,{children:["Delete “",e.title,"”?"]}),(0,a.jsx)(et.$v,{children:"This removes the node and all its sub-nodes. It can’t be undone."})]}),(0,a.jsxs)(et.ck,{children:[(0,a.jsx)(et.Zr,{children:"Cancel"}),(0,a.jsx)(et.Rx,{onClick:()=>x(()=>ec(e.id)),children:"Delete"})]})]})]})]}),i&&(0,a.jsx)(ed,{open:!0,onOpenChange:l,mode:"edit",view:t,heading:"Edit node",nodeId:e.id,hasFrontend:u,defaults:{title:e.title,role:e.role,plain:e.plain,status:e.status,cluster:e.cluster,kind:e.kind,layer:e.layer}}),d&&(0,a.jsx)(ed,{open:!0,onOpenChange:c,mode:"create",view:t,heading:"New sub-node",parentId:e.id,position:{x:e.x,y:e.y+120},hasFrontend:u,defaults:{cluster:e.cluster,layer:e.layer}})]})}function eg({node:e}){let t=(0,g.useRouter)(),[n,s]=(0,r.useState)(""),[o,i]=(0,r.useState)(!1),l=e.bugFlags.filter(e=>!e.resolved),d=e=>{i(!0),e().then(()=>t.refresh()).finally(()=>i(!1))},c=()=>{let t=n.trim();t&&d(async()=>{(await fetch("/api/bug-flags",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({nodeId:e.id,by:"user",note:t})})).ok&&s("")})};return(0,a.jsxs)("div",{children:[(0,a.jsxs)("h3",{className:"mb-1.5 flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[(0,a.jsx)(u.A,{className:"size-3.5 text-rose-300"}),"Bug flags",l.length>0&&` (${l.length} open)`]}),e.bugFlags.length>0&&(0,a.jsx)("ul",{className:"space-y-1.5",children:e.bugFlags.map(e=>(0,a.jsxs)("li",{className:(0,H.cn)("rounded-md border px-2 py-1.5",e.resolved?"border-white/5 bg-card/30 opacity-60":"border-rose-400/25 bg-rose-500/[0.05]"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{title:"agent"===e.by?"Flagged by an agent examining the code":"Flagged by you",className:(0,H.cn)("rounded px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide","agent"===e.by?"bg-violet-500/15 text-violet-300":"bg-sky-500/15 text-sky-300"),children:"agent"===e.by?"agent":"you"}),(0,a.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,a.jsx)("button",{type:"button",disabled:o,onClick:()=>d(()=>fetch(`/api/bug-flags/${e.id}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({resolved:!e.resolved})})),className:"rounded px-1.5 py-0.5 text-[10px] text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground",children:e.resolved?"Reopen":"Resolve"}),(0,a.jsx)("button",{type:"button",disabled:o,title:"Delete flag",onClick:()=>d(()=>fetch(`/api/bug-flags/${e.id}`,{method:"DELETE"})),className:"rounded p-0.5 text-muted-foreground transition-colors hover:bg-white/10 hover:text-red-300",children:(0,a.jsx)(T.A,{className:"size-3"})})]})]}),(0,a.jsx)("p",{className:(0,H.cn)("mt-1 text-[11.5px] leading-snug",e.resolved&&"line-through"),children:e.note})]},e.id))}),(0,a.jsxs)("div",{className:"mt-1.5 flex items-start gap-1.5",children:[(0,a.jsx)("textarea",{rows:1,value:n,placeholder:"Flag a bug or something worth investigating…",onChange:e=>s(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),c())},className:"field-sizing-content min-h-7 w-full resize-none rounded-md border border-white/10 bg-white/[0.03] px-2 py-1 text-[11.5px] outline-none placeholder:text-muted-foreground/60 focus:bg-white/[0.06]"}),(0,a.jsx)(ee.$,{size:"sm",variant:"outline",className:"h-7 shrink-0 px-2 text-[11px]",disabled:o||!n.trim(),onClick:c,children:"Flag"})]})]})}function eb({view:e,nodes:t}){let n=t.filter(e=>0===e.priority).length;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-sm font-semibold",children:"ROADMAP"===e?"Roadmap":"Architecture"}),(0,a.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Click a node for details and actions. Drag to rearrange — positions are saved."})]}),(0,a.jsxs)("dl",{className:"grid grid-cols-2 gap-2 text-center",children:[(0,a.jsx)(ey,{label:"nodes",value:t.length}),(0,a.jsx)(ey,{label:"critical",value:n})]})]})}function ey({label:e,value:t}){return(0,a.jsxs)("div",{className:"rounded-md border border-border bg-card py-2",children:[(0,a.jsx)("div",{className:"text-lg font-semibold",children:t}),(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:e})]})}var ev=n(18874),ej=n(62311),ew=n(9991),ek=n(14983),eN=n(91157),eC=n(56895),eE=n(16607),eA=n(56614),eS=n(98238),eI=n(36849),eM=n(94014),eT=n(44267);function ez(e,t){let n={x:t.x,y:t.y};for(let t=0;t<100&&e.some(e=>200>Math.abs(n.x-e.x)&&150>Math.abs(n.y-e.y));t++)n.y+=150;return n}var eR=n(70947);let e$=[{value:"cluster",label:"Theme"},{value:"status",label:"Status"},{value:"priority",label:"Priority"}],eD=new Set(["title","role","plain","cluster","layer","status","priority"]),eP={roadmapNode:Z,archNode:Z,annotation:y.Sh},eO={deletable:V.I,annotation:J.L},eF={CONTAINS:{stroke:"#7c7c8a"},DEPENDS:{stroke:"#f5b942",dash:"6 4"},RELATES:{stroke:"#8a8a95",dash:"4 4"},REPLACES:{stroke:"#ff6b9d"}};function eL({view:e,nodes:t,edges:n,workOrder:g=[],embedded:b=!1,commentsContent:v,commentsCount:j=0,controlRef:w,onAskAgent:k,onAddComment:N,annotations:C,onPinClick:E,onUpdateComment:A,onRemoveComment:S,boardAnnotations:I,initialArrangedBy:M=null,hasFrontend:T=!1,readOnly:z=!1}){let R=g.join(","),$=(0,r.useMemo)(()=>{let e=new Map;return g.forEach((t,n)=>e.set(t,n+1)),e},[R]),O=g[0]??null,L=(0,r.useMemo)(()=>t.map(e=>({id:e.id,type:"ROADMAP"===e.view?"roadmapNode":"archNode",position:{x:e.x,y:e.y},data:{title:e.title,role:e.role,plain:e.plain,status:e.status,priority:e.priority,cluster:e.cluster,layer:e.layer,view:e.view,kind:e.kind,source:e.source,sourceRef:e.sourceRef,isCriterion:e.isCriterion,isChild:null!=e.parentId,parentId:e.parentId,signals:e.signals,openBugs:e.bugFlags.filter(e=>!e.resolved).length}})),[t]),B=(0,r.useMemo)(()=>{let e;return e=new Set(t.map(e=>e.id)),[...t.filter(t=>t.parentId&&e.has(t.parentId)).map(e=>({id:`c-${e.id}`,source:e.parentId,sourceHandle:"sb",target:e.id,targetHandle:"tt",type:"smoothstep",style:{stroke:eF.CONTAINS.stroke}})),...n.filter(t=>e.has(t.fromId)&&e.has(t.toId)).map(e=>{let t=eF[e.kind]??eF.RELATES,n="DEPENDS"===e.kind?"depends on":void 0;return{id:e.id,source:e.fromId,sourceHandle:e.sourceHandle??void 0,target:e.toId,targetHandle:e.targetHandle??void 0,label:e.label??n,type:"deletable",markerEnd:{type:o.TG.ArrowClosed,color:t.stroke},style:{stroke:t.stroke,strokeDasharray:t.dash}}})]},[t,n]),[U,X]=(0,r.useState)(L),[G,K]=(0,r.useState)(B),[W,Y]=(0,r.useState)(null),[Z,V]=(0,r.useState)(null),[J,Q]=(0,r.useState)(null),[ee,et]=(0,r.useState)(!1),[en,ea]=(0,r.useState)("details"),er=(0,r.useRef)(!1),es=(0,r.useRef)("details");(0,r.useEffect)(()=>{er.current=ee},[ee]),(0,r.useEffect)(()=>{es.current=en},[en]),(0,r.useEffect)(()=>{if(w)return w.current={open:()=>{if(er.current){et(!1),ea("details");return}et(!0),ea("details")},close:()=>{et(!1),ea("details")},openComments:()=>{et(!0),ea("comments")}},()=>{w&&(w.current=null)}},[w]);let[eo,ei]=(0,r.useState)(new Set),[el,ed]=(0,r.useState)(null),[ec,eu]=(0,r.useState)(!1),em=(0,r.useRef)(null);(0,r.useEffect)(()=>X(L),[L]),(0,r.useEffect)(()=>K(B),[B]),(0,r.useEffect)(()=>{if(!z)return;let e=0,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>em.current?.fitView({padding:.2,duration:0}))});return()=>{cancelAnimationFrame(t),cancelAnimationFrame(e)}},[z,L]);let ep=(0,r.useCallback)((e,t,n)=>{X(n=>n.map(n=>n.id===e?{...n,data:{...n.data,...t}}:n)),n&&fetch(`/api/nodes/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(Object.fromEntries(Object.entries(t).filter(([e])=>eD.has(e))))})},[]),eh=(0,r.useMemo)(()=>Array.from(new Set(U.map(e=>e.data.cluster).filter(e=>!!e))).sort(),[U]),ef=(0,r.useCallback)(e=>ei(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[]),eg=(0,r.useCallback)(e=>{Y(e),et(!0),ea("details")},[]),eb=(0,r.useCallback)(e=>{X(t=>t.filter(t=>t.id!==e)),Y(t=>t===e?null:t),fetch(`/api/nodes/${e}`,{method:"DELETE"})},[]),ey=(0,r.useCallback)(async(t,n,a="FEATURE")=>{let r=(0,s.sX)(),o="ARCHITECTURE"===e?"REBUILD":"PENDING",i="BUG"===a?"New bug":"New node";X(s=>[...s,{id:r,type:"ROADMAP"===e?"roadmapNode":"archNode",position:{x:t,y:n},data:{title:i,role:null,plain:null,status:o,priority:2,cluster:null,view:e,kind:a,source:"MANUAL",sourceRef:null,isCriterion:!1,isChild:!1,parentId:null,openBugs:0}}]),ei(e=>new Set(e).add(r)),ed(r),Y(r);try{if(!(await fetch("/api/nodes",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:r,view:e,kind:a,title:i,status:o,x:t,y:n})})).ok)throw Error("create failed")}catch{X(e=>e.filter(e=>e.id!==r)),ei(e=>{let t=new Set(e);return t.delete(r),t}),ed(e=>e===r?null:e),Y(e=>e===r?null:e)}},[e]),e_=(0,r.useCallback)(()=>{let e=U.filter(e=>"annotation"!==e.type);return function(e,t,n={}){let a=n.colW??320,r=n.rowH??150,s=n.maxCols??4,o=n.bandGap??90;if(0===e.length){if(0===t.length)return{x:0,y:0};let e=Math.max(...t.map(e=>e.y));return ez(t,{x:0,y:e+r+o})}let i=Math.min(...e.map(e=>e.x)),l=Math.min(...e.map(e=>e.y)),d=e.map(e=>Math.max(0,Math.round((e.x-i)/a))),c=Math.min(s,Math.max(Math.max(...d)+1,Math.ceil(Math.sqrt(e.length+1)))),u=Array(c).fill(l-r);e.forEach((e,t)=>{let n=Math.min(d[t],c-1);u[n]=Math.max(u[n],e.y)});let m=0;for(let e=1;e<c;e++)u[e]<u[m]&&(m=e);return ez(t,{x:i+m*a,y:u[m]+r})}(e.filter(e=>!e.data.parentId&&!(e.data.cluster??"").trim()).map(e=>e.position),e.map(e=>e.position))},[U]),eB=(0,r.useCallback)(()=>{let e=e_();ey(e.x,e.y)},[ey,e_]),eH=(0,r.useCallback)(()=>{let e=e_();ey(e.x,e.y,"BUG")},[ey,e_]),eU=(0,r.useMemo)(()=>({view:e,categories:eh,statuses:"ARCHITECTURE"===e?D.m6:D.yl,patch:ep,isExpanded:e=>eo.has(e),toggleExpand:ef,openDetailed:eg,removeNode:eb,editingTitleId:el,onAskAgent:k,hasFrontend:T}),[e,eh,ep,eo,ef,eg,eb,el,k,T]),[eX,eG]=(0,r.useState)(M),[eK,eW]=(0,r.useState)(""),[eY,eZ]=(0,r.useState)("full"),[eq,eV]=(0,r.useState)(new Set),[eJ,eQ]=(0,r.useState)(new Set),[e0,e1]=(0,r.useState)(new Set),[e5,e2]=(0,r.useState)(null),e3=(0,r.useMemo)(()=>Array.from(new Set(t.map(e=>e.status))),[t]),e4=(0,r.useMemo)(()=>Array.from(new Set(t.map(e=>e.cluster).filter(e=>!!e))).sort(),[t]),e6=(0,r.useMemo)(()=>Array.from(new Set(t.map(e=>e.priority))).sort((e,t)=>e-t),[t]),e9=(0,r.useCallback)(e=>(!eq.size||!!eq.has(e.status))&&(!eJ.size||!!e.cluster&&!!eJ.has(e.cluster))&&(!e0.size||!!e0.has(e.priority)),[eq,eJ,e0]),e8=eq.size+eJ.size+e0.size,e7=(0,r.useCallback)(()=>{eV(new Set),eQ(new Set),e1(new Set)},[]),te=(0,r.useMemo)(()=>U.map(e=>({...e,hidden:!e9(e.data)})),[U,e9]),tt=(0,r.useMemo)(()=>new Set(te.filter(e=>e.hidden).map(e=>e.id)),[te]),tn=(0,r.useMemo)(()=>G.map(e=>({...e,hidden:tt.has(e.source)||tt.has(e.target)})),[G,tt]),ta=(0,r.useMemo)(()=>{if(Z){let e=tn.find(e=>e.id===Z);return e?new Set([e.source,e.target]):null}return W?(0,ev.F1)(W,tn.filter(e=>!e.hidden)):null},[W,Z,tn]),tr=eK.trim().length>0,ts=(0,r.useMemo)(()=>{if(!tr)return null;let e=new Set;for(let t of U)e9(t.data)&&(0,ek.Qk)((0,ek.$$)(t.data),eK)&&e.add(t.id);return e},[U,eK,e9,tr]),to=(0,r.useMemo)(()=>"ARCHITECTURE"===e?(0,eN.d)(t):[],[e,t]),ti=(0,r.useCallback)(e=>{em.current&&(e.focusIds.length?em.current.fitView({nodes:e.focusIds.map(e=>({id:e})),duration:700,padding:.3,maxZoom:1.1}):em.current.fitView({duration:700,padding:.2}))},[]),tl=(0,eC.W)(to,ti),td=tl.focusIds,tc=td??ts??ta,tu=ts??td,tm=(0,r.useMemo)(()=>e5?new Set(te.filter(e=>!e.hidden&&!(0,eS.F)(e5,(0,P.jR)(e.data.layer))).map(e=>e.id)):null,[e5,te]),tp=(0,r.useMemo)(()=>te.map(e=>{let t=$.get(e.id),n=t?{...e,data:{...e.data,workOrderRank:t,isNext:1===t}}:e;if(eo.has(e.id)&&(n={...n,zIndex:25}),n.hidden)return n;if(!tc)return tm?.has(e.id)?{...n,style:{...n.style,opacity:.3,filter:"saturate(0.3)",transition:"opacity 120ms, filter 120ms"}}:n;let a=tc.has(e.id),r=tu?ek.Uy:.45;return{...n,zIndex:a&&tu?24:n.zIndex,style:{...n.style,opacity:a?1:r,boxShadow:a&&tu?ek.RU:n.style?.boxShadow,borderRadius:a&&tu?14:n.style?.borderRadius,transition:"opacity 120ms, box-shadow 120ms"}}}),[te,tc,tu,$,eo,tm]),tx=(0,r.useMemo)(()=>{if("ROADMAP"===e&&!eX||"ROADMAP"!==e&&"ARCHITECTURE"!==e)return[];let t=new Map(tp.map(e=>[e.id,e])),n=[];for(let r of tp){var a;if(r.hidden||"annotation"===r.type)continue;let s=(r.data.parentId?t.get(r.data.parentId):void 0)??r,o="ROADMAP"===e&&eX?(a=s.data,"status"===eX?D.nR[a.status]?.label??a.status:"priority"===eX?`P${a.priority}`:a.cluster?.trim()||"—"):s.data.cluster?.trim()||"—";n.push({id:r.id,group:o,x:r.position.x,y:r.position.y,w:r.measured?.width??(r.data.isChild?224:256),h:r.measured?.height??96})}return(0,eT.S)(n)},[tp,eX,e]),th="ARCHITECTURE"===e||"cluster"===eX?"category":"neutral",tf=(0,r.useMemo)(()=>{if(td)return tn.map(e=>e.hidden?e:td.has(e.source)&&td.has(e.target)?{...e,style:{...e.style,opacity:1}}:{...e,label:void 0,style:{...e.style,opacity:.06}});if(ts)return tn.map(e=>e.hidden?e:ts.has(e.source)&&ts.has(e.target)?{...e,style:{...e.style,opacity:1}}:{...e,label:void 0,style:{...e.style,opacity:.06}});let e=W??J;return Z||e?tn.map(t=>t.hidden?t:(Z?t.id===Z:t.source===e||t.target===e)?{...t,zIndex:20,style:{...t.style,opacity:1,strokeWidth:2.5}}:{...t,selectable:!1,label:void 0,markerEnd:void 0,style:{...t.style,opacity:.06}}):tn.map(e=>{if(e.hidden)return e;let t=tm&&(tm.has(e.source)||tm.has(e.target));return{...e,label:void 0,style:{...e.style,opacity:t?.06:.18}}})},[tn,W,Z,J,ts,tm,td]),tg=void 0!==I,[tb,ty]=(0,r.useState)(I??[]);(0,r.useEffect)(()=>{I&&ty(I)},[I]);let tv=(0,r.useMemo)(()=>{if(tg){let e=new Set(t.map(e=>e.id));return tb.filter(t=>"feature"===t.targetKind&&e.has(t.targetId)).map((e,t)=>({id:e.id,n:t+1,targetId:e.targetId,text:e.body,x:e.x,y:e.y}))}let e=new Map((C??[]).map(e=>[e.id,e.comment]));return(0,q.m)(C??[],{tables:[],features:t.map(e=>({id:e.id,title:e.title}))}).map(t=>({id:t.annotationId,n:t.n,targetId:t.targetId,text:e.get(t.annotationId)??"",x:null,y:null}))},[tg,tb,C,t]),tj=(0,r.useMemo)(()=>{let e=new Map;for(let t of tv){let n=e.get(t.targetId)??[];n.push({id:t.id,n:t.n,column:null}),e.set(t.targetId,n)}return e},[tv]),tw=(0,r.useCallback)(async e=>{let n=(0,q.m)([{id:"_",excerpt:e}],{tables:[],features:t.map(e=>({id:e.id,title:e.title}))})[0];if(!n)return;let a=await fetch("/api/board-annotations",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({targetKind:"feature",targetId:n.targetId})});if(a.ok){let e=await a.json();ty(t=>[...t,e])}},[t]),tk=(0,r.useCallback)((e,t)=>{ty(n=>n.map(n=>n.id===e?{...n,...t}:n)),fetch(`/api/board-annotations/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)})},[]),tN=(0,r.useCallback)(e=>{ty(t=>t.filter(t=>t.id!==e)),fetch(`/api/board-annotations/${e}`,{method:"DELETE"})},[]),tC=tg?tw:N,[tE,tA]=(0,r.useState)(()=>new Map),tS=(0,r.useMemo)(()=>{let e=new Map(tp.map(e=>[e.id,e])),t=new Map,n=tv.flatMap(n=>{let a=e.get(n.targetId);if(!a||a.hidden)return[];let r=t.get(n.targetId)??0;t.set(n.targetId,r+1);let s=a.measured?.height??96;return[{id:`anno-${n.id}`,type:"annotation",position:{x:n.x??a.position.x+26,y:n.y??a.position.y+s+56+112*r},measured:tE.get(`anno-${n.id}`),draggable:tg,data:{n:n.n,text:n.text,annotationId:n.id,onClick:tg||A?void 0:E,editable:tg||!!A,onChangeText:tg?(e,t)=>tk(e,{body:t}):A,onDelete:tg?tN:S}}]});return[...tp.map(e=>{let t=tj.get(e.id);return t||tC?{...e,data:{...e.data,pins:t,onPinClick:tg?void 0:E,onComment:tC}}:e}),...n]},[tp,tv,tj,tg,E,A,S,tC,tk,tN,tE]),tI=(0,r.useMemo)(()=>tv.map(e=>({id:`annoe-${e.id}`,source:e.targetId,sourceHandle:`pin-${e.id}`,target:`anno-${e.id}`,targetHandle:"in",type:"annotation",selectable:!1,zIndex:30,style:{stroke:y.V5,strokeWidth:1.5,opacity:.9}})),[tv]),tM=(0,r.useCallback)(e=>{let t=[];for(let n of e)if("position"===n.type&&n.id.startsWith("anno-")&&n.position){let e=n.id.slice(5),{x:t,y:a}=n.position;ty(n=>n.map(n=>n.id===e?{...n,x:t,y:a}:n))}else if("dimensions"===n.type&&n.id.startsWith("anno-")){let e=n.dimensions;e&&tA(t=>{let a=t.get(n.id);if(a&&a.width===e.width&&a.height===e.height)return t;let r=new Map(t);return r.set(n.id,e),r})}else t.push(n);t.length&&X(e=>(0,i._0)(t,e))},[]),tT=(0,r.useCallback)(e=>K(t=>(0,i.zW)(e,t)),[]),tz=(0,r.useCallback)(async e=>{if(!e.source||!e.target||e.source===e.target)return;let t=await fetch("/api/edges",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({fromId:e.source,toId:e.target,kind:"DEPENDS",sourceHandle:e.sourceHandle??null,targetHandle:e.targetHandle??null})});if(!t.ok)return;let n=await t.json(),a=eF.DEPENDS;K(t=>t.some(e=>e.id===n.id)?t:[...t,{id:n.id,source:n.fromId,sourceHandle:e.sourceHandle??void 0,target:n.toId,targetHandle:e.targetHandle??void 0,label:"depends on",type:"deletable",markerEnd:{type:o.TG.ArrowClosed,color:a.stroke},style:{stroke:a.stroke,strokeDasharray:a.dash}}])},[]),tR=(0,r.useCallback)(async(t,n,a)=>{let r=await fetch("/api/nodes",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({view:e,title:"New node",parentId:t.id,cluster:t.data.cluster??null,status:"ARCHITECTURE"===e?"REBUILD":"PENDING",x:n,y:a})});if(!r.ok)return;let s=await r.json();X(r=>[...r,{id:s.id,type:"ROADMAP"===e?"roadmapNode":"archNode",position:{x:n,y:a},data:{title:s.title,role:s.role,plain:s.plain,status:s.status,priority:s.priority,cluster:s.cluster,view:s.view,source:s.source,sourceRef:s.sourceRef,kind:s.kind,isCriterion:!1,isChild:!0,parentId:t.id,openBugs:0}}]),K(e=>[...e,{id:`c-${s.id}`,source:t.id,target:s.id,type:"smoothstep",style:{stroke:eF.CONTAINS.stroke}}]),ei(e=>new Set(e).add(s.id)),ed(s.id),Y(s.id)},[e]),t$=(0,r.useCallback)(async(e,t)=>{if(t.isValid||!t.fromNode||!em.current)return;let n=e.changedTouches,a=n?.[0]?.clientX??e.clientX,r=n?.[0]?.clientY??e.clientY,{x:s,y:o}=em.current.screenToFlowPosition({x:a,y:r});await tR(t.fromNode,s,o)},[tR]);(0,r.useEffect)(()=>{if(!ec)return;let e=e=>{"Escape"===e.key&&eu(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ec]);let tD=(0,r.useMemo)(()=>t.find(e=>e.id===W)??null,[t,W]),tP=(0,r.useCallback)((e,t,n)=>{fetch(`/api/nodes/${e}/position`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({x:t,y:n})})},[]),tO=(0,r.useCallback)(e=>{Y(e),V(null);let t=em.current?.getNode(e);if(!t||!em.current)return;let n=t.measured?.width??128,a=t.measured?.height??48;em.current.setCenter(t.position.x+n/2,t.position.y+a/2,{zoom:1.2,duration:600})},[]),tF=(0,r.useCallback)(e=>{let t=(0,eI.VI)(U.map(e=>({id:e.id,parentId:e.data.parentId??null,cluster:e.data.cluster,status:e.data.status,priority:e.data.priority})),e,{viewportAspect:window.innerWidth/window.innerHeight});X(e=>e.map(e=>{let n=t.get(e.id);return n?{...e,position:n}:e}));let n=Array.from(t,([e,t])=>({id:e,x:t.x,y:t.y}));n.length&&fetch("/api/nodes/positions",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({batch:n})}),eG(e),fetch("/api/board-layout",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({board:"roadmap",arrangedBy:e})}),requestAnimationFrame(()=>em.current?.fitView({duration:600,padding:.2}))},[U]),tL=(0,r.useMemo)(()=>{let t=new Map;if("ROADMAP"!==e||!eX)return t;let n=e=>"status"===eX?e.status:"priority"===eX?`P${e.priority}`:e.cluster??"—";for(let e of U)"annotation"!==e.type&&t.set(e.id,n(e.data));return t},[U,eX,e]),t_=(0,r.useRef)(null);(0,r.useEffect)(()=>{let t=t_.current;if(t_.current=tL,!t||"ROADMAP"!==e||!eX)return;let n=!1;for(let[e,a]of tL)if(t.has(e)&&t.get(e)!==a){n=!0;break}n&&tF(eX)},[tL,eX,e,tF]);let tB=(0,r.useCallback)(()=>{let e=function(e,t,n={}){if(0===e.length)return new Map;let a=function(e,t){let n=e.map(e=>e.id).sort(),a=new Map(n.map(e=>[e,[]]));for(let e of[...t].sort((e,t)=>e.fromId.localeCompare(t.fromId)||e.toId.localeCompare(t.toId)))a.get(e.fromId)?.push(e);let r=new Map,s=[],o=e=>{for(let t of(r.set(e,"visiting"),a.get(e)??[])){let e=r.get(t.toId);"visiting"!==e&&(s.push(t),"done"!==e&&o(t.toId))}r.set(e,"done")};for(let e of n)r.has(e)||o(e);return s}(e,t),r=function(e,t){let n=new Map(e.map(e=>[e.id,[]]));for(let e of t)n.get(e.fromId)?.push(e.toId);let a=new Map,r=e=>{let t=a.get(e);if(void 0!==t)return t;a.set(e,0);let s=n.get(e)??[],o=s.length?1+Math.max(...s.map(r)):0;return a.set(e,o),o};for(let t of e)r(t.id);return a}(e,a),s=new Map(e.map(e=>[e.id,[]]));for(let e of a)s.get(e.fromId)?.push(e.toId);let o=Array.from(new Set(e.map(e=>e.group))),i=o.filter(e=>"—"!==e).sort(),l=o.includes("—")?[...i,"—"]:i,d=[];for(let t of l){let n=e.filter(e=>e.group===t),a=Math.min(...n.map(e=>r.get(e.id)??0)),o=Math.max(...n.map(e=>r.get(e.id)??0)),i=new Map,l=new Map,c=0,u=1;for(let e=a;e<=o;e++){let t=n.filter(t=>r.get(t.id)===e);if(!t.length)continue;let a=e=>{let t=(s.get(e.id)??[]).map(e=>l.get(e)).filter(e=>void 0!==e);return t.length?t.reduce((e,t)=>e+t,0)/t.length:1/0};t.sort((e,t)=>a(e)-a(t)||e.id.localeCompare(t.id));let o=Math.max(1,Math.ceil(Math.sqrt(2*t.length)));t.forEach((e,t)=>{let n=Math.floor(t/o),a=t%o;l.set(e.id,a),i.set(e.id,{x:c+360*n,y:150*a}),u=Math.max(u,a+1)}),c+=360*Math.ceil(t.length/o)}d.push({d:t,w:c,h:150*u,local:i})}let c=(0,eM.Xi)(d.map(e=>({id:e.d,w:e.w,h:e.h})),{gapX:84,gapY:80,viewportAspect:n.viewportAspect,minBandW:1080,aspectSlack:1.5}),u=new Map;for(let e of d){let t=c.get(e.d);for(let[n,a]of e.local)u.set(n,{x:t.x+a.x,y:t.y+a.y})}return u}(U.filter(e=>"annotation"!==e.type).map(e=>({id:e.id,group:(e.data.cluster??"").trim()||"—"})),n.filter(e=>"DEPENDS"===e.kind).map(e=>({fromId:e.fromId,toId:e.toId})),{viewportAspect:window.innerWidth/window.innerHeight});X(t=>t.map(t=>{let n=e.get(t.id);return n?{...t,position:n}:t}));let t=Array.from(e,([e,t])=>({id:e,x:t.x,y:t.y}));t.length&&fetch("/api/nodes/positions",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({batch:t})}),requestAnimationFrame(()=>em.current?.fitView({duration:600,padding:.2}))},[U,n]),tH=(0,r.useMemo)(()=>tr?(0,ek.r2)(U.filter(e=>e9(e.data)),eK,e=>(0,ek.$$)(e.data),e=>({id:e.id,label:e.data.title,sublabel:e.data.cluster??e.data.status,kind:"feature"})):[],[U,eK,e9,tr]);function tU(e,t){t(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,a.jsx)(F.Provider,{value:eU,children:(0,a.jsxs)("div",{className:(0,H.cn)("canvas-dots relative w-full",b?"h-full":"h-screen"),onDragOver:e=>{e.dataTransfer.types.includes("application/beacon-node")&&(e.preventDefault(),e.dataTransfer.dropEffect="copy")},onDrop:e=>{if(!e.dataTransfer.getData("application/beacon-node")||!em.current)return;e.preventDefault();let{x:t,y:n}=em.current.screenToFlowPosition({x:e.clientX,y:e.clientY});ey(t,n,"BUG"===e.dataTransfer.getData("application/beacon-node-kind")?"BUG":"FEATURE")},children:[(0,a.jsxs)(i.Gc,{nodes:tS,edges:"far"===eY?[...tf,...tI].map(e=>({...e,hidden:!0})):[...tf,...tI],nodeTypes:eP,edgeTypes:eO,nodesConnectable:!z,connectionMode:o.WZ.Loose,connectionLineStyle:{stroke:"var(--accent-2,#ff7a45)",strokeWidth:1.5,strokeDasharray:"4 4"},onInit:e=>{em.current=e},onNodesChange:tM,onEdgesChange:tT,onConnect:tz,onConnectEnd:t$,onNodeMouseEnter:(e,t)=>Q(t.id),onNodeMouseLeave:()=>Q(null),onEdgesDelete:e=>{for(let t of e)t.id.startsWith("c-")||fetch(`/api/edges/${t.id}`,{method:"DELETE"})},onNodesDelete:e=>{for(let t of e)t.id.startsWith("anno-")||(fetch(`/api/nodes/${t.id}`,{method:"DELETE"}),Y(e=>e===t.id?null:e))},onNodeClick:(e,t)=>{if("annotation"===t.type){let e=t.data;e.editable||E?.(e.annotationId);return}if(ec){if(eu(!1),t.data.isChild)return;tR(t,t.position.x+300,t.position.y+60);return}if(Y(t.id),V(null),ea("details"),b){let t=e.target;t?.closest("input, textarea, select, button, [role='combobox']")||et(!0)}},onEdgeClick:(e,t)=>{V(t.id),Y(null),ea("details")},onPaneClick:()=>{ec?eu(!1):(et(!1),Y(null),V(null))},onNodeDragStop:(e,t)=>{if(t.id.startsWith("anno-")){tg&&tk(t.id.slice(5),{x:t.position.x,y:t.position.y});return}z||tP(t.id,t.position.x,t.position.y)},deleteKeyCode:z?null:["Backspace","Delete"],colorMode:"dark",fitView:!0,fitViewOptions:{padding:.15,minZoom:.38,maxZoom:.9},minZoom:.2,panOnScroll:!0,zoomActivationKeyCode:["Meta","Control"],proOptions:{hideAttribution:!0},children:[(0,a.jsx)(eR.Z,{regions:tx,tone:th,lod:eY}),(0,a.jsx)(_.J,{onLod:eZ}),(0,a.jsx)(i.H2,{position:"bottom-right",className:"!overflow-hidden !rounded-xl !border !border-white/10 [&_button]:!border-white/10 [&_button]:!bg-card/70 [&_button]:!text-foreground [&_button]:!backdrop-blur"}),(0,a.jsx)(i.Zk,{position:"bottom-right",style:{marginBottom:152},children:(0,a.jsx)(eA.er,{title:"Legend",trigger:(e,t)=>(0,a.jsx)("button",{type:"button",onClick:t,title:"Legend",className:(0,H.cn)("glass flex size-8 items-center justify-center rounded-lg transition-colors",e?"text-foreground":"text-muted-foreground hover:text-foreground"),children:(0,a.jsx)(l.A,{className:"size-4"})}),children:(0,a.jsxs)("ul",{className:"space-y-1.5 text-[10.5px] text-muted-foreground",children:["ROADMAP"===e?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("li",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"inline-block rounded bg-sky-500/15 px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-sky-300",children:"feature"}),(0,a.jsx)("span",{children:"top-level card \xb7 can have sub-tasks"})]}),(0,a.jsxs)("li",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"inline-block rounded bg-zinc-500/15 px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-zinc-300",children:"sub-task"}),(0,a.jsx)("span",{children:"child of a feature"})]}),(0,a.jsxs)("li",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"inline-block rounded bg-rose-500/15 px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-rose-300",children:"bug"}),(0,a.jsx)("span",{children:"a bug to fix \xb7 not a feature"})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("li",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"inline-block rounded bg-sky-500/15 px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-sky-300",children:"component"}),(0,a.jsx)("span",{children:"a subsystem \xb7 can have sub-components"})]}),(0,a.jsxs)("li",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"inline-block rounded bg-zinc-500/15 px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-zinc-300",children:"sub-component"}),(0,a.jsx)("span",{children:"part of a component"})]}),(0,a.jsxs)("li",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"inline-block rounded bg-rose-500/15 px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-rose-300",children:"bug"}),(0,a.jsx)("span",{children:"a flagged issue on a component"})]})]}),T&&(0,a.jsxs)("li",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{"aria-hidden":!0,className:"inline-block h-3 w-1 shrink-0 rounded-sm",style:{background:(0,P.A6)("fullstack")}}),(0,a.jsx)("span",{children:"left stripe \xb7 frontend / backend layer"})]}),(0,a.jsxs)("li",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{"aria-hidden":!0,className:"inline-block h-px w-6 bg-[#33333a]"}),(0,a.jsx)("span",{children:"contains \xb7 drag the bottom handle to empty canvas"})]}),(0,a.jsxs)("li",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{"aria-hidden":!0,className:"inline-block h-0 w-6 border-t border-dashed",style:{borderColor:"#f5b942"}}),(0,a.jsxs)("span",{children:["depends on \xb7 drag between two ","ROADMAP"===e?"cards":"components"]})]})]})})}),!b&&(0,a.jsx)(i.of,{pannable:!0,zoomable:!0,position:"bottom-left",style:{width:140,height:90},className:"!overflow-hidden !rounded-xl !border !border-white/10 !bg-card/50 !backdrop-blur",nodeColor:e=>e.data?.priority===0?"#ff3860":"#555"}),(0,a.jsxs)(i.Zk,{position:"bottom-center",className:"!mb-4 flex flex-col items-center gap-2",children:[ec&&(0,a.jsxs)("div",{className:"glass rounded-full px-3 py-1 text-[11px] text-muted-foreground",children:["Click a ","ARCHITECTURE"===e?"component":"feature"," to attach the"," ","ARCHITECTURE"===e?"sub-component":"sub-task"," \xb7 Esc to cancel"]}),"ARCHITECTURE"===e&&(0,a.jsx)("div",{className:"glass flex items-center rounded-full p-0.5",children:(0,a.jsxs)("button",{onClick:tB,title:"Arrange components into a left→right dependency flow, grouped by domain",className:"flex h-6 items-center gap-1.5 rounded-full px-3 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-white/[0.06] hover:text-foreground",children:[(0,a.jsx)(d.A,{className:"size-3"}),"Arrange"]})}),"ROADMAP"===e&&(0,a.jsxs)("div",{className:"glass flex items-center gap-1 rounded-full p-1",children:[(0,a.jsx)("span",{className:"pl-2 pr-0.5 text-[11px] text-muted-foreground",children:"Group by"}),e$.map(e=>(0,a.jsx)("button",{onClick:()=>tF(e.value),title:`Arrange features into lanes by ${e.label.toLowerCase()}`,className:(0,H.cn)("h-7 rounded-full px-2.5 text-[11px] font-medium transition-colors",eX===e.value?"bg-white/[0.12] text-foreground":"text-muted-foreground hover:bg-white/[0.06] hover:text-foreground"),children:e.label},e.value))]}),(0,a.jsxs)("div",{className:"glass flex items-center gap-1 rounded-full p-1",children:[(0,a.jsxs)("button",{onClick:eB,draggable:!0,onDragStart:t=>{t.dataTransfer.setData("application/beacon-node",e),t.dataTransfer.effectAllowed="copy"},title:"ARCHITECTURE"===e?"Add component (click, or drag onto the board to place it)":"Add feature (click, or drag onto the board to place it)",className:"flex h-8 cursor-grab items-center gap-1.5 rounded-full px-3 text-[12px] font-medium text-foreground transition-colors hover:bg-white/[0.06] active:cursor-grabbing",children:[(0,a.jsx)(c.A,{className:"size-3.5 text-[var(--accent-2,#ff7a45)]"}),"ARCHITECTURE"===e?"Component":"Feature"]}),"ROADMAP"===e&&(0,a.jsxs)("button",{onClick:eH,draggable:!0,onDragStart:t=>{t.dataTransfer.setData("application/beacon-node",e),t.dataTransfer.setData("application/beacon-node-kind","BUG"),t.dataTransfer.effectAllowed="copy"},title:"Add bug (click, or drag onto the board to place it)",className:"flex h-8 cursor-grab items-center gap-1.5 rounded-full px-3 text-[12px] font-medium text-foreground transition-colors hover:bg-white/[0.06] active:cursor-grabbing",children:[(0,a.jsx)(u.A,{className:"size-3.5 text-rose-400"}),"Bug"]}),(0,a.jsx)("span",{"aria-hidden":!0,className:"mx-0.5 h-5 w-px bg-white/10"}),(0,a.jsxs)("button",{onClick:()=>eu(e=>!e),title:"ARCHITECTURE"===e?"Add sub-component (click a component next)":"Add sub-task (click a feature next)",className:(0,H.cn)("flex h-8 items-center gap-1.5 rounded-full px-3 text-[12px] font-medium transition-colors",ec?"bg-white/[0.1] text-foreground":"text-muted-foreground hover:bg-white/[0.06] hover:text-foreground"),children:[(0,a.jsx)(m.A,{className:"size-3.5"}),"ARCHITECTURE"===e?"Sub-component":"Sub-task"]})]})]}),!b&&to.length>0&&!tl.active&&(0,a.jsx)(i.Zk,{position:"top-left",className:"!mt-14",children:(0,a.jsxs)("button",{type:"button",onClick:tl.start,title:"Guided, domain-by-domain walkthrough of the architecture",className:"glass flex items-center gap-1.5 rounded-xl px-3 py-1.5 text-[11px] text-muted-foreground transition-colors hover:text-foreground",children:[(0,a.jsx)(p.A,{className:"size-3.5"}),"Start tour"]})}),!b&&(0,a.jsx)(i.Zk,{position:"top-center",className:"glass rounded-full px-1 py-0.5",children:(0,a.jsx)(ej.Z,{active:e,tabs:[{value:"ROADMAP",label:"Roadmap",href:"/map?view=ROADMAP"},{value:"ARCHITECTURE",label:"Architecture",href:"/map?view=ARCHITECTURE"},{value:"DATABASE",label:"Database",href:"/map?view=DATABASE"},{value:"FILES",label:"Files",href:"/map?view=FILES"}]})}),(0,a.jsxs)(i.Zk,{position:"top-right",className:(0,H.cn)("flex items-center gap-1 transition-[margin] duration-200",ee&&"!mr-[332px]",b&&"hidden"),children:[(0,a.jsx)(ew.X,{query:eK,onQuery:eW,hits:tH,placeholder:"Find a feature…",onPick:e=>{eW(""),tO(e)},onZoomToMatches:()=>{ts?.size&&em.current?.fitView({nodes:[...ts].map(e=>({id:e})),duration:600,padding:.2})}}),T&&(0,a.jsx)(eS.o,{value:e5,onChange:e2}),"ROADMAP"===e&&O&&(0,a.jsx)("button",{type:"button",onClick:()=>tO(O),title:"Jump to the next feature to work on",className:"glass flex size-8 items-center justify-center rounded-lg text-emerald-300 transition-colors hover:text-emerald-200",children:(0,a.jsx)(x.A,{className:"size-4"})}),(0,a.jsxs)(eA.er,{title:"Filters",trigger:(e,t)=>(0,a.jsxs)("button",{type:"button",onClick:t,title:"Filters",className:(0,H.cn)("glass relative flex size-8 items-center justify-center rounded-lg transition-colors",e||e8>0?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[(0,a.jsx)(h.A,{className:"size-4"}),e8>0&&(0,a.jsx)("span",{className:"absolute -right-1 -top-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-[var(--accent-2,#ff7a45)] px-1 text-[9px] font-semibold text-white",children:e8})]}),children:[e3.length>0&&(0,a.jsx)(eA.r1,{title:"Status",children:e3.map(e=>(0,a.jsx)(eA.vu,{on:eq.has(e),onClick:()=>tU(e,eV),children:D.nR[e]?.label??e},e))}),e4.length>0&&(0,a.jsx)(eA.r1,{title:"Cluster",children:e4.map(e=>(0,a.jsx)(eA.vu,{on:eJ.has(e),onClick:()=>tU(e,eQ),children:e},e))}),e6.length>0&&(0,a.jsx)(eA.r1,{title:"Priority",children:e6.map(e=>(0,a.jsxs)(eA.vu,{on:e0.has(e),onClick:()=>tU(e,e1),children:["P",e]},e))}),e8>0&&(0,a.jsx)("button",{type:"button",onClick:e7,className:"mt-1 w-full rounded-md border border-white/10 px-2 py-1 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-white/5 hover:text-foreground",children:"clear filters"})]}),!ee&&(0,a.jsx)("button",{onClick:()=>{et(!0),ea("details")},title:"Show panel",className:"glass flex size-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:text-foreground",children:(0,a.jsx)(f.A,{className:"size-4"})})]})]}),ee&&(0,a.jsx)(ex,{view:e,selected:tD,allNodes:t,onClose:()=>{et(!1),ea("details")},commentsContent:v,commentsCount:j,activeTab:en,onTabChange:ea,onAddComment:tC,topOffset:b?64:void 0}),tl.active&&tl.step&&(0,a.jsx)(eE.d,{steps:to,index:tl.index,onPrev:tl.prev,onNext:tl.next,onExit:tl.stop,onGoto:tl.goto})]})})}},4474:(e,t,n)=>{n.d(t,{$:()=>l});var a=n(95155),r=n(6539),s=n(18460),o=n(91337);let i=(0,s.F)("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function l({className:e,variant:t="default",size:n="default",...s}){return(0,a.jsx)(r.Button,{"data-slot":"button",className:(0,o.cn)(i({variant:t,size:n,className:e})),...s})}},9991:(e,t,n)=>{n.d(t,{X:()=>c});var a=n(95155),r=n(12115),s=n(65377),o=n(9005),i=n(91337),l=n(56614);function d(e){if(!e||!e.tagName)return!1;let t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t||e.isContentEditable}function c({query:e,onQuery:t,hits:n,onPick:u,onZoomToMatches:m,placeholder:p="Search…"}){let[x,h]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let e=e=>{x||e.metaKey||e.ctrlKey||e.altKey||1!==e.key.length||" "===e.key||d(e.target)||d(document.activeElement)||(e.preventDefault(),h(!0),t(e.key))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[x,t]),(0,a.jsxs)(l.er,{title:"Search",open:x,onOpenChange:e=>e?h(!0):void(h(!1),t("")),outsideClicksToClose:2,trigger:(t,n)=>(0,a.jsx)("button",{type:"button",onClick:n,title:"Search this canvas",className:(0,i.cn)("glass flex size-8 items-center justify-center rounded-lg transition-colors",t||e.trim()?"text-foreground":"text-muted-foreground hover:text-foreground"),children:(0,a.jsx)(s.A,{className:"size-4"})}),children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{autoFocus:!0,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{"Enter"===e.key&&m&&(e.preventDefault(),m())},placeholder:p,className:"w-full rounded-md border border-white/10 bg-white/[0.04] py-1 pl-2 pr-7 text-[12px] outline-none placeholder:text-muted-foreground/50 focus:bg-white/[0.08]"}),e&&(0,a.jsx)("button",{type:"button",onClick:()=>t(""),title:"Clear search",className:"absolute right-1 top-1/2 flex size-5 -translate-y-1/2 items-center justify-center rounded text-muted-foreground/60 transition-colors hover:bg-white/10 hover:text-foreground",children:(0,a.jsx)(o.A,{className:"size-3.5"})})]}),(0,a.jsxs)("div",{className:"mt-2 max-h-64 space-y-0.5 overflow-y-auto",children:[e.trim()&&0===n.length&&(0,a.jsx)("div",{className:"px-1 py-1 text-[11px] text-muted-foreground",children:"No matches"}),n.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{u(e.id),h(!1)},className:"group flex w-full items-center gap-2 rounded-md px-2 py-1 text-left transition-colors hover:bg-white/5",children:[(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] text-muted-foreground transition-colors group-hover:text-foreground",children:e.label}),e.sublabel&&(0,a.jsx)("span",{className:"shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground/50",children:e.sublabel})]},e.id))]})]})}},12410:(e,t,n)=>{n.d(t,{a2:()=>o,i3:()=>d,xZ:()=>i});let a=["bg-emerald-500/15 text-emerald-300","bg-sky-500/15 text-sky-300","bg-violet-500/15 text-violet-300","bg-amber-500/15 text-amber-200","bg-rose-500/15 text-rose-300","bg-cyan-500/15 text-cyan-300","bg-fuchsia-500/15 text-fuchsia-300","bg-lime-500/15 text-lime-300","bg-orange-500/15 text-orange-300","bg-teal-500/15 text-teal-300","bg-indigo-500/15 text-indigo-300","bg-pink-500/15 text-pink-300"],r=["border-emerald-500/20 bg-emerald-500/[0.04]","border-sky-500/20 bg-sky-500/[0.04]","border-violet-500/20 bg-violet-500/[0.04]","border-amber-500/20 bg-amber-500/[0.04]","border-rose-500/20 bg-rose-500/[0.04]","border-cyan-500/20 bg-cyan-500/[0.04]","border-fuchsia-500/20 bg-fuchsia-500/[0.04]","border-lime-500/20 bg-lime-500/[0.04]","border-orange-500/20 bg-orange-500/[0.04]","border-teal-500/20 bg-teal-500/[0.04]","border-indigo-500/20 bg-indigo-500/[0.04]","border-pink-500/20 bg-pink-500/[0.04]"];function s(e){let t=(e??"").trim().toUpperCase();if(!t)return null;let n=0;for(let e=0;e<t.length;e++)n=31*n+t.charCodeAt(e)>>>0;return n%a.length}function o(e){let t=s(e);return null===t?"bg-white/[0.06] text-muted-foreground":a[t]}function i(e){let t=s(e);return null===t?"border-white/10 bg-white/[0.02]":r[t]}let l=["#34d399","#38bdf8","#a78bfa","#fbbf24","#fb7185","#22d3ee","#e879f9","#a3e635","#fb923c","#2dd4bf","#818cf8","#f472b6"];function d(e){let t=s(e);return null===t?"#9ca3af":l[t]}},14983:(e,t,n)=>{n.d(t,{$$:()=>o,Qk:()=>s,RU:()=>a,Uy:()=>r,jF:()=>i,r2:()=>c,sQ:()=>l,zn:()=>d});let a="0 0 0 3px var(--accent-2,#ff7a45), 0 0 32px -2px var(--accent-2,#ff7a45)",r=.14;function s(e,t){let n=t.trim().toLowerCase();if(!n)return!1;for(let t of e)if(t&&t.toLowerCase().includes(n))return!0;return!1}function o(e){return[e.title,e.role,e.plain,e.cluster,e.status].filter(Boolean)}function i(e){let t=[e.name,e.domain,e.description];for(let n of e.columns??[])t.push(n.name,n.type,n.note);return t.filter(Boolean)}function l(e){return[e.method,e.path,e.domain,e.description].filter(Boolean)}function d(e){return[e.path,e.lang].filter(Boolean)}function c(e,t,n,a,r=12){let o=t.trim().toLowerCase();if(!o)return[];let i=[];for(let t of e){if(!s(n(t),o))continue;let e=a(t);i.push({hit:e,score:function(e,t){let n=e.toLowerCase();return n===t?0:n.startsWith(t)?1:RegExp(`(^|[^a-z0-9])${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}`,"i").test(e)?2:n.includes(t)?3:4}(e.label,o)})}return i.sort((e,t)=>e.score-t.score||e.hit.label.length-t.hit.label.length),i.slice(0,r).map(e=>e.hit)}},16607:(e,t,n)=>{n.d(t,{d:()=>c});var a=n(95155),r=n(24413),s=n(9005),o=n(78780),i=n(76721),l=n(82099),d=n(91337);function c({steps:e,index:t,onPrev:n,onNext:u,onExit:m,onGoto:p}){let x=e[t];if(!x)return null;let h=t===e.length-1;return(0,a.jsxs)(l.b,{className:"absolute bottom-3 left-3 top-16 z-10 flex w-72 flex-col rounded-2xl",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between border-b border-white/10 px-3.5 py-2.5",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:[(0,a.jsx)(r.A,{className:"size-3.5"}),"Guided tour"]}),(0,a.jsx)("button",{onClick:m,title:"End tour (Esc)",className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground",children:(0,a.jsx)(s.A,{className:"size-4"})})]}),(0,a.jsxs)("div",{className:"border-b border-white/10 px-3.5 py-3",children:[(0,a.jsxs)("div",{className:"text-[10px] font-medium uppercase tracking-wide text-[var(--accent-2,#ff7a45)]",children:["Step ",t+1," / ",e.length]}),(0,a.jsx)("h2",{className:"mt-1 break-words text-sm font-semibold leading-tight",children:x.title}),(0,a.jsx)("p",{className:"mt-1 text-[11px] leading-snug text-muted-foreground",children:x.summary})]}),(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-1.5",children:(0,a.jsx)("ol",{className:"space-y-0.5",children:e.map((e,n)=>(0,a.jsx)("li",{children:(0,a.jsxs)("button",{onClick:()=>p(n),title:e.title,className:(0,d.cn)("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors",n===t?"bg-white/[0.08] text-foreground":"text-muted-foreground hover:bg-white/[0.04] hover:text-foreground"),children:[(0,a.jsx)("span",{className:(0,d.cn)("flex size-4 shrink-0 items-center justify-center rounded-full text-[9px] font-bold",n===t?"bg-[var(--accent-2,#ff7a45)] text-background":"bg-white/10 text-muted-foreground"),children:n+1}),(0,a.jsx)("span",{className:"truncate text-[11px]",children:e.title})]})},e.id))})}),(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 border-t border-white/10 p-2",children:[(0,a.jsxs)("button",{onClick:n,disabled:0===t,className:"flex items-center gap-1 rounded-md px-2 py-1.5 text-[11px] text-muted-foreground transition-colors enabled:hover:bg-white/[0.06] enabled:hover:text-foreground disabled:opacity-40",children:[(0,a.jsx)(o.A,{className:"size-3.5"})," Prev"]}),h?(0,a.jsx)("button",{onClick:m,className:"rounded-md bg-[var(--accent-2,#ff7a45)]/90 px-3 py-1.5 text-[11px] font-semibold text-background transition-colors hover:bg-[var(--accent-2,#ff7a45)]",children:"Done"}):(0,a.jsxs)("button",{onClick:u,className:"flex items-center gap-1 rounded-md bg-white/10 px-3 py-1.5 text-[11px] font-semibold text-foreground transition-colors hover:bg-white/[0.16]",children:["Next ",(0,a.jsx)(i.A,{className:"size-3.5"})]})]})]})}},17918:(e,t,n)=>{n.d(t,{Sh:()=>c,V5:()=>d,e0:()=>m});var a=n(95155),r=n(12115),s=n(81750),o=n(6266),i=n(9005),l=n(91337);let d="#ff7a45";function c({data:e,selected:t}){let[n,u]=(0,r.useState)(e.text);return(0,r.useEffect)(()=>{u(e.text)},[e.text]),(0,a.jsxs)("div",{onClick:()=>e.onClick?.(e.annotationId),className:(0,l.cn)("group/anno relative w-[270px] rounded-xl border border-white/10 bg-[#1b1b1e]/95 px-4 py-3 shadow-[0_18px_50px_-20px_rgba(0,0,0,0.9)] backdrop-blur transition-colors hover:border-white/20",!e.editable&&"cursor-pointer",t&&"border-[#ff7a45]/50"),children:[(0,a.jsx)("span",{"aria-hidden":!0,className:"pointer-events-none absolute -left-px bottom-2 top-2 w-[3px] rounded-full",style:{background:d}}),(0,a.jsx)(s.h7,{type:"target",id:"in",position:o.yX.Top,isConnectable:!1,className:"!pointer-events-none !size-1 !min-h-0 !min-w-0 !border-0 !bg-transparent",style:{left:"auto",right:22,top:0}}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("div",{className:"font-mono text-[10px] font-semibold uppercase tracking-[0.22em]",style:{color:d},children:"Annotation \xb7 You"}),e.editable&&e.onDelete&&(0,a.jsx)("button",{type:"button",title:"Delete annotation",onClick:t=>{t.stopPropagation(),e.onDelete?.(e.annotationId)},className:"nodrag nopan -mr-1 rounded p-0.5 text-muted-foreground/60 opacity-0 transition-opacity hover:text-red-300 group-hover/anno:opacity-100",children:(0,a.jsx)(i.A,{className:"size-3"})})]}),e.editable?(0,a.jsx)("textarea",{value:n,autoFocus:!e.text.trim(),placeholder:"Type your annotation…",onChange:e=>u(e.target.value),onBlur:()=>{n!==e.text&&e.onChangeText?.(e.annotationId,n)},onKeyDown:e=>e.stopPropagation(),className:"nodrag nopan thin-scroll field-sizing-content mt-1.5 max-h-40 min-h-[2.25rem] w-full resize-none overflow-y-auto bg-transparent text-[13px] leading-snug text-foreground/95 outline-none placeholder:text-muted-foreground/60"}):(0,a.jsx)("div",{className:"thin-scroll mt-1.5 max-h-40 overflow-y-auto text-[13px] leading-snug text-foreground/95",children:e.text.trim()?e.text:(0,a.jsx)("span",{className:"text-muted-foreground",children:"…"})})]})}function u({n:e,annotationId:t,onClick:n}){return(0,a.jsxs)("button",{type:"button",title:`Annotation ${e} — view comment`,onClick:e=>{e.stopPropagation(),n?.(t)},className:"nodrag nopan relative flex size-6 items-center justify-center rounded-full font-mono text-[11px] font-bold text-[#181818] shadow-[0_0_0_3px_rgba(255,122,69,0.22),0_0_16px_2px_rgba(255,122,69,0.4)] transition-transform hover:scale-110",style:{background:d},children:[e,(0,a.jsx)(s.h7,{type:"source",id:`pin-${t}`,position:o.yX.Bottom,isConnectable:!1,className:"!pointer-events-none !size-1 !min-h-0 !min-w-0 !border-0 !bg-transparent",style:{left:"50%",bottom:2}})]})}function m({pins:e,onPinClick:t}){return e.length?(0,a.jsx)("span",{className:"absolute -right-3 top-1/2 z-10 flex -translate-y-1/2 flex-row-reverse gap-1",children:e.map(e=>(0,a.jsx)(u,{n:e.n,annotationId:e.id,onClick:t},e.id))}):null}},18874:(e,t,n)=>{n.d(t,{F1:()=>i,e6:()=>s,qA:()=>r,ru:()=>o});let a={auth:"#4ea1ff",firms:"#c792ea",search:"#7bd389",storage:"#ffb86b",petitions:"#ff7a45",monitoring:"#f5b942",admin:"#ff6b9d"};function r(e){return e&&a[e]||"#8a8a8a"}let s={GET:"#7bd389",POST:"#4ea1ff",PUT:"#ffb86b",PATCH:"#ffb86b",DELETE:"#ff3860"},o={read:"#4ea1ff",write:"#ffb86b","read-write":"#c792ea"};function i(e,t){let n=new Set([e]);for(let a of t)a.source===e&&n.add(a.target),a.target===e&&n.add(a.source);return n}},24692:(e,t,n)=>{n.d(t,{I:()=>l});var a=n(95155),r=n(81750),s=n(6266),o=n(65738),i=n(28736);function l(e){let{deleteElements:t}=(0,r.VH)(),n=(0,r.JY)(e.source),l=(0,r.JY)(e.target),d=n&&l?(0,i.U)(n,l):null,[c,u,m]=(0,s.Fp)(d?{sourceX:d.sx,sourceY:d.sy,sourcePosition:d.sourcePos,targetX:d.tx,targetY:d.ty,targetPosition:d.targetPos}:{sourceX:e.sourceX,sourceY:e.sourceY,sourcePosition:e.sourcePosition,targetX:e.targetX,targetY:e.targetY,targetPosition:e.targetPosition});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.tE,{id:e.id,path:c,style:e.style,markerEnd:e.markerEnd,interactionWidth:20}),e.label&&(0,a.jsx)(r.rV,{children:(0,a.jsx)("div",{style:{position:"absolute",transform:`translate(-50%, -120%) translate(${u}px, ${m}px)`,fontSize:11,color:"#cfcfcf",background:"#161616",padding:"1px 4px",borderRadius:4,pointerEvents:"none",zIndex:1e3},children:e.label})}),e.selected&&(0,a.jsx)(r.rV,{children:(0,a.jsx)("div",{className:"nodrag nopan",style:{position:"absolute",transform:`translate(-50%, 0) translate(${u}px, ${m+14}px)`,pointerEvents:"all",zIndex:1e3},children:(0,a.jsx)("button",{type:"button",onMouseDown:e=>e.stopPropagation(),onClick:n=>{n.stopPropagation(),t({edges:[{id:e.id}]})},title:"Delete (or press Backspace)",className:"flex size-7 items-center justify-center rounded-full border border-white/20 bg-card/95 text-red-300 shadow-lg backdrop-blur-md transition-colors hover:bg-red-500/25 hover:text-red-200",children:(0,a.jsx)(o.A,{className:"size-3.5"})})})})]})}},26518:(e,t,n)=>{n.d(t,{bq:()=>k,eb:()=>C,gC:()=>N,l6:()=>j,yv:()=>w});var a=n(95155);n(12115);var r=n(40595),s=n(41294),o=n(75681),i=n(17314),l=n(37265),d=n(23107),c=n(70826),u=n(67564),m=n(1938),p=n(15433),x=n(5919),h=n(45450),f=n(88988),g=n(91337),b=n(12363),y=n(64577),v=n(94088);let j=r.H;function w({className:e,...t}){return(0,a.jsx)(s.y,{"data-slot":"select-value",className:(0,g.cn)("flex flex-1 text-left",e),...t})}function k({className:e,size:t="default",children:n,...r}){return(0,a.jsxs)(o.b,{"data-slot":"select-trigger","data-size":t,className:(0,g.cn)("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,(0,a.jsx)(i.w,{render:(0,a.jsx)(b.A,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function N({className:e,children:t,side:n="bottom",sideOffset:r=4,align:s="center",alignOffset:o=0,alignItemWithTrigger:i=!0,...m}){return(0,a.jsx)(l.V,{children:(0,a.jsx)(d.l,{side:n,sideOffset:r,align:s,alignOffset:o,alignItemWithTrigger:i,className:"isolate z-50",children:(0,a.jsxs)(c.t,{"data-slot":"select-content","data-align-trigger":i,className:(0,g.cn)("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...m,children:[(0,a.jsx)(E,{}),(0,a.jsx)(u.B,{children:t}),(0,a.jsx)(A,{})]})})})}function C({className:e,children:t,...n}){return(0,a.jsxs)(m.e,{"data-slot":"select-item",className:(0,g.cn)("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[(0,a.jsx)(p.h,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),(0,a.jsx)(x.h,{render:(0,a.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:(0,a.jsx)(y.A,{className:"pointer-events-none"})})]})}function E({className:e,...t}){return(0,a.jsx)(h.w,{"data-slot":"select-scroll-up-button",className:(0,g.cn)("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,a.jsx)(v.A,{})})}function A({className:e,...t}){return(0,a.jsx)(f.d,{"data-slot":"select-scroll-down-button",className:(0,g.cn)("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,a.jsx)(b.A,{})})}},28161:(e,t,n)=>{n.d(t,{A6:()=>l,An:()=>d,RR:()=>a,YG:()=>o,ZD:()=>i,jR:()=>s});let a=["frontend","backend","fullstack"],r={fe:"frontend",front:"frontend",be:"backend",back:"backend",fs:"fullstack","full-stack":"fullstack","full stack":"fullstack"};function s(e){let t=(e??"").trim().toLowerCase();return t?a.includes(t)?t:r[t]??null:null}let o={frontend:{label:"Frontend",short:"FE"},backend:{label:"Backend",short:"BE"},fullstack:{label:"Fullstack",short:"FS"}},i={frontend:"#5AC8FA",backend:"#3ECF8E",fullstack:"#5AC8FA"};function l(e){return"fullstack"!==e?i[e]:`linear-gradient(to bottom, ${i.frontend} 0%, ${i.frontend} 50%, ${i.backend} 50%, ${i.backend} 100%)`}let d=/\.(tsx|jsx|vue|svelte)$/i},28736:(e,t,n)=>{n.d(t,{U:()=>i,u:()=>l});var a=n(6266);function r(e){let{x:t,y:n}=e.internals.positionAbsolute,a=e.measured?.width??0,r=e.measured?.height??0;return{x:t,y:n,w:a,h:r,cx:t+a/2,cy:n+r/2}}function s(e,t){let n=r(e),a=r(t),s=n.w/2||1,o=n.h/2||1,i=(a.cx-n.cx)/(2*s)-(a.cy-n.cy)/(2*o),l=(a.cx-n.cx)/(2*s)+(a.cy-n.cy)/(2*o),d=1/(Math.abs(i)+Math.abs(l)||1);return{x:s*d*(i+l)+n.cx,y:o*d*(-i+l)+n.cy}}function o(e,t){let n=r(e),s=Math.round(t.x),o=Math.round(t.y);return s<=Math.round(n.x)+1?a.yX.Left:s>=Math.round(n.x+n.w)-1?a.yX.Right:o<=Math.round(n.y)+1?a.yX.Top:a.yX.Bottom}function i(e,t){let n=s(e,t),a=s(t,e);return{sx:n.x,sy:n.y,tx:a.x,ty:a.y,sourcePos:o(e,n),targetPos:o(t,a)}}function l(e,t){let n=e.x+e.w/2,a=e.y+e.h/2,r=t.x-n,s=t.y-a;if(0===r&&0===s)return{x:n,y:a};let o=1/Math.max(Math.abs(r)/(e.w/2||1),Math.abs(s)/(e.h/2||1));return{x:n+r*o,y:a+s*o}}},29523:(e,t,n)=>{n.d(t,{J:()=>i,k:()=>o});var a=n(12115),r=n(81750),s=n(70221);function o(e){let[t,n]=(0,a.useState)("full"),o=(0,r.Pj)(n=>(0,s.gt)(n.transform[2],t,e));return o!==t&&n(o),o}function i({onLod:e,thresholds:t}){let n=o(t),r=(0,a.useRef)(null);return(0,a.useEffect)(()=>{r.current!==n&&(r.current=n,e(n))},[n,e]),null}},36849:(e,t,n)=>{n.d(t,{VI:()=>s});var a=n(43137),r=n(94014);function s(e,t,n={}){let o=n.colW??320,i=n.rowH??150,l=n.childIndent??24,d=n.laneGap??56,c=n.bandGap??110,u=n.maxCols??10,m=n.minBandW??3*o,p=new Set(e.map(e=>e.id)),x=e=>!e.parentId||!p.has(e.parentId),h=e.filter(x),f=new Map;for(let t of e){if(x(t))continue;let e=f.get(t.parentId);e?e.push(t):f.set(t.parentId,[t])}let g="status"===t?e=>e.status:"priority"===t?e=>String(e.priority):e=>(e.cluster??"").trim()||"—",b=new Map;for(let e of h){let t=g(e),n=b.get(t);n?n.push(e):b.set(t,[e])}let y=(function(e,t,n){if("status"===e)return[...a.TT];if("priority"===e)return["0","1","2","3"];let r=Array.from(new Set(t.map(n))),s=r.filter(e=>"—"!==e).sort();return r.includes("—")?[...s,"—"]:s})(t,h,g).filter(e=>b.has(e)),v=[];for(let e of y){let t=b.get(e),n=t.reduce((e,t)=>e+1+(f.get(t.id)?.length??0),0),a=Math.max(1,Math.min(u,t.length,Math.round(Math.sqrt(.85*n))||1)),r=Array(a).fill(0),s=new Map;for(let e of t){let t=0;for(let e=1;e<a;e++)r[e]<r[t]&&(t=e);let n=t*o,d=r[t]*i;s.set(e.id,{x:n,y:d});let c=f.get(e.id)??[];c.forEach((e,t)=>{s.set(e.id,{x:n+l,y:d+(t+1)*i})}),r[t]+=1+c.length}let d=r.reduce((e,t)=>Math.max(e,t),0);v.push({id:e,w:a*o,h:d*i,local:s})}let j=(0,r.Xi)(v.map(e=>({id:e.id,w:e.w,h:e.h})),{gapX:d,gapY:c,viewportAspect:n.viewportAspect,minBandW:m,aspectSlack:1.5}),w=new Map;for(let e of v){let t=j.get(e.id);for(let[n,a]of e.local)w.set(n,{x:t.x+a.x,y:t.y+a.y})}return w}},43137:(e,t,n)=>{n.d(t,{TT:()=>s,Xf:()=>i,m6:()=>r,nR:()=>o,yl:()=>a});let a=["PENDING","IN_PROGRESS","DONE","BLOCKED","CANCELLED","DEPRIORITIZED"],r=["KEEP","REBUILD","REPLACE","DROP"],s=["IN_PROGRESS","PENDING","BLOCKED","DONE","DEPRIORITIZED","CANCELLED"],o={DONE:{label:"Done",className:"border-emerald-500/30 bg-emerald-500/15 text-emerald-300"},IN_PROGRESS:{label:"In progress",className:"border-sky-500/30 bg-sky-500/15 text-sky-300"},PENDING:{label:"Pending",className:"border-amber-500/30 bg-amber-500/10 text-amber-200"},BLOCKED:{label:"Blocked",className:"border-orange-500/30 bg-orange-500/15 text-orange-300"},CANCELLED:{label:"Cancelled",className:"border-zinc-500/30 bg-zinc-500/10 text-zinc-400 line-through"},DEPRIORITIZED:{label:"Deprioritized",className:"border-zinc-600/40 bg-zinc-600/10 text-zinc-400"},KEEP:{label:"Keep",className:"border-emerald-500/30 bg-emerald-500/15 text-emerald-300"},REBUILD:{label:"Rebuild",className:"border-violet-500/30 bg-violet-500/15 text-violet-300"},REPLACE:{label:"Replace",className:"border-rose-500/30 bg-rose-500/15 text-rose-300"},DROP:{label:"Drop",className:"border-zinc-500/30 bg-zinc-500/10 text-zinc-400 line-through"}};function i(e){return e?.trim()||"—"}},44267:(e,t,n)=>{n.d(t,{S:()=>a});function a(e,t={}){let n=t.pad??20,r=t.header??26,s=new Map;for(let t of e){let e=s.get(t.group);e?(e.minX=Math.min(e.minX,t.x),e.minY=Math.min(e.minY,t.y),e.maxX=Math.max(e.maxX,t.x+t.w),e.maxY=Math.max(e.maxY,t.y+t.h),e.count++):s.set(t.group,{minX:t.x,minY:t.y,maxX:t.x+t.w,maxY:t.y+t.h,count:1})}return Array.from(s.entries()).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({key:e,label:e,x:t.minX-n,y:t.minY-n-r,w:t.maxX-t.minX+2*n,h:t.maxY-t.minY+2*n+r,count:t.count}))}},45437:(e,t,n)=>{n.d(t,{L:()=>i});var a=n(95155),r=n(81750),s=n(6266),o=n(28736);function i(e){let t=(0,r.JY)(e.target),n=e.targetX,i=e.targetY,l=t?.measured?.width,d=t?.measured?.height;if(t&&l&&d){let a=(0,o.u)({x:t.internals.positionAbsolute.x,y:t.internals.positionAbsolute.y,w:l,h:d},{x:e.sourceX,y:e.sourceY});n=a.x,i=a.y}let[c]=(0,s.ah)({sourceX:e.sourceX,sourceY:e.sourceY,targetX:n,targetY:i});return(0,a.jsx)(r.tE,{id:e.id,path:c,style:e.style,markerEnd:e.markerEnd})}},54698:(e,t,n)=>{n.d(t,{m:()=>a});function a(e,t){let n=[];return e.forEach((e,a)=>{let r=e.excerpt.trim();if(!r)return;let s={annotationId:e.id,n:a+1};for(let e of t.tables){if(r===e.name)return void n.push({...s,kind:"table",targetId:e.id,column:null});if(r.startsWith(`${e.name}.`)){let t=r.slice(e.name.length+1);if(e.columns.includes(t))return void n.push({...s,kind:"column",targetId:e.id,column:t})}}for(let e of t.endpoints??[])if(r===`${e.method} ${e.path}`)return void n.push({...s,kind:"endpoint",targetId:e.id,column:null});for(let e of t.features??[])if(r===e.title||r===`feature: ${e.title}`)return void n.push({...s,kind:"feature",targetId:e.id,column:null})}),n}},56614:(e,t,n)=>{n.d(t,{er:()=>o,r1:()=>i,vu:()=>l});var a=n(95155),r=n(12115),s=n(91337);function o({trigger:e,title:t,align:n="right",children:i,open:l,onOpenChange:d,outsideClicksToClose:c=1}){let[u,m]=(0,r.useState)(!1),[p,x]=(0,r.useState)("down"),h=l??u,f=e=>{void 0===l&&m(e),d?.(e)},g=(0,r.useRef)(null),b=(0,r.useRef)(()=>{});return(0,r.useEffect)(()=>{b.current=()=>f(!1)}),(0,r.useEffect)(()=>{if(!h)return;let e=g.current?.firstElementChild?.getBoundingClientRect();e&&x(window.innerHeight-e.bottom<260?"up":"down")},[h]),(0,r.useEffect)(()=>{if(!h)return;let e=0,t=null,n=()=>{t&&clearTimeout(t),t=null},a=a=>{if(g.current?.contains(a.target)){e=0,n();return}c<=1?b.current():(e+=1)>=c?(e=0,n(),b.current()):(n(),t=setTimeout(()=>{e=0},1500))},r=e=>{"Escape"===e.key&&b.current()};return window.addEventListener("mousedown",a,!0),window.addEventListener("keydown",r),()=>{n(),window.removeEventListener("mousedown",a,!0),window.removeEventListener("keydown",r)}},[h,c]),(0,a.jsxs)("div",{ref:g,className:"relative",children:[e(h,()=>f(!h)),h&&(0,a.jsxs)("div",{className:(0,s.cn)("glass absolute z-30 w-64 rounded-xl p-3 shadow-xl","up"===p?"bottom-full mb-1.5":"top-full mt-1.5","right"===n?"right-0":"left-0"),children:[t&&(0,a.jsx)("div",{className:"mb-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:t}),i]})]})}function i({title:e,children:t}){return(0,a.jsxs)("div",{className:"mb-2.5 last:mb-0",children:[(0,a.jsx)("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/80",children:e}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:t})]})}function l({on:e,onClick:t,children:n,tone:r="default"}){return(0,a.jsx)("button",{type:"button",onClick:t,className:(0,s.cn)("rounded-md border px-2 py-0.5 text-[11px] font-medium transition-colors",{default:e?"border-foreground/40 bg-white/10 text-foreground":"border-white/10 text-muted-foreground hover:text-foreground",danger:e?"border-red-500/40 bg-red-500/15 text-red-300":"border-white/10 text-muted-foreground hover:text-foreground",accent:e?"border-sky-500/40 bg-sky-500/15 text-sky-300":"border-white/10 text-muted-foreground hover:text-foreground"}[r]),children:n})}},56895:(e,t,n)=>{n.d(t,{W:()=>r});var a=n(12115);function r(e,t){let[n,r]=(0,a.useState)(!1),[s,o]=(0,a.useState)(0),i=n?e[s]??null:null,l=(0,a.useCallback)(()=>{o(0),r(!0)},[]),d=(0,a.useCallback)(()=>r(!1),[]),c=(0,a.useCallback)(()=>o(t=>Math.min(t+1,e.length-1)),[e.length]),u=(0,a.useCallback)(()=>o(e=>Math.max(e-1,0)),[]),m=(0,a.useCallback)(t=>{t>=0&&t<e.length&&o(t)},[e.length]);(0,a.useEffect)(()=>{if(!n)return;let a=e[s];a&&t(a)},[n,s]),(0,a.useEffect)(()=>{if(!n)return;let e=e=>{"ArrowRight"===e.key?(e.preventDefault(),c()):"ArrowLeft"===e.key?(e.preventDefault(),u()):"Escape"===e.key&&(e.preventDefault(),d())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n,c,u,d]);let p=(0,a.useMemo)(()=>i&&i.focusIds.length?new Set(i.focusIds):null,[i]);return{active:n,index:s,step:i,start:l,stop:d,next:c,prev:u,goto:m,focusIds:p}}},60292:(e,t,n)=>{n.d(t,{Bz:()=>a,Fj:()=>i,aE:()=>s,dh:()=>o,fk:()=>r,q0:()=>l});let a="beacon:tab-ws";function r(){var e;let t=new URLSearchParams(window.location.search).get("ws"),n=null;try{t&&sessionStorage.setItem(a,t),n=sessionStorage.getItem(a)}catch{}return e=n,t||e||null}function s(e){try{sessionStorage.setItem(a,e)}catch{}}function o(e){return e?{"x-beacon-workspace":e}:{}}function i(e,t,n){let a=new URLSearchParams;for(let[e,r]of(t&&a.set("ws",t),Object.entries(n??{})))a.set(e,r);let r=a.toString();return r?`${e}?${r}`:e}function l(e,t){if(e.startsWith("/api/"))return!0;try{let n=new URL(e,t);return n.origin===t&&n.pathname.startsWith("/api/")}catch{return!1}}},60874:(e,t,n)=>{n.d(t,{F8:()=>b,NG:()=>x,QH:()=>h,Vq:()=>g,aM:()=>j,cV:()=>k,kz:()=>v,n$:()=>m,pO:()=>o,vB:()=>y});var a=n(95155),r=n(12115),s=n(91337);function o({markdown:e,className:t,variant:n="reading"}){let i=(0,r.useMemo)(()=>m(e),[e]),l="reading"===n;return(0,a.jsx)("div",{className:(0,s.cn)("min-w-0 [overflow-wrap:anywhere]",l?"mx-auto w-full max-w-[66ch] space-y-4 text-[15px] leading-[1.6]":"space-y-3.5 text-[13px] leading-relaxed",t),children:i.map((e,t)=>(0,a.jsx)(w,{block:e,variant:n},t))})}function i(e){let t=e.trim();return t.includes("|")&&t.includes("-")&&/^[\s|:-]+$/.test(t)}function l(e){return""!==e.trim()&&e.includes("|")}function d(e){let t=e.trim();return t.startsWith("|")&&(t=t.slice(1)),t.endsWith("|")&&(t=t.slice(0,-1)),t.split("|").map(e=>e.trim())}function c(e){let t=e.trim(),n=t.startsWith(":"),a=t.endsWith(":");return n&&a?"center":a?"right":n?"left":null}let u=/^\s*```[^\s`]*\s*$/;function m(e){let t=e.split("\n"),n=[],a=[],r=()=>{a.length&&(n.push({kind:"p",text:a.join("\n")}),a=[])},s=null,o=()=>{null!==s&&(n.push({kind:"quote",text:s.join("\n")}),s=null)},m=e=>Math.min(6,Math.floor(e.length/2)),p=null,x=null;for(let e=0;e<t.length;e++){let h=t[e];if(null!==p){u.test(h)?(n.push({kind:"code",text:p.join("\n")}),p=null):p.push(h);continue}let f=h.match(/^>\s?(.*)$/);if(f){r(),x=null,(s??=[]).push(f[1]);continue}if(o(),u.test(h)){r(),x=null,p=[];continue}if(/^\s*$/.test(h)){r(),x=null;continue}let g=h.match(/^#### +(.+)$/);if(g){r(),x=null,n.push({kind:"h4",text:g[1]});continue}let b=h.match(/^### +(.+)$/);if(b){r(),x=null,n.push({kind:"h3",text:b[1]});continue}let y=h.match(/^## +(.+)$/);if(y){r(),x=null,n.push({kind:"h2",text:y[1]});continue}let v=h.match(/^# +(.+)$/);if(v){r(),x=null,n.push({kind:"h1",text:v[1]});continue}if(l(h)&&e+1<t.length&&i(t[e+1])){r(),x=null;let a=[d(h)],s=d(t[e+1]).map(c),o=e+2;for(;o<t.length&&l(t[o])&&!i(t[o]);)a.push(d(t[o])),o++;n.push({kind:"table",text:t.slice(e,o).join("\n"),rows:a,align:s}),e=o-1;continue}let j=h.match(/^(\s*)(\d+)\. +(.+)$/);if(j){r(),n.push({kind:"ol",text:j[3],depth:m(j[1]),marker:j[2]}),x=n.length-1;continue}let w=h.match(/^(\s*)- +(.+)$/);if(w){r(),n.push({kind:"ul",text:w[2],depth:m(w[1])}),x=n.length-1;continue}if(null!==x&&0===a.length){n[x].text+=" "+h.trim();continue}a.push(h)}return r(),o(),null!==p&&n.push({kind:"code",text:p.join("\n")}),n}let p=/("(?:\\.|[^"\\])*")(\s*:)?|\b(true|false|null)\b|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g;function x({text:e}){let t=function(e){let t=e.trim();if(!t||"{"!==t[0]&&"["!==t[0])return null;try{return JSON.stringify(JSON.parse(t),null,2)}catch{return null}}(e);return(0,a.jsx)("pre",{className:"overflow-x-auto rounded-lg border border-white/10 bg-white/[0.06] p-3 text-[12px] leading-relaxed",children:(0,a.jsx)("code",{className:"whitespace-pre font-mono [overflow-wrap:normal]",children:t?function(e){let t,n=[],r=0,s=0,o=e=>(0,a.jsx)("span",{className:"text-foreground/45",children:e},s++);for(p.lastIndex=0;null!==(t=p.exec(e));){if(t.index>r&&n.push(o(e.slice(r,t.index))),void 0!==t[1]){let e=void 0!==t[2];n.push((0,a.jsx)("span",{className:e?"text-sky-300":"text-emerald-300/90",children:t[1]},s++)),e&&t[2]&&n.push(o(t[2]))}else void 0!==t[3]?n.push((0,a.jsx)("span",{className:"text-purple-300",children:t[3]},s++)):void 0!==t[4]&&n.push((0,a.jsx)("span",{className:"text-amber-300",children:t[4]},s++));r=p.lastIndex}return r<e.length&&n.push(o(e.slice(r))),n}(t):(0,a.jsx)("span",{className:"text-foreground/85",children:e})})})}function h({block:e}){let t=e.rows??[];if(0===t.length)return null;let[n,...r]=t,o=e.align??[],i=e=>"center"===o[e]?"text-center":"right"===o[e]?"text-right":"text-left";return(0,a.jsx)("div",{className:"overflow-x-auto rounded-lg border border-white/10",children:(0,a.jsxs)("table",{className:"w-full border-collapse text-[13px] [overflow-wrap:normal]",children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{className:"border-b border-white/15 bg-white/[0.04]",children:n.map((e,t)=>(0,a.jsx)("th",{className:(0,s.cn)("whitespace-nowrap px-3 py-1.5 font-semibold text-foreground",i(t)),children:(0,a.jsx)(k,{text:e})},t))})}),(0,a.jsx)("tbody",{children:r.map((e,t)=>(0,a.jsx)("tr",{className:"border-b border-white/5 last:border-0",children:e.map((e,t)=>(0,a.jsx)("td",{className:(0,s.cn)("px-3 py-1.5 align-top text-foreground/90",i(t)),children:(0,a.jsx)(k,{text:e})},t))},t))})]})})}let f=["h1","h2","h3","h4"];function g(e){return f.includes(e)}function b(e){let t=f.indexOf(e);return t<0?0:t}function y(e){return`plan-h-${e}`}function v(e){return e.replace(/[`*]/g,"").trim()}function j(e,t,n,r){let o="reading"===n;switch(e.kind){case"h1":return(0,a.jsx)("h1",{id:r,className:o?"scroll-mt-24 text-xl font-semibold tracking-tight text-foreground":"text-base font-semibold text-foreground",children:t});case"h2":return(0,a.jsx)("h2",{id:r,className:o?"mt-6 scroll-mt-24 border-b border-white/10 pb-1 text-lg font-semibold text-foreground":"mt-3 text-sm font-semibold text-muted-foreground",children:t});case"h3":return(0,a.jsx)("h3",{id:r,className:o?"mt-4 scroll-mt-24 text-base font-semibold text-foreground":"mt-2 text-[13px] font-semibold text-foreground",children:t});case"h4":return(0,a.jsx)("h4",{id:r,className:o?"mt-3 scroll-mt-24 text-sm font-semibold text-muted-foreground":"mt-2 text-[13px] font-semibold text-muted-foreground",children:t});case"ul":case"ol":{let n=e.depth??0;return(0,a.jsxs)("div",{className:(0,s.cn)("flex gap-2",o?"text-foreground/95":"text-foreground/90"),style:{marginLeft:`${.75+1.25*n}rem`},children:[(0,a.jsx)("span",{className:"shrink-0 select-none text-muted-foreground tabular-nums",children:"ol"===e.kind?`${e.marker}.`:"•"}),(0,a.jsx)("span",{className:"min-w-0 flex-1",children:t})]})}case"quote":return(0,a.jsx)("blockquote",{className:(0,s.cn)("whitespace-pre-wrap border-l-2 pl-3 italic",o?"border-white/15 text-foreground/80":"border-white/10 text-foreground/75"),children:t});default:return(0,a.jsx)("p",{className:(0,s.cn)("whitespace-pre-wrap",o?"text-foreground/95":"text-foreground/90"),children:t})}}function w({block:e,variant:t}){return"code"===e.kind?(0,a.jsx)(x,{text:e.text}):"table"===e.kind?(0,a.jsx)(h,{block:e}):(0,a.jsx)(a.Fragment,{children:j(e,(0,a.jsx)(k,{text:e.text}),t)})}function k({text:e}){let t=e.split(/(`[^`]+`|\*\*[\s\S]+?\*\*|\*[^*]+\*)/g);return(0,a.jsx)(a.Fragment,{children:t.map((e,t)=>/^`[^`]+`$/.test(e)?(0,a.jsx)("code",{className:"rounded bg-white/5 px-1 font-mono text-[12px]",children:e.slice(1,-1)},t):/^\*\*[\s\S]+\*\*$/.test(e)?(0,a.jsx)("strong",{className:"font-semibold text-foreground",children:(0,a.jsx)(k,{text:e.slice(2,-2)})},t):/^\*[^*]+\*$/.test(e)?(0,a.jsx)("em",{className:"text-muted-foreground",children:(0,a.jsx)(k,{text:e.slice(1,-1)})},t):(0,a.jsx)("span",{children:e},t))})}},62311:(e,t,n)=>{n.d(t,{Z:()=>x});var a=n(95155),r=n(12115),s=n(98500),o=n.n(s),i=n(25640),l=n(83599),d=n(94192),c=n(34306),u=n(60292),m=n(91337);let p={ROADMAP:i.A,ARCHITECTURE:l.A,FILES:d.A,DATABASE:c.A};function x({tabs:e,active:t}){let[n,s]=(0,r.useState)(null);return(0,r.useEffect)(()=>{s((0,u.fk)())},[]),(0,a.jsx)("div",{className:"flex items-center gap-0.5",children:e.map(e=>{let r,s=e.value===t,i=e.Icon??p[e.value];return(0,a.jsxs)(o(),{href:(r=e.href,n?`${r}${r.includes("?")?"&":"?"}ws=${n}`:r),className:(0,m.cn)("flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[12px] font-medium tracking-tight transition-colors",s?"border-white/10 bg-white/[0.07] text-foreground shadow-[inset_0_1px_0_rgba(255,255,255,0.06)]":"border-transparent text-muted-foreground/80 hover:bg-white/5 hover:text-foreground"),children:[i?(0,a.jsx)(i,{className:(0,m.cn)("size-3",s&&"text-[#ff7a45]")}):null,(0,a.jsx)("span",{children:e.label})]},e.value)})})}},70221:(e,t,n)=>{n.d(t,{fE:()=>s,gt:()=>o,kz:()=>r});let a={far:.3,farExit:.34,mid:.55,midExit:.6},r={far:.12,farExit:.15,mid:.45,midExit:.5},s={far:.2,farExit:.24,mid:.32,midExit:.36};function o(e,t="full",n=a){return e<n.far||"far"===t&&e<n.farExit?"far":e<n.mid||"mid"===t&&e<n.midExit?"mid":"full"}},70521:(e,t,n)=>{n.d(t,{$v:()=>w,EO:()=>b,Lt:()=>x,Rx:()=>k,Zr:()=>N,ck:()=>v,r7:()=>j,tv:()=>h,wd:()=>y});var a=n(95155);n(12115);var r=n(25381),s=n(7121),o=n(51880),i=n(35176),l=n(11248),d=n(82022),c=n(98758),u=n(45362),m=n(91337),p=n(4474);function x({...e}){return(0,a.jsx)(r.V,{"data-slot":"alert-dialog",...e})}function h({...e}){return(0,a.jsx)(s.t,{"data-slot":"alert-dialog-trigger",...e})}function f({...e}){return(0,a.jsx)(o.Z,{"data-slot":"alert-dialog-portal",...e})}function g({className:e,...t}){return(0,a.jsx)(i.X,{"data-slot":"alert-dialog-overlay",className:(0,m.cn)("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function b({className:e,size:t="default",...n}){return(0,a.jsxs)(f,{children:[(0,a.jsx)(g,{}),(0,a.jsx)(l.h,{"data-slot":"alert-dialog-content","data-size":t,className:(0,m.cn)("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...n})]})}function y({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"alert-dialog-header",className:(0,m.cn)("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function v({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"alert-dialog-footer",className:(0,m.cn)("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function j({className:e,...t}){return(0,a.jsx)(d.L,{"data-slot":"alert-dialog-title",className:(0,m.cn)("font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t})}function w({className:e,...t}){return(0,a.jsx)(c.r,{"data-slot":"alert-dialog-description",className:(0,m.cn)("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function k({className:e,variant:t,size:n,...r}){return(0,a.jsx)(u.H,{"data-slot":"alert-dialog-action",className:(0,m.cn)(e),render:(0,a.jsx)(p.$,{variant:t,size:n}),...r})}function N({className:e,variant:t="outline",size:n="default",...r}){return(0,a.jsx)(u.H,{"data-slot":"alert-dialog-cancel",className:(0,m.cn)(e),render:(0,a.jsx)(p.$,{variant:t,size:n}),...r})}},70947:(e,t,n)=>{n.d(t,{Z:()=>i});var a=n(95155),r=n(81750),s=n(12410),o=n(91337);function i({regions:e,tone:t="neutral",lod:n="full"}){let l=(0,r.Pj)(e=>e.transform[2]);if(0===e.length)return null;let d="far"===n,c=Math.min(150,26/Math.max(l,.05)),u=Math.min(80,13/Math.max(l,.05));return(0,a.jsx)(r.DX,{children:e.map(e=>(0,a.jsx)("div",{style:{position:"absolute",transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,pointerEvents:"none",zIndex:0},className:(0,o.cn)("rounded-2xl border","category"===t?(0,s.xZ)(e.key):"border-white/[0.08] bg-white/[0.015]",d&&"bg-card/80"),children:d?(0,a.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-[0.3em] px-2",children:[(0,a.jsx)("span",{className:"whitespace-nowrap text-center font-semibold tracking-tight text-foreground",style:{fontSize:Math.min(c,.34*e.h,(e.w-16)/(.74*Math.max(e.label.length,1))),lineHeight:1.1},children:e.label}),(0,a.jsxs)("span",{className:"tabular-nums text-muted-foreground",style:{fontSize:Math.min(u,.18*e.h)},children:[e.count," ",1===e.count?"card":"cards"]})]}):(0,a.jsxs)("div",{className:"flex items-baseline gap-2 px-3 py-1",children:[(0,a.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground/80",children:e.label}),(0,a.jsx)("span",{className:"text-[10px] tabular-nums text-muted-foreground/50",children:e.count})]})},e.key))})}},74350:(e,t,n)=>{n.d(t,{Cf:()=>g,Es:()=>y,L3:()=>v,c7:()=>b,lG:()=>x,rr:()=>j});var a=n(95155);n(12115);var r=n(17112),s=n(51880),o=n(35176),i=n(11248),l=n(45362),d=n(82022),c=n(98758),u=n(91337),m=n(4474),p=n(9005);function x({...e}){return(0,a.jsx)(r.D,{"data-slot":"dialog",...e})}function h({...e}){return(0,a.jsx)(s.Z,{"data-slot":"dialog-portal",...e})}function f({className:e,...t}){return(0,a.jsx)(o.X,{"data-slot":"dialog-overlay",className:(0,u.cn)("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function g({className:e,children:t,showCloseButton:n=!0,...r}){return(0,a.jsxs)(h,{children:[(0,a.jsx)(f,{}),(0,a.jsxs)(i.h,{"data-slot":"dialog-content",className:(0,u.cn)("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...r,children:[t,n&&(0,a.jsxs)(l.H,{"data-slot":"dialog-close",render:(0,a.jsx)(m.$,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[(0,a.jsx)(p.A,{}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function b({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"dialog-header",className:(0,u.cn)("flex flex-col gap-2",e),...t})}function y({className:e,showCloseButton:t=!1,children:n,...r}){return(0,a.jsxs)("div",{"data-slot":"dialog-footer",className:(0,u.cn)("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...r,children:[n,t&&(0,a.jsx)(l.H,{render:(0,a.jsx)(m.$,{variant:"outline"}),children:"Close"})]})}function v({className:e,...t}){return(0,a.jsx)(d.L,{"data-slot":"dialog-title",className:(0,u.cn)("font-heading text-base leading-none font-medium",e),...t})}function j({className:e,...t}){return(0,a.jsx)(c.r,{"data-slot":"dialog-description",className:(0,u.cn)("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}},82099:(e,t,n)=>{n.d(t,{b:()=>s});var a=n(95155);n(12115);var r=n(91337);function s({className:e,children:t,...n}){return(0,a.jsxs)("div",{className:(0,r.cn)("glass relative isolate overflow-hidden",e),...n,children:[(0,a.jsx)("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 -z-10 rounded-[inherit]",style:{background:"radial-gradient(90% 60% at 0% 0%, oklch(1 0 0 / 0.04), transparent 42%)"}}),(0,a.jsx)("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 -z-10 rounded-[inherit] opacity-[0.035] mix-blend-overlay",style:{backgroundImage:"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")",backgroundSize:"120px 120px"}}),t]})}},91157:(e,t,n)=>{n.d(t,{b:()=>o,d:()=>i});let a=e=>e.slice(e.lastIndexOf("/")+1),r=(e,t)=>t>e?", …":"";function s(e){let t=new Map;for(let n of e)t.set(a(n),(t.get(a(n))??0)+1);return e.map(e=>{let n=a(e);if((t.get(n)??0)<=1)return n;let r=e.slice(0,e.lastIndexOf("/")),s=r.slice(r.lastIndexOf("/")+1);return s?`${s}/${n}`:n})}function o(e,t,n){if(0===e.length)return[];let a=e=>n.get(e)??"(root)",o=new Map;for(let t of e){let e=a(t.path),n=o.get(e);n?n.push(t):o.set(e,[t])}let i=[...o.keys()],l=e=>o.get(e)?.length??0,d=new Map,c=new Map;for(let e of i)d.set(e,new Set),c.set(e,0);let u=new Set;for(let e of t){if(e.circular)continue;let t=a(e.from),n=a(e.to);if(t===n||!d.has(t)||!d.has(n))continue;let r=`${t}\0${n}`;u.has(r)||(u.add(r),d.get(t).add(n),c.set(n,(c.get(n)??0)+1))}let m=(e,t)=>l(t)-l(e)||e.localeCompare(t),p=new Map(c),x=new Set,h=[];for(;h.length<i.length;){let e=i.filter(e=>!x.has(e)&&(p.get(e)??0)===0).sort(m);if(0===e.length){for(let e of i.filter(e=>!x.has(e)).sort((e,t)=>(p.get(e)??0)-(p.get(t)??0)||l(t)-l(e)||e.localeCompare(t)))h.push(e),x.add(e);break}for(let t of e)for(let e of(h.push(t),x.add(t),d.get(t)))p.set(e,(p.get(e)??0)-1)}let f=e.filter(e=>(e.inDegree??0)===0).sort((e,t)=>(t.outDegree??0)-(e.outDegree??0)||e.path.localeCompare(t.path)),g=[];if(g.push({id:"tour:overview",kind:"overview",title:"Project overview",summary:`${e.length} files across ${i.length} ${1===i.length?"area":"areas"} \xb7 ${t.length} imports. Step through the architecture in dependency order — entry points first.`,focusIds:[]}),f.length){let e=s(f.slice(0,4).map(e=>e.path));g.push({id:"tour:entry",kind:"entry",title:"Entry points",summary:`${f.length} file${1===f.length?"":"s"} nothing imports — where execution starts: ${e.join(", ")}${r(4,f.length)}.`,focusIds:f.slice(0,12).map(e=>e.path)})}for(let e of h){let t=o.get(e),n=s([...t].sort((e,t)=>(t.inDegree??0)-(e.inDegree??0)||e.path.localeCompare(t.path)).slice(0,3).map(e=>e.path)),a=[...d.get(e)].sort(m),i=a.length?` \xb7 imports ${a.slice(0,3).join(", ")}${r(3,a.length)}`:" \xb7 no cross-area imports";g.push({id:`tour:group:${e}`,kind:"group",title:e,summary:`${t.length} file${1===t.length?"":"s"}${i} \xb7 top hubs: ${n.join(", ")}.`,focusIds:t.map(e=>e.path)})}return g}function i(e){if(0===e.length)return[];let t=e=>e.cluster?.trim()||"—",n=new Map;for(let a of e){let e=t(a),r=n.get(e);r?r.push(a):n.set(e,[a])}let a=e=>Math.min(...n.get(e).map(e=>e.x??0)),s=[...n.keys()].sort((e,t)=>a(e)-a(t)||e.localeCompare(t)),o=[{id:"tour:overview",kind:"overview",title:"Architecture overview",summary:`${e.length} component${1===e.length?"":"s"} across ${s.length} ${1===s.length?"domain":"domains"}. Walk the architecture domain by domain, upstream first.`,focusIds:[]}];for(let e of s){let t=n.get(e),a=t.slice(0,3).map(e=>e.title?.trim()||e.id);o.push({id:`tour:domain:${e}`,kind:"group",title:e,summary:`${t.length} component${1===t.length?"":"s"}: ${a.join(", ")}${r(3,t.length)}.`,focusIds:t.map(e=>e.id)})}return o}},91337:(e,t,n)=>{n.d(t,{cn:()=>s});var a=n(29722),r=n(622);function s(...e){return(0,r.QP)((0,a.$)(e))}},91588:(e,t,n)=>{n.d(t,{DbMapClient:()=>eg});var a=n(95155),r=n(12115),s=n(73321),o=n(81750),i=n(6266);n(53255);var l=n(32133),d=n(81499),c=n(51128),u=n(65738),m=n(9005),p=n(2125),x=n(91337),h=n(18874);let f=(0,r.createContext)(null);function g(){let e=(0,r.useContext)(f);if(!e)throw Error("useDbEdit must be used inside DbEditContext");return e}var b=n(29523),y=n(70221),v=n(95635),j=n(17918);let w={danger:"bg-red-500/15 text-red-300",warn:"bg-amber-500/15 text-amber-300"};function k({badges:e,className:t}){return e.length?(0,a.jsx)("span",{className:(0,x.cn)("flex shrink-0 items-center gap-0.5",t),children:e.map(e=>(0,a.jsx)("span",{title:e.title,className:(0,x.cn)("rounded px-1 text-[8px] font-semibold uppercase tracking-wide",w[e.tone]),children:e.label},e.label))}):null}let N=/pass(word)?|token|secret|api[_-]?key|credential|priv(ate)?[_-]?key|hash|salt/i,C=/auth|login|logout|session|token|password|oauth|sso|credential/i,E="nodrag nopan",A=v.x;function S({onClick:e,title:t}){return(0,a.jsx)("button",{type:"button",title:t,onClick:t=>{t.stopPropagation(),e()},className:(0,x.cn)(E,"absolute -right-3 top-1/2 z-10 flex size-6 -translate-y-1/2 items-center justify-center rounded-full border border-white/15 bg-[#242428] text-muted-foreground opacity-0 shadow-md transition-all group-hover/row:opacity-100 hover:border-[#ff7a45]/50 hover:text-[#ff7a45]"),children:(0,a.jsx)(l.A,{className:"size-3"})})}function I({c:e,fkTargets:t}){let n=t?.[e.name];return(0,a.jsx)("span",{title:n?`→ ${n}`:e.type,className:"ml-auto min-w-0 truncate font-mono text-[11px] text-muted-foreground/80",children:n?(0,a.jsxs)(a.Fragment,{children:["→\xa0",n]}):e.type})}let M="nodrag nopan",T=["GET","POST","PUT","PATCH","DELETE"];var z=n(54698),R=n(82099),$=n(4474);let D=[{id:"claude",label:"Prompt p/ Claude Code",fn:function(e){let t=["Implement this database schema in this project, following its existing stack and conventions:",""];for(let n of e.tables){let e=`Table \`${n.name}\``+(n.domain?` (domain: ${n.domain})`:"")+(n.description?` — ${n.description}`:"");for(let a of(t.push(e),n.columns)){let e=[a.isPk&&"PK",a.isFk&&"FK",!1===a.nullable&&"NOT NULL"].filter(Boolean).join(", ");t.push(` - ${a.name}: ${a.type}`+(e?` [${e}]`:"")+(a.note?` — ${a.note}`:""))}t.push("")}if(e.relations.length){for(let n of(t.push("Foreign keys:"),e.relations))t.push(` - ${n.fromTable}.${n.fromColumn} -> ${n.toTable}.${n.toColumn}`);t.push("")}return t.push("Create the models/migrations using the project's existing ORM and patterns, wire the relationships, and keep table and column names exactly as given."),t.join("\n")}},{id:"dbml",label:"DBML",fn:function(e){let t=[];for(let n of e.tables){for(let e of(t.push(`Table ${n.name} {`),n.columns)){let n=[e.isPk&&"pk",!1===e.nullable&&!e.isPk&&"not null",e.note&&`note: '${e.note.replace(/'/g,"")}'`].filter(Boolean).join(", ");t.push(` ${e.name} ${e.type}`+(n?` [${n}]`:""))}t.push("}","")}for(let n of e.relations)t.push(`Ref: ${n.fromTable}.${n.fromColumn} > ${n.toTable}.${n.toColumn}`);return t.join("\n").trim()}},{id:"sql",label:"SQL DDL",fn:function(e){let t=[];for(let n of e.tables){t.push(`CREATE TABLE ${n.name} (`);let a=n.columns.map(e=>{let t=[` ${e.name} ${e.type}`];return e.isPk?t.push("PRIMARY KEY"):!1===e.nullable&&t.push("NOT NULL"),t.join(" ")}),r=e.relations.filter(e=>e.fromTable===n.name).map(e=>` FOREIGN KEY (${e.fromColumn}) REFERENCES ${e.toTable}(${e.toColumn})`);t.push([...a,...r].join(",\n")),t.push(");","")}return t.join("\n").trim()}}];function P({draftGraph:e}){let[t,n]=(0,r.useState)(null);if(0===e.tables.length)return null;async function s(t){await navigator.clipboard.writeText(t.fn(e)).catch(()=>{}),n(t.id),setTimeout(()=>n(null),1500)}return(0,a.jsxs)("div",{className:"space-y-2 rounded-xl border border-sky-400/20 bg-sky-500/[0.04] p-3",children:[(0,a.jsxs)("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-sky-300",children:["Rascunho \xb7 ",e.tables.length," tabelas"]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"copiar:"}),D.map(e=>(0,a.jsx)($.$,{size:"sm",variant:"outline",className:"h-6 px-2 text-[11px]",onClick:()=>s(e),children:t===e.id?"✓":e.label},e.id))]})]})}function O({selected:e,tables:t,relations:n,endpoints:r,draftGraph:s,onClose:o,commentsContent:i,commentsCount:d=0,activeTab:c,onTabChange:u,onAddComment:p,topOffset:x}){let h,f,g=new Map(t.map(e=>[e.id,e.name])),b=!!i,y=c??"details",v=e?.kind==="table"?t.find(t=>t.id===e.id)?.name??null:e?.kind==="endpoint"&&(f=r.find(t=>t.id===e.id))?`${f.method} ${f.path}`:null;if(e?.kind==="table"){let s=t.find(t=>t.id===e.id);h=s?(0,a.jsx)(L,{table:s,relations:n,endpoints:r,nameById:g}):null}else if(e?.kind==="endpoint"){let t=r.find(t=>t.id===e.id);h=t?(0,a.jsx)(_,{ep:t,nameById:g}):null}else h=(0,a.jsx)(B,{tables:t,relations:n,endpoints:r});return(0,a.jsxs)(R.b,{className:"absolute right-3 z-10 flex w-80 flex-col rounded-2xl",style:{top:x??12,maxHeight:`calc(100% - ${(x??12)+12}px)`},children:[b?(0,a.jsxs)("div",{className:"flex items-center justify-between border-b border-white/10 px-1 py-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,a.jsx)(F,{active:"details"===y,onClick:()=>u?.("details"),children:"Details"}),(0,a.jsxs)(F,{active:"comments"===y,onClick:()=>u?.("comments"),children:["Comments",d>0&&(0,a.jsx)("span",{className:"ml-1 rounded-full bg-white/10 px-1 text-[9px] font-semibold leading-4",children:d})]})]}),(0,a.jsx)("button",{onClick:o,title:"Close panel",className:"mr-1 rounded-md p-1 text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground",children:(0,a.jsx)(m.A,{className:"size-4"})})]}):(0,a.jsxs)("div",{className:"flex items-center justify-between border-b border-white/10 px-3.5 py-2.5",children:[(0,a.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Panel"}),(0,a.jsx)("button",{onClick:o,title:"Close panel",className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground",children:(0,a.jsx)(m.A,{className:"size-4"})})]}),(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:"comments"===y&&b?(0,a.jsx)("div",{className:"p-3",children:i}):(0,a.jsxs)(a.Fragment,{children:[s.tables.length>0&&(0,a.jsx)("div",{className:"border-b border-white/10 p-3.5",children:(0,a.jsx)(P,{draftGraph:s})}),(0,a.jsxs)("div",{className:"p-4",children:[p&&v&&(0,a.jsxs)("button",{type:"button",onClick:()=>p(v),className:"mb-3 flex w-full items-center justify-center gap-1.5 rounded-lg border border-white/10 bg-white/[0.03] px-3 py-1.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-white/[0.06] hover:text-foreground",children:[(0,a.jsx)(l.A,{className:"size-3.5"}),"Comment on this ",e?.kind==="endpoint"?"endpoint":"table"]}),h]})]})})]})}function F({active:e,onClick:t,children:n}){return(0,a.jsx)("button",{type:"button",onClick:t,className:(0,x.cn)("flex items-center gap-1 rounded-md px-2.5 py-1 text-[11px] font-medium transition-colors",e?"bg-white/10 text-foreground":"text-muted-foreground hover:text-foreground"),children:n})}function L({table:e,relations:t,endpoints:n,nameById:r}){let s=t.filter(t=>t.fromTableId===e.id),o=t.filter(t=>t.toTableId===e.id),i=n.map(t=>({e:t,u:t.tables.find(t=>t.tableId===e.id)})).filter(e=>e.u);return(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-xs uppercase tracking-wide",style:{color:(0,h.qA)(e.domain)},children:e.domain??"table"}),(0,a.jsx)("h2",{className:"font-mono text-lg font-semibold",children:e.name}),e.description&&(0,a.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:e.description})]}),(0,a.jsx)(H,{title:`Columns (${e.columns.length})`,children:(0,a.jsx)("ul",{className:"space-y-0.5",children:e.columns.map(e=>(0,a.jsxs)("li",{className:"flex items-center gap-1.5 text-xs",children:[e.isPk?(0,a.jsx)(d.A,{className:"size-3 text-amber-400"}):e.isFk?(0,a.jsx)(c.A,{className:"size-3 text-sky-400"}):(0,a.jsx)("span",{className:"size-3"}),(0,a.jsx)("span",{className:"font-mono",children:e.name}),(0,a.jsxs)("span",{className:"ml-auto font-mono text-[10px] text-muted-foreground",children:[e.type,!e.nullable&&" \xb7NN"]})]},e.name))})}),s.length>0&&(0,a.jsx)(H,{title:"References (FK out)",children:(0,a.jsx)("ul",{className:"space-y-1 text-xs",children:s.map(e=>(0,a.jsxs)("li",{className:"font-mono text-muted-foreground",children:[e.fromColumn," → ",r.get(e.toTableId),".",e.toColumn]},e.id))})}),o.length>0&&(0,a.jsx)(H,{title:"Referenced by (FK in)",children:(0,a.jsx)("ul",{className:"space-y-1 text-xs",children:o.map(e=>(0,a.jsxs)("li",{className:"font-mono text-muted-foreground",children:[r.get(e.fromTableId),".",e.fromColumn]},e.id))})}),i.length>0&&(0,a.jsx)(H,{title:`Used by endpoints (${i.length})`,children:(0,a.jsx)("ul",{className:"space-y-1 text-xs",children:i.map(({e,u:t})=>(0,a.jsxs)("li",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{style:{color:h.e6[e.method]},className:"font-bold",children:e.method}),(0,a.jsx)("span",{className:"truncate font-mono",children:e.path}),(0,a.jsx)("span",{className:"ml-auto",style:{color:h.ru[t.access]},children:t.access})]},e.id))})})]})}function _({ep:e,nameById:t}){return(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"rounded px-1.5 py-0.5 text-[11px] font-bold",style:{background:`${h.e6[e.method]}22`,color:h.e6[e.method]},children:e.method}),(0,a.jsx)("h2",{className:"mt-2 font-mono text-base font-semibold",children:e.path}),e.description&&(0,a.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:e.description})]}),(0,a.jsx)(H,{title:`Tables used (${e.tables.length})`,children:(0,a.jsx)("ul",{className:"space-y-1 text-xs",children:e.tables.map(e=>(0,a.jsxs)("li",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"font-mono",children:t.get(e.tableId)}),(0,a.jsx)("span",{className:"ml-auto",style:{color:h.ru[e.access]},children:e.access})]},e.tableId))})})]})}function B({tables:e,relations:t,endpoints:n}){return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-sm font-semibold",children:"Database"}),(0,a.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Live schema derived from your code. Click a table or endpoint to see details. Drag to rearrange — positions are saved."})]}),(0,a.jsxs)("dl",{className:"grid grid-cols-3 gap-2 text-center",children:[(0,a.jsx)(U,{label:"tables",value:e.length}),(0,a.jsx)(U,{label:"FKs",value:t.length}),(0,a.jsx)(U,{label:"endpoints",value:n.length})]}),(0,a.jsx)(H,{title:"Legend",children:(0,a.jsxs)("ul",{className:"space-y-1 text-xs text-muted-foreground",children:[(0,a.jsxs)("li",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(d.A,{className:"size-3 text-amber-400"})," primary key"]}),(0,a.jsxs)("li",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(c.A,{className:"size-3 text-sky-400"})," foreign key"]}),(0,a.jsx)("li",{children:"— gray line: FK relation between tables"}),(0,a.jsx)("li",{children:"– – dashed line: endpoint uses table (read/write)"})]})})]})}function H({title:e,children:t}){return(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:e}),t]})}function U({label:e,value:t}){return(0,a.jsxs)("div",{className:"rounded-lg border border-white/10 bg-white/[0.03] py-2",children:[(0,a.jsx)("div",{className:"text-lg font-semibold",children:t}),(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:e})]})}var X=n(56614),G=n(9991),K=n(14983),W=n(62311);let Y=new Set(["GET","HEAD","OPTIONS"]);var Z=n(44267),q=n(94014);function V(e){return 36+30*Math.max(0,e)+16}let J="Unattached",Q=e=>(e??"").trim()||"—";function ee(e,t){let n=new Map(e.map(e=>[e.id,e.name])),a=new Map;for(let e of t)for(let t of e.uses)n.has(t.tableId)&&a.set(t.tableId,(a.get(t.tableId)??0)+1);return new Map(t.map(e=>[e.id,function(e,t,n){let a=new Map;for(let n of e.uses)t.has(n.tableId)&&a.set(n.tableId,(a.get(n.tableId)??0)+1);let r=null;for(let[e,s]of a){if(null===r){r=e;continue}let o=a.get(r);if(s>o){r=e;continue}if(s<o)continue;let i=n?.get(e)??0,l=n?.get(r)??0;i<l?r=e:i===l&&0>t.get(e).localeCompare(t.get(r))&&(r=e)}return r}(e,n,a)]))}let et=(e,t)=>e.path.localeCompare(t.path)||e.method.localeCompare(t.method)||e.id.localeCompare(t.id);var en=n(70947);let ea=e=>e.trim().toLowerCase();var er=n(85618),es=n(80846),eo=n(17356),ei=n(45486),el=n(15330),ed=n(60976),ec=n(64577),eu=n(24692),em=n(45437);let ep={dbTable:function({id:e,data:t,selected:n}){var s;let o,i,l="DRAFT"===t.source,f="added"===t.diffStatus?"#7bd389":"modified"===t.diffStatus?"#ffb86b":"#4ea1ff",w="added"===t.diffStatus?"new":"modified"===t.diffStatus?"modify":"draft",C=t.diffChanges?.length?t.diffChanges.join("\n"):"draft",M=l?f:(0,h.qA)(t.domain),T=(s={domain:t.domain,columns:t.columns},o=[],(i=s.columns.filter(e=>N.test(e.name)).map(e=>e.name)).length&&o.push({label:"secrets",tone:"danger",title:`stores credentials: ${i.join(", ")}`}),s.domain&&/auth/i.test(s.domain)&&o.push({label:"auth",tone:"warn",title:"auth-domain table"}),o),z=g(),[R,$]=(0,r.useState)(t.name),[D,P]=(0,r.useState)(t.columns),[O,F]=(0,r.useState)(!1);(0,r.useEffect)(()=>{$(t.name),P(t.columns)},[t.rev]);let L=e=>e.stopPropagation(),_=t=>{P(t),z.patchTable(e,{columns:t})},B=(t.pins??[]).filter(e=>null===e.column),H=e=>(t.pins??[]).filter(t=>t.column===e),U=function(e,t,n,a=!1){return Math.min(312,Math.max(240,Math.round(8*e.length)+90,...t.map(e=>{if(a)return Math.round(7.3*e.name.length)+146;let t=n?.[e.name]?n[e.name].length+2:e.type.length;return Math.round(7.3*e.name.length+6.7*t)+64})))}(t.name,l?D:t.columns,t.fkTargets,l),X=(0,x.cn)("relative rounded-xl border bg-[#161618]/95 text-card-foreground shadow-[0_18px_50px_-22px_rgba(0,0,0,0.9)] backdrop-blur",n&&"ring-2 ring-[var(--accent,#f5b942)]"),G=(0,b.k)(y.fE);return"full"!==G?(0,a.jsxs)("div",{className:(0,x.cn)(X,"border-white/10 px-3 py-2.5","far"===G&&"!opacity-0"),style:{width:U},children:[(0,a.jsx)(v.x,{}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"inline-block size-2 shrink-0 rounded-full",style:{background:M}}),(0,a.jsx)("span",{className:"truncate font-mono text-[15px] font-semibold",children:t.name})]})]}):l?(0,a.jsxs)("div",{className:(0,x.cn)(X,"group/card"),style:{width:U,borderColor:`${f}59`},children:[(0,a.jsx)(A,{}),(0,a.jsxs)("div",{className:"group/row relative flex items-center gap-1.5 rounded-t-[11px] px-3 py-2",style:{background:`${f}14`},children:[(0,a.jsx)("input",{value:R,onChange:e=>$(e.target.value),onBlur:()=>{let n=R.trim();n&&n!==t.name&&z.patchTable(e,{name:n})},onKeyDown:e=>{L(e),"Enter"===e.key&&e.currentTarget.blur()},placeholder:"table",className:(0,x.cn)(E,"min-w-0 flex-1 bg-transparent font-mono text-[13px] font-semibold tracking-tight outline-none")}),(0,a.jsx)(k,{badges:T}),(0,a.jsx)("span",{title:C,className:"shrink-0 rounded-md border px-1.5 py-px font-mono text-[9px] font-semibold uppercase tracking-[0.14em]",style:{background:`${f}1f`,borderColor:`${f}55`,color:f},children:w}),(0,a.jsx)("button",{type:"button",onClick:t=>{L(t),O?z.deleteTable(e):F(!0)},onBlur:()=>F(!1),title:"Delete table",className:(0,x.cn)(E,"shrink-0 transition-all",O?"text-red-300":"text-muted-foreground opacity-0 hover:text-red-300 group-hover/card:opacity-100"),children:(0,a.jsx)(u.A,{className:"size-3"})}),B.length>0?(0,a.jsx)(j.e0,{pins:B,onPinClick:t.onPinClick}):t.onComment&&(0,a.jsx)(S,{title:`Comment on ${t.name}`,onClick:()=>t.onComment?.(t.name)})]}),(0,a.jsxs)("div",{className:"divide-y divide-white/[0.05]",children:[D.map((e,n)=>{let r=H(e.name),s=t.diffColumns?.[e.name];return(0,a.jsxs)("div",{title:"added"===s?"column being added":"modified"===s?"column changed vs. the live schema":void 0,style:"added"===s?{background:"#7bd38914",boxShadow:"inset 2px 0 0 #7bd389"}:"modified"===s?{background:"#ffb86b14",boxShadow:"inset 2px 0 0 #ffb86b"}:void 0,className:"group/row relative flex items-center gap-1.5 px-3 py-[5px] text-[12px]",children:[(0,a.jsx)("button",{type:"button",onClick:e=>{L(e),_(D.map((e,t)=>t===n?{...e,isPk:!e.isPk}:e))},title:"Primary key",className:(0,x.cn)(E,"shrink-0",e.isPk?"text-amber-300/90":"text-muted-foreground/40 hover:text-amber-300"),children:(0,a.jsx)(d.A,{className:"size-3"})}),(0,a.jsx)("button",{type:"button",onClick:e=>{L(e),_(D.map((e,t)=>t===n?{...e,isFk:!e.isFk}:e))},title:"Foreign key",className:(0,x.cn)(E,"shrink-0",e.isFk?"text-sky-400/80":"text-muted-foreground/40 hover:text-sky-400"),children:(0,a.jsx)(c.A,{className:"size-3"})}),(0,a.jsx)("input",{value:e.name,onChange:e=>P(t=>t.map((t,a)=>a===n?{...t,name:e.target.value}:t)),onBlur:()=>_(D),onKeyDown:L,placeholder:"column",style:{minWidth:`${Math.max(6,e.name.length+1)}ch`},className:(0,x.cn)(E,"flex-1 bg-transparent font-mono outline-none")}),t.fkTargets?.[e.name]?(0,a.jsxs)("span",{title:`→ ${t.fkTargets[e.name]}`,className:"min-w-0 shrink truncate text-right font-mono text-[11px] text-muted-foreground/80",children:["→\xa0",t.fkTargets[e.name]]}):(0,a.jsx)("input",{value:e.type,onChange:e=>P(t=>t.map((t,a)=>a===n?{...t,type:e.target.value}:t)),onBlur:()=>_(D),onKeyDown:L,placeholder:"type",title:e.type,className:(0,x.cn)(E,"w-16 min-w-0 shrink bg-transparent text-right font-mono text-[11px] text-muted-foreground/80 outline-none")}),(0,a.jsx)("button",{type:"button",onClick:e=>{L(e),_(D.filter((e,t)=>t!==n))},title:"Remove column",className:(0,x.cn)(E,"shrink-0 text-muted-foreground/40 opacity-0 transition-opacity hover:text-red-300 group-hover/card:opacity-100"),children:(0,a.jsx)(m.A,{className:"size-3"})}),r.length>0?(0,a.jsx)(j.e0,{pins:r,onPinClick:t.onPinClick}):t.onComment&&(0,a.jsx)(S,{title:`Comment on ${t.name}.${e.name}`,onClick:()=>t.onComment?.(`${t.name}.${e.name}`)})]},n)}),(0,a.jsxs)("button",{type:"button",onClick:e=>{L(e),_([...D,{name:"",type:"text",isPk:!1,isFk:!1,nullable:!0,note:null}])},className:(0,x.cn)(E,"flex w-full items-center gap-1 px-3 py-1.5 text-[10px] text-muted-foreground hover:text-foreground"),children:[(0,a.jsx)(p.A,{className:"size-3"})," column"]})]})]}):(0,a.jsxs)("div",{className:X,style:{width:U,borderColor:`${M}3d`},children:[(0,a.jsx)(A,{}),(0,a.jsxs)("div",{className:"group/row relative flex items-center justify-between rounded-t-[11px] px-3 py-2",style:{background:`${M}14`},children:[(0,a.jsxs)("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 font-mono text-[13px] font-semibold tracking-tight",children:["INTROSPECTION"===t.source&&(0,a.jsx)("span",{title:"live — derived from your code",className:"inline-block size-1.5 shrink-0 rounded-full bg-emerald-400"}),(0,a.jsx)("span",{className:"truncate",title:t.name,children:t.name})]}),(0,a.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:["INTROSPECTION"!==t.source&&(0,a.jsx)("span",{title:"planned — not yet detected in code",className:"shrink-0 rounded-md border border-[#f5b942]/35 bg-[#f5b942]/10 px-1.5 py-px font-mono text-[9px] font-semibold uppercase tracking-[0.14em] text-[#f5b942]",children:"planned"}),(0,a.jsx)(k,{badges:T}),t.domain&&(0,a.jsx)("span",{className:"text-[9px] uppercase tracking-[0.14em]",style:{color:M},children:t.domain})]}),B.length>0?(0,a.jsx)(j.e0,{pins:B,onPinClick:t.onPinClick}):t.onComment&&(0,a.jsx)(S,{title:`Comment on ${t.name}`,onClick:()=>t.onComment?.(t.name)})]}),(0,a.jsx)("div",{className:"divide-y divide-white/[0.05]",children:t.columns.map(e=>{let n=H(e.name);return(0,a.jsxs)("div",{className:"group/row relative flex items-center gap-2 px-3 py-[7px] text-[12px]",children:[e.isPk?(0,a.jsx)(d.A,{className:"size-3 shrink-0 text-amber-300/90"}):e.isFk?(0,a.jsx)(c.A,{className:"size-3 shrink-0 text-sky-400/80"}):(0,a.jsx)("span",{className:"size-3 shrink-0"}),(0,a.jsx)("span",{className:"shrink-0 whitespace-nowrap font-mono",children:e.name}),(0,a.jsx)(I,{c:e,fkTargets:t.fkTargets}),n.length>0?(0,a.jsx)(j.e0,{pins:n,onPinClick:t.onPinClick}):t.onComment&&(0,a.jsx)(S,{title:`Comment on ${t.name}.${e.name}`,onClick:()=>t.onComment?.(`${t.name}.${e.name}`)})]},e.name)})})]})},endpoint:function({id:e,data:t,selected:n}){var s;let o,i=h.e6[t.method]??"#8a8a8a",d="DRAFT"===t.source,c="added"===t.diffStatus?"#7bd389":"modified"===t.diffStatus?"#ffb86b":"#4ea1ff",m="added"===t.diffStatus?"new":"modified"===t.diffStatus?"changed":"draft",p=t.diffChanges?.length?t.diffChanges.join("\n"):"draft",f=(s={method:t.method,domain:t.domain,path:t.path},o=[],/^delete$/i.test(s.method.trim())&&o.push({label:"DELETE",tone:"danger",title:"destructive: deletes data"}),(s.domain&&/auth/i.test(s.domain)||C.test(s.path))&&o.push({label:"auth",tone:"warn",title:"auth-related endpoint"}),o),w=g(),[N,E]=(0,r.useState)(t.path),[A,S]=(0,r.useState)(!1);(0,r.useEffect)(()=>{E(t.path)},[t.rev]);let I=e=>e.stopPropagation(),z=(0,b.k)(y.fE);return"full"!==z?(0,a.jsxs)("div",{className:(0,x.cn)("relative flex w-[300px] items-center gap-2 rounded-lg border border-white/10 bg-[#161618]/95 px-2.5 py-2 text-card-foreground backdrop-blur",n&&"ring-2 ring-[var(--accent,#f5b942)]","far"===z&&"!opacity-0"),children:[(0,a.jsx)(v.x,{}),(0,a.jsx)("span",{className:"shrink-0 font-mono text-[12px] font-bold",style:{color:i},children:t.method}),(0,a.jsx)("span",{title:t.path,className:"truncate font-mono text-[13px]",children:t.path})]}):(0,a.jsxs)("div",{className:(0,x.cn)("group relative flex w-[300px] items-center gap-2 rounded-lg border bg-[#161618]/95 px-2.5 py-1.5 text-card-foreground shadow-[0_12px_36px_-18px_rgba(0,0,0,0.9)] backdrop-blur",d?"border-dashed":"border-white/10",n&&"ring-2 ring-[var(--accent,#f5b942)]"),style:d?{borderColor:`${c}66`,background:`${c}0f`}:void 0,children:[(0,a.jsx)(v.x,{}),"INTROSPECTION"===t.source&&(0,a.jsx)("span",{title:"live — derived from your code",className:"inline-block size-1.5 shrink-0 rounded-full bg-emerald-400"}),d?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("select",{value:t.method,onChange:t=>w.patchEndpoint(e,{method:t.target.value}),onPointerDown:I,className:(0,x.cn)(M,"shrink-0 rounded bg-transparent text-[10px] font-bold outline-none"),style:{color:i},title:"Method",children:T.map(e=>(0,a.jsx)("option",{value:e,className:"bg-card text-foreground",children:e},e))}),(0,a.jsx)("input",{value:N,title:N,onChange:e=>E(e.target.value),onBlur:()=>{let n=N.trim();n&&n!==t.path&&w.patchEndpoint(e,{path:n})},onKeyDown:e=>{I(e),"Enter"===e.key&&e.currentTarget.blur()},className:(0,x.cn)(M,"min-w-0 flex-1 bg-transparent font-mono text-[11px] outline-none")}),(0,a.jsx)(k,{badges:f}),(0,a.jsx)("span",{title:p,className:"shrink-0 rounded px-1 py-0.5 text-[8px] font-semibold uppercase",style:{background:`${c}26`,color:c},children:m}),(0,a.jsx)("button",{type:"button",onClick:t=>{I(t),A?w.deleteEndpoint(e):S(!0)},onBlur:()=>S(!1),title:"Delete",className:(0,x.cn)(M,"shrink-0 transition-colors",A?"text-red-300":"text-muted-foreground hover:text-red-300"),children:(0,a.jsx)(u.A,{className:"size-3"})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"rounded px-1.5 py-0.5 text-[10px] font-bold",style:{background:`${i}22`,color:i},children:t.method}),(0,a.jsx)("span",{title:t.path,className:"min-w-0 flex-1 break-all font-mono text-[11px] leading-tight [-webkit-box-orient:vertical] [-webkit-line-clamp:2] [display:-webkit-box] overflow-hidden",children:t.path}),"INTROSPECTION"!==t.source&&(0,a.jsx)("span",{title:"planned — not yet detected in code",className:"shrink-0 rounded-md border border-[#f5b942]/35 bg-[#f5b942]/10 px-1.5 py-px font-mono text-[8px] font-semibold uppercase tracking-[0.14em] text-[#f5b942]",children:"planned"}),(0,a.jsx)(k,{badges:f}),(0,a.jsx)("button",{type:"button",onClick:t=>{I(t),A?w.deleteRealEndpoint(e):S(!0)},onBlur:()=>S(!1),title:A?"Click again to delete":"Delete endpoint",className:(0,x.cn)(M,"shrink-0 opacity-0 transition-opacity group-hover:opacity-100",A?"text-red-300 opacity-100":"text-muted-foreground hover:text-red-300"),children:(0,a.jsx)(u.A,{className:"size-3"})})]}),(t.pins?.length??0)>0?(0,a.jsx)(j.e0,{pins:t.pins,onPinClick:t.onPinClick}):t.onComment&&(0,a.jsx)("button",{type:"button",title:`Comment on ${t.method} ${t.path}`,onClick:e=>{I(e),t.onComment?.(`${t.method} ${t.path}`)},className:(0,x.cn)(M,"absolute -right-3 top-1/2 z-10 flex size-6 -translate-y-1/2 items-center justify-center rounded-full border border-white/15 bg-[#242428] text-muted-foreground opacity-0 shadow-md transition-all group-hover:opacity-100 hover:border-[#ff7a45]/50 hover:text-[#ff7a45]"),children:(0,a.jsx)(l.A,{className:"size-3"})})]})},annotation:j.Sh},ex={deletable:eu.I,annotation:em.L},eh="beacon:db-draft",ef={proposedAt:0,status:"pending",tables:[],relations:[],endpoints:[]};function eg({tables:e,relations:t,endpoints:n,draft:l,workspaceId:d,embedded:c=!1,diffBase:m,draftRef:p,onEdit:g,controlRef:v,commentsContent:w,commentsCount:k=0,onAddComment:N,annotations:C,onPinClick:E,onUpdateComment:A,onRemoveComment:S,boardAnnotations:I,readOnly:M=!1}){let T=(0,s.useRouter)(),R=e.length+(l?.tables.length??0),$=n.length+(l?.endpoints.length??0),[D,P]=(0,r.useState)($>0&&(c||0===R)),[F,L]=(0,r.useState)(null),[_,B]=(0,r.useState)(null),[H,U]=(0,r.useState)(null),[eu,em]=(0,r.useState)(!1),[eb,ey]=(0,r.useState)("details"),[ev,ej]=(0,r.useState)(!1),[ew,ek]=(0,r.useState)(""),eN=(0,r.useRef)(null);(0,r.useEffect)(()=>{if(!M)return;let e=0,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>eN.current?.fitView({padding:.2,duration:0}))});return()=>{cancelAnimationFrame(t),cancelAnimationFrame(e)}},[M,l,D]),(0,r.useEffect)(()=>{if(v)return v.current={open:()=>{em(!0),ey("details")},close:()=>{em(!1),ey("details")},openComments:()=>{em(!0),ey("comments")}},()=>{v&&(v.current=null)}},[v]);let[eC,eE]=(0,r.useState)(new Set),[eA,eS]=(0,r.useState)("full"),[eI,eM]=(0,r.useState)(new Set),[eT,ez]=(0,r.useState)(new Set),[eR,e$]=(0,r.useState)(()=>({past:[],present:l??ef,future:[],rev:0,edited:!1})),eD=eR.present,eP=(0,r.useCallback)(e=>{e$(t=>{let n=e(t.present);return n===t.present?t:{past:[...t.past,t.present].slice(-100),present:n,future:[],rev:t.rev+1,edited:!0}})},[]),eO=(0,r.useCallback)(e=>{e$(t=>{let n=e(t.present);return n===t.present?t:{...t,present:n}})},[]),eF=(0,r.useCallback)(()=>e$(e=>e.past.length?{past:e.past.slice(0,-1),present:e.past[e.past.length-1],future:[e.present,...e.future],rev:e.rev+1,edited:!0}:e),[]),eL=(0,r.useCallback)(()=>e$(e=>e.future.length?{past:[...e.past,e.present],present:e.future[0],future:e.future.slice(1),rev:e.rev+1,edited:!0}:e),[]),e_=(0,r.useCallback)(e=>e$(t=>({past:[],present:e,future:[],rev:t.rev+1,edited:!1})),[]),eB=(0,r.useRef)(!1),eH=l?.proposedAt??0;(0,r.useEffect)(()=>{let e=null;if(eB.current)l&&l.proposedAt!==eD.proposedAt?e=l:!l&&(eD.tables.length>0||eD.endpoints.length>0)&&(e=ef);else{eB.current=!0;let t=null;try{let e=localStorage.getItem(eh);if(e){let n=JSON.parse(e);n.workspaceId===d&&n.doc&&l&&n.doc.proposedAt===l.proposedAt&&(t=n.doc)}}catch{}e=t??l??null}e&&e_(e)},[eH]),(0,r.useEffect)(()=>{try{eD.tables.length>0||eD.endpoints.length>0?localStorage.setItem(eh,JSON.stringify({workspaceId:d,doc:eD})):localStorage.removeItem(eh)}catch{}},[eD,d]),(0,r.useEffect)(()=>{p&&(p.current=eD)},[p,eD]);let eU=(0,r.useRef)(!1);(0,r.useEffect)(()=>{eR.edited&&!eU.current&&(eU.current=!0,g?.())},[eR.edited,g]);let eX=(0,r.useMemo)(()=>eD.tables.map(e=>({id:e.id,name:e.name,domain:e.domain,description:e.description,source:"DRAFT",x:e.x,y:e.y,columns:e.columns})),[eD]),eG=(0,r.useMemo)(()=>eD.endpoints.map(e=>({id:e.id,method:e.method,path:e.path,domain:e.domain,description:e.description,source:"DRAFT",x:e.x,y:e.y,tables:e.links.map(e=>({tableId:e.tableId,access:e.access}))})),[eD]),eK=(0,r.useMemo)(()=>[...e,...eX],[e,eX]),eW=(0,r.useMemo)(()=>[...n,...eG],[n,eG]),eY=(0,r.useMemo)(()=>(function(e,t,n={}){let a=ee(e,t),r=new Map,s=[];for(let e of[...t].sort(et)){let t=a.get(e.id)??null;if(t){let n=r.get(t);n?n.push(e):r.set(t,[e])}else s.push(e)}let o=e=>{let t=r.get(e.id)?.length??0;return V(e.columnCount)+(t?10+60*t:0)+30},i=Array.from(new Set(e.map(e=>Q(e.domain)))),l=i.filter(e=>"—"!==e).sort(),d=i.includes("—")?[...l,"—"]:l,c=[];for(let t of d){let n=e.filter(e=>Q(e.domain)===t).sort((e,t)=>e.name.localeCompare(t.name)),a=n.reduce((e,t)=>e+o(t),0),r=Math.max(1,Math.min(12,n.length,Math.round(Math.sqrt(a/320)))),s=Array(r).fill(0),i=new Map;for(let e of n){let t=0;for(let e=1;e<r;e++)s[e]<s[t]&&(t=e);i.set(e.id,{x:320*t,y:s[t]}),s[t]+=o(e)}c.push({d:t,w:320*r,h:Math.max(...s,0),tableLocal:i})}let u=(0,q.Xi)(c.map(e=>({id:e.d,w:e.w,h:e.h})),{gapX:84,gapY:72,viewportAspect:n.viewportAspect,minBandW:960,aspectSlack:1.7}),m=new Map,p=new Map,x=0;for(let t of c){let n=u.get(t.d);for(let a of e.filter(e=>t.tableLocal.has(e.id))){let e=t.tableLocal.get(a.id),s=n.x+e.x,o=n.y+e.y;m.set(a.id,{x:s,y:o}),(r.get(a.id)??[]).forEach((e,t)=>{p.set(e.id,{x:s,y:o+V(a.columnCount)+10+60*t})})}x=Math.max(x,n.y+t.h)}if(s.length){let e=x+72,t=Math.max(1,Math.min(4,Math.ceil(Math.sqrt(s.length/2))));s.forEach((n,a)=>{p.set(n.id,{x:a%t*300,y:e+60*Math.floor(a/t)})})}return{tables:m,endpoints:p}})(eK.map(e=>({id:e.id,name:e.name,domain:e.domain,columnCount:e.columns.length})),[]).tables,[eK]),eZ=(0,r.useMemo)(()=>new Map,[]),eq=(0,r.useMemo)(()=>c?function(e,t){let n=new Map(e.map(e=>[ea(e.name),e])),a=new Map;for(let e of t){let t=n.get(ea(e.name));if(!t){a.set(e.id,{status:"added",changes:["new table"],columns:{}});continue}let{changes:r,columns:s}=function(e,t){let n=new Map(e.map(e=>[ea(e.name),e])),a=new Set(t.map(e=>ea(e.name))),r=[],s={};for(let e of t){let t=n.get(ea(e.name));if(!t){r.push(`+ column ${e.name} (${e.type})`),s[e.name]="added";continue}let a=[];ea(t.type)!==ea(e.type)&&a.push(`type ${t.type}→${e.type}`),t.isPk!==e.isPk&&a.push(e.isPk?"now PK":"no longer PK"),t.isFk!==e.isFk&&a.push(e.isFk?"now FK":"no longer FK"),t.nullable!==e.nullable&&a.push(e.nullable?"now nullable":"now required"),a.length&&(r.push(`~ column ${e.name}: ${a.join(", ")}`),s[e.name]="modified")}for(let t of e)a.has(ea(t.name))||r.push(`- column ${t.name}`);return{changes:r,columns:s}}(t.columns,e.columns);a.set(e.id,{status:r.length?"modified":"unchanged",changes:r,columns:s})}return a}(m?.tables??e,eX):eZ,[c,m,e,eX,eZ]),eV=(0,r.useMemo)(()=>c?function(e,t){let n=e=>`${ea(e.method)} ${ea(e.path)}`,a=new Set(e.map(n)),r=new Map;for(let e of t)r.set(e.id,a.has(n(e))?{status:"unchanged",changes:[],columns:{}}:{status:"added",changes:["new endpoint"],columns:{}});return r}(m?.endpoints??n,eG):eZ,[c,m,n,eG,eZ]),eJ=(0,r.useMemo)(()=>[...t,...eD.relations.map(e=>({id:e.id,fromTableId:e.fromTableId,toTableId:e.toTableId,fromColumn:e.fromColumn,toColumn:e.toColumn,label:e.label}))],[t,eD.relations]),eQ=(0,r.useMemo)(()=>{let e=new Map;for(let t of eW)for(let n of t.tables)e.set(n.tableId,(e.get(n.tableId)??0)+1);return e},[eW]),e0=(0,r.useMemo)(()=>{let e=new Map;return eK.forEach(t=>e.set(t.id,t.x)),eW.forEach(t=>e.set(t.id,t.x)),e},[eK,eW]),e1=(0,r.useMemo)(()=>{let e=new Map;return eK.forEach(t=>e.set(t.id,t.y)),eW.forEach(t=>e.set(t.id,t.y)),e},[eK,eW]),e5=(0,r.useMemo)(()=>{let e=new Map(eK.map(e=>[e.id,e.name])),t=new Map;for(let n of eJ){let a=e.get(n.toTableId);if(!a)continue;let r=t.get(n.fromTableId)??{};r[n.fromColumn]=a,t.set(n.fromTableId,r)}return t},[eJ,eK]),e2=void 0!==I,[e3,e4]=(0,r.useState)(I??[]);(0,r.useEffect)(()=>{I&&e4(I)},[I]);let e6=(0,r.useMemo)(()=>({tables:eK.map(e=>({id:e.id,name:e.name,columns:e.columns.map(e=>e.name)})),endpoints:eW.map(e=>({id:e.id,method:e.method,path:e.path}))}),[eK,eW]),e9=(0,r.useMemo)(()=>{if(e2){let e=new Set([...eK.map(e=>e.id),...eW.map(e=>e.id)]);return e3.filter(t=>e.has(t.targetId)).map((e,t)=>({id:e.id,n:t+1,targetId:e.targetId,column:e.columnName,text:e.body,x:e.x,y:e.y}))}let e=new Map((C??[]).map(e=>[e.id,e.comment]));return(0,z.m)(C??[],e6).map(t=>({id:t.annotationId,n:t.n,targetId:t.targetId,column:t.column,text:e.get(t.annotationId)??"",x:null,y:null}))},[e2,e3,C,e6,eK,eW]),e8=(0,r.useMemo)(()=>{let e=new Map;for(let t of e9){let n=e.get(t.targetId)??[];n.push({id:t.id,n:t.n,column:t.column}),e.set(t.targetId,n)}return e},[e9]),e7=(0,r.useMemo)(()=>new Map(e9.map(e=>[`anno-${e.id}`,e.targetId])),[e9]),te=(0,r.useCallback)(async e=>{let t=(0,z.m)([{id:"_",excerpt:e}],e6)[0];if(!t)return;let n=await fetch("/api/board-annotations",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({targetKind:t.kind,targetId:t.targetId,columnName:t.column??void 0})});if(n.ok){let e=await n.json();e4(t=>[...t,e])}},[e6]),tt=(0,r.useCallback)((e,t)=>{e4(n=>n.map(n=>n.id===e?{...n,...t}:n)),fetch(`/api/board-annotations/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)})},[]),tn=(0,r.useCallback)(e=>{e4(t=>t.filter(t=>t.id!==e)),fetch(`/api/board-annotations/${e}`,{method:"DELETE"})},[]),ta=e2?te:N,tr=(0,r.useCallback)((e,t)=>{let n=(e0.get(t)??0)-(e0.get(e)??0),a=(e1.get(t)??0)-(e1.get(e)??0);return Math.abs(n)>=Math.abs(a)?n>=0?{sourceHandle:"sr",targetHandle:"tl"}:{sourceHandle:"sl",targetHandle:"tr"}:a>=0?{sourceHandle:"sb",targetHandle:"tt"}:{sourceHandle:"st",targetHandle:"tb"}},[e0,e1]),ts=(0,r.useMemo)(()=>new Set([...eD.tables.map(e=>e.id),...eD.endpoints.map(e=>e.id)]),[eD]),to=(0,r.useMemo)(()=>new Set(e.map(e=>e.id)),[e]),ti=(0,r.useCallback)(()=>{let e=eK.map(e=>({id:e.id,type:"dbTable",position:D?{x:e.x,y:e.y}:eY.get(e.id)??{x:e.x,y:e.y},data:{name:e.name,domain:e.domain,columns:e.columns,usageCount:eQ.get(e.id)??0,source:e.source,rev:eR.rev,diffStatus:eq.get(e.id)?.status,diffChanges:eq.get(e.id)?.changes,diffColumns:eq.get(e.id)?.columns,fkTargets:e5.get(e.id),pins:e8.get(e.id),onPinClick:E,onComment:ta}})),t=eW.map(e=>({id:e.id,type:"endpoint",position:{x:e.x,y:e.y},data:{method:e.method,path:e.path,domain:e.domain,source:e.source,rev:eR.rev,diffStatus:eV.get(e.id)?.status,diffChanges:eV.get(e.id)?.changes,pins:e8.get(e.id),onPinClick:E,onComment:ta}})),n=new Map,a=new Map(eK.map(e=>[e.id,e])),r=new Map(eW.map(e=>[e.id,e]));return[...e,...t,...e9.map(e=>{let t=a.get(e.targetId),s=r.get(e.targetId),o=t?.x??s?.x??0,i=t?.y??s?.y??0,l=t?38+28*t.columns.length:42,d=n.get(e.targetId)??0;return n.set(e.targetId,d+1),{id:`anno-${e.id}`,type:"annotation",position:{x:e.x??o+26,y:e.y??i+l+64+112*d},data:{n:e.n,text:e.text,annotationId:e.id,onClick:e2||A?void 0:E,editable:e2||!!A,onChangeText:e2?(e,t)=>tt(e,{body:t}):A,onDelete:e2?tn:S}}})]},[eK,eW,D,eY,eQ,eR.rev,eq,eV,e5,e8,e9,e2,E,A,S,ta,tt,tn]),[tl,td,tc]=(0,o.ck)(ti()),tu=(0,r.useRef)(D);(0,r.useEffect)(()=>{let e=tu.current!==D;tu.current=D,td(t=>{let n=new Map(t.map(e=>[e.id,e.position]));return ti().map(t=>e&&"dbTable"===t.type?t:{...t,position:n.get(t.id)??t.position})}),e&&requestAnimationFrame(()=>eN.current?.fitView({duration:500,padding:.15,minZoom:.2,maxZoom:.9}))},[ti,td,D]);let tm=(0,r.useCallback)((e,t,n,a)=>{fetch("/api/db/position",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({kind:e,id:t,x:n,y:a})})},[]),tp=(0,r.useCallback)((e,t)=>{let{x:n,y:a}=t.position;if(t.id.startsWith("anno-")){e2&&tt(t.id.slice(5),{x:n,y:a});return}ts.has(t.id)?eO(e=>e.tables.some(e=>e.id===t.id)?{...e,tables:e.tables.map(e=>e.id===t.id?{...e,x:n,y:a}:e)}:e.endpoints.some(e=>e.id===t.id)?{...e,endpoints:e.endpoints.map(e=>e.id===t.id?{...e,x:n,y:a}:e)}:e):tm("endpoint"===t.type?"endpoint":"table",t.id,n,a)},[ts,eO,tm,e2,tt]),tx=(0,r.useMemo)(()=>eJ.map(e=>({id:`fk-${e.id}`,source:e.fromTableId,target:e.toTableId,...tr(e.fromTableId,e.toTableId),type:"deletable",label:e.label??void 0,markerEnd:{type:i.TG.ArrowClosed,color:"#6b6b6b"},style:{stroke:"#6b6b6b"}})),[eJ,tr]),th=(0,r.useMemo)(()=>eW.flatMap(e=>e.tables.map(t=>{let n=h.ru[t.access]??"#5a5a5a";return{id:`u-${e.id}-${t.tableId}`,source:e.id,target:t.tableId,...tr(e.id,t.tableId),type:"default",markerEnd:{type:i.TG.ArrowClosed,color:n},style:{stroke:n,strokeDasharray:"4 4",opacity:.7}}})),[eW,tr]),tf=(0,r.useMemo)(()=>D?[...tx,...th]:tx,[tx,th,D]),tg=(0,r.useMemo)(()=>e9.map(e=>({id:`annoe-${e.id}`,source:e.targetId,sourceHandle:`pin-${e.id}`,target:`anno-${e.id}`,targetHandle:"in",type:"annotation",selectable:!1,zIndex:30,style:{stroke:j.V5,strokeWidth:1.5,opacity:.9}})),[e9]),tb=F?.id??H,ty=(0,r.useMemo)(()=>{if(_){let e=tf.find(e=>e.id===_);return e?new Set([e.source,e.target]):null}return tb?(0,h.F1)(tb,tf):null},[tb,_,tf]),tv=(0,r.useMemo)(()=>new Map(eK.map(e=>[e.id,{domain:e.domain,source:e.source}])),[eK]),tj=(0,r.useMemo)(()=>new Map(eW.map(e=>[e.id,{method:e.method,source:e.source}])),[eW]),tw=(0,r.useMemo)(()=>{let e=new Set;if(!D)for(let t of tj.keys())e.add(t);for(let[t,n]of tv)!eC.size||n.domain&&eC.has(n.domain)||e.add(t),eI.size&&!eI.has(n.source)&&e.add(t);for(let[t,n]of tj)eT.size&&!eT.has(n.method)&&e.add(t),eI.size&&!eI.has(n.source)&&e.add(t);return e},[D,tv,tj,eC,eI,eT]),tk=ew.trim().length>0,tN=(0,r.useMemo)(()=>{if(!tk)return null;let e=new Set;for(let t of eK)!tw.has(t.id)&&(0,K.Qk)((0,K.jF)(t),ew)&&e.add(t.id);for(let t of eW)!tw.has(t.id)&&(0,K.Qk)((0,K.sQ)(t),ew)&&e.add(t.id);return e},[eK,eW,tw,ew,tk]),tC=(0,r.useMemo)(()=>tk?[...(0,K.r2)(eK.filter(e=>!tw.has(e.id)),ew,e=>(0,K.jF)(e),e=>({id:e.id,label:e.name,sublabel:e.domain??"table",kind:"table"})),...(0,K.r2)(eW.filter(e=>!tw.has(e.id)),ew,e=>(0,K.sQ)(e),e=>({id:e.id,label:e.path,sublabel:e.method,kind:"endpoint"}))].slice(0,12):[],[eK,eW,tw,ew,tk]),tE=(0,r.useCallback)(e=>{ek(""),L(tj.has(e)?{id:e,kind:"endpoint"}:{id:e,kind:"table"}),B(null),em(!0),ey("details");let t=eN.current?.getNode(e);if(!t||!eN.current)return;let n=t.measured?.width??220,a=t.measured?.height??80;eN.current.setCenter(t.position.x+n/2,t.position.y+a/2,{zoom:.9,duration:600})},[tj]),tA=tN??ty,tS=(0,r.useMemo)(()=>tl.map(e=>{if(e.id.startsWith("anno-")){let t=e7.get(e.id),n=!!t&&tw.has(t);return!!e.hidden!==n?{...e,hidden:n}:e}let t=tw.has(e.id);if(!tA)return t?{...e,hidden:t}:e;let n=tA.has(e.id),a=tN?K.Uy:.45;return{...e,hidden:t,style:{...e.style,opacity:n?1:a,boxShadow:n&&tN?K.RU:e.style?.boxShadow,borderRadius:n&&tN?12:e.style?.borderRadius,transition:"opacity 120ms, box-shadow 120ms"}}}),[tl,tw,tA,tN,e7]),tI=(0,r.useMemo)(()=>{let e=new Map(eK.map(e=>[e.id,(e.domain??"").trim()||"—"])),t=ee(eK,eW.map(e=>({id:e.id,method:e.method,path:e.path,uses:e.tables.map(e=>({tableId:e.tableId}))})));return new Map(eW.map(n=>{let a=t.get(n.id);return[n.id,a?e.get(a):J]}))},[eK,eW]),tM=(0,r.useMemo)(()=>{let e=[];for(let t of tl)if(!tw.has(t.id))if("dbTable"===t.type){let n=t.data;e.push({id:t.id,group:(n.domain??"").trim()||"—",x:t.position.x,y:t.position.y,w:t.measured?.width??280,h:t.measured?.height??38+28*n.columns.length})}else"endpoint"===t.type&&e.push({id:t.id,group:tI.get(t.id)??J,x:t.position.x,y:t.position.y,w:t.measured?.width??240,h:t.measured?.height??50});return(0,Z.S)(e)},[tl,tw,tI]),tT=(0,r.useMemo)(()=>tN?tf.map(e=>{let t=tw.has(e.source)||tw.has(e.target);return tN.has(e.source)&&tN.has(e.target)?{...e,hidden:t,style:{...e.style,opacity:1}}:{...e,hidden:t,label:void 0,style:{...e.style,opacity:.08}}}):tf.map(e=>{let t=tw.has(e.source)||tw.has(e.target);return tb||_?(_?e.id===_:tb&&(e.source===tb||e.target===tb))?{...e,hidden:t,zIndex:20,style:{...e.style,opacity:1,strokeWidth:2.5}}:{...e,hidden:t,selectable:!1,label:void 0,markerEnd:void 0,style:{...e.style,opacity:.08}}:{...e,hidden:t,label:void 0}}),[tf,tb,_,tw,tN]),tz=(0,r.useMemo)(()=>Array.from(new Set(eK.map(e=>e.domain).filter(e=>!!e))).sort(),[eK]),tR=(0,r.useMemo)(()=>Array.from(new Set([...eK.map(e=>e.source),...eW.map(e=>e.source)])).sort(),[eK,eW]),t$=(0,r.useMemo)(()=>Array.from(new Set(eW.map(e=>e.method))).sort(),[eW]);function tD(e,t){t(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}let tP=+!D+eC.size+eI.size+eT.size,tO=(0,r.useCallback)(()=>{P(!0),eE(new Set),eM(new Set),ez(new Set)},[]),tF=(0,r.useCallback)(e=>{let{source:t,target:n}=e;t&&n&&t!==n&&eP(e=>{if(!(e.tables.some(e=>e.id===n)||to.has(n)))return e;let a=e.endpoints.find(e=>e.id===t);return a?a.links.some(e=>e.tableId===n)?e:{...e,endpoints:e.endpoints.map(e=>{var a;return e.id===t?{...e,links:[...e.links,{tableId:n,access:(a=e.method,Y.has(a.trim().toUpperCase())?"read":"write")}]}:e})}:e.tables.find(e=>e.id===t)?e.relations.some(e=>e.fromTableId===t&&e.toTableId===n)?e:{...e,relations:[...e.relations,{id:crypto.randomUUID(),fromTableId:t,toTableId:n,fromColumn:"fk",toColumn:"id",label:null}]}:e})},[eP,to]),tL=(0,r.useMemo)(()=>({patchEndpoint:(e,t)=>eP(n=>({...n,endpoints:n.endpoints.map(n=>n.id===e?{...n,...t}:n)})),deleteEndpoint:e=>eP(t=>({...t,endpoints:t.endpoints.filter(t=>t.id!==e)})),patchTable:(e,t)=>eP(n=>({...n,tables:n.tables.map(n=>n.id===e?{...n,...t}:n)})),deleteTable:e=>eP(t=>({...t,tables:t.tables.filter(t=>t.id!==e),relations:t.relations.filter(t=>t.fromTableId!==e&&t.toTableId!==e),endpoints:t.endpoints.map(t=>({...t,links:t.links.filter(t=>t.tableId!==e)}))})),deleteRealEndpoint:e=>{fetch(`/api/endpoints/${e}`,{method:"DELETE"}).then(e=>{e.ok&&T.refresh()})}}),[eP,T]);(0,r.useEffect)(()=>{let e=e=>{if(!(e.metaKey||e.ctrlKey))return;let t=e.target;if(t&&/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName))return;let n=e.key.toLowerCase();"z"===n?(e.preventDefault(),e.shiftKey?eL():eF()):"y"===n&&(e.preventDefault(),eL())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[eF,eL]);let t_=(0,r.useCallback)(async()=>{ej(!0);try{if((await fetch("/api/draft/approve",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(eD)})).ok){try{localStorage.removeItem(eh)}catch{}e_(ef),T.refresh()}}finally{ej(!1)}},[eD,e_,T]),tB=(0,r.useCallback)(async()=>{ej(!0);try{await fetch("/api/draft",{method:"DELETE"})}catch{}try{localStorage.removeItem(eh)}catch{}e_(ef),T.refresh(),ej(!1)},[e_,T]),tH=(0,r.useMemo)(()=>{let e;return e=new Map(eD.tables.map(e=>[e.id,e.name])),{tables:eD.tables.map(e=>({name:e.name,domain:e.domain,description:e.description,columns:e.columns.map(e=>({name:e.name,type:e.type,isPk:e.isPk,isFk:e.isFk,nullable:e.nullable,note:e.note}))})),relations:eD.relations.flatMap(t=>{let n=e.get(t.fromTableId),a=e.get(t.toTableId);return n&&a?[{fromTable:n,fromColumn:t.fromColumn,toTable:a,toColumn:t.toColumn,label:t.label}]:[]}),endpoints:eD.endpoints.map(t=>({method:t.method,path:t.path,domain:t.domain,description:t.description,uses:t.links.flatMap(t=>{let n=e.get(t.tableId);return n?[{table:n,access:t.access}]:[]})}))}},[eD]),tU=eD.tables.length>0||eD.endpoints.length>0,tX=eR.past.length>0,tG=eR.future.length>0;return(0,a.jsx)(f.Provider,{value:tL,children:(0,a.jsxs)("div",{className:(0,x.cn)("canvas-dots relative w-full",c?"h-full":"h-screen"),children:[(0,a.jsxs)(o.Gc,{nodes:tS,edges:"far"===eA?[...tT,...tg].map(e=>({...e,hidden:!0})):[...tT,...tg.map(e=>({...e,hidden:tw.has(e.source)}))],nodeTypes:ep,edgeTypes:ex,nodesConnectable:!M,connectionMode:i.WZ.Loose,connectionLineStyle:{stroke:"var(--accent-2,#ff7a45)",strokeWidth:1.5,strokeDasharray:"4 4"},onInit:e=>{eN.current=e},onNodesChange:tc,onConnect:tF,onNodeMouseEnter:(e,t)=>{"annotation"!==t.type&&U(t.id)},onNodeMouseLeave:()=>U(null),onNodeClick:(e,t)=>{if("annotation"===t.type){let e=t.data;e.editable||E?.(e.annotationId);return}let n="endpoint"===t.type?"endpoint":"table";L({id:t.id,kind:n}),B(null),em(!0),ey("details")},onEdgeClick:(e,t)=>{B(t.id),L(null)},onPaneClick:()=>{L(null),B(null),em(!1)},onNodeDragStop:tp,onEdgesDelete:e=>{for(let t of e)if(t.id.startsWith("fk-")){let e=t.id.slice(3);fetch(`/api/db/relations/${e}`,{method:"DELETE"})}},onNodesDelete:e=>{for(let t of e)t.id.startsWith("anno-")||ts.has(t.id)||("endpoint"===t.type?fetch(`/api/endpoints/${t.id}`,{method:"DELETE"}):"dbTable"===t.type&&fetch(`/api/db/tables/${t.id}`,{method:"DELETE"}))},deleteKeyCode:M?null:["Backspace","Delete"],colorMode:"dark",fitView:!0,fitViewOptions:{padding:.15,minZoom:.38,maxZoom:.9},minZoom:.15,panOnScroll:!0,zoomActivationKeyCode:["Meta","Control"],proOptions:{hideAttribution:!0},children:[(0,a.jsx)(en.Z,{regions:tM,tone:"category",lod:eA}),(0,a.jsx)(b.J,{onLod:eS,thresholds:y.fE}),(0,a.jsx)(o.H2,{position:"bottom-right",className:"!overflow-hidden !rounded-xl !border !border-white/10 [&_button]:!border-white/10 [&_button]:!bg-card/70 [&_button]:!text-foreground [&_button]:!backdrop-blur"}),!c&&(0,a.jsx)(o.of,{pannable:!0,zoomable:!0,position:"bottom-left",style:{width:140,height:90},className:"!overflow-hidden !rounded-xl !border !border-white/10 !bg-card/50 !backdrop-blur",nodeColor:"#555"}),!c&&(0,a.jsx)(o.Zk,{position:"bottom-center",className:"!mb-4",children:(0,a.jsx)("div",{className:"glass flex items-center rounded-full p-0.5",children:(0,a.jsxs)("button",{type:"button",disabled:ev,title:"Re-arrange the board — domain clusters with endpoints docked under their tables",onClick:async()=>{ej(!0);try{let e=window.innerWidth/window.innerHeight;await fetch("/api/db/arrange",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({viewportAspect:e})}),T.refresh()}finally{ej(!1)}},className:"flex h-6 items-center gap-1.5 rounded-full px-3 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-white/[0.06] hover:text-foreground disabled:opacity-40",children:[(0,a.jsx)(er.A,{className:"size-3"}),ev?"Arranging…":"Arrange"]})})}),!c&&(0,a.jsx)(o.Zk,{position:"top-center",className:"glass rounded-full px-1 py-0.5",children:(0,a.jsx)(W.Z,{active:"DATABASE",tabs:[{value:"ROADMAP",label:"Roadmap",href:"/map?view=ROADMAP"},{value:"ARCHITECTURE",label:"Architecture",href:"/map?view=ARCHITECTURE"},{value:"DATABASE",label:"Database",href:"/map?view=DATABASE"},{value:"FILES",label:"Files",href:"/map?view=FILES"}]})}),(0,a.jsxs)(o.Zk,{position:"top-right",className:(0,x.cn)("flex items-center gap-1 transition-[margin] duration-200",eu&&"!mr-[332px]",c&&"hidden"),children:[(0,a.jsx)(G.X,{query:ew,onQuery:ek,hits:tC,placeholder:"Find a table, column, endpoint…",onPick:tE,onZoomToMatches:()=>{tN?.size&&eN.current?.fitView({nodes:[...tN].map(e=>({id:e})),duration:600,padding:.2})}}),(0,a.jsxs)(X.er,{title:"Filters",trigger:(e,t)=>(0,a.jsxs)("button",{type:"button",onClick:t,title:"Filters",className:(0,x.cn)("glass relative flex size-8 items-center justify-center rounded-lg transition-colors",e||tP>0?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[(0,a.jsx)(es.A,{className:"size-4"}),tP>0&&(0,a.jsx)("span",{className:"absolute -right-1 -top-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-[var(--accent-2,#ff7a45)] px-1 text-[9px] font-semibold text-white",children:tP})]}),children:[(0,a.jsx)(X.r1,{title:"Show",children:(0,a.jsx)(X.vu,{tone:"accent",on:D,onClick:()=>P(e=>!e),children:"endpoints"})}),tz.length>0&&(0,a.jsx)(X.r1,{title:"Domain",children:tz.map(e=>(0,a.jsx)(X.vu,{on:eC.has(e),onClick:()=>tD(e,eE),children:e},e))}),t$.length>0&&(0,a.jsx)(X.r1,{title:"Method",children:t$.map(e=>(0,a.jsx)(X.vu,{on:eT.has(e),onClick:()=>tD(e,ez),children:e},e))}),tR.length>0&&(0,a.jsx)(X.r1,{title:"Source",children:tR.map(e=>(0,a.jsx)(X.vu,{on:eI.has(e),onClick:()=>tD(e,eM),children:e.toLowerCase()},e))}),tP>0&&(0,a.jsx)("button",{type:"button",onClick:tO,className:"mt-1 w-full rounded-md border border-white/10 px-2 py-1 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-white/5 hover:text-foreground",children:"clear filters"})]}),(0,a.jsx)(X.er,{title:"Legend",trigger:(e,t)=>(0,a.jsx)("button",{type:"button",onClick:t,title:"Legend",className:(0,x.cn)("glass flex size-8 items-center justify-center rounded-lg transition-colors",e?"text-foreground":"text-muted-foreground hover:text-foreground"),children:(0,a.jsx)(eo.A,{className:"size-4"})}),children:(0,a.jsxs)("ul",{className:"space-y-1.5 text-[10.5px] text-muted-foreground",children:[(0,a.jsxs)("li",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"inline-block rounded border border-white/15 bg-white/[0.06] px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-foreground/80",children:"table"}),(0,a.jsx)("span",{children:"a database table \xb7 its columns"})]}),(0,a.jsxs)("li",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"inline-block rounded border border-white/15 bg-white/[0.06] px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-foreground/80",children:"endpoint"}),(0,a.jsx)("span",{children:"an API route \xb7 reads / writes tables"})]}),(0,a.jsxs)("li",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{"aria-hidden":!0,className:"inline-block h-px w-6 bg-[#6b6b6b]"}),(0,a.jsx)("span",{children:"foreign key \xb7 drag from a table handle"})]}),(0,a.jsxs)("li",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{"aria-hidden":!0,className:"inline-block h-0 w-6 border-t border-dashed",style:{borderColor:"#4ea1ff"}}),(0,a.jsx)("span",{children:"endpoint read \xb7 GET / POST / etc"})]}),(0,a.jsxs)("li",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{"aria-hidden":!0,className:"inline-block h-0 w-6 border-t border-dashed",style:{borderColor:"#ffb86b"}}),(0,a.jsx)("span",{children:"endpoint write"})]}),(0,a.jsxs)("li",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"inline-block rounded border border-dashed border-sky-400/50 px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-sky-300",children:"draft"}),(0,a.jsx)("span",{children:"agent-proposed \xb7 approve to persist"})]})]})}),!eu&&(0,a.jsx)("button",{onClick:()=>em(!0),title:"Show panel",className:"glass flex size-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:text-foreground",children:(0,a.jsx)(ei.A,{className:"size-4"})})]}),tU&&(0,a.jsxs)(o.Zk,{position:"bottom-center",className:"glass flex items-center gap-1 rounded-xl p-1.5",children:[(0,a.jsxs)("button",{onClick:eF,disabled:!tX,title:"Undo (⌘Z)",className:"flex items-center gap-1 rounded-md px-2 py-1 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground disabled:opacity-30 disabled:hover:bg-transparent",children:[(0,a.jsx)(el.A,{className:"size-3.5"})," undo"]}),(0,a.jsxs)("button",{onClick:eL,disabled:!tG,title:"Redo (⇧⌘Z)",className:"flex items-center gap-1 rounded-md px-2 py-1 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground disabled:opacity-30 disabled:hover:bg-transparent",children:[(0,a.jsx)(ed.A,{className:"size-3.5"})," redo"]}),!c&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"mx-1 h-4 w-px bg-white/10"}),(0,a.jsxs)("button",{onClick:tB,disabled:ev,title:"Discard draft",className:"flex items-center gap-1 rounded-md px-2 py-1 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-red-500/15 hover:text-red-300 disabled:opacity-40",children:[(0,a.jsx)(u.A,{className:"size-3.5"})," discard"]}),(0,a.jsxs)("button",{onClick:t_,disabled:ev,title:"Approve and persist to the schema",className:"flex items-center gap-1 rounded-md border border-emerald-500/40 bg-emerald-500/15 px-2.5 py-1 text-[11px] font-semibold text-emerald-300 transition-colors hover:bg-emerald-500/25 disabled:opacity-40",children:[(0,a.jsx)(ec.A,{className:"size-3.5"})," approve draft"]})]})]})]}),eu&&(0,a.jsx)(O,{selected:F,tables:eK,relations:eJ,endpoints:eW,draftGraph:tH,onClose:()=>{em(!1),ey("details")},commentsContent:w,commentsCount:k,activeTab:eb,onTabChange:ey,onAddComment:ta,topOffset:c?64:void 0})]})})}},94014:(e,t,n)=>{n.d(t,{Xi:()=>a});function a(e,t){let n,a,r,s=(a=((n=t.viewportAspect)&&Number.isFinite(n)&&n>0?Math.min(3.2,Math.max(.7,n)):1.8)*(t.aspectSlack??1),r=e.reduce((e,n)=>e+(n.w+t.gapX)*(n.h+t.gapY),0),Math.max(t.minBandW,Math.round(Math.sqrt(r*a)))),o=new Map,i=0,l=0,d=0;for(let n of e)i>0&&i+n.w>s&&(l+=d+t.gapY,i=0,d=0),o.set(n.id,{x:i,y:l}),d=Math.max(d,n.h),i+=n.w+t.gapX;return o}},95635:(e,t,n)=>{n.d(t,{x:()=>o});var a=n(95155),r=n(81750),s=n(6266);function o(){let e="!h-2 !w-2 !border-0 !bg-zinc-400";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.h7,{type:"target",position:s.yX.Top,id:"tt",className:e}),(0,a.jsx)(r.h7,{type:"source",position:s.yX.Top,id:"st",className:e}),(0,a.jsx)(r.h7,{type:"target",position:s.yX.Right,id:"tr",className:e}),(0,a.jsx)(r.h7,{type:"source",position:s.yX.Right,id:"sr",className:e}),(0,a.jsx)(r.h7,{type:"target",position:s.yX.Bottom,id:"tb",className:e}),(0,a.jsx)(r.h7,{type:"source",position:s.yX.Bottom,id:"sb",className:e}),(0,a.jsx)(r.h7,{type:"target",position:s.yX.Left,id:"tl",className:e}),(0,a.jsx)(r.h7,{type:"source",position:s.yX.Left,id:"sl",className:e})]})}},98238:(e,t,n)=>{n.d(t,{F:()=>o,o:()=>i});var a=n(95155),r=n(28161),s=n(91337);function o(e,t){return!!t&&("fullstack"===e?"fullstack"===t:t===e||"fullstack"===t)}function i({value:e,onChange:t,options:n=r.RR}){return(0,a.jsx)("div",{className:"glass flex items-center gap-0.5 rounded-lg p-0.5",children:n.map(n=>{let o=e===n;return(0,a.jsxs)("button",{type:"button",onClick:()=>t(o?null:n),title:o?"Show every layer at full strength again":`Highlight ${r.YG[n].label} — other cards dim, nothing is hidden`,className:(0,s.cn)("flex h-7 items-center gap-1.5 rounded-md px-2 text-[10px] font-semibold uppercase tracking-wide transition-colors",o?"bg-white/[0.12] text-foreground":"text-muted-foreground hover:bg-white/[0.06] hover:text-foreground"),children:[(0,a.jsx)("span",{"aria-hidden":!0,className:"h-3 w-[3px] shrink-0 rounded-full",style:{background:(0,r.A6)(n)}}),r.YG[n].short]},n)})})}}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9040],{39593:(e,s,a)=>{"use strict";a.d(s,{EO:()=>o,W6:()=>r,kw:()=>n});var t=a(41463);let n="https://registry.npmjs.org/trybeacon/latest",r=(t.env.NEXT_PUBLIC_BEACON_SITE_URL??"https://www.trybeacon.sh").replace(/\/$/,""),o=`curl -fsSL ${r}/install.sh | sh`},52965:(e,s,a)=>{"use strict";a.d(s,{_:()=>n});var t=a(95155);function n({size:e=18,className:s}){return(0,t.jsxs)("svg",{width:e,height:e,viewBox:"20 22 56 56",fill:"none",className:s,"aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M48 33 L72.5 73 L23.5 73 Z",fill:"none",stroke:"var(--accent-2, #ff7a45)",strokeWidth:7,strokeLinejoin:"round",strokeLinecap:"round"}),(0,t.jsx)("circle",{cx:"48",cy:"29.5",r:"7",fill:"var(--accent-2, #ff7a45)"})]})}},73954:(e,s,a)=>{"use strict";a.d(s,{Docs:()=>f});var t=a(95155),n=a(12115),r=a(98500),o=a.n(r),i=a(52965),l=a(39593);a(93340);let d=[{id:"overview",title:"What is Beacon"},{id:"install",title:"Install"},{id:"quickstart",title:"Quickstart"},{id:"loop",title:"The planning loop"},{id:"canvases",title:"The canvases"},{id:"cli",title:"CLI reference"},{id:"integration",title:"Claude Code integration"},{id:"config",title:"Configuration"},{id:"telemetry",title:"Telemetry"},{id:"troubleshooting",title:"Troubleshooting"}],c=[{cmd:"beacon",what:"Register the current repo, ensure the shared server is running, and open the panel on this repo. The everyday command."},{cmd:"beacon doctor",what:"Audit what's wired — the global Claude Code hooks + skills, this repo's .mcp.json, and the running daemon."},{cmd:"beacon stop",what:"Stop the shared background server. It restarts the next time you run beacon."},{cmd:"beacon setup",what:"(Re)install Beacon's per-repo helpers — the skills and .mcp.json — in the current repo without opening the panel."},{cmd:"beacon uninstall",what:"Reverse every Beacon artifact: the global ~/.claude wiring and the per-repo files."},{cmd:"beacon mcp",what:"The stdio MCP server Claude Code spawns automatically. You never run this by hand."}],h=[{name:"/beacon-init",when:"First time you point Beacon at a repo.",what:"The agent reads the codebase and fills Beacon's map — the main components, the rough roadmap themes, the database schema, and the endpoints. Run it once per repo to bootstrap the picture."},{name:"/beacon-refresh",when:"Every few weeks, or after a big set of changes.",what:"The agent re-surveys the repo and updates what /beacon-init produced — adds new components, drops removed ones, picks up new tables and routes. Anything you added by hand on the canvas survives."},{name:"/beacon-plan",when:"Whenever you want to review an approach on the canvas.",what:"Present the current plan or approach on Beacon's /plan page for annotation instead of asking for approval as a wall of text."}],m=[{name:"beacon_context_for_feature",what:"Before touching code, the agent pulls the files attached to a feature plus their imports, the endpoints in that domain, the tables those endpoints touch, and the surrounding components — one round-trip instead of a blind Glob/Grep scan."},{name:"beacon_blast_radius",what:"Mid-feature, the agent runs this on a file it's about to edit to see what imports it and what it imports — so it can judge whether a change is safe."},{name:"beacon_propose_plan",what:"When the agent has a feature plan (tables + relations + endpoints), this opens it on /plan and BLOCKS the session until you Approve, Discard, or Submit feedback."},{name:"beacon_describe_feature",what:"When a feature is done, the agent records a short markdown summary and the files it touched, keeping the next session's context accurate."},{name:"beacon_map",what:"A quick list of features already on the roadmap. The agent calls it near the start of work to avoid duplicating what's planned."},{name:"beacon_entities",what:"A raw readout of everything mapped — features, architecture, tables, endpoints — when the agent just needs the planning data."}],p=[{trigger:"Plan mode (ExitPlanMode)",what:"When the agent shows you a plan, Beacon intercepts it and renders the markdown on /plan with a native annotation panel. Select text and type → it becomes a comment. Approve / Discard / Submit feedback flows back to the session as the next instruction."},{trigger:"File edits (PostToolUse)",what:"Every Edit/Write the agent runs is reported to Beacon and the file is attached to whichever feature the session is working on. The /map view fills in with the real files behind each feature, without you tagging anything."},{trigger:"Code-graph watcher",what:"While the panel is open, a background watcher rebuilds the Files view as you save code — the maps stay current with the repo on their own."}],x=[{key:"BEACON_HOME",what:"Where per-workspace data lives — the SQLite databases and the server record. Defaults to ~/.beacon."},{key:"PORT",what:"Port for the shared local server. Defaults to 4319."},{key:"Settings → intel",what:"In the panel, the Settings page drives the code-intelligence model/provider and your editor, and triggers a code-map sync."}];function u({text:e,label:s="Copy"}){let[a,r]=(0,n.useState)(!1);return(0,t.jsx)("button",{onClick:()=>{navigator.clipboard?.writeText(e),r(!0),setTimeout(()=>r(!1),1500)},className:"glass-soft w-hover grid h-8 w-8 shrink-0 place-items-center rounded-md","aria-label":s,children:a?(0,t.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#ff7a45",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"M20 6 9 17l-5-5"})}):(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})}function g({children:e,copy:s}){return(0,t.jsxs)("div",{className:"glass-soft flex items-center gap-3 rounded-lg px-4 py-2.5",children:[(0,t.jsx)("span",{className:"w-signal select-none",children:"$"}),(0,t.jsx)("code",{className:"w-mono w-scrollbar-none flex-1 overflow-x-auto whitespace-nowrap text-[0.85rem] text-foreground",children:e}),s&&(0,t.jsx)(u,{text:e})]})}function w({id:e,eyebrow:s,children:a}){return(0,t.jsxs)("div",{className:"mb-5 scroll-mt-28",id:e,children:[(0,t.jsx)("p",{className:"w-mono w-eyebrow w-signal mb-2",children:s}),(0,t.jsx)("h2",{className:"text-[1.6rem] font-semibold tracking-tight",children:a})]})}function f(){let[e,s]=(0,n.useState)(d[0].id),a=(0,n.useRef)(null);return(0,n.useEffect)(()=>{let e=new IntersectionObserver(e=>{let a=e.filter(e=>e.isIntersecting).sort((e,s)=>e.boundingClientRect.top-s.boundingClientRect.top);a[0]&&s(a[0].target.id)},{rootMargin:"-20% 0px -70% 0px",threshold:0});return d.forEach(s=>{let a=document.getElementById(s.id);a&&e.observe(a)}),()=>e.disconnect()},[]),(0,t.jsxs)("div",{className:"welcome",ref:a,children:[(0,t.jsx)("div",{className:"welcome-bg","aria-hidden":!0}),(0,t.jsx)("header",{className:"fixed inset-x-0 top-0 z-50",children:(0,t.jsx)("div",{className:"mx-auto max-w-6xl px-6",children:(0,t.jsxs)("div",{className:"w-load mt-4 glass flex items-center justify-between rounded-full py-2.5 pl-5 pr-3",style:{animationDelay:".05s"},children:[(0,t.jsxs)(o(),{href:"/",className:"flex items-center gap-2.5",children:[(0,t.jsx)(i._,{size:20,className:"text-foreground"}),(0,t.jsx)("span",{className:"font-semibold tracking-tight",children:"Beacon"}),(0,t.jsx)("span",{className:"w-mono w-eyebrow w-muted ml-1 hidden sm:inline",children:"docs"})]}),(0,t.jsxs)("nav",{className:"flex items-center gap-6 text-sm w-muted",children:[(0,t.jsx)(o(),{href:"/",className:"transition-colors hover:text-foreground",children:"Home"}),(0,t.jsx)("a",{href:"#install",className:"transition-colors hover:text-foreground",children:"Install"})]})]})})}),(0,t.jsx)("div",{className:"mx-auto max-w-6xl px-6 pb-24 pt-20",children:(0,t.jsxs)("div",{className:"lg:grid lg:grid-cols-[15rem_1fr] lg:gap-14",children:[(0,t.jsx)("aside",{className:"hidden lg:block",children:(0,t.jsxs)("nav",{className:"sticky top-28",children:[(0,t.jsx)("p",{className:"w-mono w-eyebrow w-muted mb-4",children:"On this page"}),(0,t.jsx)("ul",{className:"space-y-1.5 text-sm",children:d.map(s=>(0,t.jsx)("li",{children:(0,t.jsx)("a",{href:`#${s.id}`,className:`block border-l-2 py-1 pl-3 transition-colors ${e===s.id?"w-signal border-[#ff7a45]":"w-muted border-transparent hover:text-foreground"}`,children:s.title})},s.id))})]})}),(0,t.jsxs)("main",{className:"min-w-0 max-w-2xl",children:[(0,t.jsxs)("section",{className:"w-load",children:[(0,t.jsx)(w,{id:"overview",eyebrow:"Overview",children:"What is Beacon"}),(0,t.jsxs)("p",{className:"w-muted leading-relaxed",children:["Beacon is the ",(0,t.jsx)("span",{className:"text-foreground",children:"visual planning surface for the coding agent in your terminal"}),". That session is the brain; Beacon is its eyes and hands. The agent proposes a feature plan — roadmap features, database schema, and endpoints — you review it on a canvas instead of a wall of text, give scoped feedback, and approve or discard with a click. The verdict flows straight back to your session."]}),(0,t.jsxs)("p",{className:"w-muted mt-4 leading-relaxed",children:["It runs entirely on your machine — ",(0,t.jsx)("span",{className:"text-foreground",children:"local-first, your code never leaves it"}),". One shared server quietly serves every repo you open; each keeps its own data under ",(0,t.jsx)("span",{className:"w-mono text-foreground",children:"~/.beacon"}),"."]})]}),(0,t.jsxs)("section",{className:"mt-16",children:[(0,t.jsx)(w,{id:"install",eyebrow:"Get started",children:"Install"}),(0,t.jsxs)("p",{className:"w-muted mb-4 leading-relaxed",children:["One command. It installs ",(0,t.jsx)("span",{className:"text-foreground",children:"Bun"})," if you don't have it, then puts the"," ",(0,t.jsx)("span",{className:"w-mono text-foreground",children:"beacon"})," CLI on your PATH. Re-run it any time to update."]}),(0,t.jsx)(g,{copy:!0,children:l.EO}),(0,t.jsx)("p",{className:"w-muted mt-4 leading-relaxed",children:"Then, inside any repository:"}),(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsx)(g,{copy:!0,children:"beacon"})})]}),(0,t.jsxs)("section",{className:"mt-16",children:[(0,t.jsx)(w,{id:"quickstart",eyebrow:"Get started",children:"Quickstart"}),(0,t.jsx)("ol",{className:"space-y-5",children:[(0,t.jsxs)(t.Fragment,{children:["Install with the command above, then run ",(0,t.jsx)("span",{className:"w-mono text-foreground",children:"beacon"})," inside a repo. It registers the repo, starts the shared server, and opens the panel in your browser."]}),(0,t.jsxs)(t.Fragment,{children:["In your Claude Code session, run ",(0,t.jsx)("span",{className:"w-mono text-foreground",children:"/beacon-init"}),". The agent reads the repo and draws its architecture, schema, and roadmap onto the canvas."]}),(0,t.jsxs)(t.Fragment,{children:["Ask the agent to plan a feature. It calls ",(0,t.jsx)("span",{className:"w-mono text-foreground",children:"beacon_propose_plan"})," and the plan renders live on ",(0,t.jsx)("span",{className:"text-foreground",children:"/plan"}),"."]}),(0,t.jsxs)(t.Fragment,{children:["Review it — annotate inline, edit the boards — then ",(0,t.jsx)("span",{className:"text-foreground",children:"Approve"}),", ",(0,t.jsx)("span",{className:"text-foreground",children:"Submit feedback"}),", or ",(0,t.jsx)("span",{className:"text-foreground",children:"Discard"}),". Your verdict returns to the session."]})].map((e,s)=>(0,t.jsxs)("li",{className:"relative pl-11",children:[(0,t.jsx)("span",{className:"w-mono glass absolute left-0 top-0 grid h-7 w-7 place-items-center rounded-md text-[0.72rem] font-semibold text-foreground",children:s+1}),(0,t.jsx)("p",{className:"w-muted leading-relaxed",children:e})]},s))})]}),(0,t.jsxs)("section",{className:"mt-16",children:[(0,t.jsx)(w,{id:"loop",eyebrow:"Concepts",children:"The planning loop"}),(0,t.jsx)("p",{className:"w-muted leading-relaxed",children:"The loop is the whole point. It closes in five steps:"}),(0,t.jsx)("ol",{className:"mt-4 space-y-3",children:[(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-foreground",children:"Propose."})," The agent calls ",(0,t.jsx)("span",{className:"w-mono text-foreground",children:"beacon_propose_plan"})," (or you present a plan in plan mode). The tool ",(0,t.jsx)("span",{className:"text-foreground",children:"blocks"})," — the session waits for your verdict."]}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-foreground",children:"Review."})," The plan renders on ",(0,t.jsx)("span",{className:"text-foreground",children:"/plan"}),": a native annotation panel on the left, the roadmap and database boards on the right. Select text to comment; edit the boards directly."]}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-foreground",children:"Decide."})," Approve, Discard, or Submit feedback. Feedback bundles your inline notes plus any board edits."]}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-foreground",children:"Return."})," The verdict flows back to the terminal. On feedback, the agent revises and re-proposes — the loop continues."]}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-foreground",children:"Record."})," On approval the schema and roadmap drafts persist, and when the work is done the agent calls ",(0,t.jsx)("span",{className:"w-mono text-foreground",children:"beacon_describe_feature"})," so the next session has accurate context."]})].map((e,s)=>(0,t.jsx)("li",{className:"glass w-hover rounded-lg p-4",children:(0,t.jsx)("p",{className:"w-muted text-[0.95rem] leading-relaxed",children:e})},s))})]}),(0,t.jsxs)("section",{className:"mt-16",children:[(0,t.jsx)(w,{id:"canvases",eyebrow:"Concepts",children:"The canvases"}),(0,t.jsx)("div",{className:"space-y-4",children:[{path:"/map",what:"The roadmap: feature cards, their sub-tasks, and dependency links — plus a separate architecture view of the real components. Files the agent edits attach themselves here."},{path:"/db",what:"The database design board: tables and columns, endpoints, and the endpoint→table links. Proposed schema lands as a distinct draft layer you can approve or discard."},{path:"/plan",what:"The split-screen review page: annotations on the left, the roadmap + database boards tabbed on the right, plus a history of every plan and its verdict."}].map(e=>(0,t.jsxs)("div",{className:"glass w-hover rounded-lg p-5",children:[(0,t.jsx)("p",{className:"w-mono text-foreground mb-1",children:e.path}),(0,t.jsx)("p",{className:"w-muted text-[0.95rem] leading-relaxed",children:e.what})]},e.path))})]}),(0,t.jsxs)("section",{className:"mt-16",children:[(0,t.jsx)(w,{id:"cli",eyebrow:"Reference",children:"CLI reference"}),(0,t.jsx)("div",{className:"space-y-3",children:c.map(e=>(0,t.jsxs)("div",{className:"glass rounded-lg p-4",children:[(0,t.jsxs)("code",{className:"w-mono text-foreground text-[0.9rem]",children:[(0,t.jsx)("span",{className:"w-signal select-none",children:"$ "}),e.cmd]}),(0,t.jsx)("p",{className:"w-muted mt-1.5 text-[0.92rem] leading-relaxed",children:e.what})]},e.cmd))})]}),(0,t.jsxs)("section",{className:"mt-16",children:[(0,t.jsx)(w,{id:"integration",eyebrow:"Reference",children:"Claude Code integration"}),(0,t.jsx)("h3",{className:"mb-1 mt-2 font-semibold text-foreground",children:"Skills — you type these"}),(0,t.jsx)("p",{className:"w-muted mb-4 text-[0.92rem]",children:"Slash commands that tell the agent to do something Beacon-shaped."}),(0,t.jsx)("div",{className:"space-y-3",children:h.map(e=>(0,t.jsxs)("div",{className:"glass rounded-lg p-4",children:[(0,t.jsx)("code",{className:"w-mono text-foreground text-[0.9rem]",children:e.name}),(0,t.jsxs)("p",{className:"w-muted mt-1.5 text-[0.92rem] leading-relaxed",children:[(0,t.jsx)("span",{className:"text-foreground",children:"When:"})," ",e.when," ",e.what]})]},e.name))}),(0,t.jsx)("h3",{className:"mb-1 mt-8 font-semibold text-foreground",children:"MCP tools — the agent calls these"}),(0,t.jsx)("p",{className:"w-muted mb-4 text-[0.92rem]",children:"You don't run these; the agent reaches for them when they fit. Knowing they exist makes its moves legible."}),(0,t.jsx)("div",{className:"space-y-3",children:m.map(e=>(0,t.jsxs)("div",{className:"glass rounded-lg p-4",children:[(0,t.jsx)("code",{className:"w-mono text-foreground text-[0.9rem]",children:e.name}),(0,t.jsx)("p",{className:"w-muted mt-1.5 text-[0.92rem] leading-relaxed",children:e.what})]},e.name))}),(0,t.jsx)("h3",{className:"mb-1 mt-8 font-semibold text-foreground",children:"Hooks — these run on their own"}),(0,t.jsx)("p",{className:"w-muted mb-4 text-[0.92rem]",children:"Wired into Claude Code globally; they react to what the session is already doing."}),(0,t.jsx)("div",{className:"space-y-3",children:p.map(e=>(0,t.jsxs)("div",{className:"glass rounded-lg p-4",children:[(0,t.jsx)("p",{className:"font-medium text-foreground text-[0.92rem]",children:e.trigger}),(0,t.jsx)("p",{className:"w-muted mt-1.5 text-[0.92rem] leading-relaxed",children:e.what})]},e.trigger))})]}),(0,t.jsxs)("section",{className:"mt-16",children:[(0,t.jsx)(w,{id:"config",eyebrow:"Reference",children:"Configuration"}),(0,t.jsx)("div",{className:"space-y-3",children:x.map(e=>(0,t.jsxs)("div",{className:"glass rounded-lg p-4",children:[(0,t.jsx)("code",{className:"w-mono text-foreground text-[0.9rem]",children:e.key}),(0,t.jsx)("p",{className:"w-muted mt-1.5 text-[0.92rem] leading-relaxed",children:e.what})]},e.key))})]}),(0,t.jsxs)("section",{className:"mt-16",children:[(0,t.jsx)(w,{id:"telemetry",eyebrow:"Reference",children:"Telemetry"}),(0,t.jsxs)("p",{className:"w-muted mb-4 leading-relaxed",children:["Beacon sends an anonymous heartbeat at most every 12 hours while the local server runs, so we can count active installs (npm download numbers are dominated by mirrors and CI). The payload is exactly five fields — verify it yourself anytime with"," ",(0,t.jsx)("span",{className:"w-mono text-foreground",children:"beacon telemetry status"}),", which prints the exact payload that gets sent."]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"glass rounded-lg p-4",children:[(0,t.jsx)("p",{className:"font-medium text-foreground text-[0.92rem]",children:"What is sent"}),(0,t.jsxs)("p",{className:"w-muted mt-1.5 text-[0.92rem] leading-relaxed",children:["A random machine id (a UUID generated locally — tied to nothing), the Beacon version, the operating system (",(0,t.jsx)("span",{className:"w-mono",children:"darwin"}),"/",(0,t.jsx)("span",{className:"w-mono",children:"linux"}),"/",(0,t.jsx)("span",{className:"w-mono",children:"win32"}),"), the CPU architecture, and whether the machine is a CI runner."]})]}),(0,t.jsxs)("div",{className:"glass rounded-lg p-4",children:[(0,t.jsx)("p",{className:"font-medium text-foreground text-[0.92rem]",children:"What is never sent"}),(0,t.jsx)("p",{className:"w-muted mt-1.5 text-[0.92rem] leading-relaxed",children:"Repo names, file paths, code, plans, board content, environment variables, or anything derived from them. IP addresses are not stored."})]}),(0,t.jsxs)("div",{className:"glass rounded-lg p-4",children:[(0,t.jsx)("p",{className:"font-medium text-foreground text-[0.92rem]",children:"Opting out"}),(0,t.jsxs)("p",{className:"w-muted mt-1.5 text-[0.92rem] leading-relaxed",children:["Any of: ",(0,t.jsx)("span",{className:"w-mono text-foreground",children:"beacon telemetry off"}),", the env var"," ",(0,t.jsx)("span",{className:"w-mono text-foreground",children:"BEACON_TELEMETRY_DISABLED=1"}),", or the cross-tool ",(0,t.jsx)("span",{className:"w-mono text-foreground",children:"DO_NOT_TRACK=1"})," convention. Re-enable with ",(0,t.jsx)("span",{className:"w-mono text-foreground",children:"beacon telemetry on"}),"."]})]})]})]}),(0,t.jsxs)("section",{className:"mt-16",children:[(0,t.jsx)(w,{id:"troubleshooting",eyebrow:"Help",children:"Troubleshooting"}),(0,t.jsx)("p",{className:"w-muted mb-4 leading-relaxed",children:"When something looks off, start here:"}),(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsx)(g,{copy:!0,children:"beacon doctor"})}),(0,t.jsx)("div",{className:"space-y-3",children:[{q:"The panel won't open",a:(0,t.jsxs)(t.Fragment,{children:["Make sure the server is up — run ",(0,t.jsx)("span",{className:"w-mono text-foreground",children:"beacon"})," again, or ",(0,t.jsx)("span",{className:"w-mono text-foreground",children:"beacon stop"})," then ",(0,t.jsx)("span",{className:"w-mono text-foreground",children:"beacon"})," to restart it."]})},{q:"The @beacon tools or skills are missing in Claude Code",a:(0,t.jsxs)(t.Fragment,{children:["Run ",(0,t.jsx)("span",{className:"w-mono text-foreground",children:"beacon setup"})," in the repo, then restart your Claude Code session so it re-reads the MCP registration."]})},{q:"How do I update?",a:(0,t.jsx)(t.Fragment,{children:"Re-run the install command — it fetches the latest and relinks. Nothing else to do."})}].map(e=>(0,t.jsxs)("div",{className:"glass rounded-lg p-4",children:[(0,t.jsx)("p",{className:"font-medium text-foreground text-[0.92rem]",children:e.q}),(0,t.jsx)("p",{className:"w-muted mt-1.5 text-[0.92rem] leading-relaxed",children:e.a})]},e.q))})]})]})]})}),(0,t.jsx)("footer",{className:"px-6 pb-12 pt-8",children:(0,t.jsxs)("div",{className:"mx-auto max-w-6xl",children:[(0,t.jsx)("div",{className:"w-accent-line mb-8 h-px w-full opacity-60"}),(0,t.jsxs)("div",{className:"flex flex-col items-center justify-between gap-5 md:flex-row",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,t.jsx)(i._,{size:26,className:"text-foreground"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-semibold leading-tight",children:"Beacon"}),(0,t.jsx)("p",{className:"w-mono w-muted text-[0.72rem]",children:"the visual planning surface for your terminal"})]})]}),(0,t.jsxs)("nav",{className:"flex items-center gap-6 text-sm w-muted",children:[(0,t.jsx)(o(),{href:"/",className:"transition-colors hover:text-foreground",children:"Home"}),(0,t.jsx)("a",{href:"#overview",className:"transition-colors hover:text-foreground",children:"Docs"})]}),(0,t.jsxs)("p",{className:"w-mono w-muted text-[0.72rem]",children:["Created by"," ",(0,t.jsxs)("a",{href:"https://www.instagram.com/wenzorithelly/",target:"_blank",rel:"noreferrer",className:"w-signal inline-flex items-center gap-1 underline decoration-dotted underline-offset-2 transition-opacity hover:opacity-80",children:[(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,t.jsx)("rect",{x:"2",y:"2",width:"20",height:"20",rx:"5",ry:"5"}),(0,t.jsx)("path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z"}),(0,t.jsx)("line",{x1:"17.5",y1:"6.5",x2:"17.51",y2:"6.5"})]}),"Wenzo"]}),(0,t.jsx)("span",{className:"mx-2 opacity-40",children:"\xb7"}),"\xa9 2026 Beacon"]})]})]})})]})}},82780:(e,s,a)=>{Promise.resolve().then(a.bind(a,73954))},93340:()=>{}},e=>{e.O(0,[1477,8500,8441,3794,7358],()=>e(e.s=82780)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5823],{39454:(e,t,s)=>{Promise.resolve().then(s.bind(s,91588)),Promise.resolve().then(s.bind(s,62079)),Promise.resolve().then(s.bind(s,3958))},62079:(e,t,s)=>{"use strict";s.d(t,{FilesMapClient:()=>L});var o=s(95155),n=s(12115),r=s(81750),l=s(6266),a=s(7679),i=s(98766),d=s(15629),c=s(79176),u=s(2982),p=s(64385);s(53255);var h=s(17356),f=s(24413),x=s(18986),m=s(9005),g=s(25583),b=s(82099),y=s(62311),j=s(9991),k=s(91157),w=s(56895),N=s(16607),v=s(14983);let M=/(^|\/)tests?\/|\.(test|spec)\.[jt]sx?$/i;var C=s(44267),S=s(70947),A=s(98238),$=s(56614),z=s(28161);let E=/\.(py|go|rb|rs|java|php|ex|exs)$/i,I=/(^|\/)(app\/api|pages\/api|migrations|bin)\/|(^|\/)instrumentation\.[^/]+$/,O=e=>e.includes("/")?e.slice(0,e.indexOf("/")):"(root)";function D(e){let t=Math.max(14,.35*e.length),s=new Map;for(let t of e)s.set(t,O(t));for(let e=0;e<6;e++){let e=new Map;for(let t of s.values())e.set(t,(e.get(t)??0)+1);let o=!1;for(let[n,r]of s){if((e.get(r)??0)<=t||!n.startsWith(`${r}/`))continue;let l=n.slice(r.length+1);l.includes("/")&&(s.set(n,`${r}/${l.slice(0,l.indexOf("/"))}`),o=!0)}if(!o)break}return s}var Z=s(29523),R=s(70221),F=s(12410),P=s(91337);function _(e){return 5+.5*Math.min(e,26)}let T={file:function({data:e}){let t=(0,Z.k)(R.kz),s=!!e.touched,n=e.recency??0,a=e.inDegree??0,i=_(a),d=e.layer??null,c=2*!!d,u=a>0?` \xb7 imported by ${a}`:"",p=d?` \xb7 ${"fullstack"===d?"shared (used by frontend + backend)":z.YG[d].label.toLowerCase()}`:"",h=s?`${e.tooltip} \xb7 edited ${e.count??0}\xd7 this session${u}${p}`:e.untested?`${e.tooltip} \xb7 no test imports this file${u}${p}`:`${e.tooltip}${u}${p}`;return(0,o.jsxs)("div",{title:h,className:"relative flex flex-col items-center",children:[(0,o.jsx)(r.h7,{type:"target",position:l.yX.Top,isConnectable:!1,className:"!h-0 !w-0 !min-w-0 !border-0 !bg-transparent",style:{top:i+c,left:"50%"}}),(0,o.jsx)("span",{"aria-hidden":!0,className:(0,P.cn)("rounded-full",e.isNewest&&"animate-touch-pulse"),style:{padding:c,background:d?(0,z.A6)(d):void 0,boxShadow:s?`0 0 ${8+Math.round(14*n)}px ${2+Math.round(3*n)}px rgba(45,212,191,${(.35+.45*n).toFixed(2)})`:e.untested?"0 0 0 2px rgba(251,191,36,0.65)":"none"},children:(0,o.jsx)("span",{"aria-hidden":!0,className:"block rounded-full",style:{width:2*i,height:2*i,backgroundColor:e.dirColor}})}),s&&(e.count??0)>0&&(0,o.jsx)("span",{"aria-hidden":!0,className:"absolute -right-2 -top-2 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-teal-400 px-0.5 text-[8px] font-bold text-background ring-1 ring-background",children:e.count}),("full"===t||"mid"===t&&a>=4)&&(0,o.jsx)("span",{className:(0,P.cn)("pointer-events-none mt-1 max-w-44 truncate text-[10px] leading-tight",s?"font-semibold text-teal-100":"text-foreground/75"),children:e.label}),(0,o.jsx)(r.h7,{type:"source",position:l.yX.Bottom,isConnectable:!1,className:"!h-0 !w-0 !min-w-0 !border-0 !bg-transparent",style:{top:i+c,bottom:"auto",left:"50%"}})]})}};function W({regions:e,dominant:t}){return(0,o.jsx)(r.DX,{children:e.map(e=>{let s=t.get(e.key);return s&&"fullstack"!==s?(0,o.jsx)("div",{style:{position:"absolute",transform:`translate(${e.x-.15*e.w}px, ${e.y-.15*e.h}px)`,width:1.3*e.w,height:1.3*e.h,pointerEvents:"none",zIndex:0,background:`radial-gradient(closest-side, ${z.ZD[s]} 0%, transparent 72%)`,opacity:.1}},e.key):null})})}function L({files:e,edges:t,touched:s,hasFrontend:l=!1,classificationRoots:O=[]}){let X,B=(0,n.useMemo)(()=>(function(e,t){let s=function(e){if(!e?.length)return[];let t=new Set;for(let s of e){let e=s.trim().replace(/^\/+|\/+$/g,"");e&&t.add(e)}return[...t]}(t);if(!s.length)return D(e);let o=new Map,n=[];for(let t of e){let e=function(e,t){let s=null;for(let o of t)(e===o||e.startsWith(`${o}/`))&&(!s||o.length>s.length)&&(s=o);return s}(t,s);e?o.set(t,function(e,t){if(e===t||!e.startsWith(`${t}/`))return t;let s=e.slice(t.length+1);return s.includes("/")?`${t}/${s.slice(0,s.indexOf("/"))}`:t}(t,e)):n.push(t)}for(let[e,t]of D(n))o.set(e,t);return o})(e.map(e=>e.path),O),[e,O]),G=(0,n.useMemo)(()=>(function(e,t,s){let o=function(e){let t=new Map;for(let s of e.values())t.set(s,(t.get(s)??0)+1);let s=Array.from(t.entries()).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])),o=Math.max(1,Math.ceil(Math.sqrt(2.5*s.length))),n=new Map;return s.forEach(([e],t)=>{n.set(e,{x:t%o*1250,y:950*Math.floor(t/o)})}),n}(s),n=e=>o.get(s.get(e)??"(root)"),r=e.map(e=>{let t=function(e){let t=0x811c9dc5;for(let s=0;s<e.length;s++)t=(t^e.charCodeAt(s))*0x1000193>>>0;return{x:(t%10007/10007-.5)*900,y:((t>>>13)%10007/10007-.5)*900}}(e.path),s=n(e.path);return{id:e.path,x:s.x+.5*t.x,y:s.y+.5*t.y,pinned:!1,radius:_(e.inDegree??0)+22}}),l=t.filter(e=>e.from!==e.to).map(e=>({source:e.from,target:e.to})),h=(0,a.A)(r).force("link",(0,i.A)(l).id(e=>e.id).distance(100).strength(e=>{let t="object"==typeof e.source?e.source.id:String(e.source),o="object"==typeof e.target?e.target.id:String(e.target);return s.get(t)===s.get(o)?.5:.02})).force("charge",(0,d.A)().strength(-260).distanceMax(800)).force("collide",(0,c.A)().radius(e=>e.radius).strength(.6)).force("clusterX",(0,u.A)(e=>n(e.id).x).strength(.1)).force("clusterY",(0,p.A)(e=>n(e.id).y).strength(.115)).stop();for(let e=0;e<500;e++)h.tick();let f=new Map;for(let e of r)f.set(e.id,{x:e.x??0,y:e.y??0});return f})(e,t,B),[e,t,B]),U=(0,n.useMemo)(()=>(function(e,t){var s;let o=new Set;for(let e of t)s=e.from,M.test(s)&&o.add(e.to);let n=new Set;for(let t of e)M.test(t)||o.has(t)||n.add(t);return n})(e.map(e=>e.path),t),[e,t]),H=(0,n.useMemo)(()=>l?function(e,t){let s=new Map,o=new Map;for(let e of t){let t=o.get(e.from);t?t.push(e.to):o.set(e.from,[e.to])}let n=new Map;for(let t of e){let e=I.test(t)?"backend":z.An.test(t)?"frontend":E.test(t)?"backend":null;s.set(t,e),e&&n.set(t,e)}let r=e=>{let t=new Set,s=[];for(let[t,o]of n)o===e&&s.push(t);for(;s.length;){let e=s.pop();for(let n of o.get(e)??[])t.has(n)||(t.add(n),s.push(n))}return t},l=r("frontend"),a=r("backend");for(let t of e){if(s.get(t))continue;let e=l.has(t),o=a.has(t);e&&o?s.set(t,"fullstack"):e?s.set(t,"frontend"):o&&s.set(t,"backend")}return s}(e.map(e=>e.path),t):null,[l,e,t]),q=(0,n.useMemo)(()=>{let e=new Map,t=Object.entries(s??{});if(!t.length)return e;let o=t.map(([,e])=>e.lastAt),n=Math.max(...o),r=Math.min(...o),l=n-r||1,a=t[0][0],i=t[0][1].lastAt;for(let[e,s]of t)s.lastAt>=i&&(a=e,i=s.lastAt);for(let[s,o]of t)e.set(s,{count:o.count,recency:(o.lastAt-r)/l,isNewest:s===a});return e},[s]),J=q.size>0,K=(0,n.useMemo)(()=>Array.from(q.entries()).map(([e,t])=>({path:e,label:e.slice(e.lastIndexOf("/")+1),count:t.count,recency:t.recency})).sort((e,t)=>t.recency-e.recency),[q]),Q=(0,n.useMemo)(()=>e.map(e=>{let t=G.get(e.path)??{x:e.x,y:e.y},s=e.path.lastIndexOf("/"),o=s>=0?e.path.slice(s+1):e.path,n=q.get(e.path);return{id:e.path,type:"file",position:t,data:{label:o,tooltip:e.path,untested:U.has(e.path),inDegree:e.inDegree??0,dirColor:(0,F.i3)(B.get(e.path)??"(root)"),layer:H?.get(e.path)??null,touched:!!n,count:n?.count??0,recency:n?.recency??0,isNewest:n?.isNewest??!1}}}),[e,G,U,q,H,B]),Y=(0,n.useMemo)(()=>t.map(e=>({id:`${e.from}|${e.to}`,source:e.from,target:e.to,type:"straight",selectable:!1,focusable:!1,style:{pointerEvents:"none",...e.circular?{stroke:"#f87171",strokeDasharray:"5 3",strokeWidth:1.5,opacity:.6}:{stroke:"#8b8b94",strokeWidth:1,opacity:.3}}})),[t]),[ee,et]=(0,n.useState)(Q),[es,eo]=(0,n.useState)(Y),[en,er]=(0,n.useState)(null),[el,ea]=(0,n.useState)(null),[ei,ed]=(0,n.useState)(null),[ec,eu]=(0,n.useState)(!1),[ep,eh]=(0,n.useState)(!1),[ef,ex]=(0,n.useState)(null),[em,eg]=(0,n.useState)(!1),[eb,ey]=(0,n.useState)(""),[ej,ek]=(0,n.useState)(!1),[ew,eN]=(0,n.useState)("full"),ev=(0,n.useRef)(null),eM=(0,n.useCallback)(e=>{er(e),ed(null);let t=ev.current?.getNode(e);t&&ev.current&&ev.current.setCenter(t.position.x+40,t.position.y+12,{zoom:1.4,duration:600})},[]),eC=(0,n.useCallback)(()=>{er(null),ed(null);let e=!ep;if(eh(e),eg(e),e&&ev.current){let e=Array.from(q.keys()).map(e=>({id:e}));e.length&&ev.current.fitView({nodes:e,duration:600,padding:.4})}},[ep,q]),eS=(0,n.useMemo)(()=>(0,k.b)(e,t,B),[e,t,B]),eA=(0,n.useCallback)(e=>{ev.current&&(e.focusIds.length?ev.current.fitView({nodes:e.focusIds.map(e=>({id:e})),duration:700,padding:.3,maxZoom:1.1}):ev.current.fitView({duration:700,padding:.1}))},[]),e$=(0,w.W)(eS,eA);(0,n.useEffect)(()=>ek(!0),[]),(0,n.useEffect)(()=>et(Q),[Q]),(0,n.useEffect)(()=>eo(Y),[Y]);let ez=(0,n.useCallback)(e=>et(t=>(0,r._0)(e,t)),[]),eE=(0,n.useCallback)(e=>eo(t=>(0,r.zW)(e,t)),[]),eI=(0,n.useCallback)((e,t,s)=>{fetch("/api/code-graph/position",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:e,x:t,y:s})})},[]),eO=(0,n.useMemo)(()=>new Set(t.filter(e=>e.circular).map(e=>`${e.from}|${e.to}`)),[t]),eD=(0,n.useMemo)(()=>{let e=new Set;for(let s of t)s.circular&&(e.add(s.from),e.add(s.to));return e},[t]),eZ=en??el,eR=eb.trim().length>0,eF=(0,n.useMemo)(()=>{if(!eR)return null;let t=new Set;for(let s of e)(0,v.Qk)((0,v.zn)(s),eb)&&t.add(s.path);return t},[e,eb,eR]),eP=(0,n.useMemo)(()=>eR?(0,v.r2)(e,eb,e=>(0,v.zn)(e),e=>({id:e.path,label:e.path,sublabel:e.lang??void 0,kind:"file"})):[],[e,eb,eR]),e_=(0,n.useMemo)(()=>{if(ei){let e=es.find(e=>e.id===ei);return e?new Set([e.source,e.target]):null}if(eZ){let e=new Set([eZ]);for(let s of t)s.from===eZ&&e.add(s.to),s.to===eZ&&e.add(s.from);return e}return ec?eD:ep&&J?new Set(q.keys()):null},[eZ,ei,ec,eD,t,es,ep,J,q]),eT=e$.focusIds,eW=eT??eF??e_,eL=eF??eT,eV=(0,n.useMemo)(()=>{if(!ef||!H)return null;let t=new Set;for(let s of e)(0,A.F)(ef,H.get(s.path)??null)||t.add(s.path);return t},[ef,H,e]),eX=(0,n.useMemo)(()=>eW?ee.map(e=>{let t=eW.has(e.id);return{...e,zIndex:t&&eL?10:e.zIndex,style:{...e.style,opacity:t?1:.15,boxShadow:t&&eL?v.RU:e.style?.boxShadow,borderRadius:t&&eL?9999:e.style?.borderRadius,transition:"opacity 120ms, box-shadow 120ms"}}}):eV?ee.map(e=>eV.has(e.id)?{...e,style:{...e.style,opacity:.15,transition:"opacity 120ms"}}:e):ee,[ee,eW,eL,eV]),eB=(0,n.useMemo)(()=>eT?es.map(e=>eT.has(e.source)&&eT.has(e.target)?{...e,style:{...e.style,stroke:"#e4e4e7",opacity:.9,strokeWidth:1.4}}:{...e,style:{...e.style,opacity:.05}}):eF?es.map(e=>eF.has(e.source)&&eF.has(e.target)?{...e,style:{...e.style,stroke:"#e4e4e7",opacity:.95,strokeWidth:1.6}}:{...e,style:{...e.style,opacity:.05}}):eZ||ei||ec||ep?es.map(e=>{let t=!1;return ei?t=e.id===ei:eZ?t=e.source===eZ||e.target===eZ:ec?t=eO.has(e.id):ep&&(t=q.has(e.source)&&q.has(e.target)),t?{...e,style:{...e.style,stroke:"#e4e4e7",opacity:.95,strokeWidth:1.6}}:{...e,style:{...e.style,opacity:.05}}}):eV?es.map(e=>eV.has(e.source)||eV.has(e.target)?{...e,style:{...e.style,opacity:.05}}:e):es,[es,eZ,ei,ec,eO,ep,q,eF,eV,eT]),eG=(0,n.useMemo)(()=>{let e=ee.map(e=>{let t=_(e.data.inDegree??0);return{id:e.id,group:B.get(e.id)??"(root)",x:e.position.x,y:e.position.y,w:2*t,h:2*t}});return(0,C.S)(e,{pad:60})},[ee,B]),eU=(0,n.useMemo)(()=>{let t=new Map;if(!H)return t;let s=new Map;for(let t of e){let e=H.get(t.path);if(!e)continue;let o=B.get(t.path)??"(root)",n=s.get(o)??new Map;n.set(e,(n.get(e)??0)+1),s.set(o,n)}for(let[e,o]of s){let s=null,n=0,r=!1;for(let[e,t]of o)t>n?(s=e,n=t,r=!1):t===n&&(r=!0);t.set(e,r?null:s)}return t},[H,e,B]),eH=(0,n.useMemo)(()=>{let e=new Map;for(let t of B.values())e.set(t,(e.get(t)??0)+1);return Array.from(e.entries()).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).map(([e,t])=>({group:e,count:t,color:(0,F.i3)(e)}))},[B]),eq=t.filter(e=>e.circular).length,eJ=(0,n.useMemo)(()=>en?t.filter(e=>e.from===en).map(e=>e.to):[],[en,t]),eK=(0,n.useMemo)(()=>en?t.filter(e=>e.to===en).map(e=>e.from):[],[en,t]),eQ=null!==en||em&&J,eY=(0,n.useCallback)(()=>{er(null),eg(!1),eh(!1)},[]);return ej?(0,o.jsxs)("div",{className:"canvas-dots relative h-screen w-full",children:[(0,o.jsxs)(r.Gc,{nodes:eX,edges:eB,nodeTypes:T,onNodesChange:ez,onEdgesChange:eE,onNodeClick:(e,t)=>{er(t.id),ed(null)},onEdgeClick:(e,t)=>{ed(t.id),er(null)},onPaneClick:()=>{er(null),ed(null)},onNodeMouseEnter:(e,t)=>ea(t.id),onNodeMouseLeave:()=>ea(null),onInit:e=>{ev.current=e},onNodeDragStop:(e,t)=>eI(t.id,t.position.x,t.position.y),deleteKeyCode:null,colorMode:"dark",fitView:!0,fitViewOptions:{padding:.1,minZoom:.18,maxZoom:.9},minZoom:.05,panOnScroll:!0,zoomActivationKeyCode:["Meta","Control"],proOptions:{hideAttribution:!0},children:[(0,o.jsx)(S.Z,{regions:"far"===ew?eG:[],tone:"category",lod:ew}),l&&(0,o.jsx)(W,{regions:"far"===ew?[]:eG,dominant:eU}),(0,o.jsx)(Z.J,{onLod:eN,thresholds:R.kz}),(0,o.jsx)(r.H2,{position:"bottom-right",className:"!overflow-hidden !rounded-xl !border !border-white/10 [&_button]:!border-white/10 [&_button]:!bg-card/70 [&_button]:!text-foreground [&_button]:!backdrop-blur"}),(0,o.jsx)(r.Zk,{position:"bottom-right",style:{marginBottom:152},children:(0,o.jsx)($.er,{title:"Legend",trigger:(e,t)=>(0,o.jsx)("button",{type:"button",onClick:t,title:"Legend",className:(0,P.cn)("glass flex size-8 items-center justify-center rounded-lg transition-colors",e?"text-foreground":"text-muted-foreground hover:text-foreground"),children:(0,o.jsx)(h.A,{className:"size-4"})}),children:(0,o.jsxs)("ul",{className:"space-y-1.5 text-[10.5px] text-muted-foreground",children:[(0,o.jsxs)("li",{className:"flex items-center gap-2",children:[(0,o.jsx)("span",{"aria-hidden":!0,className:"inline-block size-2.5 shrink-0 rounded-full bg-zinc-400"}),(0,o.jsx)("span",{children:"a file \xb7 bigger dot = more files import it"})]}),l&&(0,o.jsxs)("li",{className:"flex items-center gap-2",children:[(0,o.jsx)("span",{"aria-hidden":!0,className:"inline-block size-2.5 shrink-0 rounded-full",style:{boxShadow:`inset 0 0 0 2px ${z.ZD.frontend}`}}),(0,o.jsx)("span",{children:"colored ring \xb7 frontend / backend layer"})]}),(0,o.jsxs)("li",{className:"flex items-center gap-2",children:[(0,o.jsx)("span",{"aria-hidden":!0,className:"inline-block h-px w-6 bg-[#4a4a52]"}),(0,o.jsx)("span",{children:"line \xb7 imports another file"})]}),(0,o.jsxs)("li",{className:"flex items-center gap-2",children:[(0,o.jsx)("span",{"aria-hidden":!0,className:"inline-block h-px w-6 bg-red-400"}),(0,o.jsx)("span",{children:"red \xb7 part of an import cycle"})]}),(0,o.jsxs)("li",{className:"flex items-center gap-2",children:[(0,o.jsxs)("span",{"aria-hidden":!0,className:"inline-flex shrink-0 gap-0.5",children:[(0,o.jsx)("span",{className:"inline-block size-2 rounded-full bg-violet-400"}),(0,o.jsx)("span",{className:"inline-block size-2 rounded-full bg-amber-400"})]}),(0,o.jsx)("span",{children:"dot color \xb7 its directory (chips, top-right)"})]})]})})}),(0,o.jsx)(r.of,{pannable:!0,zoomable:!0,position:"bottom-left",style:{width:140,height:90},className:"!overflow-hidden !rounded-xl !border !border-white/10 !bg-card/50 !backdrop-blur",nodeColor:()=>"#555"}),eS.length>0&&!e$.active&&(0,o.jsx)(r.Zk,{position:"top-left",className:"!mt-14",children:(0,o.jsxs)("button",{type:"button",onClick:e$.start,title:"Guided, dependency-ordered walkthrough of the codebase",className:"glass flex items-center gap-1.5 rounded-xl px-3 py-1.5 text-[11px] text-muted-foreground transition-colors hover:text-foreground",children:[(0,o.jsx)(f.A,{className:"size-3.5"}),"Start tour"]})}),(0,o.jsx)(r.Zk,{position:"top-center",className:"glass rounded-full px-1 py-0.5",children:(0,o.jsx)(y.Z,{active:"FILES",tabs:[{value:"ROADMAP",label:"Roadmap",href:"/map?view=ROADMAP"},{value:"ARCHITECTURE",label:"Architecture",href:"/map?view=ARCHITECTURE"},{value:"DATABASE",label:"Database",href:"/map?view=DATABASE"},{value:"FILES",label:"Files",href:"/map?view=FILES"}]})}),(0,o.jsx)(r.Zk,{position:"top-right",className:"glass !mt-14 flex max-w-[300px] flex-wrap items-center justify-end gap-x-2.5 gap-y-1 rounded-xl px-3 py-1.5",children:eH.map(t=>(0,o.jsxs)("button",{type:"button",onClick:()=>{let s=e.filter(e=>(B.get(e.path)??"(root)")===t.group).map(e=>({id:e.path}));s.length&&ev.current?.fitView({nodes:s,duration:600,padding:.3,maxZoom:1})},title:`${t.count} files — click to zoom to ${t.group}`,className:"flex items-center gap-1.5 rounded px-1 py-0.5 text-[10px] text-muted-foreground transition-colors hover:bg-white/[0.06] hover:text-foreground",children:[(0,o.jsx)("span",{"aria-hidden":!0,className:"size-2 shrink-0 rounded-full",style:{backgroundColor:t.color}}),t.group]},t.group))}),(0,o.jsxs)(r.Zk,{position:"top-right",className:"flex items-center gap-2",children:[(0,o.jsx)(j.X,{query:eb,onQuery:ey,hits:eP,placeholder:"Find a file…",onPick:e=>{ey(""),eM(e)},onZoomToMatches:()=>{eF?.size&&ev.current?.fitView({nodes:[...eF].map(e=>({id:e})),duration:600,padding:.3})}}),l&&(0,o.jsx)(A.o,{value:ef,onChange:ex,options:["frontend","backend"]}),(0,o.jsxs)("div",{className:"glass flex items-center gap-3 rounded-xl px-3 py-1.5 text-[11px]",children:[(0,o.jsxs)("span",{className:"text-muted-foreground",children:[e.length," files \xb7 ",t.length," imports"]}),eq>0&&(0,o.jsxs)("button",{type:"button",onClick:()=>{eu(e=>!e),er(null),ed(null)},title:ec?"Show all imports":"Show only files involved in import cycles",className:(0,P.cn)("flex items-center gap-1.5 rounded-md px-1.5 py-0.5 transition-colors",ec?"bg-red-500/15 text-red-200 ring-1 ring-red-400/40":"text-red-300 hover:bg-red-500/10"),children:[(0,o.jsx)("span",{"aria-hidden":!0,className:"inline-block h-0 w-5 border-t border-dashed",style:{borderColor:"#ef4444"}}),eq," circular"]}),J&&(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)("button",{type:"button",onClick:eC,title:ep?"Show all files again":"Focus + zoom to the files edited this session",className:(0,P.cn)("flex items-center gap-1.5 rounded-md px-1.5 py-0.5 transition-colors",ep?"bg-teal-500/15 text-teal-200 ring-1 ring-teal-400/40":"text-teal-300 hover:bg-teal-500/10"),children:[(0,o.jsx)(x.A,{className:"size-3"}),q.size," edited"]})})]})]})]}),eQ&&(0,o.jsxs)(b.b,{className:"absolute bottom-3 right-3 top-16 z-10 flex w-72 flex-col rounded-2xl",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between border-b border-white/10 px-3.5 py-2.5",children:[(0,o.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:en?"File":"Edited this session"}),(0,o.jsx)("button",{onClick:eY,title:"Close panel",className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground",children:(0,o.jsx)(m.A,{className:"size-4"})})]}),(0,o.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-3",children:en?(0,o.jsxs)("div",{className:"space-y-3",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"flex items-start gap-1.5",children:[(0,o.jsx)(g.A,{className:"mt-0.5 size-4 shrink-0 text-muted-foreground"}),(0,o.jsx)("h2",{className:"break-all text-sm font-semibold leading-tight",children:en.slice(en.lastIndexOf("/")+1)})]}),(0,o.jsx)("div",{className:"mt-0.5 break-all font-mono text-[10px] text-muted-foreground",children:en})]}),(0,o.jsxs)("div",{className:"flex flex-wrap gap-1",children:[(X=q.get(en))?(0,o.jsxs)("span",{className:"rounded bg-teal-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-teal-300",children:["edited ",X.count,"\xd7"]}):null,U.has(en)&&(0,o.jsx)("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-amber-300",children:"untested"})]}),(0,o.jsx)("button",{onClick:()=>fetch(`/api/open?path=${encodeURIComponent(en)}`).catch(()=>{}),className:"w-full rounded-md border border-white/10 px-2 py-1.5 text-[11px] text-muted-foreground transition-colors hover:bg-white/[0.06] hover:text-foreground",children:"Open in editor"}),(0,o.jsx)(V,{label:"Imports",paths:eJ,onPick:eM}),(0,o.jsx)(V,{label:"Imported by",paths:eK,onPick:eM})]}):(0,o.jsx)("ul",{className:"space-y-0.5",children:K.map(e=>(0,o.jsx)("li",{children:(0,o.jsxs)("button",{onClick:()=>eM(e.path),title:e.path,className:"flex w-full items-center justify-between gap-2 rounded px-2 py-1 text-left transition-colors hover:bg-white/[0.06]",children:[(0,o.jsx)("span",{className:"truncate text-[11px] text-foreground/90",children:e.label}),(0,o.jsxs)("span",{className:"shrink-0 text-[9px] text-teal-300/80",children:[e.count,"\xd7"]})]})},e.path))})})]}),e$.active&&e$.step&&(0,o.jsx)(N.d,{steps:eS,index:e$.index,onPrev:e$.prev,onNext:e$.next,onExit:e$.stop,onGoto:e$.goto})]}):(0,o.jsx)("div",{className:"flex h-screen w-full items-center justify-center text-sm text-muted-foreground",children:"Loading graph…"})}function V({label:e,paths:t,onPick:s}){return t.length?(0,o.jsxs)("div",{children:[(0,o.jsxs)("h3",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[e," (",t.length,")"]}),(0,o.jsx)("ul",{className:"space-y-0.5",children:t.map(e=>(0,o.jsx)("li",{children:(0,o.jsx)("button",{onClick:()=>s(e),title:e,className:"block w-full truncate rounded px-1.5 py-0.5 text-left font-mono text-[10px] text-muted-foreground transition-colors hover:bg-white/5 hover:text-foreground",children:e.slice(e.lastIndexOf("/")+1)})},e))})]}):null}}},e=>{e.O(0,[2574,3862,8500,4888,8997,2500,766,3343,1439,7323,8441,3794,7358],()=>e(e.s=39454)),_N_E=e.O()}]);