@inf-monkeys-tech/monkeys-design 2.0.178 → 2.0.179
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/dist/components/agent-workbench/index.js +1 -1
- package/dist/components/agent-workbench/index.js.map +1 -1
- package/dist/components/agent-workbench/index.mjs +1 -1
- package/dist/components/agent-workbench/index.mjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -53,7 +53,7 @@ var re__namespace = /*#__PURE__*/_interopNamespace(re);
|
|
|
53
53
|
var Me__namespace = /*#__PURE__*/_interopNamespace(Me);
|
|
54
54
|
var He__namespace = /*#__PURE__*/_interopNamespace(He);
|
|
55
55
|
|
|
56
|
-
var lr=Object.defineProperty;var a=(e,t)=>lr(e,"name",{value:t,configurable:true});var Qt={locale:"en-US",messages:{pagination:{navigation:"Pagination",first:"First",previous:"Previous",next:"Next",last:"Last",page:a(({page:e,pageCount:t})=>`Page ${e} of ${t}`,"page"),currentPage:a(({page:e,pageCount:t})=>`Page ${e} of ${t}, current page`,"currentPage"),emptyResults:"0 results",range:a(({start:e,end:t,total:n})=>`${e}-${t} of ${n}`,"range"),selected:a(({count:e})=>`${e} selected`,"selected"),pageSize:"Items per page",loadBatchSize:"Items per load",perLoad:"Items per load",jumpToPage:"Jump to page",pages:"pages",clickToJump:"Click to jump to a page"},dialog:{close:"Close dialog"},dropdownMenu:{actions:"Actions"},loading:{spinner:"Loading"},layout:{resizePanels:"Resize panels",expandPanel:"Expand",collapsePanel:"Collapse",movePanel:"Move",moveBefore:"Move earlier",moveAfter:"Move later"},steps:{label:"Progress",current:"Current",completed:"Completed",error:"Error",disabled:"Disabled"},numberInput:{increment:"Increase value",decrement:"Decrease value"},passwordInput:{showPassword:"Show password",hidePassword:"Hide password"},multiSelect:{placeholder:"Select options",empty:"No options",removeOption:a(({value:e})=>`Remove ${e}`,"removeOption")},table:{dragColumn:a(({columnId:e})=>`Drag column ${e}`,"dragColumn"),resizeColumn:a(({columnId:e})=>`Resize column ${e}`,"resizeColumn"),sortColumn:a(({columnId:e})=>e?`Sort column ${e}`:"Sort column","sortColumn"),loadingRow:"Loading table row"},toolbar:{theme:{label:"Appearance",toggle:"Toggle theme",auto:"Auto",light:"Light",dark:"Dark"},language:{label:"Language",switch:"Switch language"}},toast:{errorTitle:"Error",warningTitle:"Warning",defaultErrorDescription:"Something went wrong.",defaultWarningDescription:"Please check and try again."},dataExplorer:{viewTree:{actions:"More actions",expand:"Expand",collapse:"Collapse",loading:"Loading...",empty:"No views",error:"Unable to load views"}},workbench:{relationshipGraph:{zoomOut:"Zoom out",zoomIn:"Zoom in",zoomToFit:"Fit graph",minimap:"Graph overview"},collection:{label:"Collection",loading:"Loading items",empty:"No items",loadError:"Unable to load items",refreshError:"Unable to refresh items",retry:"Retry",loadingMore:"Loading more items",permission:"You do not have permission to view this content",offline:"You appear to be offline",requestAccess:"Request access"},interactiveTable:{columnActions:"Column actions",freezeColumn:"Freeze to left",freezeEndColumn:"Freeze to right",unfreezeColumn:"Unfreeze from left",unfreezeEndColumn:"Unfreeze from right",unfreezeAllColumns:"Unfreeze all columns",resetColumnWidth:"Reset column width",frozenColumnTitle:"Frozen column"}},agentWorkbench:{label:"Session activity",reasoning:"Reasoning",plan:"Plan",taskNoDetail:"No additional details",modes:{chat:"Chat",work:"Work"},composer:{send:"Send message",stop:"Stop generating",queue:"Queue message",attach:"Add photos or files",voice:"Start voice input",webSearch:"Web search",chatMode:"Chat mode",model:"Model",reasoning:"Reasoning effort",permissions:"Permissions",removeAttachment:"Remove attachment",editQueued:"Edit queued message",deleteQueued:"Delete queued message",moveUp:"Move message up",moveDown:"Move message down",queued:"Queued messages",uploading:"Uploading",uploadFailed:"Upload failed",retryAttachment:"Retry attachment upload",noModels:"No models available",message:"Message",attachmentOnly:"Attachment",reasoningOptions:{low:"Low",medium:"Medium",high:"High",xhigh:"Extra high"},permissionOptions:{"approval-required":"Approval required","auto-approve":"Auto approve","full-access":"Full access"}},quickStart:{label:"Quick start",back:"Back",addFile:"Add file"},tool:{input:"Input",output:"Output",status:{pending:"Pending",running:"Running",completed:"Completed",failed:"Error",denied:"Denied"}},approval:{approve:"Approve",reject:"Reject",approved:"Approved",rejected:"Rejected"},artifact:{pending:"Preparing",ready:"Ready",failed:"Failed",open:a(({name:e})=>`Open ${e}`,"open")},run:{stopping:"Stopping...",stoppedAfter:a(({duration:e})=>`You stopped after ${e}`,"stoppedAfter")},process:{running:"Working",queued:"Queued",waitingApproval:"Waiting for approval",failed:"Failed",stopped:"Stopped",processed:"Processed",processedFor:a(({duration:e})=>`Worked for ${e}`,"processedFor"),completedCount:a(({completed:e,total:t})=>`${e}/${t} completed`,"completedCount")},artifactWorkspace:{outputs:"Outputs",sources:"Sources",viewAll:"View all",toggleSummary:"Toggle files",tabs:"Open files",closeTab:a(({name:e})=>`Close ${e}`,"closeTab"),closeWorkspace:"Close workspace",download:a(({name:e})=>`Download ${e}`,"download"),openExternal:a(({name:e})=>`Open ${e} in a new window`,"openExternal"),loading:"Loading preview...",failed:"Preview unavailable",retry:"Try again"},usage:{label:"Context usage",context:a(({used:e,total:t})=>`${e} / ${t} tokens`,"context")},navigation:{search:"Search agents and sessions",searchSessions:"Search sessions",searchShortcut:"Focus search",clearSearch:"Clear search",tabsLabel:"Agent workbench navigation",agents:"Agents",sessions:"Sessions",newAgent:"New Agent",newSession:"New Session",capabilities:"Capabilities & Extensions",settings:"Agent Settings",allAgents:"All Agents",recentSessions:"Recent Sessions",chat:"Chat",work:"Work",chats:"Chats",builtIn:"Built-in",noDescription:"No description",loading:"Loading...",emptyAgents:"No agents yet",emptySessions:"No sessions yet",noResults:"No matching results",retry:"Retry",pin:"Pin",unpin:"Unpin",rename:"Rename",delete:"Delete",actions:"Actions",save:"Save",cancel:"Cancel",running:"Running",completed:"Completed",failed:"Failed",contextUsage:a(({percent:e})=>`${e}% context used`,"contextUsage")},details:{title:"Task details",description:"Summary and workspace activity",duration:"Duration",updated:"Updated",model:"Model",mode:"Mode",permissions:"Permissions",tokenUsage:"Token usage",summary:"Summary",summaryEmpty:"No summary is available yet.",summaryFailed:"The summary could not be generated.",highlights:"Highlights",pendingItems:"Pending items",tabs:{label:"Task detail views",summary:"Summary",workspace:"Workspace"},status:{queued:"Queued",running:"Running",waiting_approval:"Waiting for approval",stopping:"Stopping",stopped:"Stopped",completed:"Completed",failed:"Failed"},state:{loading:{title:"Loading task details",description:"Restoring the latest session activity."},empty:{title:"No task selected",description:"Select a task to inspect its details."},error:{title:"Unable to load task details",description:"Try again after the session is available."}},actions:{close:"Close task details",copySummary:"Copy summary",retry:"Retry",retrySummary:"Retry summary",resume:"Resume",continueInNewTask:"Continue in new task",editAndRerun:"Edit and rerun",export:"Export"},workspace:{diffs:"Code changes",files:"Files",terminals:"Terminals",tests:"Tests",artifacts:"Artifacts",exitCode:a(({code:e})=>`Exit code ${e}`,"exitCode"),diffStatus:{added:"Added",modified:"Modified",deleted:"Deleted",renamed:"Renamed"},fileOperation:{upsert:"Updated",delete:"Deleted"}}}}}};function eo(e,t){return t?{pagination:{...e.pagination,...t.pagination},dialog:{...e.dialog,...t.dialog},dropdownMenu:{...e.dropdownMenu,...t.dropdownMenu},loading:{...e.loading,...t.loading},layout:{...e.layout,...t.layout},steps:{...e.steps,...t.steps},numberInput:{...e.numberInput,...t.numberInput},passwordInput:{...e.passwordInput,...t.passwordInput},multiSelect:{...e.multiSelect,...t.multiSelect},table:{...e.table,...t.table},toolbar:{theme:{...e.toolbar.theme,...t.toolbar?.theme},language:{...e.toolbar.language,...t.toolbar?.language}},toast:{...e.toast,...t.toast},dataExplorer:{viewTree:{...e.dataExplorer.viewTree,...t.dataExplorer?.viewTree}},workbench:{relationshipGraph:{zoomOut:"Zoom out",zoomIn:"Zoom in",zoomToFit:"Fit graph",minimap:"Graph overview",...e.workbench.relationshipGraph,...t.workbench?.relationshipGraph},collection:{...e.workbench.collection,...t.workbench?.collection},interactiveTable:{...e.workbench.interactiveTable,...t.workbench?.interactiveTable}},agentWorkbench:{...e.agentWorkbench,...t.agentWorkbench,modes:{...e.agentWorkbench.modes,...t.agentWorkbench?.modes},composer:{...e.agentWorkbench.composer,...t.agentWorkbench?.composer},quickStart:{...e.agentWorkbench.quickStart,...t.agentWorkbench?.quickStart},tool:{...e.agentWorkbench.tool,...t.agentWorkbench?.tool,status:{...e.agentWorkbench.tool.status,...t.agentWorkbench?.tool?.status}},approval:{...e.agentWorkbench.approval,...t.agentWorkbench?.approval},artifact:{...e.agentWorkbench.artifact,...t.agentWorkbench?.artifact},run:{...e.agentWorkbench.run,...t.agentWorkbench?.run},process:{...e.agentWorkbench.process,...t.agentWorkbench?.process},artifactWorkspace:{...e.agentWorkbench.artifactWorkspace,...t.agentWorkbench?.artifactWorkspace},usage:{...e.agentWorkbench.usage,...t.agentWorkbench?.usage},navigation:{...e.agentWorkbench.navigation,...t.agentWorkbench?.navigation},details:{...e.agentWorkbench.details,...t.agentWorkbench?.details,tabs:{...e.agentWorkbench.details.tabs,...t.agentWorkbench?.details?.tabs},status:{...e.agentWorkbench.details.status,...t.agentWorkbench?.details?.status},state:{loading:{...e.agentWorkbench.details.state.loading,...t.agentWorkbench?.details?.state?.loading},empty:{...e.agentWorkbench.details.state.empty,...t.agentWorkbench?.details?.state?.empty},error:{...e.agentWorkbench.details.state.error,...t.agentWorkbench?.details?.state?.error}},actions:{...e.agentWorkbench.details.actions,...t.agentWorkbench?.details?.actions},workspace:{...e.agentWorkbench.details.workspace,...t.agentWorkbench?.details?.workspace,diffStatus:{...e.agentWorkbench.details.workspace.diffStatus,...t.agentWorkbench?.details?.workspace?.diffStatus},fileOperation:{...e.agentWorkbench.details.workspace.fileOperation,...t.agentWorkbench?.details?.workspace?.fileOperation}}}}}:e}a(eo,"mergeMonkeysLocaleMessages");var it={locale:Qt.locale,messages:eo(Qt.messages)};var cr=Object.freeze({}),pr=Object.freeze({}),to=Symbol.for("@inf-monkeys-tech/monkeys-design/provider-context@1");function ur(){return Object.freeze({locale:ne.createContext({...it,provided:false}),theme:ne.createContext({provided:false}),direction:ne.createContext({provided:false}),environment:ne.createContext({provided:false,environment:cr,portal:pr})})}a(ur,"createMonkeysProviderContexts");function mr(){let e=globalThis,t=e[to];if(t)return t;let n=ur();return Object.defineProperty(e,to,{value:n,enumerable:false,configurable:false,writable:false}),n}a(mr,"getMonkeysProviderContexts");var Wt=mr(),Yt=Wt.locale,gr=Wt.theme,fr=Wt.direction;Wt.environment;function dt(){try{return ne.useContext(Yt)??{...it,provided:!1}}catch{return {...it,provided:false}}}a(dt,"useMonkeysLocale");function L(){return ne.useContext(Yt).messages}a(L,"useMonkeysLocaleMessages");function Ae(){let e=ne.useContext(Yt),t=ne.useContext(gr),n=ne.useContext(fr),o=e.provided||t.provided||n.provided;return ne.useMemo(()=>o?{dir:n.direction,"data-monkeys-direction":n.direction,"data-monkeys-locale":e.locale,"data-monkeys-theme":t.themeId,"data-monkeys-theme-mode":t.resolvedTheme?.colorMode}:{},[n.direction,e.locale,o,t.resolvedTheme?.colorMode,t.themeId])}a(Ae,"useMonkeysComponentAttributes");function R(...e){return tailwindMerge.twMerge(e.filter(Boolean).join(" "))}a(R,"cn");var no=Symbol.for("@inf-monkeys-tech/monkeys-design/bento-depth@1"),oo=globalThis,ro=oo[no]??(oo[no]=ne.createContext(0));function Xt(){return ne.useContext(ro)}a(Xt,"useBentoDepth");function yr({children:e,depth:t}){return jsxRuntime.jsx(ro.Provider,{value:t,children:e})}a(yr,"BentoDepthProvider");function ao({children:e}){return jsxRuntime.jsx(yr,{depth:0,children:e})}a(ao,"BentoScope");var xr={menu:"monkeys-overlay-surface--menu bg-menu-surface text-popover-foreground",dialog:"monkeys-overlay-surface--dialog bg-dialog-surface text-foreground"};function Ye(e,t={}){return ["monkeys-overlay-surface",xr[e],t.rounded===false?void 0:"monkeys-overlay-surface--rounded"].filter(Boolean).join(" ")}a(Ye,"getOverlaySurfaceClassName");function d(...e){return e.filter(Boolean).join(" ")}a(d,"cn");var Nr={variant:"default",density:"default"},Jt=ne.createContext(Nr);function Zt(e,t={}){return {variant:t.variant??e.variant,density:t.density??(t.variant==="trend"?"compact":e.density)}}a(Zt,"resolveAgentWorkbenchAppearance");function fe(e={}){return Zt(ne.useContext(Jt),e)}a(fe,"useAgentWorkbenchAppearance");function Sr({children:e,variant:t,density:n}){let o=ne.useContext(Jt),r=ne.useMemo(()=>Zt(o,{variant:t,density:n}),[n,o,t]);return jsxRuntime.jsx(Jt.Provider,{value:r,children:e})}a(Sr,"AgentWorkbenchAppearanceProvider");var Cr={page:"bg-background text-foreground",panel:"bg-card text-card-foreground",elevated:"border border-border bg-popover text-popover-foreground shadow-sm",subtle:"bg-muted/40 text-foreground",overlay:"border border-border bg-popover text-popover-foreground shadow-lg"},Rr=ne.forwardRef(a(function({level:t="panel",variant:n,density:o,className:r,children:i,...l},u){let g=fe({variant:n,density:o});return jsxRuntime.jsx("div",{...l,ref:u,"data-agent-workbench-surface":t,"data-agent-workbench-variant":g.variant,"data-agent-workbench-density":g.density,className:d(Cr[t],r),children:i})},"AgentWorkbenchSurface"));var Wr=a(({textAreaRef:e,triggerAutoSize:t,maxHeight:n=Number.MAX_SAFE_INTEGER,minHeight:o=0})=>{let[r,i]=ne__namespace.useState(true);ne__namespace.useEffect(()=>{if(e){r&&(e.style.minHeight=`${o+2}px`,n>o&&(e.style.maxHeight=`${n}px`),i(false)),e.style.height=`${o+2}px`;let u=e.scrollHeight;u>n?e.style.height=`${n}px`:e.style.height=`${u+2}px`;}},[e,t]);},"useAutosizeTextArea"),en=ne__namespace.forwardRef(({maxHeight:e=Number.MAX_SAFE_INTEGER,minHeight:t=52,className:n,onChange:o,value:r,onKeyDown:i,onSubmit:l,onCompositionStart:u,onCompositionEnd:g,...p},c)=>{let v=ne__namespace.useRef(null),[x,k]=ne__namespace.useState(""),[m,A]=ne__namespace.useState(false),[P,E]=ne__namespace.useState("");Wr({textAreaRef:v.current,triggerAutoSize:x,maxHeight:e,minHeight:t}),ne.useImperativeHandle(c,()=>({textArea:v.current,focus:a(()=>v.current?.focus(),"focus"),maxHeight:e,minHeight:t})),ne__namespace.useEffect(()=>{k(r);},[p?.defaultValue,r]);let b=ne__namespace.useCallback(s=>{if(s.key==="ArrowUp"&&x.length<=0&&!(s.metaKey||s.altKey||s.ctrlKey)){s.preventDefault();return}l&&s.key==="Enter"&&s.keyCode!==229&&!s.nativeEvent.isComposing&&!m&&!s.altKey&&!s.ctrlKey&&!s.shiftKey&&!s.metaKey&&(s.preventDefault(),l(s)),i?.(s);},[m,i,l,x.length]);return jsxRuntime.jsx("textarea",{...p,onKeyDown:b,value:typeof r<"u"?m?P:r??"":void 0,ref:v,className:R("flex w-full resize-y rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),onCompositionStart:s=>{A(true),E(s.currentTarget.value),u?.(s);},onCompositionEnd:s=>{A(false);let y=s.currentTarget.value;E(y),k(y),o?.(s),g?.(s);},onChange:s=>{if(s.nativeEvent.isComposing){E(s.target.value),k(s.target.value);return}k(s.target.value),o?.(s);}})});en.displayName="AutosizeTextarea";var Dr=ne__namespace.forwardRef(({className:e,style:t,...n},o)=>jsxRuntime.jsx(We__namespace.Item,{ref:o,className:R("border-b",e),style:{borderColor:"var(--monkeys-component-accordion-item-border-color, hsl(var(--border)))",...t},...n}));Dr.displayName="AccordionItem";var zr=ne__namespace.forwardRef(({className:e,children:t,...n},o)=>jsxRuntime.jsx(We__namespace.Header,{className:"flex",children:jsxRuntime.jsxs(We__namespace.Trigger,{ref:o,className:R("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,jsxRuntime.jsx(lucideReact.ChevronDown,{"aria-hidden":"true",className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));zr.displayName="AccordionTrigger";var Or=ne__namespace.forwardRef(({className:e,children:t,...n},o)=>jsxRuntime.jsx(We__namespace.Content,{ref:o,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:jsxRuntime.jsx("div",{className:R("pb-4 pt-0",e),children:t})}));Or.displayName="AccordionContent";var Br=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Mt__namespace.Root,{ref:n,className:R("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:jsxRuntime.jsx(Mt__namespace.Indicator,{className:"flex items-center justify-center text-current",children:jsxRuntime.jsx(lucideReact.Check,{"aria-hidden":"true",className:"h-4 w-4"})})}));Br.displayName="Checkbox";var Hr=classVarianceAuthority.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_[data-slot=icon]]:text-[inherit] [&_[data-slot=icon]_*]:!text-[inherit] [&_[data-slot=icon]_svg]:!stroke-current [&_[data-slot=icon]_svg_*]:!stroke-current [&_[data-slot=end-icon]]:text-[inherit] [&_[data-slot=end-icon]_*]:!text-[inherit] [&_[data-slot=end-icon]_svg]:!stroke-current [&_[data-slot=end-icon]_svg_*]:!stroke-current [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-control-surface shadow-sm ring-offset-control-surface hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-sm px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),W=ne__namespace.forwardRef(({className:e,variant:t,size:n,asChild:o=false,...r},i)=>jsxRuntime.jsx(o?reactSlot.Slot:"button",{ref:i,className:Hr({variant:t,size:n,className:e}),...r}));W.displayName="Button";var _r=ne__namespace.forwardRef(({className:e,children:t,viewportClassName:n,viewportRef:o,onViewportScroll:r,scrollbar:i=true,scrollbarOrientation:l="vertical",scrollBarDisabled:u=false,type:g,...p},c)=>{let v=Xt();return jsxRuntime.jsxs(Ne__namespace.Root,{ref:c,type:g??(v>0?"auto":void 0),className:R("group relative overflow-hidden",u&&"no-scrollbar",e),...p,children:[jsxRuntime.jsx(Ne__namespace.Viewport,{ref:o,onScroll:r,className:R("h-full w-full rounded-[inherit]",n),children:t}),i?jsxRuntime.jsx(co,{orientation:l,className:R(u&&"size-0 p-0")}):null,jsxRuntime.jsx(Ne__namespace.Corner,{})]})});_r.displayName="ScrollArea";var co=ne__namespace.forwardRef(({className:e,orientation:t="vertical",...n},o)=>jsxRuntime.jsx(Ne__namespace.ScrollAreaScrollbar,{ref:o,"data-monkeys-scrollbar":"",orientation:t,className:R("flex touch-none select-none opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 data-[state=visible]:opacity-100",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-px",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-px",e),...n,children:jsxRuntime.jsx(Ne__namespace.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));co.displayName="ScrollBar";var tn=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Pt__namespace.Root,{ref:n,className:R("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,children:jsxRuntime.jsx(Pt__namespace.Thumb,{className:"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"})}));tn.displayName="Switch";var Se=ne__namespace.forwardRef(({variant:e="default",...t},n)=>jsxRuntime.jsx(De__namespace.Root,{ref:n,"data-variant":e,...t}));Se.displayName="Tabs";var Ce=ne__namespace.forwardRef(({className:e,gap:t,style:n,...o},r)=>jsxRuntime.jsx(De__namespace.List,{ref:r,className:R("inline-flex h-10 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),style:{gap:t,...n},...o}));Ce.displayName="TabsList";var ye=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(De__namespace.Trigger,{ref:n,className:R("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));ye.displayName="TabsTrigger";var be=ne__namespace.forwardRef(({className:e,...t},n)=>{let o=Xt();return jsxRuntime.jsx(De__namespace.Content,{ref:n,className:R("mt-2 ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",o>0&&"gap-[var(--monkeys-bento-gap)]",e),...t})});be.displayName="TabsContent";var Vr=ne__namespace.forwardRef(({className:e,sideOffset:t=4,...n},o)=>{let r=Ae();return jsxRuntime.jsx(Ue__namespace.Portal,{children:jsxRuntime.jsx(Ue__namespace.Content,{...r,...n,ref:o,sideOffset:t,"data-monkeys-component":"tooltip","data-slot":"content","data-surface":"menu",className:R("z-50 overflow-hidden border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",Ye("menu"),e)})})});Vr.displayName="TooltipContent";var qe=ne__namespace.forwardRef(({className:e,appearance:t="standard",type:n,...o},r)=>jsxRuntime.jsx("input",{ref:r,type:n,className:R("flex w-full border border-input bg-control-surface px-3 text-foreground ring-offset-control-surface transition-[border-color,background-color,color,box-shadow] file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t==="compact"?"h-9 rounded-md py-1 text-sm shadow-sm":"h-10 rounded-md py-2 text-sm shadow-sm",t==="shadow"&&"rounded-lg shadow-sm shadow-black/[0.02] dark:border-white/10 dark:bg-white/[0.04] dark:shadow-none",e),...o}));qe.displayName="Input";var on=ne__namespace.forwardRef(({className:e,appearance:t="standard",...n},o)=>jsxRuntime.jsx("textarea",{ref:o,className:R("flex w-full border border-input bg-control-surface px-3 py-2 text-foreground ring-offset-control-surface placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t==="compact"?"min-h-[60px] rounded-md text-sm shadow-sm":"min-h-[80px] rounded-md text-sm",t==="shadow"&&"rounded-lg shadow-sm shadow-black/[0.02] dark:border-white/10 dark:bg-white/[0.04] dark:shadow-none",e),...n}));on.displayName="Textarea";function go({className:e,...t}){return jsxRuntime.jsx("div",{"data-slot":"input-group",role:"group",className:R("group/input-group shadow-xs relative flex w-full items-center rounded-md border border-input outline-hidden transition-[color,box-shadow] dark:bg-input/30","h-9 has-[>textarea]:h-auto","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col","has-[[data-slot=input-group-control]:focus-visible]:ring-1 has-[[data-slot=input-group-control]:focus-visible]:ring-ring","has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e),...t})}a(go,"InputGroup");var Ur=classVarianceAuthority.cva("text-muted-foreground flex h-auto cursor-text select-none items-center justify-center gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.4rem] has-[>kbd]:mr-[-0.35rem]","block-start":"[.border-b]:pb-3 order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5","block-end":"[.border-t]:pt-3 order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function It({className:e,align:t="inline-start",...n}){return jsxRuntime.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:R(Ur({align:t}),e),onClick:o=>{o.target.closest("button")||o.currentTarget.parentElement?.querySelector("input")?.focus();},...n})}a(It,"InputGroupAddon");var qr=classVarianceAuthority.cva("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",sm:"h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function fo({className:e,type:t="button",variant:n="ghost",size:o="xs",...r}){return jsxRuntime.jsx(W,{type:t,"data-size":o,variant:n,className:R(qr({size:o}),e),...r})}a(fo,"InputGroupButton");var an=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(qe,{ref:n,"data-slot":"input-group-control",className:R("flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 dark:bg-transparent",e),...t}));an.displayName="InputGroupInput";var Fr=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(on,{ref:n,"data-slot":"input-group-control",className:R("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 dark:bg-transparent",e),...t}));Fr.displayName="InputGroupTextarea";var pt="relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",sn=`z-50 min-w-[8rem] overflow-hidden border p-1 ${Ye("menu")} data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,ln=H__namespace.Root,dn=H__namespace.Trigger;var Kr=ne__namespace.forwardRef(({className:e,inset:t,children:n,...o},r)=>jsxRuntime.jsxs(H__namespace.SubTrigger,{ref:r,className:R(pt,"data-[state=open]:bg-accent",t&&"pl-8",e),...o,children:[n,jsxRuntime.jsx(lucideReact.ChevronRight,{"aria-hidden":"true",className:"ml-auto"})]}));Kr.displayName="DropdownMenuSubTrigger";var Qr=ne__namespace.forwardRef(({className:e,...t},n)=>{let o=Ae();return jsxRuntime.jsx(H__namespace.SubContent,{...o,...t,ref:n,"data-monkeys-component":"dropdown-menu","data-slot":"content","data-surface":"menu",className:R(sn,e)})});Qr.displayName="DropdownMenuSubContent";var Et=ne__namespace.forwardRef(({className:e,sideOffset:t=4,...n},o)=>{let r=Ae();return jsxRuntime.jsx(H__namespace.Portal,{children:jsxRuntime.jsx(H__namespace.Content,{...r,...n,ref:o,sideOffset:t,"data-monkeys-component":"dropdown-menu","data-slot":"content","data-surface":"menu",className:R(sn,e)})})});Et.displayName="DropdownMenuContent";var ut=ne__namespace.forwardRef(({className:e,inset:t,...n},o)=>jsxRuntime.jsx(H__namespace.Item,{ref:o,className:R(pt,t&&"pl-8",e),...n}));ut.displayName="DropdownMenuItem";var Yr=ne__namespace.forwardRef(({className:e,children:t,checked:n,...o},r)=>jsxRuntime.jsxs(H__namespace.CheckboxItem,{ref:r,className:R(pt,"pl-8",e),checked:n,...o,children:[jsxRuntime.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(H__namespace.ItemIndicator,{children:jsxRuntime.jsx(lucideReact.Check,{"aria-hidden":"true",className:"h-4 w-4"})})}),t]}));Yr.displayName="DropdownMenuCheckboxItem";var Xr=ne__namespace.forwardRef(({className:e,children:t,...n},o)=>jsxRuntime.jsxs(H__namespace.RadioItem,{ref:o,className:R(pt,"pl-8",e),...n,children:[jsxRuntime.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(H__namespace.ItemIndicator,{children:jsxRuntime.jsx(lucideReact.Circle,{"aria-hidden":"true",className:"h-2 w-2 fill-current"})})}),t]}));Xr.displayName="DropdownMenuRadioItem";var Jr=ne__namespace.forwardRef(({className:e,inset:t,...n},o)=>jsxRuntime.jsx(H__namespace.Label,{ref:o,className:R("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Jr.displayName="DropdownMenuLabel";var Zr=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(H__namespace.Separator,{ref:n,className:R("-mx-1 my-1 h-px bg-muted",e),...t}));Zr.displayName="DropdownMenuSeparator";var ea=a(({className:e,...t})=>jsxRuntime.jsx("span",{className:R("ml-auto text-xs tracking-widest opacity-60",e),...t}),"DropdownMenuShortcut");ea.displayName="DropdownMenuShortcut";var vo=B__namespace.Root;var yo=B__namespace.Value,cn=ne__namespace.forwardRef(({className:e,children:t,iconClassName:n,size:o="default",...r},i)=>jsxRuntime.jsxs(B__namespace.Trigger,{ref:i,className:R("flex h-10 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-control-surface px-3 py-2 text-left text-sm text-foreground shadow-sm ring-offset-control-surface data-[placeholder]:text-muted-foreground focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 [&>span]:min-w-0 [&>span]:flex-1 [&>span]:text-left",o==="sm"&&"h-8 px-2 py-1 text-xs",e),...r,children:[t,jsxRuntime.jsx(B__namespace.Icon,{asChild:true,children:jsxRuntime.jsx(lucideReact.ChevronDown,{"aria-hidden":"true",className:R("h-4 w-4 opacity-50",n)})})]}));cn.displayName="SelectTrigger";var xo=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(B__namespace.ScrollUpButton,{ref:n,className:R("flex cursor-default items-center justify-center py-1",e),...t,children:jsxRuntime.jsx(lucideReact.ChevronUp,{"aria-hidden":"true",className:"h-4 w-4"})}));xo.displayName="SelectScrollUpButton";var ko=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(B__namespace.ScrollDownButton,{ref:n,className:R("flex cursor-default items-center justify-center py-1",e),...t,children:jsxRuntime.jsx(lucideReact.ChevronDown,{"aria-hidden":"true",className:"h-4 w-4"})}));ko.displayName="SelectScrollDownButton";var pn=ne__namespace.forwardRef(({className:e,children:t,position:n="popper",viewportClassName:o,disableTriggerViewportSizing:r=false,...i},l)=>{let u=Ae();return jsxRuntime.jsx(B__namespace.Portal,{children:jsxRuntime.jsxs(B__namespace.Content,{...u,...i,ref:l,position:n,"data-monkeys-component":"select","data-slot":"content","data-surface":"menu",className:R(sn,"relative max-h-[var(--radix-select-content-available-height)] overflow-y-auto overflow-x-hidden",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),children:[jsxRuntime.jsx(xo,{}),jsxRuntime.jsx(B__namespace.Viewport,{className:R("p-1",n==="popper"&&"w-full min-w-[var(--radix-select-trigger-width)]",n==="popper"&&!r&&"h-[var(--radix-select-trigger-height)]",o),children:t}),jsxRuntime.jsx(ko,{})]})})});pn.displayName="SelectContent";var ta=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(B__namespace.Label,{ref:n,className:R("px-2 py-1.5 text-sm font-semibold",e),...t}));ta.displayName="SelectLabel";var un=ne__namespace.forwardRef(({className:e,children:t,indicatorClassName:n,itemText:o,hideIndicator:r=false,...i},l)=>jsxRuntime.jsxs(B__namespace.Item,{ref:l,className:R(pt,"w-full",r?"px-2":"pl-8 pr-2",e),...i,children:[r?null:jsxRuntime.jsx("span",{className:R("absolute left-2 flex h-3.5 w-3.5 items-center justify-center",n),children:jsxRuntime.jsx(B__namespace.ItemIndicator,{children:jsxRuntime.jsx(lucideReact.Check,{"aria-hidden":"true",className:"h-4 w-4"})})}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(B__namespace.ItemText,{asChild:true,children:jsxRuntime.jsx("span",{className:"sr-only",children:o})}),t]}):jsxRuntime.jsx(B__namespace.ItemText,{children:t})]}));un.displayName="SelectItem";var na=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(B__namespace.Separator,{ref:n,className:R("-mx-1 my-1 h-px bg-muted",e),...t}));na.displayName="SelectSeparator";var gn=re__namespace.Root;var ra=re__namespace.Portal,wo=ne__namespace.forwardRef(({className:e,...t},n)=>{let o=Ae();return jsxRuntime.jsx(re__namespace.Overlay,{...o,...t,ref:n,"data-monkeys-component":"sheet","data-slot":"overlay","data-monkeys-overlay":true,className:R("theme-overlay-backdrop fixed inset-0 z-50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e)})});wo.displayName="SheetOverlay";var aa={top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm"},Lt=ne__namespace.forwardRef(({side:e="right",className:t,children:n,...o},r)=>{let i=Ae();return jsxRuntime.jsxs(ra,{children:[jsxRuntime.jsx(wo,{}),jsxRuntime.jsxs(re__namespace.Content,{...i,...o,ref:r,"data-monkeys-component":"sheet","data-slot":"content","data-surface":"dialog","data-monkeys-dialog-content":true,className:R("fixed z-50 gap-4 p-6 transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",Ye("dialog",{rounded:false}),aa[e],t),children:[jsxRuntime.jsxs(re__namespace.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-dialog-surface transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[jsxRuntime.jsx("svg",{"aria-hidden":"true",className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6 6 18M6 6l12 12"})}),jsxRuntime.jsx("span",{className:"sr-only",children:"Close"})]}),jsxRuntime.jsx(ao,{children:n})]})]})});Lt.displayName="SheetContent";var Dt=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(re__namespace.Title,{ref:n,className:R("text-lg font-semibold text-foreground",e),...t}));Dt.displayName="SheetTitle";var sa=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(re__namespace.Description,{ref:n,className:R("text-sm text-muted-foreground",e),...t}));sa.displayName="SheetDescription";function hn({value:e,label:t,placeholder:n,options:o,className:r,onValueChange:i}){let l=o.find(u=>u.value===e);return jsxRuntime.jsxs(vo,{value:e||void 0,disabled:o.length===0,onValueChange:i,children:[jsxRuntime.jsx(cn,{size:"sm","aria-label":t,className:d("shrink bg-background font-medium",r),children:jsxRuntime.jsx(yo,{placeholder:n,children:l?.label})}),jsxRuntime.jsx(pn,{disableTriggerViewportSizing:true,children:o.map(u=>jsxRuntime.jsx(un,{value:u.value,disabled:u.disabled,children:u.label},u.value))})]})}a(hn,"ComposerSelect");var wa={contract:"AgentWorkbenchComposerViewModel",value:"",status:"idle",mode:"chat",attachments:[],queuedDrafts:[],inputActions:[],model:{options:[]},webSearchEnabled:false,capabilities:{attachments:false,voiceInput:false,webSearch:false,modelSelection:false,reasoning:false,permissions:false,queue:false,stop:false}};function zt(e){return `${e.mode}:${e.id}`}a(zt,"modelOptionValue");function Aa({viewModel:e=wa,disabled:t=false,modeSelectionEnabled:n=false,modeFilteringEnabled:o=false,variant:r,density:i,className:l,classNames:u,onIntent:g}){let p=ne.useRef({disabled:t,emitIntent:g});p.current={disabled:t,emitIntent:g};let c=a(f=>{p.current.disabled||p.current.emitIntent?.(f);},"onIntent"),v=fe({variant:r,density:i}),x=v.density==="compact",k=d(x?"size-7":"size-8","shrink-0 p-0 text-muted-foreground"),m=L().agentWorkbench,A=ne.useRef(null),P=ne.useRef(null),[E,b]=ne.useState(),[s,y]=ne.useState(""),[C,F]=ne.useState(false),Q=n?900:704,K=e.status==="loading"||e.status==="streaming"||e.status==="stopping",le=e.status==="stopping",J=e.attachments.some(f=>f.status==="uploading"),ge=!t&&!le&&!J&&(e.value.trim().length>0||e.attachments.some(f=>f.status==="ready")),ke=!K||ge,M=n||o,w=ne.useMemo(()=>M?e.model.options.filter(f=>f.mode===e.mode):e.model.options,[M,e.mode,e.model.options]),Z=ne.useMemo(()=>{let f=w.find(z=>z.id===e.model.selectedId&&z.mode===e.mode);return f?zt(f):w[0]?zt(w[0]):""},[e.mode,e.model.selectedId,w]),_=e.inputActions||[],Ve=e.selectedInputActionId;ne.useEffect(()=>{let f=P.current;if(!f)return;let z=a(()=>F(f.getBoundingClientRect().width<=Q),"updateLayout");if(z(),window.addEventListener("resize",z),typeof ResizeObserver>"u"){let Ge=window.setInterval(z,250);return ()=>{window.clearInterval(Ge),window.removeEventListener("resize",z);}}let X=new ResizeObserver(z);return X.observe(f),()=>{X.disconnect(),window.removeEventListener("resize",z);}},[Q]);let rt=a(()=>{ge&&c?.({type:"submit"});},"submit");return jsxRuntime.jsx("fieldset",{disabled:t,className:"min-w-0 border-0 p-0",children:jsxRuntime.jsxs("form",{"data-agent-workbench-variant":v.variant,"data-agent-workbench-density":v.density,"data-agent-workbench-status":e.status,className:d("agent-workbench-composer flex min-w-0 w-full flex-col",x?"gap-1.5":"gap-2",l,u?.root),"aria-label":m.composer.message,onSubmit:f=>{f.preventDefault(),rt();},children:[e.capabilities.queue&&e.queuedDrafts.length>0?jsxRuntime.jsx("section",{"aria-label":m.composer.queued,className:d("min-w-0 max-w-full rounded-md border border-border bg-muted/40 p-2",u?.queue),children:jsxRuntime.jsx("ol",{className:"space-y-1.5",children:e.queuedDrafts.map((f,z)=>jsxRuntime.jsxs("li",{className:"flex min-h-9 min-w-0 max-w-full items-center gap-2 overflow-hidden rounded-md bg-background px-2 py-1.5 text-sm",children:[jsxRuntime.jsx("span",{className:"w-5 shrink-0 text-center text-xs text-muted-foreground",children:z+1}),E===f.id?jsxRuntime.jsx(qe,{autoFocus:true,value:s,"aria-label":m.composer.editQueued,appearance:"compact",className:"h-8 min-w-0 flex-1 px-2 py-1",onChange:X=>y(X.target.value),onBlur:()=>{s.trim()&&c?.({type:"edit-queued-draft",draftId:f.id,text:s}),b(void 0);},onKeyDown:X=>{X.key==="Escape"&&b(void 0),X.key==="Enter"&&s.trim()&&(X.preventDefault(),c?.({type:"edit-queued-draft",draftId:f.id,text:s}),b(void 0));}}):jsxRuntime.jsx("span",{className:"min-w-0 flex-1 truncate",children:f.text||m.composer.attachmentOnly}),jsxRuntime.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:k,"aria-label":m.composer.moveUp,disabled:z===0,onClick:()=>c?.({type:"move-queued-draft",draftId:f.id,direction:"up"}),children:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"size-3.5"})}),jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:k,"aria-label":m.composer.moveDown,disabled:z===e.queuedDrafts.length-1,onClick:()=>c?.({type:"move-queued-draft",draftId:f.id,direction:"down"}),children:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"size-3.5"})}),jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:k,"aria-label":m.composer.editQueued,onClick:()=>{b(f.id),y(f.text);},children:jsxRuntime.jsx(lucideReact.Pencil,{className:"size-3.5"})}),jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:d(k,"text-destructive-text hover:text-destructive-text"),"aria-label":m.composer.deleteQueued,onClick:()=>c?.({type:"delete-queued-draft",draftId:f.id}),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"size-3.5"})})]})]},f.id))})}):null,jsxRuntime.jsxs("div",{ref:P,"data-agent-workbench-surface":"elevated",className:d("agent-workbench-composer__surface min-w-0 max-w-full rounded-[var(--radius)] border border-input bg-popover text-popover-foreground shadow-sm transition-[border-color,box-shadow] focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/30",x?"p-2.5":"p-3"),children:[e.attachments.length>0?jsxRuntime.jsx("div",{"data-agent-workbench-composer-attachments":true,className:d("mb-2 flex max-w-full gap-2 overflow-x-auto overscroll-x-contain pb-1",u?.attachments),children:e.attachments.map(f=>{let z=f.status==="error",X=f.status==="uploading";return jsxRuntime.jsxs("div",{role:z?"alert":void 0,className:d("flex h-14 min-w-48 max-w-64 shrink-0 items-center gap-2 rounded-md border bg-muted/45 p-1.5",z?"border-destructive/50 bg-destructive/5":"border-border"),children:[jsxRuntime.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center overflow-hidden rounded bg-muted",children:f.previewUrl&&f.mediaType?.startsWith("image/")?jsxRuntime.jsx("img",{src:f.previewUrl,alt:"",className:"size-full object-cover"}):f.mediaType?.startsWith("image/")?jsxRuntime.jsx(lucideReact.Image,{className:"size-5 text-muted-foreground"}):jsxRuntime.jsx(lucideReact.File,{className:"size-5 text-muted-foreground"})}),jsxRuntime.jsxs("span",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("span",{className:"block truncate text-xs font-medium text-foreground",title:f.name,children:f.name}),jsxRuntime.jsxs("span",{className:d("mt-0.5 flex items-center gap-1 text-[11px]",z?"text-destructive-text":"text-muted-foreground"),children:[X?jsxRuntime.jsx(lucideReact.LoaderCircle,{className:"size-3 animate-spin","aria-hidden":"true"}):null,z?jsxRuntime.jsx(lucideReact.CircleAlert,{className:"size-3","aria-hidden":"true"}):null,X?m.composer.uploading:z?m.composer.uploadFailed:f.mediaType||m.composer.attachmentOnly]})]}),jsxRuntime.jsxs("span",{className:"flex shrink-0 items-center gap-0.5",children:[z?jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:"!size-7 min-w-7 shrink-0 p-0 text-destructive-text hover:text-destructive-text","aria-label":`${m.composer.retryAttachment}: ${f.name}`,onClick:()=>c?.({type:"retry-attachment",attachmentId:f.id}),children:jsxRuntime.jsx(lucideReact.RotateCcw,{className:"size-3.5"})}):null,jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:"!size-7 min-w-7 shrink-0 p-0 text-muted-foreground hover:text-foreground","aria-label":`${m.composer.removeAttachment}: ${f.name}`,onClick:()=>c?.({type:"remove-attachment",attachmentId:f.id}),children:jsxRuntime.jsx(lucideReact.X,{className:"size-3.5"})})]})]},f.id)})}):null,jsxRuntime.jsx(en,{value:e.value,minHeight:x?44:54,maxHeight:256,"aria-label":m.composer.message,placeholder:e.placeholder,className:d("min-w-0 w-full resize-none overflow-y-auto rounded-none border-0 bg-transparent px-0 py-0 text-sm leading-relaxed text-foreground shadow-none focus-visible:ring-0 focus-visible:ring-offset-0",u?.textarea),onChange:f=>c?.({type:"change-value",value:f.target.value}),onKeyDown:f=>{f.key==="Enter"&&!f.shiftKey&&!f.nativeEvent.isComposing&&(f.preventDefault(),rt());}}),jsxRuntime.jsxs("div",{className:d("agent-workbench-composer__toolbar mt-2 flex min-w-0 max-w-full items-center",x?"min-h-7 gap-1.5":"min-h-8 gap-2",C?"flex-wrap":"flex-nowrap",u?.toolbar),children:[jsxRuntime.jsxs("div",{"data-agent-workbench-composer-controls":true,className:d("agent-workbench-composer__controls flex min-w-0 max-w-full flex-1 items-center gap-1.5",C?"w-full flex-wrap":"flex-nowrap overflow-x-auto overscroll-x-contain pb-1"),children:[e.capabilities.attachments?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:k,"aria-label":m.composer.attach,onClick:()=>A.current?.click(),children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"size-4"})}),jsxRuntime.jsx("input",{ref:A,type:"file",className:"hidden",multiple:true,onChange:f=>{let z=Array.from(f.target.files||[]);z.length>0&&c?.({type:"request-attachments",files:z}),f.target.value="";}})]}):null,_.length>0?jsxRuntime.jsxs(Se,{value:Ve,onValueChange:f=>c?.({type:"select-input-action",actionId:f}),children:[jsxRuntime.jsx(Ce,{className:d("shrink-0 gap-0.5 rounded-md bg-muted/60 p-0.5",x?"h-7":"h-8"),children:_.map(f=>{let z=f.icon==="image"?lucideReact.Image:lucideReact.FileText;return jsxRuntime.jsxs(ye,{value:f.id,className:d("min-w-0 gap-1.5 px-2.5 text-xs text-foreground/75 shadow-none hover:text-foreground data-[state=active]:bg-primary/10 data-[state=active]:text-primary data-[state=active]:shadow-none",x?"h-6":"h-7"),children:[f.icon?jsxRuntime.jsx(z,{className:"size-3.5"}):null,jsxRuntime.jsx("span",{className:"max-w-32 truncate",children:f.label})]},f.id)})}),_.map(f=>jsxRuntime.jsx(be,{value:f.id,className:"hidden"},f.id))]}):null,e.capabilities.voiceInput?jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:k,"aria-label":m.composer.voice,onClick:()=>c?.({type:"request-voice-input"}),children:jsxRuntime.jsx(lucideReact.Mic,{className:"size-4"})}):null,e.capabilities.webSearch?jsxRuntime.jsxs("label",{className:"flex shrink-0 items-center gap-1.5 whitespace-nowrap px-1 text-xs font-medium text-foreground",children:[m.composer.webSearch,jsxRuntime.jsx(tn,{checked:e.webSearchEnabled,onCheckedChange:f=>c?.({type:"toggle-web-search",enabled:f})})]}):null,n?jsxRuntime.jsxs(Se,{value:e.mode,onValueChange:f=>c?.({type:"change-mode",mode:f}),children:[jsxRuntime.jsx(Ce,{"aria-label":m.composer.chatMode,className:d("shrink-0 gap-0.5 rounded-md bg-muted/60 p-0.5",x?"h-7":"h-8"),children:["chat","work"].map(f=>jsxRuntime.jsx(ye,{value:f,className:d("min-w-0 px-2.5 text-xs text-foreground/75 shadow-none hover:text-foreground data-[state=active]:bg-primary/10 data-[state=active]:text-primary data-[state=active]:shadow-none",x?"h-6":"h-7"),children:m.modes[f]},f))}),["chat","work"].map(f=>jsxRuntime.jsx(be,{value:f,className:"hidden"},f))]}):null,e.capabilities.modelSelection?jsxRuntime.jsx(hn,{value:Z,label:m.composer.model,placeholder:m.composer.noModels,className:"w-48 min-w-36",options:w.map(f=>({value:zt(f),label:`${f.label} \xB7 ${m.modes[f.mode]}`,disabled:f.disabled})),onValueChange:f=>{let z=w.find(X=>zt(X)===f);z&&c?.({type:"select-model",modelId:z.id,mode:z.mode});}}):null,e.capabilities.reasoning&&e.reasoning?jsxRuntime.jsx(hn,{value:e.reasoning.value,label:m.composer.reasoning,className:"w-32 min-w-24",options:e.reasoning.options.map(f=>({value:f,label:m.composer.reasoningOptions[f]})),onValueChange:f=>c?.({type:"change-reasoning",value:f})}):null,e.capabilities.permissions&&e.permissionProfile?jsxRuntime.jsx(hn,{value:e.permissionProfile,label:m.composer.permissions,className:"w-40 min-w-32",options:["approval-required","auto-approve","full-access"].map(f=>({value:f,label:m.composer.permissionOptions[f]})),onValueChange:f=>c?.({type:"change-permission",value:f})}):null]}),jsxRuntime.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5",children:[ke?jsxRuntime.jsx(W,{type:"submit",size:"icon",className:d(k,"bg-primary text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground disabled:bg-primary/40 disabled:!opacity-100"),"aria-label":K&&e.capabilities.queue?m.composer.queue:m.composer.send,disabled:!ge,children:jsxRuntime.jsx(lucideReact.Send,{className:"size-4 !text-white [&_path]:!stroke-white"})}):null,K&&!ge&&e.capabilities.stop?jsxRuntime.jsx(W,{type:"button",variant:"outline",size:"icon",className:k,"aria-label":le?m.run.stopping:m.composer.stop,disabled:le,onClick:()=>c?.({type:"stop"}),children:jsxRuntime.jsx(lucideReact.Square,{className:"size-3 fill-current"})}):null]})]})]}),e.status==="error"&&e.error?jsxRuntime.jsx("p",{role:"alert",className:"text-sm text-destructive-text",children:e.error}):null]})})}a(Aa,"AgentWorkbenchComposer");var Ro={sparkles:lucideReact.Sparkles,palette:lucideReact.Palette,search:lucideReact.Search,"file-text":lucideReact.FileText,code:lucideReact.Code2,"shopping-bag":lucideReact.ShoppingBag},je="__quick-start__";function Da({template:e}){let t=Ro[e.icon||"sparkles"];return e.coverImageUrl?jsxRuntime.jsx("img",{src:e.coverImageUrl,alt:"",className:"size-full bg-muted object-contain"}):jsxRuntime.jsx("span",{className:"flex size-full items-center justify-center bg-gradient-to-br from-primary/5 via-muted/50 to-primary/15",children:jsxRuntime.jsx("span",{className:"flex size-14 items-center justify-center rounded-2xl border border-primary/10 bg-background/85 text-primary shadow-sm",children:jsxRuntime.jsx(t,{className:"size-7","aria-hidden":"true"})})})}a(Da,"TemplateVisual");function za({viewModel:e,className:t,onIntent:n}){let o=L().agentWorkbench.quickStart,r=ne.useRef(null),[i,l]=ne.useState(),[u,g]=ne.useState(),[p,c]=ne.useState(),v=ne.useMemo(()=>e.categories.map(y=>({...y,sections:y.sections.map(C=>({...C,templates:C.templates.filter(F=>!F.modes||F.modes.includes(e.mode))})).filter(C=>C.templates.length>0)})).filter(y=>y.sections.length>0),[e.categories,e.mode]),x=ne.useMemo(()=>{let y=v.flatMap(C=>C.sections.filter(F=>F.id==="quick-start")).map(C=>C.templates).flat().filter((C,F,Q)=>Q.findIndex(K=>K.id===C.id)===F);if(y.length!==0)return {id:je,label:o.label,icon:"sparkles",sections:[{id:"quick-start",label:o.label,templates:y}]}},[v,o.label]),k=i===je?x:v.find(y=>y.id===i),m=k?.sections.find(y=>y.id===u)||k?.sections[0],A=m?.templates.length?m.templates.every(y=>!y.coverImageUrl):false;if(ne.useEffect(()=>{i&&i!==je&&!v.some(y=>y.id===i)&&(l(void 0),g(void 0)),i===je&&!x&&(l(void 0),g(void 0));},[i,v,x]),v.length===0)return null;let P=a(y=>{l(y.id),g(y.sections[0]?.id),n?.({type:"change-category",categoryId:y.id});},"selectCategory"),E=a(()=>{x&&(l(je),g(x.sections[0]?.id),n?.({type:"change-category"}));},"selectQuickStart"),b=a(y=>{k&&(g(y),n?.({type:"change-section",categoryId:k.id,sectionId:y}));},"selectSection"),s=a(y=>{if(e.disabled)return;if(y.action!=="upload"){n?.({type:"select-template",templateId:y.id,prompt:y.prompt});return}let C=r.current;C&&(C.accept=y.accept||"*/*",C.multiple=y.multiple===true,c(y),C.click());},"selectTemplate");return jsxRuntime.jsxs("section",{className:d("agent-workbench-quick-start min-w-0 max-w-full",t),"aria-label":o.label,children:[jsxRuntime.jsx("input",{ref:r,type:"file",className:"hidden",onChange:y=>{let C=Array.from(y.target.files||[]);p&&C.length>0&&n?.({type:"select-template",templateId:p.id,prompt:p.prompt,files:p.multiple?C:C.slice(0,1)}),c(void 0),y.target.value="";}}),k?jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex min-w-0 max-w-full items-center gap-1 overflow-x-auto pb-1",children:[jsxRuntime.jsxs("button",{type:"button",className:"inline-flex h-9 shrink-0 items-center gap-1.5 rounded-md px-3 text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>{l(void 0),g(void 0),n?.({type:"change-category"});},children:[jsxRuntime.jsx(lucideReact.ArrowLeft,{className:"size-4","aria-hidden":"true"}),o.back]}),k.sections.map((y,C)=>jsxRuntime.jsx("button",{type:"button","aria-pressed":m?.id===y.id,className:d("h-9 shrink-0 rounded-md px-4 text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",m?.id===y.id?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/70 hover:text-foreground"),onClick:()=>b(y.id),children:k.id!==je&&C===0?k.label:y.label},y.id))]}),jsxRuntime.jsx("div",{"data-quick-start-layout":A?"list":"cards",className:d("grid",A?"grid-cols-1 gap-0":"grid-cols-[repeat(auto-fit,minmax(min(100%,14rem),1fr))] gap-3"),children:m?.templates.map(y=>jsxRuntime.jsxs("button",{type:"button",disabled:e.disabled,"data-quick-start-template-id":y.id,className:d("group min-w-0 overflow-hidden text-left transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",A?"flex min-h-14 items-center rounded-none border-x-0 border-t-0 bg-transparent shadow-none hover:border-border hover:bg-muted/40 last:border-b-0":"rounded-xl border border-border bg-background hover:border-primary/30 hover:bg-muted/20"),onClick:()=>s(y),children:[jsxRuntime.jsxs("span",{className:d(A?"min-w-0 flex-1 px-2 py-2.5":"block px-4 pb-3 pt-4"),children:[jsxRuntime.jsxs("span",{className:d("flex items-center gap-2 text-sm text-foreground",A?"font-medium":"font-semibold"),children:[y.title,y.action==="upload"?jsxRuntime.jsxs("span",{className:"ml-auto inline-flex items-center gap-1 text-[11px] font-medium text-muted-foreground",children:[jsxRuntime.jsx(lucideReact.Upload,{className:"size-3","aria-hidden":"true"}),o.addFile]}):null]}),y.description?jsxRuntime.jsx("span",{className:d("line-clamp-2 block text-xs leading-4 text-muted-foreground",A?"mt-0.5 min-h-0 text-muted-foreground/75":"mt-1 min-h-8"),children:y.description}):null]}),A?jsxRuntime.jsx(lucideReact.ArrowUpRight,{className:"mr-2 size-4 shrink-0 text-muted-foreground/45","aria-hidden":"true"}):jsxRuntime.jsx("span",{className:d("block overflow-hidden",y.coverImageUrl?"aspect-[5/2]":"h-28"),children:jsxRuntime.jsx(Da,{template:y})})]},y.id))})]}):jsxRuntime.jsxs("div",{className:"flex max-w-full items-center justify-center gap-2 overflow-x-auto px-1 pb-1",children:[x?jsxRuntime.jsxs("button",{type:"button",className:"inline-flex h-10 shrink-0 items-center gap-2 rounded-md border border-border bg-background px-4 text-sm font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring","aria-pressed":i===je,onClick:E,children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),o.label]}):null,v.map(y=>{let C=Ro[y.icon||"sparkles"];return jsxRuntime.jsxs("button",{type:"button",className:"inline-flex h-10 shrink-0 items-center gap-2 rounded-md border border-border bg-background px-4 text-sm font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>P(y),children:[jsxRuntime.jsx(C,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),y.label]},y.id)})]})]})}a(za,"AgentWorkbenchQuickStart");var Je=ne.forwardRef(a(function({children:t,header:n,search:o,primaryAction:r,actions:i,groups:l,footer:u,className:g,classNames:p,bodyProps:c,bodyScrollable:v=true,status:x="ready",variant:k,density:m,loadingState:A,emptyState:P,errorState:E,...b},s){let y=fe({variant:k,density:m}),C=y.density==="compact",F=o!==void 0||r!==void 0||i!==void 0,Q=x==="loading"?A:x==="empty"?P:x==="error"?E:t;return jsxRuntime.jsxs("nav",{ref:s,"data-agent-workbench-variant":y.variant,"data-agent-workbench-density":y.density,"data-agent-workbench-status":x,className:d("flex h-full min-h-0 flex-col bg-card text-card-foreground",p?.root,g),...b,children:[n!==void 0?jsxRuntime.jsx("div",{className:d("shrink-0",p?.header),children:n}):null,F?jsxRuntime.jsxs("div",{className:d("shrink-0",C?"space-y-2 px-3 pb-2 pt-3":"space-y-3 px-4 pb-2 pt-4",p?.search),children:[o,r!==void 0?jsxRuntime.jsx("div",{className:d(p?.primaryAction),children:r}):null,i!==void 0?jsxRuntime.jsx("div",{className:d("flex min-w-0 items-center gap-2",p?.actions),children:i}):null]}):null,jsxRuntime.jsx("div",{"data-agent-workbench-scroll-region":v?"":void 0,...c,tabIndex:c?.tabIndex??(v?0:void 0),className:d("min-h-0 flex-1",C?"px-3 pb-3":"px-4 pb-4",v&&"overflow-x-hidden overflow-y-auto overscroll-contain",p?.body),children:Q}),l!==void 0?jsxRuntime.jsx("div",{className:d("shrink-0",p?.groups),children:l}):null,u!==void 0?jsxRuntime.jsx("div",{className:d("shrink-0",p?.footer),children:u}):null]})},"AgentWorkbenchSidebarContainer"));Je.displayName="AgentWorkbenchSidebarContainer";function Ot({value:e,label:t,placeholder:n=t,className:o,variant:r="default",onChange:i}){let l=L().agentWorkbench.navigation,u=ne.useRef(null);return ne.useEffect(()=>{let g=a(p=>{!(p.ctrlKey||p.metaKey)||p.key.toLocaleLowerCase()!=="k"||(p.preventDefault(),u.current?.focus(),u.current?.select());},"handleShortcut");return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[]),jsxRuntime.jsxs(go,{className:d(r==="trend"?"h-12 rounded-[var(--radius)] border-border bg-card text-foreground":"h-10 rounded-lg bg-card",o),children:[jsxRuntime.jsx(It,{children:jsxRuntime.jsx(lucideReact.Search,{className:"size-4","aria-hidden":"true"})}),jsxRuntime.jsx(an,{ref:u,type:"search",value:e,"aria-label":t,placeholder:n,className:"min-w-0 [&::-webkit-search-cancel-button]:hidden",onChange:g=>i(g.target.value),onKeyDown:g=>{g.key==="Escape"&&(i(""),g.currentTarget.blur());}}),e?jsxRuntime.jsx(It,{align:"inline-end",children:jsxRuntime.jsx(fo,{size:"icon-xs","aria-label":l.clearSearch,onClick:()=>i(""),children:jsxRuntime.jsx(lucideReact.X,{className:"size-3.5","aria-hidden":"true"})})}):jsxRuntime.jsx(It,{align:"inline-end",children:jsxRuntime.jsx("kbd",{className:"border border-border px-1.5 py-0.5 text-[10px]",children:"Ctrl K"})})]})}a(Ot,"AgentWorkbenchSidebarSearch");function Bt({label:e,className:t,variant:n="default",onClick:o}){return jsxRuntime.jsxs(W,{type:"button",variant:n==="trend"?"default":"ghost",className:d(n==="trend"?"h-11 w-full justify-center gap-2 rounded-[var(--radius)] border border-primary/60 bg-primary px-3 font-semibold text-primary-foreground hover:bg-primary/90":"h-9 w-full justify-start gap-2 px-3 text-sm",t),onClick:o,children:[jsxRuntime.jsx(lucideReact.SquarePen,{className:"size-4","aria-hidden":"true"}),e]})}a(Bt,"AgentWorkbenchSidebarNewSessionButton");function Po({item:e}){let[t,n]=ne.useState(false);return e.thumbnailUrl&&!t?jsxRuntime.jsx("img",{src:e.thumbnailUrl,alt:"",className:"size-full object-cover",loading:"lazy",onError:()=>n(true)}):jsxRuntime.jsx(lucideReact.Image,{className:"size-5","aria-hidden":"true"})}a(Po,"SessionAvatar");function Io({item:e}){let{locale:t}=dt(),n=L().agentWorkbench.navigation;return jsxRuntime.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"min-w-0 truncate text-xs text-foreground/80",children:new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e.updatedAt))}),e.mode?jsxRuntime.jsx("span",{className:d("shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium leading-none",e.mode==="work"?"bg-primary/10 text-primary":"bg-muted text-foreground"),children:e.mode==="work"?n.work:n.chat}):null]})}a(Io,"SessionMeta");function Ya({status:e}){let t=L().agentWorkbench.navigation;return e==="running"?jsxRuntime.jsx(lucideReact.Loader2,{className:"size-4 animate-spin text-primary","aria-label":t.running}):e==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"size-4 text-primary","aria-label":t.completed}):e==="error"?jsxRuntime.jsx(lucideReact.AlertCircle,{className:"size-4 text-destructive-text","aria-label":t.failed}):null}a(Ya,"StatusIndicator");function Ht({sessions:e,selectedSessionId:t,status:n="ready",error:o,query:r="",emptyLabel:i,noResultsLabel:l,retryLabel:u,groupByMode:g=false,showHeading:p=false,variant:c="default",className:v,itemClassName:x,capabilities:k,onSelect:m,onTogglePin:A,onRename:P,onDelete:E,onRetry:b}){let s=L().agentWorkbench.navigation,y=ne.useRef(null),[C,F]=ne.useState(),[Q,K]=ne.useState("");ne.useEffect(()=>{C&&(y.current?.focus(),y.current?.select());},[C]);let le=a(()=>{F(void 0),K("");},"cancelRename"),J=a(M=>{let w=Q.trim();w&&w!==M.title&&P?.(M.id,w),le();},"saveRename");if(n==="loading"&&e.length===0)return jsxRuntime.jsx("div",{className:"space-y-2 px-1 py-3",role:"status","aria-label":s.loading,children:Array.from({length:4},(M,w)=>jsxRuntime.jsx("div",{"aria-hidden":"true",className:d("animate-pulse rounded-[var(--radius)] bg-muted/70",c==="trend"?"h-10":"h-14")},w))});if(n==="error")return jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-3 px-3 py-8 text-center",children:[jsxRuntime.jsx("p",{className:"max-w-full break-words text-sm text-muted-foreground",role:"alert",children:o}),b?jsxRuntime.jsxs(W,{type:"button",variant:"ghost",size:"sm",className:"gap-1.5 px-0 text-sm text-primary hover:text-primary",onClick:b,children:[jsxRuntime.jsx(lucideReact.RefreshCw,{className:"size-3.5","aria-hidden":"true"}),u??s.retry]}):null]});if(e.length===0)return jsxRuntime.jsx("div",{className:"px-3 py-8 text-center text-sm text-muted-foreground",children:r?l:i});let ge=a(M=>jsxRuntime.jsx("div",{className:"space-y-3",children:M.map(w=>jsxRuntime.jsxs("div",{"aria-current":w.id===t?"page":void 0,"data-agent-session-status":w.status??"idle","aria-busy":w.status==="running"?"true":void 0,className:"group flex h-10 w-full min-w-0 items-center rounded-[var(--radius)] border border-transparent bg-muted/60 text-foreground transition hover:bg-muted focus-within:border-ring focus-within:ring-2 focus-within:ring-ring aria-[current=page]:border-primary aria-[current=page]:bg-primary/10",children:[jsxRuntime.jsx("button",{type:"button",title:w.title,className:"h-full min-w-0 flex-1 truncate px-3 text-left text-sm font-semibold",onClick:()=>m(w.id),children:w.title}),k?.delete?jsxRuntime.jsx("span",{"data-agent-workbench-item-actions":true,className:"mr-1 shrink-0 opacity-0 transition-opacity group-aria-[current=page]:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100",onClick:Z=>Z.stopPropagation(),onKeyDown:Z=>Z.stopPropagation(),children:jsxRuntime.jsxs(ln,{children:[jsxRuntime.jsx(dn,{asChild:true,children:jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon","aria-label":s.actions,className:"size-8 text-muted-foreground",children:jsxRuntime.jsx(lucideReact.Ellipsis,{className:"size-4","aria-hidden":"true"})})}),jsxRuntime.jsx(Et,{align:"end",children:jsxRuntime.jsxs(ut,{className:"text-destructive-text",onSelect:()=>E?.(w.id),children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"mr-2 size-4","aria-hidden":"true"}),s.delete]})})]})}):null]},w.id))}),"renderTrendItems"),ke=a(M=>jsxRuntime.jsx("div",{className:"space-y-1",children:M.map(w=>{let Z=w.contextUsage&&w.contextUsage.maxTokens>0?Math.min(100,Math.round(w.contextUsage.usedTokens/w.contextUsage.maxTokens*100)):void 0;return jsxRuntime.jsxs("div",{"aria-current":w.id===t?"page":void 0,className:d("group flex w-full min-w-0 items-center gap-3 rounded-lg border border-transparent px-3 py-2 text-left hover:bg-muted aria-[current=page]:border-primary aria-[current=page]:bg-muted",x),children:[C===w.id?jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[jsxRuntime.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted",children:jsxRuntime.jsx(Po,{item:w})}),jsxRuntime.jsxs("span",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx(qe,{ref:y,value:Q,"aria-label":s.rename,appearance:"compact",className:"h-6 w-full border-primary px-1.5 text-sm font-medium",onChange:_=>K(_.target.value),onClick:_=>_.stopPropagation(),onBlur:()=>J(w),onKeyDown:_=>{_.stopPropagation(),_.key==="Enter"?(_.preventDefault(),J(w)):_.key==="Escape"&&(_.preventDefault(),le());}}),jsxRuntime.jsx(Io,{item:w})]})]}):jsxRuntime.jsxs("button",{type:"button",title:w.title,className:"flex min-w-0 flex-1 items-center gap-3 text-left",onClick:()=>m(w.id),children:[jsxRuntime.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted",children:jsxRuntime.jsx(Po,{item:w})}),jsxRuntime.jsxs("span",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("span",{className:"block truncate text-sm font-medium",children:w.title}),jsxRuntime.jsx(Io,{item:w})]})]}),jsxRuntime.jsxs("span",{"data-agent-workbench-item-actions":true,className:"flex shrink-0 items-center gap-1",children:[Z!==void 0&&w.status==="idle"?jsxRuntime.jsxs("span",{className:"text-xs text-foreground","aria-label":s.contextUsage({percent:Z}),children:[Z,"%"]}):jsxRuntime.jsx(Ya,{status:w.status}),k?.pin?jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon","aria-label":w.pinned?s.unpin:s.pin,className:d("size-8 text-muted-foreground opacity-0 group-hover:opacity-100",w.pinned&&"text-primary opacity-100"),onClick:_=>{_.stopPropagation(),A?.(w.id,!w.pinned);},children:jsxRuntime.jsx(lucideReact.Pin,{className:d("size-4",w.pinned&&"fill-current")})}):null,k?.rename||k?.delete?jsxRuntime.jsx("span",{onClick:_=>_.stopPropagation(),onKeyDown:_=>_.stopPropagation(),children:jsxRuntime.jsxs(ln,{children:[jsxRuntime.jsx(dn,{asChild:true,children:jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:"size-8","aria-label":s.actions,children:jsxRuntime.jsx(lucideReact.Ellipsis,{className:"size-4","aria-hidden":"true"})})}),jsxRuntime.jsxs(Et,{align:"end",children:[k.rename?jsxRuntime.jsxs(ut,{onSelect:()=>{F(w.id),K(w.title);},children:[jsxRuntime.jsx(lucideReact.Pencil,{className:"mr-2 size-4","aria-hidden":"true"}),s.rename]}):null,k.delete?jsxRuntime.jsxs(ut,{className:"text-destructive-text",onSelect:()=>E?.(w.id),children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"mr-2 size-4","aria-hidden":"true"}),s.delete]}):null]})]})}):null]})]},w.id)})}),"renderItems");return jsxRuntime.jsxs("div",{className:d("space-y-2",v),children:[p&&!g?jsxRuntime.jsx("h3",{className:"mb-2 px-3 text-xs font-medium text-muted-foreground",children:s.recentSessions}):null,c==="trend"?ge(e):g?[{id:"chatbot",label:s.chats,icon:lucideReact.MessageSquare,items:e.filter(M=>M.mode!=="work")},{id:"agent",label:s.agents,icon:lucideReact.Bot,items:e.filter(M=>M.mode==="work")}].map(({id:M,label:w,icon:Z,items:_})=>jsxRuntime.jsxs("details",{open:true,"aria-label":w,children:[jsxRuntime.jsxs("summary",{className:"flex h-9 cursor-pointer list-none items-center gap-2 rounded-md px-3 text-sm font-semibold hover:bg-muted",children:[jsxRuntime.jsx(Z,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:"min-w-0 truncate",children:w})]}),ke(_)]},M)):ke(e)]})}a(Ht,"AgentWorkbenchSessionList");var as={contract:"AgentWorkbenchNavigationViewModel",activeTab:"sessions",searchQuery:"",agents:{status:"loading",items:[]},sessions:{status:"loading",items:[]},capabilities:{createAgent:false,createSession:false,manageCapabilities:false,manageAgentSettings:false,pinAgents:false,pinSessions:false,renameSessions:false,deleteSessions:false}};function ss({item:e}){let[t,n]=ne.useState(false);if(e.iconUrl&&!t)return jsxRuntime.jsx("img",{src:e.iconUrl,alt:"",className:"size-full object-cover",onError:()=>n(true)});let o=e.name.trim().charAt(0).toLocaleUpperCase();return o?jsxRuntime.jsx("span",{className:"text-sm font-semibold",children:o}):jsxRuntime.jsx(lucideReact.Bot,{className:"size-4"})}a(ss,"ItemAvatar");function is({status:e,empty:t,noResults:n,hasItems:o,query:r,error:i,onRetry:l}){let u=L().agentWorkbench.navigation;return e==="loading"&&!o?jsxRuntime.jsx("div",{className:"px-3 py-8 text-center text-sm text-muted-foreground",children:u.loading}):e==="error"?jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-3 px-3 py-8 text-center",children:[jsxRuntime.jsx("p",{className:"max-w-full break-words text-sm text-muted-foreground",role:"alert",children:i}),jsxRuntime.jsxs(W,{type:"button",variant:"ghost",size:"sm",className:"gap-1.5 px-0 text-sm text-primary hover:text-primary",onClick:l,children:[jsxRuntime.jsx(lucideReact.RefreshCw,{className:"size-3.5","aria-hidden":"true"}),u.retry]})]}):o?null:jsxRuntime.jsx("div",{className:"px-3 py-8 text-center text-sm text-muted-foreground",children:r?n:t})}a(is,"CollectionState");function ls({viewModel:e=as,navigationMode:t,config:n,header:o,headerActions:r,footer:i,className:l,classNames:u,onIntent:g}){let p=L().agentWorkbench.navigation,c=ne.useMemo(()=>monkeys.resolveAgentWorkbenchSidebarConfig(n),[n]),v=ne.useMemo(()=>new Set(c.visibleSections),[c.visibleSections]),x=t==="sessions-only"||t===void 0&&c.navigationMode!=="default",k=v.has("agents")&&!x,m=v.has("sessions"),A=e.searchQuery.trim().toLocaleLowerCase(),P=ne.useMemo(()=>e.agents.items.filter(b=>!A||`${b.name} ${b.description??""}`.toLocaleLowerCase().includes(A)),[A,e.agents.items]),E=ne.useMemo(()=>e.sessions.items.filter(b=>!A||b.title.toLocaleLowerCase().includes(A)),[A,e.sessions.items]);return jsxRuntime.jsx(Se,{value:x||!k?"sessions":e.activeTab,onValueChange:b=>{!x&&(b==="agents"||b==="sessions")&&g?.({type:"change-tab",tab:b});},className:"h-full min-h-0",children:jsxRuntime.jsxs(Je,{"data-sidebar-width-percent":c.widthPercent,"aria-label":p.tabsLabel,header:v.has("header")?o:void 0,search:v.has("search")?jsxRuntime.jsx(Ot,{value:e.searchQuery,label:x?p.searchSessions:p.search,className:u?.search,onChange:b=>g?.({type:"change-search",query:b})}):void 0,actions:k&&m||r?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[k&&m?jsxRuntime.jsxs(Ce,{className:d("grid min-w-0 flex-1 grid-cols-2 text-foreground",u?.tabs),"aria-label":p.tabsLabel,children:[jsxRuntime.jsx(ye,{value:"agents",children:p.agents}),jsxRuntime.jsx(ye,{value:"sessions",children:p.sessions})]}):null,r?jsxRuntime.jsx("div",{className:"flex shrink-0 items-center",children:r}):null]}):void 0,footer:v.has("footer")&&(!x&&e.capabilities.manageAgentSettings||i)?jsxRuntime.jsxs("div",{className:d("border-t border-border p-4",u?.footer),children:[!x&&e.capabilities.manageAgentSettings?jsxRuntime.jsxs(W,{type:"button",variant:"ghost",className:"h-10 w-full justify-start gap-2 px-3 text-sm",onClick:()=>g?.({type:"open-agent-settings"}),children:[jsxRuntime.jsx(lucideReact.Settings,{className:"size-4","aria-hidden":"true"}),p.settings]}):null,i]}):void 0,bodyScrollable:false,className:l,classNames:{root:u?.root,body:"flex min-h-0 flex-1 flex-col p-0"},children:[k?jsxRuntime.jsxs(be,{value:"agents","data-agent-workbench-scroll-region":true,className:d("mt-0 min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain px-4 pb-4",u?.body),children:[e.capabilities.createAgent?jsxRuntime.jsxs(W,{type:"button",variant:"ghost",className:"mb-3 h-9 w-full justify-start gap-2 px-3 text-sm",onClick:()=>g?.({type:"create-agent"}),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"size-4","aria-hidden":"true"}),p.newAgent]}):null,jsxRuntime.jsx("h3",{className:"mb-2 px-3 text-xs font-medium text-muted-foreground",children:p.allAgents}),jsxRuntime.jsx(is,{status:e.agents.status,empty:p.emptyAgents,noResults:p.noResults,hasItems:P.length>0,query:A,error:e.agents.error,onRetry:()=>g?.({type:"retry-agents"})}),jsxRuntime.jsx("div",{className:"space-y-1",children:P.map(b=>jsxRuntime.jsxs("div",{"aria-current":b.id===e.selectedAgentItem?"page":void 0,className:d("group flex w-full min-w-0 items-center gap-3 rounded-lg border border-transparent px-3 py-2 text-left hover:bg-muted aria-[current=page]:border-primary aria-[current=page]:bg-muted",u?.item),children:[jsxRuntime.jsxs("button",{type:"button",title:b.name,className:"flex min-w-0 flex-1 items-center gap-3 text-left",onClick:()=>g?.({type:"select-agent",itemId:b.id}),children:[jsxRuntime.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted",children:jsxRuntime.jsx(ss,{item:b})}),jsxRuntime.jsxs("span",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("span",{className:"block truncate text-sm font-medium",children:b.name}),jsxRuntime.jsx("span",{className:"block truncate text-xs text-foreground/80",children:b.description||p.noDescription})]})]}),b.builtIn?jsxRuntime.jsx("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-1 text-[10px] text-foreground",children:p.builtIn}):null,e.capabilities.pinAgents?jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon","aria-label":b.pinned?p.unpin:p.pin,className:d("size-8 text-muted-foreground opacity-0 group-hover:opacity-100",b.pinned&&"text-primary opacity-100"),onClick:s=>{s.stopPropagation(),g?.({type:"toggle-agent-pin",itemId:b.id,pinned:!b.pinned});},onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),s.stopPropagation(),g?.({type:"toggle-agent-pin",itemId:b.id,pinned:!b.pinned}));},children:jsxRuntime.jsx(lucideReact.Pin,{className:d("size-4",b.pinned&&"fill-current",b.pinPending&&"animate-pulse")})}):null]},b.id))})]}):null,m?jsxRuntime.jsxs(be,{value:"sessions","data-agent-workbench-scroll-region":true,className:d("mt-0 min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain px-4 pb-4",u?.body),children:[v.has("new-session")&&e.capabilities.createSession?jsxRuntime.jsx(Bt,{label:p.newSession,onClick:()=>g?.({type:"create-session"})}):null,!x&&e.capabilities.manageCapabilities?jsxRuntime.jsxs(W,{type:"button",variant:"ghost",className:"mb-3 h-9 w-full justify-start gap-2 px-3 text-sm",onClick:()=>g?.({type:"open-capabilities"}),children:[jsxRuntime.jsx(lucideReact.Blocks,{className:"size-4","aria-hidden":"true"}),p.capabilities]}):null,jsxRuntime.jsx(Ht,{sessions:E,selectedSessionId:e.selectedSessionItem,status:e.sessions.status,error:e.sessions.error,query:A,emptyLabel:p.emptySessions,noResultsLabel:p.noResults,groupByMode:x,showHeading:!x,itemClassName:u?.item,capabilities:{pin:e.capabilities.pinSessions,rename:e.capabilities.renameSessions,delete:e.capabilities.deleteSessions},onSelect:b=>g?.({type:"select-session",sessionId:b}),onTogglePin:(b,s)=>g?.({type:"toggle-session-pin",sessionId:b,pinned:s}),onRename:(b,s)=>g?.({type:"rename-session",sessionId:b,title:s}),onDelete:b=>g?.({type:"delete-session",sessionId:b}),onRetry:()=>g?.({type:"retry-sessions"})})]}):null]})})}a(ls,"AgentWorkbenchSidebar");function Do({item:e,src:t=e.imageUrl,className:n,onError:o}){if(!t)return null;let r=e.mediaVariant??"cover",i=r==="logo",l=r==="cover-with-label",u=e.mediaTreatment==="monochrome-light"?"brightness-0 invert":e.mediaTreatment==="invert"?"invert":"";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:d(i?"flex size-full items-center justify-center bg-[hsl(var(--monkeys-color-media-surface))] p-token-xl":"block size-full",n),children:jsxRuntime.jsx("img",{src:t,alt:"",className:d("transition-transform duration-300 group-hover:scale-[1.03]",i?"max-h-full max-w-full object-contain":"size-full object-cover",u),onError:o})}),l?jsxRuntime.jsxs("span",{className:"pointer-events-none absolute inset-x-0 bottom-0 text-[hsl(var(--monkeys-color-media-foreground))]",style:{paddingInline:"var(--global-spacing, 0.75rem)",paddingBottom:"var(--global-spacing-sm, 0.5rem)",paddingTop:"var(--global-spacing-2xl, 1.5rem)",backgroundImage:"linear-gradient(to top, hsl(var(--monkeys-color-media-overlay) / 0.8), hsl(var(--monkeys-color-media-overlay) / 0.3), transparent)"},children:[jsxRuntime.jsx("span",{className:"block text-base font-semibold",children:e.title}),e.subtitle?jsxRuntime.jsx("span",{className:"block text-xs opacity-75",style:{marginTop:"calc(var(--global-spacing, 0.75rem) / 6)"},children:e.subtitle}):null]}):null]})}a(Do,"AgentWorkbenchExploreCardMedia");function ms({sessions:e,groups:t,config:n,labels:o,selectedSessionId:r,searchQuery:i="",loading:l=false,error:u,showDraftSession:g=!r,deleteSessions:p=false,variant:c="default",defaultGroupId:v,header:x,footer:k,className:m,renderItemMedia:A,onIntent:P}){let E=ne.useMemo(()=>monkeys.resolveAgentWorkbenchSidebarConfig(n),[n]),b=ne.useMemo(()=>new Set(E.visibleSections),[E.visibleSections]),s=t?.length?t:E.groups,y=v??E.defaultGroupId,[C,F]=ne.useState(y??s[0]?.id??""),Q=s.find(M=>M.id===C)??s[0],K=i.trim().toLocaleLowerCase(),le=g&&(!K||o.draftSession.toLocaleLowerCase().includes(K)),J=ne.useMemo(()=>e.filter(M=>!K||M.title.toLocaleLowerCase().includes(K)),[K,e]);ne.useEffect(()=>{s.some(M=>M.id===C)||F(y??s[0]?.id??"");},[C,s,y]);let ge=a(M=>{F(M),P?.({type:"change-group",groupId:M});},"changeGroup"),ke=b.has("groups")&&Q?jsxRuntime.jsx("div",{className:"border-t border-border px-4 pb-4 pt-3",children:jsxRuntime.jsxs(Se,{value:Q.id,onValueChange:ge,children:[jsxRuntime.jsx(Ce,{className:"grid h-10 w-full rounded-[var(--radius)] bg-muted p-0.5 text-foreground",style:{gridTemplateColumns:`repeat(${s.length}, minmax(0, 1fr))`},children:s.map(M=>jsxRuntime.jsx(ye,{value:M.id,className:"rounded-md text-sm font-semibold text-foreground data-[state=active]:border data-[state=active]:border-border data-[state=active]:bg-background",children:M.label},M.id))}),s.map(M=>jsxRuntime.jsx(be,{value:M.id,className:"mt-3",children:jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:M.items.map(w=>jsxRuntime.jsx("button",{type:"button","aria-label":w.title,className:"group relative aspect-[1.27] overflow-hidden rounded-[var(--radius)] border border-border bg-card text-left transition hover:border-primary focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",style:Number.isFinite(M.itemAspectRatio)&&Number(M.itemAspectRatio)>0?{aspectRatio:M.itemAspectRatio}:void 0,onClick:()=>P?.({type:"select-item",groupId:M.id,item:w}),children:A?.(w,M)??jsxRuntime.jsx(Do,{item:w})},w.id))})},M.id))]})}):void 0;return jsxRuntime.jsx(Je,{"data-sidebar-style":"explore","data-sidebar-width-percent":E.widthPercent,"aria-label":o.navigation,variant:c,density:c==="trend"?"compact":void 0,header:b.has("header")?x:void 0,search:b.has("search")?jsxRuntime.jsx(Ot,{value:i,label:o.search,variant:c,onChange:M=>P?.({type:"change-search",query:M})}):void 0,primaryAction:b.has("new-session")?jsxRuntime.jsx(Bt,{label:o.newSession,variant:c,onClick:()=>P?.({type:"create-session"})}):void 0,groups:ke,footer:b.has("footer")?k:void 0,bodyProps:{"data-agent-workbench-session-scroll-region":""},className:m,classNames:{body:"min-h-[160px] flex-[0_1_280px]"},children:b.has("sessions")?jsxRuntime.jsxs("div",{className:"space-y-2",children:[le?jsxRuntime.jsx("button",{type:"button","aria-current":"page",className:"block h-10 w-full min-w-0 truncate rounded-[var(--radius)] border border-primary bg-primary/10 px-3 text-left text-sm font-semibold text-foreground",onClick:()=>P?.({type:"create-session"}),children:o.draftSession}):null,J.length>0||!le||l||u?jsxRuntime.jsx(Ht,{sessions:J,selectedSessionId:r,status:u?"error":l?"loading":"ready",error:u,query:K,emptyLabel:o.emptySessions,noResultsLabel:o.noResults,retryLabel:o.retry,groupByMode:E.navigationMode!=="default",variant:c,capabilities:{delete:p},onSelect:M=>P?.({type:"select-session",sessionId:M}),onDelete:M=>P?.({type:"delete-session",sessionId:M}),onRetry:o.retry?()=>P?.({type:"retry-sessions"}):void 0}):null]}):null})}a(ms,"AgentWorkbenchExploreSidebar");var fs={reasoning:"reasoning",plan:"plan",task:"tasks",tool:"tools",approval:"approval",artifact:"artifacts",usage:"usage"};function bs(e){let t=e.filter(p=>p.eventType==="status"),n=t.at(-1);if(!n)return;if(n.payload.status!=="stopped"||n.payload.durationMs!==void 0)return n;let o=n.runId?t.filter(p=>p.runId===n.runId&&p.sequence<=n.sequence):t.filter(p=>p.sequence<=n.sequence),r=-1;for(let p=o.length-1;p>=0;p-=1){let c=o[p];if(c.sequence<n.sequence&&c.payload.status==="stopped"){r=p;break}}let i=o.slice(r+1).reverse().find(p=>p.payload.status==="running"||p.payload.status==="queued"),l=i?.payload.startedAt??i?.occurredAt,u=n.payload.stoppedAt??n.occurredAt;if(!l||!u)return n;let g=Date.parse(u)-Date.parse(l);return Number.isFinite(g)&&g>=0?{...n,resolvedDurationMs:g}:n}a(bs,"projectRun");function hs(e,t){let n=fs[e.eventType];return n?t[n]===true:true}a(hs,"isVisible");function Ze(e,t,n){let o=new Map;for(let r of e){if(r.eventType!==t)continue;let i=r;o.set(n(i),i);}return [...o.values()].sort((r,i)=>r.sequence-i.sequence)}a(Ze,"latestBy");function kn(e){let t=e.events.filter(n=>hs(n,e.snapshot.capabilities));return {mode:e.snapshot.mode,status:e.status,reasoning:Ze(t,"reasoning",n=>n.payload.reasoningId),plans:Ze(t,"plan",n=>n.payload.planId),tasks:Ze(t,"task",n=>n.payload.taskId),tools:Ze(t,"tool",n=>n.payload.toolCallId),approvals:Ze(t,"approval",n=>n.payload.approvalId),artifacts:Ze(t,"artifact",n=>n.payload.artifactId),usage:[...t].reverse().find(n=>n.eventType==="usage"),run:bs(t)}}a(kn,"createAgentWorkbenchActivityModel");function ks({value:e}){if(e===void 0)return null;let t=typeof e=="string"?e:JSON.stringify(e,null,2);return jsxRuntime.jsx("pre",{className:"max-h-48 max-w-full overflow-auto overscroll-contain whitespace-pre-wrap break-words rounded-md bg-muted p-3 font-mono text-xs text-foreground [overflow-wrap:anywhere]",tabIndex:0,children:t})}a(ks,"JsonValue");function An({approval:e,className:t,onDecision:n}){let o=L().agentWorkbench.approval,r=e.status==="requested",i=e.status==="approved";return jsxRuntime.jsx("article",{className:d("min-w-0 overflow-hidden rounded-lg border border-border bg-card p-3 text-card-foreground",t),"data-agent-approval-status":e.status,children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[r?jsxRuntime.jsx(lucideReact.Clock3,{className:"mt-0.5 size-4 shrink-0 text-warning-foreground","aria-hidden":"true"}):i?jsxRuntime.jsx(lucideReact.Check,{className:"mt-0.5 size-4 shrink-0 text-success","aria-hidden":"true"}):jsxRuntime.jsx(lucideReact.X,{className:"mt-0.5 size-4 shrink-0 text-destructive-text","aria-hidden":"true"}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("h3",{className:"break-words text-sm font-medium",children:e.title}),e.description?jsxRuntime.jsx("p",{tabIndex:0,className:"mt-1 max-h-32 overflow-auto whitespace-pre-wrap break-words text-sm text-muted-foreground [overflow-wrap:anywhere]",children:e.description}):null,e.requestedAction!==void 0?jsxRuntime.jsx("div",{className:"mt-3 min-w-0",children:jsxRuntime.jsx(ks,{value:e.requestedAction})}):null,r?jsxRuntime.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[jsxRuntime.jsx(W,{type:"button",size:"sm",className:"h-auto px-3 py-1.5 text-sm",disabled:!n,onClick:()=>n?.({approvalId:e.approvalId,approved:true}),children:o.approve}),jsxRuntime.jsx(W,{type:"button",variant:"outline",size:"sm",className:"h-auto px-3 py-1.5 text-sm",disabled:!n,onClick:()=>n?.({approvalId:e.approvalId,approved:false}),children:o.reject})]}):jsxRuntime.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:i?o.approved:o.rejected})]})]})})}a(An,"AgentWorkbenchApproval");function zo({value:e,className:t}){if(e===void 0)return null;let n=typeof e=="string"?e:JSON.stringify(e,null,2);return jsxRuntime.jsx("pre",{tabIndex:0,className:d("max-h-64 max-w-full overflow-auto overscroll-contain whitespace-pre-wrap break-words rounded-md bg-muted p-3 font-mono text-xs text-foreground [overflow-wrap:anywhere]",t),children:n})}a(zo,"JsonValue");function Ws({status:e}){L().agentWorkbench.tool.status;let n="size-3.5 shrink-0";return e==="pending"?jsxRuntime.jsx(lucideReact.Clock3,{className:n,"aria-hidden":"true"}):e==="running"?jsxRuntime.jsx(lucideReact.Loader2,{className:d(n,"animate-spin"),"aria-hidden":"true"}):e==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:d(n,"text-primary"),"aria-hidden":"true"}):jsxRuntime.jsx(lucideReact.XCircle,{className:d(n,"text-destructive-text"),"aria-hidden":"true"})}a(Ws,"ToolStatus");function Nn({event:e,expanded:t,defaultExpanded:n=e.payload.status==="failed",className:o,classNames:r,onExpandedChange:i}){let l=L().agentWorkbench.tool,[u,g]=ne.useState(n),p=t!==void 0,c=t??u,v=e.payload.status,x=a(k=>{p||g(k),i?.(k);},"setExpanded");return jsxRuntime.jsxs("details",{open:c,className:d("group min-w-0 overflow-hidden rounded-lg border border-border bg-card text-card-foreground",r?.root,o),"data-tool-status":v,children:[jsxRuntime.jsxs("summary",{className:d("flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 text-sm outline-hidden focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden",r?.trigger),onClick:k=>{k.preventDefault(),x(!c);},children:[jsxRuntime.jsx(lucideReact.TerminalSquare,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:e.payload.toolName}),jsxRuntime.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs text-foreground",children:[jsxRuntime.jsx(Ws,{status:v}),l.status[v]]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"size-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180","aria-hidden":"true"})]}),jsxRuntime.jsxs("div",{className:d("min-w-0 space-y-3 border-t border-border px-3 py-3 text-sm",r?.content),children:[e.payload.input!==void 0?jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:l.input}),jsxRuntime.jsx(zo,{value:e.payload.input,className:r?.input})]}):null,e.payload.output!==void 0?jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:l.output}),jsxRuntime.jsx(zo,{value:e.payload.output,className:r?.output})]}):null,e.payload.error?jsxRuntime.jsx("p",{tabIndex:0,className:"max-h-32 overflow-auto whitespace-pre-wrap break-words text-sm text-destructive-text [overflow-wrap:anywhere]",role:"alert",children:e.payload.error}):null]})]})}a(Nn,"AgentWorkbenchTool");function _s({artifact:e,label:t,onDownload:n}){let o=ne.useRef(false),[r,i]=ne.useState(false);return jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon","aria-label":t,title:t,disabled:r,className:"text-muted-foreground hover:text-foreground",onClick:async l=>{if(l.preventDefault(),l.stopPropagation(),!o.current){o.current=true,i(true);try{await n(e);}finally{o.current=false,i(false);}}},children:r?jsxRuntime.jsx(lucideReact.Loader2,{className:"size-4 animate-spin","aria-hidden":"true"}):jsxRuntime.jsx(lucideReact.Download,{className:"size-4","aria-hidden":"true"})})}a(_s,"ArtifactDownloadButton");function Sn({icon:e,title:t,open:n,streaming:o,className:r,triggerClassName:i,contentClassName:l,children:u}){return jsxRuntime.jsxs("details",{className:d("group min-w-0 overflow-hidden rounded-lg border border-border bg-card text-card-foreground",r),open:n,children:[jsxRuntime.jsxs("summary",{className:d("flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 text-sm font-medium outline-hidden focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden",i),children:[o?jsxRuntime.jsx(lucideReact.Loader2,{className:"size-4 shrink-0 animate-spin","aria-hidden":"true"}):jsxRuntime.jsx(e,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"size-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180","aria-hidden":"true"})]}),jsxRuntime.jsx("div",{className:d("min-w-0 border-t border-border px-3 py-3 text-sm",l),children:u})]})}a(Sn,"ActivityDetails");function Oo({status:e}){return e==="completed"||e==="passed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"size-4 text-success","aria-hidden":"true"}):e==="failed"?jsxRuntime.jsx(lucideReact.XCircle,{className:"size-4 text-destructive-text","aria-hidden":"true"}):e==="running"?jsxRuntime.jsx(lucideReact.Clock3,{className:"size-4 animate-pulse text-warning-foreground","aria-hidden":"true"}):jsxRuntime.jsx(lucideReact.Circle,{className:"size-4 text-muted-foreground","aria-hidden":"true"})}a(Oo,"StatusIcon");function Vs(e){if(e<1e3)return "<1s";let t=Math.floor(e/1e3),n=Math.floor(t/60),o=t%60;return n>0?`${n}m ${o}s`:`${o}s`}a(Vs,"formatDuration");function Us({event:e}){let t=L().agentWorkbench,n=e.payload.status;return n!=="stopping"&&n!=="stopped"?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",role:"status",children:[n==="stopping"?jsxRuntime.jsx(lucideReact.Loader2,{className:"size-4 animate-spin","aria-hidden":"true"}):jsxRuntime.jsx(lucideReact.CircleStop,{className:"size-4","aria-hidden":"true"}),jsxRuntime.jsx("span",{children:n==="stopping"?t.run.stopping:t.run.stoppedAfter({duration:Vs(e.payload.durationMs??e.resolvedDurationMs??0)})})]})}a(Us,"RunStatus");function Rn({viewModel:e,ariaLabel:t,hiddenToolCallIds:n,hideReasoning:o=false,hideStoppedRun:r=false,className:i,classNames:l,onApprovalDecision:u,onArtifactOpen:g,onArtifactDownload:p}){let c=L().agentWorkbench;if(!e)return null;let v=kn(e),x=o?[]:v.reasoning,k=v.tools.filter(s=>!n?.has(s.payload.toolCallId)),m=v.approvals.filter(s=>!s.payload.toolCallId||!n?.has(s.payload.toolCallId)),A=v.usage?.payload,P=typeof A?.contextWindow=="number"&&A.contextWindow>0?A.contextWindow:void 0,E=v.run?.payload.status==="stopping"||v.run?.payload.status==="stopped"&&!r;return x.length>0||v.plans.length>0||v.tasks.length>0||k.length>0||m.length>0||v.artifacts.length>0||E||P!==void 0?jsxRuntime.jsxs("section",{className:d("space-y-3",l?.root,i),"aria-label":t??c.label,"data-agent-workbench-mode":v.mode,"data-agent-workbench-status":v.status,children:[x.map(s=>jsxRuntime.jsx(Sn,{icon:lucideReact.Circle,title:c.reasoning,open:s.payload.status==="streaming",streaming:s.payload.status==="streaming",className:l?.item,triggerClassName:l?.trigger,contentClassName:l?.content,children:jsxRuntime.jsx("div",{tabIndex:0,className:"max-h-64 overflow-auto whitespace-pre-wrap break-words text-muted-foreground [overflow-wrap:anywhere]",children:s.payload.text})},s.payload.reasoningId)),v.plans.map(s=>jsxRuntime.jsx(Sn,{icon:lucideReact.Circle,title:s.payload.title||c.plan,open:s.payload.status==="running",streaming:s.payload.status==="running",className:l?.item,triggerClassName:l?.trigger,contentClassName:l?.content,children:jsxRuntime.jsx("ol",{className:"space-y-2",children:s.payload.steps.map(y=>jsxRuntime.jsxs("li",{className:"flex min-w-0 items-start gap-2",children:[jsxRuntime.jsx(Oo,{status:y.status}),jsxRuntime.jsx("span",{className:"min-w-0 break-words [overflow-wrap:anywhere]",children:y.title})]},y.id))})},s.payload.planId)),v.tasks.map(s=>jsxRuntime.jsx(Sn,{icon:lucideReact.Circle,title:s.payload.title,open:s.payload.status==="running",streaming:s.payload.status==="running",className:l?.item,triggerClassName:l?.trigger,contentClassName:l?.content,children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[jsxRuntime.jsx(Oo,{status:s.payload.status}),jsxRuntime.jsx("span",{className:"min-w-0 whitespace-pre-wrap break-words text-muted-foreground [overflow-wrap:anywhere]",children:s.payload.detail||c.taskNoDetail})]})},s.payload.taskId)),k.map(s=>jsxRuntime.jsx(Nn,{event:s,defaultExpanded:s.payload.status==="failed",classNames:{root:l?.item,trigger:l?.trigger,content:l?.content}},s.payload.toolCallId)),m.map(s=>jsxRuntime.jsx(An,{approval:s.payload,className:l?.approval,onDecision:u},s.payload.approvalId)),v.artifacts.map(s=>{let y=!!(s.payload.url&&g);return jsxRuntime.jsxs("article",{className:d("flex items-center gap-3 rounded-lg border border-border bg-card p-3 text-card-foreground",l?.artifact),children:[jsxRuntime.jsx(lucideReact.FileOutput,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:"truncate text-sm font-medium",children:s.payload.name}),jsxRuntime.jsx("div",{className:"text-xs text-muted-foreground",children:c.artifact[s.payload.status]})]}),s.payload.url?jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-foreground","aria-label":c.artifact.open({name:s.payload.name}),title:c.artifact.open({name:s.payload.name}),disabled:!y,onClick:C=>{C.preventDefault(),C.stopPropagation(),s.payload.url&&g?.({artifactId:s.payload.artifactId,name:s.payload.name,url:s.payload.url});},children:jsxRuntime.jsx(lucideReact.PanelRightOpen,{className:"size-4","aria-hidden":"true"})}):null,s.payload.url&&s.payload.status==="ready"&&p?jsxRuntime.jsx(_s,{artifact:{artifactId:s.payload.artifactId,name:s.payload.name,url:s.payload.url},label:c.artifactWorkspace.download({name:s.payload.name}),onDownload:p}):null]},s.payload.artifactId)}),E&&v.run?jsxRuntime.jsx(Us,{event:v.run}):null,A&&P!==void 0?jsxRuntime.jsx("div",{className:d("flex justify-end",l?.usage),"aria-label":c.usage.label,children:jsxRuntime.jsx("span",{className:"rounded-full border border-border bg-muted px-2.5 py-1 text-xs text-foreground",children:c.usage.context({used:A.contextTokens??A.totalTokens??0,total:P})})}):null]}):null}a(Rn,"AgentWorkbenchActivity");var qs={diff:"diff","workspace-file":"workspaceFiles",terminal:"terminal","test-result":"testResults",artifact:"artifacts"};function qt(e,t,n){let o=new Map;for(let r of e){if(r.eventType!==t)continue;let i=r;o.set(n(i),i);}return [...o.values()].sort((r,i)=>r.sequence-i.sequence)}a(qt,"latestBy");function Fs(e){let t=new Map;for(let n of e){let o=t.get(n.payload.terminalId)??{terminalId:n.payload.terminalId,stdin:"",stdout:"",stderr:"",status:"",sequence:n.sequence},r=n.payload.stream;t.set(n.payload.terminalId,{...o,...r==="status"?{status:n.payload.chunk}:{[r]:`${o[r]}${n.payload.chunk}`},...n.payload.exitCode===void 0?{}:{exitCode:n.payload.exitCode},sequence:n.sequence});}return [...t.values()].sort((n,o)=>n.sequence-o.sequence)}a(Fs,"projectTerminals");function Tn(e){let t=e.snapshot.capabilities,n=e.events.filter(l=>{let u=qs[l.eventType];return u?t[u]===true:false}),o=[...e.events].reverse().find(l=>l.eventType==="status"),r=o?.runId,i=[...e.events].reverse().find(l=>l.eventType==="summary"&&t.summary===true&&(!r||l.runId===r));return {mode:e.snapshot.mode,modelId:e.snapshot.modelId,permissionProfile:e.snapshot.permissionProfile,status:e.status,sessionId:e.sessionId,capabilities:t,resumable:t.resume===true&&e.resumable,summary:i,error:[...e.events].reverse().find(l=>l.eventType==="error"),run:o,usage:t.usage?[...e.events].reverse().find(l=>l.eventType==="usage"):void 0,workspace:{diffs:qt(n,"diff",l=>l.payload.path),files:qt(n,"workspace-file",l=>l.payload.path),terminals:Fs(n.filter(l=>l.eventType==="terminal")),tests:qt(n,"test-result",l=>l.payload.testId),artifacts:qt(n,"artifact",l=>l.payload.artifactId)}}}a(Tn,"createAgentWorkbenchDetailsModel");function Ho(e){if(e===void 0)return "-";let t=Math.max(0,Math.round(e/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}a(Ho,"formatDuration");function li(e,t){if(!e)return "-";let n=new Date(e);return Number.isNaN(n.getTime())?"-":new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"short"}).format(n)}a(li,"formatDate");function _o({value:e}){return jsxRuntime.jsx("span",{className:"rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-semibold text-foreground",children:e})}a(_o,"Count");function gt({title:e,count:t,icon:n,className:o,children:r}){return t===0?null:jsxRuntime.jsxs("details",{className:d("group rounded-lg border border-border bg-card text-card-foreground",o),open:true,children:[jsxRuntime.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 text-sm font-medium outline-hidden focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden",children:[jsxRuntime.jsx(n,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:"min-w-0 flex-1 truncate",children:e}),jsxRuntime.jsx(_o,{value:t}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"size-4 text-muted-foreground transition-transform group-open:rotate-180","aria-hidden":"true"})]}),jsxRuntime.jsx("div",{className:"border-t border-border p-3",children:r})]})}a(gt,"DetailsSection");function Vo({status:e}){return e==="completed"||e==="passed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"size-4 text-primary","aria-hidden":"true"}):e==="failed"?jsxRuntime.jsx(lucideReact.XCircle,{className:"size-4 text-destructive-text","aria-hidden":"true"}):e==="running"?jsxRuntime.jsx(lucideReact.Clock3,{className:"size-4 animate-pulse","aria-hidden":"true"}):jsxRuntime.jsx(lucideReact.Circle,{className:"size-4 text-muted-foreground","aria-hidden":"true"})}a(Vo,"StatusIcon");function Bo({state:e}){let t=L().agentWorkbench.details,n=e==="error";return jsxRuntime.jsxs("div",{className:"flex min-h-48 flex-col items-center justify-center gap-2 px-6 text-center",role:n?"alert":e==="loading"?"status":void 0,"aria-busy":e==="loading"||void 0,children:[e==="loading"?jsxRuntime.jsx(lucideReact.RefreshCw,{className:"size-5 animate-spin text-muted-foreground","aria-hidden":"true"}):n?jsxRuntime.jsx(lucideReact.AlertCircle,{className:"size-5 text-destructive-text","aria-hidden":"true"}):jsxRuntime.jsx(lucideReact.FileOutput,{className:"size-5 text-muted-foreground","aria-hidden":"true"}),jsxRuntime.jsx("div",{className:"text-sm font-medium",children:t.state[e].title}),jsxRuntime.jsx("div",{className:"text-xs text-muted-foreground",children:t.state[e].description})]})}a(Bo,"StateContent");function di({model:e,onIntent:t}){let n=L().agentWorkbench,o=n.details,r=dt().locale,i=e.summary,l=e.run?.payload,u=e.error,g=e.status==="failed"&&u?.payload.retryable,p=e.resumable&&["stopped","completed","failed"].includes(e.status),c=e.capabilities.threadForking,v=e.capabilities.editAndRerun,x=e.usage?.payload.totalTokens??(e.usage?.payload.inputTokens!==void 0||e.usage?.payload.outputTokens!==void 0?(e.usage.payload.inputTokens??0)+(e.usage.payload.outputTokens??0):void 0);return jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("section",{className:"rounded-lg border border-border bg-muted/40 p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Vo,{status:e.status}),jsxRuntime.jsx("span",{className:"text-sm font-semibold",children:o.status[e.status]})]}),jsxRuntime.jsxs("dl",{className:"mt-3 grid grid-cols-2 gap-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("dt",{className:"text-muted-foreground",children:o.duration}),jsxRuntime.jsx("dd",{className:"mt-0.5 font-medium",children:Ho(l?.durationMs)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("dt",{className:"text-muted-foreground",children:o.updated}),jsxRuntime.jsx("dd",{className:"mt-0.5 truncate font-medium",children:li(l?.stoppedAt??l?.completedAt??l?.failedAt,r)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("dt",{className:"text-muted-foreground",children:o.model}),jsxRuntime.jsx("dd",{className:"mt-0.5 truncate font-medium",children:e.modelId})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("dt",{className:"text-muted-foreground",children:o.mode}),jsxRuntime.jsx("dd",{className:"mt-0.5 font-medium",children:n.modes[e.mode]})]}),e.permissionProfile?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("dt",{className:"text-muted-foreground",children:o.permissions}),jsxRuntime.jsx("dd",{className:"mt-0.5 font-medium",children:n.composer.permissionOptions[e.permissionProfile]})]}):null,x!==void 0?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("dt",{className:"text-muted-foreground",children:o.tokenUsage}),jsxRuntime.jsx("dd",{className:"mt-0.5 font-medium",children:new Intl.NumberFormat(r).format(x)})]}):null]}),u?jsxRuntime.jsx("div",{className:"mt-3 rounded-md border border-destructive/30 bg-destructive/5 p-2.5 text-sm text-destructive-text",role:"alert",children:u.payload.message}):null,g||p?jsxRuntime.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[g?jsxRuntime.jsx(W,{type:"button",variant:"outline",size:"sm",className:"h-auto px-2.5 py-1.5 text-xs",disabled:!t,onClick:()=>t?.({type:"retry",eventId:u.eventId}),children:o.actions.retry}):null,p?jsxRuntime.jsx(W,{type:"button",size:"sm",className:"h-auto px-2.5 py-1.5 text-xs",disabled:!t,onClick:()=>t?.({type:"resume",sessionId:e.sessionId}),children:o.actions.resume}):null]}):null]}),jsxRuntime.jsxs("section",{className:"flex flex-wrap gap-2 rounded-lg border border-border bg-card p-3 text-card-foreground",children:[c?jsxRuntime.jsxs(W,{type:"button",variant:"outline",size:"sm",className:"h-auto gap-1.5 px-2.5 py-1.5 text-xs",disabled:!t,onClick:()=>t?.({type:"continue-in-new-task",sessionId:e.sessionId}),children:[jsxRuntime.jsx(lucideReact.GitFork,{className:"size-3.5","aria-hidden":"true"}),o.actions.continueInNewTask]}):null,v?jsxRuntime.jsxs(W,{type:"button",variant:"outline",size:"sm",className:"h-auto gap-1.5 px-2.5 py-1.5 text-xs",disabled:!t,onClick:()=>t?.({type:"edit-and-rerun",sessionId:e.sessionId}),children:[jsxRuntime.jsx(lucideReact.PencilLine,{className:"size-3.5","aria-hidden":"true"}),o.actions.editAndRerun]}):null,jsxRuntime.jsxs(W,{type:"button",variant:"outline",size:"sm",className:"h-auto gap-1.5 px-2.5 py-1.5 text-xs",disabled:!t,onClick:()=>t?.({type:"export",sessionId:e.sessionId}),children:[jsxRuntime.jsx(lucideReact.Download,{className:"size-3.5","aria-hidden":"true"}),o.actions.export]})]}),jsxRuntime.jsxs("section",{className:"rounded-lg border border-border bg-card p-3 text-card-foreground",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold",children:o.summary}),i?.payload.text?jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:"size-8 text-muted-foreground hover:text-foreground","aria-label":o.actions.copySummary,disabled:!t,onClick:()=>t?.({type:"copy-summary",summaryId:i.payload.summaryId,text:i.payload.text}),children:jsxRuntime.jsx(lucideReact.Copy,{className:"size-4","aria-hidden":"true"})}):null]}),i?.payload.status==="failed"?jsxRuntime.jsxs("div",{className:"mt-3 space-y-2",children:[jsxRuntime.jsx("p",{className:"text-sm text-destructive-text",role:"alert",children:o.summaryFailed}),jsxRuntime.jsxs(W,{type:"button",variant:"outline",size:"sm",className:"h-auto gap-1.5 px-2.5 py-1.5 text-xs",disabled:!t,onClick:()=>t?.({type:"retry-summary",eventId:i.eventId}),children:[jsxRuntime.jsx(lucideReact.RotateCcw,{className:"size-3.5","aria-hidden":"true"}),o.actions.retrySummary]})]}):i?.payload.text?jsxRuntime.jsxs("div",{className:"mt-3 space-y-3 text-sm",children:[jsxRuntime.jsx("p",{className:"whitespace-pre-wrap text-muted-foreground",children:i.payload.text}),i.payload.highlights.length>0?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h4",{className:"text-xs font-medium",children:o.highlights}),jsxRuntime.jsx("ul",{className:"mt-1 list-disc space-y-1 pl-5 text-muted-foreground",children:i.payload.highlights.map(k=>jsxRuntime.jsx("li",{children:k},k))})]}):null,i.payload.pendingItems.length>0?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h4",{className:"text-xs font-medium",children:o.pendingItems}),jsxRuntime.jsx("ul",{className:"mt-1 list-disc space-y-1 pl-5 text-muted-foreground",children:i.payload.pendingItems.map(k=>jsxRuntime.jsx("li",{children:k},k))})]}):null]}):jsxRuntime.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:o.summaryEmpty})]})]})}a(di,"SummaryPanel");function ci({model:e,sectionClassName:t,codeClassName:n}){let o=L().agentWorkbench.details.workspace,r=e.workspace;return jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx(gt,{title:o.diffs,count:r.diffs.length,icon:lucideReact.FileCode2,className:t,children:jsxRuntime.jsx("div",{className:"space-y-3",children:r.diffs.map(i=>jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[jsxRuntime.jsx("span",{className:"truncate font-medium",children:i.payload.path}),jsxRuntime.jsx("span",{className:"shrink-0 text-muted-foreground",children:o.diffStatus[i.payload.status]})]}),i.payload.patch?jsxRuntime.jsx("pre",{className:d("mt-2 max-h-72 overflow-auto whitespace-pre-wrap rounded-md bg-muted p-3 font-mono text-xs",n),children:i.payload.patch}):null]},i.payload.path))})}),jsxRuntime.jsx(gt,{title:o.files,count:r.files.length,icon:lucideReact.Files,className:t,children:jsxRuntime.jsx("ul",{className:"space-y-2 text-xs",children:r.files.map(i=>jsxRuntime.jsxs("li",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.FileOutput,{className:"size-3.5 text-muted-foreground","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:"min-w-0 flex-1 truncate",children:i.payload.path}),jsxRuntime.jsx("span",{className:"text-muted-foreground",children:o.fileOperation[i.payload.operation]})]},i.payload.path))})}),jsxRuntime.jsx(gt,{title:o.terminals,count:r.terminals.length,icon:lucideReact.TerminalSquare,className:t,children:jsxRuntime.jsx("div",{className:"space-y-3",children:r.terminals.map(i=>jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex justify-between gap-2 text-xs font-medium",children:[jsxRuntime.jsx("span",{children:i.terminalId}),jsxRuntime.jsx("span",{className:"text-muted-foreground",children:i.exitCode===void 0?i.status:o.exitCode({code:i.exitCode})})]}),jsxRuntime.jsx("pre",{className:d("mt-2 max-h-72 overflow-auto whitespace-pre-wrap rounded-md bg-muted p-3 font-mono text-xs",n),children:[i.stdin,i.stdout,i.stderr].filter(Boolean).join(`
|
|
56
|
+
var lr=Object.defineProperty;var a=(e,t)=>lr(e,"name",{value:t,configurable:true});var Qt={locale:"en-US",messages:{pagination:{navigation:"Pagination",first:"First",previous:"Previous",next:"Next",last:"Last",page:a(({page:e,pageCount:t})=>`Page ${e} of ${t}`,"page"),currentPage:a(({page:e,pageCount:t})=>`Page ${e} of ${t}, current page`,"currentPage"),emptyResults:"0 results",range:a(({start:e,end:t,total:n})=>`${e}-${t} of ${n}`,"range"),selected:a(({count:e})=>`${e} selected`,"selected"),pageSize:"Items per page",loadBatchSize:"Items per load",perLoad:"Items per load",jumpToPage:"Jump to page",pages:"pages",clickToJump:"Click to jump to a page"},dialog:{close:"Close dialog"},dropdownMenu:{actions:"Actions"},loading:{spinner:"Loading"},layout:{resizePanels:"Resize panels",expandPanel:"Expand",collapsePanel:"Collapse",movePanel:"Move",moveBefore:"Move earlier",moveAfter:"Move later"},steps:{label:"Progress",current:"Current",completed:"Completed",error:"Error",disabled:"Disabled"},numberInput:{increment:"Increase value",decrement:"Decrease value"},passwordInput:{showPassword:"Show password",hidePassword:"Hide password"},multiSelect:{placeholder:"Select options",empty:"No options",removeOption:a(({value:e})=>`Remove ${e}`,"removeOption")},table:{dragColumn:a(({columnId:e})=>`Drag column ${e}`,"dragColumn"),resizeColumn:a(({columnId:e})=>`Resize column ${e}`,"resizeColumn"),sortColumn:a(({columnId:e})=>e?`Sort column ${e}`:"Sort column","sortColumn"),loadingRow:"Loading table row"},toolbar:{theme:{label:"Appearance",toggle:"Toggle theme",auto:"Auto",light:"Light",dark:"Dark"},language:{label:"Language",switch:"Switch language"}},toast:{errorTitle:"Error",warningTitle:"Warning",defaultErrorDescription:"Something went wrong.",defaultWarningDescription:"Please check and try again."},dataExplorer:{viewTree:{actions:"More actions",expand:"Expand",collapse:"Collapse",loading:"Loading...",empty:"No views",error:"Unable to load views"}},workbench:{relationshipGraph:{zoomOut:"Zoom out",zoomIn:"Zoom in",zoomToFit:"Fit graph",minimap:"Graph overview"},collection:{label:"Collection",loading:"Loading items",empty:"No items",loadError:"Unable to load items",refreshError:"Unable to refresh items",retry:"Retry",loadingMore:"Loading more items",permission:"You do not have permission to view this content",offline:"You appear to be offline",requestAccess:"Request access"},interactiveTable:{columnActions:"Column actions",freezeColumn:"Freeze to left",freezeEndColumn:"Freeze to right",unfreezeColumn:"Unfreeze from left",unfreezeEndColumn:"Unfreeze from right",unfreezeAllColumns:"Unfreeze all columns",resetColumnWidth:"Reset column width",frozenColumnTitle:"Frozen column"}},agentWorkbench:{label:"Session activity",reasoning:"Reasoning",plan:"Plan",taskNoDetail:"No additional details",modes:{chat:"Chat",work:"Work"},composer:{send:"Send message",stop:"Stop generating",queue:"Queue message",attach:"Add photos or files",voice:"Start voice input",webSearch:"Web search",chatMode:"Chat mode",model:"Model",reasoning:"Reasoning effort",permissions:"Permissions",removeAttachment:"Remove attachment",editQueued:"Edit queued message",deleteQueued:"Delete queued message",moveUp:"Move message up",moveDown:"Move message down",queued:"Queued messages",uploading:"Uploading",uploadFailed:"Upload failed",retryAttachment:"Retry attachment upload",noModels:"No models available",message:"Message",attachmentOnly:"Attachment",reasoningOptions:{low:"Low",medium:"Medium",high:"High",xhigh:"Extra high"},permissionOptions:{"approval-required":"Approval required","auto-approve":"Auto approve","full-access":"Full access"}},quickStart:{label:"Quick start",back:"Back",addFile:"Add file"},tool:{input:"Input",output:"Output",status:{pending:"Pending",running:"Running",completed:"Completed",failed:"Error",denied:"Denied"}},approval:{approve:"Approve",reject:"Reject",approved:"Approved",rejected:"Rejected"},artifact:{pending:"Preparing",ready:"Ready",failed:"Failed",open:a(({name:e})=>`Open ${e}`,"open")},run:{stopping:"Stopping...",stoppedAfter:a(({duration:e})=>`You stopped after ${e}`,"stoppedAfter")},process:{running:"Working",queued:"Queued",waitingApproval:"Waiting for approval",failed:"Failed",stopped:"Stopped",processed:"Processed",processedFor:a(({duration:e})=>`Worked for ${e}`,"processedFor"),completedCount:a(({completed:e,total:t})=>`${e}/${t} completed`,"completedCount")},artifactWorkspace:{outputs:"Outputs",sources:"Sources",viewAll:"View all",toggleSummary:"Toggle files",tabs:"Open files",closeTab:a(({name:e})=>`Close ${e}`,"closeTab"),closeWorkspace:"Close workspace",download:a(({name:e})=>`Download ${e}`,"download"),openExternal:a(({name:e})=>`Open ${e} in a new window`,"openExternal"),loading:"Loading preview...",failed:"Preview unavailable",retry:"Try again"},usage:{label:"Context usage",context:a(({used:e,total:t})=>`${e} / ${t} tokens`,"context")},navigation:{search:"Search agents and sessions",searchSessions:"Search sessions",searchShortcut:"Focus search",clearSearch:"Clear search",tabsLabel:"Agent workbench navigation",agents:"Agents",sessions:"Sessions",newAgent:"New Agent",newSession:"New Session",capabilities:"Capabilities & Extensions",settings:"Agent Settings",allAgents:"All Agents",recentSessions:"Recent Sessions",chat:"Chat",work:"Work",chats:"Chats",builtIn:"Built-in",noDescription:"No description",loading:"Loading...",emptyAgents:"No agents yet",emptySessions:"No sessions yet",noResults:"No matching results",retry:"Retry",pin:"Pin",unpin:"Unpin",rename:"Rename",delete:"Delete",actions:"Actions",save:"Save",cancel:"Cancel",running:"Running",completed:"Completed",failed:"Failed",contextUsage:a(({percent:e})=>`${e}% context used`,"contextUsage")},details:{title:"Task details",description:"Summary and workspace activity",duration:"Duration",updated:"Updated",model:"Model",mode:"Mode",permissions:"Permissions",tokenUsage:"Token usage",summary:"Summary",summaryEmpty:"No summary is available yet.",summaryFailed:"The summary could not be generated.",highlights:"Highlights",pendingItems:"Pending items",tabs:{label:"Task detail views",summary:"Summary",workspace:"Workspace"},status:{queued:"Queued",running:"Running",waiting_approval:"Waiting for approval",stopping:"Stopping",stopped:"Stopped",completed:"Completed",failed:"Failed"},state:{loading:{title:"Loading task details",description:"Restoring the latest session activity."},empty:{title:"No task selected",description:"Select a task to inspect its details."},error:{title:"Unable to load task details",description:"Try again after the session is available."}},actions:{close:"Close task details",copySummary:"Copy summary",retry:"Retry",retrySummary:"Retry summary",resume:"Resume",continueInNewTask:"Continue in new task",editAndRerun:"Edit and rerun",export:"Export"},workspace:{diffs:"Code changes",files:"Files",terminals:"Terminals",tests:"Tests",artifacts:"Artifacts",exitCode:a(({code:e})=>`Exit code ${e}`,"exitCode"),diffStatus:{added:"Added",modified:"Modified",deleted:"Deleted",renamed:"Renamed"},fileOperation:{upsert:"Updated",delete:"Deleted"}}}}}};function eo(e,t){return t?{pagination:{...e.pagination,...t.pagination},dialog:{...e.dialog,...t.dialog},dropdownMenu:{...e.dropdownMenu,...t.dropdownMenu},loading:{...e.loading,...t.loading},layout:{...e.layout,...t.layout},steps:{...e.steps,...t.steps},numberInput:{...e.numberInput,...t.numberInput},passwordInput:{...e.passwordInput,...t.passwordInput},multiSelect:{...e.multiSelect,...t.multiSelect},table:{...e.table,...t.table},toolbar:{theme:{...e.toolbar.theme,...t.toolbar?.theme},language:{...e.toolbar.language,...t.toolbar?.language}},toast:{...e.toast,...t.toast},dataExplorer:{viewTree:{...e.dataExplorer.viewTree,...t.dataExplorer?.viewTree}},workbench:{relationshipGraph:{zoomOut:"Zoom out",zoomIn:"Zoom in",zoomToFit:"Fit graph",minimap:"Graph overview",...e.workbench.relationshipGraph,...t.workbench?.relationshipGraph},collection:{...e.workbench.collection,...t.workbench?.collection},interactiveTable:{...e.workbench.interactiveTable,...t.workbench?.interactiveTable}},agentWorkbench:{...e.agentWorkbench,...t.agentWorkbench,modes:{...e.agentWorkbench.modes,...t.agentWorkbench?.modes},composer:{...e.agentWorkbench.composer,...t.agentWorkbench?.composer},quickStart:{...e.agentWorkbench.quickStart,...t.agentWorkbench?.quickStart},tool:{...e.agentWorkbench.tool,...t.agentWorkbench?.tool,status:{...e.agentWorkbench.tool.status,...t.agentWorkbench?.tool?.status}},approval:{...e.agentWorkbench.approval,...t.agentWorkbench?.approval},artifact:{...e.agentWorkbench.artifact,...t.agentWorkbench?.artifact},run:{...e.agentWorkbench.run,...t.agentWorkbench?.run},process:{...e.agentWorkbench.process,...t.agentWorkbench?.process},artifactWorkspace:{...e.agentWorkbench.artifactWorkspace,...t.agentWorkbench?.artifactWorkspace},usage:{...e.agentWorkbench.usage,...t.agentWorkbench?.usage},navigation:{...e.agentWorkbench.navigation,...t.agentWorkbench?.navigation},details:{...e.agentWorkbench.details,...t.agentWorkbench?.details,tabs:{...e.agentWorkbench.details.tabs,...t.agentWorkbench?.details?.tabs},status:{...e.agentWorkbench.details.status,...t.agentWorkbench?.details?.status},state:{loading:{...e.agentWorkbench.details.state.loading,...t.agentWorkbench?.details?.state?.loading},empty:{...e.agentWorkbench.details.state.empty,...t.agentWorkbench?.details?.state?.empty},error:{...e.agentWorkbench.details.state.error,...t.agentWorkbench?.details?.state?.error}},actions:{...e.agentWorkbench.details.actions,...t.agentWorkbench?.details?.actions},workspace:{...e.agentWorkbench.details.workspace,...t.agentWorkbench?.details?.workspace,diffStatus:{...e.agentWorkbench.details.workspace.diffStatus,...t.agentWorkbench?.details?.workspace?.diffStatus},fileOperation:{...e.agentWorkbench.details.workspace.fileOperation,...t.agentWorkbench?.details?.workspace?.fileOperation}}}}}:e}a(eo,"mergeMonkeysLocaleMessages");var it={locale:Qt.locale,messages:eo(Qt.messages)};var cr=Object.freeze({}),pr=Object.freeze({}),to=Symbol.for("@inf-monkeys-tech/monkeys-design/provider-context@1");function ur(){return Object.freeze({locale:ne.createContext({...it,provided:false}),theme:ne.createContext({provided:false}),direction:ne.createContext({provided:false}),environment:ne.createContext({provided:false,environment:cr,portal:pr})})}a(ur,"createMonkeysProviderContexts");function mr(){let e=globalThis,t=e[to];if(t)return t;let n=ur();return Object.defineProperty(e,to,{value:n,enumerable:false,configurable:false,writable:false}),n}a(mr,"getMonkeysProviderContexts");var Wt=mr(),Yt=Wt.locale,gr=Wt.theme,fr=Wt.direction;Wt.environment;function dt(){try{return ne.useContext(Yt)??{...it,provided:!1}}catch{return {...it,provided:false}}}a(dt,"useMonkeysLocale");function L(){return ne.useContext(Yt).messages}a(L,"useMonkeysLocaleMessages");function Ae(){let e=ne.useContext(Yt),t=ne.useContext(gr),n=ne.useContext(fr),o=e.provided||t.provided||n.provided;return ne.useMemo(()=>o?{dir:n.direction,"data-monkeys-direction":n.direction,"data-monkeys-locale":e.locale,"data-monkeys-theme":t.themeId,"data-monkeys-theme-mode":t.resolvedTheme?.colorMode}:{},[n.direction,e.locale,o,t.resolvedTheme?.colorMode,t.themeId])}a(Ae,"useMonkeysComponentAttributes");function R(...e){return tailwindMerge.twMerge(e.filter(Boolean).join(" "))}a(R,"cn");var no=Symbol.for("@inf-monkeys-tech/monkeys-design/bento-depth@1"),oo=globalThis,ro=oo[no]??(oo[no]=ne.createContext(0));function Xt(){return ne.useContext(ro)}a(Xt,"useBentoDepth");function yr({children:e,depth:t}){return jsxRuntime.jsx(ro.Provider,{value:t,children:e})}a(yr,"BentoDepthProvider");function ao({children:e}){return jsxRuntime.jsx(yr,{depth:0,children:e})}a(ao,"BentoScope");var xr={menu:"monkeys-overlay-surface--menu bg-menu-surface text-popover-foreground",dialog:"monkeys-overlay-surface--dialog bg-dialog-surface text-foreground"};function Ye(e,t={}){return ["monkeys-overlay-surface",xr[e],t.rounded===false?void 0:"monkeys-overlay-surface--rounded"].filter(Boolean).join(" ")}a(Ye,"getOverlaySurfaceClassName");function d(...e){return e.filter(Boolean).join(" ")}a(d,"cn");var Nr={variant:"default",density:"default"},Jt=ne.createContext(Nr);function Zt(e,t={}){return {variant:t.variant??e.variant,density:t.density??(t.variant==="trend"?"compact":e.density)}}a(Zt,"resolveAgentWorkbenchAppearance");function fe(e={}){return Zt(ne.useContext(Jt),e)}a(fe,"useAgentWorkbenchAppearance");function Sr({children:e,variant:t,density:n}){let o=ne.useContext(Jt),r=ne.useMemo(()=>Zt(o,{variant:t,density:n}),[n,o,t]);return jsxRuntime.jsx(Jt.Provider,{value:r,children:e})}a(Sr,"AgentWorkbenchAppearanceProvider");var Cr={page:"bg-background text-foreground",panel:"bg-card text-card-foreground",elevated:"border border-border bg-popover text-popover-foreground shadow-sm",subtle:"bg-muted/40 text-foreground",overlay:"border border-border bg-popover text-popover-foreground shadow-lg"},Rr=ne.forwardRef(a(function({level:t="panel",variant:n,density:o,className:r,children:i,...l},u){let g=fe({variant:n,density:o});return jsxRuntime.jsx("div",{...l,ref:u,"data-agent-workbench-surface":t,"data-agent-workbench-variant":g.variant,"data-agent-workbench-density":g.density,className:d(Cr[t],r),children:i})},"AgentWorkbenchSurface"));var Wr=a(({textAreaRef:e,triggerAutoSize:t,maxHeight:n=Number.MAX_SAFE_INTEGER,minHeight:o=0})=>{let[r,i]=ne__namespace.useState(true);ne__namespace.useEffect(()=>{if(e){r&&(e.style.minHeight=`${o+2}px`,n>o&&(e.style.maxHeight=`${n}px`),i(false)),e.style.height=`${o+2}px`;let u=e.scrollHeight;u>n?e.style.height=`${n}px`:e.style.height=`${u+2}px`;}},[e,t]);},"useAutosizeTextArea"),en=ne__namespace.forwardRef(({maxHeight:e=Number.MAX_SAFE_INTEGER,minHeight:t=52,className:n,onChange:o,value:r,onKeyDown:i,onSubmit:l,onCompositionStart:u,onCompositionEnd:g,...p},c)=>{let v=ne__namespace.useRef(null),[x,k]=ne__namespace.useState(""),[m,A]=ne__namespace.useState(false),[P,E]=ne__namespace.useState("");Wr({textAreaRef:v.current,triggerAutoSize:x,maxHeight:e,minHeight:t}),ne.useImperativeHandle(c,()=>({textArea:v.current,focus:a(()=>v.current?.focus(),"focus"),maxHeight:e,minHeight:t})),ne__namespace.useEffect(()=>{k(r);},[p?.defaultValue,r]);let b=ne__namespace.useCallback(s=>{if(s.key==="ArrowUp"&&x.length<=0&&!(s.metaKey||s.altKey||s.ctrlKey)){s.preventDefault();return}l&&s.key==="Enter"&&s.keyCode!==229&&!s.nativeEvent.isComposing&&!m&&!s.altKey&&!s.ctrlKey&&!s.shiftKey&&!s.metaKey&&(s.preventDefault(),l(s)),i?.(s);},[m,i,l,x.length]);return jsxRuntime.jsx("textarea",{...p,onKeyDown:b,value:typeof r<"u"?m?P:r??"":void 0,ref:v,className:R("flex w-full resize-y rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),onCompositionStart:s=>{A(true),E(s.currentTarget.value),u?.(s);},onCompositionEnd:s=>{A(false);let y=s.currentTarget.value;E(y),k(y),o?.(s),g?.(s);},onChange:s=>{if(s.nativeEvent.isComposing){E(s.target.value),k(s.target.value);return}k(s.target.value),o?.(s);}})});en.displayName="AutosizeTextarea";var Dr=ne__namespace.forwardRef(({className:e,style:t,...n},o)=>jsxRuntime.jsx(We__namespace.Item,{ref:o,className:R("border-b",e),style:{borderColor:"var(--monkeys-component-accordion-item-border-color, hsl(var(--border)))",...t},...n}));Dr.displayName="AccordionItem";var zr=ne__namespace.forwardRef(({className:e,children:t,...n},o)=>jsxRuntime.jsx(We__namespace.Header,{className:"flex",children:jsxRuntime.jsxs(We__namespace.Trigger,{ref:o,className:R("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,jsxRuntime.jsx(lucideReact.ChevronDown,{"aria-hidden":"true",className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));zr.displayName="AccordionTrigger";var Or=ne__namespace.forwardRef(({className:e,children:t,...n},o)=>jsxRuntime.jsx(We__namespace.Content,{ref:o,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:jsxRuntime.jsx("div",{className:R("pb-4 pt-0",e),children:t})}));Or.displayName="AccordionContent";var Br=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Mt__namespace.Root,{ref:n,className:R("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:jsxRuntime.jsx(Mt__namespace.Indicator,{className:"flex items-center justify-center text-current",children:jsxRuntime.jsx(lucideReact.Check,{"aria-hidden":"true",className:"h-4 w-4"})})}));Br.displayName="Checkbox";var Hr=classVarianceAuthority.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_[data-slot=icon]]:text-[inherit] [&_[data-slot=icon]_*]:!text-[inherit] [&_[data-slot=icon]_svg]:!stroke-current [&_[data-slot=icon]_svg_*]:!stroke-current [&_[data-slot=end-icon]]:text-[inherit] [&_[data-slot=end-icon]_*]:!text-[inherit] [&_[data-slot=end-icon]_svg]:!stroke-current [&_[data-slot=end-icon]_svg_*]:!stroke-current [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-control-surface shadow-sm ring-offset-control-surface hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-sm px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),W=ne__namespace.forwardRef(({className:e,variant:t,size:n,asChild:o=false,...r},i)=>jsxRuntime.jsx(o?reactSlot.Slot:"button",{ref:i,className:Hr({variant:t,size:n,className:e}),...r}));W.displayName="Button";var _r=ne__namespace.forwardRef(({className:e,children:t,viewportClassName:n,viewportRef:o,onViewportScroll:r,scrollbar:i=true,scrollbarOrientation:l="vertical",scrollBarDisabled:u=false,type:g,...p},c)=>{let v=Xt();return jsxRuntime.jsxs(Ne__namespace.Root,{ref:c,type:g??(v>0?"auto":void 0),className:R("group relative overflow-hidden",u&&"no-scrollbar",e),...p,children:[jsxRuntime.jsx(Ne__namespace.Viewport,{ref:o,onScroll:r,className:R("h-full w-full rounded-[inherit]",n),children:t}),i?jsxRuntime.jsx(co,{orientation:l,className:R(u&&"size-0 p-0")}):null,jsxRuntime.jsx(Ne__namespace.Corner,{})]})});_r.displayName="ScrollArea";var co=ne__namespace.forwardRef(({className:e,orientation:t="vertical",...n},o)=>jsxRuntime.jsx(Ne__namespace.ScrollAreaScrollbar,{ref:o,"data-monkeys-scrollbar":"",orientation:t,className:R("flex touch-none select-none opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 data-[state=visible]:opacity-100",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-px",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-px",e),...n,children:jsxRuntime.jsx(Ne__namespace.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));co.displayName="ScrollBar";var tn=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Pt__namespace.Root,{ref:n,className:R("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,children:jsxRuntime.jsx(Pt__namespace.Thumb,{className:"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"})}));tn.displayName="Switch";var Se=ne__namespace.forwardRef(({variant:e="default",...t},n)=>jsxRuntime.jsx(De__namespace.Root,{ref:n,"data-variant":e,...t}));Se.displayName="Tabs";var Ce=ne__namespace.forwardRef(({className:e,gap:t,style:n,...o},r)=>jsxRuntime.jsx(De__namespace.List,{ref:r,className:R("inline-flex h-10 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),style:{gap:t,...n},...o}));Ce.displayName="TabsList";var ye=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(De__namespace.Trigger,{ref:n,className:R("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));ye.displayName="TabsTrigger";var be=ne__namespace.forwardRef(({className:e,...t},n)=>{let o=Xt();return jsxRuntime.jsx(De__namespace.Content,{ref:n,className:R("mt-2 ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",o>0&&"gap-[var(--monkeys-bento-gap)]",e),...t})});be.displayName="TabsContent";var Vr=ne__namespace.forwardRef(({className:e,sideOffset:t=4,...n},o)=>{let r=Ae();return jsxRuntime.jsx(Ue__namespace.Portal,{children:jsxRuntime.jsx(Ue__namespace.Content,{...r,...n,ref:o,sideOffset:t,"data-monkeys-component":"tooltip","data-slot":"content","data-surface":"menu",className:R("z-50 overflow-hidden border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",Ye("menu"),e)})})});Vr.displayName="TooltipContent";var qe=ne__namespace.forwardRef(({className:e,appearance:t="standard",type:n,...o},r)=>jsxRuntime.jsx("input",{ref:r,type:n,className:R("flex w-full border border-input bg-control-surface px-3 text-foreground ring-offset-control-surface transition-[border-color,background-color,color,box-shadow] file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t==="compact"?"h-9 rounded-md py-1 text-sm shadow-sm":"h-10 rounded-md py-2 text-sm shadow-sm",t==="shadow"&&"rounded-lg shadow-sm shadow-black/[0.02] dark:border-white/10 dark:bg-white/[0.04] dark:shadow-none",e),...o}));qe.displayName="Input";var on=ne__namespace.forwardRef(({className:e,appearance:t="standard",...n},o)=>jsxRuntime.jsx("textarea",{ref:o,className:R("flex w-full border border-input bg-control-surface px-3 py-2 text-foreground ring-offset-control-surface placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t==="compact"?"min-h-[60px] rounded-md text-sm shadow-sm":"min-h-[80px] rounded-md text-sm",t==="shadow"&&"rounded-lg shadow-sm shadow-black/[0.02] dark:border-white/10 dark:bg-white/[0.04] dark:shadow-none",e),...n}));on.displayName="Textarea";function go({className:e,...t}){return jsxRuntime.jsx("div",{"data-slot":"input-group",role:"group",className:R("group/input-group shadow-xs relative flex w-full items-center rounded-md border border-input outline-hidden transition-[color,box-shadow] dark:bg-input/30","h-9 has-[>textarea]:h-auto","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col","has-[[data-slot=input-group-control]:focus-visible]:ring-1 has-[[data-slot=input-group-control]:focus-visible]:ring-ring","has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e),...t})}a(go,"InputGroup");var Ur=classVarianceAuthority.cva("text-muted-foreground flex h-auto cursor-text select-none items-center justify-center gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.4rem] has-[>kbd]:mr-[-0.35rem]","block-start":"[.border-b]:pb-3 order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5","block-end":"[.border-t]:pt-3 order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function It({className:e,align:t="inline-start",...n}){return jsxRuntime.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:R(Ur({align:t}),e),onClick:o=>{o.target.closest("button")||o.currentTarget.parentElement?.querySelector("input")?.focus();},...n})}a(It,"InputGroupAddon");var qr=classVarianceAuthority.cva("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",sm:"h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function fo({className:e,type:t="button",variant:n="ghost",size:o="xs",...r}){return jsxRuntime.jsx(W,{type:t,"data-size":o,variant:n,className:R(qr({size:o}),e),...r})}a(fo,"InputGroupButton");var an=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(qe,{ref:n,"data-slot":"input-group-control",className:R("flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 dark:bg-transparent",e),...t}));an.displayName="InputGroupInput";var Fr=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(on,{ref:n,"data-slot":"input-group-control",className:R("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 dark:bg-transparent",e),...t}));Fr.displayName="InputGroupTextarea";var pt="relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",sn=`z-50 min-w-[8rem] overflow-hidden border p-1 ${Ye("menu")} data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,ln=H__namespace.Root,dn=H__namespace.Trigger;var Kr=ne__namespace.forwardRef(({className:e,inset:t,children:n,...o},r)=>jsxRuntime.jsxs(H__namespace.SubTrigger,{ref:r,className:R(pt,"data-[state=open]:bg-accent",t&&"pl-8",e),...o,children:[n,jsxRuntime.jsx(lucideReact.ChevronRight,{"aria-hidden":"true",className:"ml-auto"})]}));Kr.displayName="DropdownMenuSubTrigger";var Qr=ne__namespace.forwardRef(({className:e,...t},n)=>{let o=Ae();return jsxRuntime.jsx(H__namespace.SubContent,{...o,...t,ref:n,"data-monkeys-component":"dropdown-menu","data-slot":"content","data-surface":"menu",className:R(sn,e)})});Qr.displayName="DropdownMenuSubContent";var Et=ne__namespace.forwardRef(({className:e,sideOffset:t=4,...n},o)=>{let r=Ae();return jsxRuntime.jsx(H__namespace.Portal,{children:jsxRuntime.jsx(H__namespace.Content,{...r,...n,ref:o,sideOffset:t,"data-monkeys-component":"dropdown-menu","data-slot":"content","data-surface":"menu",className:R(sn,e)})})});Et.displayName="DropdownMenuContent";var ut=ne__namespace.forwardRef(({className:e,inset:t,...n},o)=>jsxRuntime.jsx(H__namespace.Item,{ref:o,className:R(pt,t&&"pl-8",e),...n}));ut.displayName="DropdownMenuItem";var Yr=ne__namespace.forwardRef(({className:e,children:t,checked:n,...o},r)=>jsxRuntime.jsxs(H__namespace.CheckboxItem,{ref:r,className:R(pt,"pl-8",e),checked:n,...o,children:[jsxRuntime.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(H__namespace.ItemIndicator,{children:jsxRuntime.jsx(lucideReact.Check,{"aria-hidden":"true",className:"h-4 w-4"})})}),t]}));Yr.displayName="DropdownMenuCheckboxItem";var Xr=ne__namespace.forwardRef(({className:e,children:t,...n},o)=>jsxRuntime.jsxs(H__namespace.RadioItem,{ref:o,className:R(pt,"pl-8",e),...n,children:[jsxRuntime.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(H__namespace.ItemIndicator,{children:jsxRuntime.jsx(lucideReact.Circle,{"aria-hidden":"true",className:"h-2 w-2 fill-current"})})}),t]}));Xr.displayName="DropdownMenuRadioItem";var Jr=ne__namespace.forwardRef(({className:e,inset:t,...n},o)=>jsxRuntime.jsx(H__namespace.Label,{ref:o,className:R("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Jr.displayName="DropdownMenuLabel";var Zr=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(H__namespace.Separator,{ref:n,className:R("-mx-1 my-1 h-px bg-muted",e),...t}));Zr.displayName="DropdownMenuSeparator";var ea=a(({className:e,...t})=>jsxRuntime.jsx("span",{className:R("ml-auto text-xs tracking-widest opacity-60",e),...t}),"DropdownMenuShortcut");ea.displayName="DropdownMenuShortcut";var vo=B__namespace.Root;var yo=B__namespace.Value,cn=ne__namespace.forwardRef(({className:e,children:t,iconClassName:n,size:o="default",...r},i)=>jsxRuntime.jsxs(B__namespace.Trigger,{ref:i,className:R("flex h-10 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-control-surface px-3 py-2 text-left text-sm text-foreground shadow-sm ring-offset-control-surface data-[placeholder]:text-muted-foreground focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 [&>span]:min-w-0 [&>span]:flex-1 [&>span]:text-left",o==="sm"&&"h-8 px-2 py-1 text-xs",e),...r,children:[t,jsxRuntime.jsx(B__namespace.Icon,{asChild:true,children:jsxRuntime.jsx(lucideReact.ChevronDown,{"aria-hidden":"true",className:R("h-4 w-4 opacity-50",n)})})]}));cn.displayName="SelectTrigger";var xo=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(B__namespace.ScrollUpButton,{ref:n,className:R("flex cursor-default items-center justify-center py-1",e),...t,children:jsxRuntime.jsx(lucideReact.ChevronUp,{"aria-hidden":"true",className:"h-4 w-4"})}));xo.displayName="SelectScrollUpButton";var ko=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(B__namespace.ScrollDownButton,{ref:n,className:R("flex cursor-default items-center justify-center py-1",e),...t,children:jsxRuntime.jsx(lucideReact.ChevronDown,{"aria-hidden":"true",className:"h-4 w-4"})}));ko.displayName="SelectScrollDownButton";var pn=ne__namespace.forwardRef(({className:e,children:t,position:n="popper",viewportClassName:o,disableTriggerViewportSizing:r=false,...i},l)=>{let u=Ae();return jsxRuntime.jsx(B__namespace.Portal,{children:jsxRuntime.jsxs(B__namespace.Content,{...u,...i,ref:l,position:n,"data-monkeys-component":"select","data-slot":"content","data-surface":"menu",className:R(sn,"relative max-h-[var(--radix-select-content-available-height)] overflow-y-auto overflow-x-hidden",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),children:[jsxRuntime.jsx(xo,{}),jsxRuntime.jsx(B__namespace.Viewport,{className:R("p-1",n==="popper"&&"w-full min-w-[var(--radix-select-trigger-width)]",n==="popper"&&!r&&"h-[var(--radix-select-trigger-height)]",o),children:t}),jsxRuntime.jsx(ko,{})]})})});pn.displayName="SelectContent";var ta=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(B__namespace.Label,{ref:n,className:R("px-2 py-1.5 text-sm font-semibold",e),...t}));ta.displayName="SelectLabel";var un=ne__namespace.forwardRef(({className:e,children:t,indicatorClassName:n,itemText:o,hideIndicator:r=false,...i},l)=>jsxRuntime.jsxs(B__namespace.Item,{ref:l,className:R(pt,"w-full",r?"px-2":"pl-8 pr-2",e),...i,children:[r?null:jsxRuntime.jsx("span",{className:R("absolute left-2 flex h-3.5 w-3.5 items-center justify-center",n),children:jsxRuntime.jsx(B__namespace.ItemIndicator,{children:jsxRuntime.jsx(lucideReact.Check,{"aria-hidden":"true",className:"h-4 w-4"})})}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(B__namespace.ItemText,{asChild:true,children:jsxRuntime.jsx("span",{className:"sr-only",children:o})}),t]}):jsxRuntime.jsx(B__namespace.ItemText,{children:t})]}));un.displayName="SelectItem";var na=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(B__namespace.Separator,{ref:n,className:R("-mx-1 my-1 h-px bg-muted",e),...t}));na.displayName="SelectSeparator";var gn=re__namespace.Root;var ra=re__namespace.Portal,wo=ne__namespace.forwardRef(({className:e,...t},n)=>{let o=Ae();return jsxRuntime.jsx(re__namespace.Overlay,{...o,...t,ref:n,"data-monkeys-component":"sheet","data-slot":"overlay","data-monkeys-overlay":true,className:R("theme-overlay-backdrop fixed inset-0 z-50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e)})});wo.displayName="SheetOverlay";var aa={top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm"},Lt=ne__namespace.forwardRef(({side:e="right",className:t,children:n,...o},r)=>{let i=Ae();return jsxRuntime.jsxs(ra,{children:[jsxRuntime.jsx(wo,{}),jsxRuntime.jsxs(re__namespace.Content,{...i,...o,ref:r,"data-monkeys-component":"sheet","data-slot":"content","data-surface":"dialog","data-monkeys-dialog-content":true,className:R("fixed z-50 gap-4 p-6 transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",Ye("dialog",{rounded:false}),aa[e],t),children:[jsxRuntime.jsxs(re__namespace.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-dialog-surface transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[jsxRuntime.jsx("svg",{"aria-hidden":"true",className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6 6 18M6 6l12 12"})}),jsxRuntime.jsx("span",{className:"sr-only",children:"Close"})]}),jsxRuntime.jsx(ao,{children:n})]})]})});Lt.displayName="SheetContent";var Dt=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(re__namespace.Title,{ref:n,className:R("text-lg font-semibold text-foreground",e),...t}));Dt.displayName="SheetTitle";var sa=ne__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(re__namespace.Description,{ref:n,className:R("text-sm text-muted-foreground",e),...t}));sa.displayName="SheetDescription";function hn({value:e,label:t,placeholder:n,options:o,className:r,onValueChange:i}){let l=o.find(u=>u.value===e);return jsxRuntime.jsxs(vo,{value:e||void 0,disabled:o.length===0,onValueChange:i,children:[jsxRuntime.jsx(cn,{size:"sm","aria-label":t,className:d("shrink bg-background font-medium",r),children:jsxRuntime.jsx(yo,{placeholder:n,children:l?.label})}),jsxRuntime.jsx(pn,{disableTriggerViewportSizing:true,children:o.map(u=>jsxRuntime.jsx(un,{value:u.value,disabled:u.disabled,children:u.label},u.value))})]})}a(hn,"ComposerSelect");var wa={contract:"AgentWorkbenchComposerViewModel",value:"",status:"idle",mode:"chat",attachments:[],queuedDrafts:[],inputActions:[],model:{options:[]},webSearchEnabled:false,capabilities:{attachments:false,voiceInput:false,webSearch:false,modelSelection:false,reasoning:false,permissions:false,queue:false,stop:false}};function zt(e){return `${e.mode}:${e.id}`}a(zt,"modelOptionValue");function Aa({viewModel:e=wa,disabled:t=false,modeSelectionEnabled:n=false,modeFilteringEnabled:o=false,variant:r,density:i,className:l,classNames:u,onIntent:g}){let p=ne.useRef({disabled:t,emitIntent:g});p.current={disabled:t,emitIntent:g};let c=a(f=>{p.current.disabled||p.current.emitIntent?.(f);},"onIntent"),v=fe({variant:r,density:i}),x=v.density==="compact",k=d(x?"size-7":"size-8","shrink-0 p-0 text-muted-foreground"),m=L().agentWorkbench,A=ne.useRef(null),P=ne.useRef(null),[E,b]=ne.useState(),[s,y]=ne.useState(""),[C,F]=ne.useState(false),Q=n?900:704,K=e.status==="loading"||e.status==="streaming"||e.status==="stopping",le=e.status==="stopping",J=e.attachments.some(f=>f.status==="uploading"),ge=!t&&!le&&!J&&(e.value.trim().length>0||e.attachments.some(f=>f.status==="ready")),ke=!K||ge,M=n||o,w=ne.useMemo(()=>M?e.model.options.filter(f=>f.mode===e.mode):e.model.options,[M,e.mode,e.model.options]),Z=ne.useMemo(()=>{let f=w.find(z=>z.id===e.model.selectedId&&z.mode===e.mode);return f?zt(f):w[0]?zt(w[0]):""},[e.mode,e.model.selectedId,w]),_=e.inputActions||[],Ve=e.selectedInputActionId;ne.useEffect(()=>{let f=P.current;if(!f)return;let z=a(()=>F(f.getBoundingClientRect().width<=Q),"updateLayout");if(z(),window.addEventListener("resize",z),typeof ResizeObserver>"u"){let Ge=window.setInterval(z,250);return ()=>{window.clearInterval(Ge),window.removeEventListener("resize",z);}}let X=new ResizeObserver(z);return X.observe(f),()=>{X.disconnect(),window.removeEventListener("resize",z);}},[Q]);let rt=a(()=>{ge&&c?.({type:"submit"});},"submit");return jsxRuntime.jsx("fieldset",{disabled:t,className:"min-w-0 border-0 p-0",children:jsxRuntime.jsxs("form",{"data-agent-workbench-variant":v.variant,"data-agent-workbench-density":v.density,"data-agent-workbench-status":e.status,className:d("agent-workbench-composer flex min-w-0 w-full flex-col",x?"gap-1.5":"gap-2",l,u?.root),"aria-label":m.composer.message,onSubmit:f=>{f.preventDefault(),rt();},children:[e.capabilities.queue&&e.queuedDrafts.length>0?jsxRuntime.jsx("section",{"aria-label":m.composer.queued,className:d("min-w-0 max-w-full rounded-md border border-border bg-muted/40 p-2",u?.queue),children:jsxRuntime.jsx("ol",{className:"space-y-1.5",children:e.queuedDrafts.map((f,z)=>jsxRuntime.jsxs("li",{className:"flex min-h-9 min-w-0 max-w-full items-center gap-2 overflow-hidden rounded-md bg-background px-2 py-1.5 text-sm",children:[jsxRuntime.jsx("span",{className:"w-5 shrink-0 text-center text-xs text-muted-foreground",children:z+1}),E===f.id?jsxRuntime.jsx(qe,{autoFocus:true,value:s,"aria-label":m.composer.editQueued,appearance:"compact",className:"h-8 min-w-0 flex-1 px-2 py-1",onChange:X=>y(X.target.value),onBlur:()=>{s.trim()&&c?.({type:"edit-queued-draft",draftId:f.id,text:s}),b(void 0);},onKeyDown:X=>{X.key==="Escape"&&b(void 0),X.key==="Enter"&&s.trim()&&(X.preventDefault(),c?.({type:"edit-queued-draft",draftId:f.id,text:s}),b(void 0));}}):jsxRuntime.jsx("span",{className:"min-w-0 flex-1 truncate",children:f.text||m.composer.attachmentOnly}),jsxRuntime.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:k,"aria-label":m.composer.moveUp,disabled:z===0,onClick:()=>c?.({type:"move-queued-draft",draftId:f.id,direction:"up"}),children:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"size-3.5"})}),jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:k,"aria-label":m.composer.moveDown,disabled:z===e.queuedDrafts.length-1,onClick:()=>c?.({type:"move-queued-draft",draftId:f.id,direction:"down"}),children:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"size-3.5"})}),jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:k,"aria-label":m.composer.editQueued,onClick:()=>{b(f.id),y(f.text);},children:jsxRuntime.jsx(lucideReact.Pencil,{className:"size-3.5"})}),jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:d(k,"text-destructive-text hover:text-destructive-text"),"aria-label":m.composer.deleteQueued,onClick:()=>c?.({type:"delete-queued-draft",draftId:f.id}),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"size-3.5"})})]})]},f.id))})}):null,jsxRuntime.jsxs("div",{ref:P,"data-agent-workbench-surface":"elevated",className:d("agent-workbench-composer__surface min-w-0 max-w-full rounded-[var(--radius)] border border-input bg-popover text-popover-foreground shadow-sm transition-[border-color,box-shadow] focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/30",x?"p-2.5":"p-3"),children:[e.attachments.length>0?jsxRuntime.jsx("div",{"data-agent-workbench-composer-attachments":true,className:d("mb-2 flex max-w-full gap-2 overflow-x-auto overscroll-x-contain pb-1",u?.attachments),children:e.attachments.map(f=>{let z=f.status==="error",X=f.status==="uploading";return jsxRuntime.jsxs("div",{role:z?"alert":void 0,className:d("flex h-14 min-w-48 max-w-64 shrink-0 items-center gap-2 rounded-md border bg-muted/45 p-1.5",z?"border-destructive/50 bg-destructive/5":"border-border"),children:[jsxRuntime.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center overflow-hidden rounded bg-muted",children:f.previewUrl&&f.mediaType?.startsWith("image/")?jsxRuntime.jsx("img",{src:f.previewUrl,alt:"",className:"size-full object-cover"}):f.mediaType?.startsWith("image/")?jsxRuntime.jsx(lucideReact.Image,{className:"size-5 text-muted-foreground"}):jsxRuntime.jsx(lucideReact.File,{className:"size-5 text-muted-foreground"})}),jsxRuntime.jsxs("span",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("span",{className:"block truncate text-xs font-medium text-foreground",title:f.name,children:f.name}),jsxRuntime.jsxs("span",{className:d("mt-0.5 flex items-center gap-1 text-[11px]",z?"text-destructive-text":"text-muted-foreground"),children:[X?jsxRuntime.jsx(lucideReact.LoaderCircle,{className:"size-3 animate-spin","aria-hidden":"true"}):null,z?jsxRuntime.jsx(lucideReact.CircleAlert,{className:"size-3","aria-hidden":"true"}):null,X?m.composer.uploading:z?m.composer.uploadFailed:f.mediaType||m.composer.attachmentOnly]})]}),jsxRuntime.jsxs("span",{className:"flex shrink-0 items-center gap-0.5",children:[z?jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:"!size-7 min-w-7 shrink-0 p-0 text-destructive-text hover:text-destructive-text","aria-label":`${m.composer.retryAttachment}: ${f.name}`,onClick:()=>c?.({type:"retry-attachment",attachmentId:f.id}),children:jsxRuntime.jsx(lucideReact.RotateCcw,{className:"size-3.5"})}):null,jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:"!size-7 min-w-7 shrink-0 p-0 text-muted-foreground hover:text-foreground","aria-label":`${m.composer.removeAttachment}: ${f.name}`,onClick:()=>c?.({type:"remove-attachment",attachmentId:f.id}),children:jsxRuntime.jsx(lucideReact.X,{className:"size-3.5"})})]})]},f.id)})}):null,jsxRuntime.jsx(en,{value:e.value,minHeight:x?44:54,maxHeight:256,"aria-label":m.composer.message,placeholder:e.placeholder,className:d("min-w-0 w-full resize-none overflow-y-auto rounded-none border-0 bg-transparent px-0 py-0 text-sm leading-relaxed text-foreground shadow-none focus-visible:ring-0 focus-visible:ring-offset-0",u?.textarea),onChange:f=>c?.({type:"change-value",value:f.target.value}),onKeyDown:f=>{f.key==="Enter"&&!f.shiftKey&&!f.nativeEvent.isComposing&&(f.preventDefault(),rt());}}),jsxRuntime.jsxs("div",{className:d("agent-workbench-composer__toolbar mt-2 flex min-w-0 max-w-full items-center",x?"min-h-7 gap-1.5":"min-h-8 gap-2",C?"flex-wrap":"flex-nowrap",u?.toolbar),children:[jsxRuntime.jsxs("div",{"data-agent-workbench-composer-controls":true,className:d("agent-workbench-composer__controls flex min-w-0 max-w-full flex-1 items-center gap-1.5",C?"w-full flex-wrap":"flex-nowrap overflow-x-auto overscroll-x-contain pb-1"),children:[e.capabilities.attachments?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:k,"aria-label":m.composer.attach,onClick:()=>A.current?.click(),children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"size-4"})}),jsxRuntime.jsx("input",{ref:A,type:"file",className:"hidden",multiple:true,onChange:f=>{let z=Array.from(f.target.files||[]);z.length>0&&c?.({type:"request-attachments",files:z}),f.target.value="";}})]}):null,_.length>0?jsxRuntime.jsxs(Se,{value:Ve,onValueChange:f=>c?.({type:"select-input-action",actionId:f}),children:[jsxRuntime.jsx(Ce,{className:d("shrink-0 gap-0.5 rounded-md bg-muted/60 p-0.5",x?"h-7":"h-8"),children:_.map(f=>{let z=f.icon==="image"?lucideReact.Image:lucideReact.FileText;return jsxRuntime.jsxs(ye,{value:f.id,className:d("min-w-0 gap-1.5 px-2.5 text-xs text-foreground/75 shadow-none hover:text-foreground data-[state=active]:bg-primary/10 data-[state=active]:text-primary data-[state=active]:shadow-none",x?"h-6":"h-7"),children:[f.icon?jsxRuntime.jsx(z,{className:"size-3.5"}):null,jsxRuntime.jsx("span",{className:"max-w-32 truncate",children:f.label})]},f.id)})}),_.map(f=>jsxRuntime.jsx(be,{value:f.id,className:"hidden"},f.id))]}):null,e.capabilities.voiceInput?jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:k,"aria-label":m.composer.voice,onClick:()=>c?.({type:"request-voice-input"}),children:jsxRuntime.jsx(lucideReact.Mic,{className:"size-4"})}):null,e.capabilities.webSearch?jsxRuntime.jsxs("label",{className:"flex shrink-0 items-center gap-1.5 whitespace-nowrap px-1 text-xs font-medium text-foreground",children:[m.composer.webSearch,jsxRuntime.jsx(tn,{checked:e.webSearchEnabled,onCheckedChange:f=>c?.({type:"toggle-web-search",enabled:f})})]}):null,n?jsxRuntime.jsxs(Se,{value:e.mode,onValueChange:f=>c?.({type:"change-mode",mode:f}),children:[jsxRuntime.jsx(Ce,{"aria-label":m.composer.chatMode,className:d("shrink-0 gap-0.5 rounded-md bg-muted/60 p-0.5",x?"h-7":"h-8"),children:["chat","work"].map(f=>jsxRuntime.jsx(ye,{value:f,className:d("min-w-0 px-2.5 text-xs text-foreground/75 shadow-none hover:text-foreground data-[state=active]:bg-primary/10 data-[state=active]:text-primary data-[state=active]:shadow-none",x?"h-6":"h-7"),children:m.modes[f]},f))}),["chat","work"].map(f=>jsxRuntime.jsx(be,{value:f,className:"hidden"},f))]}):null,e.capabilities.modelSelection?jsxRuntime.jsx(hn,{value:Z,label:m.composer.model,placeholder:m.composer.noModels,className:"w-48 min-w-36",options:w.map(f=>({value:zt(f),label:`${f.label} \xB7 ${m.modes[f.mode]}`,disabled:f.disabled})),onValueChange:f=>{let z=w.find(X=>zt(X)===f);z&&c?.({type:"select-model",modelId:z.id,mode:z.mode});}}):null,e.capabilities.reasoning&&e.reasoning?jsxRuntime.jsx(hn,{value:e.reasoning.value,label:m.composer.reasoning,className:"w-32 min-w-24",options:e.reasoning.options.map(f=>({value:f,label:m.composer.reasoningOptions[f]})),onValueChange:f=>c?.({type:"change-reasoning",value:f})}):null,e.capabilities.permissions&&e.permissionProfile?jsxRuntime.jsx(hn,{value:e.permissionProfile,label:m.composer.permissions,className:"w-40 min-w-32",options:["approval-required","auto-approve","full-access"].map(f=>({value:f,label:m.composer.permissionOptions[f]})),onValueChange:f=>c?.({type:"change-permission",value:f})}):null]}),jsxRuntime.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5",children:[ke?jsxRuntime.jsx(W,{type:"submit",size:"icon",className:d(k,"bg-primary text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground disabled:bg-primary/40 disabled:!opacity-100"),"aria-label":K&&e.capabilities.queue?m.composer.queue:m.composer.send,disabled:!ge,children:jsxRuntime.jsx(lucideReact.Send,{className:"size-4 !text-white [&_path]:!stroke-white"})}):null,K&&!ge&&e.capabilities.stop?jsxRuntime.jsx(W,{type:"button",variant:"outline",size:"icon",className:k,"aria-label":le?m.run.stopping:m.composer.stop,disabled:le,onClick:()=>c?.({type:"stop"}),children:jsxRuntime.jsx(lucideReact.Square,{className:"size-3 fill-current"})}):null]})]})]}),e.status==="error"&&e.error?jsxRuntime.jsx("p",{role:"alert",className:"text-sm text-destructive-text",children:e.error}):null]})})}a(Aa,"AgentWorkbenchComposer");var Ro={sparkles:lucideReact.Sparkles,palette:lucideReact.Palette,search:lucideReact.Search,"file-text":lucideReact.FileText,code:lucideReact.Code2,"shopping-bag":lucideReact.ShoppingBag},je="__quick-start__";function Da({template:e}){let t=Ro[e.icon||"sparkles"];return e.coverImageUrl?jsxRuntime.jsx("img",{src:e.coverImageUrl,alt:"",className:"size-full bg-muted object-contain"}):jsxRuntime.jsx("span",{className:"flex size-full items-center justify-center bg-gradient-to-br from-primary/5 via-muted/50 to-primary/15",children:jsxRuntime.jsx("span",{className:"flex size-14 items-center justify-center rounded-2xl border border-primary/10 bg-background/85 text-primary shadow-sm",children:jsxRuntime.jsx(t,{className:"size-7","aria-hidden":"true"})})})}a(Da,"TemplateVisual");function za({viewModel:e,className:t,onIntent:n}){let o=L().agentWorkbench.quickStart,r=ne.useRef(null),[i,l]=ne.useState(),[u,g]=ne.useState(),[p,c]=ne.useState(),v=ne.useMemo(()=>e.categories.map(y=>({...y,sections:y.sections.map(C=>({...C,templates:C.templates.filter(F=>!F.modes||F.modes.includes(e.mode))})).filter(C=>C.templates.length>0)})).filter(y=>y.sections.length>0),[e.categories,e.mode]),x=ne.useMemo(()=>{let y=v.flatMap(C=>C.sections.filter(F=>F.id==="quick-start")).map(C=>C.templates).flat().filter((C,F,Q)=>Q.findIndex(K=>K.id===C.id)===F);if(y.length!==0)return {id:je,label:o.label,icon:"sparkles",sections:[{id:"quick-start",label:o.label,templates:y}]}},[v,o.label]),k=i===je?x:v.find(y=>y.id===i),m=k?.sections.find(y=>y.id===u)||k?.sections[0],A=m?.templates.length?m.templates.every(y=>!y.coverImageUrl):false;if(ne.useEffect(()=>{i&&i!==je&&!v.some(y=>y.id===i)&&(l(void 0),g(void 0)),i===je&&!x&&(l(void 0),g(void 0));},[i,v,x]),v.length===0)return null;let P=a(y=>{l(y.id),g(y.sections[0]?.id),n?.({type:"change-category",categoryId:y.id});},"selectCategory"),E=a(()=>{x&&(l(je),g(x.sections[0]?.id),n?.({type:"change-category"}));},"selectQuickStart"),b=a(y=>{k&&(g(y),n?.({type:"change-section",categoryId:k.id,sectionId:y}));},"selectSection"),s=a(y=>{if(e.disabled)return;if(y.action!=="upload"){n?.({type:"select-template",templateId:y.id,prompt:y.prompt});return}let C=r.current;C&&(C.accept=y.accept||"*/*",C.multiple=y.multiple===true,c(y),C.click());},"selectTemplate");return jsxRuntime.jsxs("section",{className:d("agent-workbench-quick-start min-w-0 max-w-full",t),"aria-label":o.label,children:[jsxRuntime.jsx("input",{ref:r,type:"file",className:"hidden",onChange:y=>{let C=Array.from(y.target.files||[]);p&&C.length>0&&n?.({type:"select-template",templateId:p.id,prompt:p.prompt,files:p.multiple?C:C.slice(0,1)}),c(void 0),y.target.value="";}}),k?jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex min-w-0 max-w-full items-center gap-1 overflow-x-auto pb-1",children:[jsxRuntime.jsxs("button",{type:"button",className:"inline-flex h-9 shrink-0 items-center gap-1.5 rounded-md px-3 text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>{l(void 0),g(void 0),n?.({type:"change-category"});},children:[jsxRuntime.jsx(lucideReact.ArrowLeft,{className:"size-4","aria-hidden":"true"}),o.back]}),k.sections.map((y,C)=>jsxRuntime.jsx("button",{type:"button","aria-pressed":m?.id===y.id,className:d("h-9 shrink-0 rounded-md px-4 text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",m?.id===y.id?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/70 hover:text-foreground"),onClick:()=>b(y.id),children:k.id!==je&&C===0?k.label:y.label},y.id))]}),jsxRuntime.jsx("div",{"data-quick-start-layout":A?"list":"cards",className:d("grid",A?"grid-cols-1 gap-0":"grid-cols-[repeat(auto-fit,minmax(min(100%,14rem),1fr))] gap-3"),children:m?.templates.map(y=>jsxRuntime.jsxs("button",{type:"button",disabled:e.disabled,"data-quick-start-template-id":y.id,className:d("group min-w-0 overflow-hidden text-left transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",A?"flex min-h-14 items-center rounded-none border-x-0 border-t-0 bg-transparent shadow-none hover:border-border hover:bg-muted/40 last:border-b-0":"rounded-xl border border-border bg-background hover:border-primary/30 hover:bg-muted/20"),onClick:()=>s(y),children:[jsxRuntime.jsxs("span",{className:d(A?"min-w-0 flex-1 px-2 py-2.5":"block px-4 pb-3 pt-4"),children:[jsxRuntime.jsxs("span",{className:d("flex items-center gap-2 text-sm text-foreground",A?"font-medium":"font-semibold"),children:[y.title,y.action==="upload"?jsxRuntime.jsxs("span",{className:"ml-auto inline-flex items-center gap-1 text-[11px] font-medium text-muted-foreground",children:[jsxRuntime.jsx(lucideReact.Upload,{className:"size-3","aria-hidden":"true"}),o.addFile]}):null]}),y.description?jsxRuntime.jsx("span",{className:d("line-clamp-2 block text-xs leading-4 text-muted-foreground",A?"mt-0.5 min-h-0 text-muted-foreground/75":"mt-1 min-h-8"),children:y.description}):null]}),A?jsxRuntime.jsx(lucideReact.ArrowUpRight,{className:"mr-2 size-4 shrink-0 text-muted-foreground/45","aria-hidden":"true"}):jsxRuntime.jsx("span",{className:d("block overflow-hidden",y.coverImageUrl?"aspect-[5/2]":"h-28"),children:jsxRuntime.jsx(Da,{template:y})})]},y.id))})]}):jsxRuntime.jsxs("div",{className:"flex max-w-full items-center justify-center gap-2 overflow-x-auto px-1 pb-1",children:[x?jsxRuntime.jsxs("button",{type:"button",className:"inline-flex h-10 shrink-0 items-center gap-2 rounded-md border border-border bg-background px-4 text-sm font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring","aria-pressed":i===je,onClick:E,children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),o.label]}):null,v.map(y=>{let C=Ro[y.icon||"sparkles"];return jsxRuntime.jsxs("button",{type:"button",className:"inline-flex h-10 shrink-0 items-center gap-2 rounded-md border border-border bg-background px-4 text-sm font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>P(y),children:[jsxRuntime.jsx(C,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),y.label]},y.id)})]})]})}a(za,"AgentWorkbenchQuickStart");var Je=ne.forwardRef(a(function({children:t,header:n,search:o,primaryAction:r,actions:i,groups:l,footer:u,className:g,classNames:p,bodyProps:c,bodyScrollable:v=true,status:x="ready",variant:k,density:m,loadingState:A,emptyState:P,errorState:E,...b},s){let y=fe({variant:k,density:m}),C=y.density==="compact",F=o!==void 0||r!==void 0||i!==void 0,Q=x==="loading"?A:x==="empty"?P:x==="error"?E:t;return jsxRuntime.jsxs("nav",{ref:s,"data-agent-workbench-variant":y.variant,"data-agent-workbench-density":y.density,"data-agent-workbench-status":x,className:d("flex h-full min-h-0 flex-col bg-card text-card-foreground",p?.root,g),...b,children:[n!==void 0?jsxRuntime.jsx("div",{className:d("shrink-0",p?.header),children:n}):null,F?jsxRuntime.jsxs("div",{className:d("shrink-0",C?"space-y-2 px-3 pb-2 pt-3":"space-y-3 px-4 pb-2 pt-4",p?.search),children:[o,r!==void 0?jsxRuntime.jsx("div",{className:d(p?.primaryAction),children:r}):null,i!==void 0?jsxRuntime.jsx("div",{className:d("flex min-w-0 items-center gap-2",p?.actions),children:i}):null]}):null,jsxRuntime.jsx("div",{"data-agent-workbench-scroll-region":v?"":void 0,...c,tabIndex:c?.tabIndex??(v?0:void 0),className:d("min-h-0 flex-1",C?"px-3 pb-3":"px-4 pb-4",v&&"overflow-x-hidden overflow-y-auto overscroll-contain",p?.body),children:Q}),l!==void 0?jsxRuntime.jsx("div",{className:d("shrink-0",p?.groups),children:l}):null,u!==void 0?jsxRuntime.jsx("div",{className:d("shrink-0",p?.footer),children:u}):null]})},"AgentWorkbenchSidebarContainer"));Je.displayName="AgentWorkbenchSidebarContainer";function Ot({value:e,label:t,placeholder:n=t,className:o,variant:r="default",onChange:i}){let l=L().agentWorkbench.navigation,u=ne.useRef(null);return ne.useEffect(()=>{let g=a(p=>{!(p.ctrlKey||p.metaKey)||p.key.toLocaleLowerCase()!=="k"||(p.preventDefault(),u.current?.focus(),u.current?.select());},"handleShortcut");return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[]),jsxRuntime.jsxs(go,{className:d(r==="trend"?"h-12 rounded-[var(--radius)] border-border bg-card text-foreground":"h-10 rounded-lg bg-card",o),children:[jsxRuntime.jsx(It,{children:jsxRuntime.jsx(lucideReact.Search,{className:"size-4","aria-hidden":"true"})}),jsxRuntime.jsx(an,{ref:u,type:"search",value:e,"aria-label":t,placeholder:n,className:"min-w-0 [&::-webkit-search-cancel-button]:hidden",onChange:g=>i(g.target.value),onKeyDown:g=>{g.key==="Escape"&&(i(""),g.currentTarget.blur());}}),e?jsxRuntime.jsx(It,{align:"inline-end",children:jsxRuntime.jsx(fo,{size:"icon-xs","aria-label":l.clearSearch,onClick:()=>i(""),children:jsxRuntime.jsx(lucideReact.X,{className:"size-3.5","aria-hidden":"true"})})}):jsxRuntime.jsx(It,{align:"inline-end",children:jsxRuntime.jsx("kbd",{className:"border border-border px-1.5 py-0.5 text-[10px]",children:"Ctrl K"})})]})}a(Ot,"AgentWorkbenchSidebarSearch");function Bt({label:e,className:t,variant:n="default",onClick:o}){return jsxRuntime.jsxs(W,{type:"button",variant:n==="trend"?"default":"ghost",className:d(n==="trend"?"h-11 w-full justify-center gap-2 rounded-[var(--radius)] border border-primary/60 bg-primary px-3 font-semibold text-primary-foreground hover:bg-primary/90":"h-9 w-full justify-start gap-2 px-3 text-sm",t),onClick:o,children:[jsxRuntime.jsx(lucideReact.SquarePen,{className:"size-4","aria-hidden":"true"}),e]})}a(Bt,"AgentWorkbenchSidebarNewSessionButton");function Po({item:e}){let[t,n]=ne.useState(false);return e.thumbnailUrl&&!t?jsxRuntime.jsx("img",{src:e.thumbnailUrl,alt:"",className:"size-full object-cover",loading:"lazy",onError:()=>n(true)}):jsxRuntime.jsx(lucideReact.Image,{className:"size-5","aria-hidden":"true"})}a(Po,"SessionAvatar");function Io({item:e}){let{locale:t}=dt(),n=L().agentWorkbench.navigation;return jsxRuntime.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"min-w-0 truncate text-xs text-foreground/80",children:new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e.updatedAt))}),e.mode?jsxRuntime.jsx("span",{className:d("shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium leading-none",e.mode==="work"?"bg-primary/10 text-primary":"bg-muted text-foreground"),children:e.mode==="work"?n.work:n.chat}):null]})}a(Io,"SessionMeta");function Ya({status:e}){let t=L().agentWorkbench.navigation;return e==="running"?jsxRuntime.jsx(lucideReact.Loader2,{className:"size-4 animate-spin text-primary","aria-label":t.running}):e==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"size-4 text-primary","aria-label":t.completed}):e==="error"?jsxRuntime.jsx(lucideReact.AlertCircle,{className:"size-4 text-destructive-text","aria-label":t.failed}):null}a(Ya,"StatusIndicator");function Ht({sessions:e,selectedSessionId:t,status:n="ready",error:o,query:r="",emptyLabel:i,noResultsLabel:l,retryLabel:u,groupByMode:g=false,showHeading:p=false,variant:c="default",className:v,itemClassName:x,capabilities:k,onSelect:m,onTogglePin:A,onRename:P,onDelete:E,onRetry:b}){let s=L().agentWorkbench.navigation,y=ne.useRef(null),[C,F]=ne.useState(),[Q,K]=ne.useState("");ne.useEffect(()=>{C&&(y.current?.focus(),y.current?.select());},[C]);let le=a(()=>{F(void 0),K("");},"cancelRename"),J=a(M=>{let w=Q.trim();w&&w!==M.title&&P?.(M.id,w),le();},"saveRename");if(n==="loading"&&e.length===0)return jsxRuntime.jsx("div",{className:"space-y-2 px-1 py-3",role:"status","aria-label":s.loading,children:Array.from({length:4},(M,w)=>jsxRuntime.jsx("div",{"aria-hidden":"true",className:d("animate-pulse rounded-[var(--radius)] bg-muted/70",c==="trend"?"h-10":"h-14")},w))});if(n==="error")return jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-3 px-3 py-8 text-center",children:[jsxRuntime.jsx("p",{className:"max-w-full break-words text-sm text-muted-foreground",role:"alert",children:o}),b?jsxRuntime.jsxs(W,{type:"button",variant:"ghost",size:"sm",className:"gap-1.5 px-0 text-sm text-primary hover:text-primary",onClick:b,children:[jsxRuntime.jsx(lucideReact.RefreshCw,{className:"size-3.5","aria-hidden":"true"}),u??s.retry]}):null]});if(e.length===0)return jsxRuntime.jsx("div",{className:"px-3 py-8 text-center text-sm text-muted-foreground",children:r?l:i});let ge=a(M=>jsxRuntime.jsx("div",{className:"space-y-3",children:M.map(w=>jsxRuntime.jsxs("div",{"aria-current":w.id===t?"page":void 0,"data-agent-session-status":w.status??"idle","aria-busy":w.status==="running"?"true":void 0,className:"group flex h-10 w-full min-w-0 items-center rounded-[var(--radius)] border border-transparent bg-muted/60 text-foreground transition hover:bg-muted focus-within:border-ring focus-within:ring-2 focus-within:ring-ring aria-[current=page]:border-primary aria-[current=page]:bg-primary/10",children:[jsxRuntime.jsx("button",{type:"button",title:w.title,className:"h-full min-w-0 flex-1 truncate px-3 text-left text-sm font-semibold",onClick:()=>m(w.id),children:w.title}),k?.delete?jsxRuntime.jsx("span",{"data-agent-workbench-item-actions":true,className:"mr-1 shrink-0 opacity-0 transition-opacity group-aria-[current=page]:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100",onClick:Z=>Z.stopPropagation(),onKeyDown:Z=>Z.stopPropagation(),children:jsxRuntime.jsxs(ln,{children:[jsxRuntime.jsx(dn,{asChild:true,children:jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon","aria-label":s.actions,className:"size-8 text-muted-foreground",children:jsxRuntime.jsx(lucideReact.Ellipsis,{className:"size-4","aria-hidden":"true"})})}),jsxRuntime.jsx(Et,{align:"end",children:jsxRuntime.jsxs(ut,{className:"text-destructive-text",onSelect:()=>E?.(w.id),children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"mr-2 size-4","aria-hidden":"true"}),s.delete]})})]})}):null]},w.id))}),"renderTrendItems"),ke=a(M=>jsxRuntime.jsx("div",{className:"space-y-1",children:M.map(w=>{let Z=w.contextUsage&&w.contextUsage.maxTokens>0?Math.min(100,Math.round(w.contextUsage.usedTokens/w.contextUsage.maxTokens*100)):void 0;return jsxRuntime.jsxs("div",{"aria-current":w.id===t?"page":void 0,className:d("group flex w-full min-w-0 items-center gap-3 rounded-lg border border-transparent px-3 py-2 text-left hover:bg-muted aria-[current=page]:border-primary aria-[current=page]:bg-muted",x),children:[C===w.id?jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[jsxRuntime.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted",children:jsxRuntime.jsx(Po,{item:w})}),jsxRuntime.jsxs("span",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx(qe,{ref:y,value:Q,"aria-label":s.rename,appearance:"compact",className:"h-6 w-full border-primary px-1.5 text-sm font-medium",onChange:_=>K(_.target.value),onClick:_=>_.stopPropagation(),onBlur:()=>J(w),onKeyDown:_=>{_.stopPropagation(),_.key==="Enter"?(_.preventDefault(),J(w)):_.key==="Escape"&&(_.preventDefault(),le());}}),jsxRuntime.jsx(Io,{item:w})]})]}):jsxRuntime.jsxs("button",{type:"button",title:w.title,className:"flex min-w-0 flex-1 items-center gap-3 text-left",onClick:()=>m(w.id),children:[jsxRuntime.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted",children:jsxRuntime.jsx(Po,{item:w})}),jsxRuntime.jsxs("span",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("span",{className:"block truncate text-sm font-medium",children:w.title}),jsxRuntime.jsx(Io,{item:w})]})]}),jsxRuntime.jsxs("span",{"data-agent-workbench-item-actions":true,className:"flex shrink-0 items-center gap-1",children:[Z!==void 0&&w.status==="idle"?jsxRuntime.jsxs("span",{className:"text-xs text-foreground","aria-label":s.contextUsage({percent:Z}),children:[Z,"%"]}):jsxRuntime.jsx(Ya,{status:w.status}),k?.pin?jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon","aria-label":w.pinned?s.unpin:s.pin,className:d("size-8 text-muted-foreground opacity-0 group-hover:opacity-100",w.pinned&&"text-primary opacity-100"),onClick:_=>{_.stopPropagation(),A?.(w.id,!w.pinned);},children:jsxRuntime.jsx(lucideReact.Pin,{className:d("size-4",w.pinned&&"fill-current")})}):null,k?.rename||k?.delete?jsxRuntime.jsx("span",{onClick:_=>_.stopPropagation(),onKeyDown:_=>_.stopPropagation(),children:jsxRuntime.jsxs(ln,{children:[jsxRuntime.jsx(dn,{asChild:true,children:jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:"size-8","aria-label":s.actions,children:jsxRuntime.jsx(lucideReact.Ellipsis,{className:"size-4","aria-hidden":"true"})})}),jsxRuntime.jsxs(Et,{align:"end",children:[k.rename?jsxRuntime.jsxs(ut,{onSelect:()=>{F(w.id),K(w.title);},children:[jsxRuntime.jsx(lucideReact.Pencil,{className:"mr-2 size-4","aria-hidden":"true"}),s.rename]}):null,k.delete?jsxRuntime.jsxs(ut,{className:"text-destructive-text",onSelect:()=>E?.(w.id),children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"mr-2 size-4","aria-hidden":"true"}),s.delete]}):null]})]})}):null]})]},w.id)})}),"renderItems");return jsxRuntime.jsxs("div",{className:d("space-y-2",v),children:[p&&!g?jsxRuntime.jsx("h3",{className:"mb-2 px-3 text-xs font-medium text-muted-foreground",children:s.recentSessions}):null,c==="trend"?ge(e):g?[{id:"chatbot",label:s.chats,icon:lucideReact.MessageSquare,items:e.filter(M=>M.mode!=="work")},{id:"agent",label:s.agents,icon:lucideReact.Bot,items:e.filter(M=>M.mode==="work")}].map(({id:M,label:w,icon:Z,items:_})=>jsxRuntime.jsxs("details",{open:true,"aria-label":w,children:[jsxRuntime.jsxs("summary",{className:"flex h-9 cursor-pointer list-none items-center gap-2 rounded-md px-3 text-sm font-semibold hover:bg-muted",children:[jsxRuntime.jsx(Z,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:"min-w-0 truncate",children:w})]}),ke(_)]},M)):ke(e)]})}a(Ht,"AgentWorkbenchSessionList");var as={contract:"AgentWorkbenchNavigationViewModel",activeTab:"sessions",searchQuery:"",agents:{status:"loading",items:[]},sessions:{status:"loading",items:[]},capabilities:{createAgent:false,createSession:false,manageCapabilities:false,manageAgentSettings:false,pinAgents:false,pinSessions:false,renameSessions:false,deleteSessions:false}};function ss({item:e}){let[t,n]=ne.useState(false);if(e.iconUrl&&!t)return jsxRuntime.jsx("img",{src:e.iconUrl,alt:"",className:"size-full object-cover",onError:()=>n(true)});let o=e.name.trim().charAt(0).toLocaleUpperCase();return o?jsxRuntime.jsx("span",{className:"text-sm font-semibold",children:o}):jsxRuntime.jsx(lucideReact.Bot,{className:"size-4"})}a(ss,"ItemAvatar");function is({status:e,empty:t,noResults:n,hasItems:o,query:r,error:i,onRetry:l}){let u=L().agentWorkbench.navigation;return e==="loading"&&!o?jsxRuntime.jsx("div",{className:"px-3 py-8 text-center text-sm text-muted-foreground",children:u.loading}):e==="error"?jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-3 px-3 py-8 text-center",children:[jsxRuntime.jsx("p",{className:"max-w-full break-words text-sm text-muted-foreground",role:"alert",children:i}),jsxRuntime.jsxs(W,{type:"button",variant:"ghost",size:"sm",className:"gap-1.5 px-0 text-sm text-primary hover:text-primary",onClick:l,children:[jsxRuntime.jsx(lucideReact.RefreshCw,{className:"size-3.5","aria-hidden":"true"}),u.retry]})]}):o?null:jsxRuntime.jsx("div",{className:"px-3 py-8 text-center text-sm text-muted-foreground",children:r?n:t})}a(is,"CollectionState");function ls({viewModel:e=as,navigationMode:t,config:n,header:o,headerActions:r,footer:i,className:l,classNames:u,onIntent:g}){let p=L().agentWorkbench.navigation,c=ne.useMemo(()=>monkeys.resolveAgentWorkbenchSidebarConfig(n),[n]),v=ne.useMemo(()=>new Set(c.visibleSections),[c.visibleSections]),x=t==="sessions-only"||t===void 0&&c.navigationMode!=="default",k=v.has("agents")&&!x,m=v.has("sessions"),A=e.searchQuery.trim().toLocaleLowerCase(),P=ne.useMemo(()=>e.agents.items.filter(b=>!A||`${b.name} ${b.description??""}`.toLocaleLowerCase().includes(A)),[A,e.agents.items]),E=ne.useMemo(()=>e.sessions.items.filter(b=>!A||b.title.toLocaleLowerCase().includes(A)),[A,e.sessions.items]);return jsxRuntime.jsx(Se,{value:x||!k?"sessions":e.activeTab,onValueChange:b=>{!x&&(b==="agents"||b==="sessions")&&g?.({type:"change-tab",tab:b});},className:"h-full min-h-0",children:jsxRuntime.jsxs(Je,{"data-sidebar-width-percent":c.widthPercent,"aria-label":p.tabsLabel,header:v.has("header")?o:void 0,search:v.has("search")?jsxRuntime.jsx(Ot,{value:e.searchQuery,label:x?p.searchSessions:p.search,className:u?.search,onChange:b=>g?.({type:"change-search",query:b})}):void 0,actions:k&&m||r?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[k&&m?jsxRuntime.jsxs(Ce,{className:d("grid min-w-0 flex-1 grid-cols-2 text-foreground",u?.tabs),"aria-label":p.tabsLabel,children:[jsxRuntime.jsx(ye,{value:"agents",children:p.agents}),jsxRuntime.jsx(ye,{value:"sessions",children:p.sessions})]}):null,r?jsxRuntime.jsx("div",{className:"flex shrink-0 items-center",children:r}):null]}):void 0,footer:v.has("footer")&&(!x&&e.capabilities.manageAgentSettings||i)?jsxRuntime.jsxs("div",{className:d("border-t border-border p-4",u?.footer),children:[!x&&e.capabilities.manageAgentSettings?jsxRuntime.jsxs(W,{type:"button",variant:"ghost",className:"h-10 w-full justify-start gap-2 px-3 text-sm",onClick:()=>g?.({type:"open-agent-settings"}),children:[jsxRuntime.jsx(lucideReact.Settings,{className:"size-4","aria-hidden":"true"}),p.settings]}):null,i]}):void 0,bodyScrollable:false,className:l,classNames:{root:u?.root,body:"flex min-h-0 flex-1 flex-col p-0"},children:[k?jsxRuntime.jsxs(be,{value:"agents","data-agent-workbench-scroll-region":true,className:d("mt-0 min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain px-4 pb-4",u?.body),children:[e.capabilities.createAgent?jsxRuntime.jsxs(W,{type:"button",variant:"ghost",className:"mb-3 h-9 w-full justify-start gap-2 px-3 text-sm",onClick:()=>g?.({type:"create-agent"}),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"size-4","aria-hidden":"true"}),p.newAgent]}):null,jsxRuntime.jsx("h3",{className:"mb-2 px-3 text-xs font-medium text-muted-foreground",children:p.allAgents}),jsxRuntime.jsx(is,{status:e.agents.status,empty:p.emptyAgents,noResults:p.noResults,hasItems:P.length>0,query:A,error:e.agents.error,onRetry:()=>g?.({type:"retry-agents"})}),jsxRuntime.jsx("div",{className:"space-y-1",children:P.map(b=>jsxRuntime.jsxs("div",{"aria-current":b.id===e.selectedAgentItem?"page":void 0,className:d("group flex w-full min-w-0 items-center gap-3 rounded-lg border border-transparent px-3 py-2 text-left hover:bg-muted aria-[current=page]:border-primary aria-[current=page]:bg-muted",u?.item),children:[jsxRuntime.jsxs("button",{type:"button",title:b.name,className:"flex min-w-0 flex-1 items-center gap-3 text-left",onClick:()=>g?.({type:"select-agent",itemId:b.id}),children:[jsxRuntime.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted",children:jsxRuntime.jsx(ss,{item:b})}),jsxRuntime.jsxs("span",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("span",{className:"block truncate text-sm font-medium",children:b.name}),jsxRuntime.jsx("span",{className:"block truncate text-xs text-foreground/80",children:b.description||p.noDescription})]})]}),b.builtIn?jsxRuntime.jsx("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-1 text-[10px] text-foreground",children:p.builtIn}):null,e.capabilities.pinAgents?jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon","aria-label":b.pinned?p.unpin:p.pin,className:d("size-8 text-muted-foreground opacity-0 group-hover:opacity-100",b.pinned&&"text-primary opacity-100"),onClick:s=>{s.stopPropagation(),g?.({type:"toggle-agent-pin",itemId:b.id,pinned:!b.pinned});},onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),s.stopPropagation(),g?.({type:"toggle-agent-pin",itemId:b.id,pinned:!b.pinned}));},children:jsxRuntime.jsx(lucideReact.Pin,{className:d("size-4",b.pinned&&"fill-current",b.pinPending&&"animate-pulse")})}):null]},b.id))})]}):null,m?jsxRuntime.jsxs(be,{value:"sessions","data-agent-workbench-scroll-region":true,className:d("mt-0 min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain px-4 pb-4",u?.body),children:[v.has("new-session")&&e.capabilities.createSession?jsxRuntime.jsx(Bt,{label:p.newSession,onClick:()=>g?.({type:"create-session"})}):null,!x&&e.capabilities.manageCapabilities?jsxRuntime.jsxs(W,{type:"button",variant:"ghost",className:"mb-3 h-9 w-full justify-start gap-2 px-3 text-sm",onClick:()=>g?.({type:"open-capabilities"}),children:[jsxRuntime.jsx(lucideReact.Blocks,{className:"size-4","aria-hidden":"true"}),p.capabilities]}):null,jsxRuntime.jsx(Ht,{sessions:E,selectedSessionId:e.selectedSessionItem,status:e.sessions.status,error:e.sessions.error,query:A,emptyLabel:p.emptySessions,noResultsLabel:p.noResults,groupByMode:x,showHeading:!x,itemClassName:u?.item,capabilities:{pin:e.capabilities.pinSessions,rename:e.capabilities.renameSessions,delete:e.capabilities.deleteSessions},onSelect:b=>g?.({type:"select-session",sessionId:b}),onTogglePin:(b,s)=>g?.({type:"toggle-session-pin",sessionId:b,pinned:s}),onRename:(b,s)=>g?.({type:"rename-session",sessionId:b,title:s}),onDelete:b=>g?.({type:"delete-session",sessionId:b}),onRetry:()=>g?.({type:"retry-sessions"})})]}):null]})})}a(ls,"AgentWorkbenchSidebar");function Do({item:e,src:t=e.imageUrl,className:n,onError:o}){if(!t)return null;let r=e.mediaVariant??"cover",i=r==="logo",l=r==="cover-with-label",u=e.mediaTreatment==="monochrome-light"?"brightness-0 invert":e.mediaTreatment==="invert"?"invert":"";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:d(i?"flex size-full items-center justify-center bg-[hsl(var(--monkeys-color-media-surface))] p-token-xl":"block size-full",n),children:jsxRuntime.jsx("img",{src:t,alt:"",className:d("transition-transform duration-300 group-hover/explore-card:scale-[1.03]",i?"max-h-full max-w-full object-contain":"size-full object-cover",u),onError:o})}),l?jsxRuntime.jsxs("span",{className:"pointer-events-none absolute inset-x-0 bottom-0 text-[hsl(var(--monkeys-color-media-foreground))]",style:{paddingInline:"var(--global-spacing, 0.75rem)",paddingBottom:"var(--global-spacing-sm, 0.5rem)",paddingTop:"var(--global-spacing-2xl, 1.5rem)",backgroundImage:"linear-gradient(to top, hsl(var(--monkeys-color-media-overlay) / 0.8), hsl(var(--monkeys-color-media-overlay) / 0.3), transparent)"},children:[jsxRuntime.jsx("span",{className:"block text-base font-semibold",children:e.title}),e.subtitle?jsxRuntime.jsx("span",{className:"block text-xs opacity-75",style:{marginTop:"calc(var(--global-spacing, 0.75rem) / 6)"},children:e.subtitle}):null]}):null]})}a(Do,"AgentWorkbenchExploreCardMedia");function ms({sessions:e,groups:t,config:n,labels:o,selectedSessionId:r,searchQuery:i="",loading:l=false,error:u,showDraftSession:g=!r,deleteSessions:p=false,variant:c="default",defaultGroupId:v,header:x,footer:k,className:m,renderItemMedia:A,onIntent:P}){let E=ne.useMemo(()=>monkeys.resolveAgentWorkbenchSidebarConfig(n),[n]),b=ne.useMemo(()=>new Set(E.visibleSections),[E.visibleSections]),s=t?.length?t:E.groups,y=v??E.defaultGroupId,[C,F]=ne.useState(y??s[0]?.id??""),Q=s.find(M=>M.id===C)??s[0],K=i.trim().toLocaleLowerCase(),le=g&&(!K||o.draftSession.toLocaleLowerCase().includes(K)),J=ne.useMemo(()=>e.filter(M=>!K||M.title.toLocaleLowerCase().includes(K)),[K,e]);ne.useEffect(()=>{s.some(M=>M.id===C)||F(y??s[0]?.id??"");},[C,s,y]);let ge=a(M=>{F(M),P?.({type:"change-group",groupId:M});},"changeGroup"),ke=b.has("groups")&&Q?jsxRuntime.jsx("div",{className:"border-t border-border px-4 pb-4 pt-3",children:jsxRuntime.jsxs(Se,{value:Q.id,onValueChange:ge,children:[jsxRuntime.jsx(Ce,{className:"grid h-10 w-full rounded-[var(--radius)] bg-muted p-0.5 text-foreground",style:{gridTemplateColumns:`repeat(${s.length}, minmax(0, 1fr))`},children:s.map(M=>jsxRuntime.jsx(ye,{value:M.id,className:"rounded-md text-sm font-semibold text-foreground data-[state=active]:border data-[state=active]:border-border data-[state=active]:bg-background",children:M.label},M.id))}),s.map(M=>jsxRuntime.jsx(be,{value:M.id,className:"mt-3",children:jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:M.items.map(w=>jsxRuntime.jsx("button",{type:"button","aria-label":w.title,className:"group/explore-card relative aspect-[1.27] overflow-hidden rounded-[var(--radius)] border border-border bg-card text-left transition hover:border-primary focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",style:Number.isFinite(M.itemAspectRatio)&&Number(M.itemAspectRatio)>0?{aspectRatio:M.itemAspectRatio}:void 0,onClick:()=>P?.({type:"select-item",groupId:M.id,item:w}),children:A?.(w,M)??jsxRuntime.jsx(Do,{item:w})},w.id))})},M.id))]})}):void 0;return jsxRuntime.jsx(Je,{"data-sidebar-style":"explore","data-sidebar-width-percent":E.widthPercent,"aria-label":o.navigation,variant:c,density:c==="trend"?"compact":void 0,header:b.has("header")?x:void 0,search:b.has("search")?jsxRuntime.jsx(Ot,{value:i,label:o.search,variant:c,onChange:M=>P?.({type:"change-search",query:M})}):void 0,primaryAction:b.has("new-session")?jsxRuntime.jsx(Bt,{label:o.newSession,variant:c,onClick:()=>P?.({type:"create-session"})}):void 0,groups:ke,footer:b.has("footer")?k:void 0,bodyProps:{"data-agent-workbench-session-scroll-region":""},className:m,classNames:{body:"min-h-[160px] flex-[0_1_280px]"},children:b.has("sessions")?jsxRuntime.jsxs("div",{className:"space-y-2",children:[le?jsxRuntime.jsx("button",{type:"button","aria-current":"page",className:"block h-10 w-full min-w-0 truncate rounded-[var(--radius)] border border-primary bg-primary/10 px-3 text-left text-sm font-semibold text-foreground",onClick:()=>P?.({type:"create-session"}),children:o.draftSession}):null,J.length>0||!le||l||u?jsxRuntime.jsx(Ht,{sessions:J,selectedSessionId:r,status:u?"error":l?"loading":"ready",error:u,query:K,emptyLabel:o.emptySessions,noResultsLabel:o.noResults,retryLabel:o.retry,groupByMode:E.navigationMode!=="default",variant:c,capabilities:{delete:p},onSelect:M=>P?.({type:"select-session",sessionId:M}),onDelete:M=>P?.({type:"delete-session",sessionId:M}),onRetry:o.retry?()=>P?.({type:"retry-sessions"}):void 0}):null]}):null})}a(ms,"AgentWorkbenchExploreSidebar");var fs={reasoning:"reasoning",plan:"plan",task:"tasks",tool:"tools",approval:"approval",artifact:"artifacts",usage:"usage"};function bs(e){let t=e.filter(p=>p.eventType==="status"),n=t.at(-1);if(!n)return;if(n.payload.status!=="stopped"||n.payload.durationMs!==void 0)return n;let o=n.runId?t.filter(p=>p.runId===n.runId&&p.sequence<=n.sequence):t.filter(p=>p.sequence<=n.sequence),r=-1;for(let p=o.length-1;p>=0;p-=1){let c=o[p];if(c.sequence<n.sequence&&c.payload.status==="stopped"){r=p;break}}let i=o.slice(r+1).reverse().find(p=>p.payload.status==="running"||p.payload.status==="queued"),l=i?.payload.startedAt??i?.occurredAt,u=n.payload.stoppedAt??n.occurredAt;if(!l||!u)return n;let g=Date.parse(u)-Date.parse(l);return Number.isFinite(g)&&g>=0?{...n,resolvedDurationMs:g}:n}a(bs,"projectRun");function hs(e,t){let n=fs[e.eventType];return n?t[n]===true:true}a(hs,"isVisible");function Ze(e,t,n){let o=new Map;for(let r of e){if(r.eventType!==t)continue;let i=r;o.set(n(i),i);}return [...o.values()].sort((r,i)=>r.sequence-i.sequence)}a(Ze,"latestBy");function kn(e){let t=e.events.filter(n=>hs(n,e.snapshot.capabilities));return {mode:e.snapshot.mode,status:e.status,reasoning:Ze(t,"reasoning",n=>n.payload.reasoningId),plans:Ze(t,"plan",n=>n.payload.planId),tasks:Ze(t,"task",n=>n.payload.taskId),tools:Ze(t,"tool",n=>n.payload.toolCallId),approvals:Ze(t,"approval",n=>n.payload.approvalId),artifacts:Ze(t,"artifact",n=>n.payload.artifactId),usage:[...t].reverse().find(n=>n.eventType==="usage"),run:bs(t)}}a(kn,"createAgentWorkbenchActivityModel");function ks({value:e}){if(e===void 0)return null;let t=typeof e=="string"?e:JSON.stringify(e,null,2);return jsxRuntime.jsx("pre",{className:"max-h-48 max-w-full overflow-auto overscroll-contain whitespace-pre-wrap break-words rounded-md bg-muted p-3 font-mono text-xs text-foreground [overflow-wrap:anywhere]",tabIndex:0,children:t})}a(ks,"JsonValue");function An({approval:e,className:t,onDecision:n}){let o=L().agentWorkbench.approval,r=e.status==="requested",i=e.status==="approved";return jsxRuntime.jsx("article",{className:d("min-w-0 overflow-hidden rounded-lg border border-border bg-card p-3 text-card-foreground",t),"data-agent-approval-status":e.status,children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[r?jsxRuntime.jsx(lucideReact.Clock3,{className:"mt-0.5 size-4 shrink-0 text-warning-foreground","aria-hidden":"true"}):i?jsxRuntime.jsx(lucideReact.Check,{className:"mt-0.5 size-4 shrink-0 text-success","aria-hidden":"true"}):jsxRuntime.jsx(lucideReact.X,{className:"mt-0.5 size-4 shrink-0 text-destructive-text","aria-hidden":"true"}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("h3",{className:"break-words text-sm font-medium",children:e.title}),e.description?jsxRuntime.jsx("p",{tabIndex:0,className:"mt-1 max-h-32 overflow-auto whitespace-pre-wrap break-words text-sm text-muted-foreground [overflow-wrap:anywhere]",children:e.description}):null,e.requestedAction!==void 0?jsxRuntime.jsx("div",{className:"mt-3 min-w-0",children:jsxRuntime.jsx(ks,{value:e.requestedAction})}):null,r?jsxRuntime.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[jsxRuntime.jsx(W,{type:"button",size:"sm",className:"h-auto px-3 py-1.5 text-sm",disabled:!n,onClick:()=>n?.({approvalId:e.approvalId,approved:true}),children:o.approve}),jsxRuntime.jsx(W,{type:"button",variant:"outline",size:"sm",className:"h-auto px-3 py-1.5 text-sm",disabled:!n,onClick:()=>n?.({approvalId:e.approvalId,approved:false}),children:o.reject})]}):jsxRuntime.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:i?o.approved:o.rejected})]})]})})}a(An,"AgentWorkbenchApproval");function zo({value:e,className:t}){if(e===void 0)return null;let n=typeof e=="string"?e:JSON.stringify(e,null,2);return jsxRuntime.jsx("pre",{tabIndex:0,className:d("max-h-64 max-w-full overflow-auto overscroll-contain whitespace-pre-wrap break-words rounded-md bg-muted p-3 font-mono text-xs text-foreground [overflow-wrap:anywhere]",t),children:n})}a(zo,"JsonValue");function Ws({status:e}){L().agentWorkbench.tool.status;let n="size-3.5 shrink-0";return e==="pending"?jsxRuntime.jsx(lucideReact.Clock3,{className:n,"aria-hidden":"true"}):e==="running"?jsxRuntime.jsx(lucideReact.Loader2,{className:d(n,"animate-spin"),"aria-hidden":"true"}):e==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:d(n,"text-primary"),"aria-hidden":"true"}):jsxRuntime.jsx(lucideReact.XCircle,{className:d(n,"text-destructive-text"),"aria-hidden":"true"})}a(Ws,"ToolStatus");function Nn({event:e,expanded:t,defaultExpanded:n=e.payload.status==="failed",className:o,classNames:r,onExpandedChange:i}){let l=L().agentWorkbench.tool,[u,g]=ne.useState(n),p=t!==void 0,c=t??u,v=e.payload.status,x=a(k=>{p||g(k),i?.(k);},"setExpanded");return jsxRuntime.jsxs("details",{open:c,className:d("group min-w-0 overflow-hidden rounded-lg border border-border bg-card text-card-foreground",r?.root,o),"data-tool-status":v,children:[jsxRuntime.jsxs("summary",{className:d("flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 text-sm outline-hidden focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden",r?.trigger),onClick:k=>{k.preventDefault(),x(!c);},children:[jsxRuntime.jsx(lucideReact.TerminalSquare,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:e.payload.toolName}),jsxRuntime.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs text-foreground",children:[jsxRuntime.jsx(Ws,{status:v}),l.status[v]]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"size-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180","aria-hidden":"true"})]}),jsxRuntime.jsxs("div",{className:d("min-w-0 space-y-3 border-t border-border px-3 py-3 text-sm",r?.content),children:[e.payload.input!==void 0?jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:l.input}),jsxRuntime.jsx(zo,{value:e.payload.input,className:r?.input})]}):null,e.payload.output!==void 0?jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:l.output}),jsxRuntime.jsx(zo,{value:e.payload.output,className:r?.output})]}):null,e.payload.error?jsxRuntime.jsx("p",{tabIndex:0,className:"max-h-32 overflow-auto whitespace-pre-wrap break-words text-sm text-destructive-text [overflow-wrap:anywhere]",role:"alert",children:e.payload.error}):null]})]})}a(Nn,"AgentWorkbenchTool");function _s({artifact:e,label:t,onDownload:n}){let o=ne.useRef(false),[r,i]=ne.useState(false);return jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon","aria-label":t,title:t,disabled:r,className:"text-muted-foreground hover:text-foreground",onClick:async l=>{if(l.preventDefault(),l.stopPropagation(),!o.current){o.current=true,i(true);try{await n(e);}finally{o.current=false,i(false);}}},children:r?jsxRuntime.jsx(lucideReact.Loader2,{className:"size-4 animate-spin","aria-hidden":"true"}):jsxRuntime.jsx(lucideReact.Download,{className:"size-4","aria-hidden":"true"})})}a(_s,"ArtifactDownloadButton");function Sn({icon:e,title:t,open:n,streaming:o,className:r,triggerClassName:i,contentClassName:l,children:u}){return jsxRuntime.jsxs("details",{className:d("group min-w-0 overflow-hidden rounded-lg border border-border bg-card text-card-foreground",r),open:n,children:[jsxRuntime.jsxs("summary",{className:d("flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 text-sm font-medium outline-hidden focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden",i),children:[o?jsxRuntime.jsx(lucideReact.Loader2,{className:"size-4 shrink-0 animate-spin","aria-hidden":"true"}):jsxRuntime.jsx(e,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"size-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180","aria-hidden":"true"})]}),jsxRuntime.jsx("div",{className:d("min-w-0 border-t border-border px-3 py-3 text-sm",l),children:u})]})}a(Sn,"ActivityDetails");function Oo({status:e}){return e==="completed"||e==="passed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"size-4 text-success","aria-hidden":"true"}):e==="failed"?jsxRuntime.jsx(lucideReact.XCircle,{className:"size-4 text-destructive-text","aria-hidden":"true"}):e==="running"?jsxRuntime.jsx(lucideReact.Clock3,{className:"size-4 animate-pulse text-warning-foreground","aria-hidden":"true"}):jsxRuntime.jsx(lucideReact.Circle,{className:"size-4 text-muted-foreground","aria-hidden":"true"})}a(Oo,"StatusIcon");function Vs(e){if(e<1e3)return "<1s";let t=Math.floor(e/1e3),n=Math.floor(t/60),o=t%60;return n>0?`${n}m ${o}s`:`${o}s`}a(Vs,"formatDuration");function Us({event:e}){let t=L().agentWorkbench,n=e.payload.status;return n!=="stopping"&&n!=="stopped"?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",role:"status",children:[n==="stopping"?jsxRuntime.jsx(lucideReact.Loader2,{className:"size-4 animate-spin","aria-hidden":"true"}):jsxRuntime.jsx(lucideReact.CircleStop,{className:"size-4","aria-hidden":"true"}),jsxRuntime.jsx("span",{children:n==="stopping"?t.run.stopping:t.run.stoppedAfter({duration:Vs(e.payload.durationMs??e.resolvedDurationMs??0)})})]})}a(Us,"RunStatus");function Rn({viewModel:e,ariaLabel:t,hiddenToolCallIds:n,hideReasoning:o=false,hideStoppedRun:r=false,className:i,classNames:l,onApprovalDecision:u,onArtifactOpen:g,onArtifactDownload:p}){let c=L().agentWorkbench;if(!e)return null;let v=kn(e),x=o?[]:v.reasoning,k=v.tools.filter(s=>!n?.has(s.payload.toolCallId)),m=v.approvals.filter(s=>!s.payload.toolCallId||!n?.has(s.payload.toolCallId)),A=v.usage?.payload,P=typeof A?.contextWindow=="number"&&A.contextWindow>0?A.contextWindow:void 0,E=v.run?.payload.status==="stopping"||v.run?.payload.status==="stopped"&&!r;return x.length>0||v.plans.length>0||v.tasks.length>0||k.length>0||m.length>0||v.artifacts.length>0||E||P!==void 0?jsxRuntime.jsxs("section",{className:d("space-y-3",l?.root,i),"aria-label":t??c.label,"data-agent-workbench-mode":v.mode,"data-agent-workbench-status":v.status,children:[x.map(s=>jsxRuntime.jsx(Sn,{icon:lucideReact.Circle,title:c.reasoning,open:s.payload.status==="streaming",streaming:s.payload.status==="streaming",className:l?.item,triggerClassName:l?.trigger,contentClassName:l?.content,children:jsxRuntime.jsx("div",{tabIndex:0,className:"max-h-64 overflow-auto whitespace-pre-wrap break-words text-muted-foreground [overflow-wrap:anywhere]",children:s.payload.text})},s.payload.reasoningId)),v.plans.map(s=>jsxRuntime.jsx(Sn,{icon:lucideReact.Circle,title:s.payload.title||c.plan,open:s.payload.status==="running",streaming:s.payload.status==="running",className:l?.item,triggerClassName:l?.trigger,contentClassName:l?.content,children:jsxRuntime.jsx("ol",{className:"space-y-2",children:s.payload.steps.map(y=>jsxRuntime.jsxs("li",{className:"flex min-w-0 items-start gap-2",children:[jsxRuntime.jsx(Oo,{status:y.status}),jsxRuntime.jsx("span",{className:"min-w-0 break-words [overflow-wrap:anywhere]",children:y.title})]},y.id))})},s.payload.planId)),v.tasks.map(s=>jsxRuntime.jsx(Sn,{icon:lucideReact.Circle,title:s.payload.title,open:s.payload.status==="running",streaming:s.payload.status==="running",className:l?.item,triggerClassName:l?.trigger,contentClassName:l?.content,children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[jsxRuntime.jsx(Oo,{status:s.payload.status}),jsxRuntime.jsx("span",{className:"min-w-0 whitespace-pre-wrap break-words text-muted-foreground [overflow-wrap:anywhere]",children:s.payload.detail||c.taskNoDetail})]})},s.payload.taskId)),k.map(s=>jsxRuntime.jsx(Nn,{event:s,defaultExpanded:s.payload.status==="failed",classNames:{root:l?.item,trigger:l?.trigger,content:l?.content}},s.payload.toolCallId)),m.map(s=>jsxRuntime.jsx(An,{approval:s.payload,className:l?.approval,onDecision:u},s.payload.approvalId)),v.artifacts.map(s=>{let y=!!(s.payload.url&&g);return jsxRuntime.jsxs("article",{className:d("flex items-center gap-3 rounded-lg border border-border bg-card p-3 text-card-foreground",l?.artifact),children:[jsxRuntime.jsx(lucideReact.FileOutput,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:"truncate text-sm font-medium",children:s.payload.name}),jsxRuntime.jsx("div",{className:"text-xs text-muted-foreground",children:c.artifact[s.payload.status]})]}),s.payload.url?jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-foreground","aria-label":c.artifact.open({name:s.payload.name}),title:c.artifact.open({name:s.payload.name}),disabled:!y,onClick:C=>{C.preventDefault(),C.stopPropagation(),s.payload.url&&g?.({artifactId:s.payload.artifactId,name:s.payload.name,url:s.payload.url});},children:jsxRuntime.jsx(lucideReact.PanelRightOpen,{className:"size-4","aria-hidden":"true"})}):null,s.payload.url&&s.payload.status==="ready"&&p?jsxRuntime.jsx(_s,{artifact:{artifactId:s.payload.artifactId,name:s.payload.name,url:s.payload.url},label:c.artifactWorkspace.download({name:s.payload.name}),onDownload:p}):null]},s.payload.artifactId)}),E&&v.run?jsxRuntime.jsx(Us,{event:v.run}):null,A&&P!==void 0?jsxRuntime.jsx("div",{className:d("flex justify-end",l?.usage),"aria-label":c.usage.label,children:jsxRuntime.jsx("span",{className:"rounded-full border border-border bg-muted px-2.5 py-1 text-xs text-foreground",children:c.usage.context({used:A.contextTokens??A.totalTokens??0,total:P})})}):null]}):null}a(Rn,"AgentWorkbenchActivity");var qs={diff:"diff","workspace-file":"workspaceFiles",terminal:"terminal","test-result":"testResults",artifact:"artifacts"};function qt(e,t,n){let o=new Map;for(let r of e){if(r.eventType!==t)continue;let i=r;o.set(n(i),i);}return [...o.values()].sort((r,i)=>r.sequence-i.sequence)}a(qt,"latestBy");function Fs(e){let t=new Map;for(let n of e){let o=t.get(n.payload.terminalId)??{terminalId:n.payload.terminalId,stdin:"",stdout:"",stderr:"",status:"",sequence:n.sequence},r=n.payload.stream;t.set(n.payload.terminalId,{...o,...r==="status"?{status:n.payload.chunk}:{[r]:`${o[r]}${n.payload.chunk}`},...n.payload.exitCode===void 0?{}:{exitCode:n.payload.exitCode},sequence:n.sequence});}return [...t.values()].sort((n,o)=>n.sequence-o.sequence)}a(Fs,"projectTerminals");function Tn(e){let t=e.snapshot.capabilities,n=e.events.filter(l=>{let u=qs[l.eventType];return u?t[u]===true:false}),o=[...e.events].reverse().find(l=>l.eventType==="status"),r=o?.runId,i=[...e.events].reverse().find(l=>l.eventType==="summary"&&t.summary===true&&(!r||l.runId===r));return {mode:e.snapshot.mode,modelId:e.snapshot.modelId,permissionProfile:e.snapshot.permissionProfile,status:e.status,sessionId:e.sessionId,capabilities:t,resumable:t.resume===true&&e.resumable,summary:i,error:[...e.events].reverse().find(l=>l.eventType==="error"),run:o,usage:t.usage?[...e.events].reverse().find(l=>l.eventType==="usage"):void 0,workspace:{diffs:qt(n,"diff",l=>l.payload.path),files:qt(n,"workspace-file",l=>l.payload.path),terminals:Fs(n.filter(l=>l.eventType==="terminal")),tests:qt(n,"test-result",l=>l.payload.testId),artifacts:qt(n,"artifact",l=>l.payload.artifactId)}}}a(Tn,"createAgentWorkbenchDetailsModel");function Ho(e){if(e===void 0)return "-";let t=Math.max(0,Math.round(e/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}a(Ho,"formatDuration");function li(e,t){if(!e)return "-";let n=new Date(e);return Number.isNaN(n.getTime())?"-":new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"short"}).format(n)}a(li,"formatDate");function _o({value:e}){return jsxRuntime.jsx("span",{className:"rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-semibold text-foreground",children:e})}a(_o,"Count");function gt({title:e,count:t,icon:n,className:o,children:r}){return t===0?null:jsxRuntime.jsxs("details",{className:d("group rounded-lg border border-border bg-card text-card-foreground",o),open:true,children:[jsxRuntime.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 text-sm font-medium outline-hidden focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden",children:[jsxRuntime.jsx(n,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:"min-w-0 flex-1 truncate",children:e}),jsxRuntime.jsx(_o,{value:t}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"size-4 text-muted-foreground transition-transform group-open:rotate-180","aria-hidden":"true"})]}),jsxRuntime.jsx("div",{className:"border-t border-border p-3",children:r})]})}a(gt,"DetailsSection");function Vo({status:e}){return e==="completed"||e==="passed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"size-4 text-primary","aria-hidden":"true"}):e==="failed"?jsxRuntime.jsx(lucideReact.XCircle,{className:"size-4 text-destructive-text","aria-hidden":"true"}):e==="running"?jsxRuntime.jsx(lucideReact.Clock3,{className:"size-4 animate-pulse","aria-hidden":"true"}):jsxRuntime.jsx(lucideReact.Circle,{className:"size-4 text-muted-foreground","aria-hidden":"true"})}a(Vo,"StatusIcon");function Bo({state:e}){let t=L().agentWorkbench.details,n=e==="error";return jsxRuntime.jsxs("div",{className:"flex min-h-48 flex-col items-center justify-center gap-2 px-6 text-center",role:n?"alert":e==="loading"?"status":void 0,"aria-busy":e==="loading"||void 0,children:[e==="loading"?jsxRuntime.jsx(lucideReact.RefreshCw,{className:"size-5 animate-spin text-muted-foreground","aria-hidden":"true"}):n?jsxRuntime.jsx(lucideReact.AlertCircle,{className:"size-5 text-destructive-text","aria-hidden":"true"}):jsxRuntime.jsx(lucideReact.FileOutput,{className:"size-5 text-muted-foreground","aria-hidden":"true"}),jsxRuntime.jsx("div",{className:"text-sm font-medium",children:t.state[e].title}),jsxRuntime.jsx("div",{className:"text-xs text-muted-foreground",children:t.state[e].description})]})}a(Bo,"StateContent");function di({model:e,onIntent:t}){let n=L().agentWorkbench,o=n.details,r=dt().locale,i=e.summary,l=e.run?.payload,u=e.error,g=e.status==="failed"&&u?.payload.retryable,p=e.resumable&&["stopped","completed","failed"].includes(e.status),c=e.capabilities.threadForking,v=e.capabilities.editAndRerun,x=e.usage?.payload.totalTokens??(e.usage?.payload.inputTokens!==void 0||e.usage?.payload.outputTokens!==void 0?(e.usage.payload.inputTokens??0)+(e.usage.payload.outputTokens??0):void 0);return jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("section",{className:"rounded-lg border border-border bg-muted/40 p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Vo,{status:e.status}),jsxRuntime.jsx("span",{className:"text-sm font-semibold",children:o.status[e.status]})]}),jsxRuntime.jsxs("dl",{className:"mt-3 grid grid-cols-2 gap-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("dt",{className:"text-muted-foreground",children:o.duration}),jsxRuntime.jsx("dd",{className:"mt-0.5 font-medium",children:Ho(l?.durationMs)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("dt",{className:"text-muted-foreground",children:o.updated}),jsxRuntime.jsx("dd",{className:"mt-0.5 truncate font-medium",children:li(l?.stoppedAt??l?.completedAt??l?.failedAt,r)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("dt",{className:"text-muted-foreground",children:o.model}),jsxRuntime.jsx("dd",{className:"mt-0.5 truncate font-medium",children:e.modelId})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("dt",{className:"text-muted-foreground",children:o.mode}),jsxRuntime.jsx("dd",{className:"mt-0.5 font-medium",children:n.modes[e.mode]})]}),e.permissionProfile?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("dt",{className:"text-muted-foreground",children:o.permissions}),jsxRuntime.jsx("dd",{className:"mt-0.5 font-medium",children:n.composer.permissionOptions[e.permissionProfile]})]}):null,x!==void 0?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("dt",{className:"text-muted-foreground",children:o.tokenUsage}),jsxRuntime.jsx("dd",{className:"mt-0.5 font-medium",children:new Intl.NumberFormat(r).format(x)})]}):null]}),u?jsxRuntime.jsx("div",{className:"mt-3 rounded-md border border-destructive/30 bg-destructive/5 p-2.5 text-sm text-destructive-text",role:"alert",children:u.payload.message}):null,g||p?jsxRuntime.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[g?jsxRuntime.jsx(W,{type:"button",variant:"outline",size:"sm",className:"h-auto px-2.5 py-1.5 text-xs",disabled:!t,onClick:()=>t?.({type:"retry",eventId:u.eventId}),children:o.actions.retry}):null,p?jsxRuntime.jsx(W,{type:"button",size:"sm",className:"h-auto px-2.5 py-1.5 text-xs",disabled:!t,onClick:()=>t?.({type:"resume",sessionId:e.sessionId}),children:o.actions.resume}):null]}):null]}),jsxRuntime.jsxs("section",{className:"flex flex-wrap gap-2 rounded-lg border border-border bg-card p-3 text-card-foreground",children:[c?jsxRuntime.jsxs(W,{type:"button",variant:"outline",size:"sm",className:"h-auto gap-1.5 px-2.5 py-1.5 text-xs",disabled:!t,onClick:()=>t?.({type:"continue-in-new-task",sessionId:e.sessionId}),children:[jsxRuntime.jsx(lucideReact.GitFork,{className:"size-3.5","aria-hidden":"true"}),o.actions.continueInNewTask]}):null,v?jsxRuntime.jsxs(W,{type:"button",variant:"outline",size:"sm",className:"h-auto gap-1.5 px-2.5 py-1.5 text-xs",disabled:!t,onClick:()=>t?.({type:"edit-and-rerun",sessionId:e.sessionId}),children:[jsxRuntime.jsx(lucideReact.PencilLine,{className:"size-3.5","aria-hidden":"true"}),o.actions.editAndRerun]}):null,jsxRuntime.jsxs(W,{type:"button",variant:"outline",size:"sm",className:"h-auto gap-1.5 px-2.5 py-1.5 text-xs",disabled:!t,onClick:()=>t?.({type:"export",sessionId:e.sessionId}),children:[jsxRuntime.jsx(lucideReact.Download,{className:"size-3.5","aria-hidden":"true"}),o.actions.export]})]}),jsxRuntime.jsxs("section",{className:"rounded-lg border border-border bg-card p-3 text-card-foreground",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold",children:o.summary}),i?.payload.text?jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:"size-8 text-muted-foreground hover:text-foreground","aria-label":o.actions.copySummary,disabled:!t,onClick:()=>t?.({type:"copy-summary",summaryId:i.payload.summaryId,text:i.payload.text}),children:jsxRuntime.jsx(lucideReact.Copy,{className:"size-4","aria-hidden":"true"})}):null]}),i?.payload.status==="failed"?jsxRuntime.jsxs("div",{className:"mt-3 space-y-2",children:[jsxRuntime.jsx("p",{className:"text-sm text-destructive-text",role:"alert",children:o.summaryFailed}),jsxRuntime.jsxs(W,{type:"button",variant:"outline",size:"sm",className:"h-auto gap-1.5 px-2.5 py-1.5 text-xs",disabled:!t,onClick:()=>t?.({type:"retry-summary",eventId:i.eventId}),children:[jsxRuntime.jsx(lucideReact.RotateCcw,{className:"size-3.5","aria-hidden":"true"}),o.actions.retrySummary]})]}):i?.payload.text?jsxRuntime.jsxs("div",{className:"mt-3 space-y-3 text-sm",children:[jsxRuntime.jsx("p",{className:"whitespace-pre-wrap text-muted-foreground",children:i.payload.text}),i.payload.highlights.length>0?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h4",{className:"text-xs font-medium",children:o.highlights}),jsxRuntime.jsx("ul",{className:"mt-1 list-disc space-y-1 pl-5 text-muted-foreground",children:i.payload.highlights.map(k=>jsxRuntime.jsx("li",{children:k},k))})]}):null,i.payload.pendingItems.length>0?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h4",{className:"text-xs font-medium",children:o.pendingItems}),jsxRuntime.jsx("ul",{className:"mt-1 list-disc space-y-1 pl-5 text-muted-foreground",children:i.payload.pendingItems.map(k=>jsxRuntime.jsx("li",{children:k},k))})]}):null]}):jsxRuntime.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:o.summaryEmpty})]})]})}a(di,"SummaryPanel");function ci({model:e,sectionClassName:t,codeClassName:n}){let o=L().agentWorkbench.details.workspace,r=e.workspace;return jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx(gt,{title:o.diffs,count:r.diffs.length,icon:lucideReact.FileCode2,className:t,children:jsxRuntime.jsx("div",{className:"space-y-3",children:r.diffs.map(i=>jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[jsxRuntime.jsx("span",{className:"truncate font-medium",children:i.payload.path}),jsxRuntime.jsx("span",{className:"shrink-0 text-muted-foreground",children:o.diffStatus[i.payload.status]})]}),i.payload.patch?jsxRuntime.jsx("pre",{className:d("mt-2 max-h-72 overflow-auto whitespace-pre-wrap rounded-md bg-muted p-3 font-mono text-xs",n),children:i.payload.patch}):null]},i.payload.path))})}),jsxRuntime.jsx(gt,{title:o.files,count:r.files.length,icon:lucideReact.Files,className:t,children:jsxRuntime.jsx("ul",{className:"space-y-2 text-xs",children:r.files.map(i=>jsxRuntime.jsxs("li",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.FileOutput,{className:"size-3.5 text-muted-foreground","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:"min-w-0 flex-1 truncate",children:i.payload.path}),jsxRuntime.jsx("span",{className:"text-muted-foreground",children:o.fileOperation[i.payload.operation]})]},i.payload.path))})}),jsxRuntime.jsx(gt,{title:o.terminals,count:r.terminals.length,icon:lucideReact.TerminalSquare,className:t,children:jsxRuntime.jsx("div",{className:"space-y-3",children:r.terminals.map(i=>jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex justify-between gap-2 text-xs font-medium",children:[jsxRuntime.jsx("span",{children:i.terminalId}),jsxRuntime.jsx("span",{className:"text-muted-foreground",children:i.exitCode===void 0?i.status:o.exitCode({code:i.exitCode})})]}),jsxRuntime.jsx("pre",{className:d("mt-2 max-h-72 overflow-auto whitespace-pre-wrap rounded-md bg-muted p-3 font-mono text-xs",n),children:[i.stdin,i.stdout,i.stderr].filter(Boolean).join(`
|
|
57
57
|
`)})]},i.terminalId))})}),jsxRuntime.jsx(gt,{title:o.tests,count:r.tests.length,icon:lucideReact.TestTube2,className:t,children:jsxRuntime.jsx("ul",{className:"space-y-2 text-xs",children:r.tests.map(i=>jsxRuntime.jsxs("li",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Vo,{status:i.payload.status}),jsxRuntime.jsx("span",{className:"min-w-0 flex-1 truncate",children:i.payload.name}),i.payload.durationMs===void 0?null:jsxRuntime.jsx("span",{className:"text-muted-foreground",children:Ho(i.payload.durationMs)})]}),i.payload.output?jsxRuntime.jsx("pre",{className:d("mt-2 max-h-48 overflow-auto whitespace-pre-wrap rounded-md bg-muted p-3 font-mono text-xs",n),children:i.payload.output}):null]},i.payload.testId))})}),jsxRuntime.jsx(gt,{title:o.artifacts,count:r.artifacts.length,icon:lucideReact.FileOutput,className:t,children:jsxRuntime.jsx("ul",{className:"space-y-2 text-xs",children:r.artifacts.map(i=>jsxRuntime.jsxs("li",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.FileOutput,{className:"size-3.5 text-muted-foreground","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:"min-w-0 flex-1 truncate",children:i.payload.name}),jsxRuntime.jsx("span",{className:"text-muted-foreground",children:i.payload.kind})]},i.payload.artifactId))})})]})}a(ci,"WorkspacePanel");function pi({viewModel:e,state:t="ready",activeTab:n="summary",className:o,classNames:r,onActiveTabChange:i,onIntent:l,onExport:u,onCopySummary:g,onRetry:p,onRetrySummary:c}){let v=l||u||g||p||c?b=>{if(b.type==="export"&&u)return u(b);if(b.type==="copy-summary"&&g)return g(b);if(b.type==="retry"&&p)return p(b);if(b.type==="retry-summary"&&c)return c(b);l?.(b);}:void 0,x=L().agentWorkbench.details;if(t!=="ready")return jsxRuntime.jsx("aside",{className:d("flex h-full min-h-0 flex-col border-l border-border bg-background",r?.root,o),children:jsxRuntime.jsx(Bo,{state:t})});if(!e)return jsxRuntime.jsx("aside",{className:d("flex h-full min-h-0 flex-col border-l border-border bg-background",r?.root,o),children:jsxRuntime.jsx(Bo,{state:"empty"})});let k=Tn(e),m=Object.values(k.workspace).reduce((b,s)=>b+s.length,0),A=m>0,P=n==="workspace"&&!A?"summary":n,E=[{id:"summary",label:x.tabs.summary,count:k.summary?1:0},...A?[{id:"workspace",label:x.tabs.workspace,count:m}]:[]];return jsxRuntime.jsxs("aside",{className:d("flex h-full min-h-0 min-w-0 flex-col border-l border-border bg-background text-foreground",r?.root,o),"data-agent-workbench-mode":k.mode,children:[jsxRuntime.jsxs("header",{className:d("flex shrink-0 items-center gap-2 border-b border-border px-4 py-3",r?.header),children:[jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("h2",{className:"truncate text-sm font-semibold",children:x.title}),jsxRuntime.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:x.description})]}),l?jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-foreground","aria-label":x.actions.close,onClick:()=>l({type:"close"}),children:jsxRuntime.jsx(lucideReact.X,{className:"size-4","aria-hidden":"true"})}):null]}),jsxRuntime.jsxs(Se,{value:P,className:"flex min-h-0 flex-1 flex-col",onValueChange:b=>i?.(b),children:[jsxRuntime.jsx(Ce,{"aria-label":x.tabs.label,className:d("flex h-auto shrink-0 gap-1 rounded-none border-b border-border bg-transparent px-3 py-2",r?.tabs),children:E.map(b=>jsxRuntime.jsxs(ye,{value:b.id,className:"min-w-0 flex-1 gap-1 px-2 py-1.5 text-xs shadow-none data-[state=active]:bg-primary/10 data-[state=active]:text-primary data-[state=active]:shadow-none",children:[jsxRuntime.jsx("span",{className:"truncate",children:b.label}),jsxRuntime.jsx(_o,{value:b.count})]},b.id))}),jsxRuntime.jsx(be,{value:"summary",className:d("mt-0 min-h-0 flex-1 overflow-y-auto p-3",r?.body),children:jsxRuntime.jsx(di,{model:k,onIntent:v})}),A?jsxRuntime.jsx(be,{value:"workspace",className:d("mt-0 min-h-0 flex-1 overflow-y-auto p-3",r?.body),children:jsxRuntime.jsx(ci,{model:k,sectionClassName:r?.section,codeClassName:r?.code})}):null]})]})}a(pi,"AgentWorkbenchTaskDetails");var Wn=ne.forwardRef(a(function({role:t,className:n,...o},r){return jsxRuntime.jsx("div",{...o,ref:r,"data-agent-message-role":t,className:d("group flex w-full max-w-[95%] min-w-0 flex-col gap-2",t==="user"?"is-user ml-auto justify-end":"is-assistant",t==="system"&&"mx-auto items-center text-center",n)})},"AgentWorkbenchMessage")),Mn=ne.forwardRef(a(function({children:t,className:n,tabIndex:o=0,...r},i){return jsxRuntime.jsx("div",{...r,ref:i,tabIndex:o,className:d("flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-x-auto overflow-y-hidden break-words text-sm [overflow-wrap:anywhere]","[&_a]:max-w-full [&_a]:break-all [&_code]:max-w-full [&_code]:break-words","[&_pre]:w-max [&_pre]:min-w-full [&_pre]:whitespace-pre [&_pre_code]:break-normal","[&_table]:w-max [&_table]:min-w-full [&_table]:whitespace-nowrap","group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground","group-[.is-assistant]:text-foreground",n),children:t})},"AgentWorkbenchMessageContent")),ui=ne.forwardRef(a(function({children:t,className:n,...o},r){return jsxRuntime.jsx("div",{...o,ref:r,className:d("flex min-w-0 items-center gap-1",n),children:t})},"AgentWorkbenchMessageActions")),mi=ne.forwardRef(a(function({children:t,label:n,tooltip:o,className:r,disabled:i=false,type:l="button",...u},g){return jsxRuntime.jsx("button",{...u,ref:g,type:l,"aria-label":n,title:o,disabled:i,className:d("inline-flex size-8 shrink-0 items-center justify-center rounded-md border-0 bg-transparent text-muted-foreground shadow-none transition-colors","hover:bg-muted hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0",r),children:t})},"AgentWorkbenchMessageAction"));function hi(e){let t=new Map;for(let n of e){if(n.eventType!=="message")continue;let o=t.get(n.payload.messageId),r=n.payload.operation==="replace"?n.payload.parts:[...o?.parts??[],...n.payload.parts];t.set(n.payload.messageId,{id:n.payload.messageId,role:n.payload.role,parts:r,sequence:n.sequence});}return [...t.values()]}a(hi,"materializeMessages");function vi(e){switch(e.eventType){case "reasoning":return `reasoning:${e.payload.reasoningId}`;case "plan":return `plan:${e.payload.planId}`;case "task":return `task:${e.payload.taskId}`;case "tool":return `tool:${e.payload.toolCallId}`;case "approval":return `approval:${e.payload.approvalId}`;case "artifact":return `artifact:${e.payload.artifactId}`;case "usage":return "usage";case "status":return "status";default:return}}a(vi,"logicalActivityKey");function yi(e){let t=hi(e.events).map(o=>({type:"message",sequence:o.sequence,message:o})),n=new Map;for(let o of e.events){let r=vi(o);r&&n.set(r,o);}return [...t,...e.events.filter(o=>o.eventType==="error").map(o=>({type:"error",sequence:o.sequence,event:o})),...[...n.values()].map(o=>({type:"activity",sequence:o.sequence,event:o}))].sort((o,r)=>o.sequence-r.sequence)}a(yi,"createThreadEntries");function xi(e){if(typeof e=="string")return e;if(!e||typeof e!="object"||Array.isArray(e))return String(e??"");let t=e;return typeof t.text=="string"?t.text:typeof t.name=="string"?t.name:JSON.stringify(t,null,2)}a(xi,"partText");function Uo({message:e}){let t=e.parts.map(xi).filter(Boolean).join("");return jsxRuntime.jsx("div",{className:"whitespace-pre-wrap break-words",children:t})}a(Uo,"DefaultMessageContent");function ki(e,t){return {...e,events:[t],lastSequence:t.sequence}}a(ki,"singleEventViewModel");function wi({viewModel:e,loading:t=false,emptyTitle:n,emptyDescription:o,autoScroll:r=true,className:i,classNames:l,renderMessageContent:u,onApprovalDecision:g,onArtifactOpen:p}){let c=L().agentWorkbench,v=n??c.navigation.emptySessions,x=ne.useRef(null),k=ne.useMemo(()=>e?yi(e):[],[e]);return ne.useEffect(()=>{if(!r||!e)return;let m=x.current;m&&(m.scrollTop=m.scrollHeight);},[r,e?.lastSequence,e?.sessionId]),jsxRuntime.jsx("div",{ref:x,role:"log","aria-label":c.label,className:d("min-h-0 flex-1 overflow-y-auto bg-background",l?.root,i),children:t&&k.length===0?jsxRuntime.jsxs("div",{className:d("flex min-h-48 items-center justify-center gap-2 text-sm text-muted-foreground",l?.loading),role:"status",children:[jsxRuntime.jsx("span",{className:"size-4 animate-spin rounded-full border-2 border-muted-foreground/30 border-t-muted-foreground","aria-hidden":"true"}),jsxRuntime.jsx("span",{children:c.navigation.loading})]}):k.length===0?jsxRuntime.jsxs("div",{className:d("flex min-h-48 flex-col items-center justify-center px-6 text-center",l?.empty),children:[jsxRuntime.jsx("h2",{className:"text-base font-semibold text-foreground",children:v}),o?jsxRuntime.jsx("p",{className:"mt-1 max-w-lg text-sm text-muted-foreground",children:o}):null]}):jsxRuntime.jsx("div",{className:d("mx-auto flex w-full max-w-4xl flex-col gap-4 px-4 py-6 sm:px-6",l?.list),children:k.map(m=>{if(m.type==="error")return jsxRuntime.jsx("div",{role:"alert",className:d("rounded-lg border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive-text",l?.activity),children:m.event.payload.message},`error:${m.event.eventId}`);if(m.type==="activity")return jsxRuntime.jsx(Rn,{viewModel:ki(e,m.event),ariaLabel:`${c.label} ${m.sequence+1}`,className:l?.activity,onApprovalDecision:g,onArtifactOpen:p},`activity:${m.event.eventId}`);let{message:A}=m,P=A.role==="user";return A.role==="system"?jsxRuntime.jsx("div",{className:d("text-center text-xs text-muted-foreground",l?.message),children:u?.(A)??jsxRuntime.jsx(Uo,{message:A})},A.id):jsxRuntime.jsxs(Wn,{role:A.role,className:d("flex-row items-start gap-3",P&&"flex-row-reverse",l?.message),"data-message-role":A.role,children:[jsxRuntime.jsx("span",{className:d("flex size-8 shrink-0 items-center justify-center rounded-full",P?"bg-primary text-primary-foreground":"bg-muted text-foreground"),"aria-hidden":"true",children:jsxRuntime.jsx("span",{className:"size-2 rounded-full bg-current"})}),jsxRuntime.jsx(Mn,{className:d("max-w-[85%] rounded-2xl px-4 py-2.5 text-sm leading-6",!P&&"bg-card text-card-foreground",l?.messageContent),children:u?.(A)??jsxRuntime.jsx(Uo,{message:A})})]},A.id)})})})}a(wi,"AgentWorkbenchThread");var Ni=ne.forwardRef(a(function({children:t,title:n,headerActions:o,showHeader:r=!!(n||o),variant:i,density:l,className:u,classNames:g,...p},c){let v=fe({variant:i,density:l}),x=v.density==="compact";return jsxRuntime.jsxs("section",{...p,ref:c,"data-agent-thread-shell":"true","data-agent-workbench-variant":v.variant,"data-agent-workbench-density":v.density,className:d("flex h-full min-h-0 min-w-0 flex-col bg-background text-foreground",g?.root,u),children:[r?jsxRuntime.jsxs("div",{className:d("flex min-w-0 items-center justify-between border-b border-border",x?"min-h-10 gap-2 px-3 py-1.5":"min-h-11 gap-3 px-4 py-2",g?.header),children:[jsxRuntime.jsx("h1",{className:d("min-w-0 flex-1 truncate font-normal text-foreground",x?"text-base leading-5":"text-lg leading-6",g?.title),children:n}),o?jsxRuntime.jsx("div",{className:d("flex min-w-0 shrink-0 items-center gap-0.5",g?.headerActions),children:o}):null]}):null,jsxRuntime.jsx("div",{className:d("flex min-h-0 min-w-0 flex-1 flex-col",g?.body),children:t})]})},"AgentWorkbenchThreadShell"));var Dn=Object.freeze({mobile:768,drawer:1200,compact:1440,lowHeight:768});function $o(e,t=Dn){return e<t.mobile?"mobile":e<t.drawer?"drawer":e<t.compact?"compact":"wide"}a($o,"resolveAgentWorkbenchShellLayout");var Ln="monkeys-agent-workbench-overlay-open";function Fo(e){return typeof e=="number"?`${e}px`:e}a(Fo,"cssSize");function Gt(e,t,n){return Math.min(Math.max(e,t),Math.max(t,n))}a(Gt,"clamp");function jo(){return typeof window>"u"?{width:1440,height:900}:{width:window.visualViewport?.width??window.innerWidth,height:window.visualViewport?.height??window.innerHeight}}a(jo,"initialMeasuredSize");function Wi(e){if(!e||typeof window>"u")return {};try{let t=JSON.parse(window.localStorage.getItem(e)??"{}");return typeof t=="object"&&t!==null?t:{}}catch{return {}}}a(Wi,"readStoredWidths");function Mi(e,t){!e||typeof window>"u"||window.localStorage.setItem(e,JSON.stringify(t));}a(Mi,"writeStoredWidths");function Pi({sidebar:e,children:t,details:n,sidebarOpen:o=true,sidebarDefaultOpen:r=true,detailsOpen:i=true,onDetailsOpenChange:l,sidebarWidth:u=280,detailsWidth:g=360,sidebarMinWidth:p=240,sidebarMaxWidth:c=400,detailsMinWidth:v=320,detailsMaxWidth:x=720,mainMinWidth:k=600,responsive:m=false,responsiveMeasurement:A="container",responsiveWidth:P,responsiveHeight:E,breakpoints:b=Dn,onLayoutChange:s,showResponsiveControls:y=true,overlayGroupId:C,resizable:F=false,widthStorageKey:Q,onSidebarWidthChange:K,onDetailsWidthChange:le,labels:J,variant:ge,density:ke,className:M,classNames:w,style:Z,..._}){let Ve=fe({variant:ge,density:ke}),rt=ne.useRef(null),f=ne.useRef(null),z=ne.useRef(null),X=ne.useId(),[Ge,On]=ne.useState(jo),Ke=ne.useMemo(()=>Wi(Q),[Q]),[Ie,Bn]=ne.useState(()=>typeof u=="number"?Ke.sidebar??u:280),[Ee,Hn]=ne.useState(()=>typeof g=="number"?Ke.details??g:360),[_n,bt]=ne.useState(false),[Vn,at]=ne.useState(false),[ht,Un]=ne.useState(r),vt=ne.useCallback((N,j=document.activeElement)=>{if(!(j instanceof HTMLElement)||j===document.body||j===document.documentElement)return;let Y=N==="sidebar"?f:z;Y.current=j;},[]),qn=ne.useCallback(N=>{let j=N==="sidebar"?f:z,Y=j.current;j.current=null,Y?.isConnected&&window.requestAnimationFrame(()=>{Y.isConnected&&Y.focus();});},[]);ne.useEffect(()=>{typeof u=="number"&&Bn(Ke.sidebar??u);},[u,Ke.sidebar]),ne.useEffect(()=>Un(r),[r]),ne.useEffect(()=>{typeof g=="number"&&Hn(Ke.details??g);},[g,Ke.details]),ne.useEffect(()=>{if(!m)return;let N=a(()=>{let Te=jo();On({width:P??Te.width,height:E??Te.height});},"updateViewport");if(A==="viewport"||P!==void 0||E!==void 0)return N(),P!==void 0&&E!==void 0?void 0:(window.addEventListener("resize",N),window.visualViewport?.addEventListener("resize",N),()=>{window.removeEventListener("resize",N),window.visualViewport?.removeEventListener("resize",N);});let j=rt.current;if(!j)return;let Y=a(()=>{let Te=j.getBoundingClientRect();On({width:Te.width,height:Te.height});},"updateContainer");if(Y(),typeof ResizeObserver>"u")return window.addEventListener("resize",Y),()=>window.removeEventListener("resize",Y);let de=new ResizeObserver(Y);return de.observe(j),()=>de.disconnect()},[m,E,A,P]);let Le=m?$o(P??Ge.width,b):"wide",Fn=m&&(E??Ge.height)<=b.lowHeight;ne.useEffect(()=>s?.(Le),[Le,s]);let Qe=e!==void 0&&o,st=n!==void 0&&i,Kt=Le==="drawer"||Le==="mobile",Re=Qe&&ht&&!Kt,we=st&&Le==="wide",yt=Math.max(p,Math.min(c,Le==="compact"?320:c,Ge.width-(we?Ee:0)-k)),xt=Math.max(v,Math.min(x,Ge.width-(Re?Ie:0)-k)),jn=typeof u=="number"?Gt(Ie,p,yt):u,$n=typeof g=="number"?Gt(Ee,v,xt):g,kt=ne.useCallback(N=>{!C||typeof window>"u"||window.dispatchEvent(new CustomEvent(Ln,{detail:{groupId:C,ownerId:X,region:N}}));},[C,X]);ne.useEffect(()=>{if(!C||typeof window>"u")return;let N=a(j=>{let Y=j.detail;Y?.groupId!==C||Y?.ownerId===X||(bt(false),at(de=>(de&&l?.(false),false)));},"handleOverlayOpen");return window.addEventListener(Ln,N),()=>window.removeEventListener(Ln,N)},[l,C,X]),ne.useEffect(()=>{(Re||!Qe)&&bt(false);},[Qe,Re]),ne.useEffect(()=>{if(we||!st){at(false);return}vt("details"),kt("details"),at(true);},[st,we,vt,kt]);let wt=ne.useCallback((N,j)=>{Mi(Q,{sidebar:N,details:j});},[Q]),At=ne.useCallback((N,j)=>{if(N==="sidebar"){let de=Gt(j,p,yt);return Bn(de),K?.(de),de}let Y=Gt(j,v,xt);return Hn(Y),le?.(Y),Y},[v,le,K,xt,yt,p]),Gn=ne.useCallback((N,j)=>{if(!F||j.button!==0)return;j.preventDefault();let Y=j.clientX,de=N==="sidebar"?Ie:Ee,Te=de,ar=document.body.style.cursor,sr=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";let Xn=a(ir=>{let Zn=ir.clientX-Y;Te=At(N,de+(N==="sidebar"?Zn:-Zn));},"handleMove"),Jn=a(()=>{document.body.style.cursor=ar,document.body.style.userSelect=sr,window.removeEventListener("pointermove",Xn),window.removeEventListener("pointerup",Jn),wt(N==="sidebar"?Te:Ie,N==="details"?Te:Ee);},"handleUp");window.addEventListener("pointermove",Xn),window.addEventListener("pointerup",Jn,{once:true});},[Ee,wt,F,Ie,At]),Kn=ne.useCallback((N,j)=>{let de=At(N,(N==="sidebar"?Ie:Ee)+j*16);wt(N==="sidebar"?de:Ie,N==="details"?de:Ee);},[Ee,wt,Ie,At]),or={"--agent-workbench-sidebar-width":Re?Fo(jn):"0px","--agent-workbench-details-width":we?Fo($n):"0px",gridTemplateColumns:Re&&we?"var(--agent-workbench-sidebar-width) minmax(0, 1fr) var(--agent-workbench-details-width)":Re?"var(--agent-workbench-sidebar-width) minmax(0, 1fr)":we?"minmax(0, 1fr) var(--agent-workbench-details-width)":"minmax(0, 1fr)",...Z},Nt=Qe&&Kt,St=Qe&&!ht&&!Kt,Ct=st&&!we,rr=m&&y&&(Nt||St||Ct),Rt=Le==="mobile",Qn=Rt?"size-11":"size-9",Yn=Rt?"[&>button]:flex [&>button]:size-11 [&>button]:items-center [&>button]:justify-center":"";return jsxRuntime.jsxs("div",{..._,ref:rt,role:_.role??"region","aria-label":_["aria-label"]??"Agent workbench","data-agent-workbench-shell":"true","data-agent-workbench-variant":Ve.variant,"data-agent-workbench-density":Ve.density,"data-agent-workbench-layout":Le,"data-agent-workbench-low-height":Fn?"true":"false","data-sidebar-open":Qe?"true":"false","data-sidebar-expanded":ht?"true":"false","data-sidebar-presentation":Re?"inline":Nt?"overlay":"hidden","data-details-open":st?"true":"false","data-details-presentation":we?"inline":Ct?"overlay":"hidden",className:d("relative grid size-full min-h-0 min-w-0 overflow-hidden bg-background text-foreground",w?.root,M),style:or,children:[Re?jsxRuntime.jsx("div",{"data-agent-workbench-region":"sidebar",className:d("min-h-0 min-w-0 overflow-hidden border-r border-border bg-card text-card-foreground",w?.sidebar),children:e}):null,jsxRuntime.jsxs("div",{"data-agent-workbench-region":"main",className:d("flex min-h-0 min-w-0 flex-col overflow-hidden bg-background",w?.main),children:[rr?jsxRuntime.jsxs("div",{"data-agent-workbench-responsive-controls":"true",className:d("flex min-h-11 shrink-0 items-center gap-1 border-b border-border bg-background px-2",Fn&&"min-h-10",w?.controls),children:[Nt||St?jsxRuntime.jsx("button",{type:"button",className:d("inline-flex items-center justify-center rounded-[var(--radius)] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",Qn),"aria-label":J?.openSidebar??"Open navigation","aria-expanded":St?ht:_n,onClick:N=>{if(St){Un(true);return}vt("sidebar",N.currentTarget),kt("sidebar"),bt(true);},children:jsxRuntime.jsx(lucideReact.PanelLeft,{className:"size-5","aria-hidden":"true"})}):null,Ct&&n?jsxRuntime.jsx("button",{type:"button",className:d("ml-auto inline-flex items-center justify-center rounded-[var(--radius)] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",Qn),"aria-label":J?.openDetails??"Open details","aria-expanded":Vn,onClick:N=>{vt("details",N.currentTarget),kt("details"),at(true);},children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"size-5","aria-hidden":"true"})}):null]}):null,jsxRuntime.jsx("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:t})]}),we?jsxRuntime.jsx("div",{"data-agent-workbench-region":"details",className:d("min-h-0 min-w-0 overflow-hidden border-l border-border bg-card text-card-foreground",w?.details),children:n}):null,F&&Re&&typeof u=="number"?jsxRuntime.jsx("button",{type:"button",role:"separator","aria-orientation":"vertical","aria-label":J?.resizeSidebar??"Resize navigation","aria-valuemin":p,"aria-valuemax":yt,"aria-valuenow":Number(jn),className:d("absolute inset-y-0 z-20 w-2 -translate-x-1/2 cursor-col-resize touch-none bg-transparent outline-hidden after:absolute after:inset-y-0 after:left-1/2 after:w-px after:-translate-x-1/2 after:bg-border after:transition-colors hover:after:bg-primary focus-visible:after:w-0.5 focus-visible:after:bg-ring",w?.resizeHandle),style:{left:"var(--agent-workbench-sidebar-width)"},onPointerDown:N=>Gn("sidebar",N),onKeyDown:N=>{N.key!=="ArrowLeft"&&N.key!=="ArrowRight"||(N.preventDefault(),Kn("sidebar",N.key==="ArrowRight"?1:-1));}}):null,F&&we&&typeof g=="number"?jsxRuntime.jsx("button",{type:"button",role:"separator","aria-orientation":"vertical","aria-label":J?.resizeDetails??"Resize details","aria-valuemin":v,"aria-valuemax":xt,"aria-valuenow":Number($n),className:d("absolute inset-y-0 right-[var(--agent-workbench-details-width)] z-20 w-2 translate-x-1/2 cursor-col-resize touch-none bg-transparent outline-hidden after:absolute after:inset-y-0 after:left-1/2 after:w-px after:-translate-x-1/2 after:bg-border after:transition-colors hover:after:bg-primary focus-visible:after:w-0.5 focus-visible:after:bg-ring",w?.resizeHandle),onPointerDown:N=>Gn("details",N),onKeyDown:N=>{N.key!=="ArrowLeft"&&N.key!=="ArrowRight"||(N.preventDefault(),Kn("details",N.key==="ArrowLeft"?1:-1));}}):null,Nt?jsxRuntime.jsx(gn,{open:_n,onOpenChange:N=>{bt(N),N||qn("sidebar");},children:jsxRuntime.jsxs(Lt,{side:"left","aria-describedby":void 0,className:d("flex h-dvh flex-col gap-0 overflow-hidden bg-card p-0 text-card-foreground",Rt?"inset-0 size-dvw !max-w-none border-0":"w-[min(360px,90vw)] !max-w-none",Yn,w?.sidebarOverlay),children:[jsxRuntime.jsx(Dt,{className:"sr-only",children:J?.sidebar??"Navigation"}),jsxRuntime.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e})]})}):null,Ct?jsxRuntime.jsx(gn,{open:Vn,onOpenChange:N=>{at(N),N||(qn("details"),l?.(false));},children:jsxRuntime.jsxs(Lt,{side:"right","aria-describedby":void 0,className:d("flex h-dvh flex-col gap-0 overflow-hidden bg-card p-0 text-card-foreground",Rt?"inset-0 size-dvw !max-w-none border-0":"w-[min(520px,92vw)] !max-w-none",Yn,w?.detailsOverlay),children:[jsxRuntime.jsx(Dt,{className:"sr-only",children:J?.details??"Details"}),jsxRuntime.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:n})]})}):null]})}a(Pi,"AgentWorkbenchShell");function _i(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),o=Math.floor(t%3600/60),r=t%60;return n>0?o>0?`${n}h ${o}m`:`${n}h`:o===0?`${r}s`:`${o}m ${r}s`}a(_i,"formatDuration");function zn(e){return e==="queued"||e==="running"||e==="waiting_approval"}a(zn,"isActive");function Vi({status:e,children:t,durationMs:n,completedCount:o,totalCount:r,open:i,defaultOpen:l,onOpenChange:u,className:g,contentClassName:p,label:c,title:v,createdAt:x,showStatusIcon:k=true,variant:m,density:A}){let P=fe({variant:m,density:A}),E=P.density==="compact",b=L().agentWorkbench,s=i!==void 0,[y,C]=ne.useState(l??zn(e)),F=ne.useRef(false),Q=ne.useRef(e),K=s?i:y;ne.useEffect(()=>{s||F.current||Q.current===e||(Q.current=e,C(zn(e)));},[s,e]);let le=a(Ve=>{F.current=true,s||C(Ve),u?.(Ve);},"handleOpenChange"),J=n===void 0?void 0:_i(n),ge=c??(e==="queued"?b.process.queued:e==="waiting_approval"?b.process.waitingApproval:e==="running"?b.process.running:e==="failed"?b.process.failed:e==="stopped"?b.process.stopped:J?b.process.processedFor({duration:J}):b.process.processed),ke=r!==void 0&&r>0,M=v??ge,w=x?new Date(x):void 0,Z=w&&Number.isFinite(w.getTime())?w.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:false}):void 0,_=v!==void 0&&(Z!==void 0||c!==void 0);return jsxRuntime.jsxs(Me__namespace.Root,{open:K,onOpenChange:le,className:d("group/process w-full min-w-0",g),"data-agent-process-status":e,"data-agent-workbench-variant":P.variant,"data-agent-workbench-density":P.density,"aria-busy":zn(e)?"true":void 0,children:[jsxRuntime.jsxs(Me__namespace.Trigger,{className:d("flex w-full min-w-0 items-center gap-2 border-b border-border/70 text-left text-sm text-muted-foreground outline-hidden transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",E?"min-h-8 py-1.5":"min-h-9 py-2"),children:[k?e==="running"||e==="queued"?jsxRuntime.jsx(lucideReact.Loader2,{className:"size-4 shrink-0 animate-spin","aria-hidden":"true"}):e==="waiting_approval"?jsxRuntime.jsx(lucideReact.Clock3,{className:"size-4 shrink-0 text-warning-foreground","aria-hidden":"true"}):e==="failed"?jsxRuntime.jsx(lucideReact.CircleAlert,{className:"size-4 shrink-0 text-destructive-text","aria-hidden":"true"}):e==="completed"?jsxRuntime.jsx(lucideReact.Check,{className:"size-4 shrink-0 text-success","aria-hidden":"true"}):jsxRuntime.jsx(lucideReact.Clock3,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):null,jsxRuntime.jsx("span",{className:"min-w-0 flex-1 truncate",children:_?jsxRuntime.jsxs("span",{className:"flex min-w-0 flex-col",children:[jsxRuntime.jsxs("span",{className:"flex min-w-0 items-center gap-2 truncate",children:[jsxRuntime.jsx("span",{className:"truncate",children:M}),Z?jsxRuntime.jsx("span",{className:"shrink-0 text-xs text-muted-foreground/70",children:Z}):null]}),c?jsxRuntime.jsx("span",{className:"truncate text-xs text-muted-foreground/70",children:c}):null]}):ge}),ke?jsxRuntime.jsx("span",{className:"shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs text-foreground",children:b.process.completedCount({completed:o??0,total:r})}):null,jsxRuntime.jsx(lucideReact.ChevronRight,{className:"size-4 shrink-0 transition-transform group-data-[state=open]/process:rotate-90","aria-hidden":"true"})]}),jsxRuntime.jsx(Me__namespace.Content,{className:d("overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down",p),children:jsxRuntime.jsx("div",{className:d("flex min-w-0 flex-col",E?"gap-2 py-3":"gap-3 py-4"),children:t})})]})}a(Vi,"AgentWorkbenchProcess");var Ui={read:lucideReact.BookOpen,search:lucideReact.Search,tool:lucideReact.Wrench,command:lucideReact.TerminalSquare,file:lucideReact.FileText};function qi({status:e}){return e==="running"||e==="pending"?jsxRuntime.jsx(lucideReact.Loader2,{className:"size-3.5 shrink-0 animate-spin","aria-hidden":"true"}):e==="failed"||e==="denied"?jsxRuntime.jsx(lucideReact.CircleAlert,{className:"size-3.5 shrink-0 text-destructive-text","aria-hidden":"true"}):e==="completed"?jsxRuntime.jsx(lucideReact.Check,{className:"size-3.5 shrink-0","aria-hidden":"true"}):jsxRuntime.jsx(lucideReact.Circle,{className:"size-3.5 shrink-0","aria-hidden":"true"})}a(qi,"ActionStatusIcon");function Fi({summary:e,kind:t="tool",status:n="completed",children:o,open:r,defaultOpen:i=false,onOpenChange:l,icon:u,className:g,contentClassName:p}){let c=u??Ui[t],v=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(c,{className:"size-4 shrink-0","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:"min-w-0 flex-1 truncate",children:e}),jsxRuntime.jsx(qi,{status:n}),o?jsxRuntime.jsx(lucideReact.ChevronRight,{className:"size-3.5 shrink-0 transition-transform group-data-[state=open]/action:rotate-90","aria-hidden":"true"}):null]});return o?jsxRuntime.jsxs(Me__namespace.Root,{open:r,defaultOpen:i,onOpenChange:l,className:d("group/action min-w-0",g),"data-agent-action-status":n,children:[jsxRuntime.jsx(Me__namespace.Trigger,{className:"flex min-h-7 w-full min-w-0 items-center gap-2 text-left text-[13px] text-muted-foreground outline-hidden hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:v}),jsxRuntime.jsx(Me__namespace.Content,{className:"overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down",children:jsxRuntime.jsx("div",{className:d("ml-6 mt-2 min-w-0 border-l border-border pl-3",p),children:o})})]}):jsxRuntime.jsx("div",{className:d("flex min-h-7 min-w-0 items-center gap-2 text-[13px] text-muted-foreground",g),"data-agent-action-status":n,children:v})}a(Fi,"AgentWorkbenchAction");var ol={audio:lucideReact.Music2,file:lucideReact.File,html:lucideReact.FileCode2,image:lucideReact.FileImage,markdown:lucideReact.FileText,pdf:lucideReact.FileText,presentation:lucideReact.Presentation,video:lucideReact.Film,web:lucideReact.Globe2};function rl({artifact:e}){let[t,n]=ne.useState(false);if(e.status==="loading")return jsxRuntime.jsx("span",{className:"size-7 shrink-0 animate-pulse rounded bg-muted","aria-hidden":"true"});if(e.status==="error")return jsxRuntime.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded bg-destructive/10 text-destructive-text",children:jsxRuntime.jsx(lucideReact.TriangleAlert,{className:"size-4","aria-hidden":"true"})});if(e.thumbnailUrl&&!t)return jsxRuntime.jsx("img",{src:e.thumbnailUrl,alt:"",loading:"lazy",className:"size-7 shrink-0 rounded object-cover",onError:()=>n(true)});let o=ol[e.kind];return jsxRuntime.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded bg-muted text-muted-foreground",children:jsxRuntime.jsx(o,{className:"size-4","aria-hidden":"true"})})}a(rl,"ArtifactThumbnail");function er({title:e,artifacts:t,maxItems:n,onArtifactOpen:o}){return jsxRuntime.jsxs("section",{className:"flex min-w-0 flex-col gap-2",children:[jsxRuntime.jsx("div",{role:"heading","aria-level":2,className:"text-sm font-medium text-muted-foreground",children:e}),t.slice(0,n).map(r=>jsxRuntime.jsxs(W,{type:"button",variant:"ghost",className:"h-auto min-w-0 justify-start gap-2 px-0.5 py-0.5 text-left text-sm font-normal disabled:cursor-default",disabled:!o||r.status==="loading",onClick:()=>o?.(r),children:[jsxRuntime.jsx(rl,{artifact:r}),jsxRuntime.jsx("span",{className:"min-w-0 flex-1 truncate text-muted-foreground",children:r.name})]},r.id))]})}a(er,"ArtifactGroup");function al({artifacts:e,open:t,defaultOpen:n=false,maxItemsPerGroup:o=3,showAll:r=false,className:i,contentClassName:l,onOpenChange:u,onArtifactOpen:g,onViewAll:p}){let c=L().agentWorkbench.artifactWorkspace,v=e.filter(k=>k.origin==="output"),x=e.filter(k=>k.origin==="source");return e.length===0?null:jsxRuntime.jsxs(He__namespace.Root,{open:t,defaultOpen:n,onOpenChange:u,children:[jsxRuntime.jsx(He__namespace.Trigger,{type:"button",className:d("flex size-9 items-center justify-center rounded-xl bg-muted text-muted-foreground outline-hidden transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:text-foreground",i),"aria-label":c.toggleSummary,children:jsxRuntime.jsx(lucideReact.ListFilter,{className:"size-4","aria-hidden":"true"})}),jsxRuntime.jsxs(He__namespace.Content,{"aria-label":c.toggleSummary,side:"bottom",align:"end",sideOffset:8,collisionPadding:12,className:d("z-50 w-[min(22rem,calc(100vw-1.5rem))] rounded-3xl border border-border bg-popover p-4 text-popover-foreground shadow-xl outline-hidden",l),children:[jsxRuntime.jsxs("div",{className:"flex max-h-[min(34rem,calc(100vh-5rem))] min-w-0 flex-col gap-4 overflow-y-auto",children:[v.length>0?jsxRuntime.jsx(er,{title:c.outputs,artifacts:v,maxItems:r?v.length:o,onArtifactOpen:g}):null,v.length>0&&x.length>0?jsxRuntime.jsx("div",{className:"h-px bg-border"}):null,x.length>0?jsxRuntime.jsx(er,{title:c.sources,artifacts:x,maxItems:r?x.length:o,onArtifactOpen:g}):null,p&&!r&&(v.length>o||x.length>o)?jsxRuntime.jsxs(W,{type:"button",variant:"ghost",size:"sm",className:"min-h-8 gap-2 px-0 text-sm text-muted-foreground hover:text-foreground",onClick:p,children:[jsxRuntime.jsx(lucideReact.Link2,{className:"size-4","aria-hidden":"true"}),jsxRuntime.jsx("span",{children:c.viewAll})]}):null]}),jsxRuntime.jsx(He__namespace.Arrow,{className:"fill-popover"})]})]})}a(al,"AgentWorkbenchArtifactSummary");var Ml={audio:lucideReact.Music2,file:lucideReact.File,html:lucideReact.FileCode2,image:lucideReact.FileImage,markdown:lucideReact.FileText,pdf:lucideReact.FileText,presentation:lucideReact.Presentation,video:lucideReact.Film,web:lucideReact.Globe2};function Pl({artifact:e,selected:t,onClose:n}){let o=L().agentWorkbench.artifactWorkspace,r=Ml[e.kind],{attributes:i,listeners:l,setNodeRef:u,setActivatorNodeRef:g,transform:p,transition:c,isDragging:v}=sortable.useSortable({id:e.id}),{role:x,tabIndex:k,...m}=i,A=a(s=>{u(s),g(s);},"setTabRef"),P=a(s=>{s.button===1&&(s.preventDefault(),n());},"handleMouseDown"),E=a(s=>{!(s.target instanceof Element)||!s.target.closest("[data-close-artifact-tab]")||(s.preventDefault(),n());},"handleClick"),b=a(s=>{l?.onKeyDown?.(s),!(s.key!=="Delete"&&s.key!=="Backspace")&&(s.preventDefault(),n());},"handleKeyDown");return jsxRuntime.jsxs(De__namespace.Trigger,{ref:A,value:e.id,style:{transform:utilities.CSS.Transform.toString(p),transition:c},className:d("group/tab relative flex h-9 max-w-56 shrink-0 items-center gap-2 rounded-lg pl-3 pr-8 text-sm outline-hidden focus-visible:ring-2 focus-visible:ring-ring",t?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:bg-background/60",v&&"opacity-60"),onMouseDown:P,onClick:E,...m,...l,onKeyDown:b,children:[jsxRuntime.jsx(r,{className:"size-4 shrink-0","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:"truncate",children:e.name}),jsxRuntime.jsx("span",{className:"absolute right-1.5 flex size-6 items-center justify-center rounded-md opacity-0 hover:bg-muted group-focus/tab:opacity-100 group-hover/tab:opacity-100 data-[selected=true]:opacity-100","data-selected":t,"data-close-artifact-tab":"",title:o.closeTab({name:e.name}),"aria-hidden":"true",children:jsxRuntime.jsx(lucideReact.X,{className:"size-3.5","aria-hidden":"true"})})]})}a(Pl,"SortableArtifactTab");function Il({artifacts:e,activeArtifactId:t,className:n,variant:o,density:r,renderArtifact:i,onIntent:l}){let u=fe({variant:o,density:r}),g=u.density==="compact",p=L().agentWorkbench.artifactWorkspace,c=e.find(m=>m.id===t)??e[0],v=core.useSensors(core.useSensor(core.PointerSensor,{activationConstraint:{distance:5}}),core.useSensor(core.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates}));if(!c)return null;let x=a(({active:m,over:A})=>{!A||m.id===A.id||l?.({type:"reorder",artifactId:String(m.id),overArtifactId:String(A.id)});},"handleDragEnd"),k=c.status==="loading"?jsxRuntime.jsx("div",{className:"flex size-full min-h-48 items-center justify-center p-6 text-center",role:"status",children:jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-col items-center gap-3 text-sm text-muted-foreground",children:[jsxRuntime.jsx(lucideReact.Loader2,{className:"size-5 animate-spin","aria-hidden":"true"}),jsxRuntime.jsx("span",{children:p.loading})]})}):c.status==="error"?jsxRuntime.jsx("div",{className:"flex size-full min-h-48 items-center justify-center p-6 text-center",role:"alert",children:jsxRuntime.jsxs("div",{className:"flex min-w-0 max-w-sm flex-col items-center gap-3",children:[jsxRuntime.jsx("span",{className:"flex size-10 items-center justify-center rounded-full bg-destructive/10 text-destructive-text",children:jsxRuntime.jsx(lucideReact.TriangleAlert,{className:"size-5","aria-hidden":"true"})}),jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("div",{className:"break-words text-sm font-medium text-foreground [overflow-wrap:anywhere]",children:p.failed}),c.description?jsxRuntime.jsx("p",{className:"mt-1 max-h-24 overflow-auto whitespace-pre-wrap break-words text-sm text-muted-foreground [overflow-wrap:anywhere]",children:c.description}):null]}),l?jsxRuntime.jsxs(W,{type:"button",variant:"outline",size:"sm",className:"gap-2",onClick:()=>l({type:"retry",artifactId:c.id}),children:[jsxRuntime.jsx(lucideReact.RefreshCw,{className:"size-4","aria-hidden":"true"}),p.retry]}):null]})}):i(c);return jsxRuntime.jsxs(De__namespace.Root,{value:c.id,onValueChange:m=>l?.({type:"select",artifactId:m}),"data-agent-workbench-variant":u.variant,"data-agent-workbench-density":u.density,"data-agent-workbench-status":c.status,"data-agent-workbench-surface":"panel",className:d("flex size-full min-h-0 min-w-0 flex-col bg-card text-card-foreground",n),orientation:"horizontal",children:[jsxRuntime.jsxs("div",{className:d("relative z-10 flex shrink-0 items-center gap-2 border-b border-border bg-muted/40 px-2",g?"h-10":"h-12"),children:[jsxRuntime.jsx(core.DndContext,{sensors:v,collisionDetection:core.closestCenter,onDragEnd:x,children:jsxRuntime.jsx(sortable.SortableContext,{items:e.map(m=>m.id),strategy:sortable.horizontalListSortingStrategy,children:jsxRuntime.jsx(De__namespace.List,{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden","aria-label":p.tabs,children:e.map(m=>jsxRuntime.jsx(Pl,{artifact:m,selected:m.id===c.id,onClose:()=>l?.({type:"close",artifactId:m.id})},m.id))})})}),jsxRuntime.jsxs("div",{className:"relative z-20 flex shrink-0 items-center gap-2",children:[c.url?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:"size-8 shrink-0 text-muted-foreground hover:text-foreground","aria-label":p.download({name:c.name}),onClick:()=>l?.({type:"download",artifactId:c.id}),children:jsxRuntime.jsx(lucideReact.Download,{className:"size-4","aria-hidden":"true"})}),jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:"size-8 shrink-0 text-muted-foreground hover:text-foreground","aria-label":p.openExternal({name:c.name}),onClick:()=>l?.({type:"open-external",artifactId:c.id}),children:jsxRuntime.jsx(lucideReact.ExternalLink,{className:"size-4","aria-hidden":"true"})})]}):null,jsxRuntime.jsx(W,{type:"button",variant:"ghost",size:"icon",className:"size-8 shrink-0 text-muted-foreground hover:text-foreground","aria-label":p.closeWorkspace,onClick:()=>l?.({type:"close-workspace"}),children:jsxRuntime.jsx(lucideReact.PanelRightClose,{className:"size-4","aria-hidden":"true"})})]})]}),jsxRuntime.jsx("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:e.map(m=>jsxRuntime.jsx(De__namespace.Content,{value:m.id,className:"size-full min-h-0 min-w-0 outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:m.id===c.id?k:null},m.id))})]})}a(Il,"AgentWorkbenchArtifactWorkspace");
|
|
58
58
|
|
|
59
59
|
exports.AGENT_WORKBENCH_SHELL_BREAKPOINTS = Dn;
|