@smartmemory/compose 0.2.1-beta → 0.2.2-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/assets/{App-VU2lfA8m.js → App-QGVt8tH2.js} +155 -155
  2. package/dist/assets/arc-yX1Dy9Ls.js +1 -0
  3. package/dist/assets/{architectureDiagram-3BPJPVTR-itmOSZLE.js → architectureDiagram-3BPJPVTR-BhtVN7Go.js} +3 -3
  4. package/dist/assets/{blockDiagram-GPEHLZMM-N7MotI_5.js → blockDiagram-GPEHLZMM-Do_uWvAL.js} +4 -4
  5. package/dist/assets/{c4Diagram-AAUBKEIU-DRKW39LH.js → c4Diagram-AAUBKEIU-DhjfNEZ_.js} +3 -3
  6. package/dist/assets/channel-D6hNrRZ2.js +1 -0
  7. package/dist/assets/chunk-2J33WTMH-ZLuzLSr5.js +1 -0
  8. package/dist/assets/{chunk-4BX2VUAB-BTe-QE0R.js → chunk-4BX2VUAB-BkfYx42O.js} +1 -1
  9. package/dist/assets/chunk-55IACEB6-UGWHui37.js +1 -0
  10. package/dist/assets/{chunk-727SXJPM-CBRmkSvh.js → chunk-727SXJPM-DENLKVEd.js} +5 -5
  11. package/dist/assets/{chunk-AQP2D5EJ-BdtQ63fN.js → chunk-AQP2D5EJ-BV-AIq0h.js} +2 -2
  12. package/dist/assets/{chunk-FMBD7UC4-DfYQ2YmB.js → chunk-FMBD7UC4-BO5q1BN_.js} +1 -1
  13. package/dist/assets/chunk-ND2GUHAM-rAAtIsqf.js +1 -0
  14. package/dist/assets/{chunk-QZHKN3VN-DwjqJ9xB.js → chunk-QZHKN3VN-DmZo3sCU.js} +1 -1
  15. package/dist/assets/classDiagram-4FO5ZUOK-DvsVLUph.js +1 -0
  16. package/dist/assets/classDiagram-v2-Q7XG4LA2-DvsVLUph.js +1 -0
  17. package/dist/assets/cose-bilkent-S5V4N54A-BlBShGhI.js +1 -0
  18. package/dist/assets/dagre-BM42HDAG-urcL7_B8.js +4 -0
  19. package/dist/assets/{defaultLocale-CrowFXzY.js → defaultLocale-DX6XiGOO.js} +1 -1
  20. package/dist/assets/diagram-2AECGRRQ-DlfCvqLR.js +43 -0
  21. package/dist/assets/diagram-5GNKFQAL-h5gTsYDo.js +10 -0
  22. package/dist/assets/{diagram-KO2AKTUF-BPalYJed.js → diagram-KO2AKTUF-BbEbRrVo.js} +3 -3
  23. package/dist/assets/diagram-LMA3HP47-jog00Zl2.js +24 -0
  24. package/dist/assets/diagram-OG6HWLK6-B0JVsR6S.js +24 -0
  25. package/dist/assets/{erDiagram-TEJ5UH35-B3OLgtKK.js → erDiagram-TEJ5UH35-DkUnalKg.js} +1 -1
  26. package/dist/assets/{flowDiagram-I6XJVG4X-DdpxVf-5.js → flowDiagram-I6XJVG4X-DewNd_kM.js} +4 -4
  27. package/dist/assets/ganttDiagram-6RSMTGT7-DzDBcVj5.js +292 -0
  28. package/dist/assets/gitGraphDiagram-PVQCEYII-D0CX5WgP.js +106 -0
  29. package/dist/assets/{graph-BEmEBUp_.js → graph-CAnANduQ.js} +1 -1
  30. package/dist/assets/{graph-DnLKqSPg.js → graph-CJVNlri5.js} +2 -2
  31. package/dist/assets/{index-CLb8RFcn.js → index-D4GJb_6L.js} +4 -4
  32. package/dist/assets/infoDiagram-5YYISTIA-B1zzuW9l.js +2 -0
  33. package/dist/assets/{ishikawaDiagram-YF4QCWOH-OyKVgxOz.js → ishikawaDiagram-YF4QCWOH-3hFmuv1F.js} +6 -6
  34. package/dist/assets/{journeyDiagram-JHISSGLW-3FaFyfLR.js → journeyDiagram-JHISSGLW-w9c-l95A.js} +1 -1
  35. package/dist/assets/{kanban-definition-UN3LZRKU-DUPnRo3q.js → kanban-definition-UN3LZRKU-9cL90JL0.js} +7 -7
  36. package/dist/assets/layout-DGIYPm2g.js +1 -0
  37. package/dist/assets/linear-DyDb5wz8.js +1 -0
  38. package/dist/assets/{mindmap-definition-RKZ34NQL-C0CwWNdR.js → mindmap-definition-RKZ34NQL-DBQqsZiD.js} +10 -10
  39. package/dist/assets/{mobile-qvdJ5p0m.js → mobile-CG5tLa2S.js} +1 -1
  40. package/dist/assets/pieDiagram-4H26LBE5-BbIHZku5.js +30 -0
  41. package/dist/assets/{quadrantDiagram-W4KKPZXB-HFtjZSAT.js → quadrantDiagram-W4KKPZXB-DEQSG_lM.js} +1 -1
  42. package/dist/assets/{requirementDiagram-4Y6WPE33-CX_Mz3gv.js → requirementDiagram-4Y6WPE33-BeVnwIwF.js} +3 -3
  43. package/dist/assets/{sankeyDiagram-5OEKKPKP-BR2_eTy9.js → sankeyDiagram-5OEKKPKP-Be-ROw_I.js} +2 -2
  44. package/dist/assets/{sequenceDiagram-3UESZ5HK-CtHp0Qnp.js → sequenceDiagram-3UESZ5HK-E-tnxahu.js} +4 -4
  45. package/dist/assets/stateDiagram-AJRCARHV-3rgFN7hL.js +1 -0
  46. package/dist/assets/stateDiagram-v2-BHNVJYJU-DY_OtnIg.js +1 -0
  47. package/dist/assets/{timeline-definition-PNZ67QCA-GSHqrJ3A.js → timeline-definition-PNZ67QCA-Dcs4QFbE.js} +3 -3
  48. package/dist/assets/vennDiagram-CIIHVFJN-BstUQ900.js +34 -0
  49. package/dist/assets/{wardley-L42UT6IY-Bf-gQIFY.js → wardley-L42UT6IY-CO77hXwj.js} +1 -1
  50. package/dist/assets/{wardleyDiagram-YWT4CUSO-RGxoapr7.js → wardleyDiagram-YWT4CUSO-BvrP3shF.js} +4 -4
  51. package/dist/assets/{xychartDiagram-2RQKCTM6-1_H1qVde.js → xychartDiagram-2RQKCTM6-Btu4JcQO.js} +4 -4
  52. package/dist/index.html +2 -2
  53. package/package.json +1 -1
  54. package/dist/assets/arc-CIeqpX37.js +0 -1
  55. package/dist/assets/channel-DugSMLKi.js +0 -1
  56. package/dist/assets/chunk-2J33WTMH-CF6iSwEb.js +0 -1
  57. package/dist/assets/chunk-55IACEB6-E2hHEsl9.js +0 -1
  58. package/dist/assets/chunk-ND2GUHAM-CDrOVOW5.js +0 -1
  59. package/dist/assets/classDiagram-4FO5ZUOK-D2RRwp7J.js +0 -1
  60. package/dist/assets/classDiagram-v2-Q7XG4LA2-D2RRwp7J.js +0 -1
  61. package/dist/assets/cose-bilkent-S5V4N54A-MHpsrtBZ.js +0 -1
  62. package/dist/assets/dagre-BM42HDAG-DaPz_mPt.js +0 -4
  63. package/dist/assets/diagram-2AECGRRQ-DIdstuOm.js +0 -43
  64. package/dist/assets/diagram-5GNKFQAL-DbkTGVES.js +0 -10
  65. package/dist/assets/diagram-LMA3HP47-vnySSoyd.js +0 -24
  66. package/dist/assets/diagram-OG6HWLK6-Dv3BUJft.js +0 -24
  67. package/dist/assets/ganttDiagram-6RSMTGT7-QALT_Lj9.js +0 -292
  68. package/dist/assets/gitGraphDiagram-PVQCEYII-nITcPPED.js +0 -106
  69. package/dist/assets/infoDiagram-5YYISTIA-CjlRce3x.js +0 -2
  70. package/dist/assets/layout-Bw0msyOw.js +0 -1
  71. package/dist/assets/linear-BeL8i3rv.js +0 -1
  72. package/dist/assets/pieDiagram-4H26LBE5-DaU2jPjX.js +0 -30
  73. package/dist/assets/stateDiagram-AJRCARHV-DmiEmD6G.js +0 -1
  74. package/dist/assets/stateDiagram-v2-BHNVJYJU-7rdO1Tgp.js +0 -1
  75. package/dist/assets/vennDiagram-CIIHVFJN-CNxhQnCU.js +0 -34
@@ -0,0 +1 @@
1
+ import{a0 as ln,a1 as an,a2 as H,a3 as q,a4 as B,a5 as un,a6 as y,a7 as tn,a8 as L,a9 as _,aa as rn,ab as o,ac as on,ad as sn,ae as fn}from"./App-QGVt8tH2.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,C,a){var O=I-l,i=D-h,n=C-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function W(l,h,I,D,v,A,C){var a=l-I,O=h-D,i=(C?A:-A)/L(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,F=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*L(on(0,T*T*R-P*P)),j=(P*g-m*S)/R,z=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=j-F,e=z-t,r=w-F,G=p-t;return x*x+e*e>r*r+G*G&&(j=w,z=p),{cx:j,cy:z,x01:-n,y01:-d,x11:j*(v/T-1),y11:z*(v/T-1)}}function hn(){var l=cn,h=yn,I=B(0),D=null,v=gn,A=dn,C=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,F=rn(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(F>tn-y)a.moveTo(s*H(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*H(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=F,S=F,j=C.apply(this,arguments)/2,z=j>y&&(D?+D.apply(this,arguments):L(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(z>y){var G=sn(z/u*q(j)),M=sn(z/s*q(j));(P-=G*2)>y?(G*=t?1:-1,R+=G,T-=G):(P=0,R=T=(f+c)/2),(S-=M*2)>y?(M*=t?1:-1,m+=M,g-=M):(S=0,m=g=(f+c)/2)}var J=s*H(m),K=s*q(m),N=u*H(T),Q=u*q(T);if(w>y){var U=s*H(g),V=s*q(g),X=u*H(R),Y=u*q(R),E;if(F<an)if(E=pn(J,K,X,Y,U,V,N,Q)){var Z=J-E[0],$=K-E[1],b=U-E[0],k=V-E[1],nn=1/q(fn((Z*b+$*k)/(L(Z*Z+$*$)*L(b*b+k*k)))/2),en=L(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=W(X,Y,J,K,s,x,t),r=W(U,V,N,Q,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(J,K),a.arc(0,0,s,m,g,!t)):a.moveTo(J,K),!(u>y)||!(P>y)?a.lineTo(N,Q):p>y?(e=W(N,Q,U,V,u,-p,t),r=W(J,K,X,Y,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[H(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:B(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:B(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:B(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:B(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:B(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:B(+n),i):A},i.padAngle=function(n){return arguments.length?(C=typeof n=="function"?n:B(+n),i):C},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
@@ -1,4 +1,4 @@
1
- import{b as f,a$ as ht,b6 as gt,aE as K,b1 as ut,a3 as pt,b3 as mt,a6 as yt,a2 as wt,b0 as kt,t as xt,s as bt,a4 as vt,T as $t,a5 as J,K as Z,a9 as N,aZ as Et,a_ as St,a7 as Tt,aU as Dt,bi as At}from"./App-VU2lfA8m.js";import{p as Ct}from"./chunk-4BX2VUAB-BTe-QE0R.js";import{p as Bt}from"./wardley-L42UT6IY-Bf-gQIFY.js";import{a as tt,f as It}from"./graph-DnLKqSPg.js";import"./mobile-qvdJ5p0m.js";import"./index-CLb8RFcn.js";var W={L:"left",R:"right",T:"top",B:"bottom"},U={L:f(e=>`${e},${e/2} 0,${e} 0,0`,"L"),R:f(e=>`0,${e/2} ${e},0 ${e},${e}`,"R"),T:f(e=>`0,0 ${e},0 ${e/2},${e}`,"T"),B:f(e=>`${e/2},0 ${e},${e} 0,${e}`,"B")},Y={L:f((e,t)=>e-t+2,"L"),R:f((e,t)=>e-2,"R"),T:f((e,t)=>e-t+2,"T"),B:f((e,t)=>e-2,"B")},Lt=f(function(e){return D(e)?e==="L"?"R":"L":e==="T"?"B":"T"},"getOppositeArchitectureDirection"),Q=f(function(e){const t=e;return t==="L"||t==="R"||t==="T"||t==="B"},"isArchitectureDirection"),D=f(function(e){const t=e;return t==="L"||t==="R"},"isArchitectureDirectionX"),z=f(function(e){const t=e;return t==="T"||t==="B"},"isArchitectureDirectionY"),V=f(function(e,t){const i=D(e)&&z(t),r=z(e)&&D(t);return i||r},"isArchitectureDirectionXY"),jt=f(function(e){const t=e[0],i=e[1],r=D(t)&&z(i),n=z(t)&&D(i);return r||n},"isArchitecturePairXY"),zt=f(function(e){return e!=="LL"&&e!=="RR"&&e!=="TT"&&e!=="BB"},"isValidArchitectureDirectionPair"),_=f(function(e,t){const i=`${e}${t}`;return zt(i)?i:void 0},"getArchitectureDirectionPair"),Ft=f(function([e,t],i){const r=i[0],n=i[1];return D(r)?z(n)?[e+(r==="L"?-1:1),t+(n==="T"?1:-1)]:[e+(r==="L"?-1:1),t]:D(n)?[e+(n==="L"?1:-1),t+(r==="T"?1:-1)]:[e,t+(r==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Pt=f(function(e){return e==="LT"||e==="TL"?[1,1]:e==="BL"||e==="LB"?[1,-1]:e==="BR"||e==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Rt=f(function(e,t){return V(e,t)?"bend":D(e)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Xt=f(function(e){return e.type==="service"},"isArchitectureService"),Yt=f(function(e){return e.type==="junction"},"isArchitectureJunction"),et=f(e=>e.data(),"edgeData"),P=f(e=>e.data(),"nodeData"),Ot=$t.architecture,R,it=(R=class{constructor(){this.nodes={},this.groups={},this.edges=[],this.registeredIds={},this.elements={},this.diagramId="",this.setAccTitle=ut,this.getAccTitle=pt,this.setDiagramTitle=mt,this.getDiagramTitle=yt,this.getAccDescription=wt,this.setAccDescription=kt,this.clear()}setDiagramId(t){this.diagramId=t}getDiagramId(){return this.diagramId}clear(){this.nodes={},this.groups={},this.edges=[],this.registeredIds={},this.dataStructures=void 0,this.elements={},this.diagramId="",xt()}addService({id:t,icon:i,in:r,title:n,iconText:c}){if(this.registeredIds[t]!==void 0)throw new Error(`The service id [${t}] is already in use by another ${this.registeredIds[t]}`);if(r!==void 0){if(t===r)throw new Error(`The service [${t}] cannot be placed within itself`);if(this.registeredIds[r]===void 0)throw new Error(`The service [${t}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds[r]==="node")throw new Error(`The service [${t}]'s parent is not a group`)}this.registeredIds[t]="node",this.nodes[t]={id:t,type:"service",icon:i,iconText:c,title:n,edges:[],in:r}}getServices(){return Object.values(this.nodes).filter(Xt)}addJunction({id:t,in:i}){if(this.registeredIds[t]!==void 0)throw new Error(`The junction id [${t}] is already in use by another ${this.registeredIds[t]}`);if(i!==void 0){if(t===i)throw new Error(`The junction [${t}] cannot be placed within itself`);if(this.registeredIds[i]===void 0)throw new Error(`The junction [${t}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds[i]==="node")throw new Error(`The junction [${t}]'s parent is not a group`)}this.registeredIds[t]="node",this.nodes[t]={id:t,type:"junction",edges:[],in:i}}getJunctions(){return Object.values(this.nodes).filter(Yt)}getNodes(){return Object.values(this.nodes)}getNode(t){return this.nodes[t]??null}addGroup({id:t,icon:i,in:r,title:n}){var c,u,d;if(((c=this.registeredIds)==null?void 0:c[t])!==void 0)throw new Error(`The group id [${t}] is already in use by another ${this.registeredIds[t]}`);if(r!==void 0){if(t===r)throw new Error(`The group [${t}] cannot be placed within itself`);if(((u=this.registeredIds)==null?void 0:u[r])===void 0)throw new Error(`The group [${t}]'s parent does not exist. Please make sure the parent is created before this group`);if(((d=this.registeredIds)==null?void 0:d[r])==="node")throw new Error(`The group [${t}]'s parent is not a group`)}this.registeredIds[t]="group",this.groups[t]={id:t,icon:i,title:n,in:r}}getGroups(){return Object.values(this.groups)}addEdge({lhsId:t,rhsId:i,lhsDir:r,rhsDir:n,lhsInto:c,rhsInto:u,lhsGroup:d,rhsGroup:l,title:s}){if(!Q(r))throw new Error(`Invalid direction given for left hand side of edge ${t}--${i}. Expected (L,R,T,B) got ${String(r)}`);if(!Q(n))throw new Error(`Invalid direction given for right hand side of edge ${t}--${i}. Expected (L,R,T,B) got ${String(n)}`);if(this.nodes[t]===void 0&&this.groups[t]===void 0)throw new Error(`The left-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(this.nodes[i]===void 0&&this.groups[i]===void 0)throw new Error(`The right-hand id [${i}] does not yet exist. Please create the service/group before declaring an edge to it.`);const o=this.nodes[t].in,a=this.nodes[i].in;if(d&&o&&a&&o==a)throw new Error(`The left-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(l&&o&&a&&o==a)throw new Error(`The right-hand id [${i}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const g={lhsId:t,lhsDir:r,lhsInto:c,lhsGroup:d,rhsId:i,rhsDir:n,rhsInto:u,rhsGroup:l,title:s};this.edges.push(g),this.nodes[t]&&this.nodes[i]&&(this.nodes[t].edges.push(this.edges[this.edges.length-1]),this.nodes[i].edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}getDataStructures(){if(this.dataStructures===void 0){const t={},i=Object.entries(this.nodes).reduce((l,[s,o])=>(l[s]=o.edges.reduce((a,g)=>{var p,k;const h=(p=this.getNode(g.lhsId))==null?void 0:p.in,y=(k=this.getNode(g.rhsId))==null?void 0:k.in;if(h&&y&&h!==y){const w=Rt(g.lhsDir,g.rhsDir);w!=="bend"&&(t[h]??(t[h]={}),t[h][y]=w,t[y]??(t[y]={}),t[y][h]=w)}if(g.lhsId===s){const w=_(g.lhsDir,g.rhsDir);w&&(a[w]=g.rhsId)}else{const w=_(g.rhsDir,g.lhsDir);w&&(a[w]=g.lhsId)}return a},{}),l),{}),r=Object.keys(i)[0],n={[r]:1},c=Object.keys(i).reduce((l,s)=>s===r?l:{...l,[s]:1},{}),u=f(l=>{const s={[l]:[0,0]},o=[l];for(;o.length>0;){const a=o.shift();if(a){n[a]=1,delete c[a];const g=i[a],[h,y]=s[a];Object.entries(g).forEach(([p,k])=>{n[k]||(s[k]=Ft([h,y],p),o.push(k))})}}return s},"BFS"),d=[u(r)];for(;Object.keys(c).length>0;)d.push(u(Object.keys(c)[0]));this.dataStructures={adjList:i,spatialMaps:d,groupAlignments:t}}return this.dataStructures}setElementForId(t,i){this.elements[t]=i}getElementById(t){return this.elements[t]}getConfig(){return bt({...Ot,...vt().architecture})}getConfigField(t){return this.getConfig()[t]}},f(R,"ArchitectureDB"),R),Mt=f((e,t)=>{Ct(e,t),e.groups.map(i=>t.addGroup(i)),e.services.map(i=>t.addService({...i,type:"service"})),e.junctions.map(i=>t.addJunction({...i,type:"junction"})),e.edges.map(i=>t.addEdge(i))},"populateDb"),rt={parser:{yy:void 0},parse:f(async e=>{var r;const t=await Bt("architecture",e);K.debug(t);const i=(r=rt.parser)==null?void 0:r.yy;if(!(i instanceof it))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Mt(t,i)},"parse")},Gt=f(e=>`
1
+ import{_ as f,I as ht,Y as gt,l as K,b as ut,a as pt,p as mt,q as yt,g as wt,s as kt,z as xt,F as bt,D as vt,G as $t,c as J,ak as Z,al as N,i as Et,d as St,x as Dt,am as Tt,an as At}from"./App-QGVt8tH2.js";import{p as Ct}from"./chunk-4BX2VUAB-BkfYx42O.js";import{p as Bt}from"./wardley-L42UT6IY-CO77hXwj.js";import{c as tt,f as It}from"./graph-CJVNlri5.js";import"./mobile-CG5tLa2S.js";import"./index-D4GJb_6L.js";var W={L:"left",R:"right",T:"top",B:"bottom"},Q={L:f(e=>`${e},${e/2} 0,${e} 0,0`,"L"),R:f(e=>`0,${e/2} ${e},0 ${e},${e}`,"R"),T:f(e=>`0,0 ${e},0 ${e/2},${e}`,"T"),B:f(e=>`${e/2},0 ${e},${e} 0,${e}`,"B")},X={L:f((e,t)=>e-t+2,"L"),R:f((e,t)=>e-2,"R"),T:f((e,t)=>e-t+2,"T"),B:f((e,t)=>e-2,"B")},Lt=f(function(e){return T(e)?e==="L"?"R":"L":e==="T"?"B":"T"},"getOppositeArchitectureDirection"),U=f(function(e){const t=e;return t==="L"||t==="R"||t==="T"||t==="B"},"isArchitectureDirection"),T=f(function(e){const t=e;return t==="L"||t==="R"},"isArchitectureDirectionX"),z=f(function(e){const t=e;return t==="T"||t==="B"},"isArchitectureDirectionY"),V=f(function(e,t){const i=T(e)&&z(t),r=z(e)&&T(t);return i||r},"isArchitectureDirectionXY"),jt=f(function(e){const t=e[0],i=e[1],r=T(t)&&z(i),n=z(t)&&T(i);return r||n},"isArchitecturePairXY"),zt=f(function(e){return e!=="LL"&&e!=="RR"&&e!=="TT"&&e!=="BB"},"isValidArchitectureDirectionPair"),_=f(function(e,t){const i=`${e}${t}`;return zt(i)?i:void 0},"getArchitectureDirectionPair"),Ft=f(function([e,t],i){const r=i[0],n=i[1];return T(r)?z(n)?[e+(r==="L"?-1:1),t+(n==="T"?1:-1)]:[e+(r==="L"?-1:1),t]:T(n)?[e+(n==="L"?1:-1),t+(r==="T"?1:-1)]:[e,t+(r==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Pt=f(function(e){return e==="LT"||e==="TL"?[1,1]:e==="BL"||e==="LB"?[1,-1]:e==="BR"||e==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Yt=f(function(e,t){return V(e,t)?"bend":T(e)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Rt=f(function(e){return e.type==="service"},"isArchitectureService"),Xt=f(function(e){return e.type==="junction"},"isArchitectureJunction"),et=f(e=>e.data(),"edgeData"),P=f(e=>e.data(),"nodeData"),Ot=$t.architecture,Y,it=(Y=class{constructor(){this.nodes={},this.groups={},this.edges=[],this.registeredIds={},this.elements={},this.diagramId="",this.setAccTitle=ut,this.getAccTitle=pt,this.setDiagramTitle=mt,this.getDiagramTitle=yt,this.getAccDescription=wt,this.setAccDescription=kt,this.clear()}setDiagramId(t){this.diagramId=t}getDiagramId(){return this.diagramId}clear(){this.nodes={},this.groups={},this.edges=[],this.registeredIds={},this.dataStructures=void 0,this.elements={},this.diagramId="",xt()}addService({id:t,icon:i,in:r,title:n,iconText:c}){if(this.registeredIds[t]!==void 0)throw new Error(`The service id [${t}] is already in use by another ${this.registeredIds[t]}`);if(r!==void 0){if(t===r)throw new Error(`The service [${t}] cannot be placed within itself`);if(this.registeredIds[r]===void 0)throw new Error(`The service [${t}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds[r]==="node")throw new Error(`The service [${t}]'s parent is not a group`)}this.registeredIds[t]="node",this.nodes[t]={id:t,type:"service",icon:i,iconText:c,title:n,edges:[],in:r}}getServices(){return Object.values(this.nodes).filter(Rt)}addJunction({id:t,in:i}){if(this.registeredIds[t]!==void 0)throw new Error(`The junction id [${t}] is already in use by another ${this.registeredIds[t]}`);if(i!==void 0){if(t===i)throw new Error(`The junction [${t}] cannot be placed within itself`);if(this.registeredIds[i]===void 0)throw new Error(`The junction [${t}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds[i]==="node")throw new Error(`The junction [${t}]'s parent is not a group`)}this.registeredIds[t]="node",this.nodes[t]={id:t,type:"junction",edges:[],in:i}}getJunctions(){return Object.values(this.nodes).filter(Xt)}getNodes(){return Object.values(this.nodes)}getNode(t){return this.nodes[t]??null}addGroup({id:t,icon:i,in:r,title:n}){var c,u,d;if(((c=this.registeredIds)==null?void 0:c[t])!==void 0)throw new Error(`The group id [${t}] is already in use by another ${this.registeredIds[t]}`);if(r!==void 0){if(t===r)throw new Error(`The group [${t}] cannot be placed within itself`);if(((u=this.registeredIds)==null?void 0:u[r])===void 0)throw new Error(`The group [${t}]'s parent does not exist. Please make sure the parent is created before this group`);if(((d=this.registeredIds)==null?void 0:d[r])==="node")throw new Error(`The group [${t}]'s parent is not a group`)}this.registeredIds[t]="group",this.groups[t]={id:t,icon:i,title:n,in:r}}getGroups(){return Object.values(this.groups)}addEdge({lhsId:t,rhsId:i,lhsDir:r,rhsDir:n,lhsInto:c,rhsInto:u,lhsGroup:d,rhsGroup:l,title:s}){if(!U(r))throw new Error(`Invalid direction given for left hand side of edge ${t}--${i}. Expected (L,R,T,B) got ${String(r)}`);if(!U(n))throw new Error(`Invalid direction given for right hand side of edge ${t}--${i}. Expected (L,R,T,B) got ${String(n)}`);if(this.nodes[t]===void 0&&this.groups[t]===void 0)throw new Error(`The left-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(this.nodes[i]===void 0&&this.groups[i]===void 0)throw new Error(`The right-hand id [${i}] does not yet exist. Please create the service/group before declaring an edge to it.`);const o=this.nodes[t].in,a=this.nodes[i].in;if(d&&o&&a&&o==a)throw new Error(`The left-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(l&&o&&a&&o==a)throw new Error(`The right-hand id [${i}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const g={lhsId:t,lhsDir:r,lhsInto:c,lhsGroup:d,rhsId:i,rhsDir:n,rhsInto:u,rhsGroup:l,title:s};this.edges.push(g),this.nodes[t]&&this.nodes[i]&&(this.nodes[t].edges.push(this.edges[this.edges.length-1]),this.nodes[i].edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}getDataStructures(){if(this.dataStructures===void 0){const t={},i=Object.entries(this.nodes).reduce((l,[s,o])=>(l[s]=o.edges.reduce((a,g)=>{var p,k;const h=(p=this.getNode(g.lhsId))==null?void 0:p.in,y=(k=this.getNode(g.rhsId))==null?void 0:k.in;if(h&&y&&h!==y){const w=Yt(g.lhsDir,g.rhsDir);w!=="bend"&&(t[h]??(t[h]={}),t[h][y]=w,t[y]??(t[y]={}),t[y][h]=w)}if(g.lhsId===s){const w=_(g.lhsDir,g.rhsDir);w&&(a[w]=g.rhsId)}else{const w=_(g.rhsDir,g.lhsDir);w&&(a[w]=g.lhsId)}return a},{}),l),{}),r=Object.keys(i)[0],n={[r]:1},c=Object.keys(i).reduce((l,s)=>s===r?l:{...l,[s]:1},{}),u=f(l=>{const s={[l]:[0,0]},o=[l];for(;o.length>0;){const a=o.shift();if(a){n[a]=1,delete c[a];const g=i[a],[h,y]=s[a];Object.entries(g).forEach(([p,k])=>{n[k]||(s[k]=Ft([h,y],p),o.push(k))})}}return s},"BFS"),d=[u(r)];for(;Object.keys(c).length>0;)d.push(u(Object.keys(c)[0]));this.dataStructures={adjList:i,spatialMaps:d,groupAlignments:t}}return this.dataStructures}setElementForId(t,i){this.elements[t]=i}getElementById(t){return this.elements[t]}getConfig(){return bt({...Ot,...vt().architecture})}getConfigField(t){return this.getConfig()[t]}},f(Y,"ArchitectureDB"),Y),Mt=f((e,t)=>{Ct(e,t),e.groups.map(i=>t.addGroup(i)),e.services.map(i=>t.addService({...i,type:"service"})),e.junctions.map(i=>t.addJunction({...i,type:"junction"})),e.edges.map(i=>t.addEdge(i))},"populateDb"),rt={parser:{yy:void 0},parse:f(async e=>{var r;const t=await Bt("architecture",e);K.debug(t);const i=(r=rt.parser)==null?void 0:r.yy;if(!(i instanceof it))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Mt(t,i)},"parse")},Gt=f(e=>`
2
2
  .edge {
3
3
  stroke-width: ${e.archEdgeWidth};
4
4
  stroke: ${e.archEdgeColor};
@@ -29,8 +29,8 @@ import{b as f,a$ as ht,b6 as gt,aE as K,b1 as ut,a3 as pt,b3 as mt,a6 as yt,a2 a
29
29
  display: -webkit-box;
30
30
  -webkit-box-orient: vertical;
31
31
  }
32
- `,"getStyles"),Nt=Gt,F=f(e=>`<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/>${e}</g>`,"wrapIcon"),X={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:F('<path id="b" data-name="4" d="m20,57.86c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="c" data-name="3" d="m20,45.95c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="d" data-name="2" d="m20,34.05c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse id="e" data-name="1" cx="40" cy="22.14" rx="20" ry="7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="20" y1="57.86" x2="20" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="60" y1="57.86" x2="60" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},server:{body:F('<rect x="17.5" y="17.5" width="45" height="45" rx="2" ry="2" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="32.5" x2="62.5" y2="32.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="47.5" x2="62.5" y2="47.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><g><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g>')},disk:{body:F('<rect x="20" y="15" width="40" height="50" rx="1" ry="1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="14" ry="14.58" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="4" ry="4.17" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m37.51,42.52l-4.83,13.22c-.26.71-1.1,1.02-1.76.64l-4.18-2.42c-.66-.38-.81-1.26-.33-1.84l9.01-10.8c.88-1.05,2.56-.08,2.09,1.2Z" style="fill: #fff; stroke-width: 0px;"/>')},internet:{body:F('<circle cx="40" cy="40" r="22.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="40" y1="17.5" x2="40" y2="62.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="40" x2="62.5" y2="40" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m39.99,17.51c-15.28,11.1-15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m40.01,17.51c15.28,11.1,15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="30.1" x2="60.25" y2="30.1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="49.9" x2="60.25" y2="49.9" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},cloud:{body:F('<path d="m65,47.5c0,2.76-2.24,5-5,5H20c-2.76,0-5-2.24-5-5,0-1.87,1.03-3.51,2.56-4.36-.04-.21-.06-.42-.06-.64,0-2.6,2.48-4.74,5.65-4.97,1.65-4.51,6.34-7.76,11.85-7.76.86,0,1.69.08,2.5.23,2.09-1.57,4.69-2.5,7.5-2.5,6.1,0,11.19,4.38,12.28,10.17,2.14.56,3.72,2.51,3.72,4.83,0,.03,0,.07-.01.1,2.29.46,4.01,2.48,4.01,4.9Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},unknown:At,blank:{body:F("")}}},_t=f(async function(e,t,i,r){const n=i.getConfigField("padding"),c=i.getConfigField("iconSize"),u=c/2,d=c/6,l=d/2;await Promise.all(t.edges().map(async s=>{var A,j;const{source:o,sourceDir:a,sourceArrow:g,sourceGroup:h,target:y,targetDir:p,targetArrow:k,targetGroup:w,label:$}=et(s);let{x:m,y:b}=s[0].sourceEndpoint();const{x:E,y:B}=s[0].midpoint();let{x:v,y:S}=s[0].targetEndpoint();const x=n+4;if(h&&(D(a)?m+=a==="L"?-x:x:b+=a==="T"?-x:x+18),w&&(D(p)?v+=p==="L"?-x:x:S+=p==="T"?-x:x+18),!h&&((A=i.getNode(o))==null?void 0:A.type)==="junction"&&(D(a)?m+=a==="L"?u:-u:b+=a==="T"?u:-u),!w&&((j=i.getNode(y))==null?void 0:j.type)==="junction"&&(D(p)?v+=p==="L"?u:-u:S+=p==="T"?u:-u),s[0]._private.rscratch){const L=e.insert("g");if(L.insert("path").attr("d",`M ${m},${b} L ${E},${B} L${v},${S} `).attr("class","edge").attr("id",`${r}-${Tt(o,y,{prefix:"L"})}`),g){const I=D(a)?Y[a](m,d):m-l,T=z(a)?Y[a](b,d):b-l;L.insert("polygon").attr("points",U[a](d)).attr("transform",`translate(${I},${T})`).attr("class","arrow")}if(k){const I=D(p)?Y[p](v,d):v-l,T=z(p)?Y[p](S,d):S-l;L.insert("polygon").attr("points",U[p](d)).attr("transform",`translate(${I},${T})`).attr("class","arrow")}if($){const I=V(a,p)?"XY":D(a)?"X":"Y";let T=0;I==="X"?T=Math.abs(m-v):I==="Y"?T=Math.abs(b-S)/1.5:T=Math.abs(m-v)/2;const C=L.append("g");if(await Z(C,$,{useHtmlLabels:!1,width:T,classes:"architecture-service-label"},J()),C.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),I==="X")C.attr("transform","translate("+E+", "+B+")");else if(I==="Y")C.attr("transform","translate("+E+", "+B+") rotate(-90)");else if(I==="XY"){const O=_(a,p);if(O&&jt(O)){const q=C.node().getBoundingClientRect(),[M,G]=Pt(O);C.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*M*G*45})`);const H=C.node().getBoundingClientRect();C.attr("transform",`
32
+ `,"getStyles"),Nt=Gt,F=f(e=>`<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/>${e}</g>`,"wrapIcon"),R={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:F('<path id="b" data-name="4" d="m20,57.86c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="c" data-name="3" d="m20,45.95c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="d" data-name="2" d="m20,34.05c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse id="e" data-name="1" cx="40" cy="22.14" rx="20" ry="7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="20" y1="57.86" x2="20" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="60" y1="57.86" x2="60" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},server:{body:F('<rect x="17.5" y="17.5" width="45" height="45" rx="2" ry="2" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="32.5" x2="62.5" y2="32.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="47.5" x2="62.5" y2="47.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><g><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g>')},disk:{body:F('<rect x="20" y="15" width="40" height="50" rx="1" ry="1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="14" ry="14.58" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="4" ry="4.17" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m37.51,42.52l-4.83,13.22c-.26.71-1.1,1.02-1.76.64l-4.18-2.42c-.66-.38-.81-1.26-.33-1.84l9.01-10.8c.88-1.05,2.56-.08,2.09,1.2Z" style="fill: #fff; stroke-width: 0px;"/>')},internet:{body:F('<circle cx="40" cy="40" r="22.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="40" y1="17.5" x2="40" y2="62.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="40" x2="62.5" y2="40" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m39.99,17.51c-15.28,11.1-15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m40.01,17.51c15.28,11.1,15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="30.1" x2="60.25" y2="30.1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="49.9" x2="60.25" y2="49.9" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},cloud:{body:F('<path d="m65,47.5c0,2.76-2.24,5-5,5H20c-2.76,0-5-2.24-5-5,0-1.87,1.03-3.51,2.56-4.36-.04-.21-.06-.42-.06-.64,0-2.6,2.48-4.74,5.65-4.97,1.65-4.51,6.34-7.76,11.85-7.76.86,0,1.69.08,2.5.23,2.09-1.57,4.69-2.5,7.5-2.5,6.1,0,11.19,4.38,12.28,10.17,2.14.56,3.72,2.51,3.72,4.83,0,.03,0,.07-.01.1,2.29.46,4.01,2.48,4.01,4.9Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},unknown:At,blank:{body:F("")}}},_t=f(async function(e,t,i,r){const n=i.getConfigField("padding"),c=i.getConfigField("iconSize"),u=c/2,d=c/6,l=d/2;await Promise.all(t.edges().map(async s=>{var A,j;const{source:o,sourceDir:a,sourceArrow:g,sourceGroup:h,target:y,targetDir:p,targetArrow:k,targetGroup:w,label:$}=et(s);let{x:m,y:b}=s[0].sourceEndpoint();const{x:E,y:B}=s[0].midpoint();let{x:v,y:S}=s[0].targetEndpoint();const x=n+4;if(h&&(T(a)?m+=a==="L"?-x:x:b+=a==="T"?-x:x+18),w&&(T(p)?v+=p==="L"?-x:x:S+=p==="T"?-x:x+18),!h&&((A=i.getNode(o))==null?void 0:A.type)==="junction"&&(T(a)?m+=a==="L"?u:-u:b+=a==="T"?u:-u),!w&&((j=i.getNode(y))==null?void 0:j.type)==="junction"&&(T(p)?v+=p==="L"?u:-u:S+=p==="T"?u:-u),s[0]._private.rscratch){const L=e.insert("g");if(L.insert("path").attr("d",`M ${m},${b} L ${E},${B} L${v},${S} `).attr("class","edge").attr("id",`${r}-${Dt(o,y,{prefix:"L"})}`),g){const I=T(a)?X[a](m,d):m-l,D=z(a)?X[a](b,d):b-l;L.insert("polygon").attr("points",Q[a](d)).attr("transform",`translate(${I},${D})`).attr("class","arrow")}if(k){const I=T(p)?X[p](v,d):v-l,D=z(p)?X[p](S,d):S-l;L.insert("polygon").attr("points",Q[p](d)).attr("transform",`translate(${I},${D})`).attr("class","arrow")}if($){const I=V(a,p)?"XY":T(a)?"X":"Y";let D=0;I==="X"?D=Math.abs(m-v):I==="Y"?D=Math.abs(b-S)/1.5:D=Math.abs(m-v)/2;const C=L.append("g");if(await Z(C,$,{useHtmlLabels:!1,width:D,classes:"architecture-service-label"},J()),C.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),I==="X")C.attr("transform","translate("+E+", "+B+")");else if(I==="Y")C.attr("transform","translate("+E+", "+B+") rotate(-90)");else if(I==="XY"){const O=_(a,p);if(O&&jt(O)){const q=C.node().getBoundingClientRect(),[M,G]=Pt(O);C.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*M*G*45})`);const H=C.node().getBoundingClientRect();C.attr("transform",`
33
33
  translate(${E}, ${B-q.height/2})
34
34
  translate(${M*H.width/2}, ${G*H.height/2})
35
35
  rotate(${-1*M*G*45}, 0, ${q.height/2})
36
- `)}}}}}))},"drawEdges"),Jt=f(async function(e,t,i,r){const c=i.getConfigField("padding")*.75,u=i.getConfigField("fontSize"),l=i.getConfigField("iconSize")/2;await Promise.all(t.nodes().map(async s=>{const o=P(s);if(o.type==="group"){const{h:a,w:g,x1:h,y1:y}=s.boundingBox(),p=e.append("rect");p.attr("id",`${r}-group-${o.id}`).attr("x",h+l).attr("y",y+l).attr("width",g).attr("height",a).attr("class","node-bkg");const k=e.append("g");let w=h,$=y;if(o.icon){const m=k.append("g");m.html(`<g>${await N(o.icon,{height:c,width:c,fallbackPrefix:X.prefix})}</g>`),m.attr("transform","translate("+(w+l+1)+", "+($+l+1)+")"),w+=c,$+=u/2-1-2}if(o.label){const m=k.append("g");await Z(m,o.label,{useHtmlLabels:!1,width:g,classes:"architecture-service-label"},J()),m.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),m.attr("transform","translate("+(w+l+4)+", "+($+l+2)+")")}i.setElementForId(o.id,p)}}))},"drawGroups"),Zt=f(async function(e,t,i,r){const n=J();for(const c of i){const u=t.append("g"),d=e.getConfigField("iconSize");if(c.title){const a=u.append("g");await Z(a,c.title,{useHtmlLabels:!1,width:d*1.5,classes:"architecture-service-label"},n),a.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),a.attr("transform","translate("+d/2+", "+d+")")}const l=u.append("g");if(c.icon)l.html(`<g>${await N(c.icon,{height:d,width:d,fallbackPrefix:X.prefix})}</g>`);else if(c.iconText){l.html(`<g>${await N("blank",{height:d,width:d,fallbackPrefix:X.prefix})}</g>`);const h=l.append("g").append("foreignObject").attr("width",d).attr("height",d).append("div").attr("class","node-icon-text").attr("style",`height: ${d}px;`).append("div").html(Et(c.iconText,n)),y=parseInt(window.getComputedStyle(h.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;h.attr("style",`-webkit-line-clamp: ${Math.floor((d-2)/y)};`)}else l.append("path").attr("class","node-bkg").attr("id",`${r}-node-${c.id}`).attr("d",`M0,${d} V5 Q0,0 5,0 H${d-5} Q${d},0 ${d},5 V${d} Z`);u.attr("id",`${r}-service-${c.id}`).attr("class","architecture-service");const{width:s,height:o}=u.node().getBBox();c.width=s,c.height=o,e.setElementForId(c.id,u)}return 0},"drawServices"),Vt=f(function(e,t,i,r){i.forEach(n=>{const c=t.append("g"),u=e.getConfigField("iconSize");c.append("g").append("rect").attr("id",`${r}-node-${n.id}`).attr("fill-opacity","0").attr("width",u).attr("height",u),c.attr("class","architecture-junction");const{width:l,height:s}=c._groups[0][0].getBBox();c.width=l,c.height=s,e.setElementForId(n.id,c)})},"drawJunctions");Dt([{name:X.prefix,icons:X}]);tt.use(It);function st(e,t,i){e.forEach(r=>{t.add({group:"nodes",data:{type:"service",id:r.id,icon:r.icon,label:r.title,parent:r.in,width:i.getConfigField("iconSize"),height:i.getConfigField("iconSize")},classes:"node-service"})})}f(st,"addServices");function ot(e,t,i){e.forEach(r=>{t.add({group:"nodes",data:{type:"junction",id:r.id,parent:r.in,width:i.getConfigField("iconSize"),height:i.getConfigField("iconSize")},classes:"node-junction"})})}f(ot,"addJunctions");function nt(e,t){t.nodes().map(i=>{const r=P(i);if(r.type==="group")return;r.x=i.position().x,r.y=i.position().y,e.getElementById(r.id).attr("transform","translate("+(r.x||0)+","+(r.y||0)+")")})}f(nt,"positionNodes");function at(e,t){e.forEach(i=>{t.add({group:"nodes",data:{type:"group",id:i.id,icon:i.icon,label:i.title,parent:i.in},classes:"node-group"})})}f(at,"addGroups");function ct(e,t){e.forEach(i=>{const{lhsId:r,rhsId:n,lhsInto:c,lhsGroup:u,rhsInto:d,lhsDir:l,rhsDir:s,rhsGroup:o,title:a}=i,g=V(i.lhsDir,i.rhsDir)?"segments":"straight",h={id:`${r}-${n}`,label:a,source:r,sourceDir:l,sourceArrow:c,sourceGroup:u,sourceEndpoint:l==="L"?"0 50%":l==="R"?"100% 50%":l==="T"?"50% 0":"50% 100%",target:n,targetDir:s,targetArrow:d,targetGroup:o,targetEndpoint:s==="L"?"0 50%":s==="R"?"100% 50%":s==="T"?"50% 0":"50% 100%"};t.add({group:"edges",data:h,classes:g})})}f(ct,"addEdges");function lt(e,t,i){const r=f((d,l)=>Object.entries(d).reduce((s,[o,a])=>{var y;let g=0;const h=Object.entries(a);if(h.length===1)return s[o]=h[0][1],s;for(let p=0;p<h.length-1;p++)for(let k=p+1;k<h.length;k++){const[w,$]=h[p],[m,b]=h[k];if(((y=i[w])==null?void 0:y[m])===l)s[o]??(s[o]=[]),s[o]=[...s[o],...$,...b];else if(w==="default"||m==="default")s[o]??(s[o]=[]),s[o]=[...s[o],...$,...b];else{const B=`${o}-${g++}`;s[B]=$;const v=`${o}-${g++}`;s[v]=b}}return s},{}),"flattenAlignments"),n=t.map(d=>{const l={},s={};return Object.entries(d).forEach(([o,[a,g]])=>{var y,p,k;const h=((y=e.getNode(o))==null?void 0:y.in)??"default";l[g]??(l[g]={}),(p=l[g])[h]??(p[h]=[]),l[g][h].push(o),s[a]??(s[a]={}),(k=s[a])[h]??(k[h]=[]),s[a][h].push(o)}),{horiz:Object.values(r(l,"horizontal")).filter(o=>o.length>1),vert:Object.values(r(s,"vertical")).filter(o=>o.length>1)}}),[c,u]=n.reduce(([d,l],{horiz:s,vert:o})=>[[...d,...s],[...l,...o]],[[],[]]);return{horizontal:c,vertical:u}}f(lt,"getAlignments");function dt(e,t){const i=[],r=f(c=>`${c[0]},${c[1]}`,"posToStr"),n=f(c=>c.split(",").map(u=>parseInt(u)),"strToPos");return e.forEach(c=>{const u=Object.fromEntries(Object.entries(c).map(([o,a])=>[r(a),o])),d=[r([0,0])],l={},s={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;d.length>0;){const o=d.shift();if(o){l[o]=1;const a=u[o];if(a){const g=n(o);Object.entries(s).forEach(([h,y])=>{const p=r([g[0]+y[0],g[1]+y[1]]),k=u[p];k&&!l[p]&&(d.push(p),i.push({[W[h]]:k,[W[Lt(h)]]:a,gap:1.5*t.getConfigField("iconSize")}))})}}}}),i}f(dt,"getRelativeConstraints");function ft(e,t,i,r,n,{spatialMaps:c,groupAlignments:u}){return new Promise(d=>{const l=St("body").append("div").attr("id","cy").attr("style","display:none"),s=tt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge[label]",style:{label:"data(label)"}},{selector:"edge.segments",style:{"curve-style":"segments","segment-weights":"0","segment-distances":[.5],"edge-distances":"endpoints","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"node",style:{"compound-sizing-wrt-labels":"include"}},{selector:"node[label]",style:{"text-valign":"bottom","text-halign":"center","font-size":`${n.getConfigField("fontSize")}px`}},{selector:".node-service",style:{label:"data(label)",width:"data(width)",height:"data(height)"}},{selector:".node-junction",style:{width:"data(width)",height:"data(height)"}},{selector:".node-group",style:{padding:`${n.getConfigField("padding")}px`}}],layout:{name:"grid",boundingBox:{x1:0,x2:100,y1:0,y2:100}}});l.remove(),at(i,s),st(e,s,n),ot(t,s,n),ct(r,s);const o=lt(n,c,u),a=dt(c,n),g=n.getConfigField("iconSize"),h=n.getConfigField("idealEdgeLengthMultiplier")*g,y=.5*g,p=n.getConfigField("edgeElasticity"),k=s.layout({name:"fcose",quality:"proof",randomize:n.getConfigField("randomize"),nodeSeparation:n.getConfigField("nodeSeparation"),numIter:n.getConfigField("numIter"),styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(w){const[$,m]=w.connectedNodes(),{parent:b}=P($),{parent:E}=P(m);return b===E?h:y},edgeElasticity(w){const[$,m]=w.connectedNodes(),{parent:b}=P($),{parent:E}=P(m);return b===E?p:.001},alignmentConstraint:o,relativePlacementConstraint:a});k.one("layoutstop",()=>{var $;function w(m,b,E,B){let v,S;const{x,y:A}=m,{x:j,y:L}=b;S=(B-A+(x-E)*(A-L)/(x-j))/Math.sqrt(1+Math.pow((A-L)/(x-j),2)),v=Math.sqrt(Math.pow(B-A,2)+Math.pow(E-x,2)-Math.pow(S,2));const I=Math.sqrt(Math.pow(j-x,2)+Math.pow(L-A,2));v=v/I;let T=(j-x)*(B-A)-(L-A)*(E-x);switch(!0){case T>=0:T=1;break;case T<0:T=-1;break}let C=(j-x)*(E-x)+(L-A)*(B-A);switch(!0){case C>=0:C=1;break;case C<0:C=-1;break}return S=Math.abs(S)*T,v=v*C,{distances:S,weights:v}}f(w,"getSegmentWeights"),s.startBatch();for(const m of Object.values(s.edges()))if(($=m.data)!=null&&$.call(m)){const{x:b,y:E}=m.source().position(),{x:B,y:v}=m.target().position();if(b!==B&&E!==v){const S=m.sourceEndpoint(),x=m.targetEndpoint(),{sourceDir:A}=et(m),[j,L]=z(A)?[S.x,x.y]:[x.x,S.y],{weights:I,distances:T}=w(S,x,j,L);m.style("segment-distances",T),m.style("segment-weights",I)}}s.endBatch(),k.run()}),k.run(),s.ready(w=>{K.info("Ready",w),d(s)})})}f(ft,"layoutArchitecture");var qt=f(async(e,t,i,r)=>{const n=r.db;n.setDiagramId(t);const c=n.getServices(),u=n.getJunctions(),d=n.getGroups(),l=n.getEdges(),s=n.getDataStructures(),o=ht(t),a=o.append("g");a.attr("class","architecture-edges");const g=o.append("g");g.attr("class","architecture-services");const h=o.append("g");h.attr("class","architecture-groups"),await Zt(n,g,c,t),Vt(n,g,u,t);const y=await ft(c,u,d,l,n,s);await _t(a,y,n,t),await Jt(h,y,n,t),nt(n,y),gt(void 0,o,n.getConfigField("padding"),n.getConfigField("useMaxWidth"))},"draw"),Ht={draw:qt},ie={parser:rt,get db(){return new it},renderer:Ht,styles:Nt};export{ie as diagram};
36
+ `)}}}}}))},"drawEdges"),Jt=f(async function(e,t,i,r){const c=i.getConfigField("padding")*.75,u=i.getConfigField("fontSize"),l=i.getConfigField("iconSize")/2;await Promise.all(t.nodes().map(async s=>{const o=P(s);if(o.type==="group"){const{h:a,w:g,x1:h,y1:y}=s.boundingBox(),p=e.append("rect");p.attr("id",`${r}-group-${o.id}`).attr("x",h+l).attr("y",y+l).attr("width",g).attr("height",a).attr("class","node-bkg");const k=e.append("g");let w=h,$=y;if(o.icon){const m=k.append("g");m.html(`<g>${await N(o.icon,{height:c,width:c,fallbackPrefix:R.prefix})}</g>`),m.attr("transform","translate("+(w+l+1)+", "+($+l+1)+")"),w+=c,$+=u/2-1-2}if(o.label){const m=k.append("g");await Z(m,o.label,{useHtmlLabels:!1,width:g,classes:"architecture-service-label"},J()),m.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),m.attr("transform","translate("+(w+l+4)+", "+($+l+2)+")")}i.setElementForId(o.id,p)}}))},"drawGroups"),Zt=f(async function(e,t,i,r){const n=J();for(const c of i){const u=t.append("g"),d=e.getConfigField("iconSize");if(c.title){const a=u.append("g");await Z(a,c.title,{useHtmlLabels:!1,width:d*1.5,classes:"architecture-service-label"},n),a.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),a.attr("transform","translate("+d/2+", "+d+")")}const l=u.append("g");if(c.icon)l.html(`<g>${await N(c.icon,{height:d,width:d,fallbackPrefix:R.prefix})}</g>`);else if(c.iconText){l.html(`<g>${await N("blank",{height:d,width:d,fallbackPrefix:R.prefix})}</g>`);const h=l.append("g").append("foreignObject").attr("width",d).attr("height",d).append("div").attr("class","node-icon-text").attr("style",`height: ${d}px;`).append("div").html(Et(c.iconText,n)),y=parseInt(window.getComputedStyle(h.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;h.attr("style",`-webkit-line-clamp: ${Math.floor((d-2)/y)};`)}else l.append("path").attr("class","node-bkg").attr("id",`${r}-node-${c.id}`).attr("d",`M0,${d} V5 Q0,0 5,0 H${d-5} Q${d},0 ${d},5 V${d} Z`);u.attr("id",`${r}-service-${c.id}`).attr("class","architecture-service");const{width:s,height:o}=u.node().getBBox();c.width=s,c.height=o,e.setElementForId(c.id,u)}return 0},"drawServices"),Vt=f(function(e,t,i,r){i.forEach(n=>{const c=t.append("g"),u=e.getConfigField("iconSize");c.append("g").append("rect").attr("id",`${r}-node-${n.id}`).attr("fill-opacity","0").attr("width",u).attr("height",u),c.attr("class","architecture-junction");const{width:l,height:s}=c._groups[0][0].getBBox();c.width=l,c.height=s,e.setElementForId(n.id,c)})},"drawJunctions");Tt([{name:R.prefix,icons:R}]);tt.use(It);function st(e,t,i){e.forEach(r=>{t.add({group:"nodes",data:{type:"service",id:r.id,icon:r.icon,label:r.title,parent:r.in,width:i.getConfigField("iconSize"),height:i.getConfigField("iconSize")},classes:"node-service"})})}f(st,"addServices");function ot(e,t,i){e.forEach(r=>{t.add({group:"nodes",data:{type:"junction",id:r.id,parent:r.in,width:i.getConfigField("iconSize"),height:i.getConfigField("iconSize")},classes:"node-junction"})})}f(ot,"addJunctions");function nt(e,t){t.nodes().map(i=>{const r=P(i);if(r.type==="group")return;r.x=i.position().x,r.y=i.position().y,e.getElementById(r.id).attr("transform","translate("+(r.x||0)+","+(r.y||0)+")")})}f(nt,"positionNodes");function at(e,t){e.forEach(i=>{t.add({group:"nodes",data:{type:"group",id:i.id,icon:i.icon,label:i.title,parent:i.in},classes:"node-group"})})}f(at,"addGroups");function ct(e,t){e.forEach(i=>{const{lhsId:r,rhsId:n,lhsInto:c,lhsGroup:u,rhsInto:d,lhsDir:l,rhsDir:s,rhsGroup:o,title:a}=i,g=V(i.lhsDir,i.rhsDir)?"segments":"straight",h={id:`${r}-${n}`,label:a,source:r,sourceDir:l,sourceArrow:c,sourceGroup:u,sourceEndpoint:l==="L"?"0 50%":l==="R"?"100% 50%":l==="T"?"50% 0":"50% 100%",target:n,targetDir:s,targetArrow:d,targetGroup:o,targetEndpoint:s==="L"?"0 50%":s==="R"?"100% 50%":s==="T"?"50% 0":"50% 100%"};t.add({group:"edges",data:h,classes:g})})}f(ct,"addEdges");function lt(e,t,i){const r=f((d,l)=>Object.entries(d).reduce((s,[o,a])=>{var y;let g=0;const h=Object.entries(a);if(h.length===1)return s[o]=h[0][1],s;for(let p=0;p<h.length-1;p++)for(let k=p+1;k<h.length;k++){const[w,$]=h[p],[m,b]=h[k];if(((y=i[w])==null?void 0:y[m])===l)s[o]??(s[o]=[]),s[o]=[...s[o],...$,...b];else if(w==="default"||m==="default")s[o]??(s[o]=[]),s[o]=[...s[o],...$,...b];else{const B=`${o}-${g++}`;s[B]=$;const v=`${o}-${g++}`;s[v]=b}}return s},{}),"flattenAlignments"),n=t.map(d=>{const l={},s={};return Object.entries(d).forEach(([o,[a,g]])=>{var y,p,k;const h=((y=e.getNode(o))==null?void 0:y.in)??"default";l[g]??(l[g]={}),(p=l[g])[h]??(p[h]=[]),l[g][h].push(o),s[a]??(s[a]={}),(k=s[a])[h]??(k[h]=[]),s[a][h].push(o)}),{horiz:Object.values(r(l,"horizontal")).filter(o=>o.length>1),vert:Object.values(r(s,"vertical")).filter(o=>o.length>1)}}),[c,u]=n.reduce(([d,l],{horiz:s,vert:o})=>[[...d,...s],[...l,...o]],[[],[]]);return{horizontal:c,vertical:u}}f(lt,"getAlignments");function dt(e,t){const i=[],r=f(c=>`${c[0]},${c[1]}`,"posToStr"),n=f(c=>c.split(",").map(u=>parseInt(u)),"strToPos");return e.forEach(c=>{const u=Object.fromEntries(Object.entries(c).map(([o,a])=>[r(a),o])),d=[r([0,0])],l={},s={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;d.length>0;){const o=d.shift();if(o){l[o]=1;const a=u[o];if(a){const g=n(o);Object.entries(s).forEach(([h,y])=>{const p=r([g[0]+y[0],g[1]+y[1]]),k=u[p];k&&!l[p]&&(d.push(p),i.push({[W[h]]:k,[W[Lt(h)]]:a,gap:1.5*t.getConfigField("iconSize")}))})}}}}),i}f(dt,"getRelativeConstraints");function ft(e,t,i,r,n,{spatialMaps:c,groupAlignments:u}){return new Promise(d=>{const l=St("body").append("div").attr("id","cy").attr("style","display:none"),s=tt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge[label]",style:{label:"data(label)"}},{selector:"edge.segments",style:{"curve-style":"segments","segment-weights":"0","segment-distances":[.5],"edge-distances":"endpoints","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"node",style:{"compound-sizing-wrt-labels":"include"}},{selector:"node[label]",style:{"text-valign":"bottom","text-halign":"center","font-size":`${n.getConfigField("fontSize")}px`}},{selector:".node-service",style:{label:"data(label)",width:"data(width)",height:"data(height)"}},{selector:".node-junction",style:{width:"data(width)",height:"data(height)"}},{selector:".node-group",style:{padding:`${n.getConfigField("padding")}px`}}],layout:{name:"grid",boundingBox:{x1:0,x2:100,y1:0,y2:100}}});l.remove(),at(i,s),st(e,s,n),ot(t,s,n),ct(r,s);const o=lt(n,c,u),a=dt(c,n),g=n.getConfigField("iconSize"),h=n.getConfigField("idealEdgeLengthMultiplier")*g,y=.5*g,p=n.getConfigField("edgeElasticity"),k=s.layout({name:"fcose",quality:"proof",randomize:n.getConfigField("randomize"),nodeSeparation:n.getConfigField("nodeSeparation"),numIter:n.getConfigField("numIter"),styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(w){const[$,m]=w.connectedNodes(),{parent:b}=P($),{parent:E}=P(m);return b===E?h:y},edgeElasticity(w){const[$,m]=w.connectedNodes(),{parent:b}=P($),{parent:E}=P(m);return b===E?p:.001},alignmentConstraint:o,relativePlacementConstraint:a});k.one("layoutstop",()=>{var $;function w(m,b,E,B){let v,S;const{x,y:A}=m,{x:j,y:L}=b;S=(B-A+(x-E)*(A-L)/(x-j))/Math.sqrt(1+Math.pow((A-L)/(x-j),2)),v=Math.sqrt(Math.pow(B-A,2)+Math.pow(E-x,2)-Math.pow(S,2));const I=Math.sqrt(Math.pow(j-x,2)+Math.pow(L-A,2));v=v/I;let D=(j-x)*(B-A)-(L-A)*(E-x);switch(!0){case D>=0:D=1;break;case D<0:D=-1;break}let C=(j-x)*(E-x)+(L-A)*(B-A);switch(!0){case C>=0:C=1;break;case C<0:C=-1;break}return S=Math.abs(S)*D,v=v*C,{distances:S,weights:v}}f(w,"getSegmentWeights"),s.startBatch();for(const m of Object.values(s.edges()))if(($=m.data)!=null&&$.call(m)){const{x:b,y:E}=m.source().position(),{x:B,y:v}=m.target().position();if(b!==B&&E!==v){const S=m.sourceEndpoint(),x=m.targetEndpoint(),{sourceDir:A}=et(m),[j,L]=z(A)?[S.x,x.y]:[x.x,S.y],{weights:I,distances:D}=w(S,x,j,L);m.style("segment-distances",D),m.style("segment-weights",I)}}s.endBatch(),k.run()}),k.run(),s.ready(w=>{K.info("Ready",w),d(s)})})}f(ft,"layoutArchitecture");var qt=f(async(e,t,i,r)=>{const n=r.db;n.setDiagramId(t);const c=n.getServices(),u=n.getJunctions(),d=n.getGroups(),l=n.getEdges(),s=n.getDataStructures(),o=ht(t),a=o.append("g");a.attr("class","architecture-edges");const g=o.append("g");g.attr("class","architecture-services");const h=o.append("g");h.attr("class","architecture-groups"),await Zt(n,g,c,t),Vt(n,g,u,t);const y=await ft(c,u,d,l,n,s);await _t(a,y,n,t),await Jt(h,y,n,t),nt(n,y),gt(void 0,o,n.getConfigField("padding"),n.getConfigField("useMaxWidth"))},"draw"),Ht={draw:qt},ie={parser:rt,get db(){return new it},renderer:Ht,styles:Nt};export{ie as diagram};
@@ -1,9 +1,9 @@
1
- import{g as ye}from"./chunk-FMBD7UC4-DfYQ2YmB.js";import{ax as xe,ae as Vt,ay as be,bf as we,be as me,bh as Se,bg as Le,bc as ve,ba as Ee,b5 as _e,aT as ke,aL as Te,aK as De,aF as Ne,aq as Ie,ap as Ce,ar as Be,a0 as Oe,$ as Re,O as Ae,n as ze,N as Me,h as Pe,i as Fe,f as We,b as u,a4 as ct,a_ as O,F as Ye,aE as v,t as He,aY as Ke,aa as Ue,aB as Xe,L as Ve,a5 as M,ag as je,a8 as H,K as Et,D as at,ad as Ze,bk as st,z as Ge,ac as qe,aZ as Ot,Q as Rt,E as Je}from"./App-VU2lfA8m.js";import{G as Qe}from"./graph-BEmEBUp_.js";import{c as $e}from"./channel-DugSMLKi.js";import"./mobile-qvdJ5p0m.js";import"./index-CLb8RFcn.js";import"./graph-DnLKqSPg.js";function tr(e){return Array.isArray(e)}function er(e){if(xe(e))return e;const t=Vt(e);if(!rr(e))return{};if(tr(e)){const s=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(s.index=e.index,s.input=e.input),s}if(be(e)){const s=e,i=s.constructor;return new i(s.buffer,s.byteOffset,s.length)}if(t==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(t==="[object DataView]"){const s=e,i=s.buffer,c=s.byteOffset,r=s.byteLength,n=new ArrayBuffer(r),l=new Uint8Array(i,c,r);return new Uint8Array(n).set(l),new DataView(n)}if(t==="[object Boolean]"||t==="[object Number]"||t==="[object String]"){const s=e.constructor,i=new s(e.valueOf());return t==="[object String]"?sr(i,e):xt(i,e),i}if(t==="[object Date]")return new Date(Number(e));if(t==="[object RegExp]"){const s=e,i=new RegExp(s.source,s.flags);return i.lastIndex=s.lastIndex,i}if(t==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(t==="[object Map]"){const s=e,i=new Map;return s.forEach((c,r)=>{i.set(r,c)}),i}if(t==="[object Set]"){const s=e,i=new Set;return s.forEach(c=>{i.add(c)}),i}if(t==="[object Arguments]"){const s=e,i={};return xt(i,s),i.length=s.length,i[Symbol.iterator]=s[Symbol.iterator],i}const a={};return ir(a,e),xt(a,e),ar(a,e),a}function rr(e){switch(Vt(e)){case We:case Fe:case Pe:case Me:case ze:case Ae:case Re:case Oe:case Be:case Ce:case Ie:case Ne:case De:case Te:case ke:case _e:case Ee:case ve:case Le:case Se:case me:case we:return!0;default:return!1}}function xt(e,t){for(const a in t)Object.hasOwn(t,a)&&(e[a]=t[a])}function ar(e,t){const a=Object.getOwnPropertySymbols(t);for(let s=0;s<a.length;s++){const i=a[s];Object.prototype.propertyIsEnumerable.call(t,i)&&(e[i]=t[i])}}function sr(e,t){const a=t.valueOf().length;for(const s in t)Object.hasOwn(t,s)&&(Number.isNaN(Number(s))||Number(s)>=a)&&(e[s]=t[s])}function ir(e,t){const a=Object.getPrototypeOf(t);a!==null&&typeof t.constructor=="function"&&Object.setPrototypeOf(e,a)}var wt=(function(){var e=u(function(N,x,p,f){for(p=p||{},f=N.length;f--;p[N[f]]=x);return p},"o"),t=[1,15],a=[1,7],s=[1,13],i=[1,14],c=[1,19],r=[1,16],n=[1,17],l=[1,18],d=[8,30],g=[8,10,21,28,29,30,31,39,43,46],y=[1,23],w=[1,24],b=[8,10,15,16,21,28,29,30,31,39,43,46],m=[8,10,15,16,21,27,28,29,30,31,39,43,46],_=[1,49],L={trace:u(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:u(function(x,p,f,S,E,o,k){var h=o.length-1;switch(E){case 4:S.getLogger().debug("Rule: separator (NL) ");break;case 5:S.getLogger().debug("Rule: separator (Space) ");break;case 6:S.getLogger().debug("Rule: separator (EOF) ");break;case 7:S.getLogger().debug("Rule: hierarchy: ",o[h-1]),S.setHierarchy(o[h-1]);break;case 8:S.getLogger().debug("Stop NL ");break;case 9:S.getLogger().debug("Stop EOF ");break;case 10:S.getLogger().debug("Stop NL2 ");break;case 11:S.getLogger().debug("Stop EOF2 ");break;case 12:S.getLogger().debug("Rule: statement: ",o[h]),typeof o[h].length=="number"?this.$=o[h]:this.$=[o[h]];break;case 13:S.getLogger().debug("Rule: statement #2: ",o[h-1]),this.$=[o[h-1]].concat(o[h]);break;case 14:S.getLogger().debug("Rule: link: ",o[h],x),this.$={edgeTypeStr:o[h],label:""};break;case 15:S.getLogger().debug("Rule: LABEL link: ",o[h-3],o[h-1],o[h]),this.$={edgeTypeStr:o[h],label:o[h-1]};break;case 18:const T=parseInt(o[h]),D=S.generateId();this.$={id:D,type:"space",label:"",width:T,children:[]};break;case 23:S.getLogger().debug("Rule: (nodeStatement link node) ",o[h-2],o[h-1],o[h]," typestr: ",o[h-1].edgeTypeStr);const U=S.edgeStrToEdgeData(o[h-1].edgeTypeStr),F=S.edgeStrToEdgeStartData(o[h-1].edgeTypeStr),J=S.edgeStrToThickness(o[h-1].edgeTypeStr),B=S.edgeStrToPattern(o[h-1].edgeTypeStr);this.$=[{id:o[h-2].id,label:o[h-2].label,type:o[h-2].type,directions:o[h-2].directions},{id:o[h-2].id+"-"+o[h].id,start:o[h-2].id,end:o[h].id,label:o[h-1].label,type:"edge",thickness:J,pattern:B,directions:o[h].directions,arrowTypeEnd:U,arrowTypeStart:F},{id:o[h].id,label:o[h].label,type:S.typeStr2Type(o[h].typeStr),directions:o[h].directions}];break;case 24:S.getLogger().debug("Rule: nodeStatement (abc88 node size) ",o[h-1],o[h]),this.$={id:o[h-1].id,label:o[h-1].label,type:S.typeStr2Type(o[h-1].typeStr),directions:o[h-1].directions,widthInColumns:parseInt(o[h],10)};break;case 25:S.getLogger().debug("Rule: nodeStatement (node) ",o[h]),this.$={id:o[h].id,label:o[h].label,type:S.typeStr2Type(o[h].typeStr),directions:o[h].directions,widthInColumns:1};break;case 26:S.getLogger().debug("APA123",this?this:"na"),S.getLogger().debug("COLUMNS: ",o[h]),this.$={type:"column-setting",columns:o[h]==="auto"?-1:parseInt(o[h])};break;case 27:S.getLogger().debug("Rule: id-block statement : ",o[h-2],o[h-1]),S.generateId(),this.$={...o[h-2],type:"composite",children:o[h-1]};break;case 28:S.getLogger().debug("Rule: blockStatement : ",o[h-2],o[h-1],o[h]);const Y=S.generateId();this.$={id:Y,type:"composite",label:"",children:o[h-1]};break;case 29:S.getLogger().debug("Rule: node (NODE_ID separator): ",o[h]),this.$={id:o[h]};break;case 30:S.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",o[h-1],o[h]),this.$={id:o[h-1],label:o[h].label,typeStr:o[h].typeStr,directions:o[h].directions};break;case 31:S.getLogger().debug("Rule: dirList: ",o[h]),this.$=[o[h]];break;case 32:S.getLogger().debug("Rule: dirList: ",o[h-1],o[h]),this.$=[o[h-1]].concat(o[h]);break;case 33:S.getLogger().debug("Rule: nodeShapeNLabel: ",o[h-2],o[h-1],o[h]),this.$={typeStr:o[h-2]+o[h],label:o[h-1]};break;case 34:S.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",o[h-3],o[h-2]," #3:",o[h-1],o[h]),this.$={typeStr:o[h-3]+o[h],label:o[h-2],directions:o[h-1]};break;case 35:case 36:this.$={type:"classDef",id:o[h-1].trim(),css:o[h].trim()};break;case 37:this.$={type:"applyClass",id:o[h-1].trim(),styleClass:o[h].trim()};break;case 38:this.$={type:"applyStyles",id:o[h-1].trim(),stylesStr:o[h].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:t,11:3,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{8:[1,20]},e(d,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:t,21:a,28:s,29:i,31:c,39:r,43:n,46:l}),e(g,[2,16],{14:22,15:y,16:w}),e(g,[2,17]),e(g,[2,18]),e(g,[2,19]),e(g,[2,20]),e(g,[2,21]),e(g,[2,22]),e(b,[2,25],{27:[1,25]}),e(g,[2,26]),{19:26,26:12,31:c},{10:t,11:27,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(m,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(d,[2,13]),{26:35,31:c},{31:[2,14]},{17:[1,36]},e(b,[2,24]),{10:t,11:37,13:4,14:22,15:y,16:w,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(m,[2,30]),{18:[1,43]},{18:[1,44]},e(b,[2,23]),{18:[1,45]},{30:[1,46]},e(g,[2,28]),e(g,[2,35]),e(g,[2,36]),e(g,[2,37]),e(g,[2,38]),{36:[1,47]},{33:48,34:_},{15:[1,50]},e(g,[2,27]),e(m,[2,33]),{38:[1,51]},{33:52,34:_,38:[2,31]},{31:[2,15]},e(m,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:u(function(x,p){if(p.recoverable)this.trace(x);else{var f=new Error(x);throw f.hash=p,f}},"parseError"),parse:u(function(x){var p=this,f=[0],S=[],E=[null],o=[],k=this.table,h="",T=0,D=0,U=2,F=1,J=o.slice.call(arguments,1),B=Object.create(this.lexer),Y={yy:{}};for(var et in this.yy)Object.prototype.hasOwnProperty.call(this.yy,et)&&(Y.yy[et]=this.yy[et]);B.setInput(x,Y.yy),Y.yy.lexer=B,Y.yy.parser=this,typeof B.yylloc>"u"&&(B.yylloc={});var rt=B.yylloc;o.push(rt);var pe=B.options&&B.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function fe(X){f.length=f.length-2*X,E.length=E.length-X,o.length=o.length-X}u(fe,"popStack");function Ct(){var X;return X=S.pop()||B.lex()||F,typeof X!="number"&&(X instanceof Array&&(S=X,X=S.pop()),X=p.symbols_[X]||X),X}u(Ct,"lex");for(var K,$,j,ft,tt={},lt,Q,Bt,ot;;){if($=f[f.length-1],this.defaultActions[$]?j=this.defaultActions[$]:((K===null||typeof K>"u")&&(K=Ct()),j=k[$]&&k[$][K]),typeof j>"u"||!j.length||!j[0]){var yt="";ot=[];for(lt in k[$])this.terminals_[lt]&&lt>U&&ot.push("'"+this.terminals_[lt]+"'");B.showPosition?yt="Parse error on line "+(T+1)+`:
1
+ import{g as ye}from"./chunk-FMBD7UC4-BO5q1BN_.js";import{ar as xe,as as Vt,at as be,au as we,av as me,aw as Se,ax as Le,ay as ve,az as Ee,aA as _e,aB as ke,aC as Te,aD as De,aE as Ne,aF as Ie,aG as Ce,aH as Be,aI as Oe,aJ as Re,aK as Ae,aL as ze,aM as Me,aN as Pe,aO as Fe,aP as We,_ as u,D as ct,d as O,e as Ye,l as v,z as He,B as Ke,aQ as Ue,R as Xe,S as Ve,c as M,O as je,aR as H,ak as Et,aS as at,aT as Ge,u as st,k as Ze,aU as qe,i as Ot,aV as Rt,aW as Je}from"./App-QGVt8tH2.js";import{G as Qe}from"./graph-CAnANduQ.js";import{c as $e}from"./channel-D6hNrRZ2.js";import"./mobile-CG5tLa2S.js";import"./index-D4GJb_6L.js";import"./graph-CJVNlri5.js";function tr(e){return Array.isArray(e)}function er(e){if(xe(e))return e;const t=Vt(e);if(!rr(e))return{};if(tr(e)){const s=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(s.index=e.index,s.input=e.input),s}if(be(e)){const s=e,i=s.constructor;return new i(s.buffer,s.byteOffset,s.length)}if(t==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(t==="[object DataView]"){const s=e,i=s.buffer,c=s.byteOffset,r=s.byteLength,n=new ArrayBuffer(r),l=new Uint8Array(i,c,r);return new Uint8Array(n).set(l),new DataView(n)}if(t==="[object Boolean]"||t==="[object Number]"||t==="[object String]"){const s=e.constructor,i=new s(e.valueOf());return t==="[object String]"?sr(i,e):xt(i,e),i}if(t==="[object Date]")return new Date(Number(e));if(t==="[object RegExp]"){const s=e,i=new RegExp(s.source,s.flags);return i.lastIndex=s.lastIndex,i}if(t==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(t==="[object Map]"){const s=e,i=new Map;return s.forEach((c,r)=>{i.set(r,c)}),i}if(t==="[object Set]"){const s=e,i=new Set;return s.forEach(c=>{i.add(c)}),i}if(t==="[object Arguments]"){const s=e,i={};return xt(i,s),i.length=s.length,i[Symbol.iterator]=s[Symbol.iterator],i}const a={};return ir(a,e),xt(a,e),ar(a,e),a}function rr(e){switch(Vt(e)){case We:case Fe:case Pe:case Me:case ze:case Ae:case Re:case Oe:case Be:case Ce:case Ie:case Ne:case De:case Te:case ke:case _e:case Ee:case ve:case Le:case Se:case me:case we:return!0;default:return!1}}function xt(e,t){for(const a in t)Object.hasOwn(t,a)&&(e[a]=t[a])}function ar(e,t){const a=Object.getOwnPropertySymbols(t);for(let s=0;s<a.length;s++){const i=a[s];Object.prototype.propertyIsEnumerable.call(t,i)&&(e[i]=t[i])}}function sr(e,t){const a=t.valueOf().length;for(const s in t)Object.hasOwn(t,s)&&(Number.isNaN(Number(s))||Number(s)>=a)&&(e[s]=t[s])}function ir(e,t){const a=Object.getPrototypeOf(t);a!==null&&typeof t.constructor=="function"&&Object.setPrototypeOf(e,a)}var wt=(function(){var e=u(function(N,x,p,f){for(p=p||{},f=N.length;f--;p[N[f]]=x);return p},"o"),t=[1,15],a=[1,7],s=[1,13],i=[1,14],c=[1,19],r=[1,16],n=[1,17],l=[1,18],d=[8,30],g=[8,10,21,28,29,30,31,39,43,46],y=[1,23],w=[1,24],b=[8,10,15,16,21,28,29,30,31,39,43,46],m=[8,10,15,16,21,27,28,29,30,31,39,43,46],_=[1,49],L={trace:u(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:u(function(x,p,f,S,E,o,k){var h=o.length-1;switch(E){case 4:S.getLogger().debug("Rule: separator (NL) ");break;case 5:S.getLogger().debug("Rule: separator (Space) ");break;case 6:S.getLogger().debug("Rule: separator (EOF) ");break;case 7:S.getLogger().debug("Rule: hierarchy: ",o[h-1]),S.setHierarchy(o[h-1]);break;case 8:S.getLogger().debug("Stop NL ");break;case 9:S.getLogger().debug("Stop EOF ");break;case 10:S.getLogger().debug("Stop NL2 ");break;case 11:S.getLogger().debug("Stop EOF2 ");break;case 12:S.getLogger().debug("Rule: statement: ",o[h]),typeof o[h].length=="number"?this.$=o[h]:this.$=[o[h]];break;case 13:S.getLogger().debug("Rule: statement #2: ",o[h-1]),this.$=[o[h-1]].concat(o[h]);break;case 14:S.getLogger().debug("Rule: link: ",o[h],x),this.$={edgeTypeStr:o[h],label:""};break;case 15:S.getLogger().debug("Rule: LABEL link: ",o[h-3],o[h-1],o[h]),this.$={edgeTypeStr:o[h],label:o[h-1]};break;case 18:const T=parseInt(o[h]),D=S.generateId();this.$={id:D,type:"space",label:"",width:T,children:[]};break;case 23:S.getLogger().debug("Rule: (nodeStatement link node) ",o[h-2],o[h-1],o[h]," typestr: ",o[h-1].edgeTypeStr);const U=S.edgeStrToEdgeData(o[h-1].edgeTypeStr),F=S.edgeStrToEdgeStartData(o[h-1].edgeTypeStr),J=S.edgeStrToThickness(o[h-1].edgeTypeStr),B=S.edgeStrToPattern(o[h-1].edgeTypeStr);this.$=[{id:o[h-2].id,label:o[h-2].label,type:o[h-2].type,directions:o[h-2].directions},{id:o[h-2].id+"-"+o[h].id,start:o[h-2].id,end:o[h].id,label:o[h-1].label,type:"edge",thickness:J,pattern:B,directions:o[h].directions,arrowTypeEnd:U,arrowTypeStart:F},{id:o[h].id,label:o[h].label,type:S.typeStr2Type(o[h].typeStr),directions:o[h].directions}];break;case 24:S.getLogger().debug("Rule: nodeStatement (abc88 node size) ",o[h-1],o[h]),this.$={id:o[h-1].id,label:o[h-1].label,type:S.typeStr2Type(o[h-1].typeStr),directions:o[h-1].directions,widthInColumns:parseInt(o[h],10)};break;case 25:S.getLogger().debug("Rule: nodeStatement (node) ",o[h]),this.$={id:o[h].id,label:o[h].label,type:S.typeStr2Type(o[h].typeStr),directions:o[h].directions,widthInColumns:1};break;case 26:S.getLogger().debug("APA123",this?this:"na"),S.getLogger().debug("COLUMNS: ",o[h]),this.$={type:"column-setting",columns:o[h]==="auto"?-1:parseInt(o[h])};break;case 27:S.getLogger().debug("Rule: id-block statement : ",o[h-2],o[h-1]),S.generateId(),this.$={...o[h-2],type:"composite",children:o[h-1]};break;case 28:S.getLogger().debug("Rule: blockStatement : ",o[h-2],o[h-1],o[h]);const Y=S.generateId();this.$={id:Y,type:"composite",label:"",children:o[h-1]};break;case 29:S.getLogger().debug("Rule: node (NODE_ID separator): ",o[h]),this.$={id:o[h]};break;case 30:S.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",o[h-1],o[h]),this.$={id:o[h-1],label:o[h].label,typeStr:o[h].typeStr,directions:o[h].directions};break;case 31:S.getLogger().debug("Rule: dirList: ",o[h]),this.$=[o[h]];break;case 32:S.getLogger().debug("Rule: dirList: ",o[h-1],o[h]),this.$=[o[h-1]].concat(o[h]);break;case 33:S.getLogger().debug("Rule: nodeShapeNLabel: ",o[h-2],o[h-1],o[h]),this.$={typeStr:o[h-2]+o[h],label:o[h-1]};break;case 34:S.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",o[h-3],o[h-2]," #3:",o[h-1],o[h]),this.$={typeStr:o[h-3]+o[h],label:o[h-2],directions:o[h-1]};break;case 35:case 36:this.$={type:"classDef",id:o[h-1].trim(),css:o[h].trim()};break;case 37:this.$={type:"applyClass",id:o[h-1].trim(),styleClass:o[h].trim()};break;case 38:this.$={type:"applyStyles",id:o[h-1].trim(),stylesStr:o[h].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:t,11:3,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{8:[1,20]},e(d,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:t,21:a,28:s,29:i,31:c,39:r,43:n,46:l}),e(g,[2,16],{14:22,15:y,16:w}),e(g,[2,17]),e(g,[2,18]),e(g,[2,19]),e(g,[2,20]),e(g,[2,21]),e(g,[2,22]),e(b,[2,25],{27:[1,25]}),e(g,[2,26]),{19:26,26:12,31:c},{10:t,11:27,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(m,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(d,[2,13]),{26:35,31:c},{31:[2,14]},{17:[1,36]},e(b,[2,24]),{10:t,11:37,13:4,14:22,15:y,16:w,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(m,[2,30]),{18:[1,43]},{18:[1,44]},e(b,[2,23]),{18:[1,45]},{30:[1,46]},e(g,[2,28]),e(g,[2,35]),e(g,[2,36]),e(g,[2,37]),e(g,[2,38]),{36:[1,47]},{33:48,34:_},{15:[1,50]},e(g,[2,27]),e(m,[2,33]),{38:[1,51]},{33:52,34:_,38:[2,31]},{31:[2,15]},e(m,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:u(function(x,p){if(p.recoverable)this.trace(x);else{var f=new Error(x);throw f.hash=p,f}},"parseError"),parse:u(function(x){var p=this,f=[0],S=[],E=[null],o=[],k=this.table,h="",T=0,D=0,U=2,F=1,J=o.slice.call(arguments,1),B=Object.create(this.lexer),Y={yy:{}};for(var et in this.yy)Object.prototype.hasOwnProperty.call(this.yy,et)&&(Y.yy[et]=this.yy[et]);B.setInput(x,Y.yy),Y.yy.lexer=B,Y.yy.parser=this,typeof B.yylloc>"u"&&(B.yylloc={});var rt=B.yylloc;o.push(rt);var pe=B.options&&B.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function fe(X){f.length=f.length-2*X,E.length=E.length-X,o.length=o.length-X}u(fe,"popStack");function Ct(){var X;return X=S.pop()||B.lex()||F,typeof X!="number"&&(X instanceof Array&&(S=X,X=S.pop()),X=p.symbols_[X]||X),X}u(Ct,"lex");for(var K,$,j,ft,tt={},lt,Q,Bt,ot;;){if($=f[f.length-1],this.defaultActions[$]?j=this.defaultActions[$]:((K===null||typeof K>"u")&&(K=Ct()),j=k[$]&&k[$][K]),typeof j>"u"||!j.length||!j[0]){var yt="";ot=[];for(lt in k[$])this.terminals_[lt]&&lt>U&&ot.push("'"+this.terminals_[lt]+"'");B.showPosition?yt="Parse error on line "+(T+1)+`:
2
2
  `+B.showPosition()+`
3
3
  Expecting `+ot.join(", ")+", got '"+(this.terminals_[K]||K)+"'":yt="Parse error on line "+(T+1)+": Unexpected "+(K==F?"end of input":"'"+(this.terminals_[K]||K)+"'"),this.parseError(yt,{text:B.match,token:this.terminals_[K]||K,line:B.yylineno,loc:rt,expected:ot})}if(j[0]instanceof Array&&j.length>1)throw new Error("Parse Error: multiple actions possible at state: "+$+", token: "+K);switch(j[0]){case 1:f.push(K),E.push(B.yytext),o.push(B.yylloc),f.push(j[1]),K=null,D=B.yyleng,h=B.yytext,T=B.yylineno,rt=B.yylloc;break;case 2:if(Q=this.productions_[j[1]][1],tt.$=E[E.length-Q],tt._$={first_line:o[o.length-(Q||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(Q||1)].first_column,last_column:o[o.length-1].last_column},pe&&(tt._$.range=[o[o.length-(Q||1)].range[0],o[o.length-1].range[1]]),ft=this.performAction.apply(tt,[h,D,T,Y.yy,j[1],E,o].concat(J)),typeof ft<"u")return ft;Q&&(f=f.slice(0,-1*Q*2),E=E.slice(0,-1*Q),o=o.slice(0,-1*Q)),f.push(this.productions_[j[1]][0]),E.push(tt.$),o.push(tt._$),Bt=k[f[f.length-2]][f[f.length-1]],f.push(Bt);break;case 3:return!0}}return!0},"parse")},C=(function(){var N={EOF:1,parseError:u(function(p,f){if(this.yy.parser)this.yy.parser.parseError(p,f);else throw new Error(p)},"parseError"),setInput:u(function(x,p){return this.yy=p||this.yy||{},this._input=x,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:u(function(){var x=this._input[0];this.yytext+=x,this.yyleng++,this.offset++,this.match+=x,this.matched+=x;var p=x.match(/(?:\r\n?|\n).*/g);return p?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),x},"input"),unput:u(function(x){var p=x.length,f=x.split(/(?:\r\n?|\n)/g);this._input=x+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-p),this.offset-=p;var S=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),f.length-1&&(this.yylineno-=f.length-1);var E=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:f?(f.length===S.length?this.yylloc.first_column:0)+S[S.length-f.length].length-f[0].length:this.yylloc.first_column-p},this.options.ranges&&(this.yylloc.range=[E[0],E[0]+this.yyleng-p]),this.yyleng=this.yytext.length,this},"unput"),more:u(function(){return this._more=!0,this},"more"),reject:u(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:u(function(x){this.unput(this.match.slice(x))},"less"),pastInput:u(function(){var x=this.matched.substr(0,this.matched.length-this.match.length);return(x.length>20?"...":"")+x.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:u(function(){var x=this.match;return x.length<20&&(x+=this._input.substr(0,20-x.length)),(x.substr(0,20)+(x.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:u(function(){var x=this.pastInput(),p=new Array(x.length+1).join("-");return x+this.upcomingInput()+`
5
5
  `+p+"^"},"showPosition"),test_match:u(function(x,p){var f,S,E;if(this.options.backtrack_lexer&&(E={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(E.yylloc.range=this.yylloc.range.slice(0))),S=x[0].match(/(?:\r\n?|\n).*/g),S&&(this.yylineno+=S.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:S?S[S.length-1].length-S[S.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+x[0].length},this.yytext+=x[0],this.match+=x[0],this.matches=x,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(x[0].length),this.matched+=x[0],f=this.performAction.call(this,this.yy,this,p,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),f)return f;if(this._backtrack){for(var o in E)this[o]=E[o];return!1}return!1},"test_match"),next:u(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var x,p,f,S;this._more||(this.yytext="",this.match="");for(var E=this._currentRules(),o=0;o<E.length;o++)if(f=this._input.match(this.rules[E[o]]),f&&(!p||f[0].length>p[0].length)){if(p=f,S=o,this.options.backtrack_lexer){if(x=this.test_match(f,E[o]),x!==!1)return x;if(this._backtrack){p=!1;continue}else return!1}else if(!this.options.flex)break}return p?(x=this.test_match(p,E[S]),x!==!1?x:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
6
- `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:u(function(){var p=this.next();return p||this.lex()},"lex"),begin:u(function(p){this.conditionStack.push(p)},"begin"),popState:u(function(){var p=this.conditionStack.length-1;return p>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:u(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:u(function(p){return p=this.conditionStack.length-1-Math.abs(p||0),p>=0?this.conditionStack[p]:"INITIAL"},"topState"),pushState:u(function(p){this.begin(p)},"pushState"),stateStackSize:u(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:u(function(p,f,S,E){switch(S){case 0:return p.getLogger().debug("Found block-beta"),10;case 1:return p.getLogger().debug("Found id-block"),29;case 2:return p.getLogger().debug("Found block"),10;case 3:p.getLogger().debug(".",f.yytext);break;case 4:p.getLogger().debug("_",f.yytext);break;case 5:return 5;case 6:return f.yytext=-1,28;case 7:return f.yytext=f.yytext.replace(/columns\s+/,""),p.getLogger().debug("COLUMNS (LEX)",f.yytext),28;case 8:this.pushState("md_string");break;case 9:return"MD_STR";case 10:this.popState();break;case 11:this.pushState("string");break;case 12:p.getLogger().debug("LEX: POPPING STR:",f.yytext),this.popState();break;case 13:return p.getLogger().debug("LEX: STR end:",f.yytext),"STR";case 14:return f.yytext=f.yytext.replace(/space\:/,""),p.getLogger().debug("SPACE NUM (LEX)",f.yytext),21;case 15:return f.yytext="1",p.getLogger().debug("COLUMNS (LEX)",f.yytext),21;case 16:return 42;case 17:return"LINKSTYLE";case 18:return"INTERPOLATE";case 19:return this.pushState("CLASSDEF"),39;case 20:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 21:return this.popState(),this.pushState("CLASSDEFID"),40;case 22:return this.popState(),41;case 23:return this.pushState("CLASS"),43;case 24:return this.popState(),this.pushState("CLASS_STYLE"),44;case 25:return this.popState(),45;case 26:return this.pushState("STYLE_STMNT"),46;case 27:return this.popState(),this.pushState("STYLE_DEFINITION"),47;case 28:return this.popState(),48;case 29:return this.pushState("acc_title"),"acc_title";case 30:return this.popState(),"acc_title_value";case 31:return this.pushState("acc_descr"),"acc_descr";case 32:return this.popState(),"acc_descr_value";case 33:this.pushState("acc_descr_multiline");break;case 34:this.popState();break;case 35:return"acc_descr_multiline_value";case 36:return 30;case 37:return this.popState(),p.getLogger().debug("Lex: (("),"NODE_DEND";case 38:return this.popState(),p.getLogger().debug("Lex: (("),"NODE_DEND";case 39:return this.popState(),p.getLogger().debug("Lex: ))"),"NODE_DEND";case 40:return this.popState(),p.getLogger().debug("Lex: (("),"NODE_DEND";case 41:return this.popState(),p.getLogger().debug("Lex: (("),"NODE_DEND";case 42:return this.popState(),p.getLogger().debug("Lex: (-"),"NODE_DEND";case 43:return this.popState(),p.getLogger().debug("Lex: -)"),"NODE_DEND";case 44:return this.popState(),p.getLogger().debug("Lex: (("),"NODE_DEND";case 45:return this.popState(),p.getLogger().debug("Lex: ]]"),"NODE_DEND";case 46:return this.popState(),p.getLogger().debug("Lex: ("),"NODE_DEND";case 47:return this.popState(),p.getLogger().debug("Lex: ])"),"NODE_DEND";case 48:return this.popState(),p.getLogger().debug("Lex: /]"),"NODE_DEND";case 49:return this.popState(),p.getLogger().debug("Lex: /]"),"NODE_DEND";case 50:return this.popState(),p.getLogger().debug("Lex: )]"),"NODE_DEND";case 51:return this.popState(),p.getLogger().debug("Lex: )"),"NODE_DEND";case 52:return this.popState(),p.getLogger().debug("Lex: ]>"),"NODE_DEND";case 53:return this.popState(),p.getLogger().debug("Lex: ]"),"NODE_DEND";case 54:return p.getLogger().debug("Lexa: -)"),this.pushState("NODE"),35;case 55:return p.getLogger().debug("Lexa: (-"),this.pushState("NODE"),35;case 56:return p.getLogger().debug("Lexa: ))"),this.pushState("NODE"),35;case 57:return p.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 58:return p.getLogger().debug("Lex: ((("),this.pushState("NODE"),35;case 59:return p.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 60:return p.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 61:return p.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 62:return p.getLogger().debug("Lexc: >"),this.pushState("NODE"),35;case 63:return p.getLogger().debug("Lexa: (["),this.pushState("NODE"),35;case 64:return p.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 65:return this.pushState("NODE"),35;case 66:return this.pushState("NODE"),35;case 67:return this.pushState("NODE"),35;case 68:return this.pushState("NODE"),35;case 69:return this.pushState("NODE"),35;case 70:return this.pushState("NODE"),35;case 71:return this.pushState("NODE"),35;case 72:return p.getLogger().debug("Lexa: ["),this.pushState("NODE"),35;case 73:return this.pushState("BLOCK_ARROW"),p.getLogger().debug("LEX ARR START"),37;case 74:return p.getLogger().debug("Lex: NODE_ID",f.yytext),31;case 75:return p.getLogger().debug("Lex: EOF",f.yytext),8;case 76:this.pushState("md_string");break;case 77:this.pushState("md_string");break;case 78:return"NODE_DESCR";case 79:this.popState();break;case 80:p.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 81:p.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 82:return p.getLogger().debug("LEX: NODE_DESCR:",f.yytext),"NODE_DESCR";case 83:p.getLogger().debug("LEX POPPING"),this.popState();break;case 84:p.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 85:return f.yytext=f.yytext.replace(/^,\s*/,""),p.getLogger().debug("Lex (right): dir:",f.yytext),"DIR";case 86:return f.yytext=f.yytext.replace(/^,\s*/,""),p.getLogger().debug("Lex (left):",f.yytext),"DIR";case 87:return f.yytext=f.yytext.replace(/^,\s*/,""),p.getLogger().debug("Lex (x):",f.yytext),"DIR";case 88:return f.yytext=f.yytext.replace(/^,\s*/,""),p.getLogger().debug("Lex (y):",f.yytext),"DIR";case 89:return f.yytext=f.yytext.replace(/^,\s*/,""),p.getLogger().debug("Lex (up):",f.yytext),"DIR";case 90:return f.yytext=f.yytext.replace(/^,\s*/,""),p.getLogger().debug("Lex (down):",f.yytext),"DIR";case 91:return f.yytext="]>",p.getLogger().debug("Lex (ARROW_DIR end):",f.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";case 92:return p.getLogger().debug("Lex: LINK","#"+f.yytext+"#"),15;case 93:return p.getLogger().debug("Lex: LINK",f.yytext),15;case 94:return p.getLogger().debug("Lex: LINK",f.yytext),15;case 95:return p.getLogger().debug("Lex: LINK",f.yytext),15;case 96:return p.getLogger().debug("Lex: START_LINK",f.yytext),this.pushState("LLABEL"),16;case 97:return p.getLogger().debug("Lex: START_LINK",f.yytext),this.pushState("LLABEL"),16;case 98:return p.getLogger().debug("Lex: START_LINK",f.yytext),this.pushState("LLABEL"),16;case 99:this.pushState("md_string");break;case 100:return p.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";case 101:return this.popState(),p.getLogger().debug("Lex: LINK","#"+f.yytext+"#"),15;case 102:return this.popState(),p.getLogger().debug("Lex: LINK",f.yytext),15;case 103:return this.popState(),p.getLogger().debug("Lex: LINK",f.yytext),15;case 104:return p.getLogger().debug("Lex: COLON",f.yytext),f.yytext=f.yytext.slice(1),27}},"anonymous"),rules:[/^(?:block-beta\b)/,/^(?:block:)/,/^(?:block\b)/,/^(?:[\s]+)/,/^(?:[\n]+)/,/^(?:((\u000D\u000A)|(\u000A)))/,/^(?:columns\s+auto\b)/,/^(?:columns\s+[\d]+)/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:space[:]\d+)/,/^(?:space\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\s+)/,/^(?:DEFAULT\s+)/,/^(?:\w+\s+)/,/^(?:[^\n]*)/,/^(?:class\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:style\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:end\b\s*)/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:[\)]\))/,/^(?:\}\})/,/^(?:\})/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\()/,/^(?:\]\])/,/^(?:\()/,/^(?:\]\))/,/^(?:\\\])/,/^(?:\/\])/,/^(?:\)\])/,/^(?:[\)])/,/^(?:\]>)/,/^(?:[\]])/,/^(?:-\))/,/^(?:\(-)/,/^(?:\)\))/,/^(?:\))/,/^(?:\(\(\()/,/^(?:\(\()/,/^(?:\{\{)/,/^(?:\{)/,/^(?:>)/,/^(?:\(\[)/,/^(?:\()/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\[\\)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:\[)/,/^(?:<\[)/,/^(?:[^\(\[\n\-\)\{\}\s\<\>:=]+)/,/^(?:$)/,/^(?:["][`])/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:\]>\s*\()/,/^(?:,?\s*right\s*)/,/^(?:,?\s*left\s*)/,/^(?:,?\s*x\s*)/,/^(?:,?\s*y\s*)/,/^(?:,?\s*up\s*)/,/^(?:,?\s*down\s*)/,/^(?:\)\s*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*~~[\~]+\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:["][`])/,/^(?:["])/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?::\d+)/],conditions:{STYLE_DEFINITION:{rules:[28],inclusive:!1},STYLE_STMNT:{rules:[27],inclusive:!1},CLASSDEFID:{rules:[22],inclusive:!1},CLASSDEF:{rules:[20,21],inclusive:!1},CLASS_STYLE:{rules:[25],inclusive:!1},CLASS:{rules:[24],inclusive:!1},LLABEL:{rules:[99,100,101,102,103],inclusive:!1},ARROW_DIR:{rules:[85,86,87,88,89,90,91],inclusive:!1},BLOCK_ARROW:{rules:[76,81,84],inclusive:!1},NODE:{rules:[37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,77,80],inclusive:!1},md_string:{rules:[9,10,78,79],inclusive:!1},space:{rules:[],inclusive:!1},string:{rules:[12,13,82,83],inclusive:!1},acc_descr_multiline:{rules:[34,35],inclusive:!1},acc_descr:{rules:[32],inclusive:!1},acc_title:{rules:[30],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,11,14,15,16,17,18,19,23,26,29,31,33,36,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,92,93,94,95,96,97,98,104],inclusive:!0}}};return N})();L.lexer=C;function I(){this.yy={}}return u(I,"Parser"),I.prototype=L,L.Parser=I,new I})();wt.parser=wt;var nr=wt,G=new Map,_t=[],mt=new Map,At="color",zt="fill",cr="bgFill",jt=",",lr=M(),gt=new Map,kt="",or=u(e=>Ge.sanitizeText(e,lr),"sanitizeText"),hr=u(function(e,t=""){let a=gt.get(e);a||(a={id:e,styles:[],textStyles:[]},gt.set(e,a)),t!=null&&t.split(jt).forEach(s=>{const i=s.replace(/([^;]*);/,"$1").trim();if(RegExp(At).exec(s)){const r=i.replace(zt,cr).replace(At,zt);a.textStyles.push(r)}a.styles.push(i)})},"addStyleClass"),gr=u(function(e,t=""){const a=G.get(e);t!=null&&(a.styles=t.split(jt))},"addStyle2Node"),ur=u(function(e,t){e.split(",").forEach(function(a){let s=G.get(a);if(s===void 0){const i=a.trim();s={id:i,type:"na",children:[]},G.set(i,s)}s.classes||(s.classes=[]),s.classes.push(t)})},"setCssClass"),Zt=u((e,t)=>{const a=e.flat(),s=[],i=a.find(r=>(r==null?void 0:r.type)==="column-setting"),c=(i==null?void 0:i.columns)??-1;for(const r of a){if(typeof c=="number"&&c>0&&r.type!=="column-setting"&&typeof r.widthInColumns=="number"&&r.widthInColumns>c&&v.warn(`Block ${r.id} width ${r.widthInColumns} exceeds configured column width ${c}`),r.label&&(r.label=or(r.label)),r.type==="classDef"){hr(r.id,r.css);continue}if(r.type==="applyClass"){ur(r.id,(r==null?void 0:r.styleClass)??"");continue}if(r.type==="applyStyles"){r!=null&&r.stylesStr&&gr(r.id,r==null?void 0:r.stylesStr);continue}if(r.type==="column-setting")t.columns=r.columns??-1;else if(r.type==="edge"){const n=(mt.get(r.id)??0)+1;mt.set(r.id,n),r.id=n+"-"+r.id,_t.push(r)}else{r.label||(r.type==="composite"?r.label="":r.label=r.id);const n=G.get(r.id);if(n===void 0?G.set(r.id,r):(r.type!=="na"&&(n.type=r.type),r.label!==r.id&&(n.label=r.label)),r.children&&Zt(r.children,r),r.type==="space"){const l=r.width??1;for(let d=0;d<l;d++){const g=er(r);g.id=g.id+"-"+d,G.set(g.id,g),s.push(g)}}else n===void 0&&s.push(r)}}t.children=s},"populateBlockDatabase"),Tt=[],nt={id:"root",type:"composite",children:[],columns:-1},dr=u(()=>{v.debug("Clear called"),He(),nt={id:"root",type:"composite",children:[],columns:-1},G=new Map([["root",nt]]),Tt=[],gt=new Map,_t=[],mt=new Map,kt=""},"clear");function Gt(e){switch(v.debug("typeStr2Type",e),e){case"[]":return"square";case"()":return v.debug("we have a round"),"round";case"(())":return"circle";case">]":return"rect_left_inv_arrow";case"{}":return"diamond";case"{{}}":return"hexagon";case"([])":return"stadium";case"[[]]":return"subroutine";case"[()]":return"cylinder";case"((()))":return"doublecircle";case"[//]":return"lean_right";case"[\\\\]":return"lean_left";case"[/\\]":return"trapezoid";case"[\\/]":return"inv_trapezoid";case"<[]>":return"block_arrow";default:return"na"}}u(Gt,"typeStr2Type");function qt(e){switch(v.debug("typeStr2Type",e),e){case"==":return"thick";default:return"normal"}}u(qt,"edgeTypeStr2Type");function Jt(e){switch(e.trim().slice(-1)){case"x":return"arrow_cross";case"o":return"arrow_circle";case">":return"arrow_point";default:return""}}u(Jt,"edgeStrToEdgeData");function Qt(e){switch(e.trim().charAt(0)){case"x":return"arrow_cross";case"o":return"arrow_circle";case"<":return"arrow_point";default:return"arrow_open"}}u(Qt,"edgeStrToEdgeStartData");function $t(e){return e.includes("==")?"thick":"normal"}u($t,"edgeStrToThickness");function te(e){return e.includes(".-")?"dotted":"solid"}u(te,"edgeStrToPattern");var Mt=0,pr=u(()=>(Mt++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Mt),"generateId"),fr=u(e=>{nt.children=e,Zt(e,nt),Tt=nt.children},"setHierarchy"),yr=u(e=>{const t=G.get(e);return t?t.columns?t.columns:t.children?t.children.length:-1:-1},"getColumns"),xr=u(()=>[...G.values()],"getBlocksFlat"),br=u(()=>Tt||[],"getBlocks"),wr=u(()=>_t,"getEdges"),mr=u(e=>G.get(e),"getBlock"),Sr=u(e=>{G.set(e.id,e)},"setBlock"),Lr=u(e=>{kt=e},"setDiagramId"),vr=u(()=>kt,"getDiagramId"),Er=u(()=>v,"getLogger"),_r=u(function(){return gt},"getClasses"),kr={getConfig:u(()=>ct().block,"getConfig"),typeStr2Type:Gt,edgeTypeStr2Type:qt,edgeStrToEdgeData:Jt,edgeStrToEdgeStartData:Qt,edgeStrToThickness:$t,edgeStrToPattern:te,getLogger:Er,getBlocksFlat:xr,getBlocks:br,getEdges:wr,setHierarchy:fr,getBlock:mr,setBlock:Sr,getColumns:yr,getClasses:_r,clear:dr,generateId:pr,setDiagramId:Lr,getDiagramId:vr},Tr=kr,bt=u((e,t)=>{const a=$e,s=a(e,"r"),i=a(e,"g"),c=a(e,"b");return Ke(s,i,c,t)},"fade"),Dr=u(e=>`.label {
6
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:u(function(){var p=this.next();return p||this.lex()},"lex"),begin:u(function(p){this.conditionStack.push(p)},"begin"),popState:u(function(){var p=this.conditionStack.length-1;return p>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:u(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:u(function(p){return p=this.conditionStack.length-1-Math.abs(p||0),p>=0?this.conditionStack[p]:"INITIAL"},"topState"),pushState:u(function(p){this.begin(p)},"pushState"),stateStackSize:u(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:u(function(p,f,S,E){switch(S){case 0:return p.getLogger().debug("Found block-beta"),10;case 1:return p.getLogger().debug("Found id-block"),29;case 2:return p.getLogger().debug("Found block"),10;case 3:p.getLogger().debug(".",f.yytext);break;case 4:p.getLogger().debug("_",f.yytext);break;case 5:return 5;case 6:return f.yytext=-1,28;case 7:return f.yytext=f.yytext.replace(/columns\s+/,""),p.getLogger().debug("COLUMNS (LEX)",f.yytext),28;case 8:this.pushState("md_string");break;case 9:return"MD_STR";case 10:this.popState();break;case 11:this.pushState("string");break;case 12:p.getLogger().debug("LEX: POPPING STR:",f.yytext),this.popState();break;case 13:return p.getLogger().debug("LEX: STR end:",f.yytext),"STR";case 14:return f.yytext=f.yytext.replace(/space\:/,""),p.getLogger().debug("SPACE NUM (LEX)",f.yytext),21;case 15:return f.yytext="1",p.getLogger().debug("COLUMNS (LEX)",f.yytext),21;case 16:return 42;case 17:return"LINKSTYLE";case 18:return"INTERPOLATE";case 19:return this.pushState("CLASSDEF"),39;case 20:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 21:return this.popState(),this.pushState("CLASSDEFID"),40;case 22:return this.popState(),41;case 23:return this.pushState("CLASS"),43;case 24:return this.popState(),this.pushState("CLASS_STYLE"),44;case 25:return this.popState(),45;case 26:return this.pushState("STYLE_STMNT"),46;case 27:return this.popState(),this.pushState("STYLE_DEFINITION"),47;case 28:return this.popState(),48;case 29:return this.pushState("acc_title"),"acc_title";case 30:return this.popState(),"acc_title_value";case 31:return this.pushState("acc_descr"),"acc_descr";case 32:return this.popState(),"acc_descr_value";case 33:this.pushState("acc_descr_multiline");break;case 34:this.popState();break;case 35:return"acc_descr_multiline_value";case 36:return 30;case 37:return this.popState(),p.getLogger().debug("Lex: (("),"NODE_DEND";case 38:return this.popState(),p.getLogger().debug("Lex: (("),"NODE_DEND";case 39:return this.popState(),p.getLogger().debug("Lex: ))"),"NODE_DEND";case 40:return this.popState(),p.getLogger().debug("Lex: (("),"NODE_DEND";case 41:return this.popState(),p.getLogger().debug("Lex: (("),"NODE_DEND";case 42:return this.popState(),p.getLogger().debug("Lex: (-"),"NODE_DEND";case 43:return this.popState(),p.getLogger().debug("Lex: -)"),"NODE_DEND";case 44:return this.popState(),p.getLogger().debug("Lex: (("),"NODE_DEND";case 45:return this.popState(),p.getLogger().debug("Lex: ]]"),"NODE_DEND";case 46:return this.popState(),p.getLogger().debug("Lex: ("),"NODE_DEND";case 47:return this.popState(),p.getLogger().debug("Lex: ])"),"NODE_DEND";case 48:return this.popState(),p.getLogger().debug("Lex: /]"),"NODE_DEND";case 49:return this.popState(),p.getLogger().debug("Lex: /]"),"NODE_DEND";case 50:return this.popState(),p.getLogger().debug("Lex: )]"),"NODE_DEND";case 51:return this.popState(),p.getLogger().debug("Lex: )"),"NODE_DEND";case 52:return this.popState(),p.getLogger().debug("Lex: ]>"),"NODE_DEND";case 53:return this.popState(),p.getLogger().debug("Lex: ]"),"NODE_DEND";case 54:return p.getLogger().debug("Lexa: -)"),this.pushState("NODE"),35;case 55:return p.getLogger().debug("Lexa: (-"),this.pushState("NODE"),35;case 56:return p.getLogger().debug("Lexa: ))"),this.pushState("NODE"),35;case 57:return p.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 58:return p.getLogger().debug("Lex: ((("),this.pushState("NODE"),35;case 59:return p.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 60:return p.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 61:return p.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 62:return p.getLogger().debug("Lexc: >"),this.pushState("NODE"),35;case 63:return p.getLogger().debug("Lexa: (["),this.pushState("NODE"),35;case 64:return p.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 65:return this.pushState("NODE"),35;case 66:return this.pushState("NODE"),35;case 67:return this.pushState("NODE"),35;case 68:return this.pushState("NODE"),35;case 69:return this.pushState("NODE"),35;case 70:return this.pushState("NODE"),35;case 71:return this.pushState("NODE"),35;case 72:return p.getLogger().debug("Lexa: ["),this.pushState("NODE"),35;case 73:return this.pushState("BLOCK_ARROW"),p.getLogger().debug("LEX ARR START"),37;case 74:return p.getLogger().debug("Lex: NODE_ID",f.yytext),31;case 75:return p.getLogger().debug("Lex: EOF",f.yytext),8;case 76:this.pushState("md_string");break;case 77:this.pushState("md_string");break;case 78:return"NODE_DESCR";case 79:this.popState();break;case 80:p.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 81:p.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 82:return p.getLogger().debug("LEX: NODE_DESCR:",f.yytext),"NODE_DESCR";case 83:p.getLogger().debug("LEX POPPING"),this.popState();break;case 84:p.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 85:return f.yytext=f.yytext.replace(/^,\s*/,""),p.getLogger().debug("Lex (right): dir:",f.yytext),"DIR";case 86:return f.yytext=f.yytext.replace(/^,\s*/,""),p.getLogger().debug("Lex (left):",f.yytext),"DIR";case 87:return f.yytext=f.yytext.replace(/^,\s*/,""),p.getLogger().debug("Lex (x):",f.yytext),"DIR";case 88:return f.yytext=f.yytext.replace(/^,\s*/,""),p.getLogger().debug("Lex (y):",f.yytext),"DIR";case 89:return f.yytext=f.yytext.replace(/^,\s*/,""),p.getLogger().debug("Lex (up):",f.yytext),"DIR";case 90:return f.yytext=f.yytext.replace(/^,\s*/,""),p.getLogger().debug("Lex (down):",f.yytext),"DIR";case 91:return f.yytext="]>",p.getLogger().debug("Lex (ARROW_DIR end):",f.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";case 92:return p.getLogger().debug("Lex: LINK","#"+f.yytext+"#"),15;case 93:return p.getLogger().debug("Lex: LINK",f.yytext),15;case 94:return p.getLogger().debug("Lex: LINK",f.yytext),15;case 95:return p.getLogger().debug("Lex: LINK",f.yytext),15;case 96:return p.getLogger().debug("Lex: START_LINK",f.yytext),this.pushState("LLABEL"),16;case 97:return p.getLogger().debug("Lex: START_LINK",f.yytext),this.pushState("LLABEL"),16;case 98:return p.getLogger().debug("Lex: START_LINK",f.yytext),this.pushState("LLABEL"),16;case 99:this.pushState("md_string");break;case 100:return p.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";case 101:return this.popState(),p.getLogger().debug("Lex: LINK","#"+f.yytext+"#"),15;case 102:return this.popState(),p.getLogger().debug("Lex: LINK",f.yytext),15;case 103:return this.popState(),p.getLogger().debug("Lex: LINK",f.yytext),15;case 104:return p.getLogger().debug("Lex: COLON",f.yytext),f.yytext=f.yytext.slice(1),27}},"anonymous"),rules:[/^(?:block-beta\b)/,/^(?:block:)/,/^(?:block\b)/,/^(?:[\s]+)/,/^(?:[\n]+)/,/^(?:((\u000D\u000A)|(\u000A)))/,/^(?:columns\s+auto\b)/,/^(?:columns\s+[\d]+)/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:space[:]\d+)/,/^(?:space\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\s+)/,/^(?:DEFAULT\s+)/,/^(?:\w+\s+)/,/^(?:[^\n]*)/,/^(?:class\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:style\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:end\b\s*)/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:[\)]\))/,/^(?:\}\})/,/^(?:\})/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\()/,/^(?:\]\])/,/^(?:\()/,/^(?:\]\))/,/^(?:\\\])/,/^(?:\/\])/,/^(?:\)\])/,/^(?:[\)])/,/^(?:\]>)/,/^(?:[\]])/,/^(?:-\))/,/^(?:\(-)/,/^(?:\)\))/,/^(?:\))/,/^(?:\(\(\()/,/^(?:\(\()/,/^(?:\{\{)/,/^(?:\{)/,/^(?:>)/,/^(?:\(\[)/,/^(?:\()/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\[\\)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:\[)/,/^(?:<\[)/,/^(?:[^\(\[\n\-\)\{\}\s\<\>:=]+)/,/^(?:$)/,/^(?:["][`])/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:\]>\s*\()/,/^(?:,?\s*right\s*)/,/^(?:,?\s*left\s*)/,/^(?:,?\s*x\s*)/,/^(?:,?\s*y\s*)/,/^(?:,?\s*up\s*)/,/^(?:,?\s*down\s*)/,/^(?:\)\s*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*~~[\~]+\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:["][`])/,/^(?:["])/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?::\d+)/],conditions:{STYLE_DEFINITION:{rules:[28],inclusive:!1},STYLE_STMNT:{rules:[27],inclusive:!1},CLASSDEFID:{rules:[22],inclusive:!1},CLASSDEF:{rules:[20,21],inclusive:!1},CLASS_STYLE:{rules:[25],inclusive:!1},CLASS:{rules:[24],inclusive:!1},LLABEL:{rules:[99,100,101,102,103],inclusive:!1},ARROW_DIR:{rules:[85,86,87,88,89,90,91],inclusive:!1},BLOCK_ARROW:{rules:[76,81,84],inclusive:!1},NODE:{rules:[37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,77,80],inclusive:!1},md_string:{rules:[9,10,78,79],inclusive:!1},space:{rules:[],inclusive:!1},string:{rules:[12,13,82,83],inclusive:!1},acc_descr_multiline:{rules:[34,35],inclusive:!1},acc_descr:{rules:[32],inclusive:!1},acc_title:{rules:[30],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,11,14,15,16,17,18,19,23,26,29,31,33,36,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,92,93,94,95,96,97,98,104],inclusive:!0}}};return N})();L.lexer=C;function I(){this.yy={}}return u(I,"Parser"),I.prototype=L,L.Parser=I,new I})();wt.parser=wt;var nr=wt,Z=new Map,_t=[],mt=new Map,At="color",zt="fill",cr="bgFill",jt=",",lr=M(),gt=new Map,kt="",or=u(e=>Ze.sanitizeText(e,lr),"sanitizeText"),hr=u(function(e,t=""){let a=gt.get(e);a||(a={id:e,styles:[],textStyles:[]},gt.set(e,a)),t!=null&&t.split(jt).forEach(s=>{const i=s.replace(/([^;]*);/,"$1").trim();if(RegExp(At).exec(s)){const r=i.replace(zt,cr).replace(At,zt);a.textStyles.push(r)}a.styles.push(i)})},"addStyleClass"),gr=u(function(e,t=""){const a=Z.get(e);t!=null&&(a.styles=t.split(jt))},"addStyle2Node"),ur=u(function(e,t){e.split(",").forEach(function(a){let s=Z.get(a);if(s===void 0){const i=a.trim();s={id:i,type:"na",children:[]},Z.set(i,s)}s.classes||(s.classes=[]),s.classes.push(t)})},"setCssClass"),Gt=u((e,t)=>{const a=e.flat(),s=[],i=a.find(r=>(r==null?void 0:r.type)==="column-setting"),c=(i==null?void 0:i.columns)??-1;for(const r of a){if(typeof c=="number"&&c>0&&r.type!=="column-setting"&&typeof r.widthInColumns=="number"&&r.widthInColumns>c&&v.warn(`Block ${r.id} width ${r.widthInColumns} exceeds configured column width ${c}`),r.label&&(r.label=or(r.label)),r.type==="classDef"){hr(r.id,r.css);continue}if(r.type==="applyClass"){ur(r.id,(r==null?void 0:r.styleClass)??"");continue}if(r.type==="applyStyles"){r!=null&&r.stylesStr&&gr(r.id,r==null?void 0:r.stylesStr);continue}if(r.type==="column-setting")t.columns=r.columns??-1;else if(r.type==="edge"){const n=(mt.get(r.id)??0)+1;mt.set(r.id,n),r.id=n+"-"+r.id,_t.push(r)}else{r.label||(r.type==="composite"?r.label="":r.label=r.id);const n=Z.get(r.id);if(n===void 0?Z.set(r.id,r):(r.type!=="na"&&(n.type=r.type),r.label!==r.id&&(n.label=r.label)),r.children&&Gt(r.children,r),r.type==="space"){const l=r.width??1;for(let d=0;d<l;d++){const g=er(r);g.id=g.id+"-"+d,Z.set(g.id,g),s.push(g)}}else n===void 0&&s.push(r)}}t.children=s},"populateBlockDatabase"),Tt=[],nt={id:"root",type:"composite",children:[],columns:-1},dr=u(()=>{v.debug("Clear called"),He(),nt={id:"root",type:"composite",children:[],columns:-1},Z=new Map([["root",nt]]),Tt=[],gt=new Map,_t=[],mt=new Map,kt=""},"clear");function Zt(e){switch(v.debug("typeStr2Type",e),e){case"[]":return"square";case"()":return v.debug("we have a round"),"round";case"(())":return"circle";case">]":return"rect_left_inv_arrow";case"{}":return"diamond";case"{{}}":return"hexagon";case"([])":return"stadium";case"[[]]":return"subroutine";case"[()]":return"cylinder";case"((()))":return"doublecircle";case"[//]":return"lean_right";case"[\\\\]":return"lean_left";case"[/\\]":return"trapezoid";case"[\\/]":return"inv_trapezoid";case"<[]>":return"block_arrow";default:return"na"}}u(Zt,"typeStr2Type");function qt(e){switch(v.debug("typeStr2Type",e),e){case"==":return"thick";default:return"normal"}}u(qt,"edgeTypeStr2Type");function Jt(e){switch(e.trim().slice(-1)){case"x":return"arrow_cross";case"o":return"arrow_circle";case">":return"arrow_point";default:return""}}u(Jt,"edgeStrToEdgeData");function Qt(e){switch(e.trim().charAt(0)){case"x":return"arrow_cross";case"o":return"arrow_circle";case"<":return"arrow_point";default:return"arrow_open"}}u(Qt,"edgeStrToEdgeStartData");function $t(e){return e.includes("==")?"thick":"normal"}u($t,"edgeStrToThickness");function te(e){return e.includes(".-")?"dotted":"solid"}u(te,"edgeStrToPattern");var Mt=0,pr=u(()=>(Mt++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Mt),"generateId"),fr=u(e=>{nt.children=e,Gt(e,nt),Tt=nt.children},"setHierarchy"),yr=u(e=>{const t=Z.get(e);return t?t.columns?t.columns:t.children?t.children.length:-1:-1},"getColumns"),xr=u(()=>[...Z.values()],"getBlocksFlat"),br=u(()=>Tt||[],"getBlocks"),wr=u(()=>_t,"getEdges"),mr=u(e=>Z.get(e),"getBlock"),Sr=u(e=>{Z.set(e.id,e)},"setBlock"),Lr=u(e=>{kt=e},"setDiagramId"),vr=u(()=>kt,"getDiagramId"),Er=u(()=>v,"getLogger"),_r=u(function(){return gt},"getClasses"),kr={getConfig:u(()=>ct().block,"getConfig"),typeStr2Type:Zt,edgeTypeStr2Type:qt,edgeStrToEdgeData:Jt,edgeStrToEdgeStartData:Qt,edgeStrToThickness:$t,edgeStrToPattern:te,getLogger:Er,getBlocksFlat:xr,getBlocks:br,getEdges:wr,setHierarchy:fr,getBlock:mr,setBlock:Sr,getColumns:yr,getClasses:_r,clear:dr,generateId:pr,setDiagramId:Lr,getDiagramId:vr},Tr=kr,bt=u((e,t)=>{const a=$e,s=a(e,"r"),i=a(e,"g"),c=a(e,"b");return Ke(s,i,c,t)},"fade"),Dr=u(e=>`.label {
7
7
  font-family: ${e.fontFamily};
8
8
  color: ${e.nodeTextColor||e.textColor};
9
9
  }
@@ -126,7 +126,7 @@ Expecting `+ot.join(", ")+", got '"+(this.terminals_[K]||K)+"'":yt="Parse error
126
126
  fill: ${e.textColor};
127
127
  }
128
128
  ${ye()}
129
- `,"getStyles"),Nr=Dr,Ir=u((e,t,a,s)=>{t.forEach(i=>{Wr[i](e,a,s)})},"insertMarkers"),Cr=u((e,t,a)=>{v.trace("Making markers for ",a),e.append("defs").append("marker").attr("id",a+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),Br=u((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),Or=u((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),Rr=u((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),Ar=u((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",a+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),zr=u((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",6).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),Mr=u((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),Pr=u((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),Fr=u((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),Wr={extension:Cr,composition:Br,aggregation:Or,dependency:Rr,lollipop:Ar,point:zr,circle:Mr,cross:Pr,barb:Fr},Yr=Ir,Ut,Xt,z=((Xt=(Ut=M())==null?void 0:Ut.block)==null?void 0:Xt.padding)??8;function St(e,t){if(e===0||!Number.isInteger(e))throw new Error("Columns must be an integer !== 0.");if(t<0||!Number.isInteger(t))throw new Error("Position must be a non-negative integer."+t);if(e<0)return{px:t,py:0};if(e===1)return{px:0,py:t};const a=t%e,s=Math.floor(t/e);return{px:a,py:s}}u(St,"calculateBlockPosition");var Hr=u(e=>{let t=0,a=0;for(const s of e.children){const{width:i,height:c,x:r,y:n}=s.size??{width:0,height:0,x:0,y:0};if(v.debug("getMaxChildSize abc95 child:",s.id,"width:",i,"height:",c,"x:",r,"y:",n,s.type),s.type==="space")continue;const l=i/(s.widthInColumns??1);l>t&&(t=l),c>a&&(a=c)}return{width:t,height:a}},"getMaxChildSize");function ut(e,t,a=0,s=0){var r,n,l,d,g,y,w,b,m,_,L;v.debug("setBlockSizes abc95 (start)",e.id,(r=e==null?void 0:e.size)==null?void 0:r.x,"block width =",e==null?void 0:e.size,"siblingWidth",a),(n=e==null?void 0:e.size)!=null&&n.width||(e.size={width:a,height:s,x:0,y:0});let i=0,c=0;if(((l=e.children)==null?void 0:l.length)>0){for(const E of e.children)ut(E,t);const C=Hr(e);i=C.width,c=C.height,v.debug("setBlockSizes abc95 maxWidth of",e.id,":s children is ",i,c);for(const E of e.children)E.size&&(v.debug(`abc95 Setting size of children of ${e.id} id=${E.id} ${i} ${c} ${JSON.stringify(E.size)}`),E.size.width=i*(E.widthInColumns??1)+z*((E.widthInColumns??1)-1),E.size.height=c,E.size.x=0,E.size.y=0,v.debug(`abc95 updating size of ${e.id} children child:${E.id} maxWidth:${i} maxHeight:${c}`));for(const E of e.children)ut(E,t,i,c);const I=e.columns??-1;let N=0;for(const E of e.children)N+=E.widthInColumns??1;let x=e.children.length;I>0&&I<N&&(x=I);const p=Math.ceil(N/x);let f=x*(i+z)+z,S=p*(c+z)+z;if(f<a){v.debug(`Detected to small sibling: abc95 ${e.id} siblingWidth ${a} siblingHeight ${s} width ${f}`),f=a,S=s;const E=(a-x*z-z)/x,o=(s-p*z-z)/p;v.debug("Size indata abc88",e.id,"childWidth",E,"maxWidth",i),v.debug("Size indata abc88",e.id,"childHeight",o,"maxHeight",c),v.debug("Size indata abc88 xSize",x,"padding",z);for(const k of e.children)k.size&&(k.size.width=E,k.size.height=o,k.size.x=0,k.size.y=0)}if(v.debug(`abc95 (finale calc) ${e.id} xSize ${x} ySize ${p} columns ${I}${e.children.length} width=${Math.max(f,((d=e.size)==null?void 0:d.width)||0)}`),f<(((g=e==null?void 0:e.size)==null?void 0:g.width)||0)){f=((y=e==null?void 0:e.size)==null?void 0:y.width)||0;const E=I>0?Math.min(e.children.length,I):e.children.length;if(E>0){const o=(f-E*z-z)/E;v.debug("abc95 (growing to fit) width",e.id,f,(w=e.size)==null?void 0:w.width,o);for(const k of e.children)k.size&&(k.size.width=o)}}e.size={width:f,height:S,x:0,y:0}}v.debug("setBlockSizes abc94 (done)",e.id,(b=e==null?void 0:e.size)==null?void 0:b.x,(m=e==null?void 0:e.size)==null?void 0:m.width,(_=e==null?void 0:e.size)==null?void 0:_.y,(L=e==null?void 0:e.size)==null?void 0:L.height)}u(ut,"setBlockSizes");function Dt(e,t){var s,i,c,r,n,l,d,g,y,w,b,m,_,L,C,I,N;v.debug(`abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${(s=e==null?void 0:e.size)==null?void 0:s.x} y: ${(i=e==null?void 0:e.size)==null?void 0:i.y} width: ${(c=e==null?void 0:e.size)==null?void 0:c.width}`);const a=e.columns??-1;if(v.debug("layoutBlocks columns abc95",e.id,"=>",a,e),e.children&&e.children.length>0){const x=((n=(r=e==null?void 0:e.children[0])==null?void 0:r.size)==null?void 0:n.width)??0,p=e.children.length*x+(e.children.length-1)*z;v.debug("widthOfChildren 88",p,"posX");const f=new Map;{let h=0;for(const T of e.children){if(!T.size)continue;const{py:D}=St(a,h),U=f.get(D)??0;T.size.height>U&&f.set(D,T.size.height);let F=(T==null?void 0:T.widthInColumns)??1;a>0&&(F=Math.min(F,a-h%a)),h+=F}}const S=new Map;{let h=0;const T=[...f.keys()].sort((D,U)=>D-U);for(const D of T)S.set(D,h),h+=(f.get(D)??0)+z}let E=0;v.debug("abc91 block?.size?.x",e.id,(l=e==null?void 0:e.size)==null?void 0:l.x);let o=(d=e==null?void 0:e.size)!=null&&d.x?((g=e==null?void 0:e.size)==null?void 0:g.x)+(-((y=e==null?void 0:e.size)==null?void 0:y.width)/2||0):-z,k=0;for(const h of e.children){const T=e;if(!h.size)continue;const{width:D,height:U}=h.size,{px:F,py:J}=St(a,E);if(J!=k&&(k=J,o=(w=e==null?void 0:e.size)!=null&&w.x?((b=e==null?void 0:e.size)==null?void 0:b.x)+(-((m=e==null?void 0:e.size)==null?void 0:m.width)/2||0):-z,v.debug("New row in layout for block",e.id," and child ",h.id,k)),v.debug(`abc89 layout blocks (child) id: ${h.id} Pos: ${E} (px, py) ${F},${J} (${(_=T==null?void 0:T.size)==null?void 0:_.x},${(L=T==null?void 0:T.size)==null?void 0:L.y}) parent: ${T.id} width: ${D}${z}`),T.size){const Y=D/2;h.size.x=o+z+Y,v.debug(`abc91 layout blocks (calc) px, pyid:${h.id} startingPos=X${o} new startingPosX${h.size.x} ${Y} padding=${z} width=${D} halfWidth=${Y} => x:${h.size.x} y:${h.size.y} ${h.widthInColumns} (width * (child?.w || 1)) / 2 ${D*((h==null?void 0:h.widthInColumns)??1)/2}`),o=h.size.x+Y;const et=S.get(J)??0,rt=f.get(J)??U;h.size.y=T.size.y-T.size.height/2+et+rt/2+z,v.debug(`abc88 layout blocks (calc) px, pyid:${h.id}startingPosX${o}${z}${Y}=>x:${h.size.x}y:${h.size.y}${h.widthInColumns}(width * (child?.w || 1)) / 2${D*((h==null?void 0:h.widthInColumns)??1)/2}`)}h.children&&Dt(h);let B=(h==null?void 0:h.widthInColumns)??1;a>0&&(B=Math.min(B,a-E%a)),E+=B,v.debug("abc88 columnsPos",h,E)}}v.debug(`layout blocks (<==layoutBlocks) ${e.id} x: ${(C=e==null?void 0:e.size)==null?void 0:C.x} y: ${(I=e==null?void 0:e.size)==null?void 0:I.y} width: ${(N=e==null?void 0:e.size)==null?void 0:N.width}`)}u(Dt,"layoutBlocks");function Nt(e,{minX:t,minY:a,maxX:s,maxY:i}={minX:0,minY:0,maxX:0,maxY:0}){if(e.size&&e.id!=="root"){const{x:c,y:r,width:n,height:l}=e.size;c-n/2<t&&(t=c-n/2),r-l/2<a&&(a=r-l/2),c+n/2>s&&(s=c+n/2),r+l/2>i&&(i=r+l/2)}if(e.children)for(const c of e.children)({minX:t,minY:a,maxX:s,maxY:i}=Nt(c,{minX:t,minY:a,maxX:s,maxY:i}));return{minX:t,minY:a,maxX:s,maxY:i}}u(Nt,"findBounds");function ee(e){const t=e.getBlock("root");if(!t)return;ut(t,e,0,0),Dt(t),v.debug("getBlocks",JSON.stringify(t,null,2));const{minX:a,minY:s,maxX:i,maxY:c}=Nt(t),r=c-s,n=i-a;return{x:a,y:s,width:n,height:r}}u(ee,"layout");var Kr=u(async(e,t,a,s=!1,i=!1)=>{let c=t||"";typeof c=="object"&&(c=c[0]);const r=M(),n=H(r);return await Et(e,c,{style:a,isTitle:s,useHtmlLabels:n,markdown:!1,isNode:i,width:Number.POSITIVE_INFINITY},r)},"createLabel"),Z=Kr,Ur=u((e,t,a,s,i)=>{t.arrowTypeStart&&Pt(e,"start",t.arrowTypeStart,a,s,i),t.arrowTypeEnd&&Pt(e,"end",t.arrowTypeEnd,a,s,i)},"addEdgeMarkers"),Xr={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},Pt=u((e,t,a,s,i,c)=>{const r=Xr[a];if(!r){v.warn(`Unknown arrow type: ${a}`);return}const n=t==="start"?"Start":"End";e.attr(`marker-${t}`,`url(${s}#${i}_${c}-${r}${n})`)},"addEdgeMarker"),Lt={},W={},Vr=u(async(e,t)=>{const a=M(),s=H(a),i=e.insert("g").attr("class","edgeLabel"),c=i.insert("g").attr("class","label"),r=t.labelType==="markdown",n=await Et(e,t.label,{style:t.labelStyle,useHtmlLabels:s,addSvgBackground:r,isNode:!1,markdown:r,width:r?void 0:Number.POSITIVE_INFINITY},a);c.node().appendChild(n);let l=n.getBBox(),d=l;if(s){const y=n.children[0],w=O(n);l=y.getBoundingClientRect(),d=l,w.attr("width",l.width),w.attr("height",l.height)}else{const y=O(n).select("text").node();y&&typeof y.getBBox=="function"&&(d=y.getBBox())}c.attr("transform",at(d,s)),Lt[t.id]=i,t.width=l.width,t.height=l.height;let g;if(t.startLabelLeft){const y=e.insert("g").attr("class","edgeTerminals"),w=y.insert("g").attr("class","inner"),b=await Z(w,t.startLabelLeft,t.labelStyle);g=b;let m=b.getBBox();if(s){const _=b.children[0],L=O(b);m=_.getBoundingClientRect(),L.attr("width",m.width),L.attr("height",m.height)}w.attr("transform",at(m,s)),W[t.id]||(W[t.id]={}),W[t.id].startLeft=y,it(g,t.startLabelLeft)}if(t.startLabelRight){const y=e.insert("g").attr("class","edgeTerminals"),w=y.insert("g").attr("class","inner"),b=await Z(w,t.startLabelRight,t.labelStyle);g=b;let m=b.getBBox();if(s){const _=b.children[0],L=O(b);m=_.getBoundingClientRect(),L.attr("width",m.width),L.attr("height",m.height)}w.attr("transform",at(m,s)),W[t.id]||(W[t.id]={}),W[t.id].startRight=y,it(g,t.startLabelRight)}if(t.endLabelLeft){const y=e.insert("g").attr("class","edgeTerminals"),w=y.insert("g").attr("class","inner"),b=await Z(y,t.endLabelLeft,t.labelStyle);g=b;let m=b.getBBox();if(s){const _=b.children[0],L=O(b);m=_.getBoundingClientRect(),L.attr("width",m.width),L.attr("height",m.height)}w.attr("transform",at(m,s)),W[t.id]||(W[t.id]={}),W[t.id].endLeft=y,it(g,t.endLabelLeft)}if(t.endLabelRight){const y=e.insert("g").attr("class","edgeTerminals"),w=y.insert("g").attr("class","inner"),b=await Z(y,t.endLabelRight,t.labelStyle);g=b;let m=b.getBBox();if(s){const _=b.children[0],L=O(b);m=_.getBoundingClientRect(),L.attr("width",m.width),L.attr("height",m.height)}w.attr("transform",at(m,s)),W[t.id]||(W[t.id]={}),W[t.id].endRight=y,it(g,t.endLabelRight)}return n},"insertEdgeLabel");function it(e,t){H(M())&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}u(it,"setTerminalWidth");var jr=u((e,t)=>{v.debug("Moving label abc88 ",e.id,e.label,Lt[e.id],t);let a=t.updatedPath?t.updatedPath:t.originalPath;const s=M(),{subGraphTitleTotalMargin:i}=Ze(s);if(e.label){const c=Lt[e.id];let r=e.x,n=e.y;if(a){const l=st.calcLabelPosition(a);v.debug("Moving label "+e.label+" from (",r,",",n,") to (",l.x,",",l.y,") abc88"),t.updatedPath&&(r=l.x,n=l.y)}c.attr("transform",`translate(${r}, ${n+i/2})`)}if(e.startLabelLeft){const c=W[e.id].startLeft;let r=e.x,n=e.y;if(a){const l=st.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",a);r=l.x,n=l.y}c.attr("transform",`translate(${r}, ${n})`)}if(e.startLabelRight){const c=W[e.id].startRight;let r=e.x,n=e.y;if(a){const l=st.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",a);r=l.x,n=l.y}c.attr("transform",`translate(${r}, ${n})`)}if(e.endLabelLeft){const c=W[e.id].endLeft;let r=e.x,n=e.y;if(a){const l=st.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",a);r=l.x,n=l.y}c.attr("transform",`translate(${r}, ${n})`)}if(e.endLabelRight){const c=W[e.id].endRight;let r=e.x,n=e.y;if(a){const l=st.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",a);r=l.x,n=l.y}c.attr("transform",`translate(${r}, ${n})`)}},"positionEdgeLabel"),Zr=u((e,t)=>{const a=e.x,s=e.y,i=Math.abs(t.x-a),c=Math.abs(t.y-s),r=e.width/2,n=e.height/2;return i>=r||c>=n},"outsideNode"),Gr=u((e,t,a)=>{v.debug(`intersection calc abc89:
129
+ `,"getStyles"),Nr=Dr,Ir=u((e,t,a,s)=>{t.forEach(i=>{Wr[i](e,a,s)})},"insertMarkers"),Cr=u((e,t,a)=>{v.trace("Making markers for ",a),e.append("defs").append("marker").attr("id",a+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),Br=u((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),Or=u((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),Rr=u((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),Ar=u((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",a+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),zr=u((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",6).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),Mr=u((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),Pr=u((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),Fr=u((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),Wr={extension:Cr,composition:Br,aggregation:Or,dependency:Rr,lollipop:Ar,point:zr,circle:Mr,cross:Pr,barb:Fr},Yr=Ir,Ut,Xt,z=((Xt=(Ut=M())==null?void 0:Ut.block)==null?void 0:Xt.padding)??8;function St(e,t){if(e===0||!Number.isInteger(e))throw new Error("Columns must be an integer !== 0.");if(t<0||!Number.isInteger(t))throw new Error("Position must be a non-negative integer."+t);if(e<0)return{px:t,py:0};if(e===1)return{px:0,py:t};const a=t%e,s=Math.floor(t/e);return{px:a,py:s}}u(St,"calculateBlockPosition");var Hr=u(e=>{let t=0,a=0;for(const s of e.children){const{width:i,height:c,x:r,y:n}=s.size??{width:0,height:0,x:0,y:0};if(v.debug("getMaxChildSize abc95 child:",s.id,"width:",i,"height:",c,"x:",r,"y:",n,s.type),s.type==="space")continue;const l=i/(s.widthInColumns??1);l>t&&(t=l),c>a&&(a=c)}return{width:t,height:a}},"getMaxChildSize");function ut(e,t,a=0,s=0){var r,n,l,d,g,y,w,b,m,_,L;v.debug("setBlockSizes abc95 (start)",e.id,(r=e==null?void 0:e.size)==null?void 0:r.x,"block width =",e==null?void 0:e.size,"siblingWidth",a),(n=e==null?void 0:e.size)!=null&&n.width||(e.size={width:a,height:s,x:0,y:0});let i=0,c=0;if(((l=e.children)==null?void 0:l.length)>0){for(const E of e.children)ut(E,t);const C=Hr(e);i=C.width,c=C.height,v.debug("setBlockSizes abc95 maxWidth of",e.id,":s children is ",i,c);for(const E of e.children)E.size&&(v.debug(`abc95 Setting size of children of ${e.id} id=${E.id} ${i} ${c} ${JSON.stringify(E.size)}`),E.size.width=i*(E.widthInColumns??1)+z*((E.widthInColumns??1)-1),E.size.height=c,E.size.x=0,E.size.y=0,v.debug(`abc95 updating size of ${e.id} children child:${E.id} maxWidth:${i} maxHeight:${c}`));for(const E of e.children)ut(E,t,i,c);const I=e.columns??-1;let N=0;for(const E of e.children)N+=E.widthInColumns??1;let x=e.children.length;I>0&&I<N&&(x=I);const p=Math.ceil(N/x);let f=x*(i+z)+z,S=p*(c+z)+z;if(f<a){v.debug(`Detected to small sibling: abc95 ${e.id} siblingWidth ${a} siblingHeight ${s} width ${f}`),f=a,S=s;const E=(a-x*z-z)/x,o=(s-p*z-z)/p;v.debug("Size indata abc88",e.id,"childWidth",E,"maxWidth",i),v.debug("Size indata abc88",e.id,"childHeight",o,"maxHeight",c),v.debug("Size indata abc88 xSize",x,"padding",z);for(const k of e.children)k.size&&(k.size.width=E,k.size.height=o,k.size.x=0,k.size.y=0)}if(v.debug(`abc95 (finale calc) ${e.id} xSize ${x} ySize ${p} columns ${I}${e.children.length} width=${Math.max(f,((d=e.size)==null?void 0:d.width)||0)}`),f<(((g=e==null?void 0:e.size)==null?void 0:g.width)||0)){f=((y=e==null?void 0:e.size)==null?void 0:y.width)||0;const E=I>0?Math.min(e.children.length,I):e.children.length;if(E>0){const o=(f-E*z-z)/E;v.debug("abc95 (growing to fit) width",e.id,f,(w=e.size)==null?void 0:w.width,o);for(const k of e.children)k.size&&(k.size.width=o)}}e.size={width:f,height:S,x:0,y:0}}v.debug("setBlockSizes abc94 (done)",e.id,(b=e==null?void 0:e.size)==null?void 0:b.x,(m=e==null?void 0:e.size)==null?void 0:m.width,(_=e==null?void 0:e.size)==null?void 0:_.y,(L=e==null?void 0:e.size)==null?void 0:L.height)}u(ut,"setBlockSizes");function Dt(e,t){var s,i,c,r,n,l,d,g,y,w,b,m,_,L,C,I,N;v.debug(`abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${(s=e==null?void 0:e.size)==null?void 0:s.x} y: ${(i=e==null?void 0:e.size)==null?void 0:i.y} width: ${(c=e==null?void 0:e.size)==null?void 0:c.width}`);const a=e.columns??-1;if(v.debug("layoutBlocks columns abc95",e.id,"=>",a,e),e.children&&e.children.length>0){const x=((n=(r=e==null?void 0:e.children[0])==null?void 0:r.size)==null?void 0:n.width)??0,p=e.children.length*x+(e.children.length-1)*z;v.debug("widthOfChildren 88",p,"posX");const f=new Map;{let h=0;for(const T of e.children){if(!T.size)continue;const{py:D}=St(a,h),U=f.get(D)??0;T.size.height>U&&f.set(D,T.size.height);let F=(T==null?void 0:T.widthInColumns)??1;a>0&&(F=Math.min(F,a-h%a)),h+=F}}const S=new Map;{let h=0;const T=[...f.keys()].sort((D,U)=>D-U);for(const D of T)S.set(D,h),h+=(f.get(D)??0)+z}let E=0;v.debug("abc91 block?.size?.x",e.id,(l=e==null?void 0:e.size)==null?void 0:l.x);let o=(d=e==null?void 0:e.size)!=null&&d.x?((g=e==null?void 0:e.size)==null?void 0:g.x)+(-((y=e==null?void 0:e.size)==null?void 0:y.width)/2||0):-z,k=0;for(const h of e.children){const T=e;if(!h.size)continue;const{width:D,height:U}=h.size,{px:F,py:J}=St(a,E);if(J!=k&&(k=J,o=(w=e==null?void 0:e.size)!=null&&w.x?((b=e==null?void 0:e.size)==null?void 0:b.x)+(-((m=e==null?void 0:e.size)==null?void 0:m.width)/2||0):-z,v.debug("New row in layout for block",e.id," and child ",h.id,k)),v.debug(`abc89 layout blocks (child) id: ${h.id} Pos: ${E} (px, py) ${F},${J} (${(_=T==null?void 0:T.size)==null?void 0:_.x},${(L=T==null?void 0:T.size)==null?void 0:L.y}) parent: ${T.id} width: ${D}${z}`),T.size){const Y=D/2;h.size.x=o+z+Y,v.debug(`abc91 layout blocks (calc) px, pyid:${h.id} startingPos=X${o} new startingPosX${h.size.x} ${Y} padding=${z} width=${D} halfWidth=${Y} => x:${h.size.x} y:${h.size.y} ${h.widthInColumns} (width * (child?.w || 1)) / 2 ${D*((h==null?void 0:h.widthInColumns)??1)/2}`),o=h.size.x+Y;const et=S.get(J)??0,rt=f.get(J)??U;h.size.y=T.size.y-T.size.height/2+et+rt/2+z,v.debug(`abc88 layout blocks (calc) px, pyid:${h.id}startingPosX${o}${z}${Y}=>x:${h.size.x}y:${h.size.y}${h.widthInColumns}(width * (child?.w || 1)) / 2${D*((h==null?void 0:h.widthInColumns)??1)/2}`)}h.children&&Dt(h);let B=(h==null?void 0:h.widthInColumns)??1;a>0&&(B=Math.min(B,a-E%a)),E+=B,v.debug("abc88 columnsPos",h,E)}}v.debug(`layout blocks (<==layoutBlocks) ${e.id} x: ${(C=e==null?void 0:e.size)==null?void 0:C.x} y: ${(I=e==null?void 0:e.size)==null?void 0:I.y} width: ${(N=e==null?void 0:e.size)==null?void 0:N.width}`)}u(Dt,"layoutBlocks");function Nt(e,{minX:t,minY:a,maxX:s,maxY:i}={minX:0,minY:0,maxX:0,maxY:0}){if(e.size&&e.id!=="root"){const{x:c,y:r,width:n,height:l}=e.size;c-n/2<t&&(t=c-n/2),r-l/2<a&&(a=r-l/2),c+n/2>s&&(s=c+n/2),r+l/2>i&&(i=r+l/2)}if(e.children)for(const c of e.children)({minX:t,minY:a,maxX:s,maxY:i}=Nt(c,{minX:t,minY:a,maxX:s,maxY:i}));return{minX:t,minY:a,maxX:s,maxY:i}}u(Nt,"findBounds");function ee(e){const t=e.getBlock("root");if(!t)return;ut(t,e,0,0),Dt(t),v.debug("getBlocks",JSON.stringify(t,null,2));const{minX:a,minY:s,maxX:i,maxY:c}=Nt(t),r=c-s,n=i-a;return{x:a,y:s,width:n,height:r}}u(ee,"layout");var Kr=u(async(e,t,a,s=!1,i=!1)=>{let c=t||"";typeof c=="object"&&(c=c[0]);const r=M(),n=H(r);return await Et(e,c,{style:a,isTitle:s,useHtmlLabels:n,markdown:!1,isNode:i,width:Number.POSITIVE_INFINITY},r)},"createLabel"),G=Kr,Ur=u((e,t,a,s,i)=>{t.arrowTypeStart&&Pt(e,"start",t.arrowTypeStart,a,s,i),t.arrowTypeEnd&&Pt(e,"end",t.arrowTypeEnd,a,s,i)},"addEdgeMarkers"),Xr={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},Pt=u((e,t,a,s,i,c)=>{const r=Xr[a];if(!r){v.warn(`Unknown arrow type: ${a}`);return}const n=t==="start"?"Start":"End";e.attr(`marker-${t}`,`url(${s}#${i}_${c}-${r}${n})`)},"addEdgeMarker"),Lt={},W={},Vr=u(async(e,t)=>{const a=M(),s=H(a),i=e.insert("g").attr("class","edgeLabel"),c=i.insert("g").attr("class","label"),r=t.labelType==="markdown",n=await Et(e,t.label,{style:t.labelStyle,useHtmlLabels:s,addSvgBackground:r,isNode:!1,markdown:r,width:r?void 0:Number.POSITIVE_INFINITY},a);c.node().appendChild(n);let l=n.getBBox(),d=l;if(s){const y=n.children[0],w=O(n);l=y.getBoundingClientRect(),d=l,w.attr("width",l.width),w.attr("height",l.height)}else{const y=O(n).select("text").node();y&&typeof y.getBBox=="function"&&(d=y.getBBox())}c.attr("transform",at(d,s)),Lt[t.id]=i,t.width=l.width,t.height=l.height;let g;if(t.startLabelLeft){const y=e.insert("g").attr("class","edgeTerminals"),w=y.insert("g").attr("class","inner"),b=await G(w,t.startLabelLeft,t.labelStyle);g=b;let m=b.getBBox();if(s){const _=b.children[0],L=O(b);m=_.getBoundingClientRect(),L.attr("width",m.width),L.attr("height",m.height)}w.attr("transform",at(m,s)),W[t.id]||(W[t.id]={}),W[t.id].startLeft=y,it(g,t.startLabelLeft)}if(t.startLabelRight){const y=e.insert("g").attr("class","edgeTerminals"),w=y.insert("g").attr("class","inner"),b=await G(w,t.startLabelRight,t.labelStyle);g=b;let m=b.getBBox();if(s){const _=b.children[0],L=O(b);m=_.getBoundingClientRect(),L.attr("width",m.width),L.attr("height",m.height)}w.attr("transform",at(m,s)),W[t.id]||(W[t.id]={}),W[t.id].startRight=y,it(g,t.startLabelRight)}if(t.endLabelLeft){const y=e.insert("g").attr("class","edgeTerminals"),w=y.insert("g").attr("class","inner"),b=await G(y,t.endLabelLeft,t.labelStyle);g=b;let m=b.getBBox();if(s){const _=b.children[0],L=O(b);m=_.getBoundingClientRect(),L.attr("width",m.width),L.attr("height",m.height)}w.attr("transform",at(m,s)),W[t.id]||(W[t.id]={}),W[t.id].endLeft=y,it(g,t.endLabelLeft)}if(t.endLabelRight){const y=e.insert("g").attr("class","edgeTerminals"),w=y.insert("g").attr("class","inner"),b=await G(y,t.endLabelRight,t.labelStyle);g=b;let m=b.getBBox();if(s){const _=b.children[0],L=O(b);m=_.getBoundingClientRect(),L.attr("width",m.width),L.attr("height",m.height)}w.attr("transform",at(m,s)),W[t.id]||(W[t.id]={}),W[t.id].endRight=y,it(g,t.endLabelRight)}return n},"insertEdgeLabel");function it(e,t){H(M())&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}u(it,"setTerminalWidth");var jr=u((e,t)=>{v.debug("Moving label abc88 ",e.id,e.label,Lt[e.id],t);let a=t.updatedPath?t.updatedPath:t.originalPath;const s=M(),{subGraphTitleTotalMargin:i}=Ge(s);if(e.label){const c=Lt[e.id];let r=e.x,n=e.y;if(a){const l=st.calcLabelPosition(a);v.debug("Moving label "+e.label+" from (",r,",",n,") to (",l.x,",",l.y,") abc88"),t.updatedPath&&(r=l.x,n=l.y)}c.attr("transform",`translate(${r}, ${n+i/2})`)}if(e.startLabelLeft){const c=W[e.id].startLeft;let r=e.x,n=e.y;if(a){const l=st.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",a);r=l.x,n=l.y}c.attr("transform",`translate(${r}, ${n})`)}if(e.startLabelRight){const c=W[e.id].startRight;let r=e.x,n=e.y;if(a){const l=st.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",a);r=l.x,n=l.y}c.attr("transform",`translate(${r}, ${n})`)}if(e.endLabelLeft){const c=W[e.id].endLeft;let r=e.x,n=e.y;if(a){const l=st.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",a);r=l.x,n=l.y}c.attr("transform",`translate(${r}, ${n})`)}if(e.endLabelRight){const c=W[e.id].endRight;let r=e.x,n=e.y;if(a){const l=st.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",a);r=l.x,n=l.y}c.attr("transform",`translate(${r}, ${n})`)}},"positionEdgeLabel"),Gr=u((e,t)=>{const a=e.x,s=e.y,i=Math.abs(t.x-a),c=Math.abs(t.y-s),r=e.width/2,n=e.height/2;return i>=r||c>=n},"outsideNode"),Zr=u((e,t,a)=>{v.debug(`intersection calc abc89:
130
130
  outsidePoint: ${JSON.stringify(t)}
131
131
  insidePoint : ${JSON.stringify(a)}
132
- node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const s=e.x,i=e.y,c=Math.abs(s-a.x),r=e.width/2;let n=a.x<t.x?r-c:r+c;const l=e.height/2,d=Math.abs(t.y-a.y),g=Math.abs(t.x-a.x);if(Math.abs(i-t.y)*r>Math.abs(s-t.x)*l){let y=a.y<t.y?t.y-l-i:i-l-t.y;n=g*y/d;const w={x:a.x<t.x?a.x+n:a.x-g+n,y:a.y<t.y?a.y+d-y:a.y-d+y};return n===0&&(w.x=t.x,w.y=t.y),g===0&&(w.x=t.x),d===0&&(w.y=t.y),v.debug(`abc89 topp/bott calc, Q ${d}, q ${y}, R ${g}, r ${n}`,w),w}else{a.x<t.x?n=t.x-r-s:n=s-r-t.x;let y=d*n/g,w=a.x<t.x?a.x+g-n:a.x-g+n,b=a.y<t.y?a.y+y:a.y-y;return v.debug(`sides calc abc89, Q ${d}, q ${y}, R ${g}, r ${n}`,{_x:w,_y:b}),n===0&&(w=t.x,b=t.y),g===0&&(w=t.x),d===0&&(b=t.y),{x:w,y:b}}},"intersection"),Ft=u((e,t)=>{v.debug("abc88 cutPathAtIntersect",e,t);let a=[],s=e[0],i=!1;return e.forEach(c=>{if(!Zr(t,c)&&!i){const r=Gr(t,s,c);let n=!1;a.forEach(l=>{n=n||l.x===r.x&&l.y===r.y}),a.some(l=>l.x===r.x&&l.y===r.y)||a.push(r),i=!0}else s=c,i||a.push(c)}),a},"cutPathAtIntersect"),qr=u(function(e,t,a,s,i,c,r){let n=a.points;v.debug("abc88 InsertEdge: edge=",a,"e=",t);let l=!1;const d=c.node(t.v);var g=c.node(t.w);g!=null&&g.intersect&&(d!=null&&d.intersect)&&(n=n.slice(1,a.points.length-1),n.unshift(d.intersect(n[0])),n.push(g.intersect(n[n.length-1]))),a.toCluster&&(v.debug("to cluster abc88",s[a.toCluster]),n=Ft(a.points,s[a.toCluster].node),l=!0),a.fromCluster&&(v.debug("from cluster abc88",s[a.fromCluster]),n=Ft(n.reverse(),s[a.fromCluster].node).reverse(),l=!0);const y=n.filter(x=>!Number.isNaN(x.y));let w=Ve;a.curve&&(i==="graph"||i==="flowchart")&&(w=a.curve);const{x:b,y:m}=Ue(a),_=Xe().x(b).y(m).curve(w);let L;switch(a.thickness){case"normal":L="edge-thickness-normal";break;case"thick":L="edge-thickness-thick";break;case"invisible":L="edge-thickness-thick";break;default:L=""}switch(a.pattern){case"solid":L+=" edge-pattern-solid";break;case"dotted":L+=" edge-pattern-dotted";break;case"dashed":L+=" edge-pattern-dashed";break}const C=e.append("path").attr("d",_(y)).attr("id",a.id).attr("class"," "+L+(a.classes?" "+a.classes:"")).attr("style",a.style);let I="";(M().flowchart.arrowMarkerAbsolute||M().state.arrowMarkerAbsolute)&&(I=je(!0)),Ur(C,a,I,r,i);let N={};return l&&(N.updatedPath=n),N.originalPath=a.points,N},"insertEdge"),Jr=u(e=>{const t=new Set;for(const a of e)switch(a){case"x":t.add("right"),t.add("left");break;case"y":t.add("up"),t.add("down");break;default:t.add(a);break}return t},"expandAndDeduplicateDirections"),Qr=u((e,t,a,s)=>{const i=Jr(e),c=2,r=t.height+2*a.padding,n=r/c,l=s??t.width+2*n+a.padding,d=a.padding/2;return i.has("right")&&i.has("left")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:n,y:0},{x:l/2,y:2*d},{x:l-n,y:0},{x:l,y:0},{x:l,y:-r/3},{x:l+2*d,y:-r/2},{x:l,y:-2*r/3},{x:l,y:-r},{x:l-n,y:-r},{x:l/2,y:-r-2*d},{x:n,y:-r},{x:0,y:-r},{x:0,y:-2*r/3},{x:-2*d,y:-r/2},{x:0,y:-r/3}]:i.has("right")&&i.has("left")&&i.has("up")?[{x:n,y:0},{x:l-n,y:0},{x:l,y:-r/2},{x:l-n,y:-r},{x:n,y:-r},{x:0,y:-r/2}]:i.has("right")&&i.has("left")&&i.has("down")?[{x:0,y:0},{x:n,y:-r},{x:l-n,y:-r},{x:l,y:0}]:i.has("right")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:l,y:-n},{x:l,y:-r+n},{x:0,y:-r}]:i.has("left")&&i.has("up")&&i.has("down")?[{x:l,y:0},{x:0,y:-n},{x:0,y:-r+n},{x:l,y:-r}]:i.has("right")&&i.has("left")?[{x:n,y:0},{x:n,y:-d},{x:l-n,y:-d},{x:l-n,y:0},{x:l,y:-r/2},{x:l-n,y:-r},{x:l-n,y:-r+d},{x:n,y:-r+d},{x:n,y:-r},{x:0,y:-r/2}]:i.has("up")&&i.has("down")?[{x:l/2,y:0},{x:0,y:-d},{x:n,y:-d},{x:n,y:-r+d},{x:0,y:-r+d},{x:l/2,y:-r},{x:l,y:-r+d},{x:l-n,y:-r+d},{x:l-n,y:-d},{x:l,y:-d}]:i.has("right")&&i.has("up")?[{x:0,y:0},{x:l,y:-n},{x:0,y:-r}]:i.has("right")&&i.has("down")?[{x:0,y:0},{x:l,y:0},{x:0,y:-r}]:i.has("left")&&i.has("up")?[{x:l,y:0},{x:0,y:-n},{x:l,y:-r}]:i.has("left")&&i.has("down")?[{x:l,y:0},{x:0,y:0},{x:l,y:-r}]:i.has("right")?[{x:n,y:-d},{x:n,y:-d},{x:l-n,y:-d},{x:l-n,y:0},{x:l,y:-r/2},{x:l-n,y:-r},{x:l-n,y:-r+d},{x:n,y:-r+d},{x:n,y:-r+d}]:i.has("left")?[{x:n,y:0},{x:n,y:-d},{x:l-n,y:-d},{x:l-n,y:-r+d},{x:n,y:-r+d},{x:n,y:-r},{x:0,y:-r/2}]:i.has("up")?[{x:n,y:-d},{x:n,y:-r+d},{x:0,y:-r+d},{x:l/2,y:-r},{x:l,y:-r+d},{x:l-n,y:-r+d},{x:l-n,y:-d}]:i.has("down")?[{x:l/2,y:0},{x:0,y:-d},{x:n,y:-d},{x:n,y:-r+d},{x:l-n,y:-r+d},{x:l-n,y:-d},{x:l,y:-d}]:[{x:0,y:0}]},"getArrowPoints");function re(e,t){return e.intersect(t)}u(re,"intersectNode");var $r=re;function ae(e,t,a,s){var i=e.x,c=e.y,r=i-s.x,n=c-s.y,l=Math.sqrt(t*t*n*n+a*a*r*r),d=Math.abs(t*a*r/l);s.x<i&&(d=-d);var g=Math.abs(t*a*n/l);return s.y<c&&(g=-g),{x:i+d,y:c+g}}u(ae,"intersectEllipse");var se=ae;function ie(e,t,a){return se(e,t,t,a)}u(ie,"intersectCircle");var ta=ie;function ne(e,t,a,s){var i,c,r,n,l,d,g,y,w,b,m,_,L,C,I;if(i=t.y-e.y,r=e.x-t.x,l=t.x*e.y-e.x*t.y,w=i*a.x+r*a.y+l,b=i*s.x+r*s.y+l,!(w!==0&&b!==0&&vt(w,b))&&(c=s.y-a.y,n=a.x-s.x,d=s.x*a.y-a.x*s.y,g=c*e.x+n*e.y+d,y=c*t.x+n*t.y+d,!(g!==0&&y!==0&&vt(g,y))&&(m=i*n-c*r,m!==0)))return _=Math.abs(m/2),L=r*d-n*l,C=L<0?(L-_)/m:(L+_)/m,L=c*l-i*d,I=L<0?(L-_)/m:(L+_)/m,{x:C,y:I}}u(ne,"intersectLine");function vt(e,t){return e*t>0}u(vt,"sameSign");var ea=ne,ra=ce;function ce(e,t,a){var s=e.x,i=e.y,c=[],r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(m){r=Math.min(r,m.x),n=Math.min(n,m.y)}):(r=Math.min(r,t.x),n=Math.min(n,t.y));for(var l=s-e.width/2-r,d=i-e.height/2-n,g=0;g<t.length;g++){var y=t[g],w=t[g<t.length-1?g+1:0],b=ea(e,a,{x:l+y.x,y:d+y.y},{x:l+w.x,y:d+w.y});b&&c.push(b)}return c.length?(c.length>1&&c.sort(function(m,_){var L=m.x-a.x,C=m.y-a.y,I=Math.sqrt(L*L+C*C),N=_.x-a.x,x=_.y-a.y,p=Math.sqrt(N*N+x*x);return I<p?-1:I===p?0:1}),c[0]):e}u(ce,"intersectPolygon");var aa=u((e,t)=>{var a=e.x,s=e.y,i=t.x-a,c=t.y-s,r=e.width/2,n=e.height/2,l,d;return Math.abs(c)*r>Math.abs(i)*n?(c<0&&(n=-n),l=c===0?0:n*i/c,d=n):(i<0&&(r=-r),l=r,d=i===0?0:r*c/i),{x:a+l,y:s+d}},"intersectRect"),sa=aa,R={node:$r,circle:ta,ellipse:se,polygon:ra,rect:sa},P=u(async(e,t,a,s)=>{const i=M();let c;const r=t.useHtmlLabels||H(i);a?c=a:c="node default";const n=e.insert("g").attr("class",c).attr("id",t.domId||t.id),l=n.insert("g").attr("class","label").attr("style",t.labelStyle);let d;t.labelText===void 0?d="":d=typeof t.labelText=="string"?t.labelText:t.labelText[0];let g;t.labelType==="markdown"?g=Et(l,Ot(Rt(d),i),{useHtmlLabels:r,width:t.width||i.flowchart.wrappingWidth,classes:"markdown-node-label"},i):g=await Z(l,Ot(Rt(d),i),t.labelStyle,!1,s);let y=g.getBBox();const w=t.padding/2;if(H(i)){const b=g.children[0],m=O(g);await Je(b,d),y=b.getBoundingClientRect(),m.attr("width",y.width),m.attr("height",y.height)}return r?l.attr("transform","translate("+-y.width/2+", "+-y.height/2+")"):l.attr("transform","translate(0, "+-y.height/2+")"),t.centerLabel&&l.attr("transform","translate("+-y.width/2+", "+-y.height/2+")"),l.insert("rect",":first-child"),{shapeSvg:n,bbox:y,halfPadding:w,label:l}},"labelHelper"),A=u((e,t)=>{const a=t.node().getBBox();e.width=a.width,e.height=a.height},"updateNodeBounds");function q(e,t,a,s){return e.insert("polygon",":first-child").attr("points",s.map(function(i){return i.x+","+i.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+a/2+")")}u(q,"insertPolygonShape");var ia=u(async(e,t)=>{t.useHtmlLabels||H(M())||(t.centerLabel=!0);const{shapeSvg:s,bbox:i,halfPadding:c}=await P(e,t,"node "+t.classes,!0);v.info("Classes = ",t.classes);const r=s.insert("rect",":first-child");return r.attr("rx",t.rx).attr("ry",t.ry).attr("x",-i.width/2-c).attr("y",-i.height/2-c).attr("width",i.width+t.padding).attr("height",i.height+t.padding),A(t,r),t.intersect=function(n){return R.rect(t,n)},s},"note"),na=ia,Wt=u(e=>e?" "+e:"","formatClass"),V=u((e,t)=>`${t||"node default"}${Wt(e.classes)} ${Wt(e.class)}`,"getClassesFromNode"),Yt=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=i+c,n=[{x:r/2,y:0},{x:r,y:-r/2},{x:r/2,y:-r},{x:0,y:-r/2}];v.info("Question main (Circle)");const l=q(a,r,r,n);return l.attr("style",t.style),A(t,l),t.intersect=function(d){return v.warn("Intersect called"),R.polygon(t,n,d)},a},"question"),ca=u((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),s=28,i=[{x:0,y:s/2},{x:s/2,y:0},{x:0,y:-s/2},{x:-s/2,y:0}];return a.insert("polygon",":first-child").attr("points",i.map(function(r){return r.x+","+r.y}).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),t.width=28,t.height=28,t.intersect=function(r){return R.circle(t,14,r)},a},"choice"),la=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=4,c=t.positioned?t.height:s.height+t.padding,r=c/i,n=t.positioned?t.width:s.width+2*r+t.padding,l=[{x:r,y:0},{x:n-r,y:0},{x:n,y:-c/2},{x:n-r,y:-c},{x:r,y:-c},{x:0,y:-c/2}],d=q(a,n,c,l);return d.attr("style",t.style),A(t,d),t.intersect=function(g){return R.polygon(t,l,g)},a},"hexagon"),oa=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,void 0,!0),i=2,c=s.height+2*t.padding,r=c/i,n=s.width+2*r+t.padding,d=t.positioned&&(t.widthInColumns??1)>1&&t.width>n?t.width:n,g=Qr(t.directions,s,t,d),y=q(a,d,c,g);return y.attr("style",t.style),A(t,y),t.intersect=function(w){return R.polygon(t,g,w)},a},"block_arrow"),ha=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:-c/2,y:0},{x:i,y:0},{x:i,y:-c},{x:-c/2,y:-c},{x:0,y:-c/2}];return q(a,i,c,r).attr("style",t.style),t.width=i+c,t.height=c,t.intersect=function(l){return R.polygon(t,r,l)},a},"rect_left_inv_arrow"),ga=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:-2*c/6,y:0},{x:i-c/6,y:0},{x:i+2*c/6,y:-c},{x:c/6,y:-c}],n=q(a,i,c,r);return n.attr("style",t.style),A(t,n),t.intersect=function(l){return R.polygon(t,r,l)},a},"lean_right"),ua=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:2*c/6,y:0},{x:i+c/6,y:0},{x:i-2*c/6,y:-c},{x:-c/6,y:-c}],n=q(a,i,c,r);return n.attr("style",t.style),A(t,n),t.intersect=function(l){return R.polygon(t,r,l)},a},"lean_left"),da=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:-2*c/6,y:0},{x:i+2*c/6,y:0},{x:i-c/6,y:-c},{x:c/6,y:-c}],n=q(a,i,c,r);return n.attr("style",t.style),A(t,n),t.intersect=function(l){return R.polygon(t,r,l)},a},"trapezoid"),pa=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:c/6,y:0},{x:i-c/6,y:0},{x:i+2*c/6,y:-c},{x:-2*c/6,y:-c}],n=q(a,i,c,r);return n.attr("style",t.style),A(t,n),t.intersect=function(l){return R.polygon(t,r,l)},a},"inv_trapezoid"),fa=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:0,y:0},{x:i+c/2,y:0},{x:i,y:-c/2},{x:i+c/2,y:-c},{x:0,y:-c}],n=q(a,i,c,r);return n.attr("style",t.style),A(t,n),t.intersect=function(l){return R.polygon(t,r,l)},a},"rect_right_inv_arrow"),ya=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=s.width+t.padding,c=i/2,r=c/(2.5+i/50),n=s.height+r+t.padding,l="M 0,"+r+" a "+c+","+r+" 0,0,0 "+i+" 0 a "+c+","+r+" 0,0,0 "+-i+" 0 l 0,"+n+" a "+c+","+r+" 0,0,0 "+i+" 0 l 0,"+-n,d=a.attr("label-offset-y",r).insert("path",":first-child").attr("style",t.style).attr("d",l).attr("transform","translate("+-i/2+","+-(n/2+r)+")");return A(t,d),t.intersect=function(g){const y=R.rect(t,g),w=y.x-t.x;if(c!=0&&(Math.abs(w)<t.width/2||Math.abs(w)==t.width/2&&Math.abs(y.y-t.y)>t.height/2-r)){let b=r*r*(1-w*w/(c*c));b!=0&&(b=Math.sqrt(b)),b=r-b,g.y-t.y>0&&(b=-b),y.y+=b}return y},a},"cylinder"),xa=u(async(e,t)=>{const{shapeSvg:a,bbox:s,halfPadding:i}=await P(e,t,"node "+t.classes+" "+t.class,!0),c=a.insert("rect",":first-child"),r=t.positioned?t.width:s.width+t.padding,n=t.positioned?t.height:s.height+t.padding,l=t.positioned?-r/2:-s.width/2-i,d=t.positioned?-n/2:-s.height/2-i;if(c.attr("class","basic label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",l).attr("y",d).attr("width",r).attr("height",n),t.props){const g=new Set(Object.keys(t.props));t.props.borders&&(dt(c,t.props.borders,r,n),g.delete("borders")),g.forEach(y=>{v.warn(`Unknown node property ${y}`)})}return A(t,c),t.intersect=function(g){return R.rect(t,g)},a},"rect"),ba=u(async(e,t)=>{const{shapeSvg:a,bbox:s,halfPadding:i}=await P(e,t,"node "+t.classes,!0),c=a.insert("rect",":first-child"),r=t.positioned?t.width:s.width+t.padding,n=t.positioned?t.height:s.height+t.padding,l=t.positioned?-r/2:-s.width/2-i,d=t.positioned?-n/2:-s.height/2-i;if(c.attr("class","basic cluster composite label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",l).attr("y",d).attr("width",r).attr("height",n),t.props){const g=new Set(Object.keys(t.props));t.props.borders&&(dt(c,t.props.borders,r,n),g.delete("borders")),g.forEach(y=>{v.warn(`Unknown node property ${y}`)})}return A(t,c),t.intersect=function(g){return R.rect(t,g)},a},"composite"),wa=u(async(e,t)=>{const{shapeSvg:a}=await P(e,t,"label",!0);v.trace("Classes = ",t.class);const s=a.insert("rect",":first-child"),i=0,c=0;if(s.attr("width",i).attr("height",c),a.attr("class","label edgeLabel"),t.props){const r=new Set(Object.keys(t.props));t.props.borders&&(dt(s,t.props.borders,i,c),r.delete("borders")),r.forEach(n=>{v.warn(`Unknown node property ${n}`)})}return A(t,s),t.intersect=function(r){return R.rect(t,r)},a},"labelRect");function dt(e,t,a,s){const i=[],c=u(n=>{i.push(n,0)},"addBorder"),r=u(n=>{i.push(0,n)},"skipBorder");t.includes("t")?(v.debug("add top border"),c(a)):r(a),t.includes("r")?(v.debug("add right border"),c(s)):r(s),t.includes("b")?(v.debug("add bottom border"),c(a)):r(a),t.includes("l")?(v.debug("add left border"),c(s)):r(s),e.attr("stroke-dasharray",i.join(" "))}u(dt,"applyNodePropertyBorders");var ma=u(async(e,t)=>{let a;t.classes?a="node "+t.classes:a="node default";const s=e.insert("g").attr("class",a).attr("id",t.domId||t.id),i=s.insert("rect",":first-child"),c=s.insert("line"),r=s.insert("g").attr("class","label"),n=t.labelText.flat?t.labelText.flat():t.labelText;let l="";typeof n=="object"?l=n[0]:l=n,v.info("Label text abc79",l,n,typeof n=="object");const d=await Z(r,l,t.labelStyle,!0,!0);let g={width:0,height:0};if(H(M())){const _=d.children[0],L=O(d);g=_.getBoundingClientRect(),L.attr("width",g.width),L.attr("height",g.height)}v.info("Text 2",n);const y=n.slice(1,n.length);let w=d.getBBox();const b=await Z(r,y.join?y.join("<br/>"):y,t.labelStyle,!0,!0);if(H(M())){const _=b.children[0],L=O(b);g=_.getBoundingClientRect(),L.attr("width",g.width),L.attr("height",g.height)}const m=t.padding/2;return O(b).attr("transform","translate( "+(g.width>w.width?0:(w.width-g.width)/2)+", "+(w.height+m+5)+")"),O(d).attr("transform","translate( "+(g.width<w.width?0:-(w.width-g.width)/2)+", 0)"),g=r.node().getBBox(),r.attr("transform","translate("+-g.width/2+", "+(-g.height/2-m+3)+")"),i.attr("class","outer title-state").attr("x",-g.width/2-m).attr("y",-g.height/2-m).attr("width",g.width+t.padding).attr("height",g.height+t.padding),c.attr("class","divider").attr("x1",-g.width/2-m).attr("x2",g.width/2+m).attr("y1",-g.height/2-m+w.height+m).attr("y2",-g.height/2-m+w.height+m),A(t,i),t.intersect=function(_){return R.rect(t,_)},s},"rectWithTitle"),Sa=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=s.height+t.padding,c=s.width+i/4+t.padding,r=a.insert("rect",":first-child").attr("style",t.style).attr("rx",i/2).attr("ry",i/2).attr("x",-c/2).attr("y",-i/2).attr("width",c).attr("height",i);return A(t,r),t.intersect=function(n){return R.rect(t,n)},a},"stadium"),La=u(async(e,t)=>{const{shapeSvg:a,bbox:s,halfPadding:i}=await P(e,t,V(t,void 0),!0),c=a.insert("circle",":first-child");return c.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",s.width/2+i).attr("width",s.width+t.padding).attr("height",s.height+t.padding),v.info("Circle main"),A(t,c),t.intersect=function(r){return v.info("Circle intersect",t,s.width/2+i,r),R.circle(t,s.width/2+i,r)},a},"circle"),va=u(async(e,t)=>{const{shapeSvg:a,bbox:s,halfPadding:i}=await P(e,t,V(t,void 0),!0),c=5,r=a.insert("g",":first-child"),n=r.insert("circle"),l=r.insert("circle");return r.attr("class",t.class),n.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",s.width/2+i+c).attr("width",s.width+t.padding+c*2).attr("height",s.height+t.padding+c*2),l.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",s.width/2+i).attr("width",s.width+t.padding).attr("height",s.height+t.padding),v.info("DoubleCircle main"),A(t,n),t.intersect=function(d){return v.info("DoubleCircle intersect",t,s.width/2+i+c,d),R.circle(t,s.width/2+i+c,d)},a},"doublecircle"),Ea=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:0,y:0},{x:i,y:0},{x:i,y:-c},{x:0,y:-c},{x:0,y:0},{x:-8,y:0},{x:i+8,y:0},{x:i+8,y:-c},{x:-8,y:-c},{x:-8,y:0}],n=q(a,i,c,r);return n.attr("style",t.style),A(t,n),t.intersect=function(l){return R.polygon(t,r,l)},a},"subroutine"),_a=u((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),s=a.insert("circle",":first-child");return s.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),A(t,s),t.intersect=function(i){return R.circle(t,7,i)},a},"start"),Ht=u((e,t,a)=>{const s=e.insert("g").attr("class","node default").attr("id",t.domId||t.id);let i=70,c=10;a==="LR"&&(i=10,c=70);const r=s.append("rect").attr("x",-1*i/2).attr("y",-1*c/2).attr("width",i).attr("height",c).attr("class","fork-join");return A(t,r),t.height=t.height+t.padding/2,t.width=t.width+t.padding/2,t.intersect=function(n){return R.rect(t,n)},s},"forkJoin"),ka=u((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),s=a.insert("circle",":first-child"),i=a.insert("circle",":first-child");return i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),s.attr("class","state-end").attr("r",5).attr("width",10).attr("height",10),A(t,i),t.intersect=function(c){return R.circle(t,7,c)},a},"end"),Ta=u(async(e,t)=>{var E;const a=t.padding/2,s=4,i=8;let c;t.classes?c="node "+t.classes:c="node default";const r=e.insert("g").attr("class",c).attr("id",t.domId||t.id),n=r.insert("rect",":first-child"),l=r.insert("line"),d=r.insert("line");let g=0,y=s;const w=r.insert("g").attr("class","label");let b=0;const m=(E=t.classData.annotations)==null?void 0:E[0],_=t.classData.annotations[0]?"«"+t.classData.annotations[0]+"»":"",L=await Z(w,_,t.labelStyle,!0,!0);let C=L.getBBox();if(H(M())){const o=L.children[0],k=O(L);C=o.getBoundingClientRect(),k.attr("width",C.width),k.attr("height",C.height)}t.classData.annotations[0]&&(y+=C.height+s,g+=C.width);let I=t.classData.label;t.classData.type!==void 0&&t.classData.type!==""&&(H(M())?I+="&lt;"+t.classData.type+"&gt;":I+="<"+t.classData.type+">");const N=await Z(w,I,t.labelStyle,!0,!0);O(N).attr("class","classTitle");let x=N.getBBox();if(H(M())){const o=N.children[0],k=O(N);x=o.getBoundingClientRect(),k.attr("width",x.width),k.attr("height",x.height)}y+=x.height+s,x.width>g&&(g=x.width);const p=[];t.classData.members.forEach(async o=>{const k=o.getDisplayDetails();let h=k.displayText;H(M())&&(h=h.replace(/</g,"&lt;").replace(/>/g,"&gt;"));const T=await Z(w,h,k.cssStyle?k.cssStyle:t.labelStyle,!0,!0);let D=T.getBBox();if(H(M())){const U=T.children[0],F=O(T);D=U.getBoundingClientRect(),F.attr("width",D.width),F.attr("height",D.height)}D.width>g&&(g=D.width),y+=D.height+s,p.push(T)}),y+=i;const f=[];if(t.classData.methods.forEach(async o=>{const k=o.getDisplayDetails();let h=k.displayText;H(M())&&(h=h.replace(/</g,"&lt;").replace(/>/g,"&gt;"));const T=await Z(w,h,k.cssStyle?k.cssStyle:t.labelStyle,!0,!0);let D=T.getBBox();if(H(M())){const U=T.children[0],F=O(T);D=U.getBoundingClientRect(),F.attr("width",D.width),F.attr("height",D.height)}D.width>g&&(g=D.width),y+=D.height+s,f.push(T)}),y+=i,m){let o=(g-C.width)/2;O(L).attr("transform","translate( "+(-1*g/2+o)+", "+-1*y/2+")"),b=C.height+s}let S=(g-x.width)/2;return O(N).attr("transform","translate( "+(-1*g/2+S)+", "+(-1*y/2+b)+")"),b+=x.height+s,l.attr("class","divider").attr("x1",-g/2-a).attr("x2",g/2+a).attr("y1",-y/2-a+i+b).attr("y2",-y/2-a+i+b),b+=i,p.forEach(o=>{O(o).attr("transform","translate( "+-g/2+", "+(-1*y/2+b+i/2)+")");const k=o==null?void 0:o.getBBox();b+=((k==null?void 0:k.height)??0)+s}),b+=i,d.attr("class","divider").attr("x1",-g/2-a).attr("x2",g/2+a).attr("y1",-y/2-a+i+b).attr("y2",-y/2-a+i+b),b+=i,f.forEach(o=>{O(o).attr("transform","translate( "+-g/2+", "+(-1*y/2+b)+")");const k=o==null?void 0:o.getBBox();b+=((k==null?void 0:k.height)??0)+s}),n.attr("style",t.style).attr("class","outer title-state").attr("x",-g/2-a).attr("y",-(y/2)-a).attr("width",g+t.padding).attr("height",y+t.padding),A(t,n),t.intersect=function(o){return R.rect(t,o)},r},"class_box"),Kt={rhombus:Yt,composite:ba,question:Yt,rect:xa,labelRect:wa,rectWithTitle:ma,choice:ca,circle:La,doublecircle:va,stadium:Sa,hexagon:la,block_arrow:oa,rect_left_inv_arrow:ha,lean_right:ga,lean_left:ua,trapezoid:da,inv_trapezoid:pa,rect_right_inv_arrow:fa,cylinder:ya,start:_a,end:ka,note:na,subroutine:Ea,fork:Ht,join:Ht,class_box:Ta},ht={},le=u(async(e,t,a)=>{let s,i;if(t.link){let c;M().securityLevel==="sandbox"?c="_top":t.linkTarget&&(c=t.linkTarget||"_blank"),s=e.insert("svg:a").attr("xlink:href",t.link).attr("target",c),i=await Kt[t.shape](s,t,a)}else i=await Kt[t.shape](e,t,a),s=i;return t.tooltip&&i.attr("title",t.tooltip),t.class&&i.attr("class","node default "+t.class),ht[t.id]=s,t.haveCallback&&ht[t.id].attr("class",ht[t.id].attr("class")+" clickable"),s},"insertNode"),Da=u(e=>{const t=ht[e.id];v.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");const a=8,s=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+s-e.width/2)+", "+(e.y-e.height/2-a)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),s},"positionNode");function It(e,t,a=!1){var b,m,_;const s=e;let i="default";(((b=s==null?void 0:s.classes)==null?void 0:b.length)||0)>0&&(i=((s==null?void 0:s.classes)??[]).join(" ")),i=i+" flowchart-label";let c=0,r="",n;switch(s.type){case"round":c=5,r="rect";break;case"composite":c=0,r="composite",n=0;break;case"square":r="rect";break;case"diamond":r="question";break;case"hexagon":r="hexagon";break;case"block_arrow":r="block_arrow";break;case"odd":r="rect_left_inv_arrow";break;case"lean_right":r="lean_right";break;case"lean_left":r="lean_left";break;case"trapezoid":r="trapezoid";break;case"inv_trapezoid":r="inv_trapezoid";break;case"rect_left_inv_arrow":r="rect_left_inv_arrow";break;case"circle":r="circle";break;case"ellipse":r="ellipse";break;case"stadium":r="stadium";break;case"subroutine":r="subroutine";break;case"cylinder":r="cylinder";break;case"group":r="rect";break;case"doublecircle":r="doublecircle";break;default:r="rect"}const l=qe((s==null?void 0:s.styles)??[]),d=s.label,g=s.size??{width:0,height:0,x:0,y:0},y=t.getDiagramId();return{labelStyle:l.labelStyle,shape:r,labelText:d,rx:c,ry:c,class:i,style:l.style,id:s.id,domId:y?`${y}-${s.id}`:s.id,directions:s.directions,width:g.width,height:g.height,x:g.x,y:g.y,positioned:a,intersect:void 0,type:s.type,padding:n??((_=(m=ct())==null?void 0:m.block)==null?void 0:_.padding)??0,widthInColumns:s.widthInColumns??1}}u(It,"getNodeFromBlock");async function oe(e,t,a){const s=It(t,a,!1);if(s.type==="group")return;const i=ct(),c=await le(e,s,{config:i}),r=c.node().getBBox(),n=a.getBlock(s.id);n.size={width:r.width,height:r.height,x:0,y:0,node:c},a.setBlock(n),c.remove()}u(oe,"calculateBlockSize");async function he(e,t,a){const s=It(t,a,!0);if(a.getBlock(s.id).type!=="space"){const c=ct();await le(e,s,{config:c}),t.intersect=s==null?void 0:s.intersect,Da(s)}}u(he,"insertBlockPositioned");async function pt(e,t,a,s){for(const i of t)await s(e,i,a),i.children&&await pt(e,i.children,a,s)}u(pt,"performOperations");async function ge(e,t,a){await pt(e,t,a,oe)}u(ge,"calculateBlockSizes");async function ue(e,t,a){await pt(e,t,a,he)}u(ue,"insertBlocks");async function de(e,t,a,s,i){const c=new Qe({multigraph:!0,compound:!0});c.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(const r of a)r.size&&c.setNode(r.id,{width:r.size.width,height:r.size.height,intersect:r.intersect});for(const r of t)if(r.start&&r.end){const n=s.getBlock(r.start),l=s.getBlock(r.end);if(n!=null&&n.size&&(l!=null&&l.size)){const d=n.size,g=l.size,y=[{x:d.x,y:d.y},{x:d.x+(g.x-d.x)/2,y:d.y+(g.y-d.y)/2},{x:g.x,y:g.y}],w=i?`${i}-${r.id}`:r.id,b=r.thickness==="thick"?"edge-thickness-thick":"edge-thickness-normal",m=r.pattern==="dotted"?"edge-pattern-dotted":"edge-pattern-solid",_=`${b} ${m} flowchart-link LS-a1 LE-b1`;qr(e,{v:r.start,w:r.end,name:w},{...r,id:w,arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:y,classes:_},void 0,"block",c,i),r.label&&(await Vr(e,{...r,label:r.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:y,classes:_}),jr({...r,x:y[1].x,y:y[1].y},{originalPath:y}))}}}u(de,"insertEdges");var Na=u(function(e,t){return t.db.getClasses()},"getClasses"),Ia=u(async function(e,t,a,s){const{securityLevel:i,block:c}=ct(),r=s.db;r.setDiagramId(t);let n;i==="sandbox"&&(n=O("#i"+t));const l=i==="sandbox"?O(n.nodes()[0].contentDocument.body):O("body"),d=i==="sandbox"?l.select(`[id="${t}"]`):O(`[id="${t}"]`);Yr(d,["point","circle","cross"],s.type,t);const y=r.getBlocks(),w=r.getBlocksFlat(),b=r.getEdges(),m=d.insert("g").attr("class","block");await ge(m,y,r);const _=ee(r);if(await ue(m,y,r),await de(m,b,w,r,t),_){const L=_,C=Math.max(1,Math.round(.125*(L.width/L.height))),I=L.height+C+10,N=L.width+10,{useMaxWidth:x}=c;Ye(d,I,N,!!x),v.debug("Here Bounds",_,L),d.attr("viewBox",`${L.x-5} ${L.y-5} ${L.width+10} ${L.height+10}`)}},"draw"),Ca={draw:Ia,getClasses:Na},Fa={parser:nr,db:Tr,renderer:Ca,styles:Nr};export{Fa as diagram};
132
+ node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const s=e.x,i=e.y,c=Math.abs(s-a.x),r=e.width/2;let n=a.x<t.x?r-c:r+c;const l=e.height/2,d=Math.abs(t.y-a.y),g=Math.abs(t.x-a.x);if(Math.abs(i-t.y)*r>Math.abs(s-t.x)*l){let y=a.y<t.y?t.y-l-i:i-l-t.y;n=g*y/d;const w={x:a.x<t.x?a.x+n:a.x-g+n,y:a.y<t.y?a.y+d-y:a.y-d+y};return n===0&&(w.x=t.x,w.y=t.y),g===0&&(w.x=t.x),d===0&&(w.y=t.y),v.debug(`abc89 topp/bott calc, Q ${d}, q ${y}, R ${g}, r ${n}`,w),w}else{a.x<t.x?n=t.x-r-s:n=s-r-t.x;let y=d*n/g,w=a.x<t.x?a.x+g-n:a.x-g+n,b=a.y<t.y?a.y+y:a.y-y;return v.debug(`sides calc abc89, Q ${d}, q ${y}, R ${g}, r ${n}`,{_x:w,_y:b}),n===0&&(w=t.x,b=t.y),g===0&&(w=t.x),d===0&&(b=t.y),{x:w,y:b}}},"intersection"),Ft=u((e,t)=>{v.debug("abc88 cutPathAtIntersect",e,t);let a=[],s=e[0],i=!1;return e.forEach(c=>{if(!Gr(t,c)&&!i){const r=Zr(t,s,c);let n=!1;a.forEach(l=>{n=n||l.x===r.x&&l.y===r.y}),a.some(l=>l.x===r.x&&l.y===r.y)||a.push(r),i=!0}else s=c,i||a.push(c)}),a},"cutPathAtIntersect"),qr=u(function(e,t,a,s,i,c,r){let n=a.points;v.debug("abc88 InsertEdge: edge=",a,"e=",t);let l=!1;const d=c.node(t.v);var g=c.node(t.w);g!=null&&g.intersect&&(d!=null&&d.intersect)&&(n=n.slice(1,a.points.length-1),n.unshift(d.intersect(n[0])),n.push(g.intersect(n[n.length-1]))),a.toCluster&&(v.debug("to cluster abc88",s[a.toCluster]),n=Ft(a.points,s[a.toCluster].node),l=!0),a.fromCluster&&(v.debug("from cluster abc88",s[a.fromCluster]),n=Ft(n.reverse(),s[a.fromCluster].node).reverse(),l=!0);const y=n.filter(x=>!Number.isNaN(x.y));let w=Ve;a.curve&&(i==="graph"||i==="flowchart")&&(w=a.curve);const{x:b,y:m}=Ue(a),_=Xe().x(b).y(m).curve(w);let L;switch(a.thickness){case"normal":L="edge-thickness-normal";break;case"thick":L="edge-thickness-thick";break;case"invisible":L="edge-thickness-thick";break;default:L=""}switch(a.pattern){case"solid":L+=" edge-pattern-solid";break;case"dotted":L+=" edge-pattern-dotted";break;case"dashed":L+=" edge-pattern-dashed";break}const C=e.append("path").attr("d",_(y)).attr("id",a.id).attr("class"," "+L+(a.classes?" "+a.classes:"")).attr("style",a.style);let I="";(M().flowchart.arrowMarkerAbsolute||M().state.arrowMarkerAbsolute)&&(I=je(!0)),Ur(C,a,I,r,i);let N={};return l&&(N.updatedPath=n),N.originalPath=a.points,N},"insertEdge"),Jr=u(e=>{const t=new Set;for(const a of e)switch(a){case"x":t.add("right"),t.add("left");break;case"y":t.add("up"),t.add("down");break;default:t.add(a);break}return t},"expandAndDeduplicateDirections"),Qr=u((e,t,a,s)=>{const i=Jr(e),c=2,r=t.height+2*a.padding,n=r/c,l=s??t.width+2*n+a.padding,d=a.padding/2;return i.has("right")&&i.has("left")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:n,y:0},{x:l/2,y:2*d},{x:l-n,y:0},{x:l,y:0},{x:l,y:-r/3},{x:l+2*d,y:-r/2},{x:l,y:-2*r/3},{x:l,y:-r},{x:l-n,y:-r},{x:l/2,y:-r-2*d},{x:n,y:-r},{x:0,y:-r},{x:0,y:-2*r/3},{x:-2*d,y:-r/2},{x:0,y:-r/3}]:i.has("right")&&i.has("left")&&i.has("up")?[{x:n,y:0},{x:l-n,y:0},{x:l,y:-r/2},{x:l-n,y:-r},{x:n,y:-r},{x:0,y:-r/2}]:i.has("right")&&i.has("left")&&i.has("down")?[{x:0,y:0},{x:n,y:-r},{x:l-n,y:-r},{x:l,y:0}]:i.has("right")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:l,y:-n},{x:l,y:-r+n},{x:0,y:-r}]:i.has("left")&&i.has("up")&&i.has("down")?[{x:l,y:0},{x:0,y:-n},{x:0,y:-r+n},{x:l,y:-r}]:i.has("right")&&i.has("left")?[{x:n,y:0},{x:n,y:-d},{x:l-n,y:-d},{x:l-n,y:0},{x:l,y:-r/2},{x:l-n,y:-r},{x:l-n,y:-r+d},{x:n,y:-r+d},{x:n,y:-r},{x:0,y:-r/2}]:i.has("up")&&i.has("down")?[{x:l/2,y:0},{x:0,y:-d},{x:n,y:-d},{x:n,y:-r+d},{x:0,y:-r+d},{x:l/2,y:-r},{x:l,y:-r+d},{x:l-n,y:-r+d},{x:l-n,y:-d},{x:l,y:-d}]:i.has("right")&&i.has("up")?[{x:0,y:0},{x:l,y:-n},{x:0,y:-r}]:i.has("right")&&i.has("down")?[{x:0,y:0},{x:l,y:0},{x:0,y:-r}]:i.has("left")&&i.has("up")?[{x:l,y:0},{x:0,y:-n},{x:l,y:-r}]:i.has("left")&&i.has("down")?[{x:l,y:0},{x:0,y:0},{x:l,y:-r}]:i.has("right")?[{x:n,y:-d},{x:n,y:-d},{x:l-n,y:-d},{x:l-n,y:0},{x:l,y:-r/2},{x:l-n,y:-r},{x:l-n,y:-r+d},{x:n,y:-r+d},{x:n,y:-r+d}]:i.has("left")?[{x:n,y:0},{x:n,y:-d},{x:l-n,y:-d},{x:l-n,y:-r+d},{x:n,y:-r+d},{x:n,y:-r},{x:0,y:-r/2}]:i.has("up")?[{x:n,y:-d},{x:n,y:-r+d},{x:0,y:-r+d},{x:l/2,y:-r},{x:l,y:-r+d},{x:l-n,y:-r+d},{x:l-n,y:-d}]:i.has("down")?[{x:l/2,y:0},{x:0,y:-d},{x:n,y:-d},{x:n,y:-r+d},{x:l-n,y:-r+d},{x:l-n,y:-d},{x:l,y:-d}]:[{x:0,y:0}]},"getArrowPoints");function re(e,t){return e.intersect(t)}u(re,"intersectNode");var $r=re;function ae(e,t,a,s){var i=e.x,c=e.y,r=i-s.x,n=c-s.y,l=Math.sqrt(t*t*n*n+a*a*r*r),d=Math.abs(t*a*r/l);s.x<i&&(d=-d);var g=Math.abs(t*a*n/l);return s.y<c&&(g=-g),{x:i+d,y:c+g}}u(ae,"intersectEllipse");var se=ae;function ie(e,t,a){return se(e,t,t,a)}u(ie,"intersectCircle");var ta=ie;function ne(e,t,a,s){var i,c,r,n,l,d,g,y,w,b,m,_,L,C,I;if(i=t.y-e.y,r=e.x-t.x,l=t.x*e.y-e.x*t.y,w=i*a.x+r*a.y+l,b=i*s.x+r*s.y+l,!(w!==0&&b!==0&&vt(w,b))&&(c=s.y-a.y,n=a.x-s.x,d=s.x*a.y-a.x*s.y,g=c*e.x+n*e.y+d,y=c*t.x+n*t.y+d,!(g!==0&&y!==0&&vt(g,y))&&(m=i*n-c*r,m!==0)))return _=Math.abs(m/2),L=r*d-n*l,C=L<0?(L-_)/m:(L+_)/m,L=c*l-i*d,I=L<0?(L-_)/m:(L+_)/m,{x:C,y:I}}u(ne,"intersectLine");function vt(e,t){return e*t>0}u(vt,"sameSign");var ea=ne,ra=ce;function ce(e,t,a){var s=e.x,i=e.y,c=[],r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(m){r=Math.min(r,m.x),n=Math.min(n,m.y)}):(r=Math.min(r,t.x),n=Math.min(n,t.y));for(var l=s-e.width/2-r,d=i-e.height/2-n,g=0;g<t.length;g++){var y=t[g],w=t[g<t.length-1?g+1:0],b=ea(e,a,{x:l+y.x,y:d+y.y},{x:l+w.x,y:d+w.y});b&&c.push(b)}return c.length?(c.length>1&&c.sort(function(m,_){var L=m.x-a.x,C=m.y-a.y,I=Math.sqrt(L*L+C*C),N=_.x-a.x,x=_.y-a.y,p=Math.sqrt(N*N+x*x);return I<p?-1:I===p?0:1}),c[0]):e}u(ce,"intersectPolygon");var aa=u((e,t)=>{var a=e.x,s=e.y,i=t.x-a,c=t.y-s,r=e.width/2,n=e.height/2,l,d;return Math.abs(c)*r>Math.abs(i)*n?(c<0&&(n=-n),l=c===0?0:n*i/c,d=n):(i<0&&(r=-r),l=r,d=i===0?0:r*c/i),{x:a+l,y:s+d}},"intersectRect"),sa=aa,R={node:$r,circle:ta,ellipse:se,polygon:ra,rect:sa},P=u(async(e,t,a,s)=>{const i=M();let c;const r=t.useHtmlLabels||H(i);a?c=a:c="node default";const n=e.insert("g").attr("class",c).attr("id",t.domId||t.id),l=n.insert("g").attr("class","label").attr("style",t.labelStyle);let d;t.labelText===void 0?d="":d=typeof t.labelText=="string"?t.labelText:t.labelText[0];let g;t.labelType==="markdown"?g=Et(l,Ot(Rt(d),i),{useHtmlLabels:r,width:t.width||i.flowchart.wrappingWidth,classes:"markdown-node-label"},i):g=await G(l,Ot(Rt(d),i),t.labelStyle,!1,s);let y=g.getBBox();const w=t.padding/2;if(H(i)){const b=g.children[0],m=O(g);await Je(b,d),y=b.getBoundingClientRect(),m.attr("width",y.width),m.attr("height",y.height)}return r?l.attr("transform","translate("+-y.width/2+", "+-y.height/2+")"):l.attr("transform","translate(0, "+-y.height/2+")"),t.centerLabel&&l.attr("transform","translate("+-y.width/2+", "+-y.height/2+")"),l.insert("rect",":first-child"),{shapeSvg:n,bbox:y,halfPadding:w,label:l}},"labelHelper"),A=u((e,t)=>{const a=t.node().getBBox();e.width=a.width,e.height=a.height},"updateNodeBounds");function q(e,t,a,s){return e.insert("polygon",":first-child").attr("points",s.map(function(i){return i.x+","+i.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+a/2+")")}u(q,"insertPolygonShape");var ia=u(async(e,t)=>{t.useHtmlLabels||H(M())||(t.centerLabel=!0);const{shapeSvg:s,bbox:i,halfPadding:c}=await P(e,t,"node "+t.classes,!0);v.info("Classes = ",t.classes);const r=s.insert("rect",":first-child");return r.attr("rx",t.rx).attr("ry",t.ry).attr("x",-i.width/2-c).attr("y",-i.height/2-c).attr("width",i.width+t.padding).attr("height",i.height+t.padding),A(t,r),t.intersect=function(n){return R.rect(t,n)},s},"note"),na=ia,Wt=u(e=>e?" "+e:"","formatClass"),V=u((e,t)=>`${t||"node default"}${Wt(e.classes)} ${Wt(e.class)}`,"getClassesFromNode"),Yt=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=i+c,n=[{x:r/2,y:0},{x:r,y:-r/2},{x:r/2,y:-r},{x:0,y:-r/2}];v.info("Question main (Circle)");const l=q(a,r,r,n);return l.attr("style",t.style),A(t,l),t.intersect=function(d){return v.warn("Intersect called"),R.polygon(t,n,d)},a},"question"),ca=u((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),s=28,i=[{x:0,y:s/2},{x:s/2,y:0},{x:0,y:-s/2},{x:-s/2,y:0}];return a.insert("polygon",":first-child").attr("points",i.map(function(r){return r.x+","+r.y}).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),t.width=28,t.height=28,t.intersect=function(r){return R.circle(t,14,r)},a},"choice"),la=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=4,c=t.positioned?t.height:s.height+t.padding,r=c/i,n=t.positioned?t.width:s.width+2*r+t.padding,l=[{x:r,y:0},{x:n-r,y:0},{x:n,y:-c/2},{x:n-r,y:-c},{x:r,y:-c},{x:0,y:-c/2}],d=q(a,n,c,l);return d.attr("style",t.style),A(t,d),t.intersect=function(g){return R.polygon(t,l,g)},a},"hexagon"),oa=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,void 0,!0),i=2,c=s.height+2*t.padding,r=c/i,n=s.width+2*r+t.padding,d=t.positioned&&(t.widthInColumns??1)>1&&t.width>n?t.width:n,g=Qr(t.directions,s,t,d),y=q(a,d,c,g);return y.attr("style",t.style),A(t,y),t.intersect=function(w){return R.polygon(t,g,w)},a},"block_arrow"),ha=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:-c/2,y:0},{x:i,y:0},{x:i,y:-c},{x:-c/2,y:-c},{x:0,y:-c/2}];return q(a,i,c,r).attr("style",t.style),t.width=i+c,t.height=c,t.intersect=function(l){return R.polygon(t,r,l)},a},"rect_left_inv_arrow"),ga=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:-2*c/6,y:0},{x:i-c/6,y:0},{x:i+2*c/6,y:-c},{x:c/6,y:-c}],n=q(a,i,c,r);return n.attr("style",t.style),A(t,n),t.intersect=function(l){return R.polygon(t,r,l)},a},"lean_right"),ua=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:2*c/6,y:0},{x:i+c/6,y:0},{x:i-2*c/6,y:-c},{x:-c/6,y:-c}],n=q(a,i,c,r);return n.attr("style",t.style),A(t,n),t.intersect=function(l){return R.polygon(t,r,l)},a},"lean_left"),da=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:-2*c/6,y:0},{x:i+2*c/6,y:0},{x:i-c/6,y:-c},{x:c/6,y:-c}],n=q(a,i,c,r);return n.attr("style",t.style),A(t,n),t.intersect=function(l){return R.polygon(t,r,l)},a},"trapezoid"),pa=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:c/6,y:0},{x:i-c/6,y:0},{x:i+2*c/6,y:-c},{x:-2*c/6,y:-c}],n=q(a,i,c,r);return n.attr("style",t.style),A(t,n),t.intersect=function(l){return R.polygon(t,r,l)},a},"inv_trapezoid"),fa=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:0,y:0},{x:i+c/2,y:0},{x:i,y:-c/2},{x:i+c/2,y:-c},{x:0,y:-c}],n=q(a,i,c,r);return n.attr("style",t.style),A(t,n),t.intersect=function(l){return R.polygon(t,r,l)},a},"rect_right_inv_arrow"),ya=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=s.width+t.padding,c=i/2,r=c/(2.5+i/50),n=s.height+r+t.padding,l="M 0,"+r+" a "+c+","+r+" 0,0,0 "+i+" 0 a "+c+","+r+" 0,0,0 "+-i+" 0 l 0,"+n+" a "+c+","+r+" 0,0,0 "+i+" 0 l 0,"+-n,d=a.attr("label-offset-y",r).insert("path",":first-child").attr("style",t.style).attr("d",l).attr("transform","translate("+-i/2+","+-(n/2+r)+")");return A(t,d),t.intersect=function(g){const y=R.rect(t,g),w=y.x-t.x;if(c!=0&&(Math.abs(w)<t.width/2||Math.abs(w)==t.width/2&&Math.abs(y.y-t.y)>t.height/2-r)){let b=r*r*(1-w*w/(c*c));b!=0&&(b=Math.sqrt(b)),b=r-b,g.y-t.y>0&&(b=-b),y.y+=b}return y},a},"cylinder"),xa=u(async(e,t)=>{const{shapeSvg:a,bbox:s,halfPadding:i}=await P(e,t,"node "+t.classes+" "+t.class,!0),c=a.insert("rect",":first-child"),r=t.positioned?t.width:s.width+t.padding,n=t.positioned?t.height:s.height+t.padding,l=t.positioned?-r/2:-s.width/2-i,d=t.positioned?-n/2:-s.height/2-i;if(c.attr("class","basic label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",l).attr("y",d).attr("width",r).attr("height",n),t.props){const g=new Set(Object.keys(t.props));t.props.borders&&(dt(c,t.props.borders,r,n),g.delete("borders")),g.forEach(y=>{v.warn(`Unknown node property ${y}`)})}return A(t,c),t.intersect=function(g){return R.rect(t,g)},a},"rect"),ba=u(async(e,t)=>{const{shapeSvg:a,bbox:s,halfPadding:i}=await P(e,t,"node "+t.classes,!0),c=a.insert("rect",":first-child"),r=t.positioned?t.width:s.width+t.padding,n=t.positioned?t.height:s.height+t.padding,l=t.positioned?-r/2:-s.width/2-i,d=t.positioned?-n/2:-s.height/2-i;if(c.attr("class","basic cluster composite label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",l).attr("y",d).attr("width",r).attr("height",n),t.props){const g=new Set(Object.keys(t.props));t.props.borders&&(dt(c,t.props.borders,r,n),g.delete("borders")),g.forEach(y=>{v.warn(`Unknown node property ${y}`)})}return A(t,c),t.intersect=function(g){return R.rect(t,g)},a},"composite"),wa=u(async(e,t)=>{const{shapeSvg:a}=await P(e,t,"label",!0);v.trace("Classes = ",t.class);const s=a.insert("rect",":first-child"),i=0,c=0;if(s.attr("width",i).attr("height",c),a.attr("class","label edgeLabel"),t.props){const r=new Set(Object.keys(t.props));t.props.borders&&(dt(s,t.props.borders,i,c),r.delete("borders")),r.forEach(n=>{v.warn(`Unknown node property ${n}`)})}return A(t,s),t.intersect=function(r){return R.rect(t,r)},a},"labelRect");function dt(e,t,a,s){const i=[],c=u(n=>{i.push(n,0)},"addBorder"),r=u(n=>{i.push(0,n)},"skipBorder");t.includes("t")?(v.debug("add top border"),c(a)):r(a),t.includes("r")?(v.debug("add right border"),c(s)):r(s),t.includes("b")?(v.debug("add bottom border"),c(a)):r(a),t.includes("l")?(v.debug("add left border"),c(s)):r(s),e.attr("stroke-dasharray",i.join(" "))}u(dt,"applyNodePropertyBorders");var ma=u(async(e,t)=>{let a;t.classes?a="node "+t.classes:a="node default";const s=e.insert("g").attr("class",a).attr("id",t.domId||t.id),i=s.insert("rect",":first-child"),c=s.insert("line"),r=s.insert("g").attr("class","label"),n=t.labelText.flat?t.labelText.flat():t.labelText;let l="";typeof n=="object"?l=n[0]:l=n,v.info("Label text abc79",l,n,typeof n=="object");const d=await G(r,l,t.labelStyle,!0,!0);let g={width:0,height:0};if(H(M())){const _=d.children[0],L=O(d);g=_.getBoundingClientRect(),L.attr("width",g.width),L.attr("height",g.height)}v.info("Text 2",n);const y=n.slice(1,n.length);let w=d.getBBox();const b=await G(r,y.join?y.join("<br/>"):y,t.labelStyle,!0,!0);if(H(M())){const _=b.children[0],L=O(b);g=_.getBoundingClientRect(),L.attr("width",g.width),L.attr("height",g.height)}const m=t.padding/2;return O(b).attr("transform","translate( "+(g.width>w.width?0:(w.width-g.width)/2)+", "+(w.height+m+5)+")"),O(d).attr("transform","translate( "+(g.width<w.width?0:-(w.width-g.width)/2)+", 0)"),g=r.node().getBBox(),r.attr("transform","translate("+-g.width/2+", "+(-g.height/2-m+3)+")"),i.attr("class","outer title-state").attr("x",-g.width/2-m).attr("y",-g.height/2-m).attr("width",g.width+t.padding).attr("height",g.height+t.padding),c.attr("class","divider").attr("x1",-g.width/2-m).attr("x2",g.width/2+m).attr("y1",-g.height/2-m+w.height+m).attr("y2",-g.height/2-m+w.height+m),A(t,i),t.intersect=function(_){return R.rect(t,_)},s},"rectWithTitle"),Sa=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=s.height+t.padding,c=s.width+i/4+t.padding,r=a.insert("rect",":first-child").attr("style",t.style).attr("rx",i/2).attr("ry",i/2).attr("x",-c/2).attr("y",-i/2).attr("width",c).attr("height",i);return A(t,r),t.intersect=function(n){return R.rect(t,n)},a},"stadium"),La=u(async(e,t)=>{const{shapeSvg:a,bbox:s,halfPadding:i}=await P(e,t,V(t,void 0),!0),c=a.insert("circle",":first-child");return c.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",s.width/2+i).attr("width",s.width+t.padding).attr("height",s.height+t.padding),v.info("Circle main"),A(t,c),t.intersect=function(r){return v.info("Circle intersect",t,s.width/2+i,r),R.circle(t,s.width/2+i,r)},a},"circle"),va=u(async(e,t)=>{const{shapeSvg:a,bbox:s,halfPadding:i}=await P(e,t,V(t,void 0),!0),c=5,r=a.insert("g",":first-child"),n=r.insert("circle"),l=r.insert("circle");return r.attr("class",t.class),n.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",s.width/2+i+c).attr("width",s.width+t.padding+c*2).attr("height",s.height+t.padding+c*2),l.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",s.width/2+i).attr("width",s.width+t.padding).attr("height",s.height+t.padding),v.info("DoubleCircle main"),A(t,n),t.intersect=function(d){return v.info("DoubleCircle intersect",t,s.width/2+i+c,d),R.circle(t,s.width/2+i+c,d)},a},"doublecircle"),Ea=u(async(e,t)=>{const{shapeSvg:a,bbox:s}=await P(e,t,V(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:0,y:0},{x:i,y:0},{x:i,y:-c},{x:0,y:-c},{x:0,y:0},{x:-8,y:0},{x:i+8,y:0},{x:i+8,y:-c},{x:-8,y:-c},{x:-8,y:0}],n=q(a,i,c,r);return n.attr("style",t.style),A(t,n),t.intersect=function(l){return R.polygon(t,r,l)},a},"subroutine"),_a=u((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),s=a.insert("circle",":first-child");return s.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),A(t,s),t.intersect=function(i){return R.circle(t,7,i)},a},"start"),Ht=u((e,t,a)=>{const s=e.insert("g").attr("class","node default").attr("id",t.domId||t.id);let i=70,c=10;a==="LR"&&(i=10,c=70);const r=s.append("rect").attr("x",-1*i/2).attr("y",-1*c/2).attr("width",i).attr("height",c).attr("class","fork-join");return A(t,r),t.height=t.height+t.padding/2,t.width=t.width+t.padding/2,t.intersect=function(n){return R.rect(t,n)},s},"forkJoin"),ka=u((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),s=a.insert("circle",":first-child"),i=a.insert("circle",":first-child");return i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),s.attr("class","state-end").attr("r",5).attr("width",10).attr("height",10),A(t,i),t.intersect=function(c){return R.circle(t,7,c)},a},"end"),Ta=u(async(e,t)=>{var E;const a=t.padding/2,s=4,i=8;let c;t.classes?c="node "+t.classes:c="node default";const r=e.insert("g").attr("class",c).attr("id",t.domId||t.id),n=r.insert("rect",":first-child"),l=r.insert("line"),d=r.insert("line");let g=0,y=s;const w=r.insert("g").attr("class","label");let b=0;const m=(E=t.classData.annotations)==null?void 0:E[0],_=t.classData.annotations[0]?"«"+t.classData.annotations[0]+"»":"",L=await G(w,_,t.labelStyle,!0,!0);let C=L.getBBox();if(H(M())){const o=L.children[0],k=O(L);C=o.getBoundingClientRect(),k.attr("width",C.width),k.attr("height",C.height)}t.classData.annotations[0]&&(y+=C.height+s,g+=C.width);let I=t.classData.label;t.classData.type!==void 0&&t.classData.type!==""&&(H(M())?I+="&lt;"+t.classData.type+"&gt;":I+="<"+t.classData.type+">");const N=await G(w,I,t.labelStyle,!0,!0);O(N).attr("class","classTitle");let x=N.getBBox();if(H(M())){const o=N.children[0],k=O(N);x=o.getBoundingClientRect(),k.attr("width",x.width),k.attr("height",x.height)}y+=x.height+s,x.width>g&&(g=x.width);const p=[];t.classData.members.forEach(async o=>{const k=o.getDisplayDetails();let h=k.displayText;H(M())&&(h=h.replace(/</g,"&lt;").replace(/>/g,"&gt;"));const T=await G(w,h,k.cssStyle?k.cssStyle:t.labelStyle,!0,!0);let D=T.getBBox();if(H(M())){const U=T.children[0],F=O(T);D=U.getBoundingClientRect(),F.attr("width",D.width),F.attr("height",D.height)}D.width>g&&(g=D.width),y+=D.height+s,p.push(T)}),y+=i;const f=[];if(t.classData.methods.forEach(async o=>{const k=o.getDisplayDetails();let h=k.displayText;H(M())&&(h=h.replace(/</g,"&lt;").replace(/>/g,"&gt;"));const T=await G(w,h,k.cssStyle?k.cssStyle:t.labelStyle,!0,!0);let D=T.getBBox();if(H(M())){const U=T.children[0],F=O(T);D=U.getBoundingClientRect(),F.attr("width",D.width),F.attr("height",D.height)}D.width>g&&(g=D.width),y+=D.height+s,f.push(T)}),y+=i,m){let o=(g-C.width)/2;O(L).attr("transform","translate( "+(-1*g/2+o)+", "+-1*y/2+")"),b=C.height+s}let S=(g-x.width)/2;return O(N).attr("transform","translate( "+(-1*g/2+S)+", "+(-1*y/2+b)+")"),b+=x.height+s,l.attr("class","divider").attr("x1",-g/2-a).attr("x2",g/2+a).attr("y1",-y/2-a+i+b).attr("y2",-y/2-a+i+b),b+=i,p.forEach(o=>{O(o).attr("transform","translate( "+-g/2+", "+(-1*y/2+b+i/2)+")");const k=o==null?void 0:o.getBBox();b+=((k==null?void 0:k.height)??0)+s}),b+=i,d.attr("class","divider").attr("x1",-g/2-a).attr("x2",g/2+a).attr("y1",-y/2-a+i+b).attr("y2",-y/2-a+i+b),b+=i,f.forEach(o=>{O(o).attr("transform","translate( "+-g/2+", "+(-1*y/2+b)+")");const k=o==null?void 0:o.getBBox();b+=((k==null?void 0:k.height)??0)+s}),n.attr("style",t.style).attr("class","outer title-state").attr("x",-g/2-a).attr("y",-(y/2)-a).attr("width",g+t.padding).attr("height",y+t.padding),A(t,n),t.intersect=function(o){return R.rect(t,o)},r},"class_box"),Kt={rhombus:Yt,composite:ba,question:Yt,rect:xa,labelRect:wa,rectWithTitle:ma,choice:ca,circle:La,doublecircle:va,stadium:Sa,hexagon:la,block_arrow:oa,rect_left_inv_arrow:ha,lean_right:ga,lean_left:ua,trapezoid:da,inv_trapezoid:pa,rect_right_inv_arrow:fa,cylinder:ya,start:_a,end:ka,note:na,subroutine:Ea,fork:Ht,join:Ht,class_box:Ta},ht={},le=u(async(e,t,a)=>{let s,i;if(t.link){let c;M().securityLevel==="sandbox"?c="_top":t.linkTarget&&(c=t.linkTarget||"_blank"),s=e.insert("svg:a").attr("xlink:href",t.link).attr("target",c),i=await Kt[t.shape](s,t,a)}else i=await Kt[t.shape](e,t,a),s=i;return t.tooltip&&i.attr("title",t.tooltip),t.class&&i.attr("class","node default "+t.class),ht[t.id]=s,t.haveCallback&&ht[t.id].attr("class",ht[t.id].attr("class")+" clickable"),s},"insertNode"),Da=u(e=>{const t=ht[e.id];v.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");const a=8,s=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+s-e.width/2)+", "+(e.y-e.height/2-a)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),s},"positionNode");function It(e,t,a=!1){var b,m,_;const s=e;let i="default";(((b=s==null?void 0:s.classes)==null?void 0:b.length)||0)>0&&(i=((s==null?void 0:s.classes)??[]).join(" ")),i=i+" flowchart-label";let c=0,r="",n;switch(s.type){case"round":c=5,r="rect";break;case"composite":c=0,r="composite",n=0;break;case"square":r="rect";break;case"diamond":r="question";break;case"hexagon":r="hexagon";break;case"block_arrow":r="block_arrow";break;case"odd":r="rect_left_inv_arrow";break;case"lean_right":r="lean_right";break;case"lean_left":r="lean_left";break;case"trapezoid":r="trapezoid";break;case"inv_trapezoid":r="inv_trapezoid";break;case"rect_left_inv_arrow":r="rect_left_inv_arrow";break;case"circle":r="circle";break;case"ellipse":r="ellipse";break;case"stadium":r="stadium";break;case"subroutine":r="subroutine";break;case"cylinder":r="cylinder";break;case"group":r="rect";break;case"doublecircle":r="doublecircle";break;default:r="rect"}const l=qe((s==null?void 0:s.styles)??[]),d=s.label,g=s.size??{width:0,height:0,x:0,y:0},y=t.getDiagramId();return{labelStyle:l.labelStyle,shape:r,labelText:d,rx:c,ry:c,class:i,style:l.style,id:s.id,domId:y?`${y}-${s.id}`:s.id,directions:s.directions,width:g.width,height:g.height,x:g.x,y:g.y,positioned:a,intersect:void 0,type:s.type,padding:n??((_=(m=ct())==null?void 0:m.block)==null?void 0:_.padding)??0,widthInColumns:s.widthInColumns??1}}u(It,"getNodeFromBlock");async function oe(e,t,a){const s=It(t,a,!1);if(s.type==="group")return;const i=ct(),c=await le(e,s,{config:i}),r=c.node().getBBox(),n=a.getBlock(s.id);n.size={width:r.width,height:r.height,x:0,y:0,node:c},a.setBlock(n),c.remove()}u(oe,"calculateBlockSize");async function he(e,t,a){const s=It(t,a,!0);if(a.getBlock(s.id).type!=="space"){const c=ct();await le(e,s,{config:c}),t.intersect=s==null?void 0:s.intersect,Da(s)}}u(he,"insertBlockPositioned");async function pt(e,t,a,s){for(const i of t)await s(e,i,a),i.children&&await pt(e,i.children,a,s)}u(pt,"performOperations");async function ge(e,t,a){await pt(e,t,a,oe)}u(ge,"calculateBlockSizes");async function ue(e,t,a){await pt(e,t,a,he)}u(ue,"insertBlocks");async function de(e,t,a,s,i){const c=new Qe({multigraph:!0,compound:!0});c.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(const r of a)r.size&&c.setNode(r.id,{width:r.size.width,height:r.size.height,intersect:r.intersect});for(const r of t)if(r.start&&r.end){const n=s.getBlock(r.start),l=s.getBlock(r.end);if(n!=null&&n.size&&(l!=null&&l.size)){const d=n.size,g=l.size,y=[{x:d.x,y:d.y},{x:d.x+(g.x-d.x)/2,y:d.y+(g.y-d.y)/2},{x:g.x,y:g.y}],w=i?`${i}-${r.id}`:r.id,b=r.thickness==="thick"?"edge-thickness-thick":"edge-thickness-normal",m=r.pattern==="dotted"?"edge-pattern-dotted":"edge-pattern-solid",_=`${b} ${m} flowchart-link LS-a1 LE-b1`;qr(e,{v:r.start,w:r.end,name:w},{...r,id:w,arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:y,classes:_},void 0,"block",c,i),r.label&&(await Vr(e,{...r,label:r.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:y,classes:_}),jr({...r,x:y[1].x,y:y[1].y},{originalPath:y}))}}}u(de,"insertEdges");var Na=u(function(e,t){return t.db.getClasses()},"getClasses"),Ia=u(async function(e,t,a,s){const{securityLevel:i,block:c}=ct(),r=s.db;r.setDiagramId(t);let n;i==="sandbox"&&(n=O("#i"+t));const l=i==="sandbox"?O(n.nodes()[0].contentDocument.body):O("body"),d=i==="sandbox"?l.select(`[id="${t}"]`):O(`[id="${t}"]`);Yr(d,["point","circle","cross"],s.type,t);const y=r.getBlocks(),w=r.getBlocksFlat(),b=r.getEdges(),m=d.insert("g").attr("class","block");await ge(m,y,r);const _=ee(r);if(await ue(m,y,r),await de(m,b,w,r,t),_){const L=_,C=Math.max(1,Math.round(.125*(L.width/L.height))),I=L.height+C+10,N=L.width+10,{useMaxWidth:x}=c;Ye(d,I,N,!!x),v.debug("Here Bounds",_,L),d.attr("viewBox",`${L.x-5} ${L.y-5} ${L.width+10} ${L.height+10}`)}},"draw"),Ca={draw:Ia,getClasses:Na},Fa={parser:nr,db:Tr,renderer:Ca,styles:Nr};export{Fa as diagram};