@befe/vault-system 0.1.17 → 0.1.18
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/INSTALL.md +1 -1
- package/SKILL.md +4 -1
- package/bin/_vault-inner-cli.ts +22 -0
- package/package.json +1 -1
- package/src/core/api-version.ts +2 -1
- package/src/core/comate-rules.ts +753 -0
- package/src/core/format.ts +17 -0
- package/src/server/app.ts +18 -0
- package/src/server/index.ts +28 -0
- package/web/dist/assets/{abnfDiagram-WEYOIA3C-DLJIMq8P.js → abnfDiagram-WEYOIA3C-rZaG2iSs.js} +1 -1
- package/web/dist/assets/{arc-BHgYezlx.js → arc-D-YRXgrg.js} +1 -1
- package/web/dist/assets/{architectureDiagram-ZHVYKT53-BDkW8ePg.js → architectureDiagram-ZHVYKT53-BBkgnnhu.js} +1 -1
- package/web/dist/assets/{blockDiagram-RJAE7QA3-Blqsnq-H.js → blockDiagram-RJAE7QA3-D_UPuzcL.js} +1 -1
- package/web/dist/assets/{c4Diagram-XDPPPE54-DeuPrP50.js → c4Diagram-XDPPPE54-rRkxxACp.js} +1 -1
- package/web/dist/assets/channel-CX2cpODM.js +1 -0
- package/web/dist/assets/{chunk-2E7WHVMD-gv7qZgKt.js → chunk-2E7WHVMD-BRH_4_am.js} +1 -1
- package/web/dist/assets/{chunk-2Q5K7J3B-Hn6TZXuv.js → chunk-2Q5K7J3B-Ca9Nzrlh.js} +1 -1
- package/web/dist/assets/{chunk-4EMNKR2T-DOwEEpcl.js → chunk-4EMNKR2T-EeIUtWEL.js} +1 -1
- package/web/dist/assets/{chunk-55XCU76K-B2Fu2bCs.js → chunk-55XCU76K-BSK00in2.js} +1 -1
- package/web/dist/assets/{chunk-5VM5RSS4-DRpBwMt3.js → chunk-5VM5RSS4-C861XhrM.js} +1 -1
- package/web/dist/assets/{chunk-JWPE2WC7-CfdgzbDM.js → chunk-JWPE2WC7-v2zmmZ8M.js} +1 -1
- package/web/dist/assets/{chunk-VQ5W62QI-ou89H6Wm.js → chunk-VQ5W62QI-D66wyirI.js} +1 -1
- package/web/dist/assets/{chunk-XXDRQBXY-Bbpvpd5G.js → chunk-XXDRQBXY-EVyGdP8d.js} +1 -1
- package/web/dist/assets/{chunk-ZCHMQSOR-CDpWRbY_.js → chunk-ZCHMQSOR-DXtpKq5T.js} +2 -2
- package/web/dist/assets/{classDiagram-v2-4MYWR3UA-DCLkhvEY.js → classDiagram-v2-4MYWR3UA-Cr43uJqI.js} +1 -1
- package/web/dist/assets/{cose-bilkent-JH36ORCC-BS2NC7iI.js → cose-bilkent-JH36ORCC-Cuuq6WQQ.js} +1 -1
- package/web/dist/assets/{cynefin-EF2NZ3EQ-4mFSoXYF.js → cynefin-EF2NZ3EQ-C3iyCS68.js} +1 -1
- package/web/dist/assets/{cynefinDiagram-WF24UDRP-Mw4rChGW.js → cynefinDiagram-WF24UDRP-bKF_V24p.js} +1 -1
- package/web/dist/assets/{dagre-NK4GIZVX-pE7C93hg.js → dagre-NK4GIZVX-BP6HiUix.js} +1 -1
- package/web/dist/assets/{diagram-CBK3MWTC-BEMAaUjh.js → diagram-CBK3MWTC--Bdnc_hg.js} +1 -1
- package/web/dist/assets/{diagram-I5XIIV2D-CkYyKCp0.js → diagram-I5XIIV2D-Cb_w9kpf.js} +1 -1
- package/web/dist/assets/{diagram-ODIL2UCW-CqlkTPFd.js → diagram-ODIL2UCW-dTgly2Fz.js} +1 -1
- package/web/dist/assets/{diagram-PFBEJUXE-fHMT170j.js → diagram-PFBEJUXE-BjGtD0ca.js} +1 -1
- package/web/dist/assets/{diagram-RJA3I4VV-DcXq8RD9.js → diagram-RJA3I4VV-7yxAtb-a.js} +1 -1
- package/web/dist/assets/{diagram-TYUNFSNR-BKRe_vPM.js → diagram-TYUNFSNR-CdDNua7n.js} +1 -1
- package/web/dist/assets/{ebnfDiagram-V4P3TTPT-Cbk3uiFJ.js → ebnfDiagram-V4P3TTPT-BNdBmqlo.js} +1 -1
- package/web/dist/assets/{elk-QONTBCTQ-BqBMP6OE.js → elk-QONTBCTQ-CmnC5D_R.js} +1 -1
- package/web/dist/assets/{erDiagram-KYQIGQAA-Ct5UB1cs.js → erDiagram-KYQIGQAA-DbvWu-TF.js} +1 -1
- package/web/dist/assets/{flowDiagram-IUGLLWBU-CIs4aoLL.js → flowDiagram-IUGLLWBU-ElkzAMUI.js} +1 -1
- package/web/dist/assets/{ganttDiagram-R7GPNTJY-Wh-qfl6d.js → ganttDiagram-R7GPNTJY-CT2YIzjy.js} +1 -1
- package/web/dist/assets/{gitGraphDiagram-PDYL7XHY-BXgAEV6L.js → gitGraphDiagram-PDYL7XHY-DAXq_4wb.js} +1 -1
- package/web/dist/assets/{index-C9nnPdjX.js → index-CvSLBFhG.js} +2 -2
- package/web/dist/assets/{infoDiagram-MVDRKAX5-D8ypF4D2.js → infoDiagram-MVDRKAX5-DRP-H8zh.js} +1 -1
- package/web/dist/assets/{ishikawaDiagram-HPEHV2GE-C19zaDM_.js → ishikawaDiagram-HPEHV2GE-BNoK_XsT.js} +1 -1
- package/web/dist/assets/{journeyDiagram-BOSHW7O7-Cxh9cIZe.js → journeyDiagram-BOSHW7O7-pkpw5r9x.js} +1 -1
- package/web/dist/assets/{kanban-definition-FNSA4HC5-DsPTJfwn.js → kanban-definition-FNSA4HC5-Dt6SzUmC.js} +1 -1
- package/web/dist/assets/{linear-CCFgeLjG.js → linear-FQQ9tQr_.js} +1 -1
- package/web/dist/assets/{mermaid.core-B6ecop8m.js → mermaid.core-BZ6wQkn-.js} +4 -4
- package/web/dist/assets/{mindmap-definition-6OY57UG3-BGuokJbh.js → mindmap-definition-6OY57UG3-Bb2sk6RX.js} +1 -1
- package/web/dist/assets/{pegDiagram-ECIUJNBX-eSCc6TvR.js → pegDiagram-ECIUJNBX-CQKk04_1.js} +1 -1
- package/web/dist/assets/{pieDiagram-GNMPY74T-DZC03UXt.js → pieDiagram-GNMPY74T-BfKw-loG.js} +1 -1
- package/web/dist/assets/{quadrantDiagram-D57K4MC3-CyXhndWM.js → quadrantDiagram-D57K4MC3-CuWo9HYa.js} +1 -1
- package/web/dist/assets/{railroadDiagram-Y72NRBL7-BQAWVPzH.js → railroadDiagram-Y72NRBL7-Di4q_SJ_.js} +1 -1
- package/web/dist/assets/{requirementDiagram-EQYSW5RA-zFI-MRiW.js → requirementDiagram-EQYSW5RA-DC4GU4Pk.js} +1 -1
- package/web/dist/assets/{sankeyDiagram-SY24JHO5-Cf0W1k3B.js → sankeyDiagram-SY24JHO5-_fgVuzHE.js} +1 -1
- package/web/dist/assets/{sequenceDiagram-BLEHNHQU-DZDbLH09.js → sequenceDiagram-BLEHNHQU-Bqlr7yoo.js} +1 -1
- package/web/dist/assets/{sizeCapture-INFHLROL-DHeTaZST.js → sizeCapture-INFHLROL-CbbBAQPu.js} +1 -1
- package/web/dist/assets/{stateDiagram-v2-A6IESKWZ-gdkehZVO.js → stateDiagram-v2-A6IESKWZ-DoMyztsn.js} +1 -1
- package/web/dist/assets/{swimlanes-B3ENRKFQ-CaXIpd5v.js → swimlanes-B3ENRKFQ-BvuDLV2j.js} +1 -1
- package/web/dist/assets/swimlanesDiagram-AYQRV4AK-Dxt3sSM3.js +8 -0
- package/web/dist/assets/{timeline-definition-JXYKGLGB-B9xgit-m.js → timeline-definition-JXYKGLGB-Bvrh9DNs.js} +1 -1
- package/web/dist/assets/{usecaseDiagram-WPOLBNNX-MabBSksg.js → usecaseDiagram-WPOLBNNX-DPY4EcsJ.js} +1 -1
- package/web/dist/assets/{vennDiagram-Q3Y3IDCW-XXoUFseC.js → vennDiagram-Q3Y3IDCW-BFo8so0I.js} +1 -1
- package/web/dist/assets/{wardleyDiagram-IVAIDKWA-CKpPqLnu.js → wardleyDiagram-IVAIDKWA-DYzIhyA5.js} +1 -1
- package/web/dist/assets/{xychartDiagram-4URNHDU4-BIjdftbg.js → xychartDiagram-4URNHDU4-l_k66Yd_.js} +1 -1
- package/web/dist/index.html +1 -1
- package/web/dist/assets/channel-DWYdW6gS.js +0 -1
- package/web/dist/assets/swimlanesDiagram-AYQRV4AK-rV1V-rKA.js +0 -8
|
@@ -69,8 +69,8 @@ Error generating stack: `+p.message+`
|
|
|
69
69
|
`};function qd(t,u){if(!u||!/\.md$/i.test(u))return{html:If(Re.render(t,{docPath:u})),commentable:!1,units:[],comments:[]};const o=M3(t),i=o.text.split(`
|
|
70
70
|
`),s=zd(i),c={lines:i,lineMap:o.lineMap,fmEnd:s,comments:o.comments,anchors:j3(t),units:[],claimed:new Set};let f=o.text,d="";s>=0&&(d=z3(i.slice(1,s),Re.utils.escapeHtml),f=i.map((k,x)=>x<=s?"":k).join(`
|
|
71
71
|
`));const h=d+If(Re.render(f,{docPath:u,cm:c})),m=o.comments.map(k=>{const x=c.units.find(_=>{var v;return((v=_.comment)==null?void 0:v.id)===k.id});if(x)return{id:k.id,content:k.content,line:x.startLine+1,preview:x.preview};let b=-1;for(let _=0;_<o.lineMap.length&&o.lineMap[_]<=k.hostLine;_++)b=_;return{id:k.id,content:k.content,line:k.hostLine+1,preview:Ud(i[Math.max(0,b)]??"")}});return{html:h,commentable:!0,units:c.units,comments:m}}function pg(t,u){return!Number.isInteger(u)||u<=0||u>=t.length?t:[t[u],...t.slice(0,u),...t.slice(u+1)]}function hg(t,u){return!Number.isInteger(u)||u<0||u>=t.length?t:[...t.slice(0,u),...t.slice(u+1)]}function Hd(t){return t.map(di).join("~")}function mg(t){return t.split("~").filter(Boolean).map(u=>{if(u.startsWith("c:"))return{kind:"ctag",value:u.slice(2)};if(u.startsWith("f:"))try{return{kind:"file",value:decodeURIComponent(u.slice(2))}}catch{return null}return null}).filter(u=>!!u)}function gg(t,u=window.location){return`${u.origin}${u.pathname}#/browse?cols=c:${t}`}function Wd(t){const[u,o=""]=t.replace(/^#/,"").split("?"),i=u==="/browse"||u==="/browse/",s=u==="/temp"||u==="/temp/",c=new URLSearchParams(o),f=mg(c.get("cols")??""),d=c.get("vault")??void 0;return{isBrowse:i,isTemp:s,cols:f,vault:d}}const Vd="#/browse";function yg(t){const{isBrowse:u,isTemp:o}=Wd(t);return u||o?null:Vd}let $s="";function xg(t){return t&&t===$s?($s="",!0):!1}let zs=!1;function vg(){zs=!0}function kg(t,u){const o=[`cols=${Hd(t)}`];u&&o.push(`vault=${encodeURIComponent(u)}`);const i=`#/browse?${o.join("&")}`,s=zs;zs=!1,i!==window.location.hash&&($s=i,s?window.location.replace(i):window.location.hash=i)}const bg=new RegExp(`^def#file_[^\\s]*?\\.(\\d{6}_${tc}_ctag)\\.?\\s*(?:—.*)?$`);function Kd(t){var o;if(!t)return;const u=t.split(`
|
|
72
|
-
`,1)[0].trim();return(o=bg.exec(u))==null?void 0:o[1]}const _g="vault-api-
|
|
73
|
-
`).length:0,html:s?s.html:`<p class="muted">读取失败:${i.error??""}</p>`,hash:i.hash,mtimeMs:i.mtimeMs,fileKey:Kd(i.content),commentable:!!s&&s.commentable&&!!i.hash,units:(s==null?void 0:s.units)??[],comments:(s==null?void 0:s.comments)??[]}}))).map((o,i)=>o.status==="fulfilled"?o.value:{path:t[i].path,ok:!1,defLine:t[i].defLine,occs:t[i].occs??[],lineCount:0,html:`<p class="muted">读取失败:${String(o.reason)}</p>`})}let Et=0;async function Eg(t){var u;try{if(t.kind==="file"){const f=await wr([{path:t.value,defLine:null,kind:"link"}]);return(u=f[0])!=null&&u.ok?{kind:"file",anchor:t.value,path:t.value,files:f}:null}const o=`def#${t.value}_ctag.`,i=await li("/resolve-open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clicked:o})}),s=i.files??[];if(!i.ok||!s.length)return null;const c=await wr(s);return{kind:"ctag",anchor:o,keyCore:i.keyCore??t.value,files:c}}catch{return null}}const Se=Mr((t,u)=>({columns:[],truncateAt:o=>t({columns:u().columns.slice(0,o)}),closeColumn:o=>t({columns:hg(u().columns,o)}),moveColumnToFirst:o=>{const i=pg(u().columns,o);i!==u().columns&&(vg(),t({columns:i}))},applyDoc:(o,i,s,c)=>{const f=qd(i,o),d={html:f.html,hash:s,mtimeMs:c,fileKey:Kd(i),missing:!1,commentable:f.commentable,units:f.units,comments:f.comments};t({columns:u().columns.map(h=>h.files.some(m=>m.path===o)?{...h,files:h.files.map(m=>m.path===o?{...m,...d}:m)}:h)})},reloadDoc:async(o,i)=>{try{const s=await li(`/file?path=${encodeURIComponent(o)}`);return!s.ok||s.content===void 0||!s.hash||i&&!i()?!1:(u().applyDoc(o,s.content,s.hash,s.mtimeMs),!0)}catch{return!1}},relocateDoc:async(o,i)=>(t({columns:u().columns.map(s=>{if(!s.files.some(f=>f.path===o))return s;const c=s.files.map(f=>f.path===o?{...f,path:i,missing:!1}:f);return s.kind==="file"&&s.path===o?{...s,path:i,anchor:s.anchor===o?i:s.anchor,files:c}:{...s,files:c}})}),u().reloadDoc(i)),markMissing:o=>{t({columns:u().columns.map(i=>i.files.some(s=>s.path===o&&!s.missing)?{...i,files:i.files.map(s=>s.path===o?{...s,missing:!0}:s)}:i)})},openAnchor:async(o,i)=>{var c,f;const s=++Et;try{const d=await li("/resolve-open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(s!==Et)return;if(!d.ok){d.note&&Xe.getState().show(d.note);return}const h=d.files??[];if(!h.length){d.note&&Xe.getState().show(d.note);return}const m=await wr(h);if(s!==Et)return;const k=o.clicked||((c=o.link)==null?void 0:c.href)||"",x=d.kind==="link"||!d.keyCore?{kind:"file",anchor:k,path:((f=h[0])==null?void 0:f.path)??"",files:m}:{kind:"ctag",anchor:k,keyCore:d.keyCore,files:m,fromClick:!0,openId:s},b=u().columns;t({columns:b.slice(0,i).concat([x])})}catch(d){s===Et&&Xe.getState().show(`打开失败:${String(d)}`)}},openFile:async(o,i)=>{var c;const s=++Et;try{const f=await wr([{path:o,defLine:null,kind:"link"}]);if(s!==Et)return;if(!((c=f[0])!=null&&c.ok)){Xe.getState().show(`打不开:${o}`);return}const d={kind:"file",anchor:o,path:o,files:f};t({columns:u().columns.slice(0,i).concat([d])})}catch(f){s===Et&&Xe.getState().show(`打开失败:${String(f)}`)}},openFileAt:async(o,i,s)=>{var f;const c=++Et;try{const d=await wr([{path:o,defLine:i,kind:"link"}]);if(c!==Et)return;if(!((f=d[0])!=null&&f.ok)){Xe.getState().show(`打不开:${o}`);return}const h={kind:"file",anchor:o,path:o,files:d,focusLine:i,openId:c};t({columns:u().columns.slice(0,s).concat([h])})}catch(d){c===Et&&Xe.getState().show(`打开失败:${String(d)}`)}},restore:async o=>{const i=++Et,s=await Promise.all(o.map(d=>Eg(d)));if(i!==Et)return;const c=s.findIndex(d=>!d),f=c===-1?s:s.slice(0,c);c!==-1&&Xe.getState().show(`有 ${s.length-c} 列打不开,已省略`),t({columns:f})}})),nc="deck:scroll",Uf=()=>({tree:{open:[],months:{}},cols:{},canvas:0});function rn(){var t,u;try{const o=sessionStorage.getItem(nc);if(!o)return Uf();const i=JSON.parse(o),s={};for(const[c,f]of Object.entries(((t=i.tree)==null?void 0:t.months)??{}))typeof f=="boolean"&&(s[c]=f);return{tree:{open:Array.isArray((u=i.tree)==null?void 0:u.open)?i.tree.open.filter(c=>typeof c=="string"):[],months:s},cols:i.cols??{},canvas:i.canvas??0}}catch{return Uf()}}let gt=null,wu=null;function vi(t){gt=t,!wu&&(wu=setTimeout(()=>{wu=null;const u=gt;if(gt=null,!!u)try{sessionStorage.setItem(nc,JSON.stringify(u))}catch{}},150))}function Sg(t){return(gt??rn()).cols[t]}function Dg(t,u){const o=gt??rn();vi({...o,cols:{...o.cols,[t]:u}})}function Ag(){return(gt??rn()).canvas}function Fg(t){const u=gt??rn();vi({...u,canvas:t})}function Ng(){return[...(gt??rn()).tree.open]}function qf(t){const u=gt??rn();vi({...u,tree:{...u.tree,open:[...new Set(t)]}})}function Tg(){return{...(gt??rn()).tree.months}}function jg(t){const u=gt??rn();vi({...u,tree:{...u.tree,months:{...t}}})}function Lg(t={}){const u=gt??rn();wu&&(clearTimeout(wu),wu=null),gt=null;try{sessionStorage.setItem(nc,JSON.stringify({...u,tree:{open:[],months:t}}))}catch{}}function Es(t){return[...new Set(t.filter(Boolean))]}function Mg(t){const u=new URL("/tree",window.location.origin);return t.forEach(o=>u.searchParams.append("path",o)),u.toString()}async function Rg(t){const u=await Dt(Mg(t));if(!u.ok)throw new Error(`读取目录失败:HTTP ${u.status}`);const o=await u.json();return t.length===1?[o]:o.results??[]}const _e=Mr((t,u)=>({openPaths:[],monthOpen:{},dataByPath:{},loadingPaths:{},hydrated:!1,activePath:"",setActivePath:o=>{u().activePath!==o&&t({activePath:o})},hydrate:()=>{u().hydrated||t({openPaths:Es(Ng()),monthOpen:Tg(),hydrated:!0})},isOpen:o=>u().openPaths.includes(o),setOpen:(o,i)=>{const s=u().openPaths,c=i?Es([...s,o]):s.filter(f=>f!==o);c.length===s.length&&c.every((f,d)=>f===s[d])||(t({openPaths:c}),qf(c))},setMonthOpen:(o,i)=>{if(u().monthOpen[o]===i)return;const s={...u().monthOpen,[o]:i};t({monthOpen:s}),jg(s)},closeAll:(o=[])=>{const s={...Object.fromEntries(Object.entries(u().monthOpen).filter(([c])=>c.startsWith("root:"))),...Object.fromEntries(o.map(c=>[c,!1]))};t({openPaths:[],monthOpen:s}),Lg(s)},load:async o=>{const i=Es(o).filter(s=>{var c;return!((c=u().dataByPath[s])!=null&&c.ok)&&!u().loadingPaths[s]});if(i.length){t(s=>({loadingPaths:{...s.loadingPaths,...Object.fromEntries(i.map(c=>[c,!0]))}}));try{const s=await Rg(i),c=Object.fromEntries(s.map(h=>[h.path??"",h])),f=i.filter(h=>!c[h]),d=s.filter(h=>h.missing).map(h=>h.path).filter(Boolean);t(h=>({openPaths:h.openPaths.filter(m=>!d.includes(m)),dataByPath:{...h.dataByPath,...c,...Object.fromEntries(f.map(m=>[m,{ok:!1,path:m,error:"没有返回这一层"}]))},loadingPaths:{...h.loadingPaths,...Object.fromEntries(i.map(m=>[m,!1]))}})),d.length&&qf(u().openPaths)}catch(s){t(c=>({dataByPath:{...c.dataByPath,...Object.fromEntries(i.map(f=>[f,{ok:!1,path:f,error:String(s instanceof Error?s.message:s)}]))},loadingPaths:{...c.loadingPaths,...Object.fromEntries(i.map(f=>[f,!1]))}}))}}}})),Pg=/^(\d{2})(0[1-9]|1[0-2])$/;function Hf(t){const u=Pg.exec(t);return u?`20${u[1]}-${u[2]}`:null}function Ss(t,u){return`${String(t%100).padStart(2,"0")}${String(u).padStart(2,"0")}`}function $g(t){const u=t.getFullYear(),o=t.getMonth()+1,i=new Set([Ss(u,o)]);return t.getDate()<=15&&i.add(o===1?Ss(u-1,12):Ss(u,o-1)),i}function zg(t,u){const o=$g(u),i=new Map,s=[];for(const d of t)if(d.month&&Hf(d.month)){const h=i.get(d.month)??[];h.push(d),i.set(d.month,h)}else s.push(d);const c=(d,h)=>d.name.localeCompare(h.name),f=[...i.keys()].sort((d,h)=>h.localeCompare(d)).map(d=>({key:d,label:Hf(d),items:i.get(d).sort(c),defaultOpen:o.has(d)}));return s.length&&f.push({key:"",label:"未归月份",items:s.sort(c),defaultOpen:!0}),f}function Du(t,u){return!!u&&t.startsWith(u+"/")}function Og(t,u){let o=null;for(const i of u)Du(t,i.path)&&(!o||i.path.length>o.path.length)&&(o=i);return o}function Ig(t,u){if(!Du(t,u))return[];const o=t.slice(u.length+1).split("/");o.pop();const i=[u];let s=u;for(const c of o)s=`${s}/${c}`,i.push(s);return i}function Bg(t,u){const o=new Set(t),i=new Set;return u.forEach((s,c)=>{o.has(s)||i.add(c)}),u.length&&u[0]!==t[0]&&i.add(0),[...i].sort((s,c)=>s-c)}function Qd({data:t,busy:u,depth:o}){if(u&&!t)return y.jsx("div",{className:"tree-hint",style:{paddingLeft:o*14+14},children:"载入中…"});if(!(t!=null&&t.ok))return y.jsx("div",{className:"tree-hint",style:{paddingLeft:o*14+14},children:"读不到这一层"});const i=t.dirs??[],s=t.files??[];return!i.length&&!s.length?y.jsx("div",{className:"tree-hint",style:{paddingLeft:o*14+14},children:"(空)"}):y.jsxs(y.Fragment,{children:[i.map(c=>y.jsx(Ug,{name:c.name,path:c.path,depth:o},c.path)),s.map(c=>y.jsx(qg,{name:c.name,path:c.path,depth:o},c.path))]})}function Ug({name:t,path:u,depth:o}){const i=_e(k=>k.isOpen(u)),s=_e(k=>k.dataByPath[u]??null),c=_e(k=>!!k.loadingPaths[u]),f=_e(k=>Du(k.activePath,u)),d=_e(k=>k.setOpen),h=_e(k=>k.load),m=()=>{const k=!i;d(u,k),k&&h([u])};return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:`tree-row${f?" has-active":""}`,style:{paddingLeft:o*14},onClick:m,title:u,children:[y.jsx("span",{className:"tree-caret",children:i?"▾":"▸"}),t]}),i&&y.jsx(Qd,{data:s,busy:c,depth:o+1})]})}function qg({name:t,path:u,depth:o}){const i=Se(f=>f.openFile),s=t==="_index.md",c=_e(f=>f.activePath===u);return y.jsxs("div",{className:`tree-row tree-file${s?" is-index":""}${c?" is-active":""}`,style:{paddingLeft:o*14+14},onClick:()=>void i(u,0),title:u,children:[t,s&&y.jsx("span",{className:"tree-tag",children:"总览"})]})}function Hg({v:t,current:u}){const o=_e(m=>m.isOpen(t.path)),i=_e(m=>m.dataByPath[t.path]??null),s=_e(m=>!!m.loadingPaths[t.path]),c=_e(m=>Du(m.activePath,t.path)),f=_e(m=>m.setOpen),d=_e(m=>m.load),h=()=>{const m=!o;f(t.path,m),m&&d([t.path])};return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:`tree-row tree-vault${u?" is-current":""}${c?" has-active":""}`,onClick:h,title:t.path,children:[y.jsx("span",{className:"tree-caret",children:o?"▾":"▸"}),y.jsx("b",{children:t.title??t.descr??t.name}),y.jsx("code",{children:t.keyCore})]}),o&&y.jsx(Qd,{data:i,busy:s,depth:1})]})}function Wg({monthKey:t,label:u,count:o,defaultOpen:i,hasActive:s,children:c}){const f=_e(h=>h.monthOpen[t]??i),d=_e(h=>h.setMonthOpen);return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:`tree-row tree-month${s?" has-active":""}`,onClick:()=>d(t,!f),children:[y.jsx("span",{className:"tree-caret",children:f?"▾":"▸"}),u," ",y.jsxs("span",{className:"muted",children:["(",o,")"]})]}),f&&y.jsx("div",{className:"tree-month-body",children:c})]})}const Go=(t,u)=>`${t}|${u.key}`,vr=t=>`root:${t}`;function Vg({rootPath:t,title:u,total:o,hasActive:i,children:s}){const c=vr(t),f=_e(h=>h.monthOpen[c]??!0),d=_e(h=>h.setMonthOpen);return y.jsxs("section",{className:"tree-root",children:[y.jsxs("div",{className:`tree-root-title tree-root-toggle${i?" has-active":""}`,title:t,onClick:()=>d(c,!f),children:[y.jsxs("span",{children:[y.jsx("span",{className:"tree-caret",children:f?"▾":"▸"}),u," ",y.jsxs("span",{className:"muted",children:["(",o,")"]})]}),y.jsx("span",{className:"tree-root-path secondary",children:t})]}),f&&s]})}function Kg({onSearch:t,currentVaultPath:u}){const[o,i]=M.useState(null),[s,c]=M.useState(!1),f=_e(F=>F.openPaths),d=_e(F=>F.hydrated),h=_e(F=>F.hydrate),m=_e(F=>F.setOpen),k=_e(F=>F.closeAll),x=_e(F=>F.load),b=_e(F=>F.activePath),_=Se(F=>F.columns),v=M.useMemo(()=>new Date,[]);M.useEffect(()=>{h()},[h]),M.useEffect(()=>{u&&m(u,!0)},[u,m]),M.useEffect(()=>{d&&f.length&&x(f)},[d,x,f]),M.useEffect(()=>{const F=new AbortController;return Dt("/overview",{signal:F.signal}).then(z=>z.json()).then(z=>z.ok?i(z):c(!0)).catch(z=>{(z==null?void 0:z.name)!=="AbortError"&&c(!0)}),()=>F.abort()},[]);const D=F=>zg(((o==null?void 0:o.vaults)??[]).filter(z=>z.root===F),v);M.useEffect(()=>{if(!o||!u)return;const F=o.vaults.find(I=>I.path===u);if(!F)return;const z=D(F.root).find(I=>I.items.some(G=>G.path===F.path));if(!z)return;const{monthOpen:L,setMonthOpen:E}=_e.getState();L[vr(F.root)]===!1&&E(vr(F.root),!0);const P=Go(F.root,z);(L[P]??z.defaultOpen)||E(P,!0)},[o,u]);const T=M.useRef([]),O=M.useRef([]);M.useEffect(()=>{const F=_.map(di),z=Bg(T.current,F);T.current=F;for(const I of z)for(const G of _[I].files)O.current.push(G.path);if(!o||!O.current.length)return;const L=[...new Set(O.current)];O.current=[];const{monthOpen:E,setMonthOpen:P}=_e.getState();for(const I of L){const G=Og(I,o.vaults);if(!G)continue;E[vr(G.root)]===!1&&P(vr(G.root),!0);const oe=D(G.root).find(ae=>ae.items.some(ye=>ye.path===G.path));if(oe){const ae=Go(G.root,oe);(E[ae]??oe.defaultOpen)||P(ae,!0)}Ig(I,G.path).forEach(ae=>m(ae,!0))}},[_,o]);const $=()=>k(((o==null?void 0:o.roots)??[]).flatMap(F=>D(F.path).map(z=>Go(F.path,z))));return y.jsxs("div",{className:"col nav",children:[y.jsxs("div",{className:"nav-head",children:[y.jsx("h3",{className:"nav-title",children:"话题"}),y.jsxs("div",{className:"nav-actions",children:[y.jsx("button",{className:"nav-action-btn",onClick:$,title:"收起所有月份、话题和文件夹",children:"全收起"}),y.jsxs("button",{className:"nav-action-btn",onClick:t,title:"搜信息点(⌘K)",children:["搜信息点",y.jsx("span",{className:"kbd-hint",children:"⌘K"})]})]})]}),o&&y.jsxs("div",{className:"nav-counts muted",title:"话题集合 / 话题 / 信息点 / 文件",children:["roots ",o.counts.roots," · vaults ",o.counts.vaults," · 信息点 ",o.counts.points," · 文件 ",o.counts.files]}),s&&y.jsx("p",{className:"muted",children:"加载失败"}),!o&&!s&&y.jsx("p",{className:"muted",children:"加载中…"}),o==null?void 0:o.roots.map(F=>{const z=D(F.path),L=z.reduce((E,P)=>E+P.items.length,0);return y.jsx(Vg,{rootPath:F.path,title:F.name??F.path,total:L,hasActive:z.some(E=>E.items.some(P=>Du(b,P.path))),children:z.map(E=>y.jsx(Wg,{monthKey:Go(F.path,E),label:E.label,count:E.items.length,defaultOpen:E.defaultOpen,hasActive:E.items.some(P=>Du(b,P.path)),children:E.items.map(P=>y.jsx(Hg,{v:P,current:P.path===u},P.path))},E.key))},F.path)})]})}function si(t,u){const o=u-(t.scrollHeight-t.clientHeight);if(o>0){const i=parseFloat(getComputedStyle(t).paddingBottom)||0;t.style.paddingBottom=`${Math.ceil(i+o)}px`}t.scrollTop=u}const Qg="modulepreload",Zg=function(t){return"/app/"+t},Wf={},Gg=function(u,o,i){let s=Promise.resolve();if(o&&o.length>0){let f=function(m){return Promise.all(m.map(k=>Promise.resolve(k).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),h=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));s=f(o.map(m=>{if(m=Zg(m),m in Wf)return;Wf[m]=!0;const k=m.endsWith(".css"),x=k?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${x}`))return;const b=document.createElement("link");if(b.rel=k?"stylesheet":Qg,k||(b.as="script"),b.crossOrigin="",b.href=m,h&&b.setAttribute("nonce",h),document.head.appendChild(b),k)return new Promise((_,v)=>{b.addEventListener("load",_),b.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(f){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=f,window.dispatchEvent(d),!d.defaultPrevented)throw f}return s.then(f=>{for(const d of f||[])d.status==="rejected"&&c(d.reason);return u().catch(c)})};let Ds=null;function Yg(){return Ds||(Ds=Gg(()=>import("./mermaid.core-B6ecop8m.js").then(t=>t.bA),[]).then(t=>{const u=t.default;return u.initialize({startOnLoad:!1,securityLevel:"strict"}),u})),Ds}function Vf(t,u){const o=document.createElement("pre");o.className="mermaid-fallback",o.textContent=u,t.replaceWith(o)}async function Xg(t){const u=Array.from(t.querySelectorAll(".mermaid:not([data-processed])"));if(!u.length)return;const o=new Map(u.map(s=>[s,s.textContent??""]));let i;try{i=await Yg()}catch{u.forEach(s=>Vf(s,o.get(s)??""));return}for(const s of u)if(s.isConnected)try{await i.run({nodes:[s],suppressErrors:!1})}catch{Vf(s,o.get(s)??"")}}function Jg(t){const u=t.getBoundingClientRect(),o=t.viewBox.baseVal,i=t.cloneNode(!0);i.setAttribute("width",String(o.width||u.width)),i.setAttribute("height",String(o.height||u.height)),i.style.removeProperty("max-width"),i.setAttribute("xmlns","http://www.w3.org/2000/svg");const s=new XMLSerializer().serializeToString(i);return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`}const Zd=2,e6=8;function t6(t,u,o=Zd,i=e6){const s=t.wrapLeft+o+t.btnsWidth+i-u;return s>0?Math.ceil(s):0}function n6(t,u){return t.map(o=>t6(o,u))}function u6(t){const u=t.closest(".col");if(!u)return;const o=u.getBoundingClientRect().left+u.clientWidth,i=[];t.querySelectorAll(".cm-btnwrap").forEach(c=>{var d;if(c.closest(".cb")||(d=c.closest(".cm-unit"))!=null&&d.classList.contains("cm-block"))return;const f=c.firstElementChild;f&&i.push({btns:f,box:{wrapLeft:c.getBoundingClientRect().left,btnsWidth:f.getBoundingClientRect().width}})});const s=n6(i.map(c=>c.box),o);i.forEach((c,f)=>r6(c.btns,s[f]))}function r6(t,u){t.style.left=u?`${Zd-u}px`:"",t.classList.toggle("cm-shifted",u>0)}function o6(t){let u=0;return{request(){u||(u=requestAnimationFrame(()=>{u=0,u6(t)}))},cancel(){u&&cancelAnimationFrame(u),u=0}}}const i6=new RegExp(`^(.*)\\.(\\d{6}_${tc}_ctag)$`);function uc(t){const u=t.split("/").slice(0,-1);for(let o=u.length-1;o>=0;o--){const i=i6.exec(u[o]);if(i)return{descr:i[1],key:i[2],ctag:`ref#${u[o]}.`}}return null}function Gd(t){return t.replace(/^(?:def|ref)#/,"def#")}const l6=40,s6=3,c6=6e4,a6="defCount,defFile,refsCount";function f6(t){const u=t.matched?t.defs??[]:[],o=t.matched?t.defCount??u.length:0;return{matched:!!t.matched,hasDef:o>0,defCount:o,refsCount:t.matched?t.refsCount??0:0,...u[0]?{def:{file:u[0].file,line:u[0].line}}:{}}}function d6(t,u=l6){const o=[];for(let i=0;i<t.length;i+=u)o.push(t.slice(i,i+u));return o}function p6(t,u,o){if(!t)return{miss:!1,metaText:""};if(u==="ref"&&!t.hasDef)return{miss:!0,metaText:"查无 def"};if(t.def&&o){const i=uc(t.def.file);if(i&&i.key!==o)return{miss:!1,metaText:`↗ ${i.descr||i.key}`}}return{miss:!1,metaText:""}}const rc=new Map,kr=new Map;let ci=0;const Os=new Set;function h6(){return ci}function Yd(t){return Os.add(t),()=>{Os.delete(t)}}const m6={fetch:t=>Dt(t),now:()=>Date.now()};function ki(t,u=Date.now()){const o=rc.get(t);return o&&u-o.at<c6?o.meta:void 0}function g6(){ci++,rc.clear(),kr.clear();for(const t of[...Os])t()}let As=0;const Kf=[];async function y6(t){As>=s6?await new Promise(u=>Kf.push(u)):As++;try{return await t()}finally{const u=Kf.shift();u?u():As--}}async function x6(t,u){const o=ci;try{const i=t.map(d=>`ctag=${encodeURIComponent(d)}`).join("&"),s=await y6(()=>u.fetch(`/locate-ctag?${i}&fields=${a6}`));if(!s.ok)return;const c=await s.json();if(!c.ok||ci!==o)return;const f=u.now();for(const d of c.hits??[])rc.set(d.query,{at:f,meta:f6(d)})}catch{}}async function v6(t,u=m6){const o=u.now(),i=[],s=[];for(const c of new Set(t)){if(ki(c,o))continue;const f=kr.get(c);f?i.push(f):s.push(c)}for(const c of d6(s)){const f=x6(c,u).finally(()=>{for(const d of c)kr.get(d)===f&&kr.delete(d)});for(const d of c)kr.set(d,f);i.push(f)}await Promise.all(i)}const Xd=".ctag-link[data-key]";function k6(t){const u=new Set;for(const o of Array.from(t.querySelectorAll(Xd))){const i=o.getAttribute("data-key");i&&u.add(i)}return[...u]}function Qf(t,u,o){const i=t.getAttribute(u);return o===""?i===null?!1:(t.removeAttribute(u),!0):i===o?!1:(t.setAttribute(u,o),!0)}function Jd(t,u,o=ki){let i=!1;for(const s of Array.from(t.querySelectorAll(Xd))){const c=s.getAttribute("data-key"),f=c?o(c):void 0;if(!f)continue;const d=p6(f,s.getAttribute("data-kind")??"",u);i=Qf(s,"data-miss",d.miss?"1":"")||i,i=Qf(s,"data-meta",d.metaText)||i}return i}async function b6(t,u,o,i){const s=k6(t);return!s.length||s.every(c=>ki(c))||(await v6(s,i),!o()||t.isConnected===!1)?!1:Jd(t,u)}function _6(t,u){if(!t||u<1)return;const o=u-1;let i;for(const s of t)s.startLine>o||s.endLine<o||(!i||s.endLine-s.startLine<i.endLine-i.startLine)&&(i=s);return i}function w6(t,u,o,i){if(u<1||u>t.length)return null;const s=Math.max(1,u-o),c=Math.min(t.length,u+i),f=[];for(let d=s;d<=c;d++)f.push({n:d,t:t[d-1],hit:d===u});return{from:s,to:c,total:t.length,lines:f}}function C6(t,u,o,i,s){var c;return!o||!((c=t[u-1])!=null&&c.includes(o))?null:w6(t,u,i,s)}const Fs=56;function Zf(t,u){let o=0,i=t;for(;i&&i!==u;)o+=i.offsetTop,i=i.offsetParent;return o}const E6=y.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round",children:y.jsx("path",{d:"M1.5 4.2c0-.7.5-1.2 1.2-1.2h3l1.4 1.6h6.2c.7 0 1.2.5 1.2 1.2v6.2c0 .7-.5 1.2-1.2 1.2H2.7c-.7 0-1.2-.5-1.2-1.2z"})});function S6({card:t,keyCore:u,primary:o,onSettled:i}){const s=M.useRef(null),c=uc(t.path),f=c==null?void 0:c.key,d=M.useRef(null),h=M.useSyncExternalStore(Yd,h6),m=M.useRef(t.units);m.current=t.units;const k=M.useCallback(()=>{if(!o)return;const v=s.current;if(!v)return;const D=v.closest(".col");if(!D)return;const T=()=>{const F=v.querySelector(".md"),z=Math.max(0,Math.min(1,((t.defLine??1)-1)/(t.lineCount||1)));D.scrollTop=Math.max(0,v.offsetTop+(F?F.offsetTop-v.offsetTop:0)+z*(F?F.offsetHeight:0)-Fs)};if(!u){if(!t.defLine)return;const F=_6(m.current,t.defLine),z=F?v.querySelector(`[data-cm="${F.i}"]`):null;z?si(D,Math.max(0,Zf(z,D)-Fs)):T();return}const $=Array.prototype.filter.call(v.querySelectorAll(".ctag-link"),F=>decodeURIComponent(F.getAttribute("data-ctag")||"").includes(`.${u}_ctag`)).find(F=>decodeURIComponent(F.getAttribute("data-ctag")||"").startsWith("def#"))||null;if($){si(D,Math.max(0,Zf($,D)-Fs));return}t.defLine&&T()},[t.defLine,t.lineCount,u,o]);M.useEffect(()=>{k()},[k]);const x=M.useRef(!1);M.useEffect(()=>{const v=s.current;if(!v)return;const D=T=>{var $;const O=T.target;($=O==null?void 0:O.matches)!=null&&$.call(O,"details.fm")&&(x.current=O.open)};return v.addEventListener("toggle",D,!0),()=>v.removeEventListener("toggle",D,!0)},[]),M.useLayoutEffect(()=>{var D;if(!x.current)return;const v=(D=s.current)==null?void 0:D.querySelector("details.fm");v&&!v.open&&(v.open=!0)},[t.html]);const b=M.useRef(!1);M.useEffect(()=>{var $,F;const v=($=s.current)==null?void 0:$.querySelector(".md");if(!v)return;const D=o6(v);d.current=D,D.request();const T=new ResizeObserver(()=>D.request());T.observe(v);let O=!0;return(F=document.fonts)==null||F.ready.then(()=>{O&&D.request()}),()=>{O=!1,d.current=null,T.disconnect(),D.cancel()}},[t.html]),M.useLayoutEffect(()=>{var D;const v=(D=s.current)==null?void 0:D.querySelector(".md");v&&Jd(v,f)},[t.html,f]),M.useEffect(()=>{var T;const v=(T=s.current)==null?void 0:T.querySelector(".md");if(!v)return;let D=!0;return b6(v,f,()=>D).then(O=>{var $;D&&O&&(($=d.current)==null||$.request())}),()=>{D=!1}},[t.html,f,h]),M.useEffect(()=>{const v=s.current;v&&Xg(v).then(()=>{b.current||(b.current=!0,k(),i==null||i())})},[t.html,k,i]);const _=t.defLine?{"data-defline":t.defLine,"data-linecount":t.lineCount,"data-defkey":u}:{};return y.jsxs("div",{className:"card",ref:s,"data-path":t.path,..._,children:[y.jsxs("div",{className:"card-path",children:[c&&y.jsxs("button",{type:"button",className:"card-topic","data-topic-ctag":c.ctag,title:`打开所在话题:${c.ctag}`,children:[E6,y.jsx("span",{children:c.descr||c.key})]}),y.jsx("span",{className:"card-path-text",children:t.path})]}),t.missing&&y.jsx("div",{className:"card-missing",role:"alert",children:"这个文件已不存在(可能被删除,或移动后无法追踪新位置),下面是之前读到的内容;刷新页面可重新打开"}),y.jsx("div",{className:"md",dangerouslySetInnerHTML:{__html:t.html}})]})}function D6({col:t,index:u}){const o=M.useRef(null),i=di(t),[s]=M.useState(()=>t.kind==="ctag"&&t.fromClick||t.kind==="file"&&t.focusLine!==void 0?void 0:Sg(i)),c=s!==void 0;M.useEffect(()=>{const x=o.current,b=x==null?void 0:x.closest("#canvas");if(!x||!b)return;const _=b.getBoundingClientRect().left,v=z=>z-_+b.scrollLeft,D=v(x.getBoundingClientRect().left),T=b.querySelectorAll(".col"),O=T[T.length-1],$=O?v(O.getBoundingClientRect().right):b.scrollWidth,F=Math.max(0,$-b.clientWidth);b.scrollTo({left:Math.min(D,F),behavior:"smooth"})},[i]),M.useEffect(()=>{const x=o.current;x&&c&&si(x,s)},[i]);const f=M.useCallback(()=>{const x=o.current;x&&c&&si(x,s)},[c,s]),d=M.useRef(0);M.useLayoutEffect(()=>{const x=o.current;x&&d.current&&x.scrollTop!==d.current&&(x.scrollTop=d.current)},[u]);const h=Se(x=>x.closeColumn),m=Se(x=>x.moveColumnToFirst),k=()=>{m(u),requestAnimationFrame(()=>{var x;(x=document.getElementById("canvas"))==null||x.scrollTo({left:0,behavior:"smooth"})})};return y.jsxs("div",{className:"col",ref:o,onScroll:x=>{const b=x.target.scrollTop;d.current=b,Dg(i,b)},children:[y.jsxs("span",{className:"col-ops",children:[u>0&&y.jsx("button",{type:"button",className:"col-op",title:"向左:移到第一列,其余列顺序不变","aria-label":"向左,移到第一列",onClick:k,children:"←"}),y.jsx("button",{type:"button",className:"col-op",title:"关闭这一列","aria-label":"关闭这一列",onClick:()=>h(u),children:"×"})]}),y.jsxs("div",{className:"col-head",children:["列 ",u+2," · ",t.anchor]}),(()=>{const x=t.kind==="ctag"&&!c?t.files.findIndex(b=>b.defLine):t.kind==="file"&&t.focusLine!==void 0?0:-1;return t.files.map((b,_)=>y.jsx(S6,{card:b,keyCore:t.kind==="ctag"?t.keyCore:"",primary:_===x,onSettled:f},b.path+_))})()]})}function ep(){const t=Xe(u=>u.msg);return y.jsx("div",{className:`toast${t?" show":""}`,children:t})}async function Nu(t){try{return await navigator.clipboard.writeText(t),!0}catch{try{const u=document.createElement("textarea");u.value=t,u.style.cssText="position:fixed;opacity:0;top:0;left:0",document.body.appendChild(u),u.select();const o=document.execCommand("copy");return u.remove(),o}catch{return!1}}}const tp="vault.panel.header",Gf=400,np=320,Is=520,Yf=60,bu=28,oc=16,up=8,A6=8,rp=32,Ns="(max-width: 719px)",F6="(pointer: coarse)",N6=5e3,T6=3e4,Tr=(t,u,o)=>Math.min(Math.max(t,u),Math.max(u,o)),ei=t=>typeof t=="number"&&Number.isFinite(t),Vn=t=>String(t).padStart(2,"0");function ic(t){return Tr(Math.round(t),np,Is)}function bi(t,u){return Math.max(bu,Math.min(ic(t),u-rp))}function Bs(t,u,o,i){return{x:Tr(t,0,i.width-oc-o.w),y:Tr(u,up,i.height-A6-o.h)}}function ai(t,u){const o=bi(t.w,u.width);if(!t.collapsed)return{...Bs(t.x,t.y,{w:o,h:Yf},u),w:o,h:Yf};const i=lc(o),s=Bs(t.x+i.dx,t.y+i.dy-ti,{w:bu+op,h:bu+ti},u);return{x:s.x,y:s.y+ti,w:bu,h:bu}}function j6(t,u=!1){const o=bi(Gf,t.width);return{x:t.width-o-oc,y:up,w:Gf,collapsed:u}}const op=4,ti=2;function lc(t){return{dx:t-bu-op,dy:ti}}function L6(t,u,o){if(t.collapsed===u)return t;if(u){const c=ai({...t,collapsed:!1},o);return{...t,x:c.x,y:c.y,collapsed:!0}}const i=ai(t,o),s=lc(bi(t.w,o.width));return{...t,x:i.x-s.dx,y:i.y-s.dy,collapsed:!1}}function M6(t,u,o,i){const s=lc(bi(o,i.width));return{x:t-s.dx,y:u-s.dy}}function ip(t){if(!t)return null;try{const u=t.getItem(tp);if(!u)return null;const o=JSON.parse(u);if(!o||typeof o!="object"||Array.isArray(o))return null;const i=o;return{...ei(i.x)&&ei(i.y)?{x:i.x,y:i.y}:{},...ei(i.w)?{w:ic(i.w)}:{},...typeof i.collapsed=="boolean"?{collapsed:i.collapsed}:{}}}catch{return null}}function R6(t,u,o){const i=ip(t),s=o?!0:(i==null?void 0:i.collapsed)??!1,c=j6(u,s);return{x:(i==null?void 0:i.x)??c.x,y:(i==null?void 0:i.y)??c.y,w:(i==null?void 0:i.w)??c.w,collapsed:s}}function Xf(t,u,o){var i;if(t)try{const s=o?((i=ip(t))==null?void 0:i.collapsed)??!1:u.collapsed;t.setItem(tp,JSON.stringify({x:Math.round(u.x),y:Math.round(u.y),w:ic(u.w),collapsed:s}))}catch{}}function P6(t,u,o,i){const s=i.width-rp,c=Math.min(np,s);if(u==="r"){const d=Tr(Math.round(t.w+o),c,Math.min(Is,s,i.width-oc-t.x));return{x:t.x,w:d}}const f=Tr(Math.round(t.w-o),c,Math.min(Is,s,t.x+t.w));return{x:t.x+t.w-f,w:f}}function $6(t,u){return t===null||u<t||u-t>=N6}function z6(t,u){const o=t?Date.parse(t):Number.NaN;if(!Number.isFinite(o))return"未更新";const i=Math.floor((u-o)/6e4);if(i<1)return"刚刚更新";if(i<60)return`${i} 分钟前更新`;if(i<1440)return`${Math.floor(i/60)} 小时前更新`;if(i<1440*30)return`${Math.floor(i/1440)} 天前更新`;const s=new Date(o);return`${Vn(s.getMonth()+1)}-${Vn(s.getDate())} 更新`}function O6(t){const u=t?Date.parse(t):Number.NaN;if(!Number.isFinite(u))return"—";const o=new Date(u);return`${o.getFullYear()}-${Vn(o.getMonth()+1)}-${Vn(o.getDate())} ${Vn(o.getHours())}:${Vn(o.getMinutes())}:${Vn(o.getSeconds())}`}function I6(t){if(!t||typeof t!="object"||Array.isArray(t))return{ok:!1,reason:"service"};const u=t,o={ok:!1};typeof u.branch=="string"&&u.branch&&(o.branch=u.branch),typeof u.fetchedAt=="string"&&u.fetchedAt&&(o.fetchedAt=u.fetchedAt);const i=s=>ei(s)&&s>=0?Math.floor(s):null;if(u.ok===!0){const s=i(u.ahead),c=i(u.behind);return s===null||c===null?{...o,reason:"service"}:{...o,ok:!0,ahead:s,behind:c}}return{...o,reason:typeof u.reason=="string"&&u.reason?u.reason:"service"}}const B6={"not-a-repo":"工作区目录不是 git 仓","no-remote":"没有配置 origin,或本地没有 origin/master",offline:"fetch 失败(断网、认证失败或远端拒绝)",timeout:"git 命令超过 3 秒没有返回",service:"连不上本地服务,或返回内容不对"};function lp(t){return t&&B6[t]||"原因不明"}function U6(t){if(!t)return{tone:"muted",local:"…",ball:"—",hint:"正在取数"};if(!t.ok)return{tone:"muted",local:"—",ball:"—",hint:`取不到:${lp(t.reason)}`};const u=t.ahead??0,o=t.behind??0,i=`↑${u} ↓${o}`;if(o>0)return{tone:"warn",local:i,ball:"↓",hint:`落后 origin/master ${o} 个提交`};const s=u>0?`,领先 ${u} 个提交`:"";return{tone:"ok",local:i,ball:"✓",hint:`没有落后 origin/master${s}`}}function q6(t,u){if(u(t))return t;for(let o=t.length-1;o>2;o--){const i=Math.ceil(o/2),s=o-i,c=`${t.slice(0,i)}…${s?t.slice(-s):""}`;if(u(c))return c}return`${t.slice(0,3)}…`}const Jf=["commit 工作区 all & 与远端 master 双向同步","","参考 ref#file_remote分支合并流程.261013_6rw3n_ctag."].join(`
|
|
72
|
+
`,1)[0].trim();return(o=bg.exec(u))==null?void 0:o[1]}const _g="vault-api-v3",wg="X-Vault-API-Version",Cg=(t={})=>({...t,headers:{[wg]:_g,...t.headers??{}}});async function Dt(t,u){return fetch(t,Cg(u))}let Cs=null;const Xe=Mr(t=>({msg:null,show:u=>{t({msg:u}),Cs&&clearTimeout(Cs),Cs=setTimeout(()=>t({msg:null}),2e3)},clear:()=>t({msg:null})}));async function li(t,u){const o=await Dt(t,u);if(!o.ok)throw new Error(`${t} -> HTTP ${o.status}`);return await o.json()}async function wr(t){return(await Promise.allSettled(t.map(async o=>{const i=await li(`/file?path=${encodeURIComponent(o.path)}`),s=i.ok&&i.content?qd(i.content,o.path):null;return{path:o.path,ok:!!i.ok,defLine:o.defLine,occs:o.occs??[],lineCount:i.ok&&i.content?i.content.split(`
|
|
73
|
+
`).length:0,html:s?s.html:`<p class="muted">读取失败:${i.error??""}</p>`,hash:i.hash,mtimeMs:i.mtimeMs,fileKey:Kd(i.content),commentable:!!s&&s.commentable&&!!i.hash,units:(s==null?void 0:s.units)??[],comments:(s==null?void 0:s.comments)??[]}}))).map((o,i)=>o.status==="fulfilled"?o.value:{path:t[i].path,ok:!1,defLine:t[i].defLine,occs:t[i].occs??[],lineCount:0,html:`<p class="muted">读取失败:${String(o.reason)}</p>`})}let Et=0;async function Eg(t){var u;try{if(t.kind==="file"){const f=await wr([{path:t.value,defLine:null,kind:"link"}]);return(u=f[0])!=null&&u.ok?{kind:"file",anchor:t.value,path:t.value,files:f}:null}const o=`def#${t.value}_ctag.`,i=await li("/resolve-open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clicked:o})}),s=i.files??[];if(!i.ok||!s.length)return null;const c=await wr(s);return{kind:"ctag",anchor:o,keyCore:i.keyCore??t.value,files:c}}catch{return null}}const Se=Mr((t,u)=>({columns:[],truncateAt:o=>t({columns:u().columns.slice(0,o)}),closeColumn:o=>t({columns:hg(u().columns,o)}),moveColumnToFirst:o=>{const i=pg(u().columns,o);i!==u().columns&&(vg(),t({columns:i}))},applyDoc:(o,i,s,c)=>{const f=qd(i,o),d={html:f.html,hash:s,mtimeMs:c,fileKey:Kd(i),missing:!1,commentable:f.commentable,units:f.units,comments:f.comments};t({columns:u().columns.map(h=>h.files.some(m=>m.path===o)?{...h,files:h.files.map(m=>m.path===o?{...m,...d}:m)}:h)})},reloadDoc:async(o,i)=>{try{const s=await li(`/file?path=${encodeURIComponent(o)}`);return!s.ok||s.content===void 0||!s.hash||i&&!i()?!1:(u().applyDoc(o,s.content,s.hash,s.mtimeMs),!0)}catch{return!1}},relocateDoc:async(o,i)=>(t({columns:u().columns.map(s=>{if(!s.files.some(f=>f.path===o))return s;const c=s.files.map(f=>f.path===o?{...f,path:i,missing:!1}:f);return s.kind==="file"&&s.path===o?{...s,path:i,anchor:s.anchor===o?i:s.anchor,files:c}:{...s,files:c}})}),u().reloadDoc(i)),markMissing:o=>{t({columns:u().columns.map(i=>i.files.some(s=>s.path===o&&!s.missing)?{...i,files:i.files.map(s=>s.path===o?{...s,missing:!0}:s)}:i)})},openAnchor:async(o,i)=>{var c,f;const s=++Et;try{const d=await li("/resolve-open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(s!==Et)return;if(!d.ok){d.note&&Xe.getState().show(d.note);return}const h=d.files??[];if(!h.length){d.note&&Xe.getState().show(d.note);return}const m=await wr(h);if(s!==Et)return;const k=o.clicked||((c=o.link)==null?void 0:c.href)||"",x=d.kind==="link"||!d.keyCore?{kind:"file",anchor:k,path:((f=h[0])==null?void 0:f.path)??"",files:m}:{kind:"ctag",anchor:k,keyCore:d.keyCore,files:m,fromClick:!0,openId:s},b=u().columns;t({columns:b.slice(0,i).concat([x])})}catch(d){s===Et&&Xe.getState().show(`打开失败:${String(d)}`)}},openFile:async(o,i)=>{var c;const s=++Et;try{const f=await wr([{path:o,defLine:null,kind:"link"}]);if(s!==Et)return;if(!((c=f[0])!=null&&c.ok)){Xe.getState().show(`打不开:${o}`);return}const d={kind:"file",anchor:o,path:o,files:f};t({columns:u().columns.slice(0,i).concat([d])})}catch(f){s===Et&&Xe.getState().show(`打开失败:${String(f)}`)}},openFileAt:async(o,i,s)=>{var f;const c=++Et;try{const d=await wr([{path:o,defLine:i,kind:"link"}]);if(c!==Et)return;if(!((f=d[0])!=null&&f.ok)){Xe.getState().show(`打不开:${o}`);return}const h={kind:"file",anchor:o,path:o,files:d,focusLine:i,openId:c};t({columns:u().columns.slice(0,s).concat([h])})}catch(d){c===Et&&Xe.getState().show(`打开失败:${String(d)}`)}},restore:async o=>{const i=++Et,s=await Promise.all(o.map(d=>Eg(d)));if(i!==Et)return;const c=s.findIndex(d=>!d),f=c===-1?s:s.slice(0,c);c!==-1&&Xe.getState().show(`有 ${s.length-c} 列打不开,已省略`),t({columns:f})}})),nc="deck:scroll",Uf=()=>({tree:{open:[],months:{}},cols:{},canvas:0});function rn(){var t,u;try{const o=sessionStorage.getItem(nc);if(!o)return Uf();const i=JSON.parse(o),s={};for(const[c,f]of Object.entries(((t=i.tree)==null?void 0:t.months)??{}))typeof f=="boolean"&&(s[c]=f);return{tree:{open:Array.isArray((u=i.tree)==null?void 0:u.open)?i.tree.open.filter(c=>typeof c=="string"):[],months:s},cols:i.cols??{},canvas:i.canvas??0}}catch{return Uf()}}let gt=null,wu=null;function vi(t){gt=t,!wu&&(wu=setTimeout(()=>{wu=null;const u=gt;if(gt=null,!!u)try{sessionStorage.setItem(nc,JSON.stringify(u))}catch{}},150))}function Sg(t){return(gt??rn()).cols[t]}function Dg(t,u){const o=gt??rn();vi({...o,cols:{...o.cols,[t]:u}})}function Ag(){return(gt??rn()).canvas}function Fg(t){const u=gt??rn();vi({...u,canvas:t})}function Ng(){return[...(gt??rn()).tree.open]}function qf(t){const u=gt??rn();vi({...u,tree:{...u.tree,open:[...new Set(t)]}})}function Tg(){return{...(gt??rn()).tree.months}}function jg(t){const u=gt??rn();vi({...u,tree:{...u.tree,months:{...t}}})}function Lg(t={}){const u=gt??rn();wu&&(clearTimeout(wu),wu=null),gt=null;try{sessionStorage.setItem(nc,JSON.stringify({...u,tree:{open:[],months:t}}))}catch{}}function Es(t){return[...new Set(t.filter(Boolean))]}function Mg(t){const u=new URL("/tree",window.location.origin);return t.forEach(o=>u.searchParams.append("path",o)),u.toString()}async function Rg(t){const u=await Dt(Mg(t));if(!u.ok)throw new Error(`读取目录失败:HTTP ${u.status}`);const o=await u.json();return t.length===1?[o]:o.results??[]}const _e=Mr((t,u)=>({openPaths:[],monthOpen:{},dataByPath:{},loadingPaths:{},hydrated:!1,activePath:"",setActivePath:o=>{u().activePath!==o&&t({activePath:o})},hydrate:()=>{u().hydrated||t({openPaths:Es(Ng()),monthOpen:Tg(),hydrated:!0})},isOpen:o=>u().openPaths.includes(o),setOpen:(o,i)=>{const s=u().openPaths,c=i?Es([...s,o]):s.filter(f=>f!==o);c.length===s.length&&c.every((f,d)=>f===s[d])||(t({openPaths:c}),qf(c))},setMonthOpen:(o,i)=>{if(u().monthOpen[o]===i)return;const s={...u().monthOpen,[o]:i};t({monthOpen:s}),jg(s)},closeAll:(o=[])=>{const s={...Object.fromEntries(Object.entries(u().monthOpen).filter(([c])=>c.startsWith("root:"))),...Object.fromEntries(o.map(c=>[c,!1]))};t({openPaths:[],monthOpen:s}),Lg(s)},load:async o=>{const i=Es(o).filter(s=>{var c;return!((c=u().dataByPath[s])!=null&&c.ok)&&!u().loadingPaths[s]});if(i.length){t(s=>({loadingPaths:{...s.loadingPaths,...Object.fromEntries(i.map(c=>[c,!0]))}}));try{const s=await Rg(i),c=Object.fromEntries(s.map(h=>[h.path??"",h])),f=i.filter(h=>!c[h]),d=s.filter(h=>h.missing).map(h=>h.path).filter(Boolean);t(h=>({openPaths:h.openPaths.filter(m=>!d.includes(m)),dataByPath:{...h.dataByPath,...c,...Object.fromEntries(f.map(m=>[m,{ok:!1,path:m,error:"没有返回这一层"}]))},loadingPaths:{...h.loadingPaths,...Object.fromEntries(i.map(m=>[m,!1]))}})),d.length&&qf(u().openPaths)}catch(s){t(c=>({dataByPath:{...c.dataByPath,...Object.fromEntries(i.map(f=>[f,{ok:!1,path:f,error:String(s instanceof Error?s.message:s)}]))},loadingPaths:{...c.loadingPaths,...Object.fromEntries(i.map(f=>[f,!1]))}}))}}}})),Pg=/^(\d{2})(0[1-9]|1[0-2])$/;function Hf(t){const u=Pg.exec(t);return u?`20${u[1]}-${u[2]}`:null}function Ss(t,u){return`${String(t%100).padStart(2,"0")}${String(u).padStart(2,"0")}`}function $g(t){const u=t.getFullYear(),o=t.getMonth()+1,i=new Set([Ss(u,o)]);return t.getDate()<=15&&i.add(o===1?Ss(u-1,12):Ss(u,o-1)),i}function zg(t,u){const o=$g(u),i=new Map,s=[];for(const d of t)if(d.month&&Hf(d.month)){const h=i.get(d.month)??[];h.push(d),i.set(d.month,h)}else s.push(d);const c=(d,h)=>d.name.localeCompare(h.name),f=[...i.keys()].sort((d,h)=>h.localeCompare(d)).map(d=>({key:d,label:Hf(d),items:i.get(d).sort(c),defaultOpen:o.has(d)}));return s.length&&f.push({key:"",label:"未归月份",items:s.sort(c),defaultOpen:!0}),f}function Du(t,u){return!!u&&t.startsWith(u+"/")}function Og(t,u){let o=null;for(const i of u)Du(t,i.path)&&(!o||i.path.length>o.path.length)&&(o=i);return o}function Ig(t,u){if(!Du(t,u))return[];const o=t.slice(u.length+1).split("/");o.pop();const i=[u];let s=u;for(const c of o)s=`${s}/${c}`,i.push(s);return i}function Bg(t,u){const o=new Set(t),i=new Set;return u.forEach((s,c)=>{o.has(s)||i.add(c)}),u.length&&u[0]!==t[0]&&i.add(0),[...i].sort((s,c)=>s-c)}function Qd({data:t,busy:u,depth:o}){if(u&&!t)return y.jsx("div",{className:"tree-hint",style:{paddingLeft:o*14+14},children:"载入中…"});if(!(t!=null&&t.ok))return y.jsx("div",{className:"tree-hint",style:{paddingLeft:o*14+14},children:"读不到这一层"});const i=t.dirs??[],s=t.files??[];return!i.length&&!s.length?y.jsx("div",{className:"tree-hint",style:{paddingLeft:o*14+14},children:"(空)"}):y.jsxs(y.Fragment,{children:[i.map(c=>y.jsx(Ug,{name:c.name,path:c.path,depth:o},c.path)),s.map(c=>y.jsx(qg,{name:c.name,path:c.path,depth:o},c.path))]})}function Ug({name:t,path:u,depth:o}){const i=_e(k=>k.isOpen(u)),s=_e(k=>k.dataByPath[u]??null),c=_e(k=>!!k.loadingPaths[u]),f=_e(k=>Du(k.activePath,u)),d=_e(k=>k.setOpen),h=_e(k=>k.load),m=()=>{const k=!i;d(u,k),k&&h([u])};return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:`tree-row${f?" has-active":""}`,style:{paddingLeft:o*14},onClick:m,title:u,children:[y.jsx("span",{className:"tree-caret",children:i?"▾":"▸"}),t]}),i&&y.jsx(Qd,{data:s,busy:c,depth:o+1})]})}function qg({name:t,path:u,depth:o}){const i=Se(f=>f.openFile),s=t==="_index.md",c=_e(f=>f.activePath===u);return y.jsxs("div",{className:`tree-row tree-file${s?" is-index":""}${c?" is-active":""}`,style:{paddingLeft:o*14+14},onClick:()=>void i(u,0),title:u,children:[t,s&&y.jsx("span",{className:"tree-tag",children:"总览"})]})}function Hg({v:t,current:u}){const o=_e(m=>m.isOpen(t.path)),i=_e(m=>m.dataByPath[t.path]??null),s=_e(m=>!!m.loadingPaths[t.path]),c=_e(m=>Du(m.activePath,t.path)),f=_e(m=>m.setOpen),d=_e(m=>m.load),h=()=>{const m=!o;f(t.path,m),m&&d([t.path])};return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:`tree-row tree-vault${u?" is-current":""}${c?" has-active":""}`,onClick:h,title:t.path,children:[y.jsx("span",{className:"tree-caret",children:o?"▾":"▸"}),y.jsx("b",{children:t.title??t.descr??t.name}),y.jsx("code",{children:t.keyCore})]}),o&&y.jsx(Qd,{data:i,busy:s,depth:1})]})}function Wg({monthKey:t,label:u,count:o,defaultOpen:i,hasActive:s,children:c}){const f=_e(h=>h.monthOpen[t]??i),d=_e(h=>h.setMonthOpen);return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:`tree-row tree-month${s?" has-active":""}`,onClick:()=>d(t,!f),children:[y.jsx("span",{className:"tree-caret",children:f?"▾":"▸"}),u," ",y.jsxs("span",{className:"muted",children:["(",o,")"]})]}),f&&y.jsx("div",{className:"tree-month-body",children:c})]})}const Go=(t,u)=>`${t}|${u.key}`,vr=t=>`root:${t}`;function Vg({rootPath:t,title:u,total:o,hasActive:i,children:s}){const c=vr(t),f=_e(h=>h.monthOpen[c]??!0),d=_e(h=>h.setMonthOpen);return y.jsxs("section",{className:"tree-root",children:[y.jsxs("div",{className:`tree-root-title tree-root-toggle${i?" has-active":""}`,title:t,onClick:()=>d(c,!f),children:[y.jsxs("span",{children:[y.jsx("span",{className:"tree-caret",children:f?"▾":"▸"}),u," ",y.jsxs("span",{className:"muted",children:["(",o,")"]})]}),y.jsx("span",{className:"tree-root-path secondary",children:t})]}),f&&s]})}function Kg({onSearch:t,currentVaultPath:u}){const[o,i]=M.useState(null),[s,c]=M.useState(!1),f=_e(F=>F.openPaths),d=_e(F=>F.hydrated),h=_e(F=>F.hydrate),m=_e(F=>F.setOpen),k=_e(F=>F.closeAll),x=_e(F=>F.load),b=_e(F=>F.activePath),_=Se(F=>F.columns),v=M.useMemo(()=>new Date,[]);M.useEffect(()=>{h()},[h]),M.useEffect(()=>{u&&m(u,!0)},[u,m]),M.useEffect(()=>{d&&f.length&&x(f)},[d,x,f]),M.useEffect(()=>{const F=new AbortController;return Dt("/overview",{signal:F.signal}).then(z=>z.json()).then(z=>z.ok?i(z):c(!0)).catch(z=>{(z==null?void 0:z.name)!=="AbortError"&&c(!0)}),()=>F.abort()},[]);const D=F=>zg(((o==null?void 0:o.vaults)??[]).filter(z=>z.root===F),v);M.useEffect(()=>{if(!o||!u)return;const F=o.vaults.find(I=>I.path===u);if(!F)return;const z=D(F.root).find(I=>I.items.some(G=>G.path===F.path));if(!z)return;const{monthOpen:L,setMonthOpen:E}=_e.getState();L[vr(F.root)]===!1&&E(vr(F.root),!0);const P=Go(F.root,z);(L[P]??z.defaultOpen)||E(P,!0)},[o,u]);const T=M.useRef([]),O=M.useRef([]);M.useEffect(()=>{const F=_.map(di),z=Bg(T.current,F);T.current=F;for(const I of z)for(const G of _[I].files)O.current.push(G.path);if(!o||!O.current.length)return;const L=[...new Set(O.current)];O.current=[];const{monthOpen:E,setMonthOpen:P}=_e.getState();for(const I of L){const G=Og(I,o.vaults);if(!G)continue;E[vr(G.root)]===!1&&P(vr(G.root),!0);const oe=D(G.root).find(ae=>ae.items.some(ye=>ye.path===G.path));if(oe){const ae=Go(G.root,oe);(E[ae]??oe.defaultOpen)||P(ae,!0)}Ig(I,G.path).forEach(ae=>m(ae,!0))}},[_,o]);const $=()=>k(((o==null?void 0:o.roots)??[]).flatMap(F=>D(F.path).map(z=>Go(F.path,z))));return y.jsxs("div",{className:"col nav",children:[y.jsxs("div",{className:"nav-head",children:[y.jsx("h3",{className:"nav-title",children:"话题"}),y.jsxs("div",{className:"nav-actions",children:[y.jsx("button",{className:"nav-action-btn",onClick:$,title:"收起所有月份、话题和文件夹",children:"全收起"}),y.jsxs("button",{className:"nav-action-btn",onClick:t,title:"搜信息点(⌘K)",children:["搜信息点",y.jsx("span",{className:"kbd-hint",children:"⌘K"})]})]})]}),o&&y.jsxs("div",{className:"nav-counts muted",title:"话题集合 / 话题 / 信息点 / 文件",children:["roots ",o.counts.roots," · vaults ",o.counts.vaults," · 信息点 ",o.counts.points," · 文件 ",o.counts.files]}),s&&y.jsx("p",{className:"muted",children:"加载失败"}),!o&&!s&&y.jsx("p",{className:"muted",children:"加载中…"}),o==null?void 0:o.roots.map(F=>{const z=D(F.path),L=z.reduce((E,P)=>E+P.items.length,0);return y.jsx(Vg,{rootPath:F.path,title:F.name??F.path,total:L,hasActive:z.some(E=>E.items.some(P=>Du(b,P.path))),children:z.map(E=>y.jsx(Wg,{monthKey:Go(F.path,E),label:E.label,count:E.items.length,defaultOpen:E.defaultOpen,hasActive:E.items.some(P=>Du(b,P.path)),children:E.items.map(P=>y.jsx(Hg,{v:P,current:P.path===u},P.path))},E.key))},F.path)})]})}function si(t,u){const o=u-(t.scrollHeight-t.clientHeight);if(o>0){const i=parseFloat(getComputedStyle(t).paddingBottom)||0;t.style.paddingBottom=`${Math.ceil(i+o)}px`}t.scrollTop=u}const Qg="modulepreload",Zg=function(t){return"/app/"+t},Wf={},Gg=function(u,o,i){let s=Promise.resolve();if(o&&o.length>0){let f=function(m){return Promise.all(m.map(k=>Promise.resolve(k).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),h=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));s=f(o.map(m=>{if(m=Zg(m),m in Wf)return;Wf[m]=!0;const k=m.endsWith(".css"),x=k?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${x}`))return;const b=document.createElement("link");if(b.rel=k?"stylesheet":Qg,k||(b.as="script"),b.crossOrigin="",b.href=m,h&&b.setAttribute("nonce",h),document.head.appendChild(b),k)return new Promise((_,v)=>{b.addEventListener("load",_),b.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(f){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=f,window.dispatchEvent(d),!d.defaultPrevented)throw f}return s.then(f=>{for(const d of f||[])d.status==="rejected"&&c(d.reason);return u().catch(c)})};let Ds=null;function Yg(){return Ds||(Ds=Gg(()=>import("./mermaid.core-BZ6wQkn-.js").then(t=>t.bA),[]).then(t=>{const u=t.default;return u.initialize({startOnLoad:!1,securityLevel:"strict"}),u})),Ds}function Vf(t,u){const o=document.createElement("pre");o.className="mermaid-fallback",o.textContent=u,t.replaceWith(o)}async function Xg(t){const u=Array.from(t.querySelectorAll(".mermaid:not([data-processed])"));if(!u.length)return;const o=new Map(u.map(s=>[s,s.textContent??""]));let i;try{i=await Yg()}catch{u.forEach(s=>Vf(s,o.get(s)??""));return}for(const s of u)if(s.isConnected)try{await i.run({nodes:[s],suppressErrors:!1})}catch{Vf(s,o.get(s)??"")}}function Jg(t){const u=t.getBoundingClientRect(),o=t.viewBox.baseVal,i=t.cloneNode(!0);i.setAttribute("width",String(o.width||u.width)),i.setAttribute("height",String(o.height||u.height)),i.style.removeProperty("max-width"),i.setAttribute("xmlns","http://www.w3.org/2000/svg");const s=new XMLSerializer().serializeToString(i);return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`}const Zd=2,e6=8;function t6(t,u,o=Zd,i=e6){const s=t.wrapLeft+o+t.btnsWidth+i-u;return s>0?Math.ceil(s):0}function n6(t,u){return t.map(o=>t6(o,u))}function u6(t){const u=t.closest(".col");if(!u)return;const o=u.getBoundingClientRect().left+u.clientWidth,i=[];t.querySelectorAll(".cm-btnwrap").forEach(c=>{var d;if(c.closest(".cb")||(d=c.closest(".cm-unit"))!=null&&d.classList.contains("cm-block"))return;const f=c.firstElementChild;f&&i.push({btns:f,box:{wrapLeft:c.getBoundingClientRect().left,btnsWidth:f.getBoundingClientRect().width}})});const s=n6(i.map(c=>c.box),o);i.forEach((c,f)=>r6(c.btns,s[f]))}function r6(t,u){t.style.left=u?`${Zd-u}px`:"",t.classList.toggle("cm-shifted",u>0)}function o6(t){let u=0;return{request(){u||(u=requestAnimationFrame(()=>{u=0,u6(t)}))},cancel(){u&&cancelAnimationFrame(u),u=0}}}const i6=new RegExp(`^(.*)\\.(\\d{6}_${tc}_ctag)$`);function uc(t){const u=t.split("/").slice(0,-1);for(let o=u.length-1;o>=0;o--){const i=i6.exec(u[o]);if(i)return{descr:i[1],key:i[2],ctag:`ref#${u[o]}.`}}return null}function Gd(t){return t.replace(/^(?:def|ref)#/,"def#")}const l6=40,s6=3,c6=6e4,a6="defCount,defFile,refsCount";function f6(t){const u=t.matched?t.defs??[]:[],o=t.matched?t.defCount??u.length:0;return{matched:!!t.matched,hasDef:o>0,defCount:o,refsCount:t.matched?t.refsCount??0:0,...u[0]?{def:{file:u[0].file,line:u[0].line}}:{}}}function d6(t,u=l6){const o=[];for(let i=0;i<t.length;i+=u)o.push(t.slice(i,i+u));return o}function p6(t,u,o){if(!t)return{miss:!1,metaText:""};if(u==="ref"&&!t.hasDef)return{miss:!0,metaText:"查无 def"};if(t.def&&o){const i=uc(t.def.file);if(i&&i.key!==o)return{miss:!1,metaText:`↗ ${i.descr||i.key}`}}return{miss:!1,metaText:""}}const rc=new Map,kr=new Map;let ci=0;const Os=new Set;function h6(){return ci}function Yd(t){return Os.add(t),()=>{Os.delete(t)}}const m6={fetch:t=>Dt(t),now:()=>Date.now()};function ki(t,u=Date.now()){const o=rc.get(t);return o&&u-o.at<c6?o.meta:void 0}function g6(){ci++,rc.clear(),kr.clear();for(const t of[...Os])t()}let As=0;const Kf=[];async function y6(t){As>=s6?await new Promise(u=>Kf.push(u)):As++;try{return await t()}finally{const u=Kf.shift();u?u():As--}}async function x6(t,u){const o=ci;try{const i=t.map(d=>`ctag=${encodeURIComponent(d)}`).join("&"),s=await y6(()=>u.fetch(`/locate-ctag?${i}&fields=${a6}`));if(!s.ok)return;const c=await s.json();if(!c.ok||ci!==o)return;const f=u.now();for(const d of c.hits??[])rc.set(d.query,{at:f,meta:f6(d)})}catch{}}async function v6(t,u=m6){const o=u.now(),i=[],s=[];for(const c of new Set(t)){if(ki(c,o))continue;const f=kr.get(c);f?i.push(f):s.push(c)}for(const c of d6(s)){const f=x6(c,u).finally(()=>{for(const d of c)kr.get(d)===f&&kr.delete(d)});for(const d of c)kr.set(d,f);i.push(f)}await Promise.all(i)}const Xd=".ctag-link[data-key]";function k6(t){const u=new Set;for(const o of Array.from(t.querySelectorAll(Xd))){const i=o.getAttribute("data-key");i&&u.add(i)}return[...u]}function Qf(t,u,o){const i=t.getAttribute(u);return o===""?i===null?!1:(t.removeAttribute(u),!0):i===o?!1:(t.setAttribute(u,o),!0)}function Jd(t,u,o=ki){let i=!1;for(const s of Array.from(t.querySelectorAll(Xd))){const c=s.getAttribute("data-key"),f=c?o(c):void 0;if(!f)continue;const d=p6(f,s.getAttribute("data-kind")??"",u);i=Qf(s,"data-miss",d.miss?"1":"")||i,i=Qf(s,"data-meta",d.metaText)||i}return i}async function b6(t,u,o,i){const s=k6(t);return!s.length||s.every(c=>ki(c))||(await v6(s,i),!o()||t.isConnected===!1)?!1:Jd(t,u)}function _6(t,u){if(!t||u<1)return;const o=u-1;let i;for(const s of t)s.startLine>o||s.endLine<o||(!i||s.endLine-s.startLine<i.endLine-i.startLine)&&(i=s);return i}function w6(t,u,o,i){if(u<1||u>t.length)return null;const s=Math.max(1,u-o),c=Math.min(t.length,u+i),f=[];for(let d=s;d<=c;d++)f.push({n:d,t:t[d-1],hit:d===u});return{from:s,to:c,total:t.length,lines:f}}function C6(t,u,o,i,s){var c;return!o||!((c=t[u-1])!=null&&c.includes(o))?null:w6(t,u,i,s)}const Fs=56;function Zf(t,u){let o=0,i=t;for(;i&&i!==u;)o+=i.offsetTop,i=i.offsetParent;return o}const E6=y.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round",children:y.jsx("path",{d:"M1.5 4.2c0-.7.5-1.2 1.2-1.2h3l1.4 1.6h6.2c.7 0 1.2.5 1.2 1.2v6.2c0 .7-.5 1.2-1.2 1.2H2.7c-.7 0-1.2-.5-1.2-1.2z"})});function S6({card:t,keyCore:u,primary:o,onSettled:i}){const s=M.useRef(null),c=uc(t.path),f=c==null?void 0:c.key,d=M.useRef(null),h=M.useSyncExternalStore(Yd,h6),m=M.useRef(t.units);m.current=t.units;const k=M.useCallback(()=>{if(!o)return;const v=s.current;if(!v)return;const D=v.closest(".col");if(!D)return;const T=()=>{const F=v.querySelector(".md"),z=Math.max(0,Math.min(1,((t.defLine??1)-1)/(t.lineCount||1)));D.scrollTop=Math.max(0,v.offsetTop+(F?F.offsetTop-v.offsetTop:0)+z*(F?F.offsetHeight:0)-Fs)};if(!u){if(!t.defLine)return;const F=_6(m.current,t.defLine),z=F?v.querySelector(`[data-cm="${F.i}"]`):null;z?si(D,Math.max(0,Zf(z,D)-Fs)):T();return}const $=Array.prototype.filter.call(v.querySelectorAll(".ctag-link"),F=>decodeURIComponent(F.getAttribute("data-ctag")||"").includes(`.${u}_ctag`)).find(F=>decodeURIComponent(F.getAttribute("data-ctag")||"").startsWith("def#"))||null;if($){si(D,Math.max(0,Zf($,D)-Fs));return}t.defLine&&T()},[t.defLine,t.lineCount,u,o]);M.useEffect(()=>{k()},[k]);const x=M.useRef(!1);M.useEffect(()=>{const v=s.current;if(!v)return;const D=T=>{var $;const O=T.target;($=O==null?void 0:O.matches)!=null&&$.call(O,"details.fm")&&(x.current=O.open)};return v.addEventListener("toggle",D,!0),()=>v.removeEventListener("toggle",D,!0)},[]),M.useLayoutEffect(()=>{var D;if(!x.current)return;const v=(D=s.current)==null?void 0:D.querySelector("details.fm");v&&!v.open&&(v.open=!0)},[t.html]);const b=M.useRef(!1);M.useEffect(()=>{var $,F;const v=($=s.current)==null?void 0:$.querySelector(".md");if(!v)return;const D=o6(v);d.current=D,D.request();const T=new ResizeObserver(()=>D.request());T.observe(v);let O=!0;return(F=document.fonts)==null||F.ready.then(()=>{O&&D.request()}),()=>{O=!1,d.current=null,T.disconnect(),D.cancel()}},[t.html]),M.useLayoutEffect(()=>{var D;const v=(D=s.current)==null?void 0:D.querySelector(".md");v&&Jd(v,f)},[t.html,f]),M.useEffect(()=>{var T;const v=(T=s.current)==null?void 0:T.querySelector(".md");if(!v)return;let D=!0;return b6(v,f,()=>D).then(O=>{var $;D&&O&&(($=d.current)==null||$.request())}),()=>{D=!1}},[t.html,f,h]),M.useEffect(()=>{const v=s.current;v&&Xg(v).then(()=>{b.current||(b.current=!0,k(),i==null||i())})},[t.html,k,i]);const _=t.defLine?{"data-defline":t.defLine,"data-linecount":t.lineCount,"data-defkey":u}:{};return y.jsxs("div",{className:"card",ref:s,"data-path":t.path,..._,children:[y.jsxs("div",{className:"card-path",children:[c&&y.jsxs("button",{type:"button",className:"card-topic","data-topic-ctag":c.ctag,title:`打开所在话题:${c.ctag}`,children:[E6,y.jsx("span",{children:c.descr||c.key})]}),y.jsx("span",{className:"card-path-text",children:t.path})]}),t.missing&&y.jsx("div",{className:"card-missing",role:"alert",children:"这个文件已不存在(可能被删除,或移动后无法追踪新位置),下面是之前读到的内容;刷新页面可重新打开"}),y.jsx("div",{className:"md",dangerouslySetInnerHTML:{__html:t.html}})]})}function D6({col:t,index:u}){const o=M.useRef(null),i=di(t),[s]=M.useState(()=>t.kind==="ctag"&&t.fromClick||t.kind==="file"&&t.focusLine!==void 0?void 0:Sg(i)),c=s!==void 0;M.useEffect(()=>{const x=o.current,b=x==null?void 0:x.closest("#canvas");if(!x||!b)return;const _=b.getBoundingClientRect().left,v=z=>z-_+b.scrollLeft,D=v(x.getBoundingClientRect().left),T=b.querySelectorAll(".col"),O=T[T.length-1],$=O?v(O.getBoundingClientRect().right):b.scrollWidth,F=Math.max(0,$-b.clientWidth);b.scrollTo({left:Math.min(D,F),behavior:"smooth"})},[i]),M.useEffect(()=>{const x=o.current;x&&c&&si(x,s)},[i]);const f=M.useCallback(()=>{const x=o.current;x&&c&&si(x,s)},[c,s]),d=M.useRef(0);M.useLayoutEffect(()=>{const x=o.current;x&&d.current&&x.scrollTop!==d.current&&(x.scrollTop=d.current)},[u]);const h=Se(x=>x.closeColumn),m=Se(x=>x.moveColumnToFirst),k=()=>{m(u),requestAnimationFrame(()=>{var x;(x=document.getElementById("canvas"))==null||x.scrollTo({left:0,behavior:"smooth"})})};return y.jsxs("div",{className:"col",ref:o,onScroll:x=>{const b=x.target.scrollTop;d.current=b,Dg(i,b)},children:[y.jsxs("span",{className:"col-ops",children:[u>0&&y.jsx("button",{type:"button",className:"col-op",title:"向左:移到第一列,其余列顺序不变","aria-label":"向左,移到第一列",onClick:k,children:"←"}),y.jsx("button",{type:"button",className:"col-op",title:"关闭这一列","aria-label":"关闭这一列",onClick:()=>h(u),children:"×"})]}),y.jsxs("div",{className:"col-head",children:["列 ",u+2," · ",t.anchor]}),(()=>{const x=t.kind==="ctag"&&!c?t.files.findIndex(b=>b.defLine):t.kind==="file"&&t.focusLine!==void 0?0:-1;return t.files.map((b,_)=>y.jsx(S6,{card:b,keyCore:t.kind==="ctag"?t.keyCore:"",primary:_===x,onSettled:f},b.path+_))})()]})}function ep(){const t=Xe(u=>u.msg);return y.jsx("div",{className:`toast${t?" show":""}`,children:t})}async function Nu(t){try{return await navigator.clipboard.writeText(t),!0}catch{try{const u=document.createElement("textarea");u.value=t,u.style.cssText="position:fixed;opacity:0;top:0;left:0",document.body.appendChild(u),u.select();const o=document.execCommand("copy");return u.remove(),o}catch{return!1}}}const tp="vault.panel.header",Gf=400,np=320,Is=520,Yf=60,bu=28,oc=16,up=8,A6=8,rp=32,Ns="(max-width: 719px)",F6="(pointer: coarse)",N6=5e3,T6=3e4,Tr=(t,u,o)=>Math.min(Math.max(t,u),Math.max(u,o)),ei=t=>typeof t=="number"&&Number.isFinite(t),Vn=t=>String(t).padStart(2,"0");function ic(t){return Tr(Math.round(t),np,Is)}function bi(t,u){return Math.max(bu,Math.min(ic(t),u-rp))}function Bs(t,u,o,i){return{x:Tr(t,0,i.width-oc-o.w),y:Tr(u,up,i.height-A6-o.h)}}function ai(t,u){const o=bi(t.w,u.width);if(!t.collapsed)return{...Bs(t.x,t.y,{w:o,h:Yf},u),w:o,h:Yf};const i=lc(o),s=Bs(t.x+i.dx,t.y+i.dy-ti,{w:bu+op,h:bu+ti},u);return{x:s.x,y:s.y+ti,w:bu,h:bu}}function j6(t,u=!1){const o=bi(Gf,t.width);return{x:t.width-o-oc,y:up,w:Gf,collapsed:u}}const op=4,ti=2;function lc(t){return{dx:t-bu-op,dy:ti}}function L6(t,u,o){if(t.collapsed===u)return t;if(u){const c=ai({...t,collapsed:!1},o);return{...t,x:c.x,y:c.y,collapsed:!0}}const i=ai(t,o),s=lc(bi(t.w,o.width));return{...t,x:i.x-s.dx,y:i.y-s.dy,collapsed:!1}}function M6(t,u,o,i){const s=lc(bi(o,i.width));return{x:t-s.dx,y:u-s.dy}}function ip(t){if(!t)return null;try{const u=t.getItem(tp);if(!u)return null;const o=JSON.parse(u);if(!o||typeof o!="object"||Array.isArray(o))return null;const i=o;return{...ei(i.x)&&ei(i.y)?{x:i.x,y:i.y}:{},...ei(i.w)?{w:ic(i.w)}:{},...typeof i.collapsed=="boolean"?{collapsed:i.collapsed}:{}}}catch{return null}}function R6(t,u,o){const i=ip(t),s=o?!0:(i==null?void 0:i.collapsed)??!1,c=j6(u,s);return{x:(i==null?void 0:i.x)??c.x,y:(i==null?void 0:i.y)??c.y,w:(i==null?void 0:i.w)??c.w,collapsed:s}}function Xf(t,u,o){var i;if(t)try{const s=o?((i=ip(t))==null?void 0:i.collapsed)??!1:u.collapsed;t.setItem(tp,JSON.stringify({x:Math.round(u.x),y:Math.round(u.y),w:ic(u.w),collapsed:s}))}catch{}}function P6(t,u,o,i){const s=i.width-rp,c=Math.min(np,s);if(u==="r"){const d=Tr(Math.round(t.w+o),c,Math.min(Is,s,i.width-oc-t.x));return{x:t.x,w:d}}const f=Tr(Math.round(t.w-o),c,Math.min(Is,s,t.x+t.w));return{x:t.x+t.w-f,w:f}}function $6(t,u){return t===null||u<t||u-t>=N6}function z6(t,u){const o=t?Date.parse(t):Number.NaN;if(!Number.isFinite(o))return"未更新";const i=Math.floor((u-o)/6e4);if(i<1)return"刚刚更新";if(i<60)return`${i} 分钟前更新`;if(i<1440)return`${Math.floor(i/60)} 小时前更新`;if(i<1440*30)return`${Math.floor(i/1440)} 天前更新`;const s=new Date(o);return`${Vn(s.getMonth()+1)}-${Vn(s.getDate())} 更新`}function O6(t){const u=t?Date.parse(t):Number.NaN;if(!Number.isFinite(u))return"—";const o=new Date(u);return`${o.getFullYear()}-${Vn(o.getMonth()+1)}-${Vn(o.getDate())} ${Vn(o.getHours())}:${Vn(o.getMinutes())}:${Vn(o.getSeconds())}`}function I6(t){if(!t||typeof t!="object"||Array.isArray(t))return{ok:!1,reason:"service"};const u=t,o={ok:!1};typeof u.branch=="string"&&u.branch&&(o.branch=u.branch),typeof u.fetchedAt=="string"&&u.fetchedAt&&(o.fetchedAt=u.fetchedAt);const i=s=>ei(s)&&s>=0?Math.floor(s):null;if(u.ok===!0){const s=i(u.ahead),c=i(u.behind);return s===null||c===null?{...o,reason:"service"}:{...o,ok:!0,ahead:s,behind:c}}return{...o,reason:typeof u.reason=="string"&&u.reason?u.reason:"service"}}const B6={"not-a-repo":"工作区目录不是 git 仓","no-remote":"没有配置 origin,或本地没有 origin/master",offline:"fetch 失败(断网、认证失败或远端拒绝)",timeout:"git 命令超过 3 秒没有返回",service:"连不上本地服务,或返回内容不对"};function lp(t){return t&&B6[t]||"原因不明"}function U6(t){if(!t)return{tone:"muted",local:"…",ball:"—",hint:"正在取数"};if(!t.ok)return{tone:"muted",local:"—",ball:"—",hint:`取不到:${lp(t.reason)}`};const u=t.ahead??0,o=t.behind??0,i=`↑${u} ↓${o}`;if(o>0)return{tone:"warn",local:i,ball:"↓",hint:`落后 origin/master ${o} 个提交`};const s=u>0?`,领先 ${u} 个提交`:"";return{tone:"ok",local:i,ball:"✓",hint:`没有落后 origin/master${s}`}}function q6(t,u){if(u(t))return t;for(let o=t.length-1;o>2;o--){const i=Math.ceil(o/2),s=o-i,c=`${t.slice(0,i)}…${s?t.slice(-s):""}`;if(u(c))return c}return`${t.slice(0,3)}…`}const Jf=["commit 工作区 all & 与远端 master 双向同步","","参考 ref#file_remote分支合并流程.261013_6rw3n_ctag."].join(`
|
|
74
74
|
`),H6="/local-branch/git-status",W6=1e4,V6=3,K6=40,Ts=()=>{try{return window.localStorage}catch{return null}},Us=()=>({width:window.innerWidth,height:window.innerHeight}),ni=t=>typeof window.matchMedia=="function"&&window.matchMedia(t).matches;function Q6(){const[t,u]=M.useState(Us);return M.useEffect(()=>{const o=()=>u(Us());return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),t}function Z6(t){const[u,o]=M.useState(()=>ni(t));return M.useEffect(()=>{if(typeof window.matchMedia!="function")return;const i=window.matchMedia(t),s=()=>o(i.matches);return s(),i.addEventListener("change",s),()=>i.removeEventListener("change",s)},[t]),u}const Qn=({children:t,className:u})=>y.jsx("svg",{className:u,viewBox:"0 0 16 16","aria-hidden":"true",children:t}),G6=()=>y.jsx(Qn,{children:y.jsx("path",{d:"M2.5 7.2 8 2.8l5.5 4.4V13H2.5z"})}),Y6=()=>y.jsxs(Qn,{children:[y.jsx("rect",{x:"2.5",y:"3",width:"11",height:"10",rx:"1.6"}),y.jsx("path",{d:"M2.5 6h11"})]}),X6=()=>y.jsx(Qn,{className:"ph-caret",children:y.jsx("path",{d:"m4 6 4 4 4-4"})}),J6=()=>y.jsx(Qn,{children:y.jsx("path",{d:"M3 5h10M6 5V3.5h4V5M4.5 5v7.5h7V5"})}),ey=()=>y.jsx(Qn,{children:y.jsx("path",{d:"M4 8h8"})}),ty=()=>y.jsxs(Qn,{children:[y.jsx("rect",{x:"5.5",y:"5.5",width:"7",height:"7",rx:"1.2",strokeWidth:"1.4"}),y.jsx("path",{d:"M10.5 5.5V4.2A1.2 1.2 0 0 0 9.3 3H4.2A1.2 1.2 0 0 0 3 4.2v5.1a1.2 1.2 0 0 0 1.2 1.2h1.3",strokeWidth:"1.4"})]}),ny=()=>y.jsxs(Qn,{children:[y.jsx("path",{d:"M13 8a5 5 0 1 1-1.6-3.7"}),y.jsx("path",{d:"M13.2 2.6v3.1H10"})]});function sp(){const t=Q6(),u=Z6(F6),[o,i]=M.useState(()=>R6(Ts(),Us(),ni(Ns))),s=M.useRef(o);s.current=o;const c=M.useRef(t);c.current=t;const[f,d]=M.useState(!1),[h,m]=M.useState(!1),[k,x]=M.useState(!1),b=M.useRef(!1),[_,v]=M.useState(null),[D,T]=M.useState(!1),[O,$]=M.useState(()=>Date.now()),F=M.useRef(null),z=M.useRef(null),L=M.useCallback(async V=>{const ie=z.current;if(ie&&(!V||ie.force))return;ie==null||ie.ctrl.abort();const xe={ctrl:new AbortController,force:V};z.current=xe,T(!0);const Be=setTimeout(()=>xe.ctrl.abort(),W6);let ze;try{const Le=await Dt(H6,{signal:xe.ctrl.signal,headers:V?{"Cache-Control":"no-cache"}:void 0});ze=I6(await Le.json().catch(()=>null))}catch{ze={ok:!1,reason:"service"}}finally{clearTimeout(Be)}if(z.current!==xe)return;z.current=null;const Oe=Date.now();ze.ok&&(F.current=Oe),v(Le=>({...ze,branch:ze.branch??(Le==null?void 0:Le.branch),fetchedAt:ze.fetchedAt??(Le==null?void 0:Le.fetchedAt)})),$(Oe),T(!1)},[]);M.useEffect(()=>{L(!1);const V=()=>{$6(F.current,Date.now())&&L(!1)},ie=()=>{document.visibilityState==="visible"&&V()};window.addEventListener("focus",V),document.addEventListener("visibilitychange",ie);const xe=setInterval(()=>$(Date.now()),T6);return()=>{var Be;window.removeEventListener("focus",V),document.removeEventListener("visibilitychange",ie),clearInterval(xe),(Be=z.current)==null||Be.ctrl.abort(),z.current=null}},[L]);const E=U6(_),P=D?"刷新中…":z6(_==null?void 0:_.fetchedAt,O),I=(_==null?void 0:_.branch)??"",G=ai(o,t),oe=!u,ae=(V,ie)=>{if(u||V.button!==0||ie==="move"&&V.target.closest(".ph-menu, .ph-resize"))return;b.current=!1;const xe=V.clientX,Be=V.clientY,ze=ai(s.current,c.current);let Oe=s.current,Le=!1;const Tu=Nn=>{if(Nn.buttons===0){on();return}const Zn=Nn.clientX-xe,Gn=Nn.clientY-Be;if(!(!Le&&Math.hypot(Zn,Gn)<V6)){if(Le||(Le=!0,x(!0),d(!1),m(!1)),ie==="move"){const xt=Bs(ze.x+Zn,ze.y+Gn,ze,c.current),Vt=Oe.collapsed?M6(xt.x,xt.y,Oe.w,c.current):xt;Oe={...Oe,x:Vt.x,y:Vt.y}}else{const xt=P6({x:ze.x,w:ze.w},ie,Zn,c.current);Oe={...Oe,x:xt.x,w:xt.w}}i(Oe)}},on=()=>{window.removeEventListener("pointermove",Tu),window.removeEventListener("pointerup",on),window.removeEventListener("pointercancel",on),Le&&(x(!1),Xf(Ts(),Oe,ni(Ns)),b.current=!0,setTimeout(()=>{b.current=!1},100))};window.addEventListener("pointermove",Tu),window.addEventListener("pointerup",on),window.addEventListener("pointercancel",on)},ye=V=>b.current?(V.preventDefault(),V.stopPropagation(),b.current=!1,!0):!1,ke=V=>{const ie=L6(s.current,V,c.current);i(ie),d(!1),m(!1),Xf(Ts(),ie,ni(Ns))},Ne=M.useRef(null),we=M.useRef(null),te=M.useRef(null),fe=M.useRef(null),[K,ne]=M.useState(""),Q=M.useCallback(()=>{const V=Ne.current,ie=we.current,xe=te.current,Be=fe.current;if(!V||!ie||!xe||!Be||!I){ne(I);return}const ze=V.clientWidth-ie.offsetWidth-xe.offsetWidth-K6;ne(q6(I,Le=>(Be.textContent=Le,Be.getBoundingClientRect().width<=ze)))},[I]);M.useLayoutEffect(()=>{Q()},[Q,E.local,o.collapsed]),M.useLayoutEffect(()=>{const V=Ne.current;if(!V||typeof ResizeObserver>"u")return;const ie=new ResizeObserver(()=>Q());return ie.observe(V),()=>ie.disconnect()},[Q,o.collapsed]);const A=M.useRef(null),B=M.useRef(null),se=M.useRef(null);M.useEffect(()=>{if(!f&&!h)return;const V=xe=>{var ze,Oe,Le;const Be=xe.target;(ze=A.current)!=null&&ze.contains(Be)||d(!1),!((Oe=B.current)!=null&&Oe.contains(Be))&&!((Le=se.current)!=null&&Le.contains(Be))&&m(!1)},ie=xe=>{xe.key!=="Escape"||xe.isComposing||(d(!1),m(!1))};return document.addEventListener("click",V),document.addEventListener("keydown",ie),()=>{document.removeEventListener("click",V),document.removeEventListener("keydown",ie)}},[f,h]);const ce=()=>{window.location.hash=Vd},pe=()=>{window.open(`${window.location.pathname}${window.location.search}#/temp`,"_blank","noopener"),d(!1)},he=async()=>{const V=await Nu(Jf),ie=Jf.split(`
|
|
75
75
|
`)[0];Xe.getState().show(V?`已复制:${ie}(含同步 guide 的 ref#)`:"复制失败,请检查浏览器的剪贴板权限")};if(o.collapsed)return y.jsx("button",{type:"button",className:`ph-ball${oe?" ph-draggable":""}${k?" is-dragging":""}`,"data-tone":E.tone,style:{left:G.x,top:G.y},title:`展开浮层 · ${E.hint}`,"aria-label":"展开浮层",onPointerDown:V=>ae(V,"move"),onClick:V=>{ye(V)||ke(!1)},children:E.ball});const be=["ph-panel",oe?"ph-draggable":"",k?"is-dragging":""].filter(Boolean).join(" ");return y.jsxs("div",{className:be,style:{left:G.x,top:G.y,width:G.w},role:"region","aria-label":"工作区浮层",onClickCapture:V=>{ye(V)},children:[oe&&y.jsx("div",{className:"ph-resize ph-resize-l","aria-hidden":"true",onPointerDown:V=>ae(V,"l")}),oe&&y.jsx("div",{className:"ph-resize ph-resize-r","aria-hidden":"true",onPointerDown:V=>ae(V,"r")}),y.jsxs("div",{className:"ph-nav-row",onPointerDown:V=>ae(V,"move"),children:[y.jsxs("button",{type:"button",className:"ph-nav-btn",title:"回到浏览页首屏(关掉所有列)",onClick:ce,children:[y.jsx(G6,{}),"首页"]}),y.jsxs("div",{className:"ph-menu-wrap",ref:A,children:[y.jsxs("button",{type:"button",className:"ph-nav-btn","aria-expanded":f,"aria-haspopup":"menu",title:"预设页面",onClick:()=>d(V=>!V),children:[y.jsx(Y6,{}),"预设页面",y.jsx(X6,{})]}),f&&y.jsxs("div",{className:"ph-menu",role:"menu",children:[y.jsx("div",{className:"ph-menu-title",children:"预设页面"}),y.jsxs("button",{type:"button",className:"ph-menu-item",role:"menuitem",title:"在新标签页打开 Temp 整理页",onClick:pe,children:[y.jsx(J6,{}),"整理临时文件夹"]})]})]}),y.jsx("span",{className:"ph-grow"}),y.jsx("button",{type:"button",className:"ph-nav-btn ph-icon-btn",title:"收起成圆钮","aria-label":"收起成圆钮",onClick:()=>ke(!0),children:y.jsx(ey,{})})]}),y.jsxs("div",{className:"ph-status-row",onPointerDown:V=>ae(V,"move"),children:[y.jsxs("div",{className:"ph-status-wrap",ref:B,children:[y.jsxs("button",{type:"button",ref:Ne,className:"ph-status","aria-expanded":h,title:`${I||"主工作区"}:${E.hint}`,onClick:()=>m(V=>!V),children:[y.jsx("span",{className:"ph-repo",ref:we,children:"主工作区"}),y.jsx("span",{className:"ph-branch",children:K}),y.jsxs("span",{className:"ph-cmp",ref:te,"data-tone":E.tone,children:[y.jsxs("span",{className:"ph-side",children:["(本地) ",y.jsx("b",{children:E.local})]}),y.jsx("span",{className:"ph-arrow",children:"↔"}),y.jsx("span",{className:"ph-side",children:"(远端) master"})]})]}),y.jsx("span",{className:"ph-tools",children:y.jsx("button",{type:"button",title:"复制提示词","aria-label":"复制提示词",onClick:()=>void he(),children:y.jsx(ty,{})})}),y.jsx("span",{className:"ph-branch ph-measure",ref:fe,"aria-hidden":"true"})]}),y.jsxs("button",{type:"button",className:`ph-updated${D?" is-busy":""}`,title:"点一下立即刷新",onClick:()=>void L(!0),children:[y.jsx(ny,{}),y.jsx("span",{children:P})]})]}),h&&y.jsxs("div",{className:"ph-detail",ref:se,children:[y.jsxs("span",{children:["上次拉取 ",y.jsx("b",{children:O6(_==null?void 0:_.fetchedAt)})]}),y.jsxs("span",{children:["取数方式 ",y.jsx("b",{children:"git fetch origin master"})]}),_&&!_.ok&&y.jsxs("span",{children:["取不到 ",y.jsx("b",{children:lp(_.reason)})]})]})]})}function uy({src:t,onClose:u}){return M.useEffect(()=>{const o=i=>{i.key==="Escape"&&u()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[u]),y.jsx("div",{className:"img-preview",onClick:u,children:y.jsx("img",{src:t,alt:"",onClick:o=>o.stopPropagation()})})}const ry={title:"标题",labels:"标签",summary:"描述"};function oy(t){const u=[];for(const o of t??[])o.name==="ctag"?o.items.forEach(i=>u.push({key:`c:${i.keyCore}`,keyCore:i.keyCore,kind:"ctag",item:i})):o.items.forEach(i=>u.push({key:`t:${i.keyCore}`,keyCore:i.keyCore,kind:"topic",item:i}));return u}function iy({onClose:t}){const[u,o]=M.useState(""),[i,s]=M.useState(null),[c,f]=M.useState(!1),[d,h]=M.useState(0),m=Se(L=>L.openAnchor),k=M.useRef(null),x=M.useRef(null);M.useEffect(()=>{var E;(E=k.current)==null||E.focus();const L=P=>{P.key==="Escape"&&t()};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[t]),M.useEffect(()=>{const L=new AbortController,E=setTimeout(()=>{f(!1),Dt(`/points?q=${encodeURIComponent(u)}`,{signal:L.signal}).then(P=>P.json()).then(P=>P.ok?s(P):f(!0)).catch(P=>{(P==null?void 0:P.name)!=="AbortError"&&f(!0)})},200);return()=>{clearTimeout(E),L.abort()}},[u]);const b=i==null?void 0:i.groups,_=M.useMemo(()=>oy(b),[b]);M.useEffect(()=>{h(0)},[i]),M.useEffect(()=>{var L,E;(E=(L=x.current)==null?void 0:L.querySelector(`[data-idx="${d}"]`))==null||E.scrollIntoView({block:"nearest"})},[d,_]);const v=L=>window.open(gg(L),"_blank","noopener"),D=L=>{m({clicked:`def#${L}_ctag.`},0),t()},T=L=>{if(L.key==="ArrowDown"||L.key==="ArrowUp"){if(!_.length)return;L.preventDefault();const E=L.key==="ArrowDown"?1:-1;h(P=>(P+E+_.length)%_.length);return}if(L.key==="Enter"){if(L.nativeEvent.isComposing||L.keyCode===229)return;L.preventDefault();const E=_[d];if(!E)return;L.metaKey||L.ctrlKey?v(E.keyCore):D(E.keyCore)}},O=(L,E)=>y.jsx("div",{"data-idx":E,className:`point${E===d?" active":""}`,onClick:P=>{if(P.metaKey||P.ctrlKey){v(L.keyCore);return}D(L.keyCore)},onMouseMove:()=>E!==d&&h(E),onMouseDown:P=>{P.button===1&&P.preventDefault()},onAuxClick:P=>{P.button===1&&(P.preventDefault(),v(L.keyCore))},children:L.kind==="ctag"?y.jsxs(y.Fragment,{children:[L.item.descr||"(无 descr)",y.jsx("code",{children:L.keyCore})]}):y.jsxs(y.Fragment,{children:[L.item.descr||L.item.title||"(无标题)",L.item.fields.length>0&&y.jsx("span",{className:"point-fields",children:L.item.fields.map(P=>ry[P]).join(" / ")}),y.jsx("code",{children:L.keyCore})]})},L.key),$=[];let F=0;b==null||b.forEach(L=>{$.push(F),F+=L.items.length});const z=!!(b!=null&&b.some(L=>L.total>L.items.length));return y.jsx("div",{className:"point-search",onClick:t,children:y.jsxs("div",{className:"point-search-box",onClick:L=>L.stopPropagation(),children:[y.jsx("input",{ref:k,className:"nav-q",placeholder:"搜 ctag 的 key,或话题的标题 / 标签 / 描述…(↑↓ 选择,Enter 打开,⌘ Enter 新标签,Esc 关闭)",value:u,onChange:L=>o(L.target.value),onKeyDown:T}),y.jsxs("div",{className:"point-search-list",ref:x,children:[c&&y.jsx("p",{className:"muted",children:"查询失败"}),!c&&(b==null?void 0:b.map((L,E)=>y.jsxs("div",{className:"point-group",children:[y.jsxs("div",{className:"point-group-head",children:[L.name==="ctag"?"按 ctag 命中":i!=null&&i.empty?"最近的话题":"按话题命中","(",L.total>L.items.length?`${L.total},显示前 ${L.items.length}`:L.total,")"]}),_.slice($[E],$[E]+L.items.length).map((P,I)=>O(P,$[E]+I))]},L.name))),!c&&b&&!b.length&&y.jsx("p",{className:"muted",children:"没有匹配的内容"})]}),y.jsx("div",{className:"point-search-foot muted",children:`共 ${(i==null?void 0:i.total)??0} 条${z?`,每组先显示 ${i==null?void 0:i.perGroup} 条,继续输入可缩小范围`:""}`})]})})}function ly(t){return t.key==="Enter"&&(t.metaKey||t.ctrlKey)&&!t.shiftKey&&!t.altKey&&!t.isComposing}function sy(t){return t.key.toLowerCase()==="d"&&t.metaKey&&!t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.isComposing}const cp="vault.copyCommentSummary",ed=!0;function ap(){try{return typeof window>"u"?null:window.localStorage}catch{return null}}function cy(t=ap()){try{const u=t==null?void 0:t.getItem(cp);return u==="1"?!0:u==="0"?!1:ed}catch{return ed}}function ay(t,u=ap()){try{u==null||u.setItem(cp,t?"1":"0")}catch{}}const Ze=Mr((t,u)=>({target:null,open:o=>t({target:o,dirty:!1}),close:()=>t({target:null,dirty:!1}),dirty:!1,setDirty:o=>t({dirty:o}),copySummary:cy(),setCopySummary:o=>{t({copySummary:o}),ay(o)},deselected:{},toggle:(o,i)=>{const s={...u().deselected};for(const c of o)i?delete s[c]:s[c]=!0;t({deselected:s})}})),fy="以下文件回复了你",td="文件列表:";function fp(t){var s;const u=new Set,o=[];let i=0;for(const c of t)for(const f of c.files)!f.commentable||u.has(f.path)||(u.add(f.path),i++,(s=f.comments)!=null&&s.length&&o.push({path:f.path,comments:[...f.comments].sort((d,h)=>d.line-h.line)}));return{docCount:i,docs:o}}const dy=["评论摘要说明:","- **摘要仅供阅读**:「摘录」「评论」只帮用户大概定位,不是评论原文","- **以文件为准**:在每个文件里搜索两个逗号(半角、全角都搜)找到真实评论,再按批注协议处理,不能仅凭这里的片段就决定怎么做"].join(`
|
|
76
76
|
`),py=30,hy=100,nd="";function my(t){return t.replace(/([,,])(?=[,,])/g,`$1${nd}`).replace(/\[(START|END):COMMENT/g,`[${nd}$1:COMMENT`)}function ud(t,u){const o=Array.from(t.replace(/\s+/g," ").trim());return my(o.length>u?`${o.slice(0,u).join("")}…`:o.join(""))}function gy(t){return t.comments.flatMap(u=>[`- 摘录: ${ud(u.preview,py)||"(无文字)"}`,` 评论: ${ud(u.content,hy)}`])}function yy(t,u,o=[],i={}){const s=t.filter(k=>!u.has(k.path));if(!s.length)return{text:"",count:0,docCount:0};const c=s.reduce((k,x)=>k+x.comments.length,0),f=o.filter(k=>k.trim()!==""),h=!!i.withSummary&&c>0?`${td}
|
package/web/dist/assets/{infoDiagram-MVDRKAX5-D8ypF4D2.js → infoDiagram-MVDRKAX5-DRP-H8zh.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,l as s,Q as o,d as i}from"./mermaid.core-
|
|
1
|
+
import{_ as e,l as s,Q as o,d as i}from"./mermaid.core-BZ6wQkn-.js";import{p as g}from"./cynefin-EF2NZ3EQ-C3iyCS68.js";import"./index-CvSLBFhG.js";var p={parse:e(async r=>{const a=await g("info",r);s.debug(a)},"parse")},d={version:"12.2.0"},v=e(()=>d.version,"getVersion"),m={getVersion:v},c=e((r,a,n)=>{s.debug(`rendering info diagram
|
|
2
2
|
`+r);const t=o(a);i(t,100,400,!0),t.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${n}`)},"draw"),l={draw:c},b={parser:p,db:m,renderer:l};export{b as diagram};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as o,c as ot,V as ut,Q as dt,at as yt,A as ft,m as pt,q as it,a as gt,b as kt,g as mt,s as wt,t as _t,d as bt}from"./mermaid.core-
|
|
1
|
+
import{_ as o,c as ot,V as ut,Q as dt,at as yt,A as ft,m as pt,q as it,a as gt,b as kt,g as mt,s as wt,t as _t,d as bt}from"./mermaid.core-BZ6wQkn-.js";import"./index-CvSLBFhG.js";var tt=(function(){var e=o(function(M,t,s,i){for(s=s||{},i=M.length;i--;s[M[i]]=t);return s},"o"),h=[1,4],r=[1,14],a=[1,12],l=[1,13],y=[6,7,8],f=[1,20],d=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],N={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:o(function(t,s,i,u,p,n,v){var w=n.length-1;switch(p){case 6:case 7:return u;case 15:u.addNode(n[w-1].length,n[w].trim());break;case 16:u.addNode(0,n[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:r,7:[1,10],9:9,12:11,13:a,14:l},e(y,[2,3]),{1:[2,2]},e(y,[2,4]),e(y,[2,5]),{1:[2,6],6:r,12:15,13:a,14:l},{6:r,9:16,12:11,13:a,14:l},{6:f,7:d,10:17,11:m},e(c,[2,18],{14:[1,21]}),e(c,[2,16]),e(c,[2,17]),{6:f,7:d,10:22,11:m},{1:[2,7],6:r,12:15,13:a,14:l},e(k,[2,14],{7:g,11:_}),e(x,[2,8]),e(x,[2,9]),e(x,[2,10]),e(c,[2,15]),e(k,[2,13],{7:g,11:_}),e(x,[2,11]),e(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(t,s){if(s.recoverable)this.trace(t);else{var i=new Error(t);throw i.hash=s,i}},"parseError"),parse:o(function(t){var s=this,i=[0],u=[],p=[null],n=[],v=this.table,w="",I=0,S=0,L=2,E=1,R=n.slice.call(arguments,1),b=Object.create(this.lexer),C={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(C.yy[F]=this.yy[F]);b.setInput(t,C.yy),C.yy.lexer=b,C.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var T=b.yylloc;n.push(T);var D=b.options&&b.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function j(P){i.length=i.length-2*P,p.length=p.length-P,n.length=n.length-P}o(j,"popStack");function z(){var P;return P=u.pop()||b.lex()||E,typeof P!="number"&&(P instanceof Array&&(u=P,P=u.pop()),P=s.symbols_[P]||P),P}o(z,"lex");for(var A,W,B,K,H={},X,V,et,Y;;){if(W=i[i.length-1],this.defaultActions[W]?B=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=z()),B=v[W]&&v[W][A]),typeof B>"u"||!B.length||!B[0]){var Q="";Y=[];for(X in v[W])this.terminals_[X]&&X>L&&Y.push("'"+this.terminals_[X]+"'");b.showPosition?Q="Parse error on line "+(I+1)+`:
|
|
2
2
|
`+b.showPosition()+`
|
|
3
3
|
Expecting `+Y.join(", ")+", got '"+(this.terminals_[A]||A)+"'":Q="Parse error on line "+(I+1)+": Unexpected "+(A==E?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(Q,{text:b.match,token:this.terminals_[A]||A,line:b.yylineno,loc:T,expected:Y})}if(B[0]instanceof Array&&B.length>1)throw new Error("Parse Error: multiple actions possible at state: "+W+", token: "+A);switch(B[0]){case 1:i.push(A),p.push(b.yytext),n.push(b.yylloc),i.push(B[1]),A=null,S=b.yyleng,w=b.yytext,I=b.yylineno,T=b.yylloc;break;case 2:if(V=this.productions_[B[1]][1],H.$=p[p.length-V],H._$={first_line:n[n.length-(V||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(V||1)].first_column,last_column:n[n.length-1].last_column},D&&(H._$.range=[n[n.length-(V||1)].range[0],n[n.length-1].range[1]]),K=this.performAction.apply(H,[w,S,I,C.yy,B[1],p,n].concat(R)),typeof K<"u")return K;V&&(i=i.slice(0,-1*V*2),p=p.slice(0,-1*V),n=n.slice(0,-1*V)),i.push(this.productions_[B[1]][0]),p.push(H.$),n.push(H._$),et=v[i[i.length-2]][i[i.length-1]],i.push(et);break;case 3:return!0}}return!0},"parse")},O=(function(){var M={EOF:1,parseError:o(function(s,i){if(this.yy.parser)this.yy.parser.parseError(s,i);else throw new Error(s)},"parseError"),setInput:o(function(t,s){return this.yy=s||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var s=t.match(/(?:\r\n?|\n).*/g);return s?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:o(function(t){var s=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-s),this.offset-=s;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===u.length?this.yylloc.first_column:0)+u[u.length-i.length].length-i[0].length:this.yylloc.first_column-s},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-s]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(t){this.unput(this.match.slice(t))},"less"),pastInput:o(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var t=this.pastInput(),s=new Array(t.length+1).join("-");return t+this.upcomingInput()+`
|
package/web/dist/assets/{journeyDiagram-BOSHW7O7-Cxh9cIZe.js → journeyDiagram-BOSHW7O7-pkpw5r9x.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as gt}from"./chunk-5VM5RSS4-
|
|
1
|
+
import{g as gt}from"./chunk-5VM5RSS4-C861XhrM.js";import{a as mt,b as lt,h as xt,d as kt}from"./chunk-55XCU76K-BSK00in2.js";import{g as _t,s as vt,a as bt,b as wt,t as Tt,q as St,_ as s,c as R,k as X,d as $t,A as Mt}from"./mermaid.core-BZ6wQkn-.js";import{d as it}from"./arc-D-YRXgrg.js";import"./index-CvSLBFhG.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`:
|
|
2
2
|
`+_.showPosition()+`
|
|
3
3
|
Expecting `+z.join(", ")+", got '"+(this.terminals_[b]||b)+"'":H="Parse error on line "+(C+1)+": Unexpected "+(b==D?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(H,{text:_.match,token:this.terminals_[b]||b,line:_.yylineno,loc:Y,expected:z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+b);switch(T[0]){case 1:l.push(b),d.push(_.yytext),c.push(_.yylloc),l.push(T[1]),b=null,Q=_.yyleng,k=_.yytext,C=_.yylineno,Y=_.yylloc;break;case 2:if(M=this.productions_[T[1]][1],F.$=d[d.length-M],F._$={first_line:c[c.length-(M||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(M||1)].first_column,last_column:c[c.length-1].last_column},ft&&(F._$.range=[c[c.length-(M||1)].range[0],c[c.length-1].range[1]]),q=this.performAction.apply(F,[k,Q,C,I.yy,T[1],d,c].concat(dt)),typeof q<"u")return q;M&&(l=l.slice(0,-1*M*2),d=d.slice(0,-1*M),c=c.slice(0,-1*M)),l.push(this.productions_[T[1]][0]),d.push(F.$),c.push(F._$),et=v[l[l.length-2]][l[l.length-1]],l.push(et);break;case 3:return!0}}return!0},"parse")},m=(function(){var h={EOF:1,parseError:s(function(n,l){if(this.yy.parser)this.yy.parser.parseError(n,l);else throw new Error(n)},"parseError"),setInput:s(function(r,n){return this.yy=n||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:s(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var n=r.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:s(function(r){var n=r.length,l=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var d=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===y.length?this.yylloc.first_column:0)+y[y.length-l.length].length-l[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:s(function(r){this.unput(this.match.slice(r))},"less"),pastInput:s(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var r=this.pastInput(),n=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as c,l as te,c as W,Q as fe,al as ye,am as be,an as me,a4 as _e,O as Y,j as G,v as ke,J as Ee,a1 as Se,a2 as le,a3 as ce}from"./mermaid.core-
|
|
1
|
+
import{_ as c,l as te,c as W,Q as fe,al as ye,am as be,an as me,a4 as _e,O as Y,j as G,v as ke,J as Ee,a1 as Se,a2 as le,a3 as ce}from"./mermaid.core-BZ6wQkn-.js";import{g as Ne}from"./chunk-5VM5RSS4-C861XhrM.js";import"./index-CvSLBFhG.js";var $=(function(){var t=c(function(_,s,n,a){for(n=n||{},a=_.length;a--;n[_[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],k=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],j=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],M=[1,35],U=[1,36],A=[1,6,7,11,13,16,17,20,23],H=[1,38],V={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,B){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:j}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(P,[2,14],{7:M,11:U}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:j}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:H}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:M,11:U}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:H}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],B=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var Q=m.yylloc;e.push(Q);var de=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||m.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var E,R,v,q,F={},X,I,oe,K;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((E===null||typeof E>"u")&&(E=ae()),v=B[R]&&B[R][E]),typeof v>"u"||!v.length||!v[0]){var Z="";K=[];for(X in B[R])this.terminals_[X]&&X>ue&&K.push("'"+this.terminals_[X]+"'");m.showPosition?Z="Parse error on line "+(z+1)+`:
|
|
2
2
|
`+m.showPosition()+`
|
|
3
3
|
Expecting `+K.join(", ")+", got '"+(this.terminals_[E]||E)+"'":Z="Parse error on line "+(z+1)+": Unexpected "+(E==re?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(Z,{text:m.match,token:this.terminals_[E]||E,line:m.yylineno,loc:Q,expected:K})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+R+", token: "+E);switch(v[0]){case 1:a.push(E),u.push(m.yytext),e.push(m.yylloc),a.push(v[1]),E=null,ie=m.yyleng,l=m.yytext,z=m.yylineno,Q=m.yylloc;break;case 2:if(I=this.productions_[v[1]][1],F.$=u[u.length-I],F._$={first_line:e[e.length-(I||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(I||1)].first_column,last_column:e[e.length-1].last_column},de&&(F._$.range=[e[e.length-(I||1)].range[0],e[e.length-1].range[1]]),q=this.performAction.apply(F,[l,ie,z,T.yy,v[1],u,e].concat(ge)),typeof q<"u")return q;I&&(a=a.slice(0,-1*I*2),u=u.slice(0,-1*I),e=e.slice(0,-1*I)),a.push(this.productions_[v[1]][0]),u.push(F.$),e.push(F._$),oe=B[a[a.length-2]][a[a.length-1]],a.push(oe);break;case 3:return!0}}return!0},"parse")},y=(function(){var _={EOF:1,parseError:c(function(n,a){if(this.yy.parser)this.yy.parser.parseError(n,a);else throw new Error(n)},"parseError"),setInput:c(function(s,n){return this.yy=n||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:c(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var n=s.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:c(function(s){var n=s.length,a=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var o=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1&&(this.yylineno-=a.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===o.length?this.yylloc.first_column:0)+o[o.length-a.length].length-a[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:c(function(){return this._more=!0,this},"more"),reject:c(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:c(function(s){this.unput(this.match.slice(s))},"less"),pastInput:c(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:c(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:c(function(){var s=this.pastInput(),n=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bi as S,bj as p,bk as w,bl as k,bm as q}from"./mermaid.core-
|
|
1
|
+
import{bi as S,bj as p,bk as w,bl as k,bm as q}from"./mermaid.core-BZ6wQkn-.js";import{i as D}from"./init-Gi6I4Gst.js";import{e as g,f as F,a as z,b as B}from"./defaultLocale-DX6XiGOO.js";function M(n,r){return n==null||r==null?NaN:n<r?-1:n>r?1:n>=r?0:NaN}function I(n,r){return n==null||r==null?NaN:r<n?-1:r>n?1:r>=n?0:NaN}function R(n){let r,t,e;n.length!==2?(r=M,t=(o,c)=>M(n(o),c),e=(o,c)=>n(o)-c):(r=n===M||n===I?n:P,t=n,e=n);function u(o,c,i=0,h=o.length){if(i<h){if(r(c,c)!==0)return h;do{const l=i+h>>>1;t(o[l],c)<0?i=l+1:h=l}while(i<h)}return i}function f(o,c,i=0,h=o.length){if(i<h){if(r(c,c)!==0)return h;do{const l=i+h>>>1;t(o[l],c)<=0?i=l+1:h=l}while(i<h)}return i}function a(o,c,i=0,h=o.length){const l=u(o,c,i,h-1);return l>i&&e(o[l-1],c)>-e(o[l],c)?l-1:l}return{left:u,center:a,right:f}}function P(){return 0}function V(n){return n===null?NaN:+n}const $=R(M),x=$.right;R(V).center;const O=Math.sqrt(50),T=Math.sqrt(10),C=Math.sqrt(2);function v(n,r,t){const e=(r-n)/Math.max(0,t),u=Math.floor(Math.log10(e)),f=e/Math.pow(10,u),a=f>=O?10:f>=T?5:f>=C?2:1;let o,c,i;return u<0?(i=Math.pow(10,-u)/a,o=Math.round(n*i),c=Math.round(r*i),o/i<n&&++o,c/i>r&&--c,i=-i):(i=Math.pow(10,u)*a,o=Math.round(n/i),c=Math.round(r/i),o*i<n&&++o,c*i>r&&--c),c<o&&.5<=t&&t<2?v(n,r,t*2):[o,c,i]}function E(n,r,t){if(r=+r,n=+n,t=+t,!(t>0))return[];if(n===r)return[n];const e=r<n,[u,f,a]=e?v(r,n,t):v(n,r,t);if(!(f>=u))return[];const o=f-u+1,c=new Array(o);if(e)if(a<0)for(let i=0;i<o;++i)c[i]=(f-i)/-a;else for(let i=0;i<o;++i)c[i]=(f-i)*a;else if(a<0)for(let i=0;i<o;++i)c[i]=(u+i)/-a;else for(let i=0;i<o;++i)c[i]=(u+i)*a;return c}function y(n,r,t){return r=+r,n=+n,t=+t,v(n,r,t)[2]}function G(n,r,t){r=+r,n=+n,t=+t;const e=r<n,u=e?y(r,n,t):y(n,r,t);return(e?-1:1)*(u<0?1/-u:u)}function H(n,r){r||(r=[]);var t=n?Math.min(r.length,n.length):0,e=r.slice(),u;return function(f){for(u=0;u<t;++u)e[u]=n[u]*(1-f)+r[u]*f;return e}}function J(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function K(n,r){var t=r?r.length:0,e=n?Math.min(t,n.length):0,u=new Array(e),f=new Array(t),a;for(a=0;a<e;++a)u[a]=d(n[a],r[a]);for(;a<t;++a)f[a]=r[a];return function(o){for(a=0;a<e;++a)f[a]=u[a](o);return f}}function L(n,r){var t=new Date;return n=+n,r=+r,function(e){return t.setTime(n*(1-e)+r*e),t}}function Q(n,r){var t={},e={},u;(n===null||typeof n!="object")&&(n={}),(r===null||typeof r!="object")&&(r={});for(u in r)u in n?t[u]=d(n[u],r[u]):e[u]=r[u];return function(f){for(u in t)e[u]=t[u](f);return e}}function d(n,r){var t=typeof r,e;return r==null||t==="boolean"?S(r):(t==="number"?p:t==="string"?(e=w(r))?(r=e,k):q:r instanceof w?k:r instanceof Date?L:J(r)?H:Array.isArray(r)?K:typeof r.valueOf!="function"&&typeof r.toString!="function"||isNaN(r)?Q:p)(n,r)}function U(n,r){return n=+n,r=+r,function(t){return Math.round(n*(1-t)+r*t)}}function W(n){return Math.max(0,-g(Math.abs(n)))}function X(n,r){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(g(r)/3)))*3-g(Math.abs(n)))}function Y(n,r){return n=Math.abs(n),r=Math.abs(r)-n,Math.max(0,g(r)-g(n))+1}function Z(n){return function(){return n}}function _(n){return+n}var A=[0,1];function m(n){return n}function N(n,r){return(r-=n=+n)?function(t){return(t-n)/r}:Z(isNaN(r)?NaN:.5)}function b(n,r){var t;return n>r&&(t=n,n=r,r=t),function(e){return Math.max(n,Math.min(r,e))}}function nn(n,r,t){var e=n[0],u=n[1],f=r[0],a=r[1];return u<e?(e=N(u,e),f=t(a,f)):(e=N(e,u),f=t(f,a)),function(o){return f(e(o))}}function rn(n,r,t){var e=Math.min(n.length,r.length)-1,u=new Array(e),f=new Array(e),a=-1;for(n[e]<n[0]&&(n=n.slice().reverse(),r=r.slice().reverse());++a<e;)u[a]=N(n[a],n[a+1]),f[a]=t(r[a],r[a+1]);return function(o){var c=x(n,o,1,e)-1;return f[c](u[c](o))}}function en(n,r){return r.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function tn(){var n=A,r=A,t=d,e,u,f,a=m,o,c,i;function h(){var s=Math.min(n.length,r.length);return a!==m&&(a=b(n[0],n[s-1])),o=s>2?rn:nn,c=i=null,l}function l(s){return s==null||isNaN(s=+s)?f:(c||(c=o(n.map(e),r,t)))(e(a(s)))}return l.invert=function(s){return a(u((i||(i=o(r,n.map(e),p)))(s)))},l.domain=function(s){return arguments.length?(n=Array.from(s,_),h()):n.slice()},l.range=function(s){return arguments.length?(r=Array.from(s),h()):r.slice()},l.rangeRound=function(s){return r=Array.from(s),t=U,h()},l.clamp=function(s){return arguments.length?(a=s?!0:m,h()):a!==m},l.interpolate=function(s){return arguments.length?(t=s,h()):t},l.unknown=function(s){return arguments.length?(f=s,l):f},function(s,j){return e=s,u=j,h()}}function un(){return tn()(m,m)}function an(n,r,t,e){var u=G(n,r,t),f;switch(e=F(e??",f"),e.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(r));return e.precision==null&&!isNaN(f=X(u,a))&&(e.precision=f),z(e,a)}case"":case"e":case"g":case"p":case"r":{e.precision==null&&!isNaN(f=Y(u,Math.max(Math.abs(n),Math.abs(r))))&&(e.precision=f-(e.type==="e"));break}case"f":case"%":{e.precision==null&&!isNaN(f=W(u))&&(e.precision=f-(e.type==="%")*2);break}}return B(e)}function on(n){var r=n.domain;return n.ticks=function(t){var e=r();return E(e[0],e[e.length-1],t??10)},n.tickFormat=function(t,e){var u=r();return an(u[0],u[u.length-1],t??10,e)},n.nice=function(t){t==null&&(t=10);var e=r(),u=0,f=e.length-1,a=e[u],o=e[f],c,i,h=10;for(o<a&&(i=a,a=o,o=i,i=u,u=f,f=i);h-- >0;){if(i=y(a,o,t),i===c)return e[u]=a,e[f]=o,r(e);if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else if(i<0)a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i;else break;c=i}return n},n}function fn(){var n=un();return n.copy=function(){return en(n,fn())},D.apply(n,arguments),on(n)}export{en as a,R as b,un as c,fn as l,G as t};
|