UNPKG

ranui

Version:

A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.

63 lines 109 kB
const v=require("./chunk-Y2CYZVJY-DPaYLFFP.cjs"),X=require("./src-D8aDujwE.cjs"),Y=require("./chunk-I66GZJ75-BzqGKy7F.cjs"),U=require("./chunk-NSK5VX7P-DcRXFc-R.cjs"),kt=require("./chunk-4I5QYGJK-fRI-M8oC.cjs"),ct=require("./chunk-WRU74C26-zS0j4l0M.cjs"),At=require("./chunk-UBXNYLIW-rJ4d6bZj.cjs"),$=require("./chunk-W5SLKNZC-z8QxkdMj.cjs"),L=require("./rough.esm-BfSi6CZE.cjs");var W=v.__name(async(u,t,f)=>{let h;const l=t.useHtmlLabels||Y.evaluate(Y.getConfig2()?.htmlLabels);f?h=f:h="node default";const r=u.insert("g").attr("class",h).attr("id",t.domId||t.id),g=r.insert("g").attr("class","label").attr("style",U.handleUndefinedAttr(t.labelStyle));let i;t.label===void 0?i="":i=typeof t.label=="string"?t.label:t.label[0];const c=!!t.icon||!!t.img,a=t.labelType==="markdown",e=await ct.createText(g,Y.sanitizeText(U.decodeEntities(i),Y.getConfig2()),{useHtmlLabels:l,width:t.width||Y.getConfig2().flowchart?.wrappingWidth,classes:a?"markdown-node-label":"",style:t.labelStyle,addSvgBackground:c,markdown:a},Y.getConfig2());let s=e.getBBox();const n=(t?.padding??0)/2;if(l){const o=e.children[0],y=X.select_default(e);await At.configureLabelImages(o,i),s=o.getBoundingClientRect(),y.attr("width",s.width),y.attr("height",s.height)}return l?g.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"):g.attr("transform","translate(0, "+-s.height/2+")"),t.centerLabel&&g.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),g.insert("rect",":first-child"),{shapeSvg:r,bbox:s,halfPadding:n,label:g}},"labelHelper"),Pt=v.__name(async(u,t,f)=>{const h=f.useHtmlLabels??Y.getEffectiveHtmlLabels(Y.getConfig2()),l=u.insert("g").attr("class","label").attr("style",f.labelStyle||""),r=await ct.createText(l,Y.sanitizeText(U.decodeEntities(t),Y.getConfig2()),{useHtmlLabels:h,width:f.width||Y.getConfig2()?.flowchart?.wrappingWidth,style:f.labelStyle,addSvgBackground:!!f.icon||!!f.img});let g=r.getBBox();const i=f.padding/2;if(Y.getEffectiveHtmlLabels(Y.getConfig2())){const c=r.children[0],a=X.select_default(r);g=c.getBoundingClientRect(),a.attr("width",g.width),a.attr("height",g.height)}return h?l.attr("transform","translate("+-g.width/2+", "+-g.height/2+")"):l.attr("transform","translate(0, "+-g.height/2+")"),f.centerLabel&&l.attr("transform","translate("+-g.width/2+", "+-g.height/2+")"),l.insert("rect",":first-child"),{shapeSvg:u,bbox:g,halfPadding:i,label:l}},"insertLabel"),O=v.__name((u,t)=>{const f=t.node().getBBox();u.width=f.width,u.height=f.height},"updateNodeBounds"),E=v.__name((u,t)=>(u.look==="handDrawn"?"rough-node":"node")+" "+u.cssClasses+" "+(t||""),"getNodeClasses");function q(u){const t=u.map((f,h)=>`${h===0?"M":"L"}${f.x},${f.y}`);return t.push("Z"),t.join(" ")}v.__name(q,"createPathFromPoints");function gt(u,t,f,h,l,r){const g=[],c=f-u,a=h-t,e=c/r,s=2*Math.PI/e,n=t+a/2;for(let o=0;o<=50;o++){const y=u+o/50*c,d=n+l*Math.sin(s*(y-u));g.push({x:y,y:d})}return g}v.__name(gt,"generateFullSineWavePoints");function St(u,t,f,h,l,r){const g=[],i=l*Math.PI/180,c=(r*Math.PI/180-i)/(h-1);for(let a=0;a<h;a++){const e=i+a*c,s=u+f*Math.cos(e),n=t+f*Math.sin(e);g.push({x:-s,y:-n})}return g}v.__name(St,"generateCirclePoints");function Bt(u){const t=Array.from(u.childNodes).filter(c=>c.tagName==="path"),f=document.createElementNS("http://www.w3.org/2000/svg","path"),h=t.map(c=>c.getAttribute("d")).filter(c=>c!==null).join(" ");f.setAttribute("d",h);const l=t.find(c=>c.getAttribute("fill")!=="none"),r=t.find(c=>c.getAttribute("stroke")!=="none"),g=v.__name((c,a)=>c?.getAttribute(a)??void 0,"getAttr");if(l){const c={fill:g(l,"fill"),"fill-opacity":g(l,"fill-opacity")??"1"};Object.entries(c).forEach(([a,e])=>{e&&f.setAttribute(a,e)})}if(r){const c={stroke:g(r,"stroke"),"stroke-width":g(r,"stroke-width")??"1","stroke-opacity":g(r,"stroke-opacity")??"1"};Object.entries(c).forEach(([a,e])=>{e&&f.setAttribute(a,e)})}const i=document.createElementNS("http://www.w3.org/2000/svg","g");return i.appendChild(f),i}v.__name(Bt,"mergePaths");var dt=v.__name((u,t)=>{var f=u.x,h=u.y,l=t.x-f,r=t.y-h,g=u.width/2,i=u.height/2,c,a;return Math.abs(r)*g>Math.abs(l)*i?(r<0&&(i=-i),c=r===0?0:i*l/r,a=i):(l<0&&(g=-g),c=g,a=l===0?0:g*r/l),{x:f+c,y:h+a}},"intersectRect"),$t=v.__name(async(u,t,f,h=!1,l=!1)=>{let r=t||"";typeof r=="object"&&(r=r[0]);const g=Y.getConfig2(),i=Y.getEffectiveHtmlLabels(g);return await ct.createText(u,r,{style:f,isTitle:h,useHtmlLabels:i,markdown:!1,isNode:l,width:Number.POSITIVE_INFINITY},g)},"createLabel"),ft=v.__name((u,t,f,h,l)=>["M",u+l,t,"H",u+f-l,"A",l,l,0,0,1,u+f,t+l,"V",t+h-l,"A",l,l,0,0,1,u+f-l,t+h,"H",u+l,"A",l,l,0,0,1,u,t+h-l,"V",t+l,"A",l,l,0,0,1,u+l,t,"Z"].join(" "),"createRoundedRectPathD"),ps=v.__name(async(u,t)=>{const f=Y.getConfig2(),{themeVariables:h,handDrawnSeed:l}=f,{clusterBkg:r,clusterBorder:g}=h,i=g,{labelStyles:c,nodeStyles:a,borderStyles:e,backgroundStyles:s}=$.styles2String(t),n=u.insert("g").attr("class","cluster swimlane "+(t.cssClasses||"")).attr("id",t.id).attr("data-id",t.id).attr("data-et","cluster").attr("data-look",t.look),o=Y.evaluate(f.flowchart.htmlLabels),y=t.direction==="LR",d=n.insert("g").attr("class","cluster-label swimlane-label"),m=await ct.createText(d,t.label,{style:t.labelStyle,useHtmlLabels:o,isNode:!0,width:t.width});let p=m.getBBox();if(o){const M=m.children[0],B=X.select_default(m);p=M.getBoundingClientRect(),B.attr("width",p.width),B.attr("height",p.height)}const w=t.padding??0,b=t.width<=p.width+w?p.width+w:t.width;t.width<=p.width+w?t.diff=(b-t.width)/2-w:t.diff=-w;const S=t.height,x=t.y-S/2,N=t.y+S/2,k=t.x-b/2,_=t.swimlaneContentTop!==void 0?t.swimlaneContentTop:x+S/3,D=y?4:0,C=p.height+2*D;let R,T;if(y){const M=Math.max(C,p.height+2*D),B=k+M,P=Math.max(0,b-M);if(t.look==="handDrawn"){const G=L.at.svg(n),V=$.userNodeOverrides(t,{roughness:.7,fill:r,stroke:i,fillWeight:3,seed:l}),z=$.userNodeOverrides(t,{roughness:.7,fill:"none",stroke:i,seed:l}),at=G.rectangle(k,x,M,S,V);R=n.insert(()=>at,":first-child");const tt=G.rectangle(B,x,P,S,z);T=n.insert(()=>tt,":first-child"),R.select("path:nth-child(2)").attr("style",e.join(";")),R.select("path").attr("style",s.join(";").replace("fill","stroke"))}else R=n.insert("rect",":first-child"),T=n.insert("rect",":first-child"),R.attr("class","swimlane-title").attr("style",a).attr("x",k).attr("y",x).attr("width",M).attr("height",S).attr("fill",r).attr("stroke",i),T.attr("class","swimlane-body").attr("style",a).attr("x",B).attr("y",x).attr("width",P).attr("height",S).attr("fill","none").attr("stroke",i);const I=k+M/2,H=t.y;d.attr("transform",`translate(${I}, ${H}) rotate(-90) translate(${-p.width/2}, ${-p.height/2})`)}else{const M=Math.max(0,_-x),B=Math.min(C,M),P=x+B,I=Math.max(0,N-P),H=t.x-b/2;if(t.look==="handDrawn"){const z=L.at.svg(n),at=$.userNodeOverrides(t,{roughness:.7,fill:r,stroke:i,fillWeight:3,seed:l}),tt=$.userNodeOverrides(t,{roughness:.7,fill:"none",stroke:i,seed:l}),it=z.rectangle(H,x,b,B,at);R=n.insert(()=>it,":first-child");const Q=z.rectangle(H,P,b,I,tt);T=n.insert(()=>Q,":first-child"),R.select("path:nth-child(2)").attr("style",e.join(";")),R.select("path").attr("style",s.join(";").replace("fill","stroke"))}else R=n.insert("rect",":first-child"),T=n.insert("rect",":first-child"),R.attr("class","swimlane-title").attr("style",a).attr("x",H).attr("y",x).attr("width",b).attr("height",B).attr("fill",r).attr("stroke",i),T.attr("class","swimlane-body").attr("style",a).attr("x",H).attr("y",P).attr("width",b).attr("height",I).attr("fill","none").attr("stroke",i);const G=t.x-p.width/2,V=x+(B-p.height)/2;d.attr("transform",`translate(${G}, ${V})`)}if(X.log.trace("Swimlane data ",t,JSON.stringify(t)),c){const M=d.select("span");M&&M.attr("style",c)}return t.offsetX=0,t.width=b,t.height=S,t.offsetY=p.height-w/2,t.intersect=function(M){return dt(t,M)},{cluster:n,labelBBox:p}},"swimlane"),It=v.__name(async(u,t)=>{X.log.info("Creating subgraph rect for ",t.id,t);const f=Y.getConfig2(),{themeVariables:h,handDrawnSeed:l}=f,{clusterBkg:r,clusterBorder:g}=h,{labelStyles:i,nodeStyles:c,borderStyles:a,backgroundStyles:e}=$.styles2String(t),s=u.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.domId).attr("data-look",t.look),n=Y.getEffectiveHtmlLabels(f),o=s.insert("g").attr("class","cluster-label ");let y;t.labelType==="markdown"?y=await ct.createText(o,t.label,{style:t.labelStyle,useHtmlLabels:n,isNode:!0,width:t.width}):y=await $t(o,t.label,t.labelStyle||"",!1,!0);let d=y.getBBox();if(Y.getEffectiveHtmlLabels(f)){const k=y.children[0],_=X.select_default(y);d=k.getBoundingClientRect(),_.attr("width",d.width),_.attr("height",d.height)}const m=t.width<=d.width+t.padding?d.width+t.padding:t.width;t.width<=d.width+t.padding?t.diff=(m-t.width)/2-t.padding:t.diff=-t.padding;const p=t.height,w=t.x-m/2,b=t.y-p/2;X.log.trace("Data ",t,JSON.stringify(t));let S;if(t.look==="handDrawn"){const k=L.at.svg(s),_=$.userNodeOverrides(t,{roughness:.7,fill:r,stroke:g,fillWeight:3,seed:l}),D=k.path(ft(w,b,m,p,0),_);S=s.insert(()=>(X.log.debug("Rough node insert CXC",D),D),":first-child"),S.select("path:nth-child(2)").attr("style",a.join(";")),S.select("path").attr("style",e.join(";").replace("fill","stroke"))}else S=s.insert("rect",":first-child"),S.attr("style",c).attr("rx",t.rx).attr("ry",t.ry).attr("x",w).attr("y",b).attr("width",m).attr("height",p);const{subGraphTitleTopMargin:x}=At.getSubGraphTitleMargins(f);if(o.attr("transform",`translate(${t.x-d.width/2}, ${t.y-t.height/2+x})`),i){const k=o.select("span");k&&k.attr("style",i)}const N=S.node().getBBox();return t.offsetX=0,t.width=N.width,t.height=N.height,t.offsetY=d.height-t.padding/2,t.intersect=function(k){return dt(t,k)},{cluster:s,labelBBox:d}},"rect"),ms={rect:It,squareRect:It,roundedWithTitle:v.__name(async(u,t)=>{const f=Y.getConfig2(),{themeVariables:h,handDrawnSeed:l}=f,{altBackground:r,compositeBackground:g,compositeTitleBackground:i,nodeBorder:c}=h,a=u.insert("g").attr("class",t.cssClasses).attr("id",t.domId).attr("data-id",t.id).attr("data-look",t.look),e=a.insert("g",":first-child"),s=a.insert("g").attr("class","cluster-label");let n=a.append("rect");const o=await $t(s,t.label,t.labelStyle,void 0,!0);let y=o.getBBox();if(Y.getEffectiveHtmlLabels(f)){const _=o.children[0],D=X.select_default(o);y=_.getBoundingClientRect(),D.attr("width",y.width),D.attr("height",y.height)}const d=0*t.padding,m=d/2,p=(t.width<=y.width+t.padding?y.width+t.padding:t.width)+d;t.width<=y.width+t.padding?t.diff=(p-t.width)/2-t.padding:t.diff=-t.padding;const w=t.height+d,b=t.height+d-y.height-6,S=t.x-p/2,x=t.y-w/2;t.width=p;const N=t.y-t.height/2-m+y.height+2;let k;if(t.look==="handDrawn"){const _=t.cssClasses.includes("statediagram-cluster-alt"),D=L.at.svg(a),C=t.rx||t.ry?D.path(ft(S,x,p,w,10),{roughness:.7,fill:i,fillStyle:"solid",stroke:c,seed:l}):D.rectangle(S,x,p,w,{seed:l});k=a.insert(()=>C,":first-child");const R=D.rectangle(S,N,p,b,{fill:_?r:g,fillStyle:_?"hachure":"solid",stroke:c,seed:l});k=a.insert(()=>C,":first-child"),n=a.insert(()=>R)}else k=e.insert("rect",":first-child"),k.attr("class","outer").attr("x",S).attr("y",x).attr("width",p).attr("height",w).attr("data-look",t.look),n.attr("class","inner").attr("x",S).attr("y",N).attr("width",p).attr("height",b);return s.attr("transform",`translate(${t.x-y.width/2}, ${x+1-(Y.getEffectiveHtmlLabels(f)?0:3)})`),t.height=k.node().getBBox().height,t.offsetX=0,t.offsetY=y.height-t.padding/2,t.labelBBox=y,t.intersect=function(_){return dt(t,_)},{cluster:a,labelBBox:y}},"roundedWithTitle"),noteGroup:v.__name((u,t)=>{const f=u.insert("g").attr("class","note-cluster").attr("id",t.domId),h=f.insert("rect",":first-child"),l=0*t.padding,r=l/2;h.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-r).attr("y",t.y-t.height/2-r).attr("width",t.width+l).attr("height",t.height+l).attr("fill","none");const g=h.node().getBBox();return t.width=g.width,t.height=g.height,t.intersect=function(i){return dt(t,i)},{cluster:f,labelBBox:{width:0,height:0}}},"noteGroup"),divider:v.__name((u,t)=>{const{themeVariables:f,handDrawnSeed:h}=Y.getConfig2(),{nodeBorder:l}=f,r=u.insert("g").attr("class",t.cssClasses).attr("id",t.domId).attr("data-look",t.look),g=r.insert("g",":first-child"),i=0*t.padding,c=t.width+i;t.diff=-t.padding;const a=t.height+i,e=t.x-c/2,s=t.y-a/2;t.width=c;let n;if(t.look==="handDrawn"){const o=L.at.svg(r).rectangle(e,s,c,a,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:l,seed:h});n=r.insert(()=>o,":first-child")}else{n=g.insert("rect",":first-child");let o="outer";t.look,o="divider",n.attr("class",o).attr("x",e).attr("y",s).attr("width",c).attr("height",a).attr("data-look",t.look)}return t.height=n.node().getBBox().height,t.offsetX=0,t.offsetY=0,t.intersect=function(o){return dt(t,o)},{cluster:r,labelBBox:{}}},"divider"),kanbanSection:v.__name(async(u,t)=>{X.log.info("Creating subgraph rect for ",t.id,t);const f=Y.getConfig2(),{themeVariables:h,handDrawnSeed:l}=f,{clusterBkg:r,clusterBorder:g}=h,{labelStyles:i,nodeStyles:c,borderStyles:a,backgroundStyles:e}=$.styles2String(t),s=u.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.domId).attr("data-look",t.look),n=Y.getEffectiveHtmlLabels(f),o=s.insert("g").attr("class","cluster-label "),y=await ct.createText(o,t.label,{style:t.labelStyle,useHtmlLabels:n,isNode:!0,width:t.width});let d=y.getBBox();if(Y.getEffectiveHtmlLabels(f)){const k=y.children[0],_=X.select_default(y);d=k.getBoundingClientRect(),_.attr("width",d.width),_.attr("height",d.height)}const m=t.width<=d.width+t.padding?d.width+t.padding:t.width;t.width<=d.width+t.padding?t.diff=(m-t.width)/2-t.padding:t.diff=-t.padding;const p=t.height,w=t.x-m/2,b=t.y-p/2;X.log.trace("Data ",t,JSON.stringify(t));let S;if(t.look==="handDrawn"){const k=L.at.svg(s),_=$.userNodeOverrides(t,{roughness:.7,fill:r,stroke:g,fillWeight:4,seed:l}),D=k.path(ft(w,b,m,p,t.rx),_);S=s.insert(()=>(X.log.debug("Rough node insert CXC",D),D),":first-child"),S.select("path:nth-child(2)").attr("style",a.join(";")),S.select("path").attr("style",e.join(";").replace("fill","stroke"))}else S=s.insert("rect",":first-child"),S.attr("style",c).attr("rx",t.rx).attr("ry",t.ry).attr("x",w).attr("y",b).attr("width",m).attr("height",p);const{subGraphTitleTopMargin:x}=At.getSubGraphTitleMargins(f);if(o.attr("transform",`translate(${t.x-d.width/2}, ${t.y-t.height/2+x})`),i){const k=o.select("span");k&&k.attr("style",i)}const N=S.node().getBBox();return t.offsetX=0,t.width=N.width,t.height=N.height,t.offsetY=d.height-t.padding/2,t.intersect=function(k){return dt(t,k)},{cluster:s,labelBBox:d}},"kanbanSection"),swimlane:ps},zt=new Map,ws=v.__name(async(u,t)=>{const f=await ms[t.shape||"rect"](u,t);return zt.set(t.id,f),f},"insertCluster"),bs=v.__name(()=>{zt=new Map},"clear");function Ut(u,t){return u.intersect(t)}v.__name(Ut,"intersectNode");var xs=Ut;function Zt(u,t,f,h){var l=u.x,r=u.y,g=l-h.x,i=r-h.y,c=Math.sqrt(t*t*i*i+f*f*g*g),a=Math.abs(t*f*g/c);h.x<l&&(a=-a);var e=Math.abs(t*f*i/c);return h.y<r&&(e=-e),{x:l+a,y:r+e}}v.__name(Zt,"intersectEllipse");var Jt=Zt;function Kt(u,t,f){return Jt(u,t,t,f)}v.__name(Kt,"intersectCircle");var Ss=Kt;function Qt(u,t,f,h){{const l=t.y-u.y,r=u.x-t.x,g=t.x*u.y-u.x*t.y,i=l*f.x+r*f.y+g,c=l*h.x+r*h.y+g,a=1e-6;if(i!==0&&c!==0&&Mt(i,c))return;const e=h.y-f.y,s=f.x-h.x,n=h.x*f.y-f.x*h.y,o=e*u.x+s*u.y+n,y=e*t.x+s*t.y+n;if(Math.abs(o)<a&&Math.abs(y)<a&&Mt(o,y))return;const d=l*s-e*r;if(d===0)return;const m=Math.abs(d/2);let p=r*n-s*g;const w=p<0?(p-m)/d:(p+m)/d;return p=e*g-l*n,{x:w,y:p<0?(p-m)/d:(p+m)/d}}}v.__name(Qt,"intersectLine");function Mt(u,t){return u*t>0}v.__name(Mt,"sameSign");var $s=Qt;function te(u,t,f){let h=u.x,l=u.y,r=[],g=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(e){g=Math.min(g,e.x),i=Math.min(i,e.y)}):(g=Math.min(g,t.x),i=Math.min(i,t.y));let c=h-u.width/2-g,a=l-u.height/2-i;for(let e=0;e<t.length;e++){let s=t[e],n=t[e<t.length-1?e+1:0],o=$s(u,f,{x:c+s.x,y:a+s.y},{x:c+n.x,y:a+n.y});o&&r.push(o)}return r.length?(r.length>1&&r.sort(function(e,s){let n=e.x-f.x,o=e.y-f.y,y=Math.sqrt(n*n+o*o),d=s.x-f.x,m=s.y-f.y,p=Math.sqrt(d*d+m*m);return y<p?-1:y===p?0:1}),r[0]):u}v.__name(te,"intersectPolygon");var A={node:xs,circle:Ss,ellipse:Jt,polygon:te,rect:dt};function ee(u,t){const{labelStyles:f}=$.styles2String(t);t.labelStyle=f;const h=E(t);let l=h;h||(l="anchor");const r=u.insert("g").attr("class",l).attr("id",t.domId||t.id),g=1,{cssStyles:i}=t,c=L.at.svg(r),a=$.userNodeOverrides(t,{fill:"black",stroke:"none",fillStyle:"solid"});t.look!=="handDrawn"&&(a.roughness=0);const e=c.circle(0,0,2,a),s=r.insert(()=>e,":first-child");return s.attr("class","anchor").attr("style",U.handleUndefinedAttr(i)),O(t,s),t.intersect=function(n){return X.log.info("Circle intersect",t,g,n),A.circle(t,g,n)},r}v.__name(ee,"anchor");function Ct(u,t,f,h,l,r,g){const c=(u+f)/2,a=(t+h)/2,e=Math.atan2(h-t,f-u),s=(f-u)/2,n=(h-t)/2,o=s/l,y=n/r,d=Math.sqrt(o**2+y**2);if(d>1)throw new Error("The given radii are too small to create an arc between the points.");const m=Math.sqrt(1-d**2),p=c+m*r*Math.sin(e)*(g?-1:1),w=a-m*l*Math.cos(e)*(g?-1:1),b=Math.atan2((t-w)/r,(u-p)/l);let S=Math.atan2((h-w)/r,(f-p)/l)-b;g&&S<0&&(S+=2*Math.PI),!g&&S>0&&(S-=2*Math.PI);const x=[];for(let N=0;N<20;N++){const k=b+N/19*S,_=p+l*Math.cos(k),D=w+r*Math.sin(k);x.push({x:_,y:D})}return x}v.__name(Ct,"generateArcPoints");function se(u,t,f){const[h,l]=[t,f].sort((r,g)=>g-r);return l*(1-Math.sqrt(1-(u/h/2)**2))}v.__name(se,"calculateArcSagitta");async function ae(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=t.look==="neo"?16:l,g=t.look==="neo"?12:l,i=v.__name(_=>_+g,"calcTotalHeight"),c=v.__name(_=>{const D=_/2;return[D/(2.5+_/50),D]},"calcEllipseRadius"),{shapeSvg:a,bbox:e}=await W(u,t,E(t)),s=i(t?.height?t?.height:e.height),[n,o]=c(s),y=se(s,n,o),d=(t?.width?t?.width:e.width)+r*2+y-y,m=s,{cssStyles:p}=t,w=[{x:d/2,y:-m/2},{x:-d/2,y:-m/2},...Ct(-d/2,-m/2,-d/2,m/2,n,o,!1),{x:d/2,y:m/2},...Ct(d/2,m/2,d/2,-m/2,n,o,!0)],b=L.at.svg(a),S=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");const x=q(w),N=b.path(x,S),k=a.insert(()=>N,":first-child");return k.attr("class","basic label-container outer-path"),p&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",p),h&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",h),k.attr("transform",`translate(${n/2}, 0)`),O(t,k),t.intersect=function(_){return A.polygon(t,w,_)},a}v.__name(ae,"bowTieRect");function ot(u,t,f,h){return u.insert("polygon",":first-child").attr("points",h.map(function(l){return l.x+","+l.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+f/2+")")}v.__name(ot,"insertPolygonShape");var vt=12;async function ie(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=t.look==="neo"?28:l,g=t.look==="neo"?24:l,{shapeSvg:i,bbox:c}=await W(u,t,E(t)),a=(t?.width??c.width)+(t.look==="neo"?r*2:r+vt),e=(t?.height??c.height)+(t.look==="neo"?g*2:g),s=0,n=a,o=-e,y=0,d=[{x:s+vt,y:o},{x:n,y:o},{x:n,y},{x:s,y},{x:s,y:o+vt},{x:s+vt,y:o}];let m;const{cssStyles:p}=t;if(t.look==="handDrawn"){const w=L.at.svg(i),b=$.userNodeOverrides(t,{}),S=q(d),x=w.path(S,b);m=i.insert(()=>x,":first-child").attr("transform",`translate(${-a/2}, ${e/2})`),p&&m.attr("style",p)}else m=ot(i,a,e,d);return h&&m.attr("style",h),O(t,m),t.intersect=function(w){return A.polygon(t,d,w)},i}v.__name(ie,"card");function re(u,t){const{nodeStyles:f}=$.styles2String(t);t.label="";const h=u.insert("g").attr("class",E(t)).attr("id",t.domId??t.id),{cssStyles:l}=t,r=Math.max(28,t.width??0),g=[{x:0,y:r/2},{x:r/2,y:0},{x:0,y:-r/2},{x:-r/2,y:0}],i=L.at.svg(h),c=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(c.roughness=0,c.fillStyle="solid");const a=q(g),e=i.path(a,c),s=h.insert(()=>e,":first-child");return l&&t.look!=="handDrawn"&&s.selectAll("path").attr("style",l),f&&t.look!=="handDrawn"&&s.selectAll("path").attr("style",f),t.width=28,t.height=28,t.intersect=function(n){return A.polygon(t,g,n)},h}v.__name(re,"choice");async function Rt(u,t,f){const{labelStyles:h,nodeStyles:l}=$.styles2String(t);t.labelStyle=h;const{shapeSvg:r,bbox:g,halfPadding:i}=await W(u,t,E(t)),c=f?.padding??i,a=t.look==="neo"?g.width/2+32:g.width/2+c;let e;const{cssStyles:s}=t;if(t.look==="handDrawn"){const n=L.at.svg(r),o=$.userNodeOverrides(t,{}),y=n.circle(0,0,a*2,o);e=r.insert(()=>y,":first-child"),e.attr("class","basic label-container").attr("style",U.handleUndefinedAttr(s))}else e=r.insert("circle",":first-child").attr("class","basic label-container").attr("style",l).attr("r",a).attr("cx",0).attr("cy",0);return O(t,e),t.calcIntersect=function(n,o){const y=n.width/2;return A.circle(n,y,o)},t.intersect=function(n){return X.log.info("Circle intersect",t,a,n),A.circle(t,a,n)},r}v.__name(Rt,"circle");function le(u){const t=Math.cos(Math.PI/4),f=Math.sin(Math.PI/4),h=u*2,l={x:h/2*t,y:h/2*f},r={x:-(h/2)*t,y:h/2*f},g={x:-(h/2)*t,y:-(h/2)*f},i={x:h/2*t,y:-(h/2)*f};return`M ${r.x},${r.y} L ${i.x},${i.y}
                   M ${l.x},${l.y} L ${g.x},${g.y}`}v.__name(le,"createLine");function ne(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f,t.label="";const l=u.insert("g").attr("class",E(t)).attr("id",t.domId??t.id),r=Math.max(30,t?.width??0),{cssStyles:g}=t,i=L.at.svg(l),c=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(c.roughness=0,c.fillStyle="solid");const a=i.circle(0,0,r*2,c),e=le(r),s=i.path(e,c),n=l.insert(()=>a,":first-child");return n.insert(()=>s),n.attr("class","outer-path"),g&&t.look!=="handDrawn"&&n.selectAll("path").attr("style",g),h&&t.look!=="handDrawn"&&n.selectAll("path").attr("style",h),O(t,n),t.intersect=function(o){return X.log.info("crossedCircle intersect",t,{radius:r,point:o}),A.circle(t,r,o)},l}v.__name(ne,"crossedCircle");function lt(u,t,f,h=100,l=0,r=180){const g=[],i=l*Math.PI/180,c=(r*Math.PI/180-i)/(h-1);for(let a=0;a<h;a++){const e=i+a*c,s=u+f*Math.cos(e),n=t+f*Math.sin(e);g.push({x:-s,y:-n})}return g}v.__name(lt,"generateCirclePoints");async function ce(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const{shapeSvg:l,bbox:r,label:g}=await W(u,t,E(t)),i=t.look==="neo"?18:t.padding??0,c=t.look==="neo"?12:t.padding??0,a=r.width+i,e=r.height+c,s=Math.max(5,e*.1),{cssStyles:n}=t,o=[...lt(a/2,-e/2,s,30,-90,0),{x:-a/2-s,y:s},...lt(a/2+s*2,-s,s,20,-180,-270),...lt(a/2+s*2,s,s,20,-90,-180),{x:-a/2-s,y:-e/2},...lt(a/2,e/2,s,20,0,90)],y=[{x:a/2,y:-e/2-s},{x:-a/2,y:-e/2-s},...lt(a/2,-e/2,s,20,-90,0),{x:-a/2-s,y:-s},...lt(a/2+a*.1,-s,s,20,-180,-270),...lt(a/2+a*.1,s,s,20,-90,-180),{x:-a/2-s,y:e/2},...lt(a/2,e/2,s,20,0,90),{x:-a/2,y:e/2+s},{x:a/2,y:e/2+s}],d=L.at.svg(l),m=$.userNodeOverrides(t,{fill:"none"});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const p=q(o).replace("Z",""),w=d.path(p,m),b=q(y),S=d.path(b,{...m}),x=l.insert("g",":first-child");return x.insert(()=>S,":first-child").attr("stroke-opacity",0),x.insert(()=>w,":first-child"),x.attr("class","text"),n&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",n),h&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",h),x.attr("transform",`translate(${s}, 0)`),g.attr("transform",`translate(${-a/2+s-(r.x-(r.left??0))},${-e/2+(t.padding??0)/2-(r.y-(r.top??0))})`),O(t,x),t.intersect=function(N){return A.polygon(t,y,N)},l}v.__name(ce,"curlyBraceLeft");function nt(u,t,f,h=100,l=0,r=180){const g=[],i=l*Math.PI/180,c=(r*Math.PI/180-i)/(h-1);for(let a=0;a<h;a++){const e=i+a*c,s=u+f*Math.cos(e),n=t+f*Math.sin(e);g.push({x:s,y:n})}return g}v.__name(nt,"generateCirclePoints");async function oe(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const{shapeSvg:l,bbox:r,label:g}=await W(u,t,E(t)),i=t.look==="neo"?18:t.padding??0,c=t.look==="neo"?12:t.padding??0,a=r.width+(t.look==="neo"?i*2:i),e=r.height+(t.look==="neo"?c*2:c),s=Math.max(5,e*.1),{cssStyles:n}=t,o=[...nt(a/2,-e/2,s,20,-90,0),{x:a/2+s,y:-s},...nt(a/2+s*2,-s,s,20,-180,-270),...nt(a/2+s*2,s,s,20,-90,-180),{x:a/2+s,y:e/2},...nt(a/2,e/2,s,20,0,90)],y=[{x:-a/2,y:-e/2-s},{x:a/2,y:-e/2-s},...nt(a/2,-e/2,s,20,-90,0),{x:a/2+s,y:-s},...nt(a/2+s*2,-s,s,20,-180,-270),...nt(a/2+s*2,s,s,20,-90,-180),{x:a/2+s,y:e/2},...nt(a/2,e/2,s,20,0,90),{x:a/2,y:e/2+s},{x:-a/2,y:e/2+s}],d=L.at.svg(l),m=$.userNodeOverrides(t,{fill:"none"});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const p=q(o).replace("Z",""),w=d.path(p,m),b=q(y),S=d.path(b,{...m}),x=l.insert("g",":first-child");return x.insert(()=>S,":first-child").attr("stroke-opacity",0),x.insert(()=>w,":first-child"),x.attr("class","text"),n&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",n),h&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",h),x.attr("transform",`translate(${-s}, 0)`),g.attr("transform",`translate(${-a/2+(t.padding??0)/2-(r.x-(r.left??0))},${-e/2+(t.padding??0)/2-(r.y-(r.top??0))})`),O(t,x),t.intersect=function(N){return A.polygon(t,y,N)},l}v.__name(oe,"curlyBraceRight");function J(u,t,f,h=100,l=0,r=180){const g=[],i=l*Math.PI/180,c=(r*Math.PI/180-i)/(h-1);for(let a=0;a<h;a++){const e=i+a*c,s=u+f*Math.cos(e),n=t+f*Math.sin(e);g.push({x:-s,y:-n})}return g}v.__name(J,"generateCirclePoints");async function he(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const{shapeSvg:l,bbox:r,label:g}=await W(u,t,E(t)),i=t.look==="neo"?18:t.padding??0,c=t.look==="neo"?12:t.padding??0,a=r.width+(t.look==="neo"?i*2:i),e=r.height+(t.look==="neo"?c*2:c),s=Math.max(5,e*.1),{cssStyles:n}=t,o=[...J(a/2,-e/2,s,30,-90,0),{x:-a/2-s,y:s},...J(a/2+s*2,-s,s,20,-180,-270),...J(a/2+s*2,s,s,20,-90,-180),{x:-a/2-s,y:-e/2},...J(a/2,e/2,s,20,0,90)],y=[...J(-a/2+s+s/2,-e/2,s,20,-90,-180),{x:a/2-s/2,y:s},...J(-a/2-s/2,-s,s,20,0,90),...J(-a/2-s/2,s,s,20,-90,0),{x:a/2-s/2,y:-s},...J(-a/2+s+s/2,e/2,s,30,-180,-270)],d=[{x:a/2,y:-e/2-s},{x:-a/2,y:-e/2-s},...J(a/2,-e/2,s,20,-90,0),{x:-a/2-s,y:-s},...J(a/2+s*2,-s,s,20,-180,-270),...J(a/2+s*2,s,s,20,-90,-180),{x:-a/2-s,y:e/2},...J(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},...J(-a/2+s+s/2,-e/2,s,20,-90,-180),{x:a/2-s/2,y:s},...J(-a/2-s/2,-s,s,20,0,90),...J(-a/2-s/2,s,s,20,-90,0),{x:a/2-s/2,y:-s},...J(-a/2+s+s/2,e/2,s,30,-180,-270)],m=L.at.svg(l),p=$.userNodeOverrides(t,{fill:"none"});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const w=q(o).replace("Z",""),b=m.path(w,p),S=q(y).replace("Z",""),x=m.path(S,p),N=q(d),k=m.path(N,{...p}),_=l.insert("g",":first-child");return _.insert(()=>k,":first-child").attr("stroke-opacity",0),_.insert(()=>b,":first-child"),_.insert(()=>x,":first-child"),_.attr("class","text"),n&&t.look!=="handDrawn"&&_.selectAll("path").attr("style",n),h&&t.look!=="handDrawn"&&_.selectAll("path").attr("style",h),_.attr("transform",`translate(${s-s/4}, 0)`),g.attr("transform",`translate(${-a/2+(t.padding??0)/2-(r.x-(r.left??0))},${-e/2+(t.padding??0)/2-(r.y-(r.top??0))})`),O(t,_),t.intersect=function(D){return A.polygon(t,d,D)},l}v.__name(he,"curlyBraces");async function ge(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=t.look==="neo"?16:l,g=t.look==="neo"?12:l,i=20,c=5,{shapeSvg:a,bbox:e}=await W(u,t,E(t)),s=Math.max(i,(e.width+r*2)*1.25,t?.width??0),n=Math.max(c,e.height+g*2,t?.height??0),o=n/2,{cssStyles:y}=t,d=L.at.svg(a),m=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const p=s,w=n,b=p-o,S=w/4,x=[{x:b,y:0},{x:S,y:0},{x:0,y:w/2},{x:S,y:w},{x:b,y:w},...St(-b,-w/2,o,50,270,90)],N=q(x),k=d.path(N,m),_=a.insert(()=>k,":first-child");return _.attr("class","basic label-container outer-path"),y&&t.look!=="handDrawn"&&_.selectChildren("path").attr("style",y),h&&t.look!=="handDrawn"&&_.selectChildren("path").attr("style",h),_.attr("transform",`translate(${-s/2}, ${-n/2})`),O(t,_),t.intersect=function(D){return A.polygon(t,x,D)},a}v.__name(ge,"curvedTrapezoid");var vs=v.__name((u,t,f,h,l,r)=>[`M${u},${t+r}`,`a${l},${r} 0,0,0 ${f},0`,`a${l},${r} 0,0,0 ${-f},0`,`l0,${h}`,`a${l},${r} 0,0,0 ${f},0`,`l0,${-h}`].join(" "),"createCylinderPathD"),ks=v.__name((u,t,f,h,l,r)=>[`M${u},${t+r}`,`M${u+f},${t+r}`,`a${l},${r} 0,0,0 ${-f},0`,`l0,${h}`,`a${l},${r} 0,0,0 ${f},0`,`l0,${-h}`].join(" "),"createOuterCylinderPathD"),_s=v.__name((u,t,f,h,l,r)=>[`M${u-f/2},${-h/2}`,`a${l},${r} 0,0,0 ${f},0`].join(" "),"createInnerCylinderPathD"),Ot=8,Tt=8;async function fe(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=t.look==="neo"?24:l,g=t.look==="neo"?24:l;if(t.width||t.height){const m=t.width??0;t.width=(t.width??0)-g,t.width<Tt&&(t.width=Tt);const p=m/2/(2.5+m/50);t.height=(t.height??0)-r-p*3,t.height<Ot&&(t.height=Ot)}const{shapeSvg:i,bbox:c,label:a}=await W(u,t,E(t)),e=(t.width?t.width:c.width)+g,s=e/2,n=s/(2.5+e/50),o=(t.height?t.height:c.height)+r+n;let y;const{cssStyles:d}=t;if(t.look==="handDrawn"){const m=L.at.svg(i),p=ks(0,0,e,o,s,n),w=_s(0,n,e,o,s,n),b=$.userNodeOverrides(t,{}),S=m.path(p,b),x=m.path(w,$.userNodeOverrides(t,{fill:"none"}));y=i.insert(()=>x,":first-child"),y=i.insert(()=>S,":first-child"),y.attr("class","basic label-container"),d&&y.attr("style",d)}else{const m=vs(0,0,e,o,s,n);y=i.insert("path",":first-child").attr("d",m).attr("class","basic label-container outer-path").attr("style",U.handleUndefinedAttr(d)).attr("style",h)}return y.attr("label-offset-y",n),y.attr("transform",`translate(${-e/2}, ${-(o/2+n)})`),O(t,y),a.attr("transform",`translate(${-(c.width/2)-(c.x-(c.left??0))}, ${-(c.height/2)+(t.padding??0)/1.5-(c.y-(c.top??0))})`),t.intersect=function(m){const p=A.rect(t,m),w=p.x-(t.x??0);if(s!=0&&(Math.abs(w)<(t.width??0)/2||Math.abs(w)==(t.width??0)/2&&Math.abs(p.y-(t.y??0))>(t.height??0)/2-n)){let b=n*n*(1-w*w/(s*s));b>0&&(b=Math.sqrt(b)),b=n-b,m.y-(t.y??0)>0&&(b=-b),p.y+=b}return p},i}v.__name(fe,"cylinder");async function wt(u,t,f){const{labelStyles:h,nodeStyles:l}=$.styles2String(t);t.labelStyle=h;const{shapeSvg:r,bbox:g}=await W(u,t,E(t)),i=Math.max(g.width+f.labelPaddingX*2,t?.width||0),c=Math.max(g.height+f.labelPaddingY*2,t?.height||0),a=-i/2,e=-c/2;let s,{rx:n,ry:o}=t;const{cssStyles:y}=t;if(f?.rx&&f.ry&&(n=f.rx,o=f.ry),t.look==="handDrawn"){const d=L.at.svg(r),m=$.userNodeOverrides(t,{}),p=n||o?d.path(ft(a,e,i,c,n||0),m):d.rectangle(a,e,i,c,m);s=r.insert(()=>p,":first-child"),s.attr("class","basic label-container").attr("style",U.handleUndefinedAttr(y))}else s=r.insert("rect",":first-child"),s.attr("class","basic label-container").attr("style",l).attr("rx",U.handleUndefinedAttr(n)).attr("ry",U.handleUndefinedAttr(o)).attr("x",a).attr("y",e).attr("width",i).attr("height",c);return O(t,s),t.calcIntersect=function(d,m){return A.rect(d,m)},t.intersect=function(d){return A.rect(t,d)},r}v.__name(wt,"drawRect");async function ye(u,t){const{cssClasses:f,labelPaddingX:h,labelPaddingY:l,padding:r,width:g,height:i}=t,c=await wt(u,t,{rx:0,ry:0,classes:f??"",labelPaddingX:h??(r??0)*2,labelPaddingY:l??r??0});if(t.look==="handDrawn"){const n=L.at.svg(c),o=$.userNodeOverrides(t,{}),y=c.select(".basic.label-container > path:nth-child(2)"),d=y.node();if(!d)return c;let m=null;if(d instanceof SVGGraphicsElement)m=d.getBBox();else return c;return c.insert(()=>n.line(m.x,m.y,m.x+m.width,m.y,o),".basic.label-container g.label"),c.insert(()=>n.line(m.x,m.y+m.height,m.x+m.width,m.y+m.height,o),".basic.label-container g.label"),y.remove(),c}const a=c.select(".basic.label-container"),e=(Number(a.attr("width"))||g)??0,s=(Number(a.attr("height"))||i)??0;return e>0&&s>0&&a.attr("stroke-dasharray",`${e} ${s}`),c}v.__name(ye,"datastore");async function de(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.look==="neo"?16:t.padding??0,r=t.look==="neo"?16:t.padding??0,{shapeSvg:g,bbox:i,label:c}=await W(u,t,E(t)),a=i.width+l,e=i.height+r,s=e*.2,n=-a/2,o=-e/2-s/2,{cssStyles:y}=t,d=L.at.svg(g),m=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const p=[{x:n,y:o+s},{x:-n,y:o+s},{x:-n,y:-o},{x:n,y:-o},{x:n,y:o},{x:-n,y:o},{x:-n,y:o+s}],w=d.polygon(p.map(S=>[S.x,S.y]),m),b=g.insert(()=>w,":first-child");return b.attr("class","basic label-container outer-path"),y&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",y),h&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",h),c.attr("transform",`translate(${n+(t.padding??0)/2-(i.x-(i.left??0))}, ${o+s+(t.padding??0)/2-(i.y-(i.top??0))})`),O(t,b),t.intersect=function(S){return A.rect(t,S)},g}v.__name(de,"dividedRectangle");async function ue(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t),l=t.look==="neo"?12:5;t.labelStyle=f;const r=t.padding??0,g=t.look==="neo"?16:r,{shapeSvg:i,bbox:c}=await W(u,t,E(t)),a=(t?.width?t?.width/2:c.width/2)+(g??0),e=a-l;let s;const{cssStyles:n}=t;if(t.look==="handDrawn"){const o=L.at.svg(i),y=$.userNodeOverrides(t,{roughness:.2,strokeWidth:2.5}),d=$.userNodeOverrides(t,{roughness:.2,strokeWidth:1.5}),m=o.circle(0,0,a*2,y),p=o.circle(0,0,e*2,d);s=i.insert("g",":first-child"),s.attr("class",U.handleUndefinedAttr(t.cssClasses)).attr("style",U.handleUndefinedAttr(n)),s.node()?.appendChild(m),s.node()?.appendChild(p)}else{s=i.insert("g",":first-child");const o=s.insert("circle",":first-child"),y=s.insert("circle");s.attr("class","basic label-container").attr("style",h),o.attr("class","outer-circle").attr("style",h).attr("r",a).attr("cx",0).attr("cy",0),y.attr("class","inner-circle").attr("style",h).attr("r",e).attr("cx",0).attr("cy",0)}return O(t,s),t.intersect=function(o){return X.log.info("DoubleCircle intersect",t,a,o),A.circle(t,a,o)},i}v.__name(ue,"doublecircle");function pe(u,t,{config:{themeVariables:f}}){const{labelStyles:h,nodeStyles:l}=$.styles2String(t);t.label="",t.labelStyle=h;const r=u.insert("g").attr("class",E(t)).attr("id",t.domId??t.id),g=7,{cssStyles:i}=t,c=L.at.svg(r),{nodeBorder:a}=f,e=$.userNodeOverrides(t,{fillStyle:"solid"});t.look!=="handDrawn"&&(e.roughness=0);const s=c.circle(0,0,14,e),n=r.insert(()=>s,":first-child");return n.selectAll("path").attr("style",`fill: ${a} !important;`),i&&i.length>0&&t.look!=="handDrawn"&&n.selectAll("path").attr("style",i),l&&t.look!=="handDrawn"&&n.selectAll("path").attr("style",l),O(t,n),t.intersect=function(o){return X.log.info("filledCircle intersect",t,{radius:g,point:o}),A.circle(t,g,o)},r}v.__name(pe,"filledCircle");var Et=10,Wt=10;async function me(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=t.look==="neo"?l*2:l;(t.width||t.height)&&(t.height=t?.height??0,t.height<Et&&(t.height=Et),t.width=(t?.width??0)-r-r/2,t.width<Wt&&(t.width=Wt));const{shapeSvg:g,bbox:i,label:c}=await W(u,t,E(t)),a=(t?.width?t?.width:i.width)+(r??0),e=t?.height?t?.height:a+i.height,s=e,n=[{x:0,y:-e},{x:s,y:-e},{x:s/2,y:0}],{cssStyles:o}=t,y=L.at.svg(g),d=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const m=q(n),p=y.path(m,d),w=g.insert(()=>p,":first-child").attr("transform",`translate(${-e/2}, ${e/2})`).attr("class","outer-path");return o&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",o),h&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",h),t.width=a,t.height=e,O(t,w),c.attr("transform",`translate(${-i.width/2-(i.x-(i.left??0))}, ${-e/2+(t.padding??0)/2+(i.y-(i.top??0))})`),t.intersect=function(b){return X.log.info("Triangle intersect",t,n,b),A.polygon(t,n,b)},g}v.__name(me,"flippedTriangle");function we(u,t,{dir:f,config:{state:h,themeVariables:l}}){const{nodeStyles:r}=$.styles2String(t);t.label="";const g=u.insert("g").attr("class",E(t)).attr("id",t.domId??t.id),{cssStyles:i}=t;let c=Math.max(70,t?.width??0),a=Math.max(10,t?.height??0);f==="LR"&&(c=Math.max(10,t?.width??0),a=Math.max(70,t?.height??0));const e=-1*c/2,s=-1*a/2,n=L.at.svg(g),o=$.userNodeOverrides(t,{stroke:l.lineColor,fill:l.lineColor});t.look!=="handDrawn"&&(o.roughness=0,o.fillStyle="solid");const y=n.rectangle(e,s,c,a,o),d=g.insert(()=>y,":first-child");i&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",i),r&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",r),O(t,d);const m=h?.padding??0;return t.width&&t.height&&(t.width+=m/2||0,t.height+=m/2||0),t.intersect=function(p){return A.rect(t,p)},g}v.__name(we,"forkJoin");async function be(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=15,r=10,g=t.look==="neo"?16:t.padding??0,i=t.look==="neo"?12:t.padding??0;(t.width||t.height)&&(t.height=(t?.height??0)-i*2,t.height<r&&(t.height=r),t.width=(t?.width??0)-g*2,t.width<l&&(t.width=l));const{shapeSvg:c,bbox:a}=await W(u,t,E(t)),e=(t?.width?t?.width:Math.max(l,a.width))+g*2,s=(t?.height?t?.height:Math.max(r,a.height))+i*2,n=s/2,{cssStyles:o}=t,y=L.at.svg(c),d=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const m=[{x:-e/2,y:-s/2},{x:e/2-n,y:-s/2},...St(-e/2+n,0,n,50,90,270),{x:e/2-n,y:s/2},{x:-e/2,y:s/2}],p=q(m),w=y.path(p,d),b=c.insert(()=>w,":first-child");return b.attr("class","basic label-container outer-path"),o&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",o),h&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",h),O(t,b),t.intersect=function(S){return X.log.info("Pill intersect",t,{radius:n,point:S}),A.polygon(t,m,S)},c}v.__name(be,"halfRoundedRectangle");var Ns=v.__name((u,t,f,h,l)=>[`M${u+l},${t}`,`L${u+f-l},${t}`,`L${u+f},${t-h/2}`,`L${u+f-l},${t-h}`,`L${u+l},${t-h}`,`L${u},${t-h/2}`,"Z"].join(" "),"createHexagonPathD");async function xe(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t),l=t.look==="neo"?3.5:4;t.labelStyle=f;const r=t.padding??0,g=70,i=32,c=t.look==="neo"?g:r,a=t.look==="neo"?i:r;if(t.width||t.height){const w=(t.height??0)/l;t.width=(t?.width??0)-2*w-a,t.height=(t.height??0)-c}const{shapeSvg:e,bbox:s}=await W(u,t,E(t)),n=(t?.height?t?.height:s.height)+c,o=n/l,y=(t?.width?t?.width:s.width)+2*o+a,d=[{x:o,y:0},{x:y-o,y:0},{x:y,y:-n/2},{x:y-o,y:-n},{x:o,y:-n},{x:0,y:-n/2}];let m;const{cssStyles:p}=t;if(t.look==="handDrawn"){const w=L.at.svg(e),b=$.userNodeOverrides(t,{}),S=Ns(0,0,y,n,o),x=w.path(S,b);m=e.insert(()=>x,":first-child").attr("transform",`translate(${-y/2}, ${n/2})`),p&&m.attr("style",p)}else m=ot(e,y,n,d);return h&&m.attr("style",h),t.width=y,t.height=n,O(t,m),t.intersect=function(w){return A.polygon(t,d,w)},e}v.__name(xe,"hexagon");async function Se(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.label="",t.labelStyle=f;const{shapeSvg:l}=await W(u,t,E(t)),r=Math.max(30,t?.width??0),g=Math.max(30,t?.height??0),{cssStyles:i}=t,c=L.at.svg(l),a=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(a.roughness=0,a.fillStyle="solid");const e=[{x:0,y:0},{x:r,y:0},{x:0,y:g},{x:r,y:g}],s=q(e),n=c.path(s,a),o=l.insert(()=>n,":first-child");return o.attr("class","basic label-container outer-path"),i&&t.look!=="handDrawn"&&o.selectChildren("path").attr("style",i),h&&t.look!=="handDrawn"&&o.selectChildren("path").attr("style",h),o.attr("transform",`translate(${-r/2}, ${-g/2})`),O(t,o),t.intersect=function(y){return X.log.info("Pill intersect",t,{points:e}),A.polygon(t,e,y)},l}v.__name(Se,"hourglass");async function $e(u,t,{config:{themeVariables:f,flowchart:h}}){const{labelStyles:l}=$.styles2String(t);t.labelStyle=l;const r=t.assetHeight??48,g=t.assetWidth??48,i=Math.max(r,g),c=h?.wrappingWidth;t.width=Math.max(i,c??0);const{shapeSvg:a,bbox:e,label:s}=await W(u,t,"icon-shape default"),n=t.pos==="t",o=i,y=i,{nodeBorder:d}=f,{stylesMap:m}=$.compileStyles(t),p=-y/2,w=-o/2,b=t.label?8:0,S=L.at.svg(a),x=$.userNodeOverrides(t,{stroke:"none",fill:"none"});t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const N=S.rectangle(p,w,y,o,x),k=Math.max(y,e.width),_=o+e.height+b,D=S.rectangle(-k/2,-_/2,k,_,{...x,fill:"transparent",stroke:"none"}),C=a.insert(()=>N,":first-child"),R=a.insert(()=>D);if(t.icon){const T=a.append("g");T.html(`<g>${await kt.getIconSVG(t.icon,{height:i,width:i,fallbackPrefix:""})}</g>`);const M=T.node().getBBox(),B=M.width,P=M.height,I=M.x,H=M.y;T.attr("transform",`translate(${-B/2-I},${n?e.height/2+b/2-P/2-H:-e.height/2-b/2-P/2-H})`),T.attr("style",`color: ${m.get("stroke")??d};`)}return s.attr("transform",`translate(${-e.width/2-(e.x-(e.left??0))},${n?-_/2:_/2-e.height})`),C.attr("transform",`translate(0,${n?e.height/2+b/2:-e.height/2-b/2})`),O(t,R),t.intersect=function(T){if(X.log.info("iconSquare intersect",t,T),!t.label)return A.rect(t,T);const M=t.x??0,B=t.y??0,P=t.height??0;let I=[];return n?I=[{x:M-e.width/2,y:B-P/2},{x:M+e.width/2,y:B-P/2},{x:M+e.width/2,y:B-P/2+e.height+b},{x:M+y/2,y:B-P/2+e.height+b},{x:M+y/2,y:B+P/2},{x:M-y/2,y:B+P/2},{x:M-y/2,y:B-P/2+e.height+b},{x:M-e.width/2,y:B-P/2+e.height+b}]:I=[{x:M-y/2,y:B-P/2},{x:M+y/2,y:B-P/2},{x:M+y/2,y:B-P/2+o},{x:M+e.width/2,y:B-P/2+o},{x:M+e.width/2/2,y:B+P/2},{x:M-e.width/2,y:B+P/2},{x:M-e.width/2,y:B-P/2+o},{x:M-y/2,y:B-P/2+o}],A.polygon(t,I,T)},a}v.__name($e,"icon");async function ve(u,t,{config:{themeVariables:f,flowchart:h}}){const{labelStyles:l}=$.styles2String(t);t.labelStyle=l;const r=t.assetHeight??48,g=t.assetWidth??48,i=Math.max(r,g),c=h?.wrappingWidth;t.width=Math.max(i,c??0);const{shapeSvg:a,bbox:e,label:s}=await W(u,t,"icon-shape default"),n=t.label?8:0,o=t.pos==="t",{nodeBorder:y,mainBkg:d}=f,{stylesMap:m}=$.compileStyles(t),p=L.at.svg(a),w=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid"),w.stroke=m.get("fill")??d;const b=a.append("g");t.icon&&b.html(`<g>${await kt.getIconSVG(t.icon,{height:i,width:i,fallbackPrefix:""})}</g>`);const S=b.node().getBBox(),x=S.width,N=S.height,k=S.x,_=S.y,D=Math.max(x,N)*Math.SQRT2+40,C=p.circle(0,0,D,w),R=Math.max(D,e.width),T=D+e.height+n,M=p.rectangle(-R/2,-T/2,R,T,{...w,fill:"transparent",stroke:"none"}),B=a.insert(()=>C,":first-child"),P=a.insert(()=>M);return b.attr("transform",`translate(${-x/2-k},${o?e.height/2+n/2-N/2-_:-e.height/2-n/2-N/2-_})`),b.attr("style",`color: ${m.get("stroke")??y};`),s.attr("transform",`translate(${-e.width/2-(e.x-(e.left??0))},${o?-T/2:T/2-e.height})`),B.attr("transform",`translate(0,${o?e.height/2+n/2:-e.height/2-n/2})`),O(t,P),t.intersect=function(I){return X.log.info("iconSquare intersect",t,I),A.rect(t,I)},a}v.__name(ve,"iconCircle");async function ke(u,t,{config:{themeVariables:f,flowchart:h}}){const{labelStyles:l}=$.styles2String(t);t.labelStyle=l;const r=t.assetHeight??48,g=t.assetWidth??48,i=Math.max(r,g),c=h?.wrappingWidth;t.width=Math.max(i,c??0);const{shapeSvg:a,bbox:e,halfPadding:s,label:n}=await W(u,t,"icon-shape default"),o=t.pos==="t",y=i+s*2,d=i+s*2,{nodeBorder:m,mainBkg:p}=f,{stylesMap:w}=$.compileStyles(t),b=-d/2,S=-y/2,x=t.label?8:0,N=L.at.svg(a),k=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid"),k.stroke=w.get("fill")??p;const _=N.path(ft(b,S,d,y,5),k),D=Math.max(d,e.width),C=y+e.height+x,R=N.rectangle(-D/2,-C/2,D,C,{...k,fill:"transparent",stroke:"none"}),T=a.insert(()=>_,":first-child").attr("class","icon-shape2"),M=a.insert(()=>R);if(t.icon){const B=a.append("g");B.html(`<g>${await kt.getIconSVG(t.icon,{height:i,width:i,fallbackPrefix:""})}</g>`);const P=B.node().getBBox(),I=P.width,H=P.height,G=P.x,V=P.y;B.attr("transform",`translate(${-I/2-G},${o?e.height/2+x/2-H/2-V:-e.height/2-x/2-H/2-V})`),B.attr("style",`color: ${w.get("stroke")??m};`)}return n.attr("transform",`translate(${-e.width/2-(e.x-(e.left??0))},${o?-C/2:C/2-e.height})`),T.attr("transform",`translate(0,${o?e.height/2+x/2:-e.height/2-x/2})`),O(t,M),t.intersect=function(B){if(X.log.info("iconSquare intersect",t,B),!t.label)return A.rect(t,B);const P=t.x??0,I=t.y??0,H=t.height??0;let G=[];return o?G=[{x:P-e.width/2,y:I-H/2},{x:P+e.width/2,y:I-H/2},{x:P+e.width/2,y:I-H/2+e.height+x},{x:P+d/2,y:I-H/2+e.height+x},{x:P+d/2,y:I+H/2},{x:P-d/2,y:I+H/2},{x:P-d/2,y:I-H/2+e.height+x},{x:P-e.width/2,y:I-H/2+e.height+x}]:G=[{x:P-d/2,y:I-H/2},{x:P+d/2,y:I-H/2},{x:P+d/2,y:I-H/2+y},{x:P+e.width/2,y:I-H/2+y},{x:P+e.width/2/2,y:I+H/2},{x:P-e.width/2,y:I+H/2},{x:P-e.width/2,y:I-H/2+y},{x:P-d/2,y:I-H/2+y}],A.polygon(t,G,B)},a}v.__name(ke,"iconRounded");async function _e(u,t,{config:{themeVariables:f,flowchart:h}}){const{labelStyles:l}=$.styles2String(t);t.labelStyle=l;const r=t.assetHeight??48,g=t.assetWidth??48,i=Math.max(r,g),c=h?.wrappingWidth;t.width=Math.max(i,c??0);const{shapeSvg:a,bbox:e,halfPadding:s,label:n}=await W(u,t,"icon-shape default"),o=t.pos==="t",y=i+s*2,d=i+s*2,{nodeBorder:m,mainBkg:p}=f,{stylesMap:w}=$.compileStyles(t),b=-d/2,S=-y/2,x=t.label?8:0,N=L.at.svg(a),k=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid"),k.stroke=w.get("fill")??p;const _=N.path(ft(b,S,d,y,.1),k),D=Math.max(d,e.width),C=y+e.height+x,R=N.rectangle(-D/2,-C/2,D,C,{...k,fill:"transparent",stroke:"none"}),T=a.insert(()=>_,":first-child"),M=a.insert(()=>R);if(t.icon){const B=a.append("g");B.html(`<g>${await kt.getIconSVG(t.icon,{height:i,width:i,fallbackPrefix:""})}</g>`);const P=B.node().getBBox(),I=P.width,H=P.height,G=P.x,V=P.y;B.attr("transform",`translate(${-I/2-G},${o?e.height/2+x/2-H/2-V:-e.height/2-x/2-H/2-V})`),B.attr("style",`color: ${w.get("stroke")??m};`)}return n.attr("transform",`translate(${-e.width/2-(e.x-(e.left??0))},${o?-C/2:C/2-e.height})`),T.attr("transform",`translate(0,${o?e.height/2+x/2:-e.height/2-x/2})`),O(t,M),t.intersect=function(B){if(X.log.info("iconSquare intersect",t,B),!t.label)return A.rect(t,B);const P=t.x??0,I=t.y??0,H=t.height??0;let G=[];return o?G=[{x:P-e.width/2,y:I-H/2},{x:P+e.width/2,y:I-H/2},{x:P+e.width/2,y:I-H/2+e.height+x},{x:P+d/2,y:I-H/2+e.height+x},{x:P+d/2,y:I+H/2},{x:P-d/2,y:I+H/2},{x:P-d/2,y:I-H/2+e.height+x},{x:P-e.width/2,y:I-H/2+e.height+x}]:G=[{x:P-d/2,y:I-H/2},{x:P+d/2,y:I-H/2},{x:P+d/2,y:I-H/2+y},{x:P+e.width/2,y:I-H/2+y},{x:P+e.width/2/2,y:I+H/2},{x:P-e.width/2,y:I+H/2},{x:P-e.width/2,y:I-H/2+y},{x:P-d/2,y:I-H/2+y}],A.polygon(t,G,B)},a}v.__name(_e,"iconSquare");async function Ne(u,t,{config:{flowchart:f}}){const h=new Image;h.src=t?.img??"",await h.decode();const l=Number(h.naturalWidth.toString().replace("px","")),r=Number(h.naturalHeight.toString().replace("px",""));t.imageAspectRatio=l/r;const{labelStyles:g}=$.styles2String(t);t.labelStyle=g;const i=f?.wrappingWidth;t.defaultWidth=f?.wrappingWidth;const c=Math.max(t.label?i??0:0,t?.assetWidth??l),a=t.constraint==="on"&&t?.assetHeight?t.assetHeight*t.imageAspectRatio:c,e=t.constraint==="on"?a/t.imageAspectRatio:t?.assetHeight??r;t.width=Math.max(a,i??0);const{shapeSvg:s,bbox:n,label:o}=await W(u,t,"image-shape default"),y=t.pos==="t",d=-a/2,m=-e/2,p=t.label?8:0,w=L.at.svg(s),b=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const S=w.rectangle(d,m,a,e,b),x=Math.max(a,n.width),N=e+n.height+p,k=w.rectangle(-x/2,-N/2,x,N,{...b,fill:"none",stroke:"none"}),_=s.insert(()=>S,":first-child"),D=s.insert(()=>k);if(t.img){const C=s.append("image");C.attr("href",t.img),C.attr("width",a),C.attr("height",e),C.attr("preserveAspectRatio","none"),C.attr("transform",`translate(${-a/2},${y?N/2-e:-N/2})`)}return o.attr("transform",`translate(${-n.width/2-(n.x-(n.left??0))},${y?-e/2-n.height/2-p/2:e/2-n.height/2+p/2})`),_.attr("transform",`translate(0,${y?n.height/2+p/2:-n.height/2-p/2})`),O(t,D),t.intersect=function(C){if(X.log.info("iconSquare intersect",t,C),!t.label)return A.rect(t,C);const R=t.x??0,T=t.y??0,M=t.height??0;let B=[];return y?B=[{x:R-n.width/2,y:T-M/2},{x:R+n.width/2,y:T-M/2},{x:R+n.width/2,y:T-M/2+n.height+p},{x:R+a/2,y:T-M/2+n.height+p},{x:R+a/2,y:T+M/2},{x:R-a/2,y:T+M/2},{x:R-a/2,y:T-M/2+n.height+p},{x:R-n.width/2,y:T-M/2+n.height+p}]:B=[{x:R-a/2,y:T-M/2},{x:R+a/2,y:T-M/2},{x:R+a/2,y:T-M/2+e},{x:R+n.width/2,y:T-M/2+e},{x:R+n.width/2/2,y:T+M/2},{x:R-n.width/2,y:T+M/2},{x:R-n.width/2,y:T-M/2+e},{x:R-a/2,y:T-M/2+e}],A.polygon(t,B,C)},s}v.__name(Ne,"imageSquare");async function Pe(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=l,g=t.look==="neo"?l*2:l,{shapeSvg:i,bbox:c}=await W(u,t,E(t)),a=Math.max(c.width+(g??0)*2,t?.width??0),e=Math.max(c.height+(r??0)*2,t?.height??0),s=[{x:0,y:0},{x:a,y:0},{x:a+3*e/6,y:-e},{x:-3*e/6,y:-e}];let n;const{cssStyles:o}=t;if(t.look==="handDrawn"){const y=L.at.svg(i),d=$.userNodeOverrides(t,{}),m=q(s),p=y.path(m,d);n=i.insert(()=>p,":first-child").attr("transform",`translate(${-a/2}, ${e/2})`),o&&n.attr("style",o)}else n=ot(i,a,e,s);return h&&n.attr("style",h),t.width=a,t.height=e,O(t,n),t.intersect=function(y){return A.polygon(t,s,y)},i}v.__name(Pe,"inv_trapezoid");async function De(u,t){const{shapeSvg:f,bbox:h,label:l}=await W(u,t,"label"),r=f.insert("rect",":first-child");return r.attr("width",.1).attr("height",.1),f.attr("class","label edgeLabel"),l.attr("transform",`translate(${-(h.width/2)-(h.x-(h.left??0))}, ${-(h.height/2)-(h.y-(h.top??0))})`),O(t,r),t.intersect=function(g){return A.rect(t,g)},f}v.__name(De,"labelRect");async function Be(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=l,g=t.look==="neo"?l*2:l,{shapeSvg:i,bbox:c}=await W(u,t,E(t)),a=(t?.height??c.height)+r,e=(t?.width??c.width)+g,s=[{x:0,y:0},{x:e+3*a/6,y:0},{x:e,y:-a},{x:-(3*a)/6,y:-a}];let n;const{cssStyles:o}=t;if(t.look==="handDrawn"){const y=L.at.svg(i),d=$.userNodeOverrides(t,{}),m=q(s),p=y.path(m,d);n=i.insert(()=>p,":first-child").attr("transform",`translate(${-e/2}, ${a/2})`),o&&n.attr("style",o)}else n=ot(i,e,a,s);return h&&n.attr("style",h),t.width=e,t.height=a,O(t,n),t.intersect=function(y){return A.polygon(t,s,y)},i}v.__name(Be,"lean_left");async function Me(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=l,g=t.look==="neo"?l*2:l,{shapeSvg:i,bbox:c}=await W(u,t,E(t)),a=(t?.height??c.height)+r,e=(t?.width??c.width)+g,s=[{x:-3*a/6,y:0},{x:e,y:0},{x:e+3*a/6,y:-a},{x:0,y:-a}];let n;const{cssStyles:o}=t;if(t.look==="handDrawn"){const y=L.at.svg(i),d=$.userNodeOverrides(t,{}),m=q(s),p=y.path(m,d);n=i.insert(()=>p,":first-child").attr("transform",`translate(${-e/2}, ${a/2})`),o&&n.attr("style",o)}else n=ot(i,e,a,s);return h&&n.attr("style",h),t.width=e,t.height=a,O(t,n),t.intersect=function(y){return A.polygon(t,s,y)},i}v.__name(Me,"lean_right");function Ce(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.label="",t.labelStyle=f;const l=u.insert("g").attr("class",E(t)).attr("id",t.domId??t.id),{cssStyles:r}=t,g=Math.max(35,t?.width??0),i=Math.max(35,t?.height??0),c=7,a=[{x:g,y:0},{x:0,y:i+c/2},{x:g-14,y:i+c/2},{x:0,y:2*i},{x:g,y:i-c/2},{x:14,y:i-c/2}],e=L.at.svg(l),s=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(s.roughness=0,s.fillStyle="solid");const n=q(a),o=e.path(n,s),y=l.insert(()=>o,":first-child");return y.attr("class","outer-path"),r&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",r),h&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",h),y.attr("transform",`translate(-${g/2},${-i})`),O(t,y),t.intersect=function(d){return X.log.info("lightningBolt intersect",t,d),A.polygon(t,a,d)},l}v.__name(Ce,"lightningBolt");var Ps=v.__name((u,t,f,h,l,r,g)=>[`M${u},${t+r}`,`a${l},${r} 0,0,0 ${f},0`,`a${l},${r} 0,0,0 ${-f},0`,`l0,${h}`,`a${l},${r} 0,0,0 ${f},0`,`l0,${-h}`,`M${u},${t+r+g}`,`a${l},${r} 0,0,0 ${f},0`].join(" "),"createCylinderPathD"),Ds=v.__name((u,t,f,h,l,r,g)=>[`M${u},${t+r}`,`M${u+f},${t+r}`,`a${l},${r} 0,0,0 ${-f},0`,`l0,${h}`,`a${l},${r} 0,0,0 ${f},0`,`l0,${-h}`,`M${u},${t+r+g}`,`a${l},${r} 0,0,0 ${f},0`].join(" "),"createOuterCylinderPathD"),Bs=v.__name((u,t,f,h,l,r)=>[`M${u-f/2},${-h/2}`,`a${l},${r} 0,0,0 ${f},0`].join(" "),"createInnerCylinderPathD"),Yt=10,Xt=10;async function Ae(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=t.look==="neo"?16:l,g=t.look==="neo"?24:l;if(t.width||t.height){const p=t.width??0;t.width=(t.width??0)-r,t.width<Xt&&(t.width=Xt);const w=p/2/(2.5+p/50);t.height=(t.height??0)-g-w*3,t.height<Yt&&(t.height=Yt)}const{shapeSvg:i,bbox:c,label:a}=await W(u,t,E(t)),e=(t?.width?t?.width:c.width)+r*2,s=e/2,n=s/(2.5+e/50),o=(t?.height?t?.height:c.height)+n+g*2,y=o*.1;let d;const{cssStyles:m}=t;if(t.look==="handDrawn"){const p=L.at.svg(i),w=Ds(0,0,e,o,s,n,y),b=Bs(0,n,e,o,s,n),S=$.userNodeOverrides(t,{}),x=p.path(w,S),N=p.path(b,S);i.insert(()=>N,":first-child").attr("class","line"),d=i.insert(()=>x,":first-child"),d.attr("class","basic label-container"),m&&d.attr("style",m)}else{const p=Ps(0,0,e,o,s,n,y);d=i.insert("path",":first-child").attr("d",p).attr("class","basic label-container outer-path").attr("style",U.handleUndefinedAttr(m)).attr("style",h)}return d.attr("label-offset-y",n),d.attr("transform",`translate(${-e/2}, ${-(o/2+n)})`),O(t,d),a.attr("transform",`translate(${-(c.width/2)-(c.x-(c.left??0))}, ${-(c.height/2)+n-(c.y-(c.top??0))})`),t.intersect=function(p){const w=A.rect(t,p),b=w.x-(t.x??0);if(s!=0&&(Math.abs(b)<(t.width??0)/2||Math.abs(b)==(t.width??0)/2&&Math.abs(w.y-(t.y??0))>(t.height??0)/2-n)){let S=n*n*(1-b*b/(s*s));S>0&&(S=Math.sqrt(S)),S=n-S,p.y-(t.y??0)>0&&(S=-S),w.y+=S}return w},i}v.__name(Ae,"linedCylinder");async function Re(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=t.look==="neo"?16:l,g=t.look==="neo"?12:l;(t.width||t.height)&&(t.width=(t.width??0)*10/11-r*2,t.width<10&&(t.width=10),t.height=(t?.height??0)-g*2,t.height<10&&(t.height=10));const{shapeSvg:i,bbox:c,label:a}=await W(u,t,E(t)),e=(t?.width?t?.width:c.width)+(r??0)*2,s=(t?.height?t?.height:c.height)+(g??0)*2,n=t.look==="neo"?s/4:s/8,o=s+n,{cssStyles:y}=t,d=L.at.svg(i),m=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const p=[{x:-e/2-e/2*.1,y:-o/2},{x:-e/2-e/2*.1,y:o/2},...gt(-e/2-e/2*.1,o/2,e/2+e/2*.1,o/2,n,.8),{x:e/2+e/2*.1,y:-o/2},{x:-e/2-e/2*.1,y:-o/2},{x:-e/2,y:-o/2},{x:-e/2,y:o/2*1.1},{x:-e/2,y:-o/2}],w=d.polygon(p.map(S=>[S.x,S.y]),m),b=i.insert(()=>w,":first-child");return b.attr("class","basic label-container outer-path"),y&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",y),h&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",h),b.attr("transform",`translate(0,${-n/2})`),a.attr("transform",`translate(${-e/2+(t.padding??0)+e/2*.1/2-(c.x-(c.left??0))},${-s/2+(t.padding??0)-n/2-(c.y-(c.top??0))})`),O(t,b),t.intersect=function(S){return A.polygon(t,p,S)},i}v.__name(Re,"linedWaveEdgedRect");async function He(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=t.look==="neo"?16:l,g=t.look==="neo"?12:l,i=t.look==="neo"?10:5;(t.width||t.height)&&(t.width=Math.max((t?.width??0)-r*2-2*i,10),t.height=Math.max((t?.height??0)-g*2-2*i,10));const{shapeSvg:c,bbox:a,label:e}=await W(u,t,E(t)),s=(t?.width?t?.width:a.width)+r*2+2*i,n=(t?.height?t?.height:a.height)+g*2+2*i,o=s-2*i,y=n-2*i,d=-o/2,m=-y/2,{cssStyles:p}=t,w=L.at.svg(c),b=$.userNodeOverrides(t,{}),S=[{x:d-i,y:m+i},{x:d-i,y:m+y+i},{x:d+o-i,y:m+y+i},{x:d+o-i,y:m+y},{x:d+o,y:m+y},{x:d+o,y:m+y-i},{x:d+o+i,y:m+y-i},{x:d+o+i,y:m-i},{x:d+i,y:m-i},{x:d+i,y:m},{x:d,y:m},{x:d,y:m+i}],x=[{x:d,y:m+i},{x:d+o-i,y:m+i},{x:d+o-i,y:m+y},{x:d+o,y:m+y},{x:d+o,y:m},{x:d,y:m}];t.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const N=q(S);let k=w.path(N,b);const _=q(x);let D=w.path(_,b);t.look!=="handDrawn"&&(k=Bt(k),D=Bt(D));const C=c.insert("g",":first-child");return C.insert(()=>k),C.insert(()=>D),C.attr("class","basic label-container outer-path"),p&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",p),h&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",h),e.attr("transform",`translate(${-(a.width/2)-i-(a.x-(a.left??0))}, ${-(a.height/2)+i-(a.y-(a.top??0))})`),O(t,C),t.intersect=function(R){return A.polygon(t,S,R)},c}v.__name(He,"multiRect");async function Le(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const{shapeSvg:l,bbox:r,label:g}=await W(u,t,E(t)),i=t.padding??0,c=t.look==="neo"?16:i,a=t.look==="neo"?12:i;let e=!0;(t.width||t.height)&&(e=!1,t.width=(t?.width??0)-c*2,t.height=(t?.height??0)-a*3);const s=Math.max(r.width,t?.width??0)+c*2,n=Math.max(r.height,t?.height??0)+a*3,o=t.look==="neo"?n/4:n/8,y=n+(e?o/2:-o/2),d=-s/2,m=-y/2,p=10,{cssStyles:w}=t,b=gt(d-p,m+y+p,d+s-p,m+y+p,o,.8),S=b?.[b.length-1],x=[{x:d-p,y:m+p},{x:d-p,y:m+y+p},...b,{x:d+s-p,y:S.y-p},{x:d+s,y:S.y-p},{x:d+s,y:S.y-20},{x:d+s+p,y:S.y-20},{x:d+s+p,y:m-p},{x:d+p,y:m-p},{x:d+p,y:m},{x:d,y:m},{x:d,y:m+p}],N=[{x:d,y:m+p},{x:d+s-p,y:m+p},{x:d+s-p,y:S.y-p},{x:d+s,y:S.y-p},{x:d+s,y:m},{x:d,y:m}],k=L.at.svg(l),_=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const D=q(x),C=k.path(D,_),R=q(N),T=k.path(R,_),M=l.insert(()=>C,":first-child");return M.insert(()=>T),M.attr("class","basic label-container outer-path"),w&&t.look!=="handDrawn"&&M.selectAll("path").attr("style",w),h&&t.look!=="handDrawn"&&M.selectAll("path").attr("style",h),M.attr("transform",`translate(0,${-o/2})`),g.attr("transform",`translate(${-(r.width/2)-p-(r.x-(r.left??0))}, ${-(r.height/2)+p-o/2-(r.y-(r.top??0))})`),O(t,M),t.intersect=function(B){return A.polygon(t,x,B)},l}v.__name(Le,"multiWaveEdgedRectangle");async function Ie(u,t,{config:{themeVariables:f}}){const{labelStyles:h,nodeStyles:l}=$.styles2String(t);t.labelStyle=h,t.useHtmlLabels||Y.getEffectiveHtmlLabels(Y.getConfig())||(t.centerLabel=!0);const{shapeSvg:r,bbox:g,label:i}=await W(u,t,E(t)),c=Math.max(g.width+(t.padding??0)*2,t?.width??0),a=Math.max(g.height+(t.padding??0)*2,t?.height??0),e=-c/2,s=-a/2,{cssStyles:n}=t,o=L.at.svg(r),y=$.userNodeOverrides(t,{fill:f.noteBkgColor,stroke:f.noteBorderColor});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const d=o.rectangle(e,s,c,a,y),m=r.insert(()=>d,":first-child");return m.attr("class","basic label-container outer-path"),i.attr("class","label noteLabel"),n&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",n),l&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",l),i.attr("transform",`translate(${-g.width/2-(g.x-(g.left??0))}, ${-(g.height/2)-(g.y-(g.top??0))})`),O(t,m),t.intersect=function(p){return A.rect(t,p)},r}v.__name(Ie,"note");var Ms=v.__name((u,t,f)=>[`M${u+f/2},${t}`,`L${u+f},${t-f/2}`,`L${u+f/2},${t-f}`,`L${u},${t-f/2}`,"Z"].join(" "),"createDecisionBoxPathD");async function Oe(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const{shapeSvg:l,bbox:r}=await W(u,t,E(t)),g=r.width+(t.padding??0)+(r.height+(t.padding??0)),i=.5,c=[{x:g/2,y:0},{x:g,y:-g/2},{x:g/2,y:-g},{x:0,y:-g/2}];let a;const{cssStyles:e}=t;if(t.look==="handDrawn"){const s=L.at.svg(l),n=$.userNodeOverrides(t,{}),o=Ms(0,0,g),y=s.path(o,n);a=l.insert(()=>y,":first-child").attr("transform",`translate(${-g/2+i}, ${g/2})`),e&&a.attr("style",e)}else a=ot(l,g,g,c),a.attr("transform",`translate(${-g/2+i}, ${g/2})`);return h&&a.attr("style",h),O(t,a),t.calcIntersect=function(s,n){const o=s.width,y=[{x:o/2,y:0},{x:o,y:-o/2},{x:o/2,y:-o},{x:0,y:-o/2}],d=A.polygon(s,y,n);return{x:d.x-.5,y:d.y-.5}},t.intersect=function(s){return this.calcIntersect(t,s)},l}v.__name(Oe,"question");async function Te(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=t.look==="neo"?21:l??0,g=t.look==="neo"?12:l??0,{shapeSvg:i,bbox:c,label:a}=await W(u,t,E(t)),e=(t?.width??c.width)+(t.look==="neo"?r*2:r),s=(t?.height??c.height)+(t.look==="neo"?g*2:g),n=-e/2,o=-s/2,y=o/2,d=[{x:n+y,y:o},{x:n,y:0},{x:n+y,y:-o},{x:-n,y:-o},{x:-n,y:o}],{cssStyles:m}=t,p=L.at.svg(i),w=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");const b=q(d),S=p.path(b,w),x=i.insert(()=>S,":first-child");return x.attr("class","basic label-container outer-path"),m&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",m),h&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",h),x.attr("transform",`translate(${-y/2},0)`),a.attr("transform",`translate(${-y/2-c.width/2-(c.x-(c.left??0))}, ${-(c.height/2)-(c.y-(c.top??0))})`),O(t,x),t.intersect=function(N){return A.polygon(t,d,N)},i}v.__name(Te,"rect_left_inv_arrow");async function Ee(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;let l;t.cssClasses?l="node "+t.cssClasses:l="node default";const r=u.insert("g").attr("class",l).attr("id",t.domId||t.id),g=r.insert("g"),i=r.insert("g").attr("class","label").attr("style",h),c=t.description,a=t.label,e=await $t(i,a,t.labelStyle,!0,!0);let s={width:0,height:0};if(Y.getEffectiveHtmlLabels(Y.getConfig2())){const _=e.children[0],D=X.select_default(e);s=_.getBoundingClientRect(),D.attr("width",s.width),D.attr("height",s.height)}X.log.info("Text 2",c);const n=c||[],o=e.getBBox(),y=await $t(i,Array.isArray(n)?n.join("<br/>"):n,t.labelStyle,!0,!0),d=y.children[0],m=X.select_default(y);s=d.getBoundingClientRect(),m.attr("width",s.width),m.attr("height",s.height);const p=(t.padding||0)/2;X.select_default(y).attr("transform","translate( "+(s.width>o.width?0:(o.width-s.width)/2)+", "+(o.height+p+5)+")"),X.select_default(e).attr("transform","translate( "+(s.width<o.width?0:-(o.width-s.width)/2)+", 0)"),s=i.node().getBBox(),i.attr("transform","translate("+-s.width/2+", "+(-s.height/2-p+3)+")");const w=s.width+(t.padding||0),b=s.height+(t.padding||0),S=-s.width/2-p,x=-s.height/2-p;let N,k;if(t.look==="handDrawn"){const _=L.at.svg(r),D=$.userNodeOverrides(t,{}),C=_.path(ft(S,x,w,b,t.rx||0),D),R=_.line(-s.width/2-p,-s.height/2-p+o.height+p,s.width/2+p,-s.height/2-p+o.height+p,D);k=r.insert(()=>(X.log.debug("Rough node insert CXC",C),R),":first-child"),N=r.insert(()=>(X.log.debug("Rough node insert CXC",C),C),":first-child")}else N=g.insert("rect",":first-child"),k=g.insert("line"),N.attr("class","outer title-state").attr("style",h).attr("x",-s.width/2-p).attr("y",-s.height/2-p).attr("width",s.width+(t.padding||0)).attr("height",s.height+(t.padding||0)),k.attr("class","divider").attr("x1",-s.width/2-p).attr("x2",s.width/2+p).attr("y1",-s.height/2-p+o.height+p).attr("y2",-s.height/2-p+o.height+p);return O(t,N),t.intersect=function(_){return A.rect(t,_)},r}v.__name(Ee,"rectWithTitle");async function We(u,t,{config:{themeVariables:f}}){const h=f?.radius??5;return wt(u,t,{rx:h,ry:h,classes:"",labelPaddingX:(t?.padding??0)*1,labelPaddingY:(t?.padding??0)*1})}v.__name(We,"roundedRect");var yt=8;async function Ye(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.look==="neo"?16:t.padding??0,r=t.look==="neo"?12:t.padding??0,{shapeSvg:g,bbox:i,label:c}=await W(u,t,E(t)),a=(t?.width??i.width)+l*2+(t.look==="neo"?yt:yt*2),e=(t?.height??i.height)+r*2,s=a-yt,n=e,o=yt-a/2,y=-e/2,{cssStyles:d}=t,m=L.at.svg(g),p=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const w=[{x:o,y},{x:o+s,y},{x:o+s,y:y+n},{x:o-yt,y:y+n},{x:o-yt,y},{x:o,y},{x:o,y:y+n}],b=m.polygon(w.map(x=>[x.x,x.y]),p),S=g.insert(()=>b,":first-child");return S.attr("class","basic label-container outer-path").attr("style",U.handleUndefinedAttr(d)),h&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",h),d&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",h),c.attr("transform",`translate(${yt/2-i.width/2-(i.x-(i.left??0))}, ${-(i.height/2)-(i.y-(i.top??0))})`),O(t,S),t.intersect=function(x){return A.rect(t,x)},g}v.__name(Ye,"shadedProcess");async function Xe(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=t.look==="neo"?16:l,g=t.look==="neo"?12:l;(t.width||t.height)&&(t.width=Math.max((t?.width??0)-r*2,10),t.height=Math.max((t?.height??0)/1.5-g*2,10));const{shapeSvg:i,bbox:c,label:a}=await W(u,t,E(t)),e=(t?.width?t?.width:c.width)+r*2,s=((t?.height?t?.height:c.height)+g*2)*1.5,n=e,o=s/1.5,y=-n/2,d=-o/2,{cssStyles:m}=t,p=L.at.svg(i),w=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");const b=[{x:y,y:d},{x:y,y:d+o},{x:y+n,y:d+o},{x:y+n,y:d-o/2}],S=q(b),x=p.path(S,w),N=i.insert(()=>x,":first-child");return N.attr("class","basic label-container  outer-path"),m&&t.look!=="handDrawn"&&N.selectChildren("path").attr("style",m),h&&t.look!=="handDrawn"&&N.selectChildren("path").attr("style",h),N.attr("transform",`translate(0, ${o/4})`),a.attr("transform",`translate(${-n/2+(t.padding??0)-(c.x-(c.left??0))}, ${-o/4+(t.padding??0)-(c.y-(c.top??0))})`),O(t,N),t.intersect=function(k){return A.polygon(t,b,k)},i}v.__name(Xe,"slopedRect");async function je(u,t){const f=t.padding??0,h=t.look==="neo"?16:f*2,l=t.look==="neo"?12:f;return wt(u,t,{rx:0,ry:0,classes:"",labelPaddingX:t.labelPaddingX??h,labelPaddingY:l})}v.__name(je,"squareRect");async function qe(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=t.look==="neo"?20:l,g=t.look==="neo"?12:l,{shapeSvg:i,bbox:c}=await W(u,t,E(t)),a=c.height+(t.look==="neo"?g*2:g),e=c.width+a/4+(t.look==="neo"?r*2:r),s=a/2,{cssStyles:n}=t,o=L.at.svg(i),y=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const d=[{x:-e/2+s,y:-a/2},{x:e/2-s,y:-a/2},...St(-e/2+s,0,s,50,90,270),{x:e/2-s,y:a/2},...St(e/2-s,0,s,50,270,450)],m=q(d),p=o.path(m,y),w=i.insert(()=>p,":first-child");return w.attr("class","basic label-container outer-path"),n&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",n),h&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",h),O(t,w),t.intersect=function(b){return A.polygon(t,d,b)},i}v.__name(qe,"stadium");async function Ge(u,t){return wt(u,t,{rx:t.look==="neo"?3:5,ry:t.look==="neo"?3:5,classes:"flowchart-node"})}v.__name(Ge,"state");function Fe(u,t,{config:{themeVariables:f}}){const{labelStyles:h,nodeStyles:l}=$.styles2String(t);t.labelStyle=h;const{cssStyles:r}=t,{lineColor:g,stateBorder:i,nodeBorder:c,nodeShadow:a}=f;(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);const e=u.insert("g").attr("class","node default").attr("id",t.domId??t.id),s=L.at.svg(e),n=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(n.roughness=0,n.fillStyle="solid");const o=s.circle(0,0,t.width,{...n,stroke:g,strokeWidth:2}),y=i??c,d=(t.width??0)*5/14,m=s.circle(0,0,d,{...n,fill:y,stroke:y,strokeWidth:2,fillStyle:"solid"}),p=e.insert(()=>o,":first-child");if(p.insert(()=>m),t.look!=="handDrawn"&&p.attr("class","outer-path"),r&&p.selectAll("path").attr("style",r),l&&p.selectAll("path").attr("style",l),t.width<25&&a&&t.look!=="handDrawn"){const w=u.node()?.ownerSVGElement?.id??"",b=w?`${w}-drop-shadow-small`:"drop-shadow-small";p.attr("style",`filter:url(#${b})`)}return O(t,p),t.intersect=function(w){return A.circle(t,(t.width??0)/2,w)},e}v.__name(Fe,"stateEnd");function Ve(u,t,{config:{themeVariables:f}}){const{lineColor:h,nodeShadow:l}=f;(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);const r=u.insert("g").attr("class","node default").attr("id",t.domId||t.id);let g;if(t.look==="handDrawn"){const i=L.at.svg(r).circle(0,0,t.width,$.solidStateFill(h));g=r.insert(()=>i),g.attr("class","state-start").attr("r",(t.width??7)/2).attr("width",t.width??14).attr("height",t.height??14)}else g=r.insert("circle",":first-child"),g.attr("class","state-start").attr("r",(t.width??7)/2).attr("width",t.width??14).attr("height",t.height??14);if(t.width<25&&l&&t.look!=="handDrawn"){const i=u.node()?.ownerSVGElement?.id??"",c=i?`${i}-drop-shadow-small`:"drop-shadow-small";g.attr("style",`filter:url(#${c})`)}return O(t,g),t.intersect=function(i){return A.circle(t,(t.width??7)/2,i)},r}v.__name(Ve,"stateStart");var ut=8;async function ze(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t?.padding??8,r=t.look==="neo"?28:l,g=t.look==="neo"?12:l,{shapeSvg:i,bbox:c}=await W(u,t,E(t)),a=(t?.width??c.width)+2*ut+r,e=(t?.height??c.height)+g,s=a-2*ut,n=e,o=-a/2,y=-e/2,d=[{x:0,y:0},{x:s,y:0},{x:s,y:-n},{x:0,y:-n},{x:0,y:0},{x:-8,y:0},{x:s+8,y:0},{x:s+8,y:-n},{x:-8,y:-n},{x:-8,y:0}];if(t.look==="handDrawn"){const m=L.at.svg(i),p=$.userNodeOverrides(t,{}),w=m.rectangle(o,y,s+16,n,p),b=m.line(o+ut,y,o+ut,y+n,p),S=m.line(o+ut+s,y,o+ut+s,y+n,p);i.insert(()=>b,":first-child"),i.insert(()=>S,":first-child");const x=i.insert(()=>w,":first-child"),{cssStyles:N}=t;x.attr("class","basic label-container").attr("style",U.handleUndefinedAttr(N)),O(t,x)}else{const m=ot(i,s,n,d);h&&m.attr("style",h),O(t,m)}return t.intersect=function(m){return A.polygon(t,d,m)},i}v.__name(ze,"subroutine");var Dt=.2;async function Ue(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=t.look==="neo"?16:l,g=t.look==="neo"?12:l;(t.width||t.height)&&(t.height=Math.max((t?.height??0)-g*2,10),t.width=Math.max((t?.width??0)-r*2-Dt*(t.height+g*2),10));const{shapeSvg:i,bbox:c}=await W(u,t,E(t)),a=(t?.height?t?.height:c.height)+g*2,e=Dt*a,s=Dt*a,n=(t?.width?t?.width:c.width)+r*2+e-e,o=a,y=-n/2,d=-o/2,{cssStyles:m}=t,p=L.at.svg(i),w=$.userNodeOverrides(t,{}),b=[{x:y-e/2,y:d},{x:y+n+e/2,y:d},{x:y+n+e/2,y:d+o},{x:y-e/2,y:d+o}],S=[{x:y+n-e/2,y:d+o},{x:y+n+e/2,y:d+o},{x:y+n+e/2,y:d+o-s}];t.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");const x=q(b),N=p.path(x,w),k=q(S),_=p.path(k,{...w,fillStyle:"solid"}),D=i.insert(()=>_,":first-child");return D.insert(()=>N,":first-child"),D.attr("class","basic label-container outer-path"),m&&t.look!=="handDrawn"&&D.selectAll("path").attr("style",m),h&&t.look!=="handDrawn"&&D.selectAll("path").attr("style",h),O(t,D),t.intersect=function(C){return A.polygon(t,b,C)},i}v.__name(Ue,"taggedRect");async function Ze(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const{shapeSvg:l,bbox:r,label:g}=await W(u,t,E(t)),i=Math.max(r.width+(t.padding??0)*2,t?.width??0),c=Math.max(r.height+(t.padding??0)*2,t?.height??0),a=c/8,e=.2*i,s=.2*c,n=c+a,{cssStyles:o}=t,y=L.at.svg(l),d=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const m=[{x:-i/2-i/2*.1,y:n/2},...gt(-i/2-i/2*.1,n/2,i/2+i/2*.1,n/2,a,.8),{x:i/2+i/2*.1,y:-n/2},{x:-i/2-i/2*.1,y:-n/2}],p=-i/2+i/2*.1,w=-n/2-s*.4,b=[{x:p+i-e,y:(w+c)*1.3},{x:p+i,y:w+c-s},{x:p+i,y:(w+c)*.9},...gt(p+i,(w+c)*1.25,p+i-e,(w+c)*1.3,-c*.02,.5)],S=q(m),x=y.path(S,d),N=q(b),k=y.path(N,{...d,fillStyle:"solid"}),_=l.insert(()=>k,":first-child");return _.insert(()=>x,":first-child"),_.attr("class","basic label-container outer-path"),o&&t.look!=="handDrawn"&&_.selectAll("path").attr("style",o),h&&t.look!=="handDrawn"&&_.selectAll("path").attr("style",h),_.attr("transform",`translate(0,${-a/2})`),g.attr("transform",`translate(${-i/2+(t.padding??0)-(r.x-(r.left??0))},${-c/2+(t.padding??0)-a/2-(r.y-(r.top??0))})`),O(t,_),t.intersect=function(D){return A.polygon(t,m,D)},l}v.__name(Ze,"taggedWaveEdgedRectangle");async function Je(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const{shapeSvg:l,bbox:r}=await W(u,t,E(t)),g=Math.max(r.width+(t.padding??0),t?.width||0),i=Math.max(r.height+(t.padding??0),t?.height||0),c=-g/2,a=-i/2,e=l.insert("rect",":first-child");return e.attr("class","text").attr("style",h).attr("rx",0).attr("ry",0).attr("x",c).attr("y",a).attr("width",g).attr("height",i),O(t,e),t.intersect=function(s){return A.rect(t,s)},l}v.__name(Je,"text");var Cs=v.__name((u,t,f,h,l,r)=>`M${u},${t}
    a${l},${r} 0,0,1 0,${-h}
    l${f},0
    a${l},${r} 0,0,1 0,${h}
    M${f},${-h}
    a${l},${r} 0,0,0 0,${h}
    l${-f},0`,"createCylinderPathD"),As=v.__name((u,t,f,h,l,r)=>[`M${u},${t}`,`M${u+f},${t}`,`a${l},${r} 0,0,0 0,${-h}`,`l${-f},0`,`a${l},${r} 0,0,0 0,${h}`,`l${f},0`].join(" "),"createOuterCylinderPathD"),Rs=v.__name((u,t,f,h,l,r)=>[`M${u+f/2},${-h/2}`,`a${l},${r} 0,0,0 0,${h}`].join(" "),"createInnerCylinderPathD"),jt=5,qt=10;async function Ke(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=t.look==="neo"?12:l/2;if(t.width||t.height){const d=t.height??0;t.height=(t.height??0)-r,t.height<jt&&(t.height=jt);const m=d/2/(2.5+d/50);t.width=(t.width??0)-r-m*3,t.width<qt&&(t.width=qt)}const{shapeSvg:g,bbox:i,label:c}=await W(u,t,E(t)),a=(t.height?t.height:i.height)+r,e=a/2,s=e/(2.5+a/50),n=(t.width?t.width:i.width)+s+r,{cssStyles:o}=t;let y;if(t.look==="handDrawn"){const d=L.at.svg(g),m=As(0,0,n,a,s,e),p=Rs(0,0,n,a,s,e),w=d.path(m,$.userNodeOverrides(t,{})),b=d.path(p,$.userNodeOverrides(t,{fill:"none"}));y=g.insert(()=>b,":first-child"),y=g.insert(()=>w,":first-child"),y.attr("class","basic label-container"),o&&y.attr("style",o)}else{const d=Cs(0,0,n,a,s,e);y=g.insert("path",":first-child").attr("d",d).attr("class","basic label-container").attr("style",U.handleUndefinedAttr(o)).attr("style",h),y.attr("class","basic label-container outer-path"),o&&y.selectAll("path").attr("style",o),h&&y.selectAll("path").attr("style",h)}return y.attr("label-offset-x",s),y.attr("transform",`translate(${-n/2}, ${a/2} )`),c.attr("transform",`translate(${-(i.width/2)-s-(i.x-(i.left??0))}, ${-(i.height/2)-(i.y-(i.top??0))})`),O(t,y),t.intersect=function(d){const m=A.rect(t,d),p=m.y-(t.y??0);if(e!=0&&(Math.abs(p)<(t.height??0)/2||Math.abs(p)==(t.height??0)/2&&Math.abs(m.x-(t.x??0))>(t.width??0)/2-s)){let w=s*s*(1-p*p/(e*e));w!=0&&(w=Math.sqrt(Math.abs(w))),w=s-w,d.x-(t.x??0)>0&&(w=-w),m.x+=w}return m},g}v.__name(Ke,"tiltedCylinder");async function Qe(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=(t.look==="neo",l),g=t.look==="neo"?l*2:l,{shapeSvg:i,bbox:c}=await W(u,t,E(t)),a=(t?.height??c.height)+r,e=(t?.width??c.width)+g,s=[{x:-3*a/6,y:0},{x:e+3*a/6,y:0},{x:e,y:-a},{x:0,y:-a}];let n;const{cssStyles:o}=t;if(t.look==="handDrawn"){const y=L.at.svg(i),d=$.userNodeOverrides(t,{}),m=q(s),p=y.path(m,d);n=i.insert(()=>p,":first-child").attr("transform",`translate(${-e/2}, ${a/2})`),o&&n.attr("style",o)}else n=ot(i,e,a,s);return h&&n.attr("style",h),t.width=e,t.height=a,O(t,n),t.intersect=function(y){return A.polygon(t,s,y)},i}v.__name(Qe,"trapezoid");async function ts(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=t.look==="neo"?16:l,g=t.look==="neo"?12:l,i=15,c=5;(t.width||t.height)&&(t.height=(t.height??0)-g*2,t.height<c&&(t.height=c),t.width=(t.width??0)-r*2,t.width<i&&(t.width=i));const{shapeSvg:a,bbox:e}=await W(u,t,E(t)),s=(t?.width?t?.width:e.width)+r*2,n=(t?.height?t?.height:e.height)+g*2,{cssStyles:o}=t,y=L.at.svg(a),d=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const m=[{x:-s/2*.8,y:-n/2},{x:s/2*.8,y:-n/2},{x:s/2,y:-n/2*.6},{x:s/2,y:n/2},{x:-s/2,y:n/2},{x:-s/2,y:-n/2*.6}],p=q(m),w=y.path(p,d),b=a.insert(()=>w,":first-child");return b.attr("class","basic label-container outer-path"),o&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",o),h&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",h),O(t,b),t.intersect=function(S){return A.polygon(t,m,S)},a}v.__name(ts,"trapezoidalPentagon");var Gt=10,Ft=10;async function es(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=t.look==="neo"?l*2:l;(t.width||t.height)&&(t.width=((t?.width??0)-r)/2,t.width<Ft&&(t.width=Ft),t.height=t?.height??0,t.height<Gt&&(t.height=Gt));const{shapeSvg:g,bbox:i,label:c}=await W(u,t,E(t)),a=Y.evaluate(Y.getConfig2().flowchart?.htmlLabels),e=(t?.width?t?.width:i.width)+r,s=t?.height?t?.height:e+i.height,n=s,o=[{x:0,y:0},{x:n,y:0},{x:n/2,y:-s}],{cssStyles:y}=t,d=L.at.svg(g),m=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const p=q(o),w=d.path(p,m),b=g.insert(()=>w,":first-child").attr("transform",`translate(${-s/2}, ${s/2})`).attr("class","outer-path");return y&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",y),h&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",h),t.width=e,t.height=s,O(t,b),c.attr("transform",`translate(${-i.width/2-(i.x-(i.left??0))}, ${s/2-(i.height+(t.padding??0)/(a?2:1)-(i.y-(i.top??0)))})`),t.intersect=function(S){return X.log.info("Triangle intersect",t,o,S),A.polygon(t,o,S)},g}v.__name(es,"triangle");async function ss(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=t.look==="neo"?16:l,g=t.look==="neo"?12:l;let i=!0;(t.width||t.height)&&(i=!1,t.width=(t?.width??0)-r*2,t.width<10&&(t.width=10),t.height=(t?.height??0)-g*2,t.height<10&&(t.height=10));const{shapeSvg:c,bbox:a,label:e}=await W(u,t,E(t)),s=(t?.width?t?.width:a.width)+(r??0)*2,n=(t?.height?t?.height:a.height)+(g??0)*2,o=t.look==="neo"?n/4:n/8,y=n+(i?o:-o),{cssStyles:d}=t,m=14-s,p=m>0?m/2:0,w=L.at.svg(c),b=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const S=[{x:-s/2-p,y:y/2},...gt(-s/2-p,y/2,s/2+p,y/2,o,.8),{x:s/2+p,y:-y/2},{x:-s/2-p,y:-y/2}],x=q(S),N=w.path(x,b),k=c.insert(()=>N,":first-child");return k.attr("class","basic label-container outer-path"),d&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",d),h&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",h),k.attr("transform",`translate(0,${-o/2})`),e.attr("transform",`translate(${-s/2+(t.padding??0)-(a.x-(a.left??0))},${-n/2+(t.padding??0)-o-(a.y-(a.top??0))})`),O(t,k),t.intersect=function(_){return A.polygon(t,S,_)},c}v.__name(ss,"waveEdgedRectangle");async function as(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.padding??0,r=t.look==="neo"?16:l,g=t.look==="neo"?20:l;if(t.width||t.height){t.width=t?.width??0,t.width<20&&(t.width=20),t.height=t?.height??0,t.height<10&&(t.height=10);const S=Math.min(t.height*.2,t.height/4);t.height=Math.ceil(t.height-g-S*(20/9)),t.width=t.width-r*2}const{shapeSvg:i,bbox:c}=await W(u,t,E(t)),a=(t?.width?t?.width:c.width)+r*2,e=(t?.height?t?.height:c.height)+g,s=e/8,n=e+s*2,{cssStyles:o}=t,y=L.at.svg(i),d=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const m=[{x:-a/2,y:n/2},...gt(-a/2,n/2,a/2,n/2,s,1),{x:a/2,y:-n/2},...gt(a/2,-n/2,-a/2,-n/2,s,-1)],p=q(m),w=y.path(p,d),b=i.insert(()=>w,":first-child");return b.attr("class","basic label-container"),o&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",o),h&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",h),O(t,b),t.intersect=function(S){return A.polygon(t,m,S)},i}v.__name(as,"waveRectangle");var Z=10;async function is(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t.look==="neo"?16:t.padding??0,r=t.look==="neo"?12:t.padding??0;(t.width||t.height)&&(t.width=Math.max((t?.width??0)-l*2-Z,10),t.height=Math.max((t?.height??0)-r*2-Z,10));const{shapeSvg:g,bbox:i,label:c}=await W(u,t,E(t)),a=(t?.width?t?.width:i.width)+l*2+Z,e=(t?.height?t?.height:i.height)+r*2+Z,s=a-Z,n=e-Z,o=-s/2,y=-n/2,{cssStyles:d}=t,m=L.at.svg(g),p=$.userNodeOverrides(t,{}),w=[{x:o-Z,y:y-Z},{x:o-Z,y:y+n},{x:o+s,y:y+n},{x:o+s,y:y-Z}],b=`M${o-Z},${y-Z} L${o+s},${y-Z} L${o+s},${y+n} L${o-Z},${y+n} L${o-Z},${y-Z}
                M${o-Z},${y} L${o+s},${y}
                M${o},${y-Z} L${o},${y+n}`;t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const S=m.path(b,p),x=g.insert(()=>S,":first-child");return x.attr("transform",`translate(${Z/2}, ${Z/2})`),x.attr("class","basic label-container outer-path"),d&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",d),h&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",h),c.attr("transform",`translate(${-(i.width/2)+Z/2-(i.x-(i.left??0))}, ${-(i.height/2)+Z/2-(i.y-(i.top??0))})`),O(t,x),t.intersect=function(N){return A.polygon(t,w,N)},g}v.__name(is,"windowPane");var Vt=new Set(["redux-color","redux-dark-color"]),Hs=new Set(["redux","redux-dark","redux-color","redux-dark-color"]);async function Ht(u,t){const f=t;f.alias&&(t.label=f.alias);const{theme:h,themeVariables:l}=Y.getConfig(),{rowEven:r,rowOdd:g,nodeBorder:i,borderColorArray:c}=l;if(t.look==="handDrawn"){const{themeVariables:j}=Y.getConfig(),{background:F}=j;await Ht(u,{...t,id:t.id+"-background",domId:(t.domId||t.id)+"-background",look:"default",cssStyles:["stroke: none",`fill: ${F}`]})}const a=Y.getConfig();t.useHtmlLabels=a.htmlLabels;let e=a.er?.diagramPadding??10,s=a.er?.entityPadding??6;const{cssStyles:n}=t,{labelStyles:o,nodeStyles:y}=$.styles2String(t);if(f.attributes.length===0&&t.label){const j={rx:0,ry:0,labelPaddingX:e,labelPaddingY:e*1.5,classes:""};U.calculateTextWidth(t.label,a)+j.labelPaddingX*2<a.er.minEntityWidth&&(t.width=a.er.minEntityWidth);const F=await wt(u,t,j);if(h!=null&&Vt.has(h)){const K=f.colorIndex??0;F.attr("data-color-id",`color-${K%c.length}`)}if(!Y.evaluate(a.htmlLabels)){const K=F.select("text"),et=K.node()?.getBBox();K.attr("transform",`translate(${-et.width/2}, 0)`)}return F}a.htmlLabels||(e*=1.25,s*=1.25);let d=E(t);d||(d="node default");const m=u.insert("g").attr("class",d).attr("id",t.domId||t.id),p=await pt(m,t.label??"",a,0,0,["name"],o);p.height+=s;let w=0;const b=[],S=[];let x=0,N=0,k=0,_=0,D=!0,C=!0;for(const j of f.attributes){const F=await pt(m,j.type,a,0,w,["attribute-type"],o);x=Math.max(x,F.width+e);const K=await pt(m,j.name,a,0,w,["attribute-name"],o);N=Math.max(N,K.width+e);const et=await pt(m,j.keys.join(),a,0,w,["attribute-keys"],o);k=Math.max(k,et.width+e);const bt=await pt(m,j.comment,a,0,w,["attribute-comment"],o);_=Math.max(_,bt.width+e);const ht=Math.max(F.height,K.height,et.height,bt.height)+s;S.push({yOffset:w,rowHeight:ht}),w+=ht}let R=4;k<=e&&(D=!1,k=0,R--),_<=e&&(C=!1,_=0,R--);const T=m.node().getBBox();if(p.width+e*2-(x+N+k+_)>0){const j=p.width+e*2-(x+N+k+_);x+=j/R,N+=j/R,k>0&&(k+=j/R),_>0&&(_+=j/R)}const M=x+N+k+_,B=L.at.svg(m),P=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(P.roughness=0,P.fillStyle="solid");let I=0;S.length>0&&(I=S.reduce((j,F)=>j+(F?.rowHeight??0),0));const H=Math.max(T.width+e*2,t?.width||0,M),G=Math.max((I??0)+p.height,t?.height||0),V=-H/2,z=-G/2;if(m.selectAll("g:not(:first-child)").each((j,F,K)=>{const et=X.select_default(K[F]),bt=et.attr("transform");let ht=0,Lt=0;if(bt){const Nt=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(bt);Nt&&(ht=parseFloat(Nt[1]),Lt=parseFloat(Nt[2]),et.attr("class").includes("attribute-name")?ht+=x:et.attr("class").includes("attribute-keys")?ht+=x+N:et.attr("class").includes("attribute-comment")&&(ht+=x+N+k))}et.attr("transform",`translate(${V+e/2+ht}, ${Lt+z+p.height+s/2})`)}),m.select(".name").attr("transform","translate("+-p.width/2+", "+(z+s/2)+")"),h!=null&&Vt.has(h)){const j=f.colorIndex??0;m.attr("data-color-id",`color-${j%c.length}`)}const at=B.rectangle(V,z,H,G,P),tt=m.insert(()=>at,":first-child").attr("class","outer-path").attr("style",n.join(""));b.push(0);for(const[j,F]of S.entries()){const K=(j+1)%2===0&&F.yOffset!==0,et=B.rectangle(V,p.height+z+F?.yOffset,H,F?.rowHeight,{...P,fill:K?r:g,stroke:i});m.insert(()=>et,"g.label").attr("style",n.join("")).attr("class",`row-rect-${K?"even":"odd"}`)}const it=1e-4;let Q=mt(V,p.height+z,H+V,p.height+z,it),rt=B.polygon(Q.map(j=>[j.x,j.y]),P);if(m.insert(()=>rt).attr("class","divider"),Q=mt(x+V,p.height+z,x+V,G+z,it),rt=B.polygon(Q.map(j=>[j.x,j.y]),P),m.insert(()=>rt).attr("class","divider"),D){const j=x+N+V;Q=mt(j,p.height+z,j,G+z,it),rt=B.polygon(Q.map(F=>[F.x,F.y]),P),m.insert(()=>rt).attr("class","divider")}if(C){const j=x+N+k+V;Q=mt(j,p.height+z,j,G+z,it),rt=B.polygon(Q.map(F=>[F.x,F.y]),P),m.insert(()=>rt).attr("class","divider")}for(const j of b){const F=p.height+z+j;Q=mt(V,F,H+V,F,it),rt=B.polygon(Q.map(K=>[K.x,K.y]),P),m.insert(()=>rt).attr("class","divider")}if(O(t,tt),y&&t.look!=="handDrawn")if(h!=null&&Hs.has(h))m.selectAll("path").attr("style",y);else{const j=y.split(";")?.filter(F=>F.includes("stroke"))?.map(F=>`${F}`).join("; ");m.selectAll("path").attr("style",j??""),m.selectAll(".row-rect-even path").attr("style",y)}return t.intersect=function(j){return A.rect(t,j)},m}v.__name(Ht,"erBox");async function pt(u,t,f,h=0,l=0,r=[],g=""){const i=u.insert("g").attr("class",`label ${r.join(" ")}`).attr("transform",`translate(${h}, ${l})`).attr("style",g);t!==Y.parseGenericTypes(t)&&(t=Y.parseGenericTypes(t),t=t.replaceAll("<","&lt;").replaceAll(">","&gt;"));const c=i.node().appendChild(await ct.createText(i,t,{width:U.calculateTextWidth(t,f)+100,style:g,useHtmlLabels:f.htmlLabels},f));if(t.includes("&lt;")||t.includes("&gt;")){let e=c.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=c.getBBox();if(Y.evaluate(f.htmlLabels)){const e=c.children[0];e.style.textAlign="start";const s=X.select_default(c);a=e.getBoundingClientRect(),s.attr("width",a.width),s.attr("height",a.height)}return a}v.__name(pt,"addText");function mt(u,t,f,h,l){return u===f?[{x:u-l/2,y:t},{x:u+l/2,y:t},{x:f+l/2,y:h},{x:f-l/2,y:h}]:[{x:u,y:t-l/2},{x:u,y:t+l/2},{x:f,y:h+l/2},{x:f,y:h-l/2}]}v.__name(mt,"lineToPolygon");async function rs(u,t,f,h,l=f.class.padding??12){const r=h?0:3,g=u.insert("g").attr("class",E(t)).attr("id",t.domId||t.id);let i=null,c=null,a=null,e=null,s=0,n=0,o=0;if(i=g.insert("g").attr("class","annotation-group text"),t.annotations.length>0){const w=t.annotations[0];await xt(i,{text:`«${w}»`},0),s=i.node().getBBox().height}c=g.insert("g").attr("class","label-group text"),await xt(c,t,0,["font-weight: bolder"]);const y=c.node().getBBox();n=y.height,a=g.insert("g").attr("class","members-group text");let d=0;for(const w of t.members){const b=await xt(a,w,d,[w.parseClassifier()]);d+=b+r}o=a.node().getBBox().height,o<=0&&(o=l/2),e=g.insert("g").attr("class","methods-group text");let m=0;for(const w of t.methods){const b=await xt(e,w,m,[w.parseClassifier()]);m+=b+r}let p=g.node().getBBox();if(i!==null){const w=i.node().getBBox();i.attr("transform",`translate(${-w.width/2})`)}return c.attr("transform",`translate(${-y.width/2}, ${s})`),p=g.node().getBBox(),a.attr("transform",`translate(0, ${s+n+l*2})`),p=g.node().getBBox(),e.attr("transform",`translate(0, ${s+n+(o?o+l*4:l*2)})`),p=g.node().getBBox(),{shapeSvg:g,bbox:p}}v.__name(rs,"textHelper");async function xt(u,t,f,h=[]){const l=u.insert("g").attr("class","label").attr("style",h.join("; ")),r=Y.getConfig();let g="useHtmlLabels"in t?t.useHtmlLabels:Y.evaluate(r.htmlLabels)??!0,i="";"text"in t?i=t.text:i=t.label,!g&&i.startsWith("\\")&&(i=i.substring(1)),Y.hasKatex(i)&&(g=!0);const c=await ct.createText(l,Y.sanitizeText3(U.decodeEntities(i)),{width:U.calculateTextWidth(i,r)+50,classes:"markdown-node-label",useHtmlLabels:g},r);let a,e=1;if(g){const s=c.children[0],n=X.select_default(c);e=s.innerHTML.split("<br>").length,s.innerHTML.includes("</math>")&&(e+=s.innerHTML.split("<mrow>").length-1);const o=s.getElementsByTagName("img");if(o){const y=i.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...o].map(d=>new Promise(m=>{function p(){if(d.style.display="flex",d.style.flexDirection="column",y){const w=r.fontSize?.toString()??window.getComputedStyle(document.body).fontSize,b=parseInt(w,10)*5+"px";d.style.minWidth=b,d.style.maxWidth=b}else d.style.width="100%";m(d)}v.__name(p,"setupImage"),setTimeout(()=>{d.complete&&p()}),d.addEventListener("error",p),d.addEventListener("load",p)})))}a=s.getBoundingClientRect(),n.attr("width",a.width),n.attr("height",a.height)}else{h.includes("font-weight: bolder")&&X.select_default(c).selectAll("tspan").attr("font-weight",""),e=c.children.length;const s=c.children[0];(c.textContent===""||c.textContent.includes("&gt"))&&(s.textContent=i[0]+i.substring(1).replaceAll("&gt;",">").replaceAll("&lt;","<").trim(),i[1]===" "&&(s.textContent=s.textContent[0]+" "+s.textContent.substring(1))),s.textContent==="undefined"&&(s.textContent=""),a=c.getBBox()}return l.attr("transform","translate(0,"+(-a.height/(2*e)+f)+")"),a.height}v.__name(xt,"addText");async function ls(u,t){const f=Y.getConfig2(),{themeVariables:h}=f,{useGradient:l}=h,r=f.class.padding??12,g=r,i=t.useHtmlLabels??Y.evaluate(f.htmlLabels)??!0,c=t;c.annotations=c.annotations??[],c.members=c.members??[],c.methods=c.methods??[];const{shapeSvg:a,bbox:e}=await rs(u,t,f,i,g),{labelStyles:s,nodeStyles:n}=$.styles2String(t);t.labelStyle=s,t.cssStyles=c.styles||"";const o=c.styles?.join(";")||n||"";t.cssStyles||(t.cssStyles=o.replaceAll("!important","").split(";"));const y=c.members.length===0&&c.methods.length===0&&!f.class?.hideEmptyMembersBox,d=L.at.svg(a),m=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const p=Math.max(t.width??0,e.width);let w=Math.max(t.height??0,e.height);const b=(t.height??0)>e.height;c.members.length===0&&c.methods.length===0?w+=g:c.members.length>0&&c.methods.length===0&&(w+=g*2);const S=-p/2,x=-w/2;let N=y?r*2:c.members.length===0&&c.methods.length===0?-r:0;b&&(N=r*2);const k=d.rectangle(S-r,x-r-(y?r:c.members.length===0&&c.methods.length===0?-r/2:0),p+2*r,w+2*r+N,m),_=a.insert(()=>k,":first-child");_.attr("class","basic label-container outer-path");const D=_.node().getBBox(),C=a.select(".annotation-group").node().getBBox().height-(y?r/2:0)||0,R=a.select(".label-group").node().getBBox().height-(y?r/2:0)||0,T=a.select(".members-group").node().getBBox().height-(y?r/2:0)||0,M=(C+R+x+r-(x-r-(y?r:c.members.length===0&&c.methods.length===0?-r/2:0)))/2;if(a.selectAll(".text").each((B,P,I)=>{const H=X.select_default(I[P]),G=H.attr("transform");let V=0;if(G){const tt=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(G);tt&&(V=parseFloat(tt[2]))}let z=V+x+r-(y?r:c.members.length===0&&c.methods.length===0?-r/2:0);if(H.attr("class").includes("methods-group")){const tt=Math.max(T,g/2);b?z=Math.max(M,C+R+tt+x+g*2+r)+g*2:z=C+R+tt+x+g*4+r}c.members.length===0&&c.methods.length===0&&f.class?.hideEmptyMembersBox&&(c.annotations.length>0?z=V-g:z=V),i||(z-=4);let at=S;(H.attr("class").includes("label-group")||H.attr("class").includes("annotation-group"))&&(at=-H.node()?.getBBox().width/2||0,a.selectAll("text").each(function(tt,it,Q){window.getComputedStyle(Q[it]).textAnchor==="middle"&&(at=0)})),H.attr("transform",`translate(${at}, ${z})`)}),c.members.length>0||c.methods.length>0||y){const B=C+R+x+r,P=d.line(D.x,B,D.x+D.width,B+.001,m);a.insert(()=>P).attr("class",`divider${t.look==="neo"&&!l?" neo-line":""}`).attr("style",o)}if(y||c.members.length>0||c.methods.length>0){const B=C+R+T+x+g*2+r,P=d.line(D.x,b?Math.max(M,B):B,D.x+D.width,(b?Math.max(M,B):B)+.001,m);a.insert(()=>P).attr("class",`divider${t.look==="neo"&&!l?" neo-line":""}`).attr("style",o)}if(c.look!=="handDrawn"&&a.selectAll("path").attr("style",o),_.select(":nth-child(2)").attr("style",o),a.selectAll(".divider").select("path").attr("style",o),t.labelStyle?a.selectAll("span").attr("style",t.labelStyle):a.selectAll("span").attr("style",o),!i){const B=RegExp(/color\s*:\s*([^;]*)/),P=B.exec(o);if(P){const I=P[0].replace("color","fill");a.selectAll("tspan").attr("style",I)}else if(s){const I=B.exec(s);if(I){const H=I[0].replace("color","fill");a.selectAll("tspan").attr("style",H)}}}return O(t,_),t.intersect=function(B){return A.rect(t,B)},a}v.__name(ls,"classBox");async function ns(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const l=t,r=t,g=20,i=20,c="verifyMethod"in t,a=E(t),{themeVariables:e}=Y.getConfig2(),{borderColorArray:s,requirementEdgeLabelBackground:n}=e,o=u.insert("g").attr("class",a).attr("id",t.domId??t.id);let y;c?y=await st(o,`&lt;&lt;${l.type}&gt;&gt;`,0,t.labelStyle):y=await st(o,"&lt;&lt;Element&gt;&gt;",0,t.labelStyle);let d=y;const m=await st(o,l.name,d,t.labelStyle+"; font-weight: bold;");if(d+=m+i,c){const D=await st(o,`${l.requirementId?`ID: ${l.requirementId}`:""}`,d,t.labelStyle);d+=D;const C=await st(o,`${l.text?`Text: ${l.text}`:""}`,d,t.labelStyle);d+=C;const R=await st(o,`${l.risk?`Risk: ${l.risk}`:""}`,d,t.labelStyle);d+=R,await st(o,`${l.verifyMethod?`Verification: ${l.verifyMethod}`:""}`,d,t.labelStyle)}else{const D=await st(o,`${r.type?`Type: ${r.type}`:""}`,d,t.labelStyle);d+=D,await st(o,`${r.docRef?`Doc Ref: ${r.docRef}`:""}`,d,t.labelStyle)}const p=(o.node()?.getBBox().width??200)+g,w=(o.node()?.getBBox().height??200)+g,b=-p/2,S=-w/2,x=L.at.svg(o),N=$.userNodeOverrides(t,{});t.look!=="handDrawn"&&(N.roughness=0,N.fillStyle="solid");const k=x.rectangle(b,S,p,w,N),_=o.insert(()=>k,":first-child");if(_.attr("class","basic label-container outer-path").attr("style",h),s?.length){const D=t.colorIndex??0;o.attr("data-color-id",`color-${D%s.length}`)}if(o.selectAll(".label").each((D,C,R)=>{const T=X.select_default(R[C]),M=T.attr("transform");let B=0,P=0;if(M){const G=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(M);G&&(B=parseFloat(G[1]),P=parseFloat(G[2]))}const I=P-w/2;let H=b+g/2;(C===0||C===1)&&(H=B),T.attr("transform",`translate(${H}, ${I+g})`)}),d>y+m+i){const D=S+y+m+i;let C;if(t.look==="neo"){const T=[[b,D],[b+p,D],[b+p,D+.001],[b,D+.001]];C=x.polygon(T,N)}else C=x.line(b,D,b+p,D,N);o.insert(()=>C).attr("class","divider")}return O(t,_),t.intersect=function(D){return A.rect(t,D)},h&&t.look!=="handDrawn"&&(n||s?.length)&&o.selectAll("path").attr("style",h),o}v.__name(ns,"requirementBox");async function st(u,t,f,h=""){if(t==="")return 0;const l=u.insert("g").attr("class","label").attr("style",h),r=Y.getConfig2(),g=r.htmlLabels??!0,i=await ct.createText(l,Y.sanitizeText3(U.decodeEntities(t)),{width:U.calculateTextWidth(t,r)+50,classes:"markdown-node-label",useHtmlLabels:g,style:h},r);let c;if(g){const a=i.children[0],e=X.select_default(i);c=a.getBoundingClientRect(),e.attr("width",c.width),e.attr("height",c.height)}else{const a=i.children[0];for(const e of a.children)h&&e.setAttribute("style",h);c=i.getBBox(),c.height+=6}return l.attr("transform",`translate(${-c.width/2},${-c.height/2+f})`),c.height}v.__name(st,"addText");var Ls=v.__name(u=>{switch(u){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 cs(u,t,{config:f}){const{labelStyles:h,nodeStyles:l}=$.styles2String(t);t.labelStyle=h||"";const r=t.width;t.width=(t.width??200)-10;const{shapeSvg:g,bbox:i,label:c}=await W(u,t,E(t)),a=t.padding||10;let e="",s;"ticket"in t&&t.ticket&&f?.kanban?.ticketBaseUrl&&(e=f?.kanban?.ticketBaseUrl.replace("#TICKET#",t.ticket),s=g.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",e).attr("target","_blank"));const n={useHtmlLabels:t.useHtmlLabels,labelStyle:t.labelStyle||"",width:t.width,img:t.img,padding:t.padding||8,centerLabel:!1};let o,y;s?{label:o,bbox:y}=await Pt(s,"ticket"in t&&t.ticket||"",n):{label:o,bbox:y}=await Pt(g,"ticket"in t&&t.ticket||"",n);const{label:d,bbox:m}=await Pt(g,"assigned"in t&&t.assigned||"",n);t.width=r;const p=t?.width||0,w=Math.max(y.height,m.height)/2,b=Math.max(i.height+20,t?.height||0)+w,S=-p/2,x=-b/2;c.attr("transform","translate("+(a-p/2)+", "+(-w-i.height/2)+")"),o.attr("transform","translate("+(a-p/2)+", "+(-w+i.height/2)+")"),d.attr("transform","translate("+(a+p/2-m.width-20)+", "+(-w+i.height/2)+")");let N;const{rx:k,ry:_}=t,{cssStyles:D}=t;if(t.look==="handDrawn"){const C=L.at.svg(g),R=$.userNodeOverrides(t,{}),T=k||_?C.path(ft(S,x,p,b,k||0),R):C.rectangle(S,x,p,b,R);N=g.insert(()=>T,":first-child"),N.attr("class","basic label-container").attr("style",D||null)}else{N=g.insert("rect",":first-child"),N.attr("class","basic label-container __APA__").attr("style",l).attr("rx",k??5).attr("ry",_??5).attr("x",S).attr("y",x).attr("width",p).attr("height",b);const C="priority"in t&&t.priority;if(C){const R=g.append("line"),T=S+2,M=x+Math.floor((k??0)/2),B=x+b-Math.floor((k??0)/2);R.attr("x1",T).attr("y1",M).attr("x2",T).attr("y2",B).attr("stroke-width","4").attr("stroke",Ls(C))}}return O(t,N),t.height=b,t.intersect=function(C){return A.rect(t,C)},g}v.__name(cs,"kanbanItem");async function os(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const{shapeSvg:l,bbox:r,halfPadding:g,label:i}=await W(u,t,E(t)),c=r.width+10*g,a=r.height+8*g,e=.15*c,{cssStyles:s}=t,n=r.width+20,o=r.height+20,y=Math.max(c,n),d=Math.max(a,o);i.attr("transform",`translate(${-r.width/2}, ${-r.height/2})`);let m;const p=`M0 0 
    a${e},${e} 1 0,0 ${y*.25},${-1*d*.1}
    a${e},${e} 1 0,0 ${y*.25},0
    a${e},${e} 1 0,0 ${y*.25},0
    a${e},${e} 1 0,0 ${y*.25},${d*.1}

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

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

    a${e},${e} 1 0,0 ${-1*y*.1},${-1*d*.33}
    a${e*.8},${e*.8} 1 0,0 0,${-1*d*.34}
    a${e},${e} 1 0,0 ${y*.1},${-1*d*.33}
  H0 V0 Z`;if(t.look==="handDrawn"){const w=L.at.svg(l),b=$.userNodeOverrides(t,{}),S=w.path(p,b);m=l.insert(()=>S,":first-child"),m.attr("class","basic label-container").attr("style",U.handleUndefinedAttr(s))}else m=l.insert("path",":first-child").attr("class","basic label-container").attr("style",h).attr("d",p);return m.attr("transform",`translate(${-y/2}, ${-d/2})`),O(t,m),t.calcIntersect=function(w,b){return A.rect(w,b)},t.intersect=function(w){return X.log.info("Bang intersect",t,w),A.rect(t,w)},l}v.__name(os,"bang");async function hs(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const{shapeSvg:l,bbox:r,halfPadding:g,label:i}=await W(u,t,E(t)),c=r.width+2*g,a=r.height+2*g,e=.15*c,s=.25*c,n=.35*c,o=.2*c,{cssStyles:y}=t;let d;const m=`M0 0 
    a${e},${e} 0 0,1 ${c*.25},${-1*c*.1}
    a${n},${n} 1 0,1 ${c*.4},${-1*c*.1}
    a${s},${s} 1 0,1 ${c*.35},${c*.2}

    a${e},${e} 1 0,1 ${c*.15},${a*.35}
    a${o},${o} 1 0,1 ${-1*c*.15},${a*.65}

    a${s},${e} 1 0,1 ${-1*c*.25},${c*.15}
    a${n},${n} 1 0,1 ${-1*c*.5},0
    a${e},${e} 1 0,1 ${-1*c*.25},${-1*c*.15}

    a${e},${e} 1 0,1 ${-1*c*.1},${-1*a*.35}
    a${o},${o} 1 0,1 ${c*.1},${-1*a*.65}
  H0 V0 Z`;if(t.look==="handDrawn"){const p=L.at.svg(l),w=$.userNodeOverrides(t,{}),b=p.path(m,w);d=l.insert(()=>b,":first-child"),d.attr("class","basic label-container").attr("style",U.handleUndefinedAttr(y))}else d=l.insert("path",":first-child").attr("class","basic label-container").attr("style",h).attr("d",m);return i.attr("transform",`translate(${-r.width/2}, ${-r.height/2})`),d.attr("transform",`translate(${-c/2}, ${-a/2})`),O(t,d),t.calcIntersect=function(p,w){return A.rect(p,w)},t.intersect=function(p){return X.log.info("Cloud intersect",t,p),A.rect(t,p)},l}v.__name(hs,"cloud");async function gs(u,t){const{labelStyles:f,nodeStyles:h}=$.styles2String(t);t.labelStyle=f;const{shapeSvg:l,bbox:r,halfPadding:g,label:i}=await W(u,t,E(t)),c=r.width+8*g,a=r.height+2*g,e=5,s=t.look==="neo"?`
    M${-c/2} ${a/2-e}
    v${-a+10}
    q0,-${e} ${e},-${e}
    h${c-10}
    q${e},0 ${e},${e}
    v${a-e}
    H${-c/2}
    Z
  `:`
    M${-c/2} ${a/2-e}
    v${-a+10}
    q0,-${e} ${e},-${e}
    h${c-10}
    q${e},0 ${e},${e}
    v${a-10}
    q0,${e} -5,${e}
    h${-(c-10)}
    q-5,0 -5,-5
    Z
  `;if(!t.domId)throw new Error(`defaultMindmapNode: node "${t.id}" is missing a domId — was render.ts domId prefixing skipped?`);const n=l.append("path").attr("id",t.domId).attr("class","node-bkg node-"+t.type).attr("style",h).attr("d",s);return l.append("line").attr("class","node-line-").attr("x1",-c/2).attr("y1",a/2).attr("x2",c/2).attr("y2",a/2),i.attr("transform",`translate(${-r.width/2}, ${-r.height/2})`),l.append(()=>i.node()),O(t,n),t.calcIntersect=function(o,y){return A.rect(o,y)},t.intersect=function(o){return A.rect(t,o)},l}v.__name(gs,"defaultMindmapNode");async function fs(u,t){return Rt(u,t,{padding:t.padding??0})}v.__name(fs,"mindmapCircle");var Is=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:je},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:We},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:qe},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:ze},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:fe},{semanticName:"Data Store",name:"Data Store",shortName:"datastore",description:"Data flow diagram data store",aliases:["data-store"],handler:ye},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:Rt},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:os},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:hs},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:Oe},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:xe},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:Me},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:Be},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:Qe},{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:Pe},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:ue},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:Je},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:ie},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:Ye},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:Ve},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:Fe},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:we},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:Se},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:ce},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:oe},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:he},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:Ce},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:ss},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:be},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:Ke},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:Ae},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:ge},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:de},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:es},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:is},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:pe},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:ts},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:me},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:Xe},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:Le},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:He},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:ae},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:ne},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:Ze},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:Ue},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:as},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:Te},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:Re}],ys=v.__name(()=>{const u=[...Object.entries({state:Ge,choice:re,note:Ie,rectWithTitle:Ee,labelRect:De,iconSquare:_e,iconCircle:ve,icon:$e,iconRounded:ke,imageSquare:Ne,anchor:ee,kanbanItem:cs,mindmapCircle:fs,defaultMindmapNode:gs,classBox:ls,erBox:Ht,requirementBox:ns}),...Is.flatMap(t=>[t.shortName,..."aliases"in t?t.aliases:[],..."internalAliases"in t?t.internalAliases:[]].map(f=>[f,t.handler]))];return Object.fromEntries(u)},"generateShapeMap")();function ds(u){return u in ys}v.__name(ds,"isValidShape");var _t=new Map;async function us(u,t,f){let h,l;t.shape==="rect"&&(t.rx&&t.ry?t.shape="roundedRect":t.shape="squareRect");const r=t.shape?ys[t.shape]:void 0;if(!r)throw new Error(`No such shape: ${t.shape}. Please check your syntax.`);if(t.link){let g;f.config.securityLevel==="sandbox"?g="_top":t.linkTarget&&(g=t.linkTarget||"_blank"),h=u.insert("svg:a").attr("xlink:href",t.link).attr("target",g??null),l=await r(h,t,f)}else l=await r(u,t,f),h=l;return h.attr("data-look",U.handleUndefinedAttr(t.look)),t.tooltip&&l.attr("title",t.tooltip),_t.set(t.id,h),t.haveCallback&&h.attr("class",h.attr("class")+" clickable"),h}v.__name(us,"insertNode");var Os=v.__name((u,t)=>{_t.set(t.id,u)},"setNodeElem"),Ts=v.__name(()=>{_t.clear()},"clear"),Es=v.__name(u=>{const t=_t.get(u.id);X.log.trace("Transforming node",u.diff,u,"translate("+(u.x-u.width/2-5)+", "+u.width/2+")");const f=8,h=u.diff||0;return u.clusterNode?t.attr("transform","translate("+(u.x+h-u.width/2)+", "+(u.y-u.height/2-f)+")"):t.attr("transform","translate("+u.x+", "+u.y+")"),h},"positionNode");Object.defineProperty(exports,"clear",{enumerable:!0,get:function(){return bs}});Object.defineProperty(exports,"clear2",{enumerable:!0,get:function(){return Ts}});Object.defineProperty(exports,"createLabel_default",{enumerable:!0,get:function(){return $t}});Object.defineProperty(exports,"insertCluster",{enumerable:!0,get:function(){return ws}});Object.defineProperty(exports,"insertNode",{enumerable:!0,get:function(){return us}});Object.defineProperty(exports,"isValidShape",{enumerable:!0,get:function(){return ds}});Object.defineProperty(exports,"labelHelper",{enumerable:!0,get:function(){return W}});Object.defineProperty(exports,"positionNode",{enumerable:!0,get:function(){return Es}});Object.defineProperty(exports,"setNodeElem",{enumerable:!0,get:function(){return Os}});Object.defineProperty(exports,"updateNodeBounds",{enumerable:!0,get:function(){return O}});