codesesh 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/{chunk-FZNZAMTZ.js → chunk-SQYHWMQV.js} +2533 -458
- package/dist/chunk-SQYHWMQV.js.map +1 -0
- package/dist/{dist-DMEDEJ2D.js → dist-NT4CH6KD.js} +46 -2
- package/dist/index.js +680 -83
- package/dist/index.js.map +1 -1
- package/dist/search-index-worker.js +40 -0
- package/dist/search-index-worker.js.map +1 -0
- package/dist/web/assets/index-D9lwrpQG.css +2 -0
- package/dist/web/assets/index-DZaQy6OQ.js +106 -0
- package/dist/web/assets/vendor-Bs5B_LvM.js +43 -0
- package/dist/web/index.html +3 -3
- package/package.json +2 -3
- package/dist/chunk-FZNZAMTZ.js.map +0 -1
- package/dist/web/assets/index-BRW_TBMw.js +0 -106
- package/dist/web/assets/index-CCgk7cPa.css +0 -2
- package/dist/web/assets/vendor-CWmLg_mG.js +0 -43
- /package/dist/{dist-DMEDEJ2D.js.map → dist-NT4CH6KD.js.map} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@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-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-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction: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-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;--tw-outline-style:solid}}}@layer theme{:root,:host{--font-sans:"Avenir Next", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", -apple-system, sans-serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-2xl:42rem;--container-4xl:56rem;--container-5xl:64rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-relaxed:1.625;--radius-sm:calc(var(--radius) - 4px);--radius-lg:var(--radius);--radius-xl:.75rem;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--aspect-video:16 / 9;--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-border:hsl(var(--border));--color-background:hsl(var(--background));--color-foreground:hsl(var(--foreground));--color-muted:hsl(var(--muted));--color-muted-foreground:hsl(var(--muted-foreground));--color-card:hsl(var(--card));--color-card-foreground:hsl(var(--card-foreground))}}@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;-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}:root{--background:0 0% 100%;--foreground:0 0% 3.9%;--card:0 0% 100%;--card-foreground:0 0% 3.9%;--popover:0 0% 100%;--popover-foreground:0 0% 3.9%;--primary:0 0% 9%;--primary-foreground:0 0% 98%;--secondary:0 0% 96.1%;--secondary-foreground:0 0% 9%;--muted:0 0% 96.1%;--muted-foreground:0 0% 45.1%;--accent:0 0% 96.1%;--accent-foreground:0 0% 9%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--border:0 0% 89.8%;--input:0 0% 89.8%;--ring:0 0% 3.9%;--radius:.5rem;--console-bg:#f7f7f7;--console-sidebar-bg:#fbfbfb;--console-surface-muted:#f5f5f5;--console-border:#e5e5e5;--console-border-strong:#d4d4d4;--console-text:#1a1a1a;--console-muted:#666;--console-accent:#2d2d2d;--console-accent-strong:#1f1f1f;--console-thread:#e8e8e8;--console-thinking-bg:#f9f9f9;--console-thinking-border:#ebebeb;--console-success:#15803d;--console-success-bg:#dcfce7;--console-success-border:#bbf7d0;--console-warning:#b45309;--console-warning-bg:#fef3c7;--console-warning-border:#fde68a;--console-error:#b91c1c;--console-error-bg:#fee2e2;--console-error-border:#fecaca}.dark{--background:0 0% 3.9%;--foreground:0 0% 98%;--card:0 0% 3.9%;--card-foreground:0 0% 98%;--popover:0 0% 3.9%;--popover-foreground:0 0% 98%;--primary:0 0% 98%;--primary-foreground:0 0% 9%;--secondary:0 0% 14.9%;--secondary-foreground:0 0% 98%;--muted:0 0% 14.9%;--muted-foreground:0 0% 63.9%;--accent:0 0% 14.9%;--accent-foreground:0 0% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:0 0% 98%;--border:0 0% 14.9%;--input:0 0% 14.9%;--ring:0 0% 83.1%}*{border-color:var(--color-border)}body{background-color:var(--color-background);color:var(--color-foreground)}}@layer components;@layer utilities{.\@container\/card-header{container:card-header/inline-size}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-4{top:calc(var(--spacing) * 4)}.left-0{left:calc(var(--spacing) * 0)}.z-40{z-index:40}.z-50{z-index:50}.order-3{order:3}.col-span-2{grid-column:span 2/span 2}.col-start-2{grid-column-start:2}.row-span-2{grid-row:span 2/span 2}.row-start-1{grid-row-start:1}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.mx-auto{margin-inline:auto}.my-0\.5{margin-block:calc(var(--spacing) * .5)}.-mt-1{margin-top:calc(var(--spacing) * -1)}.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-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-auto{margin-left:auto}.line-clamp-1{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.aspect-square{aspect-ratio:1}.aspect-video{aspect-ratio:var(--aspect-video)}.size-1\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-2\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-\[160px\]{width:160px;height:160px}.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{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-6{height:calc(var(--spacing) * 6)}.h-32{height:calc(var(--spacing) * 32)}.h-\[560px\]{height:560px}.h-\[min\(560px\,calc\(100vh-410px\)\)\]{height:min(560px,100vh - 410px)}.h-full{height:100%}.h-screen{height:100vh}.max-h-\[200px\]{max-height:200px}.max-h-\[280px\]{max-height:280px}.max-h-\[420px\]{max-height:420px}.max-h-\[min\(280px\,calc\(100vh-440px\)\)\]{max-height:min(280px,100vh - 440px)}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-11{min-height:calc(var(--spacing) * 11)}.min-h-14{min-height:calc(var(--spacing) * 14)}.min-h-24{min-height:calc(var(--spacing) * 24)}.min-h-56{min-height:calc(var(--spacing) * 56)}.min-h-full{min-height:100%}.w-0{width:calc(var(--spacing) * 0)}.w-1{width:calc(var(--spacing) * 1)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-2\/3{width:66.6667%}.w-4{width:calc(var(--spacing) * 4)}.w-5\/6{width:83.3333%}.w-5\/12{width:41.6667%}.w-6{width:calc(var(--spacing) * 6)}.w-7\/12{width:58.3333%}.w-8\/12{width:66.6667%}.w-9\/12{width:75%}.w-10\/12{width:83.3333%}.w-11\/12{width:91.6667%}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-32{width:calc(var(--spacing) * 32)}.w-64{width:calc(var(--spacing) * 64)}.w-full{width:100%}.w-screen{width:100vw}.max-w-2xl{max-width:var(--container-2xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-\[42rem\]{max-width:42rem}.max-w-\[1440px\]{max-width:1440px}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-\[8rem\]{min-width:8rem}.flex-1{flex:1}.shrink-0{flex-shrink:0}.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)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize{resize:both}.scroll-mt-6{scroll-margin-top:calc(var(--spacing) * 6)}.auto-rows-min{grid-auto-rows:min-content}.grid-cols-\[auto_1fr\]{grid-template-columns:auto 1fr}.grid-rows-\[auto_auto\]{grid-template-rows:auto auto}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.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-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-8{gap:calc(var(--spacing) * 8)}.gap-\[2px\]{gap:2px}: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)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-y-1{row-gap:calc(var(--spacing) * 1)}.self-start{align-self:flex-start}.justify-self-end{justify-self:flex-end}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\[2px\]{border-radius:2px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t-\[1px\]{border-top-left-radius:1px;border-top-right-radius:1px}.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-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-\(--color-border\){border-color:var(--color-border)}.border-\[var\(--console-accent\)\]{border-color:var(--console-accent)}.border-\[var\(--console-border\)\]{border-color:var(--console-border)}.border-\[var\(--console-border-strong\)\]{border-color:var(--console-border-strong)}.border-\[var\(--console-error-border\)\]{border-color:var(--console-error-border)}.border-\[var\(--console-success-border\)\]{border-color:var(--console-success-border)}.border-\[var\(--console-thinking-border\)\]{border-color:var(--console-thinking-border)}.border-\[var\(--console-thread\)\]{border-color:var(--console-thread)}.border-\[var\(--console-warning-border\)\]{border-color:var(--console-warning-border)}.border-border\/50{border-color:color-mix(in srgb, hsl(var(--border)) 50%, transparent)}@supports (color:color-mix(in lab, red, red)){.border-border\/50{border-color:color-mix(in oklab, var(--color-border) 50%, transparent)}}.border-transparent{border-color:#0000}.bg-\(--color-bg\){background-color:var(--color-bg)}.bg-\[\#eff6ff\]{background-color:#eff6ff}.bg-\[\#f0fdf4\]{background-color:#f0fdf4}.bg-\[\#f3f4f6\]{background-color:#f3f4f6}.bg-\[\#f5f3ff\]{background-color:#f5f3ff}.bg-\[\#fafafa\]{background-color:#fafafa}.bg-\[\#fef2f2\]{background-color:#fef2f2}.bg-\[var\(--console-accent\)\]{background-color:var(--console-accent)}.bg-\[var\(--console-bg\)\]{background-color:var(--console-bg)}.bg-\[var\(--console-border\)\]{background-color:var(--console-border)}.bg-\[var\(--console-border-strong\)\]{background-color:var(--console-border-strong)}.bg-\[var\(--console-error-bg\)\]{background-color:var(--console-error-bg)}.bg-\[var\(--console-sidebar-bg\)\]{background-color:var(--console-sidebar-bg)}.bg-\[var\(--console-success-bg\)\]{background-color:var(--console-success-bg)}.bg-\[var\(--console-surface-muted\)\]{background-color:var(--console-surface-muted)}.bg-\[var\(--console-thinking-bg\)\]{background-color:var(--console-thinking-bg)}.bg-\[var\(--console-warning-bg\)\]{background-color:var(--console-warning-bg)}.bg-background{background-color:var(--color-background)}.bg-black\/35{background-color:#00000059}@supports (color:color-mix(in lab, red, red)){.bg-black\/35{background-color:color-mix(in oklab, var(--color-black) 35%, transparent)}}.bg-card{background-color:var(--color-card)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/60{background-color:#fff9}@supports (color:color-mix(in lab, red, red)){.bg-white\/60{background-color:color-mix(in oklab, var(--color-white) 60%, transparent)}}.bg-white\/70{background-color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){.bg-white\/70{background-color:color-mix(in oklab, var(--color-white) 70%, transparent)}}.bg-white\/80{background-color:#fffc}@supports (color:color-mix(in lab, red, red)){.bg-white\/80{background-color:color-mix(in oklab, var(--color-white) 80%, transparent)}}.bg-white\/85{background-color:#ffffffd9}@supports (color:color-mix(in lab, red, red)){.bg-white\/85{background-color:color-mix(in oklab, var(--color-white) 85%, transparent)}}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-1{padding:calc(var(--spacing) * 1)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.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-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-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pr-1{padding-right:calc(var(--spacing) * 1)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-6{--tw-leading:calc(var(--spacing) * 6);line-height:calc(var(--spacing) * 6)}.leading-7{--tw-leading:calc(var(--spacing) * 7);line-height:calc(var(--spacing) * 7)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.05em\]{--tw-tracking:.05em;letter-spacing:.05em}.tracking-\[0\.12em\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-\[0\.16em\]{--tw-tracking:.16em;letter-spacing:.16em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#1d4ed8\]{color:#1d4ed8}.text-\[\#7c3aed\]{color:#7c3aed}.text-\[\#15803d\]{color:#15803d}.text-\[\#b91c1c\]{color:#b91c1c}.text-\[var\(--console-accent\)\]{color:var(--console-accent)}.text-\[var\(--console-error\)\]{color:var(--console-error)}.text-\[var\(--console-muted\)\]{color:var(--console-muted)}.text-\[var\(--console-success\)\]{color:var(--console-success)}.text-\[var\(--console-text\)\]{color:var(--console-text)}.text-\[var\(--console-warning\)\]{color:var(--console-warning)}.text-card-foreground{color:var(--color-card-foreground)}.text-foreground{color:var(--color-foreground)}.text-muted-foreground{color:var(--color-muted-foreground)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.accent-\[var\(--console-accent-strong\)\]{accent-color:var(--console-accent-strong)}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-100{opacity:1}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_1px_2px_rgba\(15\,23\,42\,0\.04\)\]{--tw-shadow:0 1px 2px var(--tw-shadow-color,#0f172a0a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[2px_2px_0_0_rgba\(15\,23\,42\,0\.05\)\]{--tw-shadow:2px 2px 0 0 var(--tw-shadow-color,#0f172a0d);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 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-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-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))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.animate-in{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.outline-none{--tw-outline-style:none;outline-style:none}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.fade-in{--tw-enter-opacity:0}.running{animation-play-state:running}.slide-in-from-bottom-2{--tw-enter-translate-y:.5rem}.placeholder\:text-\[var\(--console-muted\)\]::placeholder{color:var(--console-muted)}@media (hover:hover){.hover\:border-\[var\(--console-border\)\]:hover{border-color:var(--console-border)}.hover\:border-\[var\(--console-border-strong\)\]:hover{border-color:var(--console-border-strong)}.hover\:bg-\[var\(--console-surface-muted\)\]:hover{background-color:var(--console-surface-muted)}.hover\:bg-white:hover{background-color:var(--color-white)}.hover\:text-\[var\(--console-text\)\]:hover{color:var(--console-text)}.hover\:opacity-100:hover{opacity:1}}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-\[var\(--console-accent\)\]:focus-visible{outline-color:var(--console-accent)}.active\:cursor-grabbing:active{cursor:grabbing}.has-data-\[slot\=card-action\]\:grid-cols-\[1fr_auto\]:has([data-slot=card-action]){grid-template-columns:1fr auto}@media (width>=40rem){.sm\:order-none{order:0}.sm\:col-span-1{grid-column:span 1/span 1}.sm\:mx-auto{margin-inline:auto}.sm\:inline{display:inline}.sm\:inline-flex{display:inline-flex}.sm\:max-w-\[560px\]{max-width:560px}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-\[auto_1fr_auto\]{grid-template-columns:auto 1fr auto}.sm\:py-0{padding-block:calc(var(--spacing) * 0)}}@media (width>=48rem){.md\:inline-flex{display:inline-flex}.md\:w-24{width:calc(var(--spacing) * 24)}.md\:w-\[560px\]{width:560px}.md\:max-w-xs{max-width:var(--container-xs)}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-center{align-items:center}.md\:items-start{align-items:flex-start}.md\:justify-between{justify-content:space-between}.md\:gap-3{gap:calc(var(--spacing) * 3)}.md\:p-6{padding:calc(var(--spacing) * 6)}.md\:px-4{padding-inline:calc(var(--spacing) * 4)}.md\:px-8{padding-inline:calc(var(--spacing) * 8)}.md\:pr-5{padding-right:calc(var(--spacing) * 5)}.md\:text-\[2rem\]{font-size:2rem}}@media (width>=64rem){.lg\:sticky{position:sticky}.lg\:top-4{top:calc(var(--spacing) * 4)}.lg\:flex{display:flex}.lg\:max-h-\[calc\(100dvh-14rem\)\]{max-height:calc(100dvh - 14rem)}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-\[240px_minmax\(0\,1fr\)\]{grid-template-columns:240px minmax(0,1fr)}.lg\:items-start{align-items:flex-start}.lg\:overflow-y-auto{overflow-y:auto}.lg\:overscroll-contain{overscroll-behavior:contain}}@media (width>=80rem){.xl\:block{display:block}.xl\:grid-cols-\[220px_minmax\(0\,1fr\)_320px\]{grid-template-columns:220px minmax(0,1fr) 320px}}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:var(--color-muted-foreground)}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke=\#ccc]{stroke:color-mix(in srgb, hsl(var(--border)) 50%, transparent)}@supports (color:color-mix(in lab, red, red)){.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke=\#ccc]{stroke:color-mix(in oklab, var(--color-border) 50%, transparent)}}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:var(--color-border)}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke=\#fff]{stroke:#0000}.\[\&_\.recharts-layer\]\:outline-hidden .recharts-layer{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.\[\&_\.recharts-layer\]\:outline-hidden .recharts-layer{outline-offset:2px;outline:2px solid #0000}}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke=\#ccc]{stroke:var(--color-border)}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:var(--color-muted)}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke=\#ccc]{stroke:var(--color-border)}.\[\&_\.recharts-sector\]\:outline-hidden .recharts-sector{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.\[\&_\.recharts-sector\]\:outline-hidden .recharts-sector{outline-offset:2px;outline:2px solid #0000}}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke=\#fff]{stroke:#0000}.\[\&_\.recharts-surface\]\:outline-hidden .recharts-surface{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.\[\&_\.recharts-surface\]\:outline-hidden .recharts-surface{outline-offset:2px;outline:2px solid #0000}}.\[\&_mark\]\:bg-\[var\(--console-accent\)\] mark{background-color:var(--console-accent)}.\[\&_mark\]\:px-0\.5 mark{padding-inline:calc(var(--spacing) * .5)}.\[\&_mark\]\:text-white mark{color:var(--color-white)}.\[\.border-b\]\:pb-6.border-b{padding-bottom:calc(var(--spacing) * 6)}.\[\.border-t\]\:pt-6.border-t{padding-top:calc(var(--spacing) * 6)}.\[\&\>svg\]\:h-2\.5>svg{height:calc(var(--spacing) * 2.5)}.\[\&\>svg\]\:h-3>svg{height:calc(var(--spacing) * 3)}.\[\&\>svg\]\:w-2\.5>svg{width:calc(var(--spacing) * 2.5)}.\[\&\>svg\]\:w-3>svg{width:calc(var(--spacing) * 3)}.\[\&\>svg\]\:text-muted-foreground>svg{color:var(--color-muted-foreground)}.console-ui{font-family:IBM Plex Sans,Avenir Next,PingFang SC,-apple-system,sans-serif}.console-mono{font-family:JetBrains Mono,IBM Plex Mono,SFMono-Regular,Menlo,Monaco,Consolas,monospace}.bg-grid{background-image:linear-gradient(90deg,#0000000a 1px,#0000 1px),linear-gradient(#0000000a 1px,#0000 1px);background-size:40px 40px}}.console-scrollbar::-webkit-scrollbar{width:6px;height:6px}.console-scrollbar::-webkit-scrollbar-track{background:0 0}.console-scrollbar::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:2px}.console-scrollbar::-webkit-scrollbar-thumb:hover{background:#9ca3af}.console-scrollbar{scrollbar-width:thin;scrollbar-color:#d1d5db transparent}.console-markdown>*+*{margin-top:.75rem}.console-markdown p{margin:0}.console-markdown h1,.console-markdown h2,.console-markdown h3,.console-markdown h4,.console-markdown h5,.console-markdown h6{color:var(--console-text);margin:0;font-weight:700;line-height:1.3}.console-markdown h1{letter-spacing:-.02em;font-size:1.5rem}.console-markdown h2{letter-spacing:-.015em;font-size:1.25rem}.console-markdown h3{font-size:1.1rem}.console-markdown h4,.console-markdown h5,.console-markdown h6{font-size:1rem}.console-markdown ul,.console-markdown ol{margin:.5rem 0;padding-left:1.25rem}.console-markdown ul{list-style:outside}.console-markdown ol{list-style:decimal}.console-markdown li+li{margin-top:.25rem}.console-markdown li>p{margin:0}.console-markdown strong{font-weight:700}.console-markdown blockquote{border-left:3px solid var(--console-border-strong);color:var(--console-muted);margin:0;padding-left:.875rem}.console-markdown hr{border:0;border-top:1px solid var(--console-border);margin:1rem 0}.console-markdown a{color:#4f46e5;text-decoration:underline}.console-markdown-link{color:inherit;cursor:text;text-decoration:none}.console-markdown code{background:#f5f5f5;border:1px solid #e5e7eb;border-radius:.125rem;padding:.08rem .32rem;font-family:JetBrains Mono,IBM Plex Mono,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.8rem}.console-markdown pre{background:#fafafa;border:1px solid #e5e7eb;border-radius:.125rem;margin:0;padding:.75rem;overflow-x:auto}.console-markdown pre code{background:0 0;border:none;padding:0}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0), var(--tw-enter-translate-y,0), 0) scale3d(var(--tw-enter-scale,1), var(--tw-enter-scale,1), var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0), var(--tw-exit-translate-y,0), 0) scale3d(var(--tw-exit-scale,1), var(--tw-exit-scale,1), var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,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-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{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-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}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{l as t,t as n,u as r}from"./markdown-CnUlvKkZ.js";import{n as i,r as a,t as o}from"./react-DT3QPCDf.js";import{A as s,C as c,D as l,E as u,M as d,N as f,O as p,P as m,S as h,T as g,_,a as ee,b as v,c as te,d as y,f as b,g as ne,h as x,j as re,k as S,l as ie,m as ae,n as oe,o as se,p as ce,r as le,s as ue,t as de,u as fe,v as C,w as pe,x as w,y as me}from"./vendor-Bs5B_LvM.js";import{C as T,S as he,_ as E,a as ge,b as _e,c as ve,d as D,f as ye,g as O,h as be,i as xe,l as Se,m as Ce,n as k,o as we,p as Te,r as Ee,s as De,t as Oe,u as ke,v as Ae,x as je,y as A}from"./syntax-DcanuzfQ.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var j=e(r(),1),Me=e(a(),1),M={agents:{opencode:{name:`OpenCode`,icon:`/icon/agent/opencode.svg`},codex:{name:`Codex`,icon:`/icon/agent/codex.svg`},cursor:{name:`Cursor`,icon:`/icon/agent/cursor.svg`},kimi:{name:`Kimi-Cli`,icon:`/icon/agent/kimi.svg`},claudecode:{name:`Claude Code`,icon:`/icon/agent/claudecode.svg`},kilo:{name:`Kilo Code`,icon:`/icon/agent/kilocode.svg`},antigravity:{name:`Antigravity`,icon:`/icon/agent/antigravity.svg`}},getDefaultAgentKey(){let e=Object.keys(this.agents);return e.length>0?e[0]:null},getAgentName(e){let t=this.agents[e];return t||=this.agents[e.toLowerCase()],t?t.name:e}};async function Ne(){let e=await fetch(`/api/config`);if(!e.ok)throw Error(`Failed to fetch config`);return e.json()}async function Pe(){let e=await fetch(`/api/agents`);if(!e.ok)throw Error(`Failed to fetch agents`);return e.json()}async function Fe(){let e=await fetch(`/api/projects`);if(!e.ok)throw Error(`Failed to fetch projects`);return e.json()}async function Ie(e={}){let t=new URLSearchParams;e.agent&&t.set(`agent`,e.agent),e.projectKey&&t.set(`projectKey`,e.projectKey),e.from!=null&&t.set(`from`,new Date(e.from).toISOString()),e.to!=null&&t.set(`to`,new Date(e.to).toISOString());let n=await fetch(`/api/sessions?${t}`);if(!n.ok)throw Error(`Failed to fetch sessions`);return n.json()}async function Le(e,t){let n=await fetch(`/api/sessions/${e}/${t}`);if(!n.ok)throw Error(`Failed to fetch session data`);return n.json()}async function Re(e,t={}){let n=new URLSearchParams;e?.from!=null&&n.set(`from`,new Date(e.from).toISOString()),e?.to!=null&&n.set(`to`,new Date(e.to).toISOString()),e?.days!=null&&e.days>0&&n.set(`days`,String(e.days)),t.projectKind&&n.set(`projectKind`,t.projectKind),t.projectKey&&n.set(`projectKey`,t.projectKey),t.agent&&n.set(`agent`,t.agent);let r=n.toString(),i=await fetch(r?`/api/dashboard?${r}`:`/api/dashboard`);if(!i.ok)throw Error(`Failed to fetch dashboard`);return i.json()}async function ze(e,t={}){let n=new URLSearchParams;n.set(`q`,e),t.agent&&n.set(`agent`,t.agent),t.projectKey&&n.set(`projectKey`,t.projectKey),t.tag&&n.set(`tag`,t.tag),t.tool&&n.set(`tool`,t.tool),t.fileKind&&n.set(`fileActivity`,t.fileKind),t.costMin!=null&&n.set(`costMin`,String(t.costMin)),t.costMax!=null&&n.set(`costMax`,String(t.costMax));let r=await fetch(`/api/search?${n}`);if(!r.ok)throw Error(`Failed to fetch search results`);return r.json()}async function Be(){let e=await fetch(`/api/bookmarks`);if(!e.ok)throw Error(`Failed to fetch bookmarks`);return e.json()}async function Ve(e){let t=await fetch(`/api/bookmarks`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(`Failed to save bookmark`);return t.json()}async function He(e){let t=await fetch(`/api/bookmarks/import`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(`Failed to import bookmarks`);return t.json()}async function Ue(e,t){if(!(await fetch(`/api/bookmarks/${e}/${t}`,{method:`DELETE`})).ok)throw Error(`Failed to delete bookmark`)}function N(e,t={}){let n=JSON.stringify({event:e,data:t});try{if(typeof navigator<`u`&&navigator.sendBeacon){let e=new Blob([n],{type:`application/json`});if(navigator.sendBeacon(`/api/logs`,e))return}}catch{}fetch(`/api/logs`,{method:`POST`,headers:{"Content-Type":`application/json`},body:n,keepalive:!0}).catch(()=>{})}function We(e){let t=new EventSource(`/api/events`);return t.addEventListener(`sessions-updated`,t=>{try{e(JSON.parse(t.data))}catch(e){console.error(`Failed to parse session update event:`,e)}}),t.onerror=()=>{t.readyState!==EventSource.CLOSED&&console.warn(`Session update stream disconnected`)},()=>{t.close()}}function Ge(...e){return se(ue(e))}var P=t(),F={bugfix:`bugfix`,refactoring:`refactoring`,"feature-dev":`feature-dev`,testing:`testing`,docs:`docs`,"git-ops":`git-ops`,"build-deploy":`build-deploy`,exploration:`exploration`,planning:`planning`},I={bugfix:{text:`#B42318`,border:`#FECDCA`,background:`#FEF3F2`,bar:`#F04438`},refactoring:{text:`#6941C6`,border:`#D9D6FE`,background:`#F4F3FF`,bar:`#7A5AF8`},"feature-dev":{text:`#175CD3`,border:`#B2DDFF`,background:`#EFF8FF`,bar:`#2E90FA`},testing:{text:`#027A48`,border:`#ABEFC6`,background:`#ECFDF3`,bar:`#12B76A`},docs:{text:`#B54708`,border:`#FEDF89`,background:`#FFFAEB`,bar:`#F79009`},"git-ops":{text:`#3538CD`,border:`#C7D7FE`,background:`#EEF4FF`,bar:`#444CE7`},"build-deploy":{text:`#C4320A`,border:`#F9DBAF`,background:`#FEF6EE`,bar:`#EF6820`},exploration:{text:`#0E7090`,border:`#A5F0FC`,background:`#ECFDFF`,bar:`#06AED4`},planning:{text:`#C11574`,border:`#FCCEEE`,background:`#FDF2FA`,bar:`#EE46BC`}};function Ke(e){return I[e]}function qe(e){let t=Ke(e);return{color:t.text,borderColor:t.border,backgroundColor:t.background}}function Je({tags:e,limit:t=4,className:n=``}){if(!e||e.length===0)return null;let r=e.slice(0,t),i=e.length-r.length;return(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-1 ${n}`,children:[r.map(e=>(0,P.jsx)(`span`,{className:`console-mono rounded-sm border px-1.5 py-0.5 text-[10px] font-medium`,style:qe(e),children:F[e]},e)),i>0?(0,P.jsxs)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-1.5 py-0.5 text-[10px] text-[var(--console-muted)]`,children:[`+`,i]}):null]})}function Ye(e,t){return e?Math.abs(e.receiptWidth-t.receiptWidth)>.5||Math.abs(e.receiptHeight-t.receiptHeight)>.5||Math.abs(e.startX-t.startX)>.5||Math.abs(e.startY-t.startY)>.5:!0}var L=18,R=42,Xe=5,z=270,B=500,V=2;function H(e){return Math.round(e??0).toLocaleString(`en-US`)}function Ze(e){return`$${(e??0).toFixed(4)}`}function Qe(e){return new Date(e).toLocaleString(`en-US`,{month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function $e(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function U(e){let t=e||1;return()=>(t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296)}function et(e){let t=[{label:`User`,count:e.counts.user},{label:`Agent Responses`,count:e.counts.agent_message},{label:`Thinking`,count:e.counts.thinking},{label:`Plans`,count:e.counts.plan},{label:`Tools`,count:e.counts.tools_all}].filter(e=>e.count>0),n=e.tools.map(e=>({label:e.label,count:e.count})),r=Math.max(0,9-t.length),i=n.length>r?n.slice(0,Math.max(0,r-1)):n,a=n.slice(i.length).reduce((e,t)=>e+t.count,0);return a>0&&i.push({label:`Other tools`,count:a}),[...t,...i].slice(0,9)}function tt(e){return!e||e.length===0?`SESSION ACTIVITY RECEIPT`:e.map(e=>F[e]).join(` / `)}function nt(e,t){let n=e.slug?.split(`/`)[0]||`codesesh`;return{id:e.id,title:e.title||`Untitled session`,agent:n,updatedAt:e.time_updated??e.time_created,tags:e.smart_tags,stats:e.stats,items:et(t)}}function W(e,t,n,r,i){let a=t.toUpperCase(),o=n.toUpperCase();e.fillText(a,18,r),e.fillText(o,i-18-e.measureText(o).width,r)}function rt(e,t,n){if(e.measureText(t).width<=n)return t;let r=t;for(;r.length>1&&e.measureText(`${r}...`).width>n;)r=r.slice(0,-1);return`${r}...`}function it(e,t,n,r){let i=t.toUpperCase().split(/\s+/).filter(Boolean),a=[],o=``;for(let t of i){let i=o?`${o} ${t}`:t;if(e.measureText(i).width<=n){o=i;continue}if(o?(a.push(o),o=t):(a.push(rt(e,t,n)),o=``),a.length===r)break}return a.length<r&&o&&a.push(o),a.length>0&&a.length===r&&(a[a.length-1]=rt(e,a[a.length-1]??``,n)),a.slice(0,r)}function at(e){let t=document.createElement(`canvas`);t.width=z*V,t.height=B*V;let n=t.getContext(`2d`);if(!n)return t;n.scale(V,V);let r=n.createLinearGradient(0,0,z,B);r.addColorStop(0,`#ffffff`),r.addColorStop(.55,`#fafaf6`),r.addColorStop(1,`#f2f2ec`),n.fillStyle=r,n.fillRect(0,0,z,B);let i=U($e(e.id));n.fillStyle=`rgba(0, 0, 0, 0.035)`;for(let e=0;e<1200;e+=1)n.globalAlpha=.12+i()*.14,n.fillRect(i()*z,i()*B,.7,.7);n.globalAlpha=1,n.fillStyle=`rgba(0, 0, 0, 0.78)`,n.font=`700 18px 'Courier New', monospace`,n.textAlign=`center`,n.fillText(`CODESESH MART`,z/2,34),n.font=`11px 'Courier New', monospace`,n.fillText(rt(n,tt(e.tags).toUpperCase(),z-36),z/2,51),n.strokeStyle=`rgba(0, 0, 0, 0.5)`,n.lineWidth=1,n.setLineDash([4,4]),n.beginPath(),n.moveTo(18,66),n.lineTo(z-18,66),n.stroke(),n.setLineDash([]),n.textAlign=`left`,n.fillStyle=`rgba(0, 0, 0, 0.74)`,n.font=`11px 'Courier New', monospace`,W(n,`Agent`,e.agent,88,z),W(n,`Updated`,Qe(e.updatedAt),104,z),W(n,`Session`,`#${e.id.slice(0,8)}`,120,z),n.setLineDash([2,3]),n.beginPath(),n.moveTo(18,140),n.lineTo(z-18,140),n.stroke(),n.setLineDash([]),n.font=`700 12px 'Courier New', monospace`,n.fillText(`SESSION TOC RECEIPT LIST`,18,163),n.font=`11px 'Courier New', monospace`;let a=185;for(let t of e.items){let e=H(t.count);n.fillText(rt(n,t.label,168),18,a),n.fillText(e,z-18-n.measureText(e).width,a),a+=17}return n.strokeStyle=`rgba(0, 0, 0, 0.62)`,n.lineWidth=1.5,n.beginPath(),n.moveTo(18,a+5),n.lineTo(z-18,a+5),n.stroke(),a+=26,W(n,`Input tokens`,H(e.stats.total_input_tokens),a,z),a+=16,W(n,`Output tokens`,H(e.stats.total_output_tokens),a,z),a+=16,W(n,`Messages`,H(e.stats.message_count),a,z),a+=22,n.font=`700 13px 'Courier New', monospace`,W(n,`TOTAL COST`,Ze(e.stats.total_cost),a,z),n.strokeStyle=`rgba(0, 0, 0, 0.45)`,n.setLineDash([4,4]),n.beginPath(),n.moveTo(18,a+18),n.lineTo(z-18,a+18),n.stroke(),n.setLineDash([]),n.font=`10px 'Courier New', monospace`,n.textAlign=`center`,n.fillStyle=`rgba(0, 0, 0, 0.62)`,it(n,e.title,z-36,2).forEach((e,t)=>{n.fillText(e,z/2,a+38+t*13)}),t}function G(e,t){return e*L+t}function ot(e){let{receiptWidth:t,receiptHeight:n,startX:r,startY:i}=e,a=t/(L-1),o=n/(R-1),s=[],c=[];for(let e=0;e<R;e+=1)for(let t=0;t<L;t+=1){let n=r+t*a,c=i+e*o;s.push({x:n,y:c,oldX:n,oldY:c,fixedX:e===0?n:null,fixedY:e===0?c:null})}let l=(e,t,n)=>{let r=s[e],i=s[t];!r||!i||c.push({a:e,b:t,length:Math.hypot(i.x-r.x,i.y-r.y),stiffness:n})};for(let e=0;e<R;e+=1)for(let t=0;t<L;t+=1){let n=G(e,t);t<L-1&&l(n,G(e,t+1),.98),e<R-1&&l(n,G(e+1,t),.92),e<R-1&&t<L-1&&(l(n,G(e+1,t+1),.46),l(G(e+1,t),G(e,t+1),.46)),t<L-2&&l(n,G(e,t+2),.35),e<R-2&&l(n,G(e+2,t),.28)}return{particles:s,constraints:c,receiptWidth:t,receiptHeight:n}}function st(e,t){let n=t.receiptWidth/(L-1);for(let r=0;r<L;r+=1){let i=e[r];i&&(i.fixedX=t.startX+r*n,i.fixedY=t.startY)}}function ct(e){for(let t=0;t<L;t+=1){let n=e[t];!n||n.fixedX==null||n.fixedY==null||(n.x=n.fixedX,n.y=n.fixedY,n.oldX=n.fixedX,n.oldY=n.fixedY)}}function lt(e,t){let n=e[t.a],r=e[t.b];if(!n||!r)return;let i=r.x-n.x,a=r.y-n.y,o=Math.hypot(i,a);if(o<1e-4)return;let s=(o-t.length)/o*t.stiffness,c=n.fixedX!=null&&n.fixedY!=null,l=r.fixedX!=null&&r.fixedY!=null,u=c?0:l?1:.5,d=l?0:c?1:.5,f=i*s,p=a*s;c||(n.x+=f*u,n.y+=p*u),l||(r.x-=f*d,r.y-=p*d)}function ut(e,t,n,r,i){let a=n[G(r,i)],o=n[G(r,i+1)],s=n[G(r+1,i)],c=n[G(r+1,i+1)];if(!a||!o||!s||!c)return;let l=i/(L-1)*t.width,u=r/(R-1)*t.height,d=t.width/(L-1),f=t.height/(R-1);e.save(),e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(o.x,o.y),e.lineTo(c.x,c.y),e.lineTo(s.x,s.y),e.closePath(),e.clip(),e.transform((o.x-a.x)/d,(o.y-a.y)/d,(s.x-a.x)/f,(s.y-a.y)/f,a.x,a.y),e.drawImage(t,l,u,d+1,f+1,0,0,d+1,f+1),e.restore();let p=Math.atan2(o.y-a.y,o.x-a.x),m=Math.hypot(s.x-a.x,s.y-a.y)/(B/(R-1)),h=Math.sin(p)*.08+(m-1)*.16;Math.abs(h)<.01||(e.save(),e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(o.x,o.y),e.lineTo(c.x,c.y),e.lineTo(s.x,s.y),e.closePath(),e.fillStyle=h>0?`rgba(255,255,255,${h})`:`rgba(0,0,0,${-h})`,e.fill(),e.restore())}function dt(e,t,n){let r=null,i=44;for(let a=L;a<e.length;a+=1){let o=e[a];if(!o)continue;let s=Math.hypot(o.x-t,o.y-n);s<i&&(i=s,r=a)}return r}function ft({session:e,toc:t}){let n=(0,j.useRef)(null),r=(0,j.useRef)(null),i=(0,j.useRef)(null),a=(0,j.useMemo)(()=>nt(e,t),[e,t]);return(0,j.useLayoutEffect)(()=>{let e=n.current,t=r.current,o=i.current;if(!e||!t||!o)return;let s=e.getContext(`2d`,{alpha:!0});if(!s)return;let c={id:null,x:0,y:0,prevX:0,prevY:0,vx:0,vy:0,grabbedIndex:null},l=at(a),u=0,d=0,f=0,p=ot({receiptWidth:z,receiptHeight:B,startX:0,startY:32}),m=performance.now(),h=null,g=0,_=!1,ee=()=>{let e=t.getBoundingClientRect(),n=Math.max(280,e.width||320),r=Math.min(z,n-34);return{receiptWidth:r,receiptHeight:Math.min(B,Math.max(320,f-e.top-42)),startX:e.left+(e.width-r)/2,startY:e.top+32}},v=t=>{_!==t&&(_=t,e.style.visibility=t?`visible`:`hidden`,o.style.visibility=t?`visible`:`hidden`)},te=(e,t=performance.now())=>{p=ot(e),h=e,m=t},y=()=>{let t=window.devicePixelRatio||1;d=Math.max(1,window.innerWidth),f=Math.max(1,window.innerHeight),e.width=Math.floor(d*t),e.height=Math.floor(f*t),s.setTransform(t,0,0,t,0,0),g=0,v(!1),te(ee())},b=e=>({x:e.clientX,y:e.clientY}),ne=e=>{if(e.button!==0)return;let t=b(e),n=dt(p.particles,t.x,t.y);n!=null&&(e.preventDefault(),o.setPointerCapture(e.pointerId),c.id=e.pointerId,c.x=t.x,c.y=t.y,c.prevX=t.x,c.prevY=t.y,c.vx=0,c.vy=0,c.grabbedIndex=n)},x=e=>{if(c.id!==e.pointerId)return;let t=b(e);c.vx=t.x-c.prevX,c.vy=t.y-c.prevY,c.prevX=t.x,c.prevY=t.y,c.x=t.x,c.y=t.y},re=e=>{if(c.id!==e.pointerId)return;let t=c.grabbedIndex==null?null:p.particles[c.grabbedIndex];t&&(t.oldX=t.x-c.vx*.9,t.oldY=t.y-c.vy*.9),c.id=null,c.grabbedIndex=null},S=e=>{let t=(e-m)/1e3;for(let e=L;e<p.particles.length;e+=1){let n=p.particles[e];if(!n)continue;let r=(n.x-n.oldX)*.985,i=(n.y-n.oldY)*.985;n.oldX=n.x,n.oldY=n.y,n.x+=r+Math.sin(t*1.7+e*.19)*.018,n.y+=i+.22}let n=c.grabbedIndex==null?null:p.particles[c.grabbedIndex];n&&(n.x+=(c.x-n.x)*.72,n.y+=(c.y-n.y)*.72)},ie=()=>{for(let e=0;e<Xe;e+=1){ct(p.particles);for(let e of p.constraints)lt(p.particles,e)}ct(p.particles)},ae=()=>{let e=1/0,t=1/0,n=-1/0,r=-1/0;for(let i of p.particles)e=Math.min(e,i.x),t=Math.min(t,i.y),n=Math.max(n,i.x),r=Math.max(r,i.y);o.style.transform=`translate3d(${e-20}px, ${t-20}px, 0)`,o.style.width=`${n-e+40}px`,o.style.height=`${r-t+40}px`},oe=()=>{let e=p.particles[0],t=p.particles[L-1],n=p.particles[R*L-1],r=p.particles[(R-1)*L];!e||!t||!n||!r||(s.save(),s.shadowColor=`rgba(0,0,0,0.24)`,s.shadowBlur=24,s.shadowOffsetY=16,s.fillStyle=`rgba(0,0,0,0.14)`,s.beginPath(),s.moveTo(e.x,e.y),s.lineTo(t.x,t.y),s.lineTo(n.x,n.y),s.lineTo(r.x,r.y),s.closePath(),s.fill(),s.restore())},se=()=>{let e=p.particles[0],t=p.particles[L-1];!e||!t||(s.save(),s.strokeStyle=`rgba(0,0,0,0.72)`,s.lineWidth=4,s.lineCap=`round`,s.beginPath(),s.moveTo(e.x-10,e.y-3),s.lineTo(t.x+10,t.y-3),s.stroke(),s.strokeStyle=`rgba(255,255,255,0.55)`,s.lineWidth=1,s.beginPath(),s.moveTo(e.x-8,e.y-5),s.lineTo(t.x+8,t.y-5),s.stroke(),s.restore())},ce=()=>{s.clearRect(0,0,d,f),oe();for(let e=0;e<R-1;e+=1)for(let t=0;t<L-1;t+=1)ut(s,l,p.particles,e,t);se(),ae()},le=e=>{let t=ee();Ye(h,t)&&c.id==null?(g=0,v(!1),te(t,e)):(g+=1,h=t),st(p.particles,t),S(e),ie(),ce(),g>=2&&v(!0),u=window.requestAnimationFrame(le)};v(!1),y();let ue=new ResizeObserver(y);return ue.observe(t),window.addEventListener(`resize`,y),o.addEventListener(`pointerdown`,ne),o.addEventListener(`pointermove`,x),o.addEventListener(`pointerup`,re),o.addEventListener(`pointercancel`,re),u=window.requestAnimationFrame(le),()=>{window.cancelAnimationFrame(u),ue.disconnect(),window.removeEventListener(`resize`,y),o.removeEventListener(`pointerdown`,ne),o.removeEventListener(`pointermove`,x),o.removeEventListener(`pointerup`,re),o.removeEventListener(`pointercancel`,re)}},[a]),(0,P.jsx)(`aside`,{className:`hidden xl:block`,children:(0,P.jsxs)(`div`,{ref:r,className:`sticky top-4 h-[560px]`,children:[(0,P.jsx)(`canvas`,{ref:n,className:`invisible pointer-events-none fixed inset-0 z-40 block h-screen w-screen touch-none`,"aria-hidden":`true`}),(0,P.jsx)(`div`,{ref:i,className:`invisible fixed left-0 top-0 z-40 cursor-grab touch-none active:cursor-grabbing`,"aria-label":`Interactive thermal receipt with Verlet paper simulation`})]})})}var pt={a:({children:e})=>(0,P.jsx)(`span`,{className:`console-markdown-link`,children:e})};function mt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ht(e){let t=e?.trim();if(!t)return null;let n=Array.from(new Set((t.match(/"[^"]+"|\S+/g)??[]).map(e=>e.replace(/^"|"$/g,``).trim()).filter(Boolean).filter(e=>!/^OR$/i.test(e))));return n.length===0?null:RegExp(`(${n.map(mt).join(`|`)})`,`gi`)}function K({text:e,highlightQuery:t}){let r=(0,j.useRef)(null),i=(0,j.useMemo)(()=>ht(t),[t]);return(0,j.useEffect)(()=>{let e=r.current;if(!e||!i)return;let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];for(;t.nextNode();){let e=t.currentNode;if(!(e instanceof Text))continue;let r=e.parentElement;r&&(r.closest(`mark, pre, code`)||e.textContent?.trim()&&n.push(e))}for(let e of n){let t=e.textContent??``;if(i.lastIndex=0,!i.test(t))continue;let n=document.createDocumentFragment(),r=0;i.lastIndex=0;for(let e of t.matchAll(i)){let i=e.index??0,a=e[0]??``;i>r&&n.append(t.slice(r,i));let o=document.createElement(`mark`);o.textContent=a,n.append(o),r=i+a.length}r<t.length&&n.append(t.slice(r)),e.parentNode?.replaceChild(n,e)}},[i,e]),(0,P.jsx)(`div`,{ref:r,children:(0,P.jsx)(n,{components:pt,children:e})})}function q(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(e=>{if(typeof e==`string`)return e;if(e&&typeof e==`object`){let t=e,n=q(t.text);if(n.trim())return n;let r=q(t.content);if(r.trim())return r}return``}).filter(Boolean).join(`
|
|
2
|
+
|
|
3
|
+
`);if(e&&typeof e==`object`){let t=e,n=q(t.text);if(n.trim())return n;let r=q(t.content);if(r.trim())return r}return``}function gt(e){return e.type===`tool`||e.type===`plan`?!0:e.type===`text`||e.type===`reasoning`?!!q(e.text).trim():!1}function _t(e){return e.reduce((e,t)=>{if(!gt(t))return e;let n=e.at(-1);return t.type!==`plan`&&n?.type===t.type?(n.parts.push(t),e):(e.push({type:t.type,parts:[t]}),e)},[])}function vt(e){return _t(e.parts).length>0}var J=`<turn_aborted>
|
|
4
|
+
The user interrupted the previous turn on purpose. Any running unified exec processes were terminated. If any tools/commands were aborted, they may have partially executed; verify current state before retrying.
|
|
5
|
+
</turn_aborted>`;function yt(e){return e.replace(/\r\n/g,`
|
|
6
|
+
`).trim()}function bt(e,t){if(t.toLowerCase()!==`codex`||e.role!==`user`||e.parts.length!==1)return!1;let[n]=e.parts;return!n||n.type!==`text`||typeof n.text!=`string`?!1:yt(n.text)===yt(J)}function xt(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function St(e){return typeof e==`string`?e:``}function Ct(e){return e.replace(/\\n/g,`
|
|
7
|
+
`)}function wt(e){let t=xt(e),n=St(t.type);return n?{type:n,path:St(t.path),oldPath:St(t.old_path),targetPath:St(t.targetPath),content:St(t.content)||St(xt(t.input).content)}:null}function Tt(e){return(Array.isArray(e)?e:Array.isArray(xt(e).content)?xt(e).content:[]).map(e=>wt(e)).filter(e=>e!=null)}function Et(e,t,n){return`${e} ${e===1?t:n}`}function Dt(e){let t=e.filter(e=>e.type===`write_file`).length,n=e.filter(e=>e.type===`edit_file`).length,r=e.filter(e=>e.type===`delete_file`).length,i=e.filter(e=>e.type===`move_file`).length,a=[];return t>0&&a.push(Et(t,`write`,`writes`)),n>0&&a.push(Et(n,`edit`,`edits`)),r>0&&a.push(Et(r,`delete`,`deletes`)),i>0&&a.push(Et(i,`move`,`moves`)),a.join(` · `)}function Ot(e){return e.targetPath||e.path||e.oldPath||e.type}function kt(e,t){return e.reduce((e,n)=>n.type===`write_file`?(e.push({label:Ot(n),operation:`write`,language:t(n.path),isCode:!0,text:Ct(n.content)}),e):n.type===`edit_file`?(e.push({label:Ot(n),operation:`edit`,language:`diff`,isCode:!0,text:Ct(n.content)}),e):n.type===`delete_file`?(e.push({label:Ot(n),operation:`edit`,language:`text`,isCode:!1,text:`File deleted.`}),e):(n.type===`move_file`&&e.push({label:Ot(n),operation:`edit`,language:`text`,isCode:!1,text:n.targetPath&&n.path?`Moved from ${n.path} to ${n.targetPath}`:n.oldPath?`Moved from ${n.oldPath}`:`File moved.`}),e),[])}function At(e,t,n){let r=kt(e,n);return r.length>0?{kind:`file-sections`,sections:r}:{kind:`plain`,text:t,language:`text`,isCode:!1}}function jt(e){if(typeof e==`string`)return e.trim();if(Array.isArray(e))return e.map(e=>jt(e)).filter(Boolean).join(`
|
|
8
|
+
|
|
9
|
+
`).trim();if(e&&typeof e==`object`){let t=e,n=jt(t.text);if(n)return n;let r=jt(t.content);if(r)return r}return``}function Mt(e){let t=e.approval_status===`fail`?`fail`:`success`,n=jt(t===`fail`?e.output:e.input);return{title:`plan`,secondaryText:void 0,approvalStatus:t,expandable:!!n,contentLabel:t===`fail`?`Rejected`:`Plan`,contentMarkdown:n}}function Nt(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Pt(e){return typeof e==`string`?e.trim():``}function Ft(e){return typeof e==`string`?e:``}function It(e){return typeof e==`string`?e.trim():typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`?`${e}`:``}function Lt(e){return e.replace(/\\n/g,`
|
|
10
|
+
`)}function Rt(e){return e.replace(/\s*\(Recommended\)\s*$/i,``).trim()}function zt(e){let t=e.trim();return{label:Rt(t),recommended:/\(Recommended\)\s*$/i.test(t)}}function Bt(e){return e.replace(/\s+/g,` `).trim()}function Vt(e,t=88){let n=Bt(e);return n?n.length>t?`${n.slice(0,t)}...`:n:``}function Ht(e,t){return Vt([`${t} questions`,...e.filter(Boolean).slice(0,2)].join(` · `),96)}function Ut(e){try{return JSON.parse(e)}catch{return null}}function Wt(e){let t=Lt(e).split(`
|
|
11
|
+
`);if(t.length<5||!(/^Chunk ID:\s+\S+/.test(t[0]||``)&&/^Wall time:\s+/.test(t[1]||``)&&/^Process (?:exited with code \d+|running with session ID \d+)/.test(t[2]||``)&&/^Original token count:\s+\d+/.test(t[3]||``)&&/^Output:$/.test(t[4]||``)))return e;let n=5;for(;n<t.length&&t[n]?.trim()===``;)n+=1;let r=t.slice(n).join(`
|
|
12
|
+
`);return r.trim()?r:e}function Gt(e,t,n){n.trim()&&e.push({label:t,value:n})}function Kt(e){return e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`)?e.slice(1,-1):e}function qt(e){return e.trim()?!/[|&;<>()$`*?{}[\]\\]/.test(e):!1}function Jt(e){let t=Kt(e.trim());return qt(t)?t:null}function Yt(e){let t=e.trim();if(!t)return null;let n=t.match(/^nl\s+-ba\s+([^\s]+)\s*\|\s*sed\s+-n\s+['"][^'"]+['"]$/);if(n)return Jt(n[1]||``);for(let e of[/^cat\s+([^\s]+)$/,/^sed\s+-n\s+['"][^'"]+['"]\s+([^\s]+)$/,/^head\s+-n\s+\d+\s+([^\s]+)$/,/^tail\s+-n\s+\d+\s+([^\s]+)$/]){let n=t.match(e);if(n)return Jt(n[1]||``)}return null}function Xt(e){let t=e.split(`
|
|
13
|
+
`),n=t.filter(e=>e.trim());if(n.length===0)return e;let r=/^\s*\d+(?:\t|\|\s?)/;return n.filter(e=>r.test(e)).length/n.length<.6?e:t.map(e=>e.replace(/^\s*\d+(?:\t|\|\s?)/,``)).join(`
|
|
14
|
+
`)}function Zt(e){return/\b(Test Files|Tests|Coverage report|coverage: platform|Ran \d+ tests)\b/.test(e)||/^(PASS|FAIL|stdout\s+\|)/m.test(e)||/\bmodules transformed\b/.test(e)}function Qt(e){let t=e.trim();return!t||Zt(t)?null:(t.startsWith(`{`)||t.startsWith(`[`))&&Ut(t)!=null?`json`:/<(!DOCTYPE html|html\b|body\b|div\b|span\b|main\b|section\b|svg\b|\/[a-z])/i.test(t)?`markup`:[/^#{1,6}\s/m,/^[-*]\s/m,/^\d+\.\s/m,/^```/m].filter(e=>e.test(t)).length>=1&&!/[{};]\s*$/.test(t)?`markdown`:(t.match(/^[A-Za-z0-9_-]+:\s.+$/gm)||[]).length>=2&&!/\b(import|export|const|let|function|class)\b/.test(t)&&!/[{}()[\];]/.test(t)?`yaml`:[/^(from\s+\S+\s+import\s+.+|import\s+\S+)/m,/^def\s+\w+\(/m,/^class\s+\w+[:(]/m].filter(e=>e.test(t)).length>=2||/^(from\s+\S+\s+import\s+.+|import\s+\S+)/m.test(t)&&/^def\s+\w+\(/m.test(t)?`python`:[/\binterface\s+\w+/,/\btype\s+\w+\s*=/,/\bimplements\b/,/\bas const\b/,/:\s*[A-Z][A-Za-z0-9_<>,[\] |&?]+/].filter(e=>e.test(t)).length>=1&&/\b(import|export|const|let|function|class)\b/.test(t)?`typescript`:[/^\s*import\s.+from\s/m,/^\s*export\s/m,/\b(const|let|function|class)\b/].filter(e=>e.test(t)).length>=2?`javascript`:null}function $t(e,t,n){let r=Wt(t),i=Yt(e);if(i){let e=n(i);return{text:Xt(r),language:e,isCode:e!==`text`,sourcePath:i,confidence:`path`}}let a=Qt(r);return a?{text:r,language:a,isCode:!0,confidence:`content`}:{text:r,language:`text`,isCode:!1,confidence:`plain`}}function en(e,t,n){let r=Nt(e),i=Pt(r.cmd),a=Pt(r.workdir),o=Pt(r.sandbox_permissions),s=Pt(r.justification),c=[];Gt(c,`Command`,i),Gt(c,`Workdir`,a),Gt(c,`Escalation`,o),Gt(c,`Justification`,s);let l=Vt(i);return{secondaryText:s?[s,l].filter(Boolean).join(`
|
|
15
|
+
`):l||void 0,details:c,outputAnalysis:$t(i,t,n)}}function tn(e,t,n){let r=Nt(e),i=It(r.session_id),a=Ft(r.chars),o=a?`stdin`:`poll`,s=[];return Gt(s,`Session`,i),s.push({label:`Chars`,value:a||`(empty)`}),{secondaryText:i?`session #${i} · ${o}`:o,details:s,outputAnalysis:$t(``,t,n)}}function nn(e,t){let n=Nt(e),r=Array.isArray(n.questions)?n.questions:null;if(!r||r.length===0)return{secondaryText:void 0,details:[],outputContent:{kind:`plain`,text:t,language:`text`,isCode:!1}};let i=Nt(Ut(t)?.answers),a=r.map(e=>{let t=Nt(e),n=Nt(i[Pt(t.id)]),r=(Array.isArray(n.answers)?n.answers:[]).map(e=>typeof e==`string`?Rt(e):``).filter(Boolean),a=Array.isArray(t.options)?t.options.map(e=>{let t=Nt(e),n=zt(Pt(t.label));return n.label?{label:n.label,description:Pt(t.description)||void 0,recommended:n.recommended||void 0}:null}).filter(e=>e!=null):[],o=Pt(t.question);return o?{header:Pt(t.header)||void 0,question:o,options:a,answers:r}:null}).filter(e=>e!=null);return a.length===0?{secondaryText:void 0,details:[],outputContent:{kind:`plain`,text:t,language:`text`,isCode:!1}}:{secondaryText:Ht(a.map(e=>e.header||``),a.length),details:[],outputContent:{kind:`question-list`,questions:a}}}function rn(e){return typeof e.title==`string`&&e.title.trim()?e.title.trim().replace(/^tool:\s*/i,``):typeof e.tool==`string`&&e.tool.trim()?e.tool.trim():`tool`}function an(e){return(typeof e.tool==`string`&&e.tool.trim()?e.tool:rn(e)).trim().toLowerCase()}function on(e,t){let n=an(t),r=`tool:${n}`,i=e.get(n);if(i){i.count+=1;return}e.set(n,{id:r,toolKey:n,label:rn(t),count:1})}function sn(e){let t={user:0,agent_message:0,thinking:0,plan:0,tools_all:0},n=new Set,r=new Map;for(let i of e){let e=_t(i.parts);for(let a of e){if(i.role===`user`){t.user+=1,n.add(`user`);continue}if(a.type===`text`){t.agent_message+=1,n.add(`agent_message`);continue}if(a.type===`reasoning`){t.thinking+=1,n.add(`thinking`);continue}if(a.type===`plan`){t.plan+=1,n.add(`plan`);continue}t.tools_all+=a.parts.length,n.add(`tools_all`);for(let e of a.parts)on(r,e),n.add(`tool:${an(e)}`)}}return{filterIds:n,counts:t,tools:[...r.values()].toSorted((e,t)=>e.label.localeCompare(t.label))}}function cn(e,t){return t.has(`tools_all`)?t.has(`tool:${an(e)}`):!1}function ln(e,t,n){return t.role===`user`?n.has(`user`):e.type===`text`?n.has(`agent_message`):e.type===`reasoning`?n.has(`thinking`):e.type===`plan`?n.has(`plan`):e.parts.some(e=>cn(e,n))}function un(e,t){let n=e.parts.filter(e=>cn(e,t));return n.length===0?null:{...e,parts:n}}function dn(e,t){return e.map(e=>{let n=_t(e.parts).filter(n=>ln(n,e,t)).map(e=>e.type===`tool`?un(e,t):e).filter(e=>e!=null);return n.length===0?null:{msg:e,blocks:n}}).filter(e=>e!=null)}var fn={".bashrc":`bash`,".zshrc":`bash`,".profile":`bash`,dockerfile:`docker`,".env":`ini`},pn={ts:`typescript`,tsx:`tsx`,js:`javascript`,jsx:`jsx`,py:`python`,sql:`sql`,rs:`rust`,go:`go`,java:`java`,c:`c`,h:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,hpp:`cpp`,cs:`csharp`,sh:`bash`,bash:`bash`,zsh:`bash`,html:`html`,css:`css`,yaml:`yaml`,yml:`yaml`,json:`json`,md:`markdown`,toml:`toml`,conf:`ini`,xml:`markup`,svg:`markup`,properties:`ini`,dockerfile:`docker`};function Y(e){let t=e.split(`/`).pop()?.toLowerCase()??``;if(!t)return`text`;let n=fn[t];if(n)return n;if(t.startsWith(`.env.`))return`ini`;let r=t.includes(`.`)?t.split(`.`).pop()??``:``;return r&&pn[r]||`text`}T.registerLanguage(`bash`,he),T.registerLanguage(`c`,je),T.registerLanguage(`cpp`,_e),T.registerLanguage(`csharp`,A),T.registerLanguage(`css`,Ae),T.registerLanguage(`docker`,E),T.registerLanguage(`go`,O),T.registerLanguage(`ini`,be),T.registerLanguage(`java`,Ce),T.registerLanguage(`javascript`,Te),T.registerLanguage(`jsx`,ye),T.registerLanguage(`json`,D),T.registerLanguage(`markdown`,ke),T.registerLanguage(`markup`,Se),T.registerLanguage(`python`,ve),T.registerLanguage(`rust`,De),T.registerLanguage(`sql`,we),T.registerLanguage(`toml`,ge),T.registerLanguage(`tsx`,xe),T.registerLanguage(`typescript`,Ee),T.registerLanguage(`yaml`,k);function mn(e){return e===`html`||e===`xml`?`markup`:e}function hn({language:e,text:t}){return(0,P.jsx)(T,{language:mn(e),style:Oe,customStyle:{margin:0,padding:`0.75rem`,borderRadius:0,background:`transparent`,fontSize:`0.75rem`,lineHeight:1.55},codeTagProps:{className:`console-mono`},wrapLongLines:!0,children:t})}function gn(e,t){return`${e}:${t}`}function _n(e){return/^(Index:|diff\s|===)/.test(e)?`text-[var(--console-text)] bg-[#f3f4f6]`:e.startsWith(`@@`)?`text-[#7c3aed] bg-[#f5f3ff]`:e.startsWith(`+++ `)||e.startsWith(`--- `)?`text-[#1d4ed8] bg-[#eff6ff]`:e.startsWith(`+`)?`text-[#15803d] bg-[#f0fdf4]`:e.startsWith(`-`)?`text-[#b91c1c] bg-[#fef2f2]`:`text-[var(--console-text)]`}function vn({text:e}){let t=e.split(`
|
|
16
|
+
`),n=new Map;return(0,P.jsx)(`pre`,{className:`console-mono max-h-[420px] overflow-auto whitespace-pre rounded-sm border border-[var(--console-border)] bg-[#fafafa] p-3 text-xs leading-relaxed`,children:t.map(e=>{let t=n.get(e)??0;return n.set(e,t+1),(0,P.jsx)(`span`,{className:`block rounded-[2px] px-1 ${_n(e)}`,children:e||` `},gn(e,t))})})}function yn(e){let t=e.text||`No output captured.`;return!e.isCode||e.language===`text`?(0,P.jsx)(`pre`,{className:`console-mono max-h-[420px] overflow-auto whitespace-pre-wrap break-all p-3 text-xs leading-relaxed text-[var(--console-text)]`,children:t}):e.language===`diff`?(0,P.jsx)(vn,{text:t}):(0,P.jsx)(`div`,{className:`max-h-[420px] overflow-auto bg-[#fafafa]`,children:(0,P.jsx)(hn,{language:e.language,text:t})})}function bn({sections:e}){return(0,P.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,P.jsxs)(`div`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-[#fafafa]`,children:[(0,P.jsx)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-1.5`,children:(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-white px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-[var(--console-muted)]`,children:e.operation}),(0,P.jsx)(`span`,{className:`console-mono text-[11px] font-semibold text-[var(--console-muted)]`,children:e.label})]})}),yn(e)]},`${e.operation}:${e.label}:${e.language}`))})}function xn({questions:e}){return(0,P.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,P.jsxs)(`div`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-[#fafafa]`,children:[(0,P.jsxs)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-2`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e.header?(0,P.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-white px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-[var(--console-muted)]`,children:e.header}):null,e.answers.length>0?(0,P.jsx)(`span`,{className:`console-mono text-[11px] font-semibold text-[var(--console-success)]`,children:`Answered`}):(0,P.jsx)(`span`,{className:`console-mono text-[11px] font-semibold text-[var(--console-muted)]`,children:`Pending`})]}),(0,P.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-[var(--console-text)]`,children:e.question})]}),(0,P.jsx)(`div`,{className:`space-y-2 p-3`,children:e.options.map(t=>{let n=e.answers.includes(t.label);return(0,P.jsxs)(`div`,{className:`rounded-sm border px-3 py-2 ${n?`border-[var(--console-success-border)] bg-[var(--console-success-bg)]`:`border-[var(--console-border)] bg-white`}`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`console-mono text-xs font-semibold ${n?`text-[var(--console-success)]`:`text-[var(--console-text)]`}`,children:t.label}),t.recommended?(0,P.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-1.5 py-0.5 text-[10px] text-[var(--console-muted)]`,children:`Recommended`}):null,n?(0,P.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-success-border)] bg-white px-1.5 py-0.5 text-[10px] text-[var(--console-success)]`,children:`Selected`}):null]}),t.description?(0,P.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-[var(--console-muted)]`,children:t.description}):null]},`${e.question}:${t.label}`)})})]},`${e.header??`question`}:${e.question}`))})}function Sn(e){return`${e.label}:${e.lines.map(e=>`${e.type}:${e.text}`).join(`
|
|
17
|
+
`)}`}function Cn(e){return e===`add`?`text-[#15803d] bg-[#f0fdf4]`:e===`remove`?`text-[#b91c1c] bg-[#fef2f2]`:`text-[var(--console-text)]`}function wn({blocks:e}){return(0,P.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>{let t=new Map;return(0,P.jsxs)(`div`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-[#fafafa]`,children:[(0,P.jsx)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-1.5`,children:(0,P.jsx)(`span`,{className:`console-mono text-[11px] font-semibold text-[var(--console-muted)]`,children:e.label})}),(0,P.jsx)(`pre`,{className:`console-mono max-h-[280px] overflow-auto whitespace-pre p-3 text-xs leading-relaxed`,children:e.lines.map(e=>{let n=`${e.type}:${e.text}`,r=t.get(n)??0;return t.set(n,r+1),(0,P.jsxs)(`span`,{className:`block rounded-[2px] px-1 ${Cn(e.type)}`,children:[e.type===`add`?`+`:e.type===`remove`?`-`:` `,e.text||` `]},`${n}:${r}`)})})]},Sn(e))})})}function Tn({outputContent:e}){if(e.kind===`structured-diff`)return(0,P.jsx)(wn,{blocks:e.blocks});if(e.kind===`file-sections`)return(0,P.jsx)(bn,{sections:e.sections});if(e.kind===`question-list`)return(0,P.jsx)(xn,{questions:e.questions});let t=e.text||`No output captured.`;return!e.isCode||e.language===`text`?(0,P.jsx)(`pre`,{className:`console-mono max-h-[420px] overflow-auto whitespace-pre-wrap break-all rounded-sm border border-[var(--console-border)] bg-[#fafafa] p-3 text-xs leading-relaxed text-[var(--console-text)]`,children:t}):e.language===`diff`?(0,P.jsx)(vn,{text:t}):(0,P.jsx)(`div`,{className:`max-h-[420px] overflow-auto rounded-sm border border-[var(--console-border)] bg-[#fafafa]`,children:(0,P.jsx)(hn,{language:e.language,text:t})})}var En={completed:{label:`Success`,className:`border-[var(--console-success-border)] bg-[var(--console-success-bg)] text-[var(--console-success)]`,icon:c},error:{label:`Failed`,className:`border-[var(--console-error-border)] bg-[var(--console-error-bg)] text-[var(--console-error)]`,icon:w},running:{label:`Running`,className:`border-[var(--console-warning-border)] bg-[var(--console-warning-bg)] text-[var(--console-warning)]`,icon:ae}};function Dn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function On(e){let t=e?.trim();if(!t)return null;let n=Array.from(new Set((t.match(/"[^"]+"|\S+/g)??[]).map(e=>e.replace(/^"|"$/g,``).trim()).filter(Boolean).filter(e=>!/^OR$/i.test(e))));return n.length===0?null:RegExp(`(${n.map(Dn).join(`|`)})`,`gi`)}function kn(e,t){let n=On(t);return n?e.split(n).map((e,t)=>e.match(n)?(0,P.jsx)(`mark`,{children:e},`${e}-${t}`):(0,P.jsx)(`span`,{children:e},`${e}-${t}`)):e}function An({text:e,highlightQuery:t}){return(0,P.jsx)(K,{text:e,highlightQuery:t})}function jn(e){if(e==null)return``;if(typeof e==`string`){let t=e.trim();if(!t)return``;try{let e=JSON.parse(t);return JSON.stringify(e,null,2)}catch{return e}}try{return JSON.stringify(e,null,2)}catch{return typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`?`${e}`:typeof e==`symbol`?e.description?`Symbol(${e.description})`:`Symbol`:typeof e==`function`?`[Function]`:`[Unserializable value]`}}function Mn(e){if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}}function Nn(e){if(typeof e==`string`)return[e];if(Array.isArray(e))return e.flatMap(e=>Nn(e));if(e&&typeof e==`object`){let t=e;if(typeof t.text==`string`)return[t.text];if(t.content!==void 0)return Nn(t.content)}return[]}function Pn(e){return e.replace(/^<system>/i,``).replace(/<\/system>$/i,``).trim()}function Fn(e,t=!0){let n=Nn(e).map(e=>e.trim()).filter(e=>t?!!e:!!e&&!/^<system>[\s\S]*<\/system>$/i.test(e));return n.length===0?``:n.map(e=>t&&/^<system>[\s\S]*<\/system>$/i.test(e)?Pn(e):e).join(`
|
|
18
|
+
`)}function In(e){let t=Mn(e);if(t&&typeof t==`object`){let e=t;if(typeof e.cmd==`string`)return e.cmd;if(typeof e.command==`string`)return e.command}return``}function Ln(e){return typeof e==`string`?e.trim():``}function X(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Z(e){return typeof e==`string`?e.trim():``}function Rn(e){return typeof e==`string`?e:``}function zn(e){return typeof e.title==`string`&&e.title.trim()?e.title.trim().replace(/^tool:\s*/i,``):typeof e.tool==`string`&&e.tool.trim()?e.tool.trim():`tool`}function Bn(e){return zn(e).trim().toLowerCase()}function Vn(e,t){return`tool-${e}-${t}`}function Hn(e){let t=e.trim();return!t||t.length>300||t.includes(`
|
|
19
|
+
`)||/^[a-z]+:\/\//i.test(t)||/[<>{}]/.test(t)?!1:t.startsWith(`/`)||t.startsWith(`./`)||t.startsWith(`../`)||t.startsWith(`~/`)||t.includes(`/`)||t.includes(`\\`)?!0:/^[A-Za-z0-9_.@-]+\.[A-Za-z0-9_-]+$/.test(t)}function Un(e){let t=e.trim().toLowerCase();return!t||t.includes(`command`)||t.includes(`content`)||t.includes(`text`)||t.includes(`prompt`)||t.includes(`url`)||t.includes(`body`)||t.includes(`title`)||t.includes(`description`)||t===`cwd`||t===`workdir`||t===`directory`?!1:t===`path`||t===`paths`||t.includes(`file`)||t.includes(`path`)}function Wn(e,t,n,r=0){if(!(e==null||r>4)){if(typeof e==`string`){Un(t)&&Hn(e)&&n.add(e.trim());return}if(Array.isArray(e)){for(let i of e)Wn(i,t,n,r+1);return}if(typeof e==`object`)for(let[t,i]of Object.entries(e))Wn(i,t,n,r+1)}}function Gn(e){let t=new Set;return Wn(e,``,t),[...t]}function Kn(e){return e.state?.arguments??e.state?.input??e.input??null}function qn(e){let t=Bn(e);return t===`read`?`read`:t===`edit`||t===`multiedit`||t===`apply_patch`||t===`notebookedit`?`edit`:t===`write`||t===`create_file`||t===`write_file`?`write`:t===`delete`||t===`delete_file`?`delete`:null}function Jn(e){let t=new Map;for(let n of e){let e=t.get(n.path);if(e){e.count+=1,e.anchors.push({anchorId:n.anchorId,time:n.time,toolLabel:n.toolLabel}),n.time>=e.latestTime&&(e.latestTime=n.time,e.latestAnchorId=n.anchorId,e.toolLabel=n.toolLabel);continue}t.set(n.path,{path:n.path,count:1,latestTime:n.time,latestAnchorId:n.anchorId,toolLabel:n.toolLabel,anchors:[{anchorId:n.anchorId,time:n.time,toolLabel:n.toolLabel}]})}return[...t.values()].map(e=>({...e,anchors:e.anchors.toSorted((e,t)=>e.time-t.time)})).toSorted((e,t)=>t.latestTime===e.latestTime?e.path.localeCompare(t.path):t.latestTime-e.latestTime)}function Yn(e){let t=new Map,n={read:[],edit:[],write:[],delete:[]};return e.forEach((e,r)=>{let i=0;for(let a of e.parts){if(a.type!==`tool`)continue;let o=Vn(r,i);i+=1,t.set(a,o);let s=Kn(a),c=zn(a),l=a.time_created??e.time_created,u=Tt(s);if(u.length>0){for(let e of u){let t=(e.path||e.oldPath).trim();if(!t)continue;let r=e.type===`write_file`?`write`:e.type===`delete_file`?`delete`:`edit`;n[r].push({kind:r,path:t,anchorId:o,time:l,toolLabel:c})}continue}let d=qn(a);if(!d)continue;let f=Gn(s);for(let e of f)n[d].push({kind:d,path:e,anchorId:o,time:l,toolLabel:c})}}),{toolAnchorIds:t,summary:{read:Jn(n.read),edit:Jn(n.edit),write:Jn(n.write),delete:Jn(n.delete)}}}function Xn(e,t){if(!e)return t;let n={read:[],edit:[],write:[],delete:[]},r=new Map;for(let e of[`read`,`edit`,`write`,`delete`])for(let n of t[e])r.set(`${e}\0${n.path}`,n);for(let t of e){let e=r.get(`${t.kind}\0${t.path}`);n[t.kind].push({path:t.path,count:t.count,latestTime:t.latest_time,latestAnchorId:e?.latestAnchorId??``,toolLabel:e?.toolLabel??t.kind,anchors:e?.anchors??[]})}for(let e of[`read`,`edit`,`write`,`delete`])n[e].sort((e,t)=>t.latestTime===e.latestTime?e.path.localeCompare(t.path):t.latestTime-e.latestTime);return n}function Zn(e,t){return e.startsWith(`${t}/`)?e.slice(t.length+1):e}function Qn(e){if(typeof document>`u`)return;let t=document.getElementById(e);t&&t.scrollIntoView({behavior:`smooth`,block:`center`})}function $n(e){try{return JSON.parse(e)}catch{return null}}function Q(e){return e.replace(/\\n/g,`
|
|
20
|
+
`)}function er(e){let t=e.trim();return t?t.replace(/^tool:\s*/i,``):``}function tr(e,t=`Tool`){return er(Z(e.title))||Z(e.tool)||t}function nr(e){return Q(Fn(e)||jn(e))||`No output captured.`}function $(e){let t=nr(e.outputValue);if(t!==`No output captured.`)return t;let n=nr(e.errorValue);return n===`No output captured.`?`No output captured.`:n}function rr(e){let t=X(e);return Z(t.filePath)||Z(t.file_path)||Z(t.path)||Z(t.targetFile)||Z(t.effectiveUri)||Z(t.relativeWorkspacePath)||``}function ir(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:typeof e==`string`&&$n(e)||{}}function ar(e){return e.replace(/\n*<system-reminder>[\s\S]*$/i,``).trimEnd()}function or(e){let t=Fn(e,!1)||nr(e);return t===`No output captured.`?t:ar(t.replace(/^<file>\s*/i,``).replace(/\s*<\/file>\s*$/i,``)).split(`
|
|
21
|
+
`).filter(e=>!/^\(End of file - total \d+ lines\)$/.test(e.trim())).map(e=>e.replace(/^\d+\|\s?/,``).replace(/^\s*\d+\t/,``)).join(`
|
|
22
|
+
`).trimEnd()||`No output captured.`}function sr(e){let t=Rn(ir(e).contents);return t?Q(t):`No output captured.`}function cr(e){let t=ir(e),n=Array.isArray(t.directories)?t.directories:[];if(n.length===0)return nr(e);let r=n.flatMap(e=>{let t=X(e);return[Z(t.absPath),...(Array.isArray(t.files)?t.files:[]).map(e=>{let t=X(e);return Z(t.relPath)||Z(t.absPath)}).filter(Boolean).map(e=>` ${e}`)].filter(Boolean)});return r.length>0?r.join(`
|
|
23
|
+
`):`No output captured.`}function lr(e,t,n){return!t.trim()&&!n.trim()?[]:[{label:mr(e),lines:fr(s(Q(t),Q(n)))}]}function ur(e,t){let n=Q(e).split(`
|
|
24
|
+
`),r=Q(t).split(`
|
|
25
|
+
`);return[`@@`,...n.map(e=>`- ${e}`),...r.map(e=>`+ ${e}`)].join(`
|
|
26
|
+
`)}function dr(e){let t=Q(e),n=t.split(`
|
|
27
|
+
`);return t.endsWith(`
|
|
28
|
+
`)&&n.pop(),n}function fr(e){return e.flatMap(e=>{let t=e.added?`add`:e.removed?`remove`:`context`;return dr(e.value).map(e=>({type:t,text:e}))})}function pr(e){let t=X(e).edit;return Array.isArray(t)?t:t&&typeof t==`object`?[t]:[]}function mr(e){let t=e.trim();if(!t)return`edit`;let n=t.split(`/`).pop()||t;return n===t?n:`${n} · ${t}`}function hr(e,t){let n=pr(e.inputValue),r=mr(t);return n.map(e=>{let t=X(e),n=Rn(t.old),i=Rn(t.new);return!n.trim()&&!i.trim()?null:{label:r,lines:fr(s(Q(n),Q(i)))}}).filter(e=>e!=null&&e.lines.length>0)}function gr(e){let t=Rn(X(e.metadataValue).diff);if(t.trim())return Q(t);let n=pr(e.inputValue).map(e=>{let t=X(e),n=Rn(t.old),r=Rn(t.new);return!n.trim()&&!r.trim()?``:ur(n,r)}).filter(Boolean).join(`
|
|
29
|
+
|
|
30
|
+
`);return n.trim()?n:$(e)}function _r(e){let t=X(e.inputValue);if(e.status===`completed`){let e=Rn(t.content);if(e.trim())return Q(e)}return $(e)}function vr(e){let t=X(X(e.state).arguments),n=Ln(t.agent_type),r=Ln(e.nickname),i=[Ln(t.model),Ln(t.reasoning_effort)].filter(Boolean).join(`-`);return[[n,r].filter(Boolean).join(` - `),i].filter(Boolean).join(` `)}function yr(e){let t=X(e.state);return Ln(t.prompt)||Ln(X(t.arguments).message)||``}function br(e){let t=Ln(e.nickname);return e.role===`assistant`&&t?`AGENT (${t})`:e.role===`user`?`USER`:e.role===`tool`?`TOOL`:`AGENT`}function xr(e,t){if(t.toLowerCase()!==`cursor`)return e;let n=[];for(let t of e){if(t.role!==`tool`){n.push({...t,parts:[...t.parts]});continue}let e=n.at(-1);if(e?.role===`assistant`){e.parts.push(...t.parts);continue}n.push({...t,parts:[...t.parts]})}return n}function Sr(e){let t=e.state||{},n=t.status,r=n===`running`||n===`error`||n===`completed`?n:`completed`,i=t.output??t.result??``,a=t.error??``,o=Mn(t.input??t.arguments??{}),s=t.metadata??{};return{status:r,command:In(o),inputValue:o,outputValue:i,errorValue:a,metadataValue:s,inputText:jn(o)}}function Cr(e,t){let n=(t.command||t.inputText||`{}`).replace(/\s+/g,` `).trim(),r=n.length>72?`${n.slice(0,72)}...`:n;return{Icon:y,title:tr(e),secondaryText:r?`(${r})`:void 0,details:[],expandable:!0,showInputPreview:!0,outputContent:{kind:`plain`,text:$(t),language:`text`,isCode:!1}}}function wr(e,t,n){let r=Z(X(t.inputValue).name);return{...n,Icon:te,title:Z(e.tool)||`skill`,secondaryText:r||void 0,expandable:!1,showInputPreview:!1}}function Tr(e,t){let n=Cr(e,t),r=(e.tool||``).toLowerCase(),i=X(t.inputValue),a=rr(t.inputValue);if(r===`read`)return{...n,Icon:S,title:`read`,secondaryText:a||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:or(t.outputValue),language:Y(a),isCode:!0}};if(r===`edit`){let e=lr(a,Rn(i.old_string),Rn(i.new_string));return{...n,Icon:me,title:`edit`,secondaryText:a||void 0,showInputPreview:!1,outputContent:e.length>0?{kind:`structured-diff`,blocks:e}:{kind:`plain`,text:$(t),language:`text`,isCode:!1}}}return r===`write`?{...n,Icon:b,title:`write`,secondaryText:a||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:_r(t),language:Y(a),isCode:!0}}:{...n,title:tr(e)}}function Er(e,t){let n=Cr(e,t),r=(e.tool||``).toLowerCase(),i=X(t.inputValue);if(r===`glob`){let r=Z(i.pattern);return{...n,Icon:C,title:e.tool||`glob`,secondaryText:r||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:$(t),language:`text`,isCode:!1}}}if(r===`grep`){let r=[Z(i.path),Z(i.pattern)].filter(Boolean).join(` · `);return{...n,Icon:C,title:e.tool||`grep`,secondaryText:r||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:$(t),language:`text`,isCode:!1}}}if(r===`bash`){let r=Z(i.description),a=Z(i.command),o=r?`${r}${a?` (${a})`:``}`:a?`(${a})`:void 0;return{...n,Icon:y,title:e.tool||`bash`,secondaryText:o,showInputPreview:!1,outputContent:{kind:`plain`,text:$(t),language:`text`,isCode:!1}}}if(r===`read`){let r=rr(t.inputValue);return{...n,Icon:S,title:e.tool||`read`,secondaryText:r||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:or(t.outputValue),language:Y(r),isCode:!0}}}if(r===`edit`){let r=rr(t.inputValue);return{...n,Icon:me,title:e.tool||`edit`,secondaryText:r||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:gr(t),language:`diff`,isCode:!0}}}if(r===`write`){let r=rr(t.inputValue),i=t.status===`completed`;return{...n,Icon:b,title:e.tool||`write`,secondaryText:r||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:_r(t),language:Y(r),isCode:i}}}return r===`skill`?wr(e,t,n):n}function Dr(e,t){let n=Cr(e,t),r=(e.tool||``).toLowerCase(),i=X(t.inputValue);if(r===`glob`){let r=Z(i.pattern);return{...n,Icon:C,title:e.title||`glob`,secondaryText:r||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:$(t),language:`text`,isCode:!1}}}if(r===`grep`){let r=[Z(i.path),Z(i.pattern)].filter(Boolean).join(` · `);return{...n,Icon:C,title:e.title||`grep`,secondaryText:r||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:$(t),language:`text`,isCode:!1}}}if(r===`shell`){let r=Z(i.command);return{...n,Icon:y,title:e.title||`bash`,secondaryText:r?`(${r})`:void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:$(t),language:`text`,isCode:!1}}}if(r===`readfile`){let r=rr(t.inputValue);return{...n,Icon:S,title:e.title||`read`,secondaryText:r||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:or(t.outputValue),language:Y(r),isCode:!0}}}if(r===`strreplacefile`){let r=rr(t.inputValue),i=hr(t,r);return{...n,Icon:me,title:e.title||`edit`,secondaryText:r||void 0,showInputPreview:!1,outputContent:i.length>0?{kind:`structured-diff`,blocks:i}:{kind:`plain`,text:gr(t),language:`diff`,isCode:!0}}}if(r===`writefile`){let r=rr(t.inputValue);return{...n,Icon:b,title:e.title||`write`,secondaryText:r||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:_r(t),language:Y(r),isCode:t.status===`completed`}}}return n}function Or(e,t){let n=Cr(e,t),r=(e.tool||``).toLowerCase();if(r===`skill`)return wr(e,t,n);if(r===`exec_command`){let e=en(t.inputValue,$(t),Y);return{...n,Icon:y,title:`bash`,secondaryText:e.secondaryText,details:e.details,showInputPreview:!1,outputContent:{kind:`plain`,text:e.outputAnalysis.text,language:e.outputAnalysis.language,isCode:e.outputAnalysis.isCode}}}if(r===`write_stdin`){let e=tn(t.inputValue,$(t),Y);return{...n,Icon:y,title:`bash`,secondaryText:e.secondaryText,details:e.details,showInputPreview:!1,outputContent:{kind:`plain`,text:e.outputAnalysis.text,language:e.outputAnalysis.language,isCode:e.outputAnalysis.isCode}}}if(r===`request_user_input`){let e=nn(t.inputValue,$(t));return{...n,Icon:h,title:`ask`,secondaryText:e.secondaryText,details:e.details,showInputPreview:!1,outputContent:e.outputContent}}if(r===`patch`){let r=Tt(t.inputValue),i=Dt(r);return{...n,Icon:me,title:tr(e,`patch`),secondaryText:i||void 0,details:[],showInputPreview:!1,outputContent:At(r,$(t),Y)}}if(r===`subagent`){let r=yr(e),i=$(t);return{...n,Icon:p,title:vr(e)||tr(e,`subagent`),secondaryText:void 0,details:[],showInputPreview:!1,outputContent:{kind:`plain`,text:r||i,language:`markdown`,isCode:!1}}}return n}function kr(e,t){let n=Cr(e,t),r=(e.tool||``).toLowerCase(),i=X(t.inputValue),a=rr(t.inputValue);if(r===`read_file_v2`){let e=sr(t.outputValue);return{...n,Icon:S,title:`read`,secondaryText:a||void 0,details:e===`No output captured.`?[{label:`Lines`,value:Z(ir(t.outputValue).totalLinesInFile)}]:[],showInputPreview:!1,outputContent:{kind:`plain`,text:e,language:Y(a),isCode:e!==`No output captured.`}}}if(r===`edit_file_v2`){let e=Q(Rn(i.streamingContent));return{...n,Icon:me,title:`edit`,secondaryText:a||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:e||$(t),language:e?`diff`:`text`,isCode:!!e}}}if(r===`ripgrep_raw_search`){let e=Z(i.pattern),r=[Z(i.path),e].filter(Boolean).join(` · `);return{...n,Icon:C,title:`grep`,secondaryText:r||void 0,details:[],showInputPreview:!1,outputContent:{kind:`plain`,text:$(t),language:`text`,isCode:!1}}}if(r===`glob_file_search`){let e=Z(i.globPattern),r=[Z(i.targetDirectory),e].filter(Boolean).join(` · `);return{...n,Icon:C,title:`glob`,secondaryText:r||void 0,details:[],showInputPreview:!1,outputContent:{kind:`plain`,text:cr(t.outputValue),language:`text`,isCode:!1}}}if(r===`run_terminal_command_v2`){let e=Z(i.command),r=Z(i.commandDescription),a=r?`${r}${e?` (${e})`:``}`:e?`(${e})`:void 0;return{...n,Icon:y,title:`bash`,secondaryText:a,details:[],showInputPreview:!1,outputContent:{kind:`plain`,text:$(t),language:`text`,isCode:!1}}}return{...n,title:tr(e)}}function Ar(e,t,n){let r=e.toLowerCase();return r===`opencode`?Er(t,n):r===`codex`?Or(t,n):r===`kimi`?Dr(t,n):r===`claudecode`?Tr(t,n):r===`cursor`?kr(t,n):Cr(t,n)}function jr(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function Mr(e){if(typeof e==`number`&&e<=0)return`Unknown time`;let t=null;if(typeof e==`number`){let n=e<10**12?e*1e3:e;t=new Date(n)}else if(typeof e==`string`&&e.trim()){let n=Number(e);t=!Number.isNaN(n)&&n>0?new Date(n<10**12?n*1e3:n):new Date(e)}return!t||Number.isNaN(t.getTime())?`Unknown time`:t.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!0})}function Nr({session:e,highlightQuery:t}){let n=(e.slug||``).split(`/`)[0]||M.getDefaultAgentKey()||`claudecode`,r=(0,j.useMemo)(()=>xr(e.messages,n),[e.messages,n]),i=(0,j.useMemo)(()=>r.filter(e=>vt(e)),[r]),{toolAnchorIds:a,summary:o}=(0,j.useMemo)(()=>Yn(i),[i]),s=(0,j.useMemo)(()=>Xn(e.file_activity,o),[e.file_activity,o]),c=(0,j.useMemo)(()=>sn(i),[i]),[l,u]=(0,j.useState)(()=>new Set(c.filterIds)),d=(0,j.useMemo)(()=>[...c.filterIds].toSorted().join(`|`),[c.filterIds]),f=(0,j.useMemo)(()=>dn(i,l),[i,l]);return(0,j.useEffect)(()=>{u(new Set(c.filterIds))},[d,c.filterIds]),i.length===0?(0,P.jsx)(`div`,{"data-testid":`session-detail`,className:`mx-auto max-w-4xl rounded-sm border border-[var(--console-border)] bg-white p-6 text-sm text-[var(--console-muted)]`,children:`当前会话暂无可展示的消息内容。`}):(0,P.jsxs)(`div`,{"data-testid":`session-detail`,className:`mx-auto w-full max-w-[1440px] space-y-8 px-2 md:px-4 animate-in fade-in slide-in-from-bottom-2 duration-300`,children:[(0,P.jsx)(zr,{summary:typeof e.summary_files==`string`?e.summary_files:void 0}),(0,P.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[240px_minmax(0,1fr)] xl:grid-cols-[220px_minmax(0,1fr)_320px] lg:items-start`,children:[(0,P.jsx)(Fr,{toc:c,fileChangeSummary:s,baseDirectory:e.directory,selectedFilters:l,onToggle:e=>u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}),(0,P.jsx)(`div`,{className:`flex min-w-0 flex-col gap-8`,children:f.length>0?f.map(({msg:e,blocks:r},i)=>(0,P.jsx)(Br,{msg:e,blocks:r,toolAnchorIds:a,formatTokens:jr,sessionAgentKey:n,highlightQuery:t},i)):(0,P.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-6 text-sm text-[var(--console-muted)]`,children:`当前筛选条件下暂无可展示的消息内容。`})}),(0,P.jsx)(ft,{session:e,toc:c},e.id)]})]})}var Pr=[{id:`user`,label:`User`},{id:`agent_message`,label:`Agent Responses`},{id:`thinking`,label:`Thinking`},{id:`plan`,label:`Plans`},{id:`tools_all`,label:`Tools`}];function Fr({toc:e,fileChangeSummary:t,baseDirectory:n,selectedFilters:r,onToggle:i}){let a=r.has(`tools_all`);return(0,P.jsx)(`aside`,{className:`console-scrollbar lg:sticky lg:top-4 lg:max-h-[calc(100dvh-14rem)] lg:overflow-y-auto lg:overscroll-contain`,children:(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--console-border)] px-4 py-3`,children:[(0,P.jsx)(ne,{className:`size-3.5 text-[var(--console-accent)]`}),(0,P.jsx)(`span`,{className:`console-mono text-xs font-semibold uppercase tracking-[0.16em] text-[var(--console-text)]`,children:`Session TOC`})]}),(0,P.jsxs)(`div`,{className:`space-y-1 p-3`,children:[Pr.filter(({id:t})=>e.counts[t]>0).map(({id:t,label:n})=>(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 rounded-sm px-2 py-2 transition-colors hover:bg-[var(--console-surface-muted)]`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:r.has(t),onChange:()=>i(t),className:`size-3.5 rounded border-[var(--console-border-strong)] accent-[var(--console-accent-strong)]`}),(0,P.jsx)(`span`,{className:`console-mono min-w-0 flex-1 text-xs text-[var(--console-text)]`,children:n}),(0,P.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:e.counts[t]})]},t)),e.tools.length>0?(0,P.jsx)(`div`,{className:`space-y-1 border-t border-[var(--console-border)] pt-2`,children:e.tools.map(e=>(0,P.jsxs)(`label`,{className:Ge(`flex items-center gap-3 rounded-sm px-2 py-2 transition-colors`,a?`cursor-pointer hover:bg-[var(--console-surface-muted)]`:`cursor-not-allowed opacity-50`),children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:a&&r.has(e.id),disabled:!a,onChange:()=>i(e.id),className:`size-3.5 rounded border-[var(--console-border-strong)] accent-[var(--console-accent-strong)]`}),(0,P.jsx)(`span`,{className:`console-mono min-w-0 flex-1 text-xs text-[var(--console-muted)]`,children:e.label}),(0,P.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:e.count})]},e.id))}):null]})]}),(0,P.jsx)(Ir,{summary:t,baseDirectory:n})]})})}function Ir({summary:e,baseDirectory:t}){let n=[{key:`read`,label:`Read`,Icon:C,items:e.read},{key:`edit`,label:`Edit`,Icon:me,items:e.edit},{key:`write`,label:`Write`,Icon:b,items:e.write},{key:`delete`,label:`Delete`,Icon:w,items:e.delete}].filter(e=>e.items.length>0);return n.length===0?null:(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--console-border)] px-4 py-3`,children:[(0,P.jsx)(_,{className:`size-3.5 text-[var(--console-accent)]`}),(0,P.jsx)(`span`,{className:`console-mono text-xs font-semibold uppercase tracking-[0.16em] text-[var(--console-text)]`,children:`File Tracker`})]}),(0,P.jsx)(`div`,{className:`space-y-3 p-3`,children:n.map(({key:e,label:n,Icon:r,items:i})=>(0,P.jsx)(Lr,{label:n,Icon:r,items:i,baseDirectory:t},e))})]})}function Lr({label:e,Icon:t,items:n,baseDirectory:r}){let[i,a]=(0,j.useState)(!1);return(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[#fafafa]`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[var(--console-surface-muted)]`,children:[(0,P.jsx)(t,{className:`size-3.5 shrink-0 text-[var(--console-accent)]`}),(0,P.jsx)(`span`,{className:`console-mono min-w-0 flex-1 text-[11px] font-semibold uppercase tracking-[0.12em] text-[var(--console-muted)]`,children:e}),(0,P.jsx)(`span`,{className:`console-mono shrink-0 text-[10px] text-[var(--console-muted)]`,children:n.length}),i?(0,P.jsx)(pe,{className:`size-3.5 shrink-0 text-[var(--console-muted)]`}):(0,P.jsx)(g,{className:`size-3.5 shrink-0 text-[var(--console-muted)]`})]}),i?(0,P.jsx)(`div`,{className:`space-y-1 border-t border-[var(--console-border)] p-2`,children:n.map(e=>(0,P.jsx)(Rr,{item:e,baseDirectory:r},`${e.path}:${e.latestAnchorId||e.latestTime}`))}):null]})}function Rr({item:e,baseDirectory:t}){let[n,r]=(0,j.useState)(0);function i(t){let n=e.anchors.length;if(n===0)return;let i=(t%n+n)%n;r(i);let a=e.anchors[i];a&&Qn(a.anchorId)}return(0,P.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm px-2 py-2 transition-colors hover:bg-[var(--console-surface-muted)]`,children:[(0,P.jsx)(`button`,{type:`button`,title:e.path,onClick:()=>i(n),className:`min-w-0 flex-1 text-left`,children:(0,P.jsx)(`span`,{className:`console-mono block break-all text-xs text-[var(--console-text)]`,children:Zn(e.path,t)})}),e.anchors.length>1?(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,P.jsx)(`button`,{type:`button`,"aria-label":`Previous ${e.path}`,onClick:()=>i(n-1),className:`rounded-sm border border-[var(--console-border)] p-1 text-[var(--console-muted)] transition-colors hover:bg-white`,children:(0,P.jsx)(pe,{className:`size-3`})}),(0,P.jsxs)(`span`,{className:`console-mono text-[10px] text-[var(--console-muted)]`,children:[n+1,`/`,e.anchors.length]}),(0,P.jsx)(`button`,{type:`button`,"aria-label":`Next ${e.path}`,onClick:()=>i(n+1),className:`rounded-sm border border-[var(--console-border)] p-1 text-[var(--console-muted)] transition-colors hover:bg-white`,children:(0,P.jsx)(g,{className:`size-3`})})]}):(0,P.jsx)(`button`,{type:`button`,title:`Jump to tool call`,onClick:()=>i(0),className:`console-mono shrink-0 text-[10px] text-[var(--console-muted)]`,children:e.count})]})}function zr({summary:e,defaultExpanded:t=!1}){let n=typeof e==`string`?e.trim():``,[r,i]=(0,j.useState)(t);return n?(0,P.jsxs)(`section`,{className:`rounded-sm border border-[var(--console-border)] bg-white shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,P.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-4 py-3 text-left`,onClick:()=>i(e=>!e),children:[(0,P.jsxs)(`span`,{className:`console-mono inline-flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.16em] text-[var(--console-text)]`,children:[(0,P.jsx)(_,{className:`size-3.5 text-[var(--console-accent)]`}),`Session Summary`]}),r?(0,P.jsx)(pe,{className:`size-3.5 text-[var(--console-muted)]`}):(0,P.jsx)(g,{className:`size-3.5 text-[var(--console-muted)]`})]}),r?(0,P.jsx)(`div`,{className:`border-t border-[var(--console-border)] px-4 py-4`,children:(0,P.jsx)(`div`,{className:`console-markdown text-sm leading-relaxed text-[var(--console-text)]`,children:(0,P.jsx)(K,{text:n})})}):null]}):null}function Br({msg:e,blocks:t,toolAnchorIds:n,formatTokens:r,sessionAgentKey:i,highlightQuery:a}){let o=e.role===`user`,s=bt(e,i),c=t||_t(e.parts),l=()=>{let e=i.toLowerCase(),t=M.getAgentName(e),n=M.agents[e]?.icon;return(0,P.jsx)(P.Fragment,{children:n?(0,P.jsx)(`img`,{src:n,alt:t,className:`size-4 rounded-sm object-cover`}):(0,P.jsx)(p,{className:`size-4 text-[var(--console-muted)]`})})},u=e.mode?e.mode.toUpperCase():null,d=e.model||null,f=br(e),m=Mr(e.time_created);return(0,P.jsx)(`article`,{className:`w-full border-l-2 border-[var(--console-thread)] pl-4 pr-3 md:pr-5`,children:(0,P.jsxs)(`div`,{className:`flex gap-4`,children:[(0,P.jsx)(`div`,{className:`shrink-0 pt-1`,children:(0,P.jsx)(`div`,{className:`flex size-8 items-center justify-center rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)]`,children:o?(0,P.jsx)(ie,{className:`size-4 text-[var(--console-muted)]`}):l()})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[(0,P.jsxs)(`div`,{className:`flex items-baseline gap-3`,children:[(0,P.jsx)(`span`,{className:`console-mono text-sm font-bold tracking-wide text-[var(--console-text)]`,children:f}),(0,P.jsx)(`time`,{className:`console-mono text-xs text-[var(--console-muted)]`,children:m}),u&&(0,P.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-1.5 py-0.5 text-[10px] text-[var(--console-muted)]`,children:u}),d&&(0,P.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-1.5 py-0.5 text-[10px] text-[var(--console-muted)]`,children:d})]}),s?(0,P.jsx)(Vr,{}):c.map((e,t)=>e.type===`reasoning`?(0,P.jsx)(Hr,{parts:e.parts,highlightQuery:a},t):e.type===`plan`?(0,P.jsx)(Wr,{parts:e.parts,highlightQuery:a},t):e.type===`tool`?(0,P.jsx)(Ur,{parts:e.parts,toolAnchorIds:n,sessionAgentKey:i,highlightQuery:a},t):(0,P.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4 shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:(0,P.jsx)(`div`,{className:`console-markdown text-sm leading-relaxed text-[var(--console-text)]`,children:e.parts.map((e,t)=>(0,P.jsx)(An,{text:q(e.text),highlightQuery:a},t))})},t)),!o&&(e.tokens||e.cost)&&(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.tokens?.input?(0,P.jsxs)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-muted)]`,children:[`INPUT `,r(e.tokens.input)]}):null,e.tokens?.output?(0,P.jsxs)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-muted)]`,children:[`OUTPUT `,r(e.tokens.output)]}):null,e.tokens?.reasoning?(0,P.jsxs)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-muted)]`,children:[`REASONING `,r(e.tokens.reasoning)]}):null,e.cost?(0,P.jsxs)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-muted)]`,children:[e.cost_source===`estimated`?`EST COST`:`COST`,` $`,e.cost.toFixed(4)]}):null]})]})]})})}function Vr(){return(0,P.jsx)(`div`,{className:`space-y-2`,children:(0,P.jsx)(`div`,{className:`flex flex-wrap items-start gap-2`,children:(0,P.jsx)(`div`,{className:`w-full rounded-sm border border-[var(--console-border-strong)] bg-white px-3 py-2 text-left shadow-[2px_2px_0_0_rgba(15,23,42,0.05)] md:w-[560px]`,children:(0,P.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,P.jsx)(ce,{className:`mt-0.5 size-3.5 shrink-0 text-[var(--console-accent)]`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,P.jsx)(`span`,{className:`console-mono block text-xs font-semibold text-[var(--console-text)]`,children:`abort`})})]})})})})}function Hr({parts:e,highlightQuery:t}){let[n,r]=(0,j.useState)(!1),i=e.map(e=>q(e.text)).filter(Boolean).join(`
|
|
31
|
+
|
|
32
|
+
`);return(0,P.jsxs)(`div`,{className:`overflow-hidden rounded-sm border border-[var(--console-thinking-border)] bg-[var(--console-thinking-bg)]`,children:[(0,P.jsxs)(`div`,{className:`flex cursor-pointer items-center justify-between bg-[var(--console-surface-muted)] px-3 py-2`,onClick:()=>r(!n),children:[(0,P.jsxs)(`span`,{className:`console-mono flex items-center gap-2 text-xs font-medium text-[var(--console-muted)]`,children:[(0,P.jsx)(x,{className:`size-3.5`}),`Thinking`]}),(0,P.jsx)(`span`,{className:`text-[var(--console-muted)]`,children:n?(0,P.jsx)(pe,{className:`w-4 h-4`}):(0,P.jsx)(g,{className:`w-4 h-4`})})]}),n&&(0,P.jsx)(`div`,{className:`border-t border-dashed border-[var(--console-thinking-border)] px-4 py-3`,children:(0,P.jsx)(`div`,{className:`console-mono whitespace-pre-wrap text-xs leading-relaxed text-[var(--console-muted)]`,children:kn(i,t)})})]})}function Ur({parts:e,toolAnchorIds:t,sessionAgentKey:n,highlightQuery:r}){return(0,P.jsx)(`div`,{className:`space-y-2`,children:(0,P.jsx)(`div`,{className:`space-y-2`,children:e.map((e,i)=>(0,P.jsx)(Kr,{tool:e,anchorId:t.get(e),sessionAgentKey:n,highlightQuery:r},i))})})}function Wr({parts:e,highlightQuery:t}){return(0,P.jsx)(`div`,{className:`space-y-2`,children:e.map((e,n)=>(0,P.jsx)(Gr,{part:e,highlightQuery:t},n))})}function Gr({part:e,highlightQuery:t}){let[n,r]=(0,j.useState)(!1),i=Mt(e),a=i.approvalStatus===`fail`?En.error:En.completed,o=a.icon;return(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,P.jsx)(`div`,{className:`w-full md:w-[560px] rounded-sm border border-[var(--console-border-strong)] bg-white px-3 py-2 text-left shadow-[2px_2px_0_0_rgba(15,23,42,0.05)] ${i.expandable?`transition-colors hover:bg-[var(--console-surface-muted)]`:``}`,children:i.expandable?(0,P.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-2 text-left`,onClick:()=>r(!n),children:[(0,P.jsx)(l,{className:`mt-0.5 size-3.5 shrink-0 text-[var(--console-accent)]`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,P.jsx)(`span`,{className:`console-mono block text-xs font-semibold text-[var(--console-text)]`,children:i.title})}),(0,P.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[var(--console-muted)]`,children:n?(0,P.jsx)(pe,{className:`size-3.5`}):(0,P.jsx)(g,{className:`size-3.5`})})]}):(0,P.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,P.jsx)(l,{className:`mt-0.5 size-3.5 shrink-0 text-[var(--console-accent)]`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,P.jsx)(`span`,{className:`console-mono block text-xs font-semibold text-[var(--console-text)]`,children:i.title})})]})}),(0,P.jsxs)(`span`,{className:`console-mono inline-flex items-center gap-1 rounded-sm border px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider ${a.className}`,children:[(0,P.jsx)(o,{className:`size-3`}),a.label]})]}),i.expandable&&n?(0,P.jsxs)(`div`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-white shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,P.jsx)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-1.5`,children:(0,P.jsx)(`span`,{className:`console-mono text-xs text-[var(--console-muted)]`,children:i.contentLabel})}),(0,P.jsx)(`div`,{className:`p-4`,children:(0,P.jsx)(`div`,{className:`console-markdown text-sm leading-relaxed text-[var(--console-text)]`,children:(0,P.jsx)(An,{text:i.contentMarkdown,highlightQuery:t})})})]}):null]})}function Kr({tool:e,anchorId:t,sessionAgentKey:n,highlightQuery:r}){let[i,a]=(0,j.useState)(!1),o=Sr(e),s=Ar(n,e,o),c=En[o.status],l=c.icon,u=s.Icon;return(0,P.jsxs)(`div`,{id:t,className:`scroll-mt-6 space-y-2`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,P.jsx)(`div`,{className:`w-full md:w-[560px] rounded-sm border border-[var(--console-border-strong)] bg-white px-3 py-2 text-left shadow-[2px_2px_0_0_rgba(15,23,42,0.05)] ${s.expandable?`transition-colors hover:bg-[var(--console-surface-muted)]`:``}`,children:s.expandable?(0,P.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-2 text-left`,onClick:()=>a(!i),children:[(0,P.jsx)(u,{className:`mt-0.5 size-3.5 shrink-0 text-[var(--console-accent)]`}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`span`,{className:`console-mono block text-xs font-semibold text-[var(--console-text)]`,children:s.title}),s.secondaryText?(0,P.jsx)(`span`,{className:`console-mono mt-0.5 block whitespace-pre-wrap break-words text-xs leading-relaxed text-[var(--console-muted)]`,children:kn(s.secondaryText,r)}):null]}),(0,P.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[var(--console-muted)]`,children:i?(0,P.jsx)(pe,{className:`size-3.5`}):(0,P.jsx)(g,{className:`size-3.5`})})]}):(0,P.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,P.jsx)(u,{className:`mt-0.5 size-3.5 shrink-0 text-[var(--console-accent)]`}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`span`,{className:`console-mono block text-xs font-semibold text-[var(--console-text)]`,children:s.title}),s.secondaryText?(0,P.jsx)(`span`,{className:`console-mono mt-0.5 block whitespace-pre-wrap break-words text-xs leading-relaxed text-[var(--console-muted)]`,children:kn(s.secondaryText,r)}):null]})]})}),(0,P.jsxs)(`span`,{className:`console-mono inline-flex items-center gap-1 rounded-sm border px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider ${c.className}`,children:[(0,P.jsx)(l,{className:`size-3 ${o.status===`running`?`animate-spin`:``}`}),c.label]})]}),s.expandable&&i?(0,P.jsxs)(`div`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-white shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,P.jsx)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-1.5`,children:(0,P.jsx)(`span`,{className:`console-mono text-xs text-[var(--console-muted)]`,children:`Output`})}),(0,P.jsxs)(`div`,{className:`space-y-3 p-3`,children:[s.details.length>0?(0,P.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[#fafafa] px-3 py-2`,children:(0,P.jsx)(`div`,{className:`space-y-2`,children:s.details.map(e=>(0,P.jsxs)(`div`,{className:`flex flex-col gap-1 md:flex-row md:items-start md:gap-3`,children:[(0,P.jsx)(`span`,{className:`console-mono shrink-0 text-[11px] font-semibold uppercase tracking-wide text-[var(--console-muted)] md:w-24`,children:e.label}),(0,P.jsx)(`span`,{className:`console-mono whitespace-pre-wrap break-all text-xs leading-relaxed text-[var(--console-text)]`,children:kn(e.value,r)})]},`${e.label}:${e.value}`))})}):null,(0,P.jsx)(Tn,{outputContent:s.outputContent})]}),s.showInputPreview?(0,P.jsxs)(`div`,{className:`border-t border-[var(--console-border)] bg-[#fafafa] px-3 py-2`,children:[(0,P.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:`Input Preview`}),(0,P.jsx)(`pre`,{className:`console-mono mt-1 max-h-[200px] overflow-x-auto whitespace-pre-wrap break-all text-xs leading-relaxed text-[var(--console-muted)]`,children:kn(o.inputText||`{}`,r)})]}):null]}):null]})}var qr=[{id:`1`,roleWidth:`w-14`,timeWidth:`w-20`,bodyWidths:[`w-full`,`w-10/12`,`w-7/12`]},{id:`2`,roleWidth:`w-16`,timeWidth:`w-24`,bodyWidths:[`w-9/12`,`w-7/12`]},{id:`3`,roleWidth:`w-14`,timeWidth:`w-16`,bodyWidths:[`w-full`,`w-11/12`,`w-8/12`,`w-5/12`]},{id:`4`,roleWidth:`w-16`,timeWidth:`w-20`,bodyWidths:[`w-10/12`,`w-8/12`]},{id:`5`,roleWidth:`w-14`,timeWidth:`w-24`,bodyWidths:[`w-full`,`w-10/12`,`w-9/12`]}];function Jr({className:e}){return(0,P.jsx)(`div`,{className:`rounded-sm bg-[var(--console-border)] ${e}`})}function Yr(){return(0,P.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-5xl flex-col gap-8 px-2 md:px-4`,children:[(0,P.jsx)(`div`,{className:`flex flex-1 flex-col gap-8`,children:qr.map(e=>(0,P.jsx)(`article`,{className:`w-full border-l-2 border-[var(--console-thread)] pl-4 pr-3 md:pr-5`,children:(0,P.jsxs)(`div`,{className:`flex gap-4`,children:[(0,P.jsx)(`div`,{className:`shrink-0 pt-1`,children:(0,P.jsx)(`div`,{className:`flex size-8 items-center justify-center rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)]`,children:(0,P.jsx)(`div`,{className:`size-3.5 rounded-sm bg-[var(--console-border-strong)] animate-pulse`})})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,P.jsx)(Jr,{className:`${e.roleWidth} h-3 animate-pulse`}),(0,P.jsx)(Jr,{className:`${e.timeWidth} h-2.5 animate-pulse`})]}),(0,P.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4 shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:(0,P.jsx)(`div`,{className:`space-y-2`,children:e.bodyWidths.map(t=>(0,P.jsx)(Jr,{className:`${t} h-3 animate-pulse`},`${e.id}-${t}`))})})]})]})},e.id))}),(0,P.jsx)(`div`,{className:`min-h-24 flex-1 rounded-sm border border-[var(--console-border)] bg-white/60 animate-pulse`})]})}function Xr({active:e,onToggle:t,className:n=``}){return(0,P.jsx)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":e?`取消收藏会话`:`收藏会话`,title:e?`取消收藏`:`收藏`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-sm border transition-colors ${n} ${e?`border-[var(--console-border)] bg-[var(--console-surface-muted)] text-[var(--console-text)]`:`border-transparent text-[var(--console-muted)] opacity-70 hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)] hover:text-[var(--console-text)] hover:opacity-100`}`,children:(0,P.jsx)(fe,{className:`size-3`,strokeWidth:1.8,fill:e?`currentColor`:`none`})})}function Zr(e){return e.toLocaleString(`en-US`)}function Qr(e){return e===0?`$0.00`:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function $r(e){if(e===`recorded`)return`recorded`;if(e===`estimated`)return`estimated`}function ei(e){return e.total_tokens??e.total_input_tokens+e.total_output_tokens}function ti(e){if(!e)return`unknown`;let t=Date.now()-e;if(Number.isNaN(t)||t<0)return`just now`;let n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function ni({label:e,value:t,hint:n}){return(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,P.jsx)(`p`,{className:`console-mono text-[11px] uppercase tracking-wider text-[var(--console-muted)]`,children:e}),(0,P.jsx)(`p`,{className:`console-mono mt-2 text-xl font-semibold text-[var(--console-text)]`,children:t}),n?(0,P.jsx)(`p`,{className:`mt-1 text-xs text-[var(--console-muted)]`,children:n}):null]})}function ri({label:e,value:t}){return(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] p-3`,children:[(0,P.jsx)(`p`,{className:`console-mono text-[11px] uppercase tracking-wider text-[var(--console-muted)]`,children:e}),(0,P.jsx)(`p`,{className:`console-mono mt-2 break-all text-sm leading-6 text-[var(--console-text)]`,children:t})]})}function ii({code:e,title:t,description:n,aside:r,iconSrc:i,iconAlt:a}){return(0,P.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border-strong)] bg-white p-5 md:p-6`,children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-5 md:flex-row md:items-start md:justify-between`,children:[(0,P.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,P.jsx)(`span`,{className:`console-mono inline-flex rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--console-muted)]`,children:e}),(0,P.jsxs)(`div`,{className:`mt-4 flex items-start gap-3`,children:[i?(0,P.jsx)(`img`,{src:i,alt:a||``,className:`mt-1 size-8 shrink-0 object-contain`}):null,(0,P.jsx)(`h2`,{className:`console-mono text-2xl leading-tight font-semibold tracking-tight text-[var(--console-text)] md:text-[2rem]`,children:t})]}),(0,P.jsx)(`p`,{className:`mt-3 max-w-[42rem] text-sm leading-7 text-[var(--console-muted)]`,children:n})]}),(0,P.jsxs)(`div`,{className:`min-w-0 rounded-sm border border-dashed border-[var(--console-border)] bg-[var(--console-surface-muted)] px-4 py-3 md:max-w-xs`,children:[(0,P.jsx)(`p`,{className:`console-mono text-[11px] uppercase tracking-[0.16em] text-[var(--console-muted)]`,children:`STATUS NOTE`}),(0,P.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-[var(--console-text)]`,children:r})]})]})})}function ai({agentItems:e}){return(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,P.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,P.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:`Known Agents`}),(0,P.jsxs)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:[e.length,` items`]})]}),(0,P.jsx)(`ul`,{className:`grid gap-2 sm:grid-cols-2`,children:e.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(d,{to:`/${e.key}`,className:`flex min-h-11 items-center gap-2 rounded-sm border border-transparent px-3 py-2 transition-colors duration-200 hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--console-accent)]`,children:[(0,P.jsx)(`img`,{src:e.icon,alt:e.name,className:`size-4 object-contain`}),(0,P.jsx)(`span`,{className:`console-mono flex-1 text-xs text-[var(--console-text)]`,children:e.name}),(0,P.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:e.count})]})},e.key))})]})}function oi({sessions:e,isBookmarked:t,onToggleBookmark:n}){return e.length===0?(0,P.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4 text-sm text-[var(--console-muted)]`,children:`No sessions yet`}):(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,P.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,P.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:`Recent Sessions`}),(0,P.jsxs)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:[e.length,` items`]})]}),(0,P.jsx)(`ul`,{className:`space-y-2`,children:e.map(e=>{let r=t(e.agentKey,e.id);return(0,P.jsx)(`li`,{children:(0,P.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm border border-transparent px-2 py-1.5 transition-colors hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`,children:[(0,P.jsxs)(d,{to:`/${e.fullPath}`,className:`min-w-0 flex-1`,children:[(0,P.jsx)(`p`,{className:`line-clamp-1 text-sm text-[var(--console-text)]`,children:e.title}),(0,P.jsxs)(`p`,{className:`console-mono mt-0.5 text-[11px] text-[var(--console-muted)]`,children:[`/`,e.fullPath,` ·`,` `,ti(e.time_updated||e.time_created)]}),(0,P.jsx)(Je,{tags:e.smart_tags,className:`mt-1.5`})]}),(0,P.jsx)(Xr,{active:r,onToggle:()=>n(e)})]})},e.id)})})]})}function si({type:e,sessions:t,agentItems:n,activeAgentKey:r,attemptedAgentKey:i,attemptedSessionSlug:a,isBookmarked:o,onToggleBookmark:s}){let c=t.toSorted((e,t)=>(t.time_updated||t.time_created||0)-(e.time_updated||e.time_created||0)),l=c.slice(0,5),u=t.reduce((e,t)=>e+t.stats.message_count,0),f=t.reduce((e,t)=>e+ei(t.stats),0),p=t.reduce((e,t)=>e+t.stats.total_cost,0),m=p>0?t.some(e=>e.stats.cost_source===`estimated`)?`estimated`:`recorded`:void 0,h=c[0]?.time_updated||c[0]?.time_created;if(e===`missing-agent`){let e=`/${i||`unknown`}${a?`/${a}`:``}`;return(0,P.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-4`,children:[(0,P.jsx)(ii,{code:`404 / AGENT`,title:`This agent isn't on the roster.`,description:`The path you requested is valid in shape, but there is no matching agent in the current registry. It may not be connected yet, or its name may not match what the system recognizes.`,aside:`Choose one of the available agents to continue.`}),(0,P.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,P.jsx)(ri,{label:`Requested Agent`,value:i||`unknown`}),(0,P.jsx)(ri,{label:`Requested Path`,value:e}),a?(0,P.jsx)(ri,{label:`Requested Session`,value:a}):null]}),(0,P.jsx)(ai,{agentItems:n})]})}if(e===`missing-session`){let e=r||M.getDefaultAgentKey()||`claudecode`,t=M.agents[e],n=t?.name||e,i=t?.icon,c=a||`unknown-session`;return(0,P.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-4`,children:[(0,P.jsx)(ii,{code:`404 / SESSION`,title:`This session isn't in the index.`,description:`${n} is available, but the session you're looking for does not exist in the current index. The slug may be incorrect, or the record may never have been part of this dataset.`,aside:`We checked the current path, but nothing matched. The session list on the left is still available.`,iconSrc:i,iconAlt:n}),(0,P.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] p-3`,children:[(0,P.jsx)(`p`,{className:`console-mono text-[11px] uppercase tracking-wider text-[var(--console-muted)]`,children:`Agent`}),(0,P.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[i?(0,P.jsx)(`img`,{src:i,alt:n,className:`size-4 shrink-0 object-contain`}):null,(0,P.jsx)(`p`,{className:`console-mono break-all text-sm leading-6 text-[var(--console-text)]`,children:n})]})]}),(0,P.jsx)(ri,{label:`Session`,value:c})]}),(0,P.jsx)(oi,{sessions:l,isBookmarked:o,onToggleBookmark:s})]})}if(e===`global`)return(0,P.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-4`,children:[(0,P.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,P.jsx)(ni,{label:`Total Sessions`,value:Zr(t.length)}),(0,P.jsx)(ni,{label:`Total Messages`,value:Zr(u)}),(0,P.jsx)(ni,{label:`Latest Activity`,value:ti(h),hint:h?new Date(h).toLocaleString(`zh-CN`):void 0})]}),(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,P.jsx)(`h3`,{className:`console-mono mb-3 text-xs font-bold uppercase text-[var(--console-text)]`,children:`Agents`}),(0,P.jsx)(`ul`,{className:`grid gap-2 sm:grid-cols-2`,children:n.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(d,{to:`/${e.key}`,className:`flex items-center gap-2 rounded-sm border border-transparent px-2 py-1.5 transition-colors hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`,children:[(0,P.jsx)(`img`,{src:e.icon,alt:e.name,className:`size-4 object-contain`}),(0,P.jsx)(`span`,{className:`console-mono flex-1 text-xs text-[var(--console-text)]`,children:e.name}),(0,P.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:e.count})]})},e.key))})]}),(0,P.jsx)(oi,{sessions:l,isBookmarked:o,onToggleBookmark:s})]});let g=r?M.agents[r]:null,_=g?g.name:`Unknown Agent`;return(0,P.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-4`,children:[(0,P.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[g?(0,P.jsx)(`img`,{src:g.icon,alt:_,className:`size-6 object-contain`}):null,(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h3`,{className:`console-mono text-sm font-semibold text-[var(--console-text)]`,children:_}),(0,P.jsx)(`p`,{className:`console-mono text-xs text-[var(--console-muted)]`,children:`Select a session from the left to view details`})]})]})}),(0,P.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-4`,children:[(0,P.jsx)(ni,{label:`Sessions`,value:Zr(t.length)}),(0,P.jsx)(ni,{label:`Messages`,value:Zr(u)}),(0,P.jsx)(ni,{label:`Tokens`,value:Zr(f)}),(0,P.jsx)(ni,{label:`Total Cost`,value:Qr(p),hint:$r(m)})]}),(0,P.jsx)(oi,{sessions:l,isBookmarked:o,onToggleBookmark:s})]})}var ci=`codesesh:bookmarks:v1`;function li(e){return typeof e==`object`&&!!e}function ui(e){return li(e)?typeof e.message_count==`number`&&typeof e.total_input_tokens==`number`&&typeof e.total_output_tokens==`number`&&typeof e.total_cost==`number`&&(e.total_tokens==null||typeof e.total_tokens==`number`):!1}function di(e){return li(e)?typeof e.sessionId==`string`&&typeof e.agentKey==`string`&&typeof e.fullPath==`string`&&typeof e.title==`string`&&typeof e.directory==`string`&&typeof e.time_created==`number`&&(e.time_updated==null||typeof e.time_updated==`number`)&&(e.bookmarked_at==null||typeof e.bookmarked_at==`number`)&&ui(e.stats):!1}function fi(e,t){return`${e}:${t}`}function pi(e,t){return{sessionId:e.id,agentKey:t,fullPath:e.slug,title:e.title,directory:e.directory,time_created:e.time_created,time_updated:e.time_updated,stats:e.stats,bookmarked_at:Date.now()}}function mi(){if(typeof window>`u`)return[];try{let e=window.localStorage.getItem(ci);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(di).toSorted(gi):[]}catch{return[]}}function hi(){typeof window>`u`||window.localStorage.removeItem(ci)}function gi(e,t){let n=e.time_updated??e.time_created;return(t.time_updated??t.time_created)-n}function _i(e,t){if(e.length===0||t.length===0)return e;let n=new Map(t.map(e=>{let t=pi(e,e.slug.split(`/`)[0]?.toLowerCase()??`unknown`);return[fi(t.agentKey,t.sessionId),t]})),r=!1,i=e.map(e=>{let t=n.get(fi(e.agentKey,e.sessionId));return!t||t.fullPath===e.fullPath&&t.title===e.title&&t.directory===e.directory&&t.time_created===e.time_created&&t.time_updated===e.time_updated&&t.stats.message_count===e.stats.message_count&&t.stats.total_input_tokens===e.stats.total_input_tokens&&t.stats.total_output_tokens===e.stats.total_output_tokens&&t.stats.total_cost===e.stats.total_cost&&t.stats.total_tokens===e.stats.total_tokens?e:(r=!0,{...t,bookmarked_at:e.bookmarked_at})});return r?i.toSorted(gi):e}var vi=new Set([`git_remote`,`git_common_dir`,`manifest_path`,`path`,`loose`]);function yi(e){return vi.has(e)}function bi(e){return`${e.kind}:${e.key}`}function xi(e){return decodeURIComponent(e)}function Si(e){return`/projects/${encodeURIComponent(e.kind)}/${encodeURIComponent(e.key)}`}var Ci={light:``,dark:`.dark`},wi={width:320,height:200},Ti=j.createContext(null);function Ei(){let e=j.useContext(Ti);if(!e)throw Error(`useChart must be used within a <ChartContainer />`);return e}function Di({id:e,className:t,children:n,config:r,initialDimension:i=wi,...a}){let o=j.useId(),s=`chart-${e??o.replace(/:/g,``)}`;return(0,P.jsx)(Ti.Provider,{value:{config:r},children:(0,P.jsxs)(`div`,{"data-slot":`chart`,"data-chart":s,className:Ge(`flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden`,t),...a,children:[(0,P.jsx)(Oi,{id:s,config:r}),(0,P.jsx)(ee,{initialDimension:i,children:n})]})})}var Oi=({id:e,config:t})=>{let n=Object.entries(t).filter(([,e])=>e.theme??e.color);return n.length?(0,P.jsx)(`style`,{dangerouslySetInnerHTML:{__html:Object.entries(Ci).map(([t,r])=>`
|
|
33
|
+
${r} [data-chart=${e}] {
|
|
34
|
+
${n.map(([e,n])=>{let r=n.theme?.[t]??n.color;return r?` --color-${e}: ${r};`:null}).join(`
|
|
35
|
+
`)}
|
|
36
|
+
}
|
|
37
|
+
`).join(`
|
|
38
|
+
`)}}):null},ki=le;function Ai({active:e,payload:t,className:n,indicator:r=`dot`,hideLabel:i=!1,hideIndicator:a=!1,label:o,labelFormatter:s,labelClassName:c,formatter:l,color:u,nameKey:d,labelKey:f}){let{config:p}=Ei(),m=j.useMemo(()=>{if(i||!t?.length)return null;let[e]=t,n=ji(p,e,`${f??e?.dataKey??e?.name??`value`}`),r=!f&&typeof o==`string`?p[o]?.label??o:n?.label;return s?(0,P.jsx)(`div`,{className:Ge(`font-medium`,c),children:s(r,t)}):r?(0,P.jsx)(`div`,{className:Ge(`font-medium`,c),children:r}):null},[o,s,t,i,c,p,f]);if(!e||!t?.length)return null;let h=t.length===1&&r!==`dot`;return(0,P.jsxs)(`div`,{className:Ge(`grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl`,n),children:[h?null:m,(0,P.jsx)(`div`,{className:`grid gap-1.5`,children:t.filter(e=>e.type!==`none`).map((e,t)=>{let n=ji(p,e,`${d??e.name??e.dataKey??`value`}`),i=u??e.payload?.fill??e.color;return(0,P.jsx)(`div`,{className:Ge(`flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground`,r===`dot`&&`items-center`),children:l&&e?.value!==void 0&&e.name?l(e.value,e.name,e,t,e.payload):(0,P.jsxs)(P.Fragment,{children:[n?.icon?(0,P.jsx)(n.icon,{}):!a&&(0,P.jsx)(`div`,{className:Ge(`shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)`,{"h-2.5 w-2.5":r===`dot`,"w-1":r===`line`,"w-0 border-[1.5px] border-dashed bg-transparent":r===`dashed`,"my-0.5":h&&r===`dashed`}),style:{"--color-bg":i,"--color-border":i}}),(0,P.jsxs)(`div`,{className:Ge(`flex flex-1 justify-between leading-none`,h?`items-end`:`items-center`),children:[(0,P.jsxs)(`div`,{className:`grid gap-1.5`,children:[h?m:null,(0,P.jsx)(`span`,{className:`text-muted-foreground`,children:n?.label??e.name})]}),e.value!=null&&(0,P.jsx)(`span`,{className:`font-mono font-medium text-foreground tabular-nums`,children:typeof e.value==`number`?e.value.toLocaleString():String(e.value)})]})]})},t)})})]})}function ji(e,t,n){if(typeof t!=`object`||!t)return;let r=`payload`in t&&typeof t.payload==`object`&&t.payload!==null?t.payload:void 0,i=n;return n in t&&typeof t[n]==`string`?i=t[n]:r&&n in r&&typeof r[n]==`string`&&(i=r[n]),i in e?e[i]:e[n]}function Mi(e){return e.toLocaleString(`en-US`)}function Ni(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:Mi(e)}function Pi(e){return e===0?`$0.00`:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function Fi(e){if(e===`recorded`)return`recorded`;if(e===`estimated`)return`estimated`}function Ii(e){if(!e)return`unknown`;let t=Date.now()-e;if(Number.isNaN(t)||t<0)return`just now`;let n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Li({label:e,value:t,hint:n}){return(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,P.jsx)(`p`,{className:`console-mono text-[11px] uppercase tracking-wider text-[var(--console-muted)]`,children:e}),(0,P.jsx)(`p`,{className:`console-mono mt-2 text-xl font-semibold text-[var(--console-text)]`,children:t}),n?(0,P.jsx)(`p`,{className:`mt-1 text-xs text-[var(--console-muted)]`,children:n}):null]})}function Ri(e){return e.length>=10?e.slice(5):e}function zi({buckets:e}){let[t,n]=(0,j.useState)(null),r=(0,j.useMemo)(()=>Math.max(1,...e.map(e=>e.sessions)),[e]),i=(0,j.useMemo)(()=>e.reduce((e,t)=>e+t.sessions,0),[e]),a=(0,j.useMemo)(()=>{if(e.length===0)return new Set;let t=Math.min(6,e.length);if(t===1)return new Set([0]);let n=new Set;for(let r=0;r<t;r+=1)n.add(Math.round(r*(e.length-1)/(t-1)));return n},[e.length]);return(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,P.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:`Daily Activity`}),(0,P.jsxs)(`p`,{className:`console-mono mt-1 text-[11px] text-[var(--console-muted)]`,children:[`Session activity · last `,e.length,` days`]})]}),(0,P.jsx)(`span`,{className:`console-mono text-right text-[11px] text-[var(--console-muted)]`,children:t?`${t.date} · ${Mi(t.sessions)} sessions · ${Mi(t.messages)} msgs`:`${Mi(i)} in range`})]}),(0,P.jsx)(`div`,{className:`flex h-32 items-end gap-[2px]`,onMouseLeave:()=>n(null),children:e.map(e=>{let i=e.sessions>0?Math.max(Math.round(e.sessions/r*128),4):2,a=`${e.date} · ${e.sessions} sessions · ${e.messages} msgs`,o=t?.date===e.date;return(0,P.jsx)(`div`,{title:a,onMouseEnter:()=>n(e),className:`flex-1 cursor-default rounded-t-[1px] transition-opacity ${e.sessions>0?`bg-[var(--console-accent)]`:`bg-[var(--console-surface-muted)]`} ${o?`opacity-70`:`opacity-100`}`,style:{height:`${i}px`}},e.date)})}),(0,P.jsx)(`div`,{className:`console-mono mt-2 flex text-[10px] text-[var(--console-muted)]`,children:e.map((e,t)=>(0,P.jsx)(`span`,{className:`flex-1 text-center`,children:a.has(t)?Ri(e.date):``},e.date))})]})}var Bi={input:`#4A9EFF`,output:`#7C5CFF`,cache_read:`#3FB68B`,cache_create:`#E8A23B`},Vi={input:`Input`,output:`Output`,cache_read:`Cache Read`,cache_create:`Cache Create`};function Hi({buckets:e}){let[t,n]=(0,j.useState)(null),r=(0,j.useMemo)(()=>Math.max(1,...e.map(e=>e.input+e.output+e.cache_read+e.cache_create)),[e]),i=(0,j.useMemo)(()=>e.reduce((e,t)=>e+t.input+t.output+t.cache_read+t.cache_create,0),[e]),a=(0,j.useMemo)(()=>{if(e.length===0)return new Set;let t=Math.min(6,e.length);if(t===1)return new Set([0]);let n=new Set;for(let r=0;r<t;r+=1)n.add(Math.round(r*(e.length-1)/(t-1)));return n},[e.length]);return i===0?null:(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,P.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:`Daily Token Activity`}),(0,P.jsxs)(`p`,{className:`console-mono mt-1 text-[11px] text-[var(--console-muted)]`,children:[`Token breakdown · last `,e.length,` days`]})]}),(0,P.jsx)(`span`,{className:`console-mono text-right text-[11px] text-[var(--console-muted)]`,children:t?`${t.date} · ${Ni(t.input+t.output+t.cache_read+t.cache_create)} total`:`${Ni(i)} in range`})]}),t?(0,P.jsx)(`div`,{className:`mb-2 flex gap-4`,children:[`input`,`output`,`cache_read`,`cache_create`].map(e=>(0,P.jsxs)(`span`,{className:`console-mono flex items-center gap-1.5 text-[10px] text-[var(--console-muted)]`,children:[(0,P.jsx)(`span`,{className:`inline-block size-2 rounded-full`,style:{backgroundColor:Bi[e]}}),Vi[e],`: `,Ni(t[e])]},e))}):(0,P.jsx)(`div`,{className:`mb-2 flex gap-4`,children:[`input`,`output`,`cache_read`,`cache_create`].map(e=>(0,P.jsxs)(`span`,{className:`console-mono flex items-center gap-1.5 text-[10px] text-[var(--console-muted)]`,children:[(0,P.jsx)(`span`,{className:`inline-block size-2 rounded-full`,style:{backgroundColor:Bi[e]}}),Vi[e]]},e))}),(0,P.jsx)(`div`,{className:`flex h-32 items-end gap-[2px]`,onMouseLeave:()=>n(null),children:e.map(e=>{let i=e.input+e.output+e.cache_read+e.cache_create,a=i>0?Math.max(Math.round(i/r*128),4):2,o=t?.date===e.date,s=i>0?[{key:`input`,value:e.input},{key:`output`,value:e.output},{key:`cache_read`,value:e.cache_read},{key:`cache_create`,value:e.cache_create}]:[];return(0,P.jsx)(`div`,{onMouseEnter:()=>n(e),className:`flex flex-1 cursor-default flex-col justify-end overflow-hidden rounded-t-[1px] transition-opacity ${o?`opacity-70`:`opacity-100`}`,style:{height:`${a}px`},children:i>0?s.map(e=>{let t=Math.max(Math.round(e.value/i*a),0);return t===0?null:(0,P.jsx)(`div`,{style:{height:`${t}px`,backgroundColor:Bi[e.key]}},e.key)}):(0,P.jsx)(`div`,{className:`h-full bg-[var(--console-surface-muted)]`})},e.date)})}),(0,P.jsx)(`div`,{className:`console-mono mt-2 flex text-[10px] text-[var(--console-muted)]`,children:e.map((e,t)=>(0,P.jsx)(`span`,{className:`flex-1 text-center`,children:a.has(t)?Ri(e.date):``},e.date))})]})}var Ui=[`#4A9EFF`,`#7C5CFF`,`#3FB68B`,`#E8A23B`,`#E5484D`,`#5BCEDA`,`#F472B6`,`#A78BFA`,`#FB923C`,`#6EE7B7`];function Wi({entries:e}){let t=(0,j.useMemo)(()=>e.filter(e=>e.tokens>0),[e]),n=(0,j.useMemo)(()=>t.reduce((e,t)=>e+t.tokens,0),[t]);if(t.length===0||n===0)return(0,P.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4 text-sm text-[var(--console-muted)]`,children:`No model data yet`});let r=t.map((e,t)=>({...e,chartKey:`model${t}`,fraction:e.tokens/n,fill:Ui[t%Ui.length]})),i=r.reduce((e,t)=>(e[t.chartKey]={label:t.model,color:t.fill},e),{});return(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,P.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,P.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:`Model Distribution`}),(0,P.jsxs)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:[t.length,` models`]})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-6`,children:[(0,P.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center`,children:[(0,P.jsx)(Di,{config:i,className:`aspect-square size-[160px]`,children:(0,P.jsxs)(de,{children:[(0,P.jsx)(ki,{content:(0,P.jsx)(Ai,{hideLabel:!0,nameKey:`chartKey`,formatter:e=>(0,P.jsxs)(`span`,{className:`font-mono font-medium text-foreground tabular-nums`,children:[Mi(Number(e)),` tokens`]})})}),(0,P.jsx)(oe,{data:r,dataKey:`tokens`,nameKey:`chartKey`,outerRadius:70,paddingAngle:1,strokeWidth:0,isAnimationActive:!1})]})}),(0,P.jsxs)(`div`,{className:`console-mono -mt-1 text-center`,children:[(0,P.jsx)(`div`,{className:`text-xs font-semibold text-[var(--console-text)]`,children:Ni(n)}),(0,P.jsx)(`div`,{className:`text-[10px] text-[var(--console-muted)]`,children:`tokens`})]})]}),(0,P.jsx)(`ul`,{className:`min-w-0 flex-1 space-y-1.5`,children:r.map(e=>(0,P.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`inline-block size-2.5 shrink-0 rounded-full`,style:{backgroundColor:e.fill}}),(0,P.jsx)(`span`,{className:`console-mono min-w-0 flex-1 truncate text-xs text-[var(--console-text)]`,children:e.model}),(0,P.jsxs)(`span`,{className:`console-mono shrink-0 text-[11px] text-[var(--console-muted)]`,children:[(e.fraction*100).toFixed(1),`%`]})]},e.model))})]})]})}function Gi({perAgent:e}){let t=(0,j.useMemo)(()=>e.reduce((e,t)=>e+t.sessions,0),[e]);return t===0||e.length===0?(0,P.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4 text-sm text-[var(--console-muted)]`,children:`No agent data yet`}):(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,P.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,P.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:`Agent Distribution`}),(0,P.jsxs)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:[e.length,` agents`]})]}),(0,P.jsx)(`ul`,{className:`space-y-2`,children:e.map(e=>{let n=t>0?e.sessions/t*100:0;return(0,P.jsx)(`li`,{children:(0,P.jsxs)(d,{to:`/${e.name.toLowerCase()}`,className:`block rounded-sm border border-transparent px-2 py-1.5 transition-colors hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon?(0,P.jsx)(`img`,{src:e.icon,alt:e.displayName,className:`size-4 object-contain`}):null,(0,P.jsx)(`span`,{className:`console-mono flex-1 text-xs text-[var(--console-text)]`,children:e.displayName}),(0,P.jsxs)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:[Mi(e.sessions),` · `,n.toFixed(1),`%`]})]}),(0,P.jsx)(`div`,{className:`mt-1.5 h-1.5 overflow-hidden rounded-sm bg-[var(--console-surface-muted)]`,children:(0,P.jsx)(`div`,{className:`h-full bg-[var(--console-accent)]`,style:{width:`${n}%`}})}),(0,P.jsxs)(`div`,{className:`console-mono mt-1 flex gap-3 text-[10px] text-[var(--console-muted)]`,children:[(0,P.jsxs)(`span`,{children:[Mi(e.messages),` msgs`]}),(0,P.jsxs)(`span`,{children:[Ni(e.tokens),` tokens`]})]})]})},e.name)})})]})}function Ki({projects:e}){return e.length===0?null:(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,P.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,P.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:`Projects`}),(0,P.jsx)(d,{to:`/projects`,className:`console-mono text-[11px] text-[var(--console-muted)] transition-colors hover:text-[var(--console-text)]`,children:`View all`})]}),(0,P.jsx)(`ul`,{className:`space-y-2`,children:e.slice(0,5).map(e=>{let t=e.agentStats.slice(0,3);return(0,P.jsx)(`li`,{children:(0,P.jsxs)(d,{to:Si({kind:e.identityKind,key:e.identityKey}),className:`block rounded-sm border border-transparent px-2 py-1.5 transition-colors hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`console-mono min-w-0 flex-1 truncate text-xs text-[var(--console-text)]`,children:e.displayName}),(0,P.jsxs)(`span`,{className:`console-mono shrink-0 text-[11px] text-[var(--console-muted)]`,children:[Mi(e.sessionCount),` · `,Pi(e.cost)]})]}),(0,P.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-1.5`,children:[t.map(e=>{let t=M.agents[e.name];return(0,P.jsxs)(`span`,{className:`console-mono inline-flex items-center gap-1 rounded-sm border border-[var(--console-border)] bg-white px-1.5 py-0.5 text-[10px] text-[var(--console-muted)]`,children:[t?.icon?(0,P.jsx)(`img`,{src:t.icon,alt:t.name,className:`size-3 object-contain`}):null,t?.name??e.name,` · `,e.sessions]},e.name)}),(0,P.jsxs)(`span`,{className:`console-mono min-w-0 truncate text-[10px] text-[var(--console-muted)]`,children:[Ni(e.tokens),` tokens`]})]})]})},`${e.identityKind}:${e.identityKey}`)})})]})}function qi({sessions:e,onToggleBookmark:t}){return e.length===0?null:(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,P.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,P.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:`Bookmarked Sessions`}),(0,P.jsxs)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:[e.length,` items`]})]}),(0,P.jsx)(`ul`,{className:`space-y-2`,children:e.map(e=>{let n=M.agents[e.agentKey],r=e.time_updated??e.time_created;return(0,P.jsx)(`li`,{children:(0,P.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm border border-transparent px-2 py-1.5 transition-colors hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`,children:[(0,P.jsxs)(d,{to:`/${e.fullPath}`,className:`flex min-w-0 flex-1 items-start gap-2`,children:[n?.icon?(0,P.jsx)(`img`,{src:n.icon,alt:n.name,className:`mt-0.5 size-3.5 shrink-0 object-contain`}):null,(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`p`,{className:`line-clamp-1 text-sm text-[var(--console-text)]`,children:e.title}),(0,P.jsxs)(`p`,{className:`console-mono mt-0.5 line-clamp-1 text-[11px] text-[var(--console-muted)]`,children:[`/`,e.fullPath,` · `,Ii(r)]})]})]}),(0,P.jsx)(Xr,{active:!0,onToggle:()=>t(e)})]})},fi(e.agentKey,e.sessionId))})})]})}function Ji({sessions:e,isBookmarked:t,onToggleBookmark:n}){return e.length===0?(0,P.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4 text-sm text-[var(--console-muted)]`,children:`No sessions yet`}):(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,P.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,P.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:`Recent Activity`}),(0,P.jsxs)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:[e.length,` items`]})]}),(0,P.jsx)(`ul`,{className:`space-y-2`,children:e.map(e=>{let r=e.agentName.toLowerCase(),i=M.agents[r],a=e.time_updated??e.time_created,o=t(r,e.id);return(0,P.jsx)(`li`,{children:(0,P.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm border border-transparent px-2 py-1.5 transition-colors hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`,children:[(0,P.jsxs)(d,{to:`/${e.slug}`,className:`min-w-0 flex-1`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i?.icon?(0,P.jsx)(`img`,{src:i.icon,alt:i.name,className:`size-3.5 shrink-0 object-contain`}):null,(0,P.jsx)(`p`,{className:`line-clamp-1 flex-1 text-sm text-[var(--console-text)]`,children:e.title}),(0,P.jsx)(`span`,{className:`console-mono shrink-0 text-[11px] text-[var(--console-muted)]`,children:Ii(a)})]}),(0,P.jsxs)(`p`,{className:`console-mono mt-0.5 line-clamp-1 text-[11px] text-[var(--console-muted)]`,children:[`/`,e.slug]}),(0,P.jsx)(Je,{tags:e.smart_tags,className:`mt-1.5`})]}),(0,P.jsx)(Xr,{active:o,onToggle:()=>n(e,r)})]})},e.id)})})]})}function Yi({activity:e}){return e.length===0?(0,P.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4 text-sm text-[var(--console-muted)]`,children:`No file activity yet`}):(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,P.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,P.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:`Recently Touched Files`}),(0,P.jsxs)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:[e.length,` files`]})]}),(0,P.jsx)(`ul`,{className:`space-y-2`,children:e.map(e=>{let t=e.latest_time;return(0,P.jsx)(`li`,{children:(0,P.jsxs)(d,{to:`/${e.session.slug}`,className:`block rounded-sm border border-transparent px-2 py-1.5 transition-colors hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-1.5 py-0.5 text-[10px] uppercase text-[var(--console-muted)]`,children:e.kind}),(0,P.jsx)(`span`,{className:`console-mono min-w-0 flex-1 truncate text-xs text-[var(--console-text)]`,children:e.path}),(0,P.jsx)(`span`,{className:`console-mono shrink-0 text-[11px] text-[var(--console-muted)]`,children:Ii(t)})]}),(0,P.jsxs)(`p`,{className:`console-mono mt-1 line-clamp-1 text-[11px] text-[var(--console-muted)]`,children:[e.session.project_identity?.displayName??e.session.directory,` ·`,` `,e.session.title,` · `,e.count,` events`]})]})},`${e.agent_name}/${e.session_id}/${e.kind}/${e.path}`)})})]})}function Xi({data:e,projects:t=[],bookmarkedSessions:n,isBookmarked:r,onToggleBookmark:i}){let{totals:a,perAgent:o,dailyActivity:s,dailyTokenActivity:c,modelDistribution:l,recentSessions:u,recentFileActivities:d=[]}=e;return(0,P.jsxs)(`div`,{"data-testid":`dashboard`,className:`mx-auto max-w-5xl space-y-4`,children:[(0,P.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-5`,children:[(0,P.jsx)(Li,{label:`Total Sessions`,value:Mi(a.sessions)}),(0,P.jsx)(Li,{label:`Total Messages`,value:Mi(a.messages)}),(0,P.jsx)(Li,{label:`Total Tokens`,value:Ni(a.tokens)}),(0,P.jsx)(Li,{label:`Total Cost`,value:Pi(a.cost),hint:Fi(a.cost_source)}),(0,P.jsx)(Li,{label:`Latest Activity`,value:Ii(a.latestActivity),hint:a.latestActivity?new Date(a.latestActivity).toLocaleString(`zh-CN`):void 0})]}),(0,P.jsx)(zi,{buckets:s}),(0,P.jsx)(Hi,{buckets:c}),(0,P.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,P.jsx)(Wi,{entries:l}),(0,P.jsx)(Gi,{perAgent:o})]}),(0,P.jsx)(Ki,{projects:t}),(0,P.jsx)(Ji,{sessions:u,isBookmarked:r,onToggleBookmark:i}),(0,P.jsx)(Yi,{activity:d}),(0,P.jsx)(qi,{sessions:n,onToggleBookmark:e=>i(e)})]})}function Zi(e){return e.toLocaleString(`en-US`)}function Qi(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:Zi(e)}function $i(e){return e===0?`$0.00`:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function ea(e){if(!e)return`unknown`;let t=Date.now()-e;if(Number.isNaN(t)||t<0)return`just now`;let n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function ta(e){return e.stats.total_tokens??e.stats.total_input_tokens+e.stats.total_output_tokens}function na({label:e,value:t,hint:n}){return(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,P.jsx)(`p`,{className:`console-mono text-[11px] uppercase tracking-wider text-[var(--console-muted)]`,children:e}),(0,P.jsx)(`p`,{className:`console-mono mt-2 text-xl font-semibold text-[var(--console-text)]`,children:t}),n?(0,P.jsx)(`p`,{className:`mt-1 text-xs text-[var(--console-muted)]`,children:n}):null]})}function ra({agents:e}){return e.length===0?null:(0,P.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:e.slice(0,4).map(e=>{let t=M.agents[e.name];return(0,P.jsxs)(`span`,{className:`console-mono inline-flex items-center gap-1 rounded-sm border border-[var(--console-border)] bg-white px-1.5 py-0.5 text-[10px] text-[var(--console-muted)]`,children:[t?.icon?(0,P.jsx)(`img`,{src:t.icon,alt:t.name,className:`size-3 object-contain`}):null,t?.name??e.name,` · `,e.sessions]},e.name)})})}function ia({project:e}){return(0,P.jsx)(`li`,{children:(0,P.jsxs)(d,{to:Si({kind:e.identityKind,key:e.identityKey}),className:`block rounded-sm border border-[var(--console-border)] bg-white/85 p-4 transition-colors hover:border-[var(--console-border-strong)] hover:bg-white`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`h2`,{className:`console-mono line-clamp-1 text-sm font-semibold text-[var(--console-text)]`,children:e.displayName}),(0,P.jsx)(`p`,{className:`console-mono mt-1 break-all text-[11px] text-[var(--console-muted)]`,children:e.identityKey})]}),(0,P.jsxs)(`div`,{className:`console-mono flex shrink-0 flex-wrap gap-2 text-[11px] text-[var(--console-muted)]`,children:[(0,P.jsxs)(`span`,{children:[Zi(e.sessionCount),` sessions`]}),(0,P.jsxs)(`span`,{children:[Qi(e.tokens),` tokens`]}),(0,P.jsx)(`span`,{children:$i(e.cost)}),(0,P.jsx)(`span`,{children:ea(e.lastActivity)})]})]}),(0,P.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 md:flex-row md:items-center md:justify-between`,children:[(0,P.jsx)(ra,{agents:e.agentStats}),(0,P.jsx)(`span`,{className:`console-mono text-[10px] uppercase text-[var(--console-muted)]`,children:e.identityKind})]})]})})}function aa({projects:e}){let t=e.reduce((e,t)=>e+t.sessionCount,0),n=e.reduce((e,t)=>e+t.tokens,0),r=e.reduce((e,t)=>e+t.cost,0),i=Math.max(0,...e.map(e=>e.lastActivity??0));return e.length===0?(0,P.jsx)(`div`,{className:`mx-auto max-w-5xl rounded-sm border border-[var(--console-border)] bg-white p-6 text-sm text-[var(--console-muted)]`,children:`No projects found`}):(0,P.jsxs)(`div`,{className:`mx-auto max-w-5xl space-y-4`,children:[(0,P.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-4`,children:[(0,P.jsx)(na,{label:`Projects`,value:Zi(e.length)}),(0,P.jsx)(na,{label:`Sessions`,value:Zi(t)}),(0,P.jsx)(na,{label:`Tokens`,value:Qi(n)}),(0,P.jsx)(na,{label:`Total Cost`,value:$i(r),hint:i?`Latest ${ea(i)}`:void 0})]}),(0,P.jsx)(`ul`,{className:`grid gap-3`,children:e.map(e=>(0,P.jsx)(ia,{project:e},`${e.identityKind}:${e.identityKey}`))})]})}function oa({agents:e,activeAgent:t,onChange:n}){return(0,P.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-3`,children:(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`console-mono text-[10px] font-semibold uppercase text-[var(--console-muted)]`,children:`Agent`}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>n(void 0),className:`console-mono rounded-sm border px-2 py-1 text-[10px] transition-colors ${t?`border-[var(--console-border)] bg-[var(--console-surface-muted)] text-[var(--console-muted)] hover:bg-white`:`border-[var(--console-border-strong)] bg-[var(--console-accent)] text-white`}`,children:`All Agents`}),e.map(e=>{let r=M.agents[e.name],i=t===e.name;return(0,P.jsxs)(`button`,{type:`button`,onClick:()=>n(i?void 0:e.name),className:`console-mono inline-flex items-center gap-1 rounded-sm border px-2 py-1 text-[10px] transition-colors ${i?`border-[var(--console-border-strong)] bg-[var(--console-accent)] text-white`:`border-[var(--console-border)] bg-[var(--console-surface-muted)] text-[var(--console-muted)] hover:bg-white`}`,children:[r?.icon?(0,P.jsx)(`img`,{src:r.icon,alt:r.name,className:`size-3 object-contain`}):null,r?.name??e.name,` · `,e.sessions]},e.name)})]})})}function sa({project:e}){return(0,P.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`h2`,{className:`console-mono text-base font-semibold text-[var(--console-text)]`,children:e.displayName}),(0,P.jsxs)(`p`,{className:`console-mono mt-1 break-all text-[11px] text-[var(--console-muted)]`,children:[e.identityKind,`: `,e.identityKey]})]}),(0,P.jsx)(ra,{agents:e.agentStats})]})})}function ca({sessions:e}){if(e.length===0)return null;let t=e.toSorted((e,t)=>t.stats.total_cost-e.stats.total_cost).slice(0,5);return(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,P.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,P.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:`Top Cost`}),(0,P.jsxs)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:[t.length,` sessions`]})]}),(0,P.jsx)(`ul`,{className:`space-y-2`,children:t.map(e=>{let t=M.agents[e.agentKey];return(0,P.jsx)(`li`,{children:(0,P.jsxs)(d,{to:`/${e.fullPath}`,className:`block rounded-sm border border-transparent px-2 py-1.5 transition-colors hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t?.icon?(0,P.jsx)(`img`,{src:t.icon,alt:t.name,className:`size-3.5 object-contain`}):null,(0,P.jsx)(`span`,{className:`line-clamp-1 flex-1 text-sm text-[var(--console-text)]`,children:e.title}),(0,P.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:$i(e.stats.total_cost)})]}),(0,P.jsxs)(`p`,{className:`console-mono mt-1 text-[11px] text-[var(--console-muted)]`,children:[`/`,e.fullPath,` · `,Qi(ta(e)),` tokens`]})]})},e.fullPath)})})]})}function la({project:e,projectKey:t,dashboard:n,loading:r,error:i,sessions:a,activeAgent:o,onChangeAgent:s,isBookmarked:c,onToggleSessionBookmark:l}){if(!e)return(0,P.jsxs)(`div`,{className:`mx-auto max-w-4xl rounded-sm border border-[var(--console-border)] bg-white p-6`,children:[(0,P.jsx)(`h2`,{className:`console-mono text-sm font-semibold text-[var(--console-text)]`,children:`Project Not Found`}),(0,P.jsx)(`p`,{className:`console-mono mt-2 break-all text-xs text-[var(--console-muted)]`,children:t}),(0,P.jsx)(d,{to:`/projects`,className:`console-mono mt-4 inline-flex rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-xs text-[var(--console-text)] transition-colors hover:bg-white`,children:`Back to Projects`})]});let u=o?a.filter(e=>e.agentKey===o):a;return(0,P.jsxs)(`div`,{className:`mx-auto max-w-5xl space-y-4`,children:[(0,P.jsx)(sa,{project:e}),(0,P.jsx)(oa,{agents:e.agentStats,activeAgent:o,onChange:s}),r?(0,P.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-6 text-sm text-[var(--console-muted)]`,children:`Loading project dashboard`}):i?(0,P.jsx)(`div`,{className:`rounded-sm border border-[var(--console-error-border)] bg-[var(--console-error-bg)] p-6 text-sm text-[var(--console-error)]`,children:i}):n?(0,P.jsx)(Xi,{data:n,projects:[],bookmarkedSessions:[],isBookmarked:c,onToggleBookmark:(e,t)=>{`agentName`in e&&l(e,t??e.agentName.toLowerCase())}}):null,(0,P.jsx)(ca,{sessions:u})]})}var ua=class extends j.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`ErrorBoundary caught error:`,e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-error-border)] bg-[var(--console-error-bg)] p-6`,children:[(0,P.jsx)(`h3`,{className:`console-mono mb-2 text-sm font-semibold text-[var(--console-error)]`,children:`Something went wrong`}),(0,P.jsx)(`p`,{className:`console-mono text-xs text-[var(--console-muted)]`,children:this.state.error?.message||`Unknown error`})]}):this.props.children}};function da(e){return`'${e.replace(/'/g,`'\\''`)}'`}function fa({sessionId:e,directory:t}){let n=da(e),r=t??``;return r.trim()?`cd ${da(r)} && claude --resume ${n}`:`claude --resume ${n}`}async function pa(e){if(typeof navigator<`u`&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document>`u`)return!1;let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=!1;try{n=document.execCommand(`copy`)}catch{n=!1}return document.body.removeChild(t),n}function ma({sessionId:e,directory:t,className:n=``}){let[r,i]=(0,j.useState)(!1),a=fa({sessionId:e,directory:t});return(0,j.useEffect)(()=>{if(!r)return;let e=window.setTimeout(()=>i(!1),1500);return()=>window.clearTimeout(e)},[r]),(0,P.jsxs)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),pa(a).then(e=>{e&&i(!0)})},"aria-label":r?`Resume command copied: ${a}`:`Copy claude --resume command: ${a}`,title:r?`Copied: ${a}`:`Copy: ${a}`,className:`console-mono inline-flex items-center gap-1.5 rounded-sm border px-2 py-1 text-[11px] transition-colors ${n} ${r?`border-[var(--console-border-strong)] bg-[var(--console-surface-muted)] text-[var(--console-text)]`:`border-[var(--console-border)] bg-[var(--console-surface-muted)] text-[var(--console-muted)] hover:border-[var(--console-border-strong)] hover:text-[var(--console-text)]`}`,children:[r?(0,P.jsx)(u,{className:`size-3`,strokeWidth:1.8}):(0,P.jsx)(v,{className:`size-3`,strokeWidth:1.8}),(0,P.jsx)(`span`,{children:r?`Copied`:`Copy resume`})]})}var ha=`
|
|
39
|
+
[data-type='item'][data-item-type='file'] > [data-item-section='icon'] {
|
|
40
|
+
display: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[data-type='item'][data-item-type='file'] > [data-item-section='spacing'] {
|
|
44
|
+
padding-left: 2px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
[data-type='item'][data-item-type='file'] > [data-item-section='spacing'] > [data-item-section='spacing-item'] {
|
|
48
|
+
margin-right: 4px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[data-type='item'][data-item-type='file'] > [data-item-section='content'] {
|
|
52
|
+
flex: 1 1 auto;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
[data-type='item'][data-item-type='file'] > [data-item-section='decoration'] {
|
|
56
|
+
flex: 0 0 auto;
|
|
57
|
+
padding-inline: 8px 6px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
[data-type='item'][data-item-type='file'] > [data-item-section='decoration'] > span {
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
font-size: 18px;
|
|
63
|
+
line-height: 1;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
[data-type='item'][data-item-type='file'] [data-truncate-group-container='middle'] {
|
|
67
|
+
width: 100%;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
[data-type='item'][data-item-type='file']
|
|
71
|
+
[data-truncate-group-container='middle']
|
|
72
|
+
> div[data-truncate-segment-priority='2'] {
|
|
73
|
+
flex: 0 1 auto;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
[data-type='item'][data-item-type='file']
|
|
77
|
+
[data-truncate-group-container='middle']
|
|
78
|
+
> div[data-truncate-segment-priority='1'] {
|
|
79
|
+
flex: 1 999999 auto;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
[data-type='item'][data-item-type='file']
|
|
83
|
+
[data-truncate-group-container='middle']
|
|
84
|
+
[data-truncate-container='fruncate']
|
|
85
|
+
[data-truncate-grid] {
|
|
86
|
+
grid-template-columns: minmax(0, max-content) 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
[data-type='item'][data-item-type='file']
|
|
90
|
+
[data-truncate-group-container='middle']
|
|
91
|
+
[data-truncate-container='fruncate']
|
|
92
|
+
[data-truncate-content] {
|
|
93
|
+
direction: ltr;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
[data-type='item'][data-item-type='file']
|
|
97
|
+
[data-truncate-group-container='middle']
|
|
98
|
+
[data-truncate-container='fruncate']
|
|
99
|
+
[data-truncate-marker] {
|
|
100
|
+
right: 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
[data-type='item'][data-item-type='file'] [data-truncate-marker] {
|
|
104
|
+
display: none;
|
|
105
|
+
}
|
|
106
|
+
`;function ga(e){return e.replaceAll(`/`,`∕`).trim()||`(untitled)`}function _a(e){return e.replace(/\/+$/,``).split(`/`).at(-1)?.trim()||`(unknown)`}function va(e){let t=e.project_identity;if(t)return{key:`${t.kind}:${t.key}`,label:t.displayName||_a(e.directory)};let n=_a(e.directory);return{key:n===`(unknown)`?`__unknown__`:`path:${e.directory||n}`,label:n}}function ya(e){return e.time_updated??e.time_created}function ba(e,t,n){let r=e.get(t.path)??2**53-1,i=e.get(n.path)??2**53-1;return r===i?t.path.localeCompare(n.path):r-i}function xa(e){let t=new Map,n=new Map,r=new Map,i=new Map,a=new Map,o=new Map,s=new Set,c=[],l=new Map;for(let t of e){let{key:e,label:n}=va(t),r=l.get(e);r?r.sessions.push(t):l.set(e,{label:n,sessions:[t]})}let u=[...l.entries()].sort(([,e],[,t])=>{if(e.label===`(unknown)`)return 1;if(t.label===`(unknown)`)return-1;let n=Math.max(...e.sessions.map(ya));return Math.max(...t.sessions.map(ya))-n}),d=0,f=new Set;for(let[,e]of u){let l=ga(e.label),u=`${l}/`,p=2;for(;f.has(u);)u=`${l} (${p})/`,p+=1;f.add(u);let m=u.slice(0,-1),h=new Map;t.set(u,d),t.set(m,d),d+=1,a.set(u,`${e.sessions.length}`),a.set(m,`${e.sessions.length}`);for(let t of e.sessions)h.set(t.title,(h.get(t.title)??0)+1);for(let a of e.sessions){let e=(h.get(a.title)??0)>1?`${ga(a.title)} #${a.id.slice(0,8)}`:ga(a.title),l=`${u}${e}`,f=2;for(;s.has(l);)l=`${u}${e} (${f})`,f+=1;s.add(l),c.push(l),t.set(l,d),d+=1,n.set(a.id,l),r.set(a.id,u),i.set(l,a.id),o.set(l,a)}}return{paths:c,sortOrderByPath:t,pathBySessionId:n,groupPathBySessionId:r,sessionIdByPath:i,groupCountByPath:a,sessionByPath:o}}function Sa({sessions:e,activeSessionId:t,selectedSessionId:n,onSelectSession:r,bookmarkedSessionIds:a,onToggleBookmark:s}){let c=(0,j.useMemo)(()=>xa(e),[e]),l=(0,j.useRef)(c.sortOrderByPath),u=(0,j.useRef)(c.sessionIdByPath),d=(0,j.useRef)(c.groupCountByPath),f=(0,j.useRef)(c.sessionByPath),p=(0,j.useRef)(a),m=(0,j.useRef)(r),h=(0,j.useRef)(s),g={"--trees-bg-override":`transparent`,"--trees-border-color-override":`var(--console-border)`,"--trees-fg-override":`var(--console-text)`,"--trees-fg-muted-override":`var(--console-muted)`,"--trees-font-family-override":`"JetBrains Mono", "IBM Plex Mono", "SFMono-Regular", Menlo, Monaco, Consolas, monospace`,"--trees-font-size-override":`12px`,"--trees-item-margin-x-override":`0px`,"--trees-item-padding-x-override":`8px`,"--trees-selected-bg-override":`var(--console-surface-muted)`},{model:_}=o({flattenEmptyDirectories:!1,initialExpansion:`closed`,paths:c.paths,sort:(e,t)=>ba(l.current,e,t),density:`compact`,unsafeCSS:ha,onSelectionChange(e){let t=u.current.get(e[0]??``);t&&m.current(t)},renderRowDecoration({item:e}){let t=f.current.get(e.path);if(t){let e=p.current.has(t.id);return{text:e?`★`:`☆`,title:e?`Remove bookmark`:`Add bookmark`}}return d.current.get(e.path)?{text:d.current.get(e.path),title:`Sessions`}:null}});(0,j.useEffect)(()=>{l.current=c.sortOrderByPath,u.current=c.sessionIdByPath,d.current=c.groupCountByPath,f.current=c.sessionByPath,_.resetPaths(c.paths)},[_,c]),(0,j.useEffect)(()=>{m.current=r},[r]),(0,j.useEffect)(()=>{p.current=a,_.resetPaths(c.paths)},[a,_,c.paths]),(0,j.useEffect)(()=>{h.current=s},[s]);function ee(e){let t=e.nativeEvent.composedPath(),n=t.find(e=>e instanceof HTMLElement&&e.parentElement?.getAttribute(`data-item-section`)===`decoration`),r=t.find(e=>e instanceof HTMLElement&&e.getAttribute(`data-type`)===`item`),i=r?f.current.get(r.getAttribute(`data-item-path`)??``):null;!n||!i||(e.preventDefault(),e.stopPropagation(),h.current(i))}return(0,j.useEffect)(()=>{let e=c.pathBySessionId.get(t??``),r=c.pathBySessionId.get(n??``)??e,i=n??t??``,a=c.groupPathBySessionId.get(i);if(e&&_.getItem(e)?.select(),r&&t){let e=a?_.getItem(a):null;e&&`expand`in e&&e.expand(),_.focusPath(r);return}a&&_.focusPath(a)},[t,_,c,n]),(0,P.jsx)(`div`,{className:`session-tree h-[min(560px,calc(100vh-410px))] min-h-56 overflow-hidden`,style:g,onClickCapture:ee,children:(0,P.jsx)(i,{model:_,style:{height:`100%`},"aria-label":`Sessions`})})}function Ca(e,t){let n=e.replace(/^\/+|\/+$/g,``),r=n?n.split(`/`).map(e=>e.trim()).filter(Boolean):[];if(r.length===0)return{mode:`root`,activeAgentKey:null,activeSessionSlug:null};if(r[0]?.toLowerCase()===`projects`){if(r.length===1)return{mode:`projects`,activeAgentKey:null,activeSessionSlug:null};if(r.length===3)try{let e=decodeURIComponent(r[1]);return yi(e)?{mode:`project`,activeAgentKey:null,activeSessionSlug:null,activeProjectKind:e,activeProjectKey:xi(r[2])}:{mode:`invalidRoute`,activeAgentKey:null,activeSessionSlug:null}}catch{return{mode:`invalidRoute`,activeAgentKey:null,activeSessionSlug:null}}return{mode:`invalidRoute`,activeAgentKey:null,activeSessionSlug:null}}if(r.length===1){let e=r[0].toLowerCase();return t.has(e)?{mode:`agent`,activeAgentKey:e,activeSessionSlug:null}:{mode:`missingAgent`,activeAgentKey:null,activeSessionSlug:null,attemptedKey:e}}if(r.length===2){let e=r[0].toLowerCase(),n=r[1];return t.has(e)&&n?{mode:`session`,activeAgentKey:e,activeSessionSlug:n}:t.has(e)?{mode:`missingSession`,activeAgentKey:e,activeSessionSlug:n,attemptedSessionSlug:n}:{mode:`missingAgent`,activeAgentKey:null,activeSessionSlug:null,attemptedKey:e}}return{mode:`invalidRoute`,activeAgentKey:null,activeSessionSlug:null}}function wa(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function Ta(e){if(!e)return null;let{from:t,to:n,days:r}=e.window;if(t==null)return`All time`;let i=wa(t),a=wa(n??Date.now());return r?`Last ${r}d · ${i} → ${a}`:`${i} → ${a}`}function Ea(e,t,n){return t?e?`Searching for "${e}"`:`Loading recent sessions`:e?`${n} matches for "${e}"`:`${n} recent sessions`}function Da(e){return e.slug.split(`/`)[0]?.toLowerCase()||`unknown`}function Oa(e){return{kind:e.identityKind,key:e.identityKey}}function ka(e,t){return!!(e&&t&&e.kind===t.kind&&e.key===t.key)}function Aa(e){if(!e)return`unknown`;let t=Date.now()-e;if(Number.isNaN(t)||t<0)return`just now`;let n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function ja(e){return e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`).replaceAll(`'`,`'`).replaceAll(`<mark>`,`<mark>`).replaceAll(`</mark>`,`</mark>`)}var Ma=`codesesh.shortcuts-hint-dismissed`,Na=[`bugfix`,`refactoring`,`feature-dev`,`testing`,`docs`,`git-ops`,`build-deploy`,`exploration`,`planning`],Pa=[`apply_patch`,`bash`,`read`,`edit`,`grep`],Fa=[{kind:`read`,label:`Read`},{kind:`edit`,label:`Edit`},{kind:`write`,label:`Write`},{kind:`delete`,label:`Delete`}],Ia=[{id:`paid`,label:`Cost > $0`,costMin:1e-6},{id:`one_plus`,label:`Cost >= $1`,costMin:1},{id:`ten_plus`,label:`Cost >= $10`,costMin:10}],La={recent:`Recent`,title:`Title`,user_message:`User message`,assistant_reply:`Assistant reply`,tool_output:`Tool output`,file_path:`File path`},Ra=[{title:`Navigation`,items:[{keys:`j / k`,description:`Move through sessions or search results`},{keys:`Enter`,description:`Open the current selection`},{keys:`g / G`,description:`Jump to the first or last item`}]},{title:`Search`,items:[{keys:`Cmd/Ctrl K`,description:`Open global search`},{keys:`/`,description:`Focus the search box`},{keys:`Esc`,description:`Exit search or close the current detail view`}]},{title:`Groups`,items:[{keys:`g / G`,description:`Jump to the first or last session`},{keys:`?`,description:`Open this shortcuts panel`}]}];function za(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||t===`select`||e.isContentEditable}function Ba({value:e,onChange:t}){return(0,P.jsx)(`div`,{role:`radiogroup`,"aria-label":`Browse by`,className:`grid gap-1.5`,children:[{value:`projects`,label:`Projects`},{value:`agents`,label:`Agents`}].map(n=>{let r=e===n.value;return(0,P.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r,onClick:()=>t(n.value),className:`console-mono flex items-center gap-2 rounded-sm border px-3 py-1.5 text-left text-xs transition-colors ${r?`border-[var(--console-border-strong)] bg-white text-[var(--console-text)]`:`border-transparent text-[var(--console-muted)] hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`}`,children:[(0,P.jsx)(`span`,{className:`flex size-3 shrink-0 items-center justify-center rounded-full border ${r?`border-[var(--console-accent)]`:`border-[var(--console-border-strong)]`}`,children:r?(0,P.jsx)(`span`,{className:`size-1.5 rounded-full bg-[var(--console-accent)]`}):null}),(0,P.jsx)(`span`,{children:n.label})]},n.value)})})}function Va({sessions:e,activeSessionId:t,selectedSessionId:n,bookmarkedSessionIds:r,onSelectSession:i,onToggleBookmark:a}){return(0,P.jsx)(`div`,{className:`console-scrollbar h-[min(560px,calc(100vh-410px))] min-h-56 overflow-y-auto`,children:(0,P.jsx)(`ul`,{className:`space-y-1`,children:e.map(e=>{let o=Da(e),s=M.agents[o],c=t===e.id,l=n===e.id;return(0,P.jsx)(`li`,{children:(0,P.jsxs)(`div`,{className:`flex items-start gap-1 rounded-sm border px-2 py-1.5 transition-colors ${c||l?`border-[var(--console-border-strong)] bg-white text-[var(--console-text)]`:`border-transparent text-[var(--console-muted)] hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`}`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>i(e),className:`min-w-0 flex-1 text-left`,children:[(0,P.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[s?.icon?(0,P.jsx)(`img`,{src:s.icon,alt:s.name,className:`size-3.5 shrink-0 object-contain`}):null,(0,P.jsx)(`span`,{className:`console-mono line-clamp-1 text-xs text-[var(--console-text)]`,children:e.title})]}),(0,P.jsx)(`span`,{className:`console-mono mt-0.5 block truncate text-[10px] text-[var(--console-muted)]`,children:Aa(e.time_updated??e.time_created)})]}),(0,P.jsx)(Xr,{active:r.has(e.id),onToggle:()=>a(e)})]})},e.slug)})})})}function Ha(){let e=m(),[t,n]=(0,j.useState)([]),[r,i]=(0,j.useState)([]),[a,o]=(0,j.useState)([]),[s,c]=(0,j.useState)(!0),[l,u]=(0,j.useState)(null),[p,h]=(0,j.useState)(null),[g,_]=(0,j.useState)(!1),[ee,v]=(0,j.useState)(null),[te,y]=(0,j.useState)(null),[b,ne]=(0,j.useState)(null),[x,re]=(0,j.useState)([]),[S,ie]=(0,j.useState)(`agents`),[ae,oe]=(0,j.useState)(null),[se,ce]=(0,j.useState)(null),[le,ue]=(0,j.useState)(!1),[de,fe]=(0,j.useState)(null),[C,pe]=(0,j.useState)(void 0),[w,me]=(0,j.useState)(null),[T,he]=(0,j.useState)(``),[E,ge]=(0,j.useState)(``),[_e,ve]=(0,j.useState)(!1),[D,ye]=(0,j.useState)({}),[O,be]=(0,j.useState)([]),[xe,Se]=(0,j.useState)(!1),[Ce,k]=(0,j.useState)(null),[we,Te]=(0,j.useState)(0),[Ee,De]=(0,j.useState)(!1),[Oe,ke]=(0,j.useState)(!0),Ae=(0,j.useRef)(null),je=(0,j.useRef)(new Map);(0,j.useEffect)(()=>{let e=new AbortController,t=performance.now();return N(`app.load.start`,{path:window.location.pathname}),(async()=>{try{let e=await Ne();me(e);let[r,a,s,c,l]=await Promise.all([Pe(),Ie({from:e.window.from,to:e.window.to}),Re(e.window).catch(e=>(console.error(`Failed to load dashboard:`,e),null)),Fe().catch(e=>(console.error(`Failed to load projects:`,e),{projects:[]})),Be()]);n(r),i(a.sessions),re(c.projects),o(l.bookmarks),s&&ne(s),N(`app.load.done`,{duration_ms:Math.round(performance.now()-t),agents:r.length,sessions:a.sessions.length,projects:c.projects.length,dashboard:!!s})}catch(e){console.error(`Failed to load data:`,e),N(`app.load.error`,{duration_ms:Math.round(performance.now()-t),error:e instanceof Error?e.message:String(e)}),u(`Failed to load data. Is the CLI server running?`)}finally{c(!1)}})(),()=>e.abort()},[]);let A=f(),Me=(0,j.useMemo)(()=>new Set(t.map(e=>e.name.toLowerCase())),[t]),Ge=(0,j.useMemo)(()=>new Map(t.map(e=>[e.name.toLowerCase(),e.displayName])),[t]),F=_e,I=(0,j.useMemo)(()=>Ca(A.pathname,Me),[A.pathname,Me]);(0,j.useEffect)(()=>{N(`route.change`,{path:A.pathname,mode:I.mode,agent:I.activeAgentKey,session:I.activeSessionSlug})},[A.pathname,I.mode,I.activeAgentKey,I.activeSessionSlug]),(0,j.useEffect)(()=>{if(I.mode===`projects`||I.mode===`project`){ie(`projects`),I.mode===`project`&&oe({kind:I.activeProjectKind,key:I.activeProjectKey});return}(I.mode===`agent`||I.mode===`missingAgent`)&&ie(`agents`)},[I]);let Ke=F?E:typeof A.state==`object`&&A.state!==null&&`searchQuery`in A.state&&typeof A.state.searchQuery==`string`?A.state.searchQuery:``,qe=(0,j.useMemo)(()=>{let e={};for(let n of t)e[n.name]=[];for(let t of r){let n=t.slug.split(`/`)[0]?.toLowerCase();n&&e[n]&&e[n].push(t)}for(let t of Object.keys(e))e[t].sort((e,t)=>(t.time_updated??t.time_created)-(e.time_updated??e.time_created));return e},[r,t]);(0,j.useEffect)(()=>{let e=!1;return o(t=>{let n=_i(t,r);return n===t?t:(He(n.map(({bookmarked_at:e,...t})=>t)).catch(t=>{e||console.error(`Failed to sync bookmark snapshots:`,t)}),n)}),()=>{e=!0}},[r]),(0,j.useEffect)(()=>{let e=!1;return(async()=>{let t=mi();if(t.length!==0)try{let n=await He(t.map(({bookmarked_at:e,...t})=>t));if(e)return;o(n.bookmarks),hi()}catch(t){e||console.error(`Failed to migrate legacy bookmarks:`,t)}})(),()=>{e=!0}},[]);let Ye=(0,j.useMemo)(()=>new Set(a.map(e=>fi(e.agentKey,e.sessionId))),[a]);function L(e,t){return Ye.has(fi(e,t))}function R(e){let t=fi(e.agentKey,e.sessionId),n=Ye.has(t),r=a;o(n?r.filter(e=>fi(e.agentKey,e.sessionId)!==t):[...r,e].toSorted((e,t)=>{let n=e.time_updated??e.time_created;return(t.time_updated??t.time_created)-n})),N(n?`bookmark.delete`:`bookmark.add`,{agent:e.agentKey,session:e.sessionId}),(n?Ue(e.agentKey,e.sessionId):Ve({agentKey:e.agentKey,sessionId:e.sessionId,fullPath:e.fullPath,title:e.title,directory:e.directory,time_created:e.time_created,time_updated:e.time_updated,stats:e.stats})).catch(e=>{console.error(`Failed to toggle bookmark:`,e),o(r)})}function Xe(e,t){R(pi(e,t))}let z=I.activeAgentKey,B=I.mode===`project`?I.activeProjectKind:null,V=I.mode===`project`?I.activeProjectKey:null,H=(0,j.useMemo)(()=>B&&V?{kind:B,key:V}:null,[B,V]),Ze=H?bi(H):null,Qe=(0,j.useMemo)(()=>I.mode===`session`?r.find(e=>Da(e)===I.activeAgentKey&&e.id===I.activeSessionSlug)??null:null,[r,I]),$e=(I.mode===`session`&&p?.id===I.activeSessionSlug?p:null)?.project_identity??Qe?.project_identity??null,U=S===`projects`?H??(I.mode===`session`?$e:ae):null,et=U?bi(U):null,tt=(0,j.useMemo)(()=>z?qe[z]??[]:[],[z,qe]),nt=(0,j.useMemo)(()=>et?r.filter(e=>ka(e.project_identity,U)&&(!C||Da(e)===C)).toSorted((e,t)=>(t.time_updated??t.time_created)-(e.time_updated??e.time_created)):[],[C,et,U,r]),W=S===`projects`?nt:tt,rt=(0,j.useMemo)(()=>W.length===0?new Set:new Set(W.filter(e=>Ye.has(fi(Da(e),e.id))).map(e=>e.id)),[Ye,W]),it=(0,j.useMemo)(()=>a.toSorted((e,t)=>(t.time_updated??t.time_created)-(e.time_updated??e.time_created)),[a]),at=(0,j.useMemo)(()=>{let e=Ia.find(e=>e.id===D.costRange);return{agent:D.agent,projectKey:D.projectKey,tag:D.tag,tool:D.tool,fileKind:D.fileKind,costMin:e?.costMin}},[D]),G=E.trim().length>0||!!(D.tool||D.fileKind),ot=(0,j.useMemo)(()=>{let e=Ia.find(e=>e.id===D.costRange);return r.filter(t=>!(D.agent&&Da(t)!==D.agent||D.projectKey&&t.project_identity?.key!==D.projectKey||D.tag&&!t.smart_tags?.includes(D.tag)||e&&t.stats.total_cost<e.costMin)).toSorted((e,t)=>(t.time_updated??t.time_created)-(e.time_updated??e.time_created)).slice(0,50).map(e=>({agentName:Da(e),session:e,snippet:`Recent session · ${e.directory}`,matchType:`recent`}))},[D,r]),st=I.mode===`session`?`${I.activeAgentKey}/${I.activeSessionSlug}`:``,ct=(0,j.useEffectEvent)(async e=>{try{let[t,r,a,o,s,c]=await Promise.all([Pe(),Ie({from:w?.window.from,to:w?.window.to}),Re(w?.window).catch(e=>(console.error(`Failed to refresh dashboard:`,e),null)),Fe().catch(e=>(console.error(`Failed to refresh projects:`,e),{projects:[]})),I.mode===`project`?Re(w?.window,{projectKind:I.activeProjectKind,projectKey:I.activeProjectKey,agent:C}).catch(e=>(console.error(`Failed to refresh project dashboard:`,e),null)):Promise.resolve(null),F&&G?ze(E,at).catch(e=>(console.error(`Failed to refresh search results:`,e),{results:[]})):Promise.resolve(null)]);if(n(t),i(r.sessions),re(o.projects),a&&ne(a),s&&ce(s),c&&be(c.results),I.mode===`session`)try{h(await Le(I.activeAgentKey,I.activeSessionSlug)),v(null)}catch{h(null),v(`Session not found`)}e.newSessions>0?y(`发现 ${e.newSessions} 个新会话,列表已自动刷新`):e.updatedSessions>0&&y(`会话内容已同步`)}catch(e){console.error(`Failed to sync live session update:`,e)}});(0,j.useEffect)(()=>{if(!F){be([]),Se(!1);return}if(!G){be(ot),Se(!1);return}let e=!1;Se(!0);let t=performance.now();return N(`search.start`,{query_length:E.length}),ze(E,at).then(n=>{e||(be(n.results),N(`search.done`,{duration_ms:Math.round(performance.now()-t),results:n.results.length}))}).catch(n=>{e||(console.error(`Failed to load search results:`,n),N(`search.error`,{duration_ms:Math.round(performance.now()-t),error:n instanceof Error?n.message:String(n)}),be([]))}).finally(()=>{e||Se(!1)}),()=>{e=!0}},[E,F,ot,at,G]),(0,j.useEffect)(()=>{if(I.mode!==`session`){h(null),v(null);return}let e=new AbortController;_(!0),v(null);let t=performance.now();return N(`session.open.start`,{agent:I.activeAgentKey,session:I.activeSessionSlug}),(async()=>{try{let e=await Le(I.activeAgentKey,I.activeSessionSlug);h(e),N(`session.open.done`,{agent:I.activeAgentKey,session:I.activeSessionSlug,duration_ms:Math.round(performance.now()-t),messages:e.messages.length})}catch(e){N(`session.open.error`,{agent:I.activeAgentKey,session:I.activeSessionSlug,duration_ms:Math.round(performance.now()-t),error:e instanceof Error?e.message:String(e)}),v(`Session not found`),h(null)}finally{_(!1)}})(),()=>e.abort()},[st,I.activeAgentKey,I.activeSessionSlug,I.mode]),(0,j.useEffect)(()=>{Ze&&pe(void 0)},[Ze]),(0,j.useEffect)(()=>{if(!V||!w){ce(null),fe(null),ue(!1);return}let e=!1;return ue(!0),fe(null),Re(w.window,{projectKind:B??void 0,projectKey:V,agent:C}).then(t=>{e||ce(t)}).catch(t=>{e||(console.error(`Failed to load project dashboard:`,t),ce(null),fe(`Failed to load project dashboard`))}).finally(()=>{e||ue(!1)}),()=>{e=!0}},[B,V,w,C]),(0,j.useEffect)(()=>We(e=>{ct(e)}),[]),(0,j.useEffect)(()=>{if(!te)return;let e=window.setTimeout(()=>{y(null)},3500);return()=>{window.clearTimeout(e)}},[te]),(0,j.useEffect)(()=>{try{ke(window.localStorage.getItem(Ma)===`1`)}catch{ke(!0)}},[]),(0,j.useEffect)(()=>{if(F){Te(e=>O.length===0?0:Math.min(e,O.length-1));return}if(I.mode===`session`){k(I.activeSessionSlug);return}if(I.mode===`agent`){k(null);return}k(null)},[F,O.length,I.mode,I.activeSessionSlug,W]),(0,j.useEffect)(()=>{if(!F)return;let e=O[we];if(!e)return;let t=`${e.agentName}/${e.session.id}`;je.current.get(t)?.scrollIntoView({block:`nearest`})},[F,O,we]);let lt=(0,j.useMemo)(()=>r.map(e=>{let t=e.slug.split(`/`)[0]?.toLowerCase()||`unknown`;return{...e,agentKey:t,sessionSlug:e.id,fullPath:e.slug}}),[r]),ut=(0,j.useMemo)(()=>H?lt.filter(e=>ka(e.project_identity,H)):[],[H,lt]),dt=(0,j.useMemo)(()=>t.filter(e=>e.count>0).map(e=>({key:e.name.toLowerCase(),name:e.displayName,icon:e.icon,count:e.count})),[t]),ft=(0,j.useMemo)(()=>t.find(e=>e.name.toLowerCase()===z)??null,[z,t]),pt=(0,j.useMemo)(()=>x.find(e=>Ze===bi(Oa(e)))??null,[Ze,x]),mt=(0,j.useMemo)(()=>x.find(e=>et===bi(Oa(e)))??null,[x,et]),ht=(0,j.useMemo)(()=>{let e=new Map;for(let t of r){let n=t.project_identity;if(!n?.key)continue;let r=e.get(n.key);r?r.count+=1:e.set(n.key,{key:n.key,label:n.displayName||t.directory,count:1})}return[...e.values()].toSorted((e,t)=>t.count-e.count).slice(0,8)},[r]),K=`CodeSesh`,q=`Select an agent to browse sessions`;if(I.mode===`root`&&(K=F?`Search`:`Dashboard`,q=F?Ea(E,xe,O.length):b?`${b.totals.sessions.toLocaleString(`en-US`)} total sessions across ${b.perAgent.length} agents`:`Aggregated view across all agents`),I.mode===`projects`&&(K=`Projects`,q=`${x.length.toLocaleString(`en-US`)} projects across ${r.length.toLocaleString(`en-US`)} sessions`),I.mode===`project`&&(K=pt?.displayName??`Project`,q=pt?`${pt.sessionCount.toLocaleString(`en-US`)} sessions · ${pt.agentStats.length} agents`:I.activeProjectKey),I.mode===`agent`&&z&&(K=ft?.displayName??z,q=`${W.length} sessions`),I.mode===`session`){if(ee)K=`Session Not Found`,q=`Requested /${z}/${I.activeSessionSlug}`;else if(p){K=p.title||`Conversation`;let e=p.time_updated??p.time_created;q=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`span`,{children:[`ID: #`,p.id.slice(0,8)]}),(0,P.jsx)(`span`,{children:`·`}),(0,P.jsxs)(`span`,{children:[`Updated `,Aa(e)]}),(0,P.jsx)(Je,{tags:p.smart_tags,limit:9,className:`inline-flex`})]})}}I.mode===`missingAgent`&&(K=`Agent Not Found`,q=`Requested /${I.attemptedKey}`),I.mode===`missingSession`&&(K=`Session Not Found`,q=`Session not found in /${z}`),F&&(K=`Search`,q=Ea(E,xe,O.length));let gt=(0,j.useMemo)(()=>{if(F)return[{label:`Search`}];let e={label:`Dashboard`,to:S===`agents`&&I.mode===`root`||S===`projects`&&I.mode===`projects`?void 0:S===`projects`?`/projects`:`/`};if(I.mode===`root`)return[{label:`Dashboard`}];let t={label:`Projects`,to:I.mode===`project`?`/projects`:void 0};if(I.mode===`projects`)return[e,{label:`Projects`}];if(I.mode===`project`)return[e,t,{label:pt?.displayName??I.activeProjectKey}];if(I.mode===`session`&&S===`projects`&&U)return[e,{label:`Projects`,to:`/projects`},{label:mt?.displayName??U.key,to:Si(U)},{label:p?.title||I.activeSessionSlug||`Conversation`}];if(I.mode===`missingAgent`)return[e,{label:I.attemptedKey}];let n=ft?.displayName??z??`Unknown Agent`,r={label:n,to:I.mode===`session`?`/${z}`:void 0};return I.mode===`agent`?[e,{label:n}]:I.mode===`missingSession`?[e,r,{label:I.attemptedSessionSlug}]:I.mode===`session`?[e,r,{label:p?.title||I.activeSessionSlug||`Conversation`}]:[e,{label:`Invalid Route`}]},[ft,z,pt,S,F,mt,U,p?.title,I]),_t;_t=s?(0,P.jsx)(Yr,{}):F?(0,P.jsx)(Ua,{query:E,loading:xe,results:O,agentNameMap:Ge,agents:t,projects:ht,filters:D,onChangeFilters:ye,onOpenResult:()=>{ve(!1),ge(``)},selectedIndex:we,registerResultRef:(e,t)=>{t?je.current.set(e,t):je.current.delete(e)}}):l?(0,P.jsx)(`div`,{className:`mx-auto max-w-4xl rounded-sm border border-[var(--console-error-border)] bg-[var(--console-error-bg)] p-6 text-sm text-[var(--console-error)]`,children:l}):I.mode===`root`?b?(0,P.jsx)(Xi,{data:b,projects:x,bookmarkedSessions:it,isBookmarked:L,onToggleBookmark:(e,t)=>{if(`agentName`in e){Xe(e,t??e.agentName.toLowerCase());return}R(e)}}):(0,P.jsx)(si,{type:`global`,sessions:lt,agentItems:dt,isBookmarked:L,onToggleBookmark:e=>Xe(e,e.agentKey)}):I.mode===`projects`?(0,P.jsx)(aa,{projects:x}):I.mode===`project`?(0,P.jsx)(la,{project:pt,projectKey:I.activeProjectKey,dashboard:se,loading:le,error:de,sessions:ut,activeAgent:C,onChangeAgent:pe,isBookmarked:L,onToggleSessionBookmark:Xe}):I.mode===`agent`&&z?(0,P.jsx)(si,{type:`agent`,sessions:lt.filter(e=>e.agentKey===z),agentItems:dt,activeAgentKey:z,isBookmarked:L,onToggleBookmark:e=>Xe(e,e.agentKey)}):I.mode===`session`?g?(0,P.jsx)(Yr,{}):ee||!p?(0,P.jsx)(si,{type:`missing-session`,sessions:lt.filter(e=>e.agentKey===I.activeAgentKey),agentItems:dt,activeAgentKey:I.activeAgentKey,attemptedSessionSlug:I.activeSessionSlug,isBookmarked:L,onToggleBookmark:e=>Xe(e,e.agentKey)}):(0,P.jsx)(Nr,{session:p,highlightQuery:Ke}):I.mode===`missingAgent`?(0,P.jsx)(si,{type:`missing-agent`,sessions:lt,agentItems:dt,attemptedAgentKey:I.attemptedKey,isBookmarked:L,onToggleBookmark:e=>Xe(e,e.agentKey)}):(0,P.jsx)(`div`,{className:`text-sm text-[var(--console-muted)]`,children:`Invalid route.`});function vt(){ge(T.trim()),ve(!0),Te(0)}function J(){ke(!0);try{window.localStorage.setItem(Ma,`1`)}catch{}}function yt(t){if(ie(t),k(null),t===`projects`){let t=$e??(I.mode===`session`?null:ae);e(t?Si(t):`/projects`);return}e(`/`)}let bt=(0,j.useEffectEvent)(t=>{let n=t.key;if((t.metaKey||t.ctrlKey)&&n.toLowerCase()===`k`){t.preventDefault(),ve(!0),Te(0),window.setTimeout(()=>{Ae.current?.focus(),Ae.current?.select()},0);return}if(t.defaultPrevented||t.metaKey||t.ctrlKey||t.altKey||t.isComposing)return;let r=t.target,i=za(r);if(Ee){n===`Escape`&&(t.preventDefault(),De(!1));return}if(i){n===`Escape`&&(t.preventDefault(),r instanceof HTMLElement&&r.blur());return}if(n===`?`){t.preventDefault(),De(!0),J();return}if(n===`/`){t.preventDefault(),J(),ve(!0),Ae.current?.focus(),Ae.current?.select();return}if(n===`Escape`){if(t.preventDefault(),F){ve(!1),ge(``),he(``);return}if(I.mode===`session`&&I.activeAgentKey){if(S===`projects`&&U){e(Si(U));return}e(`/${I.activeAgentKey}`)}return}if(F){if(O.length===0)return;if(n===`j`){t.preventDefault(),J(),Te(e=>Math.min(e+1,O.length-1));return}if(n===`k`){t.preventDefault(),J(),Te(e=>Math.max(e-1,0));return}if(n===`g`){t.preventDefault(),J(),Te(0);return}if(n===`G`){t.preventDefault(),J(),Te(O.length-1);return}if(n===`Enter`){let n=O[we];if(!n)return;t.preventDefault(),J(),ve(!1),ge(``),e(`/${n.agentName.toLowerCase()}/${n.session.id}`,{state:{searchQuery:E}})}return}if(S===`agents`&&!z||W.length===0)return;let a=e=>{J();let t=W.findIndex(e=>e.id===Ce),n=t>=0?t:e>=0?-1:W.length;k(W[Math.max(0,Math.min(n+e,W.length-1))]?.id??null)};if(n===`j`){t.preventDefault(),a(1);return}if(n===`k`){t.preventDefault(),a(-1);return}if(n===`g`){t.preventDefault(),J(),k(W[0]?.id??null);return}if(n===`G`){t.preventDefault(),J(),k(W.at(-1)?.id??null);return}if(n===`Enter`){let n=W.find(e=>e.id===Ce);if(!n)return;t.preventDefault(),J(),e(S===`projects`?`/${n.slug}`:`/${z}/${n.id}`)}});return(0,j.useEffect)(()=>(window.addEventListener(`keydown`,bt),()=>window.removeEventListener(`keydown`,bt)),[]),(0,P.jsxs)(`div`,{className:`console-ui flex h-screen flex-col overflow-hidden bg-[var(--console-bg)] text-[var(--console-text)]`,children:[(0,P.jsx)(`header`,{className:`shrink-0 border-b border-[var(--console-border)] bg-white/85 backdrop-blur-sm`,children:(0,P.jsxs)(`div`,{className:`grid min-h-14 grid-cols-[auto_1fr] items-center gap-3 px-4 py-2 sm:grid-cols-[auto_1fr_auto] sm:py-0`,children:[(0,P.jsxs)(d,{to:`/`,className:`flex items-center gap-2 text-[var(--console-text)]`,children:[(0,P.jsx)(`img`,{src:`/logo.svg?v=3`,alt:`CodeSesh`,className:`h-6 w-6 rounded-sm`}),(0,P.jsx)(`span`,{className:`console-mono text-sm font-semibold uppercase tracking-[0.05em]`,children:`CodeSesh`})]}),(0,P.jsxs)(`form`,{className:`order-3 col-span-2 flex w-full items-center justify-center gap-2 sm:order-none sm:col-span-1 sm:mx-auto sm:max-w-[560px]`,onSubmit:e=>{e.preventDefault(),vt()},children:[(0,P.jsx)(`label`,{className:`flex min-w-0 flex-1 items-center rounded-sm border border-[var(--console-border)] bg-white px-2 py-1`,children:(0,P.jsx)(`input`,{ref:Ae,value:T,onChange:e=>he(e.target.value),placeholder:`Search sessions /`,className:`console-mono w-full min-w-0 bg-transparent text-xs text-[var(--console-text)] outline-none placeholder:text-[var(--console-muted)]`})}),(0,P.jsx)(`button`,{type:`submit`,className:`console-mono rounded-sm border border-[var(--console-border-strong)] bg-[var(--console-surface-muted)] px-3 py-1 text-xs text-[var(--console-text)] transition-colors hover:bg-white`,children:`Search`})]}),(0,P.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>{De(!0),J()},className:`console-mono rounded-sm border border-[var(--console-border)] bg-white px-2 py-1 text-xs text-[var(--console-text)] transition-colors hover:bg-[var(--console-surface-muted)]`,title:`Show keyboard shortcuts`,children:[`?`,(0,P.jsx)(`span`,{className:`hidden sm:inline`,children:` Shortcuts`})]}),Ta(w)?(0,P.jsx)(`span`,{className:`console-mono hidden rounded-sm border border-[var(--console-border)] bg-white px-2 py-1 text-xs text-[var(--console-text)] md:inline-flex`,title:`Time window applied to agent counts, dashboard, and session list`,children:Ta(w)}):null,(0,P.jsxs)(`span`,{className:`console-mono hidden rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-xs text-[var(--console-muted)] sm:inline-flex`,children:[`v`,`0.6.1`]})]})]})}),(0,P.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,P.jsx)(`aside`,{className:`hidden w-64 shrink-0 flex-col border-r border-[var(--console-border)] bg-[var(--console-sidebar-bg)] lg:flex`,children:(0,P.jsxs)(`div`,{className:`console-scrollbar flex-1 space-y-8 overflow-y-auto px-4 py-6`,children:[(0,P.jsxs)(`section`,{children:[(0,P.jsx)(`h3`,{className:`console-mono mb-3 text-xs font-bold uppercase text-[var(--console-text)]`,children:`BROWSE BY`}),(0,P.jsx)(Ba,{value:S,onChange:yt})]}),(0,P.jsxs)(`section`,{children:[(0,P.jsx)(`h3`,{className:`console-mono mb-3 text-xs font-bold uppercase text-[var(--console-text)]`,children:`NAVIGATION`}),(0,P.jsxs)(`ul`,{className:`space-y-1 ${S===`projects`?`console-scrollbar max-h-[min(280px,calc(100vh-440px))] overflow-y-auto pr-1`:``}`,children:[(0,P.jsx)(`li`,{children:(0,P.jsxs)(d,{to:S===`projects`?`/projects`:`/`,className:`flex items-center gap-2 rounded-sm border px-3 py-1.5 text-left transition-colors ${S===`agents`&&I.mode===`root`||S===`projects`&&I.mode===`projects`?`border-[var(--console-border-strong)] bg-white text-[var(--console-text)]`:`border-transparent text-[var(--console-muted)] hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`}`,children:[(0,P.jsx)(`img`,{src:`/logo.svg?v=3`,alt:`Dashboard`,className:`size-3.5 rounded-[2px]`}),(0,P.jsx)(`span`,{className:`console-mono line-clamp-1 flex-1 text-xs`,children:`Dashboard`})]})}),S===`agents`?t.map(e=>{let t=e.name.toLowerCase(),n=t===z,r=M.agents[t];return(0,P.jsx)(`li`,{children:(0,P.jsxs)(d,{to:`/${t}`,className:`ml-4 flex items-center gap-2 rounded-sm border px-3 py-1.5 text-left transition-colors ${n?`border-[var(--console-border-strong)] bg-white text-[var(--console-text)]`:`border-transparent text-[var(--console-muted)] hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`}`,children:[r?.icon&&(0,P.jsx)(`img`,{src:r.icon,alt:e.displayName,className:`size-3.5 object-contain`}),(0,P.jsx)(`span`,{className:`console-mono line-clamp-1 flex-1 text-xs`,children:e.displayName}),(0,P.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:e.count})]})},e.name)}):x.map(e=>{let t=Oa(e),n=et===bi(t);return(0,P.jsx)(`li`,{children:(0,P.jsxs)(d,{to:Si(t),onClick:()=>oe(t),className:`ml-4 flex min-w-0 items-center gap-2 rounded-sm border px-3 py-1.5 text-left transition-colors ${n?`border-[var(--console-border-strong)] bg-white text-[var(--console-text)]`:`border-transparent text-[var(--console-muted)] hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`}`,children:[(0,P.jsx)(`span`,{className:`console-mono min-w-0 flex-1 truncate text-xs`,children:e.displayName}),(0,P.jsx)(`span`,{className:`console-mono shrink-0 text-[11px] text-[var(--console-muted)]`,children:e.sessionCount})]})},`${e.identityKind}:${e.identityKey}`)}),S===`agents`&&t.length===0&&!s?(0,P.jsx)(`li`,{children:(0,P.jsx)(`span`,{className:`console-mono block rounded-sm px-3 py-1.5 text-xs text-[var(--console-muted)]`,children:`No agents found`})}):null,S===`projects`&&x.length===0&&!s?(0,P.jsx)(`li`,{children:(0,P.jsx)(`span`,{className:`console-mono block rounded-sm px-3 py-1.5 text-xs text-[var(--console-muted)]`,children:`No projects found`})}):null]})]}),(0,P.jsxs)(`section`,{children:[(0,P.jsx)(`h3`,{className:`console-mono mb-3 text-xs font-bold uppercase text-[var(--console-text)]`,children:`BOOKMARKS`}),it.length===0?(0,P.jsx)(`span`,{className:`console-mono block rounded-sm px-3 py-1.5 text-xs text-[var(--console-muted)]`,children:`No bookmarks yet`}):(0,P.jsx)(`ul`,{className:`space-y-1`,children:it.map(e=>{let t=I.mode===`session`&&I.activeAgentKey===e.agentKey&&I.activeSessionSlug===e.sessionId,n=M.agents[e.agentKey];return(0,P.jsx)(`li`,{children:(0,P.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm border px-2 py-1.5 transition-colors ${t?`border-[var(--console-border-strong)] bg-white text-[var(--console-text)]`:`border-transparent text-[var(--console-muted)] hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`}`,children:[(0,P.jsxs)(d,{to:`/${e.fullPath}`,className:`flex min-w-0 flex-1 items-start gap-2`,children:[n?.icon?(0,P.jsx)(`img`,{src:n.icon,alt:n.name,className:`mt-0.5 size-3.5 shrink-0 object-contain`}):null,(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`span`,{className:`console-mono line-clamp-1 block text-xs`,children:e.title}),(0,P.jsx)(`span`,{className:`console-mono mt-0.5 line-clamp-1 block text-[10px] text-[var(--console-muted)]`,children:n?.name??e.agentKey})]})]}),(0,P.jsx)(Xr,{active:!0,onToggle:()=>R(e)})]})},fi(e.agentKey,e.sessionId))})})]}),(0,P.jsxs)(`section`,{children:[(0,P.jsxs)(`h3`,{className:`console-mono mb-3 text-xs font-bold uppercase text-[var(--console-text)]`,children:[`SESSIONS`,W.length>0?(0,P.jsx)(`span`,{className:`ml-2 text-[10px] font-normal text-[var(--console-muted)]`,children:`Navigate j k · Open Enter`}):null]}),S===`agents`&&!z?(0,P.jsx)(`span`,{className:`console-mono block rounded-sm px-3 py-1.5 text-xs text-[var(--console-muted)]`,children:`Select an agent`}):S===`projects`&&!et?(0,P.jsx)(`span`,{className:`console-mono block rounded-sm px-3 py-1.5 text-xs text-[var(--console-muted)]`,children:`Select a project`}):W.length===0?(0,P.jsx)(`span`,{className:`console-mono block rounded-sm px-3 py-1.5 text-xs text-[var(--console-muted)]`,children:`No sessions yet`}):S===`projects`?(0,P.jsx)(Va,{sessions:W,activeSessionId:I.mode===`session`?I.activeSessionSlug:null,selectedSessionId:Ce,bookmarkedSessionIds:rt,onSelectSession:t=>{k(t.id),e(`/${t.slug}`)},onToggleBookmark:e=>Xe(e,Da(e))}):(0,P.jsx)(Sa,{sessions:W,activeSessionId:I.mode===`session`?I.activeSessionSlug:null,selectedSessionId:Ce,onSelectSession:t=>{k(t);let n=W.find(e=>e.id===t);n&&e(`/${n.slug}`)},bookmarkedSessionIds:rt,onToggleBookmark:e=>Xe(e,Da(e))})]})]})}),(0,P.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,P.jsx)(`section`,{className:`shrink-0 border-b border-[var(--console-border)] bg-white/70 px-4 py-4 backdrop-blur-sm md:px-8`,children:(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`nav`,{"aria-label":`Breadcrumb`,className:`console-mono mb-2 flex flex-wrap items-center gap-1 text-[11px] text-[var(--console-muted)]`,children:gt.map((e,t)=>(0,P.jsxs)(`span`,{className:`flex items-center gap-1`,children:[e.to?(0,P.jsx)(d,{to:e.to,className:`transition-colors hover:text-[var(--console-text)]`,children:e.label}):(0,P.jsx)(`span`,{className:`text-[var(--console-text)]`,children:e.label}),t<gt.length-1?(0,P.jsx)(`span`,{children:`/`}):null]},`${e.label}-${t}`))}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-1.5 py-0.5 text-[10px] font-bold uppercase text-[var(--console-muted)]`,children:I.mode===`session`?`Session`:I.mode===`root`?`Dashboard`:I.mode===`projects`?`Projects`:I.mode===`project`?`Project`:`Landing`}),(0,P.jsx)(`h1`,{className:`console-mono text-xl font-semibold tracking-tight text-[var(--console-text)]`,children:K})]}),(0,P.jsx)(`div`,{className:`console-mono mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-[var(--console-muted)]`,children:q}),(0,P.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[Oe?null:(0,P.jsxs)(`div`,{className:`console-mono inline-flex items-center gap-2 rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-text)]`,children:[(0,P.jsx)(`span`,{children:`Keyboard navigation available`}),(0,P.jsx)(`span`,{className:`rounded-sm border border-[var(--console-border)] bg-white px-1`,children:`?`}),(0,P.jsx)(`button`,{type:`button`,onClick:J,className:`text-[var(--console-muted)] transition-colors hover:text-[var(--console-text)]`,"aria-label":`Dismiss keyboard shortcuts hint`,children:`×`})]}),!F&&I.mode===`session`?(0,P.jsx)(`span`,{className:`console-mono inline-flex rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-muted)]`,children:`Esc back`}):null,!F&&I.mode===`session`&&p&&z===`claudecode`?(0,P.jsx)(ma,{sessionId:p.id,directory:p.directory}):null]}),te?(0,P.jsx)(`p`,{className:`console-mono mt-2 inline-flex rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-text)]`,children:te}):null]})}),(0,P.jsx)(`section`,{className:`console-scrollbar bg-grid min-h-0 flex-1 overflow-y-auto px-4 py-6 md:px-8`,children:(0,P.jsx)(ua,{children:_t})})]})]}),Ee?(0,P.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/35 px-4`,onClick:()=>De(!1),children:(0,P.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Keyboard shortcuts`,className:`w-full max-w-2xl rounded-sm border border-[var(--console-border-strong)] bg-white p-5 shadow-2xl`,onClick:e=>e.stopPropagation(),children:[(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`p`,{className:`console-mono text-[11px] uppercase tracking-[0.16em] text-[var(--console-muted)]`,children:`Keyboard Shortcuts`}),(0,P.jsx)(`h2`,{className:`console-mono mt-2 text-xl font-semibold text-[var(--console-text)]`,children:`Navigate without leaving the keyboard`})]}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>De(!1),className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-xs text-[var(--console-text)] transition-colors hover:bg-white`,children:`Esc`})]}),(0,P.jsx)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:Ra.map(e=>(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] p-4`,children:[(0,P.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:e.title}),(0,P.jsx)(`div`,{className:`mt-3 space-y-3`,children:e.items.map(e=>(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`p`,{className:`console-mono text-xs text-[var(--console-text)]`,children:e.keys}),(0,P.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-[var(--console-muted)]`,children:e.description})]},e.keys))})]},e.title))})]})}):null]})}function Ua({query:e,loading:t,results:n,agentNameMap:r,agents:i,projects:a,filters:o,onChangeFilters:s,onOpenResult:c,selectedIndex:l,registerResultRef:u}){let f=(0,P.jsx)(Wa,{agents:i,projects:a,filters:o,onChangeFilters:s});return t?(0,P.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[f,(0,P.jsx)(`div`,{className:`grid gap-3`,children:Array.from({length:4}).map((e,t)=>(0,P.jsxs)(`div`,{className:`animate-pulse rounded-sm border border-[var(--console-border)] bg-white/80 p-4`,children:[(0,P.jsx)(`div`,{className:`h-3 w-32 rounded bg-[var(--console-surface-muted)]`}),(0,P.jsx)(`div`,{className:`mt-3 h-4 w-2/3 rounded bg-[var(--console-surface-muted)]`}),(0,P.jsx)(`div`,{className:`mt-2 h-3 w-full rounded bg-[var(--console-surface-muted)]`}),(0,P.jsx)(`div`,{className:`mt-1 h-3 w-5/6 rounded bg-[var(--console-surface-muted)]`})]},t))})]}):n.length===0?(0,P.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[f,(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white/80 p-6`,children:[(0,P.jsx)(`h2`,{className:`console-mono text-sm font-semibold text-[var(--console-text)]`,children:e?`No matches`:`No recent sessions`}),e?(0,P.jsxs)(`p`,{className:`console-mono mt-2 text-xs text-[var(--console-muted)]`,children:[`Query: `,e]}):null]})]}):(0,P.jsxs)(`div`,{className:`grid gap-3`,children:[f,(0,P.jsx)(`div`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:`Navigate j k · Open Enter · Exit Esc`}),n.map((t,n)=>{let i=t.agentName.toLowerCase(),a=r.get(i)??t.agentName,o=`${t.agentName}/${t.session.id}`;return(0,P.jsxs)(d,{ref:e=>u(o,e),to:`/${i}/${t.session.id}`,state:{searchQuery:e},onClick:c,className:`rounded-sm border bg-white/85 p-4 transition-colors hover:border-[var(--console-border-strong)] hover:bg-white ${n===l?`border-[var(--console-border-strong)]`:`border-[var(--console-border)]`}`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-1.5 py-0.5 text-[10px] uppercase text-[var(--console-muted)]`,children:a}),(0,P.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-white px-1.5 py-0.5 text-[10px] uppercase text-[var(--console-muted)]`,children:La[t.matchType]}),(0,P.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:t.session.directory})]}),(0,P.jsx)(`h2`,{className:`console-mono mt-3 text-sm font-semibold text-[var(--console-text)]`,children:t.session.title}),(0,P.jsx)(Je,{tags:t.session.smart_tags,className:`mt-2`}),(0,P.jsx)(`p`,{className:`console-mono mt-2 text-xs leading-6 text-[var(--console-muted)] [&_mark]:bg-[var(--console-accent)] [&_mark]:px-0.5 [&_mark]:text-white`,dangerouslySetInnerHTML:{__html:ja(t.snippet||t.session.title)}})]},o)})]})}function Wa({agents:e,projects:t,filters:n,onChangeFilters:r}){let i=Object.values(n).some(Boolean),a=(e,t)=>{r(n=>({...n,[e]:n[e]===t?void 0:t}))};return(0,P.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white/85 p-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`console-mono text-[10px] font-semibold uppercase text-[var(--console-muted)]`,children:`Scope`}),(0,P.jsx)(Ga,{active:!n.projectKey,label:`All`,onClick:()=>r(e=>({...e,projectKey:void 0}))}),t.map(e=>(0,P.jsx)(Ga,{active:n.projectKey===e.key,label:`${e.label} · ${e.count}`,onClick:()=>a(`projectKey`,e.key)},e.key))]}),(0,P.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`console-mono text-[10px] font-semibold uppercase text-[var(--console-muted)]`,children:`Agent`}),(0,P.jsx)(Ga,{active:!n.agent,label:`All Agents`,onClick:()=>r(e=>({...e,agent:void 0}))}),e.map(e=>(0,P.jsx)(Ga,{active:n.agent===e.name,label:e.displayName,onClick:()=>a(`agent`,e.name)},e.name))]}),(0,P.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`console-mono text-[10px] font-semibold uppercase text-[var(--console-muted)]`,children:`Tag`}),Na.map(e=>(0,P.jsx)(Ga,{active:n.tag===e,label:F[e],onClick:()=>a(`tag`,e)},e))]}),(0,P.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`console-mono text-[10px] font-semibold uppercase text-[var(--console-muted)]`,children:`Signal`}),Pa.map(e=>(0,P.jsx)(Ga,{active:n.tool===e,label:`tool:${e}`,onClick:()=>a(`tool`,e)},e))]}),(0,P.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`console-mono text-[10px] font-semibold uppercase text-[var(--console-muted)]`,children:`File Activity`}),Fa.map(e=>(0,P.jsx)(Ga,{active:n.fileKind===e.kind,label:e.label,onClick:()=>a(`fileKind`,e.kind)},e.kind))]}),(0,P.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`console-mono text-[10px] font-semibold uppercase text-[var(--console-muted)]`,children:`Cost Range`}),(0,P.jsx)(Ga,{active:!n.costRange,label:`Any Cost`,onClick:()=>r(e=>({...e,costRange:void 0}))}),Ia.map(e=>(0,P.jsx)(Ga,{active:n.costRange===e.id,label:e.label,onClick:()=>a(`costRange`,e.id)},e.id)),i?(0,P.jsx)(`button`,{type:`button`,onClick:()=>r({}),className:`console-mono ml-auto rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[10px] text-[var(--console-muted)] transition-colors hover:bg-white`,children:`Clear`}):null]})]})}function Ga({active:e,label:t,onClick:n}){return(0,P.jsx)(`button`,{type:`button`,onClick:n,className:`console-mono rounded-sm border px-2 py-1 text-[10px] transition-colors ${e?`border-[var(--console-border-strong)] bg-[var(--console-accent)] text-white`:`border-[var(--console-border)] bg-[var(--console-surface-muted)] text-[var(--console-muted)] hover:bg-white`}`,children:t})}Me.createRoot(document.getElementById(`root`)).render((0,P.jsx)(j.StrictMode,{children:(0,P.jsx)(re,{children:(0,P.jsx)(Ha,{})})}));
|