UNPKG

mermaid

Version:

Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.

63 lines 116 kB
import{a as k}from"./chunk-F6PIGZHG.mjs";import{a as ne,b as yt,d as v,e as P}from"./chunk-JGXDHUYS.mjs";import{c as Gt,e as it}from"./chunk-TINYC7RT.mjs";import{c as ae,d as gt}from"./chunk-TDFULVG6.mjs";import{g as lt}from"./chunk-MIE3LDYP.mjs";import{k as kt,n as ie,r as xt,t as q}from"./chunk-QADHU5CF.mjs";import{$ as U,B as Bt,D as _t,E as oe,ca as Ht,j as re,n as ht,u as Nt,y as pt}from"./chunk-FE53TMRB.mjs";import{b as X,h as J}from"./chunk-L2B47AAZ.mjs";import{a as x}from"./chunk-QVIEFLGF.mjs";var mr=1,fr=3;async function jt(n){let t=n.getElementsByTagName("img");if(!t||t.length===0)return;let r=!le(n);await Promise.all([...t].map(i=>new Promise(l=>{function c(){if(i.style.display="flex",i.style.flexDirection="column",r){let f=U().fontSize?U().fontSize:window.getComputedStyle(document.body).fontSize,o=5,[h=re.fontSize]=ie(f),a=h*o+"px";i.style.minWidth=a,i.style.maxWidth=a}else i.style.width="100%";l(i)}x(c,"setupImage"),setTimeout(()=>{i.complete&&c()}),i.addEventListener("error",c),i.addEventListener("load",c)})))}x(jt,"configureLabelImages");function le(n){return n.nodeType===fr?n.textContent?.trim()!=="":n.nodeType!==mr||n.tagName.toLowerCase()==="img"?!1:[...n.childNodes].some(le)}x(le,"hasTextBesidesImages");var ce=3,dr=32,he=x(async(n,t,r)=>{let i=U(),l=n.insert("g").attr("class",r??"node default").attr("id",t.domId||t.id),c=l.insert("g").attr("class","label").attr("style",q(t.labelStyle)),o=[{text:typeof t.label=="string"?t.label:t.label?.[0]??"",cssClass:"c4-name"},{text:t.stereotype,cssClass:"c4-type"},...(t.description??[]).map(y=>({text:y,cssClass:"c4-descr"}))].filter(y=>y.text),h=t.width?Math.max(t.width-2*(t.padding??0),dr):U().flowchart?.wrappingWidth??200,e=i.c4?.wrap??!0?h:Number.POSITIVE_INFINITY,s=await Promise.all(o.map(async y=>{let b=c.append("g").attr("class",y.cssClass),S=await it(b,Bt(xt(y.text??""),i),{useHtmlLabels:!1,markdown:!1,isNode:!0,width:e,style:t.labelStyle},i);return J(S).selectAll("tspan.text-outer-tspan").attr("text-anchor","middle"),J(S).selectAll("tspan.text-inner-tspan").attr("font-weight",null).attr("font-style",null),{el:b,box:b.node().getBBox()}})),p=Math.max(...s.map(({box:y})=>y.width),0),m=0;for(let{el:y,box:b}of s)y.attr("transform",`translate(${p/2-b.x-b.width/2}, ${m-b.y})`),m+=b.height+ce;let d=s.length>0?m-ce:0;c.insert("rect",":first-child"),c.attr("transform",`translate(${-p/2}, ${-d/2})`);let g=c.node().getBBox(),u=(t.padding??0)/2;return{shapeSvg:l,bbox:g,halfPadding:u,label:c}},"c4LabelHelper");var pe=x((n,t)=>{let{x:r,y:i,width:l,height:c}=n;return l>=t?n:"left"in n?{x:r,y:i,width:t,height:c,top:i,left:r,bottom:i+c,right:r+t,toJSON:x(()=>({}),"toJSON")}:{x:r-(t-l)/2,y:i,width:t,height:c}},"withMinWidth"),T=x(async(n,t,r)=>{if(t.stereotype!==void 0)return he(n,t,r);let i,l=t.useHtmlLabels||ht(U()?.htmlLabels);r?i=r:i="node default";let c=n.insert("g").attr("class",i).attr("id",t.domId||t.id),f=c.insert("g").attr("class","label").attr("style",q(t.labelStyle)),o;t.label===void 0?o="":o=typeof t.label=="string"?t.label:t.label[0];let h=!!t.icon||!!t.img,a=t.labelType==="markdown",e=o&&!t.width?t.minWidth??0:0,s=await it(f,Bt(xt(o),U()),{useHtmlLabels:l,width:t.width||t.wrappingWidth||U().flowchart?.wrappingWidth,minWidth:e,classes:a?"markdown-node-label":"",style:t.labelStyle,addSvgBackground:h,markdown:a},U()),p=(t?.padding??0)/2,m;if(l){let d=s.children[0],g=J(s);await jt(d),m=await Gt.measure(()=>d.getBoundingClientRect()),m=pe(m,e),g.attr("width",m.width),g.attr("height",m.height)}else m=await Gt.measure(()=>s.getBBox()),m=pe(m,e);return l?f.attr("transform","translate("+-m.width/2+", "+-m.height/2+")"):f.attr("transform","translate(0, "+-m.height/2+")"),t.centerLabel&&f.attr("transform","translate("+-m.width/2+", "+-m.height/2+")"),f.insert("rect",":first-child"),{shapeSvg:c,bbox:m,halfPadding:p,label:f}},"labelHelper"),mt=x(async(n,t,r)=>{let i=r.useHtmlLabels??pt(U()),l=n.insert("g").attr("class","label").attr("style",r.labelStyle||""),c=await it(l,Bt(xt(t),U()),{useHtmlLabels:i,width:r.width||U()?.flowchart?.wrappingWidth,style:r.labelStyle,addSvgBackground:!!r.icon||!!r.img}),f=r.padding/2,o;if(pt(U())){let h=c.children[0],a=J(c);o=await Gt.measure(()=>h.getBoundingClientRect()),a.attr("width",o.width),a.attr("height",o.height)}else o=await Gt.measure(()=>c.getBBox());return i?l.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"):l.attr("transform","translate(0, "+-o.height/2+")"),r.centerLabel&&l.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"),l.insert("rect",":first-child"),{shapeSvg:n,bbox:o,halfPadding:f,label:l}},"insertLabel"),D=x((n,t,r)=>{if(r){n.width=r.width,n.height=r.height;return}let i=t.node().getBBox();n.width=i.width,n.height=i.height},"updateNodeBounds");var M=x((n,t)=>(n.look==="handDrawn"?"rough-node":"node")+" "+n.cssClasses+" "+(t||""),"getNodeClasses");function _(n){let t=n.map((r,i)=>`${i===0?"M":"L"}${r.x},${r.y}`);return t.push("Z"),t.join(" ")}x(_,"createPathFromPoints");function ct(n,t,r,i,l,c){let f=[],h=r-n,a=i-t,e=h/c,s=2*Math.PI/e,p=t+a/2;for(let m=0;m<=50;m++){let d=m/50,g=n+d*h,u=p+l*Math.sin(s*(g-n));f.push({x:g,y:u})}return f}x(ct,"generateFullSineWavePoints");function nt(n,t,r,i,l,c){let f=[],o=l*Math.PI/180,e=(c*Math.PI/180-o)/(i-1);for(let s=0;s<i;s++){let p=o+s*e,m=n+r*Math.cos(p),d=t+r*Math.sin(p);f.push({x:-m,y:-d})}return f}x(nt,"generateCirclePoints");function Yt(n){let t=Array.from(n.childNodes).filter(h=>h.tagName==="path"),r=document.createElementNS("http://www.w3.org/2000/svg","path"),i=t.map(h=>h.getAttribute("d")).filter(h=>h!==null).join(" ");r.setAttribute("d",i);let l=t.find(h=>h.getAttribute("fill")!=="none"),c=t.find(h=>h.getAttribute("stroke")!=="none"),f=x((h,a)=>h?.getAttribute(a)??void 0,"getAttr");if(l){let h={fill:f(l,"fill"),"fill-opacity":f(l,"fill-opacity")??"1"};Object.entries(h).forEach(([a,e])=>{e&&r.setAttribute(a,e)})}if(c){let h={stroke:f(c,"stroke"),"stroke-width":f(c,"stroke-width")??"1","stroke-opacity":f(c,"stroke-opacity")??"1"};Object.entries(h).forEach(([a,e])=>{e&&r.setAttribute(a,e)})}let o=document.createElementNS("http://www.w3.org/2000/svg","g");return o.appendChild(r),o}x(Yt,"mergePaths");var gr=x((n,t)=>{var r=n.x,i=n.y,l=t.x-r,c=t.y-i,f=n.width/2,o=n.height/2,h,a;return Math.abs(c)*f>Math.abs(l)*o?(c<0&&(o=-o),h=c===0?0:o*l/c,a=o):(l<0&&(f=-f),h=f,a=l===0?0:f*c/l),{x:r+h,y:i+a}},"intersectRect"),me=gr;function yr(n,t){return n.intersect(t)}x(yr,"intersectNode");var fe=yr;function ur(n,t,r,i){var l=n.x,c=n.y,f=l-i.x,o=c-i.y,h=Math.sqrt(t*t*o*o+r*r*f*f),a=Math.abs(t*r*f/h);i.x<l&&(a=-a);var e=Math.abs(t*r*o/h);return i.y<c&&(e=-e),{x:l+a,y:c+e}}x(ur,"intersectEllipse");var Ot=ur;function xr(n,t,r){return Ot(n,t,t,r)}x(xr,"intersectCircle");var de=xr;function br(n,t,r,i){{let l=t.y-n.y,c=n.x-t.x,f=t.x*n.y-n.x*t.y,o=l*r.x+c*r.y+f,h=l*i.x+c*i.y+f,a=1e-6;if(o!==0&&h!==0&&ge(o,h))return;let e=i.y-r.y,s=r.x-i.x,p=i.x*r.y-r.x*i.y,m=e*n.x+s*n.y+p,d=e*t.x+s*t.y+p;if(Math.abs(m)<a&&Math.abs(d)<a&&ge(m,d))return;let g=l*s-e*c;if(g===0)return;let u=(c*p-s*f)/g,y=(e*f-l*p)/g;return{x:u,y}}}x(br,"intersectLine");function ge(n,t){return n*t>0}x(ge,"sameSign");var ye=br;function Sr(n,t,r){let i=n.x,l=n.y,c=[],f=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(e){f=Math.min(f,e.x),o=Math.min(o,e.y)}):(f=Math.min(f,t.x),o=Math.min(o,t.y));let h=i-n.width/2-f,a=l-n.height/2-o;for(let e=0;e<t.length;e++){let s=t[e],p=t[e<t.length-1?e+1:0],m=ye(n,r,{x:h+s.x,y:a+s.y},{x:h+p.x,y:a+p.y});m&&c.push(m)}return c.length?(c.length>1&&c.sort(function(e,s){let p=e.x-r.x,m=e.y-r.y,d=Math.sqrt(p*p+m*m),g=s.x-r.x,u=s.y-r.y,y=Math.sqrt(g*g+u*u);return d<y?-1:d===y?0:1}),c[0]):n}x(Sr,"intersectPolygon");var ue=Sr;var N={node:fe,circle:de,ellipse:Ot,polygon:ue,rect:me};var tt=x((n,t,r,i,l)=>["M",n+l,t,"H",n+r-l,"A",l,l,0,0,1,n+r,t+l,"V",t+i-l,"A",l,l,0,0,1,n+r-l,t+i,"H",n+l,"A",l,l,0,0,1,n,t+i-l,"V",t+l,"A",l,l,0,0,1,n+l,t,"Z"].join(" "),"createRoundedRectPathD");var wr=x(async(n,t,r,i=!1,l=!1)=>{let c=t||"";typeof c=="object"&&(c=c[0]);let f=U(),o=pt(f);return await it(n,c,{style:r,isTitle:i,useHtmlLabels:o,markdown:!1,isNode:l,width:Number.POSITIVE_INFINITY},f)},"createLabel"),Ft=wr;function xe(n,t){let{labelStyles:r}=v(t);t.labelStyle=r;let i=M(t),l=i;i||(l="anchor");let c=n.insert("g").attr("class",l).attr("id",t.domId||t.id),f=1,{cssStyles:o}=t,h=k.svg(c),a=P(t,{fill:"black",stroke:"none",fillStyle:"solid"});t.look!=="handDrawn"&&(a.roughness=0);let e=h.circle(0,0,f*2,a),s=c.insert(()=>e,":first-child");return s.attr("class","anchor").attr("style",q(o)),D(t,s),t.intersect=function(p){return X.info("Circle intersect",t,f,p),N.circle(t,f,p)},c}x(xe,"anchor");function be(n,t,r,i,l,c,f){let h=(n+r)/2,a=(t+i)/2,e=Math.atan2(i-t,r-n),s=(r-n)/2,p=(i-t)/2,m=s/l,d=p/c,g=Math.sqrt(m**2+d**2);if(g>1)throw new Error("The given radii are too small to create an arc between the points.");let u=Math.sqrt(1-g**2),y=h+u*c*Math.sin(e)*(f?-1:1),b=a-u*l*Math.cos(e)*(f?-1:1),S=Math.atan2((t-b)/c,(n-y)/l),$=Math.atan2((i-b)/c,(r-y)/l)-S;f&&$<0&&($+=2*Math.PI),!f&&$>0&&($-=2*Math.PI);let B=[];for(let C=0;C<20;C++){let G=C/19,V=S+G*$,A=y+l*Math.cos(V),R=b+c*Math.sin(V);B.push({x:A,y:R})}return B}x(be,"generateArcPoints");function Nr(n,t,r){let[i,l]=[t,r].sort((c,f)=>f-c);return l*(1-Math.sqrt(1-(n/i/2)**2))}x(Nr,"calculateArcSagitta");async function Se(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=t.look==="neo"?16:l,f=t.look==="neo"?12:l,o=x(V=>V+f,"calcTotalHeight"),h=x(V=>{let A=V/2;return[A/(2.5+V/50),A]},"calcEllipseRadius"),{shapeSvg:a,bbox:e}=await T(n,t,M(t)),s=o(t?.height?t?.height:e.height),[p,m]=h(s),d=Nr(s,p,m),u=(t?.width?t?.width:e.width)+c*2+d-d,y=s,{cssStyles:b}=t,S=[{x:u/2,y:-y/2},{x:-u/2,y:-y/2},...be(-u/2,-y/2,-u/2,y/2,p,m,!1),{x:u/2,y:y/2},...be(u/2,y/2,u/2,-y/2,p,m,!0)],w=k.svg(a),$=P(t,{});t.look!=="handDrawn"&&($.roughness=0,$.fillStyle="solid");let B=_(S),C=w.path(B,$),G=a.insert(()=>C,":first-child");return G.attr("class","basic label-container outer-path"),b&&t.look!=="handDrawn"&&G.selectAll("path").attr("style",b),i&&t.look!=="handDrawn"&&G.selectAll("path").attr("style",i),G.attr("transform",`translate(${p/2}, 0)`),D(t,G),t.intersect=function(V){return N.polygon(t,S,V)},a}x(Se,"bowTieRect");async function we(n,t,{config:{themeVariables:r}}){let{labelStyles:i,nodeStyles:l}=v(t);t.labelStyle=i;let{shapeSvg:c,bbox:f,label:o}=await T(n,t,M(t)),h=r?.nodeBorder??r?.lineColor??"currentColor",a=t.padding??12,e=Math.max(f.width+a*2,t.width??0,80),s=Math.max(Math.min(e*.08,12),5),p=Math.max(f.height+a*2+s,t.height??0),m=-p/2+s,d=p/2,g=e*.72,u=[`M${-e/2},${m}`,`L${-g/2},${d}`,`A${g/2},${s} 0 0 0 ${g/2},${d}`,`L${e/2},${m}`,`A${e/2},${s} 0 0 0 ${-e/2},${m}`,"Z"].join(" "),{cssStyles:y}=t,b=c.insert("g",":first-child").attr("class","basic label-container");if(t.look==="handDrawn"){let G=k.svg(c).path(u,P(t,{}));b.node()?.appendChild(G),y&&b.attr("style",y)}else b.append("path").attr("d",u).attr("style",l);b.append("ellipse").attr("cx",0).attr("cy",m).attr("rx",e/2).attr("ry",s).attr("style",`fill:none;stroke:${h};stroke-width:1px`),D(t,b);let S=m+(d-m)/2;o.attr("transform",`translate(${-(f.width/2)-(f.x-(f.left??0))}, ${S-f.height/2-(f.y-(f.top??0))})`);let w=12,$=x((C,G,V)=>Array.from({length:w+1},(A,R)=>{let j=Math.PI-R*Math.PI/w;return{x:C*Math.cos(j),y:G+V*s*Math.sin(j)}}),"arc"),B=[...$(e/2,m,-1),...$(g/2,d,1).reverse()];return t.intersect=function(C){return N.polygon(t,B,C)},c}x(we,"bucket");var Xt=20,Ut=8,$r=80,Dr=8;function Pr(n){let{themeVariables:t}=U(),r=t.clusterBkg,i=t.clusterBorder;switch(n){case"flow":return{rx:10,fill:"none",stroke:t.flowContainerStroke||t.secondaryBorderColor,strokeWidth:.75,cssClass:"flow-collapsed"};default:return{rx:Dr,fill:r,stroke:i,cssClass:"collapsed-group"}}}x(Pr,"getCollapsedStyle");async function Ne(n,t){let r=Pr(t.metadata?.containerType),{fill:i,stroke:l}=r,{nodeStyles:c}=v(t),{shapeSvg:f,bbox:o}=await T(n,t,M(t)),{theme:h,themeVariables:a}=U();lt(f,t.colorIndex,h,a.borderColorArray);let e=t.padding??8,s=o.height,p=Math.max(o.width+e*2,$r,t?.width??0),m=Math.max(s+Ut+Xt+e*2,t?.height??0),d=-p/2,g=-m/2,u=-(Ut+Xt)/2,y=f.select(".label");y&&(t.useHtmlLabels??pt(U())?y.attr("transform",`translate(${-o.width/2}, ${-o.height/2+u})`):y.attr("transform",`translate(0, ${-o.height/2+u})`));let b;if(t.look==="handDrawn"){let C=k.svg(f),G=P(t,{fill:i,stroke:l,...r.strokeWidth===void 0?{}:{strokeWidth:r.strokeWidth},...i==="none"?{fillWeight:0}:{fillStyle:"solid"}}),V=C.path(tt(d,g,p,m,r.rx),G);b=f.insert(()=>V,":first-child"),b.attr("class","basic label-container "+r.cssClass).attr("style",q(t.cssStyles))}else b=f.insert("rect",":first-child"),b.attr("class","basic label-container "+r.cssClass).attr("style",c).attr("rx",r.rx).attr("ry",r.rx).attr("x",d).attr("y",g).attr("width",p).attr("height",m).attr("fill",i).attr("stroke",l),r.strokeWidth!==void 0&&b.attr("stroke-width",r.strokeWidth+"px");let S=g+e+s+Ut;f.append("line").attr("class","collapsed-separator").attr("x1",d+8).attr("y1",S).attr("x2",d+p-8).attr("y2",S).attr("stroke",l).attr("stroke-dasharray","3, 3");let w=S+Xt/2,$=2.5,B=10;for(let C=-1;C<=1;C++)f.append("circle").attr("class","collapsed-indicator").attr("cx",C*B).attr("cy",w).attr("r",$).attr("fill",l);return D(t,b),t.calcIntersect=function(C,G){return N.rect(C,G)},t.intersect=function(C){return N.rect(t,C)},f}x(Ne,"collapsedGroup");function et(n,t,r,i){return n.insert("polygon",":first-child").attr("points",i.map(function(l){return l.x+","+l.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+r/2+")")}x(et,"insertPolygonShape");var kr=["right","left","up","down"],qt="point",vr=x(n=>{let t=new Set;for(let r of n)switch(r){case"x":t.add("right"),t.add("left");break;case"y":t.add("up"),t.add("down");break;default:t.add(r);break}return t},"expandAndDeduplicateDirections"),Mr=x(n=>kr.filter(t=>n.has(t)).join("|")||qt,"getDirectionKey"),$e={"right|left|up|down":x(({height:n,midpoint:t,padding:r,width:i})=>[{x:0,y:0},{x:t,y:0},{x:i/2,y:2*r},{x:i-t,y:0},{x:i,y:0},{x:i,y:-n/3},{x:i+2*r,y:-n/2},{x:i,y:-2*n/3},{x:i,y:-n},{x:i-t,y:-n},{x:i/2,y:-n-2*r},{x:t,y:-n},{x:0,y:-n},{x:0,y:-2*n/3},{x:-2*r,y:-n/2},{x:0,y:-n/3}],"right|left|up|down"),"right|left|up":x(({height:n,midpoint:t,width:r})=>[{x:t,y:0},{x:r-t,y:0},{x:r,y:-n/2},{x:r-t,y:-n},{x:t,y:-n},{x:0,y:-n/2}],"right|left|up"),"right|left|down":x(({height:n,midpoint:t,width:r})=>[{x:0,y:0},{x:t,y:-n},{x:r-t,y:-n},{x:r,y:0}],"right|left|down"),"right|up|down":x(({height:n,midpoint:t,width:r})=>[{x:0,y:0},{x:r,y:-t},{x:r,y:-n+t},{x:0,y:-n}],"right|up|down"),"left|up|down":x(({height:n,midpoint:t,width:r})=>[{x:r,y:0},{x:0,y:-t},{x:0,y:-n+t},{x:r,y:-n}],"left|up|down"),"right|left":x(({height:n,midpoint:t,padding:r,width:i})=>[{x:t,y:0},{x:t,y:-r},{x:i-t,y:-r},{x:i-t,y:0},{x:i,y:-n/2},{x:i-t,y:-n},{x:i-t,y:-n+r},{x:t,y:-n+r},{x:t,y:-n},{x:0,y:-n/2}],"right|left"),"up|down":x(({height:n,midpoint:t,padding:r,width:i})=>[{x:i/2,y:0},{x:0,y:-r},{x:t,y:-r},{x:t,y:-n+r},{x:0,y:-n+r},{x:i/2,y:-n},{x:i,y:-n+r},{x:i-t,y:-n+r},{x:i-t,y:-r},{x:i,y:-r}],"up|down"),"right|up":x(({height:n,midpoint:t,width:r})=>[{x:0,y:0},{x:r,y:-t},{x:0,y:-n}],"right|up"),"right|down":x(({height:n,width:t})=>[{x:0,y:0},{x:t,y:0},{x:0,y:-n}],"right|down"),"left|up":x(({height:n,midpoint:t,width:r})=>[{x:r,y:0},{x:0,y:-t},{x:r,y:-n}],"left|up"),"left|down":x(({height:n,width:t})=>[{x:t,y:0},{x:0,y:0},{x:t,y:-n}],"left|down"),right:x(({height:n,midpoint:t,padding:r,width:i})=>[{x:t,y:-r},{x:t,y:-r},{x:i-t,y:-r},{x:i-t,y:0},{x:i,y:-n/2},{x:i-t,y:-n},{x:i-t,y:-n+r},{x:t,y:-n+r},{x:t,y:-n+r}],"right"),left:x(({height:n,midpoint:t,padding:r,width:i})=>[{x:t,y:0},{x:t,y:-r},{x:i-t,y:-r},{x:i-t,y:-n+r},{x:t,y:-n+r},{x:t,y:-n},{x:0,y:-n/2}],"left"),up:x(({height:n,midpoint:t,padding:r,width:i})=>[{x:t,y:-r},{x:t,y:-n+r},{x:0,y:-n+r},{x:i/2,y:-n},{x:i,y:-n+r},{x:i-t,y:-n+r},{x:i-t,y:-r}],"up"),down:x(({height:n,midpoint:t,padding:r,width:i})=>[{x:i/2,y:0},{x:0,y:-r},{x:t,y:-r},{x:t,y:-n+r},{x:i-t,y:-n+r},{x:i-t,y:-r},{x:i,y:-r}],"down"),[qt]:()=>[{x:0,y:0}]},Tr=x((n,t,r,i)=>{let l=vr(n),c=(r.padding??0)/2,f=t.height+4*c,o=f/2,h=i??t.width+2*o+2*c,a=Mr(l);return($e[a]??$e[qt])({height:f,midpoint:o,padding:c,width:h})},"getArrowPoints");async function De(n,t){let r=t,{shapeSvg:i,bbox:l}=await T(n,r,M(r)),c=r.padding??0,f=l.height+2*c,o=f/2,h=l.width+2*o+c,a=r.width??0,s=r.positioned&&(r.widthInColumns??1)>1&&a>h?a:h,p=Tr(r.directions??[],l,r,s),m=et(i,s,f,p);return m.attr("style",r.style??null),D(r,m),r.intersect=function(d){return N.polygon(r,p,d)},i}x(De,"block_arrow");async function Pe(n,t,{config:{themeVariables:r}}){let{labelStyles:i,nodeStyles:l}=v(t);t.labelStyle=i;let{shapeSvg:c,bbox:f,label:o}=await T(n,t,M(t)),h=r?.nodeBorder??r?.lineColor??"currentColor",a=t.padding??12,e=18,s=12,p=Math.max(f.width+a*2,t.width??0,90),m=Math.max(f.height+a*2+e,t.height??0),d=-m/2,{cssStyles:g}=t,u=c.insert("g",":first-child").attr("class","basic label-container");if(t.look==="handDrawn"){let S=k.svg(c).path(tt(-p/2,d,p,m,s),P(t,{}));u.node()?.appendChild(S),g&&u.attr("style",g)}else u.append("rect").attr("x",-p/2).attr("y",d).attr("width",p).attr("height",m).attr("rx",s).attr("ry",s).attr("style",l);u.append("line").attr("x1",-p/2).attr("y1",d+e).attr("x2",p/2).attr("y2",d+e).attr("style",`stroke:${h};stroke-width:1px`);for(let b=0;b<3;b++)u.append("circle").attr("cx",-p/2+12+b*9).attr("cy",d+e/2).attr("r",2.5).attr("style",`fill:${h};stroke:none`);u.append("rect").attr("class","browser-address-bar").attr("x",-p/2+44).attr("y",d+4).attr("width",Math.max(p-56,10)).attr("height",e-8).attr("rx",3).attr("ry",3).attr("style",`fill:none;stroke:${h};stroke-width:1px;opacity:0.6`),D(t,u);let y=d+e+(m-e)/2;return o.attr("transform",`translate(${-(f.width/2)-(f.x-(f.left??0))}, ${y-f.height/2-(f.y-(f.top??0))})`),t.intersect=function(b){return N.rect(t,b)},c}x(Pe,"browser");var Lt=12;async function ke(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=t.look==="neo"?28:l,f=t.look==="neo"?24:l,{shapeSvg:o,bbox:h}=await T(n,t,M(t)),a=(t?.width??h.width)+(t.look==="neo"?c*2:c+Lt),e=(t?.height??h.height)+(t.look==="neo"?f*2:f),s=0,p=a,m=-e,d=0,g=[{x:s+Lt,y:m},{x:p,y:m},{x:p,y:d},{x:s,y:d},{x:s,y:m+Lt},{x:s+Lt,y:m}],u,{cssStyles:y}=t;if(t.look==="handDrawn"){let b=k.svg(o),S=P(t,{}),w=_(g),$=b.path(w,S);u=o.insert(()=>$,":first-child").attr("transform",`translate(${-a/2}, ${e/2})`),y&&u.attr("style",y)}else u=et(o,a,e,g);return i&&u.attr("style",i),D(t,u),t.intersect=function(b){return N.polygon(t,g,b)},o}x(ke,"card");function ve(n,t){let{nodeStyles:r}=v(t);t.label="";let i=n.insert("g").attr("class",M(t)).attr("id",t.domId??t.id),{cssStyles:l}=t,c=Math.max(28,t.width??0),f=[{x:0,y:c/2},{x:c/2,y:0},{x:0,y:-c/2},{x:-c/2,y:0}],o=k.svg(i),h=P(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");let a=_(f),e=o.path(a,h),s=i.insert(()=>e,":first-child");return l&&t.look!=="handDrawn"&&s.selectAll("path").attr("style",l),r&&t.look!=="handDrawn"&&s.selectAll("path").attr("style",r),t.width=28,t.height=28,t.intersect=function(p){return N.polygon(t,f,p)},i}x(ve,"choice");async function It(n,t,r){let{labelStyles:i,nodeStyles:l}=v(t);t.labelStyle=i;let{shapeSvg:c,bbox:f,halfPadding:o}=await T(n,t,M(t)),h=16,a=r?.padding??o,e=Math.sqrt(f.width**2+f.height**2)/2,s=t.look==="neo"?e+h*2:e+a,p,{cssStyles:m}=t;if(t.look==="handDrawn"){let d=k.svg(c),g=P(t,{}),u=d.circle(0,0,s*2,g);p=c.insert(()=>u,":first-child"),p.attr("class","basic label-container").attr("style",q(m))}else p=c.insert("circle",":first-child").attr("class","basic label-container").attr("style",l).attr("r",s).attr("cx",0).attr("cy",0);return D(t,p),t.calcIntersect=function(d,g){let u=d.width/2;return N.circle(d,u,g)},t.intersect=function(d){return X.info("Circle intersect",t,s,d),N.circle(t,s,d)},c}x(It,"circle");async function Me(n,t){let r=t,i=["node",r.cssClasses,r.class].filter(Boolean).join(" "),{shapeSvg:l,bbox:c,halfPadding:f}=await T(n,r,i),o=l.insert("rect",":first-child"),h=r.padding??0,a=r.positioned?r.width??0:c.width+h,e=r.positioned?r.height??0:c.height+h,s=r.positioned?-a/2:-c.width/2-f,p=r.positioned?-e/2:-c.height/2-f;return o.attr("class","basic cluster composite label-container").attr("style",r.style??null).attr("rx",r.rx??null).attr("ry",r.ry??null).attr("x",s).attr("y",p).attr("width",a).attr("height",e),D(r,o),r.intersect=function(m){return N.rect(r,m)},l}x(Me,"composite");async function Te(n,t,{config:{themeVariables:r}}){let{labelStyles:i,nodeStyles:l}=v(t);t.labelStyle=i;let{shapeSvg:c,bbox:f,label:o}=await T(n,t,M(t)),h=r?.nodeBorder??r?.lineColor??"currentColor",a=t.padding??12,e=20,s=12,p=Math.max(f.width+a*2,t.width??0,90),m=Math.max(f.height+a*2+e,t.height??0),d=-m/2,{cssStyles:g}=t,u=c.insert("g",":first-child").attr("class","basic label-container");if(t.look==="handDrawn"){let S=k.svg(c).path(tt(-p/2,d,p,m,s),P(t,{}));u.node()?.appendChild(S),g&&u.attr("style",g)}else u.append("rect").attr("x",-p/2).attr("y",d).attr("width",p).attr("height",m).attr("rx",s).attr("ry",s).attr("style",l);u.append("text").attr("x",-p/2+12).attr("y",d+16).attr("class","console-glyph").attr("style",`font-family:monospace;font-weight:bold;font-size:14px;fill:${h}`).text(">_"),D(t,u);let y=d+e+(m-e)/2;return o.attr("transform",`translate(${-(f.width/2)-(f.x-(f.left??0))}, ${y-f.height/2-(f.y-(f.top??0))})`),t.intersect=function(b){return N.rect(t,b)},c}x(Te,"consoleWindow");function Cr(n){let t=Math.cos(Math.PI/4),r=Math.sin(Math.PI/4),i=n*2,l={x:i/2*t,y:i/2*r},c={x:-(i/2)*t,y:i/2*r},f={x:-(i/2)*t,y:-(i/2)*r},o={x:i/2*t,y:-(i/2)*r};return`M ${c.x},${c.y} L ${o.x},${o.y}
                   M ${l.x},${l.y} L ${f.x},${f.y}`}x(Cr,"createLine");function Ce(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r,t.label="";let l=n.insert("g").attr("class",M(t)).attr("id",t.domId??t.id),c=Math.max(30,t?.width??0),{cssStyles:f}=t,o=k.svg(l),h=P(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");let a=o.circle(0,0,c*2,h),e=Cr(c),s=o.path(e,h),p=l.insert(()=>a,":first-child");return p.insert(()=>s),p.attr("class","outer-path"),f&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",f),i&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",i),D(t,p),t.intersect=function(m){return X.info("crossedCircle intersect",t,{radius:c,point:m}),N.circle(t,c,m)},l}x(Ce,"crossedCircle");function $t(n,t,r,i=100,l=0,c=180){let f=[],o=l*Math.PI/180,e=(c*Math.PI/180-o)/(i-1);for(let s=0;s<i;s++){let p=o+s*e,m=n+r*Math.cos(p),d=t+r*Math.sin(p);f.push({x:-m,y:-d})}return f}x($t,"generateCirclePoints");async function Be(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let{shapeSvg:l,bbox:c,label:f}=await T(n,t,M(t)),o=t.look==="neo"?18:t.padding??0,h=t.look==="neo"?12:t.padding??0,a=c.width+o,e=c.height+h,s=Math.max(5,e*.1),{cssStyles:p}=t,m=[...$t(a/2,-e/2,s,30,-90,0),{x:-a/2-s,y:s},...$t(a/2+s*2,-s,s,20,-180,-270),...$t(a/2+s*2,s,s,20,-90,-180),{x:-a/2-s,y:-e/2},...$t(a/2,e/2,s,20,0,90)],d=[{x:a/2,y:-e/2-s},{x:-a/2,y:-e/2-s},...$t(a/2,-e/2,s,20,-90,0),{x:-a/2-s,y:-s},...$t(a/2+a*.1,-s,s,20,-180,-270),...$t(a/2+a*.1,s,s,20,-90,-180),{x:-a/2-s,y:e/2},...$t(a/2,e/2,s,20,0,90),{x:-a/2,y:e/2+s},{x:a/2,y:e/2+s}],g=k.svg(l),u=P(t,{fill:"none"});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let b=_(m).replace("Z",""),S=g.path(b,u),w=_(d),$=g.path(w,{...u}),B=l.insert("g",":first-child");return B.insert(()=>$,":first-child").attr("stroke-opacity",0),B.insert(()=>S,":first-child"),B.attr("class","text"),p&&t.look!=="handDrawn"&&B.selectAll("path").attr("style",p),i&&t.look!=="handDrawn"&&B.selectAll("path").attr("style",i),B.attr("transform",`translate(${s}, 0)`),f.attr("transform",`translate(${-a/2+s-(c.x-(c.left??0))},${-e/2+(t.padding??0)/2-(c.y-(c.top??0))})`),D(t,B),t.intersect=function(C){return N.polygon(t,d,C)},l}x(Be,"curlyBraceLeft");function Dt(n,t,r,i=100,l=0,c=180){let f=[],o=l*Math.PI/180,e=(c*Math.PI/180-o)/(i-1);for(let s=0;s<i;s++){let p=o+s*e,m=n+r*Math.cos(p),d=t+r*Math.sin(p);f.push({x:m,y:d})}return f}x(Dt,"generateCirclePoints");async function Ge(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let{shapeSvg:l,bbox:c,label:f}=await T(n,t,M(t)),o=t.look==="neo"?18:t.padding??0,h=t.look==="neo"?12:t.padding??0,a=c.width+(t.look==="neo"?o*2:o),e=c.height+(t.look==="neo"?h*2:h),s=Math.max(5,e*.1),{cssStyles:p}=t,m=[...Dt(a/2,-e/2,s,20,-90,0),{x:a/2+s,y:-s},...Dt(a/2+s*2,-s,s,20,-180,-270),...Dt(a/2+s*2,s,s,20,-90,-180),{x:a/2+s,y:e/2},...Dt(a/2,e/2,s,20,0,90)],d=[{x:-a/2,y:-e/2-s},{x:a/2,y:-e/2-s},...Dt(a/2,-e/2,s,20,-90,0),{x:a/2+s,y:-s},...Dt(a/2+s*2,-s,s,20,-180,-270),...Dt(a/2+s*2,s,s,20,-90,-180),{x:a/2+s,y:e/2},...Dt(a/2,e/2,s,20,0,90),{x:a/2,y:e/2+s},{x:-a/2,y:e/2+s}],g=k.svg(l),u=P(t,{fill:"none"});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let b=_(m).replace("Z",""),S=g.path(b,u),w=_(d),$=g.path(w,{...u}),B=l.insert("g",":first-child");return B.insert(()=>$,":first-child").attr("stroke-opacity",0),B.insert(()=>S,":first-child"),B.attr("class","text"),p&&t.look!=="handDrawn"&&B.selectAll("path").attr("style",p),i&&t.look!=="handDrawn"&&B.selectAll("path").attr("style",i),B.attr("transform",`translate(${-s}, 0)`),f.attr("transform",`translate(${-a/2+(t.padding??0)/2-(c.x-(c.left??0))},${-e/2+(t.padding??0)/2-(c.y-(c.top??0))})`),D(t,B),t.intersect=function(C){return N.polygon(t,d,C)},l}x(Ge,"curlyBraceRight");function st(n,t,r,i=100,l=0,c=180){let f=[],o=l*Math.PI/180,e=(c*Math.PI/180-o)/(i-1);for(let s=0;s<i;s++){let p=o+s*e,m=n+r*Math.cos(p),d=t+r*Math.sin(p);f.push({x:-m,y:-d})}return f}x(st,"generateCirclePoints");async function Ee(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let{shapeSvg:l,bbox:c,label:f}=await T(n,t,M(t)),o=t.look==="neo"?18:t.padding??0,h=t.look==="neo"?12:t.padding??0,a=c.width+(t.look==="neo"?o*2:o),e=c.height+(t.look==="neo"?h*2:h),s=Math.max(5,e*.1),{cssStyles:p}=t,m=[...st(a/2,-e/2,s,30,-90,0),{x:-a/2-s,y:s},...st(a/2+s*2,-s,s,20,-180,-270),...st(a/2+s*2,s,s,20,-90,-180),{x:-a/2-s,y:-e/2},...st(a/2,e/2,s,20,0,90)],d=[...st(-a/2+s+s/2,-e/2,s,20,-90,-180),{x:a/2-s/2,y:s},...st(-a/2-s/2,-s,s,20,0,90),...st(-a/2-s/2,s,s,20,-90,0),{x:a/2-s/2,y:-s},...st(-a/2+s+s/2,e/2,s,30,-180,-270)],g=[{x:a/2,y:-e/2-s},{x:-a/2,y:-e/2-s},...st(a/2,-e/2,s,20,-90,0),{x:-a/2-s,y:-s},...st(a/2+s*2,-s,s,20,-180,-270),...st(a/2+s*2,s,s,20,-90,-180),{x:-a/2-s,y:e/2},...st(a/2,e/2,s,20,0,90),{x:-a/2,y:e/2+s},{x:a/2-s-s/2,y:e/2+s},...st(-a/2+s+s/2,-e/2,s,20,-90,-180),{x:a/2-s/2,y:s},...st(-a/2-s/2,-s,s,20,0,90),...st(-a/2-s/2,s,s,20,-90,0),{x:a/2-s/2,y:-s},...st(-a/2+s+s/2,e/2,s,30,-180,-270)],u=k.svg(l),y=P(t,{fill:"none"});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let S=_(m).replace("Z",""),w=u.path(S,y),B=_(d).replace("Z",""),C=u.path(B,y),G=_(g),V=u.path(G,{...y}),A=l.insert("g",":first-child");return A.insert(()=>V,":first-child").attr("stroke-opacity",0),A.insert(()=>w,":first-child"),A.insert(()=>C,":first-child"),A.attr("class","text"),p&&t.look!=="handDrawn"&&A.selectAll("path").attr("style",p),i&&t.look!=="handDrawn"&&A.selectAll("path").attr("style",i),A.attr("transform",`translate(${s-s/4}, 0)`),f.attr("transform",`translate(${-a/2+(t.padding??0)/2-(c.x-(c.left??0))},${-e/2+(t.padding??0)/2-(c.y-(c.top??0))})`),D(t,A),t.intersect=function(R){return N.polygon(t,g,R)},l}x(Ee,"curlyBraces");async function Re(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=t.look==="neo"?16:l,f=t.look==="neo"?12:l,o=20,h=5,{shapeSvg:a,bbox:e}=await T(n,t,M(t)),s=Math.max(h,e.height+f*2,t?.height??0),p=s/2,m=p-Math.sqrt(Math.max(0,p**2-(e.height/2)**2)),d=Math.max(s/4,m),g=Math.max(o,e.width+c*2+d*2,(e.width+c*2)*1.25,t?.width??0),{cssStyles:u}=t,y=k.svg(a),b=P(t,{});t.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");let S=g,w=s,$=S-p,B=w/4,C=[{x:$,y:0},{x:B,y:0},{x:0,y:w/2},{x:B,y:w},{x:$,y:w},...nt(-$,-w/2,p,50,270,90)],G=_(C),V=y.path(G,b),A=a.insert(()=>V,":first-child");return A.attr("class","basic label-container outer-path"),u&&t.look!=="handDrawn"&&A.selectChildren("path").attr("style",u),i&&t.look!=="handDrawn"&&A.selectChildren("path").attr("style",i),A.attr("transform",`translate(${-g/2}, ${-s/2})`),D(t,A),t.intersect=function(R){return N.polygon(t,C,R)},a}x(Re,"curvedTrapezoid");async function Ae(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let{shapeSvg:l,bbox:c,label:f}=await T(n,t,M(t)),o=t.padding??20,h=Math.max(c.width+o*2,t.width??0,100),a=Math.min(Math.max(h*.23,16),56),e=a*.27,s=Math.max(c.height+o*2,t.height?t.height-(2*a-e):0),p=Math.min(h*.177,s*.45),m=s+2*a-e,d=-m/2,g=d+2*a-e,u=l.insert("g",":first-child").attr("class","basic label-container"),{cssStyles:y}=t;if(t.look==="handDrawn"){let G=k.svg(l),V=P(t,{}),A=G.path(tt(-h/2,g,h,s,p),V),R=G.circle(0,d+a,a*2,V);u.insert(()=>R,":first-child"),u.insert(()=>A,":first-child"),y&&u.attr("style",y)}else u.append("rect").attr("x",-h/2).attr("y",g).attr("width",h).attr("height",s).attr("rx",p).attr("ry",p).attr("style",i),u.append("circle").attr("cx",0).attr("cy",d+a).attr("r",a).attr("style",i);D(t,u);let b=g+s/2;f.attr("transform",`translate(${-(c.width/2)-(c.x-(c.left??0))}, ${b-c.height/2-(c.y-(c.top??0))})`);let S=d+a,w=Math.asin(Math.min(1,(g-S)/a))*180/Math.PI,C=[...nt(0,-S,a,24,180+w,-w),...nt(-(-h/2+p),-(g+p),p,12,90,0),...nt(-(-h/2+p),-(m/2-p),p,12,360,270),...nt(-(h/2-p),-(m/2-p),p,12,270,180),...nt(-(h/2-p),-(g+p),p,12,180,90)];return t.intersect=function(G){return N.polygon(t,C,G)},l}x(Ae,"person");var Br=x((n,t,r,i,l,c)=>[`M${n},${t+c}`,`a${l},${c} 0,0,0 ${r},0`,`a${l},${c} 0,0,0 ${-r},0`,`l0,${i}`,`a${l},${c} 0,0,0 ${r},0`,`l0,${-i}`].join(" "),"createCylinderPathD"),Gr=x((n,t,r,i,l,c)=>[`M${n},${t+c}`,`M${n+r},${t+c}`,`a${l},${c} 0,0,0 ${-r},0`,`l0,${i}`,`a${l},${c} 0,0,0 ${r},0`,`l0,${-i}`].join(" "),"createOuterCylinderPathD"),Er=x((n,t,r,i,l,c)=>[`M${n-r/2},${-i/2}`,`a${l},${c} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),He=8,je=8;async function Oe(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=t.look==="neo"?24:l,f=t.look==="neo"?24:l,o=t.width??0;if(t.width&&(t.width=t.width-f,t.width<je&&(t.width=je)),t.height){let b=o/2/(2.5+o/50);t.height=t.height-c-b*3,t.height<He&&(t.height=He)}let{shapeSvg:h,bbox:a,label:e}=await T(n,t,M(t)),s=Math.max(t.width??0,a.width)+f,p=s/2,m=p/(2.5+s/50),d=Math.max(t.height??0,a.height)+c+m,g,{cssStyles:u}=t;if(t.look==="handDrawn"){let y=k.svg(h),b=Gr(0,0,s,d,p,m),S=Er(0,m,s,d,p,m),w=P(t,{}),$=y.path(b,w),B=y.path(S,P(t,{fill:"none"}));g=h.insert(()=>B,":first-child"),g=h.insert(()=>$,":first-child"),g.attr("class","basic label-container"),u&&g.attr("style",u)}else{let y=Br(0,0,s,d,p,m);g=h.insert("path",":first-child").attr("d",y).attr("class","basic label-container outer-path").attr("style",q(u)).attr("style",i)}return g.attr("label-offset-y",m),g.attr("transform",`translate(${-s/2}, ${-(d/2+m)})`),D(t,g),e.attr("transform",`translate(${-(a.width/2)-(a.x-(a.left??0))}, ${-(a.height/2)+(t.padding??0)/1.5-(a.y-(a.top??0))})`),t.intersect=function(y){let b=N.rect(t,y),S=b.x-(t.x??0);if(p!=0&&(Math.abs(S)<(t.width??0)/2||Math.abs(S)==(t.width??0)/2&&Math.abs(b.y-(t.y??0))>(t.height??0)/2-m)){let w=m*m*(1-S*S/(p*p));w>0&&(w=Math.sqrt(w)),w=m-w,y.y-(t.y??0)>0&&(w=-w),b.y+=w}return b},h}x(Oe,"cylinder");async function ft(n,t,r){let{labelStyles:i,nodeStyles:l}=v(t);t.labelStyle=i;let{shapeSvg:c,bbox:f}=await T(n,t,M(t)),o=Math.max(f.width+r.labelPaddingX*2,t?.width||0),h=Math.max(f.height+r.labelPaddingY*2,t?.height||0),a=-o/2,e=-h/2,s,{rx:p,ry:m}=t,{cssStyles:d}=t;if(r?.rx&&r.ry&&(p=r.rx,m=r.ry),t.look==="handDrawn"){let g=k.svg(c),u=P(t,{}),y=p||m?g.path(tt(a,e,o,h,p||0),u):g.rectangle(a,e,o,h,u);s=c.insert(()=>y,":first-child"),s.attr("class","basic label-container").attr("style",q(d))}else s=c.insert("rect",":first-child"),s.attr("class","basic label-container").attr("style",l).attr("rx",q(p)).attr("ry",q(m)).attr("x",a).attr("y",e).attr("width",o).attr("height",h);return D(t,s,t.look==="handDrawn"?void 0:{width:o,height:h}),t.calcIntersect=function(g,u){return N.rect(g,u)},t.intersect=function(g){return N.rect(t,g)},c}x(ft,"drawRect");async function Le(n,t){let{cssClasses:r,labelPaddingX:i,labelPaddingY:l,padding:c,width:f,height:o}=t,h={rx:0,ry:0,classes:r??"",labelPaddingX:i??(c??0)*2,labelPaddingY:l??c??0},a=await ft(n,t,h);if(t.look==="handDrawn"){let m=k.svg(a),d=P(t,{}),g=a.select(".basic.label-container > path:nth-child(2)"),u=g.node();if(!u)return a;let y=null;if(u instanceof SVGGraphicsElement)y=u.getBBox();else return a;return a.insert(()=>m.line(y.x,y.y,y.x+y.width,y.y,d),".basic.label-container g.label"),a.insert(()=>m.line(y.x,y.y+y.height,y.x+y.width,y.y+y.height,d),".basic.label-container g.label"),g.remove(),a}let e=a.select(".basic.label-container"),s=(Number(e.attr("width"))||f)??0,p=(Number(e.attr("height"))||o)??0;return s>0&&p>0&&e.attr("stroke-dasharray",`${s} ${p}`),a}x(Le,"datastore");async function Ie(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.look==="neo"?16:t.padding??0,c=t.look==="neo"?16:t.padding??0,{shapeSvg:f,bbox:o,label:h}=await T(n,t,M(t)),a=o.width+l,e=o.height+c,s=e*.2,p=-a/2,m=-e/2-s/2,{cssStyles:d}=t,g=k.svg(f),u=P(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let y=[{x:p,y:m+s},{x:-p,y:m+s},{x:-p,y:-m},{x:p,y:-m},{x:p,y:m},{x:-p,y:m},{x:-p,y:m+s}],b=g.polygon(y.map(w=>[w.x,w.y]),u),S=f.insert(()=>b,":first-child");return S.attr("class","basic label-container outer-path"),d&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",d),i&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",i),h.attr("transform",`translate(${p+(t.padding??0)/2-(o.x-(o.left??0))}, ${m+s+(t.padding??0)/2-(o.y-(o.top??0))})`),D(t,S),t.intersect=function(w){return N.rect(t,w)},f}x(Ie,"dividedRectangle");async function Ve(n,t){let{labelStyles:r,nodeStyles:i}=v(t),l=t.look==="neo"?12:5;t.labelStyle=r;let c=t.padding??0,f=t.look==="neo"?16:c,{shapeSvg:o,bbox:h}=await T(n,t,M(t)),a=Math.sqrt(h.width**2+h.height**2)/2,e=(t?.width?t?.width/2:a)+(f??0),s=e+l,p,{cssStyles:m}=t;if(t.look==="handDrawn"){let d=k.svg(o),g=P(t,{roughness:.2,strokeWidth:2.5}),u=P(t,{roughness:.2,strokeWidth:1.5}),y=d.circle(0,0,s*2,g),b=d.circle(0,0,e*2,u);p=o.insert("g",":first-child"),p.attr("class",q(t.cssClasses)).attr("style",q(m)),p.node()?.appendChild(y),p.node()?.appendChild(b)}else{p=o.insert("g",":first-child");let d=p.insert("circle",":first-child"),g=p.insert("circle");p.attr("class","basic label-container").attr("style",i),d.attr("class","outer-circle").attr("style",i).attr("r",s).attr("cx",0).attr("cy",0),g.attr("class","inner-circle").attr("style",i).attr("r",e).attr("cx",0).attr("cy",0)}return D(t,p),t.intersect=function(d){return X.info("DoubleCircle intersect",t,s,d),N.circle(t,s,d)},o}x(Ve,"doublecircle");async function We(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let{shapeSvg:l,bbox:c,halfPadding:f}=await T(n,t,M(t)),{theme:o,themeVariables:h}=U();lt(l,t.colorIndex,o,h.borderColorArray);let a=f??10,e=c.width/2+a*2,s=c.height/2+a*2,p,{cssStyles:m}=t;if(t.look==="handDrawn"){let d=k.svg(l),g=P(t,{}),u=d.ellipse(0,0,e*2,s*2,g);p=l.insert(()=>u,":first-child"),p.attr("class","basic label-container"),m&&p.attr("style",m)}else p=l.insert("ellipse",":first-child").attr("class","basic label-container").attr("style",i).attr("rx",e).attr("ry",s).attr("cx",0).attr("cy",0);return t.width=e*2,t.height=s*2,D(t,p),t.calcIntersect=function(d,g){let u=d.width/2,y=d.height/2;return N.ellipse(d,u,y,g)},t.intersect=function(d){return N.ellipse(t,e,s,d)},l}x(We,"usecaseEllipse");function _e(n,t,{config:{themeVariables:r}}){let{labelStyles:i,nodeStyles:l}=v(t);t.label="",t.labelStyle=i;let c=n.insert("g").attr("class",M(t)).attr("id",t.domId??t.id),f=7,{cssStyles:o}=t,h=k.svg(c),{nodeBorder:a}=r,e=P(t,{fillStyle:"solid"});t.look!=="handDrawn"&&(e.roughness=0);let s=h.circle(0,0,f*2,e),p=c.insert(()=>s,":first-child");return p.selectAll("path").attr("style",`fill: ${a} !important;`),o&&o.length>0&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",o),l&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",l),D(t,p),t.intersect=function(m){return X.info("filledCircle intersect",t,{radius:f,point:m}),N.circle(t,f,m)},c}x(_e,"filledCircle");var Ye=10,Fe=10;async function Xe(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=t.look==="neo"?l*2:l;(t.width||t.height)&&(t.height=t?.height??0,t.height<Ye&&(t.height=Ye),t.width=(t?.width??0)-c-c/2,t.width<Fe&&(t.width=Fe));let{shapeSvg:f,bbox:o,label:h}=await T(n,t,M(t)),a=(t?.width?t?.width:o.width)+(c??0),e=t?.height?t?.height:a+o.height,s=e,p=[{x:0,y:-e},{x:s,y:-e},{x:s/2,y:0}],{cssStyles:m}=t,d=k.svg(f),g=P(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let u=_(p),y=d.path(u,g),b=f.insert(()=>y,":first-child").attr("transform",`translate(${-e/2}, ${e/2})`).attr("class","outer-path");return m&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",m),i&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",i),t.width=a,t.height=e,D(t,b),h.attr("transform",`translate(${-o.width/2-(o.x-(o.left??0))}, ${-e/2+(t.padding??0)/2+(o.y-(o.top??0))})`),t.intersect=function(S){return X.info("Triangle intersect",t,p,S),N.polygon(t,p,S)},f}x(Xe,"flippedTriangle");async function Ue(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let{shapeSvg:l,bbox:c,label:f}=await T(n,t,M(t)),o=t.padding??12,h=Math.max(c.width+o*2,t.width??0,90),a=c.height+o*2,e=Math.max(Math.min(a*.16,14),8),s=Math.max(a+e,t.height??0),p=s-e,m=Math.max(h*.38,28),d=-s/2,g=[{x:-h/2,y:d},{x:-h/2+m,y:d},{x:-h/2+m,y:d+e},{x:h/2,y:d+e},{x:h/2,y:s/2},{x:-h/2,y:s/2}],u=[`M${g[0].x},${g[0].y}`,...g.slice(1).map(w=>`L${w.x},${w.y}`),"Z"].join(" "),{cssStyles:y}=t,b;if(t.look==="handDrawn"){let $=k.svg(l).path(u,P(t,{}));b=l.insert(()=>$,":first-child").attr("class","basic label-container"),y&&b.attr("style",y)}else b=l.insert("path",":first-child").attr("d",u).attr("class","basic label-container").attr("style",i);t.look==="handDrawn"?D(t,b):D(t,b,{width:h,height:s});let S=d+e+p/2;return f.attr("transform",`translate(${-(c.width/2)-(c.x-(c.left??0))}, ${S-c.height/2-(c.y-(c.top??0))})`),t.intersect=function(w){return N.polygon(t,g,w)},l}x(Ue,"folder");function qe(n,t,{dir:r,config:{state:i,themeVariables:l}}){let{nodeStyles:c}=v(t);t.label="";let f=n.insert("g").attr("class",M(t)).attr("id",t.domId??t.id),{cssStyles:o}=t,h=Math.max(70,t?.width??0),a=Math.max(10,t?.height??0);(r==="LR"||r==="RL")&&(h=Math.max(10,t?.width??0),a=Math.max(70,t?.height??0));let e=-1*h/2,s=-1*a/2,p=k.svg(f),m=P(t,{stroke:l.lineColor,fill:l.lineColor});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");let d=p.rectangle(e,s,h,a,m),g=f.insert(()=>d,":first-child");o&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",o),c&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",c),D(t,g);let u=i?.padding??0;return t.width&&t.height&&(t.width+=u/2||0,t.height+=u/2||0),t.intersect=function(y){return N.rect(t,y)},f}x(qe,"forkJoin");async function ze(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=15,c=10,f=t.look==="neo"?16:t.padding??0,o=t.look==="neo"?12:t.padding??0;(t.width||t.height)&&(t.height=(t?.height??0)-o*2,t.height<c&&(t.height=c),t.width=(t?.width??0)-f*2,t.width<l&&(t.width=l));let{shapeSvg:h,bbox:a}=await T(n,t,M(t)),e=(t?.height?t?.height:Math.max(c,a.height))+o*2,s=e/2,p=s-Math.sqrt(Math.max(0,s**2-(a.height/2)**2)),m=(t?.width?t?.width:Math.max(l,a.width)+p*2)+f*2,{cssStyles:d}=t,g=k.svg(h),u=P(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let y=[{x:-m/2,y:-e/2},{x:m/2-s,y:-e/2},...nt(-m/2+s,0,s,50,90,270),{x:m/2-s,y:e/2},{x:-m/2,y:e/2}],b=_(y),S=g.path(b,u),w=h.insert(()=>S,":first-child");return w.attr("class","basic label-container outer-path"),d&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",d),i&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",i),D(t,w),t.intersect=function($){return X.info("Pill intersect",t,{radius:s,point:$}),N.polygon(t,y,$)},h}x(ze,"halfRoundedRectangle");var Rr=x((n,t,r,i,l)=>[`M${n+l},${t}`,`L${n+r-l},${t}`,`L${n+r},${t-i/2}`,`L${n+r-l},${t-i}`,`L${n+l},${t-i}`,`L${n},${t-i/2}`,"Z"].join(" "),"createHexagonPathD");async function Ze(n,t){let{labelStyles:r,nodeStyles:i}=v(t),l=t.look==="neo"?3.5:4;t.labelStyle=r;let c=t.padding??0,f=70,o=32,h=t.look==="neo"?f:c,a=t.look==="neo"?o:c;if(t.width||t.height){let S=(t.height??0)/l;t.width=(t?.width??0)-2*S-a,t.height=(t.height??0)-h}let{shapeSvg:e,bbox:s}=await T(n,t,M(t)),p=(t?.height?t?.height:s.height)+h,m=p/l,d=(t?.width?t?.width:s.width)+2*m+a,g=[{x:m,y:0},{x:d-m,y:0},{x:d,y:-p/2},{x:d-m,y:-p},{x:m,y:-p},{x:0,y:-p/2}],u,{cssStyles:y}=t;if(t.look==="handDrawn"){let b=k.svg(e),S=P(t,{}),w=Rr(0,0,d,p,m),$=b.path(w,S);u=e.insert(()=>$,":first-child").attr("transform",`translate(${-d/2}, ${p/2})`),y&&u.attr("style",y)}else u=et(e,d,p,g);return i&&u.attr("style",i),t.width=d,t.height=p,D(t,u),t.intersect=function(b){return N.polygon(t,g,b)},e}x(Ze,"hexagon");async function Je(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.label="",t.labelStyle=r;let{shapeSvg:l}=await T(n,t,M(t)),c=Math.max(30,t?.width??0),f=Math.max(30,t?.height??0),{cssStyles:o}=t,h=k.svg(l),a=P(t,{});t.look!=="handDrawn"&&(a.roughness=0,a.fillStyle="solid");let e=[{x:0,y:0},{x:c,y:0},{x:0,y:f},{x:c,y:f}],s=_(e),p=h.path(s,a),m=l.insert(()=>p,":first-child");return m.attr("class","basic label-container outer-path"),o&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",o),i&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",i),m.attr("transform",`translate(${-c/2}, ${-f/2})`),D(t,m),t.intersect=function(d){return X.info("Pill intersect",t,{points:e}),N.polygon(t,e,d)},l}x(Je,"hourglass");async function Ke(n,t,{config:{themeVariables:r,flowchart:i}}){let{labelStyles:l}=v(t);t.labelStyle=l;let c=t.assetHeight??48,f=t.assetWidth??48,o=Math.max(c,f),h=i?.wrappingWidth;t.width=Math.max(o,h??0);let{shapeSvg:a,bbox:e,label:s}=await T(n,t,"icon-shape default"),p=t.pos==="t",m=o,d=o,{nodeBorder:g}=r,{stylesMap:u}=yt(t),y=-d/2,b=-m/2,S=t.label?8:0,w=k.svg(a),$=P(t,{stroke:"none",fill:"none"});t.look!=="handDrawn"&&($.roughness=0,$.fillStyle="solid");let B=w.rectangle(y,b,d,m,$),C=Math.max(d,e.width),G=m+e.height+S,V=w.rectangle(-C/2,-G/2,C,G,{...$,fill:"transparent",stroke:"none"}),A=a.insert(()=>B,":first-child"),R=a.insert(()=>V);if(t.icon){let j=a.append("g");j.html(`<g>${await gt(t.icon,{height:o,width:o,fallbackPrefix:""})}</g>`);let E=j.node().getBBox(),O=E.width,L=E.height,H=E.x,I=E.y;j.attr("transform",`translate(${-O/2-H},${p?e.height/2+S/2-L/2-I:-e.height/2-S/2-L/2-I})`),j.attr("style",`color: ${u.get("stroke")??g};`)}return s.attr("transform",`translate(${-e.width/2-(e.x-(e.left??0))},${p?-G/2:G/2-e.height})`),A.attr("transform",`translate(0,${p?e.height/2+S/2:-e.height/2-S/2})`),D(t,R),t.intersect=function(j){if(X.info("iconSquare intersect",t,j),!t.label)return N.rect(t,j);let E=t.x??0,O=t.y??0,L=t.height??0,H=[];return p?H=[{x:E-e.width/2,y:O-L/2},{x:E+e.width/2,y:O-L/2},{x:E+e.width/2,y:O-L/2+e.height+S},{x:E+d/2,y:O-L/2+e.height+S},{x:E+d/2,y:O+L/2},{x:E-d/2,y:O+L/2},{x:E-d/2,y:O-L/2+e.height+S},{x:E-e.width/2,y:O-L/2+e.height+S}]:H=[{x:E-d/2,y:O-L/2},{x:E+d/2,y:O-L/2},{x:E+d/2,y:O-L/2+m},{x:E+e.width/2,y:O-L/2+m},{x:E+e.width/2/2,y:O+L/2},{x:E-e.width/2,y:O+L/2},{x:E-e.width/2,y:O-L/2+m},{x:E-d/2,y:O-L/2+m}],N.polygon(t,H,j)},a}x(Ke,"icon");async function Qe(n,t,{config:{themeVariables:r,flowchart:i}}){let{labelStyles:l}=v(t);t.labelStyle=l;let c=t.assetHeight??48,f=t.assetWidth??48,o=Math.max(c,f),h=i?.wrappingWidth;t.width=Math.max(o,h??0);let{shapeSvg:a,bbox:e,label:s}=await T(n,t,"icon-shape default"),p=20,m=t.label?8:0,d=t.pos==="t",{nodeBorder:g,mainBkg:u}=r,{stylesMap:y}=yt(t),b=k.svg(a),S=P(t,{});t.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");let w=y.get("fill");S.stroke=w??u;let $=a.append("g");t.icon&&$.html(`<g>${await gt(t.icon,{height:o,width:o,fallbackPrefix:""})}</g>`);let B=$.node().getBBox(),C=B.width,G=B.height,V=B.x,A=B.y,R=Math.max(C,G)*Math.SQRT2+p*2,j=b.circle(0,0,R,S),E=Math.max(R,e.width),O=R+e.height+m,L=b.rectangle(-E/2,-O/2,E,O,{...S,fill:"transparent",stroke:"none"}),H=a.insert(()=>j,":first-child"),I=a.insert(()=>L);return $.attr("transform",`translate(${-C/2-V},${d?e.height/2+m/2-G/2-A:-e.height/2-m/2-G/2-A})`),$.attr("style",`color: ${y.get("stroke")??g};`),s.attr("transform",`translate(${-e.width/2-(e.x-(e.left??0))},${d?-O/2:O/2-e.height})`),H.attr("transform",`translate(0,${d?e.height/2+m/2:-e.height/2-m/2})`),D(t,I),t.intersect=function(W){return X.info("iconSquare intersect",t,W),N.rect(t,W)},a}x(Qe,"iconCircle");async function ts(n,t,{config:{themeVariables:r,flowchart:i}}){let{labelStyles:l}=v(t);t.labelStyle=l;let c=t.assetHeight??48,f=t.assetWidth??48,o=Math.max(c,f),h=i?.wrappingWidth;t.width=Math.max(o,h??0);let{shapeSvg:a,bbox:e,halfPadding:s,label:p}=await T(n,t,"icon-shape default"),m=t.pos==="t",d=o+s*2,g=o+s*2,{nodeBorder:u,mainBkg:y}=r,{stylesMap:b}=yt(t),S=-g/2,w=-d/2,$=t.label?8:0,B=k.svg(a),C=P(t,{});t.look!=="handDrawn"&&(C.roughness=0,C.fillStyle="solid");let G=b.get("fill");C.stroke=G??y;let V=B.path(tt(S,w,g,d,5),C),A=Math.max(g,e.width),R=d+e.height+$,j=B.rectangle(-A/2,-R/2,A,R,{...C,fill:"transparent",stroke:"none"}),E=a.insert(()=>V,":first-child").attr("class","icon-shape2"),O=a.insert(()=>j);if(t.icon){let L=a.append("g");L.html(`<g>${await gt(t.icon,{height:o,width:o,fallbackPrefix:""})}</g>`);let H=L.node().getBBox(),I=H.width,W=H.height,F=H.x,Z=H.y;L.attr("transform",`translate(${-I/2-F},${m?e.height/2+$/2-W/2-Z:-e.height/2-$/2-W/2-Z})`),L.attr("style",`color: ${b.get("stroke")??u};`)}return p.attr("transform",`translate(${-e.width/2-(e.x-(e.left??0))},${m?-R/2:R/2-e.height})`),E.attr("transform",`translate(0,${m?e.height/2+$/2:-e.height/2-$/2})`),D(t,O),t.intersect=function(L){if(X.info("iconSquare intersect",t,L),!t.label)return N.rect(t,L);let H=t.x??0,I=t.y??0,W=t.height??0,F=[];return m?F=[{x:H-e.width/2,y:I-W/2},{x:H+e.width/2,y:I-W/2},{x:H+e.width/2,y:I-W/2+e.height+$},{x:H+g/2,y:I-W/2+e.height+$},{x:H+g/2,y:I+W/2},{x:H-g/2,y:I+W/2},{x:H-g/2,y:I-W/2+e.height+$},{x:H-e.width/2,y:I-W/2+e.height+$}]:F=[{x:H-g/2,y:I-W/2},{x:H+g/2,y:I-W/2},{x:H+g/2,y:I-W/2+d},{x:H+e.width/2,y:I-W/2+d},{x:H+e.width/2/2,y:I+W/2},{x:H-e.width/2,y:I+W/2},{x:H-e.width/2,y:I-W/2+d},{x:H-g/2,y:I-W/2+d}],N.polygon(t,F,L)},a}x(ts,"iconRounded");async function es(n,t,{config:{themeVariables:r,flowchart:i}}){let{labelStyles:l}=v(t);t.labelStyle=l;let c=t.assetHeight??48,f=t.assetWidth??48,o=Math.max(c,f),h=i?.wrappingWidth;t.width=Math.max(o,h??0);let{shapeSvg:a,bbox:e,halfPadding:s,label:p}=await T(n,t,"icon-shape default"),m=t.pos==="t",d=o+s*2,g=o+s*2,{nodeBorder:u,mainBkg:y}=r,{stylesMap:b}=yt(t),S=-g/2,w=-d/2,$=t.label?8:0,B=k.svg(a),C=P(t,{});t.look!=="handDrawn"&&(C.roughness=0,C.fillStyle="solid");let G=b.get("fill");C.stroke=G??y;let V=B.path(tt(S,w,g,d,.1),C),A=Math.max(g,e.width),R=d+e.height+$,j=B.rectangle(-A/2,-R/2,A,R,{...C,fill:"transparent",stroke:"none"}),E=a.insert(()=>V,":first-child"),O=a.insert(()=>j);if(t.icon){let L=a.append("g");L.html(`<g>${await gt(t.icon,{height:o,width:o,fallbackPrefix:""})}</g>`);let H=L.node().getBBox(),I=H.width,W=H.height,F=H.x,Z=H.y;L.attr("transform",`translate(${-I/2-F},${m?e.height/2+$/2-W/2-Z:-e.height/2-$/2-W/2-Z})`),L.attr("style",`color: ${b.get("stroke")??u};`)}return p.attr("transform",`translate(${-e.width/2-(e.x-(e.left??0))},${m?-R/2:R/2-e.height})`),E.attr("transform",`translate(0,${m?e.height/2+$/2:-e.height/2-$/2})`),D(t,O),t.intersect=function(L){if(X.info("iconSquare intersect",t,L),!t.label)return N.rect(t,L);let H=t.x??0,I=t.y??0,W=t.height??0,F=[];return m?F=[{x:H-e.width/2,y:I-W/2},{x:H+e.width/2,y:I-W/2},{x:H+e.width/2,y:I-W/2+e.height+$},{x:H+g/2,y:I-W/2+e.height+$},{x:H+g/2,y:I+W/2},{x:H-g/2,y:I+W/2},{x:H-g/2,y:I-W/2+e.height+$},{x:H-e.width/2,y:I-W/2+e.height+$}]:F=[{x:H-g/2,y:I-W/2},{x:H+g/2,y:I-W/2},{x:H+g/2,y:I-W/2+d},{x:H+e.width/2,y:I-W/2+d},{x:H+e.width/2/2,y:I+W/2},{x:H-e.width/2,y:I+W/2},{x:H-e.width/2,y:I-W/2+d},{x:H-g/2,y:I-W/2+d}],N.polygon(t,F,L)},a}x(es,"iconSquare");async function ss(n,t,{config:{flowchart:r}}){let i=new Image;i.src=t?.img??"",await i.decode();let l=Number(i.naturalWidth.toString().replace("px","")),c=Number(i.naturalHeight.toString().replace("px",""));t.imageAspectRatio=l/c;let{labelStyles:f}=v(t);t.labelStyle=f;let o=r?.wrappingWidth;t.defaultWidth=r?.wrappingWidth;let h=Math.max(t.label?o??0:0,t?.assetWidth??l),a=t.constraint==="on"&&t?.assetHeight?t.assetHeight*t.imageAspectRatio:h,e=t.constraint==="on"?a/t.imageAspectRatio:t?.assetHeight??c;t.width=Math.max(a,o??0);let{shapeSvg:s,bbox:p,label:m}=await T(n,t,"image-shape default"),d=t.pos==="t",g=-a/2,u=-e/2,y=t.label?8:0,b=k.svg(s),S=P(t,{});t.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");let w=b.rectangle(g,u,a,e,S),$=Math.max(a,p.width),B=e+p.height+y,C=b.rectangle(-$/2,-B/2,$,B,{...S,fill:"none",stroke:"none"}),G=s.insert(()=>w,":first-child"),V=s.insert(()=>C);if(t.img){let A=s.append("image");A.attr("href",t.img),A.attr("width",a),A.attr("height",e),A.attr("preserveAspectRatio","none"),A.attr("transform",`translate(${-a/2},${d?B/2-e:-B/2})`)}return m.attr("transform",`translate(${-p.width/2-(p.x-(p.left??0))},${d?-e/2-p.height/2-y/2:e/2-p.height/2+y/2})`),G.attr("transform",`translate(0,${d?p.height/2+y/2:-p.height/2-y/2})`),D(t,V),t.intersect=function(A){if(X.info("iconSquare intersect",t,A),!t.label)return N.rect(t,A);let R=t.x??0,j=t.y??0,E=t.height??0,O=[];return d?O=[{x:R-p.width/2,y:j-E/2},{x:R+p.width/2,y:j-E/2},{x:R+p.width/2,y:j-E/2+p.height+y},{x:R+a/2,y:j-E/2+p.height+y},{x:R+a/2,y:j+E/2},{x:R-a/2,y:j+E/2},{x:R-a/2,y:j-E/2+p.height+y},{x:R-p.width/2,y:j-E/2+p.height+y}]:O=[{x:R-a/2,y:j-E/2},{x:R+a/2,y:j-E/2},{x:R+a/2,y:j-E/2+e},{x:R+p.width/2,y:j-E/2+e},{x:R+p.width/2/2,y:j+E/2},{x:R-p.width/2,y:j+E/2},{x:R-p.width/2,y:j-E/2+e},{x:R-a/2,y:j-E/2+e}],N.polygon(t,O,A)},s}x(ss,"imageSquare");async function rs(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=l,f=t.look==="neo"?l*2:l,{shapeSvg:o,bbox:h}=await T(n,t,M(t)),a=Math.max(h.height+c*2,t.height??0),e=Math.max(h.width+f*2,(t.width??0)-a),s=[{x:0,y:0},{x:e,y:0},{x:e+3*a/6,y:-a},{x:-3*a/6,y:-a}],p,{cssStyles:m}=t;if(t.look==="handDrawn"){let d=k.svg(o),g=P(t,{}),u=_(s),y=d.path(u,g);p=o.insert(()=>y,":first-child").attr("transform",`translate(${-e/2}, ${a/2})`),m&&p.attr("style",m)}else p=et(o,e,a,s);return i&&p.attr("style",i),t.width=e,t.height=a,D(t,p),t.intersect=function(d){return N.polygon(t,s,d)},o}x(rs,"inv_trapezoid");async function os(n,t){let{shapeSvg:r,bbox:i,label:l}=await T(n,t,"label"),c=r.insert("rect",":first-child");return c.attr("width",.1).attr("height",.1),r.attr("class","label edgeLabel"),l.attr("transform",`translate(${-(i.width/2)-(i.x-(i.left??0))}, ${-(i.height/2)-(i.y-(i.top??0))})`),D(t,c),t.intersect=function(h){return N.rect(t,h)},r}x(os,"labelRect");async function as(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=l,f=t.look==="neo"?l*2:l,{shapeSvg:o,bbox:h}=await T(n,t,M(t)),a=Math.max(h.height+c,t.height??0),e=Math.max(h.width+f,(t.width??0)-a),s=[{x:0,y:0},{x:e+3*a/6,y:0},{x:e,y:-a},{x:-(3*a)/6,y:-a}],p,{cssStyles:m}=t;if(t.look==="handDrawn"){let d=k.svg(o),g=P(t,{}),u=_(s),y=d.path(u,g);p=o.insert(()=>y,":first-child").attr("transform",`translate(${-e/2}, ${a/2})`),m&&p.attr("style",m)}else p=et(o,e,a,s);return i&&p.attr("style",i),t.width=e,t.height=a,D(t,p),t.intersect=function(d){return N.polygon(t,s,d)},o}x(as,"lean_left");async function is(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=l,f=t.look==="neo"?l*2:l,{shapeSvg:o,bbox:h}=await T(n,t,M(t)),a=Math.max(h.height+c,t.height??0),e=Math.max(h.width+f,(t.width??0)-a),s=[{x:-3*a/6,y:0},{x:e,y:0},{x:e+3*a/6,y:-a},{x:0,y:-a}],p,{cssStyles:m}=t;if(t.look==="handDrawn"){let d=k.svg(o),g=P(t,{}),u=_(s),y=d.path(u,g);p=o.insert(()=>y,":first-child").attr("transform",`translate(${-e/2}, ${a/2})`),m&&p.attr("style",m)}else p=et(o,e,a,s);return i&&p.attr("style",i),t.width=e,t.height=a,D(t,p),t.intersect=function(d){return N.polygon(t,s,d)},o}x(is,"lean_right");function ns(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.label="",t.labelStyle=r;let l=n.insert("g").attr("class",M(t)).attr("id",t.domId??t.id),{cssStyles:c}=t,f=Math.max(35,t?.width??0),o=Math.max(35,t?.height??0),h=7,a=[{x:f,y:0},{x:0,y:o+h/2},{x:f-2*h,y:o+h/2},{x:0,y:2*o},{x:f,y:o-h/2},{x:2*h,y:o-h/2}],e=k.svg(l),s=P(t,{});t.look!=="handDrawn"&&(s.roughness=0,s.fillStyle="solid");let p=_(a),m=e.path(p,s),d=l.insert(()=>m,":first-child");return d.attr("class","outer-path"),c&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",c),i&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",i),d.attr("transform",`translate(-${f/2},${-o})`),D(t,d),t.intersect=function(g){return X.info("lightningBolt intersect",t,g),N.polygon(t,a,g)},l}x(ns,"lightningBolt");var Ar=x((n,t,r,i,l,c,f)=>[`M${n},${t+c}`,`a${l},${c} 0,0,0 ${r},0`,`a${l},${c} 0,0,0 ${-r},0`,`l0,${i}`,`a${l},${c} 0,0,0 ${r},0`,`l0,${-i}`,`M${n},${t+c+f}`,`a${l},${c} 0,0,0 ${r},0`].join(" "),"createCylinderPathD"),Hr=x((n,t,r,i,l,c,f)=>[`M${n},${t+c}`,`M${n+r},${t+c}`,`a${l},${c} 0,0,0 ${-r},0`,`l0,${i}`,`a${l},${c} 0,0,0 ${r},0`,`l0,${-i}`,`M${n},${t+c+f}`,`a${l},${c} 0,0,0 ${r},0`].join(" "),"createOuterCylinderPathD"),jr=x((n,t,r,i,l,c)=>[`M${n-r/2},${-i/2}`,`a${l},${c} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),ls=10,cs=10;async function hs(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=t.look==="neo"?16:l,f=t.look==="neo"?24:l;if(t.width||t.height){let y=t.width??0;t.width=(t.width??0)-c,t.width<cs&&(t.width=cs);let S=y/2/(2.5+y/50);t.height=(t.height??0)-f-S*3,t.height<ls&&(t.height=ls)}let{shapeSvg:o,bbox:h,label:a}=await T(n,t,M(t)),e=(t?.width?t?.width:h.width)+c*2,s=e/2,p=s/(2.5+e/50),m=(t?.height?t?.height:h.height)+p+f*2,d=m*.1,g,{cssStyles:u}=t;if(t.look==="handDrawn"){let y=k.svg(o),b=Hr(0,0,e,m,s,p,d),S=jr(0,p,e,m,s,p),w=P(t,{}),$=y.path(b,w),B=y.path(S,w);o.insert(()=>B,":first-child").attr("class","line"),g=o.insert(()=>$,":first-child"),g.attr("class","basic label-container"),u&&g.attr("style",u)}else{let y=Ar(0,0,e,m,s,p,d);g=o.insert("path",":first-child").attr("d",y).attr("class","basic label-container outer-path").attr("style",q(u)).attr("style",i)}return g.attr("label-offset-y",p),g.attr("transform",`translate(${-e/2}, ${-(m/2+p)})`),D(t,g),a.attr("transform",`translate(${-(h.width/2)-(h.x-(h.left??0))}, ${-(h.height/2)+p-(h.y-(h.top??0))})`),t.intersect=function(y){let b=N.rect(t,y),S=b.x-(t.x??0);if(s!=0&&(Math.abs(S)<(t.width??0)/2||Math.abs(S)==(t.width??0)/2&&Math.abs(b.y-(t.y??0))>(t.height??0)/2-p)){let w=p*p*(1-S*S/(s*s));w>0&&(w=Math.sqrt(w)),w=p-w,y.y-(t.y??0)>0&&(w=-w),b.y+=w}return b},o}x(hs,"linedCylinder");async function ps(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=t.look==="neo"?16:l,f=t.look==="neo"?12:l;if(t.width||t.height){let w=t.width;t.width=(w??0)*10/11-c*2,t.width<10&&(t.width=10),t.height=(t?.height??0)-f*2,t.height<10&&(t.height=10)}let{shapeSvg:o,bbox:h,label:a}=await T(n,t,M(t)),e=(t?.width?t?.width:h.width)+(c??0)*2,s=(t?.height?t?.height:h.height)+(f??0)*2,p=t.look==="neo"?s/4:s/8,m=s+p,{cssStyles:d}=t,g=k.svg(o),u=P(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let y=[{x:-e/2-e/2*.1,y:-m/2},{x:-e/2-e/2*.1,y:m/2},...ct(-e/2-e/2*.1,m/2,e/2+e/2*.1,m/2,p,.8),{x:e/2+e/2*.1,y:-m/2},{x:-e/2-e/2*.1,y:-m/2},{x:-e/2,y:-m/2},{x:-e/2,y:m/2*1.1},{x:-e/2,y:-m/2}],b=g.polygon(y.map(w=>[w.x,w.y]),u),S=o.insert(()=>b,":first-child");return S.attr("class","basic label-container outer-path"),d&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",d),i&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",i),S.attr("transform",`translate(0,${-p/2})`),a.attr("transform",`translate(${-e/2+(t.padding??0)+e/2*.1/2-(h.x-(h.left??0))},${-s/2+(t.padding??0)-p-(h.y-(h.top??0))})`),D(t,S),t.intersect=function(w){return N.polygon(t,y,w)},o}x(ps,"linedWaveEdgedRect");var Or=56,zt=72,ms=8,fs=2,Lr=8,Ir={normal:"usecase-actor-shape usecase-actor-normal",hollow:"usecase-actor-hollow",awesome:"usecase-actor-awesome",icon:"usecase-actor-icon"},ds=Math.PI/3,gs=.6,Zt=x((n,t)=>{let r=t*gs,i=t*Math.sqrt(1-gs**2),l=Math.cos(ds),c=-Math.sin(ds),f=r*-c,o=n+r*l,h=i*l,a=i*c;return`M ${f-h} ${o-a} L ${f+h} ${o+a}`},"businessMarkerPathForCircle"),Vr={normal:Zt(-24,12),hollow:Zt(-23,9),awesome:Zt(-21,13),icon:"M 12 -8 L 26 -26"},ys=x((n,t,r)=>{let i=(t.x??0)-(t.left??0),l=(t.y??0)-(t.top??0);n.attr("transform",`translate(${-t.width/2-i},${r-t.height/2-l})`)},"positionLabel"),Et=x((n,t,r,i,l=!1)=>{if(t.look==="handDrawn"){let o=k.svg(n).path(r,P(t,l?{fill:"none"}:{}));return n.insert(()=>o,":first-child").attr("class",i)}let c=n.append("path").attr("class",i).attr("d",r);return l&&c.attr("fill","none"),c},"appendActorPath"),us=x((n,t,r,i,l,c,f=!1)=>{if(t.look==="handDrawn"){let a=k.svg(n).circle(r,i,l*2,P(t,f?{fill:"none"}:{}));return n.insert(()=>a,":first-child").attr("class",c)}let o=n.append("circle").attr("class",c).attr("cx",r).attr("cy",i).attr("r",l);return f&&o.attr("fill","none"),o},"appendActorCircle"),Wr=x((n,t,r)=>{t.business&&n.append("path").attr("class","usecase-business-marker usecase-actor-business-marker").attr("d",Vr[r]).attr("fill","none").attr("style","stroke: inherit !important; stroke-width: inherit !important")},"appendBusinessActorMarker");async function vt(n,t,r,i){let{labelStyles:l,nodeStyles:c}=v(t);t.labelStyle=l;let f=r==="icon"||t.stereotype!==void 0?{...t,icon:r==="icon"?void 0:t.icon,stereotype:void 0}:t,{shapeSvg:o,bbox:h,label:a}=await T(n,f,M(t,`usecase-actor-variant usecase-actor-${r}`)),e=t.accessibleName??t.label;e&&o.attr("role","img").attr("aria-label",e),a.attr("class","label actor-label usecase-actor-label");let{theme:s,themeVariables:p}=U();lt(o,t.colorIndex,s,p.borderColorArray);let m,d;if(t.stereotype){let G=await mt(o,`\xAB${t.stereotype}\xBB`,{labelStyle:l,useHtmlLabels:t.useHtmlLabels,padding:0,centerLabel:!0,width:t.wrappingWidth});m=G.label.attr("class","label usecase-stereotype"),d=G.bbox}let g=o.append("g").attr("class",`usecase-actor-glyph ${Ir[r]}`).attr("style",c||null);await i(g,t),Wr(g,t,r);let u=t.padding??Lr,y=d?.height??0,b=zt+ms+h.height+(d?y+fs:0),S=Math.max(Or,h.width,d?.width??0)+u*2,w=b+u*2,$=-b/2;g.attr("transform",`translate(0,${$+zt/2})`);let B=$+zt+ms;m&&d&&(B+=y/2,ys(m,d,B),B+=y/2+fs),ys(a,h,B+h.height/2);let C=o.insert("rect",":first-child").attr("class","usecase-actor-outline").attr("x",-S/2).attr("y",-w/2).attr("width",S).attr("height",w).attr("opacity",0).attr("aria-hidden","true");return D(t,C),t.intersect=G=>N.rect(t,G),o}x(vt,"renderUsecaseActor");var _r=["M 0 -12","C 6.627 -12 12 -17.373 12 -24","C 12 -30.627 6.627 -36 0 -36","C -6.627 -36 -12 -30.627 -12 -24","C -12 -17.373 -6.627 -12 0 -12 Z","M 0 -12 V 8","M -17 -5 H 17","M 0 8 L -15 28","M 0 8 L 15 28"].join(" ");async function xs(n,t){return vt(n,t,"normal",(r,i)=>{Et(r,i,_r,"usecase-actor-stick")})}x(xs,"usecaseActor");var Yr=["M 0 -34","C 7.18 -34 13 -28.18 13 -21","C 13 -13.82 7.18 -8 0 -8","C -7.18 -8 -13 -13.82 -13 -21","C -13 -28.18 -7.18 -34 0 -34 Z","M -24 25","C -24 7 -14 -3 0 -3","C 14 -3 24 7 24 25","C 24 28 21 30 18 30","H -18","C -21 30 -24 28 -24 25 Z"].join(" ");async function bs(n,t){return vt(n,t,"awesome",(r,i)=>{Et(r,i,Yr,"usecase-actor-awesome-silhouette")})}x(bs,"usecaseActorAwesome");var Fr=["M -22 -10","H 22","V 0","H 6","L 22 17","L 13 28","L 0 13","L -13 28","L -22 17","L -6 0","H -22","Z"].join(" ");async function Ss(n,t){return vt(n,t,"hollow",(r,i)=>{us(r,i,0,-23,9,"usecase-actor-hollow-head",!0),Et(r,i,Fr,"usecase-actor-hollow-body",!0)})}x(Ss,"usecaseActorHollow");var Tt=52,ws=42,Ns=-2,Xr=x(async(n,t)=>{let r=-Tt/2,i=Ns-Tt/2;if(t.look==="handDrawn"){let e=k.svg(n).rectangle(r,i,Tt,Tt,P(t,{}));n.insert(()=>e,":first-child").attr("class","usecase-actor-icon-frame")}else n.append("rect").attr("class","usecase-actor-icon-frame").attr("x",r).attr("y",i).attr("width",Tt).attr("height",Tt).attr("rx",4).attr("ry",4);let l=t.icon??"",c=await ae(l.includes(":")?l:`fa:${l}`),f=await gt(l,{height:ws,width:ws,fallbackPrefix:"fa"}),o=n.append("g").attr("class",`usecase-actor-icon-symbol${c?"":" usecase-actor-icon-fallback"}`).attr("aria-hidden","true").html(`<g>${f}</g>`),h=o.node()?.getBBox();h&&o.attr("transform",`translate(${-h.width/2-h.x},${Ns-h.height/2-h.y})`)},"drawIconActor");async function $s(n,t){return vt(n,t,"icon",Xr)}x($s,"usecaseActorIcon");var Ds=x((n,t,r)=>{let i=(t.x??0)-(t.left??0),l=(t.y??0)-(t.top??0);n.attr("transform",`translate(${-t.width/2-i},${r-t.height/2-l})`)},"positionLabel");async function Ps(n,t){let r=t,{labelStyles:i,nodeStyles:l}=v(t);t.labelStyle=i;let c=r.stereotype?{...t,stereotype:void 0}:t,{shapeSvg:f,bbox:o,halfPadding:h,label:a}=await T(n,c,M(t,"usecase-business-shape"));a.attr("class","label usecase-label");let{theme:e,themeVariables:s}=U();lt(f,t.colorIndex,e,s.borderColorArray);let p,m;if(r.stereotype){let E=await mt(f,`\xAB${r.stereotype}\xBB`,{labelStyle:i,useHtmlLabels:t.useHtmlLabels,padding:0,centerLabel:!0,width:t.wrappingWidth});p=E.label.attr("class","label usecase-stereotype"),m=E.bbox}let d=m?2:0,g=o.height+(m?.height??0)+d,u=Math.max(o.width,m?.width??0),y=h??10,b=u/2+y*2,S=g/2+y*2,w=Math.min(Math.max(y/5,1),y/2),$=u/2+w,B=b-w,C=$/b,G=B/b,V=S*Math.sqrt(Math.max(0,1-C*C)),A=-S*Math.sqrt(Math.max(0,1-G*G));p&&m&&Ds(p,m,-g/2+m.height/2),Ds(a,o,g/2-o.height/2);let R;if(t.look==="handDrawn"){let O=k.svg(f).ellipse(0,0,b*2,S*2,P(t,{}));R=f.insert(()=>O,":first-child").attr("class","basic label-container usecase-business-ellipse")}else R=f.insert("ellipse",":first-child").attr("class","basic label-container usecase-business-ellipse").attr("style",l).attr("rx",b).attr("ry",S).attr("cx",0).attr("cy",0);f.append("path").attr("class","usecase-business-marker").attr("d",`M ${$} ${V} L ${B} ${A}`).attr("fill","none").attr("style",l||null);let j=r.accessibleName??r.label;return j&&f.attr("role","img").attr("aria-label",j),D(t,R),t.calcIntersect=(E,O)=>N.ellipse(E,E.width/2,E.height/2,O),t.intersect=E=>N.ellipse(t,b,S,E),f}x(Ps,"usecaseBusiness");var Jt=8,ks=4,Ur=1,Kt=x((n,t,r,i)=>{let l=(t.x??0)-(t.left??0),c=(t.y??0)-(t.top??0);n.attr("transform",`translate(${r-t.width/2-l},${i-t.height/2-c})`)},"positionLabel"),qr=x(n=>{let t=Number.parseFloat(n??"");return Number.isFinite(t)&&t>=0?t:Ur},"numericStrokeWidth");async function vs(n,t){let r=t,{labelStyles:i,nodeStyles:l}=v(t),{stylesMap:c}=yt(t);t.labelStyle=i;let{shapeSvg:f,bbox:o,label:h}=await T(n,t,M(t,"usecase-json-table"));f.attr("role","img"),r.accessibleName&&f.attr("aria-label",r.accessibleName),h.attr("class","label usecase-json-title");let a=f.append("g").attr("class","usecase-json-table-grid"),e=[];for(let E of r.jsonRows??[]){let O=await mt(a,E.key,{labelStyle:i,useHtmlLabels:t.useHtmlLabels,padding:0,centerLabel:!0}),L=await mt(a,E.value,{labelStyle:i,useHtmlLabels:t.useHtmlLabels,padding:0,centerLabel:!0});e.push({key:{label:O.label.attr("class","label usecase-json-key"),bbox:O.bbox},value:{label:L.label.attr("class","label usecase-json-value"),bbox:L.bbox}})}let s=Math.max(0,...e.map(({key:E})=>E.bbox.width))+Jt*2,p=Math.max(0,...e.map(({value:E})=>E.bbox.width))+Jt*2,m=o.width+Jt*2,d=Math.max(m,s+p),g=p+Math.max(0,d-s-p),u=o.height+ks*2,y=e.map(({key:E,value:O})=>Math.max(E.bbox.height,O.bbox.height)+ks*2),b=u+y.reduce((E,O)=>E+O,0),S=qr(c.get("stroke-width")),w=d+S*2,$=b+S*2,B=-d/2,C=-b/2,G=t.look==="handDrawn"?k.svg(f):void 0,V=G?P(t,{}):void 0,A=x((E,O,L,H,I,W)=>{if(G&&V){let F=G.rectangle(L,H,I,W,V);return E.insert(()=>F,":first-child").attr("class",O)}return E.insert("rect",":first-child").attr("class",O).attr("x",L).attr("y",H).attr("width",I).attr("height",W).attr("style",l)},"insertCell"),R=A(f,"label-container usecase-json-border",-w/2,-$/2,w,$);A(a,"usecase-json-cell usecase-json-title-cell",B,C,d,u),a.node()?.append(h.node()),Kt(h,o,0,C+u/2);let j=C+u;return e.forEach(({key:E,value:O},L)=>{let H=y[L],I=a.append("g").attr("class","usecase-json-row").attr("data-row-index",L).attr("transform",`translate(0,${j})`);A(I,"usecase-json-cell usecase-json-key-cell",B,0,s,H),A(I,"usecase-json-cell usecase-json-value-cell",B+s,0,g,H),I.node()?.append(E.label.node(),O.label.node()),Kt(E.label,E.bbox,B+s/2,H/2),Kt(O.label,O.bbox,B+s+g/2,H/2),j+=H}),D(t,R),t.intersect=E=>N.rect(t,E),f}x(vs,"usecaseJsonTable");async function Ms(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=t.look==="neo"?16:l,f=t.look==="neo"?12:l,o=t.look==="neo"?10:5;(t.width||t.height)&&(t.width=Math.max((t?.width??0)-c*2-2*o,10),t.height=Math.max((t?.height??0)-f*2-2*o,10));let{shapeSvg:h,bbox:a,label:e}=await T(n,t,M(t)),s=(t?.width?t?.width:a.width)+c*2+2*o,p=(t?.height?t?.height:a.height)+f*2+2*o,m=s-2*o,d=p-2*o,g=-m/2,u=-d/2,{cssStyles:y}=t,b=k.svg(h),S=P(t,{}),w=[{x:g-o,y:u+o},{x:g-o,y:u+d+o},{x:g+m-o,y:u+d+o},{x:g+m-o,y:u+d},{x:g+m,y:u+d},{x:g+m,y:u+d-o},{x:g+m+o,y:u+d-o},{x:g+m+o,y:u-o},{x:g+o,y:u-o},{x:g+o,y:u},{x:g,y:u},{x:g,y:u+o}],$=[{x:g,y:u+o},{x:g+m-o,y:u+o},{x:g+m-o,y:u+d},{x:g+m,y:u+d},{x:g+m,y:u},{x:g,y:u}];t.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");let B=_(w),C=b.path(B,S),G=_($),V=b.path(G,S);t.look!=="handDrawn"&&(C=Yt(C),V=Yt(V));let A=h.insert("g",":first-child");return A.insert(()=>C),A.insert(()=>V),A.attr("class","basic label-container outer-path"),y&&t.look!=="handDrawn"&&A.selectAll("path").attr("style",y),i&&t.look!=="handDrawn"&&A.selectAll("path").attr("style",i),e.attr("transform",`translate(${-(a.width/2)-o-(a.x-(a.left??0))}, ${-(a.height/2)+o-(a.y-(a.top??0))})`),D(t,A),t.intersect=function(R){return N.polygon(t,w,R)},h}x(Ms,"multiRect");async function Ts(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let{shapeSvg:l,bbox:c,label:f}=await T(n,t,M(t)),o=t.padding??0,h=t.look==="neo"?16:o,a=t.look==="neo"?12:o,e=!0;(t.width||t.height)&&(e=!1,t.width=(t?.width??0)-h*2,t.height=(t?.height??0)-a*3);let s=Math.max(c.width,t?.width??0)+h*2,p=Math.max(c.height,t?.height??0)+a*3,m=t.look==="neo"?p/4:p/8,d=p+(e?m/2:-m/2),g=-s/2,u=-d/2,y=10,{cssStyles:b}=t,S=ct(g-y,u+d+y,g+s-y,u+d+y,m,.8),w=S?.[S.length-1],$=[{x:g-y,y:u+y},{x:g-y,y:u+d+y},...S,{x:g+s-y,y:w.y-y},{x:g+s,y:w.y-y},{x:g+s,y:w.y-2*y},{x:g+s+y,y:w.y-2*y},{x:g+s+y,y:u-y},{x:g+y,y:u-y},{x:g+y,y:u},{x:g,y:u},{x:g,y:u+y}],B=[{x:g,y:u+y},{x:g+s-y,y:u+y},{x:g+s-y,y:w.y-y},{x:g+s,y:w.y-y},{x:g+s,y:u},{x:g,y:u}],C=k.svg(l),G=P(t,{});t.look!=="handDrawn"&&(G.roughness=0,G.fillStyle="solid");let V=_($),A=C.path(V,G),R=_(B),j=C.path(R,G),E=l.insert(()=>A,":first-child");return E.insert(()=>j),E.attr("class","basic label-container outer-path"),b&&t.look!=="handDrawn"&&E.selectAll("path").attr("style",b),i&&t.look!=="handDrawn"&&E.selectAll("path").attr("style",i),E.attr("transform",`translate(0,${-m/2})`),f.attr("transform",`translate(${-(c.width/2)-y-(c.x-(c.left??0))}, ${-(c.height/2)+y-m-(c.y-(c.top??0))})`),D(t,E),t.intersect=function(O){return N.polygon(t,$,O)},l}x(Ts,"multiWaveEdgedRectangle");async function Cs(n,t,{config:{themeVariables:r}}){let{labelStyles:i,nodeStyles:l}=v(t);t.labelStyle=i,t.useHtmlLabels||pt(Nt())||(t.centerLabel=!0);let{shapeSvg:f,bbox:o,label:h}=await T(n,t,M(t)),a=Math.max(o.width+(t.padding??0)*2,t?.width??0),e=Math.max(o.height+(t.padding??0)*2,t?.height??0),s=-a/2,p=-e/2,{cssStyles:m}=t,d=k.svg(f),g=P(t,{fill:r.noteBkgColor,stroke:r.noteBorderColor});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let u=d.rectangle(s,p,a,e,g),y=f.insert(()=>u,":first-child");return y.attr("class","basic label-container outer-path"),h.attr("class","label noteLabel"),m&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",m),l&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",l),h.attr("transform",`translate(${-o.width/2-(o.x-(o.left??0))}, ${-(o.height/2)-(o.y-(o.top??0))})`),D(t,y),t.intersect=function(b){return N.rect(t,b)},f}x(Cs,"note");var zr=x((n,t,r)=>[`M${n+r/2},${t}`,`L${n+r},${t-r/2}`,`L${n+r/2},${t-r}`,`L${n},${t-r/2}`,"Z"].join(" "),"createDecisionBoxPathD");async function Bs(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let{shapeSvg:l,bbox:c}=await T(n,t,M(t)),f=c.width+(t.padding??0),o=c.height+(t.padding??0),h=f+o,a=.5,e=[{x:h/2,y:0},{x:h,y:-h/2},{x:h/2,y:-h},{x:0,y:-h/2}],s,{cssStyles:p}=t;if(t.look==="handDrawn"){let m=k.svg(l),d=P(t,{}),g=zr(0,0,h),u=m.path(g,d);s=l.insert(()=>u,":first-child").attr("transform",`translate(${-h/2+a}, ${h/2})`),p&&s.attr("style",p)}else s=et(l,h,h,e),s.attr("transform",`translate(${-h/2+a}, ${h/2})`);return i&&s.attr("style",i),D(t,s),t.calcIntersect=function(m,d){let g=m.width,u=[{x:g/2,y:0},{x:g,y:-g/2},{x:g/2,y:-g},{x:0,y:-g/2}];return N.polygon(m,u,d)},t.intersect=function(m){return this.calcIntersect(t,m)},l}x(Bs,"question");async function Gs(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=t.look==="neo"?21:l??0,f=t.look==="neo"?12:l??0,{shapeSvg:o,bbox:h,label:a}=await T(n,t,M(t)),e=h.width+(t.look==="neo"?c*2:c),s=Math.max(h.height+(t.look==="neo"?f*2:f),t.height??0),p=s/4,d=-Math.max(e,(t.width??0)-p)/2,g=-s/2,u=g/2,y=[{x:d+u,y:g},{x:d,y:0},{x:d+u,y:-g},{x:-d,y:-g},{x:-d,y:g}],{cssStyles:b}=t,S=k.svg(o),w=P(t,{});t.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");let $=_(y),B=S.path($,w),C=o.insert(()=>B,":first-child");return C.attr("class","basic label-container outer-path"),b&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",b),i&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",i),C.attr("transform",`translate(${-u/2},0)`),a.attr("transform",`translate(${-u/2-h.width/2-(h.x-(h.left??0))}, ${-(h.height/2)-(h.y-(h.top??0))})`),D(t,C),t.intersect=function(G){return N.polygon(t,y,G)},o}x(Gs,"rect_left_inv_arrow");async function Es(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l;t.cssClasses?l="node "+t.cssClasses:l="node default";let c=n.insert("g").attr("class",l).attr("id",t.domId||t.id),f=c.insert("g"),o=c.insert("g").attr("class","label").attr("style",i),h=t.description,a=t.label,e=await Ft(o,a,t.labelStyle,!0,!0),s={width:0,height:0};if(pt(U())){let G=e.children[0],V=J(e);s=G.getBoundingClientRect(),V.attr("width",s.width),V.attr("height",s.height)}X.info("Text 2",h);let p=h||[],m=e.getBBox(),d=await Ft(o,Array.isArray(p)?p.join("<br/>"):p,t.labelStyle,!0,!0),g=d.children[0],u=J(d);s=g.getBoundingClientRect(),u.attr("width",s.width),u.attr("height",s.height);let y=(t.padding||0)/2;J(d).attr("transform","translate( "+(s.width>m.width?0:(m.width-s.width)/2)+", "+(m.height+y+5)+")"),J(e).attr("transform","translate( "+(s.width<m.width?0:-(m.width-s.width)/2)+", 0)"),s=o.node().getBBox(),o.attr("transform","translate("+-s.width/2+", "+(-s.height/2-y+3)+")");let b=s.width+(t.padding||0),S=s.height+(t.padding||0),w=-s.width/2-y,$=-s.height/2-y,B,C;if(t.look==="handDrawn"){let G=k.svg(c),V=P(t,{}),A=G.path(tt(w,$,b,S,t.rx||0),V),R=G.line(-s.width/2-y,-s.height/2-y+m.height+y,s.width/2+y,-s.height/2-y+m.height+y,V);C=c.insert(()=>(X.debug("Rough node insert CXC",A),R),":first-child"),B=c.insert(()=>(X.debug("Rough node insert CXC",A),A),":first-child")}else B=f.insert("rect",":first-child"),C=f.insert("line"),B.attr("class","outer title-state").attr("style",i).attr("x",-s.width/2-y).attr("y",-s.height/2-y).attr("width",s.width+(t.padding||0)).attr("height",s.height+(t.padding||0)),C.attr("class","divider").attr("x1",-s.width/2-y).attr("x2",s.width/2+y).attr("y1",-s.height/2-y+m.height+y).attr("y2",-s.height/2-y+m.height+y);return D(t,B),t.intersect=function(G){return N.rect(t,G)},c}x(Es,"rectWithTitle");async function Rs(n,t,{config:{themeVariables:r}}){let i=r?.radius??5,l={rx:i,ry:i,classes:"",labelPaddingX:(t?.padding??0)*1,labelPaddingY:(t?.padding??0)*1};return ft(n,t,l)}x(Rs,"roundedRect");var Mt=8;async function As(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.look==="neo"?16:t.padding??0,c=t.look==="neo"?12:t.padding??0,{shapeSvg:f,bbox:o,label:h}=await T(n,t,M(t)),a=(t?.width??o.width)+l*2+(t.look==="neo"?Mt:Mt*2),e=(t?.height??o.height)+c*2,s=a-Mt,p=e,m=Mt-a/2,d=-e/2,{cssStyles:g}=t,u=k.svg(f),y=P(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let b=[{x:m,y:d},{x:m+s,y:d},{x:m+s,y:d+p},{x:m-Mt,y:d+p},{x:m-Mt,y:d},{x:m,y:d},{x:m,y:d+p}],S=u.polygon(b.map($=>[$.x,$.y]),y),w=f.insert(()=>S,":first-child");return w.attr("class","basic label-container outer-path").attr("style",q(g)),i&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",i),g&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",i),h.attr("transform",`translate(${Mt/2-o.width/2-(o.x-(o.left??0))}, ${-(o.height/2)-(o.y-(o.top??0))})`),D(t,w),t.intersect=function($){return N.rect(t,$)},f}x(As,"shadedProcess");async function Hs(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=t.look==="neo"?16:l,f=t.look==="neo"?12:l;(t.width||t.height)&&(t.width=Math.max((t?.width??0)-c*2,10),t.height=Math.max((t?.height??0)/1.5-f*2,10));let{shapeSvg:o,bbox:h,label:a}=await T(n,t,M(t)),e=(t?.width?t?.width:h.width)+c*2,s=((t?.height?t?.height:h.height)+f*2)*1.5,p=e,m=s/1.5,d=-p/2,g=-m/2,{cssStyles:u}=t,y=k.svg(o),b=P(t,{});t.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");let S=[{x:d,y:g},{x:d,y:g+m},{x:d+p,y:g+m},{x:d+p,y:g-m/2}],w=_(S),$=y.path(w,b),B=o.insert(()=>$,":first-child");return B.attr("class","basic label-container  outer-path"),u&&t.look!=="handDrawn"&&B.selectChildren("path").attr("style",u),i&&t.look!=="handDrawn"&&B.selectChildren("path").attr("style",i),B.attr("transform",`translate(0, ${m/4})`),a.attr("transform",`translate(${-p/2+(t.padding??0)-(h.x-(h.left??0))}, ${-m/4+(t.padding??0)-(h.y-(h.top??0))})`),D(t,B),t.intersect=function(C){return N.polygon(t,S,C)},o}x(Hs,"slopedRect");async function js(n,t){let r=t.padding??0,i=t.look==="neo"?16:r*2,l=t.look==="neo"?12:r,c={rx:0,ry:0,classes:"",labelPaddingX:t.labelPaddingX??i,labelPaddingY:l},f=await ft(n,t,c);if(t.colorIndex!==void 0){let{theme:o,themeVariables:h}=U();lt(f,t.colorIndex,o,h.borderColorArray)}return f}x(js,"squareRect");var Qt=50,Zr=x((n,t,r)=>{let i=n.height+r,l=i*Math.cos(Math.PI/(2*(Qt-1))),c=Math.sqrt(Math.max(0,l**2-n.height**2));return{w:Math.max(n.width+i/4+t,1.5*i+(i-l),n.width+t+i-c),h:i}},"stadiumDimensions");async function Os(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=t.look==="neo"?40:l,f=t.look==="neo"?24:l,{shapeSvg:o,bbox:h}=await T(n,t,M(t)),{w:a,h:e}=Zr(h,c,f),s=e/2,{cssStyles:p}=t,m=k.svg(o),d=P(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");let g=[{x:-a/2+s,y:-e/2},{x:a/2-s,y:-e/2},...nt(-a/2+s,0,s,Qt,90,270),{x:a/2-s,y:e/2},...nt(a/2-s,0,s,Qt,270,450)],u=_(g),y=m.path(u,d),b=o.insert(()=>y,":first-child");return b.attr("class","basic label-container outer-path"),p&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",p),i&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",i),D(t,b),t.intersect=function(S){return N.polygon(t,g,S)},o}x(Os,"stadium");async function Ls(n,t){let r={rx:t.look==="neo"?3:5,ry:t.look==="neo"?3:5,classes:"flowchart-node"};return ft(n,t,r)}x(Ls,"state");function Is(n,t,{config:{themeVariables:r}}){let{labelStyles:i,nodeStyles:l}=v(t);t.labelStyle=i;let{cssStyles:c}=t,{lineColor:f,stateBorder:o,nodeBorder:h,nodeShadow:a}=r;(t.width||t.height)&&((t.width??0)<14&&(t.width=14),(t.height??0)<14&&(t.height=14)),t.width||(t.width=14),t.height||(t.height=14);let e=n.insert("g").attr("class","node default").attr("id",t.domId??t.id),s=k.svg(e),p=P(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let m=s.circle(0,0,t.width,{...p,stroke:f,strokeWidth:2}),d=o??h,g=(t.width??0)*5/14,u=s.circle(0,0,g,{...p,fill:d,stroke:d,strokeWidth:2,fillStyle:"solid"}),y=e.insert(()=>m,":first-child");if(y.insert(()=>u),t.look!=="handDrawn"&&y.attr("class","outer-path"),c&&y.selectAll("path").attr("style",c),l&&y.selectAll("path").attr("style",l),t.width<25&&a&&t.look!=="handDrawn"){let b=n.node()?.ownerSVGElement?.id??"",S=b?`${b}-drop-shadow-small`:"drop-shadow-small";y.attr("style",`filter:url(#${S})`)}return D(t,y),t.intersect=function(b){return N.circle(t,(t.width??0)/2,b)},e}x(Is,"stateEnd");function Vs(n,t,{config:{themeVariables:r}}){let{lineColor:i,nodeShadow:l}=r;(t.width||t.height)&&((t.width??0)<14&&(t.width=14),(t.height??0)<14&&(t.height=14)),t.width||(t.width=14),t.height||(t.height=14);let c=n.insert("g").attr("class","node default").attr("id",t.domId||t.id),f;if(t.look==="handDrawn"){let h=k.svg(c).circle(0,0,t.width,ne(i));f=c.insert(()=>h),f.attr("class","state-start").attr("r",(t.width??7)/2).attr("width",t.width??14).attr("height",t.height??14)}else f=c.insert("circle",":first-child"),f.attr("class","state-start").attr("r",(t.width??7)/2).attr("width",t.width??14).attr("height",t.height??14);if(t.width<25&&l&&t.look!=="handDrawn"){let o=n.node()?.ownerSVGElement?.id??"",h=o?`${o}-drop-shadow-small`:"drop-shadow-small";f.attr("style",`filter:url(#${h})`)}return D(t,f),t.intersect=function(o){return N.circle(t,(t.width??7)/2,o)},c}x(Vs,"stateStart");var Ct=8;async function Ws(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t?.padding??8,c=t.look==="neo"?28:l,f=t.look==="neo"?12:l,{shapeSvg:o,bbox:h}=await T(n,t,M(t)),a=Math.max(h.width+2*Ct+c,t.width??0),e=Math.max(h.height+f,t.height??0),s=a-2*Ct,p=e,m=-a/2,d=-e/2,g=[{x:0,y:0},{x:s,y:0},{x:s,y:-p},{x:0,y:-p},{x:0,y:0},{x:-8,y:0},{x:s+8,y:0},{x:s+8,y:-p},{x:-8,y:-p},{x:-8,y:0}];if(t.look==="handDrawn"){let u=k.svg(o),y=P(t,{}),b=u.rectangle(m,d,s+16,p,y),S=u.line(m+Ct,d,m+Ct,d+p,y),w=u.line(m+Ct+s,d,m+Ct+s,d+p,y);o.insert(()=>S,":first-child"),o.insert(()=>w,":first-child");let $=o.insert(()=>b,":first-child"),{cssStyles:B}=t;$.attr("class","basic label-container").attr("style",q(B)),D(t,$)}else{let u=et(o,s,p,g);i&&u.attr("style",i),D(t,u)}return t.intersect=function(u){return N.polygon(t,g,u)},o}x(Ws,"subroutine");var te=.2;async function _s(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=t.look==="neo"?16:l,f=t.look==="neo"?12:l;(t.width||t.height)&&(t.height=Math.max((t?.height??0)-f*2,10),t.width=Math.max((t?.width??0)-c*2-te*(t.height+f*2),10));let{shapeSvg:o,bbox:h}=await T(n,t,M(t)),a=(t?.height?t?.height:h.height)+f*2,e=te*a,s=te*a,m=(t?.width?t?.width:h.width)+c*2+e-e,d=a,g=-m/2,u=-d/2,{cssStyles:y}=t,b=k.svg(o),S=P(t,{}),w=[{x:g-e/2,y:u},{x:g+m+e/2,y:u},{x:g+m+e/2,y:u+d},{x:g-e/2,y:u+d}],$=[{x:g+m-e/2,y:u+d},{x:g+m+e/2,y:u+d},{x:g+m+e/2,y:u+d-s}];t.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");let B=_(w),C=b.path(B,S),G=_($),V=b.path(G,{...S,fillStyle:"solid"}),A=o.insert(()=>V,":first-child");return A.insert(()=>C,":first-child"),A.attr("class","basic label-container outer-path"),y&&t.look!=="handDrawn"&&A.selectAll("path").attr("style",y),i&&t.look!=="handDrawn"&&A.selectAll("path").attr("style",i),D(t,A),t.intersect=function(R){return N.polygon(t,w,R)},o}x(_s,"taggedRect");async function Ys(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let{shapeSvg:l,bbox:c,label:f}=await T(n,t,M(t)),o=Math.max(c.width+(t.padding??0)*2,t?.width??0),h=Math.max(c.height+(t.padding??0)*2,t?.height??0),a=h/8,e=.2*o,s=.2*h,p=h+a,{cssStyles:m}=t,d=k.svg(l),g=P(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let u=[{x:-o/2-o/2*.1,y:p/2},...ct(-o/2-o/2*.1,p/2,o/2+o/2*.1,p/2,a,.8),{x:o/2+o/2*.1,y:-p/2},{x:-o/2-o/2*.1,y:-p/2}],y=-o/2+o/2*.1,b=-p/2-s*.4,S=[{x:y+o-e,y:(b+h)*1.3},{x:y+o,y:b+h-s},{x:y+o,y:(b+h)*.9},...ct(y+o,(b+h)*1.25,y+o-e,(b+h)*1.3,-h*.02,.5)],w=_(u),$=d.path(w,g),B=_(S),C=d.path(B,{...g,fillStyle:"solid"}),G=l.insert(()=>C,":first-child");return G.insert(()=>$,":first-child"),G.attr("class","basic label-container outer-path"),m&&t.look!=="handDrawn"&&G.selectAll("path").attr("style",m),i&&t.look!=="handDrawn"&&G.selectAll("path").attr("style",i),G.attr("transform",`translate(0,${-a/2})`),f.attr("transform",`translate(${-o/2+(t.padding??0)-(c.x-(c.left??0))},${-h/2+(t.padding??0)-a/2-(c.y-(c.top??0))})`),D(t,G),t.intersect=function(V){return N.polygon(t,u,V)},l}x(Ys,"taggedWaveEdgedRectangle");async function Fs(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let{shapeSvg:l,bbox:c}=await T(n,t,M(t)),f=Math.max(c.width+(t.padding??0),t?.width||0),o=Math.max(c.height+(t.padding??0),t?.height||0),h=-f/2,a=-o/2,e=l.insert("rect",":first-child");return e.attr("class","text").attr("style",i).attr("rx",0).attr("ry",0).attr("x",h).attr("y",a).attr("width",f).attr("height",o),D(t,e),t.intersect=function(s){return N.rect(t,s)},l}x(Fs,"text");var Jr=x((n,t,r,i,l,c)=>`M${n},${t}
    a${l},${c} 0,0,1 0,${-i}
    l${r},0
    a${l},${c} 0,0,1 0,${i}
    M${r},${-i}
    a${l},${c} 0,0,0 0,${i}
    l${-r},0`,"createCylinderPathD"),Kr=x((n,t,r,i,l,c)=>[`M${n},${t}`,`M${n+r},${t}`,`a${l},${c} 0,0,0 0,${-i}`,`l${-r},0`,`a${l},${c} 0,0,0 0,${i}`,`l${r},0`].join(" "),"createOuterCylinderPathD"),Qr=x((n,t,r,i,l,c)=>[`M${n+r/2},${-i/2}`,`a${l},${c} 0,0,0 0,${i}`].join(" "),"createInnerCylinderPathD"),Xs=5,Us=10;async function qs(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=t.look==="neo"?12:l/2,f=t.height??0;if(t.height&&(t.height=t.height-c,t.height<Xs&&(t.height=Xs)),t.width){let y=f/2/(2.5+f/50);t.width=t.width-c-y*3,t.width<Us&&(t.width=Us)}let{shapeSvg:o,bbox:h,label:a}=await T(n,t,M(t)),e=Math.max(t.height??0,h.height)+c,s=e/2,p=s/(2.5+e/50),m=Math.max(t.width??0,h.width)+p+c,{cssStyles:d}=t,g;if(t.look==="handDrawn"){let u=k.svg(o),y=Kr(0,0,m,e,p,s),b=Qr(0,0,m,e,p,s),S=u.path(y,P(t,{})),w=u.path(b,P(t,{fill:"none"}));g=o.insert(()=>w,":first-child"),g=o.insert(()=>S,":first-child"),g.attr("class","basic label-container"),d&&g.attr("style",d)}else{let u=Jr(0,0,m,e,p,s);g=o.insert("path",":first-child").attr("d",u).attr("class","basic label-container").attr("style",q(d)).attr("style",i),g.attr("class","basic label-container outer-path"),d&&g.selectAll("path").attr("style",d),i&&g.selectAll("path").attr("style",i)}return g.attr("label-offset-x",p),g.attr("transform",`translate(${-m/2}, ${e/2} )`),a.attr("transform",`translate(${-(h.width/2)-p-(h.x-(h.left??0))}, ${-(h.height/2)-(h.y-(h.top??0))})`),D(t,g),t.intersect=function(u){let y=N.rect(t,u),b=y.y-(t.y??0);if(s!=0&&(Math.abs(b)<(t.height??0)/2||Math.abs(b)==(t.height??0)/2&&Math.abs(y.x-(t.x??0))>(t.width??0)/2-p)){let S=p*p*(1-b*b/(s*s));S!=0&&(S=Math.sqrt(Math.abs(S))),S=p-S,u.x-(t.x??0)>0&&(S=-S),y.x+=S}return y},o}x(qs,"tiltedCylinder");async function zs(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=(t.look==="neo",l),f=t.look==="neo"?l*2:l,{shapeSvg:o,bbox:h}=await T(n,t,M(t)),a=Math.max(h.height+c,t.height??0),e=Math.max(h.width+f,(t.width??0)-a),s=[{x:-3*a/6,y:0},{x:e+3*a/6,y:0},{x:e,y:-a},{x:0,y:-a}],p,{cssStyles:m}=t;if(t.look==="handDrawn"){let d=k.svg(o),g=P(t,{}),u=_(s),y=d.path(u,g);p=o.insert(()=>y,":first-child").attr("transform",`translate(${-e/2}, ${a/2})`),m&&p.attr("style",m)}else p=et(o,e,a,s);return i&&p.attr("style",i),t.width=e,t.height=a,D(t,p),t.intersect=function(d){return N.polygon(t,s,d)},o}x(zs,"trapezoid");async function Zs(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=t.look==="neo"?16:l,f=t.look==="neo"?12:l,o=15,h=5;(t.width||t.height)&&(t.height=(t.height??0)-f*2,t.height<h&&(t.height=h),t.width=(t.width??0)-c*2,t.width<o&&(t.width=o));let{shapeSvg:a,bbox:e}=await T(n,t,M(t)),s=(t?.width?t?.width:e.width)+c*2,p=(t?.height?t?.height:e.height)+f*2,{cssStyles:m}=t,d=k.svg(a),g=P(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let u=[{x:-s/2*.8,y:-p/2},{x:s/2*.8,y:-p/2},{x:s/2,y:-p/2*.6},{x:s/2,y:p/2},{x:-s/2,y:p/2},{x:-s/2,y:-p/2*.6}],y=_(u),b=d.path(y,g),S=a.insert(()=>b,":first-child");return S.attr("class","basic label-container outer-path"),m&&t.look!=="handDrawn"&&S.selectChildren("path").attr("style",m),i&&t.look!=="handDrawn"&&S.selectChildren("path").attr("style",i),D(t,S),t.intersect=function(w){return N.polygon(t,u,w)},a}x(Zs,"trapezoidalPentagon");var Js=10,Ks=10;async function Qs(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=t.look==="neo"?l*2:l;(t.width||t.height)&&(t.width=((t?.width??0)-c)/2,t.width<Ks&&(t.width=Ks),t.height=t?.height??0,t.height<Js&&(t.height=Js));let{shapeSvg:f,bbox:o,label:h}=await T(n,t,M(t)),a=ht(U().flowchart?.htmlLabels),e=(t?.width?t?.width:o.width)+c,s=t?.height?t?.height:e+o.height,p=s,m=[{x:0,y:0},{x:p,y:0},{x:p/2,y:-s}],{cssStyles:d}=t,g=k.svg(f),u=P(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let y=_(m),b=g.path(y,u),S=f.insert(()=>b,":first-child").attr("transform",`translate(${-s/2}, ${s/2})`).attr("class","outer-path");return d&&t.look!=="handDrawn"&&S.selectChildren("path").attr("style",d),i&&t.look!=="handDrawn"&&S.selectChildren("path").attr("style",i),t.width=e,t.height=s,D(t,S),h.attr("transform",`translate(${-o.width/2-(o.x-(o.left??0))}, ${s/2-(o.height+(t.padding??0)/(a?2:1)-(o.y-(o.top??0)))})`),t.intersect=function(w){return X.info("Triangle intersect",t,m,w),N.polygon(t,m,w)},f}x(Qs,"triangle");async function tr(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=t.look==="neo"?16:l,f=t.look==="neo"?12:l,o=!0;(t.width||t.height)&&(o=!1,t.width=(t?.width??0)-c*2,t.width<10&&(t.width=10),t.height=(t?.height??0)-f*2,t.height<10&&(t.height=10));let{shapeSvg:h,bbox:a,label:e}=await T(n,t,M(t)),s=(t?.width?t?.width:a.width)+(c??0)*2,p=(t?.height?t?.height:a.height)+(f??0)*2,m=t.look==="neo"?p/4:p/8,d=p+(o?m:-m),{cssStyles:g}=t,y=14-s,b=y>0?y/2:0,S=k.svg(h),w=P(t,{});t.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");let $=[{x:-s/2-b,y:d/2},...ct(-s/2-b,d/2,s/2+b,d/2,m,.8),{x:s/2+b,y:-d/2},{x:-s/2-b,y:-d/2}],B=_($),C=S.path(B,w),G=h.insert(()=>C,":first-child");return G.attr("class","basic label-container outer-path"),g&&t.look!=="handDrawn"&&G.selectAll("path").attr("style",g),i&&t.look!=="handDrawn"&&G.selectAll("path").attr("style",i),G.attr("transform",`translate(0,${-m/2})`),e.attr("transform",`translate(${-s/2+(t.padding??0)-(a.x-(a.left??0))},${-p/2+(t.padding??0)-m-(a.y-(a.top??0))})`),D(t,G),t.intersect=function(V){return N.polygon(t,$,V)},h}x(tr,"waveEdgedRectangle");async function er(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.padding??0,c=t.look==="neo"?16:l,f=t.look==="neo"?20:l;if(t.width||t.height){t.width=t?.width??0,t.width<20&&(t.width=20),t.height=t?.height??0,t.height<10&&(t.height=10);let w=Math.min(t.height*.2,t.height/4);t.height=Math.ceil(t.height-f-w*(20/9)),t.width=t.width-c*2}let{shapeSvg:o,bbox:h}=await T(n,t,M(t)),a=(t?.width?t?.width:h.width)+c*2,e=(t?.height?t?.height:h.height)+f,s=e/8,p=e+s*2,{cssStyles:m}=t,d=k.svg(o),g=P(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let u=[{x:-a/2,y:p/2},...ct(-a/2,p/2,a/2,p/2,s,1),{x:a/2,y:-p/2},...ct(a/2,-p/2,-a/2,-p/2,s,-1)],y=_(u),b=d.path(y,g),S=o.insert(()=>b,":first-child");return S.attr("class","basic label-container"),m&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",m),i&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",i),D(t,S),t.intersect=function(w){return N.polygon(t,u,w)},o}x(er,"waveRectangle");var K=10;async function sr(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t.look==="neo"?16:t.padding??0,c=t.look==="neo"?12:t.padding??0;(t.width||t.height)&&(t.width=Math.max((t?.width??0)-l*2-K,10),t.height=Math.max((t?.height??0)-c*2-K,10));let{shapeSvg:f,bbox:o,label:h}=await T(n,t,M(t)),a=(t?.width?t?.width:o.width)+l*2+K,e=(t?.height?t?.height:o.height)+c*2+K,s=a-K,p=e-K,m=-s/2,d=-p/2,{cssStyles:g}=t,u=k.svg(f),y=P(t,{}),b=[{x:m-K,y:d-K},{x:m-K,y:d+p},{x:m+s,y:d+p},{x:m+s,y:d-K}],S=`M${m-K},${d-K} L${m+s},${d-K} L${m+s},${d+p} L${m-K},${d+p} L${m-K},${d-K}
                M${m-K},${d} L${m+s},${d}
                M${m},${d-K} L${m},${d+p}`;t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let w=u.path(S,y),$=f.insert(()=>w,":first-child");return $.attr("transform",`translate(${K/2}, ${K/2})`),$.attr("class","basic label-container outer-path"),g&&t.look!=="handDrawn"&&$.selectAll("path").attr("style",g),i&&t.look!=="handDrawn"&&$.selectAll("path").attr("style",i),h.attr("transform",`translate(${-(o.width/2)+K/2-(o.x-(o.left??0))}, ${-(o.height/2)+K/2-(o.y-(o.top??0))})`),D(t,$),t.intersect=function(B){return N.polygon(t,b,B)},f}x(sr,"windowPane");var rr=new Set(["redux-color","redux-dark-color"]),to=new Set(["redux","redux-dark","redux-color","redux-dark-color"]);async function ee(n,t){let r=t;r.alias&&(t.label=r.alias);let{theme:i,themeVariables:l}=Nt(),{rowEven:c,rowOdd:f,nodeBorder:o,borderColorArray:h}=l;if(t.look==="handDrawn"){let{themeVariables:Y}=Nt(),{background:z}=Y,Q={...t,id:t.id+"-background",domId:(t.domId||t.id)+"-background",look:"default",cssStyles:["stroke: none",`fill: ${z}`]};await ee(n,Q)}let a=Nt();t.useHtmlLabels=a.htmlLabels;let e=a.er?.diagramPadding??10,s=a.er?.entityPadding??6,{cssStyles:p}=t,{labelStyles:m,nodeStyles:d}=v(t);if(r.attributes.length===0&&t.label){let Y={rx:0,ry:0,labelPaddingX:e,labelPaddingY:e*1.5,classes:""};kt(t.label,a)+Y.labelPaddingX*2<a.er.minEntityWidth&&(t.width=a.er.minEntityWidth);let z=await ft(n,t,Y);if(i!=null&&rr.has(i)){let Q=r.colorIndex??0;z.attr("data-color-id",`color-${Q%h.length}`)}if(!ht(a.htmlLabels)){let Q=z.select("text"),at=Q.node()?.getBBox();Q.attr("transform",`translate(${-at.width/2}, 0)`)}return z}a.htmlLabels||(e*=1.25,s*=1.25);let g=M(t);g||(g="node default");let u=n.insert("g").attr("class",g).attr("id",t.domId||t.id),y=await Rt(u,t.label??"",a,0,0,["name"],m);y.height+=s;let b=0,S=[],w=[],$=0,B=0,C=0,G=0,V=!0,A=!0;for(let Y of r.attributes){let z=await Rt(u,Y.type,a,0,b,["attribute-type"],m);$=Math.max($,z.width+e);let Q=await Rt(u,Y.name,a,0,b,["attribute-name"],m);B=Math.max(B,Q.width+e);let at=await Rt(u,Y.keys.join(),a,0,b,["attribute-keys"],m);C=Math.max(C,at.width+e);let Pt=await Rt(u,Y.comment,a,0,b,["attribute-comment"],m);G=Math.max(G,Pt.width+e);let wt=Math.max(z.height,Q.height,at.height,Pt.height)+s;w.push({yOffset:b,rowHeight:wt}),b+=wt}let R=4;C<=e&&(V=!1,C=0,R--),G<=e&&(A=!1,G=0,R--);let j=u.node().getBBox();if(y.width+e*2-($+B+C+G)>0){let Y=y.width+e*2-($+B+C+G);$+=Y/R,B+=Y/R,C>0&&(C+=Y/R),G>0&&(G+=Y/R)}let E=$+B+C+G,O=k.svg(u),L=P(t,{});t.look!=="handDrawn"&&(L.roughness=0,L.fillStyle="solid");let H=0;w.length>0&&(H=w.reduce((Y,z)=>Y+(z?.rowHeight??0),0));let I=Math.max(j.width+e*2,t?.width||0,E),W=Math.max((H??0)+y.height,t?.height||0),F=-I/2,Z=-W/2;if(u.selectAll("g:not(:first-child)").each((Y,z,Q)=>{let at=J(Q[z]),Pt=at.attr("transform"),wt=0,se=0;if(Pt){let Wt=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(Pt);Wt&&(wt=parseFloat(Wt[1]),se=parseFloat(Wt[2]),at.attr("class").includes("attribute-name")?wt+=$:at.attr("class").includes("attribute-keys")?wt+=$+B:at.attr("class").includes("attribute-comment")&&(wt+=$+B+C))}at.attr("transform",`translate(${F+e/2+wt}, ${se+Z+y.height+s/2})`)}),u.select(".name").attr("transform","translate("+-y.width/2+", "+(Z+s/2)+")"),i!=null&&rr.has(i)){let Y=r.colorIndex??0;u.attr("data-color-id",`color-${Y%h.length}`)}let dt=O.rectangle(F,Z,I,W,L),St=u.insert(()=>dt,":first-child").attr("class","outer-path").attr("style",p.join(""));S.push(0);for(let[Y,z]of w.entries()){let at=(Y+1)%2===0&&z.yOffset!==0,Pt=O.rectangle(F,y.height+Z+z?.yOffset,I,z?.rowHeight,{...L,fill:at?c:f,stroke:o});u.insert(()=>Pt,"g.label").attr("style",p.join("")).attr("class",`row-rect-${at?"even":"odd"}`)}let ut=1e-4,rt=At(F,y.height+Z,I+F,y.height+Z,ut),ot=O.polygon(rt.map(Y=>[Y.x,Y.y]),L);if(u.insert(()=>ot).attr("class","divider"),rt=At($+F,y.height+Z,$+F,W+Z,ut),ot=O.polygon(rt.map(Y=>[Y.x,Y.y]),L),u.insert(()=>ot).attr("class","divider"),V){let Y=$+B+F;rt=At(Y,y.height+Z,Y,W+Z,ut),ot=O.polygon(rt.map(z=>[z.x,z.y]),L),u.insert(()=>ot).attr("class","divider")}if(A){let Y=$+B+C+F;rt=At(Y,y.height+Z,Y,W+Z,ut),ot=O.polygon(rt.map(z=>[z.x,z.y]),L),u.insert(()=>ot).attr("class","divider")}for(let Y of S){let z=y.height+Z+Y;rt=At(F,z,I+F,z,ut),ot=O.polygon(rt.map(Q=>[Q.x,Q.y]),L),u.insert(()=>ot).attr("class","divider")}if(D(t,St),d&&t.look!=="handDrawn")if(i!=null&&to.has(i))u.selectAll("path").attr("style",d);else{let z=d.split(";")?.filter(Q=>Q.includes("stroke"))?.map(Q=>`${Q}`).join("; ");u.selectAll("path").attr("style",z??""),u.selectAll(".row-rect-even path").attr("style",d)}return t.intersect=function(Y){return N.rect(t,Y)},u}x(ee,"erBox");async function Rt(n,t,r,i=0,l=0,c=[],f=""){let o=n.insert("g").attr("class",`label ${c.join(" ")}`).attr("transform",`translate(${i}, ${l})`).attr("style",f);t!==_t(t)&&(t=_t(t),t=t.replaceAll("<","&lt;").replaceAll(">","&gt;"));let h=o.node().appendChild(await it(o,t,{width:kt(t,r)+100,style:f,useHtmlLabels:r.htmlLabels},r));if(t.includes("&lt;")||t.includes("&gt;")){let e=h.children[0];for(e.textContent=e.textContent.replaceAll("&lt;","<").replaceAll("&gt;",">");e.childNodes[0];)e=e.childNodes[0],e.textContent=e.textContent.replaceAll("&lt;","<").replaceAll("&gt;",">")}let a=h.getBBox();if(ht(r.htmlLabels)){let e=h.children[0];e.style.textAlign="start";let s=J(h);a=e.getBoundingClientRect(),s.attr("width",a.width),s.attr("height",a.height)}return a}x(Rt,"addText");function At(n,t,r,i,l){return n===r?[{x:n-l/2,y:t},{x:n+l/2,y:t},{x:r+l/2,y:i},{x:r-l/2,y:i}]:[{x:n,y:t-l/2},{x:n,y:t+l/2},{x:r,y:i+l/2},{x:r,y:i-l/2}]}x(At,"lineToPolygon");async function or(n,t,r,i,l=r.class.padding??12){let c=i?0:3,f=n.insert("g").attr("class",M(t)).attr("id",t.domId||t.id),o=null,h=null,a=null,e=null,s=0,p=0,m=0;if(o=f.insert("g").attr("class","annotation-group text"),t.annotations.length>0){let b=t.annotations[0];await Vt(o,{text:`\xAB${b}\xBB`},0),s=o.node().getBBox().height}h=f.insert("g").attr("class","label-group text"),await Vt(h,t,0,["font-weight: bolder"]);let d=h.node().getBBox();p=d.height,a=f.insert("g").attr("class","members-group text");let g=0;for(let b of t.members){let S=await Vt(a,b,g,[b.parseClassifier()]);g+=S+c}m=a.node().getBBox().height,m<=0&&(m=l/2),e=f.insert("g").attr("class","methods-group text");let u=0;for(let b of t.methods){let S=await Vt(e,b,u,[b.parseClassifier()]);u+=S+c}let y=f.node().getBBox();if(o!==null){let b=o.node().getBBox();o.attr("transform",`translate(${-b.width/2})`)}return h.attr("transform",`translate(${-d.width/2}, ${s})`),y=f.node().getBBox(),a.attr("transform",`translate(0, ${s+p+l*2})`),y=f.node().getBBox(),e.attr("transform",`translate(0, ${s+p+(m?m+l*4:l*2)})`),y=f.node().getBBox(),{shapeSvg:f,bbox:y}}x(or,"textHelper");async function Vt(n,t,r,i=[]){let l=n.insert("g").attr("class","label").attr("style",i.join("; ")),c=Nt(),f="useHtmlLabels"in t?t.useHtmlLabels:ht(c.htmlLabels)??!0,o="";"text"in t?o=t.text:o=t.label,!f&&o.startsWith("\\")&&(o=o.substring(1)),oe(o)&&(f=!0);let h=await it(l,Ht(xt(o)),{width:kt(o,c)+50,classes:"markdown-node-label",useHtmlLabels:f},c),a,e=1;if(f){let s=h.children[0],p=J(h);e=s.innerHTML.split("<br>").length,s.innerHTML.includes("</math>")&&(e+=s.innerHTML.split("<mrow>").length-1),await jt(s),a=s.getBoundingClientRect(),p.attr("width",a.width),p.attr("height",a.height)}else{i.includes("font-weight: bolder")&&J(h).selectAll("tspan").attr("font-weight",""),e=h.children.length;let s=h.children[0];(h.textContent===""||h.textContent.includes("&gt"))&&(s.textContent=o[0]+o.substring(1).replaceAll("&gt;",">").replaceAll("&lt;","<").trim(),o[1]===" "&&(s.textContent=s.textContent[0]+" "+s.textContent.substring(1))),s.textContent==="undefined"&&(s.textContent=""),a=h.getBBox()}return l.attr("transform","translate(0,"+(-a.height/(2*e)+r)+")"),a.height}x(Vt,"addText");async function ar(n,t){let r=U(),{theme:i,themeVariables:l}=r,{useGradient:c,borderColorArray:f}=l,o=r.class.padding??12,h=o,a=t.useHtmlLabels??ht(r.htmlLabels)??!0,e=t;e.annotations=e.annotations??[],e.members=e.members??[],e.methods=e.methods??[];let{shapeSvg:s,bbox:p}=await or(n,t,r,a,h);lt(s,t.colorIndex,i,f);let{labelStyles:m,nodeStyles:d}=v(t);t.labelStyle=m,t.cssStyles=e.styles||"";let g=e.styles?.join(";")||d||"";t.cssStyles||(t.cssStyles=g.replaceAll("!important","").split(";"));let u=e.members.length===0&&e.methods.length===0&&!r.class?.hideEmptyMembersBox,y=k.svg(s),b=P(t,{});t.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");let S=Math.max(t.width??0,p.width),w=Math.max(t.height??0,p.height),$=(t.height??0)>p.height;e.members.length===0&&e.methods.length===0?w+=h:e.members.length>0&&e.methods.length===0&&(w+=h*2);let B=-S/2,C=-w/2,G=u?o*2:e.members.length===0&&e.methods.length===0?-o:0;$&&(G=o*2);let V=y.rectangle(B-o,C-o-(u?o:e.members.length===0&&e.methods.length===0?-o/2:0),S+2*o,w+2*o+G,b),A=s.insert(()=>V,":first-child");A.attr("class","basic label-container outer-path");let R=A.node().getBBox(),j=s.select(".annotation-group").node().getBBox().height-(u?o/2:0)||0,E=s.select(".label-group").node().getBBox().height-(u?o/2:0)||0,O=s.select(".members-group").node().getBBox().height-(u?o/2:0)||0,L=(j+E+C+o-(C-o-(u?o:e.members.length===0&&e.methods.length===0?-o/2:0)))/2;if(s.selectAll(".text").each((H,I,W)=>{let F=J(W[I]),Z=F.attr("transform"),dt=0;if(Z){let ot=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(Z);ot&&(dt=parseFloat(ot[2]))}let St=dt+C+o-(u?o:e.members.length===0&&e.methods.length===0?-o/2:0);if(F.attr("class").includes("methods-group")){let rt=Math.max(O,h/2);$?St=Math.max(L,j+E+rt+C+h*2+o)+h*2:St=j+E+rt+C+h*4+o}e.members.length===0&&e.methods.length===0&&r.class?.hideEmptyMembersBox&&(e.annotations.length>0?St=dt-h:St=dt),a||(St-=4);let ut=B;(F.attr("class").includes("label-group")||F.attr("class").includes("annotation-group"))&&(ut=-F.node()?.getBBox().width/2||0,s.selectAll("text").each(function(rt,ot,Y){window.getComputedStyle(Y[ot]).textAnchor==="middle"&&(ut=0)})),F.attr("transform",`translate(${ut}, ${St})`)}),e.members.length>0||e.methods.length>0||u){let H=j+E+C+o,I=y.line(R.x,H,R.x+R.width,H+.001,b);s.insert(()=>I).attr("class",`divider${t.look==="neo"&&!c?" neo-line":""}`).attr("style",g)}if(u||e.members.length>0||e.methods.length>0){let H=j+E+O+C+h*2+o,I=y.line(R.x,$?Math.max(L,H):H,R.x+R.width,($?Math.max(L,H):H)+.001,b);s.insert(()=>I).attr("class",`divider${t.look==="neo"&&!c?" neo-line":""}`).attr("style",g)}if(e.look!=="handDrawn"&&s.selectAll("path").attr("style",g),A.select(":nth-child(2)").attr("style",g),s.selectAll(".divider").select("path").attr("style",g),t.labelStyle?s.selectAll("span").attr("style",t.labelStyle):s.selectAll("span").attr("style",g),!a){let H=RegExp(/color\s*:\s*([^;]*)/),I=H.exec(g);if(I){let W=I[0].replace("color","fill");s.selectAll("tspan").attr("style",W)}else if(m){let W=H.exec(m);if(W){let F=W[0].replace("color","fill");s.selectAll("tspan").attr("style",F)}}}return D(t,A),t.intersect=function(H){return N.rect(t,H)},s}x(ar,"classBox");async function ir(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let l=t,c=t,f=20,o=20,h="verifyMethod"in t,a=M(t),e=U(),{themeVariables:s}=e,{borderColorArray:p,requirementEdgeLabelBackground:m}=s,d=e.layout==="elk"?"start":"center",g=n.insert("g").attr("class",a).attr("id",t.domId??t.id),u;h?u=await bt(g,`&lt;&lt;${l.type}&gt;&gt;`,0,t.labelStyle):u=await bt(g,"&lt;&lt;Element&gt;&gt;",0,t.labelStyle);let y=u,b=await bt(g,l.name,y,t.labelStyle+"; font-weight: bold;");if(y+=b+o,h){let R=await bt(g,`${l.requirementId?`ID: ${l.requirementId}`:""}`,y,t.labelStyle,d);y+=R;let j=await bt(g,`${l.text?`Text: ${l.text}`:""}`,y,t.labelStyle,d);y+=j;let E=await bt(g,`${l.risk?`Risk: ${l.risk}`:""}`,y,t.labelStyle,d);y+=E,await bt(g,`${l.verifyMethod?`Verification: ${l.verifyMethod}`:""}`,y,t.labelStyle,d)}else{let R=await bt(g,`${c.type?`Type: ${c.type}`:""}`,y,t.labelStyle,d);y+=R,await bt(g,`${c.docRef?`Doc Ref: ${c.docRef}`:""}`,y,t.labelStyle,d)}let S=(g.node()?.getBBox().width??200)+f,w=(g.node()?.getBBox().height??200)+f,$=-S/2,B=-w/2,C=k.svg(g),G=P(t,{});t.look!=="handDrawn"&&(G.roughness=0,G.fillStyle="solid");let V=C.rectangle($,B,S,w,G),A=g.insert(()=>V,":first-child");if(A.attr("class","basic label-container outer-path").attr("style",i),p?.length){let R=t.colorIndex??0;g.attr("data-color-id",`color-${R%p.length}`)}if(g.selectAll(".label").each((R,j,E)=>{let O=J(E[j]),L=O.attr("transform"),H=0,I=0;if(L){let dt=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(L);dt&&(H=parseFloat(dt[1]),I=parseFloat(dt[2]))}let W=I-w/2,F=$+f/2;(j===0||j===1)&&(F=H),O.attr("transform",`translate(${F}, ${W+f})`)}),y>u+b+o){let R=B+u+b+o,j;if(t.look==="neo"){let L=[[$,R],[$+S,R],[$+S,R+.001],[$,R+.001]];j=C.polygon(L,G)}else j=C.line($,R,$+S,R,G);g.insert(()=>j).attr("class","divider")}return D(t,A),t.intersect=function(R){return N.rect(t,R)},i&&t.look!=="handDrawn"&&(m||p?.length)&&g.selectAll("path").attr("style",i),g}x(ir,"requirementBox");async function bt(n,t,r,i="",l="center"){if(t==="")return 0;let c=n.insert("g").attr("class","label").attr("style",i),f=U(),o=f.htmlLabels??!0,h=await it(c,Ht(xt(t)),{width:kt(t,f)+50,classes:"markdown-node-label",useHtmlLabels:o,style:i},f),a;if(o){let e=h.children[0],s=J(h);l==="start"&&J(e).style("text-align","left"),a=e.getBoundingClientRect(),s.attr("width",a.width),s.attr("height",a.height)}else{let e=h.children[0];for(let s of e.children)i&&s.setAttribute("style",i);if(l==="start"){e.setAttribute("text-anchor","start");for(let s of e.children)s.setAttribute("text-anchor","start")}a=h.getBBox(),a.height+=6}return c.attr("transform",`translate(${-a.width/2},${-a.height/2+r})`),a.height}x(bt,"addText");var eo=x(n=>{switch(n){case"Very High":return"red";case"High":return"orange";case"Medium":return null;case"Low":return"blue";case"Very Low":return"lightblue"}},"colorFromPriority");async function nr(n,t,{config:r}){let{labelStyles:i,nodeStyles:l}=v(t);t.labelStyle=i||"";let c=10,f=t.width;t.width=(t.width??200)-10;let{shapeSvg:o,bbox:h,label:a}=await T(n,t,M(t)),e=t.padding||10,s="",p;"ticket"in t&&t.ticket&&r?.kanban?.ticketBaseUrl&&(s=r?.kanban?.ticketBaseUrl.replace("#TICKET#",t.ticket),p=o.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",s).attr("target","_blank"));let m={useHtmlLabels:t.useHtmlLabels,labelStyle:t.labelStyle||"",width:t.width,img:t.img,padding:t.padding||8,centerLabel:!1},d,g;p?{label:d,bbox:g}=await mt(p,"ticket"in t&&t.ticket||"",m):{label:d,bbox:g}=await mt(o,"ticket"in t&&t.ticket||"",m);let{label:u,bbox:y}=await mt(o,"assigned"in t&&t.assigned||"",m);t.width=f;let b=10,S=t?.width||0,w=Math.max(g.height,y.height)/2,$=Math.max(h.height+b*2,t?.height||0)+w,B=-S/2,C=-$/2;a.attr("transform","translate("+(e-S/2)+", "+(-w-h.height/2)+")"),d.attr("transform","translate("+(e-S/2)+", "+(-w+h.height/2)+")"),u.attr("transform","translate("+(e+S/2-y.width-2*c)+", "+(-w+h.height/2)+")");let G,{rx:V,ry:A}=t,{cssStyles:R}=t;if(t.look==="handDrawn"){let j=k.svg(o),E=P(t,{}),O=V||A?j.path(tt(B,C,S,$,V||0),E):j.rectangle(B,C,S,$,E);G=o.insert(()=>O,":first-child"),G.attr("class","basic label-container").attr("style",R||null)}else{G=o.insert("rect",":first-child"),G.attr("class","basic label-container __APA__").attr("style",l).attr("rx",V??5).attr("ry",A??5).attr("x",B).attr("y",C).attr("width",S).attr("height",$);let j="priority"in t&&t.priority;if(j){let E=o.append("line"),O=B+2,L=C+Math.floor((V??0)/2),H=C+$-Math.floor((V??0)/2);E.attr("x1",O).attr("y1",L).attr("x2",O).attr("y2",H).attr("stroke-width","4").attr("stroke",eo(j))}}return D(t,G),t.height=$,t.intersect=function(j){return N.rect(t,j)},o}x(nr,"kanbanItem");async function lr(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let{shapeSvg:l,bbox:c,halfPadding:f,label:o}=await T(n,t,M(t)),h=c.width+10*f,a=c.height+8*f,e=.15*h,{cssStyles:s}=t,p=c.width+20,m=c.height+20,d=Math.max(h,p),g=Math.max(a,m);o.attr("transform",`translate(${-c.width/2}, ${-c.height/2})`);let u,y=`M0 0 
    a${e},${e} 1 0,0 ${d*.25},${-1*g*.1}
    a${e},${e} 1 0,0 ${d*.25},0
    a${e},${e} 1 0,0 ${d*.25},0
    a${e},${e} 1 0,0 ${d*.25},${g*.1}

    a${e},${e} 1 0,0 ${d*.15},${g*.33}
    a${e*.8},${e*.8} 1 0,0 0,${g*.34}
    a${e},${e} 1 0,0 ${-1*d*.15},${g*.33}

    a${e},${e} 1 0,0 ${-1*d*.25},${g*.15}
    a${e},${e} 1 0,0 ${-1*d*.25},0
    a${e},${e} 1 0,0 ${-1*d*.25},0
    a${e},${e} 1 0,0 ${-1*d*.25},${-1*g*.15}

    a${e},${e} 1 0,0 ${-1*d*.1},${-1*g*.33}
    a${e*.8},${e*.8} 1 0,0 0,${-1*g*.34}
    a${e},${e} 1 0,0 ${d*.1},${-1*g*.33}
  H0 V0 Z`;if(t.look==="handDrawn"){let b=k.svg(l),S=P(t,{}),w=b.path(y,S);u=l.insert(()=>w,":first-child"),u.attr("class","basic label-container").attr("style",q(s))}else u=l.insert("path",":first-child").attr("class","basic label-container").attr("style",i).attr("d",y);return u.attr("transform",`translate(${-d/2}, ${-g/2})`),D(t,u),t.calcIntersect=function(b,S){return N.rect(b,S)},t.intersect=function(b){return X.info("Bang intersect",t,b),N.rect(t,b)},l}x(lr,"bang");async function cr(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let{shapeSvg:l,bbox:c,halfPadding:f,label:o}=await T(n,t,M(t)),h=c.width+2*f,a=c.height+2*f,e=.15*h,s=.25*h,p=.35*h,m=.2*h,{cssStyles:d}=t,g,u=`M0 0 
    a${e},${e} 0 0,1 ${h*.25},${-1*h*.1}
    a${p},${p} 1 0,1 ${h*.4},${-1*h*.1}
    a${s},${s} 1 0,1 ${h*.35},${h*.2}

    a${e},${e} 1 0,1 ${h*.15},${a*.35}
    a${m},${m} 1 0,1 ${-1*h*.15},${a*.65}

    a${s},${e} 1 0,1 ${-1*h*.25},${h*.15}
    a${p},${p} 1 0,1 ${-1*h*.5},0
    a${e},${e} 1 0,1 ${-1*h*.25},${-1*h*.15}

    a${e},${e} 1 0,1 ${-1*h*.1},${-1*a*.35}
    a${m},${m} 1 0,1 ${h*.1},${-1*a*.65}
  H0 V0 Z`;if(t.look==="handDrawn"){let y=k.svg(l),b=P(t,{}),S=y.path(u,b);g=l.insert(()=>S,":first-child"),g.attr("class","basic label-container").attr("style",q(d))}else g=l.insert("path",":first-child").attr("class","basic label-container").attr("style",i).attr("d",u);return o.attr("transform",`translate(${-c.width/2}, ${-c.height/2})`),g.attr("transform",`translate(${-h/2}, ${-a/2})`),D(t,g),t.calcIntersect=function(y,b){return N.rect(y,b)},t.intersect=function(y){return X.info("Cloud intersect",t,y),N.rect(t,y)},l}x(cr,"cloud");async function hr(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let{shapeSvg:l,bbox:c,halfPadding:f,label:o}=await T(n,t,M(t)),h=c.width+8*f,a=c.height+2*f,e=5,s=t.look==="neo"?`
    M${-h/2} ${a/2-e}
    v${-a+2*e}
    q0,-${e} ${e},-${e}
    h${h-2*e}
    q${e},0 ${e},${e}
    v${a-e}
    H${-h/2}
    Z
  `:`
    M${-h/2} ${a/2-e}
    v${-a+2*e}
    q0,-${e} ${e},-${e}
    h${h-2*e}
    q${e},0 ${e},${e}
    v${a-2*e}
    q0,${e} ${-e},${e}
    h${-(h-2*e)}
    q${-e},0 ${-e},${-e}
    Z
  `;if(!t.domId)throw new Error(`defaultMindmapNode: node "${t.id}" is missing a domId \u2014 was render.ts domId prefixing skipped?`);let p=l.append("path").attr("id",t.domId).attr("class","node-bkg node-"+t.type).attr("style",i).attr("d",s);return l.append("line").attr("class","node-line-").attr("x1",-h/2).attr("y1",a/2).attr("x2",h/2).attr("y2",a/2),o.attr("transform",`translate(${-c.width/2}, ${-c.height/2})`),l.append(()=>o.node()),D(t,p),t.calcIntersect=function(m,d){return N.rect(m,d)},t.intersect=function(m){return N.rect(t,m)},l}x(hr,"defaultMindmapNode");async function pr(n,t){let r={padding:t.padding??0};return It(n,t,r)}x(pr,"mindmapCircle");var so=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:js},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:Rs},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:Os},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:Ws},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:Oe},{semanticName:"Data Store",name:"Data Store",shortName:"datastore",description:"Data flow diagram data store",aliases:["data-store"],handler:Le},{semanticName:"Folder",name:"Folder",shortName:"folder",description:"Folder or directory",aliases:["directory"],handler:Ue},{semanticName:"Bucket",name:"Bucket",shortName:"bucket",description:"Object storage bucket",handler:we},{semanticName:"Console",name:"Console (terminal window)",shortName:"console",description:"Terminal or console window",handler:Te},{semanticName:"Browser",name:"Browser",shortName:"browser",description:"Browser window",handler:Pe},{semanticName:"Person",name:"Person",shortName:"person",description:"Person (circular head above a rounded body)",handler:Ae},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:It},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:lr},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:cr},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:Bs},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:Ze},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:is},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:as},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:zs},{semanticName:"Manual Operation",name:"Trapezoid Base Top",shortName:"trap-t",description:"Represents a manual task",aliases:["manual","trapezoid-top","inv-trapezoid"],internalAliases:["inv_trapezoid"],handler:rs},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:Ve},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:Fs},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:ke},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:As},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:Vs},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:Is},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:qe},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:Je},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:Be},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:Ge},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:Ee},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:ns},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:tr},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:ze},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:qs},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:hs},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:Re},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:Ie},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:Qs},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:sr},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:_e},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:Zs},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:Xe},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:Hs},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:Ts},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:Ms},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:Se},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:Ce},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:Ys},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:_s},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:er},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:Gs},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:ps}],ro=x(()=>{let t=[...Object.entries({state:Ls,choice:ve,note:Cs,composite:Me,rectWithTitle:Es,labelRect:os,block_arrow:De,collapsedGroup:Ne,iconSquare:es,iconCircle:Qe,icon:Ke,iconRounded:ts,imageSquare:ss,anchor:xe,kanbanItem:nr,mindmapCircle:pr,defaultMindmapNode:hr,classBox:ar,erBox:ee,requirementBox:ir,usecaseActor:xs,usecaseActorHollow:Ss,usecaseActorAwesome:bs,usecaseActorIcon:$s,usecaseBusiness:Ps,usecaseEllipse:We,usecaseJsonTable:vs}),...so.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(l=>[l,r.handler]))];return Object.fromEntries(t)},"generateShapeMap"),oo=ro();function eu(n){return n in oo}x(eu,"isValidShape");export{T as a,D as b,me as c,N as d,tt as e,Ft as f,oo as g,eu as h};