trybeacon 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +13 -13
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/docs.html +1 -1
- package/.next/server/app/docs.rsc +1 -1
- package/.next/server/app/docs.segments/_full.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_index.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/docs.segments/docs.segment.rsc +1 -1
- package/.next/server/app/feedback/page_client-reference-manifest.js +1 -1
- package/.next/server/app/feedback.html +1 -1
- package/.next/server/app/feedback.rsc +1 -1
- package/.next/server/app/feedback.segments/_full.segment.rsc +1 -1
- package/.next/server/app/feedback.segments/_head.segment.rsc +1 -1
- package/.next/server/app/feedback.segments/_index.segment.rsc +1 -1
- package/.next/server/app/feedback.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/feedback.segments/feedback/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/feedback.segments/feedback.segment.rsc +1 -1
- package/.next/server/app/help/page_client-reference-manifest.js +1 -1
- package/.next/server/app/help.html +1 -1
- package/.next/server/app/help.rsc +1 -1
- package/.next/server/app/help.segments/_full.segment.rsc +1 -1
- package/.next/server/app/help.segments/_head.segment.rsc +1 -1
- package/.next/server/app/help.segments/_index.segment.rsc +1 -1
- package/.next/server/app/help.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/help.segments/help/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/help.segments/help.segment.rsc +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +1 -1
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/map/page.js +2 -2
- package/.next/server/app/map/page.js.nft.json +1 -1
- package/.next/server/app/map/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/plan/page.js +2 -2
- package/.next/server/app/plan/page.js.nft.json +1 -1
- package/.next/server/app/plan/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +13 -13
- package/.next/server/chunks/1093.js +1 -0
- package/.next/server/chunks/1130.js +1 -1
- package/.next/server/chunks/2933.js +1 -1
- package/.next/server/chunks/4490.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/598-236d8c7f0c45d79c.js +1 -0
- package/.next/static/chunks/app/map/{page-621463528037d2d0.js → page-a0095fd5d001a673.js} +1 -1
- package/.next/static/chunks/app/plan/{page-95a91a84bb930fc3.js → page-ba750d6f084811fa.js} +1 -1
- package/.next/trace +37 -37
- package/.next/trace-build +1 -1
- package/package.json +1 -1
- package/.next/server/chunks/389.js +0 -1
- package/.next/static/chunks/5916-65b61f02167fdaa0.js +0 -1
- /package/.next/static/{gRhUG5vdhfWUACit2_jxj → xrzeVVXRkKHe2ydUkBd70}/_buildManifest.js +0 -0
- /package/.next/static/{gRhUG5vdhfWUACit2_jxj → xrzeVVXRkKHe2ydUkBd70}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5916],{4474:(e,t,s)=>{s.d(t,{$:()=>i});var n=s(95155),a=s(6539),r=s(18460),l=s(91337);let o=(0,r.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 i({className:e,variant:t="default",size:s="default",...r}){return(0,n.jsx)(a.Button,{"data-slot":"button",className:(0,l.cn)(o({variant:t,size:s,className:e})),...r})}},18874:(e,t,s)=>{s.d(t,{F1:()=>o,e6:()=>r,qA:()=>a,ru:()=>l});let n={auth:"#4ea1ff",firms:"#c792ea",search:"#7bd389",storage:"#ffb86b",petitions:"#ff7a45",monitoring:"#f5b942",admin:"#ff6b9d"};function a(e){return e&&n[e]||"#8a8a8a"}let r={GET:"#7bd389",POST:"#4ea1ff",PUT:"#ffb86b",PATCH:"#ffb86b",DELETE:"#ff3860"},l={read:"#4ea1ff",write:"#ffb86b","read-write":"#c792ea"};function o(e,t){let s=new Set([e]);for(let n of t)n.source===e&&s.add(n.target),n.target===e&&s.add(n.source);return s}},26518:(e,t,s)=>{s.d(t,{bq:()=>w,eb:()=>C,gC:()=>k,l6:()=>y,yv:()=>N});var n=s(95155);s(12115);var a=s(40595),r=s(41294),l=s(75681),o=s(17314),i=s(37265),d=s(23107),c=s(70826),u=s(67564),m=s(1938),p=s(15433),x=s(5919),h=s(45450),f=s(88988),g=s(91337),b=s(12363),v=s(64577),j=s(94088);let y=a.H;function N({className:e,...t}){return(0,n.jsx)(r.y,{"data-slot":"select-value",className:(0,g.cn)("flex flex-1 text-left",e),...t})}function w({className:e,size:t="default",children:s,...a}){return(0,n.jsxs)(l.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),...a,children:[s,(0,n.jsx)(o.w,{render:(0,n.jsx)(b.A,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function k({className:e,children:t,side:s="bottom",sideOffset:a=4,align:r="center",alignOffset:l=0,alignItemWithTrigger:o=!0,...m}){return(0,n.jsx)(i.V,{children:(0,n.jsx)(d.l,{side:s,sideOffset:a,align:r,alignOffset:l,alignItemWithTrigger:o,className:"isolate z-50",children:(0,n.jsxs)(c.t,{"data-slot":"select-content","data-align-trigger":o,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,n.jsx)(E,{}),(0,n.jsx)(u.B,{children:t}),(0,n.jsx)(S,{})]})})})}function C({className:e,children:t,...s}){return(0,n.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),...s,children:[(0,n.jsx)(p.h,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),(0,n.jsx)(x.h,{render:(0,n.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:(0,n.jsx)(v.A,{className:"pointer-events-none"})})]})}function E({className:e,...t}){return(0,n.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,n.jsx)(j.A,{})})}function S({className:e,...t}){return(0,n.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,n.jsx)(b.A,{})})}},26856:(e,t,s)=>{s.d(t,{DbMapClient:()=>Q});var n=s(95155),a=s(12115),r=s(73321),l=s(81750),o=s(6266);s(53255);var i=s(81499),d=s(51128),c=s(65738),u=s(9005),m=s(2125),p=s(91337),x=s(18874);let h=(0,a.createContext)(null);function f(){let e=(0,a.useContext)(h);if(!e)throw Error("useDbEdit must be used inside DbEditContext");return e}var g=s(95635);let b={danger:"bg-red-500/15 text-red-300",warn:"bg-amber-500/15 text-amber-300"};function v({badges:e,className:t}){return e.length?(0,n.jsx)("span",{className:(0,p.cn)("flex shrink-0 items-center gap-0.5",t),children:e.map(e=>(0,n.jsx)("span",{title:e.title,className:(0,p.cn)("rounded px-1 text-[8px] font-semibold uppercase tracking-wide",b[e.tone]),children:e.label},e.label))}):null}let j=/pass(word)?|token|secret|api[_-]?key|credential|priv(ate)?[_-]?key|hash|salt/i,y=/auth|login|logout|session|token|password|oauth|sso|credential/i,N="nodrag nopan",w=g.x,k="nodrag nopan",C=["GET","POST","PUT","PATCH","DELETE"];var E=s(32133),S=s(82099),A=s(4474);let z=[{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 s of e.tables){let e=`Table \`${s.name}\``+(s.domain?` (domain: ${s.domain})`:"")+(s.description?` — ${s.description}`:"");for(let n of(t.push(e),s.columns)){let e=[n.isPk&&"PK",n.isFk&&"FK",!1===n.nullable&&"NOT NULL"].filter(Boolean).join(", ");t.push(` - ${n.name}: ${n.type}`+(e?` [${e}]`:"")+(n.note?` — ${n.note}`:""))}t.push("")}if(e.relations.length){for(let s of(t.push("Foreign keys:"),e.relations))t.push(` - ${s.fromTable}.${s.fromColumn} -> ${s.toTable}.${s.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 s of e.tables){for(let e of(t.push(`Table ${s.name} {`),s.columns)){let s=[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}`+(s?` [${s}]`:""))}t.push("}","")}for(let s of e.relations)t.push(`Ref: ${s.fromTable}.${s.fromColumn} > ${s.toTable}.${s.toColumn}`);return t.join("\n").trim()}},{id:"sql",label:"SQL DDL",fn:function(e){let t=[];for(let s of e.tables){t.push(`CREATE TABLE ${s.name} (`);let n=s.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(" ")}),a=e.relations.filter(e=>e.fromTable===s.name).map(e=>` FOREIGN KEY (${e.fromColumn}) REFERENCES ${e.toTable}(${e.toColumn})`);t.push([...n,...a].join(",\n")),t.push(");","")}return t.join("\n").trim()}}];function T({draftGraph:e}){let[t,s]=(0,a.useState)(null);if(0===e.tables.length)return null;async function r(t){await navigator.clipboard.writeText(t.fn(e)).catch(()=>{}),s(t.id),setTimeout(()=>s(null),1500)}return(0,n.jsxs)("div",{className:"space-y-2 rounded-xl border border-sky-400/20 bg-sky-500/[0.04] p-3",children:[(0,n.jsxs)("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-sky-300",children:["Rascunho \xb7 ",e.tables.length," tabelas"]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,n.jsx)("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"copiar:"}),z.map(e=>(0,n.jsx)(A.$,{size:"sm",variant:"outline",className:"h-6 px-2 text-[11px]",onClick:()=>r(e),children:t===e.id?"✓":e.label},e.id))]})]})}function I({selected:e,tables:t,relations:s,endpoints:a,draftGraph:r,onClose:l,commentsContent:o,commentsCount:i=0,activeTab:d,onTabChange:c,onAddComment:m,topOffset:p}){let x,h,f=new Map(t.map(e=>[e.id,e.name])),g=!!o,b=d??"details",v=e?.kind==="table"?t.find(t=>t.id===e.id)?.name??null:e?.kind==="endpoint"&&(h=a.find(t=>t.id===e.id))?`${h.method} ${h.path}`:null;if(e?.kind==="table"){let r=t.find(t=>t.id===e.id);x=r?(0,n.jsx)(D,{table:r,relations:s,endpoints:a,nameById:f}):null}else if(e?.kind==="endpoint"){let t=a.find(t=>t.id===e.id);x=t?(0,n.jsx)(M,{ep:t,nameById:f}):null}else x=(0,n.jsx)($,{tables:t,relations:s,endpoints:a});return(0,n.jsxs)(S.b,{className:"absolute bottom-3 right-3 z-10 flex w-80 flex-col rounded-2xl",style:{top:p??12},children:[g?(0,n.jsxs)("div",{className:"flex items-center justify-between border-b border-white/10 px-1 py-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,n.jsx)(R,{active:"details"===b,onClick:()=>c?.("details"),children:"Details"}),(0,n.jsxs)(R,{active:"comments"===b,onClick:()=>c?.("comments"),children:["Comments",i>0&&(0,n.jsx)("span",{className:"ml-1 rounded-full bg-white/10 px-1 text-[9px] font-semibold leading-4",children:i})]})]}),(0,n.jsx)("button",{onClick:l,title:"Close panel",className:"mr-1 rounded-md p-1 text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground",children:(0,n.jsx)(u.A,{className:"size-4"})})]}):(0,n.jsxs)("div",{className:"flex items-center justify-between border-b border-white/10 px-3.5 py-2.5",children:[(0,n.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Panel"}),(0,n.jsx)("button",{onClick:l,title:"Close panel",className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground",children:(0,n.jsx)(u.A,{className:"size-4"})})]}),(0,n.jsx)("div",{className:"flex-1 overflow-y-auto",children:"comments"===b&&g?(0,n.jsx)("div",{className:"p-3",children:o}):(0,n.jsxs)(n.Fragment,{children:[r.tables.length>0&&(0,n.jsx)("div",{className:"border-b border-white/10 p-3.5",children:(0,n.jsx)(T,{draftGraph:r})}),(0,n.jsxs)("div",{className:"p-4",children:[m&&v&&(0,n.jsxs)("button",{type:"button",onClick:()=>m(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,n.jsx)(E.A,{className:"size-3.5"}),"Comment on this ",e?.kind==="endpoint"?"endpoint":"table"]}),x]})]})})]})}function R({active:e,onClick:t,children:s}){return(0,n.jsx)("button",{type:"button",onClick:t,className:(0,p.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:s})}function D({table:e,relations:t,endpoints:s,nameById:a}){let r=t.filter(t=>t.fromTableId===e.id),l=t.filter(t=>t.toTableId===e.id),o=s.map(t=>({e:t,u:t.tables.find(t=>t.tableId===e.id)})).filter(e=>e.u);return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-xs uppercase tracking-wide",style:{color:(0,x.qA)(e.domain)},children:e.domain??"table"}),(0,n.jsx)("h2",{className:"font-mono text-lg font-semibold",children:e.name}),e.description&&(0,n.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:e.description})]}),(0,n.jsx)(P,{title:`Columns (${e.columns.length})`,children:(0,n.jsx)("ul",{className:"space-y-0.5",children:e.columns.map(e=>(0,n.jsxs)("li",{className:"flex items-center gap-1.5 text-xs",children:[e.isPk?(0,n.jsx)(i.A,{className:"size-3 text-amber-400"}):e.isFk?(0,n.jsx)(d.A,{className:"size-3 text-sky-400"}):(0,n.jsx)("span",{className:"size-3"}),(0,n.jsx)("span",{className:"font-mono",children:e.name}),(0,n.jsxs)("span",{className:"ml-auto font-mono text-[10px] text-muted-foreground",children:[e.type,!e.nullable&&" \xb7NN"]})]},e.name))})}),r.length>0&&(0,n.jsx)(P,{title:"References (FK out)",children:(0,n.jsx)("ul",{className:"space-y-1 text-xs",children:r.map(e=>(0,n.jsxs)("li",{className:"font-mono text-muted-foreground",children:[e.fromColumn," → ",a.get(e.toTableId),".",e.toColumn]},e.id))})}),l.length>0&&(0,n.jsx)(P,{title:"Referenced by (FK in)",children:(0,n.jsx)("ul",{className:"space-y-1 text-xs",children:l.map(e=>(0,n.jsxs)("li",{className:"font-mono text-muted-foreground",children:[a.get(e.fromTableId),".",e.fromColumn]},e.id))})}),o.length>0&&(0,n.jsx)(P,{title:`Used by endpoints (${o.length})`,children:(0,n.jsx)("ul",{className:"space-y-1 text-xs",children:o.map(({e,u:t})=>(0,n.jsxs)("li",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{style:{color:x.e6[e.method]},className:"font-bold",children:e.method}),(0,n.jsx)("span",{className:"truncate font-mono",children:e.path}),(0,n.jsx)("span",{className:"ml-auto",style:{color:x.ru[t.access]},children:t.access})]},e.id))})})]})}function M({ep:e,nameById:t}){return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"rounded px-1.5 py-0.5 text-[11px] font-bold",style:{background:`${x.e6[e.method]}22`,color:x.e6[e.method]},children:e.method}),(0,n.jsx)("h2",{className:"mt-2 font-mono text-base font-semibold",children:e.path}),e.description&&(0,n.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:e.description})]}),(0,n.jsx)(P,{title:`Tables used (${e.tables.length})`,children:(0,n.jsx)("ul",{className:"space-y-1 text-xs",children:e.tables.map(e=>(0,n.jsxs)("li",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"font-mono",children:t.get(e.tableId)}),(0,n.jsx)("span",{className:"ml-auto",style:{color:x.ru[e.access]},children:e.access})]},e.tableId))})})]})}function $({tables:e,relations:t,endpoints:s}){return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-sm font-semibold",children:"Database"}),(0,n.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,n.jsxs)("dl",{className:"grid grid-cols-3 gap-2 text-center",children:[(0,n.jsx)(L,{label:"tables",value:e.length}),(0,n.jsx)(L,{label:"FKs",value:t.length}),(0,n.jsx)(L,{label:"endpoints",value:s.length})]}),(0,n.jsx)(P,{title:"Legend",children:(0,n.jsxs)("ul",{className:"space-y-1 text-xs text-muted-foreground",children:[(0,n.jsxs)("li",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(i.A,{className:"size-3 text-amber-400"})," primary key"]}),(0,n.jsxs)("li",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(d.A,{className:"size-3 text-sky-400"})," foreign key"]}),(0,n.jsx)("li",{children:"— gray line: FK relation between tables"}),(0,n.jsx)("li",{children:"– – dashed line: endpoint uses table (read/write)"})]})})]})}function P({title:e,children:t}){return(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:e}),t]})}function L({label:e,value:t}){return(0,n.jsxs)("div",{className:"rounded-lg border border-white/10 bg-white/[0.03] py-2",children:[(0,n.jsx)("div",{className:"text-lg font-semibold",children:t}),(0,n.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:e})]})}var O=s(56614),F=s(62311);let _=new Set(["GET","HEAD","OPTIONS"]),H=e=>e.trim().toLowerCase();var B=s(80846),U=s(17356),K=s(45486),X=s(15330),G=s(60976),Z=s(64577),Y=s(57144);let W={dbTable:function({id:e,data:t,selected:s}){var r;let l,o,h="DRAFT"===t.source,g="added"===t.diffStatus?"#7bd389":"modified"===t.diffStatus?"#ffb86b":"#4ea1ff",b="added"===t.diffStatus?"new":"modified"===t.diffStatus?"changed":"draft",y=t.diffChanges?.length?t.diffChanges.join("\n"):"draft",k=h?g:(0,x.qA)(t.domain),C=(r={domain:t.domain,columns:t.columns},l=[],(o=r.columns.filter(e=>j.test(e.name)).map(e=>e.name)).length&&l.push({label:"secrets",tone:"danger",title:`stores credentials: ${o.join(", ")}`}),r.domain&&/auth/i.test(r.domain)&&l.push({label:"auth",tone:"warn",title:"auth-domain table"}),l),E=f(),[S,A]=(0,a.useState)(t.name),[z,T]=(0,a.useState)(t.columns),[I,R]=(0,a.useState)(!1);(0,a.useEffect)(()=>{A(t.name),T(t.columns)},[t.rev]);let D=e=>e.stopPropagation(),M=t=>{T(t),E.patchTable(e,{columns:t})};return h?(0,n.jsxs)("div",{className:(0,p.cn)("w-[252px] overflow-hidden rounded-md border border-dashed bg-card text-card-foreground shadow-sm",s&&"ring-2 ring-[var(--accent,#f5b942)]"),style:{borderColor:`${g}88`},children:[(0,n.jsx)(w,{}),(0,n.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1.5",style:{background:`${k}1f`},children:[(0,n.jsx)("span",{title:y,className:"inline-block size-1.5 shrink-0 rounded-full",style:{background:g}}),(0,n.jsx)("input",{value:S,onChange:e=>A(e.target.value),onBlur:()=>{let s=S.trim();s&&s!==t.name&&E.patchTable(e,{name:s})},onKeyDown:e=>{D(e),"Enter"===e.key&&e.currentTarget.blur()},placeholder:"table",className:(0,p.cn)(N,"min-w-0 flex-1 bg-transparent font-mono text-sm font-semibold outline-none")}),(0,n.jsx)(v,{badges:C}),(0,n.jsx)("span",{title:y,className:"shrink-0 rounded px-1 text-[9px] uppercase tracking-wide",style:{background:`${g}26`,color:g},children:b}),(0,n.jsx)("button",{type:"button",onClick:t=>{D(t),I?E.deleteTable(e):R(!0)},onBlur:()=>R(!1),title:"Delete table",className:(0,p.cn)(N,"shrink-0 transition-colors",I?"text-red-300":"text-muted-foreground hover:text-red-300"),children:(0,n.jsx)(c.A,{className:"size-3"})})]}),(0,n.jsxs)("div",{className:"divide-y divide-border/40",children:[z.map((e,t)=>(0,n.jsxs)("div",{className:"flex items-center gap-1 px-2 py-0.5 text-[11px]",children:[(0,n.jsx)("button",{type:"button",onClick:e=>{D(e),M(z.map((e,s)=>s===t?{...e,isPk:!e.isPk}:e))},title:"Primary key",className:(0,p.cn)(N,"shrink-0",e.isPk?"text-amber-400":"text-muted-foreground/40 hover:text-amber-400"),children:(0,n.jsx)(i.A,{className:"size-3"})}),(0,n.jsx)("button",{type:"button",onClick:e=>{D(e),M(z.map((e,s)=>s===t?{...e,isFk:!e.isFk}:e))},title:"Foreign key",className:(0,p.cn)(N,"shrink-0",e.isFk?"text-sky-400":"text-muted-foreground/40 hover:text-sky-400"),children:(0,n.jsx)(d.A,{className:"size-3"})}),(0,n.jsx)("input",{value:e.name,onChange:e=>T(s=>s.map((s,n)=>n===t?{...s,name:e.target.value}:s)),onBlur:()=>M(z),onKeyDown:D,placeholder:"column",className:(0,p.cn)(N,"min-w-0 flex-1 bg-transparent font-mono outline-none")}),(0,n.jsx)("input",{value:e.type,onChange:e=>T(s=>s.map((s,n)=>n===t?{...s,type:e.target.value}:s)),onBlur:()=>M(z),onKeyDown:D,placeholder:"type",className:(0,p.cn)(N,"w-16 shrink-0 bg-transparent text-right font-mono text-[10px] text-muted-foreground outline-none")}),(0,n.jsx)("button",{type:"button",onClick:e=>{D(e),M(z.filter((e,s)=>s!==t))},title:"Remove column",className:(0,p.cn)(N,"shrink-0 text-muted-foreground/40 hover:text-red-300"),children:(0,n.jsx)(u.A,{className:"size-3"})})]},t)),(0,n.jsxs)("button",{type:"button",onClick:e=>{D(e),M([...z,{name:"",type:"text",isPk:!1,isFk:!1,nullable:!0,note:null}])},className:(0,p.cn)(N,"flex w-full items-center gap-1 px-2 py-1 text-[10px] text-muted-foreground hover:text-foreground"),children:[(0,n.jsx)(m.A,{className:"size-3"})," column"]})]})]}):(0,n.jsxs)("div",{className:(0,p.cn)("w-[232px] overflow-hidden rounded-md border bg-card text-card-foreground shadow-sm",s&&"ring-2 ring-[var(--accent,#f5b942)]"),style:{borderColor:`${k}55`},children:[(0,n.jsx)(w,{}),(0,n.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5",style:{background:`${k}1f`},children:[(0,n.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-sm font-semibold",children:["INTROSPECTION"===t.source&&(0,n.jsx)("span",{title:"live — derived from your code",className:"inline-block size-1.5 rounded-full bg-emerald-400"}),t.name]}),(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(v,{badges:C}),t.domain&&(0,n.jsx)("span",{className:"text-[10px] uppercase tracking-wide",style:{color:k},children:t.domain})]})]}),(0,n.jsx)("div",{className:"divide-y divide-border/40",children:t.columns.map(e=>(0,n.jsxs)("div",{className:"flex items-center gap-1.5 px-2.5 py-1 text-[11px]",children:[e.isPk?(0,n.jsx)(i.A,{className:"size-3 shrink-0 text-amber-400"}):e.isFk?(0,n.jsx)(d.A,{className:"size-3 shrink-0 text-sky-400"}):(0,n.jsx)("span",{className:"size-3 shrink-0"}),(0,n.jsx)("span",{className:(0,p.cn)("font-mono",e.isPk&&"font-semibold"),children:e.name}),(0,n.jsx)("span",{className:"ml-auto truncate font-mono text-[10px] text-muted-foreground",children:e.type})]},e.name))})]})},endpoint:function({id:e,data:t,selected:s}){var r;let l,o=x.e6[t.method]??"#8a8a8a",i="DRAFT"===t.source,d="added"===t.diffStatus?"#7bd389":"modified"===t.diffStatus?"#ffb86b":"#4ea1ff",u="added"===t.diffStatus?"new":"modified"===t.diffStatus?"changed":"draft",m=t.diffChanges?.length?t.diffChanges.join("\n"):"draft",h=(r={method:t.method,domain:t.domain,path:t.path},l=[],/^delete$/i.test(r.method.trim())&&l.push({label:"DELETE",tone:"danger",title:"destructive: deletes data"}),(r.domain&&/auth/i.test(r.domain)||y.test(r.path))&&l.push({label:"auth",tone:"warn",title:"auth-related endpoint"}),l),b=f(),[j,N]=(0,a.useState)(t.path),[w,E]=(0,a.useState)(!1);(0,a.useEffect)(()=>{N(t.path)},[t.rev]);let S=e=>e.stopPropagation();return(0,n.jsxs)("div",{className:(0,p.cn)("group flex w-[240px] items-center gap-2 rounded-md border bg-card px-2.5 py-1.5 text-card-foreground shadow-sm",i?"border-dashed":"border-border",s&&"ring-2 ring-[var(--accent,#f5b942)]"),style:i?{borderColor:`${d}88`,background:`${d}0f`}:void 0,children:[(0,n.jsx)(g.x,{}),"INTROSPECTION"===t.source&&(0,n.jsx)("span",{title:"live — derived from your code",className:"inline-block size-1.5 shrink-0 rounded-full bg-emerald-400"}),i?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("select",{value:t.method,onChange:t=>b.patchEndpoint(e,{method:t.target.value}),onPointerDown:S,className:(0,p.cn)(k,"shrink-0 rounded bg-transparent text-[10px] font-bold outline-none"),style:{color:o},title:"Method",children:C.map(e=>(0,n.jsx)("option",{value:e,className:"bg-card text-foreground",children:e},e))}),(0,n.jsx)("input",{value:j,onChange:e=>N(e.target.value),onBlur:()=>{let s=j.trim();s&&s!==t.path&&b.patchEndpoint(e,{path:s})},onKeyDown:e=>{S(e),"Enter"===e.key&&e.currentTarget.blur()},className:(0,p.cn)(k,"min-w-0 flex-1 bg-transparent font-mono text-[11px] outline-none")}),(0,n.jsx)(v,{badges:h}),(0,n.jsx)("span",{title:m,className:"shrink-0 rounded px-1 py-0.5 text-[8px] font-semibold uppercase",style:{background:`${d}26`,color:d},children:u}),(0,n.jsx)("button",{type:"button",onClick:t=>{S(t),w?b.deleteEndpoint(e):E(!0)},onBlur:()=>E(!1),title:"Delete",className:(0,p.cn)(k,"shrink-0 transition-colors",w?"text-red-300":"text-muted-foreground hover:text-red-300"),children:(0,n.jsx)(c.A,{className:"size-3"})})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"rounded px-1.5 py-0.5 text-[10px] font-bold",style:{background:`${o}22`,color:o},children:t.method}),(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px]",children:t.path}),(0,n.jsx)(v,{badges:h}),(0,n.jsx)("button",{type:"button",onClick:t=>{S(t),w?b.deleteRealEndpoint(e):E(!0)},onBlur:()=>E(!1),title:w?"Click again to delete":"Delete endpoint",className:(0,p.cn)(k,"shrink-0 opacity-0 transition-opacity group-hover:opacity-100",w?"text-red-300 opacity-100":"text-muted-foreground hover:text-red-300"),children:(0,n.jsx)(c.A,{className:"size-3"})})]})]})}},q={deletable:Y.I},V="beacon:db-draft",J={proposedAt:0,status:"pending",tables:[],relations:[],endpoints:[]};function Q({tables:e,relations:t,endpoints:s,draft:i,workspaceId:d,embedded:u=!1,draftRef:m,onEdit:f,controlRef:g,commentsContent:b,commentsCount:v=0,onAddComment:j}){let y=(0,r.useRouter)(),[N,w]=(0,a.useState)(!0),[k,C]=(0,a.useState)(null),[E,S]=(0,a.useState)(null),[A,z]=(0,a.useState)(!1),[T,R]=(0,a.useState)("details"),[D,M]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(g)return g.current={open:()=>{z(!0),R("details")},close:()=>{z(!1),R("details")},openComments:()=>{z(!0),R("comments")}},()=>{g&&(g.current=null)}},[g]);let[$,P]=(0,a.useState)(new Set),[L,Y]=(0,a.useState)(new Set),[ee,et]=(0,a.useState)(new Set),[es,en]=(0,a.useState)(()=>({past:[],present:i??J,future:[],rev:0,edited:!1})),ea=es.present,er=(0,a.useCallback)(e=>{en(t=>{let s=e(t.present);return s===t.present?t:{past:[...t.past,t.present].slice(-100),present:s,future:[],rev:t.rev+1,edited:!0}})},[]),el=(0,a.useCallback)(e=>{en(t=>{let s=e(t.present);return s===t.present?t:{...t,present:s}})},[]),eo=(0,a.useCallback)(()=>en(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),[]),ei=(0,a.useCallback)(()=>en(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),[]),ed=(0,a.useCallback)(e=>en(t=>({past:[],present:e,future:[],rev:t.rev+1,edited:!1})),[]),ec=(0,a.useRef)(!1),eu=i?.proposedAt??0;(0,a.useEffect)(()=>{let e=null;if(ec.current)i&&i.proposedAt!==ea.proposedAt?e=i:!i&&(ea.tables.length>0||ea.endpoints.length>0)&&(e=J);else{ec.current=!0;let t=null;try{let e=localStorage.getItem(V);if(e){let s=JSON.parse(e);s.workspaceId===d&&s.doc&&i&&s.doc.proposedAt===i.proposedAt&&(t=s.doc)}}catch{}e=t??i??null}e&&ed(e)},[eu]),(0,a.useEffect)(()=>{try{ea.tables.length>0||ea.endpoints.length>0?localStorage.setItem(V,JSON.stringify({workspaceId:d,doc:ea})):localStorage.removeItem(V)}catch{}},[ea,d]),(0,a.useEffect)(()=>{m&&(m.current=ea)},[m,ea]);let em=(0,a.useRef)(!1);(0,a.useEffect)(()=>{es.edited&&!em.current&&(em.current=!0,f?.())},[es.edited,f]);let ep=(0,a.useMemo)(()=>ea.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})),[ea]),ex=(0,a.useMemo)(()=>ea.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}))})),[ea]),eh=(0,a.useMemo)(()=>[...e,...ep],[e,ep]),ef=(0,a.useMemo)(()=>[...s,...ex],[s,ex]),eg=(0,a.useMemo)(()=>new Map,[]),eb=(0,a.useMemo)(()=>u?function(e,t){let s=new Map(e.map(e=>[H(e.name),e])),n=new Map;for(let e of t){let t=s.get(H(e.name));if(!t){n.set(e.id,{status:"added",changes:["new table"]});continue}let a=function(e,t){let s=new Map(e.map(e=>[H(e.name),e])),n=new Set(t.map(e=>H(e.name))),a=[];for(let e of t){let t=s.get(H(e.name));if(!t){a.push(`+ column ${e.name} (${e.type})`);continue}let n=[];H(t.type)!==H(e.type)&&n.push(`type ${t.type}→${e.type}`),t.isPk!==e.isPk&&n.push(e.isPk?"now PK":"no longer PK"),t.isFk!==e.isFk&&n.push(e.isFk?"now FK":"no longer FK"),t.nullable!==e.nullable&&n.push(e.nullable?"now nullable":"now required"),n.length&&a.push(`~ column ${e.name}: ${n.join(", ")}`)}for(let t of e)n.has(H(t.name))||a.push(`- column ${t.name}`);return a}(t.columns,e.columns);n.set(e.id,{status:a.length?"modified":"unchanged",changes:a})}return n}(e,ep):eg,[u,e,ep,eg]),ev=(0,a.useMemo)(()=>u?function(e,t){let s=e=>`${H(e.method)} ${H(e.path)}`,n=new Set(e.map(s)),a=new Map;for(let e of t)a.set(e.id,n.has(s(e))?{status:"unchanged",changes:[]}:{status:"added",changes:["new endpoint"]});return a}(s,ex):eg,[u,s,ex,eg]),ej=(0,a.useMemo)(()=>[...t,...ea.relations.map(e=>({id:e.id,fromTableId:e.fromTableId,toTableId:e.toTableId,fromColumn:e.fromColumn,toColumn:e.toColumn,label:e.label}))],[t,ea.relations]),ey=(0,a.useMemo)(()=>{let e=new Map;for(let t of ef)for(let s of t.tables)e.set(s.tableId,(e.get(s.tableId)??0)+1);return e},[ef]),eN=(0,a.useMemo)(()=>{let e=new Map;return eh.forEach(t=>e.set(t.id,t.x)),ef.forEach(t=>e.set(t.id,t.x)),e},[eh,ef]),ew=(0,a.useCallback)((e,t)=>(eN.get(e)??0)<=(eN.get(t)??0)?{sourceHandle:"sr",targetHandle:"tl"}:{sourceHandle:"sl",targetHandle:"tr"},[eN]),ek=(0,a.useMemo)(()=>new Set([...ea.tables.map(e=>e.id),...ea.endpoints.map(e=>e.id)]),[ea]),eC=(0,a.useMemo)(()=>new Set(e.map(e=>e.id)),[e]),eE=(0,a.useCallback)(()=>[...eh.map(e=>({id:e.id,type:"dbTable",position:{x:e.x,y:e.y},data:{name:e.name,domain:e.domain,columns:e.columns,usageCount:ey.get(e.id)??0,source:e.source,rev:es.rev,diffStatus:eb.get(e.id)?.status,diffChanges:eb.get(e.id)?.changes}})),...ef.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:es.rev,diffStatus:ev.get(e.id)?.status,diffChanges:ev.get(e.id)?.changes}}))],[eh,ef,ey,es.rev,eb,ev]),[eS,eA,ez]=(0,l.ck)(eE());(0,a.useEffect)(()=>{eA(e=>{let t=new Map(e.map(e=>[e.id,e.position]));return eE().map(e=>({...e,position:t.get(e.id)??e.position}))})},[eE,eA]);let eT=(0,a.useCallback)((e,t,s,n)=>{fetch("/api/db/position",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({kind:e,id:t,x:s,y:n})})},[]),eI=(0,a.useCallback)((e,t)=>{let{x:s,y:n}=t.position;ek.has(t.id)?el(e=>e.tables.some(e=>e.id===t.id)?{...e,tables:e.tables.map(e=>e.id===t.id?{...e,x:s,y:n}:e)}:e.endpoints.some(e=>e.id===t.id)?{...e,endpoints:e.endpoints.map(e=>e.id===t.id?{...e,x:s,y:n}:e)}:e):eT("endpoint"===t.type?"endpoint":"table",t.id,s,n)},[ek,el,eT]),eR=(0,a.useMemo)(()=>ej.map(e=>({id:`fk-${e.id}`,source:e.fromTableId,target:e.toTableId,...ew(e.fromTableId,e.toTableId),type:"deletable",label:e.label??void 0,markerEnd:{type:o.TG.ArrowClosed,color:"#6b6b6b"},style:{stroke:"#6b6b6b"}})),[ej,ew]),eD=(0,a.useMemo)(()=>ef.flatMap(e=>e.tables.map(t=>{let s=x.ru[t.access]??"#5a5a5a";return{id:`u-${e.id}-${t.tableId}`,source:e.id,target:t.tableId,...ew(e.id,t.tableId),type:"default",markerEnd:{type:o.TG.ArrowClosed,color:s},style:{stroke:s,strokeDasharray:"4 4",opacity:.7}}})),[ef,ew]),eM=(0,a.useMemo)(()=>N?[...eR,...eD]:eR,[eR,eD,N]),e$=(0,a.useMemo)(()=>{if(E){let e=eM.find(e=>e.id===E);return e?new Set([e.source,e.target]):null}return k?(0,x.F1)(k.id,eM):null},[k,E,eM]),eP=(0,a.useMemo)(()=>new Map(eh.map(e=>[e.id,{domain:e.domain,source:e.source}])),[eh]),eL=(0,a.useMemo)(()=>new Map(ef.map(e=>[e.id,{method:e.method,source:e.source}])),[ef]),eO=(0,a.useMemo)(()=>{let e=new Set;if(!N)for(let t of eL.keys())e.add(t);for(let[t,s]of eP)!$.size||s.domain&&$.has(s.domain)||e.add(t),L.size&&!L.has(s.source)&&e.add(t);for(let[t,s]of eL)ee.size&&!ee.has(s.method)&&e.add(t),L.size&&!L.has(s.source)&&e.add(t);return e},[N,eP,eL,$,L,ee]),eF=(0,a.useMemo)(()=>eS.map(e=>{let t=eO.has(e.id);return e$?{...e,hidden:t,style:{...e.style,opacity:e$.has(e.id)?1:.45,transition:"opacity 120ms"}}:t?{...e,hidden:t}:e}),[eS,eO,e$]),e_=(0,a.useMemo)(()=>eM.map(e=>{let t=eO.has(e.source)||eO.has(e.target);return k||E?(E?e.id===E:k&&(e.source===k.id||e.target===k.id))?{...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}}:t?{...e,hidden:t}:e}),[eM,k,E,eO]),eH=(0,a.useMemo)(()=>Array.from(new Set(eh.map(e=>e.domain).filter(e=>!!e))).sort(),[eh]),eB=(0,a.useMemo)(()=>Array.from(new Set([...eh.map(e=>e.source),...ef.map(e=>e.source)])).sort(),[eh,ef]),eU=(0,a.useMemo)(()=>Array.from(new Set(ef.map(e=>e.method))).sort(),[ef]);function eK(e,t){t(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})}let eX=+!N+$.size+L.size+ee.size,eG=(0,a.useCallback)(()=>{w(!0),P(new Set),Y(new Set),et(new Set)},[]),eZ=(0,a.useCallback)(e=>{let{source:t,target:s}=e;t&&s&&t!==s&&er(e=>{if(!(e.tables.some(e=>e.id===s)||eC.has(s)))return e;let n=e.endpoints.find(e=>e.id===t);return n?n.links.some(e=>e.tableId===s)?e:{...e,endpoints:e.endpoints.map(e=>{var n;return e.id===t?{...e,links:[...e.links,{tableId:s,access:(n=e.method,_.has(n.trim().toUpperCase())?"read":"write")}]}:e})}:e.tables.find(e=>e.id===t)?e.relations.some(e=>e.fromTableId===t&&e.toTableId===s)?e:{...e,relations:[...e.relations,{id:crypto.randomUUID(),fromTableId:t,toTableId:s,fromColumn:"fk",toColumn:"id",label:null}]}:e})},[er,eC]),eY=(0,a.useMemo)(()=>({patchEndpoint:(e,t)=>er(s=>({...s,endpoints:s.endpoints.map(s=>s.id===e?{...s,...t}:s)})),deleteEndpoint:e=>er(t=>({...t,endpoints:t.endpoints.filter(t=>t.id!==e)})),patchTable:(e,t)=>er(s=>({...s,tables:s.tables.map(s=>s.id===e?{...s,...t}:s)})),deleteTable:e=>er(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&&y.refresh()})}}),[er,y]);(0,a.useEffect)(()=>{let e=e=>{if(!(e.metaKey||e.ctrlKey))return;let t=e.target;if(t&&/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName))return;let s=e.key.toLowerCase();"z"===s?(e.preventDefault(),e.shiftKey?ei():eo()):"y"===s&&(e.preventDefault(),ei())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[eo,ei]);let eW=(0,a.useCallback)(async()=>{M(!0);try{if((await fetch("/api/draft/approve",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(ea)})).ok){try{localStorage.removeItem(V)}catch{}ed(J),y.refresh()}}finally{M(!1)}},[ea,ed,y]),eq=(0,a.useCallback)(async()=>{M(!0);try{await fetch("/api/draft",{method:"DELETE"})}catch{}try{localStorage.removeItem(V)}catch{}ed(J),y.refresh(),M(!1)},[ed,y]),eV=(0,a.useMemo)(()=>{let e;return e=new Map(ea.tables.map(e=>[e.id,e.name])),{tables:ea.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:ea.relations.flatMap(t=>{let s=e.get(t.fromTableId),n=e.get(t.toTableId);return s&&n?[{fromTable:s,fromColumn:t.fromColumn,toTable:n,toColumn:t.toColumn,label:t.label}]:[]}),endpoints:ea.endpoints.map(t=>({method:t.method,path:t.path,domain:t.domain,description:t.description,uses:t.links.flatMap(t=>{let s=e.get(t.tableId);return s?[{table:s,access:t.access}]:[]})}))}},[ea]),eJ=ea.tables.length>0||ea.endpoints.length>0,eQ=es.past.length>0,e0=es.future.length>0;return(0,n.jsx)(h.Provider,{value:eY,children:(0,n.jsxs)("div",{className:(0,p.cn)("relative w-full",u?"h-full":"h-screen"),children:[(0,n.jsxs)(l.Gc,{nodes:eF,edges:e_,nodeTypes:W,edgeTypes:q,connectionMode:o.WZ.Loose,connectionLineStyle:{stroke:"var(--accent-2,#ff7a45)",strokeWidth:1.5,strokeDasharray:"4 4"},onNodesChange:ez,onConnect:eZ,onNodeClick:(e,t)=>{let s="endpoint"===t.type?"endpoint":"table";C({id:t.id,kind:s}),S(null),z(!0),R("details")},onEdgeClick:(e,t)=>{S(t.id),C(null)},onPaneClick:()=>{C(null),S(null)},onNodeDragStop:eI,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)ek.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:["Backspace","Delete"],colorMode:"dark",fitView:!0,minZoom:.15,panOnScroll:!0,zoomActivationKeyCode:["Meta","Control"],proOptions:{hideAttribution:!0},children:[(0,n.jsx)(l.VS,{gap:22,color:"#2a2a32"}),(0,n.jsx)(l.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"}),!u&&(0,n.jsx)(l.of,{pannable:!0,zoomable:!0,position:"bottom-left",style:{width:140,height:90},className:"!rounded-xl !border !border-white/10 !bg-card/50 !backdrop-blur",nodeColor:"#555"}),!u&&(0,n.jsx)(l.Zk,{position:"top-center",className:"glass rounded-full px-1 py-0.5",children:(0,n.jsx)(F.Z,{active:"DATABASE",tabs:[{value:"ROADMAP",label:"Roadmap",href:"/map?view=ROADMAP"},{value:"ARCHITECTURE",label:"Architecture",href:"/map?view=ARCHITECTURE"},{value:"FILES",label:"Files",href:"/map?view=FILES"},{value:"DATABASE",label:"Database",href:"/map?view=DATABASE"}]})}),(0,n.jsxs)(l.Zk,{position:"top-right",className:(0,p.cn)("flex items-center gap-1 transition-[margin] duration-200",A&&"!mr-[332px]",u&&"hidden"),children:[(0,n.jsxs)(O.er,{title:"Filters",trigger:(e,t)=>(0,n.jsxs)("button",{type:"button",onClick:t,title:"Filters",className:(0,p.cn)("glass relative flex size-8 items-center justify-center rounded-lg transition-colors",e||eX>0?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[(0,n.jsx)(B.A,{className:"size-4"}),eX>0&&(0,n.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:eX})]}),children:[(0,n.jsx)(O.r1,{title:"Show",children:(0,n.jsx)(O.vu,{tone:"accent",on:N,onClick:()=>w(e=>!e),children:"endpoints"})}),eH.length>0&&(0,n.jsx)(O.r1,{title:"Domain",children:eH.map(e=>(0,n.jsx)(O.vu,{on:$.has(e),onClick:()=>eK(e,P),children:e},e))}),eU.length>0&&(0,n.jsx)(O.r1,{title:"Method",children:eU.map(e=>(0,n.jsx)(O.vu,{on:ee.has(e),onClick:()=>eK(e,et),children:e},e))}),eB.length>0&&(0,n.jsx)(O.r1,{title:"Source",children:eB.map(e=>(0,n.jsx)(O.vu,{on:L.has(e),onClick:()=>eK(e,Y),children:e.toLowerCase()},e))}),eX>0&&(0,n.jsx)("button",{type:"button",onClick:eG,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,n.jsx)(O.er,{title:"Legend",trigger:(e,t)=>(0,n.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,n.jsx)(U.A,{className:"size-4"})}),children:(0,n.jsxs)("ul",{className:"space-y-1.5 text-[10.5px] text-muted-foreground",children:[(0,n.jsxs)("li",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{"aria-hidden":!0,className:"inline-block h-px w-6 bg-[#6b6b6b]"}),(0,n.jsx)("span",{children:"foreign key \xb7 drag from a table handle"})]}),(0,n.jsxs)("li",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{"aria-hidden":!0,className:"inline-block h-0 w-6 border-t border-dashed",style:{borderColor:"#4ea1ff"}}),(0,n.jsx)("span",{children:"endpoint read \xb7 GET / POST / etc"})]}),(0,n.jsxs)("li",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{"aria-hidden":!0,className:"inline-block h-0 w-6 border-t border-dashed",style:{borderColor:"#ffb86b"}}),(0,n.jsx)("span",{children:"endpoint write"})]}),(0,n.jsxs)("li",{className:"flex items-center gap-2",children:[(0,n.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,n.jsx)("span",{children:"agent-proposed \xb7 approve to persist"})]})]})}),!A&&(0,n.jsx)("button",{onClick:()=>z(!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,n.jsx)(K.A,{className:"size-4"})})]}),eJ&&(0,n.jsxs)(l.Zk,{position:"bottom-center",className:"glass flex items-center gap-1 rounded-xl p-1.5",children:[(0,n.jsxs)("button",{onClick:eo,disabled:!eQ,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,n.jsx)(X.A,{className:"size-3.5"})," undo"]}),(0,n.jsxs)("button",{onClick:ei,disabled:!e0,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,n.jsx)(G.A,{className:"size-3.5"})," redo"]}),!u&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"mx-1 h-4 w-px bg-white/10"}),(0,n.jsxs)("button",{onClick:eq,disabled:D,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,n.jsx)(c.A,{className:"size-3.5"})," discard"]}),(0,n.jsxs)("button",{onClick:eW,disabled:D,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,n.jsx)(Z.A,{className:"size-3.5"})," approve draft"]})]})]})]}),A&&(0,n.jsx)(I,{selected:k,tables:eh,relations:ej,endpoints:ef,draftGraph:eV,onClose:()=>{z(!1),R("details")},commentsContent:b,commentsCount:v,activeTab:T,onTabChange:R,onAddComment:j,topOffset:u?64:void 0})]})})}},40153:(e,t,s)=>{s.d(t,{MapClient:()=>eh});var n=s(95155),a=s(12115),r=s(6266),l=s(81750);s(53255);var o=s(17356),i=s(2125),d=s(15480),c=s(65377),u=s(17494),m=s(80846),p=s(45486),x=s(95635),h=s(65408),f=s(8962),g=s(84824),b=s(5736),v=s(86272),j=s(65738),y=s(40638),N=s(26518);let w=["PENDING","IN_PROGRESS","DONE","BLOCKED","CANCELLED","DEPRIORITIZED"],k=["KEEP","REBUILD","REPLACE","DROP"],C=["IN_PROGRESS","PENDING","BLOCKED","DONE","DEPRIORITIZED","CANCELLED"],E={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"}},S=["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"];function A(e){let t=(e??"").trim().toUpperCase();if(!t)return"bg-white/[0.06] text-muted-foreground";let s=0;for(let e=0;e<t.length;e++)s=31*s+t.charCodeAt(e)>>>0;return S[s%S.length]}let z=(0,a.createContext)(null);var T=s(60874),I=s(91337);let R=[{v:0,l:"P0 \xb7 critical"},{v:1,l:"P1 \xb7 high"},{v:2,l:"P2 \xb7 medium"},{v:3,l:"P3 \xb7 low"}],D="nodrag nopan";function M({id:e,data:t,selected:s}){let{categories:r,statuses:l,patch:o,isExpanded:i,toggleExpand:d,openDetailed:c,removeNode:u,editingTitleId:m,onAskAgent:w}=function(){let e=(0,a.useContext)(z);if(!e)throw Error("useNodeEdit must be used inside NodeEditContext");return e}(),k=i(e),[C,S]=(0,a.useState)(!1),[$,P]=(0,a.useState)(!1),[L,O]=(0,a.useState)(t.title),[F,_]=(0,a.useState)(t.cluster??""),[H,B]=(0,a.useState)(t.plain??""),U=0===t.priority,K="CANCELLED"===t.status||"DROP"===t.status,X="DEPRIORITIZED"===t.status,G="DRAFT"===t.source,Z="IN_PROGRESS"===t.status,Y="INIT"===t.source&&"ROADMAP"===t.view,W=e=>e.stopPropagation();return(0,n.jsxs)("div",{className:(0,I.cn)("rounded-lg border bg-card px-2.5 py-2 text-card-foreground shadow-sm transition",k?"w-80":t.isChild?"w-56":"w-64",G?"border-dashed border-sky-400/50 bg-sky-500/[0.06]":Y?"border-dashed border-violet-400/60 bg-violet-500/[0.07] shadow-[0_0_0_1px_rgba(167,139,250,0.18)]":U?"border-[#ff3860]/60 shadow-[0_0_0_1px_rgba(255,56,96,0.15)]":"border-border",Z&&"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)]",s&&"ring-2 ring-[var(--accent,#f5b942)]",K&&"opacity-60",X&&"opacity-70 border-dashed"),children:[(0,n.jsx)(x.x,{}),t.isNext&&(0,n.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"}),(0,n.jsxs)("div",{className:"flex items-start gap-1.5",children:[Z&&(0,n.jsx)("span",{title:"em andamento",className:"mt-1.5 inline-block size-2 shrink-0 animate-pulse rounded-full bg-sky-400"}),t.isCriterion&&!Z&&(0,n.jsx)("span",{title:"Success criterion",className:"mt-1.5 inline-block size-1.5 shrink-0 rounded-full bg-[var(--accent,#f5b942)]"}),(0,n.jsx)("textarea",{rows:1,value:L,autoFocus:m===e,placeholder:"Title…",onFocus:t=>{m===e&&t.currentTarget.select()},onChange:e=>O(e.target.value),onBlur:()=>{let s=L.trim();s&&s!==t.title&&o(e,{title:s},!0)},onKeyDown:e=>{W(e),"Enter"!==e.key||e.shiftKey||(e.preventDefault(),e.currentTarget.blur())},className:(0,I.cn)(D,"field-sizing-content w-full resize-none bg-transparent text-sm font-medium leading-snug outline-none placeholder:text-muted-foreground/60",K&&"line-through")}),(0,n.jsx)("button",{type:"button",onClick:t=>{W(t),d(e)},title:k?"Collapse":"Expand",className:(0,I.cn)(D,"mt-0.5 shrink-0 text-muted-foreground hover:text-foreground"),children:k?(0,n.jsx)(h.A,{className:"size-3.5"}):(0,n.jsx)(f.A,{className:"size-3.5"})})]}),((t.signals?.untested??0)>0||t.signals?.auth)&&(0,n.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[(t.signals?.untested??0)>0&&(0,n.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,n.jsx)(g.A,{className:"size-2.5"}),t.signals.untested," untested"]}),t.signals?.auth&&(0,n.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,n.jsx)(b.A,{className:"size-2.5"})," auth"]})]}),t.role&&(0,n.jsx)("div",{className:(0,I.cn)("mt-0.5 text-[10px] leading-snug text-muted-foreground",!k&&"line-clamp-1"),children:t.role}),(0,n.jsxs)("div",{className:"mt-2 flex items-center gap-1.5",children:["ROADMAP"===t.view?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{title:t.isChild?"Sub-task of a feature":"Feature — top-level roadmap item",className:(0,I.cn)("shrink-0 rounded px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide",t.isChild?"bg-zinc-500/15 text-zinc-300":"bg-sky-500/15 text-sky-300"),children:t.isChild?"sub-task":"feature"}),Y&&(0,n.jsxs)("span",{className:"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",children:[(0,n.jsx)(v.A,{className:"size-2.5"})," IA"]}),(0,n.jsx)("input",{list:`cats-${e}`,value:F,placeholder:"category",onChange:e=>_(e.target.value),onBlur:()=>{let s=F.trim()||null;s!==(t.cluster??null)&&o(e,{cluster:s},!0)},onKeyDown:e=>{W(e),"Enter"===e.key&&e.currentTarget.blur()},className:(0,I.cn)(D,"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",A(F))})]}):(0,n.jsxs)(n.Fragment,{children:[t.isChild&&(0,n.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"}),(0,n.jsx)("input",{list:`cats-${e}`,value:F,placeholder:"domain",title:"Architecture domain — the lane this component lives in",onChange:e=>_(e.target.value),onBlur:()=>{let s=F.trim()||null;s!==(t.cluster??null)&&o(e,{cluster:s},!0)},onKeyDown:e=>{W(e),"Enter"===e.key&&e.currentTarget.blur()},className:(0,I.cn)(D,"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",A(F))})]}),(0,n.jsx)("datalist",{id:`cats-${e}`,children:r.map(e=>(0,n.jsx)("option",{value:e},e))}),(0,n.jsxs)(N.l6,{value:t.status,onValueChange:t=>o(e,{status:t},!0),children:[(0,n.jsx)(N.bq,{className:(0,I.cn)(D,"ml-auto h-6 shrink-0 gap-1 rounded border px-1.5 py-0 text-[10px] font-medium",E[t.status]?.className??"border-white/10"),children:(0,n.jsx)(N.yv,{children:e=>E[e]?.label??e})}),(0,n.jsx)(N.gC,{alignItemWithTrigger:!1,children:l.map(e=>(0,n.jsx)(N.eb,{value:e,children:E[e]?.label??e},e))})]})]}),k&&(0,n.jsxs)("div",{className:"mt-2 space-y-2 border-t border-white/10 pt-2",children:[$||!H.trim()?(0,n.jsx)("textarea",{autoFocus:$,value:H,placeholder:"Description (markdown)…",onChange:e=>B(e.target.value),onBlur:()=>{P(!1);let s=H.trim()||null;s!==(t.plain??null)&&o(e,{plain:s},!0)},onKeyDown:W,rows:3,className:(0,I.cn)(D,"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,n.jsx)("div",{onClick:e=>{W(e),P(!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,n.jsx)(T.pO,{markdown:H,variant:"compact",className:"text-[12px]"})}),(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsxs)(N.l6,{value:String(t.priority),onValueChange:t=>o(e,{priority:Number(t)},!0),children:[(0,n.jsx)(N.bq,{className:(0,I.cn)(D,"h-6 gap-1 rounded border-white/10 px-1.5 py-0 text-[10px]"),children:(0,n.jsx)(N.yv,{children:e=>R.find(t=>String(t.v)===e)?.l??e})}),(0,n.jsx)(N.gC,{alignItemWithTrigger:!1,children:R.map(e=>(0,n.jsx)(N.eb,{value:String(e.v),children:e.l},e.v))})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsxs)("button",{type:"button",onClick:t=>{W(t),C?u(e):S(!0)},onBlur:()=>S(!1),title:"Delete node",className:(0,I.cn)(D,"flex items-center gap-1 rounded px-1.5 py-1 text-[10px] transition-colors",C?"bg-red-500/20 text-red-300":"text-muted-foreground hover:bg-white/5 hover:text-red-300"),children:[(0,n.jsx)(j.A,{className:"size-3"}),C&&"Delete?"]}),w&&(0,n.jsxs)("button",{type:"button",onClick:e=>{W(e),w(`feature: ${t.title}`)},title:"Ask the agent a question about this feature (answered in its next round)",className:(0,I.cn)(D,"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,n.jsx)(y.A,{className:"size-3"})," Ask"]}),(0,n.jsxs)("button",{type:"button",onClick:t=>{W(t),c(e)},className:(0,I.cn)(D,"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,n.jsx)(p.A,{className:"size-3"})," Details"]})]})]})]})]})}var $=s(57144),P=s(73321),L=s(9005),O=s(32133),F=s(82099),_=s(4474),H=s(70521),B=s(74350);function U({className:e,type:t,...s}){return(0,n.jsx)("input",{type:t,"data-slot":"input",className:(0,I.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),...s})}function K({className:e,...t}){return(0,n.jsx)("textarea",{"data-slot":"textarea",className:(0,I.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 X=s(61388);function G({className:e,...t}){return(0,n.jsx)(X.b,{"data-slot":"label",className:(0,I.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})}var Z=s(9339);let Y=(0,Z.createServerReference)("404ad81c9cf90aad3f674a9acfee3ab66477669023",Z.callServer,void 0,Z.findSourceMapURL,"createNodeAction"),W=(0,Z.createServerReference)("60e949e2cc6edd6b63e3bf61dcae500611d9215041",Z.callServer,void 0,Z.findSourceMapURL,"updateNodeAction");function q({open:e,onOpenChange:t,mode:s,view:r,heading:l,nodeId:o,parentId:i,position:d,defaults:c}){let u=(0,P.useRouter)(),[m,p]=(0,a.useState)(c?.title??""),[x,h]=(0,a.useState)(c?.role??""),[f,g]=(0,a.useState)(c?.plain??""),[b,v]=(0,a.useState)(c?.cluster??""),[j,y]=(0,a.useState)(c?.status??("ARCHITECTURE"===r?"REBUILD":"PENDING")),[C,S]=(0,a.useState)(!1),A="ARCHITECTURE"===r?k:w;async function z(){if(m.trim()){S(!0);try{"create"===s?await Y({view:r,title:m.trim(),role:x.trim()||null,plain:f.trim()||null,cluster:b.trim()||null,parentId:i??null,status:j,x:d?.x??60,y:d?.y??60}):o&&await W(o,{title:m.trim(),role:x.trim()||null,plain:f.trim()||null,cluster:b.trim()||null,status:j}),t(!1),u.refresh()}finally{S(!1)}}}return(0,n.jsx)(B.lG,{open:e,onOpenChange:t,children:(0,n.jsxs)(B.Cf,{children:[(0,n.jsx)(B.c7,{children:(0,n.jsx)(B.L3,{children:l})}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)(G,{htmlFor:"nf-title",children:"Title"}),(0,n.jsx)(U,{id:"nf-title",value:m,autoFocus:!0,onChange:e=>p(e.target.value)})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)(G,{htmlFor:"nf-role",children:"Role (one line)"}),(0,n.jsx)(U,{id:"nf-role",value:x,onChange:e=>h(e.target.value)})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)(G,{htmlFor:"nf-plain",children:"Description"}),(0,n.jsx)(K,{id:"nf-plain",rows:3,value:f,onChange:e=>g(e.target.value)})]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)(G,{children:"Status"}),(0,n.jsxs)(N.l6,{value:j,onValueChange:e=>null!=e&&y(e),children:[(0,n.jsx)(N.bq,{children:(0,n.jsx)(N.yv,{children:e=>E[e]?.label??e})}),(0,n.jsx)(N.gC,{children:A.map(e=>(0,n.jsx)(N.eb,{value:e,children:E[e]?.label??e},e))})]})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)(G,{htmlFor:"nf-cluster",children:"Cluster / lane"}),(0,n.jsx)(U,{id:"nf-cluster",value:b,onChange:e=>v(e.target.value)})]})]})]}),(0,n.jsxs)(B.Es,{children:[(0,n.jsx)(_.$,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),(0,n.jsx)(_.$,{onClick:z,disabled:C||!m.trim(),children:C?"Saving…":"Save"})]})]})})}let V=(0,Z.createServerReference)("407df97c2a5c303f8f9ef0aed1710e6705ed9c560f",Z.callServer,void 0,Z.findSourceMapURL,"acceptSuggestionAction"),J=(0,Z.createServerReference)("40123ca5565c67d7dd21f7c70a875eae2d39c096ee",Z.callServer,void 0,Z.findSourceMapURL,"deleteNodeAction"),Q=(0,Z.createServerReference)("605e2e3c4da2f47895738489205db931d77858cda0",Z.callServer,void 0,Z.findSourceMapURL,"setStatusAction"),ee=(0,Z.createServerReference)("40d4566fae8a6d78be6006ddf01d626d1acac40110",Z.callServer,void 0,Z.findSourceMapURL,"cancelAction"),et=(0,Z.createServerReference)("4056015b0c74fe19b3c9877daa3e613868954be1ac",Z.callServer,void 0,Z.findSourceMapURL,"deprioritizeAction");function es({view:e,selected:t,allNodes:s,onClose:a,commentsContent:r,commentsCount:l=0,activeTab:o,onTabChange:i,onAddComment:d,topOffset:c}){let u=!!r,m=o??"details";return(0,n.jsxs)(F.b,{className:"absolute bottom-3 right-3 z-10 flex w-80 flex-col rounded-2xl",style:{top:c??12},children:[u?(0,n.jsxs)("div",{className:"flex items-center justify-between border-b border-white/10 px-1 py-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,n.jsx)(en,{active:"details"===m,onClick:()=>i?.("details"),children:"Details"}),(0,n.jsxs)(en,{active:"comments"===m,onClick:()=>i?.("comments"),children:["Comments",l>0&&(0,n.jsx)("span",{className:"ml-1 rounded-full bg-white/10 px-1 text-[9px] font-semibold leading-4",children:l})]})]}),(0,n.jsx)("button",{onClick:a,title:"Close panel",className:"mr-1 rounded-md p-1 text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground",children:(0,n.jsx)(L.A,{className:"size-4"})})]}):(0,n.jsxs)("div",{className:"flex items-center justify-between border-b border-white/10 px-3.5 py-2.5",children:[(0,n.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Details"}),(0,n.jsx)("button",{onClick:a,title:"Close panel",className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground",children:(0,n.jsx)(L.A,{className:"size-4"})})]}),(0,n.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,n.jsx)("div",{className:"p-3",children:"comments"===m&&u?r:t?(0,n.jsxs)(n.Fragment,{children:[d&&(0,n.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,n.jsx)(O.A,{className:"size-3.5"}),"Comment on this ","ARCHITECTURE"===e?"component":"feature"]}),(0,n.jsx)(ea,{node:t,view:e},t.id)]}):(0,n.jsx)(er,{view:e,nodes:s})})})]})}function en({active:e,onClick:t,children:s}){return(0,n.jsx)("button",{type:"button",onClick:t,className:(0,I.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:s})}function ea({node:e,view:t}){var s;let r=(0,P.useRouter)(),[l,o]=(0,a.useTransition)(),[i,d]=(0,a.useState)(!1),[c,u]=(0,a.useState)(!1),m="ARCHITECTURE"===t?k:w,p=e=>o(async()=>{await e(),r.refresh()});return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:[(s=e.cluster,s?.trim()||"—"),0===e.priority&&(0,n.jsx)("span",{className:"ml-2 text-[#ff7a90]",children:"\xb7 critical path"})]}),(0,n.jsx)("h2",{className:"mt-1 text-lg font-semibold leading-tight",children:e.title})]}),"INIT"===e.source&&(0,n.jsxs)("div",{className:"rounded-lg border border-violet-400/30 bg-violet-500/[0.06] p-2.5",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5 text-xs font-semibold text-violet-300",children:[(0,n.jsx)(v.A,{className:"size-3.5"})," AI suggestion"]}),(0,n.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,n.jsxs)("div",{className:"mt-2 flex gap-1.5",children:[(0,n.jsx)(_.$,{size:"sm",className:"h-7 px-2.5 text-xs",disabled:l,onClick:()=>p(()=>V(e.id)),children:"Accept"}),(0,n.jsx)(_.$,{size:"sm",variant:"outline",className:"h-7 px-2.5 text-xs text-muted-foreground",disabled:l,onClick:()=>p(()=>J(e.id)),children:"Dismiss"})]})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:"Status"}),(0,n.jsxs)(N.l6,{value:e.status,onValueChange:t=>null!=t&&p(()=>Q(e.id,t)),children:[(0,n.jsx)(N.bq,{className:"h-8",disabled:l,children:(0,n.jsx)(N.yv,{children:e=>E[e]?.label??e})}),(0,n.jsx)(N.gC,{children:m.map(e=>(0,n.jsx)(N.eb,{value:e,children:E[e]?.label??e},e))})]})]}),e.plain&&(0,n.jsx)("div",{className:"rounded-md border border-white/5 bg-card/40 px-2.5 py-2 text-sm",children:(0,n.jsx)(T.pO,{markdown:e.plain,variant:"compact",className:"text-[12.5px]"})}),e.sourceRef&&(0,n.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,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:["Files (",e.files.length,")"]}),(0,n.jsx)("ul",{className:"space-y-0.5",children:e.files.map(e=>(0,n.jsx)("li",{children:(0,n.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))})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-1.5 pt-1",children:[(0,n.jsx)(_.$,{size:"sm",variant:"outline",onClick:()=>d(!0),children:"Edit"}),(0,n.jsx)(_.$,{size:"sm",variant:"outline",onClick:()=>u(!0),children:"+ Sub-node"}),(0,n.jsx)(_.$,{size:"sm",variant:"outline",disabled:l,onClick:()=>p(()=>ee(e.id)),children:"Cancel"}),(0,n.jsx)(_.$,{size:"sm",variant:"outline",disabled:l,onClick:()=>p(()=>et(e.id)),children:"Deprioritize"}),(0,n.jsxs)(H.Lt,{children:[(0,n.jsx)(H.tv,{render:(0,n.jsx)(_.$,{size:"sm",variant:"outline",className:"text-red-300",children:"Delete"})}),(0,n.jsxs)(H.EO,{children:[(0,n.jsxs)(H.wd,{children:[(0,n.jsxs)(H.r7,{children:["Delete “",e.title,"”?"]}),(0,n.jsx)(H.$v,{children:"This removes the node and all its sub-nodes. It can’t be undone."})]}),(0,n.jsxs)(H.ck,{children:[(0,n.jsx)(H.Zr,{children:"Cancel"}),(0,n.jsx)(H.Rx,{onClick:()=>p(()=>J(e.id)),children:"Delete"})]})]})]})]}),i&&(0,n.jsx)(q,{open:!0,onOpenChange:d,mode:"edit",view:t,heading:"Edit node",nodeId:e.id,defaults:{title:e.title,role:e.role,plain:e.plain,status:e.status,cluster:e.cluster}}),c&&(0,n.jsx)(q,{open:!0,onOpenChange:u,mode:"create",view:t,heading:"New sub-node",parentId:e.id,position:{x:e.x,y:e.y+120},defaults:{cluster:e.cluster}})]})}function er({view:e,nodes:t}){let s=t.filter(e=>0===e.priority).length;return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-sm font-semibold",children:"ROADMAP"===e?"Roadmap":"Architecture"}),(0,n.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,n.jsxs)("dl",{className:"grid grid-cols-2 gap-2 text-center",children:[(0,n.jsx)(el,{label:"nodes",value:t.length}),(0,n.jsx)(el,{label:"critical",value:s})]})]})}function el({label:e,value:t}){return(0,n.jsxs)("div",{className:"rounded-md border border-border bg-card py-2",children:[(0,n.jsx)("div",{className:"text-lg font-semibold",children:t}),(0,n.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:e})]})}var eo=s(18874),ei=s(62311),ed=s(56614);let ec=[{value:"cluster",label:"Theme"},{value:"status",label:"Status"},{value:"priority",label:"Priority"}],eu=new Set(["title","role","plain","cluster","status","priority"]),em={roadmapNode:M,archNode:M},ep={deletable:$.I},ex={CONTAINS:{stroke:"#7c7c8a"},DEPENDS:{stroke:"#f5b942",dash:"6 4"},RELATES:{stroke:"#8a8a95",dash:"4 4"},REPLACES:{stroke:"#ff6b9d"}};function eh({view:e,nodes:t,edges:s,workOnNextId:x=null,embedded:h=!1,commentsContent:f,commentsCount:g=0,controlRef:b,onAskAgent:v,onAddComment:j}){let y=(0,a.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,view:e.view,source:e.source,sourceRef:e.sourceRef,isCriterion:e.isCriterion,isChild:null!=e.parentId,parentId:e.parentId,signals:e.signals}})),[t]),N=(0,a.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:ex.CONTAINS.stroke}})),...s.filter(t=>e.has(t.fromId)&&e.has(t.toId)).map(e=>{let t=ex[e.kind]??ex.RELATES,s="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??s,type:"deletable",markerEnd:{type:r.TG.ArrowClosed,color:t.stroke},style:{stroke:t.stroke,strokeDasharray:t.dash}}})]},[t,s]),[S,A]=(0,a.useState)(y),[T,R]=(0,a.useState)(N),[D,M]=(0,a.useState)(null),[$,P]=(0,a.useState)(null),[L,O]=(0,a.useState)(null),[F,_]=(0,a.useState)(!1),[H,B]=(0,a.useState)("details"),U=(0,a.useRef)(!1),K=(0,a.useRef)("details");(0,a.useEffect)(()=>{U.current=F},[F]),(0,a.useEffect)(()=>{K.current=H},[H]),(0,a.useEffect)(()=>{if(b)return b.current={open:()=>{if(U.current){_(!1),B("details");return}_(!0),B("details")},close:()=>{_(!1),B("details")},openComments:()=>{_(!0),B("comments")}},()=>{b&&(b.current=null)}},[b]);let[X,G]=(0,a.useState)(new Set),[Z,Y]=(0,a.useState)(null),[W,q]=(0,a.useState)(!1),V=(0,a.useRef)(0),J=(0,a.useRef)(null);(0,a.useEffect)(()=>A(y),[y]),(0,a.useEffect)(()=>R(N),[N]);let Q=(0,a.useCallback)((e,t,s)=>{A(s=>s.map(s=>s.id===e?{...s,data:{...s.data,...t}}:s)),s&&fetch(`/api/nodes/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(Object.fromEntries(Object.entries(t).filter(([e])=>eu.has(e))))})},[]),ee=(0,a.useMemo)(()=>Array.from(new Set(S.map(e=>e.data.cluster).filter(e=>!!e))).sort(),[S]),et=(0,a.useCallback)(e=>G(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s}),[]),en=(0,a.useCallback)(e=>{M(e),_(!0),B("details")},[]),ea=(0,a.useCallback)(e=>{A(t=>t.filter(t=>t.id!==e)),M(t=>t===e?null:t),fetch(`/api/nodes/${e}`,{method:"DELETE"})},[]),er=(0,a.useCallback)(async()=>{let t=V.current++%8*28,s=80+t,n=80+t;try{let t=await fetch("/api/nodes",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({view:e,title:"New node",status:"ARCHITECTURE"===e?"REBUILD":"PENDING",x:s,y:n})});if(!t.ok)return;let a=await t.json();A(t=>[...t,{id:a.id,type:"ROADMAP"===e?"roadmapNode":"archNode",position:{x:s,y:n},data:{title:a.title,role:a.role,plain:a.plain,status:a.status,priority:a.priority,cluster:a.cluster,view:a.view,source:a.source,sourceRef:a.sourceRef,isCriterion:!1,isChild:null!=a.parentId,parentId:a.parentId??null}}]),G(e=>new Set(e).add(a.id)),Y(a.id),M(a.id)}catch{}},[e]),el=(0,a.useMemo)(()=>({view:e,categories:ee,statuses:"ARCHITECTURE"===e?k:w,patch:Q,isExpanded:e=>X.has(e),toggleExpand:et,openDetailed:en,removeNode:ea,editingTitleId:Z,onAskAgent:v}),[e,ee,Q,X,et,en,ea,Z,v]),[ef,eg]=(0,a.useState)(null),[eb,ev]=(0,a.useState)(""),[ej,ey]=(0,a.useState)(new Set),[eN,ew]=(0,a.useState)(new Set),[ek,eC]=(0,a.useState)(new Set),eE=(0,a.useMemo)(()=>Array.from(new Set(t.map(e=>e.status))),[t]),eS=(0,a.useMemo)(()=>Array.from(new Set(t.map(e=>e.cluster).filter(e=>!!e))).sort(),[t]),eA=(0,a.useMemo)(()=>Array.from(new Set(t.map(e=>e.priority))).sort((e,t)=>e-t),[t]),ez=(0,a.useCallback)(e=>(!ej.size||!!ej.has(e.status))&&(!eN.size||!!e.cluster&&!!eN.has(e.cluster))&&(!ek.size||!!ek.has(e.priority)),[ej,eN,ek]),eT=ej.size+eN.size+ek.size,eI=(0,a.useCallback)(()=>{ey(new Set),ew(new Set),eC(new Set)},[]),eR=(0,a.useMemo)(()=>S.map(e=>({...e,hidden:!ez(e.data)})),[S,ez]),eD=(0,a.useMemo)(()=>new Set(eR.filter(e=>e.hidden).map(e=>e.id)),[eR]),eM=(0,a.useMemo)(()=>T.map(e=>({...e,hidden:eD.has(e.source)||eD.has(e.target)})),[T,eD]),e$=(0,a.useMemo)(()=>{if($){let e=eM.find(e=>e.id===$);return e?new Set([e.source,e.target]):null}return D?(0,eo.F1)(D,eM.filter(e=>!e.hidden)):null},[D,$,eM]),eP=(0,a.useMemo)(()=>eR.map(e=>{let t=x&&e.id===x?{...e,data:{...e.data,isNext:!0}}:e;return!e$||t.hidden?t:{...t,style:{...t.style,opacity:e$.has(e.id)?1:.45,transition:"opacity 120ms"}}}),[eR,e$,x]),eL=(0,a.useMemo)(()=>{if(!ef||"ROADMAP"!==e)return[];let t=new Map(eP.map(e=>[e.id,e])),s=new Map;for(let e of eP){var n;if(e.hidden)continue;let a=(n=((e.data.parentId?t.get(e.data.parentId):void 0)??e).data,"status"===ef?E[n.status]?.label??n.status:"priority"===ef?`P${n.priority}`:n.cluster?.trim()||"—"),r=e.measured?.width??(e.data.isChild?224:256),l=e.measured?.height??96,o=e.position.x,i=e.position.y,d=s.get(a);d?(d.minX=Math.min(d.minX,o),d.minY=Math.min(d.minY,i),d.maxX=Math.max(d.maxX,o+r),d.maxY=Math.max(d.maxY,i+l)):s.set(a,{label:a,minX:o,minY:i,maxX:o+r,maxY:i+l})}return Array.from(s.values()).map(e=>({label:e.label,x:e.minX-20,y:e.minY-20-26,w:e.maxX-e.minX+40,h:e.maxY-e.minY+40+26}))},[eP,ef,e]),eO=(0,a.useMemo)(()=>{let e=D??L;return $||e?eM.map(t=>t.hidden?t:($?t.id===$: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}}):eM.map(e=>e.hidden?e:{...e,label:void 0,style:{...e.style,opacity:.18}})},[eM,D,$,L]),eF=(0,a.useCallback)(e=>A(t=>(0,l._0)(e,t)),[]),e_=(0,a.useCallback)(e=>R(t=>(0,l.zW)(e,t)),[]),eH=(0,a.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 s=await t.json(),n=ex.DEPENDS;R(t=>t.some(e=>e.id===s.id)?t:[...t,{id:s.id,source:s.fromId,sourceHandle:e.sourceHandle??void 0,target:s.toId,targetHandle:e.targetHandle??void 0,label:"depends on",type:"deletable",markerEnd:{type:r.TG.ArrowClosed,color:n.stroke},style:{stroke:n.stroke,strokeDasharray:n.dash}}])},[]),eB=(0,a.useCallback)(async(t,s,n)=>{let a=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:s,y:n})});if(!a.ok)return;let r=await a.json();A(a=>[...a,{id:r.id,type:"ROADMAP"===e?"roadmapNode":"archNode",position:{x:s,y:n},data:{title:r.title,role:r.role,plain:r.plain,status:r.status,priority:r.priority,cluster:r.cluster,view:r.view,source:r.source,sourceRef:r.sourceRef,isCriterion:!1,isChild:!0,parentId:t.id}}]),R(e=>[...e,{id:`c-${r.id}`,source:t.id,target:r.id,type:"smoothstep",style:{stroke:ex.CONTAINS.stroke}}]),G(e=>new Set(e).add(r.id)),Y(r.id),M(r.id)},[e]),eU=(0,a.useCallback)(async(e,t)=>{if(t.isValid||!t.fromNode||!J.current)return;let s=e.changedTouches,n=s?.[0]?.clientX??e.clientX,a=s?.[0]?.clientY??e.clientY,{x:r,y:l}=J.current.screenToFlowPosition({x:n,y:a});await eB(t.fromNode,r,l)},[eB]);(0,a.useEffect)(()=>{if(!W)return;let e=e=>{"Escape"===e.key&&q(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[W]);let eK=(0,a.useMemo)(()=>t.find(e=>e.id===D)??null,[t,D]),eX=(0,a.useCallback)((e,t,s)=>{fetch(`/api/nodes/${e}/position`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({x:t,y:s})})},[]),eG=(0,a.useCallback)(e=>{M(e),P(null);let t=J.current?.getNode(e);if(!t||!J.current)return;let s=t.measured?.width??128,n=t.measured?.height??48;J.current.setCenter(t.position.x+s/2,t.position.y+n/2,{zoom:1.2,duration:600})},[]),eZ=(0,a.useCallback)(e=>{let t=function(e,t,s={}){let n=s.colW??320,a=s.rowH??150,r=s.childIndent??24,l=s.laneGap??56,o=s.bandGap??110,i=s.maxCols??4,d=s.maxBandW??6*n,c=new Set(e.map(e=>e.id)),u=e=>!e.parentId||!c.has(e.parentId),m=e.filter(u),p=new Map;for(let t of e){if(u(t))continue;let e=p.get(t.parentId);e?e.push(t):p.set(t.parentId,[t])}let x="status"===t?e=>e.status:"priority"===t?e=>String(e.priority):e=>(e.cluster??"").trim()||"—",h=new Map;for(let e of m){let t=x(e),s=h.get(t);s?s.push(e):h.set(t,[e])}let f=(function(e,t,s){if("status"===e)return[...C];if("priority"===e)return["0","1","2","3"];let n=Array.from(new Set(t.map(s))),a=n.filter(e=>"—"!==e).sort();return n.includes("—")?[...a,"—"]:a})(t,m,x).filter(e=>h.has(e)),g=new Map,b=0,v=0,j=0;for(let e of f){let t=h.get(e),s=Math.max(1,Math.min(i,Math.ceil(Math.sqrt(t.length)))),c=s*n;b>0&&b+c>d&&(b=0,v+=j+o,j=0);let u=Array(s).fill(0);for(let e of t){let t=0;for(let e=1;e<s;e++)u[e]<u[t]&&(t=e);let l=b+t*n,o=v+u[t]*a;g.set(e.id,{x:l,y:o});let i=p.get(e.id)??[];i.forEach((e,t)=>{g.set(e.id,{x:l+r,y:o+(t+1)*a})}),u[t]+=1+i.length}j=Math.max(j,u.reduce((e,t)=>Math.max(e,t),0)*a),b+=c+l}return g}(S.map(e=>({id:e.id,parentId:e.data.parentId??null,cluster:e.data.cluster,status:e.data.status,priority:e.data.priority})),e);A(e=>e.map(e=>{let s=t.get(e.id);return s?{...e,position:s}:e}));let s=Array.from(t,([e,t])=>({id:e,x:t.x,y:t.y}));s.length&&fetch("/api/nodes/positions",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({batch:s})}),eg(e),requestAnimationFrame(()=>J.current?.fitView({duration:600,padding:.2}))},[S]),eY=(0,a.useMemo)(()=>{let e=eb.trim().toLowerCase();return e?S.filter(t=>ez(t.data)&&t.data.title.toLowerCase().includes(e)).slice(0,8):[]},[S,eb,ez]);function eW(e,t){t(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})}return(0,n.jsx)(z.Provider,{value:el,children:(0,n.jsxs)("div",{className:(0,I.cn)("relative w-full",h?"h-full":"h-screen"),children:[(0,n.jsxs)(l.Gc,{nodes:eP,edges:eO,nodeTypes:em,edgeTypes:ep,connectionMode:r.WZ.Loose,connectionLineStyle:{stroke:"var(--accent-2,#ff7a45)",strokeWidth:1.5,strokeDasharray:"4 4"},onInit:e=>{J.current=e},onNodesChange:eF,onEdgesChange:e_,onConnect:eH,onConnectEnd:eU,onNodeMouseEnter:(e,t)=>O(t.id),onNodeMouseLeave:()=>O(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)fetch(`/api/nodes/${t.id}`,{method:"DELETE"}),M(e=>e===t.id?null:e)},onNodeClick:(e,t)=>{if(W){if(q(!1),t.data.isChild)return;eB(t,t.position.x+300,t.position.y+60);return}if(M(t.id),P(null),B("details"),h){let t=e.target;t?.closest("input, textarea, select, button, [role='combobox']")||_(!0)}},onEdgeClick:(e,t)=>{P(t.id),M(null),B("details")},onPaneClick:()=>{W?q(!1):(M(null),P(null))},onNodeDragStop:(e,t)=>eX(t.id,t.position.x,t.position.y),deleteKeyCode:["Backspace","Delete"],colorMode:"dark",fitView:!0,minZoom:.2,panOnScroll:!0,zoomActivationKeyCode:["Meta","Control"],proOptions:{hideAttribution:!0},children:[(0,n.jsx)(l.VS,{gap:22,color:"#2a2a32"}),eL.length>0&&(0,n.jsx)(l.DX,{children:eL.map(e=>(0,n.jsx)("div",{style:{position:"absolute",transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,pointerEvents:"none",zIndex:0},className:"rounded-2xl border border-white/[0.08] bg-white/[0.015]",children:(0,n.jsx)("div",{className:"px-3 py-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:e.label})},e.label))}),(0,n.jsx)(l.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,n.jsx)(l.Zk,{position:"bottom-right",style:{marginBottom:152},children:(0,n.jsx)(ed.er,{title:"Legend",trigger:(e,t)=>(0,n.jsx)("button",{type:"button",onClick:t,title:"Legend",className:(0,I.cn)("glass flex size-8 items-center justify-center rounded-lg transition-colors",e?"text-foreground":"text-muted-foreground hover:text-foreground"),children:(0,n.jsx)(o.A,{className:"size-4"})}),children:(0,n.jsxs)("ul",{className:"space-y-1.5 text-[10.5px] text-muted-foreground",children:[(0,n.jsxs)("li",{className:"flex items-center gap-2",children:[(0,n.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,n.jsx)("span",{children:"top-level card \xb7 can have sub-tasks"})]}),(0,n.jsxs)("li",{className:"flex items-center gap-2",children:[(0,n.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,n.jsx)("span",{children:"child of a feature"})]}),(0,n.jsxs)("li",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{"aria-hidden":!0,className:"inline-block h-px w-6 bg-[#33333a]"}),(0,n.jsx)("span",{children:"contains \xb7 drag the bottom handle to empty canvas"})]}),(0,n.jsxs)("li",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{"aria-hidden":!0,className:"inline-block h-0 w-6 border-t border-dashed",style:{borderColor:"#f5b942"}}),(0,n.jsx)("span",{children:"depends on \xb7 drag between two cards"})]})]})})}),!h&&(0,n.jsx)(l.of,{pannable:!0,zoomable:!0,position:"bottom-left",style:{width:140,height:90},className:"!rounded-xl !border !border-white/10 !bg-card/50 !backdrop-blur",nodeColor:e=>e.data?.priority===0?"#ff3860":"#555"}),(0,n.jsxs)(l.Zk,{position:"bottom-center",className:"!mb-4 flex flex-col items-center gap-2",children:[W&&(0,n.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"]}),"ROADMAP"===e&&(0,n.jsxs)("div",{className:"glass flex items-center gap-1 rounded-full p-1",children:[(0,n.jsx)("span",{className:"pl-2 pr-0.5 text-[11px] text-muted-foreground",children:"Group by"}),ec.map(e=>(0,n.jsx)("button",{onClick:()=>eZ(e.value),title:`Arrange features into lanes by ${e.label.toLowerCase()}`,className:(0,I.cn)("h-7 rounded-full px-2.5 text-[11px] font-medium transition-colors",ef===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,n.jsxs)("div",{className:"glass flex items-center gap-1 rounded-full p-1",children:[(0,n.jsxs)("button",{onClick:()=>void er(),title:"ARCHITECTURE"===e?"Add component":"Add feature",className:"flex h-8 items-center gap-1.5 rounded-full px-3 text-[12px] font-medium text-foreground transition-colors hover:bg-white/[0.06]",children:[(0,n.jsx)(i.A,{className:"size-3.5 text-[var(--accent-2,#ff7a45)]"}),"ARCHITECTURE"===e?"Component":"Feature"]}),(0,n.jsx)("span",{"aria-hidden":!0,className:"mx-0.5 h-5 w-px bg-white/10"}),(0,n.jsxs)("button",{onClick:()=>q(e=>!e),title:"ARCHITECTURE"===e?"Add sub-component (click a component next)":"Add sub-task (click a feature next)",className:(0,I.cn)("flex h-8 items-center gap-1.5 rounded-full px-3 text-[12px] font-medium transition-colors",W?"bg-white/[0.1] text-foreground":"text-muted-foreground hover:bg-white/[0.06] hover:text-foreground"),children:[(0,n.jsx)(d.A,{className:"size-3.5"}),"ARCHITECTURE"===e?"Sub-component":"Sub-task"]})]})]}),!h&&(0,n.jsx)(l.Zk,{position:"top-center",className:"glass rounded-full px-1 py-0.5",children:(0,n.jsx)(ei.Z,{active:e,tabs:[{value:"ROADMAP",label:"Roadmap",href:"/map?view=ROADMAP"},{value:"ARCHITECTURE",label:"Architecture",href:"/map?view=ARCHITECTURE"},{value:"FILES",label:"Files",href:"/map?view=FILES"},{value:"DATABASE",label:"Database",href:"/map?view=DATABASE"}]})}),(0,n.jsxs)(l.Zk,{position:"top-right",className:(0,I.cn)("flex items-center gap-1 transition-[margin] duration-200",F&&"!mr-[332px]",h&&"hidden"),children:[(0,n.jsxs)(ed.er,{title:"Search",trigger:(e,t)=>(0,n.jsx)("button",{type:"button",onClick:t,title:"Search features",className:(0,I.cn)("glass flex size-8 items-center justify-center rounded-lg transition-colors",e?"text-foreground":"text-muted-foreground hover:text-foreground"),children:(0,n.jsx)(c.A,{className:"size-4"})}),children:[(0,n.jsx)("input",{autoFocus:!0,value:eb,onChange:e=>ev(e.target.value),placeholder:"Find a feature…",className:"w-full rounded-md border border-white/10 bg-white/[0.04] px-2 py-1 text-[12px] outline-none placeholder:text-muted-foreground/50 focus:bg-white/[0.08]"}),(0,n.jsxs)("div",{className:"mt-2 max-h-64 space-y-0.5 overflow-y-auto",children:[eb.trim()&&0===eY.length&&(0,n.jsx)("div",{className:"px-1 py-1 text-[11px] text-muted-foreground",children:"No matches"}),eY.map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>eG(e.id),className:"block w-full truncate rounded-md px-2 py-1 text-left text-[12px] text-muted-foreground transition-colors hover:bg-white/5 hover:text-foreground",children:e.data.title},e.id))]})]}),"ROADMAP"===e&&x&&(0,n.jsx)("button",{type:"button",onClick:()=>eG(x),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,n.jsx)(u.A,{className:"size-4"})}),(0,n.jsxs)(ed.er,{title:"Filters",trigger:(e,t)=>(0,n.jsxs)("button",{type:"button",onClick:t,title:"Filters",className:(0,I.cn)("glass relative flex size-8 items-center justify-center rounded-lg transition-colors",e||eT>0?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[(0,n.jsx)(m.A,{className:"size-4"}),eT>0&&(0,n.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:eT})]}),children:[eE.length>0&&(0,n.jsx)(ed.r1,{title:"Status",children:eE.map(e=>(0,n.jsx)(ed.vu,{on:ej.has(e),onClick:()=>eW(e,ey),children:E[e]?.label??e},e))}),eS.length>0&&(0,n.jsx)(ed.r1,{title:"Cluster",children:eS.map(e=>(0,n.jsx)(ed.vu,{on:eN.has(e),onClick:()=>eW(e,ew),children:e},e))}),eA.length>0&&(0,n.jsx)(ed.r1,{title:"Priority",children:eA.map(e=>(0,n.jsxs)(ed.vu,{on:ek.has(e),onClick:()=>eW(e,eC),children:["P",e]},e))}),eT>0&&(0,n.jsx)("button",{type:"button",onClick:eI,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"})]}),!F&&(0,n.jsx)("button",{onClick:()=>{_(!0),B("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,n.jsx)(p.A,{className:"size-4"})})]})]}),F&&(0,n.jsx)(es,{view:e,selected:eK,allNodes:t,onClose:()=>{_(!1),B("details")},commentsContent:f,commentsCount:g,activeTab:H,onTabChange:B,onAddComment:j,topOffset:h?64:void 0})]})})}},56614:(e,t,s)=>{s.d(t,{er:()=>l,r1:()=>o,vu:()=>i});var n=s(95155),a=s(12115),r=s(91337);function l({trigger:e,title:t,align:s="right",children:o}){let[i,d]=(0,a.useState)(!1),c=(0,a.useRef)(null);return(0,a.useEffect)(()=>{if(!i)return;let e=e=>{c.current?.contains(e.target)||d(!1)},t=e=>{"Escape"===e.key&&d(!1)};return window.addEventListener("mousedown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("mousedown",e),window.removeEventListener("keydown",t)}},[i]),(0,n.jsxs)("div",{ref:c,className:"relative",children:[e(i,()=>d(e=>!e)),i&&(0,n.jsxs)("div",{className:(0,r.cn)("glass absolute top-full z-30 mt-1.5 w-64 rounded-xl p-3 shadow-xl","right"===s?"right-0":"left-0"),children:[t&&(0,n.jsx)("div",{className:"mb-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:t}),o]})]})}function o({title:e,children:t}){return(0,n.jsxs)("div",{className:"mb-2.5 last:mb-0",children:[(0,n.jsx)("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/80",children:e}),(0,n.jsx)("div",{className:"flex flex-wrap gap-1",children:t})]})}function i({on:e,onClick:t,children:s,tone:a="default"}){return(0,n.jsx)("button",{type:"button",onClick:t,className:(0,r.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"}[a]),children:s})}},57144:(e,t,s)=>{s.d(t,{I:()=>c});var n=s(95155),a=s(81750),r=s(6266),l=s(65738);function o(e){let{x:t,y:s}=e.internals.positionAbsolute,n=e.measured?.width??0,a=e.measured?.height??0;return{x:t,y:s,w:n,h:a,cx:t+n/2,cy:s+a/2}}function i(e,t){let s=o(e),n=o(t),a=s.w/2||1,r=s.h/2||1,l=(n.cx-s.cx)/(2*a)-(n.cy-s.cy)/(2*r),i=(n.cx-s.cx)/(2*a)+(n.cy-s.cy)/(2*r),d=1/(Math.abs(l)+Math.abs(i)||1);return{x:a*d*(l+i)+s.cx,y:r*d*(-l+i)+s.cy}}function d(e,t){let s=o(e),n=Math.round(t.x),a=Math.round(t.y);return n<=Math.round(s.x)+1?r.yX.Left:n>=Math.round(s.x+s.w)-1?r.yX.Right:a<=Math.round(s.y)+1?r.yX.Top:r.yX.Bottom}function c(e){let t,s,{deleteElements:o}=(0,a.VH)(),c=(0,a.JY)(e.source),u=(0,a.JY)(e.target),m=c&&u?(t=i(c,u),s=i(u,c),{sx:t.x,sy:t.y,tx:s.x,ty:s.y,sourcePos:d(c,t),targetPos:d(u,s)}):null,[p,x,h]=(0,r.Fp)(m?{sourceX:m.sx,sourceY:m.sy,sourcePosition:m.sourcePos,targetX:m.tx,targetY:m.ty,targetPosition:m.targetPos}:{sourceX:e.sourceX,sourceY:e.sourceY,sourcePosition:e.sourcePosition,targetX:e.targetX,targetY:e.targetY,targetPosition:e.targetPosition});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.tE,{id:e.id,path:p,style:e.style,markerEnd:e.markerEnd,interactionWidth:20}),e.label&&(0,n.jsx)(a.rV,{children:(0,n.jsx)("div",{style:{position:"absolute",transform:`translate(-50%, -120%) translate(${x}px, ${h}px)`,fontSize:11,color:"#cfcfcf",background:"#161616",padding:"1px 4px",borderRadius:4,pointerEvents:"none"},children:e.label})}),e.selected&&(0,n.jsx)(a.rV,{children:(0,n.jsx)("div",{className:"nodrag nopan",style:{position:"absolute",transform:`translate(-50%, 0) translate(${x}px, ${h+14}px)`,pointerEvents:"all",zIndex:1e3},children:(0,n.jsx)("button",{type:"button",onMouseDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),o({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,n.jsx)(l.A,{className:"size-3.5"})})})})]})}},60874:(e,t,s)=>{s.d(t,{F8:()=>b,NG:()=>x,QH:()=>h,Vq:()=>g,aM:()=>y,cV:()=>w,kz:()=>j,n$:()=>m,pO:()=>l,vB:()=>v});var n=s(95155),a=s(12115),r=s(91337);function l({markdown:e,className:t,variant:s="reading"}){let o=(0,a.useMemo)(()=>m(e),[e]),i="reading"===s;return(0,n.jsx)("div",{className:(0,r.cn)("min-w-0 [overflow-wrap:anywhere]",i?"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:o.map((e,t)=>(0,n.jsx)(N,{block:e,variant:s},t))})}function o(e){let t=e.trim();return t.includes("|")&&t.includes("-")&&/^[\s|:-]+$/.test(t)}function i(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(),s=t.startsWith(":"),n=t.endsWith(":");return s&&n?"center":n?"right":s?"left":null}let u=/^\s*```[^\s`]*\s*$/;function m(e){let t=e.split("\n"),s=[],n=[],a=()=>{n.length&&(s.push({kind:"p",text:n.join("\n")}),n=[])},r=null,l=()=>{null!==r&&(s.push({kind:"quote",text:r.join("\n")}),r=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)?(s.push({kind:"code",text:p.join("\n")}),p=null):p.push(h);continue}let f=h.match(/^>\s?(.*)$/);if(f){a(),x=null,(r??=[]).push(f[1]);continue}if(l(),u.test(h)){a(),x=null,p=[];continue}if(/^\s*$/.test(h)){a(),x=null;continue}let g=h.match(/^#### +(.+)$/);if(g){a(),x=null,s.push({kind:"h4",text:g[1]});continue}let b=h.match(/^### +(.+)$/);if(b){a(),x=null,s.push({kind:"h3",text:b[1]});continue}let v=h.match(/^## +(.+)$/);if(v){a(),x=null,s.push({kind:"h2",text:v[1]});continue}let j=h.match(/^# +(.+)$/);if(j){a(),x=null,s.push({kind:"h1",text:j[1]});continue}if(i(h)&&e+1<t.length&&o(t[e+1])){a(),x=null;let n=[d(h)],r=d(t[e+1]).map(c),l=e+2;for(;l<t.length&&i(t[l])&&!o(t[l]);)n.push(d(t[l])),l++;s.push({kind:"table",text:t.slice(e,l).join("\n"),rows:n,align:r}),e=l-1;continue}let y=h.match(/^(\s*)(\d+)\. +(.+)$/);if(y){a(),s.push({kind:"ol",text:y[3],depth:m(y[1]),marker:y[2]}),x=s.length-1;continue}let N=h.match(/^(\s*)- +(.+)$/);if(N){a(),s.push({kind:"ul",text:N[2],depth:m(N[1])}),x=s.length-1;continue}if(null!==x&&0===n.length){s[x].text+=" "+h.trim();continue}n.push(h)}return a(),l(),null!==p&&s.push({kind:"code",text:p.join("\n")}),s}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,n.jsx)("pre",{className:"overflow-x-auto rounded-lg border border-white/10 bg-white/[0.06] p-3 text-[12px] leading-relaxed",children:(0,n.jsx)("code",{className:"whitespace-pre font-mono [overflow-wrap:normal]",children:t?function(e){let t,s=[],a=0,r=0,l=e=>(0,n.jsx)("span",{className:"text-foreground/45",children:e},r++);for(p.lastIndex=0;null!==(t=p.exec(e));){if(t.index>a&&s.push(l(e.slice(a,t.index))),void 0!==t[1]){let e=void 0!==t[2];s.push((0,n.jsx)("span",{className:e?"text-sky-300":"text-emerald-300/90",children:t[1]},r++)),e&&t[2]&&s.push(l(t[2]))}else void 0!==t[3]?s.push((0,n.jsx)("span",{className:"text-purple-300",children:t[3]},r++)):void 0!==t[4]&&s.push((0,n.jsx)("span",{className:"text-amber-300",children:t[4]},r++));a=p.lastIndex}return a<e.length&&s.push(l(e.slice(a))),s}(t):(0,n.jsx)("span",{className:"text-foreground/85",children:e})})})}function h({block:e}){let t=e.rows??[];if(0===t.length)return null;let[s,...a]=t,l=e.align??[],o=e=>"center"===l[e]?"text-center":"right"===l[e]?"text-right":"text-left";return(0,n.jsx)("div",{className:"overflow-x-auto rounded-lg border border-white/10",children:(0,n.jsxs)("table",{className:"w-full border-collapse text-[13px] [overflow-wrap:normal]",children:[(0,n.jsx)("thead",{children:(0,n.jsx)("tr",{className:"border-b border-white/15 bg-white/[0.04]",children:s.map((e,t)=>(0,n.jsx)("th",{className:(0,r.cn)("whitespace-nowrap px-3 py-1.5 font-semibold text-foreground",o(t)),children:(0,n.jsx)(w,{text:e})},t))})}),(0,n.jsx)("tbody",{children:a.map((e,t)=>(0,n.jsx)("tr",{className:"border-b border-white/5 last:border-0",children:e.map((e,t)=>(0,n.jsx)("td",{className:(0,r.cn)("px-3 py-1.5 align-top text-foreground/90",o(t)),children:(0,n.jsx)(w,{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 v(e){return`plan-h-${e}`}function j(e){return e.replace(/[`*]/g,"").trim()}function y(e,t,s,a){let l="reading"===s;switch(e.kind){case"h1":return(0,n.jsx)("h1",{id:a,className:l?"scroll-mt-24 text-xl font-semibold tracking-tight text-foreground":"text-base font-semibold text-foreground",children:t});case"h2":return(0,n.jsx)("h2",{id:a,className:l?"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,n.jsx)("h3",{id:a,className:l?"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,n.jsx)("h4",{id:a,className:l?"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 s=e.depth??0;return(0,n.jsxs)("div",{className:(0,r.cn)("flex gap-2",l?"text-foreground/95":"text-foreground/90"),style:{marginLeft:`${.75+1.25*s}rem`},children:[(0,n.jsx)("span",{className:"shrink-0 select-none text-muted-foreground tabular-nums",children:"ol"===e.kind?`${e.marker}.`:"•"}),(0,n.jsx)("span",{className:"min-w-0 flex-1",children:t})]})}case"quote":return(0,n.jsx)("blockquote",{className:(0,r.cn)("whitespace-pre-wrap border-l-2 pl-3 italic",l?"border-white/15 text-foreground/80":"border-white/10 text-foreground/75"),children:t});default:return(0,n.jsx)("p",{className:(0,r.cn)("whitespace-pre-wrap",l?"text-foreground/95":"text-foreground/90"),children:t})}}function N({block:e,variant:t}){return"code"===e.kind?(0,n.jsx)(x,{text:e.text}):"table"===e.kind?(0,n.jsx)(h,{block:e}):(0,n.jsx)(n.Fragment,{children:y(e,(0,n.jsx)(w,{text:e.text}),t)})}function w({text:e}){let t=e.split(/(`[^`]+`|\*\*[\s\S]+?\*\*|\*[^*]+\*)/g);return(0,n.jsx)(n.Fragment,{children:t.map((e,t)=>/^`[^`]+`$/.test(e)?(0,n.jsx)("code",{className:"rounded bg-white/5 px-1 font-mono text-[12px]",children:e.slice(1,-1)},t):/^\*\*[\s\S]+\*\*$/.test(e)?(0,n.jsx)("strong",{className:"font-semibold text-foreground",children:(0,n.jsx)(w,{text:e.slice(2,-2)})},t):/^\*[^*]+\*$/.test(e)?(0,n.jsx)("em",{className:"text-muted-foreground",children:(0,n.jsx)(w,{text:e.slice(1,-1)})},t):(0,n.jsx)("span",{children:e},t))})}},62311:(e,t,s)=>{s.d(t,{Z:()=>m});var n=s(95155),a=s(98500),r=s.n(a),l=s(25640),o=s(83599),i=s(94192),d=s(34306),c=s(91337);let u={ROADMAP:l.A,ARCHITECTURE:o.A,FILES:i.A,DATABASE:d.A};function m({tabs:e,active:t}){return(0,n.jsx)("div",{className:"flex items-center gap-0.5",children:e.map(e=>{let s=e.value===t,a=e.Icon??u[e.value];return(0,n.jsxs)(r(),{href:e.href,className:(0,c.cn)("flex items-center gap-1.5 rounded-md px-2.5 py-1 text-[12px] font-medium tracking-tight transition-colors",s?"bg-white/10 text-foreground":"text-muted-foreground/80 hover:bg-white/5 hover:text-foreground"),children:[a?(0,n.jsx)(a,{className:"size-3"}):null,(0,n.jsx)("span",{children:e.label})]},e.value)})})}},70521:(e,t,s)=>{s.d(t,{$v:()=>N,EO:()=>b,Lt:()=>x,Rx:()=>w,Zr:()=>k,ck:()=>j,r7:()=>y,tv:()=>h,wd:()=>v});var n=s(95155);s(12115);var a=s(25381),r=s(7121),l=s(51880),o=s(35176),i=s(11248),d=s(82022),c=s(98758),u=s(45362),m=s(91337),p=s(4474);function x({...e}){return(0,n.jsx)(a.V,{"data-slot":"alert-dialog",...e})}function h({...e}){return(0,n.jsx)(r.t,{"data-slot":"alert-dialog-trigger",...e})}function f({...e}){return(0,n.jsx)(l.Z,{"data-slot":"alert-dialog-portal",...e})}function g({className:e,...t}){return(0,n.jsx)(o.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",...s}){return(0,n.jsxs)(f,{children:[(0,n.jsx)(g,{}),(0,n.jsx)(i.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),...s})]})}function v({className:e,...t}){return(0,n.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 j({className:e,...t}){return(0,n.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 y({className:e,...t}){return(0,n.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 N({className:e,...t}){return(0,n.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 w({className:e,variant:t,size:s,...a}){return(0,n.jsx)(u.H,{"data-slot":"alert-dialog-action",className:(0,m.cn)(e),render:(0,n.jsx)(p.$,{variant:t,size:s}),...a})}function k({className:e,variant:t="outline",size:s="default",...a}){return(0,n.jsx)(u.H,{"data-slot":"alert-dialog-cancel",className:(0,m.cn)(e),render:(0,n.jsx)(p.$,{variant:t,size:s}),...a})}},74350:(e,t,s)=>{s.d(t,{Cf:()=>g,Es:()=>v,L3:()=>j,c7:()=>b,lG:()=>x,rr:()=>y});var n=s(95155);s(12115);var a=s(17112),r=s(51880),l=s(35176),o=s(11248),i=s(45362),d=s(82022),c=s(98758),u=s(91337),m=s(4474),p=s(9005);function x({...e}){return(0,n.jsx)(a.D,{"data-slot":"dialog",...e})}function h({...e}){return(0,n.jsx)(r.Z,{"data-slot":"dialog-portal",...e})}function f({className:e,...t}){return(0,n.jsx)(l.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:s=!0,...a}){return(0,n.jsxs)(h,{children:[(0,n.jsx)(f,{}),(0,n.jsxs)(o.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),...a,children:[t,s&&(0,n.jsxs)(i.H,{"data-slot":"dialog-close",render:(0,n.jsx)(m.$,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[(0,n.jsx)(p.A,{}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function b({className:e,...t}){return(0,n.jsx)("div",{"data-slot":"dialog-header",className:(0,u.cn)("flex flex-col gap-2",e),...t})}function v({className:e,showCloseButton:t=!1,children:s,...a}){return(0,n.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),...a,children:[s,t&&(0,n.jsx)(i.H,{render:(0,n.jsx)(m.$,{variant:"outline"}),children:"Close"})]})}function j({className:e,...t}){return(0,n.jsx)(d.L,{"data-slot":"dialog-title",className:(0,u.cn)("font-heading text-base leading-none font-medium",e),...t})}function y({className:e,...t}){return(0,n.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,s)=>{s.d(t,{b:()=>r});var n=s(95155);s(12115);var a=s(91337);function r({className:e,children:t,...s}){return(0,n.jsxs)("div",{className:(0,a.cn)("glass relative isolate overflow-hidden",e),...s,children:[(0,n.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,n.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]})}},91337:(e,t,s)=>{s.d(t,{cn:()=>r});var n=s(29722),a=s(622);function r(...e){return(0,a.QP)((0,n.$)(e))}},95635:(e,t,s)=>{s.d(t,{x:()=>l});var n=s(95155),a=s(81750),r=s(6266);function l(){let e="!h-2 !w-2 !border-0 !bg-zinc-400";return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.h7,{type:"target",position:r.yX.Top,id:"tt",className:e}),(0,n.jsx)(a.h7,{type:"source",position:r.yX.Top,id:"st",className:e}),(0,n.jsx)(a.h7,{type:"target",position:r.yX.Right,id:"tr",className:e}),(0,n.jsx)(a.h7,{type:"source",position:r.yX.Right,id:"sr",className:e}),(0,n.jsx)(a.h7,{type:"target",position:r.yX.Bottom,id:"tb",className:e}),(0,n.jsx)(a.h7,{type:"source",position:r.yX.Bottom,id:"sb",className:e}),(0,n.jsx)(a.h7,{type:"target",position:r.yX.Left,id:"tl",className:e}),(0,n.jsx)(a.h7,{type:"source",position:r.yX.Left,id:"sl",className:e})]})}}}]);
|
|
File without changes
|
|
File without changes
|