@luuthuong/devboard 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/assets/CardDetailView-BZE_MfjM.js +24 -0
  2. package/dist/assets/{DiffPane-bQsGoT7y.js → DiffPane-2WnoRvZ0.js} +2 -2
  3. package/dist/assets/KnowledgeView-C4WPFAUM.js +3 -0
  4. package/dist/assets/ListBoardView-DEE_eK4h.js +3 -0
  5. package/dist/assets/NewTaskDialog-D8cpc7Bc.js +1 -0
  6. package/dist/assets/OnboardingWizard-9ZkFPGvH.js +1 -0
  7. package/dist/assets/{ProcessManagerView-BIYjQpoP.js → ProcessManagerView-DJOr44DY.js} +1 -1
  8. package/dist/assets/ProposalCard-B8jqFtL8.js +1 -0
  9. package/dist/assets/{SearchOverlay-B4aywpIh.js → SearchOverlay-qGxzmM_v.js} +1 -1
  10. package/dist/assets/SettingsView-C3GkCbTz.js +1 -0
  11. package/dist/assets/SetupProjectView-CSx6ax5r.js +1 -0
  12. package/dist/assets/TaskDescriptionEditor-D0_b81zY.js +58 -0
  13. package/dist/assets/{Terminal-DJJcg-t6.js → Terminal-yq90NOBX.js} +1 -1
  14. package/dist/assets/deepEqual-BiJVGDfM.js +1 -0
  15. package/dist/assets/index-BtXUncAU.css +1 -0
  16. package/dist/assets/index-CQnL8JJ5.js +18 -0
  17. package/dist/assets/plus-Cecrm8sZ.js +1 -0
  18. package/dist/assets/x-B6wVesqk.js +1 -0
  19. package/dist/index.html +2 -2
  20. package/package.json +2 -2
  21. package/server-dist/server/commands.js +5 -39
  22. package/server-dist/server/fsBrowse.js +143 -0
  23. package/server-dist/server/transcripts.js +21 -22
  24. package/dist/assets/CardDetailView-CVWOsYyA.js +0 -24
  25. package/dist/assets/KnowledgeView-C5KHiBRG.js +0 -3
  26. package/dist/assets/ListBoardView-CzJcCLXS.js +0 -3
  27. package/dist/assets/NewTaskDialog-BuxvfgNU.js +0 -1
  28. package/dist/assets/OnboardingWizard-8WLFjTd8.js +0 -1
  29. package/dist/assets/ProposalCard-BbPobl1f.js +0 -1
  30. package/dist/assets/SettingsView-spBB3EwB.js +0 -1
  31. package/dist/assets/SetupProjectView-BuUDqDYU.js +0 -1
  32. package/dist/assets/TaskDescriptionEditor-Cv0nlU3w.js +0 -58
  33. package/dist/assets/chevron-right-BsVThPz4.js +0 -1
  34. package/dist/assets/index-DNKB6XwG.css +0 -1
  35. package/dist/assets/index-gWSenOqD.js +0 -18
  36. package/dist/assets/plus-XSPxArj5.js +0 -1
  37. package/dist/assets/x-CdEDbLMR.js +0 -1
@@ -0,0 +1,3 @@
1
+ import{a as e,d as t,i as n,m as r,t as i,u as a}from"./jsx-runtime-QmcfnBgR.js";import{a as o,c as s,d as c,o as l,s as u,t as d,u as f}from"./Surface-BQKeigoq.js";import{C as p,D as m,S as h,T as g,_,b as v,d as y,et as b,f as x,g as S,ht as C,m as ee,ot as w,p as te,ut as T,v as E,y as D}from"./index-CQnL8JJ5.js";import{n as O,r as k,t as A}from"./ProposalCard-B8jqFtL8.js";var j=r(t(),1),M=a(),N=i();function P(e){let t=(0,M.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,N.jsx)(`p`,{className:`bd-kb-intro`,children:n}),t[0]=n,t[1]=r),r}function F(e){let t=(0,M.c)(18),{title:n,count:r,hint:i,action:a,children:o}=e,s;t[0]===r?s=t[1]:(s=r!==void 0&&(0,N.jsx)(`span`,{className:`bd-kb-count`,children:r}),t[0]=r,t[1]=s);let c;t[2]!==s||t[3]!==n?(c=(0,N.jsxs)(`h3`,{className:`bd-kb-h`,children:[n,s]}),t[2]=s,t[3]=n,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=i&&(0,N.jsx)(`p`,{className:`bd-kb-hint`,children:i}),t[5]=i,t[6]=l);let u;t[7]!==c||t[8]!==l?(u=(0,N.jsxs)(`div`,{children:[c,l]}),t[7]=c,t[8]=l,t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==u?(d=(0,N.jsxs)(`header`,{className:`bd-kb-section-head`,children:[u,a]}),t[10]=a,t[11]=u,t[12]=d):d=t[12];let f;t[13]===o?f=t[14]:(f=(0,N.jsx)(`div`,{className:`bd-kb-list`,children:o}),t[13]=o,t[14]=f);let p;return t[15]!==d||t[16]!==f?(p=(0,N.jsxs)(`section`,{className:`bd-kb-section`,children:[d,f]}),t[15]=d,t[16]=f,t[17]=p):p=t[17],p}function I(e){let t=(0,M.c)(8),{title:n,children:r,action:i}=e,a;t[0]===n?a=t[1]:(a=(0,N.jsx)(`strong`,{children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r&&(0,N.jsx)(`p`,{children:r}),t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,N.jsxs)(`div`,{className:`bd-kb-empty`,children:[a,o,i]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}var L={inception:`Planning`,construction:`Building`,operations:`Running`,done:`Done`};function ne({intents:e,onChanged:t}){let r=C(e=>e.cards),i=C(e=>e.projects),a=w(r,i),[d,h]=(0,j.useState)(!1),[g,y]=(0,j.useState)(a[0]?.path??``),[b,x]=(0,j.useState)(``),[ee,te]=(0,j.useState)(``),[T,k]=(0,j.useState)(!1),A=async()=>{k(!0);try{await n(`intent_create`,{projectPath:g,title:b,body:ee}),x(``),te(``),h(!1),m({title:`Intent created`,description:`Its planning card is in the backlog.`,tone:`success`}),t()}catch(e){O(e)}finally{k(!1)}},M=e=>e===`done`?`success`:e===`inception`?`outline`:`default`;return(0,N.jsxs)(`div`,{className:`bd-kb-stack`,children:[(0,N.jsx)(P,{children:`An intent is a goal you hand to agents, such as “add dark mode”. They plan it first, then you approve each stage before they build it as separate task cards.`}),(0,N.jsxs)(F,{title:`Your intents`,count:e.length,action:!d&&(0,N.jsx)(l,{size:`sm`,variant:`solid`,onClick:()=>h(!0),children:`New intent`}),children:[d&&(0,N.jsxs)(u,{material:`thin`,children:[(0,N.jsx)(f,{children:(0,N.jsx)(c,{children:`New intent`})}),(0,N.jsxs)(S,{children:[(0,N.jsx)(D,{children:`Project`}),(0,N.jsx)(v,{"aria-label":`Project`,options:a.map(e=>({value:e.path,label:e.name})),value:g,onValueChange:y})]}),(0,N.jsxs)(S,{children:[(0,N.jsx)(D,{htmlFor:`intent-title`,children:`Goal`}),(0,N.jsx)(E,{id:`intent-title`,placeholder:`What should be built or fixed?`,value:b,onChange:e=>x(e.target.value)})]}),(0,N.jsxs)(S,{children:[(0,N.jsx)(D,{htmlFor:`intent-body`,children:`Details`}),(0,N.jsx)(p,{id:`intent-body`,rows:3,placeholder:`Context, constraints, links. The more the agent knows, the better its plan.`,value:ee,onChange:e=>te(e.target.value)}),(0,N.jsx)(_,{children:`Creates a planning card in the backlog. Nothing runs until you start it.`})]}),(0,N.jsxs)(`div`,{className:`bd-kb-actions`,children:[(0,N.jsx)(l,{variant:`solid`,loading:T,disabled:!g||!b.trim(),onClick:A,children:`Create intent`}),(0,N.jsx)(l,{variant:`ghost`,disabled:T,onClick:()=>h(!1),children:`Cancel`})]})]}),e.length===0&&!d&&(0,N.jsx)(I,{title:`No intents yet`,children:`Create one to have agents plan and build a larger piece of work in stages.`}),e.slice().reverse().map(e=>{let t=r.filter(t=>t.link.intentId===e.id&&t.id!==e.inceptionCardId),n=t.filter(e=>e.link.column===`done`).length;return(0,N.jsx)(u,{material:`thin`,children:(0,N.jsx)(f,{children:(0,N.jsxs)(`div`,{children:[(0,N.jsx)(c,{children:e.title}),(0,N.jsxs)(s,{children:[(0,N.jsx)(o,{tone:M(e.phase),children:L[e.phase]}),` `,t.length?`${n} of ${t.length} tasks done · `:`No tasks yet · `,e.artifactsDir]})]})})},e.id)})]})]})}function re(e){let t=(0,M.c)(16),{proposals:n,gates:r,intents:i,configured:a,onChanged:o,onOpenCard:s}=e;if(n.length===0&&r.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,N.jsx)(P,{children:`Agents propose things worth remembering and pause between stages of an intent. Both wait here for you.`}),t[0]=e):e=t[0];let n=a?`New proposals appear after an agent session finishes and the librarian finds something worth keeping.`:`Connect a harness repository in Setup to start collecting proposals.`,r;return t[1]===n?r=t[2]:(r=(0,N.jsxs)(N.Fragment,{children:[e,(0,N.jsx)(I,{title:`You're all caught up`,children:n})]}),t[1]=n,t[2]=r),r}let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,N.jsx)(P,{children:`Nothing here changes until you decide. Approve to move on, or reject to send it back.`}),t[3]=c):c=t[3];let l;t[4]!==r||t[5]!==i||t[6]!==o||t[7]!==s?(l=r.length>0&&(0,N.jsx)(F,{title:`Stages waiting for approval`,count:r.length,hint:`An agent finished a stage of an intent and is paused. Approve to let it continue, or send it back with a note.`,children:r.map(e=>(0,N.jsx)(R,{card:e,intent:i.find(t=>t.id===e.link.intentId),onChanged:o,onOpenCard:s},e.id))}),t[4]=r,t[5]=i,t[6]=o,t[7]=s,t[8]=l):l=t[8];let u;t[9]!==o||t[10]!==s||t[11]!==n?(u=n.length>0&&(0,N.jsx)(F,{title:`Proposed knowledge`,count:n.length,hint:`Approving opens a pull request in the harness repository. Once merged, new sessions start with this entry.`,children:n.map(e=>(0,N.jsx)(A,{proposal:e,onChanged:o,onOpenCard:s},e.id))}),t[9]=o,t[10]=s,t[11]=n,t[12]=u):u=t[12];let d;return t[13]!==l||t[14]!==u?(d=(0,N.jsxs)(`div`,{className:`bd-kb-stack`,children:[c,l,u]}),t[13]=l,t[14]=u,t[15]=d):d=t[15],d}function R({card:e,intent:t,onChanged:r,onOpenCard:i}){let[a,d]=(0,j.useState)(``),[h,g]=(0,j.useState)(!1),v=C(e=>e.selectCard),y=e.link.gate,b=async t=>{g(!0);try{let i=await n(t,{cardId:e.id,note:a});m({title:t===`gate_approve`?`Approved ${y.stage}`:`Sent ${y.stage} back`,description:i?.created?.length?`${i.created.length} unit cards created`:void 0,tone:`success`}),r()}catch(e){O(e)}finally{g(!1)}};return(0,N.jsxs)(u,{material:`thin`,children:[(0,N.jsxs)(f,{children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(c,{children:e.displayTitle}),(0,N.jsxs)(s,{children:[(0,N.jsxs)(o,{tone:`warning`,children:[y.stage,` stage`]}),` `,t?`${t.title} · ${t.artifactsDir}`:e.projectName]})]}),(0,N.jsx)(l,{variant:`ghost`,size:`sm`,onClick:()=>{v(e.id),i()},children:`Open task`})]}),y.note&&(0,N.jsx)(`p`,{className:`bd-kb-summary`,children:y.note}),(0,N.jsxs)(S,{children:[(0,N.jsx)(D,{htmlFor:`note-${e.id}`,children:`Note for the agent`}),(0,N.jsx)(p,{id:`note-${e.id}`,rows:2,placeholder:`What should change? Required to send back.`,value:a,onChange:e=>d(e.target.value)}),(0,N.jsx)(_,{children:`Optional when approving.`})]}),(0,N.jsxs)(`div`,{className:`bd-kb-actions`,children:[(0,N.jsx)(l,{variant:`solid`,loading:h,onClick:()=>b(`gate_approve`),children:`Approve and continue`}),(0,N.jsx)(l,{disabled:h||!a.trim(),onClick:()=>b(`gate_reject`),children:`Send back`})]})]})}var z=``;function ie({configured:e,status:t}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(z),u=[{value:z,label:`All projects`},...(t?.projects??[]).map(e=>({value:e.kbId,label:e.name??e.id})),...(t?.kbs??[]).filter(e=>!t?.projects.some(t=>t.kbId===e.id)).map(e=>({value:e.id,label:e.id}))],[d,f]=(0,j.useState)(null),[p,m]=(0,j.useState)(``),[h,g]=(0,j.useState)(!1),[_,y]=(0,j.useState)(null),b=e&&(r.trim()!==``||a.trim()!==``),x=async()=>{g(!0);try{f(await n(`kb_search`,{text:r,files:a.trim()?[a.trim()]:[],onlyKbs:s?[s]:[],limit:25})),m(r.trim()||a.trim()),y(null)}catch(e){O(e)}finally{g(!1)}};return(0,N.jsxs)(`div`,{className:`bd-kb-stack`,children:[(0,N.jsx)(P,{children:`Look up what your team already decided or learned. This is the same index agents search at the start of a session.`}),(0,N.jsxs)(`form`,{className:`bd-kb-search`,onSubmit:e=>{e.preventDefault(),b&&x()},children:[(0,N.jsx)(v,{"aria-label":`Project`,options:u,value:s,onValueChange:c}),(0,N.jsx)(E,{"aria-label":`Search words`,placeholder:`Search words, e.g. “auth token refresh”`,value:r,onChange:e=>i(e.target.value)}),(0,N.jsx)(E,{"aria-label":`Limit to a file or folder`,placeholder:`Only entries about a file or folder (optional)`,value:a,onChange:e=>o(e.target.value)}),(0,N.jsx)(l,{type:`submit`,variant:`solid`,loading:h,disabled:!b,children:`Search`})]}),d===null&&(0,N.jsxs)(I,{title:`Search the knowledge bases`,children:[`Try a topic, an error message or a path like `,(0,N.jsx)(`code`,{children:`src/auth/`}),`.`]}),d?.length===0&&(0,N.jsx)(I,{title:`Nothing found for “${p}”`,children:`Try fewer or different words, or drop the file filter.`}),d&&d.length>0&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`p`,{className:`bd-kb-hint`,children:[k(d.length,`entry`,`entries`),` · select one to read it`]}),(0,N.jsx)(`div`,{className:`bd-kb-list`,children:d.map(e=>(0,N.jsx)(B,{entry:e.entry,stale:e.stale,open:_===e.entry.id,onToggle:()=>y(_===e.entry.id?null:e.entry.id)},e.entry.id))})]})]})}function B(e){let t=(0,M.c)(27),{entry:n,stale:r,open:i,onToggle:a}=e,l;t[0]===n.title?l=t[1]:(l=(0,N.jsx)(c,{children:n.title}),t[0]=n.title,t[1]=l);let d;t[2]===n.type?d=t[3]:(d=(0,N.jsx)(o,{children:n.type}),t[2]=n.type,t[3]=d);let p;t[4]===r?p=t[5]:(p=r&&(0,N.jsx)(o,{tone:`warning`,children:`may be outdated`}),t[4]=r,t[5]=p);let m;t[6]===n.scope?m=t[7]:(m=n.scope.length?` · ${n.scope.join(`, `)}`:``,t[6]=n.scope,t[7]=m);let h;t[8]!==n.kbId||t[9]!==d||t[10]!==p||t[11]!==m?(h=(0,N.jsxs)(s,{children:[d,` `,p,` `,n.kbId,m]}),t[8]=n.kbId,t[9]=d,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]!==l||t[14]!==h?(g=(0,N.jsx)(f,{children:(0,N.jsxs)(`div`,{children:[l,h]})}),t[13]=l,t[14]=h,t[15]=g):g=t[15];let _;t[16]===n.summary?_=t[17]:(_=(0,N.jsx)(`p`,{className:`bd-kb-summary`,children:n.summary}),t[16]=n.summary,t[17]=_);let v;t[18]!==n.body||t[19]!==i?(v=i&&(0,N.jsx)(`pre`,{className:`bd-kb-body-text`,children:n.body}),t[18]=n.body,t[19]=i,t[20]=v):v=t[20];let y;return t[21]!==a||t[22]!==i||t[23]!==g||t[24]!==_||t[25]!==v?(y=(0,N.jsxs)(u,{material:`thin`,interactive:!0,onClick:a,"aria-expanded":i,children:[g,_,v]}),t[21]=a,t[22]=i,t[23]=g,t[24]=_,t[25]=v,t[26]=y):y=t[26],y}function ae({status:e,onChanged:t}){let[r,i]=(0,j.useState)(null),[a,p]=(0,j.useState)(null),[g,v]=(0,j.useState)(null),[y,x]=(0,j.useState)({}),ee=C(e=>e.cards),te=C(e=>e.projects),A=w(ee,te),M=A.map(e=>e.path).join(`
2
+ `);(0,j.useEffect)(()=>{e?.configured&&n(`harness_projects`,{paths:M.split(`
3
+ `).filter(Boolean)}).then(e=>x(Object.fromEntries(e.map(e=>[e.path,e.projectId])))).catch(O)},[e,M]),(0,j.useEffect)(()=>{b().then(e=>{i(e),p(e.harness??null)}).catch(O)},[]);let F=async(e,n,r)=>{v(e);try{await n(),r&&m({title:r,tone:`success`}),t()}catch(e){O(e)}finally{v(null)}};if(!r||!a)return null;let I=e=>p({...a,...e}),L=!!e?.configured,ne=A.filter(e=>y[e.path]).length,re=new Set(A.map(e=>y[e.path]).filter(Boolean)),R=(e?.projects??[]).filter(e=>!re.has(e.id));return(0,N.jsxs)(`div`,{className:`bd-kb-stack`,children:[(0,N.jsx)(P,{children:`Set this up once. Your harness repository holds the knowledge; agents on this machine and your teammates' read from it.`}),e?.error&&(0,N.jsx)(d,{tone:`danger`,title:`Harness error`,description:e.error}),(0,N.jsxs)(u,{material:`thin`,children:[(0,N.jsxs)(f,{children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(c,{children:`Harness repository`}),(0,N.jsx)(s,{children:`A private git repository that stores the knowledge bases and the agent pack. This server keeps a clone and opens pull requests for approved entries.`})]}),(0,N.jsx)(o,{tone:L?`success`:`warning`,children:L?`Connected`:`Not connected`})]}),(0,N.jsxs)(S,{children:[(0,N.jsx)(D,{htmlFor:`h-path`,children:`Local folder`}),(0,N.jsx)(E,{id:`h-path`,placeholder:`Where the clone lives on this server`,value:a.repoPath??``,onChange:e=>I({repoPath:e.target.value||void 0})})]}),(0,N.jsxs)(S,{children:[(0,N.jsx)(D,{htmlFor:`h-url`,children:`Git URL`}),(0,N.jsx)(E,{id:`h-url`,placeholder:`git@github.com:your-team/harness.git`,value:a.gitUrl??``,onChange:e=>I({gitUrl:e.target.value||void 0})}),(0,N.jsx)(_,{children:`Only used to clone when the folder does not exist yet.`})]}),(0,N.jsxs)(`div`,{className:`bd-kb-actions`,children:[(0,N.jsx)(l,{variant:`solid`,loading:g===`save`,onClick:()=>F(`save`,()=>T({...r,harness:a}),`Saved`),children:`Save`}),(0,N.jsx)(l,{loading:g===`init`,disabled:!a.repoPath,onClick:()=>F(`init`,()=>n(`harness_init_repo`,{repoPath:a.repoPath}),`Repository created from the template`),children:`Start a new repository`}),(0,N.jsx)(l,{loading:g===`sync`,disabled:!L,onClick:()=>F(`sync`,()=>n(`kb_sync`)),children:`Pull latest`})]}),(0,N.jsx)(_,{children:L&&e?(0,N.jsxs)(N.Fragment,{children:[e.kbs.map(e=>`${e.id}: ${k(e.entries,`entry`,`entries`)}${e.stale?`, ${e.stale} may be outdated`:``}`).join(` · `),e.lastPull?` · pulled ${new Date(e.lastPull).toLocaleTimeString()}`:``,e.indexStore?` · search: ${e.indexStore===`sqlite`?`SQLite FTS5`:`in memory`}`:``]}):`“Start a new repository” fills the folder with a ready-made template: knowledge bases, skills and reviewer agents.`})]}),(0,N.jsxs)(u,{material:`thin`,children:[(0,N.jsx)(f,{children:(0,N.jsxs)(`div`,{children:[(0,N.jsx)(c,{children:`Librarian`}),(0,N.jsx)(s,{children:`Reads finished sessions and proposes entries worth remembering. Nothing is saved until you approve it in Review.`})]})}),(0,N.jsx)(h,{label:`Propose entries from finished sessions`,checked:a.librarian.enabled,onCheckedChange:e=>I({librarian:{...a.librarian,enabled:e}})}),(0,N.jsxs)(S,{children:[(0,N.jsx)(D,{htmlFor:`h-model`,children:`Model`}),(0,N.jsx)(E,{id:`h-model`,value:a.librarian.model,onChange:e=>I({librarian:{...a.librarian,model:e.target.value}})}),(0,N.jsx)(_,{children:`Passed to claude --model.`})]}),(0,N.jsx)(`div`,{className:`bd-kb-actions`,children:(0,N.jsx)(l,{variant:`solid`,loading:g===`save`,onClick:()=>F(`save`,()=>T({...r,harness:a}),`Saved`),children:`Save`})})]}),(0,N.jsxs)(u,{material:`thin`,children:[(0,N.jsxs)(f,{children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(c,{children:`Projects`}),(0,N.jsx)(s,{children:`Adding a project opens a pull request in the harness repository with its knowledge base, then has the librarian propose a first set of entries from its docs.`})]}),L&&A.length>0&&(0,N.jsxs)(o,{tone:ne===A.length?`success`:`outline`,children:[ne,` of `,A.length,` added`]})]}),!L&&(0,N.jsx)(_,{children:`Connect the repository above to add projects.`}),L&&A.length===0&&!R.length&&(0,N.jsx)(_,{children:`Projects appear here once you have tasks on the board.`}),R.map(e=>(0,N.jsxs)(`div`,{className:`bd-kb-row`,children:[(0,N.jsx)(`span`,{className:`bd-kb-grow`,children:e.name||e.id}),(0,N.jsxs)(o,{tone:`outline`,children:[`In harness · `,e.id,` · no tasks on the board`]})]},e.id)),A.map(e=>{let t=y[e.path];return(0,N.jsxs)(`div`,{className:`bd-kb-row`,children:[(0,N.jsx)(`span`,{className:`bd-kb-grow`,children:e.name}),t?(0,N.jsxs)(o,{tone:`success`,children:[`In harness · `,t]}):(0,N.jsx)(l,{size:`sm`,disabled:!L,loading:g===e.path,onClick:()=>F(e.path,async()=>{let t=await n(`project_onboard`,{projectPath:e.path});m({title:`Project added`,description:t.url??t.mode,tone:`success`})}),children:`Add to harness`})]},e.path)})]}),(0,N.jsxs)(u,{material:`thin`,children:[(0,N.jsx)(f,{children:(0,N.jsxs)(`div`,{children:[(0,N.jsx)(c,{children:`Agent pack`}),(0,N.jsx)(s,{children:`The team's skills, reviewer subagents and a SessionStart hook that hands each new session the relevant knowledge. Install it on every machine that runs agents.`})]})}),(0,N.jsx)(`div`,{className:`bd-kb-actions`,children:(0,N.jsx)(l,{loading:g===`pack`,disabled:!L,onClick:()=>F(`pack`,()=>n(`harness_install_pack`),`Skills, subagents and hook installed`),children:`Install on this machine`})}),(0,N.jsx)(_,{children:`On a teammate's machine, run this once, pointing at this server:`}),(0,N.jsxs)(`pre`,{className:`bd-kb-body-text`,children:[`devboard harness install --server `,window.location.origin,` --token `,`<token>`]})]})]})}function V(t){let r=(0,M.c)(67),{open:i,onClose:a}=t,[s,c]=(0,j.useState)(`review`),[u,f]=(0,j.useState)(null),p;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],r[0]=p):p=r[0];let[m,h]=(0,j.useState)(p),_;r[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=[],r[1]=_):_=r[1];let[v,b]=(0,j.useState)(_),S=(0,j.useRef)(!1),w;r[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=async()=>{try{let[e,t,r]=await Promise.all([n(`kb_status`),n(`kb_proposals`,{status:`pending`}),n(`intent_list`)]);f(e),h(t),b(r)}catch(e){O(e)}},r[2]=w):w=r[2];let T=w,E,D;r[3]===i?(E=r[4],D=r[5]):(E=()=>{if(!i)return;S.current=!1,T();let t;return e(`harness-updated`,()=>void T()).then(e=>t=e),()=>t?.()},D=[i,T],r[3]=i,r[4]=E,r[5]=D),(0,j.useEffect)(E,D);let A=C(ce),P;r[6]===A?P=r[7]:(P=A.filter(se),r[6]=A,r[7]=P);let F=P,I=m.length+F.length,L,R;r[8]!==u||r[9]!==I?(L=()=>{u&&!S.current&&(S.current=!0,c(u.configured?I>0?`review`:`search`:`setup`))},R=[u,I],r[8]=u,r[9]=I,r[10]=L,r[11]=R):(L=r[10],R=r[11]),(0,j.useEffect)(L,R);let z=!!u?.configured,B,V,H,U,W;if(r[12]!==z||r[13]!==a||r[14]!==i||r[15]!==u){let e=u?.kbs.reduce(oe,0)??0;B=g,W=i,r[21]===a?V=r[22]:(V=e=>!e&&a(),r[21]=a,r[22]=V),H=`Knowledge`,U=u?z?`What your agents have learned, shared with every session. ${k(e,`entry`,`entries`)} in ${k(u.kbs.length,`knowledge base`,`knowledge bases`)}.`:`Shared memory for your agents: decisions, conventions and gotchas that every new session starts with.`:`Loading…`,r[12]=z,r[13]=a,r[14]=i,r[15]=u,r[16]=B,r[17]=V,r[18]=H,r[19]=U,r[20]=W}else B=r[16],V=r[17],H=r[18],U=r[19],W=r[20];let le;r[23]===Symbol.for(`react.memo_cache_sentinel`)?(le=e=>c(e),r[23]=le):le=r[23];let G;r[24]===I?G=r[25]:(G=I>0&&(0,N.jsx)(o,{tone:`warning`,className:`bd-kb-tabcount`,children:I}),r[24]=I,r[25]=G);let K;r[26]===G?K=r[27]:(K=(0,N.jsxs)(y,{value:`review`,children:[`Review`,G]}),r[26]=G,r[27]=K);let ue,de,fe;r[28]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,N.jsx)(y,{value:`search`,children:`Search`}),de=(0,N.jsx)(y,{value:`intents`,children:`Intents`}),fe=(0,N.jsx)(y,{value:`setup`,children:`Setup`}),r[28]=ue,r[29]=de,r[30]=fe):(ue=r[28],de=r[29],fe=r[30]);let q;r[31]===K?q=r[32]:(q=(0,N.jsxs)(ee,{"aria-label":`Knowledge sections`,children:[K,ue,de,fe]}),r[31]=K,r[32]=q);let J;r[33]!==z||r[34]!==u||r[35]!==s?(J=u&&!z&&s!==`setup`&&(0,N.jsx)(d,{className:`bd-kb-banner`,tone:`info`,title:`Connect a harness repository first`,description:`Knowledge is stored in a private git repository. Until one is connected there is nothing to review or search.`,action:(0,N.jsx)(l,{size:`sm`,variant:`solid`,onClick:()=>c(`setup`),children:`Go to Setup`})}),r[33]=z,r[34]=u,r[35]=s,r[36]=J):J=r[36];let Y;r[37]!==z||r[38]!==F||r[39]!==v||r[40]!==a||r[41]!==m?(Y=(0,N.jsx)(x,{value:`review`,children:(0,N.jsx)(re,{proposals:m,gates:F,intents:v,configured:z,onChanged:T,onOpenCard:a})}),r[37]=z,r[38]=F,r[39]=v,r[40]=a,r[41]=m,r[42]=Y):Y=r[42];let X;r[43]!==z||r[44]!==u?(X=(0,N.jsx)(x,{value:`search`,children:(0,N.jsx)(ie,{configured:z,status:u})}),r[43]=z,r[44]=u,r[45]=X):X=r[45];let Z;r[46]===v?Z=r[47]:(Z=(0,N.jsx)(x,{value:`intents`,children:(0,N.jsx)(ne,{intents:v,onChanged:T})}),r[46]=v,r[47]=Z);let Q;r[48]===u?Q=r[49]:(Q=(0,N.jsx)(x,{value:`setup`,children:(0,N.jsx)(ae,{status:u,onChanged:T})}),r[48]=u,r[49]=Q);let $;r[50]!==Y||r[51]!==X||r[52]!==Z||r[53]!==Q?($=(0,N.jsxs)(`div`,{className:`bd-kb-body`,children:[Y,X,Z,Q]}),r[50]=Y,r[51]=X,r[52]=Z,r[53]=Q,r[54]=$):$=r[54];let pe;r[55]!==q||r[56]!==J||r[57]!==$||r[58]!==s?(pe=(0,N.jsxs)(te,{value:s,onValueChange:le,children:[q,J,$]}),r[55]=q,r[56]=J,r[57]=$,r[58]=s,r[59]=pe):pe=r[59];let me;return r[60]!==B||r[61]!==V||r[62]!==H||r[63]!==U||r[64]!==pe||r[65]!==W?(me=(0,N.jsx)(B,{open:W,onOpenChange:V,title:H,description:U,width:880,children:pe}),r[60]=B,r[61]=V,r[62]=H,r[63]=U,r[64]=pe,r[65]=W,r[66]=me):me=r[66],me}function oe(e,t){return e+t.entries}function se(e){return e.link.gate?.status===`pending`}function ce(e){return e.cards}export{V as default};
@@ -0,0 +1,3 @@
1
+ import{d as e,m as t,t as n,u as r}from"./jsx-runtime-QmcfnBgR.js";import{A as i,D as a,F as o,G as s,I as c,M as l,N as u,P as d,R as f,a as p,c as m,gt as h,ht as g,j as _,k as ee,l as v,o as y,ot as b,q as x,s as te,w as ne,z as re}from"./index-CQnL8JJ5.js";var ie=r(),ae=t(e(),1),S=n(),C=`devboard.listCollapsedColumns`,w=`pinned`;function oe(){try{let e=window.localStorage.getItem(C);return new Set(e?JSON.parse(e):[])}catch{return new Set}}function T(e){try{window.localStorage.setItem(C,JSON.stringify(Array.from(e)))}catch{}}function se(){let e=(0,ie.c)(16),t=g(k),n=g(ce),r=g(O),i=g(D),a=g(h(E)),[o,c]=(0,ae.useState)(oe),l=(0,ae.useRef)(null),u;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),T(n),n})},e[0]=u):u=e[0];let d=u,f;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=Array.from(l.current?.querySelectorAll(`[data-ls-stop]`)??[]),n=t.indexOf(document.activeElement);n!==-1&&(e.preventDefault(),t[Math.max(0,Math.min(t.length-1,n+(e.key===`ArrowDown`?1:-1)))]?.focus())},e[1]=f):f=e[1];let p=f,m;if(e[2]!==t||e[3]!==i||e[4]!==o||e[5]!==a||e[6]!==r||e[7]!==n){let c=n===null?b(t,r):null,u;e[9]===i?u=e[10]:(u=e=>s.map(t=>({id:t,cid:e===void 0?t:`${e}|${t}`,label:x[t],cards:i(t,e)})),e[9]=i,e[10]=u);let f=u,h;e[11]===o?h=e[12]:(h=e=>(0,S.jsx)(A,{id:e.id,cid:e.cid,label:e.label,cards:e.cards,open:!o.has(e.cid),onToggle:d},e.cid),e[11]=o,e[12]=h);let g=h,_;e[13]!==a||e[14]!==g?(_=a.length>0&&g({id:w,cid:w,label:`Pinned`,cards:a}),e[13]=a,e[14]=g,e[15]=_):_=e[15],m=(0,S.jsxs)(`div`,{ref:l,className:`ls-root`,onKeyDown:p,role:`list`,"aria-label":`Cards by status`,children:[_,c?c.map(e=>(0,S.jsxs)(`section`,{className:`ls-project`,"aria-label":e.name,children:[(0,S.jsx)(`h2`,{className:`ls-project-head`,title:e.path||void 0,children:e.name}),f(e.path).map(g)]},e.path)):f().map(g)]}),e[2]=t,e[3]=i,e[4]=o,e[5]=a,e[6]=r,e[7]=n,e[8]=m}else m=e[8];return m}function E(e){return e.pinnedCards()}function D(e){return e.cardsInColumn}function O(e){return e.projects}function ce(e){return e.selectedProjectPath}function k(e){return e.cards}function A(e){let t=(0,ie.c)(36),{id:n,cid:r,label:i,cards:a,open:o,onToggle:s}=e,u=`ls-body-${(0,ae.useId)()}`,d;t[0]!==r||t[1]!==s?(d=()=>s(r),t[0]=r,t[1]=s,t[2]=d):d=t[2];let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,S.jsx)(l,{}),t[3]=f):f=t[3];let p;t[4]===o?p=t[5]:(p=(0,S.jsx)(`span`,{className:`ls-chev`,"data-open":o,children:f}),t[4]=o,t[5]=p);let m;t[6]===n?m=t[7]:(m=n===w&&(0,S.jsx)(`span`,{className:`ls-head-icon`,children:(0,S.jsx)(c,{})}),t[6]=n,t[7]=m);let h;t[8]===i?h=t[9]:(h=(0,S.jsx)(`span`,{className:`ls-head-title`,children:i}),t[8]=i,t[9]=h);let g;t[10]===a.length?g=t[11]:(g=(0,S.jsx)(`span`,{className:`ls-head-count`,children:a.length}),t[10]=a.length,t[11]=g);let _;t[12]!==u||t[13]!==o||t[14]!==d||t[15]!==p||t[16]!==m||t[17]!==h||t[18]!==g?(_=(0,S.jsxs)(`button`,{type:`button`,className:`ls-head`,"data-ls-stop":!0,"aria-expanded":o,"aria-controls":u,onClick:d,children:[p,m,h,g]}),t[12]=u,t[13]=o,t[14]=d,t[15]=p,t[16]=m,t[17]=h,t[18]=g,t[19]=_):_=t[19];let ee=!o,v;t[20]!==a||t[21]!==n?(v=a.length===0?(0,S.jsx)(`p`,{className:`ls-empty`,children:n===`backlog`?`Nothing queued. New tasks land here.`:`No cards in this status.`}):a.map(j),t[20]=a,t[21]=n,t[22]=v):v=t[22];let y;t[23]!==u||t[24]!==v?(y=(0,S.jsx)(`div`,{id:u,className:`ls-body`,role:`list`,children:v}),t[23]=u,t[24]=v,t[25]=y):y=t[25];let b;t[26]!==y||t[27]!==ee?(b=(0,S.jsx)(`div`,{className:`ls-collapse-inner`,inert:ee,children:y}),t[26]=y,t[27]=ee,t[28]=b):b=t[28];let x;t[29]!==o||t[30]!==b?(x=(0,S.jsx)(`div`,{className:`ls-collapse`,"data-open":o,children:b}),t[29]=o,t[30]=b,t[31]=x):x=t[31];let te;return t[32]!==o||t[33]!==x||t[34]!==_?(te=(0,S.jsxs)(`section`,{className:`ls-group`,role:`listitem`,"data-open":o,children:[_,x]}),t[32]=o,t[33]=x,t[34]=_,t[35]=te):te=t[35],te}function j(e){return(0,S.jsx)(le,{card:e},e.id)}var le=(0,ae.memo)(function(e){let t=(0,ie.c)(107),{card:n}=e,{selectCard:r,moveCard:l,deleteCard:b,archiveCard:C,setCardPinned:w}=g(h(ue)),oe;t[0]===n.id?oe=t[1]:(oe=e=>e.selectedCardId===n.id,t[0]=n.id,t[1]=oe);let T=g(oe),se=(0,ae.useRef)(null),E=n.link.worktreeLink?.branch,D=n.link.prLinks[0],O=n.link.issueLink,ce;t[2]!==n.activityState||t[3]!==n.showSpinner?(ce=m(n.activityState,n.showSpinner),t[2]=n.activityState,t[3]=n.showSpinner,t[4]=ce):ce=t[4];let k=ce,A=!!n.link.pinnedAt,j=s[s.indexOf(n.link.column)+1],le;t[5]!==n.id||t[6]!==l?(le=e=>f(n.id,se.current,()=>l(n.id,e)),t[5]=n.id,t[6]=l,t[7]=le):le=t[7];let M=le,fe;t[8]!==n.id||t[9]!==A||t[10]!==w?(fe=()=>f(n.id,se.current,()=>w(n.id,!A)),t[8]=n.id,t[9]=A,t[10]=w,t[11]=fe):fe=t[11];let N=fe,pe;t[12]!==n.id||t[13]!==T||t[14]!==r?(pe=()=>r(T?null:n.id),t[12]=n.id,t[13]=T,t[14]=r,t[15]=pe):pe=t[15];let P=pe,me;t[16]!==n.displayTitle||t[17]!==n.id||t[18]!==n.link.name||t[19]!==b?(me=async()=>{let e=n.displayTitle||n.link.name||`this card`;await re(`Delete "${e}"?
2
+
3
+ The Claude session .jsonl on disk is not deleted — you can still find it in All Sessions.`,{title:`Delete card`,kind:`warning`,okLabel:`Delete`,cancelLabel:`Cancel`})&&b(n.id)},t[16]=n.displayTitle,t[17]=n.id,t[18]=n.link.name,t[19]=b,t[20]=me):me=t[20];let he=me,ge;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(ge={display:`contents`},t[21]=ge):ge=t[21];let F;t[22]!==C||t[23]!==n.id?(F=()=>C(n.id),t[22]=C,t[23]=n.id,t[24]=F):F=t[24];let I;t[25]!==n||t[26]!==M||t[27]!==N||t[28]!==he||t[29]!==F?(I=(0,S.jsx)(y,{card:n,onMove:M,onTogglePin:N,onArchive:F,onDelete:he}),t[25]=n,t[26]=M,t[27]=N,t[28]=he,t[29]=F,t[30]=I):I=t[30];let _e=n.activityState===`needsAttention`,ve=T||void 0,ye;t[31]===P?ye=t[32]:(ye=e=>{(e.key===`Enter`||e.key===` `)&&e.target===e.currentTarget&&(e.preventDefault(),P())},t[31]=P,t[32]=ye);let be=k?.label,L;t[33]===k?L=t[34]:(L=k?(0,S.jsx)(`span`,{className:`bd-dot`,"data-tone":k.tone,"data-pulse":k.pulse,role:`img`,"aria-label":k.label}):(0,S.jsx)(`span`,{className:`bd-dot`,"aria-hidden":!0}),t[33]=k,t[34]=L);let R;t[35]!==be||t[36]!==L?(R=(0,S.jsx)(`span`,{className:`ls-state`,title:be,children:L}),t[35]=be,t[36]=L,t[37]=R):R=t[37];let z;t[38]===n.displayTitle?z=t[39]:(z=(0,S.jsx)(`span`,{className:`ls-title`,title:n.displayTitle,children:n.displayTitle}),t[38]=n.displayTitle,t[39]=z);let B;t[40]!==n.projectName||t[41]!==k?(B=(n.projectName||k)&&(0,S.jsxs)(`span`,{className:`ls-sub`,children:[k&&(0,S.jsx)(`span`,{className:`bd-state`,"data-tone":k.tone,children:k.label}),k&&n.projectName&&(0,S.jsx)(`span`,{"aria-hidden":!0,children:`·`}),n.projectName&&(0,S.jsx)(`span`,{className:`ls-project`,children:n.projectName})]}),t[40]=n.projectName,t[41]=k,t[42]=B):B=t[42];let V;t[43]!==z||t[44]!==B?(V=(0,S.jsxs)(`div`,{className:`ls-main`,children:[z,B]}),t[43]=z,t[44]=B,t[45]=V):V=t[45];let H;t[46]===E?H=t[47]:(H=E&&(0,S.jsxs)(`span`,{className:`bd-chip bd-chip--branch`,title:`Branch: ${E}`,children:[(0,S.jsx)(_,{}),(0,S.jsx)(`span`,{children:E})]}),t[46]=E,t[47]=H);let U;t[48]===H?U=t[49]:(U=(0,S.jsx)(`div`,{className:`ls-cell ls-cell--branch`,children:H}),t[48]=H,t[49]=U);let W;t[50]===D?W=t[51]:(W=D&&(0,S.jsx)(te,{pr:D,ci:v(D.checkRuns)}),t[50]=D,t[51]=W);let G;t[52]===W?G=t[53]:(G=(0,S.jsx)(`div`,{className:`ls-cell ls-cell--pr`,children:W}),t[52]=W,t[53]=G);let K;t[54]===O?K=t[55]:(K=O&&(0,S.jsxs)(`span`,{className:`bd-chip`,title:O.title??`Issue #${O.number}`,children:[(0,S.jsx)(o,{}),(0,S.jsxs)(`span`,{children:[`#`,O.number]})]}),t[54]=O,t[55]=K);let q;t[56]===K?q=t[57]:(q=(0,S.jsx)(`div`,{className:`ls-cell ls-cell--issue`,children:K}),t[56]=K,t[57]=q);let J;t[58]===A?J=t[59]:(J=A&&(0,S.jsx)(`span`,{className:`ls-pin`,role:`img`,"aria-label":`Pinned`,children:(0,S.jsx)(c,{})}),t[58]=A,t[59]=J);let Y;t[60]===n.relativeTime?Y=t[61]:(Y=(0,S.jsx)(`time`,{className:`ls-time`,children:n.relativeTime}),t[60]=n.relativeTime,t[61]=Y);let X;t[62]!==M||t[63]!==j?(X=j&&(0,S.jsx)(p,{label:`Move to ${x[j]}`,onClick:()=>M(j),children:(0,S.jsx)(i,{})}),t[62]=M,t[63]=j,t[64]=X):X=t[64];let Z;t[65]===D?Z=t[66]:(Z=D?.url&&(0,S.jsx)(p,{label:`Open PR #${D.number}`,onClick:()=>window.open(D.url,`_blank`,`noopener`),children:(0,S.jsx)(d,{})}),t[65]=D,t[66]=Z);let Q;t[67]===E?Q=t[68]:(Q=E&&(0,S.jsx)(p,{label:`Copy branch name`,onClick:()=>{navigator.clipboard?.writeText(E),a(`Branch copied`)},children:(0,S.jsx)(u,{})}),t[67]=E,t[68]=Q);let xe=A?`Unpin`:`Pin to top`,Se;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,S.jsx)(c,{}),t[69]=Se):Se=t[69];let $;t[70]!==N||t[71]!==A||t[72]!==xe?($=(0,S.jsx)(p,{label:xe,pressed:A,onClick:N,children:Se}),t[70]=N,t[71]=A,t[72]=xe,t[73]=$):$=t[73];let Ce;t[74]!==C||t[75]!==n.id?(Ce=()=>f(n.id,se.current,()=>C(n.id)),t[74]=C,t[75]=n.id,t[76]=Ce):Ce=t[76];let we;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,S.jsx)(ee,{}),t[77]=we):we=t[77];let Te;t[78]===Ce?Te=t[79]:(Te=(0,S.jsx)(p,{label:`Archive`,onClick:Ce,children:we}),t[78]=Ce,t[79]=Te);let Ee;t[80]!==X||t[81]!==Z||t[82]!==Q||t[83]!==$||t[84]!==Te?(Ee=(0,S.jsxs)(`div`,{className:`ls-actions`,onClick:de,children:[X,Z,Q,$,Te]}),t[80]=X,t[81]=Z,t[82]=Q,t[83]=$,t[84]=Te,t[85]=Ee):Ee=t[85];let De;t[86]!==J||t[87]!==Y||t[88]!==Ee?(De=(0,S.jsxs)(`div`,{className:`ls-end`,children:[J,Y,Ee]}),t[86]=J,t[87]=Y,t[88]=Ee,t[89]=De):De=t[89];let Oe;t[90]!==n.displayTitle||t[91]!==n.id||t[92]!==T||t[93]!==P||t[94]!==_e||t[95]!==ve||t[96]!==ye||t[97]!==R||t[98]!==V||t[99]!==U||t[100]!==G||t[101]!==q||t[102]!==De?(Oe=(0,S.jsxs)(`div`,{ref:se,role:`listitem`,tabIndex:0,"data-ls-stop":!0,"data-card-id":n.id,"data-selected":T,"data-attention":_e,className:`ls-row`,"aria-label":n.displayTitle,"aria-current":ve,onClick:P,onKeyDown:ye,children:[R,V,U,G,q,De]}),t[90]=n.displayTitle,t[91]=n.id,t[92]=T,t[93]=P,t[94]=_e,t[95]=ve,t[96]=ye,t[97]=R,t[98]=V,t[99]=U,t[100]=G,t[101]=q,t[102]=De,t[103]=Oe):Oe=t[103];let ke;return t[104]!==Oe||t[105]!==I?(ke=(0,S.jsx)(ne,{style:ge,menu:I,children:Oe}),t[104]=Oe,t[105]=I,t[106]=ke):ke=t[106],ke});function ue(e){return{selectCard:e.selectCard,moveCard:e.moveCard,deleteCard:e.deleteCard,archiveCard:e.archiveCard,setCardPinned:e.setCardPinned}}function de(e){return e.stopPropagation()}export{se as default};
@@ -0,0 +1 @@
1
+ import{d as e,m as t,t as n}from"./jsx-runtime-QmcfnBgR.js";import{o as r,t as i}from"./TaskDescriptionEditor-D0_b81zY.js";import{o as a,p as o}from"./Surface-BQKeigoq.js";import{T as s,_ as c,b as l,et as u,g as d,h as f,ht as p,v as m,y as h}from"./index-CQnL8JJ5.js";var g=t(e(),1),_=n(),v=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform);function y(e,t){return t?e.find(e=>e===t)||(e.filter(e=>t.startsWith(e+`/`)||t.startsWith(e+`\\`)).sort((e,t)=>t.length-e.length)[0]??null):null}function b(){let e=p(e=>e.createCard),t=p(e=>e.setNewTaskOpen),n=p(e=>e.selectCard),b=p(e=>e.cards),x=p(e=>e.newTaskProject),[S,C]=(0,g.useState)(``),[w,T]=(0,g.useState)(``),[E,D]=(0,g.useState)(``),[O,k]=(0,g.useState)(!0),A=`claude`,[j,M]=(0,g.useState)(!1),[N,P]=(0,g.useState)([]),[F,I]=(0,g.useState)([]),[L,R]=(0,g.useState)([]),[z,B]=(0,g.useState)({}),[V,H]=(0,g.useState)(null),U=(0,g.useRef)(null),[W,G]=(0,g.useState)([]),K=[...new Set(b.map(e=>e.link.projectPath??e.session?.projectPath).filter(Boolean))],q=N.length>0?N:K.slice(0,30);(0,g.useEffect)(()=>{u().then(e=>{let t=e.projects.map(e=>e.path).filter(Boolean);P(t),!E&&t.length>0?D(y(t,x)??t[0]):!E&&x&&D(x),R(e.apiServices??[]),B(e.defaultAPIServiceIds??{})}).catch(console.error)},[]);let J=async i=>{if(i.preventDefault(),S.trim()&&!j){M(!0);try{let i=await e(r(S,W),w.trim()||null,E||`.`,O,A,F.length>0?F:void 0,V);t(!1),O&&i&&n(i)}finally{M(!1)}}},Y=()=>t(!1),X=L.filter(e=>e.assistant===A);return(0,_.jsx)(s,{open:!0,onOpenChange:e=>!e&&Y(),title:`New task`,description:`Describe what Claude should do. Each task becomes a card with its own session.`,width:640,footer:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`span`,{className:`nt-shortcut`,children:[(0,_.jsx)(o,{children:v?`⌘`:`Ctrl`}),(0,_.jsx)(o,{children:`↵`}),(0,_.jsxs)(`span`,{children:[`to `,O?`create & start`:`create`]})]}),(0,_.jsx)(a,{variant:`ghost`,onClick:Y,children:`Cancel`}),(0,_.jsx)(a,{type:`submit`,form:`new-task-form`,variant:`solid`,disabled:!S.trim()||j,children:j?`Creating...`:O?`Create & start`:`Create task`})]}),children:(0,_.jsxs)(`form`,{id:`new-task-form`,ref:U,onSubmit:J,className:`flex flex-col gap-4`,onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),U.current?.requestSubmit())},onDragOver:e=>e.dataTransfer.types.includes(`Files`)&&e.preventDefault(),onDrop:e=>e.dataTransfer.types.includes(`Files`)&&e.preventDefault(),children:[(0,_.jsxs)(d,{children:[(0,_.jsxs)(h,{htmlFor:`nt-title`,children:[`Title `,(0,_.jsx)(`span`,{className:`tg-muted`,children:`(optional, defaults to the first line)`})]}),(0,_.jsx)(m,{id:`nt-title`,placeholder:`Short name shown on the board card`,value:w,onChange:e=>T(e.target.value),autoComplete:`off`})]}),(0,_.jsxs)(d,{children:[(0,_.jsx)(h,{htmlFor:`nt-prompt`,children:`Description`}),(0,_.jsx)(i,{initialValue:``,onChange:C,imagePaths:F,onImagePathsChange:I,files:W,onFilesChange:G,autoFocus:!0})]}),(0,_.jsxs)(`div`,{className:`nt-row`,"data-cols":X.length>0?2:1,children:[(0,_.jsxs)(d,{children:[(0,_.jsx)(h,{htmlFor:`nt-project`,children:`Project`}),q.length>0?(0,_.jsx)(l,{id:`nt-project`,value:E,onValueChange:D,options:q.map(e=>({value:e,label:e.split(/[/\\]/).pop()??e}))}):(0,_.jsx)(m,{id:`nt-project`,placeholder:`C:\\path\\to\\project`,value:E,onChange:e=>D(e.target.value)})]}),X.length>0&&(0,_.jsxs)(d,{children:[(0,_.jsx)(h,{htmlFor:`nt-api`,children:`API service`}),(0,_.jsx)(l,{id:`nt-api`,value:V??``,onValueChange:e=>H(e||null),options:[{value:``,label:z[A]?`Default: ${L.find(e=>e.id===z[A])?.name??`configured default`}`:`Default: bare CLI`},...X.map(e=>({value:e.id,label:e.name}))]})]})]}),(0,_.jsxs)(d,{children:[(0,_.jsx)(f,{checked:O,onCheckedChange:k,label:`Start immediately in terminal`}),(0,_.jsx)(c,{children:O?`Claude starts working as soon as the card is created.`:`The card is added to the backlog; start it later.`})]})]})})}export{b as default};
@@ -0,0 +1 @@
1
+ import{d as e,m as t,t as n,u as r}from"./jsx-runtime-QmcfnBgR.js";import{B as i,H as a,V as o,Z as s,et as c,ut as l}from"./index-CQnL8JJ5.js";var u=r(),d=t(e(),1),f=n(),p=5;function m({onComplete:e}){let{theme:t}=a(),n=o(t),[r,u]=(0,d.useState)(0),[m,y]=(0,d.useState)(null),[x,S]=(0,d.useState)(!1),[C,w]=(0,d.useState)(null);(0,d.useEffect)(()=>{T(),c().then(w).catch(console.error)},[]);let T=async()=>{S(!0);try{let e=await s();y(e)}catch(e){console.error(e)}finally{S(!1)}},E=()=>u(e=>Math.min(e+1,4)),D=()=>u(e=>Math.max(e-1,0)),O=async()=>{C&&await l({...C,hasCompletedOnboarding:!0}),e()},k=async()=>{let e=await i(`Select project folder`);if(!e||!C||C.projects.find(t=>t.path===e))return;let t={...C,projects:[...C.projects,{path:e}]};w(t),await l(t)},A=async e=>{if(!C)return;let t={...C,projects:C.projects.filter(t=>t.path!==e)};w(t),await l(t)};return(0,f.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center`,style:{background:n.bg},children:(0,f.jsxs)(`div`,{className:`w-[560px] rounded-[34px] flex flex-col overflow-hidden`,style:{...n.mat.ultrathick,border:`1px solid ${n.borderBright}`},children:[(0,f.jsx)(`div`,{className:`flex items-center justify-center gap-2 pt-6 pb-3`,children:Array.from({length:p}).map((e,t)=>(0,f.jsx)(`div`,{className:`w-2 h-2 rounded-full transition-colors`,style:{background:t===r?`var(--ink)`:t<r?`#3fb950`:n.bgAccent(`0.10`)}},t))}),(0,f.jsx)(`div`,{style:{borderTop:`1px solid ${n.border}`}}),(0,f.jsxs)(`div`,{className:`flex-1 min-h-[320px] p-8`,children:[r===0&&(0,f.jsx)(h,{themeTokens:n}),r===1&&(0,f.jsx)(g,{deps:m,checking:x,onRecheck:T,themeTokens:n}),r===2&&(0,f.jsx)(_,{deps:m,checking:x,onRecheck:T,themeTokens:n}),r===3&&(0,f.jsx)(v,{settings:C,onAdd:k,onRemove:A,themeTokens:n}),r===4&&(0,f.jsx)(b,{deps:m,settings:C,themeTokens:n})]}),(0,f.jsx)(`div`,{style:{borderTop:`1px solid ${n.border}`}}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4`,children:[(0,f.jsx)(`div`,{children:r>0&&r<4&&(0,f.jsx)(`button`,{onClick:D,className:`px-4 py-2 rounded-lg text-[13px] transition-colors`,style:{color:n.textMuted},onMouseEnter:e=>{e.currentTarget.style.background=n.hoverBg,e.currentTarget.style.color=n.textPrimary},onMouseLeave:e=>{e.currentTarget.style.background=``,e.currentTarget.style.color=n.textMuted},children:`Back`})}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r>0&&r<4&&(0,f.jsx)(`button`,{onClick:E,className:`px-4 py-2 rounded-lg text-[13px] transition-colors`,style:{color:n.textMuted},onMouseEnter:e=>{e.currentTarget.style.color=n.textSecondary},onMouseLeave:e=>{e.currentTarget.style.color=n.textMuted},children:`Skip`}),r<4?(0,f.jsx)(`button`,{onClick:E,className:`px-5 py-2 rounded-lg tg-btn tg-btn--solid tg-btn--sm text-[13px] font-medium transition-colors`,children:r===0?`Get Started`:`Continue`}):(0,f.jsx)(`button`,{onClick:O,className:`px-5 py-2 rounded-lg tg-btn tg-btn--solid tg-btn--sm text-[13px] font-medium transition-colors`,children:`Done`})]})]})]})})}function h(e){let t=(0,u.c)(8),{themeTokens:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,f.jsx)(`div`,{className:`w-16 h-16 rounded-2xl bg-gradient-to-br from-[var(--mist-1)] to-[var(--mist-3)] flex items-center justify-center `,children:(0,f.jsx)(`svg`,{className:`w-8 h-8 text-white`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:1.5,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25a2.25 2.25 0 0 1-2.25-2.25v-2.25Z`})})}),t[0]=r):r=t[0];let i;t[1]===n.textPrimary?i=t[2]:(i=(0,f.jsx)(`h2`,{className:`text-xl font-medium mb-2`,style:{color:n.textPrimary},children:`Welcome to DevBoard`}),t[1]=n.textPrimary,t[2]=i);let a;t[3]===n.textMuted?a=t[4]:(a=(0,f.jsx)(`p`,{className:`text-[14px] max-w-[360px] leading-relaxed`,style:{color:n.textMuted},children:`Let's set up everything you need to manage your Claude Code sessions on a visual devboard board.`}),t[3]=n.textMuted,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full text-center gap-5`,children:[r,(0,f.jsxs)(`div`,{children:[i,a]})]}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function g(e){let t=(0,u.c)(29),{deps:n,checking:r,onRecheck:i,themeTokens:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,f.jsx)(`svg`,{className:`w-5 h-5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:1.5,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z`})}),t[0]=o):o=t[0];let s;t[1]===a?s=t[2]:(s=(0,f.jsx)(x,{themeTokens:a,icon:o,title:`Claude Code CLI`,description:`DevBoard manages sessions from Claude Code. Make sure it's installed globally.`}),t[1]=a,t[2]=s);let c=n?.claudeAvailable??!1,l;t[3]!==a||t[4]!==c?(l=(0,f.jsx)(S,{label:`Claude Code`,ok:c,themeTokens:a}),t[3]=a,t[4]=c,t[5]=l):l=t[5];let d;t[6]!==a||t[7]!==r||t[8]!==n?.claudeAvailable||t[9]!==i?(d=n?.claudeAvailable?(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-[#3fb950] text-[13px]`,children:[(0,f.jsx)(w,{}),`Claude Code is installed and ready`]}):(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,f.jsx)(`p`,{className:`text-[12px]`,style:{color:a.textMuted},children:`Install Claude Code:`}),(0,f.jsx)(T,{command:`npm install -g @anthropic-ai/claude-code`,themeTokens:a}),(0,f.jsx)(`p`,{className:`text-[11px]`,style:{color:a.textDim},children:`DevBoard works without it — columns will just be empty until sessions are created.`}),(0,f.jsx)(E,{checking:r,onRecheck:i,themeTokens:a})]}),t[6]=a,t[7]=r,t[8]=n?.claudeAvailable,t[9]=i,t[10]=d):d=t[10];let p;t[11]===a.textDim?p=t[12]:(p={color:a.textDim},t[11]=a.textDim,t[12]=p);let m;t[13]===a.textMuted?m=t[14]:(m=(0,f.jsx)(`code`,{className:`font-mono`,style:{color:a.textMuted},children:`cmd.exe`}),t[13]=a.textMuted,t[14]=m);let h;t[15]===a.textMuted?h=t[16]:(h=(0,f.jsx)(`code`,{className:`font-mono`,style:{color:a.textMuted},children:`wsl.exe`}),t[15]=a.textMuted,t[16]=h);let g;t[17]===a.textSecondary?g=t[18]:(g=(0,f.jsx)(`span`,{style:{color:a.textSecondary},children:`Settings → Terminal shell`}),t[17]=a.textSecondary,t[18]=g);let _;t[19]!==p||t[20]!==m||t[21]!==h||t[22]!==g?(_=(0,f.jsxs)(`p`,{className:`text-[11px] leading-relaxed`,style:p,children:[`Using WSL? The embedded terminal defaults to`,` `,m,`. If you installed Claude inside WSL, switch it to`,` `,h,` `,`in `,g,` after onboarding.`]}),t[19]=p,t[20]=m,t[21]=h,t[22]=g,t[23]=_):_=t[23];let v;return t[24]!==_||t[25]!==s||t[26]!==l||t[27]!==d?(v=(0,f.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[s,l,d,_]}),t[24]=_,t[25]=s,t[26]=l,t[27]=d,t[28]=v):v=t[28],v}function _(e){let t=(0,u.c)(30),{deps:n,checking:r,onRecheck:i,themeTokens:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,f.jsx)(`svg`,{className:`w-5 h-5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:1.5,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m21 7.5-9-5.25L3 7.5m18 0-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9`})}),t[0]=o):o=t[0];let s;t[1]===a?s=t[2]:(s=(0,f.jsx)(x,{themeTokens:a,icon:o,title:`Dependencies`,description:`Tools that DevBoard uses for session management and GitHub integration.`}),t[1]=a,t[2]=s);let c=n?.gitAvailable??!1,l;t[3]!==a||t[4]!==c?(l=(0,f.jsx)(S,{label:`Git`,ok:c,themeTokens:a}),t[3]=a,t[4]=c,t[5]=l):l=t[5];let d=n?.ghAvailable??!1,p;t[6]!==a||t[7]!==d?(p=(0,f.jsx)(S,{label:`GitHub CLI (gh)`,ok:d,themeTokens:a}),t[6]=a,t[7]=d,t[8]=p):p=t[8];let m;t[9]!==a||t[10]!==n?.ghAuthenticated||t[11]!==n?.ghAvailable?(m=n?.ghAvailable&&!n?.ghAuthenticated&&(0,f.jsxs)(`div`,{className:`ml-6 flex items-center gap-1.5 text-[12px] text-amber-500`,children:[(0,f.jsx)(`svg`,{className:`w-3.5 h-3.5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z`})}),(0,f.jsxs)(`span`,{children:[`gh is installed but not logged in. Run`,` `,(0,f.jsx)(`code`,{className:`font-mono`,style:{color:a.textSecondary},children:`gh auth login`}),` `,`in a terminal.`]})]}),t[9]=a,t[10]=n?.ghAuthenticated,t[11]=n?.ghAvailable,t[12]=m):m=t[12];let h;t[13]!==l||t[14]!==p||t[15]!==m?(h=(0,f.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[l,p,m]}),t[13]=l,t[14]=p,t[15]=m,t[16]=h):h=t[16];let g;t[17]!==a||t[18]!==n?.ghAvailable||t[19]!==n?.gitAvailable?(g=(!n?.gitAvailable||!n?.ghAvailable)&&(0,f.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,f.jsx)(`p`,{className:`text-[12px]`,style:{color:a.textMuted},children:`Install missing tools:`}),!n?.gitAvailable&&(0,f.jsx)(T,{command:`winget install Git.Git`,themeTokens:a}),!n?.ghAvailable&&(0,f.jsx)(T,{command:`winget install GitHub.cli`,themeTokens:a})]}),t[17]=a,t[18]=n?.ghAvailable,t[19]=n?.gitAvailable,t[20]=g):g=t[20];let _;t[21]!==a||t[22]!==r||t[23]!==i?(_=(0,f.jsx)(E,{checking:r,onRecheck:i,themeTokens:a}),t[21]=a,t[22]=r,t[23]=i,t[24]=_):_=t[24];let v;return t[25]!==_||t[26]!==s||t[27]!==h||t[28]!==g?(v=(0,f.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[s,h,g,_]}),t[25]=_,t[26]=s,t[27]=h,t[28]=g,t[29]=v):v=t[29],v}function v(e){let t=(0,u.c)(18),{settings:n,onAdd:r,onRemove:i,themeTokens:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,f.jsx)(`svg`,{className:`w-5 h-5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:1.5,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M2.25 12.75V12A2.25 2.25 0 0 1 4.5 9.75h15A2.25 2.25 0 0 1 21.75 12v.75m-8.69-6.44-2.12-2.12a1.5 1.5 0 0 0-1.061-.44H4.5A2.25 2.25 0 0 0 2.25 6v12a2.25 2.25 0 0 0 2.25 2.25h15A2.25 2.25 0 0 0 21.75 18V9a2.25 2.25 0 0 0-2.25-2.25h-5.379a1.5 1.5 0 0 1-1.06-.44Z`})}),t[0]=o):o=t[0];let s;t[1]===a?s=t[2]:(s=(0,f.jsx)(x,{themeTokens:a,icon:o,title:`Add a Project`,description:`Select the folder(s) where you use Claude Code. Sessions and git worktrees in these folders will appear on the board.`}),t[1]=a,t[2]=s);let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,f.jsx)(`svg`,{className:`w-4 h-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 4.5v15m7.5-7.5h-15`})}),t[3]=c):c=t[3];let l;t[4]===r?l=t[5]:(l=(0,f.jsxs)(`button`,{onClick:r,className:`flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl tg-btn tg-btn--solid tg-btn--sm text-[13px] font-medium transition-all w-fit`,children:[c,`Add Project Folder`]}),t[4]=r,t[5]=l);let d;t[6]!==a||t[7]!==i||t[8]!==n?(d=n&&n.projects.length>0&&(0,f.jsx)(`div`,{className:`flex flex-col gap-1.5 max-h-[160px] overflow-y-auto`,children:n.projects.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2.5 rounded-xl`,style:{background:a.bgCard,border:`1px solid ${a.borderCard}`},children:[(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-[13px] truncate`,style:{color:a.textSecondary},children:e.name??e.path.split(/[/\\]/).pop()??e.path}),(0,f.jsx)(`p`,{className:`text-[11px] font-mono truncate`,style:{color:a.textMuted},children:e.path})]}),(0,f.jsx)(`button`,{onClick:()=>i(e.path),className:`ml-2 shrink-0 transition-colors`,style:{color:a.textDim},onMouseEnter:y,onMouseLeave:e=>{e.currentTarget.style.color=a.textDim},children:(0,f.jsx)(`svg`,{className:`w-4 h-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 18 18 6M6 6l12 12`})})})]},e.path))}),t[6]=a,t[7]=i,t[8]=n,t[9]=d):d=t[9];let p;t[10]!==a||t[11]!==n?(p=(!n||n.projects.length===0)&&(0,f.jsx)(`p`,{className:`text-[12px]`,style:{color:a.textDim},children:`No projects added yet. You can always add more later in Settings.`}),t[10]=a,t[11]=n,t[12]=p):p=t[12];let m;return t[13]!==s||t[14]!==l||t[15]!==d||t[16]!==p?(m=(0,f.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[s,l,d,p]}),t[13]=s,t[14]=l,t[15]=d,t[16]=p,t[17]=m):m=t[17],m}function y(e){e.currentTarget.style.color=`#f85149`}function b(e){let t=(0,u.c)(26),{deps:n,settings:r,themeTokens:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,f.jsx)(`svg`,{className:`w-5 h-5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:1.5,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12.75 11.25 15 15 9.75M21 12c0 1.268-.63 2.39-1.593 3.068a3.745 3.745 0 0 1-1.043 3.296 3.745 3.745 0 0 1-3.296 1.043A3.745 3.745 0 0 1 12 21c-1.268 0-2.39-.63-3.068-1.593a3.746 3.746 0 0 1-3.296-1.043 3.746 3.746 0 0 1-1.043-3.296A3.745 3.745 0 0 1 3 12c0-1.268.63-2.39 1.593-3.068a3.746 3.746 0 0 1 1.043-3.296 3.746 3.746 0 0 1 3.296-1.043A3.746 3.746 0 0 1 12 3c1.268 0 2.39.63 3.068 1.593a3.746 3.746 0 0 1 3.296 1.043 3.746 3.746 0 0 1 1.043 3.296A3.745 3.745 0 0 1 21 12Z`})}),t[0]=a):a=t[0];let o;t[1]===i?o=t[2]:(o=(0,f.jsx)(x,{themeTokens:i,icon:a,title:`Setup Complete`,description:`Here's a summary of your configuration.`}),t[1]=i,t[2]=o);let s=n?.claudeAvailable??!1,c;t[3]!==i||t[4]!==s?(c=(0,f.jsx)(C,{label:`Claude Code`,ok:s,themeTokens:i}),t[3]=i,t[4]=s,t[5]=c):c=t[5];let l=n?.gitAvailable??!1,d;t[6]!==i||t[7]!==l?(d=(0,f.jsx)(C,{label:`Git`,ok:l,themeTokens:i}),t[6]=i,t[7]=l,t[8]=d):d=t[8];let p=n?.ghAuthenticated??!1,m;t[9]!==i||t[10]!==p?(m=(0,f.jsx)(C,{label:`GitHub CLI`,ok:p,themeTokens:i}),t[9]=i,t[10]=p,t[11]=m):m=t[11];let h=(r?.projects.length??0)>0,g;t[12]!==i||t[13]!==h?(g=(0,f.jsx)(C,{label:`Projects`,ok:h,themeTokens:i}),t[12]=i,t[13]=h,t[14]=g):g=t[14];let _;t[15]!==g||t[16]!==c||t[17]!==d||t[18]!==m?(_=(0,f.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[c,d,m,g]}),t[15]=g,t[16]=c,t[17]=d,t[18]=m,t[19]=_):_=t[19];let v;t[20]===i.textDim?v=t[21]:(v=(0,f.jsx)(`p`,{className:`text-[11px] mt-1`,style:{color:i.textDim},children:`You can always reopen this wizard or change settings later from the Settings page.`}),t[20]=i.textDim,t[21]=v);let y;return t[22]!==_||t[23]!==v||t[24]!==o?(y=(0,f.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[o,_,v]}),t[22]=_,t[23]=v,t[24]=o,t[25]=y):y=t[25],y}function x(e){let t=(0,u.c)(18),{icon:n,title:r,description:i,themeTokens:a}=e,o;t[0]===n?o=t[1]:(o=(0,f.jsx)(`span`,{className:`text-[color:var(--ink)]`,children:n}),t[0]=n,t[1]=o);let s;t[2]===a.textPrimary?s=t[3]:(s={color:a.textPrimary},t[2]=a.textPrimary,t[3]=s);let c;t[4]!==s||t[5]!==r?(c=(0,f.jsx)(`h3`,{className:`text-[16px] font-medium`,style:s,children:r}),t[4]=s,t[5]=r,t[6]=c):c=t[6];let l;t[7]!==o||t[8]!==c?(l=(0,f.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[o,c]}),t[7]=o,t[8]=c,t[9]=l):l=t[9];let d;t[10]===a.textMuted?d=t[11]:(d={color:a.textMuted},t[10]=a.textMuted,t[11]=d);let p;t[12]!==i||t[13]!==d?(p=(0,f.jsx)(`p`,{className:`text-[13px] leading-relaxed`,style:d,children:i}),t[12]=i,t[13]=d,t[14]=p):p=t[14];let m;return t[15]!==l||t[16]!==p?(m=(0,f.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[l,p]}),t[15]=l,t[16]=p,t[17]=m):m=t[17],m}function S(e){let t=(0,u.c)(17),{label:n,ok:r,themeTokens:i}=e,a;t[0]!==i.textDim||t[1]!==r?(a=r?(0,f.jsx)(`svg`,{className:`w-4 h-4 text-[#3fb950]`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,f.jsx)(`path`,{fillRule:`evenodd`,d:`M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z`,clipRule:`evenodd`})}):(0,f.jsx)(`div`,{className:`w-4 h-4 rounded-full`,style:{border:`1.5px solid ${i.textDim}`}}),t[0]=i.textDim,t[1]=r,t[2]=a):a=t[2];let o;t[3]===i.textSecondary?o=t[4]:(o={color:i.textSecondary},t[3]=i.textSecondary,t[4]=o);let s;t[5]!==n||t[6]!==o?(s=(0,f.jsx)(`span`,{className:`text-[13px]`,style:o,children:n}),t[5]=n,t[6]=o,t[7]=s):s=t[7];let c=r?`#3fb950`:`#d29922`,l;t[8]===c?l=t[9]:(l={color:c},t[8]=c,t[9]=l);let d=r?`Ready`:`Not found`,p;t[10]!==l||t[11]!==d?(p=(0,f.jsx)(`span`,{className:`ml-auto text-[11px]`,style:l,children:d}),t[10]=l,t[11]=d,t[12]=p):p=t[12];let m;return t[13]!==a||t[14]!==s||t[15]!==p?(m=(0,f.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[a,s,p]}),t[13]=a,t[14]=s,t[15]=p,t[16]=m):m=t[16],m}function C(e){let t=(0,u.c)(10),{label:n,ok:r,themeTokens:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,f.jsx)(`svg`,{className:`w-4 h-4 text-[#3fb950]`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,f.jsx)(`path`,{fillRule:`evenodd`,d:`M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z`,clipRule:`evenodd`})}):(0,f.jsx)(`svg`,{className:`w-4 h-4 text-amber-500`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:1.5,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z`})}),t[0]=r,t[1]=a);let o;t[2]===i.textSecondary?o=t[3]:(o={color:i.textSecondary},t[2]=i.textSecondary,t[3]=o);let s;t[4]!==n||t[5]!==o?(s=(0,f.jsx)(`span`,{className:`text-[13px]`,style:o,children:n}),t[4]=n,t[5]=o,t[6]=s):s=t[6];let c;return t[7]!==a||t[8]!==s?(c=(0,f.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function w(){let e=(0,u.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(`svg`,{className:`w-4 h-4`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,f.jsx)(`path`,{fillRule:`evenodd`,d:`M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z`,clipRule:`evenodd`})}),e[0]=t):t=e[0],t}function T(e){let t=(0,u.c)(28),{command:n,themeTokens:r}=e,[i,a]=(0,d.useState)(!1),o;t[0]===n?o=t[1]:(o=()=>{navigator.clipboard.writeText(n),a(!0),setTimeout(()=>a(!1),1500)},t[0]=n,t[1]=o);let s=o,c;t[2]===r?c=t[3]:(c=r.bgAccent(`0.03`),t[2]=r,t[3]=c);let l=`1px solid ${r.border}`,p;t[4]!==r.textSecondary||t[5]!==c||t[6]!==l?(p={background:c,border:l,color:r.textSecondary},t[4]=r.textSecondary,t[5]=c,t[6]=l,t[7]=p):p=t[7];let m;t[8]!==n||t[9]!==p?(m=(0,f.jsx)(`code`,{className:`flex-1 rounded-lg px-3 py-2 text-[12px] font-mono select-all`,style:p,children:n}),t[8]=n,t[9]=p,t[10]=m):m=t[10];let h;t[11]===r.textMuted?h=t[12]:(h={color:r.textMuted},t[11]=r.textMuted,t[12]=h);let g;t[13]===r.textPrimary?g=t[14]:(g=e=>{e.currentTarget.style.color=r.textPrimary},t[13]=r.textPrimary,t[14]=g);let _;t[15]===r.textMuted?_=t[16]:(_=e=>{e.currentTarget.style.color=r.textMuted},t[15]=r.textMuted,t[16]=_);let v;t[17]===i?v=t[18]:(v=i?(0,f.jsx)(`svg`,{className:`w-4 h-4 text-[#3fb950]`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m4.5 12.75 6 6 9-13.5`})}):(0,f.jsx)(`svg`,{className:`w-4 h-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:1.5,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75`})}),t[17]=i,t[18]=v);let y;t[19]!==s||t[20]!==h||t[21]!==g||t[22]!==_||t[23]!==v?(y=(0,f.jsx)(`button`,{onClick:s,className:`transition-colors shrink-0`,style:h,onMouseEnter:g,onMouseLeave:_,title:`Copy to clipboard`,children:v}),t[19]=s,t[20]=h,t[21]=g,t[22]=_,t[23]=v,t[24]=y):y=t[24];let b;return t[25]!==y||t[26]!==m?(b=(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m,y]}),t[25]=y,t[26]=m,t[27]=b):b=t[27],b}function E(e){let t=(0,u.c)(19),{checking:n,onRecheck:r,themeTokens:i}=e,a;t[0]===i?a=t[1]:(a=i.bgAccent(`0.04`),t[0]=i,t[1]=a);let o;t[2]!==i.textMuted||t[3]!==a?(o={background:a,color:i.textMuted},t[2]=i.textMuted,t[3]=a,t[4]=o):o=t[4];let s,c;t[5]!==i||t[6]!==n?(s=e=>{n||(e.currentTarget.style.background=i.bgAccent(`0.08`),e.currentTarget.style.color=i.textPrimary)},c=e=>{n||(e.currentTarget.style.background=i.bgAccent(`0.04`),e.currentTarget.style.color=i.textMuted)},t[5]=i,t[6]=n,t[7]=s,t[8]=c):(s=t[7],c=t[8]);let l;t[9]!==i.textMuted||t[10]!==n?(l=n&&(0,f.jsx)(`div`,{className:`w-3 h-3 border-[1.5px] border-t-transparent rounded-full animate-spin`,style:{borderColor:i.textMuted,borderTopColor:`transparent`}}),t[9]=i.textMuted,t[10]=n,t[11]=l):l=t[11];let d;return t[12]!==n||t[13]!==r||t[14]!==o||t[15]!==s||t[16]!==c||t[17]!==l?(d=(0,f.jsxs)(`button`,{onClick:r,disabled:n,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[12px] transition-colors disabled:opacity-50 w-fit`,style:o,onMouseEnter:s,onMouseLeave:c,children:[l,`Re-check`]}),t[12]=n,t[13]=r,t[14]=o,t[15]=s,t[16]=c,t[17]=l,t[18]=d):d=t[18],d}export{m as default};
@@ -1 +1 @@
1
- import{d as e,i as t,m as n,t as r,u as i}from"./jsx-runtime-QmcfnBgR.js";import{B as a,L as o,ot as s,pt as c,z as l}from"./index-gWSenOqD.js";var u=i(),d=n(e(),1),f=r();function p({open:e,onClose:n}){let{theme:r}=a(),i=l(r),u=c(e=>e.cards),p=c(e=>e.selectCard),[g,b]=(0,d.useState)(`tmux`),[x,S]=(0,d.useState)({tmuxSessions:[],claudeProcesses:[],worktrees:[]}),[C,w]=(0,d.useState)(!1),[T,E]=(0,d.useState)(new Set),D=async()=>{w(!0);try{let e=await t(`get_process_state`);S(e)}catch(e){c.setState({error:String(e)})}finally{w(!1)}};if((0,d.useEffect)(()=>{e&&D()},[e]),!e)return null;let O=e=>u.find(t=>e===t.id||e.endsWith(t.id)),k=e=>e.sessionId?u.find(t=>t.link.sessionLink?.sessionId===e.sessionId):void 0,A=async e=>{try{await t(`tmux_kill_session`,{name:e,runtime:x.tmuxSessions.find(t=>t.name===e)?.runtime}),await D()}catch(e){c.setState({error:String(e)})}},j=x.tmuxSessions.filter(e=>O(e.name)),M=async()=>{if(j.length!==0&&await o(`Kill ${j.length} managed tmux session${j.length===1?``:`s`}?\n\nThis ends every Claude session owned by a card. The action is irreversible.`,{title:`Kill All Managed`,kind:`warning`,okLabel:`Kill ${j.length}`,cancelLabel:`Cancel`})){for(let e of j)try{await t(`tmux_kill_session`,{name:e.name,runtime:e.runtime})}catch(e){c.setState({error:String(e)});break}await D()}},N=async e=>{if(await o(`Kill Claude process ${e}?`,{title:`Kill process`,kind:`warning`,okLabel:`Kill`,cancelLabel:`Cancel`}))try{await t(`kill_claude_process`,{pid:e}),await D()}catch(e){c.setState({error:String(e)})}},P=async e=>{if(!e.isMain&&await o(`Remove worktree at ${e.path}?\n\nThe directory is deleted; the branch stays.`,{title:`Remove worktree`,kind:`warning`,okLabel:`Remove`,cancelLabel:`Cancel`})){E(t=>new Set(t).add(e.path));try{await s(e.path,e.repoRoot,!1),await D()}catch(e){c.setState({error:String(e)})}finally{E(t=>{let n=new Set(t);return n.delete(e.path),n})}}};return(0,f.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,style:{background:i.bgOverlay},onClick:e=>{e.target===e.currentTarget&&n()},children:(0,f.jsxs)(`div`,{className:`rounded-[34px] flex flex-col animate-slide-up`,style:{width:720,height:540,...i.mat.ultrathick,border:`1px solid ${i.border}`},onKeyDown:e=>{e.key===`Escape`&&n()},children:[(0,f.jsxs)(`div`,{className:`px-6 pt-5 pb-3 flex items-center justify-between`,children:[(0,f.jsx)(`h2`,{className:`text-[16px] font-medium`,style:{color:i.textPrimary},children:`Process Manager`}),(0,f.jsx)(`button`,{onClick:n,className:`transition-colors`,style:{color:i.textMuted},onMouseEnter:e=>{e.currentTarget.style.color=i.textPrimary},onMouseLeave:e=>{e.currentTarget.style.color=i.textMuted},"aria-label":`Close`,children:(0,f.jsx)(`svg`,{className:`w-5 h-5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 18 18 6M6 6l12 12`})})})]}),(0,f.jsxs)(`div`,{className:`px-6 pb-3 flex items-center gap-1`,children:[[`tmux`,`claude`,`worktrees`].map(e=>(0,f.jsx)(`button`,{onClick:()=>b(e),className:`px-3 py-1.5 rounded-lg text-[13px] font-medium transition-colors`,style:{background:g===e?i.bgInput:`transparent`,color:g===e?i.textPrimary:i.textMuted,border:`1px solid ${g===e?i.borderBright:`transparent`}`},children:e===`tmux`?`Tmux (${x.tmuxSessions.length})`:e===`claude`?`Claude (${x.claudeProcesses.length})`:`Worktrees (${x.worktrees.length})`},e)),(0,f.jsx)(`span`,{className:`flex-1`}),g===`tmux`&&j.length>0&&(0,f.jsxs)(`button`,{onClick:M,className:`px-3 py-1.5 rounded-lg text-[13px] transition-colors`,style:{color:`#f85149`,border:`1px solid #f8514940`},onMouseEnter:e=>{e.currentTarget.style.background=`#f8514912`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},title:`Kill every tmux session owned by a card`,children:[`Kill All Managed (`,j.length,`)`]}),(0,f.jsx)(`button`,{onClick:D,disabled:C,className:`px-3 py-1.5 rounded-lg text-[13px] transition-colors disabled:opacity-50`,style:{color:i.textSecondary,border:`1px solid ${i.border}`},onMouseEnter:e=>{C||(e.currentTarget.style.background=i.hoverBg)},onMouseLeave:e=>{e.currentTarget.style.background=``},title:`Refresh`,children:C?`Refreshing…`:`Refresh`})]}),(0,f.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 pb-4`,children:[g===`tmux`&&(0,f.jsx)(v,{when:x.tmuxSessions.length===0,c:i,message:`No active tmux sessions. Requires WSL + tmux installed.`}),g===`tmux`&&x.tmuxSessions.map(e=>{let t=O(e.name);return(0,f.jsxs)(m,{c:i,children:[(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-mono text-[13px] truncate`,style:{color:i.textPrimary},children:e.name}),e.attached&&(0,f.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded uppercase tracking-wider`,style:{background:`#3fb95018`,color:`#3fb950`},children:`attached`})]}),(0,f.jsxs)(`div`,{className:`text-[11px] mt-0.5`,style:{color:i.textDim},children:[e.windows,` window`,e.windows===1?``:`s`,` · created `,y(e.createdAt*1e3),t&&(0,f.jsxs)(f.Fragment,{children:[` `,`·`,` `,(0,f.jsx)(_,{card:t,onSelect:()=>{p(t.id),n()},c:i})]})]})]}),(0,f.jsx)(h,{onClick:()=>A(e.name),c:i,label:`Kill`,danger:!0})]},e.name)}),g===`claude`&&(0,f.jsx)(v,{when:x.claudeProcesses.length===0,c:i,message:`No Claude processes running.`}),g===`claude`&&x.claudeProcesses.map(e=>{let t=k(e);return(0,f.jsxs)(m,{c:i,children:[(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(`span`,{className:`font-mono text-[13px]`,style:{color:i.textPrimary},children:[`PID `,e.pid]}),e.sessionId&&(0,f.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded font-mono`,style:{background:i.bgInput,color:i.textMuted},children:e.sessionId.slice(0,8)})]}),(0,f.jsx)(`div`,{className:`text-[11px] mt-0.5 font-mono truncate`,style:{color:i.textDim},title:e.command,children:e.command}),t&&(0,f.jsx)(`div`,{className:`text-[11px] mt-0.5`,style:{color:i.textDim},children:(0,f.jsx)(_,{card:t,onSelect:()=>{p(t.id),n()},c:i})})]}),(0,f.jsx)(h,{onClick:()=>N(e.pid),c:i,label:`Kill`,danger:!0})]},e.pid)}),g===`worktrees`&&(0,f.jsx)(v,{when:x.worktrees.length===0,c:i,message:`No worktrees found. Configure a project in Settings → Projects.`}),g===`worktrees`&&x.worktrees.map(e=>(0,f.jsxs)(m,{c:i,children:[(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`text-[13px] truncate`,style:{color:i.textPrimary},children:e.projectName}),e.branch&&(0,f.jsx)(`span`,{className:`text-[11px] px-1.5 py-0.5 rounded`,style:{background:`var(--hover)`,color:`var(--solid)`},children:e.branch}),e.isMain&&(0,f.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded uppercase tracking-wider`,style:{background:i.bgInput,color:i.textMuted},children:`main`})]}),(0,f.jsx)(`div`,{className:`text-[11px] mt-0.5 font-mono truncate`,style:{color:i.textDim},title:e.path,children:e.path})]}),!e.isMain&&(0,f.jsx)(h,{onClick:()=>P(e),c:i,label:T.has(e.path)?`Removing…`:`Remove`,danger:!0,disabled:T.has(e.path)})]},`${e.repoRoot}::${e.path}`))]})]})})}function m(e){let t=(0,u.c)(6),{children:n,c:r}=e,i=`1px solid ${r.border}`,a;t[0]!==r.bgCard||t[1]!==i?(a={border:i,background:r.bgCard},t[0]=r.bgCard,t[1]=i,t[2]=a):a=t[2];let o;return t[3]!==n||t[4]!==a?(o=(0,f.jsx)(`div`,{className:`flex items-center gap-3 px-3 py-2.5 rounded-lg mb-1.5`,style:a,children:n}),t[3]=n,t[4]=a,t[5]=o):o=t[5],o}function h(e){let t=(0,u.c)(12),{onClick:n,c:r,label:i,danger:a,disabled:o}=e,s=a?`#f85149`:r.textSecondary,c=`1px solid ${s}40`,l;t[0]!==s||t[1]!==c?(l={color:s,border:c},t[0]=s,t[1]=c,t[2]=l):l=t[2];let d;t[3]!==s||t[4]!==o?(d=e=>{o||(e.currentTarget.style.background=s+`12`)},t[3]=s,t[4]=o,t[5]=d):d=t[5];let p;return t[6]!==o||t[7]!==i||t[8]!==n||t[9]!==l||t[10]!==d?(p=(0,f.jsx)(`button`,{onClick:n,disabled:o,className:`px-3 py-1.5 rounded text-[12px] font-medium transition-colors shrink-0 disabled:opacity-50`,style:l,onMouseEnter:d,onMouseLeave:g,children:i}),t[6]=o,t[7]=i,t[8]=n,t[9]=l,t[10]=d,t[11]=p):p=t[11],p}function g(e){e.currentTarget.style.background=`transparent`}function _(e){let t=(0,u.c)(6),{card:n,onSelect:r,c:i}=e,a;t[0]===i.textSecondary?a=t[1]:(a={color:i.textSecondary},t[0]=i.textSecondary,t[1]=a);let o;return t[2]!==n.displayTitle||t[3]!==r||t[4]!==a?(o=(0,f.jsxs)(`button`,{onClick:r,className:`underline-offset-2 hover:underline transition-colors`,style:a,title:`Open this card`,children:[`→ `,n.displayTitle]}),t[2]=n.displayTitle,t[3]=r,t[4]=a,t[5]=o):o=t[5],o}function v(e){let t=(0,u.c)(6),{when:n,c:r,message:i}=e;if(!n)return null;let a=`1px dashed ${r.border}`,o;t[0]!==r.textDim||t[1]!==a?(o={color:r.textDim,border:a},t[0]=r.textDim,t[1]=a,t[2]=o):o=t[2];let s;return t[3]!==i||t[4]!==o?(s=(0,f.jsx)(`div`,{className:`flex items-center justify-center py-12 rounded-lg text-[12px]`,style:o,children:i}),t[3]=i,t[4]=o,t[5]=s):s=t[5],s}function y(e){let t=Date.now()-e,n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}export{p as default};
1
+ import{d as e,i as t,m as n,t as r,u as i}from"./jsx-runtime-QmcfnBgR.js";import{H as a,V as o,ct as s,ht as c,z as l}from"./index-CQnL8JJ5.js";var u=i(),d=n(e(),1),f=r();function p({open:e,onClose:n}){let{theme:r}=a(),i=o(r),u=c(e=>e.cards),p=c(e=>e.selectCard),[g,b]=(0,d.useState)(`tmux`),[x,S]=(0,d.useState)({tmuxSessions:[],claudeProcesses:[],worktrees:[]}),[C,w]=(0,d.useState)(!1),[T,E]=(0,d.useState)(new Set),D=async()=>{w(!0);try{let e=await t(`get_process_state`);S(e)}catch(e){c.setState({error:String(e)})}finally{w(!1)}};if((0,d.useEffect)(()=>{e&&D()},[e]),!e)return null;let O=e=>u.find(t=>e===t.id||e.endsWith(t.id)),k=e=>e.sessionId?u.find(t=>t.link.sessionLink?.sessionId===e.sessionId):void 0,A=async e=>{try{await t(`tmux_kill_session`,{name:e,runtime:x.tmuxSessions.find(t=>t.name===e)?.runtime}),await D()}catch(e){c.setState({error:String(e)})}},j=x.tmuxSessions.filter(e=>O(e.name)),M=async()=>{if(j.length!==0&&await l(`Kill ${j.length} managed tmux session${j.length===1?``:`s`}?\n\nThis ends every Claude session owned by a card. The action is irreversible.`,{title:`Kill All Managed`,kind:`warning`,okLabel:`Kill ${j.length}`,cancelLabel:`Cancel`})){for(let e of j)try{await t(`tmux_kill_session`,{name:e.name,runtime:e.runtime})}catch(e){c.setState({error:String(e)});break}await D()}},N=async e=>{if(await l(`Kill Claude process ${e}?`,{title:`Kill process`,kind:`warning`,okLabel:`Kill`,cancelLabel:`Cancel`}))try{await t(`kill_claude_process`,{pid:e}),await D()}catch(e){c.setState({error:String(e)})}},P=async e=>{if(!e.isMain&&await l(`Remove worktree at ${e.path}?\n\nThe directory is deleted; the branch stays.`,{title:`Remove worktree`,kind:`warning`,okLabel:`Remove`,cancelLabel:`Cancel`})){E(t=>new Set(t).add(e.path));try{await s(e.path,e.repoRoot,!1),await D()}catch(e){c.setState({error:String(e)})}finally{E(t=>{let n=new Set(t);return n.delete(e.path),n})}}};return(0,f.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,style:{background:i.bgOverlay},onClick:e=>{e.target===e.currentTarget&&n()},children:(0,f.jsxs)(`div`,{className:`rounded-[34px] flex flex-col animate-slide-up`,style:{width:720,height:540,...i.mat.ultrathick,border:`1px solid ${i.border}`},onKeyDown:e=>{e.key===`Escape`&&n()},children:[(0,f.jsxs)(`div`,{className:`px-6 pt-5 pb-3 flex items-center justify-between`,children:[(0,f.jsx)(`h2`,{className:`text-[16px] font-medium`,style:{color:i.textPrimary},children:`Process Manager`}),(0,f.jsx)(`button`,{onClick:n,className:`transition-colors`,style:{color:i.textMuted},onMouseEnter:e=>{e.currentTarget.style.color=i.textPrimary},onMouseLeave:e=>{e.currentTarget.style.color=i.textMuted},"aria-label":`Close`,children:(0,f.jsx)(`svg`,{className:`w-5 h-5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 18 18 6M6 6l12 12`})})})]}),(0,f.jsxs)(`div`,{className:`px-6 pb-3 flex items-center gap-1`,children:[[`tmux`,`claude`,`worktrees`].map(e=>(0,f.jsx)(`button`,{onClick:()=>b(e),className:`px-3 py-1.5 rounded-lg text-[13px] font-medium transition-colors`,style:{background:g===e?i.bgInput:`transparent`,color:g===e?i.textPrimary:i.textMuted,border:`1px solid ${g===e?i.borderBright:`transparent`}`},children:e===`tmux`?`Tmux (${x.tmuxSessions.length})`:e===`claude`?`Claude (${x.claudeProcesses.length})`:`Worktrees (${x.worktrees.length})`},e)),(0,f.jsx)(`span`,{className:`flex-1`}),g===`tmux`&&j.length>0&&(0,f.jsxs)(`button`,{onClick:M,className:`px-3 py-1.5 rounded-lg text-[13px] transition-colors`,style:{color:`#f85149`,border:`1px solid #f8514940`},onMouseEnter:e=>{e.currentTarget.style.background=`#f8514912`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},title:`Kill every tmux session owned by a card`,children:[`Kill All Managed (`,j.length,`)`]}),(0,f.jsx)(`button`,{onClick:D,disabled:C,className:`px-3 py-1.5 rounded-lg text-[13px] transition-colors disabled:opacity-50`,style:{color:i.textSecondary,border:`1px solid ${i.border}`},onMouseEnter:e=>{C||(e.currentTarget.style.background=i.hoverBg)},onMouseLeave:e=>{e.currentTarget.style.background=``},title:`Refresh`,children:C?`Refreshing…`:`Refresh`})]}),(0,f.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 pb-4`,children:[g===`tmux`&&(0,f.jsx)(v,{when:x.tmuxSessions.length===0,c:i,message:`No active tmux sessions. Requires WSL + tmux installed.`}),g===`tmux`&&x.tmuxSessions.map(e=>{let t=O(e.name);return(0,f.jsxs)(m,{c:i,children:[(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-mono text-[13px] truncate`,style:{color:i.textPrimary},children:e.name}),e.attached&&(0,f.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded uppercase tracking-wider`,style:{background:`#3fb95018`,color:`#3fb950`},children:`attached`})]}),(0,f.jsxs)(`div`,{className:`text-[11px] mt-0.5`,style:{color:i.textDim},children:[e.windows,` window`,e.windows===1?``:`s`,` · created `,y(e.createdAt*1e3),t&&(0,f.jsxs)(f.Fragment,{children:[` `,`·`,` `,(0,f.jsx)(_,{card:t,onSelect:()=>{p(t.id),n()},c:i})]})]})]}),(0,f.jsx)(h,{onClick:()=>A(e.name),c:i,label:`Kill`,danger:!0})]},e.name)}),g===`claude`&&(0,f.jsx)(v,{when:x.claudeProcesses.length===0,c:i,message:`No Claude processes running.`}),g===`claude`&&x.claudeProcesses.map(e=>{let t=k(e);return(0,f.jsxs)(m,{c:i,children:[(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(`span`,{className:`font-mono text-[13px]`,style:{color:i.textPrimary},children:[`PID `,e.pid]}),e.sessionId&&(0,f.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded font-mono`,style:{background:i.bgInput,color:i.textMuted},children:e.sessionId.slice(0,8)})]}),(0,f.jsx)(`div`,{className:`text-[11px] mt-0.5 font-mono truncate`,style:{color:i.textDim},title:e.command,children:e.command}),t&&(0,f.jsx)(`div`,{className:`text-[11px] mt-0.5`,style:{color:i.textDim},children:(0,f.jsx)(_,{card:t,onSelect:()=>{p(t.id),n()},c:i})})]}),(0,f.jsx)(h,{onClick:()=>N(e.pid),c:i,label:`Kill`,danger:!0})]},e.pid)}),g===`worktrees`&&(0,f.jsx)(v,{when:x.worktrees.length===0,c:i,message:`No worktrees found. Configure a project in Settings → Projects.`}),g===`worktrees`&&x.worktrees.map(e=>(0,f.jsxs)(m,{c:i,children:[(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`text-[13px] truncate`,style:{color:i.textPrimary},children:e.projectName}),e.branch&&(0,f.jsx)(`span`,{className:`text-[11px] px-1.5 py-0.5 rounded`,style:{background:`var(--hover)`,color:`var(--solid)`},children:e.branch}),e.isMain&&(0,f.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded uppercase tracking-wider`,style:{background:i.bgInput,color:i.textMuted},children:`main`})]}),(0,f.jsx)(`div`,{className:`text-[11px] mt-0.5 font-mono truncate`,style:{color:i.textDim},title:e.path,children:e.path})]}),!e.isMain&&(0,f.jsx)(h,{onClick:()=>P(e),c:i,label:T.has(e.path)?`Removing…`:`Remove`,danger:!0,disabled:T.has(e.path)})]},`${e.repoRoot}::${e.path}`))]})]})})}function m(e){let t=(0,u.c)(6),{children:n,c:r}=e,i=`1px solid ${r.border}`,a;t[0]!==r.bgCard||t[1]!==i?(a={border:i,background:r.bgCard},t[0]=r.bgCard,t[1]=i,t[2]=a):a=t[2];let o;return t[3]!==n||t[4]!==a?(o=(0,f.jsx)(`div`,{className:`flex items-center gap-3 px-3 py-2.5 rounded-lg mb-1.5`,style:a,children:n}),t[3]=n,t[4]=a,t[5]=o):o=t[5],o}function h(e){let t=(0,u.c)(12),{onClick:n,c:r,label:i,danger:a,disabled:o}=e,s=a?`#f85149`:r.textSecondary,c=`1px solid ${s}40`,l;t[0]!==s||t[1]!==c?(l={color:s,border:c},t[0]=s,t[1]=c,t[2]=l):l=t[2];let d;t[3]!==s||t[4]!==o?(d=e=>{o||(e.currentTarget.style.background=s+`12`)},t[3]=s,t[4]=o,t[5]=d):d=t[5];let p;return t[6]!==o||t[7]!==i||t[8]!==n||t[9]!==l||t[10]!==d?(p=(0,f.jsx)(`button`,{onClick:n,disabled:o,className:`px-3 py-1.5 rounded text-[12px] font-medium transition-colors shrink-0 disabled:opacity-50`,style:l,onMouseEnter:d,onMouseLeave:g,children:i}),t[6]=o,t[7]=i,t[8]=n,t[9]=l,t[10]=d,t[11]=p):p=t[11],p}function g(e){e.currentTarget.style.background=`transparent`}function _(e){let t=(0,u.c)(6),{card:n,onSelect:r,c:i}=e,a;t[0]===i.textSecondary?a=t[1]:(a={color:i.textSecondary},t[0]=i.textSecondary,t[1]=a);let o;return t[2]!==n.displayTitle||t[3]!==r||t[4]!==a?(o=(0,f.jsxs)(`button`,{onClick:r,className:`underline-offset-2 hover:underline transition-colors`,style:a,title:`Open this card`,children:[`→ `,n.displayTitle]}),t[2]=n.displayTitle,t[3]=r,t[4]=a,t[5]=o):o=t[5],o}function v(e){let t=(0,u.c)(6),{when:n,c:r,message:i}=e;if(!n)return null;let a=`1px dashed ${r.border}`,o;t[0]!==r.textDim||t[1]!==a?(o={color:r.textDim,border:a},t[0]=r.textDim,t[1]=a,t[2]=o):o=t[2];let s;return t[3]!==i||t[4]!==o?(s=(0,f.jsx)(`div`,{className:`flex items-center justify-center py-12 rounded-lg text-[12px]`,style:o,children:i}),t[3]=i,t[4]=o,t[5]=s):s=t[5],s}function y(e){let t=Date.now()-e,n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}export{p as default};
@@ -0,0 +1 @@
1
+ import{d as e,i as t,m as n,t as r,u as i}from"./jsx-runtime-QmcfnBgR.js";import{a,c as o,d as s,o as c,s as l,u}from"./Surface-BQKeigoq.js";import{C as d,D as f,_ as p,g as m,ht as h,v as g,y as _}from"./index-CQnL8JJ5.js";var v=n(e(),1),y=i(),b=r(),x=(e,t)=>e.title===t.title&&e.summary===t.summary&&e.body===t.body;function S(e){let t=(0,y.c)(40),{id:n,value:r,onChange:i}=e,a=`${n}-t`,o;t[0]===a?o=t[1]:(o=(0,b.jsx)(_,{htmlFor:a,children:`Title`}),t[0]=a,t[1]=o);let s=`${n}-t`,c;t[2]!==i||t[3]!==r?(c=e=>i({...r,title:e.target.value}),t[2]=i,t[3]=r,t[4]=c):c=t[4];let l;t[5]!==s||t[6]!==c||t[7]!==r.title?(l=(0,b.jsx)(g,{id:s,value:r.title,onChange:c}),t[5]=s,t[6]=c,t[7]=r.title,t[8]=l):l=t[8];let u;t[9]!==o||t[10]!==l?(u=(0,b.jsxs)(m,{children:[o,l]}),t[9]=o,t[10]=l,t[11]=u):u=t[11];let f=`${n}-s`,p;t[12]===f?p=t[13]:(p=(0,b.jsx)(_,{htmlFor:f,children:`Summary`}),t[12]=f,t[13]=p);let h=`${n}-s`,v;t[14]!==i||t[15]!==r?(v=e=>i({...r,summary:e.target.value}),t[14]=i,t[15]=r,t[16]=v):v=t[16];let x;t[17]!==v||t[18]!==h||t[19]!==r.summary?(x=(0,b.jsx)(g,{id:h,value:r.summary,onChange:v}),t[17]=v,t[18]=h,t[19]=r.summary,t[20]=x):x=t[20];let S;t[21]!==x||t[22]!==p?(S=(0,b.jsxs)(m,{children:[p,x]}),t[21]=x,t[22]=p,t[23]=S):S=t[23];let C=`${n}-b`,w;t[24]===C?w=t[25]:(w=(0,b.jsx)(_,{htmlFor:C,children:`Body`}),t[24]=C,t[25]=w);let T=`${n}-b`,E;t[26]!==i||t[27]!==r?(E=e=>i({...r,body:e.target.value}),t[26]=i,t[27]=r,t[28]=E):E=t[28];let D;t[29]!==T||t[30]!==E||t[31]!==r.body?(D=(0,b.jsx)(d,{id:T,rows:6,value:r.body,onChange:E}),t[29]=T,t[30]=E,t[31]=r.body,t[32]=D):D=t[32];let O;t[33]!==w||t[34]!==D?(O=(0,b.jsxs)(m,{children:[w,D]}),t[33]=w,t[34]=D,t[35]=O):O=t[35];let k;return t[36]!==S||t[37]!==O||t[38]!==u?(k=(0,b.jsxs)(b.Fragment,{children:[u,S,O]}),t[36]=S,t[37]=O,t[38]=u,t[39]=k):k=t[39],k}var C=(e,t,n)=>`${e} ${e===1?t:n}`,w=e=>{f({title:e instanceof Error?e.message:String(e),tone:`danger`,duration:6e3})},T={librarian:`From a session`,bootstrap:`From project docs`,manual:`Written by hand`};function E({proposal:e,onChanged:n,showSourceCard:r=!0,onOpenCard:i}){let[d,m]=(0,v.useState)(!1),[_,y]=(0,v.useState)({title:e.title,summary:e.summary,body:e.body}),[x,C]=(0,v.useState)(``),[E,D]=(0,v.useState)(!1),O=h(e=>e.selectCard),k=h(t=>t.cards.find(t=>t.id===e.source?.cardId)),A=e.status===`pending`;return(0,b.jsxs)(l,{material:`thin`,children:[(0,b.jsxs)(u,{children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(s,{children:d?`Editing proposal`:e.title}),(0,b.jsxs)(o,{children:[(0,b.jsx)(a,{children:e.type}),` `,!A&&(0,b.jsx)(a,{tone:e.status===`approved`?`success`:`outline`,children:e.status}),` `,T[e.origin],` · `,e.kbId,e.scope.length?` · about ${e.scope.join(`, `)}`:``,e.supersedes?.length?` · replaces ${e.supersedes.join(`, `)}`:``]})]}),(0,b.jsxs)(`div`,{className:`bd-kb-actions`,style:{marginTop:0},children:[r&&k&&(0,b.jsx)(c,{variant:`ghost`,size:`sm`,onClick:()=>{O(k.id),i?.()},children:`Open task`}),A&&(0,b.jsx)(c,{variant:`ghost`,size:`sm`,onClick:()=>m(e=>!e),children:d?`Done editing`:`Edit`})]})]}),d?(0,b.jsx)(S,{id:`p-${e.id}`,value:_,onChange:y}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`p`,{className:`bd-kb-summary`,children:e.summary}),(0,b.jsx)(`pre`,{className:`bd-kb-body-text`,children:e.body}),e.reason&&(0,b.jsxs)(`p`,{className:`bd-kb-why`,children:[(0,b.jsx)(`span`,{children:`Why it was proposed`}),e.reason]})]}),A?(0,b.jsxs)(`div`,{className:`bd-kb-actions bd-kb-decide`,children:[(0,b.jsx)(g,{"aria-label":`Reason for rejecting`,placeholder:`Reason for rejecting (optional)`,value:x,onChange:e=>C(e.target.value)}),(0,b.jsx)(c,{variant:`danger`,disabled:E,onClick:async()=>{D(!0);try{await t(`kb_proposal_reject`,{id:e.id,note:x}),n()}catch(e){w(e)}finally{D(!1)}},children:`Reject`}),(0,b.jsx)(c,{variant:`solid`,loading:E,onClick:async()=>{D(!0);try{let r=await t(`kb_proposal_approve`,{id:e.id,edits:d?_:void 0});f({title:`Entry approved`,description:r.prUrl?.startsWith(`http`)?`Pull request: ${r.prUrl}`:r.prUrl,tone:`success`}),n()}catch(e){w(e)}finally{D(!1)}},children:`Approve`})]}):(0,b.jsxs)(`div`,{className:`bd-kb-actions`,children:[(0,b.jsx)(p,{children:e.status===`approved`&&e.prUrl?.startsWith(`http`)?(0,b.jsx)(`a`,{href:e.prUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Pull request`}):e.prUrl??e.decisionNote??``}),e.status===`approved`&&e.entryId&&(0,b.jsx)(c,{size:`sm`,disabled:E,onClick:async()=>{D(!0);try{let r=await t(`kb_proposal_undo`,{id:e.id});f({title:`Approval undone`,description:r.revertUrl?`It was already merged. Merge this revert to remove it: ${r.revertUrl}`:`The proposal is back in the review queue.`,tone:`success`}),n()}catch(e){w(e)}finally{D(!1)}},children:`Undo approval`})]})]})}export{x as a,S as i,w as n,C as r,E as t};
@@ -1 +1 @@
1
- import{d as e,m as t,t as n}from"./jsx-runtime-QmcfnBgR.js";import{p as r}from"./Surface-BQKeigoq.js";import{F as i,lt as a,pt as o}from"./index-gWSenOqD.js";function s(e){return Array.isArray?Array.isArray(e):_(e)===`[object Array]`}function c(e){if(typeof e==`string`)return e;if(typeof e==`bigint`)return e.toString();let t=e+``;return t==`0`&&1/e==-1/0?`-0`:t}function l(e){return e==null?``:c(e)}function u(e){return typeof e==`string`}function d(e){return typeof e==`number`}function f(e){return e===!0||e===!1||m(e)&&_(e)==`[object Boolean]`}function p(e){return typeof e==`object`}function m(e){return p(e)&&e!==null}function h(e){return e!=null}function g(e){return!e.trim().length}function _(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var v=`Incorrect 'index' type`,y=`Invalid doc index: must be a non-negative integer within the bounds of the docs array`,b=e=>`Invalid value for key ${e}`,x=e=>`Pattern length exceeds max of ${e}.`,S=e=>`Missing ${e} property in key`,C=e=>`Property 'weight' in key '${e}' must be a positive integer`,w=`Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.`,T=Object.prototype.hasOwnProperty,ee=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=E(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function E(e){let t=null,n=null,r=null,i=1,a=null;if(u(e)||s(e))r=e,t=D(e),n=O(e);else{if(!T.call(e,`name`))throw Error(S(`name`));let o=e.name;if(r=o,T.call(e,`weight`)&&e.weight!==void 0&&(i=e.weight,i<=0))throw Error(C(O(o)));t=D(o),n=O(o),a=e.getFn??null}return{path:t,id:n,weight:i,src:r,getFn:a}}function D(e){return s(e)?e:e.split(`.`)}function O(e){return s(e)?e.join(`.`):e}function te(e,t){let n=[],r=!1,i=(e,t,a,o)=>{if(h(e)){if(!t[a])n.push(o===void 0?e:{v:e,i:o});else{let c=e[t[a]];if(!h(c))return;if(a===t.length-1&&(u(c)||d(c)||f(c)||typeof c==`bigint`))n.push(o===void 0?l(c):{v:l(c),i:o});else if(s(c)){r=!0;for(let e=0,n=c.length;e<n;e+=1)i(c[e],t,a+1,e)}else t.length&&i(c,t,a+1,o)}}};return i(e,u(t)?t.split(`.`):t,0),r?n:n[0]}var ne={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},re={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},ie={location:0,threshold:.6,distance:100},ae={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:`any`,getFn:te,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},k=Object.freeze({...re,...ne,...ie,...ae});function oe(e){return e>=9&&e<=13||e===32||e===160}function se(e=1,t=3){let n=new Map,r=10**t;return{get(t){let i=0,a=!1;for(let e=0;e<t.length;e++)oe(t.charCodeAt(e))?a=!1:a||=(i++,!0);if(i===0&&(i=1),n.has(i))return n.get(i);let o=Math.round(r/i**(.5*e))/r;return n.set(i,o),o},clear(){n.clear()}}}var A=class{constructor({getFn:e=k.getFn,fieldNormWeight:t=k.fieldNormWeight}={}){this.norm=se(t,3),this.getFn=e,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;let e=this.docs.length;this.records=Array(e);let t=0;if(u(this.docs[0]))for(let n=0;n<e;n++){let e=this._createStringRecord(this.docs[n],n);e&&(this.records[t++]=e)}else for(let n=0;n<e;n++)this.records[t++]=this._createObjectRecord(this.docs[n],n);this.records.length=t,this.norm.clear()}add(e,t){if(!Number.isInteger(t)||t<0)throw Error(y);if(u(e)){let n=this._createStringRecord(e,t);return n&&this.records.push(n),n}let n=this._createObjectRecord(e,t);return this.records.push(n),n}removeAt(e){if(!Number.isInteger(e)||e<0)throw Error(y);for(let t=0,n=this.records.length;t<n;t+=1)if(this.records[t].i===e){this.records.splice(t,1);break}for(let t=0,n=this.records.length;t<n;t+=1)this.records[t].i>e&&--this.records[t].i}removeAll(e){let t=new Set;for(let n of e)Number.isInteger(n)&&n>=0&&t.add(n);if(t.size===0)return;this.records=this.records.filter(e=>!t.has(e.i));let n=Array.from(t).sort((e,t)=>e-t);for(let e of this.records){let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e.i?t=i+1:r=i}e.i-=t}}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_createStringRecord(e,t){return!h(e)||g(e)?null:{v:e,i:t,n:this.norm.get(e)}}_createObjectRecord(e,t){let n={i:t,$:{}};for(let t=0,r=this.keys.length;t<r;t++){let r=this.keys[t],i=r.getFn?r.getFn(e):this.getFn(e,r.path);if(h(i)){if(s(i)){let e=[];for(let t=0,n=i.length;t<n;t+=1){let n=i[t];if(h(n)){if(u(n)){if(!g(n)){let r={v:n,i:t,n:this.norm.get(n)};e.push(r)}}else if(h(n.v)){let t=u(n.v)?n.v:l(n.v);if(!g(t)){let r={v:t,i:n.i,n:this.norm.get(t)};e.push(r)}}}}n.$[t]=e}else if(u(i)&&!g(i)){let e={v:i,n:this.norm.get(i)};n.$[t]=e}}}return n}toJSON(){return{keys:this.keys.map(({getFn:e,...t})=>t),records:this.records}}};function j(e,t,{getFn:n=k.getFn,fieldNormWeight:r=k.fieldNormWeight}={}){let i=new A({getFn:n,fieldNormWeight:r});return i.setKeys(e.map(E)),i.setSources(t),i.create(),i}function ce(e,{getFn:t=k.getFn,fieldNormWeight:n=k.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new A({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function le(e=[],t=k.minMatchCharLength){let n=[],r=-1,i=-1,a=0;for(let o=e.length;a<o;a+=1){let o=e[a];o&&r===-1?r=a:!o&&r!==-1&&(i=a-1,i-r+1>=t&&n.push([r,i]),r=-1)}return e[a-1]&&a-r>=t&&n.push([r,a-1]),n}function ue(e,t,n,{location:r=k.location,distance:i=k.distance,threshold:a=k.threshold,findAllMatches:o=k.findAllMatches,minMatchCharLength:s=k.minMatchCharLength,includeMatches:c=k.includeMatches,ignoreLocation:l=k.ignoreLocation}={}){if(t.length>32)throw Error(x(32));let u=t.length,d=e.length,f=Math.max(0,Math.min(r,d)),p=a,m=f,h=(e,t)=>{let n=e/u;if(l)return n;let r=Math.abs(f-t);return i?n+r/i:r?1:n},g=s>1||c,_=g?Array(d):[],v;for(;(v=e.indexOf(t,m))>-1;){let e=h(0,v);if(p=Math.min(e,p),m=v+u,g){let e=0;for(;e<u;)_[v+e]=1,e+=1}}m=-1;let y=[],b=1,S=0,C=u+d,w=1<<u-1;for(let t=0;t<u;t+=1){let r=0,i=C;for(;r<i;)h(t,f+i)<=p?r=i:C=i,i=Math.floor((C-r)/2+r);C=i;let a=Math.max(1,f-i+1),s=o?d:Math.min(f+i,d)+u,c=Array(s+2);c[s+1]=(1<<t)-1;for(let r=s;r>=a;--r){let i=r-1,o=n[e[i]];if(c[r]=(c[r+1]<<1|1)&o,t&&(c[r]|=(y[r+1]|y[r])<<1|1|y[r+1]),c[r]&w&&(b=h(t,i),b<=p)){if(p=b,m=i,S=t,m<=f)break;a=Math.max(1,2*f-m)}}if(h(t+1,f)>p)break;y=c}if(g&&m>=0){let t=Math.min(d-1,m+u-1+S);for(let r=m;r<=t;r+=1)n[e[r]]&&(_[r]=1)}let T={isMatch:m>=0,score:Math.max(.001,b)};if(g){let e=le(_,s);e.length?c&&(T.indices=e):T.isMatch=!1}return T}function de(e){let t={};for(let n=0,r=e.length;n<r;n+=1){let i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}function M(e){if(e.length<=1)return e;e.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let t=[e[0]];for(let n=1,r=e.length;n<r;n+=1){let r=t[t.length-1],i=e[n];i[0]<=r[1]+1?r[1]=Math.max(r[1],i[1]):t.push(i)}return t}var N={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},fe=RegExp(`[`+Object.keys(N).join(``)+`]`,`g`),P=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFD`).replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,``).replace(fe,e=>N[e]):e=>e,F=class{constructor(e,{location:t=k.location,threshold:n=k.threshold,distance:r=k.distance,includeMatches:i=k.includeMatches,findAllMatches:a=k.findAllMatches,minMatchCharLength:o=k.minMatchCharLength,isCaseSensitive:s=k.isCaseSensitive,ignoreDiacritics:c=k.ignoreDiacritics,ignoreLocation:l=k.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:i,findAllMatches:a,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:c,ignoreLocation:l},e=s?e:e.toLowerCase(),e=c?P(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:de(e),startIndex:t})},d=this.pattern.length;if(d>32){let e=0,t=d%32,n=d-t;for(;e<n;)u(this.pattern.substr(e,32),e),e+=32;if(t){let e=d-32;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=t?e:e.toLowerCase(),e=n?P(e):e,this.pattern===e){if(e.length<this.options.minMatchCharLength)return{isMatch:!1,score:1};let t={isMatch:!0,score:0};return r&&(t.indices=[[0,e.length-1]]),t}let{location:i,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,ignoreLocation:l}=this.options,u=[],d=0,f=!1;this.chunks.forEach(({pattern:t,alphabet:n,startIndex:p})=>{let{isMatch:m,score:h,indices:g}=ue(e,t,n,{location:i+p,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,includeMatches:r,ignoreLocation:l});m&&(f=!0),d+=h,m&&g&&u.push(...g)});let p={isMatch:f,score:f?d/this.chunks.length:1};return f&&r&&(p.indices=M(u)),p}},pe=new Set([`fuzzy`,`include`]);function me(e){return e.startsWith(`inverse`)}var I=[{type:`exact`,multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:e=>({type:`exact`,search(t){let n=t===e;return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`include`,multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:e=>({type:`include`,search(t){let n=0,r,i=[],a=e.length;for(;(r=t.indexOf(e,n))>-1;)n=r+a,i.push([r,n-1]);let o=!!i.length;return{isMatch:o,score:+!o,indices:i}}})},{type:`prefix-exact`,multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:e=>({type:`prefix-exact`,search(t){let n=t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`inverse-prefix-exact`,multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:e=>({type:`inverse-prefix-exact`,search(t){let n=!t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`inverse-suffix-exact`,multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:e=>({type:`inverse-suffix-exact`,search(t){let n=!t.endsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`suffix-exact`,multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:e=>({type:`suffix-exact`,search(t){let n=t.endsWith(e);return{isMatch:n,score:+!n,indices:[t.length-e.length,t.length-1]}}})},{type:`inverse-exact`,multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:e=>({type:`inverse-exact`,search(t){let n=t.indexOf(e)===-1;return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`fuzzy`,multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(e,t={})=>{let n=new F(e,{location:t.location??k.location,threshold:t.threshold??k.threshold,distance:t.distance??k.distance,includeMatches:t.includeMatches??k.includeMatches,findAllMatches:t.findAllMatches??k.findAllMatches,minMatchCharLength:t.minMatchCharLength??k.minMatchCharLength,isCaseSensitive:t.isCaseSensitive??k.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics??k.ignoreDiacritics,ignoreLocation:t.ignoreLocation??k.ignoreLocation});return{type:`fuzzy`,search(e){return n.searchIn(e)}}}}],L=I.length,he=`\0`,ge=`|`;function _e(e){let t=[],n=e.length,r=0;for(;r<n;){for(;r<n&&e[r]===` `;)r++;if(r>=n)break;let i=r;for(;i<n&&e[i]!==` `&&e[i]!==`"`;)i++;if(i<n&&e[i]===`"`){for(i++;i<n;){if(e[i]===`"`){let t=i+1;if(t>=n||e[t]===` `){i++;break}if(e[t]===`$`&&(t+1>=n||e[t+1]===` `)){i+=2;break}}i++}t.push(e.substring(r,i)),r=i}else{for(;i<n&&e[i]!==` `;)i++;t.push(e.substring(r,i)),r=i}}return t}function R(e,t){let n=e.match(t);return n?n[1]:null}function ve(e,t={}){return e.replace(/\\\|/g,he).split(ge).map(e=>{let n=_e(e.replace(/\u0000/g,`|`).trim()).filter(e=>e&&!!e.trim()),r=[];for(let e=0,i=n.length;e<i;e+=1){let i=n[e],a=!1,o=-1;for(;!a&&++o<L;){let e=I[o],n=R(i,e.multiRegex);n&&(r.push(e.create(n,t)),a=!0)}if(!a)for(o=-1;++o<L;){let e=I[o],n=R(i,e.singleRegex);if(n){r.push(e.create(n,t));break}}}return r})}var ye=class{constructor(e,{isCaseSensitive:t=k.isCaseSensitive,ignoreDiacritics:n=k.ignoreDiacritics,includeMatches:r=k.includeMatches,minMatchCharLength:i=k.minMatchCharLength,ignoreLocation:a=k.ignoreLocation,findAllMatches:o=k.findAllMatches,location:s=k.location,threshold:c=k.threshold,distance:l=k.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:o,ignoreLocation:a,location:s,threshold:c,distance:l},e=t?e:e.toLowerCase(),e=n?P(e):e,this.pattern=e,this.query=ve(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?P(e):e;let a=0,o=[],s=0,c=!1;for(let r=0,i=t.length;r<i;r+=1){let i=t[r];o.length=0,a=0,c=!1;for(let t=0,r=i.length;t<r;t+=1){let r=i[t],{isMatch:l,indices:u,score:d}=r.search(e);if(l)a+=1,s+=d,me(r.type)&&(c=!0),n&&(pe.has(r.type)?o.push(...u):o.push(u));else{s=0,a=0,o.length=0,c=!1;break}}if(a){let e={isMatch:!0,score:s/a};return c&&(e.hasInverse=!0),n&&(e.indices=M(o)),e}}return{isMatch:!1,score:1}}},z=[];function B(...e){z.push(...e)}function V(e,t){for(let n=0,r=z.length;n<r;n+=1){let r=z[n];if(r.condition(e,t))return new r(e,t)}return new F(e,t)}var H={AND:`$and`,OR:`$or`},U={PATH:`$path`,PATTERN:`$val`},W=e=>!!(e[H.AND]||e[H.OR]),be=e=>!!e[U.PATH],xe=e=>!s(e)&&p(e)&&!W(e),G=e=>({[H.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function K(e,t,{auto:n=!0}={}){let r=e=>{if(u(e)){let r={keyId:null,pattern:e};return n&&(r.searcher=V(e,t)),r}let i=Object.keys(e),a=be(e);if(!a&&i.length>1&&!W(e))return r(G(e));if(xe(e)){let r=a?e[U.PATH]:i[0],o=a?e[U.PATTERN]:e[r];if(!u(o))throw Error(b(r));let s={keyId:O(r),pattern:o};return n&&(s.searcher=V(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];s(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return W(e)||(e=G(e)),r(e)}function q(e,{ignoreFieldNorm:t=k.ignoreFieldNorm}){let n=1;return e.forEach(({key:e,norm:r,score:i})=>{let a=e?e.weight:null;n*=(i===0&&a?2**-52:i)**+((a||1)*(t?1:r))}),n}function Se(e,{ignoreFieldNorm:t=k.ignoreFieldNorm}){e.forEach(e=>{e.score=q(e.matches,{ignoreFieldNorm:t})})}var Ce=class{constructor(e,t){this.limit=e,this.heap=[],this.comparator=t}get size(){return this.heap.length}insert(e){this.size<this.limit?(this.heap.push(e),this._bubbleUp(this.size-1)):this.comparator(e,this.heap[0])<0&&(this.heap[0]=e,this._sinkDown(0))}extractSorted(){return this.heap.sort(this.comparator)}_bubbleUp(e){let t=this.heap;for(;e>0;){let n=e-1>>1;if(this.comparator(t[e],t[n])<=0)break;let r=t[e];t[e]=t[n],t[n]=r,e=n}}_sinkDown(e){let t=this.heap,n=t.length,r=e;do{e=r;let i=2*e+1,a=2*e+2;if(i<n&&this.comparator(t[i],t[r])>0&&(r=i),a<n&&this.comparator(t[a],t[r])>0&&(r=a),r!==e){let n=t[e];t[e]=t[r],t[r]=n}}while(r!==e)}};function we(e){let t=[];return e.matches.forEach(e=>{if(!h(e.indices)||!e.indices.length)return;let n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.id),e.idx>-1&&(n.refIndex=e.idx),t.push(n)}),t}function Te(e,t,{includeMatches:n=k.includeMatches,includeScore:r=k.includeScore}={}){return e.map(e=>{let{idx:i}=e,a={item:t[i],refIndex:i};return n&&(a.matches=we(e)),r&&(a.score=e.score),a})}var Ee=/[\p{L}\p{M}\p{N}_]+/gu,De=new WeakSet;function Oe(e){De.has(e)||(De.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`))}function ke(e){if(typeof e==`function`){let t=!1;return n=>{let r=e(n);if(!t&&(t=!0,!Array.isArray(r)||r.some(e=>typeof e!=`string`)))throw Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(r)?`array containing non-strings`:typeof r}.`);return r}}return e instanceof RegExp?(e.global||Oe(e),t=>t.match(e)||[]):e=>e.match(Ee)||[]}function J({isCaseSensitive:e=!1,ignoreDiacritics:t=!1,tokenize:n}={}){let r=ke(n);return{tokenize(n){return e||(n=n.toLowerCase()),t&&(n=P(n)),r(n)}}}var Ae=class{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=J({isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,tokenize:t.tokenize});let n=this.analyzer.tokenize(e),{df:r,fieldCount:i}=t._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(let e of n){this.termSearchers.push(new F(e,{location:t.location,threshold:t.threshold,distance:t.distance,includeMatches:t.includeMatches,findAllMatches:t.findAllMatches,minMatchCharLength:t.minMatchCharLength,isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,ignoreLocation:!0}));let n=r.get(e)||0,a=Math.log(1+(i-n+.5)/(n+.5));this.idfWeights.push(a)}this.combineAll=t.tokenMatch===`all`,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(e){if(!this.termSearchers.length)return{isMatch:!1,score:1};let t=[],n=0,r=0,i=0,a=0,o=this.combineAll&&!this.useMask?new Set:null;for(let s=0;s<this.termSearchers.length;s++){let c=this.termSearchers[s].searchIn(e),l=this.idfWeights[s];r+=l,c.isMatch&&(i++,n+=l*(1-c.score),c.indices&&t.push(...c.indices),this.combineAll&&(this.useMask?a|=1<<s:o.add(s)))}if(i===0)return{isMatch:!1,score:1};let s=r>0?1-n/r:0,c={isMatch:!0,score:Math.max(.001,s)};return this.options.includeMatches&&t.length&&(c.indices=M(t)),this.combineAll&&(this.useMask?c.matchedMask=a:c.matchedTerms=o,c.termCount=this.numTerms),c}};function Y(e,t,n,r){let i=r.tokenize(t);if(!i.length)return;e.fieldCount++,e.docFieldCount.set(n,(e.docFieldCount.get(n)||0)+1);let a=new Set(i),o=e.docTermFieldHits.get(n);o||(o=new Map,e.docTermFieldHits.set(n,o));for(let t of a)o.set(t,(o.get(t)||0)+1),e.df.set(t,(e.df.get(t)||0)+1)}function je(e,t,n,r){let{i,v:a,$:o}=t;if(a!==void 0)Y(e,a,i,r);else if(o)for(let t=0;t<n;t++){let n=o[t];if(n){if(Array.isArray(n))for(let t of n)Y(e,t.v,i,r);else Y(e,n.v,i,r)}}}function Me(e,t,n){let r={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(let i of e)je(r,i,t,n);return r}function Ne(e,t,n,r){je(e,t,n,r)}function Pe(e,t){let n=e.docFieldCount.get(t);if(n===void 0)return;e.fieldCount-=n,e.docFieldCount.delete(t);let r=e.docTermFieldHits.get(t);if(r){for(let[t,n]of r){let r=(e.df.get(t)||0)-n;r<=0?e.df.delete(t):e.df.set(t,r)}e.docTermFieldHits.delete(t)}}function X(e,t){if(t.length===0)return;let n=Array.from(new Set(t)).sort((e,t)=>e-t);for(let t of n)Pe(e,t);let r=e=>{let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e?t=i+1:r=i}return e-t},i=n[0],a=new Map;for(let[t,n]of e.docFieldCount)a.set(t>i?r(t):t,n);e.docFieldCount=a;let o=new Map;for(let[t,n]of e.docTermFieldHits)o.set(t>i?r(t):t,n);e.docTermFieldHits=o}var Z=class{constructor(e,t,n){this.options={...k,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new ee(this.options.keys),this._docs=e,this._myIndex=null,this._invertedIndex=null,this.setCollection(e,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(e){if(this._lastQuery===e)return this._lastSearcher;let t=V(e,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=e,this._lastSearcher=t,t}setCollection(e,t){if(this._docs=e,t&&!(t instanceof A))throw Error(v);if(this._myIndex=t||j(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let e=J({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=Me(this._myIndex.records,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}add(e){if(!h(e))return;this._docs.push(e);let t=this._myIndex.add(e,this._docs.length-1);if(this._invertedIndex&&t){let e=J({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});Ne(this._invertedIndex,t,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}remove(e=()=>!1){let t=[],n=[];for(let r=0,i=this._docs.length;r<i;r+=1)e(this._docs[r],r)&&(t.push(this._docs[r]),n.push(r));if(n.length){this._invertedIndex&&X(this._invertedIndex,n);let e=new Set(n);this._docs=this._docs.filter((t,n)=>!e.has(n)),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return t}removeAt(e){if(!Number.isInteger(e)||e<0||e>=this._docs.length)throw Error(y);this._invertedIndex&&X(this._invertedIndex,[e]);let t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),this._invalidateSearcherCache(),t}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}_normalizedKeys(){return this._myIndex.keys.map(e=>this._keyStore.get(e.id)||e)}search(e,t){let{limit:n=-1}=t||{},{includeMatches:r,includeScore:i,shouldSort:a,sortFn:o,ignoreFieldNorm:s}=this.options;if(u(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return d(n)&&n>-1&&(e=e.slice(0,n)),e}let c=a&&d(n)&&n>0&&u(e),l=o,f=(e,t)=>l(e,t)||e.idx-t.idx,p;if(c){let t=new Ce(n,f);u(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:s}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:s}),p=t.extractSorted()}else p=u(e)?u(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),Se(p,{ignoreFieldNorm:s}),a&&p.sort(u(e)?f:l),d(n)&&n>-1&&(p=p.slice(0,n));return Te(p,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=t?null:[];return a.forEach(({v:e,i:a,n:s})=>{if(!h(e))return;let c=r.searchIn(e);if(c.isMatch){let r={score:c.score,value:e,norm:s,indices:c.indices};i&&(r.matchedMask=c.matchedMask,r.matchedTerms=c.matchedTerms,r.termCount=c.termCount);let l=[r];if(!i||this._coversAllTokens(l)){let r={item:e,idx:a,matches:l};t?(r.score=q(r.matches,{ignoreFieldNorm:n}),t.insert(r)):o.push(r)}}}),o}_searchLogical(e){let t=K(e,this.options),n=this._normalizedKeys(),r=(e,t,i)=>{if(!(`children`in e)){let{keyId:r,searcher:a}=e,o;return r===null?(o=[],n.forEach((e,n)=>{o.push(...this._findMatches({key:e,value:t[n],searcher:a}))})):o=this._findMatches({key:this._keyStore.get(r),value:this._myIndex.getValueForItemAtKeyId(t,r),searcher:a}),o&&o.length?[{idx:i,item:t,matches:o}]:[]}let{children:a,operator:o}=e,s=[];for(let e=0,n=a.length;e<n;e+=1){let n=a[e],c=r(n,t,i);if(c.length)s.push(...c);else if(o===H.AND)return[]}return s},i=this._myIndex.records,a=new Map,o=[];return i.forEach(({$:e,i:n})=>{if(h(e)){let i=r(t,e,n);i.length&&(a.has(n)||(a.set(n,{idx:n,item:e,matches:[]}),o.push(a.get(n))),i.forEach(({matches:e})=>{a.get(n).matches.push(...e)}))}}),o}_searchObjectList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=this._normalizedKeys(),s=t?null:[];return a.forEach(({$:e,i:a})=>{if(!h(e))return;let c=[],l=!1,u=!1;if(o.forEach((t,n)=>{let i=this._findMatches({key:t,value:e[n],searcher:r});i.length?(c.push(...i),i[0].hasInverse&&(u=!0)):l=!0}),!(u&&l)&&c.length&&(!i||this._coversAllTokens(c))){let r={idx:a,item:e,matches:c};t?(r.score=q(r.matches,{ignoreFieldNorm:n}),t.insert(r)):s.push(r)}}),s}_findMatches({key:e,value:t,searcher:n}){if(!h(t))return[];let r=[];if(s(t))t.forEach(({v:t,i,n:a})=>{if(!h(t))return;let o=n.searchIn(t);if(o.isMatch){let n={score:o.score,key:e,value:t,idx:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(n.matchedMask=o.matchedMask,n.matchedTerms=o.matchedTerms,n.termCount=o.termCount),r.push(n)}});else{let{v:i,n:a}=t,o=n.searchIn(i);if(o.isMatch){let t={score:o.score,key:e,value:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(t.matchedMask=o.matchedMask,t.matchedTerms=o.matchedTerms,t.termCount=o.termCount),r.push(t)}}return r}_coversAllTokens(e){let t=e.length?e[0].termCount:void 0;if(t===void 0)return!0;if(t<=31){let n=0;for(let t=0;t<e.length;t++)n|=e[t].matchedMask||0;return n===2**t-1}let n=new Set;for(let t=0;t<e.length;t++){let r=e[t].matchedTerms;if(r)for(let e of r)n.add(e)}return n.size===t}};Z.version=`7.5.0`,Z.createIndex=j,Z.parseIndex=ce,Z.config=k,Z.match=function(e,t,n){if(n&&n.useTokenSearch)throw Error(w);return V(e,{...k,...n}).searchIn(t)},Z.parseQuery=K,B(ye),B(Ae),Z.use=function(...e){e.forEach(e=>B(e))};var Fe=Z,Q=t(e(),1),$=n();function Ie(){let e=o(e=>e.cards),t=o(e=>e.setSearchOpen),n=o(e=>e.selectCard),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(0),d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{d.current?.focus()},[]);let _=(0,Q.useMemo)(()=>new Fe(e,{keys:[{name:`displayTitle`,weight:.5},{name:`link.promptBody`,weight:.3},{name:`projectName`,weight:.1},{name:`link.sessionLink.sessionId`,weight:.1}],threshold:.4,includeScore:!0}),[e]),v=(0,Q.useMemo)(()=>s.trim()?_.search(s).map(e=>e.item).slice(0,15):[...e].sort((e,t)=>{let n=e.link.lastActivity??e.link.updatedAt;return(t.link.lastActivity??t.link.updatedAt).localeCompare(n)}).slice(0,15),[s,_,e]);(0,Q.useEffect)(()=>{f.current?.querySelector(`[data-active="true"]`)?.scrollIntoView({block:`nearest`})},[l,p]),(0,Q.useEffect)(()=>{u(0),m(null)},[s]);let y=e=>{n(e.id),t(!1)},b=r=>{let i=e.find(e=>e.link.sessionLink?.sessionId===r.id);i&&n(i.id),t(!1)},x=async()=>{let e=s.trim();if(e&&!h){g(!0);try{let t=await a(e);m(t),u(0)}catch{m([])}finally{g(!1)}}},S=e=>{let t=p??v;if(e.key===`ArrowDown`)e.preventDefault(),u(e=>Math.min(e+1,t.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),u(e=>Math.max(e-1,0));else if(e.key===`Enter`){if(!p&&s.trim()){e.preventDefault(),x();return}if(p){let e=p[l];e&&b(e)}else v[l]&&y(v[l])}},C=p??v,w=s.trim(),T=p===null?w?`Cards`:`Recent`:`Transcript matches`;return(0,$.jsx)(`div`,{className:`bd-search-scrim animate-fade-in`,onClick:()=>t(!1),children:(0,$.jsxs)(`div`,{className:`bd-search-panel animate-slide-up`,role:`dialog`,"aria-label":`Search`,onClick:e=>e.stopPropagation(),onKeyDown:S,children:[(0,$.jsxs)(`div`,{className:`bd-search-field`,children:[(0,$.jsx)(i,{}),(0,$.jsx)(`input`,{ref:d,type:`text`,placeholder:`Search sessions, tasks, projects…`,"aria-label":`Search`,value:s,onChange:e=>c(e.target.value)}),h?(0,$.jsx)(`span`,{className:`bd-search-spinner`,"aria-hidden":`true`}):(0,$.jsx)(r,{children:`Esc`})]}),(0,$.jsxs)(`div`,{className:`bd-search-list`,ref:f,role:`listbox`,children:[h&&(0,$.jsx)(`div`,{className:`bd-search-empty`,children:`Scanning all sessions…`}),!h&&p!==null&&p.length===0&&(0,$.jsxs)(`div`,{className:`bd-search-empty`,children:[`No transcript matches for “`,s,`”`]}),p===null&&v.length===0&&w&&(0,$.jsxs)(`div`,{className:`bd-search-empty`,children:[`No board matches for “`,s,`”.`,(0,$.jsx)(`br`,{}),`Press `,(0,$.jsx)(r,{children:`Enter`}),` to search transcripts.`]}),!h&&C.length>0&&(0,$.jsxs)(`div`,{className:`bd-search-section`,children:[(0,$.jsx)(`span`,{children:T}),p!==null&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>m(null),children:`Back to board`})]}),!h&&p!==null&&p.map((t,n)=>{let r=e.find(e=>e.link.sessionLink?.sessionId===t.id);return(0,$.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n===l,"data-active":n===l,className:`bd-search-row`,onClick:()=>b(t),onMouseMove:()=>n!==l&&u(n),children:[(0,$.jsx)(`span`,{className:`bd-search-dot`,"data-state":r?.activityState,"aria-hidden":`true`}),(0,$.jsxs)(`span`,{className:`bd-search-main`,children:[(0,$.jsx)(`span`,{className:`bd-search-title`,children:r?.displayTitle??t.firstPrompt??t.id}),(0,$.jsxs)(`span`,{className:`bd-search-meta`,children:[t.projectPath&&(0,$.jsx)(`span`,{children:t.projectPath.split(/[/\\]/).pop()}),t.gitBranch&&(0,$.jsx)(`code`,{children:t.gitBranch}),(0,$.jsxs)(`span`,{children:[t.messageCount,` msg`]})]})]})]},t.id)}),p===null&&v.map((e,t)=>(0,$.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t===l,"data-active":t===l,className:`bd-search-row`,onClick:()=>y(e),onMouseMove:()=>t!==l&&u(t),children:[(0,$.jsx)(`span`,{className:`bd-search-dot`,"data-state":e.activityState,"aria-hidden":`true`}),(0,$.jsxs)(`span`,{className:`bd-search-main`,children:[(0,$.jsx)(`span`,{className:`bd-search-title`,children:e.displayTitle}),(0,$.jsxs)(`span`,{className:`bd-search-meta`,children:[e.projectName&&(0,$.jsx)(`span`,{children:e.projectName}),e.link.worktreeLink?.branch&&(0,$.jsx)(`code`,{children:e.link.worktreeLink.branch}),e.link.prLinks[0]&&(0,$.jsxs)(`span`,{className:`bd-search-pr`,children:[`PR #`,e.link.prLinks[0].number]})]})]}),(0,$.jsx)(`span`,{className:`bd-search-time`,children:e.relativeTime})]},e.id))]}),(0,$.jsxs)(`div`,{className:`bd-search-foot`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(r,{children:`↑`}),(0,$.jsx)(r,{children:`↓`}),` navigate`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(r,{children:`↵`}),` `,p===null&&w?`deep search`:`open`]}),C.length>0&&(0,$.jsxs)(`span`,{className:`bd-search-count`,children:[C.length,` result`,C.length===1?``:`s`]})]})]})})}export{Ie as default};
1
+ import{d as e,m as t,t as n}from"./jsx-runtime-QmcfnBgR.js";import{p as r}from"./Surface-BQKeigoq.js";import{L as i,dt as a,ht as o}from"./index-CQnL8JJ5.js";function s(e){return Array.isArray?Array.isArray(e):_(e)===`[object Array]`}function c(e){if(typeof e==`string`)return e;if(typeof e==`bigint`)return e.toString();let t=e+``;return t==`0`&&1/e==-1/0?`-0`:t}function l(e){return e==null?``:c(e)}function u(e){return typeof e==`string`}function d(e){return typeof e==`number`}function f(e){return e===!0||e===!1||m(e)&&_(e)==`[object Boolean]`}function p(e){return typeof e==`object`}function m(e){return p(e)&&e!==null}function h(e){return e!=null}function g(e){return!e.trim().length}function _(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var v=`Incorrect 'index' type`,y=`Invalid doc index: must be a non-negative integer within the bounds of the docs array`,b=e=>`Invalid value for key ${e}`,x=e=>`Pattern length exceeds max of ${e}.`,S=e=>`Missing ${e} property in key`,C=e=>`Property 'weight' in key '${e}' must be a positive integer`,w=`Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.`,T=Object.prototype.hasOwnProperty,ee=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=E(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function E(e){let t=null,n=null,r=null,i=1,a=null;if(u(e)||s(e))r=e,t=D(e),n=O(e);else{if(!T.call(e,`name`))throw Error(S(`name`));let o=e.name;if(r=o,T.call(e,`weight`)&&e.weight!==void 0&&(i=e.weight,i<=0))throw Error(C(O(o)));t=D(o),n=O(o),a=e.getFn??null}return{path:t,id:n,weight:i,src:r,getFn:a}}function D(e){return s(e)?e:e.split(`.`)}function O(e){return s(e)?e.join(`.`):e}function te(e,t){let n=[],r=!1,i=(e,t,a,o)=>{if(h(e)){if(!t[a])n.push(o===void 0?e:{v:e,i:o});else{let c=e[t[a]];if(!h(c))return;if(a===t.length-1&&(u(c)||d(c)||f(c)||typeof c==`bigint`))n.push(o===void 0?l(c):{v:l(c),i:o});else if(s(c)){r=!0;for(let e=0,n=c.length;e<n;e+=1)i(c[e],t,a+1,e)}else t.length&&i(c,t,a+1,o)}}};return i(e,u(t)?t.split(`.`):t,0),r?n:n[0]}var ne={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},re={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},ie={location:0,threshold:.6,distance:100},ae={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:`any`,getFn:te,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},k=Object.freeze({...re,...ne,...ie,...ae});function oe(e){return e>=9&&e<=13||e===32||e===160}function se(e=1,t=3){let n=new Map,r=10**t;return{get(t){let i=0,a=!1;for(let e=0;e<t.length;e++)oe(t.charCodeAt(e))?a=!1:a||=(i++,!0);if(i===0&&(i=1),n.has(i))return n.get(i);let o=Math.round(r/i**(.5*e))/r;return n.set(i,o),o},clear(){n.clear()}}}var A=class{constructor({getFn:e=k.getFn,fieldNormWeight:t=k.fieldNormWeight}={}){this.norm=se(t,3),this.getFn=e,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;let e=this.docs.length;this.records=Array(e);let t=0;if(u(this.docs[0]))for(let n=0;n<e;n++){let e=this._createStringRecord(this.docs[n],n);e&&(this.records[t++]=e)}else for(let n=0;n<e;n++)this.records[t++]=this._createObjectRecord(this.docs[n],n);this.records.length=t,this.norm.clear()}add(e,t){if(!Number.isInteger(t)||t<0)throw Error(y);if(u(e)){let n=this._createStringRecord(e,t);return n&&this.records.push(n),n}let n=this._createObjectRecord(e,t);return this.records.push(n),n}removeAt(e){if(!Number.isInteger(e)||e<0)throw Error(y);for(let t=0,n=this.records.length;t<n;t+=1)if(this.records[t].i===e){this.records.splice(t,1);break}for(let t=0,n=this.records.length;t<n;t+=1)this.records[t].i>e&&--this.records[t].i}removeAll(e){let t=new Set;for(let n of e)Number.isInteger(n)&&n>=0&&t.add(n);if(t.size===0)return;this.records=this.records.filter(e=>!t.has(e.i));let n=Array.from(t).sort((e,t)=>e-t);for(let e of this.records){let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e.i?t=i+1:r=i}e.i-=t}}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_createStringRecord(e,t){return!h(e)||g(e)?null:{v:e,i:t,n:this.norm.get(e)}}_createObjectRecord(e,t){let n={i:t,$:{}};for(let t=0,r=this.keys.length;t<r;t++){let r=this.keys[t],i=r.getFn?r.getFn(e):this.getFn(e,r.path);if(h(i)){if(s(i)){let e=[];for(let t=0,n=i.length;t<n;t+=1){let n=i[t];if(h(n)){if(u(n)){if(!g(n)){let r={v:n,i:t,n:this.norm.get(n)};e.push(r)}}else if(h(n.v)){let t=u(n.v)?n.v:l(n.v);if(!g(t)){let r={v:t,i:n.i,n:this.norm.get(t)};e.push(r)}}}}n.$[t]=e}else if(u(i)&&!g(i)){let e={v:i,n:this.norm.get(i)};n.$[t]=e}}}return n}toJSON(){return{keys:this.keys.map(({getFn:e,...t})=>t),records:this.records}}};function j(e,t,{getFn:n=k.getFn,fieldNormWeight:r=k.fieldNormWeight}={}){let i=new A({getFn:n,fieldNormWeight:r});return i.setKeys(e.map(E)),i.setSources(t),i.create(),i}function ce(e,{getFn:t=k.getFn,fieldNormWeight:n=k.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new A({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function le(e=[],t=k.minMatchCharLength){let n=[],r=-1,i=-1,a=0;for(let o=e.length;a<o;a+=1){let o=e[a];o&&r===-1?r=a:!o&&r!==-1&&(i=a-1,i-r+1>=t&&n.push([r,i]),r=-1)}return e[a-1]&&a-r>=t&&n.push([r,a-1]),n}function ue(e,t,n,{location:r=k.location,distance:i=k.distance,threshold:a=k.threshold,findAllMatches:o=k.findAllMatches,minMatchCharLength:s=k.minMatchCharLength,includeMatches:c=k.includeMatches,ignoreLocation:l=k.ignoreLocation}={}){if(t.length>32)throw Error(x(32));let u=t.length,d=e.length,f=Math.max(0,Math.min(r,d)),p=a,m=f,h=(e,t)=>{let n=e/u;if(l)return n;let r=Math.abs(f-t);return i?n+r/i:r?1:n},g=s>1||c,_=g?Array(d):[],v;for(;(v=e.indexOf(t,m))>-1;){let e=h(0,v);if(p=Math.min(e,p),m=v+u,g){let e=0;for(;e<u;)_[v+e]=1,e+=1}}m=-1;let y=[],b=1,S=0,C=u+d,w=1<<u-1;for(let t=0;t<u;t+=1){let r=0,i=C;for(;r<i;)h(t,f+i)<=p?r=i:C=i,i=Math.floor((C-r)/2+r);C=i;let a=Math.max(1,f-i+1),s=o?d:Math.min(f+i,d)+u,c=Array(s+2);c[s+1]=(1<<t)-1;for(let r=s;r>=a;--r){let i=r-1,o=n[e[i]];if(c[r]=(c[r+1]<<1|1)&o,t&&(c[r]|=(y[r+1]|y[r])<<1|1|y[r+1]),c[r]&w&&(b=h(t,i),b<=p)){if(p=b,m=i,S=t,m<=f)break;a=Math.max(1,2*f-m)}}if(h(t+1,f)>p)break;y=c}if(g&&m>=0){let t=Math.min(d-1,m+u-1+S);for(let r=m;r<=t;r+=1)n[e[r]]&&(_[r]=1)}let T={isMatch:m>=0,score:Math.max(.001,b)};if(g){let e=le(_,s);e.length?c&&(T.indices=e):T.isMatch=!1}return T}function de(e){let t={};for(let n=0,r=e.length;n<r;n+=1){let i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}function M(e){if(e.length<=1)return e;e.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let t=[e[0]];for(let n=1,r=e.length;n<r;n+=1){let r=t[t.length-1],i=e[n];i[0]<=r[1]+1?r[1]=Math.max(r[1],i[1]):t.push(i)}return t}var N={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},fe=RegExp(`[`+Object.keys(N).join(``)+`]`,`g`),P=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFD`).replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,``).replace(fe,e=>N[e]):e=>e,F=class{constructor(e,{location:t=k.location,threshold:n=k.threshold,distance:r=k.distance,includeMatches:i=k.includeMatches,findAllMatches:a=k.findAllMatches,minMatchCharLength:o=k.minMatchCharLength,isCaseSensitive:s=k.isCaseSensitive,ignoreDiacritics:c=k.ignoreDiacritics,ignoreLocation:l=k.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:i,findAllMatches:a,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:c,ignoreLocation:l},e=s?e:e.toLowerCase(),e=c?P(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:de(e),startIndex:t})},d=this.pattern.length;if(d>32){let e=0,t=d%32,n=d-t;for(;e<n;)u(this.pattern.substr(e,32),e),e+=32;if(t){let e=d-32;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=t?e:e.toLowerCase(),e=n?P(e):e,this.pattern===e){if(e.length<this.options.minMatchCharLength)return{isMatch:!1,score:1};let t={isMatch:!0,score:0};return r&&(t.indices=[[0,e.length-1]]),t}let{location:i,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,ignoreLocation:l}=this.options,u=[],d=0,f=!1;this.chunks.forEach(({pattern:t,alphabet:n,startIndex:p})=>{let{isMatch:m,score:h,indices:g}=ue(e,t,n,{location:i+p,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,includeMatches:r,ignoreLocation:l});m&&(f=!0),d+=h,m&&g&&u.push(...g)});let p={isMatch:f,score:f?d/this.chunks.length:1};return f&&r&&(p.indices=M(u)),p}},pe=new Set([`fuzzy`,`include`]);function me(e){return e.startsWith(`inverse`)}var I=[{type:`exact`,multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:e=>({type:`exact`,search(t){let n=t===e;return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`include`,multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:e=>({type:`include`,search(t){let n=0,r,i=[],a=e.length;for(;(r=t.indexOf(e,n))>-1;)n=r+a,i.push([r,n-1]);let o=!!i.length;return{isMatch:o,score:+!o,indices:i}}})},{type:`prefix-exact`,multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:e=>({type:`prefix-exact`,search(t){let n=t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`inverse-prefix-exact`,multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:e=>({type:`inverse-prefix-exact`,search(t){let n=!t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`inverse-suffix-exact`,multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:e=>({type:`inverse-suffix-exact`,search(t){let n=!t.endsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`suffix-exact`,multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:e=>({type:`suffix-exact`,search(t){let n=t.endsWith(e);return{isMatch:n,score:+!n,indices:[t.length-e.length,t.length-1]}}})},{type:`inverse-exact`,multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:e=>({type:`inverse-exact`,search(t){let n=t.indexOf(e)===-1;return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`fuzzy`,multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(e,t={})=>{let n=new F(e,{location:t.location??k.location,threshold:t.threshold??k.threshold,distance:t.distance??k.distance,includeMatches:t.includeMatches??k.includeMatches,findAllMatches:t.findAllMatches??k.findAllMatches,minMatchCharLength:t.minMatchCharLength??k.minMatchCharLength,isCaseSensitive:t.isCaseSensitive??k.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics??k.ignoreDiacritics,ignoreLocation:t.ignoreLocation??k.ignoreLocation});return{type:`fuzzy`,search(e){return n.searchIn(e)}}}}],L=I.length,he=`\0`,ge=`|`;function _e(e){let t=[],n=e.length,r=0;for(;r<n;){for(;r<n&&e[r]===` `;)r++;if(r>=n)break;let i=r;for(;i<n&&e[i]!==` `&&e[i]!==`"`;)i++;if(i<n&&e[i]===`"`){for(i++;i<n;){if(e[i]===`"`){let t=i+1;if(t>=n||e[t]===` `){i++;break}if(e[t]===`$`&&(t+1>=n||e[t+1]===` `)){i+=2;break}}i++}t.push(e.substring(r,i)),r=i}else{for(;i<n&&e[i]!==` `;)i++;t.push(e.substring(r,i)),r=i}}return t}function R(e,t){let n=e.match(t);return n?n[1]:null}function ve(e,t={}){return e.replace(/\\\|/g,he).split(ge).map(e=>{let n=_e(e.replace(/\u0000/g,`|`).trim()).filter(e=>e&&!!e.trim()),r=[];for(let e=0,i=n.length;e<i;e+=1){let i=n[e],a=!1,o=-1;for(;!a&&++o<L;){let e=I[o],n=R(i,e.multiRegex);n&&(r.push(e.create(n,t)),a=!0)}if(!a)for(o=-1;++o<L;){let e=I[o],n=R(i,e.singleRegex);if(n){r.push(e.create(n,t));break}}}return r})}var ye=class{constructor(e,{isCaseSensitive:t=k.isCaseSensitive,ignoreDiacritics:n=k.ignoreDiacritics,includeMatches:r=k.includeMatches,minMatchCharLength:i=k.minMatchCharLength,ignoreLocation:a=k.ignoreLocation,findAllMatches:o=k.findAllMatches,location:s=k.location,threshold:c=k.threshold,distance:l=k.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:o,ignoreLocation:a,location:s,threshold:c,distance:l},e=t?e:e.toLowerCase(),e=n?P(e):e,this.pattern=e,this.query=ve(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?P(e):e;let a=0,o=[],s=0,c=!1;for(let r=0,i=t.length;r<i;r+=1){let i=t[r];o.length=0,a=0,c=!1;for(let t=0,r=i.length;t<r;t+=1){let r=i[t],{isMatch:l,indices:u,score:d}=r.search(e);if(l)a+=1,s+=d,me(r.type)&&(c=!0),n&&(pe.has(r.type)?o.push(...u):o.push(u));else{s=0,a=0,o.length=0,c=!1;break}}if(a){let e={isMatch:!0,score:s/a};return c&&(e.hasInverse=!0),n&&(e.indices=M(o)),e}}return{isMatch:!1,score:1}}},z=[];function B(...e){z.push(...e)}function V(e,t){for(let n=0,r=z.length;n<r;n+=1){let r=z[n];if(r.condition(e,t))return new r(e,t)}return new F(e,t)}var H={AND:`$and`,OR:`$or`},U={PATH:`$path`,PATTERN:`$val`},W=e=>!!(e[H.AND]||e[H.OR]),be=e=>!!e[U.PATH],xe=e=>!s(e)&&p(e)&&!W(e),G=e=>({[H.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function K(e,t,{auto:n=!0}={}){let r=e=>{if(u(e)){let r={keyId:null,pattern:e};return n&&(r.searcher=V(e,t)),r}let i=Object.keys(e),a=be(e);if(!a&&i.length>1&&!W(e))return r(G(e));if(xe(e)){let r=a?e[U.PATH]:i[0],o=a?e[U.PATTERN]:e[r];if(!u(o))throw Error(b(r));let s={keyId:O(r),pattern:o};return n&&(s.searcher=V(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];s(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return W(e)||(e=G(e)),r(e)}function q(e,{ignoreFieldNorm:t=k.ignoreFieldNorm}){let n=1;return e.forEach(({key:e,norm:r,score:i})=>{let a=e?e.weight:null;n*=(i===0&&a?2**-52:i)**+((a||1)*(t?1:r))}),n}function Se(e,{ignoreFieldNorm:t=k.ignoreFieldNorm}){e.forEach(e=>{e.score=q(e.matches,{ignoreFieldNorm:t})})}var Ce=class{constructor(e,t){this.limit=e,this.heap=[],this.comparator=t}get size(){return this.heap.length}insert(e){this.size<this.limit?(this.heap.push(e),this._bubbleUp(this.size-1)):this.comparator(e,this.heap[0])<0&&(this.heap[0]=e,this._sinkDown(0))}extractSorted(){return this.heap.sort(this.comparator)}_bubbleUp(e){let t=this.heap;for(;e>0;){let n=e-1>>1;if(this.comparator(t[e],t[n])<=0)break;let r=t[e];t[e]=t[n],t[n]=r,e=n}}_sinkDown(e){let t=this.heap,n=t.length,r=e;do{e=r;let i=2*e+1,a=2*e+2;if(i<n&&this.comparator(t[i],t[r])>0&&(r=i),a<n&&this.comparator(t[a],t[r])>0&&(r=a),r!==e){let n=t[e];t[e]=t[r],t[r]=n}}while(r!==e)}};function we(e){let t=[];return e.matches.forEach(e=>{if(!h(e.indices)||!e.indices.length)return;let n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.id),e.idx>-1&&(n.refIndex=e.idx),t.push(n)}),t}function Te(e,t,{includeMatches:n=k.includeMatches,includeScore:r=k.includeScore}={}){return e.map(e=>{let{idx:i}=e,a={item:t[i],refIndex:i};return n&&(a.matches=we(e)),r&&(a.score=e.score),a})}var Ee=/[\p{L}\p{M}\p{N}_]+/gu,De=new WeakSet;function Oe(e){De.has(e)||(De.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`))}function ke(e){if(typeof e==`function`){let t=!1;return n=>{let r=e(n);if(!t&&(t=!0,!Array.isArray(r)||r.some(e=>typeof e!=`string`)))throw Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(r)?`array containing non-strings`:typeof r}.`);return r}}return e instanceof RegExp?(e.global||Oe(e),t=>t.match(e)||[]):e=>e.match(Ee)||[]}function J({isCaseSensitive:e=!1,ignoreDiacritics:t=!1,tokenize:n}={}){let r=ke(n);return{tokenize(n){return e||(n=n.toLowerCase()),t&&(n=P(n)),r(n)}}}var Ae=class{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=J({isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,tokenize:t.tokenize});let n=this.analyzer.tokenize(e),{df:r,fieldCount:i}=t._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(let e of n){this.termSearchers.push(new F(e,{location:t.location,threshold:t.threshold,distance:t.distance,includeMatches:t.includeMatches,findAllMatches:t.findAllMatches,minMatchCharLength:t.minMatchCharLength,isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,ignoreLocation:!0}));let n=r.get(e)||0,a=Math.log(1+(i-n+.5)/(n+.5));this.idfWeights.push(a)}this.combineAll=t.tokenMatch===`all`,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(e){if(!this.termSearchers.length)return{isMatch:!1,score:1};let t=[],n=0,r=0,i=0,a=0,o=this.combineAll&&!this.useMask?new Set:null;for(let s=0;s<this.termSearchers.length;s++){let c=this.termSearchers[s].searchIn(e),l=this.idfWeights[s];r+=l,c.isMatch&&(i++,n+=l*(1-c.score),c.indices&&t.push(...c.indices),this.combineAll&&(this.useMask?a|=1<<s:o.add(s)))}if(i===0)return{isMatch:!1,score:1};let s=r>0?1-n/r:0,c={isMatch:!0,score:Math.max(.001,s)};return this.options.includeMatches&&t.length&&(c.indices=M(t)),this.combineAll&&(this.useMask?c.matchedMask=a:c.matchedTerms=o,c.termCount=this.numTerms),c}};function Y(e,t,n,r){let i=r.tokenize(t);if(!i.length)return;e.fieldCount++,e.docFieldCount.set(n,(e.docFieldCount.get(n)||0)+1);let a=new Set(i),o=e.docTermFieldHits.get(n);o||(o=new Map,e.docTermFieldHits.set(n,o));for(let t of a)o.set(t,(o.get(t)||0)+1),e.df.set(t,(e.df.get(t)||0)+1)}function je(e,t,n,r){let{i,v:a,$:o}=t;if(a!==void 0)Y(e,a,i,r);else if(o)for(let t=0;t<n;t++){let n=o[t];if(n){if(Array.isArray(n))for(let t of n)Y(e,t.v,i,r);else Y(e,n.v,i,r)}}}function Me(e,t,n){let r={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(let i of e)je(r,i,t,n);return r}function Ne(e,t,n,r){je(e,t,n,r)}function Pe(e,t){let n=e.docFieldCount.get(t);if(n===void 0)return;e.fieldCount-=n,e.docFieldCount.delete(t);let r=e.docTermFieldHits.get(t);if(r){for(let[t,n]of r){let r=(e.df.get(t)||0)-n;r<=0?e.df.delete(t):e.df.set(t,r)}e.docTermFieldHits.delete(t)}}function X(e,t){if(t.length===0)return;let n=Array.from(new Set(t)).sort((e,t)=>e-t);for(let t of n)Pe(e,t);let r=e=>{let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e?t=i+1:r=i}return e-t},i=n[0],a=new Map;for(let[t,n]of e.docFieldCount)a.set(t>i?r(t):t,n);e.docFieldCount=a;let o=new Map;for(let[t,n]of e.docTermFieldHits)o.set(t>i?r(t):t,n);e.docTermFieldHits=o}var Z=class{constructor(e,t,n){this.options={...k,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new ee(this.options.keys),this._docs=e,this._myIndex=null,this._invertedIndex=null,this.setCollection(e,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(e){if(this._lastQuery===e)return this._lastSearcher;let t=V(e,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=e,this._lastSearcher=t,t}setCollection(e,t){if(this._docs=e,t&&!(t instanceof A))throw Error(v);if(this._myIndex=t||j(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let e=J({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=Me(this._myIndex.records,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}add(e){if(!h(e))return;this._docs.push(e);let t=this._myIndex.add(e,this._docs.length-1);if(this._invertedIndex&&t){let e=J({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});Ne(this._invertedIndex,t,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}remove(e=()=>!1){let t=[],n=[];for(let r=0,i=this._docs.length;r<i;r+=1)e(this._docs[r],r)&&(t.push(this._docs[r]),n.push(r));if(n.length){this._invertedIndex&&X(this._invertedIndex,n);let e=new Set(n);this._docs=this._docs.filter((t,n)=>!e.has(n)),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return t}removeAt(e){if(!Number.isInteger(e)||e<0||e>=this._docs.length)throw Error(y);this._invertedIndex&&X(this._invertedIndex,[e]);let t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),this._invalidateSearcherCache(),t}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}_normalizedKeys(){return this._myIndex.keys.map(e=>this._keyStore.get(e.id)||e)}search(e,t){let{limit:n=-1}=t||{},{includeMatches:r,includeScore:i,shouldSort:a,sortFn:o,ignoreFieldNorm:s}=this.options;if(u(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return d(n)&&n>-1&&(e=e.slice(0,n)),e}let c=a&&d(n)&&n>0&&u(e),l=o,f=(e,t)=>l(e,t)||e.idx-t.idx,p;if(c){let t=new Ce(n,f);u(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:s}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:s}),p=t.extractSorted()}else p=u(e)?u(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),Se(p,{ignoreFieldNorm:s}),a&&p.sort(u(e)?f:l),d(n)&&n>-1&&(p=p.slice(0,n));return Te(p,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=t?null:[];return a.forEach(({v:e,i:a,n:s})=>{if(!h(e))return;let c=r.searchIn(e);if(c.isMatch){let r={score:c.score,value:e,norm:s,indices:c.indices};i&&(r.matchedMask=c.matchedMask,r.matchedTerms=c.matchedTerms,r.termCount=c.termCount);let l=[r];if(!i||this._coversAllTokens(l)){let r={item:e,idx:a,matches:l};t?(r.score=q(r.matches,{ignoreFieldNorm:n}),t.insert(r)):o.push(r)}}}),o}_searchLogical(e){let t=K(e,this.options),n=this._normalizedKeys(),r=(e,t,i)=>{if(!(`children`in e)){let{keyId:r,searcher:a}=e,o;return r===null?(o=[],n.forEach((e,n)=>{o.push(...this._findMatches({key:e,value:t[n],searcher:a}))})):o=this._findMatches({key:this._keyStore.get(r),value:this._myIndex.getValueForItemAtKeyId(t,r),searcher:a}),o&&o.length?[{idx:i,item:t,matches:o}]:[]}let{children:a,operator:o}=e,s=[];for(let e=0,n=a.length;e<n;e+=1){let n=a[e],c=r(n,t,i);if(c.length)s.push(...c);else if(o===H.AND)return[]}return s},i=this._myIndex.records,a=new Map,o=[];return i.forEach(({$:e,i:n})=>{if(h(e)){let i=r(t,e,n);i.length&&(a.has(n)||(a.set(n,{idx:n,item:e,matches:[]}),o.push(a.get(n))),i.forEach(({matches:e})=>{a.get(n).matches.push(...e)}))}}),o}_searchObjectList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=this._normalizedKeys(),s=t?null:[];return a.forEach(({$:e,i:a})=>{if(!h(e))return;let c=[],l=!1,u=!1;if(o.forEach((t,n)=>{let i=this._findMatches({key:t,value:e[n],searcher:r});i.length?(c.push(...i),i[0].hasInverse&&(u=!0)):l=!0}),!(u&&l)&&c.length&&(!i||this._coversAllTokens(c))){let r={idx:a,item:e,matches:c};t?(r.score=q(r.matches,{ignoreFieldNorm:n}),t.insert(r)):s.push(r)}}),s}_findMatches({key:e,value:t,searcher:n}){if(!h(t))return[];let r=[];if(s(t))t.forEach(({v:t,i,n:a})=>{if(!h(t))return;let o=n.searchIn(t);if(o.isMatch){let n={score:o.score,key:e,value:t,idx:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(n.matchedMask=o.matchedMask,n.matchedTerms=o.matchedTerms,n.termCount=o.termCount),r.push(n)}});else{let{v:i,n:a}=t,o=n.searchIn(i);if(o.isMatch){let t={score:o.score,key:e,value:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(t.matchedMask=o.matchedMask,t.matchedTerms=o.matchedTerms,t.termCount=o.termCount),r.push(t)}}return r}_coversAllTokens(e){let t=e.length?e[0].termCount:void 0;if(t===void 0)return!0;if(t<=31){let n=0;for(let t=0;t<e.length;t++)n|=e[t].matchedMask||0;return n===2**t-1}let n=new Set;for(let t=0;t<e.length;t++){let r=e[t].matchedTerms;if(r)for(let e of r)n.add(e)}return n.size===t}};Z.version=`7.5.0`,Z.createIndex=j,Z.parseIndex=ce,Z.config=k,Z.match=function(e,t,n){if(n&&n.useTokenSearch)throw Error(w);return V(e,{...k,...n}).searchIn(t)},Z.parseQuery=K,B(ye),B(Ae),Z.use=function(...e){e.forEach(e=>B(e))};var Fe=Z,Q=t(e(),1),$=n();function Ie(){let e=o(e=>e.cards),t=o(e=>e.setSearchOpen),n=o(e=>e.selectCard),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(0),d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{d.current?.focus()},[]);let _=(0,Q.useMemo)(()=>new Fe(e,{keys:[{name:`displayTitle`,weight:.5},{name:`link.promptBody`,weight:.3},{name:`projectName`,weight:.1},{name:`link.sessionLink.sessionId`,weight:.1}],threshold:.4,includeScore:!0}),[e]),v=(0,Q.useMemo)(()=>s.trim()?_.search(s).map(e=>e.item).slice(0,15):[...e].sort((e,t)=>{let n=e.link.lastActivity??e.link.updatedAt;return(t.link.lastActivity??t.link.updatedAt).localeCompare(n)}).slice(0,15),[s,_,e]);(0,Q.useEffect)(()=>{f.current?.querySelector(`[data-active="true"]`)?.scrollIntoView({block:`nearest`})},[l,p]),(0,Q.useEffect)(()=>{u(0),m(null)},[s]);let y=e=>{n(e.id),t(!1)},b=r=>{let i=e.find(e=>e.link.sessionLink?.sessionId===r.id);i&&n(i.id),t(!1)},x=async()=>{let e=s.trim();if(e&&!h){g(!0);try{let t=await a(e);m(t),u(0)}catch{m([])}finally{g(!1)}}},S=e=>{let t=p??v;if(e.key===`ArrowDown`)e.preventDefault(),u(e=>Math.min(e+1,t.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),u(e=>Math.max(e-1,0));else if(e.key===`Enter`){if(!p&&s.trim()){e.preventDefault(),x();return}if(p){let e=p[l];e&&b(e)}else v[l]&&y(v[l])}},C=p??v,w=s.trim(),T=p===null?w?`Cards`:`Recent`:`Transcript matches`;return(0,$.jsx)(`div`,{className:`bd-search-scrim animate-fade-in`,onClick:()=>t(!1),children:(0,$.jsxs)(`div`,{className:`bd-search-panel animate-slide-up`,role:`dialog`,"aria-label":`Search`,onClick:e=>e.stopPropagation(),onKeyDown:S,children:[(0,$.jsxs)(`div`,{className:`bd-search-field`,children:[(0,$.jsx)(i,{}),(0,$.jsx)(`input`,{ref:d,type:`text`,placeholder:`Search sessions, tasks, projects…`,"aria-label":`Search`,value:s,onChange:e=>c(e.target.value)}),h?(0,$.jsx)(`span`,{className:`bd-search-spinner`,"aria-hidden":`true`}):(0,$.jsx)(r,{children:`Esc`})]}),(0,$.jsxs)(`div`,{className:`bd-search-list`,ref:f,role:`listbox`,children:[h&&(0,$.jsx)(`div`,{className:`bd-search-empty`,children:`Scanning all sessions…`}),!h&&p!==null&&p.length===0&&(0,$.jsxs)(`div`,{className:`bd-search-empty`,children:[`No transcript matches for “`,s,`”`]}),p===null&&v.length===0&&w&&(0,$.jsxs)(`div`,{className:`bd-search-empty`,children:[`No board matches for “`,s,`”.`,(0,$.jsx)(`br`,{}),`Press `,(0,$.jsx)(r,{children:`Enter`}),` to search transcripts.`]}),!h&&C.length>0&&(0,$.jsxs)(`div`,{className:`bd-search-section`,children:[(0,$.jsx)(`span`,{children:T}),p!==null&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>m(null),children:`Back to board`})]}),!h&&p!==null&&p.map((t,n)=>{let r=e.find(e=>e.link.sessionLink?.sessionId===t.id);return(0,$.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n===l,"data-active":n===l,className:`bd-search-row`,onClick:()=>b(t),onMouseMove:()=>n!==l&&u(n),children:[(0,$.jsx)(`span`,{className:`bd-search-dot`,"data-state":r?.activityState,"aria-hidden":`true`}),(0,$.jsxs)(`span`,{className:`bd-search-main`,children:[(0,$.jsx)(`span`,{className:`bd-search-title`,children:r?.displayTitle??t.firstPrompt??t.id}),(0,$.jsxs)(`span`,{className:`bd-search-meta`,children:[t.projectPath&&(0,$.jsx)(`span`,{children:t.projectPath.split(/[/\\]/).pop()}),t.gitBranch&&(0,$.jsx)(`code`,{children:t.gitBranch}),(0,$.jsxs)(`span`,{children:[t.messageCount,` msg`]})]})]})]},t.id)}),p===null&&v.map((e,t)=>(0,$.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t===l,"data-active":t===l,className:`bd-search-row`,onClick:()=>y(e),onMouseMove:()=>t!==l&&u(t),children:[(0,$.jsx)(`span`,{className:`bd-search-dot`,"data-state":e.activityState,"aria-hidden":`true`}),(0,$.jsxs)(`span`,{className:`bd-search-main`,children:[(0,$.jsx)(`span`,{className:`bd-search-title`,children:e.displayTitle}),(0,$.jsxs)(`span`,{className:`bd-search-meta`,children:[e.projectName&&(0,$.jsx)(`span`,{children:e.projectName}),e.link.worktreeLink?.branch&&(0,$.jsx)(`code`,{children:e.link.worktreeLink.branch}),e.link.prLinks[0]&&(0,$.jsxs)(`span`,{className:`bd-search-pr`,children:[`PR #`,e.link.prLinks[0].number]})]})]}),(0,$.jsx)(`span`,{className:`bd-search-time`,children:e.relativeTime})]},e.id))]}),(0,$.jsxs)(`div`,{className:`bd-search-foot`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(r,{children:`↑`}),(0,$.jsx)(r,{children:`↓`}),` navigate`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(r,{children:`↵`}),` `,p===null&&w?`deep search`:`open`]}),C.length>0&&(0,$.jsxs)(`span`,{className:`bd-search-count`,children:[C.length,` result`,C.length===1?``:`s`]})]})]})})}export{Ie as default};
@@ -0,0 +1 @@
1
+ import{d as e,i as t,m as n,t as r,u as i}from"./jsx-runtime-QmcfnBgR.js";import{t as a}from"./plus-Cecrm8sZ.js";import{t as o}from"./x-B6wVesqk.js";import{a as s,o as c}from"./Surface-BQKeigoq.js";import{B as l,Ct as u,D as d,Q as f,T as p,W as m,_t as h,b as g,et as _,ht as v,n as y,r as b,ut as x,v as S,vt as C,x as w,xt as T}from"./index-CQnL8JJ5.js";import{t as E}from"./deepEqual-BiJVGDfM.js";var D={name:`bell`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]};D.node;var O=u(D),k={name:`blocks`,size:24,node:[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]};k.node;var A=u(k),j={name:`folder-plus`,size:24,node:[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};j.node;var M=u(j),N={name:`folder-search`,size:24,node:[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]};N.node;var P=u(N),F={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};F.node;var ee=u(F),I=n(e(),1);function L(e,t){let n={...e,...t};for(let e of Object.keys(n))n[e]===void 0&&delete n[e];return n}function te(e,t,n){let r={...n},i=e,a=t;for(let e of Object.keys(a))E(a[e],i[e])||(r[e]=a[e]);return r}function R(e){return/^\d{1,9}$/.test(e.trim())?Number(e):null}var z=i(),B=r();function V(e){let t=(0,z.c)(14),{label:n,help:r,children:i}=e,a=(0,I.useId)(),o;t[0]!==a||t[1]!==n?(o=(0,B.jsx)(`span`,{id:a,className:`bd-set-label`,children:n}),t[0]=a,t[1]=n,t[2]=o):o=t[2];let s;t[3]===r?s=t[4]:(s=r&&(0,B.jsx)(`span`,{className:`bd-set-help`,children:r}),t[3]=r,t[4]=s);let c;t[5]!==o||t[6]!==s?(c=(0,B.jsxs)(`div`,{className:`bd-set-row-text`,children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===i?l=t[9]:(l=(0,B.jsx)(`div`,{className:`bd-set-row-control`,children:i}),t[8]=i,t[9]=l);let u;return t[10]!==a||t[11]!==c||t[12]!==l?(u=(0,B.jsxs)(`div`,{className:`bd-set-row`,role:`group`,"aria-labelledby":a,children:[c,l]}),t[10]=a,t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function H(e){let t=(0,z.c)(10),{label:n,help:r,children:i}=e,a=(0,I.useId)(),o;t[0]!==a||t[1]!==n?(o=(0,B.jsx)(`span`,{id:a,className:`bd-set-label`,children:n}),t[0]=a,t[1]=n,t[2]=o):o=t[2];let s;t[3]===r?s=t[4]:(s=r&&(0,B.jsx)(`span`,{className:`bd-set-help`,children:r}),t[3]=r,t[4]=s);let c;return t[5]!==i||t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,B.jsxs)(`div`,{className:`bd-set-stack`,role:`group`,"aria-labelledby":a,children:[o,i,s]}),t[5]=i,t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function U(e){let t=(0,z.c)(8),{checked:n,onChange:r,label:i,help:a}=e,o;t[0]!==n||t[1]!==i||t[2]!==r?(o=(0,B.jsx)(w,{checked:n,onCheckedChange:r,"aria-label":i}),t[0]=n,t[1]=i,t[2]=r,t[3]=o):o=t[3];let s;return t[4]!==a||t[5]!==i||t[6]!==o?(s=(0,B.jsx)(V,{label:i,help:a,children:o}),t[4]=a,t[5]=i,t[6]=o,t[7]=s):s=t[7],s}function W(e){let t=(0,z.c)(8),{title:n,rows:r,children:i}=e,a;t[0]===n?a=t[1]:(a=n&&(0,B.jsx)(`h4`,{children:n}),t[0]=n,t[1]=a);let o;t[2]!==i||t[3]!==r?(o=r?(0,B.jsx)(`div`,{className:`bd-set-rows`,children:i}):i,t[2]=i,t[3]=r,t[4]=o):o=t[4];let s;return t[5]!==a||t[6]!==o?(s=(0,B.jsxs)(`section`,{className:`bd-set-group`,children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function G(e){let t=(0,z.c)(46),{value:n,onChange:r,unit:i,label:o,min:s,max:c}=e,l=s===void 0?0:s,[u,d]=(0,I.useState)(null),f;t[0]!==c||t[1]!==l?(f=e=>Math.min(c??1/0,Math.max(l,e)),t[0]=c,t[1]=l,t[2]=f):f=t[2];let p=f,m;t[3]!==p||t[4]!==u||t[5]!==r?(m=()=>{if(u===null)return;let e=R(u);e!==null&&r(p(e)),d(null)},t[3]=p,t[4]=u,t[5]=r,t[6]=m):m=t[6];let h=m,g;t[7]!==p||t[8]!==r||t[9]!==n?(g=e=>{d(null),r(p(n+e))},t[7]=p,t[8]=r,t[9]=n,t[10]=g):g=t[10];let _=g,v=`Decrease ${o}`,y=n<=l,b;t[11]===_?b=t[12]:(b=()=>_(-1),t[11]=_,t[12]=b);let x;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,B.jsx)(ee,{size:14,"aria-hidden":`true`}),t[13]=x):x=t[13];let S;t[14]!==v||t[15]!==y||t[16]!==b?(S=(0,B.jsx)(`button`,{type:`button`,className:`bd-set-step`,"aria-label":v,disabled:y,onClick:b,children:x}),t[14]=v,t[15]=y,t[16]=b,t[17]=S):S=t[17];let C=u??n,w=`${o}, in ${i}`,T;t[18]!==c||t[19]!==l||t[20]!==r?(T=e=>{d(e.target.value);let t=R(e.target.value);t!==null&&t>=l&&(c===void 0||t<=c)&&r(t)},t[18]=c,t[19]=l,t[20]=r,t[21]=T):T=t[21];let E;t[22]===h?E=t[23]:(E=e=>{e.key===`Enter`&&h()},t[22]=h,t[23]=E);let D;t[24]!==h||t[25]!==c||t[26]!==l||t[27]!==C||t[28]!==w||t[29]!==T||t[30]!==E?(D=(0,B.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:l,max:c,className:`bd-set-num`,value:C,"aria-label":w,onChange:T,onBlur:h,onKeyDown:E}),t[24]=h,t[25]=c,t[26]=l,t[27]=C,t[28]=w,t[29]=T,t[30]=E,t[31]=D):D=t[31];let O;t[32]===i?O=t[33]:(O=(0,B.jsx)(`span`,{className:`bd-set-unit`,"aria-hidden":!0,children:i}),t[32]=i,t[33]=O);let k=`Increase ${o}`,A=c!==void 0&&n>=c,j;t[34]===_?j=t[35]:(j=()=>_(1),t[34]=_,t[35]=j);let M;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,B.jsx)(a,{size:14,"aria-hidden":`true`}),t[36]=M):M=t[36];let N;t[37]!==k||t[38]!==A||t[39]!==j?(N=(0,B.jsx)(`button`,{type:`button`,className:`bd-set-step`,"aria-label":k,disabled:A,onClick:j,children:M}),t[37]=k,t[38]=A,t[39]=j,t[40]=N):N=t[40];let P;return t[41]!==D||t[42]!==O||t[43]!==N||t[44]!==S?(P=(0,B.jsxs)(`span`,{className:`bd-set-numfield`,children:[S,D,O,N]}),t[41]=D,t[42]=O,t[43]=N,t[44]=S,t[45]=P):P=t[45],P}var K=[`claude`],ne=()=>`svc_${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`;function re(e){let t=(0,z.c)(31),{settings:n,update:r}=e,i;t[0]===n.apiServices?i=t[1]:(i=n.apiServices??[],t[0]=n.apiServices,t[1]=i);let a=i,s;t[2]===n.defaultAPIServiceIds?s=t[3]:(s=n.defaultAPIServiceIds??{},t[2]=n.defaultAPIServiceIds,t[3]=s);let l=s,u;t[4]===r?u=t[5]:(u=()=>r(ae),t[4]=r,t[5]=u);let d=u,f;t[6]===r?f=t[7]:(f=(e,t)=>r(n=>({...n,apiServices:(n.apiServices??[]).map(n=>n.id===e?L(n,t):n)})),t[6]=r,t[7]=f);let p=f,h;t[8]===r?h=t[9]:(h=e=>r(t=>({...t,apiServices:(t.apiServices??[]).filter(t=>t.id!==e),defaultAPIServiceIds:Object.fromEntries(Object.entries(t.defaultAPIServiceIds??{}).filter(t=>{let[,n]=t;return n!==e}))})),t[8]=r,t[9]=h);let _=h,v;t[10]===r?v=t[11]:(v=(e,t)=>r(n=>{let r={...n.defaultAPIServiceIds};return t?r[e]=t:delete r[e],{...n,defaultAPIServiceIds:r}}),t[10]=r,t[11]=v);let y=v,b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,B.jsx)(`p`,{className:`bd-set-note`,children:`A service wraps the Claude Code CLI with a launcher prefix, a model override or a custom base URL, for example to route Claude through Ollama or a self-hosted proxy.`}),t[12]=b):b=t[12];let x;t[13]!==l||t[14]!==a||t[15]!==y?(x=K.map(e=>{let t=m[e]??e;return(0,B.jsx)(V,{label:t,help:`Used when a card has no override.`,children:(0,B.jsx)(g,{"aria-label":`Default service for ${t}`,value:l[e]??``,onValueChange:t=>y(e,t),options:[{value:``,label:`None (bare ${e} CLI)`},...a.filter(t=>t.assistant===e).map(ie)]})},e)}),t[13]=l,t[14]=a,t[15]=y,t[16]=x):x=t[16];let C;t[17]===x?C=t[18]:(C=(0,B.jsx)(W,{title:`Default service`,children:x}),t[17]=x,t[18]=C);let w;t[19]!==_||t[20]!==a||t[21]!==p?(w=a.length===0?(0,B.jsxs)(`div`,{className:`bd-set-empty`,children:[(0,B.jsx)(`strong`,{children:`No API services yet`}),(0,B.jsx)(`span`,{children:`Add one to point Claude Code at a different launcher, model or endpoint.`})]}):(0,B.jsx)(`ul`,{className:`bd-set-list`,children:a.map(e=>(0,B.jsxs)(`li`,{className:`bd-set-item bd-set-service`,children:[(0,B.jsxs)(`div`,{className:`bd-set-service-top`,children:[(0,B.jsx)(S,{value:e.name,onChange:t=>p(e.id,{name:t.target.value}),placeholder:`Service name`,"aria-label":`Service name`}),(0,B.jsx)(c,{variant:`ghost`,size:`sm`,icon:!0,className:`bd-set-remove`,"aria-label":`Remove ${e.name||`service`}`,onClick:()=>_(e.id),children:(0,B.jsx)(o,{size:16,"aria-hidden":`true`})})]}),(0,B.jsxs)(`div`,{className:`bd-set-service-grid`,children:[(0,B.jsx)(S,{value:e.launcherPrefix??``,onChange:t=>p(e.id,{launcherPrefix:t.target.value||void 0}),placeholder:`Launcher prefix, e.g. ollama launch`,"aria-label":`Launcher prefix`,spellCheck:!1,className:`bd-set-mono`}),(0,B.jsx)(S,{value:e.modelFlag??``,onChange:t=>p(e.id,{modelFlag:t.target.value||void 0}),placeholder:`Model, e.g. qwen3-coder`,"aria-label":`Model`,spellCheck:!1,className:`bd-set-mono`})]}),(0,B.jsx)(S,{value:e.baseURL??``,onChange:t=>p(e.id,{baseURL:t.target.value||void 0}),placeholder:`Base URL, e.g. http://localhost:11434/v1`,"aria-label":`Base URL`,spellCheck:!1,className:`bd-set-mono`})]},e.id))}),t[19]=_,t[20]=a,t[21]=p,t[22]=w):w=t[22];let T;t[23]===d?T=t[24]:(T=(0,B.jsx)(`div`,{children:(0,B.jsx)(c,{size:`sm`,onClick:d,children:`Add service`})}),t[23]=d,t[24]=T);let E;t[25]!==w||t[26]!==T?(E=(0,B.jsxs)(W,{title:`Services`,children:[w,T]}),t[25]=w,t[26]=T,t[27]=E):E=t[27];let D;return t[28]!==E||t[29]!==C?(D=(0,B.jsxs)(B.Fragment,{children:[b,C,E]}),t[28]=E,t[29]=C,t[30]=D):D=t[30],D}function ie(e){return{value:e.id,label:e.name}}function ae(e){return{...e,apiServices:[...e.apiServices??[],{id:ne(),name:`New service`,assistant:`claude`}]}}function oe(){let[e,n]=(0,I.useState)(null),[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(!1);return(0,I.useEffect)(()=>{let e=!0;return t(`self_compact_statusline_installed`).then(t=>e&&n(t)).catch(()=>e&&i(!0)),()=>{e=!1}},[]),{installed:e,unknown:r,busy:a,toggle:async()=>{let r=e===!0;o(!0);try{await t(r?`uninstall_self_compact_statusline`:`install_self_compact_statusline`),n(await t(`self_compact_statusline_installed`))}catch(e){d({title:`Could not ${r?`uninstall`:`install`} the statusline: ${String(e)}`,tone:`danger`,duration:6e3})}finally{o(!1)}}}}var q={enabled:!1,pollIntervalSeconds:30,rules:[]};function se(e){let t=(0,z.c)(30),{settings:n,update:r}=e,i=n.selfCompact??q,a=oe(),{installed:o}=a,l=a.unknown?`Could not read ~/.claude/settings.json.`:o===null?`Checking installation…`:o?`Lives in ~/.claude/settings.json. Each turn snapshots context usage for the guard. Installing or removing applies immediately.`:`Without it the guard has no usage data to act on. Installing applies immediately.`,u;t[0]===r?u=t[1]:(u=e=>r(t=>({...t,selfCompact:{...t.selfCompact??q,enabled:e}})),t[0]=r,t[1]=u);let d;t[2]!==i.enabled||t[3]!==u?(d=(0,B.jsx)(U,{checked:i.enabled,onChange:u,label:`Auto self-compact`,help:`Watches each session’s context usage and queues a nudge when it crosses a threshold. Stale nudges are dropped once the model compacts.`}),t[2]=i.enabled,t[3]=u,t[4]=d):d=t[4];let f;t[5]!==o||t[6]!==i.enabled?(f=i.enabled&&o===!1&&(0,B.jsx)(`div`,{className:`bd-set-error`,role:`alert`,children:`Auto self-compact is on but the Claude Code statusline isn’t installed, so no context usage is collected and nothing will trigger. Install it below.`}),t[5]=o,t[6]=i.enabled,t[7]=f):f=t[7];let p;t[8]===o?p=t[9]:(p=o!==null&&(0,B.jsx)(s,{tone:o?`success`:`warning`,children:o?`Installed`:`Not installed`}),t[8]=o,t[9]=p);let m;t[10]===p?m=t[11]:(m=(0,B.jsxs)(`span`,{className:`bd-set-inline`,children:[`Claude Code statusline`,p]}),t[10]=p,t[11]=m);let h=o?`danger`:`default`,g=a.busy||o===null,_=o?`Uninstall`:`Install`,v;t[12]!==a.busy||t[13]!==a.toggle||t[14]!==h||t[15]!==g||t[16]!==_?(v=(0,B.jsx)(c,{size:`sm`,variant:h,onClick:a.toggle,loading:a.busy,disabled:g,children:_}),t[12]=a.busy,t[13]=a.toggle,t[14]=h,t[15]=g,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==l||t[19]!==m||t[20]!==v?(y=(0,B.jsx)(V,{label:m,help:l,children:v}),t[18]=l,t[19]=m,t[20]=v,t[21]=y):y=t[21];let b;t[22]!==i.enabled||t[23]!==i.rules?(b=i.enabled&&i.rules.length>0&&(0,B.jsx)(`ul`,{className:`bd-set-rules`,"aria-label":`Configured thresholds`,children:i.rules.map(ce)}),t[22]=i.enabled,t[23]=i.rules,t[24]=b):b=t[24];let x;return t[25]!==y||t[26]!==b||t[27]!==d||t[28]!==f?(x=(0,B.jsxs)(W,{title:`Context guard`,rows:!0,children:[d,f,y,b]}),t[25]=y,t[26]=b,t[27]=d,t[28]=f,t[29]=x):x=t[29],x}function ce(e){return(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`span`,{className:`bd-set-mono`,children:[(e.thresholdTokens/1e3).toFixed(0),`k tokens`]}),(0,B.jsx)(T,{size:12,"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:e.action===`compactNow`?`Compact now`:`Queue a prompt`})]},e.id)}var J={terminalFontSize:15,sessionDetailFontSize:12,idleMinutes:30,maxSessions:8},le=[{id:`popup`,label:`Popup`,hint:`Grows out of the card you click`},{id:`drawer`,label:`Drawer`,hint:`Slides in from the right`}];function ue(e){let t=(0,z.c)(5),{value:n,onChange:r}=e,i;t[0]!==r||t[1]!==n?(i=le.map(e=>(0,B.jsxs)(`label`,{className:`bd-set-choice`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`card-view`,value:e.id,checked:n===e.id,onChange:()=>r(e.id)}),(0,B.jsxs)(`span`,{className:`bd-set-thumb bd-set-thumb--${e.id}`,"aria-hidden":`true`,children:[(0,B.jsx)(`i`,{}),(0,B.jsx)(`i`,{}),(0,B.jsx)(`i`,{}),(0,B.jsx)(`b`,{})]}),(0,B.jsx)(`span`,{className:`bd-set-choice-label`,children:e.label}),(0,B.jsx)(`span`,{className:`bd-set-help`,children:e.hint})]},e.id)),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;return t[3]===i?a=t[4]:(a=(0,B.jsx)(`div`,{className:`bd-set-choices`,role:`radiogroup`,"aria-label":`Open cards as`,children:i}),t[3]=i,t[4]=a),a}function de(e){let t=(0,z.c)(41),{settings:n,update:r}=e,i=n.terminalSessions,a;t[0]===r?a=t[1]:(a=e=>r(t=>({...t,terminalSessions:{idleMinutes:J.idleMinutes,maxSessions:J.maxSessions,...t.terminalSessions,...e}})),t[0]=r,t[1]=a);let o=a,s=n.cardDetailMode??`popup`,c;t[2]===r?c=t[3]:(c=e=>r(t=>({...t,cardDetailMode:e})),t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,B.jsx)(W,{title:`Open cards as`,children:(0,B.jsx)(ue,{value:s,onChange:c})}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u=n.terminalFontSize||J.terminalFontSize,d;t[7]===r?d=t[8]:(d=e=>r(t=>({...t,terminalFontSize:e})),t[7]=r,t[8]=d);let f;t[9]!==u||t[10]!==d?(f=(0,B.jsx)(V,{label:`Terminal`,help:`Applies to terminals opened from now on.`,children:(0,B.jsx)(G,{label:`Terminal text size`,unit:`pt`,min:8,max:24,value:u,onChange:d})}),t[9]=u,t[10]=d,t[11]=f):f=t[11];let p=n.sessionDetailFontSize||J.sessionDetailFontSize,m;t[12]===r?m=t[13]:(m=e=>r(t=>({...t,sessionDetailFontSize:e})),t[12]=r,t[13]=m);let h;t[14]!==p||t[15]!==m?(h=(0,B.jsx)(V,{label:`Transcript`,help:`The Trace tab’s session transcript.`,children:(0,B.jsx)(G,{label:`Transcript text size`,unit:`pt`,min:8,max:20,value:p,onChange:m})}),t[14]=p,t[15]=m,t[16]=h):h=t[16];let g;t[17]!==h||t[18]!==f?(g=(0,B.jsxs)(W,{title:`Text size`,rows:!0,children:[f,h]}),t[17]=h,t[18]=f,t[19]=g):g=t[19];let _=i?.idleMinutes??J.idleMinutes,v;t[20]===o?v=t[21]:(v=e=>o({idleMinutes:e}),t[20]=o,t[21]=v);let y;t[22]!==_||t[23]!==v?(y=(0,B.jsx)(V,{label:`Close idle sessions after`,help:`Closes a terminal nobody is attached to once Claude has been idle this long. It resumes from history when reopened. 0 = never.`,children:(0,B.jsx)(G,{label:`Close idle sessions after`,unit:`min`,value:_,onChange:v})}),t[22]=_,t[23]=v,t[24]=y):y=t[24];let b=i?.maxSessions??J.maxSessions,x;t[25]===o?x=t[26]:(x=e=>o({maxSessions:e}),t[25]=o,t[26]=x);let S;t[27]!==b||t[28]!==x?(S=(0,B.jsx)(V,{label:`Keep at most`,help:`Past this many live terminals, the longest-idle are closed first. Sessions in use are never closed. 0 = no limit.`,children:(0,B.jsx)(G,{label:`Maximum live sessions`,unit:`sessions`,value:b,onChange:x})}),t[27]=b,t[28]=x,t[29]=S):S=t[29];let C;t[30]!==y||t[31]!==S?(C=(0,B.jsxs)(W,{title:`Terminal sessions`,rows:!0,children:[y,S]}),t[30]=y,t[31]=S,t[32]=C):C=t[32];let w;t[33]!==n||t[34]!==r?(w=(0,B.jsx)(se,{settings:n,update:r}),t[33]=n,t[34]=r,t[35]=w):w=t[35];let T;return t[36]!==g||t[37]!==C||t[38]!==w||t[39]!==l?(T=(0,B.jsxs)(B.Fragment,{children:[l,g,C,w]}),t[36]=g,t[37]=C,t[38]=w,t[39]=l,t[40]=T):T=t[40],T}function fe(e){let t=(0,z.c)(5),{settings:n,update:r}=e,i;t[0]===r?i=t[1]:(i=e=>r(t=>({...t,notifications:{...t.notifications,notificationsEnabled:e}})),t[0]=r,t[1]=i);let a;return t[2]!==n.notifications.notificationsEnabled||t[3]!==i?(a=(0,B.jsx)(W,{title:`On this computer`,children:(0,B.jsx)(U,{checked:n.notifications.notificationsEnabled,onChange:i,label:`System notifications`,help:`Notify when Claude finishes a turn and needs your input.`})}),t[2]=n.notifications.notificationsEnabled,t[3]=i,t[4]=a):a=t[4],a}var Y=/^[a-zA-Z]:$/;function X(e){let t=e.replace(/[\\/]+$/,``);return t===``?e.slice(0,1):Y.test(t)?`${t}${e[t.length]??`\\`}`:t}function Z(e){return e.split(/[/\\]/).filter(Boolean).pop()??e}function pe(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));if(t<0)return e;let n=e.slice(0,t);return n===``?e.slice(0,1):Y.test(n)?`${n}${e[t]}`:n}function Q(e){let t=X(e.trim()).replace(/\\/g,`/`);return/^[a-zA-Z]:|^\/\//.test(t)?t.toLowerCase():t}var me=(0,I.memo)(function(e){let t=(0,z.c)(46),{project:n,expanded:r,defaultFilter:i,onToggle:a,onRemove:s,onPatch:u}=e,d=(0,I.useId)(),f;t[0]!==n.name||t[1]!==n.path?(f=n.name??Z(n.path),t[0]=n.name,t[1]=n.path,t[2]=f):f=t[2];let p=f,m=r||void 0,h=r?d:void 0,g;t[3]!==a||t[4]!==n.path?(g=()=>a(n.path),t[3]=a,t[4]=n.path,t[5]=g):g=t[5];let _,v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,B.jsx)(T,{className:`bd-set-chevron`,"aria-hidden":`true`}),v=(0,B.jsx)(C,{className:`bd-set-item-icon`,size:18,"aria-hidden":`true`}),t[6]=_,t[7]=v):(_=t[6],v=t[7]);let y;t[8]===p?y=t[9]:(y=(0,B.jsx)(`span`,{className:`bd-set-item-name`,children:p}),t[8]=p,t[9]=y);let b;t[10]===n.path?b=t[11]:(b=(0,B.jsx)(`bdi`,{children:n.path}),t[10]=n.path,t[11]=b);let x;t[12]!==n.path||t[13]!==b?(x=(0,B.jsx)(`span`,{className:`bd-set-item-sub bd-set-path`,title:n.path,children:b}),t[12]=n.path,t[13]=b,t[14]=x):x=t[14];let w;t[15]!==y||t[16]!==x?(w=(0,B.jsxs)(`span`,{className:`bd-set-item-text`,children:[y,x]}),t[15]=y,t[16]=x,t[17]=w):w=t[17];let E;t[18]!==r||t[19]!==w||t[20]!==h||t[21]!==g?(E=(0,B.jsxs)(`button`,{type:`button`,className:`bd-set-item-toggle`,"aria-expanded":r,"aria-controls":h,onClick:g,children:[_,v,w]}),t[18]=r,t[19]=w,t[20]=h,t[21]=g,t[22]=E):E=t[22];let D=`Remove ${p}`,O;t[23]!==s||t[24]!==n.path?(O=()=>s(n.path),t[23]=s,t[24]=n.path,t[25]=O):O=t[25];let k;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,B.jsx)(o,{size:16,"aria-hidden":`true`}),t[26]=k):k=t[26];let A;t[27]!==D||t[28]!==O?(A=(0,B.jsx)(c,{variant:`ghost`,size:`sm`,icon:!0,className:`bd-set-remove`,"aria-label":D,onClick:O,children:k}),t[27]=D,t[28]=O,t[29]=A):A=t[29];let j;t[30]!==E||t[31]!==A?(j=(0,B.jsxs)(`div`,{className:`bd-set-item-head`,children:[E,A]}),t[30]=E,t[31]=A,t[32]=j):j=t[32];let M;t[33]!==i||t[34]!==r||t[35]!==u||t[36]!==n.githubFilter||t[37]!==n.name||t[38]!==n.path||t[39]!==n.repoRoot||t[40]!==d?(M=r&&(0,B.jsxs)(`div`,{className:`bd-set-item-body`,id:d,children:[(0,B.jsx)(H,{label:`Display name`,children:(0,B.jsx)(S,{value:n.name??``,onChange:e=>u(n.path,{name:e.target.value||void 0}),placeholder:Z(n.path)})}),(0,B.jsx)(H,{label:`Repo root`,help:`Set this when the project is a sub-folder of its git repo. Used for git remote, gh and worktrees.`,children:(0,B.jsxs)(`div`,{className:`bd-set-add`,children:[(0,B.jsx)(S,{value:n.repoRoot??``,onChange:e=>u(n.path,{repoRoot:e.target.value||void 0}),placeholder:n.path,"aria-label":`Repo root`,spellCheck:!1,className:`bd-set-mono`}),(0,B.jsx)(c,{onClick:async()=>{let e=await l(`Select the repo root`,n.path);e&&u(n.path,{repoRoot:e})},children:`Browse…`})]})}),(0,B.jsx)(H,{label:`GitHub issue filter`,help:`Falls back to the filter in GitHub settings when empty.`,children:(0,B.jsx)(S,{value:n.githubFilter??``,onChange:e=>u(n.path,{githubFilter:e.target.value||void 0}),placeholder:i||`assignee:@me is:open`})})]}),t[33]=i,t[34]=r,t[35]=u,t[36]=n.githubFilter,t[37]=n.name,t[38]=n.path,t[39]=n.repoRoot,t[40]=d,t[41]=M):M=t[41];let N;return t[42]!==j||t[43]!==M||t[44]!==m?(N=(0,B.jsxs)(`li`,{className:`bd-set-item`,"data-open":m,children:[j,M]}),t[42]=j,t[43]=M,t[44]=m,t[45]=N):N=t[45],N}),he=/(^|[\\/])(\.[^\\/]+|worktrees)([\\/]|$)/,ge=8;function _e({settings:e,update:n}){let[r,i]=(0,I.useState)(``),[o,s]=(0,I.useState)(null),[u,p]=(0,I.useState)(!1),[m,h]=(0,I.useState)(null),[g,_]=(0,I.useState)([]),v=(0,I.useId)(),{projects:y}=e;(0,I.useEffect)(()=>{let e=!0;return f().then(t=>e&&_(t)).catch(()=>e&&_([])),()=>{e=!1}},[]);let b=(0,I.useMemo)(()=>{let e=new Set(y.map(e=>Q(e.path)));return g.filter(t=>!e.has(Q(t))&&!he.test(t)).slice(0,ge)},[g,y]),x=(e,t=!0)=>{let r=X(e.trim());if(!r)return;let i=Q(r),a=y.find(e=>Q(e.path)===i);a?(h(a.path),d({title:`${Z(a.path)} is already in your projects`})):(n(e=>e.projects.some(e=>Q(e.path)===i)?e:{...e,projects:[...e.projects,{path:r}]}),t&&h(r))},w=async()=>{let e=await l(`Add a project folder`);e&&(s(null),x(e,!1))},T=async()=>{let e=r.trim();if(e&&!u){p(!0);try{let n=await t(`fs_list`,{path:e});s(null),i(``),x(n.path)}catch{s(`That folder doesn’t exist, or DevBoard can’t read it.`)}finally{p(!1)}}},E=(0,I.useCallback)(e=>h(t=>t===e?null:e),[]),D=(0,I.useCallback)((e,t)=>n(n=>({...n,projects:n.projects.map(n=>n.path===e?L(n,t):n)})),[n]),O=(0,I.useCallback)(e=>{n(t=>({...t,projects:t.projects.filter(t=>t.path!==e)})),h(t=>t===e?null:t)},[n]);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(W,{title:`Add a project`,children:[(0,B.jsxs)(`div`,{className:`bd-set-add`,children:[(0,B.jsx)(S,{icon:(0,B.jsx)(M,{size:16,"aria-hidden":`true`}),value:r,onChange:e=>{i(e.target.value),o&&s(null)},onKeyDown:e=>{e.key===`Enter`&&T()},placeholder:`Paste a folder path and press Enter`,"aria-label":`Project path`,"aria-describedby":o?v:void 0,invalid:!!o,spellCheck:!1,className:`bd-set-mono`}),(0,B.jsxs)(c,{onClick:w,children:[(0,B.jsx)(P,{size:16,"aria-hidden":`true`}),`Browse…`]})]}),o&&(0,B.jsx)(`p`,{className:`bd-set-fielderr`,id:v,role:`alert`,children:o})]}),(0,B.jsx)(W,{title:y.length?`Your projects · ${y.length}`:`Your projects`,children:y.length===0?(0,B.jsxs)(`div`,{className:`bd-set-empty`,children:[(0,B.jsx)(`strong`,{children:`No projects yet`}),(0,B.jsx)(`span`,{children:b.length>0?`Pick one of the folders found in your sessions below, or browse for another.`:`Add the folders you run agents in. They appear in the project switcher.`})]}):(0,B.jsx)(`ul`,{className:`bd-set-list`,children:y.map(t=>(0,B.jsx)(me,{project:t,expanded:m===t.path,defaultFilter:e.github.defaultFilter,onToggle:E,onRemove:O,onPatch:D},t.path))})}),b.length>0&&(0,B.jsx)(W,{title:`Found in your sessions`,children:(0,B.jsx)(`ul`,{className:`bd-set-suggest`,children:b.map(e=>(0,B.jsxs)(`li`,{children:[(0,B.jsx)(C,{size:16,"aria-hidden":`true`}),(0,B.jsxs)(`span`,{className:`bd-set-suggest-text`,title:e,children:[(0,B.jsx)(`span`,{className:`bd-set-suggest-name`,children:Z(e)}),(0,B.jsx)(`span`,{className:`bd-set-path`,children:(0,B.jsx)(`bdi`,{children:pe(e)})})]}),(0,B.jsxs)(c,{size:`sm`,"aria-label":`Add ${Z(e)}`,onClick:()=>x(e),children:[(0,B.jsx)(a,{size:14,"aria-hidden":`true`}),`Add`]})]},e))})})]})}var $=[{id:`general`,label:`General`,blurb:`Text sizes, terminal sessions and the context guard.`,icon:h,Component:de},{id:`projects`,label:`Projects`,blurb:`Folders DevBoard tracks, with per-project overrides.`,icon:C,Component:_e},{id:`notifications`,label:`Notifications`,blurb:`Get pulled in only when an agent needs you.`,icon:O,Component:fe},{id:`apis`,label:`API services`,blurb:`Route assistants through a launcher, model or custom endpoint.`,icon:A,Component:re}];function ve(){let e=v(e=>e.setSettingsOpen),[t,n]=(0,I.useState)(null),[r,i]=(0,I.useState)(null),[a,o]=(0,I.useState)(null),[s,l]=(0,I.useState)(0),[u,f]=(0,I.useState)(!1),[m,h]=(0,I.useState)($[0].id),[g,S]=(0,I.useState)(()=>new Set([$[0].id])),C=(0,I.useRef)(null),w=(0,I.useRef)(new Map);(0,I.useEffect)(()=>{let e=!0;return _().then(t=>{e&&(i(t),n(t))}).catch(t=>e&&o(String(t))),()=>{e=!1}},[s]);let T=(0,I.useCallback)(e=>n(t=>t&&e(t)),[]),D=(0,I.useMemo)(()=>t!==null&&r!==null&&!E(t,r),[t,r]);(0,I.useEffect)(()=>(b(D),()=>b(!1)),[D]);let O=async()=>{if(t&&r){f(!0);try{let n=await _();await x(te(r,t,n)),d({title:`Settings saved`,tone:`success`}),e(!1)}catch(e){d({title:`Could not save settings: ${String(e)}`,tone:`danger`,duration:6e3})}finally{f(!1)}}},k=e=>{h(e),S(t=>t.has(e)?t:new Set(t).add(e)),C.current?.scrollTo({top:0})},A=e=>{let t=$.findIndex(e=>e.id===m),n=$.length-1,r=e.key===`ArrowDown`?(t+1)%$.length:e.key===`ArrowUp`?(t+n)%$.length:e.key===`Home`?0:e.key===`End`?n:-1;if(r<0)return;e.preventDefault();let i=$[r].id;k(i),w.current.get(i)?.focus()},j=$.find(e=>e.id===m)??$[0],M=()=>{u||y()};return(0,B.jsx)(p,{open:!0,onOpenChange:e=>!e&&M(),title:`Settings`,width:920,className:`bd-settings`,footer:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`bd-set-dirty`,"aria-live":`polite`,children:D?`Unsaved changes`:``}),(0,B.jsx)(c,{variant:`ghost`,onClick:M,disabled:u,children:`Cancel`}),(0,B.jsx)(c,{variant:`solid`,onClick:O,loading:u,disabled:!D||u,children:`Save changes`})]}),children:(0,B.jsxs)(`div`,{className:`bd-set-body`,children:[(0,B.jsx)(`div`,{className:`bd-set-nav`,"aria-label":`Settings sections`,role:`tablist`,"aria-orientation":`vertical`,onKeyDown:A,children:$.map(e=>(0,B.jsxs)(`button`,{id:`bd-set-tab-${e.id}`,ref:t=>{t?w.current.set(e.id,t):w.current.delete(e.id)},type:`button`,role:`tab`,"aria-selected":m===e.id,"aria-controls":g.has(e.id)?`bd-set-panel-${e.id}`:void 0,tabIndex:m===e.id?0:-1,className:`bd-set-tab`,onClick:()=>k(e.id),children:[(0,B.jsx)(e.icon,{size:18,strokeWidth:1.75,"aria-hidden":`true`}),e.label]},e.id))}),(0,B.jsxs)(`div`,{className:`bd-set-pane`,ref:C,children:[(0,B.jsxs)(`header`,{className:`bd-set-pane-head`,children:[(0,B.jsx)(`h3`,{children:j.label}),(0,B.jsx)(`p`,{children:j.blurb})]}),a?(0,B.jsxs)(`div`,{className:`bd-set-error`,role:`alert`,children:[`Could not load settings: `,a,(0,B.jsx)(`div`,{children:(0,B.jsx)(c,{size:`sm`,onClick:()=>{o(null),l(e=>e+1)},children:`Try again`})})]}):t?$.filter(e=>g.has(e.id)).map(({id:e,Component:n})=>(0,B.jsx)(`div`,{id:`bd-set-panel-${e}`,className:`bd-set-content`,role:`tabpanel`,"aria-labelledby":`bd-set-tab-${e}`,hidden:e!==m,children:(0,B.jsx)(n,{settings:t,update:T})},e)):(0,B.jsx)(`div`,{className:`bd-set-loading`,children:`Loading settings…`})]})]})})}export{ve as default};
@@ -0,0 +1 @@
1
+ import{d as e,m as t,t as n}from"./jsx-runtime-QmcfnBgR.js";import{t as r}from"./plus-Cecrm8sZ.js";import{o as i}from"./Surface-BQKeigoq.js";import{B as a,D as o,Q as s,et as c,ut as l,v as u,yt as d}from"./index-CQnL8JJ5.js";var f=t(e(),1),p=n(),m=e=>e.replace(/[/\\]+$/,``).split(/[/\\]/).pop()||e;function h(){let[e,t]=(0,f.useState)(``),[n,h]=(0,f.useState)(!1),[g,_]=(0,f.useState)([]);(0,f.useEffect)(()=>{s().then(e=>_(e.slice(0,6))).catch(()=>_([]))},[]);let v=async e=>{let t=e.trim();if(t&&!n){h(!0);try{let e=await c();e.projects.some(e=>e.path===t)||await l({...e,projects:[...e.projects,{path:t}]}),o({title:`Added ${m(t)}`,tone:`success`})}catch(e){o({title:`Could not add project: ${String(e)}`,tone:`danger`,duration:6e3})}finally{h(!1)}}};return(0,p.jsx)(`div`,{className:`bd-setup`,children:(0,p.jsxs)(`div`,{className:`bd-setup-panel`,children:[(0,p.jsx)(`h1`,{children:`Add a project to get started`}),(0,p.jsx)(`p`,{className:`bd-setup-lead`,children:`DevBoard only shows work from folders you choose. Add a project and its Claude sessions, branches and pull requests land on the board.`}),(0,p.jsxs)(i,{variant:`solid`,size:`lg`,onClick:async()=>{let e=await a(`Select project folder`);e&&await v(e)},disabled:n,"data-autofocus":!0,children:[(0,p.jsx)(d,{size:18,"aria-hidden":`true`}),`Choose project folder`]}),(0,p.jsxs)(`form`,{className:`bd-setup-path`,onSubmit:n=>{n.preventDefault(),v(e).then(()=>t(``))},children:[(0,p.jsx)(u,{value:e,onChange:e=>t(e.target.value),placeholder:`Or paste a folder path`,"aria-label":`Project folder path`,spellCheck:!1}),(0,p.jsxs)(i,{type:`submit`,disabled:!e.trim()||n,children:[(0,p.jsx)(r,{size:16,"aria-hidden":`true`}),`Add`]})]}),g.length>0&&(0,p.jsxs)(`section`,{className:`bd-setup-found`,"aria-labelledby":`bd-setup-found-h`,children:[(0,p.jsx)(`h2`,{id:`bd-setup-found-h`,children:`Found in your Claude sessions`}),(0,p.jsx)(`ul`,{children:g.map(e=>(0,p.jsxs)(`li`,{children:[(0,p.jsxs)(`span`,{className:`bd-setup-found-text`,children:[(0,p.jsx)(`b`,{children:m(e)}),(0,p.jsx)(`span`,{title:e,children:e})]}),(0,p.jsx)(i,{size:`sm`,onClick:()=>v(e),disabled:n,"aria-label":`Add ${m(e)}`,children:`Add`})]},e))})]})]})})}export{h as default};