?',height:80,width:80},Ws=new Map,Bu=new Map,Fx=p(e=>{for(const t of e){if(!t.name)throw new Error('Invalid icon loader. Must have a "name" property with non-empty string value.');if(D.debug("Registering icon pack:",t.name),"loader"in t)Bu.set(t.name,t.loader);else if("icons"in t)Ws.set(t.name,t.icons);else throw D.error("Invalid icon loader:",t),new Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),Au=p(async(e,t)=>{const r=Dy(e,!0,t!==void 0);if(!r)throw new Error(`Invalid icon name: ${e}`);const i=r.prefix||t;if(!i)throw new Error(`Icon name must contain a prefix: ${e}`);let a=Ws.get(i);if(!a){const o=Bu.get(i);if(!o)throw new Error(`Icon set not found: ${r.prefix}`);try{a={...await o(),prefix:i},Ws.set(i,a)}catch(n){throw D.error(n),new Error(`Failed to load icon set: ${r.prefix}`)}}const s=Iy(a,r.name);if(!s)throw new Error(`Icon not found: ${e}`);return s},"getRegisteredIconData"),Dx=p(async e=>{try{return await Au(e),!0}catch{return!1}},"isIconAvailable"),yi=p(async(e,t,r)=>{let i;try{i=await Au(e,t==null?void 0:t.fallbackPrefix)}catch(o){D.error(o),i=$x}const a=jy(i,t),s=Vy(Gy(a.body),{...a.attributes,...r});return de(s,It())},"getIconSVG");function Mu(e,{markdownAutoWrap:t}){const i=e.replace(/
/g,`
`).replace(/\n{2,}/g,`
`);return Lu(i)}p(Mu,"preprocessMarkdown");function Eu(e){return e.split(/\\n|\n|
/gi).map(t=>{var r;return((r=t.trim().match(/]+>|[^\s]+/g))==null?void 0:r.map(i=>({content:i,type:"normal"})))??[]})}p(Eu,"nonMarkdownToLines");function $u(e,t={}){const r=Mu(e,t),i=gt.lexer(r),a=[[]];let s=0;function o(n,l="normal"){n.type==="text"?n.text.split(`
`).forEach((h,u)=>{u!==0&&(s++,a.push([])),h.split(" ").forEach(f=>{f=f.replace(/'/g,"'"),f&&a[s].push({content:f,type:l})})}):n.type==="strong"||n.type==="em"?n.tokens.forEach(c=>{o(c,n.type)}):n.type==="html"&&a[s].push({content:n.text,type:"normal"})}return p(o,"processNode"),i.forEach(n=>{var l;n.type==="paragraph"?(l=n.tokens)==null||l.forEach(c=>{o(c)}):n.type==="html"?a[s].push({content:n.text,type:"normal"}):a[s].push({content:n.raw,type:"normal"})}),a}p($u,"markdownToLines");function Fu(e){return e?`${e.replace(/\\n|\n/g,"
")}
`:""}p(Fu,"nonMarkdownToHTML");function Du(e,{markdownAutoWrap:t}={}){const r=gt.lexer(e);function i(a){var s,o,n;return a.type==="text"?t===!1?a.text.replace(/\n */g,"
").replace(/ /g," "):a.text.replace(/\n */g,"
"):a.type==="strong"?`${(s=a.tokens)==null?void 0:s.map(i).join("")}`:a.type==="em"?`${(o=a.tokens)==null?void 0:o.map(i).join("")}`:a.type==="paragraph"?`${(n=a.tokens)==null?void 0:n.map(i).join("")}
`:a.type==="space"?"":a.type==="html"?`${a.text}`:a.type==="escape"?a.text:(D.warn(`Unsupported markdown: ${a.type}`),a.raw)}return p(i,"output"),r.map(i).join("")}p(Du,"markdownToHTML");function Ou(e){return Intl.Segmenter?[...new Intl.Segmenter().segment(e)].map(t=>t.segment):[...e]}p(Ou,"splitTextToChars");function Ru(e,t){const r=Ou(t.content);return Pn(e,[],r,t.type)}p(Ru,"splitWordToFitWidth");function Pn(e,t,r,i){if(r.length===0)return[{content:t.join(""),type:i},{content:"",type:i}];const[a,...s]=r,o=[...t,a];return e([{content:o.join(""),type:i}])?Pn(e,o,s,i):(t.length===0&&a&&(t.push(a),r.shift()),[{content:t.join(""),type:i},{content:r.join(""),type:i}])}p(Pn,"splitWordToFitWidthRecursion");function Iu(e,t){if(e.some(({content:r})=>r.includes(`
`)))throw new Error("splitLineToFitWidth does not support newlines in the line");return da(e,t)}p(Iu,"splitLineToFitWidth");function da(e,t,r=[],i=[]){if(e.length===0)return i.length>0&&r.push(i),r.length>0?r:[];let a="";e[0].content===" "&&(a=" ",e.shift());const s=e.shift()??{content:" ",type:"normal"},o=[...i];if(a!==""&&o.push({content:a,type:"normal"}),o.push(s),t(o))return da(e,t,r,o);if(i.length>0)r.push(i),e.unshift(s);else if(s.content){const[n,l]=Ru(t,s);r.push([n]),l.content&&e.unshift(l)}return da(e,t,r)}p(da,"splitLineToFitWidthRecursion");function qs(e,t){t&&e.attr("style",t)}p(qs,"applyStyle");var il=16384;async function Pu(e,t,r,i,a=!1,s=It()){const o=e.append("foreignObject");o.attr("width",`${Math.min(10*r,il)}px`),o.attr("height",`${Math.min(10*r,il)}px`);const n=o.append("xhtml:div"),l=ai(t.label)?await Ul(t.label.replace(pi.lineBreakRegex,`
`),s):de(t.label,s),c=t.isNode?"nodeLabel":"edgeLabel",h=n.append("span");h.html(l),qs(h,t.labelStyle),h.attr("class",`${c} ${i}`),qs(n,t.labelStyle),n.style("display","table-cell"),n.style("white-space","nowrap"),n.style("line-height","1.5"),r!==Number.POSITIVE_INFINITY&&(n.style("max-width",r+"px"),n.style("text-align","center")),n.attr("xmlns","http://www.w3.org/1999/xhtml"),a&&n.attr("class","labelBkg");let u=n.node().getBoundingClientRect();return u.width===r&&(n.style("display","table"),n.style("white-space","break-spaces"),n.style("width",r+"px"),u=n.node().getBoundingClientRect()),o.node()}p(Pu,"addHtmlSpan");function Ea(e,t,r,i=!1){const a=e.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",t*r-.1+"em").attr("dy",r+"em");return i&&a.attr("text-anchor","middle"),a}p(Ea,"createTspan");function Nu(e,t,r){const i=e.append("text"),a=Ea(i,1,t);$a(a,r);const s=a.node().getComputedTextLength();return i.remove(),s}p(Nu,"computeWidthOfText");function Ox(e,t,r){var o;const i=e.append("text"),a=Ea(i,1,t);$a(a,[{content:r,type:"normal"}]);const s=(o=a.node())==null?void 0:o.getBoundingClientRect();return s&&i.remove(),s}p(Ox,"computeDimensionOfText");function zu(e,t,r,i=!1,a=!1){const o=t.append("g"),n=o.insert("rect").attr("class","background").attr("style","stroke: none"),l=o.append("text").attr("y","-10.1");a&&l.attr("text-anchor","middle");let c=0;for(const h of r){const u=p(d=>Nu(o,1.1,d){const a=e.append("tspan").attr("font-style",r.type==="em"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",r.type==="strong"?"bold":"normal");i===0?a.text(r.content):a.text(" "+r.content)})}p($a,"updateTextContentAndStyles");async function Wu(e,t={}){const r=[];e.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(a,s,o)=>(r.push((async()=>{const n=`${s}:${o}`;return await Dx(n)?await yi(n,void 0,{class:"label-icon"}):``})()),a));const i=await Promise.all(r);return e.replace(/(fa[bklrs]?):fa-([\w-]+)/g,()=>i.shift()??"")}p(Wu,"replaceIconSubstring");var Me=p(async(e,t="",{style:r="",isTitle:i=!1,classes:a="",useHtmlLabels:s=!0,markdown:o=!0,isNode:n=!0,width:l=200,addSvgBackground:c=!1}={},h)=>{if(D.debug("XYZ createText",t,r,i,a,s,n,"addSvgBackground: ",c),s){const u=o?Du(t,h):Fu(t),f=await Wu(Mr(u),h),d=t.replace(/\\\\/g,"\\"),g={isNode:n,label:ai(t)?d:f,labelStyle:r.replace("fill:","color:")};return await Pu(e,g,l,a,c,h)}else{const u=t.replace(/
/g,"
"),f=o?$u(u.replace("
","
"),h):Eu(u),d=zu(l,e,f,t?c:!1,!n);if(n){/stroke:/.exec(r)&&(r=r.replace("stroke:","lineColor:"));const g=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");ot(d).attr("style",g)}else{const g=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");ot(d).select("rect").attr("style",g.replace(/background:/g,"fill:"));const m=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");ot(d).select("text").attr("style",m)}return i?ot(d).selectAll("tspan.text-outer-tspan").classed("title-row",!0):ot(d).selectAll("tspan.text-outer-tspan").classed("row",!0),d}},"createText");function is(e,t,r){if(e&&e.length){const[i,a]=t,s=Math.PI/180*r,o=Math.cos(s),n=Math.sin(s);for(const l of e){const[c,h]=l;l[0]=(c-i)*o-(h-a)*n+i,l[1]=(c-i)*n+(h-a)*o+a}}}function Rx(e,t){return e[0]===t[0]&&e[1]===t[1]}function Ix(e,t,r,i=1){const a=r,s=Math.max(t,.1),o=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,n=[0,0];if(a)for(const c of o)is(c,n,a);const l=(function(c,h,u){const f=[];for(const b of c){const k=[...b];Rx(k[0],k[k.length-1])||k.push([k[0][0],k[0][1]]),k.length>2&&f.push(k)}const d=[];h=Math.max(h,.1);const g=[];for(const b of f)for(let k=0;kb.ymink.ymin?1:b.xk.x?1:b.ymax===k.ymax?0:(b.ymax-k.ymax)/Math.abs(b.ymax-k.ymax))),!g.length)return d;let m=[],y=g[0].ymin,x=0;for(;m.length||g.length;){if(g.length){let b=-1;for(let k=0;ky);k++)b=k;g.splice(0,b+1).forEach((k=>{m.push({s:y,edge:k})}))}if(m=m.filter((b=>!(b.edge.ymaxb.edge.x===k.edge.x?0:(b.edge.x-k.edge.x)/Math.abs(b.edge.x-k.edge.x))),(u!==1||x%h==0)&&m.length>1)for(let b=0;b=m.length)break;const v=m[b].edge,S=m[k].edge;d.push([[Math.round(v.x),y],[Math.round(S.x),y]])}y+=u,m.forEach((b=>{b.edge.x=b.edge.x+u*b.edge.islope})),x++}return d})(o,s,i);if(a){for(const c of o)is(c,n,-a);(function(c,h,u){const f=[];c.forEach((d=>f.push(...d))),is(f,h,u)})(l,n,-a)}return l}function xi(e,t){var r;const i=t.hachureAngle+90;let a=t.hachureGap;a=1&&(((r=t.randomizer)===null||r===void 0?void 0:r.next())||Math.random())>.7&&(s=a),Ix(e,a,i,s||1)}class Nn{constructor(t){this.helper=t}fillPolygons(t,r){return this._fillPolygons(t,r)}_fillPolygons(t,r){const i=xi(t,r);return{type:"fillSketch",ops:this.renderLines(i,r)}}renderLines(t,r){const i=[];for(const a of t)i.push(...this.helper.doubleLineOps(a[0][0],a[0][1],a[1][0],a[1][1],r));return i}}function Fa(e){const t=e[0],r=e[1];return Math.sqrt(Math.pow(t[0]-r[0],2)+Math.pow(t[1]-r[1],2))}class Px extends Nn{fillPolygons(t,r){let i=r.hachureGap;i{const n=Fa(o),l=Math.floor(n/(i+a)),c=(n+a-l*(i+a))/2;let h=o[0],u=o[1];h[0]>u[0]&&(h=o[1],u=o[0]);const f=Math.atan((u[1]-h[1])/(u[0]-h[0]));for(let d=0;d{const o=Fa(s),n=Math.round(o/(2*r));let l=s[0],c=s[1];l[0]>c[0]&&(l=s[1],c=s[0]);const h=Math.atan((c[1]-l[1])/(c[0]-l[0]));for(let u=0;uh%2?c+r:c+t));s.push({key:"C",data:l}),t=l[4],r=l[5];break}case"Q":s.push({key:"Q",data:[...n]}),t=n[2],r=n[3];break;case"q":{const l=n.map(((c,h)=>h%2?c+r:c+t));s.push({key:"Q",data:l}),t=l[2],r=l[3];break}case"A":s.push({key:"A",data:[...n]}),t=n[5],r=n[6];break;case"a":t+=n[5],r+=n[6],s.push({key:"A",data:[n[0],n[1],n[2],n[3],n[4],t,r]});break;case"H":s.push({key:"H",data:[...n]}),t=n[0];break;case"h":t+=n[0],s.push({key:"H",data:[t]});break;case"V":s.push({key:"V",data:[...n]}),r=n[0];break;case"v":r+=n[0],s.push({key:"V",data:[r]});break;case"S":s.push({key:"S",data:[...n]}),t=n[2],r=n[3];break;case"s":{const l=n.map(((c,h)=>h%2?c+r:c+t));s.push({key:"S",data:l}),t=l[2],r=l[3];break}case"T":s.push({key:"T",data:[...n]}),t=n[0],r=n[1];break;case"t":t+=n[0],r+=n[1],s.push({key:"T",data:[t,r]});break;case"Z":case"z":s.push({key:"Z",data:[]}),t=i,r=a}return s}function Hu(e){const t=[];let r="",i=0,a=0,s=0,o=0,n=0,l=0;for(const{key:c,data:h}of e){switch(c){case"M":t.push({key:"M",data:[...h]}),[i,a]=h,[s,o]=h;break;case"C":t.push({key:"C",data:[...h]}),i=h[4],a=h[5],n=h[2],l=h[3];break;case"L":t.push({key:"L",data:[...h]}),[i,a]=h;break;case"H":i=h[0],t.push({key:"L",data:[i,a]});break;case"V":a=h[0],t.push({key:"L",data:[i,a]});break;case"S":{let u=0,f=0;r==="C"||r==="S"?(u=i+(i-n),f=a+(a-l)):(u=i,f=a),t.push({key:"C",data:[u,f,...h]}),n=h[0],l=h[1],i=h[2],a=h[3];break}case"T":{const[u,f]=h;let d=0,g=0;r==="Q"||r==="T"?(d=i+(i-n),g=a+(a-l)):(d=i,g=a);const m=i+2*(d-i)/3,y=a+2*(g-a)/3,x=u+2*(d-u)/3,b=f+2*(g-f)/3;t.push({key:"C",data:[m,y,x,b,u,f]}),n=d,l=g,i=u,a=f;break}case"Q":{const[u,f,d,g]=h,m=i+2*(u-i)/3,y=a+2*(f-a)/3,x=d+2*(u-d)/3,b=g+2*(f-g)/3;t.push({key:"C",data:[m,y,x,b,d,g]}),n=u,l=f,i=d,a=g;break}case"A":{const u=Math.abs(h[0]),f=Math.abs(h[1]),d=h[2],g=h[3],m=h[4],y=h[5],x=h[6];u===0||f===0?(t.push({key:"C",data:[i,a,y,x,y,x]}),i=y,a=x):(i!==y||a!==x)&&(ju(i,a,y,x,u,f,d,g,m).forEach((function(b){t.push({key:"C",data:b})})),i=y,a=x);break}case"Z":t.push({key:"Z",data:[]}),i=s,a=o}r=c}return t}function jr(e,t,r){return[e*Math.cos(r)-t*Math.sin(r),e*Math.sin(r)+t*Math.cos(r)]}function ju(e,t,r,i,a,s,o,n,l,c){const h=(u=o,Math.PI*u/180);var u;let f=[],d=0,g=0,m=0,y=0;if(c)[d,g,m,y]=c;else{[e,t]=jr(e,t,-h),[r,i]=jr(r,i,-h);const O=(e-r)/2,A=(t-i)/2;let M=O*O/(a*a)+A*A/(s*s);M>1&&(M=Math.sqrt(M),a*=M,s*=M);const L=a*a,E=s*s,B=L*E-L*A*A-E*O*O,W=L*A*A+E*O*O,Y=(n===l?-1:1)*Math.sqrt(Math.abs(B/W));m=Y*a*A/s+(e+r)/2,y=Y*-s*O/a+(t+i)/2,d=Math.asin(parseFloat(((t-y)/s).toFixed(9))),g=Math.asin(parseFloat(((i-y)/s).toFixed(9))),eg&&(d-=2*Math.PI),!l&&g>d&&(g-=2*Math.PI)}let x=g-d;if(Math.abs(x)>120*Math.PI/180){const O=g,A=r,M=i;g=l&&g>d?d+120*Math.PI/180*1:d+120*Math.PI/180*-1,f=ju(r=m+a*Math.cos(g),i=y+s*Math.sin(g),A,M,a,s,o,0,l,[g,O,m,y])}x=g-d;const b=Math.cos(d),k=Math.sin(d),v=Math.cos(g),S=Math.sin(g),C=Math.tan(x/4),T=4/3*a*C,F=4/3*s*C,P=[e,t],R=[e+T*k,t-F*b],$=[r+T*S,i-F*v],z=[r,i];if(R[0]=2*P[0]-R[0],R[1]=2*P[1]-R[1],c)return[R,$,z].concat(f);{f=[R,$,z].concat(f);const O=[];for(let A=0;A2){const a=[];for(let s=0;s2*Math.PI&&(d=0,g=2*Math.PI);const m=2*Math.PI/l.curveStepCount,y=Math.min(m/2,(g-d)/2),x=hl(y,c,h,u,f,d,g,1,l);if(!l.disableMultiStroke){const b=hl(y,c,h,u,f,d,g,1.5,l);x.push(...b)}return o&&(n?x.push(...Ne(c,h,c+u*Math.cos(d),h+f*Math.sin(d),l),...Ne(c,h,c+u*Math.cos(g),h+f*Math.sin(g),l)):x.push({op:"lineTo",data:[c,h]},{op:"lineTo",data:[c+u*Math.cos(d),h+f*Math.sin(d)]})),{type:"path",ops:x}}function ol(e,t){const r=Hu(qu(zn(e))),i=[];let a=[0,0],s=[0,0];for(const{key:o,data:n}of r)switch(o){case"M":s=[n[0],n[1]],a=[n[0],n[1]];break;case"L":i.push(...Ne(s[0],s[1],n[0],n[1],t)),s=[n[0],n[1]];break;case"C":{const[l,c,h,u,f,d]=n;i.push(...Gx(l,c,h,u,f,d,s,t)),s=[f,d];break}case"Z":i.push(...Ne(s[0],s[1],a[0],a[1],t)),s=[a[0],a[1]]}return{type:"path",ops:i}}function ns(e,t){const r=[];for(const i of e)if(i.length){const a=t.maxRandomnessOffset||0,s=i.length;if(s>2){r.push({op:"move",data:[i[0][0]+rt(a,t),i[0][1]+rt(a,t)]});for(let o=1;o500?.4:-.0016668*l+1.233334;let h=a.maxRandomnessOffset||0;h*h*100>n&&(h=l/10);const u=h/2,f=.2+.2*Gu(a);let d=a.bowing*a.maxRandomnessOffset*(i-t)/200,g=a.bowing*a.maxRandomnessOffset*(e-r)/200;d=rt(d,a,c),g=rt(g,a,c);const m=[],y=()=>rt(u,a,c),x=()=>rt(h,a,c),b=a.preserveVertices;return o?m.push({op:"move",data:[e+(b?0:y()),t+(b?0:y())]}):m.push({op:"move",data:[e+(b?0:rt(h,a,c)),t+(b?0:rt(h,a,c))]}),o?m.push({op:"bcurveTo",data:[d+e+(r-e)*f+y(),g+t+(i-t)*f+y(),d+e+2*(r-e)*f+y(),g+t+2*(i-t)*f+y(),r+(b?0:y()),i+(b?0:y())]}):m.push({op:"bcurveTo",data:[d+e+(r-e)*f+x(),g+t+(i-t)*f+x(),d+e+2*(r-e)*f+x(),g+t+2*(i-t)*f+x(),r+(b?0:x()),i+(b?0:x())]}),m}function $i(e,t,r){if(!e.length)return[];const i=[];i.push([e[0][0]+rt(t,r),e[0][1]+rt(t,r)]),i.push([e[0][0]+rt(t,r),e[0][1]+rt(t,r)]);for(let a=1;a3){const s=[],o=1-r.curveTightness;a.push({op:"move",data:[e[1][0],e[1][1]]});for(let n=1;n+21&&a.push(n)):a.push(n),a.push(e[t+3])}else{const l=e[t+0],c=e[t+1],h=e[t+2],u=e[t+3],f=Ge(l,c,.5),d=Ge(c,h,.5),g=Ge(h,u,.5),m=Ge(f,d,.5),y=Ge(d,g,.5),x=Ge(m,y,.5);Ys([l,f,m,x],0,r,a),Ys([x,y,g,u],0,r,a)}var s,o;return a}function Xx(e,t){return ga(e,0,e.length,t)}function ga(e,t,r,i,a){const s=a||[],o=e[t],n=e[r-1];let l=0,c=1;for(let h=t+1;hl&&(l=u,c=h)}return Math.sqrt(l)>i?(ga(e,t,c+1,i,s),ga(e,c,r,i,s)):(s.length||s.push(o),s.push(n)),s}function os(e,t=.15,r){const i=[],a=(e.length-1)/3;for(let s=0;s0?ga(i,0,i.length,r):i}const Qt="none";class ma{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,r,i){return{shape:t,sets:r||[],options:i||this.defaultOptions}}line(t,r,i,a,s){const o=this._o(s);return this._d("line",[Yu(t,r,i,a,o)],o)}rectangle(t,r,i,a,s){const o=this._o(s),n=[],l=Ux(t,r,i,a,o);if(o.fill){const c=[[t,r],[t+i,r],[t+i,r+a],[t,r+a]];o.fillStyle==="solid"?n.push(ns([c],o)):n.push(hr([c],o))}return o.stroke!==Qt&&n.push(l),this._d("rectangle",n,o)}ellipse(t,r,i,a,s){const o=this._o(s),n=[],l=Uu(i,a,o),c=Hs(t,r,o,l);if(o.fill)if(o.fillStyle==="solid"){const h=Hs(t,r,o,l).opset;h.type="fillPath",n.push(h)}else n.push(hr([c.estimatedPoints],o));return o.stroke!==Qt&&n.push(c.opset),this._d("ellipse",n,o)}circle(t,r,i,a){const s=this.ellipse(t,r,i,i,a);return s.shape="circle",s}linearPath(t,r){const i=this._o(r);return this._d("linearPath",[Hi(t,!1,i)],i)}arc(t,r,i,a,s,o,n=!1,l){const c=this._o(l),h=[],u=nl(t,r,i,a,s,o,n,!0,c);if(n&&c.fill)if(c.fillStyle==="solid"){const f=Object.assign({},c);f.disableMultiStroke=!0;const d=nl(t,r,i,a,s,o,!0,!1,f);d.type="fillPath",h.push(d)}else h.push((function(f,d,g,m,y,x,b){const k=f,v=d;let S=Math.abs(g/2),C=Math.abs(m/2);S+=rt(.01*S,b),C+=rt(.01*C,b);let T=y,F=x;for(;T2*Math.PI&&(T=0,F=2*Math.PI);const P=(F-T)/b.curveStepCount,R=[];for(let $=T;${x.length>=4&&m.push(...os(x,u)),x=[]},k=()=>{b(),m.length&&(g.push(m),m=[])};for(const{key:S,data:C}of d)switch(S){case"M":k(),y=[C[0],C[1]],m.push(y);break;case"L":b(),m.push([C[0],C[1]]);break;case"C":if(!x.length){const T=m.length?m[m.length-1]:y;x.push([T[0],T[1]])}x.push([C[0],C[1]]),x.push([C[2],C[3]]),x.push([C[4],C[5]]);break;case"Z":b(),m.push([y[0],y[1]])}if(k(),!f)return g;const v=[];for(const S of g){const C=Xx(S,f);C.length&&v.push(C)}return v})(t,1,n?4-4*(i.simplification||1):(1+i.roughness)/2),c=ol(t,i);if(s)if(i.fillStyle==="solid")if(l.length===1){const h=ol(t,Object.assign(Object.assign({},i),{disableMultiStroke:!0,roughness:i.roughness?i.roughness+i.fillShapeRoughnessGain:0}));a.push({type:"fillPath",ops:this._mergedShape(h.ops)})}else a.push(ns(l,i));else a.push(hr(l,i));return o&&(n?l.forEach((h=>{a.push(Hi(h,!1,i))})):a.push(c)),this._d("path",a,i)}opsToPath(t,r){let i="";for(const a of t.ops){const s=typeof r=="number"&&r>=0?a.data.map((o=>+o.toFixed(r))):a.data;switch(a.op){case"move":i+=`M${s[0]} ${s[1]} `;break;case"bcurveTo":i+=`C${s[0]} ${s[1]}, ${s[2]} ${s[3]}, ${s[4]} ${s[5]} `;break;case"lineTo":i+=`L${s[0]} ${s[1]} `}}return i.trim()}toPaths(t){const r=t.sets||[],i=t.options||this.defaultOptions,a=[];for(const s of r){let o=null;switch(s.type){case"path":o={d:this.opsToPath(s),stroke:i.stroke,strokeWidth:i.strokeWidth,fill:Qt};break;case"fillPath":o={d:this.opsToPath(s),stroke:Qt,strokeWidth:0,fill:i.fill||Qt};break;case"fillSketch":o=this.fillSketch(s,i)}o&&a.push(o)}return a}fillSketch(t,r){let i=r.fillWeight;return ii===0||r.op!=="move"))}}class Zx{constructor(t,r){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new ma(r)}draw(t){const r=t.sets||[],i=t.options||this.getDefaultOptions(),a=this.ctx,s=t.options.fixedDecimalPlaceDigits;for(const o of r)switch(o.type){case"path":a.save(),a.strokeStyle=i.stroke==="none"?"transparent":i.stroke,a.lineWidth=i.strokeWidth,i.strokeLineDash&&a.setLineDash(i.strokeLineDash),i.strokeLineDashOffset&&(a.lineDashOffset=i.strokeLineDashOffset),this._drawToContext(a,o,s),a.restore();break;case"fillPath":{a.save(),a.fillStyle=i.fill||"";const n=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(a,o,s,n),a.restore();break}case"fillSketch":this.fillSketch(a,o,i)}}fillSketch(t,r,i){let a=i.fillWeight;a=0?s.data.map((n=>+n.toFixed(i))):s.data;switch(s.op){case"move":t.moveTo(o[0],o[1]);break;case"bcurveTo":t.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5]);break;case"lineTo":t.lineTo(o[0],o[1])}}r.type==="fillPath"?t.fill(a):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,r,i,a,s){const o=this.gen.line(t,r,i,a,s);return this.draw(o),o}rectangle(t,r,i,a,s){const o=this.gen.rectangle(t,r,i,a,s);return this.draw(o),o}ellipse(t,r,i,a,s){const o=this.gen.ellipse(t,r,i,a,s);return this.draw(o),o}circle(t,r,i,a){const s=this.gen.circle(t,r,i,a);return this.draw(s),s}linearPath(t,r){const i=this.gen.linearPath(t,r);return this.draw(i),i}polygon(t,r){const i=this.gen.polygon(t,r);return this.draw(i),i}arc(t,r,i,a,s,o,n=!1,l){const c=this.gen.arc(t,r,i,a,s,o,n,l);return this.draw(c),c}curve(t,r){const i=this.gen.curve(t,r);return this.draw(i),i}path(t,r){const i=this.gen.path(t,r);return this.draw(i),i}}const Fi="http://www.w3.org/2000/svg";class Kx{constructor(t,r){this.svg=t,this.gen=new ma(r)}draw(t){const r=t.sets||[],i=t.options||this.getDefaultOptions(),a=this.svg.ownerDocument||window.document,s=a.createElementNS(Fi,"g"),o=t.options.fixedDecimalPlaceDigits;for(const n of r){let l=null;switch(n.type){case"path":l=a.createElementNS(Fi,"path"),l.setAttribute("d",this.opsToPath(n,o)),l.setAttribute("stroke",i.stroke),l.setAttribute("stroke-width",i.strokeWidth+""),l.setAttribute("fill","none"),i.strokeLineDash&&l.setAttribute("stroke-dasharray",i.strokeLineDash.join(" ").trim()),i.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${i.strokeLineDashOffset}`);break;case"fillPath":l=a.createElementNS(Fi,"path"),l.setAttribute("d",this.opsToPath(n,o)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",i.fill||""),t.shape!=="curve"&&t.shape!=="polygon"||l.setAttribute("fill-rule","evenodd");break;case"fillSketch":l=this.fillSketch(a,n,i)}l&&s.appendChild(l)}return s}fillSketch(t,r,i){let a=i.fillWeight;anew Zx(e,t),svg:(e,t)=>new Kx(e,t),generator:e=>new ma(e),newSeed:()=>ma.newSeed()},et=p(async(e,t,r)=>{var d,g;let i;const a=t.useHtmlLabels||We((d=pt())==null?void 0:d.htmlLabels);r?i=r:i="node default";const s=e.insert("g").attr("class",i).attr("id",t.domId||t.id),o=s.insert("g").attr("class","label").attr("style",Nt(t.labelStyle));let n;t.label===void 0?n="":n=typeof t.label=="string"?t.label:t.label[0];const l=!!t.icon||!!t.img,c=t.labelType==="markdown",h=await Me(o,de(Mr(n),pt()),{useHtmlLabels:a,width:t.width||((g=pt().flowchart)==null?void 0:g.wrappingWidth),cssClasses:c?"markdown-node-label":void 0,style:t.labelStyle,addSvgBackground:l,markdown:c},pt());let u=h.getBBox();const f=((t==null?void 0:t.padding)??0)/2;if(a){const m=h.children[0],y=ot(h);await fu(m,n),u=m.getBoundingClientRect(),y.attr("width",u.width),y.attr("height",u.height)}return a?o.attr("transform","translate("+-u.width/2+", "+-u.height/2+")"):o.attr("transform","translate(0, "+-u.height/2+")"),t.centerLabel&&o.attr("transform","translate("+-u.width/2+", "+-u.height/2+")"),o.insert("rect",":first-child"),{shapeSvg:s,bbox:u,halfPadding:f,label:o}},"labelHelper"),ls=p(async(e,t,r)=>{var l,c;const i=r.useHtmlLabels??zt(pt()),a=e.insert("g").attr("class","label").attr("style",r.labelStyle||""),s=await Me(a,de(Mr(t),pt()),{useHtmlLabels:i,width:r.width||((c=(l=pt())==null?void 0:l.flowchart)==null?void 0:c.wrappingWidth),style:r.labelStyle,addSvgBackground:!!r.icon||!!r.img});let o=s.getBBox();const n=r.padding/2;if(zt(pt())){const h=s.children[0],u=ot(s);o=h.getBoundingClientRect(),u.attr("width",o.width),u.attr("height",o.height)}return i?a.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"):a.attr("transform","translate(0, "+-o.height/2+")"),r.centerLabel&&a.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"),a.insert("rect",":first-child"),{shapeSvg:e,bbox:o,halfPadding:n,label:a}},"insertLabel"),Z=p((e,t)=>{const r=t.node().getBBox();e.width=r.width,e.height=r.height},"updateNodeBounds"),tt=p((e,t)=>(e.look==="handDrawn"?"rough-node":"node")+" "+e.cssClasses+" "+(t||""),"getNodeClasses");function ht(e){const t=e.map((r,i)=>`${i===0?"M":"L"}${r.x},${r.y}`);return t.push("Z"),t.join(" ")}p(ht,"createPathFromPoints");function ze(e,t,r,i,a,s){const o=[],l=r-e,c=i-t,h=l/s,u=2*Math.PI/h,f=t+c/2;for(let d=0;d{var r=e.x,i=e.y,a=t.x-r,s=t.y-i,o=e.width/2,n=e.height/2,l,c;return Math.abs(s)*o>Math.abs(a)*n?(s{let s=t||"";typeof s=="object"&&(s=s[0]);const o=pt(),n=zt(o);return await Me(e,s,{style:r,isTitle:i,useHtmlLabels:n,markdown:!1,isNode:a,width:Number.POSITIVE_INFINITY},o)},"createLabel"),De=Jx,qe=p((e,t,r,i,a)=>["M",e+a,t,"H",e+r-a,"A",a,a,0,0,1,e+r,t+a,"V",t+i-a,"A",a,a,0,0,1,e+r-a,t+i,"H",e+a,"A",a,a,0,0,1,e,t+i-a,"V",t+a,"A",a,a,0,0,1,e+a,t,"Z"].join(" "),"createRoundedRectPathD"),Vu=p(async(e,t)=>{D.info("Creating subgraph rect for ",t.id,t);const r=pt(),{themeVariables:i,handDrawnSeed:a}=r,{clusterBkg:s,clusterBorder:o}=i,{labelStyles:n,nodeStyles:l,borderStyles:c,backgroundStyles:h}=V(t),u=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=zt(r),d=u.insert("g").attr("class","cluster-label ");let g;t.labelType==="markdown"?g=await Me(d,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0,width:t.width}):g=await De(d,t.label,t.labelStyle||"",!1,!0);let m=g.getBBox();if(zt(r)){const T=g.children[0],F=ot(g);m=T.getBoundingClientRect(),F.attr("width",m.width),F.attr("height",m.height)}const y=t.width(D.debug("Rough node insert CXC",P),P),":first-child"),v.select("path:nth-child(2)").attr("style",c.join(";")),v.select("path").attr("style",h.join(";").replace("fill","stroke"))}else v=u.insert("rect",":first-child"),v.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",b).attr("y",k).attr("width",y).attr("height",x);const{subGraphTitleTopMargin:S}=Bn(r);if(d.attr("transform",`translate(${t.x-m.width/2}, ${t.y-t.height/2+S})`),n){const T=d.select("span");T&&T.attr("style",n)}const C=v.node().getBBox();return t.offsetX=0,t.width=C.width,t.height=C.height,t.offsetY=m.height-t.padding/2,t.intersect=function(T){return $r(t,T)},{cluster:u,labelBBox:m}},"rect"),tb=p((e,t)=>{const r=e.insert("g").attr("class","note-cluster").attr("id",t.id),i=r.insert("rect",":first-child"),a=0*t.padding,s=a/2;i.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-s).attr("y",t.y-t.height/2-s).attr("width",t.width+a).attr("height",t.height+a).attr("fill","none");const o=i.node().getBBox();return t.width=o.width,t.height=o.height,t.intersect=function(n){return $r(t,n)},{cluster:r,labelBBox:{width:0,height:0}}},"noteGroup"),eb=p(async(e,t)=>{const r=pt(),{themeVariables:i,handDrawnSeed:a}=r,{altBackground:s,compositeBackground:o,compositeTitleBackground:n,nodeBorder:l}=i,c=e.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-id",t.id).attr("data-look",t.look),h=c.insert("g",":first-child"),u=c.insert("g").attr("class","cluster-label");let f=c.append("rect");const d=await De(u,t.label,t.labelStyle,void 0,!0);let g=d.getBBox();if(zt(r)){const P=d.children[0],R=ot(d);g=P.getBoundingClientRect(),R.attr("width",g.width),R.attr("height",g.height)}const m=0*t.padding,y=m/2,x=(t.width$,":first-child");const z=R.rectangle(v,C,x,k,{fill:P?s:o,fillStyle:P?"hachure":"solid",stroke:l,seed:a});T=c.insert(()=>$,":first-child"),f=c.insert(()=>z)}else T=h.insert("rect",":first-child"),T.attr("class","outer").attr("x",v).attr("y",S).attr("width",x).attr("height",b).attr("data-look",t.look),f.attr("class","inner").attr("x",v).attr("y",C).attr("width",x).attr("height",k);u.attr("transform",`translate(${t.x-g.width/2}, ${S+1-(zt(r)?0:3)})`);const F=T.node().getBBox();return t.height=F.height,t.offsetX=0,t.offsetY=g.height-t.padding/2,t.labelBBox=g,t.intersect=function(P){return $r(t,P)},{cluster:c,labelBBox:g}},"roundedWithTitle"),rb=p(async(e,t)=>{D.info("Creating subgraph rect for ",t.id,t);const r=pt(),{themeVariables:i,handDrawnSeed:a}=r,{clusterBkg:s,clusterBorder:o}=i,{labelStyles:n,nodeStyles:l,borderStyles:c,backgroundStyles:h}=V(t),u=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=zt(r),d=u.insert("g").attr("class","cluster-label "),g=await Me(d,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0,width:t.width});let m=g.getBBox();if(zt(r)){const T=g.children[0],F=ot(g);m=T.getBoundingClientRect(),F.attr("width",m.width),F.attr("height",m.height)}const y=t.width(D.debug("Rough node insert CXC",P),P),":first-child"),v.select("path:nth-child(2)").attr("style",c.join(";")),v.select("path").attr("style",h.join(";").replace("fill","stroke"))}else v=u.insert("rect",":first-child"),v.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",b).attr("y",k).attr("width",y).attr("height",x);const{subGraphTitleTopMargin:S}=Bn(r);if(d.attr("transform",`translate(${t.x-m.width/2}, ${t.y-t.height/2+S})`),n){const T=d.select("span");T&&T.attr("style",n)}const C=v.node().getBBox();return t.offsetX=0,t.width=C.width,t.height=C.height,t.offsetY=m.height-t.padding/2,t.intersect=function(T){return $r(t,T)},{cluster:u,labelBBox:m}},"kanbanSection"),ib=p((e,t)=>{const r=pt(),{themeVariables:i,handDrawnSeed:a}=r,{nodeBorder:s}=i,o=e.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-look",t.look),n=o.insert("g",":first-child"),l=0*t.padding,c=t.width+l;t.diff=-t.padding;const h=t.height+l,u=t.x-c/2,f=t.y-h/2;t.width=c;let d;if(t.look==="handDrawn"){const y=U.svg(o).rectangle(u,f,c,h,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:s,seed:a});d=o.insert(()=>y,":first-child")}else d=n.insert("rect",":first-child"),d.attr("class","divider").attr("x",u).attr("y",f).attr("width",c).attr("height",h).attr("data-look",t.look);const g=d.node().getBBox();return t.height=g.height,t.offsetX=0,t.offsetY=0,t.intersect=function(m){return $r(t,m)},{cluster:o,labelBBox:{}}},"divider"),ab=Vu,sb={rect:Vu,squareRect:ab,roundedWithTitle:eb,noteGroup:tb,divider:ib,kanbanSection:rb},Xu=new Map,nb=p(async(e,t)=>{const r=t.shape||"rect",i=await sb[r](e,t);return Xu.set(t.id,i),i},"insertCluster"),Rk=p(()=>{Xu=new Map},"clear");function Zu(e,t){return e.intersect(t)}p(Zu,"intersectNode");var ob=Zu;function Ku(e,t,r,i){var a=e.x,s=e.y,o=a-i.x,n=s-i.y,l=Math.sqrt(t*t*n*n+r*r*o*o),c=Math.abs(t*r*o/l);i.x0}p(Us,"sameSign");var cb=td;function ed(e,t,r){let i=e.x,a=e.y,s=[],o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(h){o=Math.min(o,h.x),n=Math.min(n,h.y)}):(o=Math.min(o,t.x),n=Math.min(n,t.y));let l=i-e.width/2-o,c=a-e.height/2-n;for(let h=0;h1&&s.sort(function(h,u){let f=h.x-r.x,d=h.y-r.y,g=Math.sqrt(f*f+d*d),m=u.x-r.x,y=u.y-r.y,x=Math.sqrt(m*m+y*y);return gh,":first-child");return u.attr("class","anchor").attr("style",Nt(n)),Z(t,u),t.intersect=function(f){return D.info("Circle intersect",t,o,f),q.circle(t,o,f)},s}p(rd,"anchor");function Gs(e,t,r,i,a,s,o){const l=(e+r)/2,c=(t+i)/2,h=Math.atan2(i-t,r-e),u=(r-e)/2,f=(i-t)/2,d=u/a,g=f/s,m=Math.sqrt(d**2+g**2);if(m>1)throw new Error("The given radii are too small to create an arc between the points.");const y=Math.sqrt(1-m**2),x=l+y*s*Math.sin(h)*(o?-1:1),b=c-y*a*Math.cos(h)*(o?-1:1),k=Math.atan2((t-b)/s,(e-x)/a);let S=Math.atan2((i-b)/s,(r-x)/a)-k;o&&S0&&(S-=2*Math.PI);const C=[];for(let T=0;Tm,":first-child");return y.attr("class","basic label-container"),h&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",h),i&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",i),y.attr("transform",`translate(${c/2}, 0)`),Z(t,y),t.intersect=function(x){return q.polygon(t,u,x)},a}p(id,"bowTieRect");function Ee(e,t,r,i){return e.insert("polygon",":first-child").attr("points",i.map(function(a){return a.x+","+a.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+r/2+")")}p(Ee,"insertPolygonShape");async function ad(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s}=await et(e,t,tt(t)),o=s.height+t.padding,n=12,l=s.width+t.padding+n,c=0,h=l,u=-o,f=0,d=[{x:c+n,y:u},{x:h,y:u},{x:h,y:f},{x:c,y:f},{x:c,y:u+n},{x:c+n,y:u}];let g;const{cssStyles:m}=t;if(t.look==="handDrawn"){const y=U.svg(a),x=G(t,{}),b=ht(d),k=y.path(b,x);g=a.insert(()=>k,":first-child").attr("transform",`translate(${-l/2}, ${o/2})`),m&&g.attr("style",m)}else g=Ee(a,l,o,d);return i&&g.attr("style",i),Z(t,g),t.intersect=function(y){return q.polygon(t,d,y)},a}p(ad,"card");function sd(e,t){const{nodeStyles:r}=V(t);t.label="";const i=e.insert("g").attr("class",tt(t)).attr("id",t.domId??t.id),{cssStyles:a}=t,s=Math.max(28,t.width??0),o=[{x:0,y:s/2},{x:s/2,y:0},{x:0,y:-s/2},{x:-s/2,y:0}],n=U.svg(i),l=G(t,{});t.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const c=ht(o),h=n.path(c,l),u=i.insert(()=>h,":first-child");return a&&t.look!=="handDrawn"&&u.selectAll("path").attr("style",a),r&&t.look!=="handDrawn"&&u.selectAll("path").attr("style",r),t.width=28,t.height=28,t.intersect=function(f){return q.polygon(t,o,f)},i}p(sd,"choice");async function Wn(e,t,r){const{labelStyles:i,nodeStyles:a}=V(t);t.labelStyle=i;const{shapeSvg:s,bbox:o,halfPadding:n}=await et(e,t,tt(t)),l=(r==null?void 0:r.padding)??n,c=o.width/2+l;let h;const{cssStyles:u}=t;if(t.look==="handDrawn"){const f=U.svg(s),d=G(t,{}),g=f.circle(0,0,c*2,d);h=s.insert(()=>g,":first-child"),h.attr("class","basic label-container").attr("style",Nt(u))}else h=s.insert("circle",":first-child").attr("class","basic label-container").attr("style",a).attr("r",c).attr("cx",0).attr("cy",0);return Z(t,h),t.calcIntersect=function(f,d){const g=f.width/2;return q.circle(f,g,d)},t.intersect=function(f){return D.info("Circle intersect",t,c,f),q.circle(t,c,f)},s}p(Wn,"circle");function nd(e){const t=Math.cos(Math.PI/4),r=Math.sin(Math.PI/4),i=e*2,a={x:i/2*t,y:i/2*r},s={x:-(i/2)*t,y:i/2*r},o={x:-(i/2)*t,y:-(i/2)*r},n={x:i/2*t,y:-(i/2)*r};return`M ${s.x},${s.y} L ${n.x},${n.y}
M ${a.x},${a.y} L ${o.x},${o.y}`}p(nd,"createLine");function od(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r,t.label="";const a=e.insert("g").attr("class",tt(t)).attr("id",t.domId??t.id),s=Math.max(30,(t==null?void 0:t.width)??0),{cssStyles:o}=t,n=U.svg(a),l=G(t,{});t.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const c=n.circle(0,0,s*2,l),h=nd(s),u=n.path(h,l),f=a.insert(()=>c,":first-child");return f.insert(()=>u),o&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",o),i&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",i),Z(t,f),t.intersect=function(d){return D.info("crossedCircle intersect",t,{radius:s,point:d}),q.circle(t,s,d)},a}p(od,"crossedCircle");function ve(e,t,r,i=100,a=0,s=180){const o=[],n=a*Math.PI/180,h=(s*Math.PI/180-n)/(i-1);for(let u=0;uk,":first-child").attr("stroke-opacity",0),v.insert(()=>x,":first-child"),v.attr("class","text"),h&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",h),i&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",i),v.attr("transform",`translate(${c}, 0)`),o.attr("transform",`translate(${-n/2+c-(s.x-(s.left??0))},${-l/2+(t.padding??0)/2-(s.y-(s.top??0))})`),Z(t,v),t.intersect=function(S){return q.polygon(t,f,S)},a}p(ld,"curlyBraceLeft");function Te(e,t,r,i=100,a=0,s=180){const o=[],n=a*Math.PI/180,h=(s*Math.PI/180-n)/(i-1);for(let u=0;uk,":first-child").attr("stroke-opacity",0),v.insert(()=>x,":first-child"),v.attr("class","text"),h&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",h),i&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",i),v.attr("transform",`translate(${-c}, 0)`),o.attr("transform",`translate(${-n/2+(t.padding??0)/2-(s.x-(s.left??0))},${-l/2+(t.padding??0)/2-(s.y-(s.top??0))})`),Z(t,v),t.intersect=function(S){return q.polygon(t,f,S)},a}p(cd,"curlyBraceRight");function $t(e,t,r,i=100,a=0,s=180){const o=[],n=a*Math.PI/180,h=(s*Math.PI/180-n)/(i-1);for(let u=0;uT,":first-child").attr("stroke-opacity",0),F.insert(()=>b,":first-child"),F.insert(()=>S,":first-child"),F.attr("class","text"),h&&t.look!=="handDrawn"&&F.selectAll("path").attr("style",h),i&&t.look!=="handDrawn"&&F.selectAll("path").attr("style",i),F.attr("transform",`translate(${c-c/4}, 0)`),o.attr("transform",`translate(${-n/2+(t.padding??0)/2-(s.x-(s.left??0))},${-l/2+(t.padding??0)/2-(s.y-(s.top??0))})`),Z(t,F),t.intersect=function(P){return q.polygon(t,d,P)},a}p(hd,"curlyBraces");async function ud(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s}=await et(e,t,tt(t)),o=80,n=20,l=Math.max(o,(s.width+(t.padding??0)*2)*1.25,(t==null?void 0:t.width)??0),c=Math.max(n,s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),h=c/2,{cssStyles:u}=t,f=U.svg(a),d=G(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const g=l,m=c,y=g-h,x=m/4,b=[{x:y,y:0},{x,y:0},{x:0,y:m/2},{x,y:m},{x:y,y:m},...ci(-y,-m/2,h,50,270,90)],k=ht(b),v=f.path(k,d),S=a.insert(()=>v,":first-child");return S.attr("class","basic label-container"),u&&t.look!=="handDrawn"&&S.selectChildren("path").attr("style",u),i&&t.look!=="handDrawn"&&S.selectChildren("path").attr("style",i),S.attr("transform",`translate(${-l/2}, ${-c/2})`),Z(t,S),t.intersect=function(C){return q.polygon(t,b,C)},a}p(ud,"curvedTrapezoid");var ub=p((e,t,r,i,a,s)=>[`M${e},${t+s}`,`a${a},${s} 0,0,0 ${r},0`,`a${a},${s} 0,0,0 ${-r},0`,`l0,${i}`,`a${a},${s} 0,0,0 ${r},0`,`l0,${-i}`].join(" "),"createCylinderPathD"),db=p((e,t,r,i,a,s)=>[`M${e},${t+s}`,`M${e+r},${t+s}`,`a${a},${s} 0,0,0 ${-r},0`,`l0,${i}`,`a${a},${s} 0,0,0 ${r},0`,`l0,${-i}`].join(" "),"createOuterCylinderPathD"),fb=p((e,t,r,i,a,s)=>[`M${e-r/2},${-i/2}`,`a${a},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD");async function dd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s,label:o}=await et(e,t,tt(t)),n=Math.max(s.width+t.padding,t.width??0),l=n/2,c=l/(2.5+n/50),h=Math.max(s.height+c+t.padding,t.height??0);let u;const{cssStyles:f}=t;if(t.look==="handDrawn"){const d=U.svg(a),g=db(0,0,n,h,l,c),m=fb(0,c,n,h,l,c),y=d.path(g,G(t,{})),x=d.path(m,G(t,{fill:"none"}));u=a.insert(()=>x,":first-child"),u=a.insert(()=>y,":first-child"),u.attr("class","basic label-container"),f&&u.attr("style",f)}else{const d=ub(0,0,n,h,l,c);u=a.insert("path",":first-child").attr("d",d).attr("class","basic label-container").attr("style",Nt(f)).attr("style",i)}return u.attr("label-offset-y",c),u.attr("transform",`translate(${-n/2}, ${-(h/2+c)})`),Z(t,u),o.attr("transform",`translate(${-(s.width/2)-(s.x-(s.left??0))}, ${-(s.height/2)+(t.padding??0)/1.5-(s.y-(s.top??0))})`),t.intersect=function(d){const g=q.rect(t,d),m=g.x-(t.x??0);if(l!=0&&(Math.abs(m)(t.height??0)/2-c)){let y=c*c*(1-m*m/(l*l));y>0&&(y=Math.sqrt(y)),y=c-y,d.y-(t.y??0)>0&&(y=-y),g.y+=y}return g},a}p(dd,"cylinder");async function fd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s,label:o}=await et(e,t,tt(t)),n=s.width+t.padding,l=s.height+t.padding,c=l*.2,h=-n/2,u=-l/2-c/2,{cssStyles:f}=t,d=U.svg(a),g=G(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const m=[{x:h,y:u+c},{x:-h,y:u+c},{x:-h,y:-u},{x:h,y:-u},{x:h,y:u},{x:-h,y:u},{x:-h,y:u+c}],y=d.polygon(m.map(b=>[b.x,b.y]),g),x=a.insert(()=>y,":first-child");return x.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",f),i&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",i),o.attr("transform",`translate(${h+(t.padding??0)/2-(s.x-(s.left??0))}, ${u+c+(t.padding??0)/2-(s.y-(s.top??0))})`),Z(t,x),t.intersect=function(b){return q.rect(t,b)},a}p(fd,"dividedRectangle");async function pd(e,t){var f,d;const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s,halfPadding:o}=await et(e,t,tt(t)),l=s.width/2+o+5,c=s.width/2+o;let h;const{cssStyles:u}=t;if(t.look==="handDrawn"){const g=U.svg(a),m=G(t,{roughness:.2,strokeWidth:2.5}),y=G(t,{roughness:.2,strokeWidth:1.5}),x=g.circle(0,0,l*2,m),b=g.circle(0,0,c*2,y);h=a.insert("g",":first-child"),h.attr("class",Nt(t.cssClasses)).attr("style",Nt(u)),(f=h.node())==null||f.appendChild(x),(d=h.node())==null||d.appendChild(b)}else{h=a.insert("g",":first-child");const g=h.insert("circle",":first-child"),m=h.insert("circle");h.attr("class","basic label-container").attr("style",i),g.attr("class","outer-circle").attr("style",i).attr("r",l).attr("cx",0).attr("cy",0),m.attr("class","inner-circle").attr("style",i).attr("r",c).attr("cx",0).attr("cy",0)}return Z(t,h),t.intersect=function(g){return D.info("DoubleCircle intersect",t,l,g),q.circle(t,l,g)},a}p(pd,"doublecircle");function gd(e,t,{config:{themeVariables:r}}){const{labelStyles:i,nodeStyles:a}=V(t);t.label="",t.labelStyle=i;const s=e.insert("g").attr("class",tt(t)).attr("id",t.domId??t.id),o=7,{cssStyles:n}=t,l=U.svg(s),{nodeBorder:c}=r,h=G(t,{fillStyle:"solid"});t.look!=="handDrawn"&&(h.roughness=0);const u=l.circle(0,0,o*2,h),f=s.insert(()=>u,":first-child");return f.selectAll("path").attr("style",`fill: ${c} !important;`),n&&n.length>0&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",n),a&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",a),Z(t,f),t.intersect=function(d){return D.info("filledCircle intersect",t,{radius:o,point:d}),q.circle(t,o,d)},s}p(gd,"filledCircle");async function md(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s,label:o}=await et(e,t,tt(t)),n=s.width+(t.padding??0),l=n+s.height,c=n+s.height,h=[{x:0,y:-l},{x:c,y:-l},{x:c/2,y:0}],{cssStyles:u}=t,f=U.svg(a),d=G(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const g=ht(h),m=f.path(g,d),y=a.insert(()=>m,":first-child").attr("transform",`translate(${-l/2}, ${l/2})`);return u&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",u),i&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",i),t.width=n,t.height=l,Z(t,y),o.attr("transform",`translate(${-s.width/2-(s.x-(s.left??0))}, ${-l/2+(t.padding??0)/2+(s.y-(s.top??0))})`),t.intersect=function(x){return D.info("Triangle intersect",t,h,x),q.polygon(t,h,x)},a}p(md,"flippedTriangle");function yd(e,t,{dir:r,config:{state:i,themeVariables:a}}){const{nodeStyles:s}=V(t);t.label="";const o=e.insert("g").attr("class",tt(t)).attr("id",t.domId??t.id),{cssStyles:n}=t;let l=Math.max(70,(t==null?void 0:t.width)??0),c=Math.max(10,(t==null?void 0:t.height)??0);r==="LR"&&(l=Math.max(10,(t==null?void 0:t.width)??0),c=Math.max(70,(t==null?void 0:t.height)??0));const h=-1*l/2,u=-1*c/2,f=U.svg(o),d=G(t,{stroke:a.lineColor,fill:a.lineColor});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const g=f.rectangle(h,u,l,c,d),m=o.insert(()=>g,":first-child");n&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",n),s&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",s),Z(t,m);const y=(i==null?void 0:i.padding)??0;return t.width&&t.height&&(t.width+=y/2||0,t.height+=y/2||0),t.intersect=function(x){return q.rect(t,x)},o}p(yd,"forkJoin");async function xd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const a=80,s=50,{shapeSvg:o,bbox:n}=await et(e,t,tt(t)),l=Math.max(a,n.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),c=Math.max(s,n.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),h=c/2,{cssStyles:u}=t,f=U.svg(o),d=G(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const g=[{x:-l/2,y:-c/2},{x:l/2-h,y:-c/2},...ci(-l/2+h,0,h,50,90,270),{x:l/2-h,y:c/2},{x:-l/2,y:c/2}],m=ht(g),y=f.path(m,d),x=o.insert(()=>y,":first-child");return x.attr("class","basic label-container"),u&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",u),i&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",i),Z(t,x),t.intersect=function(b){return D.info("Pill intersect",t,{radius:h,point:b}),q.polygon(t,g,b)},o}p(xd,"halfRoundedRectangle");var pb=p((e,t,r,i,a)=>[`M${e+a},${t}`,`L${e+r-a},${t}`,`L${e+r},${t-i/2}`,`L${e+r-a},${t-i}`,`L${e+a},${t-i}`,`L${e},${t-i/2}`,"Z"].join(" "),"createHexagonPathD");async function bd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s}=await et(e,t,tt(t)),o=4,n=s.height+t.padding,l=n/o,c=s.width+2*l+t.padding,h=[{x:l,y:0},{x:c-l,y:0},{x:c,y:-n/2},{x:c-l,y:-n},{x:l,y:-n},{x:0,y:-n/2}];let u;const{cssStyles:f}=t;if(t.look==="handDrawn"){const d=U.svg(a),g=G(t,{}),m=pb(0,0,c,n,l),y=d.path(m,g);u=a.insert(()=>y,":first-child").attr("transform",`translate(${-c/2}, ${n/2})`),f&&u.attr("style",f)}else u=Ee(a,c,n,h);return i&&u.attr("style",i),t.width=c,t.height=n,Z(t,u),t.intersect=function(d){return q.polygon(t,h,d)},a}p(bd,"hexagon");async function Cd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.label="",t.labelStyle=r;const{shapeSvg:a}=await et(e,t,tt(t)),s=Math.max(30,(t==null?void 0:t.width)??0),o=Math.max(30,(t==null?void 0:t.height)??0),{cssStyles:n}=t,l=U.svg(a),c=G(t,{});t.look!=="handDrawn"&&(c.roughness=0,c.fillStyle="solid");const h=[{x:0,y:0},{x:s,y:0},{x:0,y:o},{x:s,y:o}],u=ht(h),f=l.path(u,c),d=a.insert(()=>f,":first-child");return d.attr("class","basic label-container"),n&&t.look!=="handDrawn"&&d.selectChildren("path").attr("style",n),i&&t.look!=="handDrawn"&&d.selectChildren("path").attr("style",i),d.attr("transform",`translate(${-s/2}, ${-o/2})`),Z(t,d),t.intersect=function(g){return D.info("Pill intersect",t,{points:h}),q.polygon(t,h,g)},a}p(Cd,"hourglass");async function kd(e,t,{config:{themeVariables:r,flowchart:i}}){const{labelStyles:a}=V(t);t.labelStyle=a;const s=t.assetHeight??48,o=t.assetWidth??48,n=Math.max(s,o),l=i==null?void 0:i.wrappingWidth;t.width=Math.max(n,l??0);const{shapeSvg:c,bbox:h,label:u}=await et(e,t,"icon-shape default"),f=t.pos==="t",d=n,g=n,{nodeBorder:m}=r,{stylesMap:y}=Er(t),x=-g/2,b=-d/2,k=t.label?8:0,v=U.svg(c),S=G(t,{stroke:"none",fill:"none"});t.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");const C=v.rectangle(x,b,g,d,S),T=Math.max(g,h.width),F=d+h.height+k,P=v.rectangle(-T/2,-F/2,T,F,{...S,fill:"transparent",stroke:"none"}),R=c.insert(()=>C,":first-child"),$=c.insert(()=>P);if(t.icon){const z=c.append("g");z.html(`${await yi(t.icon,{height:n,width:n,fallbackPrefix:""})}`);const O=z.node().getBBox(),A=O.width,M=O.height,L=O.x,E=O.y;z.attr("transform",`translate(${-A/2-L},${f?h.height/2+k/2-M/2-E:-h.height/2-k/2-M/2-E})`),z.attr("style",`color: ${y.get("stroke")??m};`)}return u.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${f?-F/2:F/2-h.height})`),R.attr("transform",`translate(0,${f?h.height/2+k/2:-h.height/2-k/2})`),Z(t,$),t.intersect=function(z){if(D.info("iconSquare intersect",t,z),!t.label)return q.rect(t,z);const O=t.x??0,A=t.y??0,M=t.height??0;let L=[];return f?L=[{x:O-h.width/2,y:A-M/2},{x:O+h.width/2,y:A-M/2},{x:O+h.width/2,y:A-M/2+h.height+k},{x:O+g/2,y:A-M/2+h.height+k},{x:O+g/2,y:A+M/2},{x:O-g/2,y:A+M/2},{x:O-g/2,y:A-M/2+h.height+k},{x:O-h.width/2,y:A-M/2+h.height+k}]:L=[{x:O-g/2,y:A-M/2},{x:O+g/2,y:A-M/2},{x:O+g/2,y:A-M/2+d},{x:O+h.width/2,y:A-M/2+d},{x:O+h.width/2/2,y:A+M/2},{x:O-h.width/2,y:A+M/2},{x:O-h.width/2,y:A-M/2+d},{x:O-g/2,y:A-M/2+d}],q.polygon(t,L,z)},c}p(kd,"icon");async function _d(e,t,{config:{themeVariables:r,flowchart:i}}){const{labelStyles:a}=V(t);t.labelStyle=a;const s=t.assetHeight??48,o=t.assetWidth??48,n=Math.max(s,o),l=i==null?void 0:i.wrappingWidth;t.width=Math.max(n,l??0);const{shapeSvg:c,bbox:h,label:u}=await et(e,t,"icon-shape default"),f=20,d=t.label?8:0,g=t.pos==="t",{nodeBorder:m,mainBkg:y}=r,{stylesMap:x}=Er(t),b=U.svg(c),k=G(t,{});t.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const v=x.get("fill");k.stroke=v??y;const S=c.append("g");t.icon&&S.html(`${await yi(t.icon,{height:n,width:n,fallbackPrefix:""})}`);const C=S.node().getBBox(),T=C.width,F=C.height,P=C.x,R=C.y,$=Math.max(T,F)*Math.SQRT2+f*2,z=b.circle(0,0,$,k),O=Math.max($,h.width),A=$+h.height+d,M=b.rectangle(-O/2,-A/2,O,A,{...k,fill:"transparent",stroke:"none"}),L=c.insert(()=>z,":first-child"),E=c.insert(()=>M);return S.attr("transform",`translate(${-T/2-P},${g?h.height/2+d/2-F/2-R:-h.height/2-d/2-F/2-R})`),S.attr("style",`color: ${x.get("stroke")??m};`),u.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${g?-A/2:A/2-h.height})`),L.attr("transform",`translate(0,${g?h.height/2+d/2:-h.height/2-d/2})`),Z(t,E),t.intersect=function(B){return D.info("iconSquare intersect",t,B),q.rect(t,B)},c}p(_d,"iconCircle");async function wd(e,t,{config:{themeVariables:r,flowchart:i}}){const{labelStyles:a}=V(t);t.labelStyle=a;const s=t.assetHeight??48,o=t.assetWidth??48,n=Math.max(s,o),l=i==null?void 0:i.wrappingWidth;t.width=Math.max(n,l??0);const{shapeSvg:c,bbox:h,halfPadding:u,label:f}=await et(e,t,"icon-shape default"),d=t.pos==="t",g=n+u*2,m=n+u*2,{nodeBorder:y,mainBkg:x}=r,{stylesMap:b}=Er(t),k=-m/2,v=-g/2,S=t.label?8:0,C=U.svg(c),T=G(t,{});t.look!=="handDrawn"&&(T.roughness=0,T.fillStyle="solid");const F=b.get("fill");T.stroke=F??x;const P=C.path(qe(k,v,m,g,5),T),R=Math.max(m,h.width),$=g+h.height+S,z=C.rectangle(-R/2,-$/2,R,$,{...T,fill:"transparent",stroke:"none"}),O=c.insert(()=>P,":first-child").attr("class","icon-shape2"),A=c.insert(()=>z);if(t.icon){const M=c.append("g");M.html(`${await yi(t.icon,{height:n,width:n,fallbackPrefix:""})}`);const L=M.node().getBBox(),E=L.width,B=L.height,W=L.x,Y=L.y;M.attr("transform",`translate(${-E/2-W},${d?h.height/2+S/2-B/2-Y:-h.height/2-S/2-B/2-Y})`),M.attr("style",`color: ${b.get("stroke")??y};`)}return f.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${d?-$/2:$/2-h.height})`),O.attr("transform",`translate(0,${d?h.height/2+S/2:-h.height/2-S/2})`),Z(t,A),t.intersect=function(M){if(D.info("iconSquare intersect",t,M),!t.label)return q.rect(t,M);const L=t.x??0,E=t.y??0,B=t.height??0;let W=[];return d?W=[{x:L-h.width/2,y:E-B/2},{x:L+h.width/2,y:E-B/2},{x:L+h.width/2,y:E-B/2+h.height+S},{x:L+m/2,y:E-B/2+h.height+S},{x:L+m/2,y:E+B/2},{x:L-m/2,y:E+B/2},{x:L-m/2,y:E-B/2+h.height+S},{x:L-h.width/2,y:E-B/2+h.height+S}]:W=[{x:L-m/2,y:E-B/2},{x:L+m/2,y:E-B/2},{x:L+m/2,y:E-B/2+g},{x:L+h.width/2,y:E-B/2+g},{x:L+h.width/2/2,y:E+B/2},{x:L-h.width/2,y:E+B/2},{x:L-h.width/2,y:E-B/2+g},{x:L-m/2,y:E-B/2+g}],q.polygon(t,W,M)},c}p(wd,"iconRounded");async function Sd(e,t,{config:{themeVariables:r,flowchart:i}}){const{labelStyles:a}=V(t);t.labelStyle=a;const s=t.assetHeight??48,o=t.assetWidth??48,n=Math.max(s,o),l=i==null?void 0:i.wrappingWidth;t.width=Math.max(n,l??0);const{shapeSvg:c,bbox:h,halfPadding:u,label:f}=await et(e,t,"icon-shape default"),d=t.pos==="t",g=n+u*2,m=n+u*2,{nodeBorder:y,mainBkg:x}=r,{stylesMap:b}=Er(t),k=-m/2,v=-g/2,S=t.label?8:0,C=U.svg(c),T=G(t,{});t.look!=="handDrawn"&&(T.roughness=0,T.fillStyle="solid");const F=b.get("fill");T.stroke=F??x;const P=C.path(qe(k,v,m,g,.1),T),R=Math.max(m,h.width),$=g+h.height+S,z=C.rectangle(-R/2,-$/2,R,$,{...T,fill:"transparent",stroke:"none"}),O=c.insert(()=>P,":first-child"),A=c.insert(()=>z);if(t.icon){const M=c.append("g");M.html(`${await yi(t.icon,{height:n,width:n,fallbackPrefix:""})}`);const L=M.node().getBBox(),E=L.width,B=L.height,W=L.x,Y=L.y;M.attr("transform",`translate(${-E/2-W},${d?h.height/2+S/2-B/2-Y:-h.height/2-S/2-B/2-Y})`),M.attr("style",`color: ${b.get("stroke")??y};`)}return f.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${d?-$/2:$/2-h.height})`),O.attr("transform",`translate(0,${d?h.height/2+S/2:-h.height/2-S/2})`),Z(t,A),t.intersect=function(M){if(D.info("iconSquare intersect",t,M),!t.label)return q.rect(t,M);const L=t.x??0,E=t.y??0,B=t.height??0;let W=[];return d?W=[{x:L-h.width/2,y:E-B/2},{x:L+h.width/2,y:E-B/2},{x:L+h.width/2,y:E-B/2+h.height+S},{x:L+m/2,y:E-B/2+h.height+S},{x:L+m/2,y:E+B/2},{x:L-m/2,y:E+B/2},{x:L-m/2,y:E-B/2+h.height+S},{x:L-h.width/2,y:E-B/2+h.height+S}]:W=[{x:L-m/2,y:E-B/2},{x:L+m/2,y:E-B/2},{x:L+m/2,y:E-B/2+g},{x:L+h.width/2,y:E-B/2+g},{x:L+h.width/2/2,y:E+B/2},{x:L-h.width/2,y:E+B/2},{x:L-h.width/2,y:E-B/2+g},{x:L-m/2,y:E-B/2+g}],q.polygon(t,W,M)},c}p(Sd,"iconSquare");async function vd(e,t,{config:{flowchart:r}}){const i=new Image;i.src=(t==null?void 0:t.img)??"",await i.decode();const a=Number(i.naturalWidth.toString().replace("px","")),s=Number(i.naturalHeight.toString().replace("px",""));t.imageAspectRatio=a/s;const{labelStyles:o}=V(t);t.labelStyle=o;const n=r==null?void 0:r.wrappingWidth;t.defaultWidth=r==null?void 0:r.wrappingWidth;const l=Math.max(t.label?n??0:0,(t==null?void 0:t.assetWidth)??a),c=t.constraint==="on"&&t!=null&&t.assetHeight?t.assetHeight*t.imageAspectRatio:l,h=t.constraint==="on"?c/t.imageAspectRatio:(t==null?void 0:t.assetHeight)??s;t.width=Math.max(c,n??0);const{shapeSvg:u,bbox:f,label:d}=await et(e,t,"image-shape default"),g=t.pos==="t",m=-c/2,y=-h/2,x=t.label?8:0,b=U.svg(u),k=G(t,{});t.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const v=b.rectangle(m,y,c,h,k),S=Math.max(c,f.width),C=h+f.height+x,T=b.rectangle(-S/2,-C/2,S,C,{...k,fill:"none",stroke:"none"}),F=u.insert(()=>v,":first-child"),P=u.insert(()=>T);if(t.img){const R=u.append("image");R.attr("href",t.img),R.attr("width",c),R.attr("height",h),R.attr("preserveAspectRatio","none"),R.attr("transform",`translate(${-c/2},${g?C/2-h:-C/2})`)}return d.attr("transform",`translate(${-f.width/2-(f.x-(f.left??0))},${g?-h/2-f.height/2-x/2:h/2-f.height/2+x/2})`),F.attr("transform",`translate(0,${g?f.height/2+x/2:-f.height/2-x/2})`),Z(t,P),t.intersect=function(R){if(D.info("iconSquare intersect",t,R),!t.label)return q.rect(t,R);const $=t.x??0,z=t.y??0,O=t.height??0;let A=[];return g?A=[{x:$-f.width/2,y:z-O/2},{x:$+f.width/2,y:z-O/2},{x:$+f.width/2,y:z-O/2+f.height+x},{x:$+c/2,y:z-O/2+f.height+x},{x:$+c/2,y:z+O/2},{x:$-c/2,y:z+O/2},{x:$-c/2,y:z-O/2+f.height+x},{x:$-f.width/2,y:z-O/2+f.height+x}]:A=[{x:$-c/2,y:z-O/2},{x:$+c/2,y:z-O/2},{x:$+c/2,y:z-O/2+h},{x:$+f.width/2,y:z-O/2+h},{x:$+f.width/2/2,y:z+O/2},{x:$-f.width/2,y:z+O/2},{x:$-f.width/2,y:z-O/2+h},{x:$-c/2,y:z-O/2+h}],q.polygon(t,A,R)},u}p(vd,"imageSquare");async function Td(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s}=await et(e,t,tt(t)),o=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),n=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),l=[{x:0,y:0},{x:o,y:0},{x:o+3*n/6,y:-n},{x:-3*n/6,y:-n}];let c;const{cssStyles:h}=t;if(t.look==="handDrawn"){const u=U.svg(a),f=G(t,{}),d=ht(l),g=u.path(d,f);c=a.insert(()=>g,":first-child").attr("transform",`translate(${-o/2}, ${n/2})`),h&&c.attr("style",h)}else c=Ee(a,o,n,l);return i&&c.attr("style",i),t.width=o,t.height=n,Z(t,c),t.intersect=function(u){return q.polygon(t,l,u)},a}p(Td,"inv_trapezoid");async function bi(e,t,r){const{labelStyles:i,nodeStyles:a}=V(t);t.labelStyle=i;const{shapeSvg:s,bbox:o}=await et(e,t,tt(t)),n=Math.max(o.width+r.labelPaddingX*2,(t==null?void 0:t.width)||0),l=Math.max(o.height+r.labelPaddingY*2,(t==null?void 0:t.height)||0),c=-n/2,h=-l/2;let u,{rx:f,ry:d}=t;const{cssStyles:g}=t;if(r!=null&&r.rx&&r.ry&&(f=r.rx,d=r.ry),t.look==="handDrawn"){const m=U.svg(s),y=G(t,{}),x=f||d?m.path(qe(c,h,n,l,f||0),y):m.rectangle(c,h,n,l,y);u=s.insert(()=>x,":first-child"),u.attr("class","basic label-container").attr("style",Nt(g))}else u=s.insert("rect",":first-child"),u.attr("class","basic label-container").attr("style",a).attr("rx",Nt(f)).attr("ry",Nt(d)).attr("x",c).attr("y",h).attr("width",n).attr("height",l);return Z(t,u),t.calcIntersect=function(m,y){return q.rect(m,y)},t.intersect=function(m){return q.rect(t,m)},s}p(bi,"drawRect");async function Ld(e,t){const{shapeSvg:r,bbox:i,label:a}=await et(e,t,"label"),s=r.insert("rect",":first-child");return s.attr("width",.1).attr("height",.1),r.attr("class","label edgeLabel"),a.attr("transform",`translate(${-(i.width/2)-(i.x-(i.left??0))}, ${-(i.height/2)-(i.y-(i.top??0))})`),Z(t,s),t.intersect=function(l){return q.rect(t,l)},r}p(Ld,"labelRect");async function Bd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s}=await et(e,t,tt(t)),o=Math.max(s.width+(t.padding??0),(t==null?void 0:t.width)??0),n=Math.max(s.height+(t.padding??0),(t==null?void 0:t.height)??0),l=[{x:0,y:0},{x:o+3*n/6,y:0},{x:o,y:-n},{x:-(3*n)/6,y:-n}];let c;const{cssStyles:h}=t;if(t.look==="handDrawn"){const u=U.svg(a),f=G(t,{}),d=ht(l),g=u.path(d,f);c=a.insert(()=>g,":first-child").attr("transform",`translate(${-o/2}, ${n/2})`),h&&c.attr("style",h)}else c=Ee(a,o,n,l);return i&&c.attr("style",i),t.width=o,t.height=n,Z(t,c),t.intersect=function(u){return q.polygon(t,l,u)},a}p(Bd,"lean_left");async function Ad(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s}=await et(e,t,tt(t)),o=Math.max(s.width+(t.padding??0),(t==null?void 0:t.width)??0),n=Math.max(s.height+(t.padding??0),(t==null?void 0:t.height)??0),l=[{x:-3*n/6,y:0},{x:o,y:0},{x:o+3*n/6,y:-n},{x:0,y:-n}];let c;const{cssStyles:h}=t;if(t.look==="handDrawn"){const u=U.svg(a),f=G(t,{}),d=ht(l),g=u.path(d,f);c=a.insert(()=>g,":first-child").attr("transform",`translate(${-o/2}, ${n/2})`),h&&c.attr("style",h)}else c=Ee(a,o,n,l);return i&&c.attr("style",i),t.width=o,t.height=n,Z(t,c),t.intersect=function(u){return q.polygon(t,l,u)},a}p(Ad,"lean_right");function Md(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.label="",t.labelStyle=r;const a=e.insert("g").attr("class",tt(t)).attr("id",t.domId??t.id),{cssStyles:s}=t,o=Math.max(35,(t==null?void 0:t.width)??0),n=Math.max(35,(t==null?void 0:t.height)??0),l=7,c=[{x:o,y:0},{x:0,y:n+l/2},{x:o-2*l,y:n+l/2},{x:0,y:2*n},{x:o,y:n-l/2},{x:2*l,y:n-l/2}],h=U.svg(a),u=G(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");const f=ht(c),d=h.path(f,u),g=a.insert(()=>d,":first-child");return s&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",s),i&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",i),g.attr("transform",`translate(-${o/2},${-n})`),Z(t,g),t.intersect=function(m){return D.info("lightningBolt intersect",t,m),q.polygon(t,c,m)},a}p(Md,"lightningBolt");var gb=p((e,t,r,i,a,s,o)=>[`M${e},${t+s}`,`a${a},${s} 0,0,0 ${r},0`,`a${a},${s} 0,0,0 ${-r},0`,`l0,${i}`,`a${a},${s} 0,0,0 ${r},0`,`l0,${-i}`,`M${e},${t+s+o}`,`a${a},${s} 0,0,0 ${r},0`].join(" "),"createCylinderPathD"),mb=p((e,t,r,i,a,s,o)=>[`M${e},${t+s}`,`M${e+r},${t+s}`,`a${a},${s} 0,0,0 ${-r},0`,`l0,${i}`,`a${a},${s} 0,0,0 ${r},0`,`l0,${-i}`,`M${e},${t+s+o}`,`a${a},${s} 0,0,0 ${r},0`].join(" "),"createOuterCylinderPathD"),yb=p((e,t,r,i,a,s)=>[`M${e-r/2},${-i/2}`,`a${a},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD");async function Ed(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s,label:o}=await et(e,t,tt(t)),n=Math.max(s.width+(t.padding??0),t.width??0),l=n/2,c=l/(2.5+n/50),h=Math.max(s.height+c+(t.padding??0),t.height??0),u=h*.1;let f;const{cssStyles:d}=t;if(t.look==="handDrawn"){const g=U.svg(a),m=mb(0,0,n,h,l,c,u),y=yb(0,c,n,h,l,c),x=G(t,{}),b=g.path(m,x),k=g.path(y,x);a.insert(()=>k,":first-child").attr("class","line"),f=a.insert(()=>b,":first-child"),f.attr("class","basic label-container"),d&&f.attr("style",d)}else{const g=gb(0,0,n,h,l,c,u);f=a.insert("path",":first-child").attr("d",g).attr("class","basic label-container").attr("style",Nt(d)).attr("style",i)}return f.attr("label-offset-y",c),f.attr("transform",`translate(${-n/2}, ${-(h/2+c)})`),Z(t,f),o.attr("transform",`translate(${-(s.width/2)-(s.x-(s.left??0))}, ${-(s.height/2)+c-(s.y-(s.top??0))})`),t.intersect=function(g){const m=q.rect(t,g),y=m.x-(t.x??0);if(l!=0&&(Math.abs(y)(t.height??0)/2-c)){let x=c*c*(1-y*y/(l*l));x>0&&(x=Math.sqrt(x)),x=c-x,g.y-(t.y??0)>0&&(x=-x),m.y+=x}return m},a}p(Ed,"linedCylinder");async function $d(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s,label:o}=await et(e,t,tt(t)),n=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),l=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),c=l/4,h=l+c,{cssStyles:u}=t,f=U.svg(a),d=G(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const g=[{x:-n/2-n/2*.1,y:-h/2},{x:-n/2-n/2*.1,y:h/2},...ze(-n/2-n/2*.1,h/2,n/2+n/2*.1,h/2,c,.8),{x:n/2+n/2*.1,y:-h/2},{x:-n/2-n/2*.1,y:-h/2},{x:-n/2,y:-h/2},{x:-n/2,y:h/2*1.1},{x:-n/2,y:-h/2}],m=f.polygon(g.map(x=>[x.x,x.y]),d),y=a.insert(()=>m,":first-child");return y.attr("class","basic label-container"),u&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",u),i&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",i),y.attr("transform",`translate(0,${-c/2})`),o.attr("transform",`translate(${-n/2+(t.padding??0)+n/2*.1/2-(s.x-(s.left??0))},${-l/2+(t.padding??0)-c/2-(s.y-(s.top??0))})`),Z(t,y),t.intersect=function(x){return q.polygon(t,g,x)},a}p($d,"linedWaveEdgedRect");async function Fd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s,label:o}=await et(e,t,tt(t)),n=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),l=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),c=5,h=-n/2,u=-l/2,{cssStyles:f}=t,d=U.svg(a),g=G(t,{}),m=[{x:h-c,y:u+c},{x:h-c,y:u+l+c},{x:h+n-c,y:u+l+c},{x:h+n-c,y:u+l},{x:h+n,y:u+l},{x:h+n,y:u+l-c},{x:h+n+c,y:u+l-c},{x:h+n+c,y:u-c},{x:h+c,y:u-c},{x:h+c,y:u},{x:h,y:u},{x:h,y:u+c}],y=[{x:h,y:u+c},{x:h+n-c,y:u+c},{x:h+n-c,y:u+l},{x:h+n,y:u+l},{x:h+n,y:u},{x:h,y:u}];t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const x=ht(m),b=d.path(x,g),k=ht(y),v=d.path(k,{...g,fill:"none"}),S=a.insert(()=>v,":first-child");return S.insert(()=>b,":first-child"),S.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",f),i&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",i),o.attr("transform",`translate(${-(s.width/2)-c-(s.x-(s.left??0))}, ${-(s.height/2)+c-(s.y-(s.top??0))})`),Z(t,S),t.intersect=function(C){return q.polygon(t,m,C)},a}p(Fd,"multiRect");async function Dd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s,label:o}=await et(e,t,tt(t)),n=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),l=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),c=l/4,h=l+c,u=-n/2,f=-h/2,d=5,{cssStyles:g}=t,m=ze(u-d,f+h+d,u+n-d,f+h+d,c,.8),y=m==null?void 0:m[m.length-1],x=[{x:u-d,y:f+d},{x:u-d,y:f+h+d},...m,{x:u+n-d,y:y.y-d},{x:u+n,y:y.y-d},{x:u+n,y:y.y-2*d},{x:u+n+d,y:y.y-2*d},{x:u+n+d,y:f-d},{x:u+d,y:f-d},{x:u+d,y:f},{x:u,y:f},{x:u,y:f+d}],b=[{x:u,y:f+d},{x:u+n-d,y:f+d},{x:u+n-d,y:y.y-d},{x:u+n,y:y.y-d},{x:u+n,y:f},{x:u,y:f}],k=U.svg(a),v=G(t,{});t.look!=="handDrawn"&&(v.roughness=0,v.fillStyle="solid");const S=ht(x),C=k.path(S,v),T=ht(b),F=k.path(T,v),P=a.insert(()=>C,":first-child");return P.insert(()=>F),P.attr("class","basic label-container"),g&&t.look!=="handDrawn"&&P.selectAll("path").attr("style",g),i&&t.look!=="handDrawn"&&P.selectAll("path").attr("style",i),P.attr("transform",`translate(0,${-c/2})`),o.attr("transform",`translate(${-(s.width/2)-d-(s.x-(s.left??0))}, ${-(s.height/2)+d-c/2-(s.y-(s.top??0))})`),Z(t,P),t.intersect=function(R){return q.polygon(t,x,R)},a}p(Dd,"multiWaveEdgedRectangle");async function Od(e,t,{config:{themeVariables:r}}){const{labelStyles:i,nodeStyles:a}=V(t);t.labelStyle=i,t.useHtmlLabels||zt(It())||(t.centerLabel=!0);const{shapeSvg:o,bbox:n,label:l}=await et(e,t,tt(t)),c=Math.max(n.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),h=Math.max(n.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),u=-c/2,f=-h/2,{cssStyles:d}=t,g=U.svg(o),m=G(t,{fill:r.noteBkgColor,stroke:r.noteBorderColor});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const y=g.rectangle(u,f,c,h,m),x=o.insert(()=>y,":first-child");return x.attr("class","basic label-container"),d&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",d),a&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",a),l.attr("transform",`translate(${-n.width/2-(n.x-(n.left??0))}, ${-(n.height/2)-(n.y-(n.top??0))})`),Z(t,x),t.intersect=function(b){return q.rect(t,b)},o}p(Od,"note");var xb=p((e,t,r)=>[`M${e+r/2},${t}`,`L${e+r},${t-r/2}`,`L${e+r/2},${t-r}`,`L${e},${t-r/2}`,"Z"].join(" "),"createDecisionBoxPathD");async function Rd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s}=await et(e,t,tt(t)),o=s.width+t.padding,n=s.height+t.padding,l=o+n,c=.5,h=[{x:l/2,y:0},{x:l,y:-l/2},{x:l/2,y:-l},{x:0,y:-l/2}];let u;const{cssStyles:f}=t;if(t.look==="handDrawn"){const d=U.svg(a),g=G(t,{}),m=xb(0,0,l),y=d.path(m,g);u=a.insert(()=>y,":first-child").attr("transform",`translate(${-l/2+c}, ${l/2})`),f&&u.attr("style",f)}else u=Ee(a,l,l,h),u.attr("transform",`translate(${-l/2+c}, ${l/2})`);return i&&u.attr("style",i),Z(t,u),t.calcIntersect=function(d,g){const m=d.width,y=[{x:m/2,y:0},{x:m,y:-m/2},{x:m/2,y:-m},{x:0,y:-m/2}],x=q.polygon(d,y,g);return{x:x.x-.5,y:x.y-.5}},t.intersect=function(d){return this.calcIntersect(t,d)},a}p(Rd,"question");async function Id(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s,label:o}=await et(e,t,tt(t)),n=Math.max(s.width+(t.padding??0),(t==null?void 0:t.width)??0),l=Math.max(s.height+(t.padding??0),(t==null?void 0:t.height)??0),c=-n/2,h=-l/2,u=h/2,f=[{x:c+u,y:h},{x:c,y:0},{x:c+u,y:-h},{x:-c,y:-h},{x:-c,y:h}],{cssStyles:d}=t,g=U.svg(a),m=G(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const y=ht(f),x=g.path(y,m),b=a.insert(()=>x,":first-child");return b.attr("class","basic label-container"),d&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",d),i&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",i),b.attr("transform",`translate(${-u/2},0)`),o.attr("transform",`translate(${-u/2-s.width/2-(s.x-(s.left??0))}, ${-(s.height/2)-(s.y-(s.top??0))})`),Z(t,b),t.intersect=function(k){return q.polygon(t,f,k)},a}p(Id,"rect_left_inv_arrow");async function Pd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;let a;t.cssClasses?a="node "+t.cssClasses:a="node default";const s=e.insert("g").attr("class",a).attr("id",t.domId||t.id),o=s.insert("g"),n=s.insert("g").attr("class","label").attr("style",i),l=t.description,c=t.label,h=await De(n,c,t.labelStyle,!0,!0);let u={width:0,height:0};if(zt(pt())){const F=h.children[0],P=ot(h);u=F.getBoundingClientRect(),P.attr("width",u.width),P.attr("height",u.height)}D.info("Text 2",l);const f=l||[],d=h.getBBox(),g=await De(n,Array.isArray(f)?f.join("
"):f,t.labelStyle,!0,!0),m=g.children[0],y=ot(g);u=m.getBoundingClientRect(),y.attr("width",u.width),y.attr("height",u.height);const x=(t.padding||0)/2;ot(g).attr("transform","translate( "+(u.width>d.width?0:(d.width-u.width)/2)+", "+(d.height+x+5)+")"),ot(h).attr("transform","translate( "+(u.width(D.debug("Rough node insert CXC",R),$),":first-child"),C=s.insert(()=>(D.debug("Rough node insert CXC",R),R),":first-child")}else C=o.insert("rect",":first-child"),T=o.insert("line"),C.attr("class","outer title-state").attr("style",i).attr("x",-u.width/2-x).attr("y",-u.height/2-x).attr("width",u.width+(t.padding||0)).attr("height",u.height+(t.padding||0)),T.attr("class","divider").attr("x1",-u.width/2-x).attr("x2",u.width/2+x).attr("y1",-u.height/2-x+d.height+x).attr("y2",-u.height/2-x+d.height+x);return Z(t,C),t.intersect=function(F){return q.rect(t,F)},s}p(Pd,"rectWithTitle");async function Nd(e,t){const r={rx:5,ry:5,labelPaddingX:((t==null?void 0:t.padding)||0)*1,labelPaddingY:((t==null?void 0:t.padding)||0)*1};return bi(e,t,r)}p(Nd,"roundedRect");async function zd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s,label:o}=await et(e,t,tt(t)),n=(t==null?void 0:t.padding)??0,l=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),c=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),h=-s.width/2-n,u=-s.height/2-n,{cssStyles:f}=t,d=U.svg(a),g=G(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const m=[{x:h,y:u},{x:h+l+8,y:u},{x:h+l+8,y:u+c},{x:h-8,y:u+c},{x:h-8,y:u},{x:h,y:u},{x:h,y:u+c}],y=d.polygon(m.map(b=>[b.x,b.y]),g),x=a.insert(()=>y,":first-child");return x.attr("class","basic label-container").attr("style",Nt(f)),i&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",i),f&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",i),o.attr("transform",`translate(${-l/2+4+(t.padding??0)-(s.x-(s.left??0))},${-c/2+(t.padding??0)-(s.y-(s.top??0))})`),Z(t,x),t.intersect=function(b){return q.rect(t,b)},a}p(zd,"shadedProcess");async function Wd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s,label:o}=await et(e,t,tt(t)),n=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),l=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),c=-n/2,h=-l/2,{cssStyles:u}=t,f=U.svg(a),d=G(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const g=[{x:c,y:h},{x:c,y:h+l},{x:c+n,y:h+l},{x:c+n,y:h-l/2}],m=ht(g),y=f.path(m,d),x=a.insert(()=>y,":first-child");return x.attr("class","basic label-container"),u&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",u),i&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",i),x.attr("transform",`translate(0, ${l/4})`),o.attr("transform",`translate(${-n/2+(t.padding??0)-(s.x-(s.left??0))}, ${-l/4+(t.padding??0)-(s.y-(s.top??0))})`),Z(t,x),t.intersect=function(b){return q.polygon(t,g,b)},a}p(Wd,"slopedRect");async function qd(e,t){const r={rx:0,ry:0,labelPaddingX:t.labelPaddingX??((t==null?void 0:t.padding)||0)*2,labelPaddingY:((t==null?void 0:t.padding)||0)*1};return bi(e,t,r)}p(qd,"squareRect");async function Hd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s}=await et(e,t,tt(t)),o=s.height+t.padding,n=s.width+o/4+t.padding,l=o/2,{cssStyles:c}=t,h=U.svg(a),u=G(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");const f=[{x:-n/2+l,y:-o/2},{x:n/2-l,y:-o/2},...ci(-n/2+l,0,l,50,90,270),{x:n/2-l,y:o/2},...ci(n/2-l,0,l,50,270,450)],d=ht(f),g=h.path(d,u),m=a.insert(()=>g,":first-child");return m.attr("class","basic label-container outer-path"),c&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",c),i&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",i),Z(t,m),t.intersect=function(y){return q.polygon(t,f,y)},a}p(Hd,"stadium");async function jd(e,t){return bi(e,t,{rx:5,ry:5})}p(jd,"state");function Yd(e,t,{config:{themeVariables:r}}){const{labelStyles:i,nodeStyles:a}=V(t);t.labelStyle=i;const{cssStyles:s}=t,{lineColor:o,stateBorder:n,nodeBorder:l}=r,c=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),h=U.svg(c),u=G(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");const f=h.circle(0,0,14,{...u,stroke:o,strokeWidth:2}),d=n??l,g=h.circle(0,0,5,{...u,fill:d,stroke:d,strokeWidth:2,fillStyle:"solid"}),m=c.insert(()=>f,":first-child");return m.insert(()=>g),s&&m.selectAll("path").attr("style",s),a&&m.selectAll("path").attr("style",a),Z(t,m),t.intersect=function(y){return q.circle(t,7,y)},c}p(Yd,"stateEnd");function Ud(e,t,{config:{themeVariables:r}}){const{lineColor:i}=r,a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id);let s;if(t.look==="handDrawn"){const n=U.svg(a).circle(0,0,14,Ly(i));s=a.insert(()=>n),s.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14)}else s=a.insert("circle",":first-child"),s.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14);return Z(t,s),t.intersect=function(o){return q.circle(t,7,o)},a}p(Ud,"stateStart");async function Gd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s}=await et(e,t,tt(t)),o=((t==null?void 0:t.padding)||0)/2,n=s.width+t.padding,l=s.height+t.padding,c=-s.width/2-o,h=-s.height/2-o,u=[{x:0,y:0},{x:n,y:0},{x:n,y:-l},{x:0,y:-l},{x:0,y:0},{x:-8,y:0},{x:n+8,y:0},{x:n+8,y:-l},{x:-8,y:-l},{x:-8,y:0}];if(t.look==="handDrawn"){const f=U.svg(a),d=G(t,{}),g=f.rectangle(c-8,h,n+16,l,d),m=f.line(c,h,c,h+l,d),y=f.line(c+n,h,c+n,h+l,d);a.insert(()=>m,":first-child"),a.insert(()=>y,":first-child");const x=a.insert(()=>g,":first-child"),{cssStyles:b}=t;x.attr("class","basic label-container").attr("style",Nt(b)),Z(t,x)}else{const f=Ee(a,n,l,u);i&&f.attr("style",i),Z(t,f)}return t.intersect=function(f){return q.polygon(t,u,f)},a}p(Gd,"subroutine");async function Vd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s}=await et(e,t,tt(t)),o=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),n=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),l=-o/2,c=-n/2,h=.2*n,u=.2*n,{cssStyles:f}=t,d=U.svg(a),g=G(t,{}),m=[{x:l-h/2,y:c},{x:l+o+h/2,y:c},{x:l+o+h/2,y:c+n},{x:l-h/2,y:c+n}],y=[{x:l+o-h/2,y:c+n},{x:l+o+h/2,y:c+n},{x:l+o+h/2,y:c+n-u}];t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const x=ht(m),b=d.path(x,g),k=ht(y),v=d.path(k,{...g,fillStyle:"solid"}),S=a.insert(()=>v,":first-child");return S.insert(()=>b,":first-child"),S.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",f),i&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",i),Z(t,S),t.intersect=function(C){return q.polygon(t,m,C)},a}p(Vd,"taggedRect");async function Xd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s,label:o}=await et(e,t,tt(t)),n=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),l=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),c=l/4,h=.2*n,u=.2*l,f=l+c,{cssStyles:d}=t,g=U.svg(a),m=G(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const y=[{x:-n/2-n/2*.1,y:f/2},...ze(-n/2-n/2*.1,f/2,n/2+n/2*.1,f/2,c,.8),{x:n/2+n/2*.1,y:-f/2},{x:-n/2-n/2*.1,y:-f/2}],x=-n/2+n/2*.1,b=-f/2-u*.4,k=[{x:x+n-h,y:(b+l)*1.4},{x:x+n,y:b+l-u},{x:x+n,y:(b+l)*.9},...ze(x+n,(b+l)*1.3,x+n-h,(b+l)*1.5,-l*.03,.5)],v=ht(y),S=g.path(v,m),C=ht(k),T=g.path(C,{...m,fillStyle:"solid"}),F=a.insert(()=>T,":first-child");return F.insert(()=>S,":first-child"),F.attr("class","basic label-container"),d&&t.look!=="handDrawn"&&F.selectAll("path").attr("style",d),i&&t.look!=="handDrawn"&&F.selectAll("path").attr("style",i),F.attr("transform",`translate(0,${-c/2})`),o.attr("transform",`translate(${-n/2+(t.padding??0)-(s.x-(s.left??0))},${-l/2+(t.padding??0)-c/2-(s.y-(s.top??0))})`),Z(t,F),t.intersect=function(P){return q.polygon(t,y,P)},a}p(Xd,"taggedWaveEdgedRectangle");async function Zd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s}=await et(e,t,tt(t)),o=Math.max(s.width+t.padding,(t==null?void 0:t.width)||0),n=Math.max(s.height+t.padding,(t==null?void 0:t.height)||0),l=-o/2,c=-n/2,h=a.insert("rect",":first-child");return h.attr("class","text").attr("style",i).attr("rx",0).attr("ry",0).attr("x",l).attr("y",c).attr("width",o).attr("height",n),Z(t,h),t.intersect=function(u){return q.rect(t,u)},a}p(Zd,"text");var bb=p((e,t,r,i,a,s)=>`M${e},${t}
a${a},${s} 0,0,1 0,${-i}
l${r},0
a${a},${s} 0,0,1 0,${i}
M${r},${-i}
a${a},${s} 0,0,0 0,${i}
l${-r},0`,"createCylinderPathD"),Cb=p((e,t,r,i,a,s)=>[`M${e},${t}`,`M${e+r},${t}`,`a${a},${s} 0,0,0 0,${-i}`,`l${-r},0`,`a${a},${s} 0,0,0 0,${i}`,`l${r},0`].join(" "),"createOuterCylinderPathD"),kb=p((e,t,r,i,a,s)=>[`M${e+r/2},${-i/2}`,`a${a},${s} 0,0,0 0,${i}`].join(" "),"createInnerCylinderPathD");async function Kd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s,label:o,halfPadding:n}=await et(e,t,tt(t)),l=t.look==="neo"?n*2:n,c=s.height+l,h=c/2,u=h/(2.5+c/50),f=s.width+u+l,{cssStyles:d}=t;let g;if(t.look==="handDrawn"){const m=U.svg(a),y=Cb(0,0,f,c,u,h),x=kb(0,0,f,c,u,h),b=m.path(y,G(t,{})),k=m.path(x,G(t,{fill:"none"}));g=a.insert(()=>k,":first-child"),g=a.insert(()=>b,":first-child"),g.attr("class","basic label-container"),d&&g.attr("style",d)}else{const m=bb(0,0,f,c,u,h);g=a.insert("path",":first-child").attr("d",m).attr("class","basic label-container").attr("style",Nt(d)).attr("style",i),g.attr("class","basic label-container"),d&&g.selectAll("path").attr("style",d),i&&g.selectAll("path").attr("style",i)}return g.attr("label-offset-x",u),g.attr("transform",`translate(${-f/2}, ${c/2} )`),o.attr("transform",`translate(${-(s.width/2)-u-(s.x-(s.left??0))}, ${-(s.height/2)-(s.y-(s.top??0))})`),Z(t,g),t.intersect=function(m){const y=q.rect(t,m),x=y.y-(t.y??0);if(h!=0&&(Math.abs(x)(t.width??0)/2-u)){let b=u*u*(1-x*x/(h*h));b!=0&&(b=Math.sqrt(Math.abs(b))),b=u-b,m.x-(t.x??0)>0&&(b=-b),y.x+=b}return y},a}p(Kd,"tiltedCylinder");async function Qd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s}=await et(e,t,tt(t)),o=s.width+t.padding,n=s.height+t.padding,l=[{x:-3*n/6,y:0},{x:o+3*n/6,y:0},{x:o,y:-n},{x:0,y:-n}];let c;const{cssStyles:h}=t;if(t.look==="handDrawn"){const u=U.svg(a),f=G(t,{}),d=ht(l),g=u.path(d,f);c=a.insert(()=>g,":first-child").attr("transform",`translate(${-o/2}, ${n/2})`),h&&c.attr("style",h)}else c=Ee(a,o,n,l);return i&&c.attr("style",i),t.width=o,t.height=n,Z(t,c),t.intersect=function(u){return q.polygon(t,l,u)},a}p(Qd,"trapezoid");async function Jd(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s}=await et(e,t,tt(t)),o=60,n=20,l=Math.max(o,s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),c=Math.max(n,s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),{cssStyles:h}=t,u=U.svg(a),f=G(t,{});t.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");const d=[{x:-l/2*.8,y:-c/2},{x:l/2*.8,y:-c/2},{x:l/2,y:-c/2*.6},{x:l/2,y:c/2},{x:-l/2,y:c/2},{x:-l/2,y:-c/2*.6}],g=ht(d),m=u.path(g,f),y=a.insert(()=>m,":first-child");return y.attr("class","basic label-container"),h&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",h),i&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",i),Z(t,y),t.intersect=function(x){return q.polygon(t,d,x)},a}p(Jd,"trapezoidalPentagon");async function tf(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s,label:o}=await et(e,t,tt(t)),n=t.useHtmlLabels||zt(pt()),l=s.width+(t.padding??0),c=l+s.height,h=l+s.height,u=[{x:0,y:0},{x:h,y:0},{x:h/2,y:-c}],{cssStyles:f}=t,d=U.svg(a),g=G(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const m=ht(u),y=d.path(m,g),x=a.insert(()=>y,":first-child").attr("transform",`translate(${-c/2}, ${c/2})`);return f&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",f),i&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",i),t.width=l,t.height=c,Z(t,x),o.attr("transform",`translate(${-s.width/2-(s.x-(s.left??0))}, ${c/2-(s.height+(t.padding??0)/(n?2:1)-(s.y-(s.top??0)))})`),t.intersect=function(b){return D.info("Triangle intersect",t,u,b),q.polygon(t,u,b)},a}p(tf,"triangle");async function ef(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s,label:o}=await et(e,t,tt(t)),n=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),l=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),c=l/8,h=l+c,{cssStyles:u}=t,d=70-n,g=d>0?d/2:0,m=U.svg(a),y=G(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const x=[{x:-n/2-g,y:h/2},...ze(-n/2-g,h/2,n/2+g,h/2,c,.8),{x:n/2+g,y:-h/2},{x:-n/2-g,y:-h/2}],b=ht(x),k=m.path(b,y),v=a.insert(()=>k,":first-child");return v.attr("class","basic label-container"),u&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",u),i&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",i),v.attr("transform",`translate(0,${-c/2})`),o.attr("transform",`translate(${-n/2+(t.padding??0)-(s.x-(s.left??0))},${-l/2+(t.padding??0)-c-(s.y-(s.top??0))})`),Z(t,v),t.intersect=function(S){return q.polygon(t,x,S)},a}p(ef,"waveEdgedRectangle");async function rf(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s}=await et(e,t,tt(t)),o=100,n=50,l=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),c=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),h=l/c;let u=l,f=c;u>f*h?f=u/h:u=f*h,u=Math.max(u,o),f=Math.max(f,n);const d=Math.min(f*.2,f/4),g=f+d*2,{cssStyles:m}=t,y=U.svg(a),x=G(t,{});t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const b=[{x:-u/2,y:g/2},...ze(-u/2,g/2,u/2,g/2,d,1),{x:u/2,y:-g/2},...ze(u/2,-g/2,-u/2,-g/2,d,-1)],k=ht(b),v=y.path(k,x),S=a.insert(()=>v,":first-child");return S.attr("class","basic label-container"),m&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",m),i&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",i),Z(t,S),t.intersect=function(C){return q.polygon(t,b,C)},a}p(rf,"waveRectangle");async function af(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s,label:o}=await et(e,t,tt(t)),n=Math.max(s.width+(t.padding??0)*2,(t==null?void 0:t.width)??0),l=Math.max(s.height+(t.padding??0)*2,(t==null?void 0:t.height)??0),c=5,h=-n/2,u=-l/2,{cssStyles:f}=t,d=U.svg(a),g=G(t,{}),m=[{x:h-c,y:u-c},{x:h-c,y:u+l},{x:h+n,y:u+l},{x:h+n,y:u-c}],y=`M${h-c},${u-c} L${h+n},${u-c} L${h+n},${u+l} L${h-c},${u+l} L${h-c},${u-c}
M${h-c},${u} L${h+n},${u}
M${h},${u-c} L${h},${u+l}`;t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const x=d.path(y,g),b=a.insert(()=>x,":first-child");return b.attr("transform",`translate(${c/2}, ${c/2})`),b.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",f),i&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",i),o.attr("transform",`translate(${-(s.width/2)+c/2-(s.x-(s.left??0))}, ${-(s.height/2)+c/2-(s.y-(s.top??0))})`),Z(t,b),t.intersect=function(k){return q.polygon(t,m,k)},a}p(af,"windowPane");async function qn(e,t){var ut,at,xt,st;const r=t;if(r.alias&&(t.label=r.alias),t.look==="handDrawn"){const{themeVariables:nt}=It(),{background:ct}=nt,mt={...t,id:t.id+"-background",look:"default",cssStyles:["stroke: none",`fill: ${ct}`]};await qn(e,mt)}const i=It();t.useHtmlLabels=i.htmlLabels;let a=((ut=i.er)==null?void 0:ut.diagramPadding)??10,s=((at=i.er)==null?void 0:at.entityPadding)??6;const{cssStyles:o}=t,{labelStyles:n,nodeStyles:l}=V(t);if(r.attributes.length===0&&t.label){const nt={rx:0,ry:0,labelPaddingX:a,labelPaddingY:a*1.5};Ae(t.label,i)+nt.labelPaddingX*20){const nt=u.width+a*2-(m+y+x+b);m+=nt/S,y+=nt/S,x>0&&(x+=nt/S),b>0&&(b+=nt/S)}const T=m+y+x+b,F=U.svg(h),P=G(t,{});t.look!=="handDrawn"&&(P.roughness=0,P.fillStyle="solid");let R=0;g.length>0&&(R=g.reduce((nt,ct)=>nt+((ct==null?void 0:ct.rowHeight)??0),0));const $=Math.max(C.width+a*2,(t==null?void 0:t.width)||0,T),z=Math.max((R??0)+u.height,(t==null?void 0:t.height)||0),O=-$/2,A=-z/2;h.selectAll("g:not(:first-child)").each((nt,ct,mt)=>{const Ct=ot(mt[ct]),bt=Ct.attr("transform");let St=0,ne=0;if(bt){const $e=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(bt);$e&&(St=parseFloat($e[1]),ne=parseFloat($e[2]),Ct.attr("class").includes("attribute-name")?St+=m:Ct.attr("class").includes("attribute-keys")?St+=m+y:Ct.attr("class").includes("attribute-comment")&&(St+=m+y+x))}Ct.attr("transform",`translate(${O+a/2+St}, ${ne+A+u.height+s/2})`)}),h.select(".name").attr("transform","translate("+-u.width/2+", "+(A+s/2)+")");const M=F.rectangle(O,A,$,z,P),L=h.insert(()=>M,":first-child").attr("style",o.join("")),{themeVariables:E}=It(),{rowEven:B,rowOdd:W,nodeBorder:Y}=E;d.push(0);for(const[nt,ct]of g.entries()){const Ct=(nt+1)%2===0&&ct.yOffset!==0,bt=F.rectangle(O,u.height+A+(ct==null?void 0:ct.yOffset),$,ct==null?void 0:ct.rowHeight,{...P,fill:Ct?B:W,stroke:Y});h.insert(()=>bt,"g.label").attr("style",o.join("")).attr("class",`row-rect-${Ct?"even":"odd"}`)}let H=F.line(O,u.height+A,$+O,u.height+A,P);h.insert(()=>H).attr("class","divider"),H=F.line(m+O,u.height+A,m+O,z+A,P),h.insert(()=>H).attr("class","divider"),k&&(H=F.line(m+y+O,u.height+A,m+y+O,z+A,P),h.insert(()=>H).attr("class","divider")),v&&(H=F.line(m+y+x+O,u.height+A,m+y+x+O,z+A,P),h.insert(()=>H).attr("class","divider"));for(const nt of d)H=F.line(O,u.height+A+nt,$+O,u.height+A+nt,P),h.insert(()=>H).attr("class","divider");if(Z(t,L),l&&t.look!=="handDrawn"){const nt=l.split(";"),ct=(st=nt==null?void 0:nt.filter(mt=>mt.includes("stroke")))==null?void 0:st.map(mt=>`${mt}`).join("; ");h.selectAll("path").attr("style",ct??""),h.selectAll(".row-rect-even path").attr("style",l)}return t.intersect=function(nt){return q.rect(t,nt)},h}p(qn,"erBox");async function dr(e,t,r,i=0,a=0,s=[],o=""){const n=e.insert("g").attr("class",`label ${s.join(" ")}`).attr("transform",`translate(${i}, ${a})`).attr("style",o);t!==Lo(t)&&(t=Lo(t),t=t.replaceAll("",">"));const l=n.node().appendChild(await Me(n,t,{width:Ae(t,r)+100,style:o,useHtmlLabels:r.htmlLabels},r));if(t.includes("<")||t.includes(">")){let h=l.children[0];for(h.textContent=h.textContent.replaceAll("<","");h.childNodes[0];)h=h.childNodes[0],h.textContent=h.textContent.replaceAll("<","")}let c=l.getBBox();if(We(r.htmlLabels)){const h=l.children[0];h.style.textAlign="start";const u=ot(l);c=h.getBoundingClientRect(),u.attr("width",c.width),u.attr("height",c.height)}return c}p(dr,"addText");async function sf(e,t,r,i,a=r.class.padding??12){const s=i?0:3,o=e.insert("g").attr("class",tt(t)).attr("id",t.domId||t.id);let n=null,l=null,c=null,h=null,u=0,f=0,d=0;if(n=o.insert("g").attr("class","annotation-group text"),t.annotations.length>0){const b=t.annotations[0];await Zr(n,{text:`«${b}»`},0),u=n.node().getBBox().height}l=o.insert("g").attr("class","label-group text"),await Zr(l,t,0,["font-weight: bolder"]);const g=l.node().getBBox();f=g.height,c=o.insert("g").attr("class","members-group text");let m=0;for(const b of t.members){const k=await Zr(c,b,m,[b.parseClassifier()]);m+=k+s}d=c.node().getBBox().height,d").length,u.innerHTML.includes("")&&(h+=u.innerHTML.split("").length-1);const d=u.getElementsByTagName("img");if(d){const g=n.replace(/
]*>/g,"").trim()==="";await Promise.all([...d].map(m=>new Promise(y=>{function x(){var b;if(m.style.display="flex",m.style.flexDirection="column",g){const k=((b=s.fontSize)==null?void 0:b.toString())??window.getComputedStyle(document.body).fontSize,S=parseInt(k,10)*5+"px";m.style.minWidth=S,m.style.maxWidth=S}else m.style.width="100%";y(m)}p(x,"setupImage"),setTimeout(()=>{m.complete&&x()}),m.addEventListener("error",x),m.addEventListener("load",x)})))}c=u.getBoundingClientRect(),f.attr("width",c.width),f.attr("height",c.height)}else{i.includes("font-weight: bolder")&&ot(l).selectAll("tspan").attr("font-weight",""),h=l.children.length;const u=l.children[0];(l.textContent===""||l.textContent.includes(">"))&&(u.textContent=n[0]+n.substring(1).replaceAll(">",">").replaceAll("<","0&&o.methods.length===0&&(y+=a*2);const x=-m/2,b=-y/2,k=d.rectangle(x-i,b-i-(f?i:o.members.length===0&&o.methods.length===0?-i/2:0),m+2*i,y+2*i+(f?i*2:o.members.length===0&&o.methods.length===0?-i:0),g),v=n.insert(()=>k,":first-child");v.attr("class","basic label-container");const S=v.node().getBBox();n.selectAll(".text").each(($,z,O)=>{var W;const A=ot(O[z]),M=A.attr("transform");let L=0;if(M){const H=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(M);H&&(L=parseFloat(H[2]))}let E=L+b+i-(f?i:o.members.length===0&&o.methods.length===0?-i/2:0);s||(E-=4);let B=x;(A.attr("class").includes("label-group")||A.attr("class").includes("annotation-group"))&&(B=-((W=A.node())==null?void 0:W.getBBox().width)/2||0,n.selectAll("text").each(function(Y,H,ut){window.getComputedStyle(ut[H]).textAnchor==="middle"&&(B=0)})),A.attr("transform",`translate(${B}, ${E})`)});const C=n.select(".annotation-group").node().getBBox().height-(f?i/2:0)||0,T=n.select(".label-group").node().getBBox().height-(f?i/2:0)||0,F=n.select(".members-group").node().getBBox().height-(f?i/2:0)||0;if(o.members.length>0||o.methods.length>0||f){const $=d.line(S.x,C+T+b+i,S.x+S.width,C+T+b+i,g);n.insert(()=>$).attr("class","divider").attr("style",u)}if(f||o.members.length>0||o.methods.length>0){const $=d.line(S.x,C+T+F+b+a*2+i,S.x+S.width,C+T+F+b+i+a*2,g);n.insert(()=>$).attr("class","divider").attr("style",u)}if(o.look!=="handDrawn"&&n.selectAll("path").attr("style",u),v.select(":nth-child(2)").attr("style",u),n.selectAll(".divider").select("path").attr("style",u),t.labelStyle?n.selectAll("span").attr("style",t.labelStyle):n.selectAll("span").attr("style",u),!s){const $=RegExp(/color\s*:\s*([^;]*)/),z=$.exec(u);if(z){const O=z[0].replace("color","fill");n.selectAll("tspan").attr("style",O)}else if(c){const O=$.exec(c);if(O){const A=O[0].replace("color","fill");n.selectAll("tspan").attr("style",A)}}}return Z(t,v),t.intersect=function($){return q.rect(t,$)},n}p(nf,"classBox");async function of(e,t){var C,T;const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const a=t,s=t,o=20,n=20,l="verifyMethod"in t,c=tt(t),h=e.insert("g").attr("class",c).attr("id",t.domId??t.id);let u;l?u=await ye(h,`<<${a.type}>>`,0,t.labelStyle):u=await ye(h,"<<Element>>",0,t.labelStyle);let f=u;const d=await ye(h,a.name,f,t.labelStyle+"; font-weight: bold;");if(f+=d+n,l){const F=await ye(h,`${a.requirementId?`ID: ${a.requirementId}`:""}`,f,t.labelStyle);f+=F;const P=await ye(h,`${a.text?`Text: ${a.text}`:""}`,f,t.labelStyle);f+=P;const R=await ye(h,`${a.risk?`Risk: ${a.risk}`:""}`,f,t.labelStyle);f+=R,await ye(h,`${a.verifyMethod?`Verification: ${a.verifyMethod}`:""}`,f,t.labelStyle)}else{const F=await ye(h,`${s.type?`Type: ${s.type}`:""}`,f,t.labelStyle);f+=F,await ye(h,`${s.docRef?`Doc Ref: ${s.docRef}`:""}`,f,t.labelStyle)}const g=(((C=h.node())==null?void 0:C.getBBox().width)??200)+o,m=(((T=h.node())==null?void 0:T.getBBox().height)??200)+o,y=-g/2,x=-m/2,b=U.svg(h),k=G(t,{});t.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const v=b.rectangle(y,x,g,m,k),S=h.insert(()=>v,":first-child");if(S.attr("class","basic label-container").attr("style",i),h.selectAll(".label").each((F,P,R)=>{const $=ot(R[P]),z=$.attr("transform");let O=0,A=0;if(z){const B=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(z);B&&(O=parseFloat(B[1]),A=parseFloat(B[2]))}const M=A-m/2;let L=y+o/2;(P===0||P===1)&&(L=O),$.attr("transform",`translate(${L}, ${M+o})`)}),f>u+d+n){const F=b.line(y,x+u+d+n,y+g,x+u+d+n,k);h.insert(()=>F).attr("style",i)}return Z(t,S),t.intersect=function(F){return q.rect(t,F)},h}p(of,"requirementBox");async function ye(e,t,r,i=""){if(t==="")return 0;const a=e.insert("g").attr("class","label").attr("style",i),s=pt(),o=s.htmlLabels??!0,n=await Me(a,on(Mr(t)),{width:Ae(t,s)+50,classes:"markdown-node-label",useHtmlLabels:o,style:i},s);let l;if(o){const c=n.children[0],h=ot(n);l=c.getBoundingClientRect(),h.attr("width",l.width),h.attr("height",l.height)}else{const c=n.children[0];for(const h of c.children)h.textContent=h.textContent.replaceAll(">",">").replaceAll("<","{switch(e){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 lf(e,t,{config:r}){var z,O;const{labelStyles:i,nodeStyles:a}=V(t);t.labelStyle=i||"";const s=10,o=t.width;t.width=(t.width??200)-10;const{shapeSvg:n,bbox:l,label:c}=await et(e,t,tt(t)),h=t.padding||10;let u="",f;"ticket"in t&&t.ticket&&((z=r==null?void 0:r.kanban)!=null&&z.ticketBaseUrl)&&(u=(O=r==null?void 0:r.kanban)==null?void 0:O.ticketBaseUrl.replace("#TICKET#",t.ticket),f=n.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",u).attr("target","_blank"));const d={useHtmlLabels:t.useHtmlLabels,labelStyle:t.labelStyle||"",width:t.width,img:t.img,padding:t.padding||8,centerLabel:!1};let g,m;f?{label:g,bbox:m}=await ls(f,"ticket"in t&&t.ticket||"",d):{label:g,bbox:m}=await ls(n,"ticket"in t&&t.ticket||"",d);const{label:y,bbox:x}=await ls(n,"assigned"in t&&t.assigned||"",d);t.width=o;const b=10,k=(t==null?void 0:t.width)||0,v=Math.max(m.height,x.height)/2,S=Math.max(l.height+b*2,(t==null?void 0:t.height)||0)+v,C=-k/2,T=-S/2;c.attr("transform","translate("+(h-k/2)+", "+(-v-l.height/2)+")"),g.attr("transform","translate("+(h-k/2)+", "+(-v+l.height/2)+")"),y.attr("transform","translate("+(h+k/2-x.width-2*s)+", "+(-v+l.height/2)+")");let F;const{rx:P,ry:R}=t,{cssStyles:$}=t;if(t.look==="handDrawn"){const A=U.svg(n),M=G(t,{}),L=P||R?A.path(qe(C,T,k,S,P||0),M):A.rectangle(C,T,k,S,M);F=n.insert(()=>L,":first-child"),F.attr("class","basic label-container").attr("style",$||null)}else{F=n.insert("rect",":first-child"),F.attr("class","basic label-container __APA__").attr("style",a).attr("rx",P??5).attr("ry",R??5).attr("x",C).attr("y",T).attr("width",k).attr("height",S);const A="priority"in t&&t.priority;if(A){const M=n.append("line"),L=C+2,E=T+Math.floor((P??0)/2),B=T+S-Math.floor((P??0)/2);M.attr("x1",L).attr("y1",E).attr("x2",L).attr("y2",B).attr("stroke-width","4").attr("stroke",_b(A))}}return Z(t,F),t.height=S,t.intersect=function(A){return q.rect(t,A)},n}p(lf,"kanbanItem");async function cf(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s,halfPadding:o,label:n}=await et(e,t,tt(t)),l=s.width+10*o,c=s.height+8*o,h=.15*l,{cssStyles:u}=t,f=s.width+20,d=s.height+20,g=Math.max(l,f),m=Math.max(c,d);n.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`);let y;const x=`M0 0
a${h},${h} 1 0,0 ${g*.25},${-1*m*.1}
a${h},${h} 1 0,0 ${g*.25},0
a${h},${h} 1 0,0 ${g*.25},0
a${h},${h} 1 0,0 ${g*.25},${m*.1}
a${h},${h} 1 0,0 ${g*.15},${m*.33}
a${h*.8},${h*.8} 1 0,0 0,${m*.34}
a${h},${h} 1 0,0 ${-1*g*.15},${m*.33}
a${h},${h} 1 0,0 ${-1*g*.25},${m*.15}
a${h},${h} 1 0,0 ${-1*g*.25},0
a${h},${h} 1 0,0 ${-1*g*.25},0
a${h},${h} 1 0,0 ${-1*g*.25},${-1*m*.15}
a${h},${h} 1 0,0 ${-1*g*.1},${-1*m*.33}
a${h*.8},${h*.8} 1 0,0 0,${-1*m*.34}
a${h},${h} 1 0,0 ${g*.1},${-1*m*.33}
H0 V0 Z`;if(t.look==="handDrawn"){const b=U.svg(a),k=G(t,{}),v=b.path(x,k);y=a.insert(()=>v,":first-child"),y.attr("class","basic label-container").attr("style",Nt(u))}else y=a.insert("path",":first-child").attr("class","basic label-container").attr("style",i).attr("d",x);return y.attr("transform",`translate(${-g/2}, ${-m/2})`),Z(t,y),t.calcIntersect=function(b,k){return q.rect(b,k)},t.intersect=function(b){return D.info("Bang intersect",t,b),q.rect(t,b)},a}p(cf,"bang");async function hf(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s,halfPadding:o,label:n}=await et(e,t,tt(t)),l=s.width+2*o,c=s.height+2*o,h=.15*l,u=.25*l,f=.35*l,d=.2*l,{cssStyles:g}=t;let m;const y=`M0 0
a${h},${h} 0 0,1 ${l*.25},${-1*l*.1}
a${f},${f} 1 0,1 ${l*.4},${-1*l*.1}
a${u},${u} 1 0,1 ${l*.35},${l*.2}
a${h},${h} 1 0,1 ${l*.15},${c*.35}
a${d},${d} 1 0,1 ${-1*l*.15},${c*.65}
a${u},${h} 1 0,1 ${-1*l*.25},${l*.15}
a${f},${f} 1 0,1 ${-1*l*.5},0
a${h},${h} 1 0,1 ${-1*l*.25},${-1*l*.15}
a${h},${h} 1 0,1 ${-1*l*.1},${-1*c*.35}
a${d},${d} 1 0,1 ${l*.1},${-1*c*.65}
H0 V0 Z`;if(t.look==="handDrawn"){const x=U.svg(a),b=G(t,{}),k=x.path(y,b);m=a.insert(()=>k,":first-child"),m.attr("class","basic label-container").attr("style",Nt(g))}else m=a.insert("path",":first-child").attr("class","basic label-container").attr("style",i).attr("d",y);return n.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`),m.attr("transform",`translate(${-l/2}, ${-c/2})`),Z(t,m),t.calcIntersect=function(x,b){return q.rect(x,b)},t.intersect=function(x){return D.info("Cloud intersect",t,x),q.rect(t,x)},a}p(hf,"cloud");async function uf(e,t){const{labelStyles:r,nodeStyles:i}=V(t);t.labelStyle=r;const{shapeSvg:a,bbox:s,halfPadding:o,label:n}=await et(e,t,tt(t)),l=s.width+8*o,c=s.height+2*o,h=5,u=`
M${-l/2} ${c/2-h}
v${-c+2*h}
q0,-${h} ${h},-${h}
h${l-2*h}
q${h},0 ${h},${h}
v${c-2*h}
q0,${h} -${h},${h}
h${-l+2*h}
q-${h},0 -${h},-${h}
Z
`,f=a.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+t.type).attr("style",i).attr("d",u);return a.append("line").attr("class","node-line-").attr("x1",-l/2).attr("y1",c/2).attr("x2",l/2).attr("y2",c/2),n.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`),a.append(()=>n.node()),Z(t,f),t.calcIntersect=function(d,g){return q.rect(d,g)},t.intersect=function(d){return q.rect(t,d)},a}p(uf,"defaultMindmapNode");async function df(e,t){const r={padding:t.padding??0};return Wn(e,t,r)}p(df,"mindmapCircle");var wb=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:qd},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:Nd},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:Hd},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:Gd},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:dd},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:Wn},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:cf},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:hf},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:Rd},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:bd},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:Ad},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:Bd},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:Qd},{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:Td},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:pd},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:Zd},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:ad},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:zd},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:Ud},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:Yd},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:yd},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:Cd},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:ld},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:cd},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:hd},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:Md},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:ef},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:xd},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:Kd},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:Ed},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:ud},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:fd},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:tf},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:af},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:gd},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:Jd},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:md},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:Wd},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:Dd},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:Fd},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:id},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:od},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:Xd},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:Vd},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:rf},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:Id},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:$d}],Sb=p(()=>{const t=[...Object.entries({state:jd,choice:sd,note:Od,rectWithTitle:Pd,labelRect:Ld,iconSquare:Sd,iconCircle:_d,icon:kd,iconRounded:wd,imageSquare:vd,anchor:rd,kanbanItem:lf,mindmapCircle:df,defaultMindmapNode:uf,classBox:nf,erBox:qn,requirementBox:of}),...wb.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(a=>[a,r.handler]))];return Object.fromEntries(t)},"generateShapeMap"),ff=Sb();function vb(e){return e in ff}p(vb,"isValidShape");var Da=new Map;async function pf(e,t,r){let i,a;t.shape==="rect"&&(t.rx&&t.ry?t.shape="roundedRect":t.shape="squareRect");const s=t.shape?ff[t.shape]:void 0;if(!s)throw new Error(`No such shape: ${t.shape}. Please check your syntax.`);if(t.link){let o;r.config.securityLevel==="sandbox"?o="_top":t.linkTarget&&(o=t.linkTarget||"_blank"),i=e.insert("svg:a").attr("xlink:href",t.link).attr("target",o??null),a=await s(i,t,r)}else a=await s(e,t,r),i=a;return t.tooltip&&a.attr("title",t.tooltip),Da.set(t.id,i),t.haveCallback&&i.attr("class",i.attr("class")+" clickable"),i}p(pf,"insertNode");var Ik=p((e,t)=>{Da.set(t.id,e)},"setNodeElem"),Pk=p(()=>{Da.clear()},"clear"),Nk=p(e=>{const t=Da.get(e.id);D.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");const r=8,i=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+i-e.width/2)+", "+(e.y-e.height/2-r)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),i},"positionNode"),Tb=p((e,t,r,i,a,s)=>{t.arrowTypeStart&&dl(e,"start",t.arrowTypeStart,r,i,a,s),t.arrowTypeEnd&&dl(e,"end",t.arrowTypeEnd,r,i,a,s)},"addEdgeMarkers"),Lb={arrow_cross:{type:"cross",fill:!1},arrow_point:{type:"point",fill:!0},arrow_barb:{type:"barb",fill:!0},arrow_circle:{type:"circle",fill:!1},aggregation:{type:"aggregation",fill:!1},extension:{type:"extension",fill:!1},composition:{type:"composition",fill:!0},dependency:{type:"dependency",fill:!0},lollipop:{type:"lollipop",fill:!1},only_one:{type:"onlyOne",fill:!1},zero_or_one:{type:"zeroOrOne",fill:!1},one_or_more:{type:"oneOrMore",fill:!1},zero_or_more:{type:"zeroOrMore",fill:!1},requirement_arrow:{type:"requirement_arrow",fill:!1},requirement_contains:{type:"requirement_contains",fill:!1}},dl=p((e,t,r,i,a,s,o)=>{var u;const n=Lb[r];if(!n){D.warn(`Unknown arrow type: ${r}`);return}const l=n.type,h=`${a}_${s}-${l}${t==="start"?"Start":"End"}`;if(o&&o.trim()!==""){const f=o.replace(/[^\dA-Za-z]/g,"_"),d=`${h}_${f}`;if(!document.getElementById(d)){const g=document.getElementById(h);if(g){const m=g.cloneNode(!0);m.id=d,m.querySelectorAll("path, circle, line").forEach(x=>{x.setAttribute("stroke",o),n.fill&&x.setAttribute("fill",o)}),(u=g.parentNode)==null||u.appendChild(m)}}e.attr(`marker-${t}`,`url(${i}#${d})`)}else e.attr(`marker-${t}`,`url(${i}#${h})`)},"addEdgeMarker"),Bb=p(e=>{var t,r;return typeof e=="string"?e:(r=(t=pt())==null?void 0:t.flowchart)==null?void 0:r.curve},"resolveEdgeCurveType"),ya=new Map,Ft=new Map,zk=p(()=>{ya.clear(),Ft.clear()},"clear"),Ur=p(e=>e?typeof e=="string"?e:e.reduce((t,r)=>t+";"+r,""):"","getLabelStyles"),Ab=p(async(e,t)=>{const r=pt();let i=zt(r);const{labelStyles:a}=V(t);t.labelStyle=a;const s=e.insert("g").attr("class","edgeLabel"),o=s.insert("g").attr("class","label").attr("data-id",t.id),n=t.labelType==="markdown",c=await Me(e,t.label,{style:Ur(t.labelStyle),useHtmlLabels:i,addSvgBackground:!0,isNode:!1,markdown:n,width:n?void 0:void 0},r);o.node().appendChild(c),D.info("abc82",t,t.labelType);let h=c.getBBox(),u=h;if(i){const d=c.children[0],g=ot(c);h=d.getBoundingClientRect(),u=h,g.attr("width",h.width),g.attr("height",h.height)}else{const d=ot(c).select("text").node();d&&typeof d.getBBox=="function"&&(u=d.getBBox())}o.attr("transform",Wr(u,i)),ya.set(t.id,s),t.width=h.width,t.height=h.height;let f;if(t.startLabelLeft){const d=e.insert("g").attr("class","edgeTerminals"),g=d.insert("g").attr("class","inner"),m=await De(g,t.startLabelLeft,Ur(t.labelStyle)||"",!1,!1);f=m;let y=m.getBBox();if(i){const x=m.children[0],b=ot(m);y=x.getBoundingClientRect(),b.attr("width",y.width),b.attr("height",y.height)}g.attr("transform",Wr(y,i)),Ft.get(t.id)||Ft.set(t.id,{}),Ft.get(t.id).startLeft=d,Kr(f,t.startLabelLeft)}if(t.startLabelRight){const d=e.insert("g").attr("class","edgeTerminals"),g=d.insert("g").attr("class","inner"),m=await De(g,t.startLabelRight,Ur(t.labelStyle)||"",!1,!1);f=m,g.node().appendChild(m);let y=m.getBBox();if(i){const x=m.children[0],b=ot(m);y=x.getBoundingClientRect(),b.attr("width",y.width),b.attr("height",y.height)}g.attr("transform",Wr(y,i)),Ft.get(t.id)||Ft.set(t.id,{}),Ft.get(t.id).startRight=d,Kr(f,t.startLabelRight)}if(t.endLabelLeft){const d=e.insert("g").attr("class","edgeTerminals"),g=d.insert("g").attr("class","inner"),m=await De(g,t.endLabelLeft,Ur(t.labelStyle)||"",!1,!1);f=m;let y=m.getBBox();if(i){const x=m.children[0],b=ot(m);y=x.getBoundingClientRect(),b.attr("width",y.width),b.attr("height",y.height)}g.attr("transform",Wr(y,i)),d.node().appendChild(m),Ft.get(t.id)||Ft.set(t.id,{}),Ft.get(t.id).endLeft=d,Kr(f,t.endLabelLeft)}if(t.endLabelRight){const d=e.insert("g").attr("class","edgeTerminals"),g=d.insert("g").attr("class","inner"),m=await De(g,t.endLabelRight,Ur(t.labelStyle)||"",!1,!1);f=m;let y=m.getBBox();if(i){const x=m.children[0],b=ot(m);y=x.getBoundingClientRect(),b.attr("width",y.width),b.attr("height",y.height)}g.attr("transform",Wr(y,i)),d.node().appendChild(m),Ft.get(t.id)||Ft.set(t.id,{}),Ft.get(t.id).endRight=d,Kr(f,t.endLabelRight)}return c},"insertEdgeLabel");function Kr(e,t){zt(pt())&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}p(Kr,"setTerminalWidth");var Mb=p((e,t)=>{D.debug("Moving label abc88 ",e.id,e.label,ya.get(e.id),t);let r=t.updatedPath?t.updatedPath:t.originalPath;const i=pt(),{subGraphTitleTotalMargin:a}=Bn(i);if(e.label){const s=ya.get(e.id);let o=e.x,n=e.y;if(r){const l=ce.calcLabelPosition(r);D.debug("Moving label "+e.label+" from (",o,",",n,") to (",l.x,",",l.y,") abc88"),t.updatedPath&&(o=l.x,n=l.y)}s.attr("transform",`translate(${o}, ${n+a/2})`)}if(e.startLabelLeft){const s=Ft.get(e.id).startLeft;let o=e.x,n=e.y;if(r){const l=ce.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);o=l.x,n=l.y}s.attr("transform",`translate(${o}, ${n})`)}if(e.startLabelRight){const s=Ft.get(e.id).startRight;let o=e.x,n=e.y;if(r){const l=ce.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);o=l.x,n=l.y}s.attr("transform",`translate(${o}, ${n})`)}if(e.endLabelLeft){const s=Ft.get(e.id).endLeft;let o=e.x,n=e.y;if(r){const l=ce.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);o=l.x,n=l.y}s.attr("transform",`translate(${o}, ${n})`)}if(e.endLabelRight){const s=Ft.get(e.id).endRight;let o=e.x,n=e.y;if(r){const l=ce.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);o=l.x,n=l.y}s.attr("transform",`translate(${o}, ${n})`)}},"positionEdgeLabel"),Eb=p((e,t)=>{const r=e.x,i=e.y,a=Math.abs(t.x-r),s=Math.abs(t.y-i),o=e.width/2,n=e.height/2;return a>=o||s>=n},"outsideNode"),$b=p((e,t,r)=>{D.debug(`intersection calc abc89:
outsidePoint: ${JSON.stringify(t)}
insidePoint : ${JSON.stringify(r)}
node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const i=e.x,a=e.y,s=Math.abs(i-r.x),o=e.width/2;let n=r.xMath.abs(i-t.x)*l){let u=r.y{D.warn("abc88 cutPathAtIntersect",e,t);let r=[],i=e[0],a=!1;return e.forEach(s=>{if(D.info("abc88 checking point",s,t),!Eb(t,s)&&!a){const o=$b(t,i,s);D.debug("abc88 inside",s,i,o),D.debug("abc88 intersection",o,t);let n=!1;r.forEach(l=>{n=n||l.x===o.x&&l.y===o.y}),r.some(l=>l.x===o.x&&l.y===o.y)?D.warn("abc88 no intersect",o,r):r.push(o),a=!0}else D.warn("abc88 outside",s,i),i=s,a||r.push(s)}),D.debug("returning points",r),r},"cutPathAtIntersect");function gf(e){const t=[],r=[];for(let i=1;i5&&Math.abs(s.y-a.y)>5||a.y===s.y&&s.x===o.x&&Math.abs(s.x-a.x)>5&&Math.abs(s.y-o.y)>5)&&(t.push(s),r.push(i))}return{cornerPoints:t,cornerPointPositions:r}}p(gf,"extractCornerPoints");var pl=p(function(e,t,r){const i=t.x-e.x,a=t.y-e.y,s=Math.sqrt(i*i+a*a),o=r/s;return{x:t.x-o*i,y:t.y-o*a}},"findAdjacentPoint"),Fb=p(function(e){const{cornerPointPositions:t}=gf(e),r=[];for(let i=0;i10&&Math.abs(s.y-a.y)>=10){D.debug("Corner point fixing",Math.abs(s.x-a.x),Math.abs(s.y-a.y));const d=5;o.x===n.x?f={x:c{const i=e-t-r,a=2,s=2,o=a+s,n=Math.floor(i/o),l=Array(n).fill(`${a} ${s}`).join(" ");return`0 ${t} ${l} ${r}`},"generateDashArray"),Ob=p(function(e,t,r,i,a,s,o,n=!1){var L;const{handDrawnSeed:l}=pt();let c=t.points,h=!1;const u=a;var f=s;const d=[];for(const E in t.cssCompiledStyles)pu(E)||d.push(t.cssCompiledStyles[E]);D.debug("UIO intersect check",t.points,f.x,u.x),f.intersect&&u.intersect&&!n&&(c=c.slice(1,t.points.length-1),c.unshift(u.intersect(c[0])),D.debug("Last point UIO",t.start,"-->",t.end,c[c.length-1],f,f.intersect(c[c.length-1])),c.push(f.intersect(c[c.length-1])));const g=btoa(JSON.stringify(c));t.toCluster&&(D.info("to cluster abc88",r.get(t.toCluster)),c=fl(t.points,r.get(t.toCluster).node),h=!0),t.fromCluster&&(D.debug("from cluster abc88",r.get(t.fromCluster),JSON.stringify(c,null,2)),c=fl(c.reverse(),r.get(t.fromCluster).node).reverse(),h=!0);let m=c.filter(E=>!Number.isNaN(E.y));const y=Bb(t.curve);y!=="rounded"&&(m=Fb(m));let x=ri;switch(y){case"linear":x=ri;break;case"basis":x=Cs;break;case"cardinal":x=ic;break;case"bumpX":x=Ql;break;case"bumpY":x=Jl;break;case"catmullRom":x=sc;break;case"monotoneX":x=uc;break;case"monotoneY":x=dc;break;case"natural":x=pc;break;case"step":x=gc;break;case"stepAfter":x=yc;break;case"stepBefore":x=mc;break;case"rounded":x=ri;break;default:x=Cs}const{x:b,y:k}=F0(t),v=mm().x(b).y(k).curve(x);let S;switch(t.thickness){case"normal":S="edge-thickness-normal";break;case"thick":S="edge-thickness-thick";break;case"invisible":S="edge-thickness-invisible";break;default:S="edge-thickness-normal"}switch(t.pattern){case"solid":S+=" edge-pattern-solid";break;case"dotted":S+=" edge-pattern-dotted";break;case"dashed":S+=" edge-pattern-dashed";break;default:S+=" edge-pattern-solid"}let C,T=y==="rounded"?mf(yf(m,t),5):v(m);const F=Array.isArray(t.style)?t.style:[t.style];let P=F.find(E=>E==null?void 0:E.startsWith("stroke:")),R="";t.animate&&(R="edge-animation-fast"),t.animation&&(R="edge-animation-"+t.animation);let $=!1;if(t.look==="handDrawn"){const E=U.svg(e);Object.assign([],m);const B=E.path(T,{roughness:.3,seed:l});S+=" transition",C=ot(B).select("path").attr("id",t.id).attr("class"," "+S+(t.classes?" "+t.classes:"")+(R?" "+R:"")).attr("style",F?F.reduce((Y,H)=>Y+";"+H,""):"");let W=C.attr("d");C.attr("d",W),e.node().appendChild(C.node())}else{const E=d.join(";"),B=F?F.reduce((xt,st)=>xt+st+";",""):"",W=(E?E+";"+B+";":B)+";"+(F?F.reduce((xt,st)=>xt+";"+st,""):"");C=e.append("path").attr("d",T).attr("id",t.id).attr("class"," "+S+(t.classes?" "+t.classes:"")+(R?" "+R:"")).attr("style",W),P=(L=W.match(/stroke:([^;]+)/))==null?void 0:L[1],$=t.animate===!0||!!t.animation||E.includes("animation");const Y=C.node(),H=typeof Y.getTotalLength=="function"?Y.getTotalLength():0,ut=Po[t.arrowTypeStart]||0,at=Po[t.arrowTypeEnd]||0;if(t.look==="neo"&&!$){const st=`stroke-dasharray: ${t.pattern==="dotted"||t.pattern==="dashed"?Db(H,ut,at):`0 ${ut} ${H-ut-at} ${at}`}; stroke-dashoffset: 0;`;C.attr("style",st+C.attr("style"))}}C.attr("data-edge",!0),C.attr("data-et","edge"),C.attr("data-id",t.id),C.attr("data-points",g),t.showPoints&&m.forEach(E=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",E.x).attr("cy",E.y)});let z="";(pt().flowchart.arrowMarkerAbsolute||pt().state.arrowMarkerAbsolute)&&(z=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,z=z.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),D.info("arrowTypeStart",t.arrowTypeStart),D.info("arrowTypeEnd",t.arrowTypeEnd),Tb(C,t,z,o,i,P);const O=Math.floor(c.length/2),A=c[O];ce.isLabelCoordinateInPath(A,C.attr("d"))||(h=!0);let M={};return h&&(M.updatedPath=c),M.originalPath=t.points,M},"insertEdge");function mf(e,t){if(e.length({...a}));if(e.length>=2&&Rt[t.arrowTypeStart]){const a=Rt[t.arrowTypeStart],s=e[0],o=e[1],{angle:n}=Vs(s,o),l=a*Math.cos(n),c=a*Math.sin(n);r[0].x=s.x+l,r[0].y=s.y+c}const i=e.length;if(i>=2&&Rt[t.arrowTypeEnd]){const a=Rt[t.arrowTypeEnd],s=e[i-1],o=e[i-2],{angle:n}=Vs(o,s),l=a*Math.cos(n),c=a*Math.sin(n);r[i-1].x=s.x-l,r[i-1].y=s.y-c}return r}p(yf,"applyMarkerOffsetsToPoints");var Rb=p((e,t,r,i)=>{t.forEach(a=>{Qb[a](e,r,i)})},"insertMarkers"),Ib=p((e,t,r)=>{D.trace("Making markers for ",r),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),Pb=p((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),Nb=p((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),zb=p((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),Wb=p((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),qb=p((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),Hb=p((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),jb=p((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),Yb=p((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),Ub=p((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneStart").attr("class","marker onlyOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneEnd").attr("class","marker onlyOne "+t).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),Gb=p((e,t,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneStart").attr("class","marker zeroOrOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),i.append("path").attr("d","M9,0 L9,18");const a=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+t).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");a.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),a.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),Vb=p((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreStart").attr("class","marker oneOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreEnd").attr("class","marker oneOrMore "+t).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),Xb=p((e,t,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),i.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");const a=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+t).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");a.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),a.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),Zb=p((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
L20,10
M20,10
L0,20`)},"requirement_arrow"),Kb=p((e,t,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),Qb={extension:Ib,composition:Pb,aggregation:Nb,dependency:zb,lollipop:Wb,point:qb,circle:Hb,cross:jb,barb:Yb,only_one:Ub,zero_or_one:Gb,one_or_more:Vb,zero_or_more:Xb,requirement_arrow:Zb,requirement_contains:Kb},Jb=Rb,t1={common:pi,getConfig:It,insertCluster:nb,insertEdge:Ob,insertEdgeLabel:Ab,insertMarkers:Jb,insertNode:pf,interpolateToCurve:_n,labelHelper:et,log:D,positionEdgeLabel:Mb},hi={},xf=p(e=>{for(const t of e)hi[t.name]=t},"registerLayoutLoaders"),e1=p(()=>{xf([{name:"dagre",loader:p(async()=>await dt(()=>import("./D3y9anC-.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),import.meta.url),"loader")},{name:"cose-bilkent",loader:p(async()=>await dt(()=>import("./CwQYcPXW.js"),__vite__mapDeps([18,19,20,21]),import.meta.url),"loader")}])},"registerDefaultLayoutLoaders");e1();var Wk=p(async(e,t)=>{if(!(e.layoutAlgorithm in hi))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const r=hi[e.layoutAlgorithm];return(await r.loader()).render(e,t,t1,{algorithm:r.algorithm})},"render"),qk=p((e="",{fallback:t="dagre"}={})=>{if(e in hi)return e;if(t in hi)return D.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),bf="comm",Cf="rule",kf="decl",r1="@import",i1="@namespace",a1="@keyframes",s1="@layer",_f=Math.abs,Hn=String.fromCharCode;function wf(e){return e.trim()}function Yi(e,t,r){return e.replace(t,r)}function n1(e,t,r){return e.indexOf(t,r)}function gr(e,t){return e.charCodeAt(t)|0}function Br(e,t,r){return e.slice(t,r)}function xe(e){return e.length}function o1(e){return e.length}function Di(e,t){return t.push(e),e}var Oa=1,Ar=1,Sf=0,se=0,Tt=0,Fr="";function jn(e,t,r,i,a,s,o,n){return{value:e,root:t,parent:r,type:i,props:a,children:s,line:Oa,column:Ar,length:o,return:"",siblings:n}}function l1(){return Tt}function c1(){return Tt=se>0?gr(Fr,--se):0,Ar--,Tt===10&&(Ar=1,Oa--),Tt}function ue(){return Tt=se2||ui(Tt)>3?"":" "}function f1(e,t){for(;--t&&ue()&&!(Tt102||Tt>57&&Tt70&&Tt0&&(xe(T)-u||m===0&&g===47)&&Di(d>32?ml(T+";",i,r,u-1,l):ml(Yi(T," ","")+";",i,r,u-2,l),l);break;case 59:T+=";";default:if(Di(C=gl(T,t,r,c,h,a,n,k,v=[],S=[],u,s),s),b===123)if(h===0)Gi(T,t,C,C,v,s,u,n,S);else{switch(f){case 99:if(gr(T,3)===110)break;case 108:if(gr(T,2)===97)break;default:h=0;case 100:case 109:case 115:}h?Gi(e,C,C,i&&Di(gl(e,C,C,0,0,a,n,k,a,v=[],u,S),S),a,S,u,n,i?v:S):Gi(T,C,C,C,[""],S,0,n,S)}}c=h=d=0,m=x=1,k=T="",u=o;break;case 58:u=1+xe(T),d=g;default:if(m0?1:(T+="\f",-1);break;case 44:n[c++]=(xe(T)-1)*x,x=1;break;case 64:Oe()===45&&(T+=cs(ue())),f=Oe(),h=u=xe(k=T+=g1(Ui())),b++;break;case 45:g===45&&xe(T)==2&&(m=0)}}return s}function gl(e,t,r,i,a,s,o,n,l,c,h,u){for(var f=a-1,d=a===0?s:[""],g=o1(d),m=0,y=0,x=0;m0?d[b]+" "+k:Yi(k,/&\f/g,d[b])))&&(l[x++]=v);return jn(e,t,r,a===0?Cf:n,l,c,h,u)}function y1(e,t,r,i){return jn(e,t,r,bf,Hn(l1()),Br(e,2,-2),0,i)}function ml(e,t,r,i,a){return jn(e,t,r,kf,Br(e,0,i),Br(e,i+1,-1),i,a)}function Zs(e,t){for(var r="",i=0;i/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),C1=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./612YmpMR.js");return{diagram:t}},__vite__mapDeps([22,23,21]),import.meta.url);return{id:vf,diagram:e}},"loader"),k1={id:vf,detector:b1,loader:C1},_1=k1,Tf="flowchart",w1=p((e,t)=>{var r,i;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),S1=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./CoHvh17m.js");return{diagram:t}},__vite__mapDeps([24,25,23,21,26,27,28]),import.meta.url);return{id:Tf,diagram:e}},"loader"),v1={id:Tf,detector:w1,loader:S1},T1=v1,Lf="flowchart-v2",L1=p((e,t)=>{var r,i,a;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&((a=t==null?void 0:t.flowchart)==null?void 0:a.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),B1=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./CoHvh17m.js");return{diagram:t}},__vite__mapDeps([24,25,23,21,26,27,28]),import.meta.url);return{id:Lf,diagram:e}},"loader"),A1={id:Lf,detector:L1,loader:B1},M1=A1,Bf="er",E1=p(e=>/^\s*erDiagram/.test(e),"detector"),$1=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./By9IZPwN.js");return{diagram:t}},__vite__mapDeps([29,26,21,27,28]),import.meta.url);return{id:Bf,diagram:e}},"loader"),F1={id:Bf,detector:E1,loader:$1},D1=F1,Af="gitGraph",O1=p(e=>/^\s*gitGraph/.test(e),"detector"),R1=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./BDG18TR1.js");return{diagram:t}},__vite__mapDeps([30,31,32,33,34,6,5,4,7,2,3,8,9,14,10,11,15,35,12,17,20,21]),import.meta.url);return{id:Af,diagram:e}},"loader"),I1={id:Af,detector:O1,loader:R1},P1=I1,Mf="gantt",N1=p(e=>/^\s*gantt/.test(e),"detector"),z1=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./DnSL_6N-.js");return{diagram:t}},__vite__mapDeps([36,20,21,37,38,39,40]),import.meta.url);return{id:Mf,diagram:e}},"loader"),W1={id:Mf,detector:N1,loader:z1},q1=W1,Ef="info",H1=p(e=>/^\s*info/.test(e),"detector"),j1=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./CdMvPzYr.js");return{diagram:t}},__vite__mapDeps([41,33,34,6,5,4,7,2,3,8,9,14,10,11,15,35,12,17,20]),import.meta.url);return{id:Ef,diagram:e}},"loader"),Y1={id:Ef,detector:H1,loader:j1},$f="pie",U1=p(e=>/^\s*pie/.test(e),"detector"),G1=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./qJA_R-Pe.js");return{diagram:t}},__vite__mapDeps([42,31,33,34,6,5,4,7,2,3,8,9,14,10,11,15,35,12,17,20,21,43,44,39]),import.meta.url);return{id:$f,diagram:e}},"loader"),V1={id:$f,detector:U1,loader:G1},Ff="quadrantChart",X1=p(e=>/^\s*quadrantChart/.test(e),"detector"),Z1=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./SYUzGyh8.js");return{diagram:t}},__vite__mapDeps([45,21,37,38,39,40]),import.meta.url);return{id:Ff,diagram:e}},"loader"),K1={id:Ff,detector:X1,loader:Z1},Q1=K1,Df="xychart",J1=p(e=>/^\s*xychart(-beta)?/.test(e),"detector"),t2=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./Cl9g7VsS.js");return{diagram:t}},__vite__mapDeps([46,21,39,44,37,38,40]),import.meta.url);return{id:Df,diagram:e}},"loader"),e2={id:Df,detector:J1,loader:t2},r2=e2,Of="requirement",i2=p(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),a2=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./BNl0h4eM.js");return{diagram:t}},__vite__mapDeps([47,26,21,27]),import.meta.url);return{id:Of,diagram:e}},"loader"),s2={id:Of,detector:i2,loader:a2},n2=s2,Rf="sequence",o2=p(e=>/^\s*sequenceDiagram/.test(e),"detector"),l2=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./CGIUakMK.js");return{diagram:t}},__vite__mapDeps([48,23,21,32]),import.meta.url);return{id:Rf,diagram:e}},"loader"),c2={id:Rf,detector:o2,loader:l2},h2=c2,If="class",u2=p((e,t)=>{var r;return((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),d2=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./BwATMaV-.js");return{diagram:t}},__vite__mapDeps([49,50,25,23,21,26,27]),import.meta.url);return{id:If,diagram:e}},"loader"),f2={id:If,detector:u2,loader:d2},p2=f2,Pf="classDiagram",g2=p((e,t)=>{var r;return/^\s*classDiagram/.test(e)&&((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),m2=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./B_22ZBxV.js");return{diagram:t}},__vite__mapDeps([51,50,25,23,21,26,27]),import.meta.url);return{id:Pf,diagram:e}},"loader"),y2={id:Pf,detector:g2,loader:m2},x2=y2,Nf="state",b2=p((e,t)=>{var r;return((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),C2=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./apjT66B3.js");return{diagram:t}},__vite__mapDeps([52,53,26,21,27,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url);return{id:Nf,diagram:e}},"loader"),k2={id:Nf,detector:b2,loader:C2},_2=k2,zf="stateDiagram",w2=p((e,t)=>{var r;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),S2=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./gdiYiKWA.js");return{diagram:t}},__vite__mapDeps([54,53,26,21,27]),import.meta.url);return{id:zf,diagram:e}},"loader"),v2={id:zf,detector:w2,loader:S2},T2=v2,Wf="journey",L2=p(e=>/^\s*journey/.test(e),"detector"),B2=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./DofzlwI6.js");return{diagram:t}},__vite__mapDeps([55,25,23,21,43]),import.meta.url);return{id:Wf,diagram:e}},"loader"),A2={id:Wf,detector:L2,loader:B2},M2=A2,E2=p((e,t,r)=>{D.debug(`rendering svg for syntax error
`);const i=vm(t),a=i.append("g");i.attr("viewBox","0 0 2412 512"),Gl(i,100,512,!0),a.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),a.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),a.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),a.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),a.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),a.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),a.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),a.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),qf={draw:E2},$2=qf,F2={db:{},renderer:qf,parser:{parse:p(()=>{},"parse")}},D2=F2,Hf="flowchart-elk",O2=p((e,t={})=>{var r;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(t.layout="elk",!0):!1},"detector"),R2=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./CoHvh17m.js");return{diagram:t}},__vite__mapDeps([24,25,23,21,26,27,28]),import.meta.url);return{id:Hf,diagram:e}},"loader"),I2={id:Hf,detector:O2,loader:R2},P2=I2,jf="timeline",N2=p(e=>/^\s*timeline/.test(e),"detector"),z2=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./D_SpOcGe.js");return{diagram:t}},__vite__mapDeps([56,21,43]),import.meta.url);return{id:jf,diagram:e}},"loader"),W2={id:jf,detector:N2,loader:z2},q2=W2,Yf="mindmap",H2=p(e=>/^\s*mindmap/.test(e),"detector"),j2=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./mDtrOgU0.js");return{diagram:t}},__vite__mapDeps([57,26,21,27]),import.meta.url);return{id:Yf,diagram:e}},"loader"),Y2={id:Yf,detector:H2,loader:j2},U2=Y2,Uf="kanban",G2=p(e=>/^\s*kanban/.test(e),"detector"),V2=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./1hSgGEa5.js");return{diagram:t}},__vite__mapDeps([58,25]),import.meta.url);return{id:Uf,diagram:e}},"loader"),X2={id:Uf,detector:G2,loader:V2},Z2=X2,Gf="sankey",K2=p(e=>/^\s*sankey(-beta)?/.test(e),"detector"),Q2=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./CD7AgA-4.js");return{diagram:t}},__vite__mapDeps([59,21,44,39]),import.meta.url);return{id:Gf,diagram:e}},"loader"),J2={id:Gf,detector:K2,loader:Q2},tC=J2,Vf="packet",eC=p(e=>/^\s*packet(-beta)?/.test(e),"detector"),rC=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./kQcK2Dy-.js");return{diagram:t}},__vite__mapDeps([60,31,33,34,6,5,4,7,2,3,8,9,14,10,11,15,35,12,17,20]),import.meta.url);return{id:Vf,diagram:e}},"loader"),iC={id:Vf,detector:eC,loader:rC},Xf="radar",aC=p(e=>/^\s*radar-beta/.test(e),"detector"),sC=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./Dbe2mv4M.js");return{diagram:t}},__vite__mapDeps([61,31,33,34,6,5,4,7,2,3,8,9,14,10,11,15,35,12,17,20]),import.meta.url);return{id:Xf,diagram:e}},"loader"),nC={id:Xf,detector:aC,loader:sC},Zf="block",oC=p(e=>/^\s*block(-beta)?/.test(e),"detector"),lC=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./DByjOOMR.js");return{diagram:t}},__vite__mapDeps([62,25,17,10,2,3,4,5,6,7,8,9,11,21,1,12,28]),import.meta.url);return{id:Zf,diagram:e}},"loader"),cC={id:Zf,detector:oC,loader:lC},hC=cC,Kf="architecture",uC=p(e=>/^\s*architecture/.test(e),"detector"),dC=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./CsbKBAC5.js");return{diagram:t}},__vite__mapDeps([63,31,33,34,6,5,4,7,2,3,8,9,14,10,11,15,35,12,17,20,19,21]),import.meta.url);return{id:Kf,diagram:e}},"loader"),fC={id:Kf,detector:uC,loader:dC},pC=fC,Qf="ishikawa",gC=p(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),mC=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./WeAufMtV.js");return{diagram:t}},[],import.meta.url);return{id:Qf,diagram:e}},"loader"),yC={id:Qf,detector:gC,loader:mC},Jf="venn",xC=p(e=>/^\s*venn-beta/.test(e),"detector"),bC=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./CvRRIfj-.js");return{diagram:t}},__vite__mapDeps([64,21]),import.meta.url);return{id:Jf,diagram:e}},"loader"),CC={id:Jf,detector:xC,loader:bC},kC=CC,tp="treemap",_C=p(e=>/^\s*treemap/.test(e),"detector"),wC=p(async()=>{const{diagram:e}=await dt(async()=>{const{diagram:t}=await import("./dQZt1brs.js");return{diagram:t}},__vite__mapDeps([65,27,31,33,34,6,5,4,7,2,3,8,9,14,10,11,15,35,12,17,20,21,40,44,39]),import.meta.url);return{id:tp,diagram:e}},"loader"),SC={id:tp,detector:_C,loader:wC},yl=!1,Ia=p(()=>{yl||(yl=!0,Qi("error",D2,e=>e.toLowerCase().trim()==="error"),Qi("---",{db:{clear:p(()=>{},"clear")},styles:{},renderer:{draw:p(()=>{},"draw")},parser:{parse:p(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:p(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),fs(P2,U2,pC),fs(_1,Z2,x2,p2,D1,q1,Y1,V1,n2,h2,M1,T1,q2,P1,T2,_2,M2,Q1,tC,iC,r2,hC,nC,yC,SC,kC))},"addDiagrams"),vC=p(async()=>{D.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(Qe).map(async([r,{detector:i,loader:a}])=>{if(a)try{ys(r)}catch{try{const{diagram:s,id:o}=await a();Qi(o,s,i)}catch(s){throw D.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete Qe[r],s}}}))).filter(r=>r.status==="rejected");if(t.length>0){D.error(`Failed to load ${t.length} external diagrams`);for(const r of t)D.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),TC="graphics-document document";function ep(e,t){e.attr("role",TC),t!==""&&e.attr("aria-roledescription",t)}p(ep,"setA11yDiagramInfo");function rp(e,t,r,i){if(e.insert!==void 0){if(r){const a=`chart-desc-${i}`;e.attr("aria-describedby",a),e.insert("desc",":first-child").attr("id",a).text(r)}if(t){const a=`chart-title-${i}`;e.attr("aria-labelledby",a),e.insert("title",":first-child").attr("id",a).text(t)}}}p(rp,"addSVGa11yTitleDescription");var Ke,Ks=(Ke=class{constructor(t,r,i,a,s){this.type=t,this.text=r,this.db=i,this.parser=a,this.renderer=s}static async fromText(t,r={}){var c,h;const i=It(),a=en(t,i);t=Ty(t)+`
`;try{ys(a)}catch{const u=mg(a);if(!u)throw new Fl(`Diagram ${a} not found.`);const{id:f,diagram:d}=await u();Qi(f,d)}const{db:s,parser:o,renderer:n,init:l}=ys(a);return o.parser&&(o.parser.yy=s),(c=s.clear)==null||c.call(s),l==null||l(i),r.title&&((h=s.setDiagramTitle)==null||h.call(s,r.title)),await o.parse(t),new Ke(a,t,s,o,n)}async render(t,r){await this.renderer.draw(this.text,t,r,this)}getParser(){return this.parser}getType(){return this.type}},p(Ke,"Diagram"),Ke),xl=[],LC=p(()=>{xl.forEach(e=>{e()}),xl=[]},"attachFunctions"),BC=p(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function ip(e){const t=e.match($l);if(!t)return{text:e,metadata:{}};let r=$0(t[1],{schema:E0})??{};r=typeof r=="object"&&!Array.isArray(r)?r:{};const i={};return r.displayMode&&(i.displayMode=r.displayMode.toString()),r.title&&(i.title=r.title.toString()),r.config&&(i.config=r.config),{text:e.slice(t[0].length),metadata:i}}p(ip,"extractFrontMatter");var AC=p(e=>e.replace(/\r\n?/g,`
`).replace(/]*)>/g,(t,r,i)=>""),"cleanupText"),MC=p(e=>{const{text:t,metadata:r}=ip(e),{displayMode:i,title:a,config:s={}}=r;return i&&(s.gantt||(s.gantt={}),s.gantt.displayMode=i),{title:a,config:s,text:t}},"processFrontmatter"),EC=p(e=>{const t=ce.detectInit(e)??{},r=ce.detectDirective(e,"wrap");return Array.isArray(r)?t.wrap=r.some(({type:i})=>i==="wrap"):(r==null?void 0:r.type)==="wrap"&&(t.wrap=!0),{text:fy(e),directive:t}},"processDirectives");function Yn(e){const t=AC(e),r=MC(t),i=EC(r.text),a=Ln(r.config,i.directive);return e=BC(i.text),{code:e,title:r.title,config:a}}p(Yn,"preprocessDiagram");function ap(e){const t=new TextEncoder().encode(e),r=Array.from(t,i=>String.fromCodePoint(i)).join("");return btoa(r)}p(ap,"toBase64");var $C=5e4,FC="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",DC="sandbox",OC="loose",RC="http://www.w3.org/2000/svg",IC="http://www.w3.org/1999/xlink",PC="http://www.w3.org/1999/xhtml",NC="100%",zC="100%",WC="border:0;margin:0;",qC="margin:0",HC="allow-top-navigation-by-user-activation allow-popups",jC='The "iframe" tag is not supported by your browser.',YC=["foreignobject"],UC=["dominant-baseline"];function Un(e){const t=Yn(e);return Zi(),$g(t.config??{}),t}p(Un,"processAndSetConfigs");async function sp(e,t){Ia();try{const{code:r,config:i}=Un(e);return{diagramType:(await op(r)).type,config:i}}catch(r){if(t!=null&&t.suppressErrors)return!1;throw r}}p(sp,"parse");var bl=p((e,t,r=[])=>`
.${e} ${t} { ${r.join(" !important; ")} !important; }`,"cssImportantStyles"),GC=p((e,t=new Map)=>{let r="";if(e.themeCSS!==void 0&&(r+=`
${e.themeCSS}`),e.fontFamily!==void 0&&(r+=`
:root { --mermaid-font-family: ${e.fontFamily}}`),e.altFontFamily!==void 0&&(r+=`
:root { --mermaid-alt-font-family: ${e.altFontFamily}}`),t instanceof Map){const o=zt(e)?["> *","span"]:["rect","polygon","ellipse","circle","path"];t.forEach(n=>{go(n.styles)||o.forEach(l=>{r+=bl(n.id,l,n.styles)}),go(n.textStyles)||(r+=bl(n.id,"tspan",((n==null?void 0:n.textStyles)||[]).map(l=>l.replace("color","fill"))))})}return r},"createCssStyles"),VC=p((e,t,r,i)=>{const a=GC(e,r),s=Kg(t,a,e.themeVariables);return Zs(m1(`${i}{${s}}`),x1)},"createUserStyles"),XC=p((e="",t,r)=>{let i=e;return!r&&!t&&(i=i.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),i=Mr(i),i=i.replace(/
/g,"
"),i},"cleanUpSvgCode"),ZC=p((e="",t)=>{var a,s;const r=(s=(a=t==null?void 0:t.viewBox)==null?void 0:a.baseVal)!=null&&s.height?t.viewBox.baseVal.height+"px":zC,i=ap(`${e}`);return``},"putIntoIFrame"),Cl=p((e,t,r,i,a)=>{const s=e.append("div");s.attr("id",r),i&&s.attr("style",i);const o=s.append("svg").attr("id",t).attr("width","100%").attr("xmlns",RC);return a&&o.attr("xmlns:xlink",a),o.append("g"),e},"appendDivSvgG");function Qs(e,t){return e.append("iframe").attr("id",t).attr("style","width: 100%; height: 100%;").attr("sandbox","")}p(Qs,"sandboxedIframe");var KC=p((e,t,r,i)=>{var a,s,o;(a=e.getElementById(t))==null||a.remove(),(s=e.getElementById(r))==null||s.remove(),(o=e.getElementById(i))==null||o.remove()},"removeExistingElements"),QC=p(async function(e,t,r){var z,O,A,M,L,E;Ia();const i=Un(t);t=i.code;const a=It();D.debug(a),t.length>((a==null?void 0:a.maxTextSize)??$C)&&(t=FC);const s="#"+e,o="i"+e,n="#"+o,l="d"+e,c="#"+l,h=p(()=>{const W=ot(f?n:c).node();W&&"remove"in W&&W.remove()},"removeTempElements");let u=ot("body");const f=a.securityLevel===DC,d=a.securityLevel===OC,g=a.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),f){const B=Qs(ot(r),o);u=ot(B.nodes()[0].contentDocument.body),u.node().style.margin=0}else u=ot(r);Cl(u,e,l,`font-family: ${g}`,IC)}else{if(KC(document,e,l,o),f){const B=Qs(ot("body"),o);u=ot(B.nodes()[0].contentDocument.body),u.node().style.margin=0}else u=ot("body");Cl(u,e,l)}let m,y;try{m=await Ks.fromText(t,{title:i.title})}catch(B){if(a.suppressErrorRendering)throw h(),B;m=await Ks.fromText("error"),y=B}const x=u.select(c).node(),b=m.type,k=x.firstChild,v=k.firstChild,S=(O=(z=m.renderer).getClasses)==null?void 0:O.call(z,t,m),C=VC(a,b,S,s),T=document.createElement("style");T.innerHTML=C,k.insertBefore(T,v);try{await m.renderer.draw(t,e,"11.13.0",m)}catch(B){throw a.suppressErrorRendering?h():$2.draw(t,e,"11.13.0"),B}const F=u.select(`${c} svg`),P=(M=(A=m.db).getAccTitle)==null?void 0:M.call(A),R=(E=(L=m.db).getAccDescription)==null?void 0:E.call(L);lp(b,F,P,R),u.select(`[id="${e}"]`).selectAll("foreignobject > *").attr("xmlns",PC);let $=u.select(c).node().innerHTML;if(D.debug("config.arrowMarkerAbsolute",a.arrowMarkerAbsolute),$=XC($,f,We(a.arrowMarkerAbsolute)),f){const B=u.select(c+" svg").node();$=ZC($,B)}else d||($=Sr.sanitize($,{ADD_TAGS:YC,ADD_ATTR:UC,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(LC(),y)throw y;return h(),{diagramType:b,svg:$,bindFunctions:m.db.bindFunctions}},"render");function np(e={}){var i;const t=At({},e);t!=null&&t.fontFamily&&!((i=t.themeVariables)!=null&&i.fontFamily)&&(t.themeVariables||(t.themeVariables={}),t.themeVariables.fontFamily=t.fontFamily),Mg(t),t!=null&&t.theme&&t.theme in Le?t.themeVariables=Le[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=Le.default.getThemeVariables(t.themeVariables));const r=typeof t=="object"?Ag(t):Pl();tn(r.logLevel),Ia()}p(np,"initialize");var op=p((e,t={})=>{const{code:r}=Yn(e);return Ks.fromText(r,t)},"getDiagramFromText");function lp(e,t,r,i){ep(t,e),rp(t,r,i,t.attr("id"))}p(lp,"addA11yInfo");var rr=Object.freeze({render:QC,parse:sp,getDiagramFromText:op,initialize:np,getConfig:It,setConfig:Nl,getSiteConfig:Pl,updateSiteConfig:Eg,reset:p(()=>{Zi()},"reset"),globalReset:p(()=>{Zi(vr)},"globalReset"),defaultConfig:vr});tn(It().logLevel);Zi(It());var JC=p((e,t,r)=>{D.warn(e),Tn(e)?(r&&r(e.str,e.hash),t.push({...e,message:e.str,error:e})):(r&&r(e),e instanceof Error&&t.push({str:e.message,message:e.message,hash:e.name,error:e}))},"handleError"),cp=p(async function(e={querySelector:".mermaid"}){try{await tk(e)}catch(t){if(Tn(t)&&D.error(t.str),te.parseError&&te.parseError(t),!e.suppressErrors)throw D.error("Use the suppressErrors option to suppress these errors"),t}},"run"),tk=p(async function({postRenderCallback:e,querySelector:t,nodes:r}={querySelector:".mermaid"}){const i=rr.getConfig();D.debug(`${e?"":"No "}Callback function found`);let a;if(r)a=r;else if(t)a=document.querySelectorAll(t);else throw new Error("Nodes and querySelector are both undefined");D.debug(`Found ${a.length} diagrams`),(i==null?void 0:i.startOnLoad)!==void 0&&(D.debug("Start On Load: "+(i==null?void 0:i.startOnLoad)),rr.updateSiteConfig({startOnLoad:i==null?void 0:i.startOnLoad}));const s=new ce.InitIDGenerator(i.deterministicIds,i.deterministicIDSeed);let o;const n=[];for(const l of Array.from(a)){if(D.info("Rendering diagram: "+l.id),l.getAttribute("data-processed"))continue;l.setAttribute("data-processed","true");const c=`mermaid-${s.next()}`;o=l.innerHTML,o=Lu(ce.entityDecode(o)).trim().replace(/
/gi,"
");const h=ce.detectInit(o);h&&D.debug("Detected early reinit: ",h);try{const{svg:u,bindFunctions:f}=await fp(c,o,l);l.innerHTML=u,e&&await e(c),f&&f(l)}catch(u){JC(u,n,te.parseError)}}if(n.length>0)throw n[0]},"runThrowsErrors"),hp=p(function(e){rr.initialize(e)},"initialize"),ek=p(async function(e,t,r){D.warn("mermaid.init is deprecated. Please use run instead."),e&&hp(e);const i={postRenderCallback:r,querySelector:".mermaid"};typeof t=="string"?i.querySelector=t:t&&(t instanceof HTMLElement?i.nodes=[t]:i.nodes=t),await cp(i)},"init"),rk=p(async(e,{lazyLoad:t=!0}={})=>{Ia(),fs(...e),t===!1&&await vC()},"registerExternalDiagrams"),up=p(function(){if(te.startOnLoad){const{startOnLoad:e}=rr.getConfig();e&&te.run().catch(t=>D.error("Mermaid failed to initialize",t))}},"contentLoaded");typeof document{if(!hs){for(hs=!0;xa.length>0;){const e=xa.shift();if(e)try{await e()}catch(t){D.error("Error executing queue",t)}}hs=!1}},"executeQueue"),ak=p(async(e,t)=>new Promise((r,i)=>{const a=p(()=>new Promise((s,o)=>{rr.parse(e,t).then(n=>{s(n),r(n)},n=>{var l;D.error("Error parsing",n),(l=te.parseError)==null||l.call(te,n),o(n),i(n)})}),"performCall");xa.push(a),dp().catch(i)}),"parse"),fp=p((e,t,r)=>new Promise((i,a)=>{const s=p(()=>new Promise((o,n)=>{rr.render(e,t,r).then(l=>{o(l),i(l)},l=>{var c;D.error("Error parsing",l),(c=te.parseError)==null||c.call(te,l),n(l),a(l)})}),"performCall");xa.push(s),dp().catch(a)}),"render"),sk=p(()=>Object.keys(Qe).map(e=>({id:e})),"getRegisteredDiagramsMetadata"),te={startOnLoad:!0,mermaidAPI:rr,parse:ak,render:fp,init:ek,run:cp,registerExternalDiagrams:rk,registerLayoutLoaders:xf,initialize:hp,parseError:void 0,contentLoaded:up,setParseErrorHandler:ik,detectType:en,registerIconPacks:Fx,getRegisteredDiagramsMetadata:sk},Hk=te;/*! Check if previously processed *//*!
* Wait for document loaded before starting the execution
*/export{wk as $,bk as A,Jr as B,be as C,zp as D,nm as E,Ln as F,Il as G,It as H,xy as I,E0 as J,vm as K,dm as L,Eo as M,Mo as N,Lk as O,_k as P,vk as Q,Sk as R,Ck as S,ln as T,it as U,Tk as V,kk as W,cr as X,Ak as Y,Bk as Z,p as _,tm as a,_g as a0,ai as a1,yk as a2,Ba as a3,cy as a4,zg as a5,Ul as a6,Lo as a7,mm as a8,Cs as a9,Ob as aA,Mb as aB,Ab as aC,Ox as aD,Ll as aE,fm as aF,mk as aG,yi as aH,Fx as aI,$x as aJ,ru as aK,J0 as aL,V as aM,pu as aN,ty as aO,tu as aP,N0 as aQ,z0 as aR,W0 as aS,P0 as aT,H0 as aU,Np as aV,kn as aW,ly as aX,oy as aY,yy as aa,Vg as ab,di as ac,j as ad,J as ae,Vl as af,nb as ag,pf as ah,Nk as ai,F0 as aj,zt as ak,Me as al,Wr as am,Bn as an,cu as ao,Mr as ap,fu as aq,U as ar,Hk as as,j0 as at,Jb as au,Pk as av,zk as aw,Rk as ax,Z as ay,Ik as az,Jg as b,pt as c,Gl as d,At as e,Ae as f,rm as g,de as h,R0 as i,pi as j,uu as k,D as l,fi as m,xk as n,qk as o,im as p,am as q,Wk as r,em as s,$0 as t,ce as u,vb as v,ky as w,Mk as x,Sr as y,Qg as z};