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-MMC4O45A.mjs";import{c as Gt,e as it}from"./chunk-XGFVAD2T.mjs";import{c as ae,d as gt}from"./chunk-YX6CVSZ3.mjs";import{g as lt}from"./chunk-MIE3LDYP.mjs";import{k as kt,o as ie,s as xt,u as q}from"./chunk-GHI2JMQX.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-FWWDAFD2.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(c=>{function l(){if(i.style.display="flex",i.style.flexDirection="column",r){let d=U().fontSize?U().fontSize:window.getComputedStyle(document.body).fontSize,o=5,[h=re.fontSize]=ie(d),a=h*o+"px";i.style.minWidth=a,i.style.maxWidth=a}else i.style.width="100%";c(i)}x(l,"setupImage"),setTimeout(()=>{i.complete&&l()}),i.addEventListener("error",l),i.addEventListener("load",l)})))}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(),c=n.insert("g").attr("class",r??"node default").attr("id",t.domId||t.id),l=c.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=l.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),f=0;for(let{el:y,box:b}of s)y.attr("transform",`translate(${p/2-b.x-b.width/2}, ${f-b.y})`),f+=b.height+ce;let m=s.length>0?f-ce:0;l.insert("rect",":first-child"),l.attr("transform",`translate(${-p/2}, ${-m/2})`);let g=l.node().getBBox(),u=(t.padding??0)/2;return{shapeSvg:c,bbox:g,halfPadding:u,label:l}},"c4LabelHelper");var pe=x((n,t)=>{let{x:r,y:i,width:c,height:l}=n;return c>=t?n:"left"in n?{x:r,y:i,width:t,height:l,top:i,left:r,bottom:i+l,right:r+t,toJSON:x(()=>({}),"toJSON")}:{x:r-(t-c)/2,y:i,width:t,height:l}},"withMinWidth"),T=x(async(n,t,r,{ignoreMinWidth:i=!1}={})=>{if(t.stereotype!==void 0)return he(n,t,r);let c,l=t.useHtmlLabels||ht(U()?.htmlLabels);r?c=r:c="node default";let d=n.insert("g").attr("class",c).attr("id",t.domId||t.id),o=d.insert("g").attr("class","label").attr("style",q(t.labelStyle)),h;t.label===void 0?h="":h=typeof t.label=="string"?t.label:t.label[0];let a=!!t.icon||!!t.img,e=t.labelType==="markdown",s=h&&!t.width&&!i?t.minWidth??0:0,p=await it(o,Bt(xt(h),U()),{useHtmlLabels:l,width:t.width||t.wrappingWidth||U().flowchart?.wrappingWidth,minWidth:s,classes:e?"markdown-node-label":"",style:t.labelStyle,addSvgBackground:a,markdown:e},U()),f=(t?.padding??0)/2,m;if(l){let g=p.children[0],u=J(p);await jt(g),m=await Gt.measure(()=>g.getBoundingClientRect()),m=pe(m,s),u.attr("width",m.width),u.attr("height",m.height)}else m=await Gt.measure(()=>p.getBBox()),m=pe(m,s);return l?o.attr("transform","translate("+-m.width/2+", "+-m.height/2+")"):o.attr("transform","translate(0, "+-m.height/2+")"),t.centerLabel&&o.attr("transform","translate("+-m.width/2+", "+-m.height/2+")"),o.insert("rect",":first-child"),{shapeSvg:d,bbox:m,halfPadding:f,label:o}},"labelHelper"),mt=x(async(n,t,r)=>{let i=r.useHtmlLabels??pt(U()),c=n.insert("g").attr("class","label").attr("style",r.labelStyle||""),l=await it(c,Bt(xt(t),U()),{useHtmlLabels:i,width:r.width||U()?.flowchart?.wrappingWidth,style:r.labelStyle,addSvgBackground:!!r.icon||!!r.img}),d=r.padding/2,o;if(pt(U())){let h=l.children[0],a=J(l);o=await Gt.measure(()=>h.getBoundingClientRect()),a.attr("width",o.width),a.attr("height",o.height)}else o=await Gt.measure(()=>l.getBBox());return i?c.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"):c.attr("transform","translate(0, "+-o.height/2+")"),r.centerLabel&&c.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"),c.insert("rect",":first-child"),{shapeSvg:n,bbox:o,halfPadding:d,label:c}},"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,c,l){let d=[],h=r-n,a=i-t,e=h/l,s=2*Math.PI/e,p=t+a/2;for(let f=0;f<=50;f++){let m=f/50,g=n+m*h,u=p+c*Math.sin(s*(g-n));d.push({x:g,y:u})}return d}x(ct,"generateFullSineWavePoints");function nt(n,t,r,i,c,l){let d=[],o=c*Math.PI/180,e=(l*Math.PI/180-o)/(i-1);for(let s=0;s<i;s++){let p=o+s*e,f=n+r*Math.cos(p),m=t+r*Math.sin(p);d.push({x:-f,y:-m})}return d}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 c=t.find(h=>h.getAttribute("fill")!=="none"),l=t.find(h=>h.getAttribute("stroke")!=="none"),d=x((h,a)=>h?.getAttribute(a)??void 0,"getAttr");if(c){let h={fill:d(c,"fill"),"fill-opacity":d(c,"fill-opacity")??"1"};Object.entries(h).forEach(([a,e])=>{e&&r.setAttribute(a,e)})}if(l){let h={stroke:d(l,"stroke"),"stroke-width":d(l,"stroke-width")??"1","stroke-opacity":d(l,"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,c=t.x-r,l=t.y-i,d=n.width/2,o=n.height/2,h,a;return Math.abs(l)*d>Math.abs(c)*o?(l<0&&(o=-o),h=l===0?0:o*c/l,a=o):(c<0&&(d=-d),h=d,a=c===0?0:d*l/c),{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 c=n.x,l=n.y,d=c-i.x,o=l-i.y,h=Math.sqrt(t*t*o*o+r*r*d*d),a=Math.abs(t*r*d/h);i.x<c&&(a=-a);var e=Math.abs(t*r*o/h);return i.y<l&&(e=-e),{x:c+a,y:l+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 c=t.y-n.y,l=n.x-t.x,d=t.x*n.y-n.x*t.y,o=c*r.x+l*r.y+d,h=c*i.x+l*i.y+d,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,f=e*n.x+s*n.y+p,m=e*t.x+s*t.y+p;if(Math.abs(f)<a&&Math.abs(m)<a&&ge(f,m))return;let g=c*s-e*l;if(g===0)return;let u=(l*p-s*d)/g,y=(e*d-c*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,c=n.y,l=[],d=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(e){d=Math.min(d,e.x),o=Math.min(o,e.y)}):(d=Math.min(d,t.x),o=Math.min(o,t.y));let h=i-n.width/2-d,a=c-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],f=ye(n,r,{x:h+s.x,y:a+s.y},{x:h+p.x,y:a+p.y});f&&l.push(f)}return l.length?(l.length>1&&l.sort(function(e,s){let p=e.x-r.x,f=e.y-r.y,m=Math.sqrt(p*p+f*f),g=s.x-r.x,u=s.y-r.y,y=Math.sqrt(g*g+u*u);return m<y?-1:m===y?0:1}),l[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,c)=>["M",n+c,t,"H",n+r-c,"A",c,c,0,0,1,n+r,t+c,"V",t+i-c,"A",c,c,0,0,1,n+r-c,t+i,"H",n+c,"A",c,c,0,0,1,n,t+i-c,"V",t+c,"A",c,c,0,0,1,n+c,t,"Z"].join(" "),"createRoundedRectPathD");var wr=x(async(n,t,r,i=!1,c=!1)=>{let l=t||"";typeof l=="object"&&(l=l[0]);let d=U(),o=pt(d);return await it(n,l,{style:r,isTitle:i,useHtmlLabels:o,markdown:!1,isNode:c,width:Number.POSITIVE_INFINITY},d)},"createLabel"),Ft=wr;function xe(n,t){let{labelStyles:r}=v(t);t.labelStyle=r;let i=M(t),c=i;i||(c="anchor");let l=n.insert("g").attr("class",c).attr("id",t.domId||t.id),d=1,{cssStyles:o}=t,h=k.svg(l),a=P(t,{fill:"black",stroke:"none",fillStyle:"solid"});t.look!=="handDrawn"&&(a.roughness=0);let e=h.circle(0,0,d*2,a),s=l.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,d,p),N.circle(t,d,p)},l}x(xe,"anchor");function be(n,t,r,i,c,l,d){let h=(n+r)/2,a=(t+i)/2,e=Math.atan2(i-t,r-n),s=(r-n)/2,p=(i-t)/2,f=s/c,m=p/l,g=Math.sqrt(f**2+m**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*l*Math.sin(e)*(d?-1:1),b=a-u*c*Math.cos(e)*(d?-1:1),S=Math.atan2((t-b)/l,(n-y)/c),$=Math.atan2((i-b)/l,(r-y)/c)-S;d&&$<0&&($+=2*Math.PI),!d&&$>0&&($-=2*Math.PI);let B=[];for(let C=0;C<20;C++){let G=C/19,V=S+G*$,A=y+c*Math.cos(V),R=b+l*Math.sin(V);B.push({x:A,y:R})}return B}x(be,"generateArcPoints");function Nr(n,t,r){let[i,c]=[t,r].sort((l,d)=>d-l);return c*(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 c=t.padding??0,l=t.look==="neo"?16:c,d=t.look==="neo"?12:c,o=x(V=>V+d,"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,f]=h(s),m=Nr(s,p,f),u=(t?.width?t?.width:e.width)+l*2+m-m,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,f,!1),{x:u/2,y:y/2},...be(u/2,y/2,u/2,-y/2,p,f,!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:c}=v(t);t.labelStyle=i;let{shapeSvg:l,bbox:d,label:o}=await T(n,t,M(t)),h=r?.nodeBorder??r?.lineColor??"currentColor",a=t.padding??12,e=Math.max(d.width+a*2,t.width??0,80),s=Math.max(Math.min(e*.08,12),5),p=Math.max(d.height+a*2+s,t.height??0),f=-p/2+s,m=p/2,g=e*.72,u=[`M${-e/2},${f}`,`L${-g/2},${m}`,`A${g/2},${s} 0 0 0 ${g/2},${m}`,`L${e/2},${f}`,`A${e/2},${s} 0 0 0 ${-e/2},${f}`,"Z"].join(" "),{cssStyles:y}=t,b=l.insert("g",":first-child").attr("class","basic label-container");if(t.look==="handDrawn"){let G=k.svg(l).path(u,P(t,{}));b.node()?.appendChild(G),y&&b.attr("style",y)}else b.append("path").attr("d",u).attr("style",c);b.append("ellipse").attr("cx",0).attr("cy",f).attr("rx",e/2).attr("ry",s).attr("style",`fill:none;stroke:${h};stroke-width:1px`),D(t,b);let S=f+(m-f)/2;o.attr("transform",`translate(${-(d.width/2)-(d.x-(d.left??0))}, ${S-d.height/2-(d.y-(d.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,f,-1),...$(g/2,m,1).reverse()];return t.intersect=function(C){return N.polygon(t,B,C)},l}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:c}=r,{nodeStyles:l}=v(t),{shapeSvg:d,bbox:o}=await T(n,t,M(t)),{theme:h,themeVariables:a}=U();lt(d,t.colorIndex,h,a.borderColorArray);let e=t.padding??8,s=o.height,p=Math.max(o.width+e*2,$r,t?.width??0),f=Math.max(s+Ut+Xt+e*2,t?.height??0),m=-p/2,g=-f/2,u=-(Ut+Xt)/2,y=d.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(d),G=P(t,{fill:i,stroke:c,...r.strokeWidth===void 0?{}:{strokeWidth:r.strokeWidth},...i==="none"?{fillWeight:0}:{fillStyle:"solid"}}),V=C.path(tt(m,g,p,f,r.rx),G);b=d.insert(()=>V,":first-child"),b.attr("class","basic label-container "+r.cssClass).attr("style",q(t.cssStyles))}else b=d.insert("rect",":first-child"),b.attr("class","basic label-container "+r.cssClass).attr("style",l).attr("rx",r.rx).attr("ry",r.rx).attr("x",m).attr("y",g).attr("width",p).attr("height",f).attr("fill",i).attr("stroke",c),r.strokeWidth!==void 0&&b.attr("stroke-width",r.strokeWidth+"px");let S=g+e+s+Ut;d.append("line").attr("class","collapsed-separator").attr("x1",m+8).attr("y1",S).attr("x2",m+p-8).attr("y2",S).attr("stroke",c).attr("stroke-dasharray","3, 3");let w=S+Xt/2,$=2.5,B=10;for(let C=-1;C<=1;C++)d.append("circle").attr("class","collapsed-indicator").attr("cx",C*B).attr("cy",w).attr("r",$).attr("fill",c);return D(t,b),t.calcIntersect=function(C,G){return N.rect(C,G)},t.intersect=function(C){return N.rect(t,C)},d}x(Ne,"collapsedGroup");function et(n,t,r,i){return n.insert("polygon",":first-child").attr("points",i.map(function(c){return c.x+","+c.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 c=vr(n),l=(r.padding??0)/2,d=t.height+4*l,o=d/2,h=i??t.width+2*o+2*l,a=Mr(c);return($e[a]??$e[qt])({height:d,midpoint:o,padding:l,width:h})},"getArrowPoints");async function De(n,t){let r=t,{shapeSvg:i,bbox:c}=await T(n,r,M(r)),l=r.padding??0,d=c.height+2*l,o=d/2,h=c.width+2*o+l,a=r.width??0,s=r.positioned&&(r.widthInColumns??1)>1&&a>h?a:h,p=Tr(r.directions??[],c,r,s),f=et(i,s,d,p);return f.attr("style",r.style??null),D(r,f),r.intersect=function(m){return N.polygon(r,p,m)},i}x(De,"block_arrow");async function Pe(n,t,{config:{themeVariables:r}}){let{labelStyles:i,nodeStyles:c}=v(t);t.labelStyle=i;let{shapeSvg:l,bbox:d,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(d.width+a*2,t.width??0,90),f=Math.max(d.height+a*2+e,t.height??0),m=-f/2,{cssStyles:g}=t,u=l.insert("g",":first-child").attr("class","basic label-container");if(t.look==="handDrawn"){let S=k.svg(l).path(tt(-p/2,m,p,f,s),P(t,{}));u.node()?.appendChild(S),g&&u.attr("style",g)}else u.append("rect").attr("x",-p/2).attr("y",m).attr("width",p).attr("height",f).attr("rx",s).attr("ry",s).attr("style",c);u.append("line").attr("x1",-p/2).attr("y1",m+e).attr("x2",p/2).attr("y2",m+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",m+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",m+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=m+e+(f-e)/2;return o.attr("transform",`translate(${-(d.width/2)-(d.x-(d.left??0))}, ${y-d.height/2-(d.y-(d.top??0))})`),t.intersect=function(b){return N.rect(t,b)},l}x(Pe,"browser");var Lt=12;async function ke(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let c=t.padding??0,l=t.look==="neo"?28:c,d=t.look==="neo"?24:c,{shapeSvg:o,bbox:h}=await T(n,t,M(t)),a=(t?.width??h.width)+(t.look==="neo"?l*2:l+Lt),e=(t?.height??h.height)+(t.look==="neo"?d*2:d),s=0,p=a,f=-e,m=0,g=[{x:s+Lt,y:f},{x:p,y:f},{x:p,y:m},{x:s,y:m},{x:s,y:f+Lt},{x:s+Lt,y:f}],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:c}=t,l=Math.max(28,t.width??0),d=[{x:0,y:l/2},{x:l/2,y:0},{x:0,y:-l/2},{x:-l/2,y:0}],o=k.svg(i),h=P(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");let a=_(d),e=o.path(a,h),s=i.insert(()=>e,":first-child");return c&&t.look!=="handDrawn"&&s.selectAll("path").attr("style",c),r&&t.look!=="handDrawn"&&s.selectAll("path").attr("style",r),t.width=28,t.height=28,t.intersect=function(p){return N.polygon(t,d,p)},i}x(ve,"choice");async function It(n,t,r){let{labelStyles:i,nodeStyles:c}=v(t);t.labelStyle=i;let{shapeSvg:l,bbox:d,halfPadding:o}=await T(n,t,M(t),{ignoreMinWidth:!0}),h=16,a=r?.padding??o,e=Math.sqrt(d.width**2+d.height**2)/2,s=t.look==="neo"?e+h:e+a,p,{cssStyles:f}=t;if(t.look==="handDrawn"){let m=k.svg(l),g=P(t,{}),u=m.circle(0,0,s*2,g);p=l.insert(()=>u,":first-child"),p.attr("class","basic label-container").attr("style",q(f))}else p=l.insert("circle",":first-child").attr("class","basic label-container").attr("style",c).attr("r",s).attr("cx",0).attr("cy",0);return D(t,p),t.calcIntersect=function(m,g){let u=m.width/2;return N.circle(m,u,g)},t.intersect=function(m){return X.info("Circle intersect",t,s,m),N.circle(t,s,m)},l}x(It,"circle");async function Me(n,t){let r=t,i=["node",r.cssClasses,r.class].filter(Boolean).join(" "),{shapeSvg:c,bbox:l,halfPadding:d}=await T(n,r,i),o=c.insert("rect",":first-child"),h=r.padding??0,a=r.positioned?r.width??0:l.width+h,e=r.positioned?r.height??0:l.height+h,s=r.positioned?-a/2:-l.width/2-d,p=r.positioned?-e/2:-l.height/2-d;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(f){return N.rect(r,f)},c}x(Me,"composite");async function Te(n,t,{config:{themeVariables:r}}){let{labelStyles:i,nodeStyles:c}=v(t);t.labelStyle=i;let{shapeSvg:l,bbox:d,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(d.width+a*2,t.width??0,90),f=Math.max(d.height+a*2+e,t.height??0),m=-f/2,{cssStyles:g}=t,u=l.insert("g",":first-child").attr("class","basic label-container");if(t.look==="handDrawn"){let S=k.svg(l).path(tt(-p/2,m,p,f,s),P(t,{}));u.node()?.appendChild(S),g&&u.attr("style",g)}else u.append("rect").attr("x",-p/2).attr("y",m).attr("width",p).attr("height",f).attr("rx",s).attr("ry",s).attr("style",c);u.append("text").attr("x",-p/2+12).attr("y",m+16).attr("class","console-glyph").attr("style",`font-family:monospace;font-weight:bold;font-size:14px;fill:${h}`).text(">_"),D(t,u);let y=m+e+(f-e)/2;return o.attr("transform",`translate(${-(d.width/2)-(d.x-(d.left??0))}, ${y-d.height/2-(d.y-(d.top??0))})`),t.intersect=function(b){return N.rect(t,b)},l}x(Te,"consoleWindow");function Cr(n){let t=Math.cos(Math.PI/4),r=Math.sin(Math.PI/4),i=n*2,c={x:i/2*t,y:i/2*r},l={x:-(i/2)*t,y:i/2*r},d={x:-(i/2)*t,y:-(i/2)*r},o={x:i/2*t,y:-(i/2)*r};return`M ${l.x},${l.y} L ${o.x},${o.y}
                   M ${c.x},${c.y} L ${d.x},${d.y}`}x(Cr,"createLine");function Ce(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r,t.label="";let c=n.insert("g").attr("class",M(t)).attr("id",t.domId??t.id),l=Math.max(30,t?.width??0),{cssStyles:d}=t,o=k.svg(c),h=P(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");let a=o.circle(0,0,l*2,h),e=Cr(l),s=o.path(e,h),p=c.insert(()=>a,":first-child");return p.insert(()=>s),p.attr("class","outer-path"),d&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",d),i&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",i),D(t,p),t.intersect=function(f){return X.info("crossedCircle intersect",t,{radius:l,point:f}),N.circle(t,l,f)},c}x(Ce,"crossedCircle");function $t(n,t,r,i=100,c=0,l=180){let d=[],o=c*Math.PI/180,e=(l*Math.PI/180-o)/(i-1);for(let s=0;s<i;s++){let p=o+s*e,f=n+r*Math.cos(p),m=t+r*Math.sin(p);d.push({x:-f,y:-m})}return d}x($t,"generateCirclePoints");async function Be(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let{shapeSvg:c,bbox:l,label:d}=await T(n,t,M(t)),o=t.look==="neo"?18:t.padding??0,h=t.look==="neo"?12:t.padding??0,a=l.width+o,e=l.height+h,s=Math.max(5,e*.1),{cssStyles:p}=t,f=[...$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)],m=[{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(c),u=P(t,{fill:"none"});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let b=_(f).replace("Z",""),S=g.path(b,u),w=_(m),$=g.path(w,{...u}),B=c.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)`),d.attr("transform",`translate(${-a/2+s-(l.x-(l.left??0))},${-e/2+(t.padding??0)/2-(l.y-(l.top??0))})`),D(t,B),t.intersect=function(C){return N.polygon(t,m,C)},c}x(Be,"curlyBraceLeft");function Dt(n,t,r,i=100,c=0,l=180){let d=[],o=c*Math.PI/180,e=(l*Math.PI/180-o)/(i-1);for(let s=0;s<i;s++){let p=o+s*e,f=n+r*Math.cos(p),m=t+r*Math.sin(p);d.push({x:f,y:m})}return d}x(Dt,"generateCirclePoints");async function Ge(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let{shapeSvg:c,bbox:l,label:d}=await T(n,t,M(t)),o=t.look==="neo"?18:t.padding??0,h=t.look==="neo"?12:t.padding??0,a=l.width+(t.look==="neo"?o*2:o),e=l.height+(t.look==="neo"?h*2:h),s=Math.max(5,e*.1),{cssStyles:p}=t,f=[...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)],m=[{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(c),u=P(t,{fill:"none"});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let b=_(f).replace("Z",""),S=g.path(b,u),w=_(m),$=g.path(w,{...u}),B=c.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)`),d.attr("transform",`translate(${-a/2+(t.padding??0)/2-(l.x-(l.left??0))},${-e/2+(t.padding??0)/2-(l.y-(l.top??0))})`),D(t,B),t.intersect=function(C){return N.polygon(t,m,C)},c}x(Ge,"curlyBraceRight");function st(n,t,r,i=100,c=0,l=180){let d=[],o=c*Math.PI/180,e=(l*Math.PI/180-o)/(i-1);for(let s=0;s<i;s++){let p=o+s*e,f=n+r*Math.cos(p),m=t+r*Math.sin(p);d.push({x:-f,y:-m})}return d}x(st,"generateCirclePoints");async function Ee(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let{shapeSvg:c,bbox:l,label:d}=await T(n,t,M(t)),o=t.look==="neo"?18:t.padding??0,h=t.look==="neo"?12:t.padding??0,a=l.width+(t.look==="neo"?o*2:o),e=l.height+(t.look==="neo"?h*2:h),s=Math.max(5,e*.1),{cssStyles:p}=t,f=[...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)],m=[...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(c),y=P(t,{fill:"none"});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let S=_(f).replace("Z",""),w=u.path(S,y),B=_(m).replace("Z",""),C=u.path(B,y),G=_(g),V=u.path(G,{...y}),A=c.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)`),d.attr("transform",`translate(${-a/2+(t.padding??0)/2-(l.x-(l.left??0))},${-e/2+(t.padding??0)/2-(l.y-(l.top??0))})`),D(t,A),t.intersect=function(R){return N.polygon(t,g,R)},c}x(Ee,"curlyBraces");async function Re(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let c=t.padding??0,l=t.look==="neo"?16:c,d=t.look==="neo"?12:c,o=20,h=5,{shapeSvg:a,bbox:e}=await T(n,t,M(t)),s=Math.max(h,e.height+d*2,t?.height??0),p=s/2,f=p-Math.sqrt(Math.max(0,p**2-(e.height/2)**2)),m=Math.max(s/4,f),g=Math.max(o,e.width+l*2+m*2,(e.width+l*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:c,bbox:l,label:d}=await T(n,t,M(t)),o=t.padding??20,h=Math.max(l.width+o*2,t.width??0,100),a=Math.min(Math.max(h*.23,16),56),e=a*.27,s=Math.max(l.height+o*2,t.height?t.height-(2*a-e):0),p=Math.min(h*.177,s*.45),f=s+2*a-e,m=-f/2,g=m+2*a-e,u=c.insert("g",":first-child").attr("class","basic label-container"),{cssStyles:y}=t;if(t.look==="handDrawn"){let G=k.svg(c),V=P(t,{}),A=G.path(tt(-h/2,g,h,s,p),V),R=G.circle(0,m+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",m+a).attr("r",a).attr("style",i);D(t,u);let b=g+s/2;d.attr("transform",`translate(${-(l.width/2)-(l.x-(l.left??0))}, ${b-l.height/2-(l.y-(l.top??0))})`);let S=m+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),-(f/2-p),p,12,360,270),...nt(-(h/2-p),-(f/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)},c}x(Ae,"person");var Br=x((n,t,r,i,c,l)=>[`M${n},${t+l}`,`a${c},${l} 0,0,0 ${r},0`,`a${c},${l} 0,0,0 ${-r},0`,`l0,${i}`,`a${c},${l} 0,0,0 ${r},0`,`l0,${-i}`].join(" "),"createCylinderPathD"),Gr=x((n,t,r,i,c,l)=>[`M${n},${t+l}`,`M${n+r},${t+l}`,`a${c},${l} 0,0,0 ${-r},0`,`l0,${i}`,`a${c},${l} 0,0,0 ${r},0`,`l0,${-i}`].join(" "),"createOuterCylinderPathD"),Er=x((n,t,r,i,c,l)=>[`M${n-r/2},${-i/2}`,`a${c},${l} 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 c=t.padding??0,l=t.look==="neo"?24:c,d=t.look==="neo"?24:c,o=t.width??0;if(t.width&&(t.width=t.width-d,t.width<je&&(t.width=je)),t.height){let b=o/2/(2.5+o/50);t.height=t.height-l-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)+d,p=s/2,f=p/(2.5+s/50),m=Math.max(t.height??0,a.height)+l+f,g,{cssStyles:u}=t;if(t.look==="handDrawn"){let y=k.svg(h),b=Gr(0,0,s,m,p,f),S=Er(0,f,s,m,p,f),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,m,p,f);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",f),g.attr("transform",`translate(${-s/2}, ${-(m/2+f)})`),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-f)){let w=f*f*(1-S*S/(p*p));w>0&&(w=Math.sqrt(w)),w=f-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:c}=v(t);t.labelStyle=i;let{shapeSvg:l,bbox:d}=await T(n,t,M(t)),o=Math.max(d.width+r.labelPaddingX*2,t?.width||0),h=Math.max(d.height+r.labelPaddingY*2,t?.height||0),a=-o/2,e=-h/2,s,{rx:p,ry:f}=t,{cssStyles:m}=t;if(r?.rx&&r.ry&&(p=r.rx,f=r.ry),t.look==="handDrawn"){let g=k.svg(l),u=P(t,{}),y=p||f?g.path(tt(a,e,o,h,p||0),u):g.rectangle(a,e,o,h,u);s=l.insert(()=>y,":first-child"),s.attr("class","basic label-container").attr("style",q(m))}else s=l.insert("rect",":first-child"),s.attr("class","basic label-container").attr("style",c).attr("rx",q(p)).attr("ry",q(f)).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)},l}x(ft,"drawRect");async function Le(n,t){let{cssClasses:r,labelPaddingX:i,labelPaddingY:c,padding:l,width:d,height:o}=t,h={rx:0,ry:0,classes:r??"",labelPaddingX:i??(l??0)*2,labelPaddingY:c??l??0},a=await ft(n,t,h);if(t.look==="handDrawn"){let f=k.svg(a),m=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(()=>f.line(y.x,y.y,y.x+y.width,y.y,m),".basic.label-container g.label"),a.insert(()=>f.line(y.x,y.y+y.height,y.x+y.width,y.y+y.height,m),".basic.label-container g.label"),g.remove(),a}let e=a.select(".basic.label-container"),s=(Number(e.attr("width"))||d)??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 c=t.look==="neo"?16:t.padding??0,l=t.look==="neo"?16:t.padding??0,{shapeSvg:d,bbox:o,label:h}=await T(n,t,M(t)),a=o.width+c,e=o.height+l,s=e*.2,p=-a/2,f=-e/2-s/2,{cssStyles:m}=t,g=k.svg(d),u=P(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let y=[{x:p,y:f+s},{x:-p,y:f+s},{x:-p,y:-f},{x:p,y:-f},{x:p,y:f},{x:-p,y:f},{x:-p,y:f+s}],b=g.polygon(y.map(w=>[w.x,w.y]),u),S=d.insert(()=>b,":first-child");return S.attr("class","basic label-container outer-path"),m&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",m),i&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",i),h.attr("transform",`translate(${p+(t.padding??0)/2-(o.x-(o.left??0))}, ${f+s+(t.padding??0)/2-(o.y-(o.top??0))})`),D(t,S),t.intersect=function(w){return N.rect(t,w)},d}x(Ie,"dividedRectangle");async function Ve(n,t){let{labelStyles:r,nodeStyles:i}=v(t),c=t.look==="neo"?12:5;t.labelStyle=r;let l=t.padding??0,d=t.look==="neo"?16:l,{shapeSvg:o,bbox:h}=await T(n,t,M(t),{ignoreMinWidth:!0}),a=Math.sqrt(h.width**2+h.height**2)/2,e=(t?.width?t?.width/2:a)+(d??0),s=e+c,p,{cssStyles:f}=t;if(t.look==="handDrawn"){let m=k.svg(o),g=P(t,{roughness:.2,strokeWidth:2.5}),u=P(t,{roughness:.2,strokeWidth:1.5}),y=m.circle(0,0,s*2,g),b=m.circle(0,0,e*2,u);p=o.insert("g",":first-child"),p.attr("class",q(t.cssClasses)).attr("style",q(f)),p.node()?.appendChild(y),p.node()?.appendChild(b)}else{p=o.insert("g",":first-child");let m=p.insert("circle",":first-child"),g=p.insert("circle");p.attr("class","basic label-container").attr("style",i),m.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(m){return X.info("DoubleCircle intersect",t,s,m),N.circle(t,s,m)},o}x(Ve,"doublecircle");async function We(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let{shapeSvg:c,bbox:l,halfPadding:d}=await T(n,t,M(t)),{theme:o,themeVariables:h}=U();lt(c,t.colorIndex,o,h.borderColorArray);let a=d??10,e=l.width/2+a*2,s=l.height/2+a*2,p,{cssStyles:f}=t;if(t.look==="handDrawn"){let m=k.svg(c),g=P(t,{}),u=m.ellipse(0,0,e*2,s*2,g);p=c.insert(()=>u,":first-child"),p.attr("class","basic label-container"),f&&p.attr("style",f)}else p=c.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(m,g){let u=m.width/2,y=m.height/2;return N.ellipse(m,u,y,g)},t.intersect=function(m){return N.ellipse(t,e,s,m)},c}x(We,"usecaseEllipse");function _e(n,t,{config:{themeVariables:r}}){let{labelStyles:i,nodeStyles:c}=v(t);t.label="",t.labelStyle=i;let l=n.insert("g").attr("class",M(t)).attr("id",t.domId??t.id),d=7,{cssStyles:o}=t,h=k.svg(l),{nodeBorder:a}=r,e=P(t,{fillStyle:"solid"});t.look!=="handDrawn"&&(e.roughness=0);let s=h.circle(0,0,d*2,e),p=l.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),c&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",c),D(t,p),t.intersect=function(f){return X.info("filledCircle intersect",t,{radius:d,point:f}),N.circle(t,d,f)},l}x(_e,"filledCircle");var Ye=10,Fe=10;async function Xe(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let c=t.padding??0,l=t.look==="neo"?c*2:c;(t.width||t.height)&&(t.height=t?.height??0,t.height<Ye&&(t.height=Ye),t.width=(t?.width??0)-l-l/2,t.width<Fe&&(t.width=Fe));let{shapeSvg:d,bbox:o,label:h}=await T(n,t,M(t)),a=(t?.width?t?.width:o.width)+(l??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:f}=t,m=k.svg(d),g=P(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let u=_(p),y=m.path(u,g),b=d.insert(()=>y,":first-child").attr("transform",`translate(${-e/2}, ${e/2})`).attr("class","outer-path");return f&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",f),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)},d}x(Xe,"flippedTriangle");async function Ue(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let{shapeSvg:c,bbox:l,label:d}=await T(n,t,M(t)),o=t.padding??12,h=Math.max(l.width+o*2,t.width??0,90),a=l.height+o*2,e=Math.max(Math.min(a*.16,14),8),s=Math.max(a+e,t.height??0),p=s-e,f=Math.max(h*.38,28),m=-s/2,g=[{x:-h/2,y:m},{x:-h/2+f,y:m},{x:-h/2+f,y:m+e},{x:h/2,y:m+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(c).path(u,P(t,{}));b=c.insert(()=>$,":first-child").attr("class","basic label-container"),y&&b.attr("style",y)}else b=c.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=m+e+p/2;return d.attr("transform",`translate(${-(l.width/2)-(l.x-(l.left??0))}, ${S-l.height/2-(l.y-(l.top??0))})`),t.intersect=function(w){return N.polygon(t,g,w)},c}x(Ue,"folder");function qe(n,t,{dir:r,config:{state:i,themeVariables:c}}){let{nodeStyles:l}=v(t);t.label="";let d=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(d),f=P(t,{stroke:c.lineColor,fill:c.lineColor});t.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");let m=p.rectangle(e,s,h,a,f),g=d.insert(()=>m,":first-child");o&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",o),l&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",l),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)},d}x(qe,"forkJoin");async function ze(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let c=15,l=10,d=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<l&&(t.height=l),t.width=(t?.width??0)-d*2,t.width<c&&(t.width=c));let{shapeSvg:h,bbox:a}=await T(n,t,M(t)),e=(t?.height?t?.height:Math.max(l,a.height))+o*2,s=e/2,p=s-Math.sqrt(Math.max(0,s**2-(a.height/2)**2)),f=(t?.width?t?.width:Math.max(c,a.width)+p*2)+d*2,{cssStyles:m}=t,g=k.svg(h),u=P(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let y=[{x:-f/2,y:-e/2},{x:f/2-s,y:-e/2},...nt(-f/2+s,0,s,50,90,270),{x:f/2-s,y:e/2},{x:-f/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"),m&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",m),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,c)=>[`M${n+c},${t}`,`L${n+r-c},${t}`,`L${n+r},${t-i/2}`,`L${n+r-c},${t-i}`,`L${n+c},${t-i}`,`L${n},${t-i/2}`,"Z"].join(" "),"createHexagonPathD");async function Ze(n,t){let{labelStyles:r,nodeStyles:i}=v(t),c=t.look==="neo"?3.5:4;t.labelStyle=r;let l=t.padding??0,d=70,o=32,h=t.look==="neo"?d:l,a=t.look==="neo"?o:l;if(t.width||t.height){let S=(t.height??0)/c;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,f=p/c,m=(t?.width?t?.width:s.width)+2*f+a,g=[{x:f,y:0},{x:m-f,y:0},{x:m,y:-p/2},{x:m-f,y:-p},{x:f,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,m,p,f),$=b.path(w,S);u=e.insert(()=>$,":first-child").attr("transform",`translate(${-m/2}, ${p/2})`),y&&u.attr("style",y)}else u=et(e,m,p,g);return i&&u.attr("style",i),t.width=m,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:c}=await T(n,t,M(t)),l=Math.max(30,t?.width??0),d=Math.max(30,t?.height??0),{cssStyles:o}=t,h=k.svg(c),a=P(t,{});t.look!=="handDrawn"&&(a.roughness=0,a.fillStyle="solid");let e=[{x:0,y:0},{x:l,y:0},{x:0,y:d},{x:l,y:d}],s=_(e),p=h.path(s,a),f=c.insert(()=>p,":first-child");return f.attr("class","basic label-container outer-path"),o&&t.look!=="handDrawn"&&f.selectChildren("path").attr("style",o),i&&t.look!=="handDrawn"&&f.selectChildren("path").attr("style",i),f.attr("transform",`translate(${-l/2}, ${-d/2})`),D(t,f),t.intersect=function(m){return X.info("Pill intersect",t,{points:e}),N.polygon(t,e,m)},c}x(Je,"hourglass");async function Ke(n,t,{config:{themeVariables:r,flowchart:i}}){let{labelStyles:c}=v(t);t.labelStyle=c;let l=t.assetHeight??48,d=t.assetWidth??48,o=Math.max(l,d),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",f=o,m=o,{nodeBorder:g}=r,{stylesMap:u}=yt(t),y=-m/2,b=-f/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,m,f,$),C=Math.max(m,e.width),G=f+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+m/2,y:O-L/2+e.height+S},{x:E+m/2,y:O+L/2},{x:E-m/2,y:O+L/2},{x:E-m/2,y:O-L/2+e.height+S},{x:E-e.width/2,y:O-L/2+e.height+S}]:H=[{x:E-m/2,y:O-L/2},{x:E+m/2,y:O-L/2},{x:E+m/2,y:O-L/2+f},{x:E+e.width/2,y:O-L/2+f},{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+f},{x:E-m/2,y:O-L/2+f}],N.polygon(t,H,j)},a}x(Ke,"icon");async function Qe(n,t,{config:{themeVariables:r,flowchart:i}}){let{labelStyles:c}=v(t);t.labelStyle=c;let l=t.assetHeight??48,d=t.assetWidth??48,o=Math.max(l,d),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,f=t.label?8:0,m=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+f,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},${m?e.height/2+f/2-G/2-A:-e.height/2-f/2-G/2-A})`),$.attr("style",`color: ${y.get("stroke")??g};`),s.attr("transform",`translate(${-e.width/2-(e.x-(e.left??0))},${m?-O/2:O/2-e.height})`),H.attr("transform",`translate(0,${m?e.height/2+f/2:-e.height/2-f/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:c}=v(t);t.labelStyle=c;let l=t.assetHeight??48,d=t.assetWidth??48,o=Math.max(l,d),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"),f=t.pos==="t",m=o+s*2,g=o+s*2,{nodeBorder:u,mainBkg:y}=r,{stylesMap:b}=yt(t),S=-g/2,w=-m/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,m,5),C),A=Math.max(g,e.width),R=m+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},${f?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))},${f?-R/2:R/2-e.height})`),E.attr("transform",`translate(0,${f?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 f?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+m},{x:H+e.width/2,y:I-W/2+m},{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+m},{x:H-g/2,y:I-W/2+m}],N.polygon(t,F,L)},a}x(ts,"iconRounded");async function es(n,t,{config:{themeVariables:r,flowchart:i}}){let{labelStyles:c}=v(t);t.labelStyle=c;let l=t.assetHeight??48,d=t.assetWidth??48,o=Math.max(l,d),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"),f=t.pos==="t",m=o+s*2,g=o+s*2,{nodeBorder:u,mainBkg:y}=r,{stylesMap:b}=yt(t),S=-g/2,w=-m/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,m,.1),C),A=Math.max(g,e.width),R=m+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},${f?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))},${f?-R/2:R/2-e.height})`),E.attr("transform",`translate(0,${f?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 f?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+m},{x:H+e.width/2,y:I-W/2+m},{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+m},{x:H-g/2,y:I-W/2+m}],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 c=Number(i.naturalWidth.toString().replace("px","")),l=Number(i.naturalHeight.toString().replace("px",""));t.imageAspectRatio=c/l;let{labelStyles:d}=v(t);t.labelStyle=d;let o=r?.wrappingWidth;t.defaultWidth=r?.wrappingWidth;let h=Math.max(t.label?o??0:0,t?.assetWidth??c),a=t.constraint==="on"&&t?.assetHeight?t.assetHeight*t.imageAspectRatio:h,e=t.constraint==="on"?a/t.imageAspectRatio:t?.assetHeight??l;t.width=Math.max(a,o??0);let{shapeSvg:s,bbox:p,label:f}=await T(n,t,"image-shape default"),m=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},${m?B/2-e:-B/2})`)}return f.attr("transform",`translate(${-p.width/2-(p.x-(p.left??0))},${m?-e/2-p.height/2-y/2:e/2-p.height/2+y/2})`),G.attr("transform",`translate(0,${m?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 m?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 c=t.padding??0,l=c,d=t.look==="neo"?c*2:c,{shapeSvg:o,bbox:h}=await T(n,t,M(t)),a=Math.max(h.height+l*2,t.height??0),e=Math.max(h.width+d*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:f}=t;if(t.look==="handDrawn"){let m=k.svg(o),g=P(t,{}),u=_(s),y=m.path(u,g);p=o.insert(()=>y,":first-child").attr("transform",`translate(${-e/2}, ${a/2})`),f&&p.attr("style",f)}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(m){return N.polygon(t,s,m)},o}x(rs,"inv_trapezoid");async function os(n,t){let{shapeSvg:r,bbox:i,label:c}=await T(n,t,"label"),l=r.insert("rect",":first-child");return l.attr("width",.1).attr("height",.1),r.attr("class","label edgeLabel"),c.attr("transform",`translate(${-(i.width/2)-(i.x-(i.left??0))}, ${-(i.height/2)-(i.y-(i.top??0))})`),D(t,l),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 c=t.padding??0,l=c,d=t.look==="neo"?c*2:c,{shapeSvg:o,bbox:h}=await T(n,t,M(t)),a=Math.max(h.height+l,t.height??0),e=Math.max(h.width+d,(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:f}=t;if(t.look==="handDrawn"){let m=k.svg(o),g=P(t,{}),u=_(s),y=m.path(u,g);p=o.insert(()=>y,":first-child").attr("transform",`translate(${-e/2}, ${a/2})`),f&&p.attr("style",f)}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(m){return N.polygon(t,s,m)},o}x(as,"lean_left");async function is(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let c=t.padding??0,l=c,d=t.look==="neo"?c*2:c,{shapeSvg:o,bbox:h}=await T(n,t,M(t)),a=Math.max(h.height+l,t.height??0),e=Math.max(h.width+d,(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:f}=t;if(t.look==="handDrawn"){let m=k.svg(o),g=P(t,{}),u=_(s),y=m.path(u,g);p=o.insert(()=>y,":first-child").attr("transform",`translate(${-e/2}, ${a/2})`),f&&p.attr("style",f)}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(m){return N.polygon(t,s,m)},o}x(is,"lean_right");function ns(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.label="",t.labelStyle=r;let c=n.insert("g").attr("class",M(t)).attr("id",t.domId??t.id),{cssStyles:l}=t,d=Math.max(35,t?.width??0),o=Math.max(35,t?.height??0),h=7,a=[{x:d,y:0},{x:0,y:o+h/2},{x:d-2*h,y:o+h/2},{x:0,y:2*o},{x:d,y:o-h/2},{x:2*h,y:o-h/2}],e=k.svg(c),s=P(t,{});t.look!=="handDrawn"&&(s.roughness=0,s.fillStyle="solid");let p=_(a),f=e.path(p,s),m=c.insert(()=>f,":first-child");return m.attr("class","outer-path"),l&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",l),i&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",i),m.attr("transform",`translate(-${d/2},${-o})`),D(t,m),t.intersect=function(g){return X.info("lightningBolt intersect",t,g),N.polygon(t,a,g)},c}x(ns,"lightningBolt");var Ar=x((n,t,r,i,c,l,d)=>[`M${n},${t+l}`,`a${c},${l} 0,0,0 ${r},0`,`a${c},${l} 0,0,0 ${-r},0`,`l0,${i}`,`a${c},${l} 0,0,0 ${r},0`,`l0,${-i}`,`M${n},${t+l+d}`,`a${c},${l} 0,0,0 ${r},0`].join(" "),"createCylinderPathD"),Hr=x((n,t,r,i,c,l,d)=>[`M${n},${t+l}`,`M${n+r},${t+l}`,`a${c},${l} 0,0,0 ${-r},0`,`l0,${i}`,`a${c},${l} 0,0,0 ${r},0`,`l0,${-i}`,`M${n},${t+l+d}`,`a${c},${l} 0,0,0 ${r},0`].join(" "),"createOuterCylinderPathD"),jr=x((n,t,r,i,c,l)=>[`M${n-r/2},${-i/2}`,`a${c},${l} 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 c=t.padding??0,l=t.look==="neo"?16:c,d=t.look==="neo"?24:c;if(t.width||t.height){let y=t.width??0;t.width=(t.width??0)-l,t.width<cs&&(t.width=cs);let S=y/2/(2.5+y/50);t.height=(t.height??0)-d-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)+l*2,s=e/2,p=s/(2.5+e/50),f=(t?.height?t?.height:h.height)+p+d*2,m=f*.1,g,{cssStyles:u}=t;if(t.look==="handDrawn"){let y=k.svg(o),b=Hr(0,0,e,f,s,p,m),S=jr(0,p,e,f,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,f,s,p,m);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}, ${-(f/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 c=t.padding??0,l=t.look==="neo"?16:c,d=t.look==="neo"?12:c;if(t.width||t.height){let w=t.width;t.width=(w??0)*10/11-l*2,t.width<10&&(t.width=10),t.height=(t?.height??0)-d*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)+(l??0)*2,s=(t?.height?t?.height:h.height)+(d??0)*2,p=t.look==="neo"?s/4:s/8,f=s+p,{cssStyles:m}=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:-f/2},{x:-e/2-e/2*.1,y:f/2},...ct(-e/2-e/2*.1,f/2,e/2+e/2*.1,f/2,p,.8),{x:e/2+e/2*.1,y:-f/2},{x:-e/2-e/2*.1,y:-f/2},{x:-e/2,y:-f/2},{x:-e/2,y:f/2*1.1},{x:-e/2,y:-f/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"),m&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",m),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),c=Math.cos(ds),l=-Math.sin(ds),d=r*-l,o=n+r*c,h=i*c,a=i*l;return`M ${d-h} ${o-a} L ${d+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),c=(t.y??0)-(t.top??0);n.attr("transform",`translate(${-t.width/2-i},${r-t.height/2-c})`)},"positionLabel"),Et=x((n,t,r,i,c=!1)=>{if(t.look==="handDrawn"){let o=k.svg(n).path(r,P(t,c?{fill:"none"}:{}));return n.insert(()=>o,":first-child").attr("class",i)}let l=n.append("path").attr("class",i).attr("d",r);return c&&l.attr("fill","none"),l},"appendActorPath"),us=x((n,t,r,i,c,l,d=!1)=>{if(t.look==="handDrawn"){let a=k.svg(n).circle(r,i,c*2,P(t,d?{fill:"none"}:{}));return n.insert(()=>a,":first-child").attr("class",l)}let o=n.append("circle").attr("class",l).attr("cx",r).attr("cy",i).attr("r",c);return d&&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:c,nodeStyles:l}=v(t);t.labelStyle=c;let d=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,d,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 f,m;if(t.stereotype){let G=await mt(o,`\xAB${t.stereotype}\xBB`,{labelStyle:c,useHtmlLabels:t.useHtmlLabels,padding:0,centerLabel:!0,width:t.wrappingWidth});f=G.label.attr("class","label usecase-stereotype"),m=G.bbox}let g=o.append("g").attr("class",`usecase-actor-glyph ${Ir[r]}`).attr("style",l||null);await i(g,t),Wr(g,t,r);let u=t.padding??Lr,y=m?.height??0,b=zt+ms+h.height+(m?y+fs:0),S=Math.max(Or,h.width,m?.width??0)+u*2,w=b+u*2,$=-b/2;g.attr("transform",`translate(0,${$+zt/2})`);let B=$+zt+ms;f&&m&&(B+=y/2,ys(f,m,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 c=t.icon??"",l=await ae(c.includes(":")?c:`fa:${c}`),d=await gt(c,{height:ws,width:ws,fallbackPrefix:"fa"}),o=n.append("g").attr("class",`usecase-actor-icon-symbol${l?"":" usecase-actor-icon-fallback"}`).attr("aria-hidden","true").html(`<g>${d}</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),c=(t.y??0)-(t.top??0);n.attr("transform",`translate(${-t.width/2-i},${r-t.height/2-c})`)},"positionLabel");async function Ps(n,t){let r=t,{labelStyles:i,nodeStyles:c}=v(t);t.labelStyle=i;let l=r.stereotype?{...t,stereotype:void 0}:t,{shapeSvg:d,bbox:o,halfPadding:h,label:a}=await T(n,l,M(t,"usecase-business-shape"));a.attr("class","label usecase-label");let{theme:e,themeVariables:s}=U();lt(d,t.colorIndex,e,s.borderColorArray);let p,f;if(r.stereotype){let E=await mt(d,`\xAB${r.stereotype}\xBB`,{labelStyle:i,useHtmlLabels:t.useHtmlLabels,padding:0,centerLabel:!0,width:t.wrappingWidth});p=E.label.attr("class","label usecase-stereotype"),f=E.bbox}let m=f?2:0,g=o.height+(f?.height??0)+m,u=Math.max(o.width,f?.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&&f&&Ds(p,f,-g/2+f.height/2),Ds(a,o,g/2-o.height/2);let R;if(t.look==="handDrawn"){let O=k.svg(d).ellipse(0,0,b*2,S*2,P(t,{}));R=d.insert(()=>O,":first-child").attr("class","basic label-container usecase-business-ellipse")}else R=d.insert("ellipse",":first-child").attr("class","basic label-container usecase-business-ellipse").attr("style",c).attr("rx",b).attr("ry",S).attr("cx",0).attr("cy",0);d.append("path").attr("class","usecase-business-marker").attr("d",`M ${$} ${V} L ${B} ${A}`).attr("fill","none").attr("style",c||null);let j=r.accessibleName??r.label;return j&&d.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),d}x(Ps,"usecaseBusiness");var Jt=8,ks=4,Ur=1,Kt=x((n,t,r,i)=>{let c=(t.x??0)-(t.left??0),l=(t.y??0)-(t.top??0);n.attr("transform",`translate(${r-t.width/2-c},${i-t.height/2-l})`)},"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:c}=v(t),{stylesMap:l}=yt(t);t.labelStyle=i;let{shapeSvg:d,bbox:o,label:h}=await T(n,t,M(t,"usecase-json-table"));d.attr("role","img"),r.accessibleName&&d.attr("aria-label",r.accessibleName),h.attr("class","label usecase-json-title");let a=d.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,f=o.width+Jt*2,m=Math.max(f,s+p),g=p+Math.max(0,m-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(l.get("stroke-width")),w=m+S*2,$=b+S*2,B=-m/2,C=-b/2,G=t.look==="handDrawn"?k.svg(d):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",c)},"insertCell"),R=A(d,"label-container usecase-json-border",-w/2,-$/2,w,$);A(a,"usecase-json-cell usecase-json-title-cell",B,C,m,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),d}x(vs,"usecaseJsonTable");async function Ms(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let c=t.padding??0,l=t.look==="neo"?16:c,d=t.look==="neo"?12:c,o=t.look==="neo"?10:5;(t.width||t.height)&&(t.width=Math.max((t?.width??0)-l*2-2*o,10),t.height=Math.max((t?.height??0)-d*2-2*o,10));let{shapeSvg:h,bbox:a,label:e}=await T(n,t,M(t)),s=(t?.width?t?.width:a.width)+l*2+2*o,p=(t?.height?t?.height:a.height)+d*2+2*o,f=s-2*o,m=p-2*o,g=-f/2,u=-m/2,{cssStyles:y}=t,b=k.svg(h),S=P(t,{}),w=[{x:g-o,y:u+o},{x:g-o,y:u+m+o},{x:g+f-o,y:u+m+o},{x:g+f-o,y:u+m},{x:g+f,y:u+m},{x:g+f,y:u+m-o},{x:g+f+o,y:u+m-o},{x:g+f+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+f-o,y:u+o},{x:g+f-o,y:u+m},{x:g+f,y:u+m},{x:g+f,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:c,bbox:l,label:d}=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(l.width,t?.width??0)+h*2,p=Math.max(l.height,t?.height??0)+a*3,f=t.look==="neo"?p/4:p/8,m=p+(e?f/2:-f/2),g=-s/2,u=-m/2,y=10,{cssStyles:b}=t,S=ct(g-y,u+m+y,g+s-y,u+m+y,f,.8),w=S?.[S.length-1],$=[{x:g-y,y:u+y},{x:g-y,y:u+m+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(c),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=c.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,${-f/2})`),d.attr("transform",`translate(${-(l.width/2)-y-(l.x-(l.left??0))}, ${-(l.height/2)+y-f-(l.y-(l.top??0))})`),D(t,E),t.intersect=function(O){return N.polygon(t,$,O)},c}x(Ts,"multiWaveEdgedRectangle");async function Cs(n,t,{config:{themeVariables:r}}){let{labelStyles:i,nodeStyles:c}=v(t);t.labelStyle=i,t.useHtmlLabels||pt(Nt())||(t.centerLabel=!0);let{shapeSvg:d,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:f}=t,m=k.svg(d),g=P(t,{fill:r.noteBkgColor,stroke:r.noteBorderColor});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let u=m.rectangle(s,p,a,e,g),y=d.insert(()=>u,":first-child");return y.attr("class","basic label-container outer-path"),h.attr("class","label noteLabel"),f&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",f),c&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",c),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)},d}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:c,bbox:l}=await T(n,t,M(t)),d=l.width+(t.padding??0),o=l.height+(t.padding??0),h=d+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 f=k.svg(c),m=P(t,{}),g=zr(0,0,h),u=f.path(g,m);s=c.insert(()=>u,":first-child").attr("transform",`translate(${-h/2+a}, ${h/2})`),p&&s.attr("style",p)}else s=et(c,h,h,e),s.attr("transform",`translate(${-h/2+a}, ${h/2})`);return i&&s.attr("style",i),D(t,s),t.calcIntersect=function(f,m){let g=f.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(f,u,m)},t.intersect=function(f){return this.calcIntersect(t,f)},c}x(Bs,"question");async function Gs(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let c=t.padding??0,l=t.look==="neo"?21:c??0,d=t.look==="neo"?12:c??0,{shapeSvg:o,bbox:h,label:a}=await T(n,t,M(t)),e=h.width+(t.look==="neo"?l*2:l),s=Math.max(h.height+(t.look==="neo"?d*2:d),t.height??0),p=s/4,m=-Math.max(e,(t.width??0)-p)/2,g=-s/2,u=g/2,y=[{x:m+u,y:g},{x:m,y:0},{x:m+u,y:-g},{x:-m,y:-g},{x:-m,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 c;t.cssClasses?c="node "+t.cssClasses:c="node default";let l=n.insert("g").attr("class",c).attr("id",t.domId||t.id),d=l.insert("g"),o=l.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||[],f=e.getBBox(),m=await Ft(o,Array.isArray(p)?p.join("<br/>"):p,t.labelStyle,!0,!0),g=m.children[0],u=J(m);s=g.getBoundingClientRect(),u.attr("width",s.width),u.attr("height",s.height);let y=(t.padding||0)/2;J(m).attr("transform","translate( "+(s.width>f.width?0:(f.width-s.width)/2)+", "+(f.height+y+5)+")"),J(e).attr("transform","translate( "+(s.width<f.width?0:-(f.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(l),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+f.height+y,s.width/2+y,-s.height/2-y+f.height+y,V);C=l.insert(()=>(X.debug("Rough node insert CXC",A),R),":first-child"),B=l.insert(()=>(X.debug("Rough node insert CXC",A),A),":first-child")}else B=d.insert("rect",":first-child"),C=d.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+f.height+y).attr("y2",-s.height/2-y+f.height+y);return D(t,B),t.intersect=function(G){return N.rect(t,G)},l}x(Es,"rectWithTitle");async function Rs(n,t,{config:{themeVariables:r}}){let i=r?.radius??5,c={rx:i,ry:i,classes:"",labelPaddingX:(t?.padding??0)*1,labelPaddingY:(t?.padding??0)*1};return ft(n,t,c)}x(Rs,"roundedRect");var Mt=8;async function As(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let c=t.look==="neo"?16:t.padding??0,l=t.look==="neo"?12:t.padding??0,{shapeSvg:d,bbox:o,label:h}=await T(n,t,M(t)),a=(t?.width??o.width)+c*2+(t.look==="neo"?Mt:Mt*2),e=(t?.height??o.height)+l*2,s=a-Mt,p=e,f=Mt-a/2,m=-e/2,{cssStyles:g}=t,u=k.svg(d),y=P(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let b=[{x:f,y:m},{x:f+s,y:m},{x:f+s,y:m+p},{x:f-Mt,y:m+p},{x:f-Mt,y:m},{x:f,y:m},{x:f,y:m+p}],S=u.polygon(b.map($=>[$.x,$.y]),y),w=d.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,$)},d}x(As,"shadedProcess");async function Hs(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let c=t.padding??0,l=t.look==="neo"?16:c,d=t.look==="neo"?12:c;(t.width||t.height)&&(t.width=Math.max((t?.width??0)-l*2,10),t.height=Math.max((t?.height??0)/1.5-d*2,10));let{shapeSvg:o,bbox:h,label:a}=await T(n,t,M(t)),e=(t?.width?t?.width:h.width)+l*2,s=((t?.height?t?.height:h.height)+d*2)*1.5,p=e,f=s/1.5,m=-p/2,g=-f/2,{cssStyles:u}=t,y=k.svg(o),b=P(t,{});t.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");let S=[{x:m,y:g},{x:m,y:g+f},{x:m+p,y:g+f},{x:m+p,y:g-f/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, ${f/4})`),a.attr("transform",`translate(${-p/2+(t.padding??0)-(h.x-(h.left??0))}, ${-f/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,c=t.look==="neo"?12:r,l={rx:0,ry:0,classes:"",labelPaddingX:t.labelPaddingX??i,labelPaddingY:c},d=await ft(n,t,l);if(t.colorIndex!==void 0){let{theme:o,themeVariables:h}=U();lt(d,t.colorIndex,o,h.borderColorArray)}return d}x(js,"squareRect");var Qt=50,Zr=x((n,t,r)=>{let i=n.height+r,c=i*Math.cos(Math.PI/(2*(Qt-1))),l=Math.sqrt(Math.max(0,c**2-n.height**2));return{w:Math.max(n.width+i/4+t,1.5*i+(i-c),n.width+t+i-l),h:i}},"stadiumDimensions");async function Os(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let c=t.padding??0,l=t.look==="neo"?40:c,d=t.look==="neo"?24:c,{shapeSvg:o,bbox:h}=await T(n,t,M(t)),{w:a,h:e}=Zr(h,l,d),s=e/2,{cssStyles:p}=t,f=k.svg(o),m=P(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.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=f.path(u,m),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:c}=v(t);t.labelStyle=i;let{cssStyles:l}=t,{lineColor:d,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 f=s.circle(0,0,t.width,{...p,stroke:d,strokeWidth:2}),m=o??h,g=(t.width??0)*5/14,u=s.circle(0,0,g,{...p,fill:m,stroke:m,strokeWidth:2,fillStyle:"solid"}),y=e.insert(()=>f,":first-child");if(y.insert(()=>u),t.look!=="handDrawn"&&y.attr("class","outer-path"),l&&y.selectAll("path").attr("style",l),c&&y.selectAll("path").attr("style",c),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:c}=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 l=n.insert("g").attr("class","node default").attr("id",t.domId||t.id),d;if(t.look==="handDrawn"){let h=k.svg(l).circle(0,0,t.width,ne(i));d=l.insert(()=>h),d.attr("class","state-start").attr("r",(t.width??7)/2).attr("width",t.width??14).attr("height",t.height??14)}else d=l.insert("circle",":first-child"),d.attr("class","state-start").attr("r",(t.width??7)/2).attr("width",t.width??14).attr("height",t.height??14);if(t.width<25&&c&&t.look!=="handDrawn"){let o=n.node()?.ownerSVGElement?.id??"",h=o?`${o}-drop-shadow-small`:"drop-shadow-small";d.attr("style",`filter:url(#${h})`)}return D(t,d),t.intersect=function(o){return N.circle(t,(t.width??7)/2,o)},l}x(Vs,"stateStart");var Ct=8;async function Ws(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let c=t?.padding??8,l=t.look==="neo"?28:c,d=t.look==="neo"?12:c,{shapeSvg:o,bbox:h}=await T(n,t,M(t)),a=Math.max(h.width+2*Ct+l,t.width??0),e=Math.max(h.height+d,t.height??0),s=a-2*Ct,p=e,f=-a/2,m=-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(f,m,s+16,p,y),S=u.line(f+Ct,m,f+Ct,m+p,y),w=u.line(f+Ct+s,m,f+Ct+s,m+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 c=t.padding??0,l=t.look==="neo"?16:c,d=t.look==="neo"?12:c;(t.width||t.height)&&(t.height=Math.max((t?.height??0)-d*2,10),t.width=Math.max((t?.width??0)-l*2-te*(t.height+d*2),10));let{shapeSvg:o,bbox:h}=await T(n,t,M(t)),a=(t?.height?t?.height:h.height)+d*2,e=te*a,s=te*a,f=(t?.width?t?.width:h.width)+l*2+e-e,m=a,g=-f/2,u=-m/2,{cssStyles:y}=t,b=k.svg(o),S=P(t,{}),w=[{x:g-e/2,y:u},{x:g+f+e/2,y:u},{x:g+f+e/2,y:u+m},{x:g-e/2,y:u+m}],$=[{x:g+f-e/2,y:u+m},{x:g+f+e/2,y:u+m},{x:g+f+e/2,y:u+m-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:c,bbox:l,label:d}=await T(n,t,M(t)),o=Math.max(l.width+(t.padding??0)*2,t?.width??0),h=Math.max(l.height+(t.padding??0)*2,t?.height??0),a=h/8,e=.2*o,s=.2*h,p=h+a,{cssStyles:f}=t,m=k.svg(c),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),$=m.path(w,g),B=_(S),C=m.path(B,{...g,fillStyle:"solid"}),G=c.insert(()=>C,":first-child");return G.insert(()=>$,":first-child"),G.attr("class","basic label-container outer-path"),f&&t.look!=="handDrawn"&&G.selectAll("path").attr("style",f),i&&t.look!=="handDrawn"&&G.selectAll("path").attr("style",i),G.attr("transform",`translate(0,${-a/2})`),d.attr("transform",`translate(${-o/2+(t.padding??0)-(l.x-(l.left??0))},${-h/2+(t.padding??0)-a/2-(l.y-(l.top??0))})`),D(t,G),t.intersect=function(V){return N.polygon(t,u,V)},c}x(Ys,"taggedWaveEdgedRectangle");async function Fs(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let{shapeSvg:c,bbox:l}=await T(n,t,M(t)),d=Math.max(l.width+(t.padding??0),t?.width||0),o=Math.max(l.height+(t.padding??0),t?.height||0),h=-d/2,a=-o/2,e=c.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",d).attr("height",o),D(t,e),t.intersect=function(s){return N.rect(t,s)},c}x(Fs,"text");var Jr=x((n,t,r,i,c,l)=>`M${n},${t}
    a${c},${l} 0,0,1 0,${-i}
    l${r},0
    a${c},${l} 0,0,1 0,${i}
    M${r},${-i}
    a${c},${l} 0,0,0 0,${i}
    l${-r},0`,"createCylinderPathD"),Kr=x((n,t,r,i,c,l)=>[`M${n},${t}`,`M${n+r},${t}`,`a${c},${l} 0,0,0 0,${-i}`,`l${-r},0`,`a${c},${l} 0,0,0 0,${i}`,`l${r},0`].join(" "),"createOuterCylinderPathD"),Qr=x((n,t,r,i,c,l)=>[`M${n+r/2},${-i/2}`,`a${c},${l} 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 c=t.padding??0,l=t.look==="neo"?12:c/2,d=t.height??0;if(t.height&&(t.height=t.height-l,t.height<Xs&&(t.height=Xs)),t.width){let y=d/2/(2.5+d/50);t.width=t.width-l-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)+l,s=e/2,p=s/(2.5+e/50),f=Math.max(t.width??0,h.width)+p+l,{cssStyles:m}=t,g;if(t.look==="handDrawn"){let u=k.svg(o),y=Kr(0,0,f,e,p,s),b=Qr(0,0,f,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"),m&&g.attr("style",m)}else{let u=Jr(0,0,f,e,p,s);g=o.insert("path",":first-child").attr("d",u).attr("class","basic label-container").attr("style",q(m)).attr("style",i),g.attr("class","basic label-container outer-path"),m&&g.selectAll("path").attr("style",m),i&&g.selectAll("path").attr("style",i)}return g.attr("label-offset-x",p),g.attr("transform",`translate(${-f/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 c=t.padding??0,l=(t.look==="neo",c),d=t.look==="neo"?c*2:c,{shapeSvg:o,bbox:h}=await T(n,t,M(t)),a=Math.max(h.height+l,t.height??0),e=Math.max(h.width+d,(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:f}=t;if(t.look==="handDrawn"){let m=k.svg(o),g=P(t,{}),u=_(s),y=m.path(u,g);p=o.insert(()=>y,":first-child").attr("transform",`translate(${-e/2}, ${a/2})`),f&&p.attr("style",f)}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(m){return N.polygon(t,s,m)},o}x(zs,"trapezoid");async function Zs(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let c=t.padding??0,l=t.look==="neo"?16:c,d=t.look==="neo"?12:c,o=15,h=5;(t.width||t.height)&&(t.height=(t.height??0)-d*2,t.height<h&&(t.height=h),t.width=(t.width??0)-l*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)+l*2,p=(t?.height?t?.height:e.height)+d*2,{cssStyles:f}=t,m=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=m.path(y,g),S=a.insert(()=>b,":first-child");return S.attr("class","basic label-container outer-path"),f&&t.look!=="handDrawn"&&S.selectChildren("path").attr("style",f),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 c=t.padding??0,l=t.look==="neo"?c*2:c;(t.width||t.height)&&(t.width=((t?.width??0)-l)/2,t.width<Ks&&(t.width=Ks),t.height=t?.height??0,t.height<Js&&(t.height=Js));let{shapeSvg:d,bbox:o,label:h}=await T(n,t,M(t)),a=ht(U().flowchart?.htmlLabels),e=(t?.width?t?.width:o.width)+l,s=t?.height?t?.height:e+o.height,p=s,f=[{x:0,y:0},{x:p,y:0},{x:p/2,y:-s}],{cssStyles:m}=t,g=k.svg(d),u=P(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let y=_(f),b=g.path(y,u),S=d.insert(()=>b,":first-child").attr("transform",`translate(${-s/2}, ${s/2})`).attr("class","outer-path");return m&&t.look!=="handDrawn"&&S.selectChildren("path").attr("style",m),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,f,w),N.polygon(t,f,w)},d}x(Qs,"triangle");async function tr(n,t){let{labelStyles:r,nodeStyles:i}=v(t);t.labelStyle=r;let c=t.padding??0,l=t.look==="neo"?16:c,d=t.look==="neo"?12:c,o=!0;(t.width||t.height)&&(o=!1,t.width=(t?.width??0)-l*2,t.width<10&&(t.width=10),t.height=(t?.height??0)-d*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)+(l??0)*2,p=(t?.height?t?.height:a.height)+(d??0)*2,f=t.look==="neo"?p/4:p/8,m=p+(o?f:-f),{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:m/2},...ct(-s/2-b,m/2,s/2+b,m/2,f,.8),{x:s/2+b,y:-m/2},{x:-s/2-b,y:-m/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,${-f/2})`),e.attr("transform",`translate(${-s/2+(t.padding??0)-(a.x-(a.left??0))},${-p/2+(t.padding??0)-f-(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 c=t.padding??0,l=t.look==="neo"?16:c,d=t.look==="neo"?20:c;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-d-w*(20/9)),t.width=t.width-l*2}let{shapeSvg:o,bbox:h}=await T(n,t,M(t)),a=(t?.width?t?.width:h.width)+l*2,e=(t?.height?t?.height:h.height)+d,s=e/8,p=e+s*2,{cssStyles:f}=t,m=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=m.path(y,g),S=o.insert(()=>b,":first-child");return S.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",f),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 c=t.look==="neo"?16:t.padding??0,l=t.look==="neo"?12:t.padding??0;(t.width||t.height)&&(t.width=Math.max((t?.width??0)-c*2-K,10),t.height=Math.max((t?.height??0)-l*2-K,10));let{shapeSvg:d,bbox:o,label:h}=await T(n,t,M(t)),a=(t?.width?t?.width:o.width)+c*2+K,e=(t?.height?t?.height:o.height)+l*2+K,s=a-K,p=e-K,f=-s/2,m=-p/2,{cssStyles:g}=t,u=k.svg(d),y=P(t,{}),b=[{x:f-K,y:m-K},{x:f-K,y:m+p},{x:f+s,y:m+p},{x:f+s,y:m-K}],S=`M${f-K},${m-K} L${f+s},${m-K} L${f+s},${m+p} L${f-K},${m+p} L${f-K},${m-K}
                M${f-K},${m} L${f+s},${m}
                M${f},${m-K} L${f},${m+p}`;t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let w=u.path(S,y),$=d.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)},d}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:c}=Nt(),{rowEven:l,rowOdd:d,nodeBorder:o,borderColorArray:h}=c;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:f,nodeStyles:m}=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"],f);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"],f);$=Math.max($,z.width+e);let Q=await Rt(u,Y.name,a,0,b,["attribute-name"],f);B=Math.max(B,Q.width+e);let at=await Rt(u,Y.keys.join(),a,0,b,["attribute-keys"],f);C=Math.max(C,at.width+e);let Pt=await Rt(u,Y.comment,a,0,b,["attribute-comment"],f);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?l:d,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),m&&t.look!=="handDrawn")if(i!=null&&to.has(i))u.selectAll("path").attr("style",m);else{let z=m.split(";")?.filter(Q=>Q.includes("stroke"))?.map(Q=>`${Q}`).join("; ");u.selectAll("path").attr("style",z??""),u.selectAll(".row-rect-even path").attr("style",m)}return t.intersect=function(Y){return N.rect(t,Y)},u}x(ee,"erBox");async function Rt(n,t,r,i=0,c=0,l=[],d=""){let o=n.insert("g").attr("class",`label ${l.join(" ")}`).attr("transform",`translate(${i}, ${c})`).attr("style",d);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:d,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,c){return n===r?[{x:n-c/2,y:t},{x:n+c/2,y:t},{x:r+c/2,y:i},{x:r-c/2,y:i}]:[{x:n,y:t-c/2},{x:n,y:t+c/2},{x:r,y:i+c/2},{x:r,y:i-c/2}]}x(At,"lineToPolygon");async function or(n,t,r,i,c=r.class.padding??12){let l=i?0:3,d=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,f=0;if(o=d.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=d.insert("g").attr("class","label-group text"),await Vt(h,t,0,["font-weight: bolder"]);let m=h.node().getBBox();p=m.height,a=d.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+l}f=a.node().getBBox().height,f<=0&&(f=c/2),e=d.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+l}let y=d.node().getBBox();if(o!==null){let b=o.node().getBBox();o.attr("transform",`translate(${-b.width/2})`)}return h.attr("transform",`translate(${-m.width/2}, ${s})`),y=d.node().getBBox(),a.attr("transform",`translate(0, ${s+p+c*2})`),y=d.node().getBBox(),e.attr("transform",`translate(0, ${s+p+(f?f+c*4:c*2)})`),y=d.node().getBBox(),{shapeSvg:d,bbox:y}}x(or,"textHelper");async function Vt(n,t,r,i=[]){let c=n.insert("g").attr("class","label").attr("style",i.join("; ")),l=Nt(),d="useHtmlLabels"in t?t.useHtmlLabels:ht(l.htmlLabels)??!0,o="";"text"in t?o=t.text:o=t.label,!d&&o.startsWith("\\")&&(o=o.substring(1)),oe(o)&&(d=!0);let h=await it(c,Ht(xt(o)),{width:kt(o,l)+50,classes:"markdown-node-label",useHtmlLabels:d},l),a,e=1;if(d){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 c.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:c}=r,{useGradient:l,borderColorArray:d}=c,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,d);let{labelStyles:f,nodeStyles:m}=v(t);t.labelStyle=f,t.cssStyles=e.styles||"";let g=e.styles?.join(";")||m||"";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"&&!l?" 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"&&!l?" 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(f){let W=H.exec(f);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 c=t,l=t,d=20,o=20,h="verifyMethod"in t,a=M(t),e=U(),{themeVariables:s}=e,{borderColorArray:p,requirementEdgeLabelBackground:f}=s,m=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;${c.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,c.name,y,t.labelStyle+"; font-weight: bold;");if(y+=b+o,h){let R=await bt(g,`${c.requirementId?`ID: ${c.requirementId}`:""}`,y,t.labelStyle,m);y+=R;let j=await bt(g,`${c.text?`Text: ${c.text}`:""}`,y,t.labelStyle,m);y+=j;let E=await bt(g,`${c.risk?`Risk: ${c.risk}`:""}`,y,t.labelStyle,m);y+=E,await bt(g,`${c.verifyMethod?`Verification: ${c.verifyMethod}`:""}`,y,t.labelStyle,m)}else{let R=await bt(g,`${l.type?`Type: ${l.type}`:""}`,y,t.labelStyle,m);y+=R,await bt(g,`${l.docRef?`Doc Ref: ${l.docRef}`:""}`,y,t.labelStyle,m)}let S=(g.node()?.getBBox().width??200)+d,w=(g.node()?.getBBox().height??200)+d,$=-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=$+d/2;(j===0||j===1)&&(F=H),O.attr("transform",`translate(${F}, ${W+d})`)}),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"&&(f||p?.length)&&g.selectAll("path").attr("style",i),g}x(ir,"requirementBox");async function bt(n,t,r,i="",c="center"){if(t==="")return 0;let l=n.insert("g").attr("class","label").attr("style",i),d=U(),o=d.htmlLabels??!0,h=await it(l,Ht(xt(t)),{width:kt(t,d)+50,classes:"markdown-node-label",useHtmlLabels:o,style:i},d),a;if(o){let e=h.children[0],s=J(h);c==="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(c==="start"){e.setAttribute("text-anchor","start");for(let s of e.children)s.setAttribute("text-anchor","start")}a=h.getBBox(),a.height+=6}return l.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:c}=v(t);t.labelStyle=i||"";let l=10,d=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 f={useHtmlLabels:t.useHtmlLabels,labelStyle:t.labelStyle||"",width:t.width,img:t.img,padding:t.padding||8,centerLabel:!1},m,g;p?{label:m,bbox:g}=await mt(p,"ticket"in t&&t.ticket||"",f):{label:m,bbox:g}=await mt(o,"ticket"in t&&t.ticket||"",f);let{label:u,bbox:y}=await mt(o,"assigned"in t&&t.assigned||"",f);t.width=d;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)+")"),m.attr("transform","translate("+(e-S/2)+", "+(-w+h.height/2)+")"),u.attr("transform","translate("+(e+S/2-y.width-2*l)+", "+(-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",c).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:c,bbox:l,halfPadding:d,label:o}=await T(n,t,M(t)),h=l.width+10*d,a=l.height+8*d,e=.15*h,{cssStyles:s}=t,p=l.width+20,f=l.height+20,m=Math.max(h,p),g=Math.max(a,f);o.attr("transform",`translate(${-l.width/2}, ${-l.height/2})`);let u,y=`M0 0 
    a${e},${e} 1 0,0 ${m*.25},${-1*g*.1}
    a${e},${e} 1 0,0 ${m*.25},0
    a${e},${e} 1 0,0 ${m*.25},0
    a${e},${e} 1 0,0 ${m*.25},${g*.1}

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

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

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