@relation-graph/react 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/relation-graph.js +251 -23
- package/relation-graph.mjs +7368 -5902
- package/relation-graph.umd.js +251 -23
- package/types/packages/platforms/react/src/index.d.ts +98 -64
- package/types/packages/platforms/react/src/relation-graph/RGProvider.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/RelationGraph.d.ts +7 -3
- package/types/packages/platforms/react/src/relation-graph/RelationLinker.d.ts +4 -5
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvas.d.ts +2 -3
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent.d.ts +10 -3
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent4CreatingLine.d.ts +10 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent4FakeLines.d.ts +11 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent4Lines.d.ts +12 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent4Nodes.d.ts +13 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGFakeNode.d.ts +1 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGGraphRefs.d.ts +0 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLineContent.d.ts +1 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLinePath.d.ts +1 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLinePeel.d.ts +2 -3
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLineText.d.ts +1 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGNodePeel.d.ts +10 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationGraphUI.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationGraphView.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationLinkerCanvas.d.ts +4 -5
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationLinkerUI.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationLinkerView.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGConnectSource.d.ts +1 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGConnectTarget.d.ts +1 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingConnectPoints.d.ts +1 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingLineController.d.ts +1 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingNearNodeWidget.d.ts +1 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGMiniView.d.ts +1 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnLine.d.ts +1 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnLineText.d.ts +1 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnNode.d.ts +1 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/store/index.d.ts +3 -2
- package/types/packages/platforms/react/src/relation-graph/src/core4react/store/reducers/RGStore.d.ts +10 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphBackground.d.ts +1 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphOperateStuff.d.ts +1 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphToolBar.d.ts +1 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphWatermark.d.ts +1 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphXsToolBar.d.ts +1 -1
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/RGDebugView.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/hooks/RGDataProvider.d.ts +17 -0
- package/types/packages/platforms/react/src/relation-graph/src/hooks/RGHooks.d.ts +24 -1
- package/types/packages/platforms/react/src/relation-graph/src/hooks/useFakeNodesState.d.ts +1 -1
- package/types/packages/platforms/react/src/relation-graph/src/hooks/useGraphInstance.d.ts +2 -12
- package/types/packages/platforms/react/src/relation-graph/src/hooks/useGraphStore.d.ts +13 -0
- package/types/packages/platforms/react/src/relation-graph/src/hooks/useRelationGraph.d.ts +11 -0
- package/types/packages/platforms/react/src/relation-graph/src/hooks/useRelationLinker.d.ts +17 -0
- package/types/packages/platforms/react/src/types-react.d.ts +24 -24
- package/types/packages/platforms/svelte/src/RGProvider.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/context.d.ts +4 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGCanvas.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent4CreatingLine.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent4FakeLines.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent4Lines.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent4Nodes.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGEasyView.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGFakeNode.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGGraphDefs.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGLineContent.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGLinePath.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGLinePeel.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGLineText.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGNodeExpandHolder.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGNodePeel.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGProvider4Instance.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RelationGraph.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RelationGraphUI.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RelationLinker.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RelationLinkerCanvas.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RelationLinkerUI.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGConnectSource.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGConnectTarget.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGConnectTargetUI.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingConnectController.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingConnectPoints.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingLineController.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingLineControllerUI.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingNearNodeWidget.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingNodeController.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingNodeControllerUI.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingReferenceLine.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingResize.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingResizeUI.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGMiniView.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGMiniViewContent.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/RGConnectTarget.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingConnectController.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingLineController.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingNearNodeWidget.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingNodeController.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingReferenceLine.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingResize.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/RGMiniView.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/RelationGraphWithProvider.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/WebComponentUtils.d.ts +11 -0
- package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphBackground.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphLoading.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphMoveOperator.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphOperateStuff.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphWatermark.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphXsToolBar.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/widgets/RGIcons.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/hooks/RGHooks.d.ts +27 -0
- package/types/packages/platforms/svelte/src/hooks/useGraphInstance.d.ts +2 -0
- package/types/packages/platforms/svelte/src/hooks/useGraphStore.d.ts +14 -0
- package/types/packages/platforms/svelte/src/hooks/useRGDataProvider.d.ts +19 -0
- package/types/packages/platforms/svelte/src/hooks/useRelationGraph.d.ts +48 -0
- package/types/packages/platforms/svelte/src/index.d.ts +194 -0
- package/types/packages/platforms/svelte/src/types-svelte.d.ts +85 -0
- package/types/packages/platforms/vue2/src/core4vue/RGCanvas.vue.d.ts +2 -6
- package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent.vue.d.ts +6 -6
- package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent4CreatingLine.vue.d.ts +9 -0
- package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent4FakeLines.vue.d.ts +9 -0
- package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent4Lines.vue.d.ts +9 -0
- package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent4Nodes.vue.d.ts +9 -0
- package/types/packages/platforms/vue2/src/core4vue/RGEasyView.vue.d.ts +1 -0
- package/types/packages/platforms/vue2/src/core4vue/RGGraphDefs.vue.d.ts +1 -0
- package/types/packages/platforms/vue2/src/core4vue/RGLineContent.vue.d.ts +18 -18
- package/types/packages/platforms/vue2/src/core4vue/RGLinePath.vue.d.ts +4 -28
- package/types/packages/platforms/vue2/src/core4vue/RGLinePeel.vue.d.ts +4 -15
- package/types/packages/platforms/vue2/src/core4vue/RGNodeExpandHolder.vue.d.ts +3 -9
- package/types/packages/platforms/vue2/src/core4vue/RGNodePeel.vue.d.ts +5 -20
- package/types/packages/platforms/vue2/src/core4vue/RGProvider.vue.d.ts +50 -0
- package/types/packages/platforms/vue2/src/core4vue/RelationGraph.vue.d.ts +5 -773
- package/types/packages/platforms/vue2/src/core4vue/RelationGraphUI.vue.d.ts +46 -0
- package/types/packages/platforms/vue2/src/core4vue/RelationLinker.vue.d.ts +8 -24
- package/types/packages/platforms/vue2/src/core4vue/RelationLinkerCanvas.vue.d.ts +1 -0
- package/types/packages/platforms/vue2/src/core4vue/RelationLinkerUI.vue.d.ts +23 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGConnectSource.vue.d.ts +3 -1
- package/types/packages/platforms/vue2/src/core4vue/editing/RGConnectTarget.vue.d.ts +1 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingConnectController.vue.d.ts +2 -1
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingConnectPoints.vue.d.ts +1 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingLineController.vue.d.ts +12 -2
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingNearNodeWidget.vue.d.ts +1 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingNodeController.vue.d.ts +1 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingReferenceLine.vue.d.ts +1 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingResize.vue.d.ts +1 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGMiniView.vue.d.ts +3 -1
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphBackground.vue.d.ts +1 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphLoading.vue.d.ts +1 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphMoveOperator.vue.d.ts +1 -1
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphOperateStuff.vue.d.ts +1 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphToolBar.vue.d.ts +1 -1
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphWatermark.vue.d.ts +1 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphXsToolBar.vue.d.ts +1 -1
- package/types/packages/platforms/vue2/src/core4vue/widgets/RGDebugView.vue.d.ts +12 -0
- package/types/packages/platforms/vue2/src/hooks/GraphStoreMixin.d.ts +40 -0
- package/types/packages/platforms/vue2/src/index.d.ts +138 -1692
- package/types/packages/platforms/vue2/src/types-vue2.d.ts +3 -0
- package/types/packages/platforms/vue3/src/constants.d.ts +0 -1
- package/types/packages/platforms/vue3/src/index.d.ts +97 -1404
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGConnectSource.vue.d.ts +2 -2
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGConnectTarget.vue.d.ts +4 -4
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGEditingLineController.vue.d.ts +2 -2
- package/types/packages/platforms/vue3/src/relation-graph/src/hooks/RGHooks.d.ts +27 -2
- package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useGraphData.d.ts +2 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useGraphInstance.d.ts +1 -12
- package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useGraphStore.d.ts +16 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useRGDataProvider.d.ts +17 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useRelationGraph.d.ts +131 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useRelationLinker.d.ts +39 -0
- package/types/packages/platforms/vue3/src/types-vue3.d.ts +104 -4
- package/types/packages/platforms/vue3/src/types.d.ts +3 -1
- package/types/packages/relation-graph-models/RGObjectsForExport.d.ts +40 -32
- package/types/packages/relation-graph-models/data/RGDataDefine.d.ts +23 -0
- package/types/packages/relation-graph-models/data/RGDataGetter.d.ts +36 -0
- package/types/packages/relation-graph-models/data/RGDataProvider.d.ts +66 -0
- package/types/packages/relation-graph-models/data/RGDataProvider4React.d.ts +9 -0
- package/types/packages/relation-graph-models/data/RGDataProvider4Svelte.d.ts +10 -0
- package/types/packages/relation-graph-models/data/RGDataProvider4Vue2.d.ts +9 -0
- package/types/packages/relation-graph-models/data/RGDataProvider4Vue3.d.ts +10 -0
- package/types/packages/relation-graph-models/data/RGDataProvider4Vue3V1.d.ts +10 -0
- package/types/packages/relation-graph-models/data/RGLineDataUtils.d.ts +9 -0
- package/types/packages/relation-graph-models/data/RGNodeDataUtils.d.ts +14 -0
- package/types/packages/relation-graph-models/data/RGOptionsDataUtils.d.ts +9 -0
- package/types/packages/relation-graph-models/data/utils/EdgeCounter.d.ts +8 -0
- package/types/packages/relation-graph-models/layouts/RGBaseLayout.d.ts +37 -0
- package/types/packages/relation-graph-models/layouts/RGCenterLayout.d.ts +9 -0
- package/types/packages/relation-graph-models/layouts/RGCircleLayout.d.ts +7 -0
- package/types/packages/relation-graph-models/layouts/RGFixedLayout.d.ts +10 -0
- package/types/packages/relation-graph-models/layouts/RGFolderLayout.d.ts +15 -0
- package/types/packages/relation-graph-models/layouts/RGForceLayout.d.ts +77 -0
- package/types/packages/relation-graph-models/layouts/RGIOTreeLayout.d.ts +18 -0
- package/types/packages/relation-graph-models/layouts/RGSmartTreeLayout.d.ts +14 -0
- package/types/packages/relation-graph-models/layouts/RGTreeLayout.d.ts +17 -0
- package/types/packages/relation-graph-models/layouts/analyzers/BasicNetworkAnalyzer.d.ts +27 -0
- package/types/packages/relation-graph-models/layouts/analyzers/RGNetworkAnalyzer.d.ts +27 -0
- package/types/packages/relation-graph-models/models/RelationGraphBase.d.ts +31 -18
- package/types/packages/relation-graph-models/models/RelationGraphCore.d.ts +46 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith1View.d.ts +91 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith2Data.d.ts +34 -381
- package/types/packages/relation-graph-models/models/RelationGraphWith2Data1Getter.d.ts +77 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith2Data2Analysis.d.ts +172 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith2Data3Update.d.ts +257 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith2Data4ConnectTarget.d.ts +85 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith2Data5LineConfig.d.ts +35 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith3Options1Update.d.ts +75 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith3Options2API.d.ts +39 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith4Line.d.ts +81 -21
- package/types/packages/relation-graph-models/models/RelationGraphWith5Zoom.d.ts +19 -21
- package/types/packages/relation-graph-models/models/RelationGraphWith6Effect.d.ts +56 -4
- package/types/packages/relation-graph-models/models/RelationGraphWith6Layout.d.ts +60 -12
- package/types/packages/relation-graph-models/models/RelationGraphWith7Event.d.ts +233 -36
- package/types/packages/relation-graph-models/models/RelationGraphWith91Editing.d.ts +176 -25
- package/types/packages/relation-graph-models/models/RelationGraphWith92MiniView.d.ts +70 -13
- package/types/packages/relation-graph-models/models/RelationGraphWith93Image.d.ts +36 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith93Image_codes.d.ts +36 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith95Dom.d.ts +108 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith99API.d.ts +125 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith9EasyView.d.ts +57 -11
- package/types/packages/relation-graph-models/utils/RGCanvasImpl2D.d.ts +2 -3
- package/types/packages/relation-graph-models/utils/RGCommon.d.ts +6 -1
- package/types/packages/relation-graph-models/utils/RGDragUtils.d.ts +14 -11
- package/types/packages/relation-graph-models/utils/RGFullscreenUtils.d.ts +1 -1
- package/types/packages/relation-graph-models/utils/RGGraphMath.d.ts +27 -0
- package/types/packages/relation-graph-models/utils/RGIntergration.d.ts +32 -34
- package/types/packages/relation-graph-models/utils/RGNodesAnalytic.d.ts +6 -15
- package/types/packages/relation-graph-models/utils/RGTips.d.ts +7 -0
- package/types/packages/relation-graph-models/utils/line/RGLinePath.d.ts +16 -1
- package/types/packages/relation-graph-models/utils/line/RGLinePathUtils.d.ts +1 -1
- package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor1.d.ts +1 -1
- package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor4.d.ts +1 -1
- package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor44.d.ts +1 -1
- package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor49.d.ts +1 -1
- package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor6.d.ts +1 -1
- package/types/packages/relation-graph-models/utils/line/RGPathGeneratorForCurve.d.ts +1 -1
- package/types/packages/types.d.ts +1467 -0
- package/types/packages/types.ts +1472 -0
- package/types/react.d.ts +38 -38
- package/types/vue3.d.ts +229 -229
package/relation-graph.umd.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
(function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode("@charset \"UTF-8\";.relation-graph{box-sizing:border-box;position:relative;min-width:300px;min-height:300px;--rg-node-opacity: 1;--editor-main-color: rgb(64, 165, 248);--editor-light-color: rgb(125, 192, 248);--editor-light2-color: rgb(168, 212, 248);--editor-light-opacity: rgba(57, 144, 216, .1);--rg-node-font-size: 12px;--rg-node-font-color: #000000;--rg-node-color: #eeeeee;--rg-node-border-color: #333333;--rg-node-border-width: 1px;--rg-node-width: fit-content;--rg-node-height: fit-content;--rg-node-text-px: 10px;--rg-node-text-py: 3px;--rg-background-color: transparent;--rg-line-color: #888888;--rg-line-width: 2px;--rg-checked-line-bg-color: rgba(150,150,150,.2)}.relation-graph:focus{outline:none}.relation-graph .rg-graph-plugs{position:absolute;left:0px;top:0px;z-index:90;width:100%;height:100%;pointer-events:none;user-select:none}.relation-graph .rg-graph-plugs .rg-graph-slot{position:relative;width:100%;height:100%}.relation-graph .rg-background{position:absolute;left:0px;top:0px;width:100%;height:100%;z-index:0}.relation-graph .rg-watermark{position:absolute;--watermark-width: 200px;--watermark-height: 100px;z-index:1200;overflow:visible;min-height:100px;min-width:100px;width:var(--watermark-width);height:var(--watermark-height);box-sizing:border-box}.relation-graph .rg-watermark div{box-sizing:border-box}.relation-graph .rg-watermark.rg-watermark-top{left:calc((100% - var(--watermark-width)) / 2);top:10px}.relation-graph .rg-watermark.rg-watermark-bottom{left:calc((100% - var(--watermark-width)) / 2);bottom:10px}.relation-graph .rg-watermark.rg-watermark-left{left:10px;top:calc((100% - var(--watermark-height)) / 2)}.relation-graph .rg-watermark.rg-watermark-right{right:10px;top:calc((100% - var(--watermark-height)) / 2)}.relation-graph .rg-watermark.rg-watermark-tl{left:10px;top:10px}.relation-graph .rg-watermark.rg-watermark-tr{right:10px;top:10px}.relation-graph .rg-watermark.rg-watermark-bl{left:10px;bottom:10px}.relation-graph .rg-watermark.rg-watermark-br{right:10px;bottom:10px}.relation-graph .rg-lines-container svg{overflow:visible}.relation-graph .rg-lines-svg{overflow:visible;width:10px;height:10px;position:absolute;left:0px;top:0px}.relation-graph .rg-lines-container{overflow:visible;position:absolute;z-index:40;width:100%;top:0px;left:0px;pointer-events:none}.relation-graph .rg-lines-container-el-lines{z-index:80;pointer-events:none}.relation-graph .rg-lines-container-el-lines .rg-line-bg{pointer-events:stroke}.relation-graph .rg-lines-container-el-lines .rg-line-text{pointer-events:all}.relation-graph .rg-lines-svg-el-lines{overflow:visible;width:10px;height:10px;position:absolute;left:0px;top:0px}.relation-graph .rg-nodes-container{position:absolute;width:100%;top:0px;left:0px;z-index:50}.relation-graph .rg-map{--rg-line-width: 1px;--rg-line-color: #666666;--rg-line-fontsize: 12px;--rg-line-opacity: 1;background-color:var(--bg-background-color);overflow:hidden;cursor:default;user-select:none;opacity:.01;transition:none;width:100%;height:100%;position:relative}.relation-graph.rg-move-mode .rg-map{cursor:grab}.relation-graph .rg-map-ready{opacity:1;transition:opacity .5s ease}.relation-graph .rg-map-background-norepeat{background-repeat:no-repeat;background-position:right bottom}.relation-graph .rg-map-canvas{position:relative;user-select:none;pointer-events:none;top:0px;left:0px;border:0px;z-index:3;overflow:visible;white-space:nowrap;transform-origin:0 0}.relation-graph .rg-map-canvas .rg-events-all{pointer-events:all}.relation-graph.rg-enable-node-xy-animation .rg-node-peel{transition:transform .3s ease,top .3s ease}.relation-graph.rg-enable-node-xy-animation .rg-line-peel{opacity:0;transition:none}.relation-graph.rg-enable-node-xy-animation .rg-map-canvas{transition:transform .4s ease-in-out}.relation-graph.rg-enable-canvas-animation .rg-map-canvas{transition:transform .5s ease}.relation-graph.rg-enable-canvas-animation .rg-editing-ctrl,.relation-graph.rg-enable-canvas-animation .rg-editing-line-ctrl,.relation-graph.rg-enable-canvas-animation .rg-editing-connect-ctrl{opacity:0}.relation-graph .rg-canvas-behind{z-index:2;position:absolute}.relation-graph .rg-canvas-above{z-index:5;position:absolute}.relation-graph .rg-canvas-slot{overflow:visible;position:absolute;margin-top:0;margin-left:0}.relation-graph .rg-canvas-slot-behind{z-index:30;overflow:visible}.relation-graph .rg-canvas-slot-above{z-index:70;overflow:visible}.relation-graph .rg-single-graph{position:relative}.relation-graph .rg-map ::v-deep img{-webkit-user-drag:none;-webkit-user-select:none}.relation-graph .rg-line-text{fill:var(--rg-line-fontcolor, #888888);font-size:var(--rg-line-fontsize);paint-order:stroke;pointer-events:all}.relation-graph .rg-linetext-container{position:absolute;pointer-events:none;user-select:none;overflow:visible;left:0;top:0;z-index:45;display:block}.relation-graph .rg-linetext-container .rg-line-peel{width:fit-content;--rg-line-fontcolor: var(--rg-line-color)}.relation-graph .rg-linetext-container .rg-line-peel .rg-line-label{display:block;color:var(--rg-line-fontcolor, #888888);font-size:var(--rg-line-fontsize);transform-origin:0 0;position:absolute;user-select:none;pointer-events:all;box-sizing:border-box;padding:2px 6px;border-radius:5px}.relation-graph .rg-linetext-container .rg-line-peel-checked .rg-line-label{background-color:var(--rg-checked-line-bg-color)}.relation-graph .rg-line-peel{--rg-line-fontcolor: var(--rg-line-color);pointer-events:none;cursor:default;transition:opacity .2s ease-in;opacity:var(--rg-line-opacity, 1)}.relation-graph .rg-line{fill-rule:nonzero;stroke-linecap:round;stroke:var(--rg-line-color);stroke-width:var(--rg-line-width);pointer-events:none;fill:none;marker-end:var(--rg-line-marker-end);marker-start:var(--rg-line-marker-start)}.relation-graph .rg-line-bg{stroke:#fff;opacity:.01;fill:none;fill-rule:nonzero;stroke-linecap:round;pointer-events:stroke;stroke-width:calc(var(--rg-line-width) + 6px)}.relation-graph .rg-line-bg:hover{opacity:.1;stroke:var(--rg-line-color)}.relation-graph .rg-line-peel-checked .rg-line-bg{stroke:var(--rg-checked-line-bg-color);opacity:1}.relation-graph .rg-line-peel-checked .rg-line{z-index:100}.relation-graph .rg-line-peel-checked .rg-line-text{stroke:var(--rg-checked-line-bg-color);stroke-width:2}.relation-graph .rg-line-peel-disable-events{pointer-events:none!important}.relation-graph .rg-line-peel-disable-events .rg-line-bg,.relation-graph .rg-line-peel-disable-events .rg-line-text,.relation-graph .rg-linetext-container .rg-line-peel-disable-events .rg-line-bg,.relation-graph .rg-linetext-container .rg-line-peel-disable-events .rg-line-label{pointer-events:none}.relation-graph .rg-line-dashtype-1{stroke-dasharray:2,2,2;stroke-dashoffset:3px;stroke-linecap:butt;stroke-linejoin:bevel}.relation-graph .rg-line-dashtype-2{stroke-dasharray:5,5,5;stroke-dashoffset:3px;stroke-linecap:butt;stroke-linejoin:bevel}.relation-graph .rg-line-dashtype-3{stroke-dasharray:9,9,9;stroke-dashoffset:3px;stroke-linecap:butt;stroke-linejoin:bevel}.relation-graph .rg-line-dashtype-4{stroke-dasharray:5,5,15;stroke-dashoffset:3px;stroke-linecap:butt;stroke-linejoin:bevel}@keyframes ACTRGLineChecked{0%{stroke-dashoffset:352px;stroke-dasharray:5,5,5}50%{stroke-dasharray:5,5,5;stroke-dashoffset:3px}to{stroke-dashoffset:352px;stroke-dasharray:5,5,5}}@keyframes rg-line-anm1{0%{stroke-dashoffset:100px;stroke-dasharray:5,5,5}to{stroke-dasharray:5,5,5;stroke-dashoffset:3px}}@keyframes rg-line-anm2{0%{stroke-dashoffset:0;stroke-dasharray:4,4,4}to{stroke-dashoffset:10px;stroke-dasharray:20,20,20}}@keyframes rg-line-anm3{0%{stroke-opacity:1}50%{stroke-opacity:.2}to{stroke-opacity:1}}@keyframes rg-line-anm4{0%{stroke-dasharray:0,100%}to{stroke-dasharray:100%,0}}.relation-graph .rg-line-anm-1{animation:rg-line-anm1 10s infinite;animation-fill-mode:forwards;animation-timing-function:linear}.relation-graph .rg-line-anm-2{animation:rg-line-anm2 3s infinite}.relation-graph .rg-line-anm-3{animation:rg-line-anm3 1s infinite}.relation-graph .rg-line-anm-4{animation:rg-line-anm4 3s infinite}@keyframes deform1{0%{stroke-dashoffset:0}to{stroke-dashoffset:100%}}.relation-graph .rg-icon{width:19px;height:19px;vertical-align:0px;fill:currentColor;overflow:hidden}.relation-graph .rg-node-peel{padding:0;position:absolute;pointer-events:all;font-size:14px;box-sizing:border-box;opacity:var(--rg-node-opacity);z-index:var(--rg-node-z-index);transform-origin:0 0;cursor:default}.relation-graph .rg-node-peel-checked{z-index:9999}.relation-graph .rg-node-peel-disable-events{pointer-events:none}.relation-graph .rg-node{text-align:center;border-style:solid;box-sizing:border-box;transform-origin:0 0;font-size:var(--rg-node-font-size);color:var(--rg-node-font-color);background-color:var(--rg-node-color);border-color:var(--rg-node-border-color);border-width:var(--rg-node-border-width);width:var(--rg-node-width);height:var(--rg-node-height)}.relation-graph .rg-node-shape-0{border-radius:50%}.relation-graph .rg-node-shape-1{border-radius:var(--rg-node-border-radius, 3px)}.relation-graph img,.relation-graph svg,.relation-graph video,.relation-graph canvas,.relation-graph audio,.relation-graph iframe,.relation-graph embed,.relation-graph object{display:unset;vertical-align:unset}.relation-graph .rg-node-text{color:var(--rg-node-font-color);font-size:var(--rg-node-font-size);padding:var(--rg-node-text-py) var(--rg-node-text-px);height:100%;width:100%;display:flex;align-items:center;justify-content:center;box-sizing:border-box}.relation-graph .rg-node-type-button{border-radius:25px;color:#00f;cursor:pointer}.relation-graph .rg-node-checked{transition:background-color .2s ease,outline .2s ease,color .2s ease,-webkit-box-shadow .2s ease;box-shadow:0 0 0 8px var(--rg-checked-line-bg-color)}.relation-graph .rg-node-dragging{z-index:400}.relation-graph .rg-node-selected{box-shadow:0 0 0 2px var(--editor-main-color);z-index:400}.relation-graph .rg-editing-referline{user-select:none;position:absolute;z-index:999;pointer-events:none;width:100%;height:100%;left:0px;top:0px}.relation-graph .rg-editing-referline .rg-referline{position:absolute;display:flex;place-items:center;justify-content:center;overflow:visible;transform-origin:0 0}.relation-graph .rg-editing-referline .rg-referline .referline{display:flex;place-items:center;justify-content:center}.relation-graph .rg-editing-referline .rg-referline .referline>div{background-color:var(--editor-main-color);font-size:8px;border-radius:3px;color:#fff;width:fit-content;height:fit-content;padding:2px 5px}.relation-graph .rg-editing-referline .rg-referline-v{top:0px;width:6px;height:100%;transform:translate(-3px);border-top:var(--editor-main-color) solid 6px;border-bottom:var(--editor-main-color) solid 6px}.relation-graph .rg-editing-referline .rg-referline-v .referline{width:1px;height:100%;border-left:var(--editor-main-color) solid 1px}.relation-graph .rg-editing-referline .rg-referline-h{left:0px;width:100%;height:6px;transform:translateY(-3px);border-left:var(--editor-main-color) solid 6px;border-right:var(--editor-main-color) solid 6px}.relation-graph .rg-editing-referline .rg-referline-h .referline{width:100%;height:1px;border-top:var(--editor-main-color) solid 1px}.relation-graph .rg-editing-line-ctrl{position:absolute;left:0px;top:0px;z-index:500;pointer-events:none;user-select:none;width:100%;height:100%}.relation-graph .rg-editing-line-ctrl .rg-edt-ctrl-svg{position:absolute;pointer-events:none;left:0px;top:0px;overflow:visible}.relation-graph .rg-editing-line-ctrl .rg-edt-ctrl-svg path{stroke:var(--editor-main-color);stroke-width:1px}.relation-graph .rg-editing-line-ctrl .rg-line-ctrl-dot{--rg-ctl-x: 0px;--rg-ctl-y: 0px;pointer-events:auto;user-select:none;width:10px;height:10px;background-color:#fff;box-shadow:0 0 0 1px var(--editor-main-color);position:absolute;border-radius:50%;cursor:move;z-index:1;transform-origin:0 0}.relation-graph .rg-editing-line-ctrl .start-dot,.relation-graph .rg-editing-line-ctrl .end-dot,.relation-graph .rg-editing-line-ctrl .ctrl-dot{transform-origin:0 0;transform:translate(-50%,-50%) translate(var(--rg-ctl-x),var(--rg-ctl-y))}.relation-graph .rg-editing-line-ctrl .ctrl-split,.relation-graph .rg-editing-line-ctrl .ctrl-split-core{background-color:#fff}.relation-graph .rg-editing-line-ctrl .ctrl-split-h{width:12px;height:5px;border-radius:3px;cursor:row-resize;transform:translate(-50%,-50%) translate(var(--rg-ctl-x),var(--rg-ctl-y))}.relation-graph .rg-editing-line-ctrl .ctrl-split-v{width:5px;height:12px;border-radius:3px;cursor:col-resize;transform:translate(-50%,-50%) translate(var(--rg-ctl-x),var(--rg-ctl-y))}.relation-graph .rg-editing-line-ctrl .rg-line-ctrl-text{--rg-ctl-x: 0px;--rg-ctl-y: 0px;--font-size: 12px;pointer-events:auto;background-color:#fffc;box-shadow:0 0 0 1px var(--editor-main-color);position:absolute;border-radius:3px;cursor:move;z-index:1;white-space:nowrap;color:#000;padding:3px 10px;display:flex;place-items:center;justify-content:center;box-sizing:border-box;text-shadow:none;font-size:var(--font-size, 12px);min-height:20px;max-height:30px;transform-origin:0 0;transform:translate(-50%,-50%) translate(10px,3px) translate(var(--rg-ctl-x),var(--rg-ctl-y));min-width:50px;max-width:220px}.relation-graph .rg-editing-line-ctrl .rg-line-ctrl-text p{font-size:var(--font-size, 12px);color:#333}.relation-graph .rg-editing-line-ctrl .rg-line-ctrl-text p.empty-text{font-size:10px;color:#888}.relation-graph .rg-editing-line-ctrl .rg-line-ctrl-text .rg-line-text-input{white-space:nowrap;pointer-events:auto;user-select:auto;background-color:transparent;color:#000;border-radius:3px;height:100%;padding:3px 0;width:100px;text-shadow:none;font-size:var(--font-size, 12px);text-align:center;box-sizing:border-box;border:none;outline:none}.relation-graph .rg-editing-line-ctrl .rg-line-ctrl-text-editing{background-color:#faf191;--font-size: 12px}.relation-graph .rg-editing-ctrl,.relation-graph .rg-editing-connect-ctrl{user-select:none;position:absolute;z-index:500;box-shadow:0 0 0 1px var(--editor-main-color);border-radius:0;pointer-events:none;transform-origin:0 0}.relation-graph .rg-editing-bar{user-select:none;pointer-events:none;position:absolute;border-radius:5px;padding:3px;box-sizing:border-box;display:flex;place-items:center;justify-content:center;flex-wrap:wrap;gap:5px}.relation-graph .rg-editing-bar .rg-gee-icon{background-color:#d603f680;pointer-events:auto;min-width:20px;min-height:20px;border-radius:5px;box-sizing:border-box;display:flex;place-items:center;justify-content:center;cursor:pointer}.relation-graph .rg-editing-bar .rg-gee-icon:hover{background-color:#d603f6;color:#fff}.relation-graph .rg-connect-source-handle{pointer-events:auto;width:fit-content;height:fit-content}.relation-graph .rg-editing-bar-top{width:fit-content;height:fit-content;left:50%;transform:translate(-50%) translateY(-100%);top:-15px}.relation-graph .rg-editing-bar-bottom{width:fit-content;height:fit-content;left:50%;transform:translate(-50%) translateY(100%);bottom:-15px}.relation-graph .rg-editing-bar-left{width:fit-content;height:fit-content;left:-15px;top:50%;transform:translate(-100%) translateY(-50%)}.relation-graph .rg-editing-bar-right{width:fit-content;height:fit-content;right:-15px;top:50%;transform:translate(100%) translateY(-50%)}.relation-graph .rg-editing-bar-tl{width:30px;height:30px;right:calc(100% + 10px);top:-40px}.relation-graph .rg-editing-bar-tr{width:30px;height:30px;left:calc(100% + 10px);top:-40px}.relation-graph .rg-editing-bar-bl{width:30px;height:30px;right:calc(100% + 10px);bottom:-40px}.relation-graph .rg-editing-bar-br{width:30px;height:30px;left:calc(100% + 10px);bottom:-40px}.relation-graph .rg-resize-ctl{user-select:none;position:relative;height:100%;width:100%;--resize-handler-size: 10px;--resize-handler-offset: -5px}.relation-graph .rg-resize-ctl .rg-resize-ctl-handler{pointer-events:auto;width:var(--resize-handler-size);height:var(--resize-handler-size);background-color:#fff;position:absolute;border-radius:2px;box-shadow:inset 0 0 0 1px var(--editor-main-color)}.relation-graph .rg-resize-ctl .rg-resize-ctl-tl{cursor:nwse-resize;left:var(--resize-handler-offset);top:var(--resize-handler-offset)}.relation-graph .rg-resize-ctl .rg-resize-ctl-tr{cursor:nesw-resize;right:var(--resize-handler-offset);top:var(--resize-handler-offset)}.relation-graph .rg-resize-ctl .rg-resize-ctl-bl{cursor:nesw-resize;left:var(--resize-handler-offset);bottom:var(--resize-handler-offset)}.relation-graph .rg-resize-ctl .rg-resize-ctl-br{cursor:nwse-resize;right:var(--resize-handler-offset);bottom:var(--resize-handler-offset)}.relation-graph .rg-resize-ctl .rg-resize-ctl-t{cursor:n-resize;top:var(--resize-handler-offset);left:calc((100% - var(--resize-handler-size)) / 2)}.relation-graph .rg-resize-ctl .rg-resize-ctl-b{cursor:s-resize;bottom:var(--resize-handler-offset);left:calc((100% - var(--resize-handler-size)) / 2)}.relation-graph .rg-resize-ctl .rg-resize-ctl-l{cursor:w-resize;left:var(--resize-handler-offset);top:calc((100% - var(--resize-handler-size)) / 2)}.relation-graph .rg-resize-ctl .rg-resize-ctl-r{cursor:e-resize;right:var(--resize-handler-offset);top:calc((100% - var(--resize-handler-size)) / 2)}.relation-graph .rg-editing-connect-ctrl{position:absolute;user-select:none;pointer-events:none;z-index:1400;box-shadow:0 0 0 1px var(--editor-main-color);--hander-border-radius: 5px;border-radius:var(--hander-border-radius);--border-handler-width: 8px;--hv-handler-width: 10px;--center-handler-width: 10px;--border-point-width: 10px;--border-point-height: 10px;--hander-color: var(--editor-light2-color);--hander-border-color: var(--editor-main-color)}.relation-graph .rg-connect-ctl{width:100%;height:100%;pointer-events:none;user-select:none}.relation-graph .rg-connect-ctl-handler{pointer-events:auto;user-select:none;z-index:20;cursor:crosshair}.relation-graph .rg-connect-target{width:fit-content;height:fit-content;pointer-events:auto;display:flex;place-items:center;justify-content:center}.relation-graph .rg-connect-ctl-handler-style{background-color:var(--hander-color);border:var(--hander-border-color) solid 1px;position:absolute;border-radius:3px}.relation-graph .rg-connect-ctl-handler-style:hover{background-color:#fbe691}.relation-graph .rg-connect-ctl-center{width:var(--center-handler-width);height:var(--center-handler-width);border-radius:50%;top:calc((100% - var(--center-handler-width)) / 2);left:calc((100% - var(--center-handler-width)) / 2)}.relation-graph .rg-connect-ctl-t{width:var(--border-point-width);height:var(--border-point-height);top:calc(var(--border-point-height) / -2);left:calc((100% - var(--border-point-width)) / 2)}.relation-graph .rg-connect-ctl-b{width:var(--border-point-width);height:var(--border-point-height);bottom:calc(var(--border-point-height) / -2);left:calc((100% - var(--border-point-width)) / 2)}.relation-graph .rg-connect-ctl-l{width:var(--border-point-height);height:var(--border-point-width);left:calc(var(--border-point-height) / -2);top:calc((100% - var(--border-point-width)) / 2)}.relation-graph .rg-connect-ctl-r{width:var(--border-point-height);height:var(--border-point-width);right:calc(var(--border-point-height) / -2);top:calc((100% - var(--border-point-width)) / 2)}.relation-graph .rg-connect-ctl-lr{width:100%;height:var(--hv-handler-width);right:0px;top:calc((100% - var(--hv-handler-width)) / 2);z-index:11;opacity:.01}.relation-graph .rg-connect-ctl-lr:hover{opacity:1}.relation-graph .rg-connect-ctl-tb{width:var(--hv-handler-width);height:100%;top:0px;left:calc((100% - var(--hv-handler-width)) / 2);z-index:10;opacity:.01}.relation-graph .rg-connect-ctl-tb:hover{opacity:1}.relation-graph .rg-connect-ctl-bottom-bar{border:0px;border:none;width:100%;height:var(--border-handler-width);right:0px;top:calc(100% - var(--border-handler-width));z-index:5;opacity:.1;box-shadow:none;background-color:var(--edit-ctl-light-color);border-radius:var(--hander-border-radius);border-top-left-radius:0;border-top-right-radius:0;overflow:hidden}.relation-graph .rg-connect-ctl-bottom-bar:hover{border-top:var(--hander-border-color) solid 1px;opacity:1;box-shadow:none;scale:1}.relation-graph .rg-connect-ctl-top-bar{border:0px;border:none;width:100%;height:var(--border-handler-width);right:0px;top:0px;z-index:5;opacity:.1;box-shadow:none;background-color:var(--edit-ctl-light-color);border-radius:var(--hander-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0;overflow:hidden}.relation-graph .rg-connect-ctl-top-bar:hover{border-bottom:var(--hander-border-color) solid 1px;opacity:1;box-shadow:none;scale:1}.relation-graph .rg-connect-ctl-left-bar{border:0px;border:none;width:var(--border-handler-width);height:100%;left:0px;top:0px;z-index:5;opacity:.1;box-shadow:none;background-color:var(--edit-ctl-light-color);border-radius:var(--hander-border-radius);border-bottom-right-radius:0;border-top-right-radius:0;overflow:hidden}.relation-graph .rg-connect-ctl-left-bar:hover{border-right:var(--hander-border-color) solid 1px;opacity:1;box-shadow:none;scale:1}.relation-graph .rg-connect-ctl-right-bar{border:0px;width:var(--border-handler-width);height:100%;right:0px;top:0px;z-index:5;opacity:.1;box-shadow:none;background-color:var(--edit-ctl-light-color);border-radius:var(--hander-border-radius);border-bottom-left-radius:0;border-top-left-radius:0;overflow:hidden}.relation-graph .rg-connect-ctl-right-bar:hover{border-left:var(--hander-border-color) solid 1px;opacity:1;box-shadow:none;scale:1}.relation-graph .rg-miniview{pointer-events:all;position:absolute;user-select:none;overflow:hidden;z-index:1100;min-height:100px;min-width:100px;--miniview-width: 200px;--miniview-height: 200px;height:var(--miniview-height);width:var(--miniview-width);border-radius:3px;display:flex;place-items:center;justify-content:center;background-color:#fff;box-shadow:0 0 0 1px #ccc;border:none}.relation-graph .rg-miniview .rg-miniview-container{position:absolute;width:100%;height:100%;display:flex;place-items:center;justify-content:center}.relation-graph .rg-miniview canvas{background-color:#fff;opacity:.7}.relation-graph .rg-miniview .rg-mv-canvas-reset{cursor:pointer}.relation-graph .rg-miniview .rg-mv-canvas-reset:hover{background-color:#bbf54794}.relation-graph .rg-miniview .rg-mv-visible-area{z-index:2;position:absolute;cursor:move;transform-origin:0 0;box-shadow:0 0 0 9999px #0000001a;border:1px solid #cccccc;border-radius:3px;display:grid;place-items:center;color:#fff;font-weight:700;text-shadow:0 1px 2px rgba(0,0,0,.5)}.relation-graph .rg-miniview.rg-miniview-top{left:calc((100% - var(--miniview-width)) / 2);top:10px}.relation-graph .rg-miniview.rg-miniview-bottom{left:calc((100% - var(--miniview-width)) / 2);bottom:10px}.relation-graph .rg-miniview.rg-miniview-left{left:10px;top:calc((100% - var(--miniview-height)) / 2)}.relation-graph .rg-miniview.rg-miniview-right{right:10px;top:calc((100% - var(--miniview-height)) / 2)}.relation-graph .rg-miniview.rg-miniview-tl{left:10px;top:10px}.relation-graph .rg-miniview.rg-miniview-tr{right:10px;top:10px}.relation-graph .rg-miniview.rg-miniview-bl{left:10px;bottom:10px}.relation-graph .rg-miniview.rg-miniview-br{right:10px;bottom:10px}.relation-graph .rg-node-flashing{animation:ACTRGNodeFlashing 2s infinite}.relation-graph .rg-node-vtree-2{transform-origin:0 0;transform:rotate(30deg) translate(0)}.relation-graph .rg-node-vtree{width:130px;height:45px;text-align:left}.relation-graph .rg-node-expand-holder{position:absolute;height:fit-content;width:fit-content;display:flex;align-items:center;justify-content:center;user-select:none;pointer-events:none;cursor:pointer}.relation-graph .rg-node-expand-holder>span{width:16px;height:16px;display:block;text-align:center;border-radius:15px;cursor:pointer;font-size:19px;background-size:100% 100%;pointer-events:all;border:#aaaaaa solid .5px;background-color:#fff}.relation-graph .c-expanded{background-image:url(data:image/svg+xml;%20charset=utf8,%3Csvg%20t=%221606310217820%22%20viewBox=%220%200%201024%201024%22%20version=%221.1%22%20xmlns=%22http://www.w3.org/2000/svg%22%20p-id=%223373%22%20width=%2232%22%20height=%2232%22%3E%3Cpath%20d=%22M853.333333%20480H544V170.666667c0-17.066667-14.933333-32-32-32s-32%2014.933333-32%2032v309.333333H170.666667c-17.066667%200-32%2014.933333-32%2032s14.933333%2032%2032%2032h309.333333V853.333333c0%2017.066667%2014.933333%2032%2032%2032s32-14.933333%2032-32V544H853.333333c17.066667%200%2032-14.933333%2032-32s-14.933333-32-32-32z%22%20p-id=%223374%22%20fill=%22%23666666%22%3E%3C/path%3E%3C/svg%3E)}.relation-graph .c-collapsed{background-image:url(data:image/svg+xml;%20charset=utf8,%3Csvg%20t=%221606310454619%22%20class=%22icon%22%20viewBox=%220%200%201024%201024%22%20version=%221.1%22%20xmlns=%22http://www.w3.org/2000/svg%22%20p-id=%223662%22%20width=%22128%22%20height=%22128%22%3E%3Cpath%20d=%22M853.333333%20554.666667H170.666667c-23.466667%200-42.666667-19.2-42.666667-42.666667s19.2-42.666667%2042.666667-42.666667h682.666666c23.466667%200%2042.666667%2019.2%2042.666667%2042.666667s-19.2%2042.666667-42.666667%2042.666667z%22%20p-id=%223663%22%20fill=%22%23666666%22%3E%3C/path%3E%3C/svg%3E)}.relation-graph .c-expand-positon-left{transform:translate(-100%) translateY(-50%);left:-5px;top:50%}.relation-graph .c-expand-positon-right{transform:translate(5px) translateY(-50%);left:100%;top:50%}.relation-graph .c-expand-positon-bottom{transform:translate(-50%);left:50%;top:calc(100% + 5px)}.relation-graph .c-expand-positon-top{transform:translate(-50%) translateY(-100%);left:50%;top:-5px}.relation-graph .rg-setting-panel{--height: 300px;--width: 200px;width:300px;height:200px;position:absolute;margin-left:10px;margin-top:5px;font-size:12px;color:#3a5bb2;padding:60px 10px 10px;overflow:hidden;box-shadow:0 0 5px #999;border-radius:5px;z-index:1000;background-color:#fff;border:#999999 solid 1px}.relation-graph .rg-setting-panel-button{height:35px;width:35px;font-size:8px;line-height:35px;text-align:center;border-radius:50%;position:absolute;margin-left:25px;margin-top:20px;background-color:#3a5bb2;color:#fff;cursor:pointer;z-index:1001;box-shadow:0 0 8px #999}.relation-graph .rg-setting-panel-button:hover{box-shadow:0 0 20px #ffa20a;border:#ffffff solid 1px;color:#ffa20a;-moz-transform:rotate(-89deg) translateX(-190px);animation-timing-function:linear;animation:flashButton 2s infinite}@keyframes flashButton{0%{box-shadow:0 0 8px #2e4e8f}30%{box-shadow:0 0 20px #ffa20a}to{box-shadow:0 0 8px #2e4e8f}}.relation-graph .c-debug-tools-row{text-align:left}.relation-graph .rg-operate{pointer-events:none;user-select:none;position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:180}.relation-graph .rg-operate .rg-node{cursor:move}.relation-graph .rg-operate .rg-creating-container{pointer-events:none;position:relative}.relation-graph .rg-operate .rg-creating-container .rg-node-peel,.relation-graph .rg-operate .rg-creating-container .rg-events-all{pointer-events:none!important}.relation-graph .rg-selection{pointer-events:none;position:absolute;user-select:none;background-color:var(--editor-light-opacity);border:var(--editor-main-color) solid 1px;transform-origin:0 0}.relation-graph .rg-graph-loading{position:absolute;z-index:1600;left:0px;top:0px;height:100%;width:100%;background-color:#fff}.relation-graph .rg-graph-loading .rg-graph-loading-icon{width:16px;height:16px;vertical-align:-3px;fill:currentColor;overflow:hidden;animation:turn 1s linear infinite}.relation-graph .rg-graph-loading .rg-graph-loading-message{position:absolute;width:200px;height:30px;line-height:30px;text-align:center;left:calc((100% - 200px)/2);top:calc((100% - 30px)/2);border-radius:5px;background-color:#00000080;color:#fff;display:flex;place-items:center;justify-content:center;gap:8px}.relation-graph .rg-graph-loading-hide{display:none}@keyframes slowHide{0%{opacity:1}to{opacity:0;display:none}}.relation-graph .rg-easy-view{overflow:visible;height:100%;width:100%;background-color:transparent;position:absolute;left:0px;top:0px;z-index:3;pointer-events:none}.relation-graph .rg-easy-view canvas{opacity:0;width:100%;height:100%}.relation-graph .rg-easy-view-active{pointer-events:all}.relation-graph .rg-easy-view-active canvas{opacity:1}.relation-graph .rg-move-operator{position:absolute;width:100%;height:100%;pointer-events:none;user-select:none;left:0px;top:0px;z-index:6666}.relation-graph .rg-move-operator .rg-move-touchpad{display:none;background-color:var(--edit-ctl-light2-color);height:100%;width:100%;pointer-events:all}.relation-graph .rg-move-operator.rg-move-operator-active{pointer-events:all;cursor:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMzJweCIgaGVpZ2h0PSIzMnB4Ij48aW1hZ2UgeGxpbms6aHJlZj0iZGF0YTppbWFnZS9wbmc7YmFzZTY0LGlWQk9SdzBLR2dvQUFBQU5TVWhFVWdBQUFFQUFBQUJBQ0FZQUFBQ3FhWEhlQUFBQUFYTlNSMElBcnM0YzZRQUFDWlpKUkVGVWVGN3RXZ3RNVk5rWi9xYThabkZ4QkVIQWlCV3lFa0drUEcwRW1paWdGVVZzcFZxTmlsSmZRVEV4c2k2eDFqZHRMVnVEeGpoTlJDc0JzeHBOZktEV0J4Q05QTFFpaUNoRzBTQkxKZHBTYUFWNXlHaW4rOTNjdzQ2enVEc0Rkd1lUT01uSm5XRXU5NTcvKy8vLyt4L25xRERJaDJxUXk0OGhBSVlzWUpBak1PUUNnOXdBaGtod3lBV0dYR0NRSXpEa0FnTmtBQUo0UXdYbzViV0lxMVdXWm0wTDRQdCtCTUJHdnZJN0o0WG0vQitBZC9MVktrQllBd0FocEJEY3RyS3lNc3pYMTNlcG5aMWRvTDI5ZlhoM2QzZTVUcWVycnEydHpRc0pDYmtENEswUkVCWUR3NUlBR0dxYkdyY0ZZSGYvL3YxWkV5Wk0rTE90cmEyN3NZMi9mZnYybjQ4ZVBmcDgwcVJKZndPZ2s0RWdHTFFNVHNXQnNBUUFRdU1VMkxhc3JDekF6ODh2U2ExV0I2dlY2Z2doOUtWTGw4QjU0TUFCckYrL0huRnhjZElVUTZmVFBlN3M3THgyK1BEaFA2U2xwZjNieUNvVTR3ZExBRUJ0YzlxM3RMUnNkWFoyL3NKNHRRME5EUWdNRE1TclY2OTZmdEpvTktpdXJzYllzV1BmdTEybjB6MjRjZVBHNnRqWTJHb0EzUWF1b1FnSVNnUEE1OWxSZUsxVzY1T1NrbktQcXp4eTVBaU9IajJLMHRKU1RKMDZGY09HRGNQRml4ZXhZOGNPYk4rK0hUdDM3cFErejU0OUcrM3Q3YmgrL1RvaUl5T1JuSnlNRlN0V29MdTd1elkzTjNmK3FsV3I2bVFRaEZ2MEd3U2xBYURtSFFBNHZuang0azhlSGg2L29URFRwazNyZGFGNi9iY3VyVkwxdnBScjE2NUpvTDE4K2ZLdm5wNmV2d1hRQ2VDTjdCTDk1Z1dsQWFEMkhRRTR0YmEyWG5CeWN2cEpSRVFFYnQ2OCtSMXRFNUhlQURDMmlpbFRwcUNzckV3Q3NLT2o0MjVYVjFkNWZuNStWbkp5Y29OTWxDSnM5c2thbEFTQXo2TDJod0VZb2Rmcm4zSkZRck85Q2R1WHYvR1pPcDN1SC9YMTllbSt2cjc1QnRHQzFtRDJVQklBeG5rMXRRL0FSYS9YUDFRS2dISGp4cUcrdnY0N3ZKQ2Vudjd6ZmZ2Mk5SbndndGxoVWtrQTZQK2ZBQmdPWUtSZXJ5ZHJLMklCeG1vVnZORFkyTGh2ekpneHUyVmVFQkhDTEN0UUVnREdmZnEvUmdiZ3JsSUFmSWdYMnRyYWJnOGZQdnlYQU5vQWRNbnVZSFVBYVBvRTB0NElnTnRLQWZCOVhLRlNxWHdBTUtGb2wxM0JMRGZvandWUWNKSGYyeFFWRlFXTUh6OStiazFOemRkeGNYRVA5WHA5c1pVQThBUFFBdUMxYkFWbWtXRmZBYURnVXFwYlYxY1g3Kzd1L2l0SFI4ZjV2ZG1lMGxIQStIa3FsU29RUURPQVZwa0xHQlpOSG4wQlFBaHZYMUZSTVRVa0pPUVUyWjhzZmV2V0xYUjFkU0VoSVFFdUxpN1NJcXdBUUpBTUFOMmdRMDZWTFFZQUFaT3l2ZFRVMUZGNzkrNHR0TGUzOThuSnlVRnFhcXFVeG5Jd245KzBhWlAwTnlzQUVBS0F4WklBZ0dteXljTmNDNkQyU1hhZkZCY1h4MGRGUmVVMk5UVmg4dVRKVXB4ZXVIQWgzcjE3aDFPbmFCVEF5Wk1uc1dEQkF1bXpJWkd4NkhuOCtESG16Ly9XYTBTNnpCQW5oaW5ncVZTcVVBRE1CYXdDQUxYUFpPZlR1cnE2MzNsN2U2ZHF0VnFzVzdjT3k1Y3Zsd29lamtPSERtSE5talVZT1hJa21wdnBudThEWUtwNkJKQ0dRUFhDQVFTQUZ2QmYyUVVzYWdITTlhVmtwN2k0ZUZsVVZGVEdpUk1uc0dqUklrbjd4NDhmNzVHTkdtVWhKSWFoQlpnS2dDbWtLbHVBVlFGZ3JxODVkdXhZM09MRmkvOUMwdzhJQ0lDTmpRMEtDd3NSSGg3ZXMrNVpzMlpKVFErUnlQUkg4QSs1eFlBQkFNQzFvYUhob0plWDEwODNidHlJckt3c1RKOCtIVmV2WGxWQ3pnOCs0d011WURVT0VPa3U4MzNYN096c09TdFhydHoxK3ZWclJFZEhvN3k4SEZ1M2JzV3VYYnNzQnNKQUF5QklrQldmTTRCUnQyL2Yvanc4UER6K3lwVXJtRGx6cGlUNGhRc1hwTzZPMHFPcXFnckJ3Y0VZUFhvMEdoc2I4ZWJObTFkcXRacmRGcXVIUVJZOUkxajBCQVVGalNzb0tQalMxZFgxeDl1MmJjUHUzYnVsUmJLSm9WWXpZQ2czbUcrd1RSWWFHb283ZCs2Z3RiWDFhNDFHOHdzREFOZ3RzbWdVb0RTTUJHeDhTSFUvWFVHcjFjYWxwS1NrODBmMjhpaDhSa1lHdG16Wm9wejAzK1M1NmVucHlNek14TnExYTNIdzRFRTBOVFhkR3pWcVZKSkJKa2dBckpJS2k5WVhTMStDNEZaWldmbEZjSEJ3OUprelp6QnYzanhKOEljUEg4TFBqN1dLTW1QdTNMbkl6OC9IK2ZQbkVSOGZqOU9uVC84eE1USHhLNk5hd0NyRkVNbVFWdkNwY0lVTkd6Wk16c3pNM0dOblorZVFsSlNFdkx3OGFaRmNyQkpEY0F6OW44QTZPanAyUmtkSEx5Z3BLV0hyamRVZ2V3SnNsbG9GQU5IK1psTFU0d3FGaFlXclkySmlmczFVbDY3QTZFQ056Wmt6cDk4WWVIbDU0Zm56NXowNVJVMU56WldBZ0lDZEFQNGxaNEVzaDlrVnNtby9RR3FCaXk2UWs1T1RlMjF0YlphSGg4ZG5vdGRQeWZ1YkJTNWJ0Z3k1dWJtWU9IRWlDZ29LNE9ucGljMmJONi9mczJkUHFVeUFMSVZaQ1hJN3pheGhiakZrK0hCUkdZcEdLS09DSU1UTnZKRmNRRTVnVkNncEthSFptclU0M2h3Ykc0dWlvaUpKZUJaWC92Nyt1SGZ2WGtGUVVGQ0dYQVFaTmtQTUlrQSt2ejhBOFA5WkhmYlVCd3lMbktXbHBlc2pJaUlTZUFQMyt5NWZ2Z3huWjJka1oyY2pNVEhSSkJBWTh0TFMwdERTMHZLZThNM056UTJ1cnE1clpPRlphWWtxMEd6elZ3SUFQa1BzQmtrMWdnQ2hycTd1OTk3ZTNteFc5R3g5OFhOWVdCaVdMbDBLYm5pNHVibEprMXRsRHg0OGtHWk5UWTEwUFh2MnJBU1VvZWFsQmF0VWpQc1VYQlJBb2hWbVZ2d1hXdWl2QlFnUUdSV2tNbGxFQlliSGtwS1NsTWpJU0NrOUpDZWNPM2NPZCs5S3plSWZIR1Q3MWF0WFM1TSsvK3paczJvZkh4K1NIazJlOHo4eTh6UDIwL2ZOWW44bEFUQjJCVVlGa1IrTXlNdkxTMWl5Wk1rSzhVSUN3TWp3NU1rVFBIMzZWTHJTekNrd0JRMEtDcEtLcWhrelpraHV3L0ZONisxNldGallBWm50S1RocmYwRjhmZG9QVUJvQTRRcFN0MGkyQklKQVl0UmtabWIrTENZbVpvcS92MytvV3EwMmlRbDFPdDJicXFxcXYrZms1RnpWYXJYM1pZSHA3NXlNK1dSOUNrL1ROeXYwR1RQNUQ1cWppVGVJcUVBUWhEdlFHbGc1OGtyM1VPL2Z2ejh5SkNURTE4M056ZFhaMmRsVm85RzRPRGc0T0haMmRyWjFkSFMwdGJlM3R4VVhGNWRuWldXVlZWUlVNTWF6MFVpQk9hbDFmaGZDOTJ0alZDa1NOQVpVT2h3aHRzbmx6VklLVDVLa2RSQWNSZzd5aGpnc3hXZUlRMUxVS0RYTHJJNkNVbUF4K1owN1FJb2RsRkNDQkkwTlJGaUNTSmVaTEZGd0lUeS9Fd0FCQWtPcEFJQWFGUUJRVUU2U25EZ1RRRkFFNGZXSjlIcGJySWtXYnRadGhnZWtwQk1qOGhTZnBVMFZPWThRQVBBRkJJQ1RRbkpTWUdwYmZCY25RL3JzODlZQ1FMem52ZTB6c1p0a1lQcmlkMkVCRkV5QVFHSEZGTDZ1aU5ZdFJZTGZaeUxDSW9UQVlrTlZhSisvaThPU3ZSMllWRnh3UzRSQlUzMUU4STQ0VG1mOGY0WkFtUHJNUHQ5bkNSTHM4MklHNGgrSEFCZ0kxRCttZHc1WndNZWtqWUZZeTVBRkRBVHFIOU03QjcwRi9COEJrUXA5WU5iRzJRQUFBQUJKUlU1RXJrSmdnZz09IiB3aWR0aD0iMzIiIGhlaWdodD0iMzIiLz48L3N2Zz4=) 16 16,auto!important;cursor:-webkit-image-set(url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAACZZJREFUeF7tWgtMVNkZ/qa8ZnFxBEHAiBWyEkGkPG0EmiigFUVspVqNilJfQTExsi6x1jdtLVuDxjhNRCsBsxpNfKDWBxCNPLQiiChG0SBLJdpSaAV5yGin+93cw46zuDsDdwYTOMnJnWEu957/+///+x/nqDDIh2qQy48hAIYsYJAjMOQCg9wAhkhwyAWGXGCQIzDkAgNkAAJ4QwXo5bWIq1WWZm0L4Pt+BMBGvvI7J4Xm/B+Ad/LVKkBYAwAhpBDctrKyMszX13epnZ1doL29fXh3d3e5Tqerrq2tzQsJCbkD4K0REBYDw5IAGGqbGrcFYHf//v1ZEyZM+LOtra27sY2/ffv2n48ePfp80qRJfwOgk4EgGLQMTsWBsAQAQuMU2LasrCzAz88vSa1WB6vV6ggh9KVLl8B54MABrF+/HnFxcdIUQ6fTPe7s7Lx2+PDhP6Slpf3byCoU4wdLAEBtc9q3tLRsdXZ2/sJ4tQ0NDQgMDMSrV696ftJoNKiursbYsWPfu12n0z24cePG6tjY2GoA3QauoQgISgPA59lReK1W65OSknKPqzxy5AiOHj2K0tJSTJ06FcOGDcPFixexY8cObN++HTt37pQ+z549G+3t7bh+/ToiIyORnJyMFStWoLu7uzY3N3f+qlWr6mQQhFv0GwSlAaDmHQA4vnjx4k8eHh6/oTDTpk3rdaF6/bcurVL1vpRr165JoL18+fKvnp6evwXQCeCN7BL95gWlAaD2HQE4tba2XnBycvpJREQEbt68+R1tE5HeADC2iilTpqCsrEwCsKOj425XV1d5fn5+VnJycoNMlCJs9skalASAz6L2hwEYodfrn3JFQrO9CduXv/GZOp3uH/X19em+vr75BtGC1mD2UBIAxnk1tQ/ARa/XP1QKgHHjxqG+vv47vJCenv7zffv2NRnwgtlhUkkA6P+fABgOYKRerydrK2IBxmoVvNDY2LhvzJgxu2VeEBHCLCtQEgDGffq/RgbgrlIAfIgX2trabg8fPvyXANoAdMnuYHUAaPoE0t4IgNtKAfB9XKFSqXwAMKFol13BLDfojwVQcJHf2xQVFQWMHz9+bk1NzddxcXEP9Xp9sZUA8APQAuC1bAVmkWFfAaDgUqpbV1cX7+7u/itHR8f5vdme0lHA+HkqlSoQQDOAVpkLGBZNHn0BQAhvX1FRMTUkJOQU2Z8sfevWLXR1dSEhIQEuLi7SIqwAQJAMAN2gQ06VLQYAAZOyvdTU1FF79+4ttLe398nJyUFqaqqUxnIwn9+0aZP0NysAEAKAxZIAgGmyycNcC6D2SXafFBcXx0dFReU2NTVh8uTJUpxeuHAh3r17h1OnaBTAyZMnsWDBAumzIZGx6Hn8+DHmz//Wa0S6zBAnhingqVSqUADMBawCALXPZOfTurq633l7e6dqtVqsW7cOy5cvlwoejkOHDmHNmjUYOXIkmpvpnu8DYKp6BJCGQPXCAQSAFvBf2QUsagHM9aVkp7i4eFlUVFTGiRMnsGjRIkn7x48f75GNGmUhJIahBZgKgCmkKluAVQFgrq85duxY3OLFi/9C0w8ICICNjQ0KCwsRHh7es+5Zs2ZJTQ+RyPRH8A+5xYABAMC1oaHhoJeX1083btyIrKwsTJ8+HVevXlVCzg8+4wMuYDUOEOku833X7OzsOStXrtz1+vVrREdHo7y8HFu3bsWuXbssBsJAAyBIkBWfM4BRt2/f/jw8PDz+ypUrmDlzpiT4hQsXpO6O0qOqqgrBwcEYPXo0Ghsb8ebNm1dqtZrdFquHQRY9I1j0BAUFjSsoKPjS1dX1x9u2bcPu3bulRbKJoVYzYCg3mG+wTRYaGoo7d+6gtbX1a41G8wsDANgtsmgUoDSMBGx8SHU/XUGr1calpKSk80f28ih8RkYGtmzZopz03+S56enpyMzMxNq1a3Hw4EE0NTXdGzVqVJJBJkgArJIKi9YXS1+C4FZZWflFcHBw9JkzZzBv3jxJ8IcPH8LPj7WKMmPu3LnIz8/H+fPnER8fj9OnT/8xMTHxK6NawCrFEMmQVvCpcIUNGzZMzszM3GNnZ+eQlJSEvLw8aZFcrBJDcAz9n8A6Ojp2RkdHLygpKWHrjdUgewJslloFANH+ZlLU4wqFhYWrY2Jifs1Ul67A6ECNzZkzp98YeHl54fnz5z05RU1NzZWAgICdAP4lZ4Esh9kVsmo/QGqBiy6Qk5OTe21tbZaHh8dnotdPyfubBS5btgy5ubmYOHEiCgoK4Onpic2bN6/fs2dPqUyALIVZCXI7zaxhbjFk+HBRGYpGKKOCIMTNvJFcQE5gVCgpKaHZmrU43hwbG4uioiJJeBZX/v7+uHfvXkFQUFCGXAQZNkPMIkA+vz8A8P9ZHfbUBwyLnKWlpesjIiISeAP3+y5fvgxnZ2dkZ2cjMTHRJBAY8tLS0tDS0vKe8M3NzQ2urq5rZOFZaYkq0GzzVwIAPkPsBkk1ggChrq7u997e3mxW9Gx98XNYWBiWLl0Kbni4ublJk1tlDx48kGZNTY10PXv2rASUoealBatUjPsUXBRAohVmVvwXWuivBQgQGRWkMllEBYbHkpKSlMjISCk9JCecO3cOd+9KzeIfHGT71atXS5M+/+zZs2ofHx+SHk2e8z8y8zP20/fNYn8lATB2BUYFkR+MyMvLS1iyZMkK8UICwMjw5MkTPH36VLrSzCkwBQ0KCpKKqhkzZkhuw/FN6+16WFjYAZntKThrf0F8fdoPUBoA4QpSt0i2BIJAYtRkZmb+LCYmZoq/v3+oWq02iQl1Ot2bqqqqv+fk5FzVarX3ZYHp75yM+WR9Ck/TNyv0GTP5D5qjiTeIqEAQhDvQGlg58kr3UO/fvz8yJCTE183NzdXZ2dlVo9G4ODg4OHZ2drZ1dHS0tbe3txUXF5dnZWWVVVRUMMaz0UiBOal1fhfC92tjVCkSNAZUOhwhtsnlzVIKT5KkdRAcRg7yhjgsxWeIQ1LUKDXLrI6CUmAx+Z07QIodlFCCBI0NRFiCSJeZLFFwITy/EwABAkOpAIAaFQBQUE6SnDgTQFAE4fWJ9HpbrIkWbtZthgekpBMj8hSfpU0VOY8QAPAFBICTQnJSYGpbfBcnQ/rs89YCQLznve0zsZtkYPrid2EBFEyAQGHFFL6uiNYtRYLfZyLCIoTAYkNVaJ+/i8OSvR2YVFxwS4RBU31E8I44Tmf8f4ZAmPrMPt9nCRLs82IG4h+HABgI1D+mdw5ZwMekjYFYy5AFDATqH9M7B70F/B8BkQp9YNbG2QAAAABJRU5ErkJggg==) 2x,url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAACZZJREFUeF7tWgtMVNkZ/qa8ZnFxBEHAiBWyEkGkPG0EmiigFUVspVqNilJfQTExsi6x1jdtLVuDxjhNRCsBsxpNfKDWBxCNPLQiiChG0SBLJdpSaAV5yGin+93cw46zuDsDdwYTOMnJnWEu957/+///+x/nqDDIh2qQy48hAIYsYJAjMOQCg9wAhkhwyAWGXGCQIzDkAgNkAAJ4QwXo5bWIq1WWZm0L4Pt+BMBGvvI7J4Xm/B+Ad/LVKkBYAwAhpBDctrKyMszX13epnZ1doL29fXh3d3e5Tqerrq2tzQsJCbkD4K0REBYDw5IAGGqbGrcFYHf//v1ZEyZM+LOtra27sY2/ffv2n48ePfp80qRJfwOgk4EgGLQMTsWBsAQAQuMU2LasrCzAz88vSa1WB6vV6ggh9KVLl8B54MABrF+/HnFxcdIUQ6fTPe7s7Lx2+PDhP6Slpf3byCoU4wdLAEBtc9q3tLRsdXZ2/sJ4tQ0NDQgMDMSrV696ftJoNKiursbYsWPfu12n0z24cePG6tjY2GoA3QauoQgISgPA59lReK1W65OSknKPqzxy5AiOHj2K0tJSTJ06FcOGDcPFixexY8cObN++HTt37pQ+z549G+3t7bh+/ToiIyORnJyMFStWoLu7uzY3N3f+qlWr6mQQhFv0GwSlAaDmHQA4vnjx4k8eHh6/oTDTpk3rdaF6/bcurVL1vpRr165JoL18+fKvnp6evwXQCeCN7BL95gWlAaD2HQE4tba2XnBycvpJREQEbt68+R1tE5HeADC2iilTpqCsrEwCsKOj425XV1d5fn5+VnJycoNMlCJs9skalASAz6L2hwEYodfrn3JFQrO9CduXv/GZOp3uH/X19em+vr75BtGC1mD2UBIAxnk1tQ/ARa/XP1QKgHHjxqG+vv47vJCenv7zffv2NRnwgtlhUkkA6P+fABgOYKRerydrK2IBxmoVvNDY2LhvzJgxu2VeEBHCLCtQEgDGffq/RgbgrlIAfIgX2trabg8fPvyXANoAdMnuYHUAaPoE0t4IgNtKAfB9XKFSqXwAMKFol13BLDfojwVQcJHf2xQVFQWMHz9+bk1NzddxcXEP9Xp9sZUA8APQAuC1bAVmkWFfAaDgUqpbV1cX7+7u/itHR8f5vdme0lHA+HkqlSoQQDOAVpkLGBZNHn0BQAhvX1FRMTUkJOQU2Z8sfevWLXR1dSEhIQEuLi7SIqwAQJAMAN2gQ06VLQYAAZOyvdTU1FF79+4ttLe398nJyUFqaqqUxnIwn9+0aZP0NysAEAKAxZIAgGmyycNcC6D2SXafFBcXx0dFReU2NTVh8uTJUpxeuHAh3r17h1OnaBTAyZMnsWDBAumzIZGx6Hn8+DHmz//Wa0S6zBAnhingqVSqUADMBawCALXPZOfTurq633l7e6dqtVqsW7cOy5cvlwoejkOHDmHNmjUYOXIkmpvpnu8DYKp6BJCGQPXCAQSAFvBf2QUsagHM9aVkp7i4eFlUVFTGiRMnsGjRIkn7x48f75GNGmUhJIahBZgKgCmkKluAVQFgrq85duxY3OLFi/9C0w8ICICNjQ0KCwsRHh7es+5Zs2ZJTQ+RyPRH8A+5xYABAMC1oaHhoJeX1083btyIrKwsTJ8+HVevXlVCzg8+4wMuYDUOEOku833X7OzsOStXrtz1+vVrREdHo7y8HFu3bsWuXbssBsJAAyBIkBWfM4BRt2/f/jw8PDz+ypUrmDlzpiT4hQsXpO6O0qOqqgrBwcEYPXo0Ghsb8ebNm1dqtZrdFquHQRY9I1j0BAUFjSsoKPjS1dX1x9u2bcPu3bulRbKJoVYzYCg3mG+wTRYaGoo7d+6gtbX1a41G8wsDANgtsmgUoDSMBGx8SHU/XUGr1calpKSk80f28ih8RkYGtmzZopz03+S56enpyMzMxNq1a3Hw4EE0NTXdGzVqVJJBJkgArJIKi9YXS1+C4FZZWflFcHBw9JkzZzBv3jxJ8IcPH8LPj7WKMmPu3LnIz8/H+fPnER8fj9OnT/8xMTHxK6NawCrFEMmQVvCpcIUNGzZMzszM3GNnZ+eQlJSEvLw8aZFcrBJDcAz9n8A6Ojp2RkdHLygpKWHrjdUgewJslloFANH+ZlLU4wqFhYWrY2Jifs1Ul67A6ECNzZkzp98YeHl54fnz5z05RU1NzZWAgICdAP4lZ4Esh9kVsmo/QGqBiy6Qk5OTe21tbZaHh8dnotdPyfubBS5btgy5ubmYOHEiCgoK4Onpic2bN6/fs2dPqUyALIVZCXI7zaxhbjFk+HBRGYpGKKOCIMTNvJFcQE5gVCgpKaHZmrU43hwbG4uioiJJeBZX/v7+uHfvXkFQUFCGXAQZNkPMIkA+vz8A8P9ZHfbUBwyLnKWlpesjIiISeAP3+y5fvgxnZ2dkZ2cjMTHRJBAY8tLS0tDS0vKe8M3NzQ2urq5rZOFZaYkq0GzzVwIAPkPsBkk1ggChrq7u997e3mxW9Gx98XNYWBiWLl0Kbni4ublJk1tlDx48kGZNTY10PXv2rASUoealBatUjPsUXBRAohVmVvwXWuivBQgQGRWkMllEBYbHkpKSlMjISCk9JCecO3cOd+9KzeIfHGT71atXS5M+/+zZs2ofHx+SHk2e8z8y8zP20/fNYn8lATB2BUYFkR+MyMvLS1iyZMkK8UICwMjw5MkTPH36VLrSzCkwBQ0KCpKKqhkzZkhuw/FN6+16WFjYAZntKThrf0F8fdoPUBoA4QpSt0i2BIJAYtRkZmb+LCYmZoq/v3+oWq02iQl1Ot2bqqqqv+fk5FzVarX3ZYHp75yM+WR9Ck/TNyv0GTP5D5qjiTeIqEAQhDvQGlg58kr3UO/fvz8yJCTE183NzdXZ2dlVo9G4ODg4OHZ2drZ1dHS0tbe3txUXF5dnZWWVVVRUMMaz0UiBOal1fhfC92tjVCkSNAZUOhwhtsnlzVIKT5KkdRAcRg7yhjgsxWeIQ1LUKDXLrI6CUmAx+Z07QIodlFCCBI0NRFiCSJeZLFFwITy/EwABAkOpAIAaFQBQUE6SnDgTQFAE4fWJ9HpbrIkWbtZthgekpBMj8hSfpU0VOY8QAPAFBICTQnJSYGpbfBcnQ/rs89YCQLznve0zsZtkYPrid2EBFEyAQGHFFL6uiNYtRYLfZyLCIoTAYkNVaJ+/i8OSvR2YVFxwS4RBU31E8I44Tmf8f4ZAmPrMPt9nCRLs82IG4h+HABgI1D+mdw5ZwMekjYFYy5AFDATqH9M7B70F/B8BkQp9YNbG2QAAAABJRU5ErkJggg==) 1x) 16 16,auto!important}.relation-graph .rg-move-operator.rg-move-operator-active .rg-move-touchpad{display:flex}.relation-graph.rg-creating-line .rg-connect-source-handle{pointer-events:none;opacity:.5}.relation-graph .rg-toolbar{user-select:none;pointer-events:all;display:flex;position:absolute;z-index:300;background-color:#fff;color:#999;box-shadow:0 1px 3px #00000026,0 0 .5px #0000004d;border:1px solid rgb(204,203,203);box-sizing:border-box;border-radius:5px;width:fit-content;height:fit-content;place-items:center;justify-content:center;gap:3px}.relation-graph .rg-toolbar .rg-icon{flex-grow:1;width:16px;height:16px;fill:currentColor;overflow:hidden}.relation-graph .rg-toolbar .rg-mb-button svg{margin:auto}.relation-graph .rg-toolbar .rg-mb-button-on{color:#2e74b5}.relation-graph .rg-toolbar .rg-mb-button:hover{background-color:#dcdcdc80}.relation-graph .rg-toolbar .rg-loading-icon{animation:turn 1s linear infinite}@keyframes turn{0%{-webkit-transform:rotate(0deg)}25%{-webkit-transform:rotate(90deg)}50%{-webkit-transform:rotate(180deg)}75%{-webkit-transform:rotate(270deg)}to{-webkit-transform:rotate(360deg)}}.relation-graph .rg-toolbar .rg-current-zoom{margin-top:0;color:#262626;font-size:10px;text-align:center;border-radius:3px;cursor:pointer}.relation-graph .rg-toolbar .rg-current-zoom:hover{background-color:#dcdcdc80}.relation-graph .rg-toolbar .rg-mb-button{width:35px;height:35px;margin-top:0;opacity:1;text-align:center;cursor:pointer;font-size:18px;box-sizing:border-box;display:flex;align-items:center;justify-items:center;border-radius:3px}.relation-graph .rg-toolbar-v{flex-flow:column;padding:10px 3px}.relation-graph .rg-toolbar-v .rg-current-zoom{width:35px;height:25px;line-height:25px}.relation-graph .rg-toolbar-h{padding:3px 10px}.relation-graph .rg-toolbar-h .rg-current-zoom{width:fit-content;padding:0 5px;height:35px;line-height:35px}.relation-graph .rg-toolbar-h-right{right:15px}.relation-graph .rg-toolbar-h-left{left:15px}.relation-graph .rg-toolbar-h-center{left:50%;transform:translate(-50%)}.relation-graph .rg-toolbar-v-top{top:15px}.relation-graph .rg-toolbar-v-bottom{bottom:15px}.relation-graph .rg-toolbar-v-center{top:50%;transform:translateY(-50%)}.relation-graph .rg-xs-toolbar{background-color:#fff;color:#333}.relation-graph .rg-xs-toolbar .rg-mb-button{width:25px;height:25px}.relation-graph .rg-xs-toolbar.rg-toolbar-v{padding:3px}.relation-graph .rg-xs-toolbar.rg-toolbar-v .rg-current-zoom{width:30px;height:25px;line-height:25px}.relation-graph .rg-xs-toolbar.rg-toolbar-h{padding:3px}.relation-graph .rg-xs-toolbar.rg-toolbar-h .rg-current-zoom{width:35px;height:25px;line-height:25px}.relation-graph .rg-xs-toolbar.rg-toolbar-h .rg-mb-button{width:25px;height:25px}.relation-graph .rg-xs-toolbar.rg-toolbar-h-right{right:10px}.relation-graph .rg-xs-toolbar.rg-toolbar-h-left{left:10px}.relation-graph .rg-xs-toolbar.rg-toolbar-h-center{top:50%;transform:translate(-50%)}.relation-graph .rg-xs-toolbar.rg-toolbar-v-top{top:10px}.relation-graph .rg-xs-toolbar.rg-toolbar-v-bottom{bottom:10px}.relation-graph .rg-xs-toolbar.rg-toolbar-v-center{top:50%;transform:translateY(-50%)}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();(function(V,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],v):(V=typeof globalThis<"u"?globalThis:V||self,v(V.RelationGraph={},V.ReactJSXRuntime,V.React,V.ReactDOM))})(this,function(V,v,D,Oe){"use strict";var wo=Object.defineProperty;var bo=(V,v,D)=>v in V?wo(V,v,{enumerable:!0,configurable:!0,writable:!0,value:D}):V[v]=D;var S=(V,v,D)=>(bo(V,typeof v!="symbol"?v+"":v,D),D);/*!
|
|
2
|
-
* relation-graph v3.0.
|
|
1
|
+
(function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode("@charset \"UTF-8\";.relation-graph{box-sizing:border-box;position:relative;min-width:300px;min-height:300px;--editor-main-color: rgb(64, 165, 248);--editor-light-color: rgb(125, 192, 248);--editor-light2-color: rgb(168, 212, 248);--editor-light-opacity: rgba(57, 144, 216, .1);--rg-node-opacity: 1;--rg-node-font-size: 1rem;--rg-node-font-color: #000000;--rg-node-color: #eeeeee;--rg-node-border-color: #333333;--rg-node-border-width: 1px;--rg-node-border-radius: 3px;--rg-node-width: fit-content;--rg-node-height: fit-content;--rg-node-text-px: 10px;--rg-node-text-py: 3px;--rg-background-color: transparent;--rg-line-color: #888888;--rg-line-width: 1px;--rg-line-fontcolor: #666;--rg-line-fontsize: 12px;--rg-line-opacity: 1;--rg-checked-item-bg-color: rgba(150, 150, 150, .2);--rg-checked-line-text-bg-color: rgb(234, 232, 232)}.relation-graph:focus{outline:none}.relation-graph .rg-graph-plugs{position:absolute;left:0px;top:0px;z-index:90;width:100%;height:100%;pointer-events:none;user-select:none}.relation-graph .rg-graph-plugs .rg-view-slot{position:relative;width:100%;height:100%}.relation-graph .rg-watermark{position:absolute;--watermark-width: 200px;--watermark-height: 100px;z-index:1200;overflow:visible;min-height:100px;min-width:100px;width:var(--watermark-width);height:var(--watermark-height);box-sizing:border-box}.relation-graph .rg-watermark div{box-sizing:border-box}.relation-graph .rg-watermark.rg-watermark-top{left:calc((100% - var(--watermark-width)) / 2);top:10px}.relation-graph .rg-watermark.rg-watermark-bottom{left:calc((100% - var(--watermark-width)) / 2);bottom:10px}.relation-graph .rg-watermark.rg-watermark-left{left:10px;top:calc((100% - var(--watermark-height)) / 2)}.relation-graph .rg-watermark.rg-watermark-right{right:10px;top:calc((100% - var(--watermark-height)) / 2)}.relation-graph .rg-watermark.rg-watermark-tl{left:10px;top:10px}.relation-graph .rg-watermark.rg-watermark-tr{right:10px;top:10px}.relation-graph .rg-watermark.rg-watermark-bl{left:10px;bottom:10px}.relation-graph .rg-watermark.rg-watermark-br{right:10px;bottom:10px}.relation-graph .rg-lines-container svg{overflow:visible}.relation-graph .rg-lines-svg{overflow:visible;width:10px;height:10px;position:absolute;left:0px;top:0px}.relation-graph .rg-lines-container{overflow:visible;position:absolute;z-index:40;width:100%;top:0px;left:0px;pointer-events:none}.relation-graph .rg-lines-container-el-lines{z-index:80;pointer-events:none}.relation-graph .rg-lines-container-el-lines .rg-line-bg{pointer-events:stroke}.relation-graph .rg-lines-container-el-lines .rg-line-text{pointer-events:all}.relation-graph .rg-lines-svg-el-lines{overflow:visible;width:10px;height:10px;position:absolute;left:0px;top:0px}.relation-graph .rg-nodes-container-wrapper{position:absolute;width:100%;top:0px;left:0px;z-index:50}.relation-graph .rg-nodes-container{position:relative;overflow:visible}.relation-graph .rg-map{background-color:var(--rg-background-color);overflow:hidden;cursor:default;user-select:none;opacity:.01;transition:none;width:100%;height:100%;position:relative}.relation-graph.rg-move-mode .rg-map{cursor:grab}.relation-graph .rg-map-ready{opacity:1;transition:opacity .5s ease;will-change:opacity}.relation-graph .rg-map-background-norepeat{background-repeat:no-repeat;background-position:right bottom}.relation-graph .rg-map-canvas{position:relative;user-select:none;pointer-events:none;top:0;left:0;border:none;z-index:3;overflow:visible;white-space:nowrap;transform-origin:0 0;will-change:transform}.relation-graph .rg-map-canvas .rg-events-all{pointer-events:all}.relation-graph.rg-enable-node-xy-animation .rg-node-peel{transition:transform .3s ease}.relation-graph.rg-enable-node-xy-animation .rg-line-peel{opacity:0;transition:none}.relation-graph.rg-enable-node-xy-animation .rg-map-canvas{transition:transform .4s ease-in-out}.relation-graph.rg-enable-canvas-animation .rg-map-canvas{transition:transform .5s ease}.relation-graph.rg-enable-canvas-animation .rg-editing-ctrl,.relation-graph.rg-enable-canvas-animation .rg-editing-line-ctrl,.relation-graph.rg-enable-canvas-animation .rg-editing-connect-ctrl{opacity:0}.relation-graph .rg-canvas-behind{z-index:2;position:absolute}.relation-graph .rg-canvas-above{z-index:5;position:absolute}.relation-graph .rg-canvas-slot{overflow:visible;position:absolute;margin-top:0;margin-left:0}.relation-graph .rg-canvas-slot-behind{z-index:30;overflow:visible}.relation-graph .rg-canvas-slot-above{z-index:70;overflow:visible}.relation-graph .rg-single-graph{position:relative;overflow:visible}.relation-graph .rg-map img{-webkit-user-drag:none;-webkit-user-select:none}.relation-graph .rg-line-text{fill:var(--rg-line-fontcolor, #888888);font-size:var(--rg-line-fontsize);paint-order:stroke;pointer-events:all}.relation-graph .rg-linetext-container{position:absolute;pointer-events:none;user-select:none;overflow:visible;left:0;top:0;z-index:45;display:block}.relation-graph .rg-linetext-container .rg-line-peel{width:fit-content}.relation-graph .rg-linetext-container .rg-line-peel .rg-line-label{display:block;color:var(--rg-line-fontcolor, #888888);font-size:var(--rg-line-fontsize);transform-origin:0 0;position:absolute;user-select:none;pointer-events:all;box-sizing:border-box;padding:2px 6px;border-radius:5px}.relation-graph .rg-linetext-container .rg-line-peel-checked .rg-line-label{background-color:var(--rg-checked-line-text-bg-color)}.relation-graph .rg-line-peel{pointer-events:none;cursor:default;transition:opacity .2s ease-in;opacity:var(--rg-line-opacity, 1)}.relation-graph .rg-line{fill-rule:nonzero;stroke-linecap:round;stroke:var(--rg-line-color);stroke-width:var(--rg-line-width);pointer-events:none;fill:none;marker-end:var(--rg-line-marker-end);marker-start:var(--rg-line-marker-start)}.relation-graph .rg-line-bg{stroke:#fff;opacity:.01;fill:none;fill-rule:nonzero;stroke-linecap:round;pointer-events:stroke;stroke-width:calc(var(--rg-line-width) + 6px)}.relation-graph .rg-line-bg:hover{opacity:.1;stroke:var(--rg-line-color)}.relation-graph .rg-line-peel-checked .rg-line-bg{stroke:var(--rg-checked-item-bg-color);opacity:1}.relation-graph .rg-line-peel-checked .rg-line{z-index:100}.relation-graph .rg-line-peel-checked .rg-line-text{stroke:var(--rg-checked-item-bg-color);stroke-width:2}.relation-graph .rg-line-peel-disable-events{pointer-events:none!important}.relation-graph .rg-line-peel-disable-events .rg-line-bg,.relation-graph .rg-line-peel-disable-events .rg-line-text,.relation-graph .rg-linetext-container .rg-line-peel-disable-events .rg-line-bg,.relation-graph .rg-linetext-container .rg-line-peel-disable-events .rg-line-label{pointer-events:none}.relation-graph .rg-line-dashtype-1{stroke-dasharray:2,2,2;stroke-dashoffset:3px;stroke-linecap:butt;stroke-linejoin:bevel}.relation-graph .rg-line-dashtype-2{stroke-dasharray:5,5,5;stroke-dashoffset:3px;stroke-linecap:butt;stroke-linejoin:bevel}.relation-graph .rg-line-dashtype-3{stroke-dasharray:9,9,9;stroke-dashoffset:3px;stroke-linecap:butt;stroke-linejoin:bevel}.relation-graph .rg-line-dashtype-4{stroke-dasharray:5,5,15;stroke-dashoffset:3px;stroke-linecap:butt;stroke-linejoin:bevel}@keyframes ACTRGLineChecked{0%{stroke-dashoffset:352px;stroke-dasharray:5,5,5}50%{stroke-dasharray:5,5,5;stroke-dashoffset:3px}to{stroke-dashoffset:352px;stroke-dasharray:5,5,5}}@keyframes rg-line-anm1{0%{stroke-dashoffset:100px;stroke-dasharray:5,5,5}to{stroke-dasharray:5,5,5;stroke-dashoffset:3px}}@keyframes rg-line-anm2{0%{stroke-dashoffset:0;stroke-dasharray:4,4,4}to{stroke-dashoffset:10px;stroke-dasharray:20,20,20}}@keyframes rg-line-anm3{0%{stroke-opacity:1}50%{stroke-opacity:.2}to{stroke-opacity:1}}@keyframes rg-line-anm4{0%{stroke-dasharray:0,100%}to{stroke-dasharray:100%,0}}.relation-graph .rg-line-anm-1{animation:rg-line-anm1 10s infinite;animation-fill-mode:forwards;animation-timing-function:linear}.relation-graph .rg-line-anm-2{animation:rg-line-anm2 3s infinite}.relation-graph .rg-line-anm-3{animation:rg-line-anm3 1s infinite}.relation-graph .rg-line-anm-4{animation:rg-line-anm4 3s infinite}@keyframes deform1{0%{stroke-dashoffset:0}to{stroke-dashoffset:100%}}.relation-graph .rg-icon{width:19px;height:19px;vertical-align:0px;fill:currentColor;overflow:hidden}.relation-graph .rg-node-peel{padding:0;position:absolute;pointer-events:none;box-sizing:border-box;opacity:var(--rg-node-opacity);z-index:var(--rg-node-z-index);will-change:transform;transform-origin:0 0;cursor:default}.relation-graph .rg-node-peel .rg-node{pointer-events:all;text-align:center;border-style:solid;box-sizing:border-box;overflow:visible;transform-origin:0 0;font-size:var(--rg-node-font-size);color:var(--rg-node-font-color);background-color:var(--rg-node-color);border-color:var(--rg-node-border-color);border-width:var(--rg-node-border-width);width:var(--rg-node-width);height:var(--rg-node-height)}.relation-graph .rg-node-disable-events{pointer-events:none}.relation-graph .rg-node-shape-0>.rg-node{border-radius:50%}.relation-graph .rg-node-shape-1>.rg-node{border-radius:var(--rg-node-border-radius)}.relation-graph .rg-node-checked{z-index:800}.relation-graph .rg-node-checked>.rg-node{box-shadow:0 0 0 4px var(--rg-checked-item-bg-color)}.relation-graph .rg-node-selected>.rg-node{box-shadow:0 0 0 2px var(--editor-main-color)}.relation-graph img,.relation-graph svg,.relation-graph video,.relation-graph canvas,.relation-graph audio,.relation-graph iframe,.relation-graph embed,.relation-graph object{display:unset;vertical-align:unset}.relation-graph .rg-node-text{color:var(--rg-node-font-color);font-size:var(--rg-node-font-size);padding:var(--rg-node-text-py) var(--rg-node-text-px);height:100%;width:100%;display:flex;align-items:center;justify-content:center;box-sizing:border-box}.relation-graph .rg-node-type-button{border-radius:25px;color:#00f;cursor:pointer}.relation-graph .rg-editing-referline{user-select:none;position:absolute;z-index:999;pointer-events:none;width:100%;height:100%;left:0px;top:0px}.relation-graph .rg-editing-referline .rg-referline{position:absolute;display:flex;place-items:center;justify-content:center;overflow:visible;transform-origin:0 0;--rg-refer-offset: -3px}.relation-graph .rg-editing-referline .rg-referline .referline{display:flex;place-items:center;justify-content:center}.relation-graph .rg-editing-referline .rg-referline .referline>div{background-color:var(--editor-main-color);font-size:8px;border-radius:3px;color:#fff;width:fit-content;height:fit-content;padding:2px 5px}.relation-graph .rg-editing-referline .rg-referline-v{top:0px;width:6px;height:100%}.relation-graph .rg-editing-referline .rg-referline-v .referline{width:1px;height:100%;background-color:var(--editor-main-color)}.relation-graph .rg-editing-referline .rg-referline-v:before{content:\"\";position:absolute;width:5px;height:5px;background-color:var(--editor-main-color);border-radius:50%;top:0;transform:translateY(-50%)}.relation-graph .rg-editing-referline .rg-referline-v:after{content:\"\";position:absolute;width:5px;height:5px;background-color:var(--editor-main-color);border-radius:50%;bottom:0;transform:translateY(50%)}.relation-graph .rg-editing-referline .rg-referline-h{left:0px;width:100%;height:6px}.relation-graph .rg-editing-referline .rg-referline-h .referline{width:100%;height:1px;background-color:var(--editor-main-color)}.relation-graph .rg-editing-referline .rg-referline-h:before{content:\"\";position:absolute;width:5px;height:5px;background-color:var(--editor-main-color);border-radius:50%;left:0;transform:translate(-50%)}.relation-graph .rg-editing-referline .rg-referline-h:after{content:\"\";position:absolute;width:5px;height:5px;background-color:var(--editor-main-color);border-radius:50%;right:0;transform:translate(50%)}.relation-graph .rg-editing-line-ctrl{position:absolute;left:0px;top:0px;z-index:500;pointer-events:none;user-select:none;width:100%;height:100%}.relation-graph .rg-editing-line-ctrl .rg-edt-ctrl-svg{position:absolute;pointer-events:none;left:0px;top:0px;overflow:visible}.relation-graph .rg-editing-line-ctrl .rg-edt-ctrl-svg path{stroke:var(--editor-main-color);stroke-width:1px}.relation-graph .rg-editing-line-ctrl .rg-line-ctrl-dot{--rg-ctl-x: 0px;--rg-ctl-y: 0px;pointer-events:auto;user-select:none;width:10px;height:10px;background-color:#fff;box-shadow:0 0 0 1px var(--editor-main-color);position:absolute;border-radius:50%;cursor:move;z-index:1;transform-origin:0 0}.relation-graph .rg-editing-line-ctrl .start-dot,.relation-graph .rg-editing-line-ctrl .end-dot,.relation-graph .rg-editing-line-ctrl .ctrl-dot{transform-origin:0 0;transform:translate(-50%,-50%) translate(var(--rg-ctl-x),var(--rg-ctl-y))}.relation-graph .rg-editing-line-ctrl .ctrl-split,.relation-graph .rg-editing-line-ctrl .ctrl-split-core{background-color:#fff}.relation-graph .rg-editing-line-ctrl .ctrl-split-h{width:12px;height:5px;border-radius:3px;cursor:row-resize;transform:translate(-50%,-50%) translate(var(--rg-ctl-x),var(--rg-ctl-y))}.relation-graph .rg-editing-line-ctrl .ctrl-split-v{width:5px;height:12px;border-radius:3px;cursor:col-resize;transform:translate(-50%,-50%) translate(var(--rg-ctl-x),var(--rg-ctl-y))}.relation-graph .rg-editing-line-ctrl .rg-line-ctrl-text{--rg-ctl-x: 0px;--rg-ctl-y: 0px;--font-size: .8rem;pointer-events:auto;background-color:#fffc;box-shadow:0 0 0 1px var(--editor-main-color);position:absolute;border-radius:3px;cursor:move;z-index:1;white-space:nowrap;color:#000;padding:3px 10px;display:flex;place-items:center;justify-content:center;box-sizing:border-box;text-shadow:none;font-size:var(--font-size, 12px);min-height:20px;max-height:30px;transform-origin:0 0;transform:translate(-50%,-50%) translate(10px,3px) translate(var(--rg-ctl-x),var(--rg-ctl-y));min-width:50px;max-width:220px}.relation-graph .rg-editing-line-ctrl .rg-line-ctrl-text p{font-size:var(--font-size, 12px);color:#333}.relation-graph .rg-editing-line-ctrl .rg-line-ctrl-text p.empty-text{font-size:10px;color:#888}.relation-graph .rg-editing-line-ctrl .rg-line-ctrl-text .rg-line-text-input{white-space:nowrap;pointer-events:auto;user-select:auto;background-color:transparent;color:#000;border-radius:3px;height:100%;padding:3px 0;width:100px;text-shadow:none;font-size:var(--font-size, 12px);text-align:center;box-sizing:border-box;border:none;outline:none}.relation-graph .rg-editing-line-ctrl .rg-line-ctrl-text-editing{background-color:#faf191}.relation-graph .rg-editing-ctrl,.relation-graph .rg-editing-connect-ctrl{user-select:none;position:absolute;z-index:500;box-shadow:0 0 0 1px var(--editor-main-color);border-radius:0;pointer-events:none;transform-origin:0 0}.relation-graph .rg-editing-bar{user-select:none;pointer-events:none;position:absolute;border-radius:5px;padding:3px;box-sizing:border-box;display:flex;place-items:center;justify-content:center;flex-wrap:wrap;gap:5px}.relation-graph .rg-editing-bar .rg-gee-icon{background-color:#d603f680;pointer-events:auto;min-width:20px;min-height:20px;border-radius:5px;box-sizing:border-box;display:flex;place-items:center;justify-content:center;cursor:pointer}.relation-graph .rg-editing-bar .rg-gee-icon:hover{background-color:#d603f6;color:#fff}.relation-graph .rg-connect-source-handle{pointer-events:auto;width:fit-content;height:fit-content}.relation-graph .rg-editing-bar-top{width:fit-content;height:fit-content;left:50%;transform:translate(-50%) translateY(-100%);top:-15px}.relation-graph .rg-editing-bar-bottom{width:fit-content;height:fit-content;left:50%;transform:translate(-50%) translateY(100%);bottom:-15px}.relation-graph .rg-editing-bar-left{width:fit-content;height:fit-content;left:-15px;top:50%;transform:translate(-100%) translateY(-50%)}.relation-graph .rg-editing-bar-right{width:fit-content;height:fit-content;right:-15px;top:50%;transform:translate(100%) translateY(-50%)}.relation-graph .rg-editing-bar-tl{width:30px;height:30px;right:calc(100% + 10px);top:-40px}.relation-graph .rg-editing-bar-tr{width:30px;height:30px;left:calc(100% + 10px);top:-40px}.relation-graph .rg-editing-bar-bl{width:30px;height:30px;right:calc(100% + 10px);bottom:-40px}.relation-graph .rg-editing-bar-br{width:30px;height:30px;left:calc(100% + 10px);bottom:-40px}.relation-graph .rg-resize-ctl{user-select:none;position:relative;height:100%;width:100%;--resize-handler-size: 10px;--resize-handler-offset: -5px}.relation-graph .rg-resize-ctl .rg-resize-ctl-handler{pointer-events:auto;width:var(--resize-handler-size);height:var(--resize-handler-size);background-color:#fff;position:absolute;border-radius:2px;box-shadow:inset 0 0 0 1px var(--editor-main-color)}.relation-graph .rg-resize-ctl .rg-resize-ctl-tl{cursor:nwse-resize;left:var(--resize-handler-offset);top:var(--resize-handler-offset)}.relation-graph .rg-resize-ctl .rg-resize-ctl-tr{cursor:nesw-resize;right:var(--resize-handler-offset);top:var(--resize-handler-offset)}.relation-graph .rg-resize-ctl .rg-resize-ctl-bl{cursor:nesw-resize;left:var(--resize-handler-offset);bottom:var(--resize-handler-offset)}.relation-graph .rg-resize-ctl .rg-resize-ctl-br{cursor:nwse-resize;right:var(--resize-handler-offset);bottom:var(--resize-handler-offset)}.relation-graph .rg-resize-ctl .rg-resize-ctl-t{cursor:n-resize;top:var(--resize-handler-offset);left:calc((100% - var(--resize-handler-size)) / 2)}.relation-graph .rg-resize-ctl .rg-resize-ctl-b{cursor:s-resize;bottom:var(--resize-handler-offset);left:calc((100% - var(--resize-handler-size)) / 2)}.relation-graph .rg-resize-ctl .rg-resize-ctl-l{cursor:w-resize;left:var(--resize-handler-offset);top:calc((100% - var(--resize-handler-size)) / 2)}.relation-graph .rg-resize-ctl .rg-resize-ctl-r{cursor:e-resize;right:var(--resize-handler-offset);top:calc((100% - var(--resize-handler-size)) / 2)}.relation-graph .rg-editing-connect-ctrl{position:absolute;user-select:none;pointer-events:none;left:0;top:0;z-index:1400;--hander-border-radius: 5px;border-radius:var(--hander-border-radius);--border-handler-width: 8px;--hv-handler-width: 10px;--center-handler-width: 10px;--border-point-width: 10px;--border-point-height: 10px;--hander-color: var(--editor-light2-color);--hander-border-color: var(--editor-main-color);--hander-shadow-color: rgba(57, 144, 216, .1);box-shadow:0 0 0 var(--border-handler-width) var(--hander-shadow-color)}.relation-graph .rg-connect-ctl{width:100%;height:100%;pointer-events:none;user-select:none;border:none;position:relative}.relation-graph .rg-connect-ctl-handler{pointer-events:auto;user-select:none;z-index:20;cursor:crosshair}.relation-graph .rg-connect-target{width:fit-content;height:fit-content;pointer-events:auto;display:flex;place-items:center;justify-content:center}.relation-graph .rg-connect-ctl-handler-style{background-color:var(--hander-color);border:var(--hander-border-color) solid 1px;position:absolute;border-radius:3px}.relation-graph .rg-connect-ctl-handler-style:hover{background-color:#fbe691}.relation-graph .rg-connect-ctl-center{width:var(--center-handler-width);height:var(--center-handler-width);border-radius:50%;top:calc((100% - var(--center-handler-width)) / 2);left:calc((100% - var(--center-handler-width)) / 2)}.relation-graph .rg-connect-ctl-t{width:var(--border-point-width);height:var(--border-point-height);top:calc(var(--border-point-height) / -2);left:calc((100% - var(--border-point-width)) / 2)}.relation-graph .rg-connect-ctl-b{width:var(--border-point-width);height:var(--border-point-height);bottom:calc(var(--border-point-height) / -2);left:calc((100% - var(--border-point-width)) / 2)}.relation-graph .rg-connect-ctl-l{width:var(--border-point-height);height:var(--border-point-width);left:calc(var(--border-point-height) / -2);top:calc((100% - var(--border-point-width)) / 2)}.relation-graph .rg-connect-ctl-r{width:var(--border-point-height);height:var(--border-point-width);right:calc(var(--border-point-height) / -2);top:calc((100% - var(--border-point-width)) / 2)}.relation-graph .rg-connect-ctl-lr{width:100%;height:var(--hv-handler-width);right:0px;top:calc((100% - var(--hv-handler-width)) / 2);z-index:11;opacity:.01}.relation-graph .rg-connect-ctl-lr:hover{opacity:1}.relation-graph .rg-connect-ctl-tb{width:var(--hv-handler-width);height:100%;top:0px;left:calc((100% - var(--hv-handler-width)) / 2);z-index:10;opacity:.01}.relation-graph .rg-connect-ctl-tb:hover{opacity:1}.relation-graph .rg-connect-ctl-bottom-bar{border:0px;border:none;width:100%;height:var(--border-handler-width);right:0px;top:100%;z-index:5;opacity:.1;box-shadow:none;background-color:var(--edit-ctl-light-color);border-radius:var(--hander-border-radius);border-top-left-radius:0;border-top-right-radius:0;overflow:hidden}.relation-graph .rg-connect-ctl-bottom-bar:hover{opacity:1}.relation-graph .rg-connect-ctl-top-bar{border:0px;border:none;width:100%;height:var(--border-handler-width);right:0px;top:calc(var(--border-handler-width) * -1);z-index:5;opacity:.1;box-shadow:none;background-color:var(--edit-ctl-light-color);border-radius:var(--hander-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0;overflow:hidden}.relation-graph .rg-connect-ctl-top-bar:hover{opacity:1}.relation-graph .rg-connect-ctl-left-bar{border:0px;border:none;width:var(--border-handler-width);height:100%;left:calc(var(--border-handler-width) * -1);top:0;z-index:5;opacity:.1;box-shadow:none;background-color:var(--edit-ctl-light-color);border-radius:var(--hander-border-radius);border-bottom-right-radius:0;border-top-right-radius:0;overflow:hidden}.relation-graph .rg-connect-ctl-left-bar:hover{opacity:1}.relation-graph .rg-connect-ctl-right-bar{border:0px;width:var(--border-handler-width);height:100%;right:calc(var(--border-handler-width) * -1);top:0px;z-index:5;opacity:.1;box-shadow:none;background-color:var(--edit-ctl-light-color);border-radius:var(--hander-border-radius);border-bottom-left-radius:0;border-top-left-radius:0;overflow:hidden}.relation-graph .rg-connect-ctl-right-bar:hover{opacity:1}.relation-graph .rg-miniview{pointer-events:all;position:absolute;user-select:none;overflow:hidden;z-index:1100;min-height:100px;min-width:100px;--miniview-width: 200px;--miniview-height: 120px;height:var(--miniview-height);width:var(--miniview-width);border-radius:3px;display:flex;place-items:center;justify-content:center;background-color:#fff;box-shadow:0 0 0 1px #ccc;border:none}.relation-graph .rg-miniview .rg-miniview-container{position:relative;width:100%;height:100%;display:flex;place-items:center;justify-content:center}.relation-graph .rg-miniview canvas{opacity:1}.relation-graph .rg-miniview .rg-mv-canvas-reset{cursor:pointer}.relation-graph .rg-miniview .rg-mv-canvas-reset:hover{background-color:#bbf54794}.relation-graph .rg-miniview .rg-mv-visible-area{z-index:2;position:absolute;left:0;top:0;cursor:move;transform-origin:0 0;box-shadow:0 0 0 9999px #0003;border:#888 solid 1px;border-radius:3px;display:grid;place-items:center;color:#fff;font-weight:700;text-shadow:0 1px 2px rgba(0,0,0,.5)}.relation-graph .rg-miniview.rg-miniview-top{left:calc((100% - var(--miniview-width)) / 2);top:10px}.relation-graph .rg-miniview.rg-miniview-bottom{left:calc((100% - var(--miniview-width)) / 2);bottom:10px}.relation-graph .rg-miniview.rg-miniview-left{left:10px;top:calc((100% - var(--miniview-height)) / 2)}.relation-graph .rg-miniview.rg-miniview-right{right:10px;top:calc((100% - var(--miniview-height)) / 2)}.relation-graph .rg-miniview.rg-miniview-tl{left:10px;top:10px}.relation-graph .rg-miniview.rg-miniview-tr{right:10px;top:10px}.relation-graph .rg-miniview.rg-miniview-bl{left:10px;bottom:10px}.relation-graph .rg-miniview.rg-miniview-br{right:10px;bottom:10px}.relation-graph .rg-node-flashing{animation:ACTRGNodeFlashing 2s infinite}.relation-graph .rg-node-vtree-2{transform-origin:0 0;transform:rotate(30deg) translate(0)}.relation-graph .rg-node-vtree{width:130px;height:45px;text-align:left}.relation-graph .rg-node-expand-holder{position:absolute;height:fit-content;width:fit-content;display:flex;align-items:center;justify-content:center;user-select:none;pointer-events:none;cursor:pointer}.relation-graph .rg-node-expand-holder>span{width:16px;height:16px;display:block;text-align:center;border-radius:15px;cursor:pointer;background-size:100% 100%;pointer-events:all;border:#aaaaaa solid .5px;background-color:#fff}.relation-graph .c-expanded{background-image:url(data:image/svg+xml;%20charset=utf8,%3Csvg%20t=%221606310217820%22%20viewBox=%220%200%201024%201024%22%20version=%221.1%22%20xmlns=%22http://www.w3.org/2000/svg%22%20p-id=%223373%22%20width=%2232%22%20height=%2232%22%3E%3Cpath%20d=%22M853.333333%20480H544V170.666667c0-17.066667-14.933333-32-32-32s-32%2014.933333-32%2032v309.333333H170.666667c-17.066667%200-32%2014.933333-32%2032s14.933333%2032%2032%2032h309.333333V853.333333c0%2017.066667%2014.933333%2032%2032%2032s32-14.933333%2032-32V544H853.333333c17.066667%200%2032-14.933333%2032-32s-14.933333-32-32-32z%22%20p-id=%223374%22%20fill=%22%23666666%22%3E%3C/path%3E%3C/svg%3E)}.relation-graph .c-collapsed{background-image:url(data:image/svg+xml;%20charset=utf8,%3Csvg%20t=%221606310454619%22%20class=%22icon%22%20viewBox=%220%200%201024%201024%22%20version=%221.1%22%20xmlns=%22http://www.w3.org/2000/svg%22%20p-id=%223662%22%20width=%22128%22%20height=%22128%22%3E%3Cpath%20d=%22M853.333333%20554.666667H170.666667c-23.466667%200-42.666667-19.2-42.666667-42.666667s19.2-42.666667%2042.666667-42.666667h682.666666c23.466667%200%2042.666667%2019.2%2042.666667%2042.666667s-19.2%2042.666667-42.666667%2042.666667z%22%20p-id=%223663%22%20fill=%22%23666666%22%3E%3C/path%3E%3C/svg%3E)}.relation-graph .c-expand-positon-left{transform:translate(-100%) translateY(-50%);left:-5px;top:50%}.relation-graph .c-expand-positon-right{transform:translate(5px) translateY(-50%);left:100%;top:50%}.relation-graph .c-expand-positon-bottom{transform:translate(-50%);left:50%;top:calc(100% + 5px)}.relation-graph .c-expand-positon-top{transform:translate(-50%) translateY(-100%);left:50%;top:-5px}.relation-graph .rg-setting-panel{--height: 300px;--width: 200px;width:300px;height:200px;position:absolute;left:10px;top:5px;font-size:12px;color:#3a5bb2;padding:60px 10px 10px;overflow:hidden;box-shadow:0 0 5px #999;border-radius:5px;z-index:1000;background-color:#fff;border:#999999 solid 1px}.relation-graph .rg-setting-panel-button{height:35px;width:35px;font-size:8px;line-height:35px;text-align:center;border-radius:50%;position:absolute;margin-left:25px;margin-top:20px;background-color:#3a5bb2;color:#fff;cursor:pointer;z-index:1001;box-shadow:0 0 8px #999}.relation-graph .rg-setting-panel-button:hover{box-shadow:0 0 20px #ffa20a;border:#ffffff solid 1px;color:#ffa20a;-moz-transform:rotate(-89deg) translateX(-190px);animation-timing-function:linear;animation:flashButton 2s infinite}@keyframes flashButton{0%{box-shadow:0 0 8px #2e4e8f}30%{box-shadow:0 0 20px #ffa20a}to{box-shadow:0 0 8px #2e4e8f}}.relation-graph .c-debug-tools-row{text-align:left}.relation-graph .rg-operate{pointer-events:none;user-select:none;position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:180}.relation-graph .rg-operate .rg-node{cursor:move}.relation-graph .rg-operate .rg-creating-container{pointer-events:none;position:relative}.relation-graph .rg-operate .rg-creating-container *{pointer-events:none!important}.relation-graph .rg-selection{pointer-events:none;position:absolute;user-select:none;background-color:var(--editor-light-opacity);border:var(--editor-main-color) solid 1px;transform-origin:0 0}.relation-graph .rg-graph-loading{position:absolute;z-index:1600;left:0px;top:0px;height:100%;width:100%;background-color:#fff}.relation-graph .rg-graph-loading .rg-graph-loading-icon{width:16px;height:16px;vertical-align:-3px;fill:currentColor;overflow:hidden;animation:turn 1s linear infinite}.relation-graph .rg-graph-loading .rg-graph-loading-message{position:absolute;width:200px;height:30px;line-height:30px;text-align:center;left:calc((100% - 200px)/2);top:calc((100% - 30px)/2);border-radius:5px;background-color:#00000080;color:#fff;display:flex;place-items:center;justify-content:center;gap:8px}.relation-graph .rg-graph-loading-hide{display:none}@keyframes slowHide{0%{opacity:1}to{opacity:0;display:none}}.relation-graph .rg-easy-view{overflow:visible;height:100%;width:100%;background-color:transparent;position:absolute;left:0px;top:0px;z-index:3;pointer-events:none}.relation-graph .rg-easy-view canvas{opacity:0;width:100%;height:100%}.relation-graph .rg-easy-view-active{pointer-events:all}.relation-graph .rg-easy-view-active canvas{opacity:1}.relation-graph .rg-move-operator{position:absolute;width:100%;height:100%;pointer-events:none;user-select:none;left:0px;top:0px;z-index:6666}.relation-graph .rg-move-operator .rg-move-touchpad{display:none;background-color:var(--edit-ctl-light2-color);height:100%;width:100%;pointer-events:all}.relation-graph .rg-move-operator.rg-move-operator-active{pointer-events:all;cursor:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMzJweCIgaGVpZ2h0PSIzMnB4Ij48aW1hZ2UgeGxpbms6aHJlZj0iZGF0YTppbWFnZS9wbmc7YmFzZTY0LGlWQk9SdzBLR2dvQUFBQU5TVWhFVWdBQUFFQUFBQUJBQ0FZQUFBQ3FhWEhlQUFBQUFYTlNSMElBcnM0YzZRQUFDWlpKUkVGVWVGN3RXZ3RNVk5rWi9xYThabkZ4QkVIQWlCV3lFa0drUEcwRW1paWdGVVZzcFZxTmlsSmZRVEV4c2k2eDFqZHRMVnVEeGpoTlJDc0JzeHBOZktEV0J4Q05QTFFpaUNoRzBTQkxKZHBTYUFWNXlHaW4rOTNjdzQ2enVEc0Rkd1lUT01uSm5XRXU5NTcvKy8vLyt4L25xRERJaDJxUXk0OGhBSVlzWUpBak1PUUNnOXdBaGtod3lBV0dYR0NRSXpEa0FnTmtBQUo0UXdYbzViV0lxMVdXWm0wTDRQdCtCTUJHdnZJN0o0WG0vQitBZC9MVktrQllBd0FocEJEY3RyS3lNc3pYMTNlcG5aMWRvTDI5ZlhoM2QzZTVUcWVycnEydHpRc0pDYmtENEswUkVCWUR3NUlBR0dxYkdyY0ZZSGYvL3YxWkV5Wk0rTE90cmEyN3NZMi9mZnYybjQ4ZVBmcDgwcVJKZndPZ2s0RWdHTFFNVHNXQnNBUUFRdU1VMkxhc3JDekF6ODh2U2ExV0I2dlY2Z2doOUtWTGw4QjU0TUFCckYrL0huRnhjZElVUTZmVFBlN3M3THgyK1BEaFA2U2xwZjNieUNvVTR3ZExBRUJ0YzlxM3RMUnNkWFoyL3NKNHRRME5EUWdNRE1TclY2OTZmdEpvTktpdXJzYllzV1BmdTEybjB6MjRjZVBHNnRqWTJHb0EzUWF1b1FnSVNnUEE1OWxSZUsxVzY1T1NrbktQcXp4eTVBaU9IajJLMHRKU1RKMDZGY09HRGNQRml4ZXhZOGNPYk4rK0hUdDM3cFErejU0OUcrM3Q3YmgrL1RvaUl5T1JuSnlNRlN0V29MdTd1elkzTjNmK3FsV3I2bVFRaEZ2MEd3U2xBYURtSFFBNHZuang0azhlSGg2L29URFRwazNyZGFGNi9iY3VyVkwxdnBScjE2NUpvTDE4K2ZLdm5wNmV2d1hRQ2VDTjdCTDk1Z1dsQWFEMkhRRTR0YmEyWG5CeWN2cEpSRVFFYnQ2OCtSMXRFNUhlQURDMmlpbFRwcUNzckV3Q3NLT2o0MjVYVjFkNWZuNStWbkp5Y29OTWxDSnM5c2thbEFTQXo2TDJod0VZb2Rmcm4zSkZRck85Q2R1WHYvR1pPcDN1SC9YMTllbSt2cjc1QnRHQzFtRDJVQklBeG5rMXRRL0FSYS9YUDFRS2dISGp4cUcrdnY0N3ZKQ2Vudjd6ZmZ2Mk5SbndndGxoVWtrQTZQK2ZBQmdPWUtSZXJ5ZHJLMklCeG1vVnZORFkyTGh2ekpneHUyVmVFQkhDTEN0UUVnREdmZnEvUmdiZ3JsSUFmSWdYMnRyYWJnOGZQdnlYQU5vQWRNbnVZSFVBYVBvRTB0NElnTnRLQWZCOVhLRlNxWHdBTUtGb2wxM0JMRGZvandWUWNKSGYyeFFWRlFXTUh6OStiazFOemRkeGNYRVA5WHA5c1pVQThBUFFBdUMxYkFWbWtXRmZBYURnVXFwYlYxY1g3Kzd1L2l0SFI4ZjV2ZG1lMGxIQStIa3FsU29RUURPQVZwa0xHQlpOSG4wQlFBaHZYMUZSTVRVa0pPUVUyWjhzZmV2V0xYUjFkU0VoSVFFdUxpN1NJcXdBUUpBTUFOMmdRMDZWTFFZQUFaT3l2ZFRVMUZGNzkrNHR0TGUzOThuSnlVRnFhcXFVeG5Jd245KzBhWlAwTnlzQUVBS0F4WklBZ0dteXljTmNDNkQyU1hhZkZCY1h4MGRGUmVVMk5UVmg4dVRKVXB4ZXVIQWgzcjE3aDFPbmFCVEF5Wk1uc1dEQkF1bXpJWkd4NkhuOCtESG16Ly9XYTBTNnpCQW5oaW5ncVZTcVVBRE1CYXdDQUxYUFpPZlR1cnE2MzNsN2U2ZHF0VnFzVzdjT3k1Y3Zsd29lamtPSERtSE5talVZT1hJa21wdnBudThEWUtwNkJKQ0dRUFhDQVFTQUZ2QmYyUVVzYWdITTlhVmtwN2k0ZUZsVVZGVEdpUk1uc0dqUklrbjd4NDhmNzVHTkdtVWhKSWFoQlpnS2dDbWtLbHVBVlFGZ3JxODVkdXhZM09MRmkvOUMwdzhJQ0lDTmpRMEtDd3NSSGg3ZXMrNVpzMlpKVFErUnlQUkg4QSs1eFlBQkFNQzFvYUhob0plWDEwODNidHlJckt3c1RKOCtIVmV2WGxWQ3pnOCs0d011WURVT0VPa3U4MzNYN096c09TdFhydHoxK3ZWclJFZEhvN3k4SEZ1M2JzV3VYYnNzQnNKQUF5QklrQldmTTRCUnQyL2Yvanc4UER6K3lwVXJtRGx6cGlUNGhRc1hwTzZPMHFPcXFnckJ3Y0VZUFhvMEdoc2I4ZWJObTFkcXRacmRGcXVIUVJZOUkxajBCQVVGalNzb0tQalMxZFgxeDl1MmJjUHUzYnVsUmJLSm9WWXpZQ2czbUcrd1RSWWFHb283ZCs2Z3RiWDFhNDFHOHdzREFOZ3RzbWdVb0RTTUJHeDhTSFUvWFVHcjFjYWxwS1NrODBmMjhpaDhSa1lHdG16Wm9wejAzK1M1NmVucHlNek14TnExYTNIdzRFRTBOVFhkR3pWcVZKSkJKa2dBckpJS2k5WVhTMStDNEZaWldmbEZjSEJ3OUprelp6QnYzanhKOEljUEg4TFBqN1dLTW1QdTNMbkl6OC9IK2ZQbkVSOGZqOU9uVC84eE1USHhLNk5hd0NyRkVNbVFWdkNwY0lVTkd6Wk16c3pNM0dOblorZVFsSlNFdkx3OGFaRmNyQkpEY0F6OW44QTZPanAyUmtkSEx5Z3BLV0hyamRVZ2V3SnNsbG9GQU5IK1psTFU0d3FGaFlXclkySmlmczFVbDY3QTZFQ056Wmt6cDk4WWVIbDU0Zm56NXowNVJVMU56WldBZ0lDZEFQNGxaNEVzaDlrVnNtby9RR3FCaXk2UWs1T1RlMjF0YlphSGg4ZG5vdGRQeWZ1YkJTNWJ0Z3k1dWJtWU9IRWlDZ29LNE9ucGljMmJONi9mczJkUHFVeUFMSVZaQ1hJN3pheGhiakZrK0hCUkdZcEdLS09DSU1UTnZKRmNRRTVnVkNncEthSFptclU0M2h3Ykc0dWlvaUpKZUJaWC92Nyt1SGZ2WGtGUVVGQ0dYQVFaTmtQTUlrQSt2ejhBOFA5WkhmYlVCd3lMbktXbHBlc2pJaUlTZUFQMyt5NWZ2Z3huWjJka1oyY2pNVEhSSkJBWTh0TFMwdERTMHZLZThNM056UTJ1cnE1clpPRlphWWtxMEd6elZ3SUFQa1BzQmtrMWdnQ2hycTd1OTk3ZTNteFc5R3g5OFhOWVdCaVdMbDBLYm5pNHVibEprMXRsRHg0OGtHWk5UWTEwUFh2MnJBU1VvZWFsQmF0VWpQc1VYQlJBb2hWbVZ2d1hXdWl2QlFnUUdSV2tNbGxFQlliSGtwS1NsTWpJU0NrOUpDZWNPM2NPZCs5S3plSWZIR1Q3MWF0WFM1TSsvK3paczJvZkh4K1NIazJlOHo4eTh6UDIwL2ZOWW44bEFUQjJCVVlGa1IrTXlNdkxTMWl5Wk1rSzhVSUN3TWp3NU1rVFBIMzZWTHJTekNrd0JRMEtDcEtLcWhrelpraHV3L0ZONisxNldGallBWm50S1RocmYwRjhmZG9QVUJvQTRRcFN0MGkyQklKQVl0UmtabWIrTENZbVpvcS92MytvV3EwMmlRbDFPdDJicXFxcXYrZms1RnpWYXJYM1pZSHA3NXlNK1dSOUNrL1ROeXYwR1RQNUQ1cWppVGVJcUVBUWhEdlFHbGc1OGtyM1VPL2Z2ejh5SkNURTE4M056ZFhaMmRsVm85RzRPRGc0T0haMmRyWjFkSFMwdGJlM3R4VVhGNWRuWldXVlZWUlVNTWF6MFVpQk9hbDFmaGZDOTJ0alZDa1NOQVpVT2h3aHRzbmx6VklLVDVLa2RSQWNSZzd5aGpnc3hXZUlRMUxVS0RYTHJJNkNVbUF4K1owN1FJb2RsRkNDQkkwTlJGaUNTSmVaTEZGd0lUeS9Fd0FCQWtPcEFJQWFGUUJRVUU2U25EZ1RRRkFFNGZXSjlIcGJySWtXYnRadGhnZWtwQk1qOGhTZnBVMFZPWThRQVBBRkJJQ1RRbkpTWUdwYmZCY25RL3JzODlZQ1FMem52ZTB6c1p0a1lQcmlkMkVCRkV5QVFHSEZGTDZ1aU5ZdFJZTGZaeUxDSW9UQVlrTlZhSisvaThPU3ZSMllWRnh3UzRSQlUzMUU4STQ0VG1mOGY0WkFtUHJNUHQ5bkNSTHM4MklHNGgrSEFCZ0kxRCttZHc1WndNZWtqWUZZeTVBRkRBVHFIOU03QjcwRi9COEJrUXA5WU5iRzJRQUFBQUJKUlU1RXJrSmdnZz09IiB3aWR0aD0iMzIiIGhlaWdodD0iMzIiLz48L3N2Zz4=) 16 16,auto!important;cursor:-webkit-image-set(url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAACZZJREFUeF7tWgtMVNkZ/qa8ZnFxBEHAiBWyEkGkPG0EmiigFUVspVqNilJfQTExsi6x1jdtLVuDxjhNRCsBsxpNfKDWBxCNPLQiiChG0SBLJdpSaAV5yGin+93cw46zuDsDdwYTOMnJnWEu957/+///+x/nqDDIh2qQy48hAIYsYJAjMOQCg9wAhkhwyAWGXGCQIzDkAgNkAAJ4QwXo5bWIq1WWZm0L4Pt+BMBGvvI7J4Xm/B+Ad/LVKkBYAwAhpBDctrKyMszX13epnZ1doL29fXh3d3e5Tqerrq2tzQsJCbkD4K0REBYDw5IAGGqbGrcFYHf//v1ZEyZM+LOtra27sY2/ffv2n48ePfp80qRJfwOgk4EgGLQMTsWBsAQAQuMU2LasrCzAz88vSa1WB6vV6ggh9KVLl8B54MABrF+/HnFxcdIUQ6fTPe7s7Lx2+PDhP6Slpf3byCoU4wdLAEBtc9q3tLRsdXZ2/sJ4tQ0NDQgMDMSrV696ftJoNKiursbYsWPfu12n0z24cePG6tjY2GoA3QauoQgISgPA59lReK1W65OSknKPqzxy5AiOHj2K0tJSTJ06FcOGDcPFixexY8cObN++HTt37pQ+z549G+3t7bh+/ToiIyORnJyMFStWoLu7uzY3N3f+qlWr6mQQhFv0GwSlAaDmHQA4vnjx4k8eHh6/oTDTpk3rdaF6/bcurVL1vpRr165JoL18+fKvnp6evwXQCeCN7BL95gWlAaD2HQE4tba2XnBycvpJREQEbt68+R1tE5HeADC2iilTpqCsrEwCsKOj425XV1d5fn5+VnJycoNMlCJs9skalASAz6L2hwEYodfrn3JFQrO9CduXv/GZOp3uH/X19em+vr75BtGC1mD2UBIAxnk1tQ/ARa/XP1QKgHHjxqG+vv47vJCenv7zffv2NRnwgtlhUkkA6P+fABgOYKRerydrK2IBxmoVvNDY2LhvzJgxu2VeEBHCLCtQEgDGffq/RgbgrlIAfIgX2trabg8fPvyXANoAdMnuYHUAaPoE0t4IgNtKAfB9XKFSqXwAMKFol13BLDfojwVQcJHf2xQVFQWMHz9+bk1NzddxcXEP9Xp9sZUA8APQAuC1bAVmkWFfAaDgUqpbV1cX7+7u/itHR8f5vdme0lHA+HkqlSoQQDOAVpkLGBZNHn0BQAhvX1FRMTUkJOQU2Z8sfevWLXR1dSEhIQEuLi7SIqwAQJAMAN2gQ06VLQYAAZOyvdTU1FF79+4ttLe398nJyUFqaqqUxnIwn9+0aZP0NysAEAKAxZIAgGmyycNcC6D2SXafFBcXx0dFReU2NTVh8uTJUpxeuHAh3r17h1OnaBTAyZMnsWDBAumzIZGx6Hn8+DHmz//Wa0S6zBAnhingqVSqUADMBawCALXPZOfTurq633l7e6dqtVqsW7cOy5cvlwoejkOHDmHNmjUYOXIkmpvpnu8DYKp6BJCGQPXCAQSAFvBf2QUsagHM9aVkp7i4eFlUVFTGiRMnsGjRIkn7x48f75GNGmUhJIahBZgKgCmkKluAVQFgrq85duxY3OLFi/9C0w8ICICNjQ0KCwsRHh7es+5Zs2ZJTQ+RyPRH8A+5xYABAMC1oaHhoJeX1083btyIrKwsTJ8+HVevXlVCzg8+4wMuYDUOEOku833X7OzsOStXrtz1+vVrREdHo7y8HFu3bsWuXbssBsJAAyBIkBWfM4BRt2/f/jw8PDz+ypUrmDlzpiT4hQsXpO6O0qOqqgrBwcEYPXo0Ghsb8ebNm1dqtZrdFquHQRY9I1j0BAUFjSsoKPjS1dX1x9u2bcPu3bulRbKJoVYzYCg3mG+wTRYaGoo7d+6gtbX1a41G8wsDANgtsmgUoDSMBGx8SHU/XUGr1calpKSk80f28ih8RkYGtmzZopz03+S56enpyMzMxNq1a3Hw4EE0NTXdGzVqVJJBJkgArJIKi9YXS1+C4FZZWflFcHBw9JkzZzBv3jxJ8IcPH8LPj7WKMmPu3LnIz8/H+fPnER8fj9OnT/8xMTHxK6NawCrFEMmQVvCpcIUNGzZMzszM3GNnZ+eQlJSEvLw8aZFcrBJDcAz9n8A6Ojp2RkdHLygpKWHrjdUgewJslloFANH+ZlLU4wqFhYWrY2Jifs1Ul67A6ECNzZkzp98YeHl54fnz5z05RU1NzZWAgICdAP4lZ4Esh9kVsmo/QGqBiy6Qk5OTe21tbZaHh8dnotdPyfubBS5btgy5ubmYOHEiCgoK4Onpic2bN6/fs2dPqUyALIVZCXI7zaxhbjFk+HBRGYpGKKOCIMTNvJFcQE5gVCgpKaHZmrU43hwbG4uioiJJeBZX/v7+uHfvXkFQUFCGXAQZNkPMIkA+vz8A8P9ZHfbUBwyLnKWlpesjIiISeAP3+y5fvgxnZ2dkZ2cjMTHRJBAY8tLS0tDS0vKe8M3NzQ2urq5rZOFZaYkq0GzzVwIAPkPsBkk1ggChrq7u997e3mxW9Gx98XNYWBiWLl0Kbni4ublJk1tlDx48kGZNTY10PXv2rASUoealBatUjPsUXBRAohVmVvwXWuivBQgQGRWkMllEBYbHkpKSlMjISCk9JCecO3cOd+9KzeIfHGT71atXS5M+/+zZs2ofHx+SHk2e8z8y8zP20/fNYn8lATB2BUYFkR+MyMvLS1iyZMkK8UICwMjw5MkTPH36VLrSzCkwBQ0KCpKKqhkzZkhuw/FN6+16WFjYAZntKThrf0F8fdoPUBoA4QpSt0i2BIJAYtRkZmb+LCYmZoq/v3+oWq02iQl1Ot2bqqqqv+fk5FzVarX3ZYHp75yM+WR9Ck/TNyv0GTP5D5qjiTeIqEAQhDvQGlg58kr3UO/fvz8yJCTE183NzdXZ2dlVo9G4ODg4OHZ2drZ1dHS0tbe3txUXF5dnZWWVVVRUMMaz0UiBOal1fhfC92tjVCkSNAZUOhwhtsnlzVIKT5KkdRAcRg7yhjgsxWeIQ1LUKDXLrI6CUmAx+Z07QIodlFCCBI0NRFiCSJeZLFFwITy/EwABAkOpAIAaFQBQUE6SnDgTQFAE4fWJ9HpbrIkWbtZthgekpBMj8hSfpU0VOY8QAPAFBICTQnJSYGpbfBcnQ/rs89YCQLznve0zsZtkYPrid2EBFEyAQGHFFL6uiNYtRYLfZyLCIoTAYkNVaJ+/i8OSvR2YVFxwS4RBU31E8I44Tmf8f4ZAmPrMPt9nCRLs82IG4h+HABgI1D+mdw5ZwMekjYFYy5AFDATqH9M7B70F/B8BkQp9YNbG2QAAAABJRU5ErkJggg==) 2x,url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAACZZJREFUeF7tWgtMVNkZ/qa8ZnFxBEHAiBWyEkGkPG0EmiigFUVspVqNilJfQTExsi6x1jdtLVuDxjhNRCsBsxpNfKDWBxCNPLQiiChG0SBLJdpSaAV5yGin+93cw46zuDsDdwYTOMnJnWEu957/+///+x/nqDDIh2qQy48hAIYsYJAjMOQCg9wAhkhwyAWGXGCQIzDkAgNkAAJ4QwXo5bWIq1WWZm0L4Pt+BMBGvvI7J4Xm/B+Ad/LVKkBYAwAhpBDctrKyMszX13epnZ1doL29fXh3d3e5Tqerrq2tzQsJCbkD4K0REBYDw5IAGGqbGrcFYHf//v1ZEyZM+LOtra27sY2/ffv2n48ePfp80qRJfwOgk4EgGLQMTsWBsAQAQuMU2LasrCzAz88vSa1WB6vV6ggh9KVLl8B54MABrF+/HnFxcdIUQ6fTPe7s7Lx2+PDhP6Slpf3byCoU4wdLAEBtc9q3tLRsdXZ2/sJ4tQ0NDQgMDMSrV696ftJoNKiursbYsWPfu12n0z24cePG6tjY2GoA3QauoQgISgPA59lReK1W65OSknKPqzxy5AiOHj2K0tJSTJ06FcOGDcPFixexY8cObN++HTt37pQ+z549G+3t7bh+/ToiIyORnJyMFStWoLu7uzY3N3f+qlWr6mQQhFv0GwSlAaDmHQA4vnjx4k8eHh6/oTDTpk3rdaF6/bcurVL1vpRr165JoL18+fKvnp6evwXQCeCN7BL95gWlAaD2HQE4tba2XnBycvpJREQEbt68+R1tE5HeADC2iilTpqCsrEwCsKOj425XV1d5fn5+VnJycoNMlCJs9skalASAz6L2hwEYodfrn3JFQrO9CduXv/GZOp3uH/X19em+vr75BtGC1mD2UBIAxnk1tQ/ARa/XP1QKgHHjxqG+vv47vJCenv7zffv2NRnwgtlhUkkA6P+fABgOYKRerydrK2IBxmoVvNDY2LhvzJgxu2VeEBHCLCtQEgDGffq/RgbgrlIAfIgX2trabg8fPvyXANoAdMnuYHUAaPoE0t4IgNtKAfB9XKFSqXwAMKFol13BLDfojwVQcJHf2xQVFQWMHz9+bk1NzddxcXEP9Xp9sZUA8APQAuC1bAVmkWFfAaDgUqpbV1cX7+7u/itHR8f5vdme0lHA+HkqlSoQQDOAVpkLGBZNHn0BQAhvX1FRMTUkJOQU2Z8sfevWLXR1dSEhIQEuLi7SIqwAQJAMAN2gQ06VLQYAAZOyvdTU1FF79+4ttLe398nJyUFqaqqUxnIwn9+0aZP0NysAEAKAxZIAgGmyycNcC6D2SXafFBcXx0dFReU2NTVh8uTJUpxeuHAh3r17h1OnaBTAyZMnsWDBAumzIZGx6Hn8+DHmz//Wa0S6zBAnhingqVSqUADMBawCALXPZOfTurq633l7e6dqtVqsW7cOy5cvlwoejkOHDmHNmjUYOXIkmpvpnu8DYKp6BJCGQPXCAQSAFvBf2QUsagHM9aVkp7i4eFlUVFTGiRMnsGjRIkn7x48f75GNGmUhJIahBZgKgCmkKluAVQFgrq85duxY3OLFi/9C0w8ICICNjQ0KCwsRHh7es+5Zs2ZJTQ+RyPRH8A+5xYABAMC1oaHhoJeX1083btyIrKwsTJ8+HVevXlVCzg8+4wMuYDUOEOku833X7OzsOStXrtz1+vVrREdHo7y8HFu3bsWuXbssBsJAAyBIkBWfM4BRt2/f/jw8PDz+ypUrmDlzpiT4hQsXpO6O0qOqqgrBwcEYPXo0Ghsb8ebNm1dqtZrdFquHQRY9I1j0BAUFjSsoKPjS1dX1x9u2bcPu3bulRbKJoVYzYCg3mG+wTRYaGoo7d+6gtbX1a41G8wsDANgtsmgUoDSMBGx8SHU/XUGr1calpKSk80f28ih8RkYGtmzZopz03+S56enpyMzMxNq1a3Hw4EE0NTXdGzVqVJJBJkgArJIKi9YXS1+C4FZZWflFcHBw9JkzZzBv3jxJ8IcPH8LPj7WKMmPu3LnIz8/H+fPnER8fj9OnT/8xMTHxK6NawCrFEMmQVvCpcIUNGzZMzszM3GNnZ+eQlJSEvLw8aZFcrBJDcAz9n8A6Ojp2RkdHLygpKWHrjdUgewJslloFANH+ZlLU4wqFhYWrY2Jifs1Ul67A6ECNzZkzp98YeHl54fnz5z05RU1NzZWAgICdAP4lZ4Esh9kVsmo/QGqBiy6Qk5OTe21tbZaHh8dnotdPyfubBS5btgy5ubmYOHEiCgoK4Onpic2bN6/fs2dPqUyALIVZCXI7zaxhbjFk+HBRGYpGKKOCIMTNvJFcQE5gVCgpKaHZmrU43hwbG4uioiJJeBZX/v7+uHfvXkFQUFCGXAQZNkPMIkA+vz8A8P9ZHfbUBwyLnKWlpesjIiISeAP3+y5fvgxnZ2dkZ2cjMTHRJBAY8tLS0tDS0vKe8M3NzQ2urq5rZOFZaYkq0GzzVwIAPkPsBkk1ggChrq7u997e3mxW9Gx98XNYWBiWLl0Kbni4ublJk1tlDx48kGZNTY10PXv2rASUoealBatUjPsUXBRAohVmVvwXWuivBQgQGRWkMllEBYbHkpKSlMjISCk9JCecO3cOd+9KzeIfHGT71atXS5M+/+zZs2ofHx+SHk2e8z8y8zP20/fNYn8lATB2BUYFkR+MyMvLS1iyZMkK8UICwMjw5MkTPH36VLrSzCkwBQ0KCpKKqhkzZkhuw/FN6+16WFjYAZntKThrf0F8fdoPUBoA4QpSt0i2BIJAYtRkZmb+LCYmZoq/v3+oWq02iQl1Ot2bqqqqv+fk5FzVarX3ZYHp75yM+WR9Ck/TNyv0GTP5D5qjiTeIqEAQhDvQGlg58kr3UO/fvz8yJCTE183NzdXZ2dlVo9G4ODg4OHZ2drZ1dHS0tbe3txUXF5dnZWWVVVRUMMaz0UiBOal1fhfC92tjVCkSNAZUOhwhtsnlzVIKT5KkdRAcRg7yhjgsxWeIQ1LUKDXLrI6CUmAx+Z07QIodlFCCBI0NRFiCSJeZLFFwITy/EwABAkOpAIAaFQBQUE6SnDgTQFAE4fWJ9HpbrIkWbtZthgekpBMj8hSfpU0VOY8QAPAFBICTQnJSYGpbfBcnQ/rs89YCQLznve0zsZtkYPrid2EBFEyAQGHFFL6uiNYtRYLfZyLCIoTAYkNVaJ+/i8OSvR2YVFxwS4RBU31E8I44Tmf8f4ZAmPrMPt9nCRLs82IG4h+HABgI1D+mdw5ZwMekjYFYy5AFDATqH9M7B70F/B8BkQp9YNbG2QAAAABJRU5ErkJggg==) 1x) 16 16,auto!important}.relation-graph .rg-move-operator.rg-move-operator-active .rg-move-touchpad{display:flex}.relation-graph.rg-creating-line .rg-connect-source-handle{pointer-events:none;opacity:.5}.rg-background{position:absolute;left:0px;top:0px;width:100%;height:100%;z-index:0;pointer-events:none}.rg-toolbar{user-select:none;pointer-events:all;display:flex;position:absolute;z-index:300;background-color:#fff;color:#333;--rg-toolbar-hover-bg-color: rgba(220, 220, 220, .5);box-shadow:0 1px 3px #0003,0 0 1px #0006;box-sizing:border-box;border-radius:5px;width:fit-content;height:fit-content;place-items:center;justify-content:center;gap:3px;backdrop-filter:blur(5px)}.rg-toolbar .rg-icon{flex-grow:1;width:16px;height:16px;fill:currentColor;overflow:hidden}.rg-toolbar .rg-mb-button svg{margin:auto}.rg-toolbar .rg-mb-button:hover{background-color:var(--rg-toolbar-hover-bg-color)}.rg-toolbar .rg-loading-icon{animation:turn 1s linear infinite}@keyframes turn{0%{-webkit-transform:rotate(0deg)}25%{-webkit-transform:rotate(90deg)}50%{-webkit-transform:rotate(180deg)}75%{-webkit-transform:rotate(270deg)}to{-webkit-transform:rotate(360deg)}}.rg-toolbar .rg-current-zoom{margin-top:0;font-size:10px;text-align:center;border-radius:3px;cursor:pointer}.rg-toolbar .rg-current-zoom:hover{background-color:var(--rg-toolbar-hover-bg-color)}.rg-toolbar .rg-mb-button{width:35px;height:35px;margin-top:0;opacity:1;cursor:pointer;font-size:18px;box-sizing:border-box;display:flex;align-items:center;justify-items:center;border-radius:3px}.rg-toolbar.rg-toolbar-v{flex-flow:column;padding:10px 3px}.rg-toolbar.rg-toolbar-v .rg-current-zoom{width:35px;height:25px;line-height:25px}.rg-toolbar.rg-toolbar-h{padding:3px 10px}.rg-toolbar.rg-toolbar-h .rg-current-zoom{width:fit-content;padding:0 5px;height:35px;line-height:35px}.rg-toolbar.rg-toolbar-h-right{right:15px}.rg-toolbar.rg-toolbar-h-left{left:15px}.rg-toolbar.rg-toolbar-h-center{left:50%;transform:translate(-50%)}.rg-toolbar.rg-toolbar-v-top{top:15px}.rg-toolbar.rg-toolbar-v-bottom{bottom:15px}.rg-toolbar.rg-toolbar-v-center{top:50%;transform:translateY(-50%)}.rg-toolbar.rg-xs-toolbar .rg-mb-button{width:25px;height:25px}.rg-toolbar.rg-xs-toolbar .rg-icon{width:14px;height:14px}.rg-toolbar.rg-xs-toolbar.rg-toolbar-v{padding:3px}.rg-toolbar.rg-xs-toolbar.rg-toolbar-v .rg-current-zoom{width:30px;height:25px;line-height:25px}.rg-toolbar.rg-xs-toolbar.rg-toolbar-h{padding:3px}.rg-toolbar.rg-xs-toolbar.rg-toolbar-h .rg-current-zoom{width:35px;height:25px;line-height:25px}.rg-toolbar.rg-xs-toolbar.rg-toolbar-h .rg-mb-button{width:25px;height:25px}.rg-toolbar.rg-xs-toolbar.rg-toolbar-h-right{right:10px}.rg-toolbar.rg-xs-toolbar.rg-toolbar-h-left{left:10px}.rg-toolbar.rg-xs-toolbar.rg-toolbar-h-center{top:50%;transform:translate(-50%)}.rg-toolbar.rg-xs-toolbar.rg-toolbar-v-top{top:10px}.rg-toolbar.rg-xs-toolbar.rg-toolbar-v-bottom{bottom:10px}.rg-toolbar.rg-xs-toolbar.rg-toolbar-v-center{top:50%;transform:translateY(-50%)}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();(function(R,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],x):(R=typeof globalThis<"u"?globalThis:R||self,x(R.RelationGraph={},R.ReactJSXRuntime,R.React,R.ReactDOM))})(this,function(R,x,I,Vt){"use strict";var hi=Object.defineProperty;var fi=(R,x,I)=>x in R?hi(R,x,{enumerable:!0,configurable:!0,writable:!0,value:I}):R[x]=I;var N=(R,x,I)=>(fi(R,typeof x!="symbol"?x+"":x,I),I);/*!
|
|
2
|
+
* relation-graph v3.0.1
|
|
3
3
|
* (c) 2025 WanLian <seeksdream@qq.com>
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
* Repository: https://github.com/seeksdream/relation-graph
|
|
6
|
-
*/const ct=(i=>i&&typeof i=="object"&&"default"in i?i:{default:i})(D),Wt="3.0.0",So="",Mo="",nt=i=>{try{if("touches"in i&&i.touches||"targetTouches"in i&&i.targetTouches)return!0}catch{}return!1},mt=i=>{if(nt(i)){const a=i.touches||i.targetTouches;if(!a)throw new Error("error targetTouches");return{clientX:a[0].clientX,clientY:a[0].clientY}}else return{clientX:i.clientX,clientY:i.clientY}},C=(...i)=>{typeof window<"u"&&window.relationGraphDebug&&console.log("[relation-graph:debug]",...i)},Lt=(i,a,t)=>{if(!i)return null;if(i.classList){if(i.classList.contains(a))return i;if(i.classList.contains(t))return null}return Lt(i.parentElement,a,t)},ft=async i=>new Promise((a,t)=>{setTimeout(()=>{a()},i)}),at=i=>typeof i=="string"?Number.parseInt(i):i,Se=()=>{const i="l",a="o",t="g",e=new Date().getFullYear(),n=[];return e>1&&n.push(i),e>201&&n.push(a),e>1113&&n.push(t),n.join("")},Me=()=>{const i="c",a="o",t="n",e="s",n="o",o="l",s="e",r=new Date().getFullYear(),l=[];return r>1&&l.push(i),r>21&&l.push(a),r>35&&l.push(t),r>55&&l.push(e),r>189&&l.push(n),r>231&&l.push(o),r>1234&&l.push(s),l.join("")},Ut=i=>i.replace(/-/g,"").replace(/\*/g,"-"),Zt=i=>{const a=Me(),t=Se(),e="r-e-l-a-t-i-o-n*g-r-a-p-h",n="h-t-t-p-s-:-/-/-g-i-t-h-u-b-.-c-o-m-/-s-e-e-k-s-d-r-e-a-m-/-r-e-l-a-t-i-o-n-*-g-r-a-p-h";window&&window[a]&&window[a][t](`%c ${Ut(e)} %c Version v${Wt}(${i}) %c More info: ${Ut(n)} %c`,"background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#41b883 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:#fff ; padding: 1px; border-radius: 0 3px 3px 0; color: #41b883","background:transparent")},Ne=(i,a)=>{typeof a=="string"&&(a=[a]);for(const e of a)if(i.classList.contains(e))return!0;let t=i.parentElement;for(;t;){for(const e of a)if(t.classList.contains(e))return!0;t=t.parentElement}return!1},vt=i=>{const a=i.target;return Ne(a,"rel-text-editing")?!0:["input","textarea"].includes(document.activeElement.tagName.toLowerCase())},$=D.createContext(null),gt=D.createContext(null),Q=D.createContext(0),Te=()=>{const i=D.useContext($),a=D.useContext(gt),t=i.options,[e,n]=D.useState(!1),o=()=>{n(!e)},s=()=>{i.printOptions()},r=()=>{i.getGraphJsonData()},l=()=>{i.enableDebugLog(!t.debug),C("debugLog:",t.debug),a()};return v.jsxs("div",{children:[v.jsx("div",{className:"rg-setting-panel-button",onClick:()=>{o()},children:"Debug"}),e&&v.jsxs("div",{className:"rg-setting-panel",children:[v.jsx("div",{className:"c-debug-tools-row",children:v.jsx("button",{onClick:()=>{s()},children:"print options in console"})}),v.jsx("div",{className:"c-debug-tools-row",children:v.jsx("button",{onClick:()=>{r()},children:"print json data in console"})}),v.jsxs("div",{className:"c-debug-tools-row",children:["debug log status: ",t.debug?"true":"false",v.jsxs("button",{onClick:()=>{l()},children:[t.debug?"disable":"enable"," debug log"]})]})]})]})},z={getDescendantNodes(i,a=[]){return i.lot&&i.lot.childs&&i.lot.childs.forEach(t=>{a.push(t),z.getDescendantNodes(t,a)}),a},conductStrengthToParents(i){i.lot.parent&&Math.abs(i.lot.level)-1===Math.abs(i.lot.parent.lot.level)&&(i.lot.parent.lot.strengthWithChilds+=1,z.conductStrengthToParents(i.lot.parent))},analysisDataTree(i,a,t=1){const e=[];let n=0;i.forEach(o=>{(o.lot.level===0||t===(o.lot.level<0?-1:1))&&(o.lot.childs_size>0&&o.lot.childs.forEach(s=>{e.push(s)}),o.lot.parent&&n<o.lot.parent.lot.strengthWithChilds_from&&(n=o.lot.parent.lot.strengthWithChilds_from),o.lot.strengthWithChilds_from=n,n+=o.lot.strengthWithChilds)}),e.length>0&&z.analysisDataTree(e,a+(t<0?-1:1),t)},conductStrengthToParents4Folder(i){i.lot.parent&&(i.lot.parent.lot.strengthWithChilds+=1,z.conductStrengthToParents4Folder(i.lot.parent))},analysisDataFolder(i,a,t){const e=[];let n=0,o;i.forEach(s=>{(s.lot.level===0||t===(s.lot.level<0?-1:1))&&(s.lot.childs_size>0&&s.lot.childs.forEach(r=>{e.push(r)}),s.lot.parent&&(o?o!==s.lot.parent&&(o=s.lot.parent,n=o.lot.strengthWithChilds_from):(o=s.lot.parent,n=o.lot.strengthWithChilds_from)),s.lot.strengthWithChilds_from=1+n,n+=s.lot.strengthWithChilds)}),e.length>0&&z.analysisDataFolder(e,a+t,t)},isVisibleNode(i,a=0){return typeof a!="number"&&(a=0),a>18?!0:i.hidden?!1:i.lot&&i.lot.parent?i.lot.parent.expanded===!1?!1:z.isVisibleNode(i.lot.parent,a+1):!0},isAllowShowNode(i,a=0){return z.isVisibleNode(i,a=0)},getNodeWidth(i){var a;return((a=i.el)==null?void 0:a.offsetWidth)||i.width||50},getNodeHeight(i){var a;return((a=i.el)==null?void 0:a.offsetHeight)||i.height||50},getNodeXByLotX(i,a){const t=a.lot.x||0;return i.alignItemsX==="end"?t-z.getNodeWidth(a):i.alignItemsX==="start"?t:t-z.getNodeWidth(a)/2},getNodeYByLotY(i,a){const t=a.lot.y||0;return i.alignItemsY==="end"?t-z.getNodeHeight(a):i.alignItemsY==="start"?t:t-z.getNodeHeight(a)/2},getNodeLotXY(i,a){let t=a.x||0,e=a.y||0;return i.alignItemsX==="end"?t=t+z.getNodeWidth(a):i.alignItemsX==="start"||(t=t+z.getNodeWidth(a)/2),i.alignItemsY==="end"?e=e+z.getNodeHeight(a):i.alignItemsY==="start"||(e=e+z.getNodeHeight(a)/2),{x:t,y:e}},isRectangleOverlap(i,a){const t=i.x,e=a.x,n=i.el.offsetWidth,o=a.el.offsetWidth,s=i.y,r=a.y,l=i.el.offsetHeight,c=a.el.offsetHeight;return!(e>=t+n||e+o<=t||r>=s+l||r+c<=s)},isXOverlap(i,a,t,e){return!(a>=i+t||a+e<=i)},isYOverlap(i,a,t,e){return!(a>=i+t||a+e<=i)},shapesOverlap(i,a,t=1,e=1){return this.isRectangleOverlap(i,a)},getNoOverlapLimitedPosition(i,a,t,e){const n=i.x,o=i.y,s=a,r=e.x,l=i.el.offsetWidth,c=e.el.offsetWidth,h=t,d=e.y,f=i.el.offsetHeight,p=e.el.offsetHeight;let g=i.x,u=i.y;const x=this.isXOverlap(n,r,l,c),y=this.isYOverlap(o,d,f,p);return x?h<d?(g=a,u=d-f):h>d&&(g=a,u=d+p):y&&(s<r?(g=r-l,u=t):s>r&&(g=r+c,u=t)),{x:g,y:u}},flatNodeData(i,a,t,e){i.forEach(n=>{t.push(n),a&&e.push({from:a.id,to:n.id});const o=n.children||n.childs;o&&o.length>0&&this.flatNodeData(o,n,t,e)})}},Jt=({expandButtonClass:i,expandOrCollapseNode:a,expandHolderPosition:t})=>v.jsx("div",{className:`rg-node-expand-holder c-expand-positon-${t}`,children:v.jsx("span",{className:i,onClickCapture:e=>{a(e)},onTouchEnd:e=>{a(e)}})}),jt=({nodeProps:i,nodeSlot:a,expandHolderSlot:t})=>{const e=D.useContext($);D.useContext(gt);const n=D.useRef();D.useEffect(()=>(e.addNodeResizeListener(n.current,i),()=>{n.current&&e.removeNodeResizeListener(n.current)}),[]);const o=async y=>{await e.expandOrCollapseNode(i,y.nativeEvent)},s=y=>{y.type==="mousedown"&&y.button!==0||(y.stopPropagation(),e.onNodeDragStart(i,y.nativeEvent))},r=y=>{y.stopPropagation(),e.onNodeClick(i,y.nativeEvent)},l=e.options,c=()=>{if(i.width===0)return;const y=i.width||0;if(!!y)return y+"px"},h=()=>{if(i.height===0)return;const y=i.height||0;if(!!y)return y+"px"},d=i.borderWidth===void 0?void 0:i.borderWidth+"px",f=i.borderColor,p=i.opacity,g=z.isVisibleNode(i);let u=l.defaultExpandHolderPosition&&l.defaultExpandHolderPosition!=="hide"&&i.lot.childs&&i.lot.childs.length>0;i.expandHolderPosition&&(u=i.expandHolderPosition!=="hide");const x=i.expanded===!1?"c-expanded":"c-collapsed";return v.jsxs("div",{ref:n,style:{display:g?void 0:"none","--rg-node-z-index":i.zIndex?i.zIndex:void 0,pointerEvents:p===0?"none":void 0,transform:`translate(${i.x}px, ${i.y}px)`,"--rg-node-color":i.color,"--rg-node-font-color":i.fontColor,"--rg-node-font-size":i.fontSize?i.fontSize+"px":void 0,"--rg-node-border-width":d,"--rg-node-border-radius":i.borderRadius&&i.borderRadius+"px","--rg-node-border-color":f,"--rg-node-opacity":i.opacity===void 0?void 0:i.opacity},className:["rg-node-peel",i.selected&&"rg-node-selected",i.dragging&&"rg-node-dragging",i.id===l.checkedNodeId&&"rg-node-peel-checked",i.className,(i.disablePointEvent||i.opacity===0)&&"rg-node-peel-disable-events"].filter(Boolean).join(" "),"data-id":i.id,children:[u&&(t?t({node:i,expandButtonClass:x,expandOrCollapseNode:y=>{o(y)},expandHolderPosition:i.expandHolderPosition||l.defaultExpandHolderPosition,color:l.defaultExpandHolderColor||i.color||l.defaultNodeColor}):v.jsx(Jt,{node:i,expandButtonClass:x,expandOrCollapseNode:y=>{o(y)},expandHolderPosition:i.expandHolderPosition||l.defaultExpandHolderPosition})),v.jsx("div",{className:`rg-node rg-node-shape-${i.nodeShape===void 0?1:i.nodeShape} rg-node-type-${i.type} ${i.id===l.checkedNodeId?"rg-node-checked":""}`,style:{width:c(),height:h()},onClick:y=>{r(y)},onMouseDown:y=>{s(y)},onTouchStart:y=>{s(y)},children:a?a({node:i,graphInstance:e}):v.jsx("div",{className:"rg-node-text",children:v.jsx("span",{children:i.text})})})]})},qt=({forElementLines:i,svgDefs:a})=>{const e=D.useContext($).options;return v.jsxs("defs",{children:[v.jsx("marker",{id:`${e.instanceId}-arrow-default`,markerWidth:e.defaultLineMarker.markerWidth,markerHeight:e.defaultLineMarker.markerHeight,refX:e.defaultLineMarker.refX,refY:e.defaultLineMarker.refY,markerUnits:"userSpaceOnUse",orient:"auto",viewBox:e.defaultLineMarker.viewBox,children:v.jsx("path",{style:{fill:"context-stroke"},d:e.defaultLineMarker.data})}),v.jsx("marker",{id:`${e.instanceId}-start-arrow-default`,markerWidth:e.defaultLineMarker.markerWidth,markerHeight:e.defaultLineMarker.markerHeight,refX:e.defaultLineMarker.refX,refY:e.defaultLineMarker.refY,markerUnits:"userSpaceOnUse",orient:"auto-start-reverse",viewBox:e.defaultLineMarker.viewBox,children:v.jsx("path",{style:{fill:"context-stroke"},d:e.defaultLineMarker.data})}),a]})},Qt=({children:i,lineConfig:a})=>{const t=D.useContext($);if(!t)return null;const e=t.getLineTextContainer(a==null?void 0:a.line);if(!e)return null;const n=a.line,o=t.options,s=n.id===o.checkedLineId,r=n.selected;return Oe.createPortal(v.jsx("div",{className:["rg-line-peel",n.className,s&&"rg-line-peel-checked",n.disablePointEvent&&"rg-line-peel-disable-events",r&&"rg-line-peel-selected"].filter(Boolean).join(" "),"data-id":n.id+"-text",style:{"--rg-line-color":n.color,"--rg-line-fontsize":a.line.fontSize?`${a.line.fontSize}px`:void 0,"--rg-line-opacity":n.opacity,"--rg-line-fontcolor":n.fontColor,...n.cssVars||{}},children:i}),e)},Kt=({lineConfig:i,linePathInfo:a,onLineClick:t})=>{const e=D.useContext($),n=i.line,o=e.options,s=n.id===o.checkedLineId,r=n.selected,l=e.getArrowMarkerId(n,!0),c=e.getArrowMarkerId(n,!1),h=n.lineWidth?n.lineWidth+"px":void 0,f=n.useTextPath||o.lineUseTextPath?e.generateLineTextStyle4TextPath(i):null,p=o.instanceId+"-"+n.id;return v.jsxs("g",{className:["rg-line-peel",n.className,s&&"rg-line-peel-checked",r&&"rg-line-peel-selected",n.disablePointEvent&&"rg-line-peel-disable-events"].filter(Boolean).join(" "),"data-id":n.id,style:{"--rg-line-width":h,"--rg-line-color":n.color,"--rg-line-opacity":n.opacity,"--rg-line-fontcolor":n.fontColor,"--rg-line-marker-end":c,"--rg-line-marker-start":l,...n.cssVars||{}},children:[v.jsx("path",{d:a.pathData,className:"rg-line-bg",onTouchStart:t,onClick:t}),v.jsx("path",{id:p,d:a.pathData,className:["rg-line",n.dashType?"rg-line-dashtype-"+n.dashType:void 0,n.animation?"rg-line-anm-"+n.animation:void 0].filter(Boolean).join(" ")}),f&&o.canvasZoom>40&&v.jsx("g",{children:v.jsx("text",{className:"rg-line-text rg-line-text-on-path",dy:"-6px",onTouchStart:t,onClick:t,children:v.jsx("textPath",{xlinkHref:`#${p}`,startOffset:f.onPathStartOffset,textAnchor:f.textAnchor,method:"align",spacing:"auto",children:f.text})})})]})},te=({lineConfig:i})=>{const a=D.useContext($),t=D.useMemo(()=>a.generateLinePath(i),[i]),e=s=>{console.log("onLineClick",i.line),a.onLineClick(i.line,null,s.nativeEvent)},n=!(i.line.useTextPath||a.options.lineUseTextPath)&&a.options.canvasZoom>40,o=a.generateLineTextStyle(i,t);return v.jsxs(v.Fragment,{children:[v.jsx(Kt,{lineConfig:i,linePathInfo:t,onLineClick:e}),n&&v.jsx(Qt,{lineConfig:i,linePathInfo:t,children:v.jsx("div",{className:"rg-line-label",style:{...o.cssStyles},onTouchStart:e,onClick:e,children:o.text})})]})},ee=({line:i,lineSlot:a})=>{const t=D.useContext($);D.useContext(gt);const e=i.isFakeLine?t.generateFakeLineConfig(i):t.generateLineConfig(i);return e&&v.jsx(v.Fragment,{children:a?a({config:e}):v.jsx(te,{lineConfig:e})})},ne=i=>{const a=D.useContext($);D.useEffect(()=>{},[]);const t=a.options,e=a.getShouldRenderNodes(),n=a.getShouldRenderLines(),o=a.getShouldRenderFakeLines();return v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"rg-lines-container rg-lines-container-normal-lines",children:[v.jsxs("svg",{className:"rg-lines-svg",style:{width:`${t.canvasSize.width}px`,height:`${t.canvasSize.height}px`},xmlns:"http://www.w3.org/2000/svg",children:[v.jsx(qt,{svgDefs:i.svgDefs}),!t.showEasyView&&n.map(s=>s.hidden!==!0&&v.jsx(ee,{line:s,lineSlot:i.lineSlot},s.id))]}),v.jsx("div",{className:"rg-linetext-container"})]}),v.jsx("div",{className:"rg-nodes-container",children:e.map(s=>!t.showEasyView&&v.jsx(jt,{nodeProps:s,nodeSlot:i.nodeSlot,expandHolderSlot:i.expandHolderSlot},s.id))}),v.jsxs("div",{className:"rg-lines-container rg-lines-container-el-lines",children:[v.jsx("div",{className:"rg-linetext-container"}),v.jsxs("svg",{className:"rg-lines-svg rg-lines-svg-el-lines",xmlns:"http://www.w3.org/2000/svg",children:[v.jsx(qt,{forElementLines:!0}),!t.showEasyView&&o.map(s=>s.hidden!==!0&&v.jsx(ee,{line:s,lineSlot:i.lineSlot},s.id)),t.creatingLinePlot&&t.newLinkTemplate.fromNode&&(i.lineSlot?i.lineSlot({lineConfig:a.generateCreatingLineConfig()}):v.jsx(te,{lineConfig:a.generateCreatingLineConfig()}))]})]})]})},Ee=i=>{const a=D.useContext($),t=a.options,e=D.useRef();return D.useEffect(()=>{C("[RGEasyView mounted]"),a.setEasyViewCanvas(e.current)},[]),v.jsx("div",{className:`rg-easy-view ${t.showEasyView?"rg-easy-view-active":""}`,children:v.jsx("canvas",{ref:e})})},De=i=>{const a=D.useContext($),t=D.useRef(),e=D.useRef(),n={width:`${a.options.canvasSize.width}px`,height:`${a.options.canvasSize.height}px`,backgroundColor:"transparent",transform:`translate(${a.options.canvasOffset.x}px, ${a.options.canvasOffset.y}px) scale(${a.options.canvasZoom/100},${a.options.canvasZoom/100})`};D.useEffect(()=>{C("[RGCanvas mounted]"),a.setCanvasDom(t.current)},[]);const o=r=>{r.type==="mousedown"&&r.button!==0||a.onCanvasDragStart(r.nativeEvent)},s=r=>{r.preventDefault(),a.onContextmenu(r.nativeEvent)};return v.jsxs("div",{style:{"--bg-background-color":a.options.backgroundColor,"--rg-node-color":a.options.defaultNodeColor,"--rg-line-color":a.options.defaultLineColor},ref:e,className:["rg-map",a.options.canvasOpacity===1?"rg-map-ready":""].join(" "),onContextMenu:r=>{s(r)},onMouseDown:r=>{o(r)},onTouchStart:r=>{o(r)},children:[v.jsx(Ee,{}),v.jsx("div",{style:n,className:"rg-map-canvas rg-canvas-behind",children:v.jsx("div",{className:"rg-canvas-slot rg-canvas-slot-behind",children:i.canvasPlugSlot&&(typeof i.canvasPlugSlot=="function"?v.jsx(i.canvasPlugSlot,{}):i.canvasPlugSlot)})}),v.jsx("div",{ref:t,style:n,className:"rg-map-canvas",children:v.jsx(ne,{svgDefs:i.svgDefs,nodeSlot:i.nodeSlot,lineSlot:i.lineSlot,expandHolderSlot:i.expandHolderSlot})}),v.jsx("div",{style:n,className:"rg-map-canvas rg-canvas-above",children:v.jsx("div",{className:"rg-canvas-slot rg-canvas-slot-above",children:i.canvasPlugAboveSlot})})]})},ke=()=>{const i=D.useContext($),a=(i==null?void 0:i.options.canvasMoveMode)||!1,t=e=>{i&&i.startMoveCanvas(e.nativeEvent,!0)};return v.jsx("div",{className:`rg-move-operator ${a?"rg-move-operator-active":""}`,children:v.jsx("div",{className:"rg-move-touchpad",onMouseDown:t,onTouchStart:t})})},Pe={"icon-quanping":{data:`
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<path d="M768 448a320 320 0 1 0-320 320 320 320 0 0 0 320-320z m64 0A384 384 0 1 1 448 64a384 384 0 0 1 384 384z"></path>
|
|
10
|
-
<path d="M681.28 726.72a32 32 0 0 1 45.44-45.44l160 160a32 32 0 0 1-45.44 45.44zM320 480a32 32 0 0 1 0-64h256a32 32 0 0 1 0 64z"></path>
|
|
11
|
-
<path d="M480 576a32 32 0 0 1-64 0V320a32 32 0 0 1 64 0z"></path>
|
|
6
|
+
*/const pe=(s=>s&&typeof s=="object"&&"default"in s?s:{default:s})(I),je="3.0.1",de=s=>{try{if("touches"in s&&s.touches||"targetTouches"in s&&s.targetTouches)return!0}catch{}return!1},me=s=>{if(de(s)){const i=s.touches||s.targetTouches;if(!i)throw new Error("error targetTouches");return{clientX:i[0].clientX,clientY:i[0].clientY}}else return{clientX:s.clientX,clientY:s.clientY}},C=(...s)=>{typeof window<"u"&&window.relationGraphDebug&&console.log("[relation-graph:debug]",...s)},xe=(s,i,e)=>{if(!s)return null;if(s.classList){if(s.classList.contains(i))return s;if(s.classList.contains(e))return null}let t=null;if(s.assignedSlot?t=s.assignedSlot:t=s.parentElement,!t){const n=s.parentNode;n instanceof ShadowRoot&&(t=n.host)}return xe(t,i,e)},Ae=s=>new Promise(i=>setTimeout(i,s)),Xt=()=>{const s="l",i="o",e="g",t=new Date().getFullYear(),n=[];return t>1&&n.push(s),t>201&&n.push(i),t>1113&&n.push(e),n.join("")},zt=()=>{const s="c",i="o",e="n",t="s",n="o",o="l",a="e",r=new Date().getFullYear(),l=[];return r>1&&l.push(s),r>21&&l.push(i),r>35&&l.push(e),r>55&&l.push(t),r>189&&l.push(n),r>231&&l.push(o),r>1234&&l.push(a),l.join("")},Je=s=>s.replace(/-/g,"").replace(/\*/g,"-"),Ze=s=>{const i=zt(),e=Xt(),t="r-e-l-a-t-i-o-n*g-r-a-p-h",n="h-t-t-p-s-:-/-/-g-i-t-h-u-b-.-c-o-m-/-s-e-e-k-s-d-r-e-a-m-/-r-e-l-a-t-i-o-n-*-g-r-a-p-h";window&&window[i]&&window[i][e](`%c ${Je(t)} %c Version v${je}(${s}) %c More info: ${Je(n)} %c`,"background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#41b883 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:#fff ; padding: 1px; border-radius: 0 3px 3px 0; color: #41b883","background:transparent")},Gt=(s,i)=>{typeof i=="string"&&(i=[i]);for(const t of i)if(s.classList.contains(t))return!0;let e=s.parentElement;for(;e;){for(const t of i)if(e.classList.contains(t))return!0;e=e.parentElement}return!1},Ce=s=>{const i=s.target;return Gt(i,"rel-text-editing")?!0:["input","textarea"].includes(document.activeElement.tagName.toLowerCase())},Ve=(s=5)=>{const i="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";let e="";const t=s>30?30:s;for(let n=0;n<t;n++)e+=i[Math.floor(Math.random()*i.length)];return e},Qe=s=>({onReady:s.onReady,onNodeClick:s.onNodeClick,onNodeExpand:s.onNodeExpand,onNodeCollapse:s.onNodeCollapse,onLineClick:s.onLineClick,onNodeDragStart:s.onNodeDragStart,onNodeDragEnd:s.onNodeDragEnd,onNodeDragging:s.onNodeDragging,onCanvasDragEnd:s.onCanvasDragEnd,onCanvasDragging:s.onCanvasDragging,onContextmenu:s.onContextmenu,onFullscreen:s.onFullscreen,onCanvasClick:s.onCanvasClick,onCanvasSelectionEnd:s.onCanvasSelectionEnd,beforeZoomStart:s.beforeZoomStart,onZoomEnd:s.onZoomEnd,onViewResize:s.onViewResize,onResizeStart:s.onResizeStart,beforeNodeResize:s.beforeNodeResize,onResizeEnd:s.onResizeEnd,onLineVertexDropped:s.onLineVertexDropped,beforeCreateLine:s.beforeCreateLine,onLineBeCreated:s.onLineBeCreated,beforeAddNodes:s.beforeAddNodes,beforeAddLines:s.beforeAddLines,onKeyboardDown:s.onKeyboardDown,onKeyboardUp:s.onKeyboardUp,onCanvasDragStart:s.onCanvasDragStart,onForceLayoutFinish:s.onForceLayoutFinish,beforeScrollStart:s.beforeScrollStart}),gi="",pi="";var B=(s=>(s.Node="node",s.NodePoint="NodePoint",s.HTMLElementId="HTMLElementId",s.CanvasPoint="CanvasPoint",s.ViewPoint="ViewPoint",s))(B||{}),j=(s=>(s.border="border",s.ltrb="ltrb",s.tb="tb",s.lr="lr",s.left="left",s.right="right",s.top="top",s.bottom="bottom",s))(j||{}),Le=(s=>(s[s.circle=0]="circle",s[s.rect=1]="rect",s))(Le||{}),Y=(s=>(s[s.StandardStraight=1]="StandardStraight",s[s.StandardCurve=6]="StandardCurve",s[s.Curve2=2]="Curve2",s[s.Curve3=3]="Curve3",s[s.Curve5=5]="Curve5",s[s.Curve7=7]="Curve7",s[s.Curve8=8]="Curve8",s[s.SimpleOrthogonal=4]="SimpleOrthogonal",s[s.StandardOrthogonal=44]="StandardOrthogonal",s[s.HardOrthogonal=49]="HardOrthogonal",s))(Y||{}),Ke=(s=>(s.Left="left",s.Top="top",s.Right="right",s.Bottom="bottom",s))(Ke||{}),V=(s=>(s.onReady="onReady",s.onNodeClick="onNodeClick",s.onNodeExpand="onNodeExpand",s.onNodeCollapse="onNodeCollapse",s.onLineClick="onLineClick",s.onNodeDragStart="onNodeDragStart",s.onNodeDragEnd="onNodeDragEnd",s.onNodeDragging="onNodeDragging",s.onCanvasDragEnd="onCanvasDragEnd",s.onCanvasDragging="onCanvasDragging",s.onContextmenu="onContextmenu",s.onFullscreen="onFullscreen",s.onCanvasClick="onCanvasClick",s.onCanvasSelectionEnd="onCanvasSelectionEnd",s.beforeZoomStart="beforeZoomStart",s.onZoomEnd="onZoomEnd",s.onViewResize="onViewResize",s.onResizeStart="onResizeStart",s.beforeNodeResize="beforeNodeResize",s.onResizeEnd="onResizeEnd",s.onLineVertexDropped="onLineVertexDropped",s.beforeCreateLine="beforeCreateLine",s.onLineBeCreated="onLineBeCreated",s.beforeAddNodes="beforeAddNodes",s.beforeAddLines="beforeAddLines",s.onKeyboardDown="onKeyboardDown",s.onKeyboardUp="onKeyboardUp",s.onCanvasDragStart="onCanvasDragStart",s.onForceLayoutFinish="onForceLayoutFinish",s.beforeScrollStart="beforeScrollStart",s))(V||{});const fe=(s,i)=>{if(s.from===void 0)throw console.log("error,line must has option[from](nodeId):",s),new Error("error,line must has option[from]:");if(s.to===void 0)throw console.log("error,line must has option[to](nodeId):",s),new Error("error,line must has option[to]:");if(typeof s.from!="string")throw console.log("error line from, must be string(nodeId):",s),new TypeError("error line from, must be string:");if(typeof s.to!="string")throw console.log("error line to, must be string(nodeId):",s),new TypeError("error line to, must be string:");return s.isShow!==void 0&&(s.hidden=!s.isShow,console.warn("[relation-graph Warning] line option[isShow] is deprecated, please use [hidden] instead.")),s.isHide!==void 0&&(s.hidden=s.isHide,console.warn("[relation-graph Warning] line option[isHide] is deprecated, please use [hidden] instead.")),s.placeText!==void 0&&(s.onPathStartOffset=s.placeText,console.warn("[relation-graph Warning] line option[placeText] is deprecated, please use [onPathStartOffset] instead.")),{id:s.id,from:s.from,to:s.to,type:s.type!==void 0?s.type:"line",isFakeLine:s.isFakeLine!==void 0?s.isFakeLine:!1,fromType:s.fromType!==void 0?s.fromType:s.isFakeLine?B.CanvasPoint:B.Node,toType:s.toType!==void 0?s.toType:s.isFakeLine?B.CanvasPoint:B.Node,selected:!1,text:s.text!==void 0?s.text:"",textOffset_x:s.textOffset_x!==void 0?s.textOffset_x:void 0,textOffset_y:s.textOffset_y!==void 0?s.textOffset_y:void 0,color:s.color!==void 0?s.color:void 0,opacity:s.opacity!==void 0?s.opacity:void 0,fontSize:s.fontSize!==void 0?s.fontSize:void 0,fontColor:s.fontColor!==void 0?s.fontColor:void 0,lineWidth:s.lineWidth!==void 0?s.lineWidth:void 0,lineShape:s.lineShape||i.defaultLineShape||1,className:s.className!==void 0?s.className:void 0,animation:s.animation!==void 0?s.animation:0,dashType:s.dashType!==void 0?s.dashType:0,disablePointEvent:s.disablePointEvent!==void 0?s.disablePointEvent:!1,showStartArrow:s.showStartArrow!==void 0?s.showStartArrow:!1,showEndArrow:s.showEndArrow!==void 0?s.showEndArrow:!0,useTextPath:s.useTextPath!==void 0?s.useTextPath:void 0,onPathStartOffset:s.onPathStartOffset!==void 0?s.onPathStartOffset:void 0,startMarkerId:s.startMarkerId||"",endMarkerId:s.endMarkerId||"",textAnchor:s.textAnchor!==void 0?s.textAnchor:void 0,junctionOffset:s.junctionOffset,fromJunctionPoint:s.fromJunctionPoint,toJunctionPoint:s.toJunctionPoint,fromJuctionPointOffsetX:s.fromJuctionPointOffsetX||0,fromJuctionPointOffsetY:s.fromJuctionPointOffsetY||0,toJuctionPointOffsetX:s.toJuctionPointOffsetX||0,toJuctionPointOffsetY:s.toJuctionPointOffsetY||0,lineRadius:s.lineRadius,force_elastic:s.force_elastic,polyLineStartDistance:s.polyLineStartDistance,ctrlPointsFor49:s.ctrlPointsFor49,ctrlPointsFor44:s.ctrlPointsFor44,ctrlPoints:s.ctrlPoints,lineDirection:s.lineDirection!==void 0?s.lineDirection:void 0,forDisplayOnly:s.forDisplayOnly||s.from===s.to,hidden:s.hidden!==void 0?s.hidden:!1,cssVars:s.cssVars!==void 0?s.cssVars:void 0,data:s.data!==void 0?s.data:{}}},Bt=["arrow","isReverse","selected","shouldRender","rgCalcedVisibility"],Me=s=>{if(!s)return;const i={};return Object.keys(s).forEach(e=>{if(!Bt.includes(e)){const t=s[e];t!==void 0&&(e==="isFakeLine"&&t===!1||e==="fromType"&&t===B.Node||e==="toType"&&t===B.Node||e==="animation"&&t===0||e==="text"&&t===""||e==="dashType"&&t===0||e==="disablePointEvent"&&t===!1||e==="showStartArrow"&&t===!1||e==="showEndArrow"&&t===!0||e==="startMarkerId"&&t===""||e==="endMarkerId"&&t===""||e==="forDisplayOnly"&&t===!1||e==="fromJuctionPointOffsetX"&&t===0||e==="fromJuctionPointOffsetY"&&t===0||e==="toJuctionPointOffsetX"&&t===0||e==="toJuctionPointOffsetY"&&t===0||e==="opacity"&&t===1||e==="hidden"&&t===!1||e==="data"&&(!t||Object.keys(t).length===0)||(i[e]=s[e]))}}),i},Xe=s=>{if(!!s)return Me(s.line)},Ft=Object.freeze(Object.defineProperty({__proto__:null,json2Line:fe,transLineToJson:Me,transLinkToJson:Xe,default:{json2Line:fe,transLinkToJson:Xe}},Symbol.toStringTag,{value:"Module"})),G={getDescendantNodes(s,i=[]){return s.lot&&s.lot.childs&&s.lot.childs.forEach(e=>{i.push(e),G.getDescendantNodes(e,i)}),i},isVisibleNode(s,i=0){return typeof i!="number"&&(i=0),i>18?!0:s.hidden?!1:s.lot&&s.lot.parent?s.lot.parent.expanded===!1?!1:G.isVisibleNode(s.lot.parent,i+1):!0},isAllowShowNode(s,i=0){return G.isVisibleNode(s,i=0)},getNodeWidth(s){return s.el_W||s.width||50},getNodeHeight(s){return s.el_H||s.height||50},getNodeXByLotX(s,i){const e=i.lot.x||0;return s.alignItemsX==="end"?e-G.getNodeWidth(i):s.alignItemsX==="start"?e:e-G.getNodeWidth(i)/2},getNodeYByLotY(s,i){const e=i.lot.y||0;return s.alignItemsY==="end"?e-G.getNodeHeight(i):s.alignItemsY==="start"?e:e-G.getNodeHeight(i)/2},getNodeLotXY(s,i){let e=i.x||0,t=i.y||0;return s.alignItemsX==="end"?e=e+G.getNodeWidth(i):s.alignItemsX==="start"||(e=e+G.getNodeWidth(i)/2),s.alignItemsY==="end"?t=t+G.getNodeHeight(i):s.alignItemsY==="start"||(t=t+G.getNodeHeight(i)/2),{x:e,y:t}},isRectangleOverlap(s,i){const e=s.x,t=i.x,n=s.el_W,o=i.el_W,a=s.y,r=i.y,l=s.el_H,c=i.el_H;return!(t>=e+n||t+o<=e||r>=a+l||r+c<=a)},isXOverlap(s,i,e,t){return!(i>=s+e||i+t<=s)},isYOverlap(s,i,e,t){return!(i>=s+e||i+t<=s)},shapesOverlap(s,i,e=1,t=1){return this.isRectangleOverlap(s,i)},getNoOverlapLimitedPosition(s,i,e,t){const n=s.x,o=s.y,a=i,r=t.x,l=s.el_W,c=t.el_W,d=e,h=t.y,u=s.el_H,y=t.el_H;let f=s.x,g=s.y;const v=this.isXOverlap(n,r,l,c),p=this.isYOverlap(o,h,u,y);return v?d<h?(f=i,g=h-u):d>h&&(f=i,g=h+y):p&&(a<r?(f=r-l,g=e):a>r&&(f=r+c,g=e)),{x:f,y:g}},flatNodeData(s,i,e,t){s.forEach(n=>{e.push(n),i&&t.push({from:i.id,to:n.id});const o=n.children||n.childs;o&&o.length>0&&this.flatNodeData(o,n,e,t)})}},we=(s,i)=>s||s===0?s:i,ze={id:"rg-newNodeTemplate",x:0,y:0,text:""},Ne=(s,i)=>{if(s.id===void 0)throw console.log("node must has id:",s),new Error("node must has option[id]:");s.isShow!==void 0&&(s.hidden=!s.isShow,console.warn("[relation-graph Warning] line option[isShow] is deprecated, please use [hidden] instead.")),s.isHide!==void 0&&(s.hidden=s.isHide,console.warn("[relation-graph Warning] line option[isHide] is deprecated, please use [hidden] instead."));const e=s.width||s.width===0?s.width:i==null?void 0:i.defaultNodeWidth,t=s.height||s.height===0?s.height:i==null?void 0:i.defaultNodeHeight,n={id:s.id,text:s.text!==void 0?s.text:"",type:s.type!==void 0?s.type:"node",targetType:s.targetType!==void 0?s.targetType:B.Node,expanded:s.expanded!==void 0?s.expanded:!0,selected:s.selected!==void 0?s.selected:!1,className:s.className!==void 0?s.className:"",nodeShape:we(s.nodeShape,i==null?void 0:i.defaultNodeShape),borderWidth:s.borderWidth!==void 0?s.borderWidth:void 0,borderRadius:s.borderRadius!==void 0?s.borderRadius:void 0,borderColor:s.borderColor!==void 0?s.borderColor:void 0,fontColor:s.fontColor!==void 0?s.fontColor:void 0,fontSize:s.fontSize!==void 0?s.fontSize:void 0,color:s.color!==void 0?s.color:void 0,opacity:s.opacity!==void 0?s.opacity:void 0,fixed:s.fixed!==void 0?s.fixed:!1,width:e,height:t,force_weight:s.force_weight,x:s.x!==void 0?s.x:0,y:s.y!==void 0?s.y:0,expandHolderPosition:s.expandHolderPosition!==void 0?s.expandHolderPosition:void 0,disablePointEvent:s.disablePointEvent!==void 0?s.disablePointEvent:void 0,disableDrag:s.disableDrag!==void 0?s.disableDrag:!1,hidden:s.hidden!==void 0?s.hidden:!1,rgCalcedVisibility:!0,rgShouldRender:!0,rgChildrenSize:0,zIndex:s.zIndex||0,el_W:s.el_W||e||50,el_H:s.el_H||t||50,data:s.data!==void 0?s.data:{}};return n.lot={childs:[],parent:void 0,eached:!1,strength:0},n.width&&(n.el_W=n.width),n.height&&(n.el_H=n.height),n},Yt=["Fx","Fy","appended","dragging","el","el_W","el_H","targetFrom","targetNodes","targetTo","lot","seeks_id","shouldRender","rgCalcedVisibility","rgShouldRender","rgChildrenSize","origin_x","origin_y","selected"],ke=s=>{if(!s)return;const i={};return Object.keys(s).forEach(e=>{if(!Yt.includes(e)){const t=s[e];t!==void 0&&(e==="offset_x"&&t===0||e==="nodeShape"&&t===1||e==="offset_y"&&t===0||e==="zIndex"&&t===0||e==="width"&&!t||e==="height"&&!t||e==="fixed"&&t===!1||e==="className"&&t===""||e==="hidden"&&t===!1||e==="disableDrag"&&t===!1||e==="expanded"&&t===!0||e==="opacity"&&t===1||e==="type"&&t==="node"||e==="targetType"&&t===B.Node||e==="data"&&(!t||Object.keys(t).length===0)||(i[e]=t))}}),i},Ht=Object.freeze(Object.defineProperty({__proto__:null,newNodeTemplate:ze,json2Node:Ne,transNodeToJson:ke,default:{json2Node:Ne,transNodeToJson:ke}},Symbol.toStringTag,{value:"Module"})),_e=(s={})=>{const i={definitelyNoDataProviderNeeded:!1,instanceId:"",debug:!0,graphLoading:!1,graphLoadingText:"",showToolBar:!0,backgroundColor:"transparent",checkedItemBackgroundColor:void 0,selectionMode:!1,disableWheelEvent:!1,wheelEventAction:"zoom",dragEventAction:"move",fullscreenElementXPath:"",disableDragNode:!1,disableDragLine:!0,canvasMoveMode:!1,disableNodePointEvent:!1,disableLinePointEvent:!1,enableNodeXYAnimation:!1,enableCanvasTransformAnimation:!1,reLayoutWhenExpandedOrCollapsed:!1,defaultExpandHolderPosition:"hide",toolBarDirection:"v",toolBarPositionH:"right",toolBarPositionV:"center",defaultNodeColor:"#ffffff",defaultNodeBorderColor:"#666666",defaultNodeBorderWidth:1,defaultNodeBorderRadius:3,defaultNodeShape:Le.rect,defaultNodeWidth:void 0,defaultNodeHeight:void 0,defaultLineColor:"#cccccc",defaultLineWidth:2,defaultLineShape:Y.StandardStraight,defaultLineTextOffset_x:void 0,defaultLineTextOffset_y:void 0,defaultJunctionPoint:void 0,defaultLineJunctionOffset:3,defaultPolyLineRadius:5,placeOtherGroup:!0,lineUseTextPath:!1,lineTextMaxLength:66,multiLineDistance:50,defaultLineMarker:{viewBox:"0 0 12 12",markerWidth:20,markerHeight:20,refX:3,refY:3,data:"M 0 0, V 6, L 4 3, Z"},viewSize:{width:300,height:300},canvasSize:{width:300,height:300},canvasOffset:{x:25,y:27},fullscreen:!1,checkedNodeId:"",checkedLineId:"",draggingNodeId:"",layout:{layoutName:"center"},canvasZoom:100,mouseWheelSpeed:10,minCanvasZoom:5,maxCanvasZoom:500,showEasyView:!1,performanceMode:!1,viewHeight:"100%",canvasOpacity:1,creatingSelection:!1,selectionView:{x:25,y:27,width:0,height:0},creatingNodePlot:!1,showTemplateNode:!0,newNodeTemplate:Ne(JSON.parse(JSON.stringify(ze))),creatingLinePlot:!1,newLineTemplate:{from:"newRelationTemplate-from",to:"newRelationTemplate-to",color:"",text:"new line"},newLinkTemplate:{fromNode:null,toNodeObject:null,toNode:{nothing:!0,x:400,y:400,el_W:30,el_H:30},totalLinesBetweenNodes:1,currentLineIndex:0,line:{}},data:{},editingLineController:{show:!1,line:null,startPoint:{x:0,y:0},endPoint:{x:0,y:0},text:{show:!0,x:0,y:0,width:10,height:10},ctrlPoints:[],selectedLines:[],line44Splits:[],line49Points:[],ctrlPoint1:{x:0,y:0},ctrlPoint2:{x:0,y:0},toolbar:{x:0,y:0}},editingController:{show:!1,nodes:[],x:0,y:0,width:100,height:100},nodeConnectController:{show:!1,node:void 0,x:0,y:0,width:100,height:100},showReferenceLine:!1,referenceLineAdsorption:!1,editingReferenceLine:{show:!1,directionV:!1,directionH:!1,v_x:0,v_y:0,v_height:0,h_x:0,h_y:0,h_width:0},showMiniView:!1,miniViewVisibleHandle:{x:0,y:0,width:100,height:100,emptyContent:!1},snapshotting:!1};i.newLineTemplate=fe(i.newLineTemplate,i);const e=Object.keys(i);return s&&Object.keys(s).forEach(t=>{const n=s[t];if(!e.includes(t)){C("RGOptions: unknow option key:",t);return}if(typeof n=="object"){C("RGOptions:user setting object:",t,n);const o=i[t];if(t==="layout")i[t]=JSON.parse(JSON.stringify(n));else if(o&&!Array.isArray(o)&&n)Object.keys(o).forEach(a=>{o[a]=n[a]});else if(Array.isArray(o)){const a=[];n.forEach(r=>{r&&typeof r=="object"?a.push(JSON.parse(JSON.stringify(r))):a.push(r)}),i[t]=a}else i[t]=n}else i[t]=n}),i},Ge=(s,i)=>{C("applyDefaultOptionsByLayout",s.layoutName,i);const e=s.layoutName||"";e==="center"||e.includes("tree")&&(s.from==="top"||s.from,s.from==="left"||s.from),i.defaultJunctionPoint===void 0&&(i.defaultJunctionPoint=j.border)},Be=s=>{const i=s.layoutName||"";if(i==="center"){const e=s;e.layoutDirection===void 0&&(e.layoutDirection="h"),e.layoutDirection=void 0}else if(i.includes("tree")){const e=s;e.layoutDirection===void 0&&(e.layoutDirection="h"),e.from===void 0&&(e.from="left"),e.levelGaps===void 0&&(e.levelGaps=[]),(e.from==="top"||e.from==="bottom")&&(e.layoutDirection="v",C("set layoutDirection=v"),C("set defaultJunctionPoint=tb")),(e.from==="left"||e.from==="right")&&(e.layoutDirection="h",C("set defaultJunctionPoint=lr"))}else(i==="fixed"||i==="force")&&(s.layoutDirection=void 0);s.supportAutoLayout=!1,s.autoLayouting=!1},Wt=Object.freeze(Object.defineProperty({__proto__:null,createDefaultConfig:_e,applyDefaultOptionsByLayout:Ge,appendDefaultOptions4Layout:Be,default:{createDefaultConfig:_e,applyDefaultOptionsByLayout:Ge}},Symbol.toStringTag,{value:"Module"})),ye=I.createContext(null),et=I.createContext(null),Ie=I.createContext(0),ae=I.createContext({shouldRenderLines:[],shouldRenderNodes:[],shouldRenderFakeLines:[],options:_e({})});function $(){const s=I.useContext(ye);if(!s)throw new Error("'useGraphInstance' must be used within 'RGProvider'");return s}function ie(){const s=I.useContext(Ie);if(s===void 0)throw new Error("'useAutoUpdateView' must be used within 'RGProvider'");return s}function J(){const s=I.useContext(ae);if(s===void 0)throw new Error("'useGraphStore' must be used within 'RGProvider'");return s}function $t(){const s=I.useContext(ae);if(s===void 0)throw new Error("'useCreatingLine' must be used within 'RGProvider'");const i=$();return I.useMemo(()=>{if(!s.options||!s.options.creatingLinePlot)return{creating:!1};const{line:e,from:t,to:n}=i.generateCreatingLineConfig(s.options);return{creating:!0,fromTarget:t,toTarget:n,lineJson:e}},[s.options.creatingLinePlot,s.options.newLinkTemplate,s.options.newLineTemplate])}function Ut(){const s=I.useContext(ae);if(s===void 0)throw new Error("'useCreatingLine' must be used within 'RGProvider'");return I.useMemo(()=>!s.options||!s.options.creatingNodePlot?{creating:!1}:{creating:!0,nodeJson:s.options.newNodeTemplate},[s.options.creatingNodePlot,s.options.newNodeTemplate])}function qt(){const s=I.useContext(ae);if(s===void 0)throw new Error("'useEditingNodes' must be used within 'RGProvider'");return I.useMemo(()=>s.options.editingController,[s.options.editingController])}function jt(){const s=I.useContext(ae);if(s===void 0)throw new Error("'useEditingLine' must be used within 'RGProvider'");return I.useMemo(()=>s.options.editingLineController,[s.options.editingLineController])}function Jt(){const s=I.useContext(ae);if(s===void 0)throw new Error("'useConnectingNode' must be used within 'RGProvider'");return I.useMemo(()=>s.options.nodeConnectController,[s.options.nodeConnectController])}function Zt(){const s=I.useContext(ae);if(s===void 0)throw new Error("'useViewInformation' must be used within 'RGProvider'");return I.useMemo(()=>{const{viewSize:i,canvasSize:e,canvasOffset:t,canvasZoom:n,fullscreen:o,showEasyView:a}=s.options;return{viewSize:i,canvasSize:e,canvasOffset:t,canvasZoom:n,fullscreen:o,showEasyView:a}},[s.options.viewSize,s.options.canvasSize,s.options.canvasOffset,s.options.canvasZoom,s.options.fullscreen,s.options.showEasyView])}function Qt(){const s=I.useContext(ae);if(s===void 0)throw new Error("'useSelection' must be used within 'RGProvider'");return I.useMemo(()=>({...s.options.selectionView,show:s.options.creatingSelection}),[s.options.selectionView,s.options.creatingSelection])}function Kt(){const s=I.useContext(ae);if(s===void 0)throw new Error("'useCheckedItem' must be used within 'RGProvider'");return I.useMemo(()=>({checkedLineId:s.options.checkedLineId,checkedNodeId:s.options.checkedNodeId,draggingNodeId:s.options.draggingNodeId}),[s.options.checkedLineId,s.options.checkedNodeId,s.options.draggingNodeId])}const tt=({forElementLines:s})=>{const{options:i}=J();return x.jsxs("defs",{children:[x.jsx("marker",{id:`${i.instanceId}-arrow-default`,markerWidth:i.defaultLineMarker.markerWidth,markerHeight:i.defaultLineMarker.markerHeight,refX:i.defaultLineMarker.refX,refY:i.defaultLineMarker.refY,markerUnits:"userSpaceOnUse",orient:"auto",viewBox:i.defaultLineMarker.viewBox,children:x.jsx("path",{style:{fill:"context-stroke"},d:i.defaultLineMarker.data})}),x.jsx("marker",{id:`${i.instanceId}-start-arrow-default`,markerWidth:i.defaultLineMarker.markerWidth,markerHeight:i.defaultLineMarker.markerHeight,refX:i.defaultLineMarker.refX,refY:i.defaultLineMarker.refY,markerUnits:"userSpaceOnUse",orient:"auto-start-reverse",viewBox:i.defaultLineMarker.viewBox,children:x.jsx("path",{style:{fill:"context-stroke"},d:i.defaultLineMarker.data})})]})},nt=({children:s,lineConfig:i,checked:e})=>{const t=$();if(!t)return null;const n=t.getLineTextContainer(i==null?void 0:i.line);if(!n)return null;const o=i.line,a=o.selected;return Vt.createPortal(x.jsx("div",{className:["rg-line-peel",o.className,e&&"rg-line-peel-checked",(o.disablePointEvent||o.opacity===0)&&"rg-line-peel-disable-events",a&&"rg-line-peel-selected"].filter(Boolean).join(" "),"data-id":o.id,style:{"--rg-line-color":o.color,"--rg-line-fontsize":i.line.fontSize?`${i.line.fontSize}px`:void 0,"--rg-line-opacity":o.opacity,"--rg-line-fontcolor":o.fontColor,...o.cssVars||{}},children:s}),n)},ot=({lineConfig:s,linePathInfo:i,lineUseTextPath:e,checked:t,graphInstanceId:n,onLineClick:o})=>{const a=$(),r=s.line,l=r.selected,c=a.getArrowMarkerId(r,!0),d=a.getArrowMarkerId(r,!1),h=r.lineWidth?r.lineWidth+"px":void 0,y=r.useTextPath||e?a.generateLineTextStyle4TextPath(s):null,f=n+"-"+r.id;return x.jsxs("g",{className:["rg-line-peel",r.className,t&&"rg-line-peel-checked",l&&"rg-line-peel-selected",(r.disablePointEvent||r.opacity===0)&&"rg-line-peel-disable-events"].filter(Boolean).join(" "),"data-id":r.id,style:{"--rg-line-width":h,"--rg-line-color":r.color,"--rg-line-opacity":r.opacity,"--rg-line-fontcolor":r.fontColor,"--rg-line-marker-end":d,"--rg-line-marker-start":c,...r.cssVars||{}},children:[x.jsx("path",{d:i.pathData,className:"rg-line-bg",onTouchStart:o,onClick:o}),x.jsx("path",{id:f,d:i.pathData,className:["rg-line",r.dashType?"rg-line-dashtype-"+r.dashType:void 0,r.animation?"rg-line-anm-"+r.animation:void 0].filter(Boolean).join(" ")}),y&&x.jsx("g",{children:x.jsx("text",{className:"rg-line-text rg-line-text-on-path",dy:"-6px",onTouchStart:o,onClick:o,children:x.jsx("textPath",{xlinkHref:`#${f}`,startOffset:y.onPathStartOffset,textAnchor:y.textAnchor,method:"align",spacing:"auto",children:y.text})})})]})},it=({lineConfig:s,lineUseTextPath:i,graphInstanceId:e,checked:t})=>{const n=$(),o=I.useMemo(()=>n.generateLinePath(s),[s]),a=c=>{console.log("onLineClick",s.line),n.onLineClick(s.line,null,c.nativeEvent)},r=!(s.line.useTextPath||i),l=n.generateLineTextStyle(s,o);return x.jsxs(x.Fragment,{children:[x.jsx(ot,{lineConfig:s,linePathInfo:o,onLineClick:a,lineUseTextPath:i,checked:t,graphInstanceId:e}),s.line.text&&r&&x.jsx(nt,{lineConfig:s,linePathInfo:o,checked:t,children:x.jsx("div",{className:"rg-line-label",style:{...l.cssStyles},onTouchStart:a,onClick:a,children:l.text})})]})},st=({line:s,lineUseTextPath:i,graphInstanceId:e,checked:t,lineSlot:n})=>{const o=$();ie();const a=s.isFakeLine?o.generateFakeLineConfig(s):o.generateLineConfig(s);return x.jsx(x.Fragment,{children:a&&(n?n({lineConfig:a}):x.jsx(it,{lineConfig:a,lineUseTextPath:i,graphInstanceId:e,checked:t}))})},at=({showEasyView:s,lineSlot:i,lineUseTextPath:e,checkedLineId:t,graphInstanceId:n,allLineConfigList:o})=>x.jsxs("div",{className:"rg-lines-container rg-lines-container-normal-lines",children:[x.jsxs("svg",{className:"rg-lines-svg",xmlns:"http://www.w3.org/2000/svg",children:[x.jsx(tt,{}),!s&&o.map(a=>a.hidden!==!0&&x.jsx(st,{line:a,lineSlot:i,lineUseTextPath:e,checked:a.id===t,graphInstanceId:n},a.id))]}),x.jsx("div",{className:"rg-linetext-container"})]});pe.default.memo(at,(s,i)=>s.allLineConfigList!==i.allLineConfigList||s.graphInstanceId!==i.graphInstanceId||s.checkedLineId!==i.checkedLineId||s.lineSlot!==i.lineSlot?!1:s.lineUseTextPath===i.lineUseTextPath);const rt=({node:s,expandOrCollapseNode:i,expandHolderPosition:e})=>{const t=s.expanded===!1?"c-expanded":"c-collapsed";return x.jsx("div",{className:`rg-node-expand-holder c-expand-positon-${e}`,children:x.jsx("span",{className:t,onClickCapture:i,onTouchEnd:i})})},lt=({nodeProps:s,nodeSlot:i,nodeExpandButtonSlot:e,defaultExpandHolderPosition:t,dragging:n,checked:o})=>{const a=$(),r=I.useRef();I.useEffect(()=>(a.addNodeResizeListener(r.current,s),()=>{r.current&&a.removeNodeResizeListener(r.current)}),[]);const l=async m=>{a.expandOrCollapseNode(s,m.nativeEvent)},c=m=>{m.type==="mousedown"&&m.button!==0||(m.stopPropagation(),a.onNodeDragStart(s,m.nativeEvent))},d=s.width?s.width+"px":void 0,h=s.height?s.height+"px":void 0,u=s.borderWidth===void 0?void 0:s.borderWidth+"px",y=s.borderColor,f=s.opacity,g=s.rgCalcedVisibility,v=s.expandHolderPosition||t||"hide",p=v!=="hide"&&s.rgChildrenSize>0;return x.jsxs("div",{ref:r,style:{display:g?void 0:"none","--rg-node-z-index":s.zIndex?s.zIndex:void 0,pointerEvents:f===0?"none":void 0,transform:`translate(${s.x}px, ${s.y}px)`,"--rg-node-color":s.color,"--rg-node-font-color":s.fontColor,"--rg-node-font-size":s.fontSize?s.fontSize+"px":void 0,"--rg-node-border-width":u,"--rg-node-border-radius":s.borderRadius&&s.borderRadius+"px","--rg-node-border-color":y,"--rg-node-width":d,"--rg-node-height":h,"--rg-node-opacity":s.opacity===void 0?void 0:s.opacity},className:["rg-node-peel",s.selected&&"rg-node-selected",n&&"rg-node-dragging",o&&"rg-node-checked",`rg-node-shape-${s.nodeShape===void 0?1:s.nodeShape}`,`rg-node-type-${s.type}`,s.className,(s.disablePointEvent||s.opacity===0)&&"rg-node-disable-events"].filter(Boolean).join(" "),"data-id":s.id,children:[p&&(e?e({node:s,expandOrCollapseNode:l,expandHolderPosition:v}):x.jsx(rt,{node:s,expandOrCollapseNode:l,expandHolderPosition:v})),x.jsx("div",{className:"rg-node",onMouseDown:m=>{c(m)},onTouchStart:m=>{c(m)},children:i?i({node:s,defaultExpandHolderPosition:t,checked:o,dragging:n}):x.jsx("div",{className:"rg-node-text",children:x.jsx("span",{children:s.text})})})]})},dt=({nodeSlot:s,nodeExpandButtonSlot:i,defaultExpandHolderPosition:e,draggingNodeId:t,checkedNodeId:n,allNodeConfigList:o})=>x.jsx("div",{className:"rg-nodes-container",children:o.map(a=>x.jsx(lt,{nodeProps:a,nodeSlot:s,nodeExpandButtonSlot:i,defaultExpandHolderPosition:e,dragging:a.id===t,checked:a.id===n},a.id))});pe.default.memo(dt,(s,i)=>s.allNodeConfigList!==i.allNodeConfigList||s.draggingNodeId!==i.draggingNodeId||s.checkedNodeId!==i.checkedNodeId||s.nodeSlot!==i.nodeSlot||s.nodeExpandButtonSlot!==i.nodeExpandButtonSlot?!1:s.defaultExpandHolderPosition===i.defaultExpandHolderPosition);const en=({showEasyView:s,lineSlot:i,lineUseTextPath:e,checkedLineId:t,graphInstanceId:n})=>{const o=$(),{shouldRenderFakeLines:a}=J(),r=s?[]:o.getShouldRenderFakeLines(a);return x.jsxs("div",{className:"rg-lines-container rg-lines-container-el-lines",children:[x.jsx("div",{className:"rg-linetext-container"}),x.jsxs("svg",{className:"rg-lines-svg rg-lines-svg-el-lines",xmlns:"http://www.w3.org/2000/svg",children:[x.jsx(tt,{forElementLines:!0}),!s&&r.map(l=>l.hidden!==!0&&x.jsx(st,{line:l,lineSlot:i,lineUseTextPath:e,checked:l.id===t,graphInstanceId:n},l.id))]})]})},tn=({lineSlot:s,lineUseTextPath:i,graphInstanceId:e})=>{const t=$(),{options:n}=J(),o=t.generateCreatingLineConfig(n);return x.jsxs("div",{className:"rg-lines-container rg-lines-container-el-lines",children:[x.jsx("div",{className:"rg-linetext-container"}),x.jsx("svg",{className:"rg-lines-svg rg-lines-svg-el-lines",xmlns:"http://www.w3.org/2000/svg",children:s?s({lineConfig:o}):x.jsx(it,{lineConfig:o,lineUseTextPath:i,graphInstanceId:e})})]})},nn=({nodeSlot:s,lineSlot:i,nodeExpandButtonSlot:e,showEasyView:t,creatingLine:n,defaultExpandHolderPosition:o,draggingNodeId:a,checkedNodeId:r,checkedLineId:l,graphInstanceId:c,lineUseTextPath:d})=>{const h=$(),{shouldRenderNodes:u,shouldRenderLines:y}=J(),f=I.useMemo(()=>t?[]:h.getShouldRenderNodes(u),[h,u,t]),g=I.useMemo(()=>t?[]:h.getShouldRenderLines(y),[h,y,t]);return x.jsxs("div",{className:"rg-single-graph",children:[x.jsx(at,{graphInstanceId:c,showEasyView:t,lineUseTextPath:d,checkedLineId:l,lineSlot:i,allLineConfigList:g}),x.jsx("div",{className:"rg-nodes-container-wrapper",children:!t&&x.jsx(dt,{defaultExpandHolderPosition:o,draggingNodeId:a,checkedNodeId:r,nodeSlot:s,nodeExpandButtonSlot:e,allNodeConfigList:f})}),x.jsx(en,{graphInstanceId:c,showEasyView:t,lineUseTextPath:d,checkedLineId:l,lineSlot:i}),n&&x.jsx(tn,{lineUseTextPath:d,checkedLineId:l,lineSlot:i})]})},on=s=>{const i=$(),{options:e}=J(),t=I.useRef();return I.useEffect(()=>(C("[RGEasyView mounted]"),i.setEasyViewCanvas(t.current),()=>{C("[RGEasyView UnMounted]")}),[]),x.jsx("div",{className:`rg-easy-view ${e.showEasyView?"rg-easy-view-active":""}`,children:x.jsx("canvas",{ref:t})})},sn=s=>{const i=$(),{options:e}=J();ie();const t=I.useRef(),n=I.useRef(),o=I.useMemo(()=>e.canvasSize,[e.canvasSize]),a=I.useMemo(()=>e.canvasOffset,[e.canvasOffset]),r=I.useMemo(()=>e.canvasZoom/100,[e.canvasZoom]),l={width:`${o.width}px`,height:`${o.height}px`,backgroundColor:"transparent",transform:`translate(${a.x}px, ${a.y}px) scale(${r},${r})`};I.useEffect(()=>(C("[RGCanvas mounted]"),i.setCanvasDom(t.current),()=>{C("[RGCanvas UnMounted]")}),[]);const c=h=>{h.type==="mousedown"&&h.button!==0||i.onCanvasDragStart(h.nativeEvent)},d=h=>{h.preventDefault(),i.onContextmenu(h.nativeEvent)};return x.jsxs("div",{ref:n,className:["rg-map",e.canvasOpacity===1?"rg-map-ready":""].join(" "),onContextMenu:h=>{d(h)},onMouseDown:h=>{c(h)},onTouchStart:h=>{c(h)},children:[x.jsx(on,{}),x.jsx("div",{style:l,className:"rg-map-canvas rg-canvas-behind",children:x.jsx("div",{className:"rg-canvas-slot rg-canvas-slot-behind",children:s.canvasPlugSlot&&(typeof s.canvasPlugSlot=="function"?x.jsx(s.canvasPlugSlot,{}):s.canvasPlugSlot)})}),x.jsx("div",{ref:t,style:l,className:"rg-map-canvas",children:x.jsx(nn,{nodeSlot:s.nodeSlot,lineSlot:s.lineSlot,nodeExpandButtonSlot:s.nodeExpandButtonSlot,showEasyView:e.showEasyView,creatingLine:e.creatingLinePlot&&e.newLinkTemplate.fromNode,defaultExpandHolderPosition:e.defaultExpandHolderPosition,draggingNodeId:e.draggingNodeId,checkedNodeId:e.checkedNodeId,lineUseTextPath:e.lineUseTextPath,checkedLineId:e.checkedLineId,graphInstanceId:e.instanceId})}),x.jsx("div",{style:l,className:"rg-map-canvas rg-canvas-above",children:x.jsx("div",{className:"rg-canvas-slot rg-canvas-slot-above",children:s.canvasPlugAboveSlot})})]})},an=()=>{const s=$(),i=(s==null?void 0:s.options.canvasMoveMode)||!1,e=t=>{s&&s.startMoveCanvas(t.nativeEvent,!0)};return x.jsx("div",{className:`rg-move-operator ${i?"rg-move-operator-active":""}`,children:x.jsx("div",{className:"rg-move-touchpad",onMouseDown:e,onTouchStart:e})})},rn={"icon-quanping":{data:`
|
|
7
|
+
<path d="M921.6 358.4h-76.8V179.2h-179.2V102.4h256v256zM102.4 358.4h76.8V179.2h179.2V102.4H102.4v256z m0 307.2h76.8v179.2h179.2v76.8H102.4V665.6z m819.2 0h-76.8v179.2h-179.2v76.8h256V665.6z"></path>`},"icon-fangda":{data:`
|
|
8
|
+
<path d="M853.333333 480H544V170.666667c0-17.066667-14.933333-32-32-32s-32 14.933333-32 32v309.333333H170.666667c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h309.333333V853.333333c0 17.066667 14.933333 32 32 32s32-14.933333 32-32V544H853.333333c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32z"></path>
|
|
12
9
|
`},"icon-suoxiao":{data:`
|
|
13
|
-
<path d="
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<path d="M131.3 363.3c-19.2 47.3-28.9 97.3-28.9 148.7 0 51.3 9.7 101.3 28.9 148.7 7 17.2 15.1 33.8 24.3 49.7l15.8-49.1 42.8 13.8-39.8 123.8-42.8-13.9-80.9-26 13.8-42.8 52.3 16.8c-98-168.4-74.8-387.9 69.4-532.1C342.4 44.7 586.9 30.5 759.1 158.3l-32.2 32.2c-25.1-18-52.1-32.9-80.9-44.6-47.3-19.2-97.3-28.9-148.7-28.9-51.3 0-101.3 9.7-148.7 28.9-49 19.9-92.9 49.1-130.6 86.8s-66.9 81.7-86.7 130.6z m828.3-60.2l13.8-42.8-80.9-26-42.8-13.8-39.8 123.8 42.8 13.8 15-46.7c9.8 16.6 18.4 34 25.8 52.1 19.2 47.3 28.9 97.3 28.9 148.7 0 51.3-9.7 101.3-28.9 148.7-19.9 49-49.1 92.9-86.8 130.6C768.9 829 725 858.2 676 878.1c-47.3 19.2-97.3 28.9-148.7 28.9-51.3 0-101.3-9.7-148.7-28.9-28.8-11.7-55.9-26.6-80.9-44.6l-32.2 32.2c126.3 93.7 382.6 147.7 572.9-42.6 145.8-145.8 167.9-368.6 66.1-537.7l55.1 17.7zM474 241.2L295 730.4h64.8l50.5-148.2h195.3l54 148.2h70.3L539.6 241.2H474z m-45.9 288.3L479.8 386c11-30.9 19.4-62.1 25.4-93.4 6.9 26 17.9 59.9 32.8 101.5l48.2 135.5H428.1z"></path>
|
|
17
|
-
|
|
10
|
+
<path d="M853.333333 544H170.666667c-17.066667 0-32-14.933333-32-32s14.933333-32 32-32h682.666666c17.066667 0 32 14.933333 32 32s-14.933333 32-32 32z"></path> `},"icon-zidong":{data:`
|
|
11
|
+
<path d="M633.6 467.2 512 467.2l64-352c0-12.8-12.8-12.8-19.2-6.4L211.2 537.6c-6.4 6.4 0 19.2 6.4 19.2l121.6 0-64 352c0 12.8 12.8 12.8 19.2 6.4L640 486.4C646.4 480 646.4 467.2 633.6 467.2z"></path>
|
|
12
|
+
<path d="M793.6 902.4l-38.4 0L736 832 627.2 832l-25.6 70.4L569.6 902.4l89.6-249.6L704 652.8 793.6 902.4zM723.2 806.4l-44.8-121.6-44.8 121.6L723.2 806.4z"></path>
|
|
18
13
|
`},"icon-yuanquanfenxiang":{data:`
|
|
19
14
|
<path d="M751.148705 578.773799c-61.987796 0-117.066229 30.121018-151.388942 76.488045L398.287145 536.382317c1.991354-10.171664 3.046383-20.673855 3.046383-31.419594 0-18.776645-3.196809-36.817534-9.058306-53.621245l193.486736-107.492176c31.949666 58.566884 94.104261 98.391914 165.386748 98.391914 103.803157 0 188.254571-84.450391 188.254571-188.254571S854.951863 65.73105 751.148705 65.73105c-103.804181 0-188.255595 84.450391-188.255595 188.254571 0 14.246469 1.600451 28.125571 4.613064 41.4746L368.032074 406.279167c-29.841655-39.193651-76.976162-64.544015-129.927141-64.544015-90.004897 0-163.228595 73.223698-163.228595 163.228595 0 90.003873 73.223698 163.228595 163.228595 163.228595 60.882626 0 114.078175-33.510208 142.134161-83.049484L575.173808 700.16452c-7.925507 20.788465-12.280698 43.325761-12.280698 66.86385 0 103.803157 84.450391 188.254571 188.255595 188.254571 103.803157 0 188.254571-84.450391 188.254571-188.254571S854.951863 578.773799 751.148705 578.773799zM751.148705 116.89636c75.590606 0 137.089261 61.498656 137.089261 137.089261s-61.498656 137.089261-137.089261 137.089261c-75.591629 0-137.090285-61.498656-137.090285-137.089261S675.557076 116.89636 751.148705 116.89636zM238.105956 617.026008c-61.791321 0-112.063285-50.27094-112.063285-112.063285 0-61.791321 50.27094-112.063285 112.063285-112.063285s112.063285 50.27094 112.063285 112.063285C350.168218 566.755068 299.897278 617.026008 238.105956 617.026008zM751.148705 904.117632c-75.591629 0-137.090285-61.498656-137.090285-137.089261s61.498656-137.089261 137.090285-137.089261c75.590606 0 137.089261 61.498656 137.089261 137.089261S826.739311 904.117632 751.148705 904.117632z"></path>
|
|
20
15
|
|
|
@@ -22,8 +17,7 @@
|
|
|
22
17
|
<path d="M963.66 256.607c0-0.244 0-0.607-0.126-0.851 0-0.369 0-0.614-0.119-0.978 0-0.369-0.119-0.733-0.119-1.104 0-0.244 0-0.487-0.126-0.725 0-0.369-0.119-0.859-0.244-1.222 0-0.244-0.119-0.369-0.119-0.613-0.126-0.365-0.126-0.852-0.245-1.216 0-0.244-0.126-0.369-0.126-0.613-0.119-0.365-0.244-0.734-0.364-1.222-0.126-0.244-0.126-0.49-0.244-0.609l-0.369-1.095c-0.119-0.245-0.119-0.49-0.244-0.734-0.121-0.369-0.245-0.613-0.365-0.978-0.126-0.244-0.244-0.613-0.369-0.851-0.119-0.244-0.238-0.613-0.364-0.859-0.119-0.364-0.244-0.607-0.364-0.977l-0.371-0.734c-0.119-0.364-0.364-0.725-0.487-0.971-0.119-0.245-0.244-0.371-0.364-0.614-0.244-0.364-0.369-0.733-0.614-1.097-0.119-0.126-0.244-0.369-0.364-0.487l-0.733-1.097c-0.119-0.126-0.244-0.369-0.365-0.487-0.244-0.369-0.487-0.733-0.733-0.978-0.126-0.244-0.244-0.369-0.487-0.613-0.245-0.238-0.49-0.607-0.734-0.851-0.244-0.245-0.487-0.49-0.607-0.734-0.244-0.244-0.369-0.487-0.614-0.733-0.851-0.972-1.829-1.83-2.681-2.682-0.245-0.244-0.49-0.369-0.734-0.614-0.244-0.244-0.487-0.487-0.733-0.607-0.245-0.244-0.614-0.487-0.859-0.733-0.238-0.121-0.364-0.365-0.607-0.49-0.365-0.244-0.734-0.487-0.978-0.733-0.119-0.119-0.364-0.244-0.487-0.365l-1.097-0.733c-0.119-0.119-0.364-0.244-0.487-0.364-0.365-0.244-0.734-0.369-1.097-0.614-0.244-0.119-0.369-0.244-0.613-0.364-0.365-0.126-0.734-0.369-0.972-0.487l-0.734-0.369c-0.369-0.121-0.613-0.245-0.977-0.365-0.244-0.126-0.614-0.244-0.859-0.369-0.244-0.119-0.607-0.238-0.851-0.364-0.365-0.119-0.609-0.244-0.978-0.364-0.244-0.126-0.487-0.126-0.733-0.245l-1.097-0.369c-0.244-0.119-0.487-0.119-0.609-0.244-0.369-0.119-0.733-0.244-1.22-0.364-0.245 0-0.371-0.126-0.614-0.126-0.364-0.119-0.851-0.244-1.216-0.244-0.244 0-0.487-0.121-0.613-0.121-0.364-0.126-0.852-0.126-1.222-0.244-0.244 0-0.482-0.126-0.725-0.126-0.369 0-0.734-0.119-1.104-0.119-0.364 0-0.607 0-0.978-0.126-0.244 0-0.607 0-0.851-0.119h-242.407c-21.604 0-39.062 17.456-39.062 39.062 0 21.604 17.458 39.055 39.062 39.055h146.102l-3.171 3.177-217.27 217.265 0.369 0.369-49.676 49.676-155.87-155.87c-7.694-7.689-17.827-11.472-27.953-11.472-10.13-0.126-20.263 3.659-27.952 11.472l-282.446 282.322c-15.258 15.258-15.258 40.041 0 55.298 15.258 15.258 40.033 15.258 55.291 0l255.108-255.11 155.746 155.751c7.813 7.815 17.945 11.593 28.076 11.474 10.126 0.119 20.382-3.659 28.070-11.474l182.964-182.969c0.734-0.734 1.347-1.342 1.956-2.075l111.564-111.564v146.109c0 21.604 17.451 39.060 39.055 39.060s39.062-17.456 39.062-39.060v-235.085c0-0.244 0.126-0.49 0.126-0.614 0-0.244 0.119-0.487 0.119-0.733 0-0.364 0.119-0.734 0.119-1.097s0-0.607 0.126-0.977c0-0.245 0-0.609 0.119-0.852-0.122-1.466-0.122-2.807-0.122-4.030v0zM963.66 256.607z"></path>
|
|
23
18
|
|
|
24
19
|
`},"icon-lianjie_connecting5":{data:`
|
|
25
|
-
<path d="M801.25952 251.74016l-28.9792-28.99968-150.79424 150.8352-35.1232-35.10272-99.14368 99.16416 99.14368 99.16416 99.16416-99.16416-35.10272-35.1232zM487.19872 476.8768l-29.94176 29.94176-19.61984-19.61984-99.16416 99.16416 35.10272 35.1232-150.8352 150.79424 28.95872 28.95872 150.8352-150.79424 35.10272 35.10272 99.14368-99.14368-19.61984-19.64032 29.96224-29.96224-59.92448-59.92448z m-15.48288 44.4416l15.4624-15.4624 30.98624 30.98624-15.4624 15.44192-30.98624-30.96576z"
|
|
26
|
-
fill=""></path>
|
|
20
|
+
<path d="M801.25952 251.74016l-28.9792-28.99968-150.79424 150.8352-35.1232-35.10272-99.14368 99.16416 99.14368 99.16416 99.16416-99.16416-35.10272-35.1232zM487.19872 476.8768l-29.94176 29.94176-19.61984-19.61984-99.16416 99.16416 35.10272 35.1232-150.8352 150.79424 28.95872 28.95872 150.8352-150.79424 35.10272 35.10272 99.14368-99.14368-19.61984-19.64032 29.96224-29.96224-59.92448-59.92448z m-15.48288 44.4416l15.4624-15.4624 30.98624 30.98624-15.4624 15.44192-30.98624-30.96576z"></path>
|
|
27
21
|
`},"icon-ico_reset":{data:`
|
|
28
22
|
<path d="M925.97087933 277.33133334a479.997 479.997 0 1 0 54.33566 255.9984H916.05094133a415.9974 415.9974 0 1 1-64.191599-255.9984h74.047537z"></path>
|
|
29
23
|
<path d="M978.64255033 61.01268534L725.33213333 371.09074734h297.59814z"></path>
|
|
@@ -43,14 +37,248 @@ fill=""></path>
|
|
|
43
37
|
<path d="M513.266174 1024a27.500417 27.500417 0 0 1-19.366491-8.037094L342.260061 864.129619a27.500417 27.500417 0 1 1 38.732981-38.732981L513.266174 957.766602l130.530147-130.336483a27.500417 27.500417 0 0 1 38.732981 38.732982L532.632664 1015.962906a27.403584 27.403584 0 0 1-19.36649 8.037094z"></path>
|
|
44
38
|
|
|
45
39
|
`},"icon-lianjiezhong":{data:`
|
|
46
|
-
<path d="
|
|
40
|
+
<path d="M512 907c-24.852 0-45-20.148-45-45s20.148-45 45-45c168.446 0 305-136.554 305-305S680.446 207 512 207 207 343.554 207 512c0 24.852-20.148 45-45 45S117 536.852 117 512c0-218.152 176.848-395 395-395S907 293.848 907 512 730.152 907 512 907z"></path>
|
|
47
41
|
|
|
48
|
-
`}},K=({iconName:i,className:a})=>{const t=Pe[i];return v.jsx("svg",{className:`rg-icon ${a}`,viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",dangerouslySetInnerHTML:{__html:t.data}})},Ie=()=>{const i=D.useContext($),a=i&&i.options,t=e=>{i.clearLoading()};return v.jsx(v.Fragment,{children:a&&v.jsx("div",{className:`rg-graph-loading ${a.graphLoading?"":"rg-graph-loading-hide"}`,onClick:e=>{t()},children:v.jsxs("div",{className:"rg-graph-loading-message",children:[v.jsx(K,{iconName:"icon-lianjiezhong",className:"rg-graph-loading-icon"}),"Loading..."]})})})},oe=({nodeSlot:i})=>{const a=D.useContext($),t=a&&a.options;return t&&v.jsxs("div",{className:"rg-operate",children:[v.jsxs("div",{className:"rg-creating-container",children:[t.creatingNodePlot&&t.showTemplateNode&&v.jsx(jt,{nodeProps:t.newNodeTemplate,nodeSlot:i}),t.creatingSelection&&v.jsx("div",{className:"rg-selection",style:{transform:`translate(${t.selectionView.x}px, ${t.selectionView.y}px)`,width:t.selectionView.width+"px",height:t.selectionView.height+"px"}})]}),v.jsx(ke,{}),v.jsx(Ie,{})]})},ie=({direction:i="h",positionH:a="left",positionV:t="bottom",children:e})=>{const n=D.useContext($);D.useContext(Q);const o=n&&n.options,s=()=>{n==null||n.toggleAutoLayout()},r=async()=>{n&&(n.setZoom(100),n.moveToCenter(),n.enableCanvasAnimation(),n.zoomToFit(),setTimeout(()=>{n.disableCanvasAnimation()},300))},l=async h=>{await(n==null?void 0:n.zoom(h))},c=async()=>{await(n==null?void 0:n.fullscreen())};return D.useEffect(()=>{},[]),v.jsxs("div",{className:`rg-toolbar rg-xs-toolbar rg-toolbar-h-${a||o.toolBarPositionH} rg-toolbar-v-${t||o.toolBarPositionV} rg-toolbar-${i||o.toolBarDirection}`,children:[v.jsx("div",{title:"Full Screen",className:"rg-mb-button",style:{marginTop:0},onClick:c,children:v.jsx(K,{iconName:"icon-quanping"})}),v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"rg-mb-button",onClick:()=>l(20),children:v.jsx(K,{iconName:"icon-fangda"})}),v.jsx("div",{className:"rg-current-zoom",onClick:r,children:`${Math.round(o.canvasZoom)}%`}),v.jsx("div",{className:"rg-mb-button",style:{marginTop:0},onClick:()=>l(-20),children:v.jsx(K,{iconName:"icon-suoxiao"})})]}),o.layout.supportAutoLayout&&v.jsx("div",{title:o.layout.autoLayouting?"Stop Force Layout":"Start Force Layout",className:`rg-mb-button ${o.layout.autoLayouting?"rg-mb-button-on":""}`,onClick:s,children:o.layout.autoLayouting?v.jsx(K,{iconName:"icon-lianjiezhong",className:"rg-loading-icon"}):v.jsx(K,{iconName:"icon-zidong"})}),e]})},Et=({children:i})=>v.jsx(v.Fragment,{}),wt=({children:i})=>v.jsx(v.Fragment,{}),Dt=({children:i})=>v.jsx(v.Fragment,{}),kt=({children:i})=>v.jsx(v.Fragment,{}),se=i=>({onReady:i.onReady,onNodeClick:i.onNodeClick,onNodeExpand:i.onNodeExpand,onNodeCollapse:i.onNodeCollapse,onLineClick:i.onLineClick,onImageDownload:i.onImageDownload,onImageSaveAsFile:i.onImageSaveAsFile,onNodeDragStart:i.onNodeDragStart,onNodeDragEnd:i.onNodeDragEnd,onNodeDragging:i.onNodeDragging,onCanvasDragEnd:i.onCanvasDragEnd,onCanvasDragging:i.onCanvasDragging,onContextmenu:i.onContextmenu,onFullscreen:i.onFullscreen,onCanvasClick:i.onCanvasClick,onCanvasSelectionEnd:i.onCanvasSelectionEnd,beforeZoomStart:i.beforeZoomStart,onZoomEnd:i.onZoomEnd,onViewResize:i.onViewResize,onResizeStart:i.onResizeStart,beforeNodeResize:i.beforeNodeResize,onResizeEnd:i.onResizeEnd,onLineVertexDropped:i.onLineVertexDropped,beforeCreateLine:i.beforeCreateLine,onLineBeCreated:i.onLineBeCreated,beforeAddNodes:i.beforeAddNodes,beforeAddLines:i.beforeAddLines,onKeyboardDown:i.onKeyboardDown,onKeyboardUp:i.onKeyboardUp,onCanvasDragStart:i.onCanvasDragStart,onForceLayoutFinish:i.onForceLayoutFinish,beforeScrollStart:i.beforeScrollStart}),ae=({children:i})=>v.jsx(v.Fragment,{}),re=i=>{const a=D.useContext($);D.useContext(Q);const t=D.useRef(),[e,n]=D.useState(!1);D.useEffect(()=>{Zt("React"),a.setOptions(i.options);const m=se(i);C("[RelationGraph]mounted:listeners:",m),a.setListeners(m),C("[RelationGraph]setDom:",t.current),a.setDom(t.current),n(!0),a.ready(),a.dataUpdated(),i.initialData&&(C("[RelationGraph] apply data"),a.applyInitialData(i.initialData));const w=b=>{a.onMouseWheel(b)};return t.current.addEventListener("wheel",w,{passive:!1}),()=>{t.current.removeEventListener("wheel",w),a.beforeUnmount()}},[]);const o=a&&a.options;let s,r;const l=[],c=[],h=[],d=[],f=ct.default.Children.toArray(i.children).filter(m=>{if(m&&ct.default.isValidElement(m))if(m.type===be){const w=m.props.children;if(typeof w=="function")s=w;else throw new Error("RGSlotOnNode children must be a function, e.g. <RGSlotOnNode>{ (node: RGNode) => <div>{node.text}</div> }</RGSlotOnNode>")}else if(m.type===Et){const w=m.props.children;if(typeof w=="function")r=w;else throw new Error('RGSlotOnLine children must be a function, e.g. <RGSlotOnLine>{ (line: RGLine) => <g><path d="..." /><text>{line.text}</text></g> }</RGSlotOnLine>')}else{if(m.type===wt)return l.push(m.props.children),!1;if(m.type===Dt)return c.push(m.props.children),!1;if(m.type===kt)return h.push(m.props.children),!1;if(m.type===ae)return d.push(m.props.children),!1}return!0}),p=l,g=h,u=c.concat(...f);if(s&&i.nodeSlot)throw new Error("You can only provide nodeSlot or RGSlotOnNode, but not both.");if(r&&i.lineSlot)throw new Error("You can only provide lineSlot or RGSlotOnLine, but not both.");const x=s||i.nodeSlot,y=r||i.lineSlot,L=i.expandHolderSlot;return v.jsx("div",{ref:t,id:`relation-graph-ins-${o==null?void 0:o.instanceId}`,className:["relation-graph",(o==null?void 0:o.creatingLinePlot)&&"rg-creating-line",o&&!o.selectionMode&&!o.disableDragCanvas?"rg-move-mode":"",o!=null&&o.enableNodeXYAnimation?"rg-enable-node-xy-animation":"",(o==null?void 0:o.enableCanvasTransformAnimation)&&"rg-enable-canvas-animation"].filter(Boolean).join(" "),tabIndex:1,style:{width:"100%",height:o!=null&&o.viewHeight?o==null?void 0:o.viewHeight:"100%",opacity:e?1:0,"--rg-checked-line-bg-color":o==null?void 0:o.checkedItemBackgroundColor},children:e&&o&&v.jsxs(v.Fragment,{children:[o.showDebugPanel&&v.jsx(Te,{}),o.showToolBar&&v.jsx(ie,{}),v.jsx(De,{nodeSlot:x,lineSlot:y,svgDefs:d,canvasPlugSlot:u,canvasPlugAboveSlot:g,expandHolderSlot:L}),v.jsx(oe,{nodeSlot:x}),v.jsx("div",{className:"rg-graph-plugs",children:v.jsx("div",{className:"rg-graph-slot",children:p})})]})})},Ae=$.Provider,Ve=gt.Provider,ze=Q.Provider;var F=(i=>(i.Node="node",i.NodePoint="NodePoint",i.HTMLElementId="HTMLElementId",i.CanvasPoint="CanvasPoint",i.ViewPoint="ViewPoint",i))(F||{}),J=(i=>(i.border="border",i.ltrb="ltrb",i.tb="tb",i.lr="lr",i.left="left",i.right="right",i.top="top",i.bottom="bottom",i))(J||{}),Pt=(i=>(i[i.circle=0]="circle",i[i.rect=1]="rect",i))(Pt||{}),R=(i=>(i[i.StandardStraight=1]="StandardStraight",i[i.StandardCurve=6]="StandardCurve",i[i.Curve2=2]="Curve2",i[i.Curve3=3]="Curve3",i[i.Curve5=5]="Curve5",i[i.Curve7=7]="Curve7",i[i.Curve8=8]="Curve8",i[i.SimpleOrthogonal=4]="SimpleOrthogonal",i[i.StandardOrthogonal=44]="StandardOrthogonal",i[i.HardOrthogonal=49]="HardOrthogonal",i))(R||{}),le=(i=>(i.Left="left",i.Top="top",i.Right="right",i.Bottom="bottom",i))(le||{}),A=(i=>(i.onReady="onReady",i.onNodeClick="onNodeClick",i.onNodeExpand="onNodeExpand",i.onNodeCollapse="onNodeCollapse",i.onLineClick="onLineClick",i.onImageDownload="onImageDownload",i.onImageSaveAsFile="onImageSaveAsFile",i.onNodeDragStart="onNodeDragStart",i.onNodeDragEnd="onNodeDragEnd",i.onNodeDragging="onNodeDragging",i.onCanvasDragEnd="onCanvasDragEnd",i.onCanvasDragging="onCanvasDragging",i.onContextmenu="onContextmenu",i.onFullscreen="onFullscreen",i.onCanvasClick="onCanvasClick",i.onCanvasSelectionEnd="onCanvasSelectionEnd",i.beforeZoomStart="beforeZoomStart",i.onZoomEnd="onZoomEnd",i.onViewResize="onViewResize",i.onResizeStart="onResizeStart",i.beforeNodeResize="beforeNodeResize",i.onResizeEnd="onResizeEnd",i.onLineVertexDropped="onLineVertexDropped",i.beforeCreateLine="beforeCreateLine",i.onLineBeCreated="onLineBeCreated",i.beforeAddNodes="beforeAddNodes",i.beforeAddLines="beforeAddLines",i.onKeyboardDown="onKeyboardDown",i.onKeyboardUp="onKeyboardUp",i.onCanvasDragStart="onCanvasDragStart",i.onForceLayoutFinish="onForceLayoutFinish",i.beforeScrollStart="beforeScrollStart",i))(A||{});const It={id:"rg-newNodeTemplate",x:0,y:0,text:""},xt=(i,a)=>{var e,n;if(i.id===void 0)throw console.log("node must has id:",i),new Error("node must has option[id]:");i.isShow!==void 0&&(i.hidden=!i.isShow,console.warn("[relation-graph Warning] line option[isShow] is deprecated, please use [hidden] instead.")),i.isHide!==void 0&&(i.hidden=i.isHide,console.warn("[relation-graph Warning] line option[isHide] is deprecated, please use [hidden] instead."));const t={id:i.id,text:i.text!==void 0?i.text:"",type:i.type!==void 0?i.type:"node",targetType:i.targetType!==void 0?i.targetType:F.Node,expanded:i.expanded!==void 0?i.expanded:!0,selected:i.selected!==void 0?i.selected:!1,dragging:!1,className:i.className!==void 0?i.className:"",nodeShape:i.nodeShape!==void 0?i.nodeShape:1,borderWidth:i.borderWidth!==void 0?i.borderWidth:void 0,borderRadius:i.borderRadius!==void 0?i.borderRadius:void 0,borderColor:i.borderColor!==void 0?i.borderColor:void 0,fontColor:i.fontColor!==void 0?i.fontColor:void 0,fontSize:i.fontSize!==void 0?i.fontSize:void 0,color:i.color!==void 0?i.color:void 0,opacity:i.opacity!==void 0?i.opacity:void 0,fixed:i.fixed!==void 0?i.fixed:!1,width:i.width!==void 0?i.width:void 0,height:i.height!==void 0?i.height:void 0,force_weight:i.force_weight,x:i.x!==void 0?i.x:0,y:i.y!==void 0?i.y:0,Fx:0,Fy:0,expandHolderPosition:i.expandHolderPosition!==void 0?i.expandHolderPosition:void 0,disablePointEvent:i.disablePointEvent!==void 0?i.disablePointEvent:void 0,disableDrag:i.disableDrag!==void 0?i.disableDrag:!1,hidden:i.hidden!==void 0?i.hidden:!1,rgCalcedVisible:!0,rgShouldRender:!0,zIndex:i.zIndex||0,data:i.data!==void 0?i.data:{}};return t.lot={childs:[],parent:void 0,eached:!1,strength:0},t.el={offsetWidth:((e=i.el)==null?void 0:e.offsetWidth)||50,offsetHeight:((n=i.el)==null?void 0:n.offsetHeight)||50},t.width&&(t.el.offsetWidth=t.width),t.height&&(t.el.offsetHeight=t.height),t},Be=["Fx","Fy","appended","dragging","el","targetFrom","targetNodes","targetTo","lot","seeks_id","shouldRender","rgCalcedVisible","rgShouldRender","origin_x","origin_y","selected"],bt=i=>{if(!i)return;const a={};return Object.keys(i).forEach(t=>{if(!Be.includes(t)){const e=i[t];e!==void 0&&(t==="offset_x"&&e===0||t==="offset_y"&&e===0||t==="zIndex"&&e===0||t==="fixed"&&e===!1||t==="className"&&e===""||t==="hidden"&&e===!1||t==="disableDrag"&&e===!1||t==="expanded"&&e===!0||t==="opacity"&&e===1||t==="type"&&e==="node"||t==="targetType"&&e===F.Node||t==="data"&&(!e||Object.keys(e).length===0)||(a[t]=e))}}),a},Xe=Object.freeze(Object.defineProperty({__proto__:null,newNodeTemplate:It,json2Node:xt,transNodeToJson:bt,default:{json2Node:xt,transNodeToJson:bt}},Symbol.toStringTag,{value:"Module"}));let Ct={x:0,y:0};const _t={x:0,y:0},ot={x:0,y:0};let At,Vt;const zt=i=>{const a={clientX:0,clientY:0};if(nt(i)){const t=i.touches||i.targetTouches;if(!t)throw new Error("error targetTouches");a.clientX=t[0].clientX,a.clientY=t[0].clientY}else a.clientX=i.clientX,a.clientY=i.clientY;return a},Z={startDrag(i,a,t,e){e?At=(n,o,s)=>{const r=n-ot.x,l=o-ot.y;e(r,l,_t,ot,s)}:At=(n,o)=>{Ct.x=_t.x+(n-ot.x),Ct.y=_t.y+(o-ot.y)},Vt=t,Ct=a,_t.x=Ct.x,_t.y=Ct.y;try{const n=zt(i);ot.x=n.clientX,ot.y=n.clientY,nt(i)?(document.body.addEventListener("touchmove",Z.onNodeMove),document.body.addEventListener("touchend",Z.onNodeDragend),document.body.addEventListener("mousemove",Z.onNodeMove),document.body.addEventListener("mouseup",Z.onNodeDragend),i.preventDefault()):(document.body.addEventListener("mousemove",Z.onNodeMove),document.body.addEventListener("mouseup",Z.onNodeDragend))}catch(n){console.error(n.message)}},onNodeMove(i){const a=zt(i);At(a.clientX,a.clientY,i)},onNodeDragend(i){if(nt(i)?(document.body.removeEventListener("touchmove",Z.onNodeMove),document.body.removeEventListener("touchend",Z.onNodeDragend),document.body.removeEventListener("mousemove",Z.onNodeMove),document.body.removeEventListener("mouseup",Z.onNodeDragend)):(document.body.removeEventListener("mousemove",Z.onNodeMove),document.body.removeEventListener("mouseup",Z.onNodeDragend)),Vt){const a=zt(i),t=a.clientX,e=a.clientY,n=t-ot.x,o=e-ot.y;Vt(n,o,i)}}},ht=i=>{if(i.from===void 0)throw console.log("error,line must has option[from](nodeId):",i),new Error("error,line must has option[from]:");if(i.to===void 0)throw console.log("error,line must has option[to](nodeId):",i),new Error("error,line must has option[to]:");if(typeof i.from!="string")throw console.log("error line from, must be string(nodeId):",i),new TypeError("error line from, must be string:");if(typeof i.to!="string")throw console.log("error line to, must be string(nodeId):",i),new TypeError("error line to, must be string:");return i.isShow!==void 0&&(i.hidden=!i.isShow,console.warn("[relation-graph Warning] line option[isShow] is deprecated, please use [hidden] instead.")),i.isHide!==void 0&&(i.hidden=i.isHide,console.warn("[relation-graph Warning] line option[isHide] is deprecated, please use [hidden] instead.")),i.placeText!==void 0&&(i.onPathStartOffset=i.placeText,console.warn("[relation-graph Warning] line option[placeText] is deprecated, please use [onPathStartOffset] instead.")),{id:i.id,from:i.from,to:i.to,type:i.type!==void 0?i.type:"line",isFakeLine:i.isFakeLine!==void 0?i.isFakeLine:!1,fromType:i.fromType!==void 0?i.fromType:i.isFakeLine?F.CanvasPoint:F.Node,toType:i.toType!==void 0?i.toType:i.isFakeLine?F.CanvasPoint:F.Node,selected:!1,text:i.text!==void 0?i.text:"",textOffset_x:i.textOffset_x!==void 0?i.textOffset_x:void 0,textOffset_y:i.textOffset_y!==void 0?i.textOffset_y:void 0,color:i.color!==void 0?i.color:void 0,opacity:i.opacity!==void 0?i.opacity:void 0,fontSize:i.fontSize!==void 0?i.fontSize:void 0,fontColor:i.fontColor!==void 0?i.fontColor:void 0,lineWidth:i.lineWidth!==void 0?i.lineWidth:void 0,lineShape:i.lineShape!==void 0?i.lineShape:void 0,className:i.className!==void 0?i.className:void 0,animation:i.animation!==void 0?i.animation:0,dashType:i.dashType!==void 0?i.dashType:0,disablePointEvent:i.disablePointEvent!==void 0?i.disablePointEvent:!1,showStartArrow:i.showStartArrow!==void 0?i.showStartArrow:!1,showEndArrow:i.showEndArrow!==void 0?i.showEndArrow:!0,useTextPath:i.useTextPath!==void 0?i.useTextPath:void 0,onPathStartOffset:i.onPathStartOffset!==void 0?i.onPathStartOffset:void 0,startMarkerId:i.startMarkerId||"",endMarkerId:i.endMarkerId||"",textAnchor:i.textAnchor!==void 0?i.textAnchor:void 0,junctionOffset:i.junctionOffset,fromJunctionPoint:i.fromJunctionPoint,toJunctionPoint:i.toJunctionPoint,fromJuctionPointOffsetX:i.fromJuctionPointOffsetX||0,fromJuctionPointOffsetY:i.fromJuctionPointOffsetY||0,toJuctionPointOffsetX:i.toJuctionPointOffsetX||0,toJuctionPointOffsetY:i.toJuctionPointOffsetY||0,lineRadius:i.lineRadius,force_elastic:i.force_elastic,polyLineStartDistance:i.polyLineStartDistance,ctrlPointsFor49:i.ctrlPointsFor49,ctrlPointsFor44:i.ctrlPointsFor44,ctrlPoints:i.ctrlPoints,lineDirection:i.lineDirection!==void 0?i.lineDirection:void 0,reverseText:i.reverseText!==void 0?i.reverseText:void 0,forDisplayOnly:i.forDisplayOnly||i.from===i.to,hidden:i.hidden!==void 0?i.hidden:!1,cssVars:i.cssVars!==void 0?i.cssVars:void 0,data:i.data!==void 0?i.data:{}}},Fe=["arrow","reverseText","isReverse","selected","shouldRender","rgCalcedVisible"],Bt=i=>{if(!i)return;const a={};return Object.keys(i).forEach(t=>{if(!Fe.includes(t)){const e=i[t];e!==void 0&&(t==="isFakeLine"&&e===!1||t==="fromType"&&e===F.Node||t==="toType"&&e===F.Node||t==="animation"&&e===0||t==="dashType"&&e===0||t==="disablePointEvent"&&e===!1||t==="showStartArrow"&&e===!1||t==="showEndArrow"&&e===!0||t==="startMarkerId"&&e===""||t==="endMarkerId"&&e===""||t==="forDisplayOnly"&&e===!1||t==="fromJuctionPointOffsetX"&&e===0||t==="fromJuctionPointOffsetY"&&e===0||t==="toJuctionPointOffsetX"&&e===0||t==="toJuctionPointOffsetY"&&e===0||t==="opacity"&&e===1||t==="hidden"&&e===!1||t==="data"&&(!e||Object.keys(e).length===0)||(a[t]=i[t]))}}),a},Ot=(i,a)=>{if(!i)return;const t=Bt(i.line);t&&a.push(t)},Ge=Object.freeze(Object.defineProperty({__proto__:null,json2Line:ht,transLineToJson:Bt,transLinkToJson:Ot,default:{json2Line:ht,transLinkToJson:Ot}},Symbol.toStringTag,{value:"Module"}));function He(i,a,t,e,n,o,s,r,l){const c=n-i,h=o-a,d=Math.sqrt(c*c+h*h);if(d===0)return{x:i,y:a};const f=l*h/d,p=-(l*c)/d,g=i+f,u=a+p,x=i-t/2,y=i+t/2,L=a-e/2,m=a+e/2;let w=[];if(c!==0){let N=(x-g)/c,O=u+N*h;O>=L&&O<=m&&w.push({x,y:O});let E=(y-g)/c,T=u+E*h;T>=L&&T<=m&&w.push({x:y,y:T})}if(h!==0){let N=(L-u)/h,O=g+N*c;O>=x&&O<=y&&w.push({x:O,y:L});let E=(m-u)/h,T=g+E*c;T>=x&&T<=y&&w.push({x:T,y:m})}if(w.length===0&&c===0&&h===0)return{x:g,y:u};let b=null,M=1/0;return w.forEach(N=>{const O=Math.sqrt((N.x-n)**2+(N.y-o)**2);O<M&&(M=O,b=N)}),b}const j={getRectPoint(i,a,t,e,n,o,s,r,l=!1,c=1,h=0,d=14,f=!1){const p=i+n/2,g=a+o/2,u=t+s/2,x=e+r/2;if(c>1){const E=Math.min(d,n,o),T=-E/2,k=E/(c-1),P=l&&f||!l&&!f?T*-1-h*k:T+h*k,_=He(p,g,n,o,u,x,s,r,P);if(_)return _}const y=p<u?1:-1,L=g<x?1:-1;if(x===g)return{x:p+y*n/2,y:g};const m=Math.abs((u-p)/(x-g)),w=n/o;let b=0,M=0;m<w?(b=y*o/2*m,M=L*o/2):(b=y*n/2,M=L*n/2/m);const N=p+b,O=g+M;return{x:N,y:O}},getRectPointBasic(i,a,t,e,n,o,s,r){const l=i+n/2,c=a+o/2,h=t+s/2,d=e+r/2;let f=d===c?0:(h-l)/(d-c);f===0&&d===c&&h===l?f=1:f===0&&(f=(h-l)/(d-c+(d>c?-1:1)*1e-4));const p=n/o;let g=0,u=0,x="1";return Math.abs(f)<p?(x="2",c<=d?(u=o/2,g=u*f):(u=-o/2,g=u*f)):(x="3",l<=h?(g=n/2,u=f===0&&h===l?0:g/f):(g=-n/2,u=f===0&&h===l?0:g/f)),{x:l+g,y:c+u,_case:x}},getRectJoinPoint(i){const{from_x:a,from_y:t,to_x:e,to_y:n,f_W:o,f_H:s,t_W:r,t_H:l}=i,c=a+o/2,h=t+s/2,d=e+r/2,f=n+l/2,p=Math.atan2(f-h,d-c)*180/Math.PI,g=p<0?p+360:p;return g>45&&g<=135?{x:a+o+5,y:t+s/2}:g>135&&g<=225?{x:a+o/2,y:t+s+5}:g>225&&g<=315?{x:a-5,y:t+s/2}:{x:a+o/2,y:t-5}},getRectHJoinPoint(i){const{from_x:a,from_y:t,to_x:e,f_W:n,f_H:o,t_W:s}=i,r=o/2;return a+n<e?{x:a+n+5,y:t+r}:{x:a-5,y:t+r}},getRectLeftJoinPoint(i){const{from_x:a,from_y:t,f_H:e}=i;return{x:a,y:t+e/2}},getRectRightJoinPoint(i){const{from_x:a,from_y:t,f_W:e,f_H:n}=i;return{x:a+e,y:t+n/2}},getRectTopJoinPoint(i){const{from_x:a,from_y:t,f_W:e}=i;return{x:a+e/2,y:t}},getRectBottomJoinPoint(i){const{from_x:a,from_y:t,f_W:e,f_H:n}=i;return{x:a+e/2,y:t+n}},getRectHorizontalLineJoinPoint(i){const{from_x:a,from_y:t,f_W:e,f_H:n,to_x:o,t_W:s}=i;return{x:o+s/2,y:t+n/2}},getRectVJoinPoint(i){const{from_x:a,from_y:t,to_y:e,f_W:n,f_H:o,t_H:s}=i,r=n/2;return t+o<e?{y:t+o+5,x:a+r}:{y:t-5,x:a+r}},getBorderPoint(i,a,t,e,n,o,s,r,l){return l===0?this.getCirclePoint(i,a,t,e,n,o,s,r):this.getRectPoint(i,a,t,e,n,o,s,r)},getBorderPoint4MultiLine(i){const{from_x:a,from_y:t,to_x:e,to_y:n,f_W:o,f_H:s,t_W:r,t_H:l,nodeShape:c,isReverse:h=!1,isEndPoint:d,totalLinesBetweenNodes:f=1,currentLineIndex:p=0,lineDistance:g=50}=i;return c===0?this.getCirclePoint4MultiLine(a,t,e,n,o,s,r,l,h,f,p,g,d):this.getRectPoint(a,t,e,n,o,s,r,l,h,f,p,g,d)},getCirclePoint(i,a,t,e,n,o,s,r){const l=t+s/2,c=e+r/2,h=i+n/2,d=a+o/2,f=l-h;if(f===0)return{x:h,y:d-o/2*(c<d?1:-1)};const g=(c-d)/f,u=Math.sqrt(1/(1/(n/2)**2+g**2/(o/2)**2))*(l<h?1:-1),x=g*u;return{x:h-u,y:d-x}},getCirclePoint4MultiLine(i,a,t,e,n,o,s,r,l,c,h,d,f){let p=t+s/2;const g=e+r/2;let u=i+n/2;const x=a+o/2;let y=p-u;y>-1&&y<1&&(p=p-.5,u=u+.5,y=-1);let m=0;if(c>1){const P=Math.min(d,n,o),_=-P/2,X=P/(c-1);m=l&&f||!l&&!f?_*-1-h*X:_+h*X}const w=g-x,b=Math.sqrt(y**2+w**2)*m/y,M=w/y,N=n/2,O=o/2,E=u<p?-1:1,T=(-1*N**2*M*b+N*O*Math.sqrt(Math.abs(O**2+M**2*N**2-b**2))/E)/(O**2+N**2*M**2),k=M*T+b;return{x:u-T,y:x-k}},getCirclePointBasic(i,a,t,e,n,o,s,r,l){const c=i+n/2,h=a+o/2,d=t+s/2,f=e+r/2,p=d-c,g=f-h,u=Math.sqrt(p*p+g*g),x=u-l,y=x*p/u*-1,L=x*g/u*-1;return{x:d+y,y:f+L}},getCirclePointPlus(i,a,t,e,n,o,s,r){const l=i+n/2,c=a+o/2,h=t+s/2,d=e+r/2,f=h-l,p=d-c,g=Math.sqrt(f*f+p*p),u=(g-n/2)*f/g*-1,x=(g-o/2)*p/g*-1;return{x:h+u,y:d+x}},getOvalPoint(i,a,t,e,n,o=180){const s=e*(360/n),r=(180-o+s)*Math.PI/180;return{x:i+t*Math.sin(r),y:a+t*Math.cos(r)*-1}},getAngleType(i,a){if(i>=0&&a>=0)return 1;if(i<0&&a>=0)return 2;if(i<0&&a<0)return 3;if(i>=0&&a<0)return 4},getTextAngle(i,a,t,e){let n=Math.atan2(e-a,t-i)*180/Math.PI;return n<0&&(n+=360),n>90&&n<=270&&(n+=180),n>=360&&(n-=360),Math.round(n)}},ut=(i,a,t,e)=>{const n=i-t,o=a-e;return Math.sqrt(n**2+o**2)};class pt{constructor(a,t,e){S(this,"graphOptions");S(this,"layoutOptions");S(this,"graphInstance");S(this,"allNodes",[]);S(this,"isMainLayouer",!0);S(this,"requireLinks",!1);S(this,"allLinks",[]);S(this,"rootNode");this.layoutOptions=a,this.graphOptions=t,this.graphInstance=e}setLinks(a){C("setLinks:",a.length),this.allLinks=a}placeNodes(a,t){this.allNodes=a,this.rootNode=t}doLayout(a,t){this.placeNodes(a,t)}analysisNodes(a,t,e,n){t.length>n.max_length&&(n.max_length=t.length),e>n.max_deep&&(n.max_deep=e);const o={level:e,all_size:t.length,all_strength:0};e===0&&t.forEach(r=>{r.lot.parent=void 0});const s=[];for(const r of t){a.includes(r)||(r.lot.level=e,a.push(r));for(const l of this.graphInstance.getNodeRelatedNodes(r))a.includes(l)||(a.push(l),l.lot.parent=r,r.lot.childs.push(l),s.push(l))}o.all_strength>n.max_strength&&(n.max_strength=o.all_strength),s.length>0&&this.analysisNodes(a,s,e+1,n)}generateCalcNodes(a){const t=[],e=new Map;for(const n of a){const o={rgNode:n,x:n.x,y:n.y,width:n.el.offsetWidth,height:n.el.offsetHeight};t.push(o),e.set(n.id,o)}return{calcNodes:t,calcNodeMap:e}}generateLevels(a){const t=[],e=new Map;for(const n of a){if(!n.lot||typeof n.lot.level!="number")continue;const o=n.lot.level;t.includes(o)||(t.push(o),e.set(o,[])),e.get(o).push(n)}return t.sort((n,o)=>n-o),{levels:t,levelNodesMap:e}}adjustNodePositions(a,t,e){if(!a||a.length===0)return[];for(let n=1;n<a.length;n++){const o=a[n],s=a[n-1];switch(t){case"right":o.x<s.x+s.width+e&&(o.x=s.x+s.width+e);break;case"left":o.x+o.width>s.x-e&&(o.x=s.x-o.width-e);break;case"bottom":o.y<s.y+s.height+e&&(o.y=s.y+s.height+e);break;case"top":o.y+o.height>s.y-e&&(o.y=s.y-o.height-e);break}}return a}getReverseAlignItems(a){return $e[a]}}const $e={start:"end",end:"start",center:"center"};class yt extends pt{constructor(t,e,n){super(t,e,n);S(this,"layoutOptions");S(this,"fastStart",!1);S(this,"skipInitLayout",!1);S(this,"maxLayoutTimes",300);S(this,"byNode",!0);S(this,"byLine",!0);S(this,"lockX",!1);S(this,"lockY",!1);S(this,"force_node_repulsion",1);S(this,"force_line_elastic",1);S(this,"stopWhenBalanced",!1);S(this,"calcNodes",[]);S(this,"_graphEventHandler");S(this,"layoutTimes",0);S(this,"prev10",[]);S(this,"visibleNodes",[]);S(this,"_onFinishCallback");S(this,"_onTickCallback");S(this,"calcNodeMap",new WeakMap);S(this,"forCalcNodes",[]);S(this,"recentGraphVelocity",[]);S(this,"graphVelocityBalancedValue",.1);S(this,"animationFrameTimer",0);S(this,"prevNodeLevel1Index",0);S(this,"prevNodeLevel2Index",0);S(this,"maxVaildLineLength",300);S(this,"minVaildLineLength",30);S(this,"zeroEffectNodeDistance",400);S(this,"minNodeDistance",30);S(this,"maxMoveSpeed",100);S(this,"n2nMaxForce",50);this.layoutOptions=t,this.layoutOptions.fastStart!==void 0&&(this.fastStart=this.layoutOptions.fastStart),this.layoutOptions.maxLayoutTimes!==void 0&&(this.maxLayoutTimes=this.layoutOptions.maxLayoutTimes),this.layoutOptions.byNode!==void 0&&(this.byNode=this.layoutOptions.byNode),this.layoutOptions.byLine!==void 0&&(this.byLine=this.layoutOptions.byLine),this.layoutOptions.force_node_repulsion!==void 0&&(this.force_node_repulsion=this.layoutOptions.force_node_repulsion),this.layoutOptions.force_line_elastic!==void 0&&(this.force_line_elastic=this.layoutOptions.force_line_elastic),this.layoutOptions.force_x_coefficient===void 0&&(this.layoutOptions.force_x_coefficient=1),this.layoutOptions.force_y_coefficient===void 0&&(this.layoutOptions.force_y_coefficient=1),this.layoutOptions.disableLiveChanges===void 0&&(this.layoutOptions.disableLiveChanges=!1),this.layoutOptions.stopWhenBalanced&&(this.stopWhenBalanced=!0),this.layoutOptions.skipInitLayout!==void 0&&(this.skipInitLayout=this.layoutOptions.skipInitLayout),this.requireLinks=!0}placeNodes(t,e){if(C("!!!RGForceLayouter.placeNodes"),this.calcNodes=t,this.allNodes.length===0&&(this.allNodes=t),this.rootNode=e,this.fastStart)C("!!!initNodesPosition fastStart"),this.calcNodes.forEach(n=>{n.fixed!==!0&&((!n.lot||!n.lot.placed)&&((Number.isNaN(n.x)||n.x===void 0)&&(n.x=Math.floor(Math.random()*200)-100),(Number.isNaN(n.y)||n.y===void 0)&&(n.y=Math.floor(Math.random()*200)-100),n!==e&&n.x===0&&n.y===0&&(n.x=Math.floor(Math.random()*200)-100,n.y=Math.floor(Math.random()*200)-100)),n.lot.placed=!0)});else if(!this.skipInitLayout){if(C("!!!initNodesPosition....."),e){C("layout by root:",e),(Number.isNaN(e.x)||e.x===void 0)&&(e.x=0,e.y=0);const n=this.easyAnalysisNodes(e);e.fixed||this.layoutOptions.fixedRootNode||(e.x=0,e.y=0);const o=this.layoutOptions.centerOffset_x||0,s=this.layoutOptions.centerOffset_y||0,r=z.getNodeLotXY({alignItemsX:"center",alignItemsY:"center"},e);e.lot.x=r.x+o,e.lot.y=r.y+s,this.easyPlaceRelativePosition(e,n),C("!!!initNodesPosition fixedRootNode:2:",e.x,e.y),n.forEach(l=>{l.fixed!==!0&&(!l.rgCalcedVisible||l!==e&&(l.x=l.lot.x-z.getNodeWidth(l)/2,l.y=l.lot.y-z.getNodeHeight(l)/2,l.lot.placed=!0))})}}if(this.allNodes.forEach(n=>{(Number.isNaN(n.x)||n.x===void 0)&&(n.x=0),(Number.isNaN(n.y)||n.y===void 0)&&(n.y=0)}),C("Start Auto Layout....."),this.updateVisibleNodes(),this.isMainLayouer&&this.layoutOptions.autoLayouting){C("!!!autoLayouting.....");return}this.start()}easyAnalysisNodes(t){this.allNodes.forEach(o=>{o.lot.eached=!1,o.lot.notLeafNode=!1,o.lot.childs=[],o.lot.parent=void 0,o.lot.index_of_parent=0,o.lot.strength=0,o.lot.placed=!1});const e=[],n={max_deep:1,max_length:1,max_strength:1};return this.analysisNodes4Didirectional(e,[t],0,n,0),e}easyPlaceRelativePosition(t,e){e.forEach(o=>{if(o.lot.subling.level===1){const s=o.lot.subling;if(s){const r=j.getOvalPoint(t.lot.x,t.lot.y,s.level*50,o.lot.strength_plus-o.lot.strength/2,s.all_strength,this.layoutOptions.startAngle);o.lot.x=r.x,o.lot.y=r.y}}}),e.forEach(o=>{const s=o.lot.subling;if(s&&s.level>1){const r=o.lot.parent.lot.strength_plus-o.lot.parent.lot.strength,c=(o.lot.parent.lot.strength_plus-r)/(o.lot.parent.lot.childs.length+1)*(o.lot.index_of_parent+1),h=j.getOvalPoint(t.lot.x,t.lot.y,(s.level-1)*(100+(s.level-1)*60)+50,r+c,o.lot.parent.lot.subling.all_strength,this.layoutOptions.startAngle);o.lot.x=h.x,o.lot.y=h.y}})}graphEventHandle(t,...e){if(t===A.onNodeDragStart){const n=e[0],o=this.calcNodeMap.get(n);o&&(o.dragging=!0)}else if(t===A.onNodeDragging){const n=e[0],o=e[1],s=e[2],r=this.calcNodeMap.get(n);r&&(r.x=o,r.y=s)}else if(t===A.onNodeDragEnd){const n=e[0],o=this.calcNodeMap.get(n);o&&(o.dragging=!1)}}connectToGraphInstance(){this._graphEventHandler=this.graphEventHandle.bind(this),this.graphInstance.addEventHandler(this._graphEventHandler)}disConnectToGraphInstance(){this.graphInstance.removeEventHandler(this._graphEventHandler)}updateVisibleNodes(t){this.visibleNodes=[],t&&(this.allNodes=t),this.allNodes.forEach(e=>{e.lot?e.lot.placed=!0:(C("node miss lot:",e.text),e.lot={x:e.x,y:e.y,placed:!0,childs:[]}),this.visibleNodes.push(e)}),this.resetCalcNodes(),C("visibleNodes:",this.visibleNodes.length)}viewUpdate(){this.graphInstance&&this.graphInstance.dataUpdated()}autoLayout(t=!1){this.layoutTimes=0,this.updateVisibleNodes(),C("Layout set viewUpdate:",this.viewUpdate),this.isMainLayouer&&(this.layoutOptions.autoLayouting=!0),this.doForceLayout(0)}onFinish(t){this._onFinishCallback=t}onTick(t){this._onTickCallback=t}applyFBuffToNodes(){for(const t of this.forCalcNodes)this.applyToNodePosition(t)}applyPositionToNodes(){this.visibleNodes.forEach(t=>{if(t.fixed)return;const e=this.calcNodeMap.get(t);e&&(t.x=e.x,t.y=e.y)}),this.viewUpdate()}layoutFinished(){cancelAnimationFrame(this.animationFrameTimer),this.isMainLayouer&&(this.layoutOptions.autoLayouting=!1),C("Layout finished"),this.applyFBuffToNodes(),this.applyPositionToNodes(),this.disConnectToGraphInstance();try{this._onFinishCallback&&this._onFinishCallback()}catch(t){console.error(t)}}resetCalcNodes(){C("resetCalcNodes:",this.visibleNodes.length),this.forCalcNodes=[],this.calcNodeMap=new WeakMap,this.visibleNodes.forEach(t=>{const e={rgNode:t,Fx:0,Fy:0,x:t.x,y:t.y,dragging:t.dragging||!1,force_weight:t.force_weight||1,forceCenterOffset_X:(t.width||t.el.offsetWidth||60)/2,forceCenterOffset_Y:(t.height||t.el.offsetHeight||60)/2,fixed:t.fixed||!1};this.forCalcNodes.push(e),this.calcNodeMap.set(t,e)})}start(){if(this.layoutOptions.autoLayouting){C("stop layout:already autoLayouting");return}this.connectToGraphInstance(),this.autoLayout(!0)}doForceLayout(t){if(this.graphOptions.instanceDestroyed){C("stop layout:instanceDestroyed"),this.layoutFinished();return}let e="0";t>0?(this.prev10.length>=10&&(this.prev10.splice(0,1),e=(1e3/((this.prev10[this.prev10.length-1]-this.prev10[0])/10)).toFixed(1)),this.prev10.push(t)):this.visibleNodes.length===0&&this.updateVisibleNodes(),this.layoutTimes++,this.calcNodesPosition(),this.applyFBuffToNodes(),this._onTickCallback&&this._onTickCallback(),this.layoutOptions.disableLiveChanges||this.layoutTimes%2===0&&this.applyPositionToNodes(),C("this.layoutTimes:",this.layoutTimes,"of",this.maxLayoutTimes,"Current refresh rate:",e,"Hz",this.visibleNodes.length),this.layoutTimes<=this.maxLayoutTimes?this.animationFrameTimer=requestAnimationFrame(this.doForceLayout.bind(this)):this.layoutFinished()}calcNodesPosition(){if(this.byNode)for(let t=this.prevNodeLevel1Index;t<this.forCalcNodes.length;t++){const e=this.forCalcNodes[t];if(!e.dragging&&!e.fixed){for(let n=this.prevNodeLevel2Index;n<this.forCalcNodes.length;n++)if(t!==n){const o=this.forCalcNodes[n];if(o.dragging)continue;this.addGravityByNode(e,o)}}}if(this.byLine){if(this.allLinks&&this.allLinks.length>0){for(const t of this.allLinks)if(!t.forDisplayOnly){let e=t.line.force_elastic===void 0?1:t.line.force_elastic;if(this.visibleNodes.includes(t.fromNode)&&this.visibleNodes.includes(t.toNode)){const n=this.calcNodeMap.get(t.fromNode),o=this.calcNodeMap.get(t.toNode);this.addElasticByLine(n,o,e)}}}else for(const t of this.visibleNodes)if(t.lot&&t.lot.parent){const e=this.calcNodeMap.get(t.lot.parent),n=this.calcNodeMap.get(t);this.addElasticByLine(e,n,1)}}return!0}stop(){C("[RGForceLayouter]stop:",this.layoutOptions.autoLayouting),this.layoutTimes=Number.MAX_VALUE,this.layoutFinished()}addElasticByLine(t,e,n=1){const o=t.x,s=t.y,r=e.x,l=e.y;let c=Math.sqrt((s-l)**2+(o-r)**2);if(c<this.minVaildLineLength)return;c>this.maxVaildLineLength&&(c=this.maxVaildLineLength);const h=(c-this.minVaildLineLength)*.05*this.force_line_elastic*n,d=h,f=h,p=(o-r)/c,g=(s-l)/c;this.addFtoNode(t,p*d*-1,g*d*-1),this.addFtoNode(e,p*f,g*f)}addGravityByNode(t,e,n=1){const o=t.x,s=t.y,r=e.x,l=e.y;if(n===1&&(Math.abs(o-r)>this.zeroEffectNodeDistance||Math.abs(s-l)>this.zeroEffectNodeDistance))return;const c=Math.sqrt((s-l)**2+(o-r)**2);if(n===1&&c>this.zeroEffectNodeDistance)return;let h=(this.zeroEffectNodeDistance-c)*.05*this.force_node_repulsion*n;c<this.minNodeDistance&&(h=h*2);const d=(o-r)/c,f=(s-l)/c;this.addFtoNode(t,d*h,f*h)}addFtoNode(t,e,n){if(t.fixed||t.dragging||Number.isNaN(e)||Number.isNaN(n))return;e>this.n2nMaxForce&&(e=this.n2nMaxForce),n>this.n2nMaxForce&&(n=this.n2nMaxForce),e<-this.n2nMaxForce&&(e=-this.n2nMaxForce),n<-this.n2nMaxForce&&(n=-this.n2nMaxForce);const o=t.force_weight||1;this.lockX||(t.Fx+=e*(1/o)),this.lockY||(t.Fy+=n*(1/o))}applyToNodePosition(t){if(t.fixed)return 0;if(t.dragging){const o=t.rgNode;return o.x=t.x,o.y=t.y,0}if(this.calcNodes!==this.allNodes&&!this.calcNodes.includes(t.rgNode))return 0;let e=t.Fx,n=t.Fy;if(e>this.maxMoveSpeed&&(e=this.maxMoveSpeed),n>this.maxMoveSpeed&&(n=this.maxMoveSpeed),e<-this.maxMoveSpeed&&(e=-this.maxMoveSpeed),n<-this.maxMoveSpeed&&(n=-this.maxMoveSpeed),t.x=t.x+e*this.layoutOptions.force_x_coefficient,t.y=t.y+n*this.layoutOptions.force_y_coefficient,!this.layoutOptions.disableLiveChanges){const o=t.rgNode;o.x=t.x,o.y=t.y}t.Fx=0,t.Fy=0}analysisNodes4Didirectional(t,e,n,o,s){e.length>o.max_length&&(o.max_length=e.length),n>o.max_deep&&(o.max_deep=n);const r={level:n,all_size:e.length,all_strength:0},l=[];e.forEach(h=>{h.lot||(h.lot={childs:[]}),h.lot.eached=!0,h.lot.subling=r,h.lot.level=n,t.push(h)});let c=0;e.forEach(h=>{let d=0;if(s===0){let f=0;this.graphInstance.getNodeRelatedNodes(h).forEach(p=>{p.lot||(p.lot={eached:!1,childs:[]}),p.lot.eached||(p.rgCalcedVisible?(p.lot.eached=!0,p.lot.parent=h,p.lot.index_of_parent=f++,h.lot.childs.push(p),l.push(p),d++):h.lot.childs.push(p))})}else if(s===-1){let f=0;this.graphInstance.getNodeRelatedNodes4From(h).forEach(p=>{p.lot||(p.lot={eached:!1,childs:[]}),p.lot.eached||(p.rgCalcedVisible?(p.lot.eached=!0,p.lot.parent=h,p.lot.index_of_parent=f++,h.lot.childs.push(p),l.push(p),d++):h.lot.childs.push(p))})}else{let f=0;this.graphInstance.getNodeRelatedNodes4To(h).forEach(p=>{p.lot||(p.lot={eached:!1,childs:[]}),p.lot.eached||(p.rgCalcedVisible?(p.lot.eached=!0,p.lot.parent=h,p.lot.index_of_parent=f++,h.lot.childs.push(p),l.push(p),d++):h.lot.childs.push(p))})}h.lot.strength=d>0?d:1,r.all_strength+=h.lot.strength,h.lot.strength_plus=r.all_strength,h.lot.index_of_level=c,h.lot.childs_size=d,c++}),r.all_strength>o.max_strength&&(o.max_strength=r.all_strength),l.length>0?this.analysisNodes4Didirectional(t,l,n+(s===-1?-1:1),o,s):(t.forEach(h=>{h.lot.childs_size>0&&(h.lot.strengthWithChilds=0)}),t.forEach(h=>{h.lot.childs_size===0&&(h.lot.strengthWithChilds=1,z.conductStrengthToParents(h))}),z.analysisDataTree([t[0]],0,s))}}class ce extends pt{constructor(t,e,n){super(t,e,n);S(this,"enableGatherNodes",!1);S(this,"layoutOptions");this.layoutOptions=t,C("new RGTreeLayouter:",this.layoutOptions),this.layoutOptions.from||(this.layoutOptions.from="left"),this.layoutOptions.levelGaps||(this.layoutOptions.levelGaps=[]);const o=this.layoutOptions.from;console.log("this.layoutOptions.alignItemsX:1:",this.layoutOptions.alignItemsX),o==="top"||o==="bottom"?(this.layoutOptions.treeNodeGapH||(this.layoutOptions.treeNodeGapH=10),this.layoutOptions.treeNodeGapV||(this.layoutOptions.treeNodeGapV=50)):(this.layoutOptions.treeNodeGapH||(this.layoutOptions.treeNodeGapH=50),this.layoutOptions.treeNodeGapV||(this.layoutOptions.treeNodeGapV=10)),o==="top"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="center"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="start"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.layoutOptions.alignItemsX),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.getReverseAlignItems(this.layoutOptions.alignItemsY))):o==="bottom"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="center"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="end"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.layoutOptions.alignItemsX),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.getReverseAlignItems(this.layoutOptions.alignItemsY))):o==="right"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="end"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="center"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.getReverseAlignItems(this.layoutOptions.alignItemsX)),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.layoutOptions.alignItemsY)):(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="end"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="center"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.getReverseAlignItems(this.layoutOptions.alignItemsX)),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.layoutOptions.alignItemsY)),console.log("this.layoutOptions.alignItemsX:2:",this.layoutOptions.alignItemsX),this.layoutOptions.ignoreNodeSize===void 0&&(this.layoutOptions.ignoreNodeSize=!1);const s=this.layoutOptions.layoutExpansionDirection,r=s==="start"||s==="left"||s==="top"?"start":s==="end"||s==="right"||s==="bottom"?"end":"center";this.layoutOptions.layoutExpansionDirection=r,this.layoutOptions.levelDistance&&console.error("Error: levelDistance is not support\uFF0C Please use levelGaps or treeNodeGapH,treeNodeGapV option in layoutOptions"),this.enableGatherNodes=this.layoutOptions.enableGatherNodes}analysisNodes4Didirectional(t,e,n,o,s){C(`${s} level ${n} size: ${e.length}`),e.length>o.max_length&&(o.max_length=e.length),n>o.max_deep&&(o.max_deep=n);const r={level:n,all_size:e.length,all_strength:0},l=[];e.forEach(h=>{h.lot||(h.lot={childs:[]}),h.lot.eached=!0,h.lot.subling=r,h.lot.level=n,t.push(h)});let c=0;e.forEach(h=>{let d=0,f;n===0?s===-1?f=this.graphInstance.getNodeRelatedNodes4From(h):s===1?f=this.graphInstance.getNodeRelatedNodes4To(h):f=this.graphInstance.getNodeRelatedNodes(h):f=this.graphInstance.getNodeRelatedNodes(h);let p=0;f.forEach(g=>{g.lot||(g.lot={eached:!1,childs:[]}),g.lot.eached||(g.lot.parent=h,z.isVisibleNode(g)?(g.lot.eached=!0,g.lot.index_of_parent=p++,h.lot.childs.push(g),l.push(g),d++):h.lot.childs.push(g))}),h.lot.strength=d>0?d:1,r.all_strength+=h.lot.strength,h.lot.strength_plus=r.all_strength,h.lot.index_of_level=c,h.lot.childs_size=d,c++}),r.all_strength>o.max_strength&&(o.max_strength=r.all_strength),l.length>0?this.analysisNodes4Didirectional(t,l,n+(s===-1?-1:1),o,s):(t.forEach(h=>{h.lot.childs_size>0&&(h.lot.strengthWithChilds=0)}),t.forEach(h=>{h.lot.childs_size===0&&(h.lot.strengthWithChilds=1,z.conductStrengthToParents(h))}),z.analysisDataTree([t[0]],0,s===-1?-1:1))}placeNodes(t,e){if(console.log("tree:placeNodes:rootNode",e.id,e),C("RGTreeLayouter:placeNodes"),e)C("layout by root:",e);else{console.error("root is null");return}C("allNodes:",t.length);const n={alignItemsX:this.layoutOptions.alignItemsX,alignItemsY:this.layoutOptions.alignItemsY},o={alignItemsX:this.layoutOptions.alignParentItemsX,alignItemsY:this.layoutOptions.alignParentItemsY};this.rootNode=e;let s=[];this.allNodes&&this.allNodes.length>0?(s.push(this.rootNode),z.getDescendantNodes(this.rootNode,s),C("groupNodes:1:",s.length)):s=t,s.forEach(d=>{d.lot.eached=!1,d.lot.notLeafNode=!1,d.lot.childs=[],d.lot.parent=void 0,d.lot.index_of_parent=0,d.lot.strength=0,d.lot.strengthWithChilds_from=0,d.lot.strengthWithChilds=0,d.lot.placed=!1}),this.allNodes=t;let r={max_deep:1,max_length:1,max_strength:1};s=[],this.analysisNodes(s,[this.rootNode],0,r),s.forEach(d=>{d.lot.eached=!1,d.lot.notLeafNode=!1,d.lot.childs=[],d.lot.index_of_parent=0,d.lot.strength=0,d.lot.strengthWithChilds_from=0,d.lot.strengthWithChilds=0,d.lot.placed=!1}),e.fixed||this.layoutOptions.fixedRootNode||(e.x=0,e.y=0);const l=this.layoutOptions.centerOffset_x||0,c=this.layoutOptions.centerOffset_y||0,h=z.getNodeLotXY(n,e);e.lot.x=h.x+l,e.lot.y=h.y+c,C("groupNodes:2:",s.length,s.map(d=>d.text).join(",")),s=[],r={max_deep:1,max_length:1,max_strength:1},this.layoutOptions.simpleTree===!0?(this.analysisNodes4Didirectional(s,[this.rootNode],0,r,0),this.placeNodesPosition(this.rootNode,s,r)):(this.analysisNodes4Didirectional(s,[this.rootNode],0,r,-1),C("groupNodes:L:",s.length),this.placeNodesPosition(this.rootNode,s,r),s=[],r={max_deep:1,max_length:1,max_strength:1},this.analysisNodes4Didirectional(s,[this.rootNode],0,r,1),C("groupNodes:R:",s.length),this.placeNodesPosition(this.rootNode,s,r)),this.allNodes.forEach(d=>{if(d.fixed===!0){d.lot.placed=!0;return}if(!!z.isVisibleNode(d)){if(Number.isNaN(d.lot.x)&&(C("bad lot x:",d.text,d.lot.x),d.lot.x=0),Number.isNaN(d.lot.y)&&(C("bad lot y:",d.text,d.lot.y),d.lot.y=0),d!==e){const f=d.lot.level<0?o:n;d.x=z.getNodeXByLotX(f,d),d.y=z.getNodeYByLotY(f,d)}d.lot.placed=!0}}),C("create rootNode coordinates:1",e.x,e.y)}placeNodesPosition(t,e,n){t.lot.placed=!0,this.placeRelativePosition(t,e,n)}placeRelativePosition(t,e,n){const o=this.layoutOptions.layoutExpansionDirection;if(this.layoutOptions.from==="top"||this.layoutOptions.from==="bottom"){const s=this.layoutOptions.treeNodeGapH||20,r=this.layoutOptions.treeNodeGapV||20,{levels:l,levelNodesMap:c}=this.generateLevels(e),h=new Map;for(const u of l){const x=c.get(u);h.set(u,Math.max(...x.map(y=>y.el.offsetHeight)))}let d=0,f=0;for(const u of e){const x=u.el.offsetWidth;d+=x,f++}const g=d/f+s;e.forEach(u=>{u.fixed!==!0&&u.lot.placed!==!0&&u!==t&&(this.layoutOptions.from==="bottom"?u.lot.y=t.lot.y-this.getLevelDistance(u.lot.level,h,r+10):u.lot.y=t.lot.y+this.getLevelDistance(u.lot.level,h,r+10))}),e.forEach(u=>{u.fixed!==!0&&u.lot.level!==0&&(o==="start"?u.lot.x=t.lot.x-g*u.lot.strengthWithChilds_from:o==="end"?u.lot.x=t.lot.x+g*u.lot.strengthWithChilds_from:u.lot.x=t.lot.x+g*(n.max_strength/-2+u.lot.strengthWithChilds_from+u.lot.strengthWithChilds/2))}),this.applyNodesGap(e,"v"),this.gatherNodes(e,"v",g)}else{const s=this.layoutOptions.treeNodeGapH||20,r=this.layoutOptions.treeNodeGapV||20,{levels:l,levelNodesMap:c}=this.generateLevels(e),h=new Map;for(const u of l){const x=c.get(u);h.set(u,Math.max(...x.map(y=>y.el.offsetWidth)))}let d=0,f=0;for(const u of e){const x=u.el.offsetHeight;d+=x,f++}if(f===0)return;const g=d/f+r;e.forEach(u=>{u.fixed!==!0&&u.lot.placed!==!0&&u!==t&&(this.layoutOptions.from==="right"?u.lot.x=t.lot.x-this.getLevelDistance(u.lot.level,h,s+50):u.lot.x=t.lot.x+this.getLevelDistance(u.lot.level,h,s+50))}),e.forEach(u=>{u.fixed!==!0&&u.lot.level!==0&&(o==="start"?u.lot.y=t.lot.y-g*u.lot.strengthWithChilds_from:o==="end"?u.lot.y=t.lot.y+g*u.lot.strengthWithChilds_from:u.lot.y=t.lot.y+g*(n.max_strength/-2+u.lot.strengthWithChilds_from+u.lot.strengthWithChilds/2))}),console.log("levelMaxWidthMap:",t.id,h),this.applyNodesGap(e,"h"),this.gatherNodes(e,"h",g)}}getLevelDistance(t,e,n){if(t===0)return 0;if(t>0){let o=0;for(let s=0;s<t;s++)o+=e.get(s)+this.getLevelGap(s,n);return o}else{let o=0;for(let s=0;s>t;s--)o+=e.get(s)+this.getLevelGap(s,n);return-o}}getLevelGap(t,e){var o;let n=e;if(((o=this.layoutOptions.levelGaps)==null?void 0:o.length)>0){const s=this.layoutOptions.levelGaps[Math.abs(t)];s&&(n=s)}return n}applyNodesGap(t,e){if(this.layoutOptions.ignoreNodeSize)return;const n={alignItemsX:this.layoutOptions.alignItemsX,alignItemsY:this.layoutOptions.alignItemsY},o={alignItemsX:this.layoutOptions.alignParentItemsX,alignItemsY:this.layoutOptions.alignParentItemsY},s=this.layoutOptions.layoutExpansionDirection,{levels:r,levelNodesMap:l}=this.generateLevels(t),c=new Map;for(const f of r){const p=l.get(f);c.set(f,Math.max(...p.map(g=>g.el.offsetWidth)))}const{calcNodes:h,calcNodeMap:d}=this.generateCalcNodes(t);h.forEach(f=>{const p=f.rgNode.lot.level<0?o:n;f.x=z.getNodeXByLotX(p,f.rgNode),f.y=z.getNodeYByLotY(p,f.rgNode),f.width=f.rgNode.el.offsetWidth,f.height=f.rgNode.el.offsetHeight,f.buffY=0});for(const f of r){const p=l.get(f)||[];if(e==="h")if(s==="end"){p.sort((u,x)=>u.lot.y-x.lot.y);const g=p.map(u=>d.get(u.id));this.adjustNodePositions(g,"bottom",this.layoutOptions.treeNodeGapV);for(const u of g){const x=u.rgNode.lot.level<0?o:n;u.rgNode.lot.y=z.getNodeLotXY(x,u).y}}else{p.sort((u,x)=>x.lot.y-u.lot.y);const g=p.map(u=>d.get(u.id));this.adjustNodePositions(g,"top",this.layoutOptions.treeNodeGapV);for(const u of g){const x=u.rgNode.lot.level<0?o:n;u.rgNode.lot.y=z.getNodeLotXY(x,u).y}}else if(s==="end"){p.sort((u,x)=>u.lot.x-x.lot.x);const g=p.map(u=>d.get(u.id));this.adjustNodePositions(g,"right",this.layoutOptions.treeNodeGapH);for(const u of g){const x=u.rgNode.lot.level<0?o:n,y=z.getNodeLotXY(x,u);u.rgNode.lot.x=y.x}}else{p.sort((u,x)=>x.lot.x-u.lot.x);const g=p.map(u=>d.get(u.id));this.adjustNodePositions(g,"left",this.layoutOptions.treeNodeGapH);for(const u of g){const x=u.rgNode.lot.level<0?o:n;u.rgNode.lot.x=z.getNodeLotXY(x,u).x}}console.log("levelNodes:",f,p)}if(e==="h"){const f=new Map,p=new Map;for(const m of r){const b=l.get(m).map(M=>d.get(M.id));f.set(m,Math.max(...b.map(M=>M.width))),p.set(m,Math.min(...b.map(M=>M.x)))}const g=this.layoutOptions.treeNodeGapH;let u=r.filter(m=>m>0).sort((m,w)=>m-w),x=r.filter(m=>m<0).sort((m,w)=>w-m),y=1;this.layoutOptions.from==="right"&&([x,u]=[u,x],y=-1);let L=0;for(const m of u){const w=m-y,b=p.get(w),M=f.get(w),N=p.get(m)+L;f.get(m);const O=b+M+g;if(O>N){const E=O-N;console.log("[xxxxx]move",w,m,O,N,E),L=E;const T=l.get(m);for(const k of T)k.lot.x+=L;p.set(m,N+E)}else console.log("[xxxxx]goon",w,m,O,N),p.set(m,N)}L=0;for(const m of x){const w=m+y,b=p.get(w);f.get(w);const M=p.get(m)+L,N=f.get(m),O=b-g;if(M+N>O){const E=O-(M+N);L=E;const T=l.get(m);for(const k of T)k.lot.x+=L;p.set(m,M+E)}else p.set(m,M)}}else{const f=new Map,p=new Map;for(const m of r){const b=l.get(m).map(M=>d.get(M.id));f.set(m,Math.max(...b.map(M=>M.height))),p.set(m,Math.min(...b.map(M=>M.y)))}const g=this.layoutOptions.treeNodeGapV;let u=r.filter(m=>m>0).sort((m,w)=>m-w),x=r.filter(m=>m<0).sort((m,w)=>w-m),y=1;this.layoutOptions.from==="bottom"&&([x,u]=[u,x],y=-1);let L=0;for(const m of u){const w=m-y,b=p.get(w),M=f.get(w),N=p.get(m)+L;f.get(m);const O=b+M+g;if(O>N){const E=O-N;console.log("[xxxxx]move",w,m,O,N,E),L=E;const T=l.get(m);for(const k of T)k.lot.y+=L;p.set(m,N+E)}else console.log("[xxxxx]goon",w,m,O,N),p.set(m,N)}L=0;for(const m of x){const w=m+y,b=p.get(w);f.get(w);const M=p.get(m)+L,N=f.get(m),O=b-g;if(M+N>O){const E=O-(M+N);L=E;const T=l.get(m);for(const k of T)k.lot.y+=L;p.set(m,M+E)}else p.set(m,M)}}}gatherNodes(t,e,n){if(!this.enableGatherNodes)return;const{calcNodes:o,calcNodeMap:s}=this.generateCalcNodes(t);o.forEach(l=>{l.movedNodeSizeBefore=1,l.movedNodeSizeAfter=1});const{levelNodesMap:r}=this.generateLevels(t);t.forEach(l=>{if(l.fixed!==!0&&l.lot.level!==0){const c=r.get(l.lot.level)||[];if(l.lot.strengthWithChilds===1&&l.lot.childs_size<=1){const h=this.getBloomingNearByParent(l,l.lot.parent,c,e);if(h){const d=s.get(l.id);e==="h"?l.lot.y-h.lot.y>0?(l.lot.y=h.lot.y+n*d.movedNodeSizeAfter,d.movedNodeSizeAfter++):(l.lot.y=h.lot.y-n*d.movedNodeSizeBefore,d.movedNodeSizeBefore++):l.lot.x-h.lot.x>0?(l.lot.x=h.lot.x+n*d.movedNodeSizeAfter,d.movedNodeSizeAfter++):(l.lot.x=h.lot.x-n*d.movedNodeSizeBefore,d.movedNodeSizeBefore++)}}}})}getBloomingNearByParent(t,e,n,o){let s=9999,r;for(const l of n)if(l.lot.childs_size>1&&l.lot.parent===e){const c=o==="h"?l.lot.y-e.lot.y:l.lot.x-e.lot.x;Math.abs(c)<s&&(s=Math.abs(c),r=l)}if(r&&r!==t)return r}}class he extends yt{constructor(t,e,n){super(t,e,n);S(this,"layoutOptions");this.layoutOptions=t}placeNodes(t,e){if(C("RGCenterLayouter:placeNodes"),!e){C("root is null:",e);return}C("layout by root:",e),this.allNodes=t,this.calcNodes=t,this.rootNode=e,t.forEach(h=>{h.lot.eached=!1,h.lot.notLeafNode=!1,h.lot.childs=[],h.lot.parent=void 0,h.lot.index_of_parent=0,h.lot.strength=0,h.lot.placed=!1});let n=[],o={max_deep:1,max_length:1,max_strength:1};if(this.analysisNodes(n,[this.rootNode],0,o),n=[],o={max_deep:1,max_length:1,max_strength:1},this.analysisNodes4Didirectional(n,[this.rootNode],0,o,0),this.layoutOptions.genLotInfoOnly){C("only gen lot info, return"),t.forEach(h=>{h.lot.placed=!0});return}e.fixed||this.layoutOptions.fixedRootNode||(e.x=0,e.y=0);const s={alignItemsX:this.layoutOptions.alignItemsX||"center",alignItemsY:this.layoutOptions.alignItemsY||"center"},r=this.layoutOptions.centerOffset_x||0,l=this.layoutOptions.centerOffset_y||0,c=z.getNodeLotXY(s,e);e.lot.x=c.x+r,e.lot.y=c.y+l,C("root position:",e.lot.x,e.lot.y),this.placeRelativePosition(this.rootNode,n,o),n.forEach(h=>{if(h.fixed!==!0&&!!h.rgCalcedVisible){if(h!==e){const d=s;h.x=z.getNodeXByLotX(d,h),h.y=z.getNodeYByLotY(d,h)}h.lot.placed=!0}})}getLevelDistanceArr(){let t=[];if(this.layoutOptions.levelDistance&&(Array.isArray(this.layoutOptions.levelDistance)?t=this.layoutOptions.levelDistance:console.error("Error levelDistance, levelDistance must is Array"),t.length>0&&t.length<10))for(let e=t.length;e<10;e++)t.push(t[t.length-1]);return t}getLevelR(t,e){if(t.length===0)return;let n=0;for(let o=0;o<e;o++)n+=t[o]||t[t.length-1];return n}placeRelativePosition(t,e,n){const o=this.layoutOptions.distance_coefficient===void 0?1:this.layoutOptions.distance_coefficient,s=this.getLevelDistanceArr(),r=Math.min(this.graphOptions.viewSize.height,this.graphOptions.viewSize.width)*.4;let l=Math.min(Math.max(r,150),400)*o;C("analyticResult:",this.layoutOptions,n,r,l,o,s);let c=0;e.forEach(d=>{const f=d.lot.subling;if(f&&f.level===1){c=Math.round(f.all_size*60/Math.PI/2),c<l&&(c=l);const p=this.getLevelR(s,f.level)||f.level*c,g=j.getOvalPoint(t.lot.x,t.lot.y,p,d.lot.strength_plus-d.lot.strength/2,f.all_strength,this.layoutOptions.startAngle);d.lot.x=g.x,d.lot.y=g.y}});const h=Math.round(300*o);e.forEach(d=>{const f=d.lot.subling;if(f&&f.level>1){const p=d.lot.parent.lot.strength_plus-d.lot.parent.lot.strength,u=(d.lot.parent.lot.strength_plus-p)/(d.lot.parent.lot.childs_size+1)*(d.lot.index_of_parent+1),x=this.getLevelR(s,f.level)||(f.level-1)*h+c,y=j.getOvalPoint(t.lot.x,t.lot.y,x,p+u,d.lot.parent.lot.subling.all_strength,this.layoutOptions.startAngle);d.lot.x=y.x,d.lot.y=y.y}})}}class de extends yt{constructor(a,t,e){super(a,t,e)}refresh(){this.placeNodes(this.allNodes,this.rootNode)}placeNodes(a,t){if(t)C("layout by root:",t);else{C("root is null:",t);return}this.allNodes=a,this.rootNode=t,a.forEach(c=>{c.lot.eached=!1,c.lot.notLeafNode=!1,c.lot.childs=[],c.lot.parent=void 0,c.lot.index_of_p_childs=0,c.lot.strength=0}),t.fixed||this.layoutOptions.fixedRootNode||(t.x=0,t.y=0);const e={alignItemsX:this.layoutOptions.alignItemsX||"center",alignItemsY:this.layoutOptions.alignItemsY||"center"},n=this.layoutOptions.centerOffset_x||0,o=this.layoutOptions.centerOffset_y||0,s=z.getNodeLotXY(e,t);t.lot.x=s.x+n,t.lot.y=s.y+o;const r=this.allNodes.length;let l=r*90/Math.PI/2;l<200&&(l=200),l>800&&(l=800),this.allNodes.forEach((c,h)=>{const d=j.getOvalPoint(t.lot.x,t.lot.y,l,h,r);c.lot.x=d.x,c.lot.y=d.y}),this.allNodes.forEach(c=>{if(c.fixed!==!0&&!!c.rgCalcedVisible){if(c===t){const h=e;c.x=z.getNodeXByLotX(h,c),c.y=z.getNodeYByLotY(h,c)}c.lot.placed=!0}})}}class fe extends pt{constructor(t,e,n){super(t,e,n);S(this,"graphOptions");S(this,"layoutOptions");S(this,"allNodes",[]);S(this,"__origin_nodes",[]);this.layoutOptions=t,this.graphOptions=e}placeNodes(t,e){if(e)C("layout by root:",e);else{C("root is null:",e);return}C("allNodes:",t.length),this.__origin_nodes=t,this.rootNode=e,t.forEach(o=>{o.lot.eached=!1,o.lot.notLeafNode=!1,o.lot.childs=[],o.lot.parent=void 0,o.lot.index_of_parent=0,o.lot.strength=0,o.lot.placed=!1,o.x||(o.x=0),o.y||(o.y=0),Number.isNaN(o.x)&&(o.x=0),Number.isNaN(o.y)&&(o.y=0)}),this.allNodes=[];const n={max_strength:1,max_deep:1,max_length:1};this.analysisNodes(this.allNodes,[this.rootNode],0,n),C("[layout canvasOffset]",this.graphOptions.viewSize,this.graphOptions.canvasSize)}}class Re extends pt{constructor(t,e,n){super(t,e,n);S(this,"graphInstance");S(this,"layoutOptions");S(this,"levelDistanceArr",[]);this.layoutOptions=t,C("new RGSmartTreeLayouter:",this.layoutOptions),this.layoutOptions.from||(this.layoutOptions.from="left"),this.layoutOptions.levelDistance&&(Array.isArray(this.layoutOptions.levelDistance)?this.levelDistanceArr=this.layoutOptions.levelDistance:console.error("Error levelDistance, levelDistance must is Array")),this.requireLinks=!0,this.graphInstance=n}analysisNodes4Didirectional(t,e,n,o){this.analysisBothWay(t,e,n,o);const s={};t.forEach(c=>{const h=c.lot.level+"";s[h]||(s[h]=[]),s[h].push(c),c.lot.subling={level:c.lot.level,all_size:0,all_strength:0}}),t.forEach(c=>{const h=c.lot.level+"",d=s[h],f=d.length;c.lot.index_of_level=d.indexOf(c),c.lot.subling.all_size=f,c.lot.subling.all_strength+=c.lot.strength||1,c.lot.strength_plus=c.lot.subling.all_strength}),t.forEach(c=>{c.lot.childs_size>0&&(c.lot.strengthWithChilds=0)}),t.forEach(c=>{c.lot.childs_size===0&&(c.lot.strengthWithChilds=1,z.conductStrengthToParents(c))});const r=Object.keys(s).map(c=>Number.parseInt(c)).sort(),l=c=>{const h=c+"",d=s[h];let f=0;d.forEach(p=>{p.lot.parent&&f<p.lot.parent.lot.strengthWithChilds_from&&(f=p.lot.parent.lot.strengthWithChilds_from),c===0?f+=1:p.lot.strengthWithChilds_from=f,C("levels:",c,f,p.text,p.lot.strengthWithChilds),f+=p.lot.strengthWithChilds})};[0].forEach(l),r.filter(c=>c>0).forEach(l),r.filter(c=>c<0).forEach(l)}analysisBothWay(t,e,n,o){C(`level ${n} size: ${e.length}`),e.length>o.max_length&&(o.max_length=e.length),n>o.max_deep&&(o.max_deep=n);const s={level:n,all_size:e.length,all_strength:0};e.forEach(l=>{l.lot||(l.lot={childs:[]}),l.lot.eached=!0,l.lot.subling=s,l.lot.level=n,t.push(l)});let r=0;e.forEach(l=>{let c=0,h=0,d=[];this.graphInstance.getNodeRelatedNodes4From(l).forEach(f=>{f.lot||(f.lot={eached:!1,childs:[]}),f.lot.eached||(f.lot.parent=l,f.rgCalcedVisible?(f.lot.eached=!0,f.lot.index_of_parent=h++,l.lot.childs.push(f),d.push(f),c++):l.lot.childs.push(f))}),this.analysisBothWay(t,d,n-1,o),d=[],this.graphInstance.getNodeRelatedNodes4To(l).forEach(f=>{f.lot||(f.lot={eached:!1,childs:[]}),f.lot.eached||(f.lot.parent=l,f.rgCalcedVisible?(f.lot.eached=!0,f.lot.index_of_parent=h++,l.lot.childs.push(f),d.push(f),c++):l.lot.childs.push(f))}),this.analysisBothWay(t,d,n+1,o),l.lot.strength=c>0?c:1,s.all_strength+=l.lot.strength,l.lot.strength_plus=s.all_strength,l.lot.index_of_level=r,l.lot.childs_size=c,r++}),s.all_strength>o.max_strength&&(o.max_strength=s.all_strength)}placeNodes(t,e){if(C("RGSmartTreeLayouter:placeNodes"),e)C("layout by root:",e);else{console.error("root is null");return}this.rootNode=e,this.allNodes=t,C("allNodes:",t.length),t.forEach(c=>{c.lot.eached=!1,c.lot.notLeafNode=!1,c.lot.childs=[],c.lot.parent=void 0,c.lot.index_of_parent=0,c.lot.strength=0,c.lot.strengthWithChilds_from=0,c.lot.strengthWithChilds=0,c.lot.placed=!1});let n=[],o={max_deep:1,max_length:1,max_strength:1};this.analysisNodes(n,[this.rootNode],0,o),n=[],o={max_deep:1,max_length:1,max_strength:1},this.analysisNodes4Didirectional(n,[this.rootNode],0,o),this.placeNodesPosition(this.rootNode,n,o),C("allNodes:",n.length),this.allNodes.forEach(c=>{if(c.fixed===!0){c.lot.placed=!0;return}!c.rgCalcedVisible||(Number.isNaN(c.lot.x)&&(C("bad lot x:",c.text,c.lot.x),c.lot.x=0),Number.isNaN(c.lot.y)&&(C("bad lot y:",c.text,c.lot.y),c.lot.y=0),c.x=z.getNodeXByLotX(this.layoutOptions,c),c.y=z.getNodeYByLotY(this.layoutOptions,c),c.lot.placed=!0)}),C("create rootNode coordinates:1",e.x,e.y);const s=n.filter(c=>c.lot.level===0),r=[];this.allLinks.forEach(c=>{s.includes(c.fromNode)&&!s.includes(c.toNode)&&r.push(c.toNode),s.includes(c.toNode)&&!s.includes(c.fromNode)&&r.push(c.fromNode)}),r.forEach(c=>{c.fixed=!0}),s.push(...r);const l=new yt({layoutName:"force",maxLayoutTimes:100,force_node_repulsion:.1,force_line_elastic:1,fixedRootNode:!0},this.graphOptions,this.graphInstance);l.isMainLayouer=!1,l.requireLinks=!0,this.layoutOptions.from==="left"||this.layoutOptions.from==="right"?l.lockX=!0:l.lockY=!0,l.visibleNodes=s,l.setLinks(this.allLinks),l.resetCalcNodes(),l.doForceLayout(0)}placeNodesPosition(t,e,n){t.fixed||this.layoutOptions.fixedRootNode||(t.x=0,t.y=0);const o=this.layoutOptions.centerOffset_x||0,s=this.layoutOptions.centerOffset_y||0,r=z.getNodeLotXY(childrenTreeAlign,t);t.lot.x=r.x+o,t.lot.y=r.y+s,t.lot.placed=!0,this.placeRelativePosition(t,e,n)}placeRelativePosition(t,e,n){const o=this.graphOptions.viewSize;if(this.layoutOptions.from==="left"||this.layoutOptions.from==="right"){const s=at(this.layoutOptions.min_per_height)||80,r=at(this.layoutOptions.max_per_height)||400,l=at(this.layoutOptions.min_per_width)||430,c=at(this.layoutOptions.max_per_width)||650;let h=Math.round((o.width-10)/(n.max_deep+2));h<l&&(h=l),h>c&&(h=c);let d=Math.round(o.height/(n.max_strength+1));d<s&&(d=s),d>r&&(d=r),e.forEach(f=>{f.fixed!==!0&&f.lot.placed!==!0&&f!==t&&(this.layoutOptions.from==="right"?f.lot.x=t.lot.x-this.getLevelDistance(f,f.lot.subling.level,h):f.lot.x=t.lot.x+this.getLevelDistance(f,f.lot.subling.level,h))}),e.forEach(f=>{f.fixed!==!0&&(f.lot.level===0?f!==t&&(f.lot.y=t.lot.y+d*f.lot.index_of_level):f.lot.y=t.lot.y+d*(n.max_strength/-2+f.lot.strengthWithChilds_from+f.lot.strengthWithChilds/2))})}else{const s=at(this.layoutOptions.min_per_height)||350,r=at(this.layoutOptions.max_per_height)||400,l=at(this.layoutOptions.min_per_width)||250,c=at(this.layoutOptions.max_per_width)||500;let h=Math.round((o.width-10)/(n.max_strength+2));h<l&&(h=l),h>c&&(h=c);let d=Math.round((o.height-10)/(n.max_deep+2));d<s&&(d=s),d>r&&(d=r),e.forEach(f=>{f.fixed!==!0&&f.lot.placed!==!0&&f!==t&&(this.layoutOptions.from==="bottom"?f.lot.y=t.lot.y-this.getLevelDistance(f,f.lot.subling.level,d):f.lot.y=t.lot.y+this.getLevelDistance(f,f.lot.subling.level,d))}),e.forEach(f=>{f.fixed!==!0&&f.lot.level!==0&&(f.lot.x=t.lot.x+h*(n.max_strength/-2+f.lot.strengthWithChilds_from+f.lot.strengthWithChilds/2))})}}getLevelDistance(t,e,n){const o=Math.abs(e);if(this.levelDistanceArr&&this.levelDistanceArr.length>0){let s=0;for(let r=0;r<o;r++){const l=this.levelDistanceArr[r]||100;s+=l}return e>0?s:s*-1}else return e*n}}class ge extends pt{constructor(t,e,n){super(t,e,n);S(this,"enableGatherNodes",!1);S(this,"layoutOptions");this.layoutOptions=t,C("new RGFolderLayouter:",this.layoutOptions),this.layoutOptions.from||(this.layoutOptions.from="left"),this.layoutOptions.treeNodeGapH||(this.layoutOptions.treeNodeGapH=10),this.layoutOptions.treeNodeGapV||(this.layoutOptions.treeNodeGapV=10),this.layoutOptions.levelGaps||(this.layoutOptions.levelGaps=[]),this.layoutOptions.bottomJuctionPointOffsetX===void 0&&(this.layoutOptions.bottomJuctionPointOffsetX=-50);const o=this.layoutOptions.from;o==="top"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="center"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="start"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.layoutOptions.alignItemsX),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.getReverseAlignItems(this.layoutOptions.alignItemsY))):o==="bottom"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="center"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="end"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.layoutOptions.alignItemsX),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.getReverseAlignItems(this.layoutOptions.alignItemsY))):o==="right"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="end"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="center"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.getReverseAlignItems(this.layoutOptions.alignItemsX)),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.layoutOptions.alignItemsY)):(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="end"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="center"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.getReverseAlignItems(this.layoutOptions.alignItemsX)),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.layoutOptions.alignItemsY)),this.layoutOptions.levelDistance&&console.error("Error: levelDistance is not support\uFF0C Please use levelGaps, treeNodeGapH, treeNodeGapV option in layoutOptions"),this.enableGatherNodes=this.layoutOptions.enableGatherNodes}analysisNodes4Didirectional(t,e,n,o,s){C(`${s} level ${n} size: ${e.length}`),e.length>o.max_length&&(o.max_length=e.length),n>o.max_deep&&(o.max_deep=n);const r={level:n,all_size:e.length,all_strength:0},l=[];e.forEach(h=>{h.lot||(h.lot={childs:[]}),h.lot.eached=!0,h.lot.subling=r,h.lot.level=n,t.push(h)});let c=0;e.forEach(h=>{let d=0;const f=this.graphInstance.getNodeRelatedNodes(h);let p=0;f.forEach(g=>{g.lot||(g.lot={eached:!1,childs:[]}),g.lot.eached||(g.lot.parent=h,g.rgCalcedVisible?(g.lot.eached=!0,g.lot.index_of_parent=p++,h.lot.childs.push(g),l.push(g),d++):h.lot.childs.push(g))}),h.lot.strength=d>0?d:1,r.all_strength+=h.lot.strength,h.lot.strength_plus=r.all_strength,h.lot.index_of_level=c,h.lot.childs_size=d,c++}),r.all_strength>o.max_strength&&(o.max_strength=r.all_strength),l.length>0?this.analysisNodes4Didirectional(t,l,n+s,o,s):(t.forEach(h=>{h.lot.strengthWithChilds=1,z.conductStrengthToParents4Folder(h)}),z.analysisDataFolder([t[0]],0,s))}placeNodes(t,e){if(C("RGFolderLayouter:placeNodes"),e)C("layout by root:",e);else{console.error("root is null");return}this.rootNode=e,this.allNodes=t,console.log("fixedRootNode:",this.layoutOptions.fixedRootNode);const n={alignItemsX:this.layoutOptions.alignItemsX,alignItemsY:this.layoutOptions.alignItemsY},o={alignItemsX:this.layoutOptions.alignParentItemsX,alignItemsY:this.layoutOptions.alignParentItemsY};e.fixed||this.layoutOptions.fixedRootNode||(e.x=0,e.y=0);const s=this.layoutOptions.centerOffset_x||0,r=this.layoutOptions.centerOffset_y||0,l=z.getNodeLotXY(n,e);e.lot.x=l.x+s,e.lot.y=l.y+r,C("allNodes:",t.length),t.forEach(d=>{d.lot||(d.lot={}),d.lot.eached=!1,d.lot.notLeafNode=!1,d.lot.childs=[],d.lot.parent=void 0,d.lot.index_of_parent=0,d.lot.strength=0,d.lot.strengthWithChilds_from=0,d.lot.strengthWithChilds=0,d.lot.placed=!1});let c=[],h={max_deep:1,max_length:1,max_strength:1};this.analysisNodesForFolder(c,[this.rootNode],0,h),c=[],h={max_deep:1,max_length:1,max_strength:1},this.analysisNodes4Didirectional(c,[this.rootNode],0,h,1),this.placeRelativePosition(e,c,h),C("allNodes:",c.length),this.allNodes.forEach(d=>{if(d.fixed===!0){d.lot.placed=!0;return}if(Number.isNaN(d.lot.x)&&(C("bad lot x:",d.text,d.lot.x),d.lot.x=0),Number.isNaN(d.lot.y)&&(C("bad lot y:",d.text,d.lot.y),d.lot.y=0),d!==e){const f=d.lot.level<0?o:n;d.x=z.getNodeXByLotX(f,d),d.y=z.getNodeYByLotY(f,d)}d.lot.placed=!0}),C("create rootNode coordinates:1",e.x,e.y)}placeRelativePosition(t,e,n){const o=this.layoutOptions.treeNodeGapH||20,s=this.layoutOptions.treeNodeGapV||20,r=new Map;let l=0,c=0;for(const f of e){const p=f.lot.level,g=f.el.offsetWidth,u=f.el.offsetHeight;l+=u,c++;const x=r.get(p);x===void 0?r.set(p,g):g>x&&r.set(p,x)}if(c===0)return;console.log("levelMaxWidthMap:",r);const d=l/c+s;e.forEach(f=>{f.fixed!==!0&&f.lot.placed!==!0&&f!==t&&(this.layoutOptions.from==="right"?f.lot.x=t.lot.x-this.getLevelDistance(f.lot.level,r,o+50):f.lot.x=t.lot.x+this.getLevelDistance(f.lot.level,r,o+50))}),e.forEach(f=>{f.fixed!==!0&&f!==t&&f.lot.level!==0&&(f.lot.y=t.lot.y+d*(f.lot.strengthWithChilds_from-1))}),this.gatherNodes(e,"h",d)}gatherNodes(t,e,n){if(!this.enableGatherNodes)return;const o={};t.forEach(s=>{if(s.lot.level!==0)return;const r=s.lot.level+"";o[r]||(o[r]=[]),o[r].push(s),s.lot.movedNodeSizeBefore=1,s.lot.movedNodeSizeAfter=1}),t.forEach(s=>{if(s.fixed!==!0&&s.lot.level!==0){const r=s.lot.level+"",l=o[r];if(s.lot.strengthWithChilds===1&&s.lot.childs_size<=1){const c=this.getBloomingNearByParent(s,s.lot.parent,l,e);c&&(e==="h"?s.lot.y-c.lot.y>0?(s.lot.y=c.lot.y+n*c.lot.movedNodeSizeAfter,c.lot.movedNodeSizeAfter++):(s.lot.y=c.lot.y-n*c.lot.movedNodeSizeBefore,c.lot.movedNodeSizeBefore++):s.lot.x-c.lot.x>0?(s.lot.x=c.lot.x+n*c.lot.movedNodeSizeAfter,c.lot.movedNodeSizeAfter++):(s.lot.x=c.lot.x-n*c.lot.movedNodeSizeBefore,c.lot.movedNodeSizeBefore++))}}})}getBloomingNearByParent(t,e,n,o){let s=9999,r;for(const l of n)if(l.lot.childs_size>1&&l.lot.parent===e){const c=o==="h"?l.lot.y-e.lot.y:l.lot.x-e.lot.x;Math.abs(c)<s&&(s=Math.abs(c),r=l)}if(r&&r!==t)return r}getLevelDistance(t,e,n){if(t===0)return 0;if(t>0){let o=0;for(let s=0;s<t;s++)o+=e.get(s)+this.getLevelGap(s,n);return o}else{let o=t<-1?0:-e.get(t)/2;for(let s=t;s<0;s++)o+=e.get(s)+this.getLevelGap(s,n)+50;return-o}}getLevelGap(t,e){var o;let n=e;if(((o=this.layoutOptions.levelGaps)==null?void 0:o.length)>0){const s=this.layoutOptions.levelGaps[Math.abs(t)];s&&(n=s)}return n}analysisNodesForFolder(t,e,n,o){e.length>o.max_length&&(o.max_length=e.length),n>o.max_deep&&(o.max_deep=n);const s={level:n,all_size:e.length,all_strength:0};n===0&&e.forEach(l=>{l.lot.parent=void 0});const r=[];for(const l of e){t.push(l);for(const c of this.graphInstance.getNodeRelatedNodes(l))t.includes(c)||(t.push(c),c.lot.parent=l,r.push(c))}s.all_strength>o.max_strength&&(o.max_strength=s.all_strength),r.length>0&&this.analysisNodesForFolder(t,r,n+1,o)}}let Ye=0;const Xt=i=>{typeof i.graphOffset_x=="string"&&(i.graphOffset_x=parseInt(i.graphOffset_x)),typeof i.graphOffset_y=="string"&&(i.graphOffset_y=parseInt(i.graphOffset_y)),i.defaultPloyLineRadius&&(i.defaultPolyLineRadius=i.defaultPloyLineRadius);const a={instanceId:"",debug:!0,graphLoading:!1,graphLoadingText:"",instanceDestroyed:!1,useHorizontalView:!1,showDebugPanel:!1,showToolBar:!0,backgroundColor:"transparent",checkedItemBackgroundColor:void 0,downloadImageFileName:"",selectionMode:!1,disableWheelEvent:!1,wheelEventAction:"zoom",disableDragNode:!1,disableDragLine:!0,disableDragCanvas:!1,canvasMoveMode:!1,disableNodePointEvent:!1,disableLinePointEvent:!1,enableNodeXYAnimation:!1,enableCanvasTransformAnimation:!1,reLayoutWhenExpandedOrCollapsed:!1,defaultExpandHolderPosition:"hide",defaultExpandHolderColor:void 0,toolBarDirection:"v",toolBarPositionH:"right",toolBarPositionV:"center",defaultNodeColor:"#ffffff",defaultLineColor:"#cccccc",defaultLineShape:void 0,defaultLineTextOffset_x:void 0,defaultLineTextOffset_y:void 0,defaultJunctionPoint:void 0,defaultPolyLineRadius:5,placeSingleNode:!0,placeOtherGroup:!0,lineUseTextPath:!1,lineTextMaxLength:66,multiLineDistance:50,graphOffset_x:0,graphOffset_y:0,defaultLineMarker:{viewBox:"0 0 12 12",markerWidth:20,markerHeight:20,refX:3,refY:3,data:"M 0 0, V 6, L 4 3, Z"},viewSize:{width:300,height:300},viewELSize:{width:1300,height:800,left:0,top:100},canvasSize:{width:1e3,height:1e3},canvasOffset:{x:25,y:27,zoom_buff_x:0,zoom_buff_y:0},fullscreen:!1,checkedNodeId:"",checkedLineId:"",checkedLinkId:"",layout:{label:"\u4E2D\u5FC3",layoutName:"fixed",layoutDirection:"v"},canvasZoom:100,mouseWheelSpeed:10,minCanvasZoom:5,maxCanvasZoom:500,showEasyView:!1,performanceMode:!1,viewHeight:"100%",canvasOpacity:1,creatingSelection:!1,selectionView:{x:25,y:27,width:0,height:0},creatingNodePlot:!1,showTemplateNode:!0,newNodeTemplate:xt(JSON.parse(JSON.stringify(It))),creatingLinePlot:!1,newLineTemplate:{from:"newRelationTemplate-from",to:"newRelationTemplate-to",color:"",text:"new line"},newLinkTemplate:{fromNode:null,toNodeObject:null,toNode:{nothing:!0,x:400,y:400,el:{offsetWidth:30,offsetHeight:30}},totalLinesBetweenNodes:1,currentLineIndex:0,line:{}},data:{},editingLineController:{show:!1,link:null,line:null,startPoint:{x:0,y:0},endPoint:{x:0,y:0},text:{show:!0,x:0,y:0,width:10,height:10},ctrlPoints:[],selectedLines:[],line44Splits:[],line49Points:[],ctrlPoint1:{x:0,y:0},ctrlPoint2:{x:0,y:0},toolbar:{x:0,y:0}},editingController:{show:!1,nodes:[],x:0,y:0,width:100,height:100},nodeConnectController:{show:!1,node:null,x:0,y:0,width:100,height:100},showReferenceLine:!1,referenceLineAdsorption:!1,editingReferenceLine:{show:!1,directionV:!1,directionH:!1,v_x:0,v_y:0,v_height:0,h_x:0,h_y:0,h_width:0},showMiniView:!1,miniViewVisibleHandle:{x:0,y:0,width:100,height:100,emptyContent:!1},snapshotting:!1};if(a.newLineTemplate=ht(a.newLineTemplate),i.layouts)throw new Error("Graph options do not support setting layouts properties !");const t=i.debug===!0;t&&C("RGOptions:user instance options:",i),window&&(window.relationGraphDebug=t);const e=Object.keys(a);return i&&Object.keys(i).forEach(n=>{const o=i[n];if(!e.includes(n)){C("RGOptions: unknow option key:",n);return}if(typeof o=="object"){C("RGOptions:user setting object:",n,o);const s=a[n];if(n==="layout")a[n]=JSON.parse(JSON.stringify(o));else if(s&&!Array.isArray(s)&&o)Object.keys(s).forEach(r=>{s[r]=o[r]});else if(Array.isArray(s)){const r=[];o.forEach(l=>{l&&typeof l=="object"?r.push(JSON.parse(JSON.stringify(l))):r.push(l)}),a[n]=r}else a[n]=o}else a[n]=o}),C("final layout:",a.layout),Gt(a.layout),Ft(a.layout,a),a},Ft=(i,a)=>{C("applyDefaultOptionsByLayout",i.layoutName,a),i.layoutName==="center"?a.defaultJunctionPoint===void 0&&(a.defaultJunctionPoint=J.border):i.layoutName.includes("tree")?((i.from==="top"||i.from==="bottom")&&(C("set layoutDirection=v"),a.defaultJunctionPoint===void 0&&(a.defaultJunctionPoint=J.tb),C("set defaultJunctionPoint=tb")),(i.from==="left"||i.from==="right")&&(C("set layoutDirection=h"),a.defaultJunctionPoint===void 0&&(a.defaultJunctionPoint=J.lr),C("set defaultJunctionPoint=lr"))):i.layoutName==="fixed"||i.layoutName,a.defaultJunctionPoint===void 0&&(a.defaultJunctionPoint=J.border)},Gt=i=>{if(typeof i.centerOffset_x=="string"&&(i.centerOffset_x=parseInt(i.centerOffset_x)),typeof i.centerOffset_y=="string"&&(i.centerOffset_y=parseInt(i.centerOffset_y)),i.layoutName==="center"){const a=i;a.layoutDirection===void 0&&(a.layoutDirection="h"),a.centerOffset_x===void 0&&(a.centerOffset_x=0),a.centerOffset_y===void 0&&(a.centerOffset_y=0),a.layoutDirection=void 0}else if(i.layoutName.includes("tree")){const a=i;a.layoutDirection===void 0&&(a.layoutDirection="h"),a.centerOffset_x===void 0&&(a.centerOffset_x=0),a.centerOffset_y===void 0&&(a.centerOffset_y=0),a.from===void 0&&(a.from="top"),a.levelGaps===void 0&&(a.levelGaps=[]),(a.from==="top"||a.from==="bottom")&&(a.layoutDirection="v",C("set layoutDirection=v"),C("set defaultJunctionPoint=tb")),(a.from==="left"||a.from==="right")&&(a.layoutDirection="h",C("set defaultJunctionPoint=lr"))}else(i.layoutName==="fixed"||i.layoutName==="force")&&(i.layoutDirection=void 0);i.supportAutoLayout=!1,i.autoLayouting=!1},St=i=>{const a=Xt(i);return C("RGOptions:new RGOptions:by:",i),C("RGOptions:new RGOptions:",a),a.instanceId||(a.instanceId=`rg-ins-${Ye++}`),a},We=Object.freeze(Object.defineProperty({__proto__:null,createDefaultConfig:Xt,applyDefaultOptionsByLayout:Ft,appendDefaultOptions4Layout:Gt,newInstanceOptions:St,default:{newInstanceOptions:St,createDefaultConfig:Xt,applyDefaultOptionsByLayout:Ft}},Symbol.toStringTag,{value:"Module"}));class Ue{constructor(a,t){S(this,"options");S(this,"listeners");S(this,"isReact",!1);S(this,"updateViewHook",()=>{});S(this,"_dataUpdating",!1);S(this,"_dataUpdatingNext",!1);S(this,"eventHandlers",[]);S(this,"_emitHook");this.listeners=t||{},this.options=a?St(a):{}}enableDebugLog(a){this.options.debug=a,window&&(window.relationGraphDebug=a)}setUpdateViewHook(a){this.isReact=!0,this.updateViewHook=a}_dataUpdated(){!window||!window.requestAnimationFrame||requestAnimationFrame(this._doSomethingAfterDataUpdated.bind(this))}_doSomethingAfterDataUpdated(){C("_dataUpdated:"),this.updateShouldRenderGraphData(),this.updateEasyView(),this.updateViewHook()}addEventHandler(a){this.eventHandlers.includes(a)||this.eventHandlers.push(a)}removeEventHandler(a){const t=this.eventHandlers.indexOf(a);t!==-1&&this.eventHandlers.splice(t,1)}setEventEmitHook(a){this._emitHook=a}emitEvent(a,...t){let{result:e,handled:n}=this.defaultEventHandler(a,...t);for(const o of this.eventHandlers){const s=o(a,...t);s!==void 0&&(e=s,n=!0)}if(n||this._emitHook&&this._emitHook(a,...t,o=>{o!==void 0&&(e=o)}),e!==void 0)return C("[custom event hook]Event:",a," => returnValue:",e),e}defaultEventHandler(a,...t){let e,n=!1;if(a===A.onReady)this.listeners.onReady&&(n=!0,this.listeners.onReady(this));else if(a===A.onNodeDragStart)this.listeners.onNodeDragStart&&(n=!0,this.listeners.onNodeDragStart(t[0],t[1]));else if(a===A.onNodeDragging){if(this.listeners.onNodeDragging){n=!0;const o=t[0],s=t[1],r=t[2],l=t[3],c=t[4],h=t[5];e=this.listeners.onNodeDragging(o,s,r,l,c,h)}}else if(a===A.onCanvasDragging){if(this.listeners.onCanvasDragging){n=!0;const o=t[0],s=t[1],r=t[2],l=t[3];e=this.listeners.onCanvasDragging(o,s,r,l)}}else if(a===A.onNodeDragEnd){const o=t[0],s=t[1],r=t[2],l=t[3];this.listeners.onNodeDragEnd&&(n=!0,this.listeners.onNodeDragEnd(o,s,r,l))}else if(a===A.onZoomEnd)this.listeners.onZoomEnd&&(n=!0,this.listeners.onZoomEnd());else if(a===A.onNodeClick){if(this.listeners.onNodeClick){n=!0;const o=t[0],s=t[1];this.listeners.onNodeClick(o,s)}}else if(a===A.onImageDownload){if(this.listeners.onImageDownload){n=!0;const o=t[0],s=t[1];e=this.listeners.onImageDownload(o,s)}}else if(a===A.onImageSaveAsFile){if(this.listeners.onImageSaveAsFile){n=!0;const o=t[0],s=t[1],r=t[2];e=this.listeners.onImageSaveAsFile(o,s,r)}}else if(a===A.onLineClick){if(this.listeners.onLineClick){n=!0;const o=t[0],s=t[1],r=t[2];this.listeners.onLineClick(o,s,r)}}else if(a===A.onNodeExpand){if(this.listeners.onNodeExpand){n=!0;const o=t[0],s=t[1];this.listeners.onNodeExpand(o,s)}}else if(a===A.onNodeCollapse){if(this.listeners.onNodeCollapse){n=!0;const o=t[0],s=t[1];this.listeners.onNodeCollapse(o,s)}}else if(a===A.onCanvasDragEnd){if(this.listeners.onCanvasDragEnd){n=!0;const o=t[0];this.listeners.onCanvasDragEnd(o)}}else if(a===A.onCanvasClick){if(this.listeners.onCanvasClick){n=!0;const o=t[0];this.listeners.onCanvasClick(o)}}else if(a===A.onCanvasSelectionEnd){if(this.listeners.onCanvasSelectionEnd){n=!0;const o=t[0],s=t[1];this.listeners.onCanvasSelectionEnd(o,s)}}else if(a===A.onContextmenu){if(this.listeners.onContextmenu){n=!0;const o=t[0],s=t[1],r=t[2];this.listeners.onContextmenu(o,s,r)}}else if(a===A.onFullscreen){if(this.listeners.onFullscreen){n=!0;const o=t[0],s=t[1];e=this.listeners.onFullscreen(o,s)}}else if(a===A.beforeAddNodes){if(this.listeners.beforeAddNodes){n=!0;const o=t[0];e=this.listeners.beforeAddNodes(o)}}else if(a===A.beforeAddLines){if(this.listeners.beforeAddLines){n=!0;const o=t[0];e=this.listeners.beforeAddLines(o)}}else if(a===A.onKeyboardDown){if(this.listeners.onKeyboardDown){n=!0;const o=t[0];e=this.listeners.onKeyboardDown(o)}}else if(a===A.onKeyboardUp){if(this.listeners.onKeyboardUp){n=!0;const o=t[0];e=this.listeners.onKeyboardUp(o)}}else if(a===A.onLineBeCreated){if(this.listeners.onLineBeCreated){n=!0;const o=t[0];e=this.listeners.onLineBeCreated(o)}}else if(a===A.onCanvasDragStart&&this.listeners.onCanvasDragStart){n=!0;const o=t[0],s=t[1],r=t[2];e=this.listeners.onCanvasDragStart(o,s,r)}return{result:e,handled:n}}setEventListener(a){Object.assign(this.listeners,a)}}class Ze extends Ue{constructor(t,e){super(t,e);S(this,"$dom");S(this,"$canvasDom");S(this,"resizeObserver");S(this,"resizeListenerMap",new WeakMap);S(this,"domToNodeIdMap",new WeakMap);S(this,"_rgAsConnectArea",!1);S(this,"onKeyDownHanlder");S(this,"onKeyUpHanlder");S(this,"$lineTextContainer4NormalLine");S(this,"$lineTextContainer4FakeLine")}initDom(){this.resizeObserver=new ResizeObserver((t,e)=>{for(const n of t){const o=this.resizeListenerMap.get(n.target);o?n.borderBoxSize?o(n.borderBoxSize[0].inlineSize,n.borderBoxSize[0].blockSize):o(n.target.clientWidth,n.target.clientHeight):n.borderBoxSize?this._onNodeDomResize(n.target,n.borderBoxSize[0].inlineSize,n.borderBoxSize[0].blockSize):this._onNodeDomResize(n.target,n.target.clientWidth,n.target.clientHeight)}})}setDom(t){this.$dom=t,this.addResizeListener(this.$dom,(e,n)=>{C("resizeListener:this.$dom"),this.resetViewSize(),this.updateViewBoxInfo(),this.updateEasyView(),this._rgAsConnectArea&&(this.updateConnectTargetsOnCanvas("View Resize",this.$dom.querySelector(".rg-canvas-slot-behind")),this.updateConnectTargetsOnCanvas("View Resize",this.$dom.querySelector(".rg-canvas-slot-above"))),this.updateEditingControllerView(),this.updateEditingLineView(),setTimeout(()=>{C("resizeListener:updateShouldRenderGraphData"),this.emitEvent(A.onViewResize,{width:e,height:n})},500)}),this._rgAsConnectArea||(this.removeKeyboardListener(),this.addKeyboardListener())}addKeyboardListener(){this.onKeyDownHanlder=t=>{vt(t)||(t.code==="Space"&&(t.preventDefault(),this.setCanvasMoveMode(!0)),this.emitEvent(A.onKeyboardDown,t))},this.onKeyUpHanlder=t=>{vt(t)||(t.code==="Space"&&(t.preventDefault(),this.setCanvasMoveMode(!1)),this.emitEvent(A.onKeyboardUp,t))},this.$dom.addEventListener("keydown",this.onKeyDownHanlder),this.$dom.addEventListener("keyup",this.onKeyUpHanlder)}removeKeyboardListener(){this.onKeyDownHanlder&&this.$dom.removeEventListener("keydown",this.onKeyDownHanlder),this.onKeyUpHanlder&&this.$dom.removeEventListener("keyup",this.onKeyUpHanlder)}setCanvasDom(t){this.$canvasDom=t,this.reinitMutationObservers(),this.getLineTextContainer({isFakeLine:!0}),this.getLineTextContainer({isFakeLine:!1})}getLineTextContainer(t){if(!(!t||!this.$canvasDom))return t.isFakeLine?(this.$lineTextContainer4NormalLine||(this.$lineTextContainer4NormalLine=this.$canvasDom.querySelector(".rg-lines-container-el-lines .rg-linetext-container")),this.$lineTextContainer4NormalLine):(this.$lineTextContainer4FakeLine||(this.$lineTextContainer4FakeLine=this.$canvasDom.querySelector(".rg-lines-container-normal-lines .rg-linetext-container")),this.$lineTextContainer4FakeLine)}getBoundingClientRect(){var t;return(t=this.$dom)==null?void 0:t.getBoundingClientRect()}addResizeListener(t,e){this.resizeListenerMap.set(t,e),this.resizeObserver||this.initDom(),this.resizeObserver.observe(t)}_onNodeDomResize(t,e,n){if(e===0||n===0)return;const o=this.domToNodeIdMap.get(t);this._onNodeResize(t,o,e,n)}_onNodeResize(t,e,n,o){n===0||o===0||(this.updateConnectTargetsOnNode("Node-Created",e,t),this.updateNodeOffsetSize(e,n,o))}addNodeResizeListener(t,e){this.domToNodeIdMap.set(t,e.id),this.resizeObserver||this.initDom(),this._onNodeResize(t,e.id,t.offsetWidth,t.offsetHeight),this.resizeObserver.observe(t)}removeNodeResizeListener(t){this.domToNodeIdMap.delete(t),t?this.resizeObserver.unobserve(t):C("removeNodeResizeListener: dom is null or undefined!")}removeResizeListener(t){this.resizeListenerMap.delete(t),this.resizeObserver.unobserve(t)}destroyResizeObserver(){this.resizeObserver&&this.resizeObserver.disconnect()}}class Je extends Ze{constructor(t,e){super(t,e);S(this,"graphData",{rootNode:void 0,nodes:[],normalLines:[],elementLines:[],fakeLines:[]});S(this,"runtimeDATA4Links",[]);S(this,"runtimeDATA4NodeMap",{});S(this,"runtimeDATA4ConnectTargets",[]);S(this,"reactiveData");S(this,"runtimeDATA4ShouldRenderGraphData",{nodes:[],lines:[]});S(this,"prevAddNodeTimestamp",0);S(this,"mutationObserver4Nodes");S(this,"mutationObserver4CanvasSlotBehind");S(this,"mutationObserver4CanvasSlotAbove");S(this,"canvasConnectTargetsMap",new Map);S(this,"nodeConnectTargetsMap",new Map);S(this,"fakeLineTargetRender");S(this,"runtimeDATA4ElLineTargets",[]);S(this,"elLineUpdating",!1);S(this,"_canvasBoxXY",{x:0,y:0});S(this,"canvasDragging",!1)}setReactiveData4Vue2(t,e,n){this.reactiveData=e,this.graphData=t,this.runtimeDATA4ShouldRenderGraphData=n.runtimeDATA4ShouldRenderGraphData,this.runtimeDATA4ConnectTargets=n.runtimeDATA4ConnectTargets,this.runtimeDATA4ElLineTargets=n.runtimeDATA4ElLineTargets,Object.assign(e.options,this.options),this.options=e.options}setReactiveData4Vue3(t,e,n){this.reactiveData=e,this.graphData=t,this.options.performanceMode||(this.runtimeDATA4Links=n.runtimeDATA4Links),this.runtimeDATA4ShouldRenderGraphData=n.runtimeDATA4ShouldRenderGraphData,this.runtimeDATA4ConnectTargets=n.runtimeDATA4ConnectTargets,this.runtimeDATA4ElLineTargets=n.runtimeDATA4ElLineTargets,Object.assign(e.options,this.options||{}),this.options=e.options}_setOptions(t){const e=this.options.instanceId;t.instanceId||(t.instanceId=e);const n=St(t);this.reactiveData?Object.assign(this.reactiveData.options,n):Object.assign(this.options,n)}_setJsonData(t,e=!1){this.clearGraph(),C("set jsonData:",t),this.loadGraphJsonData(t)}clearGraph(){this.graphData.nodes=[],this.graphData.normalLines=[],this.graphData.elementLines=[],this.graphData.fakeLines=[],this.runtimeDATA4Links.splice(0,this.runtimeDATA4Links.length),this.runtimeDATA4ElLineTargets.splice(0,this.runtimeDATA4ElLineTargets.length),this.runtimeDATA4NodeMap={},this.graphData.rootNode=void 0,this.clearChecked(),this.setEditingLine(null,null),this.setEditingNodes([])}clearFakeLines(){this.graphData.fakeLines.splice(0,this.graphData.fakeLines.length)}clearElementLines(){for(const t of this.getFakeLines())(t.fromType===F.HTMLElementId||t.toType===F.HTMLElementId)&&this.removeFakeLine(t)}generateNewNodeId(t=5){const e=this.generateNewUUID(t);return this.getNodeById(e)?this.generateNewNodeId(t+1):e}generateNewUUID(t=5){const e="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";let n="";const o=t>30?30:t;for(let s=0;s<o;s++)n+=e[Math.floor(Math.random()*e.length)];return n}loadNodes(t){this.emitEvent(A.beforeAddNodes,t);const e={};this.graphData.nodes.forEach(o=>{e[o.id]=o});const n=[];t.forEach(o=>{let s=e[o.id];if(!s){let{text:r,id:l}=o;!r&&o.label&&(r=o.label,console.warn('Use "label" as "text":',o.label)),!r&&l&&(r=l,console.warn('Use "id" as "text":',l)),s=xt(Object.assign({},o,{text:r}),this.options),s&&(e[s.id]=s,n.push(s))}}),this.graphData.nodes.push(...n);for(const o of n)this.runtimeDATA4NodeMap[o.id]=o;n.length>0&&(this.prevAddNodeTimestamp=Date.now())}loadLines(t){this.emitEvent(A.beforeAddLines,t);const e=[],n=[];t.forEach(o=>{let{from:s,to:r,text:l}=o;if(!s)if(o.source)s=o.source,console.warn('Use "source" as "from":',o.source);else{console.error('JsonLine Must have field:"from"',o);return}if(!r)if(o.target)r=o.target,console.warn('Use "target" as "to":',o.target);else{console.error('JsonLine Must have field:"to"',o);return}l||o.label&&(l=o.label,console.warn('Use "label" as "text":',o.label));const c=this.getNodeById(s);if(!c){console.error("Can not found from node:",o);return}const h=this.getNodeById(r);if(!h){console.error("Can not found to node:",o);return}if(o.id){if(this.getLineById(o.id)){console.warn("loadLines:skip duplicate line id:",o.id);return}else if(n.some(u=>u.id===o.id)){console.warn("Duplicate line id in new lines:",o.id);return}}else o.id="L-"+this.generateNewUUID(6);const d=ht(Object.assign({},o,{from:s,to:r,text:l})),p={seeks_id:"LK-"+this.generateNewUUID(6),fromNode:c,toNode:h,forDisplayOnly:d.forDisplayOnly||!1,currentLineIndex:0,totalLinesBetweenNodes:1,rgShouldRender:!0,rgCalcedVisible:!0,line:d};n.push(d),e.push(p)}),this.graphData.normalLines.push(...n),this.runtimeDATA4Links.push(...e),this.updateLinks(e)}updateLinks(t){for(const e of t){const n=this.getLinesBetweenNodes([e.fromNode,e.toNode]);for(const o of n){const s=this.getLinkByLine(o);s.totalLinesBetweenNodes=n.length,s.currentLineIndex=n.findIndex(r=>r.id===s.line.id)}}}flatNodeData(t,e,n,o){z.flatNodeData(t,e,n,o)}loadGraphJsonData(t){t.lines||(t.lines=t.relations,console.warn("[relation-graph] For compatibility with older versionsm, Use jsonData.relations as jsonData.lines, It is recommended that you define your data using")),t.lines||(t.lines=t.links||t.edges,console.warn("[relation-graph] For compatibility with older versionsm, Use jsonData.links/jsonData.edges as jsonData.lines, It is recommended that you define your data using"));const e=t.nodes||[],n=t.lines||[],o=[],s=[];this.flatNodeData(e,null,o,s),n.forEach(r=>{s.push(r)}),this.loadNodes(o),C("Nodes is initialized"),this.loadLines(s),this._dataUpdated(),setTimeout(()=>{t.elementLines&&this.addElementLines(t.elementLines),t.fakeLines&&this.addFakeLines(t.fakeLines),this._dataUpdated()},500)}getLineArrow(t,e=!1,n=!1){const o=e?"start-":"";return`${this.options.instanceId}-${o}arrow-default`}getNodes(){return[...this.graphData.nodes]}getShouldRenderNodes(){return this.options.performanceMode?this.runtimeDATA4ShouldRenderGraphData.nodes:this.calcShouldRenderNodes()}calcShouldRenderNodes(){const t=[];return this.getNodes().forEach(e=>{e.rgShouldRender===!1||!z.isVisibleNode(e)||t.push(e)}),t}getShouldRenderLines(){return this.options.performanceMode?this.runtimeDATA4ShouldRenderGraphData.lines:this.calcShouldRenderLines()}calcShouldRenderLines(){const t=[];return this.runtimeDATA4Links.forEach(e=>{e.rgShouldRender===!1||e.line.hidden===!0||!(z.isVisibleNode(e.fromNode)&&z.isVisibleNode(e.toNode))||t.push(e.line)}),t}reinitMutationObservers(){this.destroyMutationObserver();const t=this.$dom.querySelector(".rg-nodes-container");if(t)this.mutationObserver4Nodes=new MutationObserver(o=>{for(const s of o){const r=this.getNodeElByChildrenTarget(s.target),l=this.domToNodeIdMap.get(r);l&&this.updateConnectTargetsOnNode("Mutation",l,r)}}),this.mutationObserver4Nodes.observe(t,{childList:!0,subtree:!0,characterData:!0});else throw new Error("MutationObserver:error:Can not find: .rg-nodes-container");const e=this.$dom.querySelector(".rg-canvas-slot-behind");if(e)this.mutationObserver4CanvasSlotBehind=new MutationObserver(o=>{console.warn("MutationObserver:updateConnectTargetsOnCanvas:mutations:",o),this.updateConnectTargetsOnCanvas("CanvasBehind-Mutation",e)}),this.mutationObserver4CanvasSlotBehind.observe(e,{childList:!0,subtree:!0,characterData:!0});else throw new Error("MutationObserver:error:Can not find: .rg-canvas-slot-behind");const n=this.$dom.querySelector(".rg-canvas-slot-above");n&&(this.mutationObserver4CanvasSlotAbove=new MutationObserver(o=>{this.updateConnectTargetsOnCanvas("CanvasAbove-Mutation",n)}),this.mutationObserver4CanvasSlotAbove.observe(n,{childList:!0,subtree:!0,characterData:!0}))}destroyMutationObserver(){this.mutationObserver4Nodes&&(this.mutationObserver4Nodes.disconnect(),this.mutationObserver4Nodes=void 0),this.mutationObserver4CanvasSlotBehind&&(this.mutationObserver4CanvasSlotBehind.disconnect(),this.mutationObserver4CanvasSlotBehind=void 0),this.mutationObserver4CanvasSlotAbove&&(this.mutationObserver4CanvasSlotAbove.disconnect(),this.mutationObserver4CanvasSlotAbove=void 0)}updateConnectTargetsOnCanvas(t,e){if(!e)return;console.warn(`updateConnectTargetsOnCanvas:[${t}]:`);const n=e.classList.contains("rg-canvas-slot-above")?"above":"behind",o=this.canvasConnectTargetsMap.get(n);o&&o.length>0&&this.updateConnectTargetList(t,e,o)}updateConnectTargetsByNodeId(t){const e=this.getNodeElByNodeId(t);this.updateConnectTargetsOnNode("API",t,e)}updateConnectTargetsOnNode(t,e,n){const o=this.nodeConnectTargetsMap.get(e)||[];o.length!==0&&requestIdleCallback(()=>{this.updateConnectTargetList(t,n,o)})}updateConnectTargetList(t,e,n){const o=this.options.canvasZoom/100,s=e.getBoundingClientRect();for(const r of n){const l=e.querySelector(`div[data-target-id="${r.targetId}"]`);if(!l){console.error("Can not find el for connectTarget:",r.targetId,r);continue}this.updateConnectTargetOffset(t,r,l,s,o)}this._dataUpdated()}updateConnectTargetOffset(t,e,n,o,s){const r=n.getBoundingClientRect(),l=Math.round(r.x-o.x),c=Math.round(r.y-o.y);e.offsetX=l/s,e.offsetY=c/s,e.width=r.width/s,e.height=r.height/s}_onConnectTargetMounted(t,e,n,o){const s=this.options.canvasZoom/100,r=o.getBoundingClientRect();this.updateConnectTargetOffset(t,e,n,r,s)}getNodeElByNodeId(t){return this.$dom.querySelector(`[data-id="${t}"]`)}getNodeElByChildrenTarget(t){return Lt(t,"rg-node-peel","rg-map")}getConnectTargetById(t){if(!t)throw new Error("[getConnectTargetById]targetId is empty");for(let e=0;e<this.runtimeDATA4ConnectTargets.length;e++){const n=this.runtimeDATA4ConnectTargets[e];if(n.targetId===t)return n}}registerConnectTarget(t,e,n,o,s={}){if(n!==F.NodePoint&&n!==F.CanvasPoint)return;if(!t){console.error(`[registerConnectTarget]Can not find CanvasPoint target DOM: ${e}`);return}const r=this.getNodeElByChildrenTarget(t),l=r==null?void 0:r.dataset.id;if(l==="rg-newNodeTemplate")return;let c=this.getConnectTargetById(e);if(!c){const d={targetId:e,targetType:F.NodePoint,junctionPoint:J.border,nodeId:"",width:20,height:20,offsetX:0,offsetY:0,offsetPercentX:0,offsetPercentY:0,targetData:{}};this.runtimeDATA4ConnectTargets.push(d),c=this.getConnectTargetById(e)}if(l?this.getNodeById(l):null){c.junctionPoint=o,c.targetType=F.NodePoint,c.nodeId=l,c.targetData=Object.assign({},s||{},{nodeId:l});let d=this.nodeConnectTargetsMap.get(l);d?d.some(f=>f.targetId===c.targetId)||d.push(c):this.nodeConnectTargetsMap.set(l,[c]),this._onConnectTargetMounted("NT-Mounted",c,t,r)}else{const d=t.closest(".rg-canvas-slot");if(!d){console.error(`Can not find CanvasPoint target DOM's parent(.rg-canvas-slot) : ${e}`,t);return}const f=d.classList.contains("rg-canvas-slot-above")?"above":"behind";c.junctionPoint=o,c.targetType=F.CanvasPoint,c.targetData=Object.assign({},s||{});const p=this.canvasConnectTargetsMap.get(f);p?p.some(g=>g.targetId===c.targetId)||p.push(c):this.canvasConnectTargetsMap.set(f,[c]),this._onConnectTargetMounted("CT-Mounted",c,t,d)}return c}unregisterConnectTarget(t){if(this.options.performanceMode)return;const e=this.runtimeDATA4ConnectTargets.findIndex(n=>n.targetId===t);if(e!==-1){const n=this.runtimeDATA4ConnectTargets[e];if(n.targetType===F.NodePoint||n.targetType===F.CanvasPoint){this.runtimeDATA4ConnectTargets.splice(e,1);const o=n.nodeId&&this.nodeConnectTargetsMap.get(n.nodeId);if(o){const s=o.findIndex(r=>r.targetId===t);o.splice(s,1)}}}}setFakeLineTargetRender(t){this.fakeLineTargetRender=t}generateCreatingLineConfig(){const t=this.options,{newLinkTemplate:e,newLineTemplate:n}=t,o=e.fromNode;if(!o)return{line:n,from:null,to:null,totalLinesBetweenNodes:1,currentLineIndex:0};const s=e.toNode,r=s.targetType===F.Node?e.toNode:this.getFakeLineTarget(s.targetType,s.id,n);return{line:Object.assign({},n,{isFakeLine:!1}),from:this.getFakeLineTarget(o.targetType,o.id,n),to:r,totalLinesBetweenNodes:1,currentLineIndex:0}}getFakeLineTargetNode(t){return this.getNodeById(t)}getFakeLineTarget(t,e,n){if(t===F.HTMLElementId){let o=this.runtimeDATA4ElLineTargets.find(s=>s.id===e);return o||(o={x:300,y:300,targetType:F.HTMLElementId,nodeShape:1,id:e,el:{offsetWidth:40,offsetHeight:40},hidden:!0},this.runtimeDATA4ElLineTargets.push(o),this.updateCanvasBoxInfo(),this.updateElementTarget(o)),o.hidden?null:o}else{if(t===F.Node)return this.getFakeLineTargetNode(e);if(t===F.NodePoint||t===F.CanvasPoint){const o=this.getConnectTargetById(e);if(!o)return;if(o.nodeId){const s=this.getFakeLineTargetNode(o.nodeId);if(!s){console.error("[getFakeLineTarget]Can not find NodePoint-s Node:",`${o.targetId}@${o.nodeId}`);return}return{x:s.x+o.offsetPercentX*s.el.offsetWidth+o.offsetX,y:s.y+o.offsetPercentY*s.el.offsetHeight+o.offsetY,targetType:F.NodePoint,targetData:o.targetData,nodeShape:0,id:e,el:{offsetWidth:o.width,offsetHeight:o.height},hidden:!1}}else return{x:o.offsetX,y:o.offsetY,targetType:F.CanvasPoint,targetData:o.targetData,nodeShape:0,id:e,el:{offsetWidth:o.width,offsetHeight:o.height},hidden:!1}}}if(this.fakeLineTargetRender)return this.fakeLineTargetRender(t,e,n)}generateLineConfig(t){const e=this.getLinkByLine(t);return!e||!e.fromNode.rgCalcedVisible||!e.toNode.rgCalcedVisible?!1:{line:e.line,from:e.fromNode,to:e.toNode,totalLinesBetweenNodes:e.totalLinesBetweenNodes,currentLineIndex:e.currentLineIndex}}generateFakeLineConfig(t){let e=1,n=0;if(t.fromType===F.HTMLElementId&&t.toType===F.HTMLElementId){const r=this.graphData.fakeLines.filter(l=>l.from===t.from&&l.to===t.to);r.length>1&&(console.warn("sameTargetLines element-line:",t),e=r.length,n=r.indexOf(t))}let o=this.getFakeLineTarget(t.fromType,t.from,t),s=this.getFakeLineTarget(t.toType,t.to,t);return!o&&t.fromType===F.Node?(console.error("[generateFakeLineConfig]error fakeLine from:",t.fromType,t.from,t),!1):!s&&t.fromType===F.Node?(console.error("[generateFakeLineConfig]error fakeLine to:",t.toType,t.to,t),!1):{line:t,from:o,to:s,totalLinesBetweenNodes:e,currentLineIndex:n}}getShouldRenderFakeLines(){return this.graphData.fakeLines}getLinks(){return[...this.runtimeDATA4Links]}getRelatedLinesByNode(t){const e=[];for(const n of this.runtimeDATA4Links)(t===n.fromNode||t===n.toNode)&&e.push(n.line);return e}getLinesBetweenNodes(t){const e=[],n=this.runtimeDATA4Links;for(const o of n)t.includes(o.fromNode)&&t.includes(o.toNode)&&e.push(o.line);return e}transRGNodeToJsonObject(t){return bt(t)}transRGLinkToJsonObject(t){const e=[];return Ot(t,e),e}transRGLineToJsonObject(t){return Bt(t)}getGraphJsonData(){const t=[],e=[];return this.graphData.nodes.forEach(n=>{const o=bt(n);o&&t.push(o)}),this.runtimeDATA4Links.forEach(n=>{Ot(n,e)}),{rootId:this.graphData.rootNode?this.graphData.rootNode.id:"",nodes:t,lines:e}}getGraphJsonOptions(){const t={},e=["layouter","autoLayouting","canvasNVInfo","canvasOffset","canvasZoom","fullscreen","instanceId","layoutClassName","layoutDirection","layoutLabel","layoutName","resetViewSize","viewELSize","viewNVInfo","viewSize","canvasSize","newLinkTemplate","newLineTemplate","newNodeTemplate"];return Object.keys(this.options).forEach(n=>{e.includes(n)||(t[n]=this.options[n])}),t}printGraphJsonData(){console.log("graph options:",JSON.stringify(this.getGraphJsonOptions())),console.log("graph json data:",JSON.stringify(this.getGraphJsonData()))}getNodeById(t){for(let e=0;e<this.graphData.nodes.length;e++)if(this.graphData.nodes[e].id===t)return this.graphData.nodes[e]}addNode(t){if(C("addNode:",t),t&&Array.isArray(t)){console.error("addNode: node is array:",t);return}this.loadNodes([t]),this._dataUpdated()}addNodes(t){if(C("addNodes:",t),t&&!Array.isArray(t)){console.error("addNodes: nodes is not array:",t);return}this.loadNodes(t),this._dataUpdated()}getLinkById(t){for(let e=0;e<this.runtimeDATA4Links.length;e++)if(this.runtimeDATA4Links[e].seeks_id===t)return this.runtimeDATA4Links[e]}getLinkByLineId(t){for(let e=0;e<this.runtimeDATA4Links.length;e++)if(this.runtimeDATA4Links[e].line.id===t)return this.runtimeDATA4Links[e]}getLinkByLine(t){return this.getLinkByLineId(t.id)}getLineById(t){for(let e=0;e<this.runtimeDATA4Links.length;e++)if(this.runtimeDATA4Links[e].line.id===t)return this.runtimeDATA4Links[e].line}getLines(){const t=[];for(const e of this.runtimeDATA4Links)t.push(e.line);return t}addLine(t){if(C("addLine:",t),t&&Array.isArray(t)){console.error("addLine: line is array:",t);return}this.addLines([t])}addLines(t){if(C("addLines:",t),t&&!Array.isArray(t)){console.error("addLines: lines is not array:",t);return}if(t.length===0)return;const e=t.filter(o=>!o.isFakeLine);this.loadLines(e);const n=t.filter(o=>o.isFakeLine);this.addFakeLines(n),this._dataUpdated()}removeLine(t){if(!t)throw new Error("removeLine: line is null");if(t.isFakeLine){this.removeFakeLine(t);return}let e=this.getLinkByLine(t);if(!e){C("Can not find link by line:",t);return}C("removeLine:",e,t);const n=this.graphData.normalLines.findIndex(o=>o.id===t.id);n!==-1&&this.graphData.normalLines.splice(n,1),this.removeLink(e),this.updateLinks([e]),this._dataUpdated()}removeLineById(t){let e=this.getFakeLineById(t);if(e){this.removeFakeLine(e);return}C("removeLineById:",t),this.removeLine(this.getLineById(t))}removeLink(t){C("removeLink:",t),this.removeLinkById(t.seeks_id),this._dataUpdated()}removeLinkById(t){C("removeLinkById:",t);for(let e=0;e<this.runtimeDATA4Links.length;e++)if(this.runtimeDATA4Links[e].seeks_id===t){this.runtimeDATA4Links.splice(e,1);break}this._dataUpdated()}getFakeLines(){return[...this.graphData.fakeLines]}addFakeLines(t){C("addFakeLines:",t);for(const e of t)if(e.id||console.warn("Must have id for fake line:",e),this.graphData.fakeLines.some(n=>n.id===e.id))console.error("Ignore duplicate fake line id:",e.id);else{e.isFakeLine=!0;const n=ht(e);n.forDisplayOnly=!0,n.id||(n.id=this.generateNewUUID(6)),this.graphData.fakeLines.push(n)}setTimeout(()=>{this._dataUpdated(),setTimeout(()=>{this._dataUpdated()},300)},100)}removeFakeLine(t){C("removeLine:",t),this.removeFakeLineById(t.id)}getFakeLineById(t){return this.graphData.fakeLines.find(e=>e.id===t)}removeFakeLineById(t){C("removeLineById:",t);for(let e=0;e<this.graphData.fakeLines.length;e++)if(this.graphData.fakeLines[e].id===t){this.graphData.fakeLines.splice(e,1);break}this._dataUpdated()}addElementLines(t){C("addElementLines:",t),t.forEach(e=>{e.fromType=F.HTMLElementId,e.toType=F.HTMLElementId,e.isFakeLine=!0,e.id||(e.id=this.generateNewUUID(6)),e.forDisplayOnly=!0}),this.addFakeLines(t),console.log("addElementLines:",t.length,t),this.updateElementLines()}getElementLineById(t){return this.getFakeLineById(t)}getElementLines(){return this.getFakeLines()}removeELementLineById(t){C("removeELementLineById:",t),this.removeFakeLineById(t)}updateElementLines(){C("updateElementLines:runtimeDATA4ElLineTargets:",this.runtimeDATA4ElLineTargets.length),this.runtimeDATA4ElLineTargets.length!==0&&(this.elLineUpdating||(this.elLineUpdating=!0,setTimeout(()=>{this.elLineUpdating=!1,this._updateElementLines()},50)))}_updateElementLines(){this.updateCanvasBoxInfo();for(const t of this.runtimeDATA4ElLineTargets)this.updateElementTarget(t);this._dataUpdated()}updateCanvasBoxInfo(){const t=this.$canvasDom.getBoundingClientRect();this._canvasBoxXY.x=t.x,this._canvasBoxXY.y=t.y}updateElementTarget(t){const e=document.getElementById(t.id);e&&(t.hidden=!e),this._updateElementLinePosition(e,t)}_updateElementLinePosition(t,e){if(!t)return;const n=t.getBoundingClientRect();e.x=(n.x-this._canvasBoxXY.x)/(this.options.canvasZoom/100),e.y=(n.y-this._canvasBoxXY.y)/(this.options.canvasZoom/100);const o=n.width/(this.options.canvasZoom/100),s=n.height/(this.options.canvasZoom/100);o>2&&Math.abs(o-e.el.offsetWidth)>2&&(e.el.offsetWidth=o),s>2&&Math.abs(s-e.el.offsetHeight)>2&&(e.el.offsetHeight=s)}getElementPosition(t){const n=document.getElementById(t).getBoundingClientRect(),o=this.$canvasDom.getBoundingClientRect(),s=(n.x-o.x)/(this.options.canvasZoom/100),r=(n.y-o.y)/(this.options.canvasZoom/100);return{x:s,y:r}}removeNodeById(t){let e=0;for(let o=0;o<this.runtimeDATA4Links.length;o++){const s=this.runtimeDATA4Links[o];(s.fromNode.id===t||s.toNode.id===t)&&(this.removeLink(s),o--,e++)}C("Removed Node link\uFF1A",t,e),this.beforeNodeBeRemove(t),C("Removed Node line/connect-arget\uFF1A",t);let n=0;for(let o=0;o<this.graphData.nodes.length;o++)if(this.graphData.nodes[o].id===t){this.graphData.nodes.splice(o,1),this.runtimeDATA4NodeMap[t]=void 0,delete this.runtimeDATA4NodeMap[t],n++;break}C("Removed node\uFF1A",t,n),this._dataUpdated()}removeNode(t){this.removeNodeById(t.id),this._dataUpdated()}getNodeRelatedNodes(t){const e=[];for(const n of this.runtimeDATA4Links)n.forDisplayOnly||(n.fromNode===t?e.push(n.toNode):n.toNode===t&&e.push(n.fromNode));return e}getNodeRelatedNodes4From(t){const e=[];for(const n of this.runtimeDATA4Links)n.forDisplayOnly||n.toNode===t&&e.push(n.fromNode);return e}getNodeRelatedNodes4To(t){const e=[];for(const n of this.runtimeDATA4Links)n.forDisplayOnly||n.fromNode===t&&e.push(n.toNode);return e}beforeNodeBeRemove(t){for(let e=0;e<this.graphData.fakeLines.length;e++){const n=this.graphData.fakeLines[e];let o=!1;if(n.fromType===F.Node&&n.from===t)o=!0;else if(n.fromType===F.CanvasPoint||n.fromType===F.NodePoint){const s=this.getConnectTargetById(n.from);s&&s.nodeId===t&&(o=!0)}else if(n.toType===F.CanvasPoint||n.toType===F.NodePoint){const s=this.getConnectTargetById(n.to);s&&s.nodeId===t&&(o=!0)}o&&(this.graphData.fakeLines.splice(e,1),e--)}for(let e=0;e<this.runtimeDATA4ConnectTargets.length;e++)this.runtimeDATA4ConnectTargets[e].nodeId===t&&(this.runtimeDATA4ConnectTargets.splice(e,1),e--)}setNodePosition(t,e,n){t.x=e,t.y=n}getGraphOffet(){const t=this.options.graphOffset_x||0,e=this.options.graphOffset_y||0;return{offset_x:t,offset_y:e}}setCanvasCenter(t,e){const n=this.options.viewSize.width/2,o=this.options.viewSize.height/2,s=this.getGraphOffet();this.setZoom(100),this.setCanvasOffset(n-t+s.offset_x,o-e+s.offset_y)}setCanvasOffset(t,e){this.options.canvasOffset.x=t,this.options.canvasOffset.y=e,!this.canvasDragging&&this._dataUpdated()}findGroupNodes(t,e=[]){return this.getNetworkNodesByNode(t,e)}getGroupNodesByNode(t,e=[]){return this.getNetworkNodesByNode(t,e)}getNetworkNodesByNode(t,e=[]){if(!t)throw new Error("Call graphInstance.getNetworkNodesByNode:error: node is undefined");e.includes(t)||e.push(t);for(const n of this.getNodeRelatedNodes(t))e.includes(n)||this.getNetworkNodesByNode(n,e);return e}getDescendantNodes(t){return z.getDescendantNodes(t)}resetViewSize(t=!1){if(!this.options)return;const e=this.$dom.getBoundingClientRect();this.options.viewSize.width=e.width,this.options.viewSize.height=e.height,this._rgAsConnectArea?(this.options.canvasZoom=100,this.options.canvasOffset.x=0,this.options.canvasOffset.y=0):t&&(this.options.canvasZoom=100,this.setCanvasCenter(0,0)),C("resetViewSize:1:",this.options.viewSize.width,this.options.viewSize.height,this.options.canvasOffset.x,this.options.canvasOffset.y),this.updateViewBoxInfo(),this._dataUpdated()}updateViewBoxInfo(){if(!this.$dom){console.error("cannot get view size !");return}const t=this.$dom.getBoundingClientRect();C("resetViewSize:",t.width,t.height,t.left,t.top),this.options.viewELSize.width=t.width,this.options.viewELSize.height=t.height,this.options.viewELSize.left=t.left,this.options.viewELSize.top=t.top}getStuffSize(t){const n=(t||this.graphData.nodes).filter(d=>d.rgCalcedVisible!==!1);if(n.length===0)return{width:10,height:10,minX:0,minY:0,maxX:0,maxY:0};let o=9999999,s=9999999,r=-9999999,l=-9999999;n.forEach(d=>{d.x<o&&(o=d.x),d.x+d.el.offsetWidth>r&&(r=d.x+d.el.offsetWidth),d.y<s&&(s=d.y);const p=d.y+d.el.offsetHeight;p>l&&(l=p)});const c=r-o,h=l-s;return{width:c<0?0:c,height:h<0?0:h,minX:o===9999999?0:o,minY:s===9999999?0:s,maxX:r===-9999999?0:r,maxY:l===-9999999?0:l}}getNodesViewInfo(t){return this.getStuffSize(t)}getNodesCenter(t){const e=this.getStuffSize(t);C("getStuffSize:",e);const n=e.minX+(e.maxX-e.minX)/2,o=e.minY+(e.maxY-e.minY)/2;return{x:n,y:o}}printOptions(){const t=this.getGraphJsonOptions();console.log("options:",t),console.log("options-json-string:"),console.log(JSON.stringify(t))}printData(){const t=this.getGraphJsonData();console.log("data:",t),console.log("data-json-string:"),console.log(JSON.stringify(t))}loading(t=""){this.options.graphLoading=!0,this.options.graphLoadingText=t}clearLoading(){this.options.graphLoading=!1,this.options.graphLoadingText=""}updateShouldRenderGraphData(t=!1){!t&&!this.options.performanceMode||this._updateShouldRenderGraphData()}_updateShouldRenderGraphData(){const t=this.getBoundingClientRect(),e=this.getCanvasXyByClientXy({x:t.x,y:t.y}),n=this.getCanvasXyByClientXy({x:t.x+this.options.viewELSize.width,y:t.y+this.options.viewELSize.height}),o=this.options.snapshotting;let s=0;for(const r of this.graphData.nodes){let l=!0;o||r.alwaysRender?l=!0:((r.x>n.x||r.y>n.y)&&(l=!1),(r.x+r.el.offsetWidth<e.x||r.y+r.el.offsetHeight<e.y)&&(l=!1)),r.rgShouldRender=l,l&&s++}for(const r of this.runtimeDATA4Links){if(o){r.rgShouldRender=!0;continue}r.rgShouldRender=r.fromNode.rgShouldRender||r.toNode.rgShouldRender}this.options.showEasyView&&s>1e3?(this.runtimeDATA4ShouldRenderGraphData.nodes=[],this.runtimeDATA4ShouldRenderGraphData.lines=[]):(this.runtimeDATA4ShouldRenderGraphData.nodes=this.calcShouldRenderNodes(),this.runtimeDATA4ShouldRenderGraphData.lines=this.calcShouldRenderLines()),C("updateShouldRenderGraphData:",this.options.showEasyView,n.x,s)}updateNodesVisibleProperty(){for(const t of this.graphData.nodes)t.rgCalcedVisible=z.isVisibleNode(t);for(const t of this.runtimeDATA4Links)t.rgCalcedVisible=t.fromNode.rgCalcedVisible&&t.toNode.rgCalcedVisible&&!t.line.hidden}setCanvasMoveMode(t){this.options.canvasMoveMode=t,this._dataUpdated()}defaultLineConnectEndHandler(t,e,n){C("defaultLineConnectEndHandler:",t,e,n)}defaultLineVertexBeChangedHandler(t,e,n){C("defaultLineVertexBeChangedHandler:",n&&n.isReverse)}}class je extends Je{constructor(t,e){super(t,e);S(this,"$watermarkDom",null);S(this,"$watermarkPosition","br");S(this,"$backgroundDom",null)}setWatermarkDom(t,e=!0,n=!1,o="br"){e&&(this.$watermarkDom=t),this.$watermarkPosition=o}setBackgroundDom(t,e=!0,n=!0){e&&(this.$backgroundDom=t)}dataURLToBlob(t){try{const e=t.split(","),n=e[0],o=n&&n.match(/:(.*?);/)[1],s=atob(e[1]);let r=s.length;const l=new Uint8Array(r);for(;r--;)l[r]=s.charCodeAt(r);return new Blob([l],{type:o})}catch(e){console.error("[relation-graph]Create and download image error:dataURLToBlob:dataurl",t),console.error("[relation-graph]error object",e)}}async createGraphCanvas(t="png"){const e=this.options.canvasZoom,n=this.$canvasDom.clientWidth,o=this.$canvasDom.clientHeight,s=this.options.layout.autoLayouting;s&&this.stopAutoLayout(),this.loading("Generating..."),this.options.snapshotting=!0;const r=await this.createGraphMainCanvas(t),l=this.$backgroundDom?await this.createGraphBackgroundCanvas(t):null,c=this.$watermarkDom?await this.createGraphWatermarkCanvas(t):null,h=this.mergeCanvas(l,r,c);return this.options.canvasSize.width=n,this.options.canvasSize.height=o,this.options.snapshotting=!1,this._zoomEnd(100,e),this.updateShouldRenderGraphData(),this.updateElementLines(),s&&this.startAutoLayout(),this.clearLoading(),this.dataUpdated(),h}mergeCanvas(t,e,n){const o=window.devicePixelRatio,s=document.createElement("canvas"),r=this.options.canvasSize.width,l=this.options.canvasSize.height;s.width=r*o,s.height=l*o,s.style.width=`${r}px`,s.style.height=`${l}px`;const c=s.getContext("2d");if(s.getContext("2d").scale(1,1),t?c.drawImage(t,0,0):(c.fillStyle=!this.options.backgroundColor||this.options.backgroundColor==="transparent"?"#ffffff":this.options.backgroundColor,c.fillRect(0,0,s.width,s.height)),c.drawImage(e,0,0),n){const h=this.$watermarkDom.getBoundingClientRect(),d=h.width,f=h.height;let p=r-d-20,g=l-f-20;this.$watermarkPosition==="bl"?(p=20,g=l-f-20):this.$watermarkPosition==="tl"?(p=20,g=20):this.$watermarkPosition==="tr"&&(p=r-d-20,g=20),c.drawImage(n,p*o,g*o)}return s}async createGraphBackgroundCanvas(t="png"){const e=window.devicePixelRatio,n=document.createElement("canvas"),o=this.options.canvasSize.width,s=this.options.canvasSize.height;n.width=o*e,n.height=s*e,n.style.width=`${o}px`,n.style.height=`${s}px`,n.getContext("2d").scale(e,e);const r=this.$backgroundDom;r.style.width=this.options.canvasSize.width+"px",r.style.height=this.options.canvasSize.height+"px";const l={backgroundColor:"#ffffff",scale:1,canvas:n,logging:!0,width:this.options.canvasSize.width,height:this.options.canvasSize.height,useCORS:!0},c=await this.createImage(r,l,t,"");return r.style.width="",r.style.height="",c}async createGraphWatermarkCanvas(t="png"){const e=this.$canvasDom.clientWidth,n=this.$canvasDom.clientHeight,o=window.devicePixelRatio,s=document.createElement("canvas");s.width=e*o,s.height=n*o,s.style.width=`${e}px`,s.style.height=`${n}px`,s.getContext("2d").scale(o,o);const r=this.$watermarkDom,l={backgroundColor:"transparent",scale:1,canvas:s,logging:!0,width:e,height:n,useCORS:!0};return await this.createImage(r,l,t,"")}async createGraphMainCanvas(t="png"){const e=this.options.canvasZoom,n=this.options.canvasOffset.x,o=this.options.canvasOffset.y;this.options.checkedNodeId="",this.options.canvasZoom=100,this._zoomEnd(e,this.options.canvasZoom),this.updateShouldRenderGraphData(!0),await ft(500);const s=this.$canvasDom;let r=999999,l=999999,c=-999999,h=-999999;this.graphData.nodes.forEach(E=>{E.x<r&&(r=E.x);const T=E.x+E.el.offsetWidth;T>c&&(c=T);const k=E.y+E.el.offsetHeight;E.y<l&&(l=E.y),k>h&&(h=k)});const d=new WeakMap,f=this.$dom.querySelectorAll("> .rg-map-canvas > .rg-canvas-slot");for(const E of f){let T=999999,k=999999,P=-999999,_=-999999;for(const X of E.children){const H=X,B=H.offsetLeft,I=H.offsetTop;B<T&&(T=B),B>P&&(P=B+H.offsetWidth),I<k&&(k=I),I>_&&(_=I+H.offsetHeight)}T<r&&(r=T),k<l&&(l=k),P>c&&(c=P),_>h&&(h=_),T!==999999&&d.set(E,{offsetX:T,offsetY:k})}const p=200;r=r-p,l=l-p,c=c+p,h=h+p;const g=r,u=l;this.graphData.nodes.forEach(E=>{E.x=E.x-g,E.y=E.y-u});for(const E of f){const T=E;T.style.marginLeft=-g+"px",T.style.marginTop=-u+"px"}this.updateElementLines();const x=this.$canvasDom.querySelectorAll(".rg-lines-svg-el-lines");x.forEach(E=>{const T=E;T.style.width="4000px",T.style.height="4000px"}),this.options.canvasOffset.x=0,this.options.canvasOffset.y=0;const y=c-r,L=h-l,m=window.devicePixelRatio;this.options.canvasSize.width=y,this.options.canvasSize.height=L,C("export image:",{_image_width:y,_image_height:L,_min_x:r,_min_y:l,_max_x:c,_max_y:h,devicePixelRatio:window.devicePixelRatio}),window.scrollTo(0,0);const w=document.createElement("canvas"),b=y,M=L;w.width=b*m,w.height=M*m,w.style.width=`${b}px`,w.style.height=`${M}px`,w.getContext("2d").scale(m,m);const N={backgroundColor:"transparent",scale:1,canvas:w,logging:!0,width:this.options.canvasSize.width,height:this.options.canvasSize.height,useCORS:!0};this.dataUpdated(),await ft(1e3);const O=await this.createImage(s,N,t,"");return f.forEach(E=>{const T=E;T.style.marginLeft="0px",T.style.marginTop="0px"}),this.graphData.nodes.forEach(E=>{E.x=E.x+g,E.y=E.y+u}),x.forEach(E=>{const T=E;T.style.width="1px",T.style.height="1px"}),this.options.canvasOffset.x=n,this.options.canvasOffset.y=o,this.options.canvasZoom=e,O}async createImage(t,e,n,o){C("createImage:",e);const s=window.getHtml2canvas();if(!s){console.error('Please define function window.getHtml2canvas, Make sure you can get "html2canvas" through the following code: const html2canvas = window.getHtml2canvas();');return}return await s(t,e)}async getImageBase64(t="png"){throw new Error("getImageBase64 is deprecated, Please get dom and trans to image by yourself!")}async downloadAsImage(t="png",e){if(this.emitEvent(A.onImageDownload,this.$canvasDom,t)===!1)return;if(this.graphData.nodes.length===0)throw new Error("No nodes, no content to export!");e||(e=this.options.downloadImageFileName),e||(e=`relation-graph-${(Math.random()*1e5).toFixed(0)}`);const o=await this.createGraphCanvas(t);C("downloadImageAsFile:",t,e),this.emitEvent(A.onImageDownload,this.$canvasDom,t)!==!1&&await this.downloadImageAsFile(o,t,e)}async downloadImageAsFile(t,e,n){const o=document.body.appendChild(t);o.style.display="none";const s=this.dataURLToBlob(o.toDataURL(`image/${e}`));document.body.removeChild(o);const r=document.createElement("a");r.style.display="none";try{window.navigator.msSaveOrOpenBlob?window.navigator.msSaveOrOpenBlob(s,`${n}.${e}`):(r.setAttribute("href",URL.createObjectURL(s)),r.setAttribute("download",`${n}.${e}`),document.body.appendChild(r),r.click(),C("click ok!"),URL.revokeObjectURL(await s.text()),C("revokeObjectURL ok!"),document.body.removeChild(r),C("removeChild ok!"))}catch(l){C("[relation-graph]Create and download image error:",l)}}}const dt=i=>!i||i.length===0?"":i.map(a=>{switch(a.type){case"M":return`${a.type} ${a.x} ${a.y}`;case"l":return`${a.type} ${a.dx} ${a.dy}`;case"L":return`${a.type} ${a.x} ${a.y}`;case"h":return`${a.type} ${a.dx}`;case"v":return`${a.type} ${a.dy}`;case"c":return`${a.type} ${a.dx1} ${a.dy1} ${a.dx2} ${a.dy2} ${a.dx} ${a.dy}`;case"s":return`${a.type} ${a.dx2} ${a.dy2} ${a.dx} ${a.dy}`;case"q":return`${a.type} ${a.dx1} ${a.dy1} ${a.dx} ${a.dy}`;case"Q":return`${a.type} ${a.x1} ${a.y1} ${a.x} ${a.y}`;case"t":return`${a.type} ${a.dx} ${a.dy}`;case"a":return`${a.type} ${a.rx} ${a.ry} ${a.xAxisRotation} ${a.largeArcFlag} ${a.sweepFlag} ${a.dx} ${a.dy}`;case"Z":return a.type;default:return console.warn("\u672A\u77E5\u7684\u8DEF\u5F84\u547D\u4EE4\u7C7B\u578B:",a),""}}).join(" ").trim(),ue=i=>{const a=i.match(/[a-zA-Z][^a-zA-Z]*/g);let t=0,e=0,n=0,o=0,s=0,r=0,l=0,c=0;const h={x:0,y:0},d={x:0,y:0},f=[];for(const p of a){const g=p.trim().split(/[ ,]+/),u=g[0].toUpperCase(),x=g[0]===g[0].toLowerCase();switch(u){case"M":t=q(n,g[1],x),e=q(o,g[2],x),n=t,o=e;break;case"L":t=q(n,g[1],x),e=q(o,g[2],x),f.push({x:t,y:e});break;case"C":s=q(n,g[1],x),r=q(o,g[2],x),l=q(n,g[3],x),c=q(o,g[4],x),t=q(n,g[5],x),e=q(o,g[6],x),n=t,o=e;break;case"Q":s=q(n,g[1],x),r=q(o,g[2],x),t=q(n,g[3],x),e=q(o,g[4],x),n=t,o=e;break;case"V":e=q(o,g[1],x),o=e;break;case"H":t=q(n,g[1],x),n=t;break;case"Z":break;default:console.log(`Unsupported command: ${u}`)}p===a[0]&&(h.x=t,h.y=e),p===a[a.length-1]&&(d.x=t,d.y=e)}return{startPoint:h,ctrl1:{x:s,y:r},ctrl2:{x:l,y:c},endPoint:d,lines:f}},q=(i,a,t)=>t?i+parseFloat(a):parseFloat(a),qe=(i,a={x:0,y:0,rotate:0})=>{const{fx:t,fy:e,tx:n,ty:o}=i;a.rotate=j.getTextAngle(t,e,n,o),a.x=Math.round(t+(n-t)/2),a.y=Math.round(e+(o-e)/2),Number.isNaN(a.rotate)&&(a.rotate=0);const s=Math.round(n-t),r=Math.round(o-e),l=[{type:"M",x:Math.round(t),y:Math.round(e)},{type:"l",dx:s,dy:r}],c=dt(l);return{pathCommands:l,pathData:c,textPosition:a,points:[]}},Qe=(i,a={x:0,y:0,rotate:0},t={})=>{const{line:e,fx:n,fy:o,fcx:s,fcy:r,f_W:l,f_H:c,tx:h,ty:d,tcx:f,tcy:p,t_W:g,t_H:u}=i,x=h-n,y=d-o,L=n-s,m=o-r,w=h-f,b=d-p,M=e.lineRadius!==void 0?e.lineRadius:t.lineRadius||0,N=Math.min(M,Math.abs(x))*(n<h?1:-1),O=Math.min(M,Math.abs(y))*(o<d?1:-1),E=e.lineDirection||Math.abs(L)>=l/2?"h":"v",T=e.lineDirection||Math.abs(w)>=g/2?"h":"v",k=[];let P=0,_=0;if(E==="v"){const H=e.polyLineStartDistance||Math.max(Math.min(30,Math.abs(d-o)/2),15),B=m>0?H:-H;if(e.onPathStartOffset==="start"?(P=n,_=o+B-(m>0?20:-5)):e.onPathStartOffset==="middle"?(P=n+(h-n)/2,_=o+B):(P=h,_=o+B+(m>0?20:-5)),k.push({type:"M",x:Math.round(n),y:Math.round(o)},{type:"v",dy:Math.round(B-O)},{type:"c",dx1:0,dy1:Math.round(O),dx2:Math.round(N),dy2:Math.round(O),dx:Math.round(N),dy:Math.round(O)}),T==="v")k.push({type:"h",dx:Math.round(h-n-N*2)},{type:"c",dx1:Math.round(N),dy1:0,dx2:Math.round(N),dy2:Math.round(O),dx:Math.round(N),dy:Math.round(O)},{type:"v",dy:Math.round(d-o-B-O)});else{const I=Math.min(30,Math.abs(h-n)/2),Y=w>0?-I:I;k.push({type:"h",dx:Math.round(h-n+Y-N)},{type:"c",dx1:Math.round(N),dy1:0,dx2:Math.round(N),dy2:Math.round(O),dx:Math.round(N),dy:Math.round(O)},{type:"v",dy:Math.round(d-o-B-O)},{type:"h",dx:Math.round(Y-N)})}}else{const H=e.polyLineStartDistance||Math.max(Math.min(30,Math.abs(h-n)/2),15),B=L>0?H:-H;if(e.onPathStartOffset==="start"?(P=n+(L>0?10:-50),_=o-5):e.onPathStartOffset==="center"||e.onPathStartOffset==="middle"?(P=n+B,_=o+(d-o)/2):(P=n+B+(L>0?20:-50),_=d-5),k.push({type:"M",x:Math.round(n),y:Math.round(o)},{type:"h",dx:Math.round(B-N)},{type:"c",dx1:Math.round(N),dy1:0,dx2:Math.round(N),dy2:Math.round(O),dx:Math.round(N),dy:Math.round(O)}),T==="v"){const I=Math.min(30,Math.abs(d-o)/2),Y=b>0?-I:I;k.push({type:"v",dy:Math.round(d-o+Y-O)},{type:"h",dx:Math.round(h-n-B-N)},{type:"c",dx1:0,dy1:Math.round(O),dx2:Math.round(N),dy2:Math.round(O),dx:Math.round(N),dy:Math.round(O)},{type:"v",dy:Math.round(Y-O)})}else k.push({type:"v",dy:Math.round(d-o-O*2)},{type:"c",dx1:0,dy1:Math.round(O),dx2:Math.round(N),dy2:Math.round(O),dx:Math.round(N),dy:Math.round(O)},{type:"h",dx:Math.round(h-n-B-N)})}a.x=P,a.y=_;const X=dt(k);return{pathCommands:k,pathData:X,textPosition:a,points:[]}},Mt={left:{x:-1,y:0},right:{x:1,y:0},top:{x:0,y:-1},bottom:{x:0,y:1}},Ke=({source:i,sourcePosition:a="bottom",target:t})=>a==="left"||a==="right"?i.x<t.x?{x:1,y:0}:{x:-1,y:0}:i.y<t.y?{x:0,y:1}:{x:0,y:-1},pe=(i,a)=>Math.sqrt(Math.pow(a.x-i.x,2)+Math.pow(a.y-i.y,2));function Ht({source:i,sourcePosition:a="bottom",target:t,targetPosition:e="top",center:n,sourceOffset:o,targetOffset:s}){const r=Mt[a],l=Mt[e],c={x:i.x+r.x*o,y:i.y+r.y*o},h={x:t.x+l.x*s,y:t.y+l.y*s},d=Ke({source:c,sourcePosition:a,target:h}),f=d.x!==0?"x":"y",p=d[f];let g=[],u,x;const y={x:0,y:0},L={x:0,y:0};let m=0;if(r[f]*l[f]===-1){u=n.x,x=n.y;const b=[{x:u,y:c.y},{x:u,y:h.y}],M=[{x:c.x,y:x},{x:h.x,y:x}];r[f]===p?(m=1.1,g=f==="x"?b:M):(m=1.2,g=f==="x"?M:b)}else{const b=[{x:c.x,y:h.y}],M=[{x:h.x,y:c.y}];if(f==="x"?g=r.x===p?M:b:g=r.y===p?b:M,a===e){m=2.1;const k=Math.abs(i[f]-t[f]),P=r[f]===p?o:s;if(k<=P){const _=Math.min(P-1,P-k);r[f]===p?y[f]=(c[f]>i[f]?-1:1)*_:L[f]=(h[f]>t[f]?-1:1)*_}}if(a!==e){m=2.2;const k=f==="x"?"y":"x",P=r[f]===l[k],_=c[k]>h[k],X=c[k]<h[k];(r[f]===1&&(!P&&_||P&&X)||r[f]!==1&&(!P&&X||P&&_))&&(g=f==="x"?b:M)}const N={x:c.x+y.x,y:c.y+y.y},O={x:h.x+L.x,y:h.y+L.y},E=Math.max(Math.abs(N.x-g[0].x),Math.abs(O.x-g[0].x)),T=Math.max(Math.abs(N.y-g[0].y),Math.abs(O.y-g[0].y));E>=T?(u=(N.x+O.x)/2,x=g[0].y):(u=g[0].x,x=(N.y+O.y)/2)}const w=[i,{x:c.x+y.x,y:c.y+y.y},...g,{x:h.x+L.x,y:h.y+L.y},t];return tn(w),[w,u,x,0,0,m]}const tn=i=>{for(let a=0;a<i.length;a++){const t=i[a];t.x=Math.round(t.x),t.y=Math.round(t.y)}},Nt=i=>{const a=[];for(let t=0;t<i.length;t++){const e=i[t];if(e.x=Math.round(e.x),e.y=Math.round(e.y),t===0||t===i.length-1)a.push(e);else{const n=a[a.length-1];e.x===n.x&&e.y===n.y||a.push(e)}}for(let t=2;t<a.length;t++){const e=a[t-2],n=a[t-1],o=a[t],s=e.x===n.x?"v":"h",r=n.x===o.x?"v":"h";s===r&&(n.merged=!0)}return a.filter(t=>t.merged!==!0)};function en(i,a,t,e){const n=Math.min(pe(i,a)/2,pe(a,t)/2,e),{x:o,y:s}=a;if(i.x===o&&o===t.x||i.y===s&&s===t.y)return[{type:"L",x:o,y:s}];if(i.y===s){const c=i.x<t.x?-1:1,h=i.y<t.y?1:-1;return[{type:"L",x:o+n*c,y:s},{type:"Q",x1:o,y1:s,x:o,y:s+n*h}]}const r=i.x<t.x?1:-1,l=i.y<t.y?-1:1;return[{type:"L",x:o,y:s+n*l},{type:"Q",x1:o,y1:s,x:o+n*r,y:s}]}const ye=(i,a)=>{const t=[];return i.forEach((e,n)=>{if(n===0)t.push({type:"M",x:Math.round(e.x),y:Math.round(e.y)});else if(n===i.length-1){const o=i[n-1],s=o.x===e.x?0:o.x<e.x?-1:1,r=o.y===e.y?0:o.y<e.y?-1:1;t.push({type:"l",dx:Math.round(e.x-o.x+s*5),dy:Math.round(e.y-o.y+r*5)})}else{const o=en(i[n-1],e,i[n+1],a);t.push(...o)}}),t};var it=(i=>(i.border="border",i.ltrb="ltrb",i.tb="tb",i.lr="lr",i.left="left",i.right="right",i.top="top",i.bottom="bottom",i))(it||{});const Tt=(i,a,t,e,n,o,s,r)=>i==="left"?"left":i==="right"?"right":i==="top"?"top":i==="bottom"?"bottom":i==="horizontalLine"?e?o>r?"bottom":"top":o<r?"bottom":"top":i==="verticalLine"?e?n>s?"right":"left":n<s?"right":"left":a===1?"right":a===-1?"left":t===1?"bottom":t===-1?"top":"left",me=i=>i==="left"?"right":i==="right"?"left":i==="top"?"bottom":i==="bottom"?"top":"left",ve=i=>{if(i.length<2)throw new Error("At least two points are required to form a polyline.");let a=0;const t=[];for(let o=1;o<i.length;o++){const s=i[o].x-i[o-1].x,r=i[o].y-i[o-1].y,l=Math.sqrt(s*s+r*r);t.push(l),a+=l}const e=a/2;let n=0;for(let o=0;o<t.length;o++)if(n+=t[o],n>=e){const s=i[o],r=i[o+1],l=t[o],h=(e-(n-l))/l,d=s.x+(r.x-s.x)*h,f=s.y+(r.y-s.y)*h;return{x:d,y:f}}return{x:0,y:0}},nn=(i,a={x:0,y:0,rotate:0},t={})=>{const{line:e,fromJunctionPoint:n,toJunctionPoint:o,lineDirection:s,lineShape:r,fx:l,fy:c,fcx:h,fcy:d,f_W:f,f_H:p,tx:g,ty:u,tcx:x,tcy:y,t_W:L,t_H:m}=i,w=l-h,b=c-d;let M=w>3?1:w<-3?-1:0,N=b>3?1:b<-3?-1:0;Math.abs(M)===1&&Math.abs(N)===1&&(Math.abs(w)>Math.abs(b)?N=0:M=0),M===0&&N===0&&(M=1);const O=g-x,E=u-y;let T=O>3?1:O<-3?-1:0,k=E>3?1:E<-3?-1:0;Math.abs(T)===1&&Math.abs(k)===1&&(Math.abs(O)>Math.abs(E)?k=0:T=0),T===0&&k===0&&(M=-1);const P=Tt(n,M,N,!1,l,c,g,u),_=Tt(o,T,k,!0,l,c,g,u),X=e.isReverse?_:P,H=e.isReverse?P:_,B=l+(g-l)/2,I=c+(u-c)/2;let Y={x:0,y:0},U=30,W=30;e.ctrlOptionsFor44&&(Y={x:e.ctrlOptionsFor44.cx,y:e.ctrlOptionsFor44.cy},U+=e.ctrlOptionsFor44.fd,W+=e.ctrlOptionsFor44.td);const G=e.lineRadius!==void 0?e.lineRadius:t.lineRadius||0,[rt]=Ht({source:{x:l,y:c},sourcePosition:X,target:{x:g,y:u},targetPosition:H,center:{x:B+Y.x,y:I+Y.y},sourceOffset:U,targetOffset:W}),st=Nt(rt),tt=ye(st,G),et=dt(tt),lt=ve(rt);return a.x=lt.x,a.y=lt.y,{pathCommands:tt,pathData:et,textPosition:a,points:st,startDirection:X,endDirection:H}},on=(i,a={x:0,y:0,rotate:0},t={})=>{const{line:e,fromJunctionPoint:n,toJunctionPoint:o,lineDirection:s,lineShape:r,fx:l,fy:c,fcx:h,fcy:d,f_W:f,f_H:p,tx:g,ty:u,tcx:x,tcy:y,t_W:L,t_H:m}=i,w=l-h,b=c-d;let M=w>3?1:w<-3?-1:0,N=b>3?1:b<-3?-1:0;Math.abs(M)===1&&Math.abs(N)===1&&(Math.abs(w)>Math.abs(b)?N=0:M=0),M===0&&N===0&&(M=1);const O=g-x,E=u-y;let T=O>3?1:O<-3?-1:0,k=E>3?1:E<-3?-1:0;Math.abs(T)===1&&Math.abs(k)===1&&(Math.abs(O)>Math.abs(E)?k=0:T=0),T===0&&k===0&&(M=-1);let P=Tt(n,M,N,!1,l,c,g,u),_=Tt(o,T,k,!0,l,c,g,u);const X=e.lineRadius!==void 0?e.lineRadius:t.lineRadius||0,H=e.ctrlPointsFor49;let B={x:Math.round(l),y:Math.round(c)},I={x:Math.round(g),y:Math.round(u)},Y={x:Math.round(H[0].x),y:Math.round(H[0].y)},U={x:Math.round(H[H.length-1].x),y:Math.round(H[H.length-1].y)},W=[...H];if(e.isReverse&&([P,_]=[_,P]),Math.abs(B.x-Y.x)>3||Math.abs(B.y-Y.y)>3){const et=B.x+(Y.x-B.x)/2,lt=B.y+(Y.y-B.y)/2,Rt=me(P),[Yt]=Ht({source:B,sourcePosition:P,target:Y,targetPosition:Rt,center:{x:et,y:lt},sourceOffset:20,targetOffset:5});W=Nt([...Yt,...W])}if(Math.abs(I.x-U.x)>3||Math.abs(I.y-U.y)>3){const et=U.x+(I.x-U.x)/2,lt=U.y+(I.y-U.y)/2,Rt=me(_),[Yt]=Ht({source:U,sourcePosition:Rt,target:I,targetPosition:_,center:{x:et,y:lt},sourceOffset:5,targetOffset:20});W=Nt([...W,...Yt])}const G=W,rt=ye(G,X),st=dt(rt),tt=ve(H);return a.x=tt.x,a.y=tt.y,{pathCommands:[],pathData:st,textPosition:a,points:G,startDirection:P,endDirection:_}},sn=(i,a={x:0,y:0,rotate:0})=>{const{line:t,lineShape:e,fx:n,fy:o,fcx:s,fcy:r,tx:l,ty:c,tcx:h,tcy:d}=i,f=l-n,p=c-o,g=n-s,u=o-r,x=l-h,y=c-d,L=Math.min(200,Math.max(100,Math.abs(f/2))),m=Math.min(200,Math.max(100,Math.abs(p/2))),w=g/(Math.abs(g)+Math.abs(u))*L,b=u/(Math.abs(g)+Math.abs(u))*m;let M={x:w,y:b};const N=x/(Math.abs(x)+Math.abs(y))*L+f,O=y/(Math.abs(x)+Math.abs(y))*m+p;let E={x:N,y:O};t.ctrlPoints&&t.ctrlPoints.length>0&&(t.isReverse?(M.x+=t.ctrlPoints[1].x,M.y+=t.ctrlPoints[1].y,E.x+=t.ctrlPoints[0].x,E.y+=t.ctrlPoints[0].y):(M.x+=t.ctrlPoints[0].x,M.y+=t.ctrlPoints[0].y,E.x+=t.ctrlPoints[1].x,E.y+=t.ctrlPoints[1].y));const T={x:n+M.x,y:o+M.y},k={x:n+E.x,y:o+E.y},P={x:n+f,y:o+p},_=[{type:"M",x:n,y:o},{type:"c",dx1:M.x,dy1:M.y,dx2:E.x,dy2:E.y,dx:f,dy:p}];e===8&&_.push({type:"Z"});const X=xe({x:n,y:o},T,k,P,e<6?.8:.5);a.x=X.x,a.y=X.y;const H=dt(_);return{pathCommands:_,pathData:H,textPosition:a,points:[]}},xe=(i,a,t,e,n=.5)=>{const o={x:(1-n)*i.x+n*a.x,y:(1-n)*i.y+n*a.y},s={x:(1-n)*a.x+n*t.x,y:(1-n)*a.y+n*t.y},r={x:(1-n)*t.x+n*e.x,y:(1-n)*t.y+n*e.y},l={x:(1-n)*o.x+n*s.x,y:(1-n)*o.y+n*s.y},c={x:(1-n)*s.x+n*r.x,y:(1-n)*s.y+n*r.y};return{x:(1-n)*l.x+n*c.x,y:(1-n)*l.y+n*c.y}},an=(i,a={x:0,y:0,rotate:0})=>{const{line:t,totalLinesBetweenNodes:e,currentLineIndex:n,lineDirection:o,lineShape:s,fx:r,fy:l,fcx:c,fcy:h,f_W:d,f_H:f,tx:p,ty:g,tcx:u,tcy:x,t_W:y,t_H:L}=i,m=p-r,w=g-l,b=p>r?1:-1,M=g>l?1:-1,N=o==="v"?M:b,O=r-c,E=l-h,T=p-u,k=g-x,P=1/(e+1)*(n+1);let _={x:0,y:0},X={x:0,y:0};if(s===R.Curve2)_=o==="v"?{x:0,y:N*30}:{x:N*30,y:0},X=o==="v"?{x:m*P,y:N*-10}:{x:N*-10,y:w*P};else if(s===R.Curve3)_=o==="v"?{x:0,y:w*P}:{x:N*30,y:0},X=o==="v"?{x:0,y:0}:{x:N*-10,y:w*P};else if(s===R.Curve5)_={x:0,y:0},X=o==="v"?{x:0,y:w*P}:{x:m*P,y:0};else if(s===R.Curve7||s===R.Curve8){const st=O/(Math.abs(O)+Math.abs(E))*30,tt=E/(Math.abs(O)+Math.abs(E))*30;_={x:st,y:tt};const et=T/(Math.abs(T)+Math.abs(k))*30+m,lt=k/(Math.abs(T)+Math.abs(k))*30+w;X={x:et,y:lt}}const H={x:r+_.x,y:l+_.y},B={x:r+X.x,y:l+X.y},I={x:r+m,y:l+w},Y=[{type:"M",x:r,y:l},{type:"c",dx1:_.x,dy1:_.y,dx2:X.x,dy2:X.y,dx:m,dy:w}];s===8&&Y.push({type:"Z"});const U=xe({x:r,y:l},H,B,I,s<6?.8:.5);a.x=U.x,a.y=U.y;const W=dt(Y);return{pathCommands:Y,pathData:W,textPosition:a,points:[]}};class rn extends je{constructor(a,t){super(a,t)}_getJunctionPoint(a,t){return a===J.border?j.getBorderPoint4MultiLine(t):a===J.ltrb?j.getRectJoinPoint(t):a===J.tb?j.getRectVJoinPoint(t):a===J.lr?j.getRectHJoinPoint(t):a===J.left?j.getRectLeftJoinPoint(t):a===J.right?j.getRectRightJoinPoint(t):a===J.top?j.getRectTopJoinPoint(t):a===J.bottom?j.getRectBottomJoinPoint(t):a==="horizontalLine"?j.getRectVJoinPoint(t):a==="verticalLine"?j.getRectHJoinPoint(t):j.getBorderPoint4MultiLine(t)}createLinePath(a,t,e){console.error("createLinePath() is deprecated, please use createLineDrawInfo() instead.")}createLineDrawInfo(a,t){let e,n,o=1,s=0;if(a&&(s=a.currentLineIndex,o=a.totalLinesBetweenNodes),a)e=a.fromNode,n=a.toNode;else{const r=t;if(e=this.getFakeLineTarget(r.fromType,r.from,r),n=this.getFakeLineTarget(r.toType,r.to,r),!e){console.error("Invalid line configuration:error from:",t);return}if(!n){console.error("Invalid line configuration:error to:",t);return}}return this.generateLinePath({line:t,from:e,to:n,totalLinesBetweenNodes:o,currentLineIndex:s})}generateLinePath(a){a.totalLinesBetweenNodes===void 0&&(a.totalLinesBetweenNodes=1),a.currentLineIndex===void 0&&(a.currentLineIndex=0),a.defaultOptions===void 0&&(a.defaultOptions={defaultLineShape:this.options.defaultLineShape,layoutDirection:this.options.layout.layoutDirection,multiLineDistance:this.options.multiLineDistance,defaultJunctionPoint:this.options.defaultJunctionPoint,lineRadius:this.options.defaultPolyLineRadius});try{const t=this.withLineJunctionPoints(a);return this.createLinePathData(t)}catch(t){if(t.rgError)return this.createErrorLineValue(t.errorCode,t.x,t.y);throw t}}throwLineError(a,t,e){return{rgError:!0,errorCode:a,x:t,y:e}}createErrorLineValue(a,t,e){const n={x:0,y:0,rotate:0},o=[{type:"M",x:0,y:0},{type:"l",dx:t,dy:e}];return{pathCommands:o,pathData:dt(o),textPosition:n,points:[]}}withLineJunctionPoints({line:a,from:t,to:e,totalLinesBetweenNodes:n,currentLineIndex:o,defaultOptions:s}){if(!t||!e)throw C("error from-to:",t,e),this.throwLineError("F",-10,0);let r=a.lineShape||s.defaultLineShape||1;const l=a.lineDirection||s.layoutDirection||"h";let c=t.x||0,h=t.y||0,d=e.x||0,f=e.y||0;if(Number.isNaN(c)||Number.isNaN(h))throw C("error start node:",t.text,t.x,t.y),this.throwLineError("A",-10,-10);if(Number.isNaN(d)||Number.isNaN(f))throw C("error end point:",e.text,e.x,e.y),this.throwLineError("B",10,-10);let p=t.el.offsetWidth||60,g=t.el.offsetHeight||60;if(Number.isNaN(p)||Number.isNaN(g))throw this.throwLineError("C",-10,10);let u=e.el.offsetWidth||60,x=e.el.offsetHeight||60;if(Number.isNaN(u)||Number.isNaN(x))throw this.throwLineError("D",10,10);if(c===0&&d===0&&h===0&&f===0)throw this.throwLineError("D",10,10);const y=d-c+(f-h)>0,L=a.isReverse?e:t,m=a.isReverse?t:e,w=L.nodeShape!==void 0&&L.nodeShape!==null?L.nodeShape:1,b=a.junctionOffset||0;c-=b,h-=b,d-=b,f-=b,p+=b*2,g+=b*2,u+=b*2,x+=b*2;const M={from_x:c,from_y:h,to_x:d,to_y:f,f_W:p,f_H:g,t_W:u,t_H:x,nodeShape:w,isReverse:y,isEndPoint:!1,totalLinesBetweenNodes:n,currentLineIndex:o,lineDistance:s.multiLineDistance||50},N=m.nodeShape!==void 0&&m.nodeShape!==null?m.nodeShape:1,O={from_x:d,from_y:f,to_x:c,to_y:h,f_W:u,f_H:x,t_W:p,t_H:g,nodeShape:N,isReverse:y,isEndPoint:!0,totalLinesBetweenNodes:n,currentLineIndex:o,lineDistance:s.multiLineDistance||50},E=s.defaultJunctionPoint||J.border;let T=a.fromJunctionPoint||E,k=a.toJunctionPoint||E,P=a.fromJuctionPointOffsetX||0,_=a.fromJuctionPointOffsetY||0,X=a.toJuctionPointOffsetX||0,H=a.toJuctionPointOffsetY||0;a.isReverse&&([T,k]=[k,T],[P,_,X,H]=[X,H,P,_]),(t===e||c===0&&d===0&&h===0&&f===0)&&P===0&&_===0&&X===0&&H===0&&((r===R.StandardStraight||r===R.Curve2||r===R.Curve3||r===R.SimpleOrthogonal||r===R.Curve5)&&(r=R.StandardCurve),H=20);const B=this._getJunctionPoint(T,M);B.x+=P,B.y+=_;const I=this._getJunctionPoint(k,O);if(I.x+=X,I.y+=H,!B||!I)throw this.throwLineError("E",-20,-20);const Y=c+p/2,U=h+g/2,W=d+u/2,G=f+x/2;T==="horizontalLine"?(B.x=I.x,B.y=M.from_y+M.f_H/2,r===44&&(B.x+=(I.x>W?1:-1)*30)):T==="verticalLine"&&(B.x=M.from_x+M.f_W/2,B.y=I.y,r===44&&(B.y+=(I.y>G?1:-1)*30)),k==="horizontalLine"?(I.x=B.x,I.y=O.from_y+O.f_H/2,r===44&&(I.x+=(B.x>Y?1:-1)*30)):k==="verticalLine"&&(I.x=O.from_x+O.f_W/2,I.y=B.y,r===44&&(I.y+=(B.y>U?1:-1)*30));const rt=B.x,st=B.y,tt=I.x,et=I.y;if(Number.isNaN(rt)||Number.isNaN(st))throw C("error start point:",t.text),this.throwLineError("F",-10,0);if(Number.isNaN(tt)||Number.isNaN(et))throw C("error end point:",e.text),this.throwLineError("G",10,0);return{line:a,totalLinesBetweenNodes:n,currentLineIndex:o,lineDirection:l==="v"?"v":"h",lineShape:r,lineRadius:s.lineRadius||0,fromJunctionPoint:T,toJunctionPoint:k,fx:rt,fy:st,fcx:Y,fcy:U,f_W:p,f_H:g,tx:tt,ty:et,tcx:W,tcy:G,t_W:u,t_H:x}}createLinePathData(a){const{lineShape:t}=a;let e;return t===R.SimpleOrthogonal?e=Qe(a,void 0,{lineRadius:a.lineRadius}):t===R.StandardOrthogonal?e=nn(a,void 0,{lineRadius:a.lineRadius}):t===R.HardOrthogonal?e=on(a,void 0,{lineRadius:a.lineRadius}):t===R.StandardCurve?e=sn(a):t===R.Curve2||t===R.Curve3||t===R.Curve5||t===R.Curve7||t===R.Curve8?e=an(a):e=qe(a),e}getArrowMarkerId(a,t=!1){let e=a.showStartArrow===!0,n=a.showEndArrow!==!1;if(a.isReverse&&([e,n]=[n,e]),t){if(!e)return;if(a.startMarkerId)return`url('#${a.startMarkerId}')`}else{if(!n)return;if(a.endMarkerId)return`url('#${a.endMarkerId}')`}return`url('#${this.getLineArrow(a.color,t,!1)}')`}getTextTransform(a,t){if(!a||!t)return"translate(0,0)";const{x:e,y:n,rotate:o}=t;if(Number.isNaN(e)||Number.isNaN(n))return"translate(0,0)";const s=a.textOffset_x||this.options.defaultLineTextOffset_x||0,r=a.textOffset_y||this.options.defaultLineTextOffset_y||0,l=a.lineShape||this.options.defaultLineShape;return l===R.StandardStraight||l===R.SimpleOrthogonal?`translate(-50%, -50%) translate(${e+s}px,${n+r}px) rotate(${o||0}deg)`:`translate(-50%, -50%) translate(${e+s}px,${n+r}px)`}generateLineTextStyle(a,t){const e={transform:"",transformOrigin:""};if(!a||!t)return{cssStyles:e};const{line:n}=a,{textPosition:o}=t;if(!n||!o)return{cssStyles:e};let s=n.text||"";s.length>this.options.lineTextMaxLength&&(s=s.substring(0,this.options.lineTextMaxLength||15)+"...");const{x:r,y:l,rotate:c}=o;if(Number.isNaN(r)||Number.isNaN(l))return{text:s,cssStyles:e};const h=[],d=n.textAnchor||"center";d==="start"?h.push("translate(0%, -50%)"):d==="end"?h.push("translate(100%, -50%)"):h.push("translate(-50%, -50%)"),h.push(`translate(${r}px,${l}px)`);const f=n.textOffset_x||this.options.defaultLineTextOffset_x||0,p=n.textOffset_y||this.options.defaultLineTextOffset_y||0;return(n.lineShape||this.options.defaultLineShape||1)===R.StandardStraight?(e.transformOrigin="50% 50%",h.push(`translate(${f}px,${p}px)`)):h.push(`translate(${f}px,${p}px)`),e.transform=h.join(" "),{text:s,cssStyles:e}}generateLineTextStyle4TextPath(a){const{line:t,from:e,to:n}=a;let o=t.text;if(!o||!n||!e)return null;let s=0;const r=e.x,l=e.y,c=n.x,h=n.y;o.length>this.options.lineTextMaxLength&&(o=o.substring(0,this.options.lineTextMaxLength||15)+"..."),r>c&&(s=180,o=o.split("").reverse().join(""));const p=`translate(${0},${0})`;let g="middle";const u=t.lineShape||this.options.defaultLineShape||1;let x="50%";return u===R.SimpleOrthogonal?t.onPathStartOffset==="start"?(x="10%",g="start"):t.onPathStartOffset==="end"?(x="90%",g="end"):t.onPathStartOffset?(x=t.onPathStartOffset,g="start"):this.options.layout.layoutDirection==="v"?x=String(Math.abs(c-r)+43):x=String(Math.abs(h-l)+43):t.onPathStartOffset==="start"?(x="10%",g="start"):t.onPathStartOffset==="end"?(x="90%",g="end"):t.onPathStartOffset?(x=t.onPathStartOffset,g="start"):(x="50%",g="middle"),t.textAnchor&&(g=t.textAnchor),{text:o,textOffset:p,textAnchor:g,onPathStartOffset:x,textRotate:s}}onLineVertexBeDroppedOnConnectController(a,t,e,n){if(C("onLineVertexBeDroppedOnConnectController",a,t,e),t.stopPropagation(),!e){this.onLineVertexBeDropped(a,t,void 0,n);return}const o=mt(t),s=e.getBoundingClientRect(),r={x:s.left,y:s.top+s.height/2},l={x:s.left+s.width/2,y:s.top},c={x:s.left+s.width,y:s.top+s.height/2},h={x:s.left+s.width/2,y:s.top+s.height};let d=it.left;const f={x:0,y:0};if(a)d=a,d===it.top||d===it.bottom?f.x=o.clientX-h.x:d===it.right?f.y=o.clientY-c.y:f.y=o.clientY-r.y;else{const u=ut(o.clientX,o.clientY,r.x,r.y),x=ut(o.clientX,o.clientY,l.x,l.y),y=ut(o.clientX,o.clientY,c.x,c.y),L=ut(o.clientX,o.clientY,h.x,h.y),m=Math.min(u,x,y,L);m===u?(d=it.left,f.x=o.clientX-r.x,f.y=o.clientY-r.y):m===x?(d=it.top,f.x=o.clientX-l.x,f.y=o.clientY-l.y):m===y?(d=it.right,f.x=o.clientX-c.x,f.y=o.clientY-c.y):m===L&&(d=it.bottom,f.x=o.clientX-h.x,f.y=o.clientY-h.y)}const g=this.options.canvasZoom/100;f.x=f.x/g,f.y=f.y/g,C("onMouseUpWithOffset:",a,f),this.onLineVertexBeDropped(d,t,f,n)}}class ln extends rn{constructor(t,e){super(t,e);S(this,"_zooming",!1)}async zoom(t,e,n){if(!this._rgAsConnectArea){if(this._zooming){console.error("reject zoom:_zooming");return}this._zooming=!0;try{const o=this.emitEvent(A.beforeZoomStart,this.options.canvasZoom,t,n);if(C("[zoom]","abortZoom:",o),o===!0)return;if(this.options.canvasZoom+t<this.options.minCanvasZoom){if(C("zoom:minCanvasZoom"),t=this.options.minCanvasZoom-this.options.canvasZoom,t===0)return}else if(this.options.canvasZoom+t>this.options.maxCanvasZoom&&(C("zoom:maxCanvasZoom"),t=this.options.maxCanvasZoom-this.options.canvasZoom,t===0))return;const s=t/100,r=this.$dom.getBoundingClientRect(),l=this.options.canvasZoom/100,c=Math.max(.01,Math.min(10,l+s));e||(e={x:r.x+r.width/2,y:r.y+r.height/2});const h=e.x-r.left,d=e.y-r.top,f=h-(h-this.options.canvasOffset.x)*(c/l),p=d-(d-this.options.canvasOffset.y)*(c/l);this.options.canvasOffset.x=f,this.options.canvasOffset.y=p;const g=this.options.canvasZoom,u=c*100;this.options.canvasZoom=u,this._zoomEnd(g,u)&&await ft(200)}finally{this._zooming=!1}}}_zoomEnd(t,e){this.updateViewBoxInfo();let n=!1;return t<=40?e>40&&(this.options.performanceMode&&(this.updateShouldRenderGraphData(!0),n=!0),this.options.showEasyView=!1,C("zoom:hide:showEasyView",t,e),this.updateElementLines()):t>40&&e<=40&&(C("zoom:show:showEasyView",t,e),this.options.performanceMode&&(this.options.showEasyView=!0)),this.updateEditingControllerView(),this.emitEvent(A.onZoomEnd,this.options.canvasZoom),this._dataUpdated(),n}setZoom(t,e){const n=Math.floor(t-this.options.canvasZoom);this.zoom(n,e)}getCanvasXyByClientXy(t){const e=this.$dom.getBoundingClientRect(),n={x:t.x-e.left,y:t.y-e.top};return this.getCanvasXyByViewXy(n)}getCanvasXyByViewXy(t){if(this._rgAsConnectArea)return t;const e=this.options.canvasZoom/100,n={x:t.x-this.options.canvasOffset.x,y:t.y-this.options.canvasOffset.y};return{x:n.x/e,y:n.y/e}}getViewXyByCanvasXy(t){const e=this.options.canvasZoom/100;return{x:t.x*e+this.options.canvasOffset.x,y:t.y*e+this.options.canvasOffset.y}}}class cn extends ln{constructor(a,t){super(a,t)}moveToCenter(a){const t=this.getNodesCenter(a);C("center:",t.x,t.y);const e=this.options.canvasZoom;this.options.canvasZoom=100,this.setCanvasCenter(t.x,t.y),this.setZoom(e),this._dataUpdated()}zoomToFit(a){const t=this.getStuffSize(a),e=50,n=this.options.viewSize.width/(t.width+e*2),o=this.options.viewSize.height/(t.height+e*2),s=Math.min(n,o,1);C("zoomToFit:",{stuffSize:t,zoomPercent:s,zoomPercentX:n,zoomPercentY:o,viewSize:this.options.viewSize}),this.moveToCenter(a),this.setZoom(s*100),this._dataUpdated()}enableNodeXYAnimation(){this.options.enableNodeXYAnimation=!0,this._dataUpdated()}disableNodeXYAnimation(){this.options.enableNodeXYAnimation=!1,this._dataUpdated()}enableCanvasAnimation(){this.options.enableCanvasTransformAnimation=!0,this._dataUpdated()}disableCanvasAnimation(){this.options.enableCanvasTransformAnimation=!1,this._dataUpdated()}}class hn extends cn{constructor(t,e){super(t,e);S(this,"_mainGroupNodes",[]);S(this,"layouter")}async doLayout(t){const e=Date.now()-this.prevAddNodeTimestamp;e<300&&(this.options.canvasOpacity=.01,this._dataUpdated(),await ft(300-e)),await this._doLayout(t),this.options.canvasOpacity=1,this._dataUpdated()}async _doLayout(t){this.updateNodesVisibleProperty(),C("node size\uFF1A",this.graphData.nodes.length);let e=this.graphData.rootNode;if(t&&(e=typeof t=="string"?this.getNodeById(t):t,!e))throw new Error("custom rootNode not found, id:"+t);e||(e=this.graphData.nodes[0],this._rgAsConnectArea||(console.error("No root node, use first node as root:",e),console.error("You can set rootNode call doLayout(rootNode | nodeId) with a node id"))),this.graphData.rootNode=e;const n=this.createLayout(this.options.layout,!0);this._mainGroupNodes=[],n.layoutOptions.layoutName==="force"?(n.onFinish(()=>{this.emitEvent(A.onForceLayoutFinish)}),await ft(100),C("doLayout:start force:",this.graphData.nodes.length),n.placeNodes(this.graphData.nodes,e)):(e&&this.findGroupNodes(e,this._mainGroupNodes),n.placeNodes(this._mainGroupNodes,e),C("doLayout:placeOtherNodes"),this.placeOtherNodes(),C("doLayout:placeOtherNodes ok!")),this.updateElementLines()}refresh(t=!0){this.resetViewSize(!0),this._dataUpdated(),t&&this.doLayout(),this.updateElementLines(),this._dataUpdated()}placeOtherNodes(){const t=this.options.placeSingleNode&&this.options.layout.layoutName!=="fixed",e=[...this._mainGroupNodes],n=[],o=[];this.graphData.nodes.forEach(s=>{e.includes(s)||(this.options.placeSingleNode&&s.fixed!==!0?this.getNodeRelatedNodes(s).length===0&&(t&&(s.x=Math.floor(Math.random()*200)-100,s.y=Math.floor(Math.random()*200)-100,s.lot||(s.lot={childs:[]})),s.lot.placed=!0,o.push(s)):n.push(s))}),t&&this.placeSingleNodes(o),t&&(this.options.placeOtherGroup&&this.placeOtherGroup(n,e),this._dataUpdated(),this.options.layout.layoutName==="force"&&(this.stopAutoLayout(),setTimeout(()=>{this.startAutoLayout()},500)))}placeSingleNodes(t){if(t.length>0){C("sigle nodes:",t.length);const e=new yt({layoutName:"force"},this.options,this);e.allNodes=this.graphData.nodes,e.fastStart=!0,e.maxLayoutTimes=100,e.byLine=!1,e.placeNodes(t)}}placeOtherGroup(t,e){if(t.length>0){C("[placeOtherGroup]notPlacedNodes nodes:",t.length);const n=JSON.parse(JSON.stringify(this.options.layout)),o=t[0],s=this.createLayout(n);s.isMainLayouer=!1;const r=this.getStuffSize(e);C("[placeOtherGroup]placeOtherGroup:",s.layoutOptions.layoutName,"root:",o.text);let l=this.options.layout.layoutName.includes("tree")?300:600;if(s.layoutOptions.layoutName==="force"){const d=s;d.maxLayoutTimes=0,l=100}o.fixed?C("[placeOtherGroup]fixed root x,y:",o.x,o.y,o.text):(o.x=r.maxX+l,o.y=0,C("[placeOtherGroup]set root x,y:",o.x,o.y,o.text)),s.layoutOptions.fixedRootNode=!0;const c=[];this.findGroupNodes(o,c),C("[placeOtherGroup]thisGroupNodes:",t.length),s.requireLinks&&s.setLinks(this.getLinks()),s.placeNodes(c,o),e.push(...c);const h=[];t.forEach(d=>{e.includes(d)||h.push(d)}),this.options.placeOtherGroup&&this.placeOtherGroup(h,e),this._dataUpdated()}else C("[placeOtherGroup]thisGroupNodes:all is OK!")}toggleAutoLayout(){C("toggleAutoLayout:to:",this.options.layout.autoLayouting),this.options.layout.autoLayouting?this.stopAutoLayout():this.startAutoLayout()}startAutoLayout(){this.options.layout.autoLayouting=!0,this.options.layout.supportAutoLayout&&(C("startAutoLayout:"),this.layouter.autoLayout(!0))}stopAutoLayout(){this.options.layout.autoLayouting=!1,this.options.layout.supportAutoLayout&&(C("stopAutoLayout:"),this.layouter.stop())}createLayout(t,e=!1){const n=this.options;Gt(t);let o=null;if(t.layoutName==="tree"?o=new ce(t,n,this):t.layoutName==="center"?o=new he(t,n,this):t.layoutName==="circle"?o=new de(t,n,this):t.layoutName==="force"?o=new yt(t,n,this):t.layoutName==="fixed"?o=new fe(t,n,this):t.layoutName==="smart-tree"?o=new Re(t,n,this):t.layoutName==="folder"&&(o=new ge(t,n,this)),!o)throw new Error("unknown layout: "+t.layoutName);return o.requireLinks&&o.setLinks(this.getLinks()),o.isMainLayouer=e,o.layoutOptions.fixedRootNode=!0,e&&(n.layout.supportAutoLayout=o.autoLayout!==void 0,this.layouter=o),o}}const dn=async(i,a)=>{const t=i||document.documentElement;a?await fn(t):await gn()},fn=async i=>{i.requestFullscreen?await i.requestFullscreen():i.mozRequestFullScreen?await i.mozRequestFullScreen():i.webkitRequestFullscreen?await i.webkitRequestFullscreen():i.msRequestFullscreen&&await i.msRequestFullscreen()},gn=async()=>{document.exitFullscreen?await document.exitFullscreen():document.mozCancelFullScreen?await document.mozCancelFullScreen():document.webkitExitFullscreen?await document.webkitExitFullscreen():document.msExitFullscreen&&await document.msExitFullscreen()};class un extends hn{constructor(t,e){super(t,e);S(this,"prevClickTime",0);S(this,"nodeXYBeforeDrag",{});S(this,"movingListener");S(this,"_currentMovingLineTarget",null);S(this,"step1EventTime",0);S(this,"onCreateLineCallback");S(this,"_wheelAction",0);S(this,"_wheelBuff",0);S(this,"_fullscreenchangeHandler")}setCheckedNode(t){this.options.checkedNodeId=t}setCheckedLinkAndLine(t,e){this.options.checkedLinkId=t?t.seeks_id:"",this.options.checkedLineId=e?e.id:""}setCheckedLine(t){const e=this.getLinkByLine(t);this.options.checkedLinkId=e?e.seeks_id:"",this.options.checkedLineId=t?t.id:""}clearChecked(){this.options.checkedNodeId="",this.options.checkedLineId="",this.options.checkedLinkId=""}clearSelected(){this.graphData.nodes.forEach(t=>{t.selected=!1}),this.getLines().forEach(t=>{t.selected=!1}),this.graphData.fakeLines.forEach(t=>{t.selected=!1})}updateNodeOffsetSize(t,e,n){const o=this.getNodeById(t);if(!o){console.warn("Node not found for resize handling:",t);return}const s=o.el.offsetWidth,r=o.el.offsetHeight;(s!==e||r!==n)&&(C("Node resized:",o.id,s,",",r," > ",e,",",n),o.el.offsetWidth=e,o.el.offsetHeight=n,this._dataUpdated())}onNodeClick(t,e){if(Date.now()-this.prevClickTime<200){C("[node]click abort : time < 200");return}if(this.prevClickTime=Date.now(),this.options.creatingLinePlot){this.onNodeClickWhenCreatingLinePlot(t);return}C("[node]node click",t.text,this.options.creatingLinePlot);const n=t.disablePointEvent===void 0?this.options.disableNodePointEvent:t.disablePointEvent;!e.shiftKey&&!n&&(this.options.checkedLinkId="",this.options.checkedLineId="",this.setCheckedNode(t.id)),this.emitEvent(A.onNodeClick,t,e),this.prevClickTime=Date.now()}onNodeDragStart(t,e){if(vt(e)||!t||(this.options.disableDragNode||t.disableDrag)&&e.target&&!e.target.closest(".rg-node-drag-handler"))return;isNaN(t.x)&&(t.x=0),isNaN(t.y)&&(t.y=0),t.dragging=!0,this.setEditingLine(null,null),this.options.checkedLinkId="",this.options.checkedLineId="";const n=(r,l,c)=>{t.dragging=!1,this.options.editingReferenceLine.show=!1,this.onNodeDraged(t,r,l,c),s&&this.emitEvent(A.onNodeDragEnd,t,c,r,l),this._dataUpdated()};this.nodeXYBeforeDrag={},this.nodeXYBeforeDrag[t.id]={x:t.x,y:t.y};for(const r of this.options.editingController.nodes)this.nodeXYBeforeDrag[r.id]={x:r.x,y:r.y};const o={x:t.x,y:t.y};let s=!1;Z.startDrag(e,o,n,(r,l,c)=>{if(!s)Math.abs(r)+Math.abs(l)>4&&(C("[node]onNodeDragStart...",nt(e),e),this.emitEvent(A.onNodeDragStart,t,e),s=!0);else{let h=r/(this.options.canvasZoom/100)+c.x,d=l/(this.options.canvasZoom/100)+c.y,f=h-o.x,p=d-o.y;const g=this.emitEvent(A.onNodeDragging,t,h,d,f,p,e);g&&(typeof g.x=="number"&&(h=g.x,f=h-o.x),typeof g.y=="number"&&(d=g.y,p=d-o.y)),this.options.useHorizontalView&&(h=l/(this.options.canvasZoom/100)+c.x,d=-r/(this.options.canvasZoom/100)+c.y),this.draggingSelectedNodes(t,h,d,f,p)}this.updateElementLines(),this._dataUpdated()})}onNodeDraged(t,e,n,o){if(e===0&&n===0){C("[node]node click by drag"),this.onNodeClick(t,o),this.onNodeDragEnd(t,o,e,n);return}Math.abs(e)+Math.abs(n)>6?(this.prevClickTime=Date.now(),setTimeout(()=>{C("[node]onDragEnd2"),this.onNodeDragEnd(t,o,e,n)},100)):(C("[node]onDragEnd1"),this.onNodeDragEnd(t,o,e,n))}onNodeDragEnd(t,e,n,o){this.updateElementLines()}onLineClick(t,e,n){e||(e=this.getLinkByLineId(t.id)),C("onLineClick:","line:",t,"link:",e),(t.disablePointEvent===void 0?this.options.disableLinePointEvent:t.disablePointEvent)||(this.setCheckedNode(""),this.setCheckedLinkAndLine(e,t)),this.emitEvent(A.onLineClick,t,e,n),this._dataUpdated()}expandOrCollapseNode(t,e){e.stopPropagation(),t.expanded===!1?this.expandNode(t,e):this.collapseNode(t,e)}expandNode(t,e){C("onNodeExpand:",t),t.expanded=!0,C("relayout check:",this.options.reLayoutWhenExpandedOrCollapsed),this.updateNodesVisibleProperty(),this.doLayoutWhenExpandedOrCollapsed(),this.updateElementLines(),this._dataUpdated(),this.emitEvent(A.onNodeExpand,t,e)}collapseNode(t,e){C("onNodeCollapse:",t),t.expanded=!1,C("relayout check:",this.options.reLayoutWhenExpandedOrCollapsed),this.updateNodesVisibleProperty(),this.doLayoutWhenExpandedOrCollapsed(),this.updateElementLines(),this._dataUpdated(),this.emitEvent(A.onNodeCollapse,t,e)}doLayoutWhenExpandedOrCollapsed(){this.options.reLayoutWhenExpandedOrCollapsed&&this.options.layout.layoutName!=="force"&&(C("relayout..."),this.doLayout())}onCanvasDragEnd(t){this.updateEditingControllerView(),this.updateShouldRenderGraphData(),this.emitEvent(A.onCanvasDragEnd,t)}onCanvasClick(t){this.options.creatingLinePlot&&this.onCanvasClickWhenCreatingLinePlot(t),this.emitEvent(A.onCanvasClick,t)}onCanvasSelectionEnd(t,e){this.emitEvent(A.onCanvasSelectionEnd,t,e),C("[canvas]onCanvasSelectionEnd:",t),this._dataUpdated()}startCreatingNodePlot(t,e){this.options.newNodeTemplate=xt(JSON.parse(JSON.stringify(It)),this.options),this.options.creatingNodePlot=!0;const n=nt(t);this.options.showTemplateNode=!n;let o=(g,u)=>{const x=this.options.newNodeTemplate,y={width:x.width||96,height:x.height||96};this.options.newNodeTemplate.x=g-y.width/2,this.options.newNodeTemplate.y=u-y.height/2,this._dataUpdated()},s=(g,u,x)=>{const y="s-"+Date.now();this.addNodes([{id:y,text:this.options.newNodeTemplate.text,x:g,y:u}])};e&&e.templateText&&(this.options.newNodeTemplate.text=e.templateText),e&&e.templateClassName&&(this.options.newNodeTemplate.className=e.templateClassName),e&&e.templateNode&&Object.keys(e.templateNode).forEach(g=>{this.options.newNodeTemplate[g]=e.templateNode[g]}),e&&e.templateMove&&(o=e.templateMove),e&&e.onCreateNode&&(s=e.onCreateNode);const r=this.$dom.getBoundingClientRect();C("[CreatingNodePlot]startCreatingNodePlot:");const l=mt(t),c=l.clientX-r.x+10,h=l.clientY-r.y+10;n||o(c,h);const d=g=>{const u=this.$dom.getBoundingClientRect();C("[CreatingNodePlot]objectTemplateMove");const x=g.clientX-u.x,y=g.clientY-u.y;o(x,y)},f=g=>{C("[CreatingNodePlot]user abort!"),this.$dom.removeEventListener("mousemove",d),this.$dom.removeEventListener("click",p),this.$dom.removeEventListener("contextmenu",f),this.options.creatingNodePlot=!1},p=g=>{let u=!1;if(this.options.creatingNodePlot||(u=!0),this.$dom.removeEventListener("mousemove",d),this.$dom.removeEventListener("click",p),this.$dom.removeEventListener("contextmenu",f),this.options.creatingNodePlot=!1,u){C("[CreatingNodePlot]action be abort!");return}const x=mt(g),y=x.clientX-r.x+10,L=x.clientY-r.y+10;if(Math.abs(c-y)<30&&Math.abs(h-L)<30){C("[CreatingNodePlot]create node be abort!");return}const m=this.getCanvasXyByClientXy({x:x.clientX,y:x.clientY});C("[CreatingNodePlot]objectBePlaced:",m),s(m.x,m.y,this.options.newNodeTemplate),this._dataUpdated()};setTimeout(()=>{this.$dom.addEventListener("click",p),this.$dom.addEventListener("contextmenu",f)},300),n||this.$dom.addEventListener("mousemove",d)}startCreatingLinePlot(t,e){const n=nt(t);e&&e.onCreateLine&&(this.onCreateLineCallback=e.onCreateLine);const o=ht({from:"newRelationTemplate-from",to:"newRelationTemplate-to",color:"",text:"new line"});e&&e.template&&Object.assign(o,e.template),this.options.newLineTemplate=o,this.options.newLinkTemplate.fromNode=null,this.options.newLinkTemplate.toNode.id="",this.options.newLinkTemplate.toNode.targetType=F.Node,e&&e.fromNode&&(this.options.newLinkTemplate.toNode.x=e.fromNode.x+50,this.options.newLinkTemplate.toNode.y=e.fromNode.y+50,this.options.newLinkTemplate.fromNode=e.fromNode,this.step1EventTime=Date.now()),this.options.creatingLinePlot=!0,this.options.newLinkTemplate.toNodeObject=null,this.options.newLineTemplate.disablePointEvent=!0,this.options.newLinkTemplate.toNode.el.offsetWidth=2,this.options.newLinkTemplate.toNode.el.offsetHeight=2,C("[CreatingLinePlot]startCreatingLinePlot:isTouchEvent:",n),this._currentMovingLineTarget=this.options.newLinkTemplate.toNode,n||(C("[CreatingLinePlot]Listener move"),this.movingListener&&this.$dom.removeEventListener("mousemove",this.movingListener),this.movingListener=this.onMovingWhenCreatingLinePlot.bind(this),this.$dom.addEventListener("mousemove",this.movingListener)),this.dataUpdated()}stopCreatingLinePlot(){C("[CreatingLinePlot]stop CreatingLinePlot!"),this.options.creatingLinePlot=!1,this.options.newLinkTemplate.fromNode=null,this.options.newLinkTemplate.toNodeObject=null,this.onCreateLineCallback=void 0,this.$dom.removeEventListener("mousemove",this.movingListener),this.movingListener=void 0,this._currentMovingLineTarget=null,this._currentCreatingLineIsReverse=!1,this.options.nodeConnectController.show=!1,this._dataUpdated()}onMovingWhenCreatingLinePlot(t){C("[CreatingLinePlot]mousemove");const e=this.getCanvasXyByClientXy({x:t.clientX,y:t.clientY});this._currentMovingLineTarget&&(this._currentMovingLineTarget.x=e.x,this._currentMovingLineTarget.y=e.y,this.options.editingLineController.line&&this.updateEditingLineView());const n=t.target;this.options.newLinkTemplate.fromNode&&(this.options.newLinkTemplate.toNode.x=e.x,this.options.newLinkTemplate.toNode.y=e.y,this._dataUpdated());let o="",s=F.Node;const r=this.isNode(n);r&&(o=r.id,r===this.options.newLinkTemplate.fromNode?this.options.nodeConnectController.show=!1:(this.options.nodeConnectController.node=r,this.updateEditingConnectControllerView(),this.options.nodeConnectController.show=!0));const l=this.options.newLinkTemplate,c=n.closest(".rg-connect-ctl-handler");if(c){let h=this.options.nodeConnectController.node;C("[CreatingLinePlot]content point:",c.dataset.point);let d=c.dataset.point||"border";if(c.classList.contains("rg-connect-target")){const{width:f,height:p,x:g,y:u}=c.getBoundingClientRect(),x=this.getCanvasXyByClientXy({x:g,y:u}),y=this.options.canvasZoom/100,L={x:x.x,y:x.y,el:{offsetWidth:f/y,offsetHeight:p/y},nodeShape:1,id:c.dataset.targetId,targetData:JSON.parse(c.dataset.targetData||"{}"),targetType:c.dataset.targetType};console.log("[CreatingLinePlot]fakeNode:",JSON.stringify(L)),this.options.nodeConnectController.node=L,h=this.options.nodeConnectController.node,this.options.nodeConnectController.show=!1,d=c.dataset.point,this._currentMovingLineTarget&&(o=L.id,s=L.targetType,this._currentMovingLineTarget.nodeShape=L.nodeShape),this.updateEditingConnectControllerView()}else this._currentMovingLineTarget&&(s=F.Node);l.fromNode===this._currentMovingLineTarget?this.options.newLineTemplate.isReverse?this.options.newLineTemplate.fromJunctionPoint=d:this.options.newLineTemplate.toJunctionPoint=d:this.options.newLineTemplate.isReverse?this.options.newLineTemplate.fromJunctionPoint=d:this.options.newLineTemplate.toJunctionPoint=d,this._currentMovingLineTarget&&(n.dataset.innode==="true"?(this._currentMovingLineTarget.targetType=F.Node,this._currentMovingLineTarget.el.offsetWidth=5,this._currentMovingLineTarget.el.offsetHeight=5,this._currentMovingLineTarget.x=e.x,this._currentMovingLineTarget.y=e.y,this._currentMovingLineTarget.nodeShape=1,this._currentMovingLineTarget.rotate=0):(C("[CreatingLinePlot]content point:",h.el.offsetWidth,h.el.offsetHeight),this._currentMovingLineTarget.el.offsetWidth=h.el.offsetWidth,this._currentMovingLineTarget.el.offsetHeight=h.el.offsetHeight,this._currentMovingLineTarget.x=h.x,this._currentMovingLineTarget.y=h.y,this._currentMovingLineTarget.nodeShape=h.nodeShape||1,this._currentMovingLineTarget.rotate=0))}else C("[CreatingLinePlot]point:",n.dataset.point),this.options.newLineTemplate.isReverse?this.options.newLineTemplate.fromJunctionPoint=J.border:this.options.newLineTemplate.toJunctionPoint=J.border,this._currentMovingLineTarget&&(this._currentMovingLineTarget.el.offsetWidth=3,this._currentMovingLineTarget.el.offsetHeight=3,this._currentMovingLineTarget.rotate=0,s=F.Node);this._currentMovingLineTarget&&(o&&(this._currentMovingLineTarget.id=o),this._currentMovingLineTarget.targetType=s)}onCanvasClickWhenCreatingLinePlot(t){if(Date.now()-this.step1EventTime<500){C("[CreatingLinePlot]step1EventTime:",this.step1EventTime);return}if(!this.options.newLinkTemplate.fromNode){C("[CreatingLinePlot]CreatingLinePlot:fromNode not set!");return}let e=!1;if(!this.options.newLinkTemplate.toNodeObject){C("[CreatingLinePlot]CreatingLinePlot:toNodeObject not set!");const n=mt(t),o=this.getCanvasXyByClientXy({x:n.clientX,y:n.clientY});e=this.onCreateLine(this.options.newLinkTemplate.fromNode,o)}e!==!0&&this.stopCreatingLinePlot()}onNodeClickWhenCreatingLinePlot(t){this.options.newLinkTemplate.fromNode?(C("[CreatingLinePlot]step 2: set toNodeObjecct:",this.options.newLinkTemplate.fromNode,t),this.options.newLinkTemplate.toNodeObject=t,this.options.newLinkTemplate.toJunctionPoint=J.border,this.onCreateLine(this.options.newLinkTemplate.fromNode,t)!==!0&&this.stopCreatingLinePlot()):(C("[CreatingLinePlot]step 1: set fromNode:",t),this.options.newLinkTemplate.fromNode=t,this.options.newLinkTemplate.toNode.x=t.x+50,this.options.newLinkTemplate.toNode.y=t.y+50,this.step1EventTime=Date.now())}onCreateLine(t,e){C("[CreatingLinePlot][fire-event]onCreateLine:",t,e);const n=ht(this.options.newLineTemplate);this.options.newLineTemplate.isReverse?(n.from=e?e.id:"",n.to=t?t.id:"",n.isReverse=void 0,[t,e]=[e,t]):(n.from=t?t.id:"",n.to=e?e.id:""),n.disablePointEvent=!1;const o=this.emitEvent(A.beforeCreateLine,{lineJson:n,fromNode:t,toNode:e});if(C("[CreatingLinePlot]onCreateLine:abort-flag:",o),o===!0){C("[CreatingLinePlot]onCreateLine:abort!");return}if(this.onCreateLineCallback){C("[CreatingLinePlot]onCreateLine:callback"),this.options.newLineTemplate.disablePointEvent=!1;try{this.onCreateLineCallback(t,e,this.options.newLineTemplate)}catch(r){return console.warn("[Custom Reject Connect By Throw Error:",r),!1}}return C("[CreatingLinePlot]onCreateLine:emitEvent"),this.emitEvent(A.onLineBeCreated,{lineJson:n,fromNode:t,toNode:e})}isNode(t){const e=Lt(t,"rg-node-peel","rg-map");return e?this.getNodeById(e.dataset.id):void 0}isLine(t){const e=Lt(t,"rg-line-peel","rg-map");return e?this.getLineById(e.dataset.id):void 0}isLink(t){throw new Error("Please use isLine")}onContextmenu(t){this.stopCreatingLinePlot();let e="canvas",n=this.isNode(t.target);n?e="node":(n=this.isLine(t.target),n&&(e="line")),C("contextmenu:objectType",e,n);const o=mt(t),s=this.getCanvasXyByClientXy({x:o.clientX,y:o.clientY}),r=this.getViewXyByCanvasXy(s);this.emitEvent(A.onContextmenu,t,e,n,s,r)}async fullscreen(t){t!==this.options.fullscreen&&(C("fullscreen:newValue:",t),t===void 0&&(t=!this.options.fullscreen),await dn(this.$dom,t),this.emitEvent(A.onFullscreen,t))}focusNodeById(t){let e;this.graphData.nodes.forEach(n=>{n.id===t&&(e=n)}),e&&this.handleSelect(e)}focusRootNode(){C("relation-graph:focusRootNode"),this.graphData.rootNode&&this.handleSelect(this.graphData.rootNode)}handleSelect(t){C("checked:",t),this.setZoom(100);const e=t.width||50,n=t.height||50,o=t.x*-1+this.options.viewSize.width/2-e/2,s=t.y*-1+this.options.viewSize.height/2-n/2;this.setCanvasOffset(o,s),this.options.checkedNodeId=t.id,this.updateViewBoxInfo()}onMouseWheel(t){if(!t.ctrlKey&&!t.metaKey&&(this.options.disableWheelEvent||this.options.wheelEventAction==="none"))return!0;try{t.preventDefault(),t.stopPropagation()}catch{}let e=t.deltaY,n=t.deltaX;e===void 0&&(e=t.wheelDelta),n===void 0&&(n=t.wheelDelta),this._onMouseWheel(t,n,e)}_onMouseWheel(t,e,n){const o=t.ctrlKey||t.metaKey;if(!o&&this.options.wheelEventAction==="scroll"){let s=0,r=0;const l=e===0?0:e>0?-1:1,c=n===0?0:n>0?-1:1;Math.abs(e)>Math.abs(n)?(s=1,r=Math.abs(n)/Math.abs(e)):(r=1,s=Math.abs(e)/Math.abs(n));const h=l*this.options.mouseWheelSpeed*5*s,d=c*this.options.mouseWheelSpeed*5*r,f=this.emitEvent(A.beforeScrollStart,h,d,t);if(C("[scroll]","abortScroll:",f),f===!0)return;this.scrollView(h,d)}else if(!(!o&&this.options.wheelEventAction==="none")){const s={x:t.clientX,y:t.clientY},r=n===0?0:n>0?-1:1,l=this.options.mouseWheelSpeed*r;this.zoom(l,s,t)}}scrollView(t,e){this.setCanvasOffset(this.options.canvasOffset.x+t,this.options.canvasOffset.y+e),this.updateEditingControllerView(),this.updateShouldRenderGraphData()}onLineDragStart(t,e){C("onLineDragStart...");const n=this.getLinkByLine(t),o={x:n.fromNode.x,y:n.fromNode.y},s={x:n.toNode.x,y:n.toNode.y},r=(l,c,h,d,f)=>{n.fromNode.x=o.x+l/(this.options.canvasZoom/100),n.fromNode.y=o.y+c/(this.options.canvasZoom/100),n.toNode.x=s.x+l/(this.options.canvasZoom/100),n.toNode.y=s.y+c/(this.options.canvasZoom/100),this.updateEditingControllerView(),this._dataUpdated()};Z.startDrag(e,{x:0,y:0},(...l)=>{this.onLineDragEnd(...l)},r)}onLineDragEnd(t,e,n){C("onLineDragEnd"),this.updateElementLines()}onCanvasDragStart(t){if(!vt(t)){if(this.options.disableDragCanvas){this.onCanvasClick(t);return}if(this.options.selectionMode||t.shiftKey){this.startCreateSelection(t);return}if(!this.options.disableDragLine){const e=this.isLine(t.target);if(e){this.onLineDragStart(e,t);return}}this.startMoveCanvas(t)}}startMoveCanvas(t,e=!1){let n;if(nt(t)){let r,l=1;n=(c,h,d,f,p)=>{const g=p.touches||p.targetTouches,u=g[0];if(g&&g.length>1){p.preventDefault();const x=g[1];r||(r={x:x.clientX,y:x.clientY},l=this.options.canvasZoom);const y={x:u.clientX,y:u.clientY},L={x:x.clientX,y:x.clientY},m=Math.hypot(r.x-f.x,r.y-f.y),b=Math.hypot(L.x-y.x,L.y-y.y)/m,M=this.options.mouseWheelSpeed*b,N=l*M;this.setZoom(N,f),this._dataUpdated()}else{const x=u.clientX,y=u.clientY,L=x-f.x,m=y-f.y;if(this.options.useHorizontalView){const w=d.x+m,b=d.y-L;this.onCanvasDragging(w,b,L,m)}else{const w=d.x+L,b=d.y+m;this.onCanvasDragging(w,b,m,L)}this.updateEditingControllerView(),this._dataUpdated()}}}else n=(r,l,c,h,d)=>{const f=c.x+r,p=c.y+l;this.onCanvasDragging(f,p,r,l),this.updateEditingControllerView(),this._dataUpdated()};const o={x:this.options.canvasOffset.x,y:this.options.canvasOffset.y};this.canvasDragging=!0;let s=e;Z.startDrag(t,o,(r,l,c)=>{this.canvasDragging=!1,this.onCanvasDragStop(r,l,c)},(r,l,c,h,d)=>{s?n(r,l,c,h,d):Math.abs(r)+Math.abs(l)>4&&(this.emitEvent(A.onCanvasDragStart,c,h,d),s=!0)})}onCanvasDragging(t,e,n,o){const s=this.emitEvent(A.onCanvasDragging,t,e,n,o);s!==!1&&(s&&(typeof s.x=="number"&&(t=s.x),typeof s.y=="number"&&(e=s.y)),this.setCanvasOffset(t,e))}onCanvasDragStop(t,e,n){if(this.options.creatingSelection){this.options.creatingSelection=!1,this.onCanvasSelectionEnd(this.options.selectionView,n);return}if(Math.abs(t)+Math.abs(e)<4){C("[canvas]onDragEnd as click2"),this._dataUpdated(),this.onCanvasClick(n);return}else C("[canvas]onDragEnd"),this.onCanvasDragEnd(n)}startCreateSelection(t){let e=!1;const n=(o,s,r,l,c)=>{if(!e&&Math.abs(o)+Math.abs(s)>6&&(e=!0,this.options.creatingSelection=!0,this.options.selectionView.x=l.x,this.options.selectionView.y=l.y),e){const h=this.getBoundingClientRect();o<0?(this.options.selectionView.x=l.x+o-h.x,this.options.selectionView.width=Math.abs(o)):(this.options.selectionView.x=l.x-h.x,this.options.selectionView.width=o),s<0?(this.options.selectionView.y=l.y+s-h.y,this.options.selectionView.height=Math.abs(s)):(this.options.selectionView.y=l.y-h.y,this.options.selectionView.height=s)}this._dataUpdated()};Z.startDrag(t,{x:0,y:0},(...o)=>{this.onCanvasDragStop(...o)},n)}addFullscreenListener(){this._fullscreenchangeHandler=()=>{let t=!1;document.fullscreenElement?(C("div entered fullscreen mode",document.fullscreenElement),this.$dom===document.fullscreenElement&&(C("relation-graph is fullscreen!"),t=!0)):C("div exited fullscreen mode"),t!==this.options.fullscreen&&(this.options.fullscreen=t,this._dataUpdated(),setTimeout(async()=>{this.updateViewBoxInfo(),this.moveToCenter(),this.zoomToFit(),C("relation-graph reset complete!"),this._dataUpdated()},500))},document.addEventListener("fullscreenchange",this._fullscreenchangeHandler)}removeFullscreenListener(){document.addEventListener("fullscreenchange",this._fullscreenchangeHandler)}async sleep(t){await ft(1e3)}}class pn extends un{constructor(a,t){super(a,t)}dataUpdated(){(this.isReact||this.options.showEasyView)&&this._dataUpdated()}setOptions(a){this._setOptions(a)}setRootNodeId(a){if(this.graphData.rootNode=this.graphData.nodes.find(t=>t.id===a),!this.graphData.rootNode)throw new Error("The root node [rootId] is not set! Or cannot get the root node:"+a+", If you don't have any nodes to display, you can simply set an invisible node: {id:'root', opacity:0}")}getRootNode(){return this.graphData.rootNode}setCheckedNode(a){this.options.checkedNodeId=a}getCheckedNode(){return this.getNodeById(this.options.checkedNodeId)}getCheckedLine(){if(!this.getLineById(this.options.checkedLineId))return this.getFakeLineById(this.options.checkedLineId)}getSelectedNodes(){return this.getNodes().filter(a=>a.selected)}getEditingNodes(){return[...this.options.editingController.nodes]}async setJsonData(a){this._setJsonData(a);const t=a.rootId;t&&(this.graphData.rootNode=this.graphData.nodes.find(e=>e.id===t)),!this.graphData.rootNode&&this.graphData.nodes.length>0&&(this.graphData.rootNode=this.graphData.nodes[0]),await this.doLayout()}async appendJsonData(a,t=!0){C("appendData:",a),this.loadGraphJsonData(a),t&&await this.doLayout()}async applyInitialData(a){await this.setJsonData(a),this.moveToCenter(),this.zoomToFit()}fitContentHeight(a=20){this.options.canvasOpacity=.01,this._dataUpdated();const t=this.getNodesViewInfo(),e=t.height,n=t.width,o=this.options.viewSize.width-a*2,s=t.minX+t.width/2,r=t.minY+t.height/2;console.warn("[fitContentHeight]nodesCenter:",s,r),this.setCanvasCenter(s,r);const l=Math.min(1,o/n),c=e*l+a*2;this.options.viewSize.height=c,this.options.viewHeight=c+"px",setTimeout(()=>{this.setZoom(l*100),this.moveToCenter(),this.options.canvasOpacity=1,this._dataUpdated()},200)}}class yn{constructor(a){S(this,"$evCanvasCtx");S(this,"mediaDPR");S(this,"viewScale",1);S(this,"offset",{x:0,y:0});const t=a.getContext("2d");if(!t)throw new Error("\u65E0\u6CD5\u83B7\u53D6 Canvas 2D \u4E0A\u4E0B\u6587");this.$evCanvasCtx=t,this.mediaDPR=window.devicePixelRatio||1}setSize(a,t){const e=this.$evCanvasCtx.canvas;e.width=a*this.mediaDPR,e.height=t*this.mediaDPR,e.style.width=`${a}px`,e.style.height=`${t}px`,this.$evCanvasCtx.setTransform(this.mediaDPR,0,0,this.mediaDPR,0,0),this.applyCurrentViewTransform()}setScale(a){this.viewScale=a,this.applyCurrentViewTransform()}applyCurrentViewTransform(){this.$evCanvasCtx.setTransform(this.mediaDPR,0,0,this.mediaDPR,0,0),this.$evCanvasCtx.scale(this.viewScale,this.viewScale)}setViewOffset(a,t){this.offset.x=a/this.viewScale,this.offset.y=t/this.viewScale}beforeDraw(){}evDrawNode4Rect(a,t,e,n,o,s,r=5){const l=this.$evCanvasCtx,c=this.offset.x+a,h=this.offset.y+t;let d=Math.max(0,r);e<2*d&&(d=e/2),n<2*d&&(d=n/2),l.beginPath(),l.globalAlpha=s,d===0?l.rect(c,h,e,n):(l.moveTo(c+d,h),l.arcTo(c+e,h,c+e,h+d,d),l.arcTo(c+e,h+n,c+e-d,h+n,d),l.arcTo(c,h+n,c,h+n-d,d),l.arcTo(c,h,c+d,h,d),l.closePath()),l.fillStyle=o,l.fill(),l.globalAlpha=1}evDrawNode4Circle(a,t,e,n,o,s){const r=this.$evCanvasCtx,l=this.offset.x+a+e/2,c=this.offset.y+t+n/2;r.beginPath(),r.globalAlpha=s,r.ellipse(l,c,e/2,n/2,0,0,2*Math.PI),r.fillStyle=o,r.fill(),r.globalAlpha=1}evDrawLine(a,t,e,n){const o=this.$evCanvasCtx;o.beginPath(),o.globalAlpha=n,this.evDrawSvgPathOnCanvas(o,a),o.strokeStyle=e,o.lineWidth=t*this.viewScale<.5?.5/this.viewScale:t,o.stroke(),o.globalAlpha=1}getPointValue(a,t,e){return e?a+parseFloat(t):parseFloat(t)}evDrawSvgPathOnCanvas(a,t){const e=t.match(/[a-zA-Z][^a-zA-Z]*/g);if(!e)return;let n=0,o=0,s=0,r=0,l=0,c=0,h=0,d=0,f="";a.beginPath(),e.forEach(p=>{const g=p.trim(),u=g.charAt(0),y=g.substring(1).trim().split(/[ ,]+/).filter(_=>_!=="").map(parseFloat);let L=0,m=0,w=0,b=0,M=0,N=0,O=0,E=0,T=0,k=0,P=0;switch(u){case"M":n=y[0],o=y[1],s=n,r=o,a.moveTo(n+this.offset.x,o+this.offset.y);for(let _=2;_<y.length;_+=2)n=y[_],o=y[_+1],a.lineTo(n+this.offset.x,o+this.offset.y);break;case"L":for(let _=0;_<y.length;_+=2)n=y[_],o=y[_+1],a.lineTo(n+this.offset.x,o+this.offset.y);break;case"l":for(let _=0;_<y.length;_+=2)n+=y[_],o+=y[_+1],a.lineTo(n+this.offset.x,o+this.offset.y);break;case"H":for(let _=0;_<y.length;_++)n=y[_],a.lineTo(n+this.offset.x,o+this.offset.y);break;case"h":for(let _=0;_<y.length;_++)n+=y[_],a.lineTo(n+this.offset.x,o+this.offset.y);break;case"V":for(let _=0;_<y.length;_++)o=y[_],a.lineTo(n+this.offset.x,o+this.offset.y);break;case"v":for(let _=0;_<y.length;_++)o+=y[_],a.lineTo(n+this.offset.x,o+this.offset.y);break;case"C":for(let _=0;_<y.length;_+=6)w=y[_],b=y[_+1],M=y[_+2],N=y[_+3],L=y[_+4],m=y[_+5],a.bezierCurveTo(w+this.offset.x,b+this.offset.y,M+this.offset.x,N+this.offset.y,L+this.offset.x,m+this.offset.y),n=L,o=m,l=M,c=N;break;case"c":for(let _=0;_<y.length;_+=6)w=n+y[_],b=o+y[_+1],M=n+y[_+2],N=o+y[_+3],L=n+y[_+4],m=o+y[_+5],a.bezierCurveTo(w+this.offset.x,b+this.offset.y,M+this.offset.x,N+this.offset.y,L+this.offset.x,m+this.offset.y),l=M,c=N,n=L,o=m;break;case"S":for(let _=0;_<y.length;_+=4)f.match(/[CS]/i)?(w=2*n-l,b=2*o-c):(w=n,b=o),M=y[_],N=y[_+1],L=y[_+2],m=y[_+3],a.bezierCurveTo(w+this.offset.x,b+this.offset.y,M+this.offset.x,N+this.offset.y,L+this.offset.x,m+this.offset.y),n=L,o=m,l=M,c=N;break;case"s":for(let _=0;_<y.length;_+=4)f.match(/[CS]/i)?(w=2*n-l,b=2*o-c):(w=n,b=o),M=n+y[_],N=o+y[_+1],L=n+y[_+2],m=o+y[_+3],a.bezierCurveTo(w+this.offset.x,b+this.offset.y,M+this.offset.x,N+this.offset.y,L+this.offset.x,m+this.offset.y),l=M,c=N,n=L,o=m;break;case"Q":for(let _=0;_<y.length;_+=4)w=y[_],b=y[_+1],L=y[_+2],m=y[_+3],a.quadraticCurveTo(w+this.offset.x,b+this.offset.y,L+this.offset.x,m+this.offset.y),n=L,o=m,h=w,d=b;break;case"q":for(let _=0;_<y.length;_+=4)w=n+y[_],b=o+y[_+1],L=n+y[_+2],m=o+y[_+3],a.quadraticCurveTo(w+this.offset.x,b+this.offset.y,L+this.offset.x,m+this.offset.y),h=w,d=b,n=L,o=m;break;case"T":for(let _=0;_<y.length;_+=2)f.match(/[QT]/i)?(w=2*n-h,b=2*o-d):(w=n,b=o),L=y[_],m=y[_+1],a.quadraticCurveTo(w+this.offset.x,b+this.offset.y,L+this.offset.x,m+this.offset.y),n=L,o=m,h=w,d=b;break;case"t":for(let _=0;_<y.length;_+=2)f.match(/[QT]/i)?(w=2*n-h,b=2*o-d):(w=n,b=o),L=n+y[_],m=o+y[_+1],a.quadraticCurveTo(w+this.offset.x,b+this.offset.y,L+this.offset.x,m+this.offset.y),h=w,d=b,n=L,o=m;break;case"A":for(let _=0;_<y.length;_+=7)O=y[_],E=y[_+1],T=y[_+2],k=y[_+3],P=y[_+4],L=y[_+5],m=y[_+6],this.drawArc(a,n,o,O,E,T,k,P,L,m),n=L,o=m;break;case"a":for(let _=0;_<y.length;_+=7)O=y[_],E=y[_+1],T=y[_+2],k=y[_+3],P=y[_+4],L=n+y[_+5],m=o+y[_+6],this.drawArc(a,n,o,O,E,T,k,P,L,m),n=L,o=m;break;case"Z":case"z":a.closePath(),n=s,o=r;break;default:console.warn(`\u672A\u652F\u6301\u7684SVG\u547D\u4EE4\u5B57\u7B26: ${u}`)}u.match(/[CSQT]/i)?f=u:f=""})}drawArc(a,t,e,n,o,s,r,l,c,h){if(n=Math.abs(n),o=Math.abs(o),n===0||o===0){a.lineTo(c+this.offset.x,h+this.offset.y);return}const d=s%360*Math.PI/180,f=Math.sin(d),p=Math.cos(d),g=p*(t-c)/2+f*(e-h)/2,u=-f*(t-c)/2+p*(e-h)/2,x=g*g/(n*n)+u*u/(o*o);x>1&&(n*=Math.sqrt(x),o*=Math.sqrt(x));let y=(r===l?-1:1)*Math.sqrt(Math.max(0,(n*n*o*o-n*n*u*u-o*o*g*g)/(n*n*u*u+o*o*g*g)));isNaN(y)&&(y=0);const L=y*n*u/o,m=y*-o*g/n,w=p*L-f*m+(t+c)/2,b=f*L+p*m+(e+h)/2,M=(g-L)/n,N=(u-m)/o,O=(-g-L)/n,E=(-u-m)/o;let T=Math.atan2(N,M),k=Math.atan2(N*O-M*E,M*O+N*E);l===0&&k>0?k-=2*Math.PI:l===1&&k<0&&(k+=2*Math.PI);const P=T+k;a.ellipse?a.ellipse(w+this.offset.x,b+this.offset.y,n,o,d,T,P,l===0):(console.warn("ctx.ellipse is not supported. Arc will be drawn as a line."),a.lineTo(c+this.offset.x,h+this.offset.y))}}class mn extends pn{constructor(t,e){super(t,e);S(this,"$easyViewCanvas");S(this,"rgWebglCanvas");S(this,"easyViewUpdating",!1);S(this,"easyViewUpdateTimer");S(this,"easyViewOffset",{x:0,y:0})}setEasyViewCanvas(t){this.$easyViewCanvas=t,this.rgWebglCanvas=new yn(t)}startUpdateTask(){this.updateEasyView(),requestAnimationFrame(this.startUpdateTask.bind(this))}updateEasyView(){this.updateMiniView(),this.options.performanceMode&&(!this.options.showEasyView||requestAnimationFrame(this._updateEasyView.bind(this)))}_updateEasyView(t){try{this._updateShouldRenderGraphData(),this.evDosomethingBeforeDraw(),this.evDrawAllLines(),this.evDrawAllNodes()}catch(e){console.error(e)}}evDosomethingBeforeDraw(){const t=this.$easyViewCanvas.getBoundingClientRect(),e=t.width,n=t.height;this.$easyViewCanvas.width=e,this.$easyViewCanvas.height=n,this.rgWebglCanvas.setSize(e,n),C("updateEasyView",e,n);const o=this.options.canvasZoom/100;this.rgWebglCanvas.setScale(o),this.easyViewOffset.x=this.options.canvasOffset.x,this.easyViewOffset.y=this.options.canvasOffset.y,this.rgWebglCanvas.setViewOffset(this.easyViewOffset.x,this.easyViewOffset.y),this.rgWebglCanvas.beforeDraw()}evDrawAllNodes(){for(const t of this.graphData.nodes)!(t.rgShouldRender!==!1&&t.rgCalcedVisible&&t.opacity!==0)||this.evDrawNode(t)}evDrawNode(t){t.nodeShape===Pt.circle?this.evDrawNode4Circle(t):this.evDrawNode4Rect(t)}getNodeColor(t){const e=t.color||this.options.defaultNodeColor||"#dddddd";return e==="transparent"?"rgba(204,204,204,0.55)":e.toLowerCase()==="#ffffff"||e.toLowerCase()==="white"||e.replace(/ /g,"").includes("255,255,255")?"#cccccc":e}evDrawNode4Rect(t){const e=t.el.offsetWidth,n=t.el.offsetHeight,o=t.opacity||1,s=this.getNodeColor(t),r=t.borderRadius===void 0?3:t.borderRadius;this.rgWebglCanvas.evDrawNode4Rect(t.x,t.y,e,n,s,o,r)}evDrawNode4Circle(t){const e=t.el.offsetWidth,n=t.el.offsetHeight,o=t.opacity||1,s=this.getNodeColor(t);this.rgWebglCanvas.evDrawNode4Circle(t.x,t.y,e,n,s,o)}evDrawAllLines(){for(const t of this.runtimeDATA4Links){const e=t.fromNode.rgShouldRender!==!1&&t.fromNode.opacity!==0&&t.fromNode.rgCalcedVisible,n=t.toNode.rgShouldRender!==!1&&t.toNode.opacity!==0&&t.toNode.rgCalcedVisible;!e&&!n||this.evDrawLine(t,t.line)}}evDrawLine(t,e){const n=this.createLineDrawInfo(t,e),o=e.opacity||1,s=e.lineWidth||1,r=e.color||this.options.defaultLineColor||"#888888";this.rgWebglCanvas.evDrawLine(n.pathData,s,r,o)}getPointValue(t,e,n){return n?t+parseFloat(e):parseFloat(e)}}class vn extends mn{constructor(){super(...arguments);S(this,"_onResizing");S(this,"_onResizeEnd");S(this,"_startPoint",{x:0,y:0});S(this,"_startSize",{x:0,y:0,width:0,height:0});S(this,"_resizeType","l");S(this,"nodeStartSizeMap",new WeakMap);S(this,"resizeMiniLimit",{width:10,height:10});S(this,"_currentCreatingLineIsReverse",!1);S(this,"_startCreateLineFromNodeTime",0)}setEditingNodes(t){this.options.editingController.nodes.forEach(e=>{e.selected=!1}),this.options.editingController.nodes.splice(0,this.options.editingController.nodes.length),this.options.editingController.nodes.push(...t),this.options.editingController.show=this.options.editingController.nodes.length>0,this.updateEditingControllerView()}addEditingNode(t){this.options.editingController.nodes.forEach(e=>{e.selected=!1}),this.options.editingController.show=!0,this.options.editingController.nodes.push(t),this.updateEditingControllerView()}removeEditingNode(t){this.options.editingController.nodes.forEach(e=>{e.selected=!1}),this.options.editingController.nodes.splice(this.options.editingController.nodes.indexOf(t),1),this.options.editingController.show=this.options.editingController.nodes.length>0,this.updateEditingControllerView()}toggleEditingNode(t){this.options.editingController.nodes.forEach(e=>{e.selected=!1}),this.options.editingController.nodes.includes(t)?this.removeEditingNode(t):this.addEditingNode(t)}updateEditingControllerView(){if(this.updateEditingLineView(),this.updateEditingConnectControllerView(),!this.options.editingController.show)return;this.options.editingController.nodes.length>1&&this.options.editingController.nodes.forEach(h=>{h.selected=!0});const{minX:t,minY:e,maxX:n,maxY:o}=this.getStuffSize(this.options.editingController.nodes),s=this.options.editingController.nodes.length>1?5:0,r=this.options.canvasZoom/100;let l=n-t,c=o-e;if(l<0&&(l=0),c<0&&(c=0),l>0&&c>0){const h=this.getViewXyByCanvasXy({x:t,y:e});this.options.editingController.x=h.x-s*r,this.options.editingController.y=h.y-s*r,this.options.editingController.width=l*r+s*2*r,this.options.editingController.height=c*r+s*2*r}else this.options.editingController.show=!1;this.dataUpdated()}_getEventPoint(t){const e={x:t.clientX,y:t.clientY};if(nt(t)){const o=t.touches||t.targetTouches;if(!o)throw new Error("error targetTouches");e.x=o[0].clientX,e.x=o[0].clientY}const n=this.getBoundingClientRect();return{x:e.x-n.x,y:e.y-n.y}}onResizeStart(t,e){this._resizeType=t,this._startPoint=this._getEventPoint(e),this._startSize.x=this.options.editingController.x,this._startSize.y=this.options.editingController.y,this._startSize.width=this.options.editingController.width,this._startSize.height=this.options.editingController.height;for(const n of this.options.editingController.nodes)this.nodeStartSizeMap.set(n,{x:n.x,y:n.y,width:n.el.offsetWidth,height:n.el.offsetHeight});this._onResizing&&this.$dom.removeEventListener("mousemove",this._onResizing),this._onResizeEnd&&this.$dom.removeEventListener("mouseup",this._onResizeEnd),this._onResizing=this.onResizing.bind(this),this._onResizeEnd=this.onResizeEnd.bind(this),this.$dom.addEventListener("mousemove",this._onResizing),this.$dom.addEventListener("mouseup",this._onResizeEnd),this.emitEvent(A.onResizeStart,this.options.editingController.nodes)}onResizing(t){const e=this._getEventPoint(t),n=e.x-this._startPoint.x,o=e.y-this._startPoint.y;let s=this.options.editingController.width,r=this.options.editingController.height;const l=1;this._resizeType==="tl"?(this.options.editingController.x=this._startSize.x+n/l,this.options.editingController.y=this._startSize.y+o/l,s=this._startSize.width-n/l,r=this._startSize.height-o/l):this._resizeType==="tr"?(this.options.editingController.y=this._startSize.y+o/l,s=this._startSize.width+n/l,r=this._startSize.height-o/l):this._resizeType==="bl"?(this.options.editingController.x=this._startSize.x+n/l,s=this._startSize.width-n/l,r=this._startSize.height+o/l):this._resizeType==="br"?(s=this._startSize.width+n/l,r=this._startSize.height+o/l):this._resizeType==="t"?(this.options.editingController.y=this._startSize.y+o/l,r=this._startSize.height-o/l):this._resizeType==="r"?s=this._startSize.width+n/l:this._resizeType==="b"?r=this._startSize.height+o/l:this._resizeType==="l"&&(this.options.editingController.x=this._startSize.x+n/l,s=this._startSize.width-n/l),s<this.resizeMiniLimit.width&&(s=this.resizeMiniLimit.width),r<this.resizeMiniLimit.width&&(r=this.resizeMiniLimit.width),this.options.editingController.width=s,this.options.editingController.height=r,this._applyResizeScale(t),this.dataUpdated()}_applyResizeScale(t){const e=this.options.editingController.width/this._startSize.width,n=this.options.editingController.height/this._startSize.height,o=this.getCanvasXyByViewXy({x:this._startSize.x,y:this._startSize.y}),s=this.getCanvasXyByViewXy({x:this.options.editingController.x,y:this.options.editingController.y});let r=!0,l=!0;this._resizeType==="t"||this._resizeType==="b"?r=!1:(this._resizeType==="r"||this._resizeType==="l")&&(l=!1);for(const c of this.options.editingController.nodes){const h=this.nodeStartSizeMap.get(c),d=h.width*e,f=h.height*n,p=s.x+e*(h.x-o.x),g=s.y+n*(h.y-o.y),u=d,x=f;this.emitEvent(A.beforeNodeResize,c,p,g,u,x)===!1||(r&&(c.x=p,c.width=u,c.el.offsetWidth=u),l&&(c.y=g,c.height=x,c.el.offsetHeight=x),C("ResizeNode:",c.id,u,x,e,n))}this.updateEditingControllerView()}onResizeEnd(t){const e=this._getEventPoint(t),n=e.x-this._startPoint.x,o=e.y-this._startPoint.y;this._applyResizeScale(t),this.$dom.removeEventListener("mousemove",this._onResizing),this.$dom.removeEventListener("mouseup",this._onResizeEnd),this._onResizing=null,this._onResizeEnd=null,this.emitEvent(A.onResizeEnd,this.options.editingController.nodes,n,o,t)}draggingSelectedNodes(t,e,n,o,s){const r=this.updateReferenceLineView(t,e,n,o,s);if(r){const{showV:l,fixedX:c,showH:h,fixedY:d}=r;l&&(o+=c-e,e=c),h&&(s+=d-n,n=d)}if(!this.options.editingController.nodes.includes(t))this.setNodePosition(t,e,n),this.updateEditingLineView();else{for(const l of this.options.editingController.nodes){const c=this.nodeXYBeforeDrag[l.id];c&&(l.x=c.x+o,l.y=c.y+s)}this.updateEditingControllerView()}}getNodesInSelectionView(t){const e=this.getCanvasXyByViewXy({x:t.x,y:t.y}),n=this.getCanvasXyByViewXy({x:t.x+t.width,y:t.y+t.height}),o=[];return this.getNodes().forEach(s=>{const r=s.x+s.el.offsetWidth/2,l=s.y+s.el.offsetHeight/2;r>e.x&&l>e.y&&r<n.x&&l<n.y&&o.push(s)}),o}updateEditingConnectControllerView(){if(!this.options.nodeConnectController.show)return;const t=this.options.nodeConnectController.node,e=t.x,n=t.y,o=t.x+t.el.offsetWidth,s=t.y+t.el.offsetHeight,r=0,l=this.options.canvasZoom/100,c=e,h=n,d=o-e,f=s-n,p=this.getViewXyByCanvasXy({x:c,y:h});this.options.nodeConnectController.x=p.x-r*l,this.options.nodeConnectController.y=p.y-r*l,this.options.nodeConnectController.width=d*l+r*2*l,this.options.nodeConnectController.height=f*l+r*2*l,this.dataUpdated()}setEditingLine(t,e){this.options.editingLineController.link=e,this.options.editingLineController.line=t,this.options.editingLineController.show=!!t,this.updateEditingLineView(!0)}updateReferenceLineView(t,e,n,o,s){if(!this.options.showReferenceLine)return;if(!this.options.editingReferenceLine.show){const b=Math.abs(o),M=Math.abs(s);b+M>2&&(this.options.editingReferenceLine.show=!0)}if(!this.options.editingReferenceLine.show)return;const r=e,l=t.el.offsetWidth,c=t.el.offsetHeight,h=e+l/2,d=e+l,f=n,p=n+c/2,g=n+c,u=this.getViewXyByCanvasXy({x:h,y:p});let x=!1,y=!1,L=0,m=0;const w=this.graphData.nodes.filter(b=>this.nodeXYBeforeDrag[b.id]?!1:Math.abs(b.x-h)<600&&Math.abs(b.y-p)<600);w.sort((b,M)=>{const N=ut(h,p,b.x+b.el.offsetWidth/2,b.y+b.el.offsetHeight/2),O=ut(h,p,M.x+M.el.offsetWidth/2,M.y+M.el.offsetHeight/2);return N<O?-1:1});for(const b of w){const M=b.x,N=b.el.offsetWidth,O=b.el.offsetHeight,E=b.x+N/2,T=b.x+N,k=b.y,P=b.y+O/2,_=b.y+O,X=Math.abs(r-M),H=Math.abs(h-E),B=Math.abs(d-T),I=Math.abs(f-k),Y=Math.abs(p-P),U=Math.abs(g-_),W=5;if(H<800&&Y<800){if(!y&&H<W){const G=this.getViewXyByCanvasXy({x:E,y:P});this.options.editingReferenceLine.v_x=G.x,this.options.editingReferenceLine.v_y=u.y>G.y?G.y:u.y,this.options.editingReferenceLine.v_height=Math.round(Math.abs(u.y-G.y)),y=!0,L=E-l/2}if(!y&&X<W){const G=this.getViewXyByCanvasXy({x:M,y:P});this.options.editingReferenceLine.v_x=G.x,this.options.editingReferenceLine.v_y=u.y>G.y?G.y:u.y,this.options.editingReferenceLine.v_height=Math.round(Math.abs(u.y-G.y)),y=!0,L=M}if(!y&&B<W){const G=this.getViewXyByCanvasXy({x:T,y:P});this.options.editingReferenceLine.v_x=G.x,this.options.editingReferenceLine.v_y=u.y>G.y?G.y:u.y,this.options.editingReferenceLine.v_height=Math.round(Math.abs(u.y-G.y)),y=!0,L=T-l}if(!x&&Y<W){const G=this.getViewXyByCanvasXy({x:E,y:P});this.options.editingReferenceLine.h_y=G.y,this.options.editingReferenceLine.h_x=u.x>G.x?G.x:u.x,this.options.editingReferenceLine.h_width=Math.round(Math.abs(u.x-G.x)),x=!0,m=P-c/2}if(!x&&I<W){const G=this.getViewXyByCanvasXy({x:E,y:k});this.options.editingReferenceLine.h_y=G.y,this.options.editingReferenceLine.h_x=u.x>G.x?G.x:u.x,this.options.editingReferenceLine.h_width=Math.round(Math.abs(u.x-G.x)),x=!0,m=k}if(!x&&U<W){const G=this.getViewXyByCanvasXy({x:E,y:_});this.options.editingReferenceLine.h_y=G.y,this.options.editingReferenceLine.h_x=u.x>G.x?G.x:u.x,this.options.editingReferenceLine.h_width=Math.abs(u.x-G.x),x=!0,m=_-c}if(x&&y)break}}if(this.options.editingReferenceLine.directionH=x,this.options.editingReferenceLine.directionV=y,this.options.referenceLineAdsorption)return{showV:y,fixedX:L,showH:x,fixedY:m}}hideEditingLineView(){this.options.editingLineController.show=!1}updateEditingLineView(t=!1){this.updateElementLines();const e=this.options;if(!e.editingLineController.show)return;const n=e.editingLineController.link,o=e.editingLineController.line;if(!o||o.to==="newRelationTemplate-to"){e.editingLineController.show=!1;return}let s,r,l;const c=this.createLineDrawInfo(n,o);if(!c){e.editingLineController.show=!1;return}if(o.lineShape===R.StandardOrthogonal){let{textPosition:m,pathData:w,points:b,startDirection:M,endDirection:N}=c;l=m,s=b[0],r=b[b.length-1];const O=[];for(let E=0;E<b.length-1;E++){const T=b[E],k=b[E+1],P={pIndex:E,optionName:"cp-"+E,x:0,y:0,direction:"v",startDirection:M,endDirection:N};T.x!==k.x&&(P.direction="h");const _=this.getViewXyByCanvasXy({x:(T.x+k.x)/2,y:(T.y+k.y)/2});P.x=_.x,P.y=_.y,O.push(P)}if(O.length!==1){if(O.length!==2)if(O.length===3){const E=b[0],T=b[1],k=b[3];if(O[1].direction==="v"){const P=E.x,_=T.x,X=k.x;if(Math.max(P,_,X)!==_&&Math.min(P,_,X)!==_)O[1].optionName="cx";else{const B=Math.abs(_-P),I=Math.abs(_-X);B>=I?O[1].optionName="td":B<I&&(O[1].optionName="fd")}}else{const P=E.y,_=T.y,X=k.y;if(Math.max(P,_,X)!==_&&Math.min(P,_,X)!==_)O[1].optionName="cy";else{const B=Math.abs(_-P),I=Math.abs(_-X);B>=I?O[1].optionName="td":B<I&&(O[1].optionName="fd")}}}else O.length===4?(O[1].optionName="fd",O[2].optionName="td"):O.length===5&&(O[1].optionName="fd",O[2].direction==="v"?O[2].optionName="cx":O[2].optionName="cy",O[3].optionName="td")}e.editingLineController.line44Splits=O,e.editingLineController.line49Points=b,o.ctrlPointsFor49||(o.ctrlPointsFor49=b)}else if(o.lineShape===R.HardOrthogonal){let{textPosition:m,pathData:w,points:b,startDirection:M,endDirection:N}=c;l=m;const O=[];o.ctrlPointsFor49=b,s=b[0],r=b[b.length-1];const E=b;for(let T=0;T<E.length-1;T++){const k=E[T],P=E[T+1],_={pIndex:T,optionName:"cp-"+T,x:0,y:0,direction:"v",startDirection:M,endDirection:N};k.x!==P.x?(_.direction="h",Math.abs(k.x-P.x)<15&&(_.hide=!0)):Math.abs(k.y-P.y)<15&&(_.hide=!0);const X=this.getViewXyByCanvasXy({x:(k.x+P.x)/2,y:(k.y+P.y)/2});_.x=X.x,_.y=X.y,O.push(_)}for(let T=0;T<O.length;T++){const k=O[T-1],P=O[T],_=O[T+1];T===0&&P.direction===_.direction&&(P.hide=!0),T===O.length-1&&P.direction===k.direction&&(P.hide=!0)}e.editingLineController.line44Splits=O,e.editingLineController.line49Points=E}else if(o.lineShape!==1){l=c.textPosition;const m=ue(c.pathData);o.isReverse?(s=m.endPoint,r=m.startPoint,e.editingLineController.ctrlPoint1=this.getViewXyByCanvasXy(m.ctrl1),e.editingLineController.ctrlPoint2=this.getViewXyByCanvasXy(m.ctrl2)):(s=m.startPoint,r=m.endPoint,e.editingLineController.ctrlPoint1=this.getViewXyByCanvasXy(m.ctrl1),e.editingLineController.ctrlPoint2=this.getViewXyByCanvasXy(m.ctrl2))}else{l=c.textPosition;const m=c.pathData,w=ue(m);s=w.startPoint,r=w.endPoint}const h=this.getViewXyByCanvasXy(o.isReverse?r:s),d=this.getViewXyByCanvasXy(o.isReverse?s:r);e.editingLineController.startPoint.x=h.x,e.editingLineController.startPoint.y=h.y,e.editingLineController.endPoint.x=d.x,e.editingLineController.endPoint.y=d.y;const f=this.getViewXyByCanvasXy(l),p=this.$canvasDom.querySelector(`g[data-id='${o.id}']`);let g=0,u=0,x=o.textOffset_x||0,y=o.textOffset_y||0;const L=e.canvasZoom/100;if(p){const m=p.querySelector("text.rg-line-text");if(m){x=Math.floor(parseFloat(m.getAttribute("x")||"0")),y=Math.floor(parseFloat(m.getAttribute("y")||"0"));const w=m.clientWidth,b=m.clientHeight;e.editingLineController.text.width=w,e.editingLineController.text.height=b}else e.editingLineController.text.width=20,e.editingLineController.text.height=10,g=-e.editingLineController.text.width/2}e.editingLineController.text.width+=40,e.editingLineController.text.height+=10,e.editingLineController.text.width>120&&(e.editingLineController.text.width=120),e.editingLineController.text.height>20&&(e.editingLineController.text.height=20),e.editingLineController.text.x=f.x+g+x*L,e.editingLineController.text.y=f.y+u+y*L}getStartAndEndPoint(t){const e=t.match(/[a-zA-Z][^a-zA-Z]*/g);let n=0,o=0,s=0,r=0;const l={x:0,y:0},c={x:0,y:0};for(const h of e){const d=h.trim().split(/[ ,]+/),f=d[0].toUpperCase(),p=d[0]===d[0].toLowerCase();switch(f){case"M":n=this.getPointValue(s,d[1],p)+this.easyViewOffset.x,o=this.getPointValue(r,d[2],p)+this.easyViewOffset.y,s=n,r=o;break;case"L":n=this.getPointValue(s,d[1],p)+this.easyViewOffset.x,o=this.getPointValue(r,d[2],p)+this.easyViewOffset.y;break;case"C":this.getPointValue(s,d[1],p),this.getPointValue(r,d[2],p),this.getPointValue(s,d[3],p),this.getPointValue(r,d[4],p),n=this.getPointValue(s,d[5],p),o=this.getPointValue(r,d[6],p),s=n,r=o;break;case"Q":this.getPointValue(s,d[1],p),this.getPointValue(r,d[2],p),n=this.getPointValue(s,d[3],p),o=this.getPointValue(r,d[4],p),s=n,r=o;break;case"V":o=this.getPointValue(r,d[1],p),r=o;break;case"H":n=this.getPointValue(s,d[1],p),s=n;break;case"Z":break;default:C(`Unsupported command: ${f}`)}h===e[0]&&(l.x=n,l.y=o),h===e[e.length-1]&&(c.x=n,c.y=o)}return{startPoint:l,endPoint:c}}startMoveLineVertex(t,e,n){e.stopPropagation();const o=this.options.editingLineController.link,s=this.options.editingLineController.line;let r,l;if(o)r=o.fromNode,l=o.toNode;else{const{from:L,to:m}=this.generateFakeLineConfig(s);r=L,l=m}let c=r;this.setEditingLine(null,null),o?this.removeLine(s):this.removeFakeLine(s),console.log("DragLine start:",t,s.isReverse),this._currentCreatingLineIsReverse=!1;const{startMarkerId:h,endMarkerId:d,fromJunctionPoint:f,fromJuctionPointOffsetX:p,fromJuctionPointOffsetY:g,toJunctionPoint:u,toJuctionPointOffsetX:x,toJuctionPointOffsetY:y}=this.options.newLineTemplate;s.lineShape===R.HardOrthogonal&&(s.lineShape=R.StandardOrthogonal),t==="start"?(s.fromJuctionPointOffsetX=0,s.fromJuctionPointOffsetY=0,s.isReverse?this._currentCreatingLineIsReverse=!0:(c=l,s.isReverse=!0)):(s.toJuctionPointOffsetX=0,s.toJuctionPointOffsetY=0,s.isReverse&&(c=l,s.isReverse=void 0,this._currentCreatingLineIsReverse=!0)),this._currentCreatingLineIsReverse&&(this.options.newLinkTemplate.fromJunctionPoint=u,this.options.newLinkTemplate.toJunctionPoint=f,this.options.newLineTemplate.startMarkerId=d,this.options.newLineTemplate.endMarkerId=h,this.options.newLineTemplate.fromJuctionPointOffsetX=p,this.options.newLineTemplate.fromJuctionPointOffsetY=g,this.options.newLineTemplate.toJuctionPointOffsetX=x,this.options.newLineTemplate.toJuctionPointOffsetY=y),this.startCreatingLinePlot(e,{template:s,fromNode:c,onCreateLine:n})}startCreateLineFromNode(t,e,n,o){if(n.stopPropagation(),this._startCreateLineFromNodeTime=Date.now(),!e.from){if(!t){const r=this.options.editingController.nodes;r.length===1&&(t=r[0])}t&&(e.from=t.id,e.fromType=t.targetType)}if(!e.from)throw console.error("Error:lineTemplate:",e),Error("Error:startCreateLineByTemplate: lineTemplate must has [fromType, from]");const s=this.getFakeLineTarget(e.fromType,e.from,e);if(!s)throw console.error("Error:fakeTarget[fromType, from]:",e.fromType,e.from,e),Error(`Error:startCreateLineByTemplate: error from fakeTarget[fromType, from]:${e.fromType}, ${e.from}`);e.lineShape||(e.lineShape=6),this.startCreatingLinePlot(n,{template:e,fromNode:s,onCreateLine:o})}onLineVertexBeDropped(t,e,n={x:0,y:0},o){if(e.stopPropagation(),!this.options.creatingLinePlot||Date.now()-this._startCreateLineFromNodeTime<500)return;console.log("Connect end:",this.options.newLineTemplate.isReverse);const s=this.options.nodeConnectController.node;if(!this.options.newLinkTemplate.fromNode)this.options.newLineTemplate.isReverse?(this.options.newLineTemplate.toJunctionPoint=t,this.options.newLineTemplate.toJuctionPointOffsetX=n.x,this.options.newLineTemplate.toJuctionPointOffsetY=n.y):(this.options.newLineTemplate.fromJunctionPoint=t,this.options.newLineTemplate.fromJuctionPointOffsetX=n.x,this.options.newLineTemplate.fromJuctionPointOffsetY=n.y),this.options.newLinkTemplate.fromNode=s;else{this.options.newLineTemplate.isReverse?(this.options.newLineTemplate.fromJunctionPoint=t,this.options.newLineTemplate.fromJuctionPointOffsetX=n.x,this.options.newLineTemplate.fromJuctionPointOffsetY=n.y):(this.options.newLineTemplate.toJunctionPoint=t,this.options.newLineTemplate.toJuctionPointOffsetX=n.x,this.options.newLineTemplate.toJuctionPointOffsetY=n.y),this.options.newLinkTemplate.toNodeObject=s;const r=this.options.newLinkTemplate.fromNode,l=s;try{this.emitEvent(A.onLineVertexDropped,{newLineTemplate:this.options.newLineTemplate,fromNode:r,toNode:l}),o&&o(r,l,this.options.newLineTemplate),this.onCreateLine(this.options.newLinkTemplate.fromNode,this.options.nodeConnectController.node)!==!0&&this.stopCreatingLinePlot()}catch(c){this.stopCreatingLinePlot(),console.warn("[Custom Reject onCreateLine By Throw Error:",c)}}}startMoveLineText(t,e){if(vt(t))return;const n=this._getEventPoint(t),o=this.options.editingLineController.line,s=o.textOffset_x||0,r=o.textOffset_y||0,l=h=>{const d=this.options.canvasZoom/100,f=this._getEventPoint(h),p=f.x-n.x,g=f.y-n.y;o.textOffset_x=Math.round(s+p/d),o.textOffset_y=Math.round(r+g/d),this.updateEditingLineView(),this._dataUpdated()},c=h=>{this.$dom.removeEventListener("mousemove",l),this.$dom.removeEventListener("mouseup",c),e&&e(),this._dataUpdated()};this.$dom.addEventListener("mousemove",l),this.$dom.addEventListener("mouseup",c)}startMoveLine6CtrlPoint(t,e){return e.stopPropagation(),e.preventDefault(),new Promise((n,o)=>{const r=this.options.editingLineController.line;r.ctrlPoints||(r.ctrlPoints=[]),r.ctrlPoints.length===0&&(r.ctrlPoints.push({x:0,y:0}),r.ctrlPoints.push({x:0,y:0})),r.isReverse&&(t=r.ctrlPoints.length-1-t);const c=this.options.canvasZoom/100,h=r.ctrlPoints[t],{x:d,y:f}=h,p=()=>{this.dataUpdated(),n()};Z.startDrag(e,{x:0,y:0},p,(g,u)=>{h.x=d+g/c,h.y=f+u/c,this.updateEditingLineView(),this.dataUpdated()})})}startMoveLine44CtrlPoint(t,e){return e.stopPropagation(),e.preventDefault(),console.log("startMoveLine44CtrlPoint:",t.optionName),new Promise((n,o)=>{const s=this.options.editingLineController,r=s.line;r.ctrlOptionsFor44||(r.ctrlOptionsFor44={cx:0,cy:0,fd:0,td:0});const c=this.options.canvasZoom/100,h=r.ctrlOptionsFor44[t.optionName],d={indexOffset:0};let f=JSON.parse(JSON.stringify(r.ctrlPointsFor49));const p=()=>{if(r.lineShape===R.HardOrthogonal){const g=Nt(r.ctrlPointsFor49);r.ctrlPointsFor49=g}this.updateEditingLineView(),this.dataUpdated(),n()};Z.startDrag(e,{x:0,y:0},p,(g,u)=>{if(r.lineShape===R.StandardOrthogonal)if(t.optionName==="cx"){const y=h+g/c*1;r.ctrlOptionsFor44.cx=y}else if(t.optionName==="cy"){const y=h+u/c*1;r.ctrlOptionsFor44.cy=y}else if(t.optionName==="fd"){const x=Mt[t.startDirection],y=t.direction==="v"?g*x.x:u*x.y;r.ctrlOptionsFor44.fd=h+y/c}else if(t.optionName==="td"){const x=Mt[t.endDirection],y=t.direction==="v"?g*x.x:u*x.y;r.ctrlOptionsFor44.td=h+y/c}else(t.direction==="v"&&Math.abs(g)>5||t.direction==="h"&&Math.abs(u)>5)&&(r.ctrlPointsFor49=s.line49Points,r.lineShape=49,f=JSON.parse(JSON.stringify(r.ctrlPointsFor49)));else if(r.lineShape===R.HardOrthogonal){const{newPoints:x,pointsChanged:y}=xn(r.ctrlPointsFor49,f,t.pIndex+d.indexOffset,t,d,g/c,u/c);y&&(f=JSON.parse(JSON.stringify(x))),r.ctrlPointsFor49=x}this.updateEditingLineView(),this.dataUpdated()})})}}const xn=(i,a,t,e,n,o,s)=>{const r=JSON.parse(JSON.stringify(i));let l=!1;if(t<0||t>=i.length-1)return{newPoints:r,pointsChanged:l};r[t-1];const c=r[t],h=r[t+1];a[t-1];const d=a[t];a[t+1];let f=o,p=s;if(e.direction==="v"){const g=a[t-2],u=a[t+2],x=d.x+f;let y=3e3;if(g){const L=Math.abs(g.x-x);L<10&&L<y&&(y=L,f=g.x-d.x)}if(u){const L=Math.abs(u.x-x);L<10&&L<y&&(y=L,f=u.x-d.x)}}else{const g=a[t-2],u=a[t+2],x=d.y+p;let y=3e3;if(g){const L=Math.abs(g.y-x);L<10&&L<y&&(y=L,p=g.y-d.y)}if(u){const L=Math.abs(u.y-x);L<10&&L<y&&(y=L,p=u.y-d.y)}}if(e.direction==="v")if(t===0){const g=c.y<h.y?1:-1,u={x:c.x,y:c.y},x={x:c.x,y:c.y+20*g};c.x=x.x+f,c.y=x.y,r.splice(t,0,u,x),n.indexOffset+=2,l=!0}else if(t===i.length-2){const g=c.y<h.y?1:-1,u={x:d.x+f,y:h.y-20*g},x={x:h.x,y:h.y-20*g};r.splice(t+1,0,u,x),l=!0}else c.x=d.x+f,h.x=d.x+f;else if(t===0){const g=c.x<h.x?1:-1,u={x:c.x,y:c.y},x={x:c.x+20*g,y:c.y};c.x=x.x,c.y=d.y+p,r.splice(t,0,u,x),n.indexOffset+=2,l=!0}else if(t===i.length-2){const g=c.x<h.x?1:-1,u={x:h.x-20*g,y:d.y+p},x={x:h.x-20*g,y:h.y};r.splice(t+1,0,u,x),l=!0}else c.y=d.y+p,h.y=d.y+p;return{newPoints:r,pointsChanged:l}};class Cn extends vn{constructor(t,e){super(t,e);S(this,"$miniViewCanvas");S(this,"$mvCanvasCtx");S(this,"mediaDPR");S(this,"miniViewUpdating",!1);S(this,"miniViewUpdateHasNext",!1);S(this,"canvasDomScale",1);S(this,"miniViewBox",{visibleAreaStart:{x:0,y:0},visibleAreaEnd:{x:0,y:0},canvas_start_x:0,canvas_start_y:0,canvas_end_x:0,canvas_end_y:0,canvas_width:0,canvas_height:0,miniview_width:0,miniview_height:0});S(this,"visibleArea",{x:0,y:0});S(this,"_canvasItemMiniSizeLimit",1);S(this,"miniviewVisiableHandleMoveing",!1)}initImageTool(){this.mediaDPR=window.devicePixelRatio||1}setMiniViewCanvas(t){this.$miniViewCanvas=t,this.$mvCanvasCtx=this.$miniViewCanvas.getContext("2d")}updateMiniView(){!this.options.showMiniView||requestAnimationFrame(this._updateMiniView.bind(this))}_updateMiniView(){try{this.miniViewUpdating=!0,this.mvDosomethingBeforeDraw(),this.mvDrawAllNodes(),this.mvDrawMask()}catch(t){console.error(t)}this.miniViewUpdating=!1,this.miniViewUpdateHasNext&&(this.miniViewUpdateHasNext=!1,this._updateMiniView())}mvDosomethingBeforeDraw(){let t=9999999,e=9999999,n=-9999999,o=-9999999,s=0;for(const L of this.getNodes())if(L.rgCalcedVisible&&L.opacity!==0){L.x<t&&(t=L.x),L.y<e&&(e=L.y);const m=L.x+L.el.offsetWidth,w=L.y+L.el.offsetHeight;m>n&&(n=m),w>o&&(o=w),s++}if(s===0)return;const r=1,l=50,c=50;this.miniViewBox.canvas_start_x=t-l,this.miniViewBox.canvas_start_y=e-c,this.miniViewBox.canvas_end_x=n+l,this.miniViewBox.canvas_end_y=o+c,this.miniViewBox.canvas_width=this.miniViewBox.canvas_end_x-this.miniViewBox.canvas_start_x,this.miniViewBox.canvas_height=this.miniViewBox.canvas_end_y-this.miniViewBox.canvas_start_y;const h=this.$miniViewCanvas.parentElement.getBoundingClientRect(),d=h.width,f=h.height;let p=0,g=0,u=r;d/this.miniViewBox.canvas_width<f/this.miniViewBox.canvas_height?(u=d/this.miniViewBox.canvas_width*r,p=d,g=d/this.miniViewBox.canvas_width*this.miniViewBox.canvas_height):(u=f/this.miniViewBox.canvas_height*r,p=f/this.miniViewBox.canvas_height*this.miniViewBox.canvas_width,g=f),this.miniViewBox.miniview_width=d,this.miniViewBox.miniview_height=f,this.$miniViewCanvas.width=d,this.$miniViewCanvas.height=f,this.$mvCanvasCtx.canvas.width=d*this.mediaDPR,this.$mvCanvasCtx.canvas.height=f*this.mediaDPR,this.$mvCanvasCtx.canvas.style.width=`${d}px`,this.$mvCanvasCtx.canvas.style.height=`${f}px`;const x=(f-g)/2,y=(d-p)/2;if(this.miniViewBox.canvas_start_x-=y/u,this.miniViewBox.canvas_start_y-=x/u,C("updateMiniView",y,x),this.$mvCanvasCtx.setTransform(this.mediaDPR,0,0,this.mediaDPR,0,0),this.$mvCanvasCtx.scale(u,u),!this.miniviewVisiableHandleMoveing){const L=this.getBoundingClientRect(),m=this.getCanvasXyByViewXy({x:0,y:0}),w=this.getCanvasXyByViewXy({x:L.width,y:L.height}),b=w.x-m.x,M=w.y-m.y;this.miniViewBox.visibleAreaStart=m,this.miniViewBox.visibleAreaEnd=w,this.options.miniViewVisibleHandle.width=u*b,this.options.miniViewVisibleHandle.height=u*M;const N=m.x-this.miniViewBox.canvas_start_x,O=m.y-this.miniViewBox.canvas_start_y;this.options.miniViewVisibleHandle.x=u*N,this.options.miniViewVisibleHandle.y=u*O,this.canvasDomScale=u,this.options.miniViewVisibleHandle.x+this.options.miniViewVisibleHandle.width<0||this.options.miniViewVisibleHandle.y+this.options.miniViewVisibleHandle.height<0||this.options.miniViewVisibleHandle.y>this.miniViewBox.miniview_height||this.options.miniViewVisibleHandle.x>this.miniViewBox.miniview_width?this.options.miniViewVisibleHandle.emptyContent=!0:this.options.miniViewVisibleHandle.emptyContent=!1}}mvDrawMask(){}mvDrawAllNodes(){const t=this.canvasDomScale;for(const e of this.getNodes())if(e.rgCalcedVisible&&e.opacity!==0){let n=e.el.offsetWidth,o=e.el.offsetHeight;t*n<this._canvasItemMiniSizeLimit&&(n=this._canvasItemMiniSizeLimit/this.canvasDomScale),t*o<this._canvasItemMiniSizeLimit&&(o=this._canvasItemMiniSizeLimit/this.canvasDomScale),this.mvDrawNode(e,n,o)}}mvDrawNode(t,e,n){t.nodeShape===0?this.mvDrawNode4Circle(t,e,n):this.mvDrawNode4Rect(t,e,n)}mvDrawNode4Rect(t,e,n){const o=this.$mvCanvasCtx,s=t.x-this.miniViewBox.canvas_start_x,r=t.y-this.miniViewBox.canvas_start_y;o.beginPath(),o.globalAlpha=t.opacity||1,o.rect(s,r,e,n),o.fillStyle=this.getNodeColor(t),o.fill(),o.globalAlpha=1}mvDrawNode4Circle(t,e,n){const o=this.$mvCanvasCtx,s=t.x+e/2-this.miniViewBox.canvas_start_x,r=t.y+n/2-this.miniViewBox.canvas_start_y;o.beginPath(),o.globalAlpha=t.opacity||1,o.ellipse(s,r,e/2,n/2,0,0,2*Math.PI),o.fillStyle=this.getNodeColor(t),o.fill(),o.globalAlpha=1}mvDrawAllLines(){for(const t of this.getLinks())t.fromNode.rgCalcedVisible&&t.toNode.rgCalcedVisible&&this.mvDrawLine(t,t.line)}mvDrawLine(t,e){const n=this.$mvCanvasCtx,o=this.createLineDrawInfo(t,e);n.beginPath(),n.globalAlpha=e.opacity||1,this.mvDrawSvgPathOnCanvas(n,o.pathData),n.strokeStyle=e.color||this.options.defaultLineColor||"#888888",n.lineWidth=e.lineWidth||1,n.stroke(),n.globalAlpha=1}mvDrawSvgPathOnCanvas(t,e){const n=e.match(/[a-zA-Z][^a-zA-Z]*/g);let o=0,s=0,r=0,l=0,c=0,h=0,d=0,f=0,p=!1;n.forEach(g=>{const u=g.trim().split(/[ ,]+/),x=u[0].toUpperCase(),y=u[0]===u[0].toLowerCase();switch(x){case"M":o=this.getPointValue(r,u[1],y)-this.miniViewBox.canvas_start_x,s=this.getPointValue(l,u[2],y)-this.miniViewBox.canvas_start_y,r=o,l=s,p&&(t.closePath(),p=!1),t.moveTo(o,s);break;case"L":o=this.getPointValue(r,u[1],y)-this.miniViewBox.canvas_start_x,s=this.getPointValue(l,u[2],y)-this.miniViewBox.canvas_start_y,t.lineTo(o,s);break;case"C":c=this.getPointValue(r,u[1],y),h=this.getPointValue(l,u[2],y),d=this.getPointValue(r,u[3],y),f=this.getPointValue(l,u[4],y),o=this.getPointValue(r,u[5],y),s=this.getPointValue(l,u[6],y),r=o,l=s,t.bezierCurveTo(c,h,d,f,o,s);break;case"Q":c=this.getPointValue(r,u[1],y),h=this.getPointValue(l,u[2],y),o=this.getPointValue(r,u[3],y),s=this.getPointValue(l,u[4],y),r=o,l=s;break;case"V":s=this.getPointValue(l,u[1],y),l=s,t.lineTo(o,s);break;case"H":o=this.getPointValue(r,u[1],y),r=o,t.lineTo(o,s);break;case"Z":t.closePath(),p=!1;break;default:C(`Unsupported command: ${x}`)}})}onVisiableViewHandleDragStart(t){t.preventDefault(),t.stopPropagation();const e=this.options.canvasOffset.x,n=this.options.canvasOffset.y,o=this.miniViewBox.canvas_width,s=this.miniViewBox.canvas_height,r=(c,h,d,f,p)=>{const g=c/this.miniViewBox.miniview_width,u=h/this.miniViewBox.miniview_height,x=this.options.canvasZoom/100,y=o*g*x,L=s*u*x;this.setCanvasOffset(e-y,n-L),this.updateEditingControllerView(),this.dataUpdated()},l=(c,h,d)=>{this.miniviewVisiableHandleMoveing=!1,this.onCanvasDragEnd(d)};Z.startDrag(t,this.options.miniViewVisibleHandle,l,r)}resetByVisiableView(t){!this.options.miniViewVisibleHandle.emptyContent||(this.setZoom(100),this.moveToCenter(),this.zoomToFit())}}class Ce extends Cn{constructor(a,t){super(a,t)}setListeners(a){this.listeners=a}ready(){this.initDom(),this.resetViewSize(!0),this.initImageTool(),this.updateViewBoxInfo(),this.addFullscreenListener(),this.emitEvent(A.onReady,this)}beforeUnmount(){this.options.instanceDestroyed=!0,this.removeFullscreenListener(),this.removeKeyboardListener(),this.destroyMutationObserver(),this.destroyResizeObserver()}}const $t=i=>{const[a,t]=D.useState(0),e=D.useRef(0),n=D.useRef(i.relationGraphCore?new i.relationGraphCore:new Ce),o=s=>{e.current++,t(e.current)};return D.useEffect(()=>{n.current.setUpdateViewHook(o),i.onProviderReady&&i.onProviderReady(n.current)},[]),v.jsx(v.Fragment,{children:v.jsx(Ae,{value:n.current,children:v.jsx(Ve,{value:o,children:v.jsx(ze,{value:a,children:i.children})})})})},_n=(i,a)=>{const t=D.useContext($),e=D.useRef(i.relationGraphInstance);D.useImperativeHandle(a,()=>({getInstance(){return t||e.current},async setJsonData(o,s,r){throw new Error(`Please Initialize the graph using the new method:
|
|
49
|
-
|
|
42
|
+
`}},ne=({iconName:s,className:i})=>{const e=rn[s];return x.jsx("svg",{className:`rg-icon ${i||""}`,viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",dangerouslySetInnerHTML:{__html:e.data}})},ln=()=>{const s=$(),{options:i}=J(),e=t=>{s.clearLoading()};return x.jsx(x.Fragment,{children:i&&x.jsx("div",{className:`rg-graph-loading ${i.graphLoading?"":"rg-graph-loading-hide"}`,onClick:t=>{e()},children:x.jsxs("div",{className:"rg-graph-loading-message",children:[x.jsx(ne,{iconName:"icon-lianjiezhong",className:"rg-graph-loading-icon"}),"Loading..."]})})})},dn=({nodeSlot:s})=>{$();const{options:i}=J();return i&&x.jsxs("div",{className:"rg-operate",children:[x.jsxs("div",{className:"rg-creating-container",children:[i.creatingNodePlot&&i.showTemplateNode&&x.jsx(lt,{nodeProps:i.newNodeTemplate,nodeSlot:s}),i.creatingSelection&&x.jsx("div",{className:"rg-selection",style:{transform:`translate(${i.selectionView.x}px, ${i.selectionView.y}px)`,width:i.selectionView.width+"px",height:i.selectionView.height+"px"}})]}),x.jsx(an,{}),x.jsx(ln,{})]})},ct=({direction:s="h",positionH:i="left",positionV:e="bottom",children:t})=>{const n=$();ie();const{options:o}=J(),a=()=>{n==null||n.toggleAutoLayout()},r=async()=>{n&&(n.enableCanvasAnimation(),n.setZoom(100),n.moveToCenter(),n.zoomToFit(),setTimeout(()=>{n.disableCanvasAnimation()},300))},l=async d=>{await(n==null?void 0:n.zoom(d))},c=async()=>{await(n==null?void 0:n.fullscreen())};return I.useEffect(()=>{},[]),x.jsxs("div",{className:`rg-toolbar rg-xs-toolbar rg-toolbar-h-${i||o.toolBarPositionH} rg-toolbar-v-${e||o.toolBarPositionV} rg-toolbar-${s||o.toolBarDirection}`,children:[x.jsx("div",{title:"Full Screen",className:"rg-mb-button",style:{marginTop:0},onClick:c,children:x.jsx(ne,{iconName:"icon-quanping"})}),x.jsxs(x.Fragment,{children:[x.jsx("div",{className:"rg-mb-button",onClick:()=>l(20),children:x.jsx(ne,{iconName:"icon-fangda"})}),x.jsx("div",{className:"rg-current-zoom",onClick:r,children:`${Math.round(o.canvasZoom)}%`}),x.jsx("div",{className:"rg-mb-button",style:{marginTop:0},onClick:()=>l(-20),children:x.jsx(ne,{iconName:"icon-suoxiao"})})]}),o.layout.supportAutoLayout&&x.jsx("div",{title:o.layout.autoLayouting?"Stop Force Layout":"Start Force Layout",className:`rg-mb-button ${o.layout.autoLayouting?"rg-mb-button-on":""}`,onClick:a,children:o.layout.autoLayouting?x.jsx(ne,{iconName:"icon-lianjiezhong",className:"rg-loading-icon"}):x.jsx(ne,{iconName:"icon-zidong"})}),t]})},ht=({children:s})=>x.jsx(x.Fragment,{}),Fe=({children:s})=>x.jsx(x.Fragment,{}),ft=({children:s})=>x.jsx(x.Fragment,{}),ut=({children:s})=>x.jsx(x.Fragment,{}),gt=s=>{const i=$();ie();const e=I.useRef(),[t,n]=I.useState(!1);I.useEffect(()=>{C("<RelationGraph> Dom Mounted!"),i.setDom(e.current),n(!0);const m=L=>{i.onMouseWheel(L)};return e.current.addEventListener("wheel",m,{passive:!1}),()=>{var L;C("<RelationGraph> Dom UnMounted!"),(L=e.current)==null||L.removeEventListener("wheel",m),i.beforeUnmount()}},[]);const{options:o}=J();let a,r;const l=[],c=[],d=[],h=pe.default.Children.toArray(s.children).filter(m=>{if(m&&pe.default.isValidElement(m))if(m.type===Rt){const L=m.props.children;if(typeof L=="function")a=L;else throw new Error("RGSlotOnNode children must be a function, e.g. <RGSlotOnNode>{ (node: RGNode) => <div>{node.text}</div> }</RGSlotOnNode>")}else if(m.type===ht){const L=m.props.children;if(typeof L=="function")r=L;else throw new Error("RGSlotOnLine children must be a function, e.g. <RGSlotOnLine>{ (lineConfig: RGGenerateLineConfig) => <RGLineContent lineConfig={lineConfig} /> }</RGSlotOnLine>")}else{if(m.type===Fe)return l.push(m.props.children),!1;if(m.type===ft)return c.push(m.props.children),!1;if(m.type===ut)return d.push(m.props.children),!1}return!0}),u=l,y=d,f=c.concat(...h);if(a&&s.nodeSlot)throw new Error("You can only provide nodeSlot or RGSlotOnNode, but not both.");if(r&&s.lineSlot)throw new Error("You can only provide lineSlot or RGSlotOnLine, but not both.");const g=a||s.nodeSlot,v=r||s.lineSlot,p=s.nodeExpandButtonSlot;return x.jsx("div",{ref:e,id:`relation-graph-ins-${o==null?void 0:o.instanceId}`,className:["relation-graph",(o==null?void 0:o.creatingLinePlot)&&"rg-creating-line",(o==null?void 0:o.dragEventAction)==="move"?"rg-move-mode":"",o!=null&&o.enableNodeXYAnimation?"rg-enable-node-xy-animation":"",(o==null?void 0:o.enableCanvasTransformAnimation)&&"rg-enable-canvas-animation"].filter(Boolean).join(" "),tabIndex:1,style:{width:"100%",height:o!=null&&o.viewHeight?o==null?void 0:o.viewHeight:"100%",opacity:t?1:0,"--rg-checked-item-bg-color":o==null?void 0:o.checkedItemBackgroundColor,"--rg-background-color":o==null?void 0:o.backgroundColor,"--rg-node-color":o==null?void 0:o.defaultNodeColor,"--rg-node-border-color":o==null?void 0:o.defaultNodeBorderColor,"--rg-node-border-width":(o==null?void 0:o.defaultNodeBorderWidth)+"px","--rg-node-border-radius":(o==null?void 0:o.defaultNodeBorderRadius)+"px","--rg-line-color":o==null?void 0:o.defaultLineColor,"--rg-line-width":(o==null?void 0:o.defaultLineWidth)+"px"},children:o&&x.jsxs(x.Fragment,{children:[o.showToolBar&&x.jsx(ct,{}),x.jsx(sn,{nodeSlot:g,lineSlot:v,canvasPlugSlot:f,canvasPlugAboveSlot:y,nodeExpandButtonSlot:p}),x.jsx(dn,{nodeSlot:g}),x.jsx("div",{className:"rg-graph-plugs",children:x.jsx("div",{className:"rg-view-slot",children:u})})]})})},pt=s=>{const i=$();return I.useEffect(()=>{Ze("React"),i.setOptions(s.options);const e=Qe(s);C("[RelationGraph]mounted:listeners:",e),i.setListeners(e),i.ready(),i.dataUpdated(),s.initialData&&(C("[RelationGraph] apply data"),i.applyInitialData(s.initialData))},[]),I.useEffect(()=>{C("[RelationGraph] update options:",s.options),console.warn("[RelationGraph] update options:",s.options),i.setOptions(s.options),i.dataUpdated()},[s.options]),x.jsx(gt,{...s})};class cn{constructor(i){N(this,"$evCanvasCtx");N(this,"viewScale",1);N(this,"offset",{x:0,y:0});const e=i.getContext("2d");if(!e)throw new Error("\u65E0\u6CD5\u83B7\u53D6 Canvas 2D \u4E0A\u4E0B\u6587");this.$evCanvasCtx=e}setSize(i,e){const t=this.$evCanvasCtx.canvas;t.width=i*window.devicePixelRatio,t.height=e*window.devicePixelRatio,t.style.width=`${i}px`,t.style.height=`${e}px`,this.$evCanvasCtx.setTransform(window.devicePixelRatio,0,0,window.devicePixelRatio,0,0),this.applyCurrentViewTransform()}setScale(i){this.viewScale=i,this.applyCurrentViewTransform()}applyCurrentViewTransform(){this.$evCanvasCtx.setTransform(window.devicePixelRatio,0,0,window.devicePixelRatio,0,0),this.$evCanvasCtx.scale(this.viewScale,this.viewScale)}setViewOffset(i,e){this.offset.x=i/this.viewScale,this.offset.y=e/this.viewScale}beforeDraw(){}evDrawNode4Rect(i,e,t,n,o,a,r=5,l){const c=this.$evCanvasCtx,d=this.offset.x+i,h=this.offset.y+e;let u=Math.max(0,r);t<2*u&&(u=t/2),n<2*u&&(u=n/2),c.beginPath(),c.globalAlpha=a,u===0?c.rect(d,h,t,n):(c.moveTo(d+u,h),c.arcTo(d+t,h,d+t,h+u,u),c.arcTo(d+t,h+n,d+t-u,h+n,u),c.arcTo(d,h+n,d,h+n-u,u),c.arcTo(d,h,d+u,h,u),c.closePath()),c.fillStyle=o,c.fill(),c.globalAlpha=1,c.strokeStyle=l,c.lineWidth=1,c.stroke()}evDrawNode4Circle(i,e,t,n,o,a,r){const l=this.$evCanvasCtx,c=this.offset.x+i+t/2,d=this.offset.y+e+n/2;l.beginPath(),l.globalAlpha=a,l.ellipse(c,d,t/2,n/2,0,0,2*Math.PI),l.fillStyle=o,l.fill(),l.strokeStyle=r,l.lineWidth=1,l.stroke(),l.globalAlpha=1}evDrawLine(i,e,t,n){const o=this.$evCanvasCtx;o.beginPath(),o.globalAlpha=n,this.evDrawSvgPathOnCanvas(o,i),o.strokeStyle=t,o.lineWidth=e*this.viewScale<.5?.5:e,o.stroke(),o.globalAlpha=1}getPointValue(i,e,t){return t?i+parseFloat(e):parseFloat(e)}evDrawSvgPathOnCanvas(i,e){const t=e.match(/[a-zA-Z][^a-zA-Z]*/g);if(!t)return;let n=0,o=0,a=0,r=0,l=0,c=0,d=0,h=0,u="";i.beginPath(),t.forEach(y=>{const f=y.trim(),g=f.charAt(0),p=f.substring(1).trim().split(/[ ,]+/).filter(w=>w!=="").map(parseFloat);let m=0,L=0,_=0,S=0,b=0,O=0,T=0,k=0,E=0,P=0,M=0;switch(g){case"M":n=p[0],o=p[1],a=n,r=o,i.moveTo(n+this.offset.x,o+this.offset.y);for(let w=2;w<p.length;w+=2)n=p[w],o=p[w+1],i.lineTo(n+this.offset.x,o+this.offset.y);break;case"L":for(let w=0;w<p.length;w+=2)n=p[w],o=p[w+1],i.lineTo(n+this.offset.x,o+this.offset.y);break;case"l":for(let w=0;w<p.length;w+=2)n+=p[w],o+=p[w+1],i.lineTo(n+this.offset.x,o+this.offset.y);break;case"H":for(let w=0;w<p.length;w++)n=p[w],i.lineTo(n+this.offset.x,o+this.offset.y);break;case"h":for(let w=0;w<p.length;w++)n+=p[w],i.lineTo(n+this.offset.x,o+this.offset.y);break;case"V":for(let w=0;w<p.length;w++)o=p[w],i.lineTo(n+this.offset.x,o+this.offset.y);break;case"v":for(let w=0;w<p.length;w++)o+=p[w],i.lineTo(n+this.offset.x,o+this.offset.y);break;case"C":for(let w=0;w<p.length;w+=6)_=p[w],S=p[w+1],b=p[w+2],O=p[w+3],m=p[w+4],L=p[w+5],i.bezierCurveTo(_+this.offset.x,S+this.offset.y,b+this.offset.x,O+this.offset.y,m+this.offset.x,L+this.offset.y),n=m,o=L,l=b,c=O;break;case"c":for(let w=0;w<p.length;w+=6)_=n+p[w],S=o+p[w+1],b=n+p[w+2],O=o+p[w+3],m=n+p[w+4],L=o+p[w+5],i.bezierCurveTo(_+this.offset.x,S+this.offset.y,b+this.offset.x,O+this.offset.y,m+this.offset.x,L+this.offset.y),l=b,c=O,n=m,o=L;break;case"S":for(let w=0;w<p.length;w+=4)u.match(/[CS]/i)?(_=2*n-l,S=2*o-c):(_=n,S=o),b=p[w],O=p[w+1],m=p[w+2],L=p[w+3],i.bezierCurveTo(_+this.offset.x,S+this.offset.y,b+this.offset.x,O+this.offset.y,m+this.offset.x,L+this.offset.y),n=m,o=L,l=b,c=O;break;case"s":for(let w=0;w<p.length;w+=4)u.match(/[CS]/i)?(_=2*n-l,S=2*o-c):(_=n,S=o),b=n+p[w],O=o+p[w+1],m=n+p[w+2],L=o+p[w+3],i.bezierCurveTo(_+this.offset.x,S+this.offset.y,b+this.offset.x,O+this.offset.y,m+this.offset.x,L+this.offset.y),l=b,c=O,n=m,o=L;break;case"Q":for(let w=0;w<p.length;w+=4)_=p[w],S=p[w+1],m=p[w+2],L=p[w+3],i.quadraticCurveTo(_+this.offset.x,S+this.offset.y,m+this.offset.x,L+this.offset.y),n=m,o=L,d=_,h=S;break;case"q":for(let w=0;w<p.length;w+=4)_=n+p[w],S=o+p[w+1],m=n+p[w+2],L=o+p[w+3],i.quadraticCurveTo(_+this.offset.x,S+this.offset.y,m+this.offset.x,L+this.offset.y),d=_,h=S,n=m,o=L;break;case"T":for(let w=0;w<p.length;w+=2)u.match(/[QT]/i)?(_=2*n-d,S=2*o-h):(_=n,S=o),m=p[w],L=p[w+1],i.quadraticCurveTo(_+this.offset.x,S+this.offset.y,m+this.offset.x,L+this.offset.y),n=m,o=L,d=_,h=S;break;case"t":for(let w=0;w<p.length;w+=2)u.match(/[QT]/i)?(_=2*n-d,S=2*o-h):(_=n,S=o),m=n+p[w],L=o+p[w+1],i.quadraticCurveTo(_+this.offset.x,S+this.offset.y,m+this.offset.x,L+this.offset.y),d=_,h=S,n=m,o=L;break;case"A":for(let w=0;w<p.length;w+=7)T=p[w],k=p[w+1],E=p[w+2],P=p[w+3],M=p[w+4],m=p[w+5],L=p[w+6],this.drawArc(i,n,o,T,k,E,P,M,m,L),n=m,o=L;break;case"a":for(let w=0;w<p.length;w+=7)T=p[w],k=p[w+1],E=p[w+2],P=p[w+3],M=p[w+4],m=n+p[w+5],L=o+p[w+6],this.drawArc(i,n,o,T,k,E,P,M,m,L),n=m,o=L;break;case"Z":case"z":i.closePath(),n=a,o=r;break;default:console.warn(`\u672A\u652F\u6301\u7684SVG\u547D\u4EE4\u5B57\u7B26: ${g}`)}g.match(/[CSQT]/i)?u=g:u=""})}drawArc(i,e,t,n,o,a,r,l,c,d){if(n=Math.abs(n),o=Math.abs(o),n===0||o===0){i.lineTo(c+this.offset.x,d+this.offset.y);return}const h=a%360*Math.PI/180,u=Math.sin(h),y=Math.cos(h),f=y*(e-c)/2+u*(t-d)/2,g=-u*(e-c)/2+y*(t-d)/2,v=f*f/(n*n)+g*g/(o*o);v>1&&(n*=Math.sqrt(v),o*=Math.sqrt(v));let p=(r===l?-1:1)*Math.sqrt(Math.max(0,(n*n*o*o-n*n*g*g-o*o*f*f)/(n*n*g*g+o*o*f*f)));isNaN(p)&&(p=0);const m=p*n*g/o,L=p*-o*f/n,_=y*m-u*L+(e+c)/2,S=u*m+y*L+(t+d)/2,b=(f-m)/n,O=(g-L)/o,T=(-f-m)/n,k=(-g-L)/o;let E=Math.atan2(O,b),P=Math.atan2(O*T-b*k,b*T+O*k);l===0&&P>0?P-=2*Math.PI:l===1&&P<0&&(P+=2*Math.PI);const M=E+P;i.ellipse?i.ellipse(_+this.offset.x,S+this.offset.y,n,o,h,E,M,l===0):(console.warn("ctx.ellipse is not supported. Arc will be drawn as a line."),i.lineTo(c+this.offset.x,d+this.offset.y))}}let be={x:0,y:0};const Oe={x:0,y:0},ce={x:0,y:0};let Ye,He;const We=s=>{const i={clientX:0,clientY:0};if(de(s)){const e=s.touches||s.targetTouches;if(!e)throw new Error("error targetTouches");i.clientX=e[0].clientX,i.clientY=e[0].clientY}else i.clientX=s.clientX,i.clientY=s.clientY;return i},Z={startDrag(s,i,e,t){t?Ye=(n,o,a)=>{const r=n-ce.x,l=o-ce.y;t(r,l,Oe,ce,a)}:Ye=(n,o)=>{be.x=Oe.x+(n-ce.x),be.y=Oe.y+(o-ce.y)},He=e,be=i,Oe.x=be.x,Oe.y=be.y;try{const n=We(s);ce.x=n.clientX,ce.y=n.clientY,de(s)?(document.body.addEventListener("touchmove",Z.onNodeMove),document.body.addEventListener("touchend",Z.onNodeDragend),document.body.addEventListener("mousemove",Z.onNodeMove),document.body.addEventListener("mouseup",Z.onNodeDragend),s.preventDefault()):(document.body.addEventListener("mousemove",Z.onNodeMove),document.body.addEventListener("mouseup",Z.onNodeDragend))}catch(n){console.error(n.message)}},onNodeMove(s){const i=We(s);Ye(i.clientX,i.clientY,s)},onNodeDragend(s){if(de(s)?(document.body.removeEventListener("touchmove",Z.onNodeMove),document.body.removeEventListener("touchend",Z.onNodeDragend),document.body.removeEventListener("mousemove",Z.onNodeMove),document.body.removeEventListener("mouseup",Z.onNodeDragend)):(document.body.removeEventListener("mousemove",Z.onNodeMove),document.body.removeEventListener("mouseup",Z.onNodeDragend)),He){const i=We(s),e=i.clientX,t=i.clientY,n=e-ce.x,o=t-ce.y;He(n,o,s)}}};function hn(s,i,e,t,n,o,a,r,l){const c=n-s,d=o-i,h=Math.sqrt(c*c+d*d);if(h===0)return{x:s,y:i};const u=l*d/h,y=-(l*c)/h,f=s+u,g=i+y,v=s-e/2,p=s+e/2,m=i-t/2,L=i+t/2;let _=[];if(c!==0){let O=(v-f)/c,T=g+O*d;T>=m&&T<=L&&_.push({x:v,y:T});let k=(p-f)/c,E=g+k*d;E>=m&&E<=L&&_.push({x:p,y:E})}if(d!==0){let O=(m-g)/d,T=f+O*c;T>=v&&T<=p&&_.push({x:T,y:m});let k=(L-g)/d,E=f+k*c;E>=v&&E<=p&&_.push({x:E,y:L})}if(_.length===0&&c===0&&d===0)return{x:f,y:g};let S=null,b=1/0;return _.forEach(O=>{const T=Math.sqrt((O.x-n)**2+(O.y-o)**2);T<b&&(b=T,S=O)}),S}const Q={getRectPoint(s,i,e,t,n,o,a,r,l=!1,c=1,d=0,h=14,u=!1){const y=s+n/2,f=i+o/2,g=e+a/2,v=t+r/2;if(c>1){const k=Math.min(h,n,o),E=-k/2,P=k/(c-1),M=l&&u||!l&&!u?E*-1-d*P:E+d*P,w=hn(y,f,n,o,g,v,a,r,M);if(w)return w}const p=y<g?1:-1,m=f<v?1:-1;if(v===f)return{x:y+p*n/2,y:f};const L=Math.abs((g-y)/(v-f)),_=n/o;let S=0,b=0;L<_?(S=p*o/2*L,b=m*o/2):(S=p*n/2,b=m*n/2/L);const O=y+S,T=f+b;return{x:O,y:T}},getRectPointBasic(s,i,e,t,n,o,a,r){const l=s+n/2,c=i+o/2,d=e+a/2,h=t+r/2;let u=h===c?0:(d-l)/(h-c);u===0&&h===c&&d===l?u=1:u===0&&(u=(d-l)/(h-c+(h>c?-1:1)*1e-4));const y=n/o;let f=0,g=0,v="1";return Math.abs(u)<y?(v="2",c<=h?(g=o/2,f=g*u):(g=-o/2,f=g*u)):(v="3",l<=d?(f=n/2,g=u===0&&d===l?0:f/u):(f=-n/2,g=u===0&&d===l?0:f/u)),{x:l+f,y:c+g,_case:v}},getRectJoinPoint(s){const{from_x:i,from_y:e,to_x:t,to_y:n,f_W:o,f_H:a,t_W:r,t_H:l}=s,c=i+o/2,d=e+a/2,h=t+r/2,u=n+l/2,y=Math.atan2(u-d,h-c)*180/Math.PI,f=y<0?y+360:y;return f>45&&f<=135?{x:i+o,y:e+a/2}:f>135&&f<=225?{x:i+o/2,y:e+a}:f>225&&f<=315?{x:i,y:e+a/2}:{x:i+o/2,y:e}},getRectHJoinPoint(s){const{from_x:i,from_y:e,to_x:t,f_W:n,f_H:o,t_W:a}=s,r=o/2;return i+n<t?{x:i+n,y:e+r}:{x:i,y:e+r}},getRectLeftJoinPoint(s){const{from_x:i,from_y:e,f_H:t}=s;return{x:i,y:e+t/2}},getRectRightJoinPoint(s){const{from_x:i,from_y:e,f_W:t,f_H:n}=s;return{x:i+t,y:e+n/2}},getRectTopJoinPoint(s){const{from_x:i,from_y:e,f_W:t}=s;return{x:i+t/2,y:e}},getRectBottomJoinPoint(s){const{from_x:i,from_y:e,f_W:t,f_H:n}=s;return{x:i+t/2,y:e+n}},getRectHorizontalLineJoinPoint(s){return this.getRectVJoinPoint(s)},getRectVerticalLineLineJoinPoint(s){return this.getRectHJoinPoint(s)},getRectVJoinPoint(s){const{from_x:i,from_y:e,to_y:t,f_W:n,f_H:o,t_H:a}=s,r=n/2;return e+o<t?{y:e+o,x:i+r}:{y:e,x:i+r}},getBorderPoint(s,i,e,t,n,o,a,r,l){return l===0?this.getCirclePoint(s,i,e,t,n,o,a,r):this.getRectPoint(s,i,e,t,n,o,a,r)},getBorderPoint4MultiLine(s){const{from_x:i,from_y:e,to_x:t,to_y:n,f_W:o,f_H:a,t_W:r,t_H:l,nodeShape:c,isReverse:d=!1,isEndPoint:h,totalLinesBetweenNodes:u=1,currentLineIndex:y=0,lineDistance:f=50}=s;return c===0?this.getCirclePoint4MultiLine(i,e,t,n,o,a,r,l,d,u,y,f,h):this.getRectPoint(i,e,t,n,o,a,r,l,d,u,y,f,h)},getCirclePoint(s,i,e,t,n,o,a,r){const l=e+a/2,c=t+r/2,d=s+n/2,h=i+o/2,u=l-d;if(u===0)return{x:d,y:h-o/2*(c<h?1:-1)};const f=(c-h)/u,g=Math.sqrt(1/(1/(n/2)**2+f**2/(o/2)**2))*(l<d?1:-1),v=f*g;return{x:d-g,y:h-v}},getCirclePoint4MultiLine(s,i,e,t,n,o,a,r,l,c,d,h,u){let y=e+a/2;const f=t+r/2;let g=s+n/2;const v=i+o/2;let p=y-g;p>-1&&p<1&&(y=y-.5,g=g+.5,p=-1);let L=0;if(c>1){const M=Math.min(h,n,o),w=-M/2,A=M/(c-1);L=l&&u||!l&&!u?w*-1-d*A:w+d*A}const _=f-v,S=Math.sqrt(p**2+_**2)*L/p,b=_/p,O=n/2,T=o/2,k=g<y?-1:1,E=(-1*O**2*b*S+O*T*Math.sqrt(Math.abs(T**2+b**2*O**2-S**2))/k)/(T**2+O**2*b**2),P=b*E+S;return{x:g-E,y:v-P}},getCirclePointBasic(s,i,e,t,n,o,a,r,l){const c=s+n/2,d=i+o/2,h=e+a/2,u=t+r/2,y=h-c,f=u-d,g=Math.sqrt(y*y+f*f),v=g-l,p=v*y/g*-1,m=v*f/g*-1;return{x:h+p,y:u+m}},getCirclePointPlus(s,i,e,t,n,o,a,r){const l=s+n/2,c=i+o/2,d=e+a/2,h=t+r/2,u=d-l,y=h-c,f=Math.sqrt(u*u+y*y),g=(f-n/2)*u/f*-1,v=(f-o/2)*y/f*-1;return{x:d+g,y:h+v}},getOvalPoint(s,i,e,t,n,o=180){const a=t*(360/n),r=(180-o+a)*Math.PI/180;return{x:s+e*Math.sin(r),y:i+e*Math.cos(r)*-1}},getRotatedPoint(s,i,e,t,n){const o=n*Math.PI/180,a=Math.cos(o),r=Math.sin(o),l=(s-e)*a-(i-t)*r+e,c=(s-e)*r+(i-t)*a+t;return{x:l,y:c}},getFlippedX(s,i){return i-(s-i)},getFlippedY(s,i){return i-(s-i)},getAngleType(s,i){if(s>=0&&i>=0)return 1;if(s<0&&i>=0)return 2;if(s<0&&i<0)return 3;if(s>=0&&i<0)return 4},getTextAngle(s,i,e,t){let n=Math.atan2(t-i,e-s)*180/Math.PI;return n<0&&(n+=360),n>90&&n<=270&&(n+=180),n>=360&&(n-=360),Math.round(n)}},ve=(s,i,e,t)=>{const n=s-e,o=i-t;return Math.sqrt(n**2+o**2)};function yt(s,i,e,t,n=0,o=0){let a=1,r=n,l=o,c=0;for(let d of e){const h=d.width,u=d.height;u>c&&(c=u),t(d,r,l),r+=h+i,a>s?(l+=c+i,a=1,r=0,c=0):a++}}class fn{constructor(i){N(this,"graphInstance");N(this,"initialized",!1);this.graphInstance=i}analyzeNetwork(i,e,t=!1,n=!1){this.initialized||(this.initialized=!0),i.forEach(f=>{f.lot||(f.lot={}),f.lot.eached=!1,f.lot.index_of_level=0,f.lot.index_of_p_childs=0,f.lot.index_of_parent=0,f.lot.strength=0,f.lot.strengthWithChilds_from=0,f.lot.strengthWithChilds=0,f.lot.childrenSizeVisible=0,f.lot.childrenSize=0,f.lot.childs=[],f.lot.subling=void 0,f.lot.parent=void 0}),e.lot.parent=void 0;const o=this.markNodeParent(e);C("groupNodes:marked-tree-node:",o.networkNodes.length);const a=[],r={direct:1,min_deep:0,max_deep:0,max_length:1,max_strength:1,levels:new Map},l={direct:-1,min_deep:0,max_deep:0,max_length:1,max_strength:1,levels:new Map},c=[e];this.expandLevelNodesWithDirection(a,c,0,t,n,r,l),this.calcStrengthWithChildsValue(a),this.calcStrengthFromValue(e,1),t&&this.calcStrengthFromValue(e,-1);const d=a.filter(f=>f.lot.level===1),h=d.length===0?1:d.map(f=>f.lot.strengthWithChilds).reduce((f,g)=>f+g,0);r.max_strength=h;const u=a.filter(f=>f.lot.level>=0);C("groupNodes:tree-nodes:",u.length,r);const y={tree:{networkNodes:u,analyticResult:r},reverseTree:{networkNodes:[],analyticResult:l}};if(t){const f=a.filter(p=>p.lot.level===-1),g=f.length===0?1:f.map(p=>p.lot.strengthWithChilds).reduce((p,m)=>p+m,0);l.max_strength=g;const v=a.filter(p=>p.lot.level<=0);C("groupNodes:reverse-tree-nodes:",v.length,l),y.reverseTree.networkNodes=v}for(const f of i)this.graphInstance.updateNode(f,{rgChildrenSize:f.lot.childrenSize});return y}markNodeParent(i){let e=[];return this._markNodeParent(e,[i],0),{networkNodes:e}}_markNodeParent(i,e,t){t===0&&e.forEach(o=>{o.lot.parent=void 0});const n=[];for(const o of e){i.includes(o)||i.push(o);for(const a of this.graphInstance.getNodeRelatedNodes(o))i.includes(a)||(i.push(a),a.lot.parent=o,n.push(a))}n.length>0&&this._markNodeParent(i,n,t+1)}expandLevelNodesWithDirection(i,e,t,n,o,a,r){const l=n&&t<0?r:a;C(`bothWay:${n}(deep:${o}) level ${t} size: ${e.length}`,l.direct),e.length>l.max_length&&(l.max_length=e.length),t>l.max_deep&&(l.max_deep=t),t<l.min_deep&&(l.min_deep=t),l.levels.has(t)||l.levels.set(t,{level:t,all_size:e.length,all_strength:0});const c=l.levels.get(t);e.forEach(f=>{f.lot.eached=!0,f.lot.subling=c,f.lot.level=t,i.push(f)});const d=[],h=[];let u=1,y=0;e.forEach(f=>{let g=[],v=[];n?o||t===0?(g=this.graphInstance.getNodeIncomingNodes(f),v=this.graphInstance.getNodeOutgoingNodes(f)):(t<0&&(u=-1),v=this.graphInstance.getNodeRelatedNodes(f)):v=this.graphInstance.getNodeRelatedNodes(f),this._appendNodeChildrenToNextLevelNodes(f,v,h,c,n,1),this._appendNodeChildrenToNextLevelNodes(f,g,d,c,n,-1),f.lot.index_of_level=y,y++}),c.all_strength>l.max_strength&&(l.max_strength=c.all_strength),h.length>0&&this.expandLevelNodesWithDirection(i,h,t+u,n,o,a,r),d.length>0&&this.expandLevelNodesWithDirection(i,d,t-1,n,o,a,r)}_appendNodeChildrenToNextLevelNodes(i,e,t,n,o,a){let r=0,l=0,c=0;if(e.forEach(d=>{d.lot||(d.lot={eached:!1,childs:[]}),d.lot.eached||(l++,d.lot.parent=i,G.isVisibleNode(d)&&(d.lot.eached=!0,d.lot.index_of_parent=c++,t.push(d),r++),i.lot.childs.push(d))}),a===1){const d=r>0?r:1;i.lot.strength=d,n.all_strength+=d,i.lot.strength_of_level=n.all_strength,i.lot.childrenSizeVisible=r,i.lot.childrenSize=l}}calcStrengthWithChildsValue(i){i.forEach(e=>{e.lot.childrenSizeVisible>0&&(e.lot.strengthWithChilds=0)}),i.forEach(e=>{e.lot.childrenSizeVisible===0&&(e.lot.strengthWithChilds=1,this.conductStrengthToParents(e))})}calcStrengthFromValue(i,e=1){this._calcStrengthFromValue([i],0,e===-1?-1:1)}_calcStrengthFromValue(i,e,t=1){const n=[];let o=0;i.forEach(a=>{(a.lot.level===0||t===(a.lot.level<0?-1:1))&&(a.lot.childs.forEach(r=>{n.push(r)}),a.lot.parent&&o<a.lot.parent.lot.strengthWithChilds_from&&(o=a.lot.parent.lot.strengthWithChilds_from),a.lot.strengthWithChilds_from=o,o+=a.lot.strengthWithChilds)}),n.length>0&&this._calcStrengthFromValue(n,e+(t<0?-1:1),t)}conductStrengthToParents(i){i.lot.parent&&Math.abs(i.lot.level)-1===Math.abs(i.lot.parent.lot.level)&&(i.lot.parent.lot.strengthWithChilds+=1,this.conductStrengthToParents(i.lot.parent))}}class ue{constructor(i,e,t){N(this,"graphOptions");N(this,"layoutOptions");N(this,"graphInstance");N(this,"networkAnalyzer");N(this,"allNodes",[]);N(this,"isMainLayouer",!0);N(this,"requireLinks",!1);N(this,"allLinks",[]);N(this,"rootNode");this.layoutOptions=i,this.graphOptions=e,this.graphInstance=t,this.networkAnalyzer=new fn(t)}setLinks(i){C("setLinks:",i.length),this.allLinks=i}generateCalcNodes(i){const e=[],t=new Map;for(const n of i){const o={rgNode:n,x:n.x,y:n.y,width:n.el_W,height:n.el_H};e.push(o),t.set(n.id,o)}return{calcNodes:e,calcNodeMap:t}}generateLevels(i){const e=[],t=new Map;for(const n of i){if(!n.lot||typeof n.lot.level!="number")continue;const o=n.lot.level;e.includes(o)||(e.push(o),t.set(o,[])),t.get(o).push(n)}return e.sort((n,o)=>n-o),{levels:e,levelNodesMap:t}}adjustNodePositions(i,e,t){if(!i||i.length===0)return[];for(let n=1;n<i.length;n++){const o=i[n],a=i[n-1];switch(e){case"right":o.x<a.x+a.width+t&&(o.x=a.x+a.width+t);break;case"left":o.x+o.width>a.x-t&&(o.x=a.x-o.width-t);break;case"bottom":o.y<a.y+a.height+t&&(o.y=a.y+a.height+t);break;case"top":o.y+o.height>a.y-t&&(o.y=a.y-o.height-t);break}}return i}getReverseAlignItems(i){return un[i]}updateNodePosition(i,e,t){this.graphInstance.updateNode(typeof i=="string"?i:i.id,{x:e,y:t})}layoutEnd(){this.graphInstance&&(this.graphInstance.dataProvider.updateShouldRenderGraphData(),this.graphInstance._dataUpdated())}}const un={start:"end",end:"start",center:"center"};class Se extends ue{constructor(e,t,n){super(e,t,n);N(this,"layoutOptions");N(this,"fastStart",!1);N(this,"skipInitLayout",!1);N(this,"maxLayoutTimes",300);N(this,"byNode",!0);N(this,"byLine",!0);N(this,"lockX",!1);N(this,"lockY",!1);N(this,"force_node_repulsion",1);N(this,"force_line_elastic",1);N(this,"stopWhenBalanced",!1);N(this,"instanceId","");N(this,"calcNodes",[]);N(this,"_graphEventHandler");N(this,"layoutTimes",0);N(this,"prev10",[]);N(this,"visibleNodes",[]);N(this,"_onFinishCallback");N(this,"_onTickCallback");N(this,"calcNodeMap",new WeakMap);N(this,"forCalcNodes",[]);N(this,"recentGraphVelocity",[]);N(this,"graphVelocityBalancedValue",.1);N(this,"prevLogTime",0);N(this,"animationFrameTimer",0);N(this,"prevNodeLevel1Index",0);N(this,"prevNodeLevel2Index",0);N(this,"stoped",!1);N(this,"maxTractionLength",300);N(this,"zeroForceLength",30);N(this,"maxRepulsionDistance",400);N(this,"nodeCollisionRadius",30);N(this,"maxMoveSpeed",100);N(this,"n2nMaxForce",50);this.layoutOptions=e,this.layoutOptions.fastStart!==void 0&&(this.fastStart=this.layoutOptions.fastStart),this.layoutOptions.maxLayoutTimes!==void 0&&(this.maxLayoutTimes=this.layoutOptions.maxLayoutTimes),this.layoutOptions.byNode!==void 0&&(this.byNode=this.layoutOptions.byNode),this.layoutOptions.byLine!==void 0&&(this.byLine=this.layoutOptions.byLine),this.layoutOptions.force_node_repulsion!==void 0&&(this.force_node_repulsion=this.layoutOptions.force_node_repulsion),this.layoutOptions.force_line_elastic!==void 0&&(this.force_line_elastic=this.layoutOptions.force_line_elastic),this.layoutOptions.force_x_coefficient===void 0&&(this.layoutOptions.force_x_coefficient=1),this.layoutOptions.force_y_coefficient===void 0&&(this.layoutOptions.force_y_coefficient=1),this.layoutOptions.disableLiveChanges===void 0&&(this.layoutOptions.disableLiveChanges=!1),this.layoutOptions.stopWhenBalanced&&(this.stopWhenBalanced=!0),this.layoutOptions.skipInitLayout!==void 0&&(this.skipInitLayout=this.layoutOptions.skipInitLayout),this.layoutOptions.maxTractionLength!==void 0&&(this.maxTractionLength=this.layoutOptions.maxTractionLength),this.layoutOptions.zeroForceLength!==void 0&&(this.zeroForceLength=this.layoutOptions.zeroForceLength),this.layoutOptions.maxRepulsionDistance!==void 0&&(this.maxRepulsionDistance=this.layoutOptions.maxRepulsionDistance),this.layoutOptions.nodeCollisionRadius!==void 0&&(this.nodeCollisionRadius=this.layoutOptions.nodeCollisionRadius),this.requireLinks=!0,this.instanceId=n?n.generateNewUUID(5):"error-id"}placeNodes(e,t){if(C("RGForceLayout["+this.instanceId+"].placeNodes"),this.calcNodes=e,this.allNodes.length===0&&(this.allNodes=e),this.rootNode=t,this.fastStart)C("RGForceLayout["+this.instanceId+"] fastStart"),this.calcNodes.forEach(n=>{if(n.fixed===!0)return;let o=n.x,a=n.y,r=!1;(Number.isNaN(o)||o===void 0)&&(o=Math.floor(Math.random()*200)-100,r=!0),(Number.isNaN(a)||a===void 0)&&(a=Math.floor(Math.random()*200)-100,r=!0),o===0&&a===0&&(o=Math.floor(Math.random()*200)-100,a=Math.floor(Math.random()*200)-100,r=!0),r&&this.updateNodePosition(n,o,a)});else if(!this.skipInitLayout){if(C("!!!initNodesPosition....."),t){C("layout by root:",t),(Number.isNaN(t.x)||t.x===void 0)&&this.updateNodePosition(t,0,0);const{tree:n}=this.networkAnalyzer.analyzeNetwork(e,t),{networkNodes:o,analyticResult:a}=n;t.fixed||this.layoutOptions.fixedRootNode||this.updateNodePosition(t,0,0);const r=G.getNodeLotXY({alignItemsX:"center",alignItemsY:"center"},t);t.lot.x=r.x,t.lot.y=r.y,this.placeRelativePosition(t,o,a,1,[]),C("!!!initNodesPosition fixedRootNode:2:",t.x,t.y),o.forEach(l=>{if(l.fixed===!0||!l.rgCalcedVisibility||l===t)return;const c=l.lot.x-G.getNodeWidth(l)/2,d=l.lot.y-G.getNodeHeight(l)/2;this.updateNodePosition(l,c,d)})}}this.allNodes.forEach(n=>{let o=n.x,a=n.y,r=!1;(Number.isNaN(o)||o===void 0)&&(o=0,r=!0),(Number.isNaN(a)||a===void 0)&&(a=0,r=!0),r&&this.updateNodePosition(n,o,a)}),C("["+this.instanceId+"]Start Auto Layout....."),this.start()}getLevelR(e,t){if(e.length===0)return;let n=0;for(let o=0;o<t;o++)n+=e[o]||e[e.length-1];return n}placeRelativePosition(e,t,n,o,a){const r=Math.min(this.graphOptions.viewSize.height,this.graphOptions.viewSize.width)*.4;let l=Math.min(Math.max(r,150),400)*o;C("analyticResult:",this.layoutOptions,n,r,l,o,a);const c={x:e.lot.x,y:e.lot.y},d=t.filter(h=>h.lot.level===1);this.placeNodesInFanRegion(d,0,360,c,1,n.max_strength,a,1,o)}placeNodesInFanRegion(e,t,n,o,a,r,l,c,d=1){var g,v;console.warn("[center]levelNodes:",a,e.length,r);let h=t;const u=n-t,y=200,f=this.getLevelR(l,a)||a*y*d;for(const p of e){const m=((g=p.lot)==null?void 0:g.strengthWithChilds)/r,L=o.x+f,_=o.y,S=m*u,b=h+S/2,O=Q.getRotatedPoint(L,_,o.x,o.y,b);p.lot.x=O.x,p.lot.y=O.y,p.lot.childs&&p.lot.childs.length>0&&this.placeNodesInFanRegion(p.lot.childs,h,h+S,o,a+1,(v=p.lot)==null?void 0:v.strengthWithChilds,l,c+1),h+=S}}graphEventHandle(e,...t){if(e===V.onNodeDragStart){const n=t[0],o=this.calcNodeMap.get(n);o&&(o.dragging=!0)}else if(e===V.onNodeDragging){const n=t[0],o=t[1],a=t[2],r=this.calcNodeMap.get(n);console.log("[force]onNodeDragging:",n.id,r),r&&(r.x=o,r.y=a)}else if(e===V.onNodeDragEnd){const n=t[0],o=this.calcNodeMap.get(n);o&&(o.dragging=!1)}}connectToGraphInstance(){this._graphEventHandler=this.graphEventHandle.bind(this),this.graphInstance&&this.graphInstance.addEventHandler(this._graphEventHandler)}disConnectToGraphInstance(){this.graphInstance&&this.graphInstance.removeEventHandler(this._graphEventHandler)}updateVisibleNodes(e){this.visibleNodes=[],e&&(this.allNodes=e),this.allNodes.forEach(t=>{t.lot||(C("node miss lot:",t.text),t.lot={x:t.x,y:t.y,childs:[]}),this.visibleNodes.push(t)}),this.resetCalcNodes(),C("visibleNodes:",this.visibleNodes.length)}viewUpdate(){this._onTickCallback&&this._onTickCallback(),this.graphInstance&&this.graphInstance.forceLayoutTickCallback()}autoLayout(e=!1){if(this.updateVisibleNodes(),this.isMainLayouer){const t=this.graphInstance.dataProvider.getOptions();this.graphInstance.dataProvider.updateOptions({layout:{...t.layout,autoLayouting:!0}})}this.doForceLayout(0)}onFinish(e){this._onFinishCallback=e}onTick(e){this._onTickCallback=e}applyFBuffToNodes(){for(const e of this.forCalcNodes)this.applyToNodePosition(e)}applyPositionToNodes(){this.visibleNodes.forEach(e=>{if(e.fixed)return;const t=this.calcNodeMap.get(e);t&&(e.x=t.x,e.y=t.y)}),this.viewUpdate()}layoutFinished(){if(cancelAnimationFrame(this.animationFrameTimer),this.isMainLayouer){const e=this.graphInstance.dataProvider.getOptions();this.graphInstance.dataProvider.updateOptions({layout:{...e.layout,autoLayouting:!1}})}C("Force Layout["+this.instanceId+"] finished"),this.applyFBuffToNodes(),this.applyPositionToNodes(),this.disConnectToGraphInstance();try{this._onFinishCallback&&this._onFinishCallback()}catch(e){console.error(e)}}resetCalcNodes(){C("resetCalcNodes:",this.visibleNodes.length),this.forCalcNodes=[],this.calcNodeMap=new WeakMap,this.visibleNodes.forEach(e=>{const t={rgNode:e,Fx:0,Fy:0,x:e.x,y:e.y,dragging:!1,force_weight:e.force_weight||1,forceCenterOffset_X:(e.width||e.el_W||60)/2,forceCenterOffset_Y:(e.height||e.el_H||60)/2,fixed:e.fixed||!1};this.forCalcNodes.push(t),this.calcNodeMap.set(e,t)})}start(){this.stoped&&this.layoutTimes===0||(this.stoped=!1,this.layoutTimes=0,this.updateVisibleNodes(),this.connectToGraphInstance(),this.autoLayout(!0))}doForceLayout(e){if(this.graphInstance.viewComponentUnmounted){C("["+this.instanceId+"]stop layout:viewComponentUnmounted"),this.layoutFinished();return}let t="0";e>0?(this.prev10.length>=10&&(this.prev10.splice(0,1),t=(1e3/((this.prev10[this.prev10.length-1]-this.prev10[0])/10)).toFixed(1)),this.prev10.push(e)):this.visibleNodes.length===0&&this.updateVisibleNodes(),this.layoutTimes++,this.calcNodesPosition(),this.applyFBuffToNodes(),this.layoutOptions.disableLiveChanges||this.layoutTimes%2===0&&this.applyPositionToNodes(),this.layoutTimes<=this.maxLayoutTimes?(Date.now()-this.prevLogTime>3e3&&(C("Force Layout["+this.instanceId+"] Is Working...layoutTimes:",this.layoutTimes,"of",this.maxLayoutTimes,t,"Hz",this.visibleNodes.length),this.prevLogTime=Date.now()),this.animationFrameTimer=requestAnimationFrame(this.doForceLayout.bind(this))):this.layoutFinished()}calcNodesPosition(){if(this.byNode)for(let e=this.prevNodeLevel1Index;e<this.forCalcNodes.length;e++){const t=this.forCalcNodes[e];if(!t.dragging&&!t.fixed){for(let n=this.prevNodeLevel2Index;n<this.forCalcNodes.length;n++)if(e!==n){const o=this.forCalcNodes[n];if(o.dragging)continue;this.addGravityByNode(t,o)}}}if(this.byLine){if(this.allLinks&&this.allLinks.length>0){for(const e of this.allLinks)if(!e.line.forDisplayOnly){let t=e.line.force_elastic===void 0?1:e.line.force_elastic;if(this.visibleNodes.includes(e.fromNode)&&this.visibleNodes.includes(e.toNode)){const n=this.calcNodeMap.get(e.fromNode),o=this.calcNodeMap.get(e.toNode);this.addElasticByLine(n,o,t)}}}else for(const e of this.visibleNodes)if(e.lot&&e.lot.parent){const t=this.calcNodeMap.get(e.lot.parent),n=this.calcNodeMap.get(e);this.addElasticByLine(t,n,1)}}return!0}stop(){if(this.stoped=!0,this.layoutTimes===0)return;const e=this.graphInstance.dataProvider.getOptions();cancelAnimationFrame(this.animationFrameTimer),C("[RGForceLayout]["+this.instanceId+"]stop:",e.layout.autoLayouting,this.layoutTimes),this.layoutTimes=Number.MAX_VALUE,this.layoutFinished()}addElasticByLine(e,t,n=1){const o=e.x,a=e.y,r=t.x,l=t.y;let c=Math.sqrt((a-l)**2+(o-r)**2);if(c<this.zeroForceLength)return;c>this.maxTractionLength&&(c=this.maxTractionLength);const d=(c-this.zeroForceLength)*.05*this.force_line_elastic*n,h=d,u=d,y=(o-r)/c,f=(a-l)/c;this.addFtoNode(e,y*h*-1,f*h*-1),this.addFtoNode(t,y*u,f*u)}addGravityByNode(e,t,n=1){const o=e.x,a=e.y,r=t.x,l=t.y;if(n===1&&(Math.abs(o-r)>this.maxRepulsionDistance||Math.abs(a-l)>this.maxRepulsionDistance))return;const c=Math.sqrt((a-l)**2+(o-r)**2);if(n===1&&c>this.maxRepulsionDistance)return;let d=(this.maxRepulsionDistance-c)*.05*this.force_node_repulsion*n;c<this.nodeCollisionRadius&&(d=d*2);const h=(o-r)/c,u=(a-l)/c;this.addFtoNode(e,h*d,u*d)}addFtoNode(e,t,n){if(e.fixed||e.dragging||Number.isNaN(t)||Number.isNaN(n))return;t>this.n2nMaxForce&&(t=this.n2nMaxForce),n>this.n2nMaxForce&&(n=this.n2nMaxForce),t<-this.n2nMaxForce&&(t=-this.n2nMaxForce),n<-this.n2nMaxForce&&(n=-this.n2nMaxForce);const o=e.force_weight||1;this.lockX||(e.Fx+=t*(1/o)),this.lockY||(e.Fy+=n*(1/o))}applyToNodePosition(e){if(e.fixed)return 0;if(e.dragging){const o=e.rgNode;return this.updateNodePosition(o,e.x,e.y),0}if(this.calcNodes!==this.allNodes&&!this.calcNodes.includes(e.rgNode))return 0;let t=e.Fx,n=e.Fy;if(t>this.maxMoveSpeed&&(t=this.maxMoveSpeed),n>this.maxMoveSpeed&&(n=this.maxMoveSpeed),t<-this.maxMoveSpeed&&(t=-this.maxMoveSpeed),n<-this.maxMoveSpeed&&(n=-this.maxMoveSpeed),e.x=e.x+t*this.layoutOptions.force_x_coefficient,e.y=e.y+n*this.layoutOptions.force_y_coefficient,!this.layoutOptions.disableLiveChanges){const o=e.rgNode;this.updateNodePosition(o,e.x,e.y)}e.Fx=0,e.Fy=0}}class vt extends ue{constructor(e,t,n){super(e,t,n);N(this,"enableGatherNodes",!1);N(this,"layoutOptions");this.layoutOptions=e,C("new RGTreeLayout:",this.layoutOptions),this.layoutOptions.from||(this.layoutOptions.from="left"),this.layoutOptions.levelGaps||(this.layoutOptions.levelGaps=[]);const o=this.layoutOptions.from;console.log("this.layoutOptions.alignItemsX:1:",this.layoutOptions.alignItemsX),o==="top"||o==="bottom"?(this.layoutOptions.treeNodeGapH||(this.layoutOptions.treeNodeGapH=10),this.layoutOptions.treeNodeGapV||(this.layoutOptions.treeNodeGapV=50)):(this.layoutOptions.treeNodeGapH||(this.layoutOptions.treeNodeGapH=50),this.layoutOptions.treeNodeGapV||(this.layoutOptions.treeNodeGapV=10)),o==="top"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="center"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="start"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.layoutOptions.alignItemsX),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.getReverseAlignItems(this.layoutOptions.alignItemsY))):o==="bottom"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="center"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="end"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.layoutOptions.alignItemsX),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.getReverseAlignItems(this.layoutOptions.alignItemsY))):o==="right"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="end"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="center"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.getReverseAlignItems(this.layoutOptions.alignItemsX)),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.layoutOptions.alignItemsY)):(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="start"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="center"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.getReverseAlignItems(this.layoutOptions.alignItemsX)),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.layoutOptions.alignItemsY)),console.log("this.layoutOptions.alignItemsX:2:",this.layoutOptions.alignItemsX),this.layoutOptions.ignoreNodeSize===void 0&&(this.layoutOptions.ignoreNodeSize=!1);const a=this.layoutOptions.layoutExpansionDirection,r=a==="start"||a==="left"||a==="top"?"start":a==="end"||a==="right"||a==="bottom"?"end":"center";this.layoutOptions.layoutExpansionDirection=r,this.layoutOptions.levelDistance&&console.error("Error: levelDistance is not support\uFF0C Please use levelGaps or treeNodeGapH,treeNodeGapV option in layoutOptions"),this.enableGatherNodes=this.layoutOptions.enableGatherNodes,this.layoutOptions.rotate||(this.layoutOptions.rotate=0)}placeNodes(e,t){if(console.log("tree:placeNodes:rootNode",t.id,t),C("RGTreeLayout:placeNodes"),t)C("layout by root:",t);else{console.error("root is null");return}C("allNodes:",e.length);const n={alignItemsX:this.layoutOptions.alignItemsX,alignItemsY:this.layoutOptions.alignItemsY},o={alignItemsX:this.layoutOptions.alignParentItemsX,alignItemsY:this.layoutOptions.alignParentItemsY};this.rootNode=t,this.allNodes=e,t.fixed||this.layoutOptions.fixedRootNode||this.updateNodePosition(t,0,0);const a=G.getNodeLotXY(n,t);t.lot.x=a.x,t.lot.y=a.y;const r=e;if(C("groupNodes:2:",r.length,r.map(d=>d.text).join(",")),this.layoutOptions.simpleTree===!0){const{tree:d}=this.networkAnalyzer.analyzeNetwork(r,this.rootNode,!1);this.placeNodesPosition(this.rootNode,d.networkNodes,d.analyticResult)}else{const{tree:d,reverseTree:h}=this.networkAnalyzer.analyzeNetwork(r,this.rootNode,!0);this.placeNodesPosition(this.rootNode,d.networkNodes,d.analyticResult),this.placeNodesPosition(this.rootNode,h.networkNodes,h.analyticResult)}const l=this.layoutOptions.rotate||0;console.log("rotate:",l);const c={x:t.x,y:t.y};this.allNodes.forEach(d=>{if(d.fixed!==!0&&!!G.isVisibleNode(d)&&(Number.isNaN(d.lot.x)&&(C("bad lot x:",d.text,d.lot.x),d.lot.x=0),Number.isNaN(d.lot.y)&&(C("bad lot y:",d.text,d.lot.y),d.lot.y=0),d!==t)){if(l){const f=Q.getRotatedPoint(d.lot.x,d.lot.y,c.x,c.y,l);d.lot.x=f.x,d.lot.y=f.y}const h=d.lot.level<0?o:n,u=G.getNodeXByLotX(h,d),y=G.getNodeYByLotY(h,d);this.updateNodePosition(d,u,y)}}),C("create rootNode coordinates:1",t.x,t.y),this.layoutEnd()}placeNodesPosition(e,t,n){this.placeRelativePosition(e,t,n)}placeRelativePosition(e,t,n){const o=this.layoutOptions.layoutExpansionDirection,{levels:a,levelNodesMap:r}=this.generateLevels(t),l=n.max_strength;if(this.layoutOptions.from==="top"||this.layoutOptions.from==="bottom"){const c=this.layoutOptions.treeNodeGapH||20,d=this.layoutOptions.treeNodeGapV||20,h=new Map;for(const v of a){const p=r.get(v);h.set(v,Math.max(...p.map(m=>m.el_H)))}let u=0,y=0;for(const v of t){const p=v.el_W;u+=p,y++}const g=u/y+c;t.forEach(v=>{v.fixed!==!0&&v!==e&&(this.layoutOptions.from==="bottom"?v.lot.y=e.lot.y-this.getLevelDistance(v.lot.level,h,d+10):v.lot.y=e.lot.y+this.getLevelDistance(v.lot.level,h,d+10))}),t.forEach(v=>{v.fixed!==!0&&v.lot.level!==0&&(o==="start"?v.lot.x=e.lot.x-g*v.lot.strengthWithChilds_from:o==="end"?v.lot.x=e.lot.x+g*v.lot.strengthWithChilds_from:v.lot.x=e.lot.x+g*(l/-2+v.lot.strengthWithChilds_from+v.lot.strengthWithChilds/2))}),this.applyNodesGap(t,"v"),this.gatherNodes(t,"v",g)}else{const c=this.layoutOptions.treeNodeGapH||20,d=this.layoutOptions.treeNodeGapV||20;console.log("levelNodesMap:",r);const h=new Map;for(const v of a){const p=r.get(v);h.set(v,Math.max(...p.map(m=>m.el_W||m.width)))}let u=0,y=0;for(const v of t){const p=v.el_H;u+=p,y++}if(y===0)return;const g=u/y+d;t.forEach(v=>{v.fixed!==!0&&v!==e&&(this.layoutOptions.from==="right"?v.lot.x=e.lot.x-this.getLevelDistance(v.lot.level,h,c+50):v.lot.x=e.lot.x+this.getLevelDistance(v.lot.level,h,c+50))}),t.forEach(v=>{v.fixed!==!0&&v.lot.level!==0&&(o==="start"?v.lot.y=e.lot.y-g*v.lot.strengthWithChilds_from:o==="end"?v.lot.y=e.lot.y+g*v.lot.strengthWithChilds_from:v.lot.y=e.lot.y+g*(l/-2+v.lot.strengthWithChilds_from+v.lot.strengthWithChilds/2))}),console.log("levelMaxWidthMap:",e.id,h),this.applyNodesGap(t,"h"),this.gatherNodes(t,"h",g)}}getLevelDistance(e,t,n){if(e===0)return 0;if(e>0){let o=0;for(let a=0;a<e;a++){const r=t.get(a);o+=r+this.getLevelGap(a,n,r,e)}return o}else{let o=0;for(let a=0;a>e;a--){const r=t.get(a);o+=r+this.getLevelGap(a,n,r,e)}return-o}}getLevelGap(e,t,n,o){let a=t+(o===-1&&e===0?n/2:0);if(this.layoutOptions.levelGaps.length>0){const r=this.layoutOptions.levelGaps[Math.abs(e)];r&&(a=r)}return a}applyNodesGap(e,t){if(this.layoutOptions.ignoreNodeSize)return;const n={alignItemsX:this.layoutOptions.alignItemsX,alignItemsY:this.layoutOptions.alignItemsY},o={alignItemsX:this.layoutOptions.alignParentItemsX,alignItemsY:this.layoutOptions.alignParentItemsY},a=this.layoutOptions.layoutExpansionDirection,{levels:r,levelNodesMap:l}=this.generateLevels(e),c=new Map;for(const u of r){const y=l.get(u);c.set(u,Math.max(...y.map(f=>f.el_W)))}const{calcNodes:d,calcNodeMap:h}=this.generateCalcNodes(e);d.forEach(u=>{const y=u.rgNode.lot.level<0?o:n;u.x=G.getNodeXByLotX(y,u.rgNode),u.y=G.getNodeYByLotY(y,u.rgNode),u.width=u.rgNode.el_W,u.height=u.rgNode.el_H,u.buffY=0});for(const u of r){const y=l.get(u)||[];if(t==="h")if(a==="end"){y.sort((g,v)=>g.lot.y-v.lot.y);const f=y.map(g=>h.get(g.id));this.adjustNodePositions(f,"bottom",this.layoutOptions.treeNodeGapV);for(const g of f){const v=g.rgNode.lot.level<0?o:n;g.rgNode.lot.y=G.getNodeLotXY(v,g).y}}else{y.sort((g,v)=>v.lot.y-g.lot.y);const f=y.map(g=>h.get(g.id));this.adjustNodePositions(f,"top",this.layoutOptions.treeNodeGapV);for(const g of f){const v=g.rgNode.lot.level<0?o:n;g.rgNode.lot.y=G.getNodeLotXY(v,g).y}}else if(a==="end"){y.sort((g,v)=>g.lot.x-v.lot.x);const f=y.map(g=>h.get(g.id));this.adjustNodePositions(f,"right",this.layoutOptions.treeNodeGapH);for(const g of f){const v=g.rgNode.lot.level<0?o:n,p=G.getNodeLotXY(v,g);g.rgNode.lot.x=p.x}}else{y.sort((g,v)=>v.lot.x-g.lot.x);const f=y.map(g=>h.get(g.id));this.adjustNodePositions(f,"left",this.layoutOptions.treeNodeGapH);for(const g of f){const v=g.rgNode.lot.level<0?o:n;g.rgNode.lot.x=G.getNodeLotXY(v,g).x}}console.log("levelNodes:",u,y)}if(t==="h"){const u=new Map,y=new Map;for(const L of r){const S=l.get(L).map(b=>h.get(b.id));u.set(L,Math.max(...S.map(b=>b.width))),y.set(L,Math.min(...S.map(b=>b.x)))}const f=this.layoutOptions.treeNodeGapH;let g=r.filter(L=>L>0).sort((L,_)=>L-_),v=r.filter(L=>L<0).sort((L,_)=>_-L),p=1;this.layoutOptions.from==="right"&&([v,g]=[g,v],p=-1);let m=0;for(const L of g){const _=L-p,S=y.get(_),b=u.get(_),O=y.get(L)+m;u.get(L);const T=S+b+f;if(T>O){const k=T-O;console.log("[xxxxx]move",_,L,T,O,k),m=k;const E=l.get(L);for(const P of E)P.lot.x+=m;y.set(L,O+k)}else console.log("[xxxxx]goon",_,L,T,O),y.set(L,O)}m=0;for(const L of v){const _=L+p,S=y.get(_);u.get(_);const b=y.get(L)+m,O=u.get(L),T=S-f;if(b+O>T){const k=T-(b+O);m=k;const E=l.get(L);for(const P of E)P.lot.x+=m;y.set(L,b+k)}else y.set(L,b)}}else{const u=new Map,y=new Map;for(const L of r){const S=l.get(L).map(b=>h.get(b.id));u.set(L,Math.max(...S.map(b=>b.height))),y.set(L,Math.min(...S.map(b=>b.y)))}const f=this.layoutOptions.treeNodeGapV;let g=r.filter(L=>L>0).sort((L,_)=>L-_),v=r.filter(L=>L<0).sort((L,_)=>_-L),p=1;this.layoutOptions.from==="bottom"&&([v,g]=[g,v],p=-1);let m=0;for(const L of g){const _=L-p,S=y.get(_),b=u.get(_),O=y.get(L)+m;u.get(L);const T=S+b+f;if(T>O){const k=T-O;console.log("[xxxxx]move",_,L,T,O,k),m=k;const E=l.get(L);for(const P of E)P.lot.y+=m;y.set(L,O+k)}else console.log("[xxxxx]goon",_,L,T,O),y.set(L,O)}m=0;for(const L of v){const _=L+p,S=y.get(_);u.get(_);const b=y.get(L)+m,O=u.get(L),T=S-f;if(b+O>T){const k=T-(b+O);m=k;const E=l.get(L);for(const P of E)P.lot.y+=m;y.set(L,b+k)}else y.set(L,b)}}}gatherNodes(e,t,n){if(!this.enableGatherNodes)return;const{calcNodes:o,calcNodeMap:a}=this.generateCalcNodes(e);o.forEach(l=>{l.movedNodeSizeBefore=1,l.movedNodeSizeAfter=1});const{levelNodesMap:r}=this.generateLevels(e);e.forEach(l=>{if(l.fixed!==!0&&l.lot.level!==0){const c=r.get(l.lot.level)||[];if(l.lot.strengthWithChilds===1&&l.lot.childrenSizeVisible<=1){const d=this.getBloomingNearByParent(l,l.lot.parent,c,t);if(d){const h=a.get(l.id);t==="h"?l.lot.y-d.lot.y>0?(l.lot.y=d.lot.y+n*h.movedNodeSizeAfter,h.movedNodeSizeAfter++):(l.lot.y=d.lot.y-n*h.movedNodeSizeBefore,h.movedNodeSizeBefore++):l.lot.x-d.lot.x>0?(l.lot.x=d.lot.x+n*h.movedNodeSizeAfter,h.movedNodeSizeAfter++):(l.lot.x=d.lot.x-n*h.movedNodeSizeBefore,h.movedNodeSizeBefore++)}}}})}getBloomingNearByParent(e,t,n,o){let a=9999,r;for(const l of n)if(l.lot.childrenSizeVisible>1&&l.lot.parent===t){const c=o==="h"?l.lot.y-t.lot.y:l.lot.x-t.lot.x;Math.abs(c)<a&&(a=Math.abs(c),r=l)}if(r&&r!==e)return r}}class mt extends Se{constructor(e,t,n){super(e,t,n);N(this,"layoutOptions");this.layoutOptions=e,this.layoutOptions.distance_coefficient||(this.layoutOptions.distance_coefficient=1),this.layoutOptions.levelGaps&&!this.layoutOptions.levelGaps&&(this.layoutOptions.levelDistance=[...this.layoutOptions.levelGaps])}placeNodes(e,t){if(C("RGCenterLayout:placeNodes"),!t){C("root is null:",t);return}C("layout by root:",t),this.allNodes=e,this.calcNodes=e,this.rootNode=t;const{tree:n}=this.networkAnalyzer.analyzeNetwork(e,this.rootNode),{networkNodes:o,analyticResult:a}=n;if(this.layoutOptions.genLotInfoOnly){C("only gen lot info, return");return}t.fixed||this.layoutOptions.fixedRootNode||this.updateNodePosition(t,0,0);const r={alignItemsX:this.layoutOptions.alignItemsX||"center",alignItemsY:this.layoutOptions.alignItemsY||"center"},l=G.getNodeLotXY(r,t);t.lot.x=l.x,t.lot.y=l.y,C("root position:",t.lot.x,t.lot.y);const c=this.layoutOptions.distance_coefficient||1,d=this.getLevelDistanceArr();this.placeRelativePosition(this.rootNode,o,a,c,d),o.forEach(h=>{if(h.fixed!==!0&&!!h.rgCalcedVisibility&&h!==t){const u=r,y=G.getNodeXByLotX(u,h),f=G.getNodeYByLotY(u,h);this.updateNodePosition(h,y,f)}}),this.layoutEnd()}getLevelDistanceArr(){let e=[];if(this.layoutOptions.levelDistance){if(Array.isArray(this.layoutOptions.levelDistance))e=this.layoutOptions.levelDistance;else return console.error("Error levelDistance, levelDistance must is Array"),new Array(10).fill(200);if(e.length>0&&e.length<10)for(let t=e.length;t<10;t++)e.push(e[e.length-1])}return e}}class xt extends Se{constructor(i,e,t){super(i,e,t)}placeNodes(i,e){if(e)C("layout by root:",e);else{C("root is null:",e);return}this.allNodes=i,this.rootNode=e,e.fixed||this.layoutOptions.fixedRootNode||this.updateNodePosition(e,0,0);const t={alignItemsX:this.layoutOptions.alignItemsX||"center",alignItemsY:this.layoutOptions.alignItemsY||"center"},n=G.getNodeLotXY(t,e);e.lot.x=n.x,e.lot.y=n.y;const o=this.allNodes.filter(l=>l.rgCalcedVisibility),a=o.length;let r=a*90/Math.PI/2;r<200&&(r=200),r>800&&(r=800),o.forEach((l,c)=>{const d=Q.getOvalPoint(e.lot.x,e.lot.y,r,c,a);l.lot.x=d.x,l.lot.y=d.y,console.log("xxxxxxxxxxxxxx:",l.id,l.lot.x,l.lot.y)}),o.forEach(l=>{if(l===e||l.fixed===!0||!l.rgCalcedVisibility)return;const c=t,d=G.getNodeXByLotX(c,l),h=G.getNodeYByLotY(c,l);this.updateNodePosition(l,d,h)}),this.layoutEnd()}}class Ct extends ue{constructor(e,t,n){super(e,t,n);N(this,"graphOptions");N(this,"layoutOptions");N(this,"allNodes",[]);this.layoutOptions=e,this.graphOptions=t}placeNodes(e,t){if(t)C("layout by root:",t);else{C("root is null:",t);return}C("allNodes:",e.length),this.networkAnalyzer.analyzeNetwork(e,t,!1,!1),C("[Fixed layout canvasOffset]",this.graphOptions.viewSize,this.graphOptions.canvasSize),this.layoutEnd()}}class gn extends ue{constructor(e,t,n){super(e,t,n);N(this,"graphInstance");N(this,"layoutOptions");N(this,"levelGaps",[]);this.layoutOptions=e,C("new RGSmartTreeLayout:",this.layoutOptions),this.layoutOptions.from||(this.layoutOptions.from="left"),this.layoutOptions.levelGaps&&(Array.isArray(this.layoutOptions.levelGaps)?this.levelGaps=this.layoutOptions.levelGaps:console.error("Error levelDistance, levelDistance must is Array"));const o=this.layoutOptions.from;o==="top"||o==="bottom"?(this.layoutOptions.treeNodeGapH||(this.layoutOptions.treeNodeGapH=10),this.layoutOptions.treeNodeGapV||(this.layoutOptions.treeNodeGapV=30),this.layoutOptions.treeNodeGapV<30&&(this.layoutOptions.treeNodeGapV=30)):(this.layoutOptions.treeNodeGapH||(this.layoutOptions.treeNodeGapH=30),this.layoutOptions.treeNodeGapV||(this.layoutOptions.treeNodeGapV=10),this.layoutOptions.treeNodeGapH<30&&(this.layoutOptions.treeNodeGapH=30)),o==="top"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="center"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="start"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.layoutOptions.alignItemsX),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.getReverseAlignItems(this.layoutOptions.alignItemsY))):o==="bottom"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="center"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="end"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.layoutOptions.alignItemsX),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.getReverseAlignItems(this.layoutOptions.alignItemsY))):o==="right"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="end"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="center"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.getReverseAlignItems(this.layoutOptions.alignItemsX)),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.layoutOptions.alignItemsY)):(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="end"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="center"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.getReverseAlignItems(this.layoutOptions.alignItemsX)),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.layoutOptions.alignItemsY)),console.log("this.layoutOptions.alignItemsX:2:",this.layoutOptions.alignItemsX,this.layoutOptions.alignItemsY),this.requireLinks=!0,this.graphInstance=n}placeNodes(e,t){if(C("RGSmartTreeLayout:placeNodes"),t)C("layout by root:",t);else{console.error("root is null");return}this.rootNode=t,this.allNodes=e,C("allNodes:",e.length);const n={alignItemsX:this.layoutOptions.alignItemsX,alignItemsY:this.layoutOptions.alignItemsY},o={alignItemsX:this.layoutOptions.alignParentItemsX,alignItemsY:this.layoutOptions.alignParentItemsY},{tree:a,reverseTree:r}=this.networkAnalyzer.analyzeNetwork(e,this.rootNode,!0,!0);t.fixed||this.layoutOptions.fixedRootNode||this.updateNodePosition(t,0,0);const l=G.getNodeLotXY(n,t);t.lot.x=l.x,t.lot.y=l.y,this.placeRelativePosition(t,[...a.networkNodes].concat(r.networkNodes),Math.max(a.analyticResult.max_strength,r.analyticResult.max_strength)),C("allNodes:",e.length);const c={left:0,top:90,right:180,bottom:270}[this.layoutOptions.from],d={x:t.x,y:t.y};this.allNodes.forEach(y=>{if(y.fixed===!0||!y.rgCalcedVisibility)return;if(Number.isNaN(y.lot.x)&&(C("bad lot x:",y.text,y.lot.x),y.lot.x=0),Number.isNaN(y.lot.y)&&(C("bad lot y:",y.text,y.lot.y),y.lot.y=0),c){const p=Q.getRotatedPoint(y.lot.x,y.lot.y,d.x,d.y,c);y.lot.x=p.x,y.lot.y=p.y}const f=y.lot.level<0?o:n,g=G.getNodeXByLotX(f,y),v=G.getNodeYByLotY(f,y);this.updateNodePosition(y,g,v)}),C("create rootNode coordinates:1",t.x,t.y);const h=new Se({layoutName:"force",maxLayoutTimes:30,force_node_repulsion:.1,force_line_elastic:1,fixedRootNode:!0,disableLiveChanges:!0},this.graphOptions,this.graphInstance);h.isMainLayouer=!1,h.requireLinks=!0,this.layoutOptions.from==="top"||this.layoutOptions.from==="bottom"?h.lockY=!0:h.lockX=!0;const u=t.fixed;t.fixed=!0,h.skipInitLayout=!0,h.setLinks(this.graphInstance.getLinks()),h.resetCalcNodes(),setTimeout(()=>{t.fixed=u},800),h.onFinish(()=>{t.fixed=u,this.graphInstance&&(this.graphInstance.enableNodeXYAnimation(),this.graphInstance._dataUpdated()),this.applyNodesGap(this.allNodes),this.graphInstance&&(this.graphInstance._dataUpdated(),setTimeout(()=>{this.graphInstance.disableNodeXYAnimation(),this.graphInstance._dataUpdated()},300))}),h.placeNodes(this.allNodes,t),this.layoutEnd()}placeRelativePosition(e,t,n){const o=this.layoutOptions.from==="top"||this.layoutOptions.from==="bottom"?"v":"h";let a=this.layoutOptions.treeNodeGapH||300,r=this.layoutOptions.treeNodeGapV||10;o==="v"&&([a,r]=[r,a]);const{levels:l,levelNodesMap:c}=this.generateLevels(t),d=new Map;for(const g of l){const v=c.get(g);d.set(g,Math.max(...v.map(p=>p.el_W)))}let h=0,u=0;for(const g of t){const v=g.el_H;h+=v,u++}if(u===0)return;const f=h/u+r;t.forEach(g=>{g.fixed!==!0&&g!==e&&(g.lot.x=e.lot.x+this.getLevelDistance(g.lot.level,d,a))}),t.forEach(g=>{g.fixed!==!0&&g!==e&&(g.lot.level===0?g.lot.y=e.lot.y+f*g.lot.index_of_level:g.lot.y=e.lot.y+f*(n/-2+g.lot.strengthWithChilds_from+g.lot.strengthWithChilds/2))})}applyNodesGap(e){const t=this.layoutOptions.from==="top"||this.layoutOptions.from==="bottom"?"v":"h",{levels:n,levelNodesMap:o}=this.generateLevels(e),a=new Map;for(const c of n){const d=o.get(c);a.set(c,Math.max(...d.map(h=>h.el_W)))}const{calcNodes:r,calcNodeMap:l}=this.generateCalcNodes(e);r.forEach(c=>{c.x=c.rgNode.x,c.y=c.rgNode.y,c.width=c.rgNode.el_W,c.height=c.rgNode.el_H,c.buffY=0});for(const c of n){const d=o.get(c)||[];if(t==="h"){const h=d.map(f=>l.get(f.id)),u=h.filter(f=>f.y<this.rootNode.y).sort((f,g)=>g.y-f.y),y=h.filter(f=>f.y>=this.rootNode.y).sort((f,g)=>f.y-g.y);this.adjustNodePositions(u,"top",5),this.adjustNodePositions(y,"bottom",5);for(const f of h)f.rgNode.y=f.y}else{const h=d.map(f=>l.get(f.id)),u=h.filter(f=>f.x<this.rootNode.x).sort((f,g)=>g.x-f.x),y=h.filter(f=>f.x>=this.rootNode.x).sort((f,g)=>f.x-g.x);this.adjustNodePositions(u,"left",5),this.adjustNodePositions(y,"right",5);for(const f of h)f.rgNode.x=f.x}console.log("levelNodes:",c,d)}}getLevelDistance(e,t,n){if(e===0)return 0;if(e>0){let o=0;for(let a=1;a<=e;a++){const r=t.get(a);o+=r+this.getLevelGap(a,n,r)}return o}else{let o=0;for(let a=-1;a>=e;a--){const r=t.get(a);o+=r+this.getLevelGap(a,n,r)}return-o}}getLevelGap(e,t,n){var a;let o=t+(e===-1?n/2:0);if(((a=this.layoutOptions.levelGaps)==null?void 0:a.length)>0){const r=this.layoutOptions.levelGaps[Math.abs(e)];r&&(o=r)}return o}}class Lt extends ue{constructor(e,t,n){super(e,t,n);N(this,"enableGatherNodes",!1);N(this,"layoutOptions");this.layoutOptions=e,C("new RGFolderLayout:",this.layoutOptions),this.layoutOptions.from||(this.layoutOptions.from="left"),this.layoutOptions.treeNodeGapH||(this.layoutOptions.treeNodeGapH=10),this.layoutOptions.treeNodeGapV||(this.layoutOptions.treeNodeGapV=10),this.layoutOptions.levelGaps||(this.layoutOptions.levelGaps=[]),this.layoutOptions.bottomJuctionPointOffsetX===void 0&&(this.layoutOptions.bottomJuctionPointOffsetX=-50);const o=this.layoutOptions.from;o==="top"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="center"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="start"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.layoutOptions.alignItemsX),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.getReverseAlignItems(this.layoutOptions.alignItemsY))):o==="bottom"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="center"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="end"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.layoutOptions.alignItemsX),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.getReverseAlignItems(this.layoutOptions.alignItemsY))):o==="right"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="end"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="center"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.getReverseAlignItems(this.layoutOptions.alignItemsX)),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.layoutOptions.alignItemsY)):(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="end"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="center"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.getReverseAlignItems(this.layoutOptions.alignItemsX)),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.layoutOptions.alignItemsY)),this.layoutOptions.levelDistance&&console.error("Error: levelDistance is not support\uFF0C Please use levelGaps, treeNodeGapH, treeNodeGapV option in layoutOptions"),this.enableGatherNodes=this.layoutOptions.enableGatherNodes}placeNodes(e,t){if(C("RGFolderLayout:placeNodes"),t)C("layout by root:",t);else{console.error("root is null");return}this.rootNode=t,this.allNodes=e,console.log("fixedRootNode:",this.layoutOptions.fixedRootNode);const n={alignItemsX:this.layoutOptions.alignItemsX,alignItemsY:this.layoutOptions.alignItemsY},o={alignItemsX:this.layoutOptions.alignParentItemsX,alignItemsY:this.layoutOptions.alignParentItemsY};t.fixed||this.layoutOptions.fixedRootNode||this.updateNodePosition(t,0,0);const a=G.getNodeLotXY(n,t);t.lot.x=a.x,t.lot.y=a.y,C("allNodes:",e.length);const{tree:r}=this.networkAnalyzer.analyzeNetwork(e,t,!1);this.placeRelativePosition(t,r.networkNodes,r.analyticResult),C("networkNodes:",r.networkNodes.length),this.allNodes.forEach(l=>{if(l.fixed!==!0&&(Number.isNaN(l.lot.x)&&(C("bad lot x:",l.text,l.lot.x),l.lot.x=0),Number.isNaN(l.lot.y)&&(C("bad lot y:",l.text,l.lot.y),l.lot.y=0),l!==t)){const c=l.lot.level<0?o:n,d=G.getNodeXByLotX(c,l),h=G.getNodeYByLotY(c,l);this.updateNodePosition(l,d,h)}}),C("create rootNode coordinates:1",t.x,t.y),this.layoutEnd()}placeRelativePosition(e,t,n){const o=this.layoutOptions.treeNodeGapH||20,a=this.layoutOptions.treeNodeGapV||20,r=new Map;let l=0,c=0;for(const u of t){const y=u.lot.level,f=u.el_W,g=u.el_H;l+=g,c++;const v=r.get(y);v===void 0?r.set(y,f):f>v&&r.set(y,v)}if(c===0)return;console.log("levelMaxWidthMap:",r);const h=l/c+a;t.forEach(u=>{u.fixed!==!0&&u!==e&&(this.layoutOptions.from==="right"?u.lot.x=e.lot.x-this.getLevelDistance(u.lot.level,r,o+50):u.lot.x=e.lot.x+this.getLevelDistance(u.lot.level,r,o+50))}),t.forEach(u=>{u.fixed!==!0&&u!==e&&u.lot.level!==0&&(u.lot.y=e.lot.y+h*u.lot.strengthWithChilds_from)}),this.gatherNodes(t,"h",h)}gatherNodes(e,t,n){if(!this.enableGatherNodes)return;const o={};e.forEach(a=>{if(a.lot.level!==0)return;const r=a.lot.level+"";o[r]||(o[r]=[]),o[r].push(a),a.lot.movedNodeSizeBefore=1,a.lot.movedNodeSizeAfter=1}),e.forEach(a=>{if(a.fixed!==!0&&a.lot.level!==0){const r=a.lot.level+"",l=o[r];if(a.lot.strengthWithChilds===1&&a.lot.childrenSizeVisible<=1){const c=this.getBloomingNearByParent(a,a.lot.parent,l,t);c&&(t==="h"?a.lot.y-c.lot.y>0?(a.lot.y=c.lot.y+n*c.lot.movedNodeSizeAfter,c.lot.movedNodeSizeAfter++):(a.lot.y=c.lot.y-n*c.lot.movedNodeSizeBefore,c.lot.movedNodeSizeBefore++):a.lot.x-c.lot.x>0?(a.lot.x=c.lot.x+n*c.lot.movedNodeSizeAfter,c.lot.movedNodeSizeAfter++):(a.lot.x=c.lot.x-n*c.lot.movedNodeSizeBefore,c.lot.movedNodeSizeBefore++))}}})}getBloomingNearByParent(e,t,n,o){let a=9999,r;for(const l of n)if(l.lot.childrenSizeVisible>1&&l.lot.parent===t){const c=o==="h"?l.lot.y-t.lot.y:l.lot.x-t.lot.x;Math.abs(c)<a&&(a=Math.abs(c),r=l)}if(r&&r!==e)return r}getLevelDistance(e,t,n){if(e===0)return 0;if(e>0){let o=0;for(let a=0;a<e;a++)o+=t.get(a)+this.getLevelGap(a,n);return o}else{let o=e<-1?0:-t.get(e)/2;for(let a=e;a<0;a++)o+=t.get(a)+this.getLevelGap(a,n)+50;return-o}}getLevelGap(e,t){var o;let n=t;if(((o=this.layoutOptions.levelGaps)==null?void 0:o.length)>0){const a=this.layoutOptions.levelGaps[Math.abs(e)];a&&(n=a)}return n}}const ge=s=>!s||s.length===0?"":s.map(i=>{switch(i.type){case"M":return`${i.type} ${i.x} ${i.y}`;case"l":return`${i.type} ${i.dx} ${i.dy}`;case"L":return`${i.type} ${i.x} ${i.y}`;case"h":return`${i.type} ${i.dx}`;case"v":return`${i.type} ${i.dy}`;case"c":return`${i.type} ${i.dx1} ${i.dy1} ${i.dx2} ${i.dy2} ${i.dx} ${i.dy}`;case"s":return`${i.type} ${i.dx2} ${i.dy2} ${i.dx} ${i.dy}`;case"q":return`${i.type} ${i.dx1} ${i.dy1} ${i.dx} ${i.dy}`;case"Q":return`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`;case"t":return`${i.type} ${i.dx} ${i.dy}`;case"a":return`${i.type} ${i.rx} ${i.ry} ${i.xAxisRotation} ${i.largeArcFlag} ${i.sweepFlag} ${i.dx} ${i.dy}`;case"Z":return i.type;default:return console.warn("\u672A\u77E5\u7684\u8DEF\u5F84\u547D\u4EE4\u7C7B\u578B:",i),""}}).join(" ").trim(),wt=s=>{const i=s.match(/[a-zA-Z][^a-zA-Z]*/g);let e=0,t=0,n=0,o=0,a=0,r=0,l=0,c=0;const d={x:0,y:0},h={x:0,y:0},u=[];for(const y of i){const f=y.trim().split(/[ ,]+/),g=f[0].toUpperCase(),v=f[0]===f[0].toLowerCase();switch(g){case"M":e=W(n,f[1],v),t=W(o,f[2],v),n=e,o=t;break;case"L":e=W(n,f[1],v),t=W(o,f[2],v),u.push({x:e,y:t});break;case"C":a=W(n,f[1],v),r=W(o,f[2],v),l=W(n,f[3],v),c=W(o,f[4],v),e=W(n,f[5],v),t=W(o,f[6],v),n=e,o=t;break;case"Q":a=W(n,f[1],v),r=W(o,f[2],v),e=W(n,f[3],v),t=W(o,f[4],v),n=e,o=t;break;case"V":t=W(o,f[1],v),o=t;break;case"H":e=W(n,f[1],v),n=e;break;case"Z":break;default:console.log(`Unsupported command: ${g}`)}y===i[0]&&(d.x=e,d.y=t),y===i[i.length-1]&&(h.x=e,h.y=t)}return{startPoint:d,ctrl1:{x:a,y:r},ctrl2:{x:l,y:c},endPoint:h,lines:u}},W=(s,i,e)=>e?s+parseFloat(i):parseFloat(i),pn=(s,i,e,t,n,o,a)=>{const r=JSON.parse(JSON.stringify(s));let l=!1;if(e<0||e>=s.length-1)return{newPoints:r,pointsChanged:l};r[e-1];const c=r[e],d=r[e+1];i[e-1];const h=i[e];i[e+1];let u=o,y=a;if(t.direction==="v"){const f=i[e-2],g=i[e+2],v=h.x+u;let p=3e3;if(f){const m=Math.abs(f.x-v);m<10&&m<p&&(p=m,u=f.x-h.x)}if(g){const m=Math.abs(g.x-v);m<10&&m<p&&(p=m,u=g.x-h.x)}}else{const f=i[e-2],g=i[e+2],v=h.y+y;let p=3e3;if(f){const m=Math.abs(f.y-v);m<10&&m<p&&(p=m,y=f.y-h.y)}if(g){const m=Math.abs(g.y-v);m<10&&m<p&&(p=m,y=g.y-h.y)}}if(t.direction==="v")if(e===0){const f=c.y<d.y?1:-1,g={x:c.x,y:c.y},v={x:c.x,y:c.y+20*f};c.x=v.x+u,c.y=v.y,r.splice(e,0,g,v),n.indexOffset+=2,l=!0}else if(e===s.length-2){const f=c.y<d.y?1:-1,g={x:h.x+u,y:d.y-20*f},v={x:d.x,y:d.y-20*f};r.splice(e+1,0,g,v),l=!0}else c.x=h.x+u,d.x=h.x+u;else if(e===0){const f=c.x<d.x?1:-1,g={x:c.x,y:c.y},v={x:c.x+20*f,y:c.y};c.x=v.x,c.y=h.y+y,r.splice(e,0,g,v),n.indexOffset+=2,l=!0}else if(e===s.length-2){const f=c.x<d.x?1:-1,g={x:d.x-20*f,y:h.y+y},v={x:d.x-20*f,y:d.y};r.splice(e+1,0,g,v),l=!0}else c.y=h.y+y,d.y=h.y+y;return{newPoints:r,pointsChanged:l}},yn=(s,i={x:0,y:0,rotate:0})=>{const{fx:e,fy:t,tx:n,ty:o}=s;i.rotate=Q.getTextAngle(e,t,n,o),i.x=e+(n-e)/2,i.y=t+(o-t)/2,Number.isNaN(i.rotate)&&(i.rotate=0);const a=n-e,r=o-t,l=[{type:"M",x:e,y:t},{type:"l",dx:a,dy:r}],c=ge(l);return{pathCommands:l,pathData:c,textPosition:i,points:[]}},vn=(s,i={x:0,y:0,rotate:0},e={})=>{const{line:t,fx:n,fy:o,fcx:a,fcy:r,f_W:l,f_H:c,tx:d,ty:h,tcx:u,tcy:y,t_W:f,t_H:g}=s,v=d-n,p=h-o,m=n-a,L=o-r,_=d-u,S=h-y,b=t.lineRadius!==void 0?t.lineRadius:e.lineRadius||0,O=Math.min(b,Math.abs(v))*(n<d?1:-1),T=Math.min(b,Math.abs(p))*(o<h?1:-1),k=t.lineDirection||Math.abs(m)>=l/2?"h":"v",E=t.lineDirection||Math.abs(_)>=f/2?"h":"v",P=[];let M=0,w=0;if(k==="v"){const X=t.polyLineStartDistance||Math.max(Math.min(30,Math.abs(h-o)/2),15),z=L>0?X:-X;if(t.onPathStartOffset==="start"?(M=n,w=o+z-(L>0?20:-5)):t.onPathStartOffset==="middle"?(M=n+(d-n)/2,w=o+z):(M=d,w=o+z+(L>0?20:-5)),P.push({type:"M",x:Math.round(n),y:Math.round(o)},{type:"v",dy:Math.round(z-T)},{type:"c",dx1:0,dy1:Math.round(T),dx2:Math.round(O),dy2:Math.round(T),dx:Math.round(O),dy:Math.round(T)}),E==="v")P.push({type:"h",dx:Math.round(d-n-O*2)},{type:"c",dx1:Math.round(O),dy1:0,dx2:Math.round(O),dy2:Math.round(T),dx:Math.round(O),dy:Math.round(T)},{type:"v",dy:Math.round(h-o-z-T)});else{const F=Math.min(30,Math.abs(d-n)/2),D=_>0?-F:F;P.push({type:"h",dx:Math.round(d-n+D-O)},{type:"c",dx1:Math.round(O),dy1:0,dx2:Math.round(O),dy2:Math.round(T),dx:Math.round(O),dy:Math.round(T)},{type:"v",dy:Math.round(h-o-z-T)},{type:"h",dx:Math.round(D-O)})}}else{const X=t.polyLineStartDistance||Math.max(Math.min(30,Math.abs(d-n)/2),15),z=m>0?X:-X;if(t.onPathStartOffset==="start"?(M=n+(m>0?10:-50),w=o-5):t.onPathStartOffset==="center"||t.onPathStartOffset==="middle"?(M=n+z,w=o+(h-o)/2):(M=n+z+(m>0?20:-50),w=h-5),P.push({type:"M",x:Math.round(n),y:Math.round(o)},{type:"h",dx:Math.round(z-O)},{type:"c",dx1:Math.round(O),dy1:0,dx2:Math.round(O),dy2:Math.round(T),dx:Math.round(O),dy:Math.round(T)}),E==="v"){const F=Math.min(30,Math.abs(h-o)/2),D=S>0?-F:F;P.push({type:"v",dy:Math.round(h-o+D-T)},{type:"h",dx:Math.round(d-n-z-O)},{type:"c",dx1:0,dy1:Math.round(T),dx2:Math.round(O),dy2:Math.round(T),dx:Math.round(O),dy:Math.round(T)},{type:"v",dy:Math.round(D-T)})}else P.push({type:"v",dy:Math.round(h-o-T*2)},{type:"c",dx1:0,dy1:Math.round(T),dx2:Math.round(O),dy2:Math.round(T),dx:Math.round(O),dy:Math.round(T)},{type:"h",dx:Math.round(d-n-z-O)})}i.x=M,i.y=w;const A=ge(P);return{pathCommands:P,pathData:A,textPosition:i,points:[]}},Ee={left:{x:-1,y:0},right:{x:1,y:0},top:{x:0,y:-1},bottom:{x:0,y:1}},mn=({source:s,sourcePosition:i="bottom",target:e})=>i==="left"||i==="right"?s.x<e.x?{x:1,y:0}:{x:-1,y:0}:s.y<e.y?{x:0,y:1}:{x:0,y:-1},Nt=(s,i)=>Math.sqrt(Math.pow(i.x-s.x,2)+Math.pow(i.y-s.y,2));function $e({source:s,sourcePosition:i="bottom",target:e,targetPosition:t="top",center:n,sourceOffset:o,targetOffset:a}){const r=Ee[i],l=Ee[t],c={x:s.x+r.x*o,y:s.y+r.y*o},d={x:e.x+l.x*a,y:e.y+l.y*a},h=mn({source:c,sourcePosition:i,target:d}),u=h.x!==0?"x":"y",y=h[u];let f=[],g,v;const p={x:0,y:0},m={x:0,y:0};let L=0;if(r[u]*l[u]===-1){g=n.x,v=n.y;const S=[{x:g,y:c.y},{x:g,y:d.y}],b=[{x:c.x,y:v},{x:d.x,y:v}];r[u]===y?(L=1.1,f=u==="x"?S:b):(L=1.2,f=u==="x"?b:S)}else{const S=[{x:c.x,y:d.y}],b=[{x:d.x,y:c.y}];if(u==="x"?f=r.x===y?b:S:f=r.y===y?S:b,i===t){L=2.1;const P=Math.abs(s[u]-e[u]),M=r[u]===y?o:a;if(P<=M){const w=Math.min(M-1,M-P);r[u]===y?p[u]=(c[u]>s[u]?-1:1)*w:m[u]=(d[u]>e[u]?-1:1)*w}}if(i!==t){L=2.2;const P=u==="x"?"y":"x",M=r[u]===l[P],w=c[P]>d[P],A=c[P]<d[P];(r[u]===1&&(!M&&w||M&&A)||r[u]!==1&&(!M&&A||M&&w))&&(f=u==="x"?S:b)}const O={x:c.x+p.x,y:c.y+p.y},T={x:d.x+m.x,y:d.y+m.y},k=Math.max(Math.abs(O.x-f[0].x),Math.abs(T.x-f[0].x)),E=Math.max(Math.abs(O.y-f[0].y),Math.abs(T.y-f[0].y));k>=E?(g=(O.x+T.x)/2,v=f[0].y):(g=f[0].x,v=(O.y+T.y)/2)}return[[s,{x:c.x+p.x,y:c.y+p.y},...f,{x:d.x+m.x,y:d.y+m.y},e],g,v,0,0,L]}const De=s=>{const i=[];for(let e=0;e<s.length;e++){const t=s[e];if(t.x=Math.round(t.x),t.y=Math.round(t.y),e===0||e===s.length-1)i.push(t);else{const n=i[i.length-1];t.x===n.x&&t.y===n.y||i.push(t)}}for(let e=2;e<i.length;e++){const t=i[e-2],n=i[e-1],o=i[e],a=t.x===n.x?"v":"h",r=n.x===o.x?"v":"h";a===r&&(n.merged=!0)}return i.filter(e=>e.merged!==!0)};function xn(s,i,e,t){const n=Math.min(Nt(s,i)/2,Nt(i,e)/2,t),{x:o,y:a}=i;if(s.x===o&&o===e.x||s.y===a&&a===e.y)return[{type:"L",x:o,y:a}];if(s.y===a){const c=s.x<e.x?-1:1,d=s.y<e.y?1:-1;return[{type:"L",x:o+n*c,y:a},{type:"Q",x1:o,y1:a,x:o,y:a+n*d}]}const r=s.x<e.x?1:-1,l=s.y<e.y?-1:1;return[{type:"L",x:o,y:a+n*l},{type:"Q",x1:o,y1:a,x:o+n*r,y:a}]}const _t=(s,i)=>{const e=[];return s.forEach((t,n)=>{if(n===0)e.push({type:"M",x:Math.round(t.x),y:Math.round(t.y)});else if(n===s.length-1){const o=s[n-1];let a=o.x===t.x?0:o.x<t.x?-1:1,r=o.y===t.y?0:o.y<t.y?-1:1;s.length===2&&(a=0,r=0),e.push({type:"l",dx:Math.round(t.x-o.x+i*a),dy:Math.round(t.y-o.y+i*r)})}else{const o=xn(s[n-1],t,s[n+1],i);e.push(...o)}}),e};var he=(s=>(s.border="border",s.ltrb="ltrb",s.tb="tb",s.lr="lr",s.left="left",s.right="right",s.top="top",s.bottom="bottom",s))(he||{});const Re=(s,i,e,t,n,o,a,r)=>s==="left"?"left":s==="right"?"right":s==="top"?"top":s==="bottom"?"bottom":s==="horizontalLine"?t?o>r?"bottom":"top":o<r?"bottom":"top":s==="verticalLine"?t?n>a?"right":"left":n<a?"right":"left":i===1?"right":i===-1?"left":e===1?"bottom":e===-1?"top":"left",bt=s=>s==="left"?"right":s==="right"?"left":s==="top"?"bottom":s==="bottom"?"top":"left",Ot=s=>{if(s.length<2)throw new Error("At least two points are required to form a polyline.");let i=0;const e=[];for(let o=1;o<s.length;o++){const a=s[o].x-s[o-1].x,r=s[o].y-s[o-1].y,l=Math.sqrt(a*a+r*r);e.push(l),i+=l}const t=i/2;let n=0;for(let o=0;o<e.length;o++)if(n+=e[o],n>=t){const a=s[o],r=s[o+1],l=e[o],d=(t-(n-l))/l,h=a.x+(r.x-a.x)*d,u=a.y+(r.y-a.y)*d;return{x:h,y:u}}return{x:0,y:0}},Cn=(s,i={x:0,y:0,rotate:0},e={})=>{const{line:t,fromJunctionPoint:n,toJunctionPoint:o,lineDirection:a,lineShape:r,fx:l,fy:c,fcx:d,fcy:h,f_W:u,f_H:y,tx:f,ty:g,tcx:v,tcy:p,t_W:m,t_H:L}=s,_=l-d,S=c-h;let b=_>1?1:_<-1?-1:0,O=S>1?1:S<-1?-1:0;Math.abs(b)===1&&Math.abs(O)===1&&(Math.abs(_)>Math.abs(S)?O=0:b=0),b===0&&O===0&&(b=1);const T=f-v,k=g-p;let E=T>1?1:T<-1?-1:0,P=k>1?1:k<-1?-1:0;Math.abs(E)===1&&Math.abs(P)===1&&(Math.abs(T)>Math.abs(k)?P=0:E=0),E===0&&P===0&&(b=-1);const M=Re(n,b,O,!1,l,c,f,g),w=Re(o,E,P,!0,l,c,f,g),A=M,X=w,z=l+(f-l)/2,F=c+(g-c)/2;let D={x:0,y:0},U=30,q=30;t.ctrlOptionsFor44&&(D={x:t.ctrlOptionsFor44.cx,y:t.ctrlOptionsFor44.cy},U+=t.ctrlOptionsFor44.fd,q+=t.ctrlOptionsFor44.td);const ee=t.lineRadius!==void 0?t.lineRadius:e.lineRadius||0,[K]=$e({source:{x:l,y:c},sourcePosition:A,target:{x:f,y:g},targetPosition:X,center:{x:z+D.x,y:F+D.y},sourceOffset:U,targetOffset:q}),se=De(K),oe=_t(se,ee),te=ge(oe),re=Ot(K);return i.x=re.x,i.y=re.y,{pathCommands:oe,pathData:te,textPosition:i,points:se,startDirection:A,endDirection:X}},Ln=(s,i={x:0,y:0,rotate:0},e={})=>{const{line:t,fromJunctionPoint:n,toJunctionPoint:o,lineDirection:a,lineShape:r,fx:l,fy:c,fcx:d,fcy:h,f_W:u,f_H:y,tx:f,ty:g,tcx:v,tcy:p,t_W:m,t_H:L}=s,_=l-d,S=c-h;let b=_>3?1:_<-3?-1:0,O=S>3?1:S<-3?-1:0;Math.abs(b)===1&&Math.abs(O)===1&&(Math.abs(_)>Math.abs(S)?O=0:b=0),b===0&&O===0&&(b=1);const T=f-v,k=g-p;let E=T>3?1:T<-3?-1:0,P=k>3?1:k<-3?-1:0;Math.abs(E)===1&&Math.abs(P)===1&&(Math.abs(T)>Math.abs(k)?P=0:E=0),E===0&&P===0&&(b=-1);let M=Re(n,b,O,!1,l,c,f,g),w=Re(o,E,P,!0,l,c,f,g);const A=t.lineRadius!==void 0?t.lineRadius:e.lineRadius||0,X=t.ctrlPointsFor49;let z={x:Math.round(l),y:Math.round(c)},F={x:Math.round(f),y:Math.round(g)},D={x:Math.round(X[0].x),y:Math.round(X[0].y)},U={x:Math.round(X[X.length-1].x),y:Math.round(X[X.length-1].y)},q=[...X];if(t.isReverse&&([M,w]=[w,M]),Math.abs(z.x-D.x)>3||Math.abs(z.y-D.y)>3){const te=z.x+(D.x-z.x)/2,re=z.y+(D.y-z.y)/2,le=bt(M),[H]=$e({source:z,sourcePosition:M,target:D,targetPosition:le,center:{x:te,y:re},sourceOffset:20,targetOffset:5});q=De([...H,...q])}if(Math.abs(F.x-U.x)>3||Math.abs(F.y-U.y)>3){const te=U.x+(F.x-U.x)/2,re=U.y+(F.y-U.y)/2,le=bt(w),[H]=$e({source:U,sourcePosition:le,target:F,targetPosition:w,center:{x:te,y:re},sourceOffset:5,targetOffset:20});q=De([...q,...H])}const ee=q,K=_t(ee,A),se=ge(K),oe=Ot(X);return i.x=oe.x,i.y=oe.y,{pathCommands:[],pathData:se,textPosition:i,points:ee,startDirection:M,endDirection:w}},wn=(s,i={x:0,y:0,rotate:0})=>{const{line:e,lineShape:t,fx:n,fy:o,fcx:a,fcy:r,tx:l,ty:c,tcx:d,tcy:h}=s,u=l-n,y=c-o;let f=n-a,g=o-r,v=l-d,p=c-h,{fromJunctionPoint:m,toJunctionPoint:L}=e;e.isReverse&&([m,L]=[L,m]),(m===j.left||m===j.right)&&(g=0),(m===j.top||m===j.bottom)&&(f=0),(L===j.left||L===j.right)&&(p=0),(L===j.top||L===j.bottom)&&(v=0);const _=Math.min(200,Math.max(100,Math.abs(u/2))),S=Math.min(200,Math.max(100,Math.abs(y/2))),b=f/(Math.abs(f)+Math.abs(g))*_,O=g/(Math.abs(f)+Math.abs(g))*S;let T={x:b,y:O};const k=v/(Math.abs(v)+Math.abs(p))*_+u,E=p/(Math.abs(v)+Math.abs(p))*S+y;let P={x:k,y:E};e.ctrlPoints&&e.ctrlPoints.length>0&&(e.isReverse?(T.x+=e.ctrlPoints[1].x,T.y+=e.ctrlPoints[1].y,P.x+=e.ctrlPoints[0].x,P.y+=e.ctrlPoints[0].y):(T.x+=e.ctrlPoints[0].x,T.y+=e.ctrlPoints[0].y,P.x+=e.ctrlPoints[1].x,P.y+=e.ctrlPoints[1].y));const M={x:n+T.x,y:o+T.y},w={x:n+P.x,y:o+P.y},A={x:n+u,y:o+y},X=[{type:"M",x:n,y:o},{type:"c",dx1:T.x,dy1:T.y,dx2:P.x,dy2:P.y,dx:u,dy:y}];t===8&&X.push({type:"Z"});const z=St({x:n,y:o},M,w,A,t<6?.8:.5);i.x=z.x,i.y=z.y;const F=ge(X);return{pathCommands:X,pathData:F,textPosition:i,points:[]}},St=(s,i,e,t,n=.5)=>{const o={x:(1-n)*s.x+n*i.x,y:(1-n)*s.y+n*i.y},a={x:(1-n)*i.x+n*e.x,y:(1-n)*i.y+n*e.y},r={x:(1-n)*e.x+n*t.x,y:(1-n)*e.y+n*t.y},l={x:(1-n)*o.x+n*a.x,y:(1-n)*o.y+n*a.y},c={x:(1-n)*a.x+n*r.x,y:(1-n)*a.y+n*r.y};return{x:(1-n)*l.x+n*c.x,y:(1-n)*l.y+n*c.y}},Nn=(s,i={x:0,y:0,rotate:0})=>{const{line:e,totalLinesBetweenNodes:t,currentLineIndex:n,lineDirection:o,lineShape:a,fx:r,fy:l,fcx:c,fcy:d,f_W:h,f_H:u,tx:y,ty:f,tcx:g,tcy:v,t_W:p,t_H:m}=s,L=y-r,_=f-l,S=y>r?1:-1,b=f>l?1:-1,O=o==="v"?b:S,T=r-c,k=l-d,E=y-g,P=f-v,M=1/(t+1)*(n+1);let w={x:0,y:0},A={x:0,y:0};if(a===Y.Curve2)w=o==="v"?{x:0,y:O*30}:{x:O*30,y:0},A=o==="v"?{x:L*M,y:O*-10}:{x:O*-10,y:_*M};else if(a===Y.Curve3)w=o==="v"?{x:0,y:_*M}:{x:O*30,y:0},A=o==="v"?{x:0,y:0}:{x:O*-10,y:_*M};else if(a===Y.Curve5)w={x:0,y:0},A=o==="v"?{x:0,y:_*M}:{x:L*M,y:0};else if(a===Y.Curve7||a===Y.Curve8){const se=T/(Math.abs(T)+Math.abs(k))*30,oe=k/(Math.abs(T)+Math.abs(k))*30;w={x:se,y:oe};const te=E/(Math.abs(E)+Math.abs(P))*30+L,re=P/(Math.abs(E)+Math.abs(P))*30+_;A={x:te,y:re}}const X={x:r+w.x,y:l+w.y},z={x:r+A.x,y:l+A.y},F={x:r+L,y:l+_},D=[{type:"M",x:r,y:l},{type:"c",dx1:w.x,dy1:w.y,dx2:A.x,dy2:A.y,dx:L,dy:_}];a===8&&D.push({type:"Z"});const U=St({x:r,y:l},X,z,F,a<6?.8:.5);i.x=U.x,i.y=U.y;const q=ge(D);return{pathCommands:D,pathData:q,textPosition:i,points:[]}};class _n{constructor(){N(this,"graphData",{rootNode:void 0,nodes:[],normalLines:[],fakeLines:[]});N(this,"options",{});N(this,"runtimeDATA4NodeMap",new Map);N(this,"runtimeDATA4Links",[]);N(this,"runtimeDATA4LinkMap",new Map);N(this,"runtimeDATA4ConnectTargets",[]);N(this,"runtimeDATA4ElLineTargets",[]);N(this,"runtimeDATA4ShouldRenderItems",{nodes:[],lines:[],fakeLines:[]})}}class bn extends _n{constructor(){super()}getOptions(){return this.options}getNodeById(i){return this.runtimeDATA4NodeMap.get(i)}getLineById(i){var e;return(e=this.runtimeDATA4LinkMap.get(i))==null?void 0:e.line}getLinkByLineId(i){return this.runtimeDATA4LinkMap.get(i)}getFakeLineById(i){return this.graphData.fakeLines.find(e=>e.id===i)}getNodes(){return this.graphData.nodes}getLinks(){return this.runtimeDATA4Links}getFakeLines(){return this.graphData.fakeLines}getLines(){return this.runtimeDATA4Links.map(i=>i.line)}getRootNode(){return this.graphData.rootNode}getShouldRenderNodes(){return this.isPerformanceMode()?this.runtimeDATA4ShouldRenderItems.nodes:this.graphData.nodes}getShouldRenderLines(){return this.isPerformanceMode()?this.runtimeDATA4ShouldRenderItems.lines:this.graphData.normalLines}getShouldRenderFakeLines(){return this.isPerformanceMode()?this.runtimeDATA4ShouldRenderItems.fakeLines:this.graphData.fakeLines}isPerformanceMode(){return this.options.performanceMode}getCanvasScale(){return this.options.canvasZoom/100}getConnectTargets(){return this.runtimeDATA4ConnectTargets}getConnectTargetById(i){if(!i)throw new Error("[getConnectTargetById]targetId is empty");for(let e=0;e<this.runtimeDATA4ConnectTargets.length;e++){const t=this.runtimeDATA4ConnectTargets[e];if(t.targetId===i)return t}}getElLineTargets(){return this.runtimeDATA4ElLineTargets}getElLineTargetById(i){return this.runtimeDATA4ElLineTargets.find(e=>e.id===i)}calcShouldRenderNodes(){const i=[];return this.graphData.nodes.forEach(e=>{e.rgShouldRender!==!1&&e.rgCalcedVisibility!==!1&&i.push(e)}),i}calcShouldRenderLines(){const i=[];return this.runtimeDATA4Links.forEach(e=>{e.rgShouldRender!==!1&&e.line.hidden!==!0&&e.rgCalcedVisibility!==!1&&i.push(e.line)}),i}calcShouldRenderFakeLines(){return this.graphData.fakeLines}findNodeByXy(i){const e=this.graphData.nodes;for(let t=e.length-1;t>=0;t--){const n=e[t],o=n.x,a=n.y,r=n.el_W||n.width||50,l=n.el_H||n.height||50;if(i.x>o&&i.x<o+r&&i.y>a&&i.y<a+l)return n}return null}}class On{constructor(){N(this,"map");this.map=new Map}_key(i,e){return i<=e?`${i}${e}`:`${e}${i}`}addEdge(i,e){const t=this._key(i,e),n=this.map.get(t)||0;return this.map.set(t,n+1),n}getCount(i,e){const t=this._key(i,e);return this.map.get(t)||0}clear(){this.map.clear()}}class Pe extends bn{constructor(){super();N(this,"commits");N(this,"updateViewHook",e=>{});this.options=_e({}),this.commits=this.resetCommints()}clearReactiveData(){this.graphData.nodes=[],this.graphData.normalLines=[],this.graphData.fakeLines=[],this.runtimeDATA4Links.splice(0,this.runtimeDATA4Links.length),this.runtimeDATA4ElLineTargets.splice(0,this.runtimeDATA4ElLineTargets.length),this.runtimeDATA4ConnectTargets.splice(0,this.runtimeDATA4ElLineTargets.length),this.runtimeDATA4NodeMap.clear(),this.runtimeDATA4LinkMap.clear(),this.graphData.rootNode=void 0,this.updateShouldRenderGraphData(),this.commits.optionsChanged=!0,this.commits.nodesListChanged=!0,this.commits.linesListChanged=!0,this.commits.fakeLinesListChanged=!0}resetCommints(){return{optionsChanged:!1,changedNodes:[],nodesListChanged:!1,changedLines:[],linesListChanged:!1,changedFakeLines:[],fakeLinesListChanged:!1,changedConnectTargets:[],connectTargetsListChanged:!1}}commitLine(e){this.commits.linesListChanged=!0}commitNode(e){this.commits.changedNodes.includes(e)||this.commits.changedNodes.push(e),this.commits.linesListChanged=!0,this.commits.fakeLinesListChanged=!0}commitFakeLine(e){this.commits.fakeLinesListChanged=!0}commitConnectTarget(e){this.commits.changedConnectTargets.includes(e)||this.commits.changedConnectTargets.push(e),this.commits.fakeLinesListChanged=!0}dataUpdated(){const e=this.commits;this.commits=this.resetCommints(),this.updateViewHook(e)}updateOptions(e){if(e.layout&&console.warn("RGDataProvider:updateOptions:layout:",e.layout),Object.assign(this.options,e),this.isPerformanceMode()&&!this.options.showEasyView){const t=Object.keys(e);console.log("changedKeys:",t.join(",")),t.includes("canvasZoom")&&(this.commits.nodesListChanged=!0,this.commits.linesListChanged=!0),t.includes("viewSize")&&(this.commits.nodesListChanged=!0,this.commits.linesListChanged=!0),t.includes("canvasOffset")&&(this.commits.nodesListChanged=!0,this.commits.linesListChanged=!0)}this.commits.optionsChanged=!0}clearChecked(){this.updateOptions({checkedNodeId:"",checkedLineId:""})}setCanvasOffset(e,t){this.updateOptions({canvasOffset:{x:e,y:t}}),this.commits.optionsChanged=!0}setCanvasZoom(e){this.updateOptions({canvasZoom:e})}setEditingLine(e){if(e){const t=this.getLineById(e.id)||this.getFakeLineById(e.id);t&&this.updateOptions({editingLineController:{...this.options.editingLineController,line:t,show:!0},checkedLineId:e.id})}else this.updateOptions({editingLineController:{...this.options.editingLineController,line:null,show:!1},checkedLineId:""})}setEditingNodes(e){for(const n of e)if(!n||!this.getNodeById(n.id)){console.error("setEditingNodes Error: node not found:",n);return}this.getNodes().filter(n=>n.selected).forEach(n=>this.updateNode(n.id,{selected:!1})),this.updateOptions({editingController:{...this.options.editingController,nodes:e,show:e.length>0}}),e.length>1&&this.options.editingController.nodes.forEach(n=>this.updateNode(n.id,{selected:!0}))}setCanvasCenter(e,t){const n=this.options.viewSize.width/2,o=this.options.viewSize.height/2,a=this.options.canvasZoom/100;this.setCanvasOffset(n-e*a,o-t*a)}removeNodeById(e){this.beforeNodeBeRemove(e),C("Removed Node line/connect-arget\uFF1A",e);let t=0;for(let n=0;n<this.graphData.nodes.length;n++)e.includes(this.graphData.nodes[n].id)&&(this.graphData.nodes.splice(n,1),t++);for(const n of e)this.runtimeDATA4NodeMap.delete(n);C("Removed node\uFF1A",e,t),this.commits.nodesListChanged=!0}removeLineByIds(e){C("_removeLineByIds:",e.length,e),this.removeFakeLineByIds(e);let t=0;for(let n=0;n<this.graphData.normalLines.length;n++){const o=this.graphData.normalLines[n];e.includes(o.id)&&(this.graphData.normalLines.splice(n,1),n--,t++)}C("_removeLineByIds:",t),this.removeLinkByLineIds(e),this.updateLinks(),this.commits.linesListChanged=!0}removeFakeLineByIds(e){C("_removeFakeLineByIds:",e.length,e);let t=0;for(let n=0;n<this.graphData.fakeLines.length;n++){const o=this.graphData.fakeLines[n];e.includes(o.id)&&(this.graphData.fakeLines.splice(n,1),n--,t++)}this.commits.fakeLinesListChanged=!0,C("_removeFakeLineByIds:",t)}removeLinkByLineIds(e){C("_removeLinkByLineIds:",e.length,e);let t=0;for(let n=0;n<this.runtimeDATA4Links.length;n++){const o=this.runtimeDATA4Links[n];e.includes(o.lineId)&&(this.runtimeDATA4Links.splice(n,1),this.runtimeDATA4LinkMap.delete(o.lineId),n--,t++)}this.commits.fakeLinesListChanged=!0,C("_removeLinkByLineIds:",t)}removeConnectTarget(e){const t=this.runtimeDATA4ConnectTargets.findIndex(n=>n.targetId===e);if(t!==-1){const n=this.runtimeDATA4ConnectTargets[t];(n.targetType===B.NodePoint||n.targetType===B.CanvasPoint)&&this.runtimeDATA4ConnectTargets.splice(t,1)}this.commits.connectTargetsListChanged=!0}updateLinks(e=[]){const t=new On;for(const n of this.runtimeDATA4Links){const{from:o,to:a}=n.line,r=t.addEdge(o,a);r!==n.currentLineIndex&&(n.currentLineIndex=r,this.commitLine(n.lineId))}for(const n of this.runtimeDATA4Links){const{from:o,to:a}=n.line,r=t.getCount(o,a);r!==n.totalLinesBetweenNodes&&(n.totalLinesBetweenNodes=r,this.commitLine(n.lineId))}t.clear()}beforeNodeBeRemove(e){let t=0;for(let n=0;n<this.runtimeDATA4Links.length;n++){const o=this.runtimeDATA4Links[n];(e.includes(o.fromNode.id)||e.includes(o.toNode.id))&&(this.removeLinkByLineIds([o.lineId]),n--,t++)}C("Removed Node link\uFF1A",e,t);for(let n=0;n<this.graphData.fakeLines.length;n++){const o=this.graphData.fakeLines[n];let a=!1;if(o.fromType===B.Node&&e.includes(o.from))a=!0;else if(o.fromType===B.CanvasPoint||o.fromType===B.NodePoint){const r=this.getConnectTargetById(o.from);r&&r.nodeId&&e.includes(r.nodeId)&&(a=!0)}else if(o.toType===B.CanvasPoint||o.toType===B.NodePoint){const r=this.getConnectTargetById(o.to);r&&r.nodeId&&e.includes(r.nodeId)&&(a=!0)}a&&(this.graphData.fakeLines.splice(n,1),n--,this.commits.fakeLinesListChanged=!0)}for(let n=0;n<this.runtimeDATA4ConnectTargets.length;n++){const o=this.runtimeDATA4ConnectTargets[n];o.nodeId&&e.includes(o.nodeId)&&(this.runtimeDATA4ConnectTargets.splice(n,1),this.commitConnectTarget(o.targetId),n--)}}addFakeLines(e){for(const t of e)if(t.id||console.warn("Must have id for fake line:",t),this.graphData.fakeLines.some(n=>n.id===t.id))console.error("Ignore duplicate fake line id:",t.id);else{t.isFakeLine=!0;const n=fe(t,this.options);n.forDisplayOnly=!0,n.id||(n.id=Ve(6)),this.graphData.fakeLines.push(n)}this.commits.fakeLinesListChanged=!0}clearFakeLines(){this.graphData.fakeLines.splice(0,this.graphData.fakeLines.length),this.commits.fakeLinesListChanged=!0}addNodes(e){for(const t of e)this.runtimeDATA4NodeMap.set(t.id,t);this.graphData.nodes.push(...e.map(t=>this.runtimeDATA4NodeMap.get(t.id))),this.commits.nodesListChanged=!0}addLines(e){this.graphData.normalLines.push(...e);const t=[];for(const n of e){const o=this.getNodeById(n.from),a=this.getNodeById(n.to),r={lineId:n.id,line:n,fromNode:o,toNode:a,currentLineIndex:0,totalLinesBetweenNodes:1,rgShouldRender:!0,rgCalcedVisibility:!0};this.runtimeDATA4LinkMap.set(r.lineId,r),t.push(r)}this.runtimeDATA4Links.push(...t.map(n=>this.runtimeDATA4LinkMap.get(n.lineId))),this.updateLinks(),this.commits.linesListChanged=!0}updateNode(e,t){const n=this.getNodeById(e);if(!n){console.error("Cannot find node to update:",e,t);return}const o=t.hidden!==void 0&&n.hidden!==t.hidden;if(Object.assign(n,t,{id:e}),o){const a=G.getDescendantNodes(n);this.updateNodesVisibleProperty([n].concat(a))}this.commitNode(e)}updateNodeData(e,t){const n=this.getNodeById(e);if(!n){console.error("Cannot find node to update:",e);return}this.updateNode(e,{data:Object.assign(n.data||{},t)})}updateLine(e,t){const n=this.getLineById(e);if(!n){this.updateFakeLine(e,t);return}const o=t.hidden!==void 0&&n.hidden!==t.hidden;if(Object.assign(n,t,{id:e}),o){const a=this.getLinkByLineId(e);a&&(a.rgCalcedVisibility=this.calcLinkVisibility(a))}this.commitLine(e)}updateLineData(e,t){const n=this.getLineById(e);if(!n){console.error("Cannot find line to update:",e);return}this.updateLine(e,{data:Object.assign(n.data||{},t)})}updateFakeLine(e,t){const n=this.getFakeLineById(e);if(!n){console.error("Cannot find fakeLine to update:",e,t);return}Object.assign(n,t,{id:e}),this.commitFakeLine(e)}updateConnectTarget(e,t){const n=this.getConnectTargetById(e);!n||(Object.assign(n,t,{targetId:e}),this.commitConnectTarget(e))}updateElLineTarget(e,t){const n=this.getElLineTargetById(e);!n||Object.assign(n,t,{id:e})}updateNodesVisibleProperty(e){let t=!1;e||(e=this.getNodes(),t=!0);for(const n of e){const o=G.isVisibleNode(n);n.rgCalcedVisibility!==o&&(n.rgCalcedVisibility=o,this.commitNode(n.id))}for(const n of this.runtimeDATA4Links)if(t||e.includes(n.fromNode)||e.includes(n.toNode)){const a=this.calcLinkVisibility(n);n.rgCalcedVisibility=a,n.line.hidden=!a,this.commitLine(n.lineId)}}calcLinkVisibility(e){return e.fromNode.rgCalcedVisibility&&e.toNode.rgCalcedVisibility}updateShouldRenderGraphData(){const e=this.options,t=e.canvasZoom/100,n={x:-e.canvasOffset.x/t,y:-e.canvasOffset.y/t},o={x:n.x+e.viewSize.width/t,y:n.y+e.viewSize.height/t},a=e.snapshotting;for(const r of this.getNodes()){let l=!0;a||r.alwaysRender?l=!0:((r.x>o.x||r.y>o.y)&&(l=!1),(r.x+r.el_W<n.x||r.y+r.el_H<n.y)&&(l=!1)),r.rgShouldRender=l}for(const r of this.runtimeDATA4Links){if(a){r.rgShouldRender=!0;continue}r.rgShouldRender=r.fromNode.rgShouldRender||r.toNode.rgShouldRender}this.options.showEasyView?(this.runtimeDATA4ShouldRenderItems.nodes=[],this.runtimeDATA4ShouldRenderItems.lines=[],this.runtimeDATA4ShouldRenderItems.fakeLines=[]):(this.runtimeDATA4ShouldRenderItems.nodes=this.calcShouldRenderNodes(),this.runtimeDATA4ShouldRenderItems.lines=this.calcShouldRenderLines(),this.runtimeDATA4ShouldRenderItems.fakeLines=this.calcShouldRenderFakeLines())}addConnectTarget(e){return this.runtimeDATA4ConnectTargets.push(e),this.commits.connectTargetsListChanged=!0,this.commits.fakeLinesListChanged=!0,this.getConnectTargetById(e.targetId)}addElLineTarget(e){this.runtimeDATA4ElLineTargets.push(e),this.commits.fakeLinesListChanged=!0}setRootNodeId(e){if(this.graphData.rootNode=this.graphData.nodes.find(t=>t.id===e),!this.graphData.rootNode)throw new Error("The root node [rootId] is not set! Or cannot get the root node:"+e+", If you don't have any nodes to display, you can simply set an invisible node: {id:'root', opacity:0}")}}class Sn{constructor(){N(this,"listeners");N(this,"useReactiveDataToAutoUpdateView",!1);N(this,"instanceId");N(this,"dataProvider");N(this,"options");N(this,"_dataUpdatedRequested",!1);N(this,"eventHandlers",[]);N(this,"_emitHook");this.dataProvider=new Pe,this.options=this.dataProvider.getOptions(),this.listeners={},this.instanceId="RG-"+this.generateNewUUID(5)}generateNewUUID(i=5){return Ve(i)}enableDebugLog(i){this.dataProvider.updateOptions({debug:i}),window&&(window.relationGraphDebug=i)}_dataUpdated(){this._requestDataUpdate()}_requestDataUpdate(){!window||!window.requestAnimationFrame||this._dataUpdatedRequested||(this._dataUpdatedRequested=!0,requestAnimationFrame(this._doSomethingAfterDataUpdated.bind(this)))}_doSomethingAfterDataUpdated(){try{!this.useReactiveDataToAutoUpdateView||this.dataProvider.isPerformanceMode()?(this._previousUpdateTime=Date.now(),this.updateShouldRenderGraphData(),this.updateEasyView(),this.dataProvider&&this.dataProvider.dataUpdated()):this.updateMiniView()}catch(i){console.error("[relation-graph]Error:",i)}finally{this._dataUpdatedRequested=!1}}addEventHandler(i){this.eventHandlers.includes(i)||this.eventHandlers.push(i)}removeEventHandler(i){const e=this.eventHandlers.indexOf(i);e!==-1&&this.eventHandlers.splice(e,1)}setEventEmitHook(i){this._emitHook=i,console.warn("[setEventEmitHook]",this._emitHook)}emitEvent(i,...e){let{result:t,handled:n}=this.defaultEventHandler(i,...e);for(const o of this.eventHandlers){const a=o(i,...e);a!==void 0&&(t=a,n=!0)}if(n||this._emitHook&&this._emitHook(i,...e,o=>{o!==void 0&&(t=o)}),t!==void 0)return C("[custom event hook]Event:",i," => returnValue:",t),t}defaultEventHandler(i,...e){let t,n=!1;if(i===V.onReady)this.listeners.onReady&&(n=!0,this.listeners.onReady(this));else if(i===V.onNodeDragStart)this.listeners.onNodeDragStart&&(n=!0,this.listeners.onNodeDragStart(e[0],e[1]));else if(i===V.onNodeDragging){if(this.listeners.onNodeDragging){n=!0;const o=e[0],a=e[1],r=e[2],l=e[3],c=e[4],d=e[5];t=this.listeners.onNodeDragging(o,a,r,l,c,d)}}else if(i===V.onCanvasDragging){if(this.listeners.onCanvasDragging){n=!0;const o=e[0],a=e[1],r=e[2],l=e[3];t=this.listeners.onCanvasDragging(o,a,r,l)}}else if(i===V.onNodeDragEnd){const o=e[0],a=e[1],r=e[2],l=e[3];this.listeners.onNodeDragEnd&&(n=!0,this.listeners.onNodeDragEnd(o,a,r,l))}else if(i===V.onZoomEnd)this.listeners.onZoomEnd&&(n=!0,this.listeners.onZoomEnd());else if(i===V.onNodeClick){if(this.listeners.onNodeClick){n=!0;const o=e[0],a=e[1];this.listeners.onNodeClick(o,a)}}else if(i===V.onLineClick){if(this.listeners.onLineClick){n=!0;const o=e[0],a=e[1],r=e[2];this.listeners.onLineClick(o,a,r)}}else if(i===V.onNodeExpand){if(this.listeners.onNodeExpand){n=!0;const o=e[0],a=e[1];this.listeners.onNodeExpand(o,a)}}else if(i===V.onNodeCollapse){if(this.listeners.onNodeCollapse){n=!0;const o=e[0],a=e[1];this.listeners.onNodeCollapse(o,a)}}else if(i===V.onCanvasDragEnd){if(this.listeners.onCanvasDragEnd){n=!0;const o=e[0];this.listeners.onCanvasDragEnd(o)}}else if(i===V.onCanvasClick){if(this.listeners.onCanvasClick){n=!0;const o=e[0];this.listeners.onCanvasClick(o)}}else if(i===V.onCanvasSelectionEnd){if(this.listeners.onCanvasSelectionEnd){n=!0;const o=e[0],a=e[1];this.listeners.onCanvasSelectionEnd(o,a)}}else if(i===V.onContextmenu){if(this.listeners.onContextmenu){n=!0;const o=e[0],a=e[1],r=e[2];this.listeners.onContextmenu(o,a,r)}}else if(i===V.onFullscreen){if(this.listeners.onFullscreen){n=!0;const o=e[0],a=e[1];t=this.listeners.onFullscreen(o,a)}}else if(i===V.beforeAddNodes){if(this.listeners.beforeAddNodes){n=!0;const o=e[0];t=this.listeners.beforeAddNodes(o)}}else if(i===V.beforeAddLines){if(this.listeners.beforeAddLines){n=!0;const o=e[0];t=this.listeners.beforeAddLines(o)}}else if(i===V.onKeyboardDown){if(this.listeners.onKeyboardDown){n=!0;const o=e[0];t=this.listeners.onKeyboardDown(o)}}else if(i===V.onKeyboardUp){if(this.listeners.onKeyboardUp){n=!0;const o=e[0];t=this.listeners.onKeyboardUp(o)}}else if(i===V.onLineBeCreated){if(this.listeners.onLineBeCreated){n=!0;const o=e[0];t=this.listeners.onLineBeCreated(o)}}else if(i===V.onCanvasDragStart&&this.listeners.onCanvasDragStart){n=!0;const o=e[0],a=e[1],r=e[2];t=this.listeners.onCanvasDragStart(o,a,r)}return{result:t,handled:n}}setEventListener(i){Object.assign(this.listeners,i)}}class Pn extends Sn{constructor(){super(...arguments);N(this,"$dom");N(this,"$canvasDom");N(this,"_rgAsConnectArea",!1);N(this,"$lineTextContainer4NormalLine");N(this,"$lineTextContainer4FakeLine")}getLineTextContainer(e){if(!(!e||!this.$canvasDom))return e.isFakeLine?(this.$lineTextContainer4NormalLine||(this.$lineTextContainer4NormalLine=this.$canvasDom.querySelector(".rg-lines-container-el-lines .rg-linetext-container")),this.$lineTextContainer4NormalLine):(this.$lineTextContainer4FakeLine||(this.$lineTextContainer4FakeLine=this.$canvasDom.querySelector(".rg-lines-container-normal-lines .rg-linetext-container")),this.$lineTextContainer4FakeLine)}getViewBoundingClientRect(){var e;return this.$dom?(e=this.$dom)==null?void 0:e.getBoundingClientRect():(console.error("[getViewBoundingClientRect] RelationGraph DOM is not set yet!"),null)}getBoundingClientRect(){return console.warn("Please use getViewBoundingClientRect instead of getBoundingClientRect, this method is compatible with older api versions."),this.getViewBoundingClientRect()}_getEventPoint(e){return this.getViewXyByEvent(e)}getViewXyByEvent(e){const t={x:e.clientX,y:e.clientY};if(de(e)){const o=e.touches||e.targetTouches;if(!o)throw new Error("error targetTouches");t.x=o[0].clientX,t.x=o[0].clientY}const n=this.getViewBoundingClientRect();return{x:t.x-n.x,y:t.y-n.y}}getCanvasXyByClientXy(e){const t=this.getViewBoundingClientRect(),n={x:e.x-t.left,y:e.y-t.top};return this.getCanvasXyByViewXy(n)}getCanvasXyByViewXy(e){if(this._rgAsConnectArea)return e;const t=this.dataProvider.getOptions(),n=t.canvasZoom/100,o={x:e.x-t.canvasOffset.x,y:e.y-t.canvasOffset.y};return{x:o.x/n,y:o.y/n}}getViewXyByCanvasXy(e){const t=this.dataProvider.getOptions(),n=t.canvasZoom/100;return{x:e.x*n+t.canvasOffset.x,y:e.y*n+t.canvasOffset.y}}getCanvasCoordinateByClientCoordinate(e){return console.warn("Please use getCanvasXyByClientXy instead of getCanvasCoordinateByClientCoordinate, this method is compatible with older api versions."),this.getCanvasXyByClientXy(e)}isNode(e){const t=xe(e,"rg-node-peel","rg-map");if(!!t)return this.dataProvider.getNodeById(t.dataset.id)}isLine(e){const t=xe(e,"rg-line-peel","relation-graph");if(!!t)return this.dataProvider.getLineById(t.dataset.id)}isLink(e){throw new Error("Please use isLine")}}class Tn extends Pe{constructor(e,t,n,o){super();N(this,"dataStores");this.dataStores=e;const a=Object.assign({},this.options,n);this.options=n,Object.assign(this.options,a),this.graphData=t,this.runtimeDATA4Links=o.runtimeDATA4Links,this.runtimeDATA4ShouldRenderItems=o.runtimeDATA4ShouldRenderItems,this.runtimeDATA4ConnectTargets=o.runtimeDATA4ConnectTargets,this.runtimeDATA4NodeMap=o.runtimeDATA4NodeMap,this.runtimeDATA4LinkMap=o.runtimeDATA4LinkMap,this.runtimeDATA4ElLineTargets=o.runtimeDATA4ElLineTargets,this.updateViewHook=r=>{if(console.log("###########updateViewHook"),r.optionsChanged&&(this.dataStores.store4Options.set(this.getOptions()),console.log("[updateViewHook]optionsChanged")),r.nodesListChanged&&(this.dataStores.store4ShouldRenderNodes.set(this.getShouldRenderNodes()),console.log("[updateViewHook]nodesListChanged")),r.linesListChanged){const l=this.getShouldRenderLines();this.dataStores.store4ShouldRenderLines.set(l),console.log("[updateViewHook]linesListChanged")}if(r.fakeLinesListChanged){const l=this.getShouldRenderFakeLines();this.dataStores.store4ShouldRenderFakeLines.set(l),console.log("[updateViewHook]fakeLinesListChanged")}}}}class Mn extends Pe{constructor(i,e,t){super(),this.graphData=i,this.runtimeDATA4Links=t.runtimeDATA4Links,this.runtimeDATA4ShouldRenderItems=t.runtimeDATA4ShouldRenderItems,this.runtimeDATA4ConnectTargets=t.runtimeDATA4ConnectTargets,this.runtimeDATA4NodeMap=t.runtimeDATA4NodeMap,this.runtimeDATA4LinkMap=t.runtimeDATA4LinkMap,this.runtimeDATA4ElLineTargets=t.runtimeDATA4ElLineTargets;const n=Object.assign({},this.options,e);this.options=e,Object.assign(this.options,n)}}class kn extends Pe{constructor(e,t){super();N(this,"dataStores");this.dataStores=e,this.updateViewHook=n=>{n.optionsChanged&&this.dataStores.store4Options.set(this.getOptions()),(n.nodesListChanged||n.changedNodes.length>0)&&(this.dataStores.store4ShouldRenderNodes.set(this.getShouldRenderNodes()),console.log("[updateViewHook]nodesListChanged")),(n.linesListChanged||n.changedLines.length>0)&&(this.dataStores.store4ShouldRenderLines.set(this.getShouldRenderLines()),console.log("[updateViewHook]linesListChanged")),(n.fakeLinesListChanged||n.changedFakeLines.length>0)&&this.dataStores.store4ShouldRenderFakeLines.set([...this.getShouldRenderFakeLines()])}}}class In extends Pe{constructor(i,e){super(),e(),this.updateViewHook=t=>{if(t.optionsChanged&&i.store4Options.set(this.getOptions()),t.nodesListChanged||t.changedNodes.length>0){const n=this.getShouldRenderNodes();i.store4ShouldRenderNodes.set([...n])}if(t.linesListChanged||t.changedLines.length>0){const n=this.getShouldRenderLines();i.store4ShouldRenderLines.set(n)}t.fakeLinesListChanged?i.store4ShouldRenderFakeLines.set(this.getShouldRenderFakeLines()):t.changedFakeLines.length>0&&i.store4ShouldRenderFakeLines.set(this.getShouldRenderFakeLines())}}}class En extends Pn{constructor(){super();N(this,"_initRawPropertyFn",(e,t,n)=>{});N(this,"dataStores")}setReactiveData4Vue2(e,t,n,o){this.useReactiveDataToAutoUpdateView=!0,this.dataProvider=new Mn(e,t,n),this._initRawPropertyFn=o,this.options=this.dataProvider.options,this.dataStores={shouldRenderNodesStore:n.runtimeDATA4ShouldRenderItems.nodes,shouldRenderLinesStore:n.runtimeDATA4ShouldRenderItems.lines,shouldRenderFakeLinesStore:n.runtimeDATA4ShouldRenderItems.fakeLines}}setReactiveData4Vue3(e,t,n,o,a){this.useReactiveDataToAutoUpdateView=!0,this.dataProvider=new Tn(e,t,n,o),this._initRawPropertyFn=a,this.options=this.dataProvider.getOptions(),this.dataStores={optionsStore:e.store4Options,shouldRenderNodesStore:e.store4ShouldRenderNodes,shouldRenderLinesStore:e.store4ShouldRenderLines,shouldRenderFakeLinesStore:e.store4ShouldRenderFakeLines,optionsRef:e.optionsRef,shouldRenderNodesRef:e.shouldRenderNodesRef,shouldRenderLinesRef:e.shouldRenderLinesRef,shouldRenderFakeLinesRef:e.shouldRenderFakeLinesRef},console.error("[RelationGraphWith2Data] setReactiveData4Vue3:",this.options)}setReactiveData4React(e,t){this.dataProvider=new In(e,t),this.options=this.dataProvider.getOptions(),this.dataStores={optionsStore:e.store4Options,shouldRenderNodesStore:e.store4ShouldRenderNodes,shouldRenderLinesStore:e.store4ShouldRenderLines,shouldRenderFakeLinesStore:e.store4ShouldRenderFakeLines}}setReactiveData4Svelte(e,t){this.dataProvider=new kn(e,t),this.options=this.dataProvider.getOptions(),this.dataStores={optionsStore:e.store4Options,shouldRenderNodesStore:e.store4ShouldRenderNodes,shouldRenderLinesStore:e.store4ShouldRenderLines,shouldRenderFakeLinesStore:e.store4ShouldRenderFakeLines},console.log("[RelationGraphWith2Data] setReactiveData4Svelte:",this.options)}generateNewNodeId(e=5){const t=Ve(e);return this.dataProvider.getNodeById(t)?this.generateNewNodeId(e+1):t}}class Dn extends En{constructor(){super()}getOptions(){return this.dataProvider.getOptions()}getNodeById(i){return this.dataProvider.getNodeById(i)}getLineById(i){return this.dataProvider.getLineById(i)}getLinkByLineId(i){return this.dataProvider.getLinkByLineId(i)}getLinkByLine(i){return this.getLinkByLineId(i.id)}getLines(){return this.dataProvider.getLines()}getElementLineById(i){return this.getFakeLineById(i)}getElementLines(){return this.getFakeLines()}getFakeLines(){return this.dataProvider.getFakeLines()}getFakeLineById(i){return this.dataProvider.getFakeLineById(i)}getNodes(){return this.dataProvider.getNodes()}getLinks(){return this.dataProvider.getLinks()}getConnectTargets(){return this.dataProvider.getConnectTargets()}}class Rn extends Dn{constructor(){super()}getRelatedLinesByNode(i){const e=[];for(const t of this.getLinks())(i===t.fromNode||i===t.toNode)&&e.push(t.line);return e}getLinksBetweenNodes(i){const e=[],t=this.getLinks();for(const n of t)i.includes(n.fromNode)&&i.includes(n.toNode)&&e.push(n);return e}getLinesBetweenNodes(i){return this.getLinksBetweenNodes(i).map(e=>e.line)}getNodeRelatedNodes(i){const e=[];for(const t of this.getLinks())t.line.forDisplayOnly||(t.fromNode===i?e.includes(t.toNode)||e.push(t.toNode):t.toNode===i&&(e.includes(t.fromNode)||e.push(t.fromNode)));return e}getNodeIncomingNodes(i){const e=[];for(const t of this.getLinks())t.line.forDisplayOnly||t.toNode===i&&(e.includes(t.fromNode)||e.push(t.fromNode));return e}getNodeOutgoingNodes(i){const e=[];for(const t of this.getLinks())t.line.forDisplayOnly||t.fromNode===i&&(e.includes(t.toNode)||e.push(t.toNode));return e}findGroupNodes(i,e=[]){return this._getNetworkNodesByNode(i,e)}getGroupNodesByNode(i,e=[]){return this._getNetworkNodesByNode(i,e)}getNetworkNodesByNode(i){return this._getNetworkNodesByNode(i)}_getNetworkNodesByNode(i,e=[]){if(!i)throw new Error("Call graphInstance.getNetworkNodesByNode:error: node is undefined");e.includes(i)||e.push(i);for(const t of this.getNodeRelatedNodes(i))e.includes(t)||this._getNetworkNodesByNode(t,e);return e}getStuffSize(i){return console.warn("Please use getNodesRectBox instead of getStuffSize, this method is compatible with older api versions."),this.getNodesRectBox(i)}getNodesViewInfo(i){return console.warn("Please use getNodesRectBox instead of getNodesViewInfo, this method is compatible with older api versions."),this.getNodesRectBox(i)}getNodesRectBox(i){const t=(i||this.getNodes()).filter(d=>d.rgCalcedVisibility!==!1);if(t.length===0)return{width:10,height:10,minX:0,minY:0,maxX:0,maxY:0};let n=9999999,o=9999999,a=-9999999,r=-9999999;t.forEach(d=>{d.x<n&&(n=d.x),d.x+d.el_W>a&&(a=d.x+d.el_W),d.y<o&&(o=d.y);const u=d.y+d.el_H;u>r&&(r=u)});const l=a-n,c=r-o;return{width:l<0?0:l,height:c<0?0:c,minX:n===9999999?0:n,minY:o===9999999?0:o,maxX:a===-9999999?0:a,maxY:r===-9999999?0:r}}getNodesCenter(i){const e=this.getNodesRectBox(i);C("getNodesCenter:",e);const t=e.minX+(e.maxX-e.minX)/2,n=e.minY+(e.maxY-e.minY)/2;return{x:t,y:n}}getDescendantNodes(i){return G.getDescendantNodes(i)}getNodesInSelectionView(i){const e=this.getCanvasXyByViewXy({x:i.x,y:i.y}),t=this.getCanvasXyByViewXy({x:i.x+i.width,y:i.y+i.height}),n=[];return this.getNodes().forEach(o=>{const a=o.x+o.el_W/2,r=o.y+o.el_H/2;a>e.x&&r>e.y&&a<t.x&&r<t.y&&n.push(o)}),n}getShouldRenderNodes(i){return this.dataProvider.isPerformanceMode()&&i?i:this.dataProvider.getShouldRenderNodes()}getShouldRenderLines(i){return this.dataProvider.isPerformanceMode()&&i?i:this.dataProvider.getShouldRenderLines()}getShouldRenderFakeLines(i){return this.dataProvider.isPerformanceMode()&&i?i:this.dataProvider.getShouldRenderFakeLines()}}class An extends Rn{constructor(){super();N(this,"_elLineUpdateTimer");N(this,"_canvasCurrentInfo",{x:0,y:0,scale:1});N(this,"_nodeResizeEffectTimer");N(this,"prevAddNodeTimestamp",0)}removeLine(e){this.removeLines([e])}removeLines(e){this.removeLineByIds(e.map(t=>t.id))}removeLineById(e){this.removeLineByIds([e])}removeLineByIds(e){this.dataProvider.removeLineByIds(e),this._dataUpdated()}removeFakeLine(e){this.removeFakeLineById(e.id)}removeFakeLineById(e){C("removeLineById:",e),this.dataProvider.removeFakeLineByIds([e]),this._dataUpdated()}removeLink(e){C("removeLink:",e),this.removeLinkByLineId(e.lineId)}removeLinkByLineId(e){this.dataProvider.removeLineByIds([e]),this._dataUpdated()}removeNodeById(e){this.dataProvider.removeNodeById([e]),this._dataUpdated()}removeNodesByIds(e){e.forEach(t=>this.dataProvider.removeNodeById(e)),this._dataUpdated()}removeNodes(e){this.dataProvider.removeNodeById(e.map(t=>t.id)),this._dataUpdated()}removeNode(e){this.dataProvider.removeNodeById([e.id]),this._dataUpdated()}removeELementLineById(e){C("removeELementLineById:",e),this.removeFakeLineById(e)}addNode(e){if(C("addNode:",e),e&&Array.isArray(e)){console.error("addNode: node is array:",e);return}this._addNodes([e]),this._dataUpdated()}addNodes(e){if(C("addNodes:",e),e&&!Array.isArray(e)){console.error("addNodes: nodes is not array:",e);return}this._addNodes(e),this._dataUpdated()}addLine(e){if(C("addLine:",e),e&&Array.isArray(e)){console.error("addLine: line is array:",e);return}this.addLines([e])}addLines(e){if(C("addLines:",e),e&&!Array.isArray(e)){console.error("addLines: lines is not array:",e);return}if(e.length===0)return;const t=e.filter(o=>!o.isFakeLine);this._addLines(t);const n=e.filter(o=>o.isFakeLine);this.addFakeLines(n),this._dataUpdated()}_addFakeLines(e){this.dataProvider.addFakeLines(e)}addFakeLines(e){C("addFakeLines:",e),this._addFakeLines(e),this._dataUpdated()}updateElementLines(){this.dataProvider.getElLineTargets().length!==0&&(C("updateElementLines:runtimeDATA4ElLineTargets:",this.dataProvider.getElLineTargets().length),this._elLineUpdateTimer&&clearTimeout(this._elLineUpdateTimer),this._elLineUpdateTimer=setTimeout(()=>{this._updateElementLines(),this._dataUpdated()},100))}_updateElementLines(){this._updateCanvasBoxInfo();for(const e of this.dataProvider.getElLineTargets())this.updateElementTarget(e)}_updateCanvasBoxInfo(){const e=this.$canvasDom.getBoundingClientRect();this._canvasCurrentInfo.x=e.x,this._canvasCurrentInfo.y=e.y,this._canvasCurrentInfo.scale=this.dataProvider.getOptions().canvasZoom/100}updateElementTarget(e){const t=this._getElementTargetPosition(document.getElementById(e.id),e);t?this.dataProvider.updateElLineTarget(e.id,{hidden:!1,...t}):this.dataProvider.updateElLineTarget(e.id,{hidden:!0})}_getElementTargetPosition(e){if(!e)return null;const t=e.getBoundingClientRect(),n=(t.x-this._canvasCurrentInfo.x)/this._canvasCurrentInfo.scale,o=(t.y-this._canvasCurrentInfo.y)/this._canvasCurrentInfo.scale,a=t.width/this._canvasCurrentInfo.scale,r=t.height/this._canvasCurrentInfo.scale;return{x:n,y:o,el_W:a,el_H:r}}addElementLines(e){C("addElementLines:",e),e.forEach(t=>{t.fromType=B.HTMLElementId,t.toType=B.HTMLElementId,t.isFakeLine=!0,t.id||(t.id=this.generateNewUUID(6)),t.forDisplayOnly=!0}),this.addFakeLines(e),console.log("addElementLines:",e.length,e),this.updateElementLines()}updateNodeOffsetSize(e,t,n){const o=this.getNodeById(e);if(!o)return;const a=o.el_W,r=o.el_H;(a!==t||r!==n)&&(this.dataProvider.updateNode(e,{el_W:t,el_H:n}),this._nodeResizeEffectTimer&&clearTimeout(this._nodeResizeEffectTimer),this._nodeResizeEffectTimer=setTimeout(()=>{this._dataUpdated()},100))}clearFakeLines(){this.dataProvider.clearFakeLines(),this._dataUpdated()}clearElementLines(){const e=[];for(const t of this.getFakeLines())(t.fromType===B.HTMLElementId||t.toType===B.HTMLElementId)&&e.push(t.id);this.dataProvider.removeFakeLineByIds(e),this._dataUpdated()}_addNodes(e){this.emitEvent(V.beforeAddNodes,e);const t={};this.getNodes().forEach(a=>{t[a.id]=a});const n=[],o=this.getOptions();e.forEach(a=>{let r=t[a.id];if(!r){let{text:l,id:c}=a;!l&&a.label&&(l=a.label,console.warn('Use "label" as "text":',a.label)),!l&&c&&(l=c,console.warn('Use "id" as "text":',c)),r=Ne(Object.assign({},a,{text:l}),o),this._initRawPropertyFn&&this._initRawPropertyFn(r,"lot",r.lot),r&&(t[r.id]=r,n.push(r))}}),this.dataProvider.addNodes(n),n.length>0&&(this.prevAddNodeTimestamp=Date.now())}_addLines(e){this.emitEvent(V.beforeAddLines,e);const t=[];e.forEach(n=>{let{from:o,to:a,text:r}=n;if(!o)if(n.source)o=n.source,console.warn('Use "source" as "from":',n.source);else{console.error('JsonLine Must have field:"from"',n);return}if(!a)if(n.target)a=n.target,console.warn('Use "target" as "to":',n.target);else{console.error('JsonLine Must have field:"to"',n);return}if(r||n.label&&(r=n.label,console.warn('Use "label" as "text":',n.label)),!this.getNodeById(o)){console.error("Can not found from node:",n);return}if(!this.getNodeById(a)){console.error("Can not found to node:",n);return}if(n.id){if(this.getLineById(n.id)){console.warn("_addLines:skip duplicate line id:",n.id);return}else if(t.some(u=>u.id===n.id)){console.warn("Duplicate line id in new lines:",n.id);return}}else n.id="L-"+this.generateNewUUID(6);const d=fe(Object.assign({},n,{from:o,to:a,text:r}),this.getOptions());t.push(d)}),this.dataProvider.addLines(t)}updateNode(e,t){this.dataProvider.updateNode(typeof e=="string"?e:e.id,t),this._dataUpdated()}updateNodePosition(e,t,n){this.dataProvider.updateNode(typeof e=="string"?e:e.id,{x:t,y:n}),this._dataUpdated()}updateNodeData(e,t){this.dataProvider.updateNodeData(typeof e=="string"?e:e.id,t),this._dataUpdated()}updateLine(e,t){this.dataProvider.updateLine(typeof e=="string"?e:e.id,t),this._dataUpdated()}updateLineData(e,t){this.dataProvider.updateLineData(typeof e=="string"?e:e.id,t),this._dataUpdated()}updateFakeLine(e,t){this.dataProvider.updateFakeLine(typeof e=="string"?e:e.id,t),this._dataUpdated()}flatNodeData(e,t,n,o){G.flatNodeData(e,t,n,o)}loadGraphJsonData(e){e.lines||(e.lines=e.relations,e.lines&&console.warn("[relation-graph] For compatibility with older version, Use jsonData.relations as jsonData.lines, It is recommended that you define your data using")),e.lines||(e.lines=e.links||e.edges,e.lines&&console.warn("[relation-graph] For compatibility with older version, Use jsonData.links/jsonData.edges as jsonData.lines, It is recommended that you define your data using"));const t=e.nodes||[],n=e.lines||[],o=[],a=[];this.flatNodeData(t,null,o,a),n.forEach(r=>{a.push(r)}),this._addNodes(o),C("Nodes is initialized"),this._addLines(a),this._dataUpdated(),setTimeout(()=>{e.elementLines&&(console.warn("elementLines is deprecated, please use fakeLines with isFakeLine and fromType/toType = RGInnerConnectTargetType.HTMLElementId instead:",e.elementLines),this.addElementLines(e.elementLines)),e.fakeLines&&this.addFakeLines(e.fakeLines),this._dataUpdated()},500)}updateShouldRenderGraphData(e=!1){!e&&!this.dataProvider.isPerformanceMode()||this.dataProvider.updateShouldRenderGraphData()}updateNodesVisibleProperty(e){this.dataProvider.updateNodesVisibleProperty(e)}updateVisibleNodesSize(){for(const e of this.getShouldRenderNodes()){const t=this.getNodeElByNodeId(e.id);t&&this._onNodeDomResize(t,t.clientWidth,t.clientHeight)}}_clearGraph(){this.dataProvider.clearReactiveData(),this.dataProvider.clearChecked(),this.dataProvider.setEditingLine(null),this.dataProvider.setEditingNodes([])}_setJsonData(e,t=!1){this._clearGraph(),C("set jsonData:",e),this.loadGraphJsonData(e)}}class Vn extends An{constructor(){super();N(this,"canvasConnectTargetsMap",new Map);N(this,"nodeConnectTargetsMap",new Map);N(this,"connectTargetElementMap",new Map);N(this,"_connectTargetUpdateRequestedSet",new Map);N(this,"_updateTimer");N(this,"_removedConnectTargetMap",new Map)}updateConnectTargetsOnCanvas(e,t){if(!t)return;console.warn(`updateConnectTargetsOnCanvas:[${e}]:`);const n=t.classList.contains("rg-canvas-slot-above")?"above":"behind",o=this.canvasConnectTargetsMap.get(n);o&&o.length>0&&this.updateConnectTargetList(e,t,o)}updateConnectTargetsByNodeId(e){const t=this.getNodeElByNodeId(e);this.updateConnectTargetsOnNode("API",e,t)}getNodeElByNodeId(e){return this.$dom.querySelector(`[data-id="${e}"]`)}updateConnectTargetsOnNode(e,t,n){const o=this.nodeConnectTargetsMap.get(t)||[];o.length!==0&&this.updateConnectTargetList(e,n,o)}updateConnectTargetList(e,t,n){const o=this.dataProvider.getCanvasScale();for(const a of n){const r=this.connectTargetElementMap.get(a.targetId);if(!r){console.error("Can not find el for connectTarget:",a.targetId,a);continue}this._requestUpdateConnectTargetOffset(e,a,r,t,o)}}_requestUpdateConnectTargetOffset(e,t,n,o,a){this._connectTargetUpdateRequestedSet.set(t.targetId,{stableTimes:0,connectTarget:t,by:e,connectTargetEl:n,relativeEl:o}),clearTimeout(this._updateTimer),this._updateTimer=setTimeout(()=>{this._updateAllRequestedConnectTargetOffsets()},Math.min(this._connectTargetUpdateRequestedSet.size+10,50))}_updateAllRequestedConnectTargetOffsets(){let e=0,t=0;for(const n of this._connectTargetUpdateRequestedSet.values()){const{by:o,connectTargetEl:a,relativeEl:r,connectTarget:l}=n;if(this.dataProvider.isPerformanceMode()&&l.nodeId){const h=this.getNodeById(l.nodeId);if(!h||!h.rgShouldRender||!h.rgCalcedVisibility){t++;continue}}const c=this.dataProvider.getCanvasScale();this._updateConnectTargetOffset(o,l,a,r,c)?e++:n.stableTimes++,n.stableTimes>2&&this._connectTargetUpdateRequestedSet.delete(l.targetId)}e>0?(console.warn(`_updateAllRequestedConnectTargetOffsets: ${e} of ${this._connectTargetUpdateRequestedSet.size} changed, ${t} Skipped!`),clearTimeout(this._updateTimer),this._updateTimer=setTimeout(()=>{this._updateAllRequestedConnectTargetOffsets()},Math.min(e/2+10,50)),this._dataUpdated()):(console.warn("_updateAllRequestedConnectTargetOffsets:::::::OK",this._connectTargetUpdateRequestedSet.size),this._connectTargetUpdateRequestedSet.clear(),this._dataUpdated())}_updateConnectTargetOffset(e,t,n,o,a){const r=o.getBoundingClientRect(),l=n.getBoundingClientRect(),c=Math.round(l.x-r.x),d=Math.round(l.y-r.y),h=this.dataProvider.getCanvasScale(),u=c/h,y=d/h,f=l.width/h,g=l.height/h;return t.offsetX!==u||t.offsetY!==y||t.width!==f||t.height!==g?(this.dataProvider.updateConnectTarget(t.targetId,{offsetX:u,offsetY:y,width:l.width/h,height:l.height/h}),console.warn("#######ConnectTargetOffset Changed!",t.targetId,t.offsetX,t.offsetY),!0):(console.warn("#######ConnectTargetOffset Not changed!",t.targetId,t.offsetX,t.offsetY),!1)}_onConnectTargetMounted(e,t,n,o){const a=this.dataProvider.getCanvasScale();this._requestUpdateConnectTargetOffset(e,t,n,o,a)}getNodeElByChildrenTarget(e){return xe(e,"rg-node-peel","rg-map")}registerConnectTarget(e,t,n,o,a={}){if(n!==B.NodePoint&&n!==B.CanvasPoint)return;if(!e){console.error(`[registerConnectTarget]Can not find CanvasPoint target DOM: ${t}`);return}const r=this.getNodeElByChildrenTarget(e),l=r==null?void 0:r.dataset.id;if(l==="rg-newNodeTemplate")return;let c=this.dataProvider.getConnectTargetById(t);if(!c){const h={targetId:t,targetType:n,junctionPoint:o,nodeId:"",width:20,height:20,offsetX:0,offsetY:0,offsetPercentX:0,offsetPercentY:0,targetData:a||{}};this.reuseConnectTarget(h),c=this.dataProvider.addConnectTarget(h)}return this.connectTargetElementMap.set(c.targetId,e),(l?this.getNodeById(l):null)?this._addConnectTargetToNodeMap(l,c,e,r):this._addConnectTargetToCanvasMap(c,e),c}_addConnectTargetToNodeMap(e,t,n,o){this.dataProvider.updateConnectTarget(t.targetId,{junctionPoint:t.junctionPoint,targetType:B.NodePoint,nodeId:e,targetData:Object.assign({},t.targetData||{},{nodeId:e})});let a=this.nodeConnectTargetsMap.get(e);a?a.some(r=>r.targetId===t.targetId)||a.push(t):this.nodeConnectTargetsMap.set(e,[t]),this._onConnectTargetMounted("NT-Mounted",t,n,o)}_addConnectTargetToCanvasMap(e,t){let n=xe(t,"rg-canvas-slot","rg-map");if(!n){console.error(`Can not find CanvasPoint target DOM's parent(.rg-canvas-slot) : ${e.targetId}`,t);return}if(n){const o=n.classList.contains("rg-canvas-slot-above")?"above":"behind";this.dataProvider.updateConnectTarget(e.targetId,{junctionPoint:e.junctionPoint,targetType:B.CanvasPoint,targetData:Object.assign({},e.targetData||{})});const a=this.canvasConnectTargetsMap.get(o);a?a.some(r=>r.targetId===e.targetId)||a.push(e):this.canvasConnectTargetsMap.set(o,[e]),this._onConnectTargetMounted("CT-Mounted",e,t,n)}}unregisterConnectTarget(e){const t=this.dataProvider.getConnectTargetById(e);if(!t)return;let n;if(t.nodeId&&this.nodeConnectTargetsMap.has(t.nodeId))n=this.nodeConnectTargetsMap.get(t.nodeId);else{let o=this.canvasConnectTargetsMap.get("behind").findIndex(a=>a.targetId===e);o!==-1?n=this.canvasConnectTargetsMap.get("behind"):(o=this.canvasConnectTargetsMap.get("above").findIndex(a=>a.targetId===e),o!==-1&&(n=this.canvasConnectTargetsMap.get("above")))}if(n){const o=n.findIndex(a=>a.targetId===e);o!==-1&&n.splice(o,1)}this.dataProvider.removeConnectTarget(e),this.connectTargetElementMap.delete(e),this._removedConnectTargetMap.set(t.targetId,t)}reuseConnectTarget(e){if(this._removedConnectTargetMap.has(e.targetId)){const t=this._removedConnectTargetMap.get(e.targetId);e.offsetX=t.offsetX,e.offsetY=t.offsetY,e.width=t.width,e.height=t.height,e.offsetPercentX=t.offsetPercentX,e.offsetPercentY=t.offsetPercentY,this._removedConnectTargetMap.delete(e.targetId)}}}class Xn extends Vn{constructor(){super();N(this,"fakeLineTargetRender")}generateCreatingLineConfig(e){e||(e=this.dataProvider.getOptions());const{newLinkTemplate:t,newLineTemplate:n}=e,o=t.fromNode;if(!o)return{line:n,from:null,to:null,totalLinesBetweenNodes:1,currentLineIndex:0};const a=t.toNode,r=a.targetType===B.Node?t.toNode:this.getFakeLineTarget(a.targetType,a.id,n);return{line:Object.assign({},n,{isFakeLine:!1}),from:this.getFakeLineTarget(o.targetType,o.id,n),to:r,totalLinesBetweenNodes:1,currentLineIndex:0}}generateLineConfig(e){const t=this.getLinkByLine(e);return t?{line:t.line,from:t.fromNode,to:t.toNode,totalLinesBetweenNodes:t.totalLinesBetweenNodes,currentLineIndex:t.currentLineIndex}:!1}generateFakeLineConfig(e){let t=1,n=0;if(e.fromType===B.HTMLElementId&&e.toType===B.HTMLElementId){const r=this.dataProvider.getFakeLines().filter(l=>l.from===e.from&&l.to===e.to);r.length>1&&(console.warn("sameTargetLines element-line:",e),t=r.length,n=r.indexOf(e))}let o=this.getFakeLineTarget(e.fromType,e.from,e),a=this.getFakeLineTarget(e.toType,e.to,e);return!o&&e.fromType===B.Node?(console.error("[generateFakeLineConfig]error fakeLine from:",e.fromType,e.from,e),!1):!a&&e.fromType===B.Node?(console.error("[generateFakeLineConfig]error fakeLine to:",e.toType,e.to,e),!1):{line:e,from:o,to:a,totalLinesBetweenNodes:t,currentLineIndex:n}}setFakeLineTargetRender(e){this.fakeLineTargetRender=e}getFakeLineTarget(e,t,n){if(e===B.HTMLElementId){let o=this.dataProvider.getElLineTargets().find(a=>a.id===t);return o||(o={x:300,y:300,targetType:B.HTMLElementId,nodeShape:1,id:t,el_W:40,el_H:40,hidden:!0},this.dataProvider.addElLineTarget(o),this.updateElementLines()),o.hidden?null:o}else{if(e===B.Node)return this.getNodeById(t);if(e===B.NodePoint||e===B.CanvasPoint){const o=this.dataProvider.getConnectTargetById(t);if(!o)return;if(o.nodeId){const a=this.getNodeById(o.nodeId);if(!a){console.error("[getFakeLineTarget]Can not find NodePoint-s Node:",`${o.targetId}@${o.nodeId}`);return}return{x:a.x+o.offsetPercentX*a.el_W+o.offsetX,y:a.y+o.offsetPercentY*a.el_H+o.offsetY,targetType:B.NodePoint,targetData:o.targetData,nodeShape:0,id:t,el_W:o.width,el_H:o.height,hidden:!1}}else return{x:o.offsetX,y:o.offsetY,targetType:B.CanvasPoint,targetData:o.targetData,nodeShape:0,id:t,el_W:o.width,el_H:o.height,hidden:!1}}}if(this.fakeLineTargetRender)return this.fakeLineTargetRender(e,t,n)}}class zn extends Xn{constructor(){super()}_updateOptions(i){i.instanceId||(i.instanceId=this.instanceId),console.log("[RelationGraphWith2Data] _updateOptions:",JSON.stringify(i),this.options);const e=Object.assign({},i);if(e.layouts)throw new Error("Graph options do not support setting layouts properties !");if(e.defaultPloyLineRadius&&(e.defaultPolyLineRadius=e.defaultPloyLineRadius),e.debug!==void 0){const t=e.debug===!0;t&&C("RGOptions:user instance options:",e),window&&(window.relationGraphDebug=t)}e.layout&&(Be(e.layout),Ge(e.layout,e)),this.dataProvider.updateOptions(e)}resetViewSize(i=!1){const e=this.getViewBoundingClientRect(),t={};t.viewSize={width:e.width,height:e.height},this._rgAsConnectArea?(t.canvasZoom=100,t.canvasOffset={x:0,y:0}):i&&(t.canvasZoom=100,t.canvasOffset={x:t.viewSize.width/2,y:t.viewSize.height/2}),this.dataProvider.updateOptions(t),C("resetViewSize:1:",t),this._dataUpdated()}loading(i=""){this.dataProvider.updateOptions({graphLoading:!0,graphLoadingText:i}),this._dataUpdated()}clearLoading(){this.dataProvider.updateOptions({graphLoading:!1,graphLoadingText:""}),this._dataUpdated()}setCheckedNode(i){console.log("setCheckedNode:",i),this.dataProvider.updateOptions({checkedNodeId:i?typeof i=="string"?i:i.id:""}),this._dataUpdated()}setCheckedLine(i){this.dataProvider.updateOptions({checkedLineId:i?typeof i=="string"?i:i.id:""})}clearChecked(){this.dataProvider.clearChecked(),this._dataUpdated()}clearSelected(){const i=this.getNodes().filter(n=>n.selected),e=this.getLines().filter(n=>n.selected),t=this.getFakeLines().filter(n=>n.selected);i.forEach(n=>this.dataProvider.updateNode(n.id,{selected:!1})),e.forEach(n=>this.dataProvider.updateLine(n.id,{selected:!1})),t.forEach(n=>this.dataProvider.updateFakeLine(n.id,{selected:!1})),this._dataUpdated()}setCanvasOffset(i,e){this.dataProvider.setCanvasOffset(i,e),this._updateEditingControllerView(),this.updateShouldRenderGraphData(),this._dataUpdated()}setCanvasMoveMode(i){this.dataProvider.updateOptions({canvasMoveMode:i}),this._dataUpdated()}onMiniViewMounted(){this.dataProvider.updateOptions({showMiniView:!0}),this._dataUpdated()}onMiniViewUnMounted(){this.dataProvider.updateOptions({showMiniView:!1})}onReferenceLineMounted(i){this.dataProvider.updateOptions({referenceLineAdsorption:i||!1,showReferenceLine:!0})}onReferenceLineUnMounted(){this.dataProvider.updateOptions({referenceLineAdsorption:!1,showReferenceLine:!1})}}class Gn extends zn{constructor(){super()}getCreatingLine(i){if(i||(i=this.getOptions()),!i.creatingLinePlot)return{creating:!1};const{line:e,from:t,to:n}=this.generateCreatingLineConfig();return{creating:!0,fromTarget:t,toTarget:n,lineJson:e}}getCreatingNode(i){return i||(i=this.getOptions()),i.creatingNodePlot?{creating:i.creatingNodePlot,nodeJson:i.newNodeTemplate}:{creating:!1}}}class Bn extends Gn{constructor(){super()}_getJunctionPoint(i,e){return i===j.border?Q.getBorderPoint4MultiLine(e):i===j.ltrb?Q.getRectJoinPoint(e):i===j.tb?Q.getRectVJoinPoint(e):i===j.lr?Q.getRectHJoinPoint(e):i===j.left?Q.getRectLeftJoinPoint(e):i===j.right?Q.getRectRightJoinPoint(e):i===j.top?Q.getRectTopJoinPoint(e):i===j.bottom?Q.getRectBottomJoinPoint(e):i==="horizontalLine"?Q.getRectHorizontalLineJoinPoint(e):i==="verticalLine"?Q.getRectVerticalLineLineJoinPoint(e):Q.getBorderPoint4MultiLine(e)}createLinePath(i,e,t){throw new Error("createLinePath() is deprecated, please use createLineDrawInfo() instead.")}createLineDrawInfo(i,e){let t,n,o=1,a=0;if(i&&(a=i.currentLineIndex,o=i.totalLinesBetweenNodes),i)t=i.fromNode,n=i.toNode;else{const r=e;if(t=this.getFakeLineTarget(r.fromType,r.from,r),n=this.getFakeLineTarget(r.toType,r.to,r),!t){console.error("Invalid line configuration:error from:",e);return}if(!n){console.error("Invalid line configuration:error to:",e);return}}return this.generateLinePath({line:e,from:t,to:n,totalLinesBetweenNodes:o,currentLineIndex:a})}generateLinePath(i){const e=this.getOptions();i.totalLinesBetweenNodes===void 0&&(i.totalLinesBetweenNodes=1),i.currentLineIndex===void 0&&(i.currentLineIndex=0),i.defaultOptions===void 0&&(i.defaultOptions={layoutDirection:e.layout.layoutDirection,multiLineDistance:e.multiLineDistance,defaultJunctionPoint:e.defaultJunctionPoint,lineRadius:e.defaultPolyLineRadius,defaultLineJunctionOffset:e.defaultLineJunctionOffset,defaultNodeShape:e.defaultNodeShape});try{const t=this.withLineJunctionPoints(i);return this.createLinePathData(t)}catch(t){if(t.rgError)return this.createErrorLineValue(t.errorCode,t.x,t.y);throw t}}throwLineError(i,e,t){return{rgError:!0,errorCode:i,x:e,y:t}}createErrorLineValue(i,e,t){const n={x:0,y:0,rotate:0},o=[{type:"M",x:0,y:0},{type:"l",dx:e,dy:t}];return{pathCommands:o,pathData:ge(o),textPosition:n,points:[]}}withLineJunctionPoints({line:i,from:e,to:t,totalLinesBetweenNodes:n,currentLineIndex:o,defaultOptions:a}){if(!e||!t)throw C("error from-to:",e,t),this.throwLineError("F",-10,0);let r=i.lineShape||1;const l=i.lineDirection||a.layoutDirection||"h";let c=e.x||0,d=e.y||0,h=t.x||0,u=t.y||0;if(Number.isNaN(c)||Number.isNaN(d))throw C("error start node:",e.text,e.x,e.y),this.throwLineError("A",-10,-10);if(Number.isNaN(h)||Number.isNaN(u))throw C("error end point:",t.text,t.x,t.y),this.throwLineError("B",10,-10);let y=e.el_W||60,f=e.el_H||60;if(Number.isNaN(y)||Number.isNaN(f))throw this.throwLineError("C",-10,10);let g=t.el_W||60,v=t.el_H||60;if(Number.isNaN(g)||Number.isNaN(v))throw this.throwLineError("D",10,10);if(c===0&&h===0&&d===0&&u===0)throw this.throwLineError("D",10,10);const p=h-c+(u-d)>0,m=i.isReverse?t:e,L=i.isReverse?e:t,_=we(m.nodeShape,a.defaultNodeShape),S=i.junctionOffset||a.defaultLineJunctionOffset||0;c-=S,d-=S,h-=S,u-=S,y+=S*2,f+=S*2,g+=S*2,v+=S*2;const b={from_x:c,from_y:d,to_x:h,to_y:u,f_W:y,f_H:f,t_W:g,t_H:v,nodeShape:_,isReverse:p,isEndPoint:!1,totalLinesBetweenNodes:n,currentLineIndex:o,lineDistance:a.multiLineDistance||50},O=we(L.nodeShape,a.defaultNodeShape),T={from_x:h,from_y:u,to_x:c,to_y:d,f_W:g,f_H:v,t_W:y,t_H:f,nodeShape:O,isReverse:p,isEndPoint:!0,totalLinesBetweenNodes:n,currentLineIndex:o,lineDistance:a.multiLineDistance||50},k=a.defaultJunctionPoint||j.border;let E=i.fromJunctionPoint||k,P=i.toJunctionPoint||k,M=i.fromJuctionPointOffsetX||0,w=i.fromJuctionPointOffsetY||0,A=i.toJuctionPointOffsetX||0,X=i.toJuctionPointOffsetY||0;i.isReverse&&([E,P]=[P,E],[M,w,A,X]=[A,X,M,w]),(e===t||c===0&&h===0&&d===0&&u===0)&&M===0&&w===0&&A===0&&X===0&&((r===Y.StandardStraight||r===Y.Curve2||r===Y.Curve3||r===Y.SimpleOrthogonal||r===Y.Curve5)&&(r=Y.StandardCurve),X=20);const z=this._getJunctionPoint(E,b);z.x+=M,z.y+=w;const F=this._getJunctionPoint(P,T);if(F.x+=A,F.y+=X,!z||!F)throw this.throwLineError("E",-20,-20);const D=c+y/2,U=d+f/2,q=h+g/2,ee=u+v/2;E==="horizontalLine"?(z.x=F.x,(r===44||r===49)&&(z.x+=(F.x>q?1:-1)*30)):E==="verticalLine"&&(z.y=F.y,(r===44||r===49)&&(z.y+=(F.y>ee?1:-1)*30)),P==="horizontalLine"?(F.x=z.x,(r===44||r===49)&&(F.x+=(z.x>D?1:-1)*30)):P==="verticalLine"&&(F.y=z.y,(r===44||r===49)&&(F.y+=(z.y>U?1:-1)*30));const K=z.x,se=z.y,oe=F.x,te=F.y;if(Number.isNaN(K)||Number.isNaN(se))throw C("error start point:",e.text),this.throwLineError("F",-10,0);if(Number.isNaN(oe)||Number.isNaN(te))throw C("error end point:",t.text),this.throwLineError("G",10,0);return{line:i,totalLinesBetweenNodes:n,currentLineIndex:o,lineDirection:l==="v"?"v":"h",lineShape:r,lineRadius:a.lineRadius||0,fromJunctionPoint:E,toJunctionPoint:P,fx:K,fy:se,fcx:D,fcy:U,f_W:y,f_H:f,tx:oe,ty:te,tcx:q,tcy:ee,t_W:g,t_H:v}}createLinePathData(i){const{lineShape:e}=i;let t;return e===Y.SimpleOrthogonal?t=vn(i,void 0,{lineRadius:i.lineRadius}):e===Y.StandardOrthogonal?t=Cn(i,void 0,{lineRadius:i.lineRadius}):e===Y.HardOrthogonal?t=Ln(i,void 0,{lineRadius:i.lineRadius}):e===Y.StandardCurve?t=wn(i):e===Y.Curve2||e===Y.Curve3||e===Y.Curve5||e===Y.Curve7||e===Y.Curve8?t=Nn(i):t=yn(i),t}getArrowMarkerId(i,e=!1){let t=i.showStartArrow===!0,n=i.showEndArrow!==!1;if(i.isReverse&&([t,n]=[n,t]),e){if(!t)return;if(i.startMarkerId)return`url('#${i.startMarkerId}')`}else{if(!n)return;if(i.endMarkerId)return`url('#${i.endMarkerId}')`}return`url('#${this.getLineArrow(i.color,e,!1)}')`}getLineArrow(i,e=!1,t=!1){const n=e?"start-":"";return`${this.getOptions().instanceId}-${n}arrow-default`}getTextTransform(i,e){if(!i||!e)return"translate(0,0)";const{x:t,y:n,rotate:o}=e;if(Number.isNaN(t)||Number.isNaN(n))return"translate(0,0)";const a=this.getOptions(),r=i.textOffset_x||a.defaultLineTextOffset_x||0,l=i.textOffset_y||a.defaultLineTextOffset_y||0,c=i.lineShape||1;return c===Y.StandardStraight||c===Y.SimpleOrthogonal?`translate(-50%, -50%) translate(${t+r}px,${n+l}px) rotate(${o||0}deg)`:`translate(-50%, -50%) translate(${t+r}px,${n+l}px)`}generateLineTextStyle(i,e){const t=this.getOptions(),n={transform:"",transformOrigin:""};if(!i||!e)return{cssStyles:n};const{line:o}=i,{textPosition:a}=e;if(!o||!a)return{cssStyles:n};let r=o.text||"";r.length>t.lineTextMaxLength&&(r=r.substring(0,t.lineTextMaxLength||15)+"...");const{x:l,y:c,rotate:d}=a;if(Number.isNaN(l)||Number.isNaN(c))return{text:r,cssStyles:n};const h=[],u=o.textAnchor||"center";u==="start"?h.push("translate(0%, -50%)"):u==="end"?h.push("translate(100%, -50%)"):h.push("translate(-50%, -50%)"),h.push(`translate(${l}px,${c}px)`);const y=o.textOffset_x||t.defaultLineTextOffset_x||0,f=o.textOffset_y||t.defaultLineTextOffset_y||0;return(o.lineShape||1)===Y.StandardStraight?(n.transformOrigin="50% 50%",h.push(`translate(${y}px,${f}px)`)):h.push(`translate(${y}px,${f}px)`),n.transform=h.join(" "),{text:r,cssStyles:n}}generateLineTextStyle4TextPath(i){const{line:e,from:t,to:n}=i;let o=e.text;if(!o||!n||!t)return null;let a=0;const r=t.x,l=t.y,c=n.x,d=n.y,h=this.getOptions();o.length>h.lineTextMaxLength&&(o=o.substring(0,h.lineTextMaxLength||15)+"...");const f=`translate(${0},${0})`;let g="middle";const v=e.lineShape||1;let p="50%";return v===Y.SimpleOrthogonal?e.onPathStartOffset==="start"?(p="10%",g="start"):e.onPathStartOffset==="end"?(p="90%",g="end"):e.onPathStartOffset?(p=e.onPathStartOffset,g="start"):h.layout.layoutDirection==="v"?p=String(Math.abs(c-r)+43):p=String(Math.abs(d-l)+43):e.onPathStartOffset==="start"?(p="10%",g="start"):e.onPathStartOffset==="end"?(p="90%",g="end"):e.onPathStartOffset?(p=e.onPathStartOffset,g="start"):(p="50%",g="middle"),e.textAnchor&&(g=e.textAnchor),{text:o,textOffset:f,textAnchor:g,onPathStartOffset:p,textRotate:a}}}class Fn extends Bn{constructor(){super()}zoom(i,e,t){if(this._rgAsConnectArea)return;const n=this.getOptions();try{const o=this.emitEvent(V.beforeZoomStart,n.canvasZoom,i,t);if(C("[zoom]","abortZoom:",o),o===!0)return;if(n.canvasZoom+i<n.minCanvasZoom){if(C("zoom:minCanvasZoom"),i=n.minCanvasZoom-n.canvasZoom,i===0)return}else if(n.canvasZoom+i>n.maxCanvasZoom&&(C("zoom:maxCanvasZoom"),i=n.maxCanvasZoom-n.canvasZoom,i===0))return;const a=i/100,r=this.getViewBoundingClientRect(),l=n.canvasZoom/100,c=Math.max(.01,Math.min(10,l+a));e||(e={x:r.x+r.width/2,y:r.y+r.height/2});const d=e.x-r.left,h=e.y-r.top,u=d-(d-n.canvasOffset.x)*(c/l),y=h-(h-n.canvasOffset.y)*(c/l),f=n.canvasZoom,g=c*100;this._performanceModeLogicHook(f,g),this.dataProvider.updateOptions({canvasOffset:{x:u,y},canvasZoom:g}),this.emitEvent(V.onZoomEnd,g,f)}finally{this._updateEditingControllerView(),this._dataUpdated()}}_performanceModeLogicHook(i,e){const t=this.getOptions();i<=40?e>40&&(t.performanceMode&&this.updateShouldRenderGraphData(!0),this.dataProvider.updateOptions({showEasyView:!1}),C("zoom:hide:showEasyView",i,e),this.updateElementLines()):i>40&&e<=40&&(C("zoom:show:showEasyView",i,e),t.performanceMode&&this.dataProvider.updateOptions({showEasyView:!0}))}setZoom(i,e){const t=this.getOptions(),n=Math.round(i-t.canvasZoom);this.zoom(n,e)}}class Yn extends Fn{constructor(){super()}fitContentHeight(i=20){this.dataProvider.updateOptions({canvasOpacity:.01}),this._dataUpdated();const e=this.getOptions(),t=this.getNodesRectBox(),n=t.height,o=t.width,a=e.viewSize.width-i*2,r=t.minX+t.width/2,l=t.minY+t.height/2;console.warn("[fitContentHeight]nodesCenter:",r,l),this.dataProvider.setCanvasCenter(r,l);const c=Math.min(1,a/o),d=n*c+i*2;this.dataProvider.updateOptions({viewSize:{...e.viewSize,height:d},viewHeight:d+"px"}),setTimeout(()=>{this.setZoom(c*100),this._moveToCenter(),this.dataProvider.updateOptions({canvasOpacity:1}),this._dataUpdated()},200)}_moveToCenter(i){const e=this.getNodesCenter(i);this.dataProvider.setCanvasCenter(e.x,e.y),this._dataUpdated()}setCanvasCenter(i,e){this.dataProvider.setCanvasCenter(i,e),this._dataUpdated()}zoomToFit(i){const e=this.getOptions(),t=this.getNodesRectBox(i),n=50,o=e.viewSize.width/(t.width+n*2),a=e.viewSize.height/(t.height+n*2),r=Math.min(o,a,1);C("zoomToFit:",{stuffSize:t,zoomPercent:r,zoomPercentX:o,zoomPercentY:a,viewSize:e.viewSize}),this._moveToCenter(i),this.setZoom(r*100),this._dataUpdated()}enableNodeXYAnimation(){this.dataProvider.updateOptions({enableNodeXYAnimation:!0}),this._dataUpdated()}disableNodeXYAnimation(){this.dataProvider.updateOptions({enableNodeXYAnimation:!1}),this._dataUpdated()}enableCanvasAnimation(){this.dataProvider.updateOptions({enableCanvasTransformAnimation:!0}),this._dataUpdated()}disableCanvasAnimation(){this.dataProvider.updateOptions({enableCanvasTransformAnimation:!1}),this._dataUpdated()}focusNodeById(i){const e=this.getNodeById(i);e&&this.focusNode(e)}focusRootNode(){throw new Error("focusRootNode is deprecated, please use focusNodeById instead.")}focusNode(i){C("checked:",i);const e=this.getOptions();this.setZoom(100);const t=i.width||50,n=i.height||50,o=i.x*-1+e.viewSize.width/2-t/2,a=i.y*-1+e.viewSize.height/2-n/2;this.dataProvider.setCanvasOffset(o,a),this.dataProvider.updateOptions({checkedNodeId:i.id})}}class Hn extends ue{constructor(e,t,n){super(e,t,n);N(this,"rotate",0);N(this,"enableGatherNodes",!1);N(this,"layoutOptions");this.layoutOptions=e,C("new RGTreeLayout:",this.layoutOptions),this.layoutOptions.from||(this.layoutOptions.from="left"),this.layoutOptions.levelGaps||(this.layoutOptions.levelGaps=[]);const o=this.layoutOptions.from;console.log("this.layoutOptions.alignItemsX:1:",this.layoutOptions.alignItemsX),o==="top"||o==="bottom"?(this.layoutOptions.treeNodeGapH||(this.layoutOptions.treeNodeGapH=10),this.layoutOptions.treeNodeGapV||(this.layoutOptions.treeNodeGapV=50)):(this.layoutOptions.treeNodeGapH||(this.layoutOptions.treeNodeGapH=50),this.layoutOptions.treeNodeGapV||(this.layoutOptions.treeNodeGapV=10)),o==="top"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="center"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="start"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.layoutOptions.alignItemsX),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.getReverseAlignItems(this.layoutOptions.alignItemsY))):(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="start"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="start"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.getReverseAlignItems(this.layoutOptions.alignItemsX)),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.layoutOptions.alignItemsY)),console.log("this.layoutOptions.alignItemsX:2:",this.layoutOptions.alignItemsX),this.layoutOptions.ignoreNodeSize===void 0&&(this.layoutOptions.ignoreNodeSize=!1);const a=this.layoutOptions.layoutExpansionDirection,r=a==="start"||a==="left"||a==="top"?"start":a==="end"||a==="right"||a==="bottom"?"end":"center";this.layoutOptions.layoutExpansionDirection=r,this.layoutOptions.treeNodeGapH<100&&(this.layoutOptions.treeNodeGapH=100),this.layoutOptions.treeNodeGapV<10&&(this.layoutOptions.treeNodeGapV=10),(this.layoutOptions.from==="bottom"||this.layoutOptions.from==="right")&&(this.rotate=180),this.layoutOptions.changeNodeSizeDuringLayout===void 0&&(this.layoutOptions.changeNodeSizeDuringLayout=!1)}placeNodes(e,t){if(console.log("tree:placeNodes:rootNode",t.id,t),C("RGTreeLayout:placeNodes"),t)C("layout by root:",t);else{console.error("root is null");return}C("allNodes:",e.length),this.layoutOptions.alignItemsX,this.layoutOptions.alignItemsY,this.layoutOptions.alignParentItemsX,this.layoutOptions.alignParentItemsY,this.rootNode=t,this.allNodes=e,t.fixed||this.layoutOptions.fixedRootNode||this.updateNodePosition(t,0,0),t.lot.x=t.x,t.lot.y=t.y;const n=e;C("groupNodes:2:",n.length,n.map(r=>r.text).join(","));const o=this.rotate;console.log("rotate:",o),this.networkAnalyzer.analyzeNetwork(n,this.rootNode,!1),this.placeNodesPosition(t,n);const a={x:t.x,y:t.y};this.allNodes.forEach(r=>{if(r.fixed!==!0&&!!G.isVisibleNode(r)&&(Number.isNaN(r.lot.x)&&(C("bad lot x:",r.text,r.lot.x),r.lot.x=0),Number.isNaN(r.lot.y)&&(C("bad lot y:",r.text,r.lot.y),r.lot.y=0),r!==t)){this.layoutOptions.from==="right"&&(r.lot.x=Q.getFlippedX(r.lot.x,a.x)),this.layoutOptions.from==="bottom"&&(r.lot.y=Q.getFlippedY(r.lot.y,a.y));const l=this.layoutOptions.from==="right"?G.getNodeXByLotX({alignItemsX:"end"},r):r.lot.x,c=this.layoutOptions.from==="bottom"?G.getNodeYByLotY({alignItemsY:"end"},r):r.lot.y;this.updateNodePosition(r,l,c)}});for(const r of this.allNodes)this.graphInstance.updateNode(r,{rgChildrenSize:r.lot.childs.length});C("create rootNode coordinates:1",t.x,t.y),this.layoutEnd()}placeNodesPosition(e,t){this.placeRelativePosition(e,t)}placeRelativePosition(e,t){e.lot.parent=void 0,e.lot.level=0;const n=[];this.buildNetwork([e],n,0);const o=Math.max(...n.map(c=>c.lot.level)),a=this.layoutOptions.from==="left"||this.layoutOptions.from==="right";this.reduceNodeRect(n,o,a),a?this.placeNodeChildrenH(n,0):this.placeNodeChildrenV(n,0);let r=e.lot.x-e.x,l=e.lot.y-e.y;this.layoutOptions.from==="right"&&(r+=e.lot.width),this.layoutOptions.from==="bottom"&&(l+=e.lot.height),n.forEach(c=>{c.fixed!==!0&&(c.lot.x-=r,c.lot.y-=l)}),console.log("levelMaxWidthMap:",e.id)}buildNetwork(e,t,n){n===0&&t.push(...e);const o=[];e.forEach(a=>{if(!G.isVisibleNode(a))return;const r=this.graphInstance.getNodeIncomingNodes(a).filter(G.isVisibleNode),c=this.graphInstance.getNodeOutgoingNodes(a).filter(G.isVisibleNode).filter(h=>!t.includes(h));t.push(...c);const d=r.filter(h=>!t.includes(h));t.push(...d),a.lot.level=n,a.lot.toNodes=c,a.lot.fromNodes=d;for(const h of d.concat(c))h.lot.parent=a,o.includes(h)||o.push(h)}),o.length>0&&this.buildNetwork(o,t,n+1)}reduceNodeRect(e,t,n=!1){let o=this.layoutOptions.treeNodeGapH,a=this.layoutOptions.treeNodeGapV;const r=o,l=a,c=e.filter(d=>d.lot.level===t);console.log("reduceNodeRect:level:",t,c.length);for(const d of c){if(!G.isVisibleNode(d))continue;let h=d.el_W||d.width||50,u=d.el_H||d.height||50;if(d.lot.width=h,d.lot.height=u,d.lot.toNodes.length===0&&d.lot.fromNodes.length===0)d.lot.width_with_childs=h,d.lot.height_with_childs=u;else if(n){let y=0,f=0;for(const p of d.lot.fromNodes)p.lot.height_with_childs>f&&(f=p.lot.height_with_childs),y+=p.lot.width_with_childs+l;let g=0,v=0;for(const p of d.lot.toNodes)p.lot.height_with_childs>v&&(v=p.lot.height_with_childs),g+=p.lot.width_with_childs+l;this.layoutOptions.changeNodeSizeDuringLayout&&(u=0),u=Math.max(f+r/2,u/2)+Math.max(v+r/2,u/2),d.lot.width_with_childs=h+Math.max(y,g)+l,d.lot.height_with_childs=u}else{let y=0,f=0;for(const p of d.lot.fromNodes)p.lot.width_with_childs>y&&(y=p.lot.width_with_childs),f+=p.lot.height_with_childs+l;let g=0,v=0;for(const p of d.lot.toNodes)p.lot.width_with_childs>g&&(g=p.lot.width_with_childs),v+=p.lot.height_with_childs+l;this.layoutOptions.changeNodeSizeDuringLayout&&(h=0),h=Math.max(y+r/2,h/2)+Math.max(g+r/2,h/2),d.lot.width_with_childs=h,d.lot.height_with_childs=u+Math.max(f,v)+l}}t>=0&&this.reduceNodeRect(e,t-1,n)}placeNodeChildrenV(e,t){const n=this.layoutOptions.treeNodeGapH,o=this.layoutOptions.treeNodeGapV,a=n,r=o;let l=0;const c=e.filter(d=>d.lot.level===t);console.log("placeNodeChildren:level:",t,c.length);for(const d of c){l++;let h=d.lot.width;this.layoutOptions.changeNodeSizeDuringLayout&&(h=0),t===0&&(d.lot.groupStartX=d.lot.x+h/2-d.lot.width_with_childs/2);const u=d.lot.groupStartX,y=d.lot.y;let f=0,g=0;for(const p of d.lot.fromNodes)p.lot.width_with_childs>f&&(f=p.lot.width_with_childs);for(const p of d.lot.toNodes)p.lot.width_with_childs>g&&(g=p.lot.width_with_childs);const v=u+Math.max(f+a/2,h/2);if(d.lot.fromNodes.length>0){let p=d.lot.height+r;for(const m of d.lot.fromNodes)m.lot.groupStartX=v-m.lot.width_with_childs-a/2,m.lot.y=y+p+r,p+=m.lot.height_with_childs+r}if(d.lot.toNodes.length>0){let p=d.lot.height+r;for(const m of d.lot.toNodes)m.lot.groupStartX=v+a/2,m.lot.y=y+p+r,p+=m.lot.height_with_childs+r}f>0||g>0?this.layoutOptions.changeNodeSizeDuringLayout?(d.lot.x=u,d.width=d.lot.width_with_childs):d.lot.x=v-d.lot.width/2:d.lot.x=u}l>0&&this.placeNodeChildrenV(e,t+1)}placeNodeChildrenH(e,t){const n=this.layoutOptions.treeNodeGapH,o=this.layoutOptions.treeNodeGapV,a=n,r=o;let l=0;const c=e.filter(d=>d.lot.level===t);console.log("placeNodeChildren:level:",t,c.length);for(const d of c){l++;let h=d.lot.height;this.layoutOptions.changeNodeSizeDuringLayout&&(h=0),t===0&&(d.lot.groupStartY=d.lot.y+h/2-d.lot.height_with_childs/2);const u=d.lot.groupStartY,y=d.lot.x;let f=0,g=0;for(const p of d.lot.fromNodes)p.lot.height_with_childs>f&&(f=p.lot.height_with_childs);for(const p of d.lot.toNodes)p.lot.height_with_childs>g&&(g=p.lot.height_with_childs);const v=u+Math.max(f+a/2,h/2);if(d.lot.fromNodes.length>0){let p=d.lot.width+r;for(const m of d.lot.fromNodes)m.lot.groupStartY=v-m.lot.height_with_childs-a/2,m.lot.x=y+p+r,p+=m.lot.width_with_childs+r}if(d.lot.toNodes.length>0){let p=d.lot.width+r;for(const m of d.lot.toNodes)m.lot.groupStartY=v+a/2,m.lot.x=y+p+r,p+=m.lot.width_with_childs+r}f>0||g>0?this.layoutOptions.changeNodeSizeDuringLayout?(d.lot.y=u,d.height=d.lot.height_with_childs):d.lot.y=v-d.lot.height/2:d.lot.y=u}l>0&&this.placeNodeChildrenH(e,t+1)}getLevelDistance(e,t,n){if(e===0)return 0;if(e>0){let o=0;for(let a=0;a<e;a++){const r=t.get(a);o+=r+this.getLevelGap(a,n,r,e)}return o}else{let o=0;for(let a=0;a>e;a--){const r=t.get(a);o+=r+this.getLevelGap(a,n,r,e)}return-o}}getLevelGap(e,t,n,o){let a=t+(o===-1&&e===0?n/2:0);if(this.layoutOptions.levelGaps.length>0){const r=this.layoutOptions.levelGaps[Math.abs(e)];r&&(a=r)}return a}}class Wn extends Yn{constructor(){super();N(this,"layoutor")}async doLayout(e){const t=Date.now()-this.prevAddNodeTimestamp;t<300&&(this.dataProvider.updateOptions({canvasOpacity:.01}),this._dataUpdated(),await Ae(300-t)),await this._doLayout(e),this.dataProvider.updateOptions({canvasOpacity:1}),this._dataUpdated()}async _doLayout(e){this.updateNodesVisibleProperty();const t=this.getNodes();C("node size\uFF1A",t.length);let n=this.dataProvider.getRootNode();if(e&&(n=typeof e=="string"?this.getNodeById(e):e,!n))throw new Error("custom rootNode not found, id:"+e);n||(n=t[0],this._rgAsConnectArea||(C("[relation-graph]No root node, use first node as root:",n),C("[relation-graph]You can set rootNode call doLayout(rootNode | nodeId) with a node id")));const o=this.getOptions();this.dataProvider.setRootNodeId(n?n.id:""),this.stopAutoLayout();const a=this.createLayout(o.layout,!0);if(a.layoutOptions.layoutName==="force")a.isMainLayouer=!0,a.onFinish(()=>{this.emitEvent(V.onForceLayoutFinish)}),await Ae(100),C("doLayout:start force:",t.length),a.placeNodes(t,n);else{this.enableNodeXYAnimation();let r=[];n&&(r=this.getNetworkNodesByNode(n),a.placeNodes(r,n)),C("doLayout:placeOtherNodes:all:",t.length,"mainGroupNodes:",r.length),this.placeOtherNodes(r),setTimeout(()=>{this.disableNodeXYAnimation()},300),C("doLayout:placeOtherNodes ok!")}t.forEach(r=>this.dataProvider.updateNode(r.id,{x:r.x||0,y:r.y||0,rgChildrenSize:r.rgChildrenSize||0})),this.updateElementLines()}async refresh(e=!0){this.resetViewSize(!0),this._dataUpdated(),e&&await this.doLayout(),this.updateElementLines(),this._dataUpdated()}placeOtherNodes(e=[]){const t=this.getOptions();if(t.layout.layoutName==="fixed"||!t.placeOtherGroup)return;const o=[],a=[],r=this.getNodes();r.forEach(c=>{if(c.fixed===!0||e.includes(c))return;this.getNodeRelatedNodes(c).length===0?a.push(c):o.push(c)}),C("doLayout:allNodes:",r.length),C("doLayout:mainGroupNodes:",e.length),C("doLayout:notInMainGroupNodes:",o.length),C("doLayout:singleNodes:",a.length);const l=[{nodes:e}];this.placeNextNetwork(o,[...e],l),this.placeSingleNodes(a),l.push({nodes:a}),this.sortGroups(l),this._dataUpdated()}placeSingleNodes(e){if(e.length>0){const t=Math.ceil(Math.sqrt(e.length));yt(t,30,e.map(o=>({width:o.el_W,height:o.el_H,node:o})),(o,a,r)=>{const l=o.node;l.x=a,l.y=r,l.lot||(l.lot={childs:[]})}),C("[placeSingleNodes]Single nodes:",e.length)}}sortGroups(e){C("[placeSingleNodes]sortGroups groupList:",e.length,e.map(a=>a.nodes.length));const t=e.map(a=>{const r=this.getNodesRectBox(a.nodes);return{width:r.width,height:r.height,nodes:a.nodes,orignX:r.minX,orignY:r.minY}});if(t.length===0)return;const n=Math.floor(Math.sqrt(t.length))||1;yt(n,100,t,(a,r,l)=>{const c=r-a.orignX,d=l-a.orignY;C(`[placeNextNetwork]Move ${a.nodes.length} Nodes :`,c,d,a," > ");for(const h of a.nodes)this.updateNodePosition(h,h.x+c,h.y+d)},t[0].orignX,t[0].orignY)}placeNextNetwork(e,t,n){if(e.length>0){const o=this.getOptions();C("[placeNextNetwork]notPlacedNodes nodes:",e.length);const a=JSON.parse(JSON.stringify(o.layout)),r=e[0],l=this.createLayout(a);if(l.isMainLayouer=!1,C("[placeNextNetwork]layoutName:",l.layoutOptions.layoutName,"root:",r.text),l.layoutOptions.layoutName==="force"){const h=l;h.maxLayoutTimes=0}r.fixed?C("[placeNextNetwork]fixed root x,y:",r.x,r.y,r.text):(this.updateNodePosition(r,0,0),C("[placeNextNetwork]set root x,y:",r.x,r.y,r.text)),l.layoutOptions.fixedRootNode=!0;const c=this.getNetworkNodesByNode(r);C("[placeNextNetwork]thisNetworkNodes:",e.length),l.requireLinks&&l.setLinks(this.getLinks()),l.placeNodes(c,r),t.push(...c),n.push({nodes:c});const d=[];e.forEach(h=>{t.includes(h)||d.push(h)}),o.placeOtherGroup&&this.placeNextNetwork(d,t,n),this._dataUpdated()}else C("[placeOtherGroup]thisGroupNodes:all is OK!")}toggleAutoLayout(){const e=this.getOptions();C("toggleAutoLayout:to:",e.layout.autoLayouting),e.layout.autoLayouting?this.stopAutoLayout():this.startAutoLayout()}startAutoLayout(){var t;this.getOptions().layout.supportAutoLayout&&(t=this.layoutor)!=null&&t.start&&(C("Start force layout:"+this.layoutor.instanceId),this.layoutor.start())}stopAutoLayout(){var t;this.getOptions().layout.supportAutoLayout&&(t=this.layoutor)!=null&&t.stop&&(C("Stop force layout:"+this.layoutor.instanceId),this.layoutor.stop())}createLayout(e,t=!1){console.error("########createLayout:",e);const n=this.getOptions();Be(e);let o=null;if(e.layoutName==="tree"?o=new vt(e,n,this):e.layoutName==="center"?o=new mt(e,n,this):e.layoutName==="circle"?o=new xt(e,n,this):e.layoutName==="force"?o=new Se(e,n,this):e.layoutName==="fixed"?o=new Ct(e,n,this):e.layoutName==="smart-tree"?o=new gn(e,n,this):e.layoutName==="io-tree"?o=new Hn(e,n,this):e.layoutName==="folder"&&(o=new Lt(e,n,this)),!o)throw new Error("unknown layout: "+e.layoutName);return o.requireLinks&&o.setLinks(this.getLinks()),o.isMainLayouer=t,o.layoutOptions.fixedRootNode=!0,t&&(this.layoutor=o,this.dataProvider.updateOptions({layout:{...n.layout,supportAutoLayout:o.autoLayout!==void 0}})),o}}const $n=async(s,i)=>{const e=s||document.documentElement;i?await Un(e):await qn()},Un=async s=>{s.requestFullscreen?await s.requestFullscreen():s.mozRequestFullScreen?await s.mozRequestFullScreen():s.webkitRequestFullscreen?await s.webkitRequestFullscreen():s.msRequestFullscreen&&await s.msRequestFullscreen()},qn=async()=>{document.exitFullscreen?await document.exitFullscreen():document.mozCancelFullScreen?await document.mozCancelFullScreen():document.webkitExitFullscreen?await document.webkitExitFullscreen():document.msExitFullscreen&&await document.msExitFullscreen()};class jn extends Wn{constructor(){super();N(this,"_prevClickNodeTime",0);N(this,"_nodeXYMappingBeforeDrag",{});N(this,"canvasAutoMoving",e=>{const t=this.getOptions(),n=t.viewSize,o=40;let a=0,r=0;e.x<o?a=o-e.x:n.width-o<e.x&&(a=n.width-o-e.x),e.y<o?r=o-e.y:n.height-o<e.y&&(r=n.height-o-e.y);const l=a!==0||r!==0;l&&(a=Math.max(Math.min(a/5,30),-30),r=Math.max(Math.min(r/5,30),-30));const c=t.canvasOffset.x+a,d=t.canvasOffset.y+r;return this.onCanvasDragging(c,d,a,r),l});N(this,"_canvasMovingTimer");N(this,"_relayoutTaskTimer");N(this,"_onMovingWhenCreatingLine");N(this,"_step1EventTime",0);N(this,"_onCreateLineCallback");N(this,"_mouseWheelTimer");N(this,"_mouseWheelEventPrevApplyTime",0);N(this,"_mouseWheelForce",{x:0,y:0});N(this,"_fullscreenchangeHandler")}onNodeClick(e,t){if(Date.now()-this._prevClickNodeTime<200){C("[node]click abort : time < 200");return}this._prevClickNodeTime=Date.now();const n=this.getOptions();if(n.creatingLinePlot){this.onNodeClickWhenCreatingLinePlot(e);return}const o=e.disablePointEvent===void 0?n.disableNodePointEvent:e.disablePointEvent;C("[node]node click",e.text,n.creatingLinePlot,o),!t.shiftKey&&!o&&(n.checkedLineId="",this.dataProvider.updateOptions({checkedLineId:"",checkedNodeId:e.id})),this.emitEvent(V.onNodeClick,e,t),this._prevClickNodeTime=Date.now()}onNodeDragStart(e,t){if(!e||Ce(t))return;const n=this.getOptions();if((e.disableDrag||n.disableDragNode)&&!(t.target&&t.target.closest(".rg-node-drag-handler"))){const g=v=>{this.onNodeClick(e,v),document.body.removeEventListener("mouseup",g)};document.body.addEventListener("mouseup",g);return}isNaN(e.x)&&(e.x=0),isNaN(e.y)&&(e.y=0),this.dataProvider.setEditingLine(null),this.dataProvider.updateOptions({checkedLineId:""});let a=!1;const r=(f,g,v)=>{v.stopPropagation(),a=!0,this._canvasMovingTimer&&cancelAnimationFrame(this._canvasMovingTimer),this.dataProvider.updateOptions({draggingNodeId:"",editingReferenceLine:{...n.editingReferenceLine,show:!1}}),this._onNodeDragEnd(e,f,g,v),d?this.emitEvent(V.onNodeDragEnd,e,v,f,g):this.onNodeClick(e,t),this._dataUpdated()};this._nodeXYMappingBeforeDrag={},this._nodeXYMappingBeforeDrag[e.id]={x:e.x,y:e.y};for(const f of n.editingController.nodes)this._nodeXYMappingBeforeDrag[f.id]={x:f.x,y:f.y};const l=this.getCanvasXyByViewXy(this.getViewXyByEvent(t)),c={x:e.x,y:e.y};let d=!1;this._canvasMovingTimer&&cancelAnimationFrame(this._canvasMovingTimer);let h;const u=()=>{if(!h||a)return;const f=this.getViewXyByEvent(h),g=this.getCanvasXyByViewXy(f),v=g.x-l.x,p=g.y-l.y;let m=v+c.x,L=p+c.y,_=m-c.x,S=L-c.y;const b=this.emitEvent(V.onNodeDragging,e,m,L,_,S,h);b&&(typeof b.x=="number"&&(m=b.x,_=m-c.x),typeof b.y=="number"&&(L=b.y,S=L-c.y)),this.canvasAutoMoving(f),this.draggingSelectedNodes(e,m,L,_,S),this._dataUpdated()},y=()=>{u(),this._canvasMovingTimer=requestAnimationFrame(y)};Z.startDrag(t,c,r,(f,g,v,p,m)=>{d?h=m:Math.abs(f)+Math.abs(g)>4&&(C("[node]onNodeDragStart...",de(h),h),this.emitEvent(V.onNodeDragStart,e,h),d=!0,this.dataProvider.updateOptions({draggingNodeId:e.id}),this._canvasMovingTimer=requestAnimationFrame(y)),this.updateElementLines(),this._dataUpdated()})}_onNodeDragEnd(e,t,n,o){this.updateElementLines()}onLineClick(e,t,n){t||(t=this.getLinkByLineId(e.id)),C("onLineClick:","line:",e,"link:",t);const o=this.getOptions();(e.disablePointEvent===void 0?o.disableLinePointEvent:e.disablePointEvent)||(this.setCheckedNode(""),this.setCheckedLine(e)),this.emitEvent(V.onLineClick,e,t,n),this._dataUpdated()}expandOrCollapseNode(e,t){t.stopPropagation(),e.expanded===!1?this.expandNode(e,t):this.collapseNode(e,t)}expandNode(e,t){C("onNodeExpand:",e),this.dataProvider.updateNode(e.id,{expanded:!0}),this.emitEvent(V.onNodeExpand,e,t),this._effectWhenExpandedOrCollapsed(e)}collapseNode(e,t){C("onNodeCollapse:",e),this.dataProvider.updateNode(e.id,{expanded:!1}),this.emitEvent(V.onNodeCollapse,e,t),this._effectWhenExpandedOrCollapsed(e)}_effectWhenExpandedOrCollapsed(e){this._relayoutTaskTimer&&clearTimeout(this._relayoutTaskTimer),this._relayoutTaskTimer=setTimeout(()=>{const t=this.getDescendantNodes(e);this.updateNodesVisibleProperty([e].concat(t)),this.updateElementLines(),this._dataUpdated();const n=this.getOptions();n.reLayoutWhenExpandedOrCollapsed&&(n.layout.layoutName==="force"?this.startAutoLayout():this.doLayout())},100)}onCanvasDragEnd(e){this._updateEditingControllerView(),this.updateShouldRenderGraphData(),this._dataUpdated(),this.emitEvent(V.onCanvasDragEnd,e)}onCanvasClick(e){if(this.getOptions().creatingLinePlot)this.onCanvasClickWhenCreatingLinePlot(e);else{if(this.dataProvider.isPerformanceMode()){const n=this.getNodeAtEvent(e);if(n){this.emitEvent(V.onNodeClick,n,e);return}}this.emitEvent(V.onCanvasClick,e)}}getNodeAtEvent(e){const t=this.getCanvasXyByClientXy(e);return this.dataProvider.findNodeByXy(t)}onCanvasSelectionEnd(e,t){this.emitEvent(V.onCanvasSelectionEnd,e,t),C("[canvas]onCanvasSelectionEnd:",e),this._dataUpdated()}startCreatingNodePlot(e,t){if(!t)throw new Error("startCreatingNodePlot need setting param");if(!t.onCreateNode)throw new Error("startCreatingNodePlot need setting.onCreateNode param as callback");const n=Ne(JSON.parse(JSON.stringify(ze)),this.getOptions()),o=de(e);this.dataProvider.updateOptions({newNodeTemplate:Object.assign({},n,t.templateNode),creatingNodePlot:!0,showTemplateNode:!o});let a=(f,g)=>{const v=this.getOptions().newNodeTemplate,p={width:v.width||96,height:v.height||96};this.dataProvider.updateOptions({newNodeTemplate:{...v,x:f-p.width/2,y:g-p.height/2}}),this._dataUpdated()};const r=this.getViewBoundingClientRect();C("[CreatingNodePlot]startCreatingNodePlot:");const l=me(e),c=l.clientX-r.x+10,d=l.clientY-r.y+10;o||a(c,d);const h=f=>{C("[CreatingNodePlot]objectTemplateMove");const g=this.getViewXyByEvent(f);t.templateMove&&t.templateMove(g.x,g.y),a(g.x,g.y)},u=f=>{C("[CreatingNodePlot]user abort!"),this.$dom.removeEventListener("mousemove",h),this.$dom.removeEventListener("click",y),this.$dom.removeEventListener("contextmenu",u),this.dataProvider.updateOptions({creatingNodePlot:!1})},y=f=>{let g=!1;if(this.getOptions().creatingNodePlot||(g=!0),this.$dom.removeEventListener("mousemove",h),this.$dom.removeEventListener("click",y),this.$dom.removeEventListener("contextmenu",u),this.dataProvider.updateOptions({creatingNodePlot:!1}),g){C("[CreatingNodePlot]action be abort!");return}const v=me(f),p=v.clientX-r.x+10,m=v.clientY-r.y+10;if(Math.abs(c-p)<30&&Math.abs(d-m)<30){C("[CreatingNodePlot]create node be abort!");return}const L=this.getCanvasXyByClientXy({x:v.clientX,y:v.clientY});C("[CreatingNodePlot]objectBePlaced:",L),t.onCreateNode(L.x,L.y,this.getOptions().newNodeTemplate),this._dataUpdated()};setTimeout(()=>{this.$dom.addEventListener("click",y),this.$dom.addEventListener("contextmenu",u)},300),o||this.$dom.addEventListener("mousemove",h)}startCreatingLinePlot(e,t){const n=de(e);t&&t.onCreateLine&&(this._onCreateLineCallback=t.onCreateLine);const o=fe({from:"newRelationTemplate-from",to:"newRelationTemplate-to",color:"",text:"new line"},this.getOptions());t&&t.template&&Object.assign(o,t.template),this.dataProvider.updateOptions({newLineTemplate:Object.assign(o,{isReverse:t.isReverse||!1})}),this.dataProvider.updateOptions({newLineTemplate:Object.assign(o,{isReverse:t.isReverse||!1,disablePointEvent:!0}),creatingLinePlot:!0});const a=Object.assign({},this.getOptions().newLinkTemplate,{fromNode:null,toNode:{id:"",targetType:B.Node,x:0,y:0,el_W:2,el_H:2},toNodeObject:null});t&&t.fromNode&&(a.toNode.x=t.fromNode.x+50,a.toNode.y=t.fromNode.y+50,a.fromNode=t.fromNode,this._step1EventTime=Date.now()),this.dataProvider.updateOptions({newLinkTemplate:a}),C("[CreatingLinePlot]startCreatingLinePlot:isTouchEvent:",n),n||(C("[CreatingLinePlot]Listener move"),this._onMovingWhenCreatingLine&&this.$dom.removeEventListener("mousemove",this._onMovingWhenCreatingLine),this._onMovingWhenCreatingLine=this.onMovingWhenCreatingLinePlot.bind(this),this.$dom.addEventListener("mousemove",this._onMovingWhenCreatingLine)),this._dataUpdated()}stopCreatingLinePlot(){C("[CreatingLinePlot]stop CreatingLinePlot!"),this.dataProvider.updateOptions({creatingLinePlot:!1,newLinkTemplate:{...this.getOptions().newLinkTemplate,fromNode:null,toNodeObject:null},nodeConnectController:{...this.getOptions().nodeConnectController,show:!1}}),this._onCreateLineCallback=void 0,this.$dom.removeEventListener("mousemove",this._onMovingWhenCreatingLine),this._onMovingWhenCreatingLine=void 0,this._dataUpdated()}onMovingWhenCreatingLinePlot(e){C("[CreatingLinePlot]mousemove");const t=this.getCanvasXyByClientXy({x:e.clientX,y:e.clientY}),n=this.getOptions(),o=e.target;let a="",r=B.Node;const l=this.isNode(o);let c=!1,d={x:0,y:0,el_W:5,el_H:5,nodeShape:0};l&&(a=l.id,l===this.getOptions().newLinkTemplate.fromNode?this.dataProvider.updateOptions({nodeConnectController:{...this.getOptions().nodeConnectController,show:!1}}):(this.dataProvider.updateOptions({nodeConnectController:{...this.getOptions().nodeConnectController,node:l,show:!0}}),this._updateEditingConnectControllerView()));const h=o.closest(".rg-connect-ctl-handler");if(h){let u=this.getOptions().nodeConnectController.node;C("[CreatingLinePlot]content point:",h.dataset.point);let y=h.dataset.point||"border";if(h.classList.contains("rg-connect-target")){const{width:f,height:g,x:v,y:p}=h.getBoundingClientRect(),m=this.getCanvasXyByClientXy({x:v,y:p}),L=this.dataProvider.getCanvasScale(),_={x:m.x,y:m.y,el_W:f/L,el_H:g/L,nodeShape:1,id:h.dataset.targetId,targetData:JSON.parse(h.dataset.targetData||"{}"),targetType:h.dataset.targetType};c=!0,d.x=_.x,d.y=_.y,d.el_W=_.el_W,d.el_H=_.el_H,d.nodeShape=_.nodeShape,console.log("[CreatingLinePlot]fakeNode:",JSON.stringify(_)),this.dataProvider.updateOptions({nodeConnectController:{...this.getOptions().nodeConnectController,node:_,show:!1}}),y=h.dataset.point,n.newLinkTemplate.toNode&&(a=_.id,r=_.targetType,this.dataProvider.updateOptions({newLinkTemplate:{...this.getOptions().newLinkTemplate,toNode:{...this.getOptions().newLinkTemplate.toNode,nodeShape:_.nodeShape}}})),this._updateEditingConnectControllerView()}else u&&(r=B.Node,c=!0,d.x=u.x,d.y=u.y,d.el_W=u.el_W,d.el_H=u.el_H,d.nodeShape=u.nodeShape,o.dataset.innode==="true"&&(d.x=t.x,d.y=t.y,d.el_W=2,d.el_H=2,d.nodeShape=1));n.newLineTemplate.isReverse?this.dataProvider.updateOptions({newLineTemplate:{...this.getOptions().newLineTemplate,fromJunctionPoint:y}}):this.dataProvider.updateOptions({newLineTemplate:{...this.getOptions().newLineTemplate,toJunctionPoint:y}})}else C("[CreatingLinePlot]point:",o.dataset.point),n.newLineTemplate.isReverse?this.dataProvider.updateOptions({newLineTemplate:{...this.getOptions().newLineTemplate,fromJunctionPoint:j.border}}):this.dataProvider.updateOptions({newLineTemplate:{...this.getOptions().newLineTemplate,toJunctionPoint:j.border}}),n.newLinkTemplate.toNode&&(r=B.Node);n.newLinkTemplate.toNode&&(a&&this.dataProvider.updateOptions({newLinkTemplate:{...this.getOptions().newLinkTemplate,toNode:{...this.getOptions().newLinkTemplate.toNode,id:a}}}),this.dataProvider.updateOptions({newLinkTemplate:{...this.getOptions().newLinkTemplate,toNode:{...this.getOptions().newLinkTemplate.toNode,targetType:r}}})),n.newLinkTemplate.fromNode&&this.dataProvider.updateOptions({newLinkTemplate:{...this.getOptions().newLinkTemplate,toNode:{...this.getOptions().newLinkTemplate.toNode,x:c?d.x:t.x,y:c?d.y:t.y,el_W:d.el_W,el_H:d.el_H,nodeShape:d.nodeShape}}}),this._dataUpdated()}onCanvasClickWhenCreatingLinePlot(e){if(Date.now()-this._step1EventTime<500){C("[CreatingLinePlot]step1EventTime:",this._step1EventTime);return}const t=this.getOptions();if(!t.newLinkTemplate.fromNode){C("[CreatingLinePlot]CreatingLinePlot:fromNode not set!");return}let n=!1;if(!t.newLinkTemplate.toNodeObject){C("[CreatingLinePlot]CreatingLinePlot:toNodeObject not set!");const o=me(e),a=this.getCanvasXyByClientXy({x:o.clientX,y:o.clientY});n=this.onReadyToCreateLine(t.newLinkTemplate.fromNode,a)}n!==!0&&this.stopCreatingLinePlot()}onNodeClickWhenCreatingLinePlot(e){const t=this.getOptions();t.newLinkTemplate.fromNode?(C("[CreatingLinePlot]step 2: set toNodeObjecct:",t.newLinkTemplate.fromNode,e),this.dataProvider.updateOptions({newLinkTemplate:{...t.newLinkTemplate,toNodeObject:e}}),this.onReadyToCreateLine(t.newLinkTemplate.fromNode,e)!==!0&&this.stopCreatingLinePlot()):(C("[CreatingLinePlot]step 1: set fromNode:",e),this.dataProvider.updateOptions({newLinkTemplate:{...t.newLinkTemplate,fromNode:e,toNode:{...t.newLinkTemplate.toNode,x:e.x+50,y:e.y+50}}}),this._step1EventTime=Date.now())}onReadyToCreateLine(e,t){C("[CreatingLinePlot][fire-event]onCreateLine:",e,t);const n=this.getOptions(),o=fe(n.newLineTemplate,this.getOptions());n.newLineTemplate.isReverse?(o.from=t?t.id:"",o.to=e?e.id:"",o.isReverse=void 0,[e,t]=[t,e]):(o.from=e?e.id:"",o.to=t?t.id:""),o.disablePointEvent=!1;const a=this.emitEvent(V.beforeCreateLine,{lineJson:o,fromNode:e,toNode:t});if(C("[CreatingLinePlot]onCreateLine:abort-flag:",a),a===!0){C("[CreatingLinePlot]onCreateLine:abort!");return}if(this._onCreateLineCallback){C("[CreatingLinePlot]onCreateLine:callback");try{this._onCreateLineCallback(e,t,o)}catch(l){return console.warn("[Custom Reject Connect By Throw Error:",l),!1}}return C("[CreatingLinePlot]onCreateLine:emitEvent"),this.emitEvent(V.onLineBeCreated,{lineJson:o,fromNode:e,toNode:t})}onContextmenu(e){e.stopPropagation(),e.preventDefault(),this.stopCreatingLinePlot();let t="canvas",n=this.isNode(e.target);n?t="node":(n=this.isLine(e.target),n&&(t="line")),C("contextmenu:objectType",t,n);const o=me(e),a=this.getCanvasXyByClientXy({x:o.clientX,y:o.clientY}),r=this.getViewXyByCanvasXy(a);this.emitEvent(V.onContextmenu,e,t,n,a,r)}async fullscreen(e){const t=this.getOptions();if(e!==void 0&&e===t.fullscreen)return;C("fullscreen:newValue:",e),console.log("fullscreen:newValue:",e),e===void 0&&(e=!t.fullscreen);let n=this.$dom;t.fullscreenElementXPath&&(n=document.querySelector(t.fullscreenElementXPath)||this.$dom),await $n(n,e),this.dataProvider.updateOptions({fullscreen:e}),this.emitEvent(V.onFullscreen,e),this._dataUpdated()}onMouseWheel(e){const t=this.getOptions();if(!e.ctrlKey&&!e.metaKey&&(t.disableWheelEvent||t.wheelEventAction==="none"))return!0;try{e.preventDefault(),e.stopPropagation()}catch{}let{deltaX:n,deltaY:o,deltaMode:a}=e;a===1?(n*=40,o*=40):a===2&&(n*=800,o*=800),this._mouseWheelForce.x+=n,this._mouseWheelForce.y+=o,this._applyWheelEvent(e)}_applyWheelEvent(e){clearTimeout(this._mouseWheelTimer),this._mouseWheelTimer=setTimeout(()=>{const t=this._mouseWheelForce.x,n=this._mouseWheelForce.y;this._onMouseWheel(e,t,n),this._mouseWheelForce.x-=t,this._mouseWheelForce.y-=n,this._mouseWheelEventPrevApplyTime=Date.now(),(Math.abs(this._mouseWheelForce.x)>1||Math.abs(this._mouseWheelForce.y)>1)&&this._applyWheelEvent(e)},Date.now()-this._mouseWheelEventPrevApplyTime>50?0:50)}_onMouseWheel(e,t,n){const o=e.ctrlKey||e.metaKey,a=this.getOptions();if(!o&&a.wheelEventAction==="scroll"){let r=Math.max(Math.abs(t),Math.abs(n));const l=t/r,c=n/r;r>200&&(r=200);const d=a.mouseWheelSpeed/10*-l*r,h=a.mouseWheelSpeed/10*-c*r,u=this.emitEvent(V.beforeScrollStart,d,h,e);if(C("[scroll]","abortScroll:",u),u===!0)return;this.scrollView(d,h)}else if(!(!o&&a.wheelEventAction==="none")){const r={x:e.clientX,y:e.clientY};let l=a.mouseWheelSpeed/20*-n;l=Math.max(Math.min(l,20),-20),this.zoom(l,r,e)}}scrollView(e,t){const n=this.getOptions();this.dataProvider.setCanvasOffset(n.canvasOffset.x+e,n.canvasOffset.y+t),this._updateEditingControllerView(),this.updateShouldRenderGraphData(),this._dataUpdated()}onLineDragStart(e,t){C("onLineDragStart...");const n=this.getLinkByLine(e),o={x:n.fromNode.x,y:n.fromNode.y},a={x:n.toNode.x,y:n.toNode.y},r=(l,c,d,h,u)=>{const y=this.dataProvider.getCanvasScale();n.fromNode.x=o.x+l/y,n.fromNode.y=o.y+c/y,n.toNode.x=a.x+l/y,n.toNode.y=a.y+c/y,this._updateEditingControllerView(),this._dataUpdated()};Z.startDrag(t,{x:0,y:0},(...l)=>{this.onLineDragEnd(...l)},r)}onLineDragEnd(e,t,n){C("onLineDragEnd"),this.updateElementLines()}onCanvasDragStart(e){if(Ce(e)||e.target&&e.target.closest(".rg-line-peel"))return;const t=this.getOptions();if(this.dataProvider.isPerformanceMode()&&t.editingController.nodes.length>0){const n=this.getNodeAtEvent(e);if(n){this.onNodeDragStart(n,e);return}}if(t.dragEventAction==="none"){this.onCanvasClick(e);return}if(t.dragEventAction==="selection"||e.shiftKey){this.startCreateSelection(e);return}if(!t.disableDragLine){const n=this.isLine(e.target);if(n){this.onLineDragStart(n,e);return}}this.startMoveCanvas(e)}startMoveCanvas(e,t=!1){let n;if(de(e)){let l,c=1;n=(d,h,u,y,f)=>{const g=f.touches||f.targetTouches,v=g[0];if(g&&g.length>1){f.preventDefault();const p=g[1],m=this.getOptions();l||(l={x:p.clientX,y:p.clientY},c=m.canvasZoom);const L={x:v.clientX,y:v.clientY},_={x:p.clientX,y:p.clientY},S=Math.hypot(l.x-y.x,l.y-y.y),O=Math.hypot(_.x-L.x,_.y-L.y)/S,T=m.mouseWheelSpeed*O,k=c*T;this.setZoom(k,y),this._dataUpdated()}else{const p=v.clientX,m=v.clientY,L=p-y.x,_=m-y.y,S=u.x+L,b=u.y+_;this.onCanvasDragging(S,b,_,L),this._updateEditingControllerView(),this._dataUpdated()}}}else n=(l,c,d,h,u)=>{const y=d.x+l,f=d.y+c;this.onCanvasDragging(y,f,l,c),this._updateEditingControllerView(),this._dataUpdated()};const o=this.getOptions(),a={x:o.canvasOffset.x,y:o.canvasOffset.y};let r=t;Z.startDrag(e,a,(l,c,d)=>{this.onCanvasDragStop(l,c,d)},(l,c,d,h,u)=>{r?n(l,c,d,h,u):Math.abs(l)+Math.abs(c)>4&&(this.emitEvent(V.onCanvasDragStart,d,h,u),r=!0)})}onCanvasDragging(e,t,n,o){const a=this.emitEvent(V.onCanvasDragging,e,t,n,o);a!==!1&&(a&&(typeof a.x=="number"&&(e=a.x),typeof a.y=="number"&&(t=a.y)),this.dataProvider.setCanvasOffset(e,t))}onCanvasDragStop(e,t,n){const o=this.getOptions();if(o.creatingSelection){this.dataProvider.updateOptions({creatingSelection:!1}),this.onCanvasSelectionEnd(o.selectionView,n);return}if(Math.abs(e)+Math.abs(t)<4){C("[canvas]onDragEnd as click2"),this._dataUpdated(),this.onCanvasClick(n);return}else C("[canvas]onDragEnd"),this.onCanvasDragEnd(n)}startCreateSelection(e){const t=()=>{if(!n||a)return;const d=this.getViewXyByEvent(n);this.canvasAutoMoving(d)&&this._updateEditingControllerView();const u=this.getViewXyByCanvasXy(r),y=d.x-u.x,f=d.y-u.y;y<0?this.dataProvider.updateOptions({selectionView:{...this.getOptions().selectionView,x:u.x+y,width:Math.abs(y)}}):this.dataProvider.updateOptions({selectionView:{...this.getOptions().selectionView,x:u.x,width:Math.abs(y)}}),f<0?this.dataProvider.updateOptions({selectionView:{...this.getOptions().selectionView,y:u.y+f,height:Math.abs(f)}}):this.dataProvider.updateOptions({selectionView:{...this.getOptions().selectionView,y:u.y,height:f}}),this._dataUpdated()};let n,o=!1,a=!0;const r=this.getCanvasXyByViewXy(this.getViewXyByEvent(e)),l=()=>{t(),this._canvasMovingTimer=requestAnimationFrame(l)},c=(d,h,u,y,f)=>{n=f,o?n=f:Math.abs(d)+Math.abs(h)>6&&(o=!0,a=!1,this.dataProvider.updateOptions({creatingSelection:!0}),this._canvasMovingTimer&&cancelAnimationFrame(this._canvasMovingTimer),this._canvasMovingTimer=requestAnimationFrame(l)),this._dataUpdated()};Z.startDrag(e,{x:0,y:0},(...d)=>{a=!0,this._canvasMovingTimer&&cancelAnimationFrame(this._canvasMovingTimer),this.onCanvasDragStop(...d)},c)}addFullscreenListener(){this._fullscreenchangeHandler=()=>{let e=!1;document.fullscreenElement?(C("div entered fullscreen mode",document.fullscreenElement),this.$dom===document.fullscreenElement&&(C("relation-graph is fullscreen!"),e=!0)):C("div exited fullscreen mode"),e!==this.getOptions().fullscreen&&(this.dataProvider.updateOptions({fullscreen:e}),this._dataUpdated(),setTimeout(async()=>{this.resetViewSize(),this._moveToCenter(),this.zoomToFit(),C("relation-graph reset complete!")},500))},document.addEventListener("fullscreenchange",this._fullscreenchangeHandler)}removeFullscreenListener(){document.addEventListener("fullscreenchange",this._fullscreenchangeHandler)}defaultLineConnectEndHandler(e,t,n){C("defaultLineConnectEndHandler:",e,t,n)}defaultLineVertexBeChangedHandler(e,t,n){C("defaultLineVertexBeChangedHandler:",n&&n.isReverse)}async sleep(e){await Ae(e)}forceLayoutTickCallback(){this._updateEditingControllerView(),this.dataProvider.updateShouldRenderGraphData(),this._dataUpdated()}}class Jn extends jn{constructor(){super();N(this,"$easyViewCanvas");N(this,"$rgWebglPainter");N(this,"_updateEasyViewRequested",!1);N(this,"_easyViewOffset",{x:0,y:0})}setEasyViewCanvas(e){this.$easyViewCanvas=e,this.$rgWebglPainter=new cn(e)}updateEasyView(){this.updateMiniView(),this.dataProvider.isPerformanceMode()&&(!this.getOptions().showEasyView||this._updateEasyViewRequested||(this._updateEasyViewRequested=!0,requestAnimationFrame(this._updateEasyView.bind(this))))}_updateEasyView(e){try{const t=Date.now();if(!this.$easyViewCanvas)return;this.updateShouldRenderGraphData(),this.evDosomethingBeforeDraw(),this.evDrawAllLines(),this.evDrawAllNodes()}catch(t){console.error(t)}finally{this._updateEasyViewRequested=!1}}evDosomethingBeforeDraw(){const e=this.getOptions(),t=e.viewSize.width,n=e.viewSize.height;this.$easyViewCanvas.width=t,this.$easyViewCanvas.height=n,this.$rgWebglPainter.setSize(t,n),C("updateEasyView:viewSize:",t,n);const o=this.dataProvider.getCanvasScale();this.$rgWebglPainter.setScale(o),this._easyViewOffset.x=e.canvasOffset.x,this._easyViewOffset.y=e.canvasOffset.y,this.$rgWebglPainter.setViewOffset(this._easyViewOffset.x,this._easyViewOffset.y),this.$rgWebglPainter.beforeDraw()}evDrawAllNodes(){const e=this.getOptions().defaultNodeShape;for(const t of this.getNodes()){if(!(t.rgShouldRender!==!1&&t.rgCalcedVisibility&&t.opacity!==0))continue;const o=we(t.nodeShape,e);this.evDrawNode(t,o)}}evDrawNode(e,t){t===Le.circle?this.evDrawNode4Circle(e):this.evDrawNode4Rect(e)}getNodeColor(e){const t=e.color||this.getOptions().defaultNodeColor||"#dddddd";return t==="transparent"?"rgba(204,204,204,0.2)":t}evDrawNode4Rect(e){const t=e.el_W,n=e.el_H,o=e.opacity||.8,a=this.getNodeColor(e),r=e.borderRadius===void 0?3:e.borderRadius,l=e.borderColor||"#666666";this.$rgWebglPainter.evDrawNode4Rect(e.x,e.y,t,n,a,o,r,l)}evDrawNode4Circle(e){const t=e.el_W,n=e.el_H,o=e.opacity||.8,a=this.getNodeColor(e),r=e.borderColor||"#666666";this.$rgWebglPainter.evDrawNode4Circle(e.x,e.y,t,n,a,o,r)}evDrawAllLines(){for(const e of this.getLinks()){const t=e.fromNode.rgShouldRender!==!1&&e.fromNode.opacity!==0&&e.fromNode.rgCalcedVisibility,n=e.toNode.rgShouldRender!==!1&&e.toNode.opacity!==0&&e.toNode.rgCalcedVisibility;!t&&!n||this.evDrawLine(e,e.line)}}evDrawLine(e,t){const n=this.createLineDrawInfo(e,t),o=t.opacity||1,a=this.getOptions(),r=t.color||a.defaultLineColor||"#888888",l=t.lineWidth||a.defaultLineWidth||1;this.$rgWebglPainter.evDrawLine(n.pathData,l,r,o)}}class Zn extends Jn{constructor(){super();N(this,"_onResizing");N(this,"_onResizeEnd");N(this,"_startPoint",{x:0,y:0});N(this,"_startEventCanvasXy",{x:0,y:0});N(this,"_startSizeCanvasXy",{x:0,y:0});N(this,"_startSize",{x:0,y:0,width:0,height:0,widthOnCanvas:0,heightOnCanvas:0});N(this,"_resizeType","l");N(this,"_nodeStartSizeMap",new WeakMap);N(this,"resizeMinLimit",{width:10,height:10});N(this,"_resizeDraggingTimer");N(this,"_resizeDraggingEvent");N(this,"_resizeDraggingStoped",!0);N(this,"_startCreateLineFromNodeTime",0)}setEditingNodes(e){if(e===null||e.length===0)this.dataProvider.setEditingNodes([]);else{const t=e.map(o=>o.id),n=this.getNodes().filter(o=>t.includes(o.id));this.dataProvider.setEditingNodes(n)}this._updateEditingControllerView(),this._dataUpdated()}addEditingNode(e){if(!this.getNodeById(e.id))throw new Error("Node not found: "+e.id);this.dataProvider.setEditingNodes(this.getOptions().editingController.nodes.concat(e)),this._updateEditingControllerView(),this._dataUpdated()}removeEditingNode(e){this.dataProvider.setEditingNodes(this.getOptions().editingController.nodes.filter(t=>t.id!==e.id)),this._updateEditingControllerView(),this._dataUpdated()}toggleEditingNode(e){this.getOptions().editingController.nodes.findIndex(n=>n.id===e.id)===-1?this.addEditingNode(e):this.removeEditingNode(e)}updateEditingControllerView(){this._updateEditingControllerView(),this._dataUpdated()}_updateEditingControllerView(){this._updateEditingLineView(),this._updateEditingConnectControllerView();const e=this.getOptions();if(!e.editingController.show)return;const{minX:t,minY:n,maxX:o,maxY:a}=this.getNodesRectBox(e.editingController.nodes),r=e.editingController.nodes.length>1?5:0,l=this.dataProvider.getCanvasScale();let c=o-t,d=a-n;if(c<0&&(c=0),d<0&&(d=0),c>0&&d>0){const h=this.getViewXyByCanvasXy({x:t,y:n}),u=h.x-r*l,y=h.y-r*l,f=c*l+r*2*l,g=d*l+r*2*l;this.dataProvider.updateOptions({editingController:{...e.editingController,x:u,y,width:f,height:g}})}else this.dataProvider.updateOptions({editingController:{...e.editingController,show:!1}})}onResizeStart(e,t){this._resizeType=e,this._startPoint=this.getViewXyByEvent(t),this._startEventCanvasXy=this.getCanvasXyByViewXy(this._startPoint);const n=this.getOptions();this._startSize.x=n.editingController.x,this._startSize.y=n.editingController.y,this._startSizeCanvasXy=this.getCanvasXyByViewXy(this._startSize),this._startSize.width=n.editingController.width,this._startSize.height=n.editingController.height;const o=this.dataProvider.getCanvasScale();this._startSize.widthOnCanvas=n.editingController.width/o,this._startSize.heightOnCanvas=n.editingController.height/o;for(const l of n.editingController.nodes)this._nodeStartSizeMap.set(l,{x:l.x,y:l.y,width:l.el_W,height:l.el_H});this._onResizing&&this.$dom.removeEventListener("mousemove",this._onResizing),this._onResizeEnd&&this.$dom.removeEventListener("mouseup",this._onResizeEnd),this._resizeDraggingEvent=null,this._resizeDraggingStoped=!1,this._onResizing=this.onResizing.bind(this),this._onResizeEnd=this.onResizeEnd.bind(this),this.$dom.addEventListener("mousemove",this._onResizing),this.$dom.addEventListener("mouseup",this._onResizeEnd);const a=this.onResizingRequest.bind(this),r=()=>{a(),this._resizeDraggingTimer=requestAnimationFrame(r)};this._resizeDraggingTimer=requestAnimationFrame(r),this.emitEvent(V.onResizeStart,n.editingController.nodes)}onResizing(e){this._resizeDraggingEvent=e}onResizingRequest(){if(!this._resizeDraggingEvent||this._resizeDraggingStoped)return;const e=this.getViewXyByEvent(this._resizeDraggingEvent);this.canvasAutoMoving(e);const t=this.getViewXyByCanvasXy(this._startEventCanvasXy),n=this.getViewXyByCanvasXy(this._startSizeCanvasXy),o=e.x-t.x,a=e.y-t.y,r=this.getOptions();let l=r.editingController.width,c=r.editingController.height,d=r.editingController.x,h=r.editingController.y;const u=this.dataProvider.getCanvasScale();this._resizeType==="tl"?(d=t.x+o,h=t.y+a,l=this._startSize.widthOnCanvas*u-o,c=this._startSize.heightOnCanvas*u-a):this._resizeType==="tr"?(h=t.y+a,d=n.x,l=this._startSize.widthOnCanvas*u+o,c=this._startSize.heightOnCanvas*u-a):this._resizeType==="bl"?(d=t.x+o,h=n.y,l=this._startSize.widthOnCanvas*u-o,c=this._startSize.heightOnCanvas*u+a):this._resizeType==="br"?(d=n.x,h=n.y,l=this._startSize.widthOnCanvas*u+o,c=this._startSize.heightOnCanvas*u+a):this._resizeType==="t"?(h=t.y+a,c=this._startSize.heightOnCanvas*u-a):this._resizeType==="r"?(d=n.x,l=this._startSize.widthOnCanvas*u+o):this._resizeType==="b"?(c=this._startSize.heightOnCanvas*u+a,h=n.y):this._resizeType==="l"&&(d=t.x+o,l=this._startSize.widthOnCanvas*u-o),l<this.resizeMinLimit.width&&(l=this.resizeMinLimit.width),c<this.resizeMinLimit.width&&(c=this.resizeMinLimit.height),this.dataProvider.updateOptions({editingController:{...r.editingController,x:d,y:h,width:l,height:c}}),this._applyResizeScale(this._resizeDraggingEvent),this._updateEditingControllerView(),this._dataUpdated()}_applyResizeScale(e){const t=this.getOptions(),n=this.dataProvider.getCanvasScale(),o=t.editingController.width/n/this._startSize.widthOnCanvas,a=t.editingController.height/n/this._startSize.heightOnCanvas,r=this._startSizeCanvasXy,l=this.getCanvasXyByViewXy({x:t.editingController.x,y:t.editingController.y});let c=!0,d=!0;this._resizeType==="t"||this._resizeType==="b"?c=!1:(this._resizeType==="r"||this._resizeType==="l")&&(d=!1);for(const h of t.editingController.nodes){const u=this._nodeStartSizeMap.get(h),y=u.width*o,f=u.height*a,g=l.x+o*(u.x-r.x),v=l.y+a*(u.y-r.y),p=y,m=f;this.emitEvent(V.beforeNodeResize,h,g,v,p,m)===!1||(c&&this.dataProvider.updateNode(h.id,{x:g,width:p,el_W:p}),d&&this.dataProvider.updateNode(h.id,{y:v,height:m,el_H:m}),C("ResizeNode:",h.id,p,m,o,a))}}onResizeEnd(e){cancelAnimationFrame(this._resizeDraggingTimer),this._resizeDraggingStoped=!0;const t=this.getViewXyByEvent(e),n=t.x-this._startPoint.x,o=t.y-this._startPoint.y;this._applyResizeScale(e),this.$dom.removeEventListener("mousemove",this._onResizing),this.$dom.removeEventListener("mouseup",this._onResizeEnd),this._onResizing=null,this._onResizeEnd=null,this.emitEvent(V.onResizeEnd,this.getOptions().editingController.nodes,n,o,e)}draggingSelectedNodes(e,t,n,o,a){const r=this.updateReferenceLineView(e,t,n,o,a);if(r){const{showV:c,fixedX:d,showH:h,fixedY:u}=r;c&&(o+=d-t,t=d),h&&(a+=u-n,n=u)}const l=this.getOptions();if(!l.editingController.nodes.includes(e))this.dataProvider.updateNode(e.id,{x:t,y:n}),this._updateEditingLineView();else{for(const c of l.editingController.nodes){const d=this._nodeXYMappingBeforeDrag[c.id];d&&this.dataProvider.updateNode(c.id,{x:d.x+o,y:d.y+a})}this._updateEditingControllerView()}}_updateEditingConnectControllerView(){const e=this.getOptions();if(!e.nodeConnectController.show)return;const t=e.nodeConnectController.node,n=t.x,o=t.y,a=t.x+t.el_W,r=t.y+t.el_H,l=0,c=this.dataProvider.getCanvasScale(),d=n,h=o,u=a-n,y=r-o,f=this.getViewXyByCanvasXy({x:d,y:h});this.dataProvider.updateOptions({nodeConnectController:{...e.nodeConnectController,x:f.x-l*c,y:f.y-l*c,width:u*c+l*2*c,height:y*c+l*2*c}})}setEditingLine(e){this.dataProvider.setEditingLine(e),this._updateEditingLineView(),this._dataUpdated()}updateReferenceLineView(e,t,n,o,a){const r=this.getOptions();if(!r.showReferenceLine)return;if(!r.editingReferenceLine.show){const M=Math.abs(o),w=Math.abs(a);M+w>2&&this.dataProvider.updateOptions({editingReferenceLine:{...r.editingReferenceLine,show:!0}})}if(!r.editingReferenceLine.show)return;const l=t,c=e.el_W,d=e.el_H,h=t+c/2,u=t+c,y=n,f=n+d/2,g=n+d,v=this.getViewXyByCanvasXy({x:h,y:f});let p=!1,m=!1,L=0,_=0;const S=this.getNodes().filter(M=>this._nodeXYMappingBeforeDrag[M.id]?!1:Math.abs(M.x-h)<600&&Math.abs(M.y-f)<600);S.sort((M,w)=>{const A=ve(h,f,M.x+M.el_W/2,M.y+M.el_H/2),X=ve(h,f,w.x+w.el_W/2,w.y+w.el_H/2);return A<X?-1:1});let{v_x:b,v_y:O,v_height:T,h_x:k,h_y:E,h_width:P}=r.editingReferenceLine;for(const M of S){const w=M.x,A=M.el_W,X=M.el_H,z=M.x+A/2,F=M.x+A,D=M.y,U=M.y+X/2,q=M.y+X,ee=Math.abs(l-w),K=Math.abs(h-z),se=Math.abs(u-F),oe=Math.abs(y-D),te=Math.abs(f-U),re=Math.abs(g-q),le=5;if(K<800&&te<800){if(!m&&K<le){const H=this.getViewXyByCanvasXy({x:z,y:U});b=H.x,O=v.y>H.y?H.y:v.y,T=Math.round(Math.abs(v.y-H.y)),m=!0,L=z-c/2}if(!m&&ee<le){const H=this.getViewXyByCanvasXy({x:w,y:U});b=H.x,O=v.y>H.y?H.y:v.y,T=Math.round(Math.abs(v.y-H.y)),m=!0,L=w}if(!m&&se<le){const H=this.getViewXyByCanvasXy({x:F,y:U});b=H.x,O=v.y>H.y?H.y:v.y,T=Math.round(Math.abs(v.y-H.y)),m=!0,L=F-c}if(!p&&te<le){const H=this.getViewXyByCanvasXy({x:z,y:U});E=H.y,k=v.x>H.x?H.x:v.x,P=Math.round(Math.abs(v.x-H.x)),p=!0,_=U-d/2}if(!p&&oe<le){const H=this.getViewXyByCanvasXy({x:z,y:D});E=H.y,k=v.x>H.x?H.x:v.x,P=Math.round(Math.abs(v.x-H.x)),p=!0,_=D}if(!p&&re<le){const H=this.getViewXyByCanvasXy({x:z,y:q});E=H.y,k=v.x>H.x?H.x:v.x,P=Math.abs(v.x-H.x),p=!0,_=q-d}if(p&&m)break}}if(this.dataProvider.updateOptions({editingReferenceLine:{...r.editingReferenceLine,v_x:b,v_y:O,v_height:T,h_x:k,h_y:E,h_width:P,directionH:p,directionV:m}}),r.referenceLineAdsorption)return{showV:m,fixedX:L,showH:p,fixedY:_}}hideEditingLineView(){this.dataProvider.updateOptions({editingLineController:{...this.getOptions().editingLineController,show:!1}})}updateEditingLineView(){this._updateEditingLineView(),this._dataUpdated()}_updateEditingLineView(){this.updateElementLines();const e=this.getOptions();if(!e.editingLineController.show)return;const t=e.editingLineController.line,n=this.getLinkByLine(t);if(!t||t.to==="newRelationTemplate-to"){this.dataProvider.updateOptions({editingLineController:{...this.getOptions().editingLineController,show:!1}});return}let o,a,r;const l=this.createLineDrawInfo(n,t);if(!l){this.dataProvider.updateOptions({editingLineController:{...this.getOptions().editingLineController,show:!1}});return}if(t.lineShape===Y.StandardOrthogonal){let{textPosition:_,pathData:S,points:b,startDirection:O,endDirection:T}=l;r=_,o=b[0],a=b[b.length-1];const k=[];for(let E=0;E<b.length-1;E++){const P=b[E],M=b[E+1],w={pIndex:E,optionName:"cp-"+E,x:0,y:0,direction:"v",startDirection:O,endDirection:T};P.x!==M.x&&(w.direction="h");const A=this.getViewXyByCanvasXy({x:(P.x+M.x)/2,y:(P.y+M.y)/2});w.x=A.x,w.y=A.y,k.push(w)}if(k.length!==1){if(k.length!==2)if(k.length===3){const E=b[0],P=b[1],M=b[3];if(k[1].direction==="v"){const w=E.x,A=P.x,X=M.x;if(Math.max(w,A,X)!==A&&Math.min(w,A,X)!==A)k[1].optionName="cx";else{const F=Math.abs(A-w),D=Math.abs(A-X);F>=D?k[1].optionName="td":F<D&&(k[1].optionName="fd")}}else{const w=E.y,A=P.y,X=M.y;if(Math.max(w,A,X)!==A&&Math.min(w,A,X)!==A)k[1].optionName="cy";else{const F=Math.abs(A-w),D=Math.abs(A-X);F>=D?k[1].optionName="td":F<D&&(k[1].optionName="fd")}}}else k.length===4?(k[1].optionName="fd",k[2].optionName="td"):k.length===5&&(k[1].optionName="fd",k[2].direction==="v"?k[2].optionName="cx":k[2].optionName="cy",k[3].optionName="td")}this.dataProvider.updateOptions({editingLineController:{...this.getOptions().editingLineController,line44Splits:k,line49Points:b}})}else if(t.lineShape===Y.HardOrthogonal){let{textPosition:_,pathData:S,points:b,startDirection:O,endDirection:T}=l;r=_;const k=[];b=t.ctrlPointsFor49,o=b[0],a=b[b.length-1];const E=b;for(let P=0;P<E.length-1;P++){const M=E[P],w=E[P+1],A={pIndex:P,optionName:"cp-"+P,x:0,y:0,direction:"v",startDirection:O,endDirection:T};M.x!==w.x?(A.direction="h",Math.abs(M.x-w.x)<15&&(A.hide=!0)):Math.abs(M.y-w.y)<15&&(A.hide=!0);const X=this.getViewXyByCanvasXy({x:(M.x+w.x)/2,y:(M.y+w.y)/2});A.x=X.x,A.y=X.y,k.push(A)}for(let P=0;P<k.length;P++){const M=k[P-1],w=k[P],A=k[P+1];P===0&&w.direction===A.direction&&(w.hide=!0),P===k.length-1&&w.direction===M.direction&&(w.hide=!0)}this.dataProvider.updateOptions({editingLineController:{...this.getOptions().editingLineController,line44Splits:k,line49Points:E}})}else if(t.lineShape!==1){r=l.textPosition;const _=wt(l.pathData);let S,b;t.isReverse?(o=_.endPoint,a=_.startPoint,S=this.getViewXyByCanvasXy(_.ctrl1),b=this.getViewXyByCanvasXy(_.ctrl2)):(o=_.startPoint,a=_.endPoint,S=this.getViewXyByCanvasXy(_.ctrl1),b=this.getViewXyByCanvasXy(_.ctrl2)),this.dataProvider.updateOptions({editingLineController:{...this.getOptions().editingLineController,ctrlPoint1:S,ctrlPoint2:b}})}else{r=l.textPosition;const _=l.pathData,S=wt(_);o=S.startPoint,a=S.endPoint}const c=this.getViewXyByCanvasXy(t.isReverse?a:o),d=this.getViewXyByCanvasXy(t.isReverse?o:a);this.dataProvider.updateOptions({editingLineController:{...this.getOptions().editingLineController,startPoint:c,endPoint:d}});const h=this.getViewXyByCanvasXy(r),u=this.$canvasDom.querySelector(`g[data-id='${t.id}']`);let y=0,f=0,g=t.textOffset_x||0,v=t.textOffset_y||0;const p=this.dataProvider.getCanvasScale();let m=20,L=20;if(u){const _=u.querySelector("text.rg-line-text");if(_){g=Math.floor(parseFloat(_.getAttribute("x")||"0")),v=Math.floor(parseFloat(_.getAttribute("y")||"0"));const S=_.clientWidth,b=_.clientHeight;m=S,L=b}}m+=40,L+=10,m>120&&(m=120),L>20&&(L=20),this.dataProvider.updateOptions({editingLineController:{...this.getOptions().editingLineController,text:{...this.getOptions().editingLineController.text,width:m,height:L,x:h.x+y+g*p,y:h.y+f+v*p}}})}startMoveLineVertex(e,t,n){t.stopPropagation();const o=this.getOptions().editingLineController.line,a=this.getLinkByLine(o);let r,l;if(a)r=a.fromNode,l=a.toNode;else{const{from:h,to:u}=this.generateFakeLineConfig(o);r=h,l=u}let c=r;this.dataProvider.setEditingLine(null),a?this.removeLine(o):this.removeFakeLine(o),console.log("DragLine start:",e,o.isReverse);let d=!1;o.lineShape===Y.HardOrthogonal&&(o.lineShape=Y.StandardOrthogonal),e==="start"?(o.fromJuctionPointOffsetX=0,o.fromJuctionPointOffsetY=0,c=l,d=!0):(o.toJuctionPointOffsetX=0,o.toJuctionPointOffsetY=0),this.startCreatingLinePlot(t,{template:o,fromNode:c,isReverse:d,onCreateLine:n})}startCreateLineFromNode(e,t,n,o){n.stopPropagation();const a=JSON.parse(JSON.stringify(t));if(this._startCreateLineFromNodeTime=Date.now(),!a.from){if(!e){const l=this.getOptions().editingController.nodes;l.length===1&&(e=l[0])}e&&(a.from=e.id,a.fromType=e.targetType)}if(!a.from)throw console.error("Error:lineTemplate:",a),Error("Error:startCreateLineByTemplate: lineTemplate must has [fromType, from]");const r=this.getFakeLineTarget(a.fromType,a.from,a);if(!r)throw console.error("Error:fakeTarget[fromType, from]:",a.fromType,a.from,a),Error(`Error:startCreateLineByTemplate: error from fakeTarget[fromType, from]:${a.fromType}, ${a.from}`);a.lineShape||(a.lineShape=6),this.startCreatingLinePlot(n,{template:a,fromNode:r,isReverse:!1,onCreateLine:o})}onLineVertexBeDropped(e,t,n={x:0,y:0},o){t.stopPropagation();const a=this.getOptions();if(!a.creatingLinePlot||Date.now()-this._startCreateLineFromNodeTime<500)return;console.log("Connect end:isReverse:",a.newLineTemplate.isReverse);const r=a.nodeConnectController.node;let{toJunctionPoint:l,toJuctionPointOffsetX:c,toJuctionPointOffsetY:d,fromJunctionPoint:h,fromJuctionPointOffsetX:u,fromJuctionPointOffsetY:y}=a.newLineTemplate;if(!a.newLinkTemplate.fromNode)a.newLineTemplate.isReverse?(l=e,c=n.x,d=n.y):(h=e,u=n.x,y=n.y),this.dataProvider.updateOptions({newLineTemplate:{...this.getOptions().newLineTemplate,fromJunctionPoint:h,fromJuctionPointOffsetX:u,fromJuctionPointOffsetY:y,toJunctionPoint:l,toJuctionPointOffsetX:c,toJuctionPointOffsetY:d},newLinkTemplate:{...this.getOptions().newLinkTemplate,fromNode:r}});else{a.newLineTemplate.isReverse?(h=e,u=n.x,y=n.y):(l=e,c=n.x,d=n.y);const f=this.getOptions().newLinkTemplate.fromNode;this.dataProvider.updateOptions({newLineTemplate:{...this.getOptions().newLineTemplate,fromJunctionPoint:h,fromJuctionPointOffsetX:u,fromJuctionPointOffsetY:y,toJunctionPoint:l,toJuctionPointOffsetX:c,toJuctionPointOffsetY:d},newLinkTemplate:{...this.getOptions().newLinkTemplate,toNodeObject:r}});const g=r;try{const v={newLineTemplate:this.getOptions().newLineTemplate,fromNode:f,toNode:g};this.emitEvent(V.onLineVertexDropped,v),o&&o(v.fromNode,v.toNode,v.newLineTemplate),this.onReadyToCreateLine(this.getOptions().newLinkTemplate.fromNode,this.getOptions().nodeConnectController.node)!==!0&&this.stopCreatingLinePlot()}catch(v){this.stopCreatingLinePlot(),console.warn("[Custom Reject onCreateLine By Throw Error:",v)}}}startMoveLineText(e,t){if(Ce(e))return;const n=this.getViewXyByEvent(e),a=this.getOptions().editingLineController.line;console.log("startMoveLineText:",a.id);const r=a.textOffset_x||0,l=a.textOffset_y||0,c=h=>{const u=this.dataProvider.getCanvasScale(),y=this.getViewXyByEvent(h),f=y.x-n.x,g=y.y-n.y;a.textOffset_x=Math.round(r+f/u),a.textOffset_y=Math.round(l+g/u),this._updateEditingLineView(),this._dataUpdated()},d=h=>{this.$dom.removeEventListener("mousemove",c),this.$dom.removeEventListener("mouseup",d),t&&t(),this._dataUpdated()};this.$dom.addEventListener("mousemove",c),this.$dom.addEventListener("mouseup",d)}startMoveLine6CtrlPoint(e,t,n){t.stopPropagation(),t.preventDefault();const r=this.getOptions().editingLineController.line;let l=r.ctrlPoints||[];l.length===0&&(l.push({x:0,y:0}),l.push({x:0,y:0})),this.dataProvider.updateLine(r.id,{ctrlPoints:l}),console.log("startMoveLine6CtrlPoint:line:",r),l=r.ctrlPoints,r.isReverse&&(e=l.length-1-e);const c=this.dataProvider.getCanvasScale(),d=l[e],{x:h,y:u}=d,y=()=>{n(r),this._dataUpdated()};Z.startDrag(t,{x:0,y:0},y,(f,g)=>{d.x=h+f/c,d.y=u+g/c,this.dataProvider.updateLine(r.id,{ctrlPoints:l}),this._updateEditingLineView(),this._dataUpdated()})}startMoveLine44CtrlPoint(e,t,n){t.stopPropagation(),t.preventDefault();const a=this.getOptions().editingLineController,r=a.line;console.log("startMoveLine44CtrlPoint:",r==null?void 0:r.lineShape,e.optionName);let l=r.ctrlOptionsFor44;l||(l={cx:0,cy:0,fd:0,td:0},this.dataProvider.updateLine(r.id,{ctrlOptionsFor44:l}),l=r.ctrlOptionsFor44);const c=l[e.optionName],d={indexOffset:0};let h=r.ctrlPointsFor49?JSON.parse(JSON.stringify(r.ctrlPointsFor49)):null;const u=(f,g)=>{console.log("lineSplitCtrlMoving:",r==null?void 0:r.lineShape,e.optionName);const v=this.dataProvider.getCanvasScale();if(r.lineShape===Y.StandardOrthogonal){if(e.optionName==="cx"){const m=c+f/v*1;l.cx=m,this.dataProvider.updateLine(r.id,{ctrlOptionsFor44:l})}else if(e.optionName==="cy"){const m=c+g/v*1;l.cy=m,this.dataProvider.updateLine(r.id,{ctrlOptionsFor44:l})}else if(e.optionName==="fd"){const p=Ee[e.startDirection],m=e.direction==="v"?f*p.x:g*p.y;l.fd=c+m/v,this.dataProvider.updateLine(r.id,{ctrlOptionsFor44:l})}else if(e.optionName==="td"){const p=Ee[e.endDirection],m=e.direction==="v"?f*p.x:g*p.y;l.td=c+m/v,this.dataProvider.updateLine(r.id,{ctrlOptionsFor44:l})}else if(e.direction==="v"&&Math.abs(f)>5||e.direction==="h"&&Math.abs(g)>5){const p=a.line49Points;h=JSON.parse(JSON.stringify(p)),console.log(":startCtrlPointsFor49:::",h),this.dataProvider.updateLine(r.id,{ctrlPointsFor49:h}),this.dataProvider.updateLine(r.id,{lineShape:Y.HardOrthogonal})}}else if(r.lineShape===Y.HardOrthogonal){const{newPoints:p,pointsChanged:m}=pn(r.ctrlPointsFor49,h,e.pIndex+d.indexOffset,e,d,f/v,g/v);m&&(h=JSON.parse(JSON.stringify(p))),this.dataProvider.updateLine(r.id,{ctrlPointsFor49:p})}},y=()=>{if(r.lineShape===Y.HardOrthogonal){const f=De(r.ctrlPointsFor49);this.dataProvider.updateLine(r.id,{ctrlPointsFor49:f})}this._updateEditingLineView(),n&&n(r),this._dataUpdated()};Z.startDrag(t,{x:0,y:0},y,(f,g)=>{u(f,g),this._updateEditingLineView(),this._dataUpdated()})}onLineVertexBeDroppedOnConnectController(e,t,n,o){if(C("onLineVertexBeDroppedOnConnectController",e,t,n),t.stopPropagation(),!n){this.onLineVertexBeDropped(e,t,void 0,o);return}const a=me(t),r=n.getBoundingClientRect(),l={x:r.left,y:r.top+r.height/2},c={x:r.left+r.width/2,y:r.top},d={x:r.left+r.width,y:r.top+r.height/2},h={x:r.left+r.width/2,y:r.top+r.height};let u=he.left;const y={x:0,y:0};if(e)u=e,u===he.top||u===he.bottom?y.x=a.clientX-h.x:u===he.right?y.y=a.clientY-d.y:y.y=a.clientY-l.y;else{const g=ve(a.clientX,a.clientY,l.x,l.y),v=ve(a.clientX,a.clientY,c.x,c.y),p=ve(a.clientX,a.clientY,d.x,d.y),m=ve(a.clientX,a.clientY,h.x,h.y),L=Math.min(g,v,p,m);L===g?(u=he.left,y.x=a.clientX-l.x,y.y=a.clientY-l.y):L===v?(u=he.top,y.x=a.clientX-c.x,y.y=a.clientY-c.y):L===p?(u=he.right,y.x=a.clientX-d.x,y.y=a.clientY-d.y):L===m&&(u=he.bottom,y.x=a.clientX-h.x,y.y=a.clientY-h.y)}const f=this.dataProvider.getCanvasScale();y.x=y.x/f,y.y=y.y/f,C("onMouseUpWithOffset:",e,y),this.onLineVertexBeDropped(u,t,y,o)}}class Qn extends Zn{constructor(){super();N(this,"$miniViewCanvas");N(this,"$mvCanvasCtx");N(this,"_canvasDomScale",1);N(this,"miniViewBox",{visibleAreaStart:{x:0,y:0},visibleAreaEnd:{x:0,y:0},canvas_start_x:0,canvas_start_y:0,canvas_end_x:0,canvas_end_y:0,canvas_width:0,canvas_height:0,miniview_width:0,miniview_height:0});N(this,"visibleArea",{x:0,y:0});N(this,"_canvasItemMiniSizeLimit",1)}setMiniViewCanvas(e){this.$miniViewCanvas=e,this.$mvCanvasCtx=this.$miniViewCanvas.getContext("2d")}updateMiniView(){!this.getOptions().showMiniView||(this.updateMiniViewVisibleArea(),this._updateMiniView())}_updateMiniView(){try{const e=Date.now();this.mvDosomethingBeforeDraw(),this.mvDrawAllNodes()}catch(e){console.error(e)}}mvDosomethingBeforeDraw(){let e=9999999,t=9999999,n=-9999999,o=-9999999,a=0;for(const m of this.getNodes())if(m.rgCalcedVisibility&&m.opacity!==0){m.x<e&&(e=m.x),m.y<t&&(t=m.y);const L=m.x+m.el_W,_=m.y+m.el_H;L>n&&(n=L),_>o&&(o=_),a++}const r=1,l=50,c=50;a===0?(this.miniViewBox.canvas_start_x=-100-l,this.miniViewBox.canvas_start_y=-100-c,this.miniViewBox.canvas_end_x=100+l,this.miniViewBox.canvas_end_y=100+c,this.miniViewBox.canvas_width=this.miniViewBox.canvas_end_x-this.miniViewBox.canvas_start_x,this.miniViewBox.canvas_height=this.miniViewBox.canvas_end_y-this.miniViewBox.canvas_start_y):(this.miniViewBox.canvas_start_x=e-l,this.miniViewBox.canvas_start_y=t-c,this.miniViewBox.canvas_end_x=n+l,this.miniViewBox.canvas_end_y=o+c,this.miniViewBox.canvas_width=this.miniViewBox.canvas_end_x-this.miniViewBox.canvas_start_x,this.miniViewBox.canvas_height=this.miniViewBox.canvas_end_y-this.miniViewBox.canvas_start_y);const d=this.$miniViewCanvas.parentElement.getBoundingClientRect(),h=d.width,u=d.height;let y=0,f=0,g=1;h/this.miniViewBox.canvas_width<u/this.miniViewBox.canvas_height?(g=h/this.miniViewBox.canvas_width*r,y=h,f=h/this.miniViewBox.canvas_width*this.miniViewBox.canvas_height):(g=u/this.miniViewBox.canvas_height*r,y=u/this.miniViewBox.canvas_height*this.miniViewBox.canvas_width,f=u),this.miniViewBox.miniview_width=h,this.miniViewBox.miniview_height=u,this.$miniViewCanvas.width=h,this.$miniViewCanvas.height=u,this.$mvCanvasCtx.canvas.width=h*window.devicePixelRatio,this.$mvCanvasCtx.canvas.height=u*window.devicePixelRatio,this.$mvCanvasCtx.canvas.style.width=`${h}px`,this.$mvCanvasCtx.canvas.style.height=`${u}px`;const v=(u-f)/2,p=(h-y)/2;this.miniViewBox.canvas_start_x-=p/g,this.miniViewBox.canvas_start_y-=v/g,this.$mvCanvasCtx.setTransform(window.devicePixelRatio,0,0,window.devicePixelRatio,0,0),this.$mvCanvasCtx.scale(g,g),this._canvasDomScale=g,this.$mvCanvasCtx.clearRect(0,0,this.$mvCanvasCtx.canvas.width,this.$mvCanvasCtx.canvas.height)}updateMiniViewVisibleArea(){const e=this.getCanvasXyByViewXy({x:0,y:0}),t=this.getOptions().viewSize,n=this.getCanvasXyByViewXy({x:t.width,y:t.height}),o=this._canvasDomScale,a=n.x-e.x,r=n.y-e.y;this.miniViewBox.visibleAreaStart=e,this.miniViewBox.visibleAreaEnd=n;const l=o*a,c=o*r,d=e.x-this.miniViewBox.canvas_start_x,h=e.y-this.miniViewBox.canvas_start_y,u=o*d,y=o*h;let f=!1;(u+l<0||y+c<0||y>this.miniViewBox.miniview_height||u>this.miniViewBox.miniview_width)&&(f=!0),this.dataProvider.updateOptions({miniViewVisibleHandle:{...this.getOptions().miniViewVisibleHandle,emptyContent:f,width:l,height:c,x:u,y}})}mvDrawAllNodes(){const e=this._canvasDomScale,t=this.getOptions().defaultNodeShape;for(const n of this.getNodes())if(n.rgCalcedVisibility&&n.opacity!==0){let o=n.el_W,a=n.el_H;e*o<this._canvasItemMiniSizeLimit&&(o=this._canvasItemMiniSizeLimit/this._canvasDomScale),e*a<this._canvasItemMiniSizeLimit&&(a=this._canvasItemMiniSizeLimit/this._canvasDomScale);const r=we(n.nodeShape,t);this.mvDrawNode(n,r,o,a)}}mvDrawNode(e,t,n,o){t===Le.circle?this.mvDrawNode4Circle(e,n,o):this.mvDrawNode4Rect(e,n,o)}mvDrawNode4Rect(e,t,n){const o=this.$mvCanvasCtx,a=e.x-this.miniViewBox.canvas_start_x,r=e.y-this.miniViewBox.canvas_start_y;o.beginPath(),o.globalAlpha=e.opacity||1,o.rect(a,r,t,n),o.fillStyle=this.getNodeColor(e),o.fill(),o.strokeStyle="#666666",o.lineWidth=2,o.stroke(),o.globalAlpha=1}mvDrawNode4Circle(e,t,n){const o=this.$mvCanvasCtx,a=e.x+t/2-this.miniViewBox.canvas_start_x,r=e.y+n/2-this.miniViewBox.canvas_start_y;o.beginPath(),o.globalAlpha=e.opacity||1,o.ellipse(a,r,t/2,n/2,0,0,2*Math.PI),o.fillStyle=this.getNodeColor(e),o.fill(),o.strokeStyle="#666666",o.lineWidth=2,o.stroke(),o.globalAlpha=1}mvDrawAllLines(){for(const e of this.getLinks())e.fromNode.rgCalcedVisibility&&e.toNode.rgCalcedVisibility&&this.mvDrawLine(e,e.line)}mvDrawLine(e,t){const n=this.$mvCanvasCtx,o=this.createLineDrawInfo(e,t);n.beginPath(),n.globalAlpha=t.opacity||1,this.mvDrawSvgPathOnCanvas(n,o.pathData);const a=this.getOptions();n.strokeStyle=t.color||a.defaultLineColor||"#888888",n.lineWidth=t.lineWidth||a.defaultLineWidth||1,n.stroke(),n.globalAlpha=1}mvDrawSvgPathOnCanvas(e,t){const n=t.match(/[a-zA-Z][^a-zA-Z]*/g);let o=0,a=0,r=0,l=0,c=0,d=0,h=0,u=0,y=!1;n.forEach(f=>{const g=f.trim().split(/[ ,]+/),v=g[0].toUpperCase(),p=g[0]===g[0].toLowerCase();switch(v){case"M":o=W(r,g[1],p)-this.miniViewBox.canvas_start_x,a=W(l,g[2],p)-this.miniViewBox.canvas_start_y,r=o,l=a,y&&(e.closePath(),y=!1),e.moveTo(o,a);break;case"L":o=W(r,g[1],p)-this.miniViewBox.canvas_start_x,a=W(l,g[2],p)-this.miniViewBox.canvas_start_y,e.lineTo(o,a);break;case"C":c=W(r,g[1],p),d=W(l,g[2],p),h=W(r,g[3],p),u=W(l,g[4],p),o=W(r,g[5],p),a=W(l,g[6],p),r=o,l=a,e.bezierCurveTo(c,d,h,u,o,a);break;case"Q":c=W(r,g[1],p),d=W(l,g[2],p),o=W(r,g[3],p),a=W(l,g[4],p),r=o,l=a;break;case"V":a=W(l,g[1],p),l=a,e.lineTo(o,a);break;case"H":o=W(r,g[1],p),r=o,e.lineTo(o,a);break;case"Z":e.closePath(),y=!1;break;default:C(`Unsupported command: ${v}`)}})}onVisibleViewHandleDragStart(e){e.preventDefault(),e.stopPropagation(),console.log("onVisibleViewHandleDragStart:");const t=this.getOptions(),n=t.canvasOffset.x,o=t.canvasOffset.y,a=this.miniViewBox.canvas_width,r=this.miniViewBox.canvas_height,l=()=>{const f=u/this.miniViewBox.miniview_width,g=y/this.miniViewBox.miniview_height,v=this.dataProvider.getCanvasScale(),p=a*f*v,m=r*g*v;console.log("setCanvasOffset:buff:",u,y),this.dataProvider.setCanvasOffset(n-p,o-m),this._updateEditingControllerView(),this.updateMiniViewVisibleArea(),this.updateShouldRenderGraphData(),this.dataProvider.dataUpdated()};let c;const d=(f,g,v)=>{c&&clearInterval(c),this.onCanvasDragEnd(v)};let h=!1,u=0,y=0;Z.startDrag(e,{x:0,y:0},d,(f,g)=>{u=f,y=g,console.log("onVisibleViewHandleDragStart:move:",f,g),!h&&Math.abs(f)+Math.abs(g)>3&&(console.log("onVisibleViewHandleDragStart:start"),h=!0,c=setInterval(()=>{l()},50))})}resetByVisiableView(e){!this.getOptions().miniViewVisibleHandle.emptyContent||(this.setZoom(100),this._moveToCenter(),this.zoomToFit())}}class Kn extends Qn{constructor(){super();N(this,"$watermarkDom",null);N(this,"$watermarkPosition","br");N(this,"$backgroundDom",null);N(this,"_originBackgroundColor","")}setWatermarkDom(e,t=!0,n=!1,o="br"){t&&(this.$watermarkDom=e),this.$watermarkPosition=o}setBackgroundDom(e,t=!0,n=!0){e===null?(this._originBackgroundColor=this.options.backgroundColor,this.dataProvider.updateOptions({backgroundColor:"transparent"}),t?this.$backgroundDom=e:this.$backgroundDom=null):(this.dataProvider.updateOptions({backgroundColor:this._originBackgroundColor}),this.$backgroundDom=null)}async prepareForImageGeneration(){return this.$canvasDom}async restoreAfterImageGeneration(){}}class eo extends Kn{constructor(){super();N(this,"resizeObserver");N(this,"resizeListenerMap",new WeakMap);N(this,"domToNodeIdMap",new WeakMap);N(this,"mutationObserver4Nodes");N(this,"mutationObserver4CanvasSlotBehind");N(this,"mutationObserver4CanvasSlotAbove");N(this,"_updateCanvasConnectTargetsTask");N(this,"onKeyDownHanlder");N(this,"onKeyUpHanlder")}setDom(e){C("relation-graph mounted on:",this.instanceId,e),this.$dom=e}setCanvasDom(e){C("relation-graph canvas dom mounted!"),this.$canvasDom=e,this.reinitMutationObservers(),this.getLineTextContainer({isFakeLine:!0}),this.getLineTextContainer({isFakeLine:!1})}getResizeObserver(){return this.resizeObserver||(this.resizeObserver=new ResizeObserver((e,t)=>{for(const n of e){const o=this.resizeListenerMap.get(n.target);o?n.borderBoxSize?o(n.borderBoxSize[0].inlineSize,n.borderBoxSize[0].blockSize):o(n.target.clientWidth,n.target.clientHeight):n.borderBoxSize?this._onNodeDomResize(n.target,n.borderBoxSize[0].inlineSize,n.borderBoxSize[0].blockSize):this._onNodeDomResize(n.target,n.target.clientWidth,n.target.clientHeight)}})),this.resizeObserver}initDom(){this.addResizeListener(this.$dom,(e,t)=>{C("resizeListener:this.$dom"),this.resetViewSize(),this.updateEasyView(),this._rgAsConnectArea&&(this.updateConnectTargetsOnCanvas("View Resize",this.$dom.querySelector(".rg-canvas-slot-behind")),this.updateConnectTargetsOnCanvas("View Resize",this.$dom.querySelector(".rg-canvas-slot-above"))),this._updateEditingLineView(),this._updateEditingControllerView(),this._dataUpdated(),setTimeout(()=>{C("resizeListener:updateShouldRenderGraphData"),this.emitEvent(V.onViewResize,{width:e,height:t}),this._dataUpdated()},500)}),this._rgAsConnectArea||(this.removeKeyboardListener(),this.addKeyboardListener())}reinitMutationObservers(){this.destroyMutationObserver();const e=this.$canvasDom.querySelector(".rg-nodes-container-wrapper");if(e)this.mutationObserver4Nodes=new MutationObserver(o=>{if(this.dataProvider.getConnectTargets().length>0)for(const a of o){const r=this.getNodeElByChildrenTarget(a.target),l=this.domToNodeIdMap.get(r);l&&this.updateConnectTargetsOnNode("Mutation",l,r)}}),this.mutationObserver4Nodes.observe(e,{childList:!0,subtree:!0,characterData:!0});else throw new Error("MutationObserver:error:Can not find: .rg-nodes-container-wrapper");const t=this.$canvasDom.parentElement.querySelector(".rg-canvas-slot-behind");if(t)this.mutationObserver4CanvasSlotBehind=new MutationObserver(o=>{console.warn("MutationObserver:updateConnectTargetsOnCanvas:mutations:",o),this.updateConnectTargetsOnCanvas("CanvasBehind-Mutation",t)}),this.mutationObserver4CanvasSlotBehind.observe(t,{childList:!0,subtree:!0,characterData:!0});else throw new Error("MutationObserver:error:Can not find: .rg-canvas-slot-behind");const n=this.$canvasDom.parentElement.querySelector(".rg-canvas-slot-above");n&&(this.mutationObserver4CanvasSlotAbove=new MutationObserver(o=>{this.updateConnectTargetsOnCanvas("CanvasAbove-Mutation",n)}),this.mutationObserver4CanvasSlotAbove.observe(n,{childList:!0,subtree:!0,characterData:!0}))}destroyMutationObserver(){this.mutationObserver4Nodes&&(this.mutationObserver4Nodes.disconnect(),this.mutationObserver4Nodes=void 0),this.mutationObserver4CanvasSlotBehind&&(this.mutationObserver4CanvasSlotBehind.disconnect(),this.mutationObserver4CanvasSlotBehind=void 0),this.mutationObserver4CanvasSlotAbove&&(this.mutationObserver4CanvasSlotAbove.disconnect(),this.mutationObserver4CanvasSlotAbove=void 0)}addKeyboardListener(){this.onKeyDownHanlder=e=>{Ce(e)||(e.code==="Space"&&(e.preventDefault(),this.getOptions().canvasMoveMode===!1&&this.setCanvasMoveMode(!0)),this.emitEvent(V.onKeyboardDown,e))},this.onKeyUpHanlder=e=>{Ce(e)||(e.code==="Space"&&(e.preventDefault(),this.getOptions().canvasMoveMode===!0&&this.setCanvasMoveMode(!1)),this.emitEvent(V.onKeyboardUp,e))},this.$dom.addEventListener("keydown",this.onKeyDownHanlder),this.$dom.addEventListener("keyup",this.onKeyUpHanlder)}removeKeyboardListener(){this.onKeyDownHanlder&&this.$dom.removeEventListener("keydown",this.onKeyDownHanlder),this.onKeyUpHanlder&&this.$dom.removeEventListener("keyup",this.onKeyUpHanlder)}addResizeListener(e,t){this.resizeListenerMap.set(e,t),this.getResizeObserver().observe(e)}_onNodeDomResize(e,t,n){if(t===0||n===0)return;const o=this.domToNodeIdMap.get(e);this._onNodeResize(e,o,t,n)}_onNodeResize(e,t,n,o){n===0||o===0||(this.updateConnectTargetsOnNode("Node-Created",t,e),this.updateNodeOffsetSize(t,n,o))}addNodeResizeListener(e,t){this.domToNodeIdMap.set(e,t.id),this._onNodeResize(e,t.id,e.offsetWidth,e.offsetHeight),this.getResizeObserver().observe(e)}removeNodeResizeListener(e){this.domToNodeIdMap.delete(e),e?this.getResizeObserver().unobserve(e):C("removeNodeResizeListener: dom is null or undefined!")}removeResizeListener(e){this.resizeListenerMap.delete(e),this.resizeObserver&&this.resizeObserver.unobserve(e)}destroyResizeObserver(){this.resizeObserver&&this.resizeObserver.disconnect()}}class to extends eo{constructor(){super()}dataUpdated(){this._requestDataUpdate()}setOptions(i){this._updateOptions(i),this._dataUpdated()}updateOptions(i){this._updateOptions(i),this._dataUpdated()}moveToCenter(i){this._moveToCenter(i),this._dataUpdated()}transToLinker(i=!0){this._rgAsConnectArea=i,this.resetViewSize(),this.updateConnectTargetsOnCanvas("View Resize",this.$dom.querySelector(".rg-canvas-slot-behind")),this.updateConnectTargetsOnCanvas("View Resize",this.$dom.querySelector(".rg-canvas-slot-above")),this.removeKeyboardListener(),this._rgAsConnectArea||this.addKeyboardListener(),this._dataUpdated()}setRootNodeId(i){this.dataProvider.setRootNodeId(i)}getRootNode(){return this.dataProvider.getRootNode()}getCheckedNode(){return this.getNodeById(this.getOptions().checkedNodeId)}getCheckedLine(){if(!this.getLineById(this.getOptions().checkedLineId))return this.getFakeLineById(this.getOptions().checkedLineId)}getSelectedNodes(){return this.getNodes().filter(i=>i.selected)}getEditingNodes(){return[...this.getOptions().editingController.nodes]}async setJsonData(i){this._setJsonData(i),await this.doLayout(i.rootId)}async appendJsonData(i,e=!0){C("appendData:",i),this.loadGraphJsonData(i),e&&await this.doLayout()}async applyInitialData(i){await this.setJsonData(i),this.moveToCenter(),this.zoomToFit()}getGraphJsonData(){var t;const i=[],e=[];return this.getNodes().forEach(n=>{const o=ke(n);o&&i.push(o)}),this.getLines().forEach(n=>{const o=Me(n);o&&e.push(o)}),{rootId:((t=this.dataProvider.getRootNode())==null?void 0:t.id)||"",nodes:i,lines:e}}transRGNodeToJsonObject(i){return ke(i)}transRGLinkToJsonObject(i){return Xe(i)}transRGLineToJsonObject(i){return Me(i)}getGraphJsonOptions(){const i={},e=["layouter","layoutor","autoLayouting","canvasNVInfo","canvasOffset","canvasZoom","fullscreen","instanceId","layoutClassName","layoutDirection","layoutLabel","layoutName","resetViewSize","viewELSize","viewNVInfo","viewSize","canvasSize","newLinkTemplate","newLineTemplate","newNodeTemplate"],t=this.getOptions();return Object.keys(t).forEach(n=>{e.includes(n)||(i[n]=t[n])}),i}clearGraph(){this._clearGraph(),this._dataUpdated()}printOptions(){const i=this.getGraphJsonOptions();console.log("options:",i),console.log("options-json-string:"),console.log(JSON.stringify(i))}printData(){const i=this.getGraphJsonData();console.log("data:",i),console.log("data-json-string:"),console.log(JSON.stringify(i))}printGraphJsonData(){this.printOptions(),this.printData()}}class Pt extends to{constructor(){super();N(this,"viewComponentUnmounted",!1)}setListeners(e){this.listeners=e}ready(){this.initDom(),this.resetViewSize(!0),this.addFullscreenListener(),this.emitEvent(V.onReady,this),this.viewComponentUnmounted=!1}beforeUnmount(){this.viewComponentUnmounted=!0,this.removeFullscreenListener(),this.removeKeyboardListener(),this.destroyMutationObserver(),this.destroyResizeObserver()}}const no=ye.Provider,oo=et.Provider,io=Ie.Provider,so=ae.Provider;function Tt(s,i=!1){const e=s?Reflect.construct(s,[]):new Pt;return e._rgAsConnectArea=i,console.log("[RGProvider]Creating new graphInstance",e.instanceId,i),e}function Ue(s,i=!1){const e=I.useContext(ye);return e||(console.log("[RGProvider]No parent RGProvider found, creating new graphInstance"),Tt(s,i))}const Mt=({graphInstance:s,children:i})=>{const[e,t]=I.useState(0),{data:n,dataStores:o}=ao(),a=I.useRef(0),r=I.useCallback(l=>{a.current++,t(a.current)},[]);return a.current===0&&s.setReactiveData4React(o,r),x.jsx(no,{value:s,children:x.jsx(oo,{value:r,children:x.jsx(io,{value:e,children:x.jsx(so,{value:n,children:i})})})})},qe=({graphInstance:s,children:i})=>I.useContext(ye)?x.jsx(x.Fragment,{children:i}):x.jsx(Mt,{graphInstance:s,children:i}),ao=()=>{const[s,i]=I.useState(_e({})),[e,t]=I.useState([]),[n,o]=I.useState([]),[a,r]=I.useState([]);return{data:{options:s,shouldRenderNodes:e,shouldRenderLines:n,shouldRenderFakeLines:a},dataStores:{store4Options:{set:f=>{i({...f})}},store4ShouldRenderNodes:{set:f=>{t(f)}},store4ShouldRenderLines:{set:f=>{o(f)}},store4ShouldRenderFakeLines:{set:f=>{r(f)}}}}},Te=s=>s,ro=`graphRef.value.getInstance() will be deprecated
|
|
43
|
+
|
|
44
|
+
It is recommended to use the graphInstance:
|
|
45
|
+
###### Method 1: ######
|
|
46
|
+
|
|
47
|
+
import { RGProvider } from 'relation-graph-vue2';
|
|
48
|
+
|
|
49
|
+
<RGProvider>
|
|
50
|
+
<YourComponent>
|
|
51
|
+
<RelationGraph>
|
|
52
|
+
...
|
|
53
|
+
</RelationGraph>
|
|
54
|
+
</YourComponent>
|
|
55
|
+
</RGProvider>
|
|
56
|
+
|
|
57
|
+
// YourComponent.vue file:
|
|
58
|
+
|
|
59
|
+
// ensuring the correct context is provided so that you can access the graphInstance:
|
|
60
|
+
|
|
61
|
+
import { RelationGraph, useGraphInstance } from 'relation-graph-vue2';
|
|
62
|
+
const graphInstance = useGraphInstance();
|
|
63
|
+
|
|
64
|
+
const graphOptions = ref<RGOptions>({ ... }); // Your RGOptions here
|
|
65
|
+
// Now you can use graphInstance to manipulate the graph data and call APIs. This will facilitate data manipulation and API calls.
|
|
66
|
+
|
|
67
|
+
<div>
|
|
68
|
+
...
|
|
69
|
+
<RelationGraph :options="graphOptions">
|
|
70
|
+
...
|
|
71
|
+
</RelationGraph>
|
|
72
|
+
...
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
However, you can still use the current method, but you can only obtain the <RelationGraph> component instance through:
|
|
76
|
+
graphRef.value.getInstance(). in your <YourComponent>;
|
|
77
|
+
And method graphRef.value.getInstance() will be deprecated in future versions.
|
|
78
|
+
|
|
79
|
+
More details: https://www.relation-graph.com/docs/better-integration#vue3
|
|
80
|
+
|
|
81
|
+
Set option "definitelyNoDataProviderNeeded": true to disable the data provider warning if you are sure that no data provider is needed in your case.
|
|
82
|
+
`,lo=`graphRef.value.getInstance() will be deprecated
|
|
83
|
+
|
|
84
|
+
It is recommended to use the graphInstance:
|
|
85
|
+
###### Method 1: ######
|
|
86
|
+
|
|
87
|
+
<script setup lang="ts">
|
|
88
|
+
import { useRelationGraph } from 'relation-graph-vue3';
|
|
89
|
+
|
|
90
|
+
const graphOptions = ref<RGOptions>({ ... }); // Your RGOptions here
|
|
91
|
+
const {RelationGraph, graphInstance} = useRelationGraph(); // options is reactive
|
|
92
|
+
|
|
93
|
+
onMounted(() => {
|
|
94
|
+
// Set Data Method 1:
|
|
95
|
+
// Now you can use graphInstance to manipulate the graph data and call APIs.
|
|
96
|
+
graphInstance.setJsonData(...); // Set your initial data\uFF0CThe data will be layout automatically(Use graphOptions.value.layout)
|
|
97
|
+
|
|
98
|
+
// Set Data Method 2:
|
|
99
|
+
// Or set json data by addNodes + addLines directly
|
|
100
|
+
graphInstance.addNodes([{ id:'a' }, { id: 'b'}, { id: 'c'}]);
|
|
101
|
+
graphInstance.addLines([{ from: 'a', to: 'b' }, { from: 'b', to: 'c' }]);
|
|
102
|
+
graphInstance.doLayout('a'); // Use graphOptions.value.layout as default layout algorithm, Use 'a' as the root node id.
|
|
103
|
+
// Tips: How to make different node groups use different layouts: https://www.relation-graph.com/docs/api/layout
|
|
104
|
+
|
|
105
|
+
// After setting data, you can call other APIs as needed
|
|
106
|
+
graphInstance.moveToCenter();
|
|
107
|
+
graphInstance.zoomToFit();
|
|
108
|
+
});
|
|
109
|
+
<\/script>
|
|
110
|
+
<template>
|
|
111
|
+
...
|
|
112
|
+
<RelationGraph :options="graphOptions">
|
|
113
|
+
...
|
|
114
|
+
</RelationGraph>
|
|
115
|
+
...
|
|
116
|
+
</template>
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
###### Method 2: ######
|
|
120
|
+
|
|
121
|
+
import { RGProvider } from 'relation-graph-vue3';
|
|
122
|
+
|
|
123
|
+
<RGProvider>
|
|
124
|
+
<YourComponent>
|
|
125
|
+
<RelationGraph>
|
|
126
|
+
...
|
|
127
|
+
</RelationGraph>
|
|
128
|
+
</YourComponent>
|
|
129
|
+
</RGProvider>
|
|
130
|
+
|
|
131
|
+
// YourComponent.vue file:
|
|
132
|
+
|
|
133
|
+
// ensuring the correct context is provided so that you can access the graphInstance:
|
|
134
|
+
|
|
135
|
+
import { RelationGraph, useGraphInstance } from 'relation-graph-vue3';
|
|
136
|
+
const graphInstance = useGraphInstance();
|
|
137
|
+
|
|
138
|
+
// Now you can use graphInstance to manipulate the graph data and call APIs. This will facilitate data manipulation and API calls.
|
|
139
|
+
|
|
140
|
+
<div>
|
|
141
|
+
...
|
|
142
|
+
<RelationGraph>
|
|
143
|
+
...
|
|
144
|
+
</RelationGraph>
|
|
145
|
+
...
|
|
146
|
+
</div>
|
|
147
|
+
|
|
148
|
+
However, you can still use the current method, but you can only obtain the <RelationGraph> component instance through:
|
|
149
|
+
graphRef.value.getInstance(). in your <YourComponent>;
|
|
150
|
+
And method graphRef.value.getInstance() will be deprecated in future versions.
|
|
151
|
+
|
|
152
|
+
More details: https://www.relation-graph.com/docs/better-integration#vue3
|
|
153
|
+
|
|
154
|
+
Set option "definitelyNoDataProviderNeeded": true to disable the data provider warning if you are sure that no data provider is needed in your case.
|
|
155
|
+
`,co=`graphRef.current.getInstance() will be deprecated
|
|
156
|
+
|
|
157
|
+
It is recommended to use the graphInstance:
|
|
158
|
+
###### Method 1: ######
|
|
159
|
+
|
|
160
|
+
import { useRelationGraph, RGOptions } from 'relation-graph-react';
|
|
161
|
+
|
|
162
|
+
const [graphOptions, setGraphOptions] = useRef<RGOptions>({ ... }); // Your RGOptions here
|
|
163
|
+
const {RelationGraph, graphInstance} = useRelationGraph(); // options is reactive
|
|
164
|
+
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
// Set Data Method 1:
|
|
167
|
+
// Now you can use graphInstance to manipulate the graph data and call APIs.
|
|
168
|
+
graphInstance.setJsonData(...); // Set your initial data\uFF0CThe data will be layout automatically(Use graphOptions.value.layout)
|
|
169
|
+
|
|
170
|
+
// Set Data Method 2:
|
|
171
|
+
// Or set json data by addNodes + addLines directly
|
|
172
|
+
graphInstance.addNodes([{ id:'a' }, { id: 'b'}, { id: 'c'}]);
|
|
173
|
+
graphInstance.addLines([{ from: 'a', to: 'b' }, { from: 'b', to: 'c' }]);
|
|
174
|
+
graphInstance.doLayout('a'); // Use graphOptions.value.layout as default layout algorithm, Use 'a' as the root node id.
|
|
175
|
+
// Tips: How to make different node groups use different layouts: https://www.relation-graph.com/docs/api/layout
|
|
176
|
+
|
|
177
|
+
// After setting data, you can call other APIs as needed
|
|
178
|
+
graphInstance.moveToCenter();
|
|
179
|
+
graphInstance.zoomToFit();
|
|
180
|
+
}, []);
|
|
181
|
+
return (
|
|
182
|
+
<div>
|
|
183
|
+
...
|
|
184
|
+
<RelationGraph options={graphOptions}>
|
|
185
|
+
...
|
|
186
|
+
</RelationGraph>
|
|
187
|
+
...
|
|
188
|
+
</div>
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
###### Method 2: ######
|
|
194
|
+
|
|
195
|
+
import { RGProvider } from 'relation-graph-react';
|
|
196
|
+
|
|
197
|
+
<RGProvider>
|
|
198
|
+
<YourComponent>
|
|
199
|
+
<RelationGraph>
|
|
200
|
+
...
|
|
201
|
+
</RelationGraph>
|
|
202
|
+
</YourComponent>
|
|
203
|
+
</RGProvider>
|
|
204
|
+
|
|
205
|
+
// YourComponent.vue file:
|
|
206
|
+
|
|
207
|
+
// ensuring the correct context is provided so that you can access the graphInstance:
|
|
208
|
+
|
|
209
|
+
import { RelationGraph, useGraphInstance } from 'relation-graph-react';
|
|
210
|
+
const graphInstance = useGraphInstance();
|
|
211
|
+
|
|
212
|
+
// Now you can use graphInstance to manipulate the graph data and call APIs. This will facilitate data manipulation and API calls.
|
|
213
|
+
|
|
214
|
+
<div>
|
|
215
|
+
...
|
|
216
|
+
<RelationGraph>
|
|
217
|
+
...
|
|
218
|
+
</RelationGraph>
|
|
219
|
+
...
|
|
220
|
+
</div>
|
|
221
|
+
|
|
222
|
+
However, you can still use the current method, but you can only obtain the <RelationGraph> component instance through:
|
|
223
|
+
graphRef.current.getInstance(). in your <YourComponent>;
|
|
224
|
+
And method graphRef.value.getInstance() will be deprecated in future versions.
|
|
225
|
+
|
|
226
|
+
More details: https://www.relation-graph.com/docs/better-integration#vue3
|
|
227
|
+
|
|
228
|
+
Set option "definitelyNoDataProviderNeeded": true to disable the data provider warning if you are sure that no data provider is needed in your case.
|
|
229
|
+
`,ho=`Please Initialize the graph using the new method:
|
|
230
|
+
|
|
231
|
+
###### Method 1: ######
|
|
50
232
|
// Use graphInstance to set the data.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
233
|
+
// Set Data Method 1:
|
|
234
|
+
// Now you can use graphInstance to manipulate the graph data and call APIs.
|
|
235
|
+
graphInstance.setJsonData(...); // Set your initial data\uFF0CThe data will be layout automatically(Use graphOptions.value.layout)
|
|
236
|
+
|
|
237
|
+
// Set Data Method 2:
|
|
238
|
+
// Or set json data by addNodes + addLines directly
|
|
239
|
+
graphInstance.addNodes([{ id:'a' }, { id: 'b'}, { id: 'c'}]);
|
|
240
|
+
graphInstance.addLines([{ from: 'a', to: 'b' }, { from: 'b', to: 'c' }]);
|
|
241
|
+
graphInstance.doLayout('a'); // Use graphOptions.value.layout as default layout algorithm, Use 'a' as the root node id.
|
|
242
|
+
// Tips: How to make different node groups use different layouts: https://www.relation-graph.com/docs/api/layout
|
|
243
|
+
|
|
244
|
+
// After setting data, you can call other APIs as needed
|
|
245
|
+
graphInstance.moveToCenter();
|
|
246
|
+
graphInstance.zoomToFit();
|
|
247
|
+
|
|
248
|
+
###### Method 2: ######
|
|
54
249
|
Set the initial data using the "initialData" property of the RelationGraph component.
|
|
55
|
-
|
|
56
|
-
Initialize using the onReady event of the RelationGraph component. then use graphInstance to set the data.`)}}),[]),D.useEffect(()=>{},[]);const n=o=>{console.error("onProviderReady::Index",o),e.current=o};return t?v.jsx(re,{...i,children:i.children}):v.jsx($t,{relationGraphCore:i.relationGraphCore,onProviderReady:n,children:v.jsx(re,{...i,children:i.children})})},_e=ct.default.forwardRef(_n),Ln=({children:i,direction:a,positionH:t,positionV:e})=>{const n=D.useContext($),o=async()=>{await n.refresh(),n.dataUpdated()},s=()=>{n.toggleAutoLayout()},r=async()=>{await n.fullscreen(),n.dataUpdated()},l=async()=>{n.setZoom(100),n.moveToCenter(),n.enableCanvasAnimation(),n.zoomToFit(),setTimeout(()=>{n.disableCanvasAnimation()},300)},c=d=>{n.zoom(d),n.dataUpdated()},h=n&&n.options;return v.jsxs("div",{className:["rg-toolbar","rg-toolbar-h-"+(t||h.toolBarPositionH),"rg-toolbar-v-"+(e||h.toolBarPositionV),"rg-toolbar-"+(a||h.toolBarDirection)].join(" "),children:[v.jsx("div",{className:"rg-mb-button",onClick:()=>{r()},children:v.jsx(K,{iconName:"icon-quanping"})}),v.jsxs(ct.default.Fragment,{children:[v.jsx("div",{className:"rg-mb-button",onClick:()=>{c(20)},children:v.jsx(K,{iconName:"icon-fangda"})}),v.jsxs("div",{className:"rg-current-zoom",onClick:()=>{l()},children:[Math.round(h.canvasZoom),"%"]}),v.jsx("div",{className:"rg-mb-button",onClick:()=>{c(-20)},children:v.jsx(K,{iconName:"icon-suoxiao"})})]}),h.layout.supportAutoLayout&&v.jsx("div",{title:h.layout.autoLayouting?"Stop force":"Start force",className:["rg-mb-button",h.layout.autoLayouting&&"rg-mb-button-on"].join(" "),onClick:()=>{s()},children:h.layout.autoLayouting?v.jsx(K,{iconName:"icon-lianjiezhong",className:"rg-loading-icon"}):v.jsx(K,{iconName:"icon-zidong"})}),v.jsx("div",{className:"rg-mb-button",onClick:()=>{o()},children:v.jsx(K,{iconName:"icon-ico_reset"})}),i,v.jsx("div",{style:{clear:"both"}})]})},wn=({node:i,children:a})=>{const t=D.useRef(null),e=D.useContext($);D.useContext(gt);const n=e.options,o=i.borderWidth===void 0?void 0:`${i.borderWidth}px`,s=i.width?`${i.width}px`:void 0,r=i.height?`${i.height}px`:void 0,l=()=>{const g=t.current;!g||g.offsetWidth===0&&g.offsetHeight===0||(i.el.offsetWidth!==g.offsetWidth||i.el.offsetHeight!==g.offsetHeight)&&e.updateNodeOffsetSize(i.id,g.offsetWidth,g.offsetHeight)};D.useEffect(()=>(l(),e.addNodeResizeListener(t.current,i),()=>{t.current&&e.removeNodeResizeListener(t.current)}),[]);const c=g=>{"button"in g&&g.button!==0||(g.stopPropagation(),e.onNodeDragStart(i,g.nativeEvent))},h=g=>{e.onNodeClick(i,g.nativeEvent)},d=["rg-node-peel",i.selected&&"rg-node-selected",i.dragging&&"rg-node-dragging",i.id===n.checkedNodeId&&"rg-node-peel-checked",i.className].filter(Boolean).join(" "),f=[`rg-node-shape-${i.nodeShape===void 0?1:i.nodeShape}`,`rg-node-type-${i.type}`,i.id===n.checkedNodeId?"rg-node-checked":"","rg-node"].filter(Boolean).join(" "),p={transform:`translate(${i.x}px, ${i.y}px)`,"--rg-node-z-index":i.zIndex,"--rg-node-opacity":i.opacity,pointerEvents:i.opacity===0?"none":void 0,"--rg-node-color":i.color||n.defaultNodeColor,"--rg-node-font-color":i.fontColor,"--rg-node-font-size":i.fontSize?`${i.fontSize}px`:void 0,"--rg-node-border-width":o,"--rg-node-border-radius":i.borderRadius?`${i.borderRadius}px`:void 0,"--rg-node-border-color":i.borderColor};return v.jsx("div",{ref:t,style:p,className:d,"data-id":i.id,children:v.jsx("div",{className:f,style:{width:s,height:r},onClick:h,onMouseDown:c,onTouchStart:c,children:a||v.jsx("div",{className:"rg-node-text",children:v.jsx("span",{children:i.text})})})})},bn=({children:i})=>v.jsx(v.Fragment,{}),On=({children:i})=>{D.useContext(Q);const a=D.useContext($),t=a&&a.options;if(!t.editingController.show||t.snapshotting)return null;const e={width:t.editingController.width+"px",height:t.editingController.height+"px",transform:`translate(${t.editingController.x}px, ${t.editingController.y}px)`};return v.jsx("div",{className:"rg-editing-ctrl",style:e,children:i})},Sn=({disableResizeWidth:i,disableResizeHeight:a,beforeResizeStart:t})=>{const e=D.useContext($);D.useContext(Q);const n=e&&e.options,o=(s,r)=>{r.stopPropagation(),t&&t(),e.onResizeStart(s,r.nativeEvent)};return v.jsxs("div",{className:"rg-resize-ctl",children:[n.editingController.width>30&&!i&&!a&&v.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-tl",onMouseDown:s=>o("tl",s)}),n.editingController.width>30&&!i&&!a&&v.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-tr",onMouseDown:s=>o("tr",s)}),n.editingController.width>30&&!i&&!a&&v.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-bl",onMouseDown:s=>o("bl",s)}),!i&&!a&&v.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-br",onMouseDown:s=>o("br",s)}),(n.editingController.width>60||i)&&!a&&v.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-t",onMouseDown:s=>o("t",s)}),(n.editingController.width>60||i)&&!a&&v.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-b",onMouseDown:s=>o("b",s)}),(n.editingController.height>60||a)&&!i&&v.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-l",onMouseDown:s=>o("l",s)}),(n.editingController.height>60||a)&&!i&&v.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-r",onMouseDown:s=>o("r",s)})]})},Mn=({position:i="br",width:a,height:t})=>{const e=D.useContext($);D.useContext(Q);const n=e&&e.options,o=D.useRef(null),s=D.useRef(null);D.useEffect(()=>(n.showMiniView=!0,e.setMiniViewCanvas(s.current),()=>{n.showMiniView=!1}),[]);const r=c=>{e.onVisiableViewHandleDragStart(c.nativeEvent)},l=async c=>{e.resetByVisiableView(c.nativeEvent)};return v.jsx("div",{className:`rg-miniview rg-miniview-${i}`,ref:o,style:{"--miniview-width":a,"--miniview-height":t},children:v.jsxs("div",{className:"rg-miniview-container",children:[v.jsx("canvas",{ref:s,className:n.miniViewVisibleHandle.emptyContent?"rg-mv-canvas-reset":"",onClick:l}),v.jsx("div",{className:"rg-mv-visible-area",onMouseDown:r,style:{left:`${n.miniViewVisibleHandle.x}px`,top:`${n.miniViewVisibleHandle.y}px`,width:n.miniViewVisibleHandle.width+"px",height:n.miniViewVisibleHandle.height+"px"}})]})})},Nn=({children:i,forDisplay:a,forImage:t,position:e,width:n,height:o})=>{const s=D.useContext($);D.useContext(Q);const r=s&&s.options,l=D.useRef(null);D.useEffect(()=>(s.setWatermarkDom(l.current,t,a,e),()=>{s.setWatermarkDom(null,a,t)}),[n,o]);let c=!1;return r.snapshotting?t===!1?c=!1:c=!0:a===!0?c=!0:c=!1,v.jsx("div",{className:`rg-watermark rg-watermark-${e||"br"}`,style:{display:c?"block":"none","--watermark-width":n,"--watermark-height":o},ref:l,children:i})},Tn=({children:i,forDisplay:a,forImage:t})=>{const e=D.useContext($),n=D.useRef(null);return D.useEffect(()=>(n.current.style.backgroundColor="transparent",e.setBackgroundDom(n.current,a,t),()=>{e.setBackgroundDom(null,a,t)}),[]),v.jsx("div",{className:"rg-background",ref:n,children:i})},En=({position:i,children:a})=>{const t=i||"top";return v.jsx("div",{className:`rg-editing-bar rg-editing-bar-${t}`,children:a})},Dn=({textEditable:i=!0,moveLineVertexStart:a,moveLineVertexEnd:t,onLineTextDragEnd:e,onLineTextChanged:n,children:o})=>{const s=D.useContext($);D.useContext(Q);const l=s.options.editingLineController,c=l.line,h=l.show,d=c&&c.text,[f,p]=D.useState(!1),[g,u]=D.useState(""),x=D.useRef(0),y=D.useRef(null);D.useEffect(()=>{h||p(!1)},[h]),D.useEffect(()=>{d!==g&&u(d||"")},[d]),D.useEffect(()=>{s.updateEditingLineView()},[g,c==null?void 0:c.lineShape]),D.useEffect(()=>{f&&y.current&&y.current.focus()},[f]);const L=(I,Y)=>{!c||(a&&a(I,c),s.startMoveLineVertex(I,Y.nativeEvent,(U,W,G)=>{t&&t(U,W,G),s.defaultLineVertexBeChangedHandler(U,W,G)}))},m=(I,Y)=>{s.startMoveLine6CtrlPoint(I,Y.nativeEvent)},w=(I,Y)=>{s.startMoveLine44CtrlPoint(I,Y.nativeEvent)},b=I=>{s.startMoveLineText(I.nativeEvent,()=>{c&&e&&e(c)})},M=()=>{x.current&&Date.now()-x.current<500&&p(!0),x.current=Date.now()},N=I=>{c&&c.text!==I.target.value&&(c.text=I.target.value,u(I.target.value),n&&n(c)),p(!1)};if(!h||!c)return null;const{startPoint:O,endPoint:E,ctrlPoint1:T,ctrlPoint2:k,line44Splits:P,text:_}=l,{lineShape:X}=c,H=`M ${O.x} ${O.y} L ${(T==null?void 0:T.x)||0} ${(T==null?void 0:T.y)||0}`,B=`M ${E.x} ${E.y} L ${(k==null?void 0:k.x)||0} ${(k==null?void 0:k.y)||0}`;return v.jsxs("div",{className:"rg-editing-line-ctrl",children:[o,v.jsx("svg",{className:"rg-edt-ctrl-svg",xmlns:"http://www.w3.org/2000/svg",children:v.jsxs("g",{children:[X===6&&T&&v.jsx("path",{d:H}),X===6&&k&&v.jsx("path",{d:B})]})}),v.jsx("div",{className:"rg-line-ctrl-dot start-dot",style:{"--rg-ctl-x":O.x+"px","--rg-ctl-y":O.y+"px"},onMouseDown:I=>L("start",I)}),v.jsx("div",{className:"rg-line-ctrl-dot end-dot",style:{"--rg-ctl-x":E.x+"px","--rg-ctl-y":E.y+"px"},onMouseDown:I=>L("end",I)}),X===6&&T&&v.jsx("div",{className:"rg-line-ctrl-dot ctrl-dot",style:{"--rg-ctl-x":T.x+"px","--rg-ctl-y":T.y+"px"},onMouseDown:I=>m(0,I)}),X===6&&k&&v.jsx("div",{className:"rg-line-ctrl-dot ctrl-dot",style:{"--rg-ctl-x":k.x+"px","--rg-ctl-y":k.y+"px"},onMouseDown:I=>m(1,I)}),(X===44||X===49)&&P.map(I=>!I.hide&&v.jsx("div",{className:`rg-line-ctrl-dot ctrl-split ${I.optionName.startsWith("cp-")?"":"ctrl-split-core"} ${I.direction==="v"?"ctrl-split-v":""} ${I.direction==="h"?"ctrl-split-h":""}`,style:{"--rg-ctl-x":I.x+"px","--rg-ctl-y":I.y+"px"},onMouseDown:Y=>w(I,Y)},I.optionName)),i&&c&&v.jsx("div",{className:["rg-line-ctrl-text",f&&"rg-line-ctrl-text-editing"].filter(Boolean).join(" "),style:{"--rg-ctl-x":l.text.x+"px","--rg-ctl-y":l.text.y+"px"},onClick:M,onMouseDown:b,children:f?v.jsx("input",{ref:y,className:"rg-line-text-input",value:g,onChange:I=>u(I.target.value),onBlur:N}):g?v.jsx("p",{children:g}):v.jsx("p",{className:"empty-text",children:"Add Text..."})})]})},Le=({mouseUpOnJunctionPointWithOffset:i,mouseUpOnJunctionPoint:a})=>v.jsxs("div",{className:"rg-connect-ctl",onMouseUp:t=>a("",t),onTouchEnd:t=>a("",t),children:[v.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-t","data-point":"top",onMouseUp:t=>a("top",t),onTouchEnd:t=>a("top",t)}),v.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-b","data-point":"bottom",onMouseUp:t=>a("bottom",t),onTouchEnd:t=>a("bottom",t)}),v.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-center","data-point":"border",onMouseUp:t=>a("border",t),onTouchEnd:t=>a("border",t)}),v.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-l","data-point":"left",onMouseUp:t=>a("left",t),onTouchEnd:t=>a("left",t)}),v.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-r","data-point":"right",onMouseUp:t=>a("right",t),onTouchEnd:t=>a("right",t)}),v.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-lr","data-point":"lr",onMouseUp:t=>a("lr",t),onTouchEnd:t=>a("lr",t)}),v.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-tb","data-point":"tb",onMouseUp:t=>a("tb",t),onTouchEnd:t=>a("tb",t)}),v.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-bottom-bar","data-point":"bottom","data-innode":"true",onMouseUp:t=>i("bottom",t),onTouchEnd:t=>onMouseUpWithOffset("bottom",t)}),v.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-top-bar","data-point":"top","data-innode":"true",onMouseUp:t=>i("top",t),onTouchEnd:t=>onMouseUpWithOffset("top",t)}),v.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-left-bar","data-point":"left","data-innode":"true",onMouseUp:t=>i("left",t),onTouchEnd:t=>onMouseUpWithOffset("left",t)}),v.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-right-bar","data-point":"right","data-innode":"true",onMouseUp:t=>i("right",t),onTouchEnd:t=>onMouseUpWithOffset("right",t)})]}),kn=({children:i})=>{const a=D.useContext($);D.useContext(Q);const t=D.useRef(),e=a&&a.options;if(!e.nodeConnectController.show)return v.jsx(v.Fragment,{});const n=(s,r)=>{a.onLineVertexBeDroppedOnConnectController(s,r,void 0,(l,c,h)=>{C("onLineVertexBeDropped:callback:",h)})},o=(s,r)=>{a.onLineVertexBeDroppedOnConnectController(s,r,t.current,(l,c,h)=>{C("onLineVertexBeDropped:callback:",h)})};return v.jsx("div",{className:"rg-editing-connect-ctrl",ref:t,style:{transform:`translate(${e.nodeConnectController.x}px, ${e.nodeConnectController.y}px)`,width:e.nodeConnectController.width+"px",height:e.nodeConnectController.height+"px"},children:i||v.jsx(Le,{mouseUpOnJunctionPoint:n,mouseUpOnJunctionPointWithOffset:o})})},Pn=({fromNode:i,lineTemplate:a,onConnectStart:t,onConnectEnd:e,children:n,className:o,style:s})=>{const r=D.useContext($),l=c=>{t&&t(i,a,c.nativeEvent),c.stopPropagation(),r.startCreateLineFromNode(i,a,c.nativeEvent,(h,d,f)=>{e&&e(h,d,f),r.defaultLineConnectEndHandler(h,d,f)})};return v.jsx("div",{className:`rg-connect-source-handle ${o||""}`,style:s,onMouseDown:c=>l(c),onClick:c=>{c.stopPropagation()},children:n})},In=({children:i,className:a,style:t,junctionPoint:e,targetId:n,targetType:o,targetData:s,lineTemplate:r,disableDrop:l,disableDrag:c,onLineVertexBeDropped:h,onDragConnectStart:d,onDragConnectEnd:f})=>{const p=D.useContext($),g=D.useRef(),[u,x]=D.useState();D.useEffect(()=>{const m=p.registerConnectTarget(g.current,n,o||F.CanvasPoint,e,s);return x(m),()=>{p.unregisterConnectTarget(n)}},[]);const y=(m,w)=>{w.stopPropagation(),!l&&p.onLineVertexBeDropped(m,w.nativeEvent,void 0,(b,M,N)=>{h&&h(b,M,N)})},L=m=>{if(m.stopPropagation(),c||p.options.creatingLinePlot)return;const w=Object.assign({},r||{});w.from||(w.from=(u==null?void 0:u.targetId)||n,w.fromType=(u==null?void 0:u.targetType)||o),w.fromJunctionPoint||(w.fromJunctionPoint=(u==null?void 0:u.junctionPoint)||e),w.fromType||(w.fromType=F.Node),d&&d(w,m.nativeEvent),p.startCreateLineFromNode(null,w,m.nativeEvent,(b,M,N)=>{f&&f(b,M,N)})};return v.jsx("div",{ref:g,className:`rg-connect-ctl-handler rg-connect-target ${a||""}`,style:t,"data-point":e,"data-target-id":n,"data-target-type":o||F.CanvasPoint,"data-target-data":JSON.stringify(s),onMouseDown:m=>L(m),onMouseUp:m=>y(e,m),onClick:m=>{m.stopPropagation()},children:i})},An=({showText:i,adsorption:a})=>{const t=D.useContext($),e=t&&t.options;return D.useEffect(()=>(e.editingReferenceLine.show=!0,e.showReferenceLine=!0,e.referenceLineAdsorption=a||!1,()=>{e.editingReferenceLine.show=!1}),[e]),v.jsxs("div",{className:"rg-editing-referline",style:{display:e.editingReferenceLine.show?"block":"none"},children:[e.editingReferenceLine.directionV&&v.jsx("div",{className:"rg-referline rg-referline-v",style:{transform:`translate(${e.editingReferenceLine.v_x}px, ${e.editingReferenceLine.v_y}px)`,height:e.editingReferenceLine.v_height+"px"},children:v.jsx("div",{className:"referline",children:i!==!1&&v.jsxs("div",{children:[Math.round(e.editingReferenceLine.v_height),"px"]})})}),e.editingReferenceLine.directionH&&v.jsx("div",{className:"rg-referline rg-referline-h",style:{transform:`translate(${e.editingReferenceLine.h_x}px, ${e.editingReferenceLine.h_y}px)`,width:e.editingReferenceLine.h_width+"px"},children:v.jsx("div",{className:"referline",children:i!==!1&&v.jsxs("div",{children:[Math.round(e.editingReferenceLine.h_width),"px"]})})})]})},Vn=i=>{const a=D.useContext($),t=D.useRef(),e={backgroundColor:"transparent",textWrap:"unset",position:"relative",width:"100%",height:"fit-content"};return D.useEffect(()=>{C("[RGCanvas mounted]"),a.setCanvasDom(t.current)},[]),v.jsxs("div",{style:{"--bg-background-color":a.options.backgroundColor,"--rg-node-color":a.options.defaultNodeColor,"--rg-line-color":a.options.defaultLineColor},className:["rg-map",a.options.canvasOpacity===1?"rg-map-ready":""].join(" "),children:[v.jsx("div",{style:{...e,position:"relative",pointerEvents:"all",userSelect:"text"},className:"rg-map-canvas rg-canvas-behind",children:v.jsx("div",{className:"rg-canvas-slot rg-canvas-slot-behind",children:i.canvasPlugBehindSlot})}),v.jsx("div",{ref:t,style:{...e,pointerEvents:"none",userSelect:"none",left:"0px",top:"0px",zIndex:9},className:"rg-map-canvas",children:v.jsx(ne,{svgDefs:i.svgDefs,lineSlot:i.lineSlot})})]})},we=i=>{const a=D.useContext($);D.useContext(Q);const t=D.useRef(),[e,n]=D.useState(!1);D.useEffect(()=>{Zt("React-Linker-Board"),a.setOptions(i.options||{});const g=se(i);return C("[RelationGraph]mounted:listeners:",g),a.setListeners(g),C("[RelationGraph]setDom:",t.current),a.setDom(t.current),n(!0),a.ready(),a.dataUpdated(),i.links&&(C("[RelationGraph] apply data"),(async()=>await a.setJsonData({fakeLines:i.links}))()),()=>{a.beforeUnmount()}},[]);const o=a&&a.options;let s;const r=[],l=[],c=[],h=ct.default.Children.toArray(i.children).filter(g=>{if(g&&ct.default.isValidElement(g))if(g.type===Et){const u=g.props.children;if(typeof u=="function")s=u;else throw new Error('RGSlotOnLine children must be a function, e.g. <RGSlotOnLine>{ (line: RGLine) => <g><path d="..." /><text>{line.text}</text></g> }</RGSlotOnLine>')}else{if(g.type===wt)return r.push(g.props.children),!1;if(g.type===Dt)return l.push(g.props.children),!1;if(g.type===kt)return!1;if(g.type===ae)return c.push(g.props.children),!1}return!0}),d=r,f=l.concat(...h);if(s&&i.lineSlot)throw new Error("You can only provide lineSlot or RGSlotOnLine, but not both.");const p=s||i.lineSlot;return v.jsx("div",{ref:t,id:`relation-graph-ins-${o==null?void 0:o.instanceId}`,className:["relation-graph",(o==null?void 0:o.creatingLinePlot)&&"rg-creating-line"].filter(Boolean).join(" "),tabIndex:1,style:{width:"100%",height:"fit-content",opacity:e?1:0,"--rg-checked-line-bg-color":o==null?void 0:o.checkedItemBackgroundColor},children:e&&o&&v.jsxs(v.Fragment,{children:[v.jsx(Vn,{lineSlot:p,svgDefs:c,canvasPlugBehindSlot:f}),v.jsx(oe,{}),v.jsx("div",{className:"rg-graph-plugs",children:v.jsx("div",{className:"rg-graph-slot",children:d})})]})})},zn=(i,a)=>{const t=D.useContext($),e=D.useRef(i.relationGraphInstance);D.useImperativeHandle(a,()=>({getInstance(){return t||e.current}}),[]),D.useEffect(()=>{},[]);const n=o=>{console.error("onProviderReady::Index",o),e.current=o,e.current._rgAsConnectArea=!0};return t&&!t._rgAsConnectArea&&(t._rgAsConnectArea=!0),t?v.jsx(we,{...i,children:i.children}):v.jsx($t,{relationGraphCore:i.relationGraphCore,onProviderReady:n,children:v.jsx(we,{...i,children:i.children})})},Bn=ct.default.forwardRef(zn),Xn={BaseLayouter:pt,BidirectionalTreeLayouter:ce,CenterLayouter:he,CircleLayouter:de,FixedLayouter:fe,ForceLayouter:yt,RGFolderLayouter:ge},Fn={RGOptionsDataUtils:We,RGLineDataUtils:Ge,RGNodeDataUtils:Xe,RGGraphMath:j,RGNodesAnalyticUtils:z,RGEffectUtils:Z};function Gn(){return D.useContext($)}function Hn(){return D.useContext(Q)}function $n(i){if(!i||!i.options.creatingLinePlot)return{creating:!1};const{line:a,from:t,to:e}=i.generateCreatingLineConfig();return{creating:!0,fromTarget:t,toTarget:e,lineJson:a}}function Rn(i){return!i||!i.options.creatingNodePlot?{creating:!1}:{creating:!0,nodeJson:i.options.newNodeTemplate}}const Yn={useGraphInstance:Gn,useAutoUpdateView:Hn,useCreatingLine:$n,useCreatingNode:Rn},Wn=Wt,Un=Ce,Zn=Xn,Jn=Fn,jn=wn,qn=Kt,Qn=Qt,Kn=Ln,to=Jt,eo=ie,no=Mn,oo=Tn,io=Nn,so=On,ao=Sn,ro=En,lo=Dn,co=kn,ho=Pn,fo=In,go=Le,uo=An,po=wt,yo=wt,mo=kt,vo=Dt,be=bn,xo=Et,Co=Bn,_o=$t,Lo=_e;V.RGBackground=oo,V.RGConnectSource=ho,V.RGConnectTarget=fo,V.RGDirection=le,V.RGEditingConnectController=co,V.RGEditingConnectPoints=go,V.RGEditingLineController=lo,V.RGEditingNearNodeWidget=ro,V.RGEditingNodeController=so,V.RGEditingReferenceLine=uo,V.RGEditingResize=ao,V.RGEventNames=A,V.RGFakeNode=jn,V.RGHooks=Yn,V.RGInnerConnectTargetType=F,V.RGInstanceContext=$,V.RGJunctionPoint=J,V.RGLayout=Zn,V.RGLinePath=qn,V.RGLineShape=R,V.RGLineText=Qn,V.RGMiniToolBar=eo,V.RGMiniView=no,V.RGNodeExpandHolder=to,V.RGNodeShape=Pt,V.RGProvider=_o,V.RGSlotOnCanvas=vo,V.RGSlotOnCanvasAbove=mo,V.RGSlotOnGraph=po,V.RGSlotOnLine=xo,V.RGSlotOnNode=be,V.RGSlotOnView=yo,V.RGToolBar=Kn,V.RGUpdateContext=gt,V.RGUpdateSignalContext=Q,V.RGUpdateSingalContext=Q,V.RGUtils=Jn,V.RGWatermark=io,V.RelationGraph=Lo,V.RelationGraphCore=Un,V.RelationGraphStoreContext=$,V.RelationLinker=Co,V.default=_e,V.version=Wn,Object.defineProperties(V,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
250
|
+
|
|
251
|
+
###### Method 3: ######
|
|
252
|
+
Initialize using the onReady event of the RelationGraph component. then use graphInstance to set the data.
|
|
253
|
+
|
|
254
|
+
###### More Method: ######
|
|
255
|
+
https://www.relation-graph.com/docs.'
|
|
256
|
+
`,fo=`Please Initialize the graph using the new method:
|
|
257
|
+
|
|
258
|
+
###### Method 1: ######
|
|
259
|
+
// Use graphInstance to set the data.
|
|
260
|
+
const graphInstance = this.graphInstance; // this.graphInstance is obtained through inject('graphInstance').
|
|
261
|
+
// Set Data Method 1:
|
|
262
|
+
// Now you can use graphInstance to manipulate the graph data and call APIs.
|
|
263
|
+
graphInstance.setJsonData(...); // Set your initial data\uFF0CThe data will be layout automatically(Use graphOptions.value.layout)
|
|
264
|
+
|
|
265
|
+
// Set Data Method 2:
|
|
266
|
+
// Or set json data by addNodes + addLines directly
|
|
267
|
+
graphInstance.addNodes([{ id:'a' }, { id: 'b'}, { id: 'c'}]);
|
|
268
|
+
graphInstance.addLines([{ from: 'a', to: 'b' }, { from: 'b', to: 'c' }]);
|
|
269
|
+
graphInstance.doLayout('a'); // Use graphOptions.value.layout as default layout algorithm, Use 'a' as the root node id.
|
|
270
|
+
// Tips: How to make different node groups use different layouts: https://www.relation-graph.com/docs/api/layout
|
|
271
|
+
|
|
272
|
+
// After setting data, you can call other APIs as needed
|
|
273
|
+
graphInstance.moveToCenter();
|
|
274
|
+
graphInstance.zoomToFit();
|
|
275
|
+
|
|
276
|
+
###### Method 2: ######
|
|
277
|
+
Set the initial data using the "initialData" property of the RelationGraph component.
|
|
278
|
+
|
|
279
|
+
###### Method 3: ######
|
|
280
|
+
Initialize using the onReady event of the RelationGraph component. then use graphInstance to set the data.
|
|
281
|
+
|
|
282
|
+
###### More Method: ######
|
|
283
|
+
https://www.relation-graph.com/docs.'
|
|
284
|
+
`,kt={Vue3GetInstance:Te(lo),ReactGetInstance:Te(co),Vue2GetInstance:Te(ro),setJsonData:Te(ho),setJsonData4Vue2:Te(fo)},uo=(s,i)=>{const e=Ue(s.relationGraphCore);return I.useImperativeHandle(i,()=>({getInstance(){var t;return(t=s.options)!=null&&t.definitelyNoDataProviderNeeded||console.warn("[relation-graph]",kt.ReactGetInstance),e},async setJsonData(){throw new Error(kt.setJsonData)}}),[]),x.jsx(qe,{graphInstance:e,children:x.jsx(pt,{...s})})},It=pe.default.forwardRef(uo);function go(s={}){const i=Ue(s.relationGraphCore);return{RelationGraph:I.useMemo(()=>{console.log("Creating a MemoizedRelationGraph...");const t=n=>x.jsx(qe,{graphInstance:i,children:x.jsx(pt,{...n,children:n.children})});return t.displayName="RelationGraph",t},[]),graphInstance:i}}const Et={useRelationGraph:go,useGraphInstance:$,useAutoUpdateView:ie,useCreatingLine:$t,useCreatingNode:Ut,useEditingNodes:qt,useEditingLine:jt,useViewInformation:Zt,useSelection:Qt,useConnectingNode:Jt,useCheckedItem:Kt,useGraphStore:J},po=({children:s})=>{const i=$();ie();const{options:e}=J(),[t,n]=I.useState(!1),o=()=>{n(!t)},a=()=>{i.printOptions()},r=()=>{i.getGraphJsonData()},l=()=>{i.enableDebugLog(!e.debug),C("debugLog:",e.debug),updateView()};return x.jsxs("div",{children:[x.jsx("div",{className:"rg-setting-panel-button",onClick:()=>{o()},children:"Debug"}),t&&x.jsxs("div",{className:"rg-setting-panel",children:[x.jsx("div",{className:"c-debug-tools-row",children:x.jsx("button",{onClick:()=>{a()},children:"print options in console"})}),x.jsx("div",{className:"c-debug-tools-row",children:x.jsx("button",{onClick:()=>{r()},children:"print json data in console"})}),x.jsxs("div",{className:"c-debug-tools-row",children:["debug log status: ",e.debug?"true":"false",x.jsxs("button",{onClick:()=>{l()},children:[e.debug?"disable":"enable"," debug log"]})]}),s]})]})},yo=({children:s,direction:i,positionH:e,positionV:t})=>{const n=$(),{options:o}=J(),a=async()=>{await n.refresh(),n.dataUpdated()},r=()=>{n.toggleAutoLayout()},l=async()=>{await n.fullscreen(),n.dataUpdated()},c=async()=>{n.setZoom(100),n.moveToCenter(),n.enableCanvasAnimation(),n.zoomToFit(),setTimeout(()=>{n.disableCanvasAnimation()},300)},d=h=>{n.zoom(h),n.dataUpdated()};return x.jsxs("div",{className:["rg-toolbar","rg-toolbar-h-"+(e||o.toolBarPositionH),"rg-toolbar-v-"+(t||o.toolBarPositionV),"rg-toolbar-"+(i||o.toolBarDirection)].join(" "),children:[x.jsx("div",{className:"rg-mb-button",onClick:()=>{l()},children:x.jsx(ne,{iconName:"icon-quanping"})}),x.jsxs(pe.default.Fragment,{children:[x.jsx("div",{className:"rg-mb-button",onClick:()=>{d(20)},children:x.jsx(ne,{iconName:"icon-fangda"})}),x.jsxs("div",{className:"rg-current-zoom",onClick:()=>{c()},children:[Math.round(o.canvasZoom),"%"]}),x.jsx("div",{className:"rg-mb-button",onClick:()=>{d(-20)},children:x.jsx(ne,{iconName:"icon-suoxiao"})})]}),o.layout.supportAutoLayout&&x.jsx("div",{title:o.layout.autoLayouting?"Stop force":"Start force",className:["rg-mb-button",o.layout.autoLayouting&&"rg-mb-button-on"].join(" "),onClick:()=>{r()},children:o.layout.autoLayouting?x.jsx(ne,{iconName:"icon-lianjiezhong",className:"rg-loading-icon"}):x.jsx(ne,{iconName:"icon-zidong"})}),x.jsx("div",{className:"rg-mb-button",onClick:()=>{a()},children:x.jsx(ne,{iconName:"icon-ico_reset"})}),s,x.jsx("div",{style:{clear:"both"}})]})},vo=({node:s,children:i})=>{const e=I.useRef(null),t=$();ie();const{options:n}=J(),o=s.borderWidth===void 0?void 0:`${s.borderWidth}px`,a=s.width?s.width+"px":void 0,r=s.height?s.height+"px":void 0;I.useEffect(()=>(t.addNodeResizeListener(e.current,s),()=>{e.current&&t.removeNodeResizeListener(e.current)}),[]);const l=h=>{"button"in h&&h.button!==0||(h.stopPropagation(),t.onNodeDragStart(s,h.nativeEvent))},c=["rg-node-peel",s.selected&&"rg-node-selected",s.id===n.draggingNodeId&&"rg-node-dragging",s.id===n.checkedNodeId&&"rg-node-checked",`rg-node-shape-${s.nodeShape===void 0?1:s.nodeShape}`,`rg-node-type-${s.type}`,s.className].filter(Boolean).join(" "),d={transform:`translate(${s.x}px, ${s.y}px)`,"--rg-node-z-index":s.zIndex,"--rg-node-opacity":s.opacity,pointerEvents:s.opacity===0?"none":void 0,"--rg-node-color":s.color||n.defaultNodeColor,"--rg-node-font-color":s.fontColor,"--rg-node-font-size":s.fontSize?`${s.fontSize}px`:void 0,"--rg-node-border-width":o,"--rg-node-width":a,"--rg-node-height":r,"--rg-node-border-radius":s.borderRadius?`${s.borderRadius}px`:void 0,"--rg-node-border-color":s.borderColor};return x.jsx("div",{ref:e,style:d,className:c,"data-id":s.id,children:x.jsx("div",{className:"rg-node",onMouseDown:l,onTouchStart:l,children:i||x.jsx("div",{className:"rg-node-text",children:x.jsx("span",{children:s.text})})})})},mo=({children:s})=>x.jsx(x.Fragment,{}),xo=({children:s})=>{const{options:i}=J();if(!i.editingController.show)return null;const e={width:i.editingController.width+"px",height:i.editingController.height+"px",transform:`translate(${i.editingController.x}px, ${i.editingController.y}px)`};return x.jsx("div",{className:"rg-editing-ctrl",style:e,children:s})},Co=({disableResizeWidth:s,disableResizeHeight:i,beforeResizeStart:e})=>{const t=$(),{options:n}=J(),o=(a,r)=>{r.stopPropagation(),e&&e(),t.onResizeStart(a,r.nativeEvent)};return x.jsxs("div",{className:"rg-resize-ctl",children:[n.editingController.width>30&&!s&&!i&&x.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-tl",onMouseDown:a=>o("tl",a)}),n.editingController.width>30&&!s&&!i&&x.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-tr",onMouseDown:a=>o("tr",a)}),n.editingController.width>30&&!s&&!i&&x.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-bl",onMouseDown:a=>o("bl",a)}),!s&&!i&&x.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-br",onMouseDown:a=>o("br",a)}),(n.editingController.width>60||s)&&!i&&x.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-t",onMouseDown:a=>o("t",a)}),(n.editingController.width>60||s)&&!i&&x.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-b",onMouseDown:a=>o("b",a)}),(n.editingController.height>60||i)&&!s&&x.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-l",onMouseDown:a=>o("l",a)}),(n.editingController.height>60||i)&&!s&&x.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-r",onMouseDown:a=>o("r",a)})]})},Lo=({className:s,style:i,position:e="br",width:t,height:n})=>{const o=$();ie();const{options:a}=J(),r=I.useRef(null),l=I.useRef(null);I.useEffect(()=>(o.onMiniViewMounted(),o.setMiniViewCanvas(l.current),()=>{o.onMiniViewUnMounted()}),[]);const c=h=>{o.onVisibleViewHandleDragStart(h.nativeEvent)},d=async h=>{o.resetByVisiableView(h.nativeEvent)};return x.jsx("div",{className:`rg-miniview rg-miniview-${e} ${s||""}`,ref:r,style:{...i,"--miniview-width":t,"--miniview-height":n},children:x.jsxs("div",{className:"rg-miniview-container",children:[x.jsx("canvas",{ref:l,className:a.miniViewVisibleHandle.emptyContent?"rg-mv-canvas-reset":"",onClick:d}),x.jsx("div",{className:"rg-mv-visible-area",onMouseDown:c,style:{transform:`translate(${a.miniViewVisibleHandle.x}px, ${a.miniViewVisibleHandle.y}px)`,width:a.miniViewVisibleHandle.width+"px",height:a.miniViewVisibleHandle.height+"px"}})]})})},wo=({children:s,forDisplay:i,forImage:e,position:t,width:n,height:o})=>{const a=$();ie();const{options:r}=J(),l=I.useRef(null);I.useEffect(()=>(a.setWatermarkDom(l.current,e,i,t),()=>{a.setWatermarkDom(null,i,e)}),[n,o]);let c=!1;return r.snapshotting?e===!1?c=!1:c=!0:i===!0?c=!0:c=!1,x.jsx("div",{className:`rg-watermark rg-watermark-${t||"br"}`,style:{display:c?"block":"none","--watermark-width":n,"--watermark-height":o},ref:l,children:s})},No=({children:s,forDisplay:i,forImage:e})=>{const t=$(),n=I.useRef(null);return I.useEffect(()=>(t.setBackgroundDom(n.current,i,e),()=>{t.setBackgroundDom(null,i,e)}),[]),x.jsx("div",{className:"rg-background",ref:n,children:s})},_o=({position:s,children:i})=>{const e=s||"top";return x.jsx("div",{className:`rg-editing-bar rg-editing-bar-${e}`,children:i})},bo=({textEditable:s=!0,onMoveLineVertexStart:i,onMoveLineVertexEnd:e,onLineTextDragEnd:t,onLineTextChanged:n,onLinePathChanged:o,children:a})=>{const r=$();ie();const{options:l}=J(),c=l.editingLineController,d=c.line,h=c.show,u=d&&d.text,[y,f]=I.useState(!1),[g,v]=I.useState(""),p=I.useRef(0),m=I.useRef(null);I.useEffect(()=>{h||f(!1)},[h]),I.useEffect(()=>{u!==g&&v(u||"")},[u]),I.useEffect(()=>{r.updateEditingLineView()},[g,d==null?void 0:d.lineShape]),I.useEffect(()=>{y&&m.current&&m.current.focus()},[y]);const L=(D,U)=>{!d||(i&&i(D,d),r.startMoveLineVertex(D,U.nativeEvent,(q,ee,K)=>{e&&e(q,ee,K),r.defaultLineVertexBeChangedHandler(q,ee,K)}))},_=(D,U)=>{r.startMoveLine6CtrlPoint(D,U.nativeEvent,q=>{o&&o(q,D)})},S=(D,U)=>{r.startMoveLine44CtrlPoint(D,U.nativeEvent,q=>{o&&o(q,D)})},b=D=>{r.startMoveLineText(D.nativeEvent,()=>{d&&t&&t(d)})},O=()=>{p.current&&Date.now()-p.current<500&&f(!0),p.current=Date.now()},T=D=>{d&&d.text!==D.target.value&&(r.updateLine(d.id,{text:D.target.value}),v(D.target.value),n&&n(d)),f(!1)};if(!h||!d)return null;const{startPoint:k,endPoint:E,ctrlPoint1:P,ctrlPoint2:M,line44Splits:w,text:A}=c,{lineShape:X}=d,z=`M ${k.x} ${k.y} L ${(P==null?void 0:P.x)||0} ${(P==null?void 0:P.y)||0}`,F=`M ${E.x} ${E.y} L ${(M==null?void 0:M.x)||0} ${(M==null?void 0:M.y)||0}`;return x.jsxs("div",{className:"rg-editing-line-ctrl",children:[a,x.jsx("svg",{className:"rg-edt-ctrl-svg",xmlns:"http://www.w3.org/2000/svg",children:x.jsxs("g",{children:[X===6&&P&&x.jsx("path",{d:z}),X===6&&M&&x.jsx("path",{d:F})]})}),x.jsx("div",{className:"rg-line-ctrl-dot start-dot",style:{"--rg-ctl-x":k.x+"px","--rg-ctl-y":k.y+"px"},onMouseDown:D=>L("start",D)}),x.jsx("div",{className:"rg-line-ctrl-dot end-dot",style:{"--rg-ctl-x":E.x+"px","--rg-ctl-y":E.y+"px"},onMouseDown:D=>L("end",D)}),X===6&&P&&x.jsx("div",{className:"rg-line-ctrl-dot ctrl-dot",style:{"--rg-ctl-x":P.x+"px","--rg-ctl-y":P.y+"px"},onMouseDown:D=>_(0,D)}),X===6&&M&&x.jsx("div",{className:"rg-line-ctrl-dot ctrl-dot",style:{"--rg-ctl-x":M.x+"px","--rg-ctl-y":M.y+"px"},onMouseDown:D=>_(1,D)}),(X===44||X===49)&&w.map(D=>!D.hide&&x.jsx("div",{className:`rg-line-ctrl-dot ctrl-split ${D.optionName.startsWith("cp-")?"":"ctrl-split-core"} ${D.direction==="v"?"ctrl-split-v":""} ${D.direction==="h"?"ctrl-split-h":""}`,style:{"--rg-ctl-x":D.x+"px","--rg-ctl-y":D.y+"px"},onMouseDown:U=>S(D,U)},D.optionName)),s&&d&&x.jsx("div",{className:["rg-line-ctrl-text",y&&"rg-line-ctrl-text-editing"].filter(Boolean).join(" "),style:{"--rg-ctl-x":c.text.x+"px","--rg-ctl-y":c.text.y+"px"},onClick:O,onMouseDown:b,children:y?x.jsx("input",{ref:m,className:"rg-line-text-input",value:g,onChange:D=>v(D.target.value),onBlur:T}):g?x.jsx("p",{children:g}):x.jsx("p",{className:"empty-text",children:"Add Text..."})})]})},Dt=({mouseUpOnJunctionPointWithOffset:s,mouseUpOnJunctionPoint:i})=>x.jsxs("div",{className:"rg-connect-ctl",onMouseUp:e=>i("",e),onTouchEnd:e=>i("",e),children:[x.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-t","data-point":"top",onMouseUp:e=>i("top",e),onTouchEnd:e=>i("top",e)}),x.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-b","data-point":"bottom",onMouseUp:e=>i("bottom",e),onTouchEnd:e=>i("bottom",e)}),x.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-center","data-point":"border",onMouseUp:e=>i("border",e),onTouchEnd:e=>i("border",e)}),x.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-l","data-point":"left",onMouseUp:e=>i("left",e),onTouchEnd:e=>i("left",e)}),x.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-r","data-point":"right",onMouseUp:e=>i("right",e),onTouchEnd:e=>i("right",e)}),x.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-lr","data-point":"lr",onMouseUp:e=>i("lr",e),onTouchEnd:e=>i("lr",e)}),x.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-tb","data-point":"tb",onMouseUp:e=>i("tb",e),onTouchEnd:e=>i("tb",e)}),x.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-bottom-bar","data-point":"bottom","data-innode":"true",onMouseUp:e=>s("bottom",e),onTouchEnd:e=>onMouseUpWithOffset("bottom",e)}),x.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-top-bar","data-point":"top","data-innode":"true",onMouseUp:e=>s("top",e),onTouchEnd:e=>onMouseUpWithOffset("top",e)}),x.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-left-bar","data-point":"left","data-innode":"true",onMouseUp:e=>s("left",e),onTouchEnd:e=>onMouseUpWithOffset("left",e)}),x.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-right-bar","data-point":"right","data-innode":"true",onMouseUp:e=>s("right",e),onTouchEnd:e=>onMouseUpWithOffset("right",e)})]}),Oo=({children:s})=>{const i=$();ie();const e=I.useRef(),{options:t}=J();if(!t.nodeConnectController.show)return x.jsx(x.Fragment,{});const n=(a,r)=>{i.onLineVertexBeDroppedOnConnectController(a,r,void 0,(l,c,d)=>{C("onLineVertexBeDropped:callback:",d)})},o=(a,r)=>{i.onLineVertexBeDroppedOnConnectController(a,r,e.current,(l,c,d)=>{C("onLineVertexBeDropped:callback:",d)})};return x.jsx("div",{className:"rg-editing-connect-ctrl",ref:e,style:{transform:`translate(${t.nodeConnectController.x}px, ${t.nodeConnectController.y}px)`,width:t.nodeConnectController.width+"px",height:t.nodeConnectController.height+"px"},children:s||x.jsx(Dt,{mouseUpOnJunctionPoint:n,mouseUpOnJunctionPointWithOffset:o})})},So=({lineTemplate:s,onConnectStart:i,onConnectEnd:e,children:t,className:n,style:o})=>{const a=$(),r=l=>{i&&i(s,l.nativeEvent),l.stopPropagation(),a.startCreateLineFromNode(null,s,l.nativeEvent,(c,d,h)=>{e&&e(c,d,h),a.defaultLineConnectEndHandler(c,d,h)})};return x.jsx("div",{className:`rg-connect-source-handle ${n||""}`,style:o,onMouseDown:l=>r(l),onClick:l=>{l.stopPropagation()},children:t})},Po=({children:s,className:i,style:e,junctionPoint:t,targetId:n,targetType:o,targetData:a,lineTemplate:r,disableDrop:l,disableDrag:c,onLineVertexBeDropped:d,onDragConnectStart:h,onDragConnectEnd:u})=>{const y=$(),f=I.useRef(null);I.useEffect(()=>(y.registerConnectTarget(f.current,n,o||B.CanvasPoint,t,a),()=>{y.unregisterConnectTarget(n)}),[]);const g=(p,m)=>{m.stopPropagation(),!l&&y.onLineVertexBeDropped(p,m.nativeEvent,void 0,(L,_,S)=>{d&&d(L,_,S)})},v=p=>{if(p.stopPropagation(),c||y.options.creatingLinePlot)return;const m=Object.assign({},r||{});m.from||(m.from=n),m.fromType||(m.fromType=o||B.NodePoint),m.fromJunctionPoint||(m.fromJunctionPoint=t),h&&h(m,p.nativeEvent),y.startCreateLineFromNode(null,m,p.nativeEvent,(L,_,S)=>{u&&u(L,_,S)})};return x.jsx("div",{ref:f,className:`rg-connect-ctl-handler rg-connect-target ${i||""}`,style:e,"data-point":t,"data-target-id":n,"data-target-type":o||B.CanvasPoint,"data-target-data":JSON.stringify(a),onMouseDown:p=>v(p),onMouseUp:p=>g(t,p),onClick:p=>{p.stopPropagation()},children:s})},To=({showText:s,adsorption:i})=>{const e=$(),{options:t}=J();return I.useEffect(()=>(e.onReferenceLineMounted(i),()=>{e.onReferenceLineUnMounted()}),[t]),x.jsxs("div",{className:"rg-editing-referline",style:{display:t.editingReferenceLine.show?"block":"none"},children:[t.editingReferenceLine.directionV&&x.jsx("div",{className:"rg-referline rg-referline-v",style:{transform:`translate(var(--rg-refer-offset), 0px) translate(${t.editingReferenceLine.v_x}px, ${t.editingReferenceLine.v_y}px)`,height:t.editingReferenceLine.v_height+"px"},children:x.jsx("div",{className:"referline",children:s!==!1&&x.jsxs("div",{children:[Math.round(t.editingReferenceLine.v_height),"px"]})})}),t.editingReferenceLine.directionH&&x.jsx("div",{className:"rg-referline rg-referline-h",style:{transform:`translate(0px, var(--rg-refer-offset)) translate(${t.editingReferenceLine.h_x}px, ${t.editingReferenceLine.h_y}px)`,width:t.editingReferenceLine.h_width+"px"},children:x.jsx("div",{className:"referline",children:s!==!1&&x.jsxs("div",{children:[Math.round(t.editingReferenceLine.h_width),"px"]})})})]})},Mo=s=>{const i=$();return I.useEffect(()=>{Ze("React-Linker"),i.setOptions(s.options);const e=Qe(s);C("[RelationGraph]mounted:listeners:",e),i.setListeners(e),i.ready(),i.dataUpdated()},[]),I.useEffect(()=>{i.setOptions(s.options||{}),i.dataUpdated()},[s.options]),I.useEffect(()=>{s.lines&&(C("[RelationGraph] apply data"),(async()=>(i.clearGraph(),i.addFakeLines(s.lines),i.dataUpdated()))())},[s.lines]),x.jsx(gt,{...s})},ko=s=>{const i=Ue(s.relationGraphCore,!0);return x.jsx(qe,{graphInstance:i,children:x.jsx(Mo,{...s,children:s.children})})},Io=s=>{const i=Tt(s.relationGraphCore);return x.jsx(Mt,{graphInstance:i,children:s.children})},Eo=je,Do=Pt,Ro={BaseLayout:ue,BidirectionalTreeLayout:vt,CenterLayout:mt,CircleLayout:xt,FixedLayout:Ct,ForceLayout:Se,RGFolderLayout:Lt},Ao={RGOptionsDataUtils:Wt,RGLineDataUtils:Ft,RGNodeDataUtils:Ht,RGGraphMath:Q,RGNodesAnalyticUtils:G,RGEffectUtils:Z},Vo=vo,Xo=ot,zo=nt,Go=po,Bo=yo,Fo=rt,Yo=ct,Ho=Lo,Wo=No,$o=wo,Uo=xo,qo=Co,jo=_o,Jo=bo,Zo=Oo,Qo=So,Ko=Po,ei=Dt,ti=To,ni=Fe,oi=Fe,ii=ut,si=ft,Rt=mo,ai=ht,ri=ko,At=Et,li=At.useRelationGraph,di=Io,ci=It;R.RGBackground=Wo,R.RGConnectSource=Qo,R.RGConnectTarget=Ko,R.RGDebugView=Go,R.RGDirection=Ke,R.RGEditingConnectController=Zo,R.RGEditingConnectPoints=ei,R.RGEditingLineController=Jo,R.RGEditingNearNodeWidget=jo,R.RGEditingNodeController=Uo,R.RGEditingReferenceLine=ti,R.RGEditingResize=qo,R.RGEventNames=V,R.RGFakeNode=Vo,R.RGHooks=At,R.RGInnerConnectTargetType=B,R.RGInstanceContext=ye,R.RGJunctionPoint=j,R.RGLayouts=Ro,R.RGLinePath=Xo,R.RGLineShape=Y,R.RGLineText=zo,R.RGMiniToolBar=Yo,R.RGMiniView=Ho,R.RGNodeExpandHolder=Fo,R.RGNodeShape=Le,R.RGProvider=di,R.RGSlotOnCanvas=si,R.RGSlotOnCanvasAbove=ii,R.RGSlotOnGraph=ni,R.RGSlotOnLine=ai,R.RGSlotOnNode=Rt,R.RGSlotOnView=oi,R.RGToolBar=Bo,R.RGUpdateContext=et,R.RGUpdateSignalContext=Ie,R.RGUpdateSingalContext=Ie,R.RGUtils=Ao,R.RGWatermark=$o,R.RelationGraph=ci,R.RelationGraphCore=Do,R.RelationGraphStoreContext=ye,R.RelationLinker=ri,R._RGHooks=Et,R.default=It,R.useRelationGraph=li,R.version=Eo,Object.defineProperties(R,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|