@zombie-mermaid/svg-renderer 5.9.0 → 5.9.1
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/dist/index.cjs +12 -12
- package/dist/index.js +58 -58
- package/dist/shared/index.d.ts +5 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -56,7 +56,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
|
|
|
56
56
|
`);let i=t.label?e.f` data-label="${(0,e.escapeAttr)(t.label)}"`:``;r.push(e.f`<g class="block" data-type="${(0,e.escapeAttr)(t.type)}"${i}>`),r.push(e.f` <rect x="${t.x}" y="${t.y}" width="${t.width}" height="${t.height}" `+e.f`rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${P.outerBox}" />`);let a=e.f`${t.type}${t.label?e.f` [${t.label}]`:``}`,o=a.split(`
|
|
57
57
|
`)[0],s=D(o,n.edgeLabel,M.groupHeader)+16,c=aa;r.push(e.f` <rect x="${t.x}" y="${t.y}" width="${s}" height="${c}" `+e.f`fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${P.outerBox}" />`),r.push(` `+(0,e.renderMultilineText)(a,t.x+6,t.y+c/2,n.edgeLabel,e.f`font-size="${n.edgeLabel}" font-weight="${M.groupHeader}" fill="var(--_text-sec)"`));for(let i of t.dividers)r.push(e.f` <line x1="${t.x}" y1="${i.y}" x2="${t.x+t.width}" y2="${i.y}" `+`stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`),i.label&&r.push(` `+(0,e.renderMultilineText)(e.f`[${i.label}]`,t.x+8,i.y+14,n.edgeLabel,e.f`font-size="${n.edgeLabel}" text-anchor="start" font-weight="${M.edgeLabel}" fill="var(--_text-muted)"`));return r.push(`</g>`),r.join(`
|
|
58
58
|
`)}function ba(t,n){let{x:r,y:i,width:a,height:o}=t,s=t.actors&&t.actors.length>0?e.f` data-actors="${t.actors.map(e.escapeAttr).join(`,`)}"`:``,c=t.position?e.f` data-position="${(0,e.escapeAttr)(t.position)}"`:``,l=[e.f`${r},${i}`,e.f`${r+a-6},${i}`,e.f`${r+a},${i+6}`,e.f`${r+a},${i+o}`,e.f`${r},${i+o}`].join(` `);return e.f`<g class="note"${c}${s}>`+e.f`\n <polygon points="${l}" `+e.f`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${P.innerBox}" />`+e.f`\n <polygon points="${r+a-6},${i} ${r+a},${i+6} ${r+a-6},${i+6}" `+e.f`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${P.innerBox}" />`+e.f`\n ${(0,e.renderMultilineText)(t.text,r+a/2,i+o/2,n.edgeLabel,e.f`font-size="${n.edgeLabel}" text-anchor="middle" font-weight="${M.edgeLabel}" fill="var(--_text-muted)"`)}`+`
|
|
59
|
-
</g>`}var W={plotWidth:600,plotHeight:340,padding:22,titleFontSize:18,titleFontWeight:600,titleHeight:42,axisLabelFontSize:14,axisLabelFontWeight:400,axisTitleFontSize:15,axisTitleFontWeight:500,xLabelHeight:38,yLabelWidth:58,yLabelGap:18,axisTitlePad:30,tickLength:4,barPadRatio:.2,barGroupGap:0,maxBarWidth:40,legendFontSize:14,legendFontWeight:400,legendHeight:28,legendSwatchW:14,legendSwatchH:14,legendGap:6,legendItemGap:16};function xa(e,t={}){return e.horizontal?Ca(e):Sa(e)}function Sa(t){let n=!!t.title,r=!!t.xAxis.title,i=!!t.yAxis.title,a=t.series.length>1,o=t.yAxis.range;if(!o)throw Error(`XY chart: y-axis range was not set by the parser`);let s=(0,e.niceTickValues)(o.min,o.max),c=ja(s),l=Math.max(...c.map(e=>D(e,W.axisLabelFontSize,W.axisLabelFontWeight)),W.yLabelWidth),u=W.padding+(n?W.titleHeight:0)+(a?W.legendHeight:0),d=W.padding+W.xLabelHeight+(r?W.axisTitlePad:0),f=W.padding+l+W.yLabelGap+(i?W.axisTitlePad:0),p=W.padding,m=W.plotWidth,h=W.plotHeight,g=f+m+p,_=u+h+d,v={x:f,y:u,width:m,height:h},y=wa(t),b=e=>f+(e+.5)*(m/y),x=m/y,S=e=>{let t=(e-o.min)/(o.max-o.min||1);return u+h-t*h},C=Oa(t,b,u+h,x),w=s.map((e,t)=>({label:c[t],x:f,y:S(e),tx:f-W.tickLength,ty:S(e),labelX:f-W.yLabelGap,labelY:S(e),textAnchor:`end`})),T=s.map(e=>({x1:f,y1:S(e),x2:f+m,y2:S(e)})),E=Ta(t,y),O=t.series.map((e,t)=>t),k=ka(t,b,S,x,o.min,E,O),ee=Aa(t,b,S,E,O),A=W.padding+(n?W.titleHeight:0)+W.legendHeight/2,j=a?Na(t,g/2,A,O):[],M={x1:f,y1:u+h,x2:f+m,y2:u+h},te={x1:f,y1:u,x2:f,y2:u+h},ne={ticks:C,line:M,...t.xAxis.title?{title:{text:t.xAxis.title,x:f+m/2,y:_-W.padding}}:{}},N={ticks:w,line:te,...t.yAxis.title?{title:{text:t.yAxis.title,x:W.padding+4,y:u+h/2,rotate:-90}}:{}};return{width:g,height:_,title:t.title?{text:t.title,x:g/2,y:W.padding+W.titleFontSize}:void 0,xAxis:ne,yAxis:N,plotArea:v,bars:k,lines:ee,gridLines:T,legend:j}}function Ca(t){let n=!!t.title,r=!!t.xAxis.title,i=!!t.yAxis.title,a=t.series.length>1,o=t.yAxis.range;if(!o)throw Error(`XY chart: y-axis range was not set by the parser`);let s=(0,e.niceTickValues)(o.min,o.max),c=ja(s),l=wa(t),u=Ta(t,l),d=Math.max(...u.map(e=>D(e,W.axisLabelFontSize,W.axisLabelFontWeight)),40),f=W.padding+(n?W.titleHeight:0)+(a?W.legendHeight:0),p=W.padding+W.xLabelHeight+(i?W.axisTitlePad:0),m=W.padding+d+W.yLabelGap+(r?W.axisTitlePad:0),h=W.padding,g=W.plotWidth,_=W.plotHeight,v=m+g+h,y=f+_+p,b={x:m,y:f,width:g,height:_},x=e=>{let t=(e-o.min)/(o.max-o.min||1);return m+t*g},S=_/l,C=e=>f+(e+.5)*S,w=s.map((e,t)=>({label:c[t],x:x(e),y:f+_,tx:x(e),ty:f+_+W.tickLength,labelX:x(e),labelY:f+_+18,textAnchor:`middle`})),T=u.map((e,t)=>({label:e,x:m,y:C(t),tx:m-W.tickLength,ty:C(t),labelX:m-W.yLabelGap,labelY:C(t),textAnchor:`end`})),E=s.map(e=>({x1:x(e),y1:f,x2:x(e),y2:f+_})),O=t.series.map((e,t)=>t),k=t.series.filter(e=>e.type===`bar`).length,ee=[];if(k>0){let e=S*(1-W.barPadRatio),n=k>1?(e-(k-1)*W.barGroupGap)/k:e,r=Math.min(n,W.maxBarWidth),i=k>1?r*k+W.barGroupGap*(k-1):r,a=0,s=0;for(let e of t.series){if(e.type!==`bar`){s++;continue}for(let t=0;t<e.data.length;t++){let n=C(t)-i/2+a*(r+W.barGroupGap),c=x(Math.max(e.data[t],o.min)),l=x(Math.max(0,o.min));ee.push({x:Math.min(l,c),y:n,width:Math.abs(c-l),height:r,value:e.data[t],label:u[t],seriesIndex:a,colorIndex:O[s]})}a++,s++}}let A=[],j=0,M=0;for(let e of t.series){if(e.type!==`line`){M++;continue}let t=e.data.map((e,t)=>({x:x(e),y:C(t),value:e,label:u[t]}));A.push({points:t,seriesIndex:j,colorIndex:O[M]}),j++,M++}let te={x1:m,y1:f+_,x2:m+g,y2:f+_},ne={x1:m,y1:f,x2:m,y2:f+_},N={ticks:w,line:te,...t.yAxis.title?{title:{text:t.yAxis.title,x:m+g/2,y:y-W.padding}}:{}},P={ticks:T,line:ne,...t.xAxis.title?{title:{text:t.xAxis.title,x:W.padding+4,y:f+_/2,rotate:-90}}:{}},F=t.title?{text:t.title,x:v/2,y:W.padding+W.titleFontSize}:void 0,I=W.padding+(n?W.titleHeight:0)+W.legendHeight/2;return{width:v,height:y,horizontal:!0,title:F,xAxis:N,yAxis:P,plotArea:b,bars:ee,lines:A,gridLines:E,legend:a?Na(t,v/2,I,O):[]}}function wa(e){if(e.xAxis.categories)return e.xAxis.categories.length;for(let t of e.series)if(t.data.length>0)return t.data.length;return 1}function Ta(e,t){if(e.xAxis.categories)return e.xAxis.categories;if(e.xAxis.range){let{min:n,max:r}=e.xAxis.range,i=t>1?(r-n)/(t-1):0;return Array.from({length:t},(e,t)=>Ma(n+i*t))}return Array.from({length:t},(e,t)=>String(t+1))}var Ea=8;function Da(e,t){let n=e.map(e=>D(e,W.axisLabelFontSize,W.axisLabelFontWeight));for(let r=1;r<e.length;r++){let i=!0;for(let a=0;a+r<e.length;a+=r)if(r*t-(n[a]+n[a+r])/2<Ea){i=!1;break}if(i)return r}return Math.max(1,e.length)}function Oa(e,t,n,r){let i=Ta(e,wa(e)),a=Da(i,r);return i.map((e,r)=>({label:r%a===0?e:``,x:t(r),y:n,tx:t(r),ty:n+W.tickLength,labelX:t(r),labelY:n+18,textAnchor:`middle`}))}function ka(e,t,n,r,i,a,o){let s=e.series.filter(e=>e.type===`bar`).length;if(s===0)return[];let c=r*(1-W.barPadRatio),l=s>1?(c-(s-1)*W.barGroupGap)/s:c,u=Math.min(l,W.maxBarWidth),d=s>1?u*s+W.barGroupGap*(s-1):u,f=[],p=0,m=0;for(let r of e.series){if(r.type!==`bar`){m++;continue}for(let e=0;e<r.data.length;e++){let s=t(e)-d/2+p*(u+W.barGroupGap),c=n(r.data[e]),l=n(Math.max(0,i));f.push({x:s,y:Math.min(c,l),width:u,height:Math.abs(l-c),value:r.data[e],label:a[e],seriesIndex:p,colorIndex:o[m]})}p++,m++}return f}function Aa(e,t,n,r,i){let a=[],o=0,s=0;for(let c of e.series){if(c.type!==`line`){s++;continue}let e=c.data.map((e,i)=>({x:t(i),y:n(e),value:e,label:r[i]}));a.push({points:e,seriesIndex:o,colorIndex:i[s]}),o++,s++}return a}function ja(e){let t=e.length>1?Math.abs(e[1]-e[0]):0,n=t>0&&t<1?Math.ceil(-Math.log10(t)-1e-9):0;return e.map(e=>String(Number.isInteger(e)&&n===0?e:Number(e.toFixed(n))))}function Ma(e){return Number.isInteger(e)?String(e):e.toFixed(+(Math.abs(e)<10))}function Na(e,t,n,r){let i=[],a=0,o=0;for(let t=0;t<e.series.length;t++){let s=e.series[t],c=s.type===`bar`?`Bar ${a+1}`:`Line ${o+1}`;i.push({label:c,x:0,y:n,type:s.type,seriesIndex:s.type===`bar`?a:o,colorIndex:r[t]}),s.type===`bar`?a++:o++}let s=i.map(e=>{let t=D(e.label,W.legendFontSize,W.legendFontWeight);return W.legendSwatchW+W.legendGap+t}),c=t-(s.reduce((e,t)=>e+t,0)+(i.length-1)*W.legendItemGap)/2;for(let e=0;e<i.length;e++)i[e].x=c,c+=s[e]+W.legendItemGap;return i}var G={titleSize:18,titleWeight:600,axisTitleSize:15,axisTitleWeight:500,labelSize:14,labelWeight:400,legendSize:14,legendWeight:400,dotRadius:5,lineWidth:2.5,barRadius:8},K={fontSize:15,fontWeight:500,height:32,padX:14,offsetY:12,rx:8,minY:4,pointerSize:6};function Pa(t,n,r=`Inter`,i=!1,a=!1,o,s,c,l={}){let u=[],d=Math.max(0,...t.bars.map(e=>e.colorIndex),...t.lines.map(e=>e.colorIndex)),f=Or((0,e.svgOpenTag)(t.width,t.height,n,i,s,c,void 0,l.styleAttribute,l.description).replace(`<svg `,`<svg data-xychart-colors="${d}" `),o);u.push(f),u.push((0,e.buildStyleBlock)(r,!1,l.nonce,l.bodyFont));let p=Math.max(...t.lines.map(e=>e.points.length),0),m=p>0&&p<=12,{style:h,defs:g}=Fa(t,a,m,n.accent,n.bg,l.nonce);u.push(h),g&&u.push(g);let{plotArea:_}=t,v=t.xAxis.ticks.map(e=>e.x),y=t.horizontal?t.yAxis.ticks.map(e=>e.y):t.gridLines.map(e=>e.y1),b=v.length>1?Math.abs(v[1]-v[0]):_.width/6,x=y.length>1?Math.abs(y[1]-y[0]):_.height/6,S=b/Math.max(1,Math.round(b/20)),C=x/Math.max(1,Math.round(x/20)),w=v[0]??_.x,T=y[0]??_.y,E=w-Math.ceil((w-_.x)/S)*S,D=T-Math.ceil((T-_.y)/C)*C;for(let e=D;e<=_.y+_.height+.5;e+=C)for(let t=E;t<=_.x+_.width+.5;t+=S)u.push(`<circle cx="${q(t)}" cy="${q(e)}" r="1.5" class="xychart-grid"/>`);let O=[];for(let e of t.bars){let n=` data-value="${e.value}"${e.label?` data-label="${J(e.label)}"`:``}`,r=t.horizontal?La(e.x,e.y,e.width,e.height,G.barRadius):Ia(e.x,e.y,e.width,e.height,G.barRadius);if(u.push(`<path d="${r}" class="xychart-bar xychart-color-${e.colorIndex}"${n}/>`),a){let t=Va(e.value),n=e.label?`${e.label}: ${t}`:t,r=Ba(e.x+e.width/2,e.y,t);O.push(`<g class="xychart-bar-group"><rect x="${q(e.x)}" y="${q(e.y)}" width="${q(e.width)}" height="${q(e.height)}" fill="transparent"/><title>${J(n)}</title>`+r+`</g>`)}}for(let e of t.lines){if(e.points.length===0)continue;let t=Ra(e.points);u.push(`<path d="${t}" class="xychart-line-shadow xychart-color-${e.colorIndex}" transform="translate(0,2)"/>`),u.push(`<path d="${t}" class="xychart-line xychart-color-${e.colorIndex}"/>`)}let k=[];if(a||m){let e=new Map;for(let n of t.legend)n.type===`line`&&e.set(n.seriesIndex,n.label);let n=new Map;for(let e of t.lines)for(let t of e.points){let r=q(t.x),i=n.get(r)??[];n.set(r,i),i.push({x:t.x,y:t.y,value:t.value,label:t.label,seriesIndex:e.seriesIndex,colorIndex:e.colorIndex})}for(let t of n.values()){let n=t[0].x,r=t[0].label||``;if(a&&t.length>1){let i=Math.min(...t.map(e=>e.y)),a=Math.max(...t.map(e=>e.y)),o=G.dotRadius*3,s=`<rect x="${q(n-o)}" y="${q(i-o)}" width="${q(o*2)}" height="${q(a-i+o*2)}" fill="transparent" class="xychart-hit"/>`,c=t.map(t=>({text:Va(t.value),legendLabel:e.get(t.seriesIndex)||`Line ${t.seriesIndex+1}`})),l=za(n,i-G.dotRadius,r,c),u=c.map(e=>e.text),d=r?`${r}: ${u.join(` · `)}`:u.join(` · `),f=`<g class="xychart-dot-group">${s}`;for(let e of t){let t=` data-value="${e.value}"${e.label?` data-label="${J(e.label)}"`:``}`;f+=`<circle cx="${q(e.x)}" cy="${q(e.y)}" r="${G.dotRadius}" class="xychart-dot xychart-color-${e.colorIndex}"${t}/>`}f+=`<title>${J(d)}</title>${l}</g>`,k.push(f)}else if(a){let e=t[0],r=` data-value="${e.value}"${e.label?` data-label="${J(e.label)}"`:``}`,i=Va(e.value),a=e.label?`${e.label}: ${i}`:i,o=Ba(n,e.y-G.dotRadius,i),s=m?`<circle cx="${q(n)}" cy="${q(e.y)}" r="${G.dotRadius*3}" fill="transparent" class="xychart-hit"/>`:``;k.push(`<g class="xychart-dot-group">${s}<circle cx="${q(e.x)}" cy="${q(e.y)}" r="${G.dotRadius}" class="xychart-dot xychart-color-${e.colorIndex}"${r}/><title>${J(a)}</title>${o}</g>`)}else for(let e of t){let t=` data-value="${e.value}"${e.label?` data-label="${J(e.label)}"`:``}`;u.push(`<circle cx="${q(e.x)}" cy="${q(e.y)}" r="${G.dotRadius}" class="xychart-dot xychart-color-${e.colorIndex}"${t}/>`)}}}for(let e of t.xAxis.ticks)e.label!==``&&u.push(`<text x="${e.labelX}" y="${e.labelY}" text-anchor="${e.textAnchor}" font-size="${G.labelSize}" font-weight="${G.labelWeight}" dy="${F}" class="xychart-label">${J(e.label)}</text>`);for(let e of t.yAxis.ticks)u.push(`<text x="${e.labelX}" y="${e.labelY}" text-anchor="${e.textAnchor}" font-size="${G.labelSize}" font-weight="${G.labelWeight}" dy="${F}" class="xychart-label">${J(e.label)}</text>`);if(t.xAxis.title){let e=t.xAxis.title,n=e.rotate?` transform="rotate(${e.rotate},${e.x},${e.y})"`:``;u.push(`<text x="${e.x}" y="${e.y}" text-anchor="middle"${n} font-size="${G.axisTitleSize}" font-weight="${G.axisTitleWeight}" dy="${F}" class="xychart-axis-title">${J(e.text)}</text>`)}if(t.yAxis.title){let e=t.yAxis.title,n=e.rotate?` transform="rotate(${e.rotate},${e.x},${e.y})"`:``;u.push(`<text x="${e.x}" y="${e.y}" text-anchor="middle"${n} font-size="${G.axisTitleSize}" font-weight="${G.axisTitleWeight}" dy="${F}" class="xychart-axis-title">${J(e.text)}</text>`)}t.title&&u.push(`<text x="${t.title.x}" y="${t.title.y}" text-anchor="middle" font-size="${G.titleSize}" font-weight="${G.titleWeight}" dy="${F}" class="xychart-title">${J(t.title.text)}</text>`);for(let e of t.legend){if(e.type===`bar`)u.push(`<rect x="${e.x}" y="${e.y-7}" width="14" height="14" rx="3" class="xychart-bar xychart-color-${e.colorIndex}"/>`);else{let t=e.y;u.push(`<line x1="${e.x}" y1="${t}" x2="${e.x+14}" y2="${t}" stroke-width="${G.lineWidth}" stroke-linecap="round" class="xychart-legend-line xychart-color-${e.colorIndex}"/>`)}u.push(`<text x="${e.x+14+6}" y="${e.y}" text-anchor="start" font-size="${G.legendSize}" font-weight="${G.legendWeight}" dy="${F}" class="xychart-label">${J(e.label)}</text>`)}for(let e of O)u.push(e);for(let e of k)u.push(e);return u.push(`</svg>`),u.join(`
|
|
59
|
+
</g>`}var W={plotWidth:600,plotHeight:340,padding:22,titleFontSize:18,titleFontWeight:600,titleHeight:42,axisLabelFontSize:14,axisLabelFontWeight:400,axisTitleFontSize:15,axisTitleFontWeight:500,xLabelHeight:38,yLabelWidth:58,yLabelGap:18,axisTitlePad:30,tickLength:4,barPadRatio:.2,barGroupGap:0,maxBarWidth:40,legendFontSize:14,legendFontWeight:400,legendHeight:28,legendSwatchW:14,legendSwatchH:14,legendGap:6,legendItemGap:16};function xa(e,t={}){return e.horizontal?Ca(e):Sa(e)}function Sa(t){let n=!!t.title,r=!!t.xAxis.title,i=!!t.yAxis.title,a=t.series.length>1,o=t.yAxis.range;if(!o)throw Error(`XY chart: y-axis range was not set by the parser`);let s=(0,e.niceTickValues)(o.min,o.max),c=ja(s),l=Math.max(...c.map(e=>D(e,W.axisLabelFontSize,W.axisLabelFontWeight)),W.yLabelWidth),u=W.padding+(n?W.titleHeight:0)+(a?W.legendHeight:0),d=W.padding+W.xLabelHeight+(r?W.axisTitlePad:0),f=W.padding+l+W.yLabelGap+(i?W.axisTitlePad:0),p=W.padding,m=W.plotWidth,h=W.plotHeight,g=f+m+p,_=u+h+d,v={x:f,y:u,width:m,height:h},y=wa(t),b=e=>f+(e+.5)*(m/y),x=m/y,S=e=>{let t=(e-o.min)/(o.max-o.min||1);return u+h-t*h},C=Oa(t,b,u+h,x),w=s.map((e,t)=>({label:c[t],x:f,y:S(e),tx:f-W.tickLength,ty:S(e),labelX:f-W.yLabelGap,labelY:S(e),textAnchor:`end`})),T=s.map(e=>({x1:f,y1:S(e),x2:f+m,y2:S(e)})),E=Ta(t,y),O=t.series.map((e,t)=>t),k=ka(t,b,S,x,o.min,E,O),ee=Aa(t,b,S,E,O),A=W.padding+(n?W.titleHeight:0)+W.legendHeight/2,j=a?Na(t,g/2,A,O):[],M={x1:f,y1:u+h,x2:f+m,y2:u+h},te={x1:f,y1:u,x2:f,y2:u+h},ne={ticks:C,line:M,...t.xAxis.title?{title:{text:t.xAxis.title,x:f+m/2,y:_-W.padding}}:{}},N={ticks:w,line:te,...t.yAxis.title?{title:{text:t.yAxis.title,x:W.padding+4,y:u+h/2,rotate:-90}}:{}};return{width:g,height:_,title:t.title?{text:t.title,x:g/2,y:W.padding+W.titleFontSize}:void 0,xAxis:ne,yAxis:N,plotArea:v,bars:k,lines:ee,gridLines:T,legend:j}}function Ca(t){let n=!!t.title,r=!!t.xAxis.title,i=!!t.yAxis.title,a=t.series.length>1,o=t.yAxis.range;if(!o)throw Error(`XY chart: y-axis range was not set by the parser`);let s=(0,e.niceTickValues)(o.min,o.max),c=ja(s),l=wa(t),u=Ta(t,l),d=Math.max(...u.map(e=>D(e,W.axisLabelFontSize,W.axisLabelFontWeight)),40),f=W.padding+(n?W.titleHeight:0)+(a?W.legendHeight:0),p=W.padding+W.xLabelHeight+(i?W.axisTitlePad:0),m=W.padding+d+W.yLabelGap+(r?W.axisTitlePad:0),h=Math.max(W.padding,D(c[c.length-1],W.axisLabelFontSize,W.axisLabelFontWeight)/2+4),g=W.plotWidth,_=W.plotHeight,v=m+g+h,y=f+_+p,b={x:m,y:f,width:g,height:_},x=e=>{let t=(e-o.min)/(o.max-o.min||1);return m+t*g},S=_/l,C=e=>f+(e+.5)*S,w=s.map((e,t)=>({label:c[t],x:x(e),y:f+_,tx:x(e),ty:f+_+W.tickLength,labelX:x(e),labelY:f+_+18,textAnchor:`middle`})),T=u.map((e,t)=>({label:e,x:m,y:C(t),tx:m-W.tickLength,ty:C(t),labelX:m-W.yLabelGap,labelY:C(t),textAnchor:`end`})),E=s.map(e=>({x1:x(e),y1:f,x2:x(e),y2:f+_})),O=t.series.map((e,t)=>t),k=t.series.filter(e=>e.type===`bar`).length,ee=[];if(k>0){let e=S*(1-W.barPadRatio),n=k>1?(e-(k-1)*W.barGroupGap)/k:e,r=Math.min(n,W.maxBarWidth),i=k>1?r*k+W.barGroupGap*(k-1):r,a=0,s=0;for(let e of t.series){if(e.type!==`bar`){s++;continue}for(let t=0;t<e.data.length;t++){let n=C(t)-i/2+a*(r+W.barGroupGap),c=x(Math.max(e.data[t],o.min)),l=x(Math.max(0,o.min));ee.push({x:Math.min(l,c),y:n,width:Math.abs(c-l),height:r,value:e.data[t],label:u[t],seriesIndex:a,colorIndex:O[s]})}a++,s++}}let A=[],j=0,M=0;for(let e of t.series){if(e.type!==`line`){M++;continue}let t=e.data.map((e,t)=>({x:x(e),y:C(t),value:e,label:u[t]}));A.push({points:t,seriesIndex:j,colorIndex:O[M]}),j++,M++}let te={x1:m,y1:f+_,x2:m+g,y2:f+_},ne={x1:m,y1:f,x2:m,y2:f+_},N={ticks:w,line:te,...t.yAxis.title?{title:{text:t.yAxis.title,x:m+g/2,y:y-W.padding}}:{}},P={ticks:T,line:ne,...t.xAxis.title?{title:{text:t.xAxis.title,x:W.padding+4,y:f+_/2,rotate:-90}}:{}},F=t.title?{text:t.title,x:v/2,y:W.padding+W.titleFontSize}:void 0,I=W.padding+(n?W.titleHeight:0)+W.legendHeight/2;return{width:v,height:y,horizontal:!0,title:F,xAxis:N,yAxis:P,plotArea:b,bars:ee,lines:A,gridLines:E,legend:a?Na(t,v/2,I,O):[]}}function wa(e){if(e.xAxis.categories)return e.xAxis.categories.length;for(let t of e.series)if(t.data.length>0)return t.data.length;return 1}function Ta(e,t){if(e.xAxis.categories)return e.xAxis.categories;if(e.xAxis.range){let{min:n,max:r}=e.xAxis.range,i=t>1?(r-n)/(t-1):0;return Array.from({length:t},(e,t)=>Ma(n+i*t))}return Array.from({length:t},(e,t)=>String(t+1))}var Ea=8;function Da(e,t){let n=e.map(e=>D(e,W.axisLabelFontSize,W.axisLabelFontWeight));for(let r=1;r<e.length;r++){let i=!0;for(let a=0;a+r<e.length;a+=r)if(r*t-(n[a]+n[a+r])/2<Ea){i=!1;break}if(i)return r}return Math.max(1,e.length)}function Oa(e,t,n,r){let i=Ta(e,wa(e)),a=Da(i,r);return i.map((e,r)=>({label:r%a===0?e:``,x:t(r),y:n,tx:t(r),ty:n+W.tickLength,labelX:t(r),labelY:n+18,textAnchor:`middle`}))}function ka(e,t,n,r,i,a,o){let s=e.series.filter(e=>e.type===`bar`).length;if(s===0)return[];let c=r*(1-W.barPadRatio),l=s>1?(c-(s-1)*W.barGroupGap)/s:c,u=Math.min(l,W.maxBarWidth),d=s>1?u*s+W.barGroupGap*(s-1):u,f=[],p=0,m=0;for(let r of e.series){if(r.type!==`bar`){m++;continue}for(let e=0;e<r.data.length;e++){let s=t(e)-d/2+p*(u+W.barGroupGap),c=n(r.data[e]),l=n(Math.max(0,i));f.push({x:s,y:Math.min(c,l),width:u,height:Math.abs(l-c),value:r.data[e],label:a[e],seriesIndex:p,colorIndex:o[m]})}p++,m++}return f}function Aa(e,t,n,r,i){let a=[],o=0,s=0;for(let c of e.series){if(c.type!==`line`){s++;continue}let e=c.data.map((e,i)=>({x:t(i),y:n(e),value:e,label:r[i]}));a.push({points:e,seriesIndex:o,colorIndex:i[s]}),o++,s++}return a}function ja(e){let t=e.length>1?Math.abs(e[1]-e[0]):0,n=t>0&&t<1?Math.ceil(-Math.log10(t)-1e-9):0;return e.map(e=>String(Number.isInteger(e)&&n===0?e:Number(e.toFixed(n))))}function Ma(e){return Number.isInteger(e)?String(e):e.toFixed(+(Math.abs(e)<10))}function Na(e,t,n,r){let i=[],a=0,o=0;for(let t=0;t<e.series.length;t++){let s=e.series[t],c=s.type===`bar`?`Bar ${a+1}`:`Line ${o+1}`;i.push({label:c,x:0,y:n,type:s.type,seriesIndex:s.type===`bar`?a:o,colorIndex:r[t]}),s.type===`bar`?a++:o++}let s=i.map(e=>{let t=D(e.label,W.legendFontSize,W.legendFontWeight);return W.legendSwatchW+W.legendGap+t}),c=t-(s.reduce((e,t)=>e+t,0)+(i.length-1)*W.legendItemGap)/2;for(let e=0;e<i.length;e++)i[e].x=c,c+=s[e]+W.legendItemGap;return i}var G={titleSize:18,titleWeight:600,axisTitleSize:15,axisTitleWeight:500,labelSize:14,labelWeight:400,legendSize:14,legendWeight:400,dotRadius:5,lineWidth:2.5,barRadius:8},K={fontSize:15,fontWeight:500,height:32,padX:14,offsetY:12,rx:8,minY:4,pointerSize:6};function Pa(t,n,r=`Inter`,i=!1,a=!1,o,s,c,l={}){let u=[],d=Math.max(0,...t.bars.map(e=>e.colorIndex),...t.lines.map(e=>e.colorIndex)),f=Or((0,e.svgOpenTag)(t.width,t.height,n,i,s,c,void 0,l.styleAttribute,l.description).replace(`<svg `,`<svg data-xychart-colors="${d}" `),o);u.push(f),u.push((0,e.buildStyleBlock)(r,!1,l.nonce,l.bodyFont));let p=Math.max(...t.lines.map(e=>e.points.length),0),m=p>0&&p<=12,{style:h,defs:g}=Fa(t,a,m,n.accent,n.bg,l.nonce);u.push(h),g&&u.push(g);let{plotArea:_}=t,v=t.xAxis.ticks.map(e=>e.x),y=t.horizontal?t.yAxis.ticks.map(e=>e.y):t.gridLines.map(e=>e.y1),b=v.length>1?Math.abs(v[1]-v[0]):_.width/6,x=y.length>1?Math.abs(y[1]-y[0]):_.height/6,S=b/Math.max(1,Math.round(b/20)),C=x/Math.max(1,Math.round(x/20)),w=v[0]??_.x,T=y[0]??_.y,E=w-Math.ceil((w-_.x)/S)*S,D=T-Math.ceil((T-_.y)/C)*C;for(let e=D;e<=_.y+_.height+.5;e+=C)for(let t=E;t<=_.x+_.width+.5;t+=S)u.push(`<circle cx="${q(t)}" cy="${q(e)}" r="1.5" class="xychart-grid"/>`);let O=[];for(let e of t.bars){let n=` data-value="${e.value}"${e.label?` data-label="${J(e.label)}"`:``}`,r=t.horizontal?La(e.x,e.y,e.width,e.height,G.barRadius):Ia(e.x,e.y,e.width,e.height,G.barRadius);if(u.push(`<path d="${r}" class="xychart-bar xychart-color-${e.colorIndex}"${n}/>`),a){let t=Ha(e.value),n=e.label?`${e.label}: ${t}`:t,r=Va(e.x+e.width/2,e.y,t);O.push(`<g class="xychart-bar-group"><rect x="${q(e.x)}" y="${q(e.y)}" width="${q(e.width)}" height="${q(e.height)}" fill="transparent"/><title>${J(n)}</title>`+r+`</g>`)}}for(let e of t.lines){if(e.points.length===0)continue;let n=t.horizontal?Ra(e.points):za(e.points);u.push(`<path d="${n}" class="xychart-line-shadow xychart-color-${e.colorIndex}" transform="translate(0,2)"/>`),u.push(`<path d="${n}" class="xychart-line xychart-color-${e.colorIndex}"/>`)}let k=[];if(a||m){let e=new Map;for(let n of t.legend)n.type===`line`&&e.set(n.seriesIndex,n.label);let n=new Map;for(let e of t.lines)for(let t of e.points){let r=q(t.x),i=n.get(r)??[];n.set(r,i),i.push({x:t.x,y:t.y,value:t.value,label:t.label,seriesIndex:e.seriesIndex,colorIndex:e.colorIndex})}for(let t of n.values()){let n=t[0].x,r=t[0].label||``;if(a&&t.length>1){let i=Math.min(...t.map(e=>e.y)),a=Math.max(...t.map(e=>e.y)),o=G.dotRadius*3,s=`<rect x="${q(n-o)}" y="${q(i-o)}" width="${q(o*2)}" height="${q(a-i+o*2)}" fill="transparent" class="xychart-hit"/>`,c=t.map(t=>({text:Ha(t.value),legendLabel:e.get(t.seriesIndex)||`Line ${t.seriesIndex+1}`})),l=Ba(n,i-G.dotRadius,r,c),u=c.map(e=>e.text),d=r?`${r}: ${u.join(` · `)}`:u.join(` · `),f=`<g class="xychart-dot-group">${s}`;for(let e of t){let t=` data-value="${e.value}"${e.label?` data-label="${J(e.label)}"`:``}`;f+=`<circle cx="${q(e.x)}" cy="${q(e.y)}" r="${G.dotRadius}" class="xychart-dot xychart-color-${e.colorIndex}"${t}/>`}f+=`<title>${J(d)}</title>${l}</g>`,k.push(f)}else if(a){let e=t[0],r=` data-value="${e.value}"${e.label?` data-label="${J(e.label)}"`:``}`,i=Ha(e.value),a=e.label?`${e.label}: ${i}`:i,o=Va(n,e.y-G.dotRadius,i),s=m?`<circle cx="${q(n)}" cy="${q(e.y)}" r="${G.dotRadius*3}" fill="transparent" class="xychart-hit"/>`:``;k.push(`<g class="xychart-dot-group">${s}<circle cx="${q(e.x)}" cy="${q(e.y)}" r="${G.dotRadius}" class="xychart-dot xychart-color-${e.colorIndex}"${r}/><title>${J(a)}</title>${o}</g>`)}else for(let e of t){let t=` data-value="${e.value}"${e.label?` data-label="${J(e.label)}"`:``}`;u.push(`<circle cx="${q(e.x)}" cy="${q(e.y)}" r="${G.dotRadius}" class="xychart-dot xychart-color-${e.colorIndex}"${t}/>`)}}}for(let e of t.xAxis.ticks)e.label!==``&&u.push(`<text x="${e.labelX}" y="${e.labelY}" text-anchor="${e.textAnchor}" font-size="${G.labelSize}" font-weight="${G.labelWeight}" dy="${F}" class="xychart-label">${J(e.label)}</text>`);for(let e of t.yAxis.ticks)u.push(`<text x="${e.labelX}" y="${e.labelY}" text-anchor="${e.textAnchor}" font-size="${G.labelSize}" font-weight="${G.labelWeight}" dy="${F}" class="xychart-label">${J(e.label)}</text>`);if(t.xAxis.title){let e=t.xAxis.title,n=e.rotate?` transform="rotate(${e.rotate},${e.x},${e.y})"`:``;u.push(`<text x="${e.x}" y="${e.y}" text-anchor="middle"${n} font-size="${G.axisTitleSize}" font-weight="${G.axisTitleWeight}" dy="${F}" class="xychart-axis-title">${J(e.text)}</text>`)}if(t.yAxis.title){let e=t.yAxis.title,n=e.rotate?` transform="rotate(${e.rotate},${e.x},${e.y})"`:``;u.push(`<text x="${e.x}" y="${e.y}" text-anchor="middle"${n} font-size="${G.axisTitleSize}" font-weight="${G.axisTitleWeight}" dy="${F}" class="xychart-axis-title">${J(e.text)}</text>`)}t.title&&u.push(`<text x="${t.title.x}" y="${t.title.y}" text-anchor="middle" font-size="${G.titleSize}" font-weight="${G.titleWeight}" dy="${F}" class="xychart-title">${J(t.title.text)}</text>`);for(let e of t.legend){if(e.type===`bar`)u.push(`<rect x="${e.x}" y="${e.y-7}" width="14" height="14" rx="3" class="xychart-bar xychart-color-${e.colorIndex}"/>`);else{let t=e.y;u.push(`<line x1="${e.x}" y1="${t}" x2="${e.x+14}" y2="${t}" stroke-width="${G.lineWidth}" stroke-linecap="round" class="xychart-legend-line xychart-color-${e.colorIndex}"/>`)}u.push(`<text x="${e.x+14+6}" y="${e.y}" text-anchor="start" font-size="${G.legendSize}" font-weight="${G.legendWeight}" dy="${F}" class="xychart-label">${J(e.label)}</text>`)}for(let e of O)u.push(e);for(let e of k)u.push(e);return u.push(`</svg>`),u.join(`
|
|
60
60
|
`)}function Fa(n,r,i,a,o,s){let c=a??t.CHART_ACCENT_FALLBACK,l=new Set;for(let e of n.bars)l.add(e.colorIndex);for(let e of n.lines)l.add(e.colorIndex);let u=[];for(let e of[...l].sort((e,t)=>e-t)){let n=e===0?`var(--accent, ${t.CHART_ACCENT_FALLBACK})`:(0,t.getSeriesColor)(e,c,o);u.push(` --xychart-color-${e}: ${n};`),u.push(` --xychart-bar-fill-${e}: color-mix(in srgb, var(--bg) 75%, var(--xychart-color-${e}) 25%);`)}let d=[];for(let e of[...l].sort((e,t)=>e-t)){let t=`var(--xychart-color-${e})`;d.push(` .xychart-bar.xychart-color-${e} { stroke: ${t}; fill: var(--xychart-bar-fill-${e}); }`),d.push(` path.xychart-color-${e}, line.xychart-color-${e} { stroke: ${t}; }`),d.push(` circle.xychart-color-${e} { fill: ${t}; }`)}let f=r?`
|
|
61
61
|
.xychart-tip { opacity: 0; pointer-events: none; }
|
|
62
62
|
.xychart-tip-bg { fill: var(--_text); filter: drop-shadow(0 1px 3px color-mix(in srgb, var(--fg) 20%, transparent)); }
|
|
@@ -75,7 +75,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
|
|
|
75
75
|
.xychart-title { fill: var(--_text); }${p}
|
|
76
76
|
${d.join(`
|
|
77
77
|
`)}${f}
|
|
78
|
-
</style>`,defs:``}}function Ia(e,t,n,r,i){let a=Math.min(i,n/2,r/2);return a<=0?`M${q(e)},${q(t)} h${q(n)} v${q(r)} h${q(-n)} Z`:[`M${q(e)},${q(t+a)}`,`Q${q(e)},${q(t)} ${q(e+a)},${q(t)}`,`L${q(e+n-a)},${q(t)}`,`Q${q(e+n)},${q(t)} ${q(e+n)},${q(t+a)}`,`L${q(e+n)},${q(t+r-a)}`,`Q${q(e+n)},${q(t+r)} ${q(e+n-a)},${q(t+r)}`,`L${q(e+a)},${q(t+r)}`,`Q${q(e)},${q(t+r)} ${q(e)},${q(t+r-a)}`,`Z`].join(` `)}function La(e,t,n,r,i){let a=Math.min(i,n/2,r/2);return a<=0?`M${q(e)},${q(t)} h${q(n)} v${q(r)} h${q(-n)} Z`:[`M${q(e+a)},${q(t)}`,`L${q(e+n-a)},${q(t)}`,`Q${q(e+n)},${q(t)} ${q(e+n)},${q(t+a)}`,`L${q(e+n)},${q(t+r-a)}`,`Q${q(e+n)},${q(t+r)} ${q(e+n-a)},${q(t+r)}`,`L${q(e+a)},${q(t+r)}`,`Q${q(e)},${q(t+r)} ${q(e)},${q(t+r-a)}`,`L${q(e)},${q(t+a)}`,`Q${q(e)},${q(t)} ${q(e+a)},${q(t)}`,`Z`].join(` `)}function Ra(e){if(e.length===0)return``;if(e.length===1)return`M${q(e[0].x)},${q(e[0].y)}`;if(e.length===2)return`M${q(e[0].x)},${q(e[0].y)} L${q(e[1].x)},${q(e[1].y)}`;let t=e.length,n=[],r=[];for(let i=0;i<t-1;i++)n.push(e[i+1].x-e[i].x),r.push(n[i]===0?0:(e[i+1].y-e[i].y)/n[i]);let i=Array(t).fill(0);for(let e=1;e<t-1;e++){let t=r[e-1],a=r[e];if(t*a<=0)continue;let o=2*n[e]+n[e-1],s=n[e]+2*n[e-1];i[e]=(o+s)/(o/t+s/a)}let a=(e,t,n,r)=>{let i=((2*e+t)*n-e*r)/(e+t);return i*n<=0?i=0:n*r<=0&&Math.abs(i)>3*Math.abs(n)&&(i=3*n),i};i[0]=a(n[0],n[1],r[0],r[1]),i[t-1]=a(n[t-2],n[t-3],r[t-2],r[t-3]);let o=`M${q(e[0].x)},${q(e[0].y)}`;for(let r=0;r<t-1;r++){let t=n[r]/3,a=e[r].x+t,s=e[r].y+i[r]*t,c=e[r+1].x-t,l=e[r+1].y-i[r+1]*t;o+=` C${q(a)},${q(s)} ${q(c)},${q(l)} ${q(e[r+1].x)},${q(e[r+1].y)}`}return o}function
|
|
78
|
+
</style>`,defs:``}}function Ia(e,t,n,r,i){let a=Math.min(i,n/2,r/2);return a<=0?`M${q(e)},${q(t)} h${q(n)} v${q(r)} h${q(-n)} Z`:[`M${q(e)},${q(t+a)}`,`Q${q(e)},${q(t)} ${q(e+a)},${q(t)}`,`L${q(e+n-a)},${q(t)}`,`Q${q(e+n)},${q(t)} ${q(e+n)},${q(t+a)}`,`L${q(e+n)},${q(t+r-a)}`,`Q${q(e+n)},${q(t+r)} ${q(e+n-a)},${q(t+r)}`,`L${q(e+a)},${q(t+r)}`,`Q${q(e)},${q(t+r)} ${q(e)},${q(t+r-a)}`,`Z`].join(` `)}function La(e,t,n,r,i){let a=Math.min(i,n/2,r/2);return a<=0?`M${q(e)},${q(t)} h${q(n)} v${q(r)} h${q(-n)} Z`:[`M${q(e+a)},${q(t)}`,`L${q(e+n-a)},${q(t)}`,`Q${q(e+n)},${q(t)} ${q(e+n)},${q(t+a)}`,`L${q(e+n)},${q(t+r-a)}`,`Q${q(e+n)},${q(t+r)} ${q(e+n-a)},${q(t+r)}`,`L${q(e+a)},${q(t+r)}`,`Q${q(e)},${q(t+r)} ${q(e)},${q(t+r-a)}`,`L${q(e)},${q(t+a)}`,`Q${q(e)},${q(t)} ${q(e+a)},${q(t)}`,`Z`].join(` `)}function Ra(e){return e.map((e,t)=>`${t===0?`M`:`L`}${q(e.x)},${q(e.y)}`).join(` `)}function za(e){if(e.length===0)return``;if(e.length===1)return`M${q(e[0].x)},${q(e[0].y)}`;if(e.length===2)return`M${q(e[0].x)},${q(e[0].y)} L${q(e[1].x)},${q(e[1].y)}`;let t=e.length,n=[],r=[];for(let i=0;i<t-1;i++)n.push(e[i+1].x-e[i].x),r.push(n[i]===0?0:(e[i+1].y-e[i].y)/n[i]);let i=Array(t).fill(0);for(let e=1;e<t-1;e++){let t=r[e-1],a=r[e];if(t*a<=0)continue;let o=2*n[e]+n[e-1],s=n[e]+2*n[e-1];i[e]=(o+s)/(o/t+s/a)}let a=(e,t,n,r)=>{let i=((2*e+t)*n-e*r)/(e+t);return i*n<=0?i=0:n*r<=0&&Math.abs(i)>3*Math.abs(n)&&(i=3*n),i};i[0]=a(n[0],n[1],r[0],r[1]),i[t-1]=a(n[t-2],n[t-3],r[t-2],r[t-3]);let o=`M${q(e[0].x)},${q(e[0].y)}`;for(let r=0;r<t-1;r++){let t=n[r]/3,a=e[r].x+t,s=e[r].y+i[r]*t,c=e[r+1].x-t,l=e[r+1].y-i[r+1]*t;o+=` C${q(a)},${q(s)} ${q(c)},${q(l)} ${q(e[r+1].x)},${q(e[r+1].y)}`}return o}function Ba(e,t,n,r){let i=D(n,K.fontSize,600),a=Math.max(...r.map(e=>{let t=D(e.legendLabel,K.fontSize,K.fontWeight),n=D(e.text,K.fontSize,K.fontWeight);return t+10+n})),o=Math.max(i,a)+K.padX*2,s=26+r.length*20+6,c=Math.max(K.minY,t-K.offsetY-s-K.pointerSize),l=e-o/2,u=e,d=c+s,f=K.pointerSize,p=`<polygon points="${q(u-f)},${q(d)} ${q(u+f)},${q(d)} ${q(u)},${q(d+f)}" class="xychart-tip xychart-tip-ptr"/>`,m=`<rect x="${q(l)}" y="${q(c)}" width="${q(o)}" height="${s}" rx="${K.rx}" class="xychart-tip xychart-tip-bg"/>`;m+=p;let h=c+6+10;m+=`<text x="${q(e)}" y="${q(h)}" text-anchor="middle" font-weight="600" font-size="${K.fontSize}" dy="${F}" class="xychart-tip xychart-tip-text">${J(n)}</text>`;let g=l+K.padX,_=l+o-K.padX;for(let e of r)h+=20,m+=`<text x="${q(g)}" y="${q(h)}" text-anchor="start" font-size="${K.fontSize}" font-weight="${K.fontWeight}" dy="${F}" class="xychart-tip xychart-tip-text">${J(e.legendLabel)}</text>`,m+=`<text x="${q(_)}" y="${q(h)}" text-anchor="end" font-size="${K.fontSize}" font-weight="${K.fontWeight}" dy="${F}" class="xychart-tip xychart-tip-text">${J(e.text)}</text>`;return m}function Va(e,t,n){let r=D(n,K.fontSize,K.fontWeight)+K.padX*2,i=K.height,a=Math.max(K.minY,t-K.offsetY-i-K.pointerSize),o=e-r/2,s=e,c=a+i/2,l=e,u=a+i,d=K.pointerSize,f=`<polygon points="${q(l-d)},${q(u)} ${q(l+d)},${q(u)} ${q(l)},${q(u+d)}" class="xychart-tip xychart-tip-ptr"/>`;return`<rect x="${q(o)}" y="${q(a)}" width="${q(r)}" height="${i}" rx="${K.rx}" class="xychart-tip xychart-tip-bg"/>`+f+`<text x="${q(s)}" y="${q(c)}" text-anchor="middle" dy="${F}" class="xychart-tip xychart-tip-text">${J(n)}</text>`}function Ha(e){return Number.isInteger(e)?e.toLocaleString(`en-US`):e.toFixed(+(Math.abs(e)<10))}function q(e){return String(Math.round(e*10)/10)}function J(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}var Y={height:450,margin:40,legendRectSize:18,legendSpacing:4,textPosition:.75,outerStrokeWidth:2,titleFontSize:25,sectionFontSize:17,legendFontSize:17,fontWeight:400,paletteSize:12,highlightScale:1.05,minPercent:1},Ua=Math.PI*2;function X(e){return String(Math.round(e*100)/100)}function Wa(e,t,n,r){return{x:e+n*Math.sin(r),y:t-n*Math.cos(r)}}function Ga(e,t,n,r,i,a=0){if(i-r>=Ua-1e-9){let r=(n,r)=>`M${X(e)},${X(t-n)}A${X(n)},${X(n)},0,1,${r},${X(e)},${X(t+n)}A${X(n)},${X(n)},0,1,${r},${X(e)},${X(t-n)}`;return r(n,1)+(a>0?r(a,0):``)+`Z`}let o=Wa(e,t,n,r),s=Wa(e,t,n,i),c=+(i-r>Math.PI),l=`M${X(o.x)},${X(o.y)}A${X(n)},${X(n)},0,${c},1,${X(s.x)},${X(s.y)}`;if(a<=0)return`${l}L${X(e)},${X(t)}Z`;let u=Wa(e,t,a,i),d=Wa(e,t,a,r);return`${l}L${X(u.x)},${X(u.y)}A${X(a)},${X(a)},0,${c},0,${X(d.x)},${X(d.y)}Z`}function Ka(e,t,n){return n?`${e} [${String(t)}]`:e}function qa(e,t={}){let n=Y.height,r=n,i=Math.min(r,n)/2-Y.margin,a=r/2,o=n/2,s=e.slices.reduce((e,t)=>e+t.value,0),c=e.slices.map((e,t)=>({slice:e,colorIndex:t%Y.paletteSize})).filter(({slice:e})=>e.value/s*100>=Y.minPercent),l=c.reduce((e,t)=>e+t.slice.value,0),u=Y.legendRectSize+Y.legendSpacing,d=e.slices.length,f=d>0?e.legendPosition??`right`:`right`,p=e.slices.map(t=>Ka(t.label,t.value,e.showData)),m=Math.max(0,...p.map(e=>D(e,Y.legendFontSize,Y.fontWeight))),h=Y.legendRectSize+Y.legendSpacing,g=u*d,_=f===`left`?m+h:0,v=f===`top`?g+u:0,y=a-m/2-h,b=o-g/2,x={right:{x:a+12*Y.legendRectSize,y:b},left:{x:a-i-h,y:b},center:{x:y,y:b},top:{x:y,y:o-i},bottom:{x:y,y:o+i+u}}[f],S=h+m,C=d>0&&(f===`left`||f===`right`)?r+Y.margin+S:r+Y.margin,w=f===`top`||f===`bottom`?n+g:n,T=e.title??``,E=T.length>0?D(T,Y.titleFontSize,Y.fontWeight):0,O=a-E/2,k=a+E/2,ee=x.x,A=x.x+S,j=x.y,M=x.y+g-u+Y.legendRectSize,te=Math.min(0,O,d>0?ee:0),ne=Math.max(C,k,d>0?A:0),N=d>0?Math.min(0,j):0,P=d>0?Math.max(w,M):n,F=-te,I=-N,L=a+_+F,R=o+v+I,re=[],ie=0,ae=e.donutHole??0,oe=ae>0&&ae<=.9?ae*i:0,se=i*(e.textPosition??Y.textPosition);for(let{slice:t,colorIndex:n}of c){let r=ie,a=ie+t.value/l*Ua;ie=a;let o=Wa(L,R,se,(r+a)/2),c=e.highlightSlice!==void 0&&e.highlightSlice!==`hover`&&e.highlightSlice!==``&&e.highlightSlice===t.label,u=c?Y.highlightScale:1;re.push({label:t.label,value:t.value,colorIndex:n,startAngle:r,endAngle:a,path:Ga(L,R,i*u,r,a,oe*u),percentText:`${(t.value/s*100).toFixed(0)}%`,labelX:o.x,labelY:o.y,...c?{highlighted:c}:{}})}let ce=p.map((e,t)=>{let n=x.x+F,r=x.y+t*u+I;return{text:e,colorIndex:t%Y.paletteSize,x:n,y:r,size:Y.legendRectSize,textX:n+Y.legendRectSize+Y.legendSpacing,textY:r+Y.legendRectSize-Y.legendSpacing}});return{width:Math.ceil(ne-te),height:Math.ceil(P-N),cx:L,cy:R,radius:i,outerRadius:i+Y.outerStrokeWidth/2,title:T.length>0?{text:T,x:a+F,y:o+I-(n-50)/2}:void 0,slices:re,legend:ce,accTitle:e.accTitle,accDescr:e.accDescr,sliceColors:e.sliceColors}}function Z(e){return String(Math.round(e*100)/100)}function Ja(e,n,r){return e===0?`var(--accent, ${t.CHART_ACCENT_FALLBACK})`:(0,t.getSeriesColor)(e,n??t.CHART_ACCENT_FALLBACK,r)}function Ya(t,n,r){let i=new Set;for(let e of t.slices)i.add(e.colorIndex);for(let e of t.legend)i.add(e.colorIndex);let a=[...i].sort((e,t)=>e-t),o=a.map(e=>` --pie-color-${e}: ${t.sliceColors?.[e]??Ja(e,n.accent,n.bg)};`),s=a.map(e=>` .pie-color-${e} { fill: var(--pie-color-${e}); }\n rect.pie-color-${e} { stroke: var(--pie-color-${e}); }`),c=t.slices.some(e=>e.highlighted)?`
|
|
79
79
|
.pie-slice.pie-highlight { opacity: 1; }`:``,l=o.length>0?`\n svg {\n${o.join(`
|
|
80
80
|
`)}\n }`:``;return`${(0,e.styleOpenTag)(r)}
|
|
81
81
|
.pie-outer { fill: none; stroke: var(--fg); stroke-width: ${Y.outerStrokeWidth}px; }
|
|
@@ -85,13 +85,13 @@ ${d.join(`
|
|
|
85
85
|
.pie-legend-text { fill: var(--_text); font-size: ${Y.legendFontSize}px; font-weight: ${Y.fontWeight}; }${l}
|
|
86
86
|
${s.join(`
|
|
87
87
|
`)}
|
|
88
|
-
</style>`}function
|
|
89
|
-
`)}var
|
|
90
|
-
`)){let e=``;for(let a of i.split(/\s+/).filter(Boolean)){let i=e?`${e} ${a}`:a;e&&$(i,n,400)>t?(r.push(e),e=a):e=i}r.push(e)}return r}function
|
|
91
|
-
`)]);
|
|
92
|
-
`);if(n.has(a))return;n.add(a);let o=Math.max(...i.map(e=>$(e,Q.messageSize,400)));h.push({variant:{lines:[...i,...t],position:{x:m+o/2,y:s.y}},cost:25*(r+1)})})}let g=u===0?0:c/u,_=u===0?0:l/u,v=u/2+Math.max(...
|
|
93
|
-
`)}function
|
|
94
|
-
`)}function
|
|
95
|
-
`)}function
|
|
96
|
-
`)}function
|
|
97
|
-
`)}var
|
|
88
|
+
</style>`}function Xa(t,n,r=`Inter`,i=!1,a,o,s,c={}){let l=[];l.push(Or((0,e.svgOpenTag)(t.width,t.height,n,i,o??t.accTitle,s,void 0,c.styleAttribute,t.accDescr),a)),l.push((0,e.buildStyleBlock)(r,!1,c.nonce,c.bodyFont)),l.push(Ya(t,n,c.nonce)),l.push(`<circle cx="${Z(t.cx)}" cy="${Z(t.cy)}" r="${Z(t.outerRadius)}" class="pie-outer"/>`);for(let n of t.slices)l.push(`<path d="${n.path}" class="pie-slice${n.highlighted?` pie-highlight`:``} pie-color-${n.colorIndex}" data-label="${(0,e.escapeAttr)(n.label)}" data-value="${n.value}"/>`);for(let n of t.slices)l.push(`<text x="${Z(n.labelX)}" y="${Z(n.labelY)}" text-anchor="middle" class="pie-slice-label">${(0,e.escapeXml)(n.percentText)}</text>`);t.title&&l.push(`<text x="${Z(t.title.x)}" y="${Z(t.title.y)}" text-anchor="middle" class="pie-title">${(0,e.escapeXml)(t.title.text)}</text>`);for(let n of t.legend)l.push(`<g class="pie-legend"><rect x="${Z(n.x)}" y="${Z(n.y)}" width="${n.size}" height="${n.size}" class="pie-legend-swatch pie-color-${n.colorIndex}"/><text x="${Z(n.textX)}" y="${Z(n.textY)}" class="pie-legend-text">${(0,e.escapeXml)(n.text)}</text></g>`);return l.push(`</svg>`),l.join(`
|
|
89
|
+
`)}var Za=2048,Qa=[569,569,727,1139,1139,1821,1366,391,682,682,797,1196,569,682,569,569,1139,1139,1139,1139,1139,1139,1139,1139,1139,1139,569,569,1196,1196,1196,1139,2079,1366,1366,1479,1479,1366,1251,1593,1479,569,1024,1366,1139,1706,1479,1593,1366,1593,1479,1366,1251,1479,1366,1933,1366,1366,1251,569,569,569,961,1139,682,1139,1139,1024,1139,1139,569,1139,1139,455,455,1024,455,1706,1139,1139,1139,1139,682,1024,569,1139,1024,1479,1024,1024,1024,684,532,684,1196],$a=[569,682,971,1139,1139,1821,1479,487,682,682,797,1196,569,682,569,569,1139,1139,1139,1139,1139,1139,1139,1139,1139,1139,682,682,1196,1196,1196,1251,1992,1479,1479,1479,1479,1366,1251,1593,1479,569,1139,1479,1251,1706,1479,1593,1366,1593,1479,1366,1251,1479,1366,1933,1366,1366,1251,682,569,682,1196,1139,682,1139,1251,1139,1251,1139,682,1251,1251,569,569,1139,569,1821,1251,1251,1251,1251,797,1139,682,1251,1139,1593,1139,1139,1024,801,573,801,1196];function eo(e,t){let n=e.codePointAt(0);if(!(n<32||n>126))return(t?$a:Qa)[n-32]/Za}var Q={width:216,diagramMarginX:50,diagramMarginY:10,shapeMargin:50,shapePadding:20,shapeInRow:4,boundaryInRow:2,nextLinePaddingX:0,screenWidth:1440,nameSize:14,typeSize:10.5,descrSize:11.5,messageSize:12,boundarySize:14,nameLine:15.35,typeLine:15.72,descrLine:17.1,descrExtraLine:12.48,textScale:.922,boundaryLabelHeight:18,boundaryTypeHeight:16.1,boundaryDescrHeight:14.4,rootHeadingHeight:47,titleExtra:60,cornerRadius:12,strokeWidth:2,personRx:.177,personRxMaxOfHeight:.45,personHeadRatio:.23,personHeadMin:16,personHeadMax:56,personHeadOverlap:.27,dbTrim:3.91,queueExtra:10},to=Q.width-2*Q.shapePadding;function no(e,t,n){let r=[];for(let i of e.split(`
|
|
90
|
+
`)){let e=``;for(let a of i.split(/\s+/).filter(Boolean)){let i=e?`${e} ${a}`:a;e&&$(i,n,400)>t?(r.push(e),e=a):e=i}r.push(e)}return r}function ro(e,t){let n=Math.min(Math.max(e*Q.personHeadRatio,Q.personHeadMin),Q.personHeadMax),r=n*(2-Q.personHeadOverlap),i=t===void 0?1/0:t-r;return{rx:Math.min(e*Q.personRx,i*Q.personRxMaxOfHeight),headRadius:n,pillTop:r}}function io(e,t){return e*Q.nameLine+Q.typeLine+ao(t)}function ao(e){return e===0?0:Q.descrLine+(e-1)*Q.descrExtraLine}function oo(e){let t=e/2;return{rx:t,ry:t/(2.5+e/50)}}function so(e){let t=e/2;return{rx:t/(2.5+e/50),ry:t}}function $(e,t,n){let r=0;for(let i of e){let e=eo(i,n>=600);r+=e===void 0?D(i,t,n)*Q.textScale:e*t}return r}function co(e,t,n,r){let i=io(t,n),a=i+2*Q.shapePadding,o=Math.max(Q.width,r+2*Q.shapePadding);if(e.kind===`person`)return{width:o,height:ro(o).pillTop+a,textHeight:i};if(e.shape===`db`){let{ry:e}=oo(o);return{width:o,height:a+2*e-Q.dbTrim,textHeight:i}}if(e.shape===`queue`){let e=i+Q.queueExtra,{rx:t}=so(e);return{width:o+3*t,height:e,textHeight:i}}return{width:o,height:a,textHeight:i}}function lo(e){let t=`#ffffff`;if(e.external)switch(e.kind){case`person`:return{fill:`#686868`,stroke:`#8a8a8a`,text:t};case`system`:return{fill:`#999999`,stroke:`#8a8a8a`,text:t};case`container`:return{fill:`#b3b3b3`,stroke:`#a6a6a6`,text:t};case`component`:return{fill:`#cccccc`,stroke:`#bfbfbf`,text:t}}switch(e.kind){case`person`:return{fill:`#08427b`,stroke:`#073b6f`,text:t};case`system`:return{fill:`#1168bd`,stroke:`#3c7fc0`,text:t};case`container`:return{fill:`#438dd5`,stroke:`#3c7fc0`,text:t};case`component`:return{fill:`#85bbf0`,stroke:`#78a8d8`,text:t}}}var uo=Q.messageSize+5;function fo(e){return e.labelLines??(0,t.c4RelLabelLines)(e)}function po(e){let t=e.labelPosition;return t?fo(e).map((n,r,i)=>({cx:e.technology!==void 0&&r===i.length-1&&e.technologyX!==void 0?e.technologyX:t.x,cy:t.y+r*uo,w:$(n,Q.messageSize,400),h:Q.messageSize})):[]}function mo(){return{next:{cnt:0}}}function ho(e,t,n,r,i){e.next.startx=e.startx=t,e.next.stopx=e.stopx=n,e.next.starty=e.starty=r,e.next.stopy=e.stopy=i}function go(e,t,n,r){let i=e[t];e[t]=i===void 0?n:r(n,i)}function _o(e,t){e.next.cnt+=1;let n=Q.shapeMargin,r=e.next.startx===e.next.stopx?e.next.stopx+n:e.next.stopx+n*2,i=r+t.width,a=e.next.starty+n*2,o=a+t.height;(r>=e.widthLimit||i>=e.widthLimit||e.next.cnt>Q.shapeInRow)&&(r=e.next.startx+n+Q.nextLinePaddingX,a=e.next.stopy+n*2,e.next.stopx=i=r+t.width,e.next.starty=e.next.stopy,e.next.stopy=o=a+t.height,e.next.cnt=1),t.x=r,t.y=a,go(e,`startx`,r,Math.min),go(e,`starty`,a,Math.min),go(e,`stopx`,i,Math.max),go(e,`stopy`,o,Math.max),go(e.next,`startx`,r,Math.min),go(e.next,`starty`,a,Math.min),go(e.next,`stopx`,i,Math.max),go(e.next,`stopy`,o,Math.max)}function vo(e){let n=no(e.label,to,Q.nameSize),r=e.description?no(e.description,to,Q.descrSize):[],i=Math.max(...n.map(e=>$(e,Q.nameSize,700)),$((0,t.c4TypeLine)(e),Q.typeSize,400),...r.map(e=>$(e,Q.descrSize,400)));return{el:e,nameLines:n,descriptionLines:r,x:0,y:0,...co(e,n.length,r.length,i)}}function yo(e){let t=new Set,n=new Map(e.elements.map(e=>[e.alias,e])),r=e=>{let i=e.elementAliases.flatMap(e=>{t.add(e);let r=n.get(e);return r?[r]:[]});return{alias:e.alias,boundary:e,elements:i,children:e.children.map(r)}},i=e.boundaries.map(r);return{alias:`global`,elements:e.elements.filter(e=>!t.has(e.alias)),children:i}}function bo(e){let n=new Map,r=[],i=Q.diagramMarginX,a=Q.diagramMarginY,o=(e,t)=>{for(let r of t){let t=vo(r);n.set(r.alias,t),_o(e,t)}e.stopx+=Q.shapeMargin,e.stopy+=Q.shapeMargin},s=(e,n,c)=>{let l=mo();l.widthLimit=e.widthLimit/Math.min(Q.boundaryInRow,n.length);for(let[u,d]of n.entries()){let n=d.boundary,f=0,p=f+8;f=p+Q.boundaryLabelHeight;let m;n&&(0,t.c4BoundaryTypeLine)(n)&&(m=f+5,f=m+Q.boundaryTypeHeight);let h;if(n?.description&&(h=f+20,f=h+Q.boundaryDescrHeight),n||(f=Q.rootHeadingHeight),u===0||u%Q.boundaryInRow===0){let t=e.startx+Q.diagramMarginX,n=e.stopy+Q.diagramMarginY+f;ho(l,t,t,n,n)}else{let e=l.stopx===l.startx?l.startx:l.stopx+Q.diagramMarginX;ho(l,e,e,l.starty,l.starty)}if(d.elements.length>0&&o(l,d.elements),d.children.length>0&&s(l,d.children,c+1),n){let e=l.stopx-l.startx,t=l.stopy-l.starty;e===0&&(e=Q.width,l.stopx=l.startx+e),t===0&&(t=f+Q.shapeMargin),r.push({alias:n.alias,label:n.label,...n.type?{type:n.type}:{},...n.description?{description:n.description}:{},x:l.startx,y:l.starty,width:e,height:t,depth:c,labelY:p,...m===void 0?{}:{typeY:m},...h===void 0?{}:{descrY:h}})}e.stopy=Math.max(l.stopy+Q.shapeMargin,e.stopy),e.stopx=Math.max(l.stopx+Q.shapeMargin,e.stopx),i=Math.max(i,e.stopx),a=Math.max(a,e.stopy)}},c=mo();return ho(c,Q.diagramMarginX,Q.diagramMarginX,Q.diagramMarginY,Q.diagramMarginY),c.widthLimit=Q.screenWidth,s(c,[e],-1),{elements:n,boundaries:r,maxX:i,maxY:a}}function xo(e,t){let n=e.x+e.width/2,r=e.y+e.height/2,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(i===0&&a===0)return{x:n,y:r};let c,l;if(Math.abs(a)*o>Math.abs(i)*s){let e=a<0?-s:s;c=e*i/a,l=e}else{let e=i<0?-o:o;c=e,l=e*a/i}return{x:n+c,y:r+l}}function So(e,t){let n=ro(e.width,e.height),r=e.x+e.width/2,i=e.y+e.height/2,a=e.width,o=e.height,s=-o/2+n.headRadius,c=-o/2+n.pillTop,l=n.rx,u=(e,t,n,r,i,a)=>Array.from({length:r},(o,s)=>{let c=(i+s*(a-i)/(r-1))*Math.PI/180;return{x:e-n*Math.cos(c),y:t-n*Math.sin(c)}}),d=Math.asin(Math.min(1,(c-s)/n.headRadius))*180/Math.PI,f=[...u(0,s,n.headRadius,24,180+d,-d),...u(-a/2+l,c+l,l,12,90,0),...u(-a/2+l,o/2-l,l,12,360,270),...u(a/2-l,o/2-l,l,12,270,180),...u(a/2-l,c+l,l,12,180,90)];return wo({x:r,y:i},t,f.map(e=>({x:r+e.x,y:i+e.y})))}function Co(e,t,n,r){let i=t.y-e.y,a=e.x-t.x,o=t.x*e.y-e.x*t.y,s=i*n.x+a*n.y+o,c=i*r.x+a*r.y+o;if(s!==0&&c!==0&&s*c>0)return;let l=r.y-n.y,u=n.x-r.x,d=r.x*n.y-n.x*r.y,f=l*e.x+u*e.y+d,p=l*t.x+u*t.y+d;if(f!==0&&p!==0&&f*p>0)return;let m=i*u-l*a;if(m===0)return;let h=Math.abs(m/2),g=a*d-u*o,_=g<0?(g-h)/m:(g+h)/m;return g=l*o-i*d,{x:_,y:g<0?(g-h)/m:(g+h)/m}}function wo(e,t,n){let r,i=1/0;return n.forEach((a,o)=>{let s=Co(e,t,a,n[(o+1)%n.length]);if(!s)return;let c=Math.hypot(s.x-t.x,s.y-t.y);c<i&&(r=s,i=c)}),r??e}var To=1e-6;function Eo(e,t){let n=xo(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=oo(e.width),s=n.x-r,c=Math.abs(s)<e.width/2-To||Math.abs(Math.abs(s)-e.width/2)<=To&&Math.abs(n.y-i)>e.height/2-o;if(a===0||!c)return n;let l=o*o*(1-s*s/(a*a)),u=o-(l>0?Math.sqrt(l):l);return t.y-i>0&&(u=-u),{x:n.x,y:n.y+u}}function Do(e,t){let n=xo(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=so(e.height),s=n.y-i,c=Math.abs(s)<e.height/2-To||Math.abs(Math.abs(s)-e.height/2)<=To&&Math.abs(n.x-r)>e.width/2-a;if(o===0||!c)return n;let l=a*a*(1-s*s/(o*o)),u=a-Math.sqrt(Math.abs(l));return t.x-r>0&&(u=-u),{x:n.x+u,y:n.y}}function Oo(e,t){let n=e.el;return n?.kind===`person`?So(e,t):n?.shape===`db`?Eo(e,t):n?.shape===`queue`?Do(e,t):xo(e,t)}var ko=e=>({x:e.x+e.width/2,y:e.y+e.height/2});function Ao(e,n,r,i){let a=r.get(e.from),o=r.get(e.to),s=Oo(a,ko(o)),c=Oo(o,ko(a)),l=c.x-s.x,u=c.y-s.y,d=e=>({x:e.x,y:e.y+i}),f={...e,points:[d(s),d(c)]};if(n>0&&(f.curve=d({x:s.x+l/2-l/4,y:s.y+u/2})),(0,t.c4RelLabelLines)(e).length>0){let n={x:Math.min(s.x,c.x)+Math.abs(l)/2,y:Math.min(s.y,c.y)+Math.abs(u)/2},r=(0,t.c4RelLabelLines)(e)[0],i=e.label!==``||e.index!==void 0?$(r??``,Q.messageSize,400):0;if(f.labelPosition=d({x:n.x+i/2,y:n.y}),e.technology){let t=$(`[${e.technology}]`,Q.messageSize,400);f.technologyX=n.x+Math.max(i,t)/2}}return f}var jo=2,Mo=6,No=2,Po=[0,14,-14,28,-28],Fo=[.75,.55,.4],Io=1e3,Lo=100,Ro=10,zo=2,Bo=5,Vo=4,Ho=e=>({x0:e.cx-e.w/2,x1:e.cx+e.w/2,y0:e.cy-e.h/2,y1:e.cy+e.h/2}),Uo=(e,t)=>e.x0<t.x1+jo&&e.x1>t.x0-jo&&e.y0<t.y1+jo&&e.y1>t.y0-jo;function Wo(e){let t=e.points[0],n=e.points[e.points.length-1],r=e.curve,i=Math.hypot(n.x-t.x,n.y-t.y),a=Math.max(1,Math.ceil(i/Vo));return Array.from({length:a+1},(e,i)=>{let o=i/a;if(!r)return{x:t.x+(n.x-t.x)*o,y:t.y+(n.y-t.y)*o};let s=1-o;return{x:s*s*t.x+2*s*o*r.x+o*o*n.x,y:s*s*t.y+2*s*o*r.y+o*o*n.y}})}function Go(e){return e.flatMap(e=>{let n=(e,t,n,r,i)=>({x0:e-i,x1:t+i,y0:n-i,y1:r+i,weight:Lo}),r=(t,r,i,a)=>{let o=$(t,i,a),s=e.x+e.width/2;return n(s-o/2,s+o/2,e.y+r-i/2,e.y+r+i/2,Bo)},i=(0,t.c4BoundaryTypeLine)({...e,elementAliases:[],children:[]});return[n(e.x,e.x+e.width,e.y,e.y,zo),n(e.x,e.x+e.width,e.y+e.height,e.y+e.height,zo),n(e.x,e.x,e.y,e.y+e.height,zo),n(e.x+e.width,e.x+e.width,e.y,e.y+e.height,zo),r(e.label,e.labelY,Q.boundarySize+2,700),...i?[r(i,e.typeY,Q.boundarySize,400)]:[],...e.description?[r(e.description,e.descrY,Q.boundarySize-2,400)]:[]]})}function Ko(e,t){return po({...e,labelLines:t.lines,labelPosition:t.position,...t.technologyX===void 0?{}:{technologyX:t.technologyX}}).map(Ho)}function qo(e,n,r,i){let a=e.points[0],o=e.points[e.points.length-1],s=e.labelPosition;if(!s||!a||!o)return;let c=o.x-a.x,l=o.y-a.y,u=Math.hypot(c,l),d=(0,t.c4RelLabelLines)(e),f=e.label!==``||e.index!==void 0,p=f?$(d[0],Q.messageSize,400):0,m=s.x-p/2,h=[{variant:{lines:d,position:s,...e.technologyX===void 0?{}:{technologyX:e.technologyX}},cost:0}];if(f){let t=e.technology?[`[${e.technology}]`]:[],n=new Set([d.join(`
|
|
91
|
+
`)]);Fo.forEach((e,r)=>{let i=no(d[0],p*e,Q.messageSize),a=[...i,...t].join(`
|
|
92
|
+
`);if(n.has(a))return;n.add(a);let o=Math.max(...i.map(e=>$(e,Q.messageSize,400)));h.push({variant:{lines:[...i,...t],position:{x:m+o/2,y:s.y}},cost:25*(r+1)})})}let g=u===0?0:c/u,_=u===0?0:l/u,v=u/2+Math.max(...Po)+jo,y=h.flatMap(t=>Ko(e,t.variant)),b={x0:Math.min(...y.map(e=>e.x0))-v,x1:Math.max(...y.map(e=>e.x1))+v,y0:Math.min(...y.map(e=>e.y0))-v,y1:Math.max(...y.map(e=>e.y1))+v},x=e=>e.x0<b.x1&&e.x1>b.x0&&e.y0<b.y1&&e.y1>b.y0,S=[...n,...i].filter(x),C=Math.max(No,u/200),w=r.filter(e=>x({x0:Math.min(...e.map(e=>e.x)),x1:Math.max(...e.map(e=>e.x)),y0:Math.min(...e.map(e=>e.y)),y1:Math.max(...e.map(e=>e.y))})),T=w.map(e=>({x0:Math.min(...e.map(e=>e.x)),x1:Math.max(...e.map(e=>e.x)),y0:Math.min(...e.map(e=>e.y)),y1:Math.max(...e.map(e=>e.y))})),E,D=e=>E?.penalty===0&&e>=E.cost;for(let{variant:t,cost:n}of h){let r=Ko(e,t);for(let e of Po)if(!D(n+2*Math.abs(e)))for(let i=0;i<=u/2&&!D(n+2*Math.abs(e)+i);i+=C)for(let a of i===0?[1]:[1,-1]){let o=a*i,s={x:o*g-e*_,y:o*_+e*g},c=r.map(e=>({x0:e.x0+s.x,x1:e.x1+s.x,y0:e.y0+s.y,y1:e.y1+s.y})),l=0,u=E?.penalty??1/0;for(let e of c){if(l>u)break;for(let t of S)if(Uo(e,t)&&(l+=t.weight),l>u)break;if(l>u)break;for(let[t,n]of w.entries()){let r=T[t];r.x1<=e.x0||r.x0>=e.x1||r.y1<=e.y0||r.y0>=e.y1||n.some(t=>t.x>e.x0&&t.x<e.x1&&t.y>e.y0&&t.y<e.y1)&&(l+=Ro)}}let d=n+i+2*Math.abs(e);(!E||l<E.penalty||l===E.penalty&&d<E.cost)&&(E={v:t,at:s,penalty:l,cost:d})}}let{v:O,at:k}=E;e.labelPosition={x:O.position.x+k.x,y:O.position.y+k.y},O.lines!==d&&(e.labelLines=O.lines),O.technologyX===void 0?delete e.technologyX:e.technologyX=O.technologyX+k.x,i.push(...po(e).map(e=>({...Ho(e),weight:Lo})))}function Jo(e,t={}){if(e.elements.length===0&&e.boundaries.length===0){let t={variant:e.variant,width:0,height:0,elements:[],boundaries:[],relationships:[]};if(e.title){let n=2*Q.diagramMarginY+Q.titleExtra;t.title=e.title,t.width=Math.ceil(2*Q.diagramMarginX+$(e.title,16,400)),t.height=n,t.titlePosition={x:Q.diagramMarginX,y:n/2}}return t}let n=bo(yo(e)),r=e.title?Q.titleExtra:0,i=Q.diagramMarginY+r,a=e.elements.flatMap(e=>{let t=n.elements.get(e.alias);return t?[{...e,x:t.x,y:t.y+i,width:t.width,height:t.height,nameLines:t.nameLines,descriptionLines:t.descriptionLines}]:[]}),o=[...n.boundaries].sort((e,t)=>e.depth-t.depth).map(e=>({...e,y:e.y+i})),s=new Map;for(let e of n.elements.values())s.set(e.el.alias,e);for(let e of n.boundaries)s.set(e.alias,e);let c=e.relationships.map((e,t)=>Ao(e,t,s,i)),l=[...a.map(e=>({x0:e.x-Mo,x1:e.x+e.width+Mo,y0:e.y-Mo,y1:e.y+e.height+Mo,weight:Io})),...Go(o)],u=c.map(Wo),d=[];c.forEach((e,t)=>qo(e,l,u.filter((e,n)=>n!==t),d));let f=n.maxX+Q.diagramMarginX,p=n.maxY+Q.diagramMarginY+r,m={variant:e.variant,width:f,height:p,elements:a,boundaries:o,relationships:c};return e.title&&(m.title=e.title,m.titlePosition={x:(n.maxX-Q.diagramMarginX)/2-4*Q.diagramMarginX,y:Q.diagramMarginY+Q.diagramMarginY+i}),m}function Yo(t,n,r=`Inter`,i=!1,a=A,o,s,c,l={}){let u=[];u.push(Or((0,e.svgOpenTag)(t.width,t.height,n,i,s??t.title,c,void 0,l.styleAttribute,l.description),o)),u.push((0,e.buildStyleBlock)(r,!1,l.nonce,l.bodyFont)),t.title&&t.titlePosition&&u.push(e.f`<text class="c4-title" x="${t.titlePosition.x}" y="${t.titlePosition.y}" dy="${F}" `+e.f`font-size="16" fill="var(--_text)">${(0,e.escapeXml)(t.title)}</text>`);for(let e of t.boundaries)u.push(Zo(e));for(let e of t.elements)u.push(Qo(e));for(let e of t.relationships)u.push(os(e));for(let e of t.relationships)u.push(ss(e));return u.push(`</svg>`),u.filter(Boolean).join(`
|
|
93
|
+
`)}function Xo(t,n,r,i,a){return e.f` <text x="${n}" y="${r}" text-anchor="middle" dy="${F}" font-size="${i}" `+e.f`${a}>${(0,e.escapeXml)(t)}</text>`}function Zo(n){let r=[];r.push(e.f`<g class="c4-boundary" data-id="${(0,e.escapeAttr)(n.alias)}" data-label="${(0,e.escapeAttr)(n.label)}" data-depth="${n.depth}">`),r.push(e.f` <rect x="${n.x}" y="${n.y}" width="${n.width}" height="${n.height}" rx="2.5" ry="2.5" `+`fill="none" stroke="var(--_text)" stroke-width="1" stroke-dasharray="7,7" />`);let i=n.x+n.width/2;r.push(Xo(n.label,i,n.y+(n.labelY??8),Q.boundarySize+2,`font-weight="700" fill="var(--_text)"`));let a=(0,t.c4BoundaryTypeLine)({alias:n.alias,label:n.label,...n.type?{type:n.type}:{},elementAliases:[],children:[]});return a&&n.typeY!==void 0&&r.push(Xo(a,i,n.y+n.typeY,Q.boundarySize,`fill="var(--_text)"`)),n.description&&n.descrY!==void 0&&r.push(Xo(n.description,i,n.y+n.descrY,Q.boundarySize-2,`fill="var(--_text)"`)),r.push(`</g>`),r.join(`
|
|
94
|
+
`)}function Qo(n){let r=lo(n),{x:i,y:a,width:o,height:s}=n,c=i+o/2,l=io(n.nameLines.length,n.descriptionLines.length),u=[];u.push(e.f`<g class="c4-element" data-id="${(0,e.escapeAttr)(n.alias)}" data-kind="${n.kind}" data-shape="${n.shape}" `+e.f`data-external="${n.external}" data-label="${(0,e.escapeAttr)(n.label)}">`);let d,f=c;if(n.kind===`person`)u.push(...es(n,r)),d=a+ro(o).pillTop+Q.shapePadding;else if(n.shape===`db`){u.push(...ts(n,r));let{ry:e}=oo(o);d=a+(2*e+s)/2-l/2}else if(n.shape===`queue`){u.push(...ns(n,r));let{rx:e}=so(s);f=c-e,d=a+s/2-l/2}else u.push(e.f` <rect x="${i}" y="${a}" width="${o}" height="${s}" rx="${Q.cornerRadius}" ry="${Q.cornerRadius}" `+e.f`fill="${r.fill}" stroke="${r.stroke}" stroke-width="${Q.strokeWidth}" />`),d=a+Q.shapePadding;let p=d;for(let t of n.nameLines)u.push(Xo(t,f,p+Q.nameLine/2,Q.nameSize,e.f`font-weight="700" fill="${r.text}"`)),p+=Q.nameLine;return u.push(Xo((0,t.c4TypeLine)(n),f,p+Q.typeLine/2,Q.typeSize,e.f`fill="${r.text}"`)),p+=Q.typeLine,n.descriptionLines.forEach((t,n)=>{u.push(Xo(t,f,p+Q.descrLine/2+n*Q.descrExtraLine,Q.descrSize,e.f`fill="${r.text}"`))}),p+=ao(n.descriptionLines.length),u.push(`</g>`),u.join(`
|
|
95
|
+
`)}function $o(t){let{x:n,y:r,width:i,height:a}=t,{rx:o,headRadius:s,pillTop:c}=ro(i,a),l=n+i/2,u=r+c,d=r+a,f=Math.sqrt(Math.max(0,s*s-(u-(r+s))**2));return e.f`M ${n+o} ${u} H ${l-f} A ${s} ${s} 0 1 1 ${l+f} ${u} `+e.f`H ${n+i-o} A ${o} ${o} 0 0 1 ${n+i} ${u+o} V ${d-o} `+e.f`A ${o} ${o} 0 0 1 ${n+i-o} ${d} H ${n+o} `+e.f`A ${o} ${o} 0 0 1 ${n} ${d-o} V ${u+o} `+e.f`A ${o} ${o} 0 0 1 ${n+o} ${u} Z`}function es(t,n){return[e.f` <path class="c4-person-shape" d="${$o(t)}" fill="${n.fill}" stroke="${n.stroke}" stroke-width="${Q.strokeWidth}" />`]}function ts(t,n){let{x:r,y:i,width:a,height:o}=t,{rx:s,ry:c}=oo(a),l=e.f`fill="${n.fill}" stroke="${n.stroke}" stroke-width="${Q.strokeWidth}"`;return[e.f` <path d="M ${r} ${i+c} L ${r} ${i+o-c} A ${s} ${c} 0 0 0 ${r+a} ${i+o-c} L ${r+a} ${i+c} Z" ${l} />`,e.f` <ellipse cx="${r+s}" cy="${i+c}" rx="${s}" ry="${c}" ${l} />`]}function ns(t,n){let{x:r,y:i,width:a,height:o}=t,{rx:s,ry:c}=so(o),l=e.f`fill="${n.fill}" stroke="${n.stroke}" stroke-width="${Q.strokeWidth}"`;return[e.f` <path d="M ${r+a-s} ${i} H ${r+s} A ${s} ${c} 0 0 0 ${r+s} ${i+o} H ${r+a-s} Z" ${l} />`,e.f` <ellipse cx="${r+a-s}" cy="${i+c}" rx="${s}" ry="${c}" ${l} />`]}function rs(t,n){let r=t.x-n.x,i=t.y-n.y,a=Math.hypot(r,i);if(a===0)return``;let o=r/a,s=i/a,c=t.x-o*10,l=t.y-s*10;return e.f`<polygon class="c4-arrowhead" points="${t.x},${t.y} ${c-s*5},${l+o*5} ${c+s*5},${l-o*5}" `+`fill="var(--_text)" />`}var is=3,as=1;function os(t){let[n,r]=[t.points[0],t.points[t.points.length-1]];if(!n||!r||n===r)return``;let i=[`class="c4-relationship"`,e.f`data-from="${(0,e.escapeAttr)(t.from)}"`,e.f`data-to="${(0,e.escapeAttr)(t.to)}"`];t.label&&i.push(e.f`data-label="${(0,e.escapeAttr)(t.label)}"`),t.technology&&i.push(e.f`data-technology="${(0,e.escapeAttr)(t.technology)}"`);let a=t.curve?e.f`M ${n.x},${n.y} Q ${t.curve.x},${t.curve.y} ${r.x},${r.y}`:e.f`M ${n.x},${n.y} L ${r.x},${r.y}`,o=e.f`<path ${i.join(` `)} d="${a}" fill="none" stroke="var(--_text)" stroke-width="1" />`,s=t.curve??n,c=t.curve??r,l=rs(r,s),u=rs(n,c);return[o,...t.bidirectional?[l,u]:[t.reversed?u:l]].filter(Boolean).join(`
|
|
96
|
+
`)}function ss(t){let n=fo(t),r=po(t);if(r.length===0)return``;let i=[e.f`<g class="c4-relationship-label" data-from="${(0,e.escapeAttr)(t.from)}" data-to="${(0,e.escapeAttr)(t.to)}">`],a=Math.min(...r.map(e=>e.cx-e.w/2))-is,o=Math.max(...r.map(e=>e.cx+e.w/2))+is,s=r[0].cy-r[0].h/2-as,c=r[r.length-1],l=c.cy+c.h/2+as;return i.push(e.f` <rect class="c4-label-plate" x="${a}" y="${s}" width="${o-a}" height="${l-s}" rx="2" ry="2" fill="var(--bg)" />`),n.forEach((e,a)=>{let o=t.technology!==void 0&&a===n.length-1,s=r[a];i.push(Xo(e,s.cx,s.cy,Q.messageSize,o?`font-style="italic" fill="var(--_text)"`:`fill="var(--_text)"`))}),i.push(`</g>`),i.join(`
|
|
97
|
+
`)}var cs={type:`xychart`,parse:t.parseXYChart,layoutForSvg:xa,renderSvg(e,t,n){let r=n.interactivity===void 0?n.interactive??!1:n.interactivity===`full`;return Pa(e,t.colors,t.font,t.transparent,r,t.embedSource,t.title,t.decorative,t.emit)}},ls={type:`sequence`,parse:t.parseSequenceDiagram,layoutForSvg:Xi,renderSvg(e,t){return Zi(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}};function us(e){return(e.interactivity??`static`)!==`none`}function ds(e){return(e.interactivity??`static`)===`full`}var fs={type:`class`,parse:t.parseClassDiagram,layoutForSvg:ni,renderSvg(e,t,n){return ci(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,us(n),t.emit)}},ps={type:`er`,parse:t.parseErDiagram,layoutForSvg(t,n){return Ai((0,e.withDirectionOverride)(t,n.direction),n)},renderSvg(e,t){return Ni(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},ms={type:`flowchart`,parse:(e,n)=>(0,t.parseMermaid)(n),layoutForSvg(t,n){return{graph:bn((0,e.withDirectionOverride)(t,n.direction),n),curve:n.curve??t.initConfig?.curve??`linear`}},renderSvg(e,t,n){return jn(e.graph,t.colors,t.font,t.transparent,t.fontSizes,e.curve,t.embedSource,ds(n),us(n),t.title,t.decorative,t.emit)}},hs={type:`c4`,parse:t.parseC4Diagram,layoutForSvg(e,t){return Jo(e,t)},renderSvg(e,t){return Yo(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},gs={xychart:cs,er:ps,sequence:ls,class:fs,flowchart:ms,architecture:{type:`architecture`,parse:t.parseArchitecture,layoutForSvg(n,r){return{graph:vn((0,e.withDirectionOverride)((0,t.architectureToGraph)(n),r.direction),r),curve:r.curve??`linear`}},renderSvg:ms.renderSvg},c4:hs,pie:{type:`pie`,parse:(e,n)=>(0,t.parsePieChart)(n),layoutForSvg:(e,t)=>qa(t.honorThemeVariables?e:{...e,sliceColors:void 0},t),renderSvg(e,t){return Xa(e,t.colors,t.font,t.transparent,t.embedSource,t.title,t.decorative,t.emit)}}};function _s(t){return{bg:t.bg??e.DEFAULTS.bg,fg:t.fg??e.DEFAULTS.fg,line:t.line,accent:t.accent,muted:t.muted??(t.bg||t.fg?void 0:e.DEFAULTS.muted),surface:t.surface,border:t.border}}function vs(t={}){return(0,e.themeStyleDeclarations)(_s(t),t.transparent)}function ys(e){return{nonce:e.nonce,styleAttribute:e.styleAttribute,bodyFont:a(e)}}function bs(e,t={}){let{svg:n,colors:r}=Cs(e,t),i=xs(n);return t.resolveColors?Ur(i,r):i}function xs(e){let t=new Set(Array.from(e.matchAll(/\sid="([^"]+)"/g),e=>e[1]??``));if(t.size===0)return e;let n=2166136261;for(let t=0;t<e.length;t++)n=Math.imul(n^e.charCodeAt(t),16777619);let r=`zm${(n>>>0).toString(36)}-`,i=e=>t.has(e)&&!e.startsWith(`zm-`)?r+e:e;return e.replace(/(\sid=")([^"]+)"/g,(e,t,n)=>`${t}${i(n)}"`).replace(/url\(#([^)]+)\)/g,(e,t)=>`url(#${i(t)})`).replace(/(href=")#([^"]+)"/g,(e,t,n)=>`${t}#${i(n)}"`)}function Ss(t){let r=(0,e.extractAccessibility)((0,n.decodeXML)(t)).text;gs[(0,e.detectDiagramType)(r)].parse((0,e.splitStatements)(r),r)}function Cs(t,r){(0,e.checkLimit)(`maxInputLength`,t.length,r.limits),(0,e.checkLineLength)(t,r.limits);let i=(0,e.extractAccessibility)((0,n.decodeXML)(t)),a=i.text,o=r.font??`Inter`;(0,e.setMonospaceMetrics)((0,e.isMonospaceFont)(o));let s=r.transparent??!1,c=j(r.fontSizes),l=(0,e.detectDiagramType)(a),u=r.embedSource?t:void 0,d=r.title??i.accTitle,f=r.decorative,p={...ys(r),description:i.accDescr},m=(0,e.splitStatements)(a),h=gs[l],g=h.parse(m,a),_=g;_.nodes instanceof Map&&Array.isArray(_.edges)&&(0,e.checkGraphSize)(_.nodes.size,_.edges.length,r.limits);let v=h.layoutForSvg(g,r),y=_s(r.honorThemeVariables?(0,e.applyThemeVariables)(r,g.initConfig):r),b={colors:y,font:o,transparent:s,fontSizes:c,embedSource:u,title:d,decorative:f,emit:p};return{svg:h.renderSvg(v,b,r),colors:y}}async function ws(e,t={}){return t.embedFont===`subset`&&await i(),bs(e,t)}var Ts=bs,Es=ws;exports.ACTOR_LABEL_OFFSET=Wi,exports.ARROW_HEAD=I,exports.ASYMMETRIC_NOTCH=ne,exports.CLS=H,exports.ELK_DIRECTION_FALLBACK=re,exports.ElkNotRegisteredError=g,exports.FONT_SIZES=A,exports.FONT_WEIGHTS=M,exports.GROUP_HEADER_CONTENT_PAD=te,exports.INLINE_CENTERED_EDGE_LABEL=ce,exports.MONO_FONT=k,exports.MONO_FONT_STACK=ee,exports.NODE_PADDING=N,exports.PIE=Y,exports.STROKE_WIDTHS=P,exports.TEXT_BASELINE_SHIFT=F,exports.baseElkLayoutOptions=oe,exports.boxLabelHeight=Ui,exports.buildElkEdge=ue,exports.buildElkEdgeLabel=le,exports.buildElkLeafNode=se,exports.buildSvgStyleBlock=L,exports.classBackEdges=$r,exports.classNoteId=Jr,exports.clipEdgeToShape=Me,exports.convertToElkFormat=xn,exports.createLayoutCache=x,exports.directionToElk=ie,exports.elkLayoutSync=w,exports.elkPadding=ae,exports.estimateMonoTextWidth=O,exports.estimateTextWidth=D,exports.evaluateCssColorValue=Lr,exports.extractEdgeLabelPosition=Ye,exports.extractEdgePoints=Je,exports.formatTickLabels=ja,exports.hasLabelBelowIcon=Ki,exports.layoutClassDiagramSync=ni,exports.layoutErDiagramSync=Ai,exports.layoutFlowchartSync=bn,exports.layoutGraphSync=vn,exports.layoutPieChart=qa,exports.layoutSequenceDiagram=Xi,exports.layoutXYChart=xa,exports.loadEmbeddedFont=i,Object.defineProperty(exports,"niceTickValues",{enumerable:!0,get:function(){return e.niceTickValues}}),exports.pieColorValue=Ja,exports.pointsToPath=d,exports.registerElk=_,exports.renderClassSvg=ci,exports.renderErSvg=Ni,exports.renderMermaid=Es,exports.renderMermaidSVG=bs,exports.renderMermaidSVGAsync=ws,exports.renderMermaidSync=Ts,exports.renderPieSvg=Xa,exports.renderSequenceSvg=Zi,exports.renderSvg=jn,exports.renderXYChartSvg=Pa,exports.resolveCssColors=Ur,exports.resolveFontSizes=j,exports.smoothCurvePath=za,exports.straightLinePath=Ra,exports.themeCssVariables=vs,exports.validateMermaid=Ss,exports.withDataSrc=Or,exports.xLabelStep=Da;
|