@next-bricks/diagram 0.46.2 → 0.48.0

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 (38) hide show
  1. package/dist/bricks.json +5 -5
  2. package/dist/chunks/4192.5903f562.js +2 -0
  3. package/dist/chunks/4192.5903f562.js.map +1 -0
  4. package/dist/chunks/9711.58afee04.js +2 -0
  5. package/dist/chunks/9711.58afee04.js.map +1 -0
  6. package/dist/chunks/9961.813fbbe3.js +2 -0
  7. package/dist/chunks/9961.813fbbe3.js.map +1 -0
  8. package/dist/chunks/editable-label.1bd84f29.js +3 -0
  9. package/dist/chunks/{editable-label.224a6514.js.map → editable-label.1bd84f29.js.map} +1 -1
  10. package/dist/chunks/eo-display-canvas.31ead79a.js +2 -0
  11. package/dist/chunks/eo-display-canvas.31ead79a.js.map +1 -0
  12. package/dist/chunks/{eo-draw-canvas.7ee23e06.js → eo-draw-canvas.a5b81b45.js} +2 -2
  13. package/dist/chunks/eo-draw-canvas.a5b81b45.js.map +1 -0
  14. package/dist/chunks/{main.2a2456a9.js → main.463fee46.js} +2 -2
  15. package/dist/chunks/{main.2a2456a9.js.map → main.463fee46.js.map} +1 -1
  16. package/dist/examples.json +4 -4
  17. package/dist/index.a3714a79.js +2 -0
  18. package/dist/{index.7f471621.js.map → index.a3714a79.js.map} +1 -1
  19. package/dist/manifest.json +145 -145
  20. package/dist/types.json +3832 -3760
  21. package/dist-types/diagram/interfaces.d.ts +1 -1
  22. package/dist-types/draw-canvas/interfaces.d.ts +14 -3
  23. package/dist-types/shared/canvas/useLineMarkers.d.ts +2 -0
  24. package/docs/eo-display-canvas.md +13 -7
  25. package/docs/eo-draw-canvas.md +8 -0
  26. package/package.json +2 -2
  27. package/dist/chunks/4192.d6afa672.js +0 -2
  28. package/dist/chunks/4192.d6afa672.js.map +0 -1
  29. package/dist/chunks/6055.c26f35cf.js +0 -2
  30. package/dist/chunks/6055.c26f35cf.js.map +0 -1
  31. package/dist/chunks/9711.b1a2a5bc.js +0 -2
  32. package/dist/chunks/9711.b1a2a5bc.js.map +0 -1
  33. package/dist/chunks/editable-label.224a6514.js +0 -3
  34. package/dist/chunks/eo-display-canvas.162cc0f1.js +0 -2
  35. package/dist/chunks/eo-display-canvas.162cc0f1.js.map +0 -1
  36. package/dist/chunks/eo-draw-canvas.7ee23e06.js.map +0 -1
  37. package/dist/index.7f471621.js +0 -2
  38. /package/dist/chunks/{editable-label.224a6514.js.LICENSE.txt → editable-label.1bd84f29.js.LICENSE.txt} +0 -0
package/dist/bricks.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "id": "bricks/diagram",
3
3
  "bricks": [
4
- "diagram.editable-label",
5
- "diagram.experimental-node"
4
+ "diagram.experimental-node",
5
+ "diagram.editable-label"
6
6
  ],
7
7
  "elements": [
8
8
  "eo-diagram",
9
- "eo-draw-canvas",
10
- "eo-display-canvas"
9
+ "eo-display-canvas",
10
+ "eo-draw-canvas"
11
11
  ],
12
12
  "processors": [],
13
13
  "editors": [],
@@ -16,5 +16,5 @@
16
16
  "basic.lock-body-scroll"
17
17
  ]
18
18
  },
19
- "filePath": "bricks/diagram/dist/index.7f471621.js"
19
+ "filePath": "bricks/diagram/dist/index.a3714a79.js"
20
20
  }
@@ -0,0 +1,2 @@
1
+ "use strict";(globalThis.webpackChunk_next_bricks_diagram=globalThis.webpackChunk_next_bricks_diagram||[]).push([[4192],{3739:(t,e,r)=>{r.d(e,{c:()=>o});var i=r(8769),n=r.n(i);function o(t){let e,{id:r,type:i,strokeColor:o}=t;switch(i){case"0..1":e=y;break;case"0..N":e=x;break;case"circle":e=h;break;default:e=s}return n().createElement(e,{id:r,strokeColor:o})}function h(t){let{id:e,strokeColor:r}=t;return n().createElement("marker",{viewBox:"0 0 9 9",refX:3,refY:3,id:e,overflow:"visible",markerWidth:9,markerHeight:9},n().createElement("circle",{stroke:"none",fill:r,cx:3,cy:3,r:3}))}function s(t){let{id:e,strokeColor:r}=t;return n().createElement("marker",{id:e,viewBox:"0 0 6 6",refX:5,refY:3,markerWidth:6,markerHeight:6,orient:"auto-start-reverse",strokeLinejoin:"round"},n().createElement("path",{d:"M 0.5 0.5 L 5.5 3 L 0.5 5.5 z",stroke:r,strokeWidth:1,fill:r}))}function y(t){let{id:e,strokeColor:r}=t;return n().createElement("marker",{id:e,viewBox:"0 0 21 11",refX:.5,refY:5.5,markerWidth:21,markerHeight:11,orient:"auto-start-reverse"},n().createElement("path",{d:"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 15.5 0.5 V 10.5 M 10.5 5.5 H 20.5",stroke:r,strokeWidth:1,fill:"none"}))}function x(t){let{id:e,strokeColor:r}=t;return n().createElement("marker",{id:e,viewBox:"0 0 21 11",refX:.5,refY:5.5,markerWidth:21,markerHeight:11,orient:"auto-start-reverse"},n().createElement("path",{d:"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 20.5 0.5 L 10.5 5.5 L 20.5 10.5 M 10.5 5.5 H 20.5",stroke:r,strokeWidth:1,fill:"none"}))}},8653:(t,e,r)=>{r.d(e,{S:()=>x});var i=r(482),n=r(4643),o=r(3488),h=r(6066),s=r(4993),y=r(3269);function x(t,e,r,x){if(!Array.isArray(t))return"";let a;switch(e){case"curveLinear":a=i.A;break;case"curveBumpX":a=n.dJ;break;case"curveBumpY":a=n.kl;break;case"curveMonotoneX":a=o.G;break;case"curveMonotoneY":a=o.N;break;case"curveNatural":a=h.A;break;default:a=s.Ay}const l=c(t[1],t[0],r),u=c(t[t.length-2],t[t.length-1],x);return(0,y.A)().x(((e,r)=>e.x-(0===r?l.x:r===t.length-1?u.x:0))).y(((e,r)=>e.y-(0===r?l.y:r===t.length-1?u.y:0))).curve(a)(t)}function c(t,e,r){if(!r)return{x:0,y:0};const{x:i,y:n}=t,{x:o,y:h}=e,s=r/Math.sqrt(Math.pow(o-i,2)+Math.pow(h-n,2));return{x:(o-i)*s,y:(h-n)*s}}},3188:(t,e,r)=>{r.d(e,{h:()=>n});var i=r(733);function n(t,e,r,n){const h=!(null==n||!n.exitPosition),s=!(null==n||!n.entryPosition);if(t===e||(0,i.w)(t,e,0,0)&&!h&&!s)return null;let y,x,c=0,a=0;if(r){const i=e.x-t.x,n=e.y-t.y,o=Math.atan2(n,i);c=r/2*Math.cos(o+Math.PI/2),a=r/2*Math.sin(o+Math.PI/2)}const l=[h?[t.x+(n.exitPosition.x-.5)*t.width,t.y+(n.exitPosition.y-.5)*t.height]:[t.x+c,t.y+a],s?[e.x+(n.entryPosition.x-.5)*e.width,e.y+(n.entryPosition.y-.5)*e.height]:[e.x+c,e.y+a]];if(h)y=l[0];else{const e=o(t,l);y=e.length>0?e[0]:[t.x,t.y]}if(s)x=l[1];else{const t=o(e,l);x=t.length>0?t[0]:[e.x,e.y]}return[{x:y[0],y:y[1]},{x:x[0],y:x[1]}]}function o(t,e){const r=[[t.x-t.width/2,t.y-t.height/2],[t.x+t.width/2,t.y-t.height/2],[t.x+t.width/2,t.y+t.height/2],[t.x-t.width/2,t.y+t.height/2]],i=[];for(let t=0;t<4;t++)i.push([r[t],r[(t+1)%4]]);const n=[];for(const t of i){const r=h(e[0],e[1],t[0],t[1]);r&&n.push(r)}return n}function h(t,e,r,i){let[n,o]=t,[h,s]=e,[y,x]=r,[c,a]=i;if(n===h&&o===s||y===c&&x===a)return null;const l=(a-x)*(h-n)-(c-y)*(s-o);if(0===l)return null;const u=((c-y)*(o-x)-(a-x)*(n-y))/l,f=((h-n)*(o-x)-(s-o)*(n-y))/l;return u<0||u>1||f<0||f>1?null:[n+u*(h-n),o+u*(s-o)]}},4059:(t,e,r)=>{r.d(e,{o:()=>n});const i=20;function n(t,e,r,n,h,s){const y=o(t,r,h),x=o(e,n,s);let c=[],a=!1;const l="top"===r||"bottom"===r;if(l!==("top"===n||"bottom"===n)){let o,h,s,u,f,d;l?(o=e,h=t,s="right"===n?1:-1,u="bottom"===r?1:-1,f=x,d=y):(o=t,h=e,s="right"===r?1:-1,u="bottom"===n?1:-1,f=y,d=x,a=!0);const g=f.x+i*s,k=d.y+i*u;if((o.x-h.x)*s>=0)if((h.y-o.y)*u>=0)c=[{x:d.x,y:k},{x:g,y:k},{x:g,y:f.y}];else{const t=h.y+(h.height/2+i)*u,e=o.y-(o.height/2+i)*u;if((e-t)*u>=0){const r=(t+e)/2;c=[{x:d.x,y:r},{x:g,y:r},{x:g,y:f.y}]}else{const r=(h.x+h.width/2*s+o.x-o.width/2*s)/2;c=[{x:d.x,y:t},{x:r,y:t},{x:r,y:e},{x:g,y:e},{x:g,y:f.y}]}}else if((f.y-k)*u>=0)if((d.x-g)*s>=0)c=[{x:d.x,y:f.y}];else{const t=(h.y+(h.height/2+i)*u+(o.y-(o.height/2+i)*u))/2;c=[{x:d.x,y:t},{x:g,y:t},{x:g,y:f.y}]}else{const t=h.x-(h.width/2+i)*s;if((t-g)*s>=0){const e=(t+g)/2;c=[{x:d.x,y:k},{x:e,y:k},{x:e,y:f.y}]}else{const e=(h.y-h.height/2*u+o.y+o.height/2*u)/2;c=[{x:d.x,y:k},{x:t,y:k},{x:t,y:e},{x:g,y:e},{x:g,y:f.y}]}}}else if(r===n){const n="bottom"===r||"right"===r?1:-1;let o,h,s,u;const f=l?"y":"x",d=l?"x":"y";let g,k,w,m;e[f]<t[f]?(o=e,h=t,s=x,u=y,a=1===n):(o=t,h=e,s=y,u=x,a=1!==n),1===n?(g=h,k=o,w=u,m=s):(g=o,k=h,w=s,m=u);const b=g===(e[d]<t[d]?t:e)?1:-1;if(l){const t=g.x-(g.width/2+i)*b,e=w.y+i*n;if((t-m.x)*b>=0)c=[{x:m.x,y:e},{x:w.x,y:e}];else{const r=(k.y+k.height/2*n+g.y-g.height/2*n)/2;c=[{x:m.x,y:r},{x:t,y:r},{x:t,y:e},{x:w.x,y:e}]}}else{const t=w.x+i*n,e=g.y-(g.height/2+i)*b;if((e-m.y)*b>=0)c=[{x:t,y:m.y},{x:t,y:w.y}];else{const r=(k.x+k.width/2*n+g.x-g.width/2*n)/2;c=[{x:r,y:m.y},{x:r,y:e},{x:t,y:e},{x:t,y:w.y}]}}}else{const r="bottom"===n||"right"===n?1:-1;let o,h,s,a;l?(o="y",h="x",s="height",a="width"):(o="x",h="y",s="width",a="height");const u=e[o]+e[s]/2*r,f=t[o]-t[s]/2*r,d=u+i*r,g=f-i*r,k=y[h]===x[h];if((g-d)*r>=0){const t=(g+d)/2;c=k?[]:[{[h]:y[h],[o]:t},{[h]:x[h],[o]:t}]}else if(k&&(f-u)*r>=0)c=[];else{const n=e[h]<t[h]?-1:1,l=t[h]+(t[a]/2+i)*n,u=e[h]-(e[a]/2+i)*n;if((u-l)*n>=0||Math.abs((g-d)*r)<i){const t=(l+u)/2;c=[{[h]:y[h],[o]:g},{[h]:t,[o]:g},{[h]:t,[o]:d},{[h]:x[h],[o]:d}]}else{const i=(t[o]+t[s]/2*r+e[o]-e[s]/2*r)/2;c=[{[h]:y[h],[o]:g},{[h]:l,[o]:g},{[h]:l,[o]:i},{[h]:u,[o]:i},{[h]:u,[o]:d},{[h]:x[h],[o]:d}]}}}return a&&c.reverse(),[y,...c,x]}function o(t,e,r){const{x:i,y:n,width:o,height:h}=t;switch(e){case"top":return{x:i-o/2+o*r,y:n-h/2};case"bottom":return{x:i-o/2+o*r,y:n+h/2};case"left":return{x:i-o/2,y:n-h/2+h*r};case"right":return{x:i+o/2,y:n-h/2+h*r}}}},733:(t,e,r)=>{function i(t,e,r,i){const o=r?n(t,r):t,h=i?n(e,i):e,s=Math.min(o.x-o.width/2,h.x-h.width/2),y=Math.max(o.x+o.width/2,h.x+h.width/2),x=Math.min(o.y-o.height/2,h.y-h.height/2),c=Math.max(o.y+o.height/2,h.y+h.height/2);return y-s<o.width+h.width&&c-x<o.height+h.height}function n(t,e){return{x:t.x-t.width/2-e,y:t.y-t.height/2-e,width:t.width+2*e,height:t.height+2*e}}r.d(e,{w:()=>i})},8802:(t,e,r)=>{function i(t){if(Array.isArray(t)){const e=t[0],r=t.length>1?t[1]:e;return[e,r,t.length>2?t[2]:e,t.length>3?t[3]:r]}return new Array(4).fill(t)}r.d(e,{D:()=>i})}}]);
2
+ //# sourceMappingURL=4192.5903f562.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunks/4192.5903f562.js","mappings":"gLAYO,SAASA,EAAeC,GAIO,IAChCC,GAL0B,GAC9BC,EAAE,KACFC,EAAI,YACJC,GACqBJ,EAGrB,OAAQG,GACN,IAAK,OACHF,EAAYI,EACZ,MACF,IAAK,OACHJ,EAAYK,EACZ,MACF,IAAK,SACHL,EAAYM,EACZ,MACF,QACEN,EAAYO,EAEhB,OAAOC,IAAAA,cAACR,EAAS,CAACC,GAAIA,EAAIE,YAAaA,GACzC,CAEA,SAASG,EAAYG,GAGqB,IAHpB,GACpBR,EAAE,YACFE,GACyBM,EAGzB,OACED,IAAAA,cAAA,UACEE,QAAS,UACTC,KALM,EAMNC,KANM,EAONX,GAAIA,EACJY,SAAS,UACTC,YARMC,EASNC,aATMD,GAWNP,IAAAA,cAAA,UAAQS,OAAO,OAAOC,KAAMf,EAAagB,GAZnC,EAY0CC,GAZ1C,EAYiDL,EAZjD,IAeZ,CAEA,SAASR,EAAWc,GAGsB,IAHrB,GACnBpB,EAAE,YACFE,GACyBkB,EACzB,OACEb,IAAAA,cAAA,UACEP,GAAIA,EACJS,QAAQ,UACRC,KAAM,EACNC,KAAM,EACNE,YAAa,EACbE,aAAc,EACdM,OAAO,qBACPC,eAAe,SAEff,IAAAA,cAAA,QACEgB,EAAE,gCACFP,OAAQd,EACRsB,YAAa,EACbP,KAAMf,IAId,CAEA,SAASC,EAA6BsB,GAGI,IAHH,GACrCzB,EAAE,YACFE,GACyBuB,EACzB,OACElB,IAAAA,cAAA,UACEP,GAAIA,EACJS,QAAQ,YACRC,KAAM,GACNC,KAAM,IACNE,YAAa,GACbE,aAAc,GACdM,OAAO,sBAEPd,IAAAA,cAAA,QACEgB,EAAE,yFACFP,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AAI/I,MAAM,GAAGf,KAAK4J,EAC3B,C","sources":["webpack:///./src/diagram/MarkerComponent.tsx","webpack:///./src/diagram/lines/curveLine.ts","webpack:///./src/diagram/lines/getDirectLinePoints.ts","webpack:///./src/diagram/lines/getPolyLinePoints.ts","webpack:///./src/diagram/processors/doTwoNodesOverlap.ts","webpack:///./src/diagram/processors/extractPartialRectTuple.ts"],"sourcesContent":["import React from \"react\";\nimport type { LineMarkerType } from \"./interfaces\";\n\nexport interface MarkerComponentProps extends BaseMarkerComponentProps {\n type: LineMarkerType;\n}\n\nexport interface BaseMarkerComponentProps {\n id: string;\n strokeColor?: string;\n}\n\nexport function MarkerComponent({\n id,\n type,\n strokeColor,\n}: MarkerComponentProps): JSX.Element {\n let Component: (props: BaseMarkerComponentProps) => JSX.Element;\n\n switch (type) {\n case \"0..1\":\n Component = EntityRelationZeroOrOneMarker;\n break;\n case \"0..N\":\n Component = EntityRelationZeroOrManyMarker;\n break;\n case \"circle\":\n Component = CircleMarker;\n break;\n default:\n Component = ArrowMarker;\n }\n return <Component id={id} strokeColor={strokeColor} />;\n}\n\nfunction CircleMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n const r = 3;\n const d = r * 3;\n return (\n <marker\n viewBox={`0 0 ${d} ${d}`}\n refX={r}\n refY={r}\n id={id}\n overflow=\"visible\"\n markerWidth={d}\n markerHeight={d}\n >\n <circle stroke=\"none\" fill={strokeColor} cx={r} cy={r} r={r} />\n </marker>\n );\n}\n\nfunction ArrowMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 6 6\"\n refX={5}\n refY={3}\n markerWidth={6}\n markerHeight={6}\n orient=\"auto-start-reverse\"\n strokeLinejoin=\"round\"\n >\n <path\n d=\"M 0.5 0.5 L 5.5 3 L 0.5 5.5 z\"\n stroke={strokeColor}\n strokeWidth={1}\n fill={strokeColor}\n />\n </marker>\n );\n}\n\nfunction EntityRelationZeroOrOneMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 21 11\"\n refX={0.5}\n refY={5.5}\n markerWidth={21}\n markerHeight={11}\n orient=\"auto-start-reverse\"\n >\n <path\n d=\"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 15.5 0.5 V 10.5 M 10.5 5.5 H 20.5\"\n stroke={strokeColor}\n strokeWidth={1}\n fill=\"none\"\n />\n </marker>\n );\n}\n\nfunction EntityRelationZeroOrManyMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 21 11\"\n refX={0.5}\n refY={5.5}\n markerWidth={21}\n markerHeight={11}\n orient=\"auto-start-reverse\"\n >\n <path\n d=\"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 20.5 0.5 L 10.5 5.5 L 20.5 10.5 M 10.5 5.5 H 20.5\"\n stroke={strokeColor}\n strokeWidth={1}\n fill=\"none\"\n />\n </marker>\n );\n}\n","import {\n curveLinear,\n line,\n curveBasis,\n curveBumpX,\n curveBumpY,\n type CurveFactory,\n curveMonotoneX,\n curveNatural,\n curveMonotoneY,\n} from \"d3-shape\";\nimport type { CurveType, NodePosition } from \"../interfaces\";\n\n/**\n * Generate Line from points\n */\nexport function curveLine(\n points: Array<NodePosition> | null | undefined,\n curveType: CurveType | undefined,\n startOffset: number,\n endOffset: number\n): string {\n if (!Array.isArray(points)) {\n return \"\";\n }\n let curveFactory: CurveFactory;\n switch (curveType) {\n case \"curveLinear\":\n curveFactory = curveLinear;\n break;\n case \"curveBumpX\":\n curveFactory = curveBumpX;\n break;\n case \"curveBumpY\":\n curveFactory = curveBumpY;\n break;\n case \"curveMonotoneX\":\n curveFactory = curveMonotoneX;\n break;\n case \"curveMonotoneY\":\n curveFactory = curveMonotoneY;\n break;\n case \"curveNatural\":\n curveFactory = curveNatural;\n break;\n default:\n curveFactory = curveBasis;\n }\n const startOffsets = getOffsets(points[1], points[0], startOffset);\n const endOffsets = getOffsets(\n points[points.length - 2],\n points[points.length - 1],\n endOffset\n );\n const lineFunction = line()\n .x(\n (d, index) =>\n (d as unknown as { x: number }).x -\n (index === 0\n ? startOffsets.x\n : index === points.length - 1\n ? endOffsets.x\n : 0)\n )\n .y(\n (d, index) =>\n (d as unknown as { y: number }).y -\n (index === 0\n ? startOffsets.y\n : index === points.length - 1\n ? endOffsets.y\n : 0)\n )\n .curve(curveFactory);\n return lineFunction(points as unknown as Array<[number, number]>)!;\n}\n\nfunction getOffsets(\n start: NodePosition,\n end: NodePosition,\n offset: number\n): NodePosition {\n if (!offset) {\n return { x: 0, y: 0 };\n }\n const { x: x0, y: y0 } = start;\n const { x: x1, y: y1 } = end;\n const distance = Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2));\n const ratio = offset / distance;\n return {\n x: (x1 - x0) * ratio,\n y: (y1 - y0) * ratio,\n };\n}\n","import type { EdgeView } from \"../../draw-canvas/interfaces\";\nimport type { NodePosition, NodeRect, PositionTuple } from \"../interfaces\";\nimport { doTwoNodesOverlap } from \"../processors/doTwoNodesOverlap\";\n\ntype LineTuple = [start: PositionTuple, end: PositionTuple];\n\nexport function getDirectLinePoints(\n source: NodeRect,\n target: NodeRect,\n parallelGap?: number,\n edgeView?: EdgeView\n): NodePosition[] | null {\n const hasExitPosition = !!edgeView?.exitPosition;\n const hasEntryPosition = !!edgeView?.entryPosition;\n\n // Ignore if two nodes are the same.\n // Ignore if two nodes overlap and no entry nor exit position.\n if (\n source === target ||\n (doTwoNodesOverlap(source, target, 0, 0) &&\n !(hasExitPosition || hasEntryPosition))\n ) {\n return null;\n }\n\n let p0: PositionTuple;\n let p1: PositionTuple;\n\n let xDiff = 0;\n let yDiff = 0;\n\n if (parallelGap) {\n const dx = target.x - source.x;\n const dy = target.y - source.y;\n const angle = Math.atan2(dy, dx);\n xDiff = (parallelGap / 2) * Math.cos(angle + Math.PI / 2);\n yDiff = (parallelGap / 2) * Math.sin(angle + Math.PI / 2);\n }\n\n const line: LineTuple = [\n hasExitPosition\n ? [\n source.x + (edgeView!.exitPosition!.x - 0.5) * source.width,\n source.y + (edgeView!.exitPosition!.y - 0.5) * source.height,\n ]\n : [source.x + xDiff, source.y + yDiff],\n hasEntryPosition\n ? [\n target.x + (edgeView!.entryPosition!.x - 0.5) * target.width,\n target.y + (edgeView!.entryPosition!.y - 0.5) * target.height,\n ]\n : [target.x + xDiff, target.y + yDiff],\n ];\n\n if (hasExitPosition) {\n p0 = line[0];\n } else {\n const sourceIntersections = getIntersections(source, line);\n // Todo: handle when more than one intersection\n if (sourceIntersections.length > 0) {\n p0 = sourceIntersections[0];\n } else {\n p0 = [source.x, source.y];\n }\n }\n\n if (hasEntryPosition) {\n p1 = line[1];\n } else {\n const targetIntersections = getIntersections(target, line);\n // Todo: handle when more than one intersection\n if (targetIntersections.length > 0) {\n p1 = targetIntersections[0];\n } else {\n p1 = [target.x, target.y];\n }\n }\n\n return [\n { x: p0[0], y: p0[1] },\n { x: p1[0], y: p1[1] },\n ];\n}\n\nfunction getIntersections(rect: NodeRect, line: LineTuple) {\n const vertices: PositionTuple[] = [\n [rect.x - rect.width / 2, rect.y - rect.height / 2],\n [rect.x + rect.width / 2, rect.y - rect.height / 2],\n [rect.x + rect.width / 2, rect.y + rect.height / 2],\n [rect.x - rect.width / 2, rect.y + rect.height / 2],\n ];\n const possibleLines: [start: PositionTuple, end: PositionTuple][] = [];\n for (let i = 0; i < 4; i++) {\n possibleLines.push([vertices[i], vertices[(i + 1) % 4]]);\n }\n const intersections: PositionTuple[] = [];\n for (const item of possibleLines) {\n const intersection = intersect(line[0], line[1], item[0], item[1]);\n if (intersection) {\n intersections.push(intersection);\n }\n }\n return intersections;\n}\n\n// https://paulbourke.net/geometry/pointlineplane/javascript.txt\nfunction intersect(\n [x1, y1]: PositionTuple,\n [x2, y2]: PositionTuple,\n [x3, y3]: PositionTuple,\n [x4, y4]: PositionTuple\n): null | PositionTuple {\n // Check if none of the lines are of length 0\n if ((x1 === x2 && y1 === y2) || (x3 === x4 && y3 === y4)) {\n return null;\n }\n\n const denominator = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);\n\n // Lines are parallel\n if (denominator === 0) {\n return null;\n }\n\n const ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denominator;\n const ub = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denominator;\n\n // is the intersection along the segments\n if (ua < 0 || ua > 1 || ub < 0 || ub > 1) {\n return null;\n }\n\n // Return a object with the x and y coordinates of the intersection\n const x = x1 + ua * (x2 - x1);\n const y = y1 + ua * (y2 - y1);\n\n return [x, y];\n}\n","import type { Direction, NodePosition, NodeRect } from \"../interfaces\";\n\nconst MINIMAL_OFFSET = 20;\n\nexport function getPolyLinePoints(\n source: NodeRect,\n target: NodeRect,\n sourceDirection: Direction,\n targetDirection: Direction,\n sourcePosition: number,\n targetPosition: number\n): NodePosition[] {\n const p0 = getCoordinates(source, sourceDirection, sourcePosition);\n const p1 = getCoordinates(target, targetDirection, targetPosition);\n\n let controls: NodePosition[] = [];\n let reverseControls = false;\n\n const sourceIsVertical =\n sourceDirection === \"top\" || sourceDirection === \"bottom\";\n const targetIsVertical =\n targetDirection === \"top\" || targetDirection === \"bottom\";\n\n if (sourceIsVertical !== targetIsVertical) {\n // One is vertical and the other is horizontal\n let horizontal: NodeRect;\n let vertical: NodeRect;\n let horizontalSign: number;\n let verticalSign: number;\n let horizontalPosition: NodePosition;\n let verticalPosition: NodePosition;\n if (sourceIsVertical) {\n horizontal = target;\n vertical = source;\n horizontalSign = targetDirection === \"right\" ? 1 : -1;\n verticalSign = sourceDirection === \"bottom\" ? 1 : -1;\n horizontalPosition = p1;\n verticalPosition = p0;\n } else {\n horizontal = source;\n vertical = target;\n horizontalSign = sourceDirection === \"right\" ? 1 : -1;\n verticalSign = targetDirection === \"bottom\" ? 1 : -1;\n horizontalPosition = p0;\n verticalPosition = p1;\n reverseControls = true;\n }\n\n const defaultControlX =\n horizontalPosition.x + MINIMAL_OFFSET * horizontalSign;\n const defaultControlY = verticalPosition.y + MINIMAL_OFFSET * verticalSign;\n\n if ((horizontal.x - vertical.x) * horizontalSign >= 0) {\n if ((vertical.y - horizontal.y) * verticalSign >= 0) {\n // ┌──────────────┐\n // ┌──┴──┐ ┌─────┐ │\n // │ S │ │ T ├─┘\n // └─────┘ └─────┘\n controls = [\n { x: verticalPosition.x, y: defaultControlY },\n { x: defaultControlX, y: defaultControlY },\n { x: defaultControlX, y: horizontalPosition.y },\n ];\n } else {\n const controlY0 =\n vertical.y + (vertical.height / 2 + MINIMAL_OFFSET) * verticalSign;\n const controlY1 =\n horizontal.y -\n (horizontal.height / 2 + MINIMAL_OFFSET) * verticalSign;\n if ((controlY1 - controlY0) * verticalSign >= 0) {\n // ┌─────┐\n // │ T ├─┐\n // └─────┘ │\n // ┌────────┘\n // ┌──┴──┐\n // │ S │\n // └─────┘\n const middleY = (controlY0 + controlY1) / 2;\n controls = [\n { x: verticalPosition.x, y: middleY },\n { x: defaultControlX, y: middleY },\n { x: defaultControlX, y: horizontalPosition.y },\n ];\n } else {\n // ┌─────┐\n // ┌────┐ │ T ├─┐\n // ┌──┴──┐ │ └─────┘ │\n // │ S │ └─────────┘\n // └─────┘\n const middleX =\n (vertical.x +\n (vertical.width / 2) * horizontalSign +\n horizontal.x -\n (horizontal.width / 2) * horizontalSign) /\n 2;\n controls = [\n { x: verticalPosition.x, y: controlY0 },\n { x: middleX, y: controlY0 },\n { x: middleX, y: controlY1 },\n { x: defaultControlX, y: controlY1 },\n { x: defaultControlX, y: horizontalPosition.y },\n ];\n }\n }\n } else if ((horizontalPosition.y - defaultControlY) * verticalSign >= 0) {\n if ((verticalPosition.x - defaultControlX) * horizontalSign >= 0) {\n // ┌─────┐\n // ┌──┤ T │\n // │ └─────┘\n // ┌──┴──┐\n // │ S │\n // └─────┘\n controls = [{ x: verticalPosition.x, y: horizontalPosition.y }];\n } else {\n // ┌─────┐\n // │ T ├─┐\n // └─────┘ │\n // ┌─┘\n // ┌──┴──┐\n // │ S │\n // └─────┘\n const controlY0 =\n vertical.y + (vertical.height / 2 + MINIMAL_OFFSET) * verticalSign;\n const controlY1 =\n horizontal.y -\n (horizontal.height / 2 + MINIMAL_OFFSET) * verticalSign;\n const middleY = (controlY0 + controlY1) / 2;\n controls = [\n { x: verticalPosition.x, y: middleY },\n { x: defaultControlX, y: middleY },\n { x: defaultControlX, y: horizontalPosition.y },\n ];\n }\n } else {\n const sourceExtendX =\n vertical.x - (vertical.width / 2 + MINIMAL_OFFSET) * horizontalSign;\n if ((sourceExtendX - defaultControlX) * horizontalSign >= 0) {\n // ┌────┐\n // │ ┌──┴──┐\n // │ │ S │\n // ┌─────┐ │ └─────┘\n // │ T ├─┘\n // └─────┘\n const middleX = (sourceExtendX + defaultControlX) / 2;\n controls = [\n { x: verticalPosition.x, y: defaultControlY },\n { x: middleX, y: defaultControlY },\n { x: middleX, y: horizontalPosition.y },\n ];\n } else {\n // ┌────┐\n // │ ┌──┴──┐\n // │ │ S │\n // │ └─────┘\n // └───┐\n // ┌─────┐ │\n // │ T ├─┘\n // └─────┘\n const middleY =\n (vertical.y -\n (vertical.height / 2) * verticalSign +\n horizontal.y +\n (horizontal.height / 2) * verticalSign) /\n 2;\n controls = [\n { x: verticalPosition.x, y: defaultControlY },\n { x: sourceExtendX, y: defaultControlY },\n { x: sourceExtendX, y: middleY },\n { x: defaultControlX, y: middleY },\n { x: defaultControlX, y: horizontalPosition.y },\n ];\n }\n }\n } else if (sourceDirection === targetDirection) {\n // Same direction\n const sign =\n sourceDirection === \"bottom\" || sourceDirection === \"right\" ? 1 : -1;\n let start: NodeRect;\n let end: NodeRect;\n let startPosition: NodePosition;\n let endPosition: NodePosition;\n const axis = sourceIsVertical ? \"y\" : \"x\";\n const oppositeAxis = sourceIsVertical ? \"x\" : \"y\";\n if (target[axis] < source[axis]) {\n start = target;\n end = source;\n startPosition = p1;\n endPosition = p0;\n reverseControls = sign === 1;\n } else {\n start = source;\n end = target;\n startPosition = p0;\n endPosition = p1;\n reverseControls = sign !== 1;\n }\n const perpendicular =\n target[oppositeAxis] < source[oppositeAxis] ? source : target;\n let around: NodeRect;\n let nonAround: NodeRect;\n let aroundPosition: NodePosition;\n let nonAroundPosition: NodePosition;\n if (sign === 1) {\n around = end;\n nonAround = start;\n aroundPosition = endPosition;\n nonAroundPosition = startPosition;\n } else {\n around = start;\n nonAround = end;\n aroundPosition = startPosition;\n nonAroundPosition = endPosition;\n }\n const aroundSign = around === perpendicular ? 1 : -1;\n if (sourceIsVertical) {\n const defaultControlX =\n around.x - (around.width / 2 + MINIMAL_OFFSET) * aroundSign;\n const defaultControlY = aroundPosition.y + MINIMAL_OFFSET * sign;\n if ((defaultControlX - nonAroundPosition.x) * aroundSign >= 0) {\n // ┌─────────┐\n // │ ┌──┴──┐\n // │ │ T │\n // ┌──┴──┐ └─────┘\n // │ S │\n // └─────┘\n controls = [\n { x: nonAroundPosition.x, y: defaultControlY },\n { x: aroundPosition.x, y: defaultControlY },\n ];\n } else {\n // ┌────┐\n // │ ┌──┴──┐\n // │ │ T │\n // │ └─────┘\n // └─┐\n // ┌──┴──┐\n // │ S │\n // └─────┘\n const middleY =\n (nonAround.y +\n (nonAround.height / 2) * sign +\n around.y -\n (around.height / 2) * sign) /\n 2;\n controls = [\n { x: nonAroundPosition.x, y: middleY },\n { x: defaultControlX, y: middleY },\n { x: defaultControlX, y: defaultControlY },\n { x: aroundPosition.x, y: defaultControlY },\n ];\n }\n } else {\n const defaultControlX = aroundPosition.x + MINIMAL_OFFSET * sign;\n const defaultControlY =\n around.y - (around.height / 2 + MINIMAL_OFFSET) * aroundSign;\n if ((defaultControlY - nonAroundPosition.y) * aroundSign >= 0) {\n // ┌─────┐\n // ┌─────────┤ T │\n // │ ┌─────┐ └─────┘\n // └─┤ S │\n // └─────┘\n controls = [\n { x: defaultControlX, y: nonAroundPosition.y },\n { x: defaultControlX, y: aroundPosition.y },\n ];\n } else {\n // ┌─────────┐\n // │ ┌─────┐ │ ┌─────┐\n // └─┤ S │ └─┤ T │\n // └─────┘ └─────┘\n const middleX =\n (nonAround.x +\n (nonAround.width / 2) * sign +\n around.x -\n (around.width / 2) * sign) /\n 2;\n controls = [\n { x: middleX, y: nonAroundPosition.y },\n { x: middleX, y: defaultControlY },\n { x: defaultControlX, y: defaultControlY },\n { x: defaultControlX, y: aroundPosition.y },\n ];\n }\n }\n } else {\n // Opposite direction\n const targetSign =\n targetDirection === \"bottom\" || targetDirection === \"right\" ? 1 : -1;\n let axis: \"x\" | \"y\";\n let oppositeAxis: \"x\" | \"y\";\n let size: \"width\" | \"height\";\n let oppositeSize: \"width\" | \"height\";\n if (sourceIsVertical) {\n axis = \"y\";\n oppositeAxis = \"x\";\n size = \"height\";\n oppositeSize = \"width\";\n } else {\n axis = \"x\";\n oppositeAxis = \"y\";\n size = \"width\";\n oppositeSize = \"height\";\n }\n const targetEdge = target[axis] + (target[size] / 2) * targetSign;\n const sourceEdge = source[axis] - (source[size] / 2) * targetSign;\n const targetControl = targetEdge + MINIMAL_OFFSET * targetSign;\n const sourceControl = sourceEdge - MINIMAL_OFFSET * targetSign;\n const oppositeIsStraight = p0[oppositeAxis] === p1[oppositeAxis];\n if ((sourceControl - targetControl) * targetSign >= 0) {\n const middle = (sourceControl + targetControl) / 2;\n if (oppositeIsStraight) {\n // Straight line\n // ┌─────┐\n // │ T │\n // └──┬──┘\n // │\n // ┌──┴──┐\n // │ S │\n // └─────┘\n controls = [];\n } else {\n // ┌─────┐\n // │ T │\n // └──┬──┘\n // ┌───┘\n // ┌──┴──┐\n // │ S │\n // └─────┘\n controls = [\n { [oppositeAxis]: p0[oppositeAxis], [axis]: middle },\n { [oppositeAxis]: p1[oppositeAxis], [axis]: middle },\n ] as unknown[] as NodePosition[];\n }\n } else if (\n oppositeIsStraight &&\n (sourceEdge - targetEdge) * targetSign >= 0\n ) {\n // Straight line (very close)\n // ┌─────┐\n // │ T │\n // └──┬──┘\n // ┌──┴──┐\n // │ S │\n // └─────┘\n controls = [];\n } else {\n const targetOppositeSign =\n target[oppositeAxis] < source[oppositeAxis] ? -1 : 1;\n const sourceOppositeControl =\n source[oppositeAxis] +\n (source[oppositeSize] / 2 + MINIMAL_OFFSET) * targetOppositeSign;\n const targetOppositeControl =\n target[oppositeAxis] -\n (target[oppositeSize] / 2 + MINIMAL_OFFSET) * targetOppositeSign;\n if (\n (targetOppositeControl - sourceOppositeControl) * targetOppositeSign >=\n 0 ||\n Math.abs((sourceControl - targetControl) * targetSign) < MINIMAL_OFFSET\n ) {\n // ┌─────┐\n // ┌────┐ │ T │\n // ┌──┴──┐ │ └──┬──┘\n // │ S │ └────┘\n // └─────┘\n const oppositeMiddle =\n (sourceOppositeControl + targetOppositeControl) / 2;\n controls = [\n { [oppositeAxis]: p0[oppositeAxis], [axis]: sourceControl },\n { [oppositeAxis]: oppositeMiddle, [axis]: sourceControl },\n { [oppositeAxis]: oppositeMiddle, [axis]: targetControl },\n { [oppositeAxis]: p1[oppositeAxis], [axis]: targetControl },\n ] as unknown[] as NodePosition[];\n } else {\n // ┌────┐\n // ┌──┴──┐ │\n // │ S │ │\n // └─────┘ │\n // ┌─────────┘\n // │ ┌─────┐\n // │ │ T │\n // │ └──┬──┘\n // └────┘\n const middle =\n (source[axis] +\n (source[size] / 2) * targetSign +\n target[axis] -\n (target[size] / 2) * targetSign) /\n 2;\n controls = [\n { [oppositeAxis]: p0[oppositeAxis], [axis]: sourceControl },\n { [oppositeAxis]: sourceOppositeControl, [axis]: sourceControl },\n { [oppositeAxis]: sourceOppositeControl, [axis]: middle },\n { [oppositeAxis]: targetOppositeControl, [axis]: middle },\n { [oppositeAxis]: targetOppositeControl, [axis]: targetControl },\n { [oppositeAxis]: p1[oppositeAxis], [axis]: targetControl },\n ] as unknown[] as NodePosition[];\n }\n }\n }\n\n if (reverseControls) {\n controls.reverse();\n }\n\n return [p0, ...controls, p1] as NodePosition[];\n}\n\nfunction getCoordinates(\n node: NodeRect,\n direction: Direction,\n position: number\n): NodePosition {\n const { x, y, width, height } = node;\n switch (direction) {\n case \"top\":\n return {\n x: x - width / 2 + width * position,\n y: y - height / 2,\n };\n case \"bottom\":\n return {\n x: x - width / 2 + width * position,\n y: y + height / 2,\n };\n case \"left\":\n return {\n x: x - width / 2,\n y: y - height / 2 + height * position,\n };\n case \"right\":\n return {\n x: x + width / 2,\n y: y - height / 2 + height * position,\n };\n }\n}\n","import type { NodeRect } from \"../interfaces\";\n\nexport function doTwoNodesOverlap(\n a: NodeRect,\n b: NodeRect,\n paddingA: number,\n paddingB: number\n): boolean {\n const A = paddingA ? getNodesWithPadding(a, paddingA) : a;\n const B = paddingB ? getNodesWithPadding(b, paddingB) : b;\n const left = Math.min(A.x - A.width / 2, B.x - B.width / 2);\n const right = Math.max(A.x + A.width / 2, B.x + B.width / 2);\n const top = Math.min(A.y - A.height / 2, B.y - B.height / 2);\n const bottom = Math.max(A.y + A.height / 2, B.y + B.height / 2);\n return right - left < A.width + B.width && bottom - top < A.height + B.height;\n}\n\nfunction getNodesWithPadding(node: NodeRect, padding: number) {\n return {\n x: node.x - node.width / 2 - padding,\n y: node.y - node.height / 2 - padding,\n width: node.width + padding * 2,\n height: node.height + padding * 2,\n };\n}\n","import type { FullRectTuple, PartialRectTuple } from \"../interfaces\";\n\nexport function extractPartialRectTuple(\n value: PartialRectTuple\n): FullRectTuple {\n if (Array.isArray(value)) {\n const v0 = value[0];\n const v1 = value.length > 1 ? value[1]! : v0;\n const v2 = value.length > 2 ? value[2]! : v0;\n const v3 = value.length > 3 ? value[3]! : v1;\n return [v0, v1, v2, v3];\n }\n return new Array(4).fill(value) as FullRectTuple;\n}\n"],"names":["MarkerComponent","_ref","Component","id","type","strokeColor","EntityRelationZeroOrOneMarker","EntityRelationZeroOrManyMarker","CircleMarker","ArrowMarker","React","_ref2","viewBox","refX","refY","overflow","markerWidth","r","markerHeight","stroke","fill","cx","cy","_ref3","orient","strokeLinejoin","d","strokeWidth","_ref4","_ref5","curveLine","points","curveType","startOffset","endOffset","Array","isArray","curveFactory","curveLinear","curveBumpX","curveBumpY","curveMonotoneX","curveMonotoneY","curveNatural","curveBasis","startOffsets","getOffsets","endOffsets","length","line","x","index","y","curve","lineFunction","start","end","offset","x0","y0","x1","y1","ratio","Math","sqrt","pow","getDirectLinePoints","source","target","parallelGap","edgeView","hasExitPosition","exitPosition","hasEntryPosition","entryPosition","doTwoNodesOverlap","p0","p1","xDiff","yDiff","dx","dy","angle","atan2","cos","PI","sin","width","height","sourceIntersections","getIntersections","targetIntersections","rect","vertices","possibleLines","i","push","intersections","item","intersection","intersect","x2","y2","x3","y3","x4","y4","denominator","ua","ub","MINIMAL_OFFSET","getPolyLinePoints","sourceDirection","targetDirection","sourcePosition","targetPosition","getCoordinates","controls","reverseControls","sourceIsVertical","horizontal","vertical","horizontalSign","verticalSign","horizontalPosition","verticalPosition","defaultControlX","defaultControlY","controlY0","controlY1","middleY","middleX","sourceExtendX","sign","startPosition","endPosition","axis","oppositeAxis","around","nonAround","aroundPosition","nonAroundPosition","aroundSign","targetSign","size","oppositeSize","targetEdge","sourceEdge","targetControl","sourceControl","oppositeIsStraight","middle","targetOppositeSign","sourceOppositeControl","targetOppositeControl","abs","oppositeMiddle","reverse","node","direction","position","a","b","paddingA","paddingB","A","getNodesWithPadding","B","left","min","right","max","top","bottom","padding","extractPartialRectTuple","value","v0","v1"],"sourceRoot":""}
@@ -0,0 +1,2 @@
1
+ "use strict";(globalThis.webpackChunk_next_bricks_diagram=globalThis.webpackChunk_next_bricks_diagram||[]).push([[9711,8939],{9711:(e,t,a)=>{var n,s=a(4635),l=a(918),i=a(6902),o=a(5536),r=a(6121),d=a(829),h=a(2740),c=a(8769),u=a.n(c),g=a(300),p=a(4295),A=(a(6477),a(7566)),m=a(9047),v=a(3373),y=a.n(v),f=a(1030),b=a(9126),k=a(8892),w=a(5157),C=a(8308),E=a(1518),M=a(9137),x=a(2547),W=a(1803),N=a(3739),S=a(9191),T=a(6671),R=a(8060),L=a(2448),z=a(8657),B=a(8069),D=a(1324),$=a(821),H=a(6753),P=a(2673),O=a(5987);let K,I,U,V,Y,X,_,j,F,Z,q,G,J,Q,ee,te,ae,ne,se,le,ie,oe,re,de,he,ce,ue,ge,pe,Ae,me,ve,ye,fe,be,ke,we,Ce,Ee,Me,xe,We,Ne,Se,Te,Re,Le,ze,Be,De,$e,He,Pe,Oe;const{defineElement:Ke,property:Ie,event:Ue,method:Ve}=(0,g.createDecorators)(),Ye=(0,c.forwardRef)(wt);let Xe;var _e=new WeakMap,je=new WeakMap,Fe=new WeakMap,Ze=new WeakMap,qe=new WeakMap,Ge=new WeakMap,Je=new WeakMap,Qe=new WeakMap,et=new WeakMap,tt=new WeakMap,at=new WeakMap,nt=new WeakMap,st=new WeakMap,lt=new WeakMap,it=new WeakMap,ot=new WeakSet,rt=new WeakMap,dt=new WeakMap,ht=new WeakMap,ct=new WeakMap,ut=new WeakMap,gt=new WeakMap,pt=new WeakMap,At=new WeakMap,mt=new WeakMap,vt=new WeakMap,yt=new WeakMap,ft=new WeakMap,bt=new WeakMap;class kt extends p.ReactNextElement{constructor(){super(...arguments),(0,s.A)(this,ot),(0,l.A)(this,_e,(K(this),U(this))),(0,l.A)(this,je,(V(this),Y(this))),(0,l.A)(this,Fe,(X(this),_(this))),(0,l.A)(this,Ze,(j(this),F(this))),(0,l.A)(this,qe,(Z(this),q(this))),(0,l.A)(this,Ge,(G(this),J(this))),(0,l.A)(this,Je,(Q(this),ee(this))),(0,l.A)(this,Qe,(te(this),ae(this))),(0,l.A)(this,et,(ne(this),se(this))),(0,l.A)(this,tt,(le(this),ie(this))),(0,l.A)(this,at,(oe(this),re(this,!0))),(0,l.A)(this,nt,(de(this),he(this,!0))),(0,l.A)(this,st,(ce(this),ue(this,!0))),(0,l.A)(this,lt,(ge(this),pe(this))),(0,l.A)(this,it,(Ae(this),me(this))),(0,l.A)(this,rt,(fe(this),e=>{(0,o.A)(ot,this,ve).emit(e)})),(0,l.A)(this,dt,be(this)),(0,l.A)(this,ht,(Ce(this),e=>{(0,o.A)(ot,this,ke).emit(e)})),(0,l.A)(this,ct,Ee(this)),(0,l.A)(this,ut,(We(this),e=>{(0,o.A)(ot,this,Me).emit(e)})),(0,l.A)(this,gt,Ne(this)),(0,l.A)(this,pt,(Re(this),e=>{(0,o.A)(ot,this,Se).emit(e)})),(0,l.A)(this,At,Le(this)),(0,l.A)(this,mt,(De(this),e=>{(0,o.A)(ot,this,ze).emit(e)})),(0,l.A)(this,vt,$e(this)),(0,l.A)(this,yt,(Oe(this),e=>{(0,o.A)(ot,this,He).emit(e)})),(0,l.A)(this,ft,(e=>{(0,P.c)(e,this.activeTarget)||(this.activeTarget=e)})),(0,l.A)(this,bt,(0,c.createRef)())}get layout(){return(0,d.A)(_e,this)}set layout(e){(0,r.A)(_e,this,e)}get nodes(){return(0,d.A)(je,this)}set nodes(e){(0,r.A)(je,this,e)}get edges(){return(0,d.A)(Fe,this)}set edges(e){(0,r.A)(Fe,this,e)}get nodeBricks(){return(0,d.A)(Ze,this)}set nodeBricks(e){(0,r.A)(Ze,this,e)}get lines(){return(0,d.A)(qe,this)}set lines(e){(0,r.A)(qe,this,e)}get layoutOptions(){return(0,d.A)(Ge,this)}set layoutOptions(e){(0,r.A)(Ge,this,e)}get activeTarget(){return(0,d.A)(Je,this)}set activeTarget(e){(0,r.A)(Je,this,e)}get disableKeyboardAction(){return(0,d.A)(Qe,this)}set disableKeyboardAction(e){(0,r.A)(Qe,this,e)}get connectNodes(){return(0,d.A)(et,this)}set connectNodes(e){(0,r.A)(et,this,e)}get dragNodes(){return(0,d.A)(tt,this)}set dragNodes(e){(0,r.A)(tt,this,e)}get zoomable(){return(0,d.A)(at,this)}set zoomable(e){(0,r.A)(at,this,e)}get scrollable(){return(0,d.A)(nt,this)}set scrollable(e){(0,r.A)(nt,this,e)}get pannable(){return(0,d.A)(st,this)}set pannable(e){(0,r.A)(st,this,e)}get scaleRange(){return(0,d.A)(lt,this)}set scaleRange(e){(0,r.A)(lt,this,e)}callOnLineLabel(e,t){for(var a,n=arguments.length,s=new Array(n>2?n-2:0),l=2;l<n;l++)s[l-2]=arguments[l];null===(a=(0,d.A)(bt,this).current)||void 0===a||a.callOnLineLabel(e,t,...s)}render(){return u().createElement(Ye,{ref:(0,d.A)(bt,this),layout:this.layout,nodes:this.nodes,edges:this.edges,nodeBricks:this.nodeBricks,lines:this.lines,layoutOptions:this.layoutOptions,connectNodes:this.connectNodes,dragNodes:this.dragNodes,activeTarget:this.activeTarget,disableKeyboardAction:this.disableKeyboardAction,zoomable:this.zoomable,scrollable:this.scrollable,pannable:this.pannable,scaleRange:this.scaleRange,onActiveTargetChange:(0,d.A)(rt,this),onSwitchActiveTarget:(0,d.A)(ft,this),onNodeDelete:(0,d.A)(ht,this),onEdgeDelete:(0,d.A)(ut,this),onLineClick:(0,d.A)(pt,this),onLineDoubleClick:(0,d.A)(mt,this),onNodesConnect:(0,d.A)(yt,this)})}}function wt(e,t){let{layout:a,nodes:n,edges:s,nodeBricks:l,lines:i,layoutOptions:o,connectNodes:r,dragNodes:d,activeTarget:h,disableKeyboardAction:g,zoomable:p,scrollable:v,pannable:$,scaleRange:K,onActiveTargetChange:I,onSwitchActiveTarget:U,onNodeDelete:V,onEdgeDelete:Y,onLineClick:X,onLineDoubleClick:_,onNodesConnect:j}=e;const[F,Z]=(0,c.useState)(!1),[q,G]=(0,c.useState)(0),[J,Q]=(0,c.useState)(null),[ee,te]=(0,c.useState)(!1),[ae,ne]=(0,c.useState)(0),[se,le]=(0,c.useState)(null),[ie,oe]=(0,c.useState)([]),[re,de]=(0,c.useState)(!1),[he,ce]=(0,c.useState)({k:1,x:0,y:0}),ue=(0,c.useRef)(new Map),ge=(0,c.useRef)(null),pe=(0,c.useRef)(null),[Ae,me]=(0,c.useState)(!1),{userViewReady:ve,userViewNodesMap:ye,saveUserView:fe}=(0,H._)(null==d?void 0:d.save),[be,ke]=(0,c.useState)([0,0]),[we,Ce]=(0,c.useState)(null),[Ee,Me]=(0,c.useState)("initial"),[xe,We]=(0,c.useState)(null);(0,c.useImperativeHandle)(t,(()=>({callOnLineLabel(e,t){for(var a,n=arguments.length,s=new Array(n>2?n-2:0),l=2;l<n;l++)s[l-2]=arguments[l];null==se||null===(a=se.get(e))||void 0===a||null===(a=a.firstElementChild)||void 0===a||a[t](...s)}}))),(0,c.useEffect)((()=>{const e=e=>{(0,L.P)(e,{nodes:n,nodesRefRepository:J,connectNodes:r,dragNodes:d,scale:he.k,setConnectLineState:Ce,setConnectLineTo:ke,setManualLayoutStatus:Me,setNodeMovement:We,onSwitchActiveTarget:U,onNodesConnect:j})},t=pe.current;return null==t||t.addEventListener("mousedown",e),()=>{null==t||t.removeEventListener("mousedown",e)}}),[n,r,d,he.k,J,j,U]);const{normalizedLines:Ne,normalizedLinesMap:Se,markers:Te}=(0,c.useMemo)((()=>(0,M.t)(s,i)),[s,i]),Re=(0,c.useMemo)((()=>Ne.flatMap((e=>{let t,a,{line:{text:n,label:s,$id:l},edge:i}=e;return n||s?(s?(t="label",a=[].concat(s)):(t="text",a=[].concat(n)),a.map((e=>({[t]:e,id:`${l}-${e.placement??"center"}`,edge:i})))):[]}))),[Ne]),{nodes:Le,edges:ze}=(0,B.o)({layout:a,nodes:n,edges:s,manualLayoutStatus:Ee,userViewReady:ve,userViewNodesMap:ye,nodeMovement:xe,nodesRefRepository:J,lineLabelsRefRepository:se,normalizedLinesMap:Se,layoutOptions:o,nodesRenderId:q,lineLabelsRenderId:ae});(0,c.useEffect)((()=>{"finished"===Ee&&fe(Le.map((e=>({id:e.id,x:e.x,y:e.y}))))}),[Ee]);const Be=(0,c.useMemo)((()=>(0,E.R)(ze,Le,Ne)),[Ne,Le,ze]),De=h??null,[$e,He]=(0,c.useState)(De);(0,c.useEffect)((()=>{He((e=>(0,P.c)(e,De)?e:De))}),[De]);const Pe=(0,c.useRef)(!1);(0,c.useEffect)((()=>{Pe.current?null==I||I($e):Pe.current=!0}),[$e,I]),(0,c.useEffect)((()=>{const e=ge.current;if(!e||g)return;const t=e=>{const t=(0,w.a)(e,{renderedNodes:Le,activeTarget:$e});"delete-node"===(null==t?void 0:t.action)?null==V||V(t.node):"delete-edge"===(null==t?void 0:t.action)?null==Y||Y(t.edge):"switch-active-node"===(null==t?void 0:t.action)&&t.node&&(null==U||U({type:"node",nodeId:t.node.id}))};return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}),[$e,Le,g,U,V,Y]);const Oe=(0,c.useCallback)((e=>{e&&(G((e=>e+1)),Q(e)),Z((t=>t||!!e))}),[]),Ke=(0,c.useCallback)((e=>{e&&(ne((e=>e+1)),le(e)),te((t=>t||!!e))}),[]),Ie=(0,c.useMemo)((()=>K??[z.sS,z.Yt]),[K]),Ue=(0,c.useMemo)((()=>(0,m.s_)()),[]);(0,c.useEffect)((()=>{let e=!1;Ue.scaleExtent(p?Ie:[1,1]).on("start",(()=>{e=!1,de(!0)})).on("zoom",(t=>{e=!0,ce(t.transform)})).on("end",(()=>{de(!1),e||null==U||U(null)}))}),[U,Ie,p,Ue]),(0,c.useEffect)((()=>{const e=ge.current;if(!e)return;const t=(0,A.A)(e),a=()=>{t.on(".zoom",null).on(".zoom.custom",null).on("wheel",null)};if(p||v||$)return(p||v)&&t.on("wheel.zoom.custom",(e=>{e.ctrlKey||(e.stopImmediatePropagation(),v&&(e.preventDefault(),Ue.translateBy(t,e.wheelDeltaX/5,e.wheelDeltaY/5)))})),t.call(Ue).on("wheel",(e=>e.preventDefault())).on("dblclick.zoom",null),$||t.on("mousedown.zoom",null).on("touchstart.zoom",null).on("touchmove.zoom",null).on("touchend.zoom",null),a;a()}),[$,v,p,Ue]),(0,c.useEffect)((()=>{const e=ge.current;if(0===Le.length||!e||Ae)return;const{k:t,x:a,y:n}=(0,C.r)(Le,{canvasWidth:e.clientWidth,canvasHeight:e.clientHeight,scaleRange:p?Ie:void 0});Ue.transform((0,A.A)(e),new m.uV(t,a,n)),me(!0)}),[Ae,Le,Ie,p,Ue]);const Ve=(0,c.useMemo)((()=>`${(0,f.uniqueId)("diagram-")}-`),[]),Ye=`${Ve}line-arrow-`,Xe=`${Ve}mask-`,_e=`${Ve}active-line-`;(0,c.useEffect)((()=>{oe((e=>(0,R.z)(e,Be,ue.current)))}),[Be]);const[je,Fe]=u().useState(new Map);return(0,c.useEffect)((()=>{if(!se)return;(0,D.F)(ie,se);const e=new b.A((()=>{Fe((0,O.G)(ie,se))}));for(const t of se.values())e.observe(t);return()=>{e.disconnect()}}),[ae,se,ie]),"dagre"!==a&&"force"!==a?u().createElement("div",null,`Diagram layout not supported: "${a}"`):u().createElement("div",{className:y()("diagram",{ready:F&&Ae,grabbing:re,pannable:$}),tabIndex:-1,ref:ge},u().createElement("svg",{width:"100%",height:"100%",className:"lines"},u().createElement("defs",null,Te.map(((e,t)=>{let{type:a,strokeColor:n}=e;return u().createElement(N.c,{key:t,id:`${Ye}${t}`,type:a,strokeColor:n})})),[...je].map((e=>{let[t,a]=e;return u().createElement(S.y,{key:t,lineId:t,rects:a,maskPrefix:Xe,renderedLineLabels:ie})})),u().createElement("marker",{id:`${_e}start`,viewBox:"0 0 8 8",refX:4,refY:4,markerWidth:8,markerHeight:8,orient:"auto"},u().createElement("path",{d:"M 0.5 0.5 H 7.5 V 7.5 H 0.5 Z",stroke:"var(--palette-gray-7)",strokeWidth:1,fill:"var(--palette-gray-1)"})),u().createElement("marker",{id:`${_e}end`,viewBox:"0 0 14 8",refX:3,refY:4,markerWidth:14,markerHeight:8,orient:"auto"},u().createElement("path",{d:"M 0.5 1.5 L 5.5 4 L 0.5 6.5 z",stroke:"var(--palette-blue-3)",strokeWidth:1,fill:"var(--palette-blue-3)"}),u().createElement("path",{d:"M 6.5 0.5 H 13.5 V 7.5 H 6.5 Z",stroke:"var(--palette-gray-7)",strokeWidth:1,fill:"var(--palette-gray-1)"}))),u().createElement("g",{transform:`translate(${he.x} ${he.y}) scale(${he.k})`},Be.map((e=>u().createElement(W.m,{key:e.line.$id,line:e,linePaths:ue.current,lineMaskRects:je,maskPrefix:Xe,markerPrefix:Ye,activeLineMarkerPrefix:_e,active:"edge"===(null==$e?void 0:$e.type)&&$e.edge.source===e.edge.source&&$e.edge.target===e.edge.target,activeRelated:"node"===(null==$e?void 0:$e.type)&&(e.edge.source===$e.nodeId||e.edge.target===$e.nodeId),onLineClick:X,onLineDoubleClick:_}))))),u().createElement("div",{className:y()("line-labels",{ready:ee}),style:{left:he.x,top:he.y,transform:`scale(${he.k})`}},u().createElement(x.d2,{labels:Re,onRendered:Ke})),u().createElement("div",{className:"nodes",ref:pe,style:{left:he.x,top:he.y,transform:`scale(${he.k})`}},u().createElement(k.p,{nodes:n,nodeBricks:l,onRendered:Oe})),u().createElement(T.w,{connectLineState:we,connectLineTo:be,markerPrefix:Ye}))}n=kt,({e:[U,V,Y,X,_,j,F,Z,q,G,J,Q,ee,te,ae,ne,se,le,ie,oe,re,de,he,ce,ue,ge,pe,Ae,me,ve,ye,fe,be,ke,we,Ce,Ee,Me,xe,We,Ne,Se,Te,Re,Le,ze,Be,De,$e,He,Pe,Oe,K],c:[Xe,I]}=(0,h.A)(n,[Ke("eo-diagram",{styleTexts:[$.A]})],[[Ie({type:String}),1,"layout"],[Ie({attribute:!1}),1,"nodes"],[Ie({attribute:!1}),1,"edges"],[Ie({attribute:!1}),1,"nodeBricks"],[Ie({attribute:!1}),1,"lines"],[Ie({attribute:!1}),1,"layoutOptions"],[Ie({attribute:!1}),1,"activeTarget"],[Ie({type:Boolean}),1,"disableKeyboardAction"],[Ie({attribute:!1}),1,"connectNodes"],[Ie({attribute:!1}),1,"dragNodes"],[Ie({type:Boolean}),1,"zoomable"],[Ie({type:Boolean}),1,"scrollable"],[Ie({type:Boolean}),1,"pannable"],[Ie({attribute:!1}),1,"scaleRange"],[Ue({type:"activeTarget.change"}),1,"activeTargetChangeEvent",e=>(0,d.A)(it,e),(e,t)=>(0,r.A)(it,e,t)],[Ue({type:"node.delete"}),1,"nodeDelete",e=>(0,d.A)(dt,e),(e,t)=>(0,r.A)(dt,e,t)],[Ue({type:"edge.delete"}),1,"edgeDelete",e=>(0,d.A)(ct,e),(e,t)=>(0,r.A)(ct,e,t)],[Ue({type:"line.click"}),1,"lineClick",e=>(0,d.A)(gt,e),(e,t)=>(0,r.A)(gt,e,t)],[Ue({type:"line.dblclick"}),1,"lineDoubleClick",e=>(0,d.A)(At,e),(e,t)=>(0,r.A)(At,e,t)],[Ue({type:"nodes.connect"}),1,"connectNodes",e=>(0,d.A)(vt,e),(e,t)=>(0,r.A)(vt,e,t)],[Ve(),2,"callOnLineLabel"]],0,(e=>bt.has((0,i.A)(e))),p.ReactNextElement)),I();var Ct,Et=a(3971);let Mt,xt,Wt,Nt,St,Tt,Rt,Lt,zt,Bt,Dt,$t,Ht,Pt;const{defineElement:Ot,property:Kt,event:It,method:Ut}=(0,g.createDecorators)(),Vt=(0,c.forwardRef)(ea);let Yt;var Xt=new WeakMap,_t=new WeakMap,jt=new WeakMap,Ft=new WeakSet,Zt=new WeakMap,qt=new WeakMap,Gt=new WeakMap,Jt=new WeakMap;class Qt extends p.ReactNextElement{constructor(){super(...arguments),(0,s.A)(this,Ft),(0,l.A)(this,Xt,(Mt(this),Wt(this))),(0,l.A)(this,_t,(Nt(this),St(this))),(0,l.A)(this,jt,(Tt(this),Rt(this))),(0,l.A)(this,Zt,(Bt(this),e=>{(0,o.A)(Ft,this,Lt).emit(e)})),(0,l.A)(this,qt,Dt(this)),(0,l.A)(this,Gt,(Pt(this),e=>{(0,o.A)(Ft,this,$t).emit(e)})),(0,l.A)(this,Jt,(0,c.createRef)())}get label(){return(0,d.A)(Xt,this)}set label(e){(0,r.A)(Xt,this,e)}get type(){return(0,d.A)(_t,this)}set type(e){(0,r.A)(_t,this,e)}enableEditing(){var e;null===(e=(0,d.A)(Jt,this).current)||void 0===e||e.enableEditing()}render(){return u().createElement(Vt,{ref:(0,d.A)(Jt,this),label:this.label,onLabelEditingChange:(0,d.A)(Zt,this),onLabelChange:(0,d.A)(Gt,this)})}}function ea(e,t){let{label:a,onLabelChange:n,onLabelEditingChange:s}=e;const l=a??"",[i,o]=(0,c.useState)(l),[r,d]=(0,c.useState)(!1),h=(0,c.useRef)(!1),[g,p]=(0,c.useState)(!1),A=(0,c.useRef)(null);(0,c.useImperativeHandle)(t,(()=>({enableEditing(){d(!0)}}))),(0,c.useEffect)((()=>{o(l)}),[l]);const m=(0,c.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),d(!0)}),[]);(0,c.useEffect)((()=>{var e,t;r&&(null===(e=A.current)||void 0===e||e.focus({preventScroll:!0}),null===(t=A.current)||void 0===t||t.select())}),[r]),(0,c.useEffect)((()=>{h.current?null==s||s(r):h.current=!0}),[r,s]);const v=(0,c.useCallback)((e=>{o(e.target.value)}),[]),f=(0,c.useCallback)((e=>{const t=e.key||e.keyCode||e.which;var a;"Enter"!==t&&13!==t||null===(a=A.current)||void 0===a||a.blur()}),[]),b=(0,c.useCallback)((()=>{d(!1),p(!0)}),[]);(0,c.useEffect)((()=>{g&&(null==n||n(i),p(!1))}),[i,n,g]);const k=(0,c.useCallback)((e=>{e.stopPropagation()}),[]);return u().createElement("div",{className:y()("label",{editing:r,empty:!i}),onDoubleClick:k,onMouseDown:k},u().createElement("input",{className:"label-input",value:i,ref:A,onChange:v,onKeyDown:f,onBlur:b}),u().createElement("div",{className:"label-text",onDoubleClick:m},i))}Ct=Qt,({e:[Wt,Nt,St,Tt,Rt,Lt,zt,Bt,Dt,$t,Ht,Pt,Mt],c:[Yt,xt]}=(0,h.A)(Ct,[Ot("diagram.editable-label",{styleTexts:[Et.A]})],[[Kt(),1,"label"],[Kt({render:!1}),1,"type"],[It({type:"label.editing.change"}),1,"labelEditingChange",e=>(0,d.A)(jt,e),(e,t)=>(0,r.A)(jt,e,t)],[It({type:"label.change"}),1,"labelChange",e=>(0,d.A)(qt,e),(e,t)=>(0,r.A)(qt,e,t)],[Ut(),2,"enableEditing"]],0,(e=>Jt.has((0,i.A)(e))),p.ReactNextElement)),xt(),a(9068);var ta,aa=a(497);let na,sa,la,ia,oa,ra,da,ha,ca,ua,ga,pa,Aa,ma,va,ya,fa,ba,ka;const{defineElement:wa,property:Ca,event:Ea}=(0,g.createDecorators)();let Ma;var xa=new WeakMap,Wa=new WeakMap,Na=new WeakMap,Sa=new WeakMap,Ta=new WeakSet,Ra=new WeakMap,La=new WeakMap,za=new WeakMap,Ba=new WeakMap,Da=new WeakMap;class $a extends p.ReactNextElement{constructor(){super(...arguments),(0,s.A)(this,Ta),(0,l.A)(this,xa,sa(this)),(0,l.A)(this,Wa,(la(this),ia(this))),(0,l.A)(this,Na,(oa(this),ra(this))),(0,l.A)(this,Sa,(da(this),ha(this))),(0,l.A)(this,Ra,(ga(this),e=>{(0,o.A)(Ta,this,ca).emit(e)})),(0,l.A)(this,La,pa(this)),(0,l.A)(this,za,(va(this),e=>{(0,o.A)(Ta,this,Aa).emit(e)})),(0,l.A)(this,Ba,ya(this)),(0,l.A)(this,Da,(ka(this),e=>{(0,o.A)(Ta,this,fa).emit(e)}))}get usage(){return(0,d.A)(xa,this)}set usage(e){(0,r.A)(xa,this,e)}get status(){return(0,d.A)(Wa,this)}set status(e){(0,r.A)(Wa,this,e)}get decorator(){return(0,d.A)(Na,this)}set decorator(e){(0,r.A)(Na,this,e)}render(){return u().createElement(Ha,{usage:this.usage,onDragStart:(0,d.A)(Ra,this),onDragMove:(0,d.A)(za,this),onDragEnd:(0,d.A)(Da,this)})}}function Ha(e){let{usage:t,onDragStart:a,onDragMove:n,onDragEnd:s}=e;const l=(0,c.useCallback)((e=>{if("library"!==t)return;e.stopPropagation(),e.preventDefault();const l=[e.clientX,e.clientY];let i=!1;const o=e=>{i||(i=(e.clientX-l[0])**2+(e.clientY-l[1])**2>=9,i&&(null==a||a([e.clientX,e.clientY]))),i&&(null==n||n([e.clientX,e.clientY]))},r=e=>{document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",r),i&&(null==s||s([e.clientX,e.clientY]))};document.addEventListener("mousemove",o),document.addEventListener("mouseup",r)}),[s,n,a,t]);return u().createElement("div",{onMouseDown:l},u().createElement("slot",null))}ta=$a,({e:[sa,la,ia,oa,ra,da,ha,ca,ua,ga,pa,Aa,ma,va,ya,fa,ba,ka],c:[Ma,na]}=(0,h.A)(ta,[wa("diagram.experimental-node",{styleTexts:[aa.A]})],[[Ca(),1,"usage"],[Ca({type:String,render:!1}),1,"status"],[Ca({type:String}),1,"decorator"],[Ea({type:"drag.start"}),1,"dragStartEvent",e=>(0,d.A)(Sa,e),(e,t)=>(0,r.A)(Sa,e,t)],[Ea({type:"drag.move"}),1,"dragMoveEvent",e=>(0,d.A)(La,e),(e,t)=>(0,r.A)(La,e,t)],[Ea({type:"drag.end"}),1,"dragEndEvent",e=>(0,d.A)(Ba,e),(e,t)=>(0,r.A)(Ba,e,t)]],0,(e=>Da.has((0,i.A)(e))),p.ReactNextElement)),na();var Pa,Oa=a(8185),Ka=a(4932),Ia=a(3783),Ua=a(3033),Va=a(8091),Ya=a(1819),Xa=a(5748),_a=a(227),ja=a(531),Fa=a(7099),Za=a(1484),qa=a(8197),Ga=a(7531),Ja=a(2098),Qa=a(3012),en=a(6237);let tn,an,nn,sn,ln,on,rn,dn,hn,cn,un,gn,pn,An,mn,vn,yn,fn,bn,kn,wn,Cn,En,Mn,xn,Wn,Nn,Sn,Tn,Rn,Ln,zn,Bn,Dn,$n,Hn,Pn,On,Kn,In,Un;const{defineElement:Vn,property:Yn,event:Xn}=(0,g.createDecorators)();let _n;var jn=new WeakMap,Fn=new WeakMap,Zn=new WeakMap,qn=new WeakMap,Gn=new WeakMap,Jn=new WeakMap,Qn=new WeakMap,es=new WeakMap,ts=new WeakMap,as=new WeakMap,ns=new WeakMap,ss=new WeakMap,ls=new WeakMap,is=new WeakMap,os=new WeakMap,rs=new WeakSet,ds=new WeakMap,hs=new WeakMap,cs=new WeakMap,us=new WeakMap,gs=new WeakMap,ps=new WeakMap;class As extends p.ReactNextElement{constructor(){super(...arguments),(0,s.A)(this,rs),(0,l.A)(this,jn,an(this)),(0,l.A)(this,Fn,(nn(this),sn(this))),(0,l.A)(this,Zn,(ln(this),on(this))),(0,l.A)(this,qn,(rn(this),dn(this,[Ua.HP,Ua.HP]))),(0,l.A)(this,Gn,(hn(this),cn(this))),(0,l.A)(this,Jn,(un(this),gn(this))),(0,l.A)(this,Qn,(pn(this),An(this))),(0,l.A)(this,es,(mn(this),vn(this))),(0,l.A)(this,ts,(yn(this),fn(this))),(0,l.A)(this,as,(bn(this),kn(this))),(0,l.A)(this,ns,(wn(this),Cn(this,!0))),(0,l.A)(this,ss,(En(this),Mn(this,!0))),(0,l.A)(this,ls,(xn(this),Wn(this,!0))),(0,l.A)(this,is,(Nn(this),Sn(this))),(0,l.A)(this,os,(Tn(this),Rn(this))),(0,l.A)(this,ds,(Bn(this),e=>{(0,o.A)(rs,this,Ln).emit(e)})),(0,l.A)(this,hs,(e=>{(0,Oa.c)(e,this.activeTarget)||(this.activeTarget=e)})),(0,l.A)(this,cs,Dn(this)),(0,l.A)(this,us,(Pn(this),e=>{(0,o.A)(rs,this,$n).emit(e)})),(0,l.A)(this,gs,On(this)),(0,l.A)(this,ps,(Un(this),e=>{(0,o.A)(rs,this,Kn).emit(e)}))}get cells(){return(0,d.A)(jn,this)}set cells(e){(0,r.A)(jn,this,e)}get layout(){return(0,d.A)(Fn,this)}set layout(e){(0,r.A)(Fn,this,e)}get layoutOptions(){return(0,d.A)(Zn,this)}set layoutOptions(e){(0,r.A)(Zn,this,e)}get defaultNodeSize(){return(0,d.A)(qn,this)}set defaultNodeSize(e){(0,r.A)(qn,this,e)}get defaultNodeBricks(){return(0,d.A)(Gn,this)}set defaultNodeBricks(e){(0,r.A)(Gn,this,e)}get degradedThreshold(){return(0,d.A)(Jn,this)}set degradedThreshold(e){(0,r.A)(Jn,this,e)}get degradedNodeLabel(){return(0,d.A)(Qn,this)}set degradedNodeLabel(e){(0,r.A)(Qn,this,e)}get defaultEdgeLines(){return(0,d.A)(es,this)}set defaultEdgeLines(e){(0,r.A)(es,this,e)}get activeTarget(){return(0,d.A)(ts,this)}set activeTarget(e){(0,r.A)(ts,this,e)}get fadeUnrelatedCells(){return(0,d.A)(as,this)}set fadeUnrelatedCells(e){(0,r.A)(as,this,e)}get zoomable(){return(0,d.A)(ns,this)}set zoomable(e){(0,r.A)(ns,this,e)}get scrollable(){return(0,d.A)(ss,this)}set scrollable(e){(0,r.A)(ss,this,e)}get pannable(){return(0,d.A)(ls,this)}set pannable(e){(0,r.A)(ls,this,e)}get scaleRange(){return(0,d.A)(is,this)}set scaleRange(e){(0,r.A)(is,this,e)}render(){return u().createElement(ms,{shadowRoot:this.shadowRoot,cells:this.cells,layout:this.layout,layoutOptions:this.layoutOptions,defaultNodeSize:this.defaultNodeSize,defaultNodeBricks:this.defaultNodeBricks,defaultEdgeLines:this.defaultEdgeLines,degradedThreshold:this.degradedThreshold,degradedNodeLabel:this.degradedNodeLabel,activeTarget:this.activeTarget,fadeUnrelatedCells:this.fadeUnrelatedCells,zoomable:this.zoomable,scrollable:this.scrollable,pannable:this.pannable,scaleRange:this.scaleRange,onActiveTargetChange:(0,d.A)(ds,this),onSwitchActiveTarget:(0,d.A)(hs,this),onCellContextMenu:(0,d.A)(us,this),onCellClick:(0,d.A)(ps,this)})}}function ms(e){let{shadowRoot:t,cells:a,layout:n,layoutOptions:s,defaultNodeSize:l,defaultNodeBricks:i,defaultEdgeLines:o,degradedThreshold:r,degradedNodeLabel:d,activeTarget:h,fadeUnrelatedCells:g,zoomable:p,scrollable:m,pannable:v,scaleRange:b,onActiveTargetChange:k,onSwitchActiveTarget:w,onCellContextMenu:C,onCellClick:E}=e;const[{cells:M,layoutKey:x},W]=(0,c.useReducer)(Xa.d,a,(e=>({cells:(0,Ia.C)(e,{defaultNodeSize:l}),layoutKey:1}))),S=(0,c.useMemo)((()=>M.filter(ja.N).length>=(r??Ua.pC)),[M,r]),T=(0,c.useRef)(null),{grabbing:R,transform:L,zoomer:z,scaleRange:B}=(0,Va.f)({rootRef:T,zoomable:p,scrollable:m,pannable:v,draggable:!0,scaleRange:b,onSwitchActiveTarget:w}),{centered:D,setCentered:$,getNextLayoutKey:H}=(0,Za.g)({layout:n,layoutOptions:s,rootRef:T,cells:M,zoomable:p,zoomer:z,scaleRange:B,layoutKey:x,dispatch:W}),P=(0,c.useCallback)((()=>{$(!1)}),[$]),O=(0,c.useRef)(a);(0,c.useEffect)((()=>{if(a!==O.current){O.current=a;const e=(0,Ja.L)({canvasWidth:t.host.clientWidth,canvasHeight:t.host.clientHeight,defaultNodeSize:l,layout:n,previousCells:M,cells:a,scaleRange:B,transform:L});W({type:"update-cells",payload:e.cells})}}),[M,l,a,n,B,t,L]);const K=(0,Ya.J)({rootRef:T,activeTarget:h,onActiveTargetChange:k}),I=`${(0,c.useMemo)((()=>`${(0,f.uniqueId)("diagram-")}-`),[])}line-arrow-`,U=(0,c.useCallback)(((e,t)=>{W({type:"update-node-size",payload:{id:e,size:t},layoutKey:H()})}),[H]),[V,Y]=(0,c.useState)(null),X=(0,c.useCallback)((e=>{Y(e)}),[]),_=(0,c.useCallback)((e=>{Y((t=>t===e?null:t))}),[]),[j,F]=(0,c.useState)([]);(0,c.useEffect)((()=>{const e=g?(0,_a.Y)(M,null,V):[];F((t=>0===t.length&&0===e.length?t:e))}),[M,g,V]);const Z=(0,c.useCallback)((e=>{z.scaleTo((0,A.A)(T.current),e/100)}),[z]),{lineConfMap:q,markers:G}=(0,Ga.d)({cells:M,defaultEdgeLines:o,markerPrefix:I}),J=(0,qa.H)({cells:M,layout:n,centered:D});return u().createElement(u().Fragment,null,u().createElement("svg",{width:"100%",height:"100%",ref:T,className:y()("root",{grabbing:R,pannable:v,ready:J}),tabIndex:-1},u().createElement("defs",null,G.map(((e,t)=>u().createElement(N.c,{key:t,id:`${I}${t}`,type:e.markerType,strokeColor:e.strokeColor})))),u().createElement("g",{transform:`translate(${L.x} ${L.y}) scale(${L.k})`},u().createElement("g",{className:"cells"},M.map((e=>u().createElement(Ka.m,{key:`${e.type}:${(0,ja.WW)(e)?`${e.source}~${e.target}`:e.id}`,layout:n,cell:e,cells:M,degraded:S,degradedNodeLabel:d,defaultNodeBricks:i,lineConfMap:q,transform:L,activeTarget:K,readOnly:!0,unrelatedCells:j,onSwitchActiveTarget:w,onCellContextMenu:C,onCellClick:E,onNodeBrickResize:U,onCellMouseEnter:g&&(0,ja.N)(e)?X:void 0,onCellMouseLeave:g&&(0,ja.N)(e)?_:void 0})))))),u().createElement(Fa.Y,{shadowRoot:t,scale:L.k,scaleRange:B,onZoomChange:Z,onReCenter:P}))}Pa=As,({e:[an,nn,sn,ln,on,rn,dn,hn,cn,un,gn,pn,An,mn,vn,yn,fn,bn,kn,wn,Cn,En,Mn,xn,Wn,Nn,Sn,Tn,Rn,Ln,zn,Bn,Dn,$n,Hn,Pn,On,Kn,In,Un],c:[_n,tn]}=(0,h.A)(Pa,[Vn("eo-display-canvas",{styleTexts:[Qa.A,en.A]})],[[Yn({attribute:!1}),1,"cells"],[Yn({type:String}),1,"layout"],[Yn({attribute:!1}),1,"layoutOptions"],[Yn({attribute:!1}),1,"defaultNodeSize"],[Yn({attribute:!1}),1,"defaultNodeBricks"],[Yn({type:Number}),1,"degradedThreshold"],[Yn({attribute:!1}),1,"degradedNodeLabel"],[Yn({attribute:!1}),1,"defaultEdgeLines"],[Yn({attribute:!1}),1,"activeTarget"],[Yn({type:Boolean}),1,"fadeUnrelatedCells"],[Yn({type:Boolean}),1,"zoomable"],[Yn({type:Boolean}),1,"scrollable"],[Yn({type:Boolean}),1,"pannable"],[Yn({attribute:!1}),1,"scaleRange"],[Xn({type:"activeTarget.change"}),1,"activeTargetChangeEvent",e=>(0,d.A)(os,e),(e,t)=>(0,r.A)(os,e,t)],[Xn({type:"cell.contextmenu"}),1,"cellContextMenu",e=>(0,d.A)(cs,e),(e,t)=>(0,r.A)(cs,e,t)],[Xn({type:"cell.click"}),1,"cellClick",e=>(0,d.A)(gs,e),(e,t)=>(0,r.A)(gs,e,t)]],0,(e=>ps.has((0,i.A)(e))),p.ReactNextElement)),tn()},9068:(e,t,a)=>{a.d(t,{uuidV4:()=>Ia});var n,s=a(4635),l=a(918),i=a(6902),o=a(2559),r=a(5536),d=a(6121),h=a(829),c=a(2740),u=a(8769),g=a.n(u),p=a(300),A=a(4295),m=a(7057),v=(a(6477),a(1030)),y=a(3373),f=a.n(y),b=a(7566),k=a(5748),w=a(3739),C=a(531),E=a(8185),M=a(5114),x=a(4932),W=a(3639),N=a(3783),S=a(2098),T=a(227),R=a(3033),L=a(8091),z=a(1819),B=a(7099),D=a(1484),$=a(8197),H=a(7531),P=a(8875),O=a(2722),K=a(9978),I=a(2219),U=a(3012),V=a(6237),Y=a(1103),X=a(9386),_=a(1991),j=a(2202),F=a(1825);let Z,q,G,J,Q,ee,te,ae,ne,se,le,ie,oe,re,de,he,ce,ue,ge,pe,Ae,me,ve,ye,fe,be,ke,we,Ce,Ee,Me,xe,We,Ne,Se,Te,Re,Le,ze,Be,De,$e,He,Pe,Oe,Ke,Ie,Ue,Ve,Ye,Xe,_e,je,Fe,Ze,qe,Ge,Je,Qe,et,tt,at,nt,st,lt,it,ot,rt,dt,ht,ct,ut,gt,pt,At,mt,vt,yt,ft,bt,kt,wt,Ct,Et,Mt,xt,Wt,Nt,St,Tt,Rt,Lt,zt,Bt,Dt,$t;const Ht=(0,m.unwrapProvider)("basic.lock-body-scroll"),{defineElement:Pt,property:Ot,method:Kt,event:It}=(0,p.createDecorators)(),Ut=g().forwardRef(Ka);let Vt;var Yt=new WeakMap,Xt=new WeakMap,_t=new WeakMap,jt=new WeakMap,Ft=new WeakMap,Zt=new WeakMap,qt=new WeakMap,Gt=new WeakMap,Jt=new WeakMap,Qt=new WeakMap,ea=new WeakMap,ta=new WeakMap,aa=new WeakMap,na=new WeakMap,sa=new WeakMap,la=new WeakMap,ia=new WeakMap,oa=new WeakMap,ra=new WeakMap,da=new WeakMap,ha=new WeakSet,ca=new WeakMap,ua=new WeakMap,ga=new WeakMap,pa=new WeakMap,Aa=new WeakMap,ma=new WeakMap,va=new WeakMap,ya=new WeakMap,fa=new WeakMap,ba=new WeakMap,ka=new WeakMap,wa=new WeakMap,Ca=new WeakMap,Ea=new WeakMap,Ma=new WeakMap,xa=new WeakMap,Wa=new WeakMap,Na=new WeakMap,Sa=new WeakMap,Ta=new WeakMap,Ra=new WeakMap,La=new WeakMap,za=new WeakMap,Ba=new WeakMap,Da=new WeakMap,$a=new WeakMap,Ha=new WeakMap;class Pa extends A.ReactNextElement{constructor(){super(...arguments),(0,s.A)(this,ha),(0,l.A)(this,Yt,(Z(this),G(this))),(0,l.A)(this,Xt,(J(this),Q(this))),(0,l.A)(this,_t,(ee(this),te(this))),(0,l.A)(this,jt,(ae(this),ne(this,[R.HP,R.HP]))),(0,l.A)(this,Ft,(se(this),le(this))),(0,l.A)(this,Zt,(ie(this),oe(this))),(0,l.A)(this,qt,(re(this),de(this))),(0,l.A)(this,Gt,(he(this),ce(this))),(0,l.A)(this,Jt,(ue(this),ge(this))),(0,l.A)(this,Qt,(pe(this),Ae(this))),(0,l.A)(this,ea,(me(this),ve(this,!0))),(0,l.A)(this,ta,(ye(this),fe(this,!0))),(0,l.A)(this,aa,(be(this),ke(this,!0))),(0,l.A)(this,na,(we(this),Ce(this,!1))),(0,l.A)(this,sa,(Ee(this),Me(this))),(0,l.A)(this,la,(xe(this),We(this))),(0,l.A)(this,ia,(Ne(this),Se(this))),(0,l.A)(this,oa,(Te(this),Re(this))),(0,l.A)(this,ra,(Le(this),ze(this))),(0,l.A)(this,da,(Be(this),De(this))),(0,l.A)(this,ca,(Pe(this),e=>{(0,r.A)(ha,this,$e).emit(e)})),(0,l.A)(this,ua,(e=>{(0,E.c)(e,this.activeTarget)||(this.activeTarget=e)})),(0,l.A)(this,ga,Oe(this)),(0,l.A)(this,pa,(Ue(this),Ve(this))),(0,l.A)(this,Aa,(_e(this),e=>{(0,r.A)(ha,this,Ye).emit(e),"node"===e.type&&(0,r.A)(ha,this,Ke).emit(e)})),(0,l.A)(this,ma,je(this)),(0,l.A)(this,va,(qe(this),e=>{(0,r.A)(ha,this,Fe).emit(e)})),(0,l.A)(this,ya,Ge(this)),(0,l.A)(this,fa,(et(this),e=>{(0,r.A)(ha,this,Je).emit(e)})),(0,l.A)(this,ba,tt(this)),(0,l.A)(this,ka,(st(this),lt(this))),(0,l.A)(this,wa,(rt(this),e=>{(0,r.A)(ha,this,it).emit(e),"node"===e.type&&(0,r.A)(ha,this,at).emit(e)})),(0,l.A)(this,Ca,dt(this)),(0,l.A)(this,Ea,(ut(this),e=>{(0,r.A)(ha,this,ht).emit(e)})),(0,l.A)(this,Ma,gt(this)),(0,l.A)(this,xa,(mt(this),e=>{(0,r.A)(ha,this,pt).emit(e)})),(0,l.A)(this,Wa,vt(this)),(0,l.A)(this,Na,(bt(this),e=>{(0,r.A)(ha,this,yt).emit(e)})),(0,l.A)(this,Sa,kt(this)),(0,l.A)(this,Ta,(Et(this),e=>{(0,r.A)(ha,this,wt).emit(e)})),(0,l.A)(this,Ra,Mt(this)),(0,l.A)(this,La,(Nt(this),e=>{(0,r.A)(ha,this,xt).emit(e)})),(0,l.A)(this,za,St(this)),(0,l.A)(this,Ba,(Lt(this),e=>{(0,r.A)(ha,this,Tt).emit(e)})),(0,l.A)(this,Da,zt(this)),(0,l.A)(this,$a,($t(this),e=>{(0,r.A)(ha,this,Bt).emit(e)})),(0,l.A)(this,Ha,(0,u.createRef)())}get cells(){return(0,h.A)(Yt,this)}set cells(e){(0,d.A)(Yt,this,e)}get layout(){return(0,h.A)(Xt,this)}set layout(e){(0,d.A)(Xt,this,e)}get layoutOptions(){return(0,h.A)(_t,this)}set layoutOptions(e){(0,d.A)(_t,this,e)}get defaultNodeSize(){return(0,h.A)(jt,this)}set defaultNodeSize(e){(0,d.A)(jt,this,e)}get defaultNodeBricks(){return(0,h.A)(Ft,this)}set defaultNodeBricks(e){(0,d.A)(Ft,this,e)}get degradedThreshold(){return(0,h.A)(Zt,this)}set degradedThreshold(e){(0,d.A)(Zt,this,e)}get degradedNodeLabel(){return(0,h.A)(qt,this)}set degradedNodeLabel(e){(0,d.A)(qt,this,e)}get defaultEdgeLines(){return(0,h.A)(Gt,this)}set defaultEdgeLines(e){(0,d.A)(Gt,this,e)}get activeTarget(){return(0,h.A)(Jt,this)}set activeTarget(e){(0,d.A)(Jt,this,e)}get fadeUnrelatedCells(){return(0,h.A)(Qt,this)}set fadeUnrelatedCells(e){(0,d.A)(Qt,this,e)}get zoomable(){return(0,h.A)(ea,this)}set zoomable(e){(0,d.A)(ea,this,e)}get scrollable(){return(0,h.A)(ta,this)}set scrollable(e){(0,d.A)(ta,this,e)}get pannable(){return(0,h.A)(aa,this)}set pannable(e){(0,d.A)(aa,this,e)}get allowEdgeToArea(){return(0,h.A)(na,this)}set allowEdgeToArea(e){(0,d.A)(na,this,e)}get dragBehavior(){return(0,h.A)(sa,this)}set dragBehavior(e){(0,d.A)(sa,this,e)}get ctrlDragBehavior(){return(0,h.A)(la,this)}set ctrlDragBehavior(e){(0,d.A)(la,this,e)}get scaleRange(){return(0,h.A)(ia,this)}set scaleRange(e){(0,d.A)(ia,this,e)}get lineSettings(){return(0,h.A)(oa,this)}set lineSettings(e){(0,d.A)(oa,this,e)}get lineConnector(){return(0,h.A)(ra,this)}set lineConnector(e){(0,d.A)(ra,this,e)}async dropNode(e){var t,a;let{id:n,position:s,size:l,data:i,useBrick:o}=e;if(null===(t=(a=document).elementsFromPoint)||void 0===t||null===(t=t.call(a,s[0],s[1]))||void 0===t?void 0:t.includes(this)){var r;const e=this.getBoundingClientRect(),t=(0,h.A)(Ha,this).current.getTransform(),a={type:"node",id:n,view:{..."force"===this.layout||"dagre"===this.layout?null:{x:(s[0]-e.left-t.x)/t.k,y:(s[1]-e.top-t.y)/t.k},width:(null==l?void 0:l[0])??this.defaultNodeSize[0],height:(null==l?void 0:l[1])??this.defaultNodeSize[0]},data:i,useBrick:o};return null===(r=(0,h.A)(Ha,this).current)||void 0===r||r.dropNode(a),a}return null}async dropDecorator(e){var t,a;let{position:n,decorator:s,text:l,direction:i}=e;if(null===(t=(a=document).elementsFromPoint)||void 0===t||null===(t=t.call(a,n[0],n[1]))||void 0===t?void 0:t.includes(this)){var o;const e=this.getBoundingClientRect(),t=(0,h.A)(Ha,this).current.getTransform(),a={type:"decorator",decorator:s,id:Ia(),view:{x:(n[0]-e.left-t.x)/t.k,y:(n[1]-e.top-t.y)/t.k,width:R.N8,height:R.w1,text:l,direction:i}};return null===(o=(0,h.A)(Ha,this).current)||void 0===o||o.dropDecorator(a),a}return null}async addNodes(e){if(0===e.length)return[];const t=e.map((e=>{let{size:t,useBrick:a,id:n,data:s}=e;return{type:"node",id:n,data:s,view:{width:(null==t?void 0:t[0])??this.defaultNodeSize[0],height:(null==t?void 0:t[1])??this.defaultNodeSize[0]},useBrick:a}}));return(0,h.A)(Ha,this).current.addNodes(t,{defaultNodeSize:this.defaultNodeSize,canvasWidth:this.clientWidth,canvasHeight:this.clientHeight})}async addEdge(e){var t;let{source:a,target:n,data:s}=e;const l={type:"edge",source:a,target:n,data:s,view:this.lineSettings};return null===(t=(0,h.A)(Ha,this).current)||void 0===t||t.addEdge(l),l}manuallyConnectNodes(e){return(0,h.A)(Ha,this).current.manuallyConnectNodes(e)}async updateCells(e,t){await(0,o.A)(ha,this,Oa).call(this);const{updated:a}=(0,h.A)(Ha,this).current.updateCells(e,{...t,defaultNodeSize:this.defaultNodeSize,canvasWidth:this.clientWidth,canvasHeight:this.clientHeight});return{updated:a}}disconnectedCallback(){super.disconnectedCallback(),Ht(this,!1)}render(){return g().createElement(Ut,{host:this,ref:(0,h.A)(Ha,this),layout:this.layout,layoutOptions:this.layoutOptions,cells:this.cells,defaultNodeSize:this.defaultNodeSize,defaultNodeBricks:this.defaultNodeBricks,defaultEdgeLines:this.defaultEdgeLines,degradedThreshold:this.degradedThreshold,degradedNodeLabel:this.degradedNodeLabel,activeTarget:this.activeTarget,fadeUnrelatedCells:this.fadeUnrelatedCells,zoomable:this.zoomable,scrollable:this.scrollable,pannable:this.pannable,dragBehavior:this.dragBehavior,ctrlDragBehavior:this.ctrlDragBehavior,scaleRange:this.scaleRange,lineSettings:this.lineSettings,lineConnector:this.lineConnector,allowEdgeToArea:this.allowEdgeToArea,onActiveTargetChange:(0,h.A)(ca,this),onSwitchActiveTarget:(0,h.A)(ua,this),onCellMove:(0,h.A)(Aa,this),onCellsMove:(0,h.A)(va,this),onCellResize:(0,h.A)(fa,this),onCellDelete:(0,h.A)(wa,this),onCellsDelete:(0,h.A)(Ea,this),onEdgeAdd:(0,h.A)(Na,this),onCellContextMenu:(0,h.A)(xa,this),onDecoratorTextChange:(0,h.A)(La,this),onContainerContainerChange:(0,h.A)(Ba,this),onScaleChange:(0,h.A)($a,this),onEdgeViewChange:(0,h.A)(Ta,this)})}}function Oa(){return new Promise((e=>{const t=()=>{(0,h.A)(Ha,this).current?e():setTimeout(t,10)};t()}))}function Ka(e,t){let{host:a,layout:n,layoutOptions:s,cells:l,defaultNodeSize:i,defaultNodeBricks:o,defaultEdgeLines:r,degradedThreshold:d,degradedNodeLabel:h,activeTarget:c,fadeUnrelatedCells:p,zoomable:A,scrollable:m,pannable:y,dragBehavior:E,ctrlDragBehavior:U,scaleRange:V,lineSettings:Z,lineConnector:q,allowEdgeToArea:G,onActiveTargetChange:J,onSwitchActiveTarget:Q,onCellMove:ee,onCellResize:te,onCellDelete:ae,onCellsMove:ne,onCellsDelete:se,onCellContextMenu:le,onEdgeAdd:ie,onDecoratorTextChange:oe,onScaleChange:re,onContainerContainerChange:de,onEdgeViewChange:he}=e;const[{cells:ce,layoutKey:ue},ge]=(0,u.useReducer)(k.d,l,(e=>({cells:(0,N.C)(e,{defaultNodeSize:i}),layoutKey:0}))),pe=(0,u.useMemo)((()=>ce.filter(C.N).length>=(d??R.pC)),[ce,d]),Ae=(0,u.useRef)(null),me=(0,u.useRef)(null),[ve,ye]=(0,u.useState)([]),[fe,be]=(0,u.useState)([]),{grabbing:ke,transform:we,zoomer:Ce,scaleRange:Ee}=(0,L.f)({rootRef:Ae,zoomable:A,scrollable:m,pannable:y,draggable:"grab"===E,ctrlDraggable:"grab"===U,scaleRange:V,onSwitchActiveTarget:Q});(0,u.useEffect)((()=>{re(we.k)}),[re,we.k]);const[Me,xe]=(0,u.useState)(null),[We,Ne]=(0,u.useState)(null),{centered:Se,setCentered:Te,getNextLayoutKey:Re}=(0,D.g)({layout:n,layoutOptions:s,rootRef:Ae,cells:ce,zoomable:A,zoomer:Ce,scaleRange:Ee,layoutKey:ue,allowEdgeToArea:G,dispatch:ge});(0,u.useImperativeHandle)(t,(()=>({dropNode(e){"dagre"!==n&&"force"!==n&&Te(!0),ge({type:"drop-node",payload:e})},dropDecorator(e){"dagre"!==n&&"force"!==n&&Te(!0),ge({type:"drop-decorator",payload:e})},addNodes(e,t){let{defaultNodeSize:a,canvasWidth:s,canvasHeight:l}=t;const i=ce.findLastIndex((e=>!("decorator"===e.type&&"text"===e.decorator)))+1,o=[...ce.slice(0,i),...e,...ce.slice(i)],{cells:r,updated:d,shouldReCenter:h}=(0,S.L)({cells:o,layout:n,previousCells:ce,defaultNodeSize:a,canvasWidth:s,canvasHeight:l,scaleRange:Ee,transform:we,allowEdgeToArea:G});return h&&Te(!1),ge({type:"update-cells",payload:r}),d.filter((t=>e.includes(t)))},addEdge(e){ge({type:"add-edge",payload:e})},updateCells(e,t){const{shouldReCenter:a,...s}=(0,S.L)({...t,layout:n,previousCells:ce,cells:e,scaleRange:Ee,transform:we,allowEdgeToArea:G});return a&&Te(!1),ge({type:"update-cells",payload:s.cells}),s},getTransform:()=>we,manuallyConnectNodes(e){const t=ce.find((t=>(0,C.bo)(t,G)&&t.id===e));if(t){const e=Ae.current.getBoundingClientRect();return Ne({source:t,from:[t.view.x+t.view.width/2,t.view.y+t.view.height/2],offset:[e.left,e.top]}),new Promise(((e,t)=>{me.current={resolve:e,reject:t}}))}return Promise.reject(null)}})),[ce,n,Ee,Te,we,G]);const Le=(0,u.useCallback)(((e,t)=>{var a;for(let a=ce.length-1;a>=0;a--){const s=ce[a];if((0,C.bo)(s,G)&&s.id!==e.source.id&&s.view.x<t[0]&&s.view.x+s.view.width>t[0]&&s.view.y<t[1]&&s.view.y+s.view.height>t[1]){var n;null===(n=me.current)||void 0===n||n.resolve({source:e.source,target:s});break}}null===(a=me.current)||void 0===a||a.reject(null),Ne(null)}),[G,ce]),[ze,Be]=(0,u.useState)(null);(0,u.useEffect)((()=>{Ht(a,!!(We||ze||Me))}),[We,a,ze,Me]);const De=(0,z.J)({rootRef:Ae,activeTarget:c,onActiveTargetChange:J}),[$e,He]=(0,u.useState)([]);(0,u.useEffect)((()=>{const e=p?(0,T.Y)(ce,We,De,G):[];He((t=>0===t.length&&0===e.length?t:e))}),[De,ce,We,p,G]),(0,u.useEffect)((()=>{const e=Ae.current;if(!e||ve.length>0)return;const t=e=>{const t=(0,M.a)(e,{cells:ce,activeTarget:De});"delete-cells"===(null==t?void 0:t.action)&&(se(t.cells),1===t.cells.length&&ae(t.cells[0]))};return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}),[De,ce,ve.length,ae,se]);const Pe=`${(0,u.useMemo)((()=>`${(0,v.uniqueId)("diagram-")}-`),[])}line-arrow-`,[Oe,Ke]=(0,u.useState)([]),Ie=(0,u.useCallback)((e=>{ge({type:"move-cells",payload:e});const t=[];(0,_._)(e,ce).forEach((e=>{var a,n;null!==(a=e.containerCell)&&void 0!==a&&a.id&&t.push(null===(n=e.containerCell)||void 0===n?void 0:n.id)})),be(t),Ke(e.flatMap((e=>e.guideLines??[])))}),[ce]),Ue=(0,u.useCallback)((e=>{ge({type:"move-cells",payload:e}),ne(e),1===e.length&&ee(e[0]),(0,_._)(e,ce,de),be([]),Ke([])}),[ee,ne,ce,de]),Ve=(0,u.useCallback)((e=>{ge({type:"resize-cell",payload:e})}),[]),Ye=(0,u.useCallback)((e=>{ge({type:"resize-cell",payload:e}),te(e)}),[te]),Xe=(0,u.useCallback)((e=>{let{id:t,editing:a}=e;ye(a?e=>e.includes(t)?e:[...e,t]:e=>e.filter((e=>e!==t)))}),[]),_e=(0,u.useCallback)(((e,t)=>{const a=Re();ge({type:"update-node-size",payload:{id:e,size:t},layoutKey:a})}),[Re]),je=(0,u.useCallback)((e=>{Ce.scaleTo((0,b.A)(Ae.current),e/100)}),[Ce]),Fe=(0,u.useCallback)((()=>{Te(!1)}),[Te]),{lineConfMap:Ze,lineConnectorConf:qe,markers:Ge}=(0,H.d)({cells:ce,defaultEdgeLines:r,lineConnector:q,markerPrefix:Pe}),Je=(0,$.H)({cells:ce,layout:n,centered:Se}),[Qe,et]=(0,u.useState)(null),tt=(0,u.useRef)(null),[at,nt]=(0,u.useState)(null),[st,lt]=(0,u.useState)(null),it=(0,u.useCallback)((e=>{if(qe&&(0,C.bo)(e,G)&&(!st||"control"!==st.type)){null!==tt.current&&(clearTimeout(tt.current),tt.current=null);const t=(0,P.G)();et({cell:e,relativePoints:t,points:Ua(t,e.view)})}}),[G,qe,st]),ot=(0,u.useCallback)((e=>{qe&&(0,C.N)(e)&&(tt.current=setTimeout((()=>{et(null)})))}),[qe]),rt=(0,u.useCallback)(((e,t,a,n)=>{const s={source:e.id,target:t.id,view:{...Z,exitPosition:a,entryPosition:n,vertices:null}};if(ce.find((a=>"edge"===a.type&&a.source===e.id&&a.target===t.id)))ge({type:"change-edge-view",payload:s}),null==he||he(s);else{const a={type:"edge",...s};ge({type:"add-edge",payload:a}),ie({source:e,target:t,view:a.view})}}),[ce,Z,ie,he]),dt=(0,u.useCallback)(((e,t,a)=>{const n={source:e.id,target:t.id,view:a};ge({type:"change-edge-view",payload:n}),null==he||he(n)}),[he]),ht=(0,u.useMemo)((()=>({rootRef:Ae,smartConnectLineState:ze,unsetHoverStateTimeoutRef:tt,hoverState:Qe,activeEditableLine:at,lineEditorState:st,setLineEditorState:lt,setActiveEditableLine:nt,setHoverState:et,setSmartConnectLineState:Be,onConnect:rt,onChangeEdgeView:dt})),[at,dt,rt,Qe,st,ze]);return(0,u.useEffect)((()=>{const e=Ae.current;if(!e||"lasso"!==E)return;const t=e.getBoundingClientRect(),a=e=>{(0,I.F)(e,{transform:we,offset:[t.left,t.top],onLassoing(e){xe(e)},onLassoed(e){xe(null);const t=[];for(const a of ce)if((0,C.t2)(a)||(0,C.o6)(a)||(0,C.Hs)(a)){const n=a.view.x,s=a.view.y;n>=e.x&&n+a.view.width<=e.x+e.width&&s>=e.y&&s+a.view.height<=e.y+e.height&&t.push(a)}null==Q||Q(t.length>1?{type:"multi",targets:t.map(X.P)}:1===t.length?(0,X.P)(t[0]):null)}})};return e.addEventListener("mousedown",a),()=>{e.removeEventListener("mousedown",a)}}),[we,ce,E,Q]),g().createElement(K.H.Provider,{value:ht},g().createElement("svg",{width:"100%",height:"100%",ref:Ae,className:f()("root",{grabbing:ke,pannable:y,ready:Je}),tabIndex:-1},g().createElement("defs",null,Ge.map(((e,t)=>g().createElement(w.c,{key:t,id:`${Pe}${t}`,type:e.markerType,strokeColor:e.strokeColor})))),g().createElement("g",{transform:`translate(${we.x} ${we.y}) scale(${we.k})`},g().createElement("g",{className:f()("cells",{allowEdgeToArea:G})},ce.map((e=>g().createElement(x.m,{key:`${e.type}:${(0,C.WW)(e)?`${e.source}~${e.target}`:e.id}`,dragNodeToContainerActive:!(0,C.WW)(e)&&fe.includes(e.id),layout:n,layoutOptions:s,cell:e,cells:ce,degraded:pe,degradedNodeLabel:h,defaultNodeBricks:o,transform:we,lineConfMap:Ze,activeTarget:De,unrelatedCells:$e,allowEdgeToArea:G,onCellsMoving:Ie,onCellsMoved:Ue,onCellResizing:Ve,onCellResized:Ye,onSwitchActiveTarget:Q,onCellContextMenu:le,onDecoratorTextChange:oe,onDecoratorTextEditing:Xe,onNodeBrickResize:_e,onCellMouseEnter:it,onCellMouseLeave:ot})))),g().createElement("g",null,g().createElement(W.w,{connectLineState:We,transform:we,markerEnd:`${Pe}0`,onConnect:Le})),Me&&g().createElement("rect",{x:Me.x,y:Me.y,width:Me.width,height:Me.height,fill:"var(--palette-gray-5)",fillOpacity:.3,stroke:"var(--palette-gray-5)",strokeDasharray:2}),qe&&g().createElement("g",null,g().createElement(Y.X,{transform:we,lineSettings:Z,options:qe}),g().createElement(F.W,{transform:we,options:qe})),g().createElement("g",null,Oe.map(((e,t)=>g().createElement("path",{key:t,d:`M${e[0].join(" ")} L${e[1].join(" ")}`,stroke:"var(--palette-orange-5)",fill:"none",strokeWidth:1/we.k})))),g().createElement("g",null,qe&&g().createElement(j.F,{scale:we.k})),qe&&g().createElement(O.T,{activeTarget:De,scale:we.k,disabled:!!We}))),g().createElement(B.Y,{shadowRoot:a.shadowRoot,scale:we.k,scaleRange:Ee,onZoomChange:je,onReCenter:Fe}))}function Ia(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}function Ua(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const n=R.XK,s=n/2,l=t.x+a/2-s,i=t.y+a/2-s,o=t.width-a+n,r=t.height-a+n;return e.map((e=>({x:l+e.x*o,y:i+e.y*r})))}n=Pa,({e:[G,J,Q,ee,te,ae,ne,se,le,ie,oe,re,de,he,ce,ue,ge,pe,Ae,me,ve,ye,fe,be,ke,we,Ce,Ee,Me,xe,We,Ne,Se,Te,Re,Le,ze,Be,De,$e,He,Pe,Oe,Ke,Ie,Ue,Ve,Ye,Xe,_e,je,Fe,Ze,qe,Ge,Je,Qe,et,tt,at,nt,st,lt,it,ot,rt,dt,ht,ct,ut,gt,pt,At,mt,vt,yt,ft,bt,kt,wt,Ct,Et,Mt,xt,Wt,Nt,St,Tt,Rt,Lt,zt,Bt,Dt,$t,Z],c:[Vt,q]}=(0,c.A)(n,[Pt("eo-draw-canvas",{styleTexts:[U.A,V.A]})],[[Ot({attribute:!1}),1,"cells"],[Ot({type:String}),1,"layout"],[Ot({attribute:!1}),1,"layoutOptions"],[Ot({attribute:!1}),1,"defaultNodeSize"],[Ot({attribute:!1}),1,"defaultNodeBricks"],[Ot({type:Number}),1,"degradedThreshold"],[Ot({attribute:!1}),1,"degradedNodeLabel"],[Ot({attribute:!1}),1,"defaultEdgeLines"],[Ot({attribute:!1}),1,"activeTarget"],[Ot({type:Boolean}),1,"fadeUnrelatedCells"],[Ot({type:Boolean}),1,"zoomable"],[Ot({type:Boolean}),1,"scrollable"],[Ot({type:Boolean}),1,"pannable"],[Ot({type:Boolean}),1,"allowEdgeToArea"],[Ot(),1,"dragBehavior"],[Ot(),1,"ctrlDragBehavior"],[Ot({attribute:!1}),1,"scaleRange"],[Ot({attribute:!1}),1,"lineSettings"],[Ot({attribute:!1}),1,"lineConnector"],[It({type:"activeTarget.change"}),1,"activeTargetChangeEvent",e=>(0,h.A)(da,e),(e,t)=>(0,d.A)(da,e,t)],[It({type:"node.move"}),1,"nodeMoveEvent",e=>(0,h.A)(ga,e),(e,t)=>(0,d.A)(ga,e,t)],[It({type:"cell.move"}),1,"cellMoveEvent",e=>(0,h.A)(pa,e),(e,t)=>(0,d.A)(pa,e,t)],[It({type:"cells.move"}),1,"cellsMoveEvent",e=>(0,h.A)(ma,e),(e,t)=>(0,d.A)(ma,e,t)],[It({type:"cell.resize"}),1,"cellResizeEvent",e=>(0,h.A)(ya,e),(e,t)=>(0,d.A)(ya,e,t)],[It({type:"node.delete"}),1,"nodeDelete",e=>(0,h.A)(ba,e),(e,t)=>(0,d.A)(ba,e,t)],[It({type:"cell.delete"}),1,"cellDelete",e=>(0,h.A)(ka,e),(e,t)=>(0,d.A)(ka,e,t)],[It({type:"cells.delete"}),1,"cellsDelete",e=>(0,h.A)(Ca,e),(e,t)=>(0,d.A)(Ca,e,t)],[It({type:"cell.contextmenu"}),1,"cellContextMenu",e=>(0,h.A)(Ma,e),(e,t)=>(0,d.A)(Ma,e,t)],[It({type:"edge.add"}),1,"edgeAdd",e=>(0,h.A)(Wa,e),(e,t)=>(0,d.A)(Wa,e,t)],[It({type:"edge.view.change"}),1,"edgeViewChange",e=>(0,h.A)(Sa,e),(e,t)=>(0,d.A)(Sa,e,t)],[It({type:"decorator.text.change"}),1,"decoratorTextChange",e=>(0,h.A)(Ra,e),(e,t)=>(0,d.A)(Ra,e,t)],[It({type:"node.container.change"}),1,"containerContainerChange",e=>(0,h.A)(za,e),(e,t)=>(0,d.A)(za,e,t)],[It({type:"scale.change"}),1,"scaleChange",e=>(0,h.A)(Da,e),(e,t)=>(0,d.A)(Da,e,t)],[Kt(),2,"dropNode"],[Kt(),2,"dropDecorator"],[Kt(),2,"addNodes"],[Kt(),2,"addEdge"],[Kt(),2,"manuallyConnectNodes"],[Kt(),2,"updateCells"]],0,(e=>Ha.has((0,i.A)(e))),A.ReactNextElement)),q()},3971:(e,t,a)=>{a.d(t,{A:()=>o});var n=a(6758),s=a.n(n),l=a(935),i=a.n(l)()(s());i.push([e.id,':host{display:block;--local-label-line-height:inherit;--local-label-font-size:inherit;--local-label-color:inherit;--local-label-font-weight:inherit}:host([hidden]){display:none}:host([type="line"]){--local-label-line-height:18px;--local-label-font-size:11px;--local-label-color:var(--color-secondary-text);--local-label-font-weight:400}*{box-sizing:border-box}.label{max-width:168px;margin:-3px}.label-text,\n.label-input{width:100%;height:24px;padding:3px;border:none;line-height:var(--local-label-line-height);font-size:var(--local-label-font-size);color:var(--local-label-color);font-weight:var(--local-label-font-weight);text-align:center;font-family:inherit;cursor:text;-webkit-user-select:text;user-select:text}.label-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.label.editing .label-text,\n.label.empty:not(.editing) .label-text,\n.label:not(.editing) .label-input{display:none}',""]);const o=i.toString()},497:(e,t,a)=>{a.d(t,{A:()=>o});var n=a(6758),s=a.n(n),l=a(935),i=a.n(l)()(s());i.push([e.id,'*{box-sizing:border-box}:host{display:block;border:1px solid var(--palette-gray-5);cursor:default;-webkit-user-select:none;user-select:none}:host([hidden]){display:none}:host([usage="dragging"]){opacity:0.75;position:fixed}:host(:not([usage="library"])){background:rgba(0,0,0,0.2);width:60px;height:60px}:host([usage="library"]){width:180px;height:30px;margin-bottom:10px}div{width:100%;height:100%;display:flex;align-items:center;justify-content:center}:host(:not([usage="dragging"]):not([usage="library"]):hover),\n:host([status="highlighted"]){color:var(--palette-blue-5);background:var(--palette-blue-1);border-color:1px solid var(--palette-blue-4)}:host([status="faded"]){opacity:0.3}:host([decorator="area"]){width:100px;height:60px;background:rgba(119,141,195,0.1);border:none}:host([decorator="text"]){width:auto;height:auto;background:none;border:none}',""]);const o=i.toString()}}]);
2
+ //# sourceMappingURL=9711.58afee04.js.map