@yuku123/z-cognition-component 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/dist-lib/ApartmentOutlined-M6qSurnE.js +12 -0
  2. package/dist-lib/ArrowLeftOutlined-DowsrSUj.js +12 -0
  3. package/dist-lib/{ConceptsPage-DOf_CJlz.js → ConceptsPage-BOeKdDKI.js} +16 -13
  4. package/dist-lib/{DocsPage-CiC7TU96.js → DocsPage-BZOBFp3c.js} +4 -4
  5. package/dist-lib/EvidenceFormList-DXqqSpPV.js +91 -0
  6. package/dist-lib/{EyeOutlined-CH-5UdnC.js → EyeOutlined-DGSrX-0M.js} +1 -1
  7. package/dist-lib/ImpactPage-DyhUR6fT.js +71 -0
  8. package/dist-lib/{LeftOutlined-DQTflZ6D.js → LeftOutlined-Cgo6Izj-.js} +1 -1
  9. package/dist-lib/{OntologyDetailPage-mgK_NQxP.js → OntologyDetailPage-B8DyU8WW.js} +93 -99
  10. package/dist-lib/{OntologyInferPage-NUaoaQpN.js → OntologyInferPage-CvcjxpBB.js} +40 -38
  11. package/dist-lib/{OntologyListPage-C9wH01y0.js → OntologyListPage-Cb0XfpWE.js} +49 -47
  12. package/dist-lib/OntologyMaterializePage-B0f9TnJa.js +136 -0
  13. package/dist-lib/OntologyNodesPage-D4MWlm6q.js +1268 -0
  14. package/dist-lib/{OntologyValidatePage-DtkYK_l4.js → OntologyValidatePage-abQVJwzV.js} +52 -49
  15. package/dist-lib/{Pagination-Ds8VKQIT.js → Pagination-Dxslodkq.js} +258 -260
  16. package/dist-lib/PlusOutlined-B_dXo_97.js +12 -0
  17. package/dist-lib/{ReloadOutlined-B26pDoyV.js → ReloadOutlined-CS-e-TmN.js} +10 -19
  18. package/dist-lib/{ResolvePage-Cz9HORZ3.js → ResolvePage-rbQ-8nNZ.js} +33 -31
  19. package/dist-lib/{RotateRightOutlined-B575hEBK.js → RotateRightOutlined-q7zp2e47.js} +1 -1
  20. package/dist-lib/SearchOutlined-puH6bCY6.js +979 -0
  21. package/dist-lib/Skeleton-DXcERb5r.js +557 -0
  22. package/dist-lib/{Table-D8pPXolZ.js → Table-CDagah-g.js} +452 -450
  23. package/dist-lib/TagsOutlined-B4_qkn6-.js +20 -0
  24. package/dist-lib/TermDetailPage-CP0D6OvA.js +242 -0
  25. package/dist-lib/{TermsPage-BuzCMYov.js → TermsPage-CuufAyuL.js} +31 -28
  26. package/dist-lib/TextArea-DTpTS5HL.js +1897 -0
  27. package/dist-lib/ThunderboltOutlined-Bf54AaFE.js +20 -0
  28. package/dist-lib/{agents-DS0rPJGV.js → agents-CvgRLQw2.js} +46 -46
  29. package/dist-lib/{ai-CQ67aRC4.js → ai-DYDhijtn.js} +30 -30
  30. package/dist-lib/{ai-chat-share-AOB7rEOb.js → ai-chat-share-DJnybJtS.js} +14 -13
  31. package/dist-lib/{approval-LLVR3fMa.js → approval-3IbhY8Lp.js} +26 -25
  32. package/dist-lib/{approvals-D1DSA-Mw.js → approvals-Cd6CVzz4.js} +43 -42
  33. package/dist-lib/{assistant-DpabpWKV.js → assistant-cIXgilaE.js} +50 -49
  34. package/dist-lib/{assistant-history-ChvhtZwX.js → assistant-history-BQzH4ChB.js} +5 -5
  35. package/dist-lib/{assistant-summary-B0ksF8CX.js → assistant-summary-LKTj_HKM.js} +1 -1
  36. package/dist-lib/{audit-DeU1XEgQ.js → audit-CxuJ5unU.js} +1 -1
  37. package/dist-lib/{bios-Bk36bVhw.js → bios-BplnCOF4.js} +130 -125
  38. package/dist-lib/callSuper-DZEfdkXG.js +7 -0
  39. package/dist-lib/{changelog-xEt2qnho.js → changelog-BoGqt_81.js} +2 -2
  40. package/dist-lib/{changelog-CCMDMI4R.js → changelog-Cn81Dvgk.js} +1 -1
  41. package/dist-lib/chunk-YDNE64FV-DGyyfCo0.js +2004 -0
  42. package/dist-lib/colors-sdAcAcU3.js +24 -0
  43. package/dist-lib/context-Buz0ggsK.js +710 -0
  44. package/dist-lib/context-DpmyNOn3.js +21 -0
  45. package/dist-lib/createForOfIteratorHelper-DEx_aTey.js +51 -0
  46. package/dist-lib/d3-force-CZK-Rgd6.js +598 -0
  47. package/dist-lib/{dayjs.min-DoEf5yCX.js → dayjs.min-BauDENhn.js} +1 -1
  48. package/dist-lib/{detail-Xtof0GoK.js → detail-BaX7WiWV.js} +51 -50
  49. package/dist-lib/{detail-BW6dD_YP.js → detail-Cx5c4KJH.js} +89 -88
  50. package/dist-lib/{docx-preview-D4v2g8Yg.js → docx-preview-B5nQuTwk.js} +1 -1
  51. package/dist-lib/{downloads-Dj4DgBSS.js → downloads-C3Oz04OW.js} +4 -3
  52. package/dist-lib/{edit-nZ7siGuW.js → edit-Cbn2eJaJ.js} +265 -259
  53. package/dist-lib/{editor-BuhZwEsv.js → editor-mtaJBQXz.js} +21 -20
  54. package/dist-lib/embed-CR8XVkMy.js +31148 -0
  55. package/dist-lib/{evaluation-B-igEqQ9.js → evaluation-BoHiY8yT.js} +15 -14
  56. package/dist-lib/{focus-set-DfRWcq91.js → focus-set-h0YtOUB2.js} +34 -33
  57. package/dist-lib/{format-CWI99NCN.js → format-UGmYKemG.js} +1 -1
  58. package/dist-lib/index-9aQ4BzIK.js +500 -0
  59. package/dist-lib/{index-BJ2Gpcbi.js → index-B22_2Dzh.js} +2 -2
  60. package/dist-lib/index-B57Fj7Y0.js +1169 -0
  61. package/dist-lib/{index-D_-8dmug.js → index-BEjXaDfk.js} +23 -22
  62. package/dist-lib/{index-rtSfQuYs.js → index-BSlCGnzo.js} +12 -12
  63. package/dist-lib/index-Bc-Vin3j.js +256 -0
  64. package/dist-lib/{index-SAPKyv8e.js → index-Bm1sK-VN.js} +10 -10
  65. package/dist-lib/{index-g9uC_rON.js → index-BwVZgt5s.js} +129 -146
  66. package/dist-lib/{index-CZipVp1G.js → index-C3AMwzIi.js} +1 -1
  67. package/dist-lib/{index-B5jr3A7f.js → index-CHBNrCMy.js} +19 -19
  68. package/dist-lib/{index-BFRg0cn3.js → index-CLTfICbf.js} +6 -6
  69. package/dist-lib/{index-CnLkqTRm.js → index-CaXylbQR.js} +175 -173
  70. package/dist-lib/index-Cfu1W1H6.js +535 -0
  71. package/dist-lib/{index-DzrH4RQ7.js → index-Cj4DDWyj.js} +11 -10
  72. package/dist-lib/index-CrMcNEAZ.js +9656 -0
  73. package/dist-lib/index-Cy9i4Kx7.js +699 -0
  74. package/dist-lib/index-CyKWCYMK.js +218 -0
  75. package/dist-lib/{index-CjwzwBTy.js → index-D3GHtSlM.js} +94 -93
  76. package/dist-lib/{index-B8l4PAGJ.js → index-DBlG9uXV.js} +112 -108
  77. package/dist-lib/index-DBtGE89a.js +168 -0
  78. package/dist-lib/{index-CS5YTpdI.js → index-DMTPsTna.js} +4 -3
  79. package/dist-lib/index-DjFPRXl5.js +1484 -0
  80. package/dist-lib/{index-Bu6udiyN.js → index-DsuUGhTA.js} +123 -121
  81. package/dist-lib/index-DvWHYX81.js +450 -0
  82. package/dist-lib/{index-D5V4bZ4e.js → index-PBT9GksC.js} +8 -8
  83. package/dist-lib/index-Vu6sPBci.js +1884 -0
  84. package/dist-lib/index-bOY1cBol.js +4890 -0
  85. package/dist-lib/index-nQSVLWfW.js +356 -0
  86. package/dist-lib/{index-pcUZcUIA.js → index-o65vKUwa.js} +48 -47
  87. package/dist-lib/{index-K7z38Ybg.js → index-ounfql2z.js} +33 -31
  88. package/dist-lib/{index-B1rpIXU7.js → index-y7jVGGI0.js} +23 -21
  89. package/dist-lib/index.js +3 -1
  90. package/dist-lib/{jszip.min-dcaDnWUw.js → jszip.min-DcEHhn-b.js} +1 -1
  91. package/dist-lib/{kb-form-modal-9L0AUHVG.js → kb-form-modal-B0rM1ZvV.js} +71 -71
  92. package/dist-lib/{kbTeam-BECePvJe.js → kbTeam-Bh_FQH28.js} +3 -3
  93. package/dist-lib/{knowledge-base-C8gHP0dj.js → knowledge-base-Cl1Ka1e6.js} +104 -103
  94. package/dist-lib/{knowledge-hub-C9KkDv1A.js → knowledge-hub-CPuzdRiq.js} +52 -51
  95. package/dist-lib/{markdown-lite-BABX4bcl.js → markdown-lite-Cu62Fl7J.js} +181 -177
  96. package/dist-lib/{material-preview-docx-lp_xPipj.js → material-preview-docx-CH-09KeC.js} +1 -1
  97. package/dist-lib/{material-preview-pdf-CKAovvpc.js → material-preview-pdf-CTSo215V.js} +7 -7
  98. package/dist-lib/{material-preview-pptx-6Byitp0J.js → material-preview-pptx-D8XGDF-u.js} +1 -1
  99. package/dist-lib/{member-B5WF3FCj.js → member-DKDx77PD.js} +1 -1
  100. package/dist-lib/{message-kHyjuooj.js → message-BrooQ3Q7.js} +25 -24
  101. package/dist-lib/{message-D2MSaOMq.js → message-Dievi8Jw.js} +1 -1
  102. package/dist-lib/{messages-D_VDuKK7.js → messages-xTNmTS9g.js} +16 -15
  103. package/dist-lib/{meta-CEf_DYcU.js → meta-BD_qYTZu.js} +1 -1
  104. package/dist-lib/{metrics-hONGW0KG.js → metrics-DiHYqBKB.js} +2 -2
  105. package/dist-lib/{monitor-DF3WVsVV.js → monitor-BBCu3zRe.js} +8 -8
  106. package/dist-lib/{monitor-DFmEu6rH.js → monitor-BXsdMJSV.js} +4 -4
  107. package/dist-lib/{my-access-j53lA6T6.js → my-access-CEGErUgv.js} +4 -4
  108. package/dist-lib/{my-permissions-C5L8ZN2d.js → my-permissions-wSr5zv7g.js} +23 -22
  109. package/dist-lib/{new-DfZ61nMQ.js → new-BevAuTe5.js} +14 -12
  110. package/dist-lib/{ontology-CUH5qslO.js → ontology-DXGSJC-y.js} +145 -142
  111. package/dist-lib/{ontology-domains-CRC1ZRit.js → ontology-domains-jTG7CZm8.js} +88 -84
  112. package/dist-lib/ontology-modeling-CjRsa-DR.js +1039 -0
  113. package/dist-lib/{ontology-modeling-DaSk5fsh.js → ontology-modeling-DOj68TuI.js} +2125 -2117
  114. package/dist-lib/ontology-scenarios-CcAagMiP.js +660 -0
  115. package/dist-lib/{ontology-scenarios-DAbyoKV6.js → ontology-scenarios-J5kw6xgi.js} +703 -712
  116. package/dist-lib/pages-CsexFuEz.js +73 -0
  117. package/dist-lib/pages.js +3 -3
  118. package/dist-lib/{permission-CklDU2kO.js → permission-BUXo69Ne.js} +31 -31
  119. package/dist-lib/{pptx-preview.es-D4ODiBv2.js → pptx-preview.es-AUrdYKu3.js} +2 -2
  120. package/dist-lib/{preset-Bp_mvsJm.js → preset-gh5SGoYT.js} +9810 -10199
  121. package/dist-lib/{quota-DLe9so2b.js → quota-D31cXjul.js} +4 -4
  122. package/dist-lib/{row-CE051ClO.js → row-B5MnGm9M.js} +63 -61
  123. package/dist-lib/{save-blob-qKrc8-z6.js → save-blob-CiWNK-cX.js} +2 -2
  124. package/dist-lib/{scenario-mapping-preview-CSDqIN3R.js → scenario-mapping-preview-DQ_OBV4Z.js} +48 -46
  125. package/dist-lib/{scenario-simple-form-CAkhVgeV.js → scenario-simple-form-DESMvU7A.js} +425 -423
  126. package/dist-lib/{schedule-B_ujtL3h.js → schedule-BktxwX3S.js} +8 -8
  127. package/dist-lib/{settings-BIkKTQjc.js → settings-dsB3H65I.js} +147 -146
  128. package/dist-lib/{shared-Dfz1X4Mq.js → shared-CTCzvhyE.js} +1 -1
  129. package/dist-lib/{shared-utils-BeRiAkbe.js → shared-utils-BstybhBG.js} +2 -2
  130. package/dist-lib/{skills-BzpcX5fN.js → skills-CHPlMsgO.js} +40 -39
  131. package/dist-lib/{source-selection-DOL5LBrV.js → source-selection-tXqc855k.js} +16 -16
  132. package/dist-lib/{task-config-D0a7TOYt.js → task-config-BiTOiZj0.js} +4 -4
  133. package/dist-lib/{tech-CH01ekZ5.js → tech-BKlGPkV0.js} +4 -3
  134. package/dist-lib/{tools-YnTN61uE.js → tools-CouQ4FWk.js} +14 -14
  135. package/dist-lib/{use-domain-access-CXx1YzE5.js → use-domain-access-BPlNfoiP.js} +13 -13
  136. package/dist-lib/use-g6-graph-WLX0PweO.js +1119 -0
  137. package/dist-lib/{use-graph-layers-CowyyYcb.js → use-graph-layers-ja-ZIC_R.js} +50 -48
  138. package/dist-lib/useClosable-BY7FgWKy.js +59 -0
  139. package/dist-lib/useForm-Byp1LopG.js +145 -0
  140. package/dist-lib/{version-control-panel-CLy2ZXI_.js → version-control-panel-CkBm36Yk.js} +27 -26
  141. package/dist-lib/{version-management-C_v8w1E4.js → version-management-B4kIbdVc.js} +7 -6
  142. package/dist-lib/{welcome-ChEcA4Ej.js → welcome-F5iZoFB1.js} +4 -3
  143. package/package.json +2 -3
  144. package/dist-lib/EvidenceFormList-CrE2FzHk.js +0 -90
  145. package/dist-lib/ImpactPage-CYiuqy0S.js +0 -68
  146. package/dist-lib/OntologyMaterializePage-D_fDqYHY.js +0 -134
  147. package/dist-lib/OntologyNodesPage-5kH7RHwE.js +0 -2844
  148. package/dist-lib/PlusOutlined-BSTPGLOH.js +0 -21
  149. package/dist-lib/Skeleton-CxFsInYI.js +0 -671
  150. package/dist-lib/Table-Civ838nE.js +0 -20514
  151. package/dist-lib/TermDetailPage-BtkOpbPT.js +0 -263
  152. package/dist-lib/_commonjsHelpers-DaMA6jEr.js +0 -8
  153. package/dist-lib/callSuper-CwIeyYoc.js +0 -7
  154. package/dist-lib/chunk-6KYCQHYJ-DcgZQlO5.js +0 -1627
  155. package/dist-lib/context-T27uno74.js +0 -54
  156. package/dist-lib/d3-force-Cr_oBTiR.js +0 -647
  157. package/dist-lib/embed-Bs3Hmsyy.js +0 -51377
  158. package/dist-lib/index-0TvzCTD7.js +0 -2336
  159. package/dist-lib/index-4tbtbcAt.js +0 -550
  160. package/dist-lib/index-B1wh6i1C.js +0 -1308
  161. package/dist-lib/index-BVgdmf6r.js +0 -2487
  162. package/dist-lib/index-CSnvcFg-.js +0 -543
  163. package/dist-lib/index-D35Ry0PG.js +0 -1162
  164. package/dist-lib/index-DC57_dnh.js +0 -604
  165. package/dist-lib/index-DQ16Zb7x.js +0 -546
  166. package/dist-lib/index-DRcTwC17.js +0 -418
  167. package/dist-lib/index-Dd9pPAT3.js +0 -2192
  168. package/dist-lib/index-DxzorPvG.js +0 -13960
  169. package/dist-lib/index-If4xc1-H.js +0 -559
  170. package/dist-lib/index-R71k3nB_.js +0 -710
  171. package/dist-lib/index-mUlorJxp.js +0 -3279
  172. package/dist-lib/ontology-modeling-CvJIImxt.js +0 -3612
  173. package/dist-lib/ontology-scenarios-BRDkk3uA.js +0 -675
  174. package/dist-lib/pages-CticGC6S.js +0 -512
  175. package/dist-lib/use-g6-graph-SwJtPLce.js +0 -57552
@@ -1,2844 +0,0 @@
1
- import { jsx as V, jsxs as le, Fragment as _t } from "react/jsx-runtime";
2
- import * as M from "react";
3
- import kn, { useRef as ne, useState as ve, useEffect as _e, useCallback as q, useMemo as kt } from "react";
4
- import { o as Ze } from "./api-BVrIcAFp.js";
5
- import { G as Dn } from "./preset-Bp_mvsJm.js";
6
- import { a as Cn } from "./chunk-6KYCQHYJ-DcgZQlO5.js";
7
- import { s as rt, I as $n } from "./index-BVgdmf6r.js";
8
- import { a as In, p as lt, aB as ut, w as ft, f as Mn, b as Rn, C as Dt, ap as Ct, P as On, v as Yt, E as Xt, G as zn, ax as Pn, l as Ue, m as An, n as Tn, o as Re, r as Ln, d as Hn, I as Fn, z as Bn, A as Wn, ad as ot, y as jn, J as Gn, Z as Vn, K as $t, x as Zn, aZ as It, B as Oe, bt as Kn } from "./index-DxzorPvG.js";
9
- import { u as Yn, p as Mt, T as st } from "./index-4tbtbcAt.js";
10
- import { I as wt, c as oe, b as Rt } from "./pages-CticGC6S.js";
11
- import { R as Xn } from "./ReloadOutlined-B26pDoyV.js";
12
- import "react-dom/client";
13
- import "react-dom";
14
- import { b as Un, u as qn, a as Qn } from "./context-T27uno74.js";
15
- import { S as Jn } from "./Skeleton-CxFsInYI.js";
16
- import { D as ze } from "./index-DQ16Zb7x.js";
17
- var er = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M855 160.1l-189.2 23.5c-6.6.8-9.3 8.8-4.7 13.5l54.7 54.7-153.5 153.5a8.03 8.03 0 000 11.3l45.1 45.1c3.1 3.1 8.2 3.1 11.3 0l153.6-153.6 54.7 54.7a7.94 7.94 0 0013.5-4.7L863.9 169a7.9 7.9 0 00-8.9-8.9zM416.6 562.3a8.03 8.03 0 00-11.3 0L251.8 715.9l-54.7-54.7a7.94 7.94 0 00-13.5 4.7L160.1 855c-.6 5.2 3.7 9.5 8.9 8.9l189.2-23.5c6.6-.8 9.3-8.8 4.7-13.5l-54.7-54.7 153.6-153.6c3.1-3.1 3.1-8.2 0-11.3l-45.2-45z" } }] }, name: "arrows-alt", theme: "outlined" };
18
- function dt() {
19
- return dt = Object.assign ? Object.assign.bind() : function(e) {
20
- for (var t = 1; t < arguments.length; t++) {
21
- var n = arguments[t];
22
- for (var o in n)
23
- Object.prototype.hasOwnProperty.call(n, o) && (e[o] = n[o]);
24
- }
25
- return e;
26
- }, dt.apply(this, arguments);
27
- }
28
- const tr = (e, t) => /* @__PURE__ */ M.createElement(wt, dt({}, e, {
29
- ref: t,
30
- icon: er
31
- })), ht = /* @__PURE__ */ M.forwardRef(tr);
32
- process.env.NODE_ENV !== "production" && (ht.displayName = "ArrowsAltOutlined");
33
- var nr = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M342 88H120c-17.7 0-32 14.3-32 32v224c0 8.8 7.2 16 16 16h48c8.8 0 16-7.2 16-16V168h174c8.8 0 16-7.2 16-16v-48c0-8.8-7.2-16-16-16zm578 576h-48c-8.8 0-16 7.2-16 16v176H682c-8.8 0-16 7.2-16 16v48c0 8.8 7.2 16 16 16h222c17.7 0 32-14.3 32-32V680c0-8.8-7.2-16-16-16zM342 856H168V680c0-8.8-7.2-16-16-16h-48c-8.8 0-16 7.2-16 16v224c0 17.7 14.3 32 32 32h222c8.8 0 16-7.2 16-16v-48c0-8.8-7.2-16-16-16zM904 88H682c-8.8 0-16 7.2-16 16v48c0 8.8 7.2 16 16 16h174v176c0 8.8 7.2 16 16 16h48c8.8 0 16-7.2 16-16V120c0-17.7-14.3-32-32-32z" } }] }, name: "expand", theme: "outlined" };
34
- function gt() {
35
- return gt = Object.assign ? Object.assign.bind() : function(e) {
36
- for (var t = 1; t < arguments.length; t++) {
37
- var n = arguments[t];
38
- for (var o in n)
39
- Object.prototype.hasOwnProperty.call(n, o) && (e[o] = n[o]);
40
- }
41
- return e;
42
- }, gt.apply(this, arguments);
43
- }
44
- const rr = (e, t) => /* @__PURE__ */ M.createElement(wt, gt({}, e, {
45
- ref: t,
46
- icon: nr
47
- })), pt = /* @__PURE__ */ M.forwardRef(rr);
48
- process.env.NODE_ENV !== "production" && (pt.displayName = "ExpandOutlined");
49
- var or = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M793 242H366v-74c0-6.7-7.7-10.4-12.9-6.3l-142 112a8 8 0 000 12.6l142 112c5.2 4.1 12.9.4 12.9-6.3v-74h415v470H175c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h618c35.3 0 64-28.7 64-64V306c0-35.3-28.7-64-64-64z" } }] }, name: "rollback", theme: "outlined" };
50
- function mt() {
51
- return mt = Object.assign ? Object.assign.bind() : function(e) {
52
- for (var t = 1; t < arguments.length; t++) {
53
- var n = arguments[t];
54
- for (var o in n)
55
- Object.prototype.hasOwnProperty.call(n, o) && (e[o] = n[o]);
56
- }
57
- return e;
58
- }, mt.apply(this, arguments);
59
- }
60
- const sr = (e, t) => /* @__PURE__ */ M.createElement(wt, mt({}, e, {
61
- ref: t,
62
- icon: or
63
- })), Ut = /* @__PURE__ */ M.forwardRef(sr);
64
- process.env.NODE_ENV !== "production" && (Ut.displayName = "RollbackOutlined");
65
- const Ot = /* @__PURE__ */ M.createContext(null), qt = /* @__PURE__ */ M.createContext({});
66
- function yt() {
67
- return yt = Object.assign ? Object.assign.bind() : function(e) {
68
- for (var t = 1; t < arguments.length; t++) {
69
- var n = arguments[t];
70
- for (var o in n)
71
- Object.prototype.hasOwnProperty.call(n, o) && (e[o] = n[o]);
72
- }
73
- return e;
74
- }, yt.apply(this, arguments);
75
- }
76
- const Qt = (e) => {
77
- const {
78
- prefixCls: t,
79
- className: n,
80
- containerRef: o,
81
- ...r
82
- } = e, {
83
- panel: s
84
- } = M.useContext(qt), i = In(s, o);
85
- return /* @__PURE__ */ M.createElement("div", yt({
86
- className: oe(`${t}-section`, n),
87
- role: "dialog",
88
- ref: i
89
- }, lt(e, {
90
- aria: !0
91
- }), {
92
- "aria-modal": "true"
93
- }, r));
94
- };
95
- process.env.NODE_ENV !== "production" && (Qt.displayName = "DrawerPanel");
96
- function ar(e) {
97
- const {
98
- prefixCls: t,
99
- direction: n,
100
- className: o,
101
- style: r,
102
- maxSize: s,
103
- containerRef: i,
104
- currentSize: a,
105
- onResize: c,
106
- onResizeEnd: l,
107
- onResizeStart: u
108
- } = e, [E, m] = M.useState(!1), [d, x] = M.useState(0), [g, f] = M.useState(0), h = n === "left" || n === "right", S = ut((k) => {
109
- k.preventDefault(), k.stopPropagation(), m(!0), x(h ? k.clientX : k.clientY);
110
- let D;
111
- if (typeof a == "number")
112
- D = a;
113
- else if (i != null && i.current) {
114
- const A = i.current.getBoundingClientRect();
115
- D = h ? A.width : A.height;
116
- }
117
- f(D), u == null || u(D);
118
- }), p = ut((k) => {
119
- if (!E) return;
120
- let A = (h ? k.clientX : k.clientY) - d;
121
- (n === "right" || n === "bottom") && (A = -A);
122
- let L = g + A;
123
- L < 0 && (L = 0), s && L > s && (L = s), c == null || c(L);
124
- }), y = M.useCallback(() => {
125
- if (E && (m(!1), i != null && i.current)) {
126
- const k = i.current.getBoundingClientRect(), D = h ? k.width : k.height;
127
- l == null || l(D);
128
- }
129
- }, [E, i, l, h]);
130
- return M.useEffect(() => {
131
- if (E)
132
- return document.addEventListener("mousemove", p), document.addEventListener("mouseup", y), () => {
133
- document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", y);
134
- };
135
- }, [E, p, y]), {
136
- dragElementProps: {
137
- className: oe(`${t}-dragger`, `${t}-dragger-${n}`, {
138
- [`${t}-dragger-dragging`]: E,
139
- [`${t}-dragger-horizontal`]: h,
140
- [`${t}-dragger-vertical`]: !h
141
- }, o),
142
- style: r,
143
- onMouseDown: S
144
- },
145
- isDragging: E
146
- };
147
- }
148
- function at(e) {
149
- if (typeof e == "string") {
150
- const t = Number(e.replace(/px$/i, ""));
151
- if (parseFloat(e) === t && ft(!1, "Invalid value type of `width` or `height` which should be number type instead."), !Number.isNaN(t))
152
- return t;
153
- }
154
- return e;
155
- }
156
- function ir(e) {
157
- ft(!("wrapperClassName" in e), "'wrapperClassName' is removed. Please use 'rootClassName' instead."), ft(Mn() || !e.open, "Drawer with 'open' in SSR is not work since no place to createPortal. Please move to 'useEffect' instead.");
158
- }
159
- function cr(e, t, n, o, r) {
160
- const s = o ?? r !== !1, [i] = Rn(t && s, e);
161
- return kn.useEffect(() => {
162
- var a;
163
- t && n === !0 && ((a = e()) == null || a.focus({
164
- preventScroll: !0
165
- }));
166
- }, [t]), i;
167
- }
168
- function Ae() {
169
- return Ae = Object.assign ? Object.assign.bind() : function(e) {
170
- for (var t = 1; t < arguments.length; t++) {
171
- var n = arguments[t];
172
- for (var o in n)
173
- Object.prototype.hasOwnProperty.call(n, o) && (e[o] = n[o]);
174
- }
175
- return e;
176
- }, Ae.apply(this, arguments);
177
- }
178
- const lr = (e, t) => {
179
- const {
180
- prefixCls: n,
181
- open: o,
182
- placement: r,
183
- inline: s,
184
- push: i,
185
- forceRender: a,
186
- // Focus
187
- autoFocus: c,
188
- focusTrap: l,
189
- // classNames
190
- classNames: u,
191
- // Root
192
- rootClassName: E,
193
- rootStyle: m,
194
- zIndex: d,
195
- // Drawer
196
- className: x,
197
- id: g,
198
- style: f,
199
- motion: h,
200
- width: S,
201
- height: p,
202
- size: y,
203
- maxSize: P,
204
- children: k,
205
- // Mask
206
- mask: D,
207
- maskClosable: A,
208
- maskMotion: L,
209
- maskClassName: H,
210
- maskStyle: Z,
211
- // Events
212
- afterOpenChange: W,
213
- onClose: j,
214
- onMouseEnter: X,
215
- onMouseOver: U,
216
- onMouseLeave: ue,
217
- onClick: ce,
218
- onKeyDown: de,
219
- onKeyUp: he,
220
- styles: K,
221
- drawerRender: z,
222
- resizable: N,
223
- defaultSize: O
224
- } = e, G = M.useRef(null);
225
- M.useImperativeHandle(t, () => G.current);
226
- const Q = cr(() => G.current, o, c, l, D), [te, De] = M.useState(!1), Y = M.useContext(Ot);
227
- let me;
228
- typeof i == "boolean" ? me = i ? {} : {
229
- distance: 0
230
- } : me = i || {};
231
- const ge = (me == null ? void 0 : me.distance) ?? (Y == null ? void 0 : Y.pushDistance) ?? 180, Ce = M.useMemo(() => ({
232
- pushDistance: ge,
233
- push: () => {
234
- De(!0);
235
- },
236
- pull: () => {
237
- De(!1);
238
- }
239
- }), [ge]);
240
- M.useEffect(() => {
241
- var I, F;
242
- o ? (I = Y == null ? void 0 : Y.push) == null || I.call(Y) : (F = Y == null ? void 0 : Y.pull) == null || F.call(Y);
243
- }, [o]), M.useEffect(() => () => {
244
- var I;
245
- (I = Y == null ? void 0 : Y.pull) == null || I.call(Y);
246
- }, []);
247
- const Le = /* @__PURE__ */ M.createElement(Dt, Ae({
248
- key: "mask"
249
- }, L, {
250
- visible: D && o
251
- }), ({
252
- className: I,
253
- style: F
254
- }, B) => /* @__PURE__ */ M.createElement("div", {
255
- className: oe(`${n}-mask`, I, u == null ? void 0 : u.mask, H),
256
- style: {
257
- ...F,
258
- ...Z,
259
- ...K == null ? void 0 : K.mask
260
- },
261
- onClick: A && o ? j : void 0,
262
- ref: B
263
- })), be = typeof h == "function" ? h(r) : h, [$e, Ie] = M.useState(), ye = r === "left" || r === "right", Ee = M.useMemo(() => at(y ?? (ye ? S : p) ?? $e ?? O ?? (ye ? 378 : void 0)), [y, S, p, O, ye, $e]), He = M.useMemo(() => {
264
- const I = {};
265
- if (te && ge)
266
- switch (r) {
267
- case "top":
268
- I.transform = `translateY(${ge}px)`;
269
- break;
270
- case "bottom":
271
- I.transform = `translateY(${-ge}px)`;
272
- break;
273
- case "left":
274
- I.transform = `translateX(${ge}px)`;
275
- break;
276
- default:
277
- I.transform = `translateX(${-ge}px)`;
278
- break;
279
- }
280
- return ye ? I.width = at(Ee) : I.height = at(Ee), I;
281
- }, [te, ge, r, ye, Ee]), Me = M.useRef(null), $ = !!N, w = typeof N == "object" && N || {}, R = ut((I) => {
282
- var F;
283
- Ie(I), (F = w.onResize) == null || F.call(w, I);
284
- }), {
285
- dragElementProps: _,
286
- isDragging: b
287
- } = ar({
288
- prefixCls: `${n}-resizable`,
289
- direction: r,
290
- className: u == null ? void 0 : u.dragger,
291
- style: K == null ? void 0 : K.dragger,
292
- maxSize: P,
293
- containerRef: Me,
294
- currentSize: Ee,
295
- onResize: R,
296
- onResizeStart: w.onResizeStart,
297
- onResizeEnd: w.onResizeEnd
298
- }), v = {
299
- onMouseEnter: X,
300
- onMouseOver: U,
301
- onMouseLeave: ue,
302
- onClick: ce,
303
- onKeyDown: de,
304
- onKeyUp: he,
305
- onFocus: (I) => {
306
- Q(I.target);
307
- }
308
- }, C = /* @__PURE__ */ M.createElement(Dt, Ae({
309
- key: "panel"
310
- }, be, {
311
- visible: o,
312
- forceRender: a,
313
- onVisibleChanged: W,
314
- removeOnLeave: !1,
315
- leavedClassName: `${n}-content-wrapper-hidden`
316
- }), ({
317
- className: I,
318
- style: F
319
- }, B) => {
320
- const J = /* @__PURE__ */ M.createElement(Qt, Ae({
321
- id: g,
322
- containerRef: B,
323
- prefixCls: n,
324
- className: oe(x, u == null ? void 0 : u.section),
325
- style: {
326
- ...f,
327
- ...K == null ? void 0 : K.section
328
- }
329
- }, lt(e, {
330
- aria: !0
331
- }), v), k);
332
- return /* @__PURE__ */ M.createElement("div", Ae({
333
- ref: Me,
334
- className: oe(`${n}-content-wrapper`, b && `${n}-content-wrapper-dragging`, u == null ? void 0 : u.wrapper, !b && I),
335
- style: {
336
- ...F,
337
- ...He,
338
- ...K == null ? void 0 : K.wrapper
339
- }
340
- }, lt(e, {
341
- data: !0
342
- })), $ && /* @__PURE__ */ M.createElement("div", _), z ? z(J) : J);
343
- }), T = {
344
- ...m
345
- };
346
- return d && (T.zIndex = d), /* @__PURE__ */ M.createElement(Ot.Provider, {
347
- value: Ce
348
- }, /* @__PURE__ */ M.createElement("div", {
349
- className: oe(n, `${n}-${r}`, E, {
350
- [`${n}-open`]: o,
351
- [`${n}-inline`]: s
352
- }),
353
- style: T,
354
- tabIndex: -1,
355
- ref: G
356
- }, Le, C));
357
- }, Jt = /* @__PURE__ */ M.forwardRef(lr);
358
- process.env.NODE_ENV !== "production" && (Jt.displayName = "DrawerPopup");
359
- const en = (e) => {
360
- const {
361
- open: t = !1,
362
- prefixCls: n = "rc-drawer",
363
- placement: o = "right",
364
- autoFocus: r = !0,
365
- keyboard: s = !0,
366
- width: i,
367
- height: a,
368
- size: c,
369
- maxSize: l,
370
- mask: u = !0,
371
- maskClosable: E = !0,
372
- getContainer: m,
373
- forceRender: d,
374
- afterOpenChange: x,
375
- destroyOnHidden: g,
376
- onMouseEnter: f,
377
- onMouseOver: h,
378
- onMouseLeave: S,
379
- onClick: p,
380
- onKeyDown: y,
381
- onKeyUp: P,
382
- onClose: k,
383
- resizable: D,
384
- defaultSize: A,
385
- focusTriggerAfterClose: L,
386
- // Refs
387
- panelRef: H
388
- } = e, [Z, W] = M.useState(!1);
389
- process.env.NODE_ENV !== "production" && ir(e);
390
- const [j, X] = M.useState(!1);
391
- Ct(() => {
392
- X(!0);
393
- }, []);
394
- const U = j ? t : !1, ue = M.useRef(null), ce = M.useRef(null);
395
- Ct(() => {
396
- U && (ce.current = document.activeElement);
397
- }, [U]);
398
- const de = (O) => {
399
- var G, Q;
400
- W(O), x == null || x(O), !O && L !== !1 && ce.current && !((G = ue.current) != null && G.contains(ce.current)) && ((Q = ce.current) == null || Q.focus({
401
- preventScroll: !0
402
- }));
403
- }, he = M.useMemo(() => ({
404
- panel: H
405
- }), [H]);
406
- if (!d && !Z && !U && g)
407
- return null;
408
- const z = {
409
- ...e,
410
- open: U,
411
- prefixCls: n,
412
- placement: o,
413
- autoFocus: r,
414
- keyboard: s,
415
- width: i,
416
- height: a,
417
- size: c,
418
- maxSize: l,
419
- defaultSize: A,
420
- mask: u,
421
- maskClosable: E,
422
- inline: m === !1,
423
- afterOpenChange: de,
424
- ref: ue,
425
- resizable: D,
426
- ...{
427
- onMouseEnter: f,
428
- onMouseOver: h,
429
- onMouseLeave: S,
430
- onClick: p,
431
- onKeyDown: y,
432
- onKeyUp: P
433
- }
434
- }, N = ({
435
- top: O,
436
- event: G
437
- }) => {
438
- O && s && (G.stopPropagation(), k == null || k(G));
439
- };
440
- return /* @__PURE__ */ M.createElement(qt.Provider, {
441
- value: he
442
- }, /* @__PURE__ */ M.createElement(On, {
443
- open: U || d || Z,
444
- autoDestroy: !1,
445
- getContainer: m,
446
- autoLock: u && (U || Z),
447
- onEsc: N
448
- }, /* @__PURE__ */ M.createElement(Jt, z)));
449
- };
450
- process.env.NODE_ENV !== "production" && (en.displayName = "Drawer");
451
- const tn = (e) => {
452
- const {
453
- prefixCls: t,
454
- ariaId: n,
455
- title: o,
456
- footer: r,
457
- extra: s,
458
- closable: i,
459
- loading: a,
460
- onClose: c,
461
- headerStyle: l,
462
- bodyStyle: u,
463
- footerStyle: E,
464
- children: m,
465
- classNames: d,
466
- styles: x
467
- } = e, g = Yt("drawer"), {
468
- classNames: f,
469
- styles: h,
470
- closable: S
471
- } = g, [p, y] = Xt([f, d], [h, x], {
472
- props: {
473
- ...e,
474
- closable: i ?? S
475
- }
476
- }), P = M.useMemo(() => {
477
- const U = i ?? S;
478
- if (U !== !1)
479
- return zn(U) && (U == null ? void 0 : U.placement) === "end" ? "end" : "start";
480
- }, [i, S]), k = M.useCallback((U) => /* @__PURE__ */ M.createElement("button", {
481
- type: "button",
482
- onClick: c,
483
- className: oe(`${t}-close`, {
484
- [`${t}-close-${P}`]: P === "end"
485
- }, p.close),
486
- style: y.close
487
- }, U), [c, t, P, p.close, y.close]), [D, A, L] = Yn(Mt(e), Mt(g), {
488
- closable: !0,
489
- closeIconRender: k
490
- }), H = Pn(A, {
491
- disabled: L
492
- }), Z = Ue(o), W = Ue(s), j = () => !Z && !D && !W ? null : /* @__PURE__ */ M.createElement("div", {
493
- style: {
494
- ...y.header,
495
- ...l
496
- },
497
- className: oe(`${t}-header`, p.header, {
498
- [`${t}-header-close-only`]: D && !Z && !W
499
- })
500
- }, /* @__PURE__ */ M.createElement("div", {
501
- className: `${t}-header-title`
502
- }, P === "start" && H, Z && /* @__PURE__ */ M.createElement("div", {
503
- className: oe(`${t}-title`, p.title),
504
- style: y.title,
505
- id: n
506
- }, o)), W && /* @__PURE__ */ M.createElement("div", {
507
- className: oe(`${t}-extra`, p.extra),
508
- style: y.extra
509
- }, s), P === "end" && H), X = () => Ue(r) ? /* @__PURE__ */ M.createElement("div", {
510
- className: oe(`${t}-footer`, p.footer),
511
- style: {
512
- ...y.footer,
513
- ...E
514
- }
515
- }, r) : null;
516
- return /* @__PURE__ */ M.createElement(M.Fragment, null, j(), /* @__PURE__ */ M.createElement("div", {
517
- className: oe(`${t}-body`, p.body),
518
- style: {
519
- ...y.body,
520
- ...u
521
- }
522
- }, a ? /* @__PURE__ */ M.createElement(Jn, {
523
- active: !0,
524
- title: !1,
525
- paragraph: {
526
- rows: 5
527
- },
528
- className: `${t}-body-skeleton`
529
- }) : m), X());
530
- }, ur = (e) => {
531
- const t = "100%";
532
- return {
533
- left: `translateX(-${t})`,
534
- right: `translateX(${t})`,
535
- top: `translateY(-${t})`,
536
- bottom: `translateY(${t})`
537
- }[e];
538
- }, nn = (e, t) => ({
539
- "&-enter, &-appear": {
540
- ...e,
541
- "&-active": t
542
- },
543
- "&-leave": {
544
- ...t,
545
- "&-active": e
546
- }
547
- }), rn = (e, t) => ({
548
- "&-enter, &-appear, &-leave": {
549
- "&-start": {
550
- transition: "none"
551
- },
552
- "&-active": {
553
- transition: `all ${t}`
554
- }
555
- },
556
- ...nn({
557
- opacity: e
558
- }, {
559
- opacity: 1
560
- })
561
- }), fr = (e, t) => [rn(0.7, t), nn({
562
- transform: ur(e)
563
- }, {
564
- transform: "none"
565
- })], dr = (e) => {
566
- const {
567
- componentCls: t,
568
- motionDurationSlow: n
569
- } = e;
570
- return {
571
- [t]: {
572
- // ======================== Mask ========================
573
- [`${t}-mask-motion`]: rn(0, n),
574
- // ======================= Panel ========================
575
- [`${t}-panel-motion`]: ["left", "right", "top", "bottom"].reduce((o, r) => ({
576
- ...o,
577
- [`&-${r}`]: fr(r, n)
578
- }), {})
579
- }
580
- };
581
- }, hr = (e) => {
582
- const {
583
- borderRadiusSM: t,
584
- componentCls: n,
585
- zIndexPopup: o,
586
- colorBgMask: r,
587
- colorBgElevated: s,
588
- motionDurationSlow: i,
589
- motionDurationMid: a,
590
- paddingXS: c,
591
- padding: l,
592
- paddingLG: u,
593
- fontSizeLG: E,
594
- lineHeightLG: m,
595
- lineWidth: d,
596
- lineType: x,
597
- colorSplit: g,
598
- marginXS: f,
599
- colorIcon: h,
600
- colorIconHover: S,
601
- colorBgTextHover: p,
602
- colorBgTextActive: y,
603
- colorText: P,
604
- fontWeightStrong: k,
605
- footerPaddingBlock: D,
606
- footerPaddingInline: A,
607
- draggerSize: L,
608
- calc: H
609
- } = e, Z = `${n}-content-wrapper`, W = `${n}-resizable-dragger`;
610
- return {
611
- [n]: {
612
- position: "fixed",
613
- inset: 0,
614
- zIndex: o,
615
- pointerEvents: "none",
616
- color: P,
617
- "&-pure": {
618
- position: "relative",
619
- background: s,
620
- display: "flex",
621
- flexDirection: "column",
622
- pointerEvents: "auto",
623
- [`&${n}-left`]: {
624
- boxShadow: e.boxShadowDrawerLeft
625
- },
626
- [`&${n}-right`]: {
627
- boxShadow: e.boxShadowDrawerRight
628
- },
629
- [`&${n}-top`]: {
630
- boxShadow: e.boxShadowDrawerUp
631
- },
632
- [`&${n}-bottom`]: {
633
- boxShadow: e.boxShadowDrawerDown
634
- }
635
- },
636
- "&-inline": {
637
- position: "absolute"
638
- },
639
- // ====================== Mask ======================
640
- [`${n}-mask`]: {
641
- position: "absolute",
642
- inset: 0,
643
- zIndex: o,
644
- background: r,
645
- pointerEvents: "auto",
646
- [`&${n}-mask-blur`]: {
647
- backdropFilter: "blur(4px)"
648
- }
649
- },
650
- // ==================== Content =====================
651
- [Z]: {
652
- position: "absolute",
653
- zIndex: o,
654
- maxWidth: "100vw",
655
- transition: `all ${i}`,
656
- "&-hidden": {
657
- display: "none"
658
- }
659
- },
660
- // Placement
661
- [`&-left > ${Z}`]: {
662
- top: 0,
663
- bottom: 0,
664
- left: {
665
- _skip_check_: !0,
666
- value: 0
667
- },
668
- boxShadow: e.boxShadowDrawerLeft
669
- },
670
- [`&-right > ${Z}`]: {
671
- top: 0,
672
- right: {
673
- _skip_check_: !0,
674
- value: 0
675
- },
676
- bottom: 0,
677
- boxShadow: e.boxShadowDrawerRight
678
- },
679
- [`&-top > ${Z}`]: {
680
- top: 0,
681
- insetInline: 0,
682
- boxShadow: e.boxShadowDrawerUp
683
- },
684
- [`&-bottom > ${Z}`]: {
685
- bottom: 0,
686
- insetInline: 0,
687
- boxShadow: e.boxShadowDrawerDown
688
- },
689
- [`${n}-section`]: {
690
- display: "flex",
691
- flexDirection: "column",
692
- width: "100%",
693
- height: "100%",
694
- overflow: "auto",
695
- background: s,
696
- pointerEvents: "auto"
697
- },
698
- // Header
699
- [`${n}-header`]: {
700
- display: "flex",
701
- flex: 0,
702
- alignItems: "center",
703
- padding: `${Re(l)} ${Re(u)}`,
704
- fontSize: E,
705
- lineHeight: m,
706
- borderBottom: `${Re(d)} ${x} ${g}`,
707
- "&-title": {
708
- display: "flex",
709
- flex: 1,
710
- alignItems: "center",
711
- minWidth: 0,
712
- minHeight: 0
713
- }
714
- },
715
- [`${n}-extra`]: {
716
- flex: "none"
717
- },
718
- [`${n}-close`]: {
719
- display: "inline-flex",
720
- width: H(E).add(c).equal(),
721
- height: H(E).add(c).equal(),
722
- borderRadius: t,
723
- justifyContent: "center",
724
- alignItems: "center",
725
- color: h,
726
- fontWeight: k,
727
- fontSize: E,
728
- fontStyle: "normal",
729
- lineHeight: 1,
730
- textAlign: "center",
731
- textTransform: "none",
732
- textDecoration: "none",
733
- background: "transparent",
734
- border: 0,
735
- cursor: "pointer",
736
- transition: `all ${a}`,
737
- textRendering: "auto",
738
- [`&${n}-close-end`]: {
739
- marginInlineStart: f
740
- },
741
- [`&:not(${n}-close-end)`]: {
742
- marginInlineEnd: f
743
- },
744
- "&:disabled": {
745
- pointerEvents: "none"
746
- },
747
- "&:hover": {
748
- color: S,
749
- backgroundColor: p,
750
- textDecoration: "none"
751
- },
752
- "&:active": {
753
- backgroundColor: y
754
- },
755
- ...Ln(e)
756
- },
757
- [`${n}-title`]: {
758
- flex: 1,
759
- margin: 0,
760
- fontWeight: e.fontWeightStrong,
761
- fontSize: E,
762
- lineHeight: m
763
- },
764
- // Body
765
- [`${n}-body`]: {
766
- flex: 1,
767
- minWidth: 0,
768
- minHeight: 0,
769
- padding: u,
770
- overflow: "auto",
771
- [`${n}-body-skeleton`]: {
772
- width: "100%",
773
- height: "100%",
774
- display: "flex",
775
- justifyContent: "center"
776
- }
777
- },
778
- // Footer
779
- [`${n}-footer`]: {
780
- flexShrink: 0,
781
- padding: `${Re(D)} ${Re(A)}`,
782
- borderTop: `${Re(d)} ${x} ${g}`
783
- },
784
- // ==================== Resizable ===================
785
- [W]: {
786
- position: "absolute",
787
- zIndex: 1,
788
- backgroundColor: "transparent",
789
- userSelect: "none",
790
- pointerEvents: "auto",
791
- "&:hover": {
792
- backgroundColor: e.colorPrimary,
793
- opacity: 0.2
794
- },
795
- "&-dragging": {
796
- backgroundColor: e.colorPrimary,
797
- opacity: 0.3
798
- }
799
- },
800
- [`${W}-left`]: {
801
- top: 0,
802
- bottom: 0,
803
- right: {
804
- _skip_check_: !0,
805
- value: 0
806
- },
807
- width: L,
808
- cursor: "col-resize"
809
- },
810
- [`${W}-right`]: {
811
- top: 0,
812
- bottom: 0,
813
- left: {
814
- _skip_check_: !0,
815
- value: 0
816
- },
817
- width: L,
818
- cursor: "col-resize"
819
- },
820
- [`${W}-top`]: {
821
- insetInline: 0,
822
- bottom: 0,
823
- height: L,
824
- cursor: "row-resize"
825
- },
826
- [`${W}-bottom`]: {
827
- insetInline: 0,
828
- top: 0,
829
- height: L,
830
- cursor: "row-resize"
831
- },
832
- // Wrapper dragging state - disable transitions for smooth dragging
833
- [`${Z}-dragging`]: {
834
- userSelect: "none",
835
- transition: "none",
836
- willChange: "width, height",
837
- [`${n}-content`]: {
838
- pointerEvents: "none"
839
- },
840
- [`${n}-section`]: {
841
- pointerEvents: "none"
842
- }
843
- },
844
- // ====================== RTL =======================
845
- "&-rtl": {
846
- direction: "rtl"
847
- }
848
- }
849
- };
850
- }, gr = (e) => ({
851
- zIndexPopup: e.zIndexPopupBase,
852
- footerPaddingBlock: e.paddingXS,
853
- footerPaddingInline: e.padding,
854
- draggerSize: 4
855
- }), on = An("Drawer", (e) => {
856
- const t = Tn(e, {});
857
- return [hr(t), dr(t)];
858
- }, gr), pr = {
859
- distance: 180
860
- }, zt = 378, Pt = {
861
- motionAppear: !0,
862
- motionEnter: !0,
863
- motionLeave: !0,
864
- motionDeadline: 500
865
- }, bt = (e) => {
866
- var T;
867
- const {
868
- rootClassName: t,
869
- size: n,
870
- defaultSize: o = zt,
871
- height: r,
872
- width: s,
873
- mask: i,
874
- push: a = pr,
875
- open: c,
876
- afterOpenChange: l,
877
- onClose: u,
878
- prefixCls: E,
879
- getContainer: m,
880
- panelRef: d = null,
881
- style: x,
882
- className: g,
883
- resizable: f,
884
- "aria-labelledby": h,
885
- // Focus
886
- focusable: S,
887
- // Deprecated
888
- maskClosable: p,
889
- maskStyle: y,
890
- drawerStyle: P,
891
- contentWrapperStyle: k,
892
- destroyOnClose: D,
893
- destroyOnHidden: A,
894
- ...L
895
- } = e, {
896
- placement: H
897
- } = L, Z = Hn(), W = Ue(L.title) ? Z : void 0, {
898
- getPopupContainer: j,
899
- getPrefixCls: X,
900
- direction: U,
901
- className: ue,
902
- style: ce,
903
- classNames: de,
904
- styles: he,
905
- mask: K,
906
- focusable: z
907
- } = Yt("drawer"), N = X("drawer", E), [O, G] = on(N), Q = (
908
- // 有可能为 false,所以不能直接判断
909
- m === void 0 && j ? () => j(document.body) : m
910
- ), te = M.useMemo(() => Fn(n) ? n : n === "large" ? 736 : n === "default" ? zt : typeof n == "string" ? /^\d+(\.\d+)?$/.test(n) ? Number(n) : n : !H || H === "left" || H === "right" ? s : r, [n, H, s, r]), De = {
911
- motionName: $t(N, "mask-motion"),
912
- ...Pt
913
- }, Y = (I) => ({
914
- motionName: $t(N, `panel-motion-${I}`),
915
- ...Pt
916
- }), me = Un(), ge = Bn(d, me), [Ce, Le] = Wn("Drawer", L.zIndex), [be, $e, Ie] = qn(i, K, N, p), ye = Qn({
917
- ...z,
918
- ...S
919
- }, Q !== !1 && be), {
920
- classNames: Ee,
921
- styles: He,
922
- rootStyle: Me
923
- } = L, $ = {
924
- ...e,
925
- zIndex: Ce,
926
- panelRef: d,
927
- mask: be,
928
- maskClosable: Ie,
929
- defaultSize: o,
930
- push: a,
931
- focusable: ye
932
- }, w = ot(ce, "section"), R = ot(P, "section"), _ = ot(x, "section"), [b, v] = Xt([de, Ee], [he, w, He, R, _], {
933
- props: $
934
- }), C = oe({
935
- "no-mask": !be,
936
- [`${N}-rtl`]: U === "rtl"
937
- }, t, O, G, b.root);
938
- if (process.env.NODE_ENV !== "production") {
939
- const I = jn("Drawer");
940
- [["headerStyle", "styles.header"], ["bodyStyle", "styles.body"], ["footerStyle", "styles.footer"], ["contentWrapperStyle", "styles.wrapper"], ["maskStyle", "styles.mask"], ["drawerStyle", "styles.section"], ["destroyOnClose", "destroyOnHidden"], ["width", "size"], ["height", "size"]].forEach(([F, B]) => {
941
- I.deprecated(!(F in e), F, B);
942
- }), Q !== void 0 && ((T = e.style) == null ? void 0 : T.position) === "absolute" && process.env.NODE_ENV !== "production" && I(!1, "breaking", "`style` is replaced by `rootStyle` in v5. Please check that `position: absolute` is necessary."), I.deprecated(!(b != null && b.content || v != null && v.content), "classNames.content and styles.content", "classNames.section and styles.section");
943
- }
944
- return /* @__PURE__ */ M.createElement(Gn, {
945
- form: !0,
946
- space: !0
947
- }, /* @__PURE__ */ M.createElement(Vn.Provider, {
948
- value: Le
949
- }, /* @__PURE__ */ M.createElement(en, {
950
- prefixCls: N,
951
- onClose: u,
952
- maskMotion: De,
953
- motion: Y,
954
- ...L,
955
- classNames: {
956
- mask: oe(b.mask, $e.mask),
957
- section: b.section,
958
- wrapper: b.wrapper,
959
- dragger: b.dragger
960
- },
961
- styles: {
962
- mask: {
963
- ...v.mask,
964
- ...y
965
- },
966
- section: v.section,
967
- wrapper: {
968
- ...v.wrapper,
969
- ...k
970
- },
971
- dragger: v.dragger
972
- },
973
- open: c,
974
- mask: be,
975
- maskClosable: Ie,
976
- push: a,
977
- size: te,
978
- defaultSize: o,
979
- rootStyle: {
980
- ...v.root,
981
- ...Me
982
- },
983
- className: oe(ue, g),
984
- rootClassName: C,
985
- getContainer: Q,
986
- afterOpenChange: l,
987
- panelRef: ge,
988
- zIndex: Ce,
989
- ...f ? {
990
- resizable: f
991
- } : {},
992
- "aria-labelledby": h ?? W,
993
- destroyOnHidden: A ?? D,
994
- // Focusable
995
- focusTriggerAfterClose: ye.focusTriggerAfterClose,
996
- focusTrap: ye.trap
997
- }, /* @__PURE__ */ M.createElement(tn, {
998
- prefixCls: N,
999
- size: n,
1000
- ...L,
1001
- ariaId: W,
1002
- onClose: u
1003
- }))));
1004
- }, mr = (e) => {
1005
- const {
1006
- prefixCls: t,
1007
- style: n,
1008
- className: o,
1009
- placement: r = "right",
1010
- ...s
1011
- } = e, {
1012
- getPrefixCls: i
1013
- } = M.useContext(Zn), a = i("drawer", t), [c, l] = on(a), u = oe(a, `${a}-pure`, `${a}-${r}`, c, l, o);
1014
- return /* @__PURE__ */ M.createElement("div", {
1015
- className: u,
1016
- style: n
1017
- }, /* @__PURE__ */ M.createElement(tn, {
1018
- prefixCls: a,
1019
- ...s
1020
- }));
1021
- };
1022
- bt._InternalPanelDoNotUseOrYouWillBeFired = mr;
1023
- process.env.NODE_ENV !== "production" && (bt.displayName = "Drawer");
1024
- function yr(e) {
1025
- const t = +this._x.call(null, e), n = +this._y.call(null, e);
1026
- return sn(this.cover(t, n), t, n, e);
1027
- }
1028
- function sn(e, t, n, o) {
1029
- if (isNaN(t) || isNaN(n)) return e;
1030
- var r, s = e._root, i = { data: o }, a = e._x0, c = e._y0, l = e._x1, u = e._y1, E, m, d, x, g, f, h, S;
1031
- if (!s) return e._root = i, e;
1032
- for (; s.length; )
1033
- if ((g = t >= (E = (a + l) / 2)) ? a = E : l = E, (f = n >= (m = (c + u) / 2)) ? c = m : u = m, r = s, !(s = s[h = f << 1 | g])) return r[h] = i, e;
1034
- if (d = +e._x.call(null, s.data), x = +e._y.call(null, s.data), t === d && n === x) return i.next = s, r ? r[h] = i : e._root = i, e;
1035
- do
1036
- r = r ? r[h] = new Array(4) : e._root = new Array(4), (g = t >= (E = (a + l) / 2)) ? a = E : l = E, (f = n >= (m = (c + u) / 2)) ? c = m : u = m;
1037
- while ((h = f << 1 | g) === (S = (x >= m) << 1 | d >= E));
1038
- return r[S] = s, r[h] = i, e;
1039
- }
1040
- function vr(e) {
1041
- Array.isArray(e) || (e = Array.from(e));
1042
- const t = e.length, n = new Float64Array(t), o = new Float64Array(t);
1043
- let r = 1 / 0, s = r, i = -r, a = i;
1044
- for (let c = 0, l, u, E; c < t; ++c) {
1045
- if (isNaN(u = +this._x.call(null, l = e[c])) || isNaN(E = +this._y.call(null, l))) {
1046
- n[c] = NaN;
1047
- continue;
1048
- }
1049
- n[c] = u, o[c] = E, u < r && (r = u), u > i && (i = u), E < s && (s = E), E > a && (a = E);
1050
- }
1051
- if (r > i || s > a) return this;
1052
- this.cover(r, s).cover(i, a);
1053
- for (let c = 0; c < t; ++c)
1054
- sn(this, n[c], o[c], e[c]);
1055
- return this;
1056
- }
1057
- function xr(e, t) {
1058
- if (isNaN(e = +e) || isNaN(t = +t)) return this;
1059
- var n = this._x0, o = this._y0, r = this._x1, s = this._y1;
1060
- if (isNaN(n))
1061
- r = (n = Math.floor(e)) + 1, s = (o = Math.floor(t)) + 1;
1062
- else {
1063
- for (var i = r - n || 1, a = this._root, c, l; n > e || e >= r || o > t || t >= s; )
1064
- switch (l = (t < o) << 1 | e < n, c = new Array(4), c[l] = a, a = c, i *= 2, l) {
1065
- case 0:
1066
- r = n + i, s = o + i;
1067
- break;
1068
- case 1:
1069
- n = r - i, s = o + i;
1070
- break;
1071
- case 2:
1072
- r = n + i, o = s - i;
1073
- break;
1074
- case 3:
1075
- n = r - i, o = s - i;
1076
- break;
1077
- }
1078
- this._root && this._root.length && (this._root = a);
1079
- }
1080
- return this._x0 = n, this._y0 = o, this._x1 = r, this._y1 = s, this;
1081
- }
1082
- function wr() {
1083
- var e = [];
1084
- return this.visit(function(t) {
1085
- if (!t.length) do
1086
- e.push(t.data);
1087
- while (t = t.next);
1088
- }), e;
1089
- }
1090
- function br(e) {
1091
- return arguments.length ? this.cover(+e[0][0], +e[0][1]).cover(+e[1][0], +e[1][1]) : isNaN(this._x0) ? void 0 : [[this._x0, this._y0], [this._x1, this._y1]];
1092
- }
1093
- function se(e, t, n, o, r) {
1094
- this.node = e, this.x0 = t, this.y0 = n, this.x1 = o, this.y1 = r;
1095
- }
1096
- function Er(e, t, n) {
1097
- var o, r = this._x0, s = this._y0, i, a, c, l, u = this._x1, E = this._y1, m = [], d = this._root, x, g;
1098
- for (d && m.push(new se(d, r, s, u, E)), n == null ? n = 1 / 0 : (r = e - n, s = t - n, u = e + n, E = t + n, n *= n); x = m.pop(); )
1099
- if (!(!(d = x.node) || (i = x.x0) > u || (a = x.y0) > E || (c = x.x1) < r || (l = x.y1) < s))
1100
- if (d.length) {
1101
- var f = (i + c) / 2, h = (a + l) / 2;
1102
- m.push(
1103
- new se(d[3], f, h, c, l),
1104
- new se(d[2], i, h, f, l),
1105
- new se(d[1], f, a, c, h),
1106
- new se(d[0], i, a, f, h)
1107
- ), (g = (t >= h) << 1 | e >= f) && (x = m[m.length - 1], m[m.length - 1] = m[m.length - 1 - g], m[m.length - 1 - g] = x);
1108
- } else {
1109
- var S = e - +this._x.call(null, d.data), p = t - +this._y.call(null, d.data), y = S * S + p * p;
1110
- if (y < n) {
1111
- var P = Math.sqrt(n = y);
1112
- r = e - P, s = t - P, u = e + P, E = t + P, o = d.data;
1113
- }
1114
- }
1115
- return o;
1116
- }
1117
- function Sr(e) {
1118
- if (isNaN(u = +this._x.call(null, e)) || isNaN(E = +this._y.call(null, e))) return this;
1119
- var t, n = this._root, o, r, s, i = this._x0, a = this._y0, c = this._x1, l = this._y1, u, E, m, d, x, g, f, h;
1120
- if (!n) return this;
1121
- if (n.length) for (; ; ) {
1122
- if ((x = u >= (m = (i + c) / 2)) ? i = m : c = m, (g = E >= (d = (a + l) / 2)) ? a = d : l = d, t = n, !(n = n[f = g << 1 | x])) return this;
1123
- if (!n.length) break;
1124
- (t[f + 1 & 3] || t[f + 2 & 3] || t[f + 3 & 3]) && (o = t, h = f);
1125
- }
1126
- for (; n.data !== e; ) if (r = n, !(n = n.next)) return this;
1127
- return (s = n.next) && delete n.next, r ? (s ? r.next = s : delete r.next, this) : t ? (s ? t[f] = s : delete t[f], (n = t[0] || t[1] || t[2] || t[3]) && n === (t[3] || t[2] || t[1] || t[0]) && !n.length && (o ? o[h] = n : this._root = n), this) : (this._root = s, this);
1128
- }
1129
- function Nr(e) {
1130
- for (var t = 0, n = e.length; t < n; ++t) this.remove(e[t]);
1131
- return this;
1132
- }
1133
- function _r() {
1134
- return this._root;
1135
- }
1136
- function kr() {
1137
- var e = 0;
1138
- return this.visit(function(t) {
1139
- if (!t.length) do
1140
- ++e;
1141
- while (t = t.next);
1142
- }), e;
1143
- }
1144
- function Dr(e) {
1145
- var t = [], n, o = this._root, r, s, i, a, c;
1146
- for (o && t.push(new se(o, this._x0, this._y0, this._x1, this._y1)); n = t.pop(); )
1147
- if (!e(o = n.node, s = n.x0, i = n.y0, a = n.x1, c = n.y1) && o.length) {
1148
- var l = (s + a) / 2, u = (i + c) / 2;
1149
- (r = o[3]) && t.push(new se(r, l, u, a, c)), (r = o[2]) && t.push(new se(r, s, u, l, c)), (r = o[1]) && t.push(new se(r, l, i, a, u)), (r = o[0]) && t.push(new se(r, s, i, l, u));
1150
- }
1151
- return this;
1152
- }
1153
- function Cr(e) {
1154
- var t = [], n = [], o;
1155
- for (this._root && t.push(new se(this._root, this._x0, this._y0, this._x1, this._y1)); o = t.pop(); ) {
1156
- var r = o.node;
1157
- if (r.length) {
1158
- var s, i = o.x0, a = o.y0, c = o.x1, l = o.y1, u = (i + c) / 2, E = (a + l) / 2;
1159
- (s = r[0]) && t.push(new se(s, i, a, u, E)), (s = r[1]) && t.push(new se(s, u, a, c, E)), (s = r[2]) && t.push(new se(s, i, E, u, l)), (s = r[3]) && t.push(new se(s, u, E, c, l));
1160
- }
1161
- n.push(o);
1162
- }
1163
- for (; o = n.pop(); )
1164
- e(o.node, o.x0, o.y0, o.x1, o.y1);
1165
- return this;
1166
- }
1167
- function $r(e) {
1168
- return e[0];
1169
- }
1170
- function Ir(e) {
1171
- return arguments.length ? (this._x = e, this) : this._x;
1172
- }
1173
- function Mr(e) {
1174
- return e[1];
1175
- }
1176
- function Rr(e) {
1177
- return arguments.length ? (this._y = e, this) : this._y;
1178
- }
1179
- function Et(e, t, n) {
1180
- var o = new St(t ?? $r, n ?? Mr, NaN, NaN, NaN, NaN);
1181
- return e == null ? o : o.addAll(e);
1182
- }
1183
- function St(e, t, n, o, r, s) {
1184
- this._x = e, this._y = t, this._x0 = n, this._y0 = o, this._x1 = r, this._y1 = s, this._root = void 0;
1185
- }
1186
- function At(e) {
1187
- for (var t = { data: e.data }, n = t; e = e.next; ) n = n.next = { data: e.data };
1188
- return t;
1189
- }
1190
- var ie = Et.prototype = St.prototype;
1191
- ie.copy = function() {
1192
- var e = new St(this._x, this._y, this._x0, this._y0, this._x1, this._y1), t = this._root, n, o;
1193
- if (!t) return e;
1194
- if (!t.length) return e._root = At(t), e;
1195
- for (n = [{ source: t, target: e._root = new Array(4) }]; t = n.pop(); )
1196
- for (var r = 0; r < 4; ++r)
1197
- (o = t.source[r]) && (o.length ? n.push({ source: o, target: t.target[r] = new Array(4) }) : t.target[r] = At(o));
1198
- return e;
1199
- };
1200
- ie.add = yr;
1201
- ie.addAll = vr;
1202
- ie.cover = xr;
1203
- ie.data = wr;
1204
- ie.extent = br;
1205
- ie.find = Er;
1206
- ie.remove = Sr;
1207
- ie.removeAll = Nr;
1208
- ie.root = _r;
1209
- ie.size = kr;
1210
- ie.visit = Dr;
1211
- ie.visitAfter = Cr;
1212
- ie.x = Ir;
1213
- ie.y = Rr;
1214
- var Or = { value: () => {
1215
- } };
1216
- function an() {
1217
- for (var e = 0, t = arguments.length, n = {}, o; e < t; ++e) {
1218
- if (!(o = arguments[e] + "") || o in n || /[\s.]/.test(o)) throw new Error("illegal type: " + o);
1219
- n[o] = [];
1220
- }
1221
- return new qe(n);
1222
- }
1223
- function qe(e) {
1224
- this._ = e;
1225
- }
1226
- function zr(e, t) {
1227
- return e.trim().split(/^|\s+/).map(function(n) {
1228
- var o = "", r = n.indexOf(".");
1229
- if (r >= 0 && (o = n.slice(r + 1), n = n.slice(0, r)), n && !t.hasOwnProperty(n)) throw new Error("unknown type: " + n);
1230
- return { type: n, name: o };
1231
- });
1232
- }
1233
- qe.prototype = an.prototype = {
1234
- constructor: qe,
1235
- on: function(e, t) {
1236
- var n = this._, o = zr(e + "", n), r, s = -1, i = o.length;
1237
- if (arguments.length < 2) {
1238
- for (; ++s < i; ) if ((r = (e = o[s]).type) && (r = Pr(n[r], e.name))) return r;
1239
- return;
1240
- }
1241
- if (t != null && typeof t != "function") throw new Error("invalid callback: " + t);
1242
- for (; ++s < i; )
1243
- if (r = (e = o[s]).type) n[r] = Tt(n[r], e.name, t);
1244
- else if (t == null) for (r in n) n[r] = Tt(n[r], e.name, null);
1245
- return this;
1246
- },
1247
- copy: function() {
1248
- var e = {}, t = this._;
1249
- for (var n in t) e[n] = t[n].slice();
1250
- return new qe(e);
1251
- },
1252
- call: function(e, t) {
1253
- if ((r = arguments.length - 2) > 0) for (var n = new Array(r), o = 0, r, s; o < r; ++o) n[o] = arguments[o + 2];
1254
- if (!this._.hasOwnProperty(e)) throw new Error("unknown type: " + e);
1255
- for (s = this._[e], o = 0, r = s.length; o < r; ++o) s[o].value.apply(t, n);
1256
- },
1257
- apply: function(e, t, n) {
1258
- if (!this._.hasOwnProperty(e)) throw new Error("unknown type: " + e);
1259
- for (var o = this._[e], r = 0, s = o.length; r < s; ++r) o[r].value.apply(t, n);
1260
- }
1261
- };
1262
- function Pr(e, t) {
1263
- for (var n = 0, o = e.length, r; n < o; ++n)
1264
- if ((r = e[n]).name === t)
1265
- return r.value;
1266
- }
1267
- function Tt(e, t, n) {
1268
- for (var o = 0, r = e.length; o < r; ++o)
1269
- if (e[o].name === t) {
1270
- e[o] = Or, e = e.slice(0, o).concat(e.slice(o + 1));
1271
- break;
1272
- }
1273
- return n != null && e.push({ name: t, value: n }), e;
1274
- }
1275
- var Te = 0, We = 0, Be = 0, cn = 1e3, Je, je, et = 0, ke = 0, nt = 0, Ve = typeof performance == "object" && performance.now ? performance : Date, ln = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(e) {
1276
- setTimeout(e, 17);
1277
- };
1278
- function un() {
1279
- return ke || (ln(Ar), ke = Ve.now() + nt);
1280
- }
1281
- function Ar() {
1282
- ke = 0;
1283
- }
1284
- function vt() {
1285
- this._call = this._time = this._next = null;
1286
- }
1287
- vt.prototype = fn.prototype = {
1288
- constructor: vt,
1289
- restart: function(e, t, n) {
1290
- if (typeof e != "function") throw new TypeError("callback is not a function");
1291
- n = (n == null ? un() : +n) + (t == null ? 0 : +t), !this._next && je !== this && (je ? je._next = this : Je = this, je = this), this._call = e, this._time = n, xt();
1292
- },
1293
- stop: function() {
1294
- this._call && (this._call = null, this._time = 1 / 0, xt());
1295
- }
1296
- };
1297
- function fn(e, t, n) {
1298
- var o = new vt();
1299
- return o.restart(e, t, n), o;
1300
- }
1301
- function Tr() {
1302
- un(), ++Te;
1303
- for (var e = Je, t; e; )
1304
- (t = ke - e._time) >= 0 && e._call.call(void 0, t), e = e._next;
1305
- --Te;
1306
- }
1307
- function Lt() {
1308
- ke = (et = Ve.now()) + nt, Te = We = 0;
1309
- try {
1310
- Tr();
1311
- } finally {
1312
- Te = 0, Hr(), ke = 0;
1313
- }
1314
- }
1315
- function Lr() {
1316
- var e = Ve.now(), t = e - et;
1317
- t > cn && (nt -= t, et = e);
1318
- }
1319
- function Hr() {
1320
- for (var e, t = Je, n, o = 1 / 0; t; )
1321
- t._call ? (o > t._time && (o = t._time), e = t, t = t._next) : (n = t._next, t._next = null, t = e ? e._next = n : Je = n);
1322
- je = e, xt(o);
1323
- }
1324
- function xt(e) {
1325
- if (!Te) {
1326
- We && (We = clearTimeout(We));
1327
- var t = e - ke;
1328
- t > 24 ? (e < 1 / 0 && (We = setTimeout(Lt, Math.ceil(e - Ve.now() - nt) + 1)), Be && (Be = clearInterval(Be))) : (Be || (et = Ve.now(), Be = setInterval(Lr, cn)), Te = 1, ln(Lt));
1329
- }
1330
- }
1331
- function ae(e) {
1332
- return function() {
1333
- return e;
1334
- };
1335
- }
1336
- function Ne(e) {
1337
- return (e() - 0.5) * 1e-6;
1338
- }
1339
- function Fr(e) {
1340
- return e.x + e.vx;
1341
- }
1342
- function Br(e) {
1343
- return e.y + e.vy;
1344
- }
1345
- function dn(e) {
1346
- var t, n, o, r = 1, s = 1;
1347
- typeof e != "function" && (e = ae(e == null ? 1 : +e));
1348
- function i() {
1349
- for (var l, u = t.length, E, m, d, x, g, f, h = 0; h < s; ++h)
1350
- for (E = Et(t, Fr, Br).visitAfter(a), l = 0; l < u; ++l)
1351
- m = t[l], g = n[m.index], f = g * g, d = m.x + m.vx, x = m.y + m.vy, E.visit(S);
1352
- function S(p, y, P, k, D) {
1353
- var A = p.data, L = p.r, H = g + L;
1354
- if (A) {
1355
- if (A.index > m.index) {
1356
- var Z = d - A.x - A.vx, W = x - A.y - A.vy, j = Z * Z + W * W;
1357
- j < H * H && (Z === 0 && (Z = Ne(o), j += Z * Z), W === 0 && (W = Ne(o), j += W * W), j = (H - (j = Math.sqrt(j))) / j * r, m.vx += (Z *= j) * (H = (L *= L) / (f + L)), m.vy += (W *= j) * H, A.vx -= Z * (H = 1 - H), A.vy -= W * H);
1358
- }
1359
- return;
1360
- }
1361
- return y > d + H || k < d - H || P > x + H || D < x - H;
1362
- }
1363
- }
1364
- function a(l) {
1365
- if (l.data) return l.r = n[l.data.index];
1366
- for (var u = l.r = 0; u < 4; ++u)
1367
- l[u] && l[u].r > l.r && (l.r = l[u].r);
1368
- }
1369
- function c() {
1370
- if (t) {
1371
- var l, u = t.length, E;
1372
- for (n = new Array(u), l = 0; l < u; ++l) E = t[l], n[E.index] = +e(E, l, t);
1373
- }
1374
- }
1375
- return i.initialize = function(l, u) {
1376
- t = l, o = u, c();
1377
- }, i.iterations = function(l) {
1378
- return arguments.length ? (s = +l, i) : s;
1379
- }, i.strength = function(l) {
1380
- return arguments.length ? (r = +l, i) : r;
1381
- }, i.radius = function(l) {
1382
- return arguments.length ? (e = typeof l == "function" ? l : ae(+l), c(), i) : e;
1383
- }, i;
1384
- }
1385
- function Wr(e) {
1386
- return e.index;
1387
- }
1388
- function Ht(e, t) {
1389
- var n = e.get(t);
1390
- if (!n) throw new Error("node not found: " + t);
1391
- return n;
1392
- }
1393
- function hn(e) {
1394
- var t = Wr, n = E, o, r = ae(30), s, i, a, c, l, u = 1;
1395
- e == null && (e = []);
1396
- function E(f) {
1397
- return 1 / Math.min(a[f.source.index], a[f.target.index]);
1398
- }
1399
- function m(f) {
1400
- for (var h = 0, S = e.length; h < u; ++h)
1401
- for (var p = 0, y, P, k, D, A, L, H; p < S; ++p)
1402
- y = e[p], P = y.source, k = y.target, D = k.x + k.vx - P.x - P.vx || Ne(l), A = k.y + k.vy - P.y - P.vy || Ne(l), L = Math.sqrt(D * D + A * A), L = (L - s[p]) / L * f * o[p], D *= L, A *= L, k.vx -= D * (H = c[p]), k.vy -= A * H, P.vx += D * (H = 1 - H), P.vy += A * H;
1403
- }
1404
- function d() {
1405
- if (i) {
1406
- var f, h = i.length, S = e.length, p = new Map(i.map((P, k) => [t(P, k, i), P])), y;
1407
- for (f = 0, a = new Array(h); f < S; ++f)
1408
- y = e[f], y.index = f, typeof y.source != "object" && (y.source = Ht(p, y.source)), typeof y.target != "object" && (y.target = Ht(p, y.target)), a[y.source.index] = (a[y.source.index] || 0) + 1, a[y.target.index] = (a[y.target.index] || 0) + 1;
1409
- for (f = 0, c = new Array(S); f < S; ++f)
1410
- y = e[f], c[f] = a[y.source.index] / (a[y.source.index] + a[y.target.index]);
1411
- o = new Array(S), x(), s = new Array(S), g();
1412
- }
1413
- }
1414
- function x() {
1415
- if (i)
1416
- for (var f = 0, h = e.length; f < h; ++f)
1417
- o[f] = +n(e[f], f, e);
1418
- }
1419
- function g() {
1420
- if (i)
1421
- for (var f = 0, h = e.length; f < h; ++f)
1422
- s[f] = +r(e[f], f, e);
1423
- }
1424
- return m.initialize = function(f, h) {
1425
- i = f, l = h, d();
1426
- }, m.links = function(f) {
1427
- return arguments.length ? (e = f, d(), m) : e;
1428
- }, m.id = function(f) {
1429
- return arguments.length ? (t = f, m) : t;
1430
- }, m.iterations = function(f) {
1431
- return arguments.length ? (u = +f, m) : u;
1432
- }, m.strength = function(f) {
1433
- return arguments.length ? (n = typeof f == "function" ? f : ae(+f), x(), m) : n;
1434
- }, m.distance = function(f) {
1435
- return arguments.length ? (r = typeof f == "function" ? f : ae(+f), g(), m) : r;
1436
- }, m;
1437
- }
1438
- const jr = 1664525, Gr = 1013904223, Ft = 4294967296;
1439
- function Vr() {
1440
- let e = 1;
1441
- return () => (e = (jr * e + Gr) % Ft) / Ft;
1442
- }
1443
- function Zr(e) {
1444
- return e.x;
1445
- }
1446
- function Kr(e) {
1447
- return e.y;
1448
- }
1449
- var Yr = 10, Xr = Math.PI * (3 - Math.sqrt(5));
1450
- function gn(e) {
1451
- var t, n = 1, o = 1e-3, r = 1 - Math.pow(o, 1 / 300), s = 0, i = 0.6, a = /* @__PURE__ */ new Map(), c = fn(E), l = an("tick", "end"), u = Vr();
1452
- e == null && (e = []);
1453
- function E() {
1454
- m(), l.call("tick", t), n < o && (c.stop(), l.call("end", t));
1455
- }
1456
- function m(g) {
1457
- var f, h = e.length, S;
1458
- g === void 0 && (g = 1);
1459
- for (var p = 0; p < g; ++p)
1460
- for (n += (s - n) * r, a.forEach(function(y) {
1461
- y(n);
1462
- }), f = 0; f < h; ++f)
1463
- S = e[f], S.fx == null ? S.x += S.vx *= i : (S.x = S.fx, S.vx = 0), S.fy == null ? S.y += S.vy *= i : (S.y = S.fy, S.vy = 0);
1464
- return t;
1465
- }
1466
- function d() {
1467
- for (var g = 0, f = e.length, h; g < f; ++g) {
1468
- if (h = e[g], h.index = g, h.fx != null && (h.x = h.fx), h.fy != null && (h.y = h.fy), isNaN(h.x) || isNaN(h.y)) {
1469
- var S = Yr * Math.sqrt(0.5 + g), p = g * Xr;
1470
- h.x = S * Math.cos(p), h.y = S * Math.sin(p);
1471
- }
1472
- (isNaN(h.vx) || isNaN(h.vy)) && (h.vx = h.vy = 0);
1473
- }
1474
- }
1475
- function x(g) {
1476
- return g.initialize && g.initialize(e, u), g;
1477
- }
1478
- return d(), t = {
1479
- tick: m,
1480
- restart: function() {
1481
- return c.restart(E), t;
1482
- },
1483
- stop: function() {
1484
- return c.stop(), t;
1485
- },
1486
- nodes: function(g) {
1487
- return arguments.length ? (e = g, d(), a.forEach(x), t) : e;
1488
- },
1489
- alpha: function(g) {
1490
- return arguments.length ? (n = +g, t) : n;
1491
- },
1492
- alphaMin: function(g) {
1493
- return arguments.length ? (o = +g, t) : o;
1494
- },
1495
- alphaDecay: function(g) {
1496
- return arguments.length ? (r = +g, t) : +r;
1497
- },
1498
- alphaTarget: function(g) {
1499
- return arguments.length ? (s = +g, t) : s;
1500
- },
1501
- velocityDecay: function(g) {
1502
- return arguments.length ? (i = 1 - g, t) : 1 - i;
1503
- },
1504
- randomSource: function(g) {
1505
- return arguments.length ? (u = g, a.forEach(x), t) : u;
1506
- },
1507
- force: function(g, f) {
1508
- return arguments.length > 1 ? (f == null ? a.delete(g) : a.set(g, x(f)), t) : a.get(g);
1509
- },
1510
- find: function(g, f, h) {
1511
- var S = 0, p = e.length, y, P, k, D, A;
1512
- for (h == null ? h = 1 / 0 : h *= h, S = 0; S < p; ++S)
1513
- D = e[S], y = g - D.x, P = f - D.y, k = y * y + P * P, k < h && (A = D, h = k);
1514
- return A;
1515
- },
1516
- on: function(g, f) {
1517
- return arguments.length > 1 ? (l.on(g, f), t) : l.on(g);
1518
- }
1519
- };
1520
- }
1521
- function pn() {
1522
- var e, t, n, o, r = ae(-30), s, i = 1, a = 1 / 0, c = 0.81;
1523
- function l(d) {
1524
- var x, g = e.length, f = Et(e, Zr, Kr).visitAfter(E);
1525
- for (o = d, x = 0; x < g; ++x) t = e[x], f.visit(m);
1526
- }
1527
- function u() {
1528
- if (e) {
1529
- var d, x = e.length, g;
1530
- for (s = new Array(x), d = 0; d < x; ++d) g = e[d], s[g.index] = +r(g, d, e);
1531
- }
1532
- }
1533
- function E(d) {
1534
- var x = 0, g, f, h = 0, S, p, y;
1535
- if (d.length) {
1536
- for (S = p = y = 0; y < 4; ++y)
1537
- (g = d[y]) && (f = Math.abs(g.value)) && (x += g.value, h += f, S += f * g.x, p += f * g.y);
1538
- d.x = S / h, d.y = p / h;
1539
- } else {
1540
- g = d, g.x = g.data.x, g.y = g.data.y;
1541
- do
1542
- x += s[g.data.index];
1543
- while (g = g.next);
1544
- }
1545
- d.value = x;
1546
- }
1547
- function m(d, x, g, f) {
1548
- if (!d.value) return !0;
1549
- var h = d.x - t.x, S = d.y - t.y, p = f - x, y = h * h + S * S;
1550
- if (p * p / c < y)
1551
- return y < a && (h === 0 && (h = Ne(n), y += h * h), S === 0 && (S = Ne(n), y += S * S), y < i && (y = Math.sqrt(i * y)), t.vx += h * d.value * o / y, t.vy += S * d.value * o / y), !0;
1552
- if (d.length || y >= a) return;
1553
- (d.data !== t || d.next) && (h === 0 && (h = Ne(n), y += h * h), S === 0 && (S = Ne(n), y += S * S), y < i && (y = Math.sqrt(i * y)));
1554
- do
1555
- d.data !== t && (p = s[d.data.index] * o / y, t.vx += h * p, t.vy += S * p);
1556
- while (d = d.next);
1557
- }
1558
- return l.initialize = function(d, x) {
1559
- e = d, n = x, u();
1560
- }, l.strength = function(d) {
1561
- return arguments.length ? (r = typeof d == "function" ? d : ae(+d), u(), l) : r;
1562
- }, l.distanceMin = function(d) {
1563
- return arguments.length ? (i = d * d, l) : Math.sqrt(i);
1564
- }, l.distanceMax = function(d) {
1565
- return arguments.length ? (a = d * d, l) : Math.sqrt(a);
1566
- }, l.theta = function(d) {
1567
- return arguments.length ? (c = d * d, l) : Math.sqrt(c);
1568
- }, l;
1569
- }
1570
- function mn(e) {
1571
- var t = ae(0.1), n, o, r;
1572
- typeof e != "function" && (e = ae(e == null ? 0 : +e));
1573
- function s(a) {
1574
- for (var c = 0, l = n.length, u; c < l; ++c)
1575
- u = n[c], u.vx += (r[c] - u.x) * o[c] * a;
1576
- }
1577
- function i() {
1578
- if (n) {
1579
- var a, c = n.length;
1580
- for (o = new Array(c), r = new Array(c), a = 0; a < c; ++a)
1581
- o[a] = isNaN(r[a] = +e(n[a], a, n)) ? 0 : +t(n[a], a, n);
1582
- }
1583
- }
1584
- return s.initialize = function(a) {
1585
- n = a, i();
1586
- }, s.strength = function(a) {
1587
- return arguments.length ? (t = typeof a == "function" ? a : ae(+a), i(), s) : t;
1588
- }, s.x = function(a) {
1589
- return arguments.length ? (e = typeof a == "function" ? a : ae(+a), i(), s) : e;
1590
- }, s;
1591
- }
1592
- function yn(e) {
1593
- var t = ae(0.1), n, o, r;
1594
- typeof e != "function" && (e = ae(e == null ? 0 : +e));
1595
- function s(a) {
1596
- for (var c = 0, l = n.length, u; c < l; ++c)
1597
- u = n[c], u.vy += (r[c] - u.y) * o[c] * a;
1598
- }
1599
- function i() {
1600
- if (n) {
1601
- var a, c = n.length;
1602
- for (o = new Array(c), r = new Array(c), a = 0; a < c; ++a)
1603
- o[a] = isNaN(r[a] = +e(n[a], a, n)) ? 0 : +t(n[a], a, n);
1604
- }
1605
- }
1606
- return s.initialize = function(a) {
1607
- n = a, i();
1608
- }, s.strength = function(a) {
1609
- return arguments.length ? (t = typeof a == "function" ? a : ae(+a), i(), s) : t;
1610
- }, s.y = function(a) {
1611
- return arguments.length ? (e = typeof a == "function" ? a : ae(+a), i(), s) : e;
1612
- }, s;
1613
- }
1614
- const it = "#3d7dd4", Ur = "#89b4e8", Bt = "#1e4f8f", qr = "#94a3b8", Qr = "#64748b", Jr = "#94a3b8", Wt = "#64748b", vn = "#0052d9", xn = "#003cab", eo = "rgba(0, 82, 217, 0.25)", Nt = 52, to = "#fff", no = 11, Ge = "__uncategorized__", jt = [
1615
- { fill: "#722ed1", stroke: "#531cd3" },
1616
- // 紫
1617
- { fill: "#1890ff", stroke: "#006cd4" },
1618
- // 蓝
1619
- { fill: "#13c2c2", stroke: "#08979b" },
1620
- // 青
1621
- { fill: "#52c41a", stroke: "#389e0d" },
1622
- // 绿
1623
- { fill: "#fa8c16", stroke: "#d4670c" },
1624
- // 橙
1625
- { fill: "#f5222d", stroke: "#cf1717" },
1626
- // 红
1627
- { fill: "#eb2f96", stroke: "#c41d78" },
1628
- // 粉
1629
- { fill: "#faad14", stroke: "#d48806" },
1630
- // 金
1631
- { fill: "#2f54eb", stroke: "#1d39c4" },
1632
- // 极客蓝
1633
- { fill: "#a0d911", stroke: "#7cb305" }
1634
- // 青柠
1635
- ], Ke = { fill: vn, stroke: xn };
1636
- function Gt(e, t) {
1637
- const n = e.replace("#", ""), o = parseInt(n.slice(0, 2), 16), r = parseInt(n.slice(2, 4), 16), s = parseInt(n.slice(4, 6), 16);
1638
- return `rgba(${o}, ${r}, ${s}, ${t})`;
1639
- }
1640
- function ro(e) {
1641
- const t = /* @__PURE__ */ new Map();
1642
- return [...e].sort(
1643
- (o, r) => (o.sortOrder ?? 0) - (r.sortOrder ?? 0)
1644
- ).forEach((o, r) => {
1645
- const s = o.categoryCode || Ge;
1646
- if (t.has(s)) return;
1647
- const i = s === Ge ? Ke : jt[r % jt.length];
1648
- t.set(s, {
1649
- fill: i.fill,
1650
- stroke: i.stroke,
1651
- shadowColor: Gt(i.fill, 0.25)
1652
- });
1653
- }), t.has(Ge) || t.set(Ge, {
1654
- fill: Ke.fill,
1655
- stroke: Ke.stroke,
1656
- shadowColor: Gt(Ke.fill, 0.25)
1657
- }), t;
1658
- }
1659
- const oo = "#f59e0b", so = 2, ao = "#64748b", io = 10, co = "#2563eb", lo = "#ffffff", uo = "#f59e0b";
1660
- function fo(e, t, n) {
1661
- const o = e.data.name || e.data.code || e.data.id || "", r = t != null ? `${o}
1662
- ${t}` : o, s = (n == null ? void 0 : n.fill) ?? vn, i = (n == null ? void 0 : n.stroke) ?? xn, a = (n == null ? void 0 : n.shadowColor) ?? eo;
1663
- return {
1664
- // ─── 对应 ECharts itemStyle ───
1665
- fill: s,
1666
- stroke: i,
1667
- lineWidth: 1,
1668
- // opacity 基线必须显式声明:G6 v5 移除 state 时只回退「基线有值」的属性,
1669
- // 缺省时 focusDim 写入的 opacity 0.2 会永久残留(emphasis 节点变半透明)
1670
- opacity: 1,
1671
- shadowColor: a,
1672
- shadowBlur: 8,
1673
- // ─── 对应 ECharts symbolSize ───
1674
- size: Nt,
1675
- // 节点渲染在边之上,避免边线覆盖节点
1676
- zIndex: 10,
1677
- // ─── 对应 ECharts label ───
1678
- labelText: r,
1679
- labelFill: to,
1680
- labelFontSize: no,
1681
- labelFontWeight: "bold",
1682
- // G6 v5 用 labelPlacement 控制标签位置(非 labelPosition),默认 'bottom'
1683
- labelPlacement: "center"
1684
- };
1685
- }
1686
- function ho(e, t) {
1687
- const n = e.data.displayName || "", o = t != null ? `${n}
1688
- ${t}` : n, r = e.data.isSelfAssoc;
1689
- return {
1690
- stroke: oo,
1691
- lineWidth: so,
1692
- opacity: 0.7,
1693
- // 边渲染在节点之下
1694
- zIndex: 1,
1695
- ...r ? { endArrow: !0, endArrowSize: 8 } : {},
1696
- // 边 label(对应 ECharts edgeLabel)
1697
- labelText: o,
1698
- labelFill: ao,
1699
- labelFontSize: io,
1700
- labelFontWeight: "bold",
1701
- // 标签沿连线方向自动旋转(参考图中边上文字斜排)
1702
- labelAutoRotate: !0,
1703
- // 白底衬底:边标签直接压在连线上会与中线文字互相穿透,衬底隔开
1704
- labelBackground: !0,
1705
- labelBackgroundFill: "#fff",
1706
- labelBackgroundOpacity: 0.85,
1707
- labelBackgroundRadius: 4,
1708
- labelPadding: [2, 4]
1709
- };
1710
- }
1711
- const xe = {
1712
- // hover/选中 emphasis
1713
- emphasis: {
1714
- node: {
1715
- fill: co,
1716
- stroke: lo,
1717
- lineWidth: 3,
1718
- // 显式覆盖 focusDim 残留的 0.2(G6 v5 state opacity 不随移除回退)
1719
- opacity: 1,
1720
- shadowColor: "rgba(37, 99, 235, 0.55)",
1721
- shadowBlur: 16
1722
- },
1723
- edge: {
1724
- stroke: uo,
1725
- lineWidth: 4,
1726
- shadowColor: "rgba(245, 158, 11, 0.45)",
1727
- shadowBlur: 8
1728
- }
1729
- },
1730
- // 路径高亮节点(对应 PATH_HL_COLOR 等)
1731
- pathHighlight: {
1732
- node: {
1733
- fill: it,
1734
- stroke: Ur,
1735
- lineWidth: 2,
1736
- shadowColor: "rgba(61, 125, 212, 0.75)",
1737
- shadowBlur: 20,
1738
- labelFill: "#fff",
1739
- labelFontWeight: "bold"
1740
- },
1741
- edge: {
1742
- stroke: it,
1743
- lineWidth: 4,
1744
- opacity: 1,
1745
- shadowColor: "rgba(61, 125, 212, 0.55)",
1746
- shadowBlur: 12,
1747
- labelFill: "#1e3a5f",
1748
- labelFontWeight: "bold"
1749
- }
1750
- },
1751
- // 路径末尾节点(对应 PATH_HL_DEEP)
1752
- pathLast: {
1753
- node: {
1754
- fill: it,
1755
- stroke: Bt,
1756
- lineWidth: 4,
1757
- shadowColor: "rgba(61, 125, 212, 0.75)",
1758
- shadowBlur: 20,
1759
- labelFill: "#fff",
1760
- labelFontWeight: "bold"
1761
- },
1762
- edge: {
1763
- stroke: Bt,
1764
- lineWidth: 4,
1765
- opacity: 1,
1766
- shadowColor: "rgba(61, 125, 212, 0.55)",
1767
- shadowBlur: 12,
1768
- labelFill: "#1e3a5f",
1769
- labelFontWeight: "bold"
1770
- }
1771
- },
1772
- // 路径弱化节点(对应 PATH_DIM_NODE_COLOR 等)
1773
- pathDim: {
1774
- node: {
1775
- fill: qr,
1776
- stroke: Qr,
1777
- lineWidth: 1,
1778
- opacity: 1,
1779
- labelFill: Wt
1780
- },
1781
- edge: {
1782
- stroke: Jr,
1783
- lineWidth: 1,
1784
- opacity: 0.9,
1785
- labelFill: Wt
1786
- }
1787
- },
1788
- // 聚焦弱化节点(概览右栏聚焦态:非相关节点整体压暗突出焦点邻域,不动配色)
1789
- focusDim: {
1790
- node: {
1791
- opacity: 0.2
1792
- },
1793
- // 与 pathDim.edge 对齐:邻接弱化节点的边同步降透明,避免亮边穿插弱化区
1794
- edge: {
1795
- opacity: 0.2
1796
- }
1797
- }
1798
- };
1799
- function wn(e, t) {
1800
- const n = /* @__PURE__ */ new Map();
1801
- e.forEach((s) => n.set(s.id, /* @__PURE__ */ new Set())), t.forEach((s) => {
1802
- var c, l;
1803
- const i = String(s.source), a = String(s.target);
1804
- (c = n.get(i)) == null || c.add(a), (l = n.get(a)) == null || l.add(i);
1805
- });
1806
- const o = /* @__PURE__ */ new Map();
1807
- let r = 0;
1808
- return e.forEach((s) => {
1809
- var a;
1810
- if (o.has(s.id)) return;
1811
- const i = [s.id];
1812
- for (o.set(s.id, r); i.length > 0; ) {
1813
- const c = i.shift();
1814
- (a = n.get(c)) == null || a.forEach((l) => {
1815
- o.has(l) || (o.set(l, r), i.push(l));
1816
- });
1817
- }
1818
- r += 1;
1819
- }), o;
1820
- }
1821
- function bn(e, t, n, o = !1) {
1822
- const r = /* @__PURE__ */ new Map();
1823
- e.forEach((m) => {
1824
- r.set(m, (r.get(m) ?? 0) + 1);
1825
- });
1826
- const s = Array.from(r.keys()).sort(
1827
- (m, d) => (r.get(d) ?? 0) - (r.get(m) ?? 0)
1828
- ), i = t / 2, a = n / 2, c = /* @__PURE__ */ new Map();
1829
- if (s.length === 1)
1830
- return c.set(s[0], { x: i, y: a }), c;
1831
- const l = s.filter((m) => (r.get(m) ?? 0) === 1), u = s.filter((m) => (r.get(m) ?? 0) > 1);
1832
- if (o && (u.length === 0 || l.length > 12)) {
1833
- const m = Math.min(t, n) * 0.08, d = Math.ceil(Math.sqrt(l.length)), x = Math.ceil(l.length / d), g = (t - m * 2) / d, f = (n - m * 2) / x;
1834
- return l.forEach((h, S) => {
1835
- c.set(h, {
1836
- x: m + (S % d + 0.5) * g,
1837
- y: m + (Math.floor(S / d) + 0.5) * f
1838
- });
1839
- }), u.length === 0 || u.forEach((h, S) => {
1840
- if (S === 0) {
1841
- c.set(h, { x: i, y: a });
1842
- return;
1843
- }
1844
- const p = (S - 1) / Math.max(u.length - 1, 1) * Math.PI * 2 - Math.PI / 2, y = Math.min(t, n) * 0.3;
1845
- c.set(h, {
1846
- x: i + Math.cos(p) * y,
1847
- y: a + Math.sin(p) * y
1848
- });
1849
- }), c;
1850
- }
1851
- if (l.length === s.length) {
1852
- const m = Math.min(t, n) * 0.32;
1853
- return s.forEach((d, x) => {
1854
- const g = x / s.length * Math.PI * 2 - Math.PI / 2;
1855
- c.set(d, {
1856
- x: i + Math.cos(g) * m,
1857
- y: a + Math.sin(g) * m
1858
- });
1859
- }), c;
1860
- }
1861
- return s.forEach((m, d) => {
1862
- if (!c.has(m))
1863
- if (!c.size)
1864
- c.set(m, { x: i, y: a });
1865
- else {
1866
- const x = d / (s.length - 1) * Math.PI * 2, g = Math.min(t, n) * 0.28;
1867
- c.set(m, {
1868
- x: i + Math.cos(x) * g,
1869
- y: a + Math.sin(x) * g
1870
- });
1871
- }
1872
- }), c;
1873
- }
1874
- const go = 0.55, po = 1.2;
1875
- function En(e, t, n, o, r, s, i) {
1876
- if (!i || e === 0)
1877
- return { collideRadius: o * 1.3, linkDistance: r, chargeStrength: s };
1878
- const a = o * 1.15, c = Math.max(t - a * 2, 1), l = Math.max(n - a * 2, 1), u = c * l, E = Math.min(
1879
- o * 1.3,
1880
- Math.max(
1881
- o * 0.4,
1882
- Math.sqrt(u * go / (Math.PI * e))
1883
- )
1884
- ), m = Math.min(
1885
- 1,
1886
- Math.sqrt(u * po ** 2 / e) / r
1887
- );
1888
- return {
1889
- collideRadius: E,
1890
- linkDistance: Math.max(o * 0.75, r * m),
1891
- chargeStrength: s * m * m
1892
- };
1893
- }
1894
- function mo(e, t, n, o) {
1895
- const {
1896
- nodeSize: r = Nt,
1897
- linkDistance: s = 140,
1898
- chargeStrength: i = -450,
1899
- spreadIsolated: a = !1,
1900
- adaptiveDensity: c = !1,
1901
- seed: l
1902
- } = o ?? {}, { nodes: u, edges: E } = e;
1903
- if (u.length === 0) return;
1904
- const m = Math.min(t, n) * 0.14, d = u.map((k, D) => {
1905
- const A = l == null ? void 0 : l[k.id];
1906
- return {
1907
- id: k.id,
1908
- x: (A == null ? void 0 : A.x) ?? t / 2 + Math.cos(D / Math.max(u.length, 1) * Math.PI * 2) * m,
1909
- y: (A == null ? void 0 : A.y) ?? n / 2 + Math.sin(D / Math.max(u.length, 1) * Math.PI * 2) * m,
1910
- vx: 0,
1911
- vy: 0,
1912
- ...A ? { fx: A.x, fy: A.y } : {}
1913
- };
1914
- }), x = E.filter((k) => k.source !== k.target).map((k) => ({
1915
- source: k.source,
1916
- target: k.target
1917
- })), g = wn(d, x), f = bn(
1918
- g,
1919
- t,
1920
- n,
1921
- a
1922
- ), h = En(
1923
- u.length,
1924
- t,
1925
- n,
1926
- r,
1927
- s,
1928
- i,
1929
- c
1930
- ), S = (k) => {
1931
- const D = g.get(k);
1932
- return D === void 0 ? void 0 : f.get(D);
1933
- }, p = gn(d).force(
1934
- "link",
1935
- hn(x).id((k) => k.id).distance(h.linkDistance)
1936
- ).force("charge", pn().strength(h.chargeStrength)).force(
1937
- "x",
1938
- mn((k) => {
1939
- var D;
1940
- return ((D = S(k.id)) == null ? void 0 : D.x) ?? t / 2;
1941
- }).strength(0.1)
1942
- ).force(
1943
- "y",
1944
- yn((k) => {
1945
- var D;
1946
- return ((D = S(k.id)) == null ? void 0 : D.y) ?? n / 2;
1947
- }).strength(0.1)
1948
- ).force("collide", dn(h.collideRadius)).velocityDecay(0.3).alphaDecay(0.0228).stop();
1949
- for (let k = 0; k < 500; k++)
1950
- p.tick();
1951
- const y = r * 1.15, P = (k, D, A) => Math.max(D, Math.min(A, k));
1952
- u.forEach((k, D) => {
1953
- k.style || (k.style = {}), k.style.x = c ? d[D].x ?? t / 2 : P(d[D].x ?? t / 2, y, Math.max(y, t - y)), k.style.y = c ? d[D].y ?? n / 2 : P(d[D].y ?? n / 2, y, Math.max(y, n - y));
1954
- });
1955
- }
1956
- function Vt(e, t, n, o, r) {
1957
- const {
1958
- nodeSize: s = Nt,
1959
- linkDistance: i = 140,
1960
- chargeStrength: a = -450,
1961
- spreadIsolated: c = !1,
1962
- adaptiveDensity: l = !1
1963
- } = r ?? {}, { nodes: u, edges: E } = e;
1964
- if (u.length === 0) return null;
1965
- const m = u.map((p) => {
1966
- var y, P;
1967
- return {
1968
- id: p.id,
1969
- x: ((y = p.style) == null ? void 0 : y.x) ?? t / 2,
1970
- y: ((P = p.style) == null ? void 0 : P.y) ?? n / 2,
1971
- vx: 0,
1972
- vy: 0
1973
- };
1974
- }), d = E.filter((p) => p.source !== p.target).map((p) => ({ source: p.source, target: p.target })), x = wn(m, d), g = bn(
1975
- x,
1976
- t,
1977
- n,
1978
- c
1979
- ), f = (p) => {
1980
- const y = x.get(p);
1981
- return y === void 0 ? void 0 : g.get(y);
1982
- }, h = En(
1983
- u.length,
1984
- t,
1985
- n,
1986
- s,
1987
- i,
1988
- a,
1989
- l
1990
- );
1991
- return { simulation: gn(m).force(
1992
- "link",
1993
- hn(d).id((p) => p.id).distance(h.linkDistance)
1994
- ).force("charge", pn().strength(h.chargeStrength)).force(
1995
- "x",
1996
- mn((p) => {
1997
- var y;
1998
- return ((y = f(p.id)) == null ? void 0 : y.x) ?? t / 2;
1999
- }).strength(0.1)
2000
- ).force(
2001
- "y",
2002
- yn((p) => {
2003
- var y;
2004
- return ((y = f(p.id)) == null ? void 0 : y.y) ?? n / 2;
2005
- }).strength(0.1)
2006
- ).force("collide", dn(h.collideRadius)).velocityDecay(0.3).alphaDecay(0.0228).on("tick", o).alpha(0).stop(), d3Nodes: m };
2007
- }
2008
- const yo = [
2009
- // 滚轮缩放(对应 scaleLimit: { min: 0.5, max: 3 })
2010
- {
2011
- type: "zoom-canvas",
2012
- key: "zoom-canvas",
2013
- zoomRange: [0.2, 3]
2014
- },
2015
- // 画布平移(对应 roam: true 的平移部分)
2016
- {
2017
- type: "drag-canvas",
2018
- key: "drag-canvas"
2019
- },
2020
- // 节点拖拽(对应 draggable: true)
2021
- {
2022
- type: "drag-element",
2023
- key: "drag-element"
2024
- },
2025
- // hover 高亮(对应 ECharts emphasis)
2026
- {
2027
- type: "hover-activate",
2028
- key: "hover-activate",
2029
- degree: 0,
2030
- state: "emphasis"
2031
- }
2032
- ];
2033
- function vo(e, t, n, o) {
2034
- return {
2035
- nodes: e.data.map((r) => {
2036
- const s = r.id, i = r.code ?? s, a = r.name ?? "", c = r.categoryCode || Ge;
2037
- return {
2038
- id: s,
2039
- data: {
2040
- ...r,
2041
- code: i,
2042
- name: a,
2043
- ...r.categoryCode ? { categoryCode: r.categoryCode } : {}
2044
- },
2045
- style: fo(
2046
- { data: { code: i, name: a } },
2047
- t == null ? void 0 : t[i.toLowerCase()],
2048
- o == null ? void 0 : o.get(c)
2049
- )
2050
- };
2051
- }),
2052
- edges: e.links.map((r, s) => {
2053
- const i = r.code || r.value, a = `edge-${r.source}-${r.target}-${i}-${s}`, c = i ?? "", l = r.displayName || r.value || "", u = r.sourceName || "", E = r.targetName || "";
2054
- return {
2055
- id: a,
2056
- source: r.source,
2057
- // source===target 时 G6 原生渲染自关联 loop edge
2058
- target: r.target,
2059
- data: {
2060
- ...r,
2061
- code: c,
2062
- displayName: l,
2063
- sourceName: u,
2064
- targetName: E
2065
- },
2066
- style: ho(
2067
- {
2068
- source: r.source,
2069
- target: r.target,
2070
- data: {
2071
- code: c,
2072
- displayName: l,
2073
- sourceName: u,
2074
- targetName: E,
2075
- isSelfAssoc: r.isSelfAssoc
2076
- }
2077
- },
2078
- n == null ? void 0 : n[c.toLowerCase()]
2079
- )
2080
- };
2081
- })
2082
- };
2083
- }
2084
- const Zt = 120, xo = [10, 10, 10, 10];
2085
- async function Ye(e) {
2086
- if (await e.fitView(), !e.destroyed && e.getZoom() > 1) {
2087
- if (await e.zoomTo(1), e.destroyed) return;
2088
- await e.fitCenter();
2089
- }
2090
- }
2091
- function Xe(e) {
2092
- return e.context;
2093
- }
2094
- function re(e) {
2095
- return typeof e == "object" && e !== null ? e : {};
2096
- }
2097
- function ee(e) {
2098
- return typeof e == "string" ? e : "";
2099
- }
2100
- function we(e, t = 0) {
2101
- return typeof e == "number" && Number.isFinite(e) ? e : t;
2102
- }
2103
- function Sn(e) {
2104
- const t = re(e).preventDefault;
2105
- typeof t == "function" && t.call(e);
2106
- }
2107
- function Pe(e, t, n) {
2108
- const o = re(e), r = ee(re(o.target).id) || ee(o.itemId);
2109
- let s = {};
2110
- if (n && r)
2111
- try {
2112
- const E = t === "node" ? n.getNodeData([r]) : n.getEdgeData([r]);
2113
- s = re(E == null ? void 0 : E[0]);
2114
- } catch {
2115
- }
2116
- const i = re(s.data), a = {
2117
- ...i,
2118
- id: ee(s.id) || r,
2119
- code: ee(i.code) || ee(i.value) || ee(s.id) || r,
2120
- name: ee(i.name) || ee(i.displayName) || ""
2121
- };
2122
- ee(s.source) && (a.source = ee(s.source)), ee(s.target) && (a.target = ee(s.target));
2123
- const c = re(o.viewport ?? o.canvasPoint ?? o.point), l = re(o.client ?? o.clientPoint), u = re(o.nativeEvent);
2124
- return {
2125
- dataType: t,
2126
- data: a,
2127
- name: ee(i.name) || ee(i.displayName) || r,
2128
- event: {
2129
- event: {
2130
- offsetX: we(c.x),
2131
- offsetY: we(c.y),
2132
- clientX: we(l.x, we(u.clientX)),
2133
- clientY: we(l.y, we(u.clientY)),
2134
- metaKey: !!(o.metaKey ?? re(o.originalEvent).metaKey ?? u.metaKey),
2135
- ctrlKey: !!(o.ctrlKey ?? re(o.originalEvent).ctrlKey ?? u.ctrlKey),
2136
- preventDefault: () => Sn(e)
2137
- }
2138
- }
2139
- };
2140
- }
2141
- function wo(e) {
2142
- const {
2143
- // layout 已移除:G6 v5 animation:false 时 preLayout 同步失效,
2144
- // 改用 computeForceLayout 预计算位置写入 style.x/y
2145
- zoomRange: t = [0.2, 3],
2146
- onNodeClick: n,
2147
- onNodeDoubleClick: o,
2148
- onEdgeClick: r,
2149
- onNodeContextMenu: s,
2150
- onNodeHover: i,
2151
- onEdgeHover: a,
2152
- onHoverLeave: c,
2153
- onCanvasClick: l,
2154
- onViewportChange: u,
2155
- tooltipFormatter: E,
2156
- forceLayoutOptions: m,
2157
- ctxMenuOpenRef: d,
2158
- nodeInstanceCountRef: x,
2159
- edgeInstanceCountRef: g
2160
- } = e, f = ne(null), [h, S] = ve(!1), p = ne(null), [y, P] = ve(!1), k = ne(!1), D = ne(null), A = ne(null), L = ne(null), H = ne(null), Z = ne(() => {
2161
- }), W = ne(null), j = ne(!1), X = ne(null), U = ne([]), ue = ne(null), ce = ne(!1), de = ne(void 0);
2162
- _e(() => {
2163
- de.current = m;
2164
- });
2165
- const he = ne(0), K = ne({
2166
- onNodeClick: n,
2167
- onNodeDoubleClick: o,
2168
- onEdgeClick: r,
2169
- onNodeContextMenu: s,
2170
- onNodeHover: i,
2171
- onEdgeHover: a,
2172
- onHoverLeave: c,
2173
- onCanvasClick: l,
2174
- onViewportChange: u,
2175
- tooltipFormatter: E,
2176
- ctxMenuOpenRef: d,
2177
- nodeInstanceCountRef: x,
2178
- edgeInstanceCountRef: g
2179
- });
2180
- _e(() => {
2181
- K.current = {
2182
- onNodeClick: n,
2183
- onNodeDoubleClick: o,
2184
- onEdgeClick: r,
2185
- onNodeContextMenu: s,
2186
- onNodeHover: i,
2187
- onEdgeHover: a,
2188
- onHoverLeave: c,
2189
- onCanvasClick: l,
2190
- onViewportChange: u,
2191
- tooltipFormatter: E,
2192
- ctxMenuOpenRef: d,
2193
- nodeInstanceCountRef: x,
2194
- edgeInstanceCountRef: g
2195
- };
2196
- });
2197
- const z = q(($) => {
2198
- $ ? (f.current = $, S(!0)) : (f.current = null, S(!1));
2199
- }, []);
2200
- _e(() => {
2201
- if (!h) return;
2202
- const $ = f.current;
2203
- if (!$ || p.current) return;
2204
- let w = !0;
2205
- const R = {
2206
- container: $,
2207
- autoResize: !0,
2208
- animation: !1,
2209
- data: { nodes: [], edges: [] },
2210
- padding: xo,
2211
- // 不设置 G6 内置 layout — 使用 computeForceLayout 预计算位置
2212
- // 避免 G6 preLayout 在 animation:false 时与预计算位置冲突
2213
- zoomRange: t,
2214
- behaviors: yo,
2215
- // 处理平行边和自环边:分散模式自动将多条自环分配到 8 个位置
2216
- transforms: [{ type: "process-parallel-edges" }],
2217
- node: {
2218
- type: "circle",
2219
- state: {
2220
- emphasis: xe.emphasis.node,
2221
- pathHighlight: xe.pathHighlight.node,
2222
- pathLast: xe.pathLast.node,
2223
- pathDim: xe.pathDim.node,
2224
- focusDim: xe.focusDim.node
2225
- }
2226
- },
2227
- edge: {
2228
- type: "quadratic",
2229
- state: {
2230
- emphasis: xe.emphasis.edge,
2231
- pathHighlight: xe.pathHighlight.edge,
2232
- pathLast: xe.pathLast.edge,
2233
- pathDim: xe.pathDim.edge,
2234
- focusDim: xe.focusDim.edge
2235
- }
2236
- },
2237
- plugins: [
2238
- {
2239
- type: "tooltip",
2240
- key: "tooltip",
2241
- getContent: (_, b) => {
2242
- var F;
2243
- const v = K.current;
2244
- if (!v.tooltipFormatter || (F = v.ctxMenuOpenRef) != null && F.current || !(b != null && b[0])) return "";
2245
- const C = re(b[0]), T = "source" in C ? "edge" : "node", I = {
2246
- ...re(C.data),
2247
- id: ee(C.id)
2248
- };
2249
- return ee(C.source) && (I.source = ee(C.source)), ee(C.target) && (I.target = ee(C.target)), v.tooltipFormatter(I, T);
2250
- }
2251
- }
2252
- ]
2253
- };
2254
- try {
2255
- const _ = new Dn(R);
2256
- p.current = _, _.on("node:click", (b) => {
2257
- var C, T;
2258
- const v = Pe(b, "node", _);
2259
- (T = (C = K.current).onNodeClick) == null || T.call(C, v);
2260
- }), _.on("node:dblclick", (b) => {
2261
- var C, T;
2262
- const v = Pe(b, "node", _);
2263
- (T = (C = K.current).onNodeDoubleClick) == null || T.call(C, v);
2264
- }), _.on("edge:click", (b) => {
2265
- var C, T;
2266
- const v = Pe(b, "edge", _);
2267
- (T = (C = K.current).onEdgeClick) == null || T.call(C, v);
2268
- }), _.on("node:contextmenu", (b) => {
2269
- var C, T;
2270
- Sn(b);
2271
- const v = Pe(b, "node", _);
2272
- (T = (C = K.current).onNodeContextMenu) == null || T.call(C, v);
2273
- }), _.on("canvas:click", () => {
2274
- var b, v;
2275
- (v = (b = K.current).onCanvasClick) == null || v.call(b);
2276
- }), _.on("aftertransform", () => {
2277
- var b, v;
2278
- he.current > 0 || (v = (b = K.current).onViewportChange) == null || v.call(b);
2279
- }), _.on("node:pointerenter", (b) => {
2280
- var C, T;
2281
- const v = Pe(b, "node", _);
2282
- (T = (C = K.current).onNodeHover) == null || T.call(C, v);
2283
- }), _.on("edge:pointerenter", (b) => {
2284
- var C, T;
2285
- const v = Pe(b, "edge", _);
2286
- (T = (C = K.current).onEdgeHover) == null || T.call(C, v);
2287
- }), _.on("node:pointerleave", () => {
2288
- var b, v;
2289
- (v = (b = K.current).onHoverLeave) == null || v.call(b);
2290
- }), _.on("edge:pointerleave", () => {
2291
- var b, v;
2292
- (v = (b = K.current).onHoverLeave) == null || v.call(b);
2293
- }), _.on("node:dragstart", (b) => {
2294
- var J;
2295
- const v = re(b), C = ee(re(v.target).id) || ee(v.itemId);
2296
- if (!C) return;
2297
- const T = U.current.find((pe) => pe.id === C);
2298
- if (!T || !X.current) return;
2299
- ue.current = C;
2300
- const I = (J = _.getNodeData([C])) == null ? void 0 : J[0], F = we(re(I == null ? void 0 : I.style).x, T.x ?? 0), B = we(re(I == null ? void 0 : I.style).y, T.y ?? 0);
2301
- T.fx = F, T.fy = B, X.current.alphaTarget(0.3).alpha(0.3).restart();
2302
- }), _.on("node:drag", (b) => {
2303
- const v = ue.current;
2304
- if (!v || !X.current) return;
2305
- const C = U.current.find((J) => J.id === v);
2306
- if (!C) return;
2307
- const T = re(b), I = _.getZoom(), F = we(T.dx) / I, B = we(T.dy) / I;
2308
- C.fx = (C.fx ?? C.x ?? 0) + F, C.fy = (C.fy ?? C.y ?? 0) + B;
2309
- }), _.on("node:dragend", () => {
2310
- X.current && X.current.alphaTarget(0), ue.current = null;
2311
- }), queueMicrotask(() => {
2312
- w && P(!0);
2313
- });
2314
- } catch (_) {
2315
- console.error("[G6] Failed to create graph:", _);
2316
- }
2317
- return () => {
2318
- w = !1, X.current && (X.current.stop(), X.current = null), L.current && (clearTimeout(L.current), L.current = null), A.current = null, p.current && (p.current.destroy(), p.current = null, j.current = !1, D.current = null, P(!1));
2319
- };
2320
- }, [h]), _e(() => {
2321
- if (!h) return;
2322
- const $ = f.current;
2323
- if (!$) return;
2324
- const w = new ResizeObserver(() => {
2325
- var R;
2326
- if (A.current) {
2327
- Z.current();
2328
- return;
2329
- }
2330
- (R = W.current) == null || R.call(W);
2331
- });
2332
- return w.observe($), H.current = w, () => {
2333
- w.disconnect(), H.current === w && (H.current = null);
2334
- };
2335
- }, [h]);
2336
- const N = q(() => {
2337
- var R;
2338
- const $ = p.current;
2339
- if (!$ || $.destroyed) return;
2340
- const w = (R = Xe($)) == null ? void 0 : R.canvas;
2341
- w != null && w.getLayers && Object.values(w.getLayers()).forEach((_) => {
2342
- var v;
2343
- const b = (v = _.getRenderingService) == null ? void 0 : v.call(_);
2344
- b != null && b.dirty && b.dirty(), !_.frameId && typeof _.run == "function" && _.run(), typeof _.render == "function" && _.render();
2345
- });
2346
- }, []), O = q(
2347
- async ($) => {
2348
- he.current += 1;
2349
- try {
2350
- await $();
2351
- } finally {
2352
- he.current -= 1;
2353
- }
2354
- },
2355
- []
2356
- ), G = q(() => {
2357
- const $ = p.current;
2358
- if (!$ || $.destroyed) return;
2359
- const w = U.current;
2360
- if (!w.length) return;
2361
- const R = w.filter((_) => _.fx == null && _.fy == null).map((_) => ({ id: _.id, style: { x: _.x, y: _.y } }));
2362
- R.length !== 0 && ($.updateData({ nodes: R, edges: [] }), N());
2363
- }, [N]), Q = ne({ emphasisNodes: /* @__PURE__ */ new Set(), emphasisEdgeCodes: /* @__PURE__ */ new Set(), dimmedNodes: /* @__PURE__ */ new Set() }), te = q(
2364
- ($) => {
2365
- const w = $ ?? p.current;
2366
- if (!w || w.destroyed || !j.current) return;
2367
- const { emphasisNodes: R, emphasisEdgeCodes: _, dimmedNodes: b } = Q.current, v = {};
2368
- w.getNodeData().forEach((C) => {
2369
- const T = String(C.id), F = (w.getElementState(T) ?? []).filter((B) => B !== "emphasis" && B !== "focusDim");
2370
- R.has(T) && F.push("emphasis"), b.has(T) && F.push("focusDim"), v[T] = F;
2371
- }), w.getEdgeData().forEach((C) => {
2372
- var J, pe;
2373
- const T = String(C.id), F = (w.getElementState(T) ?? []).filter((fe) => fe !== "emphasis" && fe !== "focusDim"), B = String(((J = C.data) == null ? void 0 : J.code) ?? ((pe = C.data) == null ? void 0 : pe.value) ?? "");
2374
- B && _.has(B) && F.push("emphasis"), (b.has(String(C.source)) || b.has(String(C.target))) && F.push("focusDim"), v[T] = F;
2375
- }), Promise.resolve(w.setElementState(v)).then(() => N()).catch(() => {
2376
- });
2377
- },
2378
- [N]
2379
- ), De = q(
2380
- ($, w, R) => {
2381
- Q.current = {
2382
- emphasisNodes: new Set($),
2383
- emphasisEdgeCodes: new Set(w),
2384
- dimmedNodes: new Set(R)
2385
- }, te();
2386
- },
2387
- [te]
2388
- ), Y = q(
2389
- ($, w, R, _, b) => {
2390
- var T, I, F;
2391
- const v = p.current;
2392
- if (!v || v.destroyed)
2393
- return;
2394
- let C;
2395
- if (b && D.current) {
2396
- const B = {};
2397
- D.current.nodes.forEach((J) => {
2398
- var Se, Fe;
2399
- const pe = (Se = J.style) == null ? void 0 : Se.x, fe = (Fe = J.style) == null ? void 0 : Fe.y;
2400
- typeof pe == "number" && typeof fe == "number" && (B[J.id] = { x: pe, y: fe });
2401
- }), Object.keys(B).length && (C = B);
2402
- }
2403
- mo($, w, R, {
2404
- ...de.current,
2405
- ...C ? { seed: C } : {}
2406
- }), v.setData($), (F = (I = (T = Xe(v)) == null ? void 0 : T.model) == null ? void 0 : I.refreshData) == null || F.call(I), j.current = !1, !D.current || D.current.nodes.length === 0 ? v.render().then(async () => {
2407
- if (p.current !== v || v.destroyed || (await O(() => Ye(v)), p.current !== v || v.destroyed)) return;
2408
- N(), X.current && X.current.stop();
2409
- const B = Vt(
2410
- $,
2411
- w,
2412
- R,
2413
- G,
2414
- de.current
2415
- );
2416
- B && (X.current = B.simulation, U.current = B.d3Nodes), j.current = !0, te(v);
2417
- }).catch((B) => {
2418
- console.error("[G6] render failed:", B), p.current === v && (j.current = !0);
2419
- }) : v.draw().then(async () => {
2420
- var pe, fe, Se;
2421
- if (p.current !== v || v.destroyed) return;
2422
- const B = ce.current;
2423
- ce.current = !1, B || N(), X.current && X.current.stop();
2424
- const J = Vt(
2425
- $,
2426
- w,
2427
- R,
2428
- G,
2429
- de.current
2430
- );
2431
- J && (X.current = J.simulation, U.current = J.d3Nodes), !(_ && !B && (await O(() => Ye(v)), p.current !== v || v.destroyed)) && (j.current = !0, B ? ((Se = (fe = (pe = Xe(v)) == null ? void 0 : pe.model) == null ? void 0 : fe.refreshData) == null || Se.call(fe), v.draw().then(async () => {
2432
- p.current !== v || v.destroyed || (await O(() => Ye(v)), !(p.current !== v || v.destroyed) && (N(), te(v)));
2433
- }).catch(() => {
2434
- p.current === v && N();
2435
- })) : te(v));
2436
- }).catch((B) => {
2437
- console.error("[G6] draw failed:", B), p.current === v && (j.current = !0);
2438
- }), D.current = $;
2439
- },
2440
- [N, G, O, te]
2441
- ), me = q(() => {
2442
- L.current && clearTimeout(L.current), L.current = setTimeout(() => {
2443
- const $ = A.current, w = f.current;
2444
- if (!$ || !w) return;
2445
- const R = w.clientWidth, _ = w.clientHeight;
2446
- R <= 0 || _ <= 0 || (A.current = null, Y($, R, _));
2447
- }, Zt);
2448
- }, [Y]);
2449
- _e(() => {
2450
- Z.current = me;
2451
- });
2452
- const ge = q(() => {
2453
- L.current && clearTimeout(L.current), L.current = setTimeout(() => {
2454
- const $ = f.current, w = D.current;
2455
- if (!$ || !w || w.nodes.length === 0) return;
2456
- const R = $.clientWidth, _ = $.clientHeight;
2457
- R <= 0 || _ <= 0 || Y(w, R, _, !0);
2458
- }, Zt);
2459
- }, [Y]);
2460
- _e(() => {
2461
- W.current = ge;
2462
- });
2463
- const Ce = q(
2464
- ($, w) => {
2465
- const R = p.current;
2466
- if (!R || R.destroyed)
2467
- return;
2468
- if (w != null && w.settle && (ce.current = !0), !D.current || D.current.nodes.length === 0) {
2469
- A.current = $, me();
2470
- return;
2471
- }
2472
- const b = f.current, v = (b == null ? void 0 : b.clientWidth) || 800, C = (b == null ? void 0 : b.clientHeight) || 600;
2473
- Y($, v, C, w == null ? void 0 : w.fit, w == null ? void 0 : w.keepPositions);
2474
- },
2475
- [Y, me]
2476
- ), Le = q(
2477
- ($) => {
2478
- const w = p.current;
2479
- if (!w || w.destroyed) return;
2480
- const R = w.getNodeData(), _ = w.getEdgeData(), b = {};
2481
- R.forEach((C) => {
2482
- b[String(C.id)] = [];
2483
- }), _.forEach((C) => {
2484
- b[String(C.id)] = [];
2485
- });
2486
- const v = R.some((C) => String(C.id) === $);
2487
- !j.current || R.length === 0 || Promise.resolve(w.setElementState(b)).then(() => {
2488
- if (v)
2489
- return w.setElementState($, "emphasis");
2490
- }).then(() => N()).catch(() => {
2491
- });
2492
- },
2493
- [N]
2494
- ), be = q(
2495
- ($, w, R, _) => {
2496
- const b = p.current;
2497
- if (!b || b.destroyed) return;
2498
- const v = {}, C = b.getNodeData();
2499
- C.forEach((I) => {
2500
- var J;
2501
- const F = String(I.id), B = String(((J = I.data) == null ? void 0 : J.code) || I.id);
2502
- $.has(B) || $.has(F) ? B === R || F === R ? v[F] = ["pathLast"] : v[F] = ["pathHighlight"] : v[F] = ["pathDim"];
2503
- }), b.getEdgeData().forEach((I) => {
2504
- var Se, Fe;
2505
- const F = String(I.id), B = String(((Se = I.data) == null ? void 0 : Se.value) ?? ((Fe = I.data) == null ? void 0 : Fe.code) ?? ""), J = String(I.source), pe = String(I.target), fe = `${J}->${pe}::${B}`;
2506
- w.has(fe) || w.has(B) ? fe === _ || B === _ ? v[F] = ["pathLast"] : v[F] = ["pathHighlight"] : v[F] = ["pathDim"];
2507
- }), !(!j.current || C.length === 0) && (k.current = !0, Promise.resolve(b.setElementState(v)).then(() => N()).catch(() => {
2508
- }));
2509
- },
2510
- [N]
2511
- ), $e = q(() => {
2512
- const $ = p.current;
2513
- if (!$ || $.destroyed || !k.current || !j.current) return;
2514
- const w = $.getNodeData(), R = $.getEdgeData(), _ = {};
2515
- w.forEach((b) => {
2516
- _[String(b.id)] = [];
2517
- }), R.forEach((b) => {
2518
- _[String(b.id)] = [];
2519
- }), k.current = !1, Promise.resolve($.setElementState(_)).then(() => N()).catch(() => {
2520
- });
2521
- }, [N]), Ie = q(() => {
2522
- const $ = p.current;
2523
- if (!$ || $.destroyed) return;
2524
- const w = D.current;
2525
- if (!w || w.nodes.length === 0) {
2526
- O(() => Ye($)).then(
2527
- () => N()
2528
- );
2529
- return;
2530
- }
2531
- const R = f.current, _ = (R == null ? void 0 : R.clientWidth) || 800, b = (R == null ? void 0 : R.clientHeight) || 600;
2532
- Y(w, _, b, !0);
2533
- }, [Y, N, O]), ye = q(
2534
- ($) => {
2535
- const w = p.current;
2536
- if (!w || w.destroyed || !j.current) return;
2537
- const R = Math.max(w.getZoom(), 1);
2538
- O(async () => {
2539
- await w.focusElement($, { duration: 300 }), !(w.destroyed || w.getZoom() === R) && await w.zoomTo(R, { duration: 250 });
2540
- }).then(() => N()).catch(() => {
2541
- });
2542
- },
2543
- [N, O]
2544
- ), Ee = q(
2545
- ($) => {
2546
- const w = p.current;
2547
- if (!w || w.destroyed || !j.current) return;
2548
- const R = new Set($), _ = {};
2549
- w.getNodeData().forEach((b) => {
2550
- const v = String(b.id), T = (w.getElementState(v) ?? []).filter((I) => I !== "focusDim");
2551
- R.has(v) && T.push("focusDim"), _[v] = T;
2552
- }), w.getEdgeData().forEach((b) => {
2553
- const v = String(b.id), T = (w.getElementState(v) ?? []).filter((I) => I !== "focusDim");
2554
- (R.has(String(b.source)) || R.has(String(b.target))) && T.push("focusDim"), _[v] = T;
2555
- }), Promise.resolve(w.setElementState(_)).then(() => N()).catch(() => {
2556
- });
2557
- },
2558
- [N]
2559
- ), He = q(() => {
2560
- var w, R, _;
2561
- const $ = p.current;
2562
- if (!(!$ || $.destroyed))
2563
- try {
2564
- const b = (_ = (R = (w = Xe($)) == null ? void 0 : w.plugin) == null ? void 0 : R.get) == null ? void 0 : _.call(R, "tooltip");
2565
- b && typeof b.hide == "function" && b.hide();
2566
- } catch {
2567
- }
2568
- }, []), Me = q(() => p.current, []);
2569
- return {
2570
- containerRef: z,
2571
- setData: Ce,
2572
- highlightNode: Le,
2573
- applyPathStyle: be,
2574
- resetPathStyle: $e,
2575
- fitView: Ie,
2576
- focusNode: ye,
2577
- setNodeDim: Ee,
2578
- setViewState: De,
2579
- hideTooltip: He,
2580
- ready: y,
2581
- getGraph: Me
2582
- };
2583
- }
2584
- const Nn = "class", _n = "instance";
2585
- function bo() {
2586
- return ro([
2587
- { categoryCode: Nn },
2588
- { categoryCode: _n }
2589
- ]);
2590
- }
2591
- function Qe(e) {
2592
- return (e.labels || []).includes("OntologyClass");
2593
- }
2594
- function Kt(e) {
2595
- return (e.labels || []).includes("OntologyIndividual");
2596
- }
2597
- function tt(e) {
2598
- const t = e.properties && e.properties.name;
2599
- return t != null && String(t).trim() ? String(t) : e.key;
2600
- }
2601
- function Eo(e, t) {
2602
- const n = (e.nodes || []).map((r) => ({
2603
- id: r.key,
2604
- code: r.key,
2605
- name: tt(r),
2606
- fullName: r.key,
2607
- categoryCode: Qe(r) ? Nn : _n,
2608
- objectCode: r.key,
2609
- objectName: tt(r),
2610
- labels: r.labels || [],
2611
- props: r.properties || {}
2612
- })), o = (e.edges || []).map((r) => ({
2613
- source: r.from_key,
2614
- target: r.to_key,
2615
- code: r.type,
2616
- value: r.type,
2617
- displayName: r.type,
2618
- edgeKey: r.key,
2619
- isSelfAssoc: r.from_key === r.to_key
2620
- }));
2621
- return vo({ data: n, links: o }, void 0, void 0, t);
2622
- }
2623
- function So(e, t) {
2624
- const n = new Map((e.nodes || []).map((r) => [r.key, r])), o = new Map((e.edges || []).map((r) => [r.key || `${r.from_key}|${r.type}|${r.to_key}`, r]));
2625
- return (t.nodes || []).forEach((r) => n.set(r.key, r)), (t.edges || []).forEach((r) => o.set(r.key || `${r.from_key}|${r.type}|${r.to_key}`, r)), { nodes: [...n.values()], edges: [...o.values()] };
2626
- }
2627
- function Ho() {
2628
- const [e] = Cn(), t = e.get("id") || "", [n, o] = ve("default"), [r, s] = ve("structure"), [i, a] = ve(""), [c, l] = ve([]), [u, E] = ve({ nodes: [], edges: [] }), [m, d] = ve(!1), [x, g] = ve(null), [f, h] = ve([]), [S, p] = ve(!1), y = kt(() => bo(), []), P = ne(0), k = q(
2629
- (z) => (u.nodes || []).find((N) => N.key === z) || null,
2630
- [u.nodes]
2631
- ), D = q(() => (u.nodes || []).map((z) => z.key), [u.nodes]), { containerRef: A, setData: L, setViewState: H, ready: Z } = wo({
2632
- onNodeClick: (z) => {
2633
- var G, Q;
2634
- const N = ((G = z.data) == null ? void 0 : G.code) || ((Q = z.data) == null ? void 0 : Q.id);
2635
- if (!N) return;
2636
- const O = k(N);
2637
- g(O || { key: N, labels: [], properties: {} }), h([N]), H([N], [], D().filter((te) => te !== N));
2638
- },
2639
- onNodeDoubleClick: (z) => {
2640
- var G, Q;
2641
- const N = ((G = z.data) == null ? void 0 : G.code) || ((Q = z.data) == null ? void 0 : Q.id), O = k(N);
2642
- O && Qe(O) && X(O.key);
2643
- },
2644
- onCanvasClick: () => {
2645
- g(null), h([]), H([], [], []);
2646
- },
2647
- tooltipFormatter: (z, N) => {
2648
- if (N !== "node") return "";
2649
- const O = Array.isArray(z.labels) ? z.labels.join(" / ") : "";
2650
- return `<div><b>${ct(z.name || z.code || "")}</b>${O ? `<div style="color:#888;font-size:12px">${ct(O)}</div>` : ""}<div style="color:#999;font-size:12px">${ct(z.code || "")}</div></div>`;
2651
- }
2652
- }), W = q(
2653
- (z, N = {}) => {
2654
- const O = Eo(z, y);
2655
- L(O, { fit: N.fit !== !1, keepPositions: !!N.keepPositions });
2656
- },
2657
- [L, y]
2658
- ), j = q(
2659
- async (z = n) => {
2660
- if (!t) return;
2661
- const N = ++P.current;
2662
- d(!0);
2663
- try {
2664
- const O = await Ze.listClasses(t, z);
2665
- if (N !== P.current) return;
2666
- l(O || []);
2667
- const G = (O || []).map((te) => te.key), Q = await Ze.subgraph(t, G, 1, z);
2668
- if (N !== P.current) return;
2669
- E(Q || { nodes: [], edges: [] }), s("structure"), a(""), g(null), h([]), W(Q || { nodes: [], edges: [] });
2670
- } catch (O) {
2671
- N === P.current && (rt.error(`图谱取数失败:${O.message}`), E({ nodes: [], edges: [] }), l([]));
2672
- } finally {
2673
- N === P.current && d(!1);
2674
- }
2675
- },
2676
- [t, n, W]
2677
- );
2678
- _e(() => (t && j("default"), () => {
2679
- P.current += 1;
2680
- }), [t]);
2681
- const X = q(
2682
- async (z) => {
2683
- if (!t) return;
2684
- const N = ++P.current;
2685
- d(!0);
2686
- try {
2687
- const O = await Ze.subgraph(t, [z], 1, n);
2688
- if (N !== P.current) return;
2689
- E(O || { nodes: [], edges: [] }), s("instance"), a(z), g(null), h([]), W(O || { nodes: [], edges: [] });
2690
- } catch (O) {
2691
- N === P.current && rt.error(`实例图取数失败:${O.message}`);
2692
- } finally {
2693
- N === P.current && d(!1);
2694
- }
2695
- },
2696
- [t, n, W]
2697
- ), U = q(() => j(), [j]), ue = q(
2698
- async (z) => {
2699
- const N = z || x;
2700
- if (!(!N || !t)) {
2701
- p(!0);
2702
- try {
2703
- const O = await Ze.listNeighbors(t, N.key, 1, n), G = { nodes: [], edges: [] };
2704
- (O || []).forEach((te) => {
2705
- te.node && G.nodes.push(te.node), te.edge && G.edges.push(te.edge);
2706
- });
2707
- const Q = So(u, G);
2708
- E(Q), W(Q, { keepPositions: !0 });
2709
- } catch (O) {
2710
- rt.error(`邻居展开失败:${O.message}`);
2711
- } finally {
2712
- p(!1);
2713
- }
2714
- }
2715
- },
2716
- [x, t, n, u, W]
2717
- ), ce = q(
2718
- (z) => {
2719
- const N = f.includes(z) ? f.filter((O) => O !== z) : [...f, z];
2720
- h(N), H(N, [], N.length ? D().filter((O) => !N.includes(O)) : []);
2721
- },
2722
- [f, H, D]
2723
- ), de = kt(() => {
2724
- const z = {}, N = new Set((c || []).map((O) => O.key));
2725
- return (u.nodes || []).forEach((O) => {
2726
- N.has(O.key) ? z[O.key] = z[O.key] || { instances: 0 } : Kt(O) && (O.labels || []).filter((G) => N.has(G)).forEach((G) => {
2727
- z[G] = z[G] || { instances: 0 }, z[G].instances += 1;
2728
- });
2729
- }), z;
2730
- }, [c, u.nodes]);
2731
- if (!t)
2732
- return /* @__PURE__ */ V(It, { description: "缺少本体 ID(?id=xxx)", style: { padding: 48 } });
2733
- const he = r === "structure", K = !!(u.nodes || []).length;
2734
- return /* @__PURE__ */ le("div", { className: "view", children: [
2735
- /* @__PURE__ */ le("div", { className: "view-bar", children: [
2736
- /* @__PURE__ */ le(st, { icon: /* @__PURE__ */ V(Rt, {}), color: "purple", children: [
2737
- "本体 ",
2738
- t
2739
- ] }),
2740
- /* @__PURE__ */ V(
2741
- $n.Search,
2742
- {
2743
- style: { width: 200 },
2744
- placeholder: "工作空间(默认 default)",
2745
- value: n,
2746
- onChange: (z) => o(z.target.value),
2747
- onSearch: () => j()
2748
- }
2749
- ),
2750
- he ? /* @__PURE__ */ V(Oe, { icon: /* @__PURE__ */ V(Xn, {}), onClick: () => j(), children: "刷新" }) : /* @__PURE__ */ le(_t, { children: [
2751
- /* @__PURE__ */ V(Oe, { icon: /* @__PURE__ */ V(Ut, {}), onClick: U, children: "返回结构层" }),
2752
- /* @__PURE__ */ le(st, { color: "blue", children: [
2753
- "实例层:",
2754
- i
2755
- ] })
2756
- ] }),
2757
- x ? /* @__PURE__ */ V(Oe, { icon: /* @__PURE__ */ V(pt, {}), loading: S, onClick: () => ue(x), children: "展开邻居" }) : null,
2758
- /* @__PURE__ */ V("span", { className: "spacer hint", children: "双击类节点进入实例层 · 点击节点查看详情 · 空白点击取消" })
2759
- ] }),
2760
- /* @__PURE__ */ le("div", { style: { display: "flex", gap: 12, alignItems: "stretch", height: "calc(100vh - 220px)" }, children: [
2761
- /* @__PURE__ */ le("div", { className: "side-rail", children: [
2762
- /* @__PURE__ */ le("div", { className: "rail-head", children: [
2763
- "类型(",
2764
- c.length,
2765
- ")"
2766
- ] }),
2767
- c.length ? /* @__PURE__ */ V("ul", { className: "rail-list", children: c.map((z) => {
2768
- const N = de[z.key] || { instances: 0 }, O = f.includes(z.key);
2769
- return /* @__PURE__ */ le(
2770
- "li",
2771
- {
2772
- className: `rail-item${O ? " active" : ""}`,
2773
- onClick: () => ce(z.key),
2774
- title: "点击高亮该类型",
2775
- children: [
2776
- /* @__PURE__ */ V(Rt, { style: { color: "#722ed1" } }),
2777
- /* @__PURE__ */ V("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: tt(z) }),
2778
- /* @__PURE__ */ le(st, { style: { fontSize: 11 }, children: [
2779
- N.instances,
2780
- " 实例"
2781
- ] }),
2782
- /* @__PURE__ */ V(
2783
- Oe,
2784
- {
2785
- type: "link",
2786
- size: "small",
2787
- style: { padding: 0 },
2788
- icon: /* @__PURE__ */ V(ht, {}),
2789
- title: "进入实例层",
2790
- onClick: (G) => {
2791
- G.stopPropagation(), X(z.key);
2792
- }
2793
- }
2794
- )
2795
- ]
2796
- },
2797
- z.key
2798
- );
2799
- }) }) : /* @__PURE__ */ V("div", { className: "empty-note", children: "暂无类定义(可先登记 schema 或物化)" })
2800
- ] }),
2801
- /* @__PURE__ */ le("div", { ref: A, className: "graph-canvas", children: [
2802
- m ? /* @__PURE__ */ V("div", { className: "canvas-overlay", children: /* @__PURE__ */ V(Kn, { tip: "图谱加载中", children: /* @__PURE__ */ V("div", { style: { width: 80, height: 80 } }) }) }) : null,
2803
- !m && Z && !K ? /* @__PURE__ */ V("div", { className: "canvas-overlay", children: /* @__PURE__ */ V(It, { description: he ? "本体内无物化图数据" : "该类型暂无实例" }) }) : null
2804
- ] })
2805
- ] }),
2806
- /* @__PURE__ */ V(
2807
- bt,
2808
- {
2809
- open: !!x,
2810
- width: 380,
2811
- title: x ? tt(x) : "",
2812
- onClose: () => {
2813
- g(null), h([]);
2814
- },
2815
- destroyOnHidden: !0,
2816
- children: x ? /* @__PURE__ */ le(_t, { children: [
2817
- /* @__PURE__ */ le(ze, { column: 1, size: "small", bordered: !0, children: [
2818
- /* @__PURE__ */ V(ze.Item, { label: "key", children: x.key }),
2819
- /* @__PURE__ */ V(ze.Item, { label: "类型", children: Qe(x) ? "类" : Kt(x) ? "实例" : (x.labels || []).join(" / ") || "节点" }),
2820
- /* @__PURE__ */ V(ze.Item, { label: "标签", children: (x.labels || []).join(" / ") || "-" })
2821
- ] }),
2822
- /* @__PURE__ */ V("div", { style: { marginTop: 16, fontWeight: 600, marginBottom: 8 }, children: "属性" }),
2823
- Object.keys(x.properties || {}).length ? /* @__PURE__ */ V(ze, { column: 1, size: "small", children: Object.entries(x.properties).map(([z, N]) => /* @__PURE__ */ V(ze.Item, { label: z, children: String(N) }, z)) }) : /* @__PURE__ */ V("div", { style: { color: "#999", fontSize: 12 }, children: "(无属性)" }),
2824
- /* @__PURE__ */ le("div", { style: { marginTop: 16, display: "flex", gap: 8 }, children: [
2825
- /* @__PURE__ */ V(Oe, { icon: /* @__PURE__ */ V(pt, {}), loading: S, onClick: () => ue(x), children: "展开 1 跳邻居" }),
2826
- Qe(x) ? /* @__PURE__ */ V(Oe, { type: "primary", icon: /* @__PURE__ */ V(ht, {}), onClick: () => X(x.key), children: "查看实例" }) : null
2827
- ] })
2828
- ] }) : null
2829
- }
2830
- )
2831
- ] });
2832
- }
2833
- function ct(e) {
2834
- return String(e).replace(/[&<>"']/g, (t) => ({
2835
- "&": "&amp;",
2836
- "<": "&lt;",
2837
- ">": "&gt;",
2838
- '"': "&quot;",
2839
- "'": "&#39;"
2840
- })[t]);
2841
- }
2842
- export {
2843
- Ho as default
2844
- };