PageSourceSearch

https://statics.kimi.ai/kimi-web-seo/assets/diagram-PSM6KHXK-CR1Zy_da.js

js kimi.ai collected 2026-10-02 02:18:50 UTC 16,864 bytes, 3 lines download raw bytes

1/*! pre,oversea,b3706f52,2026-09-29 18:29:09 */
2import{at as treemap_default,it as ordinal,lt as select_default,ot as hierarchy,st as format}from"./vendor-Dh3EZL8Q.js";import{n as __name,r as log}from"./chunk-AGHRB4JF--WZFvz_Y.js";import{B as setAccTitle,C as getDiagramTitle,U as setDiagramTitle,_ as getAccDescription,a as clear,c as configureSvgSize,d as defaultConfig_default,v as getAccTitle,y as getConfig,z as setAccDescription}from"./chunk-ABZYJK2D-GUy1XDNo.js";import{i as styles2String,n as isLabelStyle}from"./chunk-ATLVNIR6-DR1EbWSC.js";import{r as cleanAndMerge}from"./chunk-S3R3BYOJ-DgYvHMFt.js";import{an as selectSvgElement}from"./index-CSFKQLS8.js";import{t as parse}from"./mermaid-parser.core-B2CNvIBp.js";import{t as populateCommonDb}from"./chunk-4BX2VUAB-_nDkl-YD.js";import{t as setupViewPortForSVG}from"./chunk-QN33PNHL-CpwPA--9.js";var _Class,TreeMapDB=(__name(_Class=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=setAccTitle,this.getAccTitle=getAccTitle,this.setDiagramTitle=setDiagramTitle,this.getDiagramTitle=getDiagramTitle,this.getAccDescription=getAccDescription,this.setAccDescription=setAccDescription}getNodes(){return this.nodes}getConfig(){var _userConfig$treemap;const defaultConfig=defaultConfig_default,userConfig=getConfig();return cleanAndMerge({...defaultConfig.treemap,...null!==(_userConfig$treemap=userConfig.treemap)&&void 0!==_userConfig$treemap?_userConfig$treemap:{}})}addNode(node,level){var _this$root;(this.nodes.push(node),this.levels.set(node,level),0===level)&&(this.outerNodes.push(node),null!==(_this$root=this.root)&&void 0!==_this$root||(this.root=node))}getRoot(){return{name:"",children:this.outerNodes}}addClass(id,_style){var _this$classes$get;const styleClass=null!==(_this$classes$get=this.classes.get(id))&&void 0!==_this$classes$get?_this$classes$get:{id:id,styles:[],textStyles:[]},styles=_style.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");styles&&styles.forEach(s=>{isLabelStyle(s)&&((null==styleClass?void 0:styleClass.textStyles)?styleClass.textStyles.push(s):styleClass.textStyles=[s]),(null==styleClass?void 0:styleClass.styles)?styleClass.styles.push(s):styleClass.styles=[s]}),this.classes.set(id,styleClass)}getClasses(){return this.classes}getStylesForClass(classSelector){var _this$classes$get$sty,_this$classes$get2;return null!==(_this$classes$get$sty=null===(_this$classes$get2=this.classes.get(classSelector))||void 0===_this$classes$get2?void 0:_this$classes$get2.styles)&&void 0!==_this$classes$get$sty?_this$classes$get$sty:[]}clear(){clear(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},"TreeMapDB"),_Class);function buildHierarchy(items){if(!items.length)return[];const root=[],stack=[];return items.forEach(item=>{const node={name:item.name,children:"Leaf"===item.type?void 0:[]};for(node.classSelector=null==item?void 0:item.classSelector,(null==item?void 0:item.cssCompiledStyles)&&(node.cssCompiledStyles=[item.cssCompiledStyles]),"Leaf"===item.type&&void 0!==item.value&&(node.value=item.value);stack.length>0&&stack[stack.length-1].level>=item.level;)stack.pop();if(0===stack.length)root.push(node);else{const parent=stack[stack.length-1].node;parent.children?parent.children.push(node):parent.children=[node]}"Leaf"!==item.type&&stack.push({node:node,level:item.level})}),root}__name(buildHierarchy,"buildHierarchy");var populate=__name((ast,db)=>{var _ast$TreemapRows,_ast$TreemapRows2;populateCommonDb(ast,db);const items=[];for(const row of null!==(_ast$TreemapRows=ast.TreemapRows)&&void 0!==_ast$TreemapRows?_ast$TreemapRows:[])if("ClassDefStatement"===row.$type){var _row$className,_row$styleText;db.addClass(null!==(_row$className=row.className)&&void 0!==_row$className?_row$className:"",null!==(_row$styleText=row.styleText)&&void 0!==_row$styleText?_row$styleText:"")}for(const row of null!==(_ast$TreemapRows2=ast.TreemapRows)&&void 0!==_ast$TreemapRows2?_ast$TreemapRows2:[]){const item=row.item;if(!item)continue;const level=row.indent?parseInt(row.indent):0,name=getItemName(item),styles=item.classSelector?db.getStylesForClass(item.classSelector):[],cssCompiledStyles=styles.length>0?styles.join(";"):void 0,itemData={level:level,name:name,type:item.$type,value:item.value,classSelector:item.classSelector,cssCompiledStyles:cssCompiledStyles};items.push(itemData)}const hierarchyNodes=buildHierarchy(items),addNodesRecursively=__name((nodes,level)=>{for(const node of nodes)db.addNode(node,level),node.children&&node.children.length>0&&addNodesRecursively(node.children,level+1)},"addNodesRecursively");addNodesRecursively(hierarchyNodes,0)},"populate"),getItemName=__name(item=>item.name?String(item.name):"","getItemName"),parser={parser:{yy:void 0},parse:__name(async text=>{try{var _parser$parser;const ast=await parse("treemap",text);log.debug("Treemap AST:",ast);const db=null===(_parser$parser=parser.parser)||void 0===_parser$parser?void 0:_parser$parser.yy;if(!(db instanceof TreeMapDB))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.");populate(ast,db)}catch(error){throw log.error("Error parsing treemap:",error),error}},"parse")},renderer={draw:__name((_text,id,_version,diagram2)=>{var _config$padding,_config$diagramPaddin;const treemapDb=diagram2.db,config=treemapDb.getConfig(),treemapInnerPadding=null!==(_config$padding=config.padding)&&void 0!==_config$padding?_config$padding:10,title=treemapDb.getDiagramTitle(),root=treemapDb.getRoot(),{themeVariables:themeVariables}=getConfig();if(!root)return;const titleHeight=title?30:0,svg=selectSvgElement(id),width=config.nodeWidth?10*config.nodeWidth:960,height=config.nodeHeight?10*config.nodeHeight:500,svgWidth=width,svgHeight=height+titleHeight;let valueFormat;svg.attr("viewBox",`0 0 ${svgWidth} ${svgHeight}`),configureSvgSize(svg,svgHeight,svgWidth,config.useMaxWidth);try{const formatStr=config.valueFormat||",";if("$0,0"===formatStr)valueFormat=__name(value=>"$"+format(",")(value),"valueFormat");else if(formatStr.startsWith("$")&&formatStr.includes(",")){const precision=/\.\d+/.exec(formatStr),precisionStr=precision?precision[0]:"";valueFormat=__name(value=>"$"+format(","+precisionStr)(value),"valueFormat")}else if(formatStr.startsWith("$")){const restOfFormat=formatStr.substring(1);valueFormat=__name(value=>"$"+format(restOfFormat||"")(value),"valueFormat")}else valueFormat=format(formatStr)}catch(error){log.error("Error creating format function:",error),valueFormat=format(",")}const colorScale=ordinal().range(["transparent",themeVariables.cScale0,themeVariables.cScale1,themeVariables.cScale2,themeVariables.cScale3,themeVariables.cScale4,themeVariables.cScale5,themeVariables.cScale6,themeVariables.cScale7,themeVariables.cScale8,themeVariables.cScale9,themeVariables.cScale10,themeVariables.cScale11]),colorScalePeer=ordinal().range(["transparent",themeVariables.cScalePeer0,themeVariables.cScalePeer1,themeVariables.cScalePeer2,themeVariables.cScalePeer3,themeVariables.cScalePeer4,themeVariables.cScalePeer5,themeVariables.cScalePeer6,themeVariables.cScalePeer7,themeVariables.cScalePeer8,themeVariables.cScalePeer9,themeVariables.cScalePeer10,themeVariables.cScalePeer11]),colorScaleLabel=ordinal().range([themeVariables.cScaleLabel0,themeVariables.cScaleLabel1,themeVariables.cScaleLabel2,themeVariables.cScaleLabel3,themeVariables.cScaleLabel4,themeVariables.cScaleLabel5,themeVariables.cScaleLabel6,themeVariables.cScaleLabel7,themeVariables.cScaleLabel8,themeVariables.cScaleLabel9,themeVariables.cScaleLabel10,themeVariables.cScaleLabel11]);title&&svg.append("text").attr("x",svgWidth/2).attr("y",titleHeight/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(title);const g=svg.append("g").attr("transform",`translate(0, ${titleHeight})`).attr("class","treemapContainer"),hierarchyRoot=hierarchy(root).sum(d=>{var _d$value;return null!==(_d$value=d.value)&&void 0!==_d$value?_d$value:0}).sort((a,b)=>{var _b$value,_a$value;return(null!==(_b$value=b.value)&&void 0!==_b$value?_b$value:0)-(null!==(_a$value=a.value)&&void 0!==_a$value?_a$value:0)}),treemapData=treemap_default().size([width,height]).paddingTop(d=>d.children&&d.children.length>0?35:0).paddingInner(treemapInnerPadding).paddingLeft(d=>d.children&&d.children.length>0?10:0).paddingRight(d=>d.children&&d.children.length>0?10:0).paddingBottom(d=>d.children&&d.children.length>
20?10:0).round(!0)(hierarchyRoot),branchNodes=treemapData.descendants().filter(d=>d.children&&d.children.length>0),sections=g.selectAll(".treemapSection").data(branchNodes).enter().append("g").attr("class","treemapSection").attr("transform",d=>`translate(${d.x0},${d.y0})`);sections.append("rect").attr("width",d=>d.x1-d.x0).attr("height",25).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",d=>0===d.depth?"display: none;":""),sections.append("clipPath").attr("id",(_d,i)=>`clip-section-${id}-${i}`).append("rect").attr("width",d=>Math.max(0,d.x1-d.x0-12)).attr("height",25),sections.append("rect").attr("width",d=>d.x1-d.x0).attr("height",d=>d.y1-d.y0).attr("class",(_d,i)=>`treemapSection section${i}`).attr("fill",d=>colorScale(d.data.name)).attr("fill-opacity",.6).attr("stroke",d=>colorScalePeer(d.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",d=>{if(0===d.depth)return"display: none;";const styles=styles2String({cssCompiledStyles:d.data.cssCompiledStyles});return styles.nodeStyles+";"+styles.borderStyles.join(";")}),sections.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",12.5).attr("dominant-baseline","middle").text(d=>0===d.depth?"":d.data.name).attr("font-weight","bold").attr("style",d=>0===d.depth?"display: none;":"dominant-baseline: middle; font-size: 12px; fill:"+colorScaleLabel(d.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"+styles2String({cssCompiledStyles:d.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")).each(function(d){if(0===d.depth)return;const self=select_default(this),originalText=d.data.name;self.text(originalText);const totalHeaderWidth=d.x1-d.x0;let spaceForTextContent;spaceForTextContent=!1!==config.showValues&&d.value?totalHeaderWidth-10-30-10-6:totalHeaderWidth-6-6;const actualAvailableWidth=Math.max(15,spaceForTextContent),textNode=self.node();if(textNode.getComputedTextLength()>actualAvailableWidth){const ellipsis="...";let currentTruncatedText=originalText;for(;currentTruncatedText.length>0;){if(currentTruncatedText=originalText.substring(0,currentTruncatedText.length-1),0===currentTruncatedText.length){self.text(ellipsis),textNode.getComputedTextLength()>actualAvailableWidth&&self.text("");break}if(self.text(currentTruncatedText+ellipsis),textNode.getComputedTextLength()<=actualAvailableWidth)break}}}),!1!==config.showValues&&sections.append("text").attr("class","treemapSectionValue").attr("x",d=>d.x1-d.x0-10).attr("y",12.5).attr("text-anchor","end").attr("dominant-baseline","middle").text(d=>d.value?valueFormat(d.value):"").attr("font-style","italic").attr("style",d=>0===d.depth?"display: none;":"text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+colorScaleLabel(d.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"+styles2String({cssCompiledStyles:d.data.cssCompiledStyles}).labelStyles.replace("color:","fill:"));const leafNodes=treemapData.leaves(),cell=g.selectAll(".treemapLeafGroup").data(leafNodes).enter().append("g").attr("class",(d,i)=>`treemapNode treemapLeafGroup leaf${i}${d.data.classSelector?` ${d.data.classSelector}`:""}x`).attr("transform",d=>`translate(${d.x0},${d.y0})`);cell.append("rect").attr("width",d=>d.x1-d.x0).attr("height",d=>d.y1-d.y0).attr("class","treemapLeaf").attr("fill",d=>d.parent?colorScale(d.parent.data.name):colorScale(d.data.name)).attr("style",d=>styles2String({cssCompiledStyles:d.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",d=>d.parent?colorScale(d.parent.data.name):colorScale(d.data.name)).attr("stroke-width",3),cell.append("clipPath").attr("id",(_d,i)=>`clip-${id}-${i}`).append("rect").attr("width",d=>Math.max(0,d.x1-d.x0-4)).attr("height",d=>Math.max(0,d.y1-d.y0-4)),cell.append("text").attr("class","treemapLabel").attr("x",d=>(d.x1-d.x0)/2).attr("y",d=>(d.y1-d.y0)/2).attr("style",d=>"text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:"+colorScaleLabel(d.data.name)+";"+styles2String({cssCompiledStyles:d.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")).attr("clip-path",(_d,i)=>`url(#clip-${id}-${i})`).text(d=>d.data.name).each(function(d){const self=select_default(this),nodeWidth=d.x1-d.x0,nodeHeight=d.y1-d.y0,textNode=self.node(),availableWidth=nodeWidth-8,availableHeight=nodeHe
2ight-8;if(availableWidth<10||availableHeight<10)return void self.style("display","none");let currentLabelFontSize=parseInt(self.style("font-size"),10);for(;textNode.getComputedTextLength()>availableWidth&&currentLabelFontSize>8;)currentLabelFontSize--,self.style("font-size",`${currentLabelFontSize}px`);let prospectiveValueFontSize=Math.max(6,Math.min(28,Math.round(.6*currentLabelFontSize))),combinedHeight=currentLabelFontSize+2+prospectiveValueFontSize;for(;combinedHeight>availableHeight&&currentLabelFontSize>8&&(currentLabelFontSize--,prospectiveValueFontSize=Math.max(6,Math.min(28,Math.round(.6*currentLabelFontSize))),!(prospectiveValueFontSize<6&&8===currentLabelFontSize));)self.style("font-size",`${currentLabelFontSize}px`),combinedHeight=currentLabelFontSize+2+prospectiveValueFontSize;self.style("font-size",`${currentLabelFontSize}px`),(textNode.getComputedTextLength()>availableWidth||currentLabelFontSize<8||availableHeight<currentLabelFontSize)&&self.style("display","none")}),!1!==config.showValues&&cell.append("text").attr("class","treemapValue").attr("x",d=>(d.x1-d.x0)/2).attr("y",function(d){return(d.y1-d.y0)/2}).attr("style",d=>"text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:"+colorScaleLabel(d.data.name)+";"+styles2String({cssCompiledStyles:d.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")).attr("clip-path",(_d,i)=>`url(#clip-${id}-${i})`).text(d=>d.value?valueFormat(d.value):"").each(function(d){const valueTextElement=select_default(this),parentCellNode=this.parentNode;if(!parentCellNode)return void valueTextElement.style("display","none");const labelElement=select_default(parentCellNode).select(".treemapLabel");if(labelElement.empty()||"none"===labelElement.style("display"))return void valueTextElement.style("display","none");const finalLabelFontSize=parseFloat(labelElement.style("font-size")),actualValueFontSize=Math.max(6,Math.min(28,Math.round(.6*finalLabelFontSize)));valueTextElement.style("font-size",`${actualValueFontSize}px`);const valueTopActualY=(d.y1-d.y0)/2+finalLabelFontSize/2+2;valueTextElement.attr("y",valueTopActualY);const nodeWidth=d.x1-d.x0,maxValueBottomY=d.y1-d.y0-4,availableWidthForValue=nodeWidth-8;valueTextElement.node().getComputedTextLength()>availableWidthForValue||valueTopActualY+actualValueFontSize>maxValueBottomY||actualValueFontSize<6?valueTextElement.style("display","none"):valueTextElement.style("display",null)}),setupViewPortForSVG(svg,null!==(_config$diagramPaddin=config.diagramPadding)&&void 0!==_config$diagramPaddin?_config$diagramPaddin:8,"flowchart",(null==config?void 0:config.useMaxWidth)||!1)},"draw"),getClasses:__name(function(_text,diagramObj){return diagramObj.db.getClasses()},"getClasses")},defaultTreemapStyleOptions={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelColor:"black",labelFontSize:"12px",valueFontSize:"10px",valueColor:"black",titleColor:"black",titleFontSize:"14px"},diagram={parser:parser,get db(){return new TreeMapDB},renderer:renderer,styles:__name(({treemap:treemap2}={})=>{const options=cleanAndMerge(defaultTreemapStyleOptions,treemap2);return`\n  .treemapNode.section {\n    stroke: ${options.sectionStrokeColor};\n    stroke-width: ${options.sectionStrokeWidth};\n    fill: ${options.sectionFillColor};\n  }\n  .treemapNode.leaf {\n    stroke: ${options.leafStrokeColor};\n    stroke-width: ${options.leafStrokeWidth};\n    fill: ${options.leafFillColor};\n  }\n  .treemapLabel {\n    fill: ${options.labelColor};\n    font-size: ${options.labelFontSize};\n  }\n  .treemapValue {\n    fill: ${options.valueColor};\n    font-size: ${options.valueFontSize};\n  }\n  .treemapTitle {\n    fill: ${options.titleColor};\n    font-size: ${options.titleFontSize};\n  }\n  `},"getStyles")};export{diagram};
3//# sourceMappingURL=diagram-PSM6KHXK-CR1Zy_da.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.