zdashboard 2.13.0 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/cli.js +45 -118
  2. package/dist/cli.js.map +1 -1
  3. package/dist/web/assets/{FileIcon-KX0Rfn5x.js → FileIcon-qMWiXCuh.js} +1 -1
  4. package/dist/web/assets/{FilterPills-D2zZaent.js → FilterPills-D4oEoDdf.js} +1 -1
  5. package/dist/web/assets/Sidebar-K85f6s_v.js +1 -0
  6. package/dist/web/assets/{Sidebar-B6Pvc7pb.js → Sidebar-UhpDd_r6.js} +1 -1
  7. package/dist/web/assets/{DiagramViewer-CQYfB79k.js → UnsupportedViewer-DW7gYl0e.js} +49 -50
  8. package/dist/web/assets/Workspace-CDIORqDn.js +2 -0
  9. package/dist/web/assets/{Workspace-5hZEbEDw.js → Workspace-CEGk753f.js} +1 -1
  10. package/dist/web/assets/{Workspace-CpV2wf10.js → Workspace-D1535fIs.js} +2 -2
  11. package/dist/web/assets/Workspace-FYtBxShi.js +1 -0
  12. package/dist/web/assets/{cynefin-OW5HDTMX-BLthHq8j.js → cynefin-OW5HDTMX-CafNfxMw.js} +2 -2
  13. package/dist/web/assets/{excalidraw-Duf4g83v.js → excalidraw-B6QTBxnj.js} +6 -6
  14. package/dist/web/assets/index-B7bsV2ku.css +1 -0
  15. package/dist/web/assets/{index-BxPRo4R9.js → index-Ipssembb.js} +9 -9
  16. package/dist/web/assets/{usePluginData-BaCM6nnK.js → usePluginData-B8y55C_P.js} +1 -1
  17. package/dist/web/assets/{web-oi27dtPg.js → web-BT48JLMA.js} +2 -2
  18. package/dist/web/assets/web-CeRdVt5Q.js +2 -0
  19. package/dist/web/assets/{web-C7ddFKgL.js → web-DKDQ9hoO.js} +2 -2
  20. package/dist/web/assets/{web-CmZk5ox_.js → web-QjEj88xq.js} +2 -2
  21. package/dist/web/index.html +2 -2
  22. package/package.json +1 -1
  23. package/dist/web/assets/Sidebar-Cg5Nabqa.js +0 -1
  24. package/dist/web/assets/Workspace-BzLI5G5q.js +0 -1
  25. package/dist/web/assets/Workspace-DbRd77b0.js +0 -1
  26. package/dist/web/assets/index-DJ7iFi2B.css +0 -1
  27. package/dist/web/assets/web-CBXj6xFf.js +0 -2
  28. /package/dist/web/assets/{DiagramViewer-BTcE7LSd.css → UnsupportedViewer-BTcE7LSd.css} +0 -0
@@ -1 +1 @@
1
- import{j as o}from"./vendor-react-OhDMXABq.js";import{u as r}from"./index-BxPRo4R9.js";function a({className:s=""}){return o.jsx("span",{"data-testid":"refresh-spinner",role:"status","aria-label":"刷新中",className:`inline-block h-3 w-3 flex-none shrink-0 animate-spin rounded-[var(--radius-full)] border border-muted-foreground/25 border-t-muted-foreground ${s}`})}const i={".md":"md",".markdown":"md",".mdx":"md",".ts":"ts",".tsx":"tsx",".js":"js",".jsx":"jsx",".mjs":"mjs",".cjs":"mjs",".mts":"mjs",".cts":"mjs",".css":"css",".scss":"css",".less":"css",".html":"html",".htm":"html",".json":"json",".yaml":"json",".yml":"json",".toml":"json",".csv":"csv",".tsv":"csv",".sh":"sh",".bash":"sh",".zsh":"sh",".sql":"sh",".py":"py",".go":"py",".rs":"py",".java":"py",".svg":"svg",".png":"svg",".jpg":"svg",".jpeg":"svg",".gif":"svg",".webp":"svg",".ico":"svg"};function c(s){const e=s.toLowerCase();if(e==="justfile"||e==="makefile")return e;const n=s.lastIndexOf("."),t=n>=0?s.slice(n).toLowerCase():"";return i[t]??"unknown"}function u({name:s,active:e}){const{icon:n}=r(),t=n(c(s));return t?o.jsx("span",{className:`h-3.5 w-3.5 shrink-0 inline-flex items-center justify-center ${e?"text-primary":"text-muted-foreground"}`,children:t}):null}export{u as F,a as R};
1
+ import{j as o}from"./vendor-react-OhDMXABq.js";import{u as r}from"./index-Ipssembb.js";function a({className:s=""}){return o.jsx("span",{"data-testid":"refresh-spinner",role:"status","aria-label":"刷新中",className:`inline-block h-3 w-3 flex-none shrink-0 animate-spin rounded-[var(--radius-full)] border border-muted-foreground/25 border-t-muted-foreground ${s}`})}const i={".md":"md",".markdown":"md",".mdx":"md",".ts":"ts",".tsx":"tsx",".js":"js",".jsx":"jsx",".mjs":"mjs",".cjs":"mjs",".mts":"mjs",".cts":"mjs",".css":"css",".scss":"css",".less":"css",".html":"html",".htm":"html",".json":"json",".yaml":"json",".yml":"json",".toml":"json",".csv":"csv",".tsv":"csv",".sh":"sh",".bash":"sh",".zsh":"sh",".sql":"sh",".py":"py",".go":"py",".rs":"py",".java":"py",".svg":"svg",".png":"svg",".jpg":"svg",".jpeg":"svg",".gif":"svg",".webp":"svg",".ico":"svg"};function c(s){const e=s.toLowerCase();if(e==="justfile"||e==="makefile")return e;const n=s.lastIndexOf("."),t=n>=0?s.slice(n).toLowerCase():"";return i[t]??"unknown"}function u({name:s,active:e}){const{icon:n}=r(),t=n(c(s));return t?o.jsx("span",{className:`h-3.5 w-3.5 shrink-0 inline-flex items-center justify-center ${e?"text-primary":"text-muted-foreground"}`,children:t}):null}export{u as F,a as R};
@@ -1 +1 @@
1
- import{j as e}from"./vendor-react-OhDMXABq.js";import{d as n}from"./index-BxPRo4R9.js";function b({items:l,value:d,onChange:p,ariaLabel:c,renderExtra:o,renderLabel:a,className:t,...u}){return e.jsx("div",{role:"group","aria-label":c,className:n("inline-flex items-center gap-1.5 flex-wrap",t),...u,children:l.map(r=>{const s=r.key===d;return e.jsxs("button",{type:"button","aria-pressed":s,onClick:()=>p(r.key),className:n("inline-flex items-center gap-1.5 h-7 px-2.5 rounded-[var(--radius-full)] border text-xs transition-colors",s?"bg-primary text-primary-foreground border-primary":"border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground/40",r.className),children:[r.renderLabel?r.renderLabel(r):a?a(r):e.jsx("span",{children:r.label}),r.badge&&e.jsx("span",{className:"opacity-80",children:r.badge}),r.renderExtra?r.renderExtra(r):o==null?void 0:o(r)]},r.key)})})}export{b as F};
1
+ import{j as e}from"./vendor-react-OhDMXABq.js";import{c as n}from"./index-Ipssembb.js";function b({items:l,value:d,onChange:c,ariaLabel:p,renderExtra:o,renderLabel:a,className:t,...u}){return e.jsx("div",{role:"group","aria-label":p,className:n("inline-flex items-center gap-1.5 flex-wrap",t),...u,children:l.map(r=>{const s=r.key===d;return e.jsxs("button",{type:"button","aria-pressed":s,onClick:()=>c(r.key),className:n("inline-flex items-center gap-1.5 h-7 px-2.5 rounded-[var(--radius-full)] border text-xs transition-colors",s?"bg-primary text-primary-foreground border-primary":"border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground/40",r.className),children:[r.renderLabel?r.renderLabel(r):a?a(r):e.jsx("span",{children:r.label}),r.badge&&e.jsx("span",{className:"opacity-80",children:r.badge}),r.renderExtra?r.renderExtra(r):o==null?void 0:o(r)]},r.key)})})}export{b as F};
@@ -0,0 +1 @@
1
+ import{r as p,j as e}from"./vendor-react-OhDMXABq.js";import{R as g,F as x}from"./FileIcon-qMWiXCuh.js";import{e as j,u as c,S as b,d as y,E as N}from"./index-Ipssembb.js";import{u as v}from"./usePluginData-B8y55C_P.js";import{a as k}from"./fetchJson-D-dWeu1j.js";import"./vendor-ui-D8qdFUhC.js";import"./index-D7HrI6pR.js";function f(r,a){return!a||r.name.toLowerCase().includes(a)?!0:(r.children??[]).some(o=>f(o,a))}function h({node:r,depth:a,filter:o,current:i,onSelect:s}){const{icon:d}=c(),[m,l]=p.useState(!r.defaultCollapsed),t=(r.children??[]).filter(n=>f(n,o)),u=o?!0:m;return!t.length&&o?null:e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:()=>l(n=>!n),"aria-expanded":u,className:"w-full flex items-center gap-1.5 px-2 py-1 text-sm text-foreground hover:bg-muted rounded-md",style:{paddingLeft:8+a*14},children:[e.jsx("span",{className:`h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-transform ${u?"rotate-90":""}`,children:d("chevron-right")}),e.jsx("span",{className:"h-3.5 w-3.5 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-colors",children:d(u?"folder-open":"folder")}),e.jsx("span",{className:"truncate",children:r.name})]}),u&&t.map(n=>n.kind==="dir"?e.jsx(h,{node:n,depth:a+1,filter:o,current:i,onSelect:s},n.name):e.jsxs("button",{type:"button",onClick:()=>n.path&&s(n.path),className:`w-full flex items-center gap-2 px-2.5 py-1.5 text-xs hover:bg-muted rounded-md ${i===n.path?"bg-primary/10 text-foreground font-medium":"text-muted-foreground"}`,style:{paddingLeft:20+a*14},children:[e.jsx(x,{name:n.name,active:i===n.path}),e.jsx("span",{className:"truncate",children:n.name})]},n.path))]})}function w({node:r,current:a,onSelect:o}){var l;const{icon:i}=c(),[s,d]=p.useState(!0),m=(l=r.name.match(/\((\d+)\)$/))==null?void 0:l[1];return e.jsxs("div",{className:"mb-1.5 px-1",children:[e.jsxs("button",{type:"button",onClick:()=>d(t=>!t),"aria-expanded":s,className:"w-full flex items-center gap-1.5 pt-2 pb-1 text-sm font-semibold uppercase tracking-wide text-muted-foreground hover:text-foreground rounded-md",children:[i("chevron-right",`h-3 w-3 shrink-0 transition-transform ${s?"rotate-90":""}`),e.jsx("span",{className:"truncate",children:r.name.replace(/\s\(\d+\)$/,"")}),m&&e.jsx("span",{className:"ml-auto shrink-0 rounded-full bg-muted px-1.5 font-mono text-xs font-normal",children:m})]}),s&&(r.children??[]).map(t=>t.kind==="dir"?e.jsx(h,{node:t,depth:1,filter:"",current:a,onSelect:o},t.name):e.jsxs("button",{type:"button",onClick:()=>t.path&&o(t.path),className:`w-full flex items-center gap-2 px-2.5 py-1.5 text-xs hover:bg-muted rounded-md ${a===t.path?"bg-primary/10 text-foreground font-medium":"text-muted-foreground"}`,children:[e.jsx(x,{name:t.name,active:a===t.path}),e.jsx("span",{className:"truncate",children:t.name})]},t.path))]})}function F(){var l;const r=j(),a=r.params.get("asset"),[o,i]=p.useState("");c();const s=v("design:/__design/assets",()=>k("/__design/assets",{cache:"no-store"}),{subscribe:"files"}),d=(((l=s.data)==null?void 0:l.tree)??[]).filter(t=>t.kind==="dir"),m=!s.error&&(s.data||!s.loading)&&d.length===0;return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"p-3 text-xs text-muted-foreground truncate flex-none flex items-center gap-2",children:["设计资产",s.refreshing&&e.jsx(g,{})]}),s.loading&&!s.data&&e.jsx(b,{rows:6,className:"mx-3"}),s.error&&e.jsx(y,{message:s.error,onRetry:s.reload}),m&&e.jsx(N,{title:"未发现设计资产",hint:"在项目根创建 prototypes/ 或 design/ 目录并放入产物"}),e.jsx("div",{className:"px-2 pb-2",children:e.jsx("input",{value:o,onChange:t=>i(t.target.value.toLowerCase()),placeholder:"过滤…","aria-label":"过滤设计资产",className:"w-full h-7 px-2 text-xs rounded border border-border bg-background focus:border-primary"})}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:d.map(t=>e.jsx(w,{node:t,current:a,onSelect:u=>r.navigate({asset:u})},t.name))})]})}export{F as default};
@@ -1 +1 @@
1
- import{r as L,j as e}from"./vendor-react-OhDMXABq.js";import{b as O,u as I,S as P,E as M,c as _,r as K,s as U}from"./index-BxPRo4R9.js";import{R as V,F as Y}from"./FileIcon-KX0Rfn5x.js";import{u as B}from"./usePluginData-BaCM6nnK.js";import{a as b}from"./fetchJson-D-dWeu1j.js";import"./vendor-ui-D8qdFUhC.js";import"./index-D7HrI6pR.js";function h(r,n){return!n||r.name.toLowerCase().includes(n)?!0:(r.children??[]).some(l=>h(l,n))}const $="zd-view-collapse";function G(r){if(!r||typeof r!="object"||Array.isArray(r))return!1;const n=r;return Array.isArray(n.wt)&&n.wt.every(l=>typeof l=="string")&&typeof n.root=="boolean"}const H=()=>K($,{wt:[],root:!1},G);function F(r){U($,JSON.stringify(r))}async function Q(){const r=await b("/__worktrees",{cache:"no-store"}),n={};await Promise.all(r.map(async i=>{const a=await b(`/__files?wt=${encodeURIComponent(i.path)}`,{cache:"no-store"});n[i.path]=a.tree??[]}));const l=await b("/__files",{cache:"no-store"});return{worktrees:r,wtTrees:n,rootTree:l.tree??[]}}function v({node:r,depth:n,filter:l,current:i,onSelectFile:a}){const{icon:f}=I(),d=r.children??[],p=!!l&&r.name.toLowerCase().includes(l)?d:d.filter(s=>h(s,l)),[x,g]=L.useState(!r.defaultCollapsed),o=l?!0:x;return!p.length&&l?null:e.jsxs("div",{children:[(()=>{const s=r.name.match(/^([a-z]+)(?: \((\d+)\))?$/),j=s?f(s[1]):void 0;return e.jsxs("button",{onClick:()=>g(u=>!u),"aria-expanded":o,className:"w-full flex items-center gap-1.5 px-2 py-1 text-sm text-foreground hover:bg-muted rounded-md mx-1",style:{paddingLeft:8+n*14,width:"calc(100% - 8px)"},children:[e.jsx("span",{className:`h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-transform ${o?"rotate-90":""}`,children:f("chevron-right")}),j?e.jsx("span",{className:"h-3.5 w-3.5 shrink-0 inline-flex items-center justify-center text-muted-foreground",children:j}):e.jsx("span",{className:"h-3.5 w-3.5 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-colors",children:f(o?"folder-open":"folder")}),e.jsx("span",{className:"font-medium truncate",children:s?s[1]:r.name}),(s==null?void 0:s[2])&&e.jsx("span",{className:"ml-auto mr-1 shrink-0 rounded-full bg-muted px-1.5 text-xs font-mono text-muted-foreground",children:s[2]})]})})(),o&&p.map(s=>s.kind==="dir"?e.jsx(v,{node:s,depth:n+1,filter:l,current:i,onSelectFile:a},s.name+n):e.jsxs("button",{onClick:()=>s.path&&a(s.path),className:`w-full flex items-center gap-1.5 pr-2 py-1 text-sm hover:bg-muted rounded-md mx-1 ${i===s.path?"bg-primary/10 text-foreground font-medium":"text-muted-foreground"}`,style:{paddingLeft:20+n*14,width:"calc(100% - 8px)"},children:[e.jsx(Y,{name:s.name,active:i===s.path}),e.jsx("span",{className:"truncate",children:s.name})]},s.path))]})}function ne(){var C,E,R;const r=O(),n=r.params,l=n.get("file"),i=n.get("wt"),a=(n.get("filter")??"").toLowerCase(),f=n.get("card")==="dirty",{icon:d}=I(),[m,p]=L.useState(H),x=new Set(m.wt),g=m.root,o=B("view:sidebar-trees",Q,{subscribe:"files"}),s=((C=o.data)==null?void 0:C.worktrees)??[],j=((E=o.data)==null?void 0:E.wtTrees)??{},u=((R=o.data)==null?void 0:R.rootTree)??[],A=t=>{const c=new Set(m.wt);c.has(t)?c.delete(t):c.add(t);const w={...m,wt:[...c]};p(w),F(w)},W=()=>{const t={...m,root:!m.root};p(t),F(t)},D=t=>{r.navigate({filter:t.trim()?t:null},{replace:!0})},N=s.length>0,z=!!a&&(s.some(t=>(j[t.path]??[]).some(c=>h(c,a)))||u.some(t=>h(t,a))),k=!a&&!!o.data&&!N&&u.length===0,S=!!a&&!!o.data&&!z;return e.jsx("div",{className:"p-2 flex flex-col h-full",children:e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[e.jsxs("div",{className:"w-full flex items-center gap-2",children:[e.jsx("input",{value:a,onChange:t=>D(t.target.value),placeholder:"过滤…","data-testid":"view-filter-input",className:"w-full h-7 px-2 text-xs rounded border border-border bg-background focus:border-primary"}),o.refreshing&&e.jsx(V,{})]}),e.jsxs("div",{className:"py-1 flex-1 min-h-0 overflow-auto flex flex-col","data-testid":"view-tree-scroller",children:[o.loading&&!o.data&&e.jsx(P,{rows:6,className:"mx-1 mt-1"}),o.error&&e.jsx(M,{message:o.error,onRetry:o.reload}),k&&e.jsx(_,{title:"暂无可展示的规格文件",hint:"约定扫描目录:openspec / docs / .zdev/apply"}),S&&e.jsx(_,{title:"无匹配结果",hint:"调整或清空过滤词后重试"}),!!o.data&&!o.error&&!k&&!S&&e.jsxs(e.Fragment,{children:[N&&s.map(t=>{const w=(j[t.path]??[]).filter(y=>h(y,a));if(!w.length&&a)return null;const T=f&&t.dirty;return e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:()=>A(t.path),"aria-expanded":!x.has(t.path),"data-drill-dirty":T?"true":void 0,className:`w-full flex items-center gap-1 px-2 py-1.5 text-sm font-medium text-foreground hover:bg-muted rounded-md ${T?"bg-warning/10 ring-1 ring-warning":""}`,children:[e.jsx("span",{className:"h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-transform",children:d("chevron-right",x.has(t.path)?"":"rotate-90")}),e.jsx("span",{className:"h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground",children:d("git-branch")}),e.jsx("span",{className:"truncate",children:t.branch}),t.dirty&&e.jsx("span",{className:"ml-auto flex-none h-2 w-2 rounded-full bg-destructive shrink-0",title:"有未提交变更"})]}),!x.has(t.path)&&e.jsx("div",{className:"ml-2",children:w.map(y=>e.jsx(v,{node:y,depth:1,filter:a,current:i===t.path?l:null,onSelectFile:J=>r.navigate({wt:t.path,file:J})},y.name))})]},t.path)}),u.length>0&&(!a||u.some(t=>h(t,a)))&&e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:W,"aria-expanded":!g,className:"w-full flex items-center gap-1 px-2 py-1.5 text-sm font-medium text-foreground hover:bg-muted rounded-md",children:[e.jsx("span",{className:`h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-transform ${g?"":"rotate-90"}`,children:d("chevron-right")}),e.jsx("span",{className:"h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground",children:d("git-branch")}),e.jsx("span",{children:"当前分支"})]}),!g&&e.jsx("div",{className:"ml-2",children:u.filter(t=>h(t,a)).map(t=>e.jsx(v,{node:t,depth:1,filter:a,current:i?null:l,onSelectFile:c=>r.navigate({wt:null,file:c})},t.name))})]})]})]})]})})}export{ne as default};
1
+ import{r as L,j as e}from"./vendor-react-OhDMXABq.js";import{e as O,u as I,S as P,d as M,E as _,r as K,s as U}from"./index-Ipssembb.js";import{R as V,F as Y}from"./FileIcon-qMWiXCuh.js";import{u as B}from"./usePluginData-B8y55C_P.js";import{a as b}from"./fetchJson-D-dWeu1j.js";import"./vendor-ui-D8qdFUhC.js";import"./index-D7HrI6pR.js";function h(r,n){return!n||r.name.toLowerCase().includes(n)?!0:(r.children??[]).some(l=>h(l,n))}const $="zd-view-collapse";function G(r){if(!r||typeof r!="object"||Array.isArray(r))return!1;const n=r;return Array.isArray(n.wt)&&n.wt.every(l=>typeof l=="string")&&typeof n.root=="boolean"}const H=()=>K($,{wt:[],root:!1},G);function F(r){U($,JSON.stringify(r))}async function Q(){const r=await b("/__worktrees",{cache:"no-store"}),n={};await Promise.all(r.map(async i=>{const a=await b(`/__files?wt=${encodeURIComponent(i.path)}`,{cache:"no-store"});n[i.path]=a.tree??[]}));const l=await b("/__files",{cache:"no-store"});return{worktrees:r,wtTrees:n,rootTree:l.tree??[]}}function v({node:r,depth:n,filter:l,current:i,onSelectFile:a}){const{icon:f}=I(),d=r.children??[],p=!!l&&r.name.toLowerCase().includes(l)?d:d.filter(s=>h(s,l)),[x,g]=L.useState(!r.defaultCollapsed),o=l?!0:x;return!p.length&&l?null:e.jsxs("div",{children:[(()=>{const s=r.name.match(/^([a-z]+)(?: \((\d+)\))?$/),j=s?f(s[1]):void 0;return e.jsxs("button",{onClick:()=>g(u=>!u),"aria-expanded":o,className:"w-full flex items-center gap-1.5 px-2 py-1 text-sm text-foreground hover:bg-muted rounded-md mx-1",style:{paddingLeft:8+n*14,width:"calc(100% - 8px)"},children:[e.jsx("span",{className:`h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-transform ${o?"rotate-90":""}`,children:f("chevron-right")}),j?e.jsx("span",{className:"h-3.5 w-3.5 shrink-0 inline-flex items-center justify-center text-muted-foreground",children:j}):e.jsx("span",{className:"h-3.5 w-3.5 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-colors",children:f(o?"folder-open":"folder")}),e.jsx("span",{className:"font-medium truncate",children:s?s[1]:r.name}),(s==null?void 0:s[2])&&e.jsx("span",{className:"ml-auto mr-1 shrink-0 rounded-full bg-muted px-1.5 text-xs font-mono text-muted-foreground",children:s[2]})]})})(),o&&p.map(s=>s.kind==="dir"?e.jsx(v,{node:s,depth:n+1,filter:l,current:i,onSelectFile:a},s.name+n):e.jsxs("button",{onClick:()=>s.path&&a(s.path),className:`w-full flex items-center gap-1.5 pr-2 py-1 text-sm hover:bg-muted rounded-md mx-1 ${i===s.path?"bg-primary/10 text-foreground font-medium":"text-muted-foreground"}`,style:{paddingLeft:20+n*14,width:"calc(100% - 8px)"},children:[e.jsx(Y,{name:s.name,active:i===s.path}),e.jsx("span",{className:"truncate",children:s.name})]},s.path))]})}function ne(){var C,E,R;const r=O(),n=r.params,l=n.get("file"),i=n.get("wt"),a=(n.get("filter")??"").toLowerCase(),f=n.get("card")==="dirty",{icon:d}=I(),[m,p]=L.useState(H),x=new Set(m.wt),g=m.root,o=B("view:sidebar-trees",Q,{subscribe:"files"}),s=((C=o.data)==null?void 0:C.worktrees)??[],j=((E=o.data)==null?void 0:E.wtTrees)??{},u=((R=o.data)==null?void 0:R.rootTree)??[],A=t=>{const c=new Set(m.wt);c.has(t)?c.delete(t):c.add(t);const w={...m,wt:[...c]};p(w),F(w)},W=()=>{const t={...m,root:!m.root};p(t),F(t)},D=t=>{r.navigate({filter:t.trim()?t:null},{replace:!0})},N=s.length>0,z=!!a&&(s.some(t=>(j[t.path]??[]).some(c=>h(c,a)))||u.some(t=>h(t,a))),k=!a&&!!o.data&&!N&&u.length===0,S=!!a&&!!o.data&&!z;return e.jsx("div",{className:"p-2 flex flex-col h-full",children:e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[e.jsxs("div",{className:"w-full flex items-center gap-2",children:[e.jsx("input",{value:a,onChange:t=>D(t.target.value),placeholder:"过滤…","data-testid":"view-filter-input",className:"w-full h-7 px-2 text-xs rounded border border-border bg-background focus:border-primary"}),o.refreshing&&e.jsx(V,{})]}),e.jsxs("div",{className:"py-1 flex-1 min-h-0 overflow-auto flex flex-col","data-testid":"view-tree-scroller",children:[o.loading&&!o.data&&e.jsx(P,{rows:6,className:"mx-1 mt-1"}),o.error&&e.jsx(M,{message:o.error,onRetry:o.reload}),k&&e.jsx(_,{title:"暂无可展示的规格文件",hint:"约定扫描目录:openspec / docs / .zdev/apply"}),S&&e.jsx(_,{title:"无匹配结果",hint:"调整或清空过滤词后重试"}),!!o.data&&!o.error&&!k&&!S&&e.jsxs(e.Fragment,{children:[N&&s.map(t=>{const w=(j[t.path]??[]).filter(y=>h(y,a));if(!w.length&&a)return null;const T=f&&t.dirty;return e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:()=>A(t.path),"aria-expanded":!x.has(t.path),"data-drill-dirty":T?"true":void 0,className:`w-full flex items-center gap-1 px-2 py-1.5 text-sm font-medium text-foreground hover:bg-muted rounded-md ${T?"bg-warning/10 ring-1 ring-warning":""}`,children:[e.jsx("span",{className:"h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-transform",children:d("chevron-right",x.has(t.path)?"":"rotate-90")}),e.jsx("span",{className:"h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground",children:d("git-branch")}),e.jsx("span",{className:"truncate",children:t.branch}),t.dirty&&e.jsx("span",{className:"ml-auto flex-none h-2 w-2 rounded-full bg-destructive shrink-0",title:"有未提交变更"})]}),!x.has(t.path)&&e.jsx("div",{className:"ml-2",children:w.map(y=>e.jsx(v,{node:y,depth:1,filter:a,current:i===t.path?l:null,onSelectFile:J=>r.navigate({wt:t.path,file:J})},y.name))})]},t.path)}),u.length>0&&(!a||u.some(t=>h(t,a)))&&e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:W,"aria-expanded":!g,className:"w-full flex items-center gap-1 px-2 py-1.5 text-sm font-medium text-foreground hover:bg-muted rounded-md",children:[e.jsx("span",{className:`h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-transform ${g?"":"rotate-90"}`,children:d("chevron-right")}),e.jsx("span",{className:"h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground",children:d("git-branch")}),e.jsx("span",{children:"当前分支"})]}),!g&&e.jsx("div",{className:"ml-2",children:u.filter(t=>h(t,a)).map(t=>e.jsx(v,{node:t,depth:1,filter:a,current:i?null:l,onSelectFile:c=>r.navigate({wt:null,file:c})},t.name))})]})]})]})]})})}export{ne as default};