docs.waku.org/assets/js/5775.49d8d26f.js
2025-08-13 03:52:48 +00:00

1 line
11 KiB
JavaScript

"use strict";(self.webpackChunkwaku_guide=self.webpackChunkwaku_guide||[]).push([[5775],{45775:(e,t,a)=>{a.d(t,{diagram:()=>b});var l=a(98833),s=a(55683),r=a(50487),n=a(46792),i=a(74505),o=a(41750),c=a(78731),d=a(70451),p=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=o.SV,this.getAccTitle=o.iN,this.setDiagramTitle=o.ke,this.getDiagramTitle=o.ab,this.getAccDescription=o.m7,this.setAccDescription=o.EI}static{(0,o.K2)(this,"TreeMapDB")}getNodes(){return this.nodes}getConfig(){const e=o.UI,t=(0,o.zj)();return(0,n.$t)({...e.treemap,...t.treemap??{}})}addNode(e,t){this.nodes.push(e),this.levels.set(e,t),0===t&&(this.outerNodes.push(e),this.root??=e)}getRoot(){return{name:"",children:this.outerNodes}}addClass(e,t){const a=this.classes.get(e)??{id:e,styles:[],textStyles:[]},l=t.replace(/\\,/g,"\xa7\xa7\xa7").replace(/,/g,";").replace(/\xa7\xa7\xa7/g,",").split(";");l&&l.forEach(e=>{(0,s.KX)(e)&&(a?.textStyles?a.textStyles.push(e):a.textStyles=[e]),a?.styles?a.styles.push(e):a.styles=[e]}),this.classes.set(e,a)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){(0,o.IU)(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function h(e){if(!e.length)return[];const t=[],a=[];return e.forEach(e=>{const l={name:e.name,children:"Leaf"===e.type?void 0:[]};for(l.classSelector=e?.classSelector,e?.cssCompiledStyles&&(l.cssCompiledStyles=[e.cssCompiledStyles]),"Leaf"===e.type&&void 0!==e.value&&(l.value=e.value);a.length>0&&a[a.length-1].level>=e.level;)a.pop();if(0===a.length)t.push(l);else{const e=a[a.length-1].node;e.children?e.children.push(l):e.children=[l]}"Leaf"!==e.type&&a.push({node:l,level:e.level})}),t}(0,o.K2)(h,"buildHierarchy");var m=(0,o.K2)((e,t)=>{(0,r.S)(e,t);const a=[];for(const r of e.TreemapRows??[])"ClassDefStatement"===r.$type&&t.addClass(r.className??"",r.styleText??"");for(const r of e.TreemapRows??[]){const e=r.item;if(!e)continue;const l=r.indent?parseInt(r.indent):0,s=y(e),n=e.classSelector?t.getStylesForClass(e.classSelector):[],i=n.length>0?n.join(";"):void 0,o={level:l,name:s,type:e.$type,value:e.value,classSelector:e.classSelector,cssCompiledStyles:i};a.push(o)}const l=h(a),s=(0,o.K2)((e,a)=>{for(const l of e)t.addNode(l,a),l.children&&l.children.length>0&&s(l.children,a+1)},"addNodesRecursively");s(l,0)},"populate"),y=(0,o.K2)(e=>e.name?String(e.name):"","getItemName"),u={parser:{yy:void 0},parse:(0,o.K2)(async e=>{try{const t=c.qg,a=await t("treemap",e);o.Rm.debug("Treemap AST:",a);const l=u.parser?.yy;if(!(l instanceof p))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.");m(a,l)}catch(t){throw o.Rm.error("Error parsing treemap:",t),t}},"parse")},f=10,g={draw:(0,o.K2)((e,t,a,r)=>{const n=r.db,c=n.getConfig(),p=c.padding??10,h=n.getDiagramTitle(),m=n.getRoot(),{themeVariables:y}=(0,o.zj)();if(!m)return;const u=h?30:0,g=(0,i.D)(t),S=c.nodeWidth?c.nodeWidth*f:960,x=c.nodeHeight?c.nodeHeight*f:500,b=S,v=x+u;let $;g.attr("viewBox",`0 0 ${b} ${v}`),(0,o.a$)(g,v,b,c.useMaxWidth);try{const e=c.valueFormat||",";if("$0,0"===e)$=(0,o.K2)(e=>"$"+(0,d.GPZ)(",")(e),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const t=/\.\d+/.exec(e),a=t?t[0]:"";$=(0,o.K2)(e=>"$"+(0,d.GPZ)(","+a)(e),"valueFormat")}else if(e.startsWith("$")){const t=e.substring(1);$=(0,o.K2)(e=>"$"+(0,d.GPZ)(t||"")(e),"valueFormat")}else $=(0,d.GPZ)(e)}catch(N){o.Rm.error("Error creating format function:",N),$=(0,d.GPZ)(",")}const w=(0,d.UMr)().range(["transparent",y.cScale0,y.cScale1,y.cScale2,y.cScale3,y.cScale4,y.cScale5,y.cScale6,y.cScale7,y.cScale8,y.cScale9,y.cScale10,y.cScale11]),C=(0,d.UMr)().range(["transparent",y.cScalePeer0,y.cScalePeer1,y.cScalePeer2,y.cScalePeer3,y.cScalePeer4,y.cScalePeer5,y.cScalePeer6,y.cScalePeer7,y.cScalePeer8,y.cScalePeer9,y.cScalePeer10,y.cScalePeer11]),k=(0,d.UMr)().range([y.cScaleLabel0,y.cScaleLabel1,y.cScaleLabel2,y.cScaleLabel3,y.cScaleLabel4,y.cScaleLabel5,y.cScaleLabel6,y.cScaleLabel7,y.cScaleLabel8,y.cScaleLabel9,y.cScaleLabel10,y.cScaleLabel11]);h&&g.append("text").attr("x",b/2).attr("y",u/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(h);const L=g.append("g").attr("transform",`translate(0, ${u})`).attr("class","treemapContainer"),T=(0,d.Sk5)(m).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),M=(0,d.hkb)().size([S,x]).paddingTop(e=>e.children&&e.children.length>0?35:0).paddingInner(p).paddingLeft(e=>e.children&&e.children.length>0?f:0).paddingRight(e=>e.children&&e.children.length>0?f:0).paddingBottom(e=>e.children&&e.children.length>0?f:0).round(!0)(T),P=M.descendants().filter(e=>e.children&&e.children.length>0),z=L.selectAll(".treemapSection").data(P).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);z.append("rect").attr("width",e=>e.x1-e.x0).attr("height",25).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>0===e.depth?"display: none;":""),z.append("clipPath").attr("id",(e,a)=>`clip-section-${t}-${a}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",25),z.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=>w(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>C(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(0===e.depth)return"display: none;";const t=(0,s.GX)({cssCompiledStyles:e.data.cssCompiledStyles});return t.nodeStyles+";"+t.borderStyles.join(";")}),z.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",12.5).attr("dominant-baseline","middle").text(e=>0===e.depth?"":e.data.name).attr("font-weight","bold").attr("style",e=>{if(0===e.depth)return"display: none;";return"dominant-baseline: middle; font-size: 12px; fill:"+k(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"+(0,s.GX)({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")}).each(function(e){if(0===e.depth)return;const t=(0,d.Ltv)(this),a=e.data.name;t.text(a);const l=e.x1-e.x0;let s;if(!1!==c.showValues&&e.value){s=l-10-30-10-6}else{s=l-6-6}const r=Math.max(15,s),n=t.node();if(n.getComputedTextLength()>r){const e="...";let l=a;for(;l.length>0;){if(l=a.substring(0,l.length-1),0===l.length){t.text(e),n.getComputedTextLength()>r&&t.text("");break}if(t.text(l+e),n.getComputedTextLength()<=r)break}}}),!1!==c.showValues&&z.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",12.5).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?$(e.value):"").attr("font-style","italic").attr("style",e=>{if(0===e.depth)return"display: none;";return"text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+k(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"+(0,s.GX)({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")});const F=M.leaves(),K=L.selectAll(".treemapLeafGroup").data(F).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})`);K.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?w(e.parent.data.name):w(e.data.name)).attr("style",e=>(0,s.GX)({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?w(e.parent.data.name):w(e.data.name)).attr("stroke-width",3),K.append("clipPath").attr("id",(e,a)=>`clip-${t}-${a}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4));if(K.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>"text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:"+k(e.data.name)+";"+(0,s.GX)({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")).attr("clip-path",(e,a)=>`url(#clip-${t}-${a})`).text(e=>e.data.name).each(function(e){const t=(0,d.Ltv)(this),a=e.x1-e.x0,l=e.y1-e.y0,s=t.node(),r=a-8,n=l-8;if(r<10||n<10)return void t.style("display","none");let i=parseInt(t.style("font-size"),10);for(;s.getComputedTextLength()>r&&i>8;)i--,t.style("font-size",`${i}px`);let o=Math.max(6,Math.min(28,Math.round(.6*i))),c=i+2+o;for(;c>n&&i>8&&(i--,o=Math.max(6,Math.min(28,Math.round(.6*i))),!(o<6&&8===i));)t.style("font-size",`${i}px`),c=i+2+o;t.style("font-size",`${i}px`),(s.getComputedTextLength()>r||i<8||n<i)&&t.style("display","none")}),!1!==c.showValues){K.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=>"text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:"+k(e.data.name)+";"+(0,s.GX)({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")).attr("clip-path",(e,a)=>`url(#clip-${t}-${a})`).text(e=>e.value?$(e.value):"").each(function(e){const t=(0,d.Ltv)(this),a=this.parentNode;if(!a)return void t.style("display","none");const l=(0,d.Ltv)(a).select(".treemapLabel");if(l.empty()||"none"===l.style("display"))return void t.style("display","none");const s=parseFloat(l.style("font-size")),r=Math.max(6,Math.min(28,Math.round(.6*s)));t.style("font-size",`${r}px`);const n=(e.y1-e.y0)/2+s/2+2;t.attr("y",n);const i=e.x1-e.x0,o=e.y1-e.y0-4,c=i-8;t.node().getComputedTextLength()>c||n+r>o||r<6?t.style("display","none"):t.style("display",null)})}const D=c.diagramPadding??8;(0,l.P)(g,D,"flowchart",c?.useMaxWidth||!1)},"draw"),getClasses:(0,o.K2)(function(e,t){return t.db.getClasses()},"getClasses")},S={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelColor:"black",labelFontSize:"12px",valueFontSize:"10px",valueColor:"black",titleColor:"black",titleFontSize:"14px"},x=(0,o.K2)(({treemap:e}={})=>{const t=(0,n.$t)(S,e);return`\n .treemapNode.section {\n stroke: ${t.sectionStrokeColor};\n stroke-width: ${t.sectionStrokeWidth};\n fill: ${t.sectionFillColor};\n }\n .treemapNode.leaf {\n stroke: ${t.leafStrokeColor};\n stroke-width: ${t.leafStrokeWidth};\n fill: ${t.leafFillColor};\n }\n .treemapLabel {\n fill: ${t.labelColor};\n font-size: ${t.labelFontSize};\n }\n .treemapValue {\n fill: ${t.valueColor};\n font-size: ${t.valueFontSize};\n }\n .treemapTitle {\n fill: ${t.titleColor};\n font-size: ${t.titleFontSize};\n }\n `},"getStyles"),b={parser:u,get db(){return new p},renderer:g,styles:x}},50487:(e,t,a)=>{function l(e,t){e.accDescr&&t.setAccDescription?.(e.accDescr),e.accTitle&&t.setAccTitle?.(e.accTitle),e.title&&t.setDiagramTitle?.(e.title)}a.d(t,{S:()=>l}),(0,a(41750).K2)(l,"populateCommonDb")},98833:(e,t,a)=>{a.d(t,{P:()=>s});var l=a(41750),s=(0,l.K2)((e,t,a,s)=>{e.attr("class",a);const{width:i,height:o,x:c,y:d}=r(e,t);(0,l.a$)(e,o,i,s);const p=n(c,d,i,o,t);e.attr("viewBox",p),l.Rm.debug(`viewBox configured: ${p} with padding: ${t}`)},"setupViewPortForSVG"),r=(0,l.K2)((e,t)=>{const a=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:a.width+2*t,height:a.height+2*t,x:a.x,y:a.y}},"calculateDimensionsWithPadding"),n=(0,l.K2)((e,t,a,l,s)=>`${e-s} ${t-s} ${a} ${l}`,"createViewBox")}}]);