@cats-inc/cats-platform 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/README.md +8 -1
  2. package/build/renderer/assets/{ActiveSessionPermissionChip-B49WcZBJ.js → ActiveSessionPermissionChip-BugyYoVY.js} +1 -1
  3. package/build/renderer/assets/{App-BpxZB5ym.js → App-1MFRMMld.js} +1 -1
  4. package/build/renderer/assets/{App-boB4WrmU.js → App-BWgnfutX.js} +1 -1
  5. package/build/renderer/assets/{App-DYTUfAl6.js → App-Cm_tok6f.js} +1 -1
  6. package/build/renderer/assets/{WorkspaceAppRoutes-CPqz85iw.js → WorkspaceAppRoutes-B8U5FWao.js} +1 -1
  7. package/build/renderer/assets/{app-C52wwCGz.js → app-DTDTNtih.js} +3 -3
  8. package/build/renderer/assets/{conversationSidebarRecentEntries-DK0iWS73.js → conversationSidebarRecentEntries-y_bEg3Cp.js} +1 -1
  9. package/build/renderer/assets/{useDraftSessionChips-BdZ_B1gy.js → useDraftSessionChips-BD6ZGG_y.js} +1 -1
  10. package/build/renderer/index.html +1 -1
  11. package/build/server/app/server/shutdown.d.ts.map +1 -1
  12. package/build/server/app/server/shutdown.js +3 -1
  13. package/build/server/app/server/shutdown.js.map +1 -1
  14. package/build/server/app/server/startup.d.ts +4 -3
  15. package/build/server/app/server/startup.d.ts.map +1 -1
  16. package/build/server/app/server/startup.js +8 -0
  17. package/build/server/app/server/startup.js.map +1 -1
  18. package/build/server/index.js +30 -0
  19. package/build/server/index.js.map +1 -1
  20. package/build/server/shared/cliInteraction.d.ts +17 -0
  21. package/build/server/shared/cliInteraction.d.ts.map +1 -0
  22. package/build/server/shared/cliInteraction.js +102 -0
  23. package/build/server/shared/cliInteraction.js.map +1 -0
  24. package/build/server/shared/providerCatalogData.d.ts +41 -40
  25. package/build/server/shared/providerCatalogData.d.ts.map +1 -1
  26. package/build/server/shared/providerCatalogData.js +17 -16
  27. package/build/server/shared/providerCatalogData.js.map +1 -1
  28. package/package.json +2 -2
  29. package/scripts/dev-server.mjs +4 -1
@@ -1 +1 @@
1
- import{j as e,r as oe}from"./client-DREGSZqQ.js";import{n as $e,at as Fe,au as Ge,u as Ke,ah as qe,av as se,aw as _e,m as s,a9 as Je,ax as Xe,V as Ye,R as Ze,c as k,N as V}from"./app-C52wwCGz.js";import{n as Qe,o as et,F as tt,q as at,k as nt,l as ot,s as st,t as it,v as lt,x as ie}from"./conversationSidebarRecentEntries-DK0iWS73.js";function le({cats:a,bossCatId:l,defaultRecipientCatId:r,onClick:d}){if(a.length===0)return null;const u=r?a.find(n=>n.id===r):a[0],f=a.filter(n=>n.id!==u?.id),c=u?[u,...f]:a;return e.jsx("div",{className:"composerCatStack",style:{marginRight:10},onClick:d,role:d?"button":void 0,tabIndex:d?0:void 0,children:c.map((n,h)=>{const g=n.id===l;return e.jsx("div",{className:`catAvatar composerStackAvatar${g?" catAvatarBoss":""}`,"data-tooltip":Fe(n.name,Ge(n)),style:{...n.avatarUrl?{backgroundImage:`url(${n.avatarUrl})`,backgroundSize:"cover",backgroundPosition:"center"}:{background:n.avatarColor??"#8B7E74",color:"#fff"},zIndex:c.length-h},children:n.avatarUrl?null:$e(n.name)},n.id)})})}function rt({card:a,footer:l=null,helperRegion:r=null,shadowStack:d=null}){return e.jsxs("div",{className:"draftComposerStack",children:[a,d,l,r]})}function ct({payload:a,effectiveDefaultRecipientCat:l,nonLeadDraftCats:r,isDirectLaneContext:d,activePanelExecutionTarget:u,isSubmittingFirstTurn:f,onOpenExecution:c}){return d&&l?e.jsx(le,{cats:[l,...r],bossCatId:a.chat.bossCatId,defaultRecipientCatId:l.id,onClick:f?void 0:c}):u?e.jsx("div",{style:{marginRight:8},children:e.jsx(Qe,{audienceParticipants:[et(u)],onSingleClick:f?void 0:c,disabled:f})}):null}const re=Ye("en");function dt(a=re){return{greeting:a(s.chatNewChatDraftDefaultGreeting),composer:{placeholder:a(s.chatNewChatDraftComposerPlaceholder)},sidePanel:{title:a(s.chatNewChatDraftSidePanelTitle)},participants:{sectionTitle:a(s.chatNewChatDraftSidePanelParticipantsCatsTitle),emptyState:a(s.chatNewChatDraftSidePanelParticipantsEmptyState)},execution:{sectionTitle:a(s.chatNewChatDraftSidePanelExecutionTitle),actionLabel:a(s.chatNewChatDraftSidePanelExecutionActionLabel),emptyState:a(s.chatNewChatDraftSidePanelExecutionEmptyState)},folder:{sectionTitle:a(s.chatNewChatDraftSidePanelFolderTitle),actionLabel:a(s.chatNewChatDraftFolderActionLabel),emptyState:a(s.chatNewChatDraftSidePanelFolderEmptyState)}}}function ut(a,l=re){const r=dt(l);return{greeting:a?.greeting??r.greeting,composer:{...r.composer,...a?.composer},sidePanel:{...r.sidePanel,...a?.sidePanel},participants:{...r.participants,...a?.participants},execution:{...r.execution,...a?.execution},folder:{...r.folder,...a?.folder}}}function ht({payload:a,composerDraft:l,busy:r,greeting:d,composerHeaderAccessory:u=null,postComposerAccessory:f=null,draftFiles:c,draftCwd:n,draftCatIds:h,plusMenuOpen:g,plusMenuRef:S,fileInputRef:w,bossCatName:T,bossCatAvatarColor:O,onComposerChange:P,onComposerKeyDown:M,onSendMessage:B,onTogglePlusMenu:ce,onFileSelect:de,onTakeScreenshot:U,screenshotCaptureDisabled:ue=!1,onPickFolder:he,onOpenAddCat:pt,onDraftFilesChange:z,onDraftCwdClear:pe,onToggleDraftCat:me,onQuickAddDraftTemporaryParticipant:$,autoResize:F,draftDefaultRecipientCatId:I,onDraftDefaultRecipientChange:mt,allowAddCat:xe=!0,selectedExecutionTarget:ve,onExecutionTargetChange:G,draftHighlightedCatId:L,onHighlightDraftCat:je,draftCatExecutionTargetOverrides:K,onDraftCatExecutionTargetOverride:xt,onDirectLaneExecutionTargetChange:fe,onAddParallelTarget:ge,folderBrowsePath:Ce="",folderBrowseCurrentPath:q="",folderBrowseParentPath:be="",folderBrowseEntries:ke=[],folderBrowseLoading:_=!1,folderBrowseError:Ne="",onFolderBrowsePathChange:J,onFolderBrowse:X,onFolderBrowseSelect:Y,composerHeaderWhereExtras:Se=null,composerFooterAccessory:we=null,draftCustomRegion:Z=null,surfaceTag:Pe=null,showDraftGroupAddButton:Le=!1,showDraftParallelAddButton:ye=!1,chooseFolderPlacement:Q="header",ComposerCatStackComponent:vt,ProviderModelFieldsComponent:ee,CatAvatarRowComponent:te,FolderBrowserContentComponent:De,DraftTargetSlotComponent:Ae,copy:Te}){const{t:j}=Ke(),p=ut(Te,j),Me=d??p.greeting,C=a.chat.cats.filter(qe),o=I?C.find(t=>t.id===I&&t.status==="active")??null:null,R=!o&&h.length>0?C.find(t=>t.id===h[0]&&t.status==="active")??null:null,y=o??R,Be=R?h.filter(t=>t!==R.id):o?h.filter(t=>t!==o.id):h,[Ie,E]=oe.useState(!1),[Re,Ee]=oe.useState("cats");function D(t){E(!0),ae(t)}function ae(t){Ee(t),t==="cwd"&&!q&&!_&&he()}const N=!xe&&!!I&&!!o,b=L&&h.includes(L)?C.find(t=>t.id===L)??null:null,m=N&&o?K.get(o.id)??{provider:o.defaultExecutionTarget.provider,model:o.defaultExecutionTarget.model,instance:o.defaultExecutionTarget.instance,modelSelection:o.defaultModelSelection??null}:b?K.get(b.id)??{provider:b.defaultExecutionTarget.provider,model:b.defaultExecutionTarget.model,instance:b.defaultExecutionTarget.instance,modelSelection:b.defaultModelSelection??null}:ve??null,i=ot(r),{supported:We,listening:W,toggle:Ve,textareaRef:He,toasts:Oe,privacyMessage:A}=st({value:l,onChange:P,autoResize:F,disabled:i});return e.jsxs("div",{className:"viewShell viewShellDraft",children:[e.jsxs("section",{className:"draftShell",children:[N&&o?e.jsx(se,{variant:"profile",title:o.name,avatarName:o.name,avatarUrl:o.avatarUrl,avatarColor:o.avatarColor}):e.jsx(se,{variant:"intro",title:Me}),Z?e.jsx("div",{className:"draftCustomRegion",children:Z}):null,e.jsxs("div",{className:"composerHeaderRow",children:[e.jsxs("div",{className:"composerHeaderLeft",children:[Pe,n?e.jsxs("span",{className:"composerCwdChip composerCwdClickable","data-tooltip":n,role:"button",tabIndex:i?void 0:0,onClick:i?void 0:()=>D("cwd"),children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M2 4v9a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H8L6.5 3H3a1 1 0 0 0-1 1z"})}),e.jsx("span",{children:_e(n)}),e.jsx("button",{className:"composerChipClose",type:"button",disabled:i,onClick:t=>{t.stopPropagation(),pe()},"aria-label":j(s.chatNewChatDraftRemoveFolderAria),children:"×"})]}):Q==="header"?e.jsxs("button",{type:"button",className:"composerHeaderChooseButton",disabled:i,onClick:()=>D("cwd"),children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M2 4v9a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H8L6.5 3H3a1 1 0 0 0-1 1z"})}),e.jsx("span",{children:p.folder.actionLabel})]}):null,Se]}),u?e.jsx("div",{className:"composerHeaderRight",children:u}):null]}),e.jsx(rt,{card:e.jsxs("form",{className:`composerCard composerCardFresh${g?" composerCardMenuOpen":""}`,onSubmit:t=>{B(t)},children:[c.length>0?e.jsx("div",{className:"composerAttachments",children:c.map((t,x)=>{const v=t.type.startsWith("image/");return e.jsxs("div",{className:"attachmentCard",children:[e.jsx("button",{className:"attachmentRemove",type:"button",disabled:i,onClick:()=>z(c.filter((ne,ze)=>ze!==x)),"aria-label":j(s.chatNewChatDraftAttachmentRemoveAria,{fileName:t.name}),children:"×"}),v?e.jsx("img",{className:"attachmentPreview",src:URL.createObjectURL(t),alt:t.name,onLoad:ne=>URL.revokeObjectURL(ne.target.src)}):e.jsx("div",{className:"attachmentFileIcon",children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("path",{d:"M14 2v6h6"})]})}),e.jsx("span",{className:"attachmentName",children:t.name})]},`${t.name}-${t.size}-${x}`)})}):null,e.jsx("textarea",{ref:He,className:"composerInput",rows:1,placeholder:p.composer.placeholder,value:l,disabled:i,onChange:t=>{P(t.target.value),F(t.target)},onKeyDown:t=>{M(t)}}),e.jsxs("div",{className:"composerBottomRow",children:[e.jsxs("div",{className:"composerLeftGroup",children:[e.jsxs("div",{className:"composerPlusWrapper",ref:S,children:[e.jsx("button",{className:"composerPlusButton",type:"button","aria-label":j(s.chatComposerAreaAttachAria),disabled:i,onClick:ce,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M8 3v10"}),e.jsx("path",{d:"M3 8h10"})]})}),g?e.jsxs("div",{className:"composerPlusMenu",children:[e.jsxs("button",{className:"composerPlusMenuItem",type:"button",disabled:i,onClick:de,children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 10v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-3"}),e.jsx("path",{d:"M8 2v8"}),e.jsx("path",{d:"M4 6l4-4 4 4"})]}),j(s.chatNewChatDraftAddPhotosAndFiles)]}),U?e.jsxs("button",{className:"composerPlusMenuItem",type:"button",disabled:i||ue,onClick:U,children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M5 3.5l1-1h4l1 1h2a1 1 0 0 1 1 1v7.5a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4.5a1 1 0 0 1 1-1h2z"}),e.jsx("circle",{cx:"8",cy:"8.5",r:"2.5"})]}),j(s.chatNewChatDraftTakeScreenshot)]}):null,Q==="plusMenu"?e.jsxs("button",{className:"composerPlusMenuItem",type:"button",disabled:i,onClick:()=>{D("cwd")},children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M2 4v9a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H8L6.5 3H3a1 1 0 0 0-1 1z"})}),p.folder.actionLabel]}):null]}):null]}),Le&&$?e.jsx("button",{type:"button",className:"parallelAddButton",disabled:i,onClick:$,"aria-label":j(s.chatNewChatDraftCollaborateAria),children:e.jsx(lt,{})}):null]}),e.jsx(Ae,{payload:a,effectiveDefaultRecipientCat:y,nonLeadDraftCats:Be.map(t=>C.find(x=>x.id===t)).filter(t=>t!=null),isDirectLaneContext:N,activePanelExecutionTarget:m,isSubmittingFirstTurn:i,onOpenExecution:()=>D("execution")}),We?e.jsxs("button",{className:`composerPlusButton composerVoiceButton${W?" composerVoiceButtonActive":""}`,type:"button","aria-label":W?j(s.chatNewChatDraftStopVoiceInputAria,{privacyMessageSuffix:A?`. ${A}`:""}):j(s.chatNewChatDraftStartVoiceInputAria),"aria-pressed":W,title:A??void 0,disabled:i,onClick:Ve,children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"6",y:"2",width:"4",height:"8",rx:"2"}),e.jsx("path",{d:"M3 8a5 5 0 0 0 10 0"}),e.jsx("path",{d:"M8 13v2"}),e.jsx("path",{d:"M6 15h4"})]}),A?e.jsx("span",{className:"composerVoicePrivacyBadge","aria-hidden":"true",children:"!"}):null]}):null,e.jsx("button",{className:"composerSendButton",disabled:!l.trim()&&c.length===0||i,type:"submit","aria-label":j(s.chatNewChatDraftSendAria),children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M8 13V3"}),e.jsx("path",{d:"M3 7l5-5 5 5"})]})})]}),e.jsx("input",{ref:w,type:"file",multiple:!0,disabled:i,style:{display:"none"},onChange:t=>{const x=t.currentTarget;if(x.files&&x.files.length>0){const v=Array.from(x.files);z([...c,...v])}x.value=""}})]}),footer:e.jsx(it,{accessory:we,showParallelAddButton:ye,hideParallelHint:!0,disabled:i,onAddParallelTarget:ge}),helperRegion:f})]}),Ie?e.jsx(Je,{title:p.sidePanel.title,activeSection:Re,onSectionToggle:i?()=>{}:t=>ae(t),onClose:i?()=>{}:()=>E(!1),className:"chatPaneSidePanel",sections:Ue()}):null,e.jsx(Xe,{toasts:Oe})]});function Ue(){const t=[];t.push({id:"cats",title:p.participants.sectionTitle,children:C.filter(v=>v.status==="active").length>0?e.jsx(te,{cats:C,bossCatId:a.chat.bossCatId,selectedIds:h,highlightedId:L,defaultRecipientCatId:y?.id??null,toggleable:!0,showLeadBadge:!0,onToggle:me,onHighlight:v=>je(v)}):e.jsx("p",{className:"operatorEmptyState",children:p.participants.emptyState})});const x=N&&o&&m?e.jsxs(e.Fragment,{children:[e.jsx(te,{cats:[o],bossCatId:a.chat.bossCatId,selectedIds:[o.id],highlightedId:o.id,defaultRecipientCatId:o.id,toggleable:!1,showLeadBadge:!0,onToggle:()=>{},onHighlight:()=>{}}),e.jsx(ee,{provider:m.provider,instance:m.instance??"",model:m.model??"",modelSelection:m.modelSelection,onTargetChange:v=>{fe?.(o.id,ie(v))}})]}):m?e.jsx("div",{style:y&&!N?{pointerEvents:"none",opacity:.45}:void 0,children:e.jsx(ee,{provider:m.provider,instance:m.instance??"",model:m.model??"",modelSelection:m.modelSelection,onTargetChange:v=>{!y&&G&&G(ie(v))}})}):e.jsx("p",{className:"operatorEmptyState",children:p.execution.emptyState});return t.push({id:"execution",title:p.execution.sectionTitle,children:x}),t.push({id:"cwd",title:p.folder.sectionTitle,children:J&&X&&Y?e.jsx(De,{folderBrowsePath:Ce,folderBrowseCurrentPath:q,folderBrowseParentPath:be,folderBrowseEntries:ke,folderBrowseLoading:_,folderBrowseError:Ne,onPathChange:J,onBrowse:X,onSelect:()=>{Y(),E(!1)}}):n?e.jsx("p",{style:{margin:0,fontSize:"0.85rem",wordBreak:"break-all"},children:n}):e.jsx("p",{className:"operatorEmptyState",children:p.folder.emptyState})}),t}}function Ct({DraftTargetSlotComponent:a=ct,...l}){return e.jsx(ht,{...l,ComposerCatStackComponent:le,DraftTargetSlotComponent:a,ProviderModelFieldsComponent:nt,CatAvatarRowComponent:at,FolderBrowserContentComponent:tt})}function H(){}function bt({payload:a,selectedChannel:l,directLaneChannel:r,showDirectLaneBoot:d,feedback:u,busy:f,addCatOpen:c,entryPath:n,chatsPath:h,extraRoutes:g=null,renderBootShell:S,renderChatView:w,renderNewChatDraft:T,renderAddCatPanel:O,onToggleAddCat:P,onOpenDraftAddCat:M,onChangeDraftDefaultRecipient:B}){return e.jsxs(e.Fragment,{children:[e.jsxs(Ze,{children:[e.jsx(k,{index:!0,element:e.jsx(V,{to:n,replace:!0})}),g,e.jsx(k,{path:"chats/:channelId",element:l?w(l,{onOpenAddCat:P}):S()}),e.jsx(k,{path:"chats",element:e.jsx(V,{to:h,replace:!0})}),e.jsx(k,{path:"dm/:catId",element:d?S():r?w(r,{onOpenAddCat:H,showAddCatButton:!1}):T({onOpenAddCat:H,onDraftDefaultRecipientChange:H,allowAddCat:!1})}),e.jsx(k,{path:"new",element:T({onOpenAddCat:M,onDraftDefaultRecipientChange:B,allowAddCat:!0})}),e.jsx(k,{path:"*",element:e.jsx(V,{to:n,replace:!0})})]}),c?O({busy:f,feedback:u}):null]})}export{Ct as N,bt as W};
1
+ import{j as e,r as oe}from"./client-DREGSZqQ.js";import{n as $e,at as Fe,au as Ge,u as Ke,ah as qe,av as se,aw as _e,m as s,a9 as Je,ax as Xe,V as Ye,R as Ze,c as k,N as V}from"./app-DTDTNtih.js";import{n as Qe,o as et,F as tt,q as at,k as nt,l as ot,s as st,t as it,v as lt,x as ie}from"./conversationSidebarRecentEntries-y_bEg3Cp.js";function le({cats:a,bossCatId:l,defaultRecipientCatId:r,onClick:d}){if(a.length===0)return null;const u=r?a.find(n=>n.id===r):a[0],f=a.filter(n=>n.id!==u?.id),c=u?[u,...f]:a;return e.jsx("div",{className:"composerCatStack",style:{marginRight:10},onClick:d,role:d?"button":void 0,tabIndex:d?0:void 0,children:c.map((n,h)=>{const g=n.id===l;return e.jsx("div",{className:`catAvatar composerStackAvatar${g?" catAvatarBoss":""}`,"data-tooltip":Fe(n.name,Ge(n)),style:{...n.avatarUrl?{backgroundImage:`url(${n.avatarUrl})`,backgroundSize:"cover",backgroundPosition:"center"}:{background:n.avatarColor??"#8B7E74",color:"#fff"},zIndex:c.length-h},children:n.avatarUrl?null:$e(n.name)},n.id)})})}function rt({card:a,footer:l=null,helperRegion:r=null,shadowStack:d=null}){return e.jsxs("div",{className:"draftComposerStack",children:[a,d,l,r]})}function ct({payload:a,effectiveDefaultRecipientCat:l,nonLeadDraftCats:r,isDirectLaneContext:d,activePanelExecutionTarget:u,isSubmittingFirstTurn:f,onOpenExecution:c}){return d&&l?e.jsx(le,{cats:[l,...r],bossCatId:a.chat.bossCatId,defaultRecipientCatId:l.id,onClick:f?void 0:c}):u?e.jsx("div",{style:{marginRight:8},children:e.jsx(Qe,{audienceParticipants:[et(u)],onSingleClick:f?void 0:c,disabled:f})}):null}const re=Ye("en");function dt(a=re){return{greeting:a(s.chatNewChatDraftDefaultGreeting),composer:{placeholder:a(s.chatNewChatDraftComposerPlaceholder)},sidePanel:{title:a(s.chatNewChatDraftSidePanelTitle)},participants:{sectionTitle:a(s.chatNewChatDraftSidePanelParticipantsCatsTitle),emptyState:a(s.chatNewChatDraftSidePanelParticipantsEmptyState)},execution:{sectionTitle:a(s.chatNewChatDraftSidePanelExecutionTitle),actionLabel:a(s.chatNewChatDraftSidePanelExecutionActionLabel),emptyState:a(s.chatNewChatDraftSidePanelExecutionEmptyState)},folder:{sectionTitle:a(s.chatNewChatDraftSidePanelFolderTitle),actionLabel:a(s.chatNewChatDraftFolderActionLabel),emptyState:a(s.chatNewChatDraftSidePanelFolderEmptyState)}}}function ut(a,l=re){const r=dt(l);return{greeting:a?.greeting??r.greeting,composer:{...r.composer,...a?.composer},sidePanel:{...r.sidePanel,...a?.sidePanel},participants:{...r.participants,...a?.participants},execution:{...r.execution,...a?.execution},folder:{...r.folder,...a?.folder}}}function ht({payload:a,composerDraft:l,busy:r,greeting:d,composerHeaderAccessory:u=null,postComposerAccessory:f=null,draftFiles:c,draftCwd:n,draftCatIds:h,plusMenuOpen:g,plusMenuRef:S,fileInputRef:w,bossCatName:T,bossCatAvatarColor:O,onComposerChange:P,onComposerKeyDown:M,onSendMessage:B,onTogglePlusMenu:ce,onFileSelect:de,onTakeScreenshot:U,screenshotCaptureDisabled:ue=!1,onPickFolder:he,onOpenAddCat:pt,onDraftFilesChange:z,onDraftCwdClear:pe,onToggleDraftCat:me,onQuickAddDraftTemporaryParticipant:$,autoResize:F,draftDefaultRecipientCatId:I,onDraftDefaultRecipientChange:mt,allowAddCat:xe=!0,selectedExecutionTarget:ve,onExecutionTargetChange:G,draftHighlightedCatId:L,onHighlightDraftCat:je,draftCatExecutionTargetOverrides:K,onDraftCatExecutionTargetOverride:xt,onDirectLaneExecutionTargetChange:fe,onAddParallelTarget:ge,folderBrowsePath:Ce="",folderBrowseCurrentPath:q="",folderBrowseParentPath:be="",folderBrowseEntries:ke=[],folderBrowseLoading:_=!1,folderBrowseError:Ne="",onFolderBrowsePathChange:J,onFolderBrowse:X,onFolderBrowseSelect:Y,composerHeaderWhereExtras:Se=null,composerFooterAccessory:we=null,draftCustomRegion:Z=null,surfaceTag:Pe=null,showDraftGroupAddButton:Le=!1,showDraftParallelAddButton:ye=!1,chooseFolderPlacement:Q="header",ComposerCatStackComponent:vt,ProviderModelFieldsComponent:ee,CatAvatarRowComponent:te,FolderBrowserContentComponent:De,DraftTargetSlotComponent:Ae,copy:Te}){const{t:j}=Ke(),p=ut(Te,j),Me=d??p.greeting,C=a.chat.cats.filter(qe),o=I?C.find(t=>t.id===I&&t.status==="active")??null:null,R=!o&&h.length>0?C.find(t=>t.id===h[0]&&t.status==="active")??null:null,y=o??R,Be=R?h.filter(t=>t!==R.id):o?h.filter(t=>t!==o.id):h,[Ie,E]=oe.useState(!1),[Re,Ee]=oe.useState("cats");function D(t){E(!0),ae(t)}function ae(t){Ee(t),t==="cwd"&&!q&&!_&&he()}const N=!xe&&!!I&&!!o,b=L&&h.includes(L)?C.find(t=>t.id===L)??null:null,m=N&&o?K.get(o.id)??{provider:o.defaultExecutionTarget.provider,model:o.defaultExecutionTarget.model,instance:o.defaultExecutionTarget.instance,modelSelection:o.defaultModelSelection??null}:b?K.get(b.id)??{provider:b.defaultExecutionTarget.provider,model:b.defaultExecutionTarget.model,instance:b.defaultExecutionTarget.instance,modelSelection:b.defaultModelSelection??null}:ve??null,i=ot(r),{supported:We,listening:W,toggle:Ve,textareaRef:He,toasts:Oe,privacyMessage:A}=st({value:l,onChange:P,autoResize:F,disabled:i});return e.jsxs("div",{className:"viewShell viewShellDraft",children:[e.jsxs("section",{className:"draftShell",children:[N&&o?e.jsx(se,{variant:"profile",title:o.name,avatarName:o.name,avatarUrl:o.avatarUrl,avatarColor:o.avatarColor}):e.jsx(se,{variant:"intro",title:Me}),Z?e.jsx("div",{className:"draftCustomRegion",children:Z}):null,e.jsxs("div",{className:"composerHeaderRow",children:[e.jsxs("div",{className:"composerHeaderLeft",children:[Pe,n?e.jsxs("span",{className:"composerCwdChip composerCwdClickable","data-tooltip":n,role:"button",tabIndex:i?void 0:0,onClick:i?void 0:()=>D("cwd"),children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M2 4v9a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H8L6.5 3H3a1 1 0 0 0-1 1z"})}),e.jsx("span",{children:_e(n)}),e.jsx("button",{className:"composerChipClose",type:"button",disabled:i,onClick:t=>{t.stopPropagation(),pe()},"aria-label":j(s.chatNewChatDraftRemoveFolderAria),children:"×"})]}):Q==="header"?e.jsxs("button",{type:"button",className:"composerHeaderChooseButton",disabled:i,onClick:()=>D("cwd"),children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M2 4v9a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H8L6.5 3H3a1 1 0 0 0-1 1z"})}),e.jsx("span",{children:p.folder.actionLabel})]}):null,Se]}),u?e.jsx("div",{className:"composerHeaderRight",children:u}):null]}),e.jsx(rt,{card:e.jsxs("form",{className:`composerCard composerCardFresh${g?" composerCardMenuOpen":""}`,onSubmit:t=>{B(t)},children:[c.length>0?e.jsx("div",{className:"composerAttachments",children:c.map((t,x)=>{const v=t.type.startsWith("image/");return e.jsxs("div",{className:"attachmentCard",children:[e.jsx("button",{className:"attachmentRemove",type:"button",disabled:i,onClick:()=>z(c.filter((ne,ze)=>ze!==x)),"aria-label":j(s.chatNewChatDraftAttachmentRemoveAria,{fileName:t.name}),children:"×"}),v?e.jsx("img",{className:"attachmentPreview",src:URL.createObjectURL(t),alt:t.name,onLoad:ne=>URL.revokeObjectURL(ne.target.src)}):e.jsx("div",{className:"attachmentFileIcon",children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("path",{d:"M14 2v6h6"})]})}),e.jsx("span",{className:"attachmentName",children:t.name})]},`${t.name}-${t.size}-${x}`)})}):null,e.jsx("textarea",{ref:He,className:"composerInput",rows:1,placeholder:p.composer.placeholder,value:l,disabled:i,onChange:t=>{P(t.target.value),F(t.target)},onKeyDown:t=>{M(t)}}),e.jsxs("div",{className:"composerBottomRow",children:[e.jsxs("div",{className:"composerLeftGroup",children:[e.jsxs("div",{className:"composerPlusWrapper",ref:S,children:[e.jsx("button",{className:"composerPlusButton",type:"button","aria-label":j(s.chatComposerAreaAttachAria),disabled:i,onClick:ce,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M8 3v10"}),e.jsx("path",{d:"M3 8h10"})]})}),g?e.jsxs("div",{className:"composerPlusMenu",children:[e.jsxs("button",{className:"composerPlusMenuItem",type:"button",disabled:i,onClick:de,children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 10v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-3"}),e.jsx("path",{d:"M8 2v8"}),e.jsx("path",{d:"M4 6l4-4 4 4"})]}),j(s.chatNewChatDraftAddPhotosAndFiles)]}),U?e.jsxs("button",{className:"composerPlusMenuItem",type:"button",disabled:i||ue,onClick:U,children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M5 3.5l1-1h4l1 1h2a1 1 0 0 1 1 1v7.5a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4.5a1 1 0 0 1 1-1h2z"}),e.jsx("circle",{cx:"8",cy:"8.5",r:"2.5"})]}),j(s.chatNewChatDraftTakeScreenshot)]}):null,Q==="plusMenu"?e.jsxs("button",{className:"composerPlusMenuItem",type:"button",disabled:i,onClick:()=>{D("cwd")},children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M2 4v9a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H8L6.5 3H3a1 1 0 0 0-1 1z"})}),p.folder.actionLabel]}):null]}):null]}),Le&&$?e.jsx("button",{type:"button",className:"parallelAddButton",disabled:i,onClick:$,"aria-label":j(s.chatNewChatDraftCollaborateAria),children:e.jsx(lt,{})}):null]}),e.jsx(Ae,{payload:a,effectiveDefaultRecipientCat:y,nonLeadDraftCats:Be.map(t=>C.find(x=>x.id===t)).filter(t=>t!=null),isDirectLaneContext:N,activePanelExecutionTarget:m,isSubmittingFirstTurn:i,onOpenExecution:()=>D("execution")}),We?e.jsxs("button",{className:`composerPlusButton composerVoiceButton${W?" composerVoiceButtonActive":""}`,type:"button","aria-label":W?j(s.chatNewChatDraftStopVoiceInputAria,{privacyMessageSuffix:A?`. ${A}`:""}):j(s.chatNewChatDraftStartVoiceInputAria),"aria-pressed":W,title:A??void 0,disabled:i,onClick:Ve,children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"6",y:"2",width:"4",height:"8",rx:"2"}),e.jsx("path",{d:"M3 8a5 5 0 0 0 10 0"}),e.jsx("path",{d:"M8 13v2"}),e.jsx("path",{d:"M6 15h4"})]}),A?e.jsx("span",{className:"composerVoicePrivacyBadge","aria-hidden":"true",children:"!"}):null]}):null,e.jsx("button",{className:"composerSendButton",disabled:!l.trim()&&c.length===0||i,type:"submit","aria-label":j(s.chatNewChatDraftSendAria),children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M8 13V3"}),e.jsx("path",{d:"M3 7l5-5 5 5"})]})})]}),e.jsx("input",{ref:w,type:"file",multiple:!0,disabled:i,style:{display:"none"},onChange:t=>{const x=t.currentTarget;if(x.files&&x.files.length>0){const v=Array.from(x.files);z([...c,...v])}x.value=""}})]}),footer:e.jsx(it,{accessory:we,showParallelAddButton:ye,hideParallelHint:!0,disabled:i,onAddParallelTarget:ge}),helperRegion:f})]}),Ie?e.jsx(Je,{title:p.sidePanel.title,activeSection:Re,onSectionToggle:i?()=>{}:t=>ae(t),onClose:i?()=>{}:()=>E(!1),className:"chatPaneSidePanel",sections:Ue()}):null,e.jsx(Xe,{toasts:Oe})]});function Ue(){const t=[];t.push({id:"cats",title:p.participants.sectionTitle,children:C.filter(v=>v.status==="active").length>0?e.jsx(te,{cats:C,bossCatId:a.chat.bossCatId,selectedIds:h,highlightedId:L,defaultRecipientCatId:y?.id??null,toggleable:!0,showLeadBadge:!0,onToggle:me,onHighlight:v=>je(v)}):e.jsx("p",{className:"operatorEmptyState",children:p.participants.emptyState})});const x=N&&o&&m?e.jsxs(e.Fragment,{children:[e.jsx(te,{cats:[o],bossCatId:a.chat.bossCatId,selectedIds:[o.id],highlightedId:o.id,defaultRecipientCatId:o.id,toggleable:!1,showLeadBadge:!0,onToggle:()=>{},onHighlight:()=>{}}),e.jsx(ee,{provider:m.provider,instance:m.instance??"",model:m.model??"",modelSelection:m.modelSelection,onTargetChange:v=>{fe?.(o.id,ie(v))}})]}):m?e.jsx("div",{style:y&&!N?{pointerEvents:"none",opacity:.45}:void 0,children:e.jsx(ee,{provider:m.provider,instance:m.instance??"",model:m.model??"",modelSelection:m.modelSelection,onTargetChange:v=>{!y&&G&&G(ie(v))}})}):e.jsx("p",{className:"operatorEmptyState",children:p.execution.emptyState});return t.push({id:"execution",title:p.execution.sectionTitle,children:x}),t.push({id:"cwd",title:p.folder.sectionTitle,children:J&&X&&Y?e.jsx(De,{folderBrowsePath:Ce,folderBrowseCurrentPath:q,folderBrowseParentPath:be,folderBrowseEntries:ke,folderBrowseLoading:_,folderBrowseError:Ne,onPathChange:J,onBrowse:X,onSelect:()=>{Y(),E(!1)}}):n?e.jsx("p",{style:{margin:0,fontSize:"0.85rem",wordBreak:"break-all"},children:n}):e.jsx("p",{className:"operatorEmptyState",children:p.folder.emptyState})}),t}}function Ct({DraftTargetSlotComponent:a=ct,...l}){return e.jsx(ht,{...l,ComposerCatStackComponent:le,DraftTargetSlotComponent:a,ProviderModelFieldsComponent:nt,CatAvatarRowComponent:at,FolderBrowserContentComponent:tt})}function H(){}function bt({payload:a,selectedChannel:l,directLaneChannel:r,showDirectLaneBoot:d,feedback:u,busy:f,addCatOpen:c,entryPath:n,chatsPath:h,extraRoutes:g=null,renderBootShell:S,renderChatView:w,renderNewChatDraft:T,renderAddCatPanel:O,onToggleAddCat:P,onOpenDraftAddCat:M,onChangeDraftDefaultRecipient:B}){return e.jsxs(e.Fragment,{children:[e.jsxs(Ze,{children:[e.jsx(k,{index:!0,element:e.jsx(V,{to:n,replace:!0})}),g,e.jsx(k,{path:"chats/:channelId",element:l?w(l,{onOpenAddCat:P}):S()}),e.jsx(k,{path:"chats",element:e.jsx(V,{to:h,replace:!0})}),e.jsx(k,{path:"dm/:catId",element:d?S():r?w(r,{onOpenAddCat:H,showAddCatButton:!1}):T({onOpenAddCat:H,onDraftDefaultRecipientChange:H,allowAddCat:!1})}),e.jsx(k,{path:"new",element:T({onOpenAddCat:M,onDraftDefaultRecipientChange:B,allowAddCat:!0})}),e.jsx(k,{path:"*",element:e.jsx(V,{to:n,replace:!0})})]}),c?O({busy:f,feedback:u}):null]})}export{Ct as N,bt as W};