@runfusion/fusion 0.4.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/LICENSE +21 -0
  2. package/dist/bin.js +34069 -34842
  3. package/dist/client/assets/{AgentDetailView-DJwWfkpv.js → AgentDetailView-dhJd4os0.js} +6 -11
  4. package/dist/client/assets/{AgentsView-DegK8aw-.js → AgentsView-CYVTv2_l.js} +3 -3
  5. package/dist/client/assets/{ChatView-CYpEShLS.js → ChatView-ByPhfQZ6.js} +1 -1
  6. package/dist/client/assets/{DevServerView-DfCTA9fx.js → DevServerView-CD7mgC11.js} +1 -1
  7. package/dist/client/assets/{DirectoryPicker-B0qNpfLW.js → DirectoryPicker-Cm0FCC9M.js} +1 -1
  8. package/dist/client/assets/{DocumentsView-CsQxuyz3.js → DocumentsView-oB319uCj.js} +1 -1
  9. package/dist/client/assets/{InsightsView-Bzs7A2jv.js → InsightsView-BHdMNnOa.js} +1 -1
  10. package/dist/client/assets/{MemoryView-Cl5ASqjW.js → MemoryView-BDJMlzlM.js} +1 -1
  11. package/dist/client/assets/{NodesView-BpiqRlvc.js → NodesView-BfOlOj-Q.js} +1 -1
  12. package/dist/client/assets/{PiExtensionsManager-Cr6EoC7S.js → PiExtensionsManager-D-IznnkU.js} +2 -2
  13. package/dist/client/assets/{PluginManager-DXtQdfns.js → PluginManager-D40uAE-p.js} +1 -1
  14. package/dist/client/assets/{RoadmapsView-CYPLTTB0.js → RoadmapsView-DtgL8yl3.js} +1 -1
  15. package/dist/client/assets/{SettingsModal-CNdVTVqD.js → SettingsModal-0IyoaKEv.js} +1 -1
  16. package/dist/client/assets/SettingsModal-D1vZdAS4.js +31 -0
  17. package/dist/client/assets/{SetupWizardModal-BLiljNn7.js → SetupWizardModal-BaQ8VkZm.js} +1 -1
  18. package/dist/client/assets/{SkillsView-Dlpw5LKI.js → SkillsView-DAvaRl37.js} +1 -1
  19. package/dist/client/assets/TodoView-BXRQSmSw.js +1 -0
  20. package/dist/client/assets/TodoView-DNi8blBB.css +1 -0
  21. package/dist/client/assets/{folder-open-B_38R5AA.js → folder-open-BJ4SvamV.js} +1 -1
  22. package/dist/client/assets/index-B7TDbn3p.css +1 -0
  23. package/dist/client/assets/index-CGW6tOaX.js +631 -0
  24. package/dist/client/assets/list-checks-CpGwz9gV.js +6 -0
  25. package/dist/client/assets/{upload-DNQF7XCK.js → upload-DJYyvab0.js} +1 -1
  26. package/dist/client/assets/{users-CG2_rCdk.js → users-ndAFpylb.js} +1 -1
  27. package/dist/client/index.html +2 -2
  28. package/dist/client/version.json +1 -1
  29. package/dist/extension.js +3311 -592
  30. package/dist/pi-claude-cli/src/__tests__/process-manager.test.ts +50 -17
  31. package/dist/pi-claude-cli/src/__tests__/setup-test-isolation.test.ts +30 -0
  32. package/dist/pi-claude-cli/src/__tests__/setup-test-isolation.ts +6 -0
  33. package/package.json +17 -17
  34. package/skill/fusion/references/extension-tools.md +5 -5
  35. package/skill/fusion/references/fusion-capabilities.md +5 -5
  36. package/dist/client/assets/SettingsModal-CyCC7MzL.js +0 -31
  37. package/dist/client/assets/index-DQKtk17v.js +0 -616
  38. package/dist/client/assets/index-DjOxzdj3.css +0 -1
@@ -1,31 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PluginManager-DXtQdfns.js","assets/vendor-react-K0fH_qHe.js","assets/index-DQKtk17v.js","assets/vendor-xterm-DzcZoU0P.js","assets/vendor-xterm-LZoznX6r.css","assets/index-DjOxzdj3.css","assets/DirectoryPicker-B0qNpfLW.js","assets/folder-open-B_38R5AA.js","assets/DirectoryPicker-DzKVmxOf.css","assets/PluginManager-DRiIqol2.css","assets/PiExtensionsManager-Cr6EoC7S.js","assets/PiExtensionsManager-kgTOHPE9.css"])))=>i.map(i=>d[i]);
2
- import{c as jt,bE as cs,bJ as Js,bD as He,bC as gt,as as Zs,I as Xs,w as ea,a7 as ta,K as sa,G as ft,bK as aa,n as Qt,bL as la,p as M,bM as na,bN as ra,bO as Jt,h as ia,bP as Zt,bQ as oa,bR as ca,bS as da,b9 as Xt,b8 as ma,bT as ua,bU as ha,bV as pa,bW as ga,bX as ba,bY as xa,bZ as va,b_ as fa,b$ as ja,u as bt,c0 as ya,c1 as ka,o as Na,c2 as Ca,bb as wa,bi as Sa,bd as Pa,bc as Ma,c3 as Fa,c4 as es,c5 as Aa,c6 as Ea,P as ts,c7 as Ia,c8 as Ta,c9 as Ra,ca as La,cb as Oa,cc as za,cd as Da,ce as $a,cf as Ba,bl as _a,j as te,cg as Ka,ch as Ua,_ as ds,ci as Ga}from"./index-DQKtk17v.js";import{r as o,j as e}from"./vendor-react-K0fH_qHe.js";import{u as qa}from"./SettingsModal-CNdVTVqD.js";import{U as Wa}from"./users-CG2_rCdk.js";import"./vendor-xterm-DzcZoU0P.js";/**
3
- * @license lucide-react v1.7.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */const Va=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],ms=jt("moon",Va);/**
8
- * @license lucide-react v1.7.0 - ISC
9
- *
10
- * This source code is licensed under the ISC license.
11
- * See the LICENSE file in the root directory of this source tree.
12
- */const Ha=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Ya=jt("settings-2",Ha);/**
13
- * @license lucide-react v1.7.0 - ISC
14
- *
15
- * This source code is licensed under the ISC license.
16
- * See the LICENSE file in the root directory of this source tree.
17
- */const Qa=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],us=jt("sun",Qa),Ja=[{value:"light",label:"Light",icon:us},{value:"dark",label:"Dark",icon:ms},{value:"system",label:"System",icon:cs}],ss=[{value:"default",label:"Default",className:"theme-swatch-default"},{value:"ocean",label:"Ocean",className:"theme-swatch-ocean"},{value:"forest",label:"Forest",className:"theme-swatch-forest"},{value:"sunset",label:"Sunset",className:"theme-swatch-sunset"},{value:"zen",label:"Zen",className:"theme-swatch-zen"},{value:"berry",label:"Berry",className:"theme-swatch-berry"},{value:"high-contrast",label:"High Contrast",className:"theme-swatch-high-contrast"},{value:"industrial",label:"Industrial",className:"theme-swatch-industrial"},{value:"monochrome",label:"Mono",className:"theme-swatch-monochrome"},{value:"slate",label:"Slate",className:"theme-swatch-slate"},{value:"ash",label:"Ash",className:"theme-swatch-ash"},{value:"graphite",label:"Graphite",className:"theme-swatch-graphite"},{value:"silver",label:"Silver",className:"theme-swatch-silver"},{value:"solarized",label:"Solarized",className:"theme-swatch-solarized"},{value:"factory",label:"Factory",className:"theme-swatch-factory"},{value:"ayu",label:"Ayu",className:"theme-swatch-ayu"},{value:"one-dark",label:"One Dark",className:"theme-swatch-one-dark"},{value:"nord",label:"Nord",className:"theme-swatch-nord"},{value:"dracula",label:"Dracula",className:"theme-swatch-dracula"},{value:"gruvbox",label:"Gruvbox",className:"theme-swatch-gruvbox"},{value:"tokyo-night",label:"Tokyo Night",className:"theme-swatch-tokyo-night"},{value:"catppuccin-mocha",label:"Catppuccin Mocha",className:"theme-swatch-catppuccin-mocha"},{value:"github-dark",label:"GitHub Dark",className:"theme-swatch-github-dark"},{value:"everforest",label:"Everforest",className:"theme-swatch-everforest"},{value:"rose-pine",label:"Rosé Pine",className:"theme-swatch-rose-pine"},{value:"kanagawa",label:"Kanagawa",className:"theme-swatch-kanagawa"},{value:"night-owl",label:"Night Owl",className:"theme-swatch-night-owl"},{value:"palenight",label:"Palenight",className:"theme-swatch-palenight"},{value:"monokai-pro",label:"Monokai Pro",className:"theme-swatch-monokai-pro"},{value:"slime",label:"Slime",className:"theme-swatch-slime"},{value:"brutalist",label:"Brutalist",className:"theme-swatch-brutalist"},{value:"neon-city",label:"Neon City",className:"theme-swatch-neon-city"},{value:"parchment",label:"Parchment",className:"theme-swatch-parchment"},{value:"terminal",label:"Terminal",className:"theme-swatch-terminal"},{value:"glass",label:"Glass",className:"theme-swatch-glass"},{value:"horizon",label:"Horizon",className:"theme-swatch-horizon"},{value:"vitesse",label:"Vitesse",className:"theme-swatch-vitesse"},{value:"outrun",label:"Outrun",className:"theme-swatch-outrun"},{value:"snazzy",label:"Snazzy",className:"theme-swatch-snazzy"},{value:"porple",label:"Porple",className:"theme-swatch-porple"},{value:"espresso",label:"Espresso",className:"theme-swatch-espresso"},{value:"mars",label:"Mars",className:"theme-swatch-mars"},{value:"poimandres",label:"Poimandres",className:"theme-swatch-poimandres"},{value:"ember",label:"Ember",className:"theme-swatch-ember"},{value:"rust",label:"Rust",className:"theme-swatch-rust"},{value:"copper",label:"Copper",className:"theme-swatch-copper"},{value:"foundry",label:"Foundry",className:"theme-swatch-foundry"},{value:"carbon",label:"Carbon",className:"theme-swatch-carbon"},{value:"sandstone",label:"Sandstone",className:"theme-swatch-sandstone"},{value:"lagoon",label:"Lagoon",className:"theme-swatch-lagoon"},{value:"frost",label:"Frost",className:"theme-swatch-frost"},{value:"lavender",label:"Lavender",className:"theme-swatch-lavender"},{value:"neon-bloom",label:"Neon Bloom",className:"theme-swatch-neon-bloom"},{value:"sepia",label:"Sepia",className:"theme-swatch-sepia"}];function Za({themeMode:b,colorTheme:m,onThemeModeChange:h,onColorThemeChange:S}){const T=o.useCallback(()=>{h("dark"),S("default")},[h,S]);return e.jsxs("div",{className:"theme-selector",children:[e.jsx("div",{className:"theme-mode-toggle",role:"radiogroup","aria-label":"Theme mode",children:Ja.map(({value:k,label:w,icon:V})=>e.jsxs("button",{className:`theme-mode-btn${b===k?" active":""}`,onClick:()=>h(k),"aria-pressed":b===k,"aria-label":`${w} mode`,title:`${w} mode`,children:[e.jsx(V,{size:16}),e.jsx("span",{children:w})]},k))}),e.jsxs("div",{className:"theme-current-preview",children:[e.jsx("div",{className:"theme-preview-icon",children:b==="light"?e.jsx(us,{size:20}):b==="dark"?e.jsx(ms,{size:20}):e.jsx(cs,{size:20})}),e.jsxs("div",{className:"theme-preview-info",children:[e.jsx("div",{className:"theme-preview-label",children:"Current theme"}),e.jsxs("div",{className:"theme-preview-value",children:[b==="system"?"System":`${b.charAt(0).toUpperCase()+b.slice(1)}`," / ",ss.find(k=>k.value===m)?.label]})]})]}),e.jsx("div",{className:"theme-section-title",children:"Color Theme"}),e.jsx("div",{className:"theme-grid",role:"radiogroup","aria-label":"Color theme",children:ss.map(({value:k,label:w,className:V})=>e.jsxs("button",{className:`theme-option${m===k?" active":""}`,onClick:()=>S(k),"aria-pressed":m===k,"aria-label":`${w} theme`,title:w,children:[e.jsx("div",{className:`theme-option-swatch ${V}`}),e.jsx("span",{className:"theme-option-label",children:w})]},k))}),e.jsx("button",{className:"theme-reset-btn",onClick:T,"aria-label":"Reset to default theme",children:e.jsx("span",{children:"Reset to defaults"})})]})}const ve=[{id:"default-executor",name:"Default Executor",description:"Standard task execution agent with full tooling and review support.",role:"executor",prompt:`You are a task execution agent for "fn", an AI-orchestrated task board.
18
-
19
- You are working in a git worktree isolated from the main branch. Your job is to implement the task described in the PROMPT.md specification you're given.`,builtIn:!0},{id:"default-triage",name:"Default Triage",description:"Standard task specification agent producing detailed PROMPT.md files.",role:"triage",prompt:`You are a task specification agent for "fn", an AI-orchestrated task board.
20
-
21
- Your job: take a rough task description and produce a fully specified PROMPT.md that another AI agent can execute autonomously.`,builtIn:!0},{id:"default-reviewer",name:"Default Reviewer",description:"Standard independent code and plan reviewer with balanced criteria.",role:"reviewer",prompt:`You are an independent code and plan reviewer.
22
-
23
- You provide quality assessment for task implementations with full read access to the codebase.`,builtIn:!0},{id:"default-merger",name:"Default Merger",description:"Standard merge agent for squash merges with conflict resolution.",role:"merger",prompt:`You are a merge agent for "fn", an AI-orchestrated task board.
24
-
25
- Your job is to finalize a squash merge: resolve any conflicts and write a good commit message.`,builtIn:!0},{id:"senior-engineer",name:"Senior Engineer",description:"Autonomous executor with architectural awareness, performance focus, and minimal hand-holding.",role:"executor",prompt:`You are a senior engineering agent for "fn", an AI-orchestrated task board.
26
-
27
- You operate with a high degree of autonomy, making architectural decisions and balancing trade-offs independently.`,builtIn:!0},{id:"strict-reviewer",name:"Strict Reviewer",description:"Rigorous reviewer with stricter criteria for security, edge cases, and type safety.",role:"reviewer",prompt:`You are a strict code and plan reviewer with rigorous standards.
28
-
29
- You hold all submissions to a high bar for correctness, security, and maintainability.`,builtIn:!0},{id:"concise-triage",name:"Concise Triage",description:"Shorter, more focused specification format with minimal prose.",role:"triage",prompt:`You are a task specification agent for "fn". Produce a concise, actionable PROMPT.md from the given task description.
30
-
31
- Be brief and precise — avoid verbosity.`,builtIn:!0}],Xa={"executor-welcome":{key:"executor-welcome",name:"Executor Welcome",roles:["executor"],description:"Introductory section for the executor agent",defaultContent:"You are a task execution agent..."},"executor-guardrails":{key:"executor-guardrails",name:"Executor Guardrails",roles:["executor"],description:"Behavioral guardrails and constraints for the executor",defaultContent:"Treat the File Scope in PROMPT.md..."},"executor-spawning":{key:"executor-spawning",name:"Executor Spawning",roles:["executor"],description:"Instructions for spawning child agents",defaultContent:"You can spawn child agents..."},"executor-completion":{key:"executor-completion",name:"Executor Completion",roles:["executor"],description:"Completion criteria and signaling for executor",defaultContent:"After all steps are done..."},"triage-welcome":{key:"triage-welcome",name:"Triage Welcome",roles:["triage"],description:"Introductory section for the triage/specification agent",defaultContent:"You are a task specification agent..."},"triage-context":{key:"triage-context",name:"Triage Context",roles:["triage"],description:"Context-gathering instructions for triage",defaultContent:"What you receive: A raw task title..."},"reviewer-verdict":{key:"reviewer-verdict",name:"Reviewer Verdict",roles:["reviewer"],description:"Verdict criteria and format for code/review agent",defaultContent:"APPROVE — Step will achieve its stated outcomes..."},"merger-conflicts":{key:"merger-conflicts",name:"Merger Conflicts",roles:["merger"],description:"Merge conflict resolution instructions for merger",defaultContent:"If there are merge conflicts..."},"agent-generation-system":{key:"agent-generation-system",name:"Agent Generation System",roles:["executor"],description:"System prompt for generating agent specifications",defaultContent:"You are an agent specification generator..."},"workflow-step-refine":{key:"workflow-step-refine",name:"Workflow Step Refine",roles:["executor"],description:"System prompt for refining workflow step descriptions",defaultContent:"You are an expert at creating detailed agent prompts..."},"planning-system":{key:"planning-system",name:"Planning System",roles:["triage"],description:"System prompt for the AI planning assistant",defaultContent:"You are a planning assistant for the fn task board system..."},"subtask-breakdown-system":{key:"subtask-breakdown-system",name:"Subtask Breakdown System",roles:["executor"],description:"System prompt for AI subtask decomposition",defaultContent:"You are a task decomposition assistant..."},"mission-interview-system":{key:"mission-interview-system",name:"Mission Interview System",roles:["triage"],description:"System prompt for AI-assisted mission planning",defaultContent:"You are a mission planning assistant..."},"ai-refine-system":{key:"ai-refine-system",name:"AI Refine System",roles:["executor"],description:"System prompt for AI-powered text refinement",defaultContent:"You are a text refinement assistant..."}},as=["executor","triage","reviewer","merger"],Ee={executor:"Executor Agent",triage:"Triage Agent",reviewer:"Reviewer Agent",merger:"Merger Agent",scheduler:"Scheduler Agent",engineer:"Engineer Agent",custom:"Custom Agent"},se={executor:"#3b82f6",triage:"#f59e0b",reviewer:"#8b5cf6",merger:"#10b981",scheduler:"#06b6d4",engineer:"#ec4899",custom:"#6b7280"},xt={name:"",description:"",role:"executor",prompt:""};function el(b,m){const h=b.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,50),S=new Set(ve.map(w=>w.id)),T=new Set(m.map(w=>w.id));if(!S.has(h)&&!T.has(h))return h;let k=2;for(;S.has(`${h}-${k}`)||T.has(`${h}-${k}`);)k++;return`${h}-${k}`}function tl({value:b,onChange:m,promptOverrides:h,onPromptOverridesChange:S}){const[T,k]=o.useState("templates"),[w,V]=o.useState(null),[B,a]=o.useState(!1),[d,_]=o.useState(xt),[fe,ae]=o.useState(null),[Ye,oe]=o.useState(null),[Qe,Ie]=o.useState(new Set),[Je,je]=o.useState(null),[y,H]=o.useState(!1),[F,U]=o.useState(null),Te=o.useRef(null),I=b?.templates??[],D=b?.roleAssignments??{},Y=F===null?null:F.source==="builtin"?ve.find(c=>c.id===F.id):I.find(c=>c.id===F.id),ce=o.useCallback(c=>{const u=ve.filter(C=>C.role===c),x=I.filter(C=>C.role===c);return[...u,...x]},[I]);o.useEffect(()=>{F!==null&&Te.current?.focus()},[F]);const Re=o.useCallback(()=>{a(!0),V(null),_(xt),ae(null),U(null)},[]),$=o.useCallback(c=>{V(c.id),a(!1),_({name:c.name,description:c.description,role:c.role,prompt:c.prompt}),ae(null),U(null)},[]),Q=o.useCallback(()=>{V(null),a(!1),_(xt),ae(null),U(null),H(!1)},[]),Ze=o.useCallback(()=>{const c=d.name.trim();if(!c){ae("Template name is required");return}let u;if(B){if(u=el(c,I),new Set(ve.map(pe=>pe.id)).has(u)){ae(`Template ID "${u}" conflicts with a built-in template. Please use a different name.`);return}}else u=w;const x={id:u,name:c,description:d.description.trim(),role:d.role,prompt:d.prompt,builtIn:!1};let C;B?C=[...I,x]:C=I.map(g=>g.id===u?x:g);const j={...D};for(const[g,pe]of Object.entries(j))pe===u&&d.role!==g&&delete j[g];m({...b,templates:C,roleAssignments:Object.keys(j).length>0?j:void 0}),Q()},[d,B,w,I,D,b,m,Q]),K=o.useCallback(c=>{const u=I.filter(j=>j.id!==c),x={...D};let C=!1;for(const[j,g]of Object.entries(x))g===c&&(delete x[j],C=!0);m({...b,templates:u.length>0?u:void 0,roleAssignments:Object.keys(x).length>0||C?Object.keys(x).length>0?x:void 0:D}),oe(null),w===c&&Q()},[I,D,b,m,w,Q]),ye=o.useCallback((c,u)=>{const x={...D};u===""?delete x[c]:x[c]=u,m({...b,roleAssignments:Object.keys(x).length>0?x:void 0})},[D,b,m]),Le=o.useCallback((c,u)=>{const x={...h};x[c]=u||null,S(x)},[h,S]),Oe=o.useCallback(c=>{const u={...h};u[c]=null,S(u)},[h,S]),ke=o.useCallback(c=>{Ie(u=>{const x=new Set(u);return x.has(c)?x.delete(c):x.add(c),x})},[]),Ne=o.useCallback(c=>{je(u=>u===c?null:c)},[]),de=o.useCallback((c,u)=>{H(!1),U({source:c,id:u})},[]),ze=o.useCallback(()=>{U(null),H(c=>!c)},[]),le=c=>ve.some(u=>u.id===c);return e.jsxs("div",{className:"prompt-manager",children:[e.jsxs("div",{className:"prompt-manager-tabs",children:[e.jsxs("button",{className:`prompt-manager-tab ${T==="templates"?"active":""}`,onClick:()=>k("templates"),"data-testid":"tab-templates",children:[e.jsx(Js,{size:14}),"Templates"]}),e.jsxs("button",{className:`prompt-manager-tab ${T==="assignments"?"active":""}`,onClick:()=>k("assignments"),"data-testid":"tab-assignments",children:[e.jsx(Wa,{size:14}),"Assignments"]}),e.jsxs("button",{className:`prompt-manager-tab ${T==="overrides"?"active":""}`,onClick:()=>k("overrides"),"data-testid":"tab-overrides",children:[e.jsx(Ya,{size:14}),"Overrides"]})]}),e.jsxs("div",{className:"prompt-manager-content",children:[T==="templates"&&e.jsxs("div",{className:"prompt-manager-templates-tab","data-testid":"templates-tab",children:[(B||w!==null)&&e.jsxs("div",{className:"prompt-template-editor","data-testid":"template-editor",children:[e.jsx("h4",{className:"prompt-template-editor-title",children:B?"New Custom Template":"Edit Custom Template"}),e.jsxs("div",{className:"prompt-template-editor-fields",children:[e.jsxs("div",{className:"prompt-template-field",children:[e.jsx("label",{htmlFor:"template-name",children:"Name"}),e.jsx("input",{id:"template-name",type:"text",value:d.name,onChange:c=>_(u=>({...u,name:c.target.value})),placeholder:"e.g. My Custom Executor","data-testid":"template-name-input"})]}),e.jsxs("div",{className:"prompt-template-field",children:[e.jsx("label",{htmlFor:"template-description",children:"Description"}),e.jsx("input",{id:"template-description",type:"text",value:d.description,onChange:c=>_(u=>({...u,description:c.target.value})),placeholder:"Brief description of this template","data-testid":"template-description-input"})]}),e.jsxs("div",{className:"prompt-template-field",children:[e.jsx("label",{htmlFor:"template-role",children:"Role"}),e.jsx("select",{id:"template-role",value:d.role,onChange:c=>_(u=>({...u,role:c.target.value})),"data-testid":"template-role-select",children:as.map(c=>e.jsx("option",{value:c,children:Ee[c]},c))})]}),e.jsxs("div",{className:"prompt-template-field",children:[e.jsxs("div",{className:"prompt-template-prompt-label-row",children:[e.jsx("label",{htmlFor:"template-prompt",children:"Prompt"}),e.jsx("button",{type:"button",className:"btn-icon prompt-template-fullscreen-btn",onClick:ze,"aria-label":"Expand prompt to fullscreen","data-testid":"template-prompt-fullscreen",children:e.jsx(He,{size:14})})]}),y?e.jsxs("div",{className:"prompt-override-fullscreen",onKeyDown:c=>{c.key==="Escape"&&(c.preventDefault(),H(!1))},children:[e.jsxs("div",{className:"prompt-override-fullscreen-header",children:[e.jsx("div",{className:"prompt-override-fullscreen-title",children:"Edit Prompt"}),e.jsxs("button",{type:"button",className:"prompt-override-fullscreen-close",onClick:()=>H(!1),"data-testid":"template-prompt-collapse",children:[e.jsx(gt,{size:14}),"Collapse"]})]}),e.jsx("textarea",{id:"template-prompt-fullscreen","aria-label":"Template prompt - fullscreen",className:"prompt-template-prompt-textarea",value:d.prompt,onChange:c=>_(u=>({...u,prompt:c.target.value})),placeholder:"Enter the system prompt for this template...",rows:30,autoFocus:!0,"data-testid":"template-prompt-input-fullscreen"}),e.jsx("div",{className:"prompt-override-footer",children:e.jsxs("small",{className:"prompt-override-hint",children:[d.prompt.length," characters"]})})]}):e.jsx("textarea",{id:"template-prompt",value:d.prompt,onChange:c=>_(u=>({...u,prompt:c.target.value})),placeholder:"Enter the system prompt for this template...",rows:8,className:"prompt-template-prompt-textarea","data-testid":"template-prompt-input"})]}),fe&&e.jsx("div",{className:"prompt-template-error","data-testid":"template-error",children:fe}),e.jsxs("div",{className:"prompt-template-editor-actions",children:[e.jsx("button",{className:"btn btn-secondary",onClick:Q,"data-testid":"cancel-template-btn",children:"Cancel"}),e.jsx("button",{className:"btn btn-primary",onClick:Ze,"data-testid":"save-template-btn",children:B?"Create":"Save"})]})]})]}),e.jsxs("div",{className:"prompt-template-section","data-testid":"builtin-templates",children:[e.jsx("h4",{className:"prompt-template-section-title",children:"Built-in Templates"}),e.jsx("p",{className:"prompt-template-section-desc",children:"These templates are provided by Fusion and cannot be modified."}),e.jsx("div",{className:"prompt-template-list",children:ve.map(c=>e.jsxs("div",{className:"prompt-template-card","data-testid":`builtin-template-${c.id}`,children:[e.jsxs("div",{className:"prompt-template-card-header",children:[e.jsxs("div",{className:"prompt-template-card-info",children:[e.jsx("span",{className:"prompt-template-card-name",children:c.name}),e.jsx("span",{className:"prompt-template-badge-built-in",style:{borderColor:se[c.role]},children:"Built-in"}),e.jsx("span",{className:"prompt-template-badge-role",style:{backgroundColor:se[c.role]+"20",color:se[c.role]},children:Ee[c.role]})]}),e.jsx("div",{className:"prompt-template-card-actions",children:e.jsx("button",{type:"button",className:"btn-icon prompt-template-fullscreen-btn",onClick:()=>de("builtin",c.id),title:"View full prompt","aria-label":`View full prompt for ${c.name}`,"data-testid":`expand-view-${c.id}`,children:e.jsx(He,{size:14})})})]}),e.jsx("p",{className:"prompt-template-card-description",children:c.description}),e.jsx("div",{className:"prompt-template-card-preview",children:e.jsx("code",{children:c.prompt})})]},c.id))})]}),e.jsxs("div",{className:"prompt-template-section","data-testid":"custom-templates",children:[e.jsx("h4",{className:"prompt-template-section-title",children:"Custom Templates"}),e.jsx("p",{className:"prompt-template-section-desc",children:"Create custom templates to override built-in prompts for specific roles."}),I.length===0&&!B&&e.jsx("div",{className:"prompt-template-empty",children:"No custom templates yet. Create one to get started."}),I.length>0&&e.jsx("div",{className:"prompt-template-list",children:I.map(c=>e.jsx("div",{className:"prompt-template-card","data-testid":`custom-template-${c.id}`,children:Ye===c.id?e.jsxs("div",{className:"prompt-template-delete-confirm",children:[e.jsxs("p",{children:['Delete "',c.name,'"?']}),e.jsxs("div",{className:"prompt-template-delete-actions",children:[e.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>K(c.id),"data-testid":`confirm-delete-${c.id}`,children:"Delete"}),e.jsx("button",{className:"btn btn-sm",onClick:()=>oe(null),"data-testid":`cancel-delete-${c.id}`,children:"Cancel"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"prompt-template-card-header",children:[e.jsxs("div",{className:"prompt-template-card-info",children:[e.jsx("span",{className:"prompt-template-card-name",children:c.name}),e.jsx("span",{className:"prompt-template-badge-custom",children:"Custom"}),e.jsx("span",{className:"prompt-template-badge-role",style:{backgroundColor:se[c.role]+"20",color:se[c.role]},children:Ee[c.role]}),le(c.id)&&e.jsx("span",{className:"prompt-template-badge-override",children:"Overrides built-in"})]}),e.jsxs("div",{className:"prompt-template-card-actions",children:[e.jsx("button",{type:"button",className:"btn-icon prompt-template-fullscreen-btn",onClick:()=>de("custom",c.id),title:"View full prompt","aria-label":`View full prompt for ${c.name}`,"data-testid":`expand-view-${c.id}`,children:e.jsx(He,{size:14})}),e.jsx("button",{className:"btn-icon",onClick:()=>$(c),title:"Edit","aria-label":`Edit ${c.name}`,"data-testid":`edit-${c.id}`,children:e.jsx(Zs,{size:14})}),e.jsx("button",{className:"btn-icon",onClick:()=>oe(c.id),title:"Delete","aria-label":`Delete ${c.name}`,"data-testid":`delete-${c.id}`,children:e.jsx(Xs,{size:14})})]})]}),e.jsx("p",{className:"prompt-template-card-description",children:c.description}),e.jsx("div",{className:"prompt-template-card-preview",children:e.jsx("code",{children:c.prompt})})]})},c.id))}),!B&&w===null&&e.jsxs("button",{className:"btn btn-primary prompt-template-add-btn",onClick:Re,"data-testid":"add-template-btn",children:[e.jsx(ea,{size:14}),"Add Custom Template"]})]}),Y&&e.jsxs("div",{ref:Te,className:"prompt-override-fullscreen",role:"dialog","aria-modal":"true",tabIndex:-1,onKeyDown:c=>{c.key==="Escape"&&(c.preventDefault(),U(null))},children:[e.jsxs("div",{className:"prompt-override-fullscreen-header",children:[e.jsxs("div",{className:"prompt-override-fullscreen-title",children:[Y.name,e.jsx("span",{className:"prompt-template-badge-role",style:{backgroundColor:se[Y.role]+"20",color:se[Y.role]},children:Ee[Y.role]})]}),e.jsxs("button",{type:"button",className:"prompt-override-fullscreen-close",onClick:()=>U(null),"data-testid":`collapse-view-${Y.id}`,children:[e.jsx(gt,{size:14}),"Collapse"]})]}),e.jsx("pre",{className:"prompt-template-fullscreen-pre",children:Y.prompt})]})]}),T==="assignments"&&e.jsxs("div",{className:"prompt-manager-assignments-tab","data-testid":"assignments-tab",children:[e.jsx("p",{className:"prompt-assignments-desc",children:"Assign specific templates to agent roles. When a role has an assignment, that template will be used instead of the default built-in."}),e.jsx("div",{className:"prompt-role-assignment-list",children:as.map(c=>{const u=ce(c),x=D[c]??"",C=u.find(g=>g.id===x),j=!!x;return e.jsxs("div",{className:"prompt-role-assignment-row","data-testid":`assignment-${c}`,children:[e.jsxs("div",{className:"prompt-role-assignment-label",children:[e.jsx("span",{className:"prompt-role-badge",style:{backgroundColor:se[c]+"20",color:se[c]},children:Ee[c]}),j&&e.jsxs("span",{className:"prompt-role-assignment-status",children:[C?.name??"Custom"," (overrides default)"]})]}),e.jsxs("select",{className:"prompt-role-select",value:x,onChange:g=>ye(c,g.target.value),"data-testid":`select-${c}`,children:[e.jsx("option",{value:"",children:"Use default"}),u.map(g=>e.jsxs("option",{value:g.id,children:[g.name,le(g.id)?" (built-in)":" (custom)"]},g.id))]})]},c)})}),Object.keys(D).length>0&&e.jsxs("div",{className:"prompt-assignments-note",children:[e.jsx("strong",{children:"Note:"})," Role assignments are stored in the agentPrompts configuration. Custom templates override built-ins by ID."]})]}),T==="overrides"&&e.jsxs("div",{className:"prompt-manager-overrides-tab","data-testid":"overrides-tab",children:[e.jsx("p",{className:"prompt-overrides-desc",children:"Customize specific segments of AI agent prompts. Edits override built-in defaults. Use the Reset button to restore the original default for any prompt."}),e.jsx("div",{className:"prompt-overrides-list",children:Object.values(Xa).map(c=>{const u=c.key,x=h?.[u]??"",C=x!=="",j=Qe.has(u);return e.jsxs("div",{className:"prompt-override-item","data-testid":`override-${u}`,children:[e.jsxs("div",{className:"prompt-override-header",children:[e.jsxs("div",{className:"prompt-override-info",onClick:()=>ke(u),role:"button",tabIndex:0,onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&ke(u)},children:[e.jsx("span",{className:"prompt-override-name",children:c.name}),e.jsx("code",{className:"prompt-override-key",children:u}),C&&e.jsx("span",{className:"prompt-override-badge",children:"customized"})]}),e.jsxs("div",{className:"prompt-override-header-actions",children:[j&&e.jsx("button",{className:"prompt-override-fullscreen-btn",onClick:g=>{g.stopPropagation(),Ne(u)},"aria-label":"Expand to fullscreen","data-testid":`fullscreen-${u}`,children:e.jsx(He,{size:14})}),e.jsx("button",{className:"prompt-override-expand-btn","aria-label":j?"Collapse":"Expand","data-testid":`expand-${u}`,onClick:g=>{g.stopPropagation(),ke(u)},children:j?e.jsx(ta,{size:16}):e.jsx(sa,{size:16})})]})]}),e.jsx("p",{className:"prompt-override-description",children:c.description}),j&&(Je===u?e.jsxs("div",{className:"prompt-override-fullscreen",onKeyDown:g=>{g.key==="Escape"&&(g.preventDefault(),je(null))},children:[e.jsxs("div",{className:"prompt-override-fullscreen-header",children:[e.jsxs("div",{className:"prompt-override-fullscreen-title",children:[c.name,e.jsx("code",{className:"prompt-override-key",children:u})]}),e.jsxs("button",{type:"button",className:"prompt-override-fullscreen-close",onClick:()=>je(null),"data-testid":`collapse-fullscreen-${u}`,children:[e.jsx(gt,{size:14}),"Collapse"]})]}),e.jsx("textarea",{id:`prompt-${u}-fullscreen`,"aria-label":`${c.name} prompt override (${u}) - fullscreen`,className:"prompt-override-textarea",value:x,onChange:g=>{Le(u,g.target.value)},placeholder:`Default: ${c.defaultContent.slice(0,100)}${c.defaultContent.length>100?"...":""}`,rows:30,autoFocus:!0,"data-testid":`override-input-fullscreen-${u}`}),e.jsxs("div",{className:"prompt-override-footer",children:[C&&e.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:()=>Oe(u),"data-testid":`reset-fullscreen-${u}`,children:"Reset"}),e.jsx("small",{className:"prompt-override-hint",children:C?"Custom override active. Click Reset to restore default.":`No override set. Using built-in default (${c.defaultContent.length} chars).`})]})]}):e.jsxs("div",{className:"prompt-override-editor",children:[e.jsx("textarea",{id:`prompt-${u}`,"aria-label":`${c.name} prompt override (${u})`,className:"prompt-override-textarea",value:x,onChange:g=>{Le(u,g.target.value)},placeholder:`Default: ${c.defaultContent.slice(0,100)}${c.defaultContent.length>100?"...":""}`,rows:4,"data-testid":`override-input-${u}`}),e.jsxs("div",{className:"prompt-override-footer",children:[C&&e.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:g=>{g.stopPropagation(),Oe(u)},"data-testid":`reset-${u}`,children:"Reset"}),e.jsx("small",{className:"prompt-override-hint",children:C?"Custom override active. Click Reset to restore default.":`No override set. Using built-in default (${c.defaultContent.length} chars).`})]})]}))]},u)})})]})]})]})}const sl=o.lazy(()=>ds(()=>import("./PluginManager-DXtQdfns.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(b=>({default:b.PluginManager}))),al=o.lazy(()=>ds(()=>import("./PiExtensionsManager-Cr6EoC7S.js"),__vite__mapDeps([10,1,2,3,4,5,11])).then(b=>({default:b.PiExtensionsManager}))),ls="(max-width: 768px)",vt=".fusion/memory/DREAMS.md",ns=[{id:"__account_header",label:"Account",scope:void 0,isGroupHeader:!0},{id:"authentication",label:"Authentication",scope:void 0,icon:ft},{id:"__global_header",label:"Global",scope:void 0,isGroupHeader:!0},{id:"appearance",label:"Appearance",scope:"global"},{id:"notifications",label:"Notifications",scope:"global"},{id:"node-sync",label:"Node Sync",scope:"global"},{id:"global-models",label:"Models",scope:"global"},{id:"__project_header",label:"Project",scope:void 0,isGroupHeader:!0},{id:"project-models",label:"Project Models",scope:"project"},{id:"general",label:"General",scope:"project"},{id:"scheduling",label:"Scheduling",scope:"project"},{id:"worktrees",label:"Worktrees",scope:"project"},{id:"commands",label:"Commands",scope:"project"},{id:"merge",label:"Merge",scope:"project"},{id:"memory",label:"Memory",scope:"project"},{id:"experimental",label:"Experimental Features",scope:"project"},{id:"prompts",label:"Prompts",scope:"project"},{id:"backups",label:"Backups",scope:"project"},{id:"remote",label:"Remote Access",scope:"project"},{id:"plugins",label:"Plugins",scope:"project"}],rs=1440*60*1e3,ll=2,xe=["in-review","merged","failed","awaiting-approval","awaiting-user-review","planning-awaiting-input"],is={insights:"Insights",roadmap:"Roadmaps",memoryView:"Memory Editor",remoteAccess:"Remote Access",skillsView:"Skills View",nodesView:"Nodes View",devServerView:"Dev Server"},yt={devServer:"devServerView"};function hs(b){return yt[b]??b}function os(b,m){return b[m]===!0?!0:Object.entries(yt).some(([h,S])=>S===m&&b[h]===!0)}function nl(b){if(!b)return{};const m={};for(const[h,S]of Object.entries(b))m[hs(h)]=S;return m}function ml({onClose:b,addToast:m,projectId:h,initialSection:S,themeMode:T="dark",colorTheme:k="default",onThemeModeChange:w,onColorThemeChange:V,onReopenOnboarding:B}){const[a,d]=o.useState({maxConcurrent:2,maxTriageConcurrent:2,maxWorktrees:4,pollIntervalMs:15e3,heartbeatMultiplier:1,groupOverlappingFiles:!0,overlapIgnorePaths:[],autoMerge:!0,mergeStrategy:"direct",recycleWorktrees:!1,worktreeNaming:"random",includeTaskIdInCommit:!0,worktreeInitCommand:"",ntfyEnabled:!1,ntfyTopic:void 0}),[_,fe]=o.useState(!0),[ae,Ye]=o.useState(null),[oe,Qe]=o.useState(null),[Ie,Je]=o.useState(null),je=ns.find(t=>!t.isGroupHeader),[y,H]=o.useState(()=>S==="pi-extensions"?"plugins":S??je?.id??"authentication"),[F,U]=o.useState(()=>S==="pi-extensions"?"pi-extensions":"fusion-plugins"),[Te,I]=o.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(ls)?.matches===!0:!1),[D,Y]=o.useState(null),[ce,Re]=o.useState(null),[$,Q]=o.useState(null),{entries:Ze,currentPath:K,setPath:ye,loading:Le,error:Oe,refresh:ke}=aa("project",$!==null,h),Ne=os(a.experimentalFeatures??{},"remoteAccess"),de=ns.filter(t=>t.id!=="remote"||Ne),ze=de.find(t=>!t.isGroupHeader)?.id??"general",le=de.find(t=>t.id===y)?.scope;o.useEffect(()=>{y==="remote"&&!Ne&&H(ze)},[y,Ne,ze]);const[c,u]=o.useState([]),[x,C]=o.useState(!1),[j,g]=o.useState(null),[pe,Ce]=o.useState({}),[we,De]=o.useState({}),[$e,Be]=o.useState({}),me=o.useRef(null),[A,kt]=o.useState([]),[_e,Nt]=o.useState(!1),[R,Xe]=o.useState([]),[L,et]=o.useState([]),[Ct,wt]=o.useState(!1),[Se,Pe]=o.useState(null),[P,G]=o.useState(null),[q,tt]=o.useState(null),[st,Ke]=o.useState(!1),[ue,St]=o.useState(null),[J,Ue]=o.useState(null),[ge,ps]=o.useState("persistent"),[Me,Pt]=o.useState(null),[at,Mt]=o.useState(null),[lt,gs]=o.useState(null),[nt,Ge]=o.useState(""),[Ft,At]=o.useState(!1),[ne,Fe]=o.useState(!1),[bs,Et]=o.useState([]),[It,Tt]=o.useState([]),[O,rt]=o.useState(vt),[it,xs]=o.useState(""),[Rt,Lt]=o.useState(!1),[re,Ot]=o.useState(null),[zt,Dt]=o.useState(!1),[$t,Bt]=o.useState(!1),ot=o.useRef(!1),[qe,_t]=o.useState(4),Kt=o.useRef(4),Ut=o.useRef(!1),Gt=o.useRef(!1),[vs,Ae]=o.useState(!1),[,ct]=o.useState(null),[W,qt]=o.useState(null),[We,Ve]=o.useState(!1),[dt,fs]=o.useState("both"),[mt,js]=o.useState(!0),Wt=o.useRef(null),{status:ys,capabilities:ks,loading:Ns,error:Cs,refresh:Vt}=qa({projectId:h,enabled:y==="memory"});o.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const t=window.matchMedia(ls);if(!t)return;const s=l=>{I(l?l.matches:t.matches)};return s(),typeof t.addEventListener=="function"?(t.addEventListener("change",s),()=>t.removeEventListener("change",s)):(t.addListener(s),()=>t.removeListener(s))},[]),o.useEffect(()=>{Promise.all([Qt(h),la(h)]).then(([t,s])=>{d(t),Ye(t),Qe(s),Je(s),fe(!1)}).catch(t=>{m(M(t),"error"),fe(!1)})},[m,h]),o.useEffect(()=>{if(y!=="scheduling"||Ut.current)return;let t=!1;return na().then(s=>{t||(Gt.current||_t(s.globalMaxConcurrent),Kt.current=s.globalMaxConcurrent,Ut.current=!0)}).catch(()=>{}),()=>{t=!0}},[y]),o.useEffect(()=>{let t=!1;return ra().then(s=>{t||typeof s.version=="string"&&s.version.trim().length>0&&Y(s.version)}).catch(()=>{}),()=>{t=!0}},[]);const Z=o.useCallback(async()=>{try{const{providers:t}=await Jt();u(t),Ce(s=>{const l={};for(const[n,r]of Object.entries(s)){const i=t.find(p=>p.id===n);i&&!i.authenticated&&(l[n]=r)}return Object.keys(l).length===Object.keys(s).length?s:l})}catch{}},[]);o.useEffect(()=>{(y==="global-models"||y==="project-models")&&(Nt(!0),ia().then(t=>{kt(t.models),Xe(t.favoriteProviders),et(t.favoriteModels)}).catch(()=>kt([])).finally(()=>Nt(!1)))},[y]),o.useEffect(()=>{y==="backups"&&(Ke(!0),Zt(h).then(t=>tt(t)).catch(()=>tt(null)).finally(()=>Ke(!1)))},[y,h]);const be=o.useCallback(async()=>{const[t,s]=await Promise.allSettled([oa(h),ca(h)]);t.status==="fulfilled"&&d(l=>({...l,...t.value.settings})),s.status==="fulfilled"&&St(s.value)},[h]);o.useEffect(()=>{y==="remote"&&be().catch(()=>{St(null)})},[y,be]),o.useEffect(()=>{y==="worktrees"&&da(h).then(t=>Et(t)).catch(()=>Et([]))},[y,h]),o.useEffect(()=>{if(y!=="memory"||ne)return;if(ot.current){ot.current=!1;return}let t=!1;return At(!0),Xt(h).then(async({files:s})=>{if(t)return;Tt(s);const l=s.some(r=>r.path===O)?O:s.find(r=>r.path===vt)?.path??s.find(r=>r.layer==="dreams")?.path??s[0]?.path??vt;rt(l);const{content:n}=await ma(l,h);t||(Ge(n),Fe(!1))}).catch(s=>{t||(m(M(s)||"Failed to load project memory","error"),Ge(""))}).finally(()=>{t||At(!1)}),()=>{t=!0}},[y,ne,O,h,m]),o.useEffect(()=>(y==="authentication"&&(C(!0),Z().finally(()=>C(!1))),()=>{me.current&&(clearInterval(me.current),me.current=null)}),[y,Z]);const ws=o.useCallback(async t=>{g(t),Ce(s=>{if(!(t in s))return s;const l={...s};return delete l[t],l});try{const{url:s,instructions:l}=await ua(t);l?.trim()&&Ce(n=>({...n,[t]:l})),window.open(ha(s),"_blank"),me.current=setInterval(async()=>{try{const{providers:n}=await Jt();u(n),n.find(i=>i.id===t)?.authenticated&&(me.current&&(clearInterval(me.current),me.current=null),g(null),Ce(i=>{if(!(t in i))return i;const p={...i};return delete p[t],p}),m("Login successful","success"))}catch{}},2e3)}catch(s){m(M(s)||"Login failed","error"),g(null),Ce(l=>{if(!(t in l))return l;const n={...l};return delete n[t],n})}},[m]),Ss=o.useCallback(async t=>{g(t);try{await pa(t),await Z(),m("Logged out","success")}catch(s){m(M(s)||"Logout failed","error")}finally{g(null)}},[m,Z]),Ht=o.useCallback(async t=>{const s=we[t]?.trim();if(!s){Be(l=>({...l,[t]:"API key is required"}));return}g(t),Be(l=>{const n={...l};return delete n[t],n});try{await ga(t,s),De(l=>{const n={...l};return delete n[t],n}),await Z(),m("API key saved","success")}catch(l){Be(n=>({...n,[t]:M(l)||"Failed to save API key"}))}finally{g(null)}},[we,m,Z]),Ps=o.useCallback(async t=>{g(t);try{await ba(t),De(s=>{const l={...s};return delete l[t],l}),Be(s=>{const l={...s};return delete l[t],l}),await Z(),m("API key cleared","success")}catch(s){m(M(s)||"Failed to clear API key","error")}finally{g(null)}},[m,Z]),Ms=o.useCallback(async()=>{if(!(!a.ntfyEnabled||!a.ntfyTopic||!/^[a-zA-Z0-9_-]{1,64}$/.test(a.ntfyTopic))){wt(!0);try{const t=a.ntfyBaseUrl?.trim();(await xa({ntfyEnabled:a.ntfyEnabled,ntfyTopic:a.ntfyTopic,...t?{ntfyBaseUrl:t}:{}},h)).success?m("Test notification sent — check your ntfy app!","success"):m("Failed to send test notification","error")}catch(t){m(M(t)||"Failed to send test notification","error")}finally{wt(!1)}}},[m,a.ntfyBaseUrl,a.ntfyEnabled,a.ntfyTopic,h]),Fs=o.useCallback(async()=>{Ke(!0);try{const t=await va(h);if(t.success){m("Backup created successfully","success");const s=await Zt(h);tt(s)}else m(t.error||"Failed to create backup","error")}catch(t){m(M(t)||"Failed to create backup","error")}finally{Ke(!1)}},[m,h]),As=o.useCallback(async()=>{try{const t=le==="global"?"global":le==="project"?"project":"both",s=await fa(t,h),l=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),n=URL.createObjectURL(l),r=document.createElement("a"),i=`fusion-settings-${new Date().toISOString().replace(/[:.]/g,"-").slice(0,19)}.json`;r.href=n,r.download=i,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n),m(`Settings exported (${t==="global"?"global":t==="project"?"project":"all"} scope)`,"success")}catch(t){m(M(t)||"Failed to export settings","error")}},[m,le,h]),Es=o.useCallback(async t=>{const s=t.target.files?.[0];if(s){ct(s),Ve(!0);try{const l=await s.text(),n=JSON.parse(l);qt(n),Ae(!0)}catch(l){m(`Invalid JSON file: ${M(l)}`,"error"),ct(null)}finally{Ve(!1)}}},[m]),Is=o.useCallback(async()=>{if(W){Ve(!0);try{const t=await ja(W,{scope:dt,merge:mt},h);if(t.success){const s=[];t.globalCount>0&&s.push(`${t.globalCount} global`),t.projectCount>0&&s.push(`${t.projectCount} project`),m(`Imported ${s.join(", ")} setting(s)`,"success"),Ae(!1),qt(null),ct(null);const l=await Qt(h);d(l)}else m(t.error||"Import failed","error")}catch(t){m(M(t)||"Failed to import settings","error")}finally{Ve(!1)}}},[m,W,dt,mt,h]),X=o.useCallback(async t=>{const s=R,n=s.includes(t)?s.filter(r=>r!==t):[t,...s];Xe(n);try{await bt({favoriteProviders:n,favoriteModels:L})}catch{Xe(s)}},[R,L]),ee=o.useCallback(async t=>{const s=L,n=s.includes(t)?s.filter(r=>r!==t):[t,...s];et(n);try{await bt({favoriteProviders:R,favoriteModels:n})}catch{et(s)}},[L,R]);o.useEffect(()=>{const t=s=>{s.key==="Escape"&&b()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[b]);const Ts=o.useCallback(t=>{t.target===t.currentTarget&&b()},[b]),Yt=[{laneId:"default",label:"Default Model",globalProviderKey:"defaultProvider",globalModelKey:"defaultModelId",projectProviderKey:"defaultProviderOverride",projectModelKey:"defaultModelIdOverride",helperText:"Default AI model used for task execution when no per-task override is set.",fallbackOrder:"Project override → Global default lane → Automatic resolution"},{laneId:"execution",label:"Execution Model",globalProviderKey:"executionGlobalProvider",globalModelKey:"executionGlobalModelId",projectProviderKey:"executionProvider",projectModelKey:"executionModelId",helperText:"AI model used for task implementation (executor agent).",fallbackOrder:"Project override → Global execution lane → Global default lane → Automatic resolution"},{laneId:"planning",label:"Planning Model",globalProviderKey:"planningGlobalProvider",globalModelKey:"planningGlobalModelId",projectProviderKey:"planningProvider",projectModelKey:"planningModelId",helperText:"AI model used for task specification (triage).",fallbackOrder:"Project override → Global planning lane → Global default lane → Automatic resolution"},{laneId:"validator",label:"Validator Model",globalProviderKey:"validatorGlobalProvider",globalModelKey:"validatorGlobalModelId",projectProviderKey:"validatorProvider",projectModelKey:"validatorModelId",helperText:"AI model used for code and specification review.",fallbackOrder:"Project override → Global validator lane → Global default lane → Automatic resolution"},{laneId:"summarization",label:"Title Summarization Model",globalProviderKey:"titleSummarizerGlobalProvider",globalModelKey:"titleSummarizerGlobalModelId",projectProviderKey:"titleSummarizerProvider",projectModelKey:"titleSummarizerModelId",helperText:"AI model used for auto-generating task titles from descriptions.",fallbackOrder:"Project override → Global summarization lane → Global planning lane → Global default lane → Automatic resolution"}];function ut(t){if(!oe?.project)return"inherited";const s=oe.project[t.projectProviderKey],l=oe.project[t.projectModelKey];return s!==void 0||l!==void 0?"overridden":"inherited"}function Rs(t){const s=a[t.projectProviderKey],l=a[t.projectModelKey];return s&&l?`${s}/${l}`:""}function Ls(t,s){if(s){const l=s.indexOf("/");d(n=>({...n,[t.projectProviderKey]:s.slice(0,l),[t.projectModelKey]:s.slice(l+1)}))}else{if(ut(t)==="inherited")return;d(n=>({...n,[t.projectProviderKey]:void 0,[t.projectModelKey]:void 0}))}}function Os(t){ut(t)!=="inherited"&&d(l=>({...l,[t.projectProviderKey]:void 0,[t.projectModelKey]:void 0}))}const zs=o.useCallback(t=>{Q(t),ye(".")},[ye]),ie=o.useCallback(()=>{Q(null)},[]),ht=o.useCallback(t=>{$!==null&&(d(s=>{const l=s.overlapIgnorePaths&&s.overlapIgnorePaths.length>0?[...s.overlapIgnorePaths]:[""];return l[$]=t,{...s,overlapIgnorePaths:l}}),ie())},[$,ie]),Ds=o.useCallback(()=>{if(K===".")return;const t=K.endsWith("/")?K:`${K}/`;ht(t)},[K,ht]),$s=o.useCallback(t=>{t.target===t.currentTarget&&ie()},[ie]),Bs=o.useCallback((t,s)=>{d(l=>{const n=l.overlapIgnorePaths&&l.overlapIgnorePaths.length>0?[...l.overlapIgnorePaths]:[""];return n[t]=s,{...l,overlapIgnorePaths:n}})},[]),_s=o.useCallback(t=>{if(d(s=>{const n=(s.overlapIgnorePaths&&s.overlapIgnorePaths.length>0?[...s.overlapIgnorePaths]:[""]).filter((r,i)=>i!==t);return{...s,overlapIgnorePaths:n.length>0?n:[]}}),$===t){ie();return}$!==null&&$>t&&Q($-1)},[$,ie]),Ks=o.useCallback(()=>{d(t=>{const s=t.overlapIgnorePaths&&t.overlapIgnorePaths.length>0?t.overlapIgnorePaths:[""];return{...t,overlapIgnorePaths:[...s,""]}})},[]),Us=o.useCallback(async()=>{if(!(ce||P))try{const t={...a,worktreeInitCommand:a.worktreeInitCommand?.trim()||void 0,taskPrefix:a.taskPrefix?.trim()||void 0,overlapIgnorePaths:(a.overlapIgnorePaths??[]).map(n=>n.trim()).filter(n=>n.length>0),experimentalFeatures:nl(a.experimentalFeatures)},s={};for(const[n,r]of Object.entries(t))if(ya(n)){const i=ae?.[n];r===void 0&&i!==void 0?s[n]=null:s[n]=r}const l={};for(const[n,r]of Object.entries(t)){if(n==="githubTokenConfigured"||n==="prAuthAvailable"||!ka(n))continue;const i=Ie?.project?.[n];["planningProvider","planningModelId","validatorProvider","validatorModelId","executionProvider","executionModelId","titleSummarizerProvider","titleSummarizerModelId","defaultProviderOverride","defaultModelIdOverride","planningFallbackProvider","planningFallbackModelId","validatorFallbackProvider","validatorFallbackModelId","titleSummarizerFallbackProvider","titleSummarizerFallbackModelId"].includes(n)?r!==i&&(r==null&&i!==void 0&&i!==null?l[n]=null:r!==void 0&&(l[n]=r)):l[n]=r}await Promise.all([Object.keys(s).length>0?bt(s):Promise.resolve(),Object.keys(l).length>0?Na(l,h):Promise.resolve(),qe!==Kt.current?Ca({globalMaxConcurrent:qe??4}):Promise.resolve()]),m("Settings saved","success"),b()}catch(t){m(M(t),"error")}},[a,qe,ce,P,ae,Ie,b,m,h]),Gs=o.useCallback(async()=>{try{await wa(O,nt,h),Fe(!1),m("Memory saved","success")}catch(t){m(M(t)||"Failed to save memory","error")}},[O,nt,h,m]),qs=o.useCallback(async()=>{Dt(!0);try{const{path:t,content:s}=await Sa(O,h),l=t??O;O!==l&&(ot.current=!0),rt(l),Ge(s),Fe(!1);const{files:n}=await Xt(h);Tt(n),m("Memory file compacted","success")}catch(t){m(M(t)||"Failed to compact memory","error")}finally{Dt(!1)}},[O,h,m]),Ws=o.useCallback(async()=>{Lt(!0),Ot(null);try{const t=await Pa(it,h);Ot(t),m(t.qmdAvailable?"Memory retrieval test complete":"qmd is not installed; local fallback was used",t.qmdAvailable?"success":"warning")}catch(t){m(M(t)||"Failed to test memory retrieval","error")}finally{Lt(!1)}},[it,h,m]),Vs=o.useCallback(async()=>{Bt(!0);try{const t=await Ma(h);await Vt(),m(t.qmdAvailable?"qmd installed successfully":"qmd install finished, but qmd is still unavailable",t.qmdAvailable?"success":"warning")}catch(t){m(M(t)||"Failed to install qmd","error")}finally{Bt(!1)}},[h,Vt,m]),Hs=()=>{if(!P)return;const t=P.name.trim();if(!t){m("Preset name is required","error");return}const s=a.modelPresets||[];let l;Se?l=Se:l=Ga(t,s);const n={id:l,name:t,executorProvider:P.executorProvider,executorModelId:P.executorModelId,validatorProvider:P.validatorProvider,validatorModelId:P.validatorModelId};d(r=>{const i=r.modelPresets||[],p=Se?i.map(f=>f.id===Se?n:f):[...i,n];return{...r,modelPresets:p}}),Pe(null),G(null)},Ys=o.useCallback(async()=>{const t={remoteActiveProvider:a.remoteActiveProvider??null,remoteTailscaleEnabled:!!a.remoteTailscaleEnabled,remoteTailscaleHostname:String(a.remoteTailscaleHostname??""),remoteTailscaleTargetPort:Number(a.remoteTailscaleTargetPort??4040),remoteTailscaleAcceptRoutes:!!a.remoteTailscaleAcceptRoutes,remoteCloudflareEnabled:!!a.remoteCloudflareEnabled,remoteCloudflareTunnelName:String(a.remoteCloudflareTunnelName??""),remoteCloudflareTunnelToken:a.remoteCloudflareTunnelToken||null,remoteCloudflareIngressUrl:String(a.remoteCloudflareIngressUrl??""),remoteShortLivedEnabled:!!a.remoteShortLivedEnabled,remoteShortLivedTtlMs:Number(a.remoteShortLivedTtlMs??9e5),remoteRememberLastRunning:!!a.remoteRememberLastRunning};Ue("save");try{await Fa(t,h),m("Remote settings saved","success"),await be()}catch(s){m(M(s)||"Failed to save remote settings","error")}finally{Ue(null)}},[a,h,be,m]),he=o.useCallback(async(t,s)=>{Ue(t);try{await s(),await be()}catch(l){m(M(l)||`Failed to ${t}`,"error")}finally{Ue(null)}},[m,be]),E=()=>le==="global"?e.jsxs("div",{className:"settings-scope-banner settings-scope-global",children:[e.jsx("span",{className:"settings-scope-icon",children:e.jsx(ft,{size:14})}),e.jsx("span",{children:"These settings are shared across all your Fusion projects."})]}):le==="project"?e.jsxs("div",{className:"settings-scope-banner settings-scope-project",children:[e.jsx("span",{className:"settings-scope-icon",children:e.jsx(es,{size:14})}),e.jsx("span",{children:"These settings only affect this project."})]}):null,Qs=()=>{switch(y){case"general":return e.jsxs(e.Fragment,{children:[E(),e.jsx("h4",{className:"settings-section-heading",children:"General"}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"taskPrefix",children:"Task Prefix"}),e.jsx("input",{id:"taskPrefix",type:"text",placeholder:"FN",value:a.taskPrefix||"",onChange:t=>{const s=t.target.value;d(l=>({...l,taskPrefix:s||void 0})),s&&!/^[A-Z]{1,10}$/.test(s)?Re("Prefix must be 1–10 uppercase letters"):Re(null)}}),ce&&e.jsx("small",{className:"field-error",children:ce}),!ce&&e.jsx("small",{children:"Prefix for new task IDs (e.g. KB, PROJ)"})]}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"requirePlanApproval",className:"checkbox-label",children:[e.jsx("input",{id:"requirePlanApproval",type:"checkbox",checked:a.requirePlanApproval||!1,onChange:t=>d(s=>({...s,requirePlanApproval:t.target.checked}))}),"Require plan approval"]}),e.jsx("small",{children:"When enabled, AI-generated task specifications require manual approval before moving to Todo"})]}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"showQuickChatFAB",className:"checkbox-label",children:[e.jsx("input",{id:"showQuickChatFAB",type:"checkbox",checked:a.showQuickChatFAB===!0,onChange:t=>d(s=>({...s,showQuickChatFAB:t.target.checked}))}),"Show quick chat button"]}),e.jsx("small",{children:"Show the floating chat button in the dashboard. Chat is still accessible from the Chat tab in the mobile navigation."})]})]});case"global-models":{const t=a.defaultProvider&&a.defaultModelId?`${a.defaultProvider}/${a.defaultModelId}`:"",s=Yt.filter(l=>l.laneId!=="default");return e.jsxs(e.Fragment,{children:[E(),e.jsx("h4",{className:"settings-section-heading",children:"Default Model"}),_e?e.jsx("div",{className:"settings-empty-state",children:"Loading available models…"}):A.length===0?e.jsx("div",{className:"settings-empty-state settings-muted",children:"No models available. Configure authentication first."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"defaultModel",children:"Default Model"}),e.jsx(te,{id:"defaultModel",label:"Default Model",models:A,value:t,onChange:l=>{if(!l)d(n=>({...n,defaultProvider:void 0,defaultModelId:void 0}));else{const n=l.indexOf("/");d(r=>({...r,defaultProvider:l.slice(0,n),defaultModelId:l.slice(n+1)}))}},placeholder:"Use default",favoriteProviders:R,onToggleFavorite:X,favoriteModels:L,onToggleModelFavorite:ee}),e.jsx("small",{children:'Default AI model used for task execution when no per-task override is set. "Use default" lets the engine choose automatically.'})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"fallbackModel",children:"Fallback Model"}),e.jsx(te,{id:"fallbackModel",label:"Fallback Model",models:A,value:a.fallbackProvider&&a.fallbackModelId?`${a.fallbackProvider}/${a.fallbackModelId}`:"",onChange:l=>{if(!l)d(n=>({...n,fallbackProvider:void 0,fallbackModelId:void 0}));else{const n=l.indexOf("/");d(r=>({...r,fallbackProvider:l.slice(0,n),fallbackModelId:l.slice(n+1)}))}},placeholder:"No fallback",favoriteProviders:R,onToggleFavorite:X,favoriteModels:L,onToggleModelFavorite:ee}),e.jsx("small",{children:"Used automatically if the primary default model hits a retryable provider error like rate limiting or overload."})]})]}),(()=>{const l=A.find(n=>n.provider===a.defaultProvider&&n.id===a.defaultModelId);return l&&!l.reasoning?null:e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"defaultThinkingLevel",children:"Thinking Effort"}),e.jsxs("select",{id:"defaultThinkingLevel",value:a.defaultThinkingLevel||"",onChange:n=>{const r=n.target.value;d(i=>({...i,defaultThinkingLevel:r||void 0}))},children:[e.jsx("option",{value:"",children:"Default"}),Ua.map(n=>e.jsx("option",{value:n,children:n.charAt(0).toUpperCase()+n.slice(1)},n))]}),e.jsx("small",{children:"Controls how much reasoning effort the AI model uses. Higher levels produce better results but cost more."})]})})(),A.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{className:"settings-section-heading settings-section-heading--spaced",children:"Model Lanes"}),e.jsx("p",{className:"settings-description",children:"Global baseline models for each AI role. Project settings can override these per-project."}),s.map(l=>{const n=a[l.globalProviderKey],r=a[l.globalModelKey],i=n&&r?`${n}/${r}`:"";return e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:`global-${l.laneId}-model`,children:l.label}),e.jsx(te,{id:`global-${l.laneId}-model`,label:l.label,models:A,value:i,onChange:p=>{if(!p){d(N=>({...N,[l.globalProviderKey]:void 0,[l.globalModelKey]:void 0}));return}const f=p.indexOf("/");d(N=>({...N,[l.globalProviderKey]:p.slice(0,f),[l.globalModelKey]:p.slice(f+1)}))},placeholder:"Use default",favoriteProviders:R,onToggleFavorite:X,favoriteModels:L,onToggleModelFavorite:ee}),e.jsx("small",{children:l.helperText})]},`global-${l.laneId}`)})]}),e.jsx("h4",{className:"settings-section-heading settings-section-heading--spaced",children:"OpenRouter Models"}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"openrouterModelSync",className:"checkbox-label",children:[e.jsx("input",{id:"openrouterModelSync",type:"checkbox",checked:a.openrouterModelSync!==!1,onChange:l=>d(n=>({...n,openrouterModelSync:l.target.checked}))}),"Sync OpenRouter model list at dashboard startup"]}),e.jsx("small",{children:"When enabled, the dashboard fetches the latest available models from the OpenRouter API on startup, so the model picker always shows the most up-to-date catalog. Disable to skip the initial API call and use only the built-in model list."})]})]})}case"project-models":{const t=a.modelPresets||[],s=t.map(r=>({id:r.id,name:r.name})),l=new Set(Object.values(a.defaultPresetBySize||{}).filter(Boolean)),n=Yt.filter(r=>r.laneId==="execution"||r.laneId==="planning"||r.laneId==="validator"||r.laneId==="summarization");return e.jsxs(e.Fragment,{children:[E(),e.jsx("h4",{className:"settings-section-heading",children:"Token Cap"}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"tokenCap",children:"Token Cap"}),e.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[e.jsx("input",{id:"tokenCap",type:"number",placeholder:"No cap",value:a.tokenCap??"",onChange:r=>{const i=r.target.value;d(p=>({...p,tokenCap:i?parseInt(i,10):null}))}}),a.tokenCap!=null&&e.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",title:"Reset to default (no cap)",onClick:()=>d(r=>({...r,tokenCap:null})),style:{whiteSpace:"nowrap"},children:"Reset"})]}),e.jsx("small",{children:"Automatically compact context when approaching this token count. Leave empty for no cap (compact only on overflow errors). Set a number to proactively compact when reaching this token count."})]}),e.jsx("h4",{className:"settings-section-heading settings-section-heading--spaced",children:"Model Lanes"}),e.jsx("p",{className:"settings-description",children:"Override global model settings at the project level. Each lane controls a specific AI usage context. Unset lanes inherit from the corresponding global lane."}),_e?e.jsx("div",{className:"settings-empty-state",children:"Loading available models…"}):A.length===0?e.jsx("div",{className:"settings-empty-state settings-muted",children:"No models available. Configure authentication first."}):e.jsx(e.Fragment,{children:n.map(r=>{const i=ut(r),p=Rs(r),f=i==="overridden";return e.jsxs("div",{className:"form-group",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.25rem"},children:[e.jsx("label",{htmlFor:`${r.laneId}Model`,children:r.label}),e.jsx("span",{className:`settings-lane-badge ${f?"settings-lane-badge--override":"settings-lane-badge--inherited"}`,title:f?"Explicitly set for this project":"Inherited from global settings",children:f?"Override (Project)":"Inherited (Global)"})]}),e.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[e.jsx("div",{style:{flex:1},children:e.jsx(te,{id:`${r.laneId}Model`,label:r.label,models:A,value:p,onChange:N=>Ls(r,N),placeholder:"Use global",favoriteProviders:R,onToggleFavorite:X,favoriteModels:L,onToggleModelFavorite:ee})}),f&&e.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",title:"Reset to inherit from global",onClick:()=>Os(r),style:{whiteSpace:"nowrap"},children:"Reset"})]}),e.jsxs("small",{children:[r.helperText," Falls back to: ",r.fallbackOrder,"."]})]},r.laneId)})}),e.jsx("h4",{className:"settings-section-heading settings-section-heading--spaced",children:"Fallback Models"}),_e?e.jsx("div",{className:"settings-empty-state",children:"Loading available models…"}):A.length===0?e.jsx("div",{className:"settings-empty-state settings-muted",children:"No models available."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"planningFallbackModel",children:"Planning Fallback Model"}),e.jsx(te,{id:"planningFallbackModel",label:"Planning Fallback Model",models:A,value:a.planningFallbackProvider&&a.planningFallbackModelId?`${a.planningFallbackProvider}/${a.planningFallbackModelId}`:"",onChange:r=>{if(!r)d(i=>({...i,planningFallbackProvider:void 0,planningFallbackModelId:void 0}));else{const i=r.indexOf("/");d(p=>({...p,planningFallbackProvider:r.slice(0,i),planningFallbackModelId:r.slice(i+1)}))}},placeholder:"Use global fallback",favoriteProviders:R,onToggleFavorite:X,favoriteModels:L,onToggleModelFavorite:ee}),e.jsx("small",{children:"Used if the planning model fails due to rate limits or provider overload. Defaults to the global fallback model."})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"validatorFallbackModel",children:"Validator Fallback Model"}),e.jsx(te,{id:"validatorFallbackModel",label:"Validator Fallback Model",models:A,value:a.validatorFallbackProvider&&a.validatorFallbackModelId?`${a.validatorFallbackProvider}/${a.validatorFallbackModelId}`:"",onChange:r=>{if(!r)d(i=>({...i,validatorFallbackProvider:void 0,validatorFallbackModelId:void 0}));else{const i=r.indexOf("/");d(p=>({...p,validatorFallbackProvider:r.slice(0,i),validatorFallbackModelId:r.slice(i+1)}))}},placeholder:"Use global fallback",favoriteProviders:R,onToggleFavorite:X,favoriteModels:L,onToggleModelFavorite:ee}),e.jsx("small",{children:"Used if the validator model fails due to rate limits or provider overload. Defaults to the global fallback model."})]})]}),e.jsx("h4",{className:"settings-section-heading settings-section-heading--spaced",children:"Model Presets"}),e.jsxs("div",{className:"form-group settings-model-presets",children:[e.jsx("label",{children:"Configured presets"}),t.length===0?e.jsx("div",{className:"settings-empty-state settings-muted",children:"No presets configured yet."}):e.jsx("div",{className:"settings-preset-list",children:t.map(r=>{const i=Ka(r),p=`${i.executorValue||"default"} / ${i.validatorValue||"default"}`;return e.jsxs("div",{className:"settings-preset-item",children:[e.jsxs("div",{className:"settings-preset-item-meta",children:[e.jsx("strong",{children:r.name}),e.jsx("span",{className:"settings-muted settings-preset-summary",children:p})]}),e.jsxs("div",{className:"settings-preset-item-actions",children:[e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>{Pe(r.id),G({...r})},children:"Edit"}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>{l.has(r.id)&&!confirm(`Preset "${r.name}" is used in auto-selection. Delete it anyway?`)||(d(f=>({...f,modelPresets:(f.modelPresets||[]).filter(N=>N.id!==r.id),defaultPresetBySize:Object.fromEntries(Object.entries(f.defaultPresetBySize||{}).filter(([,N])=>N!==r.id))})),Se===r.id&&(Pe(null),G(null)))},children:"Delete"})]})]},r.id)})}),P?null:e.jsx("div",{className:"settings-preset-actions",children:e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>{Pe(null),G({id:"",name:"",executorProvider:void 0,executorModelId:void 0,validatorProvider:void 0,validatorModelId:void 0})},children:"Add Preset"})})]}),P?e.jsxs("div",{className:"form-group settings-preset-editor",children:[e.jsx("label",{children:"Preset editor"}),e.jsxs("div",{className:"settings-preset-editor-fields",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"preset-name",children:"Name"}),e.jsx("input",{id:"preset-name",type:"text",value:P.name,onChange:r=>{const i=r.target.value;G(p=>p&&{...p,name:i})}})]}),A.length===0?e.jsx("small",{children:"No models available. Configure authentication first."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"preset-executor-model",children:"Executor model"}),e.jsx(te,{id:"preset-executor-model",label:"Preset executor model",models:A,value:P.executorProvider&&P.executorModelId?`${P.executorProvider}/${P.executorModelId}`:"",onChange:r=>{if(!r){G(p=>p&&{...p,executorProvider:void 0,executorModelId:void 0});return}const i=r.indexOf("/");G(p=>p&&{...p,executorProvider:r.slice(0,i),executorModelId:r.slice(i+1)})},placeholder:"Use default",favoriteProviders:R,onToggleFavorite:X,favoriteModels:L,onToggleModelFavorite:ee})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"preset-validator-model",children:"Validator model"}),e.jsx(te,{id:"preset-validator-model",label:"Preset validator model",models:A,value:P.validatorProvider&&P.validatorModelId?`${P.validatorProvider}/${P.validatorModelId}`:"",onChange:r=>{if(!r){G(p=>p&&{...p,validatorProvider:void 0,validatorModelId:void 0});return}const i=r.indexOf("/");G(p=>p&&{...p,validatorProvider:r.slice(0,i),validatorModelId:r.slice(i+1)})},placeholder:"Use default",favoriteProviders:R,onToggleFavorite:X,favoriteModels:L,onToggleModelFavorite:ee})]})]})]}),e.jsxs("div",{className:"modal-actions settings-preset-editor-actions",children:[e.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:Hs,children:"Save preset"}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>{Pe(null),G(null)},children:"Cancel"})]})]}):null,e.jsx("div",{className:"form-group settings-preset-auto-select",children:e.jsxs("label",{htmlFor:"autoSelectModelPreset",className:"checkbox-label",children:[e.jsx("input",{id:"autoSelectModelPreset",type:"checkbox",checked:a.autoSelectModelPreset||!1,onChange:r=>d(i=>({...i,autoSelectModelPreset:r.target.checked}))}),"Auto-select preset based on task size"]})}),a.autoSelectModelPreset?e.jsx("div",{className:"settings-preset-size-grid",children:["S","M","L"].map(r=>e.jsxs("div",{className:"form-group settings-preset-size-row",children:[e.jsx("label",{htmlFor:`preset-size-${r}`,children:r==="S"?"Small tasks (S):":r==="M"?"Medium tasks (M):":"Large tasks (L):"}),e.jsxs("select",{id:`preset-size-${r}`,value:a.defaultPresetBySize?.[r]||"",onChange:i=>{const p=i.target.value||void 0;d(f=>({...f,defaultPresetBySize:{...f.defaultPresetBySize||{},[r]:p}}))},children:[e.jsx("option",{value:"",children:"No preset"}),s.map(i=>e.jsx("option",{value:i.id,children:i.name},i.id))]})]},r))}):null,e.jsx("h4",{className:"settings-section-heading settings-section-heading--spaced",children:"AI Summarization"}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"autoSummarizeTitles",className:"checkbox-label",children:[e.jsx("input",{id:"autoSummarizeTitles",type:"checkbox",checked:a.autoSummarizeTitles||!1,onChange:r=>d(i=>({...i,autoSummarizeTitles:r.target.checked}))}),"Auto-summarize long descriptions as titles"]}),e.jsx("small",{children:"When enabled, tasks created without a title but with descriptions over 200 characters will automatically get an AI-generated title (max 60 characters)."})]}),(a.autoSummarizeTitles||!1)&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Title summarization model"}),_e?e.jsx("small",{children:"Loading available models..."}):A.length===0?e.jsx("small",{children:"No models available. Configure authentication first."}):e.jsx(te,{id:"titleSummarizerModel",label:"Title summarization model",models:A,value:a.titleSummarizerProvider&&a.titleSummarizerModelId?`${a.titleSummarizerProvider}/${a.titleSummarizerModelId}`:"",onChange:r=>{if(!r){d(p=>({...p,titleSummarizerProvider:void 0,titleSummarizerModelId:void 0}));return}const i=r.indexOf("/");d(p=>({...p,titleSummarizerProvider:r.slice(0,i),titleSummarizerModelId:r.slice(i+1)}))},placeholder:"Use fallback model",favoriteProviders:R,onToggleFavorite:X,favoriteModels:L,onToggleModelFavorite:ee}),e.jsx("small",{children:a.titleSummarizerProvider&&a.titleSummarizerModelId?"Using explicitly configured model":a.planningProvider&&a.planningModelId?"(using planning model)":a.defaultProvider&&a.defaultModelId?"(using default model)":"(using automatic model selection)"})]}),e.jsx("div",{className:"form-group",children:e.jsxs("div",{className:"modal-actions",style:{justifyContent:"flex-start"},children:[e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>d(r=>({...r,titleSummarizerProvider:r.planningProvider,titleSummarizerModelId:r.planningModelId})),disabled:!a.planningProvider||!a.planningModelId,children:"Use planning model"}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>d(r=>({...r,titleSummarizerProvider:r.defaultProvider,titleSummarizerModelId:r.defaultModelId})),disabled:!a.defaultProvider||!a.defaultModelId,children:"Use default model"})]})})]})]})}case"appearance":return e.jsxs(e.Fragment,{children:[E(),e.jsx("h4",{className:"settings-section-heading",children:"Appearance"}),e.jsx(Za,{themeMode:T,colorTheme:k,onThemeModeChange:t=>{d(s=>({...s,themeMode:t})),w?.(t)},onColorThemeChange:t=>{d(s=>({...s,colorTheme:t})),V?.(t)}})]});case"scheduling":return e.jsxs(e.Fragment,{children:[E(),e.jsx("h4",{className:"settings-section-heading",children:"Scheduling"}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"globalMaxConcurrent",children:"Global Max Concurrent"}),e.jsx("input",{id:"globalMaxConcurrent",type:"number",min:0,max:1e4,value:qe??"",onChange:t=>{const s=t.target.value;Gt.current=!0,_t(s===""?void 0:Number(s))}}),e.jsx("small",{className:"form-text text-muted",children:"Maximum concurrent agents across all projects"})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"maxConcurrent",children:"Max Concurrent Tasks"}),e.jsx("input",{id:"maxConcurrent",type:"number",min:1,max:10,value:a.maxConcurrent??"",onChange:t=>{const s=t.target.value;d(l=>({...l,maxConcurrent:s===""?void 0:Number(s)}))}})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"maxTriageConcurrent",children:"Max Triage Concurrent"}),e.jsx("input",{id:"maxTriageConcurrent",type:"number",min:1,max:10,value:a.maxTriageConcurrent??"",onChange:t=>{const s=t.target.value;d(l=>({...l,maxTriageConcurrent:s===""?void 0:Number(s)}))}}),e.jsx("small",{children:"Maximum concurrent triage/specification agents"})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"pollIntervalMs",children:"Poll Interval (ms)"}),e.jsx("input",{id:"pollIntervalMs",type:"number",min:5e3,step:1e3,value:a.pollIntervalMs??"",onChange:t=>{const s=t.target.value;d(l=>({...l,pollIntervalMs:s===""?void 0:Number(s)}))}})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"taskStuckTimeoutMs",children:"Stuck Task Timeout (minutes)"}),e.jsx("input",{id:"taskStuckTimeoutMs",type:"number",min:1,step:1,value:a.taskStuckTimeoutMs?Math.round(a.taskStuckTimeoutMs/6e4):"",onChange:t=>{const s=t.target.value,l=Number(s);d(n=>({...n,taskStuckTimeoutMs:s&&l>0?l*6e4:void 0}))}}),e.jsx("small",{children:"Timeout in minutes for detecting stuck tasks. When a task's agent session shows no activity for longer than this duration, the task is terminated and retried. Leave empty to disable. Suggested: 10."})]}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"specStalenessEnabled",className:"checkbox-label",children:[e.jsx("input",{id:"specStalenessEnabled",type:"checkbox",checked:a.specStalenessEnabled||!1,onChange:t=>d(s=>({...s,specStalenessEnabled:t.target.checked}))}),"Enable specification staleness enforcement"]}),e.jsx("small",{children:"When enabled, tasks with stale specifications (PROMPT.md older than the threshold) are automatically sent back to triage for re-specification"})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"specStalenessMaxAgeMs",children:"Stale Spec Threshold (hours)"}),e.jsx("input",{id:"specStalenessMaxAgeMs",type:"number",min:0,step:1,value:a.specStalenessMaxAgeMs!==void 0?Math.round(a.specStalenessMaxAgeMs/36e5):"",onChange:t=>{const s=t.target.value,l=Number(s);d(n=>({...n,specStalenessMaxAgeMs:s!==""?l*36e5:void 0}))},disabled:!a.specStalenessEnabled}),e.jsx("small",{children:"Maximum age in hours before a specification is considered stale. Default: 6 hours."})]}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"autoArchiveDoneTasksEnabled",className:"checkbox-label",children:[e.jsx("input",{id:"autoArchiveDoneTasksEnabled",type:"checkbox",checked:a.autoArchiveDoneTasksEnabled??!0,onChange:t=>d(s=>({...s,autoArchiveDoneTasksEnabled:t.target.checked}))}),"Enable automatic task archiving"]}),e.jsx("small",{children:"Completed tasks older than the threshold are moved out of the active task database."})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"autoArchiveDoneAfterMs",children:"Archive Completed Tasks After (days)"}),e.jsx("input",{id:"autoArchiveDoneAfterMs",type:"number",min:1,step:1,value:a.autoArchiveDoneAfterMs!==void 0?Math.round(a.autoArchiveDoneAfterMs/rs):ll,onChange:t=>{const s=t.target.value,l=Number(s);d(n=>({...n,autoArchiveDoneAfterMs:s===""?void 0:l*rs}))},disabled:a.autoArchiveDoneTasksEnabled===!1}),e.jsx("small",{children:"Number of days a task can stay in Done before it is archived. Default: 2 days (48 hours)."})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"archiveAgentLogMode",children:"Archive Agent Log"}),e.jsxs("select",{id:"archiveAgentLogMode",value:a.archiveAgentLogMode??"compact",onChange:t=>d(s=>({...s,archiveAgentLogMode:t.target.value})),disabled:a.autoArchiveDoneTasksEnabled===!1,children:[e.jsx("option",{value:"compact",children:"Compact summary and recent entries"}),e.jsx("option",{value:"none",children:"Do not archive agent logs"}),e.jsx("option",{value:"full",children:"Full agent log"})]}),e.jsx("small",{children:"Compact mode keeps archive size low while preserving recent agent activity for context."})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"maxStuckKills",children:"Max Stuck Retries"}),e.jsx("input",{id:"maxStuckKills",type:"number",min:1,step:1,value:a.maxStuckKills??"",onChange:t=>{const s=t.target.value,l=Number(s);d(n=>({...n,maxStuckKills:s&&l>0?l:void 0}))}}),e.jsx("small",{children:"Maximum stuck-detector retries before a task is marked failed. Default: 6."})]}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"groupOverlappingFiles",className:"checkbox-label",children:[e.jsx("input",{id:"groupOverlappingFiles",type:"checkbox",checked:a.groupOverlappingFiles,onChange:t=>d(s=>({...s,groupOverlappingFiles:t.target.checked}))}),"Serialize tasks with overlapping files"]}),e.jsx("small",{children:"When enabled, tasks that modify the same files are queued serially to avoid merge conflicts"})]}),e.jsxs("div",{className:"form-group settings-overlap-ignore-group",children:[e.jsx("label",{children:"Ignored overlap paths"}),e.jsxs("small",{children:["Optional file or directory paths to ignore when overlap serialization is enabled. Paths are project-relative (for example ",e.jsx("code",{children:"docs/"})," or ",e.jsx("code",{children:"generated/*"}),")."]}),e.jsx("div",{className:"settings-overlap-ignore-list",children:(a.overlapIgnorePaths&&a.overlapIgnorePaths.length>0?a.overlapIgnorePaths:[""]).map((t,s)=>e.jsxs("div",{className:"settings-overlap-ignore-row",children:[e.jsxs("div",{className:"settings-overlap-ignore-path-controls",children:[e.jsx("input",{type:"text",value:t,placeholder:"docs/",onChange:l=>Bs(s,l.target.value)}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>zs(s),"aria-label":`Browse path for ignored overlap entry ${s+1}`,children:"Browse"})]}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>_s(s),disabled:(a.overlapIgnorePaths??[]).length===0&&s===0,children:"Remove"})]},`overlap-ignore-${s}`))}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:Ks,children:"Add ignored path"})]}),e.jsx("div",{className:"settings-section-divider"}),e.jsx("h5",{className:"settings-section-heading",children:"Step Execution"}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"runStepsInNewSessions",className:"checkbox-label",children:[e.jsx("input",{id:"runStepsInNewSessions",type:"checkbox",checked:a.runStepsInNewSessions||!1,onChange:t=>d(s=>({...s,runStepsInNewSessions:t.target.checked}))}),"Run each step in a new session"]}),e.jsx("small",{children:"Run each task step in its own fresh agent session for better isolation and error recovery. Failed steps can be retried individually."})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"maxParallelSteps",children:"Maximum parallel steps"}),e.jsx("input",{id:"maxParallelSteps",type:"number",min:1,max:4,value:a.maxParallelSteps??"",onChange:t=>{const s=t.target.value;d(l=>({...l,maxParallelSteps:s===""?void 0:Number(s)}))},disabled:!a.runStepsInNewSessions}),e.jsx("small",{children:"Maximum number of steps to run in parallel when file scopes don't overlap (1-4)"})]})]});case"worktrees":return e.jsxs(e.Fragment,{children:[E(),e.jsx("h4",{className:"settings-section-heading",children:"Worktrees"}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"maxWorktrees",children:"Max Worktrees"}),e.jsx("input",{id:"maxWorktrees",type:"number",min:1,max:20,value:a.maxWorktrees??"",onChange:t=>{const s=t.target.value;d(l=>({...l,maxWorktrees:s===""?void 0:Number(s)}))}}),e.jsx("small",{children:"Limits total git worktrees including in-review tasks"})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"worktreeInitCommand",children:"Worktree Init Command"}),e.jsx("input",{id:"worktreeInitCommand",type:"text",placeholder:"pnpm install --frozen-lockfile",value:a.worktreeInitCommand||"",onChange:t=>d(s=>({...s,worktreeInitCommand:t.target.value}))}),e.jsx("small",{children:"Shell command to run in each new worktree after creation"})]}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"recycleWorktrees",className:"checkbox-label",children:[e.jsx("input",{id:"recycleWorktrees",type:"checkbox",checked:a.recycleWorktrees,onChange:t=>d(s=>({...s,recycleWorktrees:t.target.checked}))}),"Recycle worktrees"]}),e.jsx("small",{children:"When enabled, completed task worktrees are returned to an idle pool instead of being deleted, preserving build caches for faster startup"})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"worktreeNaming",children:"Worktree Naming Style"}),e.jsxs("select",{id:"worktreeNaming",value:a.worktreeNaming||"random",onChange:t=>d(s=>({...s,worktreeNaming:t.target.value})),disabled:a.recycleWorktrees,children:[e.jsx("option",{value:"random",children:"Random names (e.g., swift-falcon)"}),e.jsx("option",{value:"task-id",children:"Task ID (e.g., FN-042)"}),e.jsx("option",{value:"task-title",children:"Task title (e.g., fix-login-bug)"})]}),e.jsx("small",{children:a.recycleWorktrees?"Naming style is not applicable when recycling worktrees — pooled worktrees retain their existing names":"How to name fresh worktree directories. Only applies when recycling is off."})]}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"worktreeRebaseBeforeMerge",className:"checkbox-label",children:[e.jsx("input",{id:"worktreeRebaseBeforeMerge",type:"checkbox",checked:a.worktreeRebaseBeforeMerge!==!1,onChange:t=>d(s=>({...s,worktreeRebaseBeforeMerge:t.target.checked}))}),"Rebase from remote before merge"]}),e.jsx("small",{children:"When enabled, the merger fetches from the configured remote and rebases the task branch onto the latest default-branch tip before merging — catching concurrent pushes from other collaborators or fusion workers. Any conflicts the rebase surfaces flow into the existing smart/AI resolve pipeline."})]}),a.worktreeRebaseBeforeMerge!==!1&&e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"worktreeRebaseRemote",children:"Rebase Remote"}),e.jsxs("select",{id:"worktreeRebaseRemote",value:a.worktreeRebaseRemote??"",onChange:t=>d(s=>({...s,worktreeRebaseRemote:t.target.value||void 0})),children:[e.jsx("option",{value:"",children:"Use git default"}),bs.map(t=>e.jsxs("option",{value:t.name,children:[t.name," (",t.fetchUrl,")"]},t.name))]}),e.jsxs("small",{children:['Which remote to fetch for the pre-merge rebase. "Use git default" falls back to the remote configured for the default branch (typically ',e.jsx("code",{children:"origin"}),")."]})]})]});case"commands":return e.jsxs(e.Fragment,{children:[E(),e.jsx("h4",{className:"settings-section-heading",children:"Commands"}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"testCommand",children:"Test Command"}),e.jsx("input",{id:"testCommand",type:"text",placeholder:"e.g. pnpm test",value:a.testCommand||"",onChange:t=>d(s=>({...s,testCommand:t.target.value||void 0}))}),e.jsx("small",{children:"Command used to run tests — injected into generated task specs"})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"buildCommand",children:"Build Command"}),e.jsx("input",{id:"buildCommand",type:"text",placeholder:"e.g. pnpm build",value:a.buildCommand||"",onChange:t=>d(s=>({...s,buildCommand:t.target.value||void 0}))}),e.jsx("small",{children:"Command used to build the project — injected into generated task specs"})]})]});case"merge":return e.jsxs(e.Fragment,{children:[E(),e.jsx("h4",{className:"settings-section-heading",children:"Merge"}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"autoMerge",className:"checkbox-label",children:[e.jsx("input",{id:"autoMerge",type:"checkbox",checked:a.autoMerge,onChange:t=>d(s=>({...s,autoMerge:t.target.checked}))}),"Auto-merge completed tasks"]}),e.jsx("small",{children:"When enabled, tasks that pass review are automatically merged into the main branch"})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"mergeStrategy",children:"Auto-completion mode"}),e.jsxs("select",{id:"mergeStrategy",value:a.mergeStrategy||"direct",onChange:t=>d(s=>({...s,mergeStrategy:t.target.value})),children:[e.jsx("option",{value:"direct",children:"Direct merge into the current branch"}),e.jsx("option",{value:"pull-request",children:"Create, monitor, and merge a GitHub pull request"})]}),e.jsx("small",{children:"Controls what happens after a task reaches In Review. Direct mode preserves Fusion's current local squash-merge behavior. Pull request mode keeps the task in In Review while Fusion waits for GitHub reviews and required checks before merging the PR."})]}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"includeTaskIdInCommit",className:"checkbox-label",children:[e.jsx("input",{id:"includeTaskIdInCommit",type:"checkbox",checked:a.includeTaskIdInCommit!==!1,onChange:t=>d(s=>({...s,includeTaskIdInCommit:t.target.checked}))}),"Include task ID in commit scope"]}),e.jsxs("small",{children:["When disabled, merge commit messages omit the task ID from the scope (e.g. ",e.jsx("code",{children:"feat: ..."})," instead of ",e.jsx("code",{children:"feat(KB-001): ..."}),")"]})]}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"commitAuthorEnabled",className:"checkbox-label",children:[e.jsx("input",{id:"commitAuthorEnabled",type:"checkbox",checked:a.commitAuthorEnabled!==!1,onChange:t=>d(s=>({...s,commitAuthorEnabled:t.target.checked}))}),"Add author attribution to commits"]}),e.jsxs("small",{children:["When enabled, all commits made by Fusion include ",e.jsx("code",{children:"--author"})," ","attribution identifying them as AI-generated"]})]}),a.commitAuthorEnabled!==!1&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"commitAuthorName",children:"Author Name"}),e.jsx("input",{id:"commitAuthorName",type:"text",value:a.commitAuthorName??"",placeholder:"Fusion",onChange:t=>d(s=>({...s,commitAuthorName:t.target.value||void 0}))}),e.jsx("small",{children:"Name used in commit author attribution"})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"commitAuthorEmail",children:"Author Email"}),e.jsx("input",{id:"commitAuthorEmail",type:"email",value:a.commitAuthorEmail??"",placeholder:"noreply@runfusion.ai",onChange:t=>d(s=>({...s,commitAuthorEmail:t.target.value||void 0}))}),e.jsx("small",{children:"Email used in commit author attribution"})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"autoResolveConflicts",className:"checkbox-label",children:[e.jsx("input",{id:"autoResolveConflicts",type:"checkbox",checked:a.autoResolveConflicts!==!1,onChange:t=>d(s=>({...s,autoResolveConflicts:t.target.checked}))}),"Auto-resolve conflicts in lock files and generated files"]}),e.jsx("small",{children:"When enabled, lock files (package-lock.json, pnpm-lock.yaml, etc.), generated files (dist/*, *.gen.ts), and trivial whitespace conflicts are resolved automatically without AI intervention. Complex code conflicts still require AI review."})]}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"smartConflictResolution",className:"checkbox-label",children:[e.jsx("input",{id:"smartConflictResolution",type:"checkbox",checked:a.smartConflictResolution!==!1,onChange:t=>d(s=>({...s,smartConflictResolution:t.target.checked}))}),"Smart conflict resolution"]}),e.jsx("small",{children:"When enabled, lock files (package-lock.json, pnpm-lock.yaml, etc.) are resolved using 'ours' strategy, generated files (dist/*, *.gen.ts) using 'theirs' strategy, and trivial whitespace conflicts are auto-resolved without spawning an AI agent. Complex code conflicts still require AI review."})]}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"pushAfterMerge",className:"checkbox-label",children:[e.jsx("input",{id:"pushAfterMerge",type:"checkbox",checked:a.pushAfterMerge===!0,onChange:t=>d(s=>({...s,pushAfterMerge:t.target.checked}))}),"Push to remote after merge"]}),e.jsx("small",{children:"When enabled, the merged result is automatically pushed to the configured git remote. This includes pulling the latest from the remote first (rebase) and resolving any conflicts with AI if needed."})]}),a.pushAfterMerge&&e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"pushRemote",children:"Push Remote"}),e.jsx("input",{id:"pushRemote",type:"text",placeholder:"origin",value:a.pushRemote||"",onChange:t=>d(s=>({...s,pushRemote:t.target.value||void 0}))}),e.jsx("small",{children:'Git remote to push to (e.g. "origin"). Can include branch name (e.g. "origin main"). Default: "origin".'})]})]});case"memory":{const{capabilities:t,status:s,loading:l,error:n}={capabilities:ks,status:ys,loading:Ns,error:Cs},r=a.memoryEnabled!==!1,i=!l&&s!==null,p=i?t?.writable??!0:!0,f=r&&p,N=It.find(v=>v.path===O),pt={"long-term":"Long-term",daily:"Daily",dreams:"Dreams"};return e.jsxs(e.Fragment,{children:[E(),e.jsx("h4",{className:"settings-section-heading",children:"Memory"}),e.jsx("div",{className:"form-group",children:e.jsxs("small",{className:"settings-muted",children:["Memory lives in ",e.jsx("code",{children:".fusion/memory/"}),". Agents search with qmd first, fall back to local files when qmd is missing, and open exact line windows only when needed."]})}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"memoryEnabled",className:"checkbox-label",children:[e.jsx("input",{id:"memoryEnabled",type:"checkbox",checked:a.memoryEnabled!==!1,onChange:v=>d(z=>({...z,memoryEnabled:v.target.checked}))}),"Enable memory tools"]}),e.jsx("small",{children:"Agents get memory_search, memory_get, and memory_append tools. Search defaults to qmd with a local file fallback."})]}),l?e.jsx("div",{className:"form-group",children:e.jsx("small",{className:"settings-muted",children:"Checking memory write access..."})}):n?e.jsx("div",{className:"form-group",children:e.jsxs("small",{className:"field-error",children:["Failed to load backend status: ",n]})}):null,i&&s.qmdAvailable===!1&&e.jsxs("div",{className:"settings-empty-state memory-status-message",children:[e.jsxs("span",{children:["qmd is not installed. Search will use local files. Install indexed retrieval: ",e.jsx("code",{children:s.qmdInstallCommand||"bun install -g @tobilu/qmd"})]}),e.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:Vs,disabled:$t,children:$t?"Installing…":"Install qmd"})]}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"memoryAutoSummarizeEnabled",className:"checkbox-label",children:[e.jsx("input",{id:"memoryAutoSummarizeEnabled",type:"checkbox",checked:a.memoryAutoSummarizeEnabled||!1,onChange:v=>d(z=>({...z,memoryAutoSummarizeEnabled:v.target.checked}))}),"Auto-Summarize Memory"]}),e.jsx("small",{children:"Automatically compact memory when it exceeds the threshold on a schedule"})]}),(a.memoryAutoSummarizeEnabled||!1)&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"memoryAutoSummarizeThresholdChars",children:"Compaction Threshold (chars)"}),e.jsx("input",{id:"memoryAutoSummarizeThresholdChars",type:"number",className:"input",value:a.memoryAutoSummarizeThresholdChars??5e4,onChange:v=>d(z=>({...z,memoryAutoSummarizeThresholdChars:parseInt(v.target.value,10)||5e4})),min:1e3}),e.jsx("small",{children:"Memory will be compacted when it exceeds this character count"})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"memoryAutoSummarizeSchedule",children:"Schedule (cron)"}),e.jsx("input",{id:"memoryAutoSummarizeSchedule",type:"text",className:"input",value:a.memoryAutoSummarizeSchedule??"0 3 * * *",onChange:v=>d(z=>({...z,memoryAutoSummarizeSchedule:v.target.value})),placeholder:"0 3 * * *"}),e.jsx("small",{children:"Cron expression for auto-summarize schedule (default: daily at 3 AM)"})]})]}),e.jsx("div",{style:{borderTop:"1px solid var(--border)",margin:"var(--space-lg) 0"}}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"memoryDreamsEnabled",className:"checkbox-label",children:[e.jsx("input",{id:"memoryDreamsEnabled",type:"checkbox",checked:a.memoryDreamsEnabled===!0,onChange:v=>d(z=>({...z,memoryDreamsEnabled:v.target.checked})),disabled:!r}),"Process dreams from daily memory"]}),e.jsx("small",{children:"Turns daily notes into DREAMS.md and promotes reusable lessons into MEMORY.md."})]}),r&&a.memoryDreamsEnabled===!0&&e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"memoryDreamsSchedule",children:"Dream Schedule"}),e.jsx("input",{id:"memoryDreamsSchedule",type:"text",value:a.memoryDreamsSchedule??"0 4 * * *",onChange:v=>d(z=>({...z,memoryDreamsSchedule:v.target.value}))}),e.jsx("small",{children:"Cron expression for dream processing."})]}),e.jsxs("div",{className:"memory-retrieval-test",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"memoryRetrievalQuery",children:"Test Retrieval"}),e.jsx("input",{id:"memoryRetrievalQuery",type:"text",value:it,onChange:v=>xs(v.target.value),placeholder:"Search memory with qmd"}),e.jsx("small",{children:"Runs the same qmd-backed memory_search path agents use."})]}),e.jsx("div",{className:"form-group",children:e.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:Ws,disabled:Rt,children:Rt?"Testing…":"Test Retrieval"})}),re&&e.jsxs("div",{className:"memory-test-result",children:[e.jsxs("strong",{children:[re.results.length," result",re.results.length===1?"":"s"," ",'for "',re.query,'"']}),e.jsxs("small",{children:["qmd ",re.qmdAvailable?"available":"missing"," · ",re.usedFallback?"local fallback used":"qmd path used"]}),re.results.length>0?e.jsx("ul",{children:re.results.map((v,z)=>e.jsxs("li",{children:[e.jsxs("span",{children:[v.path,":",v.lineStart]}),e.jsx("p",{children:v.snippet})]},`${v.path}-${v.lineStart}-${z}`))}):e.jsx("small",{children:"No matching memory found."})]})]}),!r&&e.jsx("div",{className:"settings-empty-state memory-status-message",children:"Memory is currently disabled. You can view the file, but editing is read-only until memory is re-enabled."}),r&&i&&!p&&e.jsx("div",{className:"settings-empty-state memory-status-message",children:"Memory is configured with a read-only backend. You can view the file, but saving is disabled."}),Ft?e.jsx("div",{className:"settings-empty-state",children:"Loading memory…"}):e.jsxs("div",{className:"memory-editor-section",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"memoryFilePath",children:"Memory File"}),e.jsx("select",{id:"memoryFilePath",value:O,onChange:v=>{rt(v.target.value),Fe(!1)},disabled:ne,children:It.map(v=>e.jsxs("option",{value:v.path,children:[v.label," - ",v.path]},v.path))}),e.jsx("small",{children:ne?"Save or discard the current edits before switching files.":"Choose any project memory file to view or edit. Dreams is selected by default."})]}),N&&e.jsxs("div",{className:"memory-file-summary",children:[e.jsx("span",{children:pt[N.layer]}),e.jsx("strong",{children:N.path}),e.jsxs("small",{children:[N.size.toLocaleString()," bytes · updated ",new Date(N.updatedAt).toLocaleString()]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:N?.label||"Memory Editor"}),e.jsxs("small",{children:[N?.layer==="long-term"&&"Curated durable decisions, conventions, constraints, and pitfalls promoted from dreams.",N?.layer==="daily"&&"Raw daily observations, open loops, and running context for dream processing.",N?.layer==="dreams"&&"Synthesized patterns and open loops promoted from daily memory.",!N&&"Edits the selected memory file."]}),e.jsx("div",{className:"memory-editor-frame",children:e.jsx(_a,{content:nt,onChange:v=>{Ge(v),Fe(!0)},readOnly:!f,filePath:O})})]})]}),!Ft&&e.jsxs("div",{className:"form-group",children:[e.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:qs,disabled:!f||ne||zt,children:zt?"Compacting…":"Compact Selected File"}),e.jsx("small",{children:ne?"Save or discard edits before compacting this file.":`Compacts ${O} and writes the result back to the same file.`})]}),ne&&f&&e.jsx("div",{className:"form-group",children:e.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:Gs,children:"Save Memory"})}),ne&&!f&&e.jsx("div",{className:"form-group",children:e.jsxs("small",{className:"field-error",children:["Cannot save: ",r?"Backend is read-only":"Memory is disabled"]})})]})}case"experimental":{const t=a.experimentalFeatures??{},l=Array.from(new Set([...Object.keys(is),...Object.keys(t).map(hs)])).sort((n,r)=>n.localeCompare(r)).map(n=>[n,os(t,n)]);return e.jsxs(e.Fragment,{children:[E(),e.jsx("h4",{className:"settings-section-heading",children:"Experimental Features"}),e.jsx("div",{className:"form-group",children:e.jsx("small",{children:"Experimental features are early capabilities that are not yet fully stable. Enable them to test new functionality, but be aware they may change or be removed."})}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Feature Flags"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:l.map(([n,r])=>e.jsxs("label",{htmlFor:`experimental-${n}`,className:"checkbox-label",children:[e.jsx("input",{id:`experimental-${n}`,type:"checkbox",checked:r,onChange:i=>{d(p=>{const f={...p.experimentalFeatures??{},[n]:i.target.checked};for(const[N,pt]of Object.entries(yt))pt===n&&delete f[N];return{...p,experimentalFeatures:f}})}}),e.jsx("span",{children:is[n]??n})]},n))})]})]})}case"backups":return e.jsxs(e.Fragment,{children:[E(),e.jsx("h4",{className:"settings-section-heading",children:"Database Backups"}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"autoBackupEnabled",className:"checkbox-label",children:[e.jsx("input",{id:"autoBackupEnabled",type:"checkbox",checked:a.autoBackupEnabled||!1,onChange:t=>d(s=>({...s,autoBackupEnabled:t.target.checked}))}),"Enable automatic database backups"]}),e.jsx("small",{children:"When enabled, the database is backed up automatically on a schedule"})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"autoBackupSchedule",children:"Backup Schedule (Cron)"}),e.jsx("input",{id:"autoBackupSchedule",type:"text",placeholder:"0 2 * * *",value:a.autoBackupSchedule||"0 2 * * *",onChange:t=>d(s=>({...s,autoBackupSchedule:t.target.value})),disabled:!a.autoBackupEnabled}),e.jsx("small",{children:"Cron expression for backup timing. Default: 0 2 * * * (daily at 2 AM). Examples: 0 * * * * (hourly), 0 0 * * 0 (weekly), */15 * * * * (every 15 min)"}),a.autoBackupSchedule&&!/^[\s\d*,/-]+$/.test(a.autoBackupSchedule)&&e.jsx("small",{className:"field-error",children:"Invalid cron expression format"})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"autoBackupRetention",children:"Retention Count"}),e.jsx("input",{id:"autoBackupRetention",type:"number",min:1,max:100,value:a.autoBackupRetention??"",onChange:t=>{const s=t.target.value;d(l=>({...l,autoBackupRetention:s===""?void 0:Number(s)}))},disabled:!a.autoBackupEnabled}),e.jsx("small",{children:"Number of backup files to keep (oldest are deleted first). Range: 1-100."}),a.autoBackupRetention!==void 0&&(a.autoBackupRetention<1||a.autoBackupRetention>100)&&e.jsx("small",{className:"field-error",children:"Must be between 1 and 100"})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"autoBackupDir",children:"Backup Directory"}),e.jsx("input",{id:"autoBackupDir",type:"text",placeholder:".fusion/backups",value:a.autoBackupDir||".fusion/backups",onChange:t=>d(s=>({...s,autoBackupDir:t.target.value})),disabled:!a.autoBackupEnabled}),e.jsx("small",{children:"Directory for backup files, relative to project root"}),a.autoBackupDir&&a.autoBackupDir.includes("..")&&e.jsx("small",{className:"field-error",children:"Path cannot contain parent directory traversal (..)"})]}),st?e.jsx("div",{className:"settings-empty-state",children:"Loading backup info…"}):q?e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Current Backups"}),e.jsxs("div",{className:"backup-stats",children:[e.jsxs("div",{className:"backup-stat",children:[e.jsx("span",{className:"backup-stat-value",children:q.count}),e.jsx("span",{className:"backup-stat-label",children:"backups"})]}),e.jsxs("div",{className:"backup-stat",children:[e.jsx("span",{className:"backup-stat-value",children:q.totalSize>1024*1024?`${(q.totalSize/(1024*1024)).toFixed(1)} MB`:`${(q.totalSize/1024).toFixed(1)} KB`}),e.jsx("span",{className:"backup-stat-label",children:"total size"})]})]}),q.backups.length>0&&e.jsxs("details",{className:"backup-list",children:[e.jsxs("summary",{children:["View ",q.backups.length," backup(s)"]}),e.jsxs("ul",{children:[q.backups.slice(0,10).map(t=>e.jsxs("li",{children:[e.jsx("code",{children:t.filename}),e.jsx("span",{className:"backup-size",children:t.size>1024*1024?`${(t.size/(1024*1024)).toFixed(1)} MB`:`${(t.size/1024).toFixed(1)} KB`})]},t.filename)),q.backups.length>10&&e.jsx("li",{children:e.jsxs("em",{children:["...and ",q.backups.length-10," more"]})})]})]})]}):null,e.jsx("div",{className:"form-group",children:e.jsx("button",{type:"button",className:"btn btn-sm",onClick:Fs,disabled:st,children:st?"Creating…":"Backup Now"})})]});case"notifications":return e.jsxs(e.Fragment,{children:[E(),e.jsx("h4",{className:"settings-section-heading",children:"Notifications"}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"ntfyEnabled",className:"checkbox-label",children:[e.jsx("input",{id:"ntfyEnabled",type:"checkbox",checked:a.ntfyEnabled||!1,onChange:t=>d(s=>({...s,ntfyEnabled:t.target.checked}))}),"Enable ntfy.sh notifications"]}),e.jsx("small",{children:"Receive push notifications when tasks complete or fail via ntfy.sh"})]}),a.ntfyEnabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"ntfyTopic",children:"ntfy Topic"}),e.jsx("input",{id:"ntfyTopic",type:"text",placeholder:"my-topic-name",value:a.ntfyTopic||"",onChange:t=>{const s=t.target.value;d(l=>({...l,ntfyTopic:s||void 0}))}}),e.jsxs("small",{children:["Your ntfy.sh topic name (1–64 alphanumeric/hyphen/underscore characters)."," ",e.jsx("a",{href:"https://ntfy.sh",target:"_blank",rel:"noopener noreferrer",children:"Learn more about ntfy.sh"})]}),a.ntfyTopic&&!/^[a-zA-Z0-9_-]{1,64}$/.test(a.ntfyTopic)&&e.jsx("small",{className:"field-error",children:"Topic must be 1–64 alphanumeric, hyphen, or underscore characters"}),e.jsxs("details",{className:"ntfy-advanced-disclosure",children:[e.jsx("summary",{children:"Advanced"}),e.jsxs("div",{className:"ntfy-advanced-content",children:[e.jsx("label",{htmlFor:"ntfyBaseUrl",children:"Custom ntfy server URL (optional)"}),e.jsx("input",{id:"ntfyBaseUrl",type:"url",placeholder:"https://ntfy.sh",value:a.ntfyBaseUrl||"",onChange:t=>{const s=t.target.value;d(l=>({...l,ntfyBaseUrl:s||void 0}))}}),e.jsx("small",{children:"Leave blank to keep the default server: https://ntfy.sh. Custom servers must use http:// or https://."})]})]}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:Ms,disabled:Ct||!a.ntfyTopic||!/^[a-zA-Z0-9_-]{1,64}$/.test(a.ntfyTopic),children:Ct?"Sending…":"Test notification"})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Notify on events"}),e.jsxs("div",{className:"ntfy-events-list",children:[e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:a.ntfyEvents?.includes("in-review")??!0,onChange:t=>{const s=a.ntfyEvents??[...xe],l=t.target.checked?s.includes("in-review")?s:[...s,"in-review"]:s.filter(n=>n!=="in-review");d(n=>({...n,ntfyEvents:l.length>0?l:void 0}))}}),"Task completed (in-review)"]}),e.jsx("small",{children:"When a task moves to In Review (ready for review)"}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:a.ntfyEvents?.includes("merged")??!0,onChange:t=>{const s=a.ntfyEvents??[...xe],l=t.target.checked?s.includes("merged")?s:[...s,"merged"]:s.filter(n=>n!=="merged");d(n=>({...n,ntfyEvents:l.length>0?l:void 0}))}}),"Task merged"]}),e.jsx("small",{children:"When a task is successfully merged to main"}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:a.ntfyEvents?.includes("failed")??!0,onChange:t=>{const s=a.ntfyEvents??[...xe],l=t.target.checked?s.includes("failed")?s:[...s,"failed"]:s.filter(n=>n!=="failed");d(n=>({...n,ntfyEvents:l.length>0?l:void 0}))}}),"Task failed"]}),e.jsx("small",{children:"When a task fails during execution (high priority)"}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:a.ntfyEvents?.includes("awaiting-approval")??!0,onChange:t=>{const s=a.ntfyEvents??[...xe],l=t.target.checked?s.includes("awaiting-approval")?s:[...s,"awaiting-approval"]:s.filter(n=>n!=="awaiting-approval");d(n=>({...n,ntfyEvents:l.length>0?l:void 0}))}}),"Plan needs approval"]}),e.jsx("small",{children:"When a task specification needs manual approval before execution"}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:a.ntfyEvents?.includes("awaiting-user-review")??!0,onChange:t=>{const s=a.ntfyEvents??[...xe],l=t.target.checked?s.includes("awaiting-user-review")?s:[...s,"awaiting-user-review"]:s.filter(n=>n!=="awaiting-user-review");d(n=>({...n,ntfyEvents:l.length>0?l:void 0}))}}),"User review needed"]}),e.jsx("small",{children:"When an agent hands off a task for human review (high priority)"}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:a.ntfyEvents?.includes("planning-awaiting-input")??!0,onChange:t=>{const s=a.ntfyEvents??[...xe],l=t.target.checked?s.includes("planning-awaiting-input")?s:[...s,"planning-awaiting-input"]:s.filter(n=>n!=="planning-awaiting-input");d(n=>({...n,ntfyEvents:l.length>0?l:void 0}))}}),"Planning needs input"]}),e.jsx("small",{children:"When planning mode is waiting for your response to continue"})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"ntfyDashboardHost",children:"Dashboard Hostname"}),e.jsx("input",{id:"ntfyDashboardHost",type:"text",placeholder:"http://localhost:3000",value:a.ntfyDashboardHost||"",onChange:t=>{const s=t.target.value;d(l=>({...l,ntfyDashboardHost:s||void 0}))}}),e.jsx("small",{children:"Base URL for deep links in notifications. When set, clicking a notification opens the dashboard directly to the task."}),a.ntfyDashboardHost&&!/^https?:\/\/.+/.test(a.ntfyDashboardHost)&&e.jsx("small",{className:"field-error",children:"Must be a valid URL starting with http:// or https://"})]})]})]});case"node-sync":return e.jsxs(e.Fragment,{children:[E(),e.jsx("h4",{className:"settings-section-heading",children:"Node Sync"}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"settingsSyncEnabled",className:"checkbox-label",children:[e.jsx("input",{id:"settingsSyncEnabled",type:"checkbox",checked:a.settingsSyncEnabled||!1,onChange:t=>d(s=>({...s,settingsSyncEnabled:t.target.checked}))}),"Enable automatic settings sync"]}),e.jsx("small",{children:"Automatically synchronize settings between this node and connected remote nodes"})]}),a.settingsSyncEnabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"settingsSyncAuth",className:"checkbox-label",children:[e.jsx("input",{id:"settingsSyncAuth",type:"checkbox",checked:a.settingsSyncAuth||!1,onChange:t=>d(s=>({...s,settingsSyncAuth:t.target.checked}))}),"Sync model auth credentials"]}),e.jsx("small",{children:"Include API keys and OAuth tokens in sync operations"})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"settingsSyncInterval",children:"Sync interval"}),e.jsxs("select",{id:"settingsSyncInterval",className:"select",value:a.settingsSyncInterval||9e5,onChange:t=>d(s=>({...s,settingsSyncInterval:parseInt(t.target.value,10)})),children:[e.jsx("option",{value:3e5,children:"Every 5 minutes"}),e.jsx("option",{value:9e5,children:"Every 15 minutes"}),e.jsx("option",{value:18e5,children:"Every 30 minutes"}),e.jsx("option",{value:36e5,children:"Every 1 hour"})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"settingsSyncConflictResolution",children:"Conflict resolution"}),e.jsxs("select",{id:"settingsSyncConflictResolution",className:"select",value:a.settingsSyncConflictResolution||"last-write-wins",onChange:t=>d(s=>({...s,settingsSyncConflictResolution:t.target.value})),children:[e.jsx("option",{value:"last-write-wins",children:"Last write wins"}),e.jsx("option",{value:"always-ask",children:"Always ask"}),e.jsx("option",{value:"keep-local",children:"Keep local"}),e.jsx("option",{value:"keep-remote",children:"Keep remote"})]})]})]})]});case"remote":{const t=a,s=t.remoteActiveProvider??null,l=ue?.state??"stopped";return e.jsxs(e.Fragment,{children:[E(),e.jsx("h4",{className:"settings-section-heading",children:"Remote Access"}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"remoteActiveProvider",children:"Active provider"}),e.jsxs("select",{id:"remoteActiveProvider",className:"select",value:s??"",onChange:n=>d(r=>({...r,remoteActiveProvider:n.target.value||null})),children:[e.jsx("option",{value:"",children:"Not selected"}),e.jsx("option",{value:"tailscale",children:"Tailscale Serve"}),e.jsx("option",{value:"cloudflare",children:"Cloudflare Tunnel"})]}),e.jsxs("div",{className:"settings-button-row",children:[e.jsx("button",{type:"button",className:"btn btn-sm",disabled:!s||J!==null,onClick:()=>{s&&he("activate provider",async()=>{await Ra(s,h),m(`Activated ${s}`,"success")})},children:"Activate Provider"}),e.jsx("button",{type:"button",className:"btn btn-sm",disabled:J!==null,onClick:()=>void Ys(),children:J==="save"?"Saving…":"Save Remote Settings"})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Tailscale"}),e.jsxs("label",{htmlFor:"remoteTailscaleEnabled",className:"checkbox-label",children:[e.jsx("input",{id:"remoteTailscaleEnabled",type:"checkbox",checked:!!t.remoteTailscaleEnabled,onChange:n=>d(r=>({...r,remoteTailscaleEnabled:n.target.checked}))}),"Enable Tailscale provider config"]}),e.jsx("label",{htmlFor:"remoteTailscaleHostname",children:"Hostname label"}),e.jsx("input",{id:"remoteTailscaleHostname",type:"text",placeholder:"tailnet label (optional)",value:String(t.remoteTailscaleHostname??""),onChange:n=>d(r=>({...r,remoteTailscaleHostname:n.target.value}))}),e.jsx("label",{htmlFor:"remoteTailscaleTargetPort",children:"Target port"}),e.jsx("input",{id:"remoteTailscaleTargetPort",type:"number",min:1,max:65535,value:Number(t.remoteTailscaleTargetPort??4040),onChange:n=>d(r=>({...r,remoteTailscaleTargetPort:Number(n.target.value||4040)}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Cloudflare"}),e.jsxs("label",{htmlFor:"remoteCloudflareEnabled",className:"checkbox-label",children:[e.jsx("input",{id:"remoteCloudflareEnabled",type:"checkbox",checked:!!t.remoteCloudflareEnabled,onChange:n=>d(r=>({...r,remoteCloudflareEnabled:n.target.checked}))}),"Enable Cloudflare provider config"]}),e.jsx("label",{htmlFor:"remoteCloudflareTunnelName",children:"Tunnel name"}),e.jsx("input",{id:"remoteCloudflareTunnelName",type:"text",placeholder:"Tunnel name",value:String(t.remoteCloudflareTunnelName??""),onChange:n=>d(r=>({...r,remoteCloudflareTunnelName:n.target.value}))}),e.jsx("label",{htmlFor:"remoteCloudflareTunnelToken",children:"Tunnel token"}),e.jsx("input",{id:"remoteCloudflareTunnelToken",type:"password",placeholder:"Tunnel token",value:String(t.remoteCloudflareTunnelToken??""),onChange:n=>d(r=>({...r,remoteCloudflareTunnelToken:n.target.value}))}),e.jsx("label",{htmlFor:"remoteCloudflareIngressUrl",children:"Ingress URL"}),e.jsx("input",{id:"remoteCloudflareIngressUrl",type:"text",placeholder:"https://your-domain.example",value:String(t.remoteCloudflareIngressUrl??""),onChange:n=>d(r=>({...r,remoteCloudflareIngressUrl:n.target.value}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Tunnel lifecycle"}),e.jsxs("small",{children:["State: ",e.jsx("strong",{children:l}),ue?.provider?` · Provider: ${ue.provider}`:""]}),ue?.url&&e.jsxs("small",{children:["URL:",e.jsx("code",{className:"settings-url-output",children:ue.url})]}),ue?.lastError&&e.jsx("small",{className:"field-error",children:ue.lastError}),e.jsxs("div",{className:"settings-button-row",children:[e.jsx("button",{type:"button",className:"btn btn-sm btn-primary",disabled:J!==null,onClick:()=>void he("start tunnel",async()=>{await La(h),m("Remote tunnel start requested","success")}),children:"Start tunnel"}),e.jsx("button",{type:"button",className:"btn btn-sm",disabled:J!==null,onClick:()=>void he("stop tunnel",async()=>{await Oa(h),m("Remote tunnel stopped","success")}),children:"Stop tunnel"})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"Auth links"}),e.jsxs("div",{className:"settings-button-row",children:[e.jsx("button",{type:"button",className:"btn btn-sm",disabled:J!==null,onClick:()=>void he("regenerate persistent token",async()=>{await za(h),m("Persistent token regenerated","success")}),children:"Regenerate persistent token"}),e.jsx("button",{type:"button",className:"btn btn-sm",disabled:J!==null,onClick:()=>void he("generate short-lived token",async()=>{const n=Number(t.remoteShortLivedTtlMs??9e5),r=await Da(n,h);gs(r),m("Short-lived token generated","success")}),children:"Generate short-lived token"}),e.jsx("button",{type:"button",className:"btn btn-sm",disabled:J!==null,onClick:()=>void he("fetch remote url",async()=>{const n=Number(t.remoteShortLivedTtlMs??9e5),r=await $a({projectId:h,tokenType:ge,ttlMs:ge==="short-lived"?n:void 0});Pt(r),Mt(null)}),children:"Show URL"}),e.jsx("button",{type:"button",className:"btn btn-sm",disabled:J!==null,onClick:()=>void he("generate QR",async()=>{const n=Number(t.remoteShortLivedTtlMs??9e5),r=await Ba("image/svg",{projectId:h,tokenType:ge,ttlMs:ge==="short-lived"?n:void 0});Pt({url:r.url,expiresAt:r.expiresAt,tokenType:r.tokenType}),Mt(r.data??null)}),children:"Generate QR"})]}),e.jsx("label",{htmlFor:"remoteAuthLinkTokenType",children:"Auth link token type"}),e.jsxs("select",{id:"remoteAuthLinkTokenType",value:ge,onChange:n=>ps(n.target.value),children:[e.jsx("option",{value:"persistent",children:"Persistent token"}),e.jsx("option",{value:"short-lived",children:"Short-lived token"})]}),e.jsxs("small",{children:["URL and QR generation use the selected token type.",ge==="short-lived"?` TTL: ${Number(t.remoteShortLivedTtlMs??9e5)}ms.`:""]}),e.jsxs("label",{htmlFor:"remoteShortLivedEnabled",className:"checkbox-label",children:[e.jsx("input",{id:"remoteShortLivedEnabled",type:"checkbox",checked:!!t.remoteShortLivedEnabled,onChange:n=>d(r=>({...r,remoteShortLivedEnabled:n.target.checked}))}),"Enable short-lived tokens"]}),e.jsx("label",{htmlFor:"remoteShortLivedTtlMs",children:"Short-lived TTL (ms)"}),e.jsx("input",{id:"remoteShortLivedTtlMs",type:"number",min:6e4,max:864e5,value:Number(t.remoteShortLivedTtlMs??9e5),onChange:n=>d(r=>({...r,remoteShortLivedTtlMs:Number(n.target.value||9e5)}))}),lt&&e.jsxs("small",{children:["Last short-lived token expires at ",new Date(lt.expiresAt).toLocaleString()," (",lt.ttlMs,"ms)"]}),Me?.url&&e.jsxs(e.Fragment,{children:[e.jsxs("small",{children:["Authenticated URL:",e.jsx("code",{className:"settings-url-output",children:Me.url})]}),e.jsxs("small",{children:["Token type: ",e.jsx("strong",{children:Me.tokenType}),Me.expiresAt?` · Expires at ${new Date(Me.expiresAt).toLocaleString()}`:" · No expiry"]})]}),at&&e.jsxs("div",{className:"settings-qr-preview","aria-live":"polite",children:[e.jsx("p",{className:"settings-qr-preview-label",children:"Scan this QR code on your phone"}),e.jsx("div",{className:"settings-qr-preview-image-wrap",children:e.jsx("img",{src:`data:image/svg+xml;utf8,${encodeURIComponent(at)}`,alt:"Remote access QR code",className:"settings-qr-preview-image"})}),e.jsxs("details",{children:[e.jsx("summary",{children:"QR SVG markup"}),e.jsx("pre",{className:"settings-raw-output",children:at})]})]})]})]})}case"prompts":return e.jsxs(e.Fragment,{children:[E(),e.jsx("h4",{className:"settings-section-heading",children:"Prompts"}),e.jsx(tl,{value:a.agentPrompts,onChange:t=>{d(s=>({...s,agentPrompts:t}))},promptOverrides:a.promptOverrides,onPromptOverridesChange:t=>{d(s=>({...s,promptOverrides:t}))}})]});case"plugins":return e.jsxs(e.Fragment,{children:[E(),e.jsx("h4",{className:"settings-section-heading",children:"Plugins"}),e.jsxs("div",{className:"settings-plugins-subsection-toggle",role:"tablist","aria-label":"Plugin manager type",children:[e.jsx("button",{type:"button",id:"plugins-tab-fusion-plugins",role:"tab","aria-controls":"plugins-panel-fusion-plugins","aria-selected":F==="fusion-plugins",tabIndex:F==="fusion-plugins"?0:-1,className:`settings-plugins-subsection-btn${F==="fusion-plugins"?" active":""}`,onClick:()=>U("fusion-plugins"),children:"Fusion Plugins"}),e.jsx("button",{type:"button",id:"plugins-tab-pi-extensions",role:"tab","aria-controls":"plugins-panel-pi-extensions","aria-selected":F==="pi-extensions",tabIndex:F==="pi-extensions"?0:-1,className:`settings-plugins-subsection-btn${F==="pi-extensions"?" active":""}`,onClick:()=>U("pi-extensions"),children:"Pi Extensions"})]}),e.jsx("div",{id:"plugins-panel-fusion-plugins",role:"tabpanel","aria-labelledby":"plugins-tab-fusion-plugins",className:"settings-plugins-subsection-panel",hidden:F!=="fusion-plugins",children:F==="fusion-plugins"&&e.jsxs(e.Fragment,{children:[e.jsx(o.Suspense,{fallback:null,children:e.jsx(sl,{addToast:m,projectId:h})}),e.jsx(Ta,{slotId:"settings-section",projectId:h})]})}),e.jsx("div",{id:"plugins-panel-pi-extensions",role:"tabpanel","aria-labelledby":"plugins-tab-pi-extensions",className:"settings-plugins-subsection-panel",hidden:F!=="pi-extensions",children:F==="pi-extensions"&&e.jsx(o.Suspense,{fallback:null,children:e.jsx(al,{addToast:m,projectId:h})})})]});case"authentication":{const t=c.filter(i=>i.type==="cli"),l=[...c.filter(i=>i.type!=="cli")].sort((i,p)=>i.authenticated!==p.authenticated?i.authenticated?-1:1:i.name.localeCompare(p.name)),n=l.filter(i=>i.authenticated),r=l.filter(i=>!i.authenticated);return e.jsxs(e.Fragment,{children:[e.jsx("h4",{className:"settings-section-heading",children:"Authentication"}),x?e.jsx("div",{className:"settings-empty-state",children:"Loading authentication status…"}):c.length===0?e.jsx("div",{className:"settings-empty-state settings-muted",children:"No providers available"}):e.jsxs(e.Fragment,{children:[t.some(i=>i.id==="claude-cli")&&e.jsx(Ea,{compact:!0,authenticated:t.find(i=>i.id==="claude-cli")?.authenticated??!1,onToggled:()=>{Z()}}),n.length===0&&e.jsx("div",{className:"auth-section-hint",children:"Sign in to at least one provider to get started with AI models."}),n.length>0&&e.jsxs("div",{className:"auth-provider-group",children:[e.jsx("div",{className:"auth-group-label",children:"Authenticated"}),n.map(i=>e.jsx("div",{className:"auth-provider-card auth-provider-card--authenticated",children:e.jsxs("div",{className:"auth-provider-header",children:[e.jsxs("div",{className:"auth-provider-info",children:[e.jsx("span",{className:"auth-provider-icon-slot","data-testid":`auth-provider-icon-${i.id}`,"aria-hidden":"true",children:e.jsx(ts,{provider:i.id,size:"md"})}),e.jsx("strong",{children:i.name}),e.jsx("span",{"data-testid":`auth-status-${i.id}`,className:`auth-status-badge ${i.authenticated?"authenticated":"not-authenticated"}`,children:"✓ Active"}),i.authenticated&&i.keyHint&&e.jsxs("span",{className:"auth-key-hint",children:["Key: ",i.keyHint]})]}),i.type==="api_key"?e.jsxs("div",{className:"auth-apikey-section",children:[e.jsxs("div",{className:"auth-apikey-input-row",children:[e.jsx("input",{type:"password",className:"auth-apikey-input",placeholder:"Enter API key",value:we[i.id]??"",onChange:p=>De(f=>({...f,[i.id]:p.target.value})),disabled:j===i.id}),i.authenticated&&!we[i.id]?e.jsx("button",{className:"btn btn-sm",onClick:()=>Ps(i.id),disabled:j===i.id,children:"Clear"}):e.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>Ht(i.id),disabled:j===i.id,children:"Save"})]}),j===i.id&&e.jsx("small",{className:"auth-apikey-progress",children:"Saving…"}),$e[i.id]&&e.jsx("small",{className:"auth-apikey-error",children:$e[i.id]})]}):e.jsx("div",{children:j===i.id?e.jsx("button",{className:"btn btn-sm",disabled:!0,children:"Logging out…"}):e.jsx("button",{className:"btn btn-sm",onClick:()=>Ss(i.id),children:"Logout"})})]})},i.id))]}),r.length>0&&e.jsxs("div",{className:"auth-provider-group",children:[e.jsx("div",{className:"auth-group-label",children:"Available"}),r.map(i=>e.jsx("div",{className:"auth-provider-card",children:e.jsxs("div",{className:"auth-provider-header",children:[e.jsxs("div",{className:"auth-provider-info",children:[e.jsx("span",{className:"auth-provider-icon-slot","data-testid":`auth-provider-icon-${i.id}`,"aria-hidden":"true",children:e.jsx(ts,{provider:i.id,size:"md"})}),e.jsx("strong",{children:i.name}),e.jsx("span",{"data-testid":`auth-status-${i.id}`,className:`auth-status-badge ${i.authenticated?"authenticated":"not-authenticated"}`,children:"✗ Not connected"})]}),i.type==="api_key"?e.jsxs("div",{className:"auth-apikey-section",children:[e.jsxs("div",{className:"auth-apikey-input-row",children:[e.jsx("input",{type:"password",className:"auth-apikey-input",placeholder:"Enter API key",value:we[i.id]??"",onChange:p=>De(f=>({...f,[i.id]:p.target.value})),disabled:j===i.id}),e.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>Ht(i.id),disabled:j===i.id,children:"Save"})]}),j===i.id&&e.jsx("small",{className:"auth-apikey-progress",children:"Saving…"}),$e[i.id]&&e.jsx("small",{className:"auth-apikey-error",children:$e[i.id]})]}):e.jsxs("div",{children:[j===i.id?e.jsx("button",{className:"btn btn-sm",disabled:!0,children:"Waiting for login…"}):e.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>ws(i.id),children:"Login"}),pe[i.id]&&e.jsx(Ia,{instructions:pe[i.id],"data-testid":`auth-login-instructions-${i.id}`})]})]})},i.id))]})]}),e.jsx("small",{className:"auth-hint",children:"Authentication changes take effect immediately — no need to save."}),B&&e.jsxs("div",{className:"form-group",style:{marginTop:"var(--space-md)"},children:[e.jsx("button",{type:"button",className:"btn btn-sm",onClick:B,children:"Reopen onboarding guide"}),e.jsx("small",{className:"settings-muted",children:"Re-run the setup wizard to review or update your AI provider and model configuration."})]})]})}}};return e.jsxs("div",{className:"modal-overlay open",onClick:Ts,role:"dialog","aria-modal":"true",children:[e.jsxs("div",{className:"modal modal-lg",children:[e.jsxs("div",{className:"modal-header",children:[e.jsxs("div",{className:"settings-modal-heading",children:[e.jsx("h3",{children:"Settings"}),D&&e.jsxs("p",{className:"settings-modal-version",children:["Version ",D]})]}),e.jsx("button",{className:"modal-close",onClick:b,"aria-label":"Close",children:"×"})]}),_?e.jsx("div",{className:"settings-empty-state settings-loading",children:"Loading…"}):e.jsxs("div",{className:"settings-layout",children:[Te&&e.jsxs("div",{className:"settings-mobile-section-picker",children:[e.jsx("label",{htmlFor:"settings-mobile-section",children:"Settings Section"}),e.jsx("select",{id:"settings-mobile-section",className:"select touch-target",value:y,onChange:t=>H(t.target.value),children:de.filter(t=>!t.isGroupHeader).map(t=>e.jsx("option",{value:t.id,children:t.label},t.id))})]}),e.jsx("nav",{className:"settings-sidebar",children:de.map(t=>t.isGroupHeader?e.jsx("div",{className:"settings-group-header",children:t.label},t.id):e.jsxs("button",{className:`settings-nav-item${y===t.id?" active":""}`,onClick:()=>H(t.id),title:t.scope==="global"?"Shared across all projects":t.scope==="project"?"Specific to this project":void 0,children:[t.scope==="global"&&e.jsx(ft,{className:"settings-scope-icon","aria-label":"Global setting",size:16}),t.scope==="project"&&e.jsx(es,{className:"settings-scope-icon","aria-label":"Project setting",size:16}),t.icon&&!t.scope&&e.jsx(t.icon,{className:"settings-scope-icon","aria-label":"Global setting",size:16}),t.label]},t.id))}),e.jsx("div",{className:"settings-content",children:Qs()})]}),e.jsxs("div",{className:"modal-actions",children:[e.jsxs("div",{className:"modal-actions-left",children:[e.jsx("button",{type:"button",className:"btn btn-sm",onClick:As,title:"Export settings to JSON file",children:"Export"}),e.jsx("input",{type:"file",ref:Wt,accept:".json,application/json",style:{display:"none"},onChange:Es}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>Wt.current?.click(),disabled:We,title:"Import settings from JSON file",children:We?"Loading…":"Import"})]}),e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn btn-sm",onClick:b,children:"Cancel"}),e.jsx("button",{className:"btn btn-primary btn-sm",onClick:Us,disabled:_,children:"Save"})]})]})]}),$!==null&&e.jsx("div",{className:"modal-overlay open",onClick:$s,role:"dialog","aria-modal":"true","aria-label":"Browse workspace path",children:e.jsxs("div",{className:"modal modal-lg settings-overlap-path-picker-modal",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:"Select ignored overlap path"}),e.jsx("button",{className:"modal-close",onClick:ie,"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"modal-body settings-overlap-path-picker-body",children:[e.jsx("p",{className:"settings-overlap-path-picker-note",children:"Choose a file to ignore directly, or navigate into a folder and select the current directory."}),e.jsx(Aa,{entries:Ze,currentPath:K,onSelectFile:ht,onNavigate:ye,loading:Le,error:Oe,onRetry:ke,workspace:"project",projectId:h})]}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("div",{className:"modal-actions-left",children:e.jsxs("small",{children:["Current directory: ",e.jsx("code",{children:K==="."?"(project root)":K})]})}),e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn btn-sm",onClick:ie,children:"Cancel"}),e.jsx("button",{className:"btn btn-primary btn-sm",onClick:Ds,disabled:K===".",children:"Select current directory"})]})]})]})}),vs&&W&&e.jsx("div",{className:"modal-overlay open",onClick:t=>t.target===t.currentTarget&&Ae(!1),role:"dialog","aria-modal":"true",children:e.jsxs("div",{className:"modal modal-md",children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:"Import Settings"}),e.jsx("button",{className:"modal-close",onClick:()=>Ae(!1),"aria-label":"Close",children:"×"})]}),e.jsxs("div",{className:"modal-body",children:[e.jsx("p",{children:"Review the settings to be imported:"}),W.global&&Object.keys(W.global).length>0&&e.jsxs("div",{className:"form-group",children:[e.jsx("strong",{children:"Global Settings:"}),e.jsx("ul",{className:"import-preview-list",children:Object.entries(W.global).filter(([,t])=>t!==void 0).map(([t])=>e.jsx("li",{children:t},t))})]}),W.project&&Object.keys(W.project).length>0&&e.jsxs("div",{className:"form-group",children:[e.jsx("strong",{children:"Project Settings:"}),e.jsx("ul",{className:"import-preview-list",children:Object.entries(W.project).filter(([,t])=>t!==void 0).map(([t])=>e.jsx("li",{children:t},t))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"import-scope",children:"Import Scope:"}),e.jsxs("select",{id:"import-scope",value:dt,onChange:t=>fs(t.target.value),children:[e.jsx("option",{value:"both",children:"Both global and project settings"}),e.jsx("option",{value:"global",children:"Global settings only"}),e.jsx("option",{value:"project",children:"Project settings only"})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{htmlFor:"import-merge",className:"checkbox-label",children:[e.jsx("input",{id:"import-merge",type:"checkbox",checked:mt,onChange:t=>js(t.target.checked)}),"Merge with existing settings (recommended)"]}),e.jsx("small",{children:"If unchecked, existing settings will be replaced with imported values."})]})]}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{className:"btn btn-sm",onClick:()=>Ae(!1),children:"Cancel"}),e.jsx("button",{className:"btn btn-primary btn-sm",onClick:Is,disabled:We,children:We?"Importing…":"Confirm Import"})]})]})})]})}export{ml as SettingsModal};