agent-canvas 0.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 (65) hide show
  1. package/bin/agent-canvas.js +14 -0
  2. package/bin/agent-canvas.ts +377 -0
  3. package/daemon/build.ts +185 -0
  4. package/daemon/client/AnnotationProvider.tsx +185 -0
  5. package/daemon/client/AnnotationSidebar.tsx +314 -0
  6. package/daemon/client/App.tsx +611 -0
  7. package/daemon/client/CompareView.tsx +333 -0
  8. package/daemon/client/FileBrowser.tsx +188 -0
  9. package/daemon/client/FileIcon.tsx +76 -0
  10. package/daemon/client/FileViewer.tsx +207 -0
  11. package/daemon/client/PlanRenderer.tsx +665 -0
  12. package/daemon/client/Popover.tsx +285 -0
  13. package/daemon/client/ResponsePreview.tsx +260 -0
  14. package/daemon/client/RevisionSelect.tsx +97 -0
  15. package/daemon/client/SessionContext.tsx +3 -0
  16. package/daemon/client/SessionSwitcher.tsx +72 -0
  17. package/daemon/client/annotationContext.ts +114 -0
  18. package/daemon/client/components/Callout.tsx +25 -0
  19. package/daemon/client/components/Checklist.tsx +37 -0
  20. package/daemon/client/components/Choice.tsx +164 -0
  21. package/daemon/client/components/CodeBlock.tsx +35 -0
  22. package/daemon/client/components/Diff.tsx +65 -0
  23. package/daemon/client/components/FilePreview.tsx +88 -0
  24. package/daemon/client/components/Image.tsx +45 -0
  25. package/daemon/client/components/Mermaid.tsx +277 -0
  26. package/daemon/client/components/Note.tsx +13 -0
  27. package/daemon/client/components/Priority.tsx +19 -0
  28. package/daemon/client/components/ResponseNote.tsx +24 -0
  29. package/daemon/client/components/Section.tsx +32 -0
  30. package/daemon/client/components/Table.tsx +35 -0
  31. package/daemon/client/components/Task.tsx +75 -0
  32. package/daemon/client/components/UserInput.tsx +180 -0
  33. package/daemon/client/components/index.ts +15 -0
  34. package/daemon/client/domDiff.ts +336 -0
  35. package/daemon/client/exportMarkdown.ts +267 -0
  36. package/daemon/client/generateMarkdown.ts +194 -0
  37. package/daemon/client/highlightRange.ts +233 -0
  38. package/daemon/client/index.html +26 -0
  39. package/daemon/client/lcs.ts +19 -0
  40. package/daemon/client/popoverPosition.ts +31 -0
  41. package/daemon/client/runtime.ts +89 -0
  42. package/daemon/client/styles.css +306 -0
  43. package/daemon/client/theme.css +66 -0
  44. package/daemon/client/unifiedDiff.ts +604 -0
  45. package/daemon/dist/client.css +2 -0
  46. package/daemon/dist/client.js +68 -0
  47. package/daemon/dist/components.js +5 -0
  48. package/daemon/dist/index.html +108 -0
  49. package/daemon/dist/jsx-dev-runtime-shim.js +17 -0
  50. package/daemon/dist/jsx-runtime-shim.js +17 -0
  51. package/daemon/dist/react-dom-client-shim.js +4 -0
  52. package/daemon/dist/react-dom-shim.js +4 -0
  53. package/daemon/dist/react-shim.js +4 -0
  54. package/daemon/dist/runtime.js +1 -0
  55. package/daemon/dist/theme.css +66 -0
  56. package/daemon/src/compiler.ts +92 -0
  57. package/daemon/src/paths.ts +22 -0
  58. package/daemon/src/server.ts +448 -0
  59. package/daemon/src/session.ts +274 -0
  60. package/daemon/src/watcher.ts +59 -0
  61. package/hooks/session-start.sh +11 -0
  62. package/package.json +39 -0
  63. package/skills/canvas/SKILL.md +174 -0
  64. package/skills/canvas/components.md +349 -0
  65. package/skills/canvas/flows.md +406 -0
@@ -0,0 +1,2 @@
1
+ /*! tailwindcss v4.2.1 | MIT License | https://tailwindcss.com */
2
+ @import "https://fonts.googleapis.com/css2?family=Instrument+Serif&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap";@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:"JetBrains Mono", "Fira Code", Consolas, monospace;--color-green-500:oklch(72.3% .219 149.579);--color-black:#000;--spacing:.25rem;--container-2xl:42rem;--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--font-weight-medium:500;--font-weight-semibold:600;--tracking-wider:.05em;--tracking-widest:.1em;--leading-snug:1.375;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-bg-base:#1a1915;--color-bg-surface:#1f1e18;--color-bg-elevated:#25241d;--color-bg-code:#1c1b16;--color-bg-input:#fff8dc08;--color-bg-elevated-half:#25241d80;--color-text-primary:#e8e4df;--color-text-secondary:#a09a92;--color-text-tertiary:#847d75;--color-text-code:#c4beb7;--color-text-disabled:#3a3530;--color-text-inverse:#1a1a1a;--color-border-subtle:#fff8f00f;--color-border-medium:#fff8f014;--color-border-hover:#fff8f01f;--color-border-strong:#fff8f026;--color-accent-green:#4a9e6d;--color-accent-green-muted:#4a9e6d1f;--color-accent-amber:#c49a3a;--color-accent-amber-muted:#c49a3a1f;--color-accent-red:#c45a5a;--color-accent-red-muted:#c45a5a1f;--color-accent-blue:#5a8ec4;--color-accent-blue-muted:#5a8ec41a;--color-highlight-bg:#ffdc6426;--color-highlight-border:#ffdc6459;--color-highlight-annotation:#ffdc642e;--color-highlight-active:#ffdc6440;--color-highlight-selected:#ffdc641a;--color-badge-bg:#c49a3a33;--color-btn-primary:#e8e4df;--color-btn-primary-text:#1a1a1a;--font-heading:"Instrument Serif", Georgia, "Times New Roman", serif;--font-body:"Inter", -apple-system, BlinkMacSystemFont, sans-serif;--text-section:1.75rem;--text-section--line-height:1.25;--text-section--letter-spacing:-.01em;--text-task-label:.9375rem;--text-task-label--line-height:1.4;--text-body:.875rem;--text-body--line-height:1.65;--text-code:.8125rem;--text-code--line-height:1.6;--text-meta:.75rem;--text-meta--line-height:1.4;--text-meta--letter-spacing:.02em;--text-tiny:.6875rem;--text-tiny--line-height:1.4}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}body{background-color:var(--color-bg-base);color:var(--color-text-primary);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-1{top:calc(var(--spacing) * 1)}.top-1\.5{top:calc(var(--spacing) * 1.5)}.top-1\/2{top:50%}.top-2{top:calc(var(--spacing) * 2)}.top-3{top:calc(var(--spacing) * 3)}.top-full{top:100%}.right-0{right:calc(var(--spacing) * 0)}.right-1{right:calc(var(--spacing) * 1)}.right-1\.5{right:calc(var(--spacing) * 1.5)}.right-3{right:calc(var(--spacing) * 3)}.right-6{right:calc(var(--spacing) * 6)}.bottom-0{bottom:calc(var(--spacing) * 0)}.-left-8{left:calc(var(--spacing) * -8)}.left-0{left:calc(var(--spacing) * 0)}.left-3{left:calc(var(--spacing) * 3)}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.-mx-4{margin-inline:calc(var(--spacing) * -4)}.mx-4{margin-inline:calc(var(--spacing) * 4)}.mx-auto{margin-inline:auto}.my-1{margin-block:calc(var(--spacing) * 1)}.my-1\.5{margin-block:calc(var(--spacing) * 1.5)}.my-2{margin-block:calc(var(--spacing) * 2)}.-mt-0\.5{margin-top:calc(var(--spacing) * -.5)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-\[7px\]{margin-top:7px}.mt-px{margin-top:1px}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-64{height:calc(var(--spacing) * 64)}.h-\[2px\]{height:2px}.h-\[18px\]{height:18px}.h-auto{height:auto}.h-full{height:100%}.h-screen{height:100vh}.max-h-80{max-height:calc(var(--spacing) * 80)}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-\[20px\]{min-height:20px}.min-h-\[40px\]{min-height:40px}.min-h-\[60px\]{min-height:60px}.min-h-screen{min-height:100vh}.w-1{width:calc(var(--spacing) * 1)}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-1\/2{width:50%}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-10{width:calc(var(--spacing) * 10)}.w-60{width:calc(var(--spacing) * 60)}.w-64{width:calc(var(--spacing) * 64)}.w-80{width:calc(var(--spacing) * 80)}.w-full{width:100%}.w-px{width:1px}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\[85vw\]{max-width:85vw}.max-w-\[720px\]{max-width:720px}.max-w-full{max-width:100%}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-\[18px\]{min-width:18px}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-x-full{--tw-translate-x:-100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-full{--tw-translate-x:100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-rotate-90{rotate:-90deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.cursor-col-resize{cursor:col-resize}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.resize{resize:both}.resize-none{resize:none}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.flex-col{flex-direction:column}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-\[1\.5px\]{border-style:var(--tw-border-style);border-width:1.5px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-none{--tw-border-style:none;border-style:none}.border-accent-amber{border-color:var(--color-accent-amber)}.border-border-hover{border-color:var(--color-border-hover)}.border-border-medium{border-color:var(--color-border-medium)}.border-border-strong{border-color:var(--color-border-strong)}.border-border-subtle{border-color:var(--color-border-subtle)}.border-highlight-border{border-color:var(--color-highlight-border)}.\!bg-transparent{background-color:#0000!important}.bg-accent-amber{background-color:var(--color-accent-amber)}.bg-accent-amber-muted{background-color:var(--color-accent-amber-muted)}.bg-accent-blue{background-color:var(--color-accent-blue)}.bg-accent-blue-muted{background-color:var(--color-accent-blue-muted)}.bg-accent-green{background-color:var(--color-accent-green)}.bg-accent-green-muted{background-color:var(--color-accent-green-muted)}.bg-accent-red{background-color:var(--color-accent-red)}.bg-accent-red-muted{background-color:var(--color-accent-red-muted)}.bg-badge-bg{background-color:var(--color-badge-bg)}.bg-bg-base{background-color:var(--color-bg-base)}.bg-bg-code{background-color:var(--color-bg-code)}.bg-bg-elevated{background-color:var(--color-bg-elevated)}.bg-bg-input{background-color:var(--color-bg-input)}.bg-bg-surface{background-color:var(--color-bg-surface)}.bg-bg-surface\/30{background-color:#1f1e184d}@supports (color:color-mix(in lab, red, red)){.bg-bg-surface\/30{background-color:color-mix(in oklab, var(--color-bg-surface) 30%, transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab, red, red)){.bg-black\/40{background-color:color-mix(in oklab, var(--color-black) 40%, transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-border-hover{background-color:var(--color-border-hover)}.bg-border-medium{background-color:var(--color-border-medium)}.bg-border-subtle{background-color:var(--color-border-subtle)}.bg-btn-primary{background-color:var(--color-btn-primary)}.bg-highlight-bg{background-color:var(--color-highlight-bg)}.bg-highlight-selected{background-color:var(--color-highlight-selected)}.bg-text-inverse{background-color:var(--color-text-inverse)}.bg-text-primary{background-color:var(--color-text-primary)}.bg-transparent{background-color:#0000}.p-0{padding:calc(var(--spacing) * 0)}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-8{padding:calc(var(--spacing) * 8)}.px-0{padding-inline:calc(var(--spacing) * 0)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-\[3px\]{padding-block:3px}.py-px{padding-block:1px}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-8{padding-top:calc(var(--spacing) * 8)}.pt-12{padding-top:calc(var(--spacing) * 12)}.pr-1{padding-right:calc(var(--spacing) * 1)}.pr-4{padding-right:calc(var(--spacing) * 4)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-32{padding-bottom:calc(var(--spacing) * 32)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-body{font-family:var(--font-body)}.font-heading{font-family:var(--font-heading)}.font-mono{font-family:var(--font-mono)}.text-meta{font-size:var(--text-meta);line-height:var(--tw-leading,var(--text-meta--line-height));letter-spacing:var(--tw-tracking,var(--text-meta--letter-spacing))}.text-section{font-size:var(--text-section);line-height:var(--tw-leading,var(--text-section--line-height));letter-spacing:var(--tw-tracking,var(--text-section--letter-spacing))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-body{font-size:var(--text-body);line-height:var(--tw-leading,var(--text-body--line-height))}.text-code{font-size:var(--text-code);line-height:var(--tw-leading,var(--text-code--line-height))}.text-task-label{font-size:var(--text-task-label);line-height:var(--tw-leading,var(--text-task-label--line-height))}.text-tiny{font-size:var(--text-tiny);line-height:var(--tw-leading,var(--text-tiny--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent-amber{color:var(--color-accent-amber)}.text-accent-blue{color:var(--color-accent-blue)}.text-accent-green{color:var(--color-accent-green)}.text-accent-red{color:var(--color-accent-red)}.text-btn-primary-text{color:var(--color-btn-primary-text)}.text-green-500{color:var(--color-green-500)}.text-text-code{color:var(--color-text-code)}.text-text-disabled{color:var(--color-text-disabled)}.text-text-primary{color:var(--color-text-primary)}.text-text-secondary{color:var(--color-text-secondary)}.text-text-tertiary{color:var(--color-text-tertiary)}.uppercase{text-transform:uppercase}.italic{font-style:italic}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.decoration-border-hover{-webkit-text-decoration-color:var(--color-border-hover);-webkit-text-decoration-color:var(--color-border-hover);text-decoration-color:var(--color-border-hover)}.accent-accent-amber{accent-color:var(--color-accent-amber)}.opacity-0{opacity:0}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow-lg{--tw-shadow:0 8px 24px var(--tw-shadow-color,var(--color-shadow));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 12px var(--tw-shadow-color,var(--color-shadow));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px var(--tw-shadow-color,var(--color-shadow));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[margin\]{transition-property:margin;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.select-text{-webkit-user-select:text;user-select:text}@media (hover:hover){.group-hover\/ann\:opacity-100:is(:where(.group\/ann):hover *){opacity:1}.group-hover\/code\:opacity-60:is(:where(.group\/code):hover *),.group-hover\/diff\:opacity-60:is(:where(.group\/diff):hover *){opacity:.6}.group-hover\/item\:opacity-100:is(:where(.group\/item):hover *){opacity:1}.group-hover\/section\:opacity-20:is(:where(.group\/section):hover *){opacity:.2}.group-hover\/section\:opacity-50:is(:where(.group\/section):hover *){opacity:.5}.group-hover\/task\:opacity-100:is(:where(.group\/task):hover *){opacity:1}}.group-\[\[data-copied\=true\]\]\:block:is(:where(.group)[data-copied=true] *){display:block}.group-\[\[data-copied\=true\]\]\:hidden:is(:where(.group)[data-copied=true] *){display:none}.placeholder\:text-text-disabled::placeholder{color:var(--color-text-disabled)}.placeholder\:text-text-tertiary::placeholder{color:var(--color-text-tertiary)}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.odd\:bg-bg-elevated-half:nth-child(odd){background-color:var(--color-bg-elevated-half)}@media (hover:hover){.hover\:-translate-y-px:hover{--tw-translate-y:-1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\:border-border-hover:hover{border-color:var(--color-border-hover)}.hover\:bg-accent-blue-muted:hover{background-color:var(--color-accent-blue-muted)}.hover\:bg-accent-blue\/30:hover{background-color:#5a8ec44d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent-blue\/30:hover{background-color:color-mix(in oklab, var(--color-accent-blue) 30%, transparent)}}.hover\:bg-accent-red-muted:hover{background-color:var(--color-accent-red-muted)}.hover\:bg-bg-elevated:hover{background-color:var(--color-bg-elevated)}.hover\:bg-bg-elevated-half:hover{background-color:var(--color-bg-elevated-half)}.hover\:bg-bg-input:hover{background-color:var(--color-bg-input)}.hover\:bg-bg-surface:hover{background-color:var(--color-bg-surface)}.hover\:bg-bg-surface\/50:hover{background-color:#1f1e1880}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bg-surface\/50:hover{background-color:color-mix(in oklab, var(--color-bg-surface) 50%, transparent)}}.hover\:bg-border-medium:hover{background-color:var(--color-border-medium)}.hover\:bg-border-subtle:hover{background-color:var(--color-border-subtle)}.hover\:text-accent-red:hover{color:var(--color-accent-red)}.hover\:text-text-primary:hover{color:var(--color-text-primary)}.hover\:text-text-secondary:hover{color:var(--color-text-secondary)}.hover\:text-text-tertiary:hover{color:var(--color-text-tertiary)}.hover\:underline:hover{text-decoration-line:underline}.hover\:\!opacity-80:hover{opacity:.8!important}.hover\:\!opacity-100:hover{opacity:1!important}.hover\:opacity-90:hover{opacity:.9}.hover\:opacity-100:hover{opacity:1}}.focus\:border-none:focus{--tw-border-style:none;border-style:none}.focus\:border-border-hover:focus{border-color:var(--color-border-hover)}.focus\:ring-0:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}@media (min-width:64rem){.lg\:mr-0{margin-right:calc(var(--spacing) * 0)}.lg\:mr-\[var\(--sidebar-width\,320px\)\]{margin-right:var(--sidebar-width,320px)}.lg\:ml-0{margin-left:calc(var(--spacing) * 0)}.lg\:ml-60{margin-left:calc(var(--spacing) * 60)}.lg\:flex{display:flex}.lg\:hidden{display:none}}}:root{--color-shadow:#00000040;--color-scrollbar:#fff8f00f;--color-scrollbar-hover:#fff8f01f;--color-folder-fill:#c49a3a26;--color-folder-fill-active:#c49a3a40;--color-folder-stroke:#c49a3a80;--color-folder-stroke-active:#c49a3a;--color-hljs-base:#c4beb7;--color-hljs-keyword:#d2a6ff;--color-hljs-string:#a8cc8c;--color-hljs-comment:#847d75;--color-hljs-number:#e8a87c;--color-hljs-variable:#7ec8e3;--color-hljs-function:#dbc074;--color-hljs-punctuation:#a09a92}[data-theme=light]{--color-bg-base:#faf5e6;--color-bg-surface:#f3edd8;--color-bg-elevated:#ebe4ce;--color-bg-code:#f0ebd5;--color-bg-input:#503c0a0d;--color-bg-elevated-half:#ebe4ce80;--color-text-primary:#2a2520;--color-text-secondary:#5a5550;--color-text-tertiary:#9a9390;--color-text-code:#4a4540;--color-text-disabled:#c5c0b8;--color-text-inverse:#faf6ef;--color-border-subtle:#503c1e14;--color-border-medium:#503c1e1a;--color-border-hover:#503c1e26;--color-border-strong:#503c1e33;--color-accent-green:#3a8a5a;--color-accent-green-muted:#3a8a5a1a;--color-accent-amber:#a07820;--color-accent-amber-muted:#a078201a;--color-accent-red:#b84a4a;--color-accent-red-muted:#b84a4a14;--color-accent-blue:#4a7eb4;--color-accent-blue-muted:#4a7eb414;--color-highlight-bg:#c8a01e26;--color-highlight-border:#c8a01e66;--color-highlight-annotation:#c8a01e2e;--color-highlight-active:#c8a01e40;--color-highlight-selected:#c8a01e1a;--color-badge-bg:#a0782026;--color-btn-primary:#2a2520;--color-btn-primary-text:#faf6ef;--color-shadow:#503c1e1a;--color-scrollbar:#503c1e14;--color-scrollbar-hover:#503c1e26;--color-folder-fill:#a078201f;--color-folder-fill-active:#a0782038;--color-folder-stroke:#a0782066;--color-folder-stroke-active:#a07820;--color-hljs-base:#4a4540;--color-hljs-keyword:#7c3aed;--color-hljs-string:#2e7d32;--color-hljs-comment:#9a9390;--color-hljs-number:#c45a20;--color-hljs-variable:#1976d2;--color-hljs-function:#8a6d00;--color-hljs-punctuation:#6b6560}code,pre,.font-mono{font-family:JetBrains Mono,Fira Code,Consolas,monospace}.annotation-highlight{background:var(--color-highlight-bg);border-bottom:2px solid var(--color-highlight-border);cursor:pointer;border-radius:2px;transition:background .15s}.annotation-highlight:hover,.annotation-highlight.active{background:var(--color-highlight-active)}::selection{background-color:var(--color-highlight-active);color:var(--color-text-primary)}:focus-visible{outline:2px solid var(--color-accent-blue);outline-offset:2px;border-radius:4px}textarea:focus-visible{outline:none}button,a,[role=button]{transition:all .15s}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:var(--color-scrollbar);border-radius:3px}::-webkit-scrollbar-thumb:hover{background:var(--color-scrollbar-hover)}.diff-added{background-color:#4a9e6d40}@supports (color:color-mix(in lab, red, red)){.diff-added{background-color:color-mix(in srgb, var(--color-accent-green) 25%, transparent)}}.diff-added{border-radius:2px;padding-block:1px;padding-inline:1px}.diff-removed{background-color:#c45a5a40}@supports (color:color-mix(in lab, red, red)){.diff-removed{background-color:color-mix(in srgb, var(--color-accent-red) 25%, transparent)}}.diff-removed{text-decoration:line-through;-webkit-text-decoration-color:var(--color-accent-red);-webkit-text-decoration-color:var(--color-accent-red);text-decoration-color:var(--color-accent-red);border-radius:2px;padding-block:1px;padding-inline:1px}.diff-block-removed{background:#c45a5a14}@supports (color:color-mix(in lab, red, red)){.diff-block-removed{background:color-mix(in srgb, var(--color-accent-red) 8%, transparent)}}.diff-block-removed{border-left:3px solid var(--color-accent-red);opacity:.7}.diff-block-added{background:#4a9e6d14}@supports (color:color-mix(in lab, red, red)){.diff-block-added{background:color-mix(in srgb, var(--color-accent-green) 8%, transparent)}}.diff-block-added{border-left:3px solid var(--color-accent-green)}.diff-row-removed td{background:#c45a5a1a}@supports (color:color-mix(in lab, red, red)){.diff-row-removed td{background:color-mix(in srgb, var(--color-accent-red) 10%, transparent)}}.diff-row-removed td{text-decoration:line-through;-webkit-text-decoration-color:var(--color-accent-red);-webkit-text-decoration-color:var(--color-accent-red);text-decoration-color:var(--color-accent-red);opacity:.6}.diff-row-added td{background:#4a9e6d1a}@supports (color:color-mix(in lab, red, red)){.diff-row-added td{background:color-mix(in srgb, var(--color-accent-green) 10%, transparent)}}.diff-item-removed{background:#c45a5a1a}@supports (color:color-mix(in lab, red, red)){.diff-item-removed{background:color-mix(in srgb, var(--color-accent-red) 10%, transparent)}}.diff-item-removed{text-decoration:line-through;-webkit-text-decoration-color:var(--color-accent-red);-webkit-text-decoration-color:var(--color-accent-red);text-decoration-color:var(--color-accent-red);opacity:.6}.diff-item-added{background:#4a9e6d1a}@supports (color:color-mix(in lab, red, red)){.diff-item-added{background:color-mix(in srgb, var(--color-accent-green) 10%, transparent)}}.diff-block-label{text-transform:uppercase;pointer-events:none;border-radius:3px;padding:1px 6px;font-size:10px;font-weight:500;position:absolute;top:4px;right:8px}@keyframes plan-refresh{0%{opacity:.6}to{opacity:1}}.plan-updated{animation:.3s plan-refresh}input[type=range]{appearance:none;background:0 0;height:20px}input[type=range]::-webkit-slider-thumb{appearance:none;background:var(--color-accent-amber);cursor:pointer;border:2px solid var(--color-bg-base);border-radius:50%;width:14px;height:14px;margin-top:-5px}input[type=range]::-moz-range-thumb{background:var(--color-accent-amber);cursor:pointer;border:2px solid var(--color-bg-base);border-radius:50%;width:14px;height:14px}input[type=range]::-webkit-slider-runnable-track{background:0 0;border-radius:2px;height:4px}input[type=range]::-moz-range-track{background:0 0;border-radius:2px;height:4px}.hljs{color:var(--color-hljs-base)!important;background:0 0!important}pre code.hljs{padding:0!important}.hljs-keyword,.hljs-selector-tag,.hljs-built_in,.hljs-name,.hljs-tag{color:var(--color-hljs-keyword)!important}.hljs-string,.hljs-title,.hljs-section,.hljs-attribute,.hljs-literal,.hljs-template-tag,.hljs-template-variable,.hljs-type{color:var(--color-hljs-string)!important}.hljs-comment,.hljs-quote,.hljs-deletion,.hljs-meta{color:var(--color-hljs-comment)!important}.hljs-number,.hljs-regexp,.hljs-addition{color:var(--color-hljs-number)!important}.hljs-variable,.hljs-attr{color:var(--color-hljs-variable)!important}.hljs-function .hljs-title,.hljs-title.function_{color:var(--color-hljs-function)!important}.hljs-params{color:var(--color-hljs-base)!important}.hljs-property{color:var(--color-hljs-variable)!important}.hljs-punctuation{color:var(--color-hljs-punctuation)!important}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes pulse{50%{opacity:.5}}
@@ -0,0 +1,68 @@
1
+ import U1,{useEffect as c1,useLayoutEffect as y2,useState as o,useCallback as d1,useRef as T1,createContext as n0}from"react";import{createRoot as P2}from"react-dom/client";import{SessionContext as e0,ActiveViewCtx as S2}from"#canvas/runtime";import{useState as F1,useCallback as Y1,useEffect as U0,useRef as K0}from"react";import{AnnotationCtx as Q5}from"#canvas/runtime";import{useAnnotations as t}from"#canvas/runtime";import{jsxDEV as z5}from"react/jsx-dev-runtime";function r1($,J){return`canvas:${$}:rev:${J}`}function N1($,J){try{let Q=localStorage.getItem(r1($,J));if(!Q)return null;return JSON.parse(Q)}catch{return null}}function Y5($,J,Q){try{localStorage.setItem(r1($,J),JSON.stringify(Q))}catch{}}function Z5($,J){try{localStorage.removeItem(r1($,J))}catch{}}function G0({sessionId:$,revision:J,isReadOnly:Q,children:Z}){let Y=K0(`${$}:${J}`),[X,z]=F1(()=>{return N1($,J)?.annotations??[]}),[_,q]=F1(()=>{return N1($,J)?.generalNote??""}),[U,K]=F1(null),[G,W]=F1(()=>{let A=N1($,J);return A?.responses?new Map(A.responses):new Map}),[T,N]=F1(()=>{let A=N1($,J);return A?.feedbackEntries?new Map(A.feedbackEntries):new Map});U0(()=>{let A=`${$}:${J}`;if(A===Y.current)return;Y.current=A;let C=N1($,J);z(C?.annotations??[]),q(C?.generalNote??""),W(C?.responses?new Map(C.responses):new Map),N(C?.feedbackEntries?new Map(C.feedbackEntries):new Map),K(null)},[$,J]);let P=K0(null);U0(()=>{if(Q)return;if(P.current)clearTimeout(P.current);return P.current=setTimeout(()=>{Y5($,J,{annotations:X,generalNote:_,responses:Array.from(G.entries()),feedbackEntries:Array.from(T.entries())})},300),()=>{if(P.current)clearTimeout(P.current)}},[X,_,G,T,$,J,Q]);let L=Y1((A,C,H,M,h)=>{z((c)=>[...c,{id:A,snippet:C,note:H,createdAt:new Date().toISOString(),filePath:M,context:h}])},[]),y=Y1((A,C,H)=>{let M=`ann-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;L(M,A,C,H)},[L]),w=Y1((A,C)=>{z((H)=>H.map((M)=>M.id===A?{...M,note:C}:M))},[]),O=Y1((A)=>{X5(A),z((C)=>C.filter((H)=>H.id!==A)),K((C)=>C===A?null:C)},[]),b=Y1((A,C)=>{W((H)=>{let M=new Map(H);return M.set(A,C),M})},[]),v=Y1((A,C)=>{N((H)=>{let M=H.get(A);if(M&&M.markdown===C.markdown&&M.label===C.label&&M.required===C.required)return H;let h=new Map(H);return h.set(A,C),h})},[]),D=Y1((A)=>{N((C)=>{if(!C.has(A))return C;let H=new Map(C);return H.delete(A),H})},[]),j=Y1(()=>{for(let A of document.querySelectorAll("[data-annotation-id]"))H0(A);z([]),q(""),K(null),W(new Map),N(new Map),Z5($,J)},[$,J]);return z5(Q5.Provider,{value:{annotations:X,addAnnotation:y,addAnnotationWithId:L,updateAnnotation:w,removeAnnotation:O,generalNote:_,setGeneralNote:q,clearAll:j,activeAnnotationId:U,setActiveAnnotationId:K,responses:G,setResponse:b,feedbackEntries:T,setFeedbackEntry:v,removeFeedbackEntry:D},children:Z},void 0,!1,void 0,this)}function X5($){let J=document.querySelectorAll(`[data-annotation-id="${$}"]`);for(let Q of J)H0(Q)}function H0($){let J=$.parentNode;if(!J)return;let Q=document.createTextNode($.textContent||"");J.replaceChild(Q,$),J.normalize()}import a1,{useEffect as $1,useState as n,useRef as G5,useContext as H5,useCallback as W5,useMemo as D1}from"react";import{createPortal as T5}from"react-dom";import{SessionContext as F5}from"#canvas/runtime";function L1($,J){let Q=[],Z=q5($);for(let Y of Z){let X=document.createRange();if(X.selectNodeContents(Y),Y===$.startContainer)X.setStart(Y,$.startOffset);if(Y===$.endContainer)X.setEnd(Y,$.endOffset);let z=X.toString();if(!z||!z.trim())continue;let _=document.createElement("mark");_.setAttribute("data-annotation-id",J),_.style.cssText=`
2
+ background: var(--color-highlight-annotation);
3
+ border-bottom: 1.5px solid var(--color-highlight-bg);
4
+ border-radius: 2px;
5
+ cursor: pointer;
6
+ transition: background 150ms ease;
7
+ color: inherit;
8
+ padding: 1px 0;
9
+ `;try{X.surroundContents(_)}catch{let q=X.extractContents();_.appendChild(q),X.insertNode(_)}Q.push(_)}return Q}function q5($){let J=[],Q=$.commonAncestorContainer;if(Q.nodeType===Node.TEXT_NODE)return J.push(Q),J;let Z=document.createTreeWalker(Q,NodeFilter.SHOW_TEXT),Y;while(Y=Z.nextNode()){if(Y.parentElement?.classList.contains("select-none"))continue;if($.intersectsNode(Y))J.push(Y)}return J}function l1($,J){let Q=document.querySelectorAll(`[data-annotation-id="${$}"]`);for(let Z of Q)Z.style.cssText=J?`
10
+ background: var(--color-highlight-bg);
11
+ border-bottom: 1.5px solid var(--color-highlight-border);
12
+ border-radius: 2px;
13
+ cursor: pointer;
14
+ transition: background 150ms ease;
15
+ color: inherit;
16
+ padding: 1px 0;
17
+ `:`
18
+ background: var(--color-highlight-annotation);
19
+ border-bottom: 1.5px solid var(--color-highlight-bg);
20
+ border-radius: 2px;
21
+ cursor: pointer;
22
+ transition: background 150ms ease;
23
+ color: inherit;
24
+ padding: 1px 0;
25
+ `}function C1($){let J=document.querySelectorAll("[data-annotation-id]");for(let Q of J){let Z=Q.getAttribute("data-annotation-id");Q.style.cssText=Z===$?`
26
+ background: var(--color-highlight-bg);
27
+ border-bottom: 1.5px solid var(--color-highlight-border);
28
+ border-radius: 2px;
29
+ cursor: pointer;
30
+ transition: background 150ms ease;
31
+ color: inherit;
32
+ padding: 1px 0;
33
+ `:`
34
+ background: var(--color-highlight-annotation);
35
+ border-bottom: 1.5px solid var(--color-highlight-bg);
36
+ border-radius: 2px;
37
+ cursor: pointer;
38
+ transition: background 150ms ease;
39
+ color: inherit;
40
+ padding: 1px 0;
41
+ `}}function I1($,J){let Q=document.querySelectorAll(`[data-annotation-id="${$}"]`);for(let Z of Q)Z.setAttribute("data-annotation-id",J)}function b1($,J){let Q=J.filter((_)=>!document.querySelector(`[data-annotation-id="${_.id}"]`));if(!Q.length)return;let Z=[],Y="",X=document.createTreeWalker($,NodeFilter.SHOW_TEXT),z;while(z=X.nextNode()){if(z.parentElement?.classList.contains("select-none"))continue;Z.push({node:z,start:Y.length}),Y+=z.textContent||""}for(let _ of Q){let q=_.snippet;if(!q)continue;let U=[],K=0;while(!0){let L=Y.indexOf(q,K);if(L===-1)break;U.push(L),K=L+1}if(U.length===0)continue;let G=U[0];if(U.length>1&&_.context){let L=-1;for(let y of U){let w=0;if(_.context.before){let O=Y.slice(Math.max(0,y-80),y);if(O.includes(_.context.before))w+=2;else if(_.context.before.length>10&&O.includes(_.context.before.slice(-10)))w+=1}if(_.context.after){let O=Y.slice(y+q.length,y+q.length+80);if(O.includes(_.context.after))w+=2;else if(_.context.after.length>10&&O.includes(_.context.after.slice(0,10)))w+=1}if(w>L)L=w,G=y}}let W=G,T=G+q.length,N=W0(Z,W),P=W0(Z,T);if(!N||!P)continue;try{let L=document.createRange();L.setStart(N.node,N.offset),L.setEnd(P.node,P.offset),L1(L,_.id)}catch{}}}function W0($,J){for(let Q=$.length-1;Q>=0;Q--)if($[Q].start<=J){let Z=J-$[Q].start,Y=$[Q].node.textContent?.length??0;if(Z<=Y)return{node:$[Q].node,offset:Z}}return null}function j1($){let J=document.querySelectorAll(`[data-annotation-id="${$}"]`);for(let Q of J){let Z=Q.parentNode;if(!Z)continue;while(Q.firstChild)Z.insertBefore(Q.firstChild,Q);Z.removeChild(Q),Z.normalize()}}function F0($,J){let Q=T0($,"before",60),Z=T0($,"after",60),Y=U5($.startContainer,J);return{before:Q,after:Z,hierarchy:Y}}function T0($,J,Q){let Z=_5(J==="before"?$.startContainer:$.endContainer);if(!Z)return"";let Y="";if(J==="before"){let X=document.createTreeWalker(Z,NodeFilter.SHOW_TEXT),z;while(z=X.nextNode()){if(z===$.startContainer){Y+=(z.textContent||"").slice(0,$.startOffset);break}if(z.parentElement?.hasAttribute("data-annotation-id"))continue;Y+=z.textContent||""}if(Y.length>Q){Y=Y.slice(-Q);let _=Y.indexOf(" ");if(_>0)Y=Y.slice(_+1)}}else{let X=document.createTreeWalker(Z,NodeFilter.SHOW_TEXT),z=!1,_;while(_=X.nextNode()){if(_===$.endContainer){Y+=(_.textContent||"").slice($.endOffset),z=!0;continue}if(z){if(_.parentElement?.hasAttribute("data-annotation-id"))continue;Y+=_.textContent||""}}if(Y.length>Q){Y=Y.slice(0,Q);let q=Y.lastIndexOf(" ");if(q>0)Y=Y.slice(0,q)}}return Y.trim()}function _5($){let J=new Set(["DIV","P","LI","PRE","BLOCKQUOTE","SECTION","ARTICLE"]),Q=$.parentElement;while(Q){if(J.has(Q.tagName))return Q;Q=Q.parentElement}return null}function U5($,J){let Q=[],Z=$ instanceof Element?$:$.parentElement;while(Z&&Z!==J){let Y=Z.getAttribute?.("data-task-id");if(Y){let X=Z.querySelector(".font-semibold");if(X)Q.unshift(X.textContent?.trim()||Y)}if(Z.tagName==="DIV"&&Z.querySelector(":scope > button .font-heading, :scope > div .font-heading")){let X=Z.querySelector(".font-heading");if(X)Q.unshift(X.textContent?.trim()||"")}Z=Z.parentElement}return Q}function N0($){let J=$.snippet.trim(),Q=$.context,Z=J.length<30;if(Q&&Z&&(Q.before||Q.after)){let Y=[];if(Q.before)Y.push(`...${Q.before} `);if(Y.push(J),Q.after)Y.push(` ${Q.after}...`);return Y.join("")}return J}import{useEffect as m1,useRef as V1,useState as O1,useCallback as i1,useMemo as O0}from"react";import{createPortal as K5}from"react-dom";function L0($,J){let Y=J||document.body,X=$.getBoundingClientRect(),z=Y.getBoundingClientRect(),_=Y===document.body?window.scrollY:Y.scrollTop,q=X.bottom-z.top+_+8,U=Math.max(0,Math.min(X.left-z.left,z.width-280-12));return Y.style.position="relative",{style:{position:"absolute",top:`${q}px`,left:`${U}px`},parent:Y}}import{jsxDEV as i}from"react/jsx-dev-runtime";function B0({anchorEl:$,scrollContainer:J,onClose:Q,ignoreSelector:Z,zIndex:Y="50",padding:X="12px",width:z="280px",children:_}){let q=V1(null),U=V1(Q);U.current=Q;let{style:K,parent:G}=L0($,J);return m1(()=>{let W=setTimeout(()=>{let T=(N)=>{if(q.current&&!q.current.contains(N.target)){if(Z&&N.target.closest?.(Z))return;U.current(),document.removeEventListener("mousedown",T)}};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},0);return()=>clearTimeout(W)},[Z]),K5(i("div",{ref:q,style:{...K,zIndex:Y,width:z,background:"var(--color-bg-elevated)",border:"1px solid var(--color-border-hover)",borderRadius:"8px",boxShadow:"0 4px 12px var(--color-shadow)",padding:X,fontFamily:"'Inter', sans-serif"},children:_},void 0,!1,void 0,this),G)}var y0=[{label:"Clarity",items:["Unclear","Why?","Needs example","Missing context"]},{label:"Scope",items:["Overkill","Out of scope","Important","Risky"]},{label:"Action",items:["Simplify","Rethink","Expand on this","Skip this"]}],M0=y0.flatMap(($)=>$.items);function M1({anchorEl:$,scrollContainer:J,snippet:Q,truncateAt:Z=100,header:Y,onAdd:X,onCancel:z}){let[_,q]=O1(""),[U,K]=O1(null),[G,W]=O1(!1),T=V1(null);m1(()=>{T.current?.focus()},[]);let N=i1(()=>{if(_.trim())X(_.trim());else z()},[_,X,z]),P=_.trim().length>0?M0.filter((H)=>H.toLowerCase().startsWith(_.trim().toLowerCase())):M0,L=G?[]:P.length===1&&P[0].toLowerCase()===_.trim().toLowerCase()?[]:P,y=new Set(L),w=y0.map((H)=>({label:H.label,items:H.items.filter((M)=>y.has(M))})).filter((H)=>H.items.length>0),O=w.map((H)=>H.items),b=O.flat(),v=O0(()=>{if(U===null)return 0;let H=0;for(let M=0;M<O.length;M++){if(U<H+O[M].length)return M;H+=O[M].length}return 0},[U,O]),D=O0(()=>{if(U===null)return 0;let H=0;for(let M=0;M<v;M++)H+=O[M].length;return U-H},[U,v,O]),j=(H,M)=>{let h=0;for(let c=0;c<H;c++)h+=O[c].length;return h+M};m1(()=>{K(null),W(!1)},[_]);let A=i1((H)=>{q(H)},[]),C=Q.length>Z?Q.slice(0,Z)+"...":Q;return i(B0,{anchorEl:$,scrollContainer:J,onClose:z,width:"420px",children:[Y??i("div",{style:{fontSize:"11px",color:"var(--color-text-tertiary)",fontStyle:"italic",marginBottom:"8px",lineHeight:"1.4",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:["“",C,"”"]},void 0,!0,void 0,this),i("textarea",{ref:T,value:_,onChange:(H)=>q(H.target.value),onKeyDown:(H)=>{if(b.length>0&&(H.key==="ArrowDown"||H.key==="ArrowUp"||H.key==="ArrowLeft"||H.key==="ArrowRight")){if(H.preventDefault(),U===null){K(0);return}if(H.key==="ArrowDown"){let M=Math.min(D+1,O[v].length-1);K(j(v,M))}else if(H.key==="ArrowUp"){let M=Math.max(D-1,0);K(j(v,M))}else if(H.key==="ArrowRight"){let M=Math.min(v+1,O.length-1),h=Math.min(D,O[M].length-1);K(j(M,h))}else if(H.key==="ArrowLeft"){let M=Math.max(v-1,0),h=Math.min(D,O[M].length-1);K(j(M,h))}return}if(U!==null&&b.length>0){if(H.key==="Tab"){H.preventDefault(),A(b[U]);return}if(H.key==="Enter"&&!H.shiftKey){H.preventDefault(),X(b[U]);return}}if(H.key==="Enter"&&!H.shiftKey){H.preventDefault(),N();return}if(H.key==="Escape")if(b.length>0&&!G)W(!0);else z()},style:{width:"100%",minHeight:"60px",background:"transparent",border:"none",color:"var(--color-text-primary)",fontFamily:"'Inter', sans-serif",fontSize:"13px",lineHeight:"1.5",resize:"vertical",outline:"none"},placeholder:"Add your note..."},void 0,!1,void 0,this),i("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"8px"},children:[i("button",{onClick:z,style:{fontSize:"11px",color:"var(--color-text-tertiary)",background:"none",border:"none",cursor:"pointer",padding:"4px 12px",fontFamily:"'Inter', sans-serif"},children:"Cancel"},void 0,!1,void 0,this),i("button",{onClick:N,style:{fontSize:"11px",fontWeight:500,padding:"4px 12px",borderRadius:"6px",background:"var(--color-highlight-bg)",color:"var(--color-text-primary)",border:"1px solid var(--color-highlight-border)",cursor:"pointer",fontFamily:"'Inter', sans-serif"},children:"Add"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b.length>0&&i("div",{style:{marginTop:"6px",borderTop:"1px solid var(--color-border-subtle)",paddingTop:"8px",display:"flex",gap:"4px"},children:w.map((H)=>i("div",{style:{flex:1},children:[i("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--color-text-disabled)",textTransform:"uppercase",letterSpacing:"0.05em",padding:"2px 6px",marginBottom:"2px",fontFamily:"'Inter', sans-serif"},children:H.label},void 0,!1,void 0,this),H.items.map((M)=>{let h=b.indexOf(M);return i("div",{onMouseDown:(c)=>{c.preventDefault(),c.stopPropagation(),A(M)},onMouseEnter:()=>K(h),style:{padding:"3px 6px",fontSize:"12px",borderRadius:"4px",fontFamily:"'Inter', sans-serif",color:h===U?"var(--color-text-primary)":"var(--color-text-secondary)",background:h===U?"var(--color-highlight-selected)":"transparent",cursor:"pointer"},children:[i("span",{style:{fontWeight:500},children:M.slice(0,_.trim().length)},void 0,!1,void 0,this),M.slice(_.trim().length)]},M,!0,void 0,this)})]},H.label,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function B1({anchorEl:$,scrollContainer:J,initialNote:Q,onUpdate:Z,onDelete:Y,onClose:X}){let[z,_]=O1(Q),q=V1(null),[U,K]=O1(!1);m1(()=>{let W=q.current;if(W)W.style.height="auto",W.style.height=W.scrollHeight+"px",W.focus(),W.setSelectionRange(W.value.length,W.value.length)},[]);let G=i1(()=>{if(!z.trim()){Y(),X();return}Z(z),X()},[z,Z,Y,X]);return i(B0,{anchorEl:$,scrollContainer:J,onClose:G,ignoreSelector:"[data-annotation-id]",zIndex:"60",padding:"10px 12px",children:[i("textarea",{ref:q,value:z,onChange:(W)=>{_(W.target.value),Z(W.target.value),W.target.style.height="auto",W.target.style.height=W.target.scrollHeight+"px"},onKeyDown:(W)=>{if(W.key==="Enter"&&!W.shiftKey)W.preventDefault(),G();if(W.key==="Escape")G()},style:{width:"100%",background:"transparent",border:"none",color:"var(--color-text-primary)",fontFamily:"'Inter', sans-serif",fontSize:"13px",lineHeight:"1.5",resize:"none",outline:"none",overflow:"hidden"}},void 0,!1,void 0,this),i("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"6px"},children:i("button",{onClick:()=>{Y(),X()},onMouseEnter:()=>K(!0),onMouseLeave:()=>K(!1),style:{fontSize:"11px",color:U?"var(--color-accent-red)":"var(--color-text-tertiary)",background:"none",border:"none",cursor:"pointer",padding:"2px 0",fontFamily:"'Inter', sans-serif"},children:"Delete"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as p,Fragment as S0}from"react/jsx-dev-runtime";var s1="[data-md='item'], [data-md='section'], [data-md='table'] tbody tr, [data-md='callout'], [data-md='note'], [data-md='checklist-item'], [data-md='choice-option'], [data-md='multichoice-option'], [data-md='userinput'], [data-md='rangeinput'], [data-md='image']",o1="[data-md='item'], [data-md='section'], [data-md='table'] tbody tr, [data-md='callout'], [data-md='note'], [data-md='checklist-item'], [data-md='image']";function P0({revision:$}){let J=H5(F5),[Q,Z]=n(null),[Y,X]=n(null),[z,_]=n(!0),q=G5(null),{annotations:U,addAnnotationWithId:K,removeAnnotation:G,updateAnnotation:W,activeAnnotationId:T,setActiveAnnotationId:N}=t(),[P,L]=n(null),[y,w]=n(null),[O,b]=n(null),[v,D]=n(null),[j,A]=n(null),[C,H]=n(null),[M,h]=n(!1);$1(()=>{_(!0),X(null),H(null),import(`/api/session/${J}/plan.js?rev=${$}&t=${Date.now()}`).then((B)=>{Z(()=>B.default),_(!1)}).catch((B)=>{X(B.message),_(!1)})},[J,$]),$1(()=>{if(!Q||!q.current)return;let B=setTimeout(()=>{if(q.current)b1(q.current,U)},50);return()=>clearTimeout(B)},[Q]),$1(()=>{C1(T)},[T]),$1(()=>{let B=q.current;if(!B)return;let S=(E)=>{let V=E.target.closest("[data-annotation-id]");if(!V)return;E.stopPropagation();let d=V.getAttribute("data-annotation-id");if(d===T)w({anchorEl:V,annId:d});else N(d)},m=(E)=>{let V=E.target.closest("[data-annotation-id]");if(V){let d=V.getAttribute("data-annotation-id");N(d)}},x=(E)=>{let V=E.target.closest("[data-annotation-id]"),d=E.relatedTarget?.closest?.("[data-annotation-id]");if(V&&!d){if(!document.getElementById("ann-inline-popover"))N(null)}};return B.addEventListener("click",S),B.addEventListener("mouseover",m),B.addEventListener("mouseout",x),()=>{B.removeEventListener("click",S),B.removeEventListener("mouseover",m),B.removeEventListener("mouseout",x)}},[Q,U,T]);let c=D1(()=>{let B=new Map;for(let S of U)if(S.snippet.startsWith("["))B.set(S.snippet,S.id);return B},[U]);$1(()=>{let B=q.current;if(!B)return;let S=(x)=>{if(j||O||y)return;let E=x.target;if(E.closest("[data-block-comment-btn]"))return;h(!1);let V=E.closest(s1);if(V&&B.contains(V)){let s=z1(B).indexOf(V);H(s>=0?s:null)}else H(null);let d=E.closest(o1);if(d&&B.contains(d)){D(d);let r=K1(d),s=r?c.get(r):void 0;if(s&&s!==T)N(s)}else D(null)},m=(x)=>{if(j||O||y)return;if(x.relatedTarget?.closest("[data-block-comment-btn]"))return;D(null),N(null)};return B.addEventListener("mousemove",S),B.addEventListener("mouseleave",m),()=>{B.removeEventListener("mousemove",S),B.removeEventListener("mouseleave",m)}},[Q,j,O,y,c,T]),$1(()=>{let B=(S)=>{let m=S.target.tagName;if(m==="INPUT"||m==="TEXTAREA"||S.target.isContentEditable)return;if(j||O||y)return;let x=q.current;if(!x)return;if(S.key==="ArrowDown"){S.preventDefault(),h(!0);let E=z1(x);if(E.length===0)return;H((V)=>{if(V===null)return 0;return Math.min(V+1,E.length-1)})}else if(S.key==="ArrowUp"){S.preventDefault(),h(!0);let E=z1(x);if(E.length===0)return;H((V)=>{if(V===null)return E.length-1;return Math.max(V-1,0)})}else if(S.key==="a"||S.key==="A"){if(C===null||!x)return;S.preventDefault();let V=z1(x)[C];if(!V)return;let d=K1(V);if(!d)return;let r=c.get(d);if(r)N(r),A({anchorEl:V,snippet:d,annId:r});else A({anchorEl:V,snippet:d})}else if(S.key===" "||S.key==="Enter"){if(C===null)return;let V=z1(x)[C];if(!V)return;let d=V.getAttribute("data-md");if(d==="choice-option"||d==="multichoice-option")S.preventDefault(),V.dispatchEvent(new CustomEvent("kb-select",{bubbles:!0}));else if(d==="userinput"){S.preventDefault();let r=V.querySelector("textarea");if(r){r.focus();let s=(X1)=>{if(X1.key==="Escape")X1.preventDefault(),r.blur(),h(!0)};r.addEventListener("keydown",s),r.addEventListener("blur",()=>r.removeEventListener("keydown",s),{once:!0})}}else if(d==="rangeinput"){S.preventDefault();let r=V.querySelector("input[type='range']");if(r){r.focus();let s=(X1)=>{if(X1.key==="Escape"||X1.key==="ArrowUp"||X1.key==="ArrowDown")X1.preventDefault(),r.blur(),h(!0)};r.addEventListener("keydown",s),r.addEventListener("blur",()=>r.removeEventListener("keydown",s),{once:!0})}}}else if(S.key==="Escape")H(null),h(!1),N(null)};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[C,j,O,y,c]),$1(()=>{let B=q.current;if(!B||C===null||!M)return;let m=z1(B)[C];if(!m)return;m.style.outline="2px solid var(--color-accent-blue)",m.style.outlineOffset="-2px",m.style.borderRadius="8px",m.scrollIntoView({block:"nearest",behavior:"smooth"});let x=K1(m),E=x?c.get(x):void 0;if(E)N(E);return()=>{m.style.outline="",m.style.outlineOffset="",m.style.borderRadius=""}},[C,M,c]),$1(()=>{let B=()=>I();return document.addEventListener("mouseup",B),()=>document.removeEventListener("mouseup",B)},[]);let I=W5(()=>{let B=window.getSelection();if(!B||B.isCollapsed||!B.toString().trim())return;if(!q.current)return;let S=B.getRangeAt(0);if(!q.current.contains(S.startContainer))return;if(S.startContainer.parentElement?.closest?.("[data-annotation-id]"))return;let m=B.toString().trim();if(m.length<2)return;let x=S.cloneRange(),E=F0(S,q.current),V=`__pending_${Date.now()}`;try{L1(x,V)}catch{}window.getSelection()?.removeAllRanges();let d=document.querySelectorAll(`[data-annotation-id="${V}"]`),r=d[d.length-1];if(!r)return;b({anchorEl:r,tempId:V,snippet:m,ctx:E})},[K]),l=D1(()=>Q?p(Q,{},void 0,!1,void 0,this):null,[Q]);if(z)return p("div",{className:"flex items-center justify-center h-64 text-text-tertiary font-body text-body",children:"Loading plan..."},void 0,!1,void 0,this);if(Y)return p("div",{className:"bg-accent-red-muted rounded-lg p-5",children:[p("h3",{className:"font-body font-semibold text-accent-red mb-2",children:"Compilation Error"},void 0,!1,void 0,this),p("pre",{className:"text-code font-mono text-text-secondary whitespace-pre-wrap",children:Y},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(!Q)return p("div",{className:"text-text-tertiary text-center py-8 font-body text-body",children:"No plan loaded"},void 0,!1,void 0,this);let R=document.getElementById("plan-scroll-container");return p(S0,{children:[p("div",{ref:q,className:"plan-content plan-updated",children:l},void 0,!1,void 0,this),P&&p(O5,{note:P.note,onSave:(B)=>{W(P.id,B),L(null)},onCancel:()=>L(null)},void 0,!1,void 0,this),y&&(()=>{let B=U.find((S)=>S.id===y.annId);if(!B)return null;return p(B1,{anchorEl:y.anchorEl,scrollContainer:R,initialNote:B.note,onUpdate:(S)=>W(y.annId,S),onDelete:()=>{G(y.annId),N(null)},onClose:()=>w(null)},void 0,!1,void 0,this)})(),O&&p(M1,{anchorEl:O.anchorEl,scrollContainer:R,snippet:O.snippet,truncateAt:80,onAdd:(B)=>{let S=`ann-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;I1(O.tempId,S),K(S,O.snippet,B,void 0,O.ctx),b(null)},onCancel:()=>{j1(O.tempId),b(null)}},void 0,!1,void 0,this),p(N5,{containerRef:q,hoveredBlock:v,focusedBlockIndex:C,blockPopover:j,blockAnnotationMap:c,activeAnnotationId:T,onOpen:(B,S,m)=>{if(m)N(m),A({anchorEl:B,snippet:S,annId:m});else A({anchorEl:B,snippet:S})}},void 0,!1,void 0,this),j&&!j.annId&&p(M1,{anchorEl:j.anchorEl,scrollContainer:R,snippet:j.snippet,truncateAt:80,onAdd:(B)=>{let S=`ann-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;K(S,j.snippet,B),A(null)},onCancel:()=>A(null)},void 0,!1,void 0,this),j?.annId&&(()=>{let B=U.find((S)=>S.id===j.annId);if(!B)return null;return p(B1,{anchorEl:j.anchorEl,scrollContainer:R,initialNote:B.note,onUpdate:(S)=>W(j.annId,S),onDelete:()=>{G(j.annId),N(null),A(null)},onClose:()=>A(null)},void 0,!1,void 0,this)})()]},void 0,!0,void 0,this)}function z1($){return Array.from($.querySelectorAll(s1))}function K1($){let J=$.getAttribute("data-md");if(J==="item"){let Q=$.getAttribute("data-md-label");return Q?`[Item] ${Q}`:null}if(J==="section"){let Q=$.getAttribute("data-md-title");return Q?`[Section] ${Q}`:null}if(J==="callout"){let Q=$.getAttribute("data-md-type")||"info",Z=$.textContent?.trim().slice(0,60)||"Callout";return`[Callout:${Q}] ${Z}`}if(J==="note")return`[Note] ${$.textContent?.trim().slice(0,60)||"Note"}`;if($.tagName==="TR"){let Q=Array.from($.querySelectorAll("td")).map((Z)=>Z.textContent?.trim()).filter(Boolean);return Q.length?`[Row] ${Q.join(" | ")}`:null}if(J==="checklist-item"){let Q=$.getAttribute("data-md-label");return Q?`[Checklist] ${Q}`:null}if(J==="choice-option"||J==="multichoice-option"){let Q=$.getAttribute("data-md-label");return Q?`[Option] ${Q}`:null}if(J==="userinput"){let Q=$.getAttribute("data-md-label");return Q?`[Input] ${Q}`:null}if(J==="rangeinput"){let Q=$.getAttribute("data-md-label");return Q?`[Range] ${Q}`:null}if(J==="image"){let Q=$.getAttribute("data-md-src");return Q?`[Image] ${Q}`:null}return null}function N5({containerRef:$,hoveredBlock:J,focusedBlockIndex:Q,blockPopover:Z,blockAnnotationMap:Y,activeAnnotationId:X,onOpen:z}){let[_,q]=n([]);$1(()=>{let T=$.current;if(!T||Y.size===0){q([]);return}let N=[];for(let P of T.querySelectorAll(o1)){let L=K1(P);if(L&&Y.has(L))N.push(P)}q(N)},[Y,$.current]);let[U,K]=n(null);$1(()=>{if(!X||!$.current){K(null);return}for(let T of $.current.querySelectorAll(s1)){let N=K1(T);if(N&&Y.get(N)===X){K(T);return}}K(null)},[X,Y]),$1(()=>{if(!U)return;return U.style.boxShadow="inset 0 0 0 1.5px var(--color-highlight-bg)",U.style.borderRadius="8px",()=>{U.style.boxShadow="",U.style.borderRadius=""}},[U]);let G=D1(()=>{if(Q===null||!$.current)return null;let T=z1($.current)[Q];if(!T)return null;return T.matches(o1)?T:null},[Q,$.current]),W=D1(()=>{let T=new Set(_);if(J)T.add(J);if(G)T.add(G);if(Z?.anchorEl)T.add(Z.anchorEl);return Array.from(T)},[_,J,G,Z]);return p(S0,{children:W.map((T)=>p(L5,{block:T,isHovered:T===J||T===G||T===Z?.anchorEl,blockAnnotationMap:Y,activeAnnotationId:X,onOpen:z},T.getAttribute("data-task-id")||T.getAttribute("data-md-title")||T.textContent?.slice(0,30)||"block",!1,void 0,this))},void 0,!1,void 0,this)}function L5({block:$,isHovered:J,blockAnnotationMap:Q,activeAnnotationId:Z,onOpen:Y}){let X=K1($);if(!X)return null;let z=Q.get(X),_=!!z;return T5(p("button",{"data-block-comment-btn":!0,onClick:(U)=>{U.stopPropagation(),Y(U.currentTarget,X,z)},className:`absolute top-1 right-1 z-10 w-6 h-6 flex items-center justify-center rounded transition-all duration-150 ${_?z===Z?"text-accent-amber bg-accent-amber-muted":"text-accent-amber opacity-60 hover:opacity-100":J?"text-text-disabled hover:text-text-tertiary opacity-50 hover:opacity-100":"text-text-disabled opacity-0 group-hover/section:opacity-20 hover:!opacity-80"}`,title:_?"Edit annotation":"Add annotation",children:p("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:_?"currentColor":"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:p("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$)}function O5({note:$,onSave:J,onCancel:Q}){let[Z,Y]=a1.useState($),X=a1.useRef(null);return a1.useEffect(()=>{X.current?.focus(),X.current?.select()},[]),p("div",{className:"fixed inset-0 z-50 bg-black/40 flex items-center justify-center",onClick:Q,children:p("div",{className:"bg-bg-elevated border border-border-hover rounded-lg shadow-md p-4 w-80",onClick:(z)=>z.stopPropagation(),children:[p("div",{className:"text-tiny uppercase tracking-widest text-text-tertiary font-body mb-2",children:"Edit annotation"},void 0,!1,void 0,this),p("textarea",{ref:X,value:Z,onChange:(z)=>Y(z.target.value),className:"w-full bg-transparent border-none text-body font-body text-text-primary resize-vertical focus:outline-none min-h-[60px]",onKeyDown:(z)=>{if(z.key==="Enter"&&(z.ctrlKey||z.metaKey))J(Z.trim());if(z.key==="Escape")Q()}},void 0,!1,void 0,this),p("div",{className:"flex justify-end gap-2 mt-2",children:[p("button",{onClick:Q,className:"text-meta text-text-tertiary font-body px-3 py-1",children:"Cancel"},void 0,!1,void 0,this),p("button",{onClick:()=>J(Z.trim()),className:"text-meta font-medium font-body px-3 py-1 rounded-md bg-highlight-bg text-text-primary border border-highlight-border",children:"Save"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import C5,{useRef as I0,useEffect as m0,useCallback as b0,useState as $0,useContext as j0}from"react";function y1($,J,Q,Z){let Y=[],X=$.filter((K)=>!K.filePath),z=$.filter((K)=>K.filePath),_=Q?Array.from(Q.values()).filter((K)=>t1(K)):[],q=Z?Array.from(Z.values()).filter((K)=>K.markdown.trim()):[];if(_.length>0||q.length>0){Y.push("## Responses"),Y.push("");for(let K of _)Y.push(M5(K));for(let K of q)Y.push(K.markdown.trim()),Y.push("")}if(X.length>0){Y.push("## Plan annotations"),Y.push("");let K=B5(X);Y.push(w0(K))}if(z.length>0){let K={};for(let G of z){let W=G.filePath;if(!K[W])K[W]=[];K[W].push(G)}Y.push("## File annotations"),Y.push("");for(let[G,W]of Object.entries(K)){Y.push(`### ${G}`),Y.push("");for(let T of W)Y.push(A0(T))}}if(J.trim())Y.push("## General notes"),Y.push(""),Y.push(J.trim()),Y.push("");return Y.join(`
42
+ `).trim()+`
43
+ `}function t1($){if($.note?.trim())return!0;if($.value===null||$.value===void 0)return!1;if($.type==="text"&&!$.value.trim())return!1;if($.type==="checkbox"&&$.value.length===0)return!1;return!0}function g1($){let J=[];for(let Q of $.values()){if(!Q.required)continue;if(Q.value===null||Q.value===void 0){J.push(Q);continue}if(Q.type==="text"&&!Q.value.trim()){J.push(Q);continue}if(Q.type==="checkbox"&&Q.value.length===0){J.push(Q);continue}}return J}function f1($){let J=[];for(let Q of $.values())if(Q.required&&!Q.markdown.trim())J.push(Q);return J}function M5($){let J=[];switch(J.push(`**${$.label}**`),$.type){case"radio":case"select":J.push(`Answer: ${$.value}`);break;case"checkbox":for(let Q of $.value)J.push(`- [x] ${Q}`);break;case"text":J.push(""),J.push($.value.trim());break;case"range":J.push(`Answer: ${$.value}`);break}if($.note?.trim())J.push(""),J.push(`Note: ${$.note.trim()}`);return J.push(""),J.join(`
44
+ `)}function A0($){let J=[],Q=$.snippet.trim(),Z=N0($);if(Q.split(`
45
+ `).length<=3)J.push(`> ${Z.split(`
46
+ `).join(`
47
+ > `)}`);else{let Y=Q.split(`
48
+ `);J.push(`> ${Y[0]}`),J.push(`> ... (${Y.length} lines)`),J.push(`> ${Y[Y.length-1]}`)}if($.note.trim())J.push(""),J.push($.note.trim());return J.push(""),J.join(`
49
+ `)}function B5($){let J={label:"",annotations:[],children:new Map};for(let Q of $){let Z=Q.context?.hierarchy||[],Y=J;for(let X of Z){if(!Y.children.has(X))Y.children.set(X,{label:X,annotations:[],children:new Map});Y=Y.children.get(X)}Y.annotations.push(Q)}return J}function w0($,J=0){let Q=[];for(let Z of $.annotations)Q.push(A0(Z));for(let[,Z]of $.children){let Y=J===0?"###":"####";Q.push(`${Y} ${Z.label}`),Q.push(""),Q.push(w0(Z,J+1))}return Q.join(`
50
+ `)}import{SessionContext as I5}from"#canvas/runtime";import{useEffect as n1,useState as k1,useRef as y5,useMemo as P5}from"react";import{jsxDEV as f,Fragment as A5}from"react/jsx-dev-runtime";function C0({open:$,onClose:J,onSubmit:Q}){let{annotations:Z,generalNote:Y,responses:X,feedbackEntries:z}=t(),[_,q]=k1(""),[U,K]=k1(!1),[G,W]=k1(!1),[T,N]=k1(null),P=y5(null);if(n1(()=>{if(!$){K(!1),W(!1),N(null);return}if(U)return;q(y1(Z,Y,X,z))},[Z,Y,X,z,U,$]),n1(()=>{if($&&G&&P.current)P.current.focus()},[$,G]),n1(()=>{if(!$)return;let y=(w)=>{if(w.key==="Escape")J()};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[$,J]),!$)return null;let L=_.trim().length>0;return f("div",{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm flex items-center justify-center p-8",onClick:J,children:f("div",{className:"bg-bg-surface border border-border-medium rounded-xl shadow-lg w-full max-w-2xl flex flex-col",style:{height:"80vh"},onClick:(y)=>y.stopPropagation(),children:[f("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border-subtle flex-shrink-0",children:[f("div",{className:"flex items-center gap-3",children:[f("span",{className:"text-[13px] font-medium text-text-primary font-body",children:"Response preview"},void 0,!1,void 0,this),U&&f("button",{onClick:()=>{K(!1),W(!1)},className:"text-[11px] text-text-tertiary hover:text-text-secondary font-body",children:"Reset"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),f("div",{className:"flex items-center gap-2",children:[f("div",{className:"flex items-center bg-bg-base rounded-md p-0.5",children:[f("button",{onClick:()=>W(!1),className:`px-2.5 py-1 rounded text-[11px] font-body font-medium transition-colors ${!G?"bg-bg-elevated text-text-primary shadow-sm":"text-text-tertiary hover:text-text-secondary"}`,children:"Preview"},void 0,!1,void 0,this),f("button",{onClick:()=>W(!0),className:`px-2.5 py-1 rounded text-[11px] font-body font-medium transition-colors ${G?"bg-bg-elevated text-text-primary shadow-sm":"text-text-tertiary hover:text-text-secondary"}`,children:"Edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),f("button",{onClick:J,className:"text-text-tertiary hover:text-text-secondary w-7 h-7 flex items-center justify-center rounded-md hover:bg-border-subtle transition-colors",children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G?f("textarea",{ref:P,value:_,onChange:(y)=>{q(y.target.value),K(!0)},className:"flex-1 w-full bg-bg-base p-5 text-[13px] font-mono text-text-code resize-none focus:outline-none leading-relaxed placeholder:text-text-disabled",placeholder:"Your feedback will appear here..."},void 0,!1,void 0,this):f("div",{className:"flex-1 overflow-y-auto p-5",children:f(e1,{text:_},void 0,!1,void 0,this)},void 0,!1,void 0,this),T&&f("div",{className:"px-5 py-2 text-[12px] text-accent-red font-body border-t border-border-subtle flex-shrink-0 flex items-center justify-between gap-2",children:[f("span",{children:T},void 0,!1,void 0,this),f("button",{onClick:()=>{N(null),Q(_)},className:"text-[11px] text-text-tertiary hover:text-text-secondary font-body whitespace-nowrap underline",children:"Submit anyway"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),f("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-border-subtle flex-shrink-0",children:[f("button",{onClick:J,className:"px-4 py-2 rounded-lg text-[13px] font-body text-text-tertiary hover:text-text-secondary transition-colors",children:"Cancel"},void 0,!1,void 0,this),f("button",{onClick:()=>{let y=g1(X),w=f1(z),O=[...y.map((b)=>b.label),...w.map((b)=>b.label||b.id)];if(O.length>0){N(`Please answer: ${O.join(", ")}`);return}N(null),Q(_)},disabled:!L,className:`px-6 py-2 rounded-lg font-body text-[13px] font-medium transition-all ${L?"bg-btn-primary text-btn-primary-text hover:opacity-90":"bg-bg-input text-text-disabled cursor-default"}`,children:"Submit feedback"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function e1({text:$}){let J=P5(()=>S5($),[$]);return f("div",{className:"font-body text-body text-text-primary leading-relaxed",children:J},void 0,!1,void 0,this)}function R0({text:$}){let J=[],Q=/(\*\*(.+?)\*\*|`(.+?)`)/g,Z=0,Y,X=0;while((Y=Q.exec($))!==null){if(Y.index>Z)J.push($.slice(Z,Y.index));if(Y[2])J.push(f("strong",{className:"font-semibold text-text-primary",children:Y[2]},X++,!1,void 0,this));else if(Y[3])J.push(f("code",{className:"font-mono text-code bg-bg-code px-1 py-px rounded",children:Y[3]},X++,!1,void 0,this));Z=Q.lastIndex}if(Z<$.length)J.push($.slice(Z));return f(A5,{children:J},void 0,!1,void 0,this)}function S5($){let J=$.split(`
51
+ `),Q=[],Z=0,Y=0;while(Z<J.length){let X=J[Z];if(X.startsWith("#### ")){Q.push(f("h4",{className:"text-[13px] font-body font-semibold text-text-primary mt-5 mb-1",children:X.slice(5)},Y++,!1,void 0,this)),Z++;continue}if(X.startsWith("### ")){Q.push(f("h3",{className:"text-[14px] font-body font-semibold text-text-primary mt-5 mb-1",children:X.slice(4)},Y++,!1,void 0,this)),Z++;continue}if(X.startsWith("## ")){Q.push(f("h2",{className:"text-task-label font-body font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-border-subtle",children:X.slice(3)},Y++,!1,void 0,this)),Z++;continue}if(X.startsWith("> ")){let z=[];while(Z<J.length&&J[Z].startsWith("> "))z.push(J[Z].slice(2)),Z++;Q.push(f("blockquote",{className:"border-l-2 border-border-hover pl-3 my-2 text-text-secondary italic text-[13px]",children:z.map((_,q)=>f("div",{children:_},q,!1,void 0,this))},Y++,!1,void 0,this));continue}if(X.startsWith("- [x] ")||X.startsWith("- [ ] ")){let z=[];while(Z<J.length&&(J[Z].startsWith("- [x] ")||J[Z].startsWith("- [ ] ")))z.push({checked:J[Z].startsWith("- [x] "),label:J[Z].slice(6)}),Z++;Q.push(f("ul",{className:"my-1 space-y-0.5",children:z.map((_,q)=>f("li",{className:"flex items-center gap-2 text-[13px]",children:[f("span",{className:`w-3.5 h-3.5 rounded flex items-center justify-center flex-shrink-0 ${_.checked?"bg-accent-amber":"border border-border-hover"}`,children:_.checked&&f("svg",{width:"8",height:"8",viewBox:"0 0 10 10",fill:"none",children:f("path",{d:"M2.5 5L4.5 7L7.5 3",style:{stroke:"var(--color-text-inverse)"},strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),f("span",{className:_.checked?"text-text-primary":"text-text-tertiary",children:_.label},void 0,!1,void 0,this)]},q,!0,void 0,this))},Y++,!1,void 0,this));continue}if(X.startsWith("- ")){let z=[];while(Z<J.length&&J[Z].startsWith("- "))z.push(J[Z].slice(2)),Z++;Q.push(f("ul",{className:"my-1 space-y-0.5 list-disc list-inside",children:z.map((_,q)=>f("li",{className:"text-[13px] text-text-secondary",children:f(R0,{text:_},void 0,!1,void 0,this)},q,!1,void 0,this))},Y++,!1,void 0,this));continue}if(X.trim()===""){Z++;continue}Q.push(f("p",{className:"my-1.5 text-[13px]",children:f(R0,{text:X},void 0,!1,void 0,this)},Y++,!1,void 0,this)),Z++}return Q}import{jsxDEV as q1}from"react/jsx-dev-runtime";var w5={ts:"#3178c6",tsx:"#3178c6",js:"#e8a32e",jsx:"#4ba0c8",html:"#e34c26",css:"#264de4",scss:"#c69",json:"#7a7568",yaml:"#cb171e",yml:"#cb171e",toml:"#9c4221",rs:"#dea584",go:"#00add8",c:"#6a6a6a",cpp:"#f34b7d",h:"#6a6a6a",py:"#3572a5",rb:"#cc342d",sh:"#5a8c3c",bash:"#5a8c3c",md:"#3573b5",txt:"#6b6560",lock:"#6b6560",gitignore:"#6b6560",svg:"#d9952e",png:"#6a9c2e",jpg:"#6a9c2e",gif:"#6a9c2e"},R5={ts:"TS",tsx:"TX",js:"JS",jsx:"JX",py:"PY",rs:"RS",go:"GO",rb:"RB",json:"{}",yaml:"YM",yml:"YM",toml:"TM",html:"<>",css:"#",scss:"#",md:"M↓",sh:"$",bash:"$",c:"C",cpp:"C+",h:"H",svg:"◇",png:"▣",jpg:"▣"};function P1({name:$,type:J,expanded:Q,className:Z=""}){if(J==="dir")return q1("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",className:`flex-shrink-0 ${Z}`,children:Q?q1("path",{d:"M1.5 3.5h5l1.5 1.5h6.5v8h-13z",style:{fill:"var(--color-folder-fill-active)",stroke:"var(--color-folder-stroke-active)"},strokeWidth:"1"},void 0,!1,void 0,this):q1("path",{d:"M1.5 3.5h5l1.5 1.5h6.5v8h-13z",style:{fill:"var(--color-folder-fill)",stroke:"var(--color-folder-stroke)"},strokeWidth:"1"},void 0,!1,void 0,this)},void 0,!1,void 0,this);let Y=$.includes(".")?$.split(".").pop().toLowerCase():"",X=w5[Y]||"#6b6560",z=R5[Y];return q1("svg",{width:"14",height:"14",viewBox:"0 0 16 16",className:`flex-shrink-0 ${Z}`,children:[q1("path",{d:"M2 1.5h8l3.5 3.5v9.5a1 1 0 01-1 1H3a1 1 0 01-1-1v-12a1 1 0 011-1z",fill:X,opacity:"0.85"},void 0,!1,void 0,this),q1("path",{d:"M10 1.5v2.5a1 1 0 001 1h2.5",fill:"none",stroke:"white",strokeWidth:"0.5",opacity:"0.5"},void 0,!1,void 0,this),z&&q1("text",{x:"8",y:"11.5",textAnchor:"middle",fill:"white",fontSize:"5.5",fontFamily:"monospace",fontWeight:"600",children:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as g}from"react/jsx-dev-runtime";function J0({onPreview:$,onSubmit:J,collapseButton:Q}){let{isReadOnly:Z,selectedRevision:Y,currentRevision:X,revisions:z}=j0(H1),_=j0(I5),q=Z&&Y===X,K=z.find((G)=>G.revision===Y)?.label||`Round ${Y}`;if(Z)return g(b5,{sessionId:_,revision:Y,label:K,waitingForUpdate:q,collapseButton:Q},void 0,!1,void 0,this);return g(j5,{onPreview:$,onSubmit:J,collapseButton:Q},void 0,!1,void 0,this)}function b5({sessionId:$,revision:J,label:Q,waitingForUpdate:Z,collapseButton:Y}){let[X,z]=$0(null),[_,q]=$0(!0);return m0(()=>{q(!0),fetch(`/api/session/${$}/revision/${J}/feedback`).then((U)=>U.json()).then((U)=>{z(U.feedback||null),q(!1)}).catch(()=>{z(null),q(!1)})},[$,J]),g("div",{className:"flex flex-col h-full",children:[g("div",{className:"px-4 py-3 flex items-center justify-between flex-shrink-0",children:[g("span",{className:"text-[11px] font-medium uppercase tracking-widest text-text-tertiary font-body",children:Z?"Feedback sent":`Feedback — ${Q}`},void 0,!1,void 0,this),Y]},void 0,!0,void 0,this),Z&&g("div",{className:"mx-4 mb-3 px-3 py-2.5 rounded-lg bg-accent-green-muted flex items-center gap-2 flex-shrink-0",children:[g("span",{className:"w-2 h-2 rounded-full bg-accent-green animate-pulse"},void 0,!1,void 0,this),g("span",{className:"text-[12px] font-body text-accent-green",children:"Waiting for next revision..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g("div",{className:"flex-1 overflow-y-auto px-4",children:_?g("p",{className:"text-[12px] text-text-tertiary font-body py-4",children:"Loading..."},void 0,!1,void 0,this):X?g(e1,{text:X},void 0,!1,void 0,this):g("p",{className:"text-[12px] text-text-tertiary font-body py-4",children:"No feedback was submitted for this revision."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function j5({onPreview:$,onSubmit:J,collapseButton:Q}){let{annotations:Z,updateAnnotation:Y,removeAnnotation:X,generalNote:z,setGeneralNote:_,activeAnnotationId:q,setActiveAnnotationId:U,responses:K,feedbackEntries:G}=t(),{setActiveView:W}=C5.useContext(G1),T=I0(null),N=I0(new Map),P=Z.filter((H)=>!H.filePath),L=Z.filter((H)=>H.filePath),y={};for(let H of L){let M=H.filePath;if(!y[M])y[M]=[];y[M].push(H)}m0(()=>{if(!q)return;let H=N.current.get(q);if(H)H.scrollIntoView({behavior:"smooth",block:"nearest"})},[q]);let w=b0((H)=>{U(H),l1(H,!0);let M=document.querySelector(`[data-annotation-id="${H}"]`);if(M)M.scrollIntoView({behavior:"smooth",block:"nearest"})},[U]),O=b0((H)=>{U(null),l1(H,!1)},[q]),b=Array.from(K.values()).some(t1),v=G.size>0,D=Z.length>0||z.trim().length>0||b||v,[j,A]=$0(null),C=(H)=>g("div",{ref:(M)=>{if(M)N.current.set(H.id,M);else N.current.delete(H.id)},className:`group/ann relative px-3 py-2.5 transition-colors duration-150 ${q===H.id?"bg-highlight-selected":"odd:bg-bg-elevated-half hover:bg-bg-input"}`,onMouseEnter:()=>w(H.id),onMouseLeave:()=>O(H.id),onClick:()=>{if(H.id===q)U(null);else if(U(H.id),H.filePath)W({type:"file",path:H.filePath}),setTimeout(()=>{let M=document.querySelector(`[data-annotation-id="${H.id}"]`);if(M)M.scrollIntoView({behavior:"smooth",block:"center"})},150)},children:[g("div",{className:"text-[11px] text-text-tertiary italic line-clamp-2 mb-1.5 leading-snug font-body border-l-2 border-border-medium pl-2",children:H.snippet.length>80?H.snippet.slice(0,80)+"...":H.snippet},void 0,!1,void 0,this),g("textarea",{value:H.note,onChange:(M)=>Y(H.id,M.target.value),onClick:(M)=>M.stopPropagation(),className:"w-full bg-transparent text-[13px] font-body text-text-primary resize-none focus:outline-none leading-relaxed p-0 border-none min-h-[20px]",rows:1,style:{height:"auto",overflow:"hidden"},onInput:(M)=>{let h=M.target;h.style.height="auto",h.style.height=h.scrollHeight+"px"},ref:(M)=>{if(M)M.style.height="auto",M.style.height=M.scrollHeight+"px"}},void 0,!1,void 0,this),g("div",{className:"absolute top-1.5 right-1.5 opacity-0 group-hover/ann:opacity-100 transition-opacity duration-100",children:g("button",{onClick:(M)=>{M.stopPropagation(),X(H.id)},className:"w-5 h-5 flex items-center justify-center rounded text-text-tertiary hover:text-accent-red hover:bg-accent-red-muted transition-colors",title:"Delete annotation",children:g("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[g("polyline",{points:"3 6 5 6 21 6"},void 0,!1,void 0,this),g("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},H.id,!0,void 0,this);return g("div",{className:"flex flex-col h-full",children:[g("div",{className:"px-4 py-3 flex items-center justify-between flex-shrink-0",children:[g("span",{className:"text-[11px] font-medium uppercase tracking-widest text-text-tertiary font-body flex items-center gap-2",children:["Annotations",Z.length>0&&g("span",{className:"inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded-full bg-border-subtle text-[10px] font-medium text-text-secondary",children:Z.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q]},void 0,!0,void 0,this),g("div",{ref:T,className:"flex-1 overflow-y-auto",children:[Z.length===0&&g("p",{className:"text-[12px] text-text-tertiary px-3 py-4 leading-relaxed font-body",children:"Select text in the plan or in files to add annotations."},void 0,!1,void 0,this),P.length>0&&L.length>0&&g("div",{className:"text-[10px] uppercase tracking-widest text-text-tertiary font-body px-3 mb-1 mt-1",children:"Plan"},void 0,!1,void 0,this),P.map(C),Object.entries(y).map(([H,M])=>g("div",{children:[g("button",{onClick:()=>W({type:"file",path:H}),className:"flex items-center gap-1.5 text-[10px] uppercase tracking-widest text-text-tertiary hover:text-text-secondary font-body px-3 pt-3 pb-1 truncate transition-colors w-full text-left",title:H,children:[g(P1,{name:H.split("/").pop()||H,type:"file"},void 0,!1,void 0,this),g("span",{className:"truncate",children:H},void 0,!1,void 0,this)]},void 0,!0,void 0,this),M.map(C)]},H,!0,void 0,this))]},void 0,!0,void 0,this),g("div",{className:"border-t border-border-subtle px-4 py-3 flex-shrink-0",children:g("textarea",{value:z,onChange:(H)=>_(H.target.value),className:"w-full bg-transparent text-[13px] font-body text-text-primary resize-none leading-relaxed p-0 border-none ring-0 shadow-none outline-none focus:outline-none focus:ring-0 focus:border-none placeholder:text-text-disabled min-h-[40px]",placeholder:"General notes...",onInput:(H)=>{let M=H.target;M.style.height="auto",M.style.height=Math.max(40,M.scrollHeight)+"px"},ref:(H)=>{if(H)H.style.height="auto",H.style.height=Math.max(40,H.scrollHeight)+"px"}},void 0,!1,void 0,this)},void 0,!1,void 0,this),j&&g("div",{className:"px-4 py-2 text-[12px] text-accent-red font-body border-t border-border-subtle flex-shrink-0 flex items-center justify-between gap-2",children:[g("span",{children:j},void 0,!1,void 0,this),g("button",{onClick:()=>{A(null);let H=y1(Z,z,K,G);J(H)},className:"text-[11px] text-text-tertiary hover:text-text-secondary font-body whitespace-nowrap underline",children:"Submit anyway"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g("div",{className:"px-4 py-3 border-t border-border-subtle flex-shrink-0",children:D?g("div",{className:"flex gap-2",children:[g("button",{onClick:$,className:"flex-1 py-2 rounded-lg font-body text-[13px] font-medium transition-all bg-border-subtle text-text-secondary hover:bg-border-medium hover:text-text-primary",children:"Preview"},void 0,!1,void 0,this),g("button",{onClick:()=>{let H=g1(K),M=f1(G),h=[...H.map((I)=>I.label),...M.map((I)=>I.label||I.id)];if(h.length>0){A(`Please answer: ${h.join(", ")}`);return}A(null);let c=y1(Z,z,K,G);J(c)},className:"flex-1 py-2 rounded-lg font-body text-[13px] font-medium transition-all bg-btn-primary text-btn-primary-text hover:opacity-90 hover:-translate-y-px shadow-sm",children:"Submit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):g("button",{onClick:()=>J("No feedback — looks good."),className:"w-full py-2 rounded-lg font-body text-[13px] font-medium border border-border-medium text-text-secondary hover:text-text-primary hover:border-border-hover hover:bg-bg-input transition-all",children:"Submit without feedback"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useEffect as m5,useState as V0,useContext as D0}from"react";import{SessionContext as V5}from"#canvas/runtime";import{jsxDEV as u,Fragment as Q0}from"react/jsx-dev-runtime";function g0({embedded:$}={}){let J=D0(V5),{annotations:Q,addAnnotation:Z}=t(),{setActiveView:Y}=D0(G1),[X,z]=V0(!1),[_,q]=V0({}),U=Q.filter((O)=>O.filePath),K=new Map;for(let O of U)K.set(O.filePath,(K.get(O.filePath)||0)+1);let G=[...K.keys()],W=async(O)=>{let v=await(await fetch(`/api/tree?session=${J}&path=${encodeURIComponent(O)}`)).json();if(v.entries)q((D)=>({...D,[O]:{entries:v.entries,expanded:!0,loaded:!0}}))};m5(()=>{if(!X&&!_[""])W("")},[X]);let T=(O)=>{if(_[O]?.loaded)q((b)=>({...b,[O]:{...b[O],expanded:!b[O].expanded}}));else W(O)},N=(O)=>{Y({type:"file",path:O})},P=async(O)=>{let v=await(await fetch(`/api/file?session=${J}&path=${encodeURIComponent(O)}`)).json();if(!v.error){let D=v.content.split(`
52
+ `).slice(0,3).join(`
53
+ `)+(v.content.split(`
54
+ `).length>3?`
55
+ ...`:"");Z(D,"Include this file for context",O)}},L=async(O)=>{let b=[];if(_[O]?.loaded)b=_[O].entries;else{let D=await(await fetch(`/api/tree?session=${J}&path=${encodeURIComponent(O)}`)).json();if(D.entries)b=D.entries}await Promise.all(b.filter((v)=>v.type==="file").map((v)=>P(O?`${O}/${v.name}`:v.name)))},y=(O)=>K.get(O)||0,w=(O,b=0)=>{let v=_[O];if(!v?.expanded)return null;return v.entries.map((D)=>{let j=O?`${O}/${D.name}`:D.name,A=y(j);return u("div",{children:[u("div",{className:"group/item flex items-center py-[3px] hover:bg-bg-elevated text-[13px] font-body cursor-default transition-colors duration-100",style:{paddingLeft:`${16+b*16}px`,paddingRight:"8px"},children:D.type==="dir"?u(Q0,{children:[u("span",{onClick:()=>T(j),className:"flex items-center gap-1.5 flex-1 text-text-secondary hover:text-text-primary cursor-pointer truncate",children:[u(P1,{name:D.name,type:"dir",expanded:_[j]?.expanded},void 0,!1,void 0,this),u("span",{className:"truncate",children:D.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u("button",{onClick:(C)=>{C.stopPropagation(),L(j)},className:"text-[11px] text-text-tertiary hover:text-text-secondary opacity-0 group-hover/item:opacity-100 transition-opacity px-1 flex-shrink-0",title:"Add all files in folder",children:"+"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):u(Q0,{children:[u("span",{onClick:()=>N(j),className:`flex-1 truncate cursor-pointer flex items-center gap-1.5 ${A>0?"text-text-primary":"text-text-secondary hover:text-text-primary"}`,children:[u(P1,{name:D.name,type:"file"},void 0,!1,void 0,this),u("span",{className:"truncate",children:D.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u("div",{className:"flex items-center gap-1 flex-shrink-0 ml-1",children:[A>0&&u("span",{className:"text-[10px] font-medium bg-badge-bg text-accent-amber px-1.5 py-px rounded-full min-w-[18px] text-center",children:A},void 0,!1,void 0,this),u("button",{onClick:(C)=>{C.stopPropagation(),P(j)},className:"text-[11px] text-text-tertiary hover:text-text-secondary opacity-0 group-hover/item:opacity-100 transition-opacity px-1",title:"Add file to context",children:"+"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),D.type==="dir"&&w(j,b+1)]},j,!0,void 0,this)})};if($)return u(Q0,{children:[u("div",{className:"flex items-center justify-between px-4 pt-3 pb-2 flex-shrink-0",children:u("span",{className:"text-[11px] font-medium uppercase tracking-widest text-text-tertiary font-body",children:"Files"},void 0,!1,void 0,this)},void 0,!1,void 0,this),u("div",{className:"flex-1 overflow-y-auto",children:w("")},void 0,!1,void 0,this),G.length>0&&u("div",{className:"border-t border-border-subtle px-4 py-3 flex-shrink-0",children:[u("div",{className:"text-[10px] uppercase tracking-widest text-text-tertiary font-body mb-1.5",children:"Referenced"},void 0,!1,void 0,this),G.map((O)=>u("div",{onClick:()=>N(O),className:"flex items-center justify-between text-[12px] font-body text-text-secondary hover:text-text-primary cursor-pointer py-0.5",children:[u("span",{className:"truncate",children:O.split("/").pop()},void 0,!1,void 0,this),u("span",{className:"text-[10px] font-medium bg-badge-bg text-accent-amber px-1.5 py-px rounded-full min-w-[18px] text-center flex-shrink-0 ml-1",children:y(O)},void 0,!1,void 0,this)]},O,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if(X)return u("div",{className:"hidden lg:flex w-8 border-r border-border-subtle bg-bg-surface flex-col items-center flex-shrink-0",children:u("button",{onClick:()=>z(!1),className:"mt-3 p-1 text-text-tertiary hover:text-text-secondary transition-colors",children:u("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:u("path",{d:"M5 3l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);return u("div",{className:"hidden lg:flex w-60 border-r border-border-subtle bg-bg-surface flex-col flex-shrink-0 overflow-hidden",children:[u("div",{className:"flex items-center justify-between px-4 pt-4 pb-3 flex-shrink-0",children:[u("span",{className:"text-[11px] font-medium uppercase tracking-widest text-text-tertiary font-body",children:"Files"},void 0,!1,void 0,this),u("button",{onClick:()=>z(!0),className:"text-text-tertiary hover:text-text-secondary transition-colors p-0.5",children:u("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:u("path",{d:"M9 3l-4 4 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u("div",{className:"flex-1 overflow-y-auto",children:w("")},void 0,!1,void 0,this),G.length>0&&u("div",{className:"border-t border-border-subtle px-4 py-3 flex-shrink-0",children:[u("div",{className:"text-[10px] uppercase tracking-widest text-text-tertiary font-body mb-1.5",children:"Referenced"},void 0,!1,void 0,this),G.map((O)=>u("div",{onClick:()=>N(O),className:"flex items-center justify-between text-[12px] font-body text-text-secondary hover:text-text-primary cursor-pointer py-0.5",children:[u("span",{className:"truncate",children:O.split("/").pop()},void 0,!1,void 0,this),u("span",{className:"text-[10px] font-medium bg-badge-bg text-accent-amber px-1.5 py-px rounded-full min-w-[18px] text-center flex-shrink-0 ml-1",children:y(O)},void 0,!1,void 0,this)]},O,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useEffect as S1,useState as _1,useContext as D5,useCallback as g5,useRef as v1,useMemo as f5}from"react";import{SessionContext as k5}from"#canvas/runtime";var u1={ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",py:"python",rs:"rust",go:"go",rb:"ruby",java:"java",json:"json",yaml:"yaml",yml:"yaml",md:"markdown",css:"css",html:"html",sh:"bash",bash:"bash",toml:"toml",sql:"sql",xml:"xml",c:"c",cpp:"cpp",h:"c"};import{jsxDEV as J1}from"react/jsx-dev-runtime";function f0({path:$}){let J=D5(k5),{annotations:Q,addAnnotationWithId:Z,removeAnnotation:Y,updateAnnotation:X,activeAnnotationId:z,setActiveAnnotationId:_}=t(),[q,U]=_1(null),[K,G]=_1("text"),[W,T]=_1(!0),[N,P]=_1(null),L=v1(null),[y,w]=_1(null),O=v1(""),[b,v]=_1(null),[D,j]=_1(null),A=Q.filter((R)=>R.filePath===$);S1(()=>{T(!0),P(null),fetch(`/api/file?session=${J}&path=${encodeURIComponent($)}`).then((R)=>R.json()).then((R)=>{if(R.error)P(R.error),T(!1);else U(R.content),G(R.language||"text"),T(!1)}).catch(()=>{P("Failed to fetch file"),T(!1)})},[J,$]),S1(()=>{if(!q||!L.current)return;let R=setTimeout(()=>{if(L.current)b1(L.current,A)},50);return()=>clearTimeout(R)},[q,$]),S1(()=>{C1(z)},[z]),S1(()=>{let R=L.current;if(!R)return;let B=(x)=>{let E=x.target.closest("[data-annotation-id]");if(!E)return;x.stopPropagation();let V=E.getAttribute("data-annotation-id");if(V===z)v({anchorEl:E,annId:V});else _(V)},S=(x)=>{let E=x.target.closest("[data-annotation-id]");if(E)_(E.getAttribute("data-annotation-id"))},m=(x)=>{let E=x.target.closest("[data-annotation-id]"),V=x.relatedTarget?.closest?.("[data-annotation-id]");if(E&&!V&&!document.getElementById("ann-inline-popover"))_(null)};return R.addEventListener("click",B),R.addEventListener("mouseover",S),R.addEventListener("mouseout",m),()=>{R.removeEventListener("click",B),R.removeEventListener("mouseover",S),R.removeEventListener("mouseout",m)}},[q,Q,z]),S1(()=>{let R=()=>M();return document.addEventListener("mouseup",R),()=>document.removeEventListener("mouseup",R)},[]);let C=v1($);C.current=$;let H=v1(Z);H.current=Z;let M=g5(()=>{let R=window.getSelection();if(!R||R.isCollapsed||!R.toString().trim())return;if(!L.current)return;let B=R.getRangeAt(0);if(!L.current.contains(B.startContainer))return;if(B.startContainer.parentElement?.closest?.("[data-annotation-id]"))return;let S=R.toString().trim();if(S.length<2)return;let m=`__pending_${Date.now()}`,x=B.cloneRange();try{L1(x,m)}catch{}R.removeAllRanges();let E=document.querySelectorAll(`[data-annotation-id="${m}"]`),V=E[E.length-1];if(!V)return;O.current=S,w(m),j({anchorEl:V,tempId:m,snippet:S})},[]),h=f5(()=>{if(!q)return null;let R=window.hljs;if(!R)return null;let B=$.split(".").pop()||"",S=u1[B];try{return(S?R.highlight(q,{language:S}):R.highlightAuto(q)).value.split(`
56
+ `)}catch{return null}},[q,$]);if(W)return J1("div",{className:"flex items-center justify-center h-64 text-text-tertiary font-body text-[13px]",children:["Loading ",$,"..."]},void 0,!0,void 0,this);if(N)return J1("div",{className:"p-8 text-accent-red font-body text-[13px]",children:N},void 0,!1,void 0,this);if(!q)return null;let c=q.split(`
57
+ `),I=()=>{let R=q.split(`
58
+ `).slice(0,3).join(`
59
+ `)+(c.length>3?`
60
+ ...`:""),B=`ann-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;Z(B,R,"",$),_(B)},l=L.current?.closest("#plan-scroll-container");return J1("div",{children:[J1("pre",{ref:L,className:"text-code font-mono text-text-code bg-bg-base select-text cursor-text py-3 hljs",children:c.map((R,B)=>J1("div",{className:"flex hover:bg-bg-elevated-half px-5",children:[J1("span",{className:"text-text-tertiary opacity-40 select-none w-10 text-right pr-4 shrink-0 py-px text-[12px]",children:B+1},void 0,!1,void 0,this),h?J1("code",{className:"py-px",dangerouslySetInnerHTML:{__html:h[B]||" "}},void 0,!1,void 0,this):J1("code",{className:"py-px",children:R||" "},void 0,!1,void 0,this)]},B,!0,void 0,this))},void 0,!1,void 0,this),b&&(()=>{let R=Q.find((B)=>B.id===b.annId);if(!R)return null;return J1(B1,{anchorEl:b.anchorEl,scrollContainer:l,initialNote:R.note,onUpdate:(B)=>X(b.annId,B),onDelete:()=>{Y(b.annId),_(null)},onClose:()=>v(null)},void 0,!1,void 0,this)})(),D&&J1(M1,{anchorEl:D.anchorEl,scrollContainer:l,snippet:D.snippet,onAdd:(R)=>{let B=`ann-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;I1(D.tempId,B),Z(B,D.snippet,R,$),w(null),j(null)},onCancel:()=>{j1(D.tempId),w(null),j(null)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useEffect as k0,useState as u0,useRef as u5}from"react";import{jsxDEV as Q1}from"react/jsx-dev-runtime";function Y0({currentSessionId:$}){let[J,Q]=u0([]),[Z,Y]=u0(!1),X=u5(null);k0(()=>{let q=async()=>{try{let K=await fetch("/api/sessions");Q(await K.json())}catch{}};q();let U=setInterval(q,5000);return()=>clearInterval(U)},[]),k0(()=>{if(!Z)return;let q=(U)=>{if(X.current&&!X.current.contains(U.target))Y(!1)};return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[Z]);let z=J.filter((q)=>q.id!==$),_=$.length>30?$.slice(0,30)+"...":$;return Q1("div",{className:"relative",ref:X,children:[Q1("button",{onClick:()=>z.length>0&&Y(!Z),className:"flex items-center gap-1.5 font-body text-body font-medium text-text-primary hover:text-text-secondary transition-colors",children:[Q1("span",{children:_},void 0,!1,void 0,this),z.length>0&&Q1("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:`text-text-tertiary transition-transform duration-200 ${Z?"rotate-180":""}`,children:Q1("path",{d:"M3 5l3 3 3-3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z&&z.length>0&&Q1("div",{className:"absolute top-full left-0 mt-2 w-64 bg-bg-elevated border border-border-hover rounded-lg shadow-lg z-50 py-1 overflow-hidden",children:z.map((q)=>Q1("a",{href:`/s/${q.id}`,className:"flex items-center gap-2.5 px-4 py-2.5 text-body font-body text-text-secondary hover:bg-bg-surface hover:text-text-primary transition-colors",children:[Q1("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${q.currentRevision>0?"bg-accent-green":"bg-border-hover"}`},void 0,!1,void 0,this),Q1("span",{className:"truncate",children:q.id},void 0,!1,void 0,this)]},q.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function v0($){let J=[];return E1($,J,0),J.join(`
61
+ `).replace(/\n{3,}/g,`
62
+
63
+ `).trim()+`
64
+ `}var v5=new Set(["CODE","SPAN","STRONG","EM","A","B","I","U","SMALL","SUB","SUP","MARK","ABBR"]);function E1($,J,Q){if(E5($)){let Z=h5($);if(Z)J.push(Z,"");return}for(let Z of $.childNodes)if(Z.nodeType===Node.ELEMENT_NODE)x5(Z,J,Q);else if(Z.nodeType===Node.TEXT_NODE){let Y=Z.textContent?.trim();if(Y)J.push(Y,"")}}function E5($){for(let J of $.childNodes){if(J.nodeType===Node.TEXT_NODE)continue;if(J.nodeType===Node.ELEMENT_NODE){let Q=J;if(!v5.has(Q.tagName)||Q.hasAttribute("data-md"))return!1}}return $.childNodes.length>0}function h5($){let J="";for(let Q of $.childNodes)if(Q.nodeType===Node.TEXT_NODE)J+=Q.textContent||"";else if(Q.nodeType===Node.ELEMENT_NODE){let Z=Q;if(Z.tagName==="CODE")J+="`"+(Z.textContent||"")+"`";else J+=Z.textContent||""}return J.trim()}function x5($,J,Q){let Z=$.getAttribute("data-md");if(Z)switch(Z){case"section":return p5($,J,Q);case"item":return c5($,J);case"codeblock":return d5($,J);case"callout":return r5($,J);case"note":return l5($,J);case"table":return i5($,J);case"checklist":return a5($,J);case"diff":return o5($,J);case"mermaid":return s5($,J);case"choice":return t5($,J);case"multichoice":return n5($,J);case"choice-option":case"multichoice-option":return;case"userinput":return e5($,J);case"rangeinput":return $2($,J);case"checklist-item":return;case"filepreview":return J2($,J);case"priority":return Q2($,J)}if($.querySelector("button, input, select, textarea"))return;if($.children.length>0)E1($,J,Q);else{let Y=$.textContent?.trim();if(Y)J.push(Y,"")}}function p5($,J,Q){let Z=$.getAttribute("data-md-title")||"Untitled",Y=Q===0?"##":"###";J.push(`${Y} ${Z}`,"");let X=$.querySelector(":scope > div:last-of-type");if(X)E1(X,J,Q+1)}function c5($,J){let Q=$.getAttribute("data-md-label")||"",Z=$.getAttribute("data-md-status"),Y=$.getAttribute("data-md-badge"),X="-";if(Z==="done")X="- [x]";else if(Z)X="- [ ]";let z=`${X} **${Q}**`;if(Y)z+=` \`${Y}\``;J.push(z);let _=$.querySelector(".text-text-secondary");if(_){let q=[];E1(_,q,0);for(let U of q)J.push(U?` ${U}`:"")}J.push("")}function d5($,J){let Q=$.getAttribute("data-md-language")||"",Y=$.querySelector("code")?.textContent||"";J.push(`\`\`\`${Q}`,Y,"```","")}function r5($,J){let Q=$.getAttribute("data-md-type")||"info",Z={info:"Info",warning:"Warning",danger:"Danger",tip:"Tip"},Y=Y2($.querySelector(".text-text-secondary")||$);J.push(`> **${Z[Q]||Q}:** ${Y}`,"")}function l5($,J){let Q=$.textContent?.trim()||"";J.push(`> *${Q}*`,"")}function i5($,J){let Q=$.querySelector("table");if(!Q)return;let Z=[];for(let Y of Q.querySelectorAll("thead th"))Z.push(Y.textContent?.trim()||"");if(Z.length===0)return;J.push(`| ${Z.join(" | ")} |`),J.push(`| ${Z.map(()=>"---").join(" | ")} |`);for(let Y of Q.querySelectorAll("tbody tr")){let X=[];for(let z of Y.querySelectorAll("td"))X.push(z.textContent?.trim()||"");J.push(`| ${X.join(" | ")} |`)}J.push("")}function a5($,J){for(let Q of $.querySelectorAll("li")){let Z=Q.querySelector(".bg-accent-green")!==null,Y=Q.textContent?.trim()||"";J.push(`- [${Z?"x":" "}] ${Y}`)}J.push("")}function o5($,J){let Q=$.getAttribute("data-md-language")||"";J.push(`\`\`\`diff${Q?` (${Q})`:""}`);for(let Z of $.querySelectorAll("[class*='flex']")){let Y=Z.querySelector(".text-accent-red")?"-":Z.querySelector(".text-accent-green")?"+":" ",X=Z.querySelector("code");if(X)J.push(`${Y} ${X.textContent}`)}J.push("```","")}function s5($,J){let Q=$.getAttribute("data-md-source")||"";if(Q)J.push("```mermaid",Q,"```","")}function t5($,J){let Q=$.getAttribute("data-md-label")||"";J.push(`**${Q}:**`);for(let Z of $.querySelectorAll("[data-md='choice-option']")){let Y=Z.getAttribute("data-md-label")||Z.textContent?.trim()||"",X=Z.querySelector(".bg-accent-amber")!==null;J.push(`- ${X?"(x)":"( )"} ${Y}`)}J.push("")}function n5($,J){let Q=$.getAttribute("data-md-label")||"";J.push(`**${Q}:**`);for(let Z of $.querySelectorAll("[data-md='multichoice-option']")){let Y=Z.getAttribute("data-md-label")||Z.textContent?.trim()||"",X=Z.querySelector(".bg-accent-amber")!==null;J.push(`- [${X?"x":" "}] ${Y}`)}J.push("")}function e5($,J){let Q=$.getAttribute("data-md-label")||"",Y=$.querySelector("textarea")?.value?.trim()||"";J.push(`**${Q}:** ${Y||"_empty_"}`,"")}function $2($,J){let Q=$.getAttribute("data-md-label")||"",Z=$.querySelector("input[type='range']"),X=$.querySelector(".font-mono")?.textContent?.trim()||Z?.value||"—";J.push(`**${Q}:** ${X}`,"")}function J2($,J){let Q=$.getAttribute("data-md-path")||"",Z=$.getAttribute("data-md-lines")||"",X=$.querySelector("code")?.textContent||"",z=Q.split(".").pop()||"",_=u1[z]||"",q=Z?`${Q} (L${Z})`:Q;J.push(q,"",`\`\`\`${_}`,X,"```","")}function Q2($,J){}function Y2($){return $?.textContent?.trim()||""}import L2,{useEffect as W1,useState as a,useRef as Z1}from"react";import{useEffect as Z2,useState as X2,useRef as z2,useContext as q2}from"react";import{jsxDEV as e,Fragment as E0}from"react/jsx-dev-runtime";function _2($){return $.label||`Round ${$.revision}`}function U2($){let J=Date.now()-new Date($).getTime(),Q=Math.floor(J/1000);if(Q<60)return"just now";let Z=Math.floor(Q/60);if(Z<60)return`${Z}m ago`;let Y=Math.floor(Z/60);if(Y<24)return`${Y}h ago`;return`${Math.floor(Y/24)}d ago`}function A1({value:$,onChange:J,accent:Q="default",className:Z}){let{currentRevision:Y,revisions:X}=q2(H1),[z,_]=X2(!1),q=z2(null);Z2(()=>{if(!z)return;let G=(W)=>{if(q.current&&!q.current.contains(W.target))_(!1)};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[z]);let U=X.find((G)=>G.revision===$);return e("div",{className:"relative",ref:q,children:[e("button",{onClick:()=>_(!z),className:`flex items-center gap-1.5 text-[12px] font-body font-medium px-2 py-1 rounded-md transition-colors hover:bg-bg-elevated ${{default:"text-text-secondary hover:text-text-primary",red:"text-accent-red",green:"text-accent-green",amber:"text-accent-amber bg-highlight-selected"}[Q]} ${Z||""}`,children:[U?_2(U):`Round ${$}`,e("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",className:`text-text-tertiary transition-transform duration-200 ${z?"rotate-180":""}`,children:e("path",{d:"M2.5 4l2.5 2.5L7.5 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z&&e("div",{className:"absolute top-full left-0 mt-1 w-64 bg-bg-elevated border border-border-hover rounded-lg shadow-lg z-50 py-1 max-h-80 overflow-y-auto",children:[...X].reverse().map((G)=>e("button",{onClick:()=>{J(G.revision),_(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-[12px] font-body transition-colors ${G.revision===$?"bg-bg-surface text-text-primary":"text-text-secondary hover:bg-bg-surface hover:text-text-primary"}`,children:[e("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${G.revision===Y?"bg-accent-green":G.hasFeedback?"bg-accent-amber":"bg-border-hover"}`},void 0,!1,void 0,this),e("span",{className:"flex-1 text-left truncate",children:G.label?e(E0,{children:[G.label," ",e("span",{className:"text-text-tertiary",children:["#",G.revision]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):e(E0,{children:["Round ",G.revision]},void 0,!0,void 0,this)},void 0,!1,void 0,this),e("span",{className:"text-[10px] text-text-tertiary flex-shrink-0",children:G.revision===Y?"current":G.hasFeedback?"sent":U2(G.createdAt)},void 0,!1,void 0,this)]},G.revision,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function h1($,J){let Q=$.length,Z=J.length;if(Q===0||Z===0)return[];let Y=Array.from({length:Q+1},()=>Array(Z+1).fill(0));for(let q=1;q<=Q;q++)for(let U=1;U<=Z;U++)Y[q][U]=$[q-1]===J[U-1]?Y[q-1][U-1]+1:Math.max(Y[q-1][U],Y[q][U-1]);let X=[],z=Q,_=Z;while(z>0&&_>0)if($[z-1]===J[_-1])X.unshift($[z-1]),z--,_--;else if(Y[z-1][_]>Y[z][_-1])z--;else _--;return X}function h0($){let J=[],Q=[],Z=document.createTreeWalker($,NodeFilter.SHOW_TEXT,{acceptNode(X){let z=X.parentElement;if(!z)return NodeFilter.FILTER_REJECT;if(z.closest("svg, .select-none, [data-no-diff]"))return NodeFilter.FILTER_REJECT;return NodeFilter.FILTER_ACCEPT}}),Y;while(Y=Z.nextNode()){let z=(Y.nodeValue||"").match(/\S+|\s+/g);if(!z)continue;let _=0;for(let q of z)J.push(q),Q.push({text:q,node:Y,offset:_}),_+=q.length}return{words:J,map:Q}}function Z0($,J){if($.length>5000||J.length>5000)return K2($,J);return c0($,J)}function c0($,J){let Q=x1($,J),Z=[],Y=[],X=0,z=0,_=0;while(X<$.length||z<J.length)if(_<Q.length&&X<$.length&&z<J.length&&$[X]===Q[_]&&J[z]===Q[_])Z.push({type:"same",index:X}),Y.push({type:"same",index:z}),X++,z++,_++;else if(X<$.length&&(_>=Q.length||$[X]!==Q[_]))Z.push({type:"removed",index:X}),X++;else if(z<J.length)Y.push({type:"added",index:z}),z++;return{oldOps:Z,newOps:Y}}function x1($,J){let Q=$.length,Z=J.length;if(Q===0||Z===0)return[];if(Q===1)return J.includes($[0])?[$[0]]:[];if(Z===1)return $.includes(J[0])?[J[0]]:[];if(Q*Z<=1e6)return h1($,J);let Y=Math.floor(Q/2),X=$.slice(0,Y),z=$.slice(Y),_=x0(X,J),q=x0([...z].reverse(),[...J].reverse()),U=0,K=0;for(let T=0;T<=Z;T++){let N=_[T]+q[Z-T];if(N>U)U=N,K=T}let G=J.slice(0,K),W=J.slice(K);return[...x1(X,G),...x1(z,W)]}function x0($,J){let Q=J.length,Z=Array(Q+1).fill(0),Y=Array(Q+1).fill(0);for(let X=0;X<$.length;X++){for(let z=1;z<=Q;z++)Y[z]=$[X]===J[z-1]?Z[z-1]+1:Math.max(Z[z],Y[z-1]);[Z,Y]=[Y,Z],Y.fill(0)}return Z}function K2($,J){let Z=(N)=>{let P=[];for(let L=0;L<N.length;L+=200){let y=Math.min(L+200,N.length);P.push({start:L,end:y,text:N.slice(L,y).join("")})}return P},Y=Z($),X=Z(J),z=Y.map((N)=>N.text),_=X.map((N)=>N.text),q=x1(z,_),U=[],K=[],G=0,W=0,T=0;while(G<Y.length||W<X.length)if(T<q.length&&G<Y.length&&W<X.length&&z[G]===q[T]&&_[W]===q[T]){for(let N=Y[G].start;N<Y[G].end;N++)U.push({type:"same",index:N});for(let N=X[W].start;N<X[W].end;N++)K.push({type:"same",index:N});G++,W++,T++}else if(G<Y.length&&(T>=q.length||z[G]!==q[T]))if(W<X.length&&(T>=q.length||_[W]!==q[T])){let N=c0($.slice(Y[G].start,Y[G].end),J.slice(X[W].start,X[W].end));for(let P of N.oldOps)U.push({type:P.type,index:P.index+Y[G].start});for(let P of N.newOps)K.push({type:P.type,index:P.index+X[W].start});G++,W++}else{for(let N=Y[G].start;N<Y[G].end;N++)U.push({type:"removed",index:N});G++}else if(W<X.length){for(let N=X[W].start;N<X[W].end;N++)K.push({type:"added",index:N});W++}return{oldOps:U,newOps:K}}function p0($,J,Q){let Z=new Map;for(let Y of $){if(Y.type==="same")continue;let X=J[Y.index];if(!X||!X.node.parentNode)continue;let z=Z.get(X.node);if(!z)z=[],Z.set(X.node,z);z.push({offset:X.offset,length:X.text.length})}for(let[Y,X]of Z){if(!Y.parentNode)continue;let z=Y.nodeValue||"";X.sort((G,W)=>G.offset-W.offset);let _=[];for(let G of X){let W=_[_.length-1];if(W&&G.offset<=W.offset+W.length)W.length=Math.max(W.length,G.offset+G.length-W.offset);else _.push({...G})}let q=Y.parentNode,U=document.createDocumentFragment(),K=0;for(let G of _){if(G.offset>K)U.appendChild(document.createTextNode(z.slice(K,G.offset)));let W=document.createElement("span");W.className=Q,W.textContent=z.slice(G.offset,G.offset+G.length),U.appendChild(W),K=G.offset+G.length}if(K<z.length)U.appendChild(document.createTextNode(z.slice(K)));q.replaceChild(U,Y)}}function d0($,J){let Q=h0($),Z=h0(J),{oldOps:Y,newOps:X}=Z0(Q.words,Z.words),z=Y.some((_)=>_.type==="removed")||X.some((_)=>_.type==="added");return p0(Y,Q.map,"diff-removed"),p0(X,Z.map,"diff-added"),z}function X0($){let J=[],Q=$.querySelectorAll(":scope > [data-md]");for(let Z of Q)J.push(w1(Z));if(J.length===0){let Z=$.querySelectorAll("[data-md]"),Y=new Set;for(let X of Z){let z=X.parentElement?.closest("[data-md]");if(z&&$.contains(z))continue;if(Y.has(X))continue;Y.add(X),J.push(w1(X))}}return J}function w1($){let J=$.getAttribute("data-md")||"unknown",Q=G2($,J),Z=[];if(J==="section"){let Y=$.querySelector(":scope > div.mt-6, :scope > div:last-child");if(Y)for(let X of Y.querySelectorAll(":scope > [data-md]"))Z.push(w1(X))}else if(J==="table")for(let Y of $.querySelectorAll(":scope table > tbody > tr"))Z.push({key:"tr:"+(Y.textContent||"").slice(0,80),type:"tr",element:Y,children:[]});else if(J==="checklist")for(let Y of $.querySelectorAll(":scope > [data-md='checklist-item']"))Z.push(w1(Y));else for(let Y of $.querySelectorAll("[data-md]"))if(Y.parentElement?.closest("[data-md]")===$)Z.push(w1(Y));return{key:Q,type:J,element:$,children:Z}}function G2($,J){switch(J){case"section":return"section:"+($.getAttribute("data-md-title")||"");case"item":return"item:"+($.getAttribute("data-task-id")||$.getAttribute("data-md-label")||"");case"codeblock":case"diff":return J+":"+($.textContent||"").slice(0,80);case"checklist-item":return"checklist-item:"+($.getAttribute("data-md-label")||$.textContent?.slice(0,60)||"");case"checklist":return"checklist:"+$.querySelectorAll("[data-md='checklist-item']").length;case"callout":return"callout:"+($.getAttribute("data-md-type")||"")+":"+($.textContent||"").slice(0,60);default:return J+":"+($.getAttribute("data-md-label")||$.textContent?.slice(0,60)||"")}}function z0($,J){let Q=$.map((U)=>U.key),Z=J.map((U)=>U.key),Y=h1(Q,Z),X=[],z=0,_=0,q=0;while(z<$.length||_<J.length)if(q<Y.length&&z<$.length&&_<J.length&&Q[z]===Y[q]&&Z[_]===Y[q]){let U=$[z],K=J[_],G=U.children.length>0||K.children.length>0?z0(U.children,K.children):void 0;X.push({kind:"matched",oldBlock:U,newBlock:K,childMatches:G}),z++,_++,q++}else if(z<$.length&&(q>=Y.length||Q[z]!==Y[q]))X.push({kind:"removed",oldBlock:$[z]}),z++;else if(_<J.length)X.push({kind:"added",newBlock:J[_]}),_++;return X}function l0($){let J=document.createDocumentFragment(),Q=!1;for(let Z of $)if(Z.kind==="removed")Q=!0,J.appendChild(i0(Z.oldBlock.element));else if(Z.kind==="added")Q=!0,J.appendChild(H2(Z.newBlock.element));else{let Y=Z.newBlock.element.cloneNode(!0),X=Z.newBlock.type;if(Z.childMatches&&Z.childMatches.length>0&&(X==="table"||X==="checklist")){if(o0(Y,Z.childMatches,X))Q=!0}else if(Z.childMatches&&Z.childMatches.length>0){if(a0(Z.oldBlock,Y,Z.childMatches,X))Q=!0}else if(R1(Z.oldBlock.element,Y,!1))Q=!0;J.appendChild(Y)}return{fragment:J,hasChanges:Q}}function i0($){let J=$.cloneNode(!0);return J.classList.add("diff-block-removed"),J.style.position="relative",q0(J,"Removed","var(--color-accent-red)"),J}function H2($){let J=$.cloneNode(!0);return J.classList.add("diff-block-added"),J.style.position="relative",q0(J,"Added","var(--color-accent-green)"),J}function a0($,J,Q,Z){let Y=!1,X=W2($,J),z,_;if(Z==="section"){let q=$.element.querySelector(":scope > div:first-child"),U=J.querySelector(":scope > div:first-child");if(q&&U){if(R1(q,U,!1))Y=!0}z=$.element.querySelector(":scope > div.mt-6, :scope > div:last-child"),_=J.querySelector(":scope > div.mt-6, :scope > div:last-child")}else z=$.element,_=J;if(!z||!_)return Y;for(let q of Q)if(q.kind==="matched"){let U=X.newMap.get(q.newBlock.element);if(U){if(q.childMatches&&q.childMatches.length>0&&(q.newBlock.type==="table"||q.newBlock.type==="checklist")){if(o0(U,q.childMatches,q.newBlock.type))Y=!0}else if(q.childMatches&&q.childMatches.length>0){if(a0(q.oldBlock,U,q.childMatches,q.newBlock.type))Y=!0}else if(R1(q.oldBlock.element,U,!1))Y=!0}}else if(q.kind==="removed"){Y=!0;let U=i0(q.oldBlock.element),K=F2(Q,q,X.newMap);_.insertBefore(U,K)}else if(q.kind==="added"){Y=!0;let U=X.newMap.get(q.newBlock.element);if(U)U.classList.add("diff-block-added"),U.style.position="relative",q0(U,"Added","var(--color-accent-green)")}if(R1(z,_,!0))Y=!0;return Y}function o0($,J,Q){let Z=Q==="table"?$.querySelector(":scope table > tbody"):$;if(!Z)return!1;let Y=!1;Z.innerHTML="";for(let X of J)if(X.kind==="removed"){Y=!0;let z=X.oldBlock.element.cloneNode(!0);z.classList.add(Q==="table"?"diff-row-removed":"diff-item-removed"),Z.appendChild(z)}else if(X.kind==="added"){Y=!0;let z=X.newBlock.element.cloneNode(!0);z.classList.add(Q==="table"?"diff-row-added":"diff-item-added"),Z.appendChild(z)}else{let z=X.newBlock.element.cloneNode(!0);if(R1(X.oldBlock.element,z,!1))Y=!0;Z.appendChild(z)}return Y}function W2($,J){let Q=new Map,Z=$.element.querySelectorAll("[data-md]"),Y=J.querySelectorAll("[data-md]");return{newMap:{get(X){return T2(J,X)}}}}function T2($,J){let Q=J.getAttribute("data-md");if(!Q)return null;let Z=J.getAttribute("data-md-label"),Y=J.getAttribute("data-md-title"),X=`[data-md="${Q}"]`;if(Y)X+=`[data-md-title="${CSS.escape(Y)}"]`;else if(Z)X+=`[data-md-label="${CSS.escape(Z)}"]`;let z=$.querySelectorAll(X);if(z.length===1)return z[0];let _=(J.textContent||"").slice(0,100),q=null,U=-1;for(let K of z){let G=(K.textContent||"").slice(0,100),W=0;for(let T=0;T<Math.min(_.length,G.length);T++)if(_[T]===G[T])W++;if(W>U)U=W,q=K}return q}function F2($,J,Q){let Z=$.indexOf(J);for(let Y=Z+1;Y<$.length;Y++){let X=$[Y];if((X.kind==="matched"||X.kind==="added")&&X.newBlock)return Q.get(X.newBlock.element)||null}return null}function r0($,J){let Q=J?new Set(Array.from($.querySelectorAll("[data-md]"))):new Set,Z=[],Y=[],X=document.createTreeWalker($,NodeFilter.SHOW_TEXT,{acceptNode(_){let q=_.parentElement;if(!q)return NodeFilter.FILTER_REJECT;if(q.closest("svg, .select-none, [data-no-diff]"))return NodeFilter.FILTER_REJECT;if(J){for(let U of Q)if(U.contains(_))return NodeFilter.FILTER_REJECT}return NodeFilter.FILTER_ACCEPT}}),z;while(z=X.nextNode()){let q=(z.nodeValue||"").match(/\S+|\s+/g);if(!q)continue;let U=0;for(let K of q)Z.push(K),Y.push({text:K,node:z,offset:U}),U+=K.length}return{words:Z,map:Y}}function R1($,J,Q){let Z=r0($,Q),Y=r0(J,Q);if(Z.words.length===0&&Y.words.length===0)return!1;let{oldOps:X,newOps:z}=Z0(Z.words,Y.words),_=X.some((L)=>L.type==="removed"),q=z.some((L)=>L.type==="added");if(!_&&!q)return!1;let U=[],K=[];for(let L of X)if(L.type==="same")U.push(L.index);for(let L of z)if(L.type==="same")K.push(L.index);let G=new Map;for(let L=0;L<U.length&&L<K.length;L++)G.set(U[L],K[L]);let W=[];{let L=[],y=-1;for(let w of X)if(w.type==="same"){if(L.length>0)W.push({text:L.join(""),anchorNewIdx:y>=0?G.get(y)??null:null}),L=[];y=w.index}else if(w.type==="removed")L.push(Z.words[w.index]);if(L.length>0)W.push({text:L.join(""),anchorNewIdx:y>=0?G.get(y)??null:null})}let T=new Map,N=new Map;for(let L of z){if(L.type!=="added")continue;let y=Y.map[L.index];if(!y?.node.parentNode)continue;let w=T.get(y.node);if(!w)w=[],T.set(y.node,w);w.push({start:y.offset,end:y.offset+y.text.length})}for(let L of W)if(L.anchorNewIdx===null){if(Y.map.length>0){let y=Y.map[0].node,w=N.get(y);if(!w)w=[],N.set(y,w);w.push({offset:0,text:L.text})}}else{let y=Y.map[L.anchorNewIdx];if(!y)continue;let w=N.get(y.node);if(!w)w=[],N.set(y.node,w);w.push({offset:y.offset+y.text.length,text:L.text})}let P=new Set([...T.keys(),...N.keys()]);for(let L of P)N2(L,T.get(L)||[],N.get(L)||[]);return!0}function N2($,J,Q){if(!$.parentNode)return;let Z=$.nodeValue||"";J.sort((K,G)=>K.start-G.start);let Y=[];for(let K of J){let G=Y[Y.length-1];if(G&&K.start<=G.end)G.end=Math.max(G.end,K.end);else Y.push({...K})}Q.sort((K,G)=>K.offset-G.offset);let X=$.parentNode,z=document.createDocumentFragment(),_=0,q=0,U=0;while(_<=Z.length){let K=q<Y.length?Y[q].start:1/0,G=U<Q.length?Q[U].offset:1/0,W=Math.min(K,G);if(W===1/0){if(_<Z.length)z.appendChild(document.createTextNode(Z.slice(_)));break}let T=Math.max(W,_);if(T>_)z.appendChild(document.createTextNode(Z.slice(_,T))),_=T;while(U<Q.length&&Q[U].offset<=_){let N=document.createElement("span");N.className="diff-removed",N.textContent=Q[U].text,z.appendChild(N),U++}if(q<Y.length&&Y[q].start<=_){let N=Y[q],P=document.createElement("span");P.className="diff-added",P.textContent=Z.slice(_,N.end),z.appendChild(P),_=N.end,q++;while(U<Q.length&&Q[U].offset<=_){let L=document.createElement("span");L.className="diff-removed",L.textContent=Q[U].text,z.appendChild(L),U++}}}while(U<Q.length){let K=document.createElement("span");K.className="diff-removed",K.textContent=Q[U].text,z.appendChild(K),U++}X.replaceChild(z,$)}function q0($,J,Q){let Z=document.createElement("span");Z.className="diff-block-label",Z.textContent=J,Z.style.color=Q,Z.style.backgroundColor=`color-mix(in srgb, ${Q} 12%, transparent)`,$.appendChild(Z)}import{jsxDEV as k}from"react/jsx-dev-runtime";function s0({initialLeft:$,initialRight:J,sessionId:Q,onExit:Z}){let[Y,X]=a($),[z,_]=a(J),[q,U]=a("unified"),[K,G]=a(!0),[W,T]=a(!1);return k("div",{className:"flex flex-col h-screen",children:[k("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border-subtle bg-bg-surface flex-shrink-0",children:[k("div",{className:"flex items-center gap-3",children:[k("span",{className:"text-[13px] font-body font-medium text-text-primary",children:"Compare"},void 0,!1,void 0,this),k(A1,{value:Y,onChange:X,accent:"red"},void 0,!1,void 0,this),k("span",{className:"text-text-tertiary text-[13px]",children:"→"},void 0,!1,void 0,this),k(A1,{value:z,onChange:_,accent:"green"},void 0,!1,void 0,this),W&&!K&&k("span",{className:"text-[11px] font-body text-text-tertiary bg-bg-elevated px-2 py-0.5 rounded",children:"No changes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k("div",{className:"flex items-center gap-4",children:[k("div",{className:"flex items-center bg-bg-elevated rounded-md p-0.5",children:[k("button",{onClick:()=>U("unified"),className:`text-[11px] font-body px-2.5 py-1 rounded transition-colors ${q==="unified"?"bg-bg-surface text-text-primary font-medium shadow-sm":"text-text-tertiary hover:text-text-secondary"}`,children:"Unified"},void 0,!1,void 0,this),k("button",{onClick:()=>U("side-by-side"),className:`text-[11px] font-body px-2.5 py-1 rounded transition-colors ${q==="side-by-side"?"bg-bg-surface text-text-primary font-medium shadow-sm":"text-text-tertiary hover:text-text-secondary"}`,children:"Side-by-side"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q==="side-by-side"&&k(O2,{},void 0,!1,void 0,this),k("button",{onClick:Z,className:"text-[12px] font-body font-medium text-text-secondary hover:text-text-primary px-3 py-1.5 rounded-md hover:bg-bg-elevated transition-colors",children:"Exit Compare"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q==="unified"?k(M2,{sessionId:Q,leftRev:Y,rightRev:z,onDiffResult:(N,P)=>{T(N),G(P)}},`unified-${Y}-${z}`,!1,void 0,this):k(B2,{sessionId:Q,leftRev:Y,rightRev:z,onDiffResult:(N,P)=>{T(N),G(P)}},`sbs-${Y}-${z}`,!1,void 0,this)]},void 0,!0,void 0,this)}function O2(){let[$,J]=a(!0);return W1(()=>{return document.documentElement.dataset.syncScroll=$?"1":"0",()=>{delete document.documentElement.dataset.syncScroll}},[$]),k("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[k("input",{type:"checkbox",checked:$,onChange:(Q)=>J(Q.target.checked),className:"accent-accent-amber w-3.5 h-3.5"},void 0,!1,void 0,this),k("span",{className:"text-[11px] font-body text-text-secondary",children:"Sync scroll"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function M2({sessionId:$,leftRev:J,rightRev:Q,onDiffResult:Z}){let Y=Z1(null),X=Z1(null),z=Z1(null),[_,q]=a(!1),[U,K]=a(!1),[G,W]=a(!1);return W1(()=>{if(!_||!U||G)return;if(!Y.current||!X.current)return;requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(!Y.current||!X.current||!z.current)return;let T=X0(Y.current),N=X0(X.current),P=z0(T,N),{fragment:L,hasChanges:y}=l0(P);z.current.innerHTML="",z.current.appendChild(L),W(!0),Z(!0,y)})})},[_,U,G]),k("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[k("div",{style:{position:"absolute",left:-9999,visibility:"hidden",pointerEvents:"none",width:720},children:[k(p1,{ref:Y,sessionId:$,revision:J,onReady:()=>q(!0)},void 0,!1,void 0,this),k(p1,{ref:X,sessionId:$,revision:Q,onReady:()=>K(!0)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k("div",{className:"max-w-[720px] mx-auto px-6 pt-8 pb-32",children:[!G&&k("div",{className:"flex items-center justify-center h-64 text-text-tertiary font-body text-body",children:"Loading..."},void 0,!1,void 0,this),k("div",{ref:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function B2({sessionId:$,leftRev:J,rightRev:Q,onDiffResult:Z}){let Y=Z1(null),X=Z1(null),[z,_]=a(!1),[q,U]=a(!1),[K,G]=a(!1),W=Z1(null),T=Z1(null),N=Z1(!1);return W1(()=>{if(!z||!q||K)return;if(!Y.current||!X.current)return;requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(!Y.current||!X.current)return;let P=d0(Y.current,X.current);G(!0),Z(!0,P)})})},[z,q,K]),W1(()=>{let P=W.current,L=T.current;if(!P||!L)return;let y=(b,v)=>{if(document.documentElement.dataset.syncScroll==="0")return;if(N.current)return;N.current=!0;let D=b.scrollHeight-b.clientHeight,j=v.scrollHeight-v.clientHeight;if(D>0&&j>0)v.scrollTop=b.scrollTop/D*j;requestAnimationFrame(()=>{N.current=!1})},w=()=>y(P,L),O=()=>y(L,P);return P.addEventListener("scroll",w),L.addEventListener("scroll",O),()=>{P.removeEventListener("scroll",w),L.removeEventListener("scroll",O)}},[]),k("div",{className:"flex flex-1 min-h-0",children:[k("div",{ref:W,className:"w-1/2 overflow-y-auto border-r border-border-subtle",children:k("div",{className:"max-w-[720px] mx-auto px-6 pt-8 pb-32",children:k(p1,{ref:Y,sessionId:$,revision:J,onReady:()=>_(!0)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),k("div",{ref:T,className:"w-1/2 overflow-y-auto",children:k("div",{className:"max-w-[720px] mx-auto px-6 pt-8 pb-32",children:k(p1,{ref:X,sessionId:$,revision:Q,onReady:()=>U(!0)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var p1=L2.forwardRef(({sessionId:$,revision:J,onReady:Q},Z)=>{let[Y,X]=a(null),[z,_]=a(null),[q,U]=a(!0);if(W1(()=>{U(!0),_(null),import(`/api/session/${$}/plan.js?rev=${J}&t=${Date.now()}`).then((K)=>{X(()=>K.default),U(!1)}).catch((K)=>{_(K.message),U(!1)})},[$,J]),W1(()=>{if(!Y)return;requestAnimationFrame(()=>{requestAnimationFrame(()=>{Q()})})},[Y]),q)return k("div",{className:"flex items-center justify-center h-64 text-text-tertiary font-body text-body",children:"Loading..."},void 0,!1,void 0,this);if(z)return k("div",{className:"bg-accent-red-muted rounded-lg p-5",children:[k("h3",{className:"font-body font-semibold text-accent-red mb-2",children:"Error"},void 0,!1,void 0,this),k("pre",{className:"text-code font-mono text-text-secondary whitespace-pre-wrap",children:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(!Y)return k("div",{className:"text-text-tertiary text-center py-8 font-body text-body",children:"No plan loaded"},void 0,!1,void 0,this);return k("div",{ref:Z,children:k(Y,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)});import{jsxDEV as F,Fragment as _0}from"react/jsx-dev-runtime";var G1=n0({activeView:{type:"plan"},setActiveView:()=>{},openFiles:[],closeFile:()=>{}}),H1=n0({currentRevision:1,selectedRevision:1,revisions:[],setSelectedRevision:()=>{},isReadOnly:!1,compareRevision:null,setCompareRevision:()=>{}});function $5(){let[$,J]=o(()=>localStorage.getItem("canvas-theme")||document.documentElement.dataset.theme||"dark");return F("button",{onClick:()=>{let Z=$==="dark"?"light":"dark";document.documentElement.dataset.theme=Z,localStorage.setItem("canvas-theme",Z),J(Z)},className:"w-7 h-7 flex items-center justify-center rounded-md text-text-tertiary hover:text-text-secondary hover:bg-bg-elevated transition-colors",title:$==="dark"?"Switch to light theme":"Switch to dark theme",children:$==="dark"?F("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[F("circle",{cx:"12",cy:"12",r:"5"},void 0,!1,void 0,this),F("line",{x1:"12",y1:"1",x2:"12",y2:"3"},void 0,!1,void 0,this),F("line",{x1:"12",y1:"21",x2:"12",y2:"23"},void 0,!1,void 0,this),F("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"},void 0,!1,void 0,this),F("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"},void 0,!1,void 0,this),F("line",{x1:"1",y1:"12",x2:"3",y2:"12"},void 0,!1,void 0,this),F("line",{x1:"21",y1:"12",x2:"23",y2:"12"},void 0,!1,void 0,this),F("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"},void 0,!1,void 0,this),F("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):F("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:F("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function J5(){let{currentRevision:$,selectedRevision:J,revisions:Q,setSelectedRevision:Z,setCompareRevision:Y}=U1.useContext(H1);if(Q.length<=1){let _=Q[0]?.label||`Round ${$}`;return F("span",{className:"text-[11px] text-text-tertiary font-body",children:_},void 0,!1,void 0,this)}return F("div",{className:"flex items-center gap-1.5",children:[F(A1,{value:J,onChange:Z,accent:J===$?"default":"amber"},void 0,!1,void 0,this),F("button",{onClick:()=>{let _=Q.find((U)=>U.revision===J)?.sourceFile,q;if(J===$)q=[...Q].reverse().find((K)=>K.revision<$&&(!_||K.sourceFile===_))?.revision??Math.max(1,$-1);else q=J;Y({left:q,right:$})},className:"text-[11px] font-body font-medium px-2 py-0.5 rounded-md text-accent-blue hover:bg-accent-blue-muted transition-colors",children:"Compare"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function A2(){let $=window.location.pathname.replace("/s/","")||"",[J,Q]=o(1),[Z,Y]=o(1),[X,z]=o([]),[_,q]=o(null),[U,K]=o(!1),[G,W]=o(!1),[T,N]=o({type:"plan"}),[P,L]=o([]),y=T1(null),[w,O]=o(!1),[b,v]=o(!1),[D,j]=o(!1);c1(()=>{let I=["Agent Canvas"];if($)I.push($);if(T.type==="file")I.push(T.path.split("/").pop()||T.path);else if(_)I.push("Compare");document.title=I.join(" — ")},[$,T,_]);let A=T1(new Map),C=X.find((I)=>I.revision===Z),H=Z!==J||!!C?.hasFeedback,M=d1((I)=>{if(A.current.set(T.type==="plan"?"plan":`file:${T.path}`,window.scrollY),N(I),I.type==="file")L((l)=>l.includes(I.path)?l:[...l,I.path])},[T]),h=d1((I)=>{A.current.delete(`file:${I}`),L((l)=>l.filter((R)=>R!==I)),N((l)=>{if(l.type==="file"&&l.path===I)return A.current.set(`file:${I}`,window.scrollY),{type:"plan"};return l})},[]);y2(()=>{let I=T.type==="plan"?"plan":`file:${T.path}`;window.scrollTo(0,A.current.get(I)||0)},[T]),c1(()=>{if(!$)return;fetch(`/api/session/${$}/meta`).then((I)=>I.json()).then((I)=>{if(I.currentRevision)Q(I.currentRevision),Y(I.currentRevision),z(I.revisions||[])}).catch(()=>{})},[$]),c1(()=>{if(!$)return;let I=null,l=()=>{let R=window.location.protocol==="https:"?"wss:":"ws:",B=new WebSocket(`${R}//${window.location.host}/ws/session/${$}`);y.current=B,B.onopen=()=>K(!0),B.onclose=()=>{K(!1),I=setTimeout(l,2000)},B.onmessage=(S)=>{try{let m=JSON.parse(S.data);if(m.type==="plan-updated"){if(Q(m.currentRevision),Y(m.currentRevision),q(null),m.revisions)z(m.revisions)}if(m.type==="revision-updated"){if(m.revisions)z(m.revisions)}}catch{}}};return l(),()=>{if(I)clearTimeout(I);y.current?.close()}},[$]);let c=d1((I)=>{if(y.current?.readyState===WebSocket.OPEN)y.current.send(JSON.stringify({type:"submit",feedback:I})),W(!1)},[]);if(!$)return F("div",{className:"flex items-center justify-center h-screen text-text-tertiary font-body",children:"No session selected."},void 0,!1,void 0,this);return F(e0.Provider,{value:$,children:F(H1.Provider,{value:{currentRevision:J,selectedRevision:Z,revisions:X,setSelectedRevision:Y,isReadOnly:H,compareRevision:_,setCompareRevision:q},children:F(G0,{sessionId:$,revision:Z,isReadOnly:H,children:F(G1.Provider,{value:{activeView:T,setActiveView:M,openFiles:P,closeFile:h},children:F(S2.Provider,{value:{setActiveView:M},children:F("div",{className:"min-h-screen bg-bg-base",children:[F(w2,{sessionId:$,connected:U,onMobileSidebar:()=>O(!w),collapsed:b,onToggle:()=>v((I)=>!I)},void 0,!1,void 0,this),_===null&&F(R2,{collapsed:D,onToggle:()=>j((I)=>!I),children:F(J0,{onPreview:()=>W(!0),onSubmit:c},void 0,!1,void 0,this)},void 0,!1,void 0,this),_!==null?F("div",{className:`${b?"lg:ml-0":"lg:ml-60"} transition-[margin] duration-200`,children:F(s0,{initialLeft:_.left,initialRight:_.right,sessionId:$,onExit:()=>q(null)},void 0,!1,void 0,this)},void 0,!1,void 0,this):F("div",{className:`relative ${b?"lg:ml-0":"lg:ml-60"} ${D?"lg:mr-0":"lg:mr-[var(--sidebar-width,320px)]"} transition-[margin] duration-200`,id:"plan-scroll-container",children:[F("div",{className:"lg:hidden sticky top-0 z-20 flex items-center justify-between px-4 py-2 border-b border-border-subtle bg-bg-surface",children:[F("div",{className:"flex items-center gap-2",children:[F(Y0,{currentSessionId:$},void 0,!1,void 0,this),F("span",{className:`w-1.5 h-1.5 rounded-full ${U?"bg-accent-green":"bg-accent-red"}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F("div",{className:"flex items-center gap-1",children:[F(J5,{},void 0,!1,void 0,this),F("button",{onClick:()=>O(!w),className:"w-7 h-7 flex items-center justify-center rounded-md text-text-tertiary hover:text-text-secondary hover:bg-bg-elevated transition-colors",title:"Annotations",children:F("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:F("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),F($5,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),F(C2,{},void 0,!1,void 0,this),F("div",{style:{display:T.type==="plan"?void 0:"none"},children:F("div",{className:"relative max-w-[720px] mx-auto px-6 pt-12 pb-32",children:[F("button",{onClick:()=>{let I=document.querySelector(".plan-content");if(!I)return;let l=v0(I);navigator.clipboard.writeText(l).then(()=>{let R=document.getElementById("export-md-btn");if(R)R.setAttribute("data-copied","true"),setTimeout(()=>{R.removeAttribute("data-copied")},1500)})},id:"export-md-btn",className:"group absolute top-3 right-6 p-1.5 text-text-tertiary hover:text-text-secondary transition-colors z-10",title:"Copy as Markdown",children:[F("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"group-[[data-copied=true]]:hidden",children:[F("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"},void 0,!1,void 0,this),F("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"hidden group-[[data-copied=true]]:block text-green-500",children:F("polyline",{points:"20 6 9 17 4 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F(P0,{revision:Z},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),P.map((I)=>F("div",{style:{display:T.type==="file"&&T.path===I?void 0:"none"},children:F(f0,{path:I},void 0,!1,void 0,this)},I,!1,void 0,this))]},void 0,!0,void 0,this),w&&F("div",{className:"lg:hidden fixed inset-0 z-40 flex",children:[F("div",{className:"flex-1",onClick:()=>O(!1)},void 0,!1,void 0,this),F("div",{className:"w-80 max-w-[85vw] bg-bg-surface border-l border-border-subtle flex flex-col shadow-lg",children:[F("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border-subtle flex-shrink-0",children:[F("span",{className:"text-[11px] font-medium uppercase tracking-widest text-text-tertiary font-body",children:"Sidebar"},void 0,!1,void 0,this),F("button",{onClick:()=>O(!1),className:"text-text-tertiary hover:text-text-secondary w-7 h-7 flex items-center justify-center",children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F("div",{className:"flex-1 overflow-hidden",children:F(J0,{onPreview:()=>W(!0),onSubmit:c},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),F(C0,{open:G,onClose:()=>W(!1),onSubmit:c},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},`${$}:${Z}`,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function w2({sessionId:$,connected:J,onMobileSidebar:Q,collapsed:Z,onToggle:Y}){return F(_0,{children:[Z&&F("button",{onClick:Y,className:"hidden lg:flex fixed top-3 left-3 z-20 w-7 h-7 items-center justify-center rounded-md text-text-tertiary hover:text-text-secondary hover:bg-bg-elevated transition-colors bg-bg-surface border border-border-subtle",title:"Show sidebar",children:F("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[F("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"},void 0,!1,void 0,this),F("line",{x1:"9",y1:"3",x2:"9",y2:"21"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),F("div",{className:`hidden lg:flex w-60 flex-col fixed top-0 left-0 bottom-0 bg-bg-surface border-r border-border-subtle z-10 transition-transform duration-200 ${Z?"-translate-x-full":""}`,children:[F("div",{className:"px-4 pt-4 pb-3 flex-shrink-0 border-b border-border-subtle",children:[F("div",{className:"flex items-center gap-2 mb-2",children:[F("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",className:"text-text-tertiary flex-shrink-0",children:F("path",{d:"M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this),F(Y0,{currentSessionId:$},void 0,!1,void 0,this),F("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${J?"bg-accent-green":"bg-accent-red"}`},void 0,!1,void 0,this),F("button",{onClick:Y,className:"ml-auto w-6 h-6 flex items-center justify-center rounded text-text-tertiary hover:text-text-secondary hover:bg-bg-elevated transition-colors",title:"Hide sidebar",children:F("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[F("polyline",{points:"11 17 6 12 11 7"},void 0,!1,void 0,this),F("polyline",{points:"18 17 13 12 18 7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F(J5,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F("div",{className:"flex-1 flex flex-col overflow-hidden",children:F(g0,{embedded:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),F("div",{className:"px-4 py-3 border-t border-border-subtle flex items-center justify-between flex-shrink-0",children:[F("span",{className:"text-[10px] text-text-tertiary font-body uppercase tracking-widest",children:"Theme"},void 0,!1,void 0,this),F($5,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function R2({children:$,collapsed:J,onToggle:Q}){let[Z,Y]=o(()=>{let K=localStorage.getItem("canvas-sidebar-width");return K?parseInt(K,10):320}),X=T1(!1),z=T1(0),_=T1(0),q=T1(Z);q.current=Z;let U=d1((K)=>{K.preventDefault(),X.current=!0,z.current=K.clientX,_.current=q.current;let G=(T)=>{if(!X.current)return;let N=z.current-T.clientX,P=Math.max(240,Math.min(600,_.current+N));Y(P),q.current=P},W=()=>{X.current=!1,localStorage.setItem("canvas-sidebar-width",String(q.current)),document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",W),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",G),document.addEventListener("mouseup",W),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[]);return c1(()=>{return document.documentElement.style.setProperty("--sidebar-width",`${Z}px`),()=>{document.documentElement.style.removeProperty("--sidebar-width")}},[Z]),F(_0,{children:[J&&F("button",{onClick:Q,className:"hidden lg:flex fixed top-3 right-3 z-20 w-7 h-7 items-center justify-center rounded-md text-text-tertiary hover:text-text-secondary hover:bg-bg-elevated transition-colors bg-bg-surface border border-border-subtle",title:"Show annotations",children:F("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:F("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),F("div",{className:`hidden lg:flex flex-col fixed top-0 right-0 bottom-0 bg-bg-surface border-l border-border-subtle z-10 transition-transform duration-200 ${J?"translate-x-full":""}`,style:{width:Z},children:[F("div",{onMouseDown:U,className:"absolute left-0 top-0 bottom-0 w-1 cursor-col-resize hover:bg-accent-blue/30 transition-colors z-20",style:{marginLeft:"-2px"}},void 0,!1,void 0,this),U1.Children.map($,(K)=>U1.isValidElement(K)?U1.cloneElement(K,{collapseButton:F("button",{onClick:Q,className:"w-6 h-6 flex items-center justify-center rounded text-text-tertiary hover:text-text-secondary hover:bg-bg-elevated transition-colors",title:"Hide annotations",children:F("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[F("polyline",{points:"13 17 18 12 13 7"},void 0,!1,void 0,this),F("polyline",{points:"6 17 11 12 6 7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}):K)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function C2(){let{activeView:$,setActiveView:J,openFiles:Q,closeFile:Z}=U1.useContext(G1),Y=U1.useContext(e0),{addAnnotationWithId:X,setActiveAnnotationId:z}=t(),_=Q.length>0;if(!_)return null;return F("div",{className:"flex items-center border-b border-border-medium bg-bg-surface overflow-x-auto sticky top-0 z-10",children:[_&&F("button",{onClick:()=>J({type:"plan"}),className:`flex items-center gap-1.5 px-4 py-2.5 text-[13px] font-body whitespace-nowrap transition-colors relative ${$.type==="plan"?"text-text-primary":"text-text-tertiary hover:text-text-secondary"}`,children:[F("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",className:"opacity-60",children:F("path",{d:"M12 2L2 7l10 5 10-5-10-5z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this),"Plan",$.type==="plan"&&F("span",{className:"absolute bottom-0 left-3 right-3 h-[2px] bg-text-primary rounded-full"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_&&F(_0,{children:[F("span",{className:"w-px h-4 bg-border-medium flex-shrink-0"},void 0,!1,void 0,this),Q.map((q,U)=>{let K=q.split("/").pop()||q,G=$.type==="file"&&$.path===q;return F(U1.Fragment,{children:[F("div",{className:"flex items-center",children:[F("button",{onClick:()=>J({type:"file",path:q}),className:`flex items-center gap-1.5 pl-3 pr-1 py-2.5 text-[13px] font-mono whitespace-nowrap transition-colors relative ${G?"text-text-primary":"text-text-tertiary hover:text-text-secondary"}`,children:[K,G&&F("span",{className:"absolute bottom-0 left-3 right-1 h-[2px] bg-text-primary rounded-full"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F("button",{onClick:(W)=>{W.stopPropagation(),Z(q)},className:"text-text-tertiary hover:text-text-secondary px-1.5 py-1 text-[10px] transition-colors rounded hover:bg-bg-input",children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U<Q.length-1&&F("span",{className:"w-px h-4 bg-border-medium flex-shrink-0"},void 0,!1,void 0,this)]},q,!0,void 0,this)})]},void 0,!0,void 0,this),F("div",{className:"ml-auto flex items-center gap-1 flex-shrink-0",children:$.type==="file"&&F("button",{onClick:async()=>{let q=$.path;try{let K=await(await fetch(`/api/file?session=${Y}&path=${encodeURIComponent(q)}`)).json();if(!K.error){let G=K.content.split(`
65
+ `).slice(0,3).join(`
66
+ `)+(K.content.split(`
67
+ `).length>3?`
68
+ ...`:""),W=`ann-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;X(W,G,"",q),z(W)}}catch{}},className:"flex items-center gap-1 px-3 py-1.5 text-[11px] font-medium font-body text-text-tertiary hover:text-text-secondary whitespace-nowrap transition-colors",children:[F("span",{className:"text-[13px] leading-none",children:"+"},void 0,!1,void 0,this),"Add to context"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var t0=document.getElementById("root");if(t0)P2(t0).render(F(A2,{},void 0,!1,void 0,this));export{H1 as RevisionContext,G1 as ActiveViewContext};
@@ -0,0 +1,5 @@
1
+ import{useState as Zy}from"react";import{jsxDEV as I}from"react/jsx-dev-runtime";function Ky({title:y,children:$}){let[b,m]=Zy(!1);return I("div",{className:"relative mb-8 p-4 group/section","data-md":"section","data-md-title":y,children:[I("div",{className:"relative mb-2",children:[I("button",{onClick:()=>m(!b),className:`absolute -left-8 top-1/2 -translate-y-1/2 text-text-tertiary opacity-0 group-hover/section:opacity-50 hover:!opacity-100 transition-all duration-150 p-0.5 ${b?"-rotate-90":""}`,children:I("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",children:I("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),I("h2",{className:"font-heading text-section text-text-primary",style:{fontWeight:400},children:y},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I("div",{className:b?"mt-6 hidden":"mt-6",children:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as C}from"react/jsx-dev-runtime";var Ly={todo:"bg-border-hover",done:"bg-accent-green",blocked:"bg-accent-red","in-progress":"bg-accent-blue"},Xy={todo:"Todo",done:"Done",blocked:"Blocked","in-progress":"In progress"},zy={info:"bg-accent-blue-muted text-accent-blue",success:"bg-accent-green-muted text-accent-green",warning:"bg-accent-amber-muted text-accent-amber",danger:"bg-accent-red-muted text-accent-red",neutral:"bg-border-subtle text-text-tertiary"};function t({id:y,label:$,status:b,badge:m,badgeVariant:f="neutral",children:g}){return C("div",{className:"group/task relative -mx-4 px-4 py-3 rounded-md transition-colors duration-150 hover:bg-bg-input","data-task-id":y,"data-md":"item","data-md-label":$,...b?{"data-md-status":b}:{},...m?{"data-md-badge":m}:{},children:C("div",{className:"flex items-start gap-3",children:[b&&C("span",{className:`w-2 h-2 rounded-full mt-[7px] flex-shrink-0 ${Ly[b]}`},void 0,!1,void 0,this),C("div",{className:"flex-1 min-w-0",children:[C("div",{className:"flex items-baseline gap-2",children:[C("span",{className:"font-body text-task-label font-semibold text-text-primary",children:$},void 0,!1,void 0,this),b&&C("span",{className:"font-body text-tiny uppercase tracking-wider text-text-tertiary opacity-0 group-hover/task:opacity-100 transition-opacity duration-150",children:Xy[b]},void 0,!1,void 0,this),m&&C("span",{className:`font-body text-tiny font-medium px-1.5 py-px rounded-full ${zy[f]}`,children:m},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g&&C("div",{className:"text-body text-text-secondary mt-1 leading-relaxed",children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function Hy(y){return C(t,{...y},void 0,!1,void 0,this)}import{useEffect as Oy,useRef as Fy}from"react";import{jsxDEV as x}from"react/jsx-dev-runtime";function Ty({language:y,children:$}){let b=typeof $==="string"?$:String($??""),m=Fy(null);return Oy(()=>{let f=m.current,g=window.hljs;if(!f||!g)return;f.removeAttribute("data-highlighted"),f.className=y?`language-${y}`:"",f.textContent=b,g.highlightElement(f)},[b,y]),x("div",{className:"relative mt-3 group/code","data-md":"codeblock","data-md-language":y||"",children:[y&&x("span",{className:"absolute top-2 right-3 text-tiny text-text-tertiary opacity-0 group-hover/code:opacity-60 transition-opacity duration-150 z-10 font-mono",children:y},void 0,!1,void 0,this),x("pre",{className:"bg-bg-code rounded-md p-4 overflow-x-auto text-code font-mono leading-relaxed",children:x("code",{ref:m,className:y?`language-${y}`:"",children:b},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as V}from"react/jsx-dev-runtime";var Uy={info:{bg:"bg-accent-blue-muted",icon:"i",iconColor:"text-accent-blue"},warning:{bg:"bg-accent-amber-muted",icon:"!",iconColor:"text-accent-amber"},danger:{bg:"bg-accent-red-muted",icon:"✕",iconColor:"text-accent-red"},tip:{bg:"bg-accent-green-muted",icon:"✓",iconColor:"text-accent-green"}};function Gy({type:y="info",children:$}){let b=Uy[y];return V("div",{className:`${b.bg} relative rounded-lg px-5 py-4 mt-3 flex gap-3 items-start`,"data-md":"callout","data-md-type":y,children:[V("span",{className:`${b.iconColor} opacity-70 text-base leading-relaxed flex-shrink-0 mt-px`,children:b.icon},void 0,!1,void 0,this),V("div",{className:"text-body text-text-secondary leading-relaxed",children:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as vy}from"react/jsx-dev-runtime";function qy({children:y}){return vy("div",{className:"relative bg-bg-elevated rounded-lg px-5 py-4 mt-3 text-body text-text-secondary italic leading-relaxed","data-md":"note",children:y},void 0,!1,void 0,this)}import{jsxDEV as r}from"react/jsx-dev-runtime";function _y({headers:y,rows:$}){return r("div",{className:"overflow-x-auto mt-3","data-md":"table",children:r("table",{className:"w-full text-body",children:[r("thead",{children:r("tr",{className:"border-b border-border-subtle",children:y.map((b,m)=>r("th",{className:"text-left px-4 py-2.5 text-meta font-medium uppercase tracking-wider text-text-tertiary font-body",children:b},m,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),r("tbody",{children:$.map((b,m)=>r("tr",{className:`relative border-b border-border-subtle last:border-b-0 transition-colors hover:bg-bg-surface/50 ${m%2===1?"bg-bg-surface/30":""}`,children:b.map((f,g)=>r("td",{className:"px-4 py-2.5 text-text-secondary font-body",children:f},g,!1,void 0,this))},m,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as c}from"react/jsx-dev-runtime";function wy({items:y}){return c("ul",{className:"space-y-1 mt-3","data-md":"checklist",children:y.map(($,b)=>c("li",{"data-md":"checklist-item","data-md-label":$.label,className:"relative flex items-start gap-2.5 py-1",children:[c("span",{className:`w-4 h-4 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5 transition-all ${$.checked?"bg-accent-green":"border-[1.5px] border-border-hover"}`,children:$.checked&&c("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:c("path",{d:"M2.5 5L4.5 7L7.5 3",style:{stroke:"var(--color-text-inverse)"},strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),c("span",{className:`text-body font-body ${$.checked?"text-text-tertiary line-through decoration-border-hover":"text-text-secondary"}`,children:$.label},void 0,!1,void 0,this)]},b,!0,void 0,this))},void 0,!1,void 0,this)}import{jsxDEV as ry}from"react/jsx-dev-runtime";var Ay={high:"text-accent-red bg-accent-red-muted",medium:"text-accent-amber bg-accent-amber-muted",low:"text-text-tertiary bg-border-subtle"};function Cy({level:y}){return ry("span",{className:`inline text-tiny font-medium font-body ml-2 px-1.5 py-0.5 rounded ${Ay[y]}`,"data-md":"priority","data-md-level":y,children:y},void 0,!1,void 0,this)}import{useEffect as n,useState as D,useContext as s,useRef as hy}from"react";import{SessionContext as Iy,ActiveViewCtx as Ry}from"#canvas/runtime";import{jsxDEV as h}from"react/jsx-dev-runtime";var Sy={ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",py:"python",rs:"rust",go:"go",rb:"ruby",java:"java",json:"json",yaml:"yaml",yml:"yaml",md:"markdown",css:"css",html:"html",sh:"bash",bash:"bash",toml:"toml",sql:"sql",xml:"xml",c:"c",cpp:"cpp",h:"c"};function cy({path:y,lines:$,__content:b}){let m=s(Iy),{setActiveView:f}=s(Ry),[g,B]=D(b??null),[k,W]=D(()=>{let M=y.split(".").pop()||"";return Sy[M]||"text"}),[N,P]=D(null),[L,F]=D(!b),O=hy(null);if(n(()=>{if(b!==void 0)return;F(!0),P(null),fetch(`/api/file?session=${m}&path=${encodeURIComponent(y)}`).then((M)=>M.json()).then((M)=>{if(M.error)P(M.error);else{let Y=M.content;if($)Y=Y.split(`
2
+ `).slice($[0]-1,$[1]).join(`
3
+ `);B(Y),W(M.language||"text")}}).catch(()=>P("Failed to fetch file")).finally(()=>F(!1))},[m,y,$?.[0],$?.[1],b]),n(()=>{let M=O.current,Y=window.hljs;if(!M||!Y||!g)return;M.removeAttribute("data-highlighted"),M.className=k?`language-${k}`:"",M.textContent=g,Y.highlightElement(M)},[g,k]),L)return h("div",{className:"text-text-tertiary text-body mt-3 bg-bg-code rounded-md p-4",children:["Loading ",y,"..."]},void 0,!0,void 0,this);if(N)return h("div",{className:"text-accent-red text-body mt-3 bg-accent-red-muted rounded-md p-4",children:[y,": ",N]},void 0,!0,void 0,this);return h("div",{className:"mt-3 bg-bg-code rounded-md overflow-hidden","data-md":"filepreview","data-md-path":y,...$?{"data-md-lines":`${$[0]}-${$[1]}`}:{},children:[h("div",{className:"px-4 py-2 flex items-center justify-between",children:[h("button",{className:"font-mono text-meta text-text-tertiary hover:text-text-secondary hover:underline cursor-pointer text-left",onClick:()=>f({type:"file",path:y}),title:`Open ${y}`,children:y},void 0,!1,void 0,this),$&&h("span",{className:"font-mono text-meta text-text-tertiary opacity-60",children:["L",$[0],"–",$[1]]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),h("pre",{className:"px-4 pb-3 overflow-x-auto text-code font-mono !bg-transparent",style:{background:"transparent"},children:h("code",{ref:O,className:k?`language-${k}`:"",children:g},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useEffect as gy,useRef as l,useState as $y,useCallback as py}from"react";import{useAnnotations as dy}from"#canvas/runtime";import{useEffect as a,useRef as o,useState as E,useCallback as yy,useMemo as my}from"react";import{createPortal as uy}from"react-dom";function e(y,$){let f=$||document.body,g=y.getBoundingClientRect(),B=f.getBoundingClientRect(),k=f===document.body?window.scrollY:f.scrollTop,W=g.bottom-B.top+k+8,N=Math.max(0,Math.min(g.left-B.left,B.width-280-12));return f.style.position="relative",{style:{position:"absolute",top:`${W}px`,left:`${N}px`},parent:f}}import{jsxDEV as v}from"react/jsx-dev-runtime";function iy({anchorEl:y,scrollContainer:$,onClose:b,ignoreSelector:m,zIndex:f="50",padding:g="12px",width:B="280px",children:k}){let W=o(null),N=o(b);N.current=b;let{style:P,parent:L}=e(y,$);return a(()=>{let F=setTimeout(()=>{let O=(M)=>{if(W.current&&!W.current.contains(M.target)){if(m&&M.target.closest?.(m))return;N.current(),document.removeEventListener("mousedown",O)}};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},0);return()=>clearTimeout(F)},[m]),uy(v("div",{ref:W,style:{...P,zIndex:f,width:B,background:"var(--color-bg-elevated)",border:"1px solid var(--color-border-hover)",borderRadius:"8px",boxShadow:"0 4px 12px var(--color-shadow)",padding:g,fontFamily:"'Inter', sans-serif"},children:k},void 0,!1,void 0,this),L)}var by=[{label:"Clarity",items:["Unclear","Why?","Needs example","Missing context"]},{label:"Scope",items:["Overkill","Out of scope","Important","Risky"]},{label:"Action",items:["Simplify","Rethink","Expand on this","Skip this"]}],fy=by.flatMap((y)=>y.items);function ky({anchorEl:y,scrollContainer:$,snippet:b,truncateAt:m=100,header:f,onAdd:g,onCancel:B}){let[k,W]=E(""),[N,P]=E(null),[L,F]=E(!1),O=o(null);a(()=>{O.current?.focus()},[]);let M=yy(()=>{if(k.trim())g(k.trim());else B()},[k,g,B]),Y=k.trim().length>0?fy.filter((J)=>J.toLowerCase().startsWith(k.trim().toLowerCase())):fy,Q=L?[]:Y.length===1&&Y[0].toLowerCase()===k.trim().toLowerCase()?[]:Y,G=new Set(Q),z=by.map((J)=>({label:J.label,items:J.items.filter((Z)=>G.has(Z))})).filter((J)=>J.items.length>0),X=z.map((J)=>J.items),T=X.flat(),_=my(()=>{if(N===null)return 0;let J=0;for(let Z=0;Z<X.length;Z++){if(N<J+X[Z].length)return Z;J+=X[Z].length}return 0},[N,X]),U=my(()=>{if(N===null)return 0;let J=0;for(let Z=0;Z<_;Z++)J+=X[Z].length;return N-J},[N,_,X]),q=(J,Z)=>{let A=0;for(let S=0;S<J;S++)A+=X[S].length;return A+Z};a(()=>{P(null),F(!1)},[k]);let w=yy((J)=>{W(J)},[]),d=b.length>m?b.slice(0,m)+"...":b;return v(iy,{anchorEl:y,scrollContainer:$,onClose:B,width:"420px",children:[f??v("div",{style:{fontSize:"11px",color:"var(--color-text-tertiary)",fontStyle:"italic",marginBottom:"8px",lineHeight:"1.4",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:["“",d,"”"]},void 0,!0,void 0,this),v("textarea",{ref:O,value:k,onChange:(J)=>W(J.target.value),onKeyDown:(J)=>{if(T.length>0&&(J.key==="ArrowDown"||J.key==="ArrowUp"||J.key==="ArrowLeft"||J.key==="ArrowRight")){if(J.preventDefault(),N===null){P(0);return}if(J.key==="ArrowDown"){let Z=Math.min(U+1,X[_].length-1);P(q(_,Z))}else if(J.key==="ArrowUp"){let Z=Math.max(U-1,0);P(q(_,Z))}else if(J.key==="ArrowRight"){let Z=Math.min(_+1,X.length-1),A=Math.min(U,X[Z].length-1);P(q(Z,A))}else if(J.key==="ArrowLeft"){let Z=Math.max(_-1,0),A=Math.min(U,X[Z].length-1);P(q(Z,A))}return}if(N!==null&&T.length>0){if(J.key==="Tab"){J.preventDefault(),w(T[N]);return}if(J.key==="Enter"&&!J.shiftKey){J.preventDefault(),g(T[N]);return}}if(J.key==="Enter"&&!J.shiftKey){J.preventDefault(),M();return}if(J.key==="Escape")if(T.length>0&&!L)F(!0);else B()},style:{width:"100%",minHeight:"60px",background:"transparent",border:"none",color:"var(--color-text-primary)",fontFamily:"'Inter', sans-serif",fontSize:"13px",lineHeight:"1.5",resize:"vertical",outline:"none"},placeholder:"Add your note..."},void 0,!1,void 0,this),v("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"8px"},children:[v("button",{onClick:B,style:{fontSize:"11px",color:"var(--color-text-tertiary)",background:"none",border:"none",cursor:"pointer",padding:"4px 12px",fontFamily:"'Inter', sans-serif"},children:"Cancel"},void 0,!1,void 0,this),v("button",{onClick:M,style:{fontSize:"11px",fontWeight:500,padding:"4px 12px",borderRadius:"6px",background:"var(--color-highlight-bg)",color:"var(--color-text-primary)",border:"1px solid var(--color-highlight-border)",cursor:"pointer",fontFamily:"'Inter', sans-serif"},children:"Add"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.length>0&&v("div",{style:{marginTop:"6px",borderTop:"1px solid var(--color-border-subtle)",paddingTop:"8px",display:"flex",gap:"4px"},children:z.map((J)=>v("div",{style:{flex:1},children:[v("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--color-text-disabled)",textTransform:"uppercase",letterSpacing:"0.05em",padding:"2px 6px",marginBottom:"2px",fontFamily:"'Inter', sans-serif"},children:J.label},void 0,!1,void 0,this),J.items.map((Z)=>{let A=T.indexOf(Z);return v("div",{onMouseDown:(S)=>{S.preventDefault(),S.stopPropagation(),w(Z)},onMouseEnter:()=>P(A),style:{padding:"3px 6px",fontSize:"12px",borderRadius:"4px",fontFamily:"'Inter', sans-serif",color:A===N?"var(--color-text-primary)":"var(--color-text-secondary)",background:A===N?"var(--color-highlight-selected)":"transparent",cursor:"pointer"},children:[v("span",{style:{fontWeight:500},children:Z.slice(0,k.trim().length)},void 0,!1,void 0,this),Z.slice(k.trim().length)]},Z,!0,void 0,this)})]},J.label,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as R,Fragment as jy}from"react/jsx-dev-runtime";function xy({children:y}){let $=l(null),[b,m]=$y(null),f=typeof y==="string"?y:String(y??""),{annotations:g,addAnnotationWithId:B,activeAnnotationId:k,setActiveAnnotationId:W}=dy(),[N,P]=$y(null),L=l(g);L.current=g;let F=py((Y,Q,G)=>{let z=`[Diagram ${G.toLowerCase()}] ${Q}`,X=L.current.find((T)=>T.snippet===z);if(X)W(X.id);else P({anchorEl:Y,snippet:Q,prefix:G})},[W]),O=l(F);if(O.current=F,gy(()=>{let Y=!1,Q=async()=>{try{let z=window.mermaid;if(!z){m("Mermaid library not loaded");return}let X=document.documentElement.dataset.theme==="light"?"default":"dark";z.initialize({startOnLoad:!1,theme:X});let T=`mermaid-${Math.random().toString(36).slice(2)}`,{svg:_}=await z.render(T,f.trim());if(!Y&&$.current)$.current.innerHTML=_,Dy($.current,(U,q,w)=>O.current(U,q,w)),By($.current,L.current);m(null)}catch(z){if(!Y)m(z.message||"Invalid diagram")}};Q();let G=new MutationObserver((z)=>{for(let X of z)if(X.attributeName==="data-theme")Q()});return G.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>{Y=!0,G.disconnect()}},[f]),gy(()=>{if($.current)By($.current,g,k)},[g,k]),b)return R("div",{className:"bg-accent-red-muted rounded-md p-4 mt-3 text-body text-accent-red",children:["Mermaid error: ",b,R("pre",{className:"mt-2 text-tiny text-text-tertiary whitespace-pre-wrap",children:f},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let M=$.current?.closest("#plan-scroll-container");return R(jy,{children:[R("div",{ref:$,className:"mt-3 flex justify-center overflow-x-auto mermaid-container","data-md":"mermaid","data-md-source":f.trim()},void 0,!1,void 0,this),N&&R(ky,{anchorEl:N.anchorEl,scrollContainer:M,snippet:N.snippet,header:R("div",{style:{fontSize:"12px",color:"var(--color-text-tertiary)",marginBottom:"8px",lineHeight:"1.4",display:"flex",alignItems:"center",gap:"6px"},children:[R("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"var(--color-accent-amber)",flexShrink:0}},void 0,!1,void 0,this),N.snippet]},void 0,!0,void 0,this),onAdd:(Y)=>{let Q=`ann-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;B(Q,`[Diagram ${N.prefix.toLowerCase()}] ${N.snippet}`,Y),P(null)},onCancel:()=>P(null)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Dy(y,$){let b=(m,f,g)=>{m.style.cursor="pointer",m.addEventListener("mouseenter",()=>{m.style.filter="brightness(1.2)"}),m.addEventListener("mouseleave",()=>{m.style.filter=""}),m.addEventListener("click",(B)=>{B.stopPropagation(),B.preventDefault(),$(m,f(),g)})};for(let m of y.querySelectorAll(".node"))b(m,()=>{return(m.querySelector(".nodeLabel")||m.querySelector("foreignObject span")||m.querySelector("text"))?.textContent?.trim()||"Node"},"Node");for(let m of y.querySelectorAll(".edgePath")){let f=m,g=f.querySelector("path");if(g){g.style.strokeWidth=Math.max(parseFloat(g.style.strokeWidth||"1"),8)+"px",g.style.strokeOpacity="0";let k=g.cloneNode(!0);k.style.strokeWidth="",k.style.strokeOpacity="",f.insertBefore(k,g)}let B=f.id||"";b(f,()=>{let k=y.querySelectorAll(".edgeLabel");for(let W of k)if(W.id&&B&&W.id.replace("label","").includes(B.replace("L-","").replace("edge",""))){let N=W.textContent?.trim();if(N)return N}return"Connection"},"Edge")}for(let m of y.querySelectorAll(".edgeLabel")){let f=m.textContent?.trim();if(!f)continue;b(m,()=>f,"Edge")}for(let m of y.querySelectorAll(".actor")){let f=m.closest("g")?.querySelector("text")||m.parentElement?.querySelector("text");if(!f)continue;let g=m.closest("g");if(!g||g.hasAttribute("data-clickable"))continue;g.setAttribute("data-clickable","true"),b(g,()=>f.textContent?.trim()||"Participant","Node")}for(let m of y.querySelectorAll(".messageText")){let f=m.textContent?.trim();if(!f)continue;b(m,()=>f,"Edge")}}function By(y,$,b){let m=new Map;for(let f of $){let g=f.snippet.match(/^\[Diagram (?:node|edge)\] (.+)$/);if(g)m.set(g[1],f.id)}for(let f of y.querySelectorAll("[data-annotated]"))f.style.outline="",f.style.outlineOffset="",f.style.borderRadius="",f.removeAttribute("data-annotated");if(m.size===0)return;for(let f of y.querySelectorAll(".node")){let B=(f.querySelector(".nodeLabel")||f.querySelector("foreignObject span")||f.querySelector("text"))?.textContent?.trim();if(!B||!m.has(B))continue;let k=m.get(B),W=f;W.setAttribute("data-annotated",k);let N=k===b;W.style.outline=N?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",W.style.outlineOffset="2px",W.style.borderRadius="4px"}for(let f of y.querySelectorAll(".edgeLabel")){let g=f.textContent?.trim();if(!g||!m.has(g))continue;let B=m.get(g),k=f;k.setAttribute("data-annotated",B);let W=B===b;k.style.outline=W?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",k.style.outlineOffset="2px",k.style.borderRadius="4px"}for(let f of y.querySelectorAll(".actor")){let g=f.closest("g");if(!g)continue;let k=g.querySelector("text")?.textContent?.trim();if(!k||!m.has(k))continue;if(g.hasAttribute("data-annotated"))continue;let W=m.get(k);g.setAttribute("data-annotated",W);let N=W===b,P=g.querySelector("rect");if(P)P.style.outline=N?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",P.style.outlineOffset="2px",P.style.borderRadius="4px"}for(let f of y.querySelectorAll(".messageText")){let g=f.textContent?.trim();if(!g||!m.has(g))continue;let B=m.get(g),k=f;k.setAttribute("data-annotated",B);let W=B===b;k.style.outline=W?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",k.style.outlineOffset="2px",k.style.borderRadius="4px"}}import{jsxDEV as i}from"react/jsx-dev-runtime";function Vy({before:y,after:$,language:b}){let m=y.split(`
4
+ `),f=$.split(`
5
+ `),g=Ey(m,f),B=[],k=0,W=0,N=0;while(k<m.length||W<f.length)if(N<g.length&&k<m.length&&W<f.length&&m[k]===g[N]&&f[W]===g[N])B.push({type:"same",line:m[k]}),k++,W++,N++;else if(k<m.length&&(N>=g.length||m[k]!==g[N]))B.push({type:"removed",line:m[k]}),k++;else if(W<f.length)B.push({type:"added",line:f[W]}),W++;return i("div",{className:"mt-3 bg-bg-code rounded-md overflow-hidden group/diff","data-md":"diff","data-md-language":b||"",children:[b&&i("div",{className:"px-4 py-2 text-meta font-mono text-text-tertiary opacity-0 group-hover/diff:opacity-60 transition-opacity",children:["diff (",b,")"]},void 0,!0,void 0,this),i("pre",{className:"px-4 pb-3 overflow-x-auto text-code font-mono",children:B.map((P,L)=>i("div",{className:P.type==="removed"?"bg-accent-red-muted text-accent-red":P.type==="added"?"bg-accent-green-muted text-accent-green":"text-text-tertiary",children:[i("span",{className:"select-none w-6 inline-block text-center opacity-60",children:P.type==="removed"?"-":P.type==="added"?"+":" "},void 0,!1,void 0,this),P.line]},L,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Ey(y,$){let b=y.length,m=$.length,f=Array.from({length:b+1},()=>Array(m+1).fill(0));for(let W=1;W<=b;W++)for(let N=1;N<=m;N++)f[W][N]=y[W-1]===$[N-1]?f[W-1][N-1]+1:Math.max(f[W-1][N],f[W][N-1]);let g=[],B=b,k=m;while(B>0&&k>0)if(y[B-1]===$[k-1])g.unshift(y[B-1]),B--,k--;else if(f[B-1][k]>f[B][k-1])B--;else k--;return g}import{useEffect as j,useRef as My,useState as Wy}from"react";import{useAnnotations as Jy}from"#canvas/runtime";import{jsxDEV as Ny}from"react/jsx-dev-runtime";function u({note:y,onChange:$}){return Ny("div",{className:"mt-1.5",children:Ny("textarea",{value:y,onChange:(b)=>$(b.target.value),className:"w-full bg-transparent text-[12px] font-body text-text-primary resize-none focus:outline-none border-none placeholder:text-text-disabled transition-colors min-h-[20px] p-0 leading-relaxed",placeholder:"Add a note...",rows:1,onInput:(b)=>{let m=b.target;m.style.height="auto",m.style.height=m.scrollHeight+"px"},ref:(b)=>{if(b)b.style.height="auto",b.style.height=b.scrollHeight+"px"}},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as H}from"react/jsx-dev-runtime";function ay({id:y,label:$,options:b,required:m}){let{responses:f,setResponse:g}=Jy(),B=f.get(y),k=B?.value,W=B?.note||"",[N,P]=Wy(!1),L=My(null);j(()=>{if(!f.has(y))g(y,{id:y,type:"radio",label:$,value:null,options:b,required:m})},[y]);let F=(M)=>{g(y,{...B,value:M})};j(()=>{let M=L.current;if(!M)return;let Y=(Q)=>{let z=Q.target.closest("[data-md-label]")?.getAttribute("data-md-label");if(z&&b.includes(z))F(z)};return M.addEventListener("kb-select",Y),()=>M.removeEventListener("kb-select",Y)});let O=B?.required&&!k;return H("div",{ref:L,"data-md":"choice","data-md-label":$,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[H("div",{className:"flex items-baseline gap-2 mb-2",children:[H("span",{className:"text-[13px] font-body font-medium text-text-primary",children:$},void 0,!1,void 0,this),m&&H("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H("div",{className:"space-y-1",children:b.map((M)=>H("label",{"data-md":"choice-option","data-md-label":M,onClick:()=>F(M),className:`flex items-center gap-2.5 px-3 py-2 rounded-lg cursor-pointer transition-all duration-150 ${k===M?"bg-highlight-selected":"hover:bg-bg-elevated"}`,children:[H("span",{className:`w-4 h-4 rounded-full border-[1.5px] flex items-center justify-center flex-shrink-0 transition-all ${k===M?"border-accent-amber bg-accent-amber":"border-border-strong"}`,children:k===M&&H("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"},void 0,!1,void 0,this)},void 0,!1,void 0,this),H("span",{className:"text-[13px] font-body text-text-secondary",children:M},void 0,!1,void 0,this)]},M,!0,void 0,this))},void 0,!1,void 0,this),H(u,{show:N,note:W,onToggle:()=>P(!N),onChange:(M)=>g(y,{...B,note:M})},void 0,!1,void 0,this),O&&H("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"Please select an option."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function oy({id:y,label:$,options:b,required:m}){let{responses:f,setResponse:g}=Jy(),B=f.get(y),k=B?.value||[],W=B?.note||"",[N,P]=Wy(!1),L=My(null);j(()=>{if(!f.has(y))g(y,{id:y,type:"checkbox",label:$,value:[],options:b,required:m})},[y]);let F=(M)=>{let Y=k.includes(M)?k.filter((Q)=>Q!==M):[...k,M];g(y,{...B,value:Y})};j(()=>{let M=L.current;if(!M)return;let Y=(Q)=>{let z=Q.target.closest("[data-md-label]")?.getAttribute("data-md-label");if(z&&b.includes(z))F(z)};return M.addEventListener("kb-select",Y),()=>M.removeEventListener("kb-select",Y)});let O=B?.required&&k.length===0;return H("div",{ref:L,"data-md":"multichoice","data-md-label":$,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[H("div",{className:"flex items-baseline gap-2 mb-2",children:[H("span",{className:"text-[13px] font-body font-medium text-text-primary",children:$},void 0,!1,void 0,this),m&&H("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H("div",{className:"space-y-1",children:b.map((M)=>{let Y=k.includes(M);return H("label",{"data-md":"multichoice-option","data-md-label":M,onClick:()=>F(M),className:`flex items-center gap-2.5 px-3 py-2 rounded-lg cursor-pointer transition-all duration-150 ${Y?"bg-highlight-selected":"hover:bg-bg-elevated"}`,children:[H("span",{className:`w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all ${Y?"bg-accent-amber":"border-[1.5px] border-border-strong"}`,children:Y&&H("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:H("path",{d:"M2.5 5L4.5 7L7.5 3",style:{stroke:"var(--color-text-inverse)"},strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),H("span",{className:"text-[13px] font-body text-text-secondary",children:M},void 0,!1,void 0,this)]},M,!0,void 0,this)})},void 0,!1,void 0,this),H(u,{show:N,note:W,onToggle:()=>P(!N),onChange:(M)=>g(y,{...B,note:M})},void 0,!1,void 0,this),O&&H("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"Please select at least one option."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useEffect as Py,useRef as ly,useState as Qy}from"react";import{useAnnotations as Yy}from"#canvas/runtime";import{jsxDEV as K}from"react/jsx-dev-runtime";function ty({id:y,label:$,placeholder:b,multiline:m,required:f}){let{responses:g,setResponse:B}=Yy(),k=g.get(y),W=k?.value??"",N=k?.note||"",[P,L]=Qy(!1),F=ly(null);Py(()=>{if(!g.has(y))B(y,{id:y,type:"text",label:$,value:"",required:f})},[y]);let O=(Q)=>{B(y,{...k,value:Q})},M=(Q)=>{Q.style.height="auto",Q.style.height=Math.max(m?60:32,Q.scrollHeight)+"px"},Y=k?.required&&!W.trim();return K("div",{"data-md":"userinput","data-md-label":$,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[K("div",{className:"flex items-baseline gap-2 mb-2",children:[K("span",{className:"text-[13px] font-body font-medium text-text-primary",children:$},void 0,!1,void 0,this),f&&K("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("textarea",{ref:F,value:W,onChange:(Q)=>{O(Q.target.value),M(Q.target)},placeholder:b||"Type your response...",rows:m?3:1,className:"w-full bg-bg-input text-[13px] font-body text-text-primary rounded-lg px-3 py-2 resize-none focus:outline-none border border-border-subtle focus:border-border-hover placeholder:text-text-tertiary transition-colors",onInput:(Q)=>M(Q.target),onFocus:(Q)=>M(Q.target)},void 0,!1,void 0,this),K(u,{show:P,note:N,onToggle:()=>L(!P),onChange:(Q)=>B(y,{...k,note:Q})},void 0,!1,void 0,this),Y&&K("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"This field is required."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ny({id:y,label:$,min:b=1,max:m=10,step:f=1,required:g,minLabel:B,maxLabel:k}){let{responses:W,setResponse:N}=Yy(),P=W.get(y),L=P?.value,F=P?.note||"",[O,M]=Qy(!1);Py(()=>{if(!W.has(y))N(y,{id:y,type:"range",label:$,value:null,required:g})},[y]);let Y=(U)=>{N(y,{...P,value:U})},Q=L!==null&&L!==void 0,G=Q?L:Math.round((b+m)/2),z=(G-b)/(m-b)*100,X=Math.round((m-b)/f),T=X<=20,_=P?.required&&!Q;return K("div",{"data-md":"rangeinput","data-md-label":$,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[K("div",{className:"flex items-baseline justify-between mb-1",children:[K("div",{className:"flex items-baseline gap-2",children:[K("span",{className:"text-[13px] font-body font-medium text-text-primary",children:$},void 0,!1,void 0,this),g&&K("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("span",{className:"flex items-center gap-1.5",children:[K("span",{className:`text-[13px] font-mono ${Q?"text-accent-amber":"text-text-disabled"}`,children:Q?L:"—"},void 0,!1,void 0,this),Q&&K("button",{onClick:()=>N(y,{...P,value:null}),className:"text-text-disabled hover:text-text-tertiary transition-colors text-[10px] leading-none",title:"Clear",children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K("div",{className:"relative h-6 flex items-center",children:[K("div",{className:"absolute left-0 right-0 h-1.5 rounded-full bg-border-medium",children:Q&&K("div",{className:"h-full rounded-full bg-accent-amber transition-all duration-150",style:{width:`${z}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this),T&&Array.from({length:X+1},(U,q)=>{let w=b+q*f,d=(w-b)/(m-b)*100,J=Q&&w<=L;return K("div",{className:`absolute rounded-full pointer-events-none transition-all duration-150 ${Q&&w===L?"w-2.5 h-2.5 bg-accent-amber":J?"w-1.5 h-1.5 bg-accent-amber":"w-1.5 h-1.5 bg-border-hover"}`,style:{left:`${d}%`,transform:"translate(-50%, -50%)",top:"50%"}},q,!1,void 0,this)}),Q?K("div",{className:"absolute h-5 w-5 rounded-full bg-accent-amber shadow-md pointer-events-none transition-all duration-150",style:{left:`calc(${z}% - 10px)`,borderWidth:"2px",borderStyle:"solid",borderColor:"var(--color-bg-base)"}},void 0,!1,void 0,this):K("div",{className:"absolute h-4 w-4 rounded-full bg-border-hover pointer-events-none opacity-50",style:{left:"calc(50% - 8px)",borderWidth:"2px",borderStyle:"solid",borderColor:"var(--color-bg-base)"}},void 0,!1,void 0,this),K("input",{type:"range",min:b,max:m,step:f,value:G,onChange:(U)=>Y(Number(U.target.value)),className:"absolute inset-0 w-full opacity-0 cursor-pointer"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T&&X<=10?K("div",{className:"flex justify-between -mt-0.5 px-0",children:Array.from({length:X+1},(U,q)=>{let w=b+q*f;return K("span",{className:`text-[10px] font-mono transition-colors ${Q&&w===L?"text-accent-amber font-medium":"text-text-disabled"}`,style:{minWidth:"1ch",textAlign:"center"},children:w},q,!1,void 0,this)})},void 0,!1,void 0,this):K("div",{className:"flex justify-between -mt-0.5",children:[K("span",{className:"text-[11px] text-text-tertiary font-body",children:B||b},void 0,!1,void 0,this),K("span",{className:"text-[11px] text-text-tertiary font-body",children:k||m},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K(u,{show:O,note:F,onToggle:()=>M(!O),onChange:(U)=>N(y,{...P,note:U})},void 0,!1,void 0,this),_&&K("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"Please select a value."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useContext as sy,useState as ey}from"react";import{SessionContext as ym}from"#canvas/runtime";import{jsxDEV as p}from"react/jsx-dev-runtime";function mm({src:y,alt:$,caption:b,width:m,height:f}){let g=sy(ym),[B,k]=ey(!1),W=`/api/image?session=${encodeURIComponent(g)}&path=${encodeURIComponent(y)}`;if(B)return p("div",{className:"mt-3 text-accent-red text-body bg-accent-red-muted rounded-md p-4",children:[y,": Failed to load image"]},void 0,!0,void 0,this);return p("figure",{className:"mt-3 relative","data-md":"image","data-md-src":y,children:[p("div",{className:"rounded-md overflow-hidden border border-border-subtle bg-bg-code inline-block",children:p("img",{src:W,alt:$||y,onError:()=>k(!0),className:"block max-w-full h-auto",...m?{width:m}:{},...f?{height:f}:{}},void 0,!1,void 0,this)},void 0,!1,void 0,this),b&&p("figcaption",{className:"mt-1.5 text-meta text-text-tertiary font-body",children:b},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useFeedback as U1}from"#canvas/runtime";export{U1 as useFeedback,ty as UserInput,Hy as Task,_y as Table,Ky as Section,ny as RangeInput,Cy as Priority,qy as Note,oy as MultiChoice,xy as Mermaid,t as Item,mm as ImageView,cy as FilePreview,Vy as Diff,Ty as CodeBlock,ay as Choice,wy as Checklist,Gy as Callout};