17 lines
108 KiB
JavaScript
17 lines
108 KiB
JavaScript
import{a as Tt}from"./chunk-V55NTXQN.min.js";import{c as ft}from"./chunk-BD4P4Z7J.min.js";import{d as ct}from"./chunk-AUO2PXKS.min.js";import{i as ls,k as cs,o as ut,q as J}from"./chunk-PYPO7LRM.min.js";import{D as Rt,H as Lt,I as Q,K as At,M as rs,N as is,Z as X,aa as ns,h as S,ia as Y,j as q,v as as}from"./chunk-U3SD26FK.min.js";function Wt(l,t,r){if(l&&l.length){let[a,e]=t,i=Math.PI/180*r,o=Math.cos(i),s=Math.sin(i);for(let h of l){let[n,c]=h;h[0]=(n-a)*o-(c-e)*s+a,h[1]=(n-a)*s+(c-e)*o+e}}}function _e(l,t){return l[0]===t[0]&&l[1]===t[1]}function ze(l,t,r,a=1){let e=r,i=Math.max(t,.1),o=l[0]&&l[0][0]&&typeof l[0][0]=="number"?[l]:l,s=[0,0];if(e)for(let n of o)Wt(n,s,e);let h=function(n,c,g){let f=[];for(let x of n){let b=[...x];_e(b[0],b[b.length-1])||b.push([b[0][0],b[0][1]]),b.length>2&&f.push(b)}let p=[];c=Math.max(c,.1);let u=[];for(let x of f)for(let b=0;b<x.length-1;b++){let k=x[b],w=x[b+1];if(k[1]!==w[1]){let v=Math.min(k[1],w[1]);u.push({ymin:v,ymax:Math.max(k[1],w[1]),x:v===k[1]?k[0]:w[0],islope:(w[0]-k[0])/(w[1]-k[1])})}}if(u.sort((x,b)=>x.ymin<b.ymin?-1:x.ymin>b.ymin?1:x.x<b.x?-1:x.x>b.x?1:x.ymax===b.ymax?0:(x.ymax-b.ymax)/Math.abs(x.ymax-b.ymax)),!u.length)return p;let y=[],m=u[0].ymin,d=0;for(;y.length||u.length;){if(u.length){let x=-1;for(let b=0;b<u.length&&!(u[b].ymin>m);b++)x=b;u.splice(0,x+1).forEach(b=>{y.push({s:m,edge:b})})}if(y=y.filter(x=>!(x.edge.ymax<=m)),y.sort((x,b)=>x.edge.x===b.edge.x?0:(x.edge.x-b.edge.x)/Math.abs(x.edge.x-b.edge.x)),(g!==1||d%c==0)&&y.length>1)for(let x=0;x<y.length;x+=2){let b=x+1;if(b>=y.length)break;let k=y[x].edge,w=y[b].edge;p.push([[Math.round(k.x),m],[Math.round(w.x),m]])}m+=g,y.forEach(x=>{x.edge.x=x.edge.x+g*x.edge.islope}),d++}return p}(o,i,a);if(e){for(let n of o)Wt(n,s,-e);(function(n,c,g){let f=[];n.forEach(p=>f.push(...p)),Wt(f,c,g)})(h,s,-e)}return h}function xt(l,t){var r;let a=t.hachureAngle+90,e=t.hachureGap;e<0&&(e=4*t.strokeWidth),e=Math.round(Math.max(e,.1));let i=1;return t.roughness>=1&&(((r=t.randomizer)===null||r===void 0?void 0:r.next())||Math.random())>.7&&(i=e),ze(l,e,a,i||1)}var mt=class{constructor(t){this.helper=t}fillPolygons(t,r){return this._fillPolygons(t,r)}_fillPolygons(t,r){let a=xt(t,r);return{type:"fillSketch",ops:this.renderLines(a,r)}}renderLines(t,r){let a=[];for(let e of t)a.push(...this.helper.doubleLineOps(e[0][0],e[0][1],e[1][0],e[1][1],r));return a}};function Ct(l){let t=l[0],r=l[1];return Math.sqrt(Math.pow(t[0]-r[0],2)+Math.pow(t[1]-r[1],2))}var _t=class extends mt{fillPolygons(t,r){let a=r.hachureGap;a<0&&(a=4*r.strokeWidth),a=Math.max(a,.1);let e=xt(t,Object.assign({},r,{hachureGap:a})),i=Math.PI/180*r.hachureAngle,o=[],s=.5*a*Math.cos(i),h=.5*a*Math.sin(i);for(let[n,c]of e)Ct([n,c])&&o.push([[n[0]-s,n[1]+h],[...c]],[[n[0]+s,n[1]-h],[...c]]);return{type:"fillSketch",ops:this.renderLines(o,r)}}},zt=class extends mt{fillPolygons(t,r){let a=this._fillPolygons(t,r),e=Object.assign({},r,{hachureAngle:r.hachureAngle+90}),i=this._fillPolygons(t,e);return a.ops=a.ops.concat(i.ops),a}},jt=class{constructor(t){this.helper=t}fillPolygons(t,r){let a=xt(t,r=Object.assign({},r,{hachureAngle:0}));return this.dotsOnLines(a,r)}dotsOnLines(t,r){let a=[],e=r.hachureGap;e<0&&(e=4*r.strokeWidth),e=Math.max(e,.1);let i=r.fillWeight;i<0&&(i=r.strokeWidth/2);let o=e/4;for(let s of t){let h=Ct(s),n=h/e,c=Math.ceil(n)-1,g=h-c*e,f=(s[0][0]+s[1][0])/2-e/4,p=Math.min(s[0][1],s[1][1]);for(let u=0;u<c;u++){let y=p+g+u*e,m=f-o+2*Math.random()*o,d=y-o+2*Math.random()*o,x=this.helper.ellipse(m,d,i,i,r);a.push(...x.ops)}}return{type:"fillSketch",ops:a}}},Gt=class{constructor(t){this.helper=t}fillPolygons(t,r){let a=xt(t,r);return{type:"fillSketch",ops:this.dashedLine(a,r)}}dashedLine(t,r){let a=r.dashOffset<0?r.hachureGap<0?4*r.strokeWidth:r.hachureGap:r.dashOffset,e=r.dashGap<0?r.hachureGap<0?4*r.strokeWidth:r.hachureGap:r.dashGap,i=[];return t.forEach(o=>{let s=Ct(o),h=Math.floor(s/(a+e)),n=(s+e-h*(a+e))/2,c=o[0],g=o[1];c[0]>g[0]&&(c=o[1],g=o[0]);let f=Math.atan((g[1]-c[1])/(g[0]-c[0]));for(let p=0;p<h;p++){let u=p*(a+e),y=u+a,m=[c[0]+u*Math.cos(f)+n*Math.cos(f),c[1]+u*Math.sin(f)+n*Math.sin(f)],d=[c[0]+y*Math.cos(f)+n*Math.cos(f),c[1]+y*Math.sin(f)+n*Math.sin(f)];i.push(...this.helper.doubleLineOps(m[0],m[1],d[0],d[1],r))}}),i}},Ft=class{constructor(t){this.helper=t}fillPolygons(t,r){let a=r.hachureGap<0?4*r.strokeWidth:r.hachureGap,e=r.zigzagOffset<0?a:r.zigzagOffset,i=xt(t,r=Object.assign({},r,{hachureGap:a+e}));return{type:"fillSketch",ops:this.zigzagLines(i,e,r)}}zigzagLines(t,r,a){let e=[];return t.forEach(i=>{let o=Ct(i),s=Math.round(o/(2*r)),h=i[0],n=i[1];h[0]>n[0]&&(h=i[1],n=i[0]);let c=Math.atan((n[1]-h[1])/(n[0]-h[0]));for(let g=0;g<s;g++){let f=2*g*r,p=2*(g+1)*r,u=Math.sqrt(2*Math.pow(r,2)),y=[h[0]+f*Math.cos(c),h[1]+f*Math.sin(c)],m=[h[0]+p*Math.cos(c),h[1]+p*Math.sin(c)],d=[y[0]+u*Math.cos(c+Math.PI/4),y[1]+u*Math.sin(c+Math.PI/4)];e.push(...this.helper.doubleLineOps(y[0],y[1],d[0],d[1],a),...this.helper.doubleLineOps(d[0],d[1],m[0],m[1],a))}}),e}},U={},qt=class{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}},je=0,Ht=1,os=2,wt={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function It(l,t){return l.type===t}function Jt(l){let t=[],r=function(o){let s=new Array;for(;o!=="";)if(o.match(/^([ \t\r\n,]+)/))o=o.substr(RegExp.$1.length);else if(o.match(/^([aAcChHlLmMqQsStTvVzZ])/))s[s.length]={type:je,text:RegExp.$1},o=o.substr(RegExp.$1.length);else{if(!o.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];s[s.length]={type:Ht,text:`${parseFloat(RegExp.$1)}`},o=o.substr(RegExp.$1.length)}return s[s.length]={type:os,text:""},s}(l),a="BOD",e=0,i=r[e];for(;!It(i,os);){let o=0,s=[];if(a==="BOD"){if(i.text!=="M"&&i.text!=="m")return Jt("M0,0"+l);e++,o=wt[i.text],a=i.text}else It(i,Ht)?o=wt[a]:(e++,o=wt[i.text],a=i.text);if(!(e+o<r.length))throw new Error("Path data ended short");for(let h=e;h<e+o;h++){let n=r[h];if(!It(n,Ht))throw new Error("Param not a number: "+a+","+n.text);s[s.length]=+n.text}if(typeof wt[a]!="number")throw new Error("Bad segment: "+a);{let h={key:a,data:s};t.push(h),e+=o,i=r[e],a==="M"&&(a="L"),a==="m"&&(a="l")}}return t}function ms(l){let t=0,r=0,a=0,e=0,i=[];for(let{key:o,data:s}of l)switch(o){case"M":i.push({key:"M",data:[...s]}),[t,r]=s,[a,e]=s;break;case"m":t+=s[0],r+=s[1],i.push({key:"M",data:[t,r]}),a=t,e=r;break;case"L":i.push({key:"L",data:[...s]}),[t,r]=s;break;case"l":t+=s[0],r+=s[1],i.push({key:"L",data:[t,r]});break;case"C":i.push({key:"C",data:[...s]}),t=s[4],r=s[5];break;case"c":{let h=s.map((n,c)=>c%2?n+r:n+t);i.push({key:"C",data:h}),t=h[4],r=h[5];break}case"Q":i.push({key:"Q",data:[...s]}),t=s[2],r=s[3];break;case"q":{let h=s.map((n,c)=>c%2?n+r:n+t);i.push({key:"Q",data:h}),t=h[2],r=h[3];break}case"A":i.push({key:"A",data:[...s]}),t=s[5],r=s[6];break;case"a":t+=s[5],r+=s[6],i.push({key:"A",data:[s[0],s[1],s[2],s[3],s[4],t,r]});break;case"H":i.push({key:"H",data:[...s]}),t=s[0];break;case"h":t+=s[0],i.push({key:"H",data:[t]});break;case"V":i.push({key:"V",data:[...s]}),r=s[0];break;case"v":r+=s[0],i.push({key:"V",data:[r]});break;case"S":i.push({key:"S",data:[...s]}),t=s[2],r=s[3];break;case"s":{let h=s.map((n,c)=>c%2?n+r:n+t);i.push({key:"S",data:h}),t=h[2],r=h[3];break}case"T":i.push({key:"T",data:[...s]}),t=s[0],r=s[1];break;case"t":t+=s[0],r+=s[1],i.push({key:"T",data:[t,r]});break;case"Z":case"z":i.push({key:"Z",data:[]}),t=a,r=e}return i}function xs(l){let t=[],r="",a=0,e=0,i=0,o=0,s=0,h=0;for(let{key:n,data:c}of l){switch(n){case"M":t.push({key:"M",data:[...c]}),[a,e]=c,[i,o]=c;break;case"C":t.push({key:"C",data:[...c]}),a=c[4],e=c[5],s=c[2],h=c[3];break;case"L":t.push({key:"L",data:[...c]}),[a,e]=c;break;case"H":a=c[0],t.push({key:"L",data:[a,e]});break;case"V":e=c[0],t.push({key:"L",data:[a,e]});break;case"S":{let g=0,f=0;r==="C"||r==="S"?(g=a+(a-s),f=e+(e-h)):(g=a,f=e),t.push({key:"C",data:[g,f,...c]}),s=c[0],h=c[1],a=c[2],e=c[3];break}case"T":{let[g,f]=c,p=0,u=0;r==="Q"||r==="T"?(p=a+(a-s),u=e+(e-h)):(p=a,u=e);let y=a+2*(p-a)/3,m=e+2*(u-e)/3,d=g+2*(p-g)/3,x=f+2*(u-f)/3;t.push({key:"C",data:[y,m,d,x,g,f]}),s=p,h=u,a=g,e=f;break}case"Q":{let[g,f,p,u]=c,y=a+2*(g-a)/3,m=e+2*(f-e)/3,d=p+2*(g-p)/3,x=u+2*(f-u)/3;t.push({key:"C",data:[y,m,d,x,p,u]}),s=g,h=f,a=p,e=u;break}case"A":{let g=Math.abs(c[0]),f=Math.abs(c[1]),p=c[2],u=c[3],y=c[4],m=c[5],d=c[6];g===0||f===0?(t.push({key:"C",data:[a,e,m,d,m,d]}),a=m,e=d):(a!==m||e!==d)&&(bs(a,e,m,d,g,f,p,u,y).forEach(function(x){t.push({key:"C",data:x})}),a=m,e=d);break}case"Z":t.push({key:"Z",data:[]}),a=i,e=o}r=n}return t}function yt(l,t,r){return[l*Math.cos(r)-t*Math.sin(r),l*Math.sin(r)+t*Math.cos(r)]}function bs(l,t,r,a,e,i,o,s,h,n){let c=(g=o,Math.PI*g/180);var g;let f=[],p=0,u=0,y=0,m=0;if(n)[p,u,y,m]=n;else{[l,t]=yt(l,t,-c),[r,a]=yt(r,a,-c);let P=(l-r)/2,A=(t-a)/2,W=P*P/(e*e)+A*A/(i*i);W>1&&(W=Math.sqrt(W),e*=W,i*=W);let B=e*e,O=i*i,z=B*O-B*A*A-O*P*P,Z=B*A*A+O*P*P,tt=(s===h?-1:1)*Math.sqrt(Math.abs(z/Z));y=tt*e*A/i+(l+r)/2,m=tt*-i*P/e+(t+a)/2,p=Math.asin(parseFloat(((t-m)/i).toFixed(9))),u=Math.asin(parseFloat(((a-m)/i).toFixed(9))),l<y&&(p=Math.PI-p),r<y&&(u=Math.PI-u),p<0&&(p=2*Math.PI+p),u<0&&(u=2*Math.PI+u),h&&p>u&&(p-=2*Math.PI),!h&&u>p&&(u-=2*Math.PI)}let d=u-p;if(Math.abs(d)>120*Math.PI/180){let P=u,A=r,W=a;u=h&&u>p?p+120*Math.PI/180*1:p+120*Math.PI/180*-1,f=bs(r=y+e*Math.cos(u),a=m+i*Math.sin(u),A,W,e,i,o,0,h,[u,P,y,m])}d=u-p;let x=Math.cos(p),b=Math.sin(p),k=Math.cos(u),w=Math.sin(u),v=Math.tan(d/4),$=4/3*e*v,D=4/3*i*v,C=[l,t],R=[l+$*b,t-D*x],L=[r+$*w,a-D*k],E=[r,a];if(R[0]=2*C[0]-R[0],R[1]=2*C[1]-R[1],n)return[R,L,E].concat(f);{f=[R,L,E].concat(f);let P=[];for(let A=0;A<f.length;A+=3){let W=yt(f[A][0],f[A][1],c),B=yt(f[A+1][0],f[A+1][1],c),O=yt(f[A+2][0],f[A+2][1],c);P.push([W[0],W[1],B[0],B[1],O[0],O[1]])}return P}}var Ge={randOffset:function(l,t){return _(l,t)},randOffsetWithRange:function(l,t,r){return $t(l,t,r)},ellipse:function(l,t,r,a,e){let i=Ss(r,a,e);return Xt(l,t,e,i).opset},doubleLineOps:function(l,t,r,a,e){return it(l,t,r,a,e,!0)}};function ws(l,t,r,a,e){return{type:"path",ops:it(l,t,r,a,e)}}function kt(l,t,r){let a=(l||[]).length;if(a>2){let e=[];for(let i=0;i<a-1;i++)e.push(...it(l[i][0],l[i][1],l[i+1][0],l[i+1][1],r));return t&&e.push(...it(l[a-1][0],l[a-1][1],l[0][0],l[0][1],r)),{type:"path",ops:e}}return a===2?ws(l[0][0],l[0][1],l[1][0],l[1][1],r):{type:"path",ops:[]}}function Fe(l,t,r,a,e){return function(i,o){return kt(i,!0,o)}([[l,t],[l+r,t],[l+r,t+a],[l,t+a]],e)}function hs(l,t){if(l.length){let r=typeof l[0][0]=="number"?[l]:l,a=St(r[0],1*(1+.2*t.roughness),t),e=t.disableMultiStroke?[]:St(r[0],1.5*(1+.22*t.roughness),fs(t));for(let i=1;i<r.length;i++){let o=r[i];if(o.length){let s=St(o,1*(1+.2*t.roughness),t),h=t.disableMultiStroke?[]:St(o,1.5*(1+.22*t.roughness),fs(t));for(let n of s)n.op!=="move"&&a.push(n);for(let n of h)n.op!=="move"&&e.push(n)}}return{type:"path",ops:a.concat(e)}}return{type:"path",ops:[]}}function Ss(l,t,r){let a=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(l/2,2)+Math.pow(t/2,2))/2)),e=Math.ceil(Math.max(r.curveStepCount,r.curveStepCount/Math.sqrt(200)*a)),i=2*Math.PI/e,o=Math.abs(l/2),s=Math.abs(t/2),h=1-r.curveFitting;return o+=_(o*h,r),s+=_(s*h,r),{increment:i,rx:o,ry:s}}function Xt(l,t,r,a){let[e,i]=us(a.increment,l,t,a.rx,a.ry,1,a.increment*$t(.1,$t(.4,1,r),r),r),o=Dt(e,null,r);if(!r.disableMultiStroke&&r.roughness!==0){let[s]=us(a.increment,l,t,a.rx,a.ry,1.5,0,r),h=Dt(s,null,r);o=o.concat(h)}return{estimatedPoints:i,opset:{type:"path",ops:o}}}function gs(l,t,r,a,e,i,o,s,h){let n=l,c=t,g=Math.abs(r/2),f=Math.abs(a/2);g+=_(.01*g,h),f+=_(.01*f,h);let p=e,u=i;for(;p<0;)p+=2*Math.PI,u+=2*Math.PI;u-p>2*Math.PI&&(p=0,u=2*Math.PI);let y=2*Math.PI/h.curveStepCount,m=Math.min(y/2,(u-p)/2),d=ys(m,n,c,g,f,p,u,1,h);if(!h.disableMultiStroke){let x=ys(m,n,c,g,f,p,u,1.5,h);d.push(...x)}return o&&(s?d.push(...it(n,c,n+g*Math.cos(p),c+f*Math.sin(p),h),...it(n,c,n+g*Math.cos(u),c+f*Math.sin(u),h)):d.push({op:"lineTo",data:[n,c]},{op:"lineTo",data:[n+g*Math.cos(p),c+f*Math.sin(p)]})),{type:"path",ops:d}}function ps(l,t){let r=xs(ms(Jt(l))),a=[],e=[0,0],i=[0,0];for(let{key:o,data:s}of r)switch(o){case"M":i=[s[0],s[1]],e=[s[0],s[1]];break;case"L":a.push(...it(i[0],i[1],s[0],s[1],t)),i=[s[0],s[1]];break;case"C":{let[h,n,c,g,f,p]=s;a.push(...qe(h,n,c,g,f,p,i,t)),i=[f,p];break}case"Z":a.push(...it(i[0],i[1],e[0],e[1],t)),i=[e[0],e[1]]}return{type:"path",ops:a}}function Et(l,t){let r=[];for(let a of l)if(a.length){let e=t.maxRandomnessOffset||0,i=a.length;if(i>2){r.push({op:"move",data:[a[0][0]+_(e,t),a[0][1]+_(e,t)]});for(let o=1;o<i;o++)r.push({op:"lineTo",data:[a[o][0]+_(e,t),a[o][1]+_(e,t)]})}}return{type:"fillPath",ops:r}}function ot(l,t){return function(r,a){let e=r.fillStyle||"hachure";if(!U[e])switch(e){case"zigzag":U[e]||(U[e]=new _t(a));break;case"cross-hatch":U[e]||(U[e]=new zt(a));break;case"dots":U[e]||(U[e]=new jt(a));break;case"dashed":U[e]||(U[e]=new Gt(a));break;case"zigzag-line":U[e]||(U[e]=new Ft(a));break;default:e="hachure",U[e]||(U[e]=new mt(a))}return U[e]}(t,Ge).fillPolygons(l,t)}function fs(l){let t=Object.assign({},l);return t.randomizer=void 0,l.seed&&(t.seed=l.seed+1),t}function Ms(l){return l.randomizer||(l.randomizer=new qt(l.seed||0)),l.randomizer.next()}function $t(l,t,r,a=1){return r.roughness*a*(Ms(r)*(t-l)+l)}function _(l,t,r=1){return $t(-l,l,t,r)}function it(l,t,r,a,e,i=!1){let o=i?e.disableMultiStrokeFill:e.disableMultiStroke,s=Yt(l,t,r,a,e,!0,!1);if(o)return s;let h=Yt(l,t,r,a,e,!0,!0);return s.concat(h)}function Yt(l,t,r,a,e,i,o){let s=Math.pow(l-r,2)+Math.pow(t-a,2),h=Math.sqrt(s),n=1;n=h<200?1:h>500?.4:-.0016668*h+1.233334;let c=e.maxRandomnessOffset||0;c*c*100>s&&(c=h/10);let g=c/2,f=.2+.2*Ms(e),p=e.bowing*e.maxRandomnessOffset*(a-t)/200,u=e.bowing*e.maxRandomnessOffset*(l-r)/200;p=_(p,e,n),u=_(u,e,n);let y=[],m=()=>_(g,e,n),d=()=>_(c,e,n),x=e.preserveVertices;return i&&(o?y.push({op:"move",data:[l+(x?0:m()),t+(x?0:m())]}):y.push({op:"move",data:[l+(x?0:_(c,e,n)),t+(x?0:_(c,e,n))]})),o?y.push({op:"bcurveTo",data:[p+l+(r-l)*f+m(),u+t+(a-t)*f+m(),p+l+2*(r-l)*f+m(),u+t+2*(a-t)*f+m(),r+(x?0:m()),a+(x?0:m())]}):y.push({op:"bcurveTo",data:[p+l+(r-l)*f+d(),u+t+(a-t)*f+d(),p+l+2*(r-l)*f+d(),u+t+2*(a-t)*f+d(),r+(x?0:d()),a+(x?0:d())]}),y}function St(l,t,r){if(!l.length)return[];let a=[];a.push([l[0][0]+_(t,r),l[0][1]+_(t,r)]),a.push([l[0][0]+_(t,r),l[0][1]+_(t,r)]);for(let e=1;e<l.length;e++)a.push([l[e][0]+_(t,r),l[e][1]+_(t,r)]),e===l.length-1&&a.push([l[e][0]+_(t,r),l[e][1]+_(t,r)]);return Dt(a,null,r)}function Dt(l,t,r){let a=l.length,e=[];if(a>3){let i=[],o=1-r.curveTightness;e.push({op:"move",data:[l[1][0],l[1][1]]});for(let s=1;s+2<a;s++){let h=l[s];i[0]=[h[0],h[1]],i[1]=[h[0]+(o*l[s+1][0]-o*l[s-1][0])/6,h[1]+(o*l[s+1][1]-o*l[s-1][1])/6],i[2]=[l[s+1][0]+(o*l[s][0]-o*l[s+2][0])/6,l[s+1][1]+(o*l[s][1]-o*l[s+2][1])/6],i[3]=[l[s+1][0],l[s+1][1]],e.push({op:"bcurveTo",data:[i[1][0],i[1][1],i[2][0],i[2][1],i[3][0],i[3][1]]})}if(t&&t.length===2){let s=r.maxRandomnessOffset;e.push({op:"lineTo",data:[t[0]+_(s,r),t[1]+_(s,r)]})}}else a===3?(e.push({op:"move",data:[l[1][0],l[1][1]]}),e.push({op:"bcurveTo",data:[l[1][0],l[1][1],l[2][0],l[2][1],l[2][0],l[2][1]]})):a===2&&e.push(...Yt(l[0][0],l[0][1],l[1][0],l[1][1],r,!0,!0));return e}function us(l,t,r,a,e,i,o,s){let h=[],n=[];if(s.roughness===0){l/=4,n.push([t+a*Math.cos(-l),r+e*Math.sin(-l)]);for(let c=0;c<=2*Math.PI;c+=l){let g=[t+a*Math.cos(c),r+e*Math.sin(c)];h.push(g),n.push(g)}n.push([t+a*Math.cos(0),r+e*Math.sin(0)]),n.push([t+a*Math.cos(l),r+e*Math.sin(l)])}else{let c=_(.5,s)-Math.PI/2;n.push([_(i,s)+t+.9*a*Math.cos(c-l),_(i,s)+r+.9*e*Math.sin(c-l)]);let g=2*Math.PI+c-.01;for(let f=c;f<g;f+=l){let p=[_(i,s)+t+a*Math.cos(f),_(i,s)+r+e*Math.sin(f)];h.push(p),n.push(p)}n.push([_(i,s)+t+a*Math.cos(c+2*Math.PI+.5*o),_(i,s)+r+e*Math.sin(c+2*Math.PI+.5*o)]),n.push([_(i,s)+t+.98*a*Math.cos(c+o),_(i,s)+r+.98*e*Math.sin(c+o)]),n.push([_(i,s)+t+.9*a*Math.cos(c+.5*o),_(i,s)+r+.9*e*Math.sin(c+.5*o)])}return[n,h]}function ys(l,t,r,a,e,i,o,s,h){let n=i+_(.1,h),c=[];c.push([_(s,h)+t+.9*a*Math.cos(n-l),_(s,h)+r+.9*e*Math.sin(n-l)]);for(let g=n;g<=o;g+=l)c.push([_(s,h)+t+a*Math.cos(g),_(s,h)+r+e*Math.sin(g)]);return c.push([t+a*Math.cos(o),r+e*Math.sin(o)]),c.push([t+a*Math.cos(o),r+e*Math.sin(o)]),Dt(c,null,h)}function qe(l,t,r,a,e,i,o,s){let h=[],n=[s.maxRandomnessOffset||1,(s.maxRandomnessOffset||1)+.3],c=[0,0],g=s.disableMultiStroke?1:2,f=s.preserveVertices;for(let p=0;p<g;p++)p===0?h.push({op:"move",data:[o[0],o[1]]}):h.push({op:"move",data:[o[0]+(f?0:_(n[0],s)),o[1]+(f?0:_(n[0],s))]}),c=f?[e,i]:[e+_(n[p],s),i+_(n[p],s)],h.push({op:"bcurveTo",data:[l+_(n[p],s),t+_(n[p],s),r+_(n[p],s),a+_(n[p],s),c[0],c[1]]});return h}function dt(l){return[...l]}function ds(l,t=0){let r=l.length;if(r<3)throw new Error("A curve must have at least three points.");let a=[];if(r===3)a.push(dt(l[0]),dt(l[1]),dt(l[2]),dt(l[2]));else{let e=[];e.push(l[0],l[0]);for(let s=1;s<l.length;s++)e.push(l[s]),s===l.length-1&&e.push(l[s]);let i=[],o=1-t;a.push(dt(e[0]));for(let s=1;s+2<e.length;s++){let h=e[s];i[0]=[h[0],h[1]],i[1]=[h[0]+(o*e[s+1][0]-o*e[s-1][0])/6,h[1]+(o*e[s+1][1]-o*e[s-1][1])/6],i[2]=[e[s+1][0]+(o*e[s][0]-o*e[s+2][0])/6,e[s+1][1]+(o*e[s][1]-o*e[s+2][1])/6],i[3]=[e[s+1][0],e[s+1][1]],a.push(i[1],i[2],i[3])}}return a}function vt(l,t){return Math.pow(l[0]-t[0],2)+Math.pow(l[1]-t[1],2)}function Xe(l,t,r){let a=vt(t,r);if(a===0)return vt(l,t);let e=((l[0]-t[0])*(r[0]-t[0])+(l[1]-t[1])*(r[1]-t[1]))/a;return e=Math.max(0,Math.min(1,e)),vt(l,lt(t,r,e))}function lt(l,t,r){return[l[0]+(t[0]-l[0])*r,l[1]+(t[1]-l[1])*r]}function Vt(l,t,r,a){let e=a||[];if(function(s,h){let n=s[h+0],c=s[h+1],g=s[h+2],f=s[h+3],p=3*c[0]-2*n[0]-f[0];p*=p;let u=3*c[1]-2*n[1]-f[1];u*=u;let y=3*g[0]-2*f[0]-n[0];y*=y;let m=3*g[1]-2*f[1]-n[1];return m*=m,p<y&&(p=y),u<m&&(u=m),p+u}(l,t)<r){let s=l[t+0];e.length?(i=e[e.length-1],o=s,Math.sqrt(vt(i,o))>1&&e.push(s)):e.push(s),e.push(l[t+3])}else{let h=l[t+0],n=l[t+1],c=l[t+2],g=l[t+3],f=lt(h,n,.5),p=lt(n,c,.5),u=lt(c,g,.5),y=lt(f,p,.5),m=lt(p,u,.5),d=lt(y,m,.5);Vt([h,f,y,d],0,r,e),Vt([d,m,u,g],0,r,e)}var i,o;return e}function Ye(l,t){return Pt(l,0,l.length,t)}function Pt(l,t,r,a,e){let i=e||[],o=l[t],s=l[r-1],h=0,n=1;for(let c=t+1;c<r-1;++c){let g=Xe(l[c],o,s);g>h&&(h=g,n=c)}return Math.sqrt(h)>a?(Pt(l,t,n+1,a,i),Pt(l,n,r,a,i)):(i.length||i.push(o),i.push(s)),i}function Ot(l,t=.15,r){let a=[],e=(l.length-1)/3;for(let i=0;i<e;i++)Vt(l,3*i,t,a);return r&&r>0?Pt(a,0,a.length,r):a}var K="none",ht=class{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,a){return{shape:t,sets:r||[],options:a||this.defaultOptions}}line(t,r,a,e,i){let o=this._o(i);return this._d("line",[ws(t,r,a,e,o)],o)}rectangle(t,r,a,e,i){let o=this._o(i),s=[],h=Fe(t,r,a,e,o);if(o.fill){let n=[[t,r],[t+a,r],[t+a,r+e],[t,r+e]];o.fillStyle==="solid"?s.push(Et([n],o)):s.push(ot([n],o))}return o.stroke!==K&&s.push(h),this._d("rectangle",s,o)}ellipse(t,r,a,e,i){let o=this._o(i),s=[],h=Ss(a,e,o),n=Xt(t,r,o,h);if(o.fill)if(o.fillStyle==="solid"){let c=Xt(t,r,o,h).opset;c.type="fillPath",s.push(c)}else s.push(ot([n.estimatedPoints],o));return o.stroke!==K&&s.push(n.opset),this._d("ellipse",s,o)}circle(t,r,a,e){let i=this.ellipse(t,r,a,a,e);return i.shape="circle",i}linearPath(t,r){let a=this._o(r);return this._d("linearPath",[kt(t,!1,a)],a)}arc(t,r,a,e,i,o,s=!1,h){let n=this._o(h),c=[],g=gs(t,r,a,e,i,o,s,!0,n);if(s&&n.fill)if(n.fillStyle==="solid"){let f=Object.assign({},n);f.disableMultiStroke=!0;let p=gs(t,r,a,e,i,o,!0,!1,f);p.type="fillPath",c.push(p)}else c.push(function(f,p,u,y,m,d,x){let b=f,k=p,w=Math.abs(u/2),v=Math.abs(y/2);w+=_(.01*w,x),v+=_(.01*v,x);let $=m,D=d;for(;$<0;)$+=2*Math.PI,D+=2*Math.PI;D-$>2*Math.PI&&($=0,D=2*Math.PI);let C=(D-$)/x.curveStepCount,R=[];for(let L=$;L<=D;L+=C)R.push([b+w*Math.cos(L),k+v*Math.sin(L)]);return R.push([b+w*Math.cos(D),k+v*Math.sin(D)]),R.push([b,k]),ot([R],x)}(t,r,a,e,i,o,n));return n.stroke!==K&&c.push(g),this._d("arc",c,n)}curve(t,r){let a=this._o(r),e=[],i=hs(t,a);if(a.fill&&a.fill!==K)if(a.fillStyle==="solid"){let o=hs(t,Object.assign(Object.assign({},a),{disableMultiStroke:!0,roughness:a.roughness?a.roughness+a.fillShapeRoughnessGain:0}));e.push({type:"fillPath",ops:this._mergedShape(o.ops)})}else{let o=[],s=t;if(s.length){let h=typeof s[0][0]=="number"?[s]:s;for(let n of h)n.length<3?o.push(...n):n.length===3?o.push(...Ot(ds([n[0],n[0],n[1],n[2]]),10,(1+a.roughness)/2)):o.push(...Ot(ds(n),10,(1+a.roughness)/2))}o.length&&e.push(ot([o],a))}return a.stroke!==K&&e.push(i),this._d("curve",e,a)}polygon(t,r){let a=this._o(r),e=[],i=kt(t,!0,a);return a.fill&&(a.fillStyle==="solid"?e.push(Et([t],a)):e.push(ot([t],a))),a.stroke!==K&&e.push(i),this._d("polygon",e,a)}path(t,r){let a=this._o(r),e=[];if(!t)return this._d("path",e,a);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let i=a.fill&&a.fill!=="transparent"&&a.fill!==K,o=a.stroke!==K,s=!!(a.simplification&&a.simplification<1),h=function(c,g,f){let p=xs(ms(Jt(c))),u=[],y=[],m=[0,0],d=[],x=()=>{d.length>=4&&y.push(...Ot(d,g)),d=[]},b=()=>{x(),y.length&&(u.push(y),y=[])};for(let{key:w,data:v}of p)switch(w){case"M":b(),m=[v[0],v[1]],y.push(m);break;case"L":x(),y.push([v[0],v[1]]);break;case"C":if(!d.length){let $=y.length?y[y.length-1]:m;d.push([$[0],$[1]])}d.push([v[0],v[1]]),d.push([v[2],v[3]]),d.push([v[4],v[5]]);break;case"Z":x(),y.push([m[0],m[1]])}if(b(),!f)return u;let k=[];for(let w of u){let v=Ye(w,f);v.length&&k.push(v)}return k}(t,1,s?4-4*(a.simplification||1):(1+a.roughness)/2),n=ps(t,a);if(i)if(a.fillStyle==="solid")if(h.length===1){let c=ps(t,Object.assign(Object.assign({},a),{disableMultiStroke:!0,roughness:a.roughness?a.roughness+a.fillShapeRoughnessGain:0}));e.push({type:"fillPath",ops:this._mergedShape(c.ops)})}else e.push(Et(h,a));else e.push(ot(h,a));return o&&(s?h.forEach(c=>{e.push(kt(c,!1,a))}):e.push(n)),this._d("path",e,a)}opsToPath(t,r){let a="";for(let e of t.ops){let i=typeof r=="number"&&r>=0?e.data.map(o=>+o.toFixed(r)):e.data;switch(e.op){case"move":a+=`M${i[0]} ${i[1]} `;break;case"bcurveTo":a+=`C${i[0]} ${i[1]}, ${i[2]} ${i[3]}, ${i[4]} ${i[5]} `;break;case"lineTo":a+=`L${i[0]} ${i[1]} `}}return a.trim()}toPaths(t){let r=t.sets||[],a=t.options||this.defaultOptions,e=[];for(let i of r){let o=null;switch(i.type){case"path":o={d:this.opsToPath(i),stroke:a.stroke,strokeWidth:a.strokeWidth,fill:K};break;case"fillPath":o={d:this.opsToPath(i),stroke:K,strokeWidth:0,fill:a.fill||K};break;case"fillSketch":o=this.fillSketch(i,a)}o&&e.push(o)}return e}fillSketch(t,r){let a=r.fillWeight;return a<0&&(a=r.strokeWidth/2),{d:this.opsToPath(t),stroke:r.fill||K,strokeWidth:a,fill:K}}_mergedShape(t){return t.filter((r,a)=>a===0||r.op!=="move")}},Zt=class{constructor(t,r){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new ht(r)}draw(t){let r=t.sets||[],a=t.options||this.getDefaultOptions(),e=this.ctx,i=t.options.fixedDecimalPlaceDigits;for(let o of r)switch(o.type){case"path":e.save(),e.strokeStyle=a.stroke==="none"?"transparent":a.stroke,e.lineWidth=a.strokeWidth,a.strokeLineDash&&e.setLineDash(a.strokeLineDash),a.strokeLineDashOffset&&(e.lineDashOffset=a.strokeLineDashOffset),this._drawToContext(e,o,i),e.restore();break;case"fillPath":{e.save(),e.fillStyle=a.fill||"";let s=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(e,o,i,s),e.restore();break}case"fillSketch":this.fillSketch(e,o,a)}}fillSketch(t,r,a){let e=a.fillWeight;e<0&&(e=a.strokeWidth/2),t.save(),a.fillLineDash&&t.setLineDash(a.fillLineDash),a.fillLineDashOffset&&(t.lineDashOffset=a.fillLineDashOffset),t.strokeStyle=a.fill||"",t.lineWidth=e,this._drawToContext(t,r,a.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,r,a,e="nonzero"){t.beginPath();for(let i of r.ops){let o=typeof a=="number"&&a>=0?i.data.map(s=>+s.toFixed(a)):i.data;switch(i.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(e):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,r,a,e,i){let o=this.gen.line(t,r,a,e,i);return this.draw(o),o}rectangle(t,r,a,e,i){let o=this.gen.rectangle(t,r,a,e,i);return this.draw(o),o}ellipse(t,r,a,e,i){let o=this.gen.ellipse(t,r,a,e,i);return this.draw(o),o}circle(t,r,a,e){let i=this.gen.circle(t,r,a,e);return this.draw(i),i}linearPath(t,r){let a=this.gen.linearPath(t,r);return this.draw(a),a}polygon(t,r){let a=this.gen.polygon(t,r);return this.draw(a),a}arc(t,r,a,e,i,o,s=!1,h){let n=this.gen.arc(t,r,a,e,i,o,s,h);return this.draw(n),n}curve(t,r){let a=this.gen.curve(t,r);return this.draw(a),a}path(t,r){let a=this.gen.path(t,r);return this.draw(a),a}},Mt="http://www.w3.org/2000/svg",Qt=class{constructor(t,r){this.svg=t,this.gen=new ht(r)}draw(t){let r=t.sets||[],a=t.options||this.getDefaultOptions(),e=this.svg.ownerDocument||window.document,i=e.createElementNS(Mt,"g"),o=t.options.fixedDecimalPlaceDigits;for(let s of r){let h=null;switch(s.type){case"path":h=e.createElementNS(Mt,"path"),h.setAttribute("d",this.opsToPath(s,o)),h.setAttribute("stroke",a.stroke),h.setAttribute("stroke-width",a.strokeWidth+""),h.setAttribute("fill","none"),a.strokeLineDash&&h.setAttribute("stroke-dasharray",a.strokeLineDash.join(" ").trim()),a.strokeLineDashOffset&&h.setAttribute("stroke-dashoffset",`${a.strokeLineDashOffset}`);break;case"fillPath":h=e.createElementNS(Mt,"path"),h.setAttribute("d",this.opsToPath(s,o)),h.setAttribute("stroke","none"),h.setAttribute("stroke-width","0"),h.setAttribute("fill",a.fill||""),t.shape!=="curve"&&t.shape!=="polygon"||h.setAttribute("fill-rule","evenodd");break;case"fillSketch":h=this.fillSketch(e,s,a)}h&&i.appendChild(h)}return i}fillSketch(t,r,a){let e=a.fillWeight;e<0&&(e=a.strokeWidth/2);let i=t.createElementNS(Mt,"path");return i.setAttribute("d",this.opsToPath(r,a.fixedDecimalPlaceDigits)),i.setAttribute("stroke",a.fill||""),i.setAttribute("stroke-width",e+""),i.setAttribute("fill","none"),a.fillLineDash&&i.setAttribute("stroke-dasharray",a.fillLineDash.join(" ").trim()),a.fillLineDashOffset&&i.setAttribute("stroke-dashoffset",`${a.fillLineDashOffset}`),i}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,r){return this.gen.opsToPath(t,r)}line(t,r,a,e,i){let o=this.gen.line(t,r,a,e,i);return this.draw(o)}rectangle(t,r,a,e,i){let o=this.gen.rectangle(t,r,a,e,i);return this.draw(o)}ellipse(t,r,a,e,i){let o=this.gen.ellipse(t,r,a,e,i);return this.draw(o)}circle(t,r,a,e){let i=this.gen.circle(t,r,a,e);return this.draw(i)}linearPath(t,r){let a=this.gen.linearPath(t,r);return this.draw(a)}polygon(t,r){let a=this.gen.polygon(t,r);return this.draw(a)}arc(t,r,a,e,i,o,s=!1,h){let n=this.gen.arc(t,r,a,e,i,o,s,h);return this.draw(n)}curve(t,r){let a=this.gen.curve(t,r);return this.draw(a)}path(t,r){let a=this.gen.path(t,r);return this.draw(a)}},M={canvas:(l,t)=>new Zt(l,t),svg:(l,t)=>new Qt(l,t),generator:l=>new ht(l),newSeed:()=>ht.newSeed()};var G=S(async(l,t,r)=>{let a,e=t.useHtmlLabels||Q(X()?.htmlLabels);r?a=r:a="node default";let i=l.insert("g").attr("class",a).attr("id",t.domId||t.id),o=i.insert("g").attr("class","label").attr("style",J(t.labelStyle)),s;t.label===void 0?s="":s=typeof t.label=="string"?t.label:t.label[0];let h=await ct(o,Lt(ut(s),X()),{useHtmlLabels:e,width:t.width||X().flowchart?.wrappingWidth,cssClasses:"markdown-node-label",style:t.labelStyle,addSvgBackground:!!t.icon||!!t.img}),n=h.getBBox(),c=(t?.padding??0)/2;if(e){let g=h.children[0],f=Y(h),p=g.getElementsByTagName("img");if(p){let u=s.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...p].map(y=>new Promise(m=>{function d(){if(y.style.display="flex",y.style.flexDirection="column",u){let x=X().fontSize?X().fontSize:window.getComputedStyle(document.body).fontSize,b=5,[k=as.fontSize]=cs(x),w=k*b+"px";y.style.minWidth=w,y.style.maxWidth=w}else y.style.width="100%";m(y)}S(d,"setupImage"),setTimeout(()=>{y.complete&&d()}),y.addEventListener("error",d),y.addEventListener("load",d)})))}n=g.getBoundingClientRect(),f.attr("width",n.width),f.attr("height",n.height)}return e?o.attr("transform","translate("+-n.width/2+", "+-n.height/2+")"):o.attr("transform","translate(0, "+-n.height/2+")"),t.centerLabel&&o.attr("transform","translate("+-n.width/2+", "+-n.height/2+")"),o.insert("rect",":first-child"),{shapeSvg:i,bbox:n,halfPadding:c,label:o}},"labelHelper"),Ut=S(async(l,t,r)=>{let a=r.useHtmlLabels||Q(X()?.flowchart?.htmlLabels),e=l.insert("g").attr("class","label").attr("style",r.labelStyle||""),i=await ct(e,Lt(ut(t),X()),{useHtmlLabels:a,width:r.width||X()?.flowchart?.wrappingWidth,style:r.labelStyle,addSvgBackground:!!r.icon||!!r.img}),o=i.getBBox(),s=r.padding/2;if(Q(X()?.flowchart?.htmlLabels)){let h=i.children[0],n=Y(i);o=h.getBoundingClientRect(),n.attr("width",o.width),n.attr("height",o.height)}return a?e.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"):e.attr("transform","translate(0, "+-o.height/2+")"),r.centerLabel&&e.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"),e.insert("rect",":first-child"),{shapeSvg:l,bbox:o,halfPadding:s,label:e}},"insertLabel"),H=S((l,t)=>{let r=t.node().getBBox();l.width=r.width,l.height=r.height},"updateNodeBounds"),j=S((l,t)=>(l.look==="handDrawn"?"rough-node":"node")+" "+l.cssClasses+" "+(t||""),"getNodeClasses");function F(l){let t=l.map((r,a)=>`${a===0?"M":"L"}${r.x},${r.y}`);return t.push("Z"),t.join(" ")}S(F,"createPathFromPoints");function nt(l,t,r,a,e,i){let o=[],h=r-l,n=a-t,c=h/i,g=2*Math.PI/c,f=t+n/2;for(let p=0;p<=50;p++){let u=p/50,y=l+u*h,m=f+e*Math.sin(g*(y-l));o.push({x:y,y:m})}return o}S(nt,"generateFullSineWavePoints");function es(l,t,r,a,e,i){let o=[],s=e*Math.PI/180,c=(i*Math.PI/180-s)/(a-1);for(let g=0;g<a;g++){let f=s+g*c,p=l+r*Math.cos(f),u=t+r*Math.sin(f);o.push({x:-p,y:-u})}return o}S(es,"generateCirclePoints");var Ve=S((l,t)=>{var r=l.x,a=l.y,e=t.x-r,i=t.y-a,o=l.width/2,s=l.height/2,h,n;return Math.abs(i)*o>Math.abs(e)*s?(i<0&&(s=-s),h=i===0?0:s*e/i,n=s):(e<0&&(o=-o),h=o,n=e===0?0:o*i/e),{x:r+h,y:a+n}},"intersectRect"),gt=Ve;function ks(l,t){t&&l.attr("style",t)}S(ks,"applyStyle");async function vs(l){let t=Y(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),r=t.append("xhtml:div"),a=l.label;l.label&&At(l.label)&&(a=await rs(l.label.replace(is.lineBreakRegex,`
|
|
`),X()));let e=l.isNode?"nodeLabel":"edgeLabel";return r.html('<span class="'+e+'" '+(l.labelStyle?'style="'+l.labelStyle+'"':"")+">"+a+"</span>"),ks(r,l.labelStyle),r.style("display","inline-block"),r.style("padding-right","1px"),r.style("white-space","nowrap"),r.attr("xmlns","http://www.w3.org/1999/xhtml"),t.node()}S(vs,"addHtmlLabel");var Ze=S(async(l,t,r,a)=>{let e=l||"";if(typeof e=="object"&&(e=e[0]),Q(X().flowchart.htmlLabels)){e=e.replace(/\\n|\n/g,"<br />"),q.info("vertexText"+e);let i={isNode:a,label:ut(e).replace(/fa[blrs]?:fa-[\w-]+/g,s=>`<i class='${s.replace(":"," ")}'></i>`),labelStyle:t&&t.replace("fill:","color:")};return await vs(i)}else{let i=document.createElementNS("http://www.w3.org/2000/svg","text");i.setAttribute("style",t.replace("color:","fill:"));let o=[];typeof e=="string"?o=e.split(/\\n|\n|<br\s*\/?>/gi):Array.isArray(e)?o=e:o=[];for(let s of o){let h=document.createElementNS("http://www.w3.org/2000/svg","tspan");h.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),h.setAttribute("dy","1em"),h.setAttribute("x","0"),r?h.setAttribute("class","title-row"):h.setAttribute("class","row"),h.textContent=s.trim(),i.appendChild(h)}return i}},"createLabel"),Kt=Ze,at=S((l,t,r,a,e)=>["M",l+e,t,"H",l+r-e,"A",e,e,0,0,1,l+r,t+e,"V",t+a-e,"A",e,e,0,0,1,l+r-e,t+a,"H",l+e,"A",e,e,0,0,1,l,t+a-e,"V",t+e,"A",e,e,0,0,1,l+e,t,"Z"].join(" "),"createRoundedRectPathD"),Qe=S(l=>{let{handDrawnSeed:t}=X();return{fill:l,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:l,seed:t}},"solidStateFill"),pt=S(l=>{let t=Je([...l.cssCompiledStyles||[],...l.cssStyles||[]]);return{stylesMap:t,stylesArray:[...t]}},"compileStyles"),Je=S(l=>{let t=new Map;return l.forEach(r=>{let[a,e]=r.split(":");t.set(a.trim(),e?.trim())}),t},"styles2Map"),I=S(l=>{let{stylesArray:t}=pt(l),r=[],a=[],e=[],i=[];return t.forEach(o=>{let s=o[0];s==="color"||s==="font-size"||s==="font-family"||s==="font-weight"||s==="font-style"||s==="text-decoration"||s==="text-align"||s==="text-transform"||s==="line-height"||s==="letter-spacing"||s==="word-spacing"||s==="text-shadow"||s==="text-overflow"||s==="white-space"||s==="word-wrap"||s==="word-break"||s==="overflow-wrap"||s==="hyphens"?r.push(o.join(":")+" !important"):(a.push(o.join(":")+" !important"),s.includes("stroke")&&e.push(o.join(":")+" !important"),s==="fill"&&i.push(o.join(":")+" !important"))}),{labelStyles:r.join(";"),nodeStyles:a.join(";"),stylesArray:t,borderStyles:e,backgroundStyles:i}},"styles2String"),T=S((l,t)=>{let{themeVariables:r,handDrawnSeed:a}=X(),{nodeBorder:e,mainBkg:i}=r,{stylesMap:o}=pt(l);return Object.assign({roughness:.7,fill:o.get("fill")||i,fillStyle:"hachure",fillWeight:4,hachureGap:5.2,stroke:o.get("stroke")||e,seed:a,strokeWidth:o.get("stroke-width")?.replace("px","")||1.3,fillLineDash:[0,0]},t)},"userNodeOverrides"),$s=S(async(l,t)=>{q.info("Creating subgraph rect for ",t.id,t);let r=X(),{themeVariables:a,handDrawnSeed:e}=r,{clusterBkg:i,clusterBorder:o}=a,{labelStyles:s,nodeStyles:h,borderStyles:n,backgroundStyles:c}=I(t),g=l.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=Q(r.flowchart.htmlLabels),p=g.insert("g").attr("class","cluster-label "),u=await ct(p,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0}),y=u.getBBox();if(Q(r.flowchart.htmlLabels)){let $=u.children[0],D=Y(u);y=$.getBoundingClientRect(),D.attr("width",y.width),D.attr("height",y.height)}let m=t.width<=y.width+t.padding?y.width+t.padding:t.width;t.width<=y.width+t.padding?t.diff=(m-t.width)/2-t.padding:t.diff=-t.padding;let d=t.height,x=t.x-m/2,b=t.y-d/2;q.trace("Data ",t,JSON.stringify(t));let k;if(t.look==="handDrawn"){let $=M.svg(g),D=T(t,{roughness:.7,fill:i,stroke:o,fillWeight:3,seed:e}),C=$.path(at(x,b,m,d,0),D);k=g.insert(()=>(q.debug("Rough node insert CXC",C),C),":first-child"),k.select("path:nth-child(2)").attr("style",n.join(";")),k.select("path").attr("style",c.join(";").replace("fill","stroke"))}else k=g.insert("rect",":first-child"),k.attr("style",h).attr("rx",t.rx).attr("ry",t.ry).attr("x",x).attr("y",b).attr("width",m).attr("height",d);let{subGraphTitleTopMargin:w}=Tt(r);if(p.attr("transform",`translate(${t.x-y.width/2}, ${t.y-t.height/2+w})`),s){let $=p.select("span");$&&$.attr("style",s)}let v=k.node().getBBox();return t.offsetX=0,t.width=v.width,t.height=v.height,t.offsetY=y.height-t.padding/2,t.intersect=function($){return gt(t,$)},{cluster:g,labelBBox:y}},"rect"),Ue=S((l,t)=>{let r=l.insert("g").attr("class","note-cluster").attr("id",t.id),a=r.insert("rect",":first-child"),e=0*t.padding,i=e/2;a.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-i).attr("y",t.y-t.height/2-i).attr("width",t.width+e).attr("height",t.height+e).attr("fill","none");let o=a.node().getBBox();return t.width=o.width,t.height=o.height,t.intersect=function(s){return gt(t,s)},{cluster:r,labelBBox:{width:0,height:0}}},"noteGroup"),Ke=S(async(l,t)=>{let r=X(),{themeVariables:a,handDrawnSeed:e}=r,{altBackground:i,compositeBackground:o,compositeTitleBackground:s,nodeBorder:h}=a,n=l.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-id",t.id).attr("data-look",t.look),c=n.insert("g",":first-child"),g=n.insert("g").attr("class","cluster-label"),f=n.append("rect"),p=g.node().appendChild(await Kt(t.label,t.labelStyle,void 0,!0)),u=p.getBBox();if(Q(r.flowchart.htmlLabels)){let C=p.children[0],R=Y(p);u=C.getBoundingClientRect(),R.attr("width",u.width),R.attr("height",u.height)}let y=0*t.padding,m=y/2,d=(t.width<=u.width+t.padding?u.width+t.padding:t.width)+y;t.width<=u.width+t.padding?t.diff=(d-t.width)/2-t.padding:t.diff=-t.padding;let x=t.height+y,b=t.height+y-u.height-6,k=t.x-d/2,w=t.y-x/2;t.width=d;let v=t.y-t.height/2-m+u.height+2,$;if(t.look==="handDrawn"){let C=t.cssClasses.includes("statediagram-cluster-alt"),R=M.svg(n),L=t.rx||t.ry?R.path(at(k,w,d,x,10),{roughness:.7,fill:s,fillStyle:"solid",stroke:h,seed:e}):R.rectangle(k,w,d,x,{seed:e});$=n.insert(()=>L,":first-child");let E=R.rectangle(k,v,d,b,{fill:C?i:o,fillStyle:C?"hachure":"solid",stroke:h,seed:e});$=n.insert(()=>L,":first-child"),f=n.insert(()=>E)}else $=c.insert("rect",":first-child"),$.attr("class","outer").attr("x",k).attr("y",w).attr("width",d).attr("height",x).attr("data-look",t.look),f.attr("class","inner").attr("x",k).attr("y",v).attr("width",d).attr("height",b);g.attr("transform",`translate(${t.x-u.width/2}, ${w+1-(Q(r.flowchart.htmlLabels)?0:3)})`);let D=$.node().getBBox();return t.height=D.height,t.offsetX=0,t.offsetY=u.height-t.padding/2,t.labelBBox=u,t.intersect=function(C){return gt(t,C)},{cluster:n,labelBBox:u}},"roundedWithTitle"),ta=S(async(l,t)=>{q.info("Creating subgraph rect for ",t.id,t);let r=X(),{themeVariables:a,handDrawnSeed:e}=r,{clusterBkg:i,clusterBorder:o}=a,{labelStyles:s,nodeStyles:h,borderStyles:n,backgroundStyles:c}=I(t),g=l.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=Q(r.flowchart.htmlLabels),p=g.insert("g").attr("class","cluster-label "),u=await ct(p,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0,width:t.width}),y=u.getBBox();if(Q(r.flowchart.htmlLabels)){let $=u.children[0],D=Y(u);y=$.getBoundingClientRect(),D.attr("width",y.width),D.attr("height",y.height)}let m=t.width<=y.width+t.padding?y.width+t.padding:t.width;t.width<=y.width+t.padding?t.diff=(m-t.width)/2-t.padding:t.diff=-t.padding;let d=t.height,x=t.x-m/2,b=t.y-d/2;q.trace("Data ",t,JSON.stringify(t));let k;if(t.look==="handDrawn"){let $=M.svg(g),D=T(t,{roughness:.7,fill:i,stroke:o,fillWeight:4,seed:e}),C=$.path(at(x,b,m,d,t.rx),D);k=g.insert(()=>(q.debug("Rough node insert CXC",C),C),":first-child"),k.select("path:nth-child(2)").attr("style",n.join(";")),k.select("path").attr("style",c.join(";").replace("fill","stroke"))}else k=g.insert("rect",":first-child"),k.attr("style",h).attr("rx",t.rx).attr("ry",t.ry).attr("x",x).attr("y",b).attr("width",m).attr("height",d);let{subGraphTitleTopMargin:w}=Tt(r);if(p.attr("transform",`translate(${t.x-y.width/2}, ${t.y-t.height/2+w})`),s){let $=p.select("span");$&&$.attr("style",s)}let v=k.node().getBBox();return t.offsetX=0,t.width=v.width,t.height=v.height,t.offsetY=y.height-t.padding/2,t.intersect=function($){return gt(t,$)},{cluster:g,labelBBox:y}},"kanbanSection"),sa=S((l,t)=>{let r=X(),{themeVariables:a,handDrawnSeed:e}=r,{nodeBorder:i}=a,o=l.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-look",t.look),s=o.insert("g",":first-child"),h=0*t.padding,n=t.width+h;t.diff=-t.padding;let c=t.height+h,g=t.x-n/2,f=t.y-c/2;t.width=n;let p;if(t.look==="handDrawn"){let m=M.svg(o).rectangle(g,f,n,c,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:i,seed:e});p=o.insert(()=>m,":first-child")}else p=s.insert("rect",":first-child"),p.attr("class","divider").attr("x",g).attr("y",f).attr("width",n).attr("height",c).attr("data-look",t.look);let u=p.node().getBBox();return t.height=u.height,t.offsetX=0,t.offsetY=0,t.intersect=function(y){return gt(t,y)},{cluster:o,labelBBox:{}}},"divider"),ea=$s,aa={rect:$s,squareRect:ea,roundedWithTitle:Ke,noteGroup:Ue,divider:sa,kanbanSection:ta},Ds=new Map,Ta=S(async(l,t)=>{let r=t.shape||"rect",a=await aa[r](l,t);return Ds.set(t.id,a),a},"insertCluster"),Wa=S(()=>{Ds=new Map},"clear");function Ps(l,t){return l.intersect(t)}S(Ps,"intersectNode");var ra=Ps;function Cs(l,t,r,a){var e=l.x,i=l.y,o=e-a.x,s=i-a.y,h=Math.sqrt(t*t*s*s+r*r*o*o),n=Math.abs(t*r*o/h);a.x<e&&(n=-n);var c=Math.abs(t*r*s/h);return a.y<i&&(c=-c),{x:e+n,y:i+c}}S(Cs,"intersectEllipse");var Bs=Cs;function Ns(l,t,r){return Bs(l,t,t,r)}S(Ns,"intersectCircle");var ia=Ns;function Rs(l,t,r,a){var e,i,o,s,h,n,c,g,f,p,u,y,m,d,x;if(e=t.y-l.y,o=l.x-t.x,h=t.x*l.y-l.x*t.y,f=e*r.x+o*r.y+h,p=e*a.x+o*a.y+h,!(f!==0&&p!==0&&ts(f,p))&&(i=a.y-r.y,s=r.x-a.x,n=a.x*r.y-r.x*a.y,c=i*l.x+s*l.y+n,g=i*t.x+s*t.y+n,!(c!==0&&g!==0&&ts(c,g))&&(u=e*s-i*o,u!==0)))return y=Math.abs(u/2),m=o*n-s*h,d=m<0?(m-y)/u:(m+y)/u,m=i*h-e*n,x=m<0?(m-y)/u:(m+y)/u,{x:d,y:x}}S(Rs,"intersectLine");function ts(l,t){return l*t>0}S(ts,"sameSign");var na=Rs;function Ls(l,t,r){let a=l.x,e=l.y,i=[],o=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(c){o=Math.min(o,c.x),s=Math.min(s,c.y)}):(o=Math.min(o,t.x),s=Math.min(s,t.y));let h=a-l.width/2-o,n=e-l.height/2-s;for(let c=0;c<t.length;c++){let g=t[c],f=t[c<t.length-1?c+1:0],p=na(l,r,{x:h+g.x,y:n+g.y},{x:h+f.x,y:n+f.y});p&&i.push(p)}return i.length?(i.length>1&&i.sort(function(c,g){let f=c.x-r.x,p=c.y-r.y,u=Math.sqrt(f*f+p*p),y=g.x-r.x,m=g.y-r.y,d=Math.sqrt(y*y+m*m);return u<d?-1:u===d?0:1}),i[0]):l}S(Ls,"intersectPolygon");var la=Ls,N={node:ra,circle:ia,ellipse:Bs,polygon:la,rect:gt};function As(l,t){let{labelStyles:r}=I(t);t.labelStyle=r;let a=j(t),e=a;a||(e="anchor");let i=l.insert("g").attr("class",e).attr("id",t.domId||t.id),o=1,{cssStyles:s}=t,h=M.svg(i),n=T(t,{fill:"black",stroke:"none",fillStyle:"solid"});t.look!=="handDrawn"&&(n.roughness=0);let c=h.circle(0,0,o*2,n),g=i.insert(()=>c,":first-child");return g.attr("class","anchor").attr("style",J(s)),H(t,g),t.intersect=function(f){return q.info("Circle intersect",t,o,f),N.circle(t,o,f)},i}S(As,"anchor");function ss(l,t,r,a,e,i,o){let h=(l+r)/2,n=(t+a)/2,c=Math.atan2(a-t,r-l),g=(r-l)/2,f=(a-t)/2,p=g/e,u=f/i,y=Math.sqrt(p**2+u**2);if(y>1)throw new Error("The given radii are too small to create an arc between the points.");let m=Math.sqrt(1-y**2),d=h+m*i*Math.sin(c)*(o?-1:1),x=n-m*e*Math.cos(c)*(o?-1:1),b=Math.atan2((t-x)/i,(l-d)/e),w=Math.atan2((a-x)/i,(r-d)/e)-b;o&&w<0&&(w+=2*Math.PI),!o&&w>0&&(w-=2*Math.PI);let v=[];for(let $=0;$<20;$++){let D=$/19,C=b+D*w,R=d+e*Math.cos(C),L=x+i*Math.sin(C);v.push({x:R,y:L})}return v}S(ss,"generateArcPoints");async function Ts(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i}=await G(l,t,j(t)),o=i.width+t.padding+20,s=i.height+t.padding,h=s/2,n=h/(2.5+s/50),{cssStyles:c}=t,g=[{x:o/2,y:-s/2},{x:-o/2,y:-s/2},...ss(-o/2,-s/2,-o/2,s/2,n,h,!1),{x:o/2,y:s/2},...ss(o/2,s/2,o/2,-s/2,n,h,!0)],f=M.svg(e),p=T(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let u=F(g),y=f.path(u,p),m=e.insert(()=>y,":first-child");return m.attr("class","basic label-container"),c&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",c),a&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",a),m.attr("transform",`translate(${n/2}, 0)`),H(t,m),t.intersect=function(d){return N.polygon(t,g,d)},e}S(Ts,"bowTieRect");function rt(l,t,r,a){return l.insert("polygon",":first-child").attr("points",a.map(function(e){return e.x+","+e.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+r/2+")")}S(rt,"insertPolygonShape");async function Ws(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i}=await G(l,t,j(t)),o=i.height+t.padding,s=12,h=i.width+t.padding+s,n=0,c=h,g=-o,f=0,p=[{x:n+s,y:g},{x:c,y:g},{x:c,y:f},{x:n,y:f},{x:n,y:g+s},{x:n+s,y:g}],u,{cssStyles:y}=t;if(t.look==="handDrawn"){let m=M.svg(e),d=T(t,{}),x=F(p),b=m.path(x,d);u=e.insert(()=>b,":first-child").attr("transform",`translate(${-h/2}, ${o/2})`),y&&u.attr("style",y)}else u=rt(e,h,o,p);return a&&u.attr("style",a),H(t,u),t.intersect=function(m){return N.polygon(t,p,m)},e}S(Ws,"card");function Hs(l,t){let{nodeStyles:r}=I(t);t.label="";let a=l.insert("g").attr("class",j(t)).attr("id",t.domId??t.id),{cssStyles:e}=t,i=Math.max(28,t.width??0),o=[{x:0,y:i/2},{x:i/2,y:0},{x:0,y:-i/2},{x:-i/2,y:0}],s=M.svg(a),h=T(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");let n=F(o),c=s.path(n,h),g=a.insert(()=>c,":first-child");return e&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",e),r&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",r),t.width=28,t.height=28,t.intersect=function(f){return N.polygon(t,o,f)},a}S(Hs,"choice");async function Is(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,halfPadding:o}=await G(l,t,j(t)),s=i.width/2+o,h,{cssStyles:n}=t;if(t.look==="handDrawn"){let c=M.svg(e),g=T(t,{}),f=c.circle(0,0,s*2,g);h=e.insert(()=>f,":first-child"),h.attr("class","basic label-container").attr("style",J(n))}else h=e.insert("circle",":first-child").attr("class","basic label-container").attr("style",a).attr("r",s).attr("cx",0).attr("cy",0);return H(t,h),t.intersect=function(c){return q.info("Circle intersect",t,s,c),N.circle(t,s,c)},e}S(Is,"circle");function Es(l){let t=Math.cos(Math.PI/4),r=Math.sin(Math.PI/4),a=l*2,e={x:a/2*t,y:a/2*r},i={x:-(a/2)*t,y:a/2*r},o={x:-(a/2)*t,y:-(a/2)*r},s={x:a/2*t,y:-(a/2)*r};return`M ${i.x},${i.y} L ${s.x},${s.y}
|
|
M ${e.x},${e.y} L ${o.x},${o.y}`}S(Es,"createLine");function Os(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r,t.label="";let e=l.insert("g").attr("class",j(t)).attr("id",t.domId??t.id),i=Math.max(30,t?.width??0),{cssStyles:o}=t,s=M.svg(e),h=T(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");let n=s.circle(0,0,i*2,h),c=Es(i),g=s.path(c,h),f=e.insert(()=>n,":first-child");return f.insert(()=>g),o&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",o),a&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",a),H(t,f),t.intersect=function(p){return q.info("crossedCircle intersect",t,{radius:i,point:p}),N.circle(t,i,p)},e}S(Os,"crossedCircle");function st(l,t,r,a=100,e=0,i=180){let o=[],s=e*Math.PI/180,c=(i*Math.PI/180-s)/(a-1);for(let g=0;g<a;g++){let f=s+g*c,p=l+r*Math.cos(f),u=t+r*Math.sin(f);o.push({x:-p,y:-u})}return o}S(st,"generateCirclePoints");async function _s(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,label:o}=await G(l,t,j(t)),s=i.width+(t.padding??0),h=i.height+(t.padding??0),n=Math.max(5,h*.1),{cssStyles:c}=t,g=[...st(s/2,-h/2,n,30,-90,0),{x:-s/2-n,y:n},...st(s/2+n*2,-n,n,20,-180,-270),...st(s/2+n*2,n,n,20,-90,-180),{x:-s/2-n,y:-h/2},...st(s/2,h/2,n,20,0,90)],f=[{x:s/2,y:-h/2-n},{x:-s/2,y:-h/2-n},...st(s/2,-h/2,n,20,-90,0),{x:-s/2-n,y:-n},...st(s/2+s*.1,-n,n,20,-180,-270),...st(s/2+s*.1,n,n,20,-90,-180),{x:-s/2-n,y:h/2},...st(s/2,h/2,n,20,0,90),{x:-s/2,y:h/2+n},{x:s/2,y:h/2+n}],p=M.svg(e),u=T(t,{fill:"none"});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let m=F(g).replace("Z",""),d=p.path(m,u),x=F(f),b=p.path(x,{...u}),k=e.insert("g",":first-child");return k.insert(()=>b,":first-child").attr("stroke-opacity",0),k.insert(()=>d,":first-child"),k.attr("class","text"),c&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",c),a&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",a),k.attr("transform",`translate(${n}, 0)`),o.attr("transform",`translate(${-s/2+n-(i.x-(i.left??0))},${-h/2+(t.padding??0)/2-(i.y-(i.top??0))})`),H(t,k),t.intersect=function(w){return N.polygon(t,f,w)},e}S(_s,"curlyBraceLeft");function et(l,t,r,a=100,e=0,i=180){let o=[],s=e*Math.PI/180,c=(i*Math.PI/180-s)/(a-1);for(let g=0;g<a;g++){let f=s+g*c,p=l+r*Math.cos(f),u=t+r*Math.sin(f);o.push({x:p,y:u})}return o}S(et,"generateCirclePoints");async function zs(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,label:o}=await G(l,t,j(t)),s=i.width+(t.padding??0),h=i.height+(t.padding??0),n=Math.max(5,h*.1),{cssStyles:c}=t,g=[...et(s/2,-h/2,n,20,-90,0),{x:s/2+n,y:-n},...et(s/2+n*2,-n,n,20,-180,-270),...et(s/2+n*2,n,n,20,-90,-180),{x:s/2+n,y:h/2},...et(s/2,h/2,n,20,0,90)],f=[{x:-s/2,y:-h/2-n},{x:s/2,y:-h/2-n},...et(s/2,-h/2,n,20,-90,0),{x:s/2+n,y:-n},...et(s/2+n*2,-n,n,20,-180,-270),...et(s/2+n*2,n,n,20,-90,-180),{x:s/2+n,y:h/2},...et(s/2,h/2,n,20,0,90),{x:s/2,y:h/2+n},{x:-s/2,y:h/2+n}],p=M.svg(e),u=T(t,{fill:"none"});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let m=F(g).replace("Z",""),d=p.path(m,u),x=F(f),b=p.path(x,{...u}),k=e.insert("g",":first-child");return k.insert(()=>b,":first-child").attr("stroke-opacity",0),k.insert(()=>d,":first-child"),k.attr("class","text"),c&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",c),a&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",a),k.attr("transform",`translate(${-n}, 0)`),o.attr("transform",`translate(${-s/2+(t.padding??0)/2-(i.x-(i.left??0))},${-h/2+(t.padding??0)/2-(i.y-(i.top??0))})`),H(t,k),t.intersect=function(w){return N.polygon(t,f,w)},e}S(zs,"curlyBraceRight");function V(l,t,r,a=100,e=0,i=180){let o=[],s=e*Math.PI/180,c=(i*Math.PI/180-s)/(a-1);for(let g=0;g<a;g++){let f=s+g*c,p=l+r*Math.cos(f),u=t+r*Math.sin(f);o.push({x:-p,y:-u})}return o}S(V,"generateCirclePoints");async function js(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,label:o}=await G(l,t,j(t)),s=i.width+(t.padding??0),h=i.height+(t.padding??0),n=Math.max(5,h*.1),{cssStyles:c}=t,g=[...V(s/2,-h/2,n,30,-90,0),{x:-s/2-n,y:n},...V(s/2+n*2,-n,n,20,-180,-270),...V(s/2+n*2,n,n,20,-90,-180),{x:-s/2-n,y:-h/2},...V(s/2,h/2,n,20,0,90)],f=[...V(-s/2+n+n/2,-h/2,n,20,-90,-180),{x:s/2-n/2,y:n},...V(-s/2-n/2,-n,n,20,0,90),...V(-s/2-n/2,n,n,20,-90,0),{x:s/2-n/2,y:-n},...V(-s/2+n+n/2,h/2,n,30,-180,-270)],p=[{x:s/2,y:-h/2-n},{x:-s/2,y:-h/2-n},...V(s/2,-h/2,n,20,-90,0),{x:-s/2-n,y:-n},...V(s/2+n*2,-n,n,20,-180,-270),...V(s/2+n*2,n,n,20,-90,-180),{x:-s/2-n,y:h/2},...V(s/2,h/2,n,20,0,90),{x:-s/2,y:h/2+n},{x:s/2-n-n/2,y:h/2+n},...V(-s/2+n+n/2,-h/2,n,20,-90,-180),{x:s/2-n/2,y:n},...V(-s/2-n/2,-n,n,20,0,90),...V(-s/2-n/2,n,n,20,-90,0),{x:s/2-n/2,y:-n},...V(-s/2+n+n/2,h/2,n,30,-180,-270)],u=M.svg(e),y=T(t,{fill:"none"});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let d=F(g).replace("Z",""),x=u.path(d,y),k=F(f).replace("Z",""),w=u.path(k,y),v=F(p),$=u.path(v,{...y}),D=e.insert("g",":first-child");return D.insert(()=>$,":first-child").attr("stroke-opacity",0),D.insert(()=>x,":first-child"),D.insert(()=>w,":first-child"),D.attr("class","text"),c&&t.look!=="handDrawn"&&D.selectAll("path").attr("style",c),a&&t.look!=="handDrawn"&&D.selectAll("path").attr("style",a),D.attr("transform",`translate(${n-n/4}, 0)`),o.attr("transform",`translate(${-s/2+(t.padding??0)/2-(i.x-(i.left??0))},${-h/2+(t.padding??0)/2-(i.y-(i.top??0))})`),H(t,D),t.intersect=function(C){return N.polygon(t,p,C)},e}S(js,"curlyBraces");async function Gs(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i}=await G(l,t,j(t)),o=80,s=20,h=Math.max(o,(i.width+(t.padding??0)*2)*1.25,t?.width??0),n=Math.max(s,i.height+(t.padding??0)*2,t?.height??0),c=n/2,{cssStyles:g}=t,f=M.svg(e),p=T(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let u=h,y=n,m=u-c,d=y/4,x=[{x:m,y:0},{x:d,y:0},{x:0,y:y/2},{x:d,y},{x:m,y},...es(-m,-y/2,c,50,270,90)],b=F(x),k=f.path(b,p),w=e.insert(()=>k,":first-child");return w.attr("class","basic label-container"),g&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",g),a&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",a),w.attr("transform",`translate(${-h/2}, ${-n/2})`),H(t,w),t.intersect=function(v){return N.polygon(t,x,v)},e}S(Gs,"curvedTrapezoid");var ca=S((l,t,r,a,e,i)=>[`M${l},${t+i}`,`a${e},${i} 0,0,0 ${r},0`,`a${e},${i} 0,0,0 ${-r},0`,`l0,${a}`,`a${e},${i} 0,0,0 ${r},0`,`l0,${-a}`].join(" "),"createCylinderPathD"),oa=S((l,t,r,a,e,i)=>[`M${l},${t+i}`,`M${l+r},${t+i}`,`a${e},${i} 0,0,0 ${-r},0`,`l0,${a}`,`a${e},${i} 0,0,0 ${r},0`,`l0,${-a}`].join(" "),"createOuterCylinderPathD"),ha=S((l,t,r,a,e,i)=>[`M${l-r/2},${-a/2}`,`a${e},${i} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD");async function Fs(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,label:o}=await G(l,t,j(t)),s=Math.max(i.width+t.padding,t.width??0),h=s/2,n=h/(2.5+s/50),c=Math.max(i.height+n+t.padding,t.height??0),g,{cssStyles:f}=t;if(t.look==="handDrawn"){let p=M.svg(e),u=oa(0,0,s,c,h,n),y=ha(0,n,s,c,h,n),m=p.path(u,T(t,{})),d=p.path(y,T(t,{fill:"none"}));g=e.insert(()=>d,":first-child"),g=e.insert(()=>m,":first-child"),g.attr("class","basic label-container"),f&&g.attr("style",f)}else{let p=ca(0,0,s,c,h,n);g=e.insert("path",":first-child").attr("d",p).attr("class","basic label-container").attr("style",J(f)).attr("style",a)}return g.attr("label-offset-y",n),g.attr("transform",`translate(${-s/2}, ${-(c/2+n)})`),H(t,g),o.attr("transform",`translate(${-(i.width/2)-(i.x-(i.left??0))}, ${-(i.height/2)+(t.padding??0)/1.5-(i.y-(i.top??0))})`),t.intersect=function(p){let u=N.rect(t,p),y=u.x-(t.x??0);if(h!=0&&(Math.abs(y)<(t.width??0)/2||Math.abs(y)==(t.width??0)/2&&Math.abs(u.y-(t.y??0))>(t.height??0)/2-n)){let m=n*n*(1-y*y/(h*h));m>0&&(m=Math.sqrt(m)),m=n-m,p.y-(t.y??0)>0&&(m=-m),u.y+=m}return u},e}S(Fs,"cylinder");async function qs(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,label:o}=await G(l,t,j(t)),s=i.width+t.padding,h=i.height+t.padding,n=h*.2,c=-s/2,g=-h/2-n/2,{cssStyles:f}=t,p=M.svg(e),u=T(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let y=[{x:c,y:g+n},{x:-c,y:g+n},{x:-c,y:-g},{x:c,y:-g},{x:c,y:g},{x:-c,y:g},{x:-c,y:g+n}],m=p.polygon(y.map(x=>[x.x,x.y]),u),d=e.insert(()=>m,":first-child");return d.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",f),a&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",a),o.attr("transform",`translate(${c+(t.padding??0)/2-(i.x-(i.left??0))}, ${g+n+(t.padding??0)/2-(i.y-(i.top??0))})`),H(t,d),t.intersect=function(x){return N.rect(t,x)},e}S(qs,"dividedRectangle");async function Xs(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,halfPadding:o}=await G(l,t,j(t)),h=i.width/2+o+5,n=i.width/2+o,c,{cssStyles:g}=t;if(t.look==="handDrawn"){let f=M.svg(e),p=T(t,{roughness:.2,strokeWidth:2.5}),u=T(t,{roughness:.2,strokeWidth:1.5}),y=f.circle(0,0,h*2,p),m=f.circle(0,0,n*2,u);c=e.insert("g",":first-child"),c.attr("class",J(t.cssClasses)).attr("style",J(g)),c.node()?.appendChild(y),c.node()?.appendChild(m)}else{c=e.insert("g",":first-child");let f=c.insert("circle",":first-child"),p=c.insert("circle");c.attr("class","basic label-container").attr("style",a),f.attr("class","outer-circle").attr("style",a).attr("r",h).attr("cx",0).attr("cy",0),p.attr("class","inner-circle").attr("style",a).attr("r",n).attr("cx",0).attr("cy",0)}return H(t,c),t.intersect=function(f){return q.info("DoubleCircle intersect",t,h,f),N.circle(t,h,f)},e}S(Xs,"doublecircle");function Ys(l,t,{config:{themeVariables:r}}){let{labelStyles:a,nodeStyles:e}=I(t);t.label="",t.labelStyle=a;let i=l.insert("g").attr("class",j(t)).attr("id",t.domId??t.id),o=7,{cssStyles:s}=t,h=M.svg(i),{nodeBorder:n}=r,c=T(t,{fillStyle:"solid"});t.look!=="handDrawn"&&(c.roughness=0);let g=h.circle(0,0,o*2,c),f=i.insert(()=>g,":first-child");return f.selectAll("path").attr("style",`fill: ${n} !important;`),s&&s.length>0&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",s),e&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",e),H(t,f),t.intersect=function(p){return q.info("filledCircle intersect",t,{radius:o,point:p}),N.circle(t,o,p)},i}S(Ys,"filledCircle");async function Vs(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,label:o}=await G(l,t,j(t)),s=i.width+(t.padding??0),h=s+i.height,n=s+i.height,c=[{x:0,y:-h},{x:n,y:-h},{x:n/2,y:0}],{cssStyles:g}=t,f=M.svg(e),p=T(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let u=F(c),y=f.path(u,p),m=e.insert(()=>y,":first-child").attr("transform",`translate(${-h/2}, ${h/2})`);return g&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",g),a&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",a),t.width=s,t.height=h,H(t,m),o.attr("transform",`translate(${-i.width/2-(i.x-(i.left??0))}, ${-h/2+(t.padding??0)/2+(i.y-(i.top??0))})`),t.intersect=function(d){return q.info("Triangle intersect",t,c,d),N.polygon(t,c,d)},e}S(Vs,"flippedTriangle");function Zs(l,t,{dir:r,config:{state:a,themeVariables:e}}){let{nodeStyles:i}=I(t);t.label="";let o=l.insert("g").attr("class",j(t)).attr("id",t.domId??t.id),{cssStyles:s}=t,h=Math.max(70,t?.width??0),n=Math.max(10,t?.height??0);r==="LR"&&(h=Math.max(10,t?.width??0),n=Math.max(70,t?.height??0));let c=-1*h/2,g=-1*n/2,f=M.svg(o),p=T(t,{stroke:e.lineColor,fill:e.lineColor});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let u=f.rectangle(c,g,h,n,p),y=o.insert(()=>u,":first-child");s&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",s),i&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",i),H(t,y);let m=a?.padding??0;return t.width&&t.height&&(t.width+=m/2||0,t.height+=m/2||0),t.intersect=function(d){return N.rect(t,d)},o}S(Zs,"forkJoin");async function Qs(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let e=80,i=50,{shapeSvg:o,bbox:s}=await G(l,t,j(t)),h=Math.max(e,s.width+(t.padding??0)*2,t?.width??0),n=Math.max(i,s.height+(t.padding??0)*2,t?.height??0),c=n/2,{cssStyles:g}=t,f=M.svg(o),p=T(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let u=[{x:-h/2,y:-n/2},{x:h/2-c,y:-n/2},...es(-h/2+c,0,c,50,90,270),{x:h/2-c,y:n/2},{x:-h/2,y:n/2}],y=F(u),m=f.path(y,p),d=o.insert(()=>m,":first-child");return d.attr("class","basic label-container"),g&&t.look!=="handDrawn"&&d.selectChildren("path").attr("style",g),a&&t.look!=="handDrawn"&&d.selectChildren("path").attr("style",a),H(t,d),t.intersect=function(x){return q.info("Pill intersect",t,{radius:c,point:x}),N.polygon(t,u,x)},o}S(Qs,"halfRoundedRectangle");var ga=S((l,t,r,a,e)=>[`M${l+e},${t}`,`L${l+r-e},${t}`,`L${l+r},${t-a/2}`,`L${l+r-e},${t-a}`,`L${l+e},${t-a}`,`L${l},${t-a/2}`,"Z"].join(" "),"createHexagonPathD");async function Js(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i}=await G(l,t,j(t)),o=4,s=i.height+t.padding,h=s/o,n=i.width+2*h+t.padding,c=[{x:h,y:0},{x:n-h,y:0},{x:n,y:-s/2},{x:n-h,y:-s},{x:h,y:-s},{x:0,y:-s/2}],g,{cssStyles:f}=t;if(t.look==="handDrawn"){let p=M.svg(e),u=T(t,{}),y=ga(0,0,n,s,h),m=p.path(y,u);g=e.insert(()=>m,":first-child").attr("transform",`translate(${-n/2}, ${s/2})`),f&&g.attr("style",f)}else g=rt(e,n,s,c);return a&&g.attr("style",a),t.width=n,t.height=s,H(t,g),t.intersect=function(p){return N.polygon(t,c,p)},e}S(Js,"hexagon");async function Us(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.label="",t.labelStyle=r;let{shapeSvg:e}=await G(l,t,j(t)),i=Math.max(30,t?.width??0),o=Math.max(30,t?.height??0),{cssStyles:s}=t,h=M.svg(e),n=T(t,{});t.look!=="handDrawn"&&(n.roughness=0,n.fillStyle="solid");let c=[{x:0,y:0},{x:i,y:0},{x:0,y:o},{x:i,y:o}],g=F(c),f=h.path(g,n),p=e.insert(()=>f,":first-child");return p.attr("class","basic label-container"),s&&t.look!=="handDrawn"&&p.selectChildren("path").attr("style",s),a&&t.look!=="handDrawn"&&p.selectChildren("path").attr("style",a),p.attr("transform",`translate(${-i/2}, ${-o/2})`),H(t,p),t.intersect=function(u){return q.info("Pill intersect",t,{points:c}),N.polygon(t,c,u)},e}S(Us,"hourglass");async function Ks(l,t,{config:{themeVariables:r,flowchart:a}}){let{labelStyles:e}=I(t);t.labelStyle=e;let i=t.assetHeight??48,o=t.assetWidth??48,s=Math.max(i,o),h=a?.wrappingWidth;t.width=Math.max(s,h??0);let{shapeSvg:n,bbox:c,label:g}=await G(l,t,"icon-shape default"),f=t.pos==="t",p=s,u=s,{nodeBorder:y}=r,{stylesMap:m}=pt(t),d=-u/2,x=-p/2,b=t.label?8:0,k=M.svg(n),w=T(t,{stroke:"none",fill:"none"});t.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");let v=k.rectangle(d,x,u,p,w),$=Math.max(u,c.width),D=p+c.height+b,C=k.rectangle(-$/2,-D/2,$,D,{...w,fill:"transparent",stroke:"none"}),R=n.insert(()=>v,":first-child"),L=n.insert(()=>C);if(t.icon){let E=n.append("g");E.html(`<g>${await ft(t.icon,{height:s,width:s,fallbackPrefix:""})}</g>`);let P=E.node().getBBox(),A=P.width,W=P.height,B=P.x,O=P.y;E.attr("transform",`translate(${-A/2-B},${f?c.height/2+b/2-W/2-O:-c.height/2-b/2-W/2-O})`),E.attr("style",`color: ${m.get("stroke")??y};`)}return g.attr("transform",`translate(${-c.width/2-(c.x-(c.left??0))},${f?-D/2:D/2-c.height})`),R.attr("transform",`translate(0,${f?c.height/2+b/2:-c.height/2-b/2})`),H(t,L),t.intersect=function(E){if(q.info("iconSquare intersect",t,E),!t.label)return N.rect(t,E);let P=t.x??0,A=t.y??0,W=t.height??0,B=[];return f?B=[{x:P-c.width/2,y:A-W/2},{x:P+c.width/2,y:A-W/2},{x:P+c.width/2,y:A-W/2+c.height+b},{x:P+u/2,y:A-W/2+c.height+b},{x:P+u/2,y:A+W/2},{x:P-u/2,y:A+W/2},{x:P-u/2,y:A-W/2+c.height+b},{x:P-c.width/2,y:A-W/2+c.height+b}]:B=[{x:P-u/2,y:A-W/2},{x:P+u/2,y:A-W/2},{x:P+u/2,y:A-W/2+p},{x:P+c.width/2,y:A-W/2+p},{x:P+c.width/2/2,y:A+W/2},{x:P-c.width/2,y:A+W/2},{x:P-c.width/2,y:A-W/2+p},{x:P-u/2,y:A-W/2+p}],N.polygon(t,B,E)},n}S(Ks,"icon");async function te(l,t,{config:{themeVariables:r,flowchart:a}}){let{labelStyles:e}=I(t);t.labelStyle=e;let i=t.assetHeight??48,o=t.assetWidth??48,s=Math.max(i,o),h=a?.wrappingWidth;t.width=Math.max(s,h??0);let{shapeSvg:n,bbox:c,label:g}=await G(l,t,"icon-shape default"),f=20,p=t.label?8:0,u=t.pos==="t",{nodeBorder:y,mainBkg:m}=r,{stylesMap:d}=pt(t),x=M.svg(n),b=T(t,{});t.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");let k=d.get("fill");b.stroke=k??m;let w=n.append("g");t.icon&&w.html(`<g>${await ft(t.icon,{height:s,width:s,fallbackPrefix:""})}</g>`);let v=w.node().getBBox(),$=v.width,D=v.height,C=v.x,R=v.y,L=Math.max($,D)*Math.SQRT2+f*2,E=x.circle(0,0,L,b),P=Math.max(L,c.width),A=L+c.height+p,W=x.rectangle(-P/2,-A/2,P,A,{...b,fill:"transparent",stroke:"none"}),B=n.insert(()=>E,":first-child"),O=n.insert(()=>W);return w.attr("transform",`translate(${-$/2-C},${u?c.height/2+p/2-D/2-R:-c.height/2-p/2-D/2-R})`),w.attr("style",`color: ${d.get("stroke")??y};`),g.attr("transform",`translate(${-c.width/2-(c.x-(c.left??0))},${u?-A/2:A/2-c.height})`),B.attr("transform",`translate(0,${u?c.height/2+p/2:-c.height/2-p/2})`),H(t,O),t.intersect=function(z){return q.info("iconSquare intersect",t,z),N.rect(t,z)},n}S(te,"iconCircle");async function se(l,t,{config:{themeVariables:r,flowchart:a}}){let{labelStyles:e}=I(t);t.labelStyle=e;let i=t.assetHeight??48,o=t.assetWidth??48,s=Math.max(i,o),h=a?.wrappingWidth;t.width=Math.max(s,h??0);let{shapeSvg:n,bbox:c,halfPadding:g,label:f}=await G(l,t,"icon-shape default"),p=t.pos==="t",u=s+g*2,y=s+g*2,{nodeBorder:m,mainBkg:d}=r,{stylesMap:x}=pt(t),b=-y/2,k=-u/2,w=t.label?8:0,v=M.svg(n),$=T(t,{});t.look!=="handDrawn"&&($.roughness=0,$.fillStyle="solid");let D=x.get("fill");$.stroke=D??d;let C=v.path(at(b,k,y,u,5),$),R=Math.max(y,c.width),L=u+c.height+w,E=v.rectangle(-R/2,-L/2,R,L,{...$,fill:"transparent",stroke:"none"}),P=n.insert(()=>C,":first-child").attr("class","icon-shape2"),A=n.insert(()=>E);if(t.icon){let W=n.append("g");W.html(`<g>${await ft(t.icon,{height:s,width:s,fallbackPrefix:""})}</g>`);let B=W.node().getBBox(),O=B.width,z=B.height,Z=B.x,tt=B.y;W.attr("transform",`translate(${-O/2-Z},${p?c.height/2+w/2-z/2-tt:-c.height/2-w/2-z/2-tt})`),W.attr("style",`color: ${x.get("stroke")??m};`)}return f.attr("transform",`translate(${-c.width/2-(c.x-(c.left??0))},${p?-L/2:L/2-c.height})`),P.attr("transform",`translate(0,${p?c.height/2+w/2:-c.height/2-w/2})`),H(t,A),t.intersect=function(W){if(q.info("iconSquare intersect",t,W),!t.label)return N.rect(t,W);let B=t.x??0,O=t.y??0,z=t.height??0,Z=[];return p?Z=[{x:B-c.width/2,y:O-z/2},{x:B+c.width/2,y:O-z/2},{x:B+c.width/2,y:O-z/2+c.height+w},{x:B+y/2,y:O-z/2+c.height+w},{x:B+y/2,y:O+z/2},{x:B-y/2,y:O+z/2},{x:B-y/2,y:O-z/2+c.height+w},{x:B-c.width/2,y:O-z/2+c.height+w}]:Z=[{x:B-y/2,y:O-z/2},{x:B+y/2,y:O-z/2},{x:B+y/2,y:O-z/2+u},{x:B+c.width/2,y:O-z/2+u},{x:B+c.width/2/2,y:O+z/2},{x:B-c.width/2,y:O+z/2},{x:B-c.width/2,y:O-z/2+u},{x:B-y/2,y:O-z/2+u}],N.polygon(t,Z,W)},n}S(se,"iconRounded");async function ee(l,t,{config:{themeVariables:r,flowchart:a}}){let{labelStyles:e}=I(t);t.labelStyle=e;let i=t.assetHeight??48,o=t.assetWidth??48,s=Math.max(i,o),h=a?.wrappingWidth;t.width=Math.max(s,h??0);let{shapeSvg:n,bbox:c,halfPadding:g,label:f}=await G(l,t,"icon-shape default"),p=t.pos==="t",u=s+g*2,y=s+g*2,{nodeBorder:m,mainBkg:d}=r,{stylesMap:x}=pt(t),b=-y/2,k=-u/2,w=t.label?8:0,v=M.svg(n),$=T(t,{});t.look!=="handDrawn"&&($.roughness=0,$.fillStyle="solid");let D=x.get("fill");$.stroke=D??d;let C=v.path(at(b,k,y,u,.1),$),R=Math.max(y,c.width),L=u+c.height+w,E=v.rectangle(-R/2,-L/2,R,L,{...$,fill:"transparent",stroke:"none"}),P=n.insert(()=>C,":first-child"),A=n.insert(()=>E);if(t.icon){let W=n.append("g");W.html(`<g>${await ft(t.icon,{height:s,width:s,fallbackPrefix:""})}</g>`);let B=W.node().getBBox(),O=B.width,z=B.height,Z=B.x,tt=B.y;W.attr("transform",`translate(${-O/2-Z},${p?c.height/2+w/2-z/2-tt:-c.height/2-w/2-z/2-tt})`),W.attr("style",`color: ${x.get("stroke")??m};`)}return f.attr("transform",`translate(${-c.width/2-(c.x-(c.left??0))},${p?-L/2:L/2-c.height})`),P.attr("transform",`translate(0,${p?c.height/2+w/2:-c.height/2-w/2})`),H(t,A),t.intersect=function(W){if(q.info("iconSquare intersect",t,W),!t.label)return N.rect(t,W);let B=t.x??0,O=t.y??0,z=t.height??0,Z=[];return p?Z=[{x:B-c.width/2,y:O-z/2},{x:B+c.width/2,y:O-z/2},{x:B+c.width/2,y:O-z/2+c.height+w},{x:B+y/2,y:O-z/2+c.height+w},{x:B+y/2,y:O+z/2},{x:B-y/2,y:O+z/2},{x:B-y/2,y:O-z/2+c.height+w},{x:B-c.width/2,y:O-z/2+c.height+w}]:Z=[{x:B-y/2,y:O-z/2},{x:B+y/2,y:O-z/2},{x:B+y/2,y:O-z/2+u},{x:B+c.width/2,y:O-z/2+u},{x:B+c.width/2/2,y:O+z/2},{x:B-c.width/2,y:O+z/2},{x:B-c.width/2,y:O-z/2+u},{x:B-y/2,y:O-z/2+u}],N.polygon(t,Z,W)},n}S(ee,"iconSquare");async function ae(l,t,{config:{flowchart:r}}){let a=new Image;a.src=t?.img??"",await a.decode();let e=Number(a.naturalWidth.toString().replace("px","")),i=Number(a.naturalHeight.toString().replace("px",""));t.imageAspectRatio=e/i;let{labelStyles:o}=I(t);t.labelStyle=o;let s=r?.wrappingWidth;t.defaultWidth=r?.wrappingWidth;let h=Math.max(t.label?s??0:0,t?.assetWidth??e),n=t.constraint==="on"&&t?.assetHeight?t.assetHeight*t.imageAspectRatio:h,c=t.constraint==="on"?n/t.imageAspectRatio:t?.assetHeight??i;t.width=Math.max(n,s??0);let{shapeSvg:g,bbox:f,label:p}=await G(l,t,"image-shape default"),u=t.pos==="t",y=-n/2,m=-c/2,d=t.label?8:0,x=M.svg(g),b=T(t,{});t.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");let k=x.rectangle(y,m,n,c,b),w=Math.max(n,f.width),v=c+f.height+d,$=x.rectangle(-w/2,-v/2,w,v,{...b,fill:"none",stroke:"none"}),D=g.insert(()=>k,":first-child"),C=g.insert(()=>$);if(t.img){let R=g.append("image");R.attr("href",t.img),R.attr("width",n),R.attr("height",c),R.attr("preserveAspectRatio","none"),R.attr("transform",`translate(${-n/2},${u?v/2-c:-v/2})`)}return p.attr("transform",`translate(${-f.width/2-(f.x-(f.left??0))},${u?-c/2-f.height/2-d/2:c/2-f.height/2+d/2})`),D.attr("transform",`translate(0,${u?f.height/2+d/2:-f.height/2-d/2})`),H(t,C),t.intersect=function(R){if(q.info("iconSquare intersect",t,R),!t.label)return N.rect(t,R);let L=t.x??0,E=t.y??0,P=t.height??0,A=[];return u?A=[{x:L-f.width/2,y:E-P/2},{x:L+f.width/2,y:E-P/2},{x:L+f.width/2,y:E-P/2+f.height+d},{x:L+n/2,y:E-P/2+f.height+d},{x:L+n/2,y:E+P/2},{x:L-n/2,y:E+P/2},{x:L-n/2,y:E-P/2+f.height+d},{x:L-f.width/2,y:E-P/2+f.height+d}]:A=[{x:L-n/2,y:E-P/2},{x:L+n/2,y:E-P/2},{x:L+n/2,y:E-P/2+c},{x:L+f.width/2,y:E-P/2+c},{x:L+f.width/2/2,y:E+P/2},{x:L-f.width/2,y:E+P/2},{x:L-f.width/2,y:E-P/2+c},{x:L-n/2,y:E-P/2+c}],N.polygon(t,A,R)},g}S(ae,"imageSquare");async function re(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i}=await G(l,t,j(t)),o=Math.max(i.width+(t.padding??0)*2,t?.width??0),s=Math.max(i.height+(t.padding??0)*2,t?.height??0),h=[{x:0,y:0},{x:o,y:0},{x:o+3*s/6,y:-s},{x:-3*s/6,y:-s}],n,{cssStyles:c}=t;if(t.look==="handDrawn"){let g=M.svg(e),f=T(t,{}),p=F(h),u=g.path(p,f);n=e.insert(()=>u,":first-child").attr("transform",`translate(${-o/2}, ${s/2})`),c&&n.attr("style",c)}else n=rt(e,o,s,h);return a&&n.attr("style",a),t.width=o,t.height=s,H(t,n),t.intersect=function(g){return N.polygon(t,h,g)},e}S(re,"inv_trapezoid");async function Bt(l,t,r){let{labelStyles:a,nodeStyles:e}=I(t);t.labelStyle=a;let{shapeSvg:i,bbox:o}=await G(l,t,j(t)),s=Math.max(o.width+r.labelPaddingX*2,t?.width||0),h=Math.max(o.height+r.labelPaddingY*2,t?.height||0),n=-s/2,c=-h/2,g,{rx:f,ry:p}=t,{cssStyles:u}=t;if(r?.rx&&r.ry&&(f=r.rx,p=r.ry),t.look==="handDrawn"){let y=M.svg(i),m=T(t,{}),d=f||p?y.path(at(n,c,s,h,f||0),m):y.rectangle(n,c,s,h,m);g=i.insert(()=>d,":first-child"),g.attr("class","basic label-container").attr("style",J(u))}else g=i.insert("rect",":first-child"),g.attr("class","basic label-container").attr("style",e).attr("rx",J(f)).attr("ry",J(p)).attr("x",n).attr("y",c).attr("width",s).attr("height",h);return H(t,g),t.intersect=function(y){return N.rect(t,y)},i}S(Bt,"drawRect");async function ie(l,t){let{shapeSvg:r,bbox:a,label:e}=await G(l,t,"label"),i=r.insert("rect",":first-child");return i.attr("width",.1).attr("height",.1),r.attr("class","label edgeLabel"),e.attr("transform",`translate(${-(a.width/2)-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),H(t,i),t.intersect=function(h){return N.rect(t,h)},r}S(ie,"labelRect");async function ne(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i}=await G(l,t,j(t)),o=Math.max(i.width+(t.padding??0),t?.width??0),s=Math.max(i.height+(t.padding??0),t?.height??0),h=[{x:0,y:0},{x:o+3*s/6,y:0},{x:o,y:-s},{x:-(3*s)/6,y:-s}],n,{cssStyles:c}=t;if(t.look==="handDrawn"){let g=M.svg(e),f=T(t,{}),p=F(h),u=g.path(p,f);n=e.insert(()=>u,":first-child").attr("transform",`translate(${-o/2}, ${s/2})`),c&&n.attr("style",c)}else n=rt(e,o,s,h);return a&&n.attr("style",a),t.width=o,t.height=s,H(t,n),t.intersect=function(g){return N.polygon(t,h,g)},e}S(ne,"lean_left");async function le(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i}=await G(l,t,j(t)),o=Math.max(i.width+(t.padding??0),t?.width??0),s=Math.max(i.height+(t.padding??0),t?.height??0),h=[{x:-3*s/6,y:0},{x:o,y:0},{x:o+3*s/6,y:-s},{x:0,y:-s}],n,{cssStyles:c}=t;if(t.look==="handDrawn"){let g=M.svg(e),f=T(t,{}),p=F(h),u=g.path(p,f);n=e.insert(()=>u,":first-child").attr("transform",`translate(${-o/2}, ${s/2})`),c&&n.attr("style",c)}else n=rt(e,o,s,h);return a&&n.attr("style",a),t.width=o,t.height=s,H(t,n),t.intersect=function(g){return N.polygon(t,h,g)},e}S(le,"lean_right");function ce(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.label="",t.labelStyle=r;let e=l.insert("g").attr("class",j(t)).attr("id",t.domId??t.id),{cssStyles:i}=t,o=Math.max(35,t?.width??0),s=Math.max(35,t?.height??0),h=7,n=[{x:o,y:0},{x:0,y:s+h/2},{x:o-2*h,y:s+h/2},{x:0,y:2*s},{x:o,y:s-h/2},{x:2*h,y:s-h/2}],c=M.svg(e),g=T(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let f=F(n),p=c.path(f,g),u=e.insert(()=>p,":first-child");return i&&t.look!=="handDrawn"&&u.selectAll("path").attr("style",i),a&&t.look!=="handDrawn"&&u.selectAll("path").attr("style",a),u.attr("transform",`translate(-${o/2},${-s})`),H(t,u),t.intersect=function(y){return q.info("lightningBolt intersect",t,y),N.polygon(t,n,y)},e}S(ce,"lightningBolt");var pa=S((l,t,r,a,e,i,o)=>[`M${l},${t+i}`,`a${e},${i} 0,0,0 ${r},0`,`a${e},${i} 0,0,0 ${-r},0`,`l0,${a}`,`a${e},${i} 0,0,0 ${r},0`,`l0,${-a}`,`M${l},${t+i+o}`,`a${e},${i} 0,0,0 ${r},0`].join(" "),"createCylinderPathD"),fa=S((l,t,r,a,e,i,o)=>[`M${l},${t+i}`,`M${l+r},${t+i}`,`a${e},${i} 0,0,0 ${-r},0`,`l0,${a}`,`a${e},${i} 0,0,0 ${r},0`,`l0,${-a}`,`M${l},${t+i+o}`,`a${e},${i} 0,0,0 ${r},0`].join(" "),"createOuterCylinderPathD"),ua=S((l,t,r,a,e,i)=>[`M${l-r/2},${-a/2}`,`a${e},${i} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD");async function oe(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,label:o}=await G(l,t,j(t)),s=Math.max(i.width+(t.padding??0),t.width??0),h=s/2,n=h/(2.5+s/50),c=Math.max(i.height+n+(t.padding??0),t.height??0),g=c*.1,f,{cssStyles:p}=t;if(t.look==="handDrawn"){let u=M.svg(e),y=fa(0,0,s,c,h,n,g),m=ua(0,n,s,c,h,n),d=T(t,{}),x=u.path(y,d),b=u.path(m,d);e.insert(()=>b,":first-child").attr("class","line"),f=e.insert(()=>x,":first-child"),f.attr("class","basic label-container"),p&&f.attr("style",p)}else{let u=pa(0,0,s,c,h,n,g);f=e.insert("path",":first-child").attr("d",u).attr("class","basic label-container").attr("style",J(p)).attr("style",a)}return f.attr("label-offset-y",n),f.attr("transform",`translate(${-s/2}, ${-(c/2+n)})`),H(t,f),o.attr("transform",`translate(${-(i.width/2)-(i.x-(i.left??0))}, ${-(i.height/2)+n-(i.y-(i.top??0))})`),t.intersect=function(u){let y=N.rect(t,u),m=y.x-(t.x??0);if(h!=0&&(Math.abs(m)<(t.width??0)/2||Math.abs(m)==(t.width??0)/2&&Math.abs(y.y-(t.y??0))>(t.height??0)/2-n)){let d=n*n*(1-m*m/(h*h));d>0&&(d=Math.sqrt(d)),d=n-d,u.y-(t.y??0)>0&&(d=-d),y.y+=d}return y},e}S(oe,"linedCylinder");async function he(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,label:o}=await G(l,t,j(t)),s=Math.max(i.width+(t.padding??0)*2,t?.width??0),h=Math.max(i.height+(t.padding??0)*2,t?.height??0),n=h/4,c=h+n,{cssStyles:g}=t,f=M.svg(e),p=T(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let u=[{x:-s/2-s/2*.1,y:-c/2},{x:-s/2-s/2*.1,y:c/2},...nt(-s/2-s/2*.1,c/2,s/2+s/2*.1,c/2,n,.8),{x:s/2+s/2*.1,y:-c/2},{x:-s/2-s/2*.1,y:-c/2},{x:-s/2,y:-c/2},{x:-s/2,y:c/2*1.1},{x:-s/2,y:-c/2}],y=f.polygon(u.map(d=>[d.x,d.y]),p),m=e.insert(()=>y,":first-child");return m.attr("class","basic label-container"),g&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",g),a&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",a),m.attr("transform",`translate(0,${-n/2})`),o.attr("transform",`translate(${-s/2+(t.padding??0)+s/2*.1/2-(i.x-(i.left??0))},${-h/2+(t.padding??0)-n/2-(i.y-(i.top??0))})`),H(t,m),t.intersect=function(d){return N.polygon(t,u,d)},e}S(he,"linedWaveEdgedRect");async function ge(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,label:o}=await G(l,t,j(t)),s=Math.max(i.width+(t.padding??0)*2,t?.width??0),h=Math.max(i.height+(t.padding??0)*2,t?.height??0),n=5,c=-s/2,g=-h/2,{cssStyles:f}=t,p=M.svg(e),u=T(t,{}),y=[{x:c-n,y:g+n},{x:c-n,y:g+h+n},{x:c+s-n,y:g+h+n},{x:c+s-n,y:g+h},{x:c+s,y:g+h},{x:c+s,y:g+h-n},{x:c+s+n,y:g+h-n},{x:c+s+n,y:g-n},{x:c+n,y:g-n},{x:c+n,y:g},{x:c,y:g},{x:c,y:g+n}],m=[{x:c,y:g+n},{x:c+s-n,y:g+n},{x:c+s-n,y:g+h},{x:c+s,y:g+h},{x:c+s,y:g},{x:c,y:g}];t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let d=F(y),x=p.path(d,u),b=F(m),k=p.path(b,{...u,fill:"none"}),w=e.insert(()=>k,":first-child");return w.insert(()=>x,":first-child"),w.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",f),a&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",a),o.attr("transform",`translate(${-(i.width/2)-n-(i.x-(i.left??0))}, ${-(i.height/2)+n-(i.y-(i.top??0))})`),H(t,w),t.intersect=function(v){return N.polygon(t,y,v)},e}S(ge,"multiRect");async function pe(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,label:o}=await G(l,t,j(t)),s=Math.max(i.width+(t.padding??0)*2,t?.width??0),h=Math.max(i.height+(t.padding??0)*2,t?.height??0),n=h/4,c=h+n,g=-s/2,f=-c/2,p=5,{cssStyles:u}=t,y=nt(g-p,f+c+p,g+s-p,f+c+p,n,.8),m=y?.[y.length-1],d=[{x:g-p,y:f+p},{x:g-p,y:f+c+p},...y,{x:g+s-p,y:m.y-p},{x:g+s,y:m.y-p},{x:g+s,y:m.y-2*p},{x:g+s+p,y:m.y-2*p},{x:g+s+p,y:f-p},{x:g+p,y:f-p},{x:g+p,y:f},{x:g,y:f},{x:g,y:f+p}],x=[{x:g,y:f+p},{x:g+s-p,y:f+p},{x:g+s-p,y:m.y-p},{x:g+s,y:m.y-p},{x:g+s,y:f},{x:g,y:f}],b=M.svg(e),k=T(t,{});t.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");let w=F(d),v=b.path(w,k),$=F(x),D=b.path($,k),C=e.insert(()=>v,":first-child");return C.insert(()=>D),C.attr("class","basic label-container"),u&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",u),a&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",a),C.attr("transform",`translate(0,${-n/2})`),o.attr("transform",`translate(${-(i.width/2)-p-(i.x-(i.left??0))}, ${-(i.height/2)+p-n/2-(i.y-(i.top??0))})`),H(t,C),t.intersect=function(R){return N.polygon(t,d,R)},e}S(pe,"multiWaveEdgedRectangle");async function fe(l,t,{config:{themeVariables:r}}){let{labelStyles:a,nodeStyles:e}=I(t);t.labelStyle=a,t.useHtmlLabels||Rt().flowchart?.htmlLabels!==!1||(t.centerLabel=!0);let{shapeSvg:o,bbox:s}=await G(l,t,j(t)),h=Math.max(s.width+(t.padding??0)*2,t?.width??0),n=Math.max(s.height+(t.padding??0)*2,t?.height??0),c=-h/2,g=-n/2,{cssStyles:f}=t,p=M.svg(o),u=T(t,{fill:r.noteBkgColor,stroke:r.noteBorderColor});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let y=p.rectangle(c,g,h,n,u),m=o.insert(()=>y,":first-child");return m.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",f),e&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",e),H(t,m),t.intersect=function(d){return N.rect(t,d)},o}S(fe,"note");var ya=S((l,t,r)=>[`M${l+r/2},${t}`,`L${l+r},${t-r/2}`,`L${l+r/2},${t-r}`,`L${l},${t-r/2}`,"Z"].join(" "),"createDecisionBoxPathD");async function ue(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i}=await G(l,t,j(t)),o=i.width+t.padding,s=i.height+t.padding,h=o+s,n=[{x:h/2,y:0},{x:h,y:-h/2},{x:h/2,y:-h},{x:0,y:-h/2}],c,{cssStyles:g}=t;if(t.look==="handDrawn"){let f=M.svg(e),p=T(t,{}),u=ya(0,0,h),y=f.path(u,p);c=e.insert(()=>y,":first-child").attr("transform",`translate(${-h/2}, ${h/2})`),g&&c.attr("style",g)}else c=rt(e,h,h,n);return a&&c.attr("style",a),H(t,c),t.intersect=function(f){return q.debug(`APA12 Intersect called SPLIT
|
|
point:`,f,`
|
|
node:
|
|
`,t,`
|
|
res:`,N.polygon(t,n,f)),N.polygon(t,n,f)},e}S(ue,"question");async function ye(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,label:o}=await G(l,t,j(t)),s=Math.max(i.width+(t.padding??0),t?.width??0),h=Math.max(i.height+(t.padding??0),t?.height??0),n=-s/2,c=-h/2,g=c/2,f=[{x:n+g,y:c},{x:n,y:0},{x:n+g,y:-c},{x:-n,y:-c},{x:-n,y:c}],{cssStyles:p}=t,u=M.svg(e),y=T(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let m=F(f),d=u.path(m,y),x=e.insert(()=>d,":first-child");return x.attr("class","basic label-container"),p&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",p),a&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",a),x.attr("transform",`translate(${-g/2},0)`),o.attr("transform",`translate(${-g/2-i.width/2-(i.x-(i.left??0))}, ${-(i.height/2)-(i.y-(i.top??0))})`),H(t,x),t.intersect=function(b){return N.polygon(t,f,b)},e}S(ye,"rect_left_inv_arrow");async function de(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let e;t.cssClasses?e="node "+t.cssClasses:e="node default";let i=l.insert("g").attr("class",e).attr("id",t.domId||t.id),o=i.insert("g"),s=i.insert("g").attr("class","label").attr("style",a),h=t.description,n=t.label,c=s.node().appendChild(await Kt(n,t.labelStyle,!0,!0)),g={width:0,height:0};if(Q(X()?.flowchart?.htmlLabels)){let D=c.children[0],C=Y(c);g=D.getBoundingClientRect(),C.attr("width",g.width),C.attr("height",g.height)}q.info("Text 2",h);let f=h||[],p=c.getBBox(),u=s.node().appendChild(await Kt(f.join?f.join("<br/>"):f,t.labelStyle,!0,!0)),y=u.children[0],m=Y(u);g=y.getBoundingClientRect(),m.attr("width",g.width),m.attr("height",g.height);let d=(t.padding||0)/2;Y(u).attr("transform","translate( "+(g.width>p.width?0:(p.width-g.width)/2)+", "+(p.height+d+5)+")"),Y(c).attr("transform","translate( "+(g.width<p.width?0:-(p.width-g.width)/2)+", 0)"),g=s.node().getBBox(),s.attr("transform","translate("+-g.width/2+", "+(-g.height/2-d+3)+")");let x=g.width+(t.padding||0),b=g.height+(t.padding||0),k=-g.width/2-d,w=-g.height/2-d,v,$;if(t.look==="handDrawn"){let D=M.svg(i),C=T(t,{}),R=D.path(at(k,w,x,b,t.rx||0),C),L=D.line(-g.width/2-d,-g.height/2-d+p.height+d,g.width/2+d,-g.height/2-d+p.height+d,C);$=i.insert(()=>(q.debug("Rough node insert CXC",R),L),":first-child"),v=i.insert(()=>(q.debug("Rough node insert CXC",R),R),":first-child")}else v=o.insert("rect",":first-child"),$=o.insert("line"),v.attr("class","outer title-state").attr("style",a).attr("x",-g.width/2-d).attr("y",-g.height/2-d).attr("width",g.width+(t.padding||0)).attr("height",g.height+(t.padding||0)),$.attr("class","divider").attr("x1",-g.width/2-d).attr("x2",g.width/2+d).attr("y1",-g.height/2-d+p.height+d).attr("y2",-g.height/2-d+p.height+d);return H(t,v),t.intersect=function(D){return N.rect(t,D)},i}S(de,"rectWithTitle");async function me(l,t){let r={rx:5,ry:5,classes:"",labelPaddingX:(t?.padding||0)*1,labelPaddingY:(t?.padding||0)*1};return Bt(l,t,r)}S(me,"roundedRect");async function xe(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,label:o}=await G(l,t,j(t)),s=t?.padding??0,h=Math.max(i.width+(t.padding??0)*2,t?.width??0),n=Math.max(i.height+(t.padding??0)*2,t?.height??0),c=-i.width/2-s,g=-i.height/2-s,{cssStyles:f}=t,p=M.svg(e),u=T(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let y=[{x:c,y:g},{x:c+h+8,y:g},{x:c+h+8,y:g+n},{x:c-8,y:g+n},{x:c-8,y:g},{x:c,y:g},{x:c,y:g+n}],m=p.polygon(y.map(x=>[x.x,x.y]),u),d=e.insert(()=>m,":first-child");return d.attr("class","basic label-container").attr("style",J(f)),a&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",a),f&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",a),o.attr("transform",`translate(${-h/2+4+(t.padding??0)-(i.x-(i.left??0))},${-n/2+(t.padding??0)-(i.y-(i.top??0))})`),H(t,d),t.intersect=function(x){return N.rect(t,x)},e}S(xe,"shadedProcess");async function be(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,label:o}=await G(l,t,j(t)),s=Math.max(i.width+(t.padding??0)*2,t?.width??0),h=Math.max(i.height+(t.padding??0)*2,t?.height??0),n=-s/2,c=-h/2,{cssStyles:g}=t,f=M.svg(e),p=T(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let u=[{x:n,y:c},{x:n,y:c+h},{x:n+s,y:c+h},{x:n+s,y:c-h/2}],y=F(u),m=f.path(y,p),d=e.insert(()=>m,":first-child");return d.attr("class","basic label-container"),g&&t.look!=="handDrawn"&&d.selectChildren("path").attr("style",g),a&&t.look!=="handDrawn"&&d.selectChildren("path").attr("style",a),d.attr("transform",`translate(0, ${h/4})`),o.attr("transform",`translate(${-s/2+(t.padding??0)-(i.x-(i.left??0))}, ${-h/4+(t.padding??0)-(i.y-(i.top??0))})`),H(t,d),t.intersect=function(x){return N.polygon(t,u,x)},e}S(be,"slopedRect");async function we(l,t){let r={rx:0,ry:0,classes:"",labelPaddingX:(t?.padding||0)*2,labelPaddingY:(t?.padding||0)*1};return Bt(l,t,r)}S(we,"squareRect");async function Se(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i}=await G(l,t,j(t)),o=i.height+t.padding,s=i.width+o/4+t.padding,h,{cssStyles:n}=t;if(t.look==="handDrawn"){let c=M.svg(e),g=T(t,{}),f=at(-s/2,-o/2,s,o,o/2),p=c.path(f,g);h=e.insert(()=>p,":first-child"),h.attr("class","basic label-container").attr("style",J(n))}else h=e.insert("rect",":first-child"),h.attr("class","basic label-container").attr("style",a).attr("rx",o/2).attr("ry",o/2).attr("x",-s/2).attr("y",-o/2).attr("width",s).attr("height",o);return H(t,h),t.intersect=function(c){return N.rect(t,c)},e}S(Se,"stadium");async function Me(l,t){return Bt(l,t,{rx:5,ry:5,classes:"flowchart-node"})}S(Me,"state");function ke(l,t,{config:{themeVariables:r}}){let{labelStyles:a,nodeStyles:e}=I(t);t.labelStyle=a;let{cssStyles:i}=t,{lineColor:o,stateBorder:s,nodeBorder:h}=r,n=l.insert("g").attr("class","node default").attr("id",t.domId||t.id),c=M.svg(n),g=T(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let f=c.circle(0,0,14,{...g,stroke:o,strokeWidth:2}),p=s??h,u=c.circle(0,0,5,{...g,fill:p,stroke:p,strokeWidth:2,fillStyle:"solid"}),y=n.insert(()=>f,":first-child");return y.insert(()=>u),i&&y.selectAll("path").attr("style",i),e&&y.selectAll("path").attr("style",e),H(t,y),t.intersect=function(m){return N.circle(t,7,m)},n}S(ke,"stateEnd");function ve(l,t,{config:{themeVariables:r}}){let{lineColor:a}=r,e=l.insert("g").attr("class","node default").attr("id",t.domId||t.id),i;if(t.look==="handDrawn"){let s=M.svg(e).circle(0,0,14,Qe(a));i=e.insert(()=>s),i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14)}else i=e.insert("circle",":first-child"),i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14);return H(t,i),t.intersect=function(o){return N.circle(t,7,o)},e}S(ve,"stateStart");async function $e(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i}=await G(l,t,j(t)),o=(t?.padding||0)/2,s=i.width+t.padding,h=i.height+t.padding,n=-i.width/2-o,c=-i.height/2-o,g=[{x:0,y:0},{x:s,y:0},{x:s,y:-h},{x:0,y:-h},{x:0,y:0},{x:-8,y:0},{x:s+8,y:0},{x:s+8,y:-h},{x:-8,y:-h},{x:-8,y:0}];if(t.look==="handDrawn"){let f=M.svg(e),p=T(t,{}),u=f.rectangle(n-8,c,s+16,h,p),y=f.line(n,c,n,c+h,p),m=f.line(n+s,c,n+s,c+h,p);e.insert(()=>y,":first-child"),e.insert(()=>m,":first-child");let d=e.insert(()=>u,":first-child"),{cssStyles:x}=t;d.attr("class","basic label-container").attr("style",J(x)),H(t,d)}else{let f=rt(e,s,h,g);a&&f.attr("style",a),H(t,f)}return t.intersect=function(f){return N.polygon(t,g,f)},e}S($e,"subroutine");async function De(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i}=await G(l,t,j(t)),o=Math.max(i.width+(t.padding??0)*2,t?.width??0),s=Math.max(i.height+(t.padding??0)*2,t?.height??0),h=-o/2,n=-s/2,c=.2*s,g=.2*s,{cssStyles:f}=t,p=M.svg(e),u=T(t,{}),y=[{x:h-c/2,y:n},{x:h+o+c/2,y:n},{x:h+o+c/2,y:n+s},{x:h-c/2,y:n+s}],m=[{x:h+o-c/2,y:n+s},{x:h+o+c/2,y:n+s},{x:h+o+c/2,y:n+s-g}];t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let d=F(y),x=p.path(d,u),b=F(m),k=p.path(b,{...u,fillStyle:"solid"}),w=e.insert(()=>k,":first-child");return w.insert(()=>x,":first-child"),w.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",f),a&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",a),H(t,w),t.intersect=function(v){return N.polygon(t,y,v)},e}S(De,"taggedRect");async function Pe(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,label:o}=await G(l,t,j(t)),s=Math.max(i.width+(t.padding??0)*2,t?.width??0),h=Math.max(i.height+(t.padding??0)*2,t?.height??0),n=h/4,c=.2*s,g=.2*h,f=h+n,{cssStyles:p}=t,u=M.svg(e),y=T(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let m=[{x:-s/2-s/2*.1,y:f/2},...nt(-s/2-s/2*.1,f/2,s/2+s/2*.1,f/2,n,.8),{x:s/2+s/2*.1,y:-f/2},{x:-s/2-s/2*.1,y:-f/2}],d=-s/2+s/2*.1,x=-f/2-g*.4,b=[{x:d+s-c,y:(x+h)*1.4},{x:d+s,y:x+h-g},{x:d+s,y:(x+h)*.9},...nt(d+s,(x+h)*1.3,d+s-c,(x+h)*1.5,-h*.03,.5)],k=F(m),w=u.path(k,y),v=F(b),$=u.path(v,{...y,fillStyle:"solid"}),D=e.insert(()=>$,":first-child");return D.insert(()=>w,":first-child"),D.attr("class","basic label-container"),p&&t.look!=="handDrawn"&&D.selectAll("path").attr("style",p),a&&t.look!=="handDrawn"&&D.selectAll("path").attr("style",a),D.attr("transform",`translate(0,${-n/2})`),o.attr("transform",`translate(${-s/2+(t.padding??0)-(i.x-(i.left??0))},${-h/2+(t.padding??0)-n/2-(i.y-(i.top??0))})`),H(t,D),t.intersect=function(C){return N.polygon(t,m,C)},e}S(Pe,"taggedWaveEdgedRectangle");async function Ce(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i}=await G(l,t,j(t)),o=Math.max(i.width+t.padding,t?.width||0),s=Math.max(i.height+t.padding,t?.height||0),h=-o/2,n=-s/2,c=e.insert("rect",":first-child");return c.attr("class","text").attr("style",a).attr("rx",0).attr("ry",0).attr("x",h).attr("y",n).attr("width",o).attr("height",s),H(t,c),t.intersect=function(g){return N.rect(t,g)},e}S(Ce,"text");var da=S((l,t,r,a,e,i)=>`M${l},${t}
|
|
a${e},${i} 0,0,1 0,${-a}
|
|
l${r},0
|
|
a${e},${i} 0,0,1 0,${a}
|
|
M${r},${-a}
|
|
a${e},${i} 0,0,0 0,${a}
|
|
l${-r},0`,"createCylinderPathD"),ma=S((l,t,r,a,e,i)=>[`M${l},${t}`,`M${l+r},${t}`,`a${e},${i} 0,0,0 0,${-a}`,`l${-r},0`,`a${e},${i} 0,0,0 0,${a}`,`l${r},0`].join(" "),"createOuterCylinderPathD"),xa=S((l,t,r,a,e,i)=>[`M${l+r/2},${-a/2}`,`a${e},${i} 0,0,0 0,${a}`].join(" "),"createInnerCylinderPathD");async function Be(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,label:o,halfPadding:s}=await G(l,t,j(t)),h=t.look==="neo"?s*2:s,n=i.height+h,c=n/2,g=c/(2.5+n/50),f=i.width+g+h,{cssStyles:p}=t,u;if(t.look==="handDrawn"){let y=M.svg(e),m=ma(0,0,f,n,g,c),d=xa(0,0,f,n,g,c),x=y.path(m,T(t,{})),b=y.path(d,T(t,{fill:"none"}));u=e.insert(()=>b,":first-child"),u=e.insert(()=>x,":first-child"),u.attr("class","basic label-container"),p&&u.attr("style",p)}else{let y=da(0,0,f,n,g,c);u=e.insert("path",":first-child").attr("d",y).attr("class","basic label-container").attr("style",J(p)).attr("style",a),u.attr("class","basic label-container"),p&&u.selectAll("path").attr("style",p),a&&u.selectAll("path").attr("style",a)}return u.attr("label-offset-x",g),u.attr("transform",`translate(${-f/2}, ${n/2} )`),o.attr("transform",`translate(${-(i.width/2)-g-(i.x-(i.left??0))}, ${-(i.height/2)-(i.y-(i.top??0))})`),H(t,u),t.intersect=function(y){let m=N.rect(t,y),d=m.y-(t.y??0);if(c!=0&&(Math.abs(d)<(t.height??0)/2||Math.abs(d)==(t.height??0)/2&&Math.abs(m.x-(t.x??0))>(t.width??0)/2-g)){let x=g*g*(1-d*d/(c*c));x!=0&&(x=Math.sqrt(Math.abs(x))),x=g-x,y.x-(t.x??0)>0&&(x=-x),m.x+=x}return m},e}S(Be,"tiltedCylinder");async function Ne(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i}=await G(l,t,j(t)),o=i.width+t.padding,s=i.height+t.padding,h=[{x:-3*s/6,y:0},{x:o+3*s/6,y:0},{x:o,y:-s},{x:0,y:-s}],n,{cssStyles:c}=t;if(t.look==="handDrawn"){let g=M.svg(e),f=T(t,{}),p=F(h),u=g.path(p,f);n=e.insert(()=>u,":first-child").attr("transform",`translate(${-o/2}, ${s/2})`),c&&n.attr("style",c)}else n=rt(e,o,s,h);return a&&n.attr("style",a),t.width=o,t.height=s,H(t,n),t.intersect=function(g){return N.polygon(t,h,g)},e}S(Ne,"trapezoid");async function Re(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i}=await G(l,t,j(t)),o=60,s=20,h=Math.max(o,i.width+(t.padding??0)*2,t?.width??0),n=Math.max(s,i.height+(t.padding??0)*2,t?.height??0),{cssStyles:c}=t,g=M.svg(e),f=T(t,{});t.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");let p=[{x:-h/2*.8,y:-n/2},{x:h/2*.8,y:-n/2},{x:h/2,y:-n/2*.6},{x:h/2,y:n/2},{x:-h/2,y:n/2},{x:-h/2,y:-n/2*.6}],u=F(p),y=g.path(u,f),m=e.insert(()=>y,":first-child");return m.attr("class","basic label-container"),c&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",c),a&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",a),H(t,m),t.intersect=function(d){return N.polygon(t,p,d)},e}S(Re,"trapezoidalPentagon");async function Le(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,label:o}=await G(l,t,j(t)),s=Q(X().flowchart?.htmlLabels),h=i.width+(t.padding??0),n=h+i.height,c=h+i.height,g=[{x:0,y:0},{x:c,y:0},{x:c/2,y:-n}],{cssStyles:f}=t,p=M.svg(e),u=T(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let y=F(g),m=p.path(y,u),d=e.insert(()=>m,":first-child").attr("transform",`translate(${-n/2}, ${n/2})`);return f&&t.look!=="handDrawn"&&d.selectChildren("path").attr("style",f),a&&t.look!=="handDrawn"&&d.selectChildren("path").attr("style",a),t.width=h,t.height=n,H(t,d),o.attr("transform",`translate(${-i.width/2-(i.x-(i.left??0))}, ${n/2-(i.height+(t.padding??0)/(s?2:1)-(i.y-(i.top??0)))})`),t.intersect=function(x){return q.info("Triangle intersect",t,g,x),N.polygon(t,g,x)},e}S(Le,"triangle");async function Ae(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,label:o}=await G(l,t,j(t)),s=Math.max(i.width+(t.padding??0)*2,t?.width??0),h=Math.max(i.height+(t.padding??0)*2,t?.height??0),n=h/8,c=h+n,{cssStyles:g}=t,p=70-s,u=p>0?p/2:0,y=M.svg(e),m=T(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");let d=[{x:-s/2-u,y:c/2},...nt(-s/2-u,c/2,s/2+u,c/2,n,.8),{x:s/2+u,y:-c/2},{x:-s/2-u,y:-c/2}],x=F(d),b=y.path(x,m),k=e.insert(()=>b,":first-child");return k.attr("class","basic label-container"),g&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",g),a&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",a),k.attr("transform",`translate(0,${-n/2})`),o.attr("transform",`translate(${-s/2+(t.padding??0)-(i.x-(i.left??0))},${-h/2+(t.padding??0)-n-(i.y-(i.top??0))})`),H(t,k),t.intersect=function(w){return N.polygon(t,d,w)},e}S(Ae,"waveEdgedRectangle");async function Te(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i}=await G(l,t,j(t)),o=100,s=50,h=Math.max(i.width+(t.padding??0)*2,t?.width??0),n=Math.max(i.height+(t.padding??0)*2,t?.height??0),c=h/n,g=h,f=n;g>f*c?f=g/c:g=f*c,g=Math.max(g,o),f=Math.max(f,s);let p=Math.min(f*.2,f/4),u=f+p*2,{cssStyles:y}=t,m=M.svg(e),d=T(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");let x=[{x:-g/2,y:u/2},...nt(-g/2,u/2,g/2,u/2,p,1),{x:g/2,y:-u/2},...nt(g/2,-u/2,-g/2,-u/2,p,-1)],b=F(x),k=m.path(b,d),w=e.insert(()=>k,":first-child");return w.attr("class","basic label-container"),y&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",y),a&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",a),H(t,w),t.intersect=function(v){return N.polygon(t,x,v)},e}S(Te,"waveRectangle");async function We(l,t){let{labelStyles:r,nodeStyles:a}=I(t);t.labelStyle=r;let{shapeSvg:e,bbox:i,label:o}=await G(l,t,j(t)),s=Math.max(i.width+(t.padding??0)*2,t?.width??0),h=Math.max(i.height+(t.padding??0)*2,t?.height??0),n=5,c=-s/2,g=-h/2,{cssStyles:f}=t,p=M.svg(e),u=T(t,{}),y=[{x:c-n,y:g-n},{x:c-n,y:g+h},{x:c+s,y:g+h},{x:c+s,y:g-n}],m=`M${c-n},${g-n} L${c+s},${g-n} L${c+s},${g+h} L${c-n},${g+h} L${c-n},${g-n}
|
|
M${c-n},${g} L${c+s},${g}
|
|
M${c},${g-n} L${c},${g+h}`;t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let d=p.path(m,u),x=e.insert(()=>d,":first-child");return x.attr("transform",`translate(${n/2}, ${n/2})`),x.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",f),a&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",a),o.attr("transform",`translate(${-(i.width/2)+n/2-(i.x-(i.left??0))}, ${-(i.height/2)+n/2-(i.y-(i.top??0))})`),H(t,x),t.intersect=function(b){return N.polygon(t,y,b)},e}S(We,"windowPane");async function He(l,t,r,a,e=r.class.padding??12){let i=a?0:3,o=l.insert("g").attr("class",j(t)).attr("id",t.domId||t.id),s=null,h=null,n=null,c=null,g=0,f=0,p=0;if(s=o.insert("g").attr("class","annotation-group text"),t.annotations.length>0){let x=t.annotations[0];await bt(s,{text:`\xAB${x}\xBB`},0),g=s.node().getBBox().height}h=o.insert("g").attr("class","label-group text"),await bt(h,t,0,["font-weight: bolder"]);let u=h.node().getBBox();f=u.height,n=o.insert("g").attr("class","members-group text");let y=0;for(let x of t.members){let b=await bt(n,x,y,[x.parseClassifier()]);y+=b+i}p=n.node().getBBox().height,p<=0&&(p=e/2),c=o.insert("g").attr("class","methods-group text");let m=0;for(let x of t.methods){let b=await bt(c,x,m,[x.parseClassifier()]);m+=b+i}let d=o.node().getBBox();if(s!==null){let x=s.node().getBBox();s.attr("transform",`translate(${-x.width/2})`)}return h.attr("transform",`translate(${-u.width/2}, ${g})`),d=o.node().getBBox(),n.attr("transform",`translate(0, ${g+f+e*2})`),d=o.node().getBBox(),c.attr("transform",`translate(0, ${g+f+(p?p+e*4:e*2)})`),d=o.node().getBBox(),{shapeSvg:o,bbox:d}}S(He,"textHelper");async function bt(l,t,r,a=[]){let e=l.insert("g").attr("class","label").attr("style",a.join("; ")),i=Rt(),o="useHtmlLabels"in t?t.useHtmlLabels:Q(i.htmlLabels)??!0,s="";"text"in t?s=t.text:s=t.label,!o&&s.startsWith("\\")&&(s=s.substring(1)),At(s)&&(o=!0);let h=await ct(e,ns(ut(s)),{width:ls(s,i)+50,classes:"markdown-node-label",useHtmlLabels:o},i),n,c=1;if(o){let g=h.children[0],f=Y(h);c=g.innerHTML.split("<br>").length,g.innerHTML.includes("</math>")&&(c+=g.innerHTML.split("<mrow>").length-1);let p=g.getElementsByTagName("img");if(p){let u=s.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...p].map(y=>new Promise(m=>{function d(){if(y.style.display="flex",y.style.flexDirection="column",u){let x=i.fontSize?.toString()??window.getComputedStyle(document.body).fontSize,k=parseInt(x,10)*5+"px";y.style.minWidth=k,y.style.maxWidth=k}else y.style.width="100%";m(y)}S(d,"setupImage"),setTimeout(()=>{y.complete&&d()}),y.addEventListener("error",d),y.addEventListener("load",d)})))}n=g.getBoundingClientRect(),f.attr("width",n.width),f.attr("height",n.height)}else{a.includes("font-weight: bolder")&&Y(h).selectAll("tspan").attr("font-weight",""),c=h.children.length;let g=h.children[0];(h.textContent===""||h.textContent.includes(">"))&&(g.textContent=s[0]+s.substring(1).replaceAll(">",">").replaceAll("<","<").trim(),s[1]===" "&&(g.textContent=g.textContent[0]+" "+g.textContent.substring(1))),g.textContent==="undefined"&&(g.textContent=""),n=h.getBBox()}return e.attr("transform","translate(0,"+(-n.height/(2*c)+r)+")"),n.height}S(bt,"addText");async function Ie(l,t){let r=X(),a=r.class.padding??12,e=a,i=t.useHtmlLabels??Q(r.htmlLabels)??!0,o=t;o.annotations=o.annotations??[],o.members=o.members??[],o.methods=o.methods??[];let{shapeSvg:s,bbox:h}=await He(l,t,r,i,e),{labelStyles:n,nodeStyles:c}=I(t);t.labelStyle=n,t.cssStyles=o.styles||"";let g=o.styles?.join(";")||c||"";t.cssStyles||(t.cssStyles=g.replaceAll("!important","").split(";"));let f=o.members.length===0&&o.methods.length===0&&!r.class?.hideEmptyMembersBox,p=M.svg(s),u=T(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let y=h.width,m=h.height;o.members.length===0&&o.methods.length===0?m+=e:o.members.length>0&&o.methods.length===0&&(m+=e*2);let d=-y/2,x=-m/2,b=p.rectangle(d-a,x-a-(f?a:o.members.length===0&&o.methods.length===0?-a/2:0),y+2*a,m+2*a+(f?a*2:o.members.length===0&&o.methods.length===0?-a:0),u),k=s.insert(()=>b,":first-child");k.attr("class","basic label-container");let w=k.node().getBBox();s.selectAll(".text").each((C,R,L)=>{let E=Y(L[R]),P=E.attr("transform"),A=0;if(P){let z=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(P);z&&(A=parseFloat(z[2]))}let W=A+x+a-(f?a:o.members.length===0&&o.methods.length===0?-a/2:0);i||(W-=4);let B=d;(E.attr("class").includes("label-group")||E.attr("class").includes("annotation-group"))&&(B=-E.node()?.getBBox().width/2||0,s.selectAll("text").each(function(O,z,Z){window.getComputedStyle(Z[z]).textAnchor==="middle"&&(B=0)})),E.attr("transform",`translate(${B}, ${W})`)});let v=s.select(".annotation-group").node().getBBox().height-(f?a/2:0)||0,$=s.select(".label-group").node().getBBox().height-(f?a/2:0)||0,D=s.select(".members-group").node().getBBox().height-(f?a/2:0)||0;if(o.members.length>0||o.methods.length>0||f){let C=p.line(w.x,v+$+x+a,w.x+w.width,v+$+x+a,u);s.insert(()=>C).attr("class","divider").attr("style",g)}if(f||o.members.length>0||o.methods.length>0){let C=p.line(w.x,v+$+D+x+e*2+a,w.x+w.width,v+$+D+x+a+e*2,u);s.insert(()=>C).attr("class","divider").attr("style",g)}if(o.look!=="handDrawn"&&s.selectAll("path").attr("style",g),k.select(":nth-child(2)").attr("style",g),s.selectAll(".divider").select("path").attr("style",g),t.labelStyle?s.selectAll("span").attr("style",t.labelStyle):s.selectAll("span").attr("style",g),!i){let C=RegExp(/color\s*:\s*([^;]*)/),R=C.exec(g);if(R){let L=R[0].replace("color","fill");s.selectAll("tspan").attr("style",L)}else if(n){let L=C.exec(n);if(L){let E=L[0].replace("color","fill");s.selectAll("tspan").attr("style",E)}}}return H(t,k),t.intersect=function(C){return N.rect(t,C)},s}S(Ie,"classBox");var ba=S(l=>{switch(l){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 Ee(l,t,{config:r}){let{labelStyles:a,nodeStyles:e}=I(t);t.labelStyle=a||"";let i=10,o=t.width;t.width=(t.width??200)-10;let{shapeSvg:s,bbox:h,label:n}=await G(l,t,j(t)),c=t.padding||10,g="",f;"ticket"in t&&t.ticket&&r?.kanban?.ticketBaseUrl&&(g=r?.kanban?.ticketBaseUrl.replace("#TICKET#",t.ticket),f=s.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",g).attr("target","_blank"));let p={useHtmlLabels:t.useHtmlLabels,labelStyle:t.labelStyle||"",width:t.width,img:t.img,padding:t.padding||8,centerLabel:!1},u,y;f?{label:u,bbox:y}=await Ut(f,"ticket"in t&&t.ticket||"",p):{label:u,bbox:y}=await Ut(s,"ticket"in t&&t.ticket||"",p);let{label:m,bbox:d}=await Ut(s,"assigned"in t&&t.assigned||"",p);t.width=o;let x=10,b=t?.width||0,k=Math.max(y.height,d.height)/2,w=Math.max(h.height+x*2,t?.height||0)+k,v=-b/2,$=-w/2;n.attr("transform","translate("+(c-b/2)+", "+(-k-h.height/2)+")"),u.attr("transform","translate("+(c-b/2)+", "+(-k+h.height/2)+")"),m.attr("transform","translate("+(c+b/2-d.width-2*i)+", "+(-k+h.height/2)+")");let D,{rx:C,ry:R}=t,{cssStyles:L}=t;if(t.look==="handDrawn"){let E=M.svg(s),P=T(t,{}),A=C||R?E.path(at(v,$,b,w,C||0),P):E.rectangle(v,$,b,w,P);D=s.insert(()=>A,":first-child"),D.attr("class","basic label-container").attr("style",L||null)}else{D=s.insert("rect",":first-child"),D.attr("class","basic label-container __APA__").attr("style",e).attr("rx",C??5).attr("ry",R??5).attr("x",v).attr("y",$).attr("width",b).attr("height",w);let E="priority"in t&&t.priority;if(E){let P=s.append("line"),A=v+2,W=$+Math.floor((C??0)/2),B=$+w-Math.floor((C??0)/2);P.attr("x1",A).attr("y1",W).attr("x2",A).attr("y2",B).attr("stroke-width","4").attr("stroke",ba(E))}}return H(t,D),t.height=w,t.intersect=function(E){return N.rect(t,E)},s}S(Ee,"kanbanItem");var wa=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:we},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:me},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:Se},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:$e},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:Fs},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:Is},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:ue},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:Js},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:le},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:ne},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:Ne},{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:re},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:Xs},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:Ce},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:Ws},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:xe},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:ve},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:ke},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:Zs},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:Us},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:_s},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:zs},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:js},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:ce},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:Ae},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:Qs},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:Be},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:oe},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:Gs},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:qs},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:Le},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:We},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:Ys},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:Re},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:Vs},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:be},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:pe},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:ge},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:Ts},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:Os},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:Pe},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:De},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:Te},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:ye},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:he}],Sa=S(()=>{let t=[...Object.entries({state:Me,choice:Hs,note:fe,rectWithTitle:de,labelRect:ie,iconSquare:ee,iconCircle:te,icon:Ks,iconRounded:se,imageSquare:ae,anchor:As,kanbanItem:Ee,classBox:Ie}),...wa.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(e=>[e,r.handler]))];return Object.fromEntries(t)},"generateShapeMap"),Oe=Sa();function Ma(l){return l in Oe}S(Ma,"isValidShape");var Nt=new Map;async function ka(l,t,r){let a,e;t.shape==="rect"&&(t.rx&&t.ry?t.shape="roundedRect":t.shape="squareRect");let i=t.shape?Oe[t.shape]:void 0;if(!i)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"),a=l.insert("svg:a").attr("xlink:href",t.link).attr("target",o??null),e=await i(a,t,r)}else e=await i(l,t,r),a=e;return t.tooltip&&e.attr("title",t.tooltip),Nt.set(t.id,a),t.haveCallback&&a.attr("class",a.attr("class")+" clickable"),a}S(ka,"insertNode");var Or=S((l,t)=>{Nt.set(t.id,l)},"setNodeElem"),_r=S(()=>{Nt.clear()},"clear"),zr=S(l=>{let t=Nt.get(l.id);q.trace("Transforming node",l.diff,l,"translate("+(l.x-l.width/2-5)+", "+l.width/2+")");let r=8,a=l.diff||0;return l.clusterNode?t.attr("transform","translate("+(l.x+a-l.width/2)+", "+(l.y-l.height/2-r)+")"):t.attr("transform","translate("+l.x+", "+l.y+")"),a},"positionNode");export{M as a,G as b,H as c,Kt as d,Ta as e,Wa as f,Ma as g,ka as h,Or as i,_r as j,zr as k};
|
|
//# sourceMappingURL=chunk-N6ME3NZU.min.js.map
|