@c4a/server-cli 0.4.12-alpha.2 → 0.4.12-beta.14

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 (194) hide show
  1. package/index.js +4255 -1109
  2. package/package.json +2 -1
  3. package/serve.js +11236 -2504
  4. package/web/assets/ContentCard-D0mL7yOO.js +1 -0
  5. package/web/assets/ContentCard-_I22pq8z.js +1 -0
  6. package/web/assets/ContentDetail-BlCJjlr2.js +65 -0
  7. package/web/assets/ContentDetail-BtrIxG3F.js +1 -0
  8. package/web/assets/ContentDetail-DVIbcpNs.js +65 -0
  9. package/web/assets/EntityDetail-BBLfJ9LL.js +3 -0
  10. package/web/assets/EntityDetail-CHe5PkO9.js +1 -0
  11. package/web/assets/EntityDetail-CQNu3A3D.js +3 -0
  12. package/web/assets/JsonTree-BRUca2ED.js +1 -0
  13. package/web/assets/JsonTree-Dd_iNoWA.js +1 -0
  14. package/web/assets/RelationDetail-BoTv8wr4.js +1 -0
  15. package/web/assets/RelationDetail-CZwj9HUp.js +1 -0
  16. package/web/assets/RelationDetail-CkBj9cCj.js +1 -0
  17. package/web/assets/andromeeda-C4gqWexZ.js +1 -0
  18. package/web/assets/angular-html-DA-rfuFy.js +1 -0
  19. package/web/assets/angular-ts-BrjP3tb8.js +1 -0
  20. package/web/assets/astro-HNnZUWAn.js +1 -0
  21. package/web/assets/aurora-x-D-2ljcwZ.js +1 -0
  22. package/web/assets/ayu-dark-DYE7WIF3.js +1 -0
  23. package/web/assets/ayu-light-BA47KaF1.js +1 -0
  24. package/web/assets/ayu-mirage-32ctXXKs.js +1 -0
  25. package/web/assets/blade-BjGOyj-B.js +1 -0
  26. package/web/assets/c-BIGW1oBm.js +1 -0
  27. package/web/assets/catppuccin-frappe-DFWUc33u.js +1 -0
  28. package/web/assets/catppuccin-latte-C9dUb6Cb.js +1 -0
  29. package/web/assets/catppuccin-macchiato-DQyhUUbL.js +1 -0
  30. package/web/assets/catppuccin-mocha-D87Tk5Gz.js +1 -0
  31. package/web/assets/coffee-Ch7k5sss.js +1 -0
  32. package/web/assets/cpp-CofmeUqb.js +1 -0
  33. package/web/assets/css-CLj8gQPS.js +1 -0
  34. package/web/assets/csv-fuZLfV_i.js +1 -0
  35. package/web/assets/dark-plus-C3mMm8J8.js +1 -0
  36. package/web/assets/dracula-BzJJZx-M.js +1 -0
  37. package/web/assets/dracula-soft-BXkSAIEj.js +1 -0
  38. package/web/assets/everforest-dark-BgDCqdQA.js +1 -0
  39. package/web/assets/everforest-light-C8M2exoo.js +1 -0
  40. package/web/assets/github-dark-DHJKELXO.js +1 -0
  41. package/web/assets/github-dark-default-Cuk6v7N8.js +1 -0
  42. package/web/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
  43. package/web/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
  44. package/web/assets/github-light-DAi9KRSo.js +1 -0
  45. package/web/assets/github-light-default-D7oLnXFd.js +1 -0
  46. package/web/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
  47. package/web/assets/glsl-DplSGwfg.js +1 -0
  48. package/web/assets/graphql-ChdNCCLP.js +1 -0
  49. package/web/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
  50. package/web/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
  51. package/web/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
  52. package/web/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
  53. package/web/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
  54. package/web/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
  55. package/web/assets/haml-D5jkg6IW.js +1 -0
  56. package/web/assets/handlebars-BpdQsYii.js +1 -0
  57. package/web/assets/horizon-BUw7H-hv.js +1 -0
  58. package/web/assets/horizon-bright-CUuTKBJd.js +1 -0
  59. package/web/assets/houston-DnULxvSX.js +1 -0
  60. package/web/assets/html-derivative-DlHx6ybY.js +1 -0
  61. package/web/assets/html-pp8916En.js +1 -0
  62. package/web/assets/http-jrhK8wxY.js +1 -0
  63. package/web/assets/hurl-irOxFIW8.js +1 -0
  64. package/web/assets/imba-DGztddWO.js +1 -0
  65. package/web/assets/index-1QkfhsIS.js +12 -0
  66. package/web/assets/index-8J6WgTr0.js +238 -0
  67. package/web/assets/index-B1KeXpYL.css +1 -0
  68. package/web/assets/index-B1zrTc3w.js +12 -0
  69. package/web/assets/index-B6uGMtfP.css +1 -0
  70. package/web/assets/index-BCzQnf3x.css +1 -0
  71. package/web/assets/index-BE9z9PQF.js +238 -0
  72. package/web/assets/index-BF6rVrre.js +238 -0
  73. package/web/assets/index-BLskFmu3.js +193 -0
  74. package/web/assets/index-BMVKFQ7h.js +238 -0
  75. package/web/assets/index-BRwgHwhm.js +12 -0
  76. package/web/assets/index-BU6YkKWq.css +1 -0
  77. package/web/assets/index-BXaK4HKi.js +12 -0
  78. package/web/assets/index-BaBWjAP7.css +1 -0
  79. package/web/assets/index-Be3yvSxB.js +12 -0
  80. package/web/assets/index-Bh0nrxkS.css +1 -0
  81. package/web/assets/index-BjM7CFih.js +12 -0
  82. package/web/assets/index-BoqItESG.js +13 -0
  83. package/web/assets/index-Bxc-msf3.js +238 -0
  84. package/web/assets/index-Bxkj7nBM.css +1 -0
  85. package/web/assets/index-ByCT34eF.css +1 -0
  86. package/web/assets/index-C0SbV7Fr.js +238 -0
  87. package/web/assets/index-C1T-mIJp.js +238 -0
  88. package/web/assets/index-C1tbhKrB.css +1 -0
  89. package/web/assets/index-C6uqUNjs.js +238 -0
  90. package/web/assets/index-CKPy6nsr.js +238 -0
  91. package/web/assets/index-CSQvEPnB.js +238 -0
  92. package/web/assets/index-CU-x3HVJ.js +12 -0
  93. package/web/assets/index-CVcqJsfJ.js +12 -0
  94. package/web/assets/index-CWKka1Dm.css +1 -0
  95. package/web/assets/index-Cs1wjzzB.css +1 -0
  96. package/web/assets/index-D0FYwi5D.css +1 -0
  97. package/web/assets/index-D9pKIRoL.js +12 -0
  98. package/web/assets/index-DHMM5gmZ.js +12 -0
  99. package/web/assets/index-DMIK6qP9.js +12 -0
  100. package/web/assets/index-DNSKIsZU.js +238 -0
  101. package/web/assets/index-DW-afpe4.js +12 -0
  102. package/web/assets/index-DYi5EQi6.css +1 -0
  103. package/web/assets/index-DaUMALOp.css +1 -0
  104. package/web/assets/index-DeStbuhs.css +1 -0
  105. package/web/assets/index-DfXQnmId.js +12 -0
  106. package/web/assets/index-DisDw0E0.css +1 -0
  107. package/web/assets/index-Dm-_KwmC.css +1 -0
  108. package/web/assets/index-DmRvWfJA.js +12 -0
  109. package/web/assets/index-Drfhm6bu.js +12 -0
  110. package/web/assets/index-DvnO8hAI.js +12 -0
  111. package/web/assets/index-G3fxfqeh.js +238 -0
  112. package/web/assets/index-JdgClnFG.css +1 -0
  113. package/web/assets/index-P648JtKx.js +12 -0
  114. package/web/assets/index-PGORoGGx.js +13 -0
  115. package/web/assets/index-VCinLKUc.css +1 -0
  116. package/web/assets/index-ZtrM6iGG.js +12 -0
  117. package/web/assets/index-oRdZsAv2.js +238 -0
  118. package/web/assets/index-snZ8He7E.js +12 -0
  119. package/web/assets/index-zH92nrE5.css +1 -0
  120. package/web/assets/java-CylS5w8V.js +1 -0
  121. package/web/assets/javascript-wDzz0qaB.js +1 -0
  122. package/web/assets/jinja-f2NsQr07.js +1 -0
  123. package/web/assets/jison-wvAkD_A8.js +1 -0
  124. package/web/assets/json-Cp-IABpG.js +1 -0
  125. package/web/assets/json5-C9tS-k6U.js +1 -0
  126. package/web/assets/jsonc-Des-eS-w.js +1 -0
  127. package/web/assets/jsonl-DcaNXYhu.js +1 -0
  128. package/web/assets/jsx-g9-lgVsj.js +1 -0
  129. package/web/assets/julia-CxzCAyBv.js +1 -0
  130. package/web/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
  131. package/web/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
  132. package/web/assets/kanagawa-wave-DWedfzmr.js +1 -0
  133. package/web/assets/laserwave-DUszq2jm.js +1 -0
  134. package/web/assets/less-B1dDrJ26.js +1 -0
  135. package/web/assets/light-plus-B7mTdjB0.js +1 -0
  136. package/web/assets/markdown-Cvjx9yec.js +1 -0
  137. package/web/assets/marko-DjSrsDqO.js +1 -0
  138. package/web/assets/material-theme-D5KoaKCx.js +1 -0
  139. package/web/assets/material-theme-darker-BfHTSMKl.js +1 -0
  140. package/web/assets/material-theme-lighter-B0m2ddpp.js +1 -0
  141. package/web/assets/material-theme-ocean-CyktbL80.js +1 -0
  142. package/web/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
  143. package/web/assets/mdc-DTYItulj.js +1 -0
  144. package/web/assets/mdx-Cmh6b_Ma.js +1 -0
  145. package/web/assets/min-dark-CafNBF8u.js +1 -0
  146. package/web/assets/min-light-CTRr51gU.js +1 -0
  147. package/web/assets/monokai-D4h5O-jR.js +1 -0
  148. package/web/assets/night-owl-C39BiMTA.js +1 -0
  149. package/web/assets/night-owl-light-CMTm3GFP.js +1 -0
  150. package/web/assets/nord-Ddv68eIx.js +1 -0
  151. package/web/assets/one-dark-pro-DVMEJ2y_.js +1 -0
  152. package/web/assets/one-light-C3Wv6jpd.js +1 -0
  153. package/web/assets/php-R6g_5hLQ.js +1 -0
  154. package/web/assets/plastic-3e1v2bzS.js +1 -0
  155. package/web/assets/poimandres-CS3Unz2-.js +1 -0
  156. package/web/assets/postcss-CXtECtnM.js +1 -0
  157. package/web/assets/pug-DKIMFp6K.js +1 -0
  158. package/web/assets/python-B6aJPvgy.js +1 -0
  159. package/web/assets/r-Dspwwk_N.js +1 -0
  160. package/web/assets/red-bN70gL4F.js +1 -0
  161. package/web/assets/regexp-CDVJQ6XC.js +1 -0
  162. package/web/assets/rose-pine-dawn-DHQR4-dF.js +1 -0
  163. package/web/assets/rose-pine-moon-D4_iv3hh.js +1 -0
  164. package/web/assets/rose-pine-qdsjHGoJ.js +1 -0
  165. package/web/assets/sass-Cj5Yp3dK.js +1 -0
  166. package/web/assets/scss-D5BDwBP9.js +1 -0
  167. package/web/assets/shellscript-Yzrsuije.js +1 -0
  168. package/web/assets/slack-dark-BthQWCQV.js +1 -0
  169. package/web/assets/slack-ochin-DqwNpetd.js +1 -0
  170. package/web/assets/snazzy-light-Bw305WKR.js +1 -0
  171. package/web/assets/solarized-dark-DXbdFlpD.js +1 -0
  172. package/web/assets/solarized-light-L9t79GZl.js +1 -0
  173. package/web/assets/sql-BLtJtn59.js +1 -0
  174. package/web/assets/stylus-BEDo0Tqx.js +1 -0
  175. package/web/assets/svelte-Cy7k_4gC.js +1 -0
  176. package/web/assets/synthwave-84-CbfX1IO0.js +1 -0
  177. package/web/assets/tokyo-night-hegEt444.js +1 -0
  178. package/web/assets/ts-tags-DQrlYJgV.js +1 -0
  179. package/web/assets/tsx-COt5Ahok.js +1 -0
  180. package/web/assets/typescript-BPQ3VLAy.js +1 -0
  181. package/web/assets/vesper-DU1UobuO.js +1 -0
  182. package/web/assets/vitesse-black-Bkuqu6BP.js +1 -0
  183. package/web/assets/vitesse-dark-D0r3Knsf.js +1 -0
  184. package/web/assets/vitesse-light-CVO1_9PV.js +1 -0
  185. package/web/assets/vue-D2xRrEX4.js +1 -0
  186. package/web/assets/vue-html-AaS7Mt5G.js +1 -0
  187. package/web/assets/vue-vine-BoDAl6tE.js +1 -0
  188. package/web/assets/wasm-CG6Dc4jp.js +1 -0
  189. package/web/assets/wasm-MzD3tlZU.js +1 -0
  190. package/web/assets/wgsl-Dx-B1_4e.js +1 -0
  191. package/web/assets/wit-5i3qLPDT.js +1 -0
  192. package/web/assets/xml-sdJ4AIDG.js +1 -0
  193. package/web/assets/yaml-Buea-lGh.js +1 -0
  194. package/web/index.html +2 -2
@@ -0,0 +1,3 @@
1
+ import{i as Ge,j as f,r as R,b as lt,a as Ut,d as Tt,E as Ct,c as Nn,A as jn,T as kn,e as An,f as vt,h as _t}from"./index-PGORoGGx.js";import{J as Ke,i as Ue,R as We,B as W,c as de,s as ht,D as En}from"./JsonTree-BRUca2ED.js";import{C as Sn}from"./ContentCard-D0mL7yOO.js";const Mn=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],Tn=Ge("git-fork",Mn);const Cn=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],$n=Ge("grid-3x3",Cn),je={entities:"Entities",behaviors:"Behaviors",roles:"Roles",attributes:"Attributes",states:"States",transitions:"Transitions",events:"Events",rules:"Rules",constraints:"Constraints",decisions:"Decisions",metrics:"Metrics",claims:"Claims",relations:"Relations",comparisons:"Comparisons",boundaries:"Boundaries"};function zn({data:t,atoms:e}){return f.jsxs("div",{className:"space-y-4",children:[t&&Object.keys(t).length>0&&f.jsx("div",{children:f.jsx(Ke,{data:t,defaultExpanded:2})}),e&&f.jsx(Rn,{atoms:e})]})}function Rn({atoms:t}){const e=Object.keys(je);return f.jsx("div",{className:"space-y-2",children:e.map(n=>{const r=t[n];return!r||r.length===0?null:f.jsx(In,{type:n,label:je[n]??n,items:r},n)})})}function In({type:t,label:e,items:n}){const[r,i]=R.useState(!0);return f.jsxs("details",{open:r,onToggle:s=>i(s.target.open),children:[f.jsxs("summary",{className:"cursor-pointer font-mono text-xs uppercase text-c4a-text-secondary hover:text-c4a-text-primary py-1.5",children:[e," (",n.length,")"]}),f.jsx("div",{className:"pl-4 pb-2",children:f.jsx(Dn,{type:t,items:n})})]})}function Dn({type:t,items:e}){switch(t){case"entities":case"behaviors":case"events":case"relations":return f.jsx(ke,{items:e});case"roles":return f.jsx(Pn,{items:e});case"attributes":return f.jsx(Fn,{items:e});case"states":return f.jsx(Ln,{items:e});case"transitions":return f.jsx(Hn,{items:e});case"rules":case"constraints":return f.jsx(On,{items:e});case"decisions":return f.jsx(Xn,{items:e});case"metrics":return f.jsx(Yn,{items:e});case"claims":return f.jsx(Bn,{items:e});case"comparisons":return f.jsx(Vn,{items:e});case"boundaries":return f.jsx(qn,{items:e});default:return f.jsx(ke,{items:e})}}function tt({value:t}){const{t:e}=lt(),n=de(t);return n?f.jsx(W,{variant:n.variant,tooltip:`confidence: ${n.value}`,children:e(n.labelKey)}):null}function ke({items:t}){return f.jsx("div",{className:"space-y-1",children:t.map((e,n)=>f.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.ref&&Ue(e.ref)?f.jsx(We,{pointer:e.ref}):f.jsx("span",{className:"text-c4a-text-primary",children:e.name??String(e)}),f.jsx(tt,{value:e.confidence})]},n))})}function Pn({items:t}){return f.jsx("div",{className:"space-y-1.5",children:t.map((e,n)=>f.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[f.jsx(W,{variant:"accent",children:e.name??"role"}),!!e.performs&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"text-c4a-text-muted",children:"performs"}),Ue(String(e.performs))?f.jsx(We,{pointer:String(e.performs)}):f.jsx("span",{className:"text-c4a-text-primary",children:String(e.performs)})]}),f.jsx(tt,{value:e.confidence})]},n))})}function Fn({items:t}){return f.jsx("div",{className:"space-y-1",children:t.map((e,n)=>f.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[f.jsxs("span",{className:"text-c4a-text-secondary font-mono",children:[e.name,":"]}),f.jsx("span",{className:"text-c4a-text-primary",children:String(e.value??"")}),f.jsx(tt,{value:e.confidence})]},n))})}function Ln({items:t}){return f.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.map((e,n)=>f.jsxs("span",{className:"inline-flex items-center gap-1",children:[f.jsx(W,{children:e.name??String(e)}),f.jsx(tt,{value:e.confidence})]},n))})}function Hn({items:t}){return f.jsx("div",{className:"space-y-1.5",children:t.map((e,n)=>{const r=e;return f.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[f.jsx(W,{variant:"muted",children:String(r.from_state??"?")}),f.jsx("span",{className:"text-c4a-text-muted",children:"→"}),f.jsx(W,{variant:"muted",children:String(r.to_state??"?")}),!!r.trigger&&f.jsx("span",{className:"text-c4a-text-muted italic",children:String(r.trigger)}),f.jsx(tt,{value:e.confidence})]},n)})})}function On({items:t}){return f.jsx("div",{className:"space-y-1.5",children:t.map((e,n)=>{const r=e;return f.jsx("div",{className:"text-xs",children:f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"text-c4a-warning font-mono font-bold",children:"IF"}),f.jsx("span",{className:"text-c4a-text-primary",children:String(r.condition??r.name??"")}),f.jsx("span",{className:"text-c4a-accent font-mono font-bold",children:"THEN"}),f.jsx("span",{className:"text-c4a-text-primary",children:String(r.conclusion??r.description??"")}),f.jsx(tt,{value:e.confidence})]})},n)})})}function Xn({items:t}){return f.jsx("div",{className:"space-y-1.5",children:t.map((e,n)=>f.jsxs("div",{className:"text-xs",children:[f.jsx("span",{className:"text-c4a-text-primary font-mono",children:e.name}),e.description&&f.jsx("span",{className:"text-c4a-text-muted ml-2",children:e.description}),f.jsx(tt,{value:e.confidence})]},n))})}function Yn({items:t}){return f.jsx("div",{className:"space-y-1",children:t.map((e,n)=>{const r=e;return f.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[f.jsx("span",{className:"text-c4a-text-primary font-mono",children:e.name}),!!r.unit&&f.jsx("span",{className:"text-c4a-text-muted",children:String(r.unit)}),!!r.threshold&&f.jsxs("span",{className:"text-c4a-text-secondary",children:["< ",String(r.threshold)]}),f.jsx(tt,{value:e.confidence})]},n)})})}function Bn({items:t}){return f.jsx("div",{className:"space-y-1.5",children:t.map((e,n)=>{const r=e;return f.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[!!r.claim_type&&f.jsx(W,{variant:"warning",children:String(r.claim_type)}),f.jsx("span",{className:"text-c4a-text-primary",children:e.description??e.name}),!!r.valid_from&&f.jsxs("span",{className:"text-c4a-text-muted",children:[String(r.valid_from)," 起"]}),f.jsx(tt,{value:e.confidence})]},n)})})}function Vn({items:t}){return f.jsx("div",{className:"space-y-3",children:t.map((e,n)=>{const r=e,i=r.criteria,s=r.options;return!i||!s?f.jsx("div",{className:"text-xs text-c4a-text-muted",children:f.jsx(Ke,{data:e,defaultExpanded:1})},n):f.jsx("div",{className:"rounded border border-c4a-border-subtle overflow-auto",children:f.jsxs("table",{className:"w-full text-xs font-mono",children:[f.jsx("thead",{children:f.jsxs("tr",{className:"border-b border-c4a-border-subtle bg-c4a-bg-surface text-c4a-text-muted",children:[f.jsx("th",{className:"px-2 py-1 text-left",children:"Criteria"}),s.map((o,a)=>f.jsx("th",{className:"px-2 py-1 text-left",children:String(o.name??`Option ${a+1}`)},a))]})}),f.jsx("tbody",{children:i.map((o,a)=>f.jsxs("tr",{className:"border-b border-c4a-border-subtle",children:[f.jsx("td",{className:"px-2 py-1 text-c4a-text-secondary",children:o}),s.map((l,c)=>{const u=l.values;return f.jsx("td",{className:"px-2 py-1 text-c4a-text-primary",children:u?.[a]??"—"},c)})]},a))})]})},n)})})}function qn({items:t}){return f.jsx("div",{className:"space-y-1",children:t.map((e,n)=>{const r=e,i=r.included!==!1&&r.type!=="exclude";return f.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[f.jsx("span",{className:i?"text-c4a-success":"text-c4a-error",children:i?"✓ 包含":"✗ 排除"}),f.jsx("span",{className:"text-c4a-text-primary",children:e.name??e.description}),f.jsx(tt,{value:e.confidence})]},n)})})}function Gn({relation:t}){const e=Ut(),{t:n}=lt(),r=de(t.confidence),i=t.direction==="incoming"?"←":"→";return f.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded hover:bg-c4a-bg-hover cursor-pointer transition-colors",onClick:()=>e(ht.relation(t.id)),children:[f.jsx(W,{variant:"accent",children:t.type}),f.jsx("span",{className:"text-xs font-mono text-c4a-accent hover:underline cursor-pointer truncate",onClick:s=>{s.stopPropagation(),e(ht.entity(t.from.id))},children:t.from.name}),f.jsx("span",{className:"text-c4a-text-muted text-xs shrink-0",children:i}),f.jsx("span",{className:"text-xs font-mono text-c4a-accent hover:underline cursor-pointer truncate",onClick:s=>{s.stopPropagation(),e(ht.entity(t.to.id))},children:t.to.name}),t.weight!==void 0&&f.jsxs("span",{className:"text-xs text-c4a-text-muted ml-auto shrink-0",children:["w: ",t.weight]}),r&&f.jsx(W,{variant:r.variant,tooltip:`confidence: ${r.value}`,children:n(r.labelKey)})]})}function Kn({entityId:t}){const{t:e}=lt(),[n,r]=R.useState([]),[i,s]=R.useState(!1),[o,a]=R.useState("both"),[l,c]=R.useState(""),[u,g]=R.useState([]);return R.useEffect(()=>{const d={};o!=="both"&&(d.direction=o),l&&(d.type=l),Tt.get(`/entities/${t}/relations`,d).then(h=>{if(r(h.relations),u.length===0){const b=[...new Set(h.relations.map(y=>y.type))];g(b)}s(!0)}).catch(()=>{s(!0)})},[t,o,l]),i?n.length===0?f.jsx(Ct,{title:e("common.empty.entity_relations.title"),description:e("common.empty.entity_relations.description")}):f.jsxs("div",{children:[f.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[f.jsxs("select",{value:o,onChange:d=>a(d.target.value),className:"bg-c4a-bg-surface border border-c4a-border-subtle rounded px-2 py-1 text-xs font-mono text-c4a-text-secondary",children:[f.jsx("option",{value:"both",children:e("relation.filter.direction.all")}),f.jsx("option",{value:"outgoing",children:e("relation.filter.direction.outgoing")}),f.jsx("option",{value:"incoming",children:e("relation.filter.direction.incoming")})]}),u.length>1&&f.jsxs("select",{value:l,onChange:d=>c(d.target.value),className:"bg-c4a-bg-surface border border-c4a-border-subtle rounded px-2 py-1 text-xs font-mono text-c4a-text-secondary",children:[f.jsx("option",{value:"",children:e("relation.filter.type.all")}),u.map(d=>f.jsx("option",{value:d,children:d},d))]})]}),f.jsx("div",{className:"space-y-1",children:n.map(d=>f.jsx(Gn,{relation:d},d.id))})]}):f.jsx("p",{className:"text-sm text-c4a-text-muted",children:e("common.loading")})}function Un({entityId:t}){const{t:e}=lt(),[n,r]=R.useState([]),[i,s]=R.useState(!1);return R.useEffect(()=>{Tt.get(`/entities/${t}/contents`).then(o=>{r(o.contents??[]),s(!0)}).catch(()=>s(!0))},[t]),i?n.length===0?f.jsx(Ct,{title:e("common.empty.entity_contents.title"),description:e("common.empty.entity_contents.description")}):f.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:n.map(o=>f.jsx(Sn,{content:o},o.hash_id))}):f.jsx("p",{className:"text-sm text-c4a-text-muted",children:e("common.loading")})}function Wn({entityId:t}){const{t:e}=lt(),n=Ut(),[r,i]=R.useState([]),[s,o]=R.useState(!1);return R.useEffect(()=>{Tt.get(`/entities/${t}/referrers`).then(a=>{i(a.referrers??[]),o(!0)}).catch(()=>o(!0))},[t]),s?r.length===0?f.jsx(Ct,{title:e("common.empty.entity_referrers.title"),description:e("common.empty.entity_referrers.description")}):f.jsx("div",{className:"space-y-1",children:r.map(a=>f.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded hover:bg-c4a-bg-hover cursor-pointer transition-colors",onClick:()=>n(ht.entity(a.id)),children:[f.jsx("span",{className:"text-xs font-mono text-c4a-accent hover:underline truncate",children:a.name}),f.jsx("span",{className:"text-xs text-c4a-text-muted shrink-0",children:a.type}),f.jsx("span",{className:"text-xs text-c4a-text-muted font-mono ml-auto shrink-0",children:a.ref_field}),f.jsxs("span",{className:"text-xs text-c4a-text-muted shrink-0",children:["(",a.ref_type,")"]})]},`${a.id}-${a.ref_field}`))}):f.jsx("p",{className:"text-sm text-c4a-text-muted",children:e("common.loading")})}function Qn(t,e){var n,r=1;t==null&&(t=0),e==null&&(e=0);function i(){var s,o=n.length,a,l=0,c=0;for(s=0;s<o;++s)a=n[s],l+=a.x,c+=a.y;for(l=(l/o-t)*r,c=(c/o-e)*r,s=0;s<o;++s)a=n[s],a.x-=l,a.y-=c}return i.initialize=function(s){n=s},i.x=function(s){return arguments.length?(t=+s,i):t},i.y=function(s){return arguments.length?(e=+s,i):e},i.strength=function(s){return arguments.length?(r=+s,i):r},i}function Jn(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return Qe(this.cover(e,n),e,n,t)}function Qe(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,s=t._root,o={data:r},a=t._x0,l=t._y0,c=t._x1,u=t._y1,g,d,h,b,y,v,m,N;if(!s)return t._root=o,t;for(;s.length;)if((y=e>=(g=(a+c)/2))?a=g:c=g,(v=n>=(d=(l+u)/2))?l=d:u=d,i=s,!(s=s[m=v<<1|y]))return i[m]=o,t;if(h=+t._x.call(null,s.data),b=+t._y.call(null,s.data),e===h&&n===b)return o.next=s,i?i[m]=o:t._root=o,t;do i=i?i[m]=new Array(4):t._root=new Array(4),(y=e>=(g=(a+c)/2))?a=g:c=g,(v=n>=(d=(l+u)/2))?l=d:u=d;while((m=v<<1|y)===(N=(b>=d)<<1|h>=g));return i[N]=s,i[m]=o,t}function Zn(t){var e,n,r=t.length,i,s,o=new Array(r),a=new Array(r),l=1/0,c=1/0,u=-1/0,g=-1/0;for(n=0;n<r;++n)isNaN(i=+this._x.call(null,e=t[n]))||isNaN(s=+this._y.call(null,e))||(o[n]=i,a[n]=s,i<l&&(l=i),i>u&&(u=i),s<c&&(c=s),s>g&&(g=s));if(l>u||c>g)return this;for(this.cover(l,c).cover(u,g),n=0;n<r;++n)Qe(this,o[n],a[n],t[n]);return this}function tr(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,s=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,s=(r=Math.floor(e))+1;else{for(var o=i-n||1,a=this._root,l,c;n>t||t>=i||r>e||e>=s;)switch(c=(e<r)<<1|t<n,l=new Array(4),l[c]=a,a=l,o*=2,c){case 0:i=n+o,s=r+o;break;case 1:n=i-o,s=r+o;break;case 2:i=n+o,r=s-o;break;case 3:n=i-o,r=s-o;break}this._root&&this._root.length&&(this._root=a)}return this._x0=n,this._y0=r,this._x1=i,this._y1=s,this}function er(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t}function nr(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function L(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function rr(t,e,n){var r,i=this._x0,s=this._y0,o,a,l,c,u=this._x1,g=this._y1,d=[],h=this._root,b,y;for(h&&d.push(new L(h,i,s,u,g)),n==null?n=1/0:(i=t-n,s=e-n,u=t+n,g=e+n,n*=n);b=d.pop();)if(!(!(h=b.node)||(o=b.x0)>u||(a=b.y0)>g||(l=b.x1)<i||(c=b.y1)<s))if(h.length){var v=(o+l)/2,m=(a+c)/2;d.push(new L(h[3],v,m,l,c),new L(h[2],o,m,v,c),new L(h[1],v,a,l,m),new L(h[0],o,a,v,m)),(y=(e>=m)<<1|t>=v)&&(b=d[d.length-1],d[d.length-1]=d[d.length-1-y],d[d.length-1-y]=b)}else{var N=t-+this._x.call(null,h.data),x=e-+this._y.call(null,h.data),w=N*N+x*x;if(w<n){var S=Math.sqrt(n=w);i=t-S,s=e-S,u=t+S,g=e+S,r=h.data}}return r}function ir(t){if(isNaN(u=+this._x.call(null,t))||isNaN(g=+this._y.call(null,t)))return this;var e,n=this._root,r,i,s,o=this._x0,a=this._y0,l=this._x1,c=this._y1,u,g,d,h,b,y,v,m;if(!n)return this;if(n.length)for(;;){if((b=u>=(d=(o+l)/2))?o=d:l=d,(y=g>=(h=(a+c)/2))?a=h:c=h,e=n,!(n=n[v=y<<1|b]))return this;if(!n.length)break;(e[v+1&3]||e[v+2&3]||e[v+3&3])&&(r=e,m=v)}for(;n.data!==t;)if(i=n,!(n=n.next))return this;return(s=n.next)&&delete n.next,i?(s?i.next=s:delete i.next,this):e?(s?e[v]=s:delete e[v],(n=e[0]||e[1]||e[2]||e[3])&&n===(e[3]||e[2]||e[1]||e[0])&&!n.length&&(r?r[m]=n:this._root=n),this):(this._root=s,this)}function sr(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function or(){return this._root}function ar(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t}function cr(t){var e=[],n,r=this._root,i,s,o,a,l;for(r&&e.push(new L(r,this._x0,this._y0,this._x1,this._y1));n=e.pop();)if(!t(r=n.node,s=n.x0,o=n.y0,a=n.x1,l=n.y1)&&r.length){var c=(s+a)/2,u=(o+l)/2;(i=r[3])&&e.push(new L(i,c,u,a,l)),(i=r[2])&&e.push(new L(i,s,u,c,l)),(i=r[1])&&e.push(new L(i,c,o,a,u)),(i=r[0])&&e.push(new L(i,s,o,c,u))}return this}function lr(t){var e=[],n=[],r;for(this._root&&e.push(new L(this._root,this._x0,this._y0,this._x1,this._y1));r=e.pop();){var i=r.node;if(i.length){var s,o=r.x0,a=r.y0,l=r.x1,c=r.y1,u=(o+l)/2,g=(a+c)/2;(s=i[0])&&e.push(new L(s,o,a,u,g)),(s=i[1])&&e.push(new L(s,u,a,l,g)),(s=i[2])&&e.push(new L(s,o,g,u,c)),(s=i[3])&&e.push(new L(s,u,g,l,c))}n.push(r)}for(;r=n.pop();)t(r.node,r.x0,r.y0,r.x1,r.y1);return this}function ur(t){return t[0]}function fr(t){return arguments.length?(this._x=t,this):this._x}function hr(t){return t[1]}function dr(t){return arguments.length?(this._y=t,this):this._y}function pe(t,e,n){var r=new xe(e??ur,n??hr,NaN,NaN,NaN,NaN);return t==null?r:r.addAll(t)}function xe(t,e,n,r,i,s){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=s,this._root=void 0}function Ae(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var H=pe.prototype=xe.prototype;H.copy=function(){var t=new xe(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,n,r;if(!e)return t;if(!e.length)return t._root=Ae(e),t;for(n=[{source:e,target:t._root=new Array(4)}];e=n.pop();)for(var i=0;i<4;++i)(r=e.source[i])&&(r.length?n.push({source:r,target:e.target[i]=new Array(4)}):e.target[i]=Ae(r));return t};H.add=Jn;H.addAll=Zn;H.cover=tr;H.data=er;H.extent=nr;H.find=rr;H.remove=ir;H.removeAll=sr;H.root=or;H.size=ar;H.visit=cr;H.visitAfter=lr;H.x=fr;H.y=dr;function dt(t){return function(){return t}}function ct(t){return(t()-.5)*1e-6}function pr(t){return t.x+t.vx}function xr(t){return t.y+t.vy}function mr(t){var e,n,r,i=1,s=1;typeof t!="function"&&(t=dt(t==null?1:+t));function o(){for(var c,u=e.length,g,d,h,b,y,v,m=0;m<s;++m)for(g=pe(e,pr,xr).visitAfter(a),c=0;c<u;++c)d=e[c],y=n[d.index],v=y*y,h=d.x+d.vx,b=d.y+d.vy,g.visit(N);function N(x,w,S,T,I){var C=x.data,D=x.r,$=y+D;if(C){if(C.index>d.index){var Y=h-C.x-C.vx,B=b-C.y-C.vy,O=Y*Y+B*B;O<$*$&&(Y===0&&(Y=ct(r),O+=Y*Y),B===0&&(B=ct(r),O+=B*B),O=($-(O=Math.sqrt(O)))/O*i,d.vx+=(Y*=O)*($=(D*=D)/(v+D)),d.vy+=(B*=O)*$,C.vx-=Y*($=1-$),C.vy-=B*$)}return}return w>h+$||T<h-$||S>b+$||I<b-$}}function a(c){if(c.data)return c.r=n[c.data.index];for(var u=c.r=0;u<4;++u)c[u]&&c[u].r>c.r&&(c.r=c[u].r)}function l(){if(e){var c,u=e.length,g;for(n=new Array(u),c=0;c<u;++c)g=e[c],n[g.index]=+t(g,c,e)}}return o.initialize=function(c,u){e=c,r=u,l()},o.iterations=function(c){return arguments.length?(s=+c,o):s},o.strength=function(c){return arguments.length?(i=+c,o):i},o.radius=function(c){return arguments.length?(t=typeof c=="function"?c:dt(+c),l(),o):t},o}function gr(t){return t.index}function Ee(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function yr(t){var e=gr,n=g,r,i=dt(30),s,o,a,l,c,u=1;t==null&&(t=[]);function g(v){return 1/Math.min(a[v.source.index],a[v.target.index])}function d(v){for(var m=0,N=t.length;m<u;++m)for(var x=0,w,S,T,I,C,D,$;x<N;++x)w=t[x],S=w.source,T=w.target,I=T.x+T.vx-S.x-S.vx||ct(c),C=T.y+T.vy-S.y-S.vy||ct(c),D=Math.sqrt(I*I+C*C),D=(D-s[x])/D*v*r[x],I*=D,C*=D,T.vx-=I*($=l[x]),T.vy-=C*$,S.vx+=I*($=1-$),S.vy+=C*$}function h(){if(o){var v,m=o.length,N=t.length,x=new Map(o.map((S,T)=>[e(S,T,o),S])),w;for(v=0,a=new Array(m);v<N;++v)w=t[v],w.index=v,typeof w.source!="object"&&(w.source=Ee(x,w.source)),typeof w.target!="object"&&(w.target=Ee(x,w.target)),a[w.source.index]=(a[w.source.index]||0)+1,a[w.target.index]=(a[w.target.index]||0)+1;for(v=0,l=new Array(N);v<N;++v)w=t[v],l[v]=a[w.source.index]/(a[w.source.index]+a[w.target.index]);r=new Array(N),b(),s=new Array(N),y()}}function b(){if(o)for(var v=0,m=t.length;v<m;++v)r[v]=+n(t[v],v,t)}function y(){if(o)for(var v=0,m=t.length;v<m;++v)s[v]=+i(t[v],v,t)}return d.initialize=function(v,m){o=v,c=m,h()},d.links=function(v){return arguments.length?(t=v,h(),d):t},d.id=function(v){return arguments.length?(e=v,d):e},d.iterations=function(v){return arguments.length?(u=+v,d):u},d.strength=function(v){return arguments.length?(n=typeof v=="function"?v:dt(+v),b(),d):n},d.distance=function(v){return arguments.length?(i=typeof v=="function"?v:dt(+v),y(),d):i},d}var vr={value:()=>{}};function Wt(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Lt(n)}function Lt(t){this._=t}function _r(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Lt.prototype=Wt.prototype={constructor:Lt,on:function(t,e){var n=this._,r=_r(t+"",n),i,s=-1,o=r.length;if(arguments.length<2){for(;++s<o;)if((i=(t=r[s]).type)&&(i=wr(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<o;)if(i=(t=r[s]).type)n[i]=Se(n[i],t.name,e);else if(e==null)for(i in n)n[i]=Se(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Lt(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],r=0,i=s.length;r<i;++r)s[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,s=r.length;i<s;++i)r[i].value.apply(e,n)}};function wr(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function Se(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=vr,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var gt=0,jt=0,wt=0,Je=1e3,Yt,kt,Bt=0,xt=0,Qt=0,At=typeof performance=="object"&&performance.now?performance:Date,Ze=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function me(){return xt||(Ze(br),xt=At.now()+Qt)}function br(){xt=0}function Vt(){this._call=this._time=this._next=null}Vt.prototype=ge.prototype={constructor:Vt,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?me():+n)+(e==null?0:+e),!this._next&&kt!==this&&(kt?kt._next=this:Yt=this,kt=this),this._call=t,this._time=n,ie()},stop:function(){this._call&&(this._call=null,this._time=1/0,ie())}};function ge(t,e,n){var r=new Vt;return r.restart(t,e,n),r}function Nr(){me(),++gt;for(var t=Yt,e;t;)(e=xt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--gt}function Me(){xt=(Bt=At.now())+Qt,gt=jt=0;try{Nr()}finally{gt=0,kr(),xt=0}}function jr(){var t=At.now(),e=t-Bt;e>Je&&(Qt-=e,Bt=t)}function kr(){for(var t,e=Yt,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Yt=n);kt=t,ie(r)}function ie(t){if(!gt){jt&&(jt=clearTimeout(jt));var e=t-xt;e>24?(t<1/0&&(jt=setTimeout(Me,t-At.now()-Qt)),wt&&(wt=clearInterval(wt))):(wt||(Bt=At.now(),wt=setInterval(jr,Je)),gt=1,Ze(Me))}}function Te(t,e,n){var r=new Vt;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}const Ar=1664525,Er=1013904223,Ce=4294967296;function Sr(){let t=1;return()=>(t=(Ar*t+Er)%Ce)/Ce}function Mr(t){return t.x}function Tr(t){return t.y}var Cr=10,$r=Math.PI*(3-Math.sqrt(5));function zr(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),s=0,o=.6,a=new Map,l=ge(g),c=Wt("tick","end"),u=Sr();t==null&&(t=[]);function g(){d(),c.call("tick",e),n<r&&(l.stop(),c.call("end",e))}function d(y){var v,m=t.length,N;y===void 0&&(y=1);for(var x=0;x<y;++x)for(n+=(s-n)*i,a.forEach(function(w){w(n)}),v=0;v<m;++v)N=t[v],N.fx==null?N.x+=N.vx*=o:(N.x=N.fx,N.vx=0),N.fy==null?N.y+=N.vy*=o:(N.y=N.fy,N.vy=0);return e}function h(){for(var y=0,v=t.length,m;y<v;++y){if(m=t[y],m.index=y,m.fx!=null&&(m.x=m.fx),m.fy!=null&&(m.y=m.fy),isNaN(m.x)||isNaN(m.y)){var N=Cr*Math.sqrt(.5+y),x=y*$r;m.x=N*Math.cos(x),m.y=N*Math.sin(x)}(isNaN(m.vx)||isNaN(m.vy))&&(m.vx=m.vy=0)}}function b(y){return y.initialize&&y.initialize(t,u),y}return h(),e={tick:d,restart:function(){return l.restart(g),e},stop:function(){return l.stop(),e},nodes:function(y){return arguments.length?(t=y,h(),a.forEach(b),e):t},alpha:function(y){return arguments.length?(n=+y,e):n},alphaMin:function(y){return arguments.length?(r=+y,e):r},alphaDecay:function(y){return arguments.length?(i=+y,e):+i},alphaTarget:function(y){return arguments.length?(s=+y,e):s},velocityDecay:function(y){return arguments.length?(o=1-y,e):1-o},randomSource:function(y){return arguments.length?(u=y,a.forEach(b),e):u},force:function(y,v){return arguments.length>1?(v==null?a.delete(y):a.set(y,b(v)),e):a.get(y)},find:function(y,v,m){var N=0,x=t.length,w,S,T,I,C;for(m==null?m=1/0:m*=m,N=0;N<x;++N)I=t[N],w=y-I.x,S=v-I.y,T=w*w+S*S,T<m&&(C=I,m=T);return C},on:function(y,v){return arguments.length>1?(c.on(y,v),e):c.on(y)}}}function Rr(){var t,e,n,r,i=dt(-30),s,o=1,a=1/0,l=.81;function c(h){var b,y=t.length,v=pe(t,Mr,Tr).visitAfter(g);for(r=h,b=0;b<y;++b)e=t[b],v.visit(d)}function u(){if(t){var h,b=t.length,y;for(s=new Array(b),h=0;h<b;++h)y=t[h],s[y.index]=+i(y,h,t)}}function g(h){var b=0,y,v,m=0,N,x,w;if(h.length){for(N=x=w=0;w<4;++w)(y=h[w])&&(v=Math.abs(y.value))&&(b+=y.value,m+=v,N+=v*y.x,x+=v*y.y);h.x=N/m,h.y=x/m}else{y=h,y.x=y.data.x,y.y=y.data.y;do b+=s[y.data.index];while(y=y.next)}h.value=b}function d(h,b,y,v){if(!h.value)return!0;var m=h.x-e.x,N=h.y-e.y,x=v-b,w=m*m+N*N;if(x*x/l<w)return w<a&&(m===0&&(m=ct(n),w+=m*m),N===0&&(N=ct(n),w+=N*N),w<o&&(w=Math.sqrt(o*w)),e.vx+=m*h.value*r/w,e.vy+=N*h.value*r/w),!0;if(h.length||w>=a)return;(h.data!==e||h.next)&&(m===0&&(m=ct(n),w+=m*m),N===0&&(N=ct(n),w+=N*N),w<o&&(w=Math.sqrt(o*w)));do h.data!==e&&(x=s[h.data.index]*r/w,e.vx+=m*x,e.vy+=N*x);while(h=h.next)}return c.initialize=function(h,b){t=h,n=b,u()},c.strength=function(h){return arguments.length?(i=typeof h=="function"?h:dt(+h),u(),c):i},c.distanceMin=function(h){return arguments.length?(o=h*h,c):Math.sqrt(o)},c.distanceMax=function(h){return arguments.length?(a=h*h,c):Math.sqrt(a)},c.theta=function(h){return arguments.length?(l=h*h,c):Math.sqrt(l)},c}var se="http://www.w3.org/1999/xhtml";const $e={svg:"http://www.w3.org/2000/svg",xhtml:se,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Jt(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),$e.hasOwnProperty(e)?{space:$e[e],local:t}:t}function Ir(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===se&&e.documentElement.namespaceURI===se?e.createElement(t):e.createElementNS(n,t)}}function Dr(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function tn(t){var e=Jt(t);return(e.local?Dr:Ir)(e)}function Pr(){}function ye(t){return t==null?Pr:function(){return this.querySelector(t)}}function Fr(t){typeof t!="function"&&(t=ye(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var s=e[i],o=s.length,a=r[i]=new Array(o),l,c,u=0;u<o;++u)(l=s[u])&&(c=t.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new V(r,this._parents)}function Lr(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Hr(){return[]}function en(t){return t==null?Hr:function(){return this.querySelectorAll(t)}}function Or(t){return function(){return Lr(t.apply(this,arguments))}}function Xr(t){typeof t=="function"?t=Or(t):t=en(t);for(var e=this._groups,n=e.length,r=[],i=[],s=0;s<n;++s)for(var o=e[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&(r.push(t.call(l,l.__data__,c,o)),i.push(l));return new V(r,i)}function nn(t){return function(){return this.matches(t)}}function rn(t){return function(e){return e.matches(t)}}var Yr=Array.prototype.find;function Br(t){return function(){return Yr.call(this.children,t)}}function Vr(){return this.firstElementChild}function qr(t){return this.select(t==null?Vr:Br(typeof t=="function"?t:rn(t)))}var Gr=Array.prototype.filter;function Kr(){return Array.from(this.children)}function Ur(t){return function(){return Gr.call(this.children,t)}}function Wr(t){return this.selectAll(t==null?Kr:Ur(typeof t=="function"?t:rn(t)))}function Qr(t){typeof t!="function"&&(t=nn(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var s=e[i],o=s.length,a=r[i]=[],l,c=0;c<o;++c)(l=s[c])&&t.call(l,l.__data__,c,s)&&a.push(l);return new V(r,this._parents)}function sn(t){return new Array(t.length)}function Jr(){return new V(this._enter||this._groups.map(sn),this._parents)}function qt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}qt.prototype={constructor:qt,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Zr(t){return function(){return t}}function ti(t,e,n,r,i,s){for(var o=0,a,l=e.length,c=s.length;o<c;++o)(a=e[o])?(a.__data__=s[o],r[o]=a):n[o]=new qt(t,s[o]);for(;o<l;++o)(a=e[o])&&(i[o]=a)}function ei(t,e,n,r,i,s,o){var a,l,c=new Map,u=e.length,g=s.length,d=new Array(u),h;for(a=0;a<u;++a)(l=e[a])&&(d[a]=h=o.call(l,l.__data__,a,e)+"",c.has(h)?i[a]=l:c.set(h,l));for(a=0;a<g;++a)h=o.call(t,s[a],a,s)+"",(l=c.get(h))?(r[a]=l,l.__data__=s[a],c.delete(h)):n[a]=new qt(t,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(d[a])===l&&(i[a]=l)}function ni(t){return t.__data__}function ri(t,e){if(!arguments.length)return Array.from(this,ni);var n=e?ei:ti,r=this._parents,i=this._groups;typeof t!="function"&&(t=Zr(t));for(var s=i.length,o=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=r[c],g=i[c],d=g.length,h=ii(t.call(u,u&&u.__data__,c,r)),b=h.length,y=a[c]=new Array(b),v=o[c]=new Array(b),m=l[c]=new Array(d);n(u,g,y,v,m,h,e);for(var N=0,x=0,w,S;N<b;++N)if(w=y[N]){for(N>=x&&(x=N+1);!(S=v[x])&&++x<b;);w._next=S||null}}return o=new V(o,r),o._enter=a,o._exit=l,o}function ii(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function si(){return new V(this._exit||this._groups.map(sn),this._parents)}function oi(t,e,n){var r=this.enter(),i=this,s=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?s.remove():n(s),r&&i?r.merge(i).order():i}function ai(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,s=r.length,o=Math.min(i,s),a=new Array(i),l=0;l<o;++l)for(var c=n[l],u=r[l],g=c.length,d=a[l]=new Array(g),h,b=0;b<g;++b)(h=c[b]||u[b])&&(d[b]=h);for(;l<i;++l)a[l]=n[l];return new V(a,this._parents)}function ci(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],i=r.length-1,s=r[i],o;--i>=0;)(o=r[i])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function li(t){t||(t=ui);function e(g,d){return g&&d?t(g.__data__,d.__data__):!g-!d}for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s){for(var o=n[s],a=o.length,l=i[s]=new Array(a),c,u=0;u<a;++u)(c=o[u])&&(l[u]=c);l.sort(e)}return new V(i,this._parents).order()}function ui(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function fi(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function hi(){return Array.from(this)}function di(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,s=r.length;i<s;++i){var o=r[i];if(o)return o}return null}function pi(){let t=0;for(const e of this)++t;return t}function xi(){return!this.node()}function mi(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],s=0,o=i.length,a;s<o;++s)(a=i[s])&&t.call(a,a.__data__,s,i);return this}function gi(t){return function(){this.removeAttribute(t)}}function yi(t){return function(){this.removeAttributeNS(t.space,t.local)}}function vi(t,e){return function(){this.setAttribute(t,e)}}function _i(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function wi(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function bi(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Ni(t,e){var n=Jt(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?yi:gi:typeof e=="function"?n.local?bi:wi:n.local?_i:vi)(n,e))}function on(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ji(t){return function(){this.style.removeProperty(t)}}function ki(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Ai(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function Ei(t,e,n){return arguments.length>1?this.each((e==null?ji:typeof e=="function"?Ai:ki)(t,e,n??"")):yt(this.node(),t)}function yt(t,e){return t.style.getPropertyValue(e)||on(t).getComputedStyle(t,null).getPropertyValue(e)}function Si(t){return function(){delete this[t]}}function Mi(t,e){return function(){this[t]=e}}function Ti(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Ci(t,e){return arguments.length>1?this.each((e==null?Si:typeof e=="function"?Ti:Mi)(t,e)):this.node()[t]}function an(t){return t.trim().split(/^|\s+/)}function ve(t){return t.classList||new cn(t)}function cn(t){this._node=t,this._names=an(t.getAttribute("class")||"")}cn.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function ln(t,e){for(var n=ve(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function un(t,e){for(var n=ve(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function $i(t){return function(){ln(this,t)}}function zi(t){return function(){un(this,t)}}function Ri(t,e){return function(){(e.apply(this,arguments)?ln:un)(this,t)}}function Ii(t,e){var n=an(t+"");if(arguments.length<2){for(var r=ve(this.node()),i=-1,s=n.length;++i<s;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?Ri:e?$i:zi)(n,e))}function Di(){this.textContent=""}function Pi(t){return function(){this.textContent=t}}function Fi(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Li(t){return arguments.length?this.each(t==null?Di:(typeof t=="function"?Fi:Pi)(t)):this.node().textContent}function Hi(){this.innerHTML=""}function Oi(t){return function(){this.innerHTML=t}}function Xi(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Yi(t){return arguments.length?this.each(t==null?Hi:(typeof t=="function"?Xi:Oi)(t)):this.node().innerHTML}function Bi(){this.nextSibling&&this.parentNode.appendChild(this)}function Vi(){return this.each(Bi)}function qi(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Gi(){return this.each(qi)}function Ki(t){var e=typeof t=="function"?t:tn(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Ui(){return null}function Wi(t,e){var n=typeof t=="function"?t:tn(t),r=e==null?Ui:typeof e=="function"?e:ye(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Qi(){var t=this.parentNode;t&&t.removeChild(this)}function Ji(){return this.each(Qi)}function Zi(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ts(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function es(t){return this.select(t?ts:Zi)}function ns(t){return arguments.length?this.property("__data__",t):this.node().__data__}function rs(t){return function(e){t.call(this,e,this.__data__)}}function is(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function ss(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,s;n<i;++n)s=e[n],(!t.type||s.type===t.type)&&s.name===t.name?this.removeEventListener(s.type,s.listener,s.options):e[++r]=s;++r?e.length=r:delete this.__on}}}function os(t,e,n){return function(){var r=this.__on,i,s=rs(e);if(r){for(var o=0,a=r.length;o<a;++o)if((i=r[o]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=n),i.value=e;return}}this.addEventListener(t.type,s,n),i={type:t.type,name:t.name,value:e,listener:s,options:n},r?r.push(i):this.__on=[i]}}function as(t,e,n){var r=is(t+""),i,s=r.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(i=0,u=a[l];i<s;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(a=e?os:ss,i=0;i<s;++i)this.each(a(r[i],e,n));return this}function fn(t,e,n){var r=on(t),i=r.CustomEvent;typeof i=="function"?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function cs(t,e){return function(){return fn(this,t,e)}}function ls(t,e){return function(){return fn(this,t,e.apply(this,arguments))}}function us(t,e){return this.each((typeof e=="function"?ls:cs)(t,e))}function*fs(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,s=r.length,o;i<s;++i)(o=r[i])&&(yield o)}var hn=[null];function V(t,e){this._groups=t,this._parents=e}function $t(){return new V([[document.documentElement]],hn)}function hs(){return this}V.prototype=$t.prototype={constructor:V,select:Fr,selectAll:Xr,selectChild:qr,selectChildren:Wr,filter:Qr,data:ri,enter:Jr,exit:si,join:oi,merge:ai,selection:hs,order:ci,sort:li,call:fi,nodes:hi,node:di,size:pi,empty:xi,each:mi,attr:Ni,style:Ei,property:Ci,classed:Ii,text:Li,html:Yi,raise:Vi,lower:Gi,append:Ki,insert:Wi,remove:Ji,clone:es,datum:ns,on:as,dispatch:us,[Symbol.iterator]:fs};function q(t){return typeof t=="string"?new V([[document.querySelector(t)]],[document.documentElement]):new V([[t]],hn)}function ds(t){let e;for(;e=t.sourceEvent;)t=e;return t}function ut(t,e){if(t=ds(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}const oe={capture:!0,passive:!1};function ae(t){t.preventDefault(),t.stopImmediatePropagation()}function ps(t){var e=t.document.documentElement,n=q(t).on("dragstart.drag",ae,oe);"onselectstart"in e?n.on("selectstart.drag",ae,oe):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function xs(t,e){var n=t.document.documentElement,r=q(t).on("dragstart.drag",null);e&&(r.on("click.drag",ae,oe),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function _e(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function dn(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function zt(){}var Et=.7,Gt=1/Et,mt="\\s*([+-]?\\d+)\\s*",St="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Z="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ms=/^#([0-9a-f]{3,8})$/,gs=new RegExp(`^rgb\\(${mt},${mt},${mt}\\)$`),ys=new RegExp(`^rgb\\(${Z},${Z},${Z}\\)$`),vs=new RegExp(`^rgba\\(${mt},${mt},${mt},${St}\\)$`),_s=new RegExp(`^rgba\\(${Z},${Z},${Z},${St}\\)$`),ws=new RegExp(`^hsl\\(${St},${Z},${Z}\\)$`),bs=new RegExp(`^hsla\\(${St},${Z},${Z},${St}\\)$`),ze={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};_e(zt,Mt,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Re,formatHex:Re,formatHex8:Ns,formatHsl:js,formatRgb:Ie,toString:Ie});function Re(){return this.rgb().formatHex()}function Ns(){return this.rgb().formatHex8()}function js(){return pn(this).formatHsl()}function Ie(){return this.rgb().formatRgb()}function Mt(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=ms.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?De(e):n===3?new X(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Rt(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Rt(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=gs.exec(t))?new X(e[1],e[2],e[3],1):(e=ys.exec(t))?new X(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=vs.exec(t))?Rt(e[1],e[2],e[3],e[4]):(e=_s.exec(t))?Rt(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=ws.exec(t))?Le(e[1],e[2]/100,e[3]/100,1):(e=bs.exec(t))?Le(e[1],e[2]/100,e[3]/100,e[4]):ze.hasOwnProperty(t)?De(ze[t]):t==="transparent"?new X(NaN,NaN,NaN,0):null}function De(t){return new X(t>>16&255,t>>8&255,t&255,1)}function Rt(t,e,n,r){return r<=0&&(t=e=n=NaN),new X(t,e,n,r)}function ks(t){return t instanceof zt||(t=Mt(t)),t?(t=t.rgb(),new X(t.r,t.g,t.b,t.opacity)):new X}function ce(t,e,n,r){return arguments.length===1?ks(t):new X(t,e,n,r??1)}function X(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}_e(X,ce,dn(zt,{brighter(t){return t=t==null?Gt:Math.pow(Gt,t),new X(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Et:Math.pow(Et,t),new X(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new X(pt(this.r),pt(this.g),pt(this.b),Kt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Pe,formatHex:Pe,formatHex8:As,formatRgb:Fe,toString:Fe}));function Pe(){return`#${ft(this.r)}${ft(this.g)}${ft(this.b)}`}function As(){return`#${ft(this.r)}${ft(this.g)}${ft(this.b)}${ft((isNaN(this.opacity)?1:this.opacity)*255)}`}function Fe(){const t=Kt(this.opacity);return`${t===1?"rgb(":"rgba("}${pt(this.r)}, ${pt(this.g)}, ${pt(this.b)}${t===1?")":`, ${t})`}`}function Kt(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function pt(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ft(t){return t=pt(t),(t<16?"0":"")+t.toString(16)}function Le(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new U(t,e,n,r)}function pn(t){if(t instanceof U)return new U(t.h,t.s,t.l,t.opacity);if(t instanceof zt||(t=Mt(t)),!t)return new U;if(t instanceof U)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),s=Math.max(e,n,r),o=NaN,a=s-i,l=(s+i)/2;return a?(e===s?o=(n-r)/a+(n<r)*6:n===s?o=(r-e)/a+2:o=(e-n)/a+4,a/=l<.5?s+i:2-s-i,o*=60):a=l>0&&l<1?0:o,new U(o,a,l,t.opacity)}function Es(t,e,n,r){return arguments.length===1?pn(t):new U(t,e,n,r??1)}function U(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}_e(U,Es,dn(zt,{brighter(t){return t=t==null?Gt:Math.pow(Gt,t),new U(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Et:Math.pow(Et,t),new U(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new X(ee(t>=240?t-240:t+120,i,r),ee(t,i,r),ee(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new U(He(this.h),It(this.s),It(this.l),Kt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Kt(this.opacity);return`${t===1?"hsl(":"hsla("}${He(this.h)}, ${It(this.s)*100}%, ${It(this.l)*100}%${t===1?")":`, ${t})`}`}}));function He(t){return t=(t||0)%360,t<0?t+360:t}function It(t){return Math.max(0,Math.min(1,t||0))}function ee(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const xn=t=>()=>t;function Ss(t,e){return function(n){return t+n*e}}function Ms(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function Ts(t){return(t=+t)==1?mn:function(e,n){return n-e?Ms(e,n,t):xn(isNaN(e)?n:e)}}function mn(t,e){var n=e-t;return n?Ss(t,n):xn(isNaN(t)?e:t)}const Oe=(function t(e){var n=Ts(e);function r(i,s){var o=n((i=ce(i)).r,(s=ce(s)).r),a=n(i.g,s.g),l=n(i.b,s.b),c=mn(i.opacity,s.opacity);return function(u){return i.r=o(u),i.g=a(u),i.b=l(u),i.opacity=c(u),i+""}}return r.gamma=t,r})(1);function at(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var le=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ne=new RegExp(le.source,"g");function Cs(t){return function(){return t}}function $s(t){return function(e){return t(e)+""}}function zs(t,e){var n=le.lastIndex=ne.lastIndex=0,r,i,s,o=-1,a=[],l=[];for(t=t+"",e=e+"";(r=le.exec(t))&&(i=ne.exec(e));)(s=i.index)>n&&(s=e.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(r=r[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:at(r,i)})),n=ne.lastIndex;return n<e.length&&(s=e.slice(n),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?$s(l[0].x):Cs(e):(e=l.length,function(c){for(var u=0,g;u<e;++u)a[(g=l[u]).i]=g.x(c);return a.join("")})}var Xe=180/Math.PI,ue={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function gn(t,e,n,r,i,s){var o,a,l;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,l/=a),t*r<e*n&&(t=-t,e=-e,l=-l,o=-o),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*Xe,skewX:Math.atan(l)*Xe,scaleX:o,scaleY:a}}var Dt;function Rs(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?ue:gn(e.a,e.b,e.c,e.d,e.e,e.f)}function Is(t){return t==null||(Dt||(Dt=document.createElementNS("http://www.w3.org/2000/svg","g")),Dt.setAttribute("transform",t),!(t=Dt.transform.baseVal.consolidate()))?ue:(t=t.matrix,gn(t.a,t.b,t.c,t.d,t.e,t.f))}function yn(t,e,n,r){function i(c){return c.length?c.pop()+" ":""}function s(c,u,g,d,h,b){if(c!==g||u!==d){var y=h.push("translate(",null,e,null,n);b.push({i:y-4,x:at(c,g)},{i:y-2,x:at(u,d)})}else(g||d)&&h.push("translate("+g+e+d+n)}function o(c,u,g,d){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),d.push({i:g.push(i(g)+"rotate(",null,r)-2,x:at(c,u)})):u&&g.push(i(g)+"rotate("+u+r)}function a(c,u,g,d){c!==u?d.push({i:g.push(i(g)+"skewX(",null,r)-2,x:at(c,u)}):u&&g.push(i(g)+"skewX("+u+r)}function l(c,u,g,d,h,b){if(c!==g||u!==d){var y=h.push(i(h)+"scale(",null,",",null,")");b.push({i:y-4,x:at(c,g)},{i:y-2,x:at(u,d)})}else(g!==1||d!==1)&&h.push(i(h)+"scale("+g+","+d+")")}return function(c,u){var g=[],d=[];return c=t(c),u=t(u),s(c.translateX,c.translateY,u.translateX,u.translateY,g,d),o(c.rotate,u.rotate,g,d),a(c.skewX,u.skewX,g,d),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,g,d),c=u=null,function(h){for(var b=-1,y=d.length,v;++b<y;)g[(v=d[b]).i]=v.x(h);return g.join("")}}}var Ds=yn(Rs,"px, ","px)","deg)"),Ps=yn(Is,", ",")",")"),Fs=1e-12;function Ye(t){return((t=Math.exp(t))+1/t)/2}function Ls(t){return((t=Math.exp(t))-1/t)/2}function Hs(t){return((t=Math.exp(2*t))-1)/(t+1)}const Os=(function t(e,n,r){function i(s,o){var a=s[0],l=s[1],c=s[2],u=o[0],g=o[1],d=o[2],h=u-a,b=g-l,y=h*h+b*b,v,m;if(y<Fs)m=Math.log(d/c)/e,v=function(I){return[a+I*h,l+I*b,c*Math.exp(e*I*m)]};else{var N=Math.sqrt(y),x=(d*d-c*c+r*y)/(2*c*n*N),w=(d*d-c*c-r*y)/(2*d*n*N),S=Math.log(Math.sqrt(x*x+1)-x),T=Math.log(Math.sqrt(w*w+1)-w);m=(T-S)/e,v=function(I){var C=I*m,D=Ye(S),$=c/(n*N)*(D*Hs(e*C+S)-Ls(S));return[a+$*h,l+$*b,c*D/Ye(e*C+S)]}}return v.duration=m*1e3*e/Math.SQRT2,v}return i.rho=function(s){var o=Math.max(.001,+s),a=o*o,l=a*a;return t(o,a,l)},i})(Math.SQRT2,2,4);var Xs=Wt("start","end","cancel","interrupt"),Ys=[],vn=0,Be=1,fe=2,Ht=3,Ve=4,he=5,Ot=6;function Zt(t,e,n,r,i,s){var o=t.__transition;if(!o)t.__transition={};else if(n in o)return;Bs(t,n,{name:e,index:r,group:i,on:Xs,tween:Ys,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:vn})}function we(t,e){var n=Q(t,e);if(n.state>vn)throw new Error("too late; already scheduled");return n}function et(t,e){var n=Q(t,e);if(n.state>Ht)throw new Error("too late; already running");return n}function Q(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Bs(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=ge(s,0,n.time);function s(c){n.state=Be,n.timer.restart(o,n.delay,n.time),n.delay<=c&&o(c-n.delay)}function o(c){var u,g,d,h;if(n.state!==Be)return l();for(u in r)if(h=r[u],h.name===n.name){if(h.state===Ht)return Te(o);h.state===Ve?(h.state=Ot,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete r[u]):+u<e&&(h.state=Ot,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete r[u])}if(Te(function(){n.state===Ht&&(n.state=Ve,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=fe,n.on.call("start",t,t.__data__,n.index,n.group),n.state===fe){for(n.state=Ht,i=new Array(d=n.tween.length),u=0,g=-1;u<d;++u)(h=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(i[++g]=h);i.length=g+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=he,1),g=-1,d=i.length;++g<d;)i[g].call(t,u);n.state===he&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){n.state=Ot,n.timer.stop(),delete r[e];for(var c in r)return;delete t.__transition}}function Xt(t,e){var n=t.__transition,r,i,s=!0,o;if(n){e=e==null?null:e+"";for(o in n){if((r=n[o]).name!==e){s=!1;continue}i=r.state>fe&&r.state<he,r.state=Ot,r.timer.stop(),r.on.call(i?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[o]}s&&delete t.__transition}}function Vs(t){return this.each(function(){Xt(this,t)})}function qs(t,e){var n,r;return function(){var i=et(this,t),s=i.tween;if(s!==n){r=n=s;for(var o=0,a=r.length;o<a;++o)if(r[o].name===e){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Gs(t,e,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=et(this,t),o=s.tween;if(o!==r){i=(r=o).slice();for(var a={name:e,value:n},l=0,c=i.length;l<c;++l)if(i[l].name===e){i[l]=a;break}l===c&&i.push(a)}s.tween=i}}function Ks(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=Q(this.node(),n).tween,i=0,s=r.length,o;i<s;++i)if((o=r[i]).name===t)return o.value;return null}return this.each((e==null?qs:Gs)(n,t,e))}function be(t,e,n){var r=t._id;return t.each(function(){var i=et(this,r);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return Q(i,r).value[e]}}function _n(t,e){var n;return(typeof e=="number"?at:e instanceof Mt?Oe:(n=Mt(e))?(e=n,Oe):zs)(t,e)}function Us(t){return function(){this.removeAttribute(t)}}function Ws(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Qs(t,e,n){var r,i=n+"",s;return function(){var o=this.getAttribute(t);return o===i?null:o===r?s:s=e(r=o,n)}}function Js(t,e,n){var r,i=n+"",s;return function(){var o=this.getAttributeNS(t.space,t.local);return o===i?null:o===r?s:s=e(r=o,n)}}function Zs(t,e,n){var r,i,s;return function(){var o,a=n(this),l;return a==null?void this.removeAttribute(t):(o=this.getAttribute(t),l=a+"",o===l?null:o===r&&l===i?s:(i=l,s=e(r=o,a)))}}function to(t,e,n){var r,i,s;return function(){var o,a=n(this),l;return a==null?void this.removeAttributeNS(t.space,t.local):(o=this.getAttributeNS(t.space,t.local),l=a+"",o===l?null:o===r&&l===i?s:(i=l,s=e(r=o,a)))}}function eo(t,e){var n=Jt(t),r=n==="transform"?Ps:_n;return this.attrTween(t,typeof e=="function"?(n.local?to:Zs)(n,r,be(this,"attr."+t,e)):e==null?(n.local?Ws:Us)(n):(n.local?Js:Qs)(n,r,e))}function no(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function ro(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function io(t,e){var n,r;function i(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&ro(t,s)),n}return i._value=e,i}function so(t,e){var n,r;function i(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&no(t,s)),n}return i._value=e,i}function oo(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=Jt(t);return this.tween(n,(r.local?io:so)(r,e))}function ao(t,e){return function(){we(this,t).delay=+e.apply(this,arguments)}}function co(t,e){return e=+e,function(){we(this,t).delay=e}}function lo(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?ao:co)(e,t)):Q(this.node(),e).delay}function uo(t,e){return function(){et(this,t).duration=+e.apply(this,arguments)}}function fo(t,e){return e=+e,function(){et(this,t).duration=e}}function ho(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?uo:fo)(e,t)):Q(this.node(),e).duration}function po(t,e){if(typeof e!="function")throw new Error;return function(){et(this,t).ease=e}}function xo(t){var e=this._id;return arguments.length?this.each(po(e,t)):Q(this.node(),e).ease}function mo(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;et(this,t).ease=n}}function go(t){if(typeof t!="function")throw new Error;return this.each(mo(this._id,t))}function yo(t){typeof t!="function"&&(t=nn(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var s=e[i],o=s.length,a=r[i]=[],l,c=0;c<o;++c)(l=s[c])&&t.call(l,l.__data__,c,s)&&a.push(l);return new ot(r,this._parents,this._name,this._id)}function vo(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,s=Math.min(r,i),o=new Array(r),a=0;a<s;++a)for(var l=e[a],c=n[a],u=l.length,g=o[a]=new Array(u),d,h=0;h<u;++h)(d=l[h]||c[h])&&(g[h]=d);for(;a<r;++a)o[a]=e[a];return new ot(o,this._parents,this._name,this._id)}function _o(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function wo(t,e,n){var r,i,s=_o(e)?we:et;return function(){var o=s(this,t),a=o.on;a!==r&&(i=(r=a).copy()).on(e,n),o.on=i}}function bo(t,e){var n=this._id;return arguments.length<2?Q(this.node(),n).on.on(t):this.each(wo(n,t,e))}function No(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function jo(){return this.on("end.remove",No(this._id))}function ko(t){var e=this._name,n=this._id;typeof t!="function"&&(t=ye(t));for(var r=this._groups,i=r.length,s=new Array(i),o=0;o<i;++o)for(var a=r[o],l=a.length,c=s[o]=new Array(l),u,g,d=0;d<l;++d)(u=a[d])&&(g=t.call(u,u.__data__,d,a))&&("__data__"in u&&(g.__data__=u.__data__),c[d]=g,Zt(c[d],e,n,d,c,Q(u,n)));return new ot(s,this._parents,e,n)}function Ao(t){var e=this._name,n=this._id;typeof t!="function"&&(t=en(t));for(var r=this._groups,i=r.length,s=[],o=[],a=0;a<i;++a)for(var l=r[a],c=l.length,u,g=0;g<c;++g)if(u=l[g]){for(var d=t.call(u,u.__data__,g,l),h,b=Q(u,n),y=0,v=d.length;y<v;++y)(h=d[y])&&Zt(h,e,n,y,d,b);s.push(d),o.push(u)}return new ot(s,o,e,n)}var Eo=$t.prototype.constructor;function So(){return new Eo(this._groups,this._parents)}function Mo(t,e){var n,r,i;return function(){var s=yt(this,t),o=(this.style.removeProperty(t),yt(this,t));return s===o?null:s===n&&o===r?i:i=e(n=s,r=o)}}function wn(t){return function(){this.style.removeProperty(t)}}function To(t,e,n){var r,i=n+"",s;return function(){var o=yt(this,t);return o===i?null:o===r?s:s=e(r=o,n)}}function Co(t,e,n){var r,i,s;return function(){var o=yt(this,t),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(t),yt(this,t))),o===l?null:o===r&&l===i?s:(i=l,s=e(r=o,a))}}function $o(t,e){var n,r,i,s="style."+e,o="end."+s,a;return function(){var l=et(this,t),c=l.on,u=l.value[s]==null?a||(a=wn(e)):void 0;(c!==n||i!==u)&&(r=(n=c).copy()).on(o,i=u),l.on=r}}function zo(t,e,n){var r=(t+="")=="transform"?Ds:_n;return e==null?this.styleTween(t,Mo(t,r)).on("end.style."+t,wn(t)):typeof e=="function"?this.styleTween(t,Co(t,r,be(this,"style."+t,e))).each($o(this._id,t)):this.styleTween(t,To(t,r,e),n).on("end.style."+t,null)}function Ro(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function Io(t,e,n){var r,i;function s(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&Ro(t,o,n)),r}return s._value=e,s}function Do(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,Io(t,e,n??""))}function Po(t){return function(){this.textContent=t}}function Fo(t){return function(){var e=t(this);this.textContent=e??""}}function Lo(t){return this.tween("text",typeof t=="function"?Fo(be(this,"text",t)):Po(t==null?"":t+""))}function Ho(t){return function(e){this.textContent=t.call(this,e)}}function Oo(t){var e,n;function r(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&Ho(i)),e}return r._value=t,r}function Xo(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,Oo(t))}function Yo(){for(var t=this._name,e=this._id,n=bn(),r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],a=o.length,l,c=0;c<a;++c)if(l=o[c]){var u=Q(l,e);Zt(l,t,n,c,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new ot(r,this._parents,t,n)}function Bo(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(s,o){var a={value:o},l={value:function(){--i===0&&s()}};n.each(function(){var c=et(this,r),u=c.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(l)),c.on=e}),i===0&&s()})}var Vo=0;function ot(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function bn(){return++Vo}var it=$t.prototype;ot.prototype={constructor:ot,select:ko,selectAll:Ao,selectChild:it.selectChild,selectChildren:it.selectChildren,filter:yo,merge:vo,selection:So,transition:Yo,call:it.call,nodes:it.nodes,node:it.node,size:it.size,empty:it.empty,each:it.each,on:bo,attr:eo,attrTween:oo,style:zo,styleTween:Do,text:Lo,textTween:Xo,remove:jo,tween:Ks,delay:lo,duration:ho,ease:xo,easeVarying:go,end:Bo,[Symbol.iterator]:it[Symbol.iterator]};function qo(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Go={time:null,delay:0,duration:250,ease:qo};function Ko(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Uo(t){var e,n;t instanceof ot?(e=t._id,t=t._name):(e=bn(),(n=Go).time=me(),t=t==null?null:t+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&Zt(l,t,e,c,o,n||Ko(l,e));return new ot(r,this._parents,t,e)}$t.prototype.interrupt=Vs;$t.prototype.transition=Uo;const Pt=t=>()=>t;function Wo(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function st(t,e,n){this.k=t,this.x=e,this.y=n}st.prototype={constructor:st,scale:function(t){return t===1?this:new st(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new st(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ne=new st(1,0,0);st.prototype;function re(t){t.stopImmediatePropagation()}function bt(t){t.preventDefault(),t.stopImmediatePropagation()}function Qo(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Jo(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function qe(){return this.__zoom||Ne}function Zo(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function ta(){return navigator.maxTouchPoints||"ontouchstart"in this}function ea(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],o=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}function na(){var t=Qo,e=Jo,n=ea,r=Zo,i=ta,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Os,c=Wt("start","zoom","end"),u,g,d,h=500,b=150,y=0,v=10;function m(p){p.property("__zoom",qe).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",$).filter(i).on("touchstart.zoom",Y).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(p,j,_,k){var A=p.selection?p.selection():p;A.property("__zoom",qe),p!==A?S(p,j,_,k):A.interrupt().each(function(){T(this,arguments).event(k).start().zoom(null,typeof j=="function"?j.apply(this,arguments):j).end()})},m.scaleBy=function(p,j,_,k){m.scaleTo(p,function(){var A=this.__zoom.k,E=typeof j=="function"?j.apply(this,arguments):j;return A*E},_,k)},m.scaleTo=function(p,j,_,k){m.transform(p,function(){var A=e.apply(this,arguments),E=this.__zoom,M=_==null?w(A):typeof _=="function"?_.apply(this,arguments):_,z=E.invert(M),P=typeof j=="function"?j.apply(this,arguments):j;return n(x(N(E,P),M,z),A,o)},_,k)},m.translateBy=function(p,j,_,k){m.transform(p,function(){return n(this.__zoom.translate(typeof j=="function"?j.apply(this,arguments):j,typeof _=="function"?_.apply(this,arguments):_),e.apply(this,arguments),o)},null,k)},m.translateTo=function(p,j,_,k,A){m.transform(p,function(){var E=e.apply(this,arguments),M=this.__zoom,z=k==null?w(E):typeof k=="function"?k.apply(this,arguments):k;return n(Ne.translate(z[0],z[1]).scale(M.k).translate(typeof j=="function"?-j.apply(this,arguments):-j,typeof _=="function"?-_.apply(this,arguments):-_),E,o)},k,A)};function N(p,j){return j=Math.max(s[0],Math.min(s[1],j)),j===p.k?p:new st(j,p.x,p.y)}function x(p,j,_){var k=j[0]-_[0]*p.k,A=j[1]-_[1]*p.k;return k===p.x&&A===p.y?p:new st(p.k,k,A)}function w(p){return[(+p[0][0]+ +p[1][0])/2,(+p[0][1]+ +p[1][1])/2]}function S(p,j,_,k){p.on("start.zoom",function(){T(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(k).end()}).tween("zoom",function(){var A=this,E=arguments,M=T(A,E).event(k),z=e.apply(A,E),P=_==null?w(z):typeof _=="function"?_.apply(A,E):_,J=Math.max(z[1][0]-z[0][0],z[1][1]-z[0][1]),F=A.__zoom,G=typeof j=="function"?j.apply(A,E):j,nt=l(F.invert(P).concat(J/F.k),G.invert(P).concat(J/G.k));return function(K){if(K===1)K=G;else{var rt=nt(K),te=J/rt[2];K=new st(te,P[0]-rt[0]*te,P[1]-rt[1]*te)}M.zoom(null,K)}})}function T(p,j,_){return!_&&p.__zooming||new I(p,j)}function I(p,j){this.that=p,this.args=j,this.active=0,this.sourceEvent=null,this.extent=e.apply(p,j),this.taps=0}I.prototype={event:function(p){return p&&(this.sourceEvent=p),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(p,j){return this.mouse&&p!=="mouse"&&(this.mouse[1]=j.invert(this.mouse[0])),this.touch0&&p!=="touch"&&(this.touch0[1]=j.invert(this.touch0[0])),this.touch1&&p!=="touch"&&(this.touch1[1]=j.invert(this.touch1[0])),this.that.__zoom=j,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(p){var j=q(this.that).datum();c.call(p,this.that,new Wo(p,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:c}),j)}};function C(p,...j){if(!t.apply(this,arguments))return;var _=T(this,j).event(p),k=this.__zoom,A=Math.max(s[0],Math.min(s[1],k.k*Math.pow(2,r.apply(this,arguments)))),E=ut(p);if(_.wheel)(_.mouse[0][0]!==E[0]||_.mouse[0][1]!==E[1])&&(_.mouse[1]=k.invert(_.mouse[0]=E)),clearTimeout(_.wheel);else{if(k.k===A)return;_.mouse=[E,k.invert(E)],Xt(this),_.start()}bt(p),_.wheel=setTimeout(M,b),_.zoom("mouse",n(x(N(k,A),_.mouse[0],_.mouse[1]),_.extent,o));function M(){_.wheel=null,_.end()}}function D(p,...j){if(d||!t.apply(this,arguments))return;var _=p.currentTarget,k=T(this,j,!0).event(p),A=q(p.view).on("mousemove.zoom",P,!0).on("mouseup.zoom",J,!0),E=ut(p,_),M=p.clientX,z=p.clientY;ps(p.view),re(p),k.mouse=[E,this.__zoom.invert(E)],Xt(this),k.start();function P(F){if(bt(F),!k.moved){var G=F.clientX-M,nt=F.clientY-z;k.moved=G*G+nt*nt>y}k.event(F).zoom("mouse",n(x(k.that.__zoom,k.mouse[0]=ut(F,_),k.mouse[1]),k.extent,o))}function J(F){A.on("mousemove.zoom mouseup.zoom",null),xs(F.view,k.moved),bt(F),k.event(F).end()}}function $(p,...j){if(t.apply(this,arguments)){var _=this.__zoom,k=ut(p.changedTouches?p.changedTouches[0]:p,this),A=_.invert(k),E=_.k*(p.shiftKey?.5:2),M=n(x(N(_,E),k,A),e.apply(this,j),o);bt(p),a>0?q(this).transition().duration(a).call(S,M,k,p):q(this).call(m.transform,M,k,p)}}function Y(p,...j){if(t.apply(this,arguments)){var _=p.touches,k=_.length,A=T(this,j,p.changedTouches.length===k).event(p),E,M,z,P;for(re(p),M=0;M<k;++M)z=_[M],P=ut(z,this),P=[P,this.__zoom.invert(P),z.identifier],A.touch0?!A.touch1&&A.touch0[2]!==P[2]&&(A.touch1=P,A.taps=0):(A.touch0=P,E=!0,A.taps=1+!!u);u&&(u=clearTimeout(u)),E&&(A.taps<2&&(g=P[0],u=setTimeout(function(){u=null},h)),Xt(this),A.start())}}function B(p,...j){if(this.__zooming){var _=T(this,j).event(p),k=p.changedTouches,A=k.length,E,M,z,P;for(bt(p),E=0;E<A;++E)M=k[E],z=ut(M,this),_.touch0&&_.touch0[2]===M.identifier?_.touch0[0]=z:_.touch1&&_.touch1[2]===M.identifier&&(_.touch1[0]=z);if(M=_.that.__zoom,_.touch1){var J=_.touch0[0],F=_.touch0[1],G=_.touch1[0],nt=_.touch1[1],K=(K=G[0]-J[0])*K+(K=G[1]-J[1])*K,rt=(rt=nt[0]-F[0])*rt+(rt=nt[1]-F[1])*rt;M=N(M,Math.sqrt(K/rt)),z=[(J[0]+G[0])/2,(J[1]+G[1])/2],P=[(F[0]+nt[0])/2,(F[1]+nt[1])/2]}else if(_.touch0)z=_.touch0[0],P=_.touch0[1];else return;_.zoom("touch",n(x(M,z,P),_.extent,o))}}function O(p,...j){if(this.__zooming){var _=T(this,j).event(p),k=p.changedTouches,A=k.length,E,M;for(re(p),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),E=0;E<A;++E)M=k[E],_.touch0&&_.touch0[2]===M.identifier?delete _.touch0:_.touch1&&_.touch1[2]===M.identifier&&delete _.touch1;if(_.touch1&&!_.touch0&&(_.touch0=_.touch1,delete _.touch1),_.touch0)_.touch0[1]=this.__zoom.invert(_.touch0[0]);else if(_.end(),_.taps===2&&(M=ut(M,this),Math.hypot(g[0]-M[0],g[1]-M[1])<v)){var z=q(this).on("dblclick.zoom");z&&z.apply(this,arguments)}}}return m.wheelDelta=function(p){return arguments.length?(r=typeof p=="function"?p:Pt(+p),m):r},m.filter=function(p){return arguments.length?(t=typeof p=="function"?p:Pt(!!p),m):t},m.touchable=function(p){return arguments.length?(i=typeof p=="function"?p:Pt(!!p),m):i},m.extent=function(p){return arguments.length?(e=typeof p=="function"?p:Pt([[+p[0][0],+p[0][1]],[+p[1][0],+p[1][1]]]),m):e},m.scaleExtent=function(p){return arguments.length?(s[0]=+p[0],s[1]=+p[1],m):[s[0],s[1]]},m.translateExtent=function(p){return arguments.length?(o[0][0]=+p[0][0],o[1][0]=+p[1][0],o[0][1]=+p[0][1],o[1][1]=+p[1][1],m):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},m.constrain=function(p){return arguments.length?(n=p,m):n},m.duration=function(p){return arguments.length?(a=+p,m):a},m.interpolate=function(p){return arguments.length?(l=p,m):l},m.on=function(){var p=c.on.apply(c,arguments);return p===c?m:p},m.clickDistance=function(p){return arguments.length?(y=(p=+p)*p,m):Math.sqrt(y)},m.tapDistance=function(p){return arguments.length?(v=+p,m):v},m}const ra=new Set(["CONTAINS","IMPLEMENTS","CORRESPONDS"]),ia=new Set(["REFERENCES","MENTIONS"]);function sa(t){return ra.has(t)?"skeleton":ia.has(t)?"weak":"standard"}const oa=30,Ft=800,Nt=500;function aa({centerNode:t,neighbors:e}){const[n,r]=R.useState(e.length>oa?"table":"graph");return f.jsxs("div",{children:[f.jsxs("div",{className:"flex items-center justify-end gap-1 mb-3",children:[f.jsx("button",{onClick:()=>r("graph"),className:`p-1.5 rounded transition-colors ${n==="graph"?"bg-c4a-bg-hover text-c4a-text-primary":"text-c4a-text-muted hover:text-c4a-text-secondary"}`,title:"力导向图",children:f.jsx(Tn,{size:16})}),f.jsx("button",{onClick:()=>r("table"),className:`p-1.5 rounded transition-colors ${n==="table"?"bg-c4a-bg-hover text-c4a-text-primary":"text-c4a-text-muted hover:text-c4a-text-secondary"}`,title:"表格模式",children:f.jsx($n,{size:16})})]}),n==="graph"?f.jsx(ca,{centerNode:t,neighbors:e}):f.jsx(la,{neighbors:e})]})}function ca({centerNode:t,neighbors:e}){const n=R.useRef(null),r=Ut(),{t:i}=lt(),s=R.useCallback(a=>r(ht.entity(a)),[r]),o=R.useCallback(a=>r(ht.relation(a)),[r]);return R.useEffect(()=>{const a=n.current;if(!a)return;const l=q(a);l.selectAll("*").remove();const c=new Map;c.set(t.id,{id:t.id,name:t.name,type:t.type,kind:t.kind,isCenter:!0,x:Ft/2,y:Nt/2});for(const x of e)c.has(x.neighbor.id)||c.set(x.neighbor.id,{id:x.neighbor.id,name:x.neighbor.name,type:x.neighbor.type,kind:x.neighbor.kind,isCenter:!1});const u=Array.from(c.values()),g=e.map(x=>{const w={id:x.id,type:x.type,edgeClass:sa(x.type),source:x.direction==="outgoing"?t.id:x.neighbor.id,target:x.direction==="outgoing"?x.neighbor.id:t.id};return x.confidence!==void 0&&(w.confidence=x.confidence),w});l.append("defs").append("marker").attr("id","arrow").attr("viewBox","0 0 10 6").attr("refX",28).attr("refY",3).attr("markerWidth",10).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M0,0L10,3L0,6").attr("fill","var(--c4a-border-subtle)");const h=l.append("g"),b=na().scaleExtent([.3,3]).on("zoom",x=>{h.attr("transform",x.transform)});l.call(b).call(b.transform,Ne);const y=h.selectAll("line.link").data(g).join("line").attr("class","link").attr("stroke",x=>x.edgeClass==="skeleton"?"var(--c4a-text-secondary)":"var(--c4a-border-subtle)").attr("stroke-width",x=>x.edgeClass==="skeleton"?2:1).attr("stroke-dasharray",x=>x.edgeClass==="weak"?"4 3":null).attr("opacity",x=>x.edgeClass==="weak"?.6:1).attr("marker-end","url(#arrow)").style("cursor","pointer").on("click",(x,w)=>o(w.id)).on("mouseenter",function(){q(this).attr("stroke","var(--c4a-accent)").attr("stroke-width",function(){return Number(q(this).attr("stroke-width"))+1})}).on("mouseleave",function(x,w){q(this).attr("stroke",w.edgeClass==="skeleton"?"var(--c4a-text-secondary)":"var(--c4a-border-subtle)").attr("stroke-width",w.edgeClass==="skeleton"?2:1)});y.append("title").text(x=>{const w=de(x.confidence);return w?`${x.type} · ${i(w.labelKey)}`:x.type});const v=h.selectAll("text.link-label").data(g).join("text").attr("class","link-label").text(x=>x.type).attr("font-family","var(--font-mono)").attr("font-size",9).attr("fill","var(--c4a-text-muted)").attr("text-anchor","middle").attr("dy",-4),m=h.selectAll("g.node").data(u,x=>x.id).join("g").attr("class","node").style("cursor","pointer").on("click",(x,w)=>s(w.id));m.append("circle").attr("r",x=>x.isCenter?24:18).attr("fill",x=>x.isCenter?"var(--c4a-accent)":"var(--c4a-bg-elevated)").attr("stroke",x=>x.isCenter?"#fff":"var(--c4a-border-default)").attr("stroke-width",x=>x.isCenter?2:1),m.append("text").text(x=>x.name.length>12?x.name.slice(0,12)+"…":x.name).attr("font-family","var(--font-mono)").attr("font-size",10).attr("fill","var(--c4a-text-primary)").attr("text-anchor","middle").attr("dy",x=>x.isCenter?36:30),m.append("title").text(x=>{let w=`${x.name}
2
+ type: ${x.type}`;return x.kind&&(w+=`
3
+ kind: ${x.kind}`),w});const N=zr(u).force("link",yr(g).id(x=>x.id).distance(120)).force("charge",Rr().strength(-300)).force("center",Qn(Ft/2,Nt/2)).force("collide",mr(30)).on("tick",()=>{y.attr("x1",x=>x.source.x??0).attr("y1",x=>x.source.y??0).attr("x2",x=>x.target.x??0).attr("y2",x=>x.target.y??0),v.attr("x",x=>{const w=x.source.x??0,S=x.target.x??0;return(w+S)/2}).attr("y",x=>{const w=x.source.y??0,S=x.target.y??0;return(w+S)/2}),m.attr("transform",x=>`translate(${x.x??0},${x.y??0})`)});return m.each(function(x,w){const S=q(this);let T=!1;S.on("mousedown.drag",I=>{I.stopPropagation(),T=!0;const C=u[w],D=a.getBoundingClientRect(),$=B=>{if(!T)return;const O=h.attr("transform");let p=0,j=0,_=1;if(O){const E=O.match(/translate\(([-\d.e+]+)[, ]([-\d.e+]+)\)\s*scale\(([-\d.e+]+)\)/);E&&(p=parseFloat(E[1]),j=parseFloat(E[2]),_=parseFloat(E[3]))}const k=(B.clientX-D.left)/D.width*Ft,A=(B.clientY-D.top)/D.height*Nt;C.fx=(k-p)/_,C.fy=(A-j)/_,N.alpha(.3).restart()},Y=()=>{T=!1,C.fx=null,C.fy=null,document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",Y)};document.addEventListener("mousemove",$),document.addEventListener("mouseup",Y)})}),()=>{N.stop()}},[t,e,s,o]),f.jsx("svg",{ref:n,width:"100%",height:Nt,viewBox:`0 0 ${Ft} ${Nt}`,className:"rounded border border-c4a-border-subtle bg-c4a-bg-surface"})}function la({neighbors:t}){const e=Ut();return f.jsx("div",{className:"rounded border border-c4a-border-subtle overflow-auto",children:f.jsxs("table",{className:"w-full text-xs font-mono",children:[f.jsx("thead",{children:f.jsxs("tr",{className:"border-b border-c4a-border-subtle bg-c4a-bg-surface text-c4a-text-muted text-left",children:[f.jsx("th",{className:"px-3 py-2",children:"NAME"}),f.jsx("th",{className:"px-3 py-2",children:"TYPE"}),f.jsx("th",{className:"px-3 py-2",children:"KIND"}),f.jsx("th",{className:"px-3 py-2",children:"EDGE"}),f.jsx("th",{className:"px-3 py-2",children:"DIRECTION"})]})}),f.jsx("tbody",{children:t.map(n=>f.jsxs("tr",{className:"border-b border-c4a-border-subtle hover:bg-c4a-bg-hover cursor-pointer transition-colors",onClick:()=>e(ht.entity(n.neighbor.id)),children:[f.jsx("td",{className:"px-3 py-2 text-c4a-accent",children:n.neighbor.name}),f.jsx("td",{className:"px-3 py-2 text-c4a-text-secondary",children:n.neighbor.type}),f.jsx("td",{className:"px-3 py-2 text-c4a-text-muted",children:n.neighbor.kind??"—"}),f.jsx("td",{className:"px-3 py-2",children:f.jsx(W,{variant:"accent",children:n.type})}),f.jsx("td",{className:"px-3 py-2 text-c4a-text-muted",children:n.direction==="outgoing"?"→":"←"})]},n.id))})]})})}function ua({entityId:t,centerNode:e}){const{t:n}=lt(),[r,i]=R.useState([]),[s,o]=R.useState(!1);return R.useEffect(()=>{Tt.get(`/entities/${t}/neighbors`).then(a=>{const l=[];for(const c of a.neighbors)for(const u of c.via)l.push({id:u.relation_id,type:u.type,direction:u.direction,neighbor:{id:c.id,name:c.name,type:c.type,...c.kind?{kind:c.kind}:{}},...u.weight!==void 0?{weight:u.weight}:{},...u.confidence!==void 0?{confidence:u.confidence}:{}});i(l),o(!0)}).catch(()=>o(!0))},[t]),s?r.length===0?f.jsx(Ct,{title:n("common.empty.entity_neighbors.title"),description:n("common.empty.entity_neighbors.description")}):f.jsx(aa,{centerNode:e,neighbors:r}):f.jsx("p",{className:"text-sm text-c4a-text-muted",children:n("common.loading")})}const fa={Component:"🏗",SoR:"📋",Product:"📦",Container:"📂",Contract:"📝",Epic:"🎯"};function xa(){const{t}=lt(),{entityId:e}=Nn(),[n,r]=R.useState(null),[i,s]=R.useState(null),[o,a]=R.useState("overview");if(R.useEffect(()=>{e&&(s(null),Tt.get(`/entities/${e}`).then(r).catch(y=>{y instanceof jn&&y.status===404?s("not_found"):s("load_failed")}))},[e]),i)return f.jsx("div",{className:"flex flex-1 flex-col p-4 md:p-6",children:f.jsx(Ct,{title:t(`common.error.${i}`),description:t(`common.error.${i}_description`)})});if(!n)return f.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:f.jsx("p",{className:"text-sm text-c4a-text-muted",children:t("common.loading")})});const l=fa[n.type]??"🔹",c=n._links,u=c?.relations?.count,g=c?.contents?.count,d=c?.referrers?.count,{atoms:h,...b}=n.data;return f.jsxs("div",{className:"flex flex-1 flex-col p-4 md:p-6",children:[f.jsx(En,{icon:f.jsx("span",{children:l}),title:n.name,badges:[f.jsx(W,{children:n.type},"type"),...n.kind?[f.jsx(W,{variant:"muted",children:n.kind},"kind")]:[]],meta:[...n.perspective?[{label:t("entity.detail.perspective"),value:n.perspective}]:[],...n.scope?[{label:t("entity.detail.scope"),value:n.scope}]:[]]}),f.jsxs(kn,{value:o,onChange:y=>a(y),children:[f.jsx("div",{className:"mt-3",children:f.jsxs(An,{children:[f.jsx(vt,{value:"overview",children:t("entity.detail.tab.overview")}),f.jsxs(vt,{value:"relations",children:[t("entity.detail.tab.relations"),u!==void 0&&` (${u})`]}),f.jsxs(vt,{value:"contents",children:[t("entity.detail.tab.contents"),g!==void 0&&` (${g})`]}),f.jsxs(vt,{value:"referrers",children:[t("entity.detail.tab.referrers"),d!==void 0&&` (${d})`]}),f.jsx(vt,{value:"neighbors",children:t("entity.detail.tab.neighbors")})]})}),f.jsxs("div",{className:"mt-4 flex-1",children:[f.jsx(_t,{value:"overview",children:f.jsx(zn,{data:b,atoms:h})}),f.jsx(_t,{value:"relations",children:f.jsx(Kn,{entityId:n.id})}),f.jsx(_t,{value:"contents",children:f.jsx(Un,{entityId:n.id})}),f.jsx(_t,{value:"referrers",children:f.jsx(Wn,{entityId:n.id})}),f.jsx(_t,{value:"neighbors",children:f.jsx(ua,{entityId:n.id,centerNode:{id:n.id,name:n.name,type:n.type,...n.kind?{kind:n.kind}:{}}})})]})]})]})}export{xa as EntityDetail};
@@ -0,0 +1 @@
1
+ import{a as n,b as a,j as e,E as i}from"./index-BLskFmu3.js";function r(){const{t:s}=n(),{entityId:t}=a();return t?e.jsx("div",{className:"flex flex-1 flex-col p-4 md:p-6",children:e.jsx(i,{entityId:t})}):e.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:e.jsx("p",{className:"text-sm text-c4a-text-muted",children:s("common.loading")})})}export{r as EntityDetail};
@@ -0,0 +1,3 @@
1
+ import{i as Ge,j as f,r as R,b as lt,a as Ut,d as Tt,E as Ct,c as Nn,A as jn,T as kn,e as An,f as vt,h as _t}from"./index-BoqItESG.js";import{J as Ke,i as Ue,R as We,B as W,c as de,s as ht,D as En}from"./JsonTree-Dd_iNoWA.js";import{C as Sn}from"./ContentCard-_I22pq8z.js";const Mn=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],Tn=Ge("git-fork",Mn);const Cn=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],$n=Ge("grid-3x3",Cn),je={entities:"Entities",behaviors:"Behaviors",roles:"Roles",attributes:"Attributes",states:"States",transitions:"Transitions",events:"Events",rules:"Rules",constraints:"Constraints",decisions:"Decisions",metrics:"Metrics",claims:"Claims",relations:"Relations",comparisons:"Comparisons",boundaries:"Boundaries"};function zn({data:t,atoms:e}){return f.jsxs("div",{className:"space-y-4",children:[t&&Object.keys(t).length>0&&f.jsx("div",{children:f.jsx(Ke,{data:t,defaultExpanded:2})}),e&&f.jsx(Rn,{atoms:e})]})}function Rn({atoms:t}){const e=Object.keys(je);return f.jsx("div",{className:"space-y-2",children:e.map(n=>{const r=t[n];return!r||r.length===0?null:f.jsx(In,{type:n,label:je[n]??n,items:r},n)})})}function In({type:t,label:e,items:n}){const[r,i]=R.useState(!0);return f.jsxs("details",{open:r,onToggle:s=>i(s.target.open),children:[f.jsxs("summary",{className:"cursor-pointer font-mono text-xs uppercase text-c4a-text-secondary hover:text-c4a-text-primary py-1.5",children:[e," (",n.length,")"]}),f.jsx("div",{className:"pl-4 pb-2",children:f.jsx(Dn,{type:t,items:n})})]})}function Dn({type:t,items:e}){switch(t){case"entities":case"behaviors":case"events":case"relations":return f.jsx(ke,{items:e});case"roles":return f.jsx(Pn,{items:e});case"attributes":return f.jsx(Fn,{items:e});case"states":return f.jsx(Ln,{items:e});case"transitions":return f.jsx(Hn,{items:e});case"rules":case"constraints":return f.jsx(On,{items:e});case"decisions":return f.jsx(Xn,{items:e});case"metrics":return f.jsx(Yn,{items:e});case"claims":return f.jsx(Bn,{items:e});case"comparisons":return f.jsx(Vn,{items:e});case"boundaries":return f.jsx(qn,{items:e});default:return f.jsx(ke,{items:e})}}function tt({value:t}){const{t:e}=lt(),n=de(t);return n?f.jsx(W,{variant:n.variant,tooltip:`confidence: ${n.value}`,children:e(n.labelKey)}):null}function ke({items:t}){return f.jsx("div",{className:"space-y-1",children:t.map((e,n)=>f.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.ref&&Ue(e.ref)?f.jsx(We,{pointer:e.ref}):f.jsx("span",{className:"text-c4a-text-primary",children:e.name??String(e)}),f.jsx(tt,{value:e.confidence})]},n))})}function Pn({items:t}){return f.jsx("div",{className:"space-y-1.5",children:t.map((e,n)=>f.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[f.jsx(W,{variant:"accent",children:e.name??"role"}),!!e.performs&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"text-c4a-text-muted",children:"performs"}),Ue(String(e.performs))?f.jsx(We,{pointer:String(e.performs)}):f.jsx("span",{className:"text-c4a-text-primary",children:String(e.performs)})]}),f.jsx(tt,{value:e.confidence})]},n))})}function Fn({items:t}){return f.jsx("div",{className:"space-y-1",children:t.map((e,n)=>f.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[f.jsxs("span",{className:"text-c4a-text-secondary font-mono",children:[e.name,":"]}),f.jsx("span",{className:"text-c4a-text-primary",children:String(e.value??"")}),f.jsx(tt,{value:e.confidence})]},n))})}function Ln({items:t}){return f.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.map((e,n)=>f.jsxs("span",{className:"inline-flex items-center gap-1",children:[f.jsx(W,{children:e.name??String(e)}),f.jsx(tt,{value:e.confidence})]},n))})}function Hn({items:t}){return f.jsx("div",{className:"space-y-1.5",children:t.map((e,n)=>{const r=e;return f.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[f.jsx(W,{variant:"muted",children:String(r.from_state??"?")}),f.jsx("span",{className:"text-c4a-text-muted",children:"→"}),f.jsx(W,{variant:"muted",children:String(r.to_state??"?")}),!!r.trigger&&f.jsx("span",{className:"text-c4a-text-muted italic",children:String(r.trigger)}),f.jsx(tt,{value:e.confidence})]},n)})})}function On({items:t}){return f.jsx("div",{className:"space-y-1.5",children:t.map((e,n)=>{const r=e;return f.jsx("div",{className:"text-xs",children:f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"text-c4a-warning font-mono font-bold",children:"IF"}),f.jsx("span",{className:"text-c4a-text-primary",children:String(r.condition??r.name??"")}),f.jsx("span",{className:"text-c4a-accent font-mono font-bold",children:"THEN"}),f.jsx("span",{className:"text-c4a-text-primary",children:String(r.conclusion??r.description??"")}),f.jsx(tt,{value:e.confidence})]})},n)})})}function Xn({items:t}){return f.jsx("div",{className:"space-y-1.5",children:t.map((e,n)=>f.jsxs("div",{className:"text-xs",children:[f.jsx("span",{className:"text-c4a-text-primary font-mono",children:e.name}),e.description&&f.jsx("span",{className:"text-c4a-text-muted ml-2",children:e.description}),f.jsx(tt,{value:e.confidence})]},n))})}function Yn({items:t}){return f.jsx("div",{className:"space-y-1",children:t.map((e,n)=>{const r=e;return f.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[f.jsx("span",{className:"text-c4a-text-primary font-mono",children:e.name}),!!r.unit&&f.jsx("span",{className:"text-c4a-text-muted",children:String(r.unit)}),!!r.threshold&&f.jsxs("span",{className:"text-c4a-text-secondary",children:["< ",String(r.threshold)]}),f.jsx(tt,{value:e.confidence})]},n)})})}function Bn({items:t}){return f.jsx("div",{className:"space-y-1.5",children:t.map((e,n)=>{const r=e;return f.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[!!r.claim_type&&f.jsx(W,{variant:"warning",children:String(r.claim_type)}),f.jsx("span",{className:"text-c4a-text-primary",children:e.description??e.name}),!!r.valid_from&&f.jsxs("span",{className:"text-c4a-text-muted",children:[String(r.valid_from)," 起"]}),f.jsx(tt,{value:e.confidence})]},n)})})}function Vn({items:t}){return f.jsx("div",{className:"space-y-3",children:t.map((e,n)=>{const r=e,i=r.criteria,s=r.options;return!i||!s?f.jsx("div",{className:"text-xs text-c4a-text-muted",children:f.jsx(Ke,{data:e,defaultExpanded:1})},n):f.jsx("div",{className:"rounded border border-c4a-border-subtle overflow-auto",children:f.jsxs("table",{className:"w-full text-xs font-mono",children:[f.jsx("thead",{children:f.jsxs("tr",{className:"border-b border-c4a-border-subtle bg-c4a-bg-surface text-c4a-text-muted",children:[f.jsx("th",{className:"px-2 py-1 text-left",children:"Criteria"}),s.map((o,a)=>f.jsx("th",{className:"px-2 py-1 text-left",children:String(o.name??`Option ${a+1}`)},a))]})}),f.jsx("tbody",{children:i.map((o,a)=>f.jsxs("tr",{className:"border-b border-c4a-border-subtle",children:[f.jsx("td",{className:"px-2 py-1 text-c4a-text-secondary",children:o}),s.map((l,c)=>{const u=l.values;return f.jsx("td",{className:"px-2 py-1 text-c4a-text-primary",children:u?.[a]??"—"},c)})]},a))})]})},n)})})}function qn({items:t}){return f.jsx("div",{className:"space-y-1",children:t.map((e,n)=>{const r=e,i=r.included!==!1&&r.type!=="exclude";return f.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[f.jsx("span",{className:i?"text-c4a-success":"text-c4a-error",children:i?"✓ 包含":"✗ 排除"}),f.jsx("span",{className:"text-c4a-text-primary",children:e.name??e.description}),f.jsx(tt,{value:e.confidence})]},n)})})}function Gn({relation:t}){const e=Ut(),{t:n}=lt(),r=de(t.confidence),i=t.direction==="incoming"?"←":"→";return f.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded hover:bg-c4a-bg-hover cursor-pointer transition-colors",onClick:()=>e(ht.relation(t.id)),children:[f.jsx(W,{variant:"accent",children:t.type}),f.jsx("span",{className:"text-xs font-mono text-c4a-accent hover:underline cursor-pointer truncate",onClick:s=>{s.stopPropagation(),e(ht.entity(t.from.id))},children:t.from.name}),f.jsx("span",{className:"text-c4a-text-muted text-xs shrink-0",children:i}),f.jsx("span",{className:"text-xs font-mono text-c4a-accent hover:underline cursor-pointer truncate",onClick:s=>{s.stopPropagation(),e(ht.entity(t.to.id))},children:t.to.name}),t.weight!==void 0&&f.jsxs("span",{className:"text-xs text-c4a-text-muted ml-auto shrink-0",children:["w: ",t.weight]}),r&&f.jsx(W,{variant:r.variant,tooltip:`confidence: ${r.value}`,children:n(r.labelKey)})]})}function Kn({entityId:t}){const{t:e}=lt(),[n,r]=R.useState([]),[i,s]=R.useState(!1),[o,a]=R.useState("both"),[l,c]=R.useState(""),[u,g]=R.useState([]);return R.useEffect(()=>{const d={};o!=="both"&&(d.direction=o),l&&(d.type=l),Tt.get(`/entities/${t}/relations`,d).then(h=>{if(r(h.relations),u.length===0){const b=[...new Set(h.relations.map(y=>y.type))];g(b)}s(!0)}).catch(()=>{s(!0)})},[t,o,l]),i?n.length===0?f.jsx(Ct,{title:e("common.empty.entity_relations.title"),description:e("common.empty.entity_relations.description")}):f.jsxs("div",{children:[f.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[f.jsxs("select",{value:o,onChange:d=>a(d.target.value),className:"bg-c4a-bg-surface border border-c4a-border-subtle rounded px-2 py-1 text-xs font-mono text-c4a-text-secondary",children:[f.jsx("option",{value:"both",children:e("relation.filter.direction.all")}),f.jsx("option",{value:"outgoing",children:e("relation.filter.direction.outgoing")}),f.jsx("option",{value:"incoming",children:e("relation.filter.direction.incoming")})]}),u.length>1&&f.jsxs("select",{value:l,onChange:d=>c(d.target.value),className:"bg-c4a-bg-surface border border-c4a-border-subtle rounded px-2 py-1 text-xs font-mono text-c4a-text-secondary",children:[f.jsx("option",{value:"",children:e("relation.filter.type.all")}),u.map(d=>f.jsx("option",{value:d,children:d},d))]})]}),f.jsx("div",{className:"space-y-1",children:n.map(d=>f.jsx(Gn,{relation:d},d.id))})]}):f.jsx("p",{className:"text-sm text-c4a-text-muted",children:e("common.loading")})}function Un({entityId:t}){const{t:e}=lt(),[n,r]=R.useState([]),[i,s]=R.useState(!1);return R.useEffect(()=>{Tt.get(`/entities/${t}/contents`).then(o=>{r(o.contents??[]),s(!0)}).catch(()=>s(!0))},[t]),i?n.length===0?f.jsx(Ct,{title:e("common.empty.entity_contents.title"),description:e("common.empty.entity_contents.description")}):f.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:n.map(o=>f.jsx(Sn,{content:o},o.hash_id))}):f.jsx("p",{className:"text-sm text-c4a-text-muted",children:e("common.loading")})}function Wn({entityId:t}){const{t:e}=lt(),n=Ut(),[r,i]=R.useState([]),[s,o]=R.useState(!1);return R.useEffect(()=>{Tt.get(`/entities/${t}/referrers`).then(a=>{i(a.referrers??[]),o(!0)}).catch(()=>o(!0))},[t]),s?r.length===0?f.jsx(Ct,{title:e("common.empty.entity_referrers.title"),description:e("common.empty.entity_referrers.description")}):f.jsx("div",{className:"space-y-1",children:r.map(a=>f.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded hover:bg-c4a-bg-hover cursor-pointer transition-colors",onClick:()=>n(ht.entity(a.id)),children:[f.jsx("span",{className:"text-xs font-mono text-c4a-accent hover:underline truncate",children:a.name}),f.jsx("span",{className:"text-xs text-c4a-text-muted shrink-0",children:a.type}),f.jsx("span",{className:"text-xs text-c4a-text-muted font-mono ml-auto shrink-0",children:a.ref_field}),f.jsxs("span",{className:"text-xs text-c4a-text-muted shrink-0",children:["(",a.ref_type,")"]})]},`${a.id}-${a.ref_field}`))}):f.jsx("p",{className:"text-sm text-c4a-text-muted",children:e("common.loading")})}function Qn(t,e){var n,r=1;t==null&&(t=0),e==null&&(e=0);function i(){var s,o=n.length,a,l=0,c=0;for(s=0;s<o;++s)a=n[s],l+=a.x,c+=a.y;for(l=(l/o-t)*r,c=(c/o-e)*r,s=0;s<o;++s)a=n[s],a.x-=l,a.y-=c}return i.initialize=function(s){n=s},i.x=function(s){return arguments.length?(t=+s,i):t},i.y=function(s){return arguments.length?(e=+s,i):e},i.strength=function(s){return arguments.length?(r=+s,i):r},i}function Jn(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return Qe(this.cover(e,n),e,n,t)}function Qe(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,s=t._root,o={data:r},a=t._x0,l=t._y0,c=t._x1,u=t._y1,g,d,h,b,y,v,m,N;if(!s)return t._root=o,t;for(;s.length;)if((y=e>=(g=(a+c)/2))?a=g:c=g,(v=n>=(d=(l+u)/2))?l=d:u=d,i=s,!(s=s[m=v<<1|y]))return i[m]=o,t;if(h=+t._x.call(null,s.data),b=+t._y.call(null,s.data),e===h&&n===b)return o.next=s,i?i[m]=o:t._root=o,t;do i=i?i[m]=new Array(4):t._root=new Array(4),(y=e>=(g=(a+c)/2))?a=g:c=g,(v=n>=(d=(l+u)/2))?l=d:u=d;while((m=v<<1|y)===(N=(b>=d)<<1|h>=g));return i[N]=s,i[m]=o,t}function Zn(t){var e,n,r=t.length,i,s,o=new Array(r),a=new Array(r),l=1/0,c=1/0,u=-1/0,g=-1/0;for(n=0;n<r;++n)isNaN(i=+this._x.call(null,e=t[n]))||isNaN(s=+this._y.call(null,e))||(o[n]=i,a[n]=s,i<l&&(l=i),i>u&&(u=i),s<c&&(c=s),s>g&&(g=s));if(l>u||c>g)return this;for(this.cover(l,c).cover(u,g),n=0;n<r;++n)Qe(this,o[n],a[n],t[n]);return this}function tr(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,s=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,s=(r=Math.floor(e))+1;else{for(var o=i-n||1,a=this._root,l,c;n>t||t>=i||r>e||e>=s;)switch(c=(e<r)<<1|t<n,l=new Array(4),l[c]=a,a=l,o*=2,c){case 0:i=n+o,s=r+o;break;case 1:n=i-o,s=r+o;break;case 2:i=n+o,r=s-o;break;case 3:n=i-o,r=s-o;break}this._root&&this._root.length&&(this._root=a)}return this._x0=n,this._y0=r,this._x1=i,this._y1=s,this}function er(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t}function nr(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function L(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function rr(t,e,n){var r,i=this._x0,s=this._y0,o,a,l,c,u=this._x1,g=this._y1,d=[],h=this._root,b,y;for(h&&d.push(new L(h,i,s,u,g)),n==null?n=1/0:(i=t-n,s=e-n,u=t+n,g=e+n,n*=n);b=d.pop();)if(!(!(h=b.node)||(o=b.x0)>u||(a=b.y0)>g||(l=b.x1)<i||(c=b.y1)<s))if(h.length){var v=(o+l)/2,m=(a+c)/2;d.push(new L(h[3],v,m,l,c),new L(h[2],o,m,v,c),new L(h[1],v,a,l,m),new L(h[0],o,a,v,m)),(y=(e>=m)<<1|t>=v)&&(b=d[d.length-1],d[d.length-1]=d[d.length-1-y],d[d.length-1-y]=b)}else{var N=t-+this._x.call(null,h.data),x=e-+this._y.call(null,h.data),w=N*N+x*x;if(w<n){var S=Math.sqrt(n=w);i=t-S,s=e-S,u=t+S,g=e+S,r=h.data}}return r}function ir(t){if(isNaN(u=+this._x.call(null,t))||isNaN(g=+this._y.call(null,t)))return this;var e,n=this._root,r,i,s,o=this._x0,a=this._y0,l=this._x1,c=this._y1,u,g,d,h,b,y,v,m;if(!n)return this;if(n.length)for(;;){if((b=u>=(d=(o+l)/2))?o=d:l=d,(y=g>=(h=(a+c)/2))?a=h:c=h,e=n,!(n=n[v=y<<1|b]))return this;if(!n.length)break;(e[v+1&3]||e[v+2&3]||e[v+3&3])&&(r=e,m=v)}for(;n.data!==t;)if(i=n,!(n=n.next))return this;return(s=n.next)&&delete n.next,i?(s?i.next=s:delete i.next,this):e?(s?e[v]=s:delete e[v],(n=e[0]||e[1]||e[2]||e[3])&&n===(e[3]||e[2]||e[1]||e[0])&&!n.length&&(r?r[m]=n:this._root=n),this):(this._root=s,this)}function sr(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function or(){return this._root}function ar(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t}function cr(t){var e=[],n,r=this._root,i,s,o,a,l;for(r&&e.push(new L(r,this._x0,this._y0,this._x1,this._y1));n=e.pop();)if(!t(r=n.node,s=n.x0,o=n.y0,a=n.x1,l=n.y1)&&r.length){var c=(s+a)/2,u=(o+l)/2;(i=r[3])&&e.push(new L(i,c,u,a,l)),(i=r[2])&&e.push(new L(i,s,u,c,l)),(i=r[1])&&e.push(new L(i,c,o,a,u)),(i=r[0])&&e.push(new L(i,s,o,c,u))}return this}function lr(t){var e=[],n=[],r;for(this._root&&e.push(new L(this._root,this._x0,this._y0,this._x1,this._y1));r=e.pop();){var i=r.node;if(i.length){var s,o=r.x0,a=r.y0,l=r.x1,c=r.y1,u=(o+l)/2,g=(a+c)/2;(s=i[0])&&e.push(new L(s,o,a,u,g)),(s=i[1])&&e.push(new L(s,u,a,l,g)),(s=i[2])&&e.push(new L(s,o,g,u,c)),(s=i[3])&&e.push(new L(s,u,g,l,c))}n.push(r)}for(;r=n.pop();)t(r.node,r.x0,r.y0,r.x1,r.y1);return this}function ur(t){return t[0]}function fr(t){return arguments.length?(this._x=t,this):this._x}function hr(t){return t[1]}function dr(t){return arguments.length?(this._y=t,this):this._y}function pe(t,e,n){var r=new xe(e??ur,n??hr,NaN,NaN,NaN,NaN);return t==null?r:r.addAll(t)}function xe(t,e,n,r,i,s){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=s,this._root=void 0}function Ae(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var H=pe.prototype=xe.prototype;H.copy=function(){var t=new xe(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,n,r;if(!e)return t;if(!e.length)return t._root=Ae(e),t;for(n=[{source:e,target:t._root=new Array(4)}];e=n.pop();)for(var i=0;i<4;++i)(r=e.source[i])&&(r.length?n.push({source:r,target:e.target[i]=new Array(4)}):e.target[i]=Ae(r));return t};H.add=Jn;H.addAll=Zn;H.cover=tr;H.data=er;H.extent=nr;H.find=rr;H.remove=ir;H.removeAll=sr;H.root=or;H.size=ar;H.visit=cr;H.visitAfter=lr;H.x=fr;H.y=dr;function dt(t){return function(){return t}}function ct(t){return(t()-.5)*1e-6}function pr(t){return t.x+t.vx}function xr(t){return t.y+t.vy}function mr(t){var e,n,r,i=1,s=1;typeof t!="function"&&(t=dt(t==null?1:+t));function o(){for(var c,u=e.length,g,d,h,b,y,v,m=0;m<s;++m)for(g=pe(e,pr,xr).visitAfter(a),c=0;c<u;++c)d=e[c],y=n[d.index],v=y*y,h=d.x+d.vx,b=d.y+d.vy,g.visit(N);function N(x,w,S,T,I){var C=x.data,D=x.r,$=y+D;if(C){if(C.index>d.index){var Y=h-C.x-C.vx,B=b-C.y-C.vy,O=Y*Y+B*B;O<$*$&&(Y===0&&(Y=ct(r),O+=Y*Y),B===0&&(B=ct(r),O+=B*B),O=($-(O=Math.sqrt(O)))/O*i,d.vx+=(Y*=O)*($=(D*=D)/(v+D)),d.vy+=(B*=O)*$,C.vx-=Y*($=1-$),C.vy-=B*$)}return}return w>h+$||T<h-$||S>b+$||I<b-$}}function a(c){if(c.data)return c.r=n[c.data.index];for(var u=c.r=0;u<4;++u)c[u]&&c[u].r>c.r&&(c.r=c[u].r)}function l(){if(e){var c,u=e.length,g;for(n=new Array(u),c=0;c<u;++c)g=e[c],n[g.index]=+t(g,c,e)}}return o.initialize=function(c,u){e=c,r=u,l()},o.iterations=function(c){return arguments.length?(s=+c,o):s},o.strength=function(c){return arguments.length?(i=+c,o):i},o.radius=function(c){return arguments.length?(t=typeof c=="function"?c:dt(+c),l(),o):t},o}function gr(t){return t.index}function Ee(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function yr(t){var e=gr,n=g,r,i=dt(30),s,o,a,l,c,u=1;t==null&&(t=[]);function g(v){return 1/Math.min(a[v.source.index],a[v.target.index])}function d(v){for(var m=0,N=t.length;m<u;++m)for(var x=0,w,S,T,I,C,D,$;x<N;++x)w=t[x],S=w.source,T=w.target,I=T.x+T.vx-S.x-S.vx||ct(c),C=T.y+T.vy-S.y-S.vy||ct(c),D=Math.sqrt(I*I+C*C),D=(D-s[x])/D*v*r[x],I*=D,C*=D,T.vx-=I*($=l[x]),T.vy-=C*$,S.vx+=I*($=1-$),S.vy+=C*$}function h(){if(o){var v,m=o.length,N=t.length,x=new Map(o.map((S,T)=>[e(S,T,o),S])),w;for(v=0,a=new Array(m);v<N;++v)w=t[v],w.index=v,typeof w.source!="object"&&(w.source=Ee(x,w.source)),typeof w.target!="object"&&(w.target=Ee(x,w.target)),a[w.source.index]=(a[w.source.index]||0)+1,a[w.target.index]=(a[w.target.index]||0)+1;for(v=0,l=new Array(N);v<N;++v)w=t[v],l[v]=a[w.source.index]/(a[w.source.index]+a[w.target.index]);r=new Array(N),b(),s=new Array(N),y()}}function b(){if(o)for(var v=0,m=t.length;v<m;++v)r[v]=+n(t[v],v,t)}function y(){if(o)for(var v=0,m=t.length;v<m;++v)s[v]=+i(t[v],v,t)}return d.initialize=function(v,m){o=v,c=m,h()},d.links=function(v){return arguments.length?(t=v,h(),d):t},d.id=function(v){return arguments.length?(e=v,d):e},d.iterations=function(v){return arguments.length?(u=+v,d):u},d.strength=function(v){return arguments.length?(n=typeof v=="function"?v:dt(+v),b(),d):n},d.distance=function(v){return arguments.length?(i=typeof v=="function"?v:dt(+v),y(),d):i},d}var vr={value:()=>{}};function Wt(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Lt(n)}function Lt(t){this._=t}function _r(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Lt.prototype=Wt.prototype={constructor:Lt,on:function(t,e){var n=this._,r=_r(t+"",n),i,s=-1,o=r.length;if(arguments.length<2){for(;++s<o;)if((i=(t=r[s]).type)&&(i=wr(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<o;)if(i=(t=r[s]).type)n[i]=Se(n[i],t.name,e);else if(e==null)for(i in n)n[i]=Se(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Lt(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],r=0,i=s.length;r<i;++r)s[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,s=r.length;i<s;++i)r[i].value.apply(e,n)}};function wr(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function Se(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=vr,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var gt=0,jt=0,wt=0,Je=1e3,Yt,kt,Bt=0,xt=0,Qt=0,At=typeof performance=="object"&&performance.now?performance:Date,Ze=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function me(){return xt||(Ze(br),xt=At.now()+Qt)}function br(){xt=0}function Vt(){this._call=this._time=this._next=null}Vt.prototype=ge.prototype={constructor:Vt,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?me():+n)+(e==null?0:+e),!this._next&&kt!==this&&(kt?kt._next=this:Yt=this,kt=this),this._call=t,this._time=n,ie()},stop:function(){this._call&&(this._call=null,this._time=1/0,ie())}};function ge(t,e,n){var r=new Vt;return r.restart(t,e,n),r}function Nr(){me(),++gt;for(var t=Yt,e;t;)(e=xt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--gt}function Me(){xt=(Bt=At.now())+Qt,gt=jt=0;try{Nr()}finally{gt=0,kr(),xt=0}}function jr(){var t=At.now(),e=t-Bt;e>Je&&(Qt-=e,Bt=t)}function kr(){for(var t,e=Yt,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Yt=n);kt=t,ie(r)}function ie(t){if(!gt){jt&&(jt=clearTimeout(jt));var e=t-xt;e>24?(t<1/0&&(jt=setTimeout(Me,t-At.now()-Qt)),wt&&(wt=clearInterval(wt))):(wt||(Bt=At.now(),wt=setInterval(jr,Je)),gt=1,Ze(Me))}}function Te(t,e,n){var r=new Vt;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}const Ar=1664525,Er=1013904223,Ce=4294967296;function Sr(){let t=1;return()=>(t=(Ar*t+Er)%Ce)/Ce}function Mr(t){return t.x}function Tr(t){return t.y}var Cr=10,$r=Math.PI*(3-Math.sqrt(5));function zr(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),s=0,o=.6,a=new Map,l=ge(g),c=Wt("tick","end"),u=Sr();t==null&&(t=[]);function g(){d(),c.call("tick",e),n<r&&(l.stop(),c.call("end",e))}function d(y){var v,m=t.length,N;y===void 0&&(y=1);for(var x=0;x<y;++x)for(n+=(s-n)*i,a.forEach(function(w){w(n)}),v=0;v<m;++v)N=t[v],N.fx==null?N.x+=N.vx*=o:(N.x=N.fx,N.vx=0),N.fy==null?N.y+=N.vy*=o:(N.y=N.fy,N.vy=0);return e}function h(){for(var y=0,v=t.length,m;y<v;++y){if(m=t[y],m.index=y,m.fx!=null&&(m.x=m.fx),m.fy!=null&&(m.y=m.fy),isNaN(m.x)||isNaN(m.y)){var N=Cr*Math.sqrt(.5+y),x=y*$r;m.x=N*Math.cos(x),m.y=N*Math.sin(x)}(isNaN(m.vx)||isNaN(m.vy))&&(m.vx=m.vy=0)}}function b(y){return y.initialize&&y.initialize(t,u),y}return h(),e={tick:d,restart:function(){return l.restart(g),e},stop:function(){return l.stop(),e},nodes:function(y){return arguments.length?(t=y,h(),a.forEach(b),e):t},alpha:function(y){return arguments.length?(n=+y,e):n},alphaMin:function(y){return arguments.length?(r=+y,e):r},alphaDecay:function(y){return arguments.length?(i=+y,e):+i},alphaTarget:function(y){return arguments.length?(s=+y,e):s},velocityDecay:function(y){return arguments.length?(o=1-y,e):1-o},randomSource:function(y){return arguments.length?(u=y,a.forEach(b),e):u},force:function(y,v){return arguments.length>1?(v==null?a.delete(y):a.set(y,b(v)),e):a.get(y)},find:function(y,v,m){var N=0,x=t.length,w,S,T,I,C;for(m==null?m=1/0:m*=m,N=0;N<x;++N)I=t[N],w=y-I.x,S=v-I.y,T=w*w+S*S,T<m&&(C=I,m=T);return C},on:function(y,v){return arguments.length>1?(c.on(y,v),e):c.on(y)}}}function Rr(){var t,e,n,r,i=dt(-30),s,o=1,a=1/0,l=.81;function c(h){var b,y=t.length,v=pe(t,Mr,Tr).visitAfter(g);for(r=h,b=0;b<y;++b)e=t[b],v.visit(d)}function u(){if(t){var h,b=t.length,y;for(s=new Array(b),h=0;h<b;++h)y=t[h],s[y.index]=+i(y,h,t)}}function g(h){var b=0,y,v,m=0,N,x,w;if(h.length){for(N=x=w=0;w<4;++w)(y=h[w])&&(v=Math.abs(y.value))&&(b+=y.value,m+=v,N+=v*y.x,x+=v*y.y);h.x=N/m,h.y=x/m}else{y=h,y.x=y.data.x,y.y=y.data.y;do b+=s[y.data.index];while(y=y.next)}h.value=b}function d(h,b,y,v){if(!h.value)return!0;var m=h.x-e.x,N=h.y-e.y,x=v-b,w=m*m+N*N;if(x*x/l<w)return w<a&&(m===0&&(m=ct(n),w+=m*m),N===0&&(N=ct(n),w+=N*N),w<o&&(w=Math.sqrt(o*w)),e.vx+=m*h.value*r/w,e.vy+=N*h.value*r/w),!0;if(h.length||w>=a)return;(h.data!==e||h.next)&&(m===0&&(m=ct(n),w+=m*m),N===0&&(N=ct(n),w+=N*N),w<o&&(w=Math.sqrt(o*w)));do h.data!==e&&(x=s[h.data.index]*r/w,e.vx+=m*x,e.vy+=N*x);while(h=h.next)}return c.initialize=function(h,b){t=h,n=b,u()},c.strength=function(h){return arguments.length?(i=typeof h=="function"?h:dt(+h),u(),c):i},c.distanceMin=function(h){return arguments.length?(o=h*h,c):Math.sqrt(o)},c.distanceMax=function(h){return arguments.length?(a=h*h,c):Math.sqrt(a)},c.theta=function(h){return arguments.length?(l=h*h,c):Math.sqrt(l)},c}var se="http://www.w3.org/1999/xhtml";const $e={svg:"http://www.w3.org/2000/svg",xhtml:se,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Jt(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),$e.hasOwnProperty(e)?{space:$e[e],local:t}:t}function Ir(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===se&&e.documentElement.namespaceURI===se?e.createElement(t):e.createElementNS(n,t)}}function Dr(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function tn(t){var e=Jt(t);return(e.local?Dr:Ir)(e)}function Pr(){}function ye(t){return t==null?Pr:function(){return this.querySelector(t)}}function Fr(t){typeof t!="function"&&(t=ye(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var s=e[i],o=s.length,a=r[i]=new Array(o),l,c,u=0;u<o;++u)(l=s[u])&&(c=t.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new V(r,this._parents)}function Lr(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Hr(){return[]}function en(t){return t==null?Hr:function(){return this.querySelectorAll(t)}}function Or(t){return function(){return Lr(t.apply(this,arguments))}}function Xr(t){typeof t=="function"?t=Or(t):t=en(t);for(var e=this._groups,n=e.length,r=[],i=[],s=0;s<n;++s)for(var o=e[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&(r.push(t.call(l,l.__data__,c,o)),i.push(l));return new V(r,i)}function nn(t){return function(){return this.matches(t)}}function rn(t){return function(e){return e.matches(t)}}var Yr=Array.prototype.find;function Br(t){return function(){return Yr.call(this.children,t)}}function Vr(){return this.firstElementChild}function qr(t){return this.select(t==null?Vr:Br(typeof t=="function"?t:rn(t)))}var Gr=Array.prototype.filter;function Kr(){return Array.from(this.children)}function Ur(t){return function(){return Gr.call(this.children,t)}}function Wr(t){return this.selectAll(t==null?Kr:Ur(typeof t=="function"?t:rn(t)))}function Qr(t){typeof t!="function"&&(t=nn(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var s=e[i],o=s.length,a=r[i]=[],l,c=0;c<o;++c)(l=s[c])&&t.call(l,l.__data__,c,s)&&a.push(l);return new V(r,this._parents)}function sn(t){return new Array(t.length)}function Jr(){return new V(this._enter||this._groups.map(sn),this._parents)}function qt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}qt.prototype={constructor:qt,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Zr(t){return function(){return t}}function ti(t,e,n,r,i,s){for(var o=0,a,l=e.length,c=s.length;o<c;++o)(a=e[o])?(a.__data__=s[o],r[o]=a):n[o]=new qt(t,s[o]);for(;o<l;++o)(a=e[o])&&(i[o]=a)}function ei(t,e,n,r,i,s,o){var a,l,c=new Map,u=e.length,g=s.length,d=new Array(u),h;for(a=0;a<u;++a)(l=e[a])&&(d[a]=h=o.call(l,l.__data__,a,e)+"",c.has(h)?i[a]=l:c.set(h,l));for(a=0;a<g;++a)h=o.call(t,s[a],a,s)+"",(l=c.get(h))?(r[a]=l,l.__data__=s[a],c.delete(h)):n[a]=new qt(t,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(d[a])===l&&(i[a]=l)}function ni(t){return t.__data__}function ri(t,e){if(!arguments.length)return Array.from(this,ni);var n=e?ei:ti,r=this._parents,i=this._groups;typeof t!="function"&&(t=Zr(t));for(var s=i.length,o=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=r[c],g=i[c],d=g.length,h=ii(t.call(u,u&&u.__data__,c,r)),b=h.length,y=a[c]=new Array(b),v=o[c]=new Array(b),m=l[c]=new Array(d);n(u,g,y,v,m,h,e);for(var N=0,x=0,w,S;N<b;++N)if(w=y[N]){for(N>=x&&(x=N+1);!(S=v[x])&&++x<b;);w._next=S||null}}return o=new V(o,r),o._enter=a,o._exit=l,o}function ii(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function si(){return new V(this._exit||this._groups.map(sn),this._parents)}function oi(t,e,n){var r=this.enter(),i=this,s=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?s.remove():n(s),r&&i?r.merge(i).order():i}function ai(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,s=r.length,o=Math.min(i,s),a=new Array(i),l=0;l<o;++l)for(var c=n[l],u=r[l],g=c.length,d=a[l]=new Array(g),h,b=0;b<g;++b)(h=c[b]||u[b])&&(d[b]=h);for(;l<i;++l)a[l]=n[l];return new V(a,this._parents)}function ci(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],i=r.length-1,s=r[i],o;--i>=0;)(o=r[i])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function li(t){t||(t=ui);function e(g,d){return g&&d?t(g.__data__,d.__data__):!g-!d}for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s){for(var o=n[s],a=o.length,l=i[s]=new Array(a),c,u=0;u<a;++u)(c=o[u])&&(l[u]=c);l.sort(e)}return new V(i,this._parents).order()}function ui(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function fi(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function hi(){return Array.from(this)}function di(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,s=r.length;i<s;++i){var o=r[i];if(o)return o}return null}function pi(){let t=0;for(const e of this)++t;return t}function xi(){return!this.node()}function mi(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],s=0,o=i.length,a;s<o;++s)(a=i[s])&&t.call(a,a.__data__,s,i);return this}function gi(t){return function(){this.removeAttribute(t)}}function yi(t){return function(){this.removeAttributeNS(t.space,t.local)}}function vi(t,e){return function(){this.setAttribute(t,e)}}function _i(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function wi(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function bi(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Ni(t,e){var n=Jt(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?yi:gi:typeof e=="function"?n.local?bi:wi:n.local?_i:vi)(n,e))}function on(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ji(t){return function(){this.style.removeProperty(t)}}function ki(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Ai(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function Ei(t,e,n){return arguments.length>1?this.each((e==null?ji:typeof e=="function"?Ai:ki)(t,e,n??"")):yt(this.node(),t)}function yt(t,e){return t.style.getPropertyValue(e)||on(t).getComputedStyle(t,null).getPropertyValue(e)}function Si(t){return function(){delete this[t]}}function Mi(t,e){return function(){this[t]=e}}function Ti(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Ci(t,e){return arguments.length>1?this.each((e==null?Si:typeof e=="function"?Ti:Mi)(t,e)):this.node()[t]}function an(t){return t.trim().split(/^|\s+/)}function ve(t){return t.classList||new cn(t)}function cn(t){this._node=t,this._names=an(t.getAttribute("class")||"")}cn.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function ln(t,e){for(var n=ve(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function un(t,e){for(var n=ve(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function $i(t){return function(){ln(this,t)}}function zi(t){return function(){un(this,t)}}function Ri(t,e){return function(){(e.apply(this,arguments)?ln:un)(this,t)}}function Ii(t,e){var n=an(t+"");if(arguments.length<2){for(var r=ve(this.node()),i=-1,s=n.length;++i<s;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?Ri:e?$i:zi)(n,e))}function Di(){this.textContent=""}function Pi(t){return function(){this.textContent=t}}function Fi(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Li(t){return arguments.length?this.each(t==null?Di:(typeof t=="function"?Fi:Pi)(t)):this.node().textContent}function Hi(){this.innerHTML=""}function Oi(t){return function(){this.innerHTML=t}}function Xi(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Yi(t){return arguments.length?this.each(t==null?Hi:(typeof t=="function"?Xi:Oi)(t)):this.node().innerHTML}function Bi(){this.nextSibling&&this.parentNode.appendChild(this)}function Vi(){return this.each(Bi)}function qi(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Gi(){return this.each(qi)}function Ki(t){var e=typeof t=="function"?t:tn(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Ui(){return null}function Wi(t,e){var n=typeof t=="function"?t:tn(t),r=e==null?Ui:typeof e=="function"?e:ye(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Qi(){var t=this.parentNode;t&&t.removeChild(this)}function Ji(){return this.each(Qi)}function Zi(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ts(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function es(t){return this.select(t?ts:Zi)}function ns(t){return arguments.length?this.property("__data__",t):this.node().__data__}function rs(t){return function(e){t.call(this,e,this.__data__)}}function is(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function ss(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,s;n<i;++n)s=e[n],(!t.type||s.type===t.type)&&s.name===t.name?this.removeEventListener(s.type,s.listener,s.options):e[++r]=s;++r?e.length=r:delete this.__on}}}function os(t,e,n){return function(){var r=this.__on,i,s=rs(e);if(r){for(var o=0,a=r.length;o<a;++o)if((i=r[o]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=n),i.value=e;return}}this.addEventListener(t.type,s,n),i={type:t.type,name:t.name,value:e,listener:s,options:n},r?r.push(i):this.__on=[i]}}function as(t,e,n){var r=is(t+""),i,s=r.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(i=0,u=a[l];i<s;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(a=e?os:ss,i=0;i<s;++i)this.each(a(r[i],e,n));return this}function fn(t,e,n){var r=on(t),i=r.CustomEvent;typeof i=="function"?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function cs(t,e){return function(){return fn(this,t,e)}}function ls(t,e){return function(){return fn(this,t,e.apply(this,arguments))}}function us(t,e){return this.each((typeof e=="function"?ls:cs)(t,e))}function*fs(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,s=r.length,o;i<s;++i)(o=r[i])&&(yield o)}var hn=[null];function V(t,e){this._groups=t,this._parents=e}function $t(){return new V([[document.documentElement]],hn)}function hs(){return this}V.prototype=$t.prototype={constructor:V,select:Fr,selectAll:Xr,selectChild:qr,selectChildren:Wr,filter:Qr,data:ri,enter:Jr,exit:si,join:oi,merge:ai,selection:hs,order:ci,sort:li,call:fi,nodes:hi,node:di,size:pi,empty:xi,each:mi,attr:Ni,style:Ei,property:Ci,classed:Ii,text:Li,html:Yi,raise:Vi,lower:Gi,append:Ki,insert:Wi,remove:Ji,clone:es,datum:ns,on:as,dispatch:us,[Symbol.iterator]:fs};function q(t){return typeof t=="string"?new V([[document.querySelector(t)]],[document.documentElement]):new V([[t]],hn)}function ds(t){let e;for(;e=t.sourceEvent;)t=e;return t}function ut(t,e){if(t=ds(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}const oe={capture:!0,passive:!1};function ae(t){t.preventDefault(),t.stopImmediatePropagation()}function ps(t){var e=t.document.documentElement,n=q(t).on("dragstart.drag",ae,oe);"onselectstart"in e?n.on("selectstart.drag",ae,oe):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function xs(t,e){var n=t.document.documentElement,r=q(t).on("dragstart.drag",null);e&&(r.on("click.drag",ae,oe),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function _e(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function dn(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function zt(){}var Et=.7,Gt=1/Et,mt="\\s*([+-]?\\d+)\\s*",St="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Z="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ms=/^#([0-9a-f]{3,8})$/,gs=new RegExp(`^rgb\\(${mt},${mt},${mt}\\)$`),ys=new RegExp(`^rgb\\(${Z},${Z},${Z}\\)$`),vs=new RegExp(`^rgba\\(${mt},${mt},${mt},${St}\\)$`),_s=new RegExp(`^rgba\\(${Z},${Z},${Z},${St}\\)$`),ws=new RegExp(`^hsl\\(${St},${Z},${Z}\\)$`),bs=new RegExp(`^hsla\\(${St},${Z},${Z},${St}\\)$`),ze={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};_e(zt,Mt,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Re,formatHex:Re,formatHex8:Ns,formatHsl:js,formatRgb:Ie,toString:Ie});function Re(){return this.rgb().formatHex()}function Ns(){return this.rgb().formatHex8()}function js(){return pn(this).formatHsl()}function Ie(){return this.rgb().formatRgb()}function Mt(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=ms.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?De(e):n===3?new X(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Rt(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Rt(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=gs.exec(t))?new X(e[1],e[2],e[3],1):(e=ys.exec(t))?new X(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=vs.exec(t))?Rt(e[1],e[2],e[3],e[4]):(e=_s.exec(t))?Rt(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=ws.exec(t))?Le(e[1],e[2]/100,e[3]/100,1):(e=bs.exec(t))?Le(e[1],e[2]/100,e[3]/100,e[4]):ze.hasOwnProperty(t)?De(ze[t]):t==="transparent"?new X(NaN,NaN,NaN,0):null}function De(t){return new X(t>>16&255,t>>8&255,t&255,1)}function Rt(t,e,n,r){return r<=0&&(t=e=n=NaN),new X(t,e,n,r)}function ks(t){return t instanceof zt||(t=Mt(t)),t?(t=t.rgb(),new X(t.r,t.g,t.b,t.opacity)):new X}function ce(t,e,n,r){return arguments.length===1?ks(t):new X(t,e,n,r??1)}function X(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}_e(X,ce,dn(zt,{brighter(t){return t=t==null?Gt:Math.pow(Gt,t),new X(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Et:Math.pow(Et,t),new X(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new X(pt(this.r),pt(this.g),pt(this.b),Kt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Pe,formatHex:Pe,formatHex8:As,formatRgb:Fe,toString:Fe}));function Pe(){return`#${ft(this.r)}${ft(this.g)}${ft(this.b)}`}function As(){return`#${ft(this.r)}${ft(this.g)}${ft(this.b)}${ft((isNaN(this.opacity)?1:this.opacity)*255)}`}function Fe(){const t=Kt(this.opacity);return`${t===1?"rgb(":"rgba("}${pt(this.r)}, ${pt(this.g)}, ${pt(this.b)}${t===1?")":`, ${t})`}`}function Kt(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function pt(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ft(t){return t=pt(t),(t<16?"0":"")+t.toString(16)}function Le(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new U(t,e,n,r)}function pn(t){if(t instanceof U)return new U(t.h,t.s,t.l,t.opacity);if(t instanceof zt||(t=Mt(t)),!t)return new U;if(t instanceof U)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),s=Math.max(e,n,r),o=NaN,a=s-i,l=(s+i)/2;return a?(e===s?o=(n-r)/a+(n<r)*6:n===s?o=(r-e)/a+2:o=(e-n)/a+4,a/=l<.5?s+i:2-s-i,o*=60):a=l>0&&l<1?0:o,new U(o,a,l,t.opacity)}function Es(t,e,n,r){return arguments.length===1?pn(t):new U(t,e,n,r??1)}function U(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}_e(U,Es,dn(zt,{brighter(t){return t=t==null?Gt:Math.pow(Gt,t),new U(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Et:Math.pow(Et,t),new U(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new X(ee(t>=240?t-240:t+120,i,r),ee(t,i,r),ee(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new U(He(this.h),It(this.s),It(this.l),Kt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Kt(this.opacity);return`${t===1?"hsl(":"hsla("}${He(this.h)}, ${It(this.s)*100}%, ${It(this.l)*100}%${t===1?")":`, ${t})`}`}}));function He(t){return t=(t||0)%360,t<0?t+360:t}function It(t){return Math.max(0,Math.min(1,t||0))}function ee(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const xn=t=>()=>t;function Ss(t,e){return function(n){return t+n*e}}function Ms(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function Ts(t){return(t=+t)==1?mn:function(e,n){return n-e?Ms(e,n,t):xn(isNaN(e)?n:e)}}function mn(t,e){var n=e-t;return n?Ss(t,n):xn(isNaN(t)?e:t)}const Oe=(function t(e){var n=Ts(e);function r(i,s){var o=n((i=ce(i)).r,(s=ce(s)).r),a=n(i.g,s.g),l=n(i.b,s.b),c=mn(i.opacity,s.opacity);return function(u){return i.r=o(u),i.g=a(u),i.b=l(u),i.opacity=c(u),i+""}}return r.gamma=t,r})(1);function at(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var le=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ne=new RegExp(le.source,"g");function Cs(t){return function(){return t}}function $s(t){return function(e){return t(e)+""}}function zs(t,e){var n=le.lastIndex=ne.lastIndex=0,r,i,s,o=-1,a=[],l=[];for(t=t+"",e=e+"";(r=le.exec(t))&&(i=ne.exec(e));)(s=i.index)>n&&(s=e.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(r=r[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:at(r,i)})),n=ne.lastIndex;return n<e.length&&(s=e.slice(n),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?$s(l[0].x):Cs(e):(e=l.length,function(c){for(var u=0,g;u<e;++u)a[(g=l[u]).i]=g.x(c);return a.join("")})}var Xe=180/Math.PI,ue={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function gn(t,e,n,r,i,s){var o,a,l;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,l/=a),t*r<e*n&&(t=-t,e=-e,l=-l,o=-o),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*Xe,skewX:Math.atan(l)*Xe,scaleX:o,scaleY:a}}var Dt;function Rs(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?ue:gn(e.a,e.b,e.c,e.d,e.e,e.f)}function Is(t){return t==null||(Dt||(Dt=document.createElementNS("http://www.w3.org/2000/svg","g")),Dt.setAttribute("transform",t),!(t=Dt.transform.baseVal.consolidate()))?ue:(t=t.matrix,gn(t.a,t.b,t.c,t.d,t.e,t.f))}function yn(t,e,n,r){function i(c){return c.length?c.pop()+" ":""}function s(c,u,g,d,h,b){if(c!==g||u!==d){var y=h.push("translate(",null,e,null,n);b.push({i:y-4,x:at(c,g)},{i:y-2,x:at(u,d)})}else(g||d)&&h.push("translate("+g+e+d+n)}function o(c,u,g,d){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),d.push({i:g.push(i(g)+"rotate(",null,r)-2,x:at(c,u)})):u&&g.push(i(g)+"rotate("+u+r)}function a(c,u,g,d){c!==u?d.push({i:g.push(i(g)+"skewX(",null,r)-2,x:at(c,u)}):u&&g.push(i(g)+"skewX("+u+r)}function l(c,u,g,d,h,b){if(c!==g||u!==d){var y=h.push(i(h)+"scale(",null,",",null,")");b.push({i:y-4,x:at(c,g)},{i:y-2,x:at(u,d)})}else(g!==1||d!==1)&&h.push(i(h)+"scale("+g+","+d+")")}return function(c,u){var g=[],d=[];return c=t(c),u=t(u),s(c.translateX,c.translateY,u.translateX,u.translateY,g,d),o(c.rotate,u.rotate,g,d),a(c.skewX,u.skewX,g,d),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,g,d),c=u=null,function(h){for(var b=-1,y=d.length,v;++b<y;)g[(v=d[b]).i]=v.x(h);return g.join("")}}}var Ds=yn(Rs,"px, ","px)","deg)"),Ps=yn(Is,", ",")",")"),Fs=1e-12;function Ye(t){return((t=Math.exp(t))+1/t)/2}function Ls(t){return((t=Math.exp(t))-1/t)/2}function Hs(t){return((t=Math.exp(2*t))-1)/(t+1)}const Os=(function t(e,n,r){function i(s,o){var a=s[0],l=s[1],c=s[2],u=o[0],g=o[1],d=o[2],h=u-a,b=g-l,y=h*h+b*b,v,m;if(y<Fs)m=Math.log(d/c)/e,v=function(I){return[a+I*h,l+I*b,c*Math.exp(e*I*m)]};else{var N=Math.sqrt(y),x=(d*d-c*c+r*y)/(2*c*n*N),w=(d*d-c*c-r*y)/(2*d*n*N),S=Math.log(Math.sqrt(x*x+1)-x),T=Math.log(Math.sqrt(w*w+1)-w);m=(T-S)/e,v=function(I){var C=I*m,D=Ye(S),$=c/(n*N)*(D*Hs(e*C+S)-Ls(S));return[a+$*h,l+$*b,c*D/Ye(e*C+S)]}}return v.duration=m*1e3*e/Math.SQRT2,v}return i.rho=function(s){var o=Math.max(.001,+s),a=o*o,l=a*a;return t(o,a,l)},i})(Math.SQRT2,2,4);var Xs=Wt("start","end","cancel","interrupt"),Ys=[],vn=0,Be=1,fe=2,Ht=3,Ve=4,he=5,Ot=6;function Zt(t,e,n,r,i,s){var o=t.__transition;if(!o)t.__transition={};else if(n in o)return;Bs(t,n,{name:e,index:r,group:i,on:Xs,tween:Ys,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:vn})}function we(t,e){var n=Q(t,e);if(n.state>vn)throw new Error("too late; already scheduled");return n}function et(t,e){var n=Q(t,e);if(n.state>Ht)throw new Error("too late; already running");return n}function Q(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Bs(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=ge(s,0,n.time);function s(c){n.state=Be,n.timer.restart(o,n.delay,n.time),n.delay<=c&&o(c-n.delay)}function o(c){var u,g,d,h;if(n.state!==Be)return l();for(u in r)if(h=r[u],h.name===n.name){if(h.state===Ht)return Te(o);h.state===Ve?(h.state=Ot,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete r[u]):+u<e&&(h.state=Ot,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete r[u])}if(Te(function(){n.state===Ht&&(n.state=Ve,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=fe,n.on.call("start",t,t.__data__,n.index,n.group),n.state===fe){for(n.state=Ht,i=new Array(d=n.tween.length),u=0,g=-1;u<d;++u)(h=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(i[++g]=h);i.length=g+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=he,1),g=-1,d=i.length;++g<d;)i[g].call(t,u);n.state===he&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){n.state=Ot,n.timer.stop(),delete r[e];for(var c in r)return;delete t.__transition}}function Xt(t,e){var n=t.__transition,r,i,s=!0,o;if(n){e=e==null?null:e+"";for(o in n){if((r=n[o]).name!==e){s=!1;continue}i=r.state>fe&&r.state<he,r.state=Ot,r.timer.stop(),r.on.call(i?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[o]}s&&delete t.__transition}}function Vs(t){return this.each(function(){Xt(this,t)})}function qs(t,e){var n,r;return function(){var i=et(this,t),s=i.tween;if(s!==n){r=n=s;for(var o=0,a=r.length;o<a;++o)if(r[o].name===e){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Gs(t,e,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=et(this,t),o=s.tween;if(o!==r){i=(r=o).slice();for(var a={name:e,value:n},l=0,c=i.length;l<c;++l)if(i[l].name===e){i[l]=a;break}l===c&&i.push(a)}s.tween=i}}function Ks(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=Q(this.node(),n).tween,i=0,s=r.length,o;i<s;++i)if((o=r[i]).name===t)return o.value;return null}return this.each((e==null?qs:Gs)(n,t,e))}function be(t,e,n){var r=t._id;return t.each(function(){var i=et(this,r);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return Q(i,r).value[e]}}function _n(t,e){var n;return(typeof e=="number"?at:e instanceof Mt?Oe:(n=Mt(e))?(e=n,Oe):zs)(t,e)}function Us(t){return function(){this.removeAttribute(t)}}function Ws(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Qs(t,e,n){var r,i=n+"",s;return function(){var o=this.getAttribute(t);return o===i?null:o===r?s:s=e(r=o,n)}}function Js(t,e,n){var r,i=n+"",s;return function(){var o=this.getAttributeNS(t.space,t.local);return o===i?null:o===r?s:s=e(r=o,n)}}function Zs(t,e,n){var r,i,s;return function(){var o,a=n(this),l;return a==null?void this.removeAttribute(t):(o=this.getAttribute(t),l=a+"",o===l?null:o===r&&l===i?s:(i=l,s=e(r=o,a)))}}function to(t,e,n){var r,i,s;return function(){var o,a=n(this),l;return a==null?void this.removeAttributeNS(t.space,t.local):(o=this.getAttributeNS(t.space,t.local),l=a+"",o===l?null:o===r&&l===i?s:(i=l,s=e(r=o,a)))}}function eo(t,e){var n=Jt(t),r=n==="transform"?Ps:_n;return this.attrTween(t,typeof e=="function"?(n.local?to:Zs)(n,r,be(this,"attr."+t,e)):e==null?(n.local?Ws:Us)(n):(n.local?Js:Qs)(n,r,e))}function no(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function ro(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function io(t,e){var n,r;function i(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&ro(t,s)),n}return i._value=e,i}function so(t,e){var n,r;function i(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&no(t,s)),n}return i._value=e,i}function oo(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=Jt(t);return this.tween(n,(r.local?io:so)(r,e))}function ao(t,e){return function(){we(this,t).delay=+e.apply(this,arguments)}}function co(t,e){return e=+e,function(){we(this,t).delay=e}}function lo(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?ao:co)(e,t)):Q(this.node(),e).delay}function uo(t,e){return function(){et(this,t).duration=+e.apply(this,arguments)}}function fo(t,e){return e=+e,function(){et(this,t).duration=e}}function ho(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?uo:fo)(e,t)):Q(this.node(),e).duration}function po(t,e){if(typeof e!="function")throw new Error;return function(){et(this,t).ease=e}}function xo(t){var e=this._id;return arguments.length?this.each(po(e,t)):Q(this.node(),e).ease}function mo(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;et(this,t).ease=n}}function go(t){if(typeof t!="function")throw new Error;return this.each(mo(this._id,t))}function yo(t){typeof t!="function"&&(t=nn(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var s=e[i],o=s.length,a=r[i]=[],l,c=0;c<o;++c)(l=s[c])&&t.call(l,l.__data__,c,s)&&a.push(l);return new ot(r,this._parents,this._name,this._id)}function vo(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,s=Math.min(r,i),o=new Array(r),a=0;a<s;++a)for(var l=e[a],c=n[a],u=l.length,g=o[a]=new Array(u),d,h=0;h<u;++h)(d=l[h]||c[h])&&(g[h]=d);for(;a<r;++a)o[a]=e[a];return new ot(o,this._parents,this._name,this._id)}function _o(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function wo(t,e,n){var r,i,s=_o(e)?we:et;return function(){var o=s(this,t),a=o.on;a!==r&&(i=(r=a).copy()).on(e,n),o.on=i}}function bo(t,e){var n=this._id;return arguments.length<2?Q(this.node(),n).on.on(t):this.each(wo(n,t,e))}function No(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function jo(){return this.on("end.remove",No(this._id))}function ko(t){var e=this._name,n=this._id;typeof t!="function"&&(t=ye(t));for(var r=this._groups,i=r.length,s=new Array(i),o=0;o<i;++o)for(var a=r[o],l=a.length,c=s[o]=new Array(l),u,g,d=0;d<l;++d)(u=a[d])&&(g=t.call(u,u.__data__,d,a))&&("__data__"in u&&(g.__data__=u.__data__),c[d]=g,Zt(c[d],e,n,d,c,Q(u,n)));return new ot(s,this._parents,e,n)}function Ao(t){var e=this._name,n=this._id;typeof t!="function"&&(t=en(t));for(var r=this._groups,i=r.length,s=[],o=[],a=0;a<i;++a)for(var l=r[a],c=l.length,u,g=0;g<c;++g)if(u=l[g]){for(var d=t.call(u,u.__data__,g,l),h,b=Q(u,n),y=0,v=d.length;y<v;++y)(h=d[y])&&Zt(h,e,n,y,d,b);s.push(d),o.push(u)}return new ot(s,o,e,n)}var Eo=$t.prototype.constructor;function So(){return new Eo(this._groups,this._parents)}function Mo(t,e){var n,r,i;return function(){var s=yt(this,t),o=(this.style.removeProperty(t),yt(this,t));return s===o?null:s===n&&o===r?i:i=e(n=s,r=o)}}function wn(t){return function(){this.style.removeProperty(t)}}function To(t,e,n){var r,i=n+"",s;return function(){var o=yt(this,t);return o===i?null:o===r?s:s=e(r=o,n)}}function Co(t,e,n){var r,i,s;return function(){var o=yt(this,t),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(t),yt(this,t))),o===l?null:o===r&&l===i?s:(i=l,s=e(r=o,a))}}function $o(t,e){var n,r,i,s="style."+e,o="end."+s,a;return function(){var l=et(this,t),c=l.on,u=l.value[s]==null?a||(a=wn(e)):void 0;(c!==n||i!==u)&&(r=(n=c).copy()).on(o,i=u),l.on=r}}function zo(t,e,n){var r=(t+="")=="transform"?Ds:_n;return e==null?this.styleTween(t,Mo(t,r)).on("end.style."+t,wn(t)):typeof e=="function"?this.styleTween(t,Co(t,r,be(this,"style."+t,e))).each($o(this._id,t)):this.styleTween(t,To(t,r,e),n).on("end.style."+t,null)}function Ro(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function Io(t,e,n){var r,i;function s(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&Ro(t,o,n)),r}return s._value=e,s}function Do(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,Io(t,e,n??""))}function Po(t){return function(){this.textContent=t}}function Fo(t){return function(){var e=t(this);this.textContent=e??""}}function Lo(t){return this.tween("text",typeof t=="function"?Fo(be(this,"text",t)):Po(t==null?"":t+""))}function Ho(t){return function(e){this.textContent=t.call(this,e)}}function Oo(t){var e,n;function r(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&Ho(i)),e}return r._value=t,r}function Xo(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,Oo(t))}function Yo(){for(var t=this._name,e=this._id,n=bn(),r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],a=o.length,l,c=0;c<a;++c)if(l=o[c]){var u=Q(l,e);Zt(l,t,n,c,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new ot(r,this._parents,t,n)}function Bo(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(s,o){var a={value:o},l={value:function(){--i===0&&s()}};n.each(function(){var c=et(this,r),u=c.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(l)),c.on=e}),i===0&&s()})}var Vo=0;function ot(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function bn(){return++Vo}var it=$t.prototype;ot.prototype={constructor:ot,select:ko,selectAll:Ao,selectChild:it.selectChild,selectChildren:it.selectChildren,filter:yo,merge:vo,selection:So,transition:Yo,call:it.call,nodes:it.nodes,node:it.node,size:it.size,empty:it.empty,each:it.each,on:bo,attr:eo,attrTween:oo,style:zo,styleTween:Do,text:Lo,textTween:Xo,remove:jo,tween:Ks,delay:lo,duration:ho,ease:xo,easeVarying:go,end:Bo,[Symbol.iterator]:it[Symbol.iterator]};function qo(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Go={time:null,delay:0,duration:250,ease:qo};function Ko(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Uo(t){var e,n;t instanceof ot?(e=t._id,t=t._name):(e=bn(),(n=Go).time=me(),t=t==null?null:t+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&Zt(l,t,e,c,o,n||Ko(l,e));return new ot(r,this._parents,t,e)}$t.prototype.interrupt=Vs;$t.prototype.transition=Uo;const Pt=t=>()=>t;function Wo(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function st(t,e,n){this.k=t,this.x=e,this.y=n}st.prototype={constructor:st,scale:function(t){return t===1?this:new st(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new st(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ne=new st(1,0,0);st.prototype;function re(t){t.stopImmediatePropagation()}function bt(t){t.preventDefault(),t.stopImmediatePropagation()}function Qo(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Jo(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function qe(){return this.__zoom||Ne}function Zo(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function ta(){return navigator.maxTouchPoints||"ontouchstart"in this}function ea(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],o=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}function na(){var t=Qo,e=Jo,n=ea,r=Zo,i=ta,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Os,c=Wt("start","zoom","end"),u,g,d,h=500,b=150,y=0,v=10;function m(p){p.property("__zoom",qe).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",$).filter(i).on("touchstart.zoom",Y).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(p,j,_,k){var A=p.selection?p.selection():p;A.property("__zoom",qe),p!==A?S(p,j,_,k):A.interrupt().each(function(){T(this,arguments).event(k).start().zoom(null,typeof j=="function"?j.apply(this,arguments):j).end()})},m.scaleBy=function(p,j,_,k){m.scaleTo(p,function(){var A=this.__zoom.k,E=typeof j=="function"?j.apply(this,arguments):j;return A*E},_,k)},m.scaleTo=function(p,j,_,k){m.transform(p,function(){var A=e.apply(this,arguments),E=this.__zoom,M=_==null?w(A):typeof _=="function"?_.apply(this,arguments):_,z=E.invert(M),P=typeof j=="function"?j.apply(this,arguments):j;return n(x(N(E,P),M,z),A,o)},_,k)},m.translateBy=function(p,j,_,k){m.transform(p,function(){return n(this.__zoom.translate(typeof j=="function"?j.apply(this,arguments):j,typeof _=="function"?_.apply(this,arguments):_),e.apply(this,arguments),o)},null,k)},m.translateTo=function(p,j,_,k,A){m.transform(p,function(){var E=e.apply(this,arguments),M=this.__zoom,z=k==null?w(E):typeof k=="function"?k.apply(this,arguments):k;return n(Ne.translate(z[0],z[1]).scale(M.k).translate(typeof j=="function"?-j.apply(this,arguments):-j,typeof _=="function"?-_.apply(this,arguments):-_),E,o)},k,A)};function N(p,j){return j=Math.max(s[0],Math.min(s[1],j)),j===p.k?p:new st(j,p.x,p.y)}function x(p,j,_){var k=j[0]-_[0]*p.k,A=j[1]-_[1]*p.k;return k===p.x&&A===p.y?p:new st(p.k,k,A)}function w(p){return[(+p[0][0]+ +p[1][0])/2,(+p[0][1]+ +p[1][1])/2]}function S(p,j,_,k){p.on("start.zoom",function(){T(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(k).end()}).tween("zoom",function(){var A=this,E=arguments,M=T(A,E).event(k),z=e.apply(A,E),P=_==null?w(z):typeof _=="function"?_.apply(A,E):_,J=Math.max(z[1][0]-z[0][0],z[1][1]-z[0][1]),F=A.__zoom,G=typeof j=="function"?j.apply(A,E):j,nt=l(F.invert(P).concat(J/F.k),G.invert(P).concat(J/G.k));return function(K){if(K===1)K=G;else{var rt=nt(K),te=J/rt[2];K=new st(te,P[0]-rt[0]*te,P[1]-rt[1]*te)}M.zoom(null,K)}})}function T(p,j,_){return!_&&p.__zooming||new I(p,j)}function I(p,j){this.that=p,this.args=j,this.active=0,this.sourceEvent=null,this.extent=e.apply(p,j),this.taps=0}I.prototype={event:function(p){return p&&(this.sourceEvent=p),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(p,j){return this.mouse&&p!=="mouse"&&(this.mouse[1]=j.invert(this.mouse[0])),this.touch0&&p!=="touch"&&(this.touch0[1]=j.invert(this.touch0[0])),this.touch1&&p!=="touch"&&(this.touch1[1]=j.invert(this.touch1[0])),this.that.__zoom=j,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(p){var j=q(this.that).datum();c.call(p,this.that,new Wo(p,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:c}),j)}};function C(p,...j){if(!t.apply(this,arguments))return;var _=T(this,j).event(p),k=this.__zoom,A=Math.max(s[0],Math.min(s[1],k.k*Math.pow(2,r.apply(this,arguments)))),E=ut(p);if(_.wheel)(_.mouse[0][0]!==E[0]||_.mouse[0][1]!==E[1])&&(_.mouse[1]=k.invert(_.mouse[0]=E)),clearTimeout(_.wheel);else{if(k.k===A)return;_.mouse=[E,k.invert(E)],Xt(this),_.start()}bt(p),_.wheel=setTimeout(M,b),_.zoom("mouse",n(x(N(k,A),_.mouse[0],_.mouse[1]),_.extent,o));function M(){_.wheel=null,_.end()}}function D(p,...j){if(d||!t.apply(this,arguments))return;var _=p.currentTarget,k=T(this,j,!0).event(p),A=q(p.view).on("mousemove.zoom",P,!0).on("mouseup.zoom",J,!0),E=ut(p,_),M=p.clientX,z=p.clientY;ps(p.view),re(p),k.mouse=[E,this.__zoom.invert(E)],Xt(this),k.start();function P(F){if(bt(F),!k.moved){var G=F.clientX-M,nt=F.clientY-z;k.moved=G*G+nt*nt>y}k.event(F).zoom("mouse",n(x(k.that.__zoom,k.mouse[0]=ut(F,_),k.mouse[1]),k.extent,o))}function J(F){A.on("mousemove.zoom mouseup.zoom",null),xs(F.view,k.moved),bt(F),k.event(F).end()}}function $(p,...j){if(t.apply(this,arguments)){var _=this.__zoom,k=ut(p.changedTouches?p.changedTouches[0]:p,this),A=_.invert(k),E=_.k*(p.shiftKey?.5:2),M=n(x(N(_,E),k,A),e.apply(this,j),o);bt(p),a>0?q(this).transition().duration(a).call(S,M,k,p):q(this).call(m.transform,M,k,p)}}function Y(p,...j){if(t.apply(this,arguments)){var _=p.touches,k=_.length,A=T(this,j,p.changedTouches.length===k).event(p),E,M,z,P;for(re(p),M=0;M<k;++M)z=_[M],P=ut(z,this),P=[P,this.__zoom.invert(P),z.identifier],A.touch0?!A.touch1&&A.touch0[2]!==P[2]&&(A.touch1=P,A.taps=0):(A.touch0=P,E=!0,A.taps=1+!!u);u&&(u=clearTimeout(u)),E&&(A.taps<2&&(g=P[0],u=setTimeout(function(){u=null},h)),Xt(this),A.start())}}function B(p,...j){if(this.__zooming){var _=T(this,j).event(p),k=p.changedTouches,A=k.length,E,M,z,P;for(bt(p),E=0;E<A;++E)M=k[E],z=ut(M,this),_.touch0&&_.touch0[2]===M.identifier?_.touch0[0]=z:_.touch1&&_.touch1[2]===M.identifier&&(_.touch1[0]=z);if(M=_.that.__zoom,_.touch1){var J=_.touch0[0],F=_.touch0[1],G=_.touch1[0],nt=_.touch1[1],K=(K=G[0]-J[0])*K+(K=G[1]-J[1])*K,rt=(rt=nt[0]-F[0])*rt+(rt=nt[1]-F[1])*rt;M=N(M,Math.sqrt(K/rt)),z=[(J[0]+G[0])/2,(J[1]+G[1])/2],P=[(F[0]+nt[0])/2,(F[1]+nt[1])/2]}else if(_.touch0)z=_.touch0[0],P=_.touch0[1];else return;_.zoom("touch",n(x(M,z,P),_.extent,o))}}function O(p,...j){if(this.__zooming){var _=T(this,j).event(p),k=p.changedTouches,A=k.length,E,M;for(re(p),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),E=0;E<A;++E)M=k[E],_.touch0&&_.touch0[2]===M.identifier?delete _.touch0:_.touch1&&_.touch1[2]===M.identifier&&delete _.touch1;if(_.touch1&&!_.touch0&&(_.touch0=_.touch1,delete _.touch1),_.touch0)_.touch0[1]=this.__zoom.invert(_.touch0[0]);else if(_.end(),_.taps===2&&(M=ut(M,this),Math.hypot(g[0]-M[0],g[1]-M[1])<v)){var z=q(this).on("dblclick.zoom");z&&z.apply(this,arguments)}}}return m.wheelDelta=function(p){return arguments.length?(r=typeof p=="function"?p:Pt(+p),m):r},m.filter=function(p){return arguments.length?(t=typeof p=="function"?p:Pt(!!p),m):t},m.touchable=function(p){return arguments.length?(i=typeof p=="function"?p:Pt(!!p),m):i},m.extent=function(p){return arguments.length?(e=typeof p=="function"?p:Pt([[+p[0][0],+p[0][1]],[+p[1][0],+p[1][1]]]),m):e},m.scaleExtent=function(p){return arguments.length?(s[0]=+p[0],s[1]=+p[1],m):[s[0],s[1]]},m.translateExtent=function(p){return arguments.length?(o[0][0]=+p[0][0],o[1][0]=+p[1][0],o[0][1]=+p[0][1],o[1][1]=+p[1][1],m):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},m.constrain=function(p){return arguments.length?(n=p,m):n},m.duration=function(p){return arguments.length?(a=+p,m):a},m.interpolate=function(p){return arguments.length?(l=p,m):l},m.on=function(){var p=c.on.apply(c,arguments);return p===c?m:p},m.clickDistance=function(p){return arguments.length?(y=(p=+p)*p,m):Math.sqrt(y)},m.tapDistance=function(p){return arguments.length?(v=+p,m):v},m}const ra=new Set(["CONTAINS","IMPLEMENTS","CORRESPONDS"]),ia=new Set(["REFERENCES","MENTIONS"]);function sa(t){return ra.has(t)?"skeleton":ia.has(t)?"weak":"standard"}const oa=30,Ft=800,Nt=500;function aa({centerNode:t,neighbors:e}){const[n,r]=R.useState(e.length>oa?"table":"graph");return f.jsxs("div",{children:[f.jsxs("div",{className:"flex items-center justify-end gap-1 mb-3",children:[f.jsx("button",{onClick:()=>r("graph"),className:`p-1.5 rounded transition-colors ${n==="graph"?"bg-c4a-bg-hover text-c4a-text-primary":"text-c4a-text-muted hover:text-c4a-text-secondary"}`,title:"力导向图",children:f.jsx(Tn,{size:16})}),f.jsx("button",{onClick:()=>r("table"),className:`p-1.5 rounded transition-colors ${n==="table"?"bg-c4a-bg-hover text-c4a-text-primary":"text-c4a-text-muted hover:text-c4a-text-secondary"}`,title:"表格模式",children:f.jsx($n,{size:16})})]}),n==="graph"?f.jsx(ca,{centerNode:t,neighbors:e}):f.jsx(la,{neighbors:e})]})}function ca({centerNode:t,neighbors:e}){const n=R.useRef(null),r=Ut(),{t:i}=lt(),s=R.useCallback(a=>r(ht.entity(a)),[r]),o=R.useCallback(a=>r(ht.relation(a)),[r]);return R.useEffect(()=>{const a=n.current;if(!a)return;const l=q(a);l.selectAll("*").remove();const c=new Map;c.set(t.id,{id:t.id,name:t.name,type:t.type,kind:t.kind,isCenter:!0,x:Ft/2,y:Nt/2});for(const x of e)c.has(x.neighbor.id)||c.set(x.neighbor.id,{id:x.neighbor.id,name:x.neighbor.name,type:x.neighbor.type,kind:x.neighbor.kind,isCenter:!1});const u=Array.from(c.values()),g=e.map(x=>{const w={id:x.id,type:x.type,edgeClass:sa(x.type),source:x.direction==="outgoing"?t.id:x.neighbor.id,target:x.direction==="outgoing"?x.neighbor.id:t.id};return x.confidence!==void 0&&(w.confidence=x.confidence),w});l.append("defs").append("marker").attr("id","arrow").attr("viewBox","0 0 10 6").attr("refX",28).attr("refY",3).attr("markerWidth",10).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M0,0L10,3L0,6").attr("fill","var(--c4a-border-subtle)");const h=l.append("g"),b=na().scaleExtent([.3,3]).on("zoom",x=>{h.attr("transform",x.transform)});l.call(b).call(b.transform,Ne);const y=h.selectAll("line.link").data(g).join("line").attr("class","link").attr("stroke",x=>x.edgeClass==="skeleton"?"var(--c4a-text-secondary)":"var(--c4a-border-subtle)").attr("stroke-width",x=>x.edgeClass==="skeleton"?2:1).attr("stroke-dasharray",x=>x.edgeClass==="weak"?"4 3":null).attr("opacity",x=>x.edgeClass==="weak"?.6:1).attr("marker-end","url(#arrow)").style("cursor","pointer").on("click",(x,w)=>o(w.id)).on("mouseenter",function(){q(this).attr("stroke","var(--c4a-accent)").attr("stroke-width",function(){return Number(q(this).attr("stroke-width"))+1})}).on("mouseleave",function(x,w){q(this).attr("stroke",w.edgeClass==="skeleton"?"var(--c4a-text-secondary)":"var(--c4a-border-subtle)").attr("stroke-width",w.edgeClass==="skeleton"?2:1)});y.append("title").text(x=>{const w=de(x.confidence);return w?`${x.type} · ${i(w.labelKey)}`:x.type});const v=h.selectAll("text.link-label").data(g).join("text").attr("class","link-label").text(x=>x.type).attr("font-family","var(--font-mono)").attr("font-size",9).attr("fill","var(--c4a-text-muted)").attr("text-anchor","middle").attr("dy",-4),m=h.selectAll("g.node").data(u,x=>x.id).join("g").attr("class","node").style("cursor","pointer").on("click",(x,w)=>s(w.id));m.append("circle").attr("r",x=>x.isCenter?24:18).attr("fill",x=>x.isCenter?"var(--c4a-accent)":"var(--c4a-bg-elevated)").attr("stroke",x=>x.isCenter?"#fff":"var(--c4a-border-default)").attr("stroke-width",x=>x.isCenter?2:1),m.append("text").text(x=>x.name.length>12?x.name.slice(0,12)+"…":x.name).attr("font-family","var(--font-mono)").attr("font-size",10).attr("fill","var(--c4a-text-primary)").attr("text-anchor","middle").attr("dy",x=>x.isCenter?36:30),m.append("title").text(x=>{let w=`${x.name}
2
+ type: ${x.type}`;return x.kind&&(w+=`
3
+ kind: ${x.kind}`),w});const N=zr(u).force("link",yr(g).id(x=>x.id).distance(120)).force("charge",Rr().strength(-300)).force("center",Qn(Ft/2,Nt/2)).force("collide",mr(30)).on("tick",()=>{y.attr("x1",x=>x.source.x??0).attr("y1",x=>x.source.y??0).attr("x2",x=>x.target.x??0).attr("y2",x=>x.target.y??0),v.attr("x",x=>{const w=x.source.x??0,S=x.target.x??0;return(w+S)/2}).attr("y",x=>{const w=x.source.y??0,S=x.target.y??0;return(w+S)/2}),m.attr("transform",x=>`translate(${x.x??0},${x.y??0})`)});return m.each(function(x,w){const S=q(this);let T=!1;S.on("mousedown.drag",I=>{I.stopPropagation(),T=!0;const C=u[w],D=a.getBoundingClientRect(),$=B=>{if(!T)return;const O=h.attr("transform");let p=0,j=0,_=1;if(O){const E=O.match(/translate\(([-\d.e+]+)[, ]([-\d.e+]+)\)\s*scale\(([-\d.e+]+)\)/);E&&(p=parseFloat(E[1]),j=parseFloat(E[2]),_=parseFloat(E[3]))}const k=(B.clientX-D.left)/D.width*Ft,A=(B.clientY-D.top)/D.height*Nt;C.fx=(k-p)/_,C.fy=(A-j)/_,N.alpha(.3).restart()},Y=()=>{T=!1,C.fx=null,C.fy=null,document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",Y)};document.addEventListener("mousemove",$),document.addEventListener("mouseup",Y)})}),()=>{N.stop()}},[t,e,s,o]),f.jsx("svg",{ref:n,width:"100%",height:Nt,viewBox:`0 0 ${Ft} ${Nt}`,className:"rounded border border-c4a-border-subtle bg-c4a-bg-surface"})}function la({neighbors:t}){const e=Ut();return f.jsx("div",{className:"rounded border border-c4a-border-subtle overflow-auto",children:f.jsxs("table",{className:"w-full text-xs font-mono",children:[f.jsx("thead",{children:f.jsxs("tr",{className:"border-b border-c4a-border-subtle bg-c4a-bg-surface text-c4a-text-muted text-left",children:[f.jsx("th",{className:"px-3 py-2",children:"NAME"}),f.jsx("th",{className:"px-3 py-2",children:"TYPE"}),f.jsx("th",{className:"px-3 py-2",children:"KIND"}),f.jsx("th",{className:"px-3 py-2",children:"EDGE"}),f.jsx("th",{className:"px-3 py-2",children:"DIRECTION"})]})}),f.jsx("tbody",{children:t.map(n=>f.jsxs("tr",{className:"border-b border-c4a-border-subtle hover:bg-c4a-bg-hover cursor-pointer transition-colors",onClick:()=>e(ht.entity(n.neighbor.id)),children:[f.jsx("td",{className:"px-3 py-2 text-c4a-accent",children:n.neighbor.name}),f.jsx("td",{className:"px-3 py-2 text-c4a-text-secondary",children:n.neighbor.type}),f.jsx("td",{className:"px-3 py-2 text-c4a-text-muted",children:n.neighbor.kind??"—"}),f.jsx("td",{className:"px-3 py-2",children:f.jsx(W,{variant:"accent",children:n.type})}),f.jsx("td",{className:"px-3 py-2 text-c4a-text-muted",children:n.direction==="outgoing"?"→":"←"})]},n.id))})]})})}function ua({entityId:t,centerNode:e}){const{t:n}=lt(),[r,i]=R.useState([]),[s,o]=R.useState(!1);return R.useEffect(()=>{Tt.get(`/entities/${t}/neighbors`).then(a=>{const l=[];for(const c of a.neighbors)for(const u of c.via)l.push({id:u.relation_id,type:u.type,direction:u.direction,neighbor:{id:c.id,name:c.name,type:c.type,...c.kind?{kind:c.kind}:{}},...u.weight!==void 0?{weight:u.weight}:{},...u.confidence!==void 0?{confidence:u.confidence}:{}});i(l),o(!0)}).catch(()=>o(!0))},[t]),s?r.length===0?f.jsx(Ct,{title:n("common.empty.entity_neighbors.title"),description:n("common.empty.entity_neighbors.description")}):f.jsx(aa,{centerNode:e,neighbors:r}):f.jsx("p",{className:"text-sm text-c4a-text-muted",children:n("common.loading")})}const fa={Component:"🏗",SoR:"📋",Product:"📦",Container:"📂",Contract:"📝",Epic:"🎯"};function xa(){const{t}=lt(),{entityId:e}=Nn(),[n,r]=R.useState(null),[i,s]=R.useState(null),[o,a]=R.useState("overview");if(R.useEffect(()=>{e&&(s(null),Tt.get(`/entities/${e}`).then(r).catch(y=>{y instanceof jn&&y.status===404?s("not_found"):s("load_failed")}))},[e]),i)return f.jsx("div",{className:"flex flex-1 flex-col p-4 md:p-6",children:f.jsx(Ct,{title:t(`common.error.${i}`),description:t(`common.error.${i}_description`)})});if(!n)return f.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:f.jsx("p",{className:"text-sm text-c4a-text-muted",children:t("common.loading")})});const l=fa[n.type]??"🔹",c=n._links,u=c?.relations?.count,g=c?.contents?.count,d=c?.referrers?.count,{atoms:h,...b}=n.data;return f.jsxs("div",{className:"flex flex-1 flex-col p-4 md:p-6",children:[f.jsx(En,{icon:f.jsx("span",{children:l}),title:n.name,badges:[f.jsx(W,{children:n.type},"type"),...n.kind?[f.jsx(W,{variant:"muted",children:n.kind},"kind")]:[]],meta:[...n.perspective?[{label:t("entity.detail.perspective"),value:n.perspective}]:[],...n.scope?[{label:t("entity.detail.scope"),value:n.scope}]:[]]}),f.jsxs(kn,{value:o,onChange:y=>a(y),children:[f.jsx("div",{className:"mt-3",children:f.jsxs(An,{children:[f.jsx(vt,{value:"overview",children:t("entity.detail.tab.overview")}),f.jsxs(vt,{value:"relations",children:[t("entity.detail.tab.relations"),u!==void 0&&` (${u})`]}),f.jsxs(vt,{value:"contents",children:[t("entity.detail.tab.contents"),g!==void 0&&` (${g})`]}),f.jsxs(vt,{value:"referrers",children:[t("entity.detail.tab.referrers"),d!==void 0&&` (${d})`]}),f.jsx(vt,{value:"neighbors",children:t("entity.detail.tab.neighbors")})]})}),f.jsxs("div",{className:"mt-4 flex-1",children:[f.jsx(_t,{value:"overview",children:f.jsx(zn,{data:b,atoms:h})}),f.jsx(_t,{value:"relations",children:f.jsx(Kn,{entityId:n.id})}),f.jsx(_t,{value:"contents",children:f.jsx(Un,{entityId:n.id})}),f.jsx(_t,{value:"referrers",children:f.jsx(Wn,{entityId:n.id})}),f.jsx(_t,{value:"neighbors",children:f.jsx(ua,{entityId:n.id,centerNode:{id:n.id,name:n.name,type:n.type,...n.kind?{kind:n.kind}:{}}})})]})]})]})}export{xa as EntityDetail};
@@ -0,0 +1 @@
1
+ import{i as R,a as N,b as w,j as t,k as S,d as L,r as C}from"./index-PGORoGGx.js";const T=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],E=R("arrow-left",T);function J({icon:e,title:n,badges:s,meta:i}){const r=N(),{t:a}=w();return t.jsxs("div",{children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx("span",{className:"shrink-0",children:e}),t.jsx("h1",{className:"min-w-0 break-all font-mono text-xl font-bold leading-none text-c4a-text-primary",children:n}),s&&s.length>0&&t.jsx("div",{className:"flex items-center gap-1.5 ml-2",children:s.map((c,o)=>t.jsx("span",{children:c},o))})]}),t.jsxs("button",{onClick:()=>r(-1),className:"flex items-center gap-1 text-c4a-text-muted hover:text-c4a-text-primary cursor-pointer transition-colors text-xs font-mono shrink-0 ml-4",children:[t.jsx(E,{size:14}),a("common.back")]})]}),i&&i.length>0&&t.jsx("div",{className:"mt-2 flex flex-wrap items-baseline gap-4 text-xs",children:i.map(c=>t.jsxs("span",{className:"text-c4a-text-muted",children:[c.label,":",t.jsx("span",{className:"text-c4a-text-secondary",children:c.value})]},c.label))})]})}const _={accent:"bg-c4a-accent/10 text-c4a-accent/60",success:"bg-c4a-success/10 text-c4a-success",warning:"bg-c4a-warning/10 text-c4a-warning",error:"bg-c4a-error/10 text-c4a-error",muted:"bg-c4a-bg-hover text-c4a-text-muted"};function K({children:e,variant:n="accent",tooltip:s}){return t.jsx("span",{className:`inline-block font-mono text-[10px] uppercase px-1.5 py-0.5 rounded-sm ${_[n]}`,title:s,children:e})}function O(e){return e===void 0?null:e>=.9?{labelKey:"confidence.high",variant:"success",value:e}:e>=.7?{labelKey:"confidence.ai",variant:"warning",value:e}:{labelKey:"confidence.low",variant:"error",value:e}}let h=null,p=[];const m=S((e,n)=>({cache:new Map,pending:new Set,resolve:s=>{const{cache:i,pending:r}=n(),a=s.filter(c=>!i.has(c)&&!r.has(c)&&!p.includes(c));a.length!==0&&(p.push(...a),e({pending:new Set([...r,...a])}),h&&clearTimeout(h),h=setTimeout(()=>{const c=[...p];p=[],h=null,c.length!==0&&L.post("/resolve",{refs:c}).then(o=>{const{cache:d,pending:f}=n(),x=new Map(d),l=new Set(f);for(const u of c){const b=o[u];b?x.set(u,b):x.set(u,{exists:!1}),l.delete(u)}e({cache:x,pending:l})}).catch(()=>{const{cache:o,pending:d}=n(),f=new Map(o),x=new Set(d);for(const l of c)f.set(l,{error:!0,exists:!1}),x.delete(l);e({cache:f,pending:x})})},50))},retry:s=>{const{cache:i}=n(),r=new Map(i);r.delete(s),e({cache:r}),n().resolve([s])}})),g="/studio",j={entity:e=>`${g}/entities/${e}`,relation:e=>`${g}/relations/${e}`,content:e=>`${g}/contents/${e}`},P=/^ref:(entity|relation|content):(.+)$/;function $(e){const n=P.exec(e);return!n||!n[2]?null:{type:n[1],id:n[2]}}function I(e){return typeof e=="string"&&P.test(e)}const v={Component:"🏗",SoR:"📋",Product:"📦",Container:"📂",Contract:"📝",Epic:"🎯"};function M(e,n){if(e.type==="content")return"📄";if(e.type==="relation")return"🔗";const s=n?.entity_type;return s&&v[s]?v[s]:"🔹"}function A(e){switch(e.type){case"entity":return j.entity(e.id);case"relation":return j.relation(e.id);case"content":return j.content(e.id);default:return"#"}}function B({pointer:e}){const n=N(),{t:s}=w(),i=m(l=>l.cache),r=m(l=>l.pending);C.useEffect(()=>{m.getState().resolve([e])},[e]);const a=$(e);if(!a)return t.jsx("span",{className:"font-mono text-xs text-c4a-text-muted",children:e});const c=i.get(e);if(r.has(e)||!c&&!i.has(e))return t.jsx("span",{className:"inline-block animate-pulse bg-c4a-bg-hover rounded px-2 py-0.5 text-xs font-mono w-24 h-4"});if(c?.error)return t.jsxs("span",{className:"font-mono text-xs text-c4a-text-muted cursor-pointer",title:s("ref.retry"),onClick:()=>m.getState().retry(e),children:["<",s("ref.unknown"),": ",a.id.slice(0,12),">"]});if(c&&!c.exists)return t.jsxs("span",{className:"font-mono text-xs text-c4a-text-muted line-through",title:e,children:["<",s("ref.stale"),": ",a.id.slice(0,12),">"]});const d=M(a,c),f=a.type==="relation"?c?.relation_type||a.id.slice(0,12):c?.name||a.id.slice(0,12),x=A(a);return t.jsxs("span",{className:"inline-flex items-center gap-1 text-c4a-accent hover:underline cursor-pointer text-xs font-mono",onClick:()=>n(x),title:e,children:[t.jsx("span",{children:d}),t.jsx("span",{children:f})]})}function z({data:e,defaultExpanded:n=2}){return t.jsx("div",{className:"font-mono text-xs",children:t.jsx(y,{value:e,depth:0,defaultExpanded:n})})}function y({keyName:e,value:n,depth:s,defaultExpanded:i}){const[r,a]=C.useState(s<i);if(typeof n=="string"&&I(n))return t.jsxs("div",{className:"flex items-baseline gap-1",style:{paddingLeft:s*16},children:[e!==void 0&&t.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),t.jsx(B,{pointer:n})]});if(n==null)return t.jsxs("div",{style:{paddingLeft:s*16},children:[e!==void 0&&t.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),t.jsx("span",{className:"text-c4a-text-muted",children:"null"})]});if(typeof n=="string")return t.jsxs("div",{style:{paddingLeft:s*16},children:[e!==void 0&&t.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),t.jsxs("span",{className:"text-c4a-accent",children:['"',n,'"']})]});if(typeof n=="number")return t.jsxs("div",{style:{paddingLeft:s*16},children:[e!==void 0&&t.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),t.jsx("span",{className:"text-c4a-success",children:n})]});if(typeof n=="boolean")return t.jsxs("div",{style:{paddingLeft:s*16},children:[e!==void 0&&t.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),t.jsx("span",{className:"text-c4a-warning",children:String(n)})]});if(Array.isArray(n))return n.length===0?t.jsxs("div",{style:{paddingLeft:s*16},children:[e!==void 0&&t.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),t.jsx("span",{className:"text-c4a-text-muted",children:"[]"})]}):t.jsxs("div",{children:[t.jsxs("div",{style:{paddingLeft:s*16},className:"cursor-pointer hover:bg-c4a-bg-hover rounded px-1 -mx-1",onClick:()=>a(!r),children:[t.jsx("span",{className:"text-c4a-text-muted mr-1",children:r?"▼":"▶"}),e!==void 0&&t.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),!r&&t.jsxs("span",{className:"text-c4a-text-muted",children:["[",n.length," items]"]})]}),r&&n.map((c,o)=>t.jsx(y,{keyName:String(o),value:c,depth:s+1,defaultExpanded:i},o))]});if(typeof n=="object"){const c=Object.entries(n);return c.length===0?t.jsxs("div",{style:{paddingLeft:s*16},children:[e!==void 0&&t.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),t.jsx("span",{className:"text-c4a-text-muted",children:"{}"})]}):t.jsxs("div",{children:[t.jsxs("div",{style:{paddingLeft:s*16},className:"cursor-pointer hover:bg-c4a-bg-hover rounded px-1 -mx-1",onClick:()=>a(!r),children:[t.jsx("span",{className:"text-c4a-text-muted mr-1",children:r?"▼":"▶"}),e!==void 0&&t.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),!r&&t.jsx("span",{className:"text-c4a-text-muted",children:"{ ... }"})]}),r&&c.map(([o,d])=>t.jsx(y,{keyName:o,value:d,depth:s+1,defaultExpanded:i},o))]})}return null}export{K as B,J as D,z as J,B as R,O as c,I as i,j as s};
@@ -0,0 +1 @@
1
+ import{i as R,a as N,b as w,j as t,k as S,d as L,r as C}from"./index-BoqItESG.js";const T=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],E=R("arrow-left",T);function J({icon:e,title:n,badges:s,meta:i}){const r=N(),{t:a}=w();return t.jsxs("div",{children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx("span",{className:"shrink-0",children:e}),t.jsx("h1",{className:"min-w-0 break-all font-mono text-xl font-bold leading-none text-c4a-text-primary",children:n}),s&&s.length>0&&t.jsx("div",{className:"flex items-center gap-1.5 ml-2",children:s.map((c,o)=>t.jsx("span",{children:c},o))})]}),t.jsxs("button",{onClick:()=>r(-1),className:"flex items-center gap-1 text-c4a-text-muted hover:text-c4a-text-primary cursor-pointer transition-colors text-xs font-mono shrink-0 ml-4",children:[t.jsx(E,{size:14}),a("common.back")]})]}),i&&i.length>0&&t.jsx("div",{className:"mt-2 flex flex-wrap items-baseline gap-4 text-xs",children:i.map(c=>t.jsxs("span",{className:"text-c4a-text-muted",children:[c.label,":",t.jsx("span",{className:"text-c4a-text-secondary",children:c.value})]},c.label))})]})}const _={accent:"bg-c4a-accent/10 text-c4a-accent/60",success:"bg-c4a-success/10 text-c4a-success",warning:"bg-c4a-warning/10 text-c4a-warning",error:"bg-c4a-error/10 text-c4a-error",muted:"bg-c4a-bg-hover text-c4a-text-muted"};function K({children:e,variant:n="accent",tooltip:s}){return t.jsx("span",{className:`inline-block font-mono text-[10px] uppercase px-1.5 py-0.5 rounded-sm ${_[n]}`,title:s,children:e})}function O(e){return e===void 0?null:e>=.9?{labelKey:"confidence.high",variant:"success",value:e}:e>=.7?{labelKey:"confidence.ai",variant:"warning",value:e}:{labelKey:"confidence.low",variant:"error",value:e}}let h=null,p=[];const m=S((e,n)=>({cache:new Map,pending:new Set,resolve:s=>{const{cache:i,pending:r}=n(),a=s.filter(c=>!i.has(c)&&!r.has(c)&&!p.includes(c));a.length!==0&&(p.push(...a),e({pending:new Set([...r,...a])}),h&&clearTimeout(h),h=setTimeout(()=>{const c=[...p];p=[],h=null,c.length!==0&&L.post("/resolve",{refs:c}).then(o=>{const{cache:d,pending:f}=n(),x=new Map(d),l=new Set(f);for(const u of c){const b=o[u];b?x.set(u,b):x.set(u,{exists:!1}),l.delete(u)}e({cache:x,pending:l})}).catch(()=>{const{cache:o,pending:d}=n(),f=new Map(o),x=new Set(d);for(const l of c)f.set(l,{error:!0,exists:!1}),x.delete(l);e({cache:f,pending:x})})},50))},retry:s=>{const{cache:i}=n(),r=new Map(i);r.delete(s),e({cache:r}),n().resolve([s])}})),g="/studio",j={entity:e=>`${g}/entities/${e}`,relation:e=>`${g}/relations/${e}`,content:e=>`${g}/contents/${e}`},P=/^ref:(entity|relation|content):(.+)$/;function $(e){const n=P.exec(e);return!n||!n[2]?null:{type:n[1],id:n[2]}}function I(e){return typeof e=="string"&&P.test(e)}const v={Component:"🏗",SoR:"📋",Product:"📦",Container:"📂",Contract:"📝",Epic:"🎯"};function M(e,n){if(e.type==="content")return"📄";if(e.type==="relation")return"🔗";const s=n?.entity_type;return s&&v[s]?v[s]:"🔹"}function A(e){switch(e.type){case"entity":return j.entity(e.id);case"relation":return j.relation(e.id);case"content":return j.content(e.id);default:return"#"}}function B({pointer:e}){const n=N(),{t:s}=w(),i=m(l=>l.cache),r=m(l=>l.pending);C.useEffect(()=>{m.getState().resolve([e])},[e]);const a=$(e);if(!a)return t.jsx("span",{className:"font-mono text-xs text-c4a-text-muted",children:e});const c=i.get(e);if(r.has(e)||!c&&!i.has(e))return t.jsx("span",{className:"inline-block animate-pulse bg-c4a-bg-hover rounded px-2 py-0.5 text-xs font-mono w-24 h-4"});if(c?.error)return t.jsxs("span",{className:"font-mono text-xs text-c4a-text-muted cursor-pointer",title:s("ref.retry"),onClick:()=>m.getState().retry(e),children:["<",s("ref.unknown"),": ",a.id.slice(0,12),">"]});if(c&&!c.exists)return t.jsxs("span",{className:"font-mono text-xs text-c4a-text-muted line-through",title:e,children:["<",s("ref.stale"),": ",a.id.slice(0,12),">"]});const d=M(a,c),f=a.type==="relation"?c?.relation_type||a.id.slice(0,12):c?.name||a.id.slice(0,12),x=A(a);return t.jsxs("span",{className:"inline-flex items-center gap-1 text-c4a-accent hover:underline cursor-pointer text-xs font-mono",onClick:()=>n(x),title:e,children:[t.jsx("span",{children:d}),t.jsx("span",{children:f})]})}function z({data:e,defaultExpanded:n=2}){return t.jsx("div",{className:"font-mono text-xs",children:t.jsx(y,{value:e,depth:0,defaultExpanded:n})})}function y({keyName:e,value:n,depth:s,defaultExpanded:i}){const[r,a]=C.useState(s<i);if(typeof n=="string"&&I(n))return t.jsxs("div",{className:"flex items-baseline gap-1",style:{paddingLeft:s*16},children:[e!==void 0&&t.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),t.jsx(B,{pointer:n})]});if(n==null)return t.jsxs("div",{style:{paddingLeft:s*16},children:[e!==void 0&&t.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),t.jsx("span",{className:"text-c4a-text-muted",children:"null"})]});if(typeof n=="string")return t.jsxs("div",{style:{paddingLeft:s*16},children:[e!==void 0&&t.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),t.jsxs("span",{className:"text-c4a-accent",children:['"',n,'"']})]});if(typeof n=="number")return t.jsxs("div",{style:{paddingLeft:s*16},children:[e!==void 0&&t.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),t.jsx("span",{className:"text-c4a-success",children:n})]});if(typeof n=="boolean")return t.jsxs("div",{style:{paddingLeft:s*16},children:[e!==void 0&&t.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),t.jsx("span",{className:"text-c4a-warning",children:String(n)})]});if(Array.isArray(n))return n.length===0?t.jsxs("div",{style:{paddingLeft:s*16},children:[e!==void 0&&t.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),t.jsx("span",{className:"text-c4a-text-muted",children:"[]"})]}):t.jsxs("div",{children:[t.jsxs("div",{style:{paddingLeft:s*16},className:"cursor-pointer hover:bg-c4a-bg-hover rounded px-1 -mx-1",onClick:()=>a(!r),children:[t.jsx("span",{className:"text-c4a-text-muted mr-1",children:r?"▼":"▶"}),e!==void 0&&t.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),!r&&t.jsxs("span",{className:"text-c4a-text-muted",children:["[",n.length," items]"]})]}),r&&n.map((c,o)=>t.jsx(y,{keyName:String(o),value:c,depth:s+1,defaultExpanded:i},o))]});if(typeof n=="object"){const c=Object.entries(n);return c.length===0?t.jsxs("div",{style:{paddingLeft:s*16},children:[e!==void 0&&t.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),t.jsx("span",{className:"text-c4a-text-muted",children:"{}"})]}):t.jsxs("div",{children:[t.jsxs("div",{style:{paddingLeft:s*16},className:"cursor-pointer hover:bg-c4a-bg-hover rounded px-1 -mx-1",onClick:()=>a(!r),children:[t.jsx("span",{className:"text-c4a-text-muted mr-1",children:r?"▼":"▶"}),e!==void 0&&t.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),!r&&t.jsx("span",{className:"text-c4a-text-muted",children:"{ ... }"})]}),r&&c.map(([o,d])=>t.jsx(y,{keyName:o,value:d,depth:s+1,defaultExpanded:i},o))]})}return null}export{K as B,J as D,z as J,B as R,O as c,I as i,j as s};
@@ -0,0 +1 @@
1
+ import{b as v,c as _,a as y,r as c,d as p,A as C,j as e,E}from"./index-PGORoGGx.js";import{c as S,D as w,B as l,s as u,J as D}from"./JsonTree-BRUca2ED.js";import{C as k}from"./ContentCard-D0mL7yOO.js";const L={Component:"🏗",SoR:"📋",Product:"📦",Container:"📂",Contract:"📝",Epic:"🎯"};function R(t){try{return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return t}}function I(){const{t}=v(),{relationId:n}=_(),i=y(),[a,f]=c.useState(null),[o,d]=c.useState(null),[x,j]=c.useState([]),[g,m]=c.useState(!1);if(c.useEffect(()=>{n&&(d(null),p.get(`/relations/${n}`).then(s=>{f(s),p.get(`/relations/${n}/contents`).then(N=>{j(N.contents??[]),m(!0)}).catch(()=>m(!0))}).catch(s=>{s instanceof C&&s.status===404?d("not_found"):d("load_failed")}))},[n]),o)return e.jsx("div",{className:"flex flex-1 flex-col p-4 md:p-6",children:e.jsx(E,{title:t(`common.error.${o}`),description:t(`common.error.${o}_description`)})});if(!a)return e.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:e.jsx("p",{className:"text-sm text-c4a-text-muted",children:t("common.loading")})});const r=S(a.confidence),b=a.metadata?._source==="field_sync"?t("relation.detail.source_field_sync"):t("relation.detail.source_explicit");return e.jsxs("div",{className:"flex flex-1 flex-col p-4 md:p-6",children:[e.jsx(w,{icon:e.jsx("span",{children:"🔗"}),title:a.type,badges:r?[e.jsx(l,{variant:r.variant,tooltip:`confidence: ${r.value}`,children:t(r.labelKey)},"conf")]:[],meta:[...a.weight!==void 0?[{label:t("relation.detail.weight"),value:String(a.weight)}]:[],...r?[{label:t("relation.detail.confidence"),value:t(r.labelKey)}]:[]]}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-4",children:[e.jsx(h,{label:t("relation.detail.from"),entity:a.from,onClick:()=>i(u.entity(a.from.id))}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-c4a-text-muted text-lg",children:"→"}),e.jsx(l,{variant:"accent",children:a.type}),e.jsx("span",{className:"text-c4a-text-muted text-lg",children:"→"})]}),e.jsx(h,{label:t("relation.detail.to"),entity:a.to,onClick:()=>i(u.entity(a.to.id))})]}),!!a.data.description&&e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"font-mono text-xs uppercase text-c4a-text-muted mb-1.5",children:t("relation.detail.description")}),e.jsx("p",{className:"text-sm text-c4a-text-secondary",children:String(a.data.description)})]}),Object.keys(a.data).filter(s=>s!=="description").length>0&&e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"font-mono text-xs uppercase text-c4a-text-muted mb-1.5",children:t("relation.detail.data")}),e.jsx("div",{className:"rounded border border-c4a-border-subtle bg-c4a-bg-surface p-3",children:e.jsx(D,{data:Object.fromEntries(Object.entries(a.data).filter(([s])=>s!=="description")),defaultExpanded:2})})]}),g&&x.length>0&&e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"font-mono text-xs uppercase text-c4a-text-muted mb-1.5",children:t("relation.detail.source_refs")}),e.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:x.map(s=>e.jsx(k,{content:{hash_id:s.hash_id,...s.source_path?{source_path:s.source_path}:{},...s.span?{span:s.span}:{}}},s.hash_id))})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"font-mono text-xs uppercase text-c4a-text-muted mb-1.5",children:t("relation.detail.meta")}),e.jsxs("div",{className:"flex flex-wrap gap-4 text-xs",children:[e.jsxs("span",{className:"text-c4a-text-muted",children:[t("relation.detail.source_label"),":",e.jsx("span",{className:"text-c4a-text-secondary ml-1",children:b})]}),a.metadata?.created_at&&e.jsxs("span",{className:"text-c4a-text-muted",children:[t("content.detail.created_at"),":",e.jsx("span",{className:"text-c4a-text-secondary ml-1",children:R(String(a.metadata.created_at))})]})]})]})]})}function h({label:t,entity:n,onClick:i}){const a=L[n.type]??"🔹";return e.jsxs("div",{className:"rounded border border-c4a-border-subtle bg-c4a-bg-surface p-3 cursor-pointer hover:border-c4a-accent transition-colors min-w-[160px]",onClick:i,children:[e.jsx("p",{className:"text-[10px] font-mono uppercase text-c4a-text-muted mb-1",children:t}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:a}),e.jsx("span",{className:"font-mono text-sm text-c4a-text-primary truncate",children:n.name})]}),e.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[e.jsx(l,{children:n.type}),n.kind&&e.jsx(l,{variant:"muted",children:n.kind})]})]})}export{I as RelationDetail};
@@ -0,0 +1 @@
1
+ import{b as v,c as _,a as y,r as c,d as p,A as C,j as e,E}from"./index-BoqItESG.js";import{c as S,D as w,B as l,s as u,J as D}from"./JsonTree-Dd_iNoWA.js";import{C as k}from"./ContentCard-_I22pq8z.js";const L={Component:"🏗",SoR:"📋",Product:"📦",Container:"📂",Contract:"📝",Epic:"🎯"};function R(t){try{return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return t}}function I(){const{t}=v(),{relationId:n}=_(),i=y(),[a,f]=c.useState(null),[o,d]=c.useState(null),[x,j]=c.useState([]),[g,m]=c.useState(!1);if(c.useEffect(()=>{n&&(d(null),p.get(`/relations/${n}`).then(s=>{f(s),p.get(`/relations/${n}/contents`).then(N=>{j(N.contents??[]),m(!0)}).catch(()=>m(!0))}).catch(s=>{s instanceof C&&s.status===404?d("not_found"):d("load_failed")}))},[n]),o)return e.jsx("div",{className:"flex flex-1 flex-col p-4 md:p-6",children:e.jsx(E,{title:t(`common.error.${o}`),description:t(`common.error.${o}_description`)})});if(!a)return e.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:e.jsx("p",{className:"text-sm text-c4a-text-muted",children:t("common.loading")})});const r=S(a.confidence),b=a.metadata?._source==="field_sync"?t("relation.detail.source_field_sync"):t("relation.detail.source_explicit");return e.jsxs("div",{className:"flex flex-1 flex-col p-4 md:p-6",children:[e.jsx(w,{icon:e.jsx("span",{children:"🔗"}),title:a.type,badges:r?[e.jsx(l,{variant:r.variant,tooltip:`confidence: ${r.value}`,children:t(r.labelKey)},"conf")]:[],meta:[...a.weight!==void 0?[{label:t("relation.detail.weight"),value:String(a.weight)}]:[],...r?[{label:t("relation.detail.confidence"),value:t(r.labelKey)}]:[]]}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-4",children:[e.jsx(h,{label:t("relation.detail.from"),entity:a.from,onClick:()=>i(u.entity(a.from.id))}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-c4a-text-muted text-lg",children:"→"}),e.jsx(l,{variant:"accent",children:a.type}),e.jsx("span",{className:"text-c4a-text-muted text-lg",children:"→"})]}),e.jsx(h,{label:t("relation.detail.to"),entity:a.to,onClick:()=>i(u.entity(a.to.id))})]}),!!a.data.description&&e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"font-mono text-xs uppercase text-c4a-text-muted mb-1.5",children:t("relation.detail.description")}),e.jsx("p",{className:"text-sm text-c4a-text-secondary",children:String(a.data.description)})]}),Object.keys(a.data).filter(s=>s!=="description").length>0&&e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"font-mono text-xs uppercase text-c4a-text-muted mb-1.5",children:t("relation.detail.data")}),e.jsx("div",{className:"rounded border border-c4a-border-subtle bg-c4a-bg-surface p-3",children:e.jsx(D,{data:Object.fromEntries(Object.entries(a.data).filter(([s])=>s!=="description")),defaultExpanded:2})})]}),g&&x.length>0&&e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"font-mono text-xs uppercase text-c4a-text-muted mb-1.5",children:t("relation.detail.source_refs")}),e.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:x.map(s=>e.jsx(k,{content:{hash_id:s.hash_id,...s.source_path?{source_path:s.source_path}:{},...s.span?{span:s.span}:{}}},s.hash_id))})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"font-mono text-xs uppercase text-c4a-text-muted mb-1.5",children:t("relation.detail.meta")}),e.jsxs("div",{className:"flex flex-wrap gap-4 text-xs",children:[e.jsxs("span",{className:"text-c4a-text-muted",children:[t("relation.detail.source_label"),":",e.jsx("span",{className:"text-c4a-text-secondary ml-1",children:b})]}),a.metadata?.created_at&&e.jsxs("span",{className:"text-c4a-text-muted",children:[t("content.detail.created_at"),":",e.jsx("span",{className:"text-c4a-text-secondary ml-1",children:R(String(a.metadata.created_at))})]})]})]})]})}function h({label:t,entity:n,onClick:i}){const a=L[n.type]??"🔹";return e.jsxs("div",{className:"rounded border border-c4a-border-subtle bg-c4a-bg-surface p-3 cursor-pointer hover:border-c4a-accent transition-colors min-w-[160px]",onClick:i,children:[e.jsx("p",{className:"text-[10px] font-mono uppercase text-c4a-text-muted mb-1",children:t}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:a}),e.jsx("span",{className:"font-mono text-sm text-c4a-text-primary truncate",children:n.name})]}),e.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[e.jsx(l,{children:n.type}),n.kind&&e.jsx(l,{variant:"muted",children:n.kind})]})]})}export{I as RelationDetail};
@@ -0,0 +1 @@
1
+ import{a,b as n,j as e,R as l}from"./index-BLskFmu3.js";function r(){const{t:s}=a(),{relationId:t}=n();return t?e.jsx("div",{className:"flex flex-1 flex-col p-4 md:p-6",children:e.jsx(l,{relationId:t})}):e.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:e.jsx("p",{className:"text-sm text-c4a-text-muted",children:s("common.loading")})})}export{r as RelationDetail};
@@ -0,0 +1 @@
1
+ const e=Object.freeze(JSON.parse('{"colors":{"activityBar.background":"#23262E","activityBar.dropBackground":"#3a404e","activityBar.foreground":"#BAAFC0","activityBarBadge.background":"#00b0ff","activityBarBadge.foreground":"#20232B","badge.background":"#00b0ff","badge.foreground":"#20232B","button.background":"#00e8c5cc","button.hoverBackground":"#07d4b6cc","debugExceptionWidget.background":"#FF9F2E60","debugExceptionWidget.border":"#FF9F2E60","debugToolBar.background":"#20232A","diffEditor.insertedTextBackground":"#29BF1220","diffEditor.removedTextBackground":"#F21B3F20","dropdown.background":"#2b303b","dropdown.border":"#363c49","editor.background":"#23262E","editor.findMatchBackground":"#f39d1256","editor.findMatchBorder":"#f39d12b6","editor.findMatchHighlightBackground":"#59b8b377","editor.foreground":"#D5CED9","editor.hoverHighlightBackground":"#373941","editor.lineHighlightBackground":"#2e323d","editor.lineHighlightBorder":"#2e323d","editor.rangeHighlightBackground":"#372F3C","editor.selectionBackground":"#3D4352","editor.selectionHighlightBackground":"#4F435580","editor.wordHighlightBackground":"#4F4355","editor.wordHighlightStrongBackground":"#db45a280","editorBracketMatch.background":"#746f77","editorBracketMatch.border":"#746f77","editorCodeLens.foreground":"#746f77","editorCursor.foreground":"#FFF","editorError.foreground":"#FC644D","editorGroup.background":"#23262E","editorGroup.dropBackground":"#495061d7","editorGroupHeader.tabsBackground":"#23262E","editorGutter.addedBackground":"#9BC53DBB","editorGutter.deletedBackground":"#FC644DBB","editorGutter.modifiedBackground":"#5BC0EBBB","editorHoverWidget.background":"#373941","editorHoverWidget.border":"#00e8c5cc","editorIndentGuide.activeBackground":"#585C66","editorIndentGuide.background":"#333844","editorLineNumber.foreground":"#746f77","editorLink.activeForeground":"#3B79C7","editorOverviewRuler.border":"#1B1D23","editorRuler.foreground":"#4F4355","editorSuggestWidget.background":"#20232A","editorSuggestWidget.border":"#372F3C","editorSuggestWidget.selectedBackground":"#373941","editorWarning.foreground":"#FF9F2E","editorWhitespace.foreground":"#333844","editorWidget.background":"#20232A","errorForeground":"#FC644D","extensionButton.prominentBackground":"#07d4b6cc","extensionButton.prominentHoverBackground":"#07d4b5b0","focusBorder":"#746f77","foreground":"#D5CED9","gitDecoration.ignoredResourceForeground":"#555555","input.background":"#2b303b","input.placeholderForeground":"#746f77","inputOption.activeBorder":"#C668BA","inputValidation.errorBackground":"#D65343","inputValidation.errorBorder":"#D65343","inputValidation.infoBackground":"#3A6395","inputValidation.infoBorder":"#3A6395","inputValidation.warningBackground":"#DE9237","inputValidation.warningBorder":"#DE9237","list.activeSelectionBackground":"#23262E","list.activeSelectionForeground":"#00e8c6","list.dropBackground":"#3a404e","list.focusBackground":"#282b35","list.focusForeground":"#eee","list.hoverBackground":"#23262E","list.hoverForeground":"#eee","list.inactiveSelectionBackground":"#23262E","list.inactiveSelectionForeground":"#00e8c6","merge.currentContentBackground":"#F9267240","merge.currentHeaderBackground":"#F92672","merge.incomingContentBackground":"#3B79C740","merge.incomingHeaderBackground":"#3B79C7BB","minimapSlider.activeBackground":"#60698060","minimapSlider.background":"#58607460","minimapSlider.hoverBackground":"#60698060","notification.background":"#2d313b","notification.buttonBackground":"#00e8c5cc","notification.buttonHoverBackground":"#07d4b5b0","notification.errorBackground":"#FC644D","notification.infoBackground":"#00b0ff","notification.warningBackground":"#FF9F2E","panel.background":"#23262E","panel.border":"#1B1D23","panelTitle.activeBorder":"#23262E","panelTitle.inactiveForeground":"#746f77","peekView.border":"#23262E","peekViewEditor.background":"#1A1C22","peekViewEditor.matchHighlightBackground":"#FF9F2E60","peekViewResult.background":"#1A1C22","peekViewResult.matchHighlightBackground":"#FF9F2E60","peekViewResult.selectionBackground":"#23262E","peekViewTitle.background":"#1A1C22","peekViewTitleDescription.foreground":"#746f77","pickerGroup.border":"#4F4355","pickerGroup.foreground":"#746f77","progressBar.background":"#C668BA","scrollbar.shadow":"#23262E","scrollbarSlider.activeBackground":"#3A3F4CCC","scrollbarSlider.background":"#3A3F4C77","scrollbarSlider.hoverBackground":"#3A3F4CAA","selection.background":"#746f77","sideBar.background":"#23262E","sideBar.foreground":"#999999","sideBarSectionHeader.background":"#23262E","sideBarTitle.foreground":"#00e8c6","statusBar.background":"#23262E","statusBar.debuggingBackground":"#FC644D","statusBar.noFolderBackground":"#23262E","statusBarItem.activeBackground":"#00e8c5cc","statusBarItem.hoverBackground":"#07d4b5b0","statusBarItem.prominentBackground":"#07d4b5b0","statusBarItem.prominentHoverBackground":"#00e8c5cc","tab.activeBackground":"#23262e","tab.activeBorder":"#00e8c6","tab.activeForeground":"#00e8c6","tab.inactiveBackground":"#23262E","tab.inactiveForeground":"#746f77","terminal.ansiBlue":"#7cb7ff","terminal.ansiBrightBlue":"#7cb7ff","terminal.ansiBrightCyan":"#00e8c6","terminal.ansiBrightGreen":"#96E072","terminal.ansiBrightMagenta":"#ff00aa","terminal.ansiBrightRed":"#ee5d43","terminal.ansiBrightYellow":"#FFE66D","terminal.ansiCyan":"#00e8c6","terminal.ansiGreen":"#96E072","terminal.ansiMagenta":"#ff00aa","terminal.ansiRed":"#ee5d43","terminal.ansiYellow":"#FFE66D","terminalCursor.background":"#23262E","terminalCursor.foreground":"#FFE66D","titleBar.activeBackground":"#23262E","walkThrough.embeddedEditorBackground":"#23262E","widget.shadow":"#14151A"},"displayName":"Andromeeda","name":"andromeeda","semanticTokenColors":{"property.declaration:javascript":"#D5CED9","variable.defaultLibrary:javascript":"#f39c12"},"tokenColors":[{"settings":{"background":"#23262E","foreground":"#D5CED9"}},{"scope":["comment","markup.quote.markdown","meta.diff","meta.diff.header"],"settings":{"foreground":"#A0A1A7cc"}},{"scope":["meta.template.expression.js","constant.name.attribute.tag.jade","punctuation.definition.metadata.markdown","punctuation.definition.string.end.markdown","punctuation.definition.string.begin.markdown","string.unquoted.cmake"],"settings":{"foreground":"#D5CED9"}},{"scope":["variable","support.variable","entity.name.tag.yaml","constant.character.entity.html","source.css entity.name.tag.reference","beginning.punctuation.definition.list.markdown","source.css entity.other.attribute-name.parent-selector","meta.structure.dictionary.json support.type.property-name"],"settings":{"foreground":"#00e8c6"}},{"scope":["markup.bold","constant.numeric","meta.group.regexp","constant.other.php","support.constant.ext.php","constant.other.class.php","support.constant.core.php","fenced_code.block.language","constant.other.caps.python","entity.other.attribute-name","support.type.exception.python","source.css keyword.other.unit","variable.other.object.property.js.jsx","variable.other.object.js"],"settings":{"foreground":"#f39c12"}},{"scope":["markup.list","text.xml string","entity.name.type","support.function","entity.other.attribute-name","meta.at-rule.extend","entity.name.function","entity.other.inherited-class","entity.other.keyframe-offset.css","text.html.markdown string.quoted","meta.function-call.generic.python","meta.at-rule.extend support.constant","entity.other.attribute-name.class.jade","source.css entity.other.attribute-name","text.xml punctuation.definition.string"],"settings":{"foreground":"#FFE66D"}},{"scope":["markup.heading","variable.language.this.js","variable.language.special.self.python"],"settings":{"foreground":"#ff00aa"}},{"scope":["punctuation.definition.interpolation","punctuation.section.embedded.end.php","punctuation.section.embedded.end.ruby","punctuation.section.embedded.begin.php","punctuation.section.embedded.begin.ruby","punctuation.definition.template-expression","entity.name.tag"],"settings":{"foreground":"#f92672"}},{"scope":["storage","keyword","meta.link","meta.image","markup.italic","source.js support.type","support.type"],"settings":{"foreground":"#c74ded"}},{"scope":["string.regexp","markup.changed"],"settings":{"foreground":"#7cb7ff"}},{"scope":["constant","support.class","keyword.operator","support.constant","text.html.markdown string","source.css support.function","source.php support.function","support.function.magic.python","entity.other.attribute-name.id","markup.deleted"],"settings":{"foreground":"#ee5d43"}},{"scope":["string","text.html.php string","markup.inline.raw","markup.inserted","punctuation.definition.string","punctuation.definition.markdown","text.html meta.embedded source.js string","text.html.php punctuation.definition.string","text.html meta.embedded source.js punctuation.definition.string","text.html punctuation.definition.string","text.html string"],"settings":{"foreground":"#96E072"}},{"scope":["entity.other.inherited-class"],"settings":{"fontStyle":"underline"}}],"type":"dark"}'));export{e as default};