All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.chunks.mermaid.esm.min.chunk-AO5Q4NQQ.mjs Maven / Gradle / Ivy

Go to download

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

There is a newer version: 11.4.0
Show newest version
import{a as mt,b as Kt}from"./chunk-U6LOUQAF.mjs";import{d as nt}from"./chunk-J5J7XQ4F.mjs";import{m as at,o as dt}from"./chunk-INOGIEW4.mjs";import{Ca as Qt,F as Zt,G as I,Ga as Jt,I as Ft,K as qt,L as Ut,X as P,b as S,fa as W}from"./chunk-DMXVZUOD.mjs";import{a as d}from"./chunk-GTKDMUJJ.mjs";function Pt(a,t,e){if(a&&a.length){let[r,s]=t,o=Math.PI/180*e,i=Math.cos(o),n=Math.sin(o);for(let l of a){let[c,h]=l;l[0]=(c-r)*i-(h-s)*n+r,l[1]=(c-r)*n+(h-s)*i+s}}}d(Pt,"t");function Ue(a,t){return a[0]===t[0]&&a[1]===t[1]}d(Ue,"e");function Qe(a,t,e,r=1){let s=e,o=Math.max(t,.1),i=a[0]&&a[0][0]&&typeof a[0][0]=="number"?[a]:a,n=[0,0];if(s)for(let c of i)Pt(c,n,s);let l=function(c,h,p){let f=[];for(let x of c){let w=[...x];Ue(w[0],w[w.length-1])||w.push([w[0][0],w[0][1]]),w.length>2&&f.push(w)}let u=[];h=Math.max(h,.1);let m=[];for(let x of f)for(let w=0;wx.yminw.ymin?1:x.xw.x?1:x.ymax===w.ymax?0:(x.ymax-w.ymax)/Math.abs(x.ymax-w.ymax)),!m.length)return u;let g=[],b=m[0].ymin,y=0;for(;g.length||m.length;){if(m.length){let x=-1;for(let w=0;wb);w++)x=w;m.splice(0,x+1).forEach(w=>{g.push({s:b,edge:w})})}if(g=g.filter(x=>!(x.edge.ymax<=b)),g.sort((x,w)=>x.edge.x===w.edge.x?0:(x.edge.x-w.edge.x)/Math.abs(x.edge.x-w.edge.x)),(p!==1||y%h==0)&&g.length>1)for(let x=0;x=g.length)break;let $=g[x].edge,O=g[w].edge;u.push([[Math.round($.x),b],[Math.round(O.x),b]])}b+=p,g.forEach(x=>{x.edge.x=x.edge.x+p*x.edge.islope}),y++}return u}(i,o,r);if(s){for(let c of i)Pt(c,n,-s);(function(c,h,p){let f=[];c.forEach(u=>f.push(...u)),Pt(f,h,p)})(l,n,-s)}return l}d(Qe,"s");function ft(a,t){var e;let r=t.hachureAngle+90,s=t.hachureGap;s<0&&(s=4*t.strokeWidth),s=Math.round(Math.max(s,.1));let o=1;return t.roughness>=1&&(((e=t.randomizer)===null||e===void 0?void 0:e.next())||Math.random())>.7&&(o=s),Qe(a,s,r,o||1)}d(ft,"n");var pt=class{static{d(this,"o")}constructor(t){this.helper=t}fillPolygons(t,e){return this._fillPolygons(t,e)}_fillPolygons(t,e){let r=ft(t,e);return{type:"fillSketch",ops:this.renderLines(r,e)}}renderLines(t,e){let r=[];for(let s of t)r.push(...this.helper.doubleLineOps(s[0][0],s[0][1],s[1][0],s[1][1],e));return r}};function vt(a){let t=a[0],e=a[1];return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2))}d(vt,"a");var Bt=class extends pt{static{d(this,"h")}fillPolygons(t,e){let r=e.hachureGap;r<0&&(r=4*e.strokeWidth),r=Math.max(r,.1);let s=ft(t,Object.assign({},e,{hachureGap:r})),o=Math.PI/180*e.hachureAngle,i=[],n=.5*r*Math.cos(o),l=.5*r*Math.sin(o);for(let[c,h]of s)vt([c,h])&&i.push([[c[0]-n,c[1]+l],[...h]],[[c[0]+n,c[1]-l],[...h]]);return{type:"fillSketch",ops:this.renderLines(i,e)}}},Rt=class extends pt{static{d(this,"r")}fillPolygons(t,e){let r=this._fillPolygons(t,e),s=Object.assign({},e,{hachureAngle:e.hachureAngle+90}),o=this._fillPolygons(t,s);return r.ops=r.ops.concat(o.ops),r}},Tt=class{static{d(this,"i")}constructor(t){this.helper=t}fillPolygons(t,e){let r=ft(t,e=Object.assign({},e,{hachureAngle:0}));return this.dotsOnLines(r,e)}dotsOnLines(t,e){let r=[],s=e.hachureGap;s<0&&(s=4*e.strokeWidth),s=Math.max(s,.1);let o=e.fillWeight;o<0&&(o=e.strokeWidth/2);let i=s/4;for(let n of t){let l=vt(n),c=l/s,h=Math.ceil(c)-1,p=l-h*s,f=(n[0][0]+n[1][0])/2-s/4,u=Math.min(n[0][1],n[1][1]);for(let m=0;m{let n=vt(i),l=Math.floor(n/(r+s)),c=(n+s-l*(r+s))/2,h=i[0],p=i[1];h[0]>p[0]&&(h=i[1],p=i[0]);let f=Math.atan((p[1]-h[1])/(p[0]-h[0]));for(let u=0;u{let i=vt(o),n=Math.round(i/(2*e)),l=o[0],c=o[1];l[0]>c[0]&&(l=o[1],c=o[0]);let h=Math.atan((c[1]-l[1])/(c[0]-l[0]));for(let p=0;ph%2?c+e:c+t);o.push({key:"C",data:l}),t=l[4],e=l[5];break}case"Q":o.push({key:"Q",data:[...n]}),t=n[2],e=n[3];break;case"q":{let l=n.map((c,h)=>h%2?c+e:c+t);o.push({key:"Q",data:l}),t=l[2],e=l[3];break}case"A":o.push({key:"A",data:[...n]}),t=n[5],e=n[6];break;case"a":t+=n[5],e+=n[6],o.push({key:"A",data:[n[0],n[1],n[2],n[3],n[4],t,e]});break;case"H":o.push({key:"H",data:[...n]}),t=n[0];break;case"h":t+=n[0],o.push({key:"H",data:[t]});break;case"V":o.push({key:"V",data:[...n]}),e=n[0];break;case"v":e+=n[0],o.push({key:"V",data:[e]});break;case"S":o.push({key:"S",data:[...n]}),t=n[2],e=n[3];break;case"s":{let l=n.map((c,h)=>h%2?c+e:c+t);o.push({key:"S",data:l}),t=l[2],e=l[3];break}case"T":o.push({key:"T",data:[...n]}),t=n[0],e=n[1];break;case"t":t+=n[0],e+=n[1],o.push({key:"T",data:[t,e]});break;case"Z":case"z":o.push({key:"Z",data:[]}),t=r,e=s}return o}d(le,"y");function ce(a){let t=[],e="",r=0,s=0,o=0,i=0,n=0,l=0;for(let{key:c,data:h}of a){switch(c){case"M":t.push({key:"M",data:[...h]}),[r,s]=h,[o,i]=h;break;case"C":t.push({key:"C",data:[...h]}),r=h[4],s=h[5],n=h[2],l=h[3];break;case"L":t.push({key:"L",data:[...h]}),[r,s]=h;break;case"H":r=h[0],t.push({key:"L",data:[r,s]});break;case"V":s=h[0],t.push({key:"L",data:[r,s]});break;case"S":{let p=0,f=0;e==="C"||e==="S"?(p=r+(r-n),f=s+(s-l)):(p=r,f=s),t.push({key:"C",data:[p,f,...h]}),n=h[0],l=h[1],r=h[2],s=h[3];break}case"T":{let[p,f]=h,u=0,m=0;e==="Q"||e==="T"?(u=r+(r-n),m=s+(s-l)):(u=r,m=s);let g=r+2*(u-r)/3,b=s+2*(m-s)/3,y=p+2*(u-p)/3,x=f+2*(m-f)/3;t.push({key:"C",data:[g,b,y,x,p,f]}),n=u,l=m,r=p,s=f;break}case"Q":{let[p,f,u,m]=h,g=r+2*(p-r)/3,b=s+2*(f-s)/3,y=u+2*(p-u)/3,x=m+2*(f-m)/3;t.push({key:"C",data:[g,b,y,x,u,m]}),n=p,l=f,r=u,s=m;break}case"A":{let p=Math.abs(h[0]),f=Math.abs(h[1]),u=h[2],m=h[3],g=h[4],b=h[5],y=h[6];p===0||f===0?(t.push({key:"C",data:[r,s,b,y,b,y]}),r=b,s=y):(r!==b||s!==y)&&(he(r,s,b,y,p,f,u,m,g).forEach(function(x){t.push({key:"C",data:x})}),r=b,s=y);break}case"Z":t.push({key:"Z",data:[]}),r=o,s=i}e=c}return t}d(ce,"m");function ct(a,t,e){return[a*Math.cos(e)-t*Math.sin(e),a*Math.sin(e)+t*Math.cos(e)]}d(ct,"w");function he(a,t,e,r,s,o,i,n,l,c){let h=(p=i,Math.PI*p/180);var p;let f=[],u=0,m=0,g=0,b=0;if(c)[u,m,g,b]=c;else{[a,t]=ct(a,t,-h),[e,r]=ct(e,r,-h);let Y=(a-e)/2,V=(t-r)/2,Z=Y*Y/(s*s)+V*V/(o*o);Z>1&&(Z=Math.sqrt(Z),s*=Z,o*=Z);let rt=s*s,st=o*o,Fe=rt*st-rt*V*V-st*Y*Y,qe=rt*V*V+st*Y*Y,Yt=(n===l?-1:1)*Math.sqrt(Math.abs(Fe/qe));g=Yt*s*V/o+(a+e)/2,b=Yt*-o*Y/s+(t+r)/2,u=Math.asin(parseFloat(((t-b)/o).toFixed(9))),m=Math.asin(parseFloat(((r-b)/o).toFixed(9))),am&&(u-=2*Math.PI),!l&&m>u&&(m-=2*Math.PI)}let y=m-u;if(Math.abs(y)>120*Math.PI/180){let Y=m,V=e,Z=r;m=l&&m>u?u+120*Math.PI/180*1:u+120*Math.PI/180*-1,f=he(e=g+s*Math.cos(m),r=b+o*Math.sin(m),V,Z,s,o,i,0,l,[m,Y,g,b])}y=m-u;let x=Math.cos(u),w=Math.sin(u),$=Math.cos(m),O=Math.sin(m),L=Math.tan(y/4),C=4/3*s*L,E=4/3*o*L,T=[a,t],A=[a+C*w,t-E*x],_=[e+C*O,r-E*$],et=[e,r];if(A[0]=2*T[0]-A[0],A[1]=2*T[1]-A[1],c)return[A,_,et].concat(f);{f=[A,_,et].concat(f);let Y=[];for(let V=0;V2){let s=[];for(let o=0;o2*Math.PI&&(u=0,m=2*Math.PI);let g=2*Math.PI/l.curveStepCount,b=Math.min(g/2,(m-u)/2),y=oe(b,c,h,p,f,u,m,1,l);if(!l.disableMultiStroke){let x=oe(b,c,h,p,f,u,m,1.5,l);y.push(...x)}return i&&(n?y.push(...Q(c,h,c+p*Math.cos(u),h+f*Math.sin(u),l),...Q(c,h,c+p*Math.cos(m),h+f*Math.sin(m),l)):y.push({op:"lineTo",data:[c,h]},{op:"lineTo",data:[c+p*Math.cos(u),h+f*Math.sin(u)]})),{type:"path",ops:y}}d(re,"A");function se(a,t){let e=ce(le(zt(a))),r=[],s=[0,0],o=[0,0];for(let{key:i,data:n}of e)switch(i){case"M":o=[n[0],n[1]],s=[n[0],n[1]];break;case"L":r.push(...Q(o[0],o[1],n[0],n[1],t)),o=[n[0],n[1]];break;case"C":{let[l,c,h,p,f,u]=n;r.push(...er(l,c,h,p,f,u,o,t)),o=[f,u];break}case"Z":r.push(...Q(o[0],o[1],s[0],s[1],t)),o=[s[0],s[1]]}return{type:"path",ops:r}}d(se,"_");function Ot(a,t){let e=[];for(let r of a)if(r.length){let s=t.maxRandomnessOffset||0,o=r.length;if(o>2){e.push({op:"move",data:[r[0][0]+k(s,t),r[0][1]+k(s,t)]});for(let i=1;i500?.4:-.0016668*l+1.233334;let h=s.maxRandomnessOffset||0;h*h*100>n&&(h=l/10);let p=h/2,f=.2+.2*ue(s),u=s.bowing*s.maxRandomnessOffset*(r-t)/200,m=s.bowing*s.maxRandomnessOffset*(a-e)/200;u=k(u,s,c),m=k(m,s,c);let g=[],b=d(()=>k(p,s,c),"M"),y=d(()=>k(h,s,c),"k"),x=s.preserveVertices;return o&&(i?g.push({op:"move",data:[a+(x?0:b()),t+(x?0:b())]}):g.push({op:"move",data:[a+(x?0:k(h,s,c)),t+(x?0:k(h,s,c))]})),i?g.push({op:"bcurveTo",data:[u+a+(e-a)*f+b(),m+t+(r-t)*f+b(),u+a+2*(e-a)*f+b(),m+t+2*(r-t)*f+b(),e+(x?0:b()),r+(x?0:b())]}):g.push({op:"bcurveTo",data:[u+a+(e-a)*f+y(),m+t+(r-t)*f+y(),u+a+2*(e-a)*f+y(),m+t+2*(r-t)*f+y(),e+(x?0:y()),r+(x?0:y())]}),g}d(_t,"R");function yt(a,t,e){if(!a.length)return[];let r=[];r.push([a[0][0]+k(t,e),a[0][1]+k(t,e)]),r.push([a[0][0]+k(t,e),a[0][1]+k(t,e)]);for(let s=1;s3){let o=[],i=1-e.curveTightness;s.push({op:"move",data:[a[1][0],a[1][1]]});for(let n=1;n+21&&s.push(n)):s.push(n),s.push(a[t+3])}else{let l=a[t+0],c=a[t+1],h=a[t+2],p=a[t+3],f=J(l,c,.5),u=J(c,h,.5),m=J(h,p,.5),g=J(f,u,.5),b=J(u,m,.5),y=J(g,b,.5);Ht([l,f,g,y],0,e,s),Ht([y,b,m,p],0,e,s)}var o,i;return s}d(Ht,"K");function sr(a,t){return Mt(a,0,a.length,t)}d(sr,"U");function Mt(a,t,e,r,s){let o=s||[],i=a[t],n=a[e-1],l=0,c=1;for(let h=t+1;hl&&(l=p,c=h)}return Math.sqrt(l)>r?(Mt(a,t,c+1,r,o),Mt(a,c,e,r,o)):(o.length||o.push(i),o.push(n)),o}d(Mt,"X");function Dt(a,t=.15,e){let r=[],s=(a.length-1)/3;for(let o=0;o0?Mt(r,0,r.length,e):r}d(Dt,"Y");var X="none",it=class{static{d(this,"et")}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,e,r){return{shape:t,sets:e||[],options:r||this.defaultOptions}}line(t,e,r,s,o){let i=this._o(o);return this._d("line",[pe(t,e,r,s,i)],i)}rectangle(t,e,r,s,o){let i=this._o(o),n=[],l=tr(t,e,r,s,i);if(i.fill){let c=[[t,e],[t+r,e],[t+r,e+s],[t,e+s]];i.fillStyle==="solid"?n.push(Ot([c],i)):n.push(ot([c],i))}return i.stroke!==X&&n.push(l),this._d("rectangle",n,i)}ellipse(t,e,r,s,o){let i=this._o(o),n=[],l=fe(r,s,i),c=jt(t,e,i,l);if(i.fill)if(i.fillStyle==="solid"){let h=jt(t,e,i,l).opset;h.type="fillPath",n.push(h)}else n.push(ot([c.estimatedPoints],i));return i.stroke!==X&&n.push(c.opset),this._d("ellipse",n,i)}circle(t,e,r,s){let o=this.ellipse(t,e,r,r,s);return o.shape="circle",o}linearPath(t,e){let r=this._o(e);return this._d("linearPath",[xt(t,!1,r)],r)}arc(t,e,r,s,o,i,n=!1,l){let c=this._o(l),h=[],p=re(t,e,r,s,o,i,n,!0,c);if(n&&c.fill)if(c.fillStyle==="solid"){let f=Object.assign({},c);f.disableMultiStroke=!0;let u=re(t,e,r,s,o,i,!0,!1,f);u.type="fillPath",h.push(u)}else h.push(function(f,u,m,g,b,y,x){let w=f,$=u,O=Math.abs(m/2),L=Math.abs(g/2);O+=k(.01*O,x),L+=k(.01*L,x);let C=b,E=y;for(;C<0;)C+=2*Math.PI,E+=2*Math.PI;E-C>2*Math.PI&&(C=0,E=2*Math.PI);let T=(E-C)/x.curveStepCount,A=[];for(let _=C;_<=E;_+=T)A.push([w+O*Math.cos(_),$+L*Math.sin(_)]);return A.push([w+O*Math.cos(E),$+L*Math.sin(E)]),A.push([w,$]),ot([A],x)}(t,e,r,s,o,i,c));return c.stroke!==X&&h.push(p),this._d("arc",h,c)}curve(t,e){let r=this._o(e),s=[],o=ee(t,r);if(r.fill&&r.fill!==X)if(r.fillStyle==="solid"){let i=ee(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));s.push({type:"fillPath",ops:this._mergedShape(i.ops)})}else{let i=[],n=t;if(n.length){let l=typeof n[0][0]=="number"?[n]:n;for(let c of l)c.length<3?i.push(...c):c.length===3?i.push(...Dt(ie([c[0],c[0],c[1],c[2]]),10,(1+r.roughness)/2)):i.push(...Dt(ie(c),10,(1+r.roughness)/2))}i.length&&s.push(ot([i],r))}return r.stroke!==X&&s.push(o),this._d("curve",s,r)}polygon(t,e){let r=this._o(e),s=[],o=xt(t,!0,r);return r.fill&&(r.fillStyle==="solid"?s.push(Ot([t],r)):s.push(ot([t],r))),r.stroke!==X&&s.push(o),this._d("polygon",s,r)}path(t,e){let r=this._o(e),s=[];if(!t)return this._d("path",s,r);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let o=r.fill&&r.fill!=="transparent"&&r.fill!==X,i=r.stroke!==X,n=!!(r.simplification&&r.simplification<1),l=function(h,p,f){let u=ce(le(zt(h))),m=[],g=[],b=[0,0],y=[],x=d(()=>{y.length>=4&&g.push(...Dt(y,p)),y=[]},"i"),w=d(()=>{x(),g.length&&(m.push(g),g=[])},"c");for(let{key:O,data:L}of u)switch(O){case"M":w(),b=[L[0],L[1]],g.push(b);break;case"L":x(),g.push([L[0],L[1]]);break;case"C":if(!y.length){let C=g.length?g[g.length-1]:b;y.push([C[0],C[1]])}y.push([L[0],L[1]]),y.push([L[2],L[3]]),y.push([L[4],L[5]]);break;case"Z":x(),g.push([b[0],b[1]])}if(w(),!f)return m;let $=[];for(let O of m){let L=sr(O,f);L.length&&$.push(L)}return $}(t,1,n?4-4*(r.simplification||1):(1+r.roughness)/2),c=se(t,r);if(o)if(r.fillStyle==="solid")if(l.length===1){let h=se(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));s.push({type:"fillPath",ops:this._mergedShape(h.ops)})}else s.push(Ot(l,r));else s.push(ot(l,r));return i&&(n?l.forEach(h=>{s.push(xt(h,!1,r))}):s.push(c)),this._d("path",s,r)}opsToPath(t,e){let r="";for(let s of t.ops){let o=typeof e=="number"&&e>=0?s.data.map(i=>+i.toFixed(e)):s.data;switch(s.op){case"move":r+=`M${o[0]} ${o[1]} `;break;case"bcurveTo":r+=`C${o[0]} ${o[1]}, ${o[2]} ${o[3]}, ${o[4]} ${o[5]} `;break;case"lineTo":r+=`L${o[0]} ${o[1]} `}}return r.trim()}toPaths(t){let e=t.sets||[],r=t.options||this.defaultOptions,s=[];for(let o of e){let i=null;switch(o.type){case"path":i={d:this.opsToPath(o),stroke:r.stroke,strokeWidth:r.strokeWidth,fill:X};break;case"fillPath":i={d:this.opsToPath(o),stroke:X,strokeWidth:0,fill:r.fill||X};break;case"fillSketch":i=this.fillSketch(o,r)}i&&s.push(i)}return s}fillSketch(t,e){let r=e.fillWeight;return r<0&&(r=e.strokeWidth/2),{d:this.opsToPath(t),stroke:e.fill||X,strokeWidth:r,fill:X}}_mergedShape(t){return t.filter((e,r)=>r===0||e.op!=="move")}},Wt=class{static{d(this,"st")}constructor(t,e){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new it(e)}draw(t){let e=t.sets||[],r=t.options||this.getDefaultOptions(),s=this.ctx,o=t.options.fixedDecimalPlaceDigits;for(let i of e)switch(i.type){case"path":s.save(),s.strokeStyle=r.stroke==="none"?"transparent":r.stroke,s.lineWidth=r.strokeWidth,r.strokeLineDash&&s.setLineDash(r.strokeLineDash),r.strokeLineDashOffset&&(s.lineDashOffset=r.strokeLineDashOffset),this._drawToContext(s,i,o),s.restore();break;case"fillPath":{s.save(),s.fillStyle=r.fill||"";let n=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(s,i,o,n),s.restore();break}case"fillSketch":this.fillSketch(s,i,r)}}fillSketch(t,e,r){let s=r.fillWeight;s<0&&(s=r.strokeWidth/2),t.save(),r.fillLineDash&&t.setLineDash(r.fillLineDash),r.fillLineDashOffset&&(t.lineDashOffset=r.fillLineDashOffset),t.strokeStyle=r.fill||"",t.lineWidth=s,this._drawToContext(t,e,r.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,e,r,s="nonzero"){t.beginPath();for(let o of e.ops){let i=typeof r=="number"&&r>=0?o.data.map(n=>+n.toFixed(r)):o.data;switch(o.op){case"move":t.moveTo(i[0],i[1]);break;case"bcurveTo":t.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5]);break;case"lineTo":t.lineTo(i[0],i[1])}}e.type==="fillPath"?t.fill(s):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,e,r,s,o){let i=this.gen.line(t,e,r,s,o);return this.draw(i),i}rectangle(t,e,r,s,o){let i=this.gen.rectangle(t,e,r,s,o);return this.draw(i),i}ellipse(t,e,r,s,o){let i=this.gen.ellipse(t,e,r,s,o);return this.draw(i),i}circle(t,e,r,s){let o=this.gen.circle(t,e,r,s);return this.draw(o),o}linearPath(t,e){let r=this.gen.linearPath(t,e);return this.draw(r),r}polygon(t,e){let r=this.gen.polygon(t,e);return this.draw(r),r}arc(t,e,r,s,o,i,n=!1,l){let c=this.gen.arc(t,e,r,s,o,i,n,l);return this.draw(c),c}curve(t,e){let r=this.gen.curve(t,e);return this.draw(r),r}path(t,e){let r=this.gen.path(t,e);return this.draw(r),r}},bt="http://www.w3.org/2000/svg",It=class{static{d(this,"ot")}constructor(t,e){this.svg=t,this.gen=new it(e)}draw(t){let e=t.sets||[],r=t.options||this.getDefaultOptions(),s=this.svg.ownerDocument||window.document,o=s.createElementNS(bt,"g"),i=t.options.fixedDecimalPlaceDigits;for(let n of e){let l=null;switch(n.type){case"path":l=s.createElementNS(bt,"path"),l.setAttribute("d",this.opsToPath(n,i)),l.setAttribute("stroke",r.stroke),l.setAttribute("stroke-width",r.strokeWidth+""),l.setAttribute("fill","none"),r.strokeLineDash&&l.setAttribute("stroke-dasharray",r.strokeLineDash.join(" ").trim()),r.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${r.strokeLineDashOffset}`);break;case"fillPath":l=s.createElementNS(bt,"path"),l.setAttribute("d",this.opsToPath(n,i)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",r.fill||""),t.shape!=="curve"&&t.shape!=="polygon"||l.setAttribute("fill-rule","evenodd");break;case"fillSketch":l=this.fillSketch(s,n,r)}l&&o.appendChild(l)}return o}fillSketch(t,e,r){let s=r.fillWeight;s<0&&(s=r.strokeWidth/2);let o=t.createElementNS(bt,"path");return o.setAttribute("d",this.opsToPath(e,r.fixedDecimalPlaceDigits)),o.setAttribute("stroke",r.fill||""),o.setAttribute("stroke-width",s+""),o.setAttribute("fill","none"),r.fillLineDash&&o.setAttribute("stroke-dasharray",r.fillLineDash.join(" ").trim()),r.fillLineDashOffset&&o.setAttribute("stroke-dashoffset",`${r.fillLineDashOffset}`),o}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,e){return this.gen.opsToPath(t,e)}line(t,e,r,s,o){let i=this.gen.line(t,e,r,s,o);return this.draw(i)}rectangle(t,e,r,s,o){let i=this.gen.rectangle(t,e,r,s,o);return this.draw(i)}ellipse(t,e,r,s,o){let i=this.gen.ellipse(t,e,r,s,o);return this.draw(i)}circle(t,e,r,s){let o=this.gen.circle(t,e,r,s);return this.draw(o)}linearPath(t,e){let r=this.gen.linearPath(t,e);return this.draw(r)}polygon(t,e){let r=this.gen.polygon(t,e);return this.draw(r)}arc(t,e,r,s,o,i,n=!1,l){let c=this.gen.arc(t,e,r,s,o,i,n,l);return this.draw(c)}curve(t,e){let r=this.gen.curve(t,e);return this.draw(r)}path(t,e){let r=this.gen.path(t,e);return this.draw(r)}},M={canvas:d((a,t)=>new Wt(a,t),"canvas"),svg:d((a,t)=>new It(a,t),"svg"),generator:d(a=>new it(a),"generator"),newSeed:d(()=>it.newSeed(),"newSeed")};var ar=d((a,t)=>{var e=a.x,r=a.y,s=t.x-e,o=t.y-r,i=a.width/2,n=a.height/2,l,c;return Math.abs(o)*i>Math.abs(s)*n?(o<0&&(n=-n),l=o===0?0:n*s/o,c=n):(s<0&&(i=-i),l=i,c=s===0?0:i*o/s),{x:e+l,y:r+c}},"intersectRect"),K=ar;function nr(a,t){t&&a.attr("style",t)}d(nr,"applyStyle");async function or(a){let t=W(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),e=t.append("xhtml:div"),r=a.label;a.label&&Ft(a.label)&&(r=await qt(a.label.replace(Ut.lineBreakRegex,`
`),P()));let s=a.isNode?"nodeLabel":"edgeLabel";return e.html('"+r+""),nr(e,a.labelStyle),e.style("display","inline-block"),e.style("padding-right","1px"),e.style("white-space","nowrap"),e.attr("xmlns","http://www.w3.org/1999/xhtml"),t.node()}d(or,"addHtmlLabel");var ir=d(async(a,t,e,r)=>{let s=a||"";if(typeof s=="object"&&(s=s[0]),I(P().flowchart.htmlLabels)){s=s.replace(/\\n|\n/g,"
"),S.info("vertexText"+s);let o={isNode:r,label:dt(s).replace(/fa[blrs]?:fa-[\w-]+/g,n=>``),labelStyle:t&&t.replace("fill:","color:")};return await or(o)}else{let o=document.createElementNS("http://www.w3.org/2000/svg","text");o.setAttribute("style",t.replace("color:","fill:"));let i=[];typeof s=="string"?i=s.split(/\\n|\n|/gi):Array.isArray(s)?i=s:i=[];for(let n of i){let l=document.createElementNS("http://www.w3.org/2000/svg","tspan");l.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),l.setAttribute("dy","1em"),l.setAttribute("x","0"),e?l.setAttribute("class","title-row"):l.setAttribute("class","row"),l.textContent=n.trim(),o.appendChild(l)}return o}},"createLabel"),F=ir;var q=d((a,t,e,r,s)=>["M",a+s,t,"H",a+e-s,"A",s,s,0,0,1,a+e,t+s,"V",t+r-s,"A",s,s,0,0,1,a+e-s,t+r,"H",a+s,"A",s,s,0,0,1,a,t+r-s,"V",t+s,"A",s,s,0,0,1,a+s,t,"Z"].join(" "),"createRoundedRectPathD");var U=d(a=>{let{handDrawnSeed:t}=P();return{fill:a,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:a,seed:t}},"solidStateFill"),de=d(a=>{let t=lr([...a.cssCompiledStyles||[],...a.cssStyles||[]]);return{stylesMap:t,stylesArray:[...t]}},"compileStyles"),lr=d(a=>{let t=new Map;return a.forEach(e=>{let[r,s]=e.split(":");t.set(r.trim(),s?.trim())}),t},"styles2Map"),D=d(a=>{let{stylesArray:t}=de(a),e=[],r=[],s=[],o=[];return t.forEach(i=>{let n=i[0];n==="color"||n==="font-size"||n==="font-family"||n==="font-weight"||n==="font-style"||n==="text-decoration"||n==="text-align"||n==="text-transform"||n==="line-height"||n==="letter-spacing"||n==="word-spacing"||n==="text-shadow"||n==="text-overflow"||n==="white-space"||n==="word-wrap"||n==="word-break"||n==="overflow-wrap"||n==="hyphens"?e.push(i.join(":")+" !important"):(r.push(i.join(":")+" !important"),n.includes("stroke")&&s.push(i.join(":")+" !important"),n==="fill"&&o.push(i.join(":")+" !important"))}),{labelStyles:e.join(";"),nodeStyles:r.join(";"),stylesArray:t,borderStyles:s,backgroundStyles:o}},"styles2String"),B=d((a,t)=>{let{themeVariables:e,handDrawnSeed:r}=P(),{nodeBorder:s,mainBkg:o}=e,{stylesMap:i}=de(a);return Object.assign({roughness:.7,fill:i.get("fill")||o,fillStyle:"hachure",fillWeight:4,stroke:i.get("stroke")||s,seed:r,strokeWidth:1.3},t)},"userNodeOverrides");var me=d(async(a,t)=>{S.info("Creating subgraph rect for ",t.id,t);let e=P(),{themeVariables:r,handDrawnSeed:s}=e,{clusterBkg:o,clusterBorder:i}=r,{labelStyles:n,nodeStyles:l,borderStyles:c,backgroundStyles:h}=D(t),p=a.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=I(e.flowchart.htmlLabels),u=p.insert("g").attr("class","cluster-label "),m=await nt(u,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0}),g=m.getBBox();if(I(e.flowchart.htmlLabels)){let C=m.children[0],E=W(m);g=C.getBoundingClientRect(),E.attr("width",g.width),E.attr("height",g.height)}let b=t.width<=g.width+t.padding?g.width+t.padding:t.width;t.width<=g.width+t.padding?t.diff=(b-t.width)/2-t.padding:t.diff=-t.padding;let y=t.height,x=t.x-b/2,w=t.y-y/2;S.trace("Data ",t,JSON.stringify(t));let $;if(t.look==="handDrawn"){let C=M.svg(p),E=B(t,{roughness:.7,fill:o,stroke:i,fillWeight:3,seed:s}),T=C.path(q(x,w,b,y,0),E);$=p.insert(()=>(S.debug("Rough node insert CXC",T),T),":first-child"),$.select("path:nth-child(2)").attr("style",c.join(";")),$.select("path").attr("style",h.join(";").replace("fill","stroke"))}else $=p.insert("rect",":first-child"),$.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",x).attr("y",w).attr("width",b).attr("height",y);let{subGraphTitleTopMargin:O}=mt(e);if(u.attr("transform",`translate(${t.x-g.width/2}, ${t.y-t.height/2+O})`),n){let C=u.select("span");C&&C.attr("style",n)}let L=$.node().getBBox();return t.offsetX=0,t.width=L.width,t.height=L.height,t.offsetY=g.height-t.padding/2,t.intersect=function(C){return K(t,C)},{cluster:p,labelBBox:g}},"rect"),cr=d((a,t)=>{let e=a.insert("g").attr("class","note-cluster").attr("id",t.id),r=e.insert("rect",":first-child"),s=0*t.padding,o=s/2;r.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-o).attr("y",t.y-t.height/2-o).attr("width",t.width+s).attr("height",t.height+s).attr("fill","none");let i=r.node().getBBox();return t.width=i.width,t.height=i.height,t.intersect=function(n){return K(t,n)},{cluster:e,labelBBox:{width:0,height:0}}},"noteGroup"),hr=d(async(a,t)=>{let e=P(),{themeVariables:r,handDrawnSeed:s}=e,{altBackground:o,compositeBackground:i,compositeTitleBackground:n,nodeBorder:l}=r,c=a.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"),p=c.insert("g").attr("class","cluster-label"),f=c.append("rect"),u=p.node().appendChild(await F(t.label,t.labelStyle,void 0,!0)),m=u.getBBox();if(I(e.flowchart.htmlLabels)){let T=u.children[0],A=W(u);m=T.getBoundingClientRect(),A.attr("width",m.width),A.attr("height",m.height)}let g=0*t.padding,b=g/2,y=(t.width<=m.width+t.padding?m.width+t.padding:t.width)+g;t.width<=m.width+t.padding?t.diff=(y-t.width)/2-t.padding:t.diff=-t.padding;let x=t.height+g,w=t.height+g-m.height-6,$=t.x-y/2,O=t.y-x/2;t.width=y;let L=t.y-t.height/2-b+m.height+2,C;if(t.look==="handDrawn"){let T=t.cssClasses.includes("statediagram-cluster-alt"),A=M.svg(c),_=t.rx||t.ry?A.path(q($,O,y,x,10),{roughness:.7,fill:n,fillStyle:"solid",stroke:l,seed:s}):A.rectangle($,O,y,x,{seed:s});C=c.insert(()=>_,":first-child");let et=A.rectangle($,L,y,w,{fill:T?o:i,fillStyle:T?"hachure":"solid",stroke:l,seed:s});C=c.insert(()=>_,":first-child"),f=c.insert(()=>et)}else C=h.insert("rect",":first-child"),C.attr("class","outer").attr("x",$).attr("y",O).attr("width",y).attr("height",x).attr("data-look",t.look),f.attr("class","inner").attr("x",$).attr("y",L).attr("width",y).attr("height",w);p.attr("transform",`translate(${t.x-m.width/2}, ${O+1-(I(e.flowchart.htmlLabels)?0:3)})`);let E=C.node().getBBox();return t.height=E.height,t.offsetX=0,t.offsetY=m.height-t.padding/2,t.labelBBox=m,t.intersect=function(T){return K(t,T)},{cluster:c,labelBBox:m}},"roundedWithTitle"),pr=d((a,t)=>{let e=P(),{themeVariables:r,handDrawnSeed:s}=e,{nodeBorder:o}=r,i=a.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-look",t.look),n=i.insert("g",":first-child"),l=0*t.padding,c=t.width+l;t.diff=-t.padding;let h=t.height+l,p=t.x-c/2,f=t.y-h/2;t.width=c;let u;if(t.look==="handDrawn"){let b=M.svg(i).rectangle(p,f,c,h,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:o,seed:s});u=i.insert(()=>b,":first-child")}else u=n.insert("rect",":first-child"),u.attr("class","divider").attr("x",p).attr("y",f).attr("width",c).attr("height",h).attr("data-look",t.look);let m=u.node().getBBox();return t.height=m.height,t.offsetX=0,t.offsetY=0,t.intersect=function(g){return K(t,g)},{cluster:i,labelBBox:{}}},"divider"),fr=me,ur={rect:me,squareRect:fr,roundedWithTitle:hr,noteGroup:cr,divider:pr},ge=new Map,bs=d(async(a,t)=>{let e=t.shape||"rect",r=await ur[e](a,t);return ge.set(t.id,r),r},"insertCluster");var xs=d(()=>{ge=new Map},"clear");var be=d((a,t,e,r,s)=>{t.arrowTypeStart&&ye(a,"start",t.arrowTypeStart,e,r,s),t.arrowTypeEnd&&ye(a,"end",t.arrowTypeEnd,e,r,s)},"addEdgeMarkers"),dr={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},ye=d((a,t,e,r,s,o)=>{let i=dr[e];if(!i){S.warn(`Unknown arrow type: ${e}`);return}let n=t==="start"?"Start":"End";a.attr(`marker-${t}`,`url(${r}#${s}_${o}-${i}${n})`)},"addEdgeMarker");var $t=new Map,j=new Map,As=d(()=>{$t.clear(),j.clear()},"clear"),ut=d(a=>a?a.reduce((e,r)=>e+";"+r,""):"","getLabelStyles"),Gs=d(async(a,t)=>{let e=I(P().flowchart.htmlLabels),r=await nt(a,t.label,{style:ut(t.labelStyle),useHtmlLabels:e,addSvgBackground:!0,isNode:!1});S.info("abc82",t,t.labelType);let s=a.insert("g").attr("class","edgeLabel"),o=s.insert("g").attr("class","label");o.node().appendChild(r);let i=r.getBBox();if(e){let l=r.children[0],c=W(r);i=l.getBoundingClientRect(),c.attr("width",i.width),c.attr("height",i.height)}o.attr("transform","translate("+-i.width/2+", "+-i.height/2+")"),$t.set(t.id,s),t.width=i.width,t.height=i.height;let n;if(t.startLabelLeft){let l=await F(t.startLabelLeft,ut(t.labelStyle)),c=a.insert("g").attr("class","edgeTerminals"),h=c.insert("g").attr("class","inner");n=h.node().appendChild(l);let p=l.getBBox();h.attr("transform","translate("+-p.width/2+", "+-p.height/2+")"),j.get(t.id)||j.set(t.id,{}),j.get(t.id).startLeft=c,Lt(n,t.startLabelLeft)}if(t.startLabelRight){let l=await F(t.startLabelRight,ut(t.labelStyle)),c=a.insert("g").attr("class","edgeTerminals"),h=c.insert("g").attr("class","inner");n=c.node().appendChild(l),h.node().appendChild(l);let p=l.getBBox();h.attr("transform","translate("+-p.width/2+", "+-p.height/2+")"),j.get(t.id)||j.set(t.id,{}),j.get(t.id).startRight=c,Lt(n,t.startLabelRight)}if(t.endLabelLeft){let l=await F(t.endLabelLeft,ut(t.labelStyle)),c=a.insert("g").attr("class","edgeTerminals"),h=c.insert("g").attr("class","inner");n=h.node().appendChild(l);let p=l.getBBox();h.attr("transform","translate("+-p.width/2+", "+-p.height/2+")"),c.node().appendChild(l),j.get(t.id)||j.set(t.id,{}),j.get(t.id).endLeft=c,Lt(n,t.endLabelLeft)}if(t.endLabelRight){let l=await F(t.endLabelRight,ut(t.labelStyle)),c=a.insert("g").attr("class","edgeTerminals"),h=c.insert("g").attr("class","inner");n=h.node().appendChild(l);let p=l.getBBox();h.attr("transform","translate("+-p.width/2+", "+-p.height/2+")"),c.node().appendChild(l),j.get(t.id)||j.set(t.id,{}),j.get(t.id).endRight=c,Lt(n,t.endLabelRight)}return r},"insertEdgeLabel");function Lt(a,t){P().flowchart.htmlLabels&&a&&(a.style.width=t.length*9+"px",a.style.height="12px")}d(Lt,"setTerminalWidth");var Vs=d((a,t)=>{S.debug("Moving label abc88 ",a.id,a.label,$t.get(a.id),t);let e=t.updatedPath?t.updatedPath:t.originalPath,r=P(),{subGraphTitleTotalMargin:s}=mt(r);if(a.label){let o=$t.get(a.id),i=a.x,n=a.y;if(e){let l=at.calcLabelPosition(e);S.debug("Moving label "+a.label+" from (",i,",",n,") to (",l.x,",",l.y,") abc88"),t.updatedPath&&(i=l.x,n=l.y)}o.attr("transform",`translate(${i}, ${n+s/2})`)}if(a.startLabelLeft){let o=j.get(a.id).startLeft,i=a.x,n=a.y;if(e){let l=at.calcTerminalLabelPosition(a.arrowTypeStart?10:0,"start_left",e);i=l.x,n=l.y}o.attr("transform",`translate(${i}, ${n})`)}if(a.startLabelRight){let o=j.get(a.id).startRight,i=a.x,n=a.y;if(e){let l=at.calcTerminalLabelPosition(a.arrowTypeStart?10:0,"start_right",e);i=l.x,n=l.y}o.attr("transform",`translate(${i}, ${n})`)}if(a.endLabelLeft){let o=j.get(a.id).endLeft,i=a.x,n=a.y;if(e){let l=at.calcTerminalLabelPosition(a.arrowTypeEnd?10:0,"end_left",e);i=l.x,n=l.y}o.attr("transform",`translate(${i}, ${n})`)}if(a.endLabelRight){let o=j.get(a.id).endRight,i=a.x,n=a.y;if(e){let l=at.calcTerminalLabelPosition(a.arrowTypeEnd?10:0,"end_right",e);i=l.x,n=l.y}o.attr("transform",`translate(${i}, ${n})`)}},"positionEdgeLabel"),mr=d((a,t)=>{let e=a.x,r=a.y,s=Math.abs(t.x-e),o=Math.abs(t.y-r),i=a.width/2,n=a.height/2;return s>=i||o>=n},"outsideNode"),gr=d((a,t,e)=>{S.debug(`intersection calc abc89: outsidePoint: ${JSON.stringify(t)} insidePoint : ${JSON.stringify(e)} node : x:${a.x} y:${a.y} w:${a.width} h:${a.height}`);let r=a.x,s=a.y,o=Math.abs(r-e.x),i=a.width/2,n=e.xMath.abs(r-t.x)*l){let p=e.y{S.warn("abc88 cutPathAtIntersect",a,t);let e=[],r=a[0],s=!1;return a.forEach(o=>{if(S.info("abc88 checking point",o,t),!mr(t,o)&&!s){let i=gr(t,r,o);S.debug("abc88 inside",o,r,i),S.debug("abc88 intersection",i,t);let n=!1;e.forEach(l=>{n=n||l.x===i.x&&l.y===i.y}),e.some(l=>l.x===i.x&&l.y===i.y)?S.warn("abc88 no intersect",i,e):e.push(i),s=!0}else S.warn("abc88 outside",o,r),r=o,s||e.push(o)}),S.debug("returning points",e),e},"cutPathAtIntersect");function yr(a){let t=[],e=[];for(let r=1;r5&&Math.abs(o.y-s.y)>5||s.y===o.y&&o.x===i.x&&Math.abs(o.x-s.x)>5&&Math.abs(o.y-i.y)>5)&&(t.push(o),e.push(r))}return{cornerPoints:t,cornerPointPositions:e}}d(yr,"extractCornerPoints");var we=d(function(a,t,e){let r=t.x-a.x,s=t.y-a.y,o=Math.sqrt(r*r+s*s),i=e/o;return{x:t.x-i*r,y:t.y-i*s}},"findAdjacentPoint"),br=d(function(a){let{cornerPointPositions:t}=yr(a),e=[];for(let r=0;r10&&Math.abs(o.y-s.y)>=10){S.debug("Corner point fixing",Math.abs(o.x-s.x),Math.abs(o.y-s.y));let u=5;i.x===n.x?f={x:c<0?n.x-u+p:n.x+u-p,y:h<0?n.y-p:n.y+p}:f={x:c<0?n.x-p:n.x+p,y:h<0?n.y-u+p:n.y+u-p}}else S.debug("Corner point skipping fixing",Math.abs(o.x-s.x),Math.abs(o.y-s.y));e.push(f,l)}else e.push(a[r]);return e},"fixCorners"),js=d(function(a,t,e,r,s,o,i){let{handDrawnSeed:n}=P(),l=t.points,c=!1,h=s;var p=o;p.intersect&&h.intersect&&(l=l.slice(1,t.points.length-1),l.unshift(h.intersect(l[0])),S.debug("Last point APA12",t.start,"-->",t.end,l[l.length-1],p,p.intersect(l[l.length-1])),l.push(p.intersect(l[l.length-1]))),t.toCluster&&(S.info("to cluster abc88",e.get(t.toCluster)),l=xe(t.points,e.get(t.toCluster).node),c=!0),t.fromCluster&&(S.debug("from cluster abc88",e.get(t.fromCluster),JSON.stringify(l,null,2)),l=xe(l.reverse(),e.get(t.fromCluster).node).reverse(),c=!0);let f=l.filter(E=>!Number.isNaN(E.y));f=br(f);let u=f[f.length-1];if(f.length>1){u=f[f.length-1];let E=f[f.length-2],T=(u.x-E.x)/2,A=(u.y-E.y)/2,_={x:E.x+T,y:E.y+A};f.splice(-1,0,_)}let m=Jt;t.curve&&(m=t.curve);let{x:g,y:b}=Kt(t),y=Qt().x(g).y(b).curve(m),x;switch(t.thickness){case"normal":x="edge-thickness-normal";break;case"thick":x="edge-thickness-thick";break;case"invisible":x="edge-thickness-invisible";break;default:x="edge-thickness-normal"}switch(t.pattern){case"solid":x+=" edge-pattern-solid";break;case"dotted":x+=" edge-pattern-dotted";break;case"dashed":x+=" edge-pattern-dashed";break;default:x+=" edge-pattern-solid"}let w,$=y(f),O=Array.isArray(t.style)?t.style:[t.style];if(t.look==="handDrawn"){let E=M.svg(a);Object.assign([],f);let T=E.path($,{roughness:.3,seed:n});x+=" transition",w=W(T).select("path").attr("id",t.id).attr("class"," "+x+(t.classes?" "+t.classes:"")).attr("style",O?O.reduce((_,et)=>_+";"+et,""):"");let A=w.attr("d");w.attr("d",A),a.node().appendChild(w.node())}else w=a.append("path").attr("d",$).attr("id",t.id).attr("class"," "+x+(t.classes?" "+t.classes:"")).attr("style",O?O.reduce((E,T)=>E+";"+T,""):"");let L="";(P().flowchart.arrowMarkerAbsolute||P().state.arrowMarkerAbsolute)&&(L=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,L=L.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),S.info("arrowTypeStart",t.arrowTypeStart),S.info("arrowTypeEnd",t.arrowTypeEnd),be(w,t,L,i,r);let C={};return c&&(C.updatedPath=l),C.originalPath=t.points,C},"insertEdge");var xr=d((a,t,e,r)=>{t.forEach(s=>{Cr[s](a,e,r)})},"insertMarkers"),wr=d((a,t,e)=>{S.trace("Making markers for ",e),a.append("defs").append("marker").attr("id",e+"_"+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"),a.append("defs").append("marker").attr("id",e+"_"+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"),kr=d((a,t,e)=>{a.append("defs").append("marker").attr("id",e+"_"+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"),a.append("defs").append("marker").attr("id",e+"_"+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"),Sr=d((a,t,e)=>{a.append("defs").append("marker").attr("id",e+"_"+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"),a.append("defs").append("marker").attr("id",e+"_"+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"),Mr=d((a,t,e)=>{a.append("defs").append("marker").attr("id",e+"_"+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"),a.append("defs").append("marker").attr("id",e+"_"+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"),vr=d((a,t,e)=>{a.append("defs").append("marker").attr("id",e+"_"+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("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),a.append("defs").append("marker").attr("id",e+"_"+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("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),Lr=d((a,t,e)=>{a.append("marker").attr("id",e+"_"+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"),a.append("marker").attr("id",e+"_"+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"),$r=d((a,t,e)=>{a.append("marker").attr("id",e+"_"+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"),a.append("marker").attr("id",e+"_"+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"),Nr=d((a,t,e)=>{a.append("marker").attr("id",e+"_"+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"),a.append("marker").attr("id",e+"_"+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"),Pr=d((a,t,e)=>{a.append("defs").append("marker").attr("id",e+"_"+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"),Cr={extension:wr,composition:kr,aggregation:Sr,dependency:Mr,lollipop:vr,point:Lr,circle:$r,cross:Nr,barb:Pr},Is=xr;var R=d(async(a,t,e)=>{let r,s=t.useHtmlLabels||I(P().flowchart.htmlLabels);e?r=e:r="node default";let o=a.insert("g").attr("class",r).attr("id",t.domId||t.id),i=o.insert("g").attr("class","label").attr("style",t.labelStyle),n;t.label===void 0?n="":n=typeof t.label=="string"?t.label:t.label[0];let l;l=await nt(i,Zt(dt(n),P()),{useHtmlLabels:s,width:t.width||P().flowchart.wrappingWidth,cssClasses:"markdown-node-label",style:t.labelStyle});let c=l.getBBox(),h=t.padding/2;if(I(P().flowchart.htmlLabels)){let p=l.children[0],f=W(l),u=p.getElementsByTagName("img");if(u){let m=n.replace(/]*>/g,"").trim()==="";await Promise.all([...u].map(g=>new Promise(b=>{function y(){if(g.style.display="flex",g.style.flexDirection="column",m){let x=P().fontSize?P().fontSize:window.getComputedStyle(document.body).fontSize,$=parseInt(x,10)*5+"px";g.style.minWidth=$,g.style.maxWidth=$}else g.style.width="100%";b(g)}d(y,"setupImage"),setTimeout(()=>{g.complete&&y()}),g.addEventListener("error",y),g.addEventListener("load",y)})))}c=p.getBoundingClientRect(),f.attr("width",c.width),f.attr("height",c.height)}return s?i.attr("transform","translate("+-c.width/2+", "+-c.height/2+")"):i.attr("transform","translate(0, "+-c.height/2+")"),t.centerLabel&&i.attr("transform","translate("+-c.width/2+", "+-c.height/2+")"),i.insert("rect",":first-child"),{shapeSvg:o,bbox:c,halfPadding:h,label:i}},"labelHelper"),N=d((a,t)=>{let e=t.node().getBBox();a.width=e.width,a.height=e.height},"updateNodeBounds");var G=d((a,t)=>(a.look==="handDrawn"?"rough-node":"node")+" "+a.cssClasses+" "+(t||""),"getNodeClasses");function Er(a,t){return a.intersect(t)}d(Er,"intersectNode");var ke=Er;function Or(a,t,e,r){var s=a.x,o=a.y,i=s-r.x,n=o-r.y,l=Math.sqrt(t*t*n*n+e*e*i*i),c=Math.abs(t*e*i/l);r.x0}d(Me,"sameSign");var ve=Br;function Rr(a,t,e){let r=a.x,s=a.y,o=[],i=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(h){i=Math.min(i,h.x),n=Math.min(n,h.y)}):(i=Math.min(i,t.x),n=Math.min(n,t.y));let l=r-a.width/2-i,c=s-a.height/2-n;for(let h=0;h1&&o.sort(function(h,p){let f=h.x-e.x,u=h.y-e.y,m=Math.sqrt(f*f+u*u),g=p.x-e.x,b=p.y-e.y,y=Math.sqrt(g*g+b*b);return m{let{labelStyles:r,nodeStyles:s}=D(t);t.labelStyle=r;let{shapeSvg:o,bbox:i}=await R(a,t,G(t)),n=Math.max(i.width+e.labelPaddingX*2,t?.width||0),l=Math.max(i.height+e.labelPaddingY*2,t?.height||0),c=-n/2,h=-l/2,p,{rx:f,ry:u}=t,{cssStyles:m}=t;if(e?.rx&&e.ry&&(f=e.rx,u=e.ry),t.look==="handDrawn"){let g=M.svg(o),b=B(t,{}),y=f||u?g.path(q(c,h,n,l,f||0),b):g.rectangle(c,h,n,l,b);p=o.insert(()=>y,":first-child"),p.attr("class","basic label-container").attr("style",m)}else p=o.insert("rect",":first-child"),p.attr("class","basic label-container").attr("style",s).attr("rx",f).attr("data-id","abc").attr("data-et","node").attr("ry",u).attr("x",c).attr("y",h).attr("width",n).attr("height",l);return N(t,p),t.intersect=function(g){return v.rect(t,g)},o},"drawRect");var $e=d(async(a,t)=>tt(a,t,{rx:5,ry:5,classes:"flowchart-node"}),"state");var Ne=d(async(a,t)=>{let e={rx:5,ry:5,classes:"",labelPaddingX:(t?.padding||0)*1,labelPaddingY:(t?.padding||0)*1};return tt(a,t,e)},"roundedRect");var Pe=d(async(a,t)=>{let e={rx:0,ry:0,classes:"",labelPaddingX:(t?.padding||0)*2,labelPaddingY:(t?.padding||0)*1};return tt(a,t,e)},"squareRect");var Ce=d((a,t)=>{let{themeVariables:e}=P(),{lineColor:r}=e,s=a.insert("g").attr("class","node default").attr("id",t.domId||t.id),o;if(t.look==="handDrawn"){let n=M.svg(s).circle(0,0,14,U(r));o=s.insert(()=>n)}else o=s.insert("circle",":first-child");return o.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),N(t,o),t.intersect=function(i){return v.circle(t,7,i)},s},"stateStart");var Ee=d((a,t)=>{let{themeVariables:e}=P(),{lineColor:r}=e,s=a.insert("g").attr("class","node default").attr("id",t.domId||t.id),o,i;if(t.look==="handDrawn"){let n=M.svg(s),l=n.circle(0,0,14,{...U(r),roughness:.5}),c=n.circle(0,0,5,{...U(r),fillStyle:"solid"});o=s.insert(()=>l),i=s.insert(()=>c)}else i=s.insert("circle",":first-child"),o=s.insert("circle",":first-child"),o.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),i.attr("class","state-end").attr("r",5).attr("width",10).attr("height",10);return N(t,o),t.intersect=function(n){return v.circle(t,7,n)},s},"stateEnd");var Xt=d((a,t,e)=>{let{themeVariables:r}=P(),{lineColor:s}=r,o=a.insert("g").attr("class","node default").attr("id",t.domId||t.id),i=70,n=10;e==="LR"&&(i=10,n=70);let l=-1*i/2,c=-1*n/2,h;if(t.look==="handDrawn"){let g=M.svg(o).rectangle(l,c,i,n,U(s));h=o.insert(()=>g)}else h=o.append("rect").attr("x",l).attr("y",c).attr("width",i).attr("height",n).attr("class","fork-join");N(t,h);let p=0,f=0,u=10;return t.height&&(p=t.height),t.width&&(f=t.width),t.padding&&(u=t.padding),t.height=p+u/2,t.width=f+u/2,t.intersect=function(m){return v.rect(t,m)},o},"forkJoin");var Oe=d((a,t)=>{let{labelStyles:e,nodeStyles:r}=D(t);t.labelStyle=e;let{themeVariables:s}=P(),{lineColor:o}=s,i=a.insert("g").attr("class","node default").attr("id",t.domId||t.id),n=28,l=[{x:0,y:n/2},{x:n/2,y:0},{x:0,y:-n/2},{x:-n/2,y:0}],c;if(t.look==="handDrawn"){let h=M.svg(i),p=l.map(function(u){return[u.x,u.y]}),f=h.polygon(p,U(o));c=i.insert(()=>f)}else c=i.insert("polygon",":first-child").attr("points",l.map(function(h){return h.x+","+h.y}).join(" "));return c.attr("class","state-start").attr("r",7).attr("width",28).attr("height",28).attr("style",r),t.width=28,t.height=28,t.intersect=function(h){return v.circle(t,14,h)},i},"choice");var De=d(async(a,t)=>{let{themeVariables:e,handDrawnSeed:r}=P(),{noteBorderColor:s,noteBkgColor:o}=e;t.useHtmlLabels||(t.centerLabel=!0);let{shapeSvg:n,bbox:l}=await R(a,t,"node "+t.cssClasses);S.info("Classes = ",t.cssClasses);let{cssStyles:c}=t,h,p=l.width+t.padding,f=l.height+t.padding,u=-p/2,m=-f/2;if(t.look==="handDrawn"){let b=M.svg(n).rectangle(u,m,p,f,{roughness:.7,fill:o,fillWeight:3,seed:r,stroke:s});h=n.insert(()=>b,":first-child"),h.attr("class","basic label-container").attr("style",c)}else h=n.insert("rect",":first-child"),h.attr("rx",t.rx).attr("ry",t.ry).attr("x",u).attr("y",m).attr("width",p).attr("height",f);return N(t,h),t.intersect=function(g){return v.rect(t,g)},n},"note");var Be=d(async(a,t)=>{let{labelStyles:e,nodeStyles:r}=D(t);t.labelStyle=e;let{shapeSvg:s,bbox:o}=await R(a,t,G(t)),i=o.height+t.padding,n=o.width+i/4+t.padding,l,{cssStyles:c}=t;if(t.look==="handDrawn"){let h=M.svg(s),p=B(t,{}),f=q(-n/2,-i/2,n,i,i/2),u=h.path(f,p);l=s.insert(()=>u,":first-child"),l.attr("class","basic label-container").attr("style",c)}else l=s.insert("rect",":first-child"),l.attr("class","basic label-container").attr("style",r).attr("rx",i/2).attr("ry",i/2).attr("x",-n/2).attr("y",-i/2).attr("width",n).attr("height",i);return N(t,l),t.intersect=function(h){return v.rect(t,h)},s},"stadium");var Re=d(async(a,t)=>{let{labelStyles:e,nodeStyles:r}=D(t);t.labelStyle=e;let s;t.cssClasses?s="node "+t.cssClasses:s="node default";let o=a.insert("g").attr("class",s).attr("id",t.domId||t.id),i=o.insert("g"),n=o.insert("g").attr("class","label").attr("style",r),l=t.description,c=t.label,h=n.node().appendChild(await F(c,t.labelStyle,!0,!0)),p={width:0,height:0};if(I(P()?.flowchart?.htmlLabels)){let E=h.children[0],T=W(h);p=E.getBoundingClientRect(),T.attr("width",p.width),T.attr("height",p.height)}S.info("Text 2",l);let f=l||[],u=h.getBBox(),m=n.node().appendChild(await F(f.join?f.join("
"):f,t.labelStyle,!0,!0)),g=m.children[0],b=W(m);p=g.getBoundingClientRect(),b.attr("width",p.width),b.attr("height",p.height);let y=(t.padding||0)/2;W(m).attr("transform","translate( "+(p.width>u.width?0:(u.width-p.width)/2)+", "+(u.height+y+5)+")"),W(h).attr("transform","translate( "+(p.width(S.debug("Rough node insert CXC",A),_),":first-child"),L=o.insert(()=>(S.debug("Rough node insert CXC",A),A),":first-child")}else L=i.insert("rect",":first-child"),C=i.insert("line"),L.attr("class","outer title-state").attr("style",r).attr("x",-p.width/2-y).attr("y",-p.height/2-y).attr("width",p.width+(t.padding||0)).attr("height",p.height+(t.padding||0)),C.attr("class","divider").attr("x1",-p.width/2-y).attr("x2",p.width/2+y).attr("y1",-p.height/2-y+u.height+y).attr("y2",-p.height/2-y+u.height+y);return N(t,L),t.intersect=function(E){return v.rect(t,E)},o},"rectWithTitle");function H(a,t,e,r){return a.insert("polygon",":first-child").attr("points",r.map(function(s){return s.x+","+s.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+e/2+")")}d(H,"insertPolygonShape");var Te=d(async(a,t)=>{let{labelStyles:e,nodeStyles:r}=D(t);t.labelStyle=e;let{shapeSvg:s,bbox:o}=await R(a,t,G(t)),i=(t?.padding||0)/2,n=o.width+t.padding,l=o.height+t.padding,c=-o.width/2-i,h=-o.height/2-i,p=[{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"){let f=M.svg(s),u=B(t,{}),m=f.rectangle(c-8,h,n+16,l,u),g=f.line(c,h,c,h+l,u),b=f.line(c+n,h,c+n,h+l,u);s.insert(()=>g,":first-child"),s.insert(()=>b,":first-child");let y=s.insert(()=>m,":first-child"),{cssStyles:x}=t;y.attr("class","basic label-container").attr("style",x),N(t,y)}else{let f=H(s,n,l,p);r&&f.attr("style",r),N(t,f)}return t.intersect=function(f){return v.polygon(t,p,f)},s},"subroutine");var Tr=d((a,t,e,r,s,o)=>[`M${a},${t+o}`,`a${s},${o} 0,0,0 ${e},0`,`a${s},${o} 0,0,0 ${-e},0`,`l0,${r}`,`a${s},${o} 0,0,0 ${e},0`,`l0,${-r}`].join(" "),"createCylinderPathD"),Ar=d((a,t,e,r,s,o)=>[`M${a},${t+o}`,`M${a+e},${t+o}`,`a${s},${o} 0,0,0 ${-e},0`,`l0,${r}`,`a${s},${o} 0,0,0 ${e},0`,`l0,${-r}`].join(" "),"createOuterCylinderPathD"),Gr=d((a,t,e,r,s,o)=>[`M${a-e/2},${-r/2}`,`a${s},${o} 0,0,0 ${e},0`].join(" "),"createInnerCylinderPathD"),Ae=d(async(a,t)=>{let{labelStyles:e,nodeStyles:r}=D(t);t.labelStyle=e;let{shapeSvg:s,bbox:o}=await R(a,t,G(t)),i=o.width+t.padding,n=i/2,l=n/(2.5+i/50),c=o.height+l+t.padding,h,{cssStyles:p}=t;if(t.look==="handDrawn"){let f=M.svg(s),u=Ar(0,0,i,c,n,l),m=Gr(0,l,i,c,n,l),g=f.path(u,B(t,{})),b=f.path(m,B(t,{fill:"none"}));h=s.insert(()=>b,":first-child"),h=s.insert(()=>g,":first-child"),h.attr("class","basic label-container"),p&&h.attr("style",p)}else{let f=Tr(0,0,i,c,n,l);h=s.insert("path",":first-child").attr("d",f).attr("class","basic label-container").attr("style",p).attr("style",r)}return h.attr("label-offset-y",l),h.attr("transform",`translate(${-i/2}, ${-(c/2+l)})`),N(t,h),t.intersect=function(f){let u=v.rect(t,f),m=u.x-(t.x??0);if(n!=0&&(Math.abs(m)<(t.width??0)/2||Math.abs(m)==(t.width??0)/2&&Math.abs(u.y-(t.y??0))>(t.height??0)/2-l)){let g=l*l*(1-m*m/(n*n));g>0&&(g=Math.sqrt(g)),g=l-g,f.y-(t.y??0)>0&&(g=-g),u.y+=g}return u},s},"cylinder");var Ge=d(async(a,t)=>{let{labelStyles:e,nodeStyles:r}=D(t);t.labelStyle=e;let{shapeSvg:s,bbox:o,halfPadding:i}=await R(a,t,G(t)),n=o.width/2+i,l,{cssStyles:c}=t;if(t.look==="handDrawn"){let h=M.svg(s),p=B(t,{}),f=h.circle(0,0,n*2,p);l=s.insert(()=>f,":first-child"),l.attr("class","basic label-container").attr("style",c)}else l=s.insert("circle",":first-child").attr("class","basic label-container").attr("style",r).attr("r",n).attr("cx",0).attr("cy",0);return N(t,l),t.intersect=function(h){return S.info("Circle intersect",t,n,h),v.circle(t,n,h)},s},"circle");var Ve=d(async(a,t)=>{let{labelStyles:e,nodeStyles:r}=D(t);t.labelStyle=e;let{shapeSvg:s,bbox:o,halfPadding:i}=await R(a,t,G(t)),l=o.width/2+i+5,c=o.width/2+i,h,{cssStyles:p}=t;if(t.look==="handDrawn"){let f=M.svg(s),u=B(t,{roughness:.2,strokeWidth:2.5}),m=B(t,{roughness:.2,strokeWidth:1.5}),g=f.circle(0,0,l*2,u),b=f.circle(0,0,c*2,m);h=s.insert("g",":first-child"),h.attr("class",t.cssClasses).attr("style",p),h.node()?.appendChild(g),h.node()?.appendChild(b)}else{h=s.insert("g",":first-child");let f=h.insert("circle",":first-child"),u=h.insert("circle");h.attr("class","basic label-container").attr("style",r),f.attr("class","outer-circle").attr("style",r).attr("r",l).attr("cx",0).attr("cy",0),u.attr("class","inner-circle").attr("style",r).attr("r",c).attr("cx",0).attr("cy",0)}return N(t,h),t.intersect=function(f){return S.info("DoubleCircle intersect",t,l,f),v.circle(t,l,f)},s},"doublecircle");var Vr=d((a,t,e,r)=>[`M${a-r/2},${t}`,`L${a+e},${t}`,`L${a+e},${t-r}`,`L${a-r/2},${t-r}`,`L${a},${t-r/2}`,"Z"].join(" "),"createPolygonPathD"),je=d(async(a,t)=>{let{labelStyles:e,nodeStyles:r}=D(t);t.labelStyle=e;let{shapeSvg:s,bbox:o}=await R(a,t,G(t)),i=o.width+t.padding,n=o.height+t.padding,l=[{x:-n/2,y:0},{x:i,y:0},{x:i,y:-n},{x:-n/2,y:-n},{x:0,y:-n/2}],c,{cssStyles:h}=t;if(t.look==="handDrawn"){let p=M.svg(s),f=B(t,{}),u=Vr(0,0,i,n),m=p.path(u,f);c=s.insert(()=>m,":first-child").attr("transform",`translate(${-i/2}, ${n/2})`),h&&c.attr("style",h)}else c=H(s,i,n,l);return r&&c.attr("style",r),t.width=i+n,t.height=n,N(t,c),t.intersect=function(p){return v.polygon(t,l,p)},s},"rect_left_inv_arrow");var jr=d((a,t,e)=>[`M${a+e/2},${t}`,`L${a+e},${t-e/2}`,`L${a+e/2},${t-e}`,`L${a},${t-e/2}`,"Z"].join(" "),"createDecisionBoxPathD"),_e=d(async(a,t)=>{let{labelStyles:e,nodeStyles:r}=D(t);t.labelStyle=e;let{shapeSvg:s,bbox:o}=await R(a,t,G(t)),i=o.width+t.padding,n=o.height+t.padding,l=i+n,c=[{x:l/2,y:0},{x:l,y:-l/2},{x:l/2,y:-l},{x:0,y:-l/2}],h,{cssStyles:p}=t;if(t.look==="handDrawn"){let f=M.svg(s),u=B(t,{}),m=jr(0,0,l),g=f.path(m,u);h=s.insert(()=>g,":first-child").attr("transform",`translate(${-l/2}, ${l/2})`),p&&h.attr("style",p)}else h=H(s,l,l,c);return r&&h.attr("style",r),N(t,h),t.intersect=function(f){return S.debug(`APA12 Intersect called SPLIT point:`,f,` node: `,t,` res:`,v.polygon(t,c,f)),v.polygon(t,c,f)},s},"question");var _r=d((a,t,e,r,s)=>[`M${a+s},${t}`,`L${a+e-s},${t}`,`L${a+e},${t-r/2}`,`L${a+e-s},${t-r}`,`L${a+s},${t-r}`,`L${a},${t-r/2}`,"Z"].join(" "),"createHexagonPathD"),He=d(async(a,t)=>{let{labelStyles:e,nodeStyles:r}=D(t);t.labelStyle=e;let{shapeSvg:s,bbox:o}=await R(a,t,G(t)),i=4,n=o.height+t.padding,l=n/i,c=o.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}],p,{cssStyles:f}=t;if(t.look==="handDrawn"){let u=M.svg(s),m=B(t,{}),g=_r(0,0,c,n,l),b=u.path(g,m);p=s.insert(()=>b,":first-child").attr("transform",`translate(${-c/2}, ${n/2})`),f&&p.attr("style",f)}else p=H(s,c,n,h);return r&&p.attr("style",r),t.width=c,t.height=n,N(t,p),t.intersect=function(u){return v.polygon(t,h,u)},s},"hexagon");var Hr=d((a,t,e,r)=>[`M${a-2*r/6},${t}`,`L${a+e-r/6},${t}`,`L${a+e+2*r/6},${t-r}`,`L${a+r/6},${t-r}`,"Z"].join(" "),"createLeanRightPathD"),We=d(async(a,t)=>{let{labelStyles:e,nodeStyles:r}=D(t);t.labelStyle=e;let{shapeSvg:s,bbox:o}=await R(a,t,G(t)),i=o.width+t.padding,n=o.height+t.padding,l=[{x:-2*n/6,y:0},{x:i-n/6,y:0},{x:i+2*n/6,y:-n},{x:n/6,y:-n}],c,{cssStyles:h}=t;if(t.look==="handDrawn"){let p=M.svg(s),f=B(t,{}),u=Hr(0,0,i,n),m=p.path(u,f);c=s.insert(()=>m,":first-child").attr("transform",`translate(${-i/2}, ${n/2})`),h&&c.attr("style",h)}else c=H(s,i,n,l);return r&&c.attr("style",r),t.width=i,t.height=n,N(t,c),t.intersect=function(p){return v.polygon(t,l,p)},s},"lean_right");var Wr=d((a,t,e,r)=>[`M${a+2*r/6},${t}`,`L${a+e+r/6},${t}`,`L${a+e-2*r/6},${t-r}`,`L${a-r/6},${t-r}`,"Z"].join(" "),"createLeanLeftPathD"),Ie=d(async(a,t)=>{let{labelStyles:e,nodeStyles:r}=D(t);t.labelStyle=e;let{shapeSvg:s,bbox:o}=await R(a,t,G(t)),i=o.width+t.padding,n=o.height+t.padding,l=[{x:2*n/6,y:0},{x:i+n/6,y:0},{x:i-2*n/6,y:-n},{x:-n/6,y:-n}],c,{cssStyles:h}=t;if(t.look==="handDrawn"){let p=M.svg(s),f=B(t,{}),u=Wr(0,0,i,n),m=p.path(u,f);c=s.insert(()=>m,":first-child").attr("transform",`translate(${-i/2}, ${n/2})`),h&&c.attr("style",h)}else c=H(s,i,n,l);return r&&c.attr("style",r),t.width=i,t.height=n,N(t,c),t.intersect=function(p){return v.polygon(t,l,p)},s},"lean_left");var Ir=d((a,t,e,r)=>[`M${a-2*r/6},${t}`,`L${a+e+2*r/6},${t}`,`L${a+e-r/6},${t-r}`,`L${a+r/6},${t-r}`,"Z"].join(" "),"createTrapezoidPathD"),ze=d(async(a,t)=>{let{labelStyles:e,nodeStyles:r}=D(t);t.labelStyle=e;let{shapeSvg:s,bbox:o}=await R(a,t,G(t)),i=o.width+t.padding,n=o.height+t.padding,l=[{x:-2*n/6,y:0},{x:i+2*n/6,y:0},{x:i-n/6,y:-n},{x:n/6,y:-n}],c,{cssStyles:h}=t;if(t.look==="handDrawn"){let p=M.svg(s),f=B(t,{}),u=Ir(0,0,i,n),m=p.path(u,f);c=s.insert(()=>m,":first-child").attr("transform",`translate(${-i/2}, ${n/2})`),h&&c.attr("style",h)}else c=H(s,i,n,l);return r&&c.attr("style",r),t.width=i,t.height=n,N(t,c),t.intersect=function(p){return v.polygon(t,l,p)},s},"trapezoid");var zr=d((a,t,e,r)=>[`M${a+r/6},${t}`,`L${a+e-r/6},${t}`,`L${a+e+2*r/6},${t-r}`,`L${a-2*r/6},${t-r}`,"Z"].join(" "),"createInvertedTrapezoidPathD"),Xe=d(async(a,t)=>{let{labelStyles:e,nodeStyles:r}=D(t);t.labelStyle=e;let{shapeSvg:s,bbox:o}=await R(a,t,G(t)),i=o.width+t.padding,n=o.height+t.padding,l=[{x:n/6,y:0},{x:i-n/6,y:0},{x:i+2*n/6,y:-n},{x:-2*n/6,y:-n}],c,{cssStyles:h}=t;if(t.look==="handDrawn"){let p=M.svg(s),f=B(t,{}),u=zr(0,0,i,n),m=p.path(u,f);c=s.insert(()=>m,":first-child").attr("transform",`translate(${-i/2}, ${n/2})`),h&&c.attr("style",h)}else c=H(s,i,n,l);return r&&c.attr("style",r),t.width=i,t.height=n,N(t,c),t.intersect=function(p){return v.polygon(t,l,p)},s},"inv_trapezoid");var Ye=d(async(a,t)=>{let{shapeSvg:e}=await R(a,t,"label"),r=e.insert("rect",":first-child");return r.attr("width",.1).attr("height",.1),e.attr("class","label edgeLabel"),N(t,r),t.intersect=function(i){return v.rect(t,i)},e},"labelRect");var Ze={state:$e,stateStart:Ce,stateEnd:Ee,fork:Xt,join:Xt,choice:Oe,note:De,roundedRect:Ne,rectWithTitle:Re,squareRect:Pe,stadium:Be,subroutine:Te,cylinder:Ae,circle:Ge,doublecircle:Ve,odd:je,diamond:_e,hexagon:He,lean_right:We,lean_left:Ie,trapezoid:ze,inv_trapezoid:Xe,labelRect:Ye},lt=new Map,Ri=d(async(a,t,e)=>{let r,s;if(t.shape==="rect"&&(t.rx&&t.ry?t.shape="roundedRect":t.shape="squareRect"),t.link){let o;P().securityLevel==="sandbox"?o="_top":t.linkTarget&&(o=t.linkTarget||"_blank"),r=a.insert("svg:a").attr("xlink:href",t.link).attr("target",o),s=await Ze[t.shape](r,t,e)}else s=await Ze[t.shape](a,t,e),r=s;return t.tooltip&&s.attr("title",t.tooltip),lt.set(t.id,r),t.haveCallback&<.get(t.id).attr("class",lt.get(t.id).attr("class")+" clickable"),r},"insertNode"),Ti=d((a,t)=>{lt.set(t.id,a)},"setNodeElem"),Ai=d(()=>{lt.clear()},"clear"),Gi=d(a=>{let t=lt.get(a.id);S.trace("Transforming node",a.diff,a,"translate("+(a.x-a.width/2-5)+", "+a.width/2+")");let e=8,r=a.diff||0;return a.clusterNode?t.attr("transform","translate("+(a.x+r-a.width/2)+", "+(a.y-a.height/2-e)+")"):t.attr("transform","translate("+a.x+", "+a.y+")"),r},"positionNode");export{bs as a,xs as b,As as c,Gs as d,Vs as e,js as f,Is as g,R as h,N as i,Ri as j,Ti as k,Ai as l,Gi as m};




© 2015 - 2024 Weber Informatics LLC | Privacy Policy