@next-bricks/diagram 0.47.0 → 0.48.1

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 (47) hide show
  1. package/dist/bricks.json +3 -3
  2. package/dist/chunks/{4192.5903f562.js → 1124.b5167ef0.js} +2 -2
  3. package/dist/chunks/{4192.5903f562.js.map → 1124.b5167ef0.js.map} +1 -1
  4. package/dist/chunks/{3171.7b3bd3db.js → 3171.05e8c8e3.js} +2 -2
  5. package/dist/chunks/{5552.05f2ffc3.js.map → 3171.05e8c8e3.js.map} +1 -1
  6. package/dist/chunks/{3233.7d668e53.js → 3233.19da547d.js} +3 -3
  7. package/dist/chunks/{3233.7d668e53.js.map → 3233.19da547d.js.map} +1 -1
  8. package/dist/chunks/{3933.0ff81187.js → 3933.88eac208.js} +2 -2
  9. package/dist/chunks/{3933.0ff81187.js.map → 3933.88eac208.js.map} +1 -1
  10. package/dist/chunks/4766.f59e3f71.js +3 -0
  11. package/dist/chunks/4766.f59e3f71.js.map +1 -0
  12. package/dist/chunks/{4837.3e1f88e9.js → 4837.70d6aed1.js} +2 -2
  13. package/dist/chunks/{7218.5fe22f37.js.map → 4837.70d6aed1.js.map} +1 -1
  14. package/dist/chunks/{5552.05f2ffc3.js → 5552.2e16bd1b.js} +2 -2
  15. package/dist/chunks/{3171.7b3bd3db.js.map → 5552.2e16bd1b.js.map} +1 -1
  16. package/dist/chunks/{6314.24686b76.js → 6314.bb9b530c.js} +2 -2
  17. package/dist/chunks/{6314.24686b76.js.map → 6314.bb9b530c.js.map} +1 -1
  18. package/dist/chunks/{7218.5fe22f37.js → 7218.46d7a966.js} +2 -2
  19. package/dist/chunks/{4837.3e1f88e9.js.map → 7218.46d7a966.js.map} +1 -1
  20. package/dist/chunks/{9711.58afee04.js → 9711.db99cd7a.js} +2 -2
  21. package/dist/chunks/{9711.58afee04.js.map → 9711.db99cd7a.js.map} +1 -1
  22. package/dist/chunks/9961.1377f8c4.js +2 -0
  23. package/dist/chunks/9961.1377f8c4.js.map +1 -0
  24. package/dist/chunks/{eo-display-canvas.31ead79a.js → eo-display-canvas.6413b302.js} +2 -2
  25. package/dist/chunks/{eo-display-canvas.31ead79a.js.map → eo-display-canvas.6413b302.js.map} +1 -1
  26. package/dist/chunks/{eo-draw-canvas.a5b81b45.js → eo-draw-canvas.75290631.js} +2 -2
  27. package/dist/chunks/{eo-draw-canvas.a5b81b45.js.map → eo-draw-canvas.75290631.js.map} +1 -1
  28. package/dist/chunks/main.81d474f0.js +2 -0
  29. package/dist/chunks/{main.5593807b.js.map → main.81d474f0.js.map} +1 -1
  30. package/dist/examples.json +4 -4
  31. package/dist/index.05903de6.js +2 -0
  32. package/dist/{index.cccdafd2.js.map → index.05903de6.js.map} +1 -1
  33. package/dist/manifest.json +91 -91
  34. package/dist/types.json +4116 -4106
  35. package/dist-types/draw-canvas/interfaces.d.ts +12 -4
  36. package/dist-types/shared/canvas/useLineMarkers.d.ts +2 -0
  37. package/docs/eo-display-canvas.md +13 -7
  38. package/docs/eo-draw-canvas.md +6 -0
  39. package/package.json +3 -3
  40. package/dist/chunks/6055.9858b4b9.js +0 -2
  41. package/dist/chunks/6055.9858b4b9.js.map +0 -1
  42. package/dist/chunks/799.ccb70fb8.js +0 -3
  43. package/dist/chunks/799.ccb70fb8.js.map +0 -1
  44. package/dist/chunks/main.5593807b.js +0 -2
  45. package/dist/index.cccdafd2.js +0 -2
  46. /package/dist/chunks/{3233.7d668e53.js.LICENSE.txt → 3233.19da547d.js.LICENSE.txt} +0 -0
  47. /package/dist/chunks/{799.ccb70fb8.js.LICENSE.txt → 4766.f59e3f71.js.LICENSE.txt} +0 -0
package/dist/bricks.json CHANGED
@@ -6,8 +6,8 @@
6
6
  ],
7
7
  "elements": [
8
8
  "eo-diagram",
9
- "eo-display-canvas",
10
- "eo-draw-canvas"
9
+ "eo-draw-canvas",
10
+ "eo-display-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.cccdafd2.js"
19
+ "filePath": "bricks/diagram/dist/index.05903de6.js"
20
20
  }
@@ -1,2 +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
1
+ "use strict";(globalThis.webpackChunk_next_bricks_diagram=globalThis.webpackChunk_next_bricks_diagram||[]).push([[1124],{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=1124.b5167ef0.js.map
@@ -1 +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,OAAQd,EACRsB,YAAa,EACbP,KAAK,SAIb,CAEA,SAASb,EAA8BsB,GAGG,IAHF,GACtC1B,E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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":""}
1
+ {"version":3,"file":"chunks/1124.b5167ef0.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,IAH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qF,EAAS9G,KAAK4G,IAAIN,EAAEjH,EAAIiH,EAAE7E,OAAS,EAAG+E,EAAEnH,EAAImH,EAAE/E,OAAS,GAC7D,OAAOkF,EAAQF,EAAOH,EAAE9E,MAAQgF,EAAEhF,OAASsF,EAASD,EAAMP,EAAE7E,OAAS+E,EAAE/E,MACzE,CAEA,SAAS8E,EAAoBR,EAAgBgB,GAC3C,MAAO,CACL5H,EAAG4G,EAAK5G,EAAI4G,EAAKvE,MAAQ,EAAIuF,EAC7B1H,EAAG0G,EAAK1G,EAAI0G,EAAKtE,OAAS,EAAIsF,EAC9BvF,MAAOuE,EAAKvE,MAAkB,EAAVuF,EACpBtF,OAAQsE,EAAKtE,OAAmB,EAAVsF,EAE1B,C,iCCtBO,SAASC,EACdC,GAEA,GAAI7I,MAAMC,QAAQ4I,GAAQ,CACxB,MAAMC,EAAKD,EAAM,GACXE,EAAKF,EAAMhI,OAAS,EAAIgI,EAAM,GAAMC,EAG1C,MAAO,CAACA,EAAIC,EAFDF,EAAMhI,OAAS,EAAIgI,EAAM,GAAMC,EAC/BD,EAAMhI,OAAS,EAAIgI,EAAM,GAAME,EAE5C,CACA,OAAO,IAAI/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":""}
@@ -1,2 +1,2 @@
1
- "use strict";(globalThis.webpackChunk_next_bricks_diagram=globalThis.webpackChunk_next_bricks_diagram||[]).push([[3171,5552],{5552:(e,n,t)=>{t.r(n),t.d(n,{i18n:()=>p,i18nText:()=>l,initializeI18n:()=>c});var i=t(2350),s=t(9428),r=t(7072);let a=!1;const o=new Set;function c(e,n){if(a||(a=!0,s.i18n.use(r.default).init({fallbackLng:"zh",debug:!1,supportedLngs:["zh","en"],nonExplicitSupportedLngs:!0,interpolation:{escapeValue:!1},react:{useSuspense:!1},compatibilityJSON:"v3",resources:{}})),e&&n&&!o.has(e)){o.add(e);for(const[t,i]of Object.entries(n))s.i18n.addResourceBundle(t,e,i)}}var u=t(7057);function l(e){if(!e)return;const n=s.i18n.language??"zh-CN";if((0,u.hasOwnProperty)(e,n))return e[n];const t=n.split("-")[0];if(t!==n)return(0,u.hasOwnProperty)(e,t)?e[t]:void 0;const i=`${t}-`;for(const n of Object.keys(e))if(n.startsWith(i))return e[n]}const p=i.default}}]);
2
- //# sourceMappingURL=3171.7b3bd3db.js.map
1
+ "use strict";(globalThis.webpackChunk_next_bricks_diagram=globalThis.webpackChunk_next_bricks_diagram||[]).push([[3171,5552],{5552:(e,n,t)=>{t.r(n),t.d(n,{i18n:()=>p,i18nText:()=>l,initializeI18n:()=>c});var i=t(2350),s=t(6181),r=t(7072);let a=!1;const o=new Set;function c(e,n){if(a||(a=!0,s.i18n.use(r.default).init({fallbackLng:"zh",debug:!1,supportedLngs:["zh","en"],nonExplicitSupportedLngs:!0,interpolation:{escapeValue:!1},react:{useSuspense:!1},compatibilityJSON:"v3",resources:{}})),e&&n&&!o.has(e)){o.add(e);for(const[t,i]of Object.entries(n))s.i18n.addResourceBundle(t,e,i)}}var u=t(3078);function l(e){if(!e)return;const n=s.i18n.language??"zh-CN";if((0,u.hasOwnProperty)(e,n))return e[n];const t=n.split("-")[0];if(t!==n)return(0,u.hasOwnProperty)(e,t)?e[t]:void 0;const i=`${t}-`;for(const n of Object.keys(e))if(n.startsWith(i))return e[n]}const p=i.default}}]);
2
+ //# sourceMappingURL=3171.05e8c8e3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chunks/5552.05f2ffc3.js","mappings":"8OAEA,IAAIA,GAAc,EAClB,MAAMC,EAAwB,IAAIC,IAC3B,SAASC,EAAeC,EAAIC,GAwBjC,GAvBKL,IACHA,GAAc,EACd,EAAAM,KAICC,IAAmF,WAEnFC,KAAK,CACJC,YAAa,KACbC,OAAO,EACPC,cAAe,CAAC,KAAM,MACtBC,0BAA0B,EAC1BC,cAAe,CACbC,aAAa,GAEfC,MAAO,CACLC,aAAa,GAEfC,kBAAmB,KACnBC,UAAW,CAAC,KAGXd,GAAOC,IAAWJ,EAAsBkB,IAAIf,GAAjD,CAGAH,EAAsBmB,IAAIhB,GAC1B,IAAK,MAAOiB,EAAMH,KAAcI,OAAOC,QAAQlB,GAC7C,EAAAC,KAAKkB,kBAAkBH,EAAMjB,EAAIc,EAHnC,CAKF,C,cCjCO,SAASO,EAASC,GACvB,IAAKA,EACH,OAEF,MAAMC,EAAW,EAAArB,KAAKqB,UAAY,QAElC,IAAI,IAAAC,gBAAeF,EAAMC,GACvB,OAAOD,EAAKC,GAGd,MAAME,EAAkBF,EAASG,MAAM,KAAK,GAC5C,GAAID,IAAoBF,EAGtB,OAAO,IAAAC,gBAAeF,EAAMG,GAAmBH,EAAKG,QAAmBE,EAKzE,MAAMC,EAAS,GAAGH,KAClB,IAAK,MAAMI,KAAOX,OAAOY,KAAKR,GAC5B,GAAIO,EAAIE,WAAWH,GACjB,OAAON,EAAKO,EAGlB,CC1BO,MAAM3B,EAA6E,S","sources":["webpack:///../../node_modules/@next-core/i18n/dist/esm/init.js","webpack:///../../node_modules/@next-core/i18n/dist/esm/text.js","webpack:///../../node_modules/@next-core/i18n/dist/esm/index.js"],"sourcesContent":["import { i18n } from \"@next-core/i18n\";\nimport LanguageDetector from \"i18next-browser-languagedetector\";\nlet initialized = false;\nconst initializedNamespaces = new Set();\nexport function initializeI18n(NS, locales) {\n if (!initialized) {\n initialized = true;\n i18n\n // learn more: https://github.com/i18next/i18next-xhr-backend\n // .use(Backend)\n // learn more: https://github.com/i18next/i18next-browser-languageDetector\n .use(process.env.NODE_ENV === \"test\" ? LanguageDetector : /* istanbul ignore next */LanguageDetector.default)\n // for all options read: https://www.i18next.com/overview/configuration-options\n .init({\n fallbackLng: \"zh\",\n debug: process.env.NODE_ENV === \"development\",\n supportedLngs: [\"zh\", \"en\"],\n nonExplicitSupportedLngs: true,\n interpolation: {\n escapeValue: false // not needed for react as it escapes by default\n },\n react: {\n useSuspense: false\n },\n compatibilityJSON: \"v3\",\n resources: {}\n });\n }\n if (!NS || !locales || initializedNamespaces.has(NS)) {\n return;\n }\n initializedNamespaces.add(NS);\n for (const [lang, resources] of Object.entries(locales)) {\n i18n.addResourceBundle(lang, NS, resources);\n }\n}\n//# sourceMappingURL=init.js.map","import { i18n } from \"@next-core/i18n\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nexport function i18nText(data) {\n if (!data) {\n return;\n }\n const language = i18n.language ?? \"zh-CN\";\n // First, make a perfect match.\n if (hasOwnProperty(data, language)) {\n return data[language];\n }\n // https://en.wikipedia.org/wiki/IETF_language_tag\n const primaryLanguage = language.split(\"-\")[0];\n if (primaryLanguage !== language) {\n // Then, match the primary language (which omits other subtags).\n // E.g., match `zh` if the current language is `zh-CN`.\n return hasOwnProperty(data, primaryLanguage) ? data[primaryLanguage] : undefined;\n }\n // At last, match the first key which starts with the primary language,\n // if the current language contains primary subtag only.\n // E.g., match `zh-CN` if the current language is `zh`.\n const prefix = `${primaryLanguage}-`;\n for (const key of Object.keys(data)) {\n if (key.startsWith(prefix)) {\n return data[key];\n }\n }\n}\n//# sourceMappingURL=text.js.map","import i18next from \"i18next\";\nexport const i18n = process.env.NODE_ENV === \"test\" ? i18next : /* istanbul ignore next */i18next.default;\nexport * from \"./init.js\";\nexport * from \"./text.js\";\n//# sourceMappingURL=index.js.map"],"names":["initialized","initializedNamespaces","Set","initializeI18n","NS","locales","i18n","use","init","fallbackLng","debug","supportedLngs","nonExplicitSupportedLngs","interpolation","escapeValue","react","useSuspense","compatibilityJSON","resources","has","add","lang","Object","entries","addResourceBundle","i18nText","data","language","hasOwnProperty","primaryLanguage","split","undefined","prefix","key","keys","startsWith"],"sourceRoot":""}
1
+ {"version":3,"file":"chunks/3171.05e8c8e3.js","mappings":"8OAEA,IAAIA,GAAc,EAClB,MAAMC,EAAwB,IAAIC,IAC3B,SAASC,EAAeC,EAAIC,GAwBjC,GAvBKL,IACHA,GAAc,EACd,EAAAM,KAICC,IAAmF,WAEnFC,KAAK,CACJC,YAAa,KACbC,OAAO,EACPC,cAAe,CAAC,KAAM,MACtBC,0BAA0B,EAC1BC,cAAe,CACbC,aAAa,GAEfC,MAAO,CACLC,aAAa,GAEfC,kBAAmB,KACnBC,UAAW,CAAC,KAGXd,GAAOC,IAAWJ,EAAsBkB,IAAIf,GAAjD,CAGAH,EAAsBmB,IAAIhB,GAC1B,IAAK,MAAOiB,EAAMH,KAAcI,OAAOC,QAAQlB,GAC7C,EAAAC,KAAKkB,kBAAkBH,EAAMjB,EAAIc,EAHnC,CAKF,C,cCjCO,SAASO,EAASC,GACvB,IAAKA,EACH,OAEF,MAAMC,EAAW,EAAArB,KAAKqB,UAAY,QAElC,IAAI,IAAAC,gBAAeF,EAAMC,GACvB,OAAOD,EAAKC,GAGd,MAAME,EAAkBF,EAASG,MAAM,KAAK,GAC5C,GAAID,IAAoBF,EAGtB,OAAO,IAAAC,gBAAeF,EAAMG,GAAmBH,EAAKG,QAAmBE,EAKzE,MAAMC,EAAS,GAAGH,KAClB,IAAK,MAAMI,KAAOX,OAAOY,KAAKR,GAC5B,GAAIO,EAAIE,WAAWH,GACjB,OAAON,EAAKO,EAGlB,CC1BO,MAAM3B,EAA6E,S","sources":["webpack:///../../node_modules/@next-core/i18n/dist/esm/init.js","webpack:///../../node_modules/@next-core/i18n/dist/esm/text.js","webpack:///../../node_modules/@next-core/i18n/dist/esm/index.js"],"sourcesContent":["import { i18n } from \"@next-core/i18n\";\nimport LanguageDetector from \"i18next-browser-languagedetector\";\nlet initialized = false;\nconst initializedNamespaces = new Set();\nexport function initializeI18n(NS, locales) {\n if (!initialized) {\n initialized = true;\n i18n\n // learn more: https://github.com/i18next/i18next-xhr-backend\n // .use(Backend)\n // learn more: https://github.com/i18next/i18next-browser-languageDetector\n .use(process.env.NODE_ENV === \"test\" ? LanguageDetector : /* istanbul ignore next */LanguageDetector.default)\n // for all options read: https://www.i18next.com/overview/configuration-options\n .init({\n fallbackLng: \"zh\",\n debug: process.env.NODE_ENV === \"development\",\n supportedLngs: [\"zh\", \"en\"],\n nonExplicitSupportedLngs: true,\n interpolation: {\n escapeValue: false // not needed for react as it escapes by default\n },\n react: {\n useSuspense: false\n },\n compatibilityJSON: \"v3\",\n resources: {}\n });\n }\n if (!NS || !locales || initializedNamespaces.has(NS)) {\n return;\n }\n initializedNamespaces.add(NS);\n for (const [lang, resources] of Object.entries(locales)) {\n i18n.addResourceBundle(lang, NS, resources);\n }\n}\n//# sourceMappingURL=init.js.map","import { i18n } from \"@next-core/i18n\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nexport function i18nText(data) {\n if (!data) {\n return;\n }\n const language = i18n.language ?? \"zh-CN\";\n // First, make a perfect match.\n if (hasOwnProperty(data, language)) {\n return data[language];\n }\n // https://en.wikipedia.org/wiki/IETF_language_tag\n const primaryLanguage = language.split(\"-\")[0];\n if (primaryLanguage !== language) {\n // Then, match the primary language (which omits other subtags).\n // E.g., match `zh` if the current language is `zh-CN`.\n return hasOwnProperty(data, primaryLanguage) ? data[primaryLanguage] : undefined;\n }\n // At last, match the first key which starts with the primary language,\n // if the current language contains primary subtag only.\n // E.g., match `zh-CN` if the current language is `zh`.\n const prefix = `${primaryLanguage}-`;\n for (const key of Object.keys(data)) {\n if (key.startsWith(prefix)) {\n return data[key];\n }\n }\n}\n//# sourceMappingURL=text.js.map","import i18next from \"i18next\";\nexport const i18n = process.env.NODE_ENV === \"test\" ? i18next : /* istanbul ignore next */i18next.default;\nexport * from \"./init.js\";\nexport * from \"./text.js\";\n//# sourceMappingURL=index.js.map"],"names":["initialized","initializedNamespaces","Set","initializeI18n","NS","locales","i18n","use","init","fallbackLng","debug","supportedLngs","nonExplicitSupportedLngs","interpolation","escapeValue","react","useSuspense","compatibilityJSON","resources","has","add","lang","Object","entries","addResourceBundle","i18nText","data","language","hasOwnProperty","primaryLanguage","split","undefined","prefix","key","keys","startsWith"],"sourceRoot":""}
@@ -1,3 +1,3 @@
1
- /*! For license information please see 3233.7d668e53.js.LICENSE.txt */
2
- "use strict";(globalThis.webpackChunk_next_bricks_diagram=globalThis.webpackChunk_next_bricks_diagram||[]).push([[3233],{6671:(e,t,n)=>{n.d(t,{w:()=>s});var o=n(8769),a=n.n(o),i=n(3373),r=n.n(i),l=n(3739);function s(e){let{connectLineState:t,connectLineTo:n,markerPrefix:o}=e;return a().createElement("svg",{width:"100%",height:"100%",className:r()("connect-line",{connecting:!!t&&(n[0]-t.from[0])**2+(n[1]-t.from[1])**2>25})},a().createElement("defs",null,a().createElement(l.c,{type:"arrow",id:`${o}connect-line`,strokeColor:null==t?void 0:t.options.strokeColor})),a().createElement("path",{d:t?`M${t.from.join(" ")}L${n.join(" ")}`:"",fill:"none",stroke:null==t?void 0:t.options.strokeColor,strokeWidth:null==t?void 0:t.options.strokeWidth,markerEnd:null!=t&&t.options.arrow?`url(#${o}connect-line)`:void 0}))}},1803:(e,t,n)=>{n.d(t,{m:()=>l});var o=n(8769),a=n.n(o),i=n(3373),r=n.n(i);function l(e){var t,n;let{line:{line:o,edge:i,d:l,markers:s},linePaths:d,lineMaskRects:c,maskPrefix:u,markerPrefix:f,activeLineMarkerPrefix:p,active:m,activeRelated:h,onLineClick:g,onLineDoubleClick:v}=e;const y=c.has(o.$id)?`url(#${u}${o.$id})`:void 0,{strokeColor:k,strokeWidth:b,interactStrokeWidth:w}={...o,...m?null===(t=o.overrides)||void 0===t?void 0:t.active:h?null===(n=o.overrides)||void 0===n?void 0:n.activeRelated:null},x=m?"active":h?"active-related":"default";let M,R;for(const e of s)e.variant===x&&("start"===e.placement?M=`url(#${f}${e.index})`:R=`url(#${f}${e.index})`);return a().createElement("g",{className:r()("line",{interactable:o.interactable,active:m,"active-related":h}),onClick:o.interactable?()=>{null==g||g({id:o.$id,edge:i})}:void 0,onDoubleClick:o.interactable?e=>{e.preventDefault(),e.stopPropagation(),null==v||v({id:o.$id,edge:i})}:void 0,style:{cursor:o.cursor}},o.interactable&&a().createElement("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:w}),a().createElement("path",{ref:e=>d.set(o.$id,e),stroke:k,strokeWidth:b,d:l,fill:"none",markerStart:M,markerEnd:R,mask:y}),a().createElement("path",{stroke:"var(--palette-blue-3)",strokeWidth:b,d:l,fill:"none",className:"active-bg",markerStart:`url(#${p}start)`,markerEnd:`url(#${p}end)`,mask:y}))}},2547:(e,t,n)=>{n.d(t,{d2:()=>l});var o=n(8769),a=n.n(o),i=n(5068),r=n(7619);function l(e){let{labels:t,onRendered:n}=e;const[i,r]=(0,o.useState)(!1),[l,c]=(0,o.useState)([]),u=(0,o.useMemo)((()=>new Map),[]),f=(0,o.useCallback)(((e,t)=>{t&&u.set(e,t),c((t=>t.includes(e)?t:t.concat(e)))}),[u]),p=(0,o.useCallback)((e=>{c((t=>{const n=t.indexOf(e);return-1===n?t:t.slice(0,n).concat(t.slice(n+1))})),u.delete(e)}),[u]);return(0,o.useEffect)((()=>{r(!(null!=t&&t.some((e=>!l.includes(e.id)))))}),[t,l]),(0,o.useEffect)((()=>{null==n||n(i?u:null)}),[u,i]),a().createElement(a().Fragment,null,null==t?void 0:t.map((e=>{let{text:t,label:n,id:o,edge:i}=e;return n?a().createElement("div",{key:o,className:"line-label"},a().createElement(d,{id:o,edge:i,label:n,onRendered:f,onUnmount:p})):a().createElement(s,{key:o,id:o,text:t,onRendered:f})})))}function s(e){let{id:t,text:n,onRendered:i}=e;const r=(0,o.useCallback)((e=>{null==i||i(t,e)}),[t,i]);return a().createElement("div",{className:"line-label",ref:r,style:n.style},n.content)}function d(e){let{id:t,edge:n,label:l,onRendered:s,onUnmount:d}=e;const c=(0,o.useMemo)((()=>(0,r.checkIfByTransform)(l,{edge:n})?l.useBrick:null),[n,l]),u=(0,o.useMemo)((()=>({edge:n})),[n]);(0,o.useEffect)((()=>{c||setTimeout((()=>{null==s||s(t,null)}))}),[t,s,c]),(0,o.useEffect)((()=>()=>{null==d||d(t)}),[]);const f=(0,o.useCallback)((e=>{e&&setTimeout((()=>{null==s||s(t,e.parentElement)}))}),[t,s]),p=(0,o.useCallback)((()=>{setTimeout((()=>{null==s||s(t,null)}))}),[t,s]);return c?a().createElement(i.ReactUseBrick,{refCallback:f,ignoredCallback:p,useBrick:c,data:u}):null}},9191:(e,t,n)=>{n.d(t,{y:()=>i});var o=n(8769),a=n.n(o);function i(e){let{lineId:t,rects:n,maskPrefix:o,renderedLineLabels:i}=e;const r=i.find((e=>e.lineId===t&&"center"===e.placement));if(!r)return null;const{lineRect:l}=r,s=(c=1e3,{left:(d=l).left-c,top:d.top-c,width:d.width+2e3,height:d.height+2e3});var d,c;return a().createElement("mask",{id:`${o}${t}`,x:s.left,y:s.top,width:s.width,height:s.height},a().createElement("rect",{x:s.left,y:s.top,width:s.width,height:s.height,fill:"white"}),n.map(((e,t)=>a().createElement("rect",{key:t,x:e.left,y:e.top,width:e.width,height:e.height,fill:"black"}))))}},8892:(e,t,n)=>{n.d(t,{p:()=>l});var o=n(8769),a=n.n(o),i=n(5068),r=n(7619);function l(e){let{nodes:t,nodeBricks:n,onRendered:i}=e;const[r,l]=(0,o.useState)(!1),[d,c]=(0,o.useState)([]),u=(0,o.useMemo)((()=>new Map),[]),f=(0,o.useCallback)(((e,t)=>{t&&u.set(e,t),c((t=>t.includes(e)?t:t.concat(e)))}),[u]),p=(0,o.useCallback)((e=>{c((t=>{const n=t.indexOf(e);return-1===n?t:t.slice(0,n).concat(t.slice(n+1))})),u.delete(e)}),[u]);return(0,o.useEffect)((()=>{l(!(null!=t&&t.some((e=>!d.includes(e.id)))))}),[t,d]),(0,o.useEffect)((()=>{null==i||i(r?u:null)}),[u,r]),a().createElement(a().Fragment,null,null==t?void 0:t.map((e=>a().createElement("div",{key:e.id,className:"node"},a().createElement(s,{nodeBricks:n,node:e,onRendered:f,onUnmount:p})))))}function s(e){let{node:t,nodeBricks:n,onRendered:l,onUnmount:s}=e;const d=(0,o.useMemo)((()=>{var e;return null===(e=function(e,t){return null==t?void 0:t.find((t=>t.nodeType?[].concat(t.nodeType).includes(e.type):(0,r.checkIfByTransform)(t,{node:e})))}(t,n))||void 0===e?void 0:e.useBrick}),[t,n]),c=(0,o.useMemo)((()=>({node:t})),[t]);(0,o.useEffect)((()=>{d||setTimeout((()=>{null==l||l(t.id,null)}))}),[t.id,l,d]),(0,o.useEffect)((()=>()=>{null==s||s(t.id)}),[]);const u=(0,o.useCallback)((e=>{e&&setTimeout((()=>{null==l||l(t.id,e)}))}),[t.id,l]),f=(0,o.useCallback)((()=>{setTimeout((()=>{null==l||l(t.id,null)}))}),[t.id,l]);return d?a().createElement(i.ReactUseBrick,{refCallback:u,ignoredCallback:f,useBrick:d,data:c}):null}},8657:(e,t,n)=>{n.d(t,{Ie:()=>r,KP:()=>i,VO:()=>a,Yt:()=>s,mF:()=>o,sS:()=>l});const o="var(--palette-gray-5)",a=1,i="curveBasis",r=20,l=.5,s=2},8069:(e,t,n)=>{n.d(t,{o:()=>k});var o=n(8769),a=n(7586),i=n.n(a),r=n(1030);function l(e,t,n){for(const o of e){const e=t.get(o.id);o.width=Math.max((null==e?void 0:e.offsetWidth)??0,10)+n[1]+n[3],o.height=Math.max((null==e?void 0:e.offsetHeight)??0,10)+n[0]+n[2]}}function s(e,t,n){for(const a of e){var o;const e=a.x-a.width/2+n[3],i=a.y-a.height/2+n[0],r=null===(o=t.get(a.id))||void 0===o?void 0:o.parentElement;r&&(r.style.left=`${e}px`,r.style.top=`${i}px`,r.style.visibility="visible")}}var d=n(8802),c=n(6149),u=n(4842),f=n(1945),p=n(9418),m=n(3854),h=n(7931);function g(e,t){let{normalizedLinesMap:n,lineLabelsRefRepository:o}=t;return(null==e?void 0:e.map((e=>{const t=n.get(e),a={};if(t)for(const e of["start","end"]){const n=o.get(`${t}-${e}`);n&&(a[e]=[n.offsetWidth,n.offsetHeight])}return{data:e,labelSize:a}})))??[]}function v(e,t){return new Array(t).fill(null).map(((t,n)=>({dummy:!0,id:`$dummy-${e.source}-${e.target}-${n}`})))}function y(e,t){return new Array(t+1).fill(null).map(((n,o)=>({dummy:!0,source:0===o?e.source:`$dummy-${e.source}-${e.target}-${o-1}`,target:o===t?e.target:`$dummy-${e.source}-${e.target}-${o}`})))}function k(e){let{layout:t,nodes:n,edges:a,manualLayoutStatus:k,userViewReady:b,userViewNodesMap:w,nodeMovement:x,nodesRefRepository:M,lineLabelsRefRepository:R,normalizedLinesMap:E,nodesRenderId:L,lineLabelsRenderId:$,layoutOptions:C}=e;const P="initial"===k?t:"manual",[S,I]=(0,o.useState)(null),[T,N]=(0,o.useState)({nodes:[],edges:[]});return(0,o.useEffect)((()=>{b&&I((e=>"dagre"===P?function(e,t,n,o){const{nodePadding:a,...c}={nodePadding:0,rankdir:"TB",ranksep:50,edgesep:10,nodesep:50,...(0,r.pick)(o,["nodePadding","rankdir","ranksep","edgesep","nodesep","align"])},u=(0,d.D)(a),f=new(i().graphlib.Graph);f.setGraph(c),f.setDefaultEdgeLabel((function(){return{}}));for(const n of t??[]){const t=null==e?void 0:e.getNode(n.id);f.setNode(n.id,(null==t?void 0:t.data)===n?t:{id:n.id,data:n})}for(const e of n??[])f.setEdge(e.source,e.target,{data:e});return{layout:"dagre",getNode:e=>f.node(e),applyLayout(e){let{nodesRefRepository:t,lineLabelsRefRepository:n,normalizedLinesMap:o}=e;const a=[];for(const e of f.nodes()){const t=f.node(e);t?a.push(t):console.error("Diagram node not found: %s",e)}if(0===a.length)return null;l(a,t,u);const r=f.edges().map((e=>f.edge(e)));for(const e of r){const t=o.get(e.data);if(t)for(const o of["center","start","end"]){const a=n.get(`${t}-${o}`);if(a){const{offsetWidth:t,offsetHeight:n}=a;"center"===o&&(e.labelpos="c",e.width=t,e.height=n),e.labelSize??(e.labelSize={}),e.labelSize[o]=[t,n]}}}return i().layout(f),s(a,t,u),{nodes:a,edges:r}}}}(e,n,a,C):"force"===P?function(e,t,n,o,a){const{nodePadding:i,dummyNodesOnEdges:k,collide:b}={nodePadding:0,dummyNodesOnEdges:0,...(0,r.pick)(a,["nodePadding","dummyNodesOnEdges"]),collide:!1!==(null==a?void 0:a.collide)&&{dummyRadius:1,radiusDiff:5,strength:1,iterations:1,...!0===(null==a?void 0:a.collide)?null:null==a?void 0:a.collide}},w=(0,d.D)(i),x=[];for(const n of t??[]){const t=null==e?void 0:e.getNode(n.id);if((null==t?void 0:t.data)===n)x.push(t);else{const e={id:n.id,data:n},t=null==o?void 0:o.get(n.id);t&&(e.fx=t.x,e.fy=t.y),x.push(e)}}return{layout:"force",getNode:function(e){return x.find((t=>t.data.id===e))},applyLayout(e){let{nodesRefRepository:t,lineLabelsRefRepository:o,normalizedLinesMap:a}=e;if(0===x.length)return null;l(x,t,w);const i=x.slice(),r=[];for(const e of n??[])r.push({...e}),k>0&&(i.push(...v(e,k)),r.push(...y(e,k)));const d=(0,c.A)(r).id((e=>e.id));k>0&&d.distance((e=>e.dummy?30/(k+1):30)).strength((e=>e.dummy?.5:1));const M=(0,u.A)(i).force("link",d).force("x",(0,f.A)()).force("y",(0,p.A)()).force("charge",(0,m.A)());b&&M.force("collide",(0,h.A)().radius((e=>e.dummy?b.dummyRadius:Math.sqrt(e.width**2+e.height**2)/2+b.radiusDiff)).strength(b.strength).iterations(b.iterations)),M.stop(),function(e){e.tick(Math.ceil(Math.log(e.alphaMin())/Math.log(1-e.alphaDecay())))}(M),s(x,t,w);const R=g(n,{normalizedLinesMap:a,lineLabelsRefRepository:o});return{nodes:x,edges:R}}}}(e,n,a,w,C):"manual"===P?function(e,t,n,o){const{nodePadding:a}={nodePadding:0,...(0,r.pick)(o,["nodePadding"])},i=(0,d.D)(a),c=[];for(const n of t??[]){const t=null==e?void 0:e.getNode(n.id);(null==t?void 0:t.data)===n?(c.push(t),t.x0=t.x,t.y0=t.y):c.push({id:n.id,data:n})}let u;return{layout:"manual",getNode:function(e){return c.find((t=>t.data.id===e))},applyLayout(e){let{manualLayoutStatus:t,nodesRefRepository:o,lineLabelsRefRepository:a,normalizedLinesMap:r,nodeMovement:d}=e;if(0===c.length)return null;l(c,o,i),d&&(u=c.find((e=>e.id===d.id)),u&&(u.x=(u.x0??0)+d.move[0],u.y=(u.y0??0)+d.move[1])),"finished"===t&&u&&(u.x0=u.x,u.y0=u.y),s(c,o,i);const f=g(n,{normalizedLinesMap:r,lineLabelsRefRepository:a});return{nodes:c,edges:f}}}}(e,n,a,C):null))}),[a,n,P,C,b,w]),(0,o.useEffect)((()=>{if(!M||!R||P!==(null==S?void 0:S.layout))return;const e=null==S?void 0:S.applyLayout({manualLayoutStatus:k,nodesRefRepository:M,lineLabelsRefRepository:R,normalizedLinesMap:E,nodeMovement:x});e&&N(e)}),[P,k,S,x,M,R,L,$,E]),T}},6753:(e,t,n)=>{n.d(t,{_:()=>u});var o=n(8769),a=n(7619),i=n(6330),r=n(3496),l=function(){var e=(0,i.A)((function*(e,t,n){return(yield r.http.post("api/gateway/cmdb.instance.PostSearchV3/v3/object/".concat(e,"/instance/_search"),t,n)).data}));return function(t,n,o){return e.apply(this,arguments)}}(),s=function(){var e=(0,i.A)((function*(e,t,n,o){return(yield r.http.put("api/gateway/cmdb.instance.UpdateInstanceV2/v2/object/".concat(e,"/instance/").concat(t),n,o)).data}));return function(t,n,o,a){return e.apply(this,arguments)}}(),d=function(){var e=(0,i.A)((function*(e,t,n){return(yield r.http.post("api/gateway/cmdb.instance.CreateInstance/v2/object/".concat(e,"/instance"),t,n)).data}));return function(t,n,o){return e.apply(this,arguments)}}();const c="GRAPH_USER_VIEW@EASYOPS";function u(e){const[t,n]=(0,o.useState)(!e),i=(0,o.useRef)(),[r,u]=(0,o.useState)(null),f=(0,o.useMemo)((()=>function(){let e=!1;const t=[];return async function(n){if(t.push(n),!e){let n;for(e=!0;n=t.shift();)try{await n()}catch(e){console.error(e)}e=!1}}}()),[]);return(0,o.useEffect)((()=>{!async function(){if(!e)return void n(!0);const{namespace:t,key:o}=e;if(!t||!o)return console.error("Namespace and key are required to save graph user view"),void n(!0);try{const e=(await l(c,{fields:["nodes"],query:{namespace:{$eq:t},key:{$eq:o}},page:1,page_size:30})).list;if(e.length>0){var r;const t=e[0],n=new Map(null===(r=t.nodes)||void 0===r?void 0:r.map((e=>[e.id,e])));i.current=t.instanceId,u(n)}else u(null)}catch(e){(0,a.handleHttpError)(e)}finally{n(!0)}}()}),[e]),{userViewReady:t,userViewNodesMap:r,saveUserView:(0,o.useCallback)((t=>{const{namespace:n,key:o}=e??{};n&&o&&f((async()=>{const e={namespace:n,key:o,nodes:t};try{if(i.current)await s(c,i.current,e,{interceptorParams:{ignoreLoadingBar:!0}});else{const t=await d(c,e,{interceptorParams:{ignoreLoadingBar:!0}});i.current=t.instanceId}}catch(e){(0,a.handleHttpError)(e)}}))}),[e,f])}}},1324:(e,t,n)=>{function o(e,t){for(const{id:n,position:o,placement:a,angle:i,size:r}of e){const e=t.get(n);if(e&&(e.style.left=`${o[0]}px`,e.style.top=`${o[1]}px`,e.style.visibility="visible","center"!==a&&void 0!==i)){const[t,n]=r??[0,0],o=Math.floor((i<0?2*Math.PI+i:i)/Math.PI*4),l="start"===a?o:(o+4)%8,s=Math.tan(i),d=i+("start"===a?1:-1)*Math.PI/2,c=2,u=Math.sin(d)*c,f=Math.cos(d)*c;let p;switch(l){case 0:p=`translate(0,${t*s+u}px)`;break;case 1:p=`translate(${n/s-f}px,0)`;break;case 2:p=`translate(calc(${n/s+f}px - 100%),0)`;break;case 3:p=`translate(-100%,${-t*s-u}px)`;break;case 4:p=`translate(-100%,calc(${-t*s+u}px - 100%))`;break;case 5:p=`translate(calc(${-n/s-f}px - 100%),-100%)`;break;case 6:p=`translate(${-n/s+f}px,-100%)`;break;default:p=`translate(0,calc(${t*s-u}px - 100%))`}e.style.transform=p}}}n.d(t,{F:()=>o})},5987:(e,t,n)=>{function o(e,t){const n=new Map;for(const{id:o,lineId:a,placement:i}of e){if(!t||"center"!==i)continue;const e=t.get(o);if(!e)continue;const{offsetWidth:r,offsetHeight:l}=e;if(0===r||0===l)continue;const s=3;n.set(a,[{left:e.offsetLeft-r/2-s,top:e.offsetTop-l/2-s,width:r+2*s,height:l+2*s}])}return n}n.d(t,{G:()=>o})},8060:(e,t,n)=>{function o(e,t,n){return 0===e.length&&0===t.length?e:t.flatMap((e=>{let{line:{text:t,label:o,$id:a},edge:i,labelSize:r,angle:l}=e;const s=n.get(a);if(!t&&!o||!s||!s.getAttribute("d"))return[];let d,c;o?(d="label",c=[].concat(o)):(d="text",c=[].concat(t));const{x:u,y:f,width:p,height:m}=s.getBBox(),h=s.getTotalLength();return c.map((e=>{const t=e.placement??"center",n=s.getPointAtLength("start"===t?Math.min(0,h/2):"end"===t?Math.max(h-0,h/2):h/2);return{[d]:e,edge:i,position:[n.x,n.y],lineRect:{left:u,top:f,width:p,height:m},id:`${a}-${t}`,lineId:a,placement:t,angle:l,size:null==r?void 0:r[t]}}))}))}n.d(t,{z:()=>o})},1518:(e,t,n)=>{n.d(t,{R:()=>l});var o=n(8653),a=n(3188),i=n(4059),r=n(733);function l(e,t,n){const l=new WeakMap,c=new Map,u=new Map;for(const e of t)c.set(e.id,e);for(const t of e){const{data:e}=t;l.set(e,t)}let f=!1;return n.map((t=>{var n,p;let{line:m,edge:h,markers:g,...v}=t;const y=l.get(h);if(!y)return;const k=(null===(n=g.find((e=>"default"===e.variant&&"start"===e.placement)))||void 0===n?void 0:n.offset)??0,b=(null===(p=g.find((e=>"default"===e.variant&&"end"===e.placement)))||void 0===p?void 0:p.offset)??0;let w,{points:x}=y;if(!x){const t=c.get(h.source),n=c.get(h.target);if(t&&n&&t!==n){if("polyline"===m.type){if(!(0,r.w)(t,n,k,b)){(()=>{if(f)return;f=!0;const t=(e,t)=>{let n=u.get(e);n||u.set(e,n=new Set);const o=c.get(t);o&&n.add(o)};for(const{data:{source:n,target:o}}of e)n!==o&&(t(n,o),t(o,n))})();const o=s(t,n,k),a=s(n,t,b),r=d(u.get(h.source)??[],t,o,k),l=d(u.get(h.target)??[],n,a,b),p=(r.indexOf(n)+1)/(r.length+1),m=(l.indexOf(t)+1)/(l.length+1);x=(0,i.o)(t,n,o,a,p,m)}}else x=(0,a.h)(t,n);if(x){const e=x[0],t=x[x.length-1];w=Math.atan2(t.y-e.y,t.x-e.x)}}}return{...v,markers:g,line:m,edge:h,d:(0,o.S)(x,m.curveType,k,b),angle:w,labelSize:y.labelSize}})).filter(Boolean)}function s(e,t,n){const o=Math.atan2(e.height+2*n,e.width+2*n),{x:a,y:i}=e,{x:r,y:l}=t,s=Math.atan2(l-i,r-a),d=s<0?2*Math.PI+s:s;switch(Math.floor(d/Math.PI*2)){case 0:return d<o?"right":"bottom";case 1:return d<Math.PI-o?"bottom":"left";case 2:return d<Math.PI+o?"left":"top";default:return d<2*Math.PI-o?"top":"right"}}function d(e,t,n,o){return[...e].filter((e=>s(t,e,o)===n)).sort(((e,t)=>{const{x:o,y:a}=e,{x:i,y:r}=t;return"top"===n||"bottom"===n?o-i:a-r}))}},5157:(e,t,n)=>{n.d(t,{a:()=>a});var o=n(1030);function a(e,t){let{renderedNodes:n,activeTarget:o}=t;const a="node"===(null==o?void 0:o.type)?n.find((e=>e.id===o.nodeId)):void 0,r="edge"===(null==o?void 0:o.type)?o.edge:void 0;if(!a&&!r)return;const l=e.key||e.keyCode||e.which;let s,d,c;switch(l){case"Backspace":case 8:case"Delete":case 46:a?(s="delete-node",d=a):(s="delete-edge",c=r);break;default:if(!a)return;switch(l){case"ArrowLeft":case 37:d=i("x",n,a,-1),s="switch-active-node";break;case"ArrowUp":case 38:d=i("y",n,a,-1),s="switch-active-node";break;case"ArrowRight":case 39:d=i("x",n,a,1),s="switch-active-node";break;case"ArrowDown":case 40:d=i("y",n,a,1),s="switch-active-node"}}var u;return s?(e.preventDefault(),e.stopPropagation(),{action:s,node:null===(u=d)||void 0===u?void 0:u.data,edge:c}):void 0}function i(e,t,n,a){const i="x"===e?"y":"x";let r;const l=t.filter((t=>t!==n&&(r=(t[e]-n[e])*a,r>0)&&r>Math.abs(n[i]-t[i])));return(0,o.minBy)(l,(t=>(n[i]-t[i])**2+(n[e]-t[e])**2))}},2448:(e,t,n)=>{n.d(t,{P:()=>i});var o=n(7619),a=n(8657);function i(e,t){let{nodes:n,nodesRefRepository:i,connectNodes:r,dragNodes:l,scale:s,setConnectLineState:d,setConnectLineTo:c,setManualLayoutStatus:u,setNodeMovement:f,onSwitchActiveTarget:p,onNodesConnect:m}=t;function h(e){if(i)for(const[t,o]of i)if(e(o))return null==n?void 0:n.find((e=>e.id===t))}if(!r&&!l)return;const g=h((t=>t.contains(e.target)));if(!g)return;if(!function(e,t){return e.sourceType?[].concat(e.sourceType).includes(t.type):(0,o.checkIfByTransform)(e,{source:t})}(r||l,g))return;e.stopPropagation();const v=[e.clientX,e.clientY];if(r){d({from:v,options:{strokeColor:a.mF,strokeWidth:a.VO,...o.__secret_internals.legacyDoTransform({source:g},r)}}),c(v),null==p||p({type:"node",nodeId:g.id});const e=e=>{c([e.clientX,e.clientY])},t=n=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t),d(null);const o=n.composedPath(),a=h((e=>o.includes(e)));a&&g!==a&&(null==m||m({source:g,target:a}))};return document.addEventListener("mousemove",e),void document.addEventListener("mouseup",t)}null==p||p({type:"node",nodeId:g.id});let y=!1;const k=e=>{const t=[(e.clientX-v[0])/s,(e.clientY-v[1])/s];y||(y=t[0]**2+t[1]**2>=9,y&&u("started")),y&&f({id:g.id,move:t})},b=()=>{y=!1,document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",b),f(null),u("finished")};document.addEventListener("mousemove",k),document.addEventListener("mouseup",b)}},9137:(e,t,n)=>{n.d(t,{t:()=>l});var o=n(1030),a=n(7619);function i(e,t){return!!t&&(t.edgeType?[].concat(t.edgeType).includes(e.type):(0,a.checkIfByTransform)(t,{edge:e}))}var r=n(8657);function l(e,t){const n=[],l=new WeakMap,d=[];for(const f of e??[]){const{label:e,...p}=(null==t?void 0:t.find((e=>i(f,e))))??{},m=a.__secret_internals.legacyDoTransform({edge:f},p);if(!1===(null==m?void 0:m.draw))continue;const h=(0,o.uniqueId)("line-"),g={strokeColor:r.mF,strokeWidth:r.VO,curveType:"polyline"===(null==m?void 0:m.type)?"curveLinear":r.KP,interactStrokeWidth:r.Ie,type:"auto",...m,label:e,$id:h};l.set(f,h);const v=[],y=g.markers??(g.arrow?[{placement:"end",type:"arrow"}]:[]);for(const e of y){var c,u;const{placement:t,type:n}=e,o=t??"end";let a,i;switch(n){case"0..1":case"0..N":i=21,a=n;break;default:i=1,a="arrow"}const r=i*g.strokeWidth,l=s({type:a,strokeColor:g.strokeColor},d);v.push({index:l,placement:o,type:a,variant:"default",offset:r});const f=s({type:a,strokeColor:(null===(c=g.overrides)||void 0===c||null===(c=c.active)||void 0===c?void 0:c.strokeColor)??g.strokeColor},d);v.push({index:f,placement:o,type:a,variant:"active",offset:r});const p=s({type:a,strokeColor:(null===(u=g.overrides)||void 0===u||null===(u=u.activeRelated)||void 0===u?void 0:u.strokeColor)??g.strokeColor},d);v.push({index:p,placement:o,type:a,variant:"active-related",offset:r})}n.push({line:g,markers:v,edge:f})}return{normalizedLines:n,normalizedLinesMap:l,markers:d}}function s(e,t){let n=(0,o.findIndex)(t,e);return-1===n&&(n=t.push(e)-1),n}},2673:(e,t,n)=>{function o(e,t){return e?!!t&&e.type===t.type&&("node"===e.type?e.nodeId===t.nodeId:e.edge.source===t.edge.source&&e.edge.target===t.edge.target):!t}n.d(t,{c:()=>o})},8308:(e,t,n)=>{function o(e,t){let{canvasWidth:n,canvasHeight:o,scaleRange:a}=t,i=1/0,r=1/0,l=-1/0,s=-1/0;for(const t of e){const e=t.width/2,n=t.height/2,o=t.x-e,a=t.x+e,d=t.y-n,c=t.y+n;o<i&&(i=o),a>l&&(l=a),d<r&&(r=d),c>s&&(s=c)}const d=l-i,c=s-r,u=a&&(d>n||c>o)?Math.max(Math.min(n/d,o/c,a[1]),a[0]):1;return{x:(n-d*u)/2-i*u,y:(o-c*u)/2-r*u,k:u}}n.d(t,{r:()=>o})},821:(e,t,n)=>{n.d(t,{A:()=>l});var o=n(6758),a=n.n(o),i=n(935),r=n.n(i)()(a());r.push([e.id,":host{display:block;width:100%;height:100%;overflow:hidden}:host([hidden]){display:none}*{box-sizing:border-box}.diagram{width:100%;height:100%;position:relative;opacity:0}.diagram:focus{outline:none}.lines,\n.line-labels,\n.nodes{position:absolute;top:0;left:0}.line-labels{opacity:0}.ready{opacity:1}.diagram.ready.pannable{cursor:grab}.diagram.pannable.grabbing{cursor:grabbing}.nodes,\n.lines{transform-origin:0 0}.node,\n.line-label{position:absolute;visibility:hidden}.line-label{transform:translate(-50%,-50%);white-space:pre-line;width:max-content;text-align:center;line-height:1}.lines{pointer-events:none}.line.interactable{pointer-events:auto;cursor:default}.connect-line{position:fixed;top:0;left:0;right:0;bottom:0;pointer-events:none}.connect-line:not(.connecting){display:none}.line:not(.active) .active-bg{display:none}",""]);const l=r.toString()}}]);
3
- //# sourceMappingURL=3233.7d668e53.js.map
1
+ /*! For license information please see 3233.19da547d.js.LICENSE.txt */
2
+ "use strict";(globalThis.webpackChunk_next_bricks_diagram=globalThis.webpackChunk_next_bricks_diagram||[]).push([[3233],{6671:(e,t,n)=>{n.d(t,{w:()=>s});var o=n(8769),a=n.n(o),i=n(3373),r=n.n(i),l=n(3739);function s(e){let{connectLineState:t,connectLineTo:n,markerPrefix:o}=e;return a().createElement("svg",{width:"100%",height:"100%",className:r()("connect-line",{connecting:!!t&&(n[0]-t.from[0])**2+(n[1]-t.from[1])**2>25})},a().createElement("defs",null,a().createElement(l.c,{type:"arrow",id:`${o}connect-line`,strokeColor:null==t?void 0:t.options.strokeColor})),a().createElement("path",{d:t?`M${t.from.join(" ")}L${n.join(" ")}`:"",fill:"none",stroke:null==t?void 0:t.options.strokeColor,strokeWidth:null==t?void 0:t.options.strokeWidth,markerEnd:null!=t&&t.options.arrow?`url(#${o}connect-line)`:void 0}))}},1803:(e,t,n)=>{n.d(t,{m:()=>l});var o=n(8769),a=n.n(o),i=n(3373),r=n.n(i);function l(e){var t,n;let{line:{line:o,edge:i,d:l,markers:s},linePaths:d,lineMaskRects:c,maskPrefix:u,markerPrefix:f,activeLineMarkerPrefix:p,active:m,activeRelated:h,onLineClick:g,onLineDoubleClick:v}=e;const y=c.has(o.$id)?`url(#${u}${o.$id})`:void 0,{strokeColor:k,strokeWidth:b,interactStrokeWidth:w}={...o,...m?null===(t=o.overrides)||void 0===t?void 0:t.active:h?null===(n=o.overrides)||void 0===n?void 0:n.activeRelated:null},x=m?"active":h?"active-related":"default";let M,R;for(const e of s)e.variant===x&&("start"===e.placement?M=`url(#${f}${e.index})`:R=`url(#${f}${e.index})`);return a().createElement("g",{className:r()("line",{interactable:o.interactable,active:m,"active-related":h}),onClick:o.interactable?()=>{null==g||g({id:o.$id,edge:i})}:void 0,onDoubleClick:o.interactable?e=>{e.preventDefault(),e.stopPropagation(),null==v||v({id:o.$id,edge:i})}:void 0,style:{cursor:o.cursor}},o.interactable&&a().createElement("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:w}),a().createElement("path",{ref:e=>d.set(o.$id,e),stroke:k,strokeWidth:b,d:l,fill:"none",markerStart:M,markerEnd:R,mask:y}),a().createElement("path",{stroke:"var(--palette-blue-3)",strokeWidth:b,d:l,fill:"none",className:"active-bg",markerStart:`url(#${p}start)`,markerEnd:`url(#${p}end)`,mask:y}))}},2547:(e,t,n)=>{n.d(t,{d2:()=>l});var o=n(8769),a=n.n(o),i=n(9592),r=n(5223);function l(e){let{labels:t,onRendered:n}=e;const[i,r]=(0,o.useState)(!1),[l,c]=(0,o.useState)([]),u=(0,o.useMemo)((()=>new Map),[]),f=(0,o.useCallback)(((e,t)=>{t&&u.set(e,t),c((t=>t.includes(e)?t:t.concat(e)))}),[u]),p=(0,o.useCallback)((e=>{c((t=>{const n=t.indexOf(e);return-1===n?t:t.slice(0,n).concat(t.slice(n+1))})),u.delete(e)}),[u]);return(0,o.useEffect)((()=>{r(!(null!=t&&t.some((e=>!l.includes(e.id)))))}),[t,l]),(0,o.useEffect)((()=>{null==n||n(i?u:null)}),[u,i]),a().createElement(a().Fragment,null,null==t?void 0:t.map((e=>{let{text:t,label:n,id:o,edge:i}=e;return n?a().createElement("div",{key:o,className:"line-label"},a().createElement(d,{id:o,edge:i,label:n,onRendered:f,onUnmount:p})):a().createElement(s,{key:o,id:o,text:t,onRendered:f})})))}function s(e){let{id:t,text:n,onRendered:i}=e;const r=(0,o.useCallback)((e=>{null==i||i(t,e)}),[t,i]);return a().createElement("div",{className:"line-label",ref:r,style:n.style},n.content)}function d(e){let{id:t,edge:n,label:l,onRendered:s,onUnmount:d}=e;const c=(0,o.useMemo)((()=>(0,r.checkIfByTransform)(l,{edge:n})?l.useBrick:null),[n,l]),u=(0,o.useMemo)((()=>({edge:n})),[n]);(0,o.useEffect)((()=>{c||setTimeout((()=>{null==s||s(t,null)}))}),[t,s,c]),(0,o.useEffect)((()=>()=>{null==d||d(t)}),[]);const f=(0,o.useCallback)((e=>{e&&setTimeout((()=>{null==s||s(t,e.parentElement)}))}),[t,s]),p=(0,o.useCallback)((()=>{setTimeout((()=>{null==s||s(t,null)}))}),[t,s]);return c?a().createElement(i.ReactUseBrick,{refCallback:f,ignoredCallback:p,useBrick:c,data:u}):null}},9191:(e,t,n)=>{n.d(t,{y:()=>i});var o=n(8769),a=n.n(o);function i(e){let{lineId:t,rects:n,maskPrefix:o,renderedLineLabels:i}=e;const r=i.find((e=>e.lineId===t&&"center"===e.placement));if(!r)return null;const{lineRect:l}=r,s=(c=1e3,{left:(d=l).left-c,top:d.top-c,width:d.width+2e3,height:d.height+2e3});var d,c;return a().createElement("mask",{id:`${o}${t}`,x:s.left,y:s.top,width:s.width,height:s.height},a().createElement("rect",{x:s.left,y:s.top,width:s.width,height:s.height,fill:"white"}),n.map(((e,t)=>a().createElement("rect",{key:t,x:e.left,y:e.top,width:e.width,height:e.height,fill:"black"}))))}},8892:(e,t,n)=>{n.d(t,{p:()=>l});var o=n(8769),a=n.n(o),i=n(9592),r=n(5223);function l(e){let{nodes:t,nodeBricks:n,onRendered:i}=e;const[r,l]=(0,o.useState)(!1),[d,c]=(0,o.useState)([]),u=(0,o.useMemo)((()=>new Map),[]),f=(0,o.useCallback)(((e,t)=>{t&&u.set(e,t),c((t=>t.includes(e)?t:t.concat(e)))}),[u]),p=(0,o.useCallback)((e=>{c((t=>{const n=t.indexOf(e);return-1===n?t:t.slice(0,n).concat(t.slice(n+1))})),u.delete(e)}),[u]);return(0,o.useEffect)((()=>{l(!(null!=t&&t.some((e=>!d.includes(e.id)))))}),[t,d]),(0,o.useEffect)((()=>{null==i||i(r?u:null)}),[u,r]),a().createElement(a().Fragment,null,null==t?void 0:t.map((e=>a().createElement("div",{key:e.id,className:"node"},a().createElement(s,{nodeBricks:n,node:e,onRendered:f,onUnmount:p})))))}function s(e){let{node:t,nodeBricks:n,onRendered:l,onUnmount:s}=e;const d=(0,o.useMemo)((()=>{var e;return null===(e=function(e,t){return null==t?void 0:t.find((t=>t.nodeType?[].concat(t.nodeType).includes(e.type):(0,r.checkIfByTransform)(t,{node:e})))}(t,n))||void 0===e?void 0:e.useBrick}),[t,n]),c=(0,o.useMemo)((()=>({node:t})),[t]);(0,o.useEffect)((()=>{d||setTimeout((()=>{null==l||l(t.id,null)}))}),[t.id,l,d]),(0,o.useEffect)((()=>()=>{null==s||s(t.id)}),[]);const u=(0,o.useCallback)((e=>{e&&setTimeout((()=>{null==l||l(t.id,e)}))}),[t.id,l]),f=(0,o.useCallback)((()=>{setTimeout((()=>{null==l||l(t.id,null)}))}),[t.id,l]);return d?a().createElement(i.ReactUseBrick,{refCallback:u,ignoredCallback:f,useBrick:d,data:c}):null}},8657:(e,t,n)=>{n.d(t,{Ie:()=>r,KP:()=>i,VO:()=>a,Yt:()=>s,mF:()=>o,sS:()=>l});const o="var(--palette-gray-5)",a=1,i="curveBasis",r=20,l=.5,s=2},8069:(e,t,n)=>{n.d(t,{o:()=>k});var o=n(8769),a=n(7586),i=n.n(a),r=n(1030);function l(e,t,n){for(const o of e){const e=t.get(o.id);o.width=Math.max((null==e?void 0:e.offsetWidth)??0,10)+n[1]+n[3],o.height=Math.max((null==e?void 0:e.offsetHeight)??0,10)+n[0]+n[2]}}function s(e,t,n){for(const a of e){var o;const e=a.x-a.width/2+n[3],i=a.y-a.height/2+n[0],r=null===(o=t.get(a.id))||void 0===o?void 0:o.parentElement;r&&(r.style.left=`${e}px`,r.style.top=`${i}px`,r.style.visibility="visible")}}var d=n(8802),c=n(6149),u=n(4842),f=n(1945),p=n(9418),m=n(3854),h=n(7931);function g(e,t){let{normalizedLinesMap:n,lineLabelsRefRepository:o}=t;return(null==e?void 0:e.map((e=>{const t=n.get(e),a={};if(t)for(const e of["start","end"]){const n=o.get(`${t}-${e}`);n&&(a[e]=[n.offsetWidth,n.offsetHeight])}return{data:e,labelSize:a}})))??[]}function v(e,t){return new Array(t).fill(null).map(((t,n)=>({dummy:!0,id:`$dummy-${e.source}-${e.target}-${n}`})))}function y(e,t){return new Array(t+1).fill(null).map(((n,o)=>({dummy:!0,source:0===o?e.source:`$dummy-${e.source}-${e.target}-${o-1}`,target:o===t?e.target:`$dummy-${e.source}-${e.target}-${o}`})))}function k(e){let{layout:t,nodes:n,edges:a,manualLayoutStatus:k,userViewReady:b,userViewNodesMap:w,nodeMovement:x,nodesRefRepository:M,lineLabelsRefRepository:R,normalizedLinesMap:E,nodesRenderId:L,lineLabelsRenderId:$,layoutOptions:C}=e;const P="initial"===k?t:"manual",[S,I]=(0,o.useState)(null),[T,N]=(0,o.useState)({nodes:[],edges:[]});return(0,o.useEffect)((()=>{b&&I((e=>"dagre"===P?function(e,t,n,o){const{nodePadding:a,...c}={nodePadding:0,rankdir:"TB",ranksep:50,edgesep:10,nodesep:50,...(0,r.pick)(o,["nodePadding","rankdir","ranksep","edgesep","nodesep","align"])},u=(0,d.D)(a),f=new(i().graphlib.Graph);f.setGraph(c),f.setDefaultEdgeLabel((function(){return{}}));for(const n of t??[]){const t=null==e?void 0:e.getNode(n.id);f.setNode(n.id,(null==t?void 0:t.data)===n?t:{id:n.id,data:n})}for(const e of n??[])f.setEdge(e.source,e.target,{data:e});return{layout:"dagre",getNode:e=>f.node(e),applyLayout(e){let{nodesRefRepository:t,lineLabelsRefRepository:n,normalizedLinesMap:o}=e;const a=[];for(const e of f.nodes()){const t=f.node(e);t?a.push(t):console.error("Diagram node not found: %s",e)}if(0===a.length)return null;l(a,t,u);const r=f.edges().map((e=>f.edge(e)));for(const e of r){const t=o.get(e.data);if(t)for(const o of["center","start","end"]){const a=n.get(`${t}-${o}`);if(a){const{offsetWidth:t,offsetHeight:n}=a;"center"===o&&(e.labelpos="c",e.width=t,e.height=n),e.labelSize??(e.labelSize={}),e.labelSize[o]=[t,n]}}}return i().layout(f),s(a,t,u),{nodes:a,edges:r}}}}(e,n,a,C):"force"===P?function(e,t,n,o,a){const{nodePadding:i,dummyNodesOnEdges:k,collide:b}={nodePadding:0,dummyNodesOnEdges:0,...(0,r.pick)(a,["nodePadding","dummyNodesOnEdges"]),collide:!1!==(null==a?void 0:a.collide)&&{dummyRadius:1,radiusDiff:5,strength:1,iterations:1,...!0===(null==a?void 0:a.collide)?null:null==a?void 0:a.collide}},w=(0,d.D)(i),x=[];for(const n of t??[]){const t=null==e?void 0:e.getNode(n.id);if((null==t?void 0:t.data)===n)x.push(t);else{const e={id:n.id,data:n},t=null==o?void 0:o.get(n.id);t&&(e.fx=t.x,e.fy=t.y),x.push(e)}}return{layout:"force",getNode:function(e){return x.find((t=>t.data.id===e))},applyLayout(e){let{nodesRefRepository:t,lineLabelsRefRepository:o,normalizedLinesMap:a}=e;if(0===x.length)return null;l(x,t,w);const i=x.slice(),r=[];for(const e of n??[])r.push({...e}),k>0&&(i.push(...v(e,k)),r.push(...y(e,k)));const d=(0,c.A)(r).id((e=>e.id));k>0&&d.distance((e=>e.dummy?30/(k+1):30)).strength((e=>e.dummy?.5:1));const M=(0,u.A)(i).force("link",d).force("x",(0,f.A)()).force("y",(0,p.A)()).force("charge",(0,m.A)());b&&M.force("collide",(0,h.A)().radius((e=>e.dummy?b.dummyRadius:Math.sqrt(e.width**2+e.height**2)/2+b.radiusDiff)).strength(b.strength).iterations(b.iterations)),M.stop(),function(e){e.tick(Math.ceil(Math.log(e.alphaMin())/Math.log(1-e.alphaDecay())))}(M),s(x,t,w);const R=g(n,{normalizedLinesMap:a,lineLabelsRefRepository:o});return{nodes:x,edges:R}}}}(e,n,a,w,C):"manual"===P?function(e,t,n,o){const{nodePadding:a}={nodePadding:0,...(0,r.pick)(o,["nodePadding"])},i=(0,d.D)(a),c=[];for(const n of t??[]){const t=null==e?void 0:e.getNode(n.id);(null==t?void 0:t.data)===n?(c.push(t),t.x0=t.x,t.y0=t.y):c.push({id:n.id,data:n})}let u;return{layout:"manual",getNode:function(e){return c.find((t=>t.data.id===e))},applyLayout(e){let{manualLayoutStatus:t,nodesRefRepository:o,lineLabelsRefRepository:a,normalizedLinesMap:r,nodeMovement:d}=e;if(0===c.length)return null;l(c,o,i),d&&(u=c.find((e=>e.id===d.id)),u&&(u.x=(u.x0??0)+d.move[0],u.y=(u.y0??0)+d.move[1])),"finished"===t&&u&&(u.x0=u.x,u.y0=u.y),s(c,o,i);const f=g(n,{normalizedLinesMap:r,lineLabelsRefRepository:a});return{nodes:c,edges:f}}}}(e,n,a,C):null))}),[a,n,P,C,b,w]),(0,o.useEffect)((()=>{if(!M||!R||P!==(null==S?void 0:S.layout))return;const e=null==S?void 0:S.applyLayout({manualLayoutStatus:k,nodesRefRepository:M,lineLabelsRefRepository:R,normalizedLinesMap:E,nodeMovement:x});e&&N(e)}),[P,k,S,x,M,R,L,$,E]),T}},6753:(e,t,n)=>{n.d(t,{_:()=>u});var o=n(8769),a=n(5223),i=n(6330),r=n(3496),l=function(){var e=(0,i.A)((function*(e,t,n){return(yield r.http.post("api/gateway/cmdb.instance.PostSearchV3/v3/object/".concat(e,"/instance/_search"),t,n)).data}));return function(t,n,o){return e.apply(this,arguments)}}(),s=function(){var e=(0,i.A)((function*(e,t,n,o){return(yield r.http.put("api/gateway/cmdb.instance.UpdateInstanceV2/v2/object/".concat(e,"/instance/").concat(t),n,o)).data}));return function(t,n,o,a){return e.apply(this,arguments)}}(),d=function(){var e=(0,i.A)((function*(e,t,n){return(yield r.http.post("api/gateway/cmdb.instance.CreateInstance/v2/object/".concat(e,"/instance"),t,n)).data}));return function(t,n,o){return e.apply(this,arguments)}}();const c="GRAPH_USER_VIEW@EASYOPS";function u(e){const[t,n]=(0,o.useState)(!e),i=(0,o.useRef)(),[r,u]=(0,o.useState)(null),f=(0,o.useMemo)((()=>function(){let e=!1;const t=[];return async function(n){if(t.push(n),!e){let n;for(e=!0;n=t.shift();)try{await n()}catch(e){console.error(e)}e=!1}}}()),[]);return(0,o.useEffect)((()=>{!async function(){if(!e)return void n(!0);const{namespace:t,key:o}=e;if(!t||!o)return console.error("Namespace and key are required to save graph user view"),void n(!0);try{const e=(await l(c,{fields:["nodes"],query:{namespace:{$eq:t},key:{$eq:o}},page:1,page_size:30})).list;if(e.length>0){var r;const t=e[0],n=new Map(null===(r=t.nodes)||void 0===r?void 0:r.map((e=>[e.id,e])));i.current=t.instanceId,u(n)}else u(null)}catch(e){(0,a.handleHttpError)(e)}finally{n(!0)}}()}),[e]),{userViewReady:t,userViewNodesMap:r,saveUserView:(0,o.useCallback)((t=>{const{namespace:n,key:o}=e??{};n&&o&&f((async()=>{const e={namespace:n,key:o,nodes:t};try{if(i.current)await s(c,i.current,e,{interceptorParams:{ignoreLoadingBar:!0}});else{const t=await d(c,e,{interceptorParams:{ignoreLoadingBar:!0}});i.current=t.instanceId}}catch(e){(0,a.handleHttpError)(e)}}))}),[e,f])}}},1324:(e,t,n)=>{function o(e,t){for(const{id:n,position:o,placement:a,angle:i,size:r}of e){const e=t.get(n);if(e&&(e.style.left=`${o[0]}px`,e.style.top=`${o[1]}px`,e.style.visibility="visible","center"!==a&&void 0!==i)){const[t,n]=r??[0,0],o=Math.floor((i<0?2*Math.PI+i:i)/Math.PI*4),l="start"===a?o:(o+4)%8,s=Math.tan(i),d=i+("start"===a?1:-1)*Math.PI/2,c=2,u=Math.sin(d)*c,f=Math.cos(d)*c;let p;switch(l){case 0:p=`translate(0,${t*s+u}px)`;break;case 1:p=`translate(${n/s-f}px,0)`;break;case 2:p=`translate(calc(${n/s+f}px - 100%),0)`;break;case 3:p=`translate(-100%,${-t*s-u}px)`;break;case 4:p=`translate(-100%,calc(${-t*s+u}px - 100%))`;break;case 5:p=`translate(calc(${-n/s-f}px - 100%),-100%)`;break;case 6:p=`translate(${-n/s+f}px,-100%)`;break;default:p=`translate(0,calc(${t*s-u}px - 100%))`}e.style.transform=p}}}n.d(t,{F:()=>o})},5987:(e,t,n)=>{function o(e,t){const n=new Map;for(const{id:o,lineId:a,placement:i}of e){if(!t||"center"!==i)continue;const e=t.get(o);if(!e)continue;const{offsetWidth:r,offsetHeight:l}=e;if(0===r||0===l)continue;const s=3;n.set(a,[{left:e.offsetLeft-r/2-s,top:e.offsetTop-l/2-s,width:r+2*s,height:l+2*s}])}return n}n.d(t,{G:()=>o})},8060:(e,t,n)=>{function o(e,t,n){return 0===e.length&&0===t.length?e:t.flatMap((e=>{let{line:{text:t,label:o,$id:a},edge:i,labelSize:r,angle:l}=e;const s=n.get(a);if(!t&&!o||!s||!s.getAttribute("d"))return[];let d,c;o?(d="label",c=[].concat(o)):(d="text",c=[].concat(t));const{x:u,y:f,width:p,height:m}=s.getBBox(),h=s.getTotalLength();return c.map((e=>{const t=e.placement??"center",n=s.getPointAtLength("start"===t?Math.min(0,h/2):"end"===t?Math.max(h-0,h/2):h/2);return{[d]:e,edge:i,position:[n.x,n.y],lineRect:{left:u,top:f,width:p,height:m},id:`${a}-${t}`,lineId:a,placement:t,angle:l,size:null==r?void 0:r[t]}}))}))}n.d(t,{z:()=>o})},1518:(e,t,n)=>{n.d(t,{R:()=>l});var o=n(8653),a=n(3188),i=n(4059),r=n(733);function l(e,t,n){const l=new WeakMap,c=new Map,u=new Map;for(const e of t)c.set(e.id,e);for(const t of e){const{data:e}=t;l.set(e,t)}let f=!1;return n.map((t=>{var n,p;let{line:m,edge:h,markers:g,...v}=t;const y=l.get(h);if(!y)return;const k=(null===(n=g.find((e=>"default"===e.variant&&"start"===e.placement)))||void 0===n?void 0:n.offset)??0,b=(null===(p=g.find((e=>"default"===e.variant&&"end"===e.placement)))||void 0===p?void 0:p.offset)??0;let w,{points:x}=y;if(!x){const t=c.get(h.source),n=c.get(h.target);if(t&&n&&t!==n){if("polyline"===m.type){if(!(0,r.w)(t,n,k,b)){(()=>{if(f)return;f=!0;const t=(e,t)=>{let n=u.get(e);n||u.set(e,n=new Set);const o=c.get(t);o&&n.add(o)};for(const{data:{source:n,target:o}}of e)n!==o&&(t(n,o),t(o,n))})();const o=s(t,n,k),a=s(n,t,b),r=d(u.get(h.source)??[],t,o,k),l=d(u.get(h.target)??[],n,a,b),p=(r.indexOf(n)+1)/(r.length+1),m=(l.indexOf(t)+1)/(l.length+1);x=(0,i.o)(t,n,o,a,p,m)}}else x=(0,a.h)(t,n);if(x){const e=x[0],t=x[x.length-1];w=Math.atan2(t.y-e.y,t.x-e.x)}}}return{...v,markers:g,line:m,edge:h,d:(0,o.S)(x,m.curveType,k,b),angle:w,labelSize:y.labelSize}})).filter(Boolean)}function s(e,t,n){const o=Math.atan2(e.height+2*n,e.width+2*n),{x:a,y:i}=e,{x:r,y:l}=t,s=Math.atan2(l-i,r-a),d=s<0?2*Math.PI+s:s;switch(Math.floor(d/Math.PI*2)){case 0:return d<o?"right":"bottom";case 1:return d<Math.PI-o?"bottom":"left";case 2:return d<Math.PI+o?"left":"top";default:return d<2*Math.PI-o?"top":"right"}}function d(e,t,n,o){return[...e].filter((e=>s(t,e,o)===n)).sort(((e,t)=>{const{x:o,y:a}=e,{x:i,y:r}=t;return"top"===n||"bottom"===n?o-i:a-r}))}},5157:(e,t,n)=>{n.d(t,{a:()=>a});var o=n(1030);function a(e,t){let{renderedNodes:n,activeTarget:o}=t;const a="node"===(null==o?void 0:o.type)?n.find((e=>e.id===o.nodeId)):void 0,r="edge"===(null==o?void 0:o.type)?o.edge:void 0;if(!a&&!r)return;const l=e.key||e.keyCode||e.which;let s,d,c;switch(l){case"Backspace":case 8:case"Delete":case 46:a?(s="delete-node",d=a):(s="delete-edge",c=r);break;default:if(!a)return;switch(l){case"ArrowLeft":case 37:d=i("x",n,a,-1),s="switch-active-node";break;case"ArrowUp":case 38:d=i("y",n,a,-1),s="switch-active-node";break;case"ArrowRight":case 39:d=i("x",n,a,1),s="switch-active-node";break;case"ArrowDown":case 40:d=i("y",n,a,1),s="switch-active-node"}}var u;return s?(e.preventDefault(),e.stopPropagation(),{action:s,node:null===(u=d)||void 0===u?void 0:u.data,edge:c}):void 0}function i(e,t,n,a){const i="x"===e?"y":"x";let r;const l=t.filter((t=>t!==n&&(r=(t[e]-n[e])*a,r>0)&&r>Math.abs(n[i]-t[i])));return(0,o.minBy)(l,(t=>(n[i]-t[i])**2+(n[e]-t[e])**2))}},2448:(e,t,n)=>{n.d(t,{P:()=>i});var o=n(5223),a=n(8657);function i(e,t){let{nodes:n,nodesRefRepository:i,connectNodes:r,dragNodes:l,scale:s,setConnectLineState:d,setConnectLineTo:c,setManualLayoutStatus:u,setNodeMovement:f,onSwitchActiveTarget:p,onNodesConnect:m}=t;function h(e){if(i)for(const[t,o]of i)if(e(o))return null==n?void 0:n.find((e=>e.id===t))}if(!r&&!l)return;const g=h((t=>t.contains(e.target)));if(!g)return;if(!function(e,t){return e.sourceType?[].concat(e.sourceType).includes(t.type):(0,o.checkIfByTransform)(e,{source:t})}(r||l,g))return;e.stopPropagation();const v=[e.clientX,e.clientY];if(r){d({from:v,options:{strokeColor:a.mF,strokeWidth:a.VO,...o.__secret_internals.legacyDoTransform({source:g},r)}}),c(v),null==p||p({type:"node",nodeId:g.id});const e=e=>{c([e.clientX,e.clientY])},t=n=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t),d(null);const o=n.composedPath(),a=h((e=>o.includes(e)));a&&g!==a&&(null==m||m({source:g,target:a}))};return document.addEventListener("mousemove",e),void document.addEventListener("mouseup",t)}null==p||p({type:"node",nodeId:g.id});let y=!1;const k=e=>{const t=[(e.clientX-v[0])/s,(e.clientY-v[1])/s];y||(y=t[0]**2+t[1]**2>=9,y&&u("started")),y&&f({id:g.id,move:t})},b=()=>{y=!1,document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",b),f(null),u("finished")};document.addEventListener("mousemove",k),document.addEventListener("mouseup",b)}},9137:(e,t,n)=>{n.d(t,{t:()=>l});var o=n(1030),a=n(5223);function i(e,t){return!!t&&(t.edgeType?[].concat(t.edgeType).includes(e.type):(0,a.checkIfByTransform)(t,{edge:e}))}var r=n(8657);function l(e,t){const n=[],l=new WeakMap,d=[];for(const f of e??[]){const{label:e,...p}=(null==t?void 0:t.find((e=>i(f,e))))??{},m=a.__secret_internals.legacyDoTransform({edge:f},p);if(!1===(null==m?void 0:m.draw))continue;const h=(0,o.uniqueId)("line-"),g={strokeColor:r.mF,strokeWidth:r.VO,curveType:"polyline"===(null==m?void 0:m.type)?"curveLinear":r.KP,interactStrokeWidth:r.Ie,type:"auto",...m,label:e,$id:h};l.set(f,h);const v=[],y=g.markers??(g.arrow?[{placement:"end",type:"arrow"}]:[]);for(const e of y){var c,u;const{placement:t,type:n}=e,o=t??"end";let a,i;switch(n){case"0..1":case"0..N":i=21,a=n;break;default:i=1,a="arrow"}const r=i*g.strokeWidth,l=s({type:a,strokeColor:g.strokeColor},d);v.push({index:l,placement:o,type:a,variant:"default",offset:r});const f=s({type:a,strokeColor:(null===(c=g.overrides)||void 0===c||null===(c=c.active)||void 0===c?void 0:c.strokeColor)??g.strokeColor},d);v.push({index:f,placement:o,type:a,variant:"active",offset:r});const p=s({type:a,strokeColor:(null===(u=g.overrides)||void 0===u||null===(u=u.activeRelated)||void 0===u?void 0:u.strokeColor)??g.strokeColor},d);v.push({index:p,placement:o,type:a,variant:"active-related",offset:r})}n.push({line:g,markers:v,edge:f})}return{normalizedLines:n,normalizedLinesMap:l,markers:d}}function s(e,t){let n=(0,o.findIndex)(t,e);return-1===n&&(n=t.push(e)-1),n}},2673:(e,t,n)=>{function o(e,t){return e?!!t&&e.type===t.type&&("node"===e.type?e.nodeId===t.nodeId:e.edge.source===t.edge.source&&e.edge.target===t.edge.target):!t}n.d(t,{c:()=>o})},8308:(e,t,n)=>{function o(e,t){let{canvasWidth:n,canvasHeight:o,scaleRange:a}=t,i=1/0,r=1/0,l=-1/0,s=-1/0;for(const t of e){const e=t.width/2,n=t.height/2,o=t.x-e,a=t.x+e,d=t.y-n,c=t.y+n;o<i&&(i=o),a>l&&(l=a),d<r&&(r=d),c>s&&(s=c)}const d=l-i,c=s-r,u=a&&(d>n||c>o)?Math.max(Math.min(n/d,o/c,a[1]),a[0]):1;return{x:(n-d*u)/2-i*u,y:(o-c*u)/2-r*u,k:u}}n.d(t,{r:()=>o})},821:(e,t,n)=>{n.d(t,{A:()=>l});var o=n(6758),a=n.n(o),i=n(935),r=n.n(i)()(a());r.push([e.id,":host{display:block;width:100%;height:100%;overflow:hidden}:host([hidden]){display:none}*{box-sizing:border-box}.diagram{width:100%;height:100%;position:relative;opacity:0}.diagram:focus{outline:none}.lines,\n.line-labels,\n.nodes{position:absolute;top:0;left:0}.line-labels{opacity:0}.ready{opacity:1}.diagram.ready.pannable{cursor:grab}.diagram.pannable.grabbing{cursor:grabbing}.nodes,\n.lines{transform-origin:0 0}.node,\n.line-label{position:absolute;visibility:hidden}.line-label{transform:translate(-50%,-50%);white-space:pre-line;width:max-content;text-align:center;line-height:1}.lines{pointer-events:none}.line.interactable{pointer-events:auto;cursor:default}.connect-line{position:fixed;top:0;left:0;right:0;bottom:0;pointer-events:none}.connect-line:not(.connecting){display:none}.line:not(.active) .active-bg{display:none}",""]);const l=r.toString()}}]);
3
+ //# sourceMappingURL=3233.19da547d.js.map