@next-bricks/diagram 0.34.7 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/bricks.json +5 -5
  2. package/dist/chunks/363.28378715.js +2 -0
  3. package/dist/chunks/363.28378715.js.map +1 -0
  4. package/dist/chunks/9074.daf4e2c5.js +3 -0
  5. package/dist/chunks/9074.daf4e2c5.js.map +1 -0
  6. package/dist/chunks/{eo-display-canvas.e13c2deb.js → eo-display-canvas.04a03e8b.js} +2 -2
  7. package/dist/chunks/{eo-display-canvas.e13c2deb.js.map → eo-display-canvas.04a03e8b.js.map} +1 -1
  8. package/dist/chunks/eo-draw-canvas.e019802d.js +2 -0
  9. package/dist/chunks/eo-draw-canvas.e019802d.js.map +1 -0
  10. package/dist/chunks/main.4e780799.js +2 -0
  11. package/dist/chunks/{main.81fec9b8.js.map → main.4e780799.js.map} +1 -1
  12. package/dist/examples.json +3 -3
  13. package/dist/index.182bfc24.js +2 -0
  14. package/dist/{index.9a09558d.js.map → index.182bfc24.js.map} +1 -1
  15. package/dist/manifest.json +150 -145
  16. package/dist/types.json +2844 -2813
  17. package/dist-types/draw-canvas/index.d.ts +2 -0
  18. package/dist-types/draw-canvas/interfaces.d.ts +3 -3
  19. package/dist-types/draw-canvas/processors/asserts.d.ts +1 -0
  20. package/dist-types/draw-canvas/processors/findNodeOrAreaDecorator.d.ts +2 -0
  21. package/dist-types/draw-canvas/processors/getUnrelatedCells.d.ts +1 -1
  22. package/docs/eo-draw-canvas.md +2 -1
  23. package/package.json +2 -2
  24. package/dist/chunks/5030.6f1895e1.js +0 -2
  25. package/dist/chunks/5030.6f1895e1.js.map +0 -1
  26. package/dist/chunks/9074.5793d8db.js +0 -3
  27. package/dist/chunks/9074.5793d8db.js.map +0 -1
  28. package/dist/chunks/eo-draw-canvas.4b7d730e.js +0 -2
  29. package/dist/chunks/eo-draw-canvas.4b7d730e.js.map +0 -1
  30. package/dist/chunks/main.81fec9b8.js +0 -2
  31. package/dist/index.9a09558d.js +0 -2
  32. /package/dist/chunks/{9074.5793d8db.js.LICENSE.txt → 9074.daf4e2c5.js.LICENSE.txt} +0 -0
package/dist/bricks.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "id": "bricks/diagram",
3
3
  "bricks": [
4
- "diagram.editable-label",
5
- "diagram.experimental-node"
4
+ "diagram.experimental-node",
5
+ "diagram.editable-label"
6
6
  ],
7
7
  "elements": [
8
8
  "eo-diagram",
9
- "eo-draw-canvas",
10
- "eo-display-canvas"
9
+ "eo-display-canvas",
10
+ "eo-draw-canvas"
11
11
  ],
12
12
  "processors": [],
13
13
  "dependencies": {
@@ -15,5 +15,5 @@
15
15
  "basic.lock-body-scroll"
16
16
  ]
17
17
  },
18
- "filePath": "bricks/diagram/dist/index.9a09558d.js"
18
+ "filePath": "bricks/diagram/dist/index.182bfc24.js"
19
19
  }
@@ -0,0 +1,2 @@
1
+ "use strict";(self.webpackChunk_next_bricks_diagram=self.webpackChunk_next_bricks_diagram||[]).push([[363],{3739:(e,t,r)=>{r.d(t,{c:()=>o});var a=r(8769),n=r.n(a);function o(e){var t,{id:r,type:a,strokeColor:o}=e;switch(a){case"0..1":t=l;break;case"0..N":t=d;break;default:t=i}return n().createElement(t,{id:r,strokeColor:o})}function i(e){var{id:t,strokeColor:r}=e;return n().createElement("marker",{id:t,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 l(e){var{id:t,strokeColor:r}=e;return n().createElement("marker",{id:t,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 d(e){var{id:t,strokeColor:r}=e;return n().createElement("marker",{id:t,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"}))}},3188:(e,t,r)=>{r.d(t,{h:()=>n});var a=r(733);function n(e,t,r){if(e===t||(0,a.w)(e,t,0,0))return null;var n,i,l=0,d=0;if(r){var c=t.x-e.x,s=t.y-e.y,u=Math.atan2(s,c);l=r/2*Math.cos(u+Math.PI/2),d=r/2*Math.sin(u+Math.PI/2)}var h=[[e.x+l,e.y+d],[t.x+l,t.y+d]],v=o(e,h),f=o(t,h);return n=v.length>0?v[0]:[e.x,e.y],i=f.length>0?f[0]:[t.x,t.y],[{x:n[0],y:n[1]},{x:i[0],y:i[1]}]}function o(e,t){for(var r=[[e.x-e.width/2,e.y-e.height/2],[e.x+e.width/2,e.y-e.height/2],[e.x+e.width/2,e.y+e.height/2],[e.x-e.width/2,e.y+e.height/2]],a=[],n=0;n<4;n++)a.push([r[n],r[(n+1)%4]]);var o=[];for(var l of a){var d=i(t[0],t[1],l[0],l[1]);d&&o.push(d)}return o}function i(e,t,r,a){var[n,o]=e,[i,l]=t,[d,c]=r,[s,u]=a;if(n===i&&o===l||d===s&&c===u)return null;var h=(u-c)*(i-n)-(s-d)*(l-o);if(0===h)return null;var v=((s-d)*(o-c)-(u-c)*(n-d))/h,f=((i-n)*(o-c)-(l-o)*(n-d))/h;return v<0||v>1||f<0||f>1?null:[n+v*(i-n),o+v*(l-o)]}},733:(e,t,r)=>{function a(e,t,r,a){var o=r?n(e,r):e,i=a?n(t,a):t,l=Math.min(o.x-o.width/2,i.x-i.width/2),d=Math.max(o.x+o.width/2,i.x+i.width/2),c=Math.min(o.y-o.height/2,i.y-i.height/2),s=Math.max(o.y+o.height/2,i.y+i.height/2);return d-l<o.width+i.width&&s-c<o.height+i.height}function n(e,t){return{x:e.x-e.width/2-t,y:e.y-e.height/2-t,width:e.width+2*t,height:e.height+2*t}}r.d(t,{w:()=>a})},8802:(e,t,r)=>{function a(e){if(Array.isArray(e)){var t=e[0],r=e.length>1?e[1]:t;return[t,r,e.length>2?e[2]:t,e.length>3?e[3]:r]}return new Array(4).fill(e)}r.d(t,{D:()=>a})},4809:(e,t,r)=>{r.d(t,{m:()=>z});var a=r(8769),n=r.n(a),o=r(3373),i=r.n(o),l=r(531),d=r(3188),c=r(3033);function s(e,t){return e.find((e=>(0,l.o6)(e)&&e.id===t))}function u(e){var t,r,o,{edge:u,cells:v,lineConfMap:f}=e,g=(0,a.useRef)(null),m=(0,a.useMemo)((()=>s(v,u.source)),[v,u.source]),p=(0,a.useMemo)((()=>s(v,u.target)),[v,u.target]),w=(0,a.useMemo)((()=>f.get(u)),[u,f]),y=(0,a.useMemo)((()=>v.some((e=>(0,l.WW)(e)&&e.source===u.target&&e.target===u.source))?w.parallelGap:0),[v,u,w.parallelGap]),x=(0,a.useMemo)((()=>m&&p&&null!=m.view.x&&null!=p.view.x?(0,d.h)(h(m.view,5),h(p.view,5),y):null),[y,m,p]);if(!x)return null;var k="M".concat(x[0].x," ").concat(x[0].y,"L").concat(x[1].x," ").concat(x[1].y);return n().createElement(n().Fragment,null,n().createElement("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:w.interactStrokeWidth}),n().createElement("path",{ref:g,className:i()("line",{dashed:w.dashed,["".concat(w.dashed?"dashed":"solid","-animation")]:w.animate.useAnimate}),style:{"--time":"".concat(null!==(t=w.animate.duration)&&void 0!==t?t:c.Be,"s"),"--solid-length":null===(r=g.current)||void 0===r||null===(o=r.getTotalLength)||void 0===o?void 0:o.call(r)},d:k,fill:"none",stroke:w.strokeColor,strokeWidth:w.strokeWidth,markerStart:w.showStartArrow?w.markerArrow:"",markerEnd:w.showEndArrow?w.markerArrow:""}),n().createElement("path",{className:"line-active-bg",d:k,fill:"none"}))}function h(e,t){return{x:e.x+e.width/2,y:e.y+e.height/2,width:e.width+t,height:e.height+t}}var v=r(7382),f=r(9924),g=r(1030),m=r(9126);function p(e){var{node:t,degraded:r,degradedNodeLabel:o,defaultNodeBricks:i,onResize:l}=e,d=function(e){var[t,r]=(0,a.useState)(e);return(0,a.useEffect)((()=>{r((t=>(0,g.isEqual)(t,e)?t:e))}),[e]),t}({node:{id:t.id,data:t.data}}),c=t.useBrick,s=(0,a.useRef)(null),u=(0,a.useMemo)((()=>{var e;return r?null:null!=c?c:null==i||null===(e=i.find((e=>(0,f.checkIfByTransform)(e,d))))||void 0===e?void 0:e.useBrick}),[r,c,i,d]),h=(0,a.useMemo)((()=>r?String(f.__secret_internals.legacyDoTransform(d,null!=o?o:"<% DATA.node.id %>")):""),[r,o,d]),p=(0,a.useCallback)((e=>{var r=s.current;r&&(r.disconnect(),s.current=null),e?setTimeout((()=>{var r=new m.A((()=>{l(t.id,[e.offsetWidth,e.offsetHeight])}));r.observe(e),s.current=r})):l(t.id,null)}),[t.id,l]),w=(0,a.useCallback)((e=>{if(e){var r=e.getBBox();l(t.id,[r.width,r.height])}else l(t.id,null)}),[t.id,l]);return u?n().createElement("foreignObject",{width:9999,height:9999,className:"node"},u&&n().createElement(v.ReactUseBrick,{useBrick:u,data:d,refCallback:p})):r?n().createElement("g",{className:"degraded",ref:w},n().createElement("circle",{cx:8,cy:8,r:8}),n().createElement("text",{x:8,y:32},h)):null}function w(e){return"edge"===e.type?(0,g.pick)(e,["type","source","target","data"]):(0,g.pick)(e,["type","id","data"])}function y(e,t){var{action:r,cell:a,scale:n,layout:o,onCellMoving:i,onCellMoved:d,onCellResizing:c,onCellResized:s,onSwitchActiveTarget:u}=t;if(e.stopPropagation(),null==u||u(w(a)),!(0,l.WW)(a)&&("force"!==o&&"dagre"!==o||!(0,l.N)(a))){var h=[e.clientX,e.clientY],v="move"===r?[a.view.x,a.view.y]:[a.view.width,a.view.height],f=!1,g=(e,t)=>{var o,l,u=function(e){return[(e.clientX-h[0])/n,(e.clientY-h[1])/n]}(e);f||(f=u[0]**2+u[1]**2>=9),f&&("move"===r?null===(o=t?d:i)||void 0===o||o({type:a.type,id:a.id,x:v[0]+u[0],y:v[1]+u[1]}):null===(l=t?s:c)||void 0===l||l({type:a.type,id:a.id,width:v[0]+u[0],height:v[1]+u[1]}))},m=e=>{g(e)},p=e=>{g(e,!0),f=!1,document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",p)};document.addEventListener("mousemove",m),document.addEventListener("mouseup",p)}}function x(e){var{cell:t,transform:r,readOnly:o,onCellResizing:i,onCellResized:l,onSwitchActiveTarget:d}=e,c=n().useRef(null);return(0,a.useEffect)((()=>{var e=c.current;if(e&&!o){var a=e=>{y(e,{action:"resize",cell:t,scale:r.k,onCellResizing:i,onCellResized:l,onSwitchActiveTarget:d})};return e.addEventListener("mousedown",a),()=>{e.removeEventListener("mousedown",a)}}}),[t,l,i,d,o,r.k]),n().createElement("g",{className:"decorator-area"},n().createElement("rect",{width:t.view.width,height:t.view.height,className:"area"}),!o&&n().createElement("g",{ref:c,className:"resize-handle",transform:"translate(".concat(t.view.width-20," ").concat(t.view.height-20,")")},n().createElement("rect",{width:20,height:20}),n().createElement("path",{d:"M10 18L18 10 M15 18L18 15"})))}var k=r(9740);function b(e){var t,{cell:r,readOnly:o,onDecoratorTextEditing:l,onDecoratorTextChange:d}=e,c=null!==(t=r.view.text)&&void 0!==t?t:"",[s,u]=(0,a.useState)(c),[h,v]=(0,a.useState)(!1),f=(0,a.useRef)(!1),[g,m]=(0,a.useState)(!1),p=(0,a.useRef)(null),w=(0,a.useCallback)((e=>{o||(e.preventDefault(),e.stopPropagation(),v(!0))}),[o]);(0,a.useEffect)((()=>{var e=p.current;e&&e.textContent!==s&&(e.textContent=s)}),[s]),(0,a.useEffect)((()=>{h&&p.current&&(p.current.focus(),function(e){var t=document.createRange();t.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(t)}(p.current)),null==l||l({id:r.id,editing:h})}),[r.id,h,l]),(0,a.useEffect)((()=>{f.current?null==l||l({id:r.id,editing:h}):f.current=!0}),[r.id,h,l]);var y=(0,a.useCallback)((e=>{o||u(e.target.textContent)}),[o]),x=(0,a.useCallback)((()=>{o||(v(!1),m(!0))}),[o]);return(0,a.useEffect)((()=>{g&&(null==d||d({id:r.id,view:(0,k.A)((0,k.A)({},r.view),{},{text:s})}),m(!1))}),[r,s,d,g]),n().createElement("foreignObject",{className:"decorator-text"},n().createElement("div",{className:i()("text-container",{editing:h}),onDoubleClick:w},n().createElement("div",{className:"text",contentEditable:h,ref:p,onInput:y,onBlur:x})))}function C(e){var t,{cell:r,transform:a,readOnly:o,onCellResizing:i,onCellResized:l,onSwitchActiveTarget:d,onDecoratorTextEditing:c,onDecoratorTextChange:s}=e;switch(r.decorator){case"area":t=x;break;case"text":t=b;break;default:return console.error("Unknown decorator: ".concat(r.decorator)),null}return n().createElement(t,{cell:r,transform:a,readOnly:o,onCellResizing:i,onCellResized:l,onSwitchActiveTarget:d,onDecoratorTextEditing:c,onDecoratorTextChange:s})}var E=r(8185);function z(e){var{layout:t,cell:r,cells:o,degraded:d,degradedNodeLabel:c,defaultNodeBricks:s,lineConfMap:h,active:v,readOnly:f,transform:g,unrelatedCells:m,onCellMoving:x,onCellMoved:k,onCellResizing:b,onCellResized:z,onSwitchActiveTarget:A,onCellContextMenu:M,onCellClick:N,onDecoratorTextEditing:R,onDecoratorTextChange:S,onNodeBrickResize:W,onCellMouseEnter:L,onCellMouseLeave:T}=e,D=(0,a.useRef)(null),B=(0,a.useMemo)((()=>m.some((e=>(0,E.c)(e,r)))),[r,m]);(0,a.useEffect)((()=>{var e=D.current;if(e){var a=e=>{f?e.stopPropagation():y(e,{layout:t,action:"move",cell:r,scale:g.k,onCellMoving:x,onCellMoved:k,onSwitchActiveTarget:A})};return e.addEventListener("mousedown",a),()=>{e.removeEventListener("mousedown",a)}}}),[t,r,k,x,A,f,g.k]);var V=(0,a.useCallback)((e=>{f&&"decorator"===r.type||(e.preventDefault(),A(w(r)),M({cell:r,clientX:e.clientX,clientY:e.clientY}))}),[r,M,A,f]),H=(0,a.useCallback)((e=>{N&&"decorator"!==r.type&&N({cell:r,clientX:e.clientX,clientY:e.clientY})}),[r,N]),P=(0,a.useCallback)((()=>{null==L||L(r)}),[r,L]),O=(0,a.useCallback)((()=>{null==T||T(r)}),[r,T]);return n().createElement("g",{className:i()("cell",{active:v,faded:B,"read-only":f}),ref:D,transform:"edge"===r.type||null==r.view.x?void 0:"translate(".concat(r.view.x," ").concat(r.view.y,")"),onContextMenu:V,onClick:H,onMouseEnter:P,onMouseLeave:O},(0,l.N)(r)?n().createElement(p,{node:r,degraded:d,degradedNodeLabel:c,defaultNodeBricks:s,onResize:W}):(0,l.WW)(r)?n().createElement(u,{edge:r,cells:o,lineConfMap:h}):(0,l.mH)(r)?n().createElement(C,{cell:r,transform:g,readOnly:f,onCellResizing:b,onCellResized:z,onSwitchActiveTarget:A,onDecoratorTextEditing:R,onDecoratorTextChange:S}):null)}},3033:(e,t,r)=>{r.d(t,{Be:()=>m,CV:()=>a,HP:()=>o,Ie:()=>v,N8:()=>l,Ub:()=>g,VO:()=>h,XV:()=>f,Yt:()=>s,mF:()=>u,pC:()=>p,sS:()=>c,sz:()=>i,w1:()=>d,xc:()=>n});var a=Symbol.for("size-initialized"),n=Symbol.for("layout-initialized"),o=20,i=36,l=100,d=60,c=.5,s=2,u="gray",h=1,v=15,f=!1,g=!0,m=1,p=500},531:(e,t,r)=>{function a(e){return"node"===e.type}function n(e){return"decorator"===e.type}function o(e){return"node"===e.type}function i(e){return"edge"===e.type}function l(e){return"node"===e.type||"edge"===e.type}function d(e){return"node"===e.type||"decorator"===e.type&&"area"===e.decorator}r.d(t,{N:()=>a,WW:()=>i,mH:()=>n,nv:()=>l,o6:()=>d,vC:()=>o})},227:(e,t,r)=>{r.d(t,{Y:()=>n});var a=r(8185);function n(e,t,r,n){var o=[];if(t){var i=new Set;for(var l of e)"edge"===l.type&&l.source===t.source.id&&i.add(l.target);for(var d of e)switch(d.type){case"node":i.has(d.id)&&o.push(d);break;case"decorator":n&&"text"!=d.decorator&&!i.has(d.id)||o.push(d);break;default:o.push(d)}}else switch(null==r?void 0:r.type){case"node":var c=new Map,s=new Set([r.id]);for(var u of e)"node"===u.type?c.set(u.id,u):"edge"===u.type?u.source===r.id?s.add(u.target):u.target===r.id?s.add(u.source):o.push(u):o.push(u);for(var[h,v]of c)s.has(h)||o.push(v);break;case"edge":for(var f of e)("edge"===f.type?(0,a.c)(f,r):"node"===f.type&&(f.id===r.source||f.id===r.target))||o.push(f)}return o}},3783:(e,t,r)=>{r.d(t,{C:()=>o});var a=r(9740),n=r(531);function o(e,t){var{defaultNodeSize:r}=t;return(null!=e?e:[]).map((e=>{var t,o;return!(0,n.vC)(e)||void 0!==(null===(t=e.view)||void 0===t?void 0:t.width)&&void 0!==(null===(o=e.view)||void 0===o?void 0:o.height)?e:(0,a.A)((0,a.A)({},e),{},{view:(0,a.A)({width:r[0],height:r[1]},e.view)})}))}},8185:(e,t,r)=>{function a(e,t){return e?!!t&&e.type===t.type&&("node"===e.type||"decorator"===e.type?e.id===t.id:e.source===t.source&&e.target===t.target):!t}r.d(t,{c:()=>a})},908:(e,t,r)=>{r.d(t,{r:()=>n});var a=r(531);function n(e,t){var{canvasWidth:r,canvasHeight:n,scaleRange:o}=t,i=1/0,l=1/0,d=-1/0,c=-1/0,s=!0;for(var u of e)if(!(0,a.WW)(u)){s=!1;var{view:h}=u,v=h.x+h.width,f=h.y+h.height;h.x<i&&(i=h.x),v>d&&(d=v),h.y<l&&(l=h.y),f>c&&(c=f)}var g=d-i,m=c-l,p=o&&!s&&(g>r||m>n)?Math.max(Math.min(r/g,n/m,o[1]),o[0]):1;return{x:s?0:(r-g*p)/2-i*p,y:s?0:(n-m*p)/2-l*p,k:p}}},2098:(e,t,r)=>{r.d(t,{L:()=>s});var a=r(1030),n=r(3033),o=r(531),i=r(3783),l=r(908),d=r(6170),c=r(9127);function s(e){var{cells:t,layout:r,previousCells:s,defaultNodeSize:u,canvasWidth:h,canvasHeight:v,scaleRange:f,transform:g,reason:m,parent:p}=e,w="force"!==r&&"dagre"!==r,y=(0,i.C)(t,{defaultNodeSize:u}),x=[],k=!1,b=new Map,C=!1;for(var E of s)(0,o.mH)(E)?C=!0:(0,o.N)(E)&&(C=!0,E[n.CV]&&b.set(E.id,E));var z=new Map;for(var A of y)if((0,o.N)(A)){z.set(A.id,A);var M=b.get(A.id);M&&(A.view.width=M.view.width,A.view.height=M.view.height,A[n.CV]=!0)}var N=!1;if("add-related-nodes"===m&&p){var R=new Set;for(var S of y)(0,o.WW)(S)&&S.source===p&&S.target!==p&&R.add(S.target);var W=z.get(p);if(void 0!==(null==W?void 0:W.view.x)&&void 0!==W.view.y){N=!0;var L=[...R].map((e=>z.get(e))).filter(Boolean),T=void 0;for(var D of L)void 0!==D.view.x&&void 0!==D.view.y?(!T||D.view.x>T.view.x)&&D.view.y>W.view.y&&(T=D):x.push(D);if(x.length>0&&w){var B,V;if(T)B=T.view.x+T.view.width+n.sz,V=T.view.y;else{var H=x.reduce(((e,t)=>e+t.view.width+n.sz),-n.sz);B=W.view.x-H/2+W.view.width/2,V=W.view.y+W.view.height+n.sz}for(var P of x)P.view.x=B,P.view.y=V,B+=P.view.width+n.sz}}}if(!N){var O,I=u[0],Y=u[1],_=[],X=!1;for(var U of y)(0,o.N)(U)?(U.view.width>I&&(I=U.view.width),U.view.height>Y&&(Y=U.view.height),void 0===U.view.x||void 0===U.view.y?x.push(U):_.push(U)):(0,o.mH)(U)&&(X=!0);if(w)for(var j of(C||(g=(0,l.r)((0,a.without)(y,...x),{canvasWidth:h,canvasHeight:v,scaleRange:f})),0===_.length||1===_.length&&!X?(x.push(..._),({getNodeView:O}=(0,c.C)({cells:y})),k=0===s.length):({getNodeView:O}=(0,d.k)({cells:y,fixedPosition:!0,center:[(h/2-g.x)/g.k,(v/2-g.y)/g.k]})),y))if((0,o.N)(j)){var G=O(j.id);j.view.x=G.x,j.view.y=G.y}}return{cells:y,updated:x,shouldReCenter:k}}},5748:(e,t,r)=>{r.d(t,{d:()=>d});var a=r(9740),n=r(531),o=r(3033);function i(e,t,r){var a=e.findLastIndex(r)+1;return[...e.slice(0,a),t,...e.slice(a)]}var l,d=(l={cells:(e,t)=>{switch(t.type){case"drop-node":return i(e,t.payload,(e=>!("decorator"===e.type&&"text"===e.decorator)));case"drop-decorator":return"text"===t.payload.decorator?[...e,t.payload]:i(e,t.payload,(e=>"decorator"===e.type&&"area"===e.decorator));case"add-nodes":var r=e.findLastIndex((e=>!("decorator"===e.type&&"text"===e.decorator)))+1;return[...e.slice(0,r),...t.payload,...e.slice(r)];case"add-edge":return i(e,t.payload,(e=>"edge"===e.type||"decorator"===e.type&&"area"===e.decorator));case"move-cell":var{type:l,id:d,x:c,y:s}=t.payload,u=e.findIndex((e=>e.type===l&&e.id===d));if(-1!==u){var h=e[u];return[...e.slice(0,u),(0,a.A)((0,a.A)({},h),{},{view:(0,a.A)((0,a.A)({},h.view),{},{x:c,y:s})}),...e.slice(u+1)]}return e;case"resize-cell":var{type:v,id:f,width:g,height:m}=t.payload,p=e.findIndex((e=>e.type===v&&e.id===f));if(-1!==p){var w=e[p];return[...e.slice(0,p),(0,a.A)((0,a.A)({},w),{},{view:(0,a.A)((0,a.A)({},w.view),{},{width:g,height:m})}),...e.slice(p+1)]}return e;case"update-cells":return t.payload;case"update-node-size":return e.map((e=>(0,n.N)(e)&&e.id===t.payload.id?(0,a.A)((0,a.A)({},e),{},{[o.CV]:!0,view:t.payload.size?(0,a.A)((0,a.A)({},e.view),{},{width:t.payload.size[0],height:t.payload.size[1]}):e.view}):e))}return e},layoutKey:(e,t)=>"update-node-size"===t.type?t.layoutKey:e},(e,t)=>Object.fromEntries(Object.entries(l).map((r=>{var[a,n]=r;return[a,n(e[a],t)]}))))},7099:(e,t,r)=>{r.d(t,{Y:()=>f});var a=r(8769),n=r.n(a),o=r(2657),i=r(6768),l=r(198),d=r(8621),c=r(7382),s=r(9575);const u=e=>a.createElement("svg",(0,s.A)({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24"},e),a.createElement("path",{d:"M12 0a.5.5 0 0 1 .5.5v2.013a9.5 9.5 0 0 1 8.987 8.988L23.5 11.5a.5.5 0 0 1 0 1h-2.013a9.5 9.5 0 0 1-8.987 8.987V23.5a.5.5 0 0 1-1 0v-2.013A9.5 9.5 0 0 1 2.514 12.5H.5a.5.5 0 0 1 0-1h2.013A9.5 9.5 0 0 1 11.5 2.514V.5A.5.5 0 0 1 12 0M3.514 11.5H7.5a.5.5 0 0 1 0 1H3.514a8.5 8.5 0 0 0 7.987 7.986L11.5 16.5a.5.5 0 0 1 1 0v3.986a8.5 8.5 0 0 0 7.986-7.986H16.5a.5.5 0 0 1 0-1h3.986A8.5 8.5 0 0 0 12.5 3.515V7.5a.5.5 0 0 1-1 0V3.514a8.5 8.5 0 0 0-7.986 7.987zm8.486-1a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3"})),h=e=>a.createElement("svg",(0,s.A)({xmlns:"http://www.w3.org/2000/svg",width:128,height:128,className:"icon",viewBox:"0 0 1024 1024"},e),a.createElement("path",{d:"M512 76.8A435.2 435.2 0 1 0 947.2 512 435.71 435.71 0 0 0 512 76.8m0 819.2a384 384 0 1 1 384-384 384 384 0 0 1-384 384"}),a.createElement("path",{d:"M744.448 486.4h-204.8V281.6a25.6 25.6 0 1 0-51.2 0v204.8h-204.8a25.6 25.6 0 0 0 0 51.2h204.8v204.8a25.6 25.6 0 0 0 51.2 0V537.6h204.8a25.6 25.6 0 0 0 0-51.2"})),v=e=>a.createElement("svg",(0,s.A)({xmlns:"http://www.w3.org/2000/svg",width:128,height:128,className:"icon",viewBox:"0 0 1024 1024"},e),a.createElement("path",{d:"M512 76.8A435.2 435.2 0 1 0 947.2 512 435.71 435.71 0 0 0 512 76.8m0 819.2a384 384 0 1 1 384-384 384 384 0 0 1-384 384"}),a.createElement("path",{d:"M744.448 486.4H280.064a25.6 25.6 0 1 0 0 51.2h464.384a25.6 25.6 0 0 0 0-51.2"}));function f(e){var{shadowRoot:t,scale:r,scaleRange:s,onZoomChange:f,onReCenter:g}=e,m=(0,c.useCurrentTheme)(),p=(0,a.useMemo)((()=>(0,d.VC)()),[]),w=(0,a.useRef)(null),y=100*s[0],x=100*s[1],k=100*r,b=(0,a.useMemo)((()=>({formatter:e=>"".concat(e,"%"),placement:"left",getPopupContainer:()=>w.current})),[]),C=(0,a.useCallback)((()=>{f(Math.min(k+5,x))}),[x,f,k]),E=(0,a.useCallback)((()=>{f(Math.max(k-5,y))}),[y,f,k]);return n().createElement(o.Ay,{theme:{algorithm:"dark-v2"===m?i.A.darkAlgorithm:i.A.defaultAlgorithm}},n().createElement(d.N7,{container:t,autoClear:!0,cache:p,hashPriority:"high"},n().createElement("div",{className:"zoom-bar",ref:w},n().createElement("div",{className:"center-button",onClick:g,role:"button"},n().createElement(u,null)),n().createElement("div",{className:"zoom-slider"},n().createElement("div",{className:"zoom-button",role:"button",onClick:C},n().createElement(h,null)),n().createElement(l.A,{min:y,max:x,value:k,step:5,vertical:!0,included:!1,tooltip:b,onChange:f}),n().createElement("div",{className:"zoom-button",role:"button",onClick:E},n().createElement(v,null))))))}},9127:(e,t,r)=>{r.d(t,{C:()=>u});var a=r(9740),n=r(4223),o=r(1030),i=r(7586),l=r.n(i),d=r(8802),c=r(531),s=["nodePadding"];function u(e){var{cells:t,layoutOptions:r}=e,i=(0,a.A)({nodePadding:0,rankdir:"TB",ranksep:50,edgesep:10,nodesep:50},(0,o.pick)(r,["nodePadding","rankdir","ranksep","edgesep","nodesep","align"])),{nodePadding:u}=i,h=(0,n.A)(i,s),v=(0,d.D)(u);if(!t.some(c.N))return{getNodeView:()=>null,nodePaddings:v};var f=new(l().graphlib.Graph);for(var g of(f.setGraph(h),f.setDefaultEdgeLabel((function(){return{}})),t))(0,c.N)(g)?f.setNode(g.id,{id:g.id,width:g.view.width+v[1]+v[3],height:g.view.height+v[0]+v[2]}):(0,c.WW)(g)&&f.setEdge(g.source,g.target);return l().layout(f),{getNodeView:e=>f.node(e),nodePaddings:v}}},6170:(e,t,r)=>{r.d(t,{k:()=>v});var a=r(9740),n=r(1030),o=r(6149),i=r(4842),l=r(1945),d=r(9418),c=r(3854),s=r(7931),u=r(531),h=r(8802);function v(e){var{cells:t,layoutOptions:r,center:v,fixedPosition:f}=e,{nodePadding:g,collide:m}=(0,a.A)((0,a.A)({nodePadding:0},(0,n.pick)(r,["nodePadding"])),{},{collide:!1!==(null==r?void 0:r.collide)&&(0,a.A)({radiusDiff:18,strength:1,iterations:1},!0===(null==r?void 0:r.collide)?null:null==r?void 0:r.collide)}),p=(0,h.D)(g),w=[],y=[],x=new Map;for(var k of t)if((0,u.N)(k)){var b=(0,a.A)({id:k.id,width:k.view.width+p[1]+p[3],height:k.view.height+p[0]+p[2]},f?{fx:k.view.x,fy:k.view.y}:null);w.push(b),x.set(b.id,b)}else(0,u.WW)(k)&&y.push({source:k.source,target:k.target});var C=(0,o.A)(y).id((e=>e.id)),E=(0,i.A)(w).force("link",C).force("x",(0,l.A)(null==v?void 0:v[0])).force("y",(0,d.A)(null==v?void 0:v[1])).force("charge",(0,c.A)());return m&&E.force("collide",(0,s.A)().radius((e=>Math.sqrt(e.width**2+e.height**2)/2+m.radiusDiff)).strength(m.strength).iterations(m.iterations)),E.stop(),function(e){e.tick(Math.ceil(Math.log(e.alphaMin())/Math.log(1-e.alphaDecay())))}(E),{getNodeView:e=>x.get(e),nodePaddings:p}}},1819:(e,t,r)=>{r.d(t,{J:()=>o});var a=r(8769),n=r(8185);function o(e){var{cellsRef:t,activeTarget:r,onActiveTargetChange:o}=e,i=null!=r?r:null,[l,d]=(0,a.useState)(i);(0,a.useEffect)((()=>{d((e=>(0,n.c)(e,i)?e:i))}),[i]);var c=(0,a.useRef)(!1);return(0,a.useEffect)((()=>{c.current?o(l):c.current=!0}),[l,o]),(0,a.useEffect)((()=>{if(l){var e=e=>{e.composedPath().indexOf(t.current)<=0&&d(null)};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}}}),[l,t]),l}},1484:(e,t,r)=>{r.d(t,{g:()=>f});var a=r(9740),n=r(8769),o=r(7566),i=r(1517),l=r(3033),d=r(531),c=r(908),s=r(6170),u=r(9127),h=new Map([["center",.5],["left",0],["right",1],["top",0],["bottom",1]]);function v(e,t){if("string"==typeof e){var r=h.get(e);if(void 0!==r)return r;var a=e.match(/^(-?\d+(?:\.\d+)?)%$/);if(a)return Number(a[1])/100;console.error("Unexpected align origin %s:",t,e)}else{if("number"==typeof e)return e;console.error("Unexpected align origin %s, expected %s, received %s:",t,"string | number",typeof e,e)}return.5}function f(e){var{layout:t,layoutOptions:r,rootRef:h,cells:f,zoomable:g,zoomer:m,scaleRange:p,layoutKey:w,dispatch:y}=e,[x,k]=(0,n.useState)("force"!==t&&"dagre"!==t),b=(0,n.useRef)(w),C=(0,n.useCallback)((()=>++b.current),[]),[E,z]=function(e){var{rootRef:t,cells:r,layoutInitialized:a,zoomable:s,zoomer:u,scaleRange:h}=e,[v,f]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{var e=t.current;if(e&&a&&!v&&r.some((e=>(0,d.N)(e)||(0,d.mH)(e)))&&!r.some((e=>(0,d.N)(e)&&!e[l.CV]))){var{k:n,x:g,y:m}=(0,c.r)(r,{canvasWidth:e.clientWidth,canvasHeight:e.clientHeight,scaleRange:s?h:void 0});u.transform((0,o.A)(e),new i.uV(n,g,m)),f(!0)}}),[r,v,a,t,h,s,u]),(0,n.useEffect)((()=>{r.some((e=>(0,d.N)(e)||(0,d.mH)(e)))||f(!1)}),[r]),[v,f]}({rootRef:h,layoutInitialized:x,cells:f,zoomable:g,zoomer:m,scaleRange:p}),A=(0,n.useRef)(null);return(0,n.useEffect)((()=>{if(!f.some((e=>(0,d.N)(e)&&!e[l.CV]))&&0!==f.length)if("force"===t||"dagre"===t){if(b.current===w&&(e=A.current,n=f.filter(d.nv),(null==e?void 0:e.length)!==n.length||!e.every(((e,t)=>e===n[t])))){var e,n,o,i;({getNodeView:o,nodePaddings:i}="force"===t?(0,s.k)({cells:f,layoutOptions:r}):(0,u.C)({cells:f,layoutOptions:r}));var c=function(e){var t=null!=e?e:[.5,.5];return[v(t[0],"x"),v(t[1],"y")]}(null==r?void 0:r.alignOrigin),h=f.map((e=>{if((0,d.N)(e)){var t=o(e.id);return(0,a.A)((0,a.A)({},e),{},{view:(0,a.A)((0,a.A)({},e.view),{},{x:t.x-t.width*c[0]+i[3],y:t.y-t.height*c[1]+i[0]}),[l.xc]:!0})}return e}));A.current=h.filter(d.nv),y({type:"update-cells",payload:h}),k(!0)}}else k(!0)}),[f,y,t,w,r]),{centered:E,setCentered:z,getNextLayoutKey:C}}},7531:(e,t,r)=>{r.d(t,{d:()=>c});var a=r(9740),n=r(8769),o=r(9924),i=r(1030),l=r(531),d=r(3033);function c(e){var{cells:t,defaultEdgeLines:r,markerPrefix:c}=e;return(0,n.useMemo)((()=>{var e=[{strokeColor:d.mF}],n=new WeakMap,s=function(t){if((0,l.WW)(t)){var s,u=null!==(s=o.__secret_internals.legacyDoTransform({edge:t},null==r?void 0:r.find((e=>(0,o.checkIfByTransform)(e,{edge:t})))))&&void 0!==s?s:{},h=(0,a.A)({dashed:!1,strokeColor:d.mF,strokeWidth:d.VO,interactStrokeWidth:d.Ie,showStartArrow:d.XV,showEndArrow:d.Ub,animate:{useAnimate:!1,duration:d.Be}},(0,i.omitBy)(u,i.isUndefined));void 0===h.parallelGap&&(h.parallelGap=h.interactStrokeWidth);var v=function(e,t){var r=(0,i.findIndex)(t,e);return-1===r&&(r=t.push(e)-1),r}({strokeColor:h.strokeColor},e);h.markerArrow="url(#".concat(c).concat(v,")"),n.set(t,h)}};for(var u of t)s(u);return[n,e]}),[t,r,c])}},8197:(e,t,r)=>{r.d(t,{H:()=>i});var a=r(8769),n=r(531),o=r(3033);function i(e){var{cells:t,layout:r,centered:i}=e;return(0,a.useMemo)((()=>i&&t.every((e=>!(0,n.N)(e)||e[o.CV]&&("force"!==r&&"dagre"!==r||e[o.xc])))),[t,i,r])}},8091:(e,t,r)=>{r.d(t,{f:()=>l});var a=r(8769),n=r(7566),o=r(1517),i=r(3033);function l(e){var{rootRef:t,zoomable:r,scrollable:l,pannable:d,draggable:c,scaleRange:s,onSwitchActiveTarget:u}=e,[h,v]=(0,a.useState)(!1),[f,g]=(0,a.useState)({k:1,x:0,y:0}),m=(0,a.useMemo)((()=>null!=s?s:[i.sS,i.Yt]),[s]),p=(0,a.useMemo)((()=>(0,o.s_)()),[]);return(0,a.useEffect)((()=>{var e=!1;p.scaleExtent(r?m:[1,1]).on("start",(()=>{e=!1,v(!0)})).on("zoom",(t=>{e=!0,g(t.transform)})).on("end",(()=>{v(!1),e||null==u||u(null)}))}),[u,m,r,p]),(0,a.useEffect)((()=>{var e=t.current;if(e){var a=(0,n.A)(e),o=()=>{a.on(".zoom",null).on(".zoom.custom",null).on("wheel",null)};if(r||l||d)return(r||l)&&a.on("wheel.zoom.custom",(e=>{e.ctrlKey||(e.stopImmediatePropagation(),l&&(e.preventDefault(),p.translateBy(a,e.wheelDeltaX/5,e.wheelDeltaY/5)))})),a.call(p).on("wheel",(e=>e.preventDefault())).on("dblclick.zoom",null),c&&d||a.on("mousedown.zoom",null),d||a.on("touchstart.zoom",null).on("touchmove.zoom",null).on("touchend.zoom",null),o;o()}}),[c,d,t,l,r,p]),{grabbing:h,transform:f,zoomer:p,scaleRange:m}}},8618:(e,t,r)=>{r.d(t,{A:()=>l});var a=r(6758),n=r.n(a),o=r(935),i=r.n(o)()(n());i.push([e.id,'.zoom-bar{position:absolute;bottom:20px;right:20px;width:40px}.zoom-slider,\n.center-button{width:100%;display:flex;align-items:center;border:1px solid var(--antd-background-color-base);border-radius:var(--larger-border-radius);box-shadow:var(--connected-overlay-shadow);background-color:var(--color-fill-bg-container-4)}.zoom-slider{height:140px;padding:8px 0;flex-direction:column}[role="button"]{cursor:pointer}.center-button{justify-content:center;margin-bottom:8px;height:40px}.center-button:hover{border-color:var(--antd-btn-default-hover-border-color)}.center-button path{fill:var(--antd-link-hover-color)}.center-button:hover path{fill:var(--palette-blue-7)}.zoom-button{font-size:16px;line-height:0}.zoom-button svg{width:1em;height:1em;fill:var(--antd-link-hover-color)}.zoom-slider .ant-slider-vertical{padding-inline:5px}.zoom-slider .ant-slider-vertical .ant-slider-rail{width:2px}.zoom-slider .ant-slider-vertical .ant-slider-handle{width:6px;height:6px;inset-inline-start:3px}.zoom-slider .ant-slider .ant-slider-handle:hover::before,\n.zoom-slider .ant-slider .ant-slider-handle:focus::before,\n.zoom-slider .ant-slider .ant-slider-handle::before{width:10px;height:10px;inset-inline-start:-2px}.zoom-slider .ant-slider .ant-slider-handle:hover::after,\n.zoom-slider .ant-slider .ant-slider-handle:focus::after,\n.zoom-slider .ant-slider .ant-slider-handle::after{width:6px;height:6px;inset-block-start:0;inset-inline-start:0}',""]);const l=i.toString()},3012:(e,t,r)=>{r.d(t,{A:()=>l});var a=r(6758),n=r.n(a),o=r(935),i=r.n(o)()(n());i.push([e.id,"*{box-sizing:border-box}:host{display:block;position:relative;overflow:hidden;--animation-dasharray:48;--stroke-dashoffset:96;--dasharray:4}:host,\n.root{width:100%;height:100%}:host([hidden]){display:none}.root{opacity:0}.root.ready{opacity:1}.root:focus{outline:none}@keyframes dashedAnimation{0%{stroke-dashoffset:var(--stroke-dashoffset)}to{stroke-dashoffset:0}}@keyframes solidAnimation{to{stroke-dashoffset:0}}.solid-animation{stroke-dasharray:var(--solid-length);stroke-dashoffset:var(--solid-length);animation:solidAnimation var(--time) linear infinite}.dashed-animation{animation:dashedAnimation var(--time) linear infinite}.decorator-area .area{fill:rgba(119,141,195,0.1);stroke:none;stroke-width:0}.node,\n.decorator-text{overflow:visible}.cell.active .decorator-area .area,\n.allowEdgeToArea:hover .decorator-area .area,\n.cell.active .line-active-bg{stroke:var(--palette-blue-5);stroke-dasharray:var(--dasharray);stroke-width:1}.cell:not(.read-only){-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-handle{cursor:nwse-resize;opacity:0}.resize-handle rect{fill:transparent;stroke:none}.resize-handle path{fill:none;stroke:var(--palette-gray-5);stroke-width:1.5}.cell.active .decorator-area .resize-handle,\n.decorator-area:hover .resize-handle{opacity:1}.connect-line{pointer-events:none}.connect-line:not(.connecting){display:none}.line.dashed{stroke-dasharray:var(--dasharray)}.cell.active .decorator-text .text-container{outline:1px dashed var(--palette-blue-5)}.decorator-text .text-container{width:-webkit-max-content;width:-moz-max-content;width:max-content;padding:0.5em}.decorator-text .text:focus{outline:none}.cell.faded{opacity:0.3}.cell .node{pointer-events:none}.cell .node > *{pointer-events:auto}.degraded{pointer-events:bounding-box}.degraded circle{fill:rgb(119,141,195)}.degraded text{text-anchor:middle;fill:var(--antd-text-color)}.cell.active .degraded circle,\n.cell.active .degraded text,\n.degraded:hover circle,\n.degraded:hover text{fill:var(--color-brand)}",""]);const l=i.toString()}}]);
2
+ //# sourceMappingURL=363.28378715.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunks/363.28378715.js","mappings":"mKAYO,SAASA,EAAeC,GAIO,IAChCC,GAL0B,GAC9BC,EAAE,KACFC,EAAI,YACJC,GACqBJ,EAGrB,OAAQG,GACN,IAAK,OACHF,EAAYI,EACZ,MACF,IAAK,OACHJ,EAAYK,EACZ,MACF,QACEL,EAAYM,EAGhB,OAAOC,IAAAA,cAACP,EAAS,CAACC,GAAIA,EAAIE,YAAaA,GACzC,CAEA,SAASG,EAAWE,GAGsB,IAHrB,GACnBP,EAAE,YACFE,GACyBK,EACzB,OACED,IAAAA,cAAA,UACEN,GAAIA,EACJQ,QAAQ,UACRC,KAAM,EACNC,KAAM,EACNC,YAAa,EACbC,aAAc,EACdC,OAAO,qBACPC,eAAe,SAEfR,IA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M0U,EAAOV,EAAQjV,QACrB,GAAK2V,EAAL,CAIA,IAAMuC,GAAgBpC,EAAAA,EAAAA,GAAOH,GAEvBwC,EAAYA,KAChBD,EACGD,GAAG,QAAS,MACZA,GAAG,eAAgB,MACnBA,GAAG,QAAS,KAAK,EAGtB,GAAM/C,GAAYsC,GAAcC,EA6ChC,OAxCIvC,GAAYsC,IAGdU,EAAcD,GACZ,qBACC3T,IAEMA,EAAE8T,UAEL9T,EAAE+T,2BACEb,IACFlT,EAAE6B,iBACFgP,EAAOmD,YACLJ,EACA5T,EAAEiU,YAAc,EAChBjU,EAAEkU,YAAc,IAGtB,IAMNN,EACGhY,KAAKiV,GACL8C,GAAG,SAAU3T,GAAkBA,EAAE6B,mBACjC8R,GAAG,gBAAiB,MAElBP,GAAcD,GACjBS,EAAcD,GAAG,iBAAkB,MAGhCR,GACHS,EACGD,GAAG,kBAAmB,MACtBA,GAAG,iBAAkB,MACrBA,GAAG,gBAAiB,MAGlBE,EA5CLA,GAZF,CAwDgB,GACf,CAACT,EAAWD,EAAUxC,EAASuC,EAAYtC,EAAUC,IAEjD,CAAEyC,WAAU5S,YAAWmQ,SAAQ1J,aACxC,C,kECvIIgN,E,MAA0B,GAA4B,KAE1DA,EAAwB/c,KAAK,CAACgd,EAAOngB,GAAI,o6CAK2E,KAEpH,QAAekgB,EAAwBE,U,kECTnCF,E,MAA0B,GAA4B,KAE1DA,EAAwB/c,KAAK,CAACgd,EAAOngB,GAAI,o+DAQO,KAEhD,QAAekgB,EAAwBE,U","sources":["webpack:///./src/diagram/MarkerComponent.tsx","webpack:///./src/diagram/lines/getDirectLinePoints.ts","webpack:///./src/diagram/processors/doTwoNodesOverlap.ts","webpack:///./src/diagram/processors/extractPartialRectTuple.ts","webpack:///./src/draw-canvas/processors/findNodeOrAreaDecorator.ts","webpack:///./src/draw-canvas/EdgeComponent.tsx","webpack:///./src/draw-canvas/NodeComponent.tsx","webpack:///./src/draw-canvas/processors/cellToTarget.ts","webpack:///./src/draw-canvas/processors/handleMouseDown.ts","webpack:///./src/draw-canvas/decorators/DecoratorArea.tsx","webpack:///./src/draw-canvas/decorators/DecoratorText.tsx","webpack:///./src/draw-canvas/decorators/index.tsx","webpack:///./src/draw-canvas/CellComponent.tsx","webpack:///./src/draw-canvas/constants.ts","webpack:///./src/draw-canvas/processors/asserts.ts","webpack:///./src/draw-canvas/processors/getUnrelatedCells.ts","webpack:///./src/draw-canvas/processors/initializeCells.ts","webpack:///./src/draw-canvas/processors/sameTarget.ts","webpack:///./src/draw-canvas/processors/transformToCenter.ts","webpack:///./src/draw-canvas/processors/updateCells.ts","webpack:///./src/draw-canvas/reducers/cells.ts","webpack:///./src/draw-canvas/reducers/index.ts","webpack:///./src/draw-canvas/reducers/layoutKey.ts","webpack:///./src/shared/canvas/icons/center.svg","webpack:///./src/shared/canvas/icons/zoom-in.svg","webpack:///./src/shared/canvas/icons/zoom-out.svg","webpack:///./src/shared/canvas/ZoomBarComponent.tsx","webpack:///./src/shared/canvas/dagreLayout.ts","webpack:///./src/shared/canvas/forceLayout.ts","webpack:///./src/shared/canvas/useActiveTarget.ts","webpack:///./src/draw-canvas/processors/normalizeAlignOrigin.ts","webpack:///./src/shared/canvas/useLayout.ts","webpack:///./src/shared/canvas/useAutoCenter.ts","webpack:///./src/shared/canvas/useLineMarkers.ts","webpack:///./src/shared/canvas/useReady.ts","webpack:///./src/shared/canvas/useZoom.ts","webpack:///./src/shared/canvas/ZoomBarComponent.shadow.css","webpack:///./src/shared/canvas/styles.shadow.css"],"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 default:\n Component = ArrowMarker;\n }\n\n return <Component id={id} strokeColor={strokeColor} />;\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 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): NodePosition[] | null {\n // Ignore if two nodes are the same.\n // Ignore if two nodes overlap.\n if (source === target || doTwoNodesOverlap(source, target, 0, 0)) {\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 [source.x + xDiff, source.y + yDiff],\n [target.x + xDiff, target.y + yDiff],\n ];\n const sourceIntersections = getIntersections(source, line);\n const targetIntersections = getIntersections(target, line);\n\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 if (targetIntersections.length > 0) {\n p1 = targetIntersections[0];\n } else {\n p1 = [target.x, target.y];\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 { 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","import type { Cell, NodeCell, DecoratorCell, NodeId } from \"../interfaces\";\nimport { isNodeOrAreaDecoratorCell } from \"./asserts\";\n\nexport function findNodeOrAreaDecorator(\n cells: Cell[],\n id: NodeId\n): NodeCell | DecoratorCell | undefined {\n return cells.find(\n (cell) => isNodeOrAreaDecoratorCell(cell) && cell.id === id\n ) as NodeCell | DecoratorCell | undefined;\n}\n","import React, { useMemo, useRef } from \"react\";\nimport classNames from \"classnames\";\nimport type {\n Cell,\n ComputedEdgeLineConf,\n EdgeCell,\n NodeView,\n} from \"./interfaces\";\nimport { getDirectLinePoints } from \"../diagram/lines/getDirectLinePoints\";\nimport type { NodeRect } from \"../diagram/interfaces\";\nimport { isEdgeCell } from \"./processors/asserts\";\nimport { DEFAULT_LINE_INTERACT_ANIMATE_DURATION } from \"./constants\";\nimport { findNodeOrAreaDecorator } from \"./processors/findNodeOrAreaDecorator\";\n\nexport interface EdgeComponentProps {\n edge: EdgeCell;\n cells: Cell[];\n lineConfMap: WeakMap<EdgeCell, ComputedEdgeLineConf>;\n}\n\nexport function EdgeComponent({\n edge,\n cells,\n lineConfMap,\n}: EdgeComponentProps): JSX.Element | null {\n const pathRef = useRef<SVGPathElement>(null);\n const sourceNode = useMemo(\n () => findNodeOrAreaDecorator(cells, edge.source),\n [cells, edge.source]\n );\n const targetNode = useMemo(\n () => findNodeOrAreaDecorator(cells, edge.target),\n [cells, edge.target]\n );\n const lineConf = useMemo(() => lineConfMap.get(edge)!, [edge, lineConfMap]);\n\n const parallelGap = useMemo(() => {\n const hasOppositeEdge = cells.some(\n (cell) =>\n isEdgeCell(cell) &&\n cell.source === edge.target &&\n cell.target === edge.source\n );\n return hasOppositeEdge ? lineConf.parallelGap : 0;\n }, [cells, edge, lineConf.parallelGap]);\n\n const padding = 5;\n const line = useMemo(\n () =>\n sourceNode &&\n targetNode &&\n sourceNode.view.x != null &&\n targetNode.view.x != null\n ? getDirectLinePoints(\n nodeViewToNodeRect(sourceNode.view, padding),\n nodeViewToNodeRect(targetNode.view, padding),\n parallelGap\n )\n : null,\n [parallelGap, sourceNode, targetNode]\n );\n\n if (!line) {\n // This happens when source or target is not found,\n // or when source or target has not been positioned yet.\n return null;\n }\n const d = `M${line[0].x} ${line[0].y}L${line[1].x} ${line[1].y}`;\n return (\n <>\n <path\n // This `path` is made for expanding interaction area of graph lines.\n d={d}\n fill=\"none\"\n stroke=\"transparent\"\n strokeWidth={lineConf.interactStrokeWidth}\n />\n <path\n ref={pathRef}\n className={classNames(\"line\", {\n dashed: lineConf.dashed,\n [`${lineConf.dashed ? \"dashed\" : \"solid\"}-animation`]:\n lineConf.animate.useAnimate,\n })}\n style={\n {\n \"--time\": `${lineConf.animate.duration ?? DEFAULT_LINE_INTERACT_ANIMATE_DURATION}s`,\n \"--solid-length\": pathRef.current?.getTotalLength?.(),\n } as React.CSSProperties\n }\n d={d}\n fill=\"none\"\n stroke={lineConf.strokeColor}\n strokeWidth={lineConf.strokeWidth}\n markerStart={lineConf.showStartArrow ? lineConf.markerArrow : \"\"}\n markerEnd={lineConf.showEndArrow ? lineConf.markerArrow : \"\"}\n />\n <path className=\"line-active-bg\" d={d} fill=\"none\" />\n </>\n );\n}\n\nfunction nodeViewToNodeRect(view: NodeView, padding: number): NodeRect {\n return {\n x: view.x + view.width / 2,\n y: view.y + view.height / 2,\n width: view.width + padding,\n height: view.height + padding,\n };\n}\n","import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { ReactUseBrick } from \"@next-core/react-runtime\";\nimport { __secret_internals, checkIfByTransform } from \"@next-core/runtime\";\nimport { isEqual } from \"lodash\";\nimport ResizeObserver from \"resize-observer-polyfill\";\nimport type { NodeBrickCell, NodeBrickConf, NodeCell } from \"./interfaces\";\nimport type { SizeTuple } from \"../diagram/interfaces\";\n\nexport interface NodeComponentProps {\n node: NodeCell;\n degraded: boolean;\n degradedNodeLabel?: string;\n defaultNodeBricks?: NodeBrickConf[];\n onResize(id: string, size: SizeTuple | null): void;\n}\n\nexport function NodeComponent({\n node,\n degraded,\n degradedNodeLabel,\n defaultNodeBricks,\n onResize,\n}: NodeComponentProps): JSX.Element | null {\n const memoizedData = useDeepMemo({ node: { id: node.id, data: node.data } });\n const specifiedUseBrick = (node as NodeBrickCell).useBrick;\n const observerRef = useRef<ResizeObserver | null>(null);\n\n const useBrick = useMemo(() => {\n return degraded\n ? null\n : specifiedUseBrick ??\n defaultNodeBricks?.find((item) =>\n checkIfByTransform(item, memoizedData)\n )?.useBrick;\n }, [degraded, specifiedUseBrick, defaultNodeBricks, memoizedData]);\n\n const label = useMemo<string>(\n () =>\n degraded\n ? String(\n __secret_internals.legacyDoTransform(\n memoizedData,\n degradedNodeLabel ?? \"<% DATA.node.id %>\"\n )\n )\n : \"\",\n [degraded, degradedNodeLabel, memoizedData]\n );\n\n const refCallback = useCallback(\n (element: HTMLElement | null) => {\n const prevObserver = observerRef.current;\n if (prevObserver) {\n prevObserver.disconnect();\n observerRef.current = null;\n }\n if (element) {\n // Todo: correctly wait for `useBrick` in v3 to be rendered (after layout)\n // Wait a macro task to let `useBrick` to be rendered.\n setTimeout(() => {\n const observer = new ResizeObserver(() => {\n onResize(node.id, [element.offsetWidth, element.offsetHeight]);\n });\n observer.observe(element);\n observerRef.current = observer;\n });\n } else {\n onResize(node.id, null);\n }\n },\n [node.id, onResize]\n );\n\n const degradedRefCallBack = useCallback(\n (g: SVGGElement | null) => {\n if (g) {\n // istanbul ignore next\n const size =\n process.env.NODE_ENV === \"test\"\n ? { width: 60, height: 60 }\n : g.getBBox();\n onResize(node.id, [size.width, size.height]);\n } else {\n onResize(node.id, null);\n }\n },\n [node.id, onResize]\n );\n\n return useBrick ? (\n <foreignObject\n // Make a large size to avoid the brick inside to be clipped by the foreignObject.\n width={9999}\n height={9999}\n className=\"node\"\n >\n {useBrick && (\n <ReactUseBrick\n useBrick={useBrick}\n data={memoizedData}\n refCallback={refCallback}\n />\n )}\n </foreignObject>\n ) : degraded ? (\n <g className=\"degraded\" ref={degradedRefCallBack}>\n <circle cx={8} cy={8} r={8} />\n <text x={8} y={32}>\n {label}\n </text>\n </g>\n ) : null;\n}\n\nfunction useDeepMemo<T>(value: T): T {\n const [memoizedValue, setMemoizedValue] = useState(value);\n\n useEffect(() => {\n setMemoizedValue((prev) => (isEqual(prev, value) ? prev : value));\n }, [value]);\n\n return memoizedValue;\n}\n","import { pick } from \"lodash\";\nimport type { ActiveTarget, Cell } from \"../interfaces\";\n\nexport function cellToTarget(cell: Cell): ActiveTarget {\n return cell.type === \"edge\"\n ? pick(cell, [\"type\", \"source\", \"target\", \"data\"])\n : pick(cell, [\"type\", \"id\", \"data\"]);\n}\n","import type { PositionTuple } from \"../../diagram/interfaces\";\nimport type { ActiveTarget, Cell, LayoutType } from \"../interfaces\";\nimport type {\n MoveCellPayload,\n ResizeCellPayload,\n} from \"../reducers/interfaces\";\nimport { isEdgeCell, isNodeCell } from \"./asserts\";\nimport { cellToTarget } from \"./cellToTarget\";\n\nexport function handleMouseDown(\n event: MouseEvent,\n {\n action,\n cell,\n scale,\n layout,\n onCellMoving,\n onCellMoved,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n }: {\n action: \"move\" | \"resize\";\n cell: Cell;\n scale: number;\n layout?: LayoutType;\n onCellMoving?(info: MoveCellPayload): void;\n onCellMoved?(info: MoveCellPayload): void;\n onCellResizing?(info: ResizeCellPayload): void;\n onCellResized?(info: ResizeCellPayload): void;\n onSwitchActiveTarget?(activeTarget: ActiveTarget | null): void;\n }\n) {\n event.stopPropagation();\n // Drag node\n onSwitchActiveTarget?.(cellToTarget(cell));\n\n if (\n isEdgeCell(cell) ||\n ((layout === \"force\" || layout === \"dagre\") && isNodeCell(cell))\n ) {\n return;\n }\n\n const from: PositionTuple = [event.clientX, event.clientY];\n const original =\n action === \"move\"\n ? [cell.view.x, cell.view.y]\n : [cell.view.width, cell.view.height];\n\n function getMovement(e: MouseEvent): PositionTuple {\n return [(e.clientX - from[0]) / scale, (e.clientY - from[1]) / scale];\n }\n\n let moved = false;\n\n const handleMove = (e: MouseEvent, finished?: boolean) => {\n // Respect the scale\n const movement = getMovement(e);\n if (!moved) {\n moved = movement[0] ** 2 + movement[1] ** 2 >= 9;\n }\n // const [x, y] = getNewPosition(movement);\n // adjustCellPosition(x, y);\n if (moved) {\n if (action === \"move\") {\n (finished ? onCellMoved : onCellMoving)?.({\n type: cell.type,\n id: cell.id,\n x: original[0] + movement[0],\n y: original[1] + movement[1],\n });\n } else {\n (finished ? onCellResized : onCellResizing)?.({\n type: cell.type,\n id: cell.id,\n width: original[0] + movement[0],\n height: original[1] + movement[1],\n });\n }\n }\n };\n\n const onMouseMove = (e: MouseEvent) => {\n handleMove(e);\n };\n const onMouseUp = (e: MouseEvent) => {\n handleMove(e, true);\n moved = false;\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mouseup\", onMouseUp);\n };\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n}\n","import React, { useEffect } from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { handleMouseDown } from \"../processors/handleMouseDown\";\n\nexport function DecoratorArea({\n cell,\n transform,\n readOnly,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n}: BasicDecoratorProps): JSX.Element {\n const resizeHandleRef = React.useRef<SVGGElement>(null);\n\n useEffect(() => {\n const resizeHandle = resizeHandleRef.current;\n if (!resizeHandle || readOnly) {\n return;\n }\n const onMouseDown = (event: MouseEvent) => {\n handleMouseDown(event, {\n action: \"resize\",\n cell,\n scale: transform.k,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n });\n };\n resizeHandle.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n resizeHandle.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [\n cell,\n onCellResized,\n onCellResizing,\n onSwitchActiveTarget,\n readOnly,\n transform.k,\n ]);\n\n return (\n <g className=\"decorator-area\">\n <rect\n width={cell.view.width}\n height={cell.view.height}\n className=\"area\"\n />\n {!readOnly && (\n <g\n ref={resizeHandleRef}\n className=\"resize-handle\"\n transform={`translate(${cell.view.width - 20} ${cell.view.height - 20})`}\n >\n <rect width={20} height={20} />\n <path d=\"M10 18L18 10 M15 18L18 15\" />\n </g>\n )}\n </g>\n );\n}\n","import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport classNames from \"classnames\";\n\nexport type DecoratorTextProps = Pick<\n BasicDecoratorProps,\n \"cell\" | \"readOnly\" | \"onDecoratorTextEditing\" | \"onDecoratorTextChange\"\n>;\n\nexport function DecoratorText({\n cell,\n readOnly,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n}: DecoratorTextProps): JSX.Element {\n const label = cell.view.text ?? \"\";\n const [currentLabel, setCurrentLabel] = useState<string>(label);\n const [editingLabel, setEditingLabel] = useState(false);\n const editingLabelInitialized = useRef(false);\n const [shouldEmitLabelChange, setShouldEmitLabelChange] = useState(false);\n const ref = useRef<HTMLDivElement>(null);\n\n const handleEnableEdit = useCallback(\n (e: React.MouseEvent) => {\n if (readOnly) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n setEditingLabel(true);\n },\n [readOnly]\n );\n\n useEffect(() => {\n const element = ref.current;\n if (element && element.textContent !== currentLabel) {\n element.textContent = currentLabel;\n }\n }, [currentLabel]);\n\n useEffect(() => {\n if (editingLabel && ref.current) {\n ref.current.focus();\n selectAllText(ref.current);\n }\n onDecoratorTextEditing?.({ id: cell.id, editing: editingLabel });\n }, [cell.id, editingLabel, onDecoratorTextEditing]);\n\n useEffect(() => {\n if (editingLabelInitialized.current) {\n onDecoratorTextEditing?.({ id: cell.id, editing: editingLabel });\n } else {\n editingLabelInitialized.current = true;\n }\n }, [cell.id, editingLabel, onDecoratorTextEditing]);\n\n const handleInput = useCallback(\n (event: React.FormEvent<HTMLDivElement>) => {\n if (readOnly) {\n return;\n }\n setCurrentLabel((event.target as HTMLDivElement).textContent!);\n },\n [readOnly]\n );\n\n const handleBlur = useCallback(() => {\n if (readOnly) {\n return;\n }\n setEditingLabel(false);\n setShouldEmitLabelChange(true);\n }, [readOnly]);\n\n useEffect(() => {\n if (shouldEmitLabelChange) {\n onDecoratorTextChange?.({\n id: cell.id,\n view: { ...cell.view, text: currentLabel },\n });\n setShouldEmitLabelChange(false);\n }\n }, [cell, currentLabel, onDecoratorTextChange, shouldEmitLabelChange]);\n\n return (\n <foreignObject className=\"decorator-text\">\n <div\n className={classNames(\"text-container\", { editing: editingLabel })}\n onDoubleClick={handleEnableEdit}\n >\n <div\n className=\"text\"\n contentEditable={editingLabel}\n ref={ref}\n onInput={handleInput}\n onBlur={handleBlur}\n />\n </div>\n </foreignObject>\n );\n}\n\nfunction selectAllText(element: HTMLElement) {\n const range = document.createRange();\n range.selectNodeContents(element);\n const selection = window.getSelection()!;\n selection.removeAllRanges();\n selection.addRange(range);\n}\n","import React from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { DecoratorArea } from \"./DecoratorArea\";\nimport { DecoratorText } from \"./DecoratorText\";\n\nexport function DecoratorComponent({\n cell,\n transform,\n readOnly,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n}: BasicDecoratorProps): JSX.Element | null {\n let SpecifiedComponent: (props: BasicDecoratorProps) => JSX.Element | null;\n\n switch (cell.decorator) {\n case \"area\":\n SpecifiedComponent = DecoratorArea;\n break;\n case \"text\":\n SpecifiedComponent = DecoratorText;\n break;\n // istanbul ignore next\n default:\n // eslint-disable-next-line no-console\n console.error(`Unknown decorator: ${cell.decorator}`);\n return null;\n }\n\n return (\n <SpecifiedComponent\n cell={cell}\n transform={transform}\n readOnly={readOnly}\n onCellResizing={onCellResizing}\n onCellResized={onCellResized}\n onSwitchActiveTarget={onSwitchActiveTarget}\n onDecoratorTextEditing={onDecoratorTextEditing}\n onDecoratorTextChange={onDecoratorTextChange}\n />\n );\n}\n","import React, { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport classNames from \"classnames\";\nimport type {\n ActiveTarget,\n Cell,\n CellContextMenuDetail,\n ComputedEdgeLineConf,\n DecoratorTextChangeDetail,\n EdgeCell,\n LayoutType,\n NodeBrickConf,\n} from \"./interfaces\";\nimport { isDecoratorCell, isEdgeCell, isNodeCell } from \"./processors/asserts\";\nimport { EdgeComponent } from \"./EdgeComponent\";\nimport { NodeComponent } from \"./NodeComponent\";\nimport { handleMouseDown } from \"./processors/handleMouseDown\";\nimport type { MoveCellPayload, ResizeCellPayload } from \"./reducers/interfaces\";\nimport { DecoratorComponent } from \"./decorators\";\nimport { cellToTarget } from \"./processors/cellToTarget\";\nimport type { SizeTuple, TransformLiteral } from \"../diagram/interfaces\";\nimport { sameTarget } from \"./processors/sameTarget\";\n\nexport interface CellComponentProps {\n layout: LayoutType;\n cell: Cell;\n cells: Cell[];\n degraded: boolean;\n degradedNodeLabel?: string;\n defaultNodeBricks?: NodeBrickConf[];\n transform: TransformLiteral;\n lineConfMap: WeakMap<EdgeCell, ComputedEdgeLineConf>;\n active: boolean;\n readOnly?: boolean;\n unrelatedCells: Cell[];\n onCellMoving?(info: MoveCellPayload): void;\n onCellMoved?(info: MoveCellPayload): void;\n onCellResizing?(info: ResizeCellPayload): void;\n onCellResized?(info: ResizeCellPayload): void;\n onSwitchActiveTarget(target: ActiveTarget | null): void;\n onCellContextMenu(detail: CellContextMenuDetail): void;\n onCellClick?(detail: CellContextMenuDetail): void;\n onDecoratorTextEditing?(detail: { id: string; editing: boolean }): void;\n onDecoratorTextChange?(detail: DecoratorTextChangeDetail): void;\n onNodeBrickResize(id: string, size: SizeTuple | null): void;\n onCellMouseEnter?(cell: Cell): void;\n onCellMouseLeave?(cell: Cell): void;\n}\n\nexport function CellComponent({\n layout,\n cell,\n cells,\n degraded,\n degradedNodeLabel,\n defaultNodeBricks,\n lineConfMap,\n active,\n readOnly,\n transform,\n unrelatedCells,\n onCellMoving,\n onCellMoved,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onCellContextMenu,\n onCellClick,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n onNodeBrickResize,\n onCellMouseEnter,\n onCellMouseLeave,\n}: CellComponentProps): JSX.Element | null {\n const gRef = useRef<SVGGElement>(null);\n\n const unrelated = useMemo(\n () => unrelatedCells.some((item) => sameTarget(item, cell)),\n [cell, unrelatedCells]\n );\n\n useEffect(() => {\n const g = gRef.current;\n if (!g) {\n return;\n }\n const onMouseDown = (event: MouseEvent) => {\n if (readOnly) {\n event.stopPropagation();\n } else {\n handleMouseDown(event, {\n layout,\n action: \"move\",\n cell,\n scale: transform.k,\n onCellMoving,\n onCellMoved,\n onSwitchActiveTarget,\n });\n }\n };\n g.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n g.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [\n layout,\n cell,\n onCellMoved,\n onCellMoving,\n onSwitchActiveTarget,\n readOnly,\n transform.k,\n ]);\n\n const handleContextMenu = useCallback(\n (event: React.MouseEvent<SVGGElement>) => {\n if (readOnly && cell.type === \"decorator\") {\n return;\n }\n event.preventDefault();\n onSwitchActiveTarget(cellToTarget(cell));\n onCellContextMenu({\n cell,\n clientX: event.clientX,\n clientY: event.clientY,\n });\n },\n [cell, onCellContextMenu, onSwitchActiveTarget, readOnly]\n );\n\n const handleCellClick = useCallback(\n (event: React.MouseEvent<SVGGElement>) => {\n if (!onCellClick || cell.type === \"decorator\") {\n return;\n }\n onCellClick({\n cell,\n clientX: event.clientX,\n clientY: event.clientY,\n });\n },\n [cell, onCellClick]\n );\n\n const handleMouseEnter = useCallback(() => {\n onCellMouseEnter?.(cell);\n }, [cell, onCellMouseEnter]);\n\n const handleMouseLeave = useCallback(() => {\n onCellMouseLeave?.(cell);\n }, [cell, onCellMouseLeave]);\n\n return (\n <g\n className={classNames(\"cell\", {\n active,\n faded: unrelated,\n \"read-only\": readOnly,\n })}\n ref={gRef}\n transform={\n cell.type === \"edge\" || cell.view.x == null\n ? undefined\n : `translate(${cell.view.x} ${cell.view.y})`\n }\n onContextMenu={handleContextMenu}\n onClick={handleCellClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n {isNodeCell(cell) ? (\n <NodeComponent\n node={cell}\n degraded={degraded}\n degradedNodeLabel={degradedNodeLabel}\n defaultNodeBricks={defaultNodeBricks}\n onResize={onNodeBrickResize}\n />\n ) : isEdgeCell(cell) ? (\n <EdgeComponent edge={cell} cells={cells} lineConfMap={lineConfMap} />\n ) : isDecoratorCell(cell) ? (\n <DecoratorComponent\n cell={cell}\n transform={transform}\n readOnly={readOnly}\n onCellResizing={onCellResizing}\n onCellResized={onCellResized}\n onSwitchActiveTarget={onSwitchActiveTarget}\n onDecoratorTextEditing={onDecoratorTextEditing}\n onDecoratorTextChange={onDecoratorTextChange}\n />\n ) : null}\n </g>\n );\n}\n","export const SYMBOL_FOR_SIZE_INITIALIZED = Symbol.for(\"size-initialized\");\nexport const SYMBOL_FOR_LAYOUT_INITIALIZED = Symbol.for(\"layout-initialized\");\nexport const DEFAULT_NODE_SIZE = 20;\nexport const DEFAULT_NODE_GAP = 36;\nexport const DEFAULT_AREA_WIDTH = 100;\nexport const DEFAULT_AREA_HEIGHT = 60;\nexport const DEFAULT_SCALE_RANGE_MIN = 0.5;\nexport const DEFAULT_SCALE_RANGE_MAX = 2;\nexport const DEFAULT_LINE_STROKE_COLOR = \"gray\";\nexport const DEFAULT_LINE_STROKE_WIDTH = 1;\nexport const DEFAULT_LINE_INTERACT_STROKE_WIDTH = 15;\nexport const DEFAULT_LINE_INTERACT_SHOW_START_ARROW = false;\nexport const DEFAULT_LINE_INTERACT_SHOW_END_ARROW = true;\nexport const DEFAULT_LINE_INTERACT_ANIMATE_DURATION = 1;\nexport const DEFAULT_DEGRADED_THRESHOLD = 500;\n","import type {\n Cell,\n DecoratorCell,\n EdgeCell,\n InitialCell,\n InitialNodeCell,\n NodeCell,\n} from \"../interfaces\";\n\nexport function isNodeCell(cell: Cell): cell is NodeCell {\n return cell.type === \"node\";\n}\n\nexport function isDecoratorCell(cell: Cell): cell is DecoratorCell {\n return cell.type === \"decorator\";\n}\n\nexport function isInitialNodeCell(cell: InitialCell): cell is InitialNodeCell {\n return cell.type === \"node\";\n}\n\nexport function isEdgeCell(cell: Cell): cell is EdgeCell {\n return cell.type === \"edge\";\n}\n\nexport function isNodeOrEdgeCell(cell: Cell): cell is NodeCell | EdgeCell {\n return cell.type === \"node\" || cell.type === \"edge\";\n}\n\nexport function isNodeOrAreaDecoratorCell(\n cell: Cell\n): cell is NodeCell | DecoratorCell {\n return (\n cell.type === \"node\" ||\n (cell.type === \"decorator\" && cell.decorator === \"area\")\n );\n}\n","import type { ActiveTarget, Cell, ConnectLineState } from \"../interfaces\";\nimport { sameTarget } from \"./sameTarget\";\n\nexport function getUnrelatedCells(\n cells: Cell[],\n connectLineState: ConnectLineState | null,\n activeTarget: ActiveTarget | null,\n allowEdgeToArea?: boolean\n): Cell[] {\n const unrelated: Cell[] = [];\n if (connectLineState) {\n const existedTargets = new Set<string>();\n for (const cell of cells) {\n if (cell.type === \"edge\" && cell.source === connectLineState.source.id) {\n existedTargets.add(cell.target);\n }\n }\n for (const cell of cells) {\n switch (cell.type) {\n case \"node\":\n if (existedTargets.has(cell.id)) {\n unrelated.push(cell);\n }\n break;\n case \"decorator\":\n if (\n !allowEdgeToArea ||\n cell.decorator == \"text\" ||\n existedTargets.has(cell.id)\n ) {\n unrelated.push(cell);\n }\n break;\n default:\n unrelated.push(cell);\n }\n }\n } else {\n switch (activeTarget?.type) {\n case \"node\": {\n const nodesMap = new Map<string, Cell>();\n const relatedNodeIds = new Set<string>([activeTarget.id]);\n for (const cell of cells) {\n if (cell.type === \"node\") {\n nodesMap.set(cell.id, cell);\n } else if (cell.type === \"edge\") {\n if (cell.source === activeTarget.id) {\n relatedNodeIds.add(cell.target);\n } else if (cell.target === activeTarget.id) {\n relatedNodeIds.add(cell.source);\n } else {\n unrelated.push(cell);\n }\n } else {\n unrelated.push(cell);\n }\n }\n for (const [id, cell] of nodesMap) {\n if (!relatedNodeIds.has(id)) {\n unrelated.push(cell);\n }\n }\n break;\n }\n\n case \"edge\":\n for (const cell of cells) {\n if (\n !(cell.type === \"edge\"\n ? sameTarget(cell, activeTarget)\n : cell.type === \"node\" &&\n (cell.id === activeTarget.source ||\n cell.id === activeTarget.target))\n ) {\n unrelated.push(cell);\n }\n }\n break;\n }\n }\n\n return unrelated;\n}\n","import type { SizeTuple } from \"../../diagram/interfaces\";\nimport type { Cell, InitialCell, NodeCell } from \"../interfaces\";\nimport { isInitialNodeCell } from \"./asserts\";\n\nexport function initializeCells(\n initialCells: InitialCell[] | undefined,\n {\n defaultNodeSize,\n }: {\n defaultNodeSize: SizeTuple;\n }\n): Cell[] {\n const originalCells = initialCells ?? [];\n const finalCells: Cell[] = originalCells.map<Cell>((cell) => {\n if (\n !isInitialNodeCell(cell) ||\n (cell.view?.width !== undefined && cell.view?.height !== undefined)\n ) {\n return cell as NodeCell;\n }\n return {\n ...cell,\n view: {\n width: defaultNodeSize[0],\n height: defaultNodeSize[1],\n ...cell.view,\n },\n } as NodeCell;\n });\n return finalCells;\n}\n","import type {\n ActiveTarget,\n ActiveTargetOfEdge,\n ActiveTargetOfNode,\n} from \"../interfaces\";\n\nexport function sameTarget(\n a: ActiveTarget | null | undefined,\n b: ActiveTarget | null | undefined\n): boolean {\n return a\n ? !!b &&\n a.type === b.type &&\n (a.type === \"node\" || a.type === \"decorator\"\n ? a.id === (b as ActiveTargetOfNode).id\n : a.source === (b as ActiveTargetOfEdge).source &&\n a.target === (b as ActiveTargetOfEdge).target)\n : !b;\n}\n","import type { TransformLiteral } from \"../../diagram/interfaces\";\nimport type { Cell } from \"../interfaces\";\nimport { isEdgeCell } from \"./asserts\";\n\nexport interface TransformToCenterOptions {\n canvasWidth: number;\n canvasHeight: number;\n scaleRange?: [min: number, max: number];\n}\n\nexport function transformToCenter(\n cells: Cell[],\n { canvasWidth, canvasHeight, scaleRange }: TransformToCenterOptions\n): TransformLiteral {\n let left = Infinity;\n let top = Infinity;\n let right = -Infinity;\n let bottom = -Infinity;\n let empty = true;\n for (const cell of cells) {\n if (!isEdgeCell(cell)) {\n empty = false;\n const { view } = cell;\n const r = view.x + view.width;\n const b = view.y + view.height;\n if (view.x < left) {\n left = view.x;\n }\n if (r > right) {\n right = r;\n }\n if (view.y < top) {\n top = view.y;\n }\n if (b > bottom) {\n bottom = b;\n }\n }\n }\n\n const width = right - left;\n const height = bottom - top;\n\n const scale =\n scaleRange && !empty && (width > canvasWidth || height > canvasHeight)\n ? Math.max(\n Math.min(canvasWidth / width, canvasHeight / height, scaleRange[1]),\n scaleRange[0]\n )\n : 1;\n\n const x = empty ? 0 : (canvasWidth - width * scale) / 2 - left * scale;\n const y = empty ? 0 : (canvasHeight - height * scale) / 2 - top * scale;\n\n return { x, y, k: scale };\n}\n","import { without } from \"lodash\";\nimport type {\n RangeTuple,\n SizeTuple,\n TransformLiteral,\n} from \"../../diagram/interfaces\";\nimport { DEFAULT_NODE_GAP, SYMBOL_FOR_SIZE_INITIALIZED } from \"../constants\";\nimport type {\n Cell,\n InitialCell,\n LayoutType,\n NodeCell,\n NodeId,\n NodeView,\n} from \"../interfaces\";\nimport { isDecoratorCell, isEdgeCell, isNodeCell } from \"./asserts\";\nimport { initializeCells } from \"./initializeCells\";\nimport { transformToCenter } from \"./transformToCenter\";\nimport { forceLayout } from \"../../shared/canvas/forceLayout\";\nimport { dagreLayout } from \"../../shared/canvas/dagreLayout\";\n\nexport function updateCells({\n cells,\n layout,\n previousCells,\n defaultNodeSize,\n canvasWidth,\n canvasHeight,\n scaleRange,\n transform,\n reason,\n parent,\n}: {\n cells: InitialCell[] | undefined;\n layout?: LayoutType;\n previousCells: Cell[];\n defaultNodeSize: SizeTuple;\n canvasWidth: number;\n canvasHeight: number;\n scaleRange: RangeTuple;\n transform: TransformLiteral;\n reason?: \"add-related-nodes\";\n parent?: NodeId;\n}): {\n cells: Cell[];\n updated: Cell[];\n shouldReCenter: boolean;\n} {\n const isManualLayout = layout !== \"force\" && layout !== \"dagre\";\n const newCells = initializeCells(cells, { defaultNodeSize });\n const updateCandidates: NodeCell[] = [];\n let shouldReCenter = false;\n\n const previousSizeInitializedNodes = new Map<string, NodeCell>();\n let previousShouldCentered = false;\n for (const cell of previousCells) {\n if (isDecoratorCell(cell)) {\n previousShouldCentered = true;\n } else if (isNodeCell(cell)) {\n previousShouldCentered = true;\n if (cell[SYMBOL_FOR_SIZE_INITIALIZED]) {\n previousSizeInitializedNodes.set(cell.id, cell);\n }\n }\n }\n\n const nodesMap = new Map<string, NodeCell>();\n for (const cell of newCells) {\n if (isNodeCell(cell)) {\n nodesMap.set(cell.id, cell);\n const previousNode = previousSizeInitializedNodes.get(cell.id);\n if (previousNode) {\n cell.view.width = previousNode.view.width;\n cell.view.height = previousNode.view.height;\n cell[SYMBOL_FOR_SIZE_INITIALIZED] = true;\n }\n }\n }\n\n let handled = false;\n\n if (reason === \"add-related-nodes\" && parent) {\n // Place these unpositioned downstream nodes below the parent node, and\n // on the right side of the positioned siblings.\n const downstreamNodeIds = new Set<string>();\n for (const cell of newCells) {\n if (\n isEdgeCell(cell) &&\n cell.source === parent &&\n cell.target !== parent\n ) {\n downstreamNodeIds.add(cell.target);\n }\n }\n const parentNode = nodesMap.get(parent);\n if (parentNode?.view.x !== undefined && parentNode.view.y !== undefined) {\n handled = true;\n const downstreamNodes = [...downstreamNodeIds]\n .map((id) => nodesMap.get(id))\n .filter(Boolean) as NodeCell[];\n let rightMostNode: NodeCell | undefined = undefined;\n for (const node of downstreamNodes) {\n if (node.view.x !== undefined && node.view.y !== undefined) {\n // Find the rightmost node that is below the parent node.\n if (\n (!rightMostNode || node.view.x > rightMostNode.view.x) &&\n node.view.y > parentNode.view.y\n ) {\n rightMostNode = node;\n }\n } else {\n // Unpositioned nodes\n updateCandidates.push(node);\n }\n }\n if (updateCandidates.length > 0 && isManualLayout) {\n let nextX: number;\n let nextY: number;\n if (rightMostNode) {\n // Place unpositioned nodes on the right side of the rightmost positioned siblings.\n nextX =\n rightMostNode.view.x + rightMostNode.view.width + DEFAULT_NODE_GAP;\n nextY = rightMostNode.view.y;\n } else {\n // If there are no positioned siblings, just place them below the parent.\n const totalWidth = updateCandidates.reduce(\n (acc, node) => acc + node.view.width + DEFAULT_NODE_GAP,\n -DEFAULT_NODE_GAP\n );\n nextX =\n parentNode.view.x - totalWidth / 2 + parentNode.view.width / 2;\n nextY = parentNode.view.y + parentNode.view.height + DEFAULT_NODE_GAP;\n }\n for (const node of updateCandidates) {\n node.view.x = nextX;\n node.view.y = nextY;\n nextX += node.view.width + DEFAULT_NODE_GAP;\n }\n }\n }\n }\n\n if (!handled) {\n // By default, place unpositioned nodes in a grid.\n let maxWidth = defaultNodeSize[0];\n let maxHeight = defaultNodeSize[1];\n const positionedNodes: NodeCell[] = [];\n let hasDecorators = false;\n for (const cell of newCells) {\n if (isNodeCell(cell)) {\n if (cell.view.width > maxWidth) {\n maxWidth = cell.view.width;\n }\n if (cell.view.height > maxHeight) {\n maxHeight = cell.view.height;\n }\n if (cell.view.x === undefined || cell.view.y === undefined) {\n updateCandidates.push(cell);\n } else {\n positionedNodes.push(cell);\n }\n } else if (isDecoratorCell(cell)) {\n hasDecorators = true;\n }\n }\n\n if (isManualLayout) {\n if (!previousShouldCentered) {\n // If the previous cells are not centered, use the centered transform instead.\n transform = transformToCenter(without(newCells, ...updateCandidates), {\n canvasWidth,\n canvasHeight,\n scaleRange,\n });\n }\n\n let getNodeView: (id: NodeId) => NodeView;\n\n // If there is no positioned nodes, or only one while without decorators,\n // then there is no relative positions, we can place the nodes with dagre layout.\n // Otherwise, use the force layout.\n if (\n positionedNodes.length === 0 ||\n (positionedNodes.length === 1 && !hasDecorators)\n ) {\n // The positioned node (if exists) will be updated.\n updateCandidates.push(...positionedNodes);\n ({ getNodeView } = dagreLayout({ cells: newCells }));\n // Only re-center when there is no cells previous.\n shouldReCenter = previousCells.length === 0;\n } else {\n ({ getNodeView } = forceLayout({\n cells: newCells,\n fixedPosition: true,\n center: [\n (canvasWidth / 2 - transform.x) / transform.k,\n (canvasHeight / 2 - transform.y) / transform.k,\n ],\n }));\n }\n\n for (const cell of newCells) {\n if (isNodeCell(cell)) {\n const view = getNodeView(cell.id);\n cell.view.x = view.x;\n cell.view.y = view.y;\n }\n }\n }\n }\n\n return { cells: newCells, updated: updateCandidates, shouldReCenter };\n}\n","import type { Reducer } from \"react\";\nimport type { DrawCanvasAction } from \"./interfaces\";\nimport type { Cell, NodeCell } from \"../interfaces\";\nimport { isNodeCell } from \"../processors/asserts\";\nimport { SYMBOL_FOR_SIZE_INITIALIZED } from \"../constants\";\n\nexport const cells: Reducer<Cell[], DrawCanvasAction> = (state, action) => {\n switch (action.type) {\n case \"drop-node\":\n return insertCellAfter(\n state,\n action.payload,\n (cell) => !(cell.type === \"decorator\" && cell.decorator === \"text\")\n );\n case \"drop-decorator\": {\n if (action.payload.decorator === \"text\") {\n return [...state, action.payload];\n }\n return insertCellAfter(\n state,\n action.payload,\n (cell) => cell.type === \"decorator\" && cell.decorator === \"area\"\n );\n }\n case \"add-nodes\": {\n const index =\n state.findLastIndex(\n (cell) => !(cell.type === \"decorator\" && cell.decorator === \"text\")\n ) + 1;\n return [\n ...state.slice(0, index),\n ...action.payload,\n ...state.slice(index),\n ];\n }\n case \"add-edge\":\n // Add the edge to just next to the previous last edge or area decorator.\n // If not found, append to the start.\n return insertCellAfter(\n state,\n action.payload,\n (cell) =>\n cell.type === \"edge\" ||\n (cell.type === \"decorator\" && cell.decorator === \"area\")\n );\n case \"move-cell\": {\n const { type, id, x, y } = action.payload;\n const index = state.findIndex(\n (cell) => cell.type === type && cell.id === id\n );\n if (index !== -1) {\n const node = state[index] as NodeCell;\n return [\n ...state.slice(0, index),\n { ...node, view: { ...node.view, x, y } },\n ...state.slice(index + 1),\n ];\n }\n return state;\n }\n case \"resize-cell\": {\n const { type, id, width, height } = action.payload;\n const index = state.findIndex(\n (cell) => cell.type === type && cell.id === id\n );\n if (index !== -1) {\n const node = state[index] as NodeCell;\n return [\n ...state.slice(0, index),\n { ...node, view: { ...node.view, width, height } },\n ...state.slice(index + 1),\n ];\n }\n return state;\n }\n case \"update-cells\":\n return action.payload;\n case \"update-node-size\":\n return state.map((cell) =>\n isNodeCell(cell) && cell.id === action.payload.id\n ? {\n ...cell,\n [SYMBOL_FOR_SIZE_INITIALIZED]: true,\n view: action.payload.size\n ? {\n ...cell.view,\n width: action.payload.size[0],\n height: action.payload.size[1],\n }\n : cell.view,\n }\n : cell\n );\n }\n return state;\n};\n\nfunction insertCellAfter(\n cells: Cell[],\n newCell: Cell,\n after: (cell: Cell) => boolean\n) {\n const index = cells.findLastIndex(after) + 1;\n return [...cells.slice(0, index), newCell, ...cells.slice(index)];\n}\n","import { Reducer } from \"react\";\nimport type { DrawCanvasAction, DrawCanvasState } from \"./interfaces\";\nimport { cells } from \"./cells\";\nimport { layoutKey } from \"./layoutKey\";\n\ntype ReducersMapObject<S, A> = {\n [K in keyof S]: Reducer<S[K], A>;\n};\n\nfunction combineReducers<S, A>(\n reducers: ReducersMapObject<S, A>\n): Reducer<S, A> {\n return ((state, action) =>\n Object.fromEntries(\n Object.entries<Reducer<any, A>>(reducers).map(([key, value]) => [\n key,\n value(state[key as keyof S], action),\n ])\n )) as Reducer<S, A>;\n}\n\nexport const rootReducer = combineReducers<DrawCanvasState, DrawCanvasAction>({\n cells,\n layoutKey,\n});\n","import type { Reducer } from \"react\";\nimport type { DrawCanvasAction } from \"./interfaces\";\n\nexport const layoutKey: Reducer<number, DrawCanvasAction> = (state, action) => {\n switch (action.type) {\n case \"update-node-size\":\n return action.layoutKey;\n default:\n return state;\n }\n};\n","import * as React from \"react\";\nconst SvgCenter = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={24} height={24} viewBox=\"0 0 24 24\" {...props}><path d=\"M12 0a.5.5 0 0 1 .5.5v2.013a9.5 9.5 0 0 1 8.987 8.988L23.5 11.5a.5.5 0 0 1 0 1h-2.013a9.5 9.5 0 0 1-8.987 8.987V23.5a.5.5 0 0 1-1 0v-2.013A9.5 9.5 0 0 1 2.514 12.5H.5a.5.5 0 0 1 0-1h2.013A9.5 9.5 0 0 1 11.5 2.514V.5A.5.5 0 0 1 12 0M3.514 11.5H7.5a.5.5 0 0 1 0 1H3.514a8.5 8.5 0 0 0 7.987 7.986L11.5 16.5a.5.5 0 0 1 1 0v3.986a8.5 8.5 0 0 0 7.986-7.986H16.5a.5.5 0 0 1 0-1h3.986A8.5 8.5 0 0 0 12.5 3.515V7.5a.5.5 0 0 1-1 0V3.514a8.5 8.5 0 0 0-7.986 7.987zm8.486-1a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3\" /></svg>;\nexport default SvgCenter;","import * as React from \"react\";\nconst SvgZoomIn = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={128} height={128} className=\"icon\" viewBox=\"0 0 1024 1024\" {...props}><path d=\"M512 76.8A435.2 435.2 0 1 0 947.2 512 435.71 435.71 0 0 0 512 76.8m0 819.2a384 384 0 1 1 384-384 384 384 0 0 1-384 384\" /><path d=\"M744.448 486.4h-204.8V281.6a25.6 25.6 0 1 0-51.2 0v204.8h-204.8a25.6 25.6 0 0 0 0 51.2h204.8v204.8a25.6 25.6 0 0 0 51.2 0V537.6h204.8a25.6 25.6 0 0 0 0-51.2\" /></svg>;\nexport default SvgZoomIn;","import * as React from \"react\";\nconst SvgZoomOut = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={128} height={128} className=\"icon\" viewBox=\"0 0 1024 1024\" {...props}><path d=\"M512 76.8A435.2 435.2 0 1 0 947.2 512 435.71 435.71 0 0 0 512 76.8m0 819.2a384 384 0 1 1 384-384 384 384 0 0 1-384 384\" /><path d=\"M744.448 486.4H280.064a25.6 25.6 0 1 0 0 51.2h464.384a25.6 25.6 0 0 0 0-51.2\" /></svg>;\nexport default SvgZoomOut;","import React, { useCallback, useMemo, useRef } from \"react\";\nimport { ConfigProvider, Slider, theme } from \"antd\";\nimport { StyleProvider, createCache } from \"@ant-design/cssinjs\";\nimport { useCurrentTheme } from \"@next-core/react-runtime\";\nimport type { RangeTuple } from \"../../diagram/interfaces\";\nimport CenterSVG from \"./icons/center.svg\";\nimport ZoomInSVG from \"./icons/zoom-in.svg\";\nimport ZoomOutSVG from \"./icons/zoom-out.svg\";\n\nexport interface ZoomBarComponentProps {\n shadowRoot: ShadowRoot;\n scale: number;\n scaleRange: RangeTuple;\n onZoomChange(value: number): void;\n onReCenter(): void;\n}\n\nexport function ZoomBarComponent({\n shadowRoot,\n scale,\n scaleRange,\n onZoomChange,\n onReCenter,\n}: ZoomBarComponentProps): JSX.Element | null {\n const currentTheme = useCurrentTheme();\n const cache = useMemo(() => createCache(), []);\n const zoomBarRef = useRef<HTMLDivElement | null>(null);\n const min = scaleRange[0] * 100;\n const max = scaleRange[1] * 100;\n const value = scale * 100;\n const step = 5;\n\n const tooltip = useMemo(() => {\n return {\n formatter: (value: number | undefined) => `${value}%`,\n placement: \"left\" as const,\n getPopupContainer: () => zoomBarRef.current!,\n };\n }, []);\n\n const onZoomIn = useCallback(() => {\n onZoomChange(Math.min(value + step, max));\n }, [max, onZoomChange, value]);\n\n const onZoomOut = useCallback(() => {\n onZoomChange(Math.max(value - step, min));\n }, [min, onZoomChange, value]);\n\n return (\n <ConfigProvider\n theme={{\n algorithm:\n currentTheme === \"dark-v2\"\n ? theme.darkAlgorithm\n : theme.defaultAlgorithm,\n }}\n >\n <StyleProvider\n container={shadowRoot}\n // Auto clear injected styles after unmount\n autoClear\n cache={cache}\n // Set hashPriority to \"high\" to disable `:where()` usage for compatibility\n hashPriority=\"high\"\n >\n <div className=\"zoom-bar\" ref={zoomBarRef}>\n <div className=\"center-button\" onClick={onReCenter} role=\"button\">\n <CenterSVG />\n </div>\n <div className=\"zoom-slider\">\n <div className=\"zoom-button\" role=\"button\" onClick={onZoomIn}>\n <ZoomInSVG />\n </div>\n <Slider\n min={min}\n max={max}\n value={value}\n step={step}\n vertical\n included={false}\n tooltip={tooltip}\n onChange={onZoomChange}\n />\n <div className=\"zoom-button\" role=\"button\" onClick={onZoomOut}>\n <ZoomOutSVG />\n </div>\n </div>\n </div>\n </StyleProvider>\n </ConfigProvider>\n );\n}\n","import { pick } from \"lodash\";\nimport dagre from \"@dagrejs/dagre\";\nimport { extractPartialRectTuple } from \"../../diagram/processors/extractPartialRectTuple\";\nimport type {\n Cell,\n ForceNode,\n LayoutOptionsDagre,\n NodeId,\n NodeView,\n} from \"../../draw-canvas/interfaces\";\nimport { isEdgeCell, isNodeCell } from \"../../draw-canvas/processors/asserts\";\nimport type { FullRectTuple } from \"../../diagram/interfaces\";\n\nexport interface DagreLayoutOptions {\n cells: Cell[];\n layoutOptions?: LayoutOptionsDagre;\n}\n\nexport function dagreLayout({ cells, layoutOptions }: DagreLayoutOptions): {\n getNodeView: (id: NodeId) => NodeView;\n nodePaddings: FullRectTuple;\n} {\n const { nodePadding, ...dagreGraphOptions } = {\n nodePadding: 0,\n rankdir: \"TB\",\n ranksep: 50,\n edgesep: 10,\n nodesep: 50,\n // align: undefined,\n ...pick(layoutOptions, [\n \"nodePadding\",\n \"rankdir\",\n \"ranksep\",\n \"edgesep\",\n \"nodesep\",\n \"align\",\n ]),\n };\n const nodePaddings = extractPartialRectTuple(nodePadding);\n\n if (!cells.some(isNodeCell)) {\n // Dagre cannot render empty nodes\n return {\n getNodeView: () => null!,\n nodePaddings,\n };\n }\n\n const graph = new dagre.graphlib.Graph<ForceNode>();\n graph.setGraph(dagreGraphOptions);\n // Default to assigning a new object as a label for each new edge.\n graph.setDefaultEdgeLabel(function () {\n return {};\n });\n for (const cell of cells) {\n if (isNodeCell(cell)) {\n graph.setNode(cell.id, {\n id: cell.id,\n width: cell.view.width + nodePaddings[1] + nodePaddings[3],\n height: cell.view.height + nodePaddings[0] + nodePaddings[2],\n });\n } else if (isEdgeCell(cell)) {\n graph.setEdge(cell.source, cell.target);\n }\n }\n dagre.layout(graph);\n\n return {\n getNodeView: (id: NodeId) => graph.node(id),\n nodePaddings,\n };\n}\n","import { pick } from \"lodash\";\nimport {\n forceCollide,\n forceLink,\n forceManyBody,\n forceSimulation,\n forceX,\n forceY,\n type Simulation,\n} from \"d3-force\";\nimport type {\n Cell,\n ForceCollideOptions,\n ForceLink,\n ForceNode,\n LayoutOptionsForce,\n NodeId,\n NodeView,\n} from \"../../draw-canvas/interfaces\";\nimport { isEdgeCell, isNodeCell } from \"../../draw-canvas/processors/asserts\";\nimport { extractPartialRectTuple } from \"../../diagram/processors/extractPartialRectTuple\";\nimport type { FullRectTuple, PositionTuple } from \"../../diagram/interfaces\";\n\nexport interface ForceLayoutOptions {\n cells: Cell[];\n layoutOptions?: LayoutOptionsForce;\n center?: PositionTuple;\n fixedPosition?: boolean;\n}\n\nexport function forceLayout({\n cells,\n layoutOptions,\n center,\n fixedPosition,\n}: ForceLayoutOptions): {\n getNodeView: (id: NodeId) => NodeView;\n nodePaddings: FullRectTuple;\n} {\n const { nodePadding, collide } = {\n nodePadding: 0,\n ...pick(layoutOptions, [\"nodePadding\"]),\n collide:\n layoutOptions?.collide !== false\n ? ({\n radiusDiff: 18,\n strength: 1,\n iterations: 1,\n ...(layoutOptions?.collide === true\n ? null\n : (layoutOptions?.collide as ForceCollideOptions)),\n } as Required<ForceCollideOptions>)\n : (false as const),\n };\n const nodePaddings = extractPartialRectTuple(nodePadding);\n const forceNodes: ForceNode[] = [];\n const forceLinks: ForceLink[] = [];\n const nodesMap = new Map<NodeId, ForceNode>();\n for (const cell of cells) {\n if (isNodeCell(cell)) {\n const node: ForceNode = {\n id: cell.id,\n width: cell.view.width + nodePaddings[1] + nodePaddings[3],\n height: cell.view.height + nodePaddings[0] + nodePaddings[2],\n ...(fixedPosition ? { fx: cell.view.x, fy: cell.view.y } : null),\n };\n forceNodes.push(node);\n nodesMap.set(node.id, node);\n } else if (isEdgeCell(cell)) {\n forceLinks.push({ source: cell.source, target: cell.target });\n }\n }\n\n const linkSimulation = forceLink<ForceNode, ForceLink>(forceLinks).id(\n (d) => d.id\n );\n const simulation = forceSimulation<ForceNode, ForceLink>(forceNodes)\n .force(\"link\", linkSimulation)\n .force(\"x\", forceX(center?.[0]))\n .force(\"y\", forceY(center?.[1]))\n .force(\"charge\", forceManyBody());\n\n if (collide) {\n simulation.force(\n \"collide\",\n forceCollide<ForceNode>()\n .radius(\n (d) =>\n Math.sqrt(d.width ** 2 + d.height ** 2) / 2 + collide.radiusDiff\n )\n .strength(collide.strength)\n .iterations(collide.iterations)\n );\n }\n\n simulation.stop();\n manuallyTickToTheEnd(simulation);\n\n return {\n getNodeView: (id: NodeId) => nodesMap.get(id) as NodeView,\n nodePaddings,\n };\n}\n\nfunction manuallyTickToTheEnd(\n simulation: Simulation<ForceNode, ForceLink>\n): void {\n // Manually tick to the end.\n simulation.tick(\n Math.ceil(\n Math.log(simulation.alphaMin()) / Math.log(1 - simulation.alphaDecay())\n )\n );\n}\n","import React, { useEffect, useRef, useState } from \"react\";\nimport type { ActiveTarget } from \"../../draw-canvas/interfaces\";\nimport { sameTarget } from \"../../draw-canvas/processors/sameTarget\";\n\nexport interface UseActiveTargetOptions {\n cellsRef: React.RefObject<SVGGElement>;\n activeTarget?: ActiveTarget | null;\n onActiveTargetChange(target: ActiveTarget | null): void;\n}\n\nexport type UseActiveTargetResult = ActiveTarget | null;\n\nexport function useActiveTarget({\n cellsRef,\n activeTarget: _activeTarget,\n onActiveTargetChange,\n}: UseActiveTargetOptions): UseActiveTargetResult {\n const newActiveTarget = _activeTarget ?? null;\n const [activeTarget, setActiveTarget] = useState<ActiveTarget | null>(\n newActiveTarget\n );\n\n useEffect(() => {\n setActiveTarget((previous) =>\n sameTarget(previous, newActiveTarget) ? previous : newActiveTarget\n );\n }, [newActiveTarget]);\n\n const activeTargetChangeInitialized = useRef(false);\n useEffect(() => {\n if (!activeTargetChangeInitialized.current) {\n activeTargetChangeInitialized.current = true;\n return;\n }\n onActiveTargetChange(activeTarget);\n }, [activeTarget, onActiveTargetChange]);\n\n useEffect(() => {\n if (!activeTarget) {\n return;\n }\n const resetActiveTarget = (e: MouseEvent) => {\n const path = e.composedPath();\n const cellsContainerIndex = path.indexOf(cellsRef.current!);\n // Reset active target to null when clicking outside of the cells container,\n // Or inside the cells container but not on any cell.\n if (cellsContainerIndex <= 0) {\n setActiveTarget(null);\n }\n };\n document.addEventListener(\"click\", resetActiveTarget);\n return () => {\n document.removeEventListener(\"click\", resetActiveTarget);\n };\n }, [activeTarget, cellsRef]);\n\n return activeTarget;\n}\n","import type { AlignOrigin, NormalizedAlignOrigin } from \"../interfaces\";\n\nconst KeywordMap = new Map([\n [\"center\", 0.5],\n [\"left\", 0],\n [\"right\", 1],\n [\"top\", 0],\n [\"bottom\", 1],\n]);\n\nexport function normalizeAlignOrigin(\n alignOrigin: AlignOrigin | undefined\n): NormalizedAlignOrigin {\n const origin = alignOrigin ?? [0.5, 0.5];\n return [\n normalizeAlignAxis(origin[0], \"x\"),\n normalizeAlignAxis(origin[1], \"y\"),\n ];\n}\n\nfunction normalizeAlignAxis(value: string | number, axis: \"x\" | \"y\"): number {\n if (typeof value === \"string\") {\n const newX = KeywordMap.get(value);\n if (newX !== undefined) {\n return newX;\n }\n const matches = value.match(/^(-?\\d+(?:\\.\\d+)?)%$/);\n if (matches) {\n return Number(matches[1]) / 100;\n }\n // eslint-disable-next-line no-console\n console.error(\"Unexpected align origin %s:\", axis, value);\n } else if (typeof value === \"number\") {\n return value;\n } else {\n // eslint-disable-next-line no-console\n console.error(\n \"Unexpected align origin %s, expected %s, received %s:\",\n axis,\n \"string | number\",\n typeof value,\n value\n );\n }\n\n return 0.5;\n}\n","import { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { ZoomBehavior } from \"d3-zoom\";\nimport type {\n Cell,\n LayoutOptions,\n LayoutOptionsForce,\n LayoutOptionsDagre,\n LayoutType,\n NodeId,\n NodeView,\n} from \"../../draw-canvas/interfaces\";\nimport type { FullRectTuple, RangeTuple } from \"../../diagram/interfaces\";\nimport { useAutoCenter } from \"./useAutoCenter\";\nimport {\n isNodeCell,\n isNodeOrEdgeCell,\n} from \"../../draw-canvas/processors/asserts\";\nimport {\n SYMBOL_FOR_LAYOUT_INITIALIZED,\n SYMBOL_FOR_SIZE_INITIALIZED,\n} from \"../../draw-canvas/constants\";\nimport type { DrawCanvasAction } from \"../../draw-canvas/reducers/interfaces\";\nimport { forceLayout } from \"./forceLayout\";\nimport { dagreLayout } from \"./dagreLayout\";\nimport { normalizeAlignOrigin } from \"../../draw-canvas/processors/normalizeAlignOrigin\";\n\nexport interface UseLayoutOptions {\n layout: LayoutType;\n layoutOptions?: LayoutOptions;\n rootRef: React.RefObject<SVGSVGElement>;\n cells: Cell[];\n zoomable?: boolean;\n zoomer: ZoomBehavior<SVGSVGElement, unknown>;\n scaleRange: RangeTuple;\n layoutKey: number;\n dispatch: (value: DrawCanvasAction) => void;\n}\n\nexport function useLayout({\n layout,\n layoutOptions,\n rootRef,\n cells,\n zoomable,\n zoomer,\n scaleRange,\n layoutKey,\n dispatch,\n}: UseLayoutOptions) {\n const [layoutInitialized, setLayoutInitialized] = useState(\n layout !== \"force\" && layout !== \"dagre\"\n );\n\n const layoutKeyRef = useRef(layoutKey);\n\n const getNextLayoutKey = useCallback(() => {\n return ++layoutKeyRef.current;\n }, []);\n\n const [centered, setCentered] = useAutoCenter({\n rootRef,\n layoutInitialized,\n cells,\n zoomable,\n zoomer,\n scaleRange,\n });\n\n const previousLayoutRef = useRef<Cell[] | null>(null);\n\n useEffect(() => {\n // Wait for all nodes to be size-initialized before layout.\n if (\n cells.some(\n (cell) => isNodeCell(cell) && !cell[SYMBOL_FOR_SIZE_INITIALIZED]\n ) ||\n // Skip layout if no cells.\n cells.length === 0\n ) {\n return;\n }\n\n if (layout !== \"force\" && layout !== \"dagre\") {\n setLayoutInitialized(true);\n return;\n }\n\n // DO NOT re-layout if layout key mismatched.\n // DO NOT re-layout if nodes and edges not changed.\n if (\n layoutKeyRef.current !== layoutKey ||\n isSameArray(previousLayoutRef.current, cells.filter(isNodeOrEdgeCell))\n ) {\n // Layout key mismatch happens when this effect is performed after\n // update-node-size dispatched but not yet applied.\n // If didn't ignore mismatched layout, it will cause the update-cells\n // action overwrites those update-node-size actions.\n return;\n }\n\n let getNodeView: (id: NodeId) => NodeView;\n let nodePaddings: FullRectTuple;\n\n if (layout === \"force\") {\n ({ getNodeView, nodePaddings } = forceLayout({\n cells,\n layoutOptions: layoutOptions as LayoutOptionsForce,\n }));\n } else {\n ({ getNodeView, nodePaddings } = dagreLayout({\n cells,\n layoutOptions: layoutOptions as LayoutOptionsDagre,\n }));\n }\n\n const alignOrigin = normalizeAlignOrigin(layoutOptions?.alignOrigin);\n\n const newCells: Cell[] = cells.map((cell) => {\n if (isNodeCell(cell)) {\n const nodeView = getNodeView(cell.id);\n return {\n ...cell,\n view: {\n ...cell.view,\n x: nodeView.x! - nodeView.width * alignOrigin[0] + nodePaddings[3],\n y: nodeView.y! - nodeView.height * alignOrigin[1] + nodePaddings[0],\n },\n [SYMBOL_FOR_LAYOUT_INITIALIZED]: true,\n };\n }\n return cell;\n });\n previousLayoutRef.current = newCells.filter(isNodeOrEdgeCell);\n\n dispatch({ type: \"update-cells\", payload: newCells });\n // setCentered(false);\n setLayoutInitialized(true);\n }, [cells, dispatch, layout, layoutKey, layoutOptions /* , setCentered */]);\n\n return { centered, setCentered, getNextLayoutKey };\n}\n\nfunction isSameArray<T = unknown>(a: T[] | null, b: T[]): boolean {\n return a?.length === b.length && a.every((v, i) => v === b[i]);\n}\n","import React, { useEffect, useState } from \"react\";\nimport { select } from \"d3-selection\";\nimport { ZoomTransform, type ZoomBehavior } from \"d3-zoom\";\nimport type { RangeTuple } from \"../../diagram/interfaces\";\nimport { SYMBOL_FOR_SIZE_INITIALIZED } from \"../../draw-canvas/constants\";\nimport type { Cell } from \"../../draw-canvas/interfaces\";\nimport {\n isDecoratorCell,\n isNodeCell,\n} from \"../../draw-canvas/processors/asserts\";\nimport { transformToCenter } from \"../../draw-canvas/processors/transformToCenter\";\n\nexport interface UseAutoCenterOptions {\n rootRef: React.RefObject<SVGSVGElement>;\n cells: Cell[];\n layoutInitialized: boolean;\n zoomable?: boolean;\n zoomer: ZoomBehavior<SVGSVGElement, unknown>;\n scaleRange: RangeTuple;\n}\n\nexport type UseAutoCenterResult = [\n centered: boolean,\n setCentered: React.Dispatch<React.SetStateAction<boolean>>,\n];\n\nexport function useAutoCenter({\n rootRef,\n cells,\n layoutInitialized,\n zoomable,\n zoomer,\n scaleRange,\n}: UseAutoCenterOptions): UseAutoCenterResult {\n const [centered, setCentered] = useState(false);\n\n useEffect(() => {\n const root = rootRef.current;\n if (\n !root ||\n !layoutInitialized ||\n centered ||\n !cells.some((cell) => isNodeCell(cell) || isDecoratorCell(cell)) ||\n cells.some(\n (cell) => isNodeCell(cell) && !cell[SYMBOL_FOR_SIZE_INITIALIZED]\n )\n ) {\n return;\n }\n const { k, x, y } = transformToCenter(cells, {\n canvasWidth: root.clientWidth,\n canvasHeight: root.clientHeight,\n scaleRange: zoomable ? scaleRange : undefined,\n });\n // istanbul ignore next\n if (process.env.NODE_ENV !== \"test\") {\n // jsdom doesn't support svg baseVal yet.\n // https://github.com/jsdom/jsdom/issues/2531\n zoomer.transform(select(root), new ZoomTransform(k, x, y));\n }\n setCentered(true);\n }, [\n cells,\n centered,\n layoutInitialized,\n rootRef,\n scaleRange,\n zoomable,\n zoomer,\n ]);\n\n useEffect(() => {\n // Reset auto centering when nodes and decorators are all removed.\n if (!cells.some((cell) => isNodeCell(cell) || isDecoratorCell(cell))) {\n setCentered(false);\n }\n }, [cells]);\n\n return [centered, setCentered];\n}\n","import { useMemo } from \"react\";\nimport { __secret_internals, checkIfByTransform } from \"@next-core/runtime\";\nimport { findIndex, isUndefined, omitBy } from \"lodash\";\nimport type {\n Cell,\n ComputedEdgeLineConf,\n EdgeCell,\n EdgeLineConf,\n LineMarker,\n} from \"../../draw-canvas/interfaces\";\nimport { isEdgeCell } from \"../../draw-canvas/processors/asserts\";\nimport {\n DEFAULT_LINE_STROKE_COLOR,\n DEFAULT_LINE_STROKE_WIDTH,\n DEFAULT_LINE_INTERACT_STROKE_WIDTH,\n DEFAULT_LINE_INTERACT_SHOW_START_ARROW,\n DEFAULT_LINE_INTERACT_SHOW_END_ARROW,\n DEFAULT_LINE_INTERACT_ANIMATE_DURATION,\n} from \"../../draw-canvas/constants\";\n\nexport interface UseLineMarkersOptions {\n cells: Cell[];\n defaultEdgeLines: EdgeLineConf[] | undefined;\n markerPrefix: string;\n}\n\nexport function useLineMarkers({\n cells,\n defaultEdgeLines,\n markerPrefix,\n}: UseLineMarkersOptions): [\n lineConfMap: WeakMap<EdgeCell, ComputedEdgeLineConf>,\n markers: LineMarker[],\n] {\n return useMemo(() => {\n // Always put the default stroke marker at the first position,\n // since the connecting line will use it.\n const markers: LineMarker[] = [{ strokeColor: DEFAULT_LINE_STROKE_COLOR }];\n const map = new WeakMap<EdgeCell, ComputedEdgeLineConf>();\n for (const cell of cells) {\n if (isEdgeCell(cell)) {\n const computedLineConf =\n __secret_internals.legacyDoTransform(\n { edge: cell },\n defaultEdgeLines?.find((item) =>\n checkIfByTransform(item, { edge: cell })\n )\n ) ?? {};\n const lineConf = {\n dashed: false,\n strokeColor: DEFAULT_LINE_STROKE_COLOR,\n strokeWidth: DEFAULT_LINE_STROKE_WIDTH,\n interactStrokeWidth: DEFAULT_LINE_INTERACT_STROKE_WIDTH,\n showStartArrow: DEFAULT_LINE_INTERACT_SHOW_START_ARROW,\n showEndArrow: DEFAULT_LINE_INTERACT_SHOW_END_ARROW,\n animate: {\n useAnimate: false,\n duration: DEFAULT_LINE_INTERACT_ANIMATE_DURATION,\n },\n ...omitBy(computedLineConf, isUndefined),\n } as ComputedEdgeLineConf;\n if (lineConf.parallelGap === undefined) {\n lineConf.parallelGap = lineConf.interactStrokeWidth;\n }\n const markerEndIndex = addMarker(\n { strokeColor: lineConf.strokeColor },\n markers\n );\n lineConf.markerArrow = `url(#${markerPrefix}${markerEndIndex})`;\n map.set(cell, lineConf);\n }\n }\n return [map, markers];\n }, [cells, defaultEdgeLines, markerPrefix]);\n}\n\nfunction addMarker(marker: LineMarker, markers: LineMarker[]): number {\n let markerIndex = findIndex(markers, marker);\n if (markerIndex === -1) {\n markerIndex = markers.push(marker) - 1;\n }\n return markerIndex;\n}\n","import { useMemo } from \"react\";\nimport type { Cell, LayoutType } from \"../../draw-canvas/interfaces\";\nimport { isNodeCell } from \"../../draw-canvas/processors/asserts\";\nimport {\n SYMBOL_FOR_LAYOUT_INITIALIZED,\n SYMBOL_FOR_SIZE_INITIALIZED,\n} from \"../../draw-canvas/constants\";\n\nexport interface UseReadyOptions {\n cells: Cell[];\n layout: LayoutType;\n centered: boolean;\n}\n\nexport function useReady({ cells, layout, centered }: UseReadyOptions) {\n const ready = useMemo(\n () =>\n centered &&\n cells.every(\n (cell) =>\n !isNodeCell(cell) ||\n (cell[SYMBOL_FOR_SIZE_INITIALIZED] &&\n ((layout !== \"force\" && layout !== \"dagre\") ||\n cell[SYMBOL_FOR_LAYOUT_INITIALIZED]))\n ),\n [cells, centered, layout]\n );\n return ready;\n}\n","import React, { useEffect, useMemo, useState } from \"react\";\nimport { select } from \"d3-selection\";\nimport { zoom, type ZoomBehavior } from \"d3-zoom\";\nimport type { RangeTuple, TransformLiteral } from \"../../diagram/interfaces\";\nimport {\n DEFAULT_SCALE_RANGE_MIN,\n DEFAULT_SCALE_RANGE_MAX,\n} from \"../../draw-canvas/constants\";\nimport type { ActiveTarget } from \"../../draw-canvas/interfaces\";\n\nexport interface UseZoomOptions {\n rootRef: React.RefObject<SVGSVGElement>;\n zoomable?: boolean;\n scrollable?: boolean;\n pannable?: boolean;\n draggable?: boolean;\n scaleRange?: RangeTuple;\n onSwitchActiveTarget?(target: ActiveTarget | null): void;\n}\n\nexport interface UseZoomResult {\n grabbing: boolean;\n transform: TransformLiteral;\n scaleRange: RangeTuple;\n zoomer: ZoomBehavior<SVGSVGElement, unknown>;\n}\n\nexport function useZoom({\n rootRef,\n zoomable,\n scrollable,\n pannable,\n draggable,\n scaleRange: _scaleRange,\n onSwitchActiveTarget,\n}: UseZoomOptions): UseZoomResult {\n const [grabbing, setGrabbing] = useState(false);\n const [transform, setTransform] = useState<TransformLiteral>({\n k: 1,\n x: 0,\n y: 0,\n });\n\n const scaleRange = useMemo(\n () =>\n _scaleRange ??\n ([DEFAULT_SCALE_RANGE_MIN, DEFAULT_SCALE_RANGE_MAX] as RangeTuple),\n [_scaleRange]\n );\n\n const zoomer = useMemo(() => zoom<SVGSVGElement, unknown>(), []);\n\n // istanbul ignore next: d3-zoom currently hard to test\n useEffect(() => {\n let moved = false;\n zoomer\n .scaleExtent(zoomable ? scaleRange : [1, 1])\n .on(\"start\", () => {\n moved = false;\n setGrabbing(true);\n })\n .on(\"zoom\", (e: { transform: TransformLiteral }) => {\n moved = true;\n setTransform(e.transform);\n })\n .on(\"end\", () => {\n setGrabbing(false);\n if (!moved) {\n onSwitchActiveTarget?.(null);\n }\n });\n }, [onSwitchActiveTarget, scaleRange, zoomable, zoomer]);\n\n // istanbul ignore next: d3-zoom currently hard to test\n useEffect(() => {\n const root = rootRef.current;\n if (!root) {\n return;\n }\n\n const rootSelection = select(root);\n\n const unsetZoom = () => {\n rootSelection\n .on(\".zoom\", null)\n .on(\".zoom.custom\", null)\n .on(\"wheel\", null);\n };\n\n if (!(zoomable || scrollable || pannable)) {\n unsetZoom();\n return;\n }\n\n if (zoomable || scrollable) {\n // Do not override default d3 zoom handler.\n // Only handles *panning*\n rootSelection.on(\n \"wheel.zoom.custom\",\n (e: WheelEvent & { wheelDeltaX: number; wheelDeltaY: number }) => {\n // Mac OS trackpad pinch event is emitted as a wheel.zoom and d3.event.ctrlKey set to true\n if (!e.ctrlKey) {\n // Stop immediate propagation for default d3 zoom handler\n e.stopImmediatePropagation();\n if (scrollable) {\n e.preventDefault();\n zoomer.translateBy(\n rootSelection,\n e.wheelDeltaX / 5,\n e.wheelDeltaY / 5\n );\n }\n }\n // zoomer.scaleBy(rootSelection, Math.pow(2, defaultWheelDelta(e)))\n }\n );\n }\n\n rootSelection\n .call(zoomer)\n .on(\"wheel\", (e: WheelEvent) => e.preventDefault())\n .on(\"dblclick.zoom\", null);\n\n if (!draggable || !pannable) {\n rootSelection.on(\"mousedown.zoom\", null);\n }\n\n if (!pannable) {\n rootSelection\n .on(\"touchstart.zoom\", null)\n .on(\"touchmove.zoom\", null)\n .on(\"touchend.zoom\", null);\n }\n\n return unsetZoom;\n }, [draggable, pannable, rootRef, scrollable, zoomable, zoomer]);\n\n return { grabbing, transform, zoomer, scaleRange };\n}\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.zoom-bar{position:absolute;bottom:20px;right:20px;width:40px}.zoom-slider,\n.center-button{width:100%;display:flex;align-items:center;border:1px solid var(--antd-background-color-base);border-radius:var(--larger-border-radius);box-shadow:var(--connected-overlay-shadow);background-color:var(--color-fill-bg-container-4)}.zoom-slider{height:140px;padding:8px 0;flex-direction:column}[role=\"button\"]{cursor:pointer}.center-button{justify-content:center;margin-bottom:8px;height:40px}.center-button:hover{border-color:var(--antd-btn-default-hover-border-color)}.center-button path{fill:var(--antd-link-hover-color)}.center-button:hover path{fill:var(--palette-blue-7)}.zoom-button{font-size:16px;line-height:0}.zoom-button svg{width:1em;height:1em;fill:var(--antd-link-hover-color)}.zoom-slider .ant-slider-vertical{padding-inline:5px}.zoom-slider .ant-slider-vertical .ant-slider-rail{width:2px}.zoom-slider .ant-slider-vertical .ant-slider-handle{width:6px;height:6px;inset-inline-start:3px}.zoom-slider .ant-slider .ant-slider-handle:hover::before,\n.zoom-slider .ant-slider .ant-slider-handle:focus::before,\n.zoom-slider .ant-slider .ant-slider-handle::before{width:10px;height:10px;inset-inline-start:-2px}.zoom-slider .ant-slider .ant-slider-handle:hover::after,\n.zoom-slider .ant-slider .ant-slider-handle:focus::after,\n.zoom-slider .ant-slider .ant-slider-handle::after{width:6px;height:6px;inset-block-start:0;inset-inline-start:0}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `*{box-sizing:border-box}:host{display:block;position:relative;overflow:hidden;--animation-dasharray:48;--stroke-dashoffset:96;--dasharray:4}:host,\n.root{width:100%;height:100%}:host([hidden]){display:none}.root{opacity:0}.root.ready{opacity:1}.root:focus{outline:none}@keyframes dashedAnimation{0%{stroke-dashoffset:var(--stroke-dashoffset)}to{stroke-dashoffset:0}}@keyframes solidAnimation{to{stroke-dashoffset:0}}.solid-animation{stroke-dasharray:var(--solid-length);stroke-dashoffset:var(--solid-length);animation:solidAnimation var(--time) linear infinite}.dashed-animation{animation:dashedAnimation var(--time) linear infinite}.decorator-area .area{fill:rgba(119,141,195,0.1);stroke:none;stroke-width:0}.node,\n.decorator-text{overflow:visible}.cell.active .decorator-area .area,\n.allowEdgeToArea:hover .decorator-area .area,\n.cell.active .line-active-bg{stroke:var(--palette-blue-5);stroke-dasharray:var(--dasharray);stroke-width:1}.cell:not(.read-only){-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-handle{cursor:nwse-resize;opacity:0}.resize-handle rect{fill:transparent;stroke:none}.resize-handle path{fill:none;stroke:var(--palette-gray-5);stroke-width:1.5}.cell.active .decorator-area .resize-handle,\n.decorator-area:hover .resize-handle{opacity:1}.connect-line{pointer-events:none}.connect-line:not(.connecting){display:none}.line.dashed{stroke-dasharray:var(--dasharray)}.cell.active .decorator-text .text-container{outline:1px dashed var(--palette-blue-5)}.decorator-text .text-container{width:-webkit-max-content;width:-moz-max-content;width:max-content;padding:0.5em}.decorator-text .text:focus{outline:none}.cell.faded{opacity:0.3}.cell .node{pointer-events:none}.cell .node > *{pointer-events:auto}.degraded{pointer-events:bounding-box}.degraded circle{fill:rgb(119,141,195)}.degraded text{text-anchor:middle;fill:var(--antd-text-color)}.cell.active .degraded circle,\n.cell.active .degraded text,\n.degraded:hover circle,\n.degraded:hover text{fill:var(--color-brand)}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n"],"names":["MarkerComponent","_ref","Component","id","type","strokeColor","EntityRelationZeroOrOneMarker","EntityRelationZeroOrManyMarker","ArrowMarker","React","_ref2","viewBox","refX","refY","markerWidth","markerHeight","orient","strokeLinejoin","d","stroke","strokeWidth","fill","_ref3","_ref4","getDirectLinePoints","source","target","parallelGap","doTwoNodesOverlap","p0","p1","xDiff","yDiff","dx","x","dy","y","angle","Math","atan2","cos","PI","sin","line","sourceIntersections","getIntersections","targetIntersections","length","rect","vertices","width","height","possibleLines","i","push","intersections","item","intersection","intersect","x1","y1","x2","y2","x3","y3","x4","y4","denominator","ua","ub","a","b","paddingA","paddingB","A","getNodesWithPadding","B","left","min","right","max","top","bottom","node","padding","extractPartialRectTuple","value","Array","isArray","v0","v1","findNodeOrAreaDecorator","cells","find","cell","isNodeOrAreaDecoratorCell","EdgeComponent","_lineConf$animate$dur","_pathRef$current","_pathRef$current$getT","edge","lineConfMap","pathRef","useRef","sourceNode","useMemo","targetNode","lineConf","get","some","isEdgeCell","view","nodeViewToNodeRect","concat","interactStrokeWidth","ref","className","classNames","dashed","animate","useAnimate","style","duration","DEFAULT_LINE_INTERACT_ANIMATE_DURATION","current","getTotalLength","call","markerStart","showStartArrow","markerArrow","markerEnd","showEndArrow","NodeComponent","degraded","degradedNodeLabel","defaultNodeBricks","onResize","memoizedData","memoizedValue","setMemoizedValue","useState","useEffect","prev","isEqual","useDeepMemo","data","specifiedUseBrick","useBrick","observerRef","_defaultNodeBricks$fi","checkIfByTransform","label","String","__secret_internals","legacyDoTransform","refCallback","useCallback","element","prevObserver","disconnect","setTimeout","observer","ResizeObserver","offsetWidth","offsetHeight","observe","degradedRefCallBack","g","size","getBBox","ReactUseBrick","cx","cy","r","cellToTarget","pick","handleMouseDown","event","action","scale","layout","onCellMoving","onCellMoved","onCellResizing","onCellResized","onSwitchActiveTarget","stopPropagation","isNodeCell","from","clientX","clientY","original","moved","handleMove","e","finished","movement","getMovement","onMouseMove","onMouseUp","document","removeEventListener","addEventListener","DecoratorArea","transform","readOnly","resizeHandleRef","resizeHandle","onMouseDown","k","DecoratorText","_cell$view$text","onDecoratorTextEditing","onDecoratorTextChange","text","currentLabel","setCurrentLabel","editingLabel","setEditingLabel","editingLabelInitialized","shouldEmitLabelChange","setShouldEmitLabelChange","handleEnableEdit","preventDefault","textContent","focus","range","createRange","selectNodeContents","selection","window","getSelection","removeAllRanges","addRange","selectAllText","editing","handleInput","handleBlur","_objectSpread","onDoubleClick","contentEditable","onInput","onBlur","DecoratorComponent","SpecifiedComponent","decorator","console","error","CellComponent","active","unrelatedCells","onCellContextMenu","onCellClick","onNodeBrickResize","onCellMouseEnter","onCellMouseLeave","gRef","unrelated","sameTarget","handleContextMenu","handleCellClick","handleMouseEnter","handleMouseLeave","faded","undefined","onContextMenu","onClick","onMouseEnter","onMouseLeave","isDecoratorCell","SYMBOL_FOR_SIZE_INITIALIZED","Symbol","for","SYMBOL_FOR_LAYOUT_INITIALIZED","DEFAULT_NODE_SIZE","DEFAULT_NODE_GAP","DEFAULT_AREA_WIDTH","DEFAULT_AREA_HEIGHT","DEFAULT_SCALE_RANGE_MIN","DEFAULT_SCALE_RANGE_MAX","DEFAULT_LINE_STROKE_COLOR","DEFAULT_LINE_STROKE_WIDTH","DEFAULT_LINE_INTERACT_STROKE_WIDTH","DEFAULT_LINE_INTERACT_SHOW_START_ARROW","DEFAULT_LINE_INTERACT_SHOW_END_ARROW","DEFAULT_DEGRADED_THRESHOLD","isInitialNodeCell","isNodeOrEdgeCell","getUnrelatedCells","connectLineState","activeTarget","allowEdgeToArea","existedTargets","Set","add","has","nodesMap","Map","relatedNodeIds","set","initializeCells","initialCells","defaultNodeSize","map","_cell$view","_cell$view2","transformToCenter","canvasWidth","canvasHeight","scaleRange","Infinity","empty","updateCells","previousCells","reason","parent","isManualLayout","newCells","updateCandidates","shouldReCenter","previousSizeInitializedNodes","previousShouldCentered","previousNode","handled","downstreamNodeIds","parentNode","downstreamNodes","filter","Boolean","rightMostNode","nextX","nextY","totalWidth","reduce","acc","getNodeView","maxWidth","maxHeight","positionedNodes","hasDecorators","without","dagreLayout","forceLayout","fixedPosition","center","updated","insertCellAfter","newCell","after","index","findLastIndex","slice","reducers","rootReducer","state","payload","findIndex","layoutKey","Object","fromEntries","entries","key","props","_extends","xmlns","ZoomBarComponent","shadowRoot","onZoomChange","onReCenter","currentTheme","useCurrentTheme","cache","createCache","zoomBarRef","tooltip","formatter","placement","getPopupContainer","onZoomIn","onZoomOut","ConfigProvider","theme","algorithm","darkAlgorithm","defaultAlgorithm","StyleProvider","container","autoClear","hashPriority","role","CenterSVG","ZoomInSVG","Slider","step","vertical","included","onChange","ZoomOutSVG","layoutOptions","_nodePadding$rankdir$","nodePadding","rankdir","ranksep","edgesep","nodesep","dagreGraphOptions","_objectWithoutProperties","_excluded","nodePaddings","graph","dagre","Graph","setGraph","setDefaultEdgeLabel","setNode","setEdge","collide","radiusDiff","strength","iterations","forceNodes","forceLinks","fx","fy","linkSimulation","forceLink","simulation","forceSimulation","force","forceX","forceY","forceManyBody","forceCollide","radius","sqrt","stop","tick","ceil","log","alphaMin","alphaDecay","manuallyTickToTheEnd","useActiveTarget","cellsRef","_activeTarget","onActiveTargetChange","newActiveTarget","setActiveTarget","previous","activeTargetChangeInitialized","resetActiveTarget","composedPath","indexOf","KeywordMap","normalizeAlignAxis","axis","newX","matches","match","Number","useLayout","rootRef","zoomable","zoomer","dispatch","layoutInitialized","setLayoutInitialized","layoutKeyRef","getNextLayoutKey","centered","setCentered","root","clientWidth","clientHeight","select","ZoomTransform","useAutoCenter","previousLayoutRef","every","v","alignOrigin","origin","normalizeAlignOrigin","nodeView","useLineMarkers","defaultEdgeLines","markerPrefix","markers","WeakMap","_loop","_secret_internals$le","computedLineConf","omitBy","isUndefined","markerEndIndex","marker","markerIndex","addMarker","useReady","useZoom","scrollable","pannable","draggable","_scaleRange","grabbing","setGrabbing","setTransform","zoom","scaleExtent","on","rootSelection","unsetZoom","ctrlKey","stopImmediatePropagation","translateBy","wheelDeltaX","wheelDeltaY","___CSS_LOADER_EXPORT___","module","toString"],"sourceRoot":""}
@@ -0,0 +1,3 @@
1
+ /*! For license information please see 9074.daf4e2c5.js.LICENSE.txt */
2
+ "use strict";(self.webpackChunk_next_bricks_diagram=self.webpackChunk_next_bricks_diagram||[]).push([[9074],{5576:(e,t,a)=>{a.r(t);var n,i,s,l,o,r,h,c,d,u,p,g,f,A,v,y,m,b,k,w,_,x,M,E,C,N,W,T,R,S,z,L,$,B,D,P,O,H,I,K,Y,U,j,V,X,q,Z,F,J,G,Q,ee,te,ae,ne,ie,se=a(4635),le=a(918),oe=a(6902),re=a(5536),he=a(6121),ce=a(829),de=a(2740),ue=a(8769),pe=a.n(ue),ge=a(7122),fe=a(6227),Ae=(a(6329),a(7566)),ve=a(1517),ye=a(3373),me=a.n(ye),be=a(1030),ke=a(9126),we=a(8892),_e=a(5157),xe=a(8308),Me=a(9576),Ee=a(9137),Ce=a(2547),Ne=a(1803),We=a(3739),Te=a(9191),Re=a(6671),Se=a(8060),ze=a(2448),Le=a(8657),$e=a(8069),Be=a(1324),De=a(821),Pe=a(9741),Oe=a(2673),He=a(5987),{defineElement:Ie,property:Ke,event:Ye,method:Ue}=(0,ge.createDecorators)(),je=(0,ue.forwardRef)(wt),Ve=new WeakMap,Xe=new WeakMap,qe=new WeakMap,Ze=new WeakMap,Fe=new WeakMap,Je=new WeakMap,Ge=new WeakMap,Qe=new WeakMap,et=new WeakMap,tt=new WeakMap,at=new WeakMap,nt=new WeakMap,it=new WeakMap,st=new WeakMap,lt=new WeakMap,ot=new WeakSet,rt=new WeakMap,ht=new WeakMap,ct=new WeakMap,dt=new WeakMap,ut=new WeakMap,pt=new WeakMap,gt=new WeakMap,ft=new WeakMap,At=new WeakMap,vt=new WeakMap,yt=new WeakMap,mt=new WeakMap,bt=new WeakMap;class kt extends fe.ReactNextElement{constructor(){super(...arguments),(0,se.A)(this,ot),(0,le.A)(this,Ve,(i(this),l(this))),(0,le.A)(this,Xe,(o(this),r(this))),(0,le.A)(this,qe,(h(this),c(this))),(0,le.A)(this,Ze,(d(this),u(this))),(0,le.A)(this,Fe,(p(this),g(this))),(0,le.A)(this,Je,(f(this),A(this))),(0,le.A)(this,Ge,(v(this),y(this))),(0,le.A)(this,Qe,(m(this),b(this))),(0,le.A)(this,et,(k(this),w(this))),(0,le.A)(this,tt,(_(this),x(this))),(0,le.A)(this,at,(M(this),E(this,!0))),(0,le.A)(this,nt,(C(this),N(this,!0))),(0,le.A)(this,it,(W(this),T(this,!0))),(0,le.A)(this,st,(R(this),S(this))),(0,le.A)(this,lt,(z(this),L(this))),(0,le.A)(this,rt,(D(this),e=>{(0,re.A)(ot,this,$).emit(e)})),(0,le.A)(this,ht,P(this)),(0,le.A)(this,ct,(I(this),e=>{(0,re.A)(ot,this,O).emit(e)})),(0,le.A)(this,dt,K(this)),(0,le.A)(this,ut,(j(this),e=>{(0,re.A)(ot,this,Y).emit(e)})),(0,le.A)(this,pt,V(this)),(0,le.A)(this,gt,(Z(this),e=>{(0,re.A)(ot,this,X).emit(e)})),(0,le.A)(this,ft,F(this)),(0,le.A)(this,At,(Q(this),e=>{(0,re.A)(ot,this,J).emit(e)})),(0,le.A)(this,vt,ee(this)),(0,le.A)(this,yt,(ne(this),e=>{(0,re.A)(ot,this,te).emit(e)})),(0,le.A)(this,mt,(e=>{(0,Oe.c)(e,this.activeTarget)||(this.activeTarget=e)})),(0,le.A)(this,bt,(0,ue.createRef)())}get layout(){return(0,ce.A)(Ve,this)}set layout(e){(0,he.A)(Ve,this,e)}get nodes(){return(0,ce.A)(Xe,this)}set nodes(e){(0,he.A)(Xe,this,e)}get edges(){return(0,ce.A)(qe,this)}set edges(e){(0,he.A)(qe,this,e)}get nodeBricks(){return(0,ce.A)(Ze,this)}set nodeBricks(e){(0,he.A)(Ze,this,e)}get lines(){return(0,ce.A)(Fe,this)}set lines(e){(0,he.A)(Fe,this,e)}get layoutOptions(){return(0,ce.A)(Je,this)}set layoutOptions(e){(0,he.A)(Je,this,e)}get activeTarget(){return(0,ce.A)(Ge,this)}set activeTarget(e){(0,he.A)(Ge,this,e)}get disableKeyboardAction(){return(0,ce.A)(Qe,this)}set disableKeyboardAction(e){(0,he.A)(Qe,this,e)}get connectNodes(){return(0,ce.A)(et,this)}set connectNodes(e){(0,he.A)(et,this,e)}get dragNodes(){return(0,ce.A)(tt,this)}set dragNodes(e){(0,he.A)(tt,this,e)}get zoomable(){return(0,ce.A)(at,this)}set zoomable(e){(0,he.A)(at,this,e)}get scrollable(){return(0,ce.A)(nt,this)}set scrollable(e){(0,he.A)(nt,this,e)}get pannable(){return(0,ce.A)(it,this)}set pannable(e){(0,he.A)(it,this,e)}get scaleRange(){return(0,ce.A)(st,this)}set scaleRange(e){(0,he.A)(st,this,e)}callOnLineLabel(e,t){for(var a,n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s];null===(a=(0,ce.A)(bt,this).current)||void 0===a||a.callOnLineLabel(e,t,...i)}render(){return pe().createElement(je,{ref:(0,ce.A)(bt,this),layout:this.layout,nodes:this.nodes,edges:this.edges,nodeBricks:this.nodeBricks,lines:this.lines,layoutOptions:this.layoutOptions,connectNodes:this.connectNodes,dragNodes:this.dragNodes,activeTarget:this.activeTarget,disableKeyboardAction:this.disableKeyboardAction,zoomable:this.zoomable,scrollable:this.scrollable,pannable:this.pannable,scaleRange:this.scaleRange,onActiveTargetChange:(0,ce.A)(rt,this),onSwitchActiveTarget:(0,ce.A)(mt,this),onNodeDelete:(0,ce.A)(ct,this),onEdgeDelete:(0,ce.A)(ut,this),onLineClick:(0,ce.A)(gt,this),onLineDoubleClick:(0,ce.A)(At,this),onNodesConnect:(0,ce.A)(yt,this)})}}function wt(e,t){var{layout:a,nodes:n,edges:i,nodeBricks:s,lines:l,layoutOptions:o,connectNodes:r,dragNodes:h,activeTarget:c,disableKeyboardAction:d,zoomable:u,scrollable:p,pannable:g,scaleRange:f,onActiveTargetChange:A,onSwitchActiveTarget:v,onNodeDelete:y,onEdgeDelete:m,onLineClick:b,onLineDoubleClick:k,onNodesConnect:w}=e,[_,x]=(0,ue.useState)(!1),[M,E]=(0,ue.useState)(0),[C,N]=(0,ue.useState)(null),[W,T]=(0,ue.useState)(!1),[R,S]=(0,ue.useState)(0),[z,L]=(0,ue.useState)(null),[$,B]=(0,ue.useState)([]),[D,P]=(0,ue.useState)(!1),[O,H]=(0,ue.useState)({k:1,x:0,y:0}),I=(0,ue.useRef)(new Map),K=(0,ue.useRef)(null),Y=(0,ue.useRef)(null),[U,j]=(0,ue.useState)(!1),{userViewReady:V,userViewNodesMap:X,saveUserView:q}=(0,Pe._)(null==h?void 0:h.save),[Z,F]=(0,ue.useState)([0,0]),[J,G]=(0,ue.useState)(null),[Q,ee]=(0,ue.useState)("initial"),[te,ae]=(0,ue.useState)(null);(0,ue.useImperativeHandle)(t,(()=>({callOnLineLabel(e,t){for(var a,n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s];null==z||null===(a=z.get(e))||void 0===a||null===(a=a.firstElementChild)||void 0===a||a[t](...i)}}))),(0,ue.useEffect)((()=>{var e=e=>{(0,ze.P)(e,{nodes:n,nodesRefRepository:C,connectNodes:r,dragNodes:h,scale:O.k,setConnectLineState:G,setConnectLineTo:F,setManualLayoutStatus:ee,setNodeMovement:ae,onSwitchActiveTarget:v,onNodesConnect:w})},t=Y.current;return null==t||t.addEventListener("mousedown",e),()=>{null==t||t.removeEventListener("mousedown",e)}}),[n,r,h,O.k,C,w,v]);var{normalizedLines:ne,normalizedLinesMap:ie,markers:se}=(0,ue.useMemo)((()=>(0,Ee.t)(i,l)),[i,l]),le=(0,ue.useMemo)((()=>ne.flatMap((e=>{var t,a,{line:{text:n,label:i,$id:s},edge:l}=e;return n||i?(i?(t="label",a=[].concat(i)):(t="text",a=[].concat(n)),a.map((e=>{var a;return{[t]:e,id:"".concat(s,"-").concat(null!==(a=e.placement)&&void 0!==a?a:"center"),edge:l}}))):[]}))),[ne]),{nodes:oe,edges:re}=(0,$e.o)({layout:a,nodes:n,edges:i,manualLayoutStatus:Q,userViewReady:V,userViewNodesMap:X,nodeMovement:te,nodesRefRepository:C,lineLabelsRefRepository:z,normalizedLinesMap:ie,layoutOptions:o,nodesRenderId:M,lineLabelsRenderId:R});(0,ue.useEffect)((()=>{"finished"===Q&&q(oe.map((e=>({id:e.id,x:e.x,y:e.y}))))}),[Q]);var he=(0,ue.useMemo)((()=>(0,Me.R)(re,oe,ne)),[ne,oe,re]),ce=null!=c?c:null,[de,ge]=(0,ue.useState)(ce);(0,ue.useEffect)((()=>{ge((e=>(0,Oe.c)(e,ce)?e:ce))}),[ce]);var fe=(0,ue.useRef)(!1);(0,ue.useEffect)((()=>{fe.current?null==A||A(de):fe.current=!0}),[de,A]),(0,ue.useEffect)((()=>{var e=K.current;if(e&&!d){var t=e=>{var t=(0,_e.a)(e,{renderedNodes:oe,activeTarget:de});"delete-node"===(null==t?void 0:t.action)?null==y||y(t.node):"delete-edge"===(null==t?void 0:t.action)?null==m||m(t.edge):"switch-active-node"===(null==t?void 0:t.action)&&t.node&&(null==v||v({type:"node",nodeId:t.node.id}))};return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}}),[de,oe,d,v,y,m]);var ye=(0,ue.useCallback)((e=>{e&&(E((e=>e+1)),N(e)),x((t=>t||!!e))}),[]),De=(0,ue.useCallback)((e=>{e&&(S((e=>e+1)),L(e)),T((t=>t||!!e))}),[]),Ie=(0,ue.useMemo)((()=>null!=f?f:[Le.sS,Le.Yt]),[f]),Ke=(0,ue.useMemo)((()=>(0,ve.s_)()),[]);(0,ue.useEffect)((()=>{var e=!1;Ke.scaleExtent(u?Ie:[1,1]).on("start",(()=>{e=!1,P(!0)})).on("zoom",(t=>{e=!0,H(t.transform)})).on("end",(()=>{P(!1),e||null==v||v(null)}))}),[v,Ie,u,Ke]),(0,ue.useEffect)((()=>{var e=K.current;if(e){var t=(0,Ae.A)(e),a=()=>{t.on(".zoom",null).on(".zoom.custom",null).on("wheel",null)};if(u||p||g)return(u||p)&&t.on("wheel.zoom.custom",(e=>{e.ctrlKey||(e.stopImmediatePropagation(),p&&(e.preventDefault(),Ke.translateBy(t,e.wheelDeltaX/5,e.wheelDeltaY/5)))})),t.call(Ke).on("wheel",(e=>e.preventDefault())).on("dblclick.zoom",null),g||t.on("mousedown.zoom",null).on("touchstart.zoom",null).on("touchmove.zoom",null).on("touchend.zoom",null),a;a()}}),[g,p,u,Ke]),(0,ue.useEffect)((()=>{var e=K.current;if(0!==oe.length&&e&&!U){var{k:t,x:a,y:n}=(0,xe.r)(oe,{canvasWidth:e.clientWidth,canvasHeight:e.clientHeight,scaleRange:u?Ie:void 0});Ke.transform((0,Ae.A)(e),new ve.uV(t,a,n)),j(!0)}}),[U,oe,Ie,u,Ke]);var Ye=(0,ue.useMemo)((()=>"".concat((0,be.uniqueId)("diagram-"),"-")),[]),Ue="".concat(Ye,"line-arrow-"),je="".concat(Ye,"mask-"),Ve="".concat(Ye,"active-line-");(0,ue.useEffect)((()=>{B((e=>(0,Se.z)(e,he,I.current)))}),[he]);var[Xe,qe]=pe().useState(new Map);return(0,ue.useEffect)((()=>{if(z){(0,Be.F)($,z);var e=new ke.A((()=>{qe((0,He.G)($,z))}));for(var t of z.values())e.observe(t);return()=>{e.disconnect()}}}),[R,z,$]),"dagre"!==a&&"force"!==a?pe().createElement("div",null,'Diagram layout not supported: "'.concat(a,'"')):pe().createElement("div",{className:me()("diagram",{ready:_&&U,grabbing:D,pannable:g}),tabIndex:-1,ref:K},pe().createElement("svg",{width:"100%",height:"100%",className:"lines"},pe().createElement("defs",null,se.map(((e,t)=>{var{type:a,strokeColor:n}=e;return pe().createElement(We.c,{key:t,id:"".concat(Ue).concat(t),type:a,strokeColor:n})})),[...Xe].map((e=>{var[t,a]=e;return pe().createElement(Te.y,{key:t,lineId:t,rects:a,maskPrefix:je,renderedLineLabels:$})})),pe().createElement("marker",{id:"".concat(Ve,"start"),viewBox:"0 0 8 8",refX:4,refY:4,markerWidth:8,markerHeight:8,orient:"auto"},pe().createElement("path",{d:"M 0.5 0.5 H 7.5 V 7.5 H 0.5 Z",stroke:"var(--palette-gray-7)",strokeWidth:1,fill:"var(--palette-gray-1)"})),pe().createElement("marker",{id:"".concat(Ve,"end"),viewBox:"0 0 14 8",refX:3,refY:4,markerWidth:14,markerHeight:8,orient:"auto"},pe().createElement("path",{d:"M 0.5 1.5 L 5.5 4 L 0.5 6.5 z",stroke:"var(--palette-blue-3)",strokeWidth:1,fill:"var(--palette-blue-3)"}),pe().createElement("path",{d:"M 6.5 0.5 H 13.5 V 7.5 H 6.5 Z",stroke:"var(--palette-gray-7)",strokeWidth:1,fill:"var(--palette-gray-1)"}))),pe().createElement("g",{transform:"translate(".concat(O.x," ").concat(O.y,") scale(").concat(O.k,")")},he.map((e=>pe().createElement(Ne.m,{key:e.line.$id,line:e,linePaths:I.current,lineMaskRects:Xe,maskPrefix:je,markerPrefix:Ue,activeLineMarkerPrefix:Ve,active:"edge"===(null==de?void 0:de.type)&&de.edge.source===e.edge.source&&de.edge.target===e.edge.target,activeRelated:"node"===(null==de?void 0:de.type)&&(e.edge.source===de.nodeId||e.edge.target===de.nodeId),onLineClick:b,onLineDoubleClick:k}))))),pe().createElement("div",{className:me()("line-labels",{ready:W}),style:{left:O.x,top:O.y,transform:"scale(".concat(O.k,")")}},pe().createElement(Ce.d2,{labels:le,onRendered:De})),pe().createElement("div",{className:"nodes",ref:Y,style:{left:O.x,top:O.y,transform:"scale(".concat(O.k,")")}},pe().createElement(we.p,{nodes:n,nodeBricks:s,onRendered:ye})),pe().createElement(Re.w,{connectLineState:J,connectLineTo:Z,markerPrefix:Ue}))}n=kt,({e:[l,o,r,h,c,d,u,p,g,f,A,v,y,m,b,k,w,_,x,M,E,C,N,W,T,R,S,z,L,$,B,D,P,O,H,I,K,Y,U,j,V,X,q,Z,F,J,G,Q,ee,te,ae,ne,i],c:[ie,s]}=(0,de.A)(n,[Ie("eo-diagram",{styleTexts:[De.A]})],[[Ke({type:String}),1,"layout"],[Ke({attribute:!1}),1,"nodes"],[Ke({attribute:!1}),1,"edges"],[Ke({attribute:!1}),1,"nodeBricks"],[Ke({attribute:!1}),1,"lines"],[Ke({attribute:!1}),1,"layoutOptions"],[Ke({attribute:!1}),1,"activeTarget"],[Ke({type:Boolean}),1,"disableKeyboardAction"],[Ke({attribute:!1}),1,"connectNodes"],[Ke({attribute:!1}),1,"dragNodes"],[Ke({type:Boolean}),1,"zoomable"],[Ke({type:Boolean}),1,"scrollable"],[Ke({type:Boolean}),1,"pannable"],[Ke({attribute:!1}),1,"scaleRange"],[Ye({type:"activeTarget.change"}),1,"activeTargetChangeEvent",e=>(0,ce.A)(lt,e),(e,t)=>(0,he.A)(lt,e,t)],[Ye({type:"node.delete"}),1,"nodeDelete",e=>(0,ce.A)(ht,e),(e,t)=>(0,he.A)(ht,e,t)],[Ye({type:"edge.delete"}),1,"edgeDelete",e=>(0,ce.A)(dt,e),(e,t)=>(0,he.A)(dt,e,t)],[Ye({type:"line.click"}),1,"lineClick",e=>(0,ce.A)(pt,e),(e,t)=>(0,he.A)(pt,e,t)],[Ye({type:"line.dblclick"}),1,"lineDoubleClick",e=>(0,ce.A)(ft,e),(e,t)=>(0,he.A)(ft,e,t)],[Ye({type:"nodes.connect"}),1,"connectNodes",e=>(0,ce.A)(vt,e),(e,t)=>(0,he.A)(vt,e,t)],[Ue(),2,"callOnLineLabel"]],0,(e=>bt.has((0,oe.A)(e))),fe.ReactNextElement)),s();var _t,xt,Mt,Et,Ct,Nt,Wt,Tt,Rt,St,zt,Lt,$t,Bt,Dt,Pt,Ot=a(3971),{defineElement:Ht,property:It,event:Kt,method:Yt}=(0,ge.createDecorators)(),Ut=(0,ue.forwardRef)(ea),jt=new WeakMap,Vt=new WeakMap,Xt=new WeakMap,qt=new WeakSet,Zt=new WeakMap,Ft=new WeakMap,Jt=new WeakMap,Gt=new WeakMap;class Qt extends fe.ReactNextElement{constructor(){super(...arguments),(0,se.A)(this,qt),(0,le.A)(this,jt,(xt(this),Et(this))),(0,le.A)(this,Vt,(Ct(this),Nt(this))),(0,le.A)(this,Xt,(Wt(this),Tt(this))),(0,le.A)(this,Zt,(zt(this),e=>{(0,re.A)(qt,this,Rt).emit(e)})),(0,le.A)(this,Ft,Lt(this)),(0,le.A)(this,Jt,(Dt(this),e=>{(0,re.A)(qt,this,$t).emit(e)})),(0,le.A)(this,Gt,(0,ue.createRef)())}get label(){return(0,ce.A)(jt,this)}set label(e){(0,he.A)(jt,this,e)}get type(){return(0,ce.A)(Vt,this)}set type(e){(0,he.A)(Vt,this,e)}enableEditing(){var e;null===(e=(0,ce.A)(Gt,this).current)||void 0===e||e.enableEditing()}render(){return pe().createElement(Ut,{ref:(0,ce.A)(Gt,this),label:this.label,onLabelEditingChange:(0,ce.A)(Zt,this),onLabelChange:(0,ce.A)(Jt,this)})}}function ea(e,t){var{label:a,onLabelChange:n,onLabelEditingChange:i}=e,s=null!=a?a:"",[l,o]=(0,ue.useState)(s),[r,h]=(0,ue.useState)(!1),c=(0,ue.useRef)(!1),[d,u]=(0,ue.useState)(!1),p=(0,ue.useRef)(null);(0,ue.useImperativeHandle)(t,(()=>({enableEditing(){h(!0)}}))),(0,ue.useEffect)((()=>{o(s)}),[s]);var g=(0,ue.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),h(!0)}),[]);(0,ue.useEffect)((()=>{var e,t;r&&(null===(e=p.current)||void 0===e||e.focus({preventScroll:!0}),null===(t=p.current)||void 0===t||t.select())}),[r]),(0,ue.useEffect)((()=>{c.current?null==i||i(r):c.current=!0}),[r,i]);var f=(0,ue.useCallback)((e=>{o(e.target.value)}),[]),A=(0,ue.useCallback)((e=>{var t,a=e.key||e.keyCode||e.which;"Enter"!==a&&13!==a||null===(t=p.current)||void 0===t||t.blur()}),[]),v=(0,ue.useCallback)((()=>{h(!1),u(!0)}),[]);(0,ue.useEffect)((()=>{d&&(null==n||n(l),u(!1))}),[l,n,d]);var y=(0,ue.useCallback)((e=>{e.stopPropagation()}),[]);return pe().createElement("div",{className:me()("label",{editing:r,empty:!l}),onDoubleClick:y,onMouseDown:y},pe().createElement("input",{className:"label-input",value:l,ref:p,onChange:f,onKeyDown:A,onBlur:v}),pe().createElement("div",{className:"label-text",onDoubleClick:g},l))}_t=Qt,({e:[Et,Ct,Nt,Wt,Tt,Rt,St,zt,Lt,$t,Bt,Dt,xt],c:[Pt,Mt]}=(0,de.A)(_t,[Ht("diagram.editable-label",{styleTexts:[Ot.A]})],[[It(),1,"label"],[It({render:!1}),1,"type"],[Kt({type:"label.editing.change"}),1,"labelEditingChange",e=>(0,ce.A)(Xt,e),(e,t)=>(0,he.A)(Xt,e,t)],[Kt({type:"label.change"}),1,"labelChange",e=>(0,ce.A)(Ft,e),(e,t)=>(0,he.A)(Ft,e,t)],[Yt(),2,"enableEditing"]],0,(e=>Gt.has((0,oe.A)(e))),fe.ReactNextElement)),Mt();var ta=a(4223),aa=a(9740),na=a(6330),ia=a(2559),sa=a(244),la=a(5748),oa=a(531),ra=a(8185),ha=a(4809);function ca(e){var{connectLineState:t,transform:a,markerEnd:n,onConnect:i}=e,[s,l]=(0,ue.useState)(null);return(0,ue.useEffect)((()=>{t&&l(t.from)}),[t]),(0,ue.useEffect)((()=>{if(t){var e=e=>{l([(e.clientX-a.x-t.offset[0])/a.k,(e.clientY-a.y-t.offset[1])/a.k])},n=e=>{e.stopPropagation()},s=e=>{e.stopPropagation(),o(),i(t,[(e.clientX-a.x-t.offset[0])/a.k,(e.clientY-a.y-t.offset[1])/a.k])},o=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mousedown",n,{capture:!0}),document.removeEventListener("click",s,{capture:!0}),l(null)};return document.addEventListener("mousemove",e),document.addEventListener("mousedown",n,{capture:!0}),document.addEventListener("click",s,{capture:!0}),o}}),[t,i,a]),pe().createElement("path",{className:me()("connect-line",{connecting:!!t&&s&&(s[0]-t.from[0])**2+(s[1]-t.from[1])**2>25}),d:t&&s?"M".concat(t.from.join(" "),"L").concat(s.join(" ")):"",fill:"none",stroke:"gray",strokeWidth:1,markerEnd:"url(#".concat(n,")")})}var da,ua,pa,ga,fa,Aa,va,ya,ma,ba,ka,wa,_a,xa,Ma,Ea,Ca,Na,Wa,Ta,Ra,Sa,za,La,$a,Ba,Da,Pa,Oa,Ha,Ia,Ka,Ya,Ua,ja,Va,Xa,qa,Za,Fa,Ja,Ga,Qa,en,tn,an,nn,sn,ln,on,rn,hn,cn,dn,un,pn,gn,fn,An,vn,yn,mn,bn,kn,wn,_n,xn,Mn,En,Cn,Nn,Wn,Tn,Rn,Sn=a(3783),zn=a(2098),Ln=a(227),$n=a(3033),Bn=a(8091),Dn=a(1819),Pn=a(7099),On=a(1484),Hn=a(8197),In=a(7531),Kn=a(3012),Yn=a(8618),Un=["shouldReCenter"],jn=(0,sa.unwrapProvider)("basic.lock-body-scroll"),{defineElement:Vn,property:Xn,method:qn,event:Zn}=(0,ge.createDecorators)(),Fn=pe().forwardRef($i),Jn=new WeakMap,Gn=new WeakMap,Qn=new WeakMap,ei=new WeakMap,ti=new WeakMap,ai=new WeakMap,ni=new WeakMap,ii=new WeakMap,si=new WeakMap,li=new WeakMap,oi=new WeakMap,ri=new WeakMap,hi=new WeakMap,ci=new WeakMap,di=new WeakMap,ui=new WeakMap,pi=new WeakMap,gi=new WeakMap,fi=new WeakSet,Ai=new WeakMap,vi=new WeakMap,yi=new WeakMap,mi=new WeakMap,bi=new WeakMap,ki=new WeakMap,wi=new WeakMap,_i=new WeakMap,xi=new WeakMap,Mi=new WeakMap,Ei=new WeakMap,Ci=new WeakMap,Ni=new WeakMap,Wi=new WeakMap,Ti=new WeakMap,Ri=new WeakMap,Si=new WeakMap;class zi extends fe.ReactNextElement{constructor(){super(...arguments),(0,se.A)(this,fi),(0,le.A)(this,Jn,(ua(this),ga(this))),(0,le.A)(this,Gn,(fa(this),Aa(this))),(0,le.A)(this,Qn,(va(this),ya(this))),(0,le.A)(this,ei,(ma(this),ba(this,[$n.HP,$n.HP]))),(0,le.A)(this,ti,(ka(this),wa(this))),(0,le.A)(this,ai,(_a(this),xa(this))),(0,le.A)(this,ni,(Ma(this),Ea(this))),(0,le.A)(this,ii,(Ca(this),Na(this))),(0,le.A)(this,si,(Wa(this),Ta(this))),(0,le.A)(this,li,(Ra(this),Sa(this))),(0,le.A)(this,oi,(za(this),La(this,!0))),(0,le.A)(this,ri,($a(this),Ba(this,!0))),(0,le.A)(this,hi,(Da(this),Pa(this,!0))),(0,le.A)(this,ci,(Oa(this),Ha(this,!0))),(0,le.A)(this,di,(Ia(this),Ka(this,!1))),(0,le.A)(this,ui,(Ya(this),Ua(this))),(0,le.A)(this,pi,(ja(this),Va(this))),(0,le.A)(this,gi,(Xa(this),qa(this))),(0,le.A)(this,Ai,(Ja(this),e=>{(0,re.A)(fi,this,Za).emit(e)})),(0,le.A)(this,vi,(e=>{(0,ra.c)(e,this.activeTarget)||(this.activeTarget=e)})),(0,le.A)(this,yi,Ga(this)),(0,le.A)(this,mi,(tn(this),an(this))),(0,le.A)(this,bi,(ln(this),e=>{(0,re.A)(fi,this,nn).emit(e),"node"===e.type&&(0,re.A)(fi,this,Qa).emit(e)})),(0,le.A)(this,ki,on(this)),(0,le.A)(this,wi,(cn(this),e=>{(0,re.A)(fi,this,rn).emit(e)})),(0,le.A)(this,_i,dn(this)),(0,le.A)(this,xi,(gn(this),fn(this))),(0,le.A)(this,Mi,(yn(this),e=>{(0,re.A)(fi,this,An).emit(e),"node"===e.type&&(0,re.A)(fi,this,un).emit(e)})),(0,le.A)(this,Ei,mn(this)),(0,le.A)(this,Ci,(wn(this),e=>{(0,re.A)(fi,this,bn).emit(e)})),(0,le.A)(this,Ni,_n(this)),(0,le.A)(this,Wi,(En(this),e=>{(0,re.A)(fi,this,xn).emit(e)})),(0,le.A)(this,Ti,Cn(this)),(0,le.A)(this,Ri,(Tn(this),e=>{(0,re.A)(fi,this,Nn).emit(e)})),(0,le.A)(this,Si,(0,ue.createRef)())}get cells(){return(0,ce.A)(Jn,this)}set cells(e){(0,he.A)(Jn,this,e)}get layout(){return(0,ce.A)(Gn,this)}set layout(e){(0,he.A)(Gn,this,e)}get layoutOptions(){return(0,ce.A)(Qn,this)}set layoutOptions(e){(0,he.A)(Qn,this,e)}get defaultNodeSize(){return(0,ce.A)(ei,this)}set defaultNodeSize(e){(0,he.A)(ei,this,e)}get defaultNodeBricks(){return(0,ce.A)(ti,this)}set defaultNodeBricks(e){(0,he.A)(ti,this,e)}get degradedThreshold(){return(0,ce.A)(ai,this)}set degradedThreshold(e){(0,he.A)(ai,this,e)}get degradedNodeLabel(){return(0,ce.A)(ni,this)}set degradedNodeLabel(e){(0,he.A)(ni,this,e)}get defaultEdgeLines(){return(0,ce.A)(ii,this)}set defaultEdgeLines(e){(0,he.A)(ii,this,e)}get activeTarget(){return(0,ce.A)(si,this)}set activeTarget(e){(0,he.A)(si,this,e)}get fadeUnrelatedCells(){return(0,ce.A)(li,this)}set fadeUnrelatedCells(e){(0,he.A)(li,this,e)}get zoomable(){return(0,ce.A)(oi,this)}set zoomable(e){(0,he.A)(oi,this,e)}get scrollable(){return(0,ce.A)(ri,this)}set scrollable(e){(0,he.A)(ri,this,e)}get pannable(){return(0,ce.A)(hi,this)}set pannable(e){(0,he.A)(hi,this,e)}get selectable(){return(0,ce.A)(ci,this)}set selectable(e){(0,he.A)(ci,this,e)}get allowEdgeToArea(){return(0,ce.A)(di,this)}set allowEdgeToArea(e){(0,he.A)(di,this,e)}get dragBehavior(){return(0,ce.A)(ui,this)}set dragBehavior(e){(0,he.A)(ui,this,e)}get scaleRange(){return(0,ce.A)(pi,this)}set scaleRange(e){(0,he.A)(pi,this,e)}dropNode(e){var t=this;return(0,na.A)((function*(){var a,n,{id:i,position:s,size:l,data:o,useBrick:r}=e;if(null===(a=(n=document).elementsFromPoint)||void 0===a||null===(a=a.call(n,s[0],s[1]))||void 0===a?void 0:a.includes(t)){var h,c,d,u=t.getBoundingClientRect(),p=(0,ce.A)(Si,t).current.getTransform(),g={type:"node",id:i,view:(0,aa.A)((0,aa.A)({},"force"===t.layout||"dagre"===t.layout?null:{x:(s[0]-u.left-p.x)/p.k,y:(s[1]-u.top-p.y)/p.k}),{},{width:null!==(h=null==l?void 0:l[0])&&void 0!==h?h:t.defaultNodeSize[0],height:null!==(c=null==l?void 0:l[1])&&void 0!==c?c:t.defaultNodeSize[0]}),data:o,useBrick:r};return null===(d=(0,ce.A)(Si,t).current)||void 0===d||d.dropNode(g),g}return null}))()}dropDecorator(e){var t=this;return(0,na.A)((function*(){var a,n,{position:i,decorator:s,text:l}=e;if(null===(a=(n=document).elementsFromPoint)||void 0===a||null===(a=a.call(n,i[0],i[1]))||void 0===a?void 0:a.includes(t)){var o,r=t.getBoundingClientRect(),h=(0,ce.A)(Si,t).current.getTransform(),c={type:"decorator",decorator:s,id:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),view:{x:(i[0]-r.left-h.x)/h.k,y:(i[1]-r.top-h.y)/h.k,width:$n.N8,height:$n.w1,text:l}};return null===(o=(0,ce.A)(Si,t).current)||void 0===o||o.dropDecorator(c),c}return null}))()}addNodes(e){var t=this;return(0,na.A)((function*(){if(0===e.length)return[];var a=e.map((e=>{var a,n,{size:i,useBrick:s,id:l,data:o}=e;return{type:"node",id:l,data:o,view:{width:null!==(a=null==i?void 0:i[0])&&void 0!==a?a:t.defaultNodeSize[0],height:null!==(n=null==i?void 0:i[1])&&void 0!==n?n:t.defaultNodeSize[0]},useBrick:s}}));return(0,ce.A)(Si,t).current.addNodes(a,{defaultNodeSize:t.defaultNodeSize,canvasWidth:t.clientWidth,canvasHeight:t.clientHeight})}))()}addEdge(e){var t=this;return(0,na.A)((function*(){var a,{source:n,target:i,data:s}=e,l={type:"edge",source:n,target:i,data:s};return null===(a=(0,ce.A)(Si,t).current)||void 0===a||a.addEdge(l),l}))()}manuallyConnectNodes(e){return(0,ce.A)(Si,this).current.manuallyConnectNodes(e)}updateCells(e,t){var a=this;return(0,na.A)((function*(){yield(0,ia.A)(fi,a,Li).call(a);var{updated:n}=(0,ce.A)(Si,a).current.updateCells(e,(0,aa.A)((0,aa.A)({},t),{},{defaultNodeSize:a.defaultNodeSize,canvasWidth:a.clientWidth,canvasHeight:a.clientHeight}));return{updated:n}}))()}disconnectedCallback(){super.disconnectedCallback(),jn(this,!1)}render(){return pe().createElement(Fn,{host:this,ref:(0,ce.A)(Si,this),layout:this.layout,layoutOptions:this.layoutOptions,cells:this.cells,defaultNodeSize:this.defaultNodeSize,defaultNodeBricks:this.defaultNodeBricks,defaultEdgeLines:this.defaultEdgeLines,degradedThreshold:this.degradedThreshold,degradedNodeLabel:this.degradedNodeLabel,activeTarget:this.activeTarget,fadeUnrelatedCells:this.fadeUnrelatedCells,zoomable:this.zoomable,scrollable:this.scrollable,pannable:this.pannable,dragBehavior:this.dragBehavior,scaleRange:this.scaleRange,allowEdgeToArea:this.allowEdgeToArea,onActiveTargetChange:(0,ce.A)(Ai,this),onSwitchActiveTarget:(0,ce.A)(vi,this),onCellMove:(0,ce.A)(bi,this),onCellResize:(0,ce.A)(wi,this),onCellDelete:(0,ce.A)(Mi,this),onCellContextMenu:(0,ce.A)(Ci,this),onDecoratorTextChange:(0,ce.A)(Wi,this),onScaleChange:(0,ce.A)(Ri,this)})}}function Li(){return new Promise((e=>{var t=()=>{(0,ce.A)(Si,this).current?e():setTimeout(t,10)};t()}))}function $i(e,t){var{host:a,layout:n,layoutOptions:i,cells:s,defaultNodeSize:l,defaultNodeBricks:o,defaultEdgeLines:r,degradedThreshold:h,degradedNodeLabel:c,activeTarget:d,fadeUnrelatedCells:u,zoomable:p,scrollable:g,pannable:f,dragBehavior:A,scaleRange:v,allowEdgeToArea:y,onActiveTargetChange:m,onSwitchActiveTarget:b,onCellMove:k,onCellResize:w,onCellDelete:_,onCellContextMenu:x,onDecoratorTextChange:M,onScaleChange:E}=e,[{cells:C,layoutKey:N},W]=(0,ue.useReducer)(la.d,s,(e=>({cells:(0,Sn.C)(e,{defaultNodeSize:l}),layoutKey:0}))),T=(0,ue.useMemo)((()=>C.filter(oa.N).length>=(null!=h?h:$n.pC)),[C,h]),R=(0,ue.useRef)(null),S=(0,ue.useRef)(null),z=(0,ue.useRef)(null),[L,$]=(0,ue.useState)([]),{grabbing:B,transform:D,zoomer:P,scaleRange:O}=(0,Bn.f)({rootRef:R,zoomable:p,scrollable:g,pannable:f,draggable:"grab"===A,scaleRange:v,onSwitchActiveTarget:b});(0,ue.useEffect)((()=>{E(D.k)}),[E,D.k]);var[H,I]=(0,ue.useState)(null),{centered:K,setCentered:Y,getNextLayoutKey:U}=(0,On.g)({layout:n,layoutOptions:i,rootRef:R,cells:C,zoomable:p,zoomer:P,scaleRange:O,layoutKey:N,dispatch:W});(0,ue.useImperativeHandle)(t,(()=>({dropNode(e){"dagre"!==n&&"force"!==n&&Y(!0),W({type:"drop-node",payload:e})},dropDecorator(e){"dagre"!==n&&"force"!==n&&Y(!0),W({type:"drop-decorator",payload:e})},addNodes(e,t){var{defaultNodeSize:a,canvasWidth:i,canvasHeight:s}=t,l=C.findLastIndex((e=>!("decorator"===e.type&&"text"===e.decorator)))+1,o=[...C.slice(0,l),...e,...C.slice(l)],{cells:r,updated:h,shouldReCenter:c}=(0,zn.L)({cells:o,layout:n,previousCells:C,defaultNodeSize:a,canvasWidth:i,canvasHeight:s,scaleRange:O,transform:D});return c&&Y(!1),W({type:"update-cells",payload:r}),h.filter((t=>e.includes(t)))},addEdge(e){W({type:"add-edge",payload:e})},updateCells(e,t){var a=(0,zn.L)((0,aa.A)((0,aa.A)({},t),{},{layout:n,previousCells:C,cells:e,scaleRange:O,transform:D})),{shouldReCenter:i}=a,s=(0,ta.A)(a,Un);return i&&Y(!1),W({type:"update-cells",payload:s.cells}),s},getTransform:()=>D,manuallyConnectNodes(e){var t=C.find((t=>y?(0,oa.o6)(t)&&t.id===e:(0,oa.N)(t)&&t.id===e));if(t){var a=R.current.getBoundingClientRect();return I({source:t,from:[t.view.x+t.view.width/2,t.view.y+t.view.height/2],offset:[a.left,a.top]}),new Promise(((e,t)=>{z.current={resolve:e,reject:t}}))}return Promise.reject(null)}})),[C,n,O,Y,D,y]);var j=(0,ue.useCallback)(((e,t)=>{for(var a,n=0;n<C.length;n++){var i=C[n];if((0,oa.o6)(i)&&i.id!==e.source.id&&i.view.x<t[0]&&i.view.x+i.view.width>t[0]&&i.view.y<t[1]&&i.view.y+i.view.height>t[1]){var s;null===(s=z.current)||void 0===s||s.resolve({source:e.source,target:i});break}}null===(a=z.current)||void 0===a||a.reject(null),I(null)}),[C]);(0,ue.useEffect)((()=>{jn(a,!!H)}),[H,a]);var V=(0,Dn.J)({cellsRef:S,activeTarget:d,onActiveTargetChange:m}),[X,q]=(0,ue.useState)([]);(0,ue.useEffect)((()=>{var e=u?(0,Ln.Y)(C,H,V,y):[];q((t=>0===t.length&&0===e.length?t:e))}),[V,C,H,u,y]),(0,ue.useEffect)((()=>{var e=R.current;if(e&&!(L.length>0)){var t=e=>{var t=function(e,t){var{cells:a,activeTarget:n}=t,i=a.find((e=>(0,ra.c)(e,n)));if(i)switch(e.key||e.keyCode||e.which){case"Backspace":case 8:case"Delete":case 46:return e.preventDefault(),e.stopPropagation(),{action:"delete-cell",cell:i}}}(e,{cells:C,activeTarget:V});"delete-cell"===(null==t?void 0:t.action)&&_(t.cell)};return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}}),[V,C,L.length,_]);var Z=(0,ue.useMemo)((()=>"".concat((0,be.uniqueId)("diagram-"),"-")),[]),F="".concat(Z,"line-arrow-"),J=(0,ue.useCallback)((e=>{W({type:"move-cell",payload:e})}),[]),G=(0,ue.useCallback)((e=>{W({type:"move-cell",payload:e}),k(e)}),[k]),Q=(0,ue.useCallback)((e=>{W({type:"resize-cell",payload:e})}),[]),ee=(0,ue.useCallback)((e=>{W({type:"resize-cell",payload:e}),w(e)}),[w]),te=(0,ue.useCallback)((e=>{var{id:t,editing:a}=e;$(a?e=>e.includes(t)?e:[...e,t]:e=>e.filter((e=>e!==t)))}),[]),ae=(0,ue.useCallback)(((e,t)=>{var a=U();W({type:"update-node-size",payload:{id:e,size:t},layoutKey:a})}),[U]),ne=(0,ue.useCallback)((e=>{P.scaleTo((0,Ae.A)(R.current),e/100)}),[P]),ie=(0,ue.useCallback)((()=>{Y(!1)}),[Y]),[se,le]=(0,In.d)({cells:C,defaultEdgeLines:r,markerPrefix:F}),oe=(0,Hn.H)({cells:C,layout:n,centered:K});return pe().createElement(pe().Fragment,null,pe().createElement("svg",{width:"100%",height:"100%",ref:R,className:me()("root",{grabbing:B,pannable:f,ready:oe}),tabIndex:-1},pe().createElement("defs",null,le.map(((e,t)=>pe().createElement(We.c,{key:t,id:"".concat(F).concat(t),type:"arrow",strokeColor:e.strokeColor})))),pe().createElement("g",{transform:"translate(".concat(D.x," ").concat(D.y,") scale(").concat(D.k,")")},pe().createElement("g",{className:me()("cells",{allowEdgeToArea:y}),ref:S},C.map((e=>pe().createElement(ha.m,{key:"".concat(e.type,":").concat("edge"===e.type?"".concat(e.source,"~").concat(e.target):e.id),layout:n,cell:e,cells:C,degraded:T,degradedNodeLabel:c,defaultNodeBricks:o,transform:D,lineConfMap:se,active:(0,ra.c)(V,e),unrelatedCells:X,onCellMoving:J,onCellMoved:G,onCellResizing:Q,onCellResized:ee,onSwitchActiveTarget:b,onCellContextMenu:x,onDecoratorTextChange:M,onDecoratorTextEditing:te,onNodeBrickResize:ae})))),pe().createElement(ca,{connectLineState:H,transform:D,markerEnd:"".concat(F,"0"),onConnect:j}))),pe().createElement(Pn.Y,{shadowRoot:a.shadowRoot,scale:D.k,scaleRange:O,onZoomChange:ne,onReCenter:ie}))}da=zi,({e:[ga,fa,Aa,va,ya,ma,ba,ka,wa,_a,xa,Ma,Ea,Ca,Na,Wa,Ta,Ra,Sa,za,La,$a,Ba,Da,Pa,Oa,Ha,Ia,Ka,Ya,Ua,ja,Va,Xa,qa,Za,Fa,Ja,Ga,Qa,en,tn,an,nn,sn,ln,on,rn,hn,cn,dn,un,pn,gn,fn,An,vn,yn,mn,bn,kn,wn,_n,xn,Mn,En,Cn,Nn,Wn,Tn,ua],c:[Rn,pa]}=(0,de.A)(da,[Vn("eo-draw-canvas",{styleTexts:[Kn.A,Yn.A]})],[[Xn({attribute:!1}),1,"cells"],[Xn({type:String}),1,"layout"],[Xn({attribute:!1}),1,"layoutOptions"],[Xn({attribute:!1}),1,"defaultNodeSize"],[Xn({attribute:!1}),1,"defaultNodeBricks"],[Xn({type:Number}),1,"degradedThreshold"],[Xn({attribute:!1}),1,"degradedNodeLabel"],[Xn({attribute:!1}),1,"defaultEdgeLines"],[Xn({attribute:!1}),1,"activeTarget"],[Xn({type:Boolean}),1,"fadeUnrelatedCells"],[Xn({type:Boolean}),1,"zoomable"],[Xn({type:Boolean}),1,"scrollable"],[Xn({type:Boolean}),1,"pannable"],[Xn({type:Boolean}),1,"selectable"],[Xn({type:Boolean}),1,"allowEdgeToArea"],[Xn(),1,"dragBehavior"],[Xn({attribute:!1}),1,"scaleRange"],[Zn({type:"activeTarget.change"}),1,"activeTargetChangeEvent",e=>(0,ce.A)(gi,e),(e,t)=>(0,he.A)(gi,e,t)],[Zn({type:"node.move"}),1,"nodeMoveEvent",e=>(0,ce.A)(yi,e),(e,t)=>(0,he.A)(yi,e,t)],[Zn({type:"cell.move"}),1,"cellMoveEvent",e=>(0,ce.A)(mi,e),(e,t)=>(0,he.A)(mi,e,t)],[Zn({type:"cell.resize"}),1,"cellResizeEvent",e=>(0,ce.A)(ki,e),(e,t)=>(0,he.A)(ki,e,t)],[Zn({type:"node.delete"}),1,"nodeDelete",e=>(0,ce.A)(_i,e),(e,t)=>(0,he.A)(_i,e,t)],[Zn({type:"cell.delete"}),1,"cellDelete",e=>(0,ce.A)(xi,e),(e,t)=>(0,he.A)(xi,e,t)],[Zn({type:"cell.contextmenu"}),1,"cellContextMenu",e=>(0,ce.A)(Ei,e),(e,t)=>(0,he.A)(Ei,e,t)],[Zn({type:"decorator.text.change"}),1,"decoratorTextChange",e=>(0,ce.A)(Ni,e),(e,t)=>(0,he.A)(Ni,e,t)],[Zn({type:"scale.change"}),1,"scaleChange",e=>(0,ce.A)(Ti,e),(e,t)=>(0,he.A)(Ti,e,t)],[qn(),2,"dropNode"],[qn(),2,"dropDecorator"],[qn(),2,"addNodes"],[qn(),2,"addEdge"],[qn(),2,"manuallyConnectNodes"],[qn(),2,"updateCells"]],0,(e=>Si.has((0,oe.A)(e))),fe.ReactNextElement)),pa();var Bi,Di,Pi,Oi,Hi,Ii,Ki,Yi,Ui,ji,Vi,Xi,qi,Zi,Fi,Ji,Gi,Qi,es,ts,as,ns,is,ss,ls,os,rs,hs,cs,ds,us,ps,gs,fs,As,vs,ys,ms,bs,ks,ws,_s,xs,Ms,Es,Cs,Ns,Ws,Ts,Rs,Ss,zs,Ls,$s,Bs,Ds,Ps,Os,Hs,Is,Ks,Ys,Us,js=a(497),{defineElement:Vs,property:Xs,event:qs}=(0,ge.createDecorators)(),Zs=new WeakMap,Fs=new WeakMap,Js=new WeakMap,Gs=new WeakMap,Qs=new WeakSet,el=new WeakMap,tl=new WeakMap,al=new WeakMap,nl=new WeakMap,il=new WeakMap;class sl extends fe.ReactNextElement{constructor(){super(...arguments),(0,se.A)(this,Qs),(0,le.A)(this,Zs,Pi(this)),(0,le.A)(this,Fs,(Oi(this),Hi(this))),(0,le.A)(this,Js,(Ii(this),Ki(this))),(0,le.A)(this,Gs,(Yi(this),Ui(this))),(0,le.A)(this,el,(Xi(this),e=>{(0,re.A)(Qs,this,ji).emit(e)})),(0,le.A)(this,tl,qi(this)),(0,le.A)(this,al,(Ji(this),e=>{(0,re.A)(Qs,this,Zi).emit(e)})),(0,le.A)(this,nl,Gi(this)),(0,le.A)(this,il,(ts(this),e=>{(0,re.A)(Qs,this,Qi).emit(e)}))}get usage(){return(0,ce.A)(Zs,this)}set usage(e){(0,he.A)(Zs,this,e)}get status(){return(0,ce.A)(Fs,this)}set status(e){(0,he.A)(Fs,this,e)}get decorator(){return(0,ce.A)(Js,this)}set decorator(e){(0,he.A)(Js,this,e)}render(){return pe().createElement(ll,{usage:this.usage,onDragStart:(0,ce.A)(el,this),onDragMove:(0,ce.A)(al,this),onDragEnd:(0,ce.A)(il,this)})}}function ll(e){var{usage:t,onDragStart:a,onDragMove:n,onDragEnd:i}=e,s=(0,ue.useCallback)((e=>{if("library"===t){e.stopPropagation(),e.preventDefault();var s=[e.clientX,e.clientY],l=!1,o=e=>{l||(l=(e.clientX-s[0])**2+(e.clientY-s[1])**2>=9)&&(null==a||a([e.clientX,e.clientY])),l&&(null==n||n([e.clientX,e.clientY]))},r=e=>{document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",r),l&&(null==i||i([e.clientX,e.clientY]))};document.addEventListener("mousemove",o),document.addEventListener("mouseup",r)}}),[i,n,a,t]);return pe().createElement("div",{onMouseDown:s},pe().createElement("slot",null))}Bi=sl,({e:[Pi,Oi,Hi,Ii,Ki,Yi,Ui,ji,Vi,Xi,qi,Zi,Fi,Ji,Gi,Qi,es,ts],c:[as,Di]}=(0,de.A)(Bi,[Vs("diagram.experimental-node",{styleTexts:[js.A]})],[[Xs(),1,"usage"],[Xs({type:String,render:!1}),1,"status"],[Xs({type:String}),1,"decorator"],[qs({type:"drag.start"}),1,"dragStartEvent",e=>(0,ce.A)(Gs,e),(e,t)=>(0,he.A)(Gs,e,t)],[qs({type:"drag.move"}),1,"dragMoveEvent",e=>(0,ce.A)(tl,e),(e,t)=>(0,he.A)(tl,e,t)],[qs({type:"drag.end"}),1,"dragEndEvent",e=>(0,ce.A)(nl,e),(e,t)=>(0,he.A)(nl,e,t)]],0,(e=>il.has((0,oe.A)(e))),fe.ReactNextElement)),Di();var ol,{defineElement:rl,property:hl,event:cl}=(0,ge.createDecorators)(),dl=new WeakMap,ul=new WeakMap,pl=new WeakMap,gl=new WeakMap,fl=new WeakMap,Al=new WeakMap,vl=new WeakMap,yl=new WeakMap,ml=new WeakMap,bl=new WeakMap,kl=new WeakMap,wl=new WeakMap,_l=new WeakMap,xl=new WeakMap,Ml=new WeakMap,El=new WeakSet,Cl=new WeakMap,Nl=new WeakMap,Wl=new WeakMap,Tl=new WeakMap,Rl=new WeakMap,Sl=new WeakMap;class zl extends fe.ReactNextElement{constructor(){super(...arguments),(0,se.A)(this,El),(0,le.A)(this,dl,ss(this)),(0,le.A)(this,ul,(ls(this),os(this))),(0,le.A)(this,pl,(rs(this),hs(this))),(0,le.A)(this,gl,(cs(this),ds(this,[$n.HP,$n.HP]))),(0,le.A)(this,fl,(us(this),ps(this))),(0,le.A)(this,Al,(gs(this),fs(this))),(0,le.A)(this,vl,(As(this),vs(this))),(0,le.A)(this,yl,(ys(this),ms(this))),(0,le.A)(this,ml,(bs(this),ks(this))),(0,le.A)(this,bl,(ws(this),_s(this))),(0,le.A)(this,kl,(xs(this),Ms(this,!0))),(0,le.A)(this,wl,(Es(this),Cs(this,!0))),(0,le.A)(this,_l,(Ns(this),Ws(this,!0))),(0,le.A)(this,xl,(Ts(this),Rs(this))),(0,le.A)(this,Ml,(Ss(this),zs(this))),(0,le.A)(this,Cl,(Bs(this),e=>{(0,re.A)(El,this,Ls).emit(e)})),(0,le.A)(this,Nl,(e=>{(0,ra.c)(e,this.activeTarget)||(this.activeTarget=e)})),(0,le.A)(this,Wl,Ds(this)),(0,le.A)(this,Tl,(Hs(this),e=>{(0,re.A)(El,this,Ps).emit(e)})),(0,le.A)(this,Rl,Is(this)),(0,le.A)(this,Sl,(Us(this),e=>{(0,re.A)(El,this,Ks).emit(e)}))}get cells(){return(0,ce.A)(dl,this)}set cells(e){(0,he.A)(dl,this,e)}get layout(){return(0,ce.A)(ul,this)}set layout(e){(0,he.A)(ul,this,e)}get layoutOptions(){return(0,ce.A)(pl,this)}set layoutOptions(e){(0,he.A)(pl,this,e)}get defaultNodeSize(){return(0,ce.A)(gl,this)}set defaultNodeSize(e){(0,he.A)(gl,this,e)}get defaultNodeBricks(){return(0,ce.A)(fl,this)}set defaultNodeBricks(e){(0,he.A)(fl,this,e)}get degradedThreshold(){return(0,ce.A)(Al,this)}set degradedThreshold(e){(0,he.A)(Al,this,e)}get degradedNodeLabel(){return(0,ce.A)(vl,this)}set degradedNodeLabel(e){(0,he.A)(vl,this,e)}get defaultEdgeLines(){return(0,ce.A)(yl,this)}set defaultEdgeLines(e){(0,he.A)(yl,this,e)}get activeTarget(){return(0,ce.A)(ml,this)}set activeTarget(e){(0,he.A)(ml,this,e)}get fadeUnrelatedCells(){return(0,ce.A)(bl,this)}set fadeUnrelatedCells(e){(0,he.A)(bl,this,e)}get zoomable(){return(0,ce.A)(kl,this)}set zoomable(e){(0,he.A)(kl,this,e)}get scrollable(){return(0,ce.A)(wl,this)}set scrollable(e){(0,he.A)(wl,this,e)}get pannable(){return(0,ce.A)(_l,this)}set pannable(e){(0,he.A)(_l,this,e)}get scaleRange(){return(0,ce.A)(xl,this)}set scaleRange(e){(0,he.A)(xl,this,e)}render(){return pe().createElement(Ll,{shadowRoot:this.shadowRoot,cells:this.cells,layout:this.layout,layoutOptions:this.layoutOptions,defaultNodeSize:this.defaultNodeSize,defaultNodeBricks:this.defaultNodeBricks,defaultEdgeLines:this.defaultEdgeLines,degradedThreshold:this.degradedThreshold,degradedNodeLabel:this.degradedNodeLabel,activeTarget:this.activeTarget,fadeUnrelatedCells:this.fadeUnrelatedCells,zoomable:this.zoomable,scrollable:this.scrollable,pannable:this.pannable,scaleRange:this.scaleRange,onActiveTargetChange:(0,ce.A)(Cl,this),onSwitchActiveTarget:(0,ce.A)(Nl,this),onCellContextMenu:(0,ce.A)(Tl,this),onCellClick:(0,ce.A)(Sl,this)})}}function Ll(e){var{shadowRoot:t,cells:a,layout:n,layoutOptions:i,defaultNodeSize:s,defaultNodeBricks:l,defaultEdgeLines:o,degradedThreshold:r,degradedNodeLabel:h,activeTarget:c,fadeUnrelatedCells:d,zoomable:u,scrollable:p,pannable:g,scaleRange:f,onActiveTargetChange:A,onSwitchActiveTarget:v,onCellContextMenu:y,onCellClick:m}=e,[{cells:b,layoutKey:k},w]=(0,ue.useReducer)(la.d,a,(e=>({cells:(0,Sn.C)(e,{defaultNodeSize:s}),layoutKey:1}))),_=(0,ue.useMemo)((()=>b.filter(oa.N).length>=(null!=r?r:$n.pC)),[b,r]),x=(0,ue.useRef)(null),M=(0,ue.useRef)(null),{grabbing:E,transform:C,zoomer:N,scaleRange:W}=(0,Bn.f)({rootRef:x,zoomable:u,scrollable:p,pannable:g,draggable:!0,scaleRange:f,onSwitchActiveTarget:v}),{centered:T,setCentered:R,getNextLayoutKey:S}=(0,On.g)({layout:n,layoutOptions:i,rootRef:x,cells:b,zoomable:u,zoomer:N,scaleRange:W,layoutKey:k,dispatch:w}),z=(0,ue.useCallback)((()=>{R(!1)}),[R]),L=(0,ue.useRef)(a);(0,ue.useEffect)((()=>{if(a!==L.current){L.current=a;var e=(0,zn.L)({canvasWidth:t.host.clientWidth,canvasHeight:t.host.clientHeight,defaultNodeSize:s,layout:n,previousCells:b,cells:a,scaleRange:W,transform:C});w({type:"update-cells",payload:e.cells})}}),[b,s,a,n,W,t,C]);var $=(0,Dn.J)({cellsRef:M,activeTarget:c,onActiveTargetChange:A}),B=(0,ue.useMemo)((()=>"".concat((0,be.uniqueId)("diagram-"),"-")),[]),D="".concat(B,"line-arrow-"),P=(0,ue.useCallback)(((e,t)=>{w({type:"update-node-size",payload:{id:e,size:t},layoutKey:S()})}),[S]),[O,H]=(0,ue.useState)(null),I=(0,ue.useCallback)((e=>{H(e)}),[]),K=(0,ue.useCallback)((e=>{H((t=>t===e?null:t))}),[]),[Y,U]=(0,ue.useState)([]);(0,ue.useEffect)((()=>{var e=d?(0,Ln.Y)(b,null,O):[];U((t=>0===t.length&&0===e.length?t:e))}),[b,d,O]);var j=(0,ue.useCallback)((e=>{N.scaleTo((0,Ae.A)(x.current),e/100)}),[N]),[V,X]=(0,In.d)({cells:b,defaultEdgeLines:o,markerPrefix:D}),q=(0,Hn.H)({cells:b,layout:n,centered:T});return pe().createElement(pe().Fragment,null,pe().createElement("svg",{width:"100%",height:"100%",ref:x,className:me()("root",{grabbing:E,pannable:g,ready:q}),tabIndex:-1},pe().createElement("defs",null,X.map(((e,t)=>pe().createElement(We.c,{key:t,id:"".concat(D).concat(t),type:"arrow",strokeColor:e.strokeColor})))),pe().createElement("g",{transform:"translate(".concat(C.x," ").concat(C.y,") scale(").concat(C.k,")")},pe().createElement("g",{className:"cells",ref:M},b.map((e=>pe().createElement(ha.m,{key:"".concat(e.type,":").concat((0,oa.WW)(e)?"".concat(e.source,"~").concat(e.target):e.id),layout:void 0,cell:e,cells:b,degraded:_,degradedNodeLabel:h,defaultNodeBricks:l,lineConfMap:V,transform:C,active:(0,ra.c)($,e),readOnly:!0,unrelatedCells:Y,onSwitchActiveTarget:v,onCellContextMenu:y,onCellClick:m,onNodeBrickResize:P,onCellMouseEnter:d&&(0,oa.N)(e)?I:void 0,onCellMouseLeave:d&&(0,oa.N)(e)?K:void 0})))))),pe().createElement(Pn.Y,{shadowRoot:t,scale:C.k,scaleRange:W,onZoomChange:j,onReCenter:z}))}ns=zl,({e:[ss,ls,os,rs,hs,cs,ds,us,ps,gs,fs,As,vs,ys,ms,bs,ks,ws,_s,xs,Ms,Es,Cs,Ns,Ws,Ts,Rs,Ss,zs,Ls,$s,Bs,Ds,Ps,Os,Hs,Is,Ks,Ys,Us],c:[ol,is]}=(0,de.A)(ns,[rl("eo-display-canvas",{styleTexts:[Kn.A,Yn.A]})],[[hl({attribute:!1}),1,"cells"],[hl({type:String}),1,"layout"],[hl({attribute:!1}),1,"layoutOptions"],[hl({attribute:!1}),1,"defaultNodeSize"],[hl({attribute:!1}),1,"defaultNodeBricks"],[hl({type:Number}),1,"degradedThreshold"],[hl({attribute:!1}),1,"degradedNodeLabel"],[hl({attribute:!1}),1,"defaultEdgeLines"],[hl({attribute:!1}),1,"activeTarget"],[hl({type:Boolean}),1,"fadeUnrelatedCells"],[hl({type:Boolean}),1,"zoomable"],[hl({type:Boolean}),1,"scrollable"],[hl({type:Boolean}),1,"pannable"],[hl({attribute:!1}),1,"scaleRange"],[cl({type:"activeTarget.change"}),1,"activeTargetChangeEvent",e=>(0,ce.A)(Ml,e),(e,t)=>(0,he.A)(Ml,e,t)],[cl({type:"cell.contextmenu"}),1,"cellContextMenu",e=>(0,ce.A)(Wl,e),(e,t)=>(0,he.A)(Wl,e,t)],[cl({type:"cell.click"}),1,"cellClick",e=>(0,ce.A)(Rl,e),(e,t)=>(0,he.A)(Rl,e,t)]],0,(e=>Sl.has((0,oe.A)(e))),fe.ReactNextElement)),is()},3971:(e,t,a)=>{a.d(t,{A:()=>o});var n=a(6758),i=a.n(n),s=a(935),l=a.n(s)()(i());l.push([e.id,':host{display:block;--local-label-line-height:inherit;--local-label-font-size:inherit;--local-label-color:inherit;--local-label-font-weight:inherit}:host([hidden]){display:none}:host([type="line"]){--local-label-line-height:18px;--local-label-font-size:11px;--local-label-color:var(--color-secondary-text);--local-label-font-weight:400}*{box-sizing:border-box}.label{max-width:168px;margin:-3px}.label-text,\n.label-input{width:100%;height:24px;padding:3px;border:none;line-height:var(--local-label-line-height);font-size:var(--local-label-font-size);color:var(--local-label-color);font-weight:var(--local-label-font-weight);text-align:center;font-family:inherit;cursor:text;-webkit-user-select:text;-moz-user-select:text;user-select:text}.label-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.label.editing .label-text,\n.label.empty:not(.editing) .label-text,\n.label:not(.editing) .label-input{display:none}',""]);const o=l.toString()},497:(e,t,a)=>{a.d(t,{A:()=>o});var n=a(6758),i=a.n(n),s=a(935),l=a.n(s)()(i());l.push([e.id,'*{box-sizing:border-box}:host{display:block;border:1px solid var(--palette-gray-5);cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([hidden]){display:none}:host([usage="dragging"]){opacity:0.75;position:fixed}:host(:not([usage="library"])){background:var(--palette-gray-3);width:60px;height:60px}:host([usage="library"]){width:180px;height:30px;margin-bottom:10px}div{width:100%;height:100%;display:flex;align-items:center;justify-content:center}:host(:not([usage="dragging"]):not([usage="library"]):hover),\n:host([status="highlighted"]){color:var(--palette-blue-5);background:var(--palette-blue-1);border-color:1px solid var(--palette-blue-4)}:host([status="faded"]){opacity:0.3}:host([decorator="area"]){width:100px;height:60px;background:rgba(119,141,195,0.1);border:none}:host([decorator="text"]){width:auto;height:auto;background:none;border:none}',""]);const o=l.toString()},6330:(e,t,a)=>{function n(e,t,a,n,i,s,l){try{var o=e[s](l),r=o.value}catch(e){return void a(e)}o.done?t(r):Promise.resolve(r).then(n,i)}function i(e){return function(){var t=this,a=arguments;return new Promise((function(i,s){var l=e.apply(t,a);function o(e){n(l,i,s,o,r,"next",e)}function r(e){n(l,i,s,o,r,"throw",e)}o(void 0)}))}}a.d(t,{A:()=>i})},780:(e,t,a)=>{a.d(t,{_:()=>s});var n=a(6330),i=a(3496),s=function(){var e=(0,n.A)((function*(e,t,a){return(yield i.http.post("api/gateway/cmdb.instance.CreateInstance/v2/object/".concat(e,"/instance"),t,a)).data}));return function(t,a,n){return e.apply(this,arguments)}}()},8406:(e,t,a)=>{a.d(t,{y:()=>s});var n=a(6330),i=a(3496),s=function(){var e=(0,n.A)((function*(e,t,a){return(yield i.http.post("api/gateway/cmdb.instance.PostSearchV3/v3/object/".concat(e,"/instance/_search"),t,a)).data}));return function(t,a,n){return e.apply(this,arguments)}}()},6841:(e,t,a)=>{a.d(t,{x:()=>s});var n=a(6330),i=a(3496),s=function(){var e=(0,n.A)((function*(e,t,a,n){return(yield i.http.put("api/gateway/cmdb.instance.UpdateInstanceV2/v2/object/".concat(e,"/instance/").concat(t),a,n)).data}));return function(t,a,n,i){return e.apply(this,arguments)}}()},4993:(e,t,a)=>{function n(e,t,a){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+a)/6)}function i(e){this._context=e}function s(e){return new i(e)}a.d(t,{Ay:()=>s}),i.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:n(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:n(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}},4643:(e,t,a)=>{a.d(t,{dJ:()=>i,kl:()=>s});class n{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}}function i(e){return new n(e,!0)}function s(e){return new n(e,!1)}},482:(e,t,a)=>{function n(e){this._context=e}function i(e){return new n(e)}a.d(t,{A:()=>i}),n.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}}},3488:(e,t,a)=>{function n(e){return e<0?-1:1}function i(e,t,a){var i=e._x1-e._x0,s=t-e._x1,l=(e._y1-e._y0)/(i||s<0&&-0),o=(a-e._y1)/(s||i<0&&-0),r=(l*s+o*i)/(i+s);return(n(l)+n(o))*Math.min(Math.abs(l),Math.abs(o),.5*Math.abs(r))||0}function s(e,t){var a=e._x1-e._x0;return a?(3*(e._y1-e._y0)/a-t)/2:t}function l(e,t,a){var n=e._x0,i=e._y0,s=e._x1,l=e._y1,o=(s-n)/3;e._context.bezierCurveTo(n+o,i+o*t,s-o,l-o*a,s,l)}function o(e){this._context=e}function r(e){this._context=new h(e)}function h(e){this._context=e}function c(e){return new o(e)}function d(e){return new r(e)}a.d(t,{G:()=>c,N:()=>d}),o.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:l(this,this._t0,s(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var a=NaN;if(t=+t,(e=+e)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,l(this,s(this,a=i(this,e,t)),a);break;default:l(this,this._t0,a=i(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=a}}},(r.prototype=Object.create(o.prototype)).point=function(e,t){o.prototype.point.call(this,t,e)},h.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,a,n,i,s){this._context.bezierCurveTo(t,e,n,a,s,i)}}},6066:(e,t,a)=>{function n(e){this._context=e}function i(e){var t,a,n=e.length-1,i=new Array(n),s=new Array(n),l=new Array(n);for(i[0]=0,s[0]=2,l[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,s[t]=4,l[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,s[n-1]=7,l[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)a=i[t]/s[t-1],s[t]-=a,l[t]-=a*l[t-1];for(i[n-1]=l[n-1]/s[n-1],t=n-2;t>=0;--t)i[t]=(l[t]-i[t+1])/s[t];for(s[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)s[t]=2*e[t+1]-i[t+1];return[i,s]}function s(e){return new n(e)}a.d(t,{A:()=>s}),n.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,a=e.length;if(a)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),2===a)this._context.lineTo(e[1],t[1]);else for(var n=i(e),s=i(t),l=0,o=1;o<a;++l,++o)this._context.bezierCurveTo(n[0][l],s[0][l],n[1][l],s[1][l],e[o],t[o]);(this._line||0!==this._line&&1===a)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}}},3269:(e,t,a)=>{function n(e){return function(){return e}}a.d(t,{A:()=>p}),Array.prototype.slice;var i=a(482);const s=Math.PI,l=2*s,o=1e-6,r=l-o;function h(e){this._+=e[0];for(let t=1,a=e.length;t<a;++t)this._+=arguments[t]+e[t]}class c{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?h:function(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return h;const a=10**t;return function(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=Math.round(arguments[t]*a)/a+e[t]}}(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,a,n){this._append`Q${+e},${+t},${this._x1=+a},${this._y1=+n}`}bezierCurveTo(e,t,a,n,i,s){this._append`C${+e},${+t},${+a},${+n},${this._x1=+i},${this._y1=+s}`}arcTo(e,t,a,n,i){if(e=+e,t=+t,a=+a,n=+n,(i=+i)<0)throw new Error(`negative radius: ${i}`);let l=this._x1,r=this._y1,h=a-e,c=n-t,d=l-e,u=r-t,p=d*d+u*u;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(p>o)if(Math.abs(u*h-c*d)>o&&i){let g=a-l,f=n-r,A=h*h+c*c,v=g*g+f*f,y=Math.sqrt(A),m=Math.sqrt(p),b=i*Math.tan((s-Math.acos((A+p-v)/(2*y*m)))/2),k=b/m,w=b/y;Math.abs(k-1)>o&&this._append`L${e+k*d},${t+k*u}`,this._append`A${i},${i},0,0,${+(u*g>d*f)},${this._x1=e+w*h},${this._y1=t+w*c}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,a,n,i,h){if(e=+e,t=+t,h=!!h,(a=+a)<0)throw new Error(`negative radius: ${a}`);let c=a*Math.cos(n),d=a*Math.sin(n),u=e+c,p=t+d,g=1^h,f=h?n-i:i-n;null===this._x1?this._append`M${u},${p}`:(Math.abs(this._x1-u)>o||Math.abs(this._y1-p)>o)&&this._append`L${u},${p}`,a&&(f<0&&(f=f%l+l),f>r?this._append`A${a},${a},0,1,${g},${e-c},${t-d}A${a},${a},0,1,${g},${this._x1=u},${this._y1=p}`:f>o&&this._append`A${a},${a},0,${+(f>=s)},${g},${this._x1=e+a*Math.cos(i)},${this._y1=t+a*Math.sin(i)}`)}rect(e,t,a,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${a=+a}v${+n}h${-a}Z`}toString(){return this._}}function d(e){return e[0]}function u(e){return e[1]}function p(e,t){var a=n(!0),s=null,l=i.A,o=null,r=function(e){let t=3;return e.digits=function(a){if(!arguments.length)return t;if(null==a)t=null;else{const e=Math.floor(a);if(!(e>=0))throw new RangeError(`invalid digits: ${a}`);t=e}return e},()=>new c(t)}(h);function h(n){var i,h,c,d=(n=function(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}(n)).length,u=!1;for(null==s&&(o=l(c=r())),i=0;i<=d;++i)!(i<d&&a(h=n[i],i,n))===u&&((u=!u)?o.lineStart():o.lineEnd()),u&&o.point(+e(h,i,n),+t(h,i,n));if(c)return o=null,c+""||null}return e="function"==typeof e?e:void 0===e?d:n(e),t="function"==typeof t?t:void 0===t?u:n(t),h.x=function(t){return arguments.length?(e="function"==typeof t?t:n(+t),h):e},h.y=function(e){return arguments.length?(t="function"==typeof e?e:n(+e),h):t},h.defined=function(e){return arguments.length?(a="function"==typeof e?e:n(!!e),h):a},h.curve=function(e){return arguments.length?(l=e,null!=s&&(o=l(s)),h):l},h.context=function(e){return arguments.length?(null==e?s=o=null:o=l(s=e),h):s},h}c.prototype}}]);
3
+ //# sourceMappingURL=9074.daf4e2c5.js.map