@geoscene/ai-components 0.0.0-stage → 5.1.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 (549) hide show
  1. package/LICENSE.md +18 -0
  2. package/README.md +2 -3
  3. package/dist/agent-utils/BaseAgent.d.ts +90 -0
  4. package/dist/agent-utils/BaseAgent.js +87 -0
  5. package/dist/agent-utils/FunctionAgent.d.ts +64 -0
  6. package/dist/agent-utils/FunctionAgent.js +98 -0
  7. package/dist/agent-utils/LLMAgent.d.ts +65 -0
  8. package/dist/agent-utils/LLMAgent.js +140 -0
  9. package/dist/agent-utils/WorkflowAgent.d.ts +44 -0
  10. package/dist/agent-utils/WorkflowAgent.js +70 -0
  11. package/dist/agent-utils/index.d.ts +177 -0
  12. package/dist/agent-utils/index.js +167 -0
  13. package/dist/agent-utils/middlewares/humanInTheLoop.d.ts +152 -0
  14. package/dist/agent-utils/middlewares/humanInTheLoop.js +94 -0
  15. package/dist/agent-utils/middlewares/middleware.d.ts +25 -0
  16. package/dist/agent-utils/middlewares/middleware.js +44 -0
  17. package/dist/agent-utils/middlewares/trace.d.ts +27 -0
  18. package/dist/agent-utils/middlewares/trace.js +42 -0
  19. package/dist/agent-utils/middlewares/types.d.ts +123 -0
  20. package/dist/agent-utils/middlewares/types.js +1 -0
  21. package/dist/agent-utils/tools/FunctionTool.d.ts +127 -0
  22. package/dist/agent-utils/tools/FunctionTool.js +80 -0
  23. package/dist/agent-utils/types.d.ts +181 -0
  24. package/dist/agent-utils/workflows/BaseWorkflow.d.ts +87 -0
  25. package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +72 -0
  26. package/dist/agent-utils/workflows/ConditionalWorkflow.js +61 -0
  27. package/dist/agent-utils/workflows/LoopWorkflow.d.ts +58 -0
  28. package/dist/agent-utils/workflows/LoopWorkflow.js +56 -0
  29. package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +68 -0
  30. package/dist/agent-utils/workflows/ParallelWorkflow.js +129 -0
  31. package/dist/agent-utils/workflows/RouterWorkflow.d.ts +63 -0
  32. package/dist/agent-utils/workflows/RouterWorkflow.js +75 -0
  33. package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +56 -0
  34. package/dist/agent-utils/workflows/SequentialWorkflow.js +69 -0
  35. package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +74 -0
  36. package/dist/agent-utils/workflows/SwitchWorkflow.js +84 -0
  37. package/dist/assets/embeddings.worker-k9_Ou679.js +1 -0
  38. package/dist/cdn/22TUPT3D.js +2 -0
  39. package/dist/cdn/27BBMHFA.js +3 -0
  40. package/dist/cdn/2FYXUV7O.js +30 -0
  41. package/dist/cdn/3Y723IJS.js +2 -0
  42. package/dist/cdn/45POUVZK.js +2 -0
  43. package/dist/cdn/46U2PGRW.js +65 -0
  44. package/dist/cdn/4ASZF5I2.js +181 -0
  45. package/dist/cdn/4BA4OUWC.js +101 -0
  46. package/dist/cdn/4EALV6QJ.js +2 -0
  47. package/dist/cdn/53Z3R4OY.js +95 -0
  48. package/dist/cdn/5RQUSM3T.js +132 -0
  49. package/dist/cdn/6FEB6XYK.js +2 -0
  50. package/dist/cdn/6TB6FVGF.js +9 -0
  51. package/dist/cdn/72TH3ONI.js +2 -0
  52. package/dist/cdn/77GAVZIK.js +62 -0
  53. package/dist/cdn/7CCULIWM.js +2 -0
  54. package/dist/cdn/7WSTR3WA.js +2 -0
  55. package/dist/cdn/AJKWCXDA.js +46 -0
  56. package/dist/cdn/AXOPGQGZ.js +2 -0
  57. package/dist/cdn/B35MHQJD.js +2 -0
  58. package/dist/cdn/BUTKUPXN.js +33 -0
  59. package/dist/cdn/CFDTXKJ6.js +2 -0
  60. package/dist/cdn/CU2TRUZQ.js +93 -0
  61. package/dist/cdn/D3KUKNJ7.js +11 -0
  62. package/dist/cdn/DHGNGMNJ.js +2 -0
  63. package/dist/cdn/DKNDDDWM.js +2 -0
  64. package/dist/cdn/ESRKMM6P.js +2 -0
  65. package/dist/cdn/FFXK76K7.js +2 -0
  66. package/dist/cdn/FYNHAVHL.js +2 -0
  67. package/dist/cdn/G7XK3XOR.js +77 -0
  68. package/dist/cdn/GHNP3LDR.js +2 -0
  69. package/dist/cdn/GI2NZ45U.js +4 -0
  70. package/dist/cdn/GTXGIROA.js +2 -0
  71. package/dist/cdn/H3EEFM4A.js +179 -0
  72. package/dist/cdn/HCD4CDWZ.js +2 -0
  73. package/dist/cdn/HJGF7W5O.js +35 -0
  74. package/dist/cdn/HK4HSYKG.js +2 -0
  75. package/dist/cdn/I55TMNNP.js +2 -0
  76. package/dist/cdn/ILGFFHXZ.js +2 -0
  77. package/dist/cdn/INJ2KWHS.js +2 -0
  78. package/dist/cdn/KBFL7LCS.js +2 -0
  79. package/dist/cdn/KGYSBUFO.js +9 -0
  80. package/dist/cdn/KLSCVMLN.js +13 -0
  81. package/dist/cdn/L6GVMINQ.js +2 -0
  82. package/dist/cdn/LTPDBXQ7.js +6 -0
  83. package/dist/cdn/LUY7QCZ3.js +2 -0
  84. package/dist/cdn/LXJWWOGK.js +66 -0
  85. package/dist/cdn/M7C6Y752.js +2 -0
  86. package/dist/cdn/MFZCTEAG.js +2 -0
  87. package/dist/cdn/MQ7QXIOW.js +52 -0
  88. package/dist/cdn/N2SKXRLK.js +65 -0
  89. package/dist/cdn/N5XXTTDR.js +2 -0
  90. package/dist/cdn/NHDPNQXA.js +36 -0
  91. package/dist/cdn/NMWLJECU.js +109 -0
  92. package/dist/cdn/OBDCCGVH.js +2 -0
  93. package/dist/cdn/P5M2HNJ7.js +2 -0
  94. package/dist/cdn/PFW7KXCP.js +48 -0
  95. package/dist/cdn/PIUDMACH.js +56 -0
  96. package/dist/cdn/PKH5BECA.js +2 -0
  97. package/dist/cdn/PTKZXFXB.js +27 -0
  98. package/dist/cdn/Q7FTL7JO.js +2 -0
  99. package/dist/cdn/QH6TSBNI.js +2 -0
  100. package/dist/cdn/QZXQIJSW.js +2 -0
  101. package/dist/cdn/TFPBGM6P.js +2 -0
  102. package/dist/cdn/THLZTO23.js +12 -0
  103. package/dist/cdn/TIXCHLEN.js +121 -0
  104. package/dist/cdn/TOYQ22PR.js +2 -0
  105. package/dist/cdn/U72SSJEL.js +2 -0
  106. package/dist/cdn/UDXMJNRF.js +3 -0
  107. package/dist/cdn/UE3CP46P.js +2 -0
  108. package/dist/cdn/URYKQKFE.js +3 -0
  109. package/dist/cdn/VBS2ZXKT.js +3 -0
  110. package/dist/cdn/VDAF255D.js +22 -0
  111. package/dist/cdn/VG7HRDJX.js +2 -0
  112. package/dist/cdn/VPZHLYPA.js +2 -0
  113. package/dist/cdn/VWMJ7HIK.js +66 -0
  114. package/dist/cdn/WNJM5TET.js +2 -0
  115. package/dist/cdn/XTEMZD4A.js +2 -0
  116. package/dist/cdn/Y5GGIKKC.js +2 -0
  117. package/dist/cdn/YULWPVJ3.js +2 -0
  118. package/dist/cdn/YURWID37.js +2 -0
  119. package/dist/cdn/ZDJM4RRH.js +2 -0
  120. package/dist/cdn/ZGUVZMYR.js +157 -0
  121. package/dist/cdn/agent-utils/index.js +2 -0
  122. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +3 -0
  123. package/dist/cdn/agent-utils/middlewares/middleware.js +2 -0
  124. package/dist/cdn/agent-utils/middlewares/trace.js +2 -0
  125. package/dist/cdn/assets/assistant/t9n/messages.ar.json +1 -0
  126. package/dist/cdn/assets/assistant/t9n/messages.bg.json +1 -0
  127. package/dist/cdn/assets/assistant/t9n/messages.bs.json +1 -0
  128. package/dist/cdn/assets/assistant/t9n/messages.ca.json +1 -0
  129. package/dist/cdn/assets/assistant/t9n/messages.cs.json +1 -0
  130. package/dist/cdn/assets/assistant/t9n/messages.da.json +1 -0
  131. package/dist/cdn/assets/assistant/t9n/messages.de.json +1 -0
  132. package/dist/cdn/assets/assistant/t9n/messages.el.json +1 -0
  133. package/dist/cdn/assets/assistant/t9n/messages.en.json +1 -0
  134. package/dist/cdn/assets/assistant/t9n/messages.es.json +1 -0
  135. package/dist/cdn/assets/assistant/t9n/messages.et.json +1 -0
  136. package/dist/cdn/assets/assistant/t9n/messages.fi.json +1 -0
  137. package/dist/cdn/assets/assistant/t9n/messages.fr.json +1 -0
  138. package/dist/cdn/assets/assistant/t9n/messages.he.json +1 -0
  139. package/dist/cdn/assets/assistant/t9n/messages.hr.json +1 -0
  140. package/dist/cdn/assets/assistant/t9n/messages.hu.json +1 -0
  141. package/dist/cdn/assets/assistant/t9n/messages.id.json +1 -0
  142. package/dist/cdn/assets/assistant/t9n/messages.it.json +1 -0
  143. package/dist/cdn/assets/assistant/t9n/messages.ja.json +1 -0
  144. package/dist/cdn/assets/assistant/t9n/messages.ko.json +1 -0
  145. package/dist/cdn/assets/assistant/t9n/messages.lt.json +1 -0
  146. package/dist/cdn/assets/assistant/t9n/messages.lv.json +1 -0
  147. package/dist/cdn/assets/assistant/t9n/messages.nl.json +1 -0
  148. package/dist/cdn/assets/assistant/t9n/messages.no.json +1 -0
  149. package/dist/cdn/assets/assistant/t9n/messages.pl.json +1 -0
  150. package/dist/cdn/assets/assistant/t9n/messages.pt-BR.json +1 -0
  151. package/dist/cdn/assets/assistant/t9n/messages.pt-PT.json +1 -0
  152. package/dist/cdn/assets/assistant/t9n/messages.ro.json +1 -0
  153. package/dist/cdn/assets/assistant/t9n/messages.ru.json +1 -0
  154. package/dist/cdn/assets/assistant/t9n/messages.sk.json +1 -0
  155. package/dist/cdn/assets/assistant/t9n/messages.sl.json +1 -0
  156. package/dist/cdn/assets/assistant/t9n/messages.sr.json +1 -0
  157. package/dist/cdn/assets/assistant/t9n/messages.sv.json +1 -0
  158. package/dist/cdn/assets/assistant/t9n/messages.th.json +1 -0
  159. package/dist/cdn/assets/assistant/t9n/messages.tr.json +1 -0
  160. package/dist/cdn/assets/assistant/t9n/messages.uk.json +1 -0
  161. package/dist/cdn/assets/assistant/t9n/messages.vi.json +1 -0
  162. package/dist/cdn/assets/assistant/t9n/messages.zh-CN.json +1 -0
  163. package/dist/cdn/assets/assistant/t9n/messages.zh-HK.json +1 -0
  164. package/dist/cdn/assets/assistant/t9n/messages.zh-TW.json +1 -0
  165. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ar.json +1 -0
  166. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.bg.json +1 -0
  167. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.bs.json +1 -0
  168. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ca.json +1 -0
  169. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.cs.json +1 -0
  170. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.da.json +1 -0
  171. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.de.json +1 -0
  172. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.el.json +1 -0
  173. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.en.json +1 -0
  174. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.es.json +1 -0
  175. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.et.json +1 -0
  176. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.fi.json +1 -0
  177. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.fr.json +1 -0
  178. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.he.json +1 -0
  179. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.hr.json +1 -0
  180. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.hu.json +1 -0
  181. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.id.json +1 -0
  182. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.it.json +1 -0
  183. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ja.json +1 -0
  184. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ko.json +1 -0
  185. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.lt.json +1 -0
  186. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.lv.json +1 -0
  187. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.nl.json +1 -0
  188. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.no.json +1 -0
  189. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.pl.json +1 -0
  190. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.pt-BR.json +1 -0
  191. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.pt-PT.json +1 -0
  192. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ro.json +1 -0
  193. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ru.json +1 -0
  194. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.sk.json +1 -0
  195. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.sl.json +1 -0
  196. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.sr.json +1 -0
  197. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.sv.json +1 -0
  198. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.th.json +1 -0
  199. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.tr.json +1 -0
  200. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.uk.json +1 -0
  201. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.vi.json +1 -0
  202. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.zh-CN.json +1 -0
  203. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.zh-HK.json +1 -0
  204. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.zh-TW.json +1 -0
  205. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ar.json +1 -0
  206. package/dist/cdn/assets/assistant-interrupt/t9n/messages.bg.json +1 -0
  207. package/dist/cdn/assets/assistant-interrupt/t9n/messages.bs.json +1 -0
  208. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ca.json +1 -0
  209. package/dist/cdn/assets/assistant-interrupt/t9n/messages.cs.json +1 -0
  210. package/dist/cdn/assets/assistant-interrupt/t9n/messages.da.json +1 -0
  211. package/dist/cdn/assets/assistant-interrupt/t9n/messages.de.json +1 -0
  212. package/dist/cdn/assets/assistant-interrupt/t9n/messages.el.json +1 -0
  213. package/dist/cdn/assets/assistant-interrupt/t9n/messages.en.json +1 -0
  214. package/dist/cdn/assets/assistant-interrupt/t9n/messages.es.json +1 -0
  215. package/dist/cdn/assets/assistant-interrupt/t9n/messages.et.json +1 -0
  216. package/dist/cdn/assets/assistant-interrupt/t9n/messages.fi.json +1 -0
  217. package/dist/cdn/assets/assistant-interrupt/t9n/messages.fr.json +1 -0
  218. package/dist/cdn/assets/assistant-interrupt/t9n/messages.he.json +1 -0
  219. package/dist/cdn/assets/assistant-interrupt/t9n/messages.hr.json +1 -0
  220. package/dist/cdn/assets/assistant-interrupt/t9n/messages.hu.json +1 -0
  221. package/dist/cdn/assets/assistant-interrupt/t9n/messages.id.json +1 -0
  222. package/dist/cdn/assets/assistant-interrupt/t9n/messages.it.json +1 -0
  223. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ja.json +1 -0
  224. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ko.json +1 -0
  225. package/dist/cdn/assets/assistant-interrupt/t9n/messages.lt.json +1 -0
  226. package/dist/cdn/assets/assistant-interrupt/t9n/messages.lv.json +1 -0
  227. package/dist/cdn/assets/assistant-interrupt/t9n/messages.nl.json +1 -0
  228. package/dist/cdn/assets/assistant-interrupt/t9n/messages.no.json +1 -0
  229. package/dist/cdn/assets/assistant-interrupt/t9n/messages.pl.json +1 -0
  230. package/dist/cdn/assets/assistant-interrupt/t9n/messages.pt-BR.json +1 -0
  231. package/dist/cdn/assets/assistant-interrupt/t9n/messages.pt-PT.json +1 -0
  232. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ro.json +1 -0
  233. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ru.json +1 -0
  234. package/dist/cdn/assets/assistant-interrupt/t9n/messages.sk.json +1 -0
  235. package/dist/cdn/assets/assistant-interrupt/t9n/messages.sl.json +1 -0
  236. package/dist/cdn/assets/assistant-interrupt/t9n/messages.sr.json +1 -0
  237. package/dist/cdn/assets/assistant-interrupt/t9n/messages.sv.json +1 -0
  238. package/dist/cdn/assets/assistant-interrupt/t9n/messages.th.json +1 -0
  239. package/dist/cdn/assets/assistant-interrupt/t9n/messages.tr.json +1 -0
  240. package/dist/cdn/assets/assistant-interrupt/t9n/messages.uk.json +1 -0
  241. package/dist/cdn/assets/assistant-interrupt/t9n/messages.vi.json +1 -0
  242. package/dist/cdn/assets/assistant-interrupt/t9n/messages.zh-CN.json +1 -0
  243. package/dist/cdn/assets/assistant-interrupt/t9n/messages.zh-HK.json +1 -0
  244. package/dist/cdn/assets/assistant-interrupt/t9n/messages.zh-TW.json +1 -0
  245. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ar.json +1 -0
  246. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.bg.json +1 -0
  247. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.bs.json +1 -0
  248. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ca.json +1 -0
  249. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.cs.json +1 -0
  250. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.da.json +1 -0
  251. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.de.json +1 -0
  252. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.el.json +1 -0
  253. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.en.json +1 -0
  254. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.es.json +1 -0
  255. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.et.json +1 -0
  256. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.fi.json +1 -0
  257. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.fr.json +1 -0
  258. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.he.json +1 -0
  259. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.hr.json +1 -0
  260. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.hu.json +1 -0
  261. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.id.json +1 -0
  262. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.it.json +1 -0
  263. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ja.json +1 -0
  264. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ko.json +1 -0
  265. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.lt.json +1 -0
  266. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.lv.json +1 -0
  267. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.nl.json +1 -0
  268. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.no.json +1 -0
  269. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.pl.json +1 -0
  270. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.pt-BR.json +1 -0
  271. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.pt-PT.json +1 -0
  272. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ro.json +1 -0
  273. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ru.json +1 -0
  274. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.sk.json +1 -0
  275. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.sl.json +1 -0
  276. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.sr.json +1 -0
  277. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.sv.json +1 -0
  278. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.th.json +1 -0
  279. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.tr.json +1 -0
  280. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.uk.json +1 -0
  281. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.vi.json +1 -0
  282. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.zh-CN.json +1 -0
  283. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.zh-HK.json +1 -0
  284. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.zh-TW.json +1 -0
  285. package/dist/cdn/assets/assistant-message-footer/t9n/messages.ar.json +1 -0
  286. package/dist/cdn/assets/assistant-message-footer/t9n/messages.bg.json +1 -0
  287. package/dist/cdn/assets/assistant-message-footer/t9n/messages.bs.json +1 -0
  288. package/dist/cdn/assets/assistant-message-footer/t9n/messages.ca.json +1 -0
  289. package/dist/cdn/assets/assistant-message-footer/t9n/messages.cs.json +1 -0
  290. package/dist/cdn/assets/assistant-message-footer/t9n/messages.da.json +1 -0
  291. package/dist/cdn/assets/assistant-message-footer/t9n/messages.de.json +1 -0
  292. package/dist/cdn/assets/assistant-message-footer/t9n/messages.el.json +1 -0
  293. package/dist/cdn/assets/assistant-message-footer/t9n/messages.en.json +1 -0
  294. package/dist/cdn/assets/assistant-message-footer/t9n/messages.es.json +1 -0
  295. package/dist/cdn/assets/assistant-message-footer/t9n/messages.et.json +1 -0
  296. package/dist/cdn/assets/assistant-message-footer/t9n/messages.fi.json +1 -0
  297. package/dist/cdn/assets/assistant-message-footer/t9n/messages.fr.json +1 -0
  298. package/dist/cdn/assets/assistant-message-footer/t9n/messages.he.json +1 -0
  299. package/dist/cdn/assets/assistant-message-footer/t9n/messages.hr.json +1 -0
  300. package/dist/cdn/assets/assistant-message-footer/t9n/messages.hu.json +1 -0
  301. package/dist/cdn/assets/assistant-message-footer/t9n/messages.id.json +1 -0
  302. package/dist/cdn/assets/assistant-message-footer/t9n/messages.it.json +1 -0
  303. package/dist/cdn/assets/assistant-message-footer/t9n/messages.ja.json +1 -0
  304. package/dist/cdn/assets/assistant-message-footer/t9n/messages.ko.json +1 -0
  305. package/dist/cdn/assets/assistant-message-footer/t9n/messages.lt.json +1 -0
  306. package/dist/cdn/assets/assistant-message-footer/t9n/messages.lv.json +1 -0
  307. package/dist/cdn/assets/assistant-message-footer/t9n/messages.nl.json +1 -0
  308. package/dist/cdn/assets/assistant-message-footer/t9n/messages.no.json +1 -0
  309. package/dist/cdn/assets/assistant-message-footer/t9n/messages.pl.json +1 -0
  310. package/dist/cdn/assets/assistant-message-footer/t9n/messages.pt-BR.json +1 -0
  311. package/dist/cdn/assets/assistant-message-footer/t9n/messages.pt-PT.json +1 -0
  312. package/dist/cdn/assets/assistant-message-footer/t9n/messages.ro.json +1 -0
  313. package/dist/cdn/assets/assistant-message-footer/t9n/messages.ru.json +1 -0
  314. package/dist/cdn/assets/assistant-message-footer/t9n/messages.sk.json +1 -0
  315. package/dist/cdn/assets/assistant-message-footer/t9n/messages.sl.json +1 -0
  316. package/dist/cdn/assets/assistant-message-footer/t9n/messages.sr.json +1 -0
  317. package/dist/cdn/assets/assistant-message-footer/t9n/messages.sv.json +1 -0
  318. package/dist/cdn/assets/assistant-message-footer/t9n/messages.th.json +1 -0
  319. package/dist/cdn/assets/assistant-message-footer/t9n/messages.tr.json +1 -0
  320. package/dist/cdn/assets/assistant-message-footer/t9n/messages.uk.json +1 -0
  321. package/dist/cdn/assets/assistant-message-footer/t9n/messages.vi.json +1 -0
  322. package/dist/cdn/assets/assistant-message-footer/t9n/messages.zh-CN.json +1 -0
  323. package/dist/cdn/assets/assistant-message-footer/t9n/messages.zh-HK.json +1 -0
  324. package/dist/cdn/assets/assistant-message-footer/t9n/messages.zh-TW.json +1 -0
  325. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ar.json +1 -0
  326. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.bg.json +1 -0
  327. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.bs.json +1 -0
  328. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ca.json +1 -0
  329. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.cs.json +1 -0
  330. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.da.json +1 -0
  331. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.de.json +1 -0
  332. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.el.json +1 -0
  333. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.en.json +1 -0
  334. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.es.json +1 -0
  335. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.et.json +1 -0
  336. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.fi.json +1 -0
  337. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.fr.json +1 -0
  338. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.he.json +1 -0
  339. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.hr.json +1 -0
  340. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.hu.json +1 -0
  341. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.id.json +1 -0
  342. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.it.json +1 -0
  343. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ja.json +1 -0
  344. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ko.json +1 -0
  345. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.lt.json +1 -0
  346. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.lv.json +1 -0
  347. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.nl.json +1 -0
  348. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.no.json +1 -0
  349. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.pl.json +1 -0
  350. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.pt-BR.json +1 -0
  351. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.pt-PT.json +1 -0
  352. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ro.json +1 -0
  353. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ru.json +1 -0
  354. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.sk.json +1 -0
  355. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.sl.json +1 -0
  356. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.sr.json +1 -0
  357. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.sv.json +1 -0
  358. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.th.json +1 -0
  359. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.tr.json +1 -0
  360. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.uk.json +1 -0
  361. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.vi.json +1 -0
  362. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.zh-CN.json +1 -0
  363. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.zh-HK.json +1 -0
  364. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.zh-TW.json +1 -0
  365. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ar.json +1 -0
  366. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.bg.json +1 -0
  367. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.bs.json +1 -0
  368. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ca.json +1 -0
  369. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.cs.json +1 -0
  370. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.da.json +1 -0
  371. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.de.json +1 -0
  372. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.el.json +1 -0
  373. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.en.json +1 -0
  374. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.es.json +1 -0
  375. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.et.json +1 -0
  376. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.fi.json +1 -0
  377. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.fr.json +1 -0
  378. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.he.json +1 -0
  379. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.hr.json +1 -0
  380. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.hu.json +1 -0
  381. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.id.json +1 -0
  382. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.it.json +1 -0
  383. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ja.json +1 -0
  384. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ko.json +1 -0
  385. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.lt.json +1 -0
  386. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.lv.json +1 -0
  387. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.nl.json +1 -0
  388. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.no.json +1 -0
  389. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.pl.json +1 -0
  390. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.pt-BR.json +1 -0
  391. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.pt-PT.json +1 -0
  392. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ro.json +1 -0
  393. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ru.json +1 -0
  394. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.sk.json +1 -0
  395. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.sl.json +1 -0
  396. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.sr.json +1 -0
  397. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.sv.json +1 -0
  398. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.th.json +1 -0
  399. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.tr.json +1 -0
  400. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.uk.json +1 -0
  401. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.vi.json +1 -0
  402. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.zh-CN.json +1 -0
  403. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.zh-HK.json +1 -0
  404. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.zh-TW.json +1 -0
  405. package/dist/cdn/index.js +2 -0
  406. package/dist/cdn/main.css +1 -0
  407. package/dist/chunks/BaseWorkflow.js +107 -0
  408. package/dist/chunks/adapter.js +3148 -0
  409. package/dist/chunks/converterUtils.js +124 -0
  410. package/dist/chunks/dataExplorationGraph.js +319 -0
  411. package/dist/chunks/data_explore_filter_prompt.js +112 -0
  412. package/dist/chunks/data_explore_query_prompt.js +135 -0
  413. package/dist/chunks/embeddings.worker.js +25 -0
  414. package/dist/chunks/field_descriptions_prompt.js +80 -0
  415. package/dist/chunks/generateLayerDescriptions.js +477 -0
  416. package/dist/chunks/geosceneKnowledgeGraph.js +221 -0
  417. package/dist/chunks/geoscene_knowledge_current_lc_context.js +25 -0
  418. package/dist/chunks/geoscene_knowledge_current_map_context.js +36 -0
  419. package/dist/chunks/geoscene_knowledge_cypher_query_prompt.js +96 -0
  420. package/dist/chunks/geoscene_knowledge_lucene_generation_prompt.js +98 -0
  421. package/dist/chunks/geoscene_knowledge_summarize_result_prompt.js +104 -0
  422. package/dist/chunks/geoscene_knowledge_tool_prompt.js +30 -0
  423. package/dist/chunks/graph.js +86 -0
  424. package/dist/chunks/helpGraph.js +117 -0
  425. package/dist/chunks/help_prompt.js +68 -0
  426. package/dist/chunks/index.js +11 -0
  427. package/dist/chunks/intent_prompt.js +124 -0
  428. package/dist/chunks/layerStylingGraph.js +190 -0
  429. package/dist/chunks/layer_descriptions_prompt.js +55 -0
  430. package/dist/chunks/layer_styling_prompt.js +65 -0
  431. package/dist/chunks/navigationGraph.js +265 -0
  432. package/dist/chunks/navigation_intent_prompt.js +49 -0
  433. package/dist/chunks/navigation_tool_prompt.js +38 -0
  434. package/dist/chunks/orchestrator.js +569 -0
  435. package/dist/chunks/runtime.js +15 -0
  436. package/dist/chunks/slottableRequestUtils.js +7 -0
  437. package/dist/chunks/state.js +71 -0
  438. package/dist/chunks/summarize_query_response_prompt.js +69 -0
  439. package/dist/chunks/toolCallResponse.js +32 -0
  440. package/dist/chunks/useT9n.js +7 -0
  441. package/dist/chunks/utils.js +53 -0
  442. package/dist/chunks/utils2.js +47 -0
  443. package/dist/chunks/utils3.js +16 -0
  444. package/dist/components/geoscene-assistant/customElement.d.ts +541 -0
  445. package/dist/components/geoscene-assistant/customElement.js +562 -0
  446. package/dist/components/geoscene-assistant/index.d.ts +1 -0
  447. package/dist/components/geoscene-assistant/index.js +13 -0
  448. package/dist/components/geoscene-assistant/types.d.ts +147 -0
  449. package/dist/components/geoscene-assistant-agent/customElement.d.ts +141 -0
  450. package/dist/components/geoscene-assistant-agent/customElement.js +23 -0
  451. package/dist/components/geoscene-assistant-agent/index.d.ts +1 -0
  452. package/dist/components/geoscene-assistant-agent/index.js +1 -0
  453. package/dist/components/geoscene-assistant-chat/customElement.d.ts +17 -0
  454. package/dist/components/geoscene-assistant-chat/customElement.js +50 -0
  455. package/dist/components/geoscene-assistant-chat/index.d.ts +1 -0
  456. package/dist/components/geoscene-assistant-chat/index.js +1 -0
  457. package/dist/components/geoscene-assistant-chat-entry/customElement.d.ts +37 -0
  458. package/dist/components/geoscene-assistant-chat-entry/customElement.js +85 -0
  459. package/dist/components/geoscene-assistant-chat-entry/index.d.ts +1 -0
  460. package/dist/components/geoscene-assistant-chat-entry/index.js +3 -0
  461. package/dist/components/geoscene-assistant-data-exploration-agent/customElement.d.ts +101 -0
  462. package/dist/components/geoscene-assistant-data-exploration-agent/customElement.js +48 -0
  463. package/dist/components/geoscene-assistant-data-exploration-agent/index.d.ts +1 -0
  464. package/dist/components/geoscene-assistant-data-exploration-agent/index.js +1 -0
  465. package/dist/components/geoscene-assistant-help-agent/customElement.d.ts +73 -0
  466. package/dist/components/geoscene-assistant-help-agent/customElement.js +51 -0
  467. package/dist/components/geoscene-assistant-help-agent/index.d.ts +1 -0
  468. package/dist/components/geoscene-assistant-help-agent/index.js +1 -0
  469. package/dist/components/geoscene-assistant-interrupt/customElement.d.ts +31 -0
  470. package/dist/components/geoscene-assistant-interrupt/customElement.js +37 -0
  471. package/dist/components/geoscene-assistant-interrupt/index.d.ts +1 -0
  472. package/dist/components/geoscene-assistant-interrupt/index.js +6 -0
  473. package/dist/components/geoscene-assistant-interrupt-preview/customElement.js +20 -0
  474. package/dist/components/geoscene-assistant-interrupt-preview/index.js +2 -0
  475. package/dist/components/geoscene-assistant-knowledge-agent/customElement.d.ts +158 -0
  476. package/dist/components/geoscene-assistant-knowledge-agent/customElement.js +74 -0
  477. package/dist/components/geoscene-assistant-knowledge-agent/index.d.ts +1 -0
  478. package/dist/components/geoscene-assistant-knowledge-agent/index.js +1 -0
  479. package/dist/components/geoscene-assistant-layer-styling-agent/customElement.d.ts +8 -0
  480. package/dist/components/geoscene-assistant-layer-styling-agent/customElement.js +51 -0
  481. package/dist/components/geoscene-assistant-layer-styling-agent/index.d.ts +1 -0
  482. package/dist/components/geoscene-assistant-layer-styling-agent/index.js +1 -0
  483. package/dist/components/geoscene-assistant-message/customElement.d.ts +23 -0
  484. package/dist/components/geoscene-assistant-message/customElement.js +45 -0
  485. package/dist/components/geoscene-assistant-message/index.d.ts +1 -0
  486. package/dist/components/geoscene-assistant-message/index.js +5 -0
  487. package/dist/components/geoscene-assistant-message-block/customElement.d.ts +8 -0
  488. package/dist/components/geoscene-assistant-message-block/customElement.js +36 -0
  489. package/dist/components/geoscene-assistant-message-block/index.d.ts +1 -0
  490. package/dist/components/geoscene-assistant-message-block/index.js +3 -0
  491. package/dist/components/geoscene-assistant-message-feedback/customElement.d.ts +26 -0
  492. package/dist/components/geoscene-assistant-message-feedback/customElement.js +36 -0
  493. package/dist/components/geoscene-assistant-message-feedback/index.d.ts +1 -0
  494. package/dist/components/geoscene-assistant-message-feedback/index.js +3 -0
  495. package/dist/components/geoscene-assistant-message-footer/customElement.d.ts +28 -0
  496. package/dist/components/geoscene-assistant-message-footer/customElement.js +62 -0
  497. package/dist/components/geoscene-assistant-message-footer/index.d.ts +1 -0
  498. package/dist/components/geoscene-assistant-message-footer/index.js +6 -0
  499. package/dist/components/geoscene-assistant-message-loading/customElement.d.ts +17 -0
  500. package/dist/components/geoscene-assistant-message-loading/customElement.js +23 -0
  501. package/dist/components/geoscene-assistant-message-loading/index.d.ts +1 -0
  502. package/dist/components/geoscene-assistant-message-loading/index.js +5 -0
  503. package/dist/components/geoscene-assistant-message-log/customElement.d.ts +14 -0
  504. package/dist/components/geoscene-assistant-message-log/customElement.js +29 -0
  505. package/dist/components/geoscene-assistant-message-log/index.d.ts +1 -0
  506. package/dist/components/geoscene-assistant-message-log/index.js +3 -0
  507. package/dist/components/geoscene-assistant-message-read-aloud/customElement.d.ts +22 -0
  508. package/dist/components/geoscene-assistant-message-read-aloud/customElement.js +100 -0
  509. package/dist/components/geoscene-assistant-message-read-aloud/index.d.ts +1 -0
  510. package/dist/components/geoscene-assistant-message-read-aloud/index.js +3 -0
  511. package/dist/components/geoscene-assistant-message-text/customElement.d.ts +11 -0
  512. package/dist/components/geoscene-assistant-message-text/customElement.js +22 -0
  513. package/dist/components/geoscene-assistant-message-text/index.d.ts +1 -0
  514. package/dist/components/geoscene-assistant-message-text/index.js +1 -0
  515. package/dist/components/geoscene-assistant-navigation-agent/customElement.d.ts +81 -0
  516. package/dist/components/geoscene-assistant-navigation-agent/customElement.js +50 -0
  517. package/dist/components/geoscene-assistant-navigation-agent/index.d.ts +1 -0
  518. package/dist/components/geoscene-assistant-navigation-agent/index.js +1 -0
  519. package/dist/components/geoscene-assistant-speech-input/customElement.d.ts +36 -0
  520. package/dist/components/geoscene-assistant-speech-input/customElement.js +488 -0
  521. package/dist/components/geoscene-assistant-speech-input/index.d.ts +1 -0
  522. package/dist/components/geoscene-assistant-speech-input/index.js +2 -0
  523. package/dist/components/geoscene-assistant-speech-input/support/types.d.ts +20 -0
  524. package/dist/components/geoscene-assistant-suggested-prompts/customElement.d.ts +19 -0
  525. package/dist/components/geoscene-assistant-suggested-prompts/customElement.js +27 -0
  526. package/dist/components/geoscene-assistant-suggested-prompts/index.d.ts +1 -0
  527. package/dist/components/geoscene-assistant-suggested-prompts/index.js +3 -0
  528. package/dist/components/geoscene-assistant-user-message/customElement.d.ts +13 -0
  529. package/dist/components/geoscene-assistant-user-message/customElement.js +25 -0
  530. package/dist/components/geoscene-assistant-user-message/index.d.ts +1 -0
  531. package/dist/components/geoscene-assistant-user-message/index.js +2 -0
  532. package/dist/docs/api.json +1 -0
  533. package/dist/docs/docs.json +1 -0
  534. package/dist/docs/vscode.css-custom-data.json +1 -0
  535. package/dist/docs/vscode.html-custom-data.json +1 -0
  536. package/dist/docs/web-types.json +1 -0
  537. package/dist/index.d.ts +158 -0
  538. package/dist/index.js +6 -0
  539. package/dist/loader.d.ts +2 -0
  540. package/dist/loader.js +30 -0
  541. package/dist/oauth-callback.html +31 -0
  542. package/dist/types/components.d.ts +2 -0
  543. package/dist/types/lumina.d.ts +138 -0
  544. package/dist/types/preact.d.ts +164 -0
  545. package/dist/types/react.d.ts +193 -0
  546. package/dist/types/stencil.d.ts +145 -0
  547. package/dist/utils/index.d.ts +542 -0
  548. package/dist/utils/index.js +116 -0
  549. package/package.json +64 -3
@@ -0,0 +1,3148 @@
1
+ /* COPYRIGHT GeoScene - https://js.geoscene.cn/5.1/LICENSE.txt */
2
+ import pe from "@geoscene/core/identity/IdentityManager.js";
3
+ import N from "@geoscene/core/portal/Portal.js";
4
+ import { Annotation as T, messagesStateReducer as be } from "@langchain/langgraph/web";
5
+ import "@geoscene/toolkit/string";
6
+ import { k as Pe, j as H, i as Ae } from "./generateLayerDescriptions.js";
7
+ import "@langchain/core/messages";
8
+ import "@langchain/core/callbacks/dispatch/web";
9
+ import "@langchain/openai";
10
+ import X from "@geoscene/core/config.js";
11
+ import * as Le from "@geoscene/core/core/reactiveUtils.js";
12
+ import "@geoscene/core/layers/FeatureLayer.js";
13
+ import me from "@geoscene/core/request.js";
14
+ import "@langchain/core/prompts";
15
+ import { tool as f } from "@langchain/core/tools";
16
+ import je from "@geoscene/core/Graphic.js";
17
+ import { addressToLocations as Ge } from "@geoscene/core/rest/locator.js";
18
+ import Oe from "@geoscene/core/symbols/PictureMarkerSymbol.js";
19
+ import s, { z as E } from "zod";
20
+ import Me from "@geoscene/core/geometry/Extent.js";
21
+ import Te from "@geoscene/core/geometry/Point.js";
22
+ import { createRenderer as Qe } from "@geoscene/core/smartMapping/renderers/pieChart.js";
23
+ import { getSchemesByTag as _e, getSchemes as We } from "@geoscene/core/smartMapping/symbology/pieChart.js";
24
+ import { getBackgroundColorTheme as he } from "@geoscene/core/views/support/colorUtils.js";
25
+ import { a as R, s as x } from "./index.js";
26
+ import { createAgeRenderer as Ve, createContinuousRenderer as Be } from "@geoscene/core/smartMapping/renderers/color.js";
27
+ import { getSchemesByTag as se } from "@geoscene/core/smartMapping/symbology/color.js";
28
+ import { createContinuousRenderer as Ue } from "@geoscene/core/smartMapping/renderers/univariateColorSize.js";
29
+ import { createRenderer as Ke } from "@geoscene/core/smartMapping/renderers/dotDensity.js";
30
+ import { getSchemesByTag as He } from "@geoscene/core/smartMapping/symbology/dotDensity.js";
31
+ import { createRenderer as Je } from "@geoscene/core/smartMapping/renderers/heatmap.js";
32
+ import { getSchemesByTag as Ye } from "@geoscene/core/smartMapping/symbology/heatmap.js";
33
+ import { createRenderer as Ze } from "@geoscene/core/smartMapping/renderers/predominance.js";
34
+ import { getSchemesByTag as Xe } from "@geoscene/core/smartMapping/symbology/predominance.js";
35
+ import { createRenderer as et } from "@geoscene/core/smartMapping/renderers/relationship.js";
36
+ import { getSchemesByTag as tt } from "@geoscene/core/smartMapping/symbology/relationship.js";
37
+ import { createAgeRenderer as rt, createContinuousRenderer as at } from "@geoscene/core/smartMapping/renderers/size.js";
38
+ import { createRenderer as ot } from "@geoscene/core/smartMapping/renderers/type.js";
39
+ import { getSchemesByTag as nt } from "@geoscene/core/smartMapping/symbology/type.js";
40
+ import { ToolNode as it } from "@langchain/langgraph/prebuilt";
41
+ import st from "@geoscene/core/layers/support/FeatureEffect.js";
42
+ import Se from "@geoscene/core/layers/support/FeatureFilter.js";
43
+ import * as lt from "@geoscene/core/geometry/operators/unionOperator.js";
44
+ import { formatDateOnly as ct, convertDateFormatToIntlOptions as _, formatTimeOnly as ut, formatDate as ye } from "@geoscene/core/intl.js";
45
+ import dt from "@geoscene/core/smartMapping/statistics/summaryStatistics.js";
46
+ import pt from "@geoscene/core/smartMapping/statistics/uniqueValues.js";
47
+ import mt from "@geoscene/core/rest/support/TopFeaturesQuery.js";
48
+ import ht from "@geoscene/core/rest/support/TopFilter.js";
49
+ import yt from "@geoscene/core/WebLinkChart.js";
50
+ import ve from "@geoscene/core/rest/knowledgeGraph/GraphQueryStreaming.js";
51
+ import "@geoscene/core/views/LinkChartView.js";
52
+ import { fetchKnowledgeGraph as fe, executeQueryStreaming as ft, executeSearchStreaming as gt } from "@geoscene/core/rest/knowledgeGraphService.js";
53
+ import wt from "@geoscene/core/rest/knowledgeGraph/GraphSearchStreaming.js";
54
+ import { getBindParametersFromCypherQuery as bt } from "@geoscene/core/applications/KnowledgeStudio/generalSharedKgUtils.js";
55
+ const L = (e, t) => t ?? e, In = T.Root({
56
+ ...Pe(),
57
+ // internal to the navigation agent
58
+ intent: T({
59
+ reducer: L
60
+ }),
61
+ vectorSearchLayerResults: T({
62
+ reducer: L,
63
+ default: () => []
64
+ }),
65
+ vectorSearchFieldResults: T({
66
+ reducer: L
67
+ }),
68
+ navigationInternalState: T({
69
+ reducer: L,
70
+ default: () => ({
71
+ toolCallMessage: void 0
72
+ })
73
+ })
74
+ });
75
+ async function Tt(e, t) {
76
+ const a = N.getDefault().helperServices, o = a.geocode.find((m) => m.name === "GeoScene World Geocoding Service") ?? a.geocode[0];
77
+ if (!o)
78
+ throw new Error("helperServices 中没有地理编码服务。");
79
+ const n = o.url, l = `${X.assetsPath?.endsWith("/") ? X.assetsPath : `${X.assetsPath}/`}geoscene/images/search/search-symbol-32.png`, c = (await Ge(n, {
80
+ address: { SingleLine: e },
81
+ outFields: ["Match_addr"]
82
+ }))?.[0];
83
+ if (!c?.extent || !c.location)
84
+ throw new Error(`未找到以下位置:${e}`);
85
+ const u = new Oe({
86
+ url: l,
87
+ width: 24,
88
+ height: 24
89
+ }), d = new je({
90
+ geometry: c.location,
91
+ symbol: u
92
+ });
93
+ t.graphics.removeAll(), t.graphics.add(d), await t.goTo(c.extent);
94
+ const p = {
95
+ address: c.address ?? "",
96
+ location: c.location ? c.location.toJSON() : null,
97
+ extent: c.extent ? c.extent.toJSON() : null
98
+ };
99
+ return {
100
+ text: `已缩放到 ${e}.`,
101
+ sharedStatePatch: { lastResolvedLocation: { value: p } }
102
+ };
103
+ }
104
+ const St = ["mapView"];
105
+ function C(e) {
106
+ const r = e?.configurable?.context;
107
+ if (!r || typeof r != "object")
108
+ throw new Error("NavigationAgent 缺少上下文");
109
+ const a = St.filter((o) => !(o in r));
110
+ if (a.length)
111
+ throw new Error(`NavigationAgent 缺少上下文:${a.join(", ")}`);
112
+ return r;
113
+ }
114
+ async function vt({ address: e }, t) {
115
+ const { mapView: r } = C(t);
116
+ return await Tt(e, r);
117
+ }
118
+ const xt = s.object({
119
+ address: s.string().describe("要定位的完整地址或地名。")
120
+ }), Dn = f(vt, {
121
+ name: "goToAddress",
122
+ description: "使用 GeoScene 全球地理编码服务解析地址,并将地图缩放到该位置。",
123
+ schema: xt
124
+ });
125
+ async function Rt(e, t) {
126
+ const a = t.map.bookmarks;
127
+ if (!a || a.length === 0)
128
+ throw new Error("地图中没有书签。");
129
+ const o = a.find((l) => l.name === e);
130
+ if (!o)
131
+ throw new Error(`书签“${e}”不存在。`);
132
+ const n = o.viewpoint;
133
+ if (!n)
134
+ throw new Error(`书签“${e}”没有有效视点。`);
135
+ return await t.goTo(n), { text: `已定位到书签:${e}` };
136
+ }
137
+ async function $t({ bookmarkName: e }, t) {
138
+ const { mapView: r } = C(t);
139
+ return await Promise.resolve(Rt(e, r));
140
+ }
141
+ const Ct = E.object({
142
+ bookmarkName: E.string().describe("要定位到的书签名称。")
143
+ }), zn = f($t, {
144
+ name: "goToBookmark",
145
+ description: "定位到指定名称书签的范围。",
146
+ schema: Ct
147
+ });
148
+ async function Et(e, t, r) {
149
+ const a = r.map?.allLayers.find((l) => l.id === e);
150
+ if (!a)
151
+ return { text: `错误:未找到图层,ID 为 ${e},不存在` };
152
+ const o = t?.trim() ? t : "1=1", n = a.createQuery();
153
+ n.where = o;
154
+ try {
155
+ const { extent: l, count: i } = await a.queryExtent(n);
156
+ if (i === 0)
157
+ return { text: `未找到要素,图层为 ${a.title},匹配条件:${o}`, where: o };
158
+ if (l)
159
+ await r.goTo(l);
160
+ else
161
+ return { text: `错误:无法确定以下要素的范围:${a.title}`, where: o };
162
+ const c = {
163
+ layerId: e,
164
+ layerTitle: a.title ?? e,
165
+ where: o,
166
+ count: i
167
+ };
168
+ return {
169
+ text: `已缩放到 ${i} 个要素,所在图层:${a.title},匹配条件:${o}`,
170
+ where: o,
171
+ sharedStatePatch: { lastNavigatedFeatures: { value: c } }
172
+ };
173
+ } catch (l) {
174
+ return console.error("goToFeatures 执行错误:", l), { text: `错误:${l instanceof Error ? l.message : "未知错误"}`, where: o };
175
+ }
176
+ }
177
+ async function Ft({ layerId: e, where: t }, r) {
178
+ const { mapView: a } = C(r);
179
+ return await Et(e, t, a);
180
+ }
181
+ const Nt = E.object({
182
+ layerId: E.string().describe("要缩放到的图层 layerId。"),
183
+ where: E.string().describe(
184
+ "所选图层 query.where 使用的 GeoScene SQL-92 WHERE 表达式。只能使用该图层字段,返回布尔过滤表达式,例如比较、LIKE、IN、BETWEEN、IS NULL、AND/OR/NOT。不得包含子查询、嵌套 SELECT、JOIN、GROUP BY、HAVING、ORDER BY 或分号。"
185
+ )
186
+ }), Pn = f(Ft, {
187
+ name: "goToFeatures",
188
+ description: "定位到指定 layerId 中符合过滤条件的要素。",
189
+ schema: Nt
190
+ });
191
+ async function kt(e) {
192
+ const r = new Me({
193
+ xmin: -180,
194
+ ymin: -90,
195
+ xmax: 180,
196
+ ymax: 90,
197
+ spatialReference: { wkid: 4326 }
198
+ }).expand(0.7);
199
+ return await e.goTo(r), { text: "已缩放到全球范围" };
200
+ }
201
+ async function qt(e, t) {
202
+ const { mapView: r } = C(t);
203
+ return await kt(r);
204
+ }
205
+ const It = E.object({}), An = f(qt, {
206
+ name: "goToFullExtent",
207
+ description: "使用 GeoScene 地理编码服务将地图缩放到全球范围。",
208
+ schema: It
209
+ });
210
+ async function Dt(e) {
211
+ const r = e.map.initialViewProperties?.viewpoint?.targetGeometry;
212
+ if (r)
213
+ await e.goTo(r);
214
+ else
215
+ throw new Error("未定义初始范围");
216
+ return { text: "已返回初始范围" };
217
+ }
218
+ async function zt(e, t) {
219
+ const { mapView: r } = C(t);
220
+ return await Dt(r);
221
+ }
222
+ const Pt = s.object({}), Ln = f(zt, {
223
+ name: "goToHomeExtent",
224
+ description: "返回 WebMap 初始视图范围",
225
+ schema: Pt
226
+ });
227
+ async function At(e, t) {
228
+ await t.when();
229
+ const r = t.map?.allLayers.find((o) => o.id === e);
230
+ if (!r)
231
+ return console.warn(`[goToLayer] 未找到匹配的 FeatureLayer:${e}`), { text: `未找到图层:${e}` };
232
+ let a;
233
+ return (r.type === "link-chart" || r.type === "knowledge-graph-sublayer") && t.map?.activeLinkChartLayer ? a = t.map.diagramNodesExtent : a = r.fullExtent, a ? (await t.goTo(a), r.visible = !0, { text: `已缩放到:${r.title ?? ""}` }) : { text: "图层未定义范围,无法缩放到该图层。" };
234
+ }
235
+ async function Lt({ layerId: e }, t) {
236
+ const { mapView: r } = C(t);
237
+ return await At(e, r);
238
+ }
239
+ const jt = E.object({
240
+ layerId: E.string().describe("要定位的图层 ID")
241
+ }), jn = f(Lt, {
242
+ name: "goToLayer",
243
+ description: "将地图缩放到最佳匹配图层的完整范围。",
244
+ schema: jt
245
+ });
246
+ async function Gt(e, t) {
247
+ return await t.goTo({ scale: e }), { text: `已缩放到:${e}` };
248
+ }
249
+ async function Ot({ scale: e }, t) {
250
+ const { mapView: r } = C(t);
251
+ return await Gt(e, r);
252
+ }
253
+ const Mt = s.object({
254
+ scale: s.number().describe("目标视图的地图比例尺。")
255
+ }), Gn = f(Ot, {
256
+ name: "goToScale",
257
+ description: "定位到指定比例尺。",
258
+ schema: Mt
259
+ });
260
+ async function Qt(e, t, r) {
261
+ const o = {
262
+ target: new Te({
263
+ longitude: e.longitude,
264
+ latitude: e.latitude,
265
+ spatialReference: { wkid: 4326 }
266
+ })
267
+ };
268
+ return r?.zoom !== void 0 && (o.zoom = r.zoom), r?.scale !== void 0 && (o.scale = r.scale), await t.goTo(o), { text: `已定位到:${[
269
+ `(${e.latitude}°, ${e.longitude}°)`,
270
+ r?.zoom !== void 0 ? `缩放级别 ${r.zoom}` : "",
271
+ r?.scale !== void 0 ? `比例尺 1:${r.scale}` : ""
272
+ ].filter(Boolean).join(", ")}` };
273
+ }
274
+ async function _t({
275
+ center: e,
276
+ zoom: t,
277
+ scale: r
278
+ }, a) {
279
+ const { mapView: o } = C(a);
280
+ return await Qt(e, o, { zoom: t, scale: r });
281
+ }
282
+ const Wt = s.object({
283
+ center: s.object({
284
+ longitude: s.number().describe("目标点的经度,即 x 坐标。"),
285
+ latitude: s.number().describe("目标点的纬度,即 y 坐标。")
286
+ }),
287
+ zoom: s.number().optional().describe("缩放级别,数值越大,地图放得越大。"),
288
+ scale: s.number().optional().describe("地图比例尺,可替代 zoom;比例尺分母越小,地图放得越大。")
289
+ }), On = f(_t, {
290
+ name: "goToViewpoint",
291
+ description: "定位到指定视点,可以组合 scale、center、zoom 等参数。",
292
+ schema: Wt
293
+ });
294
+ async function Vt(e, t) {
295
+ return await t.goTo({ zoom: e }), { text: `已缩放到:${e}` };
296
+ }
297
+ async function Bt({ zoom: e }, t) {
298
+ const { mapView: r } = C(t);
299
+ return await Vt(e, r);
300
+ }
301
+ const Ut = s.object({
302
+ zoom: s.number().min(1).max(20).describe("目标视图的缩放级别。")
303
+ }), Mn = f(Bt, {
304
+ name: "goToZoom",
305
+ description: "定位到指定缩放级别。如果要求较笼统,例如“放大”,只调整到下一个适当级别;放大时增加级别,缩小时降低级别。",
306
+ schema: Ut
307
+ }), ge = /* @__PURE__ */ Object.assign({
308
+ "../agents/geosceneKnowledge/prompts/geoscene_knowledge_current_lc_context.md": () => import("./geoscene_knowledge_current_lc_context.js").then((e) => e.default),
309
+ "../agents/geosceneKnowledge/prompts/geoscene_knowledge_current_map_context.md": () => import("./geoscene_knowledge_current_map_context.js").then((e) => e.default),
310
+ "../agents/geosceneKnowledge/prompts/geoscene_knowledge_cypher_query_prompt.md": () => import("./geoscene_knowledge_cypher_query_prompt.js").then((e) => e.default),
311
+ "../agents/geosceneKnowledge/prompts/geoscene_knowledge_lucene_generation_prompt.md": () => import("./geoscene_knowledge_lucene_generation_prompt.js").then((e) => e.default),
312
+ "../agents/geosceneKnowledge/prompts/geoscene_knowledge_summarize_result_prompt.md": () => import("./geoscene_knowledge_summarize_result_prompt.js").then((e) => e.default),
313
+ "../agents/geosceneKnowledge/prompts/geoscene_knowledge_tool_prompt.md": () => import("./geoscene_knowledge_tool_prompt.js").then((e) => e.default),
314
+ "../agents/dataExploration/prompts/data_explore_filter_prompt.md": () => import("./data_explore_filter_prompt.js").then((e) => e.default),
315
+ "../agents/dataExploration/prompts/data_explore_query_prompt.md": () => import("./data_explore_query_prompt.js").then((e) => e.default),
316
+ "../agents/dataExploration/prompts/summarize_query_response_prompt.md": () => import("./summarize_query_response_prompt.js").then((e) => e.default),
317
+ "../agents/help/prompts/help_prompt.md": () => import("./help_prompt.js").then((e) => e.default),
318
+ "../agents/layerStyling/prompts/layer_styling_prompt.md": () => import("./layer_styling_prompt.js").then((e) => e.default),
319
+ "../agents/navigation/prompts/navigation_intent_prompt.md": () => import("./navigation_intent_prompt.js").then((e) => e.default),
320
+ "../agents/navigation/prompts/navigation_tool_prompt.md": () => import("./navigation_tool_prompt.js").then((e) => e.default)
321
+ });
322
+ async function B(e) {
323
+ const t = Object.entries(ge).find(([r]) => r.endsWith(`/${e}.md`));
324
+ if (!t)
325
+ throw new Error(`未找到提示词:${e}
326
+ 可用提示词:
327
+ ${Object.keys(ge).join(`
328
+ `)}`);
329
+ return await t[1]();
330
+ }
331
+ const Kt = (e, t = 300) => {
332
+ const r = e.replace(/\s+/gu, " ").replace(/[*_`#>\-]/gu, "").trim();
333
+ return r.length > t ? `${r.slice(0, t)}...` : r;
334
+ }, xe = (e, t) => {
335
+ const a = e?.configurable?.services?.[t];
336
+ if (a == null)
337
+ throw new Error(`${t} 在 config.configurable.services 中不存在`);
338
+ return a;
339
+ }, Qn = (e, t) => (r, a) => {
340
+ const o = a?.configurable?.services;
341
+ for (const n of e)
342
+ if (!o?.[n])
343
+ throw new Error(`${t} 需要服务。${n} 可用。`);
344
+ return r;
345
+ };
346
+ async function Ht(e) {
347
+ const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
348
+ let l;
349
+ return n ? l = _e({
350
+ basemapTheme: await he(a),
351
+ geometryType: r.geometryType,
352
+ includedTags: n,
353
+ numColors: Math.min(t.length, 8)
354
+ })[0] : l = We({
355
+ basemapTheme: await he(a),
356
+ geometryType: r.geometryType,
357
+ numColors: Math.min(t.length, 8)
358
+ }).primaryScheme, {
359
+ layer: r,
360
+ view: a,
361
+ attributes: t.map((i) => ({
362
+ field: i,
363
+ label: r.fields.find((c) => c.name === i)?.alias ?? ""
364
+ })).slice(0, 8),
365
+ outlineOptimizationEnabled: !0,
366
+ sizeOptimizationEnabled: !0,
367
+ includeSizeVariable: o.includes("Size"),
368
+ pieChartScheme: l
369
+ };
370
+ }
371
+ async function Jt(e) {
372
+ return await Qe(e);
373
+ }
374
+ async function Yt({
375
+ geosceneMap: e,
376
+ geosceneMapView: t,
377
+ layerId: r,
378
+ fields: a,
379
+ colorSchemes: o,
380
+ includeSize: n
381
+ }) {
382
+ const l = t, i = e?.allLayers.find((d) => d.id === r);
383
+ if (!i)
384
+ return `未找到图层,ID:${r}`;
385
+ const u = {
386
+ styleName: n ? "chart-size" : "chart",
387
+ fields: a,
388
+ layer: i,
389
+ view: l,
390
+ colorSchemeTags: o
391
+ };
392
+ try {
393
+ const d = await Ht(u), p = await Jt(d);
394
+ return i.renderer = p.renderer, i.visible = !0, `已为图层应用图表渲染器:${i.title ?? i.id},使用字段 ${a.join(", ")}`;
395
+ } catch (d) {
396
+ return `应用图表渲染器失败:${d instanceof Error ? d.message : String(d)}`;
397
+ }
398
+ }
399
+ const Zt = ["mapView"];
400
+ function $(e) {
401
+ const r = e?.configurable?.context;
402
+ if (!r || typeof r != "object")
403
+ throw new Error("LayerStylingAgent 缺少上下文");
404
+ const a = Zt.filter((o) => !(o in r));
405
+ if (a.length)
406
+ throw new Error(`LayerStylingAgent 缺少上下文:${a.join(", ")}`);
407
+ return r;
408
+ }
409
+ async function Xt({
410
+ layerId: e,
411
+ fields: t,
412
+ colorSchemes: r,
413
+ includeSize: a
414
+ }, o) {
415
+ const { mapView: n } = $(o);
416
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Yt({
417
+ geosceneMap: n.map,
418
+ geosceneMapView: n,
419
+ layerId: e,
420
+ fields: t,
421
+ colorSchemes: r,
422
+ includeSize: a
423
+ });
424
+ }
425
+ const er = s.object({
426
+ layerId: s.string().describe("要应用图表渲染器的图层 ID"),
427
+ fields: s.array(s.string()).describe("图表使用的多个数值字段"),
428
+ colorSchemes: s.array(s.string()).optional().describe("可选的配色方案标签"),
429
+ includeSize: s.boolean().optional().describe("是否按总量改变图表大小(chart-size)")
430
+ }), _n = f(Xt, {
431
+ name: "chart",
432
+ description: `标签:图表
433
+ 说明:使用饼图表示两个或更多类别各自占总量的比例。
434
+ 关键词:饼图、图表、所有类别、构成、比例。
435
+ 示例:对每个要素,用饼图显示各年代建造的房屋数量。
436
+ 字段:需要2至8个数值字段。
437
+
438
+ 标签:图表和大小
439
+ 说明:用饼图表示类别占比,并通过图表大小表示总量或规模。
440
+ 关键词:饼图、图表、构成、比例、总计、数量、总和、分级大小、比例大小。
441
+ 示例:每个要素按年代显示房屋数量占比,饼图大小随各类别总量变化。
442
+ 字段:需要2至8个数值字段。`,
443
+ schema: er
444
+ });
445
+ function tr(e) {
446
+ const { fields: t, layer: r, view: a, theme: o, colorSchemeTags: n } = e, l = t[0];
447
+ let i;
448
+ return n && (i = se({
449
+ geometryType: r.geometryType,
450
+ includedTags: n,
451
+ theme: o || "high-to-low"
452
+ })[0]), {
453
+ layer: r,
454
+ view: a,
455
+ startTime: l,
456
+ endTime: /* @__PURE__ */ new Date(),
457
+ theme: o,
458
+ sizeOptimizationEnabled: !0,
459
+ outlineOptimizationEnabled: !0,
460
+ colorScheme: i
461
+ };
462
+ }
463
+ async function rr(e) {
464
+ return await Ve(e);
465
+ }
466
+ async function ar({
467
+ geosceneMap: e,
468
+ geosceneMapView: t,
469
+ layerId: r,
470
+ fields: a,
471
+ colorSchemes: o,
472
+ theme: n
473
+ }) {
474
+ const l = t, i = e?.allLayers.find((u) => u.id === r);
475
+ if (!i)
476
+ return `未找到图层,ID:${r}`;
477
+ const c = {
478
+ styleName: "color-age",
479
+ fields: a,
480
+ layer: i,
481
+ view: l,
482
+ colorSchemeTags: o,
483
+ theme: n
484
+ };
485
+ try {
486
+ const u = tr(c), d = await rr(u);
487
+ return i.renderer = d.renderer, i.visible = !0, `已为图层应用颜色年龄渲染器:${i.title ?? i.id},使用字段 ${a.join(", ")}`;
488
+ } catch (u) {
489
+ return `应用颜色年龄渲染器失败:${u instanceof Error ? u.message : String(u)}`;
490
+ }
491
+ }
492
+ async function or({
493
+ layerId: e,
494
+ fields: t,
495
+ colorSchemes: r,
496
+ theme: a
497
+ }, o) {
498
+ const { mapView: n } = $(o);
499
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await ar({
500
+ geosceneMap: n.map,
501
+ geosceneMapView: n,
502
+ layerId: e,
503
+ fields: t,
504
+ colorSchemes: r,
505
+ theme: a
506
+ });
507
+ }
508
+ const nr = s.object({
509
+ layerId: s.string().describe("要应用颜色年龄渲染器的图层 ID"),
510
+ fields: s.array(s.string()).describe("颜色年龄渲染器使用的日期字段"),
511
+ colorSchemes: s.array(s.string()).optional().describe("可选的配色方案标签"),
512
+ theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("可选的色带主题")
513
+ }), Wn = f(or, {
514
+ name: "color-age",
515
+ description: `标签:年龄(颜色)
516
+ 说明:沿连续色带显示要素年龄,年龄表示开始日期至结束日期的时间长度。
517
+ 关键词:自从、年龄、多久、多大。
518
+ 示例:根据上报日期显示各要素的年龄。
519
+ 字段:至少需要一个日期字段。`,
520
+ schema: nr
521
+ });
522
+ function ir(e) {
523
+ const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
524
+ let { theme: n } = e, l = t[1];
525
+ const i = t[0];
526
+ let c;
527
+ return o && (c = se({
528
+ geometryType: r.geometryType,
529
+ includedTags: o,
530
+ theme: n || "high-to-low"
531
+ })[0]), {
532
+ layer: r,
533
+ view: a,
534
+ field: i,
535
+ normalizationField: l,
536
+ theme: n,
537
+ sizeOptimizationEnabled: !0,
538
+ outlineOptimizationEnabled: !0,
539
+ colorScheme: c
540
+ };
541
+ }
542
+ async function sr(e) {
543
+ return await Be(e);
544
+ }
545
+ async function lr({
546
+ geosceneMap: e,
547
+ geosceneMapView: t,
548
+ layerId: r,
549
+ fields: a,
550
+ colorSchemes: o,
551
+ theme: n
552
+ }) {
553
+ const l = t, i = e?.allLayers.find((u) => u.id === r);
554
+ if (!i)
555
+ return `未找到图层,ID:${r}`;
556
+ const c = {
557
+ styleName: "color",
558
+ fields: a,
559
+ layer: i,
560
+ view: l,
561
+ colorSchemeTags: o,
562
+ theme: n
563
+ };
564
+ try {
565
+ const u = ir(c), d = await sr(u);
566
+ return i.renderer = d.renderer, i.visible = !0, `已为图层应用颜色渲染器:${i.title ?? i.id},使用字段 ${a.join(", ")}`;
567
+ } catch (u) {
568
+ return `应用颜色渲染器失败:${u instanceof Error ? u.message : String(u)}`;
569
+ }
570
+ }
571
+ async function cr({
572
+ layerId: e,
573
+ fields: t,
574
+ colorSchemes: r,
575
+ theme: a
576
+ }, o) {
577
+ const { mapView: n } = $(o);
578
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await lr({
579
+ geosceneMap: n.map,
580
+ geosceneMapView: n,
581
+ layerId: e,
582
+ fields: t,
583
+ colorSchemes: r,
584
+ theme: a
585
+ });
586
+ }
587
+ const ur = s.object({
588
+ layerId: s.string().describe("要应用颜色渲染器的图层 ID"),
589
+ fields: s.array(s.string()).describe("颜色渲染器使用的字段"),
590
+ colorSchemes: s.array(s.string()).optional().describe("可选的配色方案标签"),
591
+ theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("可选的色带主题")
592
+ }), Vn = f(cr, {
593
+ name: "color",
594
+ description: `标签:计数和数量(颜色)
595
+ 说明:使用连续色带表示数值或等级数据。
596
+ 关键词:分级设色、连续颜色、色相、渐变、饱和度、明度、百分比、比率、指数、增加、减少。
597
+ 示例:按人口密度为要素着色。
598
+ 字段:需要一个数值字段,可指定第二个数值字段用于归一化第一个字段。`,
599
+ schema: ur
600
+ });
601
+ function dr(e) {
602
+ const { fields: t, layer: r, view: a, colorSchemeTags: o, theme: n } = e;
603
+ let l, i;
604
+ const c = t[0];
605
+ return o && (i = se({
606
+ geometryType: r.geometryType,
607
+ includedTags: o,
608
+ theme: n || "high-to-low"
609
+ })[0]), {
610
+ layer: r,
611
+ view: a,
612
+ field: c,
613
+ normalizationField: l,
614
+ theme: n,
615
+ colorOptions: {
616
+ colorScheme: i
617
+ }
618
+ };
619
+ }
620
+ async function pr(e) {
621
+ return await Ue(e);
622
+ }
623
+ async function mr({
624
+ geosceneMap: e,
625
+ geosceneMapView: t,
626
+ layerId: r,
627
+ fields: a,
628
+ colorSchemes: o,
629
+ theme: n
630
+ }) {
631
+ const l = t, i = e?.allLayers.find((u) => u.id === r);
632
+ if (!i)
633
+ return `未找到图层,ID:${r}`;
634
+ const c = {
635
+ styleName: "color-size-univariate",
636
+ fields: a,
637
+ layer: i,
638
+ view: l,
639
+ colorSchemeTags: o,
640
+ theme: n
641
+ };
642
+ try {
643
+ const u = dr(c), d = await pr(u);
644
+ return i.renderer = d.renderer, i.visible = !0, `已为图层应用颜色与大小渲染器:${i.title ?? i.id},使用字段 ${a.join(", ")}`;
645
+ } catch (u) {
646
+ return `应用颜色与大小渲染器失败:${u instanceof Error ? u.message : String(u)}`;
647
+ }
648
+ }
649
+ async function hr({
650
+ layerId: e,
651
+ fields: t,
652
+ colorSchemes: r,
653
+ theme: a
654
+ }, o) {
655
+ const { mapView: n } = $(o);
656
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await mr({
657
+ geosceneMap: n.map,
658
+ geosceneMapView: n,
659
+ layerId: e,
660
+ fields: t,
661
+ colorSchemes: r,
662
+ theme: a
663
+ });
664
+ }
665
+ const yr = s.object({
666
+ layerId: s.string().describe("要应用颜色与大小渲染器的图层 ID"),
667
+ fields: s.array(s.string()).describe("颜色与大小渲染器使用的字段"),
668
+ colorSchemes: s.array(s.string()).optional().describe("可选的配色方案标签"),
669
+ theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("可选的颜色和大小渐变主题")
670
+ }), Bn = f(hr, {
671
+ name: "color-size-univariate",
672
+ description: `标签:颜色和大小(univariate)
673
+ 说明:根据两个数值属性改变符号大小和颜色。
674
+ 关键词:连续颜色、色相、颜色、大小、渐变、饱和度、明度、百分比、比率、指数、数量、增减。
675
+ 示例:按拥有住房的人口比例着色,按总人口改变点大小。
676
+ 字段:至少需要两个字段,分别控制颜色和大小;每个字段都可另用一个字段归一化。`,
677
+ schema: yr
678
+ });
679
+ function fr(e) {
680
+ const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
681
+ let n;
682
+ return o && (n = He({
683
+ includedTags: o,
684
+ numColors: Math.min(t.length, 8)
685
+ })[0]), {
686
+ layer: r,
687
+ view: a,
688
+ legendOptions: {
689
+ unit: "units"
690
+ },
691
+ attributes: t.map((l) => ({
692
+ field: l,
693
+ label: r.fields.find((i) => i.name === l)?.alias ?? ""
694
+ })).slice(0, 8),
695
+ outlineOptimizationEnabled: !0,
696
+ dotDensityScheme: n
697
+ };
698
+ }
699
+ async function gr(e) {
700
+ return await Ke(e);
701
+ }
702
+ async function wr({
703
+ geosceneMap: e,
704
+ geosceneMapView: t,
705
+ layerId: r,
706
+ fields: a,
707
+ colorSchemes: o
708
+ }) {
709
+ const n = t, l = e?.allLayers.find((c) => c.id === r);
710
+ if (!l)
711
+ return `未找到图层,ID:${r}`;
712
+ const i = {
713
+ styleName: "dot-density",
714
+ fields: a,
715
+ layer: l,
716
+ view: n,
717
+ colorSchemeTags: o
718
+ };
719
+ try {
720
+ const c = fr(i), u = await gr(c);
721
+ return l.renderer = u.renderer, l.visible = !0, `已为图层应用点密度渲染器:${l.title ?? l.id},使用字段 ${a.join(", ")}`;
722
+ } catch (c) {
723
+ return `应用点密度渲染器失败:${c instanceof Error ? c.message : String(c)}`;
724
+ }
725
+ }
726
+ async function br({
727
+ layerId: e,
728
+ fields: t,
729
+ colorSchemes: r
730
+ }, a) {
731
+ const { mapView: o } = $(a);
732
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await wr({
733
+ geosceneMap: o.map,
734
+ geosceneMapView: o,
735
+ layerId: e,
736
+ fields: t,
737
+ colorSchemes: r
738
+ });
739
+ }
740
+ const Tr = s.object({
741
+ layerId: s.string().describe("要应用点密度渲染器的图层 ID"),
742
+ fields: s.array(s.string()).describe("点密度渲染器使用的字段,例如人口或计数字段"),
743
+ colorSchemes: s.array(s.string()).optional().describe("可选的配色方案标签")
744
+ }), Un = f(br, {
745
+ name: "dot-density",
746
+ description: `点密度
747
+ 使用点密度显示单个属性的分布,或比较多个属性的密度,仅适用于面图层。
748
+ 用途:人口分布、区域内多类别对比、空间分布规律。
749
+ 示例:按种族或族群显示人口密度;显示不同地区的作物分布;显示人口普查区的人口特征。
750
+ 字段:需要2至8个数值字段。
751
+ 关键词:密度、多少、总量、数量。`,
752
+ schema: Tr
753
+ });
754
+ function Sr(e) {
755
+ const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
756
+ let n;
757
+ const l = t[0];
758
+ return o && (n = Ye({
759
+ includedTags: o,
760
+ basemap: a.map?.basemap || "topo"
761
+ })[0]), {
762
+ layer: r,
763
+ view: a,
764
+ field: l,
765
+ heatmapScheme: n
766
+ };
767
+ }
768
+ async function vr(e) {
769
+ return await Je(e);
770
+ }
771
+ async function xr({
772
+ geosceneMap: e,
773
+ geosceneMapView: t,
774
+ layerId: r,
775
+ fields: a,
776
+ colorSchemes: o
777
+ }) {
778
+ const n = t, l = e?.allLayers.find((c) => c.id === r);
779
+ if (!l)
780
+ return `未找到图层,ID:${r}`;
781
+ const i = {
782
+ styleName: "heatmap",
783
+ fields: a,
784
+ layer: l,
785
+ view: n,
786
+ colorSchemeTags: o
787
+ };
788
+ try {
789
+ const c = Sr(i), u = await vr(c);
790
+ return l.renderer = u.renderer, l.visible = !0, `已为图层应用热力图渲染器:${l.title ?? l.id},使用字段 ${a.join(", ")}`;
791
+ } catch (c) {
792
+ return `应用热力图渲染器失败:${c instanceof Error ? c.message : String(c)}`;
793
+ }
794
+ }
795
+ async function Rr({
796
+ layerId: e,
797
+ fields: t,
798
+ colorSchemes: r
799
+ }, a) {
800
+ const { mapView: o } = $(a);
801
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await xr({
802
+ geosceneMap: o.map,
803
+ geosceneMapView: o,
804
+ layerId: e,
805
+ fields: t,
806
+ colorSchemes: r
807
+ });
808
+ }
809
+ const $r = s.object({
810
+ layerId: s.string().describe("要应用热力图渲染器的图层 ID"),
811
+ fields: s.array(s.string()).describe("热力图渲染器使用的字段,通常表示点密度"),
812
+ colorSchemes: s.array(s.string()).optional().describe("可选的配色方案标签")
813
+ }), Kn = f(Rr, {
814
+ name: "heatmap",
815
+ description: `标签:热力图
816
+ 说明:用看起来更热、更亮的颜色表示高密度区域,仅适用于点图层。
817
+ 关键词:密度、热力图、热点、规律、聚集。
818
+ 示例:创建热力图。
819
+ 字段:通常不需要字段,或只需要一个数值字段。`,
820
+ schema: $r
821
+ });
822
+ function Cr(e) {
823
+ const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
824
+ let l;
825
+ return n && (l = Xe({
826
+ geometryType: r.geometryType,
827
+ includedTags: n,
828
+ numColors: Math.min(t.length, 10)
829
+ })[0]), {
830
+ layer: r,
831
+ view: a,
832
+ fields: t.map((i) => ({ name: i })).slice(0, 9),
833
+ outlineOptimizationEnabled: !0,
834
+ sizeOptimizationEnabled: !0,
835
+ includeSizeVariable: o.includes("Size"),
836
+ predominanceScheme: l
837
+ };
838
+ }
839
+ async function Er(e) {
840
+ return await Ze(e);
841
+ }
842
+ async function Fr({
843
+ geosceneMap: e,
844
+ geosceneMapView: t,
845
+ layerId: r,
846
+ fields: a,
847
+ colorSchemes: o,
848
+ includeSize: n
849
+ }) {
850
+ const l = t, i = e?.allLayers.find((d) => d.id === r);
851
+ if (!i)
852
+ return `未找到图层,ID:${r}`;
853
+ const u = {
854
+ styleName: n ? "predominance-size" : "predominance",
855
+ fields: a,
856
+ layer: i,
857
+ view: l,
858
+ colorSchemeTags: o
859
+ };
860
+ try {
861
+ const d = Cr(u), p = await Er(d);
862
+ return i.renderer = p.renderer, i.visible = !0, `已为图层应用主导类别渲染器:${i.title ?? i.id},使用字段 ${a.join(", ")}`;
863
+ } catch (d) {
864
+ return `应用主导类别渲染器失败:${d instanceof Error ? d.message : String(d)}`;
865
+ }
866
+ }
867
+ async function Nr({
868
+ layerId: e,
869
+ fields: t,
870
+ colorSchemes: r,
871
+ includeSize: a
872
+ }, o) {
873
+ const { mapView: n } = $(o);
874
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Fr({
875
+ geosceneMap: n.map,
876
+ geosceneMapView: n,
877
+ layerId: e,
878
+ fields: t,
879
+ colorSchemes: r,
880
+ includeSize: a
881
+ });
882
+ }
883
+ const kr = s.object({
884
+ layerId: s.string().describe("要应用主导类别渲染器的图层 ID"),
885
+ fields: s.array(s.string()).describe("主导类别渲染器使用的相互比较的类别字段"),
886
+ colorSchemes: s.array(s.string()).optional().describe("可选的配色方案标签"),
887
+ includeSize: s.boolean().optional().describe("是否同时使用大小表达总量(predominance-size)")
888
+ }), Hn = f(Nr, {
889
+ name: "predominance",
890
+ description: `标签:主导类别
891
+ 说明:比较具有相同主题和计量单位的属性,显示哪一项最高。
892
+ 关键词:主导、胜出、竞争、最多、最常见、最高。
893
+ 示例:比较玉米、小麦、棉花面积,显示各地区主要收获作物。
894
+ 字段:需要2至10个数值字段。
895
+
896
+ 标签:主导类别和大小
897
+ 说明:显示最高类别,同时以符号大小表示所有类别的总量。
898
+ 关键词:主导、最多、常见、总量、数量、比例大小、分级大小、总和。
899
+ 示例:显示各地区主导作物,并按所有类别总量改变符号大小。
900
+ 字段:需要2至10个数值字段。`,
901
+ schema: kr
902
+ });
903
+ function qr(e) {
904
+ const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
905
+ let n;
906
+ const l = {
907
+ field: t[0]
908
+ }, i = {
909
+ field: t[1]
910
+ };
911
+ return o && (n = tt({
912
+ geometryType: r.geometryType,
913
+ includedTags: o
914
+ })[0]), {
915
+ layer: r,
916
+ view: a,
917
+ field1: l,
918
+ field2: i,
919
+ outlineOptimizationEnabled: !0,
920
+ sizeOptimizationEnabled: !0,
921
+ relationshipScheme: n
922
+ };
923
+ }
924
+ async function Ir(e) {
925
+ return await et(e);
926
+ }
927
+ async function Dr({
928
+ geosceneMap: e,
929
+ geosceneMapView: t,
930
+ layerId: r,
931
+ fields: a,
932
+ colorSchemes: o
933
+ }) {
934
+ const n = t, l = e?.allLayers.find((c) => c.id === r);
935
+ if (!l)
936
+ return `未找到图层,ID:${r}`;
937
+ const i = {
938
+ styleName: "relationship",
939
+ fields: a,
940
+ layer: l,
941
+ view: n,
942
+ colorSchemeTags: o
943
+ };
944
+ try {
945
+ const c = qr(i), u = await Ir(c);
946
+ return l.renderer = u.renderer, l.visible = !0, `已为图层应用关系渲染器:${l.title ?? l.id},使用字段 ${a.join(", ")}`;
947
+ } catch (c) {
948
+ return `应用关系渲染器失败:${c instanceof Error ? c.message : String(c)}`;
949
+ }
950
+ }
951
+ async function zr({
952
+ layerId: e,
953
+ fields: t,
954
+ colorSchemes: r
955
+ }, a) {
956
+ const { mapView: o } = $(a);
957
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await Dr({
958
+ geosceneMap: o.map,
959
+ geosceneMapView: o,
960
+ layerId: e,
961
+ fields: t,
962
+ colorSchemes: r
963
+ });
964
+ }
965
+ const Pr = s.object({
966
+ layerId: s.string().describe("要应用关系渲染器的图层 ID"),
967
+ fields: s.array(s.string()).describe("关系渲染器使用的两个字段,用于双变量可视化"),
968
+ colorSchemes: s.array(s.string()).optional().describe("可选的配色方案标签")
969
+ }), Jn = f(zr, {
970
+ name: "relationship",
971
+ description: `标签:关系
972
+ 说明:叠加两个色带,表达两个数值属性的关系。
973
+ 关键词:关系、相关性、比较、双变量分级设色、双变量颜色。
974
+ 示例:显示树木高度与碳储量的关系。
975
+ 字段:需要两个数值字段。`,
976
+ schema: Pr
977
+ });
978
+ function Ar(e) {
979
+ const { fields: t, layer: r, view: a, theme: o } = e, n = t[0];
980
+ return {
981
+ layer: r,
982
+ view: a,
983
+ startTime: n,
984
+ endTime: /* @__PURE__ */ new Date(),
985
+ theme: o,
986
+ sizeOptimizationEnabled: !0,
987
+ outlineOptimizationEnabled: !0
988
+ };
989
+ }
990
+ async function Lr(e) {
991
+ return await rt(e);
992
+ }
993
+ async function jr({
994
+ geosceneMap: e,
995
+ geosceneMapView: t,
996
+ layerId: r,
997
+ fields: a,
998
+ colorSchemes: o,
999
+ theme: n
1000
+ }) {
1001
+ const l = t, i = e?.allLayers.find((u) => u.id === r);
1002
+ if (!i)
1003
+ return `未找到图层,ID:${r}`;
1004
+ const c = {
1005
+ styleName: "size-age",
1006
+ fields: a,
1007
+ layer: i,
1008
+ view: l,
1009
+ colorSchemeTags: o,
1010
+ theme: n
1011
+ };
1012
+ try {
1013
+ const u = Ar(c), d = await Lr(u);
1014
+ return i.renderer = d.renderer, i.visible = !0, `已为图层应用大小年龄渲染器:${i.title ?? i.id},使用字段 ${a.join(", ")}`;
1015
+ } catch (u) {
1016
+ return `应用大小年龄渲染器失败:${u instanceof Error ? u.message : String(u)}`;
1017
+ }
1018
+ }
1019
+ async function Gr({
1020
+ layerId: e,
1021
+ fields: t,
1022
+ colorSchemes: r,
1023
+ theme: a
1024
+ }, o) {
1025
+ const { mapView: n } = $(o);
1026
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await jr({
1027
+ geosceneMap: n.map,
1028
+ geosceneMapView: n,
1029
+ layerId: e,
1030
+ fields: t,
1031
+ colorSchemes: r,
1032
+ theme: a
1033
+ });
1034
+ }
1035
+ const Or = s.object({
1036
+ layerId: s.string().describe("要应用大小年龄渲染器的图层 ID"),
1037
+ fields: s.array(s.string()).describe("大小年龄渲染器使用的日期字段"),
1038
+ colorSchemes: s.array(s.string()).optional().describe("可选的配色方案标签"),
1039
+ theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("可选的大小渐变主题")
1040
+ }), Yn = f(Gr, {
1041
+ name: "size-age",
1042
+ description: `标签:年龄(大小)
1043
+ 说明:用连续变化的符号大小表示要素年龄,即开始日期至结束日期的时间长度。
1044
+ 关键词:自从、年龄、多久、多大。
1045
+ 示例:让较老要素的符号大于较新要素。
1046
+ 字段:至少需要一个日期字段。`,
1047
+ schema: Or
1048
+ });
1049
+ function Mr(e) {
1050
+ const { fields: t, layer: r, view: a } = e;
1051
+ let { theme: o } = e, n = t[1];
1052
+ const l = t[0];
1053
+ return {
1054
+ layer: r,
1055
+ view: a,
1056
+ field: l,
1057
+ normalizationField: n,
1058
+ theme: o,
1059
+ sizeOptimizationEnabled: !0,
1060
+ outlineOptimizationEnabled: !0
1061
+ };
1062
+ }
1063
+ async function Qr(e) {
1064
+ return await at(e);
1065
+ }
1066
+ async function _r({
1067
+ geosceneMap: e,
1068
+ geosceneMapView: t,
1069
+ layerId: r,
1070
+ fields: a,
1071
+ colorSchemes: o,
1072
+ theme: n
1073
+ }) {
1074
+ const l = t, i = e?.allLayers.find((u) => u.id === r);
1075
+ if (!i)
1076
+ return `未找到图层,ID:${r}`;
1077
+ const c = {
1078
+ styleName: "size",
1079
+ fields: a,
1080
+ layer: i,
1081
+ view: l,
1082
+ colorSchemeTags: o,
1083
+ theme: n
1084
+ };
1085
+ try {
1086
+ const u = Mr(c), d = await Qr(u);
1087
+ return i.renderer = d.renderer, i.visible = !0, `已为图层应用大小渲染器:${i.title ?? i.id},使用字段 ${a.join(", ")}`;
1088
+ } catch (u) {
1089
+ return `应用大小渲染器失败:${u instanceof Error ? u.message : String(u)}`;
1090
+ }
1091
+ }
1092
+ async function Wr({
1093
+ layerId: e,
1094
+ fields: t,
1095
+ colorSchemes: r,
1096
+ theme: a
1097
+ }, o) {
1098
+ const { mapView: n } = $(o);
1099
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await _r({
1100
+ geosceneMap: n.map,
1101
+ geosceneMapView: n,
1102
+ layerId: e,
1103
+ fields: t,
1104
+ colorSchemes: r,
1105
+ theme: a
1106
+ });
1107
+ }
1108
+ const Vr = s.object({
1109
+ layerId: s.string().describe("要应用大小渲染器的图层 ID"),
1110
+ fields: s.array(s.string()).describe("大小渲染器使用的数值字段"),
1111
+ colorSchemes: s.array(s.string()).optional().describe("可选的配色方案标签"),
1112
+ theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("可选的大小渐变主题")
1113
+ }), Zn = f(Wr, {
1114
+ name: "size",
1115
+ description: `标签:计数和数量(大小)
1116
+ 说明:以连续变化的符号大小表示数值或等级数据。
1117
+ 关键词:分级大小、比例大小、多少、总量、数量、大小。
1118
+ 示例:根据总人口改变点的大小。
1119
+ 字段:需要一个数值字段,可指定第二个数值字段对其归一化。
1120
+
1121
+ 标签:连续时间线(大小)
1122
+ 说明:以连续变化的符号大小表示日期。
1123
+ 关键词:分级大小、比例大小、分级、多少、总量、数量、何时。
1124
+ 示例:根据工单完成日期改变要素大小。
1125
+ 字段:需要一个日期字段。`,
1126
+ schema: Vr
1127
+ });
1128
+ function Br(e) {
1129
+ const { fields: t, layer: r, view: a, colorSchemeTags: o } = e, n = t[0], l = t[1], i = t[2];
1130
+ let c;
1131
+ return o && (c = nt({
1132
+ geometryType: r.geometryType,
1133
+ includedTags: o
1134
+ })[0]), {
1135
+ layer: r,
1136
+ view: a,
1137
+ field: n,
1138
+ field2: l,
1139
+ field3: i,
1140
+ outlineOptimizationEnabled: !0,
1141
+ sizeOptimizationEnabled: !0,
1142
+ typeScheme: c
1143
+ };
1144
+ }
1145
+ async function Ur(e) {
1146
+ return await ot(e);
1147
+ }
1148
+ async function Kr({
1149
+ geosceneMap: e,
1150
+ geosceneMapView: t,
1151
+ layerId: r,
1152
+ fields: a,
1153
+ colorSchemes: o,
1154
+ theme: n
1155
+ }) {
1156
+ const l = t, i = e?.allLayers.find((u) => u.id === r);
1157
+ if (!i)
1158
+ return `未找到图层,ID:${r}`;
1159
+ const c = {
1160
+ styleName: "type",
1161
+ fields: a,
1162
+ layer: i,
1163
+ view: l,
1164
+ colorSchemeTags: o,
1165
+ theme: n
1166
+ };
1167
+ try {
1168
+ const u = Br(c), d = await Ur(u);
1169
+ return i.renderer = d.renderer, i.visible = !0, `已为图层应用类型渲染器:${i.title ?? i.id},使用字段 ${a.join(", ")}`;
1170
+ } catch (u) {
1171
+ return `应用类型渲染器失败:${u instanceof Error ? u.message : String(u)}`;
1172
+ }
1173
+ }
1174
+ async function Hr({
1175
+ layerId: e,
1176
+ fields: t,
1177
+ colorSchemes: r,
1178
+ theme: a
1179
+ }, o) {
1180
+ const { mapView: n } = $(o);
1181
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Kr({
1182
+ geosceneMap: n.map,
1183
+ geosceneMapView: n,
1184
+ layerId: e,
1185
+ fields: t,
1186
+ colorSchemes: r,
1187
+ theme: a
1188
+ });
1189
+ }
1190
+ const Jr = s.object({
1191
+ layerId: s.string().describe("要应用类型渲染器的图层 ID"),
1192
+ fields: s.array(s.string()).describe("类型渲染器使用的分类字段"),
1193
+ colorSchemes: s.array(s.string()).optional().describe("可选的配色方案标签"),
1194
+ theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("可选的配色主题")
1195
+ }), Xn = f(Hr, {
1196
+ name: "type",
1197
+ description: `标签:类型(唯一值符号)
1198
+ 说明:按类别使用不同颜色或形状表示要素,例如树种、道路等级、省份。
1199
+ 关键词:分类、类别、类型、唯一值、离散、兴趣点、地区、分组。
1200
+ 示例:按所属地区为要素着色。
1201
+ 字段:需要一个字符串、数字或日期字段,通常为字符串。`,
1202
+ schema: Jr
1203
+ }), ei = T.Root({
1204
+ ...H(),
1205
+ vectorSearchLayerIds: T(),
1206
+ vectorSearchFieldResults: T(),
1207
+ layerFieldInfo: T(),
1208
+ selectedLayerId: T()
1209
+ }), ti = T.Root({
1210
+ ...H(),
1211
+ vectorSearchLayerIds: T(),
1212
+ vectorSearchFieldResults: T(),
1213
+ layerFieldInfo: T(),
1214
+ queryResponse: T(),
1215
+ dataExplorationMessages: T({
1216
+ reducer: be,
1217
+ default: () => []
1218
+ })
1219
+ }), Yr = ["mapView"];
1220
+ function k(e) {
1221
+ const r = e?.configurable?.context;
1222
+ if (!r || typeof r != "object")
1223
+ throw new Error("DataExplorationAgent 缺少上下文");
1224
+ const a = Yr.filter((o) => !(o in r));
1225
+ if (a.length)
1226
+ throw new Error(`DataExplorationAgent 缺少上下文:${a.join(", ")}`);
1227
+ return r;
1228
+ }
1229
+ const Zr = (e) => {
1230
+ const t = e.map?.allLayers.filter((a) => a.type === "feature");
1231
+ let r = 0;
1232
+ return t?.forEach((a) => {
1233
+ const o = a;
1234
+ o.featureEffect && (o.featureEffect = null, r++);
1235
+ }), r > 0 ? `已清除过滤条件,涉及 ${r} 个图层。视图保持不变。` : "没有需要清除的过滤条件。视图保持不变。";
1236
+ }, Xr = async (e, t) => {
1237
+ const { mapView: r } = k(t);
1238
+ return Zr(r);
1239
+ }, ea = f(Xr, {
1240
+ name: "clearFilters",
1241
+ description: "清除地图中所有要素效果和过滤条件,保留当前视图。用于“清除过滤”“重置过滤”“移除过滤”“显示所有要素”,或仅移除强调效果而不定位的请求。",
1242
+ schema: s.object({})
1243
+ }), ta = async (e) => {
1244
+ e.map?.allLayers.filter((o) => o.type === "feature")?.forEach((o) => {
1245
+ const n = o;
1246
+ n.featureEffect && (n.featureEffect = null);
1247
+ });
1248
+ const a = e.map.initialViewProperties?.viewpoint?.targetGeometry;
1249
+ return a ? (await e.goTo(a), "已清除所有过滤条件并返回初始范围。") : "已清除所有过滤条件,但无法确定初始范围。";
1250
+ }, ra = async (e, t) => {
1251
+ const { mapView: r } = k(t);
1252
+ return await ta(r);
1253
+ }, aa = f(ra, {
1254
+ name: "resetMap",
1255
+ description: "清除地图中所有要素效果和过滤条件,并返回初始视图范围。用于“重置地图”“重新开始”,或同时要求清除过滤与返回初始视图的请求。",
1256
+ schema: s.object({})
1257
+ }), we = 750;
1258
+ function U(e) {
1259
+ return "point" in e && e.point !== void 0;
1260
+ }
1261
+ function j(e) {
1262
+ return "layerId" in e && e.layerId !== void 0;
1263
+ }
1264
+ const J = async (e, t) => {
1265
+ if (U(e)) {
1266
+ const { point: r } = e;
1267
+ return { geometry: new Te({
1268
+ x: r.x,
1269
+ y: r.y,
1270
+ spatialReference: r.spatialReference ? { wkid: r.spatialReference.wkid } : t.spatialReference
1271
+ }) };
1272
+ }
1273
+ if (j(e)) {
1274
+ const r = t.map?.allLayers.find(
1275
+ (n) => n.id === e.layerId
1276
+ );
1277
+ if (!r)
1278
+ return { error: `未找到几何来源图层,ID:${e.layerId}` };
1279
+ const a = r.title ?? r.id, o = e.where?.trim() || "1=1";
1280
+ try {
1281
+ const n = await r.queryFeatures({
1282
+ where: o,
1283
+ returnGeometry: !0,
1284
+ outSpatialReference: t.spatialReference,
1285
+ num: we + 1
1286
+ });
1287
+ if (!n.features.length)
1288
+ return {
1289
+ error: `几何来源图层“${a}”中没有符合以下 where 条件的要素:${o}`
1290
+ };
1291
+ if (n.features.length > we)
1292
+ return {
1293
+ error: `几何来源图层“${a}”的过滤条件匹配了过多要素(${n.features.length}+),请缩小几何来源图层的过滤范围。`
1294
+ };
1295
+ const l = n.features.map((c) => c.geometry).filter((c) => !!c);
1296
+ if (!l.length)
1297
+ return { error: "匹配的几何来源要素中没有有效几何。" };
1298
+ const i = l.length === 1 ? l[0] : lt.executeMany(l);
1299
+ return i ? (i.spatialReference || (i.spatialReference = t.spatialReference), { geometry: i }) : { error: "合并来源图层几何失败。" };
1300
+ } catch (n) {
1301
+ return { error: `查询几何失败:${String(n)}` };
1302
+ }
1303
+ }
1304
+ return { error: "提供的几何配置无效" };
1305
+ }, oa = async (e, t, r, a, o, n) => {
1306
+ const l = e.map?.allLayers.find((c) => c.id === t);
1307
+ if (!l)
1308
+ return { success: !1, error: `图层 '${t}' 不存在。` };
1309
+ const i = l.createQuery();
1310
+ i.where = r ?? "1=1", a && (i.geometry = a, i.spatialRelationship = "intersects", o && (i.distance = o), n && (i.units = n));
1311
+ try {
1312
+ const { extent: c, count: u } = await l.queryExtent(i);
1313
+ return !c || u === 0 ? {
1314
+ success: !1,
1315
+ error: `没有符合过滤条件的要素(where:${i.where}${a ? ",已使用空间过滤" : ""})`
1316
+ } : (await e.goTo(c), { success: !0 });
1317
+ } catch (c) {
1318
+ return {
1319
+ success: !1,
1320
+ error: c instanceof Error ? c.message : String(c)
1321
+ };
1322
+ }
1323
+ }, na = async (e, t, r, a, o, n) => {
1324
+ const l = t.map?.allLayers.find(
1325
+ (p) => p.id === e.layerId
1326
+ );
1327
+ if (!l)
1328
+ return `未找到目标图层,ID:${e.layerId}`;
1329
+ let i;
1330
+ if (o) {
1331
+ const p = await J(o, t);
1332
+ if ("error" in p)
1333
+ return p.error;
1334
+ i = p.geometry;
1335
+ }
1336
+ if (l.featureEffect = null, l.featureEffect = new st({
1337
+ filter: new Se({
1338
+ ...e.objectIds?.length ? { objectIds: e.objectIds } : { where: e.where },
1339
+ geometry: i,
1340
+ spatialRelationship: "intersects",
1341
+ distance: o?.distance,
1342
+ units: o?.units
1343
+ }),
1344
+ includedEffect: r,
1345
+ excludedEffect: a
1346
+ }), l.visible = !0, n)
1347
+ return `已应用要素效果到“${l.title ?? e.layerId}”,范围为当前地图视图。`;
1348
+ const c = e.objectIds?.length ? `${l.objectIdField} IN (${e.objectIds.join(",")})` : e.where, u = await oa(
1349
+ t,
1350
+ e.layerId,
1351
+ c,
1352
+ i,
1353
+ o?.distance,
1354
+ o?.units
1355
+ ), d = l.title ?? e.layerId;
1356
+ return u.success ? `已应用要素效果到目标图层“${l.title ?? e.layerId}"${o && "layerId" in o ? `,几何来自图层“${o.layerId}"` : ""}.` : `已应用过滤条件到“${d}”,但没有匹配的要素。${u.error}`;
1357
+ }, ia = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], F = s.enum(ia), sa = async ({
1358
+ targetLayer: e,
1359
+ geometryFilter: t,
1360
+ useCurrentExtent: r,
1361
+ includedEffect: a = "drop-shadow(2px, 2px, 2px, gray)",
1362
+ excludedEffect: o = "grayscale(100%) opacity(60%) blur(2px)"
1363
+ }, n) => {
1364
+ const { mapView: l } = k(n);
1365
+ return await na(e, l, a, o, t, r);
1366
+ }, la = s.object({
1367
+ layerId: s.string().describe("用作空间过滤几何来源的图层 layerId。"),
1368
+ where: s.string().describe("SQL-92 where 子句,用于选择作为过滤几何来源的要素。"),
1369
+ distance: s.number().optional().describe("几何周围的缓冲距离。"),
1370
+ units: F.optional().describe("缓冲距离的单位。")
1371
+ }), ca = s.object({
1372
+ point: s.object({
1373
+ x: s.number().describe("导航结果的 X 坐标,即经度"),
1374
+ y: s.number().describe("导航结果的 Y 坐标,即纬度"),
1375
+ spatialReference: s.object({
1376
+ wkid: s.number().describe("空间参考 WKID,例如4326表示 WGS84")
1377
+ }).optional().describe("空间参考,未提供时默认使用地图空间参考。")
1378
+ }).describe("之前导航或地理编码结果中的点坐标"),
1379
+ distance: s.number().optional().describe("点周围的可选缓冲距离。"),
1380
+ units: F.optional().describe("缓冲距离的单位。")
1381
+ }), ua = s.object({
1382
+ targetLayer: s.object({
1383
+ layerId: s.string().describe("要设置要素效果的图层 layerId。"),
1384
+ where: s.string().describe("SQL-92 where 子句,用于选择需要强调的要素。"),
1385
+ objectIds: s.array(s.number()).optional().describe(
1386
+ "之前查询结果中的 objectIds 数组。当查询返回 objectIds,例如前 N 项结果时,使用它代替 where。提供此参数时优先于 where。"
1387
+ )
1388
+ }),
1389
+ geometryFilter: s.union([la, ca]).optional().describe("空间查询使用的可选几何过滤参数。"),
1390
+ useCurrentExtent: s.boolean().optional().describe(
1391
+ "之前的查询使用当前地图范围作为空间过滤条件时设为 true,确保效果只作用于当前视图中的要素。默认 false。"
1392
+ ),
1393
+ includedEffect: s.string().default("drop-shadow(2px, 2px, 2px, gray)").describe(
1394
+ "对满足过滤条件的要素应用的效果。有效值包括 bloom、blur、brightness、contrast、drop-shadow、grayscale、hue-rotate、invert、opacity、saturate、sepia。未指定时优先使用默认效果。"
1395
+ ),
1396
+ excludedEffect: s.string().default("grayscale(100%) opacity(60%) blur(2px)").describe(
1397
+ "对不满足过滤条件的要素应用的效果。有效值包括 bloom、blur、brightness、contrast、drop-shadow、grayscale、hue-rotate、invert、opacity、saturate、sepia。未指定时优先使用默认效果。"
1398
+ )
1399
+ }), da = f(sa, {
1400
+ name: "setFeatureEffect",
1401
+ description: "根据过滤参数和要素效果,为指定图层中满足条件的要素设置强调效果。未提供效果信息时使用默认效果。",
1402
+ schema: ua
1403
+ }), pa = /* @__PURE__ */ new Set([
1404
+ "date",
1405
+ "esrifieldtypedate",
1406
+ "date-only",
1407
+ "dateonly",
1408
+ "esrifieldtypedateonly",
1409
+ "time-only",
1410
+ "timeonly",
1411
+ "esrifieldtypetimeonly",
1412
+ "timestamp-offset",
1413
+ "timestampoffset",
1414
+ "esrifieldtypetimestampoffset"
1415
+ ]), Re = (e) => {
1416
+ if (!e)
1417
+ return !1;
1418
+ const t = e.toLowerCase();
1419
+ return pa.has(t);
1420
+ }, te = (e) => {
1421
+ if (e instanceof Date)
1422
+ return Number.isNaN(e.getTime()) ? null : e;
1423
+ if (typeof e == "number" && Number.isFinite(e)) {
1424
+ const t = new Date(e);
1425
+ return Number.isNaN(t.getTime()) ? null : t;
1426
+ }
1427
+ return null;
1428
+ }, ma = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, ha = (e) => {
1429
+ if (typeof e == "string" && e)
1430
+ return e;
1431
+ const t = te(e);
1432
+ return t ? t.toISOString().slice(0, 10) : null;
1433
+ }, ri = () => {
1434
+ const e = (/* @__PURE__ */ new Date()).getTimezoneOffset(), t = e <= 0 ? "+" : "-", r = Math.floor(Math.abs(e) / 60).toString().padStart(2, "0"), a = (Math.abs(e) % 60).toString().padStart(2, "0"), o = `${t}${r}:${a}`;
1435
+ return { userTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone, userTimezoneOffset: o };
1436
+ }, ya = (e, t, r) => {
1437
+ const a = t?.toLowerCase();
1438
+ if (a && !Re(a))
1439
+ return e;
1440
+ if (a === "date-only") {
1441
+ const n = ha(e);
1442
+ return n ? ct(n, _("short-date")) : e;
1443
+ }
1444
+ if (a === "time-only") {
1445
+ if (typeof e == "string" && e)
1446
+ return ut(e, _("long-time"));
1447
+ const n = te(e);
1448
+ return n ? ye(n, {
1449
+ ..._("long-time"),
1450
+ timeZone: "UTC"
1451
+ }) : e;
1452
+ }
1453
+ const o = te(e);
1454
+ return o ? ye(o, {
1455
+ ..._("short-date-short-time"),
1456
+ timeZone: ma(r)
1457
+ }) : e;
1458
+ }, $e = (e, t, r) => {
1459
+ if (e && typeof e != "function") {
1460
+ const a = "getField" in r && r.getField?.(e), o = a && "getFieldDomain" in r && r.getFieldDomain ? r.getFieldDomain(a.name) : null;
1461
+ if (o?.type === "coded-value") {
1462
+ const l = o.codedValues.find((i) => i.code === t);
1463
+ return l ? l.name : null;
1464
+ }
1465
+ }
1466
+ return null;
1467
+ }, fa = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, ga = (e) => {
1468
+ if (e instanceof Date)
1469
+ return Number.isNaN(e.getTime()) ? null : e;
1470
+ if (typeof e == "number" && Number.isFinite(e)) {
1471
+ const t = new Date(e);
1472
+ return Number.isNaN(t.getTime()) ? null : t;
1473
+ }
1474
+ if (typeof e == "string" && e) {
1475
+ const t = new Date(e);
1476
+ return Number.isNaN(t.getTime()) ? null : t;
1477
+ }
1478
+ return null;
1479
+ }, wa = (e, t) => {
1480
+ if (typeof e != "number")
1481
+ return e;
1482
+ const r = {};
1483
+ t.minimumFractionDigits !== void 0 && (r.minimumFractionDigits = t.minimumFractionDigits), t.maximumFractionDigits !== void 0 && (r.maximumFractionDigits = t.maximumFractionDigits), t.useGrouping === "always" ? r.useGrouping = !0 : t.useGrouping === "never" && (r.useGrouping = !1);
1484
+ try {
1485
+ return new Intl.NumberFormat(void 0, r).format(e);
1486
+ } catch {
1487
+ return e;
1488
+ }
1489
+ }, ba = (e, t, r) => {
1490
+ const a = ga(e);
1491
+ if (!a)
1492
+ return e;
1493
+ const o = {};
1494
+ t.dateStyle ? o.dateStyle = t.dateStyle : (t.year && (o.year = t.year), t.month && (o.month = t.month)), t.timeStyle && (o.timeStyle = t.timeStyle), t.timeStyle && t.hour12 === "always" ? o.hour12 = !0 : t.timeStyle && t.hour12 === "never" && (o.hour12 = !1), o.timeZone = fa(r);
1495
+ try {
1496
+ return new Intl.DateTimeFormat(void 0, o).format(a);
1497
+ } catch {
1498
+ return e;
1499
+ }
1500
+ }, Ce = (e, t) => e.getFieldAlias?.(t) ?? e.fieldsIndex?.get(t)?.alias ?? e.fieldsIndex?.get(t)?.name ?? t, Ee = (e, t, r, a, o) => {
1501
+ if (r == null)
1502
+ return r;
1503
+ const l = e.getFieldConfiguration?.(t)?.fieldFormat;
1504
+ return l?.type === "number" ? wa(r, l) : l?.type === "date-time" ? !a || Re(a) ? ba(r, l, o) : r : ya(r, a, o);
1505
+ }, Ta = (e, t, r, a) => {
1506
+ const o = e.fieldsIndex?.get(t), n = $e(t, r, e) ?? r;
1507
+ return Ee(e, t, n, o?.type, a);
1508
+ }, Sa = (e, t) => Ce(e, t), Fe = (e, t, r) => {
1509
+ const a = e.objectIdField, o = t.features.map(
1510
+ (l) => l.attributes[a]
1511
+ ), n = t.features.map((l) => {
1512
+ const i = l.attributes, c = {};
1513
+ return e.fields.forEach((u) => {
1514
+ if (!Object.hasOwn(i, u.name))
1515
+ return;
1516
+ const d = i[u.name];
1517
+ if (u.name === a) {
1518
+ c[u.name] = d;
1519
+ return;
1520
+ }
1521
+ const p = $e(u.name, d, e) ?? d, m = Ce(e, u.name);
1522
+ c[m] = Ee(e, u.name, p, u.type, r);
1523
+ }), c;
1524
+ });
1525
+ return { objectIds: o, attributes: n };
1526
+ }, va = (e, t, r) => {
1527
+ const a = e.createQuery();
1528
+ return a.outFields = [t], a.where = r || "1=1", a.num = 1, a;
1529
+ }, xa = async (e, t, r, a) => {
1530
+ const o = a.map?.allLayers.find((m) => m.id === e), n = va(o, t, r.where), i = (await o.queryFeatures(n)).features[0], c = i ? i.attributes[t] : null, u = Ta(o, t, c, a.timeZone), d = Sa(o, t);
1531
+ return {
1532
+ tool: "getAttribute",
1533
+ layerName: o.title ?? e,
1534
+ summary: `${d} = ${u}`,
1535
+ details: {
1536
+ fieldName: t,
1537
+ fieldAlias: d !== t ? d : void 0,
1538
+ value: u,
1539
+ where: r.where
1540
+ }
1541
+ };
1542
+ };
1543
+ async function Ra({ layerId: e, fieldName: t, query: r }, a) {
1544
+ const { mapView: o } = k(a), n = await xa(e, t, r, o);
1545
+ return JSON.stringify(n, null, 2);
1546
+ }
1547
+ const $a = s.object({
1548
+ layerId: s.string().describe("要读取属性值的字段所属图层 layerId。"),
1549
+ fieldName: s.string().describe("要读取值的字段或属性名称。"),
1550
+ query: s.object({
1551
+ where: s.string().describe("用于选择要读取属性值的要素的 SQL-92 where 子句。")
1552
+ })
1553
+ }), Ca = f(Ra, {
1554
+ name: "getAttribute",
1555
+ description: "返回指定要素的一个属性值。",
1556
+ schema: $a
1557
+ }), le = (e, t, r) => {
1558
+ if (!(r ? e.hasAllFeaturesInView : e.hasAllFeatures))
1559
+ return !1;
1560
+ const o = new Set((e.availableFields ?? []).map((n) => n.toLowerCase()));
1561
+ return o.has("*") ? !0 : t.every((n) => o.has(n.toLowerCase()));
1562
+ };
1563
+ function K(e, t) {
1564
+ let r = e ?? "";
1565
+ return t != null && t && (r = r ? `(${r}) AND (${t})` : t), r || null;
1566
+ }
1567
+ const Ea = async (e) => {
1568
+ const { targetLayer: t, fieldName: r, statisticType: a, mapView: o, layersAndFieldsRegistry: n, geometryFilter: l } = e, i = o.map?.allLayers.find((S) => S.id === t.layerId);
1569
+ if (!i)
1570
+ throw new Error(`图层 '${t.layerId}' 不存在。`);
1571
+ const c = await o.whenLayerView(i), d = n.get(t.layerId)?.fieldRegistry.get(r), p = d?.alias;
1572
+ if (!d)
1573
+ throw new Error(`字段 '${r}' 不存在。`);
1574
+ let m, w;
1575
+ if (l) {
1576
+ const S = await J(l, o);
1577
+ if ("error" in S)
1578
+ throw new Error(S.error);
1579
+ if (!S.geometry)
1580
+ throw j(l) ? new Error(`没有符合以下条件的要素:${l.where}`) : new Error("创建几何失败");
1581
+ if (j(l)) {
1582
+ const Q = o.map?.allLayers.find((A) => A.id === l.layerId);
1583
+ m = {
1584
+ geometryLayerName: Q?.title ?? Q?.id,
1585
+ geometryLayerId: l.layerId,
1586
+ geometryWhere: l.where,
1587
+ distance: l.distance,
1588
+ units: l.units,
1589
+ applied: !0
1590
+ };
1591
+ } else U(l) && (m = {
1592
+ point: l.point,
1593
+ distance: l.distance,
1594
+ units: l.units,
1595
+ applied: !0
1596
+ });
1597
+ w = new Se({
1598
+ geometry: S.geometry,
1599
+ distance: l.distance,
1600
+ units: l.units,
1601
+ spatialRelationship: "intersects"
1602
+ });
1603
+ }
1604
+ const h = le(c, [r], !1);
1605
+ let y = null, g = null;
1606
+ const b = 10;
1607
+ if (d.type !== "geometry" && d.type !== "oid" && d.type !== "global-id")
1608
+ try {
1609
+ const S = {
1610
+ layer: i,
1611
+ useFeaturesInView: h,
1612
+ view: h ? o : void 0,
1613
+ field: r,
1614
+ sqlWhere: K(i.definitionExpression, t.where),
1615
+ ...w && { filter: w },
1616
+ outStatisticTypes: { include: [a] }
1617
+ };
1618
+ y = await dt(S);
1619
+ const Q = ["string", "small-integer", "integer"], A = d.domain?.type === "coded-value" ? d.domain : null;
1620
+ (Q.includes(d.type) || A) && (g = (await pt({
1621
+ layer: i,
1622
+ useFeaturesInView: h,
1623
+ view: h ? o : void 0,
1624
+ field: r,
1625
+ sqlWhere: K(i.definitionExpression, t.where),
1626
+ ...w && { filter: w }
1627
+ })).uniqueValueInfos.sort((I, ze) => ze.count - I.count).slice(0, b)), g && d.domain?.type === "coded-value" && (g = g.map((I) => ({
1628
+ ...I,
1629
+ value: A ? A.getName(I.value) ?? I.value : I.value
1630
+ })));
1631
+ } catch (S) {
1632
+ console.error("统计错误:", S);
1633
+ }
1634
+ return {
1635
+ tool: "getStatistics",
1636
+ layerName: i.title ?? t.layerId,
1637
+ summary: `${a} = ${typeof y?.[a] == "number" ? y[a] : "N/A"}`,
1638
+ details: {
1639
+ fieldName: r,
1640
+ fieldAlias: p,
1641
+ statisticType: a,
1642
+ statistic: y?.[a] ?? null,
1643
+ summaryStatistics: y,
1644
+ uniqueValues: g,
1645
+ where: t.where,
1646
+ spatialFilterInfo: m
1647
+ }
1648
+ };
1649
+ };
1650
+ async function Fa({
1651
+ targetLayer: e,
1652
+ fieldName: t,
1653
+ statisticType: r,
1654
+ geometryFilter: a
1655
+ }, o) {
1656
+ const n = xe(o, "layersAndFieldsRegistry"), { mapView: l } = k(o), i = await Ea({
1657
+ targetLayer: e,
1658
+ fieldName: t,
1659
+ statisticType: r,
1660
+ mapView: l,
1661
+ layersAndFieldsRegistry: n,
1662
+ geometryFilter: a
1663
+ });
1664
+ return JSON.stringify(i, null, 2);
1665
+ }
1666
+ const Na = s.object({
1667
+ layerId: s.string().describe("用作空间过滤几何来源的图层 layerId。"),
1668
+ where: s.string().describe("SQL-92 where 子句,用于选择作为过滤几何来源的要素。"),
1669
+ distance: s.number().optional().describe("几何周围的缓冲距离。"),
1670
+ units: F.optional().describe("缓冲距离的单位。")
1671
+ }), ka = s.object({
1672
+ point: s.object({
1673
+ x: s.number().describe("导航结果的 X 坐标,即经度"),
1674
+ y: s.number().describe("导航结果的 Y 坐标,即纬度"),
1675
+ spatialReference: s.object({
1676
+ wkid: s.number().describe("空间参考 WKID,例如4326表示 WGS84")
1677
+ }).optional().describe("空间参考,未提供时默认使用地图空间参考。")
1678
+ }).describe("之前导航或地理编码结果中的点坐标"),
1679
+ distance: s.number().optional().describe("点周围的可选缓冲距离。"),
1680
+ units: F.optional().describe("缓冲距离的单位。")
1681
+ }), qa = s.object({
1682
+ targetLayer: s.object({
1683
+ layerId: s.string().describe("要读取属性值的字段所属图层 layerId。"),
1684
+ where: s.string().describe("用于选择要读取属性值的要素的 SQL-92 where 子句。")
1685
+ }),
1686
+ geometryFilter: s.union([Na, ka]).optional().describe(
1687
+ "空间查询的几何过滤条件。使用 point 和导航结果的 x/y 坐标查找该点位置的要素(点落入面);使用 layerId/where 按其他图层的要素进行空间过滤。"
1688
+ ),
1689
+ fieldName: s.string().describe("要统计的字段名称,严禁使用 OBJECTID,应选择其他字段。"),
1690
+ statisticType: s.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("要计算的统计类型。")
1691
+ }), Ia = f(Fa, {
1692
+ name: "getStatistics",
1693
+ description: `对匹配要素的某个数值字段计算单项聚合统计,例如 max、min、avg、sum、median、stddev、variance;对分类字段还返回频数分析。
1694
+
1695
+ 适用:
1696
+ - 某字段的平均值、最大值、最小值、总和。
1697
+ - 某字段最常见或出现最多的值。
1698
+ - 需要对多个要素进行数学聚合的问题。
1699
+
1700
+ 不适用:
1701
+ - 有多少要素匹配条件:使用 queryFeatures,它返回 totalCount。
1702
+ - 显示、列出或查找要素:使用 queryFeatures。
1703
+ - 对符合条件的要素简单计数:使用 queryFeatures。
1704
+
1705
+ 仅在答案需要对字段值聚合计算时调用,不能只为计数或列出要素而调用。`,
1706
+ schema: qa
1707
+ }), Da = (e) => e.flatMap((t) => t.split(",")).map((t) => t.trim()).map((t) => t.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((t) => !!t), za = async (e, t, r, a, o) => {
1708
+ const n = r.map?.allLayers.find((m) => m.id === e.layerId), l = await r.whenLayerView(n), i = n.title ?? e.layerId;
1709
+ let c;
1710
+ if (a) {
1711
+ const m = await J(a, r);
1712
+ if ("error" in m)
1713
+ return {
1714
+ tool: "getTopFeatures",
1715
+ layerName: i,
1716
+ summary: "查找几何失败",
1717
+ details: { error: m.error }
1718
+ };
1719
+ if (!m.geometry)
1720
+ return {
1721
+ tool: "getTopFeatures",
1722
+ layerName: i,
1723
+ summary: "没有符合几何过滤条件的要素",
1724
+ details: {
1725
+ error: `没有符合以下条件的要素:${"where" in a ? a.where : "未知条件"}`
1726
+ }
1727
+ };
1728
+ c = m.geometry;
1729
+ } else o && (c = r.extent.clone());
1730
+ const u = t.groupByFields && t.groupByFields.length > 0, d = n.objectIdField, p = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, d])];
1731
+ try {
1732
+ let m;
1733
+ if (u) {
1734
+ const y = new mt({
1735
+ where: e.where || "1=1",
1736
+ outFields: p,
1737
+ orderByFields: e.orderByFields,
1738
+ geometry: c,
1739
+ spatialRelationship: c ? "intersects" : void 0,
1740
+ distance: a?.distance,
1741
+ units: a?.units,
1742
+ topFilter: new ht({
1743
+ topCount: t.topCount,
1744
+ groupByFields: t.groupByFields,
1745
+ orderByFields: t.orderByFields
1746
+ })
1747
+ });
1748
+ m = await n.queryTopFeatures(y);
1749
+ } else {
1750
+ const y = n.createQuery();
1751
+ y.where = K(n.definitionExpression, e.where || "1=1"), y.outFields = p.length ? p : ["*"], y.orderByFields = t.orderByFields, y.returnGeometry = !1, y.num = t.topCount, c && (y.geometry = c, y.spatialRelationship = "intersects"), a?.distance && (y.distance = a.distance), a?.units && (y.units = a.units), y.outSpatialReference = r.spatialReference;
1752
+ const g = [
1753
+ .../* @__PURE__ */ new Set([...e.outFields, ...Da(t.orderByFields)])
1754
+ ], b = le(l, g, o ?? !1);
1755
+ try {
1756
+ m = b ? await l.queryFeatures(y) : await n.queryFeatures(y);
1757
+ } catch (v) {
1758
+ console.warn("客户端查询失败,改为服务端查询:", v), m = await n.queryFeatures(y);
1759
+ }
1760
+ }
1761
+ const w = m.features.map((y) => y.attributes[d]), { attributes: h } = Fe(n, m, r.timeZone);
1762
+ return {
1763
+ tool: "getTopFeatures",
1764
+ layerName: i,
1765
+ summary: `已提取前 ${t.topCount} 个要素`,
1766
+ details: {
1767
+ topCount: t.topCount,
1768
+ attributes: h,
1769
+ objectIds: w,
1770
+ objectIdField: d,
1771
+ where: e.where,
1772
+ orderByFields: t.orderByFields,
1773
+ ...u && { groupByFields: t.groupByFields }
1774
+ }
1775
+ };
1776
+ } catch (m) {
1777
+ return {
1778
+ tool: "getTopFeatures",
1779
+ layerName: i,
1780
+ summary: "查询失败",
1781
+ details: { error: m instanceof Error ? m.message : String(m) }
1782
+ };
1783
+ }
1784
+ }, Pa = async ({
1785
+ targetLayer: e,
1786
+ topFilter: t,
1787
+ geometryFilter: r,
1788
+ useCurrentExtent: a
1789
+ }, o) => {
1790
+ const { mapView: n } = k(o), l = await za(e, t, n, r, a);
1791
+ return JSON.stringify(l, null, 2);
1792
+ }, Aa = s.object({
1793
+ layerId: s.string().describe("用作空间过滤几何来源的图层 layerId。"),
1794
+ where: s.string().describe("SQL-92 where 子句,用于选择作为过滤几何来源的要素。"),
1795
+ distance: s.number().optional().describe("几何周围的缓冲距离。"),
1796
+ units: F.optional().describe("缓冲距离的单位。")
1797
+ }), La = s.object({
1798
+ point: s.object({
1799
+ x: s.number().describe("导航结果的 X 坐标,即经度"),
1800
+ y: s.number().describe("导航结果的 Y 坐标,即纬度"),
1801
+ spatialReference: s.object({
1802
+ wkid: s.number().describe("空间参考 WKID,例如4326表示 WGS84")
1803
+ }).optional().describe("空间参考,未提供时默认使用地图空间参考。")
1804
+ }).describe("之前导航或地理编码结果中的点坐标"),
1805
+ distance: s.number().optional().describe("点周围的可选缓冲距离。"),
1806
+ units: F.optional().describe("缓冲距离的单位。")
1807
+ }), ja = s.object({
1808
+ targetLayer: s.object({
1809
+ layerId: s.string().describe("要读取属性值的字段所属图层 layerId。"),
1810
+ where: s.string().describe("用于选择要读取属性值的要素的 SQL-92 where 子句。"),
1811
+ orderByFields: s.array(s.string().describe("查询结果的排序字段及排序方向。")),
1812
+ outFields: s.array(
1813
+ s.string().describe(
1814
+ "向用户展示的输出字段,应包含名称或 ID 等要素标识,以及用户需要的值。不确定时选择全部字段(\"*\")。"
1815
+ ).default("*")
1816
+ )
1817
+ }),
1818
+ geometryFilter: s.union([Aa, La]).optional().describe(
1819
+ "空间查询的几何过滤条件。使用 point 和导航结果的 x/y 坐标查找该点位置的要素(点落入面);使用 layerId/where 按其他图层的要素进行空间过滤。"
1820
+ ),
1821
+ topFilter: s.object({
1822
+ topCount: s.number().describe("每组返回的前几条要素数量。"),
1823
+ orderByFields: s.array(
1824
+ s.string().describe("用于排名的字段及 ASC/DESC,必须使用已有字段名,不能使用聚合函数。")
1825
+ ),
1826
+ groupByFields: s.array(s.string().describe("结果分组字段,每组返回前 N 个要素。"))
1827
+ }).required(),
1828
+ useCurrentExtent: s.boolean().optional().describe(
1829
+ "仅当用户明确询问“我的视图内”“我的地图上”“我正在看的”要素时设为 true,默认 false,查询整个图层。"
1830
+ )
1831
+ }), Ga = f(Pa, {
1832
+ name: "getTopFeatures",
1833
+ description: "按已有字段值排序,返回前 N 个要素。适用于基于人口、数值、日期、深度等已有字段的“最高”“最低”“前 N 个”问题。orderByFields 必须使用真实字段名及 ASC/DESC。不要使用 COUNT()、SUM()、AVG() 等聚合函数,聚合应使用 getStatistics。",
1834
+ schema: ja
1835
+ }), ee = 25, Oa = (e) => e.flatMap((t) => t.split(",")).map((t) => t.trim()).map((t) => t.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((t) => !!t), Ma = async (e, t, r, a) => {
1836
+ const o = t.map?.allLayers.find((g) => g.id === e.layerId), n = await t.whenLayerView(o), l = o.title ?? e.layerId;
1837
+ let i;
1838
+ if (r) {
1839
+ const g = await J(r, t);
1840
+ if ("error" in g) {
1841
+ const b = { error: g.error };
1842
+ if (j(r)) {
1843
+ const v = t.map?.allLayers.find((S) => S.id === r.layerId);
1844
+ b.geometryLayerName = v?.title ?? v?.id, b.geometryLayerId = r.layerId, b.geometryWhere = r.where;
1845
+ } else U(r) && (b.point = r.point);
1846
+ return {
1847
+ tool: "queryFeatures",
1848
+ layerName: l,
1849
+ summary: "查找几何失败",
1850
+ details: b
1851
+ };
1852
+ }
1853
+ if (!g.geometry) {
1854
+ const b = {};
1855
+ if (j(r)) {
1856
+ const v = t.map?.allLayers.find((S) => S.id === r.layerId);
1857
+ b.error = `没有符合以下条件的要素:${r.where}`, b.geometryLayerName = v?.title ?? v?.id, b.geometryLayerId = r.layerId, b.geometryWhere = r.where;
1858
+ } else U(r) && (b.error = "创建点几何失败", b.point = r.point);
1859
+ return {
1860
+ tool: "queryFeatures",
1861
+ layerName: l,
1862
+ summary: "没有符合几何过滤条件的要素",
1863
+ details: b
1864
+ };
1865
+ }
1866
+ i = g.geometry;
1867
+ } else a && (i = t.extent.clone());
1868
+ const c = [
1869
+ .../* @__PURE__ */ new Set([...e.outFields, ...Oa(e.orderByFields)])
1870
+ ], u = le(n, c, a ?? !1), d = o.objectIdField, p = o.createQuery();
1871
+ p.where = K(o.definitionExpression, e.where || "1=1"), p.outFields = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, d])], p.orderByFields = e.orderByFields, i && (p.geometry = i, p.spatialRelationship = "intersects"), r?.distance && (p.distance = r.distance), r?.units && (p.units = r.units), p.outSpatialReference = t.spatialReference;
1872
+ let m, w;
1873
+ try {
1874
+ m = u ? await n.queryFeatureCount(p) : await o.queryFeatureCount(p), m > 0 && m <= ee && (w = u ? await n.queryFeatures(p) : await o.queryFeatures(p));
1875
+ } catch (g) {
1876
+ console.warn("客户端查询失败,改为服务端查询:", g), m = await o.queryFeatureCount(p), m > 0 && m <= ee && (w = await o.queryFeatures(p));
1877
+ }
1878
+ const { objectIds: h, attributes: y } = w ? Fe(o, w, t.timeZone) : { objectIds: void 0, attributes: void 0 };
1879
+ return {
1880
+ tool: "queryFeatures",
1881
+ layerName: l,
1882
+ summary: `${m} 个要素`,
1883
+ details: {
1884
+ totalCount: m,
1885
+ where: e.where,
1886
+ orderByFields: e.orderByFields,
1887
+ outFields: e.outFields,
1888
+ ...h && { objectIds: h, objectIdField: d },
1889
+ ...y && { attributes: y },
1890
+ ...m > ee && {
1891
+ note: `${m} 个要素。`
1892
+ }
1893
+ }
1894
+ };
1895
+ };
1896
+ async function Qa({
1897
+ targetLayer: e,
1898
+ geometryFilter: t,
1899
+ useCurrentExtent: r
1900
+ }, a) {
1901
+ const { mapView: o } = k(a), n = await Ma(e, o, t, r);
1902
+ return JSON.stringify(n, null, 2);
1903
+ }
1904
+ const _a = s.object({
1905
+ layerId: s.string().describe("用作空间过滤几何来源的图层 layerId。"),
1906
+ where: s.string().describe("SQL-92 where 子句,用于选择作为过滤几何来源的要素。"),
1907
+ distance: s.number().optional().describe("几何周围的缓冲距离。"),
1908
+ units: F.optional().describe("缓冲距离的单位。")
1909
+ }), Wa = s.object({
1910
+ point: s.object({
1911
+ x: s.number().describe("导航结果的 X 坐标,即经度"),
1912
+ y: s.number().describe("导航结果的 Y 坐标,即纬度"),
1913
+ spatialReference: s.object({
1914
+ wkid: s.number().describe("空间参考 WKID,例如4326表示 WGS84")
1915
+ }).optional().describe("空间参考,未提供时默认使用地图空间参考。")
1916
+ }).describe("之前导航或地理编码结果中的点坐标"),
1917
+ distance: s.number().optional().describe("点周围的可选缓冲距离。"),
1918
+ units: F.optional().describe("缓冲距离的单位。")
1919
+ }), Va = s.object({
1920
+ targetLayer: s.object({
1921
+ layerId: s.string().describe("要读取属性值的字段所属图层 layerId。"),
1922
+ where: s.string().describe(
1923
+ "SQL-92 where 子句。重要:使用 geometryFilter.point 进行点落入面查询时,设为 '1=1',返回与点相交的全部要素;只有用户在空间查询之外明确要求属性过滤时,才添加属性条件。"
1924
+ ),
1925
+ orderByFields: s.array(s.string().describe("查询结果的排序字段及排序方向。")),
1926
+ outFields: s.array(
1927
+ s.string().describe(
1928
+ "向用户展示的输出字段,应包含名称或 ID 等要素标识,以及用户需要的值。不确定时选择全部字段(\"*\")。"
1929
+ ).default("*")
1930
+ )
1931
+ }),
1932
+ geometryFilter: s.union([_a, Wa]).optional().describe(
1933
+ "空间查询的几何过滤条件。使用 point 和导航结果的 x/y 坐标查找该点位置的要素(点落入面);使用 layerId/where 按其他图层的要素进行空间过滤。"
1934
+ ),
1935
+ useCurrentExtent: s.boolean().optional().describe(
1936
+ "仅当用户明确询问当前视图中的要素,或指代之前通过当前范围识别的要素,例如“这些”“那些”“它们”“同一批”时设为 true。默认 false,查询整个图层。"
1937
+ )
1938
+ }), Ba = f(Qa, {
1939
+ name: "queryFeatures",
1940
+ description: `查询图层要素。返回匹配总数;不超过25个时,还返回各要素属性。
1941
+
1942
+ 适用:
1943
+ - 显示、列出满足条件的要素。
1944
+ - 有多少 X 满足 Y:按条件计数。
1945
+ - 哪些要素、查找要素:识别具体要素。
1946
+ - 空间查询:查找其他要素附近、内部或相交的要素。
1947
+ - 任何需要查看或统计匹配要素数量的问题。
1948
+
1949
+ 这是多数查询的默认工具,不确定时使用它。`,
1950
+ schema: Va
1951
+ }), Ua = [Ca, Ia, Ga, Ba], ai = [da, aa, ea], Ka = new it(Ua, { handleToolErrors: !1 });
1952
+ async function oi(e, t) {
1953
+ const { messages: r } = await Ka.invoke({ messages: e.dataExplorationMessages }, t), a = [], o = [];
1954
+ for (const n of r) {
1955
+ const l = n.content;
1956
+ let i;
1957
+ typeof l != "string" && (i = {
1958
+ tool: n.name ?? "unknown",
1959
+ layerName: "unknown",
1960
+ summary: "查询失败",
1961
+ details: { error: "跳过非字符串工具输出:", raw: l }
1962
+ });
1963
+ try {
1964
+ typeof l == "string" ? i = JSON.parse(l) : i = {
1965
+ tool: n.name ?? "unknown",
1966
+ layerName: "unknown",
1967
+ summary: "查询失败",
1968
+ details: { error: "工具输出类型无效", raw: l }
1969
+ };
1970
+ } catch {
1971
+ i = {
1972
+ tool: n.name ?? "unknown",
1973
+ layerName: "unknown",
1974
+ summary: "查询失败",
1975
+ details: { error: l }
1976
+ };
1977
+ }
1978
+ a.push(i), i.details && typeof i.details == "object" && "error" in i.details ? o.push(`- ${i.tool}:错误——${String(i.details.error)}`) : o.push(`- ${i.layerName}: ${i.summary}`);
1979
+ }
1980
+ return await x({ text: `图层查询工具执行完成:${o.join(", ")}` }, t), {
1981
+ ...e,
1982
+ dataExplorationMessages: [...e.dataExplorationMessages, ...r],
1983
+ queryResponse: a,
1984
+ status: "success",
1985
+ summary: o.length > 0 ? Kt(o.join(`
1986
+ `)) : "查询已执行。"
1987
+ };
1988
+ }
1989
+ const ni = T.Root({
1990
+ ...H(),
1991
+ // internal to the help agent
1992
+ helpInternalState: T({
1993
+ reducer: L,
1994
+ default: () => ({
1995
+ toolCallMessage: void 0
1996
+ })
1997
+ })
1998
+ }), Ha = (e, t) => {
1999
+ const r = Array.from(e.values()).find(
2000
+ ({ layerItem: n }) => n.title?.toLowerCase().includes(t.toLowerCase())
2001
+ );
2002
+ if (!r) {
2003
+ const n = Array.from(e.values()).map((l) => l.layerItem.title).join(", ");
2004
+ return `未找到匹配图层“${t}”。可用图层:${n}`;
2005
+ }
2006
+ const a = Array.from(r.fieldRegistry.values()), o = a.map((n) => `- **${n.alias || n.name}** (\`${n.name}\`, ${n.type})${n.description ? `: ${n.description}` : ""}`).join(`
2007
+ `);
2008
+ return `**${r.layerItem.title}** 包含 ${a.length} 个字段:
2009
+
2010
+ ${o}`;
2011
+ }, Ja = async ({ layerTitle: e }, t) => {
2012
+ const r = xe(t, "layersAndFieldsRegistry");
2013
+ return Ha(r, e);
2014
+ }, ii = f(Ja, {
2015
+ name: "listLayerFields",
2016
+ description: "按图层标题列出全部字段。仅当用户明确要求查看指定图层的字段、列或属性时使用。一般帮助、能力介绍或列出图层时不得调用。",
2017
+ schema: s.object({
2018
+ layerTitle: s.string().describe("要列出字段的图层标题或部分标题。")
2019
+ })
2020
+ }), si = T.Root({
2021
+ ...H(),
2022
+ intent: T({
2023
+ reducer: (e, t) => t
2024
+ }),
2025
+ geosceneKnowledgeMessages: T({
2026
+ reducer: be,
2027
+ default: () => []
2028
+ }),
2029
+ geosceneKnowledgeToolResult: T({
2030
+ reducer: (e, t) => t,
2031
+ default: () => null
2032
+ })
2033
+ });
2034
+ function ce(e) {
2035
+ const t = e.map?.allLayers.filter((r) => r.type === "knowledge-graph");
2036
+ if (!t || t?.length !== 1)
2037
+ throw new Error("知识 Agent 当前仅支持恰好包含一个知识图谱图层的地图。");
2038
+ }
2039
+ function q(e) {
2040
+ return !!e?.map && !("activeLinkChartLayer" in e.map);
2041
+ }
2042
+ async function Y(e) {
2043
+ !e || q(e) || !e.map?.diagramNodesExtent || await e.goTo(e.map.diagramNodesExtent);
2044
+ }
2045
+ function O(e) {
2046
+ const r = e?.configurable?.context;
2047
+ if (!r || typeof r != "object")
2048
+ throw new Error("GeosceneKnowledgeAgent 缺少上下文");
2049
+ if (!("view" in r))
2050
+ throw new Error("缺少视图上下文");
2051
+ const a = r.view;
2052
+ return a.map && !("activeLinkChartLayer" in a.map) && ce(a), {
2053
+ view: a
2054
+ };
2055
+ }
2056
+ function li(e) {
2057
+ const r = e?.configurable?.context;
2058
+ if (Ne(e) === "knowledgeGraph")
2059
+ return "knowledgeGraph";
2060
+ const o = r.view;
2061
+ return q(o) ? (ce(o), "map") : "linkChart";
2062
+ }
2063
+ async function M(e) {
2064
+ const r = e?.configurable?.context;
2065
+ if (Ne(e) === "knowledgeGraph")
2066
+ return r;
2067
+ {
2068
+ const o = r.view.map;
2069
+ if (o && "activeLinkChartLayer" in o) {
2070
+ const n = o.knowledgeGraph?.url;
2071
+ if (!n)
2072
+ throw new Error("链接图缺少知识图谱 URL。");
2073
+ return {
2074
+ knowledgeGraph: await fe(n)
2075
+ };
2076
+ } else {
2077
+ ce(r.view);
2078
+ const l = (r.view.map?.allLayers.find(
2079
+ (c) => c.type === "knowledge-graph"
2080
+ )).url;
2081
+ if (!l)
2082
+ throw new Error("地图缺少知识图谱 URL。");
2083
+ return {
2084
+ knowledgeGraph: await fe(l)
2085
+ };
2086
+ }
2087
+ }
2088
+ }
2089
+ function Ne(e) {
2090
+ const r = e?.configurable?.context;
2091
+ if (!r || typeof r != "object")
2092
+ throw new Error("GeosceneKnowledgeAgent 缺少上下文");
2093
+ if ("knowledgeGraph" in r && "view" in r)
2094
+ throw new Error("知识图谱上下文只能包含 view 或 knowledgeGraph 其中之一,不能同时提供。");
2095
+ if ("knowledgeGraph" in r)
2096
+ return "knowledgeGraph";
2097
+ if ("view" in r)
2098
+ return "view";
2099
+ throw new Error("GeosceneKnowledgeAgent 上下文必须包含 view 或 knowledgeGraph。");
2100
+ }
2101
+ class Ya {
2102
+ constructor(t) {
2103
+ this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = ue.fromDataModel(t);
2104
+ }
2105
+ }
2106
+ class ue {
2107
+ constructor() {
2108
+ this.schemaType = "GeosceneGraphSchema", this.entityTypes = [], this.relationshipTypes = [], this.identifierInfo = {
2109
+ mappingInfo: {
2110
+ identifierMapsTo: "UniformPropertyIdentifier",
2111
+ identifierPropertyName: "globalid"
2112
+ }
2113
+ };
2114
+ }
2115
+ static fromDataModel(t) {
2116
+ const r = new ue();
2117
+ for (const a of t.entityTypes)
2118
+ r.entityTypes.push(G.fromEntityType(a));
2119
+ for (const a of t.relationshipTypes)
2120
+ r.relationshipTypes.push(Za.fromRelationshipType(a));
2121
+ return r.identifierInfo = {
2122
+ mappingInfo: {
2123
+ identifierMapsTo: Xa(
2124
+ t.identifierInfo.identifierMappingInfo.identifierInfoType
2125
+ ),
2126
+ identifierPropertyName: t.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName
2127
+ }
2128
+ }, r.spatialReference = JSON.parse(JSON.stringify(t.spatialReference)), r;
2129
+ }
2130
+ // Generates a short summary of the types in the data model for LLM consumption.
2131
+ static getDataModelTypesSummary(t) {
2132
+ const r = t.entityTypes.map((o) => o.name).join(", "), a = t.relationshipTypes.map((o) => o.name).join(", ");
2133
+ return `实体类型:${r}。
2134
+ 关系类型:${a}.`;
2135
+ }
2136
+ }
2137
+ class G {
2138
+ constructor() {
2139
+ this.name = "", this.properties = [];
2140
+ }
2141
+ static fromEntityType(t) {
2142
+ const r = new G();
2143
+ r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = eo(t.role);
2144
+ for (const a of t.properties) {
2145
+ const o = {
2146
+ name: a.name,
2147
+ alias: a.alias ? a.alias : void 0,
2148
+ fieldType: a.fieldType,
2149
+ role: to(a.role),
2150
+ geometryDef: a.fieldType === "esriFieldTypeGeometry" ? {
2151
+ geometryType: a.geometryType ?? "esriGeometryAny",
2152
+ hasM: a.hasM ? a.hasM : void 0,
2153
+ hasZ: a.hasZ ? a.hasZ : void 0
2154
+ } : void 0
2155
+ };
2156
+ r.properties.push(o);
2157
+ }
2158
+ return r;
2159
+ }
2160
+ }
2161
+ class Za extends G {
2162
+ constructor() {
2163
+ super(...arguments), this.observedEndPoints = [];
2164
+ }
2165
+ static fromRelationshipType(t) {
2166
+ const r = G.fromEntityType(t);
2167
+ r.observedEndPoints = [];
2168
+ for (const a of t.endPoints)
2169
+ r.observedEndPoints.push({
2170
+ originEntityType: a.originEntityType,
2171
+ destinationEntityType: a.destinationEntityType
2172
+ });
2173
+ return r;
2174
+ }
2175
+ }
2176
+ const Xa = (e) => {
2177
+ switch (e) {
2178
+ case "esriIdentifierInfoTypeUNSPECIFIED":
2179
+ return "UNSPECIFIED";
2180
+ case "esriIdentifierInfoTypeDatabaseNative":
2181
+ return "DatabaseNative";
2182
+ case "esriIdentifierInfoTypeUniformProperty":
2183
+ return "UniformPropertyIdentifier";
2184
+ default:
2185
+ return e;
2186
+ }
2187
+ }, eo = (e) => {
2188
+ switch (e) {
2189
+ case "Regular":
2190
+ return "esriGraphNamedObjectRegular";
2191
+ case "Provenance":
2192
+ return "esriGraphNamedObjectProvenance";
2193
+ case "Document":
2194
+ return "esriGraphNamedObjectDocument";
2195
+ default:
2196
+ return e;
2197
+ }
2198
+ };
2199
+ function to(e) {
2200
+ switch (e) {
2201
+ case "esriGraphPropertyRegular":
2202
+ return "Regular";
2203
+ case "esriGraphPropertyDocumentName":
2204
+ return "Document_Name";
2205
+ case "esriGraphPropertyDocumentTitle":
2206
+ return "Document_Title";
2207
+ case "esriGraphPropertyDocumentUrl":
2208
+ return "Document_Url";
2209
+ case "esriGraphPropertyDocumentText":
2210
+ return "Document_Text";
2211
+ case "esriGraphPropertyDocumentKeywords":
2212
+ return "Document_Keywords";
2213
+ case "esriGraphPropertyDocumentContentType":
2214
+ return "Document_ContentType";
2215
+ case "esriGraphPropertyDocumentMetadata":
2216
+ return "Document_Metadata";
2217
+ case "esriGraphPropertyDocumentFileExtension":
2218
+ return "Document_FileExtension";
2219
+ case "esriGraphPropertyProvenanceInstanceId":
2220
+ return "Provenance_InstanceId";
2221
+ case "esriGraphPropertyProvenanceSourceType":
2222
+ return "Provenance_SourceType";
2223
+ case "esriGraphPropertyProvenanceSourceName":
2224
+ return "Provenance_SourceName";
2225
+ case "esriGraphPropertyProvenanceSource":
2226
+ return "Provenance_Source";
2227
+ case "esriGraphPropertyProvenanceComment":
2228
+ return "Provenance_Comment";
2229
+ case "esriGraphPropertyProvenanceTypeName":
2230
+ return "Provenance_TypeName";
2231
+ case "esriGraphPropertyProvenancePropertyName":
2232
+ return "Provenance_PropertyName";
2233
+ default:
2234
+ return "Regular";
2235
+ }
2236
+ }
2237
+ function Z(e) {
2238
+ return e?.signal;
2239
+ }
2240
+ async function ro(e, t) {
2241
+ const r = await B("geoscene_knowledge_cypher_query_prompt");
2242
+ return t ? `${e} ${r}
2243
+
2244
+ 上次生成的 Cypher 查询执行失败。请阅读下方信息,生成避免该错误的新查询。
2245
+
2246
+ 尝试次数:${t.attemptCount}
2247
+ 执行错误:${t.executionError}
2248
+ 失败的查询:
2249
+ ${t.failedGraphQuery}` : `${e} ${r}`;
2250
+ }
2251
+ async function ao(e, t, r, a) {
2252
+ const { graphQuery: o, explanation: n } = await de(e, t, r, a);
2253
+ return { graphQuery: o, explanation: n };
2254
+ }
2255
+ async function de(e, t, r, a, o) {
2256
+ const n = {
2257
+ message: await ro(e, o),
2258
+ context: new Ya(t)
2259
+ }, l = Z(a);
2260
+ await x({ text: "正在根据用户提示生成 Cypher 查询……" }, a);
2261
+ const i = await me(`${r}/chat`, {
2262
+ method: "post",
2263
+ body: JSON.stringify(n),
2264
+ headers: {
2265
+ "Content-Type": "application/json",
2266
+ token: pe.findCredential(N.getDefault().url)?.token ?? ""
2267
+ },
2268
+ signal: l
2269
+ });
2270
+ if (i.httpStatus !== 200)
2271
+ throw new Error(`图谱查询服务返回错误:${i.httpStatus}`, {
2272
+ cause: i.data
2273
+ });
2274
+ let c = !1;
2275
+ const u = Date.now();
2276
+ let d = i.data.sequenceNumber, p = "", m = "", w = 1;
2277
+ for (; !c; ) {
2278
+ await new Promise((y) => setTimeout(y, 1e3)), await x(
2279
+ { text: `正在定期查询 GeoScene AI 服务的任务状态${"...".substring(0, w)}` },
2280
+ a
2281
+ ), w = w % 3 + 1;
2282
+ const h = await me(`${r}/chat`, {
2283
+ method: "post",
2284
+ body: JSON.stringify({
2285
+ conversationId: i.data.conversationId,
2286
+ inquiryId: i.data.inquiryId,
2287
+ ackSequenceNumber: d
2288
+ }),
2289
+ headers: {
2290
+ "Content-Type": "application/json",
2291
+ token: pe.findCredential(N.getDefault().url)?.token ?? ""
2292
+ },
2293
+ signal: l
2294
+ });
2295
+ if (h.httpStatus !== 200)
2296
+ throw new Error(`轮询图谱查询服务时返回错误:${h.httpStatus}`, {
2297
+ cause: h.data
2298
+ });
2299
+ if (h.data.context?.kind) {
2300
+ if (h.data.context.kind !== "GraphQueryGenerationResponse")
2301
+ throw new Error(`图谱查询服务轮询响应异常,消息:${h.data.message}`, {
2302
+ cause: h.data
2303
+ });
2304
+ p = h.data.context.graphQuery, m = h.data.message || "", c = !0;
2305
+ } else if (!h.data.hasMore)
2306
+ c = !0;
2307
+ else if (Date.now() - u > 6e4)
2308
+ throw new Error("图谱查询服务轮询超过1分钟,已超时。");
2309
+ d = h.data.sequenceNumber;
2310
+ }
2311
+ return { graphQuery: p, explanation: m };
2312
+ }
2313
+ function oo(e, t) {
2314
+ D(e, (r) => {
2315
+ t.set(`${r.typeName}__${r.id}`, {
2316
+ id: r.id,
2317
+ typeName: r.typeName
2318
+ });
2319
+ });
2320
+ }
2321
+ function D(e, t) {
2322
+ if (!(!e || typeof e != "object")) {
2323
+ if (io(e))
2324
+ for (const r of e.path)
2325
+ D(r, t);
2326
+ else if (no(e))
2327
+ t(e);
2328
+ else if (Array.isArray(e))
2329
+ for (const r of e)
2330
+ D(r, t);
2331
+ else if (so(e))
2332
+ for (const r of Object.values(e.properties ?? {}))
2333
+ D(r, t);
2334
+ }
2335
+ }
2336
+ function no(e) {
2337
+ return !e || typeof e != "object" || Array.isArray(e) ? !1 : "id" in e && "typeName" in e;
2338
+ }
2339
+ function io(e) {
2340
+ return !e || typeof e != "object" || Array.isArray(e) ? !1 : e && "path" in e && Array.isArray(e.path);
2341
+ }
2342
+ function so(e) {
2343
+ return !e || typeof e != "object" || Array.isArray(e) || "id" in e ? !1 : "properties" in e && typeof e.properties == "object";
2344
+ }
2345
+ function lo(e, t) {
2346
+ const r = [], a = [], o = [
2347
+ [t.dataModel.entityTypes, r],
2348
+ [t.dataModel.relationshipTypes, a]
2349
+ ];
2350
+ for (const [n, l] of o)
2351
+ for (const i of n) {
2352
+ const c = e.getMemberIdsByType(i.name);
2353
+ l.push(...c);
2354
+ }
2355
+ return { entityIds: r, relationshipIds: a };
2356
+ }
2357
+ function co(e, t) {
2358
+ const r = { entityIds: new Array(), relationshipIds: new Array() }, a = [], n = e?.allLayers.find((c) => c.type === "knowledge-graph")?.inclusionModeDefinition;
2359
+ if (!n)
2360
+ return { allNamedTypesFullyDynamic: !0, bindParameters: r, nonDynamicTypes: a };
2361
+ const l = [
2362
+ [t.dataModel.entityTypes, r.entityIds],
2363
+ [t.dataModel.relationshipTypes, r.relationshipIds]
2364
+ ];
2365
+ let i = !0;
2366
+ for (const [c, u] of l)
2367
+ for (const d of c) {
2368
+ const p = n.namedTypeDefinitions.get(d.name);
2369
+ if (!p) {
2370
+ i = !1, a.push(d.name);
2371
+ continue;
2372
+ }
2373
+ if (!p.useAllData) {
2374
+ i = !1, a.push(d.name);
2375
+ for (const [m] of p.members || [])
2376
+ u.push(m);
2377
+ }
2378
+ }
2379
+ return { allNamedTypesFullyDynamic: i, bindParameters: r, nonDynamicTypes: a };
2380
+ }
2381
+ const z = 3;
2382
+ function ke(e, t = 100) {
2383
+ const r = {};
2384
+ for (const a of Object.entries(e.properties ?? {})) {
2385
+ const [o, n] = a;
2386
+ typeof n == "string" && n.length > t ? r[o] = `${n.slice(0, t)}……(已截断,原始长度:${n.length})` : r[o] = n;
2387
+ }
2388
+ return e.properties = r, e;
2389
+ }
2390
+ function P(e) {
2391
+ return typeof e != "object" || e === null ? String(e) : "details" in e && typeof e.details == "object" && e.details !== null && "errorMessage" in e.details && typeof e.details.errorMessage == "string" ? e.details.errorMessage : "message" in e && typeof e.message == "string" ? e.message : String(e);
2392
+ }
2393
+ const uo = async ({
2394
+ kg: e,
2395
+ queryParams: t,
2396
+ targetStructure: r,
2397
+ targetStructureReducer: a,
2398
+ requestOptions: o,
2399
+ queryRowLimit: n,
2400
+ queryTimeoutMs: l
2401
+ }) => {
2402
+ let i = null, c = r;
2403
+ const u = new AbortController(), d = o?.signal, p = () => {
2404
+ u.abort(d?.reason);
2405
+ };
2406
+ d && (d.aborted ? u.abort(d.reason) : d.addEventListener("abort", p, { once: !0 }));
2407
+ try {
2408
+ const m = await ft(e, t, o);
2409
+ i = m.resultHeader;
2410
+ const w = m.resultRowsStream.getReader();
2411
+ let h = 0;
2412
+ const y = Date.now(), g = !1;
2413
+ for (; ; ) {
2414
+ const { done: b, value: v } = await w.read();
2415
+ if (b)
2416
+ break;
2417
+ if (!g && l && Date.now() - y > l)
2418
+ return u.abort(), { type: "timeout" };
2419
+ for (const S of v) {
2420
+ if (h++, n && h > n)
2421
+ return u.abort(), { type: "success", rowLimitReached: !0, resultHeader: i, processedResult: c };
2422
+ c = a(c, S);
2423
+ }
2424
+ }
2425
+ } catch (m) {
2426
+ return u.signal.aborted ? { type: "aborted" } : { type: "error", errorMessage: P(m), error: m };
2427
+ } finally {
2428
+ d?.removeEventListener("abort", p);
2429
+ }
2430
+ return { type: "success", rowLimitReached: !1, resultHeader: i, processedResult: c };
2431
+ };
2432
+ async function qe({
2433
+ prompt: e,
2434
+ bindParameters: t,
2435
+ kg: r,
2436
+ graphQueryServiceUrl: a,
2437
+ targetStructure: o,
2438
+ targetStructureReducer: n,
2439
+ requestOptions: l,
2440
+ queryRowLimit: i,
2441
+ queryTimeoutMs: c,
2442
+ config: u
2443
+ }) {
2444
+ let d;
2445
+ for (let p = 1; p <= z; p++) {
2446
+ let m;
2447
+ try {
2448
+ m = await de(e, r.dataModel, a, u, d);
2449
+ } catch (g) {
2450
+ return {
2451
+ type: "generation-error",
2452
+ errorMessage: P(g),
2453
+ error: g
2454
+ };
2455
+ }
2456
+ await x(
2457
+ {
2458
+ text: `正在尝试执行查询:${m.graphQuery.substring(0, 500)}${m.graphQuery.length > 500 ? "..." : ""}`
2459
+ },
2460
+ u
2461
+ );
2462
+ const w = await po(m.graphQuery, t), h = await uo({
2463
+ kg: r,
2464
+ queryParams: new ve({
2465
+ openCypherQuery: m.graphQuery,
2466
+ bindParameters: w
2467
+ }),
2468
+ targetStructure: o,
2469
+ targetStructureReducer: n,
2470
+ requestOptions: l,
2471
+ queryRowLimit: i,
2472
+ queryTimeoutMs: c
2473
+ }), y = h.type === "aborted" ? "查询执行已中止。" : h.type === "timeout" ? "查询执行已超时。" : h.type === "error" ? `查询失败,错误:${h.errorMessage}` : "";
2474
+ if (h.type === "success")
2475
+ return {
2476
+ type: "success",
2477
+ graphQuery: m.graphQuery,
2478
+ explanation: m.explanation,
2479
+ rowLimitReached: h.rowLimitReached,
2480
+ resultHeader: h.resultHeader,
2481
+ processedResult: h.processedResult
2482
+ };
2483
+ if (h.type === "aborted")
2484
+ return {
2485
+ type: "aborted",
2486
+ errorMessage: y,
2487
+ graphQuery: m.graphQuery,
2488
+ explanation: m.explanation
2489
+ };
2490
+ if (p >= z)
2491
+ return h.type === "timeout" ? {
2492
+ type: "timeout",
2493
+ errorMessage: y,
2494
+ graphQuery: m.graphQuery,
2495
+ explanation: m.explanation
2496
+ } : {
2497
+ type: "execution-error",
2498
+ errorMessage: y,
2499
+ error: h.error,
2500
+ graphQuery: m.graphQuery,
2501
+ explanation: m.explanation
2502
+ };
2503
+ d = {
2504
+ failedGraphQuery: m.graphQuery,
2505
+ executionError: y,
2506
+ attemptCount: p
2507
+ }, await x(
2508
+ { text: `第 ${p} 次尝试失败,错误:${y}。正在重试……` },
2509
+ u
2510
+ );
2511
+ }
2512
+ throw new Error(
2513
+ `生成的 Cypher 查询在多次尝试后仍执行失败,尝试次数:${z}。`
2514
+ );
2515
+ }
2516
+ const po = async (e, t) => {
2517
+ if (!t)
2518
+ return {};
2519
+ const { bindParameters: r, parseErrors: a } = await bt(e);
2520
+ if (a)
2521
+ return t;
2522
+ const o = {};
2523
+ for (const n of r)
2524
+ n in t && (o[n] = t[n]);
2525
+ return o;
2526
+ }, mo = async ({
2527
+ kg: e,
2528
+ searchQuery: t,
2529
+ typeCategoryFilter: r,
2530
+ namedTypesFilter: a,
2531
+ searchResultLimit: o,
2532
+ requestOptions: n
2533
+ }) => {
2534
+ const l = [];
2535
+ let i = [r];
2536
+ r === "both" && !e.serviceDefinition.serviceCapabilities.searchCapabilities.searchTypeFilterCapabilities.includes("esriTypeBoth") && (i = ["entity", "relationship"]);
2537
+ const c = o ?? 1 / 0;
2538
+ try {
2539
+ for (const u of i) {
2540
+ const d = c - l.length;
2541
+ if (d <= 0)
2542
+ break;
2543
+ const w = (await gt(
2544
+ e,
2545
+ new wt({
2546
+ searchQuery: t,
2547
+ typeCategoryFilter: u,
2548
+ namedTypesFilter: a ?? void 0,
2549
+ num: d
2550
+ }),
2551
+ n
2552
+ )).resultRowsStream.getReader();
2553
+ let h = !1;
2554
+ for (; !h; ) {
2555
+ const { done: y, value: g } = await w.read();
2556
+ if (y) {
2557
+ h = !0;
2558
+ break;
2559
+ }
2560
+ for (const b of g)
2561
+ for (const v of b)
2562
+ l.push(v);
2563
+ }
2564
+ }
2565
+ } catch (u) {
2566
+ const d = P(u);
2567
+ return n?.signal?.aborted ? {
2568
+ type: "aborted",
2569
+ errorMessage: d,
2570
+ error: u
2571
+ } : { type: "error", errorMessage: d, error: u };
2572
+ }
2573
+ return {
2574
+ type: "success",
2575
+ results: l
2576
+ };
2577
+ }, Ie = "重要:生成的 Cypher 查询只能返回完整实体和关系。";
2578
+ async function De({
2579
+ prompt: e,
2580
+ view: t,
2581
+ knowledgeGraph: r,
2582
+ includeReturnEntityAndRelationshipContext: a = !1
2583
+ }) {
2584
+ const o = [e];
2585
+ if (a && o.push(Ie), !q(t)) {
2586
+ const d = await B("geoscene_knowledge_current_lc_context"), p = lo(t.map, r);
2587
+ return o.push(d), {
2588
+ enhancedPrompt: o.join(`
2589
+
2590
+ `),
2591
+ bindParameters: p,
2592
+ allNamedTypesFullyDynamic: !1
2593
+ };
2594
+ }
2595
+ const n = t.map, { allNamedTypesFullyDynamic: l, bindParameters: i, nonDynamicTypes: c } = co(
2596
+ n,
2597
+ r
2598
+ );
2599
+ if (l)
2600
+ return {
2601
+ enhancedPrompt: o.join(`
2602
+
2603
+ `),
2604
+ bindParameters: i,
2605
+ allNamedTypesFullyDynamic: !0
2606
+ };
2607
+ const u = (await B("geoscene_knowledge_current_map_context")).replaceAll(
2608
+ "{nonDynamicTypes}",
2609
+ JSON.stringify(c)
2610
+ );
2611
+ return o.push(u), {
2612
+ enhancedPrompt: o.join(`
2613
+
2614
+ `),
2615
+ bindParameters: i,
2616
+ allNamedTypesFullyDynamic: l
2617
+ };
2618
+ }
2619
+ async function ho(e, t, r, a, o, n) {
2620
+ const { view: l } = o, i = await qe({
2621
+ prompt: e,
2622
+ bindParameters: t,
2623
+ kg: r,
2624
+ graphQueryServiceUrl: a,
2625
+ targetStructure: /* @__PURE__ */ new Map(),
2626
+ targetStructureReducer: (m, w) => {
2627
+ for (const h of w)
2628
+ oo(h, m);
2629
+ return m;
2630
+ },
2631
+ requestOptions: {
2632
+ signal: Z(n),
2633
+ timeout: n?.timeout
2634
+ },
2635
+ config: n
2636
+ });
2637
+ if (i.type !== "success") {
2638
+ const m = i.type === "generation-error" ? i.errorMessage : `${i.errorMessage},Cypher 查询:${i.graphQuery}`;
2639
+ throw new Error(`添加记录到链接图失败。${m}`);
2640
+ }
2641
+ const { graphQuery: c, explanation: u, processedResult: d } = i, p = Array.from(d.values());
2642
+ return await x(
2643
+ {
2644
+ text: `查询结果已解析为 ${p.length} 个唯一的关系和实体,正在添加到链接图……`
2645
+ },
2646
+ n
2647
+ ), !q(l) && l?.map ? (await l.map.addRecords(p), await Y(l), { generatedQuery: c, explanation: u, addedIdTypePairs: p }) : (await l?.map?.allLayers.find(
2648
+ (w) => w.type === "knowledge-graph"
2649
+ )?.addRecords(p), { generatedQuery: c, explanation: u, addedIdTypePairs: p });
2650
+ }
2651
+ const W = "addRecords", yo = s.object({
2652
+ prompt: s.string().describe(
2653
+ "用于生成 Cypher 查询的用户问题及必要上下文,查询结果将添加到链接图。"
2654
+ )
2655
+ }), fo = async ({ prompt: e }, t) => {
2656
+ const { knowledgeGraph: r } = await M(t), a = O(t), { view: o } = a, l = N.getDefault().helperServices, {
2657
+ enhancedPrompt: i,
2658
+ bindParameters: c,
2659
+ allNamedTypesFullyDynamic: u
2660
+ } = await De({
2661
+ prompt: e,
2662
+ view: o,
2663
+ knowledgeGraph: r,
2664
+ includeReturnEntityAndRelationshipContext: !0
2665
+ });
2666
+ if (u)
2667
+ return {
2668
+ toolName: W,
2669
+ status: "success",
2670
+ summary: "知识图谱的全部数据已包含在地图中,因此没有新增记录。",
2671
+ details: {
2672
+ generatedQuery: "N/A",
2673
+ explanation: "知识图谱的所有命名类型都是完全动态的,全部数据已在地图中,因此没有新增记录。",
2674
+ addedIdTypePairs: []
2675
+ }
2676
+ };
2677
+ try {
2678
+ const { generatedQuery: d, explanation: p, addedIdTypePairs: m } = await ho(
2679
+ i,
2680
+ c,
2681
+ r,
2682
+ `${l.aiAssistantServices.url}${l.aiAssistantServices.graphQueryAssistant}`,
2683
+ a,
2684
+ t
2685
+ );
2686
+ return {
2687
+ toolName: W,
2688
+ status: "success",
2689
+ summary: `记录添加成功。使用的 Cypher 查询:${d}
2690
+
2691
+ 新增记录数量:${m.length}`,
2692
+ details: {
2693
+ generatedQuery: d,
2694
+ explanation: p,
2695
+ addedIdTypePairs: m
2696
+ }
2697
+ };
2698
+ } catch (d) {
2699
+ const p = P(d);
2700
+ return {
2701
+ toolName: W,
2702
+ status: "error",
2703
+ errorMessage: `添加记录到链接图失败。${p}`,
2704
+ error: d
2705
+ };
2706
+ }
2707
+ }, ci = f(fo, {
2708
+ name: W,
2709
+ description: `根据知识图谱查询结果,将实体或关系添加到当前链接图。用户必须明确要求添加到当前链接图;“添加到新链接图”不适用。
2710
+ 示例:将供应商和其生产零件加入链接图;查询公司 X 的竞争者并添加;添加公司 X 和 Y 的关系;展开所有公司;展开公司 X 拥有的建筑;连接公司 X 和 Y;连接图中的所有建筑。`,
2711
+ schema: yo
2712
+ });
2713
+ async function go(e, t) {
2714
+ return await t.map?.applyLayout(e), await Y(t), { appliedLayout: e };
2715
+ }
2716
+ const re = "applyLayout", wo = s.object({
2717
+ layout: s.enum([
2718
+ "organic-standard",
2719
+ "organic-community",
2720
+ "basic-grid",
2721
+ "hierarchical-bottom-to-top",
2722
+ "radial-root-centric",
2723
+ "tree-left-to-right",
2724
+ "geographic-organic-standard",
2725
+ "chronological-mono-timeline",
2726
+ "chronological-multi-timeline"
2727
+ ]).describe(
2728
+ "链接图布局模式,必须为以下值之一:organic-standard、organic-community、basic-grid、hierarchical-bottom-to-top、radial-root-centric、tree-left-to-right、geographic-organic-standard、chronological-mono-timeline、chronological-multi-timeline"
2729
+ )
2730
+ }), bo = async ({ layout: e }, t) => {
2731
+ const { view: r } = O(t);
2732
+ if (q(r))
2733
+ return {
2734
+ toolName: re,
2735
+ status: "error",
2736
+ errorMessage: "applyLayout 工具只能用于 LinkChartView。",
2737
+ error: new Error()
2738
+ };
2739
+ {
2740
+ const { appliedLayout: a } = await go(e, r);
2741
+ return {
2742
+ toolName: re,
2743
+ status: "success",
2744
+ summary: `已应用布局:${a}.`,
2745
+ details: {
2746
+ appliedLayout: a
2747
+ }
2748
+ };
2749
+ }
2750
+ }, ui = f(bo, {
2751
+ name: re,
2752
+ description: "为链接图应用图布局",
2753
+ schema: wo
2754
+ });
2755
+ async function To(e, t) {
2756
+ return t.map?.changeNonspatialDataDisplay(e), await Y(t), { appliedNonspatialDataDisplayMode: e };
2757
+ }
2758
+ const ae = "changeNonspatialVisibility", So = s.object({
2759
+ setting: s.enum(["hidden", "visible"]).describe("非空间数据可见性设置")
2760
+ }), vo = async ({ setting: e }, t) => {
2761
+ const { view: r } = O(t);
2762
+ if (q(r))
2763
+ return {
2764
+ toolName: ae,
2765
+ status: "error",
2766
+ errorMessage: "changeNonspatialVisibility 工具只能用于 LinkChartView。",
2767
+ error: new Error()
2768
+ };
2769
+ {
2770
+ const { appliedNonspatialDataDisplayMode: a } = await To(e, r);
2771
+ return {
2772
+ toolName: ae,
2773
+ status: "success",
2774
+ summary: `已设置非空间数据可见性:${a}.`,
2775
+ details: {
2776
+ appliedNonspatialDataDisplayMode: a
2777
+ }
2778
+ };
2779
+ }
2780
+ }, di = f(vo, {
2781
+ name: ae,
2782
+ description: "切换链接图中的非空间数据可见性,只能为 'hidden' 或 'visible'。",
2783
+ schema: So
2784
+ });
2785
+ async function xo(e, t, r, a, o) {
2786
+ let n, l = "";
2787
+ for (let i = 1; i <= z; i++) {
2788
+ const { graphQuery: c, explanation: u } = await de(
2789
+ e,
2790
+ t.dataModel,
2791
+ r,
2792
+ o,
2793
+ n
2794
+ );
2795
+ try {
2796
+ await x({ text: `正在使用生成的查询创建链接图:${c}` }, o);
2797
+ const d = await yt.fromCypherQuery(
2798
+ t,
2799
+ new ve({
2800
+ openCypherQuery: c
2801
+ })
2802
+ );
2803
+ await x({ text: "链接图创建成功,正在加载……" }, o), await d.load();
2804
+ const p = a.map;
2805
+ return a.map = d, await a.when(), await Le.whenOnce(() => !a.updating), d.entityCount === 0 && d.relationshipCount === 0 ? (a.map === d && (a.map = p), d.destroy(), {
2806
+ type: "error",
2807
+ errorMessage: `查询没有返回结果。用于创建链接图的 Cypher 查询:
2808
+ ${c}
2809
+
2810
+ 说明:${u}`
2811
+ }) : (await Y(a), {
2812
+ type: "success",
2813
+ graphQuery: c,
2814
+ explanation: u
2815
+ });
2816
+ } catch (d) {
2817
+ const p = P(d);
2818
+ if (i >= z) {
2819
+ l = p;
2820
+ break;
2821
+ }
2822
+ n = {
2823
+ failedGraphQuery: c,
2824
+ executionError: p,
2825
+ attemptCount: i
2826
+ }, await x(
2827
+ { text: `第 ${i} 次创建链接图失败,错误:${p}。正在重试……` },
2828
+ o
2829
+ );
2830
+ }
2831
+ }
2832
+ return {
2833
+ type: "error",
2834
+ errorMessage: `创建链接图失败,尝试次数:${z}。最后错误:${l}`
2835
+ };
2836
+ }
2837
+ const V = "createLinkChart", Ro = s.object({
2838
+ prompt: s.string().describe(
2839
+ "用于生成链接图查询的用户问题及必要上下文。只包含生成 Cypher 所需的信息,不要建议实体类型、关系类型或属性。除非用户明确要求,否则不要添加结果数量限制或格式指令。重点描述用户希望看到的数据,而不是生成方法。"
2840
+ )
2841
+ }), $o = async ({ prompt: e }, t) => {
2842
+ const { knowledgeGraph: r } = await M(t), { view: a } = O(t);
2843
+ if (q(a))
2844
+ return {
2845
+ toolName: V,
2846
+ status: "error",
2847
+ errorMessage: "createLinkChart 工具只能用于 LinkChartView。",
2848
+ error: new Error()
2849
+ };
2850
+ {
2851
+ const n = N.getDefault().helperServices, l = await xo(
2852
+ `${e}
2853
+
2854
+ ${Ie}`,
2855
+ r,
2856
+ `${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,
2857
+ a,
2858
+ t
2859
+ );
2860
+ if (l.type === "error")
2861
+ return {
2862
+ toolName: V,
2863
+ status: "error",
2864
+ errorMessage: l.errorMessage,
2865
+ error: new Error()
2866
+ };
2867
+ const { graphQuery: i, explanation: c } = l;
2868
+ return {
2869
+ toolName: V,
2870
+ status: "success",
2871
+ summary: `链接图创建成功。用于创建链接图的 Cypher 查询:
2872
+ ${i}
2873
+
2874
+ 说明:${c}`,
2875
+ details: {
2876
+ generatedQuery: i,
2877
+ explanation: c
2878
+ }
2879
+ };
2880
+ }
2881
+ }, pi = f($o, {
2882
+ name: V,
2883
+ description: "根据知识图谱数据查询创建新链接图。用户必须明确要求创建新链接图,例如“创建新链接图”或“添加到新链接图”。",
2884
+ schema: Ro
2885
+ }), oe = "queryGraphData", Co = s.object({
2886
+ prompt: s.string().describe(
2887
+ "用户对知识图谱的提问,将生成并执行 Cypher 查询。仅当用户提示或之前步骤提供了实体类型、关系类型或属性时才能包含,不要自行建议。除非用户明确要求,不要增加数量限制、返回内容、查询编写方法或结果格式指令。"
2888
+ )
2889
+ }), Eo = async ({ prompt: e }, t) => {
2890
+ const { knowledgeGraph: r } = await M(t), o = N.getDefault().helperServices;
2891
+ let n = e, l = null, i = null;
2892
+ try {
2893
+ ({ view: i } = O(t));
2894
+ } catch {
2895
+ }
2896
+ i && ({ enhancedPrompt: n, bindParameters: l } = await De({
2897
+ prompt: e,
2898
+ view: i,
2899
+ knowledgeGraph: r,
2900
+ includeReturnEntityAndRelationshipContext: !1
2901
+ }));
2902
+ const c = await qe({
2903
+ prompt: n,
2904
+ bindParameters: l,
2905
+ kg: r,
2906
+ graphQueryServiceUrl: `${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,
2907
+ targetStructure: new Array(),
2908
+ targetStructureReducer: (g, b) => (g.push(b), g),
2909
+ requestOptions: {
2910
+ signal: Z(t),
2911
+ timeout: t?.timeout
2912
+ },
2913
+ config: t
2914
+ });
2915
+ if (c.type !== "success") {
2916
+ const g = c.type === "generation-error" ? c.errorMessage : `${c.errorMessage},Cypher 查询:${c.graphQuery}`;
2917
+ return {
2918
+ toolName: oe,
2919
+ status: "error",
2920
+ errorMessage: `查询知识图谱失败。${g}`,
2921
+ error: "error" in c ? c.error : null
2922
+ };
2923
+ }
2924
+ const { graphQuery: u, explanation: d, processedResult: p, resultHeader: m } = c, w = m.headerKeys;
2925
+ for (const g of p)
2926
+ for (const b of g)
2927
+ D(
2928
+ b,
2929
+ (v) => ke(v)
2930
+ );
2931
+ const h = 50, y = p.slice(0, h).map((g) => JSON.stringify(g));
2932
+ return {
2933
+ toolName: oe,
2934
+ status: "success",
2935
+ summary: `为回答问题,对知识图谱执行了以下 Cypher 查询:
2936
+
2937
+ \`\`\`cypher
2938
+ ${u}
2939
+ \`\`\`
2940
+
2941
+ 查询结果:
2942
+ ${y.length} 条结果。
2943
+
2944
+ 列标题:${w.join(", ")}
2945
+
2946
+ ${y.length > h ? `显示前 ${h} 条结果:
2947
+
2948
+ ` : `结果:
2949
+
2950
+ `}${y.join(`
2951
+ `)}
2952
+ `,
2953
+ details: {
2954
+ generatedQuery: u,
2955
+ explanation: d,
2956
+ resultHeader: m,
2957
+ queryResults: p
2958
+ }
2959
+ };
2960
+ }, mi = f(Eo, {
2961
+ name: oe,
2962
+ description: "使用 Cypher 查询探索知识图谱数据。根据用户问题生成并执行查询,在聊天面板展示结果,不修改已有链接图。适用于可通过 Cypher 回答的整体数据探索问题,例如“按零件总成本排名前5的供应商”或“各部门员工有多少”。",
2963
+ schema: Co
2964
+ }), ne = "generateCypher", Fo = s.object({
2965
+ prompt: s.string().describe("需要转换为 Cypher 查询的用户知识图谱问题。")
2966
+ }), No = async ({ prompt: e }, t) => {
2967
+ const { knowledgeGraph: r } = await M(t), o = N.getDefault().helperServices;
2968
+ try {
2969
+ const { graphQuery: n, explanation: l } = await ao(
2970
+ e,
2971
+ r.dataModel,
2972
+ `${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,
2973
+ t
2974
+ );
2975
+ return {
2976
+ toolName: ne,
2977
+ status: "success",
2978
+ summary: `生成的图谱查询:
2979
+ ${n}
2980
+
2981
+ 说明:${l}`,
2982
+ details: {
2983
+ generatedQuery: n,
2984
+ explanation: l
2985
+ }
2986
+ };
2987
+ } catch (n) {
2988
+ const l = P(n);
2989
+ return {
2990
+ toolName: ne,
2991
+ status: "error",
2992
+ errorMessage: `生成 Cypher 查询失败。${l}`,
2993
+ error: n
2994
+ };
2995
+ }
2996
+ }, hi = f(No, {
2997
+ name: ne,
2998
+ description: "根据用户提示生成 Open Cypher 查询,对知识服务和图数据库的数据按条件过滤并遍历指定关系。查询必须语法正确并尽量优化性能。",
2999
+ schema: Fo
3000
+ }), ko = (e) => {
3001
+ const t = e.dataModel, r = /* @__PURE__ */ new Map();
3002
+ for (const i of t.searchIndexes)
3003
+ if (i.supportedCategory !== "esriTypeMetaEntityProvenance")
3004
+ for (const [c, u] of i.searchProperties.entries()) {
3005
+ const d = r.get(c) ?? /* @__PURE__ */ new Set();
3006
+ u.propertyNames.forEach((p) => d.add(p)), r.set(c, d);
3007
+ }
3008
+ const a = t.entityTypes.filter((i) => r.has(i.name)), o = t.relationshipTypes.filter((i) => r.has(i.name)), n = `实体类型:
3009
+ ${a.map(({ name: i }) => `${i}: [${Array.from(r.get(i) ?? []).join(", ")}]`).join(`
3010
+ `)}`, l = `关系类型:
3011
+ ${o.map(({ name: i }) => `${i}: [${Array.from(r.get(i) ?? []).join(", ")}]`).join(`
3012
+ `)}`;
3013
+ return `${n}
3014
+
3015
+ ${l}`;
3016
+ };
3017
+ async function qo(e, t, r) {
3018
+ const a = await B("geoscene_knowledge_lucene_generation_prompt"), o = {
3019
+ inquiry: e,
3020
+ dataModelForSearch: ko(t)
3021
+ }, n = s.enum(["entity", "relationship", "both"]).describe("搜索的图谱元素类别:entity、relationship 或 both"), l = s.number().int().positive().nullable().describe(
3022
+ "最多返回的搜索结果数量。用户未指定时默认10,明确要求不限或全部时设为 null。"
3023
+ ), i = s.array(
3024
+ s.enum(
3025
+ t.dataModel.entityTypes.map((d) => d.name).concat(t.dataModel.relationshipTypes.map((d) => d.name))
3026
+ )
3027
+ ).min(1), c = s.object({
3028
+ query: s.string().describe("发送给知识图谱搜索 API 的 Lucene 查询字符串"),
3029
+ typeFilters: i.nullable().describe(
3030
+ "用于限制搜索范围的实体或关系类型列表,可为 null。设为 null 时搜索全部具有已索引属性的命名类型。"
3031
+ ),
3032
+ typeCategoryFilter: n,
3033
+ resultLimit: l
3034
+ });
3035
+ return await Ae({
3036
+ promptText: a,
3037
+ inputVariables: o,
3038
+ schema: c,
3039
+ config: r
3040
+ });
3041
+ }
3042
+ const ie = "searchGraphData", Io = s.object({
3043
+ prompt: s.string().describe(
3044
+ "用户对知识图谱的提问,将据此生成并执行 Lucene 搜索以返回相关结果。"
3045
+ )
3046
+ }), Do = async ({ prompt: e }, t) => {
3047
+ const { knowledgeGraph: r } = await M(t);
3048
+ await x({ text: "正在根据用户问题生成搜索查询" }, t);
3049
+ const a = await qo(e, r, t);
3050
+ await x({ text: "正在执行生成的图谱搜索查询" }, t);
3051
+ const o = await mo({
3052
+ kg: r,
3053
+ searchQuery: a.query,
3054
+ typeCategoryFilter: a.typeCategoryFilter,
3055
+ namedTypesFilter: a.typeFilters,
3056
+ searchResultLimit: a.resultLimit,
3057
+ requestOptions: {
3058
+ signal: Z(t),
3059
+ timeout: t?.timeout
3060
+ }
3061
+ });
3062
+ if (o.type !== "success")
3063
+ return {
3064
+ toolName: ie,
3065
+ status: "error",
3066
+ errorMessage: o.errorMessage,
3067
+ error: "error" in o ? o.error : null
3068
+ };
3069
+ for (const i of o.results)
3070
+ D(
3071
+ i,
3072
+ (c) => ke(c)
3073
+ );
3074
+ const n = 10, l = o.results.slice(0, n);
3075
+ return {
3076
+ toolName: ie,
3077
+ status: "success",
3078
+ summary: `为回答问题,生成并执行了以下 Lucene 查询:
3079
+ 查询:${a.query}
3080
+ 类别过滤:${a.typeCategoryFilter}
3081
+ 命名类型过滤:${a.typeFilters ? a.typeFilters.join(", ") : "无"}
3082
+ 结果数量上限:${a.resultLimit ?? "不限数量"}
3083
+
3084
+ 搜索结果:${o.results.length} 条结果。
3085
+
3086
+ ${o.results.length > n ? `显示前 ${n} 条结果:
3087
+
3088
+ ` : ""}${l.map((i) => JSON.stringify(i)).join(`
3089
+ `)}`,
3090
+ details: {
3091
+ generatedSearchQuery: a,
3092
+ searchResults: o.results
3093
+ }
3094
+ };
3095
+ }, yi = f(Do, {
3096
+ name: ie,
3097
+ description: `使用 Lucene 语法,对知识图谱实体和关系的已索引字符串属性进行文本搜索。适用于可通过属性文本搜索回答的问题,例如模糊匹配。如果需要查找相连记录、路径或聚合数据,使用 queryGraphData。
3098
+ 示例:查找 Bradley;查找 John Smith;查找姓 Smith 的所有人;查找提到“delayed parts shipment”的记录;查找 Researcher 撰写的报告;查找前5份 summary 提到 Sacramento 附近 flood zoning、organization 为 City of Sacramento Utilities、tags 含 stormwater 的报告;搜索所有 John Smith 并显示 globalid。`,
3099
+ schema: Io
3100
+ });
3101
+ export {
3102
+ Wn as A,
3103
+ Vn as B,
3104
+ Bn as C,
3105
+ Un as D,
3106
+ Kn as E,
3107
+ Hn as F,
3108
+ ue as G,
3109
+ ni as H,
3110
+ Jn as I,
3111
+ Yn as J,
3112
+ Zn as K,
3113
+ Xn as L,
3114
+ ei as M,
3115
+ In as N,
3116
+ ri as O,
3117
+ ai as P,
3118
+ Ua as Q,
3119
+ k as R,
3120
+ ti as S,
3121
+ oi as T,
3122
+ ui as a,
3123
+ hi as b,
3124
+ di as c,
3125
+ pi as d,
3126
+ ci as e,
3127
+ xe as f,
3128
+ B as g,
3129
+ li as h,
3130
+ M as i,
3131
+ si as j,
3132
+ Dn as k,
3133
+ ii as l,
3134
+ zn as m,
3135
+ Pn as n,
3136
+ An as o,
3137
+ Ln as p,
3138
+ mi as q,
3139
+ Qn as r,
3140
+ yi as s,
3141
+ Kt as t,
3142
+ jn as u,
3143
+ Gn as v,
3144
+ On as w,
3145
+ Mn as x,
3146
+ C as y,
3147
+ _n as z
3148
+ };