Files
build_notes_simengweb/assets/diagram-LL6QPXA2-3VcXRsO1.js

25 lines
11 KiB
JavaScript

import{c as se}from"./chunk-4KE642ED-CurJxSjh.js";import{p as re}from"./treemap-KMMF4GRG-7ORZ52ND-BjVEqkKc.js";import{m as h,L as X,O as Y,aN as ie,W as ne,br as N,p as B,aR as E,bs as oe,bt as ce,bu as C,i as H,H as de,U as pe,j as he,e as me,$ as ye,G as fe,r as ue,bv as Se,N as ge}from"./mermaid.esm.min-CFMguGj4.js";import{y as xe}from"./chunk-T244DUNM-toKIVE0w.js";import"./chunk-OMTJKCYW-C42Y4h95.js";import"./app-FFcgQi-5.js";var w,K=(w=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=de,this.getAccTitle=pe,this.setDiagramTitle=he,this.getDiagramTitle=me,this.getAccDescription=ye,this.setAccDescription=fe}getNodes(){return this.nodes}getConfig(){let a=ue,i=Y();return X({...a.treemap,...i.treemap??{}})}addNode(a,i){this.nodes.push(a),this.levels.set(a,i),i===0&&(this.outerNodes.push(a),this.root??=a)}getRoot(){return{name:"",children:this.outerNodes}}addClass(a,i){let r=this.classes.get(a)??{id:a,styles:[],textStyles:[]},c=i.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");c&&c.forEach(s=>{Se(s)&&(r?.textStyles?r.textStyles.push(s):r.textStyles=[s]),r?.styles?r.styles.push(s):r.styles=[s]}),this.classes.set(a,r)}getClasses(){return this.classes}getStylesForClass(a){return this.classes.get(a)?.styles??[]}clear(){ge(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},h(w,"TreeMapDB"),w);function Q(d){if(!d.length)return[];let a=[],i=[];return d.forEach(r=>{let c={name:r.name,children:r.type==="Leaf"?void 0:[]};for(c.classSelector=r?.classSelector,r?.cssCompiledStyles&&(c.cssCompiledStyles=[r.cssCompiledStyles]),r.type==="Leaf"&&r.value!==void 0&&(c.value=r.value);i.length>0&&i[i.length-1].level>=r.level;)i.pop();if(i.length===0)a.push(c);else{let s=i[i.length-1].node;s.children?s.children.push(c):s.children=[c]}r.type!=="Leaf"&&i.push({node:c,level:r.level})}),a}h(Q,"buildHierarchy");var be=h((d,a)=>{se(d,a);let i=[];for(let s of d.TreemapRows??[])s.$type==="ClassDefStatement"&&a.addClass(s.className??"",s.styleText??"");for(let s of d.TreemapRows??[]){let p=s.item;if(!p)continue;let m=s.indent?parseInt(s.indent):0,P=$e(p),l=p.classSelector?a.getStylesForClass(p.classSelector):[],L=l.length>0?l.join(";"):void 0,b={level:m,name:P,type:p.$type,value:p.value,classSelector:p.classSelector,cssCompiledStyles:L};i.push(b)}let r=Q(i),c=h((s,p)=>{for(let m of s)a.addNode(m,p),m.children&&m.children.length>0&&c(m.children,p+1)},"addNodesRecursively");c(r,0)},"populate"),$e=h(d=>d.name?String(d.name):"","getItemName"),Z={parser:{yy:void 0},parse:h(async d=>{try{let a=await re("treemap",d);B.debug("Treemap AST:",a);let i=Z.parser?.yy;if(!(i instanceof K))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");be(a,i)}catch(a){throw B.error("Error parsing treemap:",a),a}},"parse")},Ce=10,v=10,F=25,ve=h((d,a,i,r)=>{let c=r.db,s=c.getConfig(),p=s.padding??Ce,m=c.getDiagramTitle(),P=c.getRoot(),{themeVariables:l}=Y();if(!P)return;let L=m?30:0,b=ie(a),G=s.nodeWidth?s.nodeWidth*v:960,I=s.nodeHeight?s.nodeHeight*v:500,j=G,U=I+L;b.attr("viewBox",`0 0 ${j} ${U}`),ne(b,U,j,s.useMaxWidth);let $;try{let e=s.valueFormat||",";if(e==="$0,0")$=h(t=>"$"+N(",")(t),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){let t=/\.\d+/.exec(e),o=t?t[0]:"";$=h(y=>"$"+N(","+o)(y),"valueFormat")}else if(e.startsWith("$")){let t=e.substring(1);$=h(o=>"$"+N(t||"")(o),"valueFormat")}else $=N(e)}catch(e){B.error("Error creating format function:",e),$=N(",")}let k=E().range(["transparent",l.cScale0,l.cScale1,l.cScale2,l.cScale3,l.cScale4,l.cScale5,l.cScale6,l.cScale7,l.cScale8,l.cScale9,l.cScale10,l.cScale11]),_=E().range(["transparent",l.cScalePeer0,l.cScalePeer1,l.cScalePeer2,l.cScalePeer3,l.cScalePeer4,l.cScalePeer5,l.cScalePeer6,l.cScalePeer7,l.cScalePeer8,l.cScalePeer9,l.cScalePeer10,l.cScalePeer11]),W=E().range([l.cScaleLabel0,l.cScaleLabel1,l.cScaleLabel2,l.cScaleLabel3,l.cScaleLabel4,l.cScaleLabel5,l.cScaleLabel6,l.cScaleLabel7,l.cScaleLabel8,l.cScaleLabel9,l.cScaleLabel10,l.cScaleLabel11]);m&&b.append("text").attr("x",j/2).attr("y",L/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(m);let O=b.append("g").attr("transform",`translate(0, ${L})`).attr("class","treemapContainer"),ee=oe(P).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),q=ce().size([G,I]).paddingTop(e=>e.children&&e.children.length>0?F+v:0).paddingInner(p).paddingLeft(e=>e.children&&e.children.length>0?v:0).paddingRight(e=>e.children&&e.children.length>0?v:0).paddingBottom(e=>e.children&&e.children.length>0?v:0).round(!0)(ee),te=q.descendants().filter(e=>e.children&&e.children.length>0),T=O.selectAll(".treemapSection").data(te).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);T.append("rect").attr("width",e=>e.x1-e.x0).attr("height",F).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),T.append("clipPath").attr("id",(e,t)=>`clip-section-${a}-${t}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",F),T.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,t)=>`treemapSection section${t}`).attr("fill",e=>k(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>_(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";let t=C({cssCompiledStyles:e.data.cssCompiledStyles});return t.nodeStyles+";"+t.borderStyles.join(";")}),T.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",F/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("style",e=>{if(e.depth===0)return"display: none;";let t="dominant-baseline: middle; font-size: 12px; fill:"+W(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",o=C({cssCompiledStyles:e.data.cssCompiledStyles});return t+o.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;let t=H(this),o=e.data.name;t.text(o);let y=e.x1-e.x0,S=6,g;s.showValues!==!1&&e.value?g=y-10-30-10-S:g=y-S-6;let u=Math.max(15,g),f=t.node();if(f.getComputedTextLength()>u){let n=o;for(;n.length>0;){if(n=o.substring(0,n.length-1),n.length===0){t.text("..."),f.getComputedTextLength()>u&&t.text("");break}if(t.text(n+"..."),f.getComputedTextLength()<=u)break}}}),s.showValues!==!1&&T.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",F/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?$(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";let t="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+W(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",o=C({cssCompiledStyles:e.data.cssCompiledStyles});return t+o.labelStyles.replace("color:","fill:")});let ae=q.leaves(),A=O.selectAll(".treemapLeafGroup").data(ae).enter().append("g").attr("class",(e,t)=>`treemapNode treemapLeafGroup leaf${t}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);A.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?k(e.parent.data.name):k(e.data.name)).attr("style",e=>C({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?k(e.parent.data.name):k(e.data.name)).attr("stroke-width",3),A.append("clipPath").attr("id",(e,t)=>`clip-${a}-${t}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),A.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{let t="text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:"+W(e.data.name)+";",o=C({cssCompiledStyles:e.data.cssCompiledStyles});return t+o.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,t)=>`url(#clip-${a}-${t})`).text(e=>e.data.name).each(function(e){let t=H(this),o=e.x1-e.x0,y=e.y1-e.y0,S=t.node(),g=4,u=o-2*g,f=y-2*g;if(u<10||f<10){t.style("display","none");return}let n=parseInt(t.style("font-size"),10),x=8,z=28,D=.6,M=6,R=2;for(;S.getComputedTextLength()>u&&n>x;)n--,t.style("font-size",`${n}px`);let V=Math.max(M,Math.min(z,Math.round(n*D))),J=n+R+V;for(;J>f&&n>x&&(n--,V=Math.max(M,Math.min(z,Math.round(n*D))),!(V<M&&n===x));)t.style("font-size",`${n}px`),J=n+R+V;t.style("font-size",`${n}px`),(S.getComputedTextLength()>u||n<x||f<n)&&t.style("display","none")}),s.showValues!==!1&&A.append("text").attr("class","treemapValue").attr("x",e=>(e.x1-e.x0)/2).attr("y",function(e){return(e.y1-e.y0)/2}).attr("style",e=>{let t="text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:"+W(e.data.name)+";",o=C({cssCompiledStyles:e.data.cssCompiledStyles});return t+o.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,t)=>`url(#clip-${a}-${t})`).text(e=>e.value?$(e.value):"").each(function(e){let t=H(this),o=this.parentNode;if(!o){t.style("display","none");return}let y=H(o).select(".treemapLabel");if(y.empty()||y.style("display")==="none"){t.style("display","none");return}let S=parseFloat(y.style("font-size")),g=28,u=.6,f=6,n=2,x=Math.max(f,Math.min(g,Math.round(S*u)));t.style("font-size",`${x}px`);let z=(e.y1-e.y0)/2+S/2+n;t.attr("y",z);let D=e.x1-e.x0,M=e.y1-e.y0-4,R=D-8;t.node().getComputedTextLength()>R||z+x>M||x<f?t.style("display","none"):t.style("display",null)});let le=s.diagramPadding??8;xe(b,le,"flowchart",s?.useMaxWidth||!1)},"draw"),we=h(function(d,a){return a.db.getClasses()},"getClasses"),Le={draw:ve,getClasses:we},ke={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelColor:"black",labelFontSize:"12px",valueFontSize:"10px",valueColor:"black",titleColor:"black",titleFontSize:"14px"},Te=h(({treemap:d}={})=>{let a=X(ke,d);return`
.treemapNode.section {
stroke: ${a.sectionStrokeColor};
stroke-width: ${a.sectionStrokeWidth};
fill: ${a.sectionFillColor};
}
.treemapNode.leaf {
stroke: ${a.leafStrokeColor};
stroke-width: ${a.leafStrokeWidth};
fill: ${a.leafFillColor};
}
.treemapLabel {
fill: ${a.labelColor};
font-size: ${a.labelFontSize};
}
.treemapValue {
fill: ${a.valueColor};
font-size: ${a.valueFontSize};
}
.treemapTitle {
fill: ${a.titleColor};
font-size: ${a.titleFontSize};
}
`},"getStyles"),ze=Te,De={parser:Z,get db(){return new K},renderer:Le,styles:ze};export{De as diagram};