zdashboard 2.8.0 → 2.8.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.
- package/dist/cli.js +21 -11
- package/dist/cli.js.map +1 -1
- package/dist/web/assets/BatchView-BcYVTq5m.js +2 -0
- package/dist/web/assets/{CheckpointViewer-Dnakl7qw.js → CheckpointViewer-aVIaKKvz.js} +1 -1
- package/dist/web/assets/{CodeViewer-DKQhzhtt.js → CodeViewer-DFzMfmdB.js} +1 -1
- package/dist/web/assets/{DependencyGraph-M-usNrkC.js → DependencyGraph-NqqCB6Vt.js} +1 -1
- package/dist/web/assets/{FileIcon-AydLkQKG.js → FileIcon-Bk6QVgj6.js} +1 -1
- package/dist/web/assets/{FilterPills-X52teHq7.js → FilterPills-CiDfp_8h.js} +1 -1
- package/dist/web/assets/{ProgressBar-C8W_FpI2.js → ProgressBar-DIVNOeTV.js} +1 -1
- package/dist/web/assets/{Sidebar-BUEb7NX4.js → Sidebar-DbPvTOr4.js} +1 -1
- package/dist/web/assets/{Sidebar-R9gmd6Ss.js → Sidebar-prXqMrLa.js} +1 -1
- package/dist/web/assets/SingleChangeView-e7LU1eVP.js +1 -0
- package/dist/web/assets/ViewHeader-1hW25T7x.js +1 -0
- package/dist/web/assets/{Workspace-C2bvxp8p.js → Workspace-BgZLrrMa.js} +1 -1
- package/dist/web/assets/{Workspace-Do07KofT.js → Workspace-BjE2HRuu.js} +1 -1
- package/dist/web/assets/Workspace-CCD9dE4r.js +2 -0
- package/dist/web/assets/{Workspace-qzGIvIU-.js → Workspace-CthIPSy_.js} +1 -1
- package/dist/web/assets/{Workspace-CkU9yWvw.js → Workspace-DHQUpHN1.js} +2 -2
- package/dist/web/assets/{index-B1epVp2c.js → index-Cq5UOBJN.js} +2 -2
- package/dist/web/assets/index-DcspTMh9.css +1 -0
- package/dist/web/assets/{index-DOZp2EHd.js → index-PcP6ebRP.js} +1 -1
- package/dist/web/assets/{usePluginData-jGCocXxu.js → usePluginData-Cpm5C7LU.js} +1 -1
- package/dist/web/assets/{web-C-_Hr8JN.js → web-BnL7vuwB.js} +2 -2
- package/dist/web/assets/{web-He9MXVk-.js → web-CdCGfZIi.js} +2 -2
- package/dist/web/assets/{web-C4mUiGNR.js → web-Ch8IK7pu.js} +2 -2
- package/dist/web/assets/{web-BROwAvbQ.js → web-CjjS2dbX.js} +2 -2
- package/dist/web/assets/{web-VATakLhV.js → web-Jaf9aZCx.js} +2 -2
- package/dist/web/index.html +2 -2
- package/package.json +2 -1
- package/dist/web/assets/BatchView-C7Y83zJ8.js +0 -2
- package/dist/web/assets/SingleChangeView-Cfr_Wkzz.js +0 -1
- package/dist/web/assets/Workspace-CqTemGJp.js +0 -2
- package/dist/web/assets/index-BJDneNeU.css +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DependencyGraph-NqqCB6Vt.js","assets/index-Cq5UOBJN.js","assets/index-DcspTMh9.css","assets/CheckpointViewer-aVIaKKvz.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{b as k,a as E,r as l,j as e,E as V,_ as y}from"./index-Cq5UOBJN.js";import{V as C,B}from"./ViewHeader-1hW25T7x.js";import{u as x}from"./usePluginData-Cpm5C7LU.js";import{M as S,t as z}from"./index-PcP6ebRP.js";const I=l.lazy(()=>y(()=>import("./DependencyGraph-NqqCB6Vt.js"),__vite__mapDeps([0,1,2]))),R=l.lazy(()=>y(()=>import("./CheckpointViewer-aVIaKKvz.js"),__vite__mapDeps([3,1,2]))),T=["graph","checkpoint"],A={graph:"依赖图",checkpoint:"进度"},D={idle:"neutral",analyzing:"info","pending-approval":"warning",running:"info",paused:"warning",completed:"success",failed:"destructive"};function L(r){return r==="error"?"text-destructive":r==="warn"?"text-warning":"text-muted-foreground"}function P(){const r=x("apply:/__apply/batch",()=>fetch("/__apply/batch",{cache:"no-store"}).then(t=>t.json()),{subscribe:"files"}),c=x("apply:/__apply/batch/graph",()=>fetch("/__apply/batch/graph",{cache:"no-store"}).then(t=>t.json()),{subscribe:"files"}),d=x("apply:/__apply/batch/logs",()=>fetch("/__apply/batch/logs",{cache:"no-store"}).then(t=>t.json()),{subscribe:"files"}),i=x("apply:/__apply/batch/plan",()=>fetch("/__apply/batch/plan",{cache:"no-store"}).then(t=>t.ok?t.json().then(u=>u.plan):null).catch(()=>null),{subscribe:"files"});return{snapshot:r,graph:c,logs:d,plan:i}}function $({run:r,hasError:c}){return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-6 gap-2",children:[e.jsx(V,{title:"暂无批量执行数据",hint:"在 zapply batch 中启动批量执行后,状态会出现在这里"}),e.jsxs("div",{className:"text-center text-xs text-muted-foreground space-y-1",children:[e.jsxs("p",{children:["状态文件:",e.jsx("code",{className:"font-mono",children:".zdev/apply/runs/<runId>/state.json"}),"(由 zapply 写入,本页只读)"]}),e.jsx("p",{children:"旧 .zapply/batch-state.json 历史数据不迁移,仅留档"}),r!==null&&e.jsx("p",{children:"CURRENT 指向的 run 状态缺失或损坏(历史 run 只读)"}),c&&e.jsx("p",{children:"数据加载失败,请稍后重试或刷新页面"})]})]})}function W({onStatus:r}={}){var g,j;const{icon:c}=k(),d=E(),i=d.params.get("sel"),[t,u]=l.useState("graph"),[m,v]=l.useState(!0),{snapshot:o,graph:_,logs:N,plan:f}=P(),s=((g=o.data)==null?void 0:g.state)??null,p=((j=o.data)==null?void 0:j.run)??null,n={completed:(s==null?void 0:s.changes.filter(a=>a.status==="completed").length)??0,failed:(s==null?void 0:s.changes.filter(a=>a.status==="failed").length)??0,parked:(s==null?void 0:s.changes.filter(a=>a.status==="parked").length)??0,running:(s==null?void 0:s.changes.filter(a=>a.status==="running").length)??0},h=(s==null?void 0:s.changes.length)??0;if(l.useEffect(()=>{r==null||r(h?{label:`${n.completed+n.failed}/${h}`,tone:n.failed?"warning":"info"}:void 0)},[h,n.completed,n.failed,r]),!s)return e.jsx("div",{"data-testid":"batch-view",className:"h-full flex flex-col bg-background border rounded-lg shadow-sm overflow-hidden",children:o.data===null&&!o.error?e.jsx("div",{className:"flex items-center justify-center h-full",children:"加载中..."}):e.jsx($,{run:p,hasError:!!o.error})});const b=a=>d.navigate({sel:a});return e.jsxs("div",{"data-testid":"batch-view",className:"h-full flex flex-col bg-background border rounded-lg shadow-sm overflow-hidden",children:[e.jsx(C,{title:"zapply batch"}),e.jsxs("div",{"data-testid":"batch-overview",className:"flex-none px-4 py-2 border-b border-border flex items-center gap-3 text-sm text-muted-foreground flex-wrap",children:[e.jsx(B,{variant:D[s.status],children:s.status}),e.jsxs("span",{children:["第 ",s.currentBatchIndex+1,"/",s.batches.length," 批"]}),e.jsxs("span",{children:[n.completed,"/",h," 完成"]}),e.jsxs("span",{children:["并行度: ",s.parallelism]}),e.jsxs("span",{children:["🔄 ",n.running," 运行中"]}),e.jsxs("span",{children:["❌ ",n.failed," 失败"]}),e.jsxs("span",{children:["⏸️ ",n.parked," parked"]}),f.data&&e.jsx("button",{type:"button","aria-pressed":m,onClick:()=>v(a=>!a),className:`px-2 py-0.5 text-xs rounded-md border transition-colors ${m?"bg-primary text-primary-foreground border-primary":"border-border hover:bg-accent"}`,children:"执行计划"}),e.jsxs("span",{className:"ml-auto text-xs font-mono",children:["run: ",(p==null?void 0:p.id)??"-"," · 只读"]})]}),e.jsx("div",{className:"flex-none px-4 py-1.5 border-b border-border flex items-center gap-2",children:T.map(a=>e.jsx("button",{type:"button",onClick:()=>u(a),className:`px-3 py-1 text-xs rounded-md ${t===a?"bg-primary text-primary-foreground":"border border-border hover:bg-accent"}`,children:A[a]},a))}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(l.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full",children:"加载中..."}),children:e.jsxs("div",{"data-testid":`batch-subview-${t}`,className:"h-full",children:[t==="graph"&&e.jsx(I,{graph:_.data??{changes:[],batches:[],conflicts:[]},selectedChange:i,onSelectChange:b}),t==="checkpoint"&&e.jsx(R,{state:s,selectedChange:i,onSelectChange:b})]})})}),f.data&&m&&e.jsxs("div",{className:"flex-none border-t border-border px-6 py-3 max-h-48 overflow-y-auto",children:[e.jsxs("h4",{className:"text-xs font-medium text-muted-foreground mb-2 flex items-center gap-1",children:[c("file-text","h-3 w-3")," 执行计划 plan.md(只读)"]}),e.jsx("div",{className:"prose dark:prose-invert max-w-none text-xs bg-card border rounded-lg p-3",children:e.jsx(S,{remarkPlugins:[z],children:f.data})})]}),e.jsx("footer",{"data-testid":"batch-logs",className:"h-48 shrink-0 overflow-auto border-t border-border px-6 py-2",children:e.jsx("div",{className:"text-xs font-mono space-y-1",children:(N.data??[]).slice(-20).reverse().map((a,w)=>e.jsxs("div",{className:L(a.level),children:[e.jsxs("span",{className:"text-muted-foreground/60",children:["[",new Date(a.timestamp).toLocaleTimeString(),"]"]}),a.changeName&&e.jsxs("span",{className:"text-info ml-2",children:["[",a.changeName,"]"]}),e.jsx("span",{className:"ml-2",children:a.message})]},w))})})]})}export{W as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./index-
|
|
1
|
+
import{j as e}from"./index-Cq5UOBJN.js";function x({state:c,selectedChange:r,onSelectChange:a}){const t=c.changes.filter(s=>s.checkpoint&&s.status==="running");return e.jsxs("div",{className:"flex h-full",children:[e.jsxs("aside",{className:"w-80 border-r border-border overflow-y-auto p-4",children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:"执行中的变更"}),e.jsxs("div",{className:"space-y-2",children:[t.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无执行中的变更"}),t.map(s=>e.jsxs("div",{onClick:()=>a(r===s.name?null:s.name),className:`p-3 rounded-lg border cursor-pointer transition-colors ${r===s.name?"border-primary bg-primary/5":"border-border hover:border-primary/50"}`,children:[e.jsx("div",{className:"font-medium text-sm",children:s.name}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[s.checkpoint.completedTasks,"/",s.checkpoint.totalTasks," 任务"]})]},s.name))]})]}),e.jsx("main",{className:"flex-1 overflow-y-auto p-6",children:r&&t.find(s=>s.name===r)?e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:r}),e.jsx("div",{className:"space-y-3",children:Array.from({length:t.find(s=>s.name===r).checkpoint.totalTasks}).map((s,n)=>{const d=t.find(l=>l.name===r),i=n<d.checkpoint.completedTasks,o=n===d.checkpoint.currentTaskIndex;return e.jsx("div",{className:`p-4 rounded-lg border ${i?"border-success/30 bg-success/5":o?"border-info/30 bg-info/5":"border-border bg-card"}`,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-xs ${i?"bg-success text-success-foreground":o?"bg-info text-info-foreground":"bg-muted text-muted-foreground"}`,children:i?"✓":o?"↻":n+1}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:`text-sm ${i?"line-through text-muted-foreground":"font-medium"}`,children:o?d.checkpoint.currentTask:`任务 #${n+1}`}),o&&e.jsx("div",{className:"text-xs text-info mt-1",children:"执行中..."})]})]})},n)})})]}):e.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"选择一个变更查看任务进度"})})]})}export{x as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as Wl,r as At,j as Ie,f as $g}from"./index-
|
|
1
|
+
import{g as Wl,r as At,j as Ie,f as $g}from"./index-Cq5UOBJN.js";import{o as $t,l as Kg,f as dn,m as Rt,a as _n,e as Qg,b as $l,p as Gc,c as Yc,n as Hc,h as Qn,s as an,d as Xg,g as Zg,i as _r,v as Xn,j as rp,k as Sl,S as Mn,q as Jg,r as jg,M as ef,t as tf}from"./index-PcP6ebRP.js";const qc={}.hasOwnProperty;function np(t,e){const r=e||{};function n(a,...i){let s=n.invalid;const o=n.handlers;if(a&&qc.call(a,t)){const l=String(a[t]);s=qc.call(o,l)?o[l]:n.unknown}if(s)return s.call(this,a,...i)}return n.handlers=r.handlers||{},n.invalid=r.invalid,n.unknown=r.unknown,n}function rf(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:a,mathFlowFence:n,mathFlowFenceMeta:r,mathFlowValue:o,mathText:s,mathTextData:o}};function t(l){const u={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[u]}},l)}function e(){this.buffer()}function r(){const l=this.resume(),u=this.stack[this.stack.length-1];$t(u.type==="math"),u.meta=l}function n(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function a(l){const u=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),d=this.stack[this.stack.length-1];$t(d.type==="math"),this.exit(l),d.value=u;const p=d.data.hChildren[0];$t(p.type==="element"),$t(p.tagName==="code"),p.children.push({type:"text",value:u}),this.data.mathFlowInside=void 0}function i(l){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},l),this.buffer()}function s(l){const u=this.resume(),d=this.stack[this.stack.length-1];$t(d.type==="inlineMath"),this.exit(l),d.value=u,d.data.hChildren.push({type:"text",value:u})}function o(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function nf(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),n.peek=a,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
|
|
2
2
|
`,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:r,inlineMath:n}};function r(i,s,o,l){const u=i.value||"",d=o.createTracker(l),p="$".repeat(Math.max(Kg(u,"$")+1,2)),E=o.enter("mathFlow");let g=d.move(p);if(i.meta){const S=o.enter("mathFlowMeta");g+=d.move(o.safe(i.meta,{after:`
|
|
3
3
|
`,before:g,encode:["$"],...d.current()})),S()}return g+=d.move(`
|
|
4
4
|
`),u&&(g+=d.move(u+`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as u,j as e}from"./index-
|
|
1
|
+
import{r as u,j as e}from"./index-Cq5UOBJN.js";const a={pending:"bg-muted text-muted-foreground",running:"bg-info/20 text-info",completed:"bg-success/20 text-success",failed:"bg-destructive/20 text-destructive",parked:"bg-warning/20 text-warning",skipped:"bg-muted text-muted-foreground line-through"};function h({graph:t,selectedChange:d,onSelectChange:l}){const[i,o]=u.useState("all"),m=t.changes.filter(s=>i==="all"||s.status===i),c=t.batches.reduce((s,r)=>{const n=t.changes.filter(x=>x.batchIndex===r.index);return n.length&&(s[r.index]=n),s},{});return e.jsxs("div",{className:"flex h-full",children:[e.jsxs("aside",{className:"w-80 border-r border-border overflow-y-auto p-4",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"text-sm font-medium",children:"状态筛选"}),e.jsxs("select",{value:i,onChange:s=>o(s.target.value),className:"mt-1 w-full rounded-md border border-border bg-background px-3 py-1.5 text-sm",children:[e.jsx("option",{value:"all",children:"全部"}),e.jsx("option",{value:"pending",children:"待执行"}),e.jsx("option",{value:"running",children:"执行中"}),e.jsx("option",{value:"completed",children:"已完成"}),e.jsx("option",{value:"failed",children:"失败"}),e.jsx("option",{value:"parked",children:"已暂停"})]})]}),e.jsx("div",{className:"space-y-2",children:m.map(s=>e.jsxs("div",{onClick:()=>l(d===s.name?null:s.name),className:`p-3 rounded-lg border cursor-pointer transition-colors ${d===s.name?"border-primary bg-primary/5":"border-border hover:border-primary/50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-medium text-sm",children:s.name}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${a[s.status]||a.pending}`,children:s.status})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["批次 ",s.batchIndex," · 依赖 ",s.dependencies.length," 个"]})]},s.name))})]}),e.jsxs("main",{className:"flex-1 overflow-y-auto p-6",children:[t.conflicts.length>0&&e.jsxs("div",{className:"mb-6 p-4 rounded-lg border border-warning bg-warning/10",children:[e.jsx("h3",{className:"font-medium text-warning mb-2",children:"⚠️ 文件冲突检测"}),e.jsx("div",{className:"space-y-2",children:t.conflicts.map((s,r)=>e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:s.changeA}),e.jsx("span",{className:"text-muted-foreground",children:" 与 "}),e.jsx("span",{className:"font-medium",children:s.changeB}),e.jsx("span",{className:"text-muted-foreground",children:" 冲突于: "}),e.jsx("code",{className:"text-xs bg-background/50 px-1 rounded",children:s.files.join(", ")})]},r))})]}),e.jsx("div",{className:"space-y-6",children:Object.entries(c).sort(([s],[r])=>Number(s)-Number(r)).map(([s,r])=>e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:["批次 ",s,e.jsxs("span",{className:"ml-2 text-xs",children:["(",r.filter(n=>n.status==="completed").length,"/",r.length," 完成)"]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:r.map(n=>e.jsxs("div",{onClick:()=>l(d===n.name?null:n.name),className:`p-4 rounded-lg border transition-colors ${d===n.name?"border-primary bg-primary/5":"border-border hover:border-primary/50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"font-medium",children:n.name}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${a[n.status]||a.pending}`,children:n.status})]}),n.dependencies.length>0&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:["依赖: ",n.dependencies.join(", ")]})]},n.name))})]},s))})]})]})}export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,j as c}from"./index-
|
|
1
|
+
import{b as o,j as c}from"./index-Cq5UOBJN.js";const m={".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 r(s){const t=s.toLowerCase();if(t==="justfile"||t==="makefile")return t;const n=s.lastIndexOf("."),e=n>=0?s.slice(n).toLowerCase():"";return m[e]??"unknown"}function i({name:s,active:t}){const{icon:n}=o(),e=n(r(s));return e?c.jsx("span",{className:`h-3.5 w-3.5 shrink-0 inline-flex items-center justify-center ${t?"text-primary":"text-muted-foreground"}`,children:e}):null}export{i as F};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,e as n}from"./index-
|
|
1
|
+
import{j as e,e as n}from"./index-Cq5UOBJN.js";function b({items:l,value:d,onChange:c,ariaLabel:p,renderExtra:a,renderLabel:o,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):o?o(r):e.jsx("span",{children:r.label}),r.badge&&e.jsx("span",{className:"opacity-80",children:r.badge}),r.renderExtra?r.renderExtra(r):a==null?void 0:a(r)]},r.key)})})}export{b as F};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r,e as i}from"./index-
|
|
1
|
+
import{j as r,e as i}from"./index-Cq5UOBJN.js";function t({value:e,className:s}){const a=Math.max(0,Math.min(100,e));return r.jsx("div",{className:i("rounded-[var(--radius-full)] bg-muted overflow-hidden",s),role:"progressbar","aria-valuenow":a,"aria-valuemin":0,"aria-valuetext":`${a}%`,children:r.jsx("div",{className:"h-full rounded-[var(--radius-full)] bg-primary transition-all",style:{width:`${a}%`}})})}export{t as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as x,b as d,r as m,j as s}from"./index-
|
|
1
|
+
import{a as x,b as d,r as m,j as s}from"./index-Cq5UOBJN.js";import{F as f}from"./FileIcon-Bk6QVgj6.js";import{u as h}from"./usePluginData-Cpm5C7LU.js";const b={page:"monitor",component:"blocks",icon:"shapes",token:"palette",md:"book-open",video:"video",audio:"audio-lines",pdf:"file-text",font:"type"},k=[{key:"page",label:"页面"},{key:"component",label:"组件"},{key:"icon",label:"图标"},{key:"token",label:"Tokens"},{key:"md",label:"文档"},{key:"video",label:"视频"},{key:"audio",label:"音频"},{key:"pdf",label:"PDF"},{key:"font",label:"字体"}];function N(){const n=x(),o=n.params,l=o.get("asset"),c=o.get("type"),a=o.get("folder");d();const r=h("design:/__design/assets",()=>fetch("/__design/assets",{cache:"no-store"}).then(t=>t.json()),{subscribe:"files"}),i=m.useMemo(()=>{const t=r.data;return t?k.map(u=>({...u,items:(t[u.key]??[]).filter(p=>!a||p.path.startsWith(a))})).filter(u=>u.items.length>0):[]},[r.data,a]),e=t=>n.navigate({type:t.type,asset:t.path});return s.jsxs("div",{children:[s.jsx("div",{className:"p-3 text-xs text-muted-foreground truncate",children:"设计资产"}),i.map(t=>s.jsx(g,{group:t,current:l&&c===t.key?l:null,onSelect:e},t.key))]})}function g({group:n,current:o,onSelect:l}){const[c,a]=m.useState(!0),{icon:r}=d(),i=b[n.key];return s.jsxs("div",{className:"mb-1.5 px-1",children:[s.jsxs("button",{onClick:()=>a(e=>!e),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:[r("chevron-right",`h-3 w-3 shrink-0 transition-transform ${c?"rotate-90":""}`),i&&r(i,"h-3.5 w-3.5 shrink-0"),s.jsx("span",{className:"truncate",children:n.label}),s.jsx("span",{className:"ml-auto shrink-0 rounded-full bg-muted px-1.5 font-mono text-xs font-normal",children:n.items.length})]}),c&&n.items.map(e=>s.jsxs("button",{onClick:()=>l(e),className:`w-full text-left flex items-center gap-2 px-2.5 py-1.5 text-xs hover:bg-muted rounded-md ${o===e.path?"bg-primary/10 text-foreground font-medium":"text-muted-foreground"}`,children:[s.jsx(f,{name:e.name,active:o===e.path}),s.jsx("span",{className:"truncate",children:e.name}),e.ext&&s.jsx("span",{className:"ml-auto font-mono text-xs text-muted-foreground/60",children:e.ext})]},e.path))]})}export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as W,b as S,r as v,j as e}from"./index-
|
|
1
|
+
import{a as W,b as S,r as v,j as e}from"./index-Cq5UOBJN.js";import{F as D}from"./FileIcon-Bk6QVgj6.js";import{u as I}from"./usePluginData-Cpm5C7LU.js";function h(r,s){return!s||r.name.toLowerCase().includes(s)?!0:(r.children??[]).some(o=>h(o,s))}async function E(){const r=await fetch("/__worktrees",{cache:"no-store"}).then(a=>a.json()).catch(()=>[]),s={};await Promise.all(r.map(async a=>{try{const l=await fetch(`/__files?wt=${encodeURIComponent(a.path)}`,{cache:"no-store"}).then(i=>i.json());s[a.path]=l.tree??[]}catch{s[a.path]=[]}}));const o=await fetch("/__files",{cache:"no-store"}).then(a=>a.json()).then(a=>a.tree??[]).catch(()=>[]);return{worktrees:r,wtTrees:s,rootTree:o}}function y({node:r,depth:s,filter:o,current:a,onSelectFile:l}){const{icon:i}=S(),c=r.children??[],f=!!o&&r.name.toLowerCase().includes(o)?c:c.filter(n=>h(n,o)),[x,b]=v.useState(!r.defaultCollapsed),d=o?!0:x;return!f.length&&o?null:e.jsxs("div",{children:[(()=>{const n=r.name.match(/^([a-z]+)(?: \((\d+)\))?$/),p=n?i(n[1]):void 0;return e.jsxs("button",{onClick:()=>b(m=>!m),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+s*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 ${d?"rotate-90":""}`,children:i("chevron-right")}),p?e.jsx("span",{className:"h-3.5 w-3.5 shrink-0 inline-flex items-center justify-center text-muted-foreground",children:p}):e.jsx("span",{className:"h-3.5 w-3.5 shrink-0 inline-flex items-center justify-center text-muted-foreground transition-colors",children:i(d?"folder-open":"folder")}),e.jsx("span",{className:"font-medium truncate",children:n?n[1]:r.name}),(n==null?void 0:n[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:n[2]})]})})(),d&&f.map(n=>n.kind==="dir"?e.jsx(y,{node:n,depth:s+1,filter:o,current:a,onSelectFile:l},n.name+s):e.jsxs("button",{onClick:()=>n.path&&l(n.path),className:`w-full flex items-center gap-1.5 pr-2 py-1 text-sm hover:bg-muted rounded-md mx-1 ${a===n.path?"bg-primary/10 text-foreground font-medium":"text-muted-foreground"}`,style:{paddingLeft:20+s*14,width:"calc(100% - 8px)"},children:[e.jsx(D,{name:n.name,active:a===n.path}),e.jsx("span",{className:"truncate",children:n.name})]},n.path))]})}function O(){var N,k,C;const r=W(),s=r.params,o=s.get("file"),a=s.get("wt"),l=(s.get("filter")??"").toLowerCase(),i=s.get("card")==="dirty",{icon:c}=S(),[w,f]=v.useState(new Set),[x,b]=v.useState(!1),d=I("view:sidebar-trees",E,{subscribe:"files"}),n=((N=d.data)==null?void 0:N.worktrees)??[],p=((k=d.data)==null?void 0:k.wtTrees)??{},m=((C=d.data)==null?void 0:C.rootTree)??[],R=t=>{f(g=>{const u=new Set(g);return u.has(t)?u.delete(t):u.add(t),u})},_=()=>b(t=>!t),$=t=>{r.navigate({filter:t.trim()?t:null},{replace:!0})},F=n.length>0;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.jsx("input",{value:l,onChange:t=>$(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:outline-none focus:border-primary"}),e.jsxs("div",{className:"py-1 flex-1 min-h-0 overflow-auto","data-testid":"view-tree-scroller",children:[F&&n.map(t=>{const u=(p[t.path]??[]).filter(j=>h(j,l));if(!u.length&&l)return null;const T=i&&t.dirty;return e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:()=>R(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:c("chevron-right",w.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:c("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:"有未提交变更"})]}),!w.has(t.path)&&e.jsx("div",{className:"ml-2",children:u.map(j=>e.jsx(y,{node:j,depth:1,filter:l,current:a===t.path?o:null,onSelectFile:L=>r.navigate({wt:t.path,file:L})},j.name))})]},t.path)}),m.length>0&&(!l||m.some(t=>h(t,l)))&&e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:_,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 ${x?"":"rotate-90"}`,children:c("chevron-right")}),e.jsx("span",{className:"h-3 w-3 shrink-0 inline-flex items-center justify-center text-muted-foreground",children:c("git-branch")}),e.jsx("span",{children:"当前分支"})]}),!x&&e.jsx("div",{className:"ml-2",children:m.filter(t=>h(t,l)).map(t=>e.jsx(y,{node:t,depth:1,filter:l,current:a?null:o,onSelectFile:g=>r.navigate({wt:null,file:g})},t.name))})]})]})]})})}export{O as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as m,a as _,r as $,j as e,S as g,E as h}from"./index-Cq5UOBJN.js";import{V as C,B as c}from"./ViewHeader-1hW25T7x.js";import{P as E}from"./ProgressBar-DIVNOeTV.js";import{u}from"./usePluginData-Cpm5C7LU.js";import{M as P,t as B}from"./index-PcP6ebRP.js";const p=/^\s*-\s*\[([ xX])\]\s*(.*)$/,I="🔧[人工]";function b(s){return s.split(/\r?\n/).filter(r=>p.test(r)).map(r=>{const t=r.match(p),n=((t==null?void 0:t[2])??r).trim();return{text:n,checked:(t==null?void 0:t[1])!==" ",manual:n.startsWith(I)}})}function T(s){const r=b(s),t=r.filter(n=>!n.manual);return{total:t.length,done:t.filter(n=>n.checked).length,manual:r.length-t.length}}function w(s,r){return r===0?0:Math.round(s/r*100)}function k({done:s,total:r}){const t=w(s,r),n=t===100?"success":t>0?"warning":"neutral";return e.jsxs(c,{variant:n,children:[s,"/",r," · ",t,"%"]})}function v(){return e.jsx(c,{variant:"info",children:"worktree 执行中"})}function W(){return e.jsx(c,{variant:"info",children:"含测试策略"})}function M({count:s}){return e.jsxs(c,{variant:"warning",children:["🔧[人工] ",s]})}function R({name:s,pending:r}){const t=r?"neutral":"success";return e.jsx(c,{variant:t,children:r?`${s} · 等待前置`:s})}function j({label:s,content:r}){const{icon:t}=m();return e.jsxs("details",{className:"border rounded-lg bg-card",children:[e.jsxs("summary",{className:"px-3 py-2 text-xs font-medium text-muted-foreground cursor-pointer select-none flex items-center gap-1",children:[t("file-text","h-3 w-3")," ",s]}),e.jsx("div",{className:"prose dark:prose-invert max-w-none text-xs px-3 pb-3",children:e.jsx(P,{remarkPlugins:[B],children:r})})]})}function D({tasks:s}){const r=b(s);if(!r.length)return e.jsx("p",{className:"text-xs text-muted-foreground",children:"无 tasks.md"});const t=r.findIndex(n=>!n.checked&&!n.manual);return e.jsx("ul",{className:"space-y-1 text-xs",children:r.map((n,d)=>{const l=d===t,i=n.manual?"text-muted-foreground":n.checked?"text-foreground":"text-muted-foreground";return e.jsxs("li",{className:`flex items-start gap-2 rounded px-1.5 -mx-1.5 py-0.5 ${l?"bg-warning/10 border-l-2 border-warning":""} ${i}`,children:[n.checked?e.jsx("span",{className:"mt-0.5 h-3.5 w-3.5 shrink-0 rounded-full bg-success text-white flex items-center justify-center text-xs",children:"✓"}):e.jsx("span",{className:`mt-0.5 h-3.5 w-3.5 shrink-0 rounded-full border ${l?"border-warning":"border-muted-foreground/50"}`}),e.jsx("span",{children:n.text}),l&&e.jsx("span",{className:"ml-auto flex-none text-xs font-medium text-warning",children:"← 下一步"})]},d)})})}function S({item:s,selected:r,manualCount:t,onSelect:n}){const{icon:d}=m();return e.jsxs("button",{type:"button",onClick:n,"aria-current":r||void 0,className:`w-full text-left rounded-lg border p-3 transition-colors ${r?"border-primary bg-muted/50":"border-border bg-card hover:bg-muted/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[d("folder-open","h-3.5 w-3.5 text-muted-foreground shrink-0"),e.jsx("span",{className:"text-sm font-medium font-mono truncate min-w-0",title:s.name,children:s.name}),e.jsx("span",{className:"ml-auto flex-none",children:e.jsx(k,{done:s.done,total:s.total})})]}),e.jsx(E,{value:w(s.done,s.total),className:"h-1 mb-1.5"}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.hasProposal&&e.jsx(c,{variant:"outline",children:"proposal"}),s.hasDesign&&e.jsx(c,{variant:"info",children:"design"}),s.inWorktree&&e.jsx(v,{}),t!=null&&t>0&&e.jsx(M,{count:t})]})]})}function A(){const{icon:s}=m(),t=u("apply:/__worktrees",()=>fetch("/__worktrees",{cache:"no-store"}).then(n=>n.json()),{subscribe:"files"}).data??[];return t.length?e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s("git-branch","h-3.5 w-3.5 text-muted-foreground"),e.jsx("span",{className:"text-sm text-muted-foreground mr-1",children:"Worktree:"}),t.map(n=>e.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded border text-xs font-mono bg-info/10 text-info border-info/30",title:n.head,children:[n.name,"@",n.branch||"detached"]},n.name))]}):null}function X({onStatus:s}){const{icon:r}=m(),t=_(),n=t.params.get("change"),d=u("apply:/__apply",()=>fetch("/__apply",{cache:"no-store"}).then(a=>a.json()),{subscribe:"files"}),l=u(`apply:change:${n??""}`,()=>n?fetch(`/__apply/change?name=${encodeURIComponent(n)}`,{cache:"no-store"}).then(a=>a.json()).then(a=>{if(a&&a.error)throw new Error(a.error);return a}):Promise.resolve(null),{subscribe:"files"}),i=d.data??[],o=l.data&&l.data.name===n?l.data:null,{total:f,manual:x}=T((o==null?void 0:o.tasks)??"");$.useEffect(()=>{s==null||s(i.length?{label:`${i.length} 个进行中`,tone:"info"}:void 0)},[i.length,s]);const N=a=>t.navigate({change:a});return e.jsxs("div",{className:"mx-auto h-full max-w-6xl flex flex-col bg-background border rounded-lg shadow-sm overflow-hidden",children:[e.jsx(C,{title:"进行中的 change",actions:e.jsx(A,{})}),d.loading&&!i.length?e.jsx("div",{className:"p-4",children:e.jsx(g,{rows:4})}):i.length?e.jsxs("div",{"data-testid":"single-split",className:"flex-1 min-h-0 flex flex-col lg:flex-row overflow-y-auto lg:overflow-hidden",children:[e.jsx("aside",{"data-testid":"change-list-pane",className:"flex-none lg:w-72 shrink-0 border-b lg:border-b-0 lg:border-r border-border p-3 space-y-2 lg:overflow-y-auto",children:i.map(a=>e.jsx(S,{item:a,selected:a.name===n,manualCount:a.name===n&&x>0?x:null,onSelect:()=>N(a.name)},a.name))}),e.jsx("section",{"data-testid":"change-detail-pane",className:"flex-1 min-w-0 min-h-0 lg:overflow-y-auto p-4 space-y-4",children:n&&o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"text-sm font-medium",children:o.name}),e.jsx(k,{done:o.done,total:o.total}),x>0&&e.jsxs(c,{variant:"warning",children:["待人工 ",x," 项"]}),o.inWorktree&&e.jsx(v,{}),o.hasTestStrategy&&e.jsx(W,{})]}),o.dependsOn.length>0&&e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"依赖:"}),o.dependsOn.map(a=>e.jsx(R,{name:a,pending:i.some(y=>y.name===a)},a))]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-xs font-medium text-muted-foreground mb-2 flex items-center gap-1",children:[r("file-text","h-3 w-3")," tasks.md",f>0&&e.jsxs("span",{className:"font-mono",children:["(",f," 项)"]})]}),e.jsx("div",{className:"border rounded-lg p-3 bg-card",children:e.jsx(D,{tasks:o.tasks})})]}),o.proposal&&e.jsx(j,{label:"proposal.md",content:o.proposal}),o.design&&e.jsx(j,{label:"design.md",content:o.design})]}):n&&l.error?e.jsx(h,{title:`未找到 change「${n}」`,hint:l.error}):n?e.jsx("div",{"data-testid":"detail-loading",className:"p-4",children:e.jsx(g,{rows:4})}):e.jsx(h,{title:"未选择 change",hint:"从左侧列表选择 change 查看详情"})})]}):e.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center p-4",children:e.jsx(h,{icon:r("folder-git-2","h-6 w-6"),title:"没有进行中的 change",hint:"在 openspec/changes/ 下创建 change 后会显示在这里"})})]})}export{X as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as n,j as e,e as d,h as o}from"./index-Cq5UOBJN.js";const i=o("inline-flex items-center rounded-[var(--radius-sm)] border px-1.5 py-0.5 text-xs font-mono font-medium transition-colors",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",success:"border-success/30 bg-success/15 text-success",warning:"border-warning/30 bg-warning/15 text-warning",info:"border-info/30 bg-info/15 text-info",outline:"border-border bg-background text-foreground",neutral:"border-border bg-muted text-muted-foreground",destructive:"border-destructive/30 bg-destructive/15 text-destructive"}},defaultVariants:{variant:"default"}}),c=n.forwardRef(({className:r,variant:t,...a},s)=>e.jsx("div",{ref:s,className:d(i({variant:t}),r),...a}));c.displayName="Badge";function x({title:r,actions:t}){return e.jsxs("div",{"data-testid":"view-header",className:"flex-none flex items-center gap-2 px-4 py-2 border-b border-border",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground truncate min-w-0",children:r}),e.jsx("div",{"data-testid":"view-header-actions",className:"ml-auto flex items-center gap-1.5 flex-none min-w-0",children:t??null})]})}export{c as B,x as V};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,r as u,b as j,u as _,a as I,P as R,E as F}from"./index-
|
|
1
|
+
import{j as e,r as u,b as j,u as _,a as I,P as R,E as F}from"./index-Cq5UOBJN.js";import{F as S}from"./FilterPills-CiDfp_8h.js";import{C as U,M as L,I as E}from"./CodeViewer-DFzMfmdB.js";import{m as v}from"./web-CjjS2dbX.js";import"./index-PcP6ebRP.js";import"./client-Cw4K1Nx3.js";function $({path:t}){return e.jsx("iframe",{src:"/__design/asset?path="+encodeURIComponent(t),title:"预览",className:"w-full h-full border-0 bg-white"})}const k=/^(#|rgb|rgba|hsl|hsla|oklch|oklab|color\()/i,y=/font|family|type/i;function A({path:t}){const[m,d]=u.useState([]),[i,a]=u.useState(!0);return u.useEffect(()=>{let s=!1;return a(!0),d([]),fetch("/__design/asset?path="+encodeURIComponent(t),{cache:"no-store"}).then(o=>o.text()).then(o=>{if(s)return;const c=o.match(/--[A-Za-z0-9_-]+\s*:\s*[^;}\n]+/g)??[];if(!c.length){d([]),a(!1);return}const r=l=>{const N=l.indexOf(":"),V=l.slice(0,N).trim(),C=l.slice(N+1).trim();return{name:V,value:C}},n=l=>/^(#([0-9a-fA-F]{3,8})\b|rgb|rgba|hsl|hsla|oklch|oklab|color\()/i.test(l),p=l=>y.test(l),x=c.map(r),f=x.filter(l=>n(l.value)),g=x.filter(l=>!n(l.value)&&p(l.name)),b=x.filter(l=>!n(l.value)&&!p(l.name)),h=[];f.length&&h.push({label:`配色 · ${f.length}`,items:f}),g.length&&h.push({label:`字体 · ${g.length}`,items:g}),b.length&&h.push({label:`其他 · ${b.length}`,items:b}),d(h),a(!1)}).catch(()=>{s||(d([]),a(!1))}),()=>{s=!0}},[t]),i?e.jsx("p",{className:"p-3 text-xs text-muted-foreground",children:"解析中…"}):m.length?e.jsx("div",{className:"p-8 flex flex-col gap-7",children:m.map(s=>{const o=s.items.some(r=>k.test(r.value)),c=s.items.some(r=>y.test(r.name));return e.jsxs("section",{children:[e.jsx("div",{className:"mb-3 text-sm font-semibold uppercase text-muted-foreground",children:s.label}),o?e.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(var(--token-card-min-w), 1fr))"},children:s.items.filter(r=>k.test(r.value)).map(({name:r,value:n})=>e.jsxs("div",{className:"overflow-hidden rounded-lg border bg-background",children:[e.jsx("div",{className:"h-[var(--design-preview-h)] border-b",style:{background:n}}),e.jsx("div",{className:"px-2.5 pt-2 font-mono text-sm break-all",children:r}),e.jsx("div",{className:"px-2.5 pb-2 text-xs text-muted-foreground",children:n})]},r))}):c?e.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(var(--token-card-min-w), 1fr))"},children:s.items.map(({name:r,value:n})=>e.jsxs("div",{className:"overflow-hidden rounded-lg border bg-background",children:[e.jsx("div",{className:"grid h-[var(--design-preview-h)] place-items-center text-2xl",style:{fontFamily:n},children:"Aa"}),e.jsx("div",{className:"px-2.5 font-mono text-sm",children:r})]},r))}):e.jsx("div",{className:"flex flex-col gap-1",children:s.items.map(({name:r,value:n})=>e.jsxs("div",{className:"flex justify-between gap-3 px-2.5 py-1.5 rounded border bg-background text-xs",children:[e.jsx("span",{className:"font-mono",children:r}),e.jsx("span",{className:"text-muted-foreground",children:n})]},r))})]},s.label)})}):e.jsx("p",{className:"p-3 text-xs",children:"未发现 CSS 变量"})}const w=t=>"/__design/asset?path="+encodeURIComponent(t);function O({path:t}){return e.jsx(L,{path:t,resolve:w})}function M({path:t}){return e.jsx(E,{path:t,resolve:w})}function P({path:t}){return e.jsx(U,{path:t,resolve:w})}function W({path:t}){return e.jsx("div",{className:"grid place-items-center p-8",children:e.jsx("video",{src:"/__design/asset?path="+encodeURIComponent(t),controls:!0,className:"max-w-full max-h-[80vh] rounded border"})})}function z({path:t}){return e.jsx("div",{className:"grid place-items-center p-8",children:e.jsx("audio",{src:"/__design/asset?path="+encodeURIComponent(t),controls:!0,className:"w-full max-w-2xl"})})}function T({path:t}){return e.jsx("div",{className:"grid place-items-center p-8 h-full",children:e.jsx("iframe",{src:"/__design/asset?path="+encodeURIComponent(t),title:"PDF",className:"w-full h-full max-h-[80vh] rounded border bg-white"})})}function D({path:t}){const[m,d]=u.useState("");return u.useEffect(()=>{let i=!1,a="",s=null;return fetch("/__design/asset?path="+encodeURIComponent(t)).then(o=>o.blob()).then(async o=>{var c;if(!i){if(a=URL.createObjectURL(o),s=new FontFace("zd-font-preview",`url(${a})`),await s.load(),i){(c=s.dispose)==null||c.call(s);return}document.fonts.add(s),d(t.split("/").pop()??t)}}).catch(()=>{i||d(t.split("/").pop()??t)}),()=>{var o;if(i=!0,s)try{document.fonts.delete(s),(o=s.dispose)==null||o.call(s)}catch{}a&&URL.revokeObjectURL(a)}},[t]),e.jsxs("div",{className:"h-full overflow-auto p-8 grid gap-6 place-content-center text-center",children:[e.jsx("div",{className:"text-xs text-muted-foreground font-mono break-all",children:t}),e.jsx("div",{className:"text-5xl",style:{fontFamily:m?"'zd-font-preview', serif":"serif"},children:"Aa 字体预览 0123"})]})}function H({path:t}){const{icon:m}=j();return e.jsx("div",{className:"grid place-items-center h-full text-center text-muted-foreground",children:e.jsxs("div",{children:[m("image-off","h-10 w-10 mx-auto mb-3 opacity-50"),e.jsx("p",{children:"该格式无法预览"}),e.jsx("p",{className:"mt-1 font-mono text-xs break-all",children:t})]})})}const K={page:$,icon:M,token:A,md:O,video:W,audio:z,pdf:T,component:P,font:D};function Z(t){return K[t]??H}function q({mode:t,onMode:m,w:d,h:i,onW:a,onH:s}){const{icon:o}=j(),c=[{v:0,icon:o("monitor","h-3.5 w-3.5"),label:"桌面"},{v:768,icon:o("tablet","h-3.5 w-3.5"),label:"768"},{v:375,icon:o("smartphone","h-3.5 w-3.5"),label:"375"},{v:"custom",icon:o("sliders-horizontal","h-3.5 w-3.5"),label:"自定义"}],r="w-[var(--design-input-w)] h-7 px-1 text-center text-xs rounded border border-border bg-background text-foreground [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none focus:outline-none focus:border-primary";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center gap-1 rounded-md border border-border p-0.5 bg-muted",children:e.jsx(S,{items:c.map(n=>({key:String(n.v),label:n.label,renderLabel:()=>e.jsxs(e.Fragment,{children:[n.icon,e.jsx("span",{className:"hidden sm:inline",children:n.label})]})})),value:String(t),onChange:n=>m(n==="0"?0:n==="custom"?"custom":Number(n)),ariaLabel:"视口模式"})}),e.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx("input",{type:"number",value:d,min:280,max:3e3,step:8,onChange:n=>a(Number(n.target.value)),"aria-label":"自定义宽度",className:r}),e.jsx("span",{className:"text-muted-foreground/70",children:"×"}),e.jsx("input",{type:"number",value:i,min:400,max:3e3,step:8,onChange:n=>s(Number(n.target.value)),"aria-label":"自定义高度",className:r}),e.jsx("span",{className:"text-sm text-muted-foreground/70",children:"px"})]})]})}function ee({params:t}){const{icon:m}=j(),d=_(v.mode,"h-5 w-5");I();const i=t.get("type")??"",a=t.get("asset"),[s,o]=u.useState(0),[c,r]=u.useState(1024),[n,p]=u.useState(768),x=a?Z(i):null,f=s===0?"桌面":s==="custom"?`${c} × ${n}`:`${s}px`;return e.jsx(R,{manifest:v,icon:d,breadcrumb:["插件",v.mode,...i?[i]:[],...a?[a]:[]],children:e.jsx("div",{className:"mx-auto h-full flex flex-col bg-background border rounded-lg shadow-sm overflow-hidden",children:a&&x?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"h-[var(--design-toolbar-h)] flex-none flex items-center justify-between px-3.5 border-b bg-background text-xs",children:[e.jsx("span",{className:"font-mono truncate",children:a}),e.jsx("span",{className:"text-muted-foreground ml-3 flex-none",children:f}),e.jsx(q,{mode:s,onMode:o,w:c,h:n,onW:r,onH:p})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:i==="page"?e.jsx("div",{className:"mx-auto bg-background overflow-hidden",style:{maxWidth:s===0?void 0:s==="custom"?c:s,height:s==="custom"?n:"100%"},children:e.jsx(x,{path:a})}):e.jsx("div",{className:"mx-auto max-w-5xl h-full overflow-auto",children:e.jsx(x,{path:a})})})]}):e.jsx(F,{icon:m("palette","h-6 w-6"),title:"从左侧选择一个资产预览",hint:"点左侧折叠钮展开资产树 · 改文件即时刷新"})})})}export{ee as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as p,j as e,r as f,u as w,P as j,E as y}from"./index-
|
|
1
|
+
import{b as p,j as e,r as f,u as w,P as j,E as y}from"./index-Cq5UOBJN.js";import{C as b,M as I,I as k}from"./CodeViewer-DFzMfmdB.js";import{m as v}from"./web-CdCGfZIi.js";import"./index-PcP6ebRP.js";import"./client-Cw4K1Nx3.js";function N({path:s}){const{icon:i}=p();return e.jsx("div",{className:"grid place-items-center h-full text-center text-muted-foreground",children:e.jsxs("div",{children:[i("file-question","h-10 w-10 mx-auto mb-3 opacity-50"),e.jsx("p",{children:"该格式无法预览"}),e.jsx("p",{className:"mt-1 font-mono text-xs break-all",children:s})]})})}function C({containerRef:s}){const{icon:i}=p(),[r,l]=f.useState([]),[h,m]=f.useState(null);f.useEffect(()=>{const t=s.current;if(!t)return;let n=!1;const o=()=>{if(n)return;const d=t.querySelectorAll("h1[id], h2[id], h3[id]"),u=[];d.forEach(a=>{var g;u.push({id:a.id,text:((g=a.textContent)==null?void 0:g.trim())??"",level:parseInt(a.tagName[1],10)})}),l(u)};o();const c=new MutationObserver(o);return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{n=!0,c.disconnect()}},[s]),f.useEffect(()=>{const t=s.current;if(!t||!r.length)return;const n=new IntersectionObserver(o=>{const c=o.filter(d=>d.isIntersecting);if(c.length){const d=c.reduce((u,a)=>u.boundingClientRect.top<a.boundingClientRect.top?u:a);m(d.target.id)}},{root:t,rootMargin:"-60px 0px -70% 0px",threshold:0});return r.forEach(({id:o})=>{const c=t.querySelector(`#${CSS.escape(o)}`);c&&n.observe(c)}),()=>n.disconnect()},[r,s]);const x=t=>{var o;const n=(o=s.current)==null?void 0:o.querySelector(`#${CSS.escape(t)}`);n==null||n.scrollIntoView({behavior:"smooth",block:"start"})};return r.length?e.jsxs("nav",{className:"hidden md:flex w-44 shrink-0 flex-col border-l pl-3 py-2 overflow-y-auto","aria-label":"文档大纲",children:[e.jsxs("div",{className:"flex items-center gap-1 mb-2 text-sm font-medium text-muted-foreground uppercase tracking-wider",children:[i("file-text","h-3 w-3"),e.jsx("span",{children:"大纲"})]}),e.jsx("ul",{className:"space-y-0.5",children:r.map(t=>e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>x(t.id),className:`w-full text-left text-sm leading-snug py-0.5 px-1.5 rounded truncate transition-colors ${h===t.id?"bg-primary/10 text-foreground font-medium":"text-muted-foreground hover:bg-muted/70"}`,style:{paddingLeft:6+(t.level-1)*10},children:t.text||t.id})},t.id))})]}):null}function S(s){const i=s.slice(s.lastIndexOf("/")+1).toLowerCase();if(i==="justfile"||i==="makefile")return b;const r=s.slice(s.lastIndexOf(".")).toLowerCase();return r===".md"||r===".markdown"?I:[".svg",".png",".jpg",".jpeg",".gif",".webp",".ico"].includes(r)?k:[".sql",".txt",".csv",".tsv",".json",".yaml",".yml",".xml",".py",".js",".ts",".java",".go",".rs",".rb",".php",".c",".cpp",".h",".cs",".swift",".kt",".scala",".sh",".bash",".zsh",".fish",".env",".gitignore",".dockerfile"].includes(r)?b:N}function L({params:s}){const{icon:i}=p(),r=w(v.mode,"h-5 w-5"),l=s.get("file"),h=s.get("wt"),m=f.useRef(null),x=l?S(l):null;return e.jsx(j,{manifest:v,icon:r,breadcrumb:["插件",h??"当前分支",...l?[l]:[]],children:e.jsx("div",{className:"mx-auto h-full max-w-5xl bg-background border rounded-lg shadow-sm overflow-hidden flex flex-col",children:l&&x?e.jsxs("div",{className:"flex-1 min-h-0 flex overflow-hidden",children:[e.jsx("div",{ref:m,className:"flex-1 min-h-0 overflow-auto",children:e.jsx(x,{path:l})}),e.jsx(C,{containerRef:m})]}):e.jsx(y,{icon:i("eye","h-6 w-6"),title:"从左侧选择文件预览",hint:"支持 Markdown、图片、代码等格式"})})})}export{L as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SingleChangeView-e7LU1eVP.js","assets/index-Cq5UOBJN.js","assets/index-DcspTMh9.css","assets/ViewHeader-1hW25T7x.js","assets/ProgressBar-DIVNOeTV.js","assets/usePluginData-Cpm5C7LU.js","assets/index-PcP6ebRP.js","assets/BatchView-BcYVTq5m.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as g,a as h,r as t,j as e,P as _,S as f,_ as l}from"./index-Cq5UOBJN.js";import{m as r}from"./web-Ch8IK7pu.js";import"./client-Cw4K1Nx3.js";const b=t.lazy(()=>l(()=>import("./SingleChangeView-e7LU1eVP.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),j=t.lazy(()=>l(()=>import("./BatchView-BcYVTq5m.js"),__vite__mapDeps([7,1,2,3,5,6]))),m=["single","batch"],S={single:"单 change",batch:"批量驾驶舱"};function w(n){return m.includes(n??"")?n:"single"}function y(n){const u=g(r.mode,"h-5 w-5"),o=h(),a=w(o.params.get("view")),i=o.params.get("change"),d=["插件",r.mode,...a==="single"&&i?[i]:[]],[x,p]=t.useState(void 0),c=t.useCallback(s=>p(s),[]);return e.jsx(_,{manifest:r,icon:u,breadcrumb:d,status:x,children:e.jsxs("div",{className:"h-full flex flex-col gap-3",children:[e.jsx("div",{className:"flex-none flex items-center gap-2",children:m.map(s=>e.jsx("button",{type:"button","aria-pressed":a===s,onClick:()=>o.navigate({view:s}),className:`px-3 py-1.5 text-sm rounded-md transition-colors ${a===s?"bg-primary text-primary-foreground":"border border-border hover:bg-accent"}`,children:S[s]},s))}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(t.Suspense,{fallback:e.jsx(f,{rows:6,className:"mx-auto max-w-6xl"}),children:a==="single"?e.jsx(b,{onStatus:c}):e.jsx(j,{onStatus:c})})})]})})}export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as g,u as b,a as h,j as t,f as p,P as j}from"./index-
|
|
1
|
+
import{b as g,u as b,a as h,j as t,f as p,P as j}from"./index-Cq5UOBJN.js";import{P as N}from"./ProgressBar-DIVNOeTV.js";import{u as i}from"./usePluginData-Cpm5C7LU.js";import{m as l}from"./web-Jaf9aZCx.js";import"./client-Cw4K1Nx3.js";function S(v){var o,n;const{icon:d}=g(),c=b(l.mode,"h-5 w-5"),u=h(),r=i("stats:/__stats/data",()=>fetch("/__stats/data",{cache:"no-store"}).then(e=>e.json()),{subscribe:"files"}),a=i("stats:/__detect",()=>fetch("/__detect",{cache:"no-store"}).then(e=>e.json()));if(r.error)return t.jsx("div",{className:"flex h-full items-center justify-center text-destructive",children:t.jsxs("p",{children:["加载失败: ",r.error]})});if(!r.data)return t.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:t.jsx("p",{children:"加载中…"})});const s=r.data,m=Math.max(...s.byExt.map(e=>e.count),1),x=[{label:"文件",value:String(s.files),iconName:"file-text",drill:null},{label:"目录",value:String(s.dirs),iconName:"folder-tree",drill:null},{label:"总大小",value:p(s.totalSize),iconName:null,drill:null},{label:"Worktree",value:String(s.worktrees),iconName:"git-branch",drill:"worktree"},{label:"未提交",value:String(s.dirty??0),iconName:null,drill:"dirty"}],f=e=>u.navigate({p:"view",card:e});return t.jsx(j,{manifest:l,icon:c,breadcrumb:["插件",l.mode],children:t.jsxs("div",{className:"mx-auto h-full max-w-6xl overflow-auto rounded-lg border bg-background p-6 shadow-sm",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-5",children:"后端 fs 扫描 + 前端渲染 · 改文件即时刷新 · 点击卡片跳转"}),t.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3 mb-6",children:x.map(e=>t.jsxs("button",{type:"button",onClick:()=>e.drill&&f(e.drill),disabled:!e.drill,title:e.drill?`点击跳转至 ${e.label}`:void 0,className:`rounded-lg border bg-background p-4 text-left transition-colors ${e.drill?"hover:bg-muted/70 cursor-pointer":"cursor-default opacity-80"}`,children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"text-xl font-bold",children:e.value}),e.iconName&&d(e.iconName,"h-4 w-4 text-muted-foreground/50")]}),t.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:e.label})]},e.label))}),t.jsx("h2",{className:"text-xs font-medium text-muted-foreground mb-3",children:"文件类型 Top 10"}),t.jsx("div",{className:"space-y-2",children:s.byExt.map(e=>t.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[t.jsx("span",{className:"w-16 font-mono text-foreground truncate",children:e.ext}),t.jsx(N,{value:parseFloat((e.count/m*100).toFixed(1)),className:"flex-1 h-2"}),t.jsx("span",{className:"w-8 text-right font-mono text-muted-foreground",children:e.count})]},e.ext))}),t.jsxs("div",{className:"mt-5 flex items-center gap-2 text-xs",children:[t.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded border ${(o=a.data)!=null&&o.hasJust?"text-success border-success/30 bg-success/10":"text-muted-foreground border-border"}`,children:["justfile ",(n=a.data)!=null&&n.hasJust?"✓":"✗"]}),typeof s.dirty=="number"&&t.jsx("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded border ${s.dirty?"text-warning border-warning/30 bg-warning/10":"text-success border-success/30 bg-success/10"}`,children:s.dirty?`${s.dirty} 未提交`:"clean"}),t.jsxs("span",{className:"text-muted-foreground",children:["root: ",s.root]})]})]})})}export{S as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{r as
|
|
1
|
+
import{r as z,c as R,b as Fe,j as _,B as S,d as be,u as ve,a as ye,P as Ce}from"./index-Cq5UOBJN.js";import{F as Ee}from"./FilterPills-CiDfp_8h.js";import{u as Ae}from"./usePluginData-Cpm5C7LU.js";import{m as Y}from"./web-BnL7vuwB.js";import"./client-Cw4K1Nx3.js";function d(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function L(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function je(t,e){const s=d(t);return isNaN(e)?L(t,NaN):(e&&s.setDate(s.getDate()+e),s)}function ze(t,e){const s=d(t);if(isNaN(e))return L(t,NaN);if(!e)return s;const n=s.getDate(),r=L(t,s.getTime());r.setMonth(s.getMonth()+e+1,0);const u=r.getDate();return n>=u?r:(s.setFullYear(r.getFullYear(),r.getMonth(),n),s)}function I(t,e){const{years:s=0,months:n=0,weeks:r=0,days:u=0,hours:o=0,minutes:c=0,seconds:l=0}=e,i=d(t),g=n||s?ze(i,n+s*12):i,a=u||r?je(g,u+r*7):g,D=c+o*60,x=(l+D*60)*1e3;return L(t,a.getTime()+x)}const we=864e5,ke=6e4,Ne=36e5;function se(t){const e=d(t);return e.setHours(0,0,0,0),e}function ne(t){const e=d(t),s=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return s.setUTCFullYear(e.getFullYear()),+t-+s}function Re(t,e){const s=se(t),n=se(e),r=+s-ne(s),u=+n-ne(n);return Math.round((r-u)/we)}function $(t,e){const s=d(t),n=d(e),r=s.getTime()-n.getTime();return r<0?-1:r>0?1:r}function Oe(t,e){const s=d(t),n=d(e),r=s.getFullYear()-n.getFullYear(),u=s.getMonth()-n.getMonth();return r*12+u}function Me(t,e){const s=d(t),n=d(e);return s.getFullYear()-n.getFullYear()}function Se(t,e){const s=d(t),n=d(e),r=re(s,n),u=Math.abs(Re(s,n));s.setDate(s.getDate()-r*u);const o=+(re(s,n)===-r),c=r*(u-o);return c===0?0:c}function re(t,e){const s=t.getFullYear()-e.getFullYear()||t.getMonth()-e.getMonth()||t.getDate()-e.getDate()||t.getHours()-e.getHours()||t.getMinutes()-e.getMinutes()||t.getSeconds()-e.getSeconds()||t.getMilliseconds()-e.getMilliseconds();return s<0?-1:s>0?1:s}function K(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function Q(t,e){return+d(t)-+d(e)}function Ie(t,e,s){const n=Q(t,e)/Ne;return K(s==null?void 0:s.roundingMethod)(n)}function $e(t,e,s){const n=Q(t,e)/ke;return K(s==null?void 0:s.roundingMethod)(n)}function Le(t){const e=d(t);return e.setHours(23,59,59,999),e}function Te(t){const e=d(t),s=e.getMonth();return e.setFullYear(e.getFullYear(),s+1,0),e.setHours(23,59,59,999),e}function Be(t){const e=d(t);return+Le(e)==+Te(e)}function Pe(t,e){const s=d(t),n=d(e),r=$(s,n),u=Math.abs(Oe(s,n));let o;if(u<1)o=0;else{s.getMonth()===1&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-r*u);let c=$(s,n)===-r;Be(d(t))&&u===1&&$(t,n)===1&&(c=!1),o=r*(u-Number(c))}return o===0?0:o}function Ze(t,e,s){const n=Q(t,e)/1e3;return K(s==null?void 0:s.roundingMethod)(n)}function qe(t,e){const s=d(t),n=d(e),r=$(s,n),u=Math.abs(Me(s,n));s.setFullYear(1584),n.setFullYear(1584);const o=$(s,n)===-r,c=r*(u-+o);return c===0?0:c}function Ye(t){const e=d(t.start),s=d(t.end),n={},r=qe(s,e);r&&(n.years=r);const u=I(e,{years:n.years}),o=Pe(s,u);o&&(n.months=o);const c=I(u,{months:n.months}),l=Se(s,c);l&&(n.days=l);const i=I(c,{days:n.days}),g=Ie(s,i);g&&(n.hours=g);const a=I(i,{hours:n.hours}),D=$e(s,a);D&&(n.minutes=D);const F=I(a,{minutes:n.minutes}),x=Ze(s,F);return x&&(n.seconds=x),n}var ge={};const k=[[{color:"0, 0, 0",class:"ansi-black"},{color:"187, 0, 0",class:"ansi-red"},{color:"0, 187, 0",class:"ansi-green"},{color:"187, 187, 0",class:"ansi-yellow"},{color:"0, 0, 187",class:"ansi-blue"},{color:"187, 0, 187",class:"ansi-magenta"},{color:"0, 187, 187",class:"ansi-cyan"},{color:"255,255,255",class:"ansi-white"}],[{color:"85, 85, 85",class:"ansi-bright-black"},{color:"255, 85, 85",class:"ansi-bright-red"},{color:"0, 255, 0",class:"ansi-bright-green"},{color:"255, 255, 85",class:"ansi-bright-yellow"},{color:"85, 85, 255",class:"ansi-bright-blue"},{color:"255, 85, 255",class:"ansi-bright-magenta"},{color:"85, 255, 255",class:"ansi-bright-cyan"},{color:"255, 255, 255",class:"ansi-bright-white"}]],He=/(https?:\/\/(?:[A-Za-z0-9#;/?:@=+$',_.!~*()[\]-]|&|%[A-Fa-f0-9]{2})+)/gm;class O{static escapeForHtml(e){return new O().escapeForHtml(e)}static linkify(e){return new O().linkify(e)}static ansiToHtml(e,s){return new O().ansiToHtml(e,s)}static ansiToJson(e,s){return new O().ansiToJson(e,s)}static ansiToText(e){return new O().ansiToText(e)}constructor(){this.fg=this.bg=this.fg_truecolor=this.bg_truecolor=null,this.bright=0,this.decorations=[]}setupPalette(){this.PALETTE_COLORS=[];for(let r=0;r<2;++r)for(let u=0;u<8;++u)this.PALETTE_COLORS.push(k[r][u].color);let e=[0,95,135,175,215,255],s=(r,u,o)=>e[r]+", "+e[u]+", "+e[o];for(let r=0;r<6;++r)for(let u=0;u<6;++u)for(let o=0;o<6;++o)this.PALETTE_COLORS.push(s(r,u,o));let n=8;for(let r=0;r<24;++r,n+=10)this.PALETTE_COLORS.push(n+", "+n+", "+n)}escapeForHtml(e){return e.replace(/[&<>\"]/gm,s=>s=="&"?"&":s=='"'?""":s=="<"?"<":s==">"?">":"")}linkify(e){return e.replace(He,s=>`<a href="${s}">${s}</a>`)}ansiToHtml(e,s){return this.process(e,s,!0)}ansiToJson(e,s){return s=s||{},s.json=!0,s.clearLine=!1,this.process(e,s,!0)}ansiToText(e){return this.process(e,{},!1)}process(e,s,n){let r=this,u=e.split(/\033\[/),o=u.shift();s==null&&(s={}),s.clearLine=/\r/.test(e);let c=u.map(l=>this.processChunk(l,s,n));if(s&&s.json){let l=r.processChunkJson("");return l.content=o,l.clearLine=s.clearLine,c.unshift(l),s.remove_empty&&(c=c.filter(i=>!i.isEmpty())),c}else c.unshift(o);return c.join("")}processChunkJson(e,s,n){s=typeof s>"u"?{}:s;let r=s.use_classes=typeof s.use_classes<"u"&&s.use_classes,u=s.key=r?"class":"color",o={content:e,fg:null,bg:null,fg_truecolor:null,bg_truecolor:null,isInverted:!1,clearLine:s.clearLine,decoration:null,decorations:[],was_processed:!1,isEmpty:()=>!o.content},c=e.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);if(!c)return o;o.content=c[4];let l=c[2].split(";");if(c[1]!==""||c[3]!=="m"||!n)return o;let i=this;for(;l.length>0;){let g=l.shift(),a=parseInt(g);if(isNaN(a)||a===0)i.fg=i.bg=null,i.decorations=[];else if(a===1)i.decorations.push("bold");else if(a===2)i.decorations.push("dim");else if(a===3)i.decorations.push("italic");else if(a===4)i.decorations.push("underline");else if(a===5)i.decorations.push("blink");else if(a===7)i.decorations.push("reverse");else if(a===8)i.decorations.push("hidden");else if(a===9)i.decorations.push("strikethrough");else if(a===21)i.removeDecoration("bold");else if(a===22)i.removeDecoration("bold"),i.removeDecoration("dim");else if(a===23)i.removeDecoration("italic");else if(a===24)i.removeDecoration("underline");else if(a===25)i.removeDecoration("blink");else if(a===27)i.removeDecoration("reverse");else if(a===28)i.removeDecoration("hidden");else if(a===29)i.removeDecoration("strikethrough");else if(a===39)i.fg=null;else if(a===49)i.bg=null;else if(a>=30&&a<38)i.fg=k[0][a%10][u];else if(a>=90&&a<98)i.fg=k[1][a%10][u];else if(a>=40&&a<48)i.bg=k[0][a%10][u];else if(a>=100&&a<108)i.bg=k[1][a%10][u];else if(a===38||a===48){let D=a===38;if(l.length>=1){let F=l.shift();if(F==="5"&&l.length>=1){let x=parseInt(l.shift());if(x>=0&&x<=255)if(!r)this.PALETTE_COLORS||i.setupPalette(),D?i.fg=this.PALETTE_COLORS[x]:i.bg=this.PALETTE_COLORS[x];else{let y=x>=16?"ansi-palette-"+x:k[x>7?1:0][x%8].class;D?i.fg=y:i.bg=y}}else if(F==="2"&&l.length>=3){let x=parseInt(l.shift()),y=parseInt(l.shift()),j=parseInt(l.shift());if(x>=0&&x<=255&&y>=0&&y<=255&&j>=0&&j<=255){let C=x+", "+y+", "+j;r?D?(i.fg="ansi-truecolor",i.fg_truecolor=C):(i.bg="ansi-truecolor",i.bg_truecolor=C):D?i.fg=C:i.bg=C}}}}}return i.fg===null&&i.bg===null&&i.decorations.length===0||(o.fg=i.fg,o.bg=i.bg,o.fg_truecolor=i.fg_truecolor,o.bg_truecolor=i.bg_truecolor,o.decorations=i.decorations,o.decoration=i.decorations.slice(-1).pop()||null,o.was_processed=!0),o}processChunk(e,s,n){s=s||{};let r=this.processChunkJson(e,s,n),u=s.use_classes;if(r.decorations=r.decorations.filter(a=>{if(a==="reverse"){r.fg||(r.fg=k[0][7][u?"class":"color"]),r.bg||(r.bg=k[0][0][u?"class":"color"]);let D=r.fg;r.fg=r.bg,r.bg=D;let F=r.fg_truecolor;return r.fg_truecolor=r.bg_truecolor,r.bg_truecolor=F,r.isInverted=!0,!1}return!0}),s.json)return r;if(r.isEmpty())return"";if(!r.was_processed)return r.content;let o=[],c=[],l=[],i={},g=a=>{let D=[],F;for(F in a)a.hasOwnProperty(F)&&D.push("data-"+F+'="'+this.escapeForHtml(a[F])+'"');return D.length>0?" "+D.join(" "):""};return r.isInverted&&(i["ansi-is-inverted"]="true"),r.fg&&(u?(o.push(r.fg+"-fg"),r.fg_truecolor!==null&&(i["ansi-truecolor-fg"]=r.fg_truecolor,r.fg_truecolor=null)):o.push("color:rgb("+r.fg+")")),r.bg&&(u?(o.push(r.bg+"-bg"),r.bg_truecolor!==null&&(i["ansi-truecolor-bg"]=r.bg_truecolor,r.bg_truecolor=null)):o.push("background-color:rgb("+r.bg+")")),r.decorations.forEach(a=>{if(u){c.push("ansi-"+a);return}a==="bold"?c.push("font-weight:bold"):a==="dim"?c.push("opacity:0.5"):a==="italic"?c.push("font-style:italic"):a==="hidden"?c.push("visibility:hidden"):a==="strikethrough"?l.push("line-through"):l.push(a)}),l.length&&c.push("text-decoration:"+l.join(" ")),u?'<span class="'+o.concat(c).join(" ")+'"'+g(i)+">"+r.content+"</span>":'<span style="'+o.concat(c).join(";")+'"'+g(i)+">"+r.content+"</span>"}removeDecoration(e){const s=this.decorations.indexOf(e);s>=0&&this.decorations.splice(s,1)}}var We=O,B={exports:{}};function X(t){if(!t)return"";if(!/\r/.test(t))return t;for(t=t.replace(/\r+\n/gm,`
|
|
2
2
|
`);/\r./.test(t);)t=t.replace(/^([^\r\n]*)\r+([^\r\n]+)/gm,function(e,s,n){return n+s.slice(n.length)});return t}function Je(t){for(var e=0,s=0;s<t.length;s++)t[e].length<=t[s].length&&(e=s);return e}function ie(t){if(!/\r/.test(t))return t;for(var e=t.split("\r"),s=[];e.length>0;){var n=Je(e);s.push(e[n]),e=e.slice(n+1)}return s.join("\r")}function Ge(t){if(!t)return"";if(!/\r/.test(t))return t;if(!/\n/.test(t))return ie(t);t=t.replace(/\r+\n/gm,`
|
|
3
3
|
`);var e=t.lastIndexOf(`
|
|
4
4
|
`);return X(t.slice(0,e))+`
|
|
5
|
-
`+ie(t.slice(e+1))}B.exports=X;B.exports.escapeCarriageReturn=X;B.exports.escapeCarriageReturnSafe=Ge;var Ue=B.exports,H,ue;function Ve(){return ue||(ue=1,H=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),H}var W,oe;function Ke(){return oe||(oe=1,W=/[\0-\x1F\x7F-\x9F]/),W}var J,ce;function Qe(){return ce||(ce=1,J=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/),J}var G,ae;function Xe(){return ae||(ae=1,G=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/),G}var U,le;function et(){return le||(le=1,U=function(t){var e={};e.src_Any=Ve().source,e.src_Cc=Ke().source,e.src_Z=Qe().source,e.src_P=Xe().source,e.src_ZPCc=[e.src_Z,e.src_P,e.src_Cc].join("|"),e.src_ZCc=[e.src_Z,e.src_Cc].join("|");var s="[><|]";return e.src_pseudo_letter="(?:(?!"+s+"|"+e.src_ZPCc+")"+e.src_Any+")",e.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",e.src_auth="(?:(?:(?!"+e.src_ZCc+"|[@/\\[\\]()]).)+@)?",e.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",e.src_host_terminator="(?=$|"+s+"|"+e.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+e.src_ZPCc+"))",e.src_path="(?:[/?#](?:(?!"+e.src_ZCc+"|"+s+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+e.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+e.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+e.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+e.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+e.src_ZCc+"|[']).)+\\'|\\'(?="+e.src_pseudo_letter+"|[-]).|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+e.src_ZCc+"|[.]).|"+(t&&t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+e.src_ZCc+").|;(?!"+e.src_ZCc+").|\\!+(?!"+e.src_ZCc+"|[!]).|\\?(?!"+e.src_ZCc+"|[?]).)+|\\/)?",e.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',e.src_xn="xn--[a-z0-9\\-]{1,59}",e.src_domain_root="(?:"+e.src_xn+"|"+e.src_pseudo_letter+"{1,63})",e.src_domain="(?:"+e.src_xn+"|(?:"+e.src_pseudo_letter+")|(?:"+e.src_pseudo_letter+"(?:-|"+e.src_pseudo_letter+"){0,61}"+e.src_pseudo_letter+"))",e.src_host="(?:(?:(?:(?:"+e.src_domain+")\\.)*"+e.src_domain+"))",e.tpl_host_fuzzy="(?:"+e.src_ip4+"|(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%)))",e.tpl_host_no_ip_fuzzy="(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%))",e.src_host_strict=e.src_host+e.src_host_terminator,e.tpl_host_fuzzy_strict=e.tpl_host_fuzzy+e.src_host_terminator,e.src_host_port_strict=e.src_host+e.src_port+e.src_host_terminator,e.tpl_host_port_fuzzy_strict=e.tpl_host_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_port_no_ip_fuzzy_strict=e.tpl_host_no_ip_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+e.src_ZPCc+"|>|$))",e.tpl_email_fuzzy="(^|"+s+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}),U}function V(t){var e=Array.prototype.slice.call(arguments,1);return e.forEach(function(s){s&&Object.keys(s).forEach(function(n){t[n]=s[n]})}),t}function P(t){return Object.prototype.toString.call(t)}function tt(t){return P(t)==="[object String]"}function st(t){return P(t)==="[object Object]"}function nt(t){return P(t)==="[object RegExp]"}function _e(t){return P(t)==="[object Function]"}function rt(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var pe={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function it(t){return Object.keys(t||{}).reduce(function(e,s){return e||pe.hasOwnProperty(s)},!1)}var ut={"http:":{validate:function(t,e,s){var n=t.slice(e);return s.re.http||(s.re.http=new RegExp("^\\/\\/"+s.re.src_auth+s.re.src_host_port_strict+s.re.src_path,"i")),s.re.http.test(n)?n.match(s.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,s){var n=t.slice(e);return s.re.no_http||(s.re.no_http=new RegExp("^"+s.re.src_auth+"(?:localhost|(?:(?:"+s.re.src_domain+")\\.)+"+s.re.src_domain_root+")"+s.re.src_port+s.re.src_host_terminator+s.re.src_path,"i")),s.re.no_http.test(n)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:n.match(s.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,s){var n=t.slice(e);return s.re.mailto||(s.re.mailto=new RegExp("^"+s.re.src_email_name+"@"+s.re.src_host_strict,"i")),s.re.mailto.test(n)?n.match(s.re.mailto)[0].length:0}}},ot="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",ct="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function at(t){t.__index__=-1,t.__text_cache__=""}function lt(t){return function(e,s){var n=e.slice(s);return t.test(n)?n.match(t)[0].length:0}}function fe(){return function(t,e){e.normalize(t)}}function T(t){var e=t.re=et()(t.__opts__),s=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||s.push(ot),s.push(e.src_xn),e.src_tlds=s.join("|");function n(c){return c.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(n(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(n(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(n(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(n(e.tpl_host_fuzzy_test),"i");var r=[];t.__compiled__={};function u(c,l){throw new Error('(LinkifyIt) Invalid schema "'+c+'": '+l)}Object.keys(t.__schemas__).forEach(function(c){var l=t.__schemas__[c];if(l!==null){var i={validate:null,link:null};if(t.__compiled__[c]=i,st(l)){nt(l.validate)?i.validate=lt(l.validate):_e(l.validate)?i.validate=l.validate:u(c,l),_e(l.normalize)?i.normalize=l.normalize:l.normalize?u(c,l):i.normalize=fe();return}if(tt(l)){r.push(c);return}u(c,l)}}),r.forEach(function(c){t.__compiled__[t.__schemas__[c]]&&(t.__compiled__[c].validate=t.__compiled__[t.__schemas__[c]].validate,t.__compiled__[c].normalize=t.__compiled__[t.__schemas__[c]].normalize)}),t.__compiled__[""]={validate:null,normalize:fe()};var o=Object.keys(t.__compiled__).filter(function(c){return c.length>0&&t.__compiled__[c]}).map(rt).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+o+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+o+")","ig"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),at(t)}function _t(t,e){var s=t.__index__,n=t.__last_index__,r=t.__text_cache__.slice(s,n);this.schema=t.__schema__.toLowerCase(),this.index=s+e,this.lastIndex=n+e,this.raw=r,this.text=r,this.url=r}function he(t,e){var s=new _t(t,e);return t.__compiled__[s.schema].normalize(s,t),s}function E(t,e){if(!(this instanceof E))return new E(t,e);e||it(t)&&(e=t,t={}),this.__opts__=V({},pe,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=V({},ut,t),this.__compiled__={},this.__tlds__=ct,this.__tlds_replaced__=!1,this.re={},T(this)}E.prototype.add=function(e,s){return this.__schemas__[e]=s,T(this),this};E.prototype.set=function(e){return this.__opts__=V(this.__opts__,e),this};E.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var s,n,r,u,o,c,l,i,g;if(this.re.schema_test.test(e)){for(l=this.re.schema_search,l.lastIndex=0;(s=l.exec(e))!==null;)if(u=this.testSchemaAt(e,s[2],l.lastIndex),u){this.__schema__=s[2],this.__index__=s.index+s[1].length,this.__last_index__=s.index+s[0].length+u;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(i=e.search(this.re.host_fuzzy_test),i>=0&&(this.__index__<0||i<this.__index__)&&(n=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(o=n.index+n[1].length,(this.__index__<0||o<this.__index__)&&(this.__schema__="",this.__index__=o,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(g=e.indexOf("@"),g>=0&&(r=e.match(this.re.email_fuzzy))!==null&&(o=r.index+r[1].length,c=r.index+r[0].length,(this.__index__<0||o<this.__index__||o===this.__index__&&c>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=o,this.__last_index__=c))),this.__index__>=0};E.prototype.pretest=function(e){return this.re.pretest.test(e)};E.prototype.testSchemaAt=function(e,s,n){return this.__compiled__[s.toLowerCase()]?this.__compiled__[s.toLowerCase()].validate(e,n,this):0};E.prototype.match=function(e){var s=0,n=[];this.__index__>=0&&this.__text_cache__===e&&(n.push(he(this,s)),s=this.__last_index__);for(var r=s?e.slice(s):e;this.test(r);)n.push(he(this,s)),r=r.slice(this.__last_index__),s+=this.__last_index__;return n.length?n:null};E.prototype.tlds=function(e,s){return e=Array.isArray(e)?e:[e],s?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(n,r,u){return n!==u[r-1]}).reverse(),T(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,T(this),this)};E.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)};E.prototype.onCompile=function(){};var ft=E,ht=R&&R.__createBinding||(Object.create?function(t,e,s,n){n===void 0&&(n=s);var r=Object.getOwnPropertyDescriptor(e,s);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[s]}}),Object.defineProperty(t,n,r)}:function(t,e,s,n){n===void 0&&(n=s),t[n]=e[s]}),dt=R&&R.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gt=R&&R.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(s){var n=[];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(n[n.length]=r);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var s={};if(e!=null)for(var n=t(e),r=0;r<n.length;r++)n[r]!=="default"&&ht(s,e,n[r]);return dt(s,e),s}}(),me=R&&R.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ge,"__esModule",{value:!0});var pt=ge.default=At;const mt=me(We),Dt=Ue,xt=me(ft),N=gt(w);function Ft(t,e=!1){return t=(0,Dt.escapeCarriageReturn)(jt(t)),mt.default.ansiToJson(t,{json:!0,remove_empty:!0,use_classes:e})}function bt(t){let e="";return t.bg&&(e+=`${t.bg}-bg `),t.fg&&(e+=`${t.fg}-fg `),t.decoration&&(e+=`ansi-${t.decoration} `),e===""?null:(e=e.substring(0,e.length-1),e)}function vt(t){const e={};switch(t.bg&&(e.backgroundColor=`rgb(${t.bg})`),t.fg&&(e.color=`rgb(${t.fg})`),t.decoration){case"bold":e.fontWeight="bold";break;case"dim":e.opacity="0.5";break;case"italic":e.fontStyle="italic";break;case"hidden":e.visibility="hidden";break;case"strikethrough":e.textDecoration="line-through";break;case"underline":e.textDecoration="underline";break;case"blink":e.textDecoration="blink";break}return e}function yt(t,e,s,n){const r=e?null:vt(s),u=e?bt(s):null;return t?t==="fuzzy"?Et(s,n,r,u):Ct(s,n,r,u):N.createElement("span",{style:r,key:n,className:u},s.content)}function Ct(t,e,s,n){const r=[],u=/(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g;let o=0,c;for(;(c=u.exec(t.content))!==null;){const[,l,i]=c,g=c.index+l.length;g>o&&r.push(t.content.substring(o,g));const a=i.startsWith("www.")?`http://${i}`:i;r.push(N.createElement("a",{key:o,href:a,target:"_blank"},`${i}`)),o=u.lastIndex}return o<t.content.length&&r.push(t.content.substring(o)),N.createElement("span",{style:s,key:e,className:n},r)}function Et(t,e,s,n){var r;const u=(0,xt.default)({fuzzyEmail:!1}).tlds(["io"],!0);if(!u.pretest(t.content))return N.createElement("span",{style:s,key:e,className:n},t.content);const o=u.match(t.content);if(!o)return N.createElement("span",{style:s,key:e,className:n},t.content);const c=[t.content.substring(0,(r=o[0])===null||r===void 0?void 0:r.index)];return o.forEach((l,i)=>{var g;c.push(N.createElement("a",{href:l.url,target:"_blank",key:i},t.content.substring(l.index,l.lastIndex))),o[i+1]&&c.push(t.content.substring(o[i].lastIndex,(g=o[i+1])===null||g===void 0?void 0:g.index))}),o[o.length-1].lastIndex!==t.content.length&&c.push(t.content.substring(o[o.length-1].lastIndex,t.content.length)),N.createElement("span",{style:s,key:e,className:n},c)}function At(t){const{className:e,useClasses:s,children:n,linkify:r}=t;return N.createElement("code",{className:e},Ft(n??"",s??!1).map(yt.bind(null,r??!1,s??!1)))}function jt(t){let e=t;do t=e,e=t.replace(/[^\n]\x08/gm,"");while(e.length<t.length);return t}function wt(t){return/^\[(ERROR|FATAL)\]/.test(t)||/^ERROR\b/.test(t)?"text-destructive":/^\[(WARN|WARNING)\]/.test(t)||/^WARN(ING)?\b/.test(t)?"text-warning":/^\[DEBUG\]/.test(t)||/^DEBUG\b/.test(t)?"text-info":/^\[(INFO|DOWNLOAD|PROGRESS)\]/.test(t)||/^INFO\b/.test(t)?"text-success":"text-terminal-fg"}function de(t){const e=Ye({start:0,end:t}),s=e.hours??0,n=e.minutes??0,r=e.seconds??0;return s===0&&n===0?`${r}s`:s===0?`${n}m${r}s`:`${s}h${n}m`}function zt({selected:t,onSelect:e}){const s=typeof e=="function",[n,r]=w.useState(null),u=s?t??null:n,o=h=>{s?e(h):r(h)},l=Ae("just:/__just/recipes",()=>fetch("/__just/recipes",{cache:"no-store"}).then(h=>h.json()),{subscribe:"plugin:just:state"}).data??[],[i,g]=w.useState({}),[a,D]=w.useState({}),F=w.useRef(""),[,x]=w.useState(0),y=w.useRef(null),j=u?a[u]??[]:[],{icon:C}=Fe();w.useEffect(()=>{fetch("/__config").then(b=>b.json()).then(b=>{F.current=b.stopToken??""}).catch(()=>{});const h=new EventSource("/__just/logs");let f=!0;h.onopen=()=>{if(f){f=!1;return}D({}),g({})},h.onmessage=b=>{try{const p=JSON.parse(b.data);p.type==="log"?D(v=>{const z=[...v[p.recipe]??[],p.text];return{...v,[p.recipe]:z.length>1e3?z.slice(-1e3):z}}):p.type==="clear"?D(v=>({...v,[p.recipe]:[]})):p.type==="state"&&(g(v=>{var z;return{...v,[p.recipe]:{state:p.state,code:p.code,signal:p.signal,startedAt:p.startedAt??((z=v[p.recipe])==null?void 0:z.startedAt)??Date.now()}}}),p.state==="running"&&!s&&o(p.recipe))}catch{}},h.onerror=()=>{};const m=setInterval(()=>x(b=>b+1),1e3);return()=>{h.close(),clearInterval(m)}},[]),w.useEffect(()=>{y.current&&(y.current.scrollTop=y.current.scrollHeight)},[j.length,u]);const M=(h,f)=>{fetch(`/__just/${h}`,{method:"POST",headers:{"x-stop-token":F.current,"Content-Type":"application/json"},body:JSON.stringify({recipe:f})}).catch(()=>be.error(`just ${h} 动作失败`))},Z=l.map(h=>({...h,task:i[h.name]})),ee=Z.filter(h=>{var f;return((f=h.task)==null?void 0:f.state)==="running"}).length,A=u?i[u]:void 0,q=(A==null?void 0:A.state)==="running",te=(h,f,m)=>h?"bg-success animate-pulse":f?m!=null&&m.signal?"bg-muted-foreground":m!=null&&m.code?"bg-destructive":"bg-success/60":"bg-muted-foreground/30",De={key:"__console__",label:"总控台",badge:_.jsx("span",{className:"font-mono opacity-80",children:ee>0?ee:""}),className:u===null?"":"border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground/40",renderLabel:()=>_.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[_.jsx("span",{className:"h-3 w-3",children:C("monitor","h-3 w-3")}),_.jsx("span",{children:"总控台"})]})},xe=l.map(h=>{const f=i[h.name],m=(f==null?void 0:f.state)==="running",b=(f==null?void 0:f.state)==="exited",p=u===h.name;return{key:h.name,label:h.name,className:p?"":m?"border-success/40 bg-success/10 text-success hover:bg-success/20":"",renderLabel:()=>_.jsxs(_.Fragment,{children:[_.jsx("span",{className:`h-1.5 w-1.5 rounded-[var(--radius-full)] ${te(m,b,f)}`}),_.jsx("span",{children:h.name})]}),renderExtra:()=>b&&!p?_.jsx("span",{className:`text-xs ${f!=null&&f.signal?"opacity-60":f!=null&&f.code?"text-destructive":"text-success"}`,children:f!=null&&f.signal?"停":f==null?void 0:f.code}):void 0}});return _.jsxs("div",{className:"h-full flex flex-col",children:[_.jsx("div",{className:"flex-none flex items-center gap-1.5 flex-wrap px-3 py-2 border-b bg-background",children:_.jsx(Ee,{items:[De,...xe],value:u??"__console__",onChange:h=>o(h==="__console__"?null:h),ariaLabel:"任务筛选"})}),u===null?_.jsxs("div",{className:"flex-1 min-h-0 overflow-auto p-3 grid gap-2.5 grid-cols-1 md:grid-cols-2 xl:grid-cols-3 content-start",children:[Z.length===0&&_.jsx("p",{className:"text-xs text-muted-foreground col-span-full p-4 text-center",children:"未发现 justfile recipes"}),Z.map(h=>{const f=h.task,m=(f==null?void 0:f.state)==="running",b=(f==null?void 0:f.state)==="exited",p=(a[h.name]??[]).slice(-3).map(v=>v.replace(/\r?\n$/,"").replace(/\x1b\[[0-9;]*m/g,""));return _.jsxs("div",{onClick:()=>o(h.name),className:"group rounded-[var(--radius-lg)] border bg-card p-3 cursor-pointer hover:border-muted-foreground/40 transition-colors",children:[_.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[_.jsx("span",{className:`h-2 w-2 rounded-[var(--radius-full)] flex-none ${te(m,b,f)}`}),_.jsx("span",{className:"font-mono font-medium",children:h.name}),m&&_.jsx("span",{className:"text-success font-mono",children:de(Date.now()-f.startedAt)}),b&&_.jsx("span",{className:`font-mono ${f.signal?"text-muted-foreground":f.code?"text-destructive":"text-success"}`,children:f.signal?"已停止":`exit ${f.code}`}),!f&&_.jsx("span",{className:"text-muted-foreground/60",children:"未运行"}),_.jsx("span",{className:"ml-auto flex items-center gap-1",onClick:v=>v.stopPropagation(),children:m?_.jsxs(S,{variant:"ghost",className:"h-6 gap-1 px-2 text-sm",onClick:()=>M("stop",h.name),children:[C("square","h-2.5 w-2.5"),"停止"]}):_.jsxs(S,{variant:"ghost",className:"h-6 gap-1 px-2 text-sm",onClick:()=>M("start",h.name),children:[C(b?"rotate-cw":"play","h-2.5 w-2.5"),b?"重跑":"启动"]})})]}),h.description&&_.jsx("p",{className:"mt-1 text-sm text-muted-foreground/70 truncate",children:h.description}),_.jsx("div",{className:"mt-2 rounded bg-terminal-bg px-2 py-1.5 font-mono text-xs leading-relaxed text-terminal-fg/70 min-h-[3.4em]",children:p.length?p.map((v,z)=>_.jsx("div",{className:"truncate",children:v},z)):_.jsxs("span",{className:"text-terminal-fg/40",children:["$ just ",h.name," …"]})})]},h.name)})]}):_.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[_.jsxs("div",{className:"flex-none flex items-center gap-2 px-3.5 h-8 border-b bg-background text-sm",children:[_.jsx("span",{className:`h-1.5 w-1.5 rounded-[var(--radius-full)] ${q?"bg-success animate-pulse":"bg-muted-foreground"}`}),_.jsx("span",{className:"font-mono font-medium",children:u}),_.jsx("span",{className:"text-muted-foreground font-mono",children:q?`running · ${de(Date.now()-A.startedAt)}`:A!=null&&A.signal?"已停止":A?`exit ${A.code}`:"未运行"}),_.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[q?_.jsxs(S,{variant:"ghost",className:"h-6 gap-1 px-2 text-sm",onClick:()=>M("stop",u),children:[C("square","h-2.5 w-2.5"),"停止"]}):_.jsxs(S,{variant:"ghost",className:"h-6 gap-1 px-2 text-sm",onClick:()=>M("start",u),children:[C("rotate-cw","h-2.5 w-2.5"),A?"重跑":"启动"]}),_.jsxs(S,{variant:"ghost",className:"h-6 gap-1 px-2 text-sm",onClick:()=>M("clear",u),disabled:!j.length,children:[C("eraser","h-2.5 w-2.5"),"清屏"]}),_.jsxs("span",{className:"text-muted-foreground font-mono ml-1",children:[j.length," 行"]})]})]}),_.jsxs("div",{ref:y,className:"flex-1 min-h-0 overflow-auto bg-terminal-bg p-3.5 font-mono text-xs leading-relaxed text-terminal-fg",children:[j.length===0&&_.jsxs("p",{className:"text-terminal-fg/50",children:["$ just ",u," · 等待输出…"]}),j.map((h,f)=>{const m=h.replace(/\r?\n$/,"");return _.jsx("div",{className:"whitespace-pre-wrap break-all min-h-[1.25rem]",children:/\x1b\[/.test(m)?_.jsx(pt,{children:m}):_.jsx("span",{className:wt(m),children:m})},f)})]})]})]})}function St({params:t}){const e=ve(Y.mode,"h-5 w-5"),s=ye(),n=t.get("task")??t.get("recipe");return _.jsx(Ce,{manifest:Y,icon:e,breadcrumb:["插件",Y.mode,...n?[n]:[]],children:_.jsx("div",{className:"mx-auto h-full max-w-6xl bg-background border rounded-lg shadow-sm overflow-hidden flex flex-col",children:_.jsx(zt,{selected:n,onSelect:r=>s.navigate(r?{recipe:r,task:null}:{recipe:null,task:null})})})})}export{St as default};
|
|
5
|
+
`+ie(t.slice(e+1))}B.exports=X;B.exports.escapeCarriageReturn=X;B.exports.escapeCarriageReturnSafe=Ge;var Ue=B.exports,H,ue;function Ve(){return ue||(ue=1,H=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),H}var W,oe;function Ke(){return oe||(oe=1,W=/[\0-\x1F\x7F-\x9F]/),W}var J,ce;function Qe(){return ce||(ce=1,J=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/),J}var G,ae;function Xe(){return ae||(ae=1,G=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/),G}var U,le;function et(){return le||(le=1,U=function(t){var e={};e.src_Any=Ve().source,e.src_Cc=Ke().source,e.src_Z=Qe().source,e.src_P=Xe().source,e.src_ZPCc=[e.src_Z,e.src_P,e.src_Cc].join("|"),e.src_ZCc=[e.src_Z,e.src_Cc].join("|");var s="[><|]";return e.src_pseudo_letter="(?:(?!"+s+"|"+e.src_ZPCc+")"+e.src_Any+")",e.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",e.src_auth="(?:(?:(?!"+e.src_ZCc+"|[@/\\[\\]()]).)+@)?",e.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",e.src_host_terminator="(?=$|"+s+"|"+e.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+e.src_ZPCc+"))",e.src_path="(?:[/?#](?:(?!"+e.src_ZCc+"|"+s+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+e.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+e.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+e.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+e.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+e.src_ZCc+"|[']).)+\\'|\\'(?="+e.src_pseudo_letter+"|[-]).|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+e.src_ZCc+"|[.]).|"+(t&&t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+e.src_ZCc+").|;(?!"+e.src_ZCc+").|\\!+(?!"+e.src_ZCc+"|[!]).|\\?(?!"+e.src_ZCc+"|[?]).)+|\\/)?",e.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',e.src_xn="xn--[a-z0-9\\-]{1,59}",e.src_domain_root="(?:"+e.src_xn+"|"+e.src_pseudo_letter+"{1,63})",e.src_domain="(?:"+e.src_xn+"|(?:"+e.src_pseudo_letter+")|(?:"+e.src_pseudo_letter+"(?:-|"+e.src_pseudo_letter+"){0,61}"+e.src_pseudo_letter+"))",e.src_host="(?:(?:(?:(?:"+e.src_domain+")\\.)*"+e.src_domain+"))",e.tpl_host_fuzzy="(?:"+e.src_ip4+"|(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%)))",e.tpl_host_no_ip_fuzzy="(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%))",e.src_host_strict=e.src_host+e.src_host_terminator,e.tpl_host_fuzzy_strict=e.tpl_host_fuzzy+e.src_host_terminator,e.src_host_port_strict=e.src_host+e.src_port+e.src_host_terminator,e.tpl_host_port_fuzzy_strict=e.tpl_host_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_port_no_ip_fuzzy_strict=e.tpl_host_no_ip_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+e.src_ZPCc+"|>|$))",e.tpl_email_fuzzy="(^|"+s+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}),U}function V(t){var e=Array.prototype.slice.call(arguments,1);return e.forEach(function(s){s&&Object.keys(s).forEach(function(n){t[n]=s[n]})}),t}function P(t){return Object.prototype.toString.call(t)}function tt(t){return P(t)==="[object String]"}function st(t){return P(t)==="[object Object]"}function nt(t){return P(t)==="[object RegExp]"}function _e(t){return P(t)==="[object Function]"}function rt(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var pe={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function it(t){return Object.keys(t||{}).reduce(function(e,s){return e||pe.hasOwnProperty(s)},!1)}var ut={"http:":{validate:function(t,e,s){var n=t.slice(e);return s.re.http||(s.re.http=new RegExp("^\\/\\/"+s.re.src_auth+s.re.src_host_port_strict+s.re.src_path,"i")),s.re.http.test(n)?n.match(s.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,s){var n=t.slice(e);return s.re.no_http||(s.re.no_http=new RegExp("^"+s.re.src_auth+"(?:localhost|(?:(?:"+s.re.src_domain+")\\.)+"+s.re.src_domain_root+")"+s.re.src_port+s.re.src_host_terminator+s.re.src_path,"i")),s.re.no_http.test(n)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:n.match(s.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,s){var n=t.slice(e);return s.re.mailto||(s.re.mailto=new RegExp("^"+s.re.src_email_name+"@"+s.re.src_host_strict,"i")),s.re.mailto.test(n)?n.match(s.re.mailto)[0].length:0}}},ot="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",ct="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function at(t){t.__index__=-1,t.__text_cache__=""}function lt(t){return function(e,s){var n=e.slice(s);return t.test(n)?n.match(t)[0].length:0}}function fe(){return function(t,e){e.normalize(t)}}function T(t){var e=t.re=et()(t.__opts__),s=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||s.push(ot),s.push(e.src_xn),e.src_tlds=s.join("|");function n(c){return c.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(n(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(n(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(n(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(n(e.tpl_host_fuzzy_test),"i");var r=[];t.__compiled__={};function u(c,l){throw new Error('(LinkifyIt) Invalid schema "'+c+'": '+l)}Object.keys(t.__schemas__).forEach(function(c){var l=t.__schemas__[c];if(l!==null){var i={validate:null,link:null};if(t.__compiled__[c]=i,st(l)){nt(l.validate)?i.validate=lt(l.validate):_e(l.validate)?i.validate=l.validate:u(c,l),_e(l.normalize)?i.normalize=l.normalize:l.normalize?u(c,l):i.normalize=fe();return}if(tt(l)){r.push(c);return}u(c,l)}}),r.forEach(function(c){t.__compiled__[t.__schemas__[c]]&&(t.__compiled__[c].validate=t.__compiled__[t.__schemas__[c]].validate,t.__compiled__[c].normalize=t.__compiled__[t.__schemas__[c]].normalize)}),t.__compiled__[""]={validate:null,normalize:fe()};var o=Object.keys(t.__compiled__).filter(function(c){return c.length>0&&t.__compiled__[c]}).map(rt).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+o+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+o+")","ig"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),at(t)}function _t(t,e){var s=t.__index__,n=t.__last_index__,r=t.__text_cache__.slice(s,n);this.schema=t.__schema__.toLowerCase(),this.index=s+e,this.lastIndex=n+e,this.raw=r,this.text=r,this.url=r}function he(t,e){var s=new _t(t,e);return t.__compiled__[s.schema].normalize(s,t),s}function E(t,e){if(!(this instanceof E))return new E(t,e);e||it(t)&&(e=t,t={}),this.__opts__=V({},pe,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=V({},ut,t),this.__compiled__={},this.__tlds__=ct,this.__tlds_replaced__=!1,this.re={},T(this)}E.prototype.add=function(e,s){return this.__schemas__[e]=s,T(this),this};E.prototype.set=function(e){return this.__opts__=V(this.__opts__,e),this};E.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var s,n,r,u,o,c,l,i,g;if(this.re.schema_test.test(e)){for(l=this.re.schema_search,l.lastIndex=0;(s=l.exec(e))!==null;)if(u=this.testSchemaAt(e,s[2],l.lastIndex),u){this.__schema__=s[2],this.__index__=s.index+s[1].length,this.__last_index__=s.index+s[0].length+u;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(i=e.search(this.re.host_fuzzy_test),i>=0&&(this.__index__<0||i<this.__index__)&&(n=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(o=n.index+n[1].length,(this.__index__<0||o<this.__index__)&&(this.__schema__="",this.__index__=o,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(g=e.indexOf("@"),g>=0&&(r=e.match(this.re.email_fuzzy))!==null&&(o=r.index+r[1].length,c=r.index+r[0].length,(this.__index__<0||o<this.__index__||o===this.__index__&&c>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=o,this.__last_index__=c))),this.__index__>=0};E.prototype.pretest=function(e){return this.re.pretest.test(e)};E.prototype.testSchemaAt=function(e,s,n){return this.__compiled__[s.toLowerCase()]?this.__compiled__[s.toLowerCase()].validate(e,n,this):0};E.prototype.match=function(e){var s=0,n=[];this.__index__>=0&&this.__text_cache__===e&&(n.push(he(this,s)),s=this.__last_index__);for(var r=s?e.slice(s):e;this.test(r);)n.push(he(this,s)),r=r.slice(this.__last_index__),s+=this.__last_index__;return n.length?n:null};E.prototype.tlds=function(e,s){return e=Array.isArray(e)?e:[e],s?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(n,r,u){return n!==u[r-1]}).reverse(),T(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,T(this),this)};E.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)};E.prototype.onCompile=function(){};var ft=E,ht=R&&R.__createBinding||(Object.create?function(t,e,s,n){n===void 0&&(n=s);var r=Object.getOwnPropertyDescriptor(e,s);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[s]}}),Object.defineProperty(t,n,r)}:function(t,e,s,n){n===void 0&&(n=s),t[n]=e[s]}),dt=R&&R.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gt=R&&R.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(s){var n=[];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(n[n.length]=r);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var s={};if(e!=null)for(var n=t(e),r=0;r<n.length;r++)n[r]!=="default"&&ht(s,e,n[r]);return dt(s,e),s}}(),me=R&&R.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ge,"__esModule",{value:!0});var pt=ge.default=At;const mt=me(We),Dt=Ue,xt=me(ft),N=gt(z);function Ft(t,e=!1){return t=(0,Dt.escapeCarriageReturn)(jt(t)),mt.default.ansiToJson(t,{json:!0,remove_empty:!0,use_classes:e})}function bt(t){let e="";return t.bg&&(e+=`${t.bg}-bg `),t.fg&&(e+=`${t.fg}-fg `),t.decoration&&(e+=`ansi-${t.decoration} `),e===""?null:(e=e.substring(0,e.length-1),e)}function vt(t){const e={};switch(t.bg&&(e.backgroundColor=`rgb(${t.bg})`),t.fg&&(e.color=`rgb(${t.fg})`),t.decoration){case"bold":e.fontWeight="bold";break;case"dim":e.opacity="0.5";break;case"italic":e.fontStyle="italic";break;case"hidden":e.visibility="hidden";break;case"strikethrough":e.textDecoration="line-through";break;case"underline":e.textDecoration="underline";break;case"blink":e.textDecoration="blink";break}return e}function yt(t,e,s,n){const r=e?null:vt(s),u=e?bt(s):null;return t?t==="fuzzy"?Et(s,n,r,u):Ct(s,n,r,u):N.createElement("span",{style:r,key:n,className:u},s.content)}function Ct(t,e,s,n){const r=[],u=/(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g;let o=0,c;for(;(c=u.exec(t.content))!==null;){const[,l,i]=c,g=c.index+l.length;g>o&&r.push(t.content.substring(o,g));const a=i.startsWith("www.")?`http://${i}`:i;r.push(N.createElement("a",{key:o,href:a,target:"_blank"},`${i}`)),o=u.lastIndex}return o<t.content.length&&r.push(t.content.substring(o)),N.createElement("span",{style:s,key:e,className:n},r)}function Et(t,e,s,n){var r;const u=(0,xt.default)({fuzzyEmail:!1}).tlds(["io"],!0);if(!u.pretest(t.content))return N.createElement("span",{style:s,key:e,className:n},t.content);const o=u.match(t.content);if(!o)return N.createElement("span",{style:s,key:e,className:n},t.content);const c=[t.content.substring(0,(r=o[0])===null||r===void 0?void 0:r.index)];return o.forEach((l,i)=>{var g;c.push(N.createElement("a",{href:l.url,target:"_blank",key:i},t.content.substring(l.index,l.lastIndex))),o[i+1]&&c.push(t.content.substring(o[i].lastIndex,(g=o[i+1])===null||g===void 0?void 0:g.index))}),o[o.length-1].lastIndex!==t.content.length&&c.push(t.content.substring(o[o.length-1].lastIndex,t.content.length)),N.createElement("span",{style:s,key:e,className:n},c)}function At(t){const{className:e,useClasses:s,children:n,linkify:r}=t;return N.createElement("code",{className:e},Ft(n??"",s??!1).map(yt.bind(null,r??!1,s??!1)))}function jt(t){let e=t;do t=e,e=t.replace(/[^\n]\x08/gm,"");while(e.length<t.length);return t}function zt(t){return/^\[(ERROR|FATAL)\]/.test(t)||/^ERROR\b/.test(t)?"text-destructive":/^\[(WARN|WARNING)\]/.test(t)||/^WARN(ING)?\b/.test(t)?"text-warning":/^\[DEBUG\]/.test(t)||/^DEBUG\b/.test(t)?"text-info":/^\[(INFO|DOWNLOAD|PROGRESS)\]/.test(t)||/^INFO\b/.test(t)?"text-success":"text-terminal-fg"}function de(t){const e=Ye({start:0,end:t}),s=e.hours??0,n=e.minutes??0,r=e.seconds??0;return s===0&&n===0?`${r}s`:s===0?`${n}m${r}s`:`${s}h${n}m`}function wt({selected:t,onSelect:e}){const s=typeof e=="function",[n,r]=z.useState(null),u=s?t??null:n,o=h=>{s?e(h):r(h)},l=Ae("just:/__just/recipes",()=>fetch("/__just/recipes",{cache:"no-store"}).then(h=>h.json()),{subscribe:"plugin:just:state"}).data??[],[i,g]=z.useState({}),[a,D]=z.useState({}),F=z.useRef(""),[,x]=z.useState(0),y=z.useRef(null),j=u?a[u]??[]:[],{icon:C}=Fe();z.useEffect(()=>{fetch("/__config").then(b=>b.json()).then(b=>{F.current=b.stopToken??""}).catch(()=>{});const h=new EventSource("/__just/logs");let f=!0;h.onopen=()=>{if(f){f=!1;return}D({}),g({})},h.onmessage=b=>{try{const p=JSON.parse(b.data);p.type==="log"?D(v=>{const w=[...v[p.recipe]??[],p.text];return{...v,[p.recipe]:w.length>1e3?w.slice(-1e3):w}}):p.type==="clear"?D(v=>({...v,[p.recipe]:[]})):p.type==="state"&&(g(v=>{var w;return{...v,[p.recipe]:{state:p.state,code:p.code,signal:p.signal,startedAt:p.startedAt??((w=v[p.recipe])==null?void 0:w.startedAt)??Date.now()}}}),p.state==="running"&&!s&&o(p.recipe))}catch{}},h.onerror=()=>{};const m=setInterval(()=>x(b=>b+1),1e3);return()=>{h.close(),clearInterval(m)}},[]),z.useEffect(()=>{y.current&&(y.current.scrollTop=y.current.scrollHeight)},[j.length,u]);const M=(h,f)=>{fetch(`/__just/${h}`,{method:"POST",headers:{"x-stop-token":F.current,"Content-Type":"application/json"},body:JSON.stringify({recipe:f})}).catch(()=>be.error(`just ${h} 动作失败`))},Z=l.map(h=>({...h,task:i[h.name]})),ee=Z.filter(h=>{var f;return((f=h.task)==null?void 0:f.state)==="running"}).length,A=u?i[u]:void 0,q=(A==null?void 0:A.state)==="running",te=(h,f,m)=>h?"bg-success animate-pulse":f?m!=null&&m.signal?"bg-muted-foreground":m!=null&&m.code?"bg-destructive":"bg-success/60":"bg-muted-foreground/30",De={key:"__console__",label:"总控台",badge:_.jsx("span",{className:"font-mono opacity-80",children:ee>0?ee:""}),className:u===null?"":"border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground/40",renderLabel:()=>_.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[_.jsx("span",{className:"h-3 w-3",children:C("monitor","h-3 w-3")}),_.jsx("span",{children:"总控台"})]})},xe=l.map(h=>{const f=i[h.name],m=(f==null?void 0:f.state)==="running",b=(f==null?void 0:f.state)==="exited",p=u===h.name;return{key:h.name,label:h.name,className:p?"":m?"border-success/40 bg-success/10 text-success hover:bg-success/20":"",renderLabel:()=>_.jsxs(_.Fragment,{children:[_.jsx("span",{className:`h-1.5 w-1.5 rounded-[var(--radius-full)] ${te(m,b,f)}`}),_.jsx("span",{children:h.name})]}),renderExtra:()=>b&&!p?_.jsx("span",{className:`text-xs ${f!=null&&f.signal?"opacity-60":f!=null&&f.code?"text-destructive":"text-success"}`,children:f!=null&&f.signal?"停":f==null?void 0:f.code}):void 0}});return _.jsxs("div",{className:"h-full flex flex-col",children:[_.jsx("div",{className:"flex-none flex items-center gap-1.5 flex-wrap px-3 py-2 border-b bg-background",children:_.jsx(Ee,{items:[De,...xe],value:u??"__console__",onChange:h=>o(h==="__console__"?null:h),ariaLabel:"任务筛选"})}),u===null?_.jsxs("div",{className:"flex-1 min-h-0 overflow-auto p-3 grid gap-2.5 grid-cols-1 md:grid-cols-2 xl:grid-cols-3 content-start",children:[Z.length===0&&_.jsx("p",{className:"text-xs text-muted-foreground col-span-full p-4 text-center",children:"未发现 justfile recipes"}),Z.map(h=>{const f=h.task,m=(f==null?void 0:f.state)==="running",b=(f==null?void 0:f.state)==="exited",p=(a[h.name]??[]).slice(-3).map(v=>v.replace(/\r?\n$/,"").replace(/\x1b\[[0-9;]*m/g,""));return _.jsxs("div",{onClick:()=>o(h.name),className:"group rounded-[var(--radius-lg)] border bg-card p-3 cursor-pointer hover:border-muted-foreground/40 transition-colors",children:[_.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[_.jsx("span",{className:`h-2 w-2 rounded-[var(--radius-full)] flex-none ${te(m,b,f)}`}),_.jsx("span",{className:"font-mono font-medium",children:h.name}),m&&_.jsx("span",{className:"text-success font-mono",children:de(Date.now()-f.startedAt)}),b&&_.jsx("span",{className:`font-mono ${f.signal?"text-muted-foreground":f.code?"text-destructive":"text-success"}`,children:f.signal?"已停止":`exit ${f.code}`}),!f&&_.jsx("span",{className:"text-muted-foreground/60",children:"未运行"}),_.jsx("span",{className:"ml-auto flex items-center gap-1",onClick:v=>v.stopPropagation(),children:m?_.jsxs(S,{variant:"ghost",className:"h-6 gap-1 px-2 text-sm",onClick:()=>M("stop",h.name),children:[C("square","h-2.5 w-2.5"),"停止"]}):_.jsxs(S,{variant:"ghost",className:"h-6 gap-1 px-2 text-sm",onClick:()=>M("start",h.name),children:[C(b?"rotate-cw":"play","h-2.5 w-2.5"),b?"重跑":"启动"]})})]}),h.description&&_.jsx("p",{className:"mt-1 text-sm text-muted-foreground/70 truncate",children:h.description}),_.jsx("div",{className:"mt-2 rounded bg-terminal-bg px-2 py-1.5 font-mono text-xs leading-relaxed text-terminal-fg/70 min-h-[3.4em]",children:p.length?p.map((v,w)=>_.jsx("div",{className:"truncate",children:v},w)):_.jsxs("span",{className:"text-terminal-fg/40",children:["$ just ",h.name," …"]})})]},h.name)})]}):_.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[_.jsxs("div",{className:"flex-none flex items-center gap-2 px-3.5 h-8 border-b bg-background text-sm",children:[_.jsx("span",{className:`h-1.5 w-1.5 rounded-[var(--radius-full)] ${q?"bg-success animate-pulse":"bg-muted-foreground"}`}),_.jsx("span",{className:"font-mono font-medium",children:u}),_.jsx("span",{className:"text-muted-foreground font-mono",children:q?`running · ${de(Date.now()-A.startedAt)}`:A!=null&&A.signal?"已停止":A?`exit ${A.code}`:"未运行"}),_.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[q?_.jsxs(S,{variant:"ghost",className:"h-6 gap-1 px-2 text-sm",onClick:()=>M("stop",u),children:[C("square","h-2.5 w-2.5"),"停止"]}):_.jsxs(S,{variant:"ghost",className:"h-6 gap-1 px-2 text-sm",onClick:()=>M("start",u),children:[C("rotate-cw","h-2.5 w-2.5"),A?"重跑":"启动"]}),_.jsxs(S,{variant:"ghost",className:"h-6 gap-1 px-2 text-sm",onClick:()=>M("clear",u),disabled:!j.length,children:[C("eraser","h-2.5 w-2.5"),"清屏"]}),_.jsxs("span",{className:"text-muted-foreground font-mono ml-1",children:[j.length," 行"]})]})]}),_.jsxs("div",{ref:y,className:"flex-1 min-h-0 overflow-auto bg-terminal-bg p-3.5 font-mono text-xs leading-relaxed text-terminal-fg",children:[j.length===0&&_.jsxs("p",{className:"text-terminal-fg/50",children:["$ just ",u," · 等待输出…"]}),j.map((h,f)=>{const m=h.replace(/\r?\n$/,"");return _.jsx("div",{className:"whitespace-pre-wrap break-all min-h-[1.25rem]",children:/\x1b\[/.test(m)?_.jsx(pt,{children:m}):_.jsx("span",{className:zt(m),children:m})},f)})]})]})]})}function St({params:t}){const e=ve(Y.mode,"h-5 w-5"),s=ye(),n=t.get("task")??t.get("recipe");return _.jsx(Ce,{manifest:Y,icon:e,breadcrumb:["插件",Y.mode,...n?[n]:[]],children:_.jsx("div",{className:"mx-auto h-full bg-background border rounded-lg shadow-sm overflow-hidden flex flex-col",children:_.jsx(wt,{selected:n,onSelect:r=>s.navigate(r?{recipe:r,task:null}:{recipe:null,task:null})})})})}export{St as default};
|