@weapp-vite/dashboard 7.5.0 → 7.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -206,7 +206,7 @@ packages/dashboard
206
206
 
207
207
  ## 开发
208
208
 
209
- 源码构建使用的 `weapp-tailwindcss` 需要 Node.js `^22.18.0 || ^24.11.0 || >=26.0.0`。发布包只包含预构建的静态资源,不会把该开发依赖带入用户运行时。
209
+ 仓库源码构建需要 Node.js `^22.23.4 || ^24.22.1 || >=26.12.1`。发布包只包含预构建的静态资源,不会把该开发依赖带入用户运行时。
210
210
 
211
211
  在仓库根目录执行:
212
212
 
@@ -1,7 +1,7 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./monaco.css","./index.css"])))=>i.map(i=>d[i]);
2
2
  import{r as e}from"./rolldown-runtime.js";import{$ as t,A as n,B as r,C as i,D as a,F as o,G as s,H as c,J as l,K as u,L as d,M as f,O as p,P as m,Q as h,R as g,S as _,U as v,V as y,W as b,X as x,Y as S,_ as C,a as w,d as T,f as E,g as D,h as O,j as k,k as A,l as j,m as M,o as N,p as ee,q as P,s as te,t as ne,u as F,v as I,w as L,x as R,y as re}from"./vue.js";import{a as ie,i as ae,n as oe,r as se,s as ce,t as le}from"./monaco.js";import{D as ue,E as de,F as z,N as fe,O as pe,S as B,_ as me,a as he,c as ge,d as _e,f as ve,i as ye,k as be,l as xe,n as Se,o as Ce,r as we,t as Te,u as V,v as Ee,x as H,y as U}from"./index.js";import{a as De,c as W,l as Oe,n as ke,o as Ae,r as je,s as Me,t as G}from"./AppEmptyState.js";import{r as K,t as Ne}from"./AppMetricTile.js";import{a as Pe,c as Fe,d as Ie,f as Le,i as Re,l as ze,n as Be,o as Ve,p as He,r as Ue,s as We,t as Ge,u as Ke}from"./echarts.js";function qe(e){return e.replaceAll(`\\`,`/`).replace(/^\.\//,``).replace(/^\//,``).split(/[?#]/,1)[0]??``}function Je(e,t){let n=qe(t);if(!t.startsWith(`.`))return n;let r=[...qe(e).split(`/`).slice(0,-1),...n.split(`/`)],i=[];for(let e of r)e&&e!==`.`&&(e===`..`?i.pop():i.push(e));return i.join(`/`)}function Ye(e,t,n){return{id:`chunk:${n.file}`,kind:`chunk`,label:n.file,packageId:e,packageLabel:t,size:n.size??0,isEntry:n.isEntry,moduleCount:n.modules?.length??0}}function Xe(e){let t=[],n=new Map,r=new Map,i=[];for(let a of e.packages){let e=a.files.filter(e=>e.type===`chunk`),o={id:`package:${a.id}`,kind:`package`,label:a.label,packageId:a.id,packageLabel:a.label,size:a.files.reduce((e,t)=>e+(t.size??0),0),fileCount:a.files.length};t.push(o);for(let s of e){let e=Ye(a.id,a.label,s);t.push(e),i.push({file:s,node:e}),r.set(qe(s.file),e.id);let c={id:`${o.id}->${e.id}:contains`,kind:`contains`,source:o.id,target:e.id};n.set(c.id,c)}}let a=0,o=0,s=0;for(let{file:e,node:t}of i){let i=[...(e.imports??[]).map(e=>({file:e,kind:`static-import`})),...(e.dynamicImports??[]).map(e=>({file:e,kind:`dynamic-import`}))];for(let c of i){let i=r.get(Je(e.file,c.file));if(!i){a+=1;continue}let l={id:`${t.id}->${i}:${c.kind}`,kind:c.kind,source:t.id,target:i};n.has(l.id)||(n.set(l.id,l),c.kind===`dynamic-import`?s+=1:o+=1)}}return{dynamicImportCount:s,edges:[...n.values()],nodes:t,staticImportCount:o,unresolvedImportCount:a}}function Ze(e,t){let n=e.nodes.filter(e=>e.kind===`package`),r=e.nodes.filter(e=>e.kind===`chunk`),i=t.query.trim().toLowerCase(),a=r.filter(e=>t.packageId===`all`||e.packageId===t.packageId).filter(e=>!i||e.label.toLowerCase().includes(i)).sort((e,t)=>t.size-e.size),o=new Set(a.map(e=>e.id)),s=new Set;for(let t of e.edges){if(t.kind===`contains`)continue;let e=o.has(t.source),n=o.has(t.target);e&&!n?s.add(t.target):n&&!e&&s.add(t.source)}let c=r.filter(e=>s.has(e.id)).sort((e,t)=>t.size-e.size),l=[...new Map([...a,...c].map(e=>[e.id,e])).values()],u=new Set(n.map(e=>e.packageId)),d=[],f=new Set,p=t.maxNodes;for(let e of l){let t=u.has(e.packageId)&&!f.has(e.packageId),n=t?2:1;n>p||(d.push(e),t&&f.add(e.packageId),p-=n)}let m=[...n.filter(e=>f.has(e.packageId)),...d],h=new Set(m.map(e=>e.id)),g=new Set(l.map(e=>e.packageId)),_=new Set([...l.map(e=>e.id),...n.filter(e=>g.has(e.packageId)).map(e=>e.id)]),v=e.edges.filter(e=>_.has(e.source)&&_.has(e.target)),y=e.edges.filter(e=>h.has(e.source)&&h.has(e.target)).sort((e,t)=>Number(e.kind===`contains`)-Number(t.kind===`contains`)).slice(0,t.maxEdges);return{edges:y,nodes:m,truncatedEdgeCount:Math.max(0,v.length-y.length),truncatedNodeCount:Math.max(0,_.size-m.length)}}var Qe={action:`动作`,budget:`预算`,package:`包`,file:`文件`,increment:`增量`,module:`模块`},$e={action:`warning`,budget:`warning`,package:`neutral`,file:`neutral`,module:`neutral`,increment:`info`},et=[{value:`all`,label:`全部`},{value:`action`,label:`动作`},{value:`budget`,label:`预算`},{value:`package`,label:`包`},{value:`file`,label:`文件`},{value:`module`,label:`模块`},{value:`increment`,label:`增量`}];function tt(e,t){let n=u(),r=u(``),i=u(0),a=u(`all`),o=M(()=>{let t=r.value.trim().toLowerCase();return e.items.filter(e=>a.value!==`all`&&e.kind!==a.value?!1:!t||`${e.title} ${e.meta} ${e.value??``} ${e.key} ${e.keywords}`.toLowerCase().includes(t)).slice(0,40)}),s=M(()=>o.value[i.value]??null),c=M(()=>{let t=a.value===`all`?`全部类型`:Qe[a.value];return`匹配 ${o.value.length} / ${e.items.length} 项 · ${t}`});y(()=>e.open,async e=>{e?(await A(),n.value?.focus()):(r.value=``,a.value=`all`,i.value=0)}),y(o,()=>{i.value=0});function l(e){return Qe[e]}function d(e){return Ae({tone:$e[e]})}function f(e){t(`select`,e),t(`close`)}function p(e){if(e.key===`Escape`)e.preventDefault(),t(`close`);else if(e.key===`ArrowDown`)e.preventDefault(),i.value=Math.min(i.value+1,Math.max(o.value.length-1,0));else if(e.key===`ArrowUp`)e.preventDefault(),i.value=Math.max(i.value-1,0);else if(e.key===`Enter`){e.preventDefault();let t=o.value[i.value];t&&f(t)}}return{activeIndex:i,filteredItems:o,getKindLabel:l,getKindTone:d,handleKeydown:p,kindFilter:a,kindOptions:et,query:r,resultSummary:c,searchInputRef:n,selectedItem:s,selectItem:f}}var nt=L({__name:`AnalyzeCommandPalette`,props:{open:{type:Boolean},items:{}},emits:[`close`,`select`],setup(e,{expose:t,emit:n}){t();let r=e,i=n,{activeIndex:a,filteredItems:o,getKindLabel:s,getKindTone:c,handleKeydown:l,kindFilter:u,kindOptions:d,query:f,resultSummary:p,searchInputRef:m,selectedItem:h,selectItem:g}=tt(r,i),_={props:r,emit:i,activeIndex:a,filteredItems:o,getKindLabel:s,getKindTone:c,handleKeydown:l,kindFilter:u,kindOptions:d,query:f,resultSummary:p,searchInputRef:m,selectedItem:h,selectItem:g,AppEmptyState:G,AppSelect:be,DashboardIcon:pe};return Object.defineProperty(_,"__isScriptSetup",{enumerable:!1,value:!0}),_}}),rt={class:`mx-auto grid h-[min(44rem,82vh)] w-full max-w-5xl grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-lg border border-(--dashboard-border-strong) bg-(--dashboard-panel-strong) shadow-2xl`},it={class:`grid gap-3 border-b border-(--dashboard-border) px-4 py-3`},at={class:`flex items-center gap-3`},ot={class:`h-5 w-5 shrink-0 text-(--dashboard-accent)`},st={class:`flex flex-wrap items-center justify-between gap-2`},ct={class:`text-xs text-(--dashboard-text-soft)`},lt={class:`grid min-h-0 gap-2 overflow-hidden p-2 lg:grid-cols-[minmax(0,1fr)_minmax(16rem,0.52fr)]`},ut={key:1,class:`grid max-h-full min-h-0 gap-1 overflow-y-auto pr-1`},dt=[`onMouseenter`,`onClick`],ft={class:`flex items-start justify-between gap-3`},pt={class:`min-w-0`},mt={class:`flex min-w-0 items-center gap-2`},ht={class:`truncate font-medium text-(--dashboard-text)`},gt={class:`mt-1 truncate text-xs text-(--dashboard-text-soft)`},_t={key:0,class:`max-w-36 shrink-0 truncate text-sm font-medium text-(--dashboard-accent)`},vt={class:`grid min-h-0 grid-rows-[auto_minmax(0,1fr)] gap-3 overflow-hidden rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) p-4`},yt={class:`flex items-start justify-between gap-3`},bt={key:1,class:`grid min-h-0 content-start gap-3 overflow-y-auto`},xt={class:`font-medium`},St={class:`mt-1 text-sm leading-6 text-(--dashboard-text-muted)`},Ct={class:`grid gap-2 text-sm`},wt={class:`flex items-center justify-between gap-3 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel) px-3 py-2`},Tt={key:0,class:`flex items-center justify-between gap-3 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel) px-3 py-2`},Et={class:`text-(--dashboard-accent)`};function Dt(e,n,r,i,a,o){return f(),D(ee,{to:`body`},[_(te,{"enter-active-class":`transition duration-150 ease-out`,"enter-from-class":`opacity-0`,"enter-to-class":`opacity-100`,"leave-active-class":`transition duration-100 ease-in`,"leave-from-class":`opacity-100`,"leave-to-class":`opacity-0`},{default:c(()=>[r.open?(f(),I(`div`,{key:0,class:`fixed inset-0 z-[70] grid place-items-start bg-slate-950/45 px-3 py-12 backdrop-blur-sm md:px-6 md:py-[9vh]`,onClick:n[4]||=T(e=>i.emit(`close`),[`self`])},[O(`section`,rt,[O(`div`,it,[O(`div`,at,[O(`span`,ot,[_(i.DashboardIcon,{name:`metric-search`})]),v(O(`input`,{ref:`searchInputRef`,"onUpdate:modelValue":n[0]||=e=>i.query=e,class:`min-w-0 flex-1 bg-transparent text-base outline-none placeholder:text-(--dashboard-text-soft)`,placeholder:`搜索包、文件、模块、预算`,onKeydown:n[1]||=(...e)=>i.handleKeydown&&i.handleKeydown(...e)},null,544),[[j,i.query]])]),O(`div`,st,[O(`p`,ct,t(i.resultSummary),1),_(i.AppSelect,{modelValue:i.kindFilter,"onUpdate:modelValue":n[2]||=e=>i.kindFilter=e,class:`w-40`,label:`筛选搜索结果类型`,options:i.kindOptions,size:`sm`},null,8,[`modelValue`,`options`])])]),O(`div`,lt,[i.filteredItems.length===0?(f(),D(i.AppEmptyState,{key:0,compact:``},{default:c(()=>[...n[5]||=[R(` 没有匹配结果。 `,-1)]]),_:1})):(f(),I(`ul`,ut,[(f(!0),I(E,null,m(i.filteredItems,(e,n)=>(f(),I(`li`,{key:e.key,class:`list-none`},[O(`button`,{type:`button`,class:x([`w-full rounded-md border px-3 py-2.5 text-left transition`,n===i.activeIndex?`border-(--dashboard-accent) bg-(--dashboard-accent-soft)`:`border-transparent hover:border-(--dashboard-border) hover:bg-(--dashboard-panel-muted)`]),onMouseenter:e=>i.activeIndex=n,onClick:t=>i.selectItem(e)},[O(`div`,ft,[O(`div`,pt,[O(`div`,mt,[O(`span`,{class:x(i.getKindTone(e.kind))},t(i.getKindLabel(e.kind)),3),O(`p`,ht,t(e.title),1)]),O(`p`,gt,t(e.meta),1)]),e.value?(f(),I(`span`,_t,t(e.value),1)):C(``,!0)])],42,dt)]))),128))])),O(`aside`,vt,[O(`div`,yt,[n[6]||=O(`div`,null,[O(`p`,{class:`text-[11px] uppercase tracking-[0.2em] text-(--dashboard-accent)`},` Preview `),O(`h3`,{class:`mt-1 text-base font-semibold`},` 当前命令 `)],-1),i.selectedItem?(f(),I(`span`,{key:0,class:x(i.getKindTone(i.selectedItem.kind))},t(i.getKindLabel(i.selectedItem.kind)),3)):C(``,!0)]),i.selectedItem?(f(),I(`div`,bt,[O(`div`,null,[O(`h4`,xt,t(i.selectedItem.title),1),O(`p`,St,t(i.selectedItem.meta),1)]),O(`div`,Ct,[O(`div`,wt,[n[8]||=O(`span`,{class:`text-xs uppercase tracking-[0.16em] text-(--dashboard-text-soft)`},`Tab`,-1),O(`strong`,null,t(i.selectedItem.tab),1)]),i.selectedItem.value?(f(),I(`div`,Tt,[n[9]||=O(`span`,{class:`text-xs uppercase tracking-[0.16em] text-(--dashboard-text-soft)`},`Value`,-1),O(`strong`,Et,t(i.selectedItem.value),1)])):C(``,!0)]),O(`button`,{type:`button`,class:`inline-flex h-9 items-center justify-center rounded-md border border-(--dashboard-border) bg-(--dashboard-panel) px-3 text-sm font-medium text-(--dashboard-text) transition hover:border-(--dashboard-border-strong) hover:text-(--dashboard-accent) focus:border-(--dashboard-border-strong) focus:outline-none`,onClick:n[3]||=e=>i.selectItem(i.selectedItem)},` 跳转到结果 `)])):(f(),D(i.AppEmptyState,{key:0,compact:``},{default:c(()=>[...n[7]||=[R(` 选择左侧结果后查看目标和跳转位置。 `,-1)]]),_:1}))])])])])):C(``,!0)]),_:1})])}var Ot=z(nt,[[`render`,Dt]]),kt=L({__name:`AnalyzeEmptyPayloadPanel`,setup(e,{expose:t}){t();let n={get RouterLink(){return ne},AppSurfaceCard:ke};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),At={class:`grid gap-3 xl:grid-cols-[minmax(0,1fr)_minmax(18rem,0.92fr)]`},jt={class:`rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) p-4`},Mt={class:`mt-4 grid gap-2`},Nt={class:`grid gap-2`};function Pt(e,n,r,i,a,o){return f(),D(i.AppSurfaceCard,{eyebrow:`Analyze`,title:`等待分析数据注入`,"icon-name":`hero-commands`,tone:`strong`,padding:`header`},{default:c(()=>[O(`div`,At,[O(`div`,jt,[n[0]||=O(`p`,{class:`text-[11px] uppercase tracking-[0.24em] text-(--dashboard-text-soft)`},` recommended commands `,-1),O(`div`,Mt,[(f(),I(E,null,m([`weapp-vite analyze`,`weapp-vite build --ui`,`weapp-vite dev --ui`],e=>O(`code`,{key:e,class:`rounded-md bg-slate-950 px-3 py-3 text-xs text-slate-100 dark:bg-slate-900`},t(e),1)),64))])]),O(`div`,Nt,[_(i.RouterLink,{class:`rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-4 py-4 transition hover:border-(--dashboard-border-strong) hover:bg-(--dashboard-panel)`,to:`/`},{default:c(()=>[...n[1]||=[O(`p`,{class:`font-medium`},` 返回工作台 `,-1),O(`p`,{class:`mt-1 text-sm leading-6 text-(--dashboard-text-muted)`},` 查看当前状态和命令。 `,-1)]]),_:1}),_(i.RouterLink,{class:`rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-4 py-4 transition hover:border-(--dashboard-border-strong) hover:bg-(--dashboard-panel)`,to:`/activity`},{default:c(()=>[...n[2]||=[O(`p`,{class:`font-medium`},` 查看活动流 `,-1),O(`p`,{class:`mt-1 text-sm leading-6 text-(--dashboard-text-muted)`},` 观察命令、构建、HMR 和诊断事件。 `,-1)]]),_:1})])])]),_:1})}var Ft=z(kt,[[`render`,Pt]]);function It(e){return Math.max(0,Math.min(100,Math.round(e)))}function Lt(e){return e===`blocked`?`Blocked`:e===`review`?`Review`:`Ready`}function Rt(e){return e===`blocked`?`发布前需要先处理阻断项`:e===`review`?`建议评审后再发布`:`当前分析未发现阻断项`}function zt(e){let t=[];for(let n of[...e.criticalActions,...e.warningActions].slice(0,3))t.push(`${n.title}:${n.meta}`);return t.length===0&&e.largestPackage&&t.push(`持续关注最大包 ${e.largestPackage.label},当前 ${U(e.largestPackage.totalBytes)}。`),t.length===0&&e.largestFile&&t.push(`持续关注最大文件 ${e.largestFile.file},当前 ${U(e.largestFile.size)}。`),t}function Bt(e){return[`# dashboard 发布门禁`,``,`状态:${e.label}`,`风险分:${e.score}`,e.headline,``,`## 指标`,``,...e.metrics.map(e=>`- ${e.label}:${e.value}`),``,`## 建议`,``,...e.recommendations.length>0?e.recommendations.map(e=>`- ${e}`):[`- 当前没有需要立即处理的事项。`],``].join(`
3
3
  `)}function Vt(e){let t=e.actionItems.filter(e=>e.tone===`critical`),n=e.actionItems.filter(e=>e.tone===`warning`),r=e.largestFiles[0],i=e.packageInsights[0],a=t.length>0?`blocked`:n.length>0?`review`:`ready`,o=It(100-t.length*28-n.length*12),s=[{label:`阻断项`,value:t.length},{label:`建议项`,value:n.length},{label:`最大包`,value:i?U(i.totalBytes):`—`},{label:`最大文件`,value:r?U(r.size):`—`}],c={status:a,label:Lt(a),score:o,headline:Rt(a),description:`${e.actionItems.length} 个候选事项 · ${e.packageInsights.length} 个包 · ${e.largestFiles.length} 个文件样本`,metrics:s,recommendations:zt({criticalActions:t,warningActions:n,largestFile:r,largestPackage:i})};return{...c,report:Bt(c)}}function Ht(e=1800){let t=u(``),r=null;function i(n){t.value=n,r&&clearTimeout(r),r=setTimeout(()=>{t.value=``,r=null},e)}return n(()=>{r&&clearTimeout(r)}),{actionStatus:t,setActionStatus:i}}function Ut(e){let t=M(()=>e.packageInsights.reduce((e,t)=>e+t.totalBytes,0)),n=M(()=>e.packageInsights.length>0?U(t.value):`—`),r=M(()=>{let t=e.actionItems.filter(e=>e.kind===`budget`),n=t.filter(e=>e.measurementUnknown||e.warning?.status===`unknown`).length;return n>0?`预算告警 ${t.length} 项 · ${n} 项测量待确认`:t.length>0?`预算告警 ${t.length} 项`:e.packageInsights.length>0?`未发现预算告警`:`预算暂无数据`}),i=M(()=>Vt({actionItems:e.actionItems,largestFiles:e.largestFiles,packageInsights:e.packageInsights})),{actionStatus:a,setActionStatus:o}=Ht(),s=M(()=>e.packageInsights.map(e=>{let n=t.value>0?e.totalBytes/t.value*100:0;return{...e,typeLabel:B(e.type),sizeLabel:U(e.totalBytes),compressedLabel:`${e.compressedSizeSource===`real`?`Brotli`:`估算`} ${U(e.compressedBytes)}`,deltaLabel:typeof e.sizeDeltaBytes==`number`?`较基线 ${e.sizeDeltaBytes>=0?`+`:`−`}${U(Math.abs(e.sizeDeltaBytes))}`:``,shareStyle:{width:`${n}%`}}}).sort((e,t)=>t.totalBytes-e.totalBytes)),c=M(()=>s.value.slice(0,3));async function l(){try{await W(i.value.report),o(`已复制`)}catch{o(`复制失败`)}}return{budgetSummary:r,copyReleaseGateReport:l,gateCopyStatus:a,packageOverviewItems:s,packagePreviewItems:c,releaseGate:i,totalPackageBytesLabel:n}}var Wt=L({__name:`AnalyzeBuildSummary`,props:{actionItems:{},cards:{},largestFiles:{},packageInsights:{},packageTypeSummary:{}},emits:[`copyReport`,`selectFile`,`selectPackage`],setup(e,{expose:t,emit:n}){t();let r=e,i=n,{budgetSummary:a,copyReleaseGateReport:o,gateCopyStatus:s,packageOverviewItems:c,packagePreviewItems:l,releaseGate:u,totalPackageBytesLabel:d}=Ut(r),f=P(!1);function p(e){f.value=e.target.open}let m={props:r,emit:i,budgetSummary:a,copyReleaseGateReport:o,gateCopyStatus:s,packageOverviewItems:c,packagePreviewItems:l,releaseGate:u,totalPackageBytesLabel:d,detailsOpen:f,handleDetailsToggle:p,get formatBytes(){return U},get formatPackageType(){return B},DashboardIcon:pe};return Object.defineProperty(m,"__isScriptSetup",{enumerable:!1,value:!0}),m}}),Gt={class:`grid min-w-0 content-start gap-2`},Kt={class:`flex min-w-0 flex-wrap items-baseline justify-between gap-x-2 gap-y-0.5`},qt={class:`text-xl font-semibold leading-7 tabular-nums text-(--dashboard-text)`},Jt={class:`w-full text-xs leading-4 text-(--dashboard-text-muted)`},Yt={class:`min-w-0`},Xt={class:`text-xs leading-4 text-(--dashboard-text-soft)`},Zt={key:0,class:`mt-2 text-sm text-(--dashboard-text-soft)`},Qt={key:1,class:`mt-1 grid min-w-0`},$t=[`aria-label`,`onClick`],en={class:`flex min-w-0 items-baseline justify-between gap-2 text-xs leading-4`},tn=[`title`],nn={class:`shrink-0 tabular-nums text-(--dashboard-text-muted)`},rn={class:`mt-1 block h-1 overflow-hidden rounded-full bg-(--dashboard-panel-muted)`,"aria-hidden":`true`},an={class:`flex min-h-9 cursor-pointer list-none items-center justify-between gap-2 rounded-sm py-1.5 text-xs font-medium text-(--dashboard-text-muted) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--dashboard-accent) pointer-coarse:min-h-11`},on={class:`min-w-0`},sn={key:0,class:`grid min-w-0 gap-5 pt-2 pb-4`},cn={class:`min-w-0`},ln={class:`mt-2 text-xs leading-5 text-(--dashboard-text-soft)`},un={class:`mt-2 grid gap-2 text-sm`},dn={class:`flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`},fn={class:`font-semibold tabular-nums text-(--dashboard-text)`},pn={class:`text-(--dashboard-text-soft)`},mn={class:`font-semibold tabular-nums text-(--dashboard-text)`},hn={key:0,class:`mt-2 grid gap-2 text-sm leading-6 text-(--dashboard-text-muted)`},gn={class:`min-w-0`},_n={class:`mt-2 grid gap-3 text-sm`},vn={class:`text-(--dashboard-text-soft)`},yn={class:`font-semibold tabular-nums text-(--dashboard-text)`},bn={key:0,class:`w-full text-xs leading-5 text-(--dashboard-text-muted)`},xn={key:0,class:`mt-3 flex flex-wrap gap-x-3 gap-y-1 text-xs leading-5 text-(--dashboard-text-soft)`},Sn={class:`min-w-0`},Cn={key:0,class:`mt-2 text-sm leading-6 text-(--dashboard-text-soft)`},wn={key:1,class:`mt-2 divide-y divide-(--dashboard-border)`},Tn=[`aria-label`,`onClick`],En={class:`block text-sm font-semibold leading-6 text-(--dashboard-text) [overflow-wrap:anywhere]`},Dn={class:`block text-xs leading-5 text-(--dashboard-text-soft)`},On={class:`mt-1 flex flex-wrap gap-x-3 gap-y-1 text-sm leading-6 tabular-nums`},kn={class:`font-semibold text-(--dashboard-text)`},An={class:`text-(--dashboard-text-soft)`},jn={class:`block text-xs leading-5 tabular-nums text-(--dashboard-text-soft)`},Mn={class:`min-w-0`},Nn={key:0,class:`mt-2 text-sm leading-6 text-(--dashboard-text-soft)`},Pn={key:1,class:`mt-2 divide-y divide-(--dashboard-border)`},Fn=[`aria-label`,`onClick`],In={class:`block font-mono text-sm font-medium leading-6 text-(--dashboard-text) [overflow-wrap:anywhere]`},Ln={class:`mt-1 block text-xs leading-5 text-(--dashboard-text-soft) [overflow-wrap:anywhere]`},Rn={class:`mt-1 flex flex-wrap gap-x-3 gap-y-1 text-sm leading-6 tabular-nums`},zn={class:`font-semibold text-(--dashboard-text)`},Bn={class:`text-(--dashboard-text-soft)`},Vn={class:`grid min-w-0 gap-2 border-t border-(--dashboard-border) pt-3`},Hn={class:`size-4 shrink-0`,"aria-hidden":`true`},Un={role:`status`,class:`text-xs leading-5 text-(--dashboard-accent)`},Wn={class:`size-4 shrink-0`,"aria-hidden":`true`};function Gn(e,n,r,i,a,o){return f(),I(`section`,Gt,[O(`header`,Kt,[n[2]||=O(`h2`,{class:`text-xs font-medium text-(--dashboard-text-soft)`},`总产物体积`,-1),O(`p`,qt,t(i.totalPackageBytesLabel),1),O(`p`,Jt,t(i.budgetSummary),1)]),O(`figure`,Yt,[O(`figcaption`,Xt,` 包体占比 · 前 `+t(i.packagePreviewItems.length)+` 包 · 满格 = 总量 `,1),i.packagePreviewItems.length===0?(f(),I(`p`,Zt,` 当前没有包体数据。 `)):(f(),I(`ol`,Qt,[(f(!0),I(E,null,m(i.packagePreviewItems,e=>(f(),I(`li`,{key:e.id,class:`min-w-0`},[O(`button`,{type:`button`,class:`block min-h-8 w-full min-w-0 rounded-sm py-1 text-left hover:bg-(--dashboard-panel-muted) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--dashboard-accent) pointer-coarse:min-h-11`,"aria-label":`查看包 ${e.label} 的详情,${e.sizeLabel}`,onClick:t=>i.emit(`selectPackage`,e)},[O(`span`,en,[O(`span`,{title:e.label,class:`min-w-0 truncate font-medium text-(--dashboard-text)`},t(e.label),9,tn),O(`span`,nn,t(e.sizeLabel),1)]),O(`span`,rn,[O(`span`,{class:`block h-full rounded-full bg-(--dashboard-accent)`,style:h(e.shareStyle)},null,4)])],8,$t)]))),128))]))]),O(`details`,{class:`group min-w-0 border-t border-(--dashboard-border)`,onToggle:i.handleDetailsToggle},[O(`summary`,an,[O(`span`,on,`全部 `+t(r.packageInsights.length)+` 包与构建明细`,1),n[3]||=O(`span`,{class:`icon-[mdi--chevron-down] size-4 shrink-0 group-open:rotate-180`,"aria-hidden":`true`},null,-1)]),i.detailsOpen?(f(),I(`div`,sn,[O(`section`,cn,[n[5]||=O(`h3`,{class:`text-sm font-semibold text-(--dashboard-text)`},`评分与分析依据`,-1),O(`p`,ln,t(i.releaseGate.description),1),O(`dl`,un,[O(`div`,dn,[n[4]||=O(`dt`,{class:`text-(--dashboard-text-soft)`},`分析评分`,-1),O(`dd`,fn,t(i.releaseGate.score)+` / 100`,1)]),(f(!0),I(E,null,m(i.releaseGate.metrics,e=>(f(),I(`div`,{key:e.label,class:`flex min-w-0 flex-wrap items-baseline justify-between gap-x-3 gap-y-1`},[O(`dt`,pn,t(e.label),1),O(`dd`,mn,t(e.value),1)]))),128))]),n[6]||=O(`p`,{class:`mt-2 text-xs leading-5 text-(--dashboard-text-soft)`},`仅基于当前分析,不代表发布审批。`,-1),i.releaseGate.recommendations.length>0?(f(),I(`ul`,hn,[(f(!0),I(E,null,m(i.releaseGate.recommendations,e=>(f(),I(`li`,{key:e},t(e),1))),128))])):C(``,!0)]),O(`section`,gn,[n[7]||=O(`h3`,{class:`text-sm font-semibold text-(--dashboard-text)`},`全部指标`,-1),O(`dl`,_n,[(f(!0),I(E,null,m(r.cards,e=>(f(),I(`div`,{key:e.label,class:`flex min-w-0 flex-wrap items-baseline justify-between gap-x-3 gap-y-1`},[O(`dt`,vn,t(e.label),1),O(`dd`,yn,t(e.value),1),e.detail?(f(),I(`dd`,bn,t(e.detail),1)):C(``,!0)]))),128))]),r.packageTypeSummary.length>0?(f(),I(`p`,xn,[(f(!0),I(E,null,m(r.packageTypeSummary,e=>(f(),I(`span`,{key:e.label},t(i.formatPackageType(e.label))+` `+t(e.value),1))),128))])):C(``,!0)]),O(`section`,Sn,[n[9]||=O(`h3`,{class:`text-sm font-semibold text-(--dashboard-text)`},`全部包体`,-1),i.packageOverviewItems.length===0?(f(),I(`p`,Cn,`当前没有包体数据。`)):(f(),I(`ol`,wn,[(f(!0),I(E,null,m(i.packageOverviewItems,e=>(f(),I(`li`,{key:e.id,class:`min-w-0`},[O(`button`,{type:`button`,class:`w-full min-w-0 rounded-sm py-3 text-left hover:bg-(--dashboard-panel-muted) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--dashboard-accent)`,"aria-label":`查看包 ${e.label} 的详情`,onClick:t=>i.emit(`selectPackage`,e)},[O(`span`,En,t(e.label),1),O(`span`,Dn,t(e.typeLabel)+` · `+t(e.fileCount)+` 产物 · `+t(e.moduleCount)+` 模块 `,1),O(`span`,On,[O(`span`,kn,t(e.sizeLabel),1),O(`span`,An,t(e.compressedLabel),1)]),O(`span`,jn,t(e.deltaLabel||`无可比基线`),1),n[8]||=O(`span`,{class:`mt-1 block text-xs leading-5 text-(--dashboard-accent)`},`查看包详情 →`,-1)],8,Tn)]))),128))]))]),O(`section`,Mn,[n[11]||=O(`h3`,{class:`text-sm font-semibold text-(--dashboard-text)`},`文件体积排行`,-1),r.largestFiles.length===0?(f(),I(`p`,Nn,`当前没有文件体积数据。`)):(f(),I(`ol`,Pn,[(f(!0),I(E,null,m(r.largestFiles,e=>(f(),I(`li`,{key:`${e.packageId}:${e.file}`,class:`min-w-0`},[O(`button`,{type:`button`,class:`w-full min-w-0 rounded-sm py-3 text-left hover:bg-(--dashboard-panel-muted) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--dashboard-accent)`,"aria-label":`查看文件 ${e.file} 的详情`,onClick:t=>i.emit(`selectFile`,e)},[O(`span`,In,t(e.file),1),O(`span`,Ln,t(e.packageLabel)+` · `+t(e.type)+` · `+t(e.moduleCount)+` 模块 `,1),O(`span`,Rn,[O(`span`,zn,t(i.formatBytes(e.size)),1),O(`span`,Bn,t(e.compressedSizeSource===`real`?`Brotli`:`估算压缩`)+` `+t(i.formatBytes(e.compressedSize)),1)]),n[10]||=O(`span`,{class:`mt-1 block text-xs leading-5 text-(--dashboard-accent)`},`查看文件详情 →`,-1)],8,Fn)]))),128))]))]),O(`div`,Vn,[O(`button`,{type:`button`,class:`inline-flex min-h-11 items-center justify-center gap-2 rounded-md border border-(--dashboard-border) px-2 py-2 text-sm text-(--dashboard-text-muted) hover:bg-(--dashboard-panel-muted) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--dashboard-accent)`,onClick:n[0]||=(...e)=>i.copyReleaseGateReport&&i.copyReleaseGateReport(...e)},[O(`span`,Hn,[_(i.DashboardIcon,{name:`metric-copy`})]),n[12]||=R(` 复制构建结论 `,-1)]),O(`span`,Un,t(i.gateCopyStatus),1),O(`button`,{type:`button`,class:`inline-flex min-h-11 items-center justify-center gap-2 rounded-md border border-(--dashboard-border) px-2 py-2 text-sm text-(--dashboard-text-muted) hover:bg-(--dashboard-panel-muted) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--dashboard-accent)`,onClick:n[1]||=e=>i.emit(`copyReport`)},[O(`span`,Wn,[_(i.DashboardIcon,{name:`metric-copy`})]),n[13]||=R(` 复制评审摘要 `,-1)])])])):C(``,!0)],32)])}var Kn=z(Wt,[[`render`,Gn]]);function qn(e){return e===`runtime`||e===`reactivity`||e===`host`||e===`helper`}var Jn={totalBytes:20971520,mainBytes:2097152,subPackageBytes:2097152,independentBytes:2097152,warningRatio:.85,source:`default`};function Yn(e){let t=e.metadata?.budgets??Jn,n=(e,n=!1)=>{let r=e.limitBytes>0?e.currentBytes/e.limitBytes:+(e.currentBytes>0);return{...e,ratio:r,status:n?`unknown`:r>=1?`exceeded`:r>=t.warningRatio?`warning`:`ok`}},r=e.packages.flatMap(e=>e.files),i=new Map(r.map(e=>[e.file,e])),a=e=>e.some(e=>typeof e.size!=`number`||!Number.isFinite(e.size)||e.size<0),o=[n({id:`__total__`,label:`总包`,scope:`total`,currentBytes:[...i.values()].reduce((e,t)=>e+(t.size??0),0),limitBytes:t.totalBytes,measurement:`file-bytes`,files:[...i.keys()].sort()},a(r))];for(let r of e.packages){let e=t.packageBytes?.[r.id]??(r.type===`main`?t.mainBytes:r.type===`subPackage`?t.subPackageBytes:r.type===`independent`?t.independentBytes:void 0);e!==void 0&&o.push(n({id:r.id,label:r.label,scope:r.type,currentBytes:r.files.reduce((e,t)=>e+(t.size??0),0),limitBytes:e,measurement:`file-bytes`,files:r.files.map(e=>e.file).sort()},a(r.files)))}if(t.runtimeBytes!==void 0){let i=e.artifacts;o.push(n({id:`__runtime__`,label:`Runtime(含混合 chunk 的文件上界)`,scope:`runtime`,currentBytes:i?.runtime.upperBoundBytes??0,limitBytes:t.runtimeBytes,measurement:i?`upper-bound`:`unavailable`,files:i?.files.filter(e=>i.runtime.unknownFiles.includes(e.file)||e.modules.some(e=>qn(e.category))).map(e=>e.file)??r.filter(e=>e.type===`chunk`||/\.[cm]?js$/i.test(e.file)).map(e=>e.file)},!i||i.runtime.unknownFiles.length>0))}return o.sort((e,t)=>t.ratio-e.ratio||e.label.localeCompare(t.label))}function Xn(e,t){let n=t===`node_modules`||t===`workspace`?`dependency`:t,r=e.indexOf(`?`),i=(r===-1?e:e.slice(0,r)).replaceAll(`\\`,`/`).replace(/^\0/,``);if(n===`dependency`){let e=i.lastIndexOf(`/node_modules/`);e>=0?i=i.slice(e+14):i.startsWith(`node_modules/`)?i=i.slice(13):t===`workspace`&&(i=(i.match(/(?:^|\/)packages-runtime\/(wevu\/.*)$/)??i.match(/(?:^|\/)(@[^/]+\/[^/]+\/dist\/.*)$/))?.[1]??i)}return`${n}\0${i}`}function Zn(e,t){return e.includes(`wevu`)||e.includes(`@weapp-vite/dashboard`)?`WeVu / runtime`:t===`node_modules`||e.includes(`node_modules`)?`第三方依赖`:t===`workspace`?`工作区包`:t===`plugin`?`插件生成`:e.endsWith(`.wxss`)||e.endsWith(`.css`)||e.endsWith(`.scss`)?`样式资源`:e.endsWith(`.wxml`)||e.endsWith(`.json`)?`页面结构`:`业务源码`}function Qn(e,t){return t===`unmeasured`?`缺少体积测量,不能判断增长或缩小。`:t===`removed`||t===`decreased`?`确认体积减少符合预期,检查受影响页面与依赖边界。`:e===`第三方依赖`?`检查依赖边界或公共入口。`:e===`WeVu / runtime`?`排查组件和 API 引用边界。`:e===`样式资源`?`检查样式复用和生成范围。`:t===`added`?`确认分包归属和懒加载边界。`:`对比新增引用和共享模块。`}function $n(e){let t=new Map,n=new Map,r=new Map,i=0,a=0;for(let o of e.packages){let e=0,s=0;for(let t of o.files){let i=t.size??null;i===null?s+=1:e+=i;let a=`file:${o.id}\0${t.file}`;n.set(a,{key:a,label:t.file,bytes:i,packageId:o.id,packageLabel:o.label,file:t.file,category:Zn(t.source??t.file)});for(let e of t.modules??[]){let n=e.bytes??e.originalBytes??null,i=r.get(e.id);if(i){i.bytes=i.bytes===null||n===null?null:Math.max(i.bytes,n);continue}let a=e.source.indexOf(`?`);r.set(e.id,{key:`module:${Xn(e.source,e.sourceType)}`,label:e.source,bytes:n,moduleId:e.id,sourceType:e.sourceType,packageId:o.id,packageLabel:o.label,file:t.file,category:Zn(a===-1?e.source:e.source.slice(0,a),e.sourceType)})}}i+=e,a+=s;let c=`package:${o.id}`;t.set(c,{key:c,label:o.label,bytes:s>0?null:e,packageId:o.id,packageLabel:o.label})}let o=new Map;for(let e of r.values()){let t=o.get(e.key);t?t.bytes===null||e.bytes===null?t.bytes=null:t.bytes<e.bytes&&o.set(e.key,e):o.set(e.key,e)}return{packages:t,files:n,modules:o,totalBytes:a>0?null:i,unmeasuredFiles:a}}function er(e,t){let n=[],r=(e,t,r,i)=>{n.push({key:e.key,label:e.label,packageId:e.packageId,packageLabel:e.packageLabel,file:e.file,moduleId:e.moduleId,sourceType:e.sourceType,category:e.category,change:i,currentBytes:t,previousBytes:r,deltaBytes:t===null||r===null?null:t-r,advice:e.category?Qn(e.category,i):void 0})};for(let[n,i]of e){let e=t.get(n);e?i.bytes===null||e.bytes===null?r(i,i.bytes,e.bytes,`unmeasured`):i.bytes!==e.bytes&&r(i,i.bytes,e.bytes,i.bytes>e.bytes?`increased`:`decreased`):r(i,i.bytes,0,`added`)}for(let[n,i]of t)e.has(n)||r(i,0,i.bytes,`removed`);return n.sort((e,t)=>(t.deltaBytes??-1/0)-(e.deltaBytes??-1/0)||e.key.localeCompare(t.key))}function tr(e,t){let n=$n(e),r=$n(t);return{currentBytes:n.totalBytes,previousBytes:r.totalBytes,deltaBytes:n.totalBytes===null||r.totalBytes===null?null:n.totalBytes-r.totalBytes,currentUnmeasuredFiles:n.unmeasuredFiles,previousUnmeasuredFiles:r.unmeasuredFiles,packages:er(n.packages,r.packages),files:er(n.files,r.files),modules:er(n.modules,r.modules)}}function nr(e){let t=new Map;for(let n of e.packages)for(let e of n.files)for(let n of e.modules??[])t.set(n.id,Math.max(t.get(n.id)??0,n.bytes??n.originalBytes??0));return t}function rr(e,t,n){return t?n>0?`含独立分包,先确认隔离要求,再评估是否抽公共入口。`:`含独立分包,重复可能来自隔离边界。`:e===`node_modules`?`依赖被多个包带入,检查引用边界或考虑主包公共入口。`:e===`src`||e===`workspace`?`共享源码跨包重复,优先抽公共模块或调整分包归属。`:e===`plugin`?`插件生成内容跨包重复,检查插件产物输出策略。`:`检查该模块是否需要在多个包内重复存在。`}function ir(e){let t=nr(e),n=new Map(e.packages.map(e=>[e.id,e.type]));return e.modules.filter(e=>e.packages.length>1).map(e=>{let r=t.get(e.id)??0,i=e.packages.map(e=>e.packageId),a=r*(i.length-1),o=i.some(e=>n.get(e)===`independent`);return{id:e.id,source:e.source,sourceType:e.sourceType,packageCount:i.length,bytes:r,estimatedSavingBytes:a,packages:i,hasIndependentPackage:o,advice:rr(e.sourceType,o,a)}}).sort((e,t)=>t.estimatedSavingBytes-e.estimatedSavingBytes||t.packageCount-e.packageCount||t.bytes-e.bytes||e.source.localeCompare(t.source)||e.id.localeCompare(t.id))}function q(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:null}function ar(e,t,n){let r=e.modules.find(e=>e.id===t);if(!r||r.packages.length<=1)return 0;for(let n of r.packages){let r=e.packages.find(e=>e.id===n.packageId);if(!r||n.files.length===0)return null;for(let e of n.files){let n=r.files.find(t=>t.file===e)?.modules?.find(e=>e.id===t);if(q(n?.bytes??n?.originalBytes)===null)return null}}return q(n)}function or(e,t){return{packageId:t.packageId,packageLabel:e.get(t.packageId)??t.packageId,files:t.files}}function sr(e,t){return e.includes(`wevu`)||e.includes(`@weapp-vite/dashboard`)?`wevu / dashboard runtime`:t===`node_modules`?`第三方依赖`:t===`plugin`?`插件生成`:t===`workspace`?`工作区包`:e.startsWith(`pages/`)||e.includes(`/pages/`)?`业务页面`:e.startsWith(`components/`)||e.includes(`/components/`)?`业务组件`:e.startsWith(`shared/`)||e.includes(`/shared/`)||e.includes(`/utils/`)?`业务共享`:`业务源码`}function cr(e,t){return{sourceType:e,sourceCategory:t,count:0,bytes:0}}function lr(e){if(!e.result)return[];let t=new Map(e.result.modules.map(e=>[e.id,e]));return ir(e.result).map(n=>{let r=t.get(n.id);return{...n,source:H(n.source),packages:r.packages.map(t=>or(e.packageLabelMap,t))}})}function ur(e,t){let n=new Map;for(let r of e?.modules??[]){let e=t.get(r.id),i=sr(r.source,r.sourceType),a=`${r.sourceType}:${i}`,o=n.get(a)??cr(r.sourceType,i);o.count+=1,o.bytes+=e?.bytes??e?.originalBytes??0,n.set(a,o)}return[...n.values()].sort((e,t)=>t.bytes-e.bytes||t.count-e.count||e.sourceCategory.localeCompare(t.sourceCategory))}function dr(e){return e.size??0}function fr(e){return e.brotliSize??e.gzipSize??me(dr(e),e.file,e.type)}function pr(e){return typeof e.brotliSize==`number`||typeof e.gzipSize==`number`?`real`:`estimated`}function mr(e,t){return`${e}\u0000${t}`}function hr(e){let t=new Map,n=new Map,r=0,i=0;for(let a of e?.packages??[]){let e=0;for(let t of a.files){let o=dr(t);e+=o,r+=o,i+=fr(t),n.set(mr(a.id,t.file),o)}t.set(a.id,e)}return{packageBytes:t,fileBytes:n,totalBytes:r,compressedBytes:i}}function gr(e){let t=new Map;for(let n of e?.packages??[])for(let e of n.files)for(let n of e.modules??[]){let e=t.get(n.id),r=n.bytes??0,i=n.originalBytes??r;e?t.set(n.id,{bytes:Math.max(e.bytes,r),originalBytes:Math.max(e.originalBytes,i),sourceType:e.sourceType}):t.set(n.id,{bytes:r,originalBytes:i,sourceType:n.sourceType})}return t}function _r(e,t){return{label:e,value:t}}function vr(e,t,n){let r=dr(t),i=n.get(mr(e.id,t.file));return{packageId:e.id,packageLabel:e.label,packageType:e.type,file:t.file,size:r,gzipSize:t.gzipSize,brotliSize:t.brotliSize,compressedSize:fr(t),compressedSizeSource:pr(t),sizeDeltaBytes:typeof i==`number`?r-i:void 0,type:t.type,from:t.from,isEntry:!!t.isEntry,moduleCount:t.modules?.length??0,modules:t.modules,source:t.source}}function yr(e,t,n){let r=dr(t),i=n.get(mr(e,t.file));return{file:t.file,size:r,gzipSize:t.gzipSize,brotliSize:t.brotliSize,compressedSize:fr(t),compressedSizeSource:pr(t),sizeDeltaBytes:typeof i==`number`?r-i:void 0,type:t.type,from:t.from,isEntry:!!t.isEntry,moduleCount:t.modules?.length??0}}function br(e){if(!e.result)return{packageCount:0,moduleCount:0,duplicateCount:0,totalBytes:0,gzipBytes:0,brotliBytes:0,estimatedCompressedBytes:0,compressedBytes:0,compressedSizeSource:`estimated`,subpackageCount:0,entryCount:0,budgetWarningCount:0};let t=e.result.packages.flatMap(e=>e.files),n=t.reduce((e,t)=>e+dr(t),0),r=t.reduce((e,t)=>e+(t.gzipSize??0),0),i=t.reduce((e,t)=>e+(t.brotliSize??0),0),a=t.reduce((e,t)=>e+me(dr(t),t.file,t.type),0),o=t.some(e=>typeof e.gzipSize==`number`||typeof e.brotliSize==`number`),s=o?t.reduce((e,t)=>e+fr(t),0):a;return{packageCount:e.result.packages.length,moduleCount:e.result.modules.length,duplicateCount:e.result.modules.filter(e=>e.packages.length>1).length,totalBytes:n,gzipBytes:r,brotliBytes:i,estimatedCompressedBytes:a,compressedBytes:s,compressedSizeSource:o?`real`:`estimated`,sizeDeltaBytes:e.previousMaps.totalBytes>0?n-e.previousMaps.totalBytes:void 0,compressedDeltaBytes:e.previousMaps.compressedBytes>0?s-e.previousMaps.compressedBytes:void 0,subpackageCount:e.result.subPackages.length,entryCount:t.filter(e=>e.isEntry).length,budgetWarningCount:e.budgetWarnings.length}}function xr(e){let t=new Map;for(let n of e?.packages??[])t.set(n.type,(t.get(n.type)??0)+1);return Array.from(t.entries(),([e,t])=>_r(e,t)).sort((e,t)=>t.value-e.value||e.label.localeCompare(t.label))}function Sr(e,t){return e?e.packages.map(n=>{let r=new Set,i=0;for(let t of e.modules)t.packages.some(e=>e.packageId===n.id)&&(r.add(t.id),t.packages.length>1&&i++);let a=n.files.map(e=>yr(n.id,e,t.fileBytes)).sort((e,t)=>t.size-e.size||e.file.localeCompare(t.file)).slice(0,5),o=n.files.reduce((e,t)=>e+dr(t),0),s=n.files.reduce((e,t)=>e+(t.gzipSize??0),0),c=n.files.reduce((e,t)=>e+(t.brotliSize??0),0),l=n.files.reduce((e,t)=>e+fr(t),0),u=n.files.some(e=>typeof e.gzipSize==`number`||typeof e.brotliSize==`number`)?`real`:`estimated`,d=t.packageBytes.get(n.id);return{id:n.id,label:n.label,type:n.type,totalBytes:o,gzipBytes:s,brotliBytes:c,compressedBytes:l,compressedSizeSource:u,sizeDeltaBytes:typeof d==`number`?o-d:void 0,fileCount:n.files.length,chunkCount:n.files.filter(e=>e.type===`chunk`).length,assetCount:n.files.filter(e=>e.type===`asset`).length,moduleCount:r.size,duplicateModuleCount:i,entryFileCount:n.files.filter(e=>e.isEntry).length,topFiles:a}}).sort((e,t)=>t.totalBytes-e.totalBytes||e.label.localeCompare(t.label)):[]}function Cr(e,t){let n=[];for(let r of e?.packages??[])for(let e of r.files)n.push(vr(r,e,t));return n.sort((e,t)=>t.size-e.size||e.file.localeCompare(t.file))}var wr=`\0`,Tr=[{itemStyle:{borderWidth:1,gapWidth:1},upperLabel:{show:!0,height:24,fontSize:12,fontWeight:650,lineHeight:17,overflow:`truncate`,textBorderWidth:0}},{itemStyle:{borderWidth:1,gapWidth:1},upperLabel:{show:!0,height:22,fontSize:11,fontWeight:600,lineHeight:15,overflow:`truncate`,textBorderWidth:0}},{itemStyle:{borderWidth:.75,gapWidth:.75}}];function Er(e){return`package${wr}${e}`}function J(e,t){return`file${wr}${e}${wr}${t}`}function Y(e,t,n){return`module${wr}${e}${wr}${t}${wr}${n}`}function Dr(e,t){return`asset${wr}${e}${wr}${t}`}function Or(e){let t=e.replaceAll(`\\`,`/`),n=H(e).replace(/^(?:\.\.\/)+/,``),r=n.split(`/`).filter(Boolean);if(r.length===0)return n;if(t.includes(`/node_modules/`)){let e=r[0];return e.startsWith(`@`)&&r[1]?`${e}/${r[1]}`:e}return r.length>2?`${r[r.length-2]}/${r[r.length-1]}`:r.join(`/`)}function kr(e){return e===void 0||!Number.isFinite(e)||e<0?`未知`:e===0?`0 B`:U(e)}function Ar({data:e}){if(!e?.meta)return``;let t=e.meta,n=t.kind===`package`?t.totalBytes:t.kind===`module`?t.bytes??t.originalBytes:t.bytes;return`${e.name}\n${kr(n)}`}function X(e){return String(e).replace(/[&<>"']/g,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`})[e])}function jr(e){let t=Or(e),n=[`<strong>${X(t)}</strong>`];return t!==e&&(n.push(`<span>完整路径</span>`),n.push(`<span style="font-family:monospace;word-break:break-all">${X(e)}</span>`)),n}function Mr(e){if(!e)return``;let t=[];if(e.kind===`package`?(t.push(`<strong>${X(e.packageLabel)}</strong>`),t.push(`类型:${X(e.packageType)}`),t.push(`产物数量:${X(e.fileCount)}`),t.push(`累计体积:${kr(e.totalBytes)}`)):e.kind===`file`?(t.push(...jr(e.fileName)),t.push(`所属:${X(e.packageLabel)}`),t.push(`类型:${e.type===`chunk`?`代码 chunk`:`资源`} · 来源:${X(e.from)}`),t.push(`体积:${kr(e.bytes)}`),e.childCount>0&&t.push(`模块数量:${X(e.childCount)}`)):e.kind===`module`?(t.push(...jr(e.source)),t.push(`所属:${X(e.packageLabel)} → ${X(e.fileName)}`),t.push(`源码类型:${X(de(e.sourceType))}`),t.push(`${e.bytes===void 0?`源码体积`:`模块体积`}:${kr(e.bytes??e.originalBytes)}`),e.packageCount>1&&t.push(`产出分包:${X(e.packageCount)} 个`)):e.kind===`asset`&&(t.push(...jr(e.source)),t.push(`所属:${X(e.packageLabel)} → ${X(e.fileName)}`),t.push(`资源体积:${kr(e.bytes)}`)),e.colorLabel&&t.push(`颜色:${X(e.colorLabel)}`),e.deltaBytes!==void 0){let n=e.deltaBytes>0?`+`:e.deltaBytes<0?`−`:``;t.push(`体积变化:${n}${kr(Math.abs(e.deltaBytes))}(${n}${Math.abs(e.deltaBytes)} B)`)}return t.join(`<br/>`)}function Nr(e,t){return e===null||t===null?null:e-t}function Pr(e){let{action:t,result:n}=e;if(t.kind===`budget`){let e=Yn(n).find(e=>e.id===t.warning?.id&&e.scope===t.warning.scope);return{budget:e,label:e?.label??`预算目标不可用`}}if(t.kind===`duplicate`){let e=n.modules.find(e=>t.key===`duplicate:${e.id}`);return{moduleId:e?.id,label:e?`跨包重复 · ${H(e.source)}`:`重复模块不可用`}}let r=e.incrementAttribution.find(e=>t.key===`increment:${e.key}`),i=t.file&&t.key===`increment:file:${t.file.packageId}:${t.file.file}`?t.file:void 0;return{moduleId:r?.moduleId,packageId:r?.packageId??i?.packageId,file:r?.file??i?.file,label:r?`${r.moduleId===void 0?`产物增长`:`模块增长`} · ${r.label}`:i?`产物增长 · ${i.file}`:`增长目标不可用`}}function Fr(e,t,n){let r=n.budget?.scope===`runtime`?new Set(n.budget.files):null,i=new Map(e.modules.find(e=>e.id===n.moduleId)?.packages.map(e=>[e.packageId,new Set(e.files)])),a=new Map,o=new Map;for(let e of t?.packages??[])for(let t of e.files)o.set(mr(e.id,t.file),q(t.size));let s=e.packages.map(e=>({...e,files:e.files.filter(t=>n.budget?n.budget.scope===`total`||(r?r.has(t.file):e.id===n.budget.id):n.moduleId===void 0?e.id===n.packageId&&t.file===n.file:i.get(e.id)?.has(t.file)||t.modules?.some(e=>e.id===n.moduleId))})).filter(e=>e.files.length>0);for(let e of s)for(let t of e.files)a.set(mr(e.id,t.file),q(t.size));return Cr({...e,packages:s},new Map).map(e=>{let n=mr(e.packageId,e.file),r=a.get(n)??null,i=t?o.has(n)?o.get(n):0:null,s=Nr(r,i);return{entry:{...e,sizeDeltaBytes:s??void 0},bytes:r,previousBytes:i,deltaBytes:s}}).sort((e,t)=>(t.bytes??-1)-(e.bytes??-1)||e.entry.packageId.localeCompare(t.entry.packageId)||e.entry.file.localeCompare(t.entry.file))}function Ir(e,t,n){let r=new Map,i=new Map(e.modules.map(e=>[e.id,e])),a=new Map(t.map(e=>[mr(e.entry.packageId,e.entry.file),e.entry])),o=(e,t,a)=>{if(n!==void 0&&t.id!==n)return;let o=Y(e.packageId,e.file,t.id);if(r.has(o))return;let s=q(t.bytes??t.originalBytes);r.set(o,{id:o,bytes:s,readable:a,meta:{kind:`module`,nodeId:o,packageId:e.packageId,packageLabel:e.packageLabel,fileName:e.file,source:t.source,sourceType:t.sourceType,bytes:s??void 0,originalBytes:q(t.originalBytes)??void 0,packageCount:i.get(t.id)?.packages.length??1}})};for(let{entry:e}of t)for(let t of e.modules??[])o(e,t,t.sourceType!==`node_modules`&&!!t.source);for(let t of e.modules)if(n===void 0||t.id===n)for(let e of t.packages)for(let n of e.files){let r=a.get(mr(e.packageId,n));r&&o(r,t,!1)}return[...r.values()].sort((e,t)=>(t.bytes??-1)-(e.bytes??-1)||e.id.localeCompare(t.id))}function Lr(e,t){if(!e)return null;let n=Yn(e).find(e=>e.id===t.id&&e.scope===t.scope);if(n)return n.status===`unknown`?null:q(n.currentBytes);if(t.scope===`runtime`){let t=e.artifacts?.runtime;return t&&t.unknownFiles.length===0?q(t.upperBoundBytes):null}return t.scope===`total`?null:tr(e,{packages:[]}).packages.find(e=>e.packageId===t.id)?.currentBytes??(e.packages.some(e=>e.id===t.id)?null:0)}function Rr(e,t){let n=tr(e.result,e.previous??{packages:[]}).modules.find(e=>e.moduleId===t);if(!n&&e.previous){let r=tr(e.result,{packages:[]}).modules.find(e=>e.moduleId===t);r&&(n={...r,previousBytes:r.currentBytes,deltaBytes:r.currentBytes===null?null:0})}let r=q(n?.currentBytes),i=e.previous?q(n?.previousBytes):null;return{currentBytes:r,previousBytes:i,deltaBytes:Nr(r,i)}}function zr(e,t){if(!e)return null;let n=ir(e).find(e=>e.id===t)?.estimatedSavingBytes;return ar(e,t,n)}function Br(e){let{action:t,result:n,previous:r}=e,i=Pr(e),a=Fr(n,r,i),o=Ir(n,a,i.moduleId),s={classification:`unknown`,scopeLabel:i.label,currentBytes:null,previousBytes:null,deltaBytes:null,limitBytes:null,measurement:`unavailable`,artifacts:a.slice(0,12),artifactCount:a.length,sources:o.slice(0,16),sourceCount:o.length,constraints:[`包、产物、模块是重叠粒度,不能相加为总增长或总收益;产物行按包内位置计数,总包预算按共享规则对输出路径去重。`,`来源行保留真实包/产物/模块位置;同一模块可出现多次,不代表多条独立依赖链。缺测为未知,不是 0。`,`来源只证明报告记录的关联,不证明当前源码、完整依赖链或可安全删除;源码需要另行读取验证。`],steps:[],checks:[`拟议:经授权后使用项目原生构建链重新构建,读取新报告核对同一目标及测量口径。`,`拟议:检查受影响页面、分包加载和真实运行时行为,再判断是否解决;本上下文没有执行这些检查。`]};if(r||s.constraints.push(`浏览器未提供比较报告,previousBytes / deltaBytes 均未知,不能推断新增或增长。`),i.budget){let e=i.budget;s.currentBytes=e.status===`unknown`?null:q(e.currentBytes),s.previousBytes=Lr(r,e),s.limitBytes=q(e.limitBytes),s.measurement=e.measurement,s.classification=s.currentBytes===null?`unknown`:e.status===`exceeded`?`problem`:e.status===`warning`?`risk`:`clue`,s.steps.push(`先核对预算范围、阈值和缺测项,再查看该范围的产物与来源,提出需要源码证明的改动假设。`),s.checks.unshift(`拟议:复验同一预算范围的完整测量与实际阈值,不能用其他包或全局汇总替代目标范围。`),e.scope===`runtime`&&s.constraints.push(`Runtime 是包含混合 chunk 的文件体积上界,不是运行时代码净体积;只列共享预算规则认定的相关文件,不能视为一个分包。`)}else if(t.kind===`duplicate`&&i.moduleId!==void 0){let t=e.duplicateModules.find(e=>e.id===i.moduleId);s.currentBytes=ar(n,i.moduleId,t?.estimatedSavingBytes),s.previousBytes=zr(r,i.moduleId),s.measurement=`upper-bound`,s.classification=s.currentBytes===null?`unknown`:`clue`,s.constraints.push(`当前值是共享规则的重复体积估算上界,不是全部副本的总量,也不是保证可节省的字节;差值只比较重复估算。`),n.modules.find(e=>e.id===i.moduleId)?.packages.some(e=>n.packages.some(t=>t.id===e.packageId&&t.type===`independent`))&&s.constraints.push(`包含独立分包,重复可能是隔离要求;不能直接假定可移入主包或删除副本。`),s.steps.push(`逐个核对真实产物位置和源码引用边界,先确认独立分包隔离与加载约束,再评估是否有可合并的重复。`),s.checks.unshift(`拟议:对比重建前后的真实产物体积和重复位置,同时验证各分包独立运行;不要把估算值当作验收收益。`)}else if(t.kind===`increment`&&i.moduleId!==void 0)Object.assign(s,Rr(e,i.moduleId)),s.measurement=s.currentBytes===null?`unavailable`:`upper-bound`,s.classification=s.currentBytes===null||s.deltaBytes===null?`unknown`:`clue`,s.constraints.push(`模块按共享比较规则匹配规范来源,取记录贡献的最大值(可回落到原始体积),不是最终文件净增量;产物行仅作关联对照。`);else if(t.kind===`increment`){let e=a.find(e=>e.entry.packageId===i.packageId&&e.entry.file===i.file);e&&(s.currentBytes=e.bytes,s.previousBytes=e.previousBytes,s.measurement=e.bytes===null?`unavailable`:`file-bytes`,s.classification=e.bytes===null||e.deltaBytes===null?`unknown`:`clue`)}return s.deltaBytes=Nr(s.currentBytes,s.previousBytes),t.kind===`increment`&&(s.steps.push(`核对浏览器比较报告的来源,再按所选文件或模块粒度定位变化;增长本身不是错误,优化原因仍是假设。`),s.checks.unshift(`拟议:在可核对的同一比较基线上检查目标差值;没有基线或存在缺测时保持未知,不宣称增长已消除。`)),s.classification===`unknown`&&s.steps.unshift(`先补全目标定位、测量或比较基线;在事实不足时只列待确认项,不给出确定修复结论。`),s}var Vr={critical:4,warning:3,info:2,success:1},Hr=[{label:`按优先级`,value:`priority`},{label:`按严重度`,value:`severity`},{label:`按标题`,value:`title`},{label:`按数值`,value:`value`}];function Ur(e){return e===`budget`?`预算`:e===`increment`?`增量`:`重复`}function Wr(e){return Ae(e===`critical`?{tone:`error`}:e===`warning`?{tone:`warning`}:e===`success`?{tone:`success`}:{tone:`info`})}function Gr(e){return e===`critical`?`必须处理`:e===`warning`?`建议处理`:e===`success`?`可查看`:`定位`}function Kr(e,t){return[...e].sort((e,n)=>t===`severity`?Vr[n.tone]-Vr[e.tone]||n.priority-e.priority||e.title.localeCompare(n.title):t===`title`?e.title.localeCompare(n.title):t===`value`?n.priority-e.priority||String(e.value??``).localeCompare(String(n.value??``))||e.title.localeCompare(n.title):n.priority-e.priority||Vr[n.tone]-Vr[e.tone]||e.title.localeCompare(n.title))}function qr(e){let t=u(``),n=u(`all`),r=u(`all`),i=u(`priority`),a=M(()=>{let t=new Set;for(let n of e.actions)t.add(n.tone);return[...t].sort((e,t)=>Vr[t]-Vr[e])}),o=M(()=>{let t=new Set;for(let n of e.actions)t.add(n.kind);return[...t].sort((e,t)=>Ur(e).localeCompare(Ur(t)))}),s=M(()=>[{label:`全部严重度`,value:`all`},...a.value.map(e=>({label:Gr(e),value:e}))]),c=M(()=>[{label:`全部类型`,value:`all`},...o.value.map(e=>({label:Ur(e),value:e}))]);return{actionKindFilter:r,actionSortOptions:Hr,actionQuery:t,actionSortMode:i,actionToneFilter:n,filteredActions:M(()=>{let a=t.value.trim().toLowerCase();return Kr(e.actions.filter(e=>n.value!==`all`&&e.tone!==n.value||r.value!==`all`&&e.kind!==r.value?!1:!a||[e.key,e.kind,e.tone,e.title,e.meta,e.value,e.tab].some(e=>String(e??``).toLowerCase().includes(a))),i.value)}),kindFilterOptions:c,getKindLabel:Ur,getToneClassName:Wr,getToneLabel:Gr,toneFilterOptions:s}}var Jr=L({__name:`ActionCenterPanel`,props:{actions:{},activeKey:{}},emits:[`select`],setup(e,{expose:t,emit:n}){t();let r=e,i=n,{actionKindFilter:a,actionQuery:o,actionSortMode:s,actionSortOptions:c,actionToneFilter:l,filteredActions:u,getKindLabel:f,getToneLabel:p,kindFilterOptions:m,toneFilterOptions:h}=qr(r),g={props:r,emit:i,actionKindFilter:a,actionQuery:o,actionSortMode:s,actionSortOptions:c,actionToneFilter:l,filteredActions:u,getKindLabel:f,getToneLabel:p,kindFilterOptions:m,toneFilterOptions:h,advancedFilterSummary:M(()=>[l.value===`all`?``:p(l.value),a.value===`all`?``:f(a.value),s.value===`priority`?``:c.find(e=>e.value===s.value)?.label].filter(Boolean).join(` · `)),searchId:d(),listId:d(),visibleRows:M(()=>u.value.map(e=>{let t=`待核实线索`,n=`info`;e.measurementUnknown?(t=`测量不完整`,n=`neutral`):e.kind===`budget`?!e.warning||e.warning.status===`unknown`?(t=`测量不完整`,n=`neutral`):e.warning.status===`critical`?(t=`超出预算`,n=`error`):(t=`接近预算`,n=`warning`):e.kind===`increment`?t=`增长线索`:e.kind===`duplicate`&&(t=`重复待核实`);let r=H(e.targetLabel),i=r.lastIndexOf(`/`);return{item:e,label:t,target:r,name:r.slice(i+1),directory:i<0?``:r.slice(0,i+1),toneClass:n===`error`||n===`warning`?`text-amber-700 dark:text-amber-200`:`text-(--dashboard-text-muted)`}})),AppEmptyState:G,AppSelect:be};return Object.defineProperty(g,"__isScriptSetup",{enumerable:!1,value:!0}),g}}),Yr={"data-diagnostic-index":``,"aria-label":`问题索引`,class:`grid min-w-0 content-start gap-3`},Xr={class:`flex flex-wrap items-baseline justify-between gap-2`},Zr={class:`text-xs tabular-nums text-(--dashboard-text-soft)`},Qr=[`for`],$r={class:`relative min-w-0`},ei=[`id`,`aria-controls`],ti=[`open`],ni={class:`flex min-h-9 cursor-pointer list-none items-center gap-2 py-1 text-xs text-(--dashboard-text-muted) hover:text-(--dashboard-text)`},ri={class:`min-w-0 flex-1`},ii={key:0},ai={class:`grid min-w-0 gap-2 pt-2`},oi={key:0,class:`text-xs tabular-nums text-(--dashboard-text-soft)`,role:`status`},si=[`id`],ci={key:1,class:`divide-y divide-(--dashboard-border)`},li=[`aria-pressed`,`title`,`aria-label`,`data-diagnostic-key`,`onClick`],ui={class:`flex min-w-0 items-baseline justify-between gap-2`},di={class:`min-w-0 font-mono text-sm font-medium leading-5 text-(--dashboard-text) [overflow-wrap:anywhere]`},fi={key:0,class:`max-w-[45%] shrink-0 text-right text-xs font-medium leading-5 tabular-nums text-(--dashboard-text) [overflow-wrap:anywhere]`},pi={class:`mt-1 flex min-w-0 items-baseline gap-2 text-xs leading-5`},mi={key:0,class:`min-w-0 truncate text-(--dashboard-text-soft)`};function hi(e,n,r,i,a,o){return f(),I(`aside`,Yr,[O(`header`,Xr,[n[4]||=O(`h2`,{class:`text-sm font-semibold text-(--dashboard-text-muted)`},`问题与线索`,-1),O(`span`,Zr,t(r.actions.length)+` 项`,1)]),O(`label`,{for:i.searchId,class:`sr-only`},`搜索问题与线索`,8,Qr),O(`div`,$r,[n[5]||=O(`span`,{class:`icon-[mdi--magnify] pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-(--dashboard-text-soft)`,"aria-hidden":`true`},null,-1),v(O(`input`,{id:i.searchId,"onUpdate:modelValue":n[0]||=e=>i.actionQuery=e,"data-diagnostic-search":``,class:`min-h-9 w-full min-w-0 rounded-sm border border-(--dashboard-border) bg-(--dashboard-panel) pr-2 pl-8 text-sm text-(--dashboard-text) placeholder:text-(--dashboard-text-soft) pointer-coarse:min-h-11`,placeholder:`搜索名称或路径`,type:`search`,"aria-controls":i.listId},null,8,ei),[[j,i.actionQuery]])]),O(`details`,{class:`group min-w-0`,open:!!i.advancedFilterSummary},[O(`summary`,ni,[n[7]||=O(`span`,{class:`icon-[mdi--filter-outline] size-4 shrink-0`,"aria-hidden":`true`},null,-1),O(`span`,ri,[n[6]||=R(`筛选与排序`,-1),i.advancedFilterSummary?(f(),I(`span`,ii,` · `+t(i.advancedFilterSummary),1)):C(``,!0)]),n[8]||=O(`span`,{class:`icon-[mdi--chevron-right] size-4 shrink-0 group-open:rotate-90`,"aria-hidden":`true`},null,-1)]),O(`div`,ai,[_(i.AppSelect,{modelValue:i.actionToneFilter,"onUpdate:modelValue":n[1]||=e=>i.actionToneFilter=e,label:`按严重度筛选`,options:i.toneFilterOptions},null,8,[`modelValue`,`options`]),_(i.AppSelect,{modelValue:i.actionKindFilter,"onUpdate:modelValue":n[2]||=e=>i.actionKindFilter=e,label:`按问题类型筛选`,options:i.kindFilterOptions},null,8,[`modelValue`,`options`]),_(i.AppSelect,{modelValue:i.actionSortMode,"onUpdate:modelValue":n[3]||=e=>i.actionSortMode=e,label:`排序处理项`,options:i.actionSortOptions},null,8,[`modelValue`,`options`])])],8,ti),i.actionQuery||i.advancedFilterSummary?(f(),I(`p`,oi,` 匹配 `+t(i.filteredActions.length)+` / `+t(r.actions.length)+` 项 `,1)):C(``,!0),O(`div`,{id:i.listId,class:`max-h-[min(32rem,45dvh)] min-w-0 overflow-y-auto p-0.5`},[i.filteredActions.length===0?(f(),D(i.AppEmptyState,{key:0,compact:``},{default:c(()=>[R(t(r.actions.length===0?`当前没有问题或待查线索。`:`没有匹配项,请调整搜索或筛选。`),1)]),_:1})):(f(),I(`ol`,ci,[(f(!0),I(E,null,m(i.visibleRows,e=>(f(),I(`li`,{key:e.item.key,class:`min-w-0 list-none`},[O(`button`,{type:`button`,class:x([`min-h-11 w-full min-w-0 border-l-2 px-2 py-2 text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--dashboard-accent)`,r.activeKey===e.item.key?`border-l-(--dashboard-accent) bg-(--dashboard-accent-soft)`:`border-transparent hover:bg-(--dashboard-panel-muted)`]),"aria-pressed":r.activeKey===e.item.key,title:e.target,"aria-label":`${e.target},${e.label}${e.item.value?`,${e.item.value}`:``}`,"data-diagnostic-key":e.item.key,onClick:t=>i.emit(`select`,e.item)},[O(`span`,ui,[O(`span`,di,t(e.name),1),e.item.value?(f(),I(`span`,fi,t(e.item.value),1)):C(``,!0)]),O(`span`,pi,[O(`span`,{class:x([`shrink-0`,e.toneClass])},t(e.label),3),e.directory?(f(),I(`span`,mi,t(e.directory),1)):C(``,!0)])],10,li)]))),128))]))],8,si)])}var gi=z(Jr,[[`render`,hi]]);function _i(e){return e===0?`无变化`:`${e>0?`+`:`-`}${U(Math.abs(e))}`}var vi=L({__name:`DiagnosticArtifactEvidence`,props:{evidence:{},comparisonLabel:{}},emits:[`openFile`,`showSources`],setup(e,{expose:t,emit:n}){t();let r=e,i=n,a=M(()=>{let{currentBytes:e,previousBytes:t,limitBytes:n,measurement:i}=r.evidence,a=Math.max(e??0,t??0,n??0,1),o=[{key:`previous`,label:`对照基线`,bytes:t},{key:`current`,label:i===`upper-bound`?`当前估算上界`:`当前报告`,bytes:e}];return n!==null&&o.push({key:`limit`,label:`预算上限`,bytes:n}),o.map(e=>({...e,width:e.bytes===null?null:`${e.bytes/a*100}%`}))}),o=M(()=>r.evidence.sources.slice(0,3)),s=M(()=>{let e=null;for(let t of o.value)t.bytes!==null&&(e=Math.max(e??0,t.bytes));return e});function c(e){let t=H(e);return t.slice(t.lastIndexOf(`/`)+1)}let l={props:r,emit:i,measurements:a,sourcePreview:o,sourceScale:s,sourceName:c,get formatBytes(){return U},get formatModuleIdentifier(){return H},get formatSourceType(){return de},get formatSignedBytes(){return _i}};return Object.defineProperty(l,"__isScriptSetup",{enumerable:!1,value:!0}),l}}),yi={class:`@container/artifact-evidence min-w-0`},bi={class:`artifact-evidence-grid grid min-w-0 border-y border-(--dashboard-border)`},xi={"aria-label":`体积测量对照`,class:`artifact-measurements min-w-0 py-4`},Si={class:`flex flex-wrap items-baseline justify-between gap-2`},Ci={class:`text-xs text-(--dashboard-text-soft) [overflow-wrap:anywhere]`},wi={class:`mt-3 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1 text-xs text-(--dashboard-text-soft)`},Ti={class:`min-w-0 [overflow-wrap:anywhere]`},Ei={class:`mt-3 grid gap-3`},Di=[`data-measurement`],Oi={class:`text-xs text-(--dashboard-text-muted) [overflow-wrap:anywhere]`},ki={class:`col-span-2`,"aria-hidden":`true`},Ai={class:`grid min-w-0 grid-cols-[minmax(0,1fr)_minmax(0,auto)] items-baseline gap-3 border-t border-(--dashboard-border) pt-3`},ji={class:`text-xs text-(--dashboard-text-muted)`},Mi={class:`min-w-0 text-right font-mono text-lg font-medium tabular-nums text-(--dashboard-text) [overflow-wrap:anywhere]`},Ni={key:0,class:`mt-2 text-xs leading-5 text-(--dashboard-text-soft)`},Pi={key:1,class:`mt-2 text-xs leading-5 text-(--dashboard-text-soft)`},Fi={key:2,class:`mt-2 text-xs leading-5 text-(--dashboard-text-soft)`},Ii={"aria-label":`关联产物`,class:`mt-4 min-w-0 border-t border-(--dashboard-border) pt-3`},Li={class:`flex flex-wrap items-baseline justify-between gap-2`},Ri={"data-artifact-count":``,class:`text-xs tabular-nums text-(--dashboard-text-soft)`},zi={key:0,class:`mt-3 text-sm leading-6 text-(--dashboard-text-muted)`},Bi={class:`divide-y divide-(--dashboard-border)`},Vi=[`aria-label`,`onClick`],Hi={class:`min-w-0 [overflow-wrap:anywhere]`},Ui={class:`mt-1 text-xs text-(--dashboard-text-soft) [overflow-wrap:anywhere]`},Wi={class:`mt-2 grid grid-cols-3 gap-2 text-xs leading-5`},Gi={class:`min-w-0`},Ki={class:`tabular-nums text-(--dashboard-text) [overflow-wrap:anywhere]`},qi={class:`min-w-0`},Ji={class:`tabular-nums text-(--dashboard-text) [overflow-wrap:anywhere]`},Yi={class:`min-w-0`},Xi={class:`tabular-nums text-(--dashboard-text) [overflow-wrap:anywhere]`},Zi={"aria-label":`关联来源摘要`,class:`artifact-sources min-w-0 border-t border-(--dashboard-border) py-4`},Qi={class:`flex flex-wrap items-baseline justify-between gap-2`},$i={class:`text-xs tabular-nums text-(--dashboard-text-soft)`},ea={key:0,class:`mt-4 text-sm leading-6 text-(--dashboard-text-soft)`},ta={key:1,class:`mt-3 text-xs leading-5 text-(--dashboard-text-soft)`},na={key:0,class:`font-mono tabular-nums`},ra={key:2,class:`mt-2 divide-y divide-(--dashboard-border)`},ia={class:`group min-w-0`,"data-source-detail":``},aa=[`title`,`aria-label`],oa={class:`flex min-w-0 items-baseline gap-2`},sa={class:`min-w-0 flex-1 font-mono text-xs leading-5 text-(--dashboard-text) [overflow-wrap:anywhere]`},ca={class:`shrink-0 font-mono text-sm tabular-nums text-(--dashboard-text)`},la={class:`mt-1 block truncate pl-5 text-xs leading-4 text-(--dashboard-text-soft)`},ua={class:`grid min-w-0 gap-2 pb-3 pl-5 text-xs leading-5 text-(--dashboard-text-muted)`},da={class:`text-(--dashboard-text-soft)`},fa={class:`font-mono [overflow-wrap:anywhere]`},pa={class:`[overflow-wrap:anywhere]`},ma={class:`font-mono [overflow-wrap:anywhere]`},ha={key:3,class:`mt-3 text-xs leading-5 text-(--dashboard-text-soft)`},ga={key:4,class:`mt-3 border-t border-(--dashboard-border) pt-1`},_a={class:`min-h-9 cursor-pointer rounded-sm py-2 text-xs text-(--dashboard-text-muted) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--dashboard-accent) pointer-coarse:min-h-11`},va={class:`mt-2 grid list-disc gap-2 pl-4 text-xs leading-6 text-(--dashboard-text-soft)`};function ya(e,n,r,i,a,o){return f(),I(`div`,yi,[O(`div`,bi,[O(`section`,xi,[O(`header`,Si,[n[1]||=O(`h3`,{class:`text-sm font-medium text-(--dashboard-text)`},` 体积对照 `,-1),O(`span`,Ci,t(r.comparisonLabel),1)]),O(`div`,wi,[O(`span`,Ti,t(r.evidence.scopeLabel),1),n[2]||=O(`span`,null,`同一字节尺度`,-1)]),O(`dl`,Ei,[(f(!0),I(E,null,m(i.measurements,e=>(f(),I(`div`,{key:e.key,"data-measurement":e.key,class:`grid min-w-0 grid-cols-[minmax(0,1fr)_minmax(0,auto)] items-baseline gap-x-3 gap-y-1.5`},[O(`dt`,Oi,t(e.label),1),O(`dd`,{class:x([`min-w-0 text-right font-mono tabular-nums text-(--dashboard-text) [overflow-wrap:anywhere]`,e.key===`current`?`text-xl font-medium`:`text-sm`])},t(e.bytes===null?`未知 / 未提供`:i.formatBytes(e.bytes)),3),O(`dd`,ki,[O(`span`,{class:x([`block h-3 bg-(--dashboard-panel-muted)`,e.bytes===null?`border border-dashed border-(--dashboard-border)`:``])},[e.width!==null&&e.bytes!==0?(f(),I(`span`,{key:0,class:x([`block h-full`,e.key===`current`?`bg-(--dashboard-accent)`:e.key===`limit`?`bg-(--dashboard-text-muted)`:`bg-(--dashboard-border-strong)`]),style:h({width:e.width})},null,6)):C(``,!0)],2)])],8,Di))),128)),O(`div`,Ai,[O(`dt`,ji,t(r.evidence.measurement===`upper-bound`?`上界较基线变化`:`较基线变化`),1),O(`dd`,Mi,t(r.evidence.deltaBytes===null?`未知`:i.formatSignedBytes(r.evidence.deltaBytes)),1)])]),r.evidence.measurement===`upper-bound`?(f(),I(`p`,Ni,` 上界不是可移除体积或已实现收益。 `)):r.evidence.measurement===`unavailable`?(f(),I(`p`,Pi,` 测量不完整,不能判断预算达标。 `)):C(``,!0),r.evidence.currentBytes===null||r.evidence.previousBytes===null?(f(),I(`p`,Fi,t(r.evidence.previousBytes===null?`基线未提供或缺测;`:``)+`未知不按 0 计算。 `,1)):C(``,!0),O(`section`,Ii,[O(`header`,Li,[n[3]||=O(`h4`,{class:`text-xs font-medium text-(--dashboard-text)`},` 关联产物 `,-1),O(`span`,Ri,`展示 `+t(r.evidence.artifacts.length)+` / `+t(r.evidence.artifactCount)+` 项 · 最多 12 项`,1)]),r.evidence.artifacts.length===0?(f(),I(`p`,zi,` 当前报告没有可定位的关联产物。 `)):(f(),I(`details`,{key:r.evidence.scopeLabel,class:`mt-1`},[n[8]||=O(`summary`,{class:`min-h-9 cursor-pointer rounded-sm py-2 text-xs text-(--dashboard-text-muted) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--dashboard-accent) pointer-coarse:min-h-11`},` 产物位置与逐项测量 `,-1),O(`ul`,Bi,[(f(!0),I(E,null,m(r.evidence.artifacts,e=>(f(),I(`li`,{key:`${e.entry.packageId}:${e.entry.from}:${e.entry.file}`,class:`min-w-0 py-3`},[O(`button`,{type:`button`,"data-diagnostic-open-file":``,class:`inline-flex min-h-9 max-w-full items-start gap-2 rounded-sm py-1 text-left font-mono text-xs leading-6 text-(--dashboard-accent) underline decoration-(--dashboard-border-strong) underline-offset-4 hover:decoration-current focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--dashboard-accent) pointer-coarse:min-h-11`,"aria-label":`打开产物 ${e.entry.packageLabel} / ${e.entry.file}`,onClick:t=>i.emit(`openFile`,e.entry)},[O(`span`,Hi,t(e.entry.file),1),n[4]||=O(`span`,{class:`icon-[mdi--arrow-top-right] mt-1 size-4 shrink-0`,"aria-hidden":`true`},null,-1)],8,Vi),O(`p`,Ui,t(e.entry.packageLabel)+` · `+t(e.entry.type),1),O(`dl`,Wi,[O(`div`,Gi,[n[5]||=O(`dt`,{class:`text-(--dashboard-text-soft)`},`基线`,-1),O(`dd`,Ki,t(e.previousBytes===null?`未知`:i.formatBytes(e.previousBytes)),1)]),O(`div`,qi,[n[6]||=O(`dt`,{class:`text-(--dashboard-text-soft)`},`当前`,-1),O(`dd`,Ji,t(e.bytes===null?`未知`:i.formatBytes(e.bytes)),1)]),O(`div`,Yi,[n[7]||=O(`dt`,{class:`text-(--dashboard-text-soft)`},`变化`,-1),O(`dd`,Xi,t(e.deltaBytes===null?`未知`:i.formatSignedBytes(e.deltaBytes)),1)])])]))),128))])]))])]),O(`section`,Zi,[O(`header`,Qi,[n[9]||=O(`h3`,{class:`text-sm font-medium text-(--dashboard-text)`},` 来源贡献 `,-1),O(`span`,$i,`摘要 `+t(i.sourcePreview.length)+` / `+t(r.evidence.sourceCount)+` 项`,1)]),i.sourcePreview.length===0?(f(),I(`p`,ea,` 暂无可定位来源;需补齐模块报告或核对资源。 `)):C(``,!0),i.sourcePreview.length?(f(),I(`p`,ta,[R(t(i.sourceScale===null?`来源体积未提供`:`条长参照:摘要内最大已知来源`)+` `,1),i.sourceScale===null?C(``,!0):(f(),I(`span`,na,t(i.formatBytes(i.sourceScale)),1))])):C(``,!0),i.sourcePreview.length?(f(),I(`ul`,ra,[(f(!0),I(E,null,m(i.sourcePreview,e=>(f(),I(`li`,{key:e.id,class:`min-w-0`},[O(`details`,ia,[O(`summary`,{title:i.formatModuleIdentifier(e.meta.source),"aria-label":`查看来源 ${i.formatModuleIdentifier(e.meta.source)},${e.meta.packageLabel} 的关联详情`,class:`min-h-11 cursor-pointer list-none rounded-sm py-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--dashboard-accent)`},[O(`span`,oa,[n[10]||=O(`span`,{class:`icon-[mdi--chevron-right] size-3 shrink-0 self-center text-(--dashboard-text-soft) group-open:rotate-90`,"aria-hidden":`true`},null,-1),O(`code`,sa,t(i.sourceName(e.meta.source)),1),O(`span`,ca,t(e.bytes===null?`未知`:i.formatBytes(e.bytes)),1)]),O(`span`,la,t(e.meta.packageLabel),1),O(`span`,{class:x([`mt-2 block h-1.5 bg-(--dashboard-panel-muted)`,e.bytes===null?`border border-dashed border-(--dashboard-border)`:``]),"aria-hidden":`true`},[e.bytes!==null&&e.bytes>0&&i.sourceScale!==null&&i.sourceScale>0?(f(),I(`span`,{key:0,class:`block h-full bg-(--dashboard-accent)`,style:h({width:`${e.bytes/i.sourceScale*100}%`})},null,4)):C(``,!0)],2)],8,aa),O(`dl`,ua,[O(`div`,null,[O(`dt`,da,`来源 · `+t(i.formatSourceType(e.meta.sourceType)),1),O(`dd`,fa,t(i.formatModuleIdentifier(e.meta.source)),1)]),O(`div`,null,[n[11]||=O(`dt`,{class:`text-(--dashboard-text-soft)`},`所属包`,-1),O(`dd`,pa,t(e.meta.packageLabel),1)]),O(`div`,null,[n[12]||=O(`dt`,{class:`text-(--dashboard-text-soft)`},`关联产物`,-1),O(`dd`,ma,t(e.meta.fileName),1)])])])]))),128))])):C(``,!0),i.sourcePreview.length?(f(),I(`p`,ha,` 仅为报告关联,贡献不可相加,也不等于可节省量。 `)):C(``,!0),O(`button`,{type:`button`,class:`mt-2 inline-flex min-h-9 max-w-full items-center gap-2 rounded-sm py-1.5 text-left text-xs text-(--dashboard-accent) [overflow-wrap:anywhere] hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--dashboard-accent) pointer-coarse:min-h-11`,onClick:n[0]||=e=>i.emit(`showSources`)},[...n[13]||=[R(` 查看模块与来源 `,-1),O(`span`,{class:`icon-[mdi--arrow-right] size-4 shrink-0`,"aria-hidden":`true`},null,-1)]]),r.evidence.constraints.length?(f(),I(`details`,ga,[O(`summary`,_a,` 完整证据边界 · `+t(r.evidence.constraints.length)+` 项 `,1),O(`ul`,va,[(f(!0),I(E,null,m(r.evidence.constraints,e=>(f(),I(`li`,{key:e,class:`[overflow-wrap:anywhere]`},t(e),1))),128))])])):C(``,!0)])])])}var ba=z(vi,[[`render`,ya],[`__scopeId`,`data-v-d04f9a1a`]]),xa=L({__name:`DiagnosticSourcesEvidence`,props:{evidence:{}},emits:[`openSource`],setup(e,{expose:t,emit:n}){t();let r={emit:n,get formatBytes(){return U},get formatSourceType(){return de}};return Object.defineProperty(r,"__isScriptSetup",{enumerable:!1,value:!0}),r}}),Sa={"aria-label":`报告中的模块与来源`,class:`@container/source-evidence min-w-0 border-t border-(--dashboard-border) pt-6`},Ca={class:`flex flex-wrap items-baseline justify-between gap-2`},wa={"data-source-count":``,class:`text-xs tabular-nums text-(--dashboard-text-soft)`},Ta={key:0,class:`mt-6 text-sm leading-6 text-(--dashboard-text-soft)`},Ea={key:1,class:`mt-6 divide-y divide-(--dashboard-border)`},Da={class:`min-w-0`},Oa={class:`flex min-w-0 flex-wrap items-baseline justify-between gap-x-4 gap-y-1`},ka={class:`text-xs text-(--dashboard-text-soft)`},Aa={class:`text-xs tabular-nums text-(--dashboard-text-muted)`},ja=[`aria-label`,`onClick`],Ma={class:`min-w-0 [overflow-wrap:anywhere]`},Na={key:1,"data-diagnostic-unreadable-source":``,class:`mt-2`},Pa={class:`block font-mono text-xs leading-6 text-(--dashboard-text) [overflow-wrap:anywhere]`},Fa={class:`mt-1 text-xs leading-5 text-(--dashboard-text-soft)`},Ia={class:`grid content-start gap-1 text-xs leading-5 text-(--dashboard-text-muted)`},La={class:`grid grid-cols-[3rem_minmax(0,1fr)] gap-2`},Ra={class:`[overflow-wrap:anywhere]`},za={class:`grid grid-cols-[3rem_minmax(0,1fr)] gap-2`},Ba={class:`font-mono [overflow-wrap:anywhere]`};function Va(e,n,r,i,a,o){return f(),I(`section`,Sa,[O(`header`,Ca,[n[0]||=O(`h3`,{class:`font-mono text-sm font-medium text-(--dashboard-text)`},` 模块与来源 `,-1),O(`span`,wa,`展示 `+t(r.evidence.sources.length)+` / `+t(r.evidence.sourceCount)+` 项 · 最多 16 项`,1)]),n[4]||=O(`p`,{class:`mt-3 text-sm leading-6 text-(--dashboard-text-muted)`},` 报告关联不等于导入链;打开来源后需核对当前源码与构建时刻的差异。 `,-1),r.evidence.sources.length===0?(f(),I(`p`,Ta,` 当前条目没有可定位的来源模块。没有来源记录不代表没有依赖;请先补齐模块报告或核对资源本身。 `)):(f(),I(`ul`,Ea,[(f(!0),I(E,null,m(r.evidence.sources,e=>(f(),I(`li`,{key:e.id,class:`source-evidence-row grid min-w-0 gap-3 py-4 first:pt-0`},[O(`div`,Da,[O(`div`,Oa,[O(`span`,ka,t(i.formatSourceType(e.meta.sourceType)),1),O(`span`,Aa,` 模块体积 `+t(e.bytes===null?`未知`:i.formatBytes(e.bytes)),1)]),e.readable?(f(),I(`button`,{key:0,type:`button`,"data-diagnostic-open-source":``,class:`mt-1 inline-flex min-h-9 max-w-full items-start gap-2 rounded-sm py-1 text-left font-mono text-xs leading-6 text-(--dashboard-accent) underline decoration-(--dashboard-border-strong) underline-offset-4 hover:decoration-current focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--dashboard-accent) pointer-coarse:min-h-11`,"aria-label":`打开来源 ${e.meta.source},${e.meta.packageLabel} / ${e.meta.fileName}`,onClick:t=>i.emit(`openSource`,e.meta)},[O(`span`,Ma,t(e.meta.source),1),n[1]||=O(`span`,{class:`icon-[mdi--arrow-top-right] mt-1 size-4 shrink-0`,"aria-hidden":`true`},null,-1)],8,ja)):(f(),I(`div`,Na,[O(`code`,Pa,t(e.meta.source),1),O(`p`,Fa,t(e.meta.sourceType===`node_modules`?`依赖源码需在外部工作区核实。`:`未提供可导航的源码映射,需在外部工作区核实。`),1)]))]),O(`dl`,Ia,[O(`div`,La,[n[2]||=O(`dt`,{class:`text-(--dashboard-text-soft)`},`所属包`,-1),O(`dd`,Ra,t(e.meta.packageLabel),1)]),O(`div`,za,[n[3]||=O(`dt`,{class:`text-(--dashboard-text-soft)`},`产物`,-1),O(`dd`,Ba,t(e.meta.fileName),1)])])]))),128))]))])}var Ha=z(xa,[[`render`,Va],[`__scopeId`,`data-v-d4528f4c`]]),Ua=L({__name:`DiagnosticEvidencePanel`,props:{action:{},evidence:{},comparisonLabel:{}},emits:[`openFile`,`openSource`,`inspect`],setup(e,{expose:t,emit:n}){t();let i=e,a=n,o=[{id:`compare`,label:`产物对照`},{id:`sources`,label:`模块与来源`},{id:`verification`,label:`复验条件`}],s=d(),c=P(`compare`),l=r(`panel`),u=r(`tabButtons`);async function f(e,t=!1){c.value=e,t&&(await A(),u.value?.find(t=>t.dataset.evidenceTab===e)?.focus())}function p(e,t){let n;if(e.key===`ArrowRight`)n=(t+1)%o.length;else if(e.key===`ArrowLeft`)n=(t+o.length-1)%o.length;else if(e.key===`Home`)n=0;else if(e.key===`End`)n=o.length-1;else return;e.preventDefault();let r=o[n];r&&f(r.id,!0)}y(()=>i.action?.key,()=>{f(`compare`,!!(l.value?.contains(document.activeElement)||u.value?.includes(document.activeElement)))});let m={props:i,emit:a,tabs:o,panelId:s,activeTab:c,panel:l,tabButtons:u,selectTab:f,handleTabKeydown:p,DiagnosticArtifactEvidence:ba,DiagnosticSourcesEvidence:Ha};return Object.defineProperty(m,"__isScriptSetup",{enumerable:!1,value:!0}),m}}),Wa={"data-diagnostic-evidence":``,"aria-label":`所选条目的证据工作区`,class:`diagnostic-workspace min-w-0`},Ga={class:`diagnostic-columns grid min-w-0 items-start overflow-hidden rounded-md border border-(--dashboard-border) bg-(--dashboard-panel)`},Ka={class:`diagnostic-index min-w-0 border-b border-(--dashboard-border) bg-(--dashboard-bg) p-3`,"aria-label":`问题与线索索引`},qa={ref:`panel`,class:`grid min-w-0 content-start gap-3 p-3 sm:p-4`},Ja={class:`flex min-w-0 flex-wrap items-center justify-between gap-x-5 gap-y-2 border-b border-(--dashboard-border)`},Ya={key:0,role:`tablist`,"aria-label":`证据视图`,class:`flex min-w-0 gap-5`},Xa=[`id`,`aria-controls`,`aria-selected`,`tabindex`,`data-evidence-tab`,`onClick`,`onKeydown`],Za=[`id`,`aria-labelledby`],Qa=[`id`,`aria-labelledby`],$a=[`id`,`aria-labelledby`],eo={class:`diagnostic-verification grid gap-6`},to={"aria-label":`调查步骤`},no={key:0,class:`mt-3 grid list-decimal gap-3 pl-5 text-sm leading-6 text-(--dashboard-text-muted)`},ro={key:1,class:`mt-3 text-sm text-(--dashboard-text-soft)`},io={"aria-label":`复验要求`},ao={key:0,class:`mt-3 grid gap-3 text-sm leading-6 text-(--dashboard-text-muted)`},oo={key:1,class:`mt-3 text-sm text-(--dashboard-text-soft)`},so={class:`flex min-w-0 flex-wrap items-center justify-between gap-x-4 gap-y-2 text-xs text-(--dashboard-text-soft)`},co={key:2,class:`min-w-0 border-l-2 border-(--dashboard-accent) py-2 pl-4`};function lo(e,n,r,i,a,s){return f(),I(`section`,Wa,[O(`div`,Ga,[O(`aside`,Ka,[o(e.$slots,`index`,{},void 0,!0)]),O(`div`,qa,[r.action&&r.evidence?o(e.$slots,`heading`,{},void 0,!0,0):C(``,!0),O(`div`,Ja,[r.action&&r.evidence?(f(),I(`div`,Ya,[(f(),I(E,null,m(i.tabs,(e,n)=>O(`button`,{id:`${i.panelId}-tab-${e.id}`,key:e.id,ref_for:!0,ref:`tabButtons`,type:`button`,role:`tab`,class:x([`min-h-11 min-w-0 border-b-2 py-2 text-sm font-medium [overflow-wrap:anywhere] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--dashboard-accent)`,i.activeTab===e.id?`border-(--dashboard-accent) text-(--dashboard-accent)`:`border-transparent text-(--dashboard-text-muted) hover:text-(--dashboard-text)`]),"aria-controls":`${i.panelId}-panel-${e.id}`,"aria-selected":i.activeTab===e.id,tabindex:i.activeTab===e.id?0:-1,"data-evidence-tab":e.id,onClick:t=>i.selectTab(e.id),onKeydown:e=>i.handleTabKeydown(e,n)},t(e.label),43,Xa)),64))])):C(``,!0),o(e.$slots,`controls`,{},void 0,!0)]),r.action&&r.evidence?(f(),I(E,{key:1},[v(O(`div`,{id:`${i.panelId}-panel-compare`,role:`tabpanel`,tabindex:`0`,"aria-labelledby":`${i.panelId}-tab-compare`,class:`min-w-0 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--dashboard-accent)`},[_(i.DiagnosticArtifactEvidence,{evidence:r.evidence,"comparison-label":r.comparisonLabel,onOpenFile:n[0]||=e=>i.emit(`openFile`,e),onShowSources:n[1]||=e=>i.selectTab(`sources`,!0)},null,8,[`evidence`,`comparison-label`])],8,Za),[[F,i.activeTab===`compare`]]),v(O(`div`,{id:`${i.panelId}-panel-sources`,role:`tabpanel`,tabindex:`0`,"aria-labelledby":`${i.panelId}-tab-sources`,class:`min-w-0 border-t border-(--dashboard-border) pt-6 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--dashboard-accent)`},[_(i.DiagnosticSourcesEvidence,{evidence:r.evidence,onOpenSource:n[2]||=e=>i.emit(`openSource`,e)},null,8,[`evidence`])],8,Qa),[[F,i.activeTab===`sources`]]),v(O(`div`,{id:`${i.panelId}-panel-verification`,role:`tabpanel`,tabindex:`0`,"aria-labelledby":`${i.panelId}-tab-verification`,class:`min-w-0 border-t border-(--dashboard-border) pt-6 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--dashboard-accent)`},[n[6]||=O(`p`,{class:`mb-5 font-mono text-xs text-(--dashboard-text-soft)`},`拟议检查 · 尚未运行`,-1),O(`div`,eo,[O(`section`,to,[n[4]||=O(`h3`,{class:`text-base font-semibold text-(--dashboard-text)`},`先补齐证据`,-1),r.evidence.steps.length?(f(),I(`ol`,no,[(f(!0),I(E,null,m(r.evidence.steps,e=>(f(),I(`li`,{key:e},t(e),1))),128))])):(f(),I(`p`,ro,`当前条目尚无可用调查步骤。`))]),O(`section`,io,[n[5]||=O(`h3`,{class:`text-base font-semibold text-(--dashboard-text)`},`判断是否解决`,-1),r.evidence.checks.length?(f(),I(`ul`,ao,[(f(!0),I(E,null,m(r.evidence.checks,e=>(f(),I(`li`,{key:e,class:`border-b border-(--dashboard-border) pb-3`},t(e),1))),128))])):(f(),I(`p`,oo,`当前条目尚无可用复验条件。`))])]),n[7]||=O(`p`,{class:`mt-5 border-l-2 border-(--dashboard-accent) pl-3 text-xs leading-5 text-(--dashboard-text-muted)`},` 只有构建通过或总量下降不足以宣称解决。需要重新读取实际测量,并验证相关页面与分包运行行为;合理增长可以保留。 `,-1)],8,$a),[[F,i.activeTab===`verification`]]),O(`footer`,so,[n[9]||=O(`p`,null,`产物数据不等于源码因果。`,-1),O(`button`,{type:`button`,"data-diagnostic-inspect":``,class:`inline-flex min-h-11 items-center gap-2 text-(--dashboard-accent) hover:underline`,onClick:n[3]||=e=>i.emit(`inspect`,r.action)},[...n[8]||=[R(` 查看完整分析 `,-1),O(`span`,{class:`icon-[mdi--arrow-right] size-4 shrink-0`,"aria-hidden":`true`},null,-1)]])])],64)):(f(),I(`div`,co,[...n[10]||=[O(`h2`,{class:`font-semibold text-(--dashboard-text)`},`当前没有预算风险或待查线索`,-1),O(`p`,{class:`mt-2 text-sm leading-6 text-(--dashboard-text-muted)`},`可从包体图继续查看产物;构建数据不代表运行时已经验收。`,-1)]]))],512)])])}var uo=z(Ua,[[`render`,lo],[`__scopeId`,`data-v-dc397ef9`]]),fo=L({__name:`HistoryBaselinePanel`,props:{snapshots:{},baselineSnapshotId:{},comparisonMode:{}},emits:[`setBaseline`,`setComparisonMode`],setup(e,{expose:t,emit:n}){t();let r=e,i=n,a=M(()=>r.comparisonMode===`baseline`&&r.baselineSnapshotId?`snapshot:${r.baselineSnapshotId}`:`previous`),o=M(()=>[{value:`previous`,label:`上次构建`},...r.snapshots.map(e=>({value:`snapshot:${e.id}`,label:`${new Date(e.capturedAt).toLocaleString(`zh-CN`,{hour12:!1})} · ${U(e.totalBytes)}`}))]);function s(e){e===`previous`?i(`setComparisonMode`,`previous`):i(`setBaseline`,e.slice(9))}let c={props:r,emit:i,selectedValue:a,options:o,selectBaseline:s,AppSelect:be};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}});function po(e,t,n,r,i,a){return f(),D(r.AppSelect,{class:`w-full max-w-72`,label:`对照基线`,variant:`toolbar`,"model-value":r.selectedValue,options:r.options,"onUpdate:modelValue":r.selectBaseline},null,8,[`model-value`,`options`])}var mo=z(fo,[[`render`,po]]),ho=L({__name:`AnalyzeDiagnosticsSection`,props:{actionItems:{},baselineSnapshotId:{},comparisonMode:{},comparisonResult:{},duplicateModules:{},historySnapshots:{},incrementAttribution:{},result:{},selectedActionKey:{}},emits:[`focusAction`,`openFile`,`openSource`,`selectAction`,`setBaseline`,`setComparisonMode`],setup(e,{expose:t,emit:n}){t();let r=e,i=n,a=M(()=>r.actionItems.find(e=>e.key===r.selectedActionKey)??r.actionItems[0]),o=M(()=>H(a.value?.targetLabel??``)),s=M(()=>o.value.slice(o.value.lastIndexOf(`/`)+1)),c=M(()=>a.value?{budget:`预算`,increment:`增长`,duplicate:`重复`}[a.value.kind]:``),l=M(()=>a.value?Br({action:a.value,result:r.result,previous:r.comparisonResult,duplicateModules:r.duplicateModules,incrementAttribution:r.incrementAttribution}):null),u={props:r,emit:i,selectedAction:a,selectedTarget:o,selectedName:s,selectedKindLabel:c,evidence:l,classificationLabel:M(()=>l.value?{problem:`超出预算`,risk:`预算风险`,clue:`待查线索`,unknown:`测量不完整`}[l.value.classification]:``),comparisonLabel:M(()=>r.comparisonResult?r.comparisonMode===`baseline`?`浏览器选定基线`:`上次构建(浏览器对照)`:`无历史基线,不推断增长`),primaryArtifact:M(()=>l.value?.artifacts[0]?.entry??null),get dashboardAnalyzeRevision(){return Ce},ActionCenterPanel:gi,DiagnosticEvidencePanel:uo,HistoryBaselinePanel:mo};return Object.defineProperty(u,"__isScriptSetup",{enumerable:!1,value:!0}),u}}),go={class:`grid min-w-0 content-start gap-5`,"aria-label":`问题与证据`},_o={class:`mt-1.5 border-t border-(--dashboard-border) pt-1.5`},vo={class:`mt-3 text-xs text-(--dashboard-text-soft)`},yo={key:0},bo={class:`flex min-w-0 flex-wrap items-start justify-between gap-3`},xo={class:`min-w-0 flex-1 basis-64`},So={class:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1`},Co={"data-diagnostic-object":``,class:`min-w-0 font-mono text-base font-semibold leading-6 text-(--dashboard-text) [overflow-wrap:anywhere]`},wo={class:`rounded-sm border border-(--dashboard-border) px-1.5 py-0.5 text-xs text-(--dashboard-text-muted)`},To={key:0,"data-diagnostic-object-path":``,class:`mt-1 font-mono text-xs leading-5 text-(--dashboard-text-soft) [overflow-wrap:anywhere]`};function Eo(e,n,r,i,a,s){return f(),I(`section`,go,[_(i.DiagnosticEvidencePanel,{action:i.selectedAction,evidence:i.evidence,"comparison-label":i.comparisonLabel,onOpenFile:n[4]||=e=>i.emit(`openFile`,e),onOpenSource:n[5]||=e=>i.emit(`openSource`,e),onInspect:n[6]||=e=>i.emit(`selectAction`,e)},re({index:c(()=>[o(e.$slots,`overview`),O(`div`,_o,[_(i.ActionCenterPanel,{actions:r.actionItems,"active-key":i.selectedAction?.key??null,onSelect:n[0]||=e=>i.emit(`focusAction`,e)},null,8,[`actions`,`active-key`])]),O(`p`,vo,[n[7]||=R(` 当前报告`,-1),i.dashboardAnalyzeRevision===null?C(``,!0):(f(),I(`span`,yo,` · R`+t(i.dashboardAnalyzeRevision),1))])]),controls:c(()=>[_(i.HistoryBaselinePanel,{snapshots:r.historySnapshots,"baseline-snapshot-id":r.baselineSnapshotId,"comparison-mode":r.comparisonMode,onSetBaseline:n[1]||=e=>i.emit(`setBaseline`,e),onSetComparisonMode:n[2]||=e=>i.emit(`setComparisonMode`,e)},null,8,[`snapshots`,`baseline-snapshot-id`,`comparison-mode`])]),_:2},[i.selectedAction?{name:`heading`,fn:c(()=>[O(`header`,bo,[O(`div`,xo,[O(`div`,So,[O(`h2`,Co,t(i.selectedName),1),O(`span`,wo,t(i.selectedKindLabel)+` · `+t(i.classificationLabel),1)]),i.selectedTarget===i.selectedName?C(``,!0):(f(),I(`p`,To,t(i.selectedTarget),1))]),i.primaryArtifact?(f(),I(`button`,{key:0,type:`button`,class:`inline-flex min-h-11 items-center justify-center rounded-lg border border-(--dashboard-border) px-3 text-sm font-medium text-(--dashboard-text-muted) hover:bg-(--dashboard-panel-muted)`,onClick:n[3]||=e=>i.emit(`openFile`,i.primaryArtifact)},` 检查关联对象 `)):C(``,!0)])]),key:`0`}:void 0]),1032,[`action`,`evidence`,`comparison-label`])])}var Do=z(ho,[[`render`,Eo]]),Oo=L({__name:`AnalyzeDraggableGrid`,props:{items:{},storageKey:{},gridClass:{}},setup(e,{expose:t}){t();let n=e,r=P([]),i=P(null),a=M(()=>new Map(n.items.map(e=>[e.id,e]))),o=M(()=>{let e=new Set(n.items.map(e=>e.id)),t=r.value.filter(t=>e.has(t)).map(e=>a.value.get(e)).filter(e=>!!e),i=n.items.filter(e=>!r.value.includes(e.id));return[...t,...i]});function s(){try{let e=window.localStorage.getItem(n.storageKey),t=e?JSON.parse(e):null;r.value=Array.isArray(t)?t.filter(e=>typeof e==`string`):n.items.map(e=>e.id)}catch{r.value=n.items.map(e=>e.id)}}function c(e){r.value=e,window.localStorage.setItem(n.storageKey,JSON.stringify(e))}function l(e,t){i.value=e.id,t.dataTransfer?.setData(`text/plain`,e.id),t.dataTransfer&&(t.dataTransfer.effectAllowed=`move`)}function u(e){let t=i.value;if(i.value=null,!t||t===e.id)return;let n=o.value.map(e=>e.id),r=n.indexOf(t),a=n.indexOf(e.id);r<0||a<0||(n.splice(r,1),n.splice(a,0,t),c(n))}function d(){c(n.items.map(e=>e.id))}k(s),y(()=>n.items.map(e=>e.id).join(`\0`),s);let f={props:n,order:r,draggingId:i,itemMap:a,orderedItems:o,readOrder:s,writeOrder:c,handleDragStart:l,handleDrop:u,resetOrder:d,AppToolButton:K,DashboardIcon:pe};return Object.defineProperty(f,"__isScriptSetup",{enumerable:!1,value:!0}),f}}),ko=[`onDrop`],Ao={key:0,class:`absolute inset-x-0 top-0 z-10 flex -translate-y-1/2 items-center justify-center gap-2 px-2`},jo=[`aria-label`,`title`,`onDragstart`],Mo={class:`h-4 w-4`,"aria-hidden":`true`},No={class:`min-h-0 min-w-0 max-w-full`};function Po(e,t,n,r,i,a){return f(),I(`section`,{class:x(n.gridClass)},[(f(!0),I(E,null,m(r.orderedItems,n=>(f(),I(`article`,{key:n.id,class:x([`relative grid min-h-0 min-w-0 max-w-full rounded-lg border border-dashed border-transparent transition`,[n.className,r.orderedItems.length>1?`pt-2`:``,r.draggingId===n.id?`border-(--dashboard-accent) opacity-70`:``]]),onDragover:t[1]||=T(()=>{},[`prevent`]),onDrop:e=>r.handleDrop(n)},[r.orderedItems.length>1?(f(),I(`div`,Ao,[O(`button`,{class:`inline-flex h-7 w-7 shrink-0 cursor-grab items-center justify-center rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-strong) text-(--dashboard-text-soft) shadow-(--dashboard-shadow) transition hover:border-(--dashboard-border-strong) hover:text-(--dashboard-text)`,draggable:`true`,type:`button`,"aria-label":`拖动调整${n.label}模块位置`,title:`拖动调整${n.label}模块位置`,onDragend:t[0]||=e=>r.draggingId=null,onDragstart:e=>r.handleDragStart(n,e)},[O(`span`,Mo,[_(r.DashboardIcon,{name:`metric-drag`})])],40,jo),r.orderedItems.length>1&&n.id===r.orderedItems[0]?.id?(f(),D(r.AppToolButton,{key:0,class:`absolute right-2 shadow-(--dashboard-shadow)`,label:`重置模块布局`,"icon-name":`metric-reset`,"touch-label":`重置`,onClick:r.resetOrder})):C(``,!0)])):C(``,!0),O(`div`,No,[o(e.$slots,n.id,{item:n})])],42,ko))),128))],2)}var Fo=z(Oo,[[`render`,Po]]),Io=L({__name:`AppPanelHeader`,props:{iconName:{},title:{},description:{}},setup(e,{expose:t}){t();let n={iconClassName:je(),DashboardIcon:pe};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),Lo={class:`flex items-center justify-between gap-3`},Ro={class:`flex items-center gap-2`},zo={class:`h-5 w-5`},Bo={class:`min-w-0 md:flex md:flex-wrap md:items-baseline md:gap-x-2`},Vo={class:`text-lg font-semibold text-(--dashboard-text)`},Ho={key:0,class:`text-xs text-(--dashboard-text-soft) md:text-sm`};function Uo(e,n,r,i,a,s){return f(),I(`div`,Lo,[O(`div`,Ro,[O(`span`,{class:x(i.iconClassName)},[O(`span`,zo,[_(i.DashboardIcon,{name:r.iconName},null,8,[`name`])])],2),O(`div`,Bo,[O(`h2`,Vo,t(r.title),1),r.description?(f(),I(`p`,Ho,t(r.description),1)):C(``,!0)])]),o(e.$slots,`meta`)])}var Wo=z(Io,[[`render`,Uo]]),Go=L({__name:`AnalyzeWorkQueuePanel`,props:{items:{},activeId:{}},emits:[`clearCompleted`,`copy`,`remove`,`select`,`toggle`],setup(e,{expose:t,emit:n}){t();let r=e,i=n,a=u(`open`),o=M(()=>r.items.filter(e=>!e.completedAt).length),s=M(()=>r.items.length-o.value),c=M(()=>r.items.filter(e=>a.value===`open`?!e.completedAt:a.value!==`done`||!!e.completedAt));function l(e){return Ae(e===`critical`?{tone:`error`}:e===`warning`?{tone:`warning`}:e===`success`?{tone:`success`}:{tone:`info`})}let d={props:r,emit:i,queueFilter:a,openCount:o,doneCount:s,visibleItems:c,getToneClassName:l,get surfaceStyles(){return Me},AppEmptyState:G,AppPanelHeader:Wo,AppToolButton:K};return Object.defineProperty(d,"__isScriptSetup",{enumerable:!1,value:!0}),d}}),Ko={class:`mt-3 grid gap-2`},qo={class:`grid grid-cols-3 gap-2 text-center`},Jo={class:`mt-3 max-h-[32rem] min-h-0 overflow-y-auto xl:max-h-none xl:overflow-hidden`},Yo={key:1,class:`grid h-full min-h-0 content-start gap-2 overflow-y-auto pr-1`},Xo={class:`flex items-start justify-between gap-2`},Zo=[`onClick`],Qo={class:`mt-2 truncate text-sm font-medium text-(--dashboard-text)`},$o={class:`mt-1 line-clamp-2 text-xs leading-5 text-(--dashboard-text-soft)`},es={key:0,class:`shrink-0 text-xs font-medium text-(--dashboard-accent)`},ts={class:`flex items-center justify-between gap-2 border-t border-(--dashboard-border) pt-2`},ns=[`onClick`],rs=[`onClick`];function is(e,n,r,i,a,o){return f(),I(`section`,{class:x([i.surfaceStyles({padding:`md`}),`grid min-h-0 min-w-0 gap-3 overflow-visible xl:h-full xl:grid-rows-[auto_auto_minmax(0,1fr)] xl:overflow-hidden`])},[_(i.AppPanelHeader,{"icon-name":`metric-bookmark`,title:`处理清单`},{meta:c(()=>[_(i.AppToolButton,{label:`复制处理清单`,"icon-name":`metric-copy`,"touch-label":`复制`,disabled:r.items.length===0,onClick:n[0]||=e=>i.emit(`copy`)},null,8,[`disabled`])]),_:1}),O(`div`,Ko,[O(`div`,qo,[O(`button`,{type:`button`,class:x([`rounded-md border px-2 py-2 text-xs transition`,i.queueFilter===`open`?`border-(--dashboard-accent) bg-(--dashboard-accent-soft) text-(--dashboard-text)`:`border-(--dashboard-border) bg-(--dashboard-panel-muted) text-(--dashboard-text-soft) hover:border-(--dashboard-border-strong)`]),onClick:n[1]||=e=>i.queueFilter=`open`},` 待处理 `+t(i.openCount),3),O(`button`,{type:`button`,class:x([`rounded-md border px-2 py-2 text-xs transition`,i.queueFilter===`done`?`border-(--dashboard-accent) bg-(--dashboard-accent-soft) text-(--dashboard-text)`:`border-(--dashboard-border) bg-(--dashboard-panel-muted) text-(--dashboard-text-soft) hover:border-(--dashboard-border-strong)`]),onClick:n[2]||=e=>i.queueFilter=`done`},` 已完成 `+t(i.doneCount),3),O(`button`,{type:`button`,class:x([`rounded-md border px-2 py-2 text-xs transition`,i.queueFilter===`all`?`border-(--dashboard-accent) bg-(--dashboard-accent-soft) text-(--dashboard-text)`:`border-(--dashboard-border) bg-(--dashboard-panel-muted) text-(--dashboard-text-soft) hover:border-(--dashboard-border-strong)`]),onClick:n[3]||=e=>i.queueFilter=`all`},` 全部 `+t(r.items.length),3)]),i.doneCount>0?(f(),I(`button`,{key:0,type:`button`,class:`h-8 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-3 text-xs text-(--dashboard-text-soft) transition hover:border-(--dashboard-border-strong) hover:text-(--dashboard-text)`,onClick:n[4]||=e=>i.emit(`clearCompleted`)},` 清空已完成 `)):C(``,!0)]),O(`div`,Jo,[i.visibleItems.length===0?(f(),D(i.AppEmptyState,{key:0,compact:``},{default:c(()=>[...n[5]||=[R(` 当前没有处理事项。 `,-1)]]),_:1})):(f(),I(`ol`,Yo,[(f(!0),I(E,null,m(i.visibleItems,e=>(f(),I(`li`,{key:e.id,class:x([`grid gap-2 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) p-2.5 transition`,r.activeId===e.id?`border-(--dashboard-accent) bg-(--dashboard-accent-soft)`:void 0])},[O(`div`,Xo,[O(`button`,{type:`button`,class:`min-w-0 text-left`,onClick:t=>i.emit(`select`,e)},[O(`span`,{class:x(i.getToneClassName(e.tone))},t(e.completedAt?`完成`:`待处理`),3),O(`p`,Qo,t(e.title),1),O(`p`,$o,t(e.meta),1)],8,Zo),e.value?(f(),I(`span`,es,t(e.value),1)):C(``,!0)]),O(`div`,ts,[O(`button`,{type:`button`,class:`rounded-full border border-(--dashboard-border) px-2.5 py-1 text-[11px] text-(--dashboard-text-soft) transition hover:border-(--dashboard-border-strong) hover:text-(--dashboard-text)`,onClick:t=>i.emit(`toggle`,e.id)},t(e.completedAt?`重新打开`:`标记完成`),9,ns),O(`button`,{type:`button`,class:`rounded-full border border-(--dashboard-border) px-2.5 py-1 text-[11px] text-(--dashboard-text-soft) transition hover:border-rose-300 hover:text-rose-500`,onClick:t=>i.emit(`remove`,e.id)},` 移除 `,8,rs)])],2))),128))]))])],2)}var as=z(Go,[[`render`,is]]);function os(e){return e>=1048576?`${(e/1024/1024).toFixed(e%1048576==0?0:2)} MB`:e>=1024?`${(e/1024).toFixed(e%1024==0?0:2)} KB`:`${e} B`}function ss(e){return e?Yn(e).filter(e=>e.status!==`ok`).map(e=>({...e,status:e.status===`unknown`?`unknown`:e.status===`exceeded`?`critical`:`warning`})):[]}function cs(e){let t=e?.metadata?.budgets,n=t?.source??`default`;return[{key:`total`,label:`总包预算`,value:`${os(t?.totalBytes??20971520)}`,source:n},{key:`main`,label:`主包预算`,value:`${os(t?.mainBytes??2097152)}`,source:n},{key:`subPackage`,label:`分包预算`,value:`${os(t?.subPackageBytes??2097152)}`,source:n},{key:`independent`,label:`独立分包预算`,value:`${os(t?.independentBytes??2097152)}`,source:n}]}var Z={totalBytes:20971520,mainBytes:2097152,subPackageBytes:2097152,independentBytes:2097152,warningRatio:.85,source:`default`},Q=1048576,ls=[{id:`wechat-default`,label:`平台上限`,detail:`按小程序常见包体限制和 85% 预警线评估。`,config:{totalBytes:20*Q,mainBytes:2*Q,subPackageBytes:2*Q,independentBytes:2*Q,warningRatio:.85}},{id:`release-buffer`,label:`发布缓冲`,detail:`保留更早预警空间,适合发版前巡检。`,config:{totalBytes:20*Q,mainBytes:2*Q,subPackageBytes:2*Q,independentBytes:2*Q,warningRatio:.75}},{id:`near-limit`,label:`临界排查`,detail:`只标记接近上限的包,适合聚焦最紧急项。`,config:{totalBytes:20*Q,mainBytes:2*Q,subPackageBytes:2*Q,independentBytes:2*Q,warningRatio:.95}}];function us(e,t){return Number.isFinite(e)&&e>0?Math.round(e):t}function ds(e){return Number.isFinite(e)?Math.min(.99,Math.max(.01,e)):Z.warningRatio}function fs(e){return{totalBytes:us(e?.totalBytes??Z.totalBytes,Z.totalBytes),mainBytes:us(e?.mainBytes??Z.mainBytes,Z.mainBytes),subPackageBytes:us(e?.subPackageBytes??Z.subPackageBytes,Z.subPackageBytes),independentBytes:us(e?.independentBytes??Z.independentBytes,Z.independentBytes),warningRatio:ds(e?.warningRatio??Z.warningRatio),...e?.runtimeBytes===void 0?{}:{runtimeBytes:e.runtimeBytes},...e?.packageBytes===void 0?{}:{packageBytes:e.packageBytes}}}function ps(e,t){return e.totalBytes===t.totalBytes&&e.mainBytes===t.mainBytes&&e.subPackageBytes===t.subPackageBytes&&e.independentBytes===t.independentBytes&&e.warningRatio===t.warningRatio}function ms(e){let t=fs(e);return ls.find(e=>ps(fs(e.config),t))}function hs(e){return ss({packages:e.result.packages,artifacts:e.result.artifacts,metadata:{budgets:{...fs(e.config),source:`config`}}})}function gs(e){let t=fs(e);return[`analyze: {`,` budgets: {`,` totalBytes: ${t.totalBytes},`,` mainBytes: ${t.mainBytes},`,` subPackageBytes: ${t.subPackageBytes},`,` independentBytes: ${t.independentBytes},`,` warningRatio: ${t.warningRatio},`,...t.runtimeBytes===void 0?[]:[` runtimeBytes: ${t.runtimeBytes},`],...t.packageBytes===void 0?[]:[` packageBytes: ${JSON.stringify(t.packageBytes)},`],` },`,`},`].join(`
4
- `)}var _s=L({__name:`AppCompactListItem`,props:{title:{},meta:{},value:{},monoTitle:{type:Boolean},clickable:{type:Boolean},active:{type:Boolean}},emits:[`select`],setup(e,{expose:t,emit:n}){t();let r={emit:n};return Object.defineProperty(r,"__isScriptSetup",{enumerable:!1,value:!0}),r}}),vs={class:`flex items-start justify-between gap-3`},ys={class:`min-w-0`},bs={class:`mt-1 line-clamp-2 break-words text-xs leading-5 text-(--dashboard-text-soft)`},xs={key:0,class:`max-w-[40%] shrink-0 truncate font-medium text-(--dashboard-accent)`},Ss={key:1,class:`list-none`},Cs={class:`flex items-start justify-between gap-3`},ws={class:`min-w-0`},Ts={class:`mt-1 line-clamp-2 break-words text-xs leading-5 text-(--dashboard-text-soft)`},Es={key:0,class:`max-w-[40%] shrink-0 truncate font-medium text-(--dashboard-accent)`};function Ds(e,n,r,i,a,o){return r.clickable?(f(),I(`li`,Ss,[O(`button`,{type:`button`,class:x([`w-full rounded-xl border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-3 py-2.5 text-left transition hover:border-(--dashboard-border-strong) hover:bg-(--dashboard-panel)`,r.active?`border-(--dashboard-accent) bg-(--dashboard-accent-soft)`:void 0]),onClick:n[0]||=e=>i.emit(`select`)},[O(`div`,Cs,[O(`div`,ws,[O(`p`,{class:x([`font-medium`,r.monoTitle?`line-clamp-2 break-all font-mono text-xs leading-5 text-(--dashboard-text)`:`line-clamp-2 break-words leading-5 text-(--dashboard-text)`])},t(r.title),3),O(`p`,Ts,t(r.meta),1)]),r.value?(f(),I(`span`,Es,t(r.value),1)):C(``,!0)])],2)])):(f(),I(`li`,{key:0,class:x([`rounded-xl border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-3 py-2.5`,r.active?`border-(--dashboard-accent) bg-(--dashboard-accent-soft)`:void 0])},[O(`div`,vs,[O(`div`,ys,[O(`p`,{class:x([`font-medium`,r.monoTitle?`line-clamp-2 break-all font-mono text-xs leading-5 text-(--dashboard-text)`:`line-clamp-2 break-words leading-5 text-(--dashboard-text)`])},t(r.title),3),O(`p`,bs,t(r.meta),1)]),r.value?(f(),I(`span`,xs,t(r.value),1)):C(``,!0)])],2))}var Os=z(_s,[[`render`,Ds]]),ks=L({__name:`BudgetSandboxPanel`,props:{activeBudgetWarningId:{},currentWarnings:{},result:{}},emits:[`selectBudgetWarning`],setup(e,{expose:t,emit:r}){t();let i=e,a=r,o=s({totalMiB:0,mainMiB:0,subPackageMiB:0,independentMiB:0,warningPercent:85}),c=s({text:``,timer:null});function l(e){return e/1048576}function u(e){return Math.max(1,Math.round((Number.isFinite(e)?e:0)*1024*1024))}function d(){return fs(i.result.metadata?.budgets??Z)}function f(){let e=d();o.totalMiB=l(e.totalBytes),o.mainMiB=l(e.mainBytes),o.subPackageMiB=l(e.subPackageBytes),o.independentMiB=l(e.independentBytes),o.warningPercent=Math.round(e.warningRatio*100)}let p=M(()=>fs({...i.result.metadata?.budgets,totalBytes:u(o.totalMiB),mainBytes:u(o.mainMiB),subPackageBytes:u(o.subPackageMiB),independentBytes:u(o.independentMiB),warningRatio:o.warningPercent/100})),m=M(()=>hs({result:i.result,config:p.value})),h=M(()=>ms(p.value)?.id??null),g=M(()=>new Set(i.currentWarnings.map(e=>e.id))),_=M(()=>new Set(m.value.map(e=>e.id))),v=M(()=>m.value.filter(e=>!g.value.has(e.id)).length),b=M(()=>i.currentWarnings.filter(e=>!_.value.has(e.id)).length),x=M(()=>gs(p.value)),S=M(()=>m.value.slice(0,6).map(e=>({key:e.id,warning:e,active:i.activeBudgetWarningId===e.id,title:e.label,meta:e.status===`unknown`?`体积或归因不完整,无法验收`:`${e.status===`critical`?`超预算`:`接近预算`} · ${(e.ratio*100).toFixed(1)}%`,value:`${U(e.currentBytes)} / ${U(e.limitBytes)}`})));function C(e){c.text=e,c.timer&&clearTimeout(c.timer),c.timer=setTimeout(()=>{c.text=``,c.timer=null},1800)}function w(e){let t=ls.find(t=>t.id===e);if(!t)return;let n=fs(t.config);o.totalMiB=l(n.totalBytes),o.mainMiB=l(n.mainBytes),o.subPackageMiB=l(n.subPackageBytes),o.independentMiB=l(n.independentBytes),o.warningPercent=Math.round(n.warningRatio*100),C(`已应用 ${t.label}`)}async function T(){try{await W(x.value),C(`已复制`)}catch{C(`复制失败`)}}y(()=>i.result.metadata?.budgets,f,{immediate:!0}),n(()=>{c.timer&&clearTimeout(c.timer)});let E={props:i,emit:a,draft:o,actionStatus:c,bytesToMiB:l,mibToBytes:u,getInitialConfig:d,resetDraft:f,sandboxConfig:p,projectedWarnings:m,activePresetId:h,currentWarningIds:g,projectedWarningIds:_,newWarningCount:v,resolvedWarningCount:b,snippetText:x,projectedWarningItems:S,setActionStatus:C,applyPreset:w,copyBudgetSnippet:T,get budgetSandboxPresets(){return ls},AppCompactListItem:Os,AppEmptyState:G,AppToolButton:K};return Object.defineProperty(E,"__isScriptSetup",{enumerable:!1,value:!0}),E}}),As={class:`grid min-h-0 min-w-0 gap-3 overflow-visible rounded-lg border border-(--dashboard-border) bg-(--dashboard-panel) p-3 shadow-(--dashboard-shadow) xl:h-full xl:grid-rows-[auto_minmax(0,1fr)] xl:overflow-hidden`},js={class:`mb-2 flex items-center justify-between gap-3`},Ms={class:`min-w-0`},Ns={class:`mt-1 text-xs text-(--dashboard-text-soft)`},Ps={key:0,class:`text-xs font-medium text-(--dashboard-accent)`},Fs={class:`grid min-h-0 min-w-0 gap-3 overflow-visible xl:grid-rows-[auto_auto_auto_minmax(0,1fr)] xl:overflow-hidden`},Is={class:`grid gap-2 sm:grid-cols-3`},Ls=[`onClick`],Rs={class:`block truncate text-xs font-semibold`},zs={class:`mt-1 line-clamp-2 block text-[11px] leading-4 opacity-80`},Bs={class:`grid gap-2 sm:grid-cols-2`},Vs={class:`grid gap-1 text-[11px] text-(--dashboard-text-soft)`},Hs={class:`grid gap-1 text-[11px] text-(--dashboard-text-soft)`},Us={class:`grid gap-1 text-[11px] text-(--dashboard-text-soft)`},Ws={class:`grid gap-1 text-[11px] text-(--dashboard-text-soft)`},Gs={class:`grid gap-2`},Ks={class:`grid gap-1 text-[11px] text-(--dashboard-text-soft)`},qs={class:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-2`},Js={class:`max-h-80 min-h-0 overflow-y-auto pr-1 xl:max-h-none`},Ys={key:1,class:`grid content-start gap-2 text-sm text-(--dashboard-text-muted)`};function Xs(e,n,r,i,a,o){return f(),I(`section`,As,[O(`div`,js,[O(`div`,Ms,[n[5]||=O(`h3`,{class:`text-sm font-semibold text-(--dashboard-text)`},` 预算沙盘 `,-1),O(`p`,Ns,` 预测 `+t(i.projectedWarnings.length)+` 个告警 · 新增 `+t(i.newWarningCount)+` · 解除 `+t(i.resolvedWarningCount),1)]),i.actionStatus.text?(f(),I(`span`,Ps,t(i.actionStatus.text),1)):C(``,!0)]),O(`div`,Fs,[O(`div`,Is,[(f(!0),I(E,null,m(i.budgetSandboxPresets,e=>(f(),I(`button`,{key:e.id,class:x([`rounded-md border px-2 py-2 text-left transition`,i.activePresetId===e.id?`border-(--dashboard-accent) bg-(--dashboard-accent-soft) text-(--dashboard-text)`:`border-(--dashboard-border) bg-(--dashboard-panel-muted) text-(--dashboard-text-soft) hover:border-(--dashboard-border-strong) hover:text-(--dashboard-text)`]),type:`button`,onClick:t=>i.applyPreset(e.id)},[O(`span`,Rs,t(e.label),1),O(`span`,zs,t(e.detail),1)],10,Ls))),128))]),O(`div`,Bs,[O(`label`,Vs,[n[6]||=R(` 总包 MB `,-1),v(O(`input`,{"onUpdate:modelValue":n[0]||=e=>i.draft.totalMiB=e,class:`h-8 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-2 text-sm text-(--dashboard-text) outline-none focus:border-(--dashboard-accent)`,min:`0.01`,step:`0.01`,type:`number`},null,512),[[j,i.draft.totalMiB,void 0,{number:!0}]])]),O(`label`,Hs,[n[7]||=R(` 主包 MB `,-1),v(O(`input`,{"onUpdate:modelValue":n[1]||=e=>i.draft.mainMiB=e,class:`h-8 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-2 text-sm text-(--dashboard-text) outline-none focus:border-(--dashboard-accent)`,min:`0.01`,step:`0.01`,type:`number`},null,512),[[j,i.draft.mainMiB,void 0,{number:!0}]])]),O(`label`,Us,[n[8]||=R(` 分包 MB `,-1),v(O(`input`,{"onUpdate:modelValue":n[2]||=e=>i.draft.subPackageMiB=e,class:`h-8 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-2 text-sm text-(--dashboard-text) outline-none focus:border-(--dashboard-accent)`,min:`0.01`,step:`0.01`,type:`number`},null,512),[[j,i.draft.subPackageMiB,void 0,{number:!0}]])]),O(`label`,Ws,[n[9]||=R(` 独立分包 MB `,-1),v(O(`input`,{"onUpdate:modelValue":n[3]||=e=>i.draft.independentMiB=e,class:`h-8 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-2 text-sm text-(--dashboard-text) outline-none focus:border-(--dashboard-accent)`,min:`0.01`,step:`0.01`,type:`number`},null,512),[[j,i.draft.independentMiB,void 0,{number:!0}]])])]),O(`div`,Gs,[O(`label`,Ks,[R(` 预警线 `+t(i.draft.warningPercent)+`% `,1),v(O(`input`,{"onUpdate:modelValue":n[4]||=e=>i.draft.warningPercent=e,class:`accent-(--dashboard-accent)`,max:`99`,min:`1`,step:`1`,type:`range`},null,512),[[j,i.draft.warningPercent,void 0,{number:!0}]])]),O(`div`,qs,[O(`button`,{class:`h-8 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-3 text-xs text-(--dashboard-text-soft) transition hover:border-(--dashboard-border-strong) hover:text-(--dashboard-text)`,type:`button`,onClick:i.resetDraft},` 重置 `),_(i.AppToolButton,{label:`复制预算配置`,"icon-name":`metric-copy`,"touch-label":`复制`,onClick:i.copyBudgetSnippet})])]),O(`div`,Js,[i.projectedWarningItems.length===0?(f(),D(i.AppEmptyState,{key:0,compact:``},{default:c(()=>[...n[10]||=[R(` 当前沙盘预算下没有预计告警。 `,-1)]]),_:1})):(f(),I(`ul`,Ys,[(f(!0),I(E,null,m(i.projectedWarningItems,e=>(f(),D(i.AppCompactListItem,{key:e.key,active:e.active,clickable:``,meta:e.meta,title:e.title,value:e.value,onSelect:t=>i.emit(`selectBudgetWarning`,e.warning)},null,8,[`active`,`meta`,`title`,`value`,`onSelect`]))),128))]))])])])}var Zs=z(ks,[[`render`,Xs]]);function Qs(e,t){return!!e&&!!t&&e.sessionId===t.sessionId&&e.revision===t.revision&&e.reportHash===t.reportHash}function $s(e){let t=P(null),n=P(null),r=P(``),i=P(null),a=P(``),o=P(``),s=P(``),c=P(null),l=P(``),u=P(null),d=!1,f=0,p=null;function m(e){f+=1,i.value=e,c.value=null,u.value=null,e&&e!==p&&(p=e,l.value=``),o.value=``,s.value=``}let h=M(()=>xe.value.items),g=M(()=>h.value.find(e=>e.id===i.value)??null),_=M(()=>ge.value===`connected`&&V.value!==null),v=M(()=>a.value!==``),x=M(()=>t.value?t.value.report?_.value?Qs(t.value.report,V.value)?``:`草稿绑定的报告已过期。不会自动改绑;可明确用当前报告新建草稿并保留问题。`:`宿主未连接或报告正在同步;草稿与问题已保留。`:`创建草稿时报告尚未就绪。连接后请明确绑定当前报告。`:`请从关联对象创建调查草稿。`),C=M(()=>!v.value&&!x.value&&r.value.trim().length>0&&r.value.trim().length<=4096),w=M(()=>_.value&&!v.value&&!!g.value&&[`submitted`,`claimed`,`proposed`,`authorized`,`executing`].includes(g.value.status)),T=M(()=>_.value&&!v.value&&g.value?.status===`proposed`&&!!g.value.proposal&&Qs(g.value.report,V.value)),E=M(()=>{let e=g.value,t=V.value;return!e||e.status!==`completed`?`只有外部 Agent 回报完成的任务才能进行人工复验。`:!_.value||!t?`请等待当前报告同步完成;复验摘要已保留。`:t.sessionId!==e.report.sessionId||t.revision<=e.report.revision?`请先生成同一宿主会话中的更新报告,再检查实际结果。`:``}),D=M(()=>!v.value&&!E.value&&!!u.value&&!!l.value.trim()&&l.value.trim().length<=4096);y(()=>S(e.requestId),()=>{let i=S(e.request);if(!i)return;let a=V.value,o={target:{...i},report:a?{...a}:null};m(null),t.value?(n.value=o,s.value=`已有未提交草稿;新对象不会覆盖它,请选择保留或替换。`):(t.value=o,r.value=``)},{immediate:!0}),y([g,V,ge],()=>{let e=g.value,t=c.value;(!_.value||!e||!t||e.id!==t.id||e.version!==t.version||e.proposal?.id!==t.proposalId||!Qs(e.report,V.value))&&(c.value=null);let n=u.value;(!_.value||!e||!n||e.id!==n.id||e.version!==n.version||!Qs(n.report,V.value))&&(u.value=null)},{flush:`sync`}),b(()=>{d=!0});function O(){n.value&&!v.value&&(t.value=n.value,n.value=null,r.value=``,m(null),s.value=`已替换为明确选择的新对象;尚未提交。`)}function k(){n.value=null,s.value=`已保留原对象、报告和问题。`}function A(){v.value||(t.value=null,n.value=null,r.value=``,o.value=``,s.value=`本地草稿已取消,没有发送调查。`)}function j(){let e=V.value;t.value&&_.value&&e&&!v.value&&(t.value={target:{...t.value.target},report:{...e}},s.value=`已明确为原对象创建当前报告草稿,保留问题;提交时宿主会重新检查对象是否存在。`,o.value=``)}async function N(e,t){if(v.value||d)return;let n=V.value?.sessionId,r=f;a.value=e,o.value=``,s.value=``;try{let e=await t();if(!d&&V.value?.sessionId===n)return e}catch(e){!d&&f===r&&(!V.value||V.value.sessionId===n)&&(o.value=`${e instanceof Error?e.message:String(e)} 未确认操作成功,请检查任务列表后再决定是否重试。输入已保留。`)}finally{d||(a.value=``)}}async function ee(){let e=t.value;if(!C.value||!e?.report)return;let n=r.value,i=f,a=await N(`submit`,()=>he({report:e.report,target:e.target,question:n.trim()}));a&&(t.value===e&&r.value===n&&(t.value=null,r.value=``),f===i&&(m(a.id),s.value=`调查已由宿主接收;创建任务不授予文件修改或执行权限。`))}function te(e){let t=g.value;c.value=e&&T.value&&t?.proposal?{id:t.id,version:t.version,proposalId:t.proposal.id}:null}async function ne(){if(!T.value||!c.value)return;let e=c.value,t=f;await N(`authorize`,()=>Se(e))&&f===t&&(s.value=`宿主已接受此提案的授权。执行仍由外部 Agent 与其工作区权限控制。`)}async function F(){let e=g.value;if(!w.value||!e)return;let t=f;await N(`cancel`,()=>we({id:e.id,version:e.version}))&&f===t&&(s.value=`宿主已取消此调查,后续回报将被拒绝;外部进程不会因此停止,请在外部客户端处理。`)}function I(e){let t=g.value,n=V.value;u.value=e&&!E.value&&t&&n?{id:t.id,version:t.version,report:{...n}}:null}async function L(){if(!D.value||!u.value)return;let e={...u.value,summary:l.value.trim()},t=f;await N(`verify`,()=>ve(e))&&f===t&&(s.value=`宿主已记录你的人工复验结论与新报告测量;这不是自动验证 Agent 回报。`)}async function R(){o.value=``;try{await ye()}catch(e){d||(o.value=e instanceof Error?e.message:String(e))}}return{draft:t,pendingDraft:n,question:r,selectedId:i,tasks:h,selectedTask:g,connected:_,busy:v,pendingAction:a,error:o,notice:s,draftIssue:x,canSubmit:C,canCancel:w,canAuthorize:T,authorization:c,verificationSummary:l,verification:u,verificationIssue:E,canVerify:D,selectTask:m,replaceDraft:O,keepDraft:k,cancelDraft:A,renewDraft:j,submitDraft:ee,confirmAuthorization:te,authorizeProposal:ne,cancelTask:F,confirmVerification:I,verifyTask:L,reconnect:R}}var ec={submitted:`等待外部 Agent 领取`,claimed:`已领取 · 等待提案`,proposed:`提案待你授权`,authorized:`已授权 · 等待外部执行`,executing:`Agent 已报告开始执行`,completed:`Agent 回报完成 · 待复验`,failed:`Agent 回报失败`,cancelled:`调查已取消`,stale:`原报告已过期`,verified:`已记录人工复验`};function tc(e){return e.kind===`package`?`包 ${e.packageId}`:e.kind===`artifact`?`${e.packageId} / ${e.file}`:`${e.packageId} / ${e.file} → ${e.moduleId}`}var nc=L({__name:`InvestigationDraftForm`,props:{draft:{},question:{},issue:{},canSubmit:{type:Boolean},canRenew:{type:Boolean},busy:{type:Boolean}},emits:[`update:question`,`submit`,`cancel`,`renew`],setup(e,{expose:t,emit:n}){t();let r={props:e,emit:n,id:d(),get investigationTargetLabel(){return tc}};return Object.defineProperty(r,"__isScriptSetup",{enumerable:!1,value:!0}),r}}),rc=[`aria-labelledby`],ic=[`id`],ac={class:`border-l-2 border-(--dashboard-accent) bg-(--dashboard-panel) px-4 py-3`},oc={class:`mt-1 break-all font-mono text-sm text-(--dashboard-text)`},sc={key:0,class:`mt-2 text-xs leading-6 text-(--dashboard-text-muted)`},cc={class:`cursor-pointer`},lc={class:`break-all font-mono`},uc={class:`break-all font-mono`},dc={key:1,class:`mt-2 text-sm text-(--dashboard-text-muted)`},fc=[`for`],pc=[`id`,`value`,`disabled`,`aria-describedby`],mc=[`id`],hc={class:`flex flex-wrap gap-2`},gc=[`disabled`],_c=[`disabled`],vc=[`disabled`];function yc(e,n,r,i,a,o){return f(),I(`form`,{class:`grid gap-4`,"aria-labelledby":`${i.id}-heading`,onSubmit:n[3]||=T(e=>i.emit(`submit`),[`prevent`])},[O(`div`,null,[n[4]||=O(`p`,{class:`font-mono text-xs text-(--dashboard-accent)`},`01 / 本地草稿`,-1),O(`h3`,{id:`${i.id}-heading`,class:`mt-1 text-base font-semibold text-(--dashboard-text)`},`先定义问题,再提交调查`,8,ic),n[5]||=O(`p`,{class:`mt-2 text-sm leading-6 text-(--dashboard-text-muted)`},`浏览其他对象不会改变此草稿。提交只创建任务,不会自动调用 Agent 或授予执行权限。`,-1)]),O(`div`,ac,[n[7]||=O(`p`,{class:`text-xs text-(--dashboard-text-soft)`},`已冻结对象`,-1),O(`p`,oc,t(i.investigationTargetLabel(r.draft.target)),1),r.draft.report?(f(),I(`details`,sc,[O(`summary`,cc,`绑定报告 r`+t(r.draft.report.revision)+` · 查看会话与完整摘要`,1),O(`p`,lc,`会话 `+t(r.draft.report.sessionId),1),O(`p`,uc,`报告 SHA-256 `+t(r.draft.report.reportHash),1),n[6]||=O(`p`,null,`这是报告身份,不是磁盘源码内容的快照或哈希。`,-1)])):(f(),I(`p`,dc,`尚未绑定可用报告`))]),O(`div`,null,[O(`label`,{for:`${i.id}-question`,class:`block text-sm font-medium text-(--dashboard-text)`},`调查问题与预期结果`,8,fc),O(`textarea`,{id:`${i.id}-question`,value:r.question,disabled:r.busy,"aria-describedby":`${i.id}-issue`,maxlength:`4096`,required:``,rows:`4`,class:`mt-2 block w-full min-w-0 resize-y rounded-md border border-(--dashboard-border) bg-(--dashboard-bg) p-3 text-sm leading-7 text-(--dashboard-text) disabled:opacity-60`,placeholder:`例如:解释此产物的主要体积来源,给出保持现有行为的修改方案与验证步骤。`,onInput:n[0]||=e=>i.emit(`update:question`,e.target.value)},null,40,pc),O(`p`,{id:`${i.id}-issue`,role:`status`,class:`mt-2 text-sm leading-6 text-(--dashboard-text-muted)`},t(r.issue||`问题可继续编辑;对象与报告身份不随浏览选择改变。`),9,mc)]),O(`div`,hc,[O(`button`,{type:`submit`,disabled:!r.canSubmit,class:`min-h-11 rounded-md border border-(--dashboard-accent) bg-(--dashboard-accent-soft) px-4 text-sm font-semibold text-(--dashboard-accent) hover:bg-(--dashboard-panel-muted) disabled:opacity-50`},t(r.busy?`正在提交…`:`提交调查`),9,gc),r.issue?(f(),I(`button`,{key:0,type:`button`,disabled:!r.canRenew||r.busy,class:`min-h-11 rounded-md border border-(--dashboard-border) px-3 text-sm text-(--dashboard-text) hover:bg-(--dashboard-panel-muted) disabled:opacity-50`,onClick:n[1]||=e=>i.emit(`renew`)},t(i.props.draft.report?`用当前报告新建草稿,保留问题`:`明确绑定当前报告`),9,_c)):C(``,!0),O(`button`,{type:`button`,disabled:r.busy,class:`min-h-11 rounded-md px-3 text-sm text-(--dashboard-text-muted) underline-offset-4 hover:underline disabled:opacity-50`,onClick:n[2]||=e=>i.emit(`cancel`)},`取消草稿`,8,vc)])],40,rc)}var bc=z(nc,[[`render`,yc]]),xc=L({__name:`InvestigationContextCopy`,props:{task:{}},setup(e,{expose:t}){t();let n=e,i=d(),a=P(!1),o=P(``),s=r(`context`),c=M(()=>[`Dashboard 对象调查(上下文辅助,不是执行指令或授权)`,JSON.stringify({id:n.task.id,version:n.task.version,report:n.task.report,target:n.task.target,question:n.task.question,status:n.task.status},null,2),`请在已配置的 Dashboard MCP 上读取 get-dashboard-state 与 get-investigation,核实会话、报告、任务版本及状态后再领取或回报。`,`Agent 名称是自行声明;任务领取不证明在线。先提交提案,等待浏览器对精确提案的授权后再开始。`,`报告哈希不代表源码快照。文件与命令权限由外部客户端管理;Dashboard 不提供通用执行或写文件接口。`,`此处复制没有发送任务,也没有授予权限。`].join(`
4
+ `)}var _s=L({__name:`AppCompactListItem`,props:{title:{},meta:{},value:{},monoTitle:{type:Boolean},clickable:{type:Boolean},active:{type:Boolean}},emits:[`select`],setup(e,{expose:t,emit:n}){t();let r={emit:n};return Object.defineProperty(r,"__isScriptSetup",{enumerable:!1,value:!0}),r}}),vs={class:`flex items-start justify-between gap-3`},ys={class:`min-w-0`},bs={class:`mt-1 line-clamp-2 break-words text-xs leading-5 text-(--dashboard-text-soft)`},xs={key:0,class:`max-w-[40%] shrink-0 truncate font-medium text-(--dashboard-accent)`},Ss={key:1,class:`list-none`},Cs={class:`flex items-start justify-between gap-3`},ws={class:`min-w-0`},Ts={class:`mt-1 line-clamp-2 break-words text-xs leading-5 text-(--dashboard-text-soft)`},Es={key:0,class:`max-w-[40%] shrink-0 truncate font-medium text-(--dashboard-accent)`};function Ds(e,n,r,i,a,o){return r.clickable?(f(),I(`li`,Ss,[O(`button`,{type:`button`,class:x([`w-full rounded-xl border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-3 py-2.5 text-left transition hover:border-(--dashboard-border-strong) hover:bg-(--dashboard-panel)`,r.active?`border-(--dashboard-accent) bg-(--dashboard-accent-soft)`:void 0]),onClick:n[0]||=e=>i.emit(`select`)},[O(`div`,Cs,[O(`div`,ws,[O(`p`,{class:x([`font-medium`,r.monoTitle?`line-clamp-2 break-all font-mono text-xs leading-5 text-(--dashboard-text)`:`line-clamp-2 break-words leading-5 text-(--dashboard-text)`])},t(r.title),3),O(`p`,Ts,t(r.meta),1)]),r.value?(f(),I(`span`,Es,t(r.value),1)):C(``,!0)])],2)])):(f(),I(`li`,{key:0,class:x([`rounded-xl border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-3 py-2.5`,r.active?`border-(--dashboard-accent) bg-(--dashboard-accent-soft)`:void 0])},[O(`div`,vs,[O(`div`,ys,[O(`p`,{class:x([`font-medium`,r.monoTitle?`line-clamp-2 break-all font-mono text-xs leading-5 text-(--dashboard-text)`:`line-clamp-2 break-words leading-5 text-(--dashboard-text)`])},t(r.title),3),O(`p`,bs,t(r.meta),1)]),r.value?(f(),I(`span`,xs,t(r.value),1)):C(``,!0)])],2))}var Os=z(_s,[[`render`,Ds]]),ks=L({__name:`BudgetSandboxPanel`,props:{activeBudgetWarningId:{},currentWarnings:{},result:{}},emits:[`selectBudgetWarning`],setup(e,{expose:t,emit:r}){t();let i=e,a=r,o=s({totalMiB:0,mainMiB:0,subPackageMiB:0,independentMiB:0,warningPercent:85}),c=s({text:``,timer:null});function l(e){return e/1048576}function u(e){return Math.max(1,Math.round((Number.isFinite(e)?e:0)*1024*1024))}function d(){return fs(i.result.metadata?.budgets??Z)}function f(){let e=d();o.totalMiB=l(e.totalBytes),o.mainMiB=l(e.mainBytes),o.subPackageMiB=l(e.subPackageBytes),o.independentMiB=l(e.independentBytes),o.warningPercent=Math.round(e.warningRatio*100)}let p=M(()=>fs({...i.result.metadata?.budgets,totalBytes:u(o.totalMiB),mainBytes:u(o.mainMiB),subPackageBytes:u(o.subPackageMiB),independentBytes:u(o.independentMiB),warningRatio:o.warningPercent/100})),m=M(()=>hs({result:i.result,config:p.value})),h=M(()=>ms(p.value)?.id??null),g=M(()=>new Set(i.currentWarnings.map(e=>e.id))),_=M(()=>new Set(m.value.map(e=>e.id))),v=M(()=>m.value.filter(e=>!g.value.has(e.id)).length),b=M(()=>i.currentWarnings.filter(e=>!_.value.has(e.id)).length),x=M(()=>gs(p.value)),S=M(()=>m.value.slice(0,6).map(e=>({key:e.id,warning:e,active:i.activeBudgetWarningId===e.id,title:e.label,meta:e.status===`unknown`?`体积或归因不完整,无法验收`:`${e.status===`critical`?`超预算`:`接近预算`} · ${(e.ratio*100).toFixed(1)}%`,value:`${U(e.currentBytes)} / ${U(e.limitBytes)}`})));function C(e){c.text=e,c.timer&&clearTimeout(c.timer),c.timer=setTimeout(()=>{c.text=``,c.timer=null},1800)}function w(e){let t=ls.find(t=>t.id===e);if(!t)return;let n=fs(t.config);o.totalMiB=l(n.totalBytes),o.mainMiB=l(n.mainBytes),o.subPackageMiB=l(n.subPackageBytes),o.independentMiB=l(n.independentBytes),o.warningPercent=Math.round(n.warningRatio*100),C(`已应用 ${t.label}`)}async function T(){try{await W(x.value),C(`已复制`)}catch{C(`复制失败`)}}y(()=>i.result.metadata?.budgets,f,{immediate:!0}),n(()=>{c.timer&&clearTimeout(c.timer)});let E={props:i,emit:a,draft:o,actionStatus:c,bytesToMiB:l,mibToBytes:u,getInitialConfig:d,resetDraft:f,sandboxConfig:p,projectedWarnings:m,activePresetId:h,currentWarningIds:g,projectedWarningIds:_,newWarningCount:v,resolvedWarningCount:b,snippetText:x,projectedWarningItems:S,setActionStatus:C,applyPreset:w,copyBudgetSnippet:T,get budgetSandboxPresets(){return ls},AppCompactListItem:Os,AppEmptyState:G,AppToolButton:K};return Object.defineProperty(E,"__isScriptSetup",{enumerable:!1,value:!0}),E}}),As={class:`grid min-h-0 min-w-0 gap-3 overflow-visible rounded-lg border border-(--dashboard-border) bg-(--dashboard-panel) p-3 shadow-(--dashboard-shadow) xl:h-full xl:grid-rows-[auto_minmax(0,1fr)] xl:overflow-hidden`},js={class:`mb-2 flex items-center justify-between gap-3`},Ms={class:`min-w-0`},Ns={class:`mt-1 text-xs text-(--dashboard-text-soft)`},Ps={key:0,class:`text-xs font-medium text-(--dashboard-accent)`},Fs={class:`grid min-h-0 min-w-0 gap-3 overflow-visible xl:grid-rows-[auto_auto_auto_minmax(0,1fr)] xl:overflow-hidden`},Is={class:`grid gap-2 sm:grid-cols-3`},Ls=[`onClick`],Rs={class:`block truncate text-xs font-semibold`},zs={class:`mt-1 line-clamp-2 block text-[11px] leading-4 opacity-80`},Bs={class:`grid gap-2 sm:grid-cols-2`},Vs={class:`grid gap-1 text-[11px] text-(--dashboard-text-soft)`},Hs={class:`grid gap-1 text-[11px] text-(--dashboard-text-soft)`},Us={class:`grid gap-1 text-[11px] text-(--dashboard-text-soft)`},Ws={class:`grid gap-1 text-[11px] text-(--dashboard-text-soft)`},Gs={class:`grid gap-2`},Ks={class:`grid gap-1 text-[11px] text-(--dashboard-text-soft)`},qs={class:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-2`},Js={class:`max-h-80 min-h-0 overflow-y-auto pr-1 xl:max-h-none`},Ys={key:1,class:`grid content-start gap-2 text-sm text-(--dashboard-text-muted)`};function Xs(e,n,r,i,a,o){return f(),I(`section`,As,[O(`div`,js,[O(`div`,Ms,[n[5]||=O(`h3`,{class:`text-sm font-semibold text-(--dashboard-text)`},` 预算沙盘 `,-1),O(`p`,Ns,` 预测 `+t(i.projectedWarnings.length)+` 个告警 · 新增 `+t(i.newWarningCount)+` · 解除 `+t(i.resolvedWarningCount),1)]),i.actionStatus.text?(f(),I(`span`,Ps,t(i.actionStatus.text),1)):C(``,!0)]),O(`div`,Fs,[O(`div`,Is,[(f(!0),I(E,null,m(i.budgetSandboxPresets,e=>(f(),I(`button`,{key:e.id,class:x([`rounded-md border px-2 py-2 text-left transition`,i.activePresetId===e.id?`border-(--dashboard-accent) bg-(--dashboard-accent-soft) text-(--dashboard-text)`:`border-(--dashboard-border) bg-(--dashboard-panel-muted) text-(--dashboard-text-soft) hover:border-(--dashboard-border-strong) hover:text-(--dashboard-text)`]),type:`button`,onClick:t=>i.applyPreset(e.id)},[O(`span`,Rs,t(e.label),1),O(`span`,zs,t(e.detail),1)],10,Ls))),128))]),O(`div`,Bs,[O(`label`,Vs,[n[6]||=R(` 总包 MB `,-1),v(O(`input`,{"onUpdate:modelValue":n[0]||=e=>i.draft.totalMiB=e,class:`h-8 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-2 text-sm text-(--dashboard-text) outline-none focus:border-(--dashboard-accent)`,min:`0.01`,step:`0.01`,type:`number`},null,512),[[j,i.draft.totalMiB,void 0,{number:!0}]])]),O(`label`,Hs,[n[7]||=R(` 主包 MB `,-1),v(O(`input`,{"onUpdate:modelValue":n[1]||=e=>i.draft.mainMiB=e,class:`h-8 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-2 text-sm text-(--dashboard-text) outline-none focus:border-(--dashboard-accent)`,min:`0.01`,step:`0.01`,type:`number`},null,512),[[j,i.draft.mainMiB,void 0,{number:!0}]])]),O(`label`,Us,[n[8]||=R(` 分包 MB `,-1),v(O(`input`,{"onUpdate:modelValue":n[2]||=e=>i.draft.subPackageMiB=e,class:`h-8 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-2 text-sm text-(--dashboard-text) outline-none focus:border-(--dashboard-accent)`,min:`0.01`,step:`0.01`,type:`number`},null,512),[[j,i.draft.subPackageMiB,void 0,{number:!0}]])]),O(`label`,Ws,[n[9]||=R(` 独立分包 MB `,-1),v(O(`input`,{"onUpdate:modelValue":n[3]||=e=>i.draft.independentMiB=e,class:`h-8 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-2 text-sm text-(--dashboard-text) outline-none focus:border-(--dashboard-accent)`,min:`0.01`,step:`0.01`,type:`number`},null,512),[[j,i.draft.independentMiB,void 0,{number:!0}]])])]),O(`div`,Gs,[O(`label`,Ks,[R(` 预警线 `+t(i.draft.warningPercent)+`% `,1),v(O(`input`,{"onUpdate:modelValue":n[4]||=e=>i.draft.warningPercent=e,class:`accent-(--dashboard-accent)`,max:`99`,min:`1`,step:`1`,type:`range`},null,512),[[j,i.draft.warningPercent,void 0,{number:!0}]])]),O(`div`,qs,[O(`button`,{class:`h-8 rounded-md border border-(--dashboard-border) bg-(--dashboard-panel-muted) px-3 text-xs text-(--dashboard-text-soft) transition hover:border-(--dashboard-border-strong) hover:text-(--dashboard-text)`,type:`button`,onClick:i.resetDraft},` 重置 `),_(i.AppToolButton,{label:`复制预算配置`,"icon-name":`metric-copy`,"touch-label":`复制`,onClick:i.copyBudgetSnippet})])]),O(`div`,Js,[i.projectedWarningItems.length===0?(f(),D(i.AppEmptyState,{key:0,compact:``},{default:c(()=>[...n[10]||=[R(` 当前沙盘预算下没有预计告警。 `,-1)]]),_:1})):(f(),I(`ul`,Ys,[(f(!0),I(E,null,m(i.projectedWarningItems,e=>(f(),D(i.AppCompactListItem,{key:e.key,active:e.active,clickable:``,meta:e.meta,title:e.title,value:e.value,onSelect:t=>i.emit(`selectBudgetWarning`,e.warning)},null,8,[`active`,`meta`,`title`,`value`,`onSelect`]))),128))]))])])])}var Zs=z(ks,[[`render`,Xs]]);function Qs(e,t){return!!e&&!!t&&e.sessionId===t.sessionId&&e.revision===t.revision&&e.reportHash===t.reportHash}function $s(e){let t=P(null),n=P(null),r=P(``),i=P(null),a=P(``),o=P(``),s=P(``),c=P(null),l=P(``),u=P(null),d=!1,f=0,p=null;function m(e){f+=1,i.value=e,c.value=null,u.value=null,e&&e!==p&&(p=e,l.value=``),o.value=``,s.value=``}let h=M(()=>xe.value.items),g=M(()=>h.value.find(e=>e.id===i.value)??null),_=M(()=>ge.value===`connected`&&V.value!==null),v=M(()=>a.value!==``),x=M(()=>t.value?t.value.report?_.value?Qs(t.value.report,V.value)?``:`草稿绑定的报告已过期。不会自动改绑;可明确用当前报告新建草稿并保留问题。`:`宿主未连接或报告正在同步;草稿与问题已保留。`:`创建草稿时报告尚未就绪。连接后请明确绑定当前报告。`:`请从关联对象创建调查草稿。`),C=M(()=>!v.value&&!x.value&&r.value.trim().length>0&&r.value.trim().length<=4096),w=M(()=>_.value&&!v.value&&!!g.value&&[`submitted`,`claimed`,`proposed`,`authorized`,`executing`].includes(g.value.status)),T=M(()=>_.value&&!v.value&&g.value?.status===`proposed`&&!!g.value.proposal&&Qs(g.value.report,V.value)),E=M(()=>{let e=g.value,t=V.value;return!e||e.status!==`completed`?`只有外部 Agent 回报完成的任务才能进行人工复验。`:!_.value||!t?`请等待当前报告同步完成;复验摘要已保留。`:t.sessionId!==e.report.sessionId||t.revision<=e.report.revision?`请先生成同一宿主会话中的更新报告,再检查实际结果。`:``}),D=M(()=>!v.value&&!E.value&&!!u.value&&!!l.value.trim()&&l.value.trim().length<=4096);y(()=>S(e.requestId),()=>{let i=S(e.request);if(!i)return;let a=V.value,o={target:{...i},report:a?{...a}:null};m(null),t.value?(n.value=o,s.value=`已有未提交草稿;新对象不会覆盖它,请选择保留或替换。`):(t.value=o,r.value=``)},{immediate:!0}),y([g,V,ge],()=>{let e=g.value,t=c.value;_.value&&e&&t&&e.id===t.id&&e.version===t.version&&e.proposal?.id===t.proposalId&&Qs(e.report,V.value)||(c.value=null);let n=u.value;_.value&&e&&n&&e.id===n.id&&e.version===n.version&&Qs(n.report,V.value)||(u.value=null)},{flush:`sync`}),b(()=>{d=!0});function O(){n.value&&!v.value&&(t.value=n.value,n.value=null,r.value=``,m(null),s.value=`已替换为明确选择的新对象;尚未提交。`)}function k(){n.value=null,s.value=`已保留原对象、报告和问题。`}function A(){v.value||(t.value=null,n.value=null,r.value=``,o.value=``,s.value=`本地草稿已取消,没有发送调查。`)}function j(){let e=V.value;t.value&&_.value&&e&&!v.value&&(t.value={target:{...t.value.target},report:{...e}},s.value=`已明确为原对象创建当前报告草稿,保留问题;提交时宿主会重新检查对象是否存在。`,o.value=``)}async function N(e,t){if(v.value||d)return;let n=V.value?.sessionId,r=f;a.value=e,o.value=``,s.value=``;try{let e=await t();if(!d&&V.value?.sessionId===n)return e}catch(e){d||f!==r||V.value&&V.value.sessionId!==n||(o.value=`${e instanceof Error?e.message:String(e)} 未确认操作成功,请检查任务列表后再决定是否重试。输入已保留。`)}finally{d||(a.value=``)}}async function ee(){let e=t.value;if(!C.value||!e?.report)return;let n=r.value,i=f,a=await N(`submit`,()=>he({report:e.report,target:e.target,question:n.trim()}));a&&(t.value===e&&r.value===n&&(t.value=null,r.value=``),f===i&&(m(a.id),s.value=`调查已由宿主接收;创建任务不授予文件修改或执行权限。`))}function te(e){let t=g.value;c.value=e&&T.value&&t?.proposal?{id:t.id,version:t.version,proposalId:t.proposal.id}:null}async function ne(){if(!T.value||!c.value)return;let e=c.value,t=f;await N(`authorize`,()=>Se(e))&&f===t&&(s.value=`宿主已接受此提案的授权。执行仍由外部 Agent 与其工作区权限控制。`)}async function F(){let e=g.value;if(!w.value||!e)return;let t=f;await N(`cancel`,()=>we({id:e.id,version:e.version}))&&f===t&&(s.value=`宿主已取消此调查,后续回报将被拒绝;外部进程不会因此停止,请在外部客户端处理。`)}function I(e){let t=g.value,n=V.value;u.value=e&&!E.value&&t&&n?{id:t.id,version:t.version,report:{...n}}:null}async function L(){if(!D.value||!u.value)return;let e={...u.value,summary:l.value.trim()},t=f;await N(`verify`,()=>ve(e))&&f===t&&(s.value=`宿主已记录你的人工复验结论与新报告测量;这不是自动验证 Agent 回报。`)}async function R(){o.value=``;try{await ye()}catch(e){d||(o.value=e instanceof Error?e.message:String(e))}}return{draft:t,pendingDraft:n,question:r,selectedId:i,tasks:h,selectedTask:g,connected:_,busy:v,pendingAction:a,error:o,notice:s,draftIssue:x,canSubmit:C,canCancel:w,canAuthorize:T,authorization:c,verificationSummary:l,verification:u,verificationIssue:E,canVerify:D,selectTask:m,replaceDraft:O,keepDraft:k,cancelDraft:A,renewDraft:j,submitDraft:ee,confirmAuthorization:te,authorizeProposal:ne,cancelTask:F,confirmVerification:I,verifyTask:L,reconnect:R}}var ec={submitted:`等待外部 Agent 领取`,claimed:`已领取 · 等待提案`,proposed:`提案待你授权`,authorized:`已授权 · 等待外部执行`,executing:`Agent 已报告开始执行`,completed:`Agent 回报完成 · 待复验`,failed:`Agent 回报失败`,cancelled:`调查已取消`,stale:`原报告已过期`,verified:`已记录人工复验`};function tc(e){return e.kind===`package`?`包 ${e.packageId}`:e.kind===`artifact`?`${e.packageId} / ${e.file}`:`${e.packageId} / ${e.file} → ${e.moduleId}`}var nc=L({__name:`InvestigationDraftForm`,props:{draft:{},question:{},issue:{},canSubmit:{type:Boolean},canRenew:{type:Boolean},busy:{type:Boolean}},emits:[`update:question`,`submit`,`cancel`,`renew`],setup(e,{expose:t,emit:n}){t();let r={props:e,emit:n,id:d(),get investigationTargetLabel(){return tc}};return Object.defineProperty(r,"__isScriptSetup",{enumerable:!1,value:!0}),r}}),rc=[`aria-labelledby`],ic=[`id`],ac={class:`border-l-2 border-(--dashboard-accent) bg-(--dashboard-panel) px-4 py-3`},oc={class:`mt-1 break-all font-mono text-sm text-(--dashboard-text)`},sc={key:0,class:`mt-2 text-xs leading-6 text-(--dashboard-text-muted)`},cc={class:`cursor-pointer`},lc={class:`break-all font-mono`},uc={class:`break-all font-mono`},dc={key:1,class:`mt-2 text-sm text-(--dashboard-text-muted)`},fc=[`for`],pc=[`id`,`value`,`disabled`,`aria-describedby`],mc=[`id`],hc={class:`flex flex-wrap gap-2`},gc=[`disabled`],_c=[`disabled`],vc=[`disabled`];function yc(e,n,r,i,a,o){return f(),I(`form`,{class:`grid gap-4`,"aria-labelledby":`${i.id}-heading`,onSubmit:n[3]||=T(e=>i.emit(`submit`),[`prevent`])},[O(`div`,null,[n[4]||=O(`p`,{class:`font-mono text-xs text-(--dashboard-accent)`},`01 / 本地草稿`,-1),O(`h3`,{id:`${i.id}-heading`,class:`mt-1 text-base font-semibold text-(--dashboard-text)`},`先定义问题,再提交调查`,8,ic),n[5]||=O(`p`,{class:`mt-2 text-sm leading-6 text-(--dashboard-text-muted)`},`浏览其他对象不会改变此草稿。提交只创建任务,不会自动调用 Agent 或授予执行权限。`,-1)]),O(`div`,ac,[n[7]||=O(`p`,{class:`text-xs text-(--dashboard-text-soft)`},`已冻结对象`,-1),O(`p`,oc,t(i.investigationTargetLabel(r.draft.target)),1),r.draft.report?(f(),I(`details`,sc,[O(`summary`,cc,`绑定报告 r`+t(r.draft.report.revision)+` · 查看会话与完整摘要`,1),O(`p`,lc,`会话 `+t(r.draft.report.sessionId),1),O(`p`,uc,`报告 SHA-256 `+t(r.draft.report.reportHash),1),n[6]||=O(`p`,null,`这是报告身份,不是磁盘源码内容的快照或哈希。`,-1)])):(f(),I(`p`,dc,`尚未绑定可用报告`))]),O(`div`,null,[O(`label`,{for:`${i.id}-question`,class:`block text-sm font-medium text-(--dashboard-text)`},`调查问题与预期结果`,8,fc),O(`textarea`,{id:`${i.id}-question`,value:r.question,disabled:r.busy,"aria-describedby":`${i.id}-issue`,maxlength:`4096`,required:``,rows:`4`,class:`mt-2 block w-full min-w-0 resize-y rounded-md border border-(--dashboard-border) bg-(--dashboard-bg) p-3 text-sm leading-7 text-(--dashboard-text) disabled:opacity-60`,placeholder:`例如:解释此产物的主要体积来源,给出保持现有行为的修改方案与验证步骤。`,onInput:n[0]||=e=>i.emit(`update:question`,e.target.value)},null,40,pc),O(`p`,{id:`${i.id}-issue`,role:`status`,class:`mt-2 text-sm leading-6 text-(--dashboard-text-muted)`},t(r.issue||`问题可继续编辑;对象与报告身份不随浏览选择改变。`),9,mc)]),O(`div`,hc,[O(`button`,{type:`submit`,disabled:!r.canSubmit,class:`min-h-11 rounded-md border border-(--dashboard-accent) bg-(--dashboard-accent-soft) px-4 text-sm font-semibold text-(--dashboard-accent) hover:bg-(--dashboard-panel-muted) disabled:opacity-50`},t(r.busy?`正在提交…`:`提交调查`),9,gc),r.issue?(f(),I(`button`,{key:0,type:`button`,disabled:!r.canRenew||r.busy,class:`min-h-11 rounded-md border border-(--dashboard-border) px-3 text-sm text-(--dashboard-text) hover:bg-(--dashboard-panel-muted) disabled:opacity-50`,onClick:n[1]||=e=>i.emit(`renew`)},t(i.props.draft.report?`用当前报告新建草稿,保留问题`:`明确绑定当前报告`),9,_c)):C(``,!0),O(`button`,{type:`button`,disabled:r.busy,class:`min-h-11 rounded-md px-3 text-sm text-(--dashboard-text-muted) underline-offset-4 hover:underline disabled:opacity-50`,onClick:n[2]||=e=>i.emit(`cancel`)},`取消草稿`,8,vc)])],40,rc)}var bc=z(nc,[[`render`,yc]]),xc=L({__name:`InvestigationContextCopy`,props:{task:{}},setup(e,{expose:t}){t();let n=e,i=d(),a=P(!1),o=P(``),s=r(`context`),c=M(()=>[`Dashboard 对象调查(上下文辅助,不是执行指令或授权)`,JSON.stringify({id:n.task.id,version:n.task.version,report:n.task.report,target:n.task.target,question:n.task.question,status:n.task.status},null,2),`请在已配置的 Dashboard MCP 上读取 get-dashboard-state 与 get-investigation,核实会话、报告、任务版本及状态后再领取或回报。`,`Agent 名称是自行声明;任务领取不证明在线。先提交提案,等待浏览器对精确提案的授权后再开始。`,`报告哈希不代表源码快照。文件与命令权限由外部客户端管理;Dashboard 不提供通用执行或写文件接口。`,`此处复制没有发送任务,也没有授予权限。`].join(`
5
5
 
6
6
  `));y(c,()=>{o.value=``});function l(){let e=document.activeElement;try{Oe(c.value),o.value=`已复制。请手动交给已配置 MCP 的客户端;没有派发任务或授予权限。`}catch{a.value=!0,o.value=`剪贴板不可用。请展开下方文本并手动选择复制。`}finally{document.activeElement===document.body&&e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:!0})}}let u={props:n,id:i,expanded:a,status:o,textarea:s,context:c,copyContext:l};return Object.defineProperty(u,"__isScriptSetup",{enumerable:!1,value:!0}),u}}),Sc=[`aria-labelledby`],Cc=[`id`],wc={class:`mt-2 flex flex-wrap gap-2`},Tc=[`aria-expanded`,`aria-controls`],Ec={role:`status`,class:`mt-2 text-sm leading-6 text-(--dashboard-text-muted)`},Dc=[`id`],Oc=[`for`],kc=[`id`,`value`];function Ac(e,n,r,i,a,o){return f(),I(`section`,{class:`border-t border-(--dashboard-border) pt-4`,"aria-labelledby":`${i.id}-heading`},[O(`h4`,{id:`${i.id}-heading`,class:`text-sm font-semibold text-(--dashboard-text)`},`交给外部 Agent`,8,Cc),n[2]||=O(`p`,{class:`mt-2 text-sm leading-6 text-(--dashboard-text-muted)`},`已配置 MCP 的客户端可以读取此任务。这里不检测 Agent 在线状态,复制也不等于派发。`,-1),O(`div`,wc,[O(`button`,{type:`button`,class:`min-h-11 rounded-md border border-(--dashboard-border) px-3 text-sm text-(--dashboard-text) hover:bg-(--dashboard-panel-muted)`,onClick:i.copyContext},`复制任务 ID 与上下文`),O(`button`,{type:`button`,class:`min-h-11 rounded-md px-3 text-sm text-(--dashboard-accent) hover:underline`,"aria-expanded":i.expanded,"aria-controls":`${i.id}-context`,onClick:n[0]||=e=>i.expanded=!i.expanded},t(i.expanded?`收起文本`:`查看 / 手动复制文本`),9,Tc)]),O(`p`,Ec,t(i.status),1),v(O(`div`,{id:`${i.id}-context`,class:`mt-3`},[O(`label`,{for:`${i.id}-text`,class:`text-sm text-(--dashboard-text-muted)`},`任务上下文(只读)`,8,Oc),O(`textarea`,{id:`${i.id}-text`,ref:`context`,value:i.context,readonly:``,rows:`8`,spellcheck:`false`,class:`mt-2 block w-full min-w-0 resize-y rounded-md border border-(--dashboard-border) bg-(--dashboard-bg) p-3 font-mono text-xs leading-6 text-(--dashboard-text)`},null,8,kc),O(`button`,{type:`button`,class:`mt-2 min-h-11 rounded-md px-3 text-sm text-(--dashboard-accent) hover:underline`,onClick:n[1]||=e=>{i.textarea?.focus(),i.textarea?.select()}},`选中全部文本`)],8,Dc),[[F,i.expanded]])],8,Sc)}var jc=z(xc,[[`render`,Ac]]),Mc=L({__name:`InvestigationMeasurements`,props:{measurements:{}},setup(e,{expose:t}){t();let n=e,r={props:n,rows:M(()=>[{label:`原始产物`,bytes:n.measurements.rawBytes},{label:`gzip`,bytes:n.measurements.gzipBytes},{label:`brotli`,bytes:n.measurements.brotliBytes},{label:`模块归因`,bytes:n.measurements.attributedBytes},{label:`源码`,bytes:n.measurements.sourceBytes}]),get formatBytes(){return U}};return Object.defineProperty(r,"__isScriptSetup",{enumerable:!1,value:!0}),r}}),Nc={class:`flex flex-wrap gap-x-6 gap-y-3 text-sm`},Pc={class:`text-xs text-(--dashboard-text-soft)`},Fc={class:`mt-1 font-mono text-(--dashboard-text)`};function Ic(e,n,r,i,a,o){return f(),I(`dl`,Nc,[(f(!0),I(E,null,m(i.rows,e=>(f(),I(`div`,{key:e.label},[O(`dt`,Pc,t(e.label),1),O(`dd`,Fc,t(e.bytes===null?`未测量`:i.formatBytes(e.bytes)),1)]))),128))])}var Lc=z(Mc,[[`render`,Ic]]),Rc=L({__name:`InvestigationTaskDetails`,props:{task:{},currentReport:{},busy:{type:Boolean},canAuthorize:{type:Boolean},authorizationChecked:{type:Boolean},canCancel:{type:Boolean},verificationIssue:{},verificationSummary:{},verificationChecked:{type:Boolean},canVerify:{type:Boolean}},emits:[`confirmAuthorization`,`authorize`,`cancel`,`update:verificationSummary`,`confirmVerification`,`verify`],setup(e,{expose:t,emit:n}){t();let r={props:e,emit:n,id:d(),checkOutcomeLabels:{passed:`Agent 称通过`,failed:`Agent 称失败`,"not-run":`未运行`},InvestigationContextCopy:jc,InvestigationMeasurements:Lc,get investigationStatusLabels(){return ec},get investigationTargetLabel(){return tc}};return Object.defineProperty(r,"__isScriptSetup",{enumerable:!1,value:!0}),r}}),zc=[`aria-labelledby`,`aria-busy`],Bc={role:`status`,class:`text-sm font-medium text-(--dashboard-accent)`},Vc=[`id`],Hc={class:`mt-2 break-all font-mono text-xs leading-6 text-(--dashboard-text-muted)`},Uc={class:`mt-2 text-xs leading-6 text-(--dashboard-text-soft)`},Wc={class:`cursor-pointer`},Gc={class:`break-all font-mono`},Kc={class:`break-all font-mono`},qc={class:`break-all font-mono`},Jc=[`aria-labelledby`],Yc=[`id`],Xc=[`aria-labelledby`],Zc=[`id`],Qc={key:0,class:`mt-2 text-sm leading-6 text-(--dashboard-text)`},$c={key:1,class:`mt-2 text-sm leading-6 text-(--dashboard-text-muted)`},el=[`aria-labelledby`],tl=[`id`],nl={class:`mt-2 break-all font-mono text-xs leading-6 text-(--dashboard-text-soft)`},rl={class:`mt-2 whitespace-pre-wrap text-sm leading-7 text-(--dashboard-text)`},il={class:`mt-3 grid gap-3 text-sm`},al={class:`break-all font-mono leading-6 text-(--dashboard-text)`},ol={class:`mt-1 whitespace-pre-wrap leading-6 text-(--dashboard-text-muted)`},sl={class:`mt-2 list-disc space-y-1 pl-5 text-sm leading-6 text-(--dashboard-text-muted)`},cl={key:0,class:`mt-2 list-disc space-y-1 pl-5 text-sm leading-6 text-(--dashboard-text-muted)`},ll={key:1,class:`mt-2 text-sm leading-6 text-(--dashboard-text-muted)`},ul={key:2,class:`mt-4 grid gap-3`},dl={class:`flex items-start gap-3 text-sm leading-6 text-(--dashboard-text)`},fl=[`checked`,`disabled`],pl={key:0,role:`status`,class:`text-sm leading-6 text-(--dashboard-text-muted)`},ml=[`disabled`],hl={key:3,class:`mt-4 break-all text-sm leading-6 text-(--dashboard-text-muted)`},gl=[`aria-labelledby`],_l=[`id`],vl={class:`mt-2 whitespace-pre-wrap text-sm leading-7 text-(--dashboard-text)`},yl={class:`mt-2 text-xs leading-6 text-(--dashboard-text-soft)`},bl={key:0,class:`mt-2 grid gap-1 font-mono text-xs leading-6 text-(--dashboard-text-muted)`},xl={key:1,class:`mt-2 text-sm text-(--dashboard-text-muted)`},Sl={key:2,class:`mt-2 grid gap-3 text-sm leading-6 text-(--dashboard-text-muted)`},Cl={class:`break-all font-mono`},wl={key:3,class:`mt-2 text-sm text-(--dashboard-text-muted)`},Tl=[`aria-labelledby`],El=[`id`],Dl={role:`status`,class:`text-sm leading-6 text-(--dashboard-text-muted)`},Ol=[`for`],kl=[`id`,`value`,`disabled`],Al={class:`flex items-start gap-3 text-sm leading-6 text-(--dashboard-text)`},jl=[`checked`,`disabled`],Ml=[`disabled`],Nl=[`aria-labelledby`],Pl=[`id`],Fl={class:`mt-2 whitespace-pre-wrap text-sm leading-7 text-(--dashboard-text)`},Il={class:`my-3 text-xs leading-6 text-(--dashboard-text-soft)`},Ll={key:1,class:`text-sm leading-6 text-(--dashboard-text-muted)`},Rl={key:4,class:`border-t border-(--dashboard-border) pt-4`},zl=[`disabled`],Bl={key:5,role:`status`,class:`border-l-2 border-(--dashboard-border-strong) pl-3 text-sm leading-7 text-(--dashboard-text-muted)`};function Vl(e,n,r,i,a,o){return f(),I(`article`,{class:`grid gap-5`,"aria-labelledby":`${i.id}-heading`,"aria-busy":r.busy},[O(`header`,null,[O(`p`,Bc,t(i.investigationStatusLabels[r.task.status]),1),O(`h3`,{id:`${i.id}-heading`,class:`mt-2 whitespace-pre-wrap text-base font-semibold leading-7 text-(--dashboard-text)`},t(r.task.question),9,Vc),O(`p`,Hc,t(i.investigationTargetLabel(r.task.target)),1),O(`details`,Uc,[O(`summary`,Wc,`任务身份 · r`+t(r.task.report.revision)+` · 任务版本 `+t(r.task.version),1),O(`p`,Gc,`任务 `+t(r.task.id),1),O(`p`,Kc,`会话 `+t(r.task.report.sessionId),1),O(`p`,qc,`报告 SHA-256 `+t(r.task.report.reportHash),1),O(`p`,null,`创建 `+t(r.task.createdAt)+` · 更新 `+t(r.task.updatedAt),1),n[6]||=O(`p`,null,`报告哈希不是源码快照;工作区权限仍由外部客户端控制。`,-1)])]),O(`section`,{class:`border-l-2 border-(--dashboard-accent) bg-(--dashboard-panel) p-4`,"aria-labelledby":`${i.id}-evidence`},[O(`h4`,{id:`${i.id}-evidence`,class:`mb-3 text-sm font-semibold text-(--dashboard-text)`},`提交时的报告测量`,8,Yc),_(i.InvestigationMeasurements,{measurements:r.task.evidence},null,8,[`measurements`]),n[7]||=O(`p`,{class:`mt-3 text-xs leading-6 text-(--dashboard-text-soft)`},`压缩、模块归因和源码字节是不同口径;未测量不等于零,归因不代表实际产物压缩收益。`,-1)],8,Jc),O(`section`,{"aria-labelledby":`${i.id}-claim`},[O(`h4`,{id:`${i.id}-claim`,class:`text-sm font-semibold text-(--dashboard-text)`},`外部 Agent 记录`,8,Zc),r.task.agent?(f(),I(`p`,Qc,t(r.task.agent.name)+` 已领取 · `+t(r.task.agent.claimedAt),1)):(f(),I(`p`,$c,t(r.task.status===`submitted`?`等待外部 Agent 领取。`:`没有 Agent 领取记录。`),1)),n[8]||=O(`p`,{class:`mt-1 text-xs leading-6 text-(--dashboard-text-soft)`},`领取名称由客户端自行声明,不是认证身份、在线连接或心跳证明。`,-1)],8,Xc),r.task.proposal?(f(),I(`section`,{key:0,class:`border-t border-(--dashboard-border) pt-4`,"aria-labelledby":`${i.id}-proposal`},[n[10]||=O(`p`,{class:`font-mono text-xs text-(--dashboard-accent)`},`02 / 外部提案`,-1),O(`h4`,{id:`${i.id}-proposal`,class:`mt-1 text-sm font-semibold text-(--dashboard-text)`},`查看精确变更,再决定是否授权`,8,tl),O(`p`,nl,`提案 `+t(r.task.proposal.id),1),O(`p`,rl,t(r.task.proposal.summary),1),O(`ul`,il,[(f(!0),I(E,null,m(r.task.proposal.changes,(e,n)=>(f(),I(`li`,{key:n,class:`border-l border-(--dashboard-border-strong) pl-3`},[O(`p`,al,t(e.path),1),O(`p`,ol,t(e.description),1)]))),128))]),n[11]||=O(`h5`,{class:`mt-4 text-sm font-medium text-(--dashboard-text)`},`提议的检查(尚不是执行结果)`,-1),O(`ul`,sl,[(f(!0),I(E,null,m(r.task.proposal.checks,(e,n)=>(f(),I(`li`,{key:n,class:`whitespace-pre-wrap`},t(e),1))),128))]),n[12]||=O(`h5`,{class:`mt-4 text-sm font-medium text-(--dashboard-text)`},`Agent 声明的风险`,-1),r.task.proposal.risks.length?(f(),I(`ul`,cl,[(f(!0),I(E,null,m(r.task.proposal.risks,(e,n)=>(f(),I(`li`,{key:n,class:`whitespace-pre-wrap`},t(e),1))),128))])):(f(),I(`p`,ll,`Agent 未列出风险,不代表已经证明没有风险。`)),r.task.status===`proposed`?(f(),I(`div`,ul,[O(`label`,dl,[O(`input`,{type:`checkbox`,checked:r.authorizationChecked,disabled:!r.canAuthorize,class:`mt-1 size-4 shrink-0 accent-(--dashboard-accent)`,onChange:n[0]||=e=>i.emit(`confirmAuthorization`,e.target.checked)},null,40,fl),n[9]||=O(`span`,null,`我已查看此提案的路径、检查与风险,同意仅授权上述提案。报告或提案改变后需要重新确认。`,-1)]),!r.canAuthorize&&!r.busy?(f(),I(`p`,pl,`连接或原报告已变化;旧提案不可授权。请保留此记录并针对当前报告重新调查。`)):C(``,!0),O(`button`,{type:`button`,disabled:!r.canAuthorize||!r.authorizationChecked,class:`min-h-11 justify-self-start rounded-md border border-(--dashboard-accent) bg-(--dashboard-accent-soft) px-4 text-sm font-semibold text-(--dashboard-accent) disabled:opacity-50`,onClick:n[1]||=e=>i.emit(`authorize`)},`明确授权此提案`,8,ml)])):C(``,!0),r.task.authorization?(f(),I(`p`,hl,`授权记录:`+t(r.task.authorization.proposalId)+` · `+t(r.task.authorization.authorizedAt)+`。这只记录执行意图,不代替外部文件或命令权限。`,1)):C(``,!0)],8,el)):C(``,!0),r.task.receipt?(f(),I(`section`,{key:1,class:`border-t border-(--dashboard-border) pt-4`,"aria-labelledby":`${i.id}-receipt`},[n[13]||=O(`p`,{class:`font-mono text-xs text-(--dashboard-accent)`},`03 / Agent 回报`,-1),O(`h4`,{id:`${i.id}-receipt`,class:`mt-1 text-sm font-semibold text-(--dashboard-text)`},t(r.task.receipt.outcome===`completed`?`Agent 回报完成,不等于验证通过`:`Agent 回报失败`),9,_l),O(`p`,vl,t(r.task.receipt.summary),1),O(`p`,yl,`回报时间 `+t(r.task.receipt.reportedAt)+` · 下列内容未经 Dashboard 独立执行验证。`,1),n[14]||=O(`h5`,{class:`mt-3 text-sm font-medium text-(--dashboard-text)`},`声明修改的文件`,-1),r.task.receipt.changedFiles.length?(f(),I(`ul`,bl,[(f(!0),I(E,null,m(r.task.receipt.changedFiles,(e,n)=>(f(),I(`li`,{key:n,class:`break-all`},t(e),1))),128))])):(f(),I(`p`,xl,`没有声明修改的文件。`)),n[15]||=O(`h5`,{class:`mt-3 text-sm font-medium text-(--dashboard-text)`},`声明的检查结果`,-1),r.task.receipt.checks.length?(f(),I(`ul`,Sl,[(f(!0),I(E,null,m(r.task.receipt.checks,(e,n)=>(f(),I(`li`,{key:n},[O(`p`,Cl,t(e.command),1),O(`p`,null,t(i.checkOutcomeLabels[e.outcome])+` · `+t(e.summary),1)]))),128))])):(f(),I(`p`,wl,`没有检查回报。`))],8,gl)):C(``,!0),r.task.status===`completed`?(f(),I(`form`,{key:2,class:`grid gap-3 border-t border-(--dashboard-border) pt-4`,"aria-labelledby":`${i.id}-verify`,onSubmit:n[4]||=T(e=>i.emit(`verify`),[`prevent`])},[O(`div`,null,[n[16]||=O(`p`,{class:`font-mono text-xs text-(--dashboard-accent)`},`04 / 人工复验`,-1),O(`h4`,{id:`${i.id}-verify`,class:`mt-1 text-sm font-semibold text-(--dashboard-text)`},`检查更新报告与实际行为后,记录你的结论`,8,El)]),O(`p`,Dl,t(r.verificationIssue||`当前报告 r${r.currentReport?.revision},晚于原报告 r${r.task.report.revision}。报告更新本身不证明问题已解决。`),1),O(`label`,{for:`${i.id}-summary`,class:`text-sm text-(--dashboard-text)`},`人工复验摘要:实际检查了什么、结果与剩余限制`,8,Ol),O(`textarea`,{id:`${i.id}-summary`,value:r.verificationSummary,disabled:r.busy,rows:`3`,maxlength:`4096`,required:``,class:`block w-full resize-y rounded-md border border-(--dashboard-border) bg-(--dashboard-bg) p-3 text-sm leading-7 text-(--dashboard-text) disabled:opacity-60`,onInput:n[2]||=e=>i.emit(`update:verificationSummary`,e.target.value)},null,40,kl),O(`label`,Al,[O(`input`,{type:`checkbox`,checked:r.verificationChecked,disabled:!!r.verificationIssue||r.busy,class:`mt-1 size-4 shrink-0 accent-(--dashboard-accent)`,onChange:n[3]||=e=>i.emit(`confirmVerification`,e.target.checked)},null,40,jl),O(`span`,null,`我已检查当前报告 r`+t(i.props.currentReport?.revision??`—`)+` 及相关行为,并将以上摘要作为我的复验结论,而不是把 Agent 回报当作证明。`,1)]),O(`button`,{type:`submit`,disabled:!r.canVerify,class:`min-h-11 justify-self-start rounded-md border border-(--dashboard-accent) bg-(--dashboard-accent-soft) px-4 text-sm font-semibold text-(--dashboard-accent) disabled:opacity-50`},`提交人工复验记录`,8,Ml)],40,Tl)):C(``,!0),r.task.verification?(f(),I(`section`,{key:3,class:`border-t border-(--dashboard-border) pt-4`,"aria-labelledby":`${i.id}-verified`},[O(`h4`,{id:`${i.id}-verified`,class:`text-sm font-semibold text-(--dashboard-text)`},`人工复验记录 · r`+t(r.task.verification.report.revision),9,Pl),O(`p`,Fl,t(r.task.verification.summary),1),O(`p`,Il,t(r.task.verification.verifiedAt)+` · 由用户明确提交,不是自动判定成功。`,1),r.task.verification.after?(f(),D(i.InvestigationMeasurements,{key:0,measurements:r.task.verification.after},null,8,[`measurements`])):(f(),I(`p`,Ll,`更新报告中已找不到原对象;不把缺失对象计为零体积。`))],8,Nl)):C(``,!0),[`submitted`,`claimed`,`proposed`,`authorized`,`executing`,`cancelled`].includes(r.task.status)?(f(),I(`section`,Rl,[n[17]||=O(`p`,{class:`text-sm leading-6 text-(--dashboard-text-muted)`},`取消只停止本任务接受后续回报,不能终止外部进程或撤销已有文件修改。需要停止执行时,请到外部客户端操作。`,-1),r.task.status===`cancelled`?C(``,!0):(f(),I(`button`,{key:0,type:`button`,disabled:!r.canCancel,class:`mt-3 min-h-11 rounded-md border border-(--dashboard-border-strong) px-3 text-sm text-(--dashboard-text) hover:bg-(--dashboard-panel-muted) disabled:opacity-50`,onClick:n[5]||=e=>i.emit(`cancel`)},`取消此调查(不终止外部进程)`,8,zl))])):C(``,!0),r.task.status===`stale`?(f(),I(`p`,Bl,`报告已更新,此任务不会自动改绑,原提案及授权不可继续使用。请从当前对象创建新的调查。`)):C(``,!0),_(i.InvestigationContextCopy,{task:r.task},null,8,[`task`])],8,zc)}var Hl=z(Rc,[[`render`,Vl]]),Ul=L({__name:`ObjectInvestigationPanel`,props:{request:{},requestId:{}},setup(e,{expose:t}){t();let n=e,r=d(),{draft:i,pendingDraft:a,question:o,selectedId:s,tasks:c,selectedTask:l,connected:u,busy:f,pendingAction:p,error:m,notice:h,draftIssue:g,canSubmit:_,canCancel:v,canAuthorize:y,authorization:b,verificationSummary:x,verification:S,verificationIssue:C,canVerify:w,selectTask:T,replaceDraft:E,keepDraft:D,cancelDraft:O,renewDraft:k,submitDraft:A,confirmAuthorization:j,authorizeProposal:M,cancelTask:N,confirmVerification:ee,verifyTask:P,reconnect:te}=$s({request:()=>n.request,requestId:()=>n.requestId}),ne={props:n,id:r,draft:i,pendingDraft:a,question:o,selectedId:s,tasks:c,selectedTask:l,connected:u,busy:f,pendingAction:p,error:m,notice:h,draftIssue:g,canSubmit:_,canCancel:v,canAuthorize:y,authorization:b,verificationSummary:x,verification:S,verificationIssue:C,canVerify:w,selectTask:T,replaceDraft:E,keepDraft:D,cancelDraft:O,renewDraft:k,submitDraft:A,confirmAuthorization:j,authorizeProposal:M,cancelTask:N,confirmVerification:ee,verifyTask:P,reconnect:te,get dashboardConnectionStatus(){return ge},get dashboardReportIdentity(){return V},InvestigationDraftForm:bc,InvestigationTaskDetails:Hl,get investigationStatusLabels(){return ec},get investigationTargetLabel(){return tc}};return Object.defineProperty(ne,"__isScriptSetup",{enumerable:!1,value:!0}),ne}}),Wl=[`aria-labelledby`],Gl={class:`flex flex-wrap items-start justify-between gap-3`},Kl=[`id`],ql={role:`status`,class:`text-xs leading-6 text-(--dashboard-text-muted)`},Jl={key:0,class:`mt-4 flex flex-wrap items-center gap-3 border-l-2 border-(--dashboard-border-strong) bg-(--dashboard-panel) px-4 py-3`},Yl={class:`flex-1 text-sm leading-6 text-(--dashboard-text-muted)`},Xl=[`disabled`],Zl={key:1,role:`alert`,class:`mt-4 border-l-2 border-(--dashboard-border-strong) bg-(--dashboard-panel) p-3 text-sm leading-7`},Ql={role:`status`,class:`mt-3 text-sm leading-6 text-(--dashboard-text-muted)`},$l={key:2,class:`mt-3 border border-(--dashboard-border-strong) bg-(--dashboard-panel) p-4`},eu={class:`mt-1 break-all font-mono text-xs leading-6 text-(--dashboard-text-muted)`},tu={class:`mt-3 flex flex-wrap gap-2`},nu=[`disabled`],ru=[`disabled`],iu={class:`investigation-layout mt-4 grid gap-5 border-t border-(--dashboard-border) pt-4`},au={class:`min-w-0`},ou={key:2,class:`py-5 text-sm leading-7 text-(--dashboard-text-muted)`},su={key:3,role:`status`,class:`mt-4 text-sm text-(--dashboard-text-muted)`},cu={class:`min-w-0`,"aria-label":`选择调查任务或本地草稿`},lu={class:`text-xs font-medium text-(--dashboard-text-soft)`},uu=[`aria-pressed`],du={class:`mt-1 block break-all text-xs leading-6 text-(--dashboard-text-muted)`},fu={key:1,class:`mt-2 grid max-h-80 gap-2 overflow-y-auto p-1`},pu=[`aria-pressed`,`onClick`],mu={class:`block text-xs text-(--dashboard-accent)`},hu={class:`mt-1 block text-sm leading-6`},gu={class:`mt-1 block break-all font-mono text-xs leading-6 text-(--dashboard-text-soft)`},_u={key:2,class:`mt-3 text-sm leading-7 text-(--dashboard-text-muted)`};function vu(e,n,r,i,a,o){return f(),I(`section`,{class:`investigation-panel min-w-0 bg-(--dashboard-shell) text-(--dashboard-text)`,"aria-labelledby":`${i.id}-heading`},[O(`header`,Gl,[O(`div`,null,[O(`h2`,{id:`${i.id}-heading`,class:`text-base font-semibold`},`对象调查`,8,Kl),n[6]||=O(`p`,{class:`mt-1 text-xs leading-6 text-(--dashboard-text-soft)`},`草稿 → 外部领取 → 精确提案授权 → Agent 回报 → 人工复验`,-1)]),O(`p`,ql,t(i.connected?`宿主已同步 · 不代表 Agent 在线`:`宿主未就绪 · 本地输入保留`),1)]),i.connected?C(``,!0):(f(),I(`div`,Jl,[O(`p`,Yl,t(i.dashboardConnectionStatus===`connected`?`正在同步报告,暂不可提交或授权。`:`当前无法确认宿主状态。草稿不会丢失,也不会自动重发调查。`),1),i.dashboardConnectionStatus===`connected`?C(``,!0):(f(),I(`button`,{key:0,type:`button`,disabled:i.dashboardConnectionStatus===`connecting`,class:`min-h-11 rounded-md border border-(--dashboard-border) px-3 text-sm disabled:opacity-50`,onClick:n[0]||=(...e)=>i.reconnect&&i.reconnect(...e)},t(i.dashboardConnectionStatus===`connecting`?`连接中…`:`重新连接宿主`),9,Xl))])),i.error?(f(),I(`p`,Zl,t(i.error),1)):C(``,!0),O(`p`,Ql,t(i.notice),1),i.pendingDraft?(f(),I(`div`,$l,[n[7]||=O(`p`,{class:`text-sm leading-6`},`新的调查请求尚未覆盖原草稿:`,-1),O(`p`,eu,t(i.investigationTargetLabel(i.pendingDraft.target))+` · `+t(i.pendingDraft.report?`r${i.pendingDraft.report.revision}`:`报告未就绪`),1),O(`div`,tu,[O(`button`,{type:`button`,disabled:i.busy,class:`min-h-11 rounded-md border border-(--dashboard-border) px-3 text-sm hover:bg-(--dashboard-panel-muted) disabled:opacity-50`,onClick:n[1]||=(...e)=>i.keepDraft&&i.keepDraft(...e)},`保留原草稿`,8,nu),O(`button`,{type:`button`,disabled:i.busy,class:`min-h-11 rounded-md border border-(--dashboard-accent) px-3 text-sm text-(--dashboard-accent) hover:bg-(--dashboard-accent-soft) disabled:opacity-50`,onClick:n[2]||=(...e)=>i.replaceDraft&&i.replaceDraft(...e)},t(i.draft?`放弃原草稿,使用新请求`:`使用新请求创建草稿`),9,ru)])])):C(``,!0),O(`div`,iu,[O(`div`,au,[i.selectedId===null&&i.draft?(f(),D(i.InvestigationDraftForm,{key:0,question:i.question,"onUpdate:question":n[3]||=e=>i.question=e,draft:i.draft,issue:i.draftIssue,"can-submit":i.canSubmit,"can-renew":i.connected,busy:i.busy,onSubmit:i.submitDraft,onCancel:i.cancelDraft,onRenew:i.renewDraft},null,8,[`question`,`draft`,`issue`,`can-submit`,`can-renew`,`busy`,`onSubmit`,`onCancel`,`onRenew`])):i.selectedTask?(f(),D(i.InvestigationTaskDetails,{key:1,task:i.selectedTask,"current-report":i.dashboardReportIdentity,busy:i.busy,"can-authorize":i.canAuthorize,"authorization-checked":!!i.authorization,"can-cancel":i.canCancel,"verification-issue":i.verificationIssue,"verification-summary":i.verificationSummary,"verification-checked":!!i.verification,"can-verify":i.canVerify,onConfirmAuthorization:i.confirmAuthorization,onAuthorize:i.authorizeProposal,onCancel:i.cancelTask,"onUpdate:verificationSummary":n[4]||=e=>i.verificationSummary=e,onConfirmVerification:i.confirmVerification,onVerify:i.verifyTask},null,8,[`task`,`current-report`,`busy`,`can-authorize`,`authorization-checked`,`can-cancel`,`verification-issue`,`verification-summary`,`verification-checked`,`can-verify`,`onConfirmAuthorization`,`onAuthorize`,`onCancel`,`onConfirmVerification`,`onVerify`])):(f(),I(`p`,ou,t(i.selectedId?`此任务不在当前宿主列表中。会话可能已更换,或终态记录已被回收;不会将旧任务绑定到新报告。`:`从任务列表选择宿主任务,或在关联对象上点击“创建调查”。创建草稿不会提交或派发。`),1)),i.pendingAction?(f(),I(`p`,su,`正在等待宿主确认操作,请勿重复提交…`)):C(``,!0)]),O(`nav`,cu,[O(`h3`,lu,`本地草稿与宿主任务 · `+t(i.tasks.length)+`/32`,1),i.draft?(f(),I(`button`,{key:0,type:`button`,"aria-pressed":i.selectedId===null,class:`task-option mt-3 w-full rounded-md border px-3 py-3 text-left`,onClick:n[5]||=e=>i.selectTask(null)},[n[8]||=O(`span`,{class:`block text-sm font-medium`},`未提交草稿`,-1),O(`span`,du,t(i.investigationTargetLabel(i.draft.target)),1)],8,uu)):C(``,!0),i.tasks.length?(f(),I(`ul`,fu,[(f(!0),I(E,null,m(i.tasks,e=>(f(),I(`li`,{key:e.id},[O(`button`,{type:`button`,"aria-pressed":i.selectedId===e.id,class:`task-option w-full rounded-md border px-3 py-3 text-left`,onClick:t=>i.selectTask(e.id)},[O(`span`,mu,t(i.investigationStatusLabels[e.status]),1),O(`span`,hu,t(e.question),1),O(`span`,gu,t(i.investigationTargetLabel(e.target)),1)],8,pu)]))),128))])):(f(),I(`p`,_u,`宿主尚无调查记录。请先选择真实对象并创建草稿。`)),n[9]||=O(`p`,{class:`mt-3 text-xs leading-6 text-(--dashboard-text-soft)`},`记录属于当前宿主会话,不是永久历史;最多保留 32 项。`,-1)])])],8,Wl)}var yu=z(Ul,[[`render`,vu],[`__scopeId`,`data-v-daaf89ae`]]);function bu(e){return e===`high`?`高`:e===`medium`?`中`:`低`}function xu(e){let t=e.packages.some(e=>e.packageLabel.includes(`independent`)||e.packageId.includes(`independent`))?`high`:e.packageCount>2?`medium`:`low`,n=t===`high`?.72:t===`medium`?.86:1;return{id:`duplicate:${e.id}`,title:`收敛重复模块 ${e.source}`,detail:`${e.packageCount} 个包复用 · 单份 ${U(e.bytes)} · ${e.advice}`,impactBytes:e.estimatedSavingBytes,effort:t,priority:Math.round(e.estimatedSavingBytes*n+e.packageCount*128),action:t===`high`?`先确认独立分包隔离要求,再评估公共入口。`:`优先抽到共享入口或调整引用边界。`}}function Su(e){let t=e.category===`第三方依赖`?`medium`:`low`,n=t===`medium`?.82:.92;return{id:`increment:${e.key}`,title:`复核增长来源 ${e.label}`,detail:`${e.category} · ${e.packageLabel} · +${U(e.deltaBytes)}`,impactBytes:e.deltaBytes,effort:t,priority:Math.round(e.deltaBytes*n),action:e.advice}}function Cu(e){let t=e.moduleCount>12?`medium`:`low`;return{id:`file:${e.packageId}:${e.file}`,title:`检查大文件边界 ${e.file}`,detail:`${e.packageLabel} · ${U(e.size)} · ${e.moduleCount} 个模块`,impactBytes:e.size,effort:t,priority:Math.round(e.size*.42+e.moduleCount*96),action:e.isEntry?`确认入口依赖是否可懒加载或拆到分包。`:`检查静态资源和模块聚合边界。`}}function wu(e){return[`# dashboard 模块优化计划`,``,`计划项:${e.items.length}`,`估算影响:${U(e.totalImpactBytes)}`,`低成本项:${e.quickWinCount}`,``,`| 优先级 | 事项 | 影响 | 成本 | 建议 |`,`| ---: | --- | ---: | --- | --- |`,...e.items.map(e=>`| ${e.priority} | ${e.title.replaceAll(`|`,`\\|`)} | ${U(e.impactBytes)} | ${bu(e.effort)} | ${e.action.replaceAll(`|`,`\\|`)} |`),``].join(`
7
7
  `)}function Tu(e){let t=e.duplicateModules.filter(e=>e.estimatedSavingBytes>0).slice(0,8).map(xu),n=e.incrementAttribution.filter(e=>e.deltaBytes>0).slice(0,6).map(Su),r=new Set(e.duplicateModules.flatMap(e=>e.packages.flatMap(e=>e.files.map(t=>`${e.packageId}:${t}`)))),i=e.largestFiles.filter(e=>e.size>0&&!r.has(`${e.packageId}:${e.file}`)).slice(0,4).map(Cu),a=[...t,...n,...i].sort((e,t)=>t.priority-e.priority||t.impactBytes-e.impactBytes||e.title.localeCompare(t.title)).slice(0,8),o={totalImpactBytes:a.reduce((e,t)=>e+t.impactBytes,0),quickWinCount:a.filter(e=>e.effort===`low`).length,items:a};return{...o,report:wu(o)}}function Eu(e){return{title:e.source,meta:`${e.packageCount} 个包 · 单份 ${U(e.bytes)} · 可节省 ${U(e.estimatedSavingBytes)} · ${e.advice}`}}function Du(e){return{title:e.sourceCategory,meta:`${e.count} 个模块`,value:U(e.bytes)}}function Ou(e){return{title:e.label,meta:`${e.category} · ${e.packageLabel} · ${e.advice}`,value:`+${U(e.deltaBytes)}`}}function ku(e){return{title:e.category,meta:`${e.count} 项增长`,value:`+${U(e.deltaBytes)}`}}function Au(e){return{title:e.file,meta:`${e.packageLabel} · ${Ee(e.from)} · ${e.moduleCount} 模块`}}function ju(e){return e.replaceAll(`|`,`\\|`).replaceAll(`