@flesler/cursor-canvas-web 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +9 -8
  2. package/dist/cursor-canvas.cjs +1 -1
  3. package/dist/cursor-canvas.js +530 -701
  4. package/dist/host-tokens-Cjzmp0z_.cjs +1 -0
  5. package/dist/host-tokens-Dh2BFFjv.js +412 -0
  6. package/dist/runtime/index.d.ts +5 -7
  7. package/dist/runtime.cjs +1 -1
  8. package/dist/runtime.js +101 -14
  9. package/package.json +22 -12
  10. package/src/vendor/canvas/SKILL.md +113 -0
  11. package/src/vendor/canvas-sdk/callout-tone-icons.d.ts +10 -0
  12. package/src/vendor/canvas-sdk/canvas-tokens.d.ts +259 -0
  13. package/src/vendor/canvas-sdk/chart-primitives.d.ts +272 -0
  14. package/src/vendor/canvas-sdk/collapsible-section.d.ts +66 -0
  15. package/src/vendor/canvas-sdk/dag-layout.d.ts +101 -0
  16. package/src/vendor/canvas-sdk/diff-view.d.ts +129 -0
  17. package/src/vendor/canvas-sdk/form-primitives.d.ts +194 -0
  18. package/src/vendor/canvas-sdk/hooks.d.ts +173 -0
  19. package/src/vendor/canvas-sdk/index.d.ts +65 -0
  20. package/src/vendor/canvas-sdk/internal/canvas-action-dispatch.d.ts +17 -0
  21. package/src/vendor/canvas-sdk/manifest.json +5 -0
  22. package/src/vendor/canvas-sdk/swatch.d.ts +39 -0
  23. package/src/vendor/canvas-sdk/theme.d.ts +107 -0
  24. package/src/vendor/canvas-sdk/todo-list.d.ts +48 -0
  25. package/src/vendor/canvas-sdk/ui-primitives.d.ts +569 -0
  26. package/src/vendor/canvas-sdk/usage-bar.d.ts +55 -0
  27. package/dist/shim/charts.d.ts +0 -62
  28. package/dist/shim/cursor-canvas.d.ts +0 -278
  29. package/dist/shim/dag.d.ts +0 -55
  30. package/dist/shim/diff.d.ts +0 -23
  31. package/dist/shim/theme.d.ts +0 -319
  32. package/dist/shim/todo.d.ts +0 -22
  33. package/dist/shim/use-tokens.d.ts +0 -6
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # cursor-canvas-web
2
2
 
3
- > **Fork** of [`@thisismydesign/cursor-canvas-web`](https://github.com/thisismydesign/cursor-canvas-web) ([npm](https://www.npmjs.com/package/@thisismydesign/cursor-canvas-web)), published as **`@flesler/cursor-canvas-web`**. We keep the shim aligned with the Cursor IDE `cursor/canvas` SDK (see [`COMPAT.md`](./COMPAT.md), `pnpm test:contract`) and track current stack versions — **Mantine 8** and **Recharts 2 or 3** — instead of the upstream Mantine 7 line.
3
+ > **Fork** of [`@thisismydesign/cursor-canvas-web`](https://github.com/thisismydesign/cursor-canvas-web) ([npm](https://www.npmjs.com/package/@thisismydesign/cursor-canvas-web)), published as `@flesler/cursor-canvas-web`. We keep the shim aligned with the Cursor IDE `cursor/canvas` SDK (see [`COMPAT.md`](./COMPAT.md), `pnpm test:contract`) and track current stack versions — **Mantine 8** and **Recharts 2 or 3** — instead of the upstream Mantine 7 line.
4
4
 
5
5
  Deploy **Cursor canvases** to the web.
6
6
 
@@ -15,7 +15,7 @@ A Cursor canvas is a `.tsx` that imports only from `cursor/canvas`. That module
15
15
  <img src="docs/demo-dark.png" alt="Demo canvas (dark)" width="49%" />
16
16
  </p>
17
17
 
18
- Regenerate demo: `pnpm sync:demo` then `pnpm demo:screenshot` (sibling [open-canvas](https://github.com/flesler/open-canvas) built; sync uses `open-canvas generate --formats cursor`).
18
+ Regenerate demo: `pnpm sync:demo` then `pnpm demo:screenshot` (sibling [open-canvas](https://github.com/flesler/open-canvas) built; uses `open-canvas generate --formats cursor`).
19
19
 
20
20
  ## How it works: a module shim, not a converter
21
21
 
@@ -44,8 +44,8 @@ pnpm add react react-dom @mantine/core@^8 @mantine/charts@^8 recharts@^2
44
44
 
45
45
  The package ships two entry points:
46
46
 
47
- | Import | Provides |
48
- | ------------------------------------------- | --------------------------------------------- |
47
+ | Import | Provides |
48
+ | ------------------------------------ | --------------------------------------------- |
49
49
  | `@flesler/cursor-canvas-web` | The `cursor/canvas` shim (components, hooks). |
50
50
  | `@flesler/cursor-canvas-web/runtime` | `CanvasRoot` + `mountCanvas` web host glue. |
51
51
 
@@ -130,9 +130,10 @@ The shim implements the **full public `cursor/canvas` surface**:
130
130
  and `spacing` (see `COMPAT.md` for IDE vs web)
131
131
 
132
132
  Known fidelity gaps (behavior is reproduced, not the exact renderer):
133
- `DiffView` skips Shiki syntax highlighting (plain-text fallback), and
134
- `useCanvasAction` is a no-op on the web (IDE-only). Styling approximates the
135
- Cursor theme rather than matching it pixel-for-pixel.
133
+ `DiffView` skips IDE Shiki highlighting (plain-text lines; gutters/backgrounds
134
+ stay). Charts use Recharts instead of inline SVG; `useCanvasAction` is a
135
+ no-op on the web (IDE-only). Styling approximates the Cursor theme rather than
136
+ matching it pixel-for-pixel.
136
137
 
137
138
  If your canvas needs an export the shim doesn't yet provide, see
138
139
  [Extending the shim](#extending-the-shim).
@@ -170,7 +171,7 @@ pnpm typecheck # tsc --noEmit, strict
170
171
  pnpm lint # eslint
171
172
  pnpm test # vitest run
172
173
  pnpm test:contract # IDE SDK snapshot + export parity + consumer tsc
173
- pnpm sync:sdk # refresh test/contract/cursor-sdk from ~/.cursor/skills-cursor/canvas/sdk
174
+ pnpm sync:sdk # refresh src/vendor/canvas-sdk from ~/.cursor/skills-cursor/canvas/sdk
174
175
  pnpm build # typecheck + vite build -> dist/
175
176
  ```
176
177
 
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),u=require("@mantine/core"),y=require("react"),w=require("@mantine/charts"),O={foreground:"#E4E4E4EB",foregroundSecondary:"#E4E4E48D",foregroundTertiary:"#E4E4E45E",foregroundQuaternary:"#E4E4E442",editor:"#181818",chrome:"#141414",sidebar:"#141414",elevated:"#181818",fillPrimary:"#E4E4E430",fillSecondary:"#E4E4E41E",fillTertiary:"#E4E4E411",fillQuaternary:"#E4E4E40A",strokePrimary:"#E4E4E433",strokeSecondary:"#E4E4E41F",strokeTertiary:"#E4E4E414",strokeFocused:"#599CE7",accent:"#599CE7",buttonBackground:"#599CE7",buttonForeground:"#191c22",buttonHoverBackground:"#6AABE9",link:"#87c3ff",diffInsertedLine:"#3FA26633",diffRemovedLine:"#B8004933",diffStripAdded:"#3FA2668F",diffStripRemoved:"#FC6B838F"},G={foreground:"#141414F0",foregroundSecondary:"#141414BD",foregroundTertiary:"#1414148A",foregroundQuaternary:"#1414145C",editor:"#FCFCFC",chrome:"#F8F8F8",sidebar:"#F3F3F3",elevated:"#FCFCFC",fillPrimary:"#14141433",fillSecondary:"#14141424",fillTertiary:"#14141414",fillQuaternary:"#1414140F",strokePrimary:"#14141433",strokeSecondary:"#1414141F",strokeTertiary:"#14141414",strokeFocused:"#3685BF",accent:"#3685BF",buttonBackground:"#3685BF",buttonForeground:"#FCFCFC",buttonHoverBackground:"#2E76AB",link:"#3685BF",diffInsertedLine:"#1F8A651F",diffRemovedLine:"#CF2D5614",diffStripAdded:"#1F8A65CC",diffStripRemoved:"#CF2D56CC"},M={gray:"#8888A8E0",purple:"#7B64B8F0",green:"#1F8A65E8",yellow:"#E8C030E0",cyan:"#2A9A8AE0",pink:"#C85898E0",blue:"#2E79B5E0",orange:"#F0A040E0",red:"#C04848E0"},$={gray:"#8888A8E0",purple:"#7B64B8F0",green:"#1F8A65E8",yellow:"#E8C030E0",cyan:"#2A9A8AE0",pink:"#C85898E0",blue:"#2E79B5E0",orange:"#F0A088E0",red:"#CF2D56E0"};function oe(e,t){return{bg:{editor:e.editor,chrome:e.chrome,elevated:e.elevated},text:{primary:e.foreground,secondary:e.foregroundSecondary,tertiary:e.foregroundTertiary,quaternary:e.foregroundQuaternary,link:e.link,onAccent:e.buttonForeground},stroke:{primary:e.strokePrimary,secondary:e.strokeSecondary,tertiary:e.strokeTertiary,focused:e.strokeFocused},fill:{primary:e.fillPrimary,secondary:e.fillSecondary,tertiary:e.fillTertiary,quaternary:e.fillQuaternary},accent:{primary:e.accent,control:e.buttonBackground,controlHover:e.buttonHoverBackground},diff:{insertedLine:e.diffInsertedLine,removedLine:e.diffRemovedLine,stripAdded:e.diffStripAdded,stripRemoved:e.diffStripRemoved},category:t}}const ae=oe(O,M),se=oe(G,$),ye=M,I=["blue","purple","green","yellow","cyan","pink","orange","red","gray"],me={green:"#1F8A65E8",darkGreen:"#0D855AE0",lightGreen:"#52B896E0",mintGreen:"#7DCAB0E0",blue:"#2E79B5E0",lightBlue:"#70B0D8E0",indigo:"#5A6CC0F0",lightIndigo:"#9AAADCE0",purple:"#7B64B8F0",lightPurple:"#AA98D8E0",warmPink:"#C85898E0",lightPink:"#E8A0C4E0",brightOrange:"#F0A040E0",deepOrange:"#C06028E0",goldenYellow:"#E8C030E0",darkAmber:"#C04848E0",warmPeach:"#F0A088E0",vibrantTeal:"#2A9A8AE0",muted:"#8888A8E0",neutralLine:"#888899D0"},ve={h1:{fontSize:"24px",lineHeight:"30px",fontWeight:590},h2:{fontSize:"18px",lineHeight:"24px",fontWeight:590},h3:{fontSize:"16px",lineHeight:"22px",fontWeight:590},body:{fontSize:"14px",lineHeight:"20px",fontWeight:400},small:{fontSize:"12px",lineHeight:"16px",fontWeight:400}},be={"0.5":2,1:4,"1.5":6,2:8,"2.5":10,3:12,"3.5":14,4:16,"4.5":18,5:20,6:24,7:28,8:32,9:36,10:40},Ee={none:0,xs:2,sm:4,md:6,lg:8,xl:12,full:9999},W=["#1F8A65E8","#70B0D8E0","#5A6CC0F0","#F0A040E0","#C06028E0","#E8C030E0","#C85898E0","#F0A088E0","#7B64B8F0","#7DCAB0E0","#8888A8E0","#2A9A8AE0"],E={success:"#1F8A65",danger:"#CF2D56",warning:"#E8A33D",info:"#2E79B5",neutral:"#8888A8",added:"#1F8A65",deleted:"#CF2D56",renamed:"#5A6CC0"},q={success:"green",danger:"red",warning:"orange",info:"blue",neutral:"gray",added:"green",deleted:"red",renamed:"indigo"};function je(e){const t=e==="dark"?ae:se;return{...t,kind:e,tokens:t,palette:e==="dark"?O:G,category:e==="dark"?M:$,chart:{palette:me,sequence:W},radius:Ee,typography:ve,spacing:be}}function j(){const e=u.useComputedColorScheme("light");return je(e==="dark"?"dark":"light")}function ie(e,t){return e?E[e]:W[t%W.length]}function N(e,t){return e.map((r,s)=>{const i={category:r};for(const o of t)i[o.name]=o.data[s]??0;return i})}function ce(e){return e.map((t,r)=>({name:t.name,color:ie(t.tone,r)}))}function le(e,t){if(!(!e&&!t))return r=>`${t??""}${r}${e??""}`}function ke(e,t){if(e!=null&&e.length)return e.map(r=>({...t?{x:r.value}:{y:r.value},label:r.label,color:r.tone?E[r.tone]:E.neutral}))}function de(e){const t=ke(e.referenceLines,!!e.horizontal);if(e.stacked||e.normalized)return{referenceLines:t};const r=e.beginAtZero!==!1,s=[e.yMin??(r?0:"auto"),e.yMax??"auto"];return e.horizontal?{xAxisProps:{domain:s},referenceLines:t}:{yAxisProps:{domain:s},referenceLines:t}}function Ce(e,t,r){return e!==void 0?e:t.length===1&&r.length<=8}function Se({categories:e,series:t,height:r=240,fill:s,valueSuffix:i,valuePrefix:o,showValues:l,showHoverGuide:f=!0,beginAtZero:d,yMin:c,yMax:h,referenceLines:x,style:v}){const b=N(e,t),F=ce(t),k=de({beginAtZero:d,yMin:c,yMax:h,referenceLines:x,horizontal:!1}),C={h:r,data:b,dataKey:"category",series:F,curveType:"monotone",withLegend:t.length>1,valueFormatter:le(i,o),withPointLabels:l??e.length<=20,tooltipProps:f?void 0:{cursor:!1},...k,style:v};return s?n.jsx(w.AreaChart,{...C}):n.jsx(w.LineChart,{...C})}function Ae({categories:e,series:t,height:r=240,stacked:s,horizontal:i,normalized:o,valueSuffix:l,valuePrefix:f,showValues:d,beginAtZero:c,yMin:h,yMax:x,referenceLines:v,style:b}){const F=N(e,t),k=o?"percent":s?"stacked":"default",C=de({beginAtZero:c,yMin:h,yMax:x,referenceLines:v,horizontal:i,stacked:s,normalized:o}),T=!s&&!o&&Ce(d,t,e);return n.jsx(w.BarChart,{h:r,data:F,dataKey:"category",series:ce(t),type:k,orientation:i?"vertical":"horizontal",withLegend:t.length>1,valueFormatter:le(l,f),withBarValueLabel:T,...C,style:b})}function Fe({data:e,size:t=200,donut:r,style:s}){const i=e.map((l,f)=>({name:l.label,value:l.value,color:ie(l.tone,f)})),o=r?n.jsx(w.DonutChart,{data:i,size:t,withTooltip:!0,style:s}):n.jsx(w.PieChart,{data:i,size:t,withTooltip:!0,withLabelsLine:!1,style:s});return n.jsx("div",{style:{width:"100%",height:t,minHeight:t,display:"flex",alignItems:"center",justifyContent:"center"},children:o})}function Te(e){const{nodes:t,edges:r,direction:s="vertical",nodeWidth:i=160,nodeHeight:o=40,rankGap:l=64,nodeGap:f=48,padding:d=24}=e,c=t.map(a=>a.id),h=new Set(c),x=new Map;for(const a of c)x.set(a,[]);for(const a of r)h.has(a.from)&&h.has(a.to)&&x.get(a.from).push(a.to);const v=0,b=1,F=2,k=new Map(c.map(a=>[a,v])),C=new Set,T=(a,g)=>`${a}\0${g}`,Q=a=>{k.set(a,b);for(const g of x.get(a)??[]){const p=k.get(g);p===b?C.add(T(a,g)):p===v&&Q(g)}k.set(a,F)};for(const a of c)k.get(a)===v&&Q(a);const he=r.filter(a=>h.has(a.from)&&h.has(a.to)&&!C.has(T(a.from,a.to))),S=new Map(c.map(a=>[a,0])),K=new Map(c.map(a=>[a,[]]));for(const a of he)K.get(a.from).push(a.to),S.set(a.to,(S.get(a.to)??0)+1);const B=new Map(c.map(a=>[a,0])),H=c.filter(a=>(S.get(a)??0)===0);for(;H.length>0;){const a=H.shift(),g=B.get(a);for(const p of K.get(a))B.set(p,Math.max(B.get(p),g+1)),S.set(p,S.get(p)-1),S.get(p)===0&&H.push(p)}const A=new Map;for(const a of c){const g=B.get(a);A.has(g)||A.set(g,[]),A.get(g).push(a)}const L=[...A.keys()].sort((a,g)=>a-g),m=s==="vertical",X=a=>a*(m?i:o)+Math.max(0,a-1)*f,V=Math.max(0,...L.map(a=>X(A.get(a).length))),D=new Map,Y=[];L.forEach((a,g)=>{const p=A.get(a),R=X(p.length),z=d+(V-R)/2,P=d+g*((m?o:i)+l);p.forEach((ee,te)=>{const re=z+te*((m?i:o)+f),pe=m?re:P,xe=m?P:re;D.set(ee,{id:ee,x:pe,y:xe,rank:a,order:te})}),Y.push({rank:a,x:m?z:P,y:m?P:z,width:m?R:i,height:m?o:R,nodeIds:p})});const U=(a,g)=>a?m?{x:a.x+i/2,y:g==="source"?a.y+o:a.y}:{x:g==="source"?a.x+i:a.x,y:a.y+o/2}:{x:0,y:0},ge=r.filter(a=>h.has(a.from)&&h.has(a.to)).map(a=>{const g=U(D.get(a.from),"source"),p=U(D.get(a.to),"target");return{from:a.from,to:a.to,sourceX:g.x,sourceY:g.y,targetX:p.x,targetY:p.y,isBackEdge:C.has(T(a.from,a.to))}}),J=d*2+L.length*(m?o:i)+Math.max(0,L.length-1)*l,Z=d*2+V;return{nodes:[...D.values()],edges:ge,ranks:Y,direction:s,width:m?Z:J,height:m?J:Z}}function we({additions:e=0,deletions:t=0,style:r}){return e===0&&t===0?null:n.jsxs("span",{style:{display:"inline-flex",gap:8,fontVariantNumeric:"tabular-nums",fontSize:12,fontWeight:600,...r},children:[e>0&&n.jsxs("span",{style:{color:E.added},children:["+",e]}),t>0&&n.jsxs("span",{style:{color:E.deleted},children:["-",t]})]})}const Be={added:"+",removed:"-",unchanged:" "};function Le({lines:e,showLineNumbers:t=!0,coloredLineNumbers:r=!0,showAccentStrip:s=!0,style:i}){const o=j(),l=c=>c==="added"?o.diff.insertedLine:c==="removed"?o.diff.removedLine:"transparent",f=c=>c==="added"?o.diff.stripAdded:c==="removed"?o.diff.stripRemoved:"transparent",d=c=>r&&c==="added"?E.added:r&&c==="removed"?E.deleted:o.text.tertiary;return n.jsx("div",{style:{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace',fontSize:12.5,lineHeight:"18px",color:o.text.primary,overflowX:"auto",...i},children:e.map((c,h)=>n.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:l(c.type),borderLeft:s?`3px solid ${f(c.type)}`:void 0},children:[t&&n.jsx("span",{style:{flex:"0 0 auto",width:40,textAlign:"right",paddingRight:10,userSelect:"none",color:d(c.type)},children:c.lineNumber??""}),n.jsx("span",{style:{flex:"0 0 auto",width:14,textAlign:"center",userSelect:"none",color:d(c.type)},children:Be[c.type]}),n.jsx("pre",{style:{margin:0,padding:"0 8px",whiteSpace:"pre",fontFamily:"inherit"},children:c.content})]},h))})}function De({status:e}){const t=j(),r=e==="completed"?E.success:e==="in_progress"?t.accent.primary:e==="cancelled"?E.danger:t.text.tertiary;return n.jsxs("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",style:{flex:"0 0 auto",marginTop:3},"aria-hidden":!0,children:[n.jsx("circle",{cx:7,cy:7,r:6,stroke:r,strokeWidth:1.4}),e==="completed"&&n.jsx("path",{d:"M4 7.2l2 2 4-4.4",stroke:r,strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"}),e==="in_progress"&&n.jsx("circle",{cx:7,cy:7,r:3,fill:r}),e==="cancelled"&&n.jsx("path",{d:"M4.8 4.8l4.4 4.4M9.2 4.8l-4.4 4.4",stroke:r,strokeWidth:1.4,strokeLinecap:"round"})]})}function ue({todos:e,dimmedTodoIds:t,onTodoClick:r,style:s}){const i=j();return e.length===0?null:n.jsx("div",{style:{display:"flex",flexDirection:"column",...s},children:e.map(o=>{const l=t==null?void 0:t.has(o.id);return n.jsxs("button",{type:"button",onClick:()=>r==null?void 0:r(o),style:{display:"flex",gap:8,alignItems:"flex-start",width:"100%",textAlign:"left",padding:"4px 6px",background:"transparent",border:"none",cursor:r?"pointer":"default",color:i.text.primary,fontSize:14,lineHeight:"20px",opacity:l?.45:1},children:[n.jsx(De,{status:o.status}),n.jsx("span",{style:{textDecoration:o.status==="cancelled"?"line-through":void 0,color:o.status==="cancelled"?i.text.tertiary:void 0},children:o.content})]},o.id)})})}function Pe({todos:e,dimmedTodoIds:t,defaultExpanded:r=!1,onTodoClick:s,style:i}){const o=j(),[l,f]=y.useState(r);if(e.length===0)return null;const d=e.filter(c=>c.status==="completed").length;return n.jsxs("div",{style:{border:`1px solid ${o.stroke.primary}`,borderRadius:6,overflow:"hidden",...i},children:[n.jsxs("button",{type:"button",onClick:()=>f(c=>!c),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 10px",background:"transparent",border:"none",cursor:"pointer",color:o.text.secondary,fontSize:12,fontWeight:600},children:[n.jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",style:{transform:l?"rotate(90deg)":"none",transition:"transform 120ms"},"aria-hidden":!0,children:n.jsx("path",{d:"M4 2.5L8 6l-4 3.5",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"})}),n.jsx("span",{children:"Todos"}),n.jsx("span",{style:{flex:1}}),n.jsxs("span",{children:[d," of ",e.length," Done"]})]}),l&&n.jsx("div",{style:{padding:6},children:n.jsx(ue,{todos:e,dimmedTodoIds:t,onTodoClick:s})})]})}function Me(e,t){const r=`canvas:${e}`,[s,i]=y.useState(()=>{if(typeof localStorage>"u")return t;try{const l=localStorage.getItem(r);return l===null?t:JSON.parse(l)}catch{return t}}),o=y.useCallback(l=>{i(f=>{const d=typeof l=="function"?l(f):l;try{localStorage==null||localStorage.setItem(r,JSON.stringify(d))}catch{}return d})},[r]);return[s,o]}function He(){return y.useCallback(e=>{},[])}function Re(e,t){return{...e,...t}}function ze({children:e,style:t}){return n.jsx(u.Title,{order:1,fz:24,lh:"30px",style:t,children:e})}function Ie({children:e,style:t}){return n.jsx(u.Title,{order:2,fz:18,lh:"24px",style:t,children:e})}function We({children:e,style:t}){return n.jsx(u.Title,{order:3,fz:16,lh:"22px",style:t,children:e})}const Oe={normal:400,medium:500,semibold:600,bold:700};function Ge({children:e,tone:t="primary",size:r="body",as:s="p",weight:i="normal",italic:o,truncate:l,style:f}){const d=j();return n.jsx(u.Text,{component:s,size:r==="small"?"xs":"sm",fw:Oe[i],c:t==="primary"?void 0:d.text[t],truncate:l,style:{fontStyle:o?"italic":void 0,...f},children:e})}function $e({children:e,style:t}){return n.jsx("code",{style:{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace',fontSize:"0.92em",background:"var(--mantine-color-default-hover)",borderRadius:4,padding:"1px 4px",...t},children:e})}function qe({children:e,href:t,style:r}){return n.jsx("a",{href:t,target:"_blank",rel:"noreferrer",style:{color:"var(--mantine-color-anchor)",...r},children:e})}function Ne({children:e,gap:t,style:r}){return n.jsx(u.Stack,{gap:t,style:r,children:e})}const ne={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch","space-between":"space-between"};function _e({children:e,gap:t,align:r="center",justify:s="start",wrap:i=!1,style:o}){return n.jsx(u.Group,{gap:t,align:ne[r],justify:ne[s],wrap:i?"wrap":"nowrap",style:o,children:e})}function Qe(){return n.jsx("div",{style:{flex:1}})}function Ke({children:e,columns:t,gap:r=16,align:s,style:i}){const o=typeof t=="number"?`repeat(${t}, minmax(0, 1fr))`:t;return n.jsx("div",{style:{display:"grid",gridTemplateColumns:o,gap:r,alignItems:s,...i},children:e})}function Xe({style:e}){return n.jsx(u.Divider,{style:e})}const _=y.createContext({collapsible:!1,open:!0,toggle:()=>{}});function Ve({children:e,variant:t="default",collapsible:r=!1,defaultOpen:s=!0,open:i,onOpenChange:o,style:l}){const[f,d]=y.useState(s),c=i??f,h=y.useCallback(()=>{const x=!c;i===void 0&&d(x),o==null||o(x)},[c,i,o]);return n.jsx(u.Card,{withBorder:t!=="borderless",radius:"md",padding:0,style:l,children:n.jsx(_.Provider,{value:{collapsible:r,open:c,toggle:h},children:e})})}function Ye({children:e,trailing:t,style:r}){const{collapsible:s,open:i,toggle:o}=y.useContext(_);return n.jsxs("div",{onClick:s?o:void 0,style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 14px",borderBottom:"1px solid var(--mantine-color-default-border)",fontSize:12,fontWeight:600,color:"var(--mantine-color-dimmed)",cursor:s?"pointer":void 0,userSelect:s?"none":void 0,...r},children:[n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[s&&n.jsx(fe,{expanded:i}),e]}),t!=null&&n.jsx("span",{children:t})]})}function Ue({children:e,style:t}){const{collapsible:r,open:s}=y.useContext(_);return r&&!s?null:n.jsx("div",{style:{padding:14,...t},children:e})}function fe({expanded:e}){return n.jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",style:{transform:e?"rotate(90deg)":"none",transition:"transform 120ms"},"aria-hidden":!0,children:n.jsx("path",{d:"M4 2.5L8 6l-4 3.5",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"})})}function Je({value:e,label:t,tone:r,style:s}){return n.jsxs("div",{style:s,children:[n.jsx(u.Text,{fz:22,fw:700,lh:1.2,c:r?`${q[r]}.6`:void 0,children:e}),n.jsx(u.Text,{fz:12,c:"dimmed",children:t})]})}function Ze({children:e,active:t,tone:r="neutral",size:s="md",leadingContent:i,keyboardHint:o,title:l,style:f,onClick:d}){return n.jsx(u.Badge,{color:q[r],variant:t?"filled":"light",size:s==="sm"?"sm":"md",leftSection:i,rightSection:o,title:l,onClick:d,style:{cursor:d?"pointer":void 0,textTransform:"none",...f},children:e})}function et({children:e,tone:t="neutral",title:r,icon:s,style:i}){return n.jsx(u.Alert,{color:q[t],title:r,icon:s,variant:"light",style:i,children:e})}const tt={success:"rgba(31,138,101,0.12)",danger:"rgba(207,45,86,0.12)",warning:"rgba(232,163,61,0.14)",info:"rgba(46,121,181,0.12)",neutral:"rgba(136,136,168,0.12)"};function rt({headers:e,rows:t,columnAlign:r,rowTone:s,framed:i=!0,striped:o,stickyHeader:l,style:f,emptyMessage:d}){return n.jsxs(u.Table,{withTableBorder:i,withColumnBorders:!1,striped:o,stickyHeader:l,highlightOnHover:!0,style:f,children:[n.jsx(u.Table.Thead,{children:n.jsx(u.Table.Tr,{children:e.map((c,h)=>n.jsx(u.Table.Th,{ta:(r==null?void 0:r[h])??"left",children:c},h))})}),n.jsx(u.Table.Tbody,{children:t.length===0?n.jsx(u.Table.Tr,{children:n.jsx(u.Table.Td,{colSpan:e.length,ta:"center",c:"dimmed",children:d??"No data"})}):t.map((c,h)=>{const x=s==null?void 0:s[h];return n.jsx(u.Table.Tr,{style:x?{background:tt[x]}:void 0,children:e.map((v,b)=>n.jsx(u.Table.Td,{ta:(r==null?void 0:r[b])??"left",children:c[b]},b))},h)})})]})}const nt={primary:"filled",secondary:"default",ghost:"subtle"};function ot({children:e,variant:t="secondary",disabled:r,type:s="button",style:i,onClick:o}){return n.jsx(u.Button,{variant:nt[t],size:"xs",disabled:r,type:s,onClick:o,style:i,children:e})}function at({children:e,onClick:t,disabled:r,title:s,variant:i="default",size:o="md",style:l}){return n.jsx(u.ActionIcon,{variant:i==="circle"?"light":"subtle",radius:i==="circle"?"xl":"sm",size:o==="sm"?"sm":"md",color:"gray",disabled:r,title:s,"aria-label":s,onClick:t,style:l,children:e})}function st({value:e,onChange:t,options:r,placeholder:s,disabled:i,style:o}){return n.jsx(u.Select,{value:e,data:r,placeholder:s,disabled:i,allowDeselect:!1,onChange:l=>{l!==null&&(t==null||t(l))},style:o})}function it({checked:e,onChange:t,disabled:r,label:s,style:i}){return n.jsx(u.Checkbox,{checked:e,disabled:r,label:s,onChange:o=>t==null?void 0:t(o.currentTarget.checked),style:i})}function ct({checked:e,onChange:t,disabled:r,size:s="sm",style:i}){return n.jsx(u.Switch,{checked:e,disabled:r,size:s==="sm"?"sm":"md",onChange:o=>t==null?void 0:t(o.currentTarget.checked),style:i})}function lt({value:e,onChange:t,placeholder:r,disabled:s,type:i,style:o}){return n.jsx(u.TextInput,{value:e,placeholder:r,disabled:s,type:i,onChange:l=>t==null?void 0:t(l.currentTarget.value),style:o})}function dt({value:e,onChange:t,placeholder:r,disabled:s,rows:i=3,style:o}){return n.jsx(u.Textarea,{value:e,placeholder:r,disabled:s,autosize:!0,minRows:i,onChange:l=>t==null?void 0:t(l.currentTarget.value),style:o})}function ut({color:e,style:t}){const r=j();return n.jsx("span",{style:{display:"inline-block",width:14,height:14,borderRadius:4,background:r.category[e],flex:"0 0 auto",...t}})}function ft({segments:e,total:t,topLeftLabel:r,topRightLabel:s,style:i}){const o=j(),l=t>0?t:1,f=e.reduce((c,h)=>c+(Number.isFinite(h.value)&&h.value>0?h.value:0),0),d=Math.max(0,l-f);return n.jsxs("div",{style:i,children:[(r!=null||s!=null)&&n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:12,color:o.text.secondary,marginBottom:6},children:[n.jsx("span",{children:r}),n.jsx("span",{children:s})]}),n.jsxs("div",{style:{display:"flex",gap:2,height:8},children:[e.map((c,h)=>{const x=Number.isFinite(c.value)&&c.value>0?c.value:0,v=o.category[c.color??I[h%I.length]];return n.jsx("div",{style:{width:`${x/l*100}%`,background:v,borderRadius:3}},c.id)}),d>0&&n.jsx("div",{style:{width:`${d/l*100}%`,background:o.fill.tertiary,borderRadius:3}})]})]})}function ht({title:e,leading:t,count:r,trailing:s,children:i,defaultOpen:o=!1,style:l}){const f=j(),[d,c]=y.useState(o);return n.jsxs("div",{style:l,children:[n.jsxs("div",{onClick:()=>c(h=>!h),style:{display:"flex",alignItems:"center",gap:6,padding:"4px 0",cursor:"pointer",userSelect:"none",color:f.text.primary,fontSize:14},children:[n.jsx(fe,{expanded:d}),t,n.jsx("span",{style:{fontWeight:500},children:e}),r!=null&&n.jsx("span",{style:{color:f.text.tertiary,fontSize:12},children:r}),n.jsx("span",{style:{flex:1}}),s!=null&&n.jsx("span",{style:{color:f.text.tertiary},children:s})]}),d&&n.jsx("div",{style:{paddingLeft:18,paddingBottom:4},children:i})]})}Object.defineProperty(exports,"useEffect",{enumerable:!0,get:()=>y.useEffect});Object.defineProperty(exports,"useMemo",{enumerable:!0,get:()=>y.useMemo});Object.defineProperty(exports,"useRef",{enumerable:!0,get:()=>y.useRef});Object.defineProperty(exports,"useState",{enumerable:!0,get:()=>y.useState});exports.BarChart=Ae;exports.Button=ot;exports.Callout=et;exports.Card=Ve;exports.CardBody=Ue;exports.CardHeader=Ye;exports.Checkbox=it;exports.Code=$e;exports.CollapsibleSection=ht;exports.DiffStats=we;exports.DiffView=Le;exports.Divider=Xe;exports.Grid=Ke;exports.H1=ze;exports.H2=Ie;exports.H3=We;exports.IconButton=at;exports.LineChart=Se;exports.Link=qe;exports.PieChart=Fe;exports.Pill=Ze;exports.Row=_e;exports.Select=st;exports.Spacer=Qe;exports.Stack=Ne;exports.Stat=Je;exports.Swatch=ut;exports.Table=rt;exports.Text=Ge;exports.TextArea=dt;exports.TextInput=lt;exports.TodoList=ue;exports.TodoListCard=Pe;exports.Toggle=ct;exports.UsageBar=ft;exports.canvasPaletteDark=O;exports.canvasPaletteLight=G;exports.canvasTokens=ae;exports.canvasTokensLight=se;exports.categoryPaletteDark=M;exports.categoryPaletteLight=$;exports.colorPalette=ye;exports.computeDAGLayout=Te;exports.mergeStyle=Re;exports.reshapeLineChartData=N;exports.usageColorSequence=I;exports.useCanvasAction=He;exports.useCanvasState=Me;exports.useHostTheme=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),h=require("@mantine/core"),m=require("react"),b=require("./host-tokens-Cjzmp0z_.cjs"),P=require("@mantine/charts"),k={success:"#1F8A65",danger:"#CF2D56",warning:"#E8A33D",info:"#2E79B5",neutral:"#8888A8",added:"#1F8A65",deleted:"#CF2D56",renamed:"#5A6CC0"},Q={success:"green",danger:"red",warning:"orange",info:"blue",neutral:"gray",added:"green",deleted:"red",renamed:"indigo"};function x(){const e=h.useComputedColorScheme("light")==="dark"?"dark":"light";return b.resolveThemeForColorScheme(e)}function G(){const e=x().chart.sequence;return(r,o)=>r?k[r]:e[o%e.length]}function ee(t,e){return t.map((r,o)=>{const i={category:r};for(const s of e)i[s.name]=s.data[o]??0;return i})}function te(t,e){return t.map((r,o)=>({name:r.name,color:e(r.tone,o)}))}function re(t,e){if(!(!t&&!e))return r=>`${e??""}${r}${t??""}`}function de(t,e){if(t!=null&&t.length)return t.map(r=>({...e?{x:r.value}:{y:r.value},label:r.label,color:r.tone?k[r.tone]:k.neutral}))}function ne(t){const e=de(t.referenceLines,!!t.horizontal);if(t.stacked||t.normalized)return{referenceLines:e};const r=t.beginAtZero!==!1,o=[t.yMin??(r?0:"auto"),t.yMax??"auto"];return t.horizontal?{xAxisProps:{domain:o},referenceLines:e}:{yAxisProps:{domain:o},referenceLines:e}}function ue(t,e,r){return t!==void 0?t:e.length===1&&r.length<=8}function fe({categories:t,series:e,height:r=240,fill:o,valueSuffix:i,valuePrefix:s,showValues:l,showHoverGuide:u=!0,beginAtZero:d,yMin:c,yMax:f,referenceLines:y,style:j}){const S=G(),M=ee(t,e),w=te(e,S),C=ne({beginAtZero:d,yMin:c,yMax:f,referenceLines:y,horizontal:!1}),T={h:r,data:M,dataKey:"category",series:w,curveType:"monotone",withLegend:e.length>1,valueFormatter:re(i,s),withPointLabels:l??t.length<=20,tooltipProps:u?void 0:{cursor:!1},...C,style:j};return o?n.jsx(P.AreaChart,{...T}):n.jsx(P.LineChart,{...T})}function he({categories:t,series:e,height:r=240,stacked:o,horizontal:i,normalized:s,valueSuffix:l,valuePrefix:u,showValues:d,beginAtZero:c,yMin:f,yMax:y,referenceLines:j,style:S}){const M=G(),w=ee(t,e),C=s?"percent":o?"stacked":"default",T=ne({beginAtZero:c,yMin:f,yMax:y,referenceLines:j,horizontal:i,stacked:o,normalized:s}),F=!o&&!s&&ue(d,e,t);return n.jsx(P.BarChart,{h:r,data:w,dataKey:"category",series:te(e,M),type:C,orientation:i?"vertical":"horizontal",withLegend:e.length>1,valueFormatter:re(l,u),withBarValueLabel:F,...T,style:S})}function pe({data:t,size:e=200,donut:r,style:o}){const i=G(),s=t.map((u,d)=>({name:u.label,value:u.value,color:i(u.tone,d)})),l=r?n.jsx(P.DonutChart,{data:s,size:e,withTooltip:!0,style:o}):n.jsx(P.PieChart,{data:s,size:e,withTooltip:!0,withLabelsLine:!1,style:o});return n.jsx("div",{style:{width:"100%",height:e,minHeight:e,display:"flex",alignItems:"center",justifyContent:"center"},children:l})}function xe(t){const{nodes:e,edges:r,direction:o="vertical",nodeWidth:i=160,nodeHeight:s=40,rankGap:l=64,nodeGap:u=48,padding:d=24}=t,c=e.map(a=>a.id),f=new Set(c),y=new Map;for(const a of c)y.set(a,[]);for(const a of r)f.has(a.from)&&f.has(a.to)&&y.get(a.from).push(a.to);const j=0,S=1,M=2,w=new Map(c.map(a=>[a,j])),C=new Set,T=(a,p)=>`${a}\0${p}`,F=a=>{w.set(a,S);for(const p of y.get(a)??[]){const g=w.get(p);g===S?C.add(T(a,p)):g===j&&F(p)}w.set(a,M)};for(const a of c)w.get(a)===j&&F(a);const ae=r.filter(a=>f.has(a.from)&&f.has(a.to)&&!C.has(T(a.from,a.to))),L=new Map(c.map(a=>[a,0])),q=new Map(c.map(a=>[a,[]]));for(const a of ae)q.get(a.from).push(a.to),L.set(a.to,(L.get(a.to)??0)+1);const D=new Map(c.map(a=>[a,0])),R=c.filter(a=>(L.get(a)??0)===0);for(;R.length>0;){const a=R.shift(),p=D.get(a);for(const g of q.get(a))D.set(g,Math.max(D.get(g),p+1)),L.set(g,L.get(g)-1),L.get(g)===0&&R.push(g)}const B=new Map;for(const a of c){const p=D.get(a);B.has(p)||B.set(p,[]),B.get(p).push(a)}const H=[...B.keys()].sort((a,p)=>a-p),v=o==="vertical",$=a=>a*(v?i:s)+Math.max(0,a-1)*u,N=Math.max(0,...H.map(a=>$(B.get(a).length))),z=new Map,_=[];H.forEach((a,p)=>{const g=B.get(a),I=$(g.length),W=d+(N-I)/2,A=d+p*((v?s:i)+l);g.forEach((U,Y)=>{const J=W+Y*((v?i:s)+u),ce=v?J:A,le=v?A:J;z.set(U,{id:U,x:ce,y:le,rank:a,order:Y})}),_.push({rank:a,x:v?W:A,y:v?A:W,width:v?I:i,height:v?s:I,nodeIds:g})});const K=(a,p)=>a?v?{x:a.x+i/2,y:p==="source"?a.y+s:a.y}:{x:p==="source"?a.x+i:a.x,y:a.y+s/2}:{x:0,y:0},ie=r.filter(a=>f.has(a.from)&&f.has(a.to)).map(a=>{const p=K(z.get(a.from),"source"),g=K(z.get(a.to),"target");return{from:a.from,to:a.to,sourceX:p.x,sourceY:p.y,targetX:g.x,targetY:g.y,isBackEdge:C.has(T(a.from,a.to))}}),X=d*2+H.length*(v?s:i)+Math.max(0,H.length-1)*l,V=d*2+N;return{nodes:[...z.values()],edges:ie,ranks:_,direction:o,width:v?V:X,height:v?X:V}}function ge({additions:t=0,deletions:e=0,style:r}){return t===0&&e===0?null:n.jsxs("span",{style:{display:"inline-flex",gap:8,fontVariantNumeric:"tabular-nums",fontSize:12,fontWeight:600,...r},children:[t>0&&n.jsxs("span",{style:{color:k.added},children:["+",t]}),e>0&&n.jsxs("span",{style:{color:k.deleted},children:["-",e]})]})}const ye={added:"+",removed:"-",unchanged:" "};function me({lines:t,showLineNumbers:e=!0,coloredLineNumbers:r=!0,showAccentStrip:o=!0,style:i}){const s=x(),l=c=>c==="added"?s.diff.insertedLine:c==="removed"?s.diff.removedLine:"transparent",u=c=>c==="added"?s.diff.stripAdded:c==="removed"?s.diff.stripRemoved:"transparent",d=c=>r&&c==="added"?k.added:r&&c==="removed"?k.deleted:s.text.tertiary;return n.jsx("div",{style:{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace',fontSize:12.5,lineHeight:"18px",color:s.text.primary,overflowX:"auto",...i},children:t.map((c,f)=>n.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:l(c.type),borderLeft:o?`3px solid ${u(c.type)}`:void 0},children:[e&&n.jsx("span",{style:{flex:"0 0 auto",width:40,textAlign:"right",paddingRight:10,userSelect:"none",color:d(c.type)},children:c.lineNumber??""}),n.jsx("span",{style:{flex:"0 0 auto",width:14,textAlign:"center",userSelect:"none",color:d(c.type)},children:ye[c.type]}),n.jsx("pre",{style:{margin:0,padding:"0 8px",whiteSpace:"pre",fontFamily:"inherit"},children:c.content})]},f))})}function je({status:t}){const e=x(),r=t==="completed"?k.success:t==="in_progress"?e.accent.primary:t==="cancelled"?k.danger:e.text.tertiary;return n.jsxs("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",style:{flex:"0 0 auto",marginTop:3},"aria-hidden":!0,children:[n.jsx("circle",{cx:7,cy:7,r:6,stroke:r,strokeWidth:1.4}),t==="completed"&&n.jsx("path",{d:"M4 7.2l2 2 4-4.4",stroke:r,strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"}),t==="in_progress"&&n.jsx("circle",{cx:7,cy:7,r:3,fill:r}),t==="cancelled"&&n.jsx("path",{d:"M4.8 4.8l4.4 4.4M9.2 4.8l-4.4 4.4",stroke:r,strokeWidth:1.4,strokeLinecap:"round"})]})}function oe({todos:t,dimmedTodoIds:e,onTodoClick:r,style:o}){const i=x();return t.length===0?null:n.jsx("div",{style:{display:"flex",flexDirection:"column",...o},children:t.map(s=>{const l=e==null?void 0:e.has(s.id);return n.jsxs("button",{type:"button",onClick:()=>r==null?void 0:r(s),style:{display:"flex",gap:8,alignItems:"flex-start",width:"100%",textAlign:"left",padding:"4px 6px",background:"transparent",border:"none",cursor:r?"pointer":"default",color:i.text.primary,fontSize:14,lineHeight:"20px",opacity:l?.45:1},children:[n.jsx(je,{status:s.status}),n.jsx("span",{style:{textDecoration:s.status==="cancelled"?"line-through":void 0,color:s.status==="cancelled"?i.text.tertiary:void 0},children:s.content})]},s.id)})})}function ve({todos:t,dimmedTodoIds:e,defaultExpanded:r=!1,onTodoClick:o,style:i}){const s=x(),[l,u]=m.useState(r);if(t.length===0)return null;const d=t.filter(c=>c.status==="completed").length;return n.jsxs("div",{style:{border:`1px solid ${s.stroke.primary}`,borderRadius:6,overflow:"hidden",...i},children:[n.jsxs("button",{type:"button",onClick:()=>u(c=>!c),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 10px",background:"transparent",border:"none",cursor:"pointer",color:s.text.secondary,fontSize:12,fontWeight:600},children:[n.jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",style:{transform:l?"rotate(90deg)":"none",transition:"transform 120ms"},"aria-hidden":!0,children:n.jsx("path",{d:"M4 2.5L8 6l-4 3.5",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"})}),n.jsx("span",{children:"Todos"}),n.jsx("span",{style:{flex:1}}),n.jsxs("span",{children:[d," of ",t.length," Done"]})]}),l&&n.jsx("div",{style:{padding:6},children:n.jsx(oe,{todos:t,dimmedTodoIds:e,onTodoClick:o})})]})}function be(t,e){const r=`canvas:${t}`,[o,i]=m.useState(()=>{if(typeof localStorage>"u")return e;try{const l=localStorage.getItem(r);return l===null?e:JSON.parse(l)}catch{return e}}),s=m.useCallback(l=>{i(u=>{const d=typeof l=="function"?l(u):l;try{localStorage==null||localStorage.setItem(r,JSON.stringify(d))}catch{}return d})},[r]);return[o,s]}function Se(){return m.useCallback(t=>{},[])}function ke(t,e){return{...t,...e}}function E(t,e,r){const o=t.typography[e];return{fontFamily:t.typography.fontFamily,fontSize:o.fontSize,lineHeight:o.lineHeight,fontWeight:o.fontWeight,color:t.text.primary,margin:0,...r}}function we({children:t,style:e}){const r=x();return n.jsx(h.Title,{order:1,style:E(r,"h1",e),children:t})}function Te({children:t,style:e}){const r=x();return n.jsx(h.Title,{order:2,style:E(r,"h2",e),children:t})}function Ce({children:t,style:e}){const r=x();return n.jsx(h.Title,{order:3,style:E(r,"h3",e),children:t})}const Le={normal:400,medium:500,semibold:600,bold:700};function Be({children:t,tone:e="primary",size:r="body",as:o="p",weight:i="normal",italic:s,truncate:l,style:u}){const d=x();return n.jsx(h.Text,{component:o,size:r==="small"?"xs":"sm",fw:Le[i],c:e==="primary"?void 0:d.text[e],truncate:l,style:{fontStyle:s?"italic":void 0,...e==="primary"?{color:d.text.primary}:void 0,fontFamily:d.typography.fontFamily,...u},children:t})}function Me({children:t,style:e}){const r=x();return n.jsx("code",{style:{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace',fontSize:"0.92em",color:r.text.primary,background:r.fill.secondary,borderRadius:r.radius.sm,padding:"1px 4px",...e},children:t})}function Pe({children:t,href:e,style:r}){const o=x();return n.jsx("a",{href:e,target:"_blank",rel:"noreferrer",style:{color:o.text.link,...r},children:t})}function Fe({children:t,gap:e,style:r}){return n.jsx(h.Stack,{gap:e,style:r,children:t})}const Z={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch","space-between":"space-between"};function De({children:t,gap:e,align:r="center",justify:o="start",wrap:i=!1,style:s}){return n.jsx(h.Group,{gap:e,align:Z[r],justify:Z[o],wrap:i?"wrap":"nowrap",style:s,children:t})}function He(){return n.jsx("div",{style:{flex:1}})}function ze({children:t,columns:e,gap:r=16,align:o,style:i}){const s=typeof e=="number"?`repeat(${e}, minmax(0, 1fr))`:e;return n.jsx("div",{style:{display:"grid",gridTemplateColumns:s,gap:r,alignItems:o,...i},children:t})}function Ae({style:t}){return n.jsx(h.Divider,{style:t})}const O=m.createContext({collapsible:!1,open:!0,toggle:()=>{}});function Re({children:t,variant:e="default",collapsible:r=!1,defaultOpen:o=!0,open:i,onOpenChange:s,style:l}){const u=x(),[d,c]=m.useState(o),f=i??d,y=m.useCallback(()=>{const j=!f;i===void 0&&c(j),s==null||s(j)},[f,i,s]);return n.jsx(h.Card,{withBorder:e!=="borderless",radius:u.radius.md,padding:0,style:{background:u.bg.elevated,borderColor:u.stroke.secondary,...l},children:n.jsx(O.Provider,{value:{collapsible:r,open:f,toggle:y},children:t})})}function Ie({children:t,trailing:e,style:r}){const o=x(),{collapsible:i,open:s,toggle:l}=m.useContext(O);return n.jsxs("div",{onClick:i?l:void 0,style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 14px",borderBottom:`1px solid ${o.stroke.secondary}`,fontSize:o.typography.small.fontSize,fontWeight:o.typography.h3.fontWeight,color:o.text.tertiary,fontFamily:o.typography.fontFamily,cursor:i?"pointer":void 0,userSelect:i?"none":void 0,...r},children:[n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[i&&n.jsx(se,{expanded:s}),t]}),e!=null&&n.jsx("span",{children:e})]})}function We({children:t,style:e}){const{collapsible:r,open:o}=m.useContext(O);return r&&!o?null:n.jsx("div",{style:{padding:14,...e},children:t})}function se({expanded:t}){return n.jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",style:{transform:t?"rotate(90deg)":"none",transition:"transform 120ms"},"aria-hidden":!0,children:n.jsx("path",{d:"M4 2.5L8 6l-4 3.5",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ge({value:t,label:e,tone:r,style:o}){const i=x();return n.jsxs("div",{style:o,children:[n.jsx(h.Text,{fz:22,fw:700,lh:1.2,style:{color:r?k[r]:i.text.primary,fontFamily:i.typography.fontFamily},children:t}),n.jsx(h.Text,{fz:12,style:{color:i.text.tertiary,fontFamily:i.typography.fontFamily},children:e})]})}function Ee({children:t,active:e,tone:r="neutral",size:o="md",leadingContent:i,keyboardHint:s,title:l,style:u,onClick:d}){return n.jsx(h.Badge,{color:Q[r],variant:e?"filled":"light",size:o==="sm"?"sm":"md",leftSection:i,rightSection:s,title:l,onClick:d,style:{cursor:d?"pointer":void 0,textTransform:"none",...u},children:t})}function Oe({children:t,tone:e="neutral",title:r,icon:o,style:i}){return n.jsx(h.Alert,{color:Q[e],title:r,icon:o,variant:"light",style:i,children:t})}const qe={success:"rgba(31,138,101,0.12)",danger:"rgba(207,45,86,0.12)",warning:"rgba(232,163,61,0.14)",info:"rgba(46,121,181,0.12)",neutral:"rgba(136,136,168,0.12)"};function $e({headers:t,rows:e,columnAlign:r,rowTone:o,framed:i=!0,striped:s,stickyHeader:l,style:u,emptyMessage:d}){return n.jsxs(h.Table,{withTableBorder:i,withColumnBorders:!1,striped:s,stickyHeader:l,highlightOnHover:!0,style:u,children:[n.jsx(h.Table.Thead,{children:n.jsx(h.Table.Tr,{children:t.map((c,f)=>n.jsx(h.Table.Th,{ta:(r==null?void 0:r[f])??"left",children:c},f))})}),n.jsx(h.Table.Tbody,{children:e.length===0?n.jsx(h.Table.Tr,{children:n.jsx(h.Table.Td,{colSpan:t.length,ta:"center",c:"dimmed",children:d??"No data"})}):e.map((c,f)=>{const y=o==null?void 0:o[f];return n.jsx(h.Table.Tr,{style:y?{background:qe[y]}:void 0,children:t.map((j,S)=>n.jsx(h.Table.Td,{ta:(r==null?void 0:r[S])??"left",children:c[S]},S))},f)})})]})}const Ne={primary:"filled",secondary:"default",ghost:"subtle"};function _e({children:t,variant:e="secondary",disabled:r,type:o="button",style:i,onClick:s}){return n.jsx(h.Button,{variant:Ne[e],color:e==="primary"?"accent":void 0,size:"xs",disabled:r,type:o,onClick:s,style:i,children:t})}function Ke({children:t,onClick:e,disabled:r,title:o,variant:i="default",size:s="md",style:l}){return n.jsx(h.ActionIcon,{variant:i==="circle"?"light":"subtle",radius:i==="circle"?"xl":"sm",size:s==="sm"?"sm":"md",color:"gray",disabled:r,title:o,"aria-label":o,onClick:e,style:l,children:t})}function Xe({value:t,onChange:e,options:r,placeholder:o,disabled:i,style:s}){return n.jsx(h.Select,{value:t,data:r,placeholder:o,disabled:i,allowDeselect:!1,onChange:l=>{l!==null&&(e==null||e(l))},style:s})}function Ve({checked:t,onChange:e,disabled:r,label:o,style:i}){return n.jsx(h.Checkbox,{checked:t,disabled:r,label:o,onChange:s=>e==null?void 0:e(s.currentTarget.checked),style:i})}function Ue({checked:t,onChange:e,disabled:r,size:o="sm",style:i}){return n.jsx(h.Switch,{checked:t,disabled:r,size:o==="sm"?"sm":"md",onChange:s=>e==null?void 0:e(s.currentTarget.checked),style:i})}function Ye({value:t,onChange:e,placeholder:r,disabled:o,type:i,style:s}){return n.jsx(h.TextInput,{value:t,placeholder:r,disabled:o,type:i,onChange:l=>e==null?void 0:e(l.currentTarget.value),style:s})}function Je({value:t,onChange:e,placeholder:r,disabled:o,rows:i=3,style:s}){return n.jsx(h.Textarea,{value:t,placeholder:r,disabled:o,autosize:!0,minRows:i,onChange:l=>e==null?void 0:e(l.currentTarget.value),style:s})}function Ze({color:t,style:e}){const r=x();return n.jsx("span",{style:{display:"inline-block",width:14,height:14,borderRadius:4,background:r.category[t],flex:"0 0 auto",...e}})}function Qe({segments:t,total:e,topLeftLabel:r,topRightLabel:o,style:i}){const s=x(),l=e>0?e:1,u=t.reduce((c,f)=>c+(Number.isFinite(f.value)&&f.value>0?f.value:0),0),d=Math.max(0,l-u);return n.jsxs("div",{style:i,children:[(r!=null||o!=null)&&n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:12,color:s.text.secondary,marginBottom:6},children:[n.jsx("span",{children:r}),n.jsx("span",{children:o})]}),n.jsxs("div",{style:{display:"flex",gap:2,height:8},children:[t.map((c,f)=>{const y=Number.isFinite(c.value)&&c.value>0?c.value:0,j=s.category[c.color??b.usageColorSequence[f%b.usageColorSequence.length]];return n.jsx("div",{style:{width:`${y/l*100}%`,background:j,borderRadius:3}},c.id)}),d>0&&n.jsx("div",{style:{width:`${d/l*100}%`,background:s.fill.tertiary,borderRadius:3}})]})]})}function et({title:t,leading:e,count:r,trailing:o,children:i,defaultOpen:s=!1,style:l}){const u=x(),[d,c]=m.useState(s);return n.jsxs("div",{style:l,children:[n.jsxs("div",{onClick:()=>c(f=>!f),style:{display:"flex",alignItems:"center",gap:6,padding:"4px 0",cursor:"pointer",userSelect:"none",color:u.text.primary,fontSize:14},children:[n.jsx(se,{expanded:d}),e,n.jsx("span",{style:{fontWeight:500},children:t}),r!=null&&n.jsx("span",{style:{color:u.text.tertiary,fontSize:12},children:r}),n.jsx("span",{style:{flex:1}}),o!=null&&n.jsx("span",{style:{color:u.text.tertiary},children:o})]}),d&&n.jsx("div",{style:{paddingLeft:18,paddingBottom:4},children:i})]})}Object.defineProperty(exports,"useEffect",{enumerable:!0,get:()=>m.useEffect});Object.defineProperty(exports,"useMemo",{enumerable:!0,get:()=>m.useMemo});Object.defineProperty(exports,"useRef",{enumerable:!0,get:()=>m.useRef});Object.defineProperty(exports,"useState",{enumerable:!0,get:()=>m.useState});exports.canvasPaletteDark=b.canvasPaletteDark;exports.canvasPaletteGrokDark=b.canvasPaletteGrokDark;exports.canvasPaletteGrokLight=b.canvasPaletteGrokLight;exports.canvasPaletteLight=b.canvasPaletteLight;exports.canvasTokens=b.canvasTokens;exports.canvasTokensLight=b.canvasTokensLight;exports.categoryPaletteDark=b.categoryPaletteDark;exports.categoryPaletteLight=b.categoryPaletteLight;exports.colorPalette=b.colorPalette;exports.usageColorSequence=b.usageColorSequence;exports.BarChart=he;exports.Button=_e;exports.Callout=Oe;exports.Card=Re;exports.CardBody=We;exports.CardHeader=Ie;exports.Checkbox=Ve;exports.Code=Me;exports.CollapsibleSection=et;exports.DiffStats=ge;exports.DiffView=me;exports.Divider=Ae;exports.Grid=ze;exports.H1=we;exports.H2=Te;exports.H3=Ce;exports.IconButton=Ke;exports.LineChart=fe;exports.Link=Pe;exports.PieChart=pe;exports.Pill=Ee;exports.Row=De;exports.Select=Xe;exports.Spacer=He;exports.Stack=Fe;exports.Stat=Ge;exports.Swatch=Ze;exports.Table=$e;exports.Text=Be;exports.TextArea=Je;exports.TextInput=Ye;exports.TodoList=oe;exports.TodoListCard=ve;exports.Toggle=Ue;exports.UsageBar=Qe;exports.computeDAGLayout=xe;exports.mergeStyle=ke;exports.useCanvasAction=Se;exports.useCanvasState=be;exports.useHostTheme=x;