@taskforcehq/taskforce 0.3.324 → 0.3.326
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/Taskforce.module.css +39 -0
- package/dist/components/features/TaskSettings.js +26 -9
- package/dist/components/task/TaskKanban.d.ts +2 -2
- package/dist/components/views/StandaloneLayout.js +22 -22
- package/dist/components/views/panels/PlanningDrawer.d.ts +2 -2
- package/dist/components/views/panels/PlanningDrawer.js +26 -12
- package/dist/components/views/planningScope.d.ts +4 -0
- package/dist/components/views/planningScope.js +5 -0
- package/dist/core/AiProfileService.js +6 -1
- package/dist/hooks/useTaskforce.js +74 -17
- package/dist/hooks/workspace/workspaceLocalState.d.ts +25 -0
- package/dist/hooks/workspace/workspaceLocalState.js +38 -0
- package/dist/mcp/adminWorkspaceRegistrar.js +0 -10
- package/dist/mcp/clientIntegrations.d.ts +1 -1
- package/dist/mcp/clientIntegrations.js +50 -0
- package/dist/mcp/clientProfileDefaults.js +4 -0
- package/dist/mcp/collaborationRegistrar.js +3 -3
- package/dist/mcp/documentAssetRegistrar.js +24 -72
- package/dist/mcp/documentHelpers.d.ts +11 -4
- package/dist/mcp/documentHelpers.js +21 -17
- package/dist/mcp/runtime.d.ts +4 -0
- package/dist/mcp/runtime.js +466 -534
- package/dist/mcp/taskPlanningRegistrar.js +45 -81
- package/dist/mcp/toolProfiles.d.ts +7 -0
- package/dist/mcp/toolProfiles.js +36 -0
- package/dist/mcp/toolRegistry.d.ts +87 -609
- package/dist/mcp/toolRegistry.js +93 -88
- package/dist/resources/templates/workflow-sources/workflowDocs.mjs +10 -10
- package/dist/resources/templates/workflows/collaborate.yaml +2 -3
- package/dist/resources/templates/workflows/do.yaml +2 -3
- package/dist/resources/templates/workflows/evaluate.yaml +2 -3
- package/dist/resources/templates/workflows/execute.yaml +12 -15
- package/dist/resources/templates/workflows/plan.yaml +3 -4
- package/dist/resources/templates/workflows/review.yaml +2 -3
- package/dist/shared/taxonomyLibrary.js +1 -1
- package/dist/sync/cloudSyncApi.js +22 -3
- package/dist/types.js +1 -1
- package/dist/ui/assets/{AgentsModule-DvkbUHi0.js → AgentsModule-C4LcqhcZ.js} +1 -1
- package/dist/ui/assets/{AnnotatedAttachmentWorkspace-jhOhxqHT.js → AnnotatedAttachmentWorkspace-B-Dq22d2.js} +1 -1
- package/dist/ui/assets/{ContextAttachmentManager-BAmEyLHL.js → ContextAttachmentManager-DsXPTvi-.js} +1 -1
- package/dist/ui/assets/{DocumentWorkspace-X-CpD5OO.js → DocumentWorkspace-CxA1wO3U.js} +1 -1
- package/dist/ui/assets/{EntityActivityTimeline-DD33onAC.js → EntityActivityTimeline-B8nSe8l3.js} +1 -1
- package/dist/ui/assets/{InitiativesModule-5nDXtIjf.js → InitiativesModule-VY95v38E.js} +1 -1
- package/dist/ui/assets/{PlansPage-B8nDR1hQ.js → PlansPage-CQbKDv1a.js} +1 -1
- package/dist/ui/assets/{TaskContextUpload-DrGrXJHm.js → TaskContextUpload-DvDlNpHC.js} +1 -1
- package/dist/ui/assets/TaskSettings-CUWbYYtP.js +12 -0
- package/dist/ui/assets/{WorkflowsModule-DWCGhEWT.js → WorkflowsModule-CgM3Jako.js} +1 -1
- package/dist/ui/assets/documentReferences-Do9YjrS3.js +1 -0
- package/dist/ui/assets/index--mh3pktj.js +5 -0
- package/dist/ui/assets/index-BawaaEXS.css +1 -0
- package/dist/ui/index.html +2 -2
- package/dist/utils/theme.js +1 -1
- package/package.json +1 -1
- package/src/resources/templates/workflow-sources/workflowDocs.mjs +10 -10
- package/src/resources/templates/workflows/collaborate.yaml +2 -3
- package/src/resources/templates/workflows/do.yaml +2 -3
- package/src/resources/templates/workflows/evaluate.yaml +2 -3
- package/src/resources/templates/workflows/execute.yaml +12 -15
- package/src/resources/templates/workflows/plan.yaml +3 -4
- package/src/resources/templates/workflows/review.yaml +2 -3
- package/dist/ui/assets/TaskSettings-BXVvZZwH.js +0 -9
- package/dist/ui/assets/documentReferences-Crup321p.js +0 -1
- package/dist/ui/assets/index-B9k24Aym.js +0 -5
- package/dist/ui/assets/index-DNeR5dYW.css +0 -1
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{r as l,j as e,R as Ke}from"./vendor-react-CKJs5o3c.js";import{p as gn,t as s,T as Ls,P as Ve,A as Ps,I as de,r as X,D as xn,a as ra,b as yn,l as ja,c as bn,d as ca}from"./index-B9k24Aym.js";import{T as qe,P as as,X as Is,g as ka,f as Ca,I as ht,a6 as _s,n as vn,h as _e,q as Na,a7 as da,m as ce,d as fn,a8 as pa,a9 as ua,aa as yt,L as Ta,ab as jn,b as ae,j as Te,ac as kn,ad as Cn,p as Nn,ae as bt,a as gt,af as Tn,Z as ws,B as ma,c as Ss,o as wn,a0 as ha,ag as Sn,ah as $n,ai as wa,aj as In,ak as _n,al as Ln,am as Pn}from"./vendor-icons-CLnehDTw.js";import"./vendor-markdown-BUxTU7dS.js";import"./vendor-dnd-DRzYolkg.js";import"./vendor-router-BbWMxlnO.js";const An={aiProfileToken:"X-Taskforce-AI-Profile-Token",aiProfileName:"X-Taskforce-AI-Name",aiProfileIcon:"X-Taskforce-AI-Icon",aiProfileColor:"X-Taskforce-AI-Color",aiProfileDescription:"X-Taskforce-AI-Description",aiProfileRole:"X-Taskforce-AI-Role",aiProfileProvider:"X-Taskforce-AI-Provider",aiProfileModel:"X-Taskforce-AI-Model",aiProfileSurfaceType:"X-Taskforce-AI-Surface-Type"};function Ne(a){return String(a||"").trim()||null}function Bn(a){return a==null?null:gn(a)}function Mn(a){return{aiProfileToken:Ne(a.aiProfileToken),aiProfileName:Ne(a.aiProfileName),aiProfileIcon:Ne(a.aiProfileIcon),aiProfileColor:Ne(a.aiProfileColor),aiProfileDescription:Ne(a.aiProfileDescription),aiProfileRole:Ne(a.aiProfileRole),aiProfileProvider:Ne(a.aiProfileProvider),aiProfileModel:Ne(a.aiProfileModel),aiProfileSurfaceType:Bn(a.aiProfileSurfaceType)}}function Dn(a){const o=Mn(a),h={};for(const[g,b]of Object.entries(An)){const N=o[g];N&&(h[b]=N)}return h}const ga={general:{name:"Taskforce MCP Agent",icon:"Bot",role:"AI collaborator",provider:"MCP client",model:"Local MCP",surfaceType:"agent"},cursor:{name:"Cursor",icon:"Bot",role:"IDE coding assistant",provider:"Cursor",model:"Cursor",surfaceType:"ide"},cline:{name:"Cline",icon:"Bot",role:"IDE coding assistant",provider:"Cline",model:"Cline",surfaceType:"ide"},vscode:{name:"VS Code Copilot",icon:"Bot",role:"IDE coding assistant",provider:"Microsoft",model:"Copilot",surfaceType:"ide"},windsurf:{name:"Windsurf",icon:"Bot",role:"IDE coding assistant",provider:"Windsurf",model:"Windsurf",surfaceType:"ide"},antigravity:{name:"Antigravity",icon:"Bot",role:"Coding agent",provider:"Google",model:"Antigravity",surfaceType:"coding_tool"},openclaw:{name:"OpenClaw",icon:"Bot",role:"AI agent",provider:"OpenClaw",model:"OpenClaw",surfaceType:"agent"},codex:{name:"Codex",icon:"Bot",role:"Coding agent",provider:"OpenAI",model:"Codex",surfaceType:"cli"},"claude-code":{name:"Claude Code",icon:"Bot",role:"Coding agent",provider:"Anthropic",model:"Claude Code",surfaceType:"cli"},"gemini-cli":{name:"Gemini CLI",icon:"Bot",role:"Coding agent",provider:"Google",model:"Gemini CLI",surfaceType:"cli"},"claude-desktop":{name:"Claude Desktop",icon:"Bot",role:"Desktop AI collaborator",provider:"Anthropic",model:"Claude Desktop",surfaceType:"chat_app"},"chatgpt-desktop":{name:"ChatGPT Desktop",icon:"Bot",role:"Desktop AI collaborator",provider:"OpenAI",model:"ChatGPT Desktop",surfaceType:"chat_app"}};function En(a){const o=ga[a]||ga.general;return{TASKFORCE_AI_NAME:o.name,TASKFORCE_AI_ICON:o.icon,TASKFORCE_AI_ROLE:o.role,TASKFORCE_AI_PROVIDER:o.provider,TASKFORCE_AI_MODEL:o.model,TASKFORCE_AI_SURFACE_TYPE:o.surfaceType}}const xt=[{id:"general",label:"General"},{id:"antigravity",label:"Antigravity"},{id:"claude-code",label:"Claude Code CLI"},{id:"cline",label:"Cline"},{id:"codex",label:"Codex"},{id:"cursor",label:"Cursor"},{id:"gemini-cli",label:"Gemini CLI"},{id:"openclaw",label:"OpenClaw"},{id:"vscode",label:"VS Code / Copilot"},{id:"windsurf",label:"Windsurf"}];function vt(a,o){return String(a||"").toLowerCase().replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/-+/g,"-").replace(/^[-_]+|[-_]+$/g,"")||o.toLowerCase()}function Rn(a,o){const g=vt(a||o||"workspace","workspace").slice(0,25)||"workspace";return vt(`taskforce-${g}`,"taskforce-workspace")}function zn(a,o){return o}function Gn(a){return{Authorization:`Bearer ${a.tokenValue}`,...Dn(a)}}function On(a){return`${a} Keep the generated AI bootstrap headers intact so Taskforce can bind and restore the same AI profile automatically.`}function xe(a,o){return On(`${a} Use the generated config exactly as shown.`)}function ye(a){return`${a} Use the generated config exactly as shown. No token is required for local stdio MCP.`}function ft(a){return JSON.stringify(a)}function Fn(a){return`[${a.map(o=>ft(o)).join(", ")}]`}function Hn(a){return!a||Object.keys(a).length===0?[]:[`env = { ${Object.entries(a).map(([o,h])=>`${o} = ${ft(h)}`).join(", ")} }`]}function xa(a){return/^[A-Za-z0-9_./:@%+=,-]+$/.test(a)?a:`'${a.replace(/'/g,`'"'"'`)}'`}function Wn(a){const{clientId:o,endpoint:h,tokenValue:g,serverId:b}=a,N=Gn(a);N.Authorization;const w=Object.entries(N).filter(([$])=>$!=="Authorization").map(([$,A])=>` --header "${$}: ${A}"`).join("");switch(o){case"general":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:{url:h,headers:N},instructionLabel:"General MCP Configuration Instructions",instructionText:xe("Add this server to your MCP client using its standard remote HTTP configuration format.")};case"cursor":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:{url:h,headers:N},instructionLabel:"Cursor Configuration Instructions",instructionText:xe("Open Cursor settings, find MCP servers, and paste this config.")};case"cline":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:{url:h,type:"streamableHttp",headers:N},instructionLabel:"Cline Configuration Instructions",instructionText:xe("Open Cline MCP Servers, add a remote server, or paste this into the Cline MCP config with Streamable HTTP selected.")};case"vscode":return{clientId:o,kind:"json",rootKey:"servers",serverConfig:{type:"http",url:h,headers:N},instructionLabel:"VS Code Configuration Instructions",instructionText:xe("Open .vscode/mcp.json or MCP: Open User Configuration and add this server under the servers object.")};case"windsurf":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:{serverUrl:h,headers:N},instructionLabel:"Windsurf Configuration Instructions",instructionText:xe("Open Windsurf MCP settings, add a server, and paste this config.")};case"antigravity":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:{serverUrl:h,headers:N},instructionLabel:"Antigravity Configuration Instructions",instructionText:xe("Open Antigravity MCP settings, view the raw config, and paste this Antigravity-specific configuration.")};case"openclaw":return{clientId:o,kind:"json",rootKey:"servers",wrapperKeys:["mcp"],serverConfig:{transport:"streamable-http",url:h,headers:N},instructionLabel:"OpenClaw Configuration Instructions",instructionText:xe("Open ~/.openclaw/openclaw.json and add this server under mcp.servers.")};case"codex":return{clientId:o,kind:"text",renderedText:[`[mcp_servers.${b}]`,`url = "${h}"`,`http_headers = { ${Object.entries(N).map(([$,A])=>`${$} = "${A}"`).join(", ")} }`].join(`
|
|
2
|
-
`),instructionLabel:"Codex Configuration Instructions",instructionText:xe("Open ~/.codex/config.toml and add this Codex MCP entry.")};case"claude-code":return{clientId:o,kind:"text",renderedText:`claude mcp add --transport http ${b} ${h} --header "Authorization: Bearer ${g}"${w}`,instructionLabel:"Claude Code Configuration Instructions",instructionText:xe("Run this Claude Code command in your terminal to add the remote Taskforce MCP server.")};case"gemini-cli":return{clientId:o,kind:"text",renderedText:`gemini mcp add ${b} ${h} --transport http --header "Authorization: Bearer ${g}"${w}`,instructionLabel:"Gemini CLI Configuration Instructions",instructionText:xe("Run this Gemini CLI command in your terminal to add the remote Taskforce MCP server. Add --scope user if you want it available across all projects.")};case"claude-desktop":return{clientId:o,kind:"text",renderedText:zn(o,h),instructionLabel:"Claude Desktop Configuration Instructions",instructionText:"Open Claude Desktop Settings > Connectors, paste this MCP server URL, and complete the Taskforce OAuth flow to authorize one workspace."};case"chatgpt-desktop":return{clientId:o,kind:"text",renderedText:h,instructionLabel:"ChatGPT Desktop Configuration Instructions",instructionText:"Open ChatGPT Apps & Connectors / developer mode, paste this MCP server URL, and complete the Taskforce OAuth authorize flow when ChatGPT opens it."};default:{const $=o;throw new Error(`Unsupported MCP client: ${$}`)}}}function Un(a){const{clientId:o,serverId:h,serverConfig:g}=a,b={command:g.command,args:g.args,...g.env&&Object.keys(g.env).length>0?{env:g.env}:{}},N=Object.entries(g.env||{}).map(([$,A])=>` --env ${xa(`${$}=${A}`)}`).join(""),w=[g.command,...g.args].map($=>xa($)).join(" ");switch(o){case"general":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:b,instructionLabel:"General MCP Configuration Instructions",instructionText:ye("Add this server to your MCP client using its standard local stdio configuration format.")};case"cursor":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:b,instructionLabel:"Cursor Configuration Instructions",instructionText:ye("Open Cursor settings, find MCP servers, and paste this local stdio config.")};case"cline":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:b,instructionLabel:"Cline Configuration Instructions",instructionText:ye("Open Cline MCP Servers and paste this local stdio server config.")};case"vscode":return{clientId:o,kind:"json",rootKey:"servers",serverConfig:{type:"stdio",...b},instructionLabel:"VS Code Configuration Instructions",instructionText:ye("Open .vscode/mcp.json or MCP: Open User Configuration and add this server under the servers object.")};case"windsurf":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:b,instructionLabel:"Windsurf Configuration Instructions",instructionText:ye("Open Windsurf MCP settings and paste this local stdio config.")};case"antigravity":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:b,instructionLabel:"Antigravity Configuration Instructions",instructionText:ye("Open Antigravity MCP settings, view the raw config, and paste this local stdio configuration.")};case"openclaw":return{clientId:o,kind:"json",rootKey:"servers",wrapperKeys:["mcp"],serverConfig:{transport:"stdio",...b},instructionLabel:"OpenClaw Configuration Instructions",instructionText:ye("Open ~/.openclaw/openclaw.json and add this local stdio server under mcp.servers.")};case"codex":return{clientId:o,kind:"text",renderedText:[`[mcp_servers.${h}]`,`command = ${ft(g.command)}`,`args = ${Fn(g.args)}`,...Hn(g.env)].join(`
|
|
3
|
-
`),instructionLabel:"Codex Configuration Instructions",instructionText:ye("Open ~/.codex/config.toml and add this local MCP entry.")};case"claude-code":return{clientId:o,kind:"text",renderedText:`claude mcp add ${h}${N} -- ${w}`,instructionLabel:"Claude Code Configuration Instructions",instructionText:ye("Run this Claude Code command in your terminal to add the local Taskforce MCP server.")};case"gemini-cli":return{clientId:o,kind:"json",rootKey:"mcpServers",serverConfig:b,instructionLabel:"Gemini CLI Configuration Instructions",instructionText:ye("Open ~/.gemini/settings.json and add this local MCP server under mcpServers.")};case"claude-desktop":case"chatgpt-desktop":throw new Error(`Unsupported local MCP client: ${o}`);default:{const $=o;throw new Error(`Unsupported local MCP client: ${$}`)}}}const Kn="_categoryManagerContainer_1ibti_1",Vn="_pathInputGroupStretch_1ibti_9",qn="_emptyStateItalic_1ibti_13",Jn="_emptyStateBox_1ibti_28",Yn="_emptyStateBare_1ibti_44",Xn="_emptyStateIcon_1ibti_49",Zn="_taxonomyGrid_1ibti_55",Qn="_checkboxRow_1ibti_61",ei="_checkboxLabel_1ibti_67",si="_checkboxSmall_1ibti_75",ti="_flexGap8_1ibti_80",ai="_optionOrderButtons_1ibti_85",ni="_addTaxonomyBtnSmall_1ibti_92",R={categoryManagerContainer:Kn,pathInputGroupStretch:Vn,emptyStateItalic:qn,emptyStateBox:Jn,emptyStateBare:Yn,emptyStateIcon:Xn,taxonomyGrid:Zn,checkboxRow:Qn,checkboxLabel:ei,checkboxSmall:si,flexGap8:ti,optionOrderButtons:ai,addTaxonomyBtnSmall:ni},ii="_taxonomyDrillDown_1oekr_1",oi="_drillDownList_1oekr_7",li="_librarySection_1oekr_13",ri="_libraryLauncher_1oekr_18",ci="_libraryLauncherInfo_1oekr_40",di="_libraryLauncherIcon_1oekr_47",pi="_libraryLauncherText_1oekr_60",ui="_libraryLauncherLabel_1oekr_67",mi="_libraryLauncherSubtext_1oekr_73",hi="_libraryLauncherMeta_1oekr_79",gi="_drillDownSection_1oekr_89",xi="_drillDownSectionHeader_1oekr_95",yi="_drillDownSectionTitle_1oekr_102",bi="_drillDownItem_1oekr_111",vi="_drillDownItemAction_1oekr_126",fi="_drillDownItemDimmed_1oekr_145",ji="_drillDownItemInfo_1oekr_153",ki="_drillDownItemText_1oekr_159",Ci="_drillDownItemLabel_1oekr_165",Ni="_drillDownItemSubtext_1oekr_170",Ti="_systemIcon_1oekr_175",wi="_chevron_1oekr_179",Si="_orderButtons_1oekr_184",$i="_createOverlay_1oekr_195",Ii="_createDialog_1oekr_209",_i="_createDialogTitle_1oekr_218",Li="_inputGroup_1oekr_224",Pi="_dialogActions_1oekr_228",Ai="_createSubmit_1oekr_234",Bi="_createCancel_1oekr_238",Mi="_taxonomyDetailView_1oekr_242",Di="_detailHeader_1oekr_249",Ei="_taxonomyBreadcrumbs_1oekr_257",Ri="_breadcrumbPrev_1oekr_263",zi="_breadcrumbIcon_1oekr_284",Gi="_breadcrumbDivider_1oekr_288",Oi="_breadcrumbActive_1oekr_293",Fi="_detailContent_1oekr_301",y={taxonomyDrillDown:ii,drillDownList:oi,librarySection:li,libraryLauncher:ri,libraryLauncherInfo:ci,libraryLauncherIcon:di,libraryLauncherText:pi,libraryLauncherLabel:ui,libraryLauncherSubtext:mi,libraryLauncherMeta:hi,drillDownSection:gi,drillDownSectionHeader:xi,drillDownSectionTitle:yi,drillDownItem:bi,drillDownItemAction:vi,drillDownItemDimmed:fi,drillDownItemInfo:ji,drillDownItemText:ki,drillDownItemLabel:Ci,drillDownItemSubtext:Ni,systemIcon:Ti,chevron:wi,orderButtons:Si,createOverlay:$i,createDialog:Ii,createDialogTitle:_i,inputGroup:Li,dialogActions:Pi,createSubmit:Ai,createCancel:Bi,taxonomyDetailView:Mi,detailHeader:Di,taxonomyBreadcrumbs:Ei,breadcrumbPrev:Ri,breadcrumbIcon:zi,breadcrumbDivider:Gi,breadcrumbActive:Oi,detailContent:Fi};function Hi(a){const o=[{id:"categories",label:a.displayLabels?.category||"Categories",kind:"system",summary:`${a.categories.length} configured`},{id:"types",label:a.displayLabels?.type||"Task Types",kind:"system",summary:`${a.types.length} active`},{id:"priorities",label:a.displayLabels?.priority||"Priority Levels",kind:"system",summary:`${a.priorities.length} levels`},{id:"complexities",label:"Complexity",kind:"attribute",summary:a.manualComplexityEnabled?"Enabled":"Disabled (default)"}],h=a.taxonomies.map(g=>({id:g.id,label:g.label,kind:"custom",summary:`${g.options.length} options${g.status==="retired"?" · Retired":""}`,taxonomy:g}));return[...o,...h]}function Wi({taxonomy:a,onUpdateTaxonomy:o,onRemoveTaxonomy:h,onRestoreTaxonomy:g}){const[b,N]=l.useState(""),[w,$]=l.useState(!1),[A,z]=l.useState(""),[O,j]=l.useState(a.label),[I,P]=l.useState((a.aliases||[]).join(", ")),[U,B]=l.useState(""),[x,S]=l.useState(null),E=n=>{const d=n.split(",").map(L=>L.trim()).filter(Boolean);return d.length>0?Array.from(new Set(d)):void 0};l.useEffect(()=>{j(a.label),P((a.aliases||[]).join(", "));const n=a.options.find(d=>String(d.value)===String(b));S(n||null),B((n?.aliases||[]).join(", "))},[a,b]);const C=n=>{o({...a,...n})},M=()=>{if(!A.trim())return;const n=A.toLowerCase().trim().replace(/\s+/g,"-");if(a.options.some(L=>L.value===n)){alert("Option value already exists");return}const d={value:n,label:A.trim(),color:Ve[a.options.length%Ve.length],status:"active"};C({options:[...a.options,d]}),z(""),$(!1),N(n)},c=(n,d)=>{C({options:a.options.map(L=>String(L.value)===String(n)?{...L,...d}:L)})},W=n=>{c(n,{status:"retired"})},m=n=>{c(n,{status:"active"})},_=(n,d)=>{const L=a.options.findIndex(F=>String(F.value)===String(n));if(L<0)return;const f=L+d;if(f<0||f>=a.options.length)return;const G=[...a.options],[u]=G.splice(L,1);G.splice(f,0,u),C({options:G})};return e.jsxs("div",{className:R.categoryManagerContainer,children:[e.jsxs("div",{className:`${s.categoryConfigPanel} ${s.configPanel} ${s.marginBottom24}`,children:[e.jsxs("div",{className:`${s.flexBetween} ${s.marginBottom16}`,children:[e.jsx("div",{className:s.flex1,children:e.jsx("label",{className:`${s.subLabel} ${s.subLabelBlock} ${s.marginBottom8}`,children:"Taxonomy Settings"})}),!a.isSystem&&(a.status==="retired"?e.jsx("button",{type:"button",className:s.saveSettingsBtn,onClick:()=>g?.(a.id),children:"Restore Taxonomy"}):h&&e.jsxs("button",{type:"button",className:`${s.destructiveBtn} ${s.deleteBtnSmall}`,onClick:()=>{confirm(`Retire taxonomy "${a.label}"? Existing task data will be preserved as legacy values.`)&&h(a.id)},children:[e.jsx(qe,{size:14,className:s.trashIcon})," Retire Taxonomy"]}))]}),a.status==="retired"&&e.jsx("p",{className:s.settingsHint,style:{marginTop:"-4px",marginBottom:"16px"},children:"This taxonomy is retired. Existing tasks keep their values, but it is hidden from normal new-task entry unless a task already uses it."}),e.jsxs("div",{className:R.taxonomyGrid,children:[e.jsxs("div",{className:s.settingGroup,style:{margin:0},children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Display Label"}),e.jsx("input",{className:s.input,value:O,onChange:n=>j(n.target.value),onBlur:()=>C({label:O}),disabled:a.isSystem,placeholder:"e.g. Sprint, Phase..."})]}),e.jsxs("div",{className:s.settingGroup,style:{margin:0},children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Description"}),e.jsx("textarea",{className:s.textarea,value:a.description||"",onChange:n=>C({description:n.target.value}),placeholder:"Optional guidance for when and how to use this taxonomy...",rows:3,style:{minHeight:"88px"}})]}),e.jsxs("div",{className:s.settingGroup,style:{margin:0},children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Aliases"}),e.jsx("input",{className:s.input,value:I,onChange:n=>P(n.target.value),onBlur:()=>C({aliases:E(I)}),placeholder:"Optional aliases, comma-separated"})]}),e.jsxs("div",{className:s.settingGroup,style:{margin:0},children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Widget Type"}),e.jsxs("select",{className:s.select,value:a.widgetType,onChange:n=>{const d=n.target.value;C({widgetType:d,multiSelect:d==="level"?!1:a.multiSelect})},children:[e.jsx("option",{value:"select",children:"Dropdown (Select Box)"}),e.jsx("option",{value:"level",children:"Level Selector (Segmented)"})]})]})]}),e.jsxs("div",{className:R.checkboxRow,children:[e.jsxs("label",{className:R.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:a.isRequired,onChange:n=>C({isRequired:n.target.checked}),className:R.checkboxSmall}),"Mark as Required"]}),e.jsxs("label",{className:`${R.checkboxLabel} ${a.widgetType==="level"?s.opacity50:""}`,children:[e.jsx("input",{type:"checkbox",checked:a.multiSelect,onChange:n=>C({multiSelect:n.target.checked}),disabled:a.widgetType==="level",className:R.checkboxSmall}),"Allow Multi-select"]})]}),e.jsxs("div",{className:R.checkboxRow,children:[e.jsxs("label",{className:R.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:a.formEnabled!==!1,onChange:n=>C({formEnabled:n.target.checked}),className:R.checkboxSmall}),"Show in Task Form"]}),e.jsxs("label",{className:R.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:a.filterEnabled!==!1,onChange:n=>C({filterEnabled:n.target.checked}),className:R.checkboxSmall}),"Show in Filters"]}),e.jsxs("label",{className:R.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:a.sortEnabled===!0,onChange:n=>C({sortEnabled:n.target.checked}),className:R.checkboxSmall}),"Show in Sorts"]})]})]}),e.jsx("div",{className:`${s.configDivider} ${s.configDividerMargin24}`}),e.jsxs("div",{className:`${s.configPanel} ${s.flex1} ${s.flexCol}`,children:[e.jsxs("div",{className:`${s.headerFlex}`,style:{marginBottom:x&&!w||w?"16px":"0"},children:[e.jsx("div",{style:{flex:1},children:e.jsx(Ls,{value:b,options:[{value:"",label:"Select an option to configure...",icon:"HelpCircle",color:"var(--text-secondary)"},...a.options.map(n=>({value:n.value,label:n.status==="retired"?`${n.label} (Retired)`:n.label,icon:n.icon,color:n.color}))],onChange:n=>{N(n),$(!1)},disabled:w})}),w?e.jsx("button",{type:"button",onClick:()=>$(!1),title:"Cancel",className:`${s.browseBtn} ${s.cancelBtnRed}`,children:e.jsx(Is,{size:18})}):e.jsx("button",{type:"button",className:s.browseBtn,onClick:()=>$(!0),title:"Add Option",children:e.jsx(as,{size:18})})]}),w&&e.jsx("div",{className:`${s.configItem} ${s.marginBottom16}`,children:e.jsxs("div",{className:R.flexGap8,children:[e.jsx("input",{type:"text",className:s.input,placeholder:"New option label...",value:A,onChange:n=>z(n.target.value),onKeyDown:n=>{n.key==="Enter"&&M()},autoFocus:!0}),e.jsx("button",{type:"button",className:s.saveSettingsBtn,onClick:M,disabled:!A.trim(),children:"Add Option"})]})}),x&&!w&&e.jsxs("div",{className:s.flex1,children:[e.jsx("div",{className:`${s.configDivider} ${s.marginBottom20}`}),e.jsxs("div",{className:`${s.flexBetweenCenter} ${s.marginBottom20}`,children:[e.jsxs("div",{className:`${s.flexColGap4} ${s.flex1}`,children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Option Label"}),e.jsxs("div",{className:s.gridConfig,children:[e.jsx("input",{className:s.input,value:x.label,onChange:n=>c(x.value,{label:n.target.value}),placeholder:"Option Label"}),x.status==="retired"?e.jsx("button",{type:"button",className:s.saveSettingsBtn,onClick:()=>m(x.value),title:"Restore Option",children:"Restore"}):e.jsxs("button",{type:"button",className:`${s.destructiveBtn} ${s.deleteBtnMedium}`,onClick:()=>W(x.value),title:"Retire Option",children:[e.jsx(qe,{size:14,className:s.trashIcon})," Retire"]})]})]}),e.jsxs("div",{className:R.optionOrderButtons,children:[e.jsx("button",{type:"button",className:s.browseBtn,title:"Move option up",onClick:()=>_(x.value,-1),disabled:a.options[0]?.value===x.value,children:e.jsx(ka,{size:16})}),e.jsx("button",{type:"button",className:s.browseBtn,title:"Move option down",onClick:()=>_(x.value,1),disabled:a.options[a.options.length-1]?.value===x.value,children:e.jsx(Ca,{size:16})})]})]}),e.jsx("p",{className:s.settingsHint,style:{marginBottom:"20px"},children:"Retired options stay visible for existing tasks and filters, but they should not be used for new work."}),e.jsxs("div",{className:s.settingGroup,style:{marginBottom:"20px"},children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Aliases"}),e.jsx("input",{className:s.input,value:U,onChange:n=>B(n.target.value),onBlur:()=>c(x.value,{aliases:E(U)}),placeholder:"Optional aliases, comma-separated"})]}),e.jsx("div",{className:`${s.configDivider} ${s.configDividerMargin}`}),e.jsxs("div",{className:s.configSection,children:[e.jsx("label",{className:`${s.label} ${s.inputLabelBlock}`,children:"Visual Style"}),e.jsxs("div",{className:s.categorySubConfig,children:[e.jsx("div",{className:s.colorPickerGrid,children:Ve.map(n=>{const d=X(n)||"#000000",L=x.color===n,f=x.icon&&ht[x.icon]?ht[x.icon]:_s;return e.jsx("button",{type:"button",className:`${s.colorSwatch} ${L?s.colorSwatchActive:""}`,style:{borderColor:L?d:void 0,"--swatch-color":d,"--swatch-border-color":`${d}80`},onClick:()=>c(x.value,{color:n}),title:n,children:e.jsx(f,{size:14,style:{color:d}})},n)})}),e.jsx("div",{className:s.iconGrid,children:Ps.map(n=>{const d=ht[n]||de[n]||_s;return e.jsx("button",{type:"button",className:`${s.iconPickerBtn} ${x.icon===n?s.iconPickerBtnActive:""}`,style:x.icon===n?{borderColor:X(x.color),color:X(x.color),background:`${X(x.color)}15`}:{},onClick:()=>c(x.value,{icon:n}),title:n,children:e.jsx(d,{size:16})},n)})})]})]})]}),!x&&!w&&e.jsxs("div",{className:`${R.emptyStateBox} ${R.emptyStateBare}`,children:[e.jsx(vn,{size:24,className:R.emptyStateIcon}),"Select an option above to configure its appearance"]})]})]})}function Ui(a){const{displayLabel:o,categories:h,pathValidation:g,onUpdateDisplayLabel:b,onUpdateCategory:N,onRemoveCategory:w,onSaveCategory:$,onAddPath:A,onRemovePath:z,onUpdateCategoryIcon:O,onUpdateCategoryColor:j,onBrowseFolders:I}=a,[P,U]=l.useState(""),[B,x]=l.useState(!1),[S,E]=l.useState(""),[C,M]=l.useState(""),[c,W]=l.useState(o||""),[m,_]=l.useState("");l.useEffect(()=>{W(o||"")},[o]),l.useEffect(()=>{const u=h.find(F=>F.value===P);u&&M(u.label)},[P,h]);const n=()=>{if(!S.trim())return;$(S);const u=S.trim().toLowerCase().replace(/\s+/g,"-");E(""),x(!1),setTimeout(()=>U(u),100)},d=u=>{C&&C!==u.label&&N({...u,label:C},u.label)},L=u=>{const F=[];if(u.path&&F.push(u.path),u.paths&&u.paths.length>0)for(const K of u.paths)F.includes(K)||F.push(K);return F},f=h.find(u=>u.value===P),G=f?.value===xn;return e.jsxs("div",{className:`${s.configPanel} ${s.flex1}`,children:[e.jsxs("div",{className:`${s.headerFlex}`,style:{marginBottom:f&&!B||B?"20px":"0"},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("label",{id:"category-config-label",className:s.label,style:{display:"none"},children:"Select Category"}),e.jsx(Ls,{value:P,options:[{value:"",label:"Select a category to configure...",icon:"HelpCircle",color:"var(--text-secondary)"},...h.map(u=>({value:u.value,label:`${u.label}${u.disabled?" (Legacy)":""}`,icon:u.icon,color:u.color}))],onChange:u=>{U(String(u)),x(!1)},disabled:B,ariaLabelledBy:"category-config-label"})]}),B?e.jsx("button",{type:"button",className:`${s.browseBtn} ${s.cancelBtnRed}`,onClick:()=>x(!1),title:"Cancel creation",children:e.jsx(Is,{size:18})}):e.jsx("button",{type:"button",className:s.browseBtn,onClick:()=>x(!0),title:"Create new category",children:e.jsx(as,{size:18})})]}),B&&e.jsxs("div",{className:`${s.configItem} ${s.marginBottom16}`,children:[e.jsx("div",{className:`${s.labelRow} ${s.marginBottom8}`,children:e.jsx("label",{className:s.settingsLabel,children:"New Category Name"})}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.jsx("input",{type:"text",className:s.input,placeholder:"e.g. Backend, Frontend, API...",value:S,onChange:u=>E(u.target.value),onKeyDown:u=>{u.key==="Enter"&&n()},autoFocus:!0}),e.jsx("button",{type:"button",className:s.saveSettingsBtn,onClick:n,disabled:!S.trim(),children:"Create"})]})]}),f&&!B&&e.jsxs("div",{className:s.flex1,style:{overflowY:"auto",marginRight:"-8px",paddingRight:"8px"},children:[e.jsx("div",{className:`${s.configDivider} ${s.marginBottom20}`}),e.jsxs("div",{className:`${s.configSection} ${s.marginBottom20}`,children:[e.jsxs("div",{className:s.flexBetween,children:[e.jsx("label",{className:`${s.subLabel} ${s.subLabelBlock}`,children:"General"}),!G&&e.jsxs("button",{type:"button",onClick:()=>{confirm(`Retire category "${f.label}"? Existing tasks will be reassigned to ${ra}.`)&&(w(f.value),U(""))},title:"Retire Category",className:`${s.destructiveBtn} ${s.deleteBtnSmall}`,children:[e.jsx(qe,{size:14,className:s.trashIcon})," Retire"]})]}),G&&e.jsxs("p",{className:s.settingsHint,style:{marginBottom:"12px"},children:[ra," is the protected fallback category and cannot be retired."]}),e.jsxs("div",{className:s.gridConfig,children:[e.jsxs("div",{className:s.flexColGap4,children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Display Label"}),e.jsx("input",{className:s.input,value:c,onChange:u=>W(u.target.value),onBlur:()=>b?.(c.trim())})]}),e.jsxs("div",{className:s.flexColGap4,children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Label"}),e.jsx("input",{className:s.input,value:C,onChange:u=>M(u.target.value),onBlur:()=>d(f),onKeyDown:u=>{u.key==="Enter"&&(d(f),u.target.blur())}})]}),e.jsxs("div",{className:s.flexColGap4Center,children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Available for New Tasks"}),e.jsx("input",{type:"checkbox",checked:!f.disabled,onChange:()=>N({...f,disabled:!f.disabled}),className:s.checkboxInput})]})]}),e.jsx("p",{className:s.settingsHint,style:{marginTop:"12px"},children:"Turn this off to keep the category on existing tasks while removing it from new task selection by default."})]}),e.jsx("div",{className:`${s.configDivider} ${s.configDividerMargin}`}),e.jsxs("div",{className:`${s.configSection} ${s.marginBottom20}`,children:[e.jsx("label",{className:s.subLabel,style:{fontSize:"14px",fontWeight:600,display:"block",marginBottom:"8px"},children:"Context Paths"}),e.jsx("p",{className:s.settingsHint,style:{marginBottom:"12px"},children:"Files in these paths will be included as context for tasks in this category."}),L(f).length>0&&e.jsx("div",{className:`${s.pathList} ${s.pathListMargin}`,children:L(f).map((u,F)=>{const K=g[u],ee=K?.exists,Je=K?.isFile;return e.jsxs("div",{className:`${s.pathChip} ${ee===!1?s.pathInvalid:ee?s.pathValid:""}`,children:[ee===void 0?e.jsx(_e,{size:12,className:s.spinner}):ee?Je?e.jsx(Na,{size:12,className:s.pathValidIcon}):e.jsx(da,{size:12,className:s.pathValidIcon}):e.jsx(ce,{size:12,className:s.pathInvalidIcon}),e.jsx("span",{className:s.pathText,title:u,children:u}),e.jsx("button",{type:"button",className:s.removePathBtn,onClick:()=>z(f.value,u),title:"Remove path",children:e.jsx(Is,{size:10})})]},F)})}),e.jsxs("div",{className:`${s.pathInputGroup} ${R.pathInputGroupStretch}`,children:[e.jsx("input",{type:"text",className:s.input,value:m,onChange:u=>_(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),m.trim()&&(A(f.value,m.trim()),_("")))},placeholder:"Add path (e.g. frontend/src/...)"}),e.jsx("button",{type:"button",className:s.browseBtn,onClick:()=>{m.trim()&&(A(f.value,m.trim()),_(""))},disabled:!m.trim(),title:"Add path",children:e.jsx(as,{size:18})}),e.jsx("button",{type:"button",className:s.browseBtn,onClick:()=>I(f.value),title:"Browse folders",children:e.jsx(da,{size:16})})]})]}),e.jsx("div",{className:`${s.configDivider} ${s.configDividerMargin}`}),e.jsxs("div",{className:s.configSection,children:[e.jsx("label",{className:`${s.subLabel} ${s.subLabelBlock} ${s.subLabelBlock12}`,children:"Visual Style"}),e.jsxs("div",{className:s.categorySubConfig,children:[e.jsx("div",{className:s.colorPickerGrid,children:Ve.map(u=>{const F=X(u)||"#000000",K=f.color===u,ee=f.icon&&de[f.icon]?de[f.icon]:fn;return e.jsx("button",{type:"button",className:`${s.colorSwatch} ${K?s.colorSwatchActive:""}`,style:{borderColor:K?F:void 0,"--swatch-color":F,"--swatch-border-color":`${F}80`},onClick:()=>j(f.value,u),title:u,children:e.jsx(ee,{size:14,style:{color:F}})},u)})}),e.jsx("div",{className:s.iconGrid,children:Ps.map(u=>{const F=de[u];return e.jsx("button",{type:"button",className:`${s.iconPickerBtn} ${f.icon===u?s.iconPickerBtnActive:""}`,style:f.icon===u?{borderColor:X(f.color),color:X(f.color),background:`${X(f.color)}15`}:{},onClick:()=>O(f.value,u),title:u,children:e.jsx(F,{size:16})},u)})})]})]})]}),!f&&!B&&e.jsx("div",{className:`${R.emptyStateItalic} ${R.emptyStateBare}`,children:"Select a category above to configure settings"})]})}function Ki(a){const{types:o,onSaveType:h,onRemoveType:g,onUpdateType:b,displayLabel:N,onUpdateDisplayLabel:w}=a,[$,A]=l.useState(""),[z,O]=l.useState(!1),[j,I]=l.useState(""),[P,U]=l.useState(""),[B,x]=l.useState(N||"");l.useEffect(()=>{const c=o.find(W=>W.value===$);c&&U(c.label)},[$,o]),l.useEffect(()=>{x(N||"")},[N]);const S=o.find(c=>c.value===$),E=S?.value===yn,C=S?.status==="retired",M=()=>{if(!j.trim())return;h(j);const c=j.trim().toLowerCase().replace(/\s+/g,"-");I(""),O(!1),setTimeout(()=>A(c),100)};return e.jsxs("div",{className:`${s.configPanel} ${s.flex1}`,children:[e.jsxs("div",{className:`${s.headerFlex}`,style:{marginBottom:S&&!z||z?"20px":"0"},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("label",{id:"type-config-label",className:s.label,style:{display:"none"},children:"Select Type"}),e.jsx(Ls,{value:$,options:[{value:"",label:"Select a type to configure...",icon:"HelpCircle",color:"var(--text-secondary)"},...o.map(c=>({value:c.value,label:c.status==="retired"?`${c.label} (Retired)`:c.label,icon:c.icon||"Box",color:c.color||"violet-500"}))],onChange:c=>{A(String(c)),O(!1)},disabled:z,ariaLabelledBy:"type-config-label"})]}),z?e.jsx("button",{type:"button",className:`${s.browseBtn} ${s.cancelBtnRed}`,onClick:()=>O(!1),title:"Cancel creation",children:e.jsx(Is,{size:18})}):e.jsx("button",{type:"button",className:s.browseBtn,onClick:()=>O(!0),title:"Create new type",children:e.jsx(as,{size:18})})]}),z&&e.jsxs("div",{className:`${s.configItem} ${s.marginBottom16}`,children:[e.jsx("div",{className:`${s.labelRow} ${s.marginBottom8}`,children:e.jsx("label",{className:s.settingsLabel,children:"New Type Label"})}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.jsx("input",{type:"text",className:s.input,placeholder:"e.g. Bug, Feature, Chore...",value:j,onChange:c=>I(c.target.value),onKeyDown:c=>{c.key==="Enter"&&M()},autoFocus:!0}),e.jsx("button",{type:"button",className:s.saveSettingsBtn,onClick:M,disabled:!j.trim(),children:"Create"})]})]}),S&&!z&&e.jsxs("div",{className:s.flex1,children:[e.jsx("div",{className:`${s.configDivider} ${s.marginBottom20}`}),e.jsx("div",{className:s.flexBetweenCenter,children:e.jsxs("div",{className:`${s.flexColGap4} ${s.flex1}`,children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Display Label"}),e.jsx("input",{className:s.input,value:B,onChange:c=>x(c.target.value),onBlur:()=>w?.(B.trim())}),e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Label"}),e.jsxs("div",{className:s.gridConfig,children:[e.jsx("input",{className:s.input,value:P,onChange:c=>U(c.target.value),onBlur:()=>b(S.value,{label:P}),onKeyDown:c=>{c.key==="Enter"&&c.currentTarget.blur()}}),!E&&e.jsxs("button",{type:"button",onClick:()=>{if(C){b(S.value,{status:"active"});return}confirm(`Retire type "${S.label}"? Existing tasks using it will keep it as a legacy type until reassigned.`)&&g(S.value)},title:C?"Restore Type":"Retire Type",className:`${s.destructiveBtn} ${s.deleteBtnMedium}`,children:[e.jsx(qe,{size:14,className:s.trashIcon})," ",C?"Restore":"Retire"]})]})]})}),e.jsx("p",{className:`${s.settingsHint} ${s.marginTop12}`,children:E?"Task is the protected fallback type and cannot be retired.":C?"Retired types stay available as legacy values on existing tasks until you reassign them.":"Retiring a type removes it from new task selection while preserving it as a legacy value on tasks that already use it."}),e.jsx("div",{className:`${s.configDivider} ${s.configDividerMargin}`}),e.jsxs("div",{className:s.configSection,children:[e.jsx("label",{className:`${s.subLabel} ${s.subLabelBlock} ${s.subLabelBlock12}`,children:"Visual Style"}),e.jsxs("div",{className:s.categorySubConfig,children:[e.jsx("div",{className:s.colorPickerGrid,children:Ve.map(c=>{const W=X(c)||"#000000",m=S.color===c,_=S.icon&&de[S.icon]?de[S.icon]:_s;return e.jsx("button",{type:"button",className:`${s.colorSwatch} ${m?s.colorSwatchActive:""}`,style:{borderColor:m?W:void 0,"--swatch-color":W,"--swatch-border-color":`${W}80`},onClick:()=>b(S.value,{color:c}),title:c,children:e.jsx(_,{size:14,style:{color:W}})},c)})}),e.jsx("div",{className:s.iconGrid,children:Ps.map(c=>{const W=de[c];return e.jsx("button",{type:"button",className:`${s.iconPickerBtn} ${S.icon===c?s.iconPickerBtnActive:""}`,style:S.icon===c?{borderColor:X(S.color),color:X(S.color),background:`${X(S.color)}15`}:{},onClick:()=>b(S.value,{icon:c}),title:c,children:e.jsx(W,{size:16})},c)})})]})]})]}),!S&&!z&&e.jsx("div",{className:`${R.emptyStateItalic} ${R.emptyStateBare}`,children:"Select a type above to manage"})]})}function Vi({priorities:a,onUpdatePriorities:o,displayLabel:h,onUpdateDisplayLabel:g}){const[b,N]=l.useState(""),[w,$]=l.useState(null),[A,z]=l.useState(h||"");l.useEffect(()=>{const j=a.find(I=>String(I.value)===String(b))||null;$(j)},[a,b]),l.useEffect(()=>{z(h||"")},[h]);const O=(j,I)=>{o(a.map(P=>String(P.value)===String(j)?{...P,...I}:P))};return e.jsxs("div",{className:`${s.configPanel} ${s.flex1}`,children:[e.jsxs("div",{className:s.marginBottom20,children:[e.jsx("label",{id:"priority-config-label",className:s.label,style:{display:"none"},children:"Select Priority"}),e.jsx(Ls,{value:b,options:[{value:"",label:"Select a priority level to configure...",icon:"HelpCircle",color:"var(--text-secondary)"},...a.map(j=>({value:j.value,label:j.label,icon:j.icon||"Gauge",color:j.color||"blue-500"}))],onChange:j=>N(j),ariaLabelledBy:"priority-config-label"})]}),w?e.jsxs("div",{className:s.flex1,style:{overflowY:"auto",marginRight:"-8px",paddingRight:"8px"},children:[e.jsx("div",{className:`${s.configDivider} ${s.marginBottom20}`}),e.jsxs("div",{className:`${s.configSection} ${s.marginBottom20}`,children:[e.jsx("label",{className:`${s.subLabel} ${s.subLabelBlock}`,children:"General"}),e.jsx("p",{className:s.settingsHint,style:{marginBottom:"12px"},children:"Priority uses a fixed ordered scale. You can rename and restyle levels, but not add, remove, or reorder them here."}),e.jsxs("div",{className:s.gridConfig,children:[e.jsxs("div",{className:s.flexColGap4,children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Display Label"}),e.jsx("input",{className:s.input,value:A,onChange:j=>z(j.target.value),onBlur:()=>g?.(A.trim())})]}),e.jsxs("div",{className:s.flexColGap4,children:[e.jsx("label",{className:`${s.label} ${s.inputLabel}`,children:"Label"}),e.jsx("input",{className:s.input,value:w.label,onChange:j=>O(w.value,{label:j.target.value})})]})]})]}),e.jsx("div",{className:`${s.configDivider} ${s.configDividerMargin}`}),e.jsxs("div",{className:s.configSection,children:[e.jsx("label",{className:`${s.subLabel} ${s.subLabelBlock} ${s.subLabelBlock12}`,children:"Visual Style"}),e.jsxs("div",{className:s.categorySubConfig,children:[e.jsx("div",{className:s.colorPickerGrid,children:Ve.map(j=>{const I=X(j)||"#000000",P=w.color===j,U=w.icon&&de[w.icon]?de[w.icon]:pa;return e.jsx("button",{type:"button",className:`${s.colorSwatch} ${P?s.colorSwatchActive:""}`,style:{borderColor:P?I:void 0,"--swatch-color":I,"--swatch-border-color":`${I}80`},onClick:()=>O(w.value,{color:j}),title:j,children:e.jsx(U,{size:14,style:{color:I}})},j)})}),e.jsx("div",{className:s.iconGrid,children:Ps.map(j=>{const I=de[j]||pa;return e.jsx("button",{type:"button",className:`${s.iconPickerBtn} ${w.icon===j?s.iconPickerBtnActive:""}`,style:w.icon===j?{borderColor:X(w.color),color:X(w.color),background:`${X(w.color)}15`}:{},onClick:()=>O(w.value,{icon:j}),title:j,children:e.jsx(I,{size:16})},j)})})]})]})]}):e.jsx("div",{className:`${R.emptyStateItalic} ${R.emptyStateBare}`,children:"Select a priority above to manage"})]})}function qi(a){return a.map(o=>({...o,aliases:Array.isArray(o.aliases)?[...o.aliases]:void 0}))}function Ji(a){return a.map(o=>({...o,aliases:Array.isArray(o.aliases)?[...o.aliases]:void 0,options:qi(Array.isArray(o.options)?o.options:[])}))}const Yi=[{id:"client-delivery",label:"Client Delivery",description:"Taxonomies for client-facing work, approvals, and service commitments.",domainTag:"operations",bestFor:"Agencies, consulting, and service delivery work.",taxonomies:[{id:"approval-stage",label:"Approval Stage",description:"Track where work sits in the client or internal approval pipeline.",widgetType:"select",isSystem:!1,multiSelect:!1,isRequired:!1,formEnabled:!0,filterEnabled:!0,sortEnabled:!0,status:"active",options:[{value:"draft",label:"Draft",color:"blue-200",icon:"Pencil",status:"active"},{value:"internal-review",label:"Internal Review",color:"blue-500",icon:"Users",status:"active"},{value:"client-review",label:"Client Review",color:"amber-500",icon:"MessageSquare",status:"active"},{value:"approved",label:"Approved",color:"emerald-500",icon:"CheckCircle",status:"active"}]},{id:"service-line",label:"Service Line",description:"Identify which delivery lane owns or contributes to this work.",widgetType:"select",isSystem:!1,multiSelect:!0,isRequired:!1,formEnabled:!0,filterEnabled:!0,sortEnabled:!1,status:"active",options:[{value:"strategy",label:"Strategy",color:"violet-500",icon:"Target",status:"active"},{value:"content",label:"Content",color:"sky-500",icon:"Pencil",status:"active"},{value:"delivery",label:"Delivery",color:"emerald-500",icon:"Briefcase",status:"active"},{value:"reporting",label:"Reporting",color:"amber-500",icon:"Activity",status:"active"}]}]},{id:"content-operations",label:"Content Operations",description:"Reusable taxonomies for channels, publishing readiness, and editorial planning.",domainTag:"content",bestFor:"Editorial calendars, content teams, and publishing operations.",taxonomies:[{id:"content-channel",label:"Content Channel",description:"Show where a piece of work will be published or reused.",widgetType:"select",isSystem:!1,multiSelect:!0,isRequired:!1,formEnabled:!0,filterEnabled:!0,sortEnabled:!1,status:"active",options:[{value:"blog",label:"Blog",color:"blue-500",icon:"FileText",status:"active"},{value:"email",label:"Email",color:"amber-500",icon:"Mail",status:"active"},{value:"social",label:"Social",color:"violet-500",icon:"Flag",status:"active"},{value:"webinar",label:"Webinar",color:"violet-500",icon:"Video",status:"active"}]},{id:"publish-readiness",label:"Publish Readiness",description:"Track whether a content task is ready to move into scheduling or release.",widgetType:"select",isSystem:!1,multiSelect:!1,isRequired:!0,formEnabled:!0,filterEnabled:!0,sortEnabled:!0,status:"active",options:[{value:"not-started",label:"Not Started",color:"blue-200",icon:"Circle",status:"active"},{value:"in-review",label:"In Review",color:"amber-500",icon:"Search",status:"active"},{value:"ready",label:"Ready",color:"emerald-500",icon:"Rocket",status:"active"}]},{id:"effort-band",label:"Effort Band",description:"A lightweight numeric scale for content effort without using complexity.",widgetType:"level",isSystem:!1,multiSelect:!1,isRequired:!1,formEnabled:!1,filterEnabled:!0,sortEnabled:!0,status:"active",options:[{value:1,label:"Light",color:"teal-500",icon:"Wind",status:"active"},{value:2,label:"Standard",color:"blue-500",icon:"Minus",status:"active"},{value:3,label:"Heavy",color:"orange-500",icon:"Gauge",status:"active"}]}]},{id:"product-delivery",label:"Product Delivery",description:"Useful planning taxonomies for delivery stages, stakeholders, and delivery risk.",domainTag:"product",bestFor:"Product teams, implementation work, and cross-functional delivery.",taxonomies:[{id:"delivery-stage",label:"Delivery Stage",description:"Track how work moves from intake through active delivery.",widgetType:"select",isSystem:!1,multiSelect:!1,isRequired:!0,formEnabled:!0,filterEnabled:!0,sortEnabled:!0,status:"active",options:[{value:"backlog",label:"Backlog",color:"blue-200",icon:"Inbox",status:"active"},{value:"scoping",label:"Scoping",color:"sky-500",icon:"Search",status:"active"},{value:"ready",label:"Ready",color:"blue-500",icon:"Check",status:"active"},{value:"in-flight",label:"In Flight",color:"indigo-500",icon:"Play",status:"active"},{value:"blocked",label:"Blocked",color:"amber-500",icon:"Pause",status:"active"},{value:"done",label:"Done",color:"green-500",icon:"CheckCircle",status:"active"}]},{id:"stakeholder",label:"Stakeholder",description:"Show which audience or stakeholder group is most relevant to the work.",widgetType:"select",isSystem:!1,multiSelect:!0,isRequired:!1,formEnabled:!0,filterEnabled:!0,sortEnabled:!1,status:"active",options:[{value:"internal",label:"Internal",color:"blue-500",icon:"Users",status:"active"},{value:"client",label:"Client",color:"amber-500",icon:"Briefcase",status:"active"},{value:"leadership",label:"Leadership",color:"violet-500",icon:"Flag",status:"active"},{value:"partner",label:"Partner",color:"teal-500",icon:"Globe",status:"active"}]},{id:"risk-level",label:"Risk Level",description:"A simple signal for delivery or coordination risk.",widgetType:"level",isSystem:!1,multiSelect:!1,isRequired:!1,formEnabled:!1,filterEnabled:!0,sortEnabled:!0,status:"active",options:[{value:1,label:"Low",color:"teal-500",icon:"Wind",status:"active"},{value:2,label:"Medium",color:"amber-500",icon:"Gauge",status:"active"},{value:3,label:"High",color:"red-500",icon:"TriangleAlert",status:"active"}]}]},{id:"content-production",label:"Content Production",description:"Production-oriented taxonomies for content stages, channels, and asset effort.",domainTag:"marketing",bestFor:"Marketing teams, campaigns, and multi-channel asset production.",taxonomies:[{id:"content-stage",label:"Content Stage",description:"Track where a content asset sits in the production lifecycle.",widgetType:"select",isSystem:!1,multiSelect:!1,isRequired:!0,formEnabled:!0,filterEnabled:!0,sortEnabled:!0,status:"active",options:[{value:"outline",label:"Outline",color:"blue-200",icon:"Pencil",status:"active"},{value:"draft",label:"Draft",color:"blue-500",icon:"FileText",status:"active"},{value:"review",label:"Review",color:"amber-500",icon:"Search",status:"active"},{value:"approved",label:"Approved",color:"green-500",icon:"CheckCircle",status:"active"},{value:"published",label:"Published",color:"violet-500",icon:"Rocket",status:"active"}]},{id:"distribution-channel",label:"Distribution Channel",description:"Capture where the asset will be published or promoted.",widgetType:"select",isSystem:!1,multiSelect:!0,isRequired:!1,formEnabled:!0,filterEnabled:!0,sortEnabled:!1,status:"active",options:[{value:"blog",label:"Blog",color:"blue-500",icon:"FileText",status:"active"},{value:"email",label:"Email",color:"amber-500",icon:"Mail",status:"active"},{value:"video",label:"Video",color:"violet-500",icon:"Video",status:"active"},{value:"social",label:"Social",color:"indigo-500",icon:"Flag",status:"active"},{value:"docs",label:"Docs",color:"sky-500",icon:"Book",status:"active"}]},{id:"asset-effort",label:"Asset Effort",description:"Estimate the relative production effort for a content asset.",widgetType:"level",isSystem:!1,multiSelect:!1,isRequired:!1,formEnabled:!1,filterEnabled:!0,sortEnabled:!0,status:"active",options:[{value:1,label:"Quick",color:"teal-500",icon:"Wind",status:"active"},{value:2,label:"Standard",color:"blue-500",icon:"Minus",status:"active"},{value:3,label:"Campaign",color:"orange-500",icon:"Rocket",status:"active"}]}]}];function Xi(){return Yi.map(a=>({...a,taxonomies:Ji(a.taxonomies)}))}const Zi="_libraryContainer_94zm2_1",Qi="_introCard_94zm2_7",eo="_eyebrow_94zm2_17",so="_introTitle_94zm2_28",to="_introCopy_94zm2_35",ao="_prototypeNotice_94zm2_43",no="_libraryGrid_94zm2_49",io="_packList_94zm2_56",oo="_packCard_94zm2_62",lo="_packCardInteractive_94zm2_73",ro="_packCardActive_94zm2_88",co="_packHeader_94zm2_94",po="_packHeaderText_94zm2_101",uo="_packTitleRow_94zm2_108",mo="_packTitle_94zm2_108",ho="_packBadge_94zm2_122",go="_packDescription_94zm2_137",xo="_packBestFor_94zm2_144",yo="_packCounts_94zm2_151",bo="_packTaxonomyPreview_94zm2_157",vo="_packTaxonomyChip_94zm2_163",fo="_packTaxonomyMore_94zm2_175",jo="_packCountChip_94zm2_185",ko="_packActions_94zm2_198",Co="_packActionHint_94zm2_204",No="_previewPanel_94zm2_212",To="_previewHeader_94zm2_224",wo="_previewSummaryRow_94zm2_230",So="_previewTitle_94zm2_236",$o="_previewBestFor_94zm2_243",Io="_previewSubtext_94zm2_250",_o="_previewSection_94zm2_256",Lo="_previewSectionTitle_94zm2_262",Po="_previewList_94zm2_271",Ao="_previewItem_94zm2_277",Bo="_previewItemLabel_94zm2_288",Mo="_previewItemMeta_94zm2_298",Do="_customTaxonomyCard_94zm2_304",Eo="_customTaxonomyHeader_94zm2_314",Ro="_customTaxonomyDescription_94zm2_321",zo="_customTaxonomyBadges_94zm2_328",Go="_customTaxonomyBadge_94zm2_328",Oo="_applyPanel_94zm2_347",Fo="_applyTitle_94zm2_357",Ho="_applyCopy_94zm2_364",Wo="_analysisPanel_94zm2_371",Uo="_analysisCopy_94zm2_381",Ko="_analysisWarning_94zm2_388",Vo="_checkboxList_94zm2_395",qo="_checkboxLabel_94zm2_401",Jo="_prototypeResult_94zm2_409",Yo="_prototypeError_94zm2_415",r={libraryContainer:Zi,introCard:Qi,eyebrow:eo,introTitle:so,introCopy:to,prototypeNotice:ao,libraryGrid:no,packList:io,packCard:oo,packCardInteractive:lo,packCardActive:ro,packHeader:co,packHeaderText:po,packTitleRow:uo,packTitle:mo,packBadge:ho,packDescription:go,packBestFor:xo,packCounts:yo,packTaxonomyPreview:bo,packTaxonomyChip:vo,packTaxonomyMore:fo,packCountChip:jo,packActions:ko,packActionHint:Co,previewPanel:No,previewHeader:To,previewSummaryRow:wo,previewTitle:So,previewBestFor:$o,previewSubtext:Io,previewSection:_o,previewSectionTitle:Lo,previewList:Po,previewItem:Ao,previewItemLabel:Bo,previewItemMeta:Mo,customTaxonomyCard:Do,customTaxonomyHeader:Eo,customTaxonomyDescription:Ro,customTaxonomyBadges:zo,customTaxonomyBadge:Go,applyPanel:Oo,applyTitle:Fo,applyCopy:Ho,analysisPanel:Wo,analysisCopy:Uo,analysisWarning:Ko,checkboxList:Vo,checkboxLabel:qo,prototypeResult:Jo,prototypeError:Yo};function Xo(a,o="Layers"){const h=de[a||o]||de[o];return e.jsx(h,{size:15})}function ya(a){return{categories:a.categories.length>0,types:a.types.length>0,priorities:a.priorities.length>0}}function $s(a){const{title:o,items:h}=a;return e.jsxs("section",{className:r.previewSection,children:[e.jsx("h4",{className:r.previewSectionTitle,children:o}),e.jsx("div",{className:r.previewList,children:h.map(g=>e.jsxs("div",{className:r.previewItem,children:[e.jsxs("span",{className:r.previewItemLabel,children:[e.jsx("span",{style:{color:g.color?`var(--color-${g.color}, var(--text-secondary))`:"var(--text-secondary)"},children:Xo(g.icon)}),e.jsx("span",{children:g.label})]}),g.meta?e.jsx("span",{className:r.previewItemMeta,children:g.meta}):null]},g.key))})]})}function ba(a){let o=0,h=0,g=0,b=0;return a.taxonomies.forEach(N=>{N.multiSelect&&(o+=1),N.widgetType==="level"&&(h+=1),N.isRequired&&(g+=1),N.formEnabled!==!1&&(b+=1)}),{multiSelectCount:o,numericCount:h,requiredCount:g,formEnabledCount:b}}function Zo(a){const o=[];return o.push(a.widgetType==="level"?"Numeric":"Descriptive"),a.multiSelect&&o.push("Multi-select"),a.isRequired&&o.push("Required"),a.formEnabled!==!1&&o.push("Shows in forms"),a.filterEnabled&&o.push("Filterable"),a.sortEnabled&&o.push("Sortable"),o}function Qo(a){return{...a,aliases:Array.isArray(a.aliases)?[...a.aliases]:void 0,options:Array.isArray(a.options)?a.options.map(o=>({...o,aliases:Array.isArray(o.aliases)?[...o.aliases]:void 0})):[]}}function Sa(a,o){a.key!=="Enter"&&a.key!==" "||(a.preventDefault(),o())}function el(a){const{onAnalyzeSystemTaxonomyPack:o,onApplySystemTaxonomyPack:h}=a,g=l.useMemo(()=>ja(),[]),[b,N]=l.useState(g),[w,$]=l.useState(g[0]?.id||""),[A,z]=l.useState(()=>g[0]?ya(g[0]):{categories:!0,types:!0,priorities:!0}),[O,j]=l.useState(!1),[I,P]=l.useState(null),[U,B]=l.useState(!1),[x,S]=l.useState(!1),E=b.find(m=>m.id===w)||b[0]||null,C=l.useMemo(()=>!E||!o?null:o(E),[o,E]);l.useEffect(()=>{let m=!1;return B(!0),fetch("/api/taskforce/taxonomy-library").then(async _=>{if(!_.ok)return null;const n=await _.json().catch(()=>({})),d=Array.isArray(n?.packs)?n.packs:[];return!m&&d.length>0&&(N(d),$(L=>d.some(f=>f.id===L)?L:d[0].id)),null}).catch(()=>null).finally(()=>{m||B(!1)}),()=>{m=!0}},[]);const M=m=>{const _=b.find(n=>n.id===m);$(m),z(_?ya(_):{categories:!0,types:!0,priorities:!0}),j(!1),P(null)},c=m=>{z(_=>({..._,[m]:!_[m]}))},W=()=>{if(!E)return;if(Object.entries(A).filter(([,_])=>_).map(([_])=>_).length===0){P({type:"error",message:"Select at least one taxonomy section to apply."});return}if(!h){P({type:"error",message:"System taxonomy pack apply is not available in this surface yet."});return}S(!0),P(null),h({pack:E,sections:A,remapExistingValuesToDefault:O}).then(_=>{if(_?.success){P({type:"success",message:`${E.label} was applied to the selected taxonomy sections.`});return}P({type:"error",message:_?.error||"Failed to apply the selected taxonomy pack."})}).catch(_=>{P({type:"error",message:_ instanceof Error?_.message:"Failed to apply the selected taxonomy pack."})}).finally(()=>{S(!1)})};return E?e.jsxs("div",{className:r.libraryContainer,children:[e.jsxs("section",{className:r.introCard,children:[e.jsxs("span",{className:r.eyebrow,children:[e.jsx(yt,{size:14}),"System Taxonomy Library"]}),e.jsx("h3",{className:r.introTitle,children:"Browse starter packs before you replace anything."}),e.jsx("p",{className:r.introCopy,children:"Library packs give you coordinated categories, task types, and priority scales. Apply replaces only the sections you choose."}),U?e.jsx("p",{className:r.prototypeNotice,children:"Loading available packs…"}):null]}),e.jsxs("div",{className:r.libraryGrid,children:[e.jsx("div",{className:r.packList,children:b.map(m=>{const _=m.id===w;return e.jsxs("article",{className:`${r.packCard} ${r.packCardInteractive} ${_?r.packCardActive:""}`,role:"button",tabIndex:0,"aria-pressed":_,onClick:()=>M(m.id),onKeyDown:n=>Sa(n,()=>M(m.id)),children:[e.jsx("div",{className:r.packHeader,children:e.jsxs("div",{className:r.packHeaderText,children:[e.jsx("div",{className:r.packTitleRow,children:e.jsx("h4",{className:r.packTitle,children:m.label})}),e.jsx("p",{className:r.packDescription,children:m.description})]})}),e.jsxs("div",{className:r.packCounts,children:[e.jsxs("span",{className:r.packCountChip,children:[e.jsx(Ta,{size:13}),m.categories.length," categories"]}),e.jsxs("span",{className:r.packCountChip,children:[e.jsx(jn,{size:13}),m.types.length," types"]}),e.jsxs("span",{className:r.packCountChip,children:[e.jsx(ae,{size:13}),m.priorities.length," priority levels"]})]}),e.jsx("div",{className:r.packActions,children:e.jsx("button",{type:"button",className:s.submitBtn,onClick:()=>M(m.id),children:"Apply"})})]},m.id)})}),e.jsxs("aside",{className:r.previewPanel,children:[e.jsxs("div",{className:r.previewHeader,children:[e.jsx("h3",{className:r.previewTitle,children:E.label}),e.jsx("p",{className:r.previewSubtext,children:"Read-only preview. Applying this pack will replace only the sections you choose."})]}),e.jsx($s,{title:"Categories",items:E.categories.map(m=>({key:m.value,label:m.label,icon:m.icon,color:m.color}))}),e.jsx($s,{title:"Task Types",items:E.types.map(m=>({key:m.value,label:m.label,icon:m.icon,color:m.color,meta:m.status==="retired"?"Retired":void 0}))}),e.jsx($s,{title:"Priority Levels",items:E.priorities.map(m=>({key:String(m.value),label:m.label,icon:m.icon,color:m.color,meta:`Level ${m.value}`}))}),e.jsxs("section",{className:r.applyPanel,children:[e.jsx("h4",{className:r.applyTitle,children:"Apply Selected Sections"}),e.jsx("p",{className:r.applyCopy,children:"Applying this pack will replace the selected taxonomy sections in this workspace."}),C?e.jsxs("div",{className:r.analysisPanel,children:[C.unmatchedCategoryValues.length>0?e.jsxs("p",{className:r.analysisCopy,children:[C.unmatchedCategoryValues.length," category value",C.unmatchedCategoryValues.length===1?"":"s"," will be preserved as legacy unless you remap to default."]}):null,C.unmatchedTypeValues.length>0?e.jsxs("p",{className:r.analysisCopy,children:[C.unmatchedTypeValues.length," type value",C.unmatchedTypeValues.length===1?"":"s"," will be preserved as legacy unless you remap to default."]}):null,C.incompatiblePriorityValues.length>0?e.jsxs("p",{className:r.analysisWarning,children:["Existing tasks use priority level",C.incompatiblePriorityValues.length===1?"":"s"," ",C.incompatiblePriorityValues.join(", "),". Priority replacement will be blocked unless you remap unmatched existing values to default."]}):null,C.unmatchedCategoryValues.length===0&&C.unmatchedTypeValues.length===0&&C.incompatiblePriorityValues.length===0?e.jsx("p",{className:r.analysisCopy,children:"This pack lines up with the current workspace values for the selected taxonomy sections."}):null]}):null,e.jsxs("div",{className:r.checkboxList,children:[e.jsxs("label",{className:r.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:A.categories,onChange:()=>c("categories")}),e.jsx("span",{children:"Categories"})]}),e.jsxs("label",{className:r.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:A.types,onChange:()=>c("types")}),e.jsx("span",{children:"Types"})]}),e.jsxs("label",{className:r.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:A.priorities,onChange:()=>c("priorities")}),e.jsx("span",{children:"Priorities"})]})]}),e.jsxs("label",{className:r.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:O,onChange:()=>j(m=>!m)}),e.jsx("span",{children:"Remap unmatched existing values to default"})]}),e.jsx("p",{className:r.applyCopy,children:"Leave this off to preserve unmatched category and type values as legacy entries. Priority replacement will be blocked if existing tasks use values outside the selected pack."}),e.jsx("div",{className:r.packActions,children:e.jsx("button",{type:"button",className:s.submitBtn,onClick:W,disabled:x,children:x?"Applying…":"Apply Pack"})}),I?e.jsx("p",{className:`${r.prototypeResult} ${I.type==="error"?r.prototypeError:""}`,children:I.message}):null]})]})]})]}):e.jsx("div",{className:s.emptyState,children:e.jsx("p",{className:"tf-empty-copy",children:"No system taxonomy library packs are available."})})}function sl(a){const{taxonomies:o=[],onUpdateCustomTaxonomies:h}=a,g=l.useMemo(()=>Xi(),[]),[b,N]=l.useState(g),[w,$]=l.useState(g[0]?.id||""),[A,z]=l.useState(!1),[O,j]=l.useState(null),[I,P]=l.useState(g[0]?.taxonomies.map(n=>n.id)||[]),[U,B]=l.useState(null),x=b.find(n=>n.id===w)||b[0]||null,S=x?ba(x):null,E=l.useMemo(()=>x?x.taxonomies.filter(n=>I.includes(n.id)):[],[x,I]),C=l.useMemo(()=>new Set(I),[I]),M=l.useMemo(()=>{const n=new Set(o.map(d=>d.id));return E.map(d=>d.id).filter(d=>n.has(d))},[E,o]),c=l.useMemo(()=>{if(!x)return[];const n=new Set(o.map(d=>d.id));return x.taxonomies.filter(d=>C.has(d.id)&&!n.has(d.id))},[x,C,o]);if(l.useEffect(()=>{let n=!1;return z(!0),j(null),fetch("/api/taskforce/custom-taxonomy-library").then(async d=>{if(!d.ok)throw new Error(`Failed to load custom taxonomy packs (${d.status})`);const L=await d.json().catch(()=>({})),f=Array.isArray(L?.packs)?L.packs:[];!n&&f.length>0&&(N(f),$(G=>f.some(u=>u.id===G)?G:f[0].id))}).catch(d=>{n||j(d instanceof Error?d.message:"Failed to load custom taxonomy packs.")}).finally(()=>{n||z(!1)}),()=>{n=!0}},[]),l.useEffect(()=>{P(x?.taxonomies.map(n=>n.id)||[]),B(null)},[w,x]),!x)return e.jsx("div",{className:s.emptyState,children:e.jsx("p",{className:"tf-empty-copy",children:"No custom taxonomy library packs are available."})});const W=n=>{P(d=>d.includes(n)?d.filter(L=>L!==n):[...d,n]),B(null)},m=()=>{P(c.map(n=>n.id)),B(null)},_=()=>{if(I.length===0){B({type:"error",message:"Select at least one taxonomy to install."});return}if(M.length>0){B({type:"error",message:`This workspace already has ${M.length} taxonomy ${M.length===1?"id":"ids"} that match your current selection. Deselect conflicting taxonomies before installing this pack.`});return}if(!h){B({type:"error",message:"Custom taxonomy install is not available in this surface yet."});return}h([...o,...c.map(n=>Qo(n))]),B({type:"success",message:`${c.length} custom ${c.length===1?"taxonomy was":"taxonomies were"} added to this workspace.`})};return e.jsxs("div",{className:r.libraryContainer,children:[e.jsxs("section",{className:r.introCard,children:[e.jsxs("span",{className:r.eyebrow,children:[e.jsx(ua,{size:14}),"Custom Taxonomy Library"]}),e.jsx("h3",{className:r.introTitle,children:"Browse reusable custom taxonomy packs."}),e.jsx("p",{className:r.introCopy,children:"These packs install workspace-owned custom taxonomies such as approval stages, channels, and effort bands. Review a pack, choose the taxonomies you want, and install them into this workspace."}),A?e.jsx("p",{className:r.prototypeNotice,children:"Loading available packs…"}):null,O?e.jsx("p",{className:`${r.prototypeResult} ${r.prototypeError}`,children:O}):null]}),e.jsxs("div",{className:r.libraryGrid,children:[e.jsx("div",{className:r.packList,children:b.map(n=>{const d=n.id===w,L=ba(n),f=n.taxonomies.slice(0,3).map(G=>G.label);return e.jsxs("article",{className:`${r.packCard} ${r.packCardInteractive} ${d?r.packCardActive:""}`,role:"button",tabIndex:0,"aria-pressed":d,onClick:()=>$(n.id),onKeyDown:G=>Sa(G,()=>$(n.id)),children:[e.jsx("div",{className:r.packHeader,children:e.jsxs("div",{className:r.packHeaderText,children:[e.jsxs("div",{className:r.packTitleRow,children:[e.jsx("h4",{className:r.packTitle,children:n.label}),n.domainTag?e.jsx("span",{className:r.packBadge,children:n.domainTag}):null]}),e.jsx("p",{className:r.packDescription,children:n.description}),n.bestFor?e.jsxs("p",{className:r.packBestFor,children:[e.jsx("strong",{children:"Best for:"})," ",n.bestFor]}):null]})}),e.jsxs("div",{className:r.packCounts,children:[e.jsxs("span",{className:r.packCountChip,children:[e.jsx(ua,{size:13}),n.taxonomies.length," taxonomies"]}),L.multiSelectCount>0?e.jsx("span",{className:r.packCountChip,children:"Multi-select"}):null,L.numericCount>0?e.jsx("span",{className:r.packCountChip,children:"Numeric"}):null,L.requiredCount>0?e.jsx("span",{className:r.packCountChip,children:"Required"}):null]}),e.jsxs("div",{className:r.packTaxonomyPreview,children:[f.map(G=>e.jsx("span",{className:r.packTaxonomyChip,children:G},G)),n.taxonomies.length>f.length?e.jsxs("span",{className:r.packTaxonomyMore,children:["+",n.taxonomies.length-f.length," more"]}):null]}),e.jsx("div",{className:r.packActions,children:e.jsx("span",{className:r.packActionHint,children:d?"Previewing":"Click to Preview"})})]},n.id)})}),e.jsxs("aside",{className:r.previewPanel,children:[e.jsxs("div",{className:r.previewHeader,children:[e.jsx("h3",{className:r.previewTitle,children:x.label}),x.bestFor?e.jsxs("p",{className:r.previewBestFor,children:[e.jsx("strong",{children:"Best for:"})," ",x.bestFor]}):null,e.jsx("p",{className:r.previewSubtext,children:"Review each taxonomy before installing it into this workspace. Installed taxonomies become normal workspace-owned custom taxonomies."})]}),e.jsxs("div",{className:r.previewSummaryRow,children:[e.jsxs("span",{className:r.packCountChip,children:[x.taxonomies.length," taxonomies"]}),(S?.formEnabledCount||0)>0?e.jsxs("span",{className:r.packCountChip,children:[S.formEnabledCount," show in forms"]}):null,(S?.numericCount||0)>0?e.jsxs("span",{className:r.packCountChip,children:[S.numericCount," numeric"]}):null,(S?.requiredCount||0)>0?e.jsxs("span",{className:r.packCountChip,children:[S.requiredCount," required"]}):null]}),e.jsxs("section",{className:r.applyPanel,children:[e.jsx("h4",{className:r.applyTitle,children:"Choose Taxonomies to Install"}),e.jsx("p",{className:r.applyCopy,children:"Select only the taxonomies you want to add. This first pass installs new custom taxonomies only and asks you to skip conflicts rather than replace them."}),e.jsx("div",{className:r.checkboxList,children:x.taxonomies.map(n=>e.jsxs("label",{className:r.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:I.includes(n.id),onChange:()=>W(n.id)}),e.jsxs("span",{children:[n.label,o.some(d=>d.id===n.id)?" (Already installed)":""]})]},n.id))}),e.jsxs("div",{className:r.analysisPanel,children:[e.jsxs("p",{className:r.analysisCopy,children:[I.length," ",I.length===1?"taxonomy is":"taxonomies are"," currently selected from this pack."]}),c.length>0?e.jsxs("p",{className:r.analysisCopy,children:[c.length," selected ",c.length===1?"taxonomy is":"taxonomies are"," ready to install right now."]}):e.jsx("p",{className:r.analysisCopy,children:"No selected taxonomies are currently installable."}),M.length>0?e.jsxs("p",{className:r.analysisWarning,children:[M.length," selected ",M.length===1?"taxonomy conflicts":"taxonomies conflict"," with existing workspace ids: ",M.join(", "),"."]}):null]}),e.jsxs("div",{className:r.packActions,children:[M.length>0?e.jsx("button",{type:"button",className:s.cancelBtn,onClick:m,children:"Select Installable Only"}):null,e.jsx("button",{type:"button",className:s.submitBtn,onClick:_,disabled:I.length===0||c.length===0,children:"Install Selected Taxonomies"})]}),U?e.jsx("p",{className:`${r.prototypeResult} ${U.type==="error"?r.prototypeError:""}`,children:U.message}):null]}),x.taxonomies.map(n=>e.jsxs("section",{className:r.customTaxonomyCard,children:[e.jsx("div",{className:r.customTaxonomyHeader,children:e.jsxs("div",{children:[e.jsx("h4",{className:r.previewSectionTitle,children:n.label}),n.description?e.jsx("p",{className:r.customTaxonomyDescription,children:n.description}):null]})}),M.includes(n.id)?e.jsx("p",{className:r.analysisWarning,children:"Conflicts with an existing taxonomy id in this workspace."}):null,e.jsx("div",{className:r.customTaxonomyBadges,children:Zo(n).map(d=>e.jsx("span",{className:r.customTaxonomyBadge,children:d},d))}),e.jsx($s,{title:n.widgetType==="level"?"Levels":"Options",items:n.options.map(d=>({key:`${n.id}:${d.value}`,label:d.label,icon:d.icon,color:d.color,meta:n.widgetType==="level"?`Level ${d.value}`:String(d.value)}))})]},n.id))]})]})]})}function va(a){const{mode:o="system",taxonomies:h,onUpdateCustomTaxonomies:g,onAnalyzeSystemTaxonomyPack:b,onApplySystemTaxonomyPack:N}=a;return o==="custom"?e.jsx(sl,{taxonomies:h,onUpdateCustomTaxonomies:g}):e.jsx(el,{onAnalyzeSystemTaxonomyPack:b,onApplySystemTaxonomyPack:N})}function tl(a){const{taxonomies:o,onUpdateTaxonomies:h,taxonomyDisplayLabels:g,onUpdateTaxonomyDisplayLabels:b,categories:N,pathValidation:w,onUpdateCategory:$,onRemoveCategory:A,onSaveCategory:z,onAddPath:O,onRemovePath:j,onUpdateCategoryIcon:I,onUpdateCategoryColor:P,onBrowseFolders:U,types:B,onSaveType:x,onRemoveType:S,onUpdateType:E,priorities:C,onUpdatePriorities:M,onAnalyzeSystemTaxonomyPack:c,onApplySystemTaxonomyPack:W,manualComplexityEnabled:m,onManualComplexityEnabledChange:_,initialTab:n}=a,[d,L]=l.useState(n||""),[f,G]=l.useState(n?"detail":"list"),[u,F]=l.useState(!1),[K,ee]=l.useState(""),Je=l.useMemo(()=>ja().length,[]),ns=l.useMemo(()=>Hi({categories:N,types:B,priorities:C,taxonomies:o,manualComplexityEnabled:m,displayLabels:g}),[N,m,C,o,g,B]),As=()=>{if(!K.trim())return;const v=K.toLowerCase().trim().replace(/\s+/g,"-");if(o.some(Z=>Z.id===v)){alert("A taxonomy with this ID already exists");return}const Y={id:v,label:K.trim(),options:[],widgetType:"select",isSystem:!1,multiSelect:!1,formEnabled:!1,filterEnabled:!0,sortEnabled:!1};h([...o,Y]),ee(""),F(!1),L(v),G("detail")},Bs=v=>{h(o.map(Y=>Y.id===v.id?v:Y))},Ms=v=>{const Y=o.map(Z=>Z.id===v?{...Z,status:"retired"}:Z);h(Y),G("list")},Ds=v=>{const Y=o.map(Z=>Z.id===v?{...Z,status:"active"}:Z);h(Y)},Le=v=>{L(v),G("detail")},is=(v,Y)=>{const Z=o.findIndex(zs=>zs.id===v);if(Z<0)return;const Ye=Z+Y;if(Ye<0||Ye>=o.length)return;const Xe=[...o],[Rs]=Xe.splice(Z,1);Xe.splice(Ye,0,Rs),h(Xe)},os=ns.find(v=>v.id===d),ls=os?.taxonomy,Es=ns.filter(v=>v.kind!=="custom"),we=ns.filter(v=>v.kind==="custom");return f==="list"?e.jsxs("div",{className:y.taxonomyDrillDown,children:[e.jsxs("div",{className:y.drillDownList,children:[e.jsx("section",{className:y.librarySection,children:e.jsxs("button",{className:y.libraryLauncher,onClick:()=>Le("library"),children:[e.jsxs("div",{className:y.libraryLauncherInfo,children:[e.jsx("span",{className:y.libraryLauncherIcon,children:e.jsx(yt,{size:18})}),e.jsxs("div",{className:y.libraryLauncherText,children:[e.jsx("span",{className:y.libraryLauncherLabel,children:"System Taxonomy Library"}),e.jsx("span",{className:y.libraryLauncherSubtext,children:"Browse curated packs for categories, task types, and priority scales."})]})]}),e.jsxs("span",{className:y.libraryLauncherMeta,children:[Je," curated packs",e.jsx(Te,{size:16,className:y.chevron})]})]})}),e.jsxs("div",{className:y.drillDownSection,children:[e.jsx("h4",{className:y.drillDownSectionTitle,children:"System Taxonomies"}),Es.map(v=>e.jsxs("button",{className:`${y.drillDownItem} ${v.id==="complexities"&&!m?y.drillDownItemDimmed:""}`,onClick:()=>Le(v.id),children:[e.jsxs("div",{className:y.drillDownItemInfo,children:[e.jsx(kn,{size:16,className:y.systemIcon}),e.jsxs("div",{className:y.drillDownItemText,children:[e.jsx("span",{className:y.drillDownItemLabel,children:v.label}),e.jsx("span",{className:y.drillDownItemSubtext,children:v.summary})]})]}),e.jsx(Te,{size:16,className:y.chevron})]},v.id))]}),e.jsxs("div",{className:y.drillDownSection,children:[e.jsxs("div",{className:y.drillDownSectionHeader,children:[e.jsx("h4",{className:y.drillDownSectionTitle,children:"Custom Taxonomies"}),e.jsxs("button",{className:R.addTaxonomyBtnSmall,onClick:()=>F(!0),title:"Add Custom Taxonomy",children:[e.jsx(as,{size:14})," New"]})]}),e.jsxs("button",{className:y.drillDownItem,onClick:()=>Le("custom-library"),children:[e.jsxs("div",{className:y.drillDownItemInfo,children:[e.jsx(yt,{size:16,className:y.systemIcon}),e.jsxs("div",{className:y.drillDownItemText,children:[e.jsx("span",{className:y.drillDownItemLabel,children:"Custom Taxonomy Library"}),e.jsx("span",{className:y.drillDownItemSubtext,children:"Reusable templates for future custom taxonomy packs"})]})]}),e.jsx(Te,{size:16,className:y.chevron})]}),we.length===0?e.jsx("div",{className:s.emptyState,children:e.jsx("p",{className:"tf-empty-copy",children:"No custom taxonomies yet."})}):we.map(v=>e.jsxs("div",{className:`${y.drillDownItem} ${v.taxonomy?.status==="retired"?y.drillDownItemDimmed:""}`,children:[e.jsxs("button",{className:y.drillDownItemAction,onClick:()=>Le(v.id),children:[e.jsxs("div",{className:y.drillDownItemInfo,children:[e.jsx(Cn,{size:16}),e.jsxs("div",{className:y.drillDownItemText,children:[e.jsx("span",{className:y.drillDownItemLabel,children:v.taxonomy?.status==="retired"?`${v.label} (Retired)`:v.label}),e.jsx("span",{className:y.drillDownItemSubtext,children:v.summary})]})]}),e.jsx(Te,{size:16,className:y.chevron})]}),e.jsxs("div",{className:y.orderButtons,children:[e.jsx("button",{type:"button",className:s.browseBtn,title:"Move taxonomy up",onClick:Y=>{Y.stopPropagation(),is(v.id,-1)},disabled:we[0]?.id===v.id,children:e.jsx(ka,{size:16})}),e.jsx("button",{type:"button",className:s.browseBtn,title:"Move taxonomy down",onClick:Y=>{Y.stopPropagation(),is(v.id,1)},disabled:we[we.length-1]?.id===v.id,children:e.jsx(Ca,{size:16})})]})]},v.id))]})]}),u&&e.jsx("div",{className:y.createOverlay,children:e.jsxs("div",{className:y.createDialog,children:[e.jsx("h3",{className:y.createDialogTitle,children:"New Taxonomy"}),e.jsxs("div",{className:y.inputGroup,children:[e.jsx("label",{className:s.label,children:"Name"}),e.jsx("input",{className:s.input,placeholder:"e.g. Sprint, Phase",value:K,onChange:v=>ee(v.target.value),autoFocus:!0})]}),e.jsxs("div",{className:y.dialogActions,children:[e.jsx("button",{className:`${s.submitBtn} ${y.createSubmit}`,onClick:As,disabled:!K.trim(),children:"Create"}),e.jsx("button",{className:`${s.cancelBtn} ${y.createCancel}`,onClick:()=>{F(!1),ee("")},children:"Cancel"})]})]})})]}):e.jsxs("div",{className:y.taxonomyDetailView,children:[e.jsx("div",{className:y.detailHeader,children:e.jsxs("div",{className:y.taxonomyBreadcrumbs,children:[e.jsxs("button",{className:y.breadcrumbPrev,onClick:()=>G("list"),title:"Back to All Taxonomies",children:[e.jsx(Nn,{size:16,className:y.breadcrumbIcon}),"Taxonomies"]}),e.jsx(Te,{size:14,className:y.breadcrumbDivider}),e.jsx("h3",{className:y.breadcrumbActive,children:d==="library"?"System Taxonomy Library":d==="custom-library"?"Custom Taxonomy Library":os?.label||"Taxonomy"})]})}),e.jsx("div",{className:y.detailContent,children:d==="library"?e.jsx(va,{mode:"system",onAnalyzeSystemTaxonomyPack:c,onApplySystemTaxonomyPack:W}):d==="custom-library"?e.jsx(va,{mode:"custom",taxonomies:o,onUpdateCustomTaxonomies:h}):d==="categories"?e.jsx(Ui,{displayLabel:g?.category,onUpdateDisplayLabel:v=>b?.({category:v}),categories:N,pathValidation:w,onUpdateCategory:$,onRemoveCategory:A,onSaveCategory:z,onAddPath:O,onRemovePath:j,onUpdateCategoryIcon:I,onUpdateCategoryColor:P,onBrowseFolders:U}):d==="types"?e.jsx(Ki,{displayLabel:g?.type,onUpdateDisplayLabel:v=>b?.({type:v}),types:B,onSaveType:x,onRemoveType:S,onUpdateType:E}):d==="complexities"?e.jsxs("div",{className:s.settingGroup,children:[e.jsx("h4",{className:s.settingSubtitle,children:"Complexity"}),e.jsx("p",{className:s.settingsHint,children:"Complexity is estimated by AI and system logic by default."}),e.jsx("p",{className:s.settingsHint,children:"Enable this to let users set complexity manually and show the Complexity field in Add/Edit Task. When disabled, the Complexity field is hidden from the task form."}),e.jsxs("label",{className:s.archiveToggle,children:[e.jsx("input",{type:"checkbox",checked:m,onChange:v=>{_(v.target.checked)}}),e.jsx("span",{children:"Manual Complexity"})]})]}):ls?e.jsx(Wi,{taxonomy:ls,onUpdateTaxonomy:Bs,onRemoveTaxonomy:Ms,onRestoreTaxonomy:Ds}):d==="priorities"?e.jsx(Vi,{displayLabel:g?.priority,onUpdateDisplayLabel:v=>b?.({priority:v}),priorities:C,onUpdatePriorities:M}):e.jsxs("div",{className:s.emptyState,children:[e.jsx("p",{className:"tf-empty-copy",children:"Taxonomy not found."}),e.jsx("button",{className:s.submitBtn,onClick:()=>G("list"),children:"Return to List"})]})})]})}const al={sun:Pn,wind:wa,moon:Ln,sparkles:bt},fa=["tasks:read","tasks:write","workspace:read"];function ml(a){const{settingsModel:o,onSectionChange:h,renderMode:g="full"}=a,b=g==="mcp-only",{currentTheme:N,globalTheme:w,themeUseGlobalDefault:$,keyShortcut:A,jsonBackupEnabled:z,globalJsonBackupEnabled:O,globalWeekStartsOn:j,locale:I="en-US",supportedLocales:P=["en-US","es-419","pt-BR"],jsonBackupUseGlobalDefault:U,manualComplexityEnabled:B,checklistDropdownEnabled:x=!0,showTaskCardStatusLabel:S=!0,exportWorkflowsPath:E,exportingResource:C,exportResult:M,initialSection:c,onThemeChange:W,onSaveTheme:m,onSaveGlobalTheme:_,onResetProjectToGlobal:n,onKeyShortcutChange:d,onJsonBackupEnabledChange:L,onSaveGlobalJsonBackupEnabled:f,onSaveGlobalWeekStartsOn:G,onSaveLocale:u,onManualComplexityEnabledChange:F,onChecklistDropdownEnabledChange:K,onShowTaskCardStatusLabelChange:ee,onSaveSettings:Je,onExportWorkflowsPathChange:ns,onShowFolderBrowserChange:As,onBrowserTargetChange:Bs,onFetchFolders:Ms,categories:Ds,pathValidation:Le,taxonomyDisplayLabels:is,onUpdateCategory:os,onRemoveCategory:ls,onSaveCategory:Es,onAddPath:we,onRemovePath:v,onUpdateCategoryIcon:Y,onUpdateCategoryColor:Z,types:Ye,onSaveType:Xe,onRemoveType:Rs,onUpdateType:zs,taxonomies:$a,onUpdateTaxonomies:Ia,priorities:_a,onUpdatePriorities:La,onAnalyzeSystemTaxonomyPack:Pa,onApplySystemTaxonomyPack:Aa,onUpdateTaxonomyDisplayLabels:Ba,projectRoot:Se,projectName:Pe,mcpHostRoot:rs,serverHostRoot:cs,mcpScriptPath:pe,tenantId:jt,workspaceId:le,runtimeMode:Ae="local",cloudAuthBaseUrl:Gs="",cloudMcpBaseUrl:Os="",fetchCloudAuthApi:Be,workspaceSwitchingEnabled:Ma=!1,currentWorkspaceRole:Da="member",currentWorkspaceName:Me="",onDeleteWorkspace:Fs,onMcpHostRootChange:Ea,onOpenCloudAuth:Hs,isAuthenticated:kt=!1,exportEnvironment:Ct,setupState:se=null,buildInfo:nl=null,onExportEnvironmentChange:Ra,onSaveSetupMode:il,onSaveWorkspaceProfile:Ws,availableWorkflows:De=[],onExportWorkflows:za,initiativeTemplates:Ee=[],onRefreshInitiativeTemplates:Us,onCreateInitiativeFromTemplate:Ks,onRefreshWorkflows:Ga}=o,Nt=Ae!=="cloud",[Ze,ds]=l.useState([]);l.useEffect(()=>{De.length>0&&Ze.length===0&&ds(De)},[De]);const Oa=t=>{ds(i=>i.includes(t)?i.filter(p=>p!==t):[...i,t])},Fa=()=>ds(De),Ha=()=>ds([]),[Re,V]=l.useState(null),[ps,Wa]=l.useState(()=>se?.mode==="operations"?"operations":"core"),[Tt,wt]=l.useState(()=>String(se?.workspace?.name||"").trim()),[St,$t]=l.useState(()=>String(se?.workspace?.description||"")),[Qe,It]=l.useState(""),[Vs,Ua]=l.useState(""),[_t,Lt]=l.useState(!1),[D,ne]=l.useState(()=>b?"mcp":"general"),[qs,es]=l.useState(!0),[ue,us]=l.useState(()=>"project"),[Js,Pt]=l.useState([]),[Ys,At]=l.useState(!1),[ke,Xs]=l.useState(null),[ms,hs]=l.useState(null),gs=Ke.useCallback(async()=>{if(le){At(!0);try{const t=typeof window<"u"?new URL(`/api/taskforce/workspace/assignee-options?workspaceId=${encodeURIComponent(le)}`,window.location.origin).toString():`/api/taskforce/workspace/assignee-options?workspaceId=${encodeURIComponent(le)}`,i=await fetch(t,{credentials:"include"});if(!i.ok)return;const p=await i.json().catch(()=>({})),T=Array.isArray(p?.assignees)?p.assignees.filter(k=>k.kind==="agent").map(k=>({id:String(k.value||""),name:String(k.label||""),username:String(k.username||k.value||""),icon:String(k.icon||"Bot"),color:String(k.color||"#6B7280"),kind:"agent",description:typeof k.description=="string"?k.description:null,role:typeof k.role=="string"?k.role:null,provider:typeof k.provider=="string"?k.provider:null,model:typeof k.model=="string"?k.model:null,surfaceType:typeof k.surfaceType=="string"?k.surfaceType:null})):[];Pt(T)}catch{Pt([])}finally{At(!1)}}},[le]),Ka=Ke.useCallback(async(t,i)=>{if(le){hs(null);try{const p=await fetch("/api/taskforce/workspace/ai-profiles/merge",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceId:le,keepId:t,mergeId:i})}),T=await p.json().catch(()=>({}));p.ok?(hs({type:"success",message:"Profiles merged successfully."}),Xs(null),await gs()):hs({type:"error",message:T?.error||"Merge failed."})}catch{hs({type:"error",message:"Network error during merge."})}}},[le,gs]);l.useEffect(()=>{(D==="agents"||D==="mcp")&&gs()},[D,gs]),l.useEffect(()=>{Ee.length>0&&!Qe&&It(Ee[0].id)},[Ee,Qe]),l.useEffect(()=>{if(!Re)return;const t=setTimeout(()=>V(null),2500);return()=>clearTimeout(t)},[Re]),l.useEffect(()=>{Wa(se?.mode==="operations"?"operations":"core")},[se?.mode]),l.useEffect(()=>{wt(String(se?.workspace?.name||"").trim()),$t(String(se?.workspace?.description||""))},[se?.workspace?.name,se?.workspace?.description]);const Va=async t=>{W(t);const i=await m(t);V({type:i?"success":"error",message:i?"Project theme saved.":"Failed to save project theme."})},Bt=(t,i,p)=>{const T=al[t.icon];return e.jsxs("button",{className:`${s.themeBtn} tf-button-tile ${i===t.id?s.activeTheme:""}`,onClick:()=>{p(t.id)},children:[e.jsx(T,{size:20})," ",t.label]},t.id)},Zs=Ae==="cloud"?"cloud":"local",[xs,Qs]=l.useState(Zs),[be,Mt]=l.useState(!1),[ze,Dt]=l.useState(!0),[Et,Rt]=l.useState(!1),[et,zt]=l.useState(!0),[st,ys]=l.useState([]),[qa,Gt]=l.useState(!1),[Ot,tt]=l.useState(null),[ss,bs]=l.useState(null),vs=l.useMemo(()=>`${String(Me||se?.workspace?.name||Pe||le||"Taskforce Workspace").trim()} MCP`,[Me,se?.workspace?.name,Pe,le]),[Ft,at]=l.useState(vs),[nt,Ht]=l.useState(""),[Ge,ts]=l.useState(null),[me,it]=l.useState(null),[Oe,$e]=l.useState(null),[Wt,ot]=l.useState(null),[te,lt]=l.useState("general"),[Ut,Kt]=l.useState(!1),[H,ve]=l.useState(null),[fs,Vt]=l.useState([]),[Ja,qt]=l.useState(!1),[Jt,Fe]=l.useState(null),[Yt,Xt]=l.useState(null);l.useEffect(()=>{Qs(Zs)},[Zs]),l.useEffect(()=>{at(t=>t.trim().length>0?t:vs)},[vs]),l.useEffect(()=>{if(!Ge)return;const t=setTimeout(()=>ts(null),3500);return()=>clearTimeout(t)},[Ge]),l.useEffect(()=>{if(!me)return;const t=setTimeout(()=>it(null),3500);return()=>clearTimeout(t)},[me]),l.useEffect(()=>{if(!Oe)return;const t=setTimeout(()=>$e(null),3500);return()=>clearTimeout(t)},[Oe]);const He=l.useMemo(()=>{const t=bn(Os||Gs||""),i=String(t||Os||Gs||"").trim().replace(/\/+$/,"");return i?`${i}/mcp`:typeof window>"u"?"/mcp":`${window.location.origin.replace(/\/+$/,"")}/mcp`},[Os,Gs]),Ya=Ae!=="cloud",js=Ae==="cloud"||xs==="cloud",Xa=Ae!=="cloud"&&xs==="local",We=kt,Za=l.useMemo(()=>{const t={active:0,expired:1,revoked:2};return[...st].sort((i,p)=>{const T=(t[i.status]??99)-(t[p.status]??99);return T!==0?T:String(p.createdAt||"").localeCompare(String(i.createdAt||""))})},[st]),Ue=l.useMemo(()=>Rn(Me||null,Pe||null),[Me,Pe]),Ie=Wt?.trim()||"",ks=Ie||"<<GENERATE_TOKEN>>",q=l.useMemo(()=>Wn({clientId:te,endpoint:He,tokenValue:ks,serverId:Ue}),[He,Ue,ks,te]),Cs=q.kind==="json"?q.serverConfig??null:null,Zt=te==="chatgpt-desktop"||te==="claude-desktop",Qt="Resolve your profile with Taskforce.",ea=l.useMemo(()=>fs.find(t=>t.provider==="chatgpt"&&t.status==="active")||null,[fs]),sa=l.useMemo(()=>fs.find(t=>t.provider==="claude"&&t.status==="active")||null,[fs]),Ns=te==="chatgpt-desktop"?ea:te==="claude-desktop"?sa:null,Qa=l.useMemo(()=>{if(q.kind==="text")return q.renderedText||"";let t={[q.rootKey||"mcpServers"]:{[Ue]:q.serverConfig}};for(const i of[...q.wrapperKeys||[]].reverse())t={[i]:t};return JSON.stringify(t,null,2)},[q,Ue]),rt=(t,i,p="mcpServers",T=[])=>{const k={color:"var(--text-helper)"},J={color:"var(--brand-primary-strong)",fontWeight:"bold"},Q={color:"var(--text-secondary)"},re={color:"var(--text-primary, #fff)"},fe=ks,oe=[...T,p],he=" ".repeat(oe.length+1),la=JSON.stringify(i,null,2).split(`
|
|
4
|
-
`).map((je,ge)=>ge===0?je:`${he}${je}`).join(`
|
|
5
|
-
`).split(fe);return e.jsxs(e.Fragment,{children:[e.jsx("span",{style:Q,children:"{"}),`
|
|
6
|
-
`,oe.map((je,ge)=>e.jsxs(Ke.Fragment,{children:[`${" ".repeat(ge+1)}`,e.jsx("span",{style:k,children:`"${je}"`}),e.jsx("span",{style:k,children:":"})," ",e.jsx("span",{style:Q,children:"{"}),`
|
|
7
|
-
`]},`mcp-container-open-${je}-${ge}`)),he,e.jsxs("span",{style:re,children:[`"${t}"`,": ",la.map((je,ge)=>e.jsxs(Ke.Fragment,{children:[je,ge<la.length-1&&e.jsx("span",{style:J,children:fe})]},`config-segment-${ge}`))]}),`
|
|
8
|
-
`,[...oe].reverse().map((je,ge)=>e.jsxs(Ke.Fragment,{children:[`${" ".repeat(oe.length-ge)}`,e.jsx("span",{style:Q,children:"}"}),`
|
|
9
|
-
`]},`mcp-container-close-${je}-${ge}`)),e.jsx("span",{style:Q,children:"}"})]})},ct=t=>{const i={color:"var(--text-primary, #fff)"},p={color:"var(--brand-primary-strong)",fontWeight:"bold"},T=ks,k=String(t||"").split(T);return k.map((J,Q)=>e.jsxs(Ke.Fragment,{children:[e.jsx("span",{style:i,children:J}),Q<k.length-1&&e.jsx("span",{style:p,children:T})]},`text-config-${Q}`))},Ts=(t,i)=>{navigator.clipboard.writeText(t),Mt(i),setTimeout(()=>Mt(!1),2e3)},dt=()=>e.jsxs("div",{className:s.mcpRegistrationHint,children:[e.jsx("span",{children:"Once the MCP is configured, prompt your agent:"}),e.jsx("button",{type:"button",className:s.mcpRegistrationPrompt,onClick:()=>Ts(Qt,"registration"),title:be==="registration"?"Copied":"Copy prompt",children:Qt})]}),en=()=>e.jsxs("div",{className:`${s.mcpAuthRequiredCard} ${s.marginTop16}`,children:[e.jsx("div",{className:s.mcpAuthRequiredIcon,children:e.jsx(ha,{size:20})}),e.jsxs("div",{className:s.mcpAuthRequiredBody,children:[e.jsx("h3",{className:s.settingTitle,children:"Sign in to use Cloud MCP"}),e.jsx("p",{className:s.settingDescription,children:"Cloud MCP connects remote agents through your Taskforce cloud account. Register or sign in to generate cloud MCP tokens, copy client configuration, and connect hosted MCP agents to this workspace."}),Hs&&e.jsxs("div",{className:s.mcpAuthRequiredActions,children:[e.jsx("button",{type:"button",className:s.copyBtn,onClick:()=>Hs("login"),children:"Sign In"}),e.jsx("button",{type:"button",className:s.copyBtn,onClick:()=>Hs("register"),children:"Register"})]})]})]}),ta=()=>{if(!Zt&&!Ie){it({type:"error",message:"Generate a token before copying the Cloud MCP configuration."});return}it(null),Ts(Qa,"full")},sn=()=>{let t=pe||"",i=Se||"";const p=rs||cs;if(p&&Se){if(pe&&pe.startsWith(Se))t=pe.replace(Se,p);else if(pe&&pe.includes("/node_modules/")){const oa=pe.indexOf("/node_modules/");t=p+pe.substring(oa)}i=p}const T=(pe||"").endsWith(".ts"),k=Pe||(Se?Se.split(/[/\\]/).pop():"project"),J=vt(`taskforce-${k}`,"taskforce-project"),Q=(jt||"").trim()||"your-tenant-id",re=(le||se?.workspaceId||"").trim(),oe={TASKFORCE_TENANT_ID:Q,TASKFORCE_WORKSPACE_ID:re&&re!=="default"?re:"your-workspace-id",...En(te)},he=ze?{command:"taskforce",args:["mcp",i||"."],env:oe}:{command:T?"npx":"node",args:T?["-y","tsx",t,i]:[t,i],env:oe};return!ze&&!he.args[he.args.length-1]&&(he.args[he.args.length-1]=".../path/to/project/root"),{serverId:J,serverConfig:he}},Ce=l.useMemo(()=>sn(),[pe,Se,rs,cs,Pe,jt,le,se?.workspaceId,te,ze]),ie=l.useMemo(()=>Un({clientId:te,serverId:Ce.serverId,serverConfig:Ce.serverConfig}),[Ce,te]),aa=ie.kind==="json"?ie.serverConfig??null:null,tn=l.useMemo(()=>{if(ie.kind==="text")return ie.renderedText||"";let t={[ie.rootKey||"mcpServers"]:{[Ce.serverId]:ie.serverConfig}};for(const i of[...ie.wrapperKeys||[]].reverse())t={[i]:t};return JSON.stringify(t,null,2)},[ie,Ce.serverId]),an=(t="full")=>{if(!pe&&!ze)return;const i=t==="full"?tn:`"${Ce.serverId}": ${JSON.stringify(Ce.serverConfig,null,2)}`;Ts(i,t)},na=async()=>{if(We){Gt(!0),tt(null);try{const t=await Be("/api/taskforce/settings/mcp/tokens",{method:"GET",credentials:"include"}),i=await t.json().catch(()=>({}));if(!t.ok){tt(String(i?.error||"Failed to load MCP tokens."));return}ys(Array.isArray(i?.items)?i.items:[])}catch{tt("Failed to load MCP tokens.")}finally{Gt(!1)}}},pt=async()=>{if(We){qt(!0),Fe(null);try{const t=await Be("/api/taskforce/settings/mcp/connectors",{method:"GET",credentials:"include"}),i=await t.json().catch(()=>({}));if(!t.ok){Fe(String(i?.error||"Failed to load MCP connectors."));return}Vt(Array.isArray(i?.items)?i.items:[])}catch{Fe("Failed to load MCP connectors.")}finally{qt(!1)}}},nn=async()=>{const t=Ft.trim();if(!t){ts({type:"error",message:"Token name is required."});return}bs("create"),ts(null),ve(null);try{const i=await Be("/api/taskforce/settings/mcp/tokens",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,scopes:fa,expiresAt:nt?new Date(`${nt}T00:00:00`).toISOString():null})}),p=await i.json().catch(()=>({}));if(!i.ok){ts({type:"error",message:String(p?.error||"Failed to create token.")});return}ot(String(p?.token||"")),ve(null),at(vs),Ht(""),ys(T=>p?.record?[p.record,...T.filter(J=>J.id!==p.record.id)]:T)}catch{ts({type:"error",message:"Failed to create token."})}finally{bs(null)}},ut=async(t,i)=>{if(!(i==="delete"&&!window.confirm("Delete this token record? This does not affect active tokens."))){bs(`${i}:${t}`),$e(null);try{const p=i==="delete"?`/api/taskforce/settings/mcp/tokens/${encodeURIComponent(t)}`:`/api/taskforce/settings/mcp/tokens/${encodeURIComponent(t)}/${i}`,T=await Be(p,{method:i==="delete"?"DELETE":"POST",credentials:"include"}),k=await T.json().catch(()=>({}));if(!T.ok){$e({type:"error",message:String(k?.error||`Failed to ${i} token.`)});return}if(i==="regenerate"?(ot(String(k?.token||"")),ve(null),$e({type:"success",message:"Token regenerated. Copy the new value from the Full Token field."})):$e(i==="delete"?{type:"success",message:"Token deleted."}:{type:"success",message:"Token revoked."}),i==="delete"){ys(Q=>Q.filter(re=>re.id!==t));return}const J=k?.record||null;J?.id?ys(Q=>Q.map(re=>re.id===J.id?J:re)):await na()}catch{$e({type:"error",message:`Failed to ${i} token.`})}finally{bs(null)}}},on=async()=>{const t=Ie;if(!t){ve({type:"error",message:"Generate or paste a full token before testing the MCP connection."});return}Kt(!0),ve(null);try{const i=await Be("/api/taskforce/settings/mcp/test-connection",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,requiredScopes:fa})}),p=await i.json().catch(()=>({}));if(!i.ok){const k=p?.details&&typeof p.details=="object"?p.details:{},J=Array.isArray(k?.missingScopes)?k.missingScopes.map(he=>String(he)):[],Q=typeof k?.tokenWorkspaceId=="string"?String(k.tokenWorkspaceId):void 0,re=typeof k?.endpoint=="string"?String(k.endpoint):He;let fe=p?.code==="MCP_TOKEN_MISSING_SCOPES"&&J.length>0?`Token is missing required scopes: ${J.join(", ")}.`:String(p?.error||"Failed to test MCP connection."),oe;p?.code==="MCP_ENDPOINT_GATEWAY_ERROR"?(fe="The dedicated MCP host is responding with a gateway error.",oe="This usually means the cloud MCP service is degraded. Retry shortly, and if it keeps failing treat it as an environment incident rather than a bad token."):p?.code==="MCP_ENDPOINT_TIMEOUT"?(fe="The dedicated MCP host timed out during MCP initialization.",oe="This usually points to a degraded or overloaded cloud MCP service."):p?.code==="MCP_ENDPOINT_UNREACHABLE"?(fe="The dedicated MCP host could not be reached.",oe="Check the cloud MCP hostname and environment health before rotating credentials."):p?.code==="MCP_ENDPOINT_REJECTED_VALIDATED_TOKEN"&&(fe="The dedicated MCP host rejected a token that validated locally.",oe="This suggests the MCP host is stale, routed incorrectly, or out of sync with auth data."),ve({type:"error",message:fe,workspaceName:Q,endpoint:re,errorCode:typeof p?.code=="string"?String(p.code):void 0,followup:oe});return}const T=p?.result&&typeof p.result=="object"?p.result:{};ve({type:"success",message:"Connection looks good for this workspace.",scopes:Array.isArray(T?.scopes)?T.scopes.map(k=>String(k)):[],workspaceName:typeof T?.workspaceName=="string"?String(T.workspaceName):"",workspaceId:typeof T?.workspaceId=="string"?String(T.workspaceId):"",endpoint:typeof T?.endpoint=="string"?String(T.endpoint):He})}catch{ve({type:"error",message:"Failed to test MCP connection.",endpoint:He,followup:"The settings page could not complete the connection probe. Check your network connection and the selected cloud environment."})}finally{Kt(!1)}},ln=async t=>{Xt(t),Fe(null);try{const i=await Be(`/api/taskforce/settings/mcp/connectors/${encodeURIComponent(t)}/disconnect`,{method:"POST",credentials:"include"}),p=await i.json().catch(()=>({}));if(!i.ok){Fe(String(p?.error||"Failed to disconnect connector."));return}const T=p?.record||null;T?.id?Vt(k=>k.map(J=>J.id===T.id?T:J)):await pt()}catch{Fe("Failed to disconnect connector.")}finally{Xt(null)}};l.useEffect(()=>{if(We){if(D==="mcp"&&js){na(),pt();return}D==="integrations"&&pt()}},[D,js,We]),l.useEffect(()=>{D==="initiatives"&&Ee.length===0&&Us?.()},[D,Ee.length,Us]);const rn=o.availableEnvironments||[],cn=t=>{switch(t){case"Bot":return e.jsx(ma,{size:16});case"Terminal":return e.jsx(_n,{size:16});case"Sparkles":return e.jsx(bt,{size:16});case"Command":return e.jsx(In,{size:16});case"Wind":return e.jsx(wa,{size:16});case"Github":return e.jsx($n,{size:16});case"Zap":return e.jsx(ws,{size:16});case"Box":return e.jsx(_s,{size:16});default:return e.jsx(Sn,{size:16})}};l.useEffect(()=>{c&&(c==="categories"||c==="types"?ne("taxonomy"):c==="documents"?ne("general"):c==="appearance-application"?(es(!0),ne("appearanceApplication")):c==="appearance-task-cards"?(es(!0),ne("appearanceTaskCards")):c==="appearance-task-forms"?(es(!0),ne("appearanceTaskForms")):ne(c==="resources"||c==="commands"?"commands":c==="initiatives"?"initiatives":c==="agents"?"agents":c==="mcp"?b?"mcp":"general":c==="integrations"?"integrations":c))},[c,b]),l.useEffect(()=>{(D==="appearanceApplication"||D==="appearanceTaskCards"||D==="appearanceTaskForms")&&es(!0)},[D]);const dn=t=>{Bs({type:"category",value:t}),Ms(""),As(!0)},ia=[{key:"general",label:"General",icon:e.jsx(wn,{size:14}),section:"general"},{key:"taxonomy",label:"Taxonomy",icon:e.jsx(Ta,{size:14}),section:"taxonomy"},{key:"integrations",label:"Integrations",icon:e.jsx(ha,{size:14}),section:"integrations"}],pn=[{key:"appearanceApplication",label:"Application",section:"appearance-application"},{key:"appearanceTaskCards",label:"Task cards",section:"appearance-task-cards"},{key:"appearanceTaskForms",label:"Task forms",section:"appearance-task-forms"}],mt=(t,i)=>{ne(t),h?.(i)},un=()=>e.jsxs("div",{className:s.settingGroup,children:[e.jsx("h3",{className:`${s.settingTitle} tf-heading-section`,children:"Theme"}),e.jsx("div",{className:s.buttonGrid,children:ca.map(t=>Bt(t,N,Va))})]}),mn=()=>e.jsxs("div",{className:s.settingGroup,children:[e.jsx("h3",{className:`${s.settingTitle} tf-heading-section`,children:"Theme Defaults"}),e.jsx("div",{className:s.buttonGrid,children:ca.map(t=>Bt(t,w,async i=>{const p=await _(i);V({type:p?"success":"error",message:p?"Global theme saved.":"Failed to save global theme."})}))})]}),hn=()=>e.jsxs("div",{className:s.settingGroup,children:[e.jsx("h3",{className:`${s.settingTitle} tf-heading-section`,children:"Task Form"}),e.jsxs("label",{className:s.archiveToggle,children:[e.jsx("input",{type:"checkbox",checked:x,onChange:async t=>{if(!K)return;const i=await K(t.target.checked);V({type:i?"success":"error",message:i?"Checklist dropdown setting saved.":"Failed to save checklist dropdown setting."})},disabled:!K}),e.jsx("span",{children:"Enable checklist dropdown in task form"})]})]});return e.jsx("div",{className:`${s.settingsTab} ${b?s.settingsTabMcpOnly:""}`.trim(),children:e.jsxs("div",{className:`${s.settingsLayout} ${b?s.settingsLayoutMcpOnly:""}`.trim(),children:[!b&&e.jsxs("aside",{className:s.settingsSidebar,children:[e.jsx("div",{className:s.settingsSidebarHeader,children:"Sections"}),e.jsxs("div",{className:`${s.settingsSidebarNav} tf-scrollbar tf-scrollbar--track-transparent tf-scrollbar--compact`,children:[ia.filter(t=>t.key==="general").map(t=>e.jsxs("button",{className:`${s.settingsSidebarBtn} ${D===t.key?s.settingsSidebarBtnActive:""}`,onClick:()=>mt(t.key,t.section),children:[t.icon,e.jsx("span",{children:t.label})]},t.key)),e.jsxs("div",{className:s.settingsSidebarGroup,children:[e.jsxs("button",{className:`${s.settingsSidebarBtn} ${s.settingsSidebarGroupBtn} ${D==="appearanceApplication"||D==="appearanceTaskCards"||D==="appearanceTaskForms"?s.settingsSidebarBtnActive:""}`,onClick:()=>es(t=>!t),"aria-expanded":qs,"aria-controls":"settings-appearance-nav",children:[e.jsx(bt,{size:14}),e.jsx("span",{className:s.settingsSidebarGroupLabel,children:"Appearance"}),e.jsx("span",{className:s.settingsSidebarGroupChevron,children:qs?e.jsx(gt,{size:14}):e.jsx(Te,{size:14})})]}),qs&&e.jsx("div",{id:"settings-appearance-nav",className:s.settingsSidebarSubnav,children:pn.map(t=>e.jsx("button",{className:`${s.settingsSidebarSubBtn} ${D===t.key?s.settingsSidebarBtnActive:""}`,onClick:()=>mt(t.key,t.section),children:e.jsx("span",{children:t.label})},t.key))})]}),ia.filter(t=>t.key!=="general").map(t=>e.jsxs("button",{className:`${s.settingsSidebarBtn} ${D===t.key?s.settingsSidebarBtnActive:""}`,onClick:()=>mt(t.key,t.section),children:[t.icon,e.jsx("span",{children:t.label})]},t.key))]})]}),e.jsxs("div",{className:s.settingsContent,children:[Re&&e.jsxs("div",{className:`${s.settingsToast} ${Re.type==="success"?s.settingsToastSuccess:s.settingsToastError}`,children:[Re.type==="success"?e.jsx(ae,{size:14}):e.jsx(ce,{size:14}),e.jsx("span",{children:Re.message})]}),D==="general"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:s.settingGroup,children:[e.jsxs("div",{className:`${s.settingsTabs} tf-scrollbar tf-scrollbar--track-transparent tf-scrollbar--compact`,children:[e.jsx("button",{className:`${s.settingsTabBtn} ${ue==="project"?s.settingsTabBtnActive:""}`,onClick:()=>us("project"),children:"Project"}),e.jsx("button",{className:`${s.settingsTabBtn} ${ue==="global"?s.settingsTabBtnActive:""}`,onClick:()=>us("global"),children:"Global"})]}),ue==="project"&&e.jsx("div",{className:s.pathInputGroup,style:{justifyContent:"flex-end"},children:e.jsx("button",{onClick:async()=>{if(!window.confirm("Reset project Theme and Backups to global defaults?"))return;const i=await n();V({type:i?"success":"error",message:i?"Project settings reset to global.":"Failed to reset project settings."})},className:s.copyBtn,children:"Reset to Global"})})]}),ue==="project"&&e.jsxs("div",{className:s.settingGroup,children:[e.jsxs("div",{className:s.pathInputGroup,children:[e.jsxs("label",{className:s.label,style:{minWidth:"110px"},children:[ps==="operations"?"Mission":"Project"," name:"]}),e.jsx("input",{className:s.input,type:"text",value:Tt,onChange:t=>wt(t.target.value),placeholder:ps==="operations"?"Mission name":"Project name"})]}),e.jsxs("div",{className:s.pathInputGroup,children:[e.jsx("label",{className:s.label,style:{minWidth:"110px"},children:"Description:"}),e.jsx("textarea",{className:s.textarea,value:St,onChange:t=>$t(t.target.value),placeholder:ps==="operations"?"Mission description (optional)":"Project description (optional)",rows:3})]}),e.jsx("div",{className:s.pathInputGroup,style:{justifyContent:"flex-end"},children:e.jsx("button",{onClick:async()=>{if(!Ws)return;const t=await Ws({workspaceId:se?.workspaceId,name:Tt,description:St});V({type:t.success?"success":"error",message:t.success?`${ps==="operations"?"Mission":"Project"} profile saved.`:t.error||"Failed to save workspace profile."})},className:s.copyBtn,disabled:!Ws,children:"Save"})})]}),ue==="project"&&e.jsx("div",{className:s.settingGroup,children:Nt&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:s.settingTitle,children:"Backup"}),e.jsxs("label",{className:s.archiveToggle,children:[e.jsx("input",{type:"checkbox",checked:z,onChange:async t=>{const i=await L(t.target.checked);V({type:i?"success":"error",message:i?"Project backup setting saved.":"Failed to save project backup setting."})}}),e.jsx("span",{children:"Enable automatic JSON backup (`.taskforce/tasks.json`)"})]})]})}),ue==="global"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:s.settingGroup,children:Nt&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:s.settingTitle,children:"Backup"}),e.jsxs("label",{className:s.archiveToggle,children:[e.jsx("input",{type:"checkbox",checked:O,onChange:async t=>{const i=await f(t.target.checked);V({type:i?"success":"error",message:i?"Global backup default saved.":"Failed to save global backup default."})}}),e.jsx("span",{children:"Enable global JSON backup default"})]})]})}),e.jsxs("div",{className:s.settingGroup,children:[e.jsx("h3",{className:s.settingTitle,children:"Regional"}),e.jsxs("div",{className:s.pathInputGroup,children:[e.jsx("label",{className:s.label,style:{minWidth:"110px"},children:"Calendar start:"}),e.jsxs("select",{className:s.input,value:j,onChange:async t=>{const i=t.target.value,p=await G(i);V({type:p?"success":"error",message:p?`Week start saved (${i==="sunday"?"Sunday":"Monday"}).`:"Failed to save week start."})},style:{maxWidth:"220px"},children:[e.jsx("option",{value:"sunday",children:"Sunday"}),e.jsx("option",{value:"monday",children:"Monday"})]})]}),e.jsxs("div",{className:s.pathInputGroup,children:[e.jsx("label",{className:s.label,style:{minWidth:"110px"},children:"Language:"}),e.jsx("select",{className:s.input,value:I,onChange:async t=>{const i=t.target.value;if(!u)return;const p=await u(i);V({type:p?"success":"error",message:p?`Language saved (${i}).`:"Failed to save language."})},style:{maxWidth:"220px"},disabled:!u,children:P.map(t=>e.jsx("option",{value:t,children:t},t))})]})]}),e.jsxs("div",{className:s.settingGroup,children:[e.jsx("h3",{className:s.settingTitle,children:"Keyboard Shortcut"}),e.jsxs("div",{className:s.pathInputGroup,children:[e.jsxs("div",{className:s.shortcutInputWrapper,children:[e.jsx(Tn,{size:16,className:s.inputIcon}),e.jsx("input",{type:"text",value:A,onChange:t=>d(t.target.value),placeholder:"e.g. Alt+T, Ctrl+Shift+K",className:`${s.input} ${s.shortcutInput}`})]}),e.jsx("button",{onClick:async()=>{const t=await Je();V({type:t?"success":"error",message:t?"Global shortcut saved.":"Failed to save global shortcut."})},className:`${s.saveSettingsBtn} ${s.saveSettingsBtnWrapper}`,children:"Save"})]}),e.jsxs("p",{className:s.settingHelper,children:["Supported modifiers: Alt, Option, Ctrl, Shift, Meta (Cmd). Example: ",e.jsx("code",{children:"Alt+T"})," or ",e.jsx("code",{children:"Ctrl+Shift+L"}),"."]})]})]}),ue==="project"&&Ae==="cloud"&&e.jsxs("div",{className:s.settingGroup,children:[e.jsx("h3",{className:s.settingTitle,children:"Danger Zone"}),Ma?kt?Da!=="owner"?e.jsx("p",{className:s.settingHelper,children:"Only workspace owners can delete a workspace."}):e.jsx("div",{className:s.pathInputGroup,children:e.jsxs("button",{className:s.destructiveBtn,onClick:async()=>{if(!Fs)return;const t=String(le||"").trim();if(!t||t==="default"){V({type:"error",message:"A non-default workspace is required for deletion."});return}const i=String(Me||"").trim(),p=window.prompt(`Type "${i}" to permanently delete this workspace.`);if(p===null)return;if(p.trim()!==i){V({type:"error",message:"Workspace name confirmation did not match."});return}const T=await Fs(t);if(!T.success){V({type:"error",message:T.error||"Failed to delete workspace."});return}const k=Array.isArray(T.cleanupWarnings)?T.cleanupWarnings.length:0;V({type:k>0?"error":"success",message:k>0?`Workspace deleted with ${k} cleanup warning(s).`:"Workspace deleted."})},disabled:!Fs,children:[e.jsx(qe,{size:14,style:{marginRight:8}}),"Delete Workspace"]})}):e.jsx("p",{className:s.settingHelper,children:"Sign in to manage workspace deletion."}):e.jsx("p",{className:s.settingHelper,children:"Workspace deletion is available in cloud runtime only."})]})]}),D==="appearanceApplication"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:s.settingGroup,children:e.jsxs("div",{className:`${s.settingsTabs} tf-scrollbar tf-scrollbar--track-transparent tf-scrollbar--compact`,children:[e.jsx("button",{className:`${s.settingsTabBtn} ${ue==="project"?s.settingsTabBtnActive:""}`,onClick:()=>us("project"),children:"Project"}),e.jsx("button",{className:`${s.settingsTabBtn} ${ue==="global"?s.settingsTabBtnActive:""}`,onClick:()=>us("global"),children:"Global"})]})}),ue==="project"?un():mn()]}),D==="appearanceTaskCards"&&e.jsxs("div",{className:s.settingGroup,children:[e.jsx("h3",{className:`${s.settingTitle} tf-heading-section`,children:"Task Cards"}),e.jsxs("label",{className:s.archiveToggle,children:[e.jsx("input",{type:"checkbox",checked:S,onChange:async t=>{if(!ee)return;const i=await ee(t.target.checked);V({type:i?"success":"error",message:i?"Task card status label setting saved.":"Failed to save task card status label setting."})},disabled:!ee}),e.jsx("span",{children:"Show status label"})]})]}),D==="appearanceTaskForms"&&hn(),D==="commands"&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:s.settingGroup,children:[e.jsx("div",{className:s.settingTitleRow,children:e.jsx("h3",{className:s.settingTitle,children:"Command Workflows"})}),e.jsx("p",{className:`${s.settingsHint} ${s.marginBottom12}`,children:"Export standard workflows to your project to verify and commit them."}),e.jsxs("div",{className:`${s.exportRow} ${s.exportRowGrid}`,children:[e.jsxs("div",{className:s.settingGroup,children:[e.jsx("h4",{className:`${s.settingSubtitle} ${s.settingSubtitleCustom}`,children:"Target Environment"}),e.jsx("div",{className:s.buttonGrid,children:rn.map(t=>e.jsxs("button",{onClick:()=>Ra(t.id),className:`${s.themeBtn} ${Ct===t.id?s.activeTheme:""} ${s.capitalize}`,children:[cn(t.icon),t.name]},t.id))})]}),e.jsxs("div",{className:s.exportItem,children:[e.jsxs("div",{className:s.labelGroupFlex,children:[e.jsx("label",{className:s.label,children:"Workflows"}),e.jsxs("span",{className:s.settingDescription,children:["Destination: ",e.jsx("code",{className:s.code,children:E})]})]}),e.jsxs("div",{className:s.workflowList,children:[e.jsxs("div",{className:s.workflowActions,children:[e.jsx("button",{onClick:Fa,className:s.textBtn,children:"All"}),e.jsx("button",{onClick:Ha,className:s.textBtn,children:"None"})]}),e.jsx("div",{className:s.workflowGrid,children:De.length===0?e.jsxs("div",{className:s.emptyState,children:["No workflow templates found.",e.jsx("button",{onClick:()=>Ga?.(!0),className:s.secondaryBtn,style:{marginTop:"8px"},children:"Retry Fetch"})]}):De.map(t=>e.jsxs("label",{className:s.checkboxLabel,children:[e.jsx("input",{type:"checkbox",checked:Ze.includes(t),onChange:()=>Oa(t)}),t]},t))})]}),e.jsxs("button",{className:`${s.secondaryHeaderBtn} ${s.marginTop12}`,onClick:()=>za?.(Ct,Ze),disabled:C==="workflows"||Ze.length===0,children:[C==="workflows"?e.jsx(_e,{size:14,className:s.spinner}):e.jsx(Na,{size:14}),"Export Selected (",Ze.length,")"]})]})]}),M&&e.jsxs("div",{className:`${M.type==="success"?s.successMessage:s.errorMessage} ${s.marginTop12}`,children:[M.type==="success"?e.jsx(ae,{size:14}):e.jsx(ce,{size:14}),M.message]})]})}),D==="initiatives"&&e.jsxs("div",{className:s.settingGroup,children:[e.jsxs("div",{className:s.settingTitleRow,children:[e.jsx("h3",{className:s.settingTitle,children:"Initiative Templates"}),e.jsx("button",{className:s.copyBtn,onClick:()=>{Us?.()},children:"Refresh"})]}),e.jsx("p",{className:`${s.settingsHint} ${s.marginBottom12}`,children:"Create launch, migration, or incident initiatives from reusable templates."}),e.jsxs("div",{className:s.exportItem,children:[e.jsx("label",{className:s.label,children:"Template"}),e.jsx("select",{className:s.input,value:Qe,onChange:t=>{const i=t.target.value;It(i)},children:Ee.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))})]}),e.jsxs("div",{className:`${s.exportItem} ${s.marginTop12}`,children:[e.jsx("label",{className:s.label,children:"Initiative Title"}),e.jsx("input",{className:s.input,placeholder:"e.g. Taskforce Public Beta Launch",value:Vs,onChange:t=>Ua(t.target.value)})]}),e.jsxs("button",{className:`${s.secondaryHeaderBtn} ${s.marginTop12}`,disabled:_t||!Qe||!Vs.trim()||!Ks,onClick:async()=>{if(!Ks)return;Lt(!0);const t=await Ks({templateId:Qe,title:Vs.trim()});Lt(!1),V({type:t.success?"success":"error",message:t.success?"Initiative created from template.":t.error||"Failed to create initiative."})},children:[_t?e.jsx(_e,{size:14,className:s.spinner}):e.jsx(ws,{size:14}),"Create Initiative"]})]}),D==="agents"&&e.jsx("div",{className:s.settingGroup,children:e.jsxs("div",{children:[e.jsx("h4",{className:s.settingSubTitle,children:"Registered AI Profiles"}),e.jsx("p",{className:`${s.settingsHint} ${s.marginBottom12}`,children:"AI agents register profiles when connecting via MCP. Merge duplicates created when a token was lost."}),Ys&&e.jsxs("div",{className:s.settingsHint,children:[e.jsx(_e,{size:13,className:s.spinner})," Loading profiles…"]}),!Ys&&Js.length===0&&e.jsx("div",{className:s.settingsHint,children:"No AI profiles registered yet."}),!Ys&&Js.length>0&&(()=>{const t=new Map;for(const i of Js){const p=i.name.toLowerCase();t.has(p)||t.set(p,[]),t.get(p).push(i)}return e.jsx("div",{className:s.aiProfilesList,children:Array.from(t.entries()).map(([,i])=>e.jsxs("div",{className:`${s.aiProfileGroup} ${i.length>1?s.aiProfileGroupDuplicate:""}`,children:[e.jsxs("div",{className:s.aiProfileGroupHeader,children:[e.jsx(ma,{size:13,style:{color:i[0].color}}),e.jsx("span",{className:s.aiProfileName,children:i[0].name}),i.length>1&&e.jsxs("span",{className:s.aiProfileDuplicateBadge,children:[e.jsx(ce,{size:11})," ",i.length," duplicates"]})]}),e.jsxs("div",{className:s.settingsHint,style:{marginTop:6},children:["@",i[0].username,i[0].role?` · ${i[0].role}`:""]}),i[0].description&&e.jsx("div",{className:s.settingsHint,style:{marginTop:4},children:i[0].description}),(i[0].provider||i[0].model)&&e.jsx("div",{className:s.settingsHint,style:{marginTop:4},children:[i[0].provider,i[0].model].filter(Boolean).join(" · ")}),i.length>1&&e.jsxs("div",{className:s.aiProfileMergeSection,children:[i.map(p=>e.jsxs("div",{className:s.aiProfileMergeRow,children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx("span",{className:s.aiProfileIdChip,children:p.id}),e.jsxs("span",{className:s.settingsHint,children:["@",p.username]})]}),ke?.keepId!==p.id&&e.jsx("button",{className:s.secondaryHeaderBtn,title:"Keep this profile, merge others into it",onClick:()=>{const T=i.find(k=>k.id!==p.id)?.id;T&&Xs({keepId:p.id,mergeId:T})},children:"Keep this"}),ke?.keepId===p.id&&e.jsx("span",{className:s.aiProfileKeepBadge,children:"✓ keeping"})]},p.id)),ke&&i.some(p=>p.id===ke.keepId)&&e.jsxs("div",{className:s.aiProfileMergeActions,children:[e.jsxs("button",{className:s.dangerBtn,onClick:()=>Ka(ke.keepId,ke.mergeId),children:["Merge (keep ",ke.keepId.slice(-6),", delete ",ke.mergeId.slice(-6),")"]}),e.jsx("button",{className:s.secondaryHeaderBtn,onClick:()=>Xs(null),children:"Cancel"})]})]})]},i[0].id))})})(),ms&&e.jsxs("div",{className:`${ms.type==="success"?s.successMessage:s.errorMessage} ${s.marginTop12}`,children:[ms.type==="success"?e.jsx(ae,{size:14}):e.jsx(ce,{size:14}),ms.message]})]})}),D==="taxonomy"&&e.jsxs("div",{className:`${s.settingGroup} ${s.flex1} ${s.flexCol}`,children:[e.jsx("h3",{className:s.settingTitle,children:"Taxonomy & Classification"}),e.jsx("p",{className:s.settingsHint,children:"Configure categories, task types, and custom classification systems."}),e.jsx(tl,{taxonomies:$a,onUpdateTaxonomies:Ia,onApplySystemTaxonomyPack:Aa,taxonomyDisplayLabels:is,onUpdateTaxonomyDisplayLabels:Ba,categories:Ds,pathValidation:Le,onUpdateCategory:os,onRemoveCategory:ls,onSaveCategory:Es,onAddPath:we,onRemovePath:v,onUpdateCategoryIcon:Y,onUpdateCategoryColor:Z,onBrowseFolders:dn,types:Ye,onSaveType:Xe,onRemoveType:Rs,onUpdateType:zs,priorities:_a,onUpdatePriorities:La,onAnalyzeSystemTaxonomyPack:Pa,manualComplexityEnabled:B,onManualComplexityEnabledChange:async t=>{const i=await F(t);V({type:i?"success":"error",message:i?"Project complexity setting saved.":"Failed to save project complexity setting."})},initialTab:c==="categories"||c==="types"||c==="priorities"?c:void 0})]}),D==="mcp"&&e.jsxs("div",{className:s.settingsGroup,children:[Ya&&e.jsxs("div",{className:s.settingsTabs,children:[e.jsx("button",{className:`${s.settingsTabBtn} ${xs==="local"?s.settingsTabBtnActive:""}`,onClick:()=>Qs("local"),children:"Local MCP"}),e.jsx("button",{className:`${s.settingsTabBtn} ${xs==="cloud"?s.settingsTabBtnActive:""}`,onClick:()=>Qs("cloud"),children:"Cloud MCP"})]}),js&&!We&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`${s.settingGroup} ${s.marginTop16}`,children:e.jsxs("div",{className:s.settingLabelGroup,children:[e.jsx("h3",{className:s.settingTitle,children:"Cloud MCP"}),e.jsx("span",{className:s.settingDescription,children:"Cloud MCP connects agents to Taskforce through the hosted MCP endpoint. Use this for remote MCP clients or tools that cannot access your local Taskforce install."})]})}),en()]}),js&&We&&e.jsx(e.Fragment,{children:Zt?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`${s.settingGroup} ${s.marginTop16}`,children:e.jsxs("div",{className:s.settingLabelGroup,children:[e.jsx("h3",{className:s.settingTitle,children:"Cloud MCP"}),e.jsx("span",{className:s.settingDescription,children:"Cloud MCP connects agents to Taskforce through the hosted MCP endpoint. Use this for remote MCP clients or tools that cannot access your local Taskforce install."})]})}),e.jsxs("div",{className:s.settingGroup,children:[e.jsxs("div",{className:s.settingLabelGroup,children:[e.jsx("h3",{className:s.settingTitle,children:"OAuth Connector Setup"}),e.jsx("span",{className:s.settingDescription,children:te==="chatgpt-desktop"?"ChatGPT Desktop uses the Taskforce OAuth connector flow instead of a personal MCP token.":"Claude Desktop uses the Taskforce OAuth connector flow instead of a personal MCP token."})]}),e.jsx("div",{className:`${Ns?s.successMessage:s.settingHelper} ${s.marginTop12}`,children:Ns?e.jsxs(e.Fragment,{children:[e.jsx(ae,{size:14}),e.jsxs("div",{children:[e.jsx("div",{children:"Connector already authorized for this workspace."}),e.jsxs("div",{className:s.settingHelper,children:["Last used ",Ns.lastUsedAt?new Date(Ns.lastUsedAt).toLocaleString():"not yet"]})]})]}):"No active connector authorization for this workspace yet."}),e.jsx("div",{className:s.settingDescription,style:{marginTop:"12px"},children:"Use the server URL above in your client, then finish the OAuth authorization flow from the Integrations tab."}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",width:"100%",marginTop:"12px"},children:e.jsx("button",{className:s.copyBtn,onClick:()=>ne("integrations"),children:"Open Integrations"})})]}),e.jsxs("div",{className:s.settingGroup,children:[e.jsxs("div",{className:`${s.codeBlockWrapper} ${s.codeBlockWrapperCustom} ${s.marginTop12}`,style:{minHeight:"260px"},children:[e.jsxs("div",{className:s.codeHeader,children:[e.jsx("span",{className:s.codeLabel,children:"Cloud MCP Configuration"}),e.jsxs("div",{className:s.codeHeaderActions,children:[e.jsx("select",{className:s.settingInput,value:te,onChange:t=>lt(t.target.value),"aria-label":"MCP client",style:{width:"auto",minWidth:"170px",padding:"6px 12px",fontSize:"12px",borderRadius:"8px"},children:xt.map(t=>e.jsx("option",{value:t.id,disabled:t.disabled,children:t.label},t.id))}),e.jsx("button",{className:`${s.copyBtn} ${be==="full"?s.copyBtnActive:""}`,onClick:ta,title:"Copy full configuration file",children:be==="full"?e.jsx(ae,{size:14}):e.jsx(Ss,{size:14})})]})]}),e.jsx("pre",{className:s.codeBlock,children:e.jsx("code",{children:Cs?rt(Ue,Cs,q.rootKey||"mcpServers",q.wrapperKeys||[]):ct(q.renderedText||"")})})]}),me&&e.jsxs("div",{className:`${me.type==="success"?s.successMessage:s.errorMessage} ${s.marginTop12}`,children:[me.type==="success"?e.jsx(ae,{size:14}):e.jsx(ce,{size:14}),me.message]}),e.jsxs("div",{className:`${s.codeBlockWrapper} ${s.marginTop12}`,children:[e.jsx("div",{className:s.codeHeader,children:e.jsx("span",{className:s.codeLabel,children:q.instructionLabel})}),e.jsxs("div",{style:{padding:"16px 20px"},children:[e.jsx("div",{className:s.settingDescription,children:q.instructionText}),dt()]})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`${s.settingGroup} ${s.marginTop16}`,children:e.jsxs("div",{className:s.settingLabelGroup,children:[e.jsx("h3",{className:s.settingTitle,children:"Cloud MCP"}),e.jsx("span",{className:s.settingDescription,children:"Cloud MCP connects agents to Taskforce through the hosted MCP endpoint. Use this for remote MCP clients or tools that cannot access your local Taskforce install."})]})}),e.jsxs("div",{className:`${s.codeBlockWrapper} ${s.codeBlockWrapperCustom} ${s.marginTop16}`,children:[e.jsx("div",{className:s.codeHeader,children:e.jsx("div",{className:s.settingLabelGroup,style:{gap:"2px"},children:e.jsx("span",{className:s.codeLabel,children:"Generate Token"})})}),e.jsx("div",{className:s.mcpTokenCardBody,children:e.jsxs("div",{className:s.mcpTokenFormGrid,children:[e.jsxs("div",{className:s.settingsItem,style:{gap:"6px"},children:[e.jsx("div",{className:s.settingLabelGroup,children:e.jsx("span",{className:s.settingDescription,children:"Token Name"})}),e.jsx("input",{type:"text",className:s.settingInput,placeholder:"Cursor on MacBook",value:Ft,onChange:t=>at(t.target.value)})]}),e.jsxs("div",{className:s.settingsItem,style:{gap:"6px"},children:[e.jsx("div",{className:s.settingLabelGroup,children:e.jsx("span",{className:s.settingDescription,children:"Expiry (Optional)"})}),e.jsx("input",{type:"date",className:`${s.settingInput} ${s.taskFormDateInput}`,value:nt,onChange:t=>Ht(t.target.value)})]})]})}),e.jsxs("div",{className:s.mcpTokenOutputWrap,children:[e.jsx("div",{className:s.settingLabelGroup,children:e.jsx("span",{className:s.settingDescription,children:"Full Token"})}),e.jsx("input",{type:"text",className:`${s.settingInput} ${s.mcpTokenValueInput}`,placeholder:"Generate a token to populate the full secret",value:Wt||"",onChange:t=>{ot(t.target.value),ve(null)}})]}),e.jsxs("div",{className:s.mcpTokenActionRow,children:[e.jsxs("button",{className:s.copyBtn,onClick:()=>{on()},disabled:!Ie||Ut,title:"Test Token","aria-label":"Test Token",children:[Ut?e.jsx(_e,{size:14,className:s.spinIcon}):e.jsx(ws,{size:14}),e.jsx("span",{children:"TEST TOKEN"})]}),e.jsxs("button",{className:`${s.copyBtn} ${be==="token"?s.copyBtnActive:""}`,onClick:()=>Ie&&Ts(Ie,"token"),disabled:!Ie,title:"Copy Token","aria-label":"Copy Token",children:[be==="token"?e.jsx(ae,{size:14}):e.jsx(Ss,{size:14}),e.jsx("span",{children:"COPY TOKEN"})]}),e.jsxs("button",{className:s.copyBtn,onClick:()=>{nn()},disabled:ss==="create",title:"Generate Token","aria-label":"Generate Token",children:[ss==="create"?e.jsx(_e,{size:14,className:s.spinIcon}):e.jsx(ws,{size:14}),e.jsx("span",{children:"GENERATE TOKEN"})]})]}),Ge&&e.jsxs("div",{className:`${Ge.type==="success"?s.successMessage:s.errorMessage} ${s.marginTop12}`,children:[Ge.type==="success"?e.jsx(ae,{size:14}):e.jsx(ce,{size:14}),Ge.message]}),H&&e.jsxs("div",{className:`${H.type==="success"?s.successMessage:s.errorMessage} ${s.marginTop12}`,children:[H.type==="success"?e.jsx(ae,{size:14}):e.jsx(ce,{size:14}),e.jsxs("div",{children:[e.jsx("div",{children:H.message}),H.type==="success"&&(H.workspaceName||H.workspaceId)&&e.jsxs("div",{className:s.settingHelper,children:["Workspace: ",H.workspaceName||H.workspaceId,H.workspaceId?` (${H.workspaceId})`:""]}),H.type==="success"&&Array.isArray(H.scopes)&&H.scopes.length>0&&e.jsxs("div",{className:s.settingHelper,children:["Granted scopes: ",H.scopes.join(", ")]}),H.endpoint&&e.jsxs("div",{className:s.settingHelper,children:["Endpoint: ",H.endpoint]}),H.type==="error"&&H.errorCode&&e.jsxs("div",{className:s.settingHelper,children:["Error code: ",H.errorCode]}),H.type==="error"&&H.followup&&e.jsx("div",{className:s.settingHelper,children:H.followup})]})]})]}),e.jsxs("div",{className:s.settingGroup,children:[e.jsxs("div",{className:`${s.codeBlockWrapper} ${s.codeBlockWrapperCustom} ${s.marginTop12}`,style:{minHeight:"260px"},children:[e.jsxs("div",{className:s.codeHeader,children:[e.jsx("span",{className:s.codeLabel,children:"Cloud MCP Configuration"}),e.jsxs("div",{className:s.codeHeaderActions,children:[e.jsx("select",{className:s.settingInput,value:te,onChange:t=>lt(t.target.value),"aria-label":"MCP client",style:{width:"auto",minWidth:"170px",padding:"6px 12px",fontSize:"12px",borderRadius:"8px"},children:xt.map(t=>e.jsx("option",{value:t.id,disabled:t.disabled,children:t.label},t.id))}),e.jsx("button",{className:`${s.copyBtn} ${be==="full"?s.copyBtnActive:""}`,onClick:ta,title:"Copy full configuration file",children:be==="full"?e.jsx(ae,{size:14}):e.jsx(Ss,{size:14})})]})]}),e.jsx("pre",{className:s.codeBlock,children:e.jsx("code",{children:Cs?rt(Ue,Cs,q.rootKey||"mcpServers",q.wrapperKeys||[]):ct(q.renderedText||"")})})]}),me&&e.jsxs("div",{className:`${me.type==="success"?s.successMessage:s.errorMessage} ${s.marginTop12}`,children:[me.type==="success"?e.jsx(ae,{size:14}):e.jsx(ce,{size:14}),me.message]}),e.jsxs("div",{className:`${s.codeBlockWrapper} ${s.marginTop12}`,children:[e.jsx("div",{className:s.codeHeader,children:e.jsx("span",{className:s.codeLabel,children:q.instructionLabel})}),e.jsxs("div",{style:{padding:"16px 20px"},children:[e.jsx("div",{className:s.settingDescription,children:q.instructionText}),dt()]})]})]}),e.jsxs("div",{className:`${s.settingGroup} ${s.marginTop16}`,children:[e.jsxs("div",{className:s.toggleHeading,onClick:()=>zt(t=>!t),onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),zt(i=>!i))},role:"button",tabIndex:0,title:et?"Hide workspace tokens":"Show workspace tokens",children:[e.jsx("label",{className:s.label,children:"Your Tokens"}),et?e.jsx(gt,{size:14}):e.jsx(Te,{size:14})]}),et&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`${s.settingDescription} ${s.marginTop12}`,children:"Manage tokens created for this workspace."}),Oe&&e.jsxs("div",{className:`${Oe.type==="success"?s.successMessage:s.errorMessage} ${s.marginTop12}`,children:[Oe.type==="success"?e.jsx(ae,{size:14}):e.jsx(ce,{size:14}),Oe.message]}),qa?e.jsx("p",{className:s.settingHelper,children:"Loading tokens…"}):Ot?e.jsxs("div",{className:s.errorMessage,children:[e.jsx(ce,{size:14}),Ot]}):st.length===0?e.jsx("p",{className:s.settingHelper,children:"No MCP tokens yet."}):e.jsx("div",{className:s.settingGroup,children:Za.map(t=>e.jsxs("div",{className:`${s.settingsItem} ${s.marginTop12}`,style:{padding:"14px 16px",borderRadius:"12px",border:"1px solid var(--border-primary, rgba(255, 255, 255, 0.1))",background:"rgba(255, 255, 255, 0.03)"},children:[e.jsxs("div",{className:s.settingLabelGroup,children:[e.jsxs("div",{className:s.labelGroupFlex,children:[e.jsx("label",{className:s.settingLabel,children:t.name}),e.jsx("span",{className:`${s.configBadge} ${t.status==="revoked"?s.configBadgeRevoked:t.status==="expired"?s.configBadgeExpired:s.configBadgeActive}`,children:t.status})]}),e.jsx("span",{className:s.settingDescription,style:{fontFamily:'"JetBrains Mono", "Fira Code", monospace'},children:t.tokenPrefix}),e.jsxs("span",{className:s.settingDescription,children:["Scopes: ",t.scopes.join(", ")]}),e.jsxs("span",{className:s.settingDescription,children:["Created ",new Date(t.createdAt).toLocaleDateString(),t.lastUsedAt?` · Last used ${new Date(t.lastUsedAt).toLocaleString()}`:" · Never used"]})]}),e.jsxs("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap",justifyContent:"flex-end"},children:[t.status==="active"&&e.jsx("button",{className:s.copyBtn,onClick:()=>{ut(t.id,"regenerate")},disabled:ss===`regenerate:${t.id}`,children:"Regenerate"}),t.status==="active"&&e.jsx("button",{className:s.copyBtn,onClick:()=>{ut(t.id,"revoke")},disabled:ss===`revoke:${t.id}`,children:"Revoke"}),t.status!=="active"&&e.jsx("button",{className:s.copyBtn,onClick:()=>{ut(t.id,"delete")},disabled:ss===`delete:${t.id}`,children:"Delete"})]})]},t.id))})]})]})]})}),Xa&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`${s.settingGroup} ${s.marginTop16}`,children:e.jsxs("div",{className:s.settingLabelGroup,children:[e.jsx("h3",{className:s.settingTitle,children:"Local MCP"}),e.jsx("span",{className:s.settingDescription,children:"Local MCP connects through your local Taskforce install and does not require a cloud access token. Use this for Codex, Claude Code CLI, Gemini CLI, and similar local MCP clients."})]})}),e.jsxs("div",{className:`${s.codeBlockWrapper} ${s.codeBlockWrapperCustom}`,children:[e.jsxs("div",{className:s.codeHeader,children:[e.jsx("span",{className:s.codeLabel,children:"Local MCP Configuration"}),e.jsxs("div",{className:s.codeHeaderActions,children:[e.jsx("select",{className:s.settingInput,value:te,onChange:t=>lt(t.target.value),"aria-label":"MCP client",style:{width:"auto",minWidth:"170px",padding:"6px 12px",fontSize:"12px",borderRadius:"8px"},children:xt.map(t=>e.jsx("option",{value:t.id,disabled:t.disabled,children:t.label},t.id))}),e.jsx("button",{className:`${s.copyBtn} ${be==="full"?s.copyBtnActive:""}`,onClick:()=>an("full"),title:"Copy full configuration file",children:be==="full"?e.jsx(ae,{size:14}):e.jsx(Ss,{size:14})})]})]}),e.jsx("pre",{className:s.codeBlock,children:e.jsx("code",{children:aa?rt(Ce.serverId,aa,ie.rootKey||"mcpServers",ie.wrapperKeys||[]):ct(ie.renderedText||"")})})]}),e.jsxs("div",{className:`${s.codeBlockWrapper} ${s.marginTop12}`,children:[e.jsx("div",{className:s.codeHeader,children:e.jsx("span",{className:s.codeLabel,children:ie.instructionLabel})}),e.jsxs("div",{style:{padding:"16px 20px"},children:[e.jsx("div",{className:s.settingDescription,children:ie.instructionText}),dt()]})]}),e.jsx("div",{className:`${s.settingGroup} ${s.marginTop12}`,children:e.jsxs("div",{className:s.toggleHeading,onClick:()=>Rt(t=>!t),onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),Rt(i=>!i))},role:"button",tabIndex:0,title:"Show advanced MCP install options",children:[e.jsx("label",{className:s.label,children:"Advanced"}),Et?e.jsx(gt,{size:14}):e.jsx(Te,{size:14})]})}),Et&&e.jsxs("div",{className:`${s.settingGroup} ${s.marginTop12}`,children:[e.jsxs("div",{className:s.settingLabelGroup,children:[e.jsx("h3",{className:s.settingTitle,children:"Advanced Installation Mode"}),e.jsx("span",{className:s.settingDescription,children:"Global mode is recommended. Local / npx is intended for Taskforce development workflows."})]}),e.jsxs("div",{className:s.buttonGrid,children:[e.jsx("button",{className:`${s.themeBtn} ${ze?s.activeTheme:""}`,onClick:()=>Dt(!0),children:"Global"}),e.jsx("button",{className:`${s.themeBtn} ${ze?"":s.activeTheme}`,onClick:()=>Dt(!1),children:"Local / npx (Dev)"})]}),e.jsxs("div",{className:`${s.settingsItem} ${s.marginTop16}`,children:[e.jsxs("div",{className:s.settingLabelGroup,children:[e.jsxs("div",{className:s.labelGroupFlex,children:[e.jsx("label",{className:s.settingLabel,children:"MCP Path Mapping (Host Root)"}),cs&&!rs&&e.jsx("span",{className:s.configBadge,children:"Server Configured"})]}),e.jsx("span",{className:s.settingDescription,children:"If running in Docker, WSL, or Remote Dev, provide the absolute path to this project as seen by your host OS."})]}),e.jsx("div",{className:s.pathInputWrapper,children:e.jsx("input",{type:"text",className:s.settingInput,placeholder:cs||"/Users/username/Projects/my-project or C:\\Projects\\my-project",value:rs||"",onChange:t=>Ea?.(t.target.value)})})]})]})]})]}),D==="integrations"&&e.jsxs("div",{className:s.settingsGroup,children:[e.jsx("div",{className:s.settingGroup,children:e.jsxs("div",{className:s.settingLabelGroup,children:[e.jsx("h3",{className:s.settingTitle,children:"Integrations"}),e.jsx("span",{className:s.settingDescription,children:"Manage OAuth-based app connectors separately from MCP tokens and local client setup."})]})}),e.jsxs("div",{className:`${s.settingGroup} ${s.marginTop16}`,children:[[{key:"chatgpt",label:"ChatGPT Connector",description:"Use the dedicated MCP host in ChatGPT Apps & Connectors. Taskforce handles OAuth and binds each connector authorization to one workspace.",emptyMessage:"No active ChatGPT connector grant for this workspace yet.",connector:ea},{key:"claude",label:"Claude Desktop Connector",description:"Use the dedicated MCP host in Claude Desktop Settings > Connectors. Taskforce handles OAuth and binds each connector authorization to one workspace.",emptyMessage:"No active Claude Desktop connector grant for this workspace yet.",connector:sa}].map(t=>{const i=t.connector;return e.jsxs("div",{className:`${s.settingsItem} ${s.marginTop12}`,style:{padding:"16px",borderRadius:"14px",border:"1px solid var(--border-primary, rgba(255, 255, 255, 0.1))",background:"rgba(255, 255, 255, 0.03)"},children:[e.jsxs("div",{className:s.settingLabelGroup,children:[e.jsxs("div",{className:s.labelGroupFlex,children:[e.jsx("label",{className:s.settingLabel,children:t.label}),e.jsx("span",{className:`${s.configBadge} ${i?s.configBadgeActive:s.configBadgeRevoked}`,children:i?"connected":"not connected"})]}),e.jsx("span",{className:s.settingDescription,children:t.description}),e.jsx("span",{className:s.settingDescription,style:{fontFamily:'"JetBrains Mono", "Fira Code", monospace'},children:He}),i?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:s.settingDescription,children:["Authorized workspace: ",Me||i.workspaceId]}),e.jsxs("span",{className:s.settingDescription,children:["Granted scopes: ",i.scopes.join(", ")]}),e.jsxs("span",{className:s.settingDescription,children:["Connected ",new Date(i.createdAt).toLocaleString(),i.lastUsedAt?` · Last used ${new Date(i.lastUsedAt).toLocaleString()}`:" · Never used"]})]}):e.jsx("span",{className:s.settingDescription,children:t.emptyMessage})]}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",flexWrap:"wrap"},children:i&&e.jsxs("button",{className:s.copyBtn,onClick:()=>{ln(i.id)},disabled:Yt===i.id,children:[Yt===i.id?e.jsx(_e,{size:14,className:s.spinIcon}):e.jsx(qe,{size:14}),"Disconnect"]})})]},t.key)}),Ja&&e.jsx("p",{className:`${s.settingHelper} ${s.marginTop12}`,children:"Loading connector grants…"}),Jt&&e.jsxs("div",{className:`${s.errorMessage} ${s.marginTop12}`,children:[e.jsx(ce,{size:14}),Jt]})]})]})]})]})})}export{ml as TaskSettings};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a2 as t}from"./index-B9k24Aym.js";const n="D-";function E(e){return t(n,e)}export{E as g};
|