@arcgis/ai-components 5.2.0-next.12 → 5.2.0-next.121

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 (615) hide show
  1. package/LICENSE.md +4 -2
  2. package/README.md +2 -2
  3. package/dist/agent-utils/LLMAgent.d.ts +9 -7
  4. package/dist/agent-utils/LLMAgent.js +92 -62
  5. package/dist/agent-utils/WorkflowAgent.js +14 -15
  6. package/dist/agent-utils/index.d.ts +78 -0
  7. package/dist/agent-utils/index.js +116 -97
  8. package/dist/agent-utils/middlewares/trace.d.ts +2 -0
  9. package/dist/agent-utils/middlewares/trace.js +5 -5
  10. package/dist/agent-utils/types.d.ts +28 -15
  11. package/dist/agentic-workflow/AgenticWorkflowRuntime.d.ts +24 -0
  12. package/dist/agentic-workflow/Edge.d.ts +16 -0
  13. package/dist/agentic-workflow/WebAgent.d.ts +39 -0
  14. package/dist/agentic-workflow/jsonTypes.d.ts +223 -0
  15. package/dist/agentic-workflow/nodes/AgentNode.d.ts +28 -0
  16. package/dist/agentic-workflow/nodes/BaseNode.d.ts +35 -0
  17. package/dist/agentic-workflow/nodes/EndMessageNode.d.ts +25 -0
  18. package/dist/agentic-workflow/nodes/HumanInTheLoopNode.d.ts +37 -0
  19. package/dist/agentic-workflow/nodes/StartNode.d.ts +21 -0
  20. package/dist/agentic-workflow/nodes/tools/ArcgisTool.d.ts +21 -0
  21. package/dist/agentic-workflow/types.d.ts +29 -0
  22. package/dist/agents/runtime/skill/createSkillAgent.d.ts +28 -0
  23. package/dist/agents/runtime/skill/createSkillAgent.js +270 -0
  24. package/dist/agents/runtime/skill/loadAgentSkills.d.ts +16 -0
  25. package/dist/agents/runtime/skill/types.d.ts +20 -0
  26. package/dist/{cdn/WNS5ZUF5.js → agents/runtime/skill/types.js} +1 -1
  27. package/dist/agents/tools/filter/clearFilters/adapter.d.ts +8 -0
  28. package/dist/agents/tools/filter/clearFilters/adapter.js +22 -0
  29. package/dist/agents/tools/filter/resetMap/adapter.d.ts +8 -0
  30. package/dist/agents/tools/filter/resetMap/adapter.js +22 -0
  31. package/dist/agents/tools/filter/setFeatureEffect/adapter.d.ts +8 -0
  32. package/dist/agents/tools/filter/setFeatureEffect/adapter.js +122 -0
  33. package/dist/agents/tools/help/listFields/adapter.d.ts +11 -0
  34. package/dist/agents/tools/help/listFields/adapter.js +30 -0
  35. package/dist/agents/tools/navigation/goToAddress/adapter.d.ts +10 -0
  36. package/dist/agents/tools/navigation/goToAddress/adapter.js +60 -0
  37. package/dist/agents/tools/navigation/goToBookmark/adapter.d.ts +8 -0
  38. package/dist/agents/tools/navigation/goToBookmark/adapter.js +30 -0
  39. package/dist/agents/tools/navigation/goToFeatures/adapter.d.ts +8 -0
  40. package/dist/agents/tools/navigation/goToFeatures/adapter.js +50 -0
  41. package/dist/agents/tools/navigation/goToFullExtent/adapter.d.ts +8 -0
  42. package/dist/agents/tools/navigation/goToFullExtent/adapter.js +27 -0
  43. package/dist/agents/tools/navigation/goToHomeExtent/adapter.d.ts +8 -0
  44. package/dist/agents/tools/navigation/goToHomeExtent/adapter.js +24 -0
  45. package/dist/agents/tools/navigation/goToLayer/adapter.d.ts +8 -0
  46. package/dist/agents/tools/navigation/goToLayer/adapter.js +26 -0
  47. package/dist/agents/tools/navigation/goToScale/adapter.d.ts +8 -0
  48. package/dist/agents/tools/navigation/goToScale/adapter.js +21 -0
  49. package/dist/agents/tools/navigation/goToViewpoint/adapter.d.ts +8 -0
  50. package/dist/agents/tools/navigation/goToViewpoint/adapter.js +42 -0
  51. package/dist/agents/tools/navigation/goToZoom/adapter.d.ts +8 -0
  52. package/dist/agents/tools/navigation/goToZoom/adapter.js +21 -0
  53. package/dist/agents/tools/query/getAttribute/adapter.d.ts +8 -0
  54. package/dist/agents/tools/query/getAttribute/adapter.js +40 -0
  55. package/dist/agents/tools/query/getStatistics/adapter.d.ts +8 -0
  56. package/dist/agents/tools/query/getStatistics/adapter.js +158 -0
  57. package/dist/agents/tools/query/getTopFeatures/adapter.d.ts +8 -0
  58. package/dist/agents/tools/query/getTopFeatures/adapter.js +145 -0
  59. package/dist/agents/tools/query/queryFeatures/adapter.d.ts +8 -0
  60. package/dist/agents/tools/query/queryFeatures/adapter.js +131 -0
  61. package/dist/agents/tools/search/findRelevantFields/adapter.d.ts +8 -0
  62. package/dist/agents/tools/search/findRelevantFields/adapter.js +57 -0
  63. package/dist/agents/tools/search/findRelevantLayers/adapter.d.ts +8 -0
  64. package/dist/agents/tools/search/findRelevantLayers/adapter.js +38 -0
  65. package/dist/agents/tools/shared/resolveToolArtifact.d.ts +22 -0
  66. package/dist/agents/tools/shared/resolveToolArtifact.js +20 -0
  67. package/dist/agents/tools/shared/types.d.ts +22 -0
  68. package/dist/agents/tools/shared/types.js +6 -0
  69. package/dist/cdn/2BNQ6A6J.js +2 -0
  70. package/dist/cdn/2DYOTV7W.js +4 -0
  71. package/dist/cdn/2WT4JANT.js +2 -0
  72. package/dist/cdn/34O57OGV.js +2 -0
  73. package/dist/cdn/3F5EZZSG.js +46 -0
  74. package/dist/cdn/4PKMJMND.js +2 -0
  75. package/dist/cdn/4V3Q7XGS.js +2 -0
  76. package/dist/cdn/5GALSAQF.js +3 -0
  77. package/dist/cdn/5Q2XRQS6.js +2 -0
  78. package/dist/cdn/6OUIUXAJ.js +2 -0
  79. package/dist/cdn/6XZYQ74A.js +6 -0
  80. package/dist/cdn/72KYGCIU.js +2 -0
  81. package/dist/cdn/73TMZQI5.js +2 -0
  82. package/dist/cdn/74CVYM72.js +19 -0
  83. package/dist/cdn/75OPJOCY.js +2 -0
  84. package/dist/cdn/7D6POJJA.js +2 -0
  85. package/dist/cdn/7HVK7G55.js +9 -0
  86. package/dist/cdn/7L6LPWRH.js +2 -0
  87. package/dist/cdn/7TAIUEMW.js +2 -0
  88. package/dist/cdn/{ZS2TZ6BF.js → AOVJ34QE.js} +1 -1
  89. package/dist/cdn/{Q7TL5Q5N.js → APFZY4PI.js} +1 -1
  90. package/dist/cdn/AVRS6UCQ.js +2 -0
  91. package/dist/cdn/AXTQU5YL.js +56 -0
  92. package/dist/cdn/BFZ5S7NF.js +2 -0
  93. package/dist/cdn/BN7CIVBD.js +2 -0
  94. package/dist/cdn/CA3RNGPN.js +2 -0
  95. package/dist/cdn/CCC6LBMY.js +2 -0
  96. package/dist/cdn/{5ZZGKP7N.js → CEKOEHB3.js} +1 -1
  97. package/dist/cdn/CFAC4FN3.js +2 -0
  98. package/dist/cdn/CLTV27HJ.js +2 -0
  99. package/dist/cdn/D3E5NSY3.js +2 -0
  100. package/dist/cdn/DB2TFPIO.js +2 -0
  101. package/dist/cdn/DKA6PSYN.js +2 -0
  102. package/dist/cdn/EJ7QJLUE.js +2 -0
  103. package/dist/cdn/ES54NWOB.js +11 -0
  104. package/dist/cdn/ESPC6NTI.js +68 -0
  105. package/dist/cdn/EWO73MJA.js +14 -0
  106. package/dist/cdn/FCI6M62J.js +2 -0
  107. package/dist/cdn/FDOMMK2M.js +2 -0
  108. package/dist/cdn/FGQLS3UX.js +2 -0
  109. package/dist/cdn/FOZAOJCM.js +2 -0
  110. package/dist/cdn/FYIZOGHC.js +2 -0
  111. package/dist/cdn/{T537PKP4.js → FYZATVB3.js} +1 -1
  112. package/dist/cdn/FZTNWDOU.js +2 -0
  113. package/dist/cdn/{WAIFKDR3.js → GZDI2LAT.js} +1 -1
  114. package/dist/cdn/H4ERKWFA.js +2 -0
  115. package/dist/cdn/{5CV7R5IS.js → H5AVPDSE.js} +5 -5
  116. package/dist/cdn/HDAMDEYL.js +72 -0
  117. package/dist/cdn/HFHRMM6Q.js +2 -0
  118. package/dist/cdn/HIAQARIQ.js +2 -0
  119. package/dist/cdn/HR6GWPKX.js +2 -0
  120. package/dist/cdn/HSILCMAR.js +2 -0
  121. package/dist/cdn/{FX7UOGHP.js → ICBIUFK7.js} +1 -1
  122. package/dist/cdn/IHP25JWI.js +99 -0
  123. package/dist/cdn/IMRIVNHX.js +2 -0
  124. package/dist/cdn/ITCZC2VY.js +2 -0
  125. package/dist/cdn/IYLFJCJ2.js +181 -0
  126. package/dist/cdn/J6A4AS7E.js +22 -0
  127. package/dist/cdn/{UPEEHMSY.js → JE55XX2C.js} +1 -1
  128. package/dist/cdn/{NE7E52YR.js → JEBRN3EU.js} +9 -3
  129. package/dist/cdn/JNOH4PD5.js +2 -0
  130. package/dist/cdn/JTEY4E7E.js +2 -0
  131. package/dist/cdn/K36XPG2M.js +2 -0
  132. package/dist/cdn/K5JVB6FU.js +2 -0
  133. package/dist/cdn/K7XWGSLN.js +2 -0
  134. package/dist/cdn/K7YQIJFT.js +2 -0
  135. package/dist/cdn/KA3S22NQ.js +2 -0
  136. package/dist/cdn/KDE5MMMR.js +2 -0
  137. package/dist/cdn/KH4V4I3W.js +2 -0
  138. package/dist/cdn/KMLJS2VW.js +2 -0
  139. package/dist/cdn/KONQTXBJ.js +2 -0
  140. package/dist/cdn/LDIUJUI7.js +2 -0
  141. package/dist/cdn/{7RCQFLPP.js → LK7ZIQW6.js} +1 -1
  142. package/dist/cdn/LOQ2PKV5.js +208 -0
  143. package/dist/cdn/LXPGQNXQ.js +5 -0
  144. package/dist/cdn/{5W7S2RS4.js → MCZJD3A4.js} +1 -1
  145. package/dist/cdn/MJSIYEWN.js +2 -0
  146. package/dist/cdn/MNZAQM3Q.js +3 -0
  147. package/dist/cdn/{ZEYIBYSF.js → MWYBF3F3.js} +1 -1
  148. package/dist/cdn/NEV6OZN3.js +71 -0
  149. package/dist/cdn/NHZRDYLP.js +2 -0
  150. package/dist/cdn/NYFV4A6L.js +3 -0
  151. package/dist/cdn/OGYNTGNM.js +2 -0
  152. package/dist/cdn/{23EQTPO3.js → OKVLGJAG.js} +1 -1
  153. package/dist/cdn/ONQ6JSBJ.js +2 -0
  154. package/dist/cdn/{6ZW7Z36F.js → OT5ECP4V.js} +5 -3
  155. package/dist/cdn/OZAZ277H.js +2 -0
  156. package/dist/cdn/P4XZMBU5.js +2 -0
  157. package/dist/cdn/PGIXKPTW.js +2 -0
  158. package/dist/cdn/{LQ6R5YRN.js → PQ2DPOFM.js} +1 -1
  159. package/dist/cdn/PTEKX5TX.js +2 -0
  160. package/dist/cdn/PUHPFUCU.js +2 -0
  161. package/dist/cdn/QDOKDRBB.js +2 -0
  162. package/dist/cdn/{DXVU45KM.js → QRMRID2M.js} +1 -1
  163. package/dist/cdn/QUZTFUWM.js +1 -0
  164. package/dist/cdn/QZL4SAYR.js +6 -0
  165. package/dist/cdn/RGOCE3QN.js +2 -0
  166. package/dist/cdn/RHYNE5OE.js +2 -0
  167. package/dist/cdn/{X2ZDYHCG.js → SDWWUWAF.js} +10 -5
  168. package/dist/cdn/SLD4ZVT6.js +2 -0
  169. package/dist/cdn/STHBRTTD.js +2 -0
  170. package/dist/cdn/TGZBLBEJ.js +2 -0
  171. package/dist/cdn/TPULIO6I.js +34 -0
  172. package/dist/cdn/TVEEQSMF.js +2 -0
  173. package/dist/cdn/UBKYXKMW.js +2 -0
  174. package/dist/cdn/UCTC4JN4.js +3 -0
  175. package/dist/cdn/{6YMR4QSD.js → UHEYPSOR.js} +1 -1
  176. package/dist/cdn/UO5PBOQR.js +2 -0
  177. package/dist/cdn/UT6JA4TK.js +14 -0
  178. package/dist/cdn/UXECAKJ7.js +2 -0
  179. package/dist/cdn/UZLQALHY.js +2 -0
  180. package/dist/cdn/{P7DG5T3Z.js → V7Y22FRP.js} +1 -1
  181. package/dist/cdn/VAXH6RUQ.js +134 -0
  182. package/dist/cdn/VF4BIBQT.js +2 -0
  183. package/dist/cdn/VR3CF3ZY.js +2 -0
  184. package/dist/cdn/VWP2B4LB.js +2 -0
  185. package/dist/cdn/VXFQANGJ.js +2 -0
  186. package/dist/cdn/WKZHFSH3.js +2 -0
  187. package/dist/cdn/WVP73XWD.js +2 -0
  188. package/dist/cdn/{24QNMEFG.js → WXOKGQ4D.js} +1 -1
  189. package/dist/cdn/WXQ26G5Q.js +2 -0
  190. package/dist/cdn/XQ3NBBQ3.js +2 -0
  191. package/dist/cdn/{AZGGTNA3.js → Y364LLPN.js} +1 -1
  192. package/dist/cdn/YBSY32EU.js +2 -0
  193. package/dist/cdn/{7CYGX4F4.js → YHWYTHID.js} +1 -1
  194. package/dist/cdn/YIZ7PR2G.js +2 -0
  195. package/dist/cdn/Z5XQLSYH.js +2 -0
  196. package/dist/cdn/ZA2WIUWH.js +2 -0
  197. package/dist/cdn/ZCFYGCCV.js +2 -0
  198. package/dist/cdn/ZLLVPKDN.js +177 -0
  199. package/dist/cdn/{ZTBA5PM7.js → ZU2FHVNK.js} +1 -1
  200. package/dist/cdn/agent-utils/index.js +1 -1
  201. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +1 -2
  202. package/dist/cdn/agent-utils/middlewares/middleware.js +1 -1
  203. package/dist/cdn/agent-utils/middlewares/trace.js +1 -1
  204. package/dist/cdn/assets/agents/t9n/messages.ar.json +1 -0
  205. package/dist/cdn/assets/agents/t9n/messages.bg.json +1 -0
  206. package/dist/cdn/assets/agents/t9n/messages.ca.json +1 -0
  207. package/dist/cdn/assets/agents/t9n/messages.cs.json +1 -0
  208. package/dist/cdn/assets/agents/t9n/messages.da.json +1 -0
  209. package/dist/cdn/assets/agents/t9n/messages.de.json +1 -0
  210. package/dist/cdn/assets/agents/t9n/messages.el.json +1 -0
  211. package/dist/cdn/assets/agents/t9n/messages.en.json +1 -0
  212. package/dist/cdn/assets/agents/t9n/messages.es.json +1 -0
  213. package/dist/cdn/assets/agents/t9n/messages.et.json +1 -0
  214. package/dist/cdn/assets/agents/t9n/messages.fi.json +1 -0
  215. package/dist/cdn/assets/agents/t9n/messages.fr.json +1 -0
  216. package/dist/cdn/assets/agents/t9n/messages.he.json +1 -0
  217. package/dist/cdn/assets/agents/t9n/messages.hr.json +1 -0
  218. package/dist/cdn/assets/agents/t9n/messages.hu.json +1 -0
  219. package/dist/cdn/assets/agents/t9n/messages.id.json +1 -0
  220. package/dist/cdn/assets/agents/t9n/messages.it.json +1 -0
  221. package/dist/cdn/assets/agents/t9n/messages.ja.json +1 -0
  222. package/dist/cdn/assets/agents/t9n/messages.ko.json +1 -0
  223. package/dist/cdn/assets/agents/t9n/messages.lt.json +1 -0
  224. package/dist/cdn/assets/agents/t9n/messages.lv.json +1 -0
  225. package/dist/cdn/assets/agents/t9n/messages.nl.json +1 -0
  226. package/dist/cdn/assets/agents/t9n/messages.no.json +1 -0
  227. package/dist/cdn/assets/agents/t9n/messages.pl.json +1 -0
  228. package/dist/cdn/assets/agents/t9n/messages.pt-BR.json +1 -0
  229. package/dist/cdn/assets/agents/t9n/messages.pt-PT.json +1 -0
  230. package/dist/cdn/assets/agents/t9n/messages.ro.json +1 -0
  231. package/dist/cdn/assets/agents/t9n/messages.ru.json +1 -0
  232. package/dist/cdn/assets/agents/t9n/messages.sk.json +1 -0
  233. package/dist/cdn/assets/agents/t9n/messages.sl.json +1 -0
  234. package/dist/cdn/assets/agents/t9n/messages.sr.json +1 -0
  235. package/dist/cdn/assets/agents/t9n/messages.sv.json +1 -0
  236. package/dist/cdn/assets/agents/t9n/messages.th.json +1 -0
  237. package/dist/cdn/assets/agents/t9n/messages.tr.json +1 -0
  238. package/dist/cdn/assets/agents/t9n/messages.uk.json +1 -0
  239. package/dist/cdn/assets/agents/t9n/messages.vi.json +1 -0
  240. package/dist/cdn/assets/agents/t9n/messages.zh-CN.json +1 -0
  241. package/dist/cdn/assets/agents/t9n/messages.zh-TW.json +1 -0
  242. package/dist/cdn/assets/assistant/t9n/messages.ar.json +1 -1
  243. package/dist/cdn/assets/assistant/t9n/messages.bg.json +1 -1
  244. package/dist/cdn/assets/assistant/t9n/messages.bs.json +1 -1
  245. package/dist/cdn/assets/assistant/t9n/messages.ca.json +1 -1
  246. package/dist/cdn/assets/assistant/t9n/messages.cs.json +1 -1
  247. package/dist/cdn/assets/assistant/t9n/messages.da.json +1 -1
  248. package/dist/cdn/assets/assistant/t9n/messages.de.json +1 -1
  249. package/dist/cdn/assets/assistant/t9n/messages.el.json +1 -1
  250. package/dist/cdn/assets/assistant/t9n/messages.en.json +1 -1
  251. package/dist/cdn/assets/assistant/t9n/messages.es.json +1 -1
  252. package/dist/cdn/assets/assistant/t9n/messages.et.json +1 -1
  253. package/dist/cdn/assets/assistant/t9n/messages.fi.json +1 -1
  254. package/dist/cdn/assets/assistant/t9n/messages.fr.json +1 -1
  255. package/dist/cdn/assets/assistant/t9n/messages.he.json +1 -1
  256. package/dist/cdn/assets/assistant/t9n/messages.hr.json +1 -1
  257. package/dist/cdn/assets/assistant/t9n/messages.hu.json +1 -1
  258. package/dist/cdn/assets/assistant/t9n/messages.id.json +1 -1
  259. package/dist/cdn/assets/assistant/t9n/messages.it.json +1 -1
  260. package/dist/cdn/assets/assistant/t9n/messages.ja.json +1 -1
  261. package/dist/cdn/assets/assistant/t9n/messages.ko.json +1 -1
  262. package/dist/cdn/assets/assistant/t9n/messages.lt.json +1 -1
  263. package/dist/cdn/assets/assistant/t9n/messages.lv.json +1 -1
  264. package/dist/cdn/assets/assistant/t9n/messages.nl.json +1 -1
  265. package/dist/cdn/assets/assistant/t9n/messages.no.json +1 -1
  266. package/dist/cdn/assets/assistant/t9n/messages.pl.json +1 -1
  267. package/dist/cdn/assets/assistant/t9n/messages.pt-BR.json +1 -1
  268. package/dist/cdn/assets/assistant/t9n/messages.pt-PT.json +1 -1
  269. package/dist/cdn/assets/assistant/t9n/messages.ro.json +1 -1
  270. package/dist/cdn/assets/assistant/t9n/messages.ru.json +1 -1
  271. package/dist/cdn/assets/assistant/t9n/messages.sk.json +1 -1
  272. package/dist/cdn/assets/assistant/t9n/messages.sl.json +1 -1
  273. package/dist/cdn/assets/assistant/t9n/messages.sr.json +1 -1
  274. package/dist/cdn/assets/assistant/t9n/messages.sv.json +1 -1
  275. package/dist/cdn/assets/assistant/t9n/messages.th.json +1 -1
  276. package/dist/cdn/assets/assistant/t9n/messages.tr.json +1 -1
  277. package/dist/cdn/assets/assistant/t9n/messages.uk.json +1 -1
  278. package/dist/cdn/assets/assistant/t9n/messages.vi.json +1 -1
  279. package/dist/cdn/assets/assistant/t9n/messages.zh-CN.json +1 -1
  280. package/dist/cdn/assets/assistant/t9n/messages.zh-HK.json +1 -1
  281. package/dist/cdn/assets/assistant/t9n/messages.zh-TW.json +1 -1
  282. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ar.json +1 -1
  283. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.bg.json +1 -1
  284. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.bs.json +1 -1
  285. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ca.json +1 -1
  286. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.cs.json +1 -1
  287. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.da.json +1 -1
  288. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.de.json +1 -1
  289. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.el.json +1 -1
  290. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.en.json +1 -1
  291. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.es.json +1 -1
  292. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.et.json +1 -1
  293. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.fi.json +1 -1
  294. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.fr.json +1 -1
  295. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.he.json +1 -1
  296. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.hr.json +1 -1
  297. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.hu.json +1 -1
  298. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.id.json +1 -1
  299. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.it.json +1 -1
  300. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ja.json +1 -1
  301. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ko.json +1 -1
  302. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.lt.json +1 -1
  303. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.lv.json +1 -1
  304. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.nl.json +1 -1
  305. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.no.json +1 -1
  306. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.pl.json +1 -1
  307. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.pt-BR.json +1 -1
  308. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.pt-PT.json +1 -1
  309. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ro.json +1 -1
  310. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ru.json +1 -1
  311. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.sk.json +1 -1
  312. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.sl.json +1 -1
  313. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.sr.json +1 -1
  314. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.sv.json +1 -1
  315. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.th.json +1 -1
  316. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.tr.json +1 -1
  317. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.uk.json +1 -1
  318. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.vi.json +1 -1
  319. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.zh-CN.json +1 -1
  320. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.zh-HK.json +1 -1
  321. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.zh-TW.json +1 -1
  322. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ar.json +1 -1
  323. package/dist/cdn/assets/assistant-interrupt/t9n/messages.bg.json +1 -1
  324. package/dist/cdn/assets/assistant-interrupt/t9n/messages.bs.json +1 -1
  325. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ca.json +1 -1
  326. package/dist/cdn/assets/assistant-interrupt/t9n/messages.cs.json +1 -1
  327. package/dist/cdn/assets/assistant-interrupt/t9n/messages.da.json +1 -1
  328. package/dist/cdn/assets/assistant-interrupt/t9n/messages.de.json +1 -1
  329. package/dist/cdn/assets/assistant-interrupt/t9n/messages.el.json +1 -1
  330. package/dist/cdn/assets/assistant-interrupt/t9n/messages.en.json +1 -1
  331. package/dist/cdn/assets/assistant-interrupt/t9n/messages.es.json +1 -1
  332. package/dist/cdn/assets/assistant-interrupt/t9n/messages.et.json +1 -1
  333. package/dist/cdn/assets/assistant-interrupt/t9n/messages.fi.json +1 -1
  334. package/dist/cdn/assets/assistant-interrupt/t9n/messages.fr.json +1 -1
  335. package/dist/cdn/assets/assistant-interrupt/t9n/messages.he.json +1 -1
  336. package/dist/cdn/assets/assistant-interrupt/t9n/messages.hr.json +1 -1
  337. package/dist/cdn/assets/assistant-interrupt/t9n/messages.hu.json +1 -1
  338. package/dist/cdn/assets/assistant-interrupt/t9n/messages.id.json +1 -1
  339. package/dist/cdn/assets/assistant-interrupt/t9n/messages.it.json +1 -1
  340. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ja.json +1 -1
  341. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ko.json +1 -1
  342. package/dist/cdn/assets/assistant-interrupt/t9n/messages.lt.json +1 -1
  343. package/dist/cdn/assets/assistant-interrupt/t9n/messages.lv.json +1 -1
  344. package/dist/cdn/assets/assistant-interrupt/t9n/messages.nl.json +1 -1
  345. package/dist/cdn/assets/assistant-interrupt/t9n/messages.no.json +1 -1
  346. package/dist/cdn/assets/assistant-interrupt/t9n/messages.pl.json +1 -1
  347. package/dist/cdn/assets/assistant-interrupt/t9n/messages.pt-BR.json +1 -1
  348. package/dist/cdn/assets/assistant-interrupt/t9n/messages.pt-PT.json +1 -1
  349. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ro.json +1 -1
  350. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ru.json +1 -1
  351. package/dist/cdn/assets/assistant-interrupt/t9n/messages.sk.json +1 -1
  352. package/dist/cdn/assets/assistant-interrupt/t9n/messages.sl.json +1 -1
  353. package/dist/cdn/assets/assistant-interrupt/t9n/messages.sr.json +1 -1
  354. package/dist/cdn/assets/assistant-interrupt/t9n/messages.sv.json +1 -1
  355. package/dist/cdn/assets/assistant-interrupt/t9n/messages.th.json +1 -1
  356. package/dist/cdn/assets/assistant-interrupt/t9n/messages.tr.json +1 -1
  357. package/dist/cdn/assets/assistant-interrupt/t9n/messages.uk.json +1 -1
  358. package/dist/cdn/assets/assistant-interrupt/t9n/messages.vi.json +1 -1
  359. package/dist/cdn/assets/assistant-interrupt/t9n/messages.zh-CN.json +1 -1
  360. package/dist/cdn/assets/assistant-interrupt/t9n/messages.zh-HK.json +1 -1
  361. package/dist/cdn/assets/assistant-interrupt/t9n/messages.zh-TW.json +1 -1
  362. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.ar.json +1 -0
  363. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.bg.json +1 -0
  364. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.bs.json +1 -0
  365. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.ca.json +1 -0
  366. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.cs.json +1 -0
  367. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.da.json +1 -0
  368. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.de.json +1 -0
  369. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.el.json +1 -0
  370. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.en.json +1 -0
  371. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.es.json +1 -0
  372. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.et.json +1 -0
  373. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.fi.json +1 -0
  374. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.fr.json +1 -0
  375. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.he.json +1 -0
  376. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.hr.json +1 -0
  377. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.hu.json +1 -0
  378. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.id.json +1 -0
  379. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.it.json +1 -0
  380. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.ja.json +1 -0
  381. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.ko.json +1 -0
  382. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.lt.json +1 -0
  383. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.lv.json +1 -0
  384. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.nl.json +1 -0
  385. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.no.json +1 -0
  386. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.pl.json +1 -0
  387. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.pt-BR.json +1 -0
  388. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.pt-PT.json +1 -0
  389. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.ro.json +1 -0
  390. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.ru.json +1 -0
  391. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.sk.json +1 -0
  392. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.sl.json +1 -0
  393. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.sr.json +1 -0
  394. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.sv.json +1 -0
  395. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.th.json +1 -0
  396. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.tr.json +1 -0
  397. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.uk.json +1 -0
  398. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.vi.json +1 -0
  399. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.zh-CN.json +1 -0
  400. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.zh-HK.json +1 -0
  401. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.zh-TW.json +1 -0
  402. package/dist/cdn/assets/assistant-message/t9n/messages.ar.json +1 -0
  403. package/dist/cdn/assets/assistant-message/t9n/messages.bg.json +1 -0
  404. package/dist/cdn/assets/assistant-message/t9n/messages.bs.json +1 -0
  405. package/dist/cdn/assets/assistant-message/t9n/messages.ca.json +1 -0
  406. package/dist/cdn/assets/assistant-message/t9n/messages.cs.json +1 -0
  407. package/dist/cdn/assets/assistant-message/t9n/messages.da.json +1 -0
  408. package/dist/cdn/assets/assistant-message/t9n/messages.de.json +1 -0
  409. package/dist/cdn/assets/assistant-message/t9n/messages.el.json +1 -0
  410. package/dist/cdn/assets/assistant-message/t9n/messages.en.json +1 -0
  411. package/dist/cdn/assets/assistant-message/t9n/messages.es.json +1 -0
  412. package/dist/cdn/assets/assistant-message/t9n/messages.et.json +1 -0
  413. package/dist/cdn/assets/assistant-message/t9n/messages.fi.json +1 -0
  414. package/dist/cdn/assets/assistant-message/t9n/messages.fr.json +1 -0
  415. package/dist/cdn/assets/assistant-message/t9n/messages.he.json +1 -0
  416. package/dist/cdn/assets/assistant-message/t9n/messages.hr.json +1 -0
  417. package/dist/cdn/assets/assistant-message/t9n/messages.hu.json +1 -0
  418. package/dist/cdn/assets/assistant-message/t9n/messages.id.json +1 -0
  419. package/dist/cdn/assets/assistant-message/t9n/messages.it.json +1 -0
  420. package/dist/cdn/assets/assistant-message/t9n/messages.ja.json +1 -0
  421. package/dist/cdn/assets/assistant-message/t9n/messages.ko.json +1 -0
  422. package/dist/cdn/assets/assistant-message/t9n/messages.lt.json +1 -0
  423. package/dist/cdn/assets/assistant-message/t9n/messages.lv.json +1 -0
  424. package/dist/cdn/assets/assistant-message/t9n/messages.nl.json +1 -0
  425. package/dist/cdn/assets/assistant-message/t9n/messages.no.json +1 -0
  426. package/dist/cdn/assets/assistant-message/t9n/messages.pl.json +1 -0
  427. package/dist/cdn/assets/assistant-message/t9n/messages.pt-BR.json +1 -0
  428. package/dist/cdn/assets/assistant-message/t9n/messages.pt-PT.json +1 -0
  429. package/dist/cdn/assets/assistant-message/t9n/messages.ro.json +1 -0
  430. package/dist/cdn/assets/assistant-message/t9n/messages.ru.json +1 -0
  431. package/dist/cdn/assets/assistant-message/t9n/messages.sk.json +1 -0
  432. package/dist/cdn/assets/assistant-message/t9n/messages.sl.json +1 -0
  433. package/dist/cdn/assets/assistant-message/t9n/messages.sr.json +1 -0
  434. package/dist/cdn/assets/assistant-message/t9n/messages.sv.json +1 -0
  435. package/dist/cdn/assets/assistant-message/t9n/messages.th.json +1 -0
  436. package/dist/cdn/assets/assistant-message/t9n/messages.tr.json +1 -0
  437. package/dist/cdn/assets/assistant-message/t9n/messages.uk.json +1 -0
  438. package/dist/cdn/assets/assistant-message/t9n/messages.vi.json +1 -0
  439. package/dist/cdn/assets/assistant-message/t9n/messages.zh-CN.json +1 -0
  440. package/dist/cdn/assets/assistant-message/t9n/messages.zh-HK.json +1 -0
  441. package/dist/cdn/assets/assistant-message/t9n/messages.zh-TW.json +1 -0
  442. package/dist/cdn/assets/assistant-message-loading/t9n/messages.ar.json +1 -0
  443. package/dist/cdn/assets/assistant-message-loading/t9n/messages.bg.json +1 -0
  444. package/dist/cdn/assets/assistant-message-loading/t9n/messages.bs.json +1 -0
  445. package/dist/cdn/assets/assistant-message-loading/t9n/messages.ca.json +1 -0
  446. package/dist/cdn/assets/assistant-message-loading/t9n/messages.cs.json +1 -0
  447. package/dist/cdn/assets/assistant-message-loading/t9n/messages.da.json +1 -0
  448. package/dist/cdn/assets/assistant-message-loading/t9n/messages.de.json +1 -0
  449. package/dist/cdn/assets/assistant-message-loading/t9n/messages.el.json +1 -0
  450. package/dist/cdn/assets/assistant-message-loading/t9n/messages.en.json +1 -0
  451. package/dist/cdn/assets/assistant-message-loading/t9n/messages.es.json +1 -0
  452. package/dist/cdn/assets/assistant-message-loading/t9n/messages.et.json +1 -0
  453. package/dist/cdn/assets/assistant-message-loading/t9n/messages.fi.json +1 -0
  454. package/dist/cdn/assets/assistant-message-loading/t9n/messages.fr.json +1 -0
  455. package/dist/cdn/assets/assistant-message-loading/t9n/messages.he.json +1 -0
  456. package/dist/cdn/assets/assistant-message-loading/t9n/messages.hr.json +1 -0
  457. package/dist/cdn/assets/assistant-message-loading/t9n/messages.hu.json +1 -0
  458. package/dist/cdn/assets/assistant-message-loading/t9n/messages.id.json +1 -0
  459. package/dist/cdn/assets/assistant-message-loading/t9n/messages.it.json +1 -0
  460. package/dist/cdn/assets/assistant-message-loading/t9n/messages.ja.json +1 -0
  461. package/dist/cdn/assets/assistant-message-loading/t9n/messages.ko.json +1 -0
  462. package/dist/cdn/assets/assistant-message-loading/t9n/messages.lt.json +1 -0
  463. package/dist/cdn/assets/assistant-message-loading/t9n/messages.lv.json +1 -0
  464. package/dist/cdn/assets/assistant-message-loading/t9n/messages.nl.json +1 -0
  465. package/dist/cdn/assets/assistant-message-loading/t9n/messages.no.json +1 -0
  466. package/dist/cdn/assets/assistant-message-loading/t9n/messages.pl.json +1 -0
  467. package/dist/cdn/assets/assistant-message-loading/t9n/messages.pt-BR.json +1 -0
  468. package/dist/cdn/assets/assistant-message-loading/t9n/messages.pt-PT.json +1 -0
  469. package/dist/cdn/assets/assistant-message-loading/t9n/messages.ro.json +1 -0
  470. package/dist/cdn/assets/assistant-message-loading/t9n/messages.ru.json +1 -0
  471. package/dist/cdn/assets/assistant-message-loading/t9n/messages.sk.json +1 -0
  472. package/dist/cdn/assets/assistant-message-loading/t9n/messages.sl.json +1 -0
  473. package/dist/cdn/assets/assistant-message-loading/t9n/messages.sr.json +1 -0
  474. package/dist/cdn/assets/assistant-message-loading/t9n/messages.sv.json +1 -0
  475. package/dist/cdn/assets/assistant-message-loading/t9n/messages.th.json +1 -0
  476. package/dist/cdn/assets/assistant-message-loading/t9n/messages.tr.json +1 -0
  477. package/dist/cdn/assets/assistant-message-loading/t9n/messages.uk.json +1 -0
  478. package/dist/cdn/assets/assistant-message-loading/t9n/messages.vi.json +1 -0
  479. package/dist/cdn/assets/assistant-message-loading/t9n/messages.zh-CN.json +1 -0
  480. package/dist/cdn/assets/assistant-message-loading/t9n/messages.zh-HK.json +1 -0
  481. package/dist/cdn/assets/assistant-message-loading/t9n/messages.zh-TW.json +1 -0
  482. package/dist/cdn/assets/orchestrator/t9n/messages.en.json +1 -0
  483. package/dist/cdn/index.js +1 -1
  484. package/dist/chunks/SKILL.js +5 -0
  485. package/dist/chunks/SKILL2.js +5 -0
  486. package/dist/chunks/SKILL3.js +22 -0
  487. package/dist/chunks/SKILL4.js +5 -0
  488. package/dist/chunks/adapter.js +1128 -2010
  489. package/dist/chunks/aiFactory.js +118 -0
  490. package/dist/chunks/arcgisKnowledgeGraph.js +98 -76
  491. package/dist/chunks/arcgisToolRegistry.js +88 -0
  492. package/dist/chunks/arcgis_knowledge_current_lc_context.js +19 -2
  493. package/dist/chunks/arcgis_knowledge_current_map_context.js +31 -2
  494. package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +102 -0
  495. package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +116 -27
  496. package/dist/chunks/baseAgentState.js +59 -0
  497. package/dist/chunks/converterUtils.js +66 -41
  498. package/dist/chunks/dataExplorationAgent.js +17 -0
  499. package/dist/chunks/data_explore_query_prompt.js +9 -4
  500. package/dist/chunks/fetchAgentContext.js +13 -0
  501. package/dist/chunks/fetchService.js +10 -0
  502. package/dist/chunks/fieldStatistics.js +79 -0
  503. package/dist/chunks/formatFeatureAttributes.js +132 -0
  504. package/dist/chunks/generateLayerDescriptions.js +195 -315
  505. package/dist/chunks/helpAgent.js +32 -0
  506. package/dist/chunks/help_prompt.js +34 -17
  507. package/dist/chunks/intent_prompt.js +4 -2
  508. package/dist/chunks/layerStylingGraph.js +103 -83
  509. package/dist/chunks/mergeWhereClauses.js +15 -0
  510. package/dist/chunks/navigationAgent.js +25 -0
  511. package/dist/chunks/navigation_intent_prompt.js +8 -2
  512. package/dist/chunks/orchestrator.js +438 -193
  513. package/dist/chunks/requireAgentServices.js +11 -0
  514. package/dist/chunks/resolveGeometryFilter.js +149 -0
  515. package/dist/chunks/state.js +33 -28
  516. package/dist/chunks/utils2.js +11 -11
  517. package/dist/components/arcgis-assistant/customElement.d.ts +131 -4
  518. package/dist/components/arcgis-assistant/customElement.js +399 -212
  519. package/dist/components/arcgis-assistant/types.d.ts +108 -0
  520. package/dist/components/arcgis-assistant-agent/customElement.d.ts +13 -1
  521. package/dist/components/arcgis-assistant-agent/customElement.js +675 -10
  522. package/dist/components/arcgis-assistant-chat/customElement.js +22 -17
  523. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +15 -4
  524. package/dist/components/arcgis-assistant-chat-entry/customElement.js +344 -45
  525. package/dist/components/arcgis-assistant-chat-entry/index.js +3 -0
  526. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +35 -8
  527. package/dist/components/arcgis-assistant-help-agent/customElement.js +32 -8
  528. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +8 -2
  529. package/dist/components/arcgis-assistant-interrupt/customElement.js +48 -15
  530. package/dist/components/arcgis-assistant-interrupt/index.js +1 -1
  531. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +12 -8
  532. package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +1 -1
  533. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +41 -16
  534. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +31 -7
  535. package/dist/components/arcgis-assistant-message/customElement.d.ts +3 -0
  536. package/dist/components/arcgis-assistant-message/customElement.js +9 -8
  537. package/dist/components/arcgis-assistant-message-block/customElement.js +1 -1
  538. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +3 -0
  539. package/dist/components/arcgis-assistant-message-loading/customElement.js +11 -10
  540. package/dist/components/arcgis-assistant-message-log/customElement.js +4 -4
  541. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +1 -0
  542. package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
  543. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +34 -9
  544. package/dist/components/arcgis-assistant-speech-input/customElement.js +34 -52
  545. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +2 -0
  546. package/dist/components/arcgis-assistant-user-message/customElement.js +15 -10
  547. package/dist/docs/api.json +1 -1
  548. package/dist/docs/docs.json +1 -1
  549. package/dist/docs/vscode.html-custom-data.json +1 -1
  550. package/dist/docs/web-types.json +1 -1
  551. package/dist/loader.js +9 -9
  552. package/dist/oauth-callback.html +1 -1
  553. package/dist/orchestrator/models/types.d.ts +1 -0
  554. package/dist/orchestrator/orchestrator/orchestratorEvents.d.ts +78 -0
  555. package/dist/orchestrator/providers/arcgis/aiFactory.d.ts +15 -0
  556. package/dist/orchestrator/types/types.d.ts +17 -0
  557. package/dist/types/lumina.d.ts +6 -5
  558. package/dist/types/preact.d.ts +6 -5
  559. package/dist/types/react.d.ts +6 -5
  560. package/dist/types/stencil.d.ts +8 -7
  561. package/dist/utils/index.d.ts +95 -39
  562. package/dist/utils/index.js +709 -83
  563. package/package.json +35 -12
  564. package/dist/cdn/34SG44C3.js +0 -72
  565. package/dist/cdn/3JGWGKT6.js +0 -2
  566. package/dist/cdn/3NBDVZ2I.js +0 -2
  567. package/dist/cdn/3VOQD2MR.js +0 -2
  568. package/dist/cdn/53NTYC4I.js +0 -2
  569. package/dist/cdn/5QAHYX7Y.js +0 -5
  570. package/dist/cdn/AXDZBBNL.js +0 -45
  571. package/dist/cdn/B7WJFBOZ.js +0 -2
  572. package/dist/cdn/BX7FSMUU.js +0 -56
  573. package/dist/cdn/CHPQM77M.js +0 -181
  574. package/dist/cdn/DHKUXLU3.js +0 -179
  575. package/dist/cdn/DQSEBKOX.js +0 -2
  576. package/dist/cdn/DZ2QWNUA.js +0 -3
  577. package/dist/cdn/EBISDZ5H.js +0 -2
  578. package/dist/cdn/ERL2CB2Y.js +0 -14
  579. package/dist/cdn/F2AHA4GB.js +0 -54
  580. package/dist/cdn/F6QHMKF5.js +0 -2
  581. package/dist/cdn/FUIGPHBH.js +0 -2
  582. package/dist/cdn/H2CHHGGH.js +0 -2
  583. package/dist/cdn/HWKDNS4K.js +0 -4
  584. package/dist/cdn/IMQ4TVHF.js +0 -16
  585. package/dist/cdn/IOD3GDA7.js +0 -2
  586. package/dist/cdn/IR7PTESF.js +0 -2
  587. package/dist/cdn/IRZDTYO2.js +0 -2
  588. package/dist/cdn/JIWK6QK6.js +0 -2
  589. package/dist/cdn/JLKGS6Y5.js +0 -36
  590. package/dist/cdn/K3JCH4XW.js +0 -2
  591. package/dist/cdn/KHXUWZHB.js +0 -2
  592. package/dist/cdn/KMQ3SP4I.js +0 -5
  593. package/dist/cdn/LIFK3QSD.js +0 -2
  594. package/dist/cdn/NXKKG5TK.js +0 -2
  595. package/dist/cdn/O3EN27N5.js +0 -2
  596. package/dist/cdn/O3RFFPU3.js +0 -6
  597. package/dist/cdn/PBO6FZN6.js +0 -2
  598. package/dist/cdn/Q3ZW4FYA.js +0 -3
  599. package/dist/cdn/Q6LRANX6.js +0 -2
  600. package/dist/cdn/QCSN44H4.js +0 -2
  601. package/dist/cdn/R56X6ZKR.js +0 -161
  602. package/dist/cdn/RUURNLTP.js +0 -2
  603. package/dist/cdn/T43LEBBE.js +0 -47
  604. package/dist/cdn/TR4GFL7X.js +0 -2
  605. package/dist/cdn/X4XY5HIE.js +0 -2
  606. package/dist/cdn/XOH56EQ2.js +0 -2
  607. package/dist/cdn/XON27U6U.js +0 -2
  608. package/dist/cdn/YIMNOUTF.js +0 -2
  609. package/dist/cdn/YLN2BZ5J.js +0 -2
  610. package/dist/cdn/YUKR4AZW.js +0 -2
  611. package/dist/cdn/Z2G7MP5L.js +0 -22
  612. package/dist/chunks/dataExplorationGraph.js +0 -310
  613. package/dist/chunks/helpGraph.js +0 -126
  614. package/dist/chunks/navigationGraph.js +0 -270
  615. package/dist/chunks/toolCallResponse.js +0 -31
@@ -1,428 +1,237 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import he from "@arcgis/core/identity/IdentityManager.js";
3
- import k from "@arcgis/core/portal/Portal.js";
4
- import { Annotation as b, messagesStateReducer as Te } from "@langchain/langgraph/web";
5
- import { k as qe, j as B, i as De } from "./generateLayerDescriptions.js";
2
+ import H from "@arcgis/core/identity/IdentityManager.js";
3
+ import P from "@arcgis/core/portal/Portal.js";
4
+ import J from "@arcgis/core/request.js";
5
+ import { Annotation as y, messagesStateReducer as ee } from "@langchain/langgraph/web";
6
+ import "@arcgis/toolkit/string";
7
+ import { j as le } from "./generateLayerDescriptions.js";
6
8
  import "@langchain/core/messages";
7
9
  import "@langchain/core/callbacks/dispatch/web";
10
+ import "@arcgis/toolkit/intl";
11
+ import "./runtime.js";
12
+ import "@langchain/core/callbacks/base";
8
13
  import "@langchain/openai";
9
- import X from "@arcgis/core/config.js";
10
- import * as Ae from "@arcgis/core/core/reactiveUtils.js";
14
+ import "@arcgis/core/config.js";
15
+ import * as ce from "@arcgis/core/core/reactiveUtils.js";
11
16
  import "@arcgis/core/layers/FeatureLayer.js";
12
- import me from "@arcgis/core/request.js";
13
17
  import "@langchain/core/prompts";
14
- import { tool as f } from "@langchain/core/tools";
15
- import Pe from "@arcgis/core/Graphic.js";
16
- import { addressToLocations as Le } from "@arcgis/core/rest/locator.js";
17
- import je from "@arcgis/core/symbols/PictureMarkerSymbol.js";
18
- import i, { z as E } from "zod";
19
- import Ge from "@arcgis/core/geometry/Extent.js";
20
- import ve from "@arcgis/core/geometry/Point.js";
21
- import { createRenderer as Oe } from "@arcgis/core/smartMapping/renderers/pieChart.js";
22
- import { getSchemesByTag as Me, getSchemes as Qe } from "@arcgis/core/smartMapping/symbology/pieChart.js";
23
- import { getBackgroundColorTheme as ye } from "@arcgis/core/views/support/colorUtils.js";
24
- import { a as x, s as S } from "./index.js";
25
- import { createAgeRenderer as _e, createContinuousRenderer as We } from "@arcgis/core/smartMapping/renderers/color.js";
26
- import { getSchemesByTag as le } from "@arcgis/core/smartMapping/symbology/color.js";
27
- import { createContinuousRenderer as Ve } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
28
- import { createRenderer as Ue } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
29
- import { getSchemesByTag as Ke } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
30
- import { createRenderer as Be } from "@arcgis/core/smartMapping/renderers/heatmap.js";
31
- import { getSchemesByTag as He } from "@arcgis/core/smartMapping/symbology/heatmap.js";
32
- import { createRenderer as Je } from "@arcgis/core/smartMapping/renderers/predominance.js";
33
- import { getSchemesByTag as Ze } from "@arcgis/core/smartMapping/symbology/predominance.js";
34
- import { createRenderer as Ye } from "@arcgis/core/smartMapping/renderers/relationship.js";
35
- import { getSchemesByTag as Xe } from "@arcgis/core/smartMapping/symbology/relationship.js";
36
- import { createAgeRenderer as et, createContinuousRenderer as tt } from "@arcgis/core/smartMapping/renderers/size.js";
37
- import { createRenderer as rt } from "@arcgis/core/smartMapping/renderers/type.js";
38
- import { getSchemesByTag as at } from "@arcgis/core/smartMapping/symbology/type.js";
39
- import { ToolNode as ot } from "@langchain/langgraph/prebuilt";
40
- import nt from "@arcgis/core/layers/support/FeatureEffect.js";
41
- import Se from "@arcgis/core/layers/support/FeatureFilter.js";
42
- import * as it from "@arcgis/core/geometry/operators/unionOperator.js";
43
- import { formatDateOnly as st, convertDateFormatToIntlOptions as Q, formatTimeOnly as lt, formatDate as fe } from "@arcgis/core/intl.js";
44
- import ct from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
45
- import ut from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
46
- import dt from "@arcgis/core/rest/support/TopFeaturesQuery.js";
47
- import pt from "@arcgis/core/rest/support/TopFilter.js";
48
- import ht from "@arcgis/core/WebLinkChart.js";
49
- import xe from "@arcgis/core/rest/knowledgeGraph/GraphQueryStreaming.js";
50
- import "@arcgis/core/views/LinkChartView.js";
51
- import { fetchKnowledgeGraph as ge, executeQueryStreaming as mt, executeSearchStreaming as yt } from "@arcgis/core/rest/knowledgeGraphService.js";
52
- import ft from "@arcgis/core/rest/knowledgeGraph/GraphSearchStreaming.js";
53
- const L = (e, t) => t ?? e, xn = b.Root({
54
- ...qe(),
18
+ import { d as pe, a as G } from "./baseAgentState.js";
19
+ import { ToolNode as de } from "@langchain/langgraph/prebuilt";
20
+ import { s as T, a as S } from "./index.js";
21
+ import { clearFiltersTool as ue } from "../agents/tools/filter/clearFilters/adapter.js";
22
+ import { resetMapTool as he } from "../agents/tools/filter/resetMap/adapter.js";
23
+ import { setFeatureEffectTool as me } from "../agents/tools/filter/setFeatureEffect/adapter.js";
24
+ import { getAttributeTool as ye } from "../agents/tools/query/getAttribute/adapter.js";
25
+ import { getStatisticsTool as ge } from "../agents/tools/query/getStatistics/adapter.js";
26
+ import { getTopFeaturesTool as fe } from "../agents/tools/query/getTopFeatures/adapter.js";
27
+ import { queryFeaturesTool as we } from "../agents/tools/query/queryFeatures/adapter.js";
28
+ import c from "zod";
29
+ import { tool as g } from "@langchain/core/tools";
30
+ import { createRenderer as be } from "@arcgis/core/smartMapping/renderers/pieChart.js";
31
+ import { getSchemesByTag as Te, getSchemes as Se } from "@arcgis/core/smartMapping/symbology/pieChart.js";
32
+ import { getBackgroundColorTheme as X } from "@arcgis/core/views/support/colorUtils.js";
33
+ import { createAgeRenderer as ve, createContinuousRenderer as Re } from "@arcgis/core/smartMapping/renderers/color.js";
34
+ import { getSchemesByTag as V } from "@arcgis/core/smartMapping/symbology/color.js";
35
+ import { createContinuousRenderer as xe } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
36
+ import { createRenderer as Ce } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
37
+ import { getSchemesByTag as $e } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
38
+ import { createRenderer as Pe } from "@arcgis/core/smartMapping/renderers/heatmap.js";
39
+ import { getSchemesByTag as Ee } from "@arcgis/core/smartMapping/symbology/heatmap.js";
40
+ import { createRenderer as ze } from "@arcgis/core/smartMapping/renderers/predominance.js";
41
+ import { getSchemesByTag as ke } from "@arcgis/core/smartMapping/symbology/predominance.js";
42
+ import { createRenderer as Ae } from "@arcgis/core/smartMapping/renderers/relationship.js";
43
+ import { getSchemesByTag as Ne } from "@arcgis/core/smartMapping/symbology/relationship.js";
44
+ import { createAgeRenderer as qe, createContinuousRenderer as Me } from "@arcgis/core/smartMapping/renderers/size.js";
45
+ import { createRenderer as De } from "@arcgis/core/smartMapping/renderers/type.js";
46
+ import { getSchemesByTag as Le } from "@arcgis/core/smartMapping/symbology/type.js";
47
+ import Ge from "@arcgis/core/WebLinkChart.js";
48
+ import re from "@arcgis/core/rest/knowledgeGraph/GraphQueryStreaming.js";
49
+ import { fetchKnowledgeGraph as Y, executeQueryStreaming as je, executeSearchStreaming as Fe } from "@arcgis/core/rest/knowledgeGraphService.js";
50
+ import _e from "@arcgis/core/rest/knowledgeGraph/GraphSearchStreaming.js";
51
+ import { getBindParametersFromCypherQuery as Qe } from "@arcgis/core/applications/KnowledgeStudio/generalSharedKgUtils.js";
52
+ const k = (e, t) => t ?? e, xa = y.Root({
53
+ ...pe(),
55
54
  // internal to the navigation agent
56
- intent: b({
57
- reducer: L
55
+ intent: y({
56
+ reducer: k
58
57
  }),
59
- vectorSearchLayerResults: b({
60
- reducer: L,
58
+ vectorSearchLayerResults: y({
59
+ reducer: k,
61
60
  default: () => []
62
61
  }),
63
- vectorSearchFieldResults: b({
64
- reducer: L
62
+ vectorSearchFieldResults: y({
63
+ reducer: k
65
64
  }),
66
- navigationInternalState: b({
67
- reducer: L,
65
+ navigationInternalState: y({
66
+ reducer: k,
68
67
  default: () => ({
69
68
  toolCallMessage: void 0
70
69
  })
71
70
  })
72
- });
73
- async function gt(e, t) {
74
- const a = k.getDefault().helperServices, o = a.geocode.find((h) => h.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
75
- if (!o)
76
- throw new Error("No geocoding service found in helperServices.");
77
- const n = o.url, l = `${X.assetsPath?.endsWith("/") ? X.assetsPath : `${X.assetsPath}/`}esri/images/search/search-symbol-32.png`, c = (await Le(n, {
78
- address: { SingleLine: e },
79
- outFields: ["Match_addr"]
80
- }))?.[0];
81
- if (!c?.extent || !c.location)
82
- throw new Error(`Could not find location for: ${e}`);
83
- const u = new je({
84
- url: l,
85
- width: 24,
86
- height: 24
87
- }), d = new Pe({
88
- geometry: c.location,
89
- symbol: u
90
- });
91
- t.graphics.removeAll(), t.graphics.add(d), await t.goTo(c.extent);
92
- const p = {
93
- address: c.address ?? "",
94
- location: c.location ? c.location.toJSON() : null,
95
- extent: c.extent ? c.extent.toJSON() : null
96
- };
97
- return {
98
- text: `Successfully zoomed to ${e}.`,
99
- sharedStatePatch: { lastResolvedLocation: { value: p } }
100
- };
101
- }
102
- const wt = ["mapView"];
103
- function $(e) {
104
- const r = e?.configurable?.context;
105
- if (!r || typeof r != "object")
106
- throw new Error("NavigationAgent context missing");
107
- const a = wt.filter((o) => !(o in r));
108
- if (a.length)
109
- throw new Error(`NavigationAgent context missing: ${a.join(", ")}`);
110
- return r;
111
- }
112
- async function bt({ address: e }, t) {
113
- const { mapView: r } = $(t);
114
- return await gt(e, r);
115
- }
116
- const Tt = i.object({
117
- address: i.string().describe("The full address or place name to locate.")
118
- }), Rn = f(bt, {
119
- name: "goToAddress",
120
- description: "Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",
121
- schema: Tt
122
- });
123
- async function vt(e, t) {
124
- const a = t.map.bookmarks;
125
- if (!a || a.length === 0)
126
- throw new Error("No bookmarks found in the map.");
127
- const o = a.find((l) => l.name === e);
128
- if (!o)
129
- throw new Error(`Bookmark with name "${e}" not found.`);
130
- const n = o.viewpoint;
131
- if (!n)
132
- throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);
133
- return await t.goTo(n), { text: `Navigated to bookmark: ${e}` };
134
- }
135
- async function St({ bookmarkName: e }, t) {
136
- const { mapView: r } = $(t);
137
- return await Promise.resolve(vt(e, r));
138
- }
139
- const xt = E.object({
140
- bookmarkName: E.string().describe("The name of the bookmark to navigate to.")
141
- }), $n = f(St, {
142
- name: "goToBookmark",
143
- description: "Go to the extent of the bookmark with the given name.",
144
- schema: xt
145
- });
146
- async function Rt(e, t, r) {
147
- const a = r.map?.allLayers.find((l) => l.id === e);
148
- if (!a)
149
- return { text: `Error: Layer with id ${e} not found` };
150
- const o = t?.trim() ? t : "1=1", n = a.createQuery();
151
- n.where = o;
152
- try {
153
- const { extent: l, count: s } = await a.queryExtent(n);
154
- if (s === 0)
155
- return { text: `No features found in ${a.title} matching: ${o}`, where: o };
156
- if (l)
157
- await r.goTo(l);
158
- else
159
- return { text: `Error: Unable to determine extent for ${a.title}`, where: o };
160
- const c = {
161
- layerId: e,
162
- layerTitle: a.title ?? e,
163
- where: o,
164
- count: s
165
- };
166
- return {
167
- text: `Successfully zoomed to ${s} feature(s) in ${a.title} matching: ${o}`,
168
- where: o,
169
- sharedStatePatch: { lastNavigatedFeatures: { value: c } }
170
- };
171
- } catch (l) {
172
- return console.error("Error in goToFeatures:", l), { text: `Error: ${l instanceof Error ? l.message : "Unknown error"}`, where: o };
173
- }
174
- }
175
- async function $t({ layerId: e, where: t }, r) {
176
- const { mapView: a } = $(r);
177
- return await Rt(e, t, a);
178
- }
179
- const Ct = E.object({
180
- layerId: E.string().describe("The layerId of the layer to zoom to."),
181
- where: E.string().describe("The sql-92 where clause used to query features to zoom to")
182
- }), Cn = f($t, {
183
- name: "goToFeatures",
184
- description: "Go to the features that match the given filter related to the given layerId.",
185
- schema: Ct
186
- });
187
- async function Et(e) {
188
- const r = new Ge({
189
- xmin: -180,
190
- ymin: -90,
191
- xmax: 180,
192
- ymax: 90,
193
- spatialReference: { wkid: 4326 }
194
- }).expand(0.7);
195
- return await e.goTo(r), { text: "Successfully zoomed to world extent" };
196
- }
197
- async function Nt(e, t) {
198
- const { mapView: r } = $(t);
199
- return await Et(r);
200
- }
201
- const It = E.object({}), En = f(Nt, {
202
- name: "goToFullExtent",
203
- description: "Zooms the map to the full world extent using Esri's Geocoding Service.",
204
- schema: It
205
- });
206
- async function kt(e) {
207
- const r = e.map.initialViewProperties?.viewpoint?.targetGeometry;
208
- if (r)
209
- await e.goTo(r);
210
- else
211
- throw new Error("Initial extent is undefined");
212
- return { text: "Successfully zoomed to home extent" };
213
- }
214
- async function Ft(e, t) {
215
- const { mapView: r } = $(t);
216
- return await kt(r);
217
- }
218
- const zt = i.object({}), Nn = f(Ft, {
219
- name: "goToHomeExtent",
220
- description: "Go to the initial web map view extent",
221
- schema: zt
222
- });
223
- async function qt(e, t) {
224
- await t.when();
225
- const r = t.map?.allLayers.find((o) => o.id === e);
226
- if (!r)
227
- return console.warn(`[goToLayer] No matching FeatureLayer found for: ${e}`), { text: `Could not find layer for: ${e}` };
228
- let a;
229
- 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: `Successfully zoomed to: ${r.title ?? ""}` }) : { text: "Layer has no defined extent. Cannot zoom to layer." };
230
- }
231
- async function Dt({ layerId: e }, t) {
232
- const { mapView: r } = $(t);
233
- return await qt(e, r);
234
- }
235
- const At = E.object({
236
- layerId: E.string().describe("The id of the layer to navigate to")
237
- }), In = f(Dt, {
238
- name: "goToLayer",
239
- description: "Zooms the map view to the full extent of the top matching layer.",
240
- schema: At
241
- });
242
- async function Pt(e, t) {
243
- return await t.goTo({ scale: e }), { text: `Successfully zoomed to: ${e}` };
244
- }
245
- async function Lt({ scale: e }, t) {
246
- const { mapView: r } = $(t);
247
- return await Pt(e, r);
248
- }
249
- const jt = i.object({
250
- scale: i.number().describe("The map scale of the view to go to.")
251
- }), kn = f(Lt, {
252
- name: "goToScale",
253
- description: "Go to the specified view scale.",
254
- schema: jt
255
- });
256
- async function Gt(e, t, r) {
257
- const o = {
258
- target: new ve({
259
- longitude: e.longitude,
260
- latitude: e.latitude,
261
- spatialReference: { wkid: 4326 }
262
- })
263
- };
264
- return r?.zoom !== void 0 && (o.zoom = r.zoom), r?.scale !== void 0 && (o.scale = r.scale), await t.goTo(o), { text: `Successfully navigated to: ${[
265
- `(${e.latitude}°, ${e.longitude}°)`,
266
- r?.zoom !== void 0 ? `zoom ${r.zoom}` : "",
267
- r?.scale !== void 0 ? `scale 1:${r.scale}` : ""
268
- ].filter(Boolean).join(", ")}` };
269
- }
270
- async function Ot({
271
- center: e,
272
- zoom: t,
273
- scale: r
274
- }, a) {
275
- const { mapView: o } = $(a);
276
- return await Gt(e, o, { zoom: t, scale: r });
277
- }
278
- const Mt = i.object({
279
- center: i.object({
280
- longitude: i.number().describe("The longitude (x-coordinate) of the point to navigate to."),
281
- latitude: i.number().describe("The latitude (y-coordinate) of the point to navigate to.")
282
- }),
283
- zoom: i.number().optional().describe("The zoom level. Higher values = more zoomed in."),
284
- scale: i.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
285
- }), Fn = f(Ot, {
286
- name: "goToViewpoint",
287
- description: "Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",
288
- schema: Mt
289
- });
290
- async function Qt(e, t) {
291
- return await t.goTo({ zoom: e }), { text: `Successfully zoomed to: ${e}` };
292
- }
293
- async function _t({ zoom: e }, t) {
294
- const { mapView: r } = $(t);
295
- return await Qt(e, r);
296
- }
297
- const Wt = i.object({
298
- zoom: i.number().min(1).max(20).describe("The zoom level of the view to go to.")
299
- }), zn = f(_t, {
300
- name: "goToZoom",
301
- description: 'Go to the specified zoom level. If input is generic (e.g. "zoom in", then only zoom to the next appropriate level - increase level for zooming in and decrease for zooming out.).',
302
- schema: Wt
303
- }), we = /* @__PURE__ */ Object.assign({
71
+ }), Z = /* @__PURE__ */ Object.assign({
304
72
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md": () => import("./arcgis_knowledge_current_lc_context.js").then((e) => e.default),
305
73
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md": () => import("./arcgis_knowledge_current_map_context.js").then((e) => e.default),
74
+ "../agents/arcgisKnowledge/prompts/arcgis_knowledge_cypher_query_prompt.md": () => import("./arcgis_knowledge_cypher_query_prompt.js").then((e) => e.default),
306
75
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_lucene_generation_prompt.md": () => import("./arcgis_knowledge_lucene_generation_prompt.js").then((e) => e.default),
307
76
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_summarize_result_prompt.md": () => import("./arcgis_knowledge_summarize_result_prompt.js").then((e) => e.default),
308
77
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md": () => import("./arcgis_knowledge_tool_prompt.js").then((e) => e.default),
309
- "../agents/dataExploration/prompts/data_explore_filter_prompt.md": () => import("./data_explore_filter_prompt.js").then((e) => e.default),
310
- "../agents/dataExploration/prompts/data_explore_query_prompt.md": () => import("./data_explore_query_prompt.js").then((e) => e.default),
311
- "../agents/dataExploration/prompts/summarize_query_response_prompt.md": () => import("./summarize_query_response_prompt.js").then((e) => e.default),
312
- "../agents/help/prompts/help_prompt.md": () => import("./help_prompt.js").then((e) => e.default),
78
+ "../agents/dataExploration/skills/filter/SKILL.md": () => import("./SKILL2.js").then((e) => e.default),
79
+ "../agents/dataExploration/skills/query/SKILL.md": () => import("./SKILL.js").then((e) => e.default),
80
+ "../agents/dataExplorationGraph/prompts/data_explore_filter_prompt.md": () => import("./data_explore_filter_prompt.js").then((e) => e.default),
81
+ "../agents/dataExplorationGraph/prompts/data_explore_query_prompt.md": () => import("./data_explore_query_prompt.js").then((e) => e.default),
82
+ "../agents/dataExplorationGraph/prompts/summarize_query_response_prompt.md": () => import("./summarize_query_response_prompt.js").then((e) => e.default),
83
+ "../agents/help/skills/help/SKILL.md": () => import("./SKILL3.js").then((e) => e.default),
84
+ "../agents/helpGraph/prompts/help_prompt.md": () => import("./help_prompt.js").then((e) => e.default),
313
85
  "../agents/layerStyling/prompts/layer_styling_prompt.md": () => import("./layer_styling_prompt.js").then((e) => e.default),
314
- "../agents/navigation/prompts/navigation_intent_prompt.md": () => import("./navigation_intent_prompt.js").then((e) => e.default),
315
- "../agents/navigation/prompts/navigation_tool_prompt.md": () => import("./navigation_tool_prompt.js").then((e) => e.default)
86
+ "../agents/navigation/skills/navigation/SKILL.md": () => import("./SKILL4.js").then((e) => e.default),
87
+ "../agents/navigationGraph/prompts/navigation_intent_prompt.md": () => import("./navigation_intent_prompt.js").then((e) => e.default),
88
+ "../agents/navigationGraph/prompts/navigation_tool_prompt.md": () => import("./navigation_tool_prompt.js").then((e) => e.default)
316
89
  });
317
- async function te(e) {
318
- const t = Object.entries(we).find(([r]) => r.endsWith(`/${e}.md`));
90
+ async function L(e) {
91
+ const t = Object.entries(Z).find(([r]) => r.endsWith(`/${e}.md`));
319
92
  if (!t)
320
93
  throw new Error(`Prompt not found: ${e}
321
94
  Available prompts:
322
- ${Object.keys(we).join(`
95
+ ${Object.keys(Z).join(`
323
96
  `)}`);
324
97
  return await t[1]();
325
98
  }
326
- const Vt = (e, t = 300) => {
99
+ const Ie = (e, t = 300) => {
327
100
  const r = e.replace(/\s+/gu, " ").replace(/[*_`#>\-]/gu, "").trim();
328
101
  return r.length > t ? `${r.slice(0, t)}...` : r;
329
- }, Re = (e, t) => {
330
- const a = e?.configurable?.services?.[t];
331
- if (a == null)
332
- throw new Error(`${t} missing in config.configurable.services`);
333
- return a;
334
- }, qn = (e, t) => (r, a) => {
335
- const o = a?.configurable?.services;
336
- for (const n of e)
337
- if (!o?.[n])
338
- throw new Error(`${t} requires services.${n} to be available.`);
339
- return r;
340
- };
341
- async function Ut(e) {
342
- const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
343
- let l;
344
- return n ? l = Me({
345
- basemapTheme: await ye(a),
102
+ }, Ca = y.Root({
103
+ ...G(),
104
+ vectorSearchLayerIds: y(),
105
+ vectorSearchFieldResults: y(),
106
+ layerFieldInfo: y(),
107
+ queryResponse: y(),
108
+ dataExplorationMessages: y({
109
+ reducer: ee,
110
+ default: () => []
111
+ })
112
+ }), Oe = [ye, ge, fe, we], $a = [me, he, ue], Ke = new de(Oe, { handleToolErrors: !1 });
113
+ async function Pa(e, t) {
114
+ const { messages: r } = await Ke.invoke({ messages: e.dataExplorationMessages }, t), a = [], o = [];
115
+ for (const i of r) {
116
+ const s = i.content;
117
+ let n;
118
+ typeof s != "string" && (n = {
119
+ tool: i.name ?? "unknown",
120
+ layerName: "unknown",
121
+ summary: "Query failed",
122
+ details: { error: "Skipping non-string tool output:", raw: s }
123
+ });
124
+ try {
125
+ typeof s == "string" ? n = JSON.parse(s) : n = {
126
+ tool: i.name ?? "unknown",
127
+ layerName: "unknown",
128
+ summary: "Query failed",
129
+ details: { error: "Invalid tool output type", raw: s }
130
+ };
131
+ } catch {
132
+ n = {
133
+ tool: i.name ?? "unknown",
134
+ layerName: "unknown",
135
+ summary: "Query failed",
136
+ details: { error: s }
137
+ };
138
+ }
139
+ a.push(n), n.details && typeof n.details == "object" && "error" in n.details ? o.push(`- ${n.tool}: Error - ${String(n.details.error)}`) : o.push(`- ${n.layerName}: ${n.summary}`);
140
+ }
141
+ return await T({ text: `Finished executing layer query tool: ${o.join(", ")}` }, t), {
142
+ ...e,
143
+ dataExplorationMessages: [...e.dataExplorationMessages, ...r],
144
+ queryResponse: a,
145
+ status: "success",
146
+ summary: o.length > 0 ? Ie(o.join(`
147
+ `)) : "Query executed."
148
+ };
149
+ }
150
+ async function Ve(e) {
151
+ const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: i } = e;
152
+ let s;
153
+ return i ? s = Te({
154
+ basemapTheme: await X(a),
346
155
  geometryType: r.geometryType,
347
- includedTags: n,
156
+ includedTags: i,
348
157
  numColors: Math.min(t.length, 8)
349
- })[0] : l = Qe({
350
- basemapTheme: await ye(a),
158
+ })[0] : s = Se({
159
+ basemapTheme: await X(a),
351
160
  geometryType: r.geometryType,
352
161
  numColors: Math.min(t.length, 8)
353
162
  }).primaryScheme, {
354
163
  layer: r,
355
164
  view: a,
356
- attributes: t.map((s) => ({
357
- field: s,
358
- label: r.fields.find((c) => c.name === s)?.alias ?? ""
165
+ attributes: t.map((n) => ({
166
+ field: n,
167
+ label: r.fields.find((l) => l.name === n)?.alias ?? ""
359
168
  })).slice(0, 8),
360
169
  outlineOptimizationEnabled: !0,
361
170
  sizeOptimizationEnabled: !0,
362
171
  includeSizeVariable: o.includes("Size"),
363
- pieChartScheme: l
172
+ pieChartScheme: s
364
173
  };
365
174
  }
366
- async function Kt(e) {
367
- return await Oe(e);
175
+ async function Be(e) {
176
+ return await be(e);
368
177
  }
369
- async function Bt({
178
+ async function We({
370
179
  arcgisMap: e,
371
180
  arcgisMapView: t,
372
181
  layerId: r,
373
182
  fields: a,
374
183
  colorSchemes: o,
375
- includeSize: n
184
+ includeSize: i
376
185
  }) {
377
- const l = t, s = e?.allLayers.find((d) => d.id === r);
378
- if (!s)
186
+ const s = t, n = e?.allLayers.find((d) => d.id === r);
187
+ if (!n)
379
188
  return `Could not find layer for id: ${r}`;
380
- const u = {
381
- styleName: n ? "chart-size" : "chart",
189
+ const p = {
190
+ styleName: i ? "chart-size" : "chart",
382
191
  fields: a,
383
- layer: s,
384
- view: l,
192
+ layer: n,
193
+ view: s,
385
194
  colorSchemeTags: o
386
195
  };
387
196
  try {
388
- const d = await Ut(u), p = await Kt(d);
389
- return s.renderer = p.renderer, s.visible = !0, `Chart renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
197
+ const d = await Ve(p), u = await Be(d);
198
+ return n.renderer = u.renderer, n.visible = !0, `Chart renderer applied to layer: ${n.title ?? n.id} using fields ${a.join(", ")}`;
390
199
  } catch (d) {
391
200
  return `Error applying chart renderer: ${d instanceof Error ? d.message : String(d)}`;
392
201
  }
393
202
  }
394
- const Ht = ["mapView"];
395
- function R(e) {
203
+ const Ue = ["mapView"];
204
+ function v(e) {
396
205
  const r = e?.configurable?.context;
397
206
  if (!r || typeof r != "object")
398
207
  throw new Error("LayerStylingAgent context missing");
399
- const a = Ht.filter((o) => !(o in r));
208
+ const a = Ue.filter((o) => !(o in r));
400
209
  if (a.length)
401
210
  throw new Error(`LayerStylingAgent context missing: ${a.join(", ")}`);
402
211
  return r;
403
212
  }
404
- async function Jt({
213
+ async function He({
405
214
  layerId: e,
406
215
  fields: t,
407
216
  colorSchemes: r,
408
217
  includeSize: a
409
218
  }, o) {
410
- const { mapView: n } = R(o);
411
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await Bt({
412
- arcgisMap: n.map,
413
- arcgisMapView: n,
219
+ const { mapView: i } = v(o);
220
+ return await S({ type: "show-legend", data: { layerIds: [e] } }, o), await We({
221
+ arcgisMap: i.map,
222
+ arcgisMapView: i,
414
223
  layerId: e,
415
224
  fields: t,
416
225
  colorSchemes: r,
417
226
  includeSize: a
418
227
  });
419
228
  }
420
- const Zt = i.object({
421
- layerId: i.string().describe("The id of the layer to apply the chart renderer to"),
422
- fields: i.array(i.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),
423
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
424
- includeSize: i.boolean().optional().describe("Whether to vary the chart size (chart-size)")
425
- }), Dn = f(Jt, {
229
+ const Je = c.object({
230
+ layerId: c.string().describe("The id of the layer to apply the chart renderer to"),
231
+ fields: c.array(c.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),
232
+ colorSchemes: c.array(c.string()).optional().describe("Optional color scheme tags to use"),
233
+ includeSize: c.boolean().optional().describe("Whether to vary the chart size (chart-size)")
234
+ }), Ea = g(He, {
426
235
  name: "chart",
427
236
  description: `Label: Charts
428
237
  Description: Show the values of two or more categories as a proportion of the total using a pie chart.
@@ -435,77 +244,77 @@ const Zt = i.object({
435
244
  Keywords: pie, chart, all categories, breakdown, proportion, total, amount, how much, sum, graduated size, proportional size
436
245
  Example: Show the total number of homes built in each decade using a pie chart for each feature and vary the size of each chart based on the total of all categories.
437
246
  Fields: This style requires 2-8 number fields.`,
438
- schema: Zt
247
+ schema: Je
439
248
  });
440
- function Yt(e) {
441
- const { fields: t, layer: r, view: a, theme: o, colorSchemeTags: n } = e, l = t[0];
442
- let s;
443
- return n && (s = le({
249
+ function Xe(e) {
250
+ const { fields: t, layer: r, view: a, theme: o, colorSchemeTags: i } = e, s = t[0];
251
+ let n;
252
+ return i && (n = V({
444
253
  geometryType: r.geometryType,
445
- includedTags: n,
254
+ includedTags: i,
446
255
  theme: o || "high-to-low"
447
256
  })[0]), {
448
257
  layer: r,
449
258
  view: a,
450
- startTime: l,
259
+ startTime: s,
451
260
  endTime: /* @__PURE__ */ new Date(),
452
261
  theme: o,
453
262
  sizeOptimizationEnabled: !0,
454
263
  outlineOptimizationEnabled: !0,
455
- colorScheme: s
264
+ colorScheme: n
456
265
  };
457
266
  }
458
- async function Xt(e) {
459
- return await _e(e);
267
+ async function Ye(e) {
268
+ return await ve(e);
460
269
  }
461
- async function er({
270
+ async function Ze({
462
271
  arcgisMap: e,
463
272
  arcgisMapView: t,
464
273
  layerId: r,
465
274
  fields: a,
466
275
  colorSchemes: o,
467
- theme: n
276
+ theme: i
468
277
  }) {
469
- const l = t, s = e?.allLayers.find((u) => u.id === r);
470
- if (!s)
278
+ const s = t, n = e?.allLayers.find((p) => p.id === r);
279
+ if (!n)
471
280
  return `Could not find layer for id: ${r}`;
472
- const c = {
281
+ const l = {
473
282
  styleName: "color-age",
474
283
  fields: a,
475
- layer: s,
476
- view: l,
284
+ layer: n,
285
+ view: s,
477
286
  colorSchemeTags: o,
478
- theme: n
287
+ theme: i
479
288
  };
480
289
  try {
481
- const u = Yt(c), d = await Xt(u);
482
- return s.renderer = d.renderer, s.visible = !0, `Color-age renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
483
- } catch (u) {
484
- return `Error applying color-age renderer: ${u instanceof Error ? u.message : String(u)}`;
290
+ const p = Xe(l), d = await Ye(p);
291
+ return n.renderer = d.renderer, n.visible = !0, `Color-age renderer applied to layer: ${n.title ?? n.id} using fields ${a.join(", ")}`;
292
+ } catch (p) {
293
+ return `Error applying color-age renderer: ${p instanceof Error ? p.message : String(p)}`;
485
294
  }
486
295
  }
487
- async function tr({
296
+ async function er({
488
297
  layerId: e,
489
298
  fields: t,
490
299
  colorSchemes: r,
491
300
  theme: a
492
301
  }, o) {
493
- const { mapView: n } = R(o);
494
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await er({
495
- arcgisMap: n.map,
496
- arcgisMapView: n,
302
+ const { mapView: i } = v(o);
303
+ return await S({ type: "show-legend", data: { layerIds: [e] } }, o), await Ze({
304
+ arcgisMap: i.map,
305
+ arcgisMapView: i,
497
306
  layerId: e,
498
307
  fields: t,
499
308
  colorSchemes: r,
500
309
  theme: a
501
310
  });
502
311
  }
503
- const rr = i.object({
504
- layerId: i.string().describe("The id of the layer to apply the color-age renderer to"),
505
- fields: i.array(i.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),
506
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
507
- theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
508
- }), An = f(tr, {
312
+ const rr = c.object({
313
+ layerId: c.string().describe("The id of the layer to apply the color-age renderer to"),
314
+ fields: c.array(c.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),
315
+ colorSchemes: c.array(c.string()).optional().describe("Optional color scheme tags to use"),
316
+ theme: c.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
317
+ }), za = g(er, {
509
318
  name: "color-age",
510
319
  description: `Label: Age (color)
511
320
  Description: Use colors along a continuous color ramp to represent the age of features. Age reflects the length of time from a start date to an end date.
@@ -514,167 +323,167 @@ const rr = i.object({
514
323
  Fields: This style requires at least one field with a date type.`,
515
324
  schema: rr
516
325
  });
517
- function ar(e) {
326
+ function tr(e) {
518
327
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
519
- let { theme: n } = e, l = t[1];
520
- const s = t[0];
521
- let c;
522
- return o && (c = le({
328
+ let { theme: i } = e, s = t[1];
329
+ const n = t[0];
330
+ let l;
331
+ return o && (l = V({
523
332
  geometryType: r.geometryType,
524
333
  includedTags: o,
525
- theme: n || "high-to-low"
334
+ theme: i || "high-to-low"
526
335
  })[0]), {
527
336
  layer: r,
528
337
  view: a,
529
- field: s,
530
- normalizationField: l,
531
- theme: n,
338
+ field: n,
339
+ normalizationField: s,
340
+ theme: i,
532
341
  sizeOptimizationEnabled: !0,
533
342
  outlineOptimizationEnabled: !0,
534
- colorScheme: c
343
+ colorScheme: l
535
344
  };
536
345
  }
537
- async function or(e) {
538
- return await We(e);
346
+ async function ar(e) {
347
+ return await Re(e);
539
348
  }
540
- async function nr({
349
+ async function or({
541
350
  arcgisMap: e,
542
351
  arcgisMapView: t,
543
352
  layerId: r,
544
353
  fields: a,
545
354
  colorSchemes: o,
546
- theme: n
355
+ theme: i
547
356
  }) {
548
- const l = t, s = e?.allLayers.find((u) => u.id === r);
549
- if (!s)
357
+ const s = t, n = e?.allLayers.find((p) => p.id === r);
358
+ if (!n)
550
359
  return `Could not find layer for id: ${r}`;
551
- const c = {
360
+ const l = {
552
361
  styleName: "color",
553
362
  fields: a,
554
- layer: s,
555
- view: l,
363
+ layer: n,
364
+ view: s,
556
365
  colorSchemeTags: o,
557
- theme: n
366
+ theme: i
558
367
  };
559
368
  try {
560
- const u = ar(c), d = await or(u);
561
- return s.renderer = d.renderer, s.visible = !0, `Color renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
562
- } catch (u) {
563
- return `Error applying color renderer: ${u instanceof Error ? u.message : String(u)}`;
369
+ const p = tr(l), d = await ar(p);
370
+ return n.renderer = d.renderer, n.visible = !0, `Color renderer applied to layer: ${n.title ?? n.id} using fields ${a.join(", ")}`;
371
+ } catch (p) {
372
+ return `Error applying color renderer: ${p instanceof Error ? p.message : String(p)}`;
564
373
  }
565
374
  }
566
- async function ir({
375
+ async function nr({
567
376
  layerId: e,
568
377
  fields: t,
569
378
  colorSchemes: r,
570
379
  theme: a
571
380
  }, o) {
572
- const { mapView: n } = R(o);
573
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await nr({
574
- arcgisMap: n.map,
575
- arcgisMapView: n,
381
+ const { mapView: i } = v(o);
382
+ return await S({ type: "show-legend", data: { layerIds: [e] } }, o), await or({
383
+ arcgisMap: i.map,
384
+ arcgisMapView: i,
576
385
  layerId: e,
577
386
  fields: t,
578
387
  colorSchemes: r,
579
388
  theme: a
580
389
  });
581
390
  }
582
- const sr = i.object({
583
- layerId: i.string().describe("The id of the layer to apply the color renderer to"),
584
- fields: i.array(i.string()).describe("The field(s) to use for the color renderer"),
585
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
586
- theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
587
- }), Pn = f(ir, {
391
+ const ir = c.object({
392
+ layerId: c.string().describe("The id of the layer to apply the color renderer to"),
393
+ fields: c.array(c.string()).describe("The field(s) to use for the color renderer"),
394
+ colorSchemes: c.array(c.string()).optional().describe("Optional color scheme tags to use"),
395
+ theme: c.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
396
+ }), ka = g(nr, {
588
397
  name: "color",
589
398
  description: `Label: Counts and Amounts (color)
590
399
  Description: Vary color along a continuous color ramp to represent numeric or ranked data.
591
400
  Keywords: graduated color, choropleth, continuous color, hue, color, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease
592
401
  Example: Color each feature based on the population density.
593
402
  Fields: This style requires a single field with a number type. A second number field may be specified for normalizing the value of the first field.`,
594
- schema: sr
403
+ schema: ir
595
404
  });
596
- function lr(e) {
597
- const { fields: t, layer: r, view: a, colorSchemeTags: o, theme: n } = e;
598
- let l, s;
599
- const c = t[0];
600
- return o && (s = le({
405
+ function sr(e) {
406
+ const { fields: t, layer: r, view: a, colorSchemeTags: o, theme: i } = e;
407
+ let s, n;
408
+ const l = t[0];
409
+ return o && (n = V({
601
410
  geometryType: r.geometryType,
602
411
  includedTags: o,
603
- theme: n || "high-to-low"
412
+ theme: i || "high-to-low"
604
413
  })[0]), {
605
414
  layer: r,
606
415
  view: a,
607
- field: c,
608
- normalizationField: l,
609
- theme: n,
416
+ field: l,
417
+ normalizationField: s,
418
+ theme: i,
610
419
  colorOptions: {
611
- colorScheme: s
420
+ colorScheme: n
612
421
  }
613
422
  };
614
423
  }
615
- async function cr(e) {
616
- return await Ve(e);
424
+ async function lr(e) {
425
+ return await xe(e);
617
426
  }
618
- async function ur({
427
+ async function cr({
619
428
  arcgisMap: e,
620
429
  arcgisMapView: t,
621
430
  layerId: r,
622
431
  fields: a,
623
432
  colorSchemes: o,
624
- theme: n
433
+ theme: i
625
434
  }) {
626
- const l = t, s = e?.allLayers.find((u) => u.id === r);
627
- if (!s)
435
+ const s = t, n = e?.allLayers.find((p) => p.id === r);
436
+ if (!n)
628
437
  return `Could not find layer for id: ${r}`;
629
- const c = {
438
+ const l = {
630
439
  styleName: "color-size-univariate",
631
440
  fields: a,
632
- layer: s,
633
- view: l,
441
+ layer: n,
442
+ view: s,
634
443
  colorSchemeTags: o,
635
- theme: n
444
+ theme: i
636
445
  };
637
446
  try {
638
- const u = lr(c), d = await cr(u);
639
- return s.renderer = d.renderer, s.visible = !0, `Color-size-univariate renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
640
- } catch (u) {
641
- return `Error applying color-size-univariate renderer: ${u instanceof Error ? u.message : String(u)}`;
447
+ const p = sr(l), d = await lr(p);
448
+ return n.renderer = d.renderer, n.visible = !0, `Color-size-univariate renderer applied to layer: ${n.title ?? n.id} using fields ${a.join(", ")}`;
449
+ } catch (p) {
450
+ return `Error applying color-size-univariate renderer: ${p instanceof Error ? p.message : String(p)}`;
642
451
  }
643
452
  }
644
- async function dr({
453
+ async function pr({
645
454
  layerId: e,
646
455
  fields: t,
647
456
  colorSchemes: r,
648
457
  theme: a
649
458
  }, o) {
650
- const { mapView: n } = R(o);
651
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await ur({
652
- arcgisMap: n.map,
653
- arcgisMapView: n,
459
+ const { mapView: i } = v(o);
460
+ return await S({ type: "show-legend", data: { layerIds: [e] } }, o), await cr({
461
+ arcgisMap: i.map,
462
+ arcgisMapView: i,
654
463
  layerId: e,
655
464
  fields: t,
656
465
  colorSchemes: r,
657
466
  theme: a
658
467
  });
659
468
  }
660
- const pr = i.object({
661
- layerId: i.string().describe("The id of the layer to apply the color-size univariate renderer to"),
662
- fields: i.array(i.string()).describe("The fields to use for the color-size univariate renderer"),
663
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
664
- theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color and size ramps")
665
- }), Ln = f(dr, {
469
+ const dr = c.object({
470
+ layerId: c.string().describe("The id of the layer to apply the color-size univariate renderer to"),
471
+ fields: c.array(c.string()).describe("The fields to use for the color-size univariate renderer"),
472
+ colorSchemes: c.array(c.string()).optional().describe("Optional color scheme tags to use"),
473
+ theme: c.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color and size ramps")
474
+ }), Aa = g(pr, {
666
475
  name: "color-size-univariate",
667
476
  description: `Label: Color and Size (univariate)
668
477
  Description: Vary symbol size and color based on the values of two numeric attributes.
669
478
  Keywords: continuous color, hue, color, size, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease, amount
670
479
  Example: Color each feature based on the percentage of the population that owns a home and vary the size of each point based on total population.
671
480
  Fields: This style requires at least two fields: one determining the color of each feature, the other determining the size of each feature. Each field may be normalized by an additional normalization field.`,
672
- schema: pr
481
+ schema: dr
673
482
  });
674
- function hr(e) {
483
+ function ur(e) {
675
484
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
676
- let n;
677
- return o && (n = Ke({
485
+ let i;
486
+ return o && (i = $e({
678
487
  includedTags: o,
679
488
  numColors: Math.min(t.length, 8)
680
489
  })[0]), {
@@ -683,48 +492,48 @@ function hr(e) {
683
492
  legendOptions: {
684
493
  unit: "units"
685
494
  },
686
- attributes: t.map((l) => ({
687
- field: l,
688
- label: r.fields.find((s) => s.name === l)?.alias ?? ""
495
+ attributes: t.map((s) => ({
496
+ field: s,
497
+ label: r.fields.find((n) => n.name === s)?.alias ?? ""
689
498
  })).slice(0, 8),
690
499
  outlineOptimizationEnabled: !0,
691
- dotDensityScheme: n
500
+ dotDensityScheme: i
692
501
  };
693
502
  }
694
- async function mr(e) {
695
- return await Ue(e);
503
+ async function hr(e) {
504
+ return await Ce(e);
696
505
  }
697
- async function yr({
506
+ async function mr({
698
507
  arcgisMap: e,
699
508
  arcgisMapView: t,
700
509
  layerId: r,
701
510
  fields: a,
702
511
  colorSchemes: o
703
512
  }) {
704
- const n = t, l = e?.allLayers.find((c) => c.id === r);
705
- if (!l)
513
+ const i = t, s = e?.allLayers.find((l) => l.id === r);
514
+ if (!s)
706
515
  return `Could not find layer for id: ${r}`;
707
- const s = {
516
+ const n = {
708
517
  styleName: "dot-density",
709
518
  fields: a,
710
- layer: l,
711
- view: n,
519
+ layer: s,
520
+ view: i,
712
521
  colorSchemeTags: o
713
522
  };
714
523
  try {
715
- const c = hr(s), u = await mr(c);
716
- return l.renderer = u.renderer, l.visible = !0, `Dot Density renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
717
- } catch (c) {
718
- return `Error applying dot density renderer: ${c instanceof Error ? c.message : String(c)}`;
524
+ const l = ur(n), p = await hr(l);
525
+ return s.renderer = p.renderer, s.visible = !0, `Dot Density renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
526
+ } catch (l) {
527
+ return `Error applying dot density renderer: ${l instanceof Error ? l.message : String(l)}`;
719
528
  }
720
529
  }
721
- async function fr({
530
+ async function yr({
722
531
  layerId: e,
723
532
  fields: t,
724
533
  colorSchemes: r
725
534
  }, a) {
726
- const { mapView: o } = R(a);
727
- return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await yr({
535
+ const { mapView: o } = v(a);
536
+ return await S({ type: "show-legend", data: { layerIds: [e] } }, a), await mr({
728
537
  arcgisMap: o.map,
729
538
  arcgisMapView: o,
730
539
  layerId: e,
@@ -732,11 +541,11 @@ async function fr({
732
541
  colorSchemes: r
733
542
  });
734
543
  }
735
- const gr = i.object({
736
- layerId: i.string().describe("The id of the layer to apply the dot density renderer to"),
737
- fields: i.array(i.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),
738
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
739
- }), jn = f(fr, {
544
+ const gr = c.object({
545
+ layerId: c.string().describe("The id of the layer to apply the dot density renderer to"),
546
+ fields: c.array(c.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),
547
+ colorSchemes: c.array(c.string()).optional().describe("Optional color scheme tags to use")
548
+ }), Na = g(yr, {
740
549
  name: "dot-density",
741
550
  description: `Dot Density
742
551
  Use dot density to visualize the distribution of one attribute or compare the density of multiple attributes. This is only valid for polygon layers.
@@ -752,54 +561,54 @@ const gr = i.object({
752
561
  **Keywords:** density, how much, how many, total, number, amount`,
753
562
  schema: gr
754
563
  });
755
- function wr(e) {
564
+ function fr(e) {
756
565
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
757
- let n;
758
- const l = t[0];
759
- return o && (n = He({
566
+ let i;
567
+ const s = t[0];
568
+ return o && (i = Ee({
760
569
  includedTags: o,
761
570
  basemap: a.map?.basemap || "topo"
762
571
  })[0]), {
763
572
  layer: r,
764
573
  view: a,
765
- field: l,
766
- heatmapScheme: n
574
+ field: s,
575
+ heatmapScheme: i
767
576
  };
768
577
  }
769
- async function br(e) {
770
- return await Be(e);
578
+ async function wr(e) {
579
+ return await Pe(e);
771
580
  }
772
- async function Tr({
581
+ async function br({
773
582
  arcgisMap: e,
774
583
  arcgisMapView: t,
775
584
  layerId: r,
776
585
  fields: a,
777
586
  colorSchemes: o
778
587
  }) {
779
- const n = t, l = e?.allLayers.find((c) => c.id === r);
780
- if (!l)
588
+ const i = t, s = e?.allLayers.find((l) => l.id === r);
589
+ if (!s)
781
590
  return `Could not find layer for id: ${r}`;
782
- const s = {
591
+ const n = {
783
592
  styleName: "heatmap",
784
593
  fields: a,
785
- layer: l,
786
- view: n,
594
+ layer: s,
595
+ view: i,
787
596
  colorSchemeTags: o
788
597
  };
789
598
  try {
790
- const c = wr(s), u = await br(c);
791
- return l.renderer = u.renderer, l.visible = !0, `Heatmap renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
792
- } catch (c) {
793
- return `Error applying heatmap renderer: ${c instanceof Error ? c.message : String(c)}`;
599
+ const l = fr(n), p = await wr(l);
600
+ return s.renderer = p.renderer, s.visible = !0, `Heatmap renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
601
+ } catch (l) {
602
+ return `Error applying heatmap renderer: ${l instanceof Error ? l.message : String(l)}`;
794
603
  }
795
604
  }
796
- async function vr({
605
+ async function Tr({
797
606
  layerId: e,
798
607
  fields: t,
799
608
  colorSchemes: r
800
609
  }, a) {
801
- const { mapView: o } = R(a);
802
- return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Tr({
610
+ const { mapView: o } = v(a);
611
+ return await S({ type: "show-legend", data: { layerIds: [e] } }, a), await br({
803
612
  arcgisMap: o.map,
804
613
  arcgisMapView: o,
805
614
  layerId: e,
@@ -807,11 +616,11 @@ async function vr({
807
616
  colorSchemes: r
808
617
  });
809
618
  }
810
- const Sr = i.object({
811
- layerId: i.string().describe("The id of the layer to apply the heatmap renderer to"),
812
- fields: i.array(i.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),
813
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
814
- }), Gn = f(vr, {
619
+ const Sr = c.object({
620
+ layerId: c.string().describe("The id of the layer to apply the heatmap renderer to"),
621
+ fields: c.array(c.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),
622
+ colorSchemes: c.array(c.string()).optional().describe("Optional color scheme tags to use")
623
+ }), qa = g(Tr, {
815
624
  name: "heatmap",
816
625
  description: `Label: Heat Map
817
626
  Description: Show areas of high density with colors that appear to glow hotter. This is only valid for point layers.
@@ -820,47 +629,47 @@ Example: Create a heatmap
820
629
  Fields: This typically requires zero or one field of type number.`,
821
630
  schema: Sr
822
631
  });
823
- function xr(e) {
824
- const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
825
- let l;
826
- return n && (l = Ze({
632
+ function vr(e) {
633
+ const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: i } = e;
634
+ let s;
635
+ return i && (s = ke({
827
636
  geometryType: r.geometryType,
828
- includedTags: n,
637
+ includedTags: i,
829
638
  numColors: Math.min(t.length, 10)
830
639
  })[0]), {
831
640
  layer: r,
832
641
  view: a,
833
- fields: t.map((s) => ({ name: s })).slice(0, 9),
642
+ fields: t.map((n) => ({ name: n })).slice(0, 9),
834
643
  outlineOptimizationEnabled: !0,
835
644
  sizeOptimizationEnabled: !0,
836
645
  includeSizeVariable: o.includes("Size"),
837
- predominanceScheme: l
646
+ predominanceScheme: s
838
647
  };
839
648
  }
840
649
  async function Rr(e) {
841
- return await Je(e);
650
+ return await ze(e);
842
651
  }
843
- async function $r({
652
+ async function xr({
844
653
  arcgisMap: e,
845
654
  arcgisMapView: t,
846
655
  layerId: r,
847
656
  fields: a,
848
657
  colorSchemes: o,
849
- includeSize: n
658
+ includeSize: i
850
659
  }) {
851
- const l = t, s = e?.allLayers.find((d) => d.id === r);
852
- if (!s)
660
+ const s = t, n = e?.allLayers.find((d) => d.id === r);
661
+ if (!n)
853
662
  return `Could not find layer for id: ${r}`;
854
- const u = {
855
- styleName: n ? "predominance-size" : "predominance",
663
+ const p = {
664
+ styleName: i ? "predominance-size" : "predominance",
856
665
  fields: a,
857
- layer: s,
858
- view: l,
666
+ layer: n,
667
+ view: s,
859
668
  colorSchemeTags: o
860
669
  };
861
670
  try {
862
- const d = xr(u), p = await Rr(d);
863
- return s.renderer = p.renderer, s.visible = !0, `Predominance renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
671
+ const d = vr(p), u = await Rr(d);
672
+ return n.renderer = u.renderer, n.visible = !0, `Predominance renderer applied to layer: ${n.title ?? n.id} using fields ${a.join(", ")}`;
864
673
  } catch (d) {
865
674
  return `Error applying predominance renderer: ${d instanceof Error ? d.message : String(d)}`;
866
675
  }
@@ -871,22 +680,22 @@ async function Cr({
871
680
  colorSchemes: r,
872
681
  includeSize: a
873
682
  }, o) {
874
- const { mapView: n } = R(o);
875
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await $r({
876
- arcgisMap: n.map,
877
- arcgisMapView: n,
683
+ const { mapView: i } = v(o);
684
+ return await S({ type: "show-legend", data: { layerIds: [e] } }, o), await xr({
685
+ arcgisMap: i.map,
686
+ arcgisMapView: i,
878
687
  layerId: e,
879
688
  fields: t,
880
689
  colorSchemes: r,
881
690
  includeSize: a
882
691
  });
883
692
  }
884
- const Er = i.object({
885
- layerId: i.string().describe("The id of the layer to apply the predominance renderer to"),
886
- fields: i.array(i.string()).describe("The fields to use for the predominance renderer (competing categories)"),
887
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
888
- includeSize: i.boolean().optional().describe("Whether to include size visualization (predominance-size)")
889
- }), On = f(Cr, {
693
+ const $r = c.object({
694
+ layerId: c.string().describe("The id of the layer to apply the predominance renderer to"),
695
+ fields: c.array(c.string()).describe("The fields to use for the predominance renderer (competing categories)"),
696
+ colorSchemes: c.array(c.string()).optional().describe("Optional color scheme tags to use"),
697
+ includeSize: c.boolean().optional().describe("Whether to include size visualization (predominance-size)")
698
+ }), Ma = g(Cr, {
890
699
  name: "predominance",
891
700
  description: `Label: Predominant category
892
701
  Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
@@ -899,63 +708,63 @@ const Er = i.object({
899
708
  Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top, amount, total, how much, proportional size, graduated size, sum
900
709
  Example: Show the predominant crop in each area and vary the size of each symbol based on the total of all categories.
901
710
  Fields: This style relies on 2-10 number fields.`,
902
- schema: Er
711
+ schema: $r
903
712
  });
904
- function Nr(e) {
713
+ function Pr(e) {
905
714
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
906
- let n;
907
- const l = {
715
+ let i;
716
+ const s = {
908
717
  field: t[0]
909
- }, s = {
718
+ }, n = {
910
719
  field: t[1]
911
720
  };
912
- return o && (n = Xe({
721
+ return o && (i = Ne({
913
722
  geometryType: r.geometryType,
914
723
  includedTags: o
915
724
  })[0]), {
916
725
  layer: r,
917
726
  view: a,
918
- field1: l,
919
- field2: s,
727
+ field1: s,
728
+ field2: n,
920
729
  outlineOptimizationEnabled: !0,
921
730
  sizeOptimizationEnabled: !0,
922
- relationshipScheme: n
731
+ relationshipScheme: i
923
732
  };
924
733
  }
925
- async function Ir(e) {
926
- return await Ye(e);
734
+ async function Er(e) {
735
+ return await Ae(e);
927
736
  }
928
- async function kr({
737
+ async function zr({
929
738
  arcgisMap: e,
930
739
  arcgisMapView: t,
931
740
  layerId: r,
932
741
  fields: a,
933
742
  colorSchemes: o
934
743
  }) {
935
- const n = t, l = e?.allLayers.find((c) => c.id === r);
936
- if (!l)
744
+ const i = t, s = e?.allLayers.find((l) => l.id === r);
745
+ if (!s)
937
746
  return `Could not find layer for id: ${r}`;
938
- const s = {
747
+ const n = {
939
748
  styleName: "relationship",
940
749
  fields: a,
941
- layer: l,
942
- view: n,
750
+ layer: s,
751
+ view: i,
943
752
  colorSchemeTags: o
944
753
  };
945
754
  try {
946
- const c = Nr(s), u = await Ir(c);
947
- return l.renderer = u.renderer, l.visible = !0, `Relationship renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
948
- } catch (c) {
949
- return `Error applying relationship renderer: ${c instanceof Error ? c.message : String(c)}`;
755
+ const l = Pr(n), p = await Er(l);
756
+ return s.renderer = p.renderer, s.visible = !0, `Relationship renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
757
+ } catch (l) {
758
+ return `Error applying relationship renderer: ${l instanceof Error ? l.message : String(l)}`;
950
759
  }
951
760
  }
952
- async function Fr({
761
+ async function kr({
953
762
  layerId: e,
954
763
  fields: t,
955
764
  colorSchemes: r
956
765
  }, a) {
957
- const { mapView: o } = R(a);
958
- return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await kr({
766
+ const { mapView: o } = v(a);
767
+ return await S({ type: "show-legend", data: { layerIds: [e] } }, a), await zr({
959
768
  arcgisMap: o.map,
960
769
  arcgisMapView: o,
961
770
  layerId: e,
@@ -963,82 +772,82 @@ async function Fr({
963
772
  colorSchemes: r
964
773
  });
965
774
  }
966
- const zr = i.object({
967
- layerId: i.string().describe("The id of the layer to apply the relationship renderer to"),
968
- fields: i.array(i.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),
969
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
970
- }), Mn = f(Fr, {
775
+ const Ar = c.object({
776
+ layerId: c.string().describe("The id of the layer to apply the relationship renderer to"),
777
+ fields: c.array(c.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),
778
+ colorSchemes: c.array(c.string()).optional().describe("Optional color scheme tags to use")
779
+ }), Da = g(kr, {
971
780
  name: "relationship",
972
781
  description: `Label: Relationship
973
782
  Description: Overlays two color ramps to represent the relationship between two numeric attributes.
974
783
  Keywords: relationship, correlation, compare, related, bivariate choropleth, bivariate color
975
784
  Example: Show the relationship between tree height and carbon storage
976
785
  Fields: This style requires two number fields.`,
977
- schema: zr
786
+ schema: Ar
978
787
  });
979
- function qr(e) {
980
- const { fields: t, layer: r, view: a, theme: o } = e, n = t[0];
788
+ function Nr(e) {
789
+ const { fields: t, layer: r, view: a, theme: o } = e, i = t[0];
981
790
  return {
982
791
  layer: r,
983
792
  view: a,
984
- startTime: n,
793
+ startTime: i,
985
794
  endTime: /* @__PURE__ */ new Date(),
986
795
  theme: o,
987
796
  sizeOptimizationEnabled: !0,
988
797
  outlineOptimizationEnabled: !0
989
798
  };
990
799
  }
991
- async function Dr(e) {
992
- return await et(e);
800
+ async function qr(e) {
801
+ return await qe(e);
993
802
  }
994
- async function Ar({
803
+ async function Mr({
995
804
  arcgisMap: e,
996
805
  arcgisMapView: t,
997
806
  layerId: r,
998
807
  fields: a,
999
808
  colorSchemes: o,
1000
- theme: n
809
+ theme: i
1001
810
  }) {
1002
- const l = t, s = e?.allLayers.find((u) => u.id === r);
1003
- if (!s)
811
+ const s = t, n = e?.allLayers.find((p) => p.id === r);
812
+ if (!n)
1004
813
  return `Could not find layer for id: ${r}`;
1005
- const c = {
814
+ const l = {
1006
815
  styleName: "size-age",
1007
816
  fields: a,
1008
- layer: s,
1009
- view: l,
817
+ layer: n,
818
+ view: s,
1010
819
  colorSchemeTags: o,
1011
- theme: n
820
+ theme: i
1012
821
  };
1013
822
  try {
1014
- const u = qr(c), d = await Dr(u);
1015
- return s.renderer = d.renderer, s.visible = !0, `Size-age renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
1016
- } catch (u) {
1017
- return `Error applying size-age renderer: ${u instanceof Error ? u.message : String(u)}`;
823
+ const p = Nr(l), d = await qr(p);
824
+ return n.renderer = d.renderer, n.visible = !0, `Size-age renderer applied to layer: ${n.title ?? n.id} using fields ${a.join(", ")}`;
825
+ } catch (p) {
826
+ return `Error applying size-age renderer: ${p instanceof Error ? p.message : String(p)}`;
1018
827
  }
1019
828
  }
1020
- async function Pr({
829
+ async function Dr({
1021
830
  layerId: e,
1022
831
  fields: t,
1023
832
  colorSchemes: r,
1024
833
  theme: a
1025
834
  }, o) {
1026
- const { mapView: n } = R(o);
1027
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await Ar({
1028
- arcgisMap: n.map,
1029
- arcgisMapView: n,
835
+ const { mapView: i } = v(o);
836
+ return await S({ type: "show-legend", data: { layerIds: [e] } }, o), await Mr({
837
+ arcgisMap: i.map,
838
+ arcgisMapView: i,
1030
839
  layerId: e,
1031
840
  fields: t,
1032
841
  colorSchemes: r,
1033
842
  theme: a
1034
843
  });
1035
844
  }
1036
- const Lr = i.object({
1037
- layerId: i.string().describe("The id of the layer to apply the size-age renderer to"),
1038
- fields: i.array(i.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),
1039
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
1040
- theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
1041
- }), Qn = f(Pr, {
845
+ const Lr = c.object({
846
+ layerId: c.string().describe("The id of the layer to apply the size-age renderer to"),
847
+ fields: c.array(c.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),
848
+ colorSchemes: c.array(c.string()).optional().describe("Optional color scheme tags to use"),
849
+ theme: c.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
850
+ }), La = g(Dr, {
1042
851
  name: "size-age",
1043
852
  description: `Label: Age (size)
1044
853
  Description: Vary symbol sizes along a continuous ramp to represent the age of features. Age reflects the length of time from a start date to an end date.
@@ -1047,71 +856,71 @@ const Lr = i.object({
1047
856
  Fields: This style requires at least one field with a date type.`,
1048
857
  schema: Lr
1049
858
  });
1050
- function jr(e) {
859
+ function Gr(e) {
1051
860
  const { fields: t, layer: r, view: a } = e;
1052
- let { theme: o } = e, n = t[1];
1053
- const l = t[0];
861
+ let { theme: o } = e, i = t[1];
862
+ const s = t[0];
1054
863
  return {
1055
864
  layer: r,
1056
865
  view: a,
1057
- field: l,
1058
- normalizationField: n,
866
+ field: s,
867
+ normalizationField: i,
1059
868
  theme: o,
1060
869
  sizeOptimizationEnabled: !0,
1061
870
  outlineOptimizationEnabled: !0
1062
871
  };
1063
872
  }
1064
- async function Gr(e) {
1065
- return await tt(e);
873
+ async function jr(e) {
874
+ return await Me(e);
1066
875
  }
1067
- async function Or({
876
+ async function Fr({
1068
877
  arcgisMap: e,
1069
878
  arcgisMapView: t,
1070
879
  layerId: r,
1071
880
  fields: a,
1072
881
  colorSchemes: o,
1073
- theme: n
882
+ theme: i
1074
883
  }) {
1075
- const l = t, s = e?.allLayers.find((u) => u.id === r);
1076
- if (!s)
884
+ const s = t, n = e?.allLayers.find((p) => p.id === r);
885
+ if (!n)
1077
886
  return `Could not find layer for id: ${r}`;
1078
- const c = {
887
+ const l = {
1079
888
  styleName: "size",
1080
889
  fields: a,
1081
- layer: s,
1082
- view: l,
890
+ layer: n,
891
+ view: s,
1083
892
  colorSchemeTags: o,
1084
- theme: n
893
+ theme: i
1085
894
  };
1086
895
  try {
1087
- const u = jr(c), d = await Gr(u);
1088
- return s.renderer = d.renderer, s.visible = !0, `Size renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
1089
- } catch (u) {
1090
- return `Error applying size renderer: ${u instanceof Error ? u.message : String(u)}`;
896
+ const p = Gr(l), d = await jr(p);
897
+ return n.renderer = d.renderer, n.visible = !0, `Size renderer applied to layer: ${n.title ?? n.id} using fields ${a.join(", ")}`;
898
+ } catch (p) {
899
+ return `Error applying size renderer: ${p instanceof Error ? p.message : String(p)}`;
1091
900
  }
1092
901
  }
1093
- async function Mr({
902
+ async function _r({
1094
903
  layerId: e,
1095
904
  fields: t,
1096
905
  colorSchemes: r,
1097
906
  theme: a
1098
907
  }, o) {
1099
- const { mapView: n } = R(o);
1100
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await Or({
1101
- arcgisMap: n.map,
1102
- arcgisMapView: n,
908
+ const { mapView: i } = v(o);
909
+ return await S({ type: "show-legend", data: { layerIds: [e] } }, o), await Fr({
910
+ arcgisMap: i.map,
911
+ arcgisMapView: i,
1103
912
  layerId: e,
1104
913
  fields: t,
1105
914
  colorSchemes: r,
1106
915
  theme: a
1107
916
  });
1108
917
  }
1109
- const Qr = i.object({
1110
- layerId: i.string().describe("The id of the layer to apply the size renderer to"),
1111
- fields: i.array(i.string()).describe("The field(s) to use for the size renderer (numeric data)"),
1112
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
1113
- theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
1114
- }), _n = f(Mr, {
918
+ const Qr = c.object({
919
+ layerId: c.string().describe("The id of the layer to apply the size renderer to"),
920
+ fields: c.array(c.string()).describe("The field(s) to use for the size renderer (numeric data)"),
921
+ colorSchemes: c.array(c.string()).optional().describe("Optional color scheme tags to use"),
922
+ theme: c.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
923
+ }), Ga = g(_r, {
1115
924
  name: "size",
1116
925
  description: `Label: Counts and Amounts (size)
1117
926
  Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
@@ -1126,942 +935,166 @@ const Qr = i.object({
1126
935
  Fields: This style requires a single field with a date type.`,
1127
936
  schema: Qr
1128
937
  });
1129
- function _r(e) {
1130
- const { fields: t, layer: r, view: a, colorSchemeTags: o } = e, n = t[0], l = t[1], s = t[2];
1131
- let c;
1132
- return o && (c = at({
938
+ function Ir(e) {
939
+ const { fields: t, layer: r, view: a, colorSchemeTags: o } = e, i = t[0], s = t[1], n = t[2];
940
+ let l;
941
+ return o && (l = Le({
1133
942
  geometryType: r.geometryType,
1134
943
  includedTags: o
1135
944
  })[0]), {
1136
945
  layer: r,
1137
946
  view: a,
1138
- field: n,
1139
- field2: l,
1140
- field3: s,
947
+ field: i,
948
+ field2: s,
949
+ field3: n,
1141
950
  outlineOptimizationEnabled: !0,
1142
951
  sizeOptimizationEnabled: !0,
1143
- typeScheme: c
952
+ typeScheme: l
1144
953
  };
1145
954
  }
1146
- async function Wr(e) {
1147
- return await rt(e);
955
+ async function Or(e) {
956
+ return await De(e);
1148
957
  }
1149
- async function Vr({
958
+ async function Kr({
1150
959
  arcgisMap: e,
1151
960
  arcgisMapView: t,
1152
961
  layerId: r,
1153
962
  fields: a,
1154
963
  colorSchemes: o,
1155
- theme: n
964
+ theme: i
1156
965
  }) {
1157
- const l = t, s = e?.allLayers.find((u) => u.id === r);
1158
- if (!s)
966
+ const s = t, n = e?.allLayers.find((p) => p.id === r);
967
+ if (!n)
1159
968
  return `Could not find layer for id: ${r}`;
1160
- const c = {
969
+ const l = {
1161
970
  styleName: "type",
1162
971
  fields: a,
1163
- layer: s,
1164
- view: l,
972
+ layer: n,
973
+ view: s,
1165
974
  colorSchemeTags: o,
1166
- theme: n
975
+ theme: i
1167
976
  };
1168
977
  try {
1169
- const u = _r(c), d = await Wr(u);
1170
- return s.renderer = d.renderer, s.visible = !0, `Type renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
1171
- } catch (u) {
1172
- return `Error applying type renderer: ${u instanceof Error ? u.message : String(u)}`;
978
+ const p = Ir(l), d = await Or(p);
979
+ return n.renderer = d.renderer, n.visible = !0, `Type renderer applied to layer: ${n.title ?? n.id} using fields ${a.join(", ")}`;
980
+ } catch (p) {
981
+ return `Error applying type renderer: ${p instanceof Error ? p.message : String(p)}`;
1173
982
  }
1174
983
  }
1175
- async function Ur({
984
+ async function Vr({
1176
985
  layerId: e,
1177
986
  fields: t,
1178
987
  colorSchemes: r,
1179
988
  theme: a
1180
989
  }, o) {
1181
- const { mapView: n } = R(o);
1182
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await Vr({
1183
- arcgisMap: n.map,
1184
- arcgisMapView: n,
990
+ const { mapView: i } = v(o);
991
+ return await S({ type: "show-legend", data: { layerIds: [e] } }, o), await Kr({
992
+ arcgisMap: i.map,
993
+ arcgisMapView: i,
1185
994
  layerId: e,
1186
995
  fields: t,
1187
996
  colorSchemes: r,
1188
997
  theme: a
1189
998
  });
1190
999
  }
1191
- const Kr = i.object({
1192
- layerId: i.string().describe("The id of the layer to apply the type renderer to"),
1193
- fields: i.array(i.string()).describe("The field(s) to use for the type renderer (categorical data)"),
1194
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
1195
- theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color scheme")
1196
- }), Wn = f(Ur, {
1000
+ const Br = c.object({
1001
+ layerId: c.string().describe("The id of the layer to apply the type renderer to"),
1002
+ fields: c.array(c.string()).describe("The field(s) to use for the type renderer (categorical data)"),
1003
+ colorSchemes: c.array(c.string()).optional().describe("Optional color scheme tags to use"),
1004
+ theme: c.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color scheme")
1005
+ }), ja = g(Vr, {
1197
1006
  name: "type",
1198
1007
  description: `Label: Types (unique symbols)
1199
1008
  Description: Represent features as categories with different symbol colors or shapes. Examples include type of tree, road class, or province name.
1200
1009
  Keywords: categorical, category, type, unique, discrete, point of interest, region, group
1201
1010
  Example: Color each feature based on the region it belongs to
1202
1011
  Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,
1203
- schema: Kr
1204
- }), Vn = b.Root({
1205
- ...B(),
1206
- vectorSearchLayerIds: b(),
1207
- vectorSearchFieldResults: b(),
1208
- layerFieldInfo: b(),
1209
- selectedLayerId: b()
1210
- }), Un = b.Root({
1211
- ...B(),
1212
- vectorSearchLayerIds: b(),
1213
- vectorSearchFieldResults: b(),
1214
- layerFieldInfo: b(),
1215
- queryResponse: b(),
1216
- dataExplorationMessages: b({
1217
- reducer: Te,
1218
- default: () => []
1219
- })
1220
- }), Br = ["mapView"];
1221
- function F(e) {
1222
- const r = e?.configurable?.context;
1223
- if (!r || typeof r != "object")
1224
- throw new Error("DataExplorationAgent context missing");
1225
- const a = Br.filter((o) => !(o in r));
1226
- if (a.length)
1227
- throw new Error(`DataExplorationAgent context missing: ${a.join(", ")}`);
1228
- return r;
1229
- }
1230
- const Hr = (e) => {
1231
- const t = e.map?.allLayers.filter((a) => a.type === "feature");
1232
- let r = 0;
1233
- return t?.forEach((a) => {
1234
- const o = a;
1235
- o.featureEffect && (o.featureEffect = null, r++);
1236
- }), r > 0 ? `Cleared filters from ${r} layer(s). View unchanged.` : "No active filters to clear. View unchanged.";
1237
- }, Jr = async (e, t) => {
1238
- const { mapView: r } = F(t);
1239
- return Hr(r);
1240
- }, Zr = f(Jr, {
1241
- name: "clearFilters",
1242
- description: "Clears all feature effects/filters from the map but does NOT change the current view. Use when user says 'clear filters', 'reset filters', 'remove filters', 'show all features', or wants to remove emphasis without navigating anywhere.",
1243
- schema: i.object({})
1244
- }), Yr = async (e) => {
1245
- e.map?.allLayers.filter((o) => o.type === "feature")?.forEach((o) => {
1246
- const n = o;
1247
- n.featureEffect && (n.featureEffect = null);
1248
- });
1249
- const a = e.map.initialViewProperties?.viewpoint?.targetGeometry;
1250
- return a ? (await e.goTo(a), "Cleared all filters and returned to home extent.") : "Cleared all filters. Could not determine home extent.";
1251
- }, Xr = async (e, t) => {
1252
- const { mapView: r } = F(t);
1253
- return await Yr(r);
1254
- }, ea = f(Xr, {
1255
- name: "resetMap",
1256
- description: "Clears all feature effects/filters from the map AND zooms to the home extent (initial map view). Use when user says 'reset map', 'reset the map', 'start over', or wants to both clear filters and return to the initial view.",
1257
- schema: i.object({})
1258
- }), be = 750;
1259
- function U(e) {
1260
- return "point" in e && e.point !== void 0;
1261
- }
1262
- function j(e) {
1263
- return "layerId" in e && e.layerId !== void 0;
1264
- }
1265
- const H = async (e, t) => {
1266
- if (U(e)) {
1267
- const { point: r } = e;
1268
- return { geometry: new ve({
1269
- x: r.x,
1270
- y: r.y,
1271
- spatialReference: r.spatialReference ? { wkid: r.spatialReference.wkid } : t.spatialReference
1272
- }) };
1273
- }
1274
- if (j(e)) {
1275
- const r = t.map?.allLayers.find(
1276
- (n) => n.id === e.layerId
1277
- );
1278
- if (!r)
1279
- return { error: `Could not find geometry layer with ID: ${e.layerId}` };
1280
- const a = r.title ?? r.id, o = e.where?.trim() || "1=1";
1281
- try {
1282
- const n = await r.queryFeatures({
1283
- where: o,
1284
- returnGeometry: !0,
1285
- outSpatialReference: t.spatialReference,
1286
- num: be + 1
1287
- });
1288
- if (!n.features.length)
1289
- return {
1290
- error: `No features found in geometry layer "${a}" with the specified where clause: ${o}`
1291
- };
1292
- if (n.features.length > be)
1293
- return {
1294
- error: `Geometry filter for layer "${a}" matched too many features (${n.features.length}+). Please narrow the geometry layer filter.`
1295
- };
1296
- const l = n.features.map((c) => c.geometry).filter((c) => !!c);
1297
- if (!l.length)
1298
- return { error: "No valid geometries found for the matched geometry layer features." };
1299
- const s = l.length === 1 ? l[0] : it.executeMany(l);
1300
- return s ? (s.spatialReference || (s.spatialReference = t.spatialReference), { geometry: s }) : { error: "Failed to combine geometries from geometry layer." };
1301
- } catch (n) {
1302
- return { error: `Failed to query geometry: ${String(n)}` };
1303
- }
1304
- }
1305
- return { error: "Invalid geometry configuration provided" };
1306
- }, ta = async (e, t, r, a, o, n) => {
1307
- const l = e.map?.allLayers.find((c) => c.id === t);
1308
- if (!l)
1309
- return { success: !1, error: `Layer '${t}' not found.` };
1310
- const s = l.createQuery();
1311
- s.where = r ?? "1=1", a && (s.geometry = a, s.spatialRelationship = "intersects", o && (s.distance = o), n && (s.units = n));
1312
- try {
1313
- const { extent: c, count: u } = await l.queryExtent(s);
1314
- return !c || u === 0 ? {
1315
- success: !1,
1316
- error: `No features found for filter (where: ${s.where}${a ? ", spatial filter used" : ""})`
1317
- } : (await e.goTo(c), { success: !0 });
1318
- } catch (c) {
1319
- return {
1320
- success: !1,
1321
- error: c instanceof Error ? c.message : String(c)
1322
- };
1323
- }
1324
- }, ra = async (e, t, r, a, o, n) => {
1325
- const l = t.map?.allLayers.find(
1326
- (p) => p.id === e.layerId
1327
- );
1328
- if (!l)
1329
- return `Could not find target layer with ID: ${e.layerId}`;
1330
- let s;
1331
- if (o) {
1332
- const p = await H(o, t);
1333
- if ("error" in p)
1334
- return p.error;
1335
- s = p.geometry;
1336
- }
1337
- if (l.featureEffect = null, l.featureEffect = new nt({
1338
- filter: new Se({
1339
- ...e.objectIds?.length ? { objectIds: e.objectIds } : { where: e.where },
1340
- geometry: s,
1341
- spatialRelationship: "intersects",
1342
- distance: o?.distance,
1343
- units: o?.units
1344
- }),
1345
- includedEffect: r,
1346
- excludedEffect: a
1347
- }), l.visible = !0, n)
1348
- return `Applied feature effects to "${l.title ?? e.layerId}" within current map extent.`;
1349
- const c = e.objectIds?.length ? `${l.objectIdField} IN (${e.objectIds.join(",")})` : e.where, u = await ta(
1350
- t,
1351
- e.layerId,
1352
- c,
1353
- s,
1354
- o?.distance,
1355
- o?.units
1356
- ), d = l.title ?? e.layerId;
1357
- return u.success ? `Applied feature effects to target layer "${l.title ?? e.layerId}"${o && "layerId" in o ? ` using geometry from layer "${o.layerId}"` : ""}.` : `Applied filter to "${d}" but no features matched. ${u.error}`;
1358
- }, aa = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], I = i.enum(aa), oa = async ({
1359
- targetLayer: e,
1360
- geometryFilter: t,
1361
- useCurrentExtent: r,
1362
- includedEffect: a = "drop-shadow(2px, 2px, 2px, gray)",
1363
- excludedEffect: o = "grayscale(100%) opacity(60%) blur(2px)"
1364
- }, n) => {
1365
- const { mapView: l } = F(n);
1366
- return await ra(e, l, a, o, t, r);
1367
- }, na = i.object({
1368
- layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
1369
- where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
1370
- distance: i.number().optional().describe("The buffer distance around the geometry."),
1371
- units: I.optional().describe("The units for the distance buffer.")
1372
- }), ia = i.object({
1373
- point: i.object({
1374
- x: i.number().describe("X coordinate (longitude) from navigation result"),
1375
- y: i.number().describe("Y coordinate (latitude) from navigation result"),
1376
- spatialReference: i.object({
1377
- wkid: i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1378
- }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1379
- }).describe("Point coordinates from a previous navigation/geocoding result"),
1380
- distance: i.number().optional().describe("Optional buffer distance around the point."),
1381
- units: I.optional().describe("The units for the distance buffer.")
1382
- }), sa = i.object({
1383
- targetLayer: i.object({
1384
- layerId: i.string().describe("The layerId of the layer on which to set a feature effect."),
1385
- where: i.string().describe("The SQL-92 where clause representing the features to emphasize."),
1386
- objectIds: i.array(i.number()).optional().describe(
1387
- "Array of objectIds from a previous query result. Use this instead of a where clause when the query returned objectIds (e.g. top N results). If provided, takes precedence over where clause."
1388
- )
1389
- }),
1390
- geometryFilter: i.union([na, ia]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
1391
- useCurrentExtent: i.boolean().optional().describe(
1392
- "Set to true when the previous query used the current map extent as a spatial filter. This ensures the feature effect applies only to features visible in the current view. Default is false."
1393
- ),
1394
- includedEffect: i.string().default("drop-shadow(2px, 2px, 2px, gray)").describe(
1395
- "The effect applied to features that meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified."
1396
- ),
1397
- excludedEffect: i.string().default("grayscale(100%) opacity(60%) blur(2px)").describe(
1398
- "The effect applied to features that do not meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified."
1399
- )
1400
- }), la = f(oa, {
1401
- name: "setFeatureEffect",
1402
- description: "Sets a feature effect on a given layer with given filter parameters and feature effects to emphasize certain features that meet a filter requirement. If no feature effect information is provided, then use the default effect provided.",
1403
- schema: sa
1404
- }), re = (e) => {
1405
- if (e instanceof Date)
1406
- return Number.isNaN(e.getTime()) ? null : e;
1407
- if (typeof e == "number" && Number.isFinite(e)) {
1408
- const t = new Date(e);
1409
- return Number.isNaN(t.getTime()) ? null : t;
1410
- }
1411
- return null;
1412
- }, ca = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, ua = (e) => {
1413
- if (typeof e == "string" && e)
1414
- return e;
1415
- const t = re(e);
1416
- return t ? t.toISOString().slice(0, 10) : null;
1417
- }, Kn = () => {
1418
- 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}`;
1419
- return { userTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone, userTimezoneOffset: o };
1420
- }, da = (e, t, r) => {
1421
- const a = t?.toLowerCase();
1422
- if (a === "date-only") {
1423
- const n = ua(e);
1424
- return n ? st(n, Q("short-date")) : e;
1425
- }
1426
- if (a === "time-only") {
1427
- if (typeof e == "string" && e)
1428
- return lt(e, Q("long-time"));
1429
- const n = re(e);
1430
- return n ? fe(n, {
1431
- ...Q("long-time"),
1432
- timeZone: "UTC"
1433
- }) : e;
1434
- }
1435
- const o = re(e);
1436
- return o ? fe(o, {
1437
- ...Q("short-date-short-time"),
1438
- timeZone: ca(r)
1439
- }) : e;
1440
- }, $e = (e, t, r) => {
1441
- if (e && typeof e != "function") {
1442
- const a = "getField" in r && r.getField?.(e), o = a && "getFieldDomain" in r && r.getFieldDomain ? r.getFieldDomain(a.name) : null;
1443
- if (o?.type === "coded-value") {
1444
- const l = o.codedValues.find((s) => s.code === t);
1445
- return l ? l.name : null;
1446
- }
1447
- }
1448
- return null;
1449
- }, pa = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, ha = (e) => {
1450
- if (e instanceof Date)
1451
- return Number.isNaN(e.getTime()) ? null : e;
1452
- if (typeof e == "number" && Number.isFinite(e)) {
1453
- const t = new Date(e);
1454
- return Number.isNaN(t.getTime()) ? null : t;
1455
- }
1456
- if (typeof e == "string" && e) {
1457
- const t = new Date(e);
1458
- return Number.isNaN(t.getTime()) ? null : t;
1459
- }
1460
- return null;
1461
- }, ma = (e, t) => {
1462
- if (typeof e != "number")
1463
- return e;
1464
- const r = {};
1465
- 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);
1466
- try {
1467
- return new Intl.NumberFormat(void 0, r).format(e);
1468
- } catch {
1469
- return e;
1470
- }
1471
- }, ya = (e, t, r) => {
1472
- const a = ha(e);
1473
- if (!a)
1474
- return e;
1475
- const o = {};
1476
- 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 = pa(r);
1477
- try {
1478
- return new Intl.DateTimeFormat(void 0, o).format(a);
1479
- } catch {
1480
- return e;
1481
- }
1482
- }, Ce = (e, t) => e.getFieldAlias?.(t) ?? e.fieldsIndex?.get(t)?.alias ?? e.fieldsIndex?.get(t)?.name ?? t, Ee = (e, t, r, a, o) => {
1483
- if (r == null)
1484
- return r;
1485
- const l = e.getFieldConfiguration?.(t)?.fieldFormat;
1486
- return l?.type === "number" ? ma(r, l) : l?.type === "date-time" ? ya(r, l, o) : da(r, a, o);
1487
- }, fa = (e, t, r, a) => {
1488
- const o = e.fieldsIndex?.get(t), n = $e(t, r, e) ?? r;
1489
- return Ee(e, t, n, o?.type, a);
1490
- }, ga = (e, t) => Ce(e, t), Ne = (e, t, r) => {
1491
- const a = e.objectIdField, o = t.features.map(
1492
- (l) => l.attributes[a]
1493
- ), n = t.features.map((l) => {
1494
- const s = l.attributes, c = {};
1495
- return e.fields.forEach((u) => {
1496
- if (!Object.hasOwn(s, u.name))
1497
- return;
1498
- const d = s[u.name];
1499
- if (u.name === a) {
1500
- c[u.name] = d;
1501
- return;
1502
- }
1503
- const p = $e(u.name, d, e) ?? d, h = Ce(e, u.name);
1504
- c[h] = Ee(e, u.name, p, u.type, r);
1505
- }), c;
1506
- });
1507
- return { objectIds: o, attributes: n };
1508
- }, wa = (e, t, r) => {
1509
- const a = e.createQuery();
1510
- return a.outFields = [t], a.where = r || "1=1", a.num = 1, a;
1511
- }, ba = async (e, t, r, a) => {
1512
- const o = a.map?.allLayers.find((h) => h.id === e), n = wa(o, t, r.where), s = (await o.queryFeatures(n)).features[0], c = s ? s.attributes[t] : null, u = fa(o, t, c, a.timeZone), d = ga(o, t);
1513
- return {
1514
- tool: "getAttribute",
1515
- layerName: o.title ?? e,
1516
- summary: `${d} = ${u}`,
1517
- details: {
1518
- fieldName: t,
1519
- fieldAlias: d !== t ? d : void 0,
1520
- value: u,
1521
- where: r.where
1522
- }
1523
- };
1524
- };
1525
- async function Ta({ layerId: e, fieldName: t, query: r }, a) {
1526
- const { mapView: o } = F(a), n = await ba(e, t, r, o);
1527
- return JSON.stringify(n, null, 2);
1528
- }
1529
- const va = i.object({
1530
- layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1531
- fieldName: i.string().describe("The name of the field/attribute from which to get a field value."),
1532
- query: i.object({
1533
- where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1534
- })
1535
- }), Sa = f(Ta, {
1536
- name: "getAttribute",
1537
- description: "Returns an attribute value for a given feature.",
1538
- schema: va
1539
- }), ce = (e, t, r) => r ? e.hasAllFeaturesInView && e.availableFields === t : e.hasAllFeatures && e.availableFields === t;
1540
- function K(e, t) {
1541
- let r = e ?? "";
1542
- return t != null && t && (r = r ? `(${r}) AND (${t})` : t), r || null;
1543
- }
1544
- const xa = async (e) => {
1545
- const { targetLayer: t, fieldName: r, statisticType: a, mapView: o, layersAndFieldsRegistry: n, geometryFilter: l } = e, s = o.map?.allLayers.find((v) => v.id === t.layerId);
1546
- if (!s)
1547
- throw new Error(`Layer '${t.layerId}' not found.`);
1548
- const c = await o.whenLayerView(s), d = n.get(t.layerId)?.fieldRegistry.get(r), p = d?.alias;
1549
- if (!d)
1550
- throw new Error(`Field '${r}' not found.`);
1551
- let h, y;
1552
- if (l) {
1553
- const v = await H(l, o);
1554
- if ("error" in v)
1555
- throw new Error(v.error);
1556
- if (!v.geometry)
1557
- throw j(l) ? new Error(`No features found matching: ${l.where}`) : new Error("Failed to create geometry");
1558
- if (j(l)) {
1559
- const M = o.map?.allLayers.find((P) => P.id === l.layerId);
1560
- h = {
1561
- geometryLayerName: M?.title ?? M?.id,
1562
- geometryLayerId: l.layerId,
1563
- geometryWhere: l.where,
1564
- distance: l.distance,
1565
- units: l.units,
1566
- applied: !0
1567
- };
1568
- } else U(l) && (h = {
1569
- point: l.point,
1570
- distance: l.distance,
1571
- units: l.units,
1572
- applied: !0
1573
- });
1574
- y = new Se({
1575
- geometry: v.geometry,
1576
- distance: l.distance,
1577
- units: l.units,
1578
- spatialRelationship: "intersects"
1579
- });
1580
- }
1581
- const g = ce(c, [r], !1);
1582
- let m = null, w = null;
1583
- const T = 10;
1584
- if (d.type !== "geometry" && d.type !== "oid" && d.type !== "global-id")
1585
- try {
1586
- const v = {
1587
- layer: s,
1588
- useFeaturesInView: g,
1589
- view: g ? o : void 0,
1590
- field: r,
1591
- sqlWhere: K(s.definitionExpression, t.where),
1592
- ...y && { filter: y },
1593
- outStatisticTypes: { include: [a] }
1594
- };
1595
- m = await ct(v);
1596
- const M = ["string", "small-integer", "integer"], P = d.domain?.type === "coded-value" ? d.domain : null;
1597
- (M.includes(d.type) || P) && (w = (await ut({
1598
- layer: s,
1599
- useFeaturesInView: g,
1600
- view: g ? o : void 0,
1601
- field: r,
1602
- sqlWhere: K(s.definitionExpression, t.where),
1603
- ...y && { filter: y }
1604
- })).uniqueValueInfos.sort((z, ze) => ze.count - z.count).slice(0, T)), w && d.domain?.type === "coded-value" && (w = w.map((z) => ({
1605
- ...z,
1606
- value: P ? P.getName(z.value) ?? z.value : z.value
1607
- })));
1608
- } catch (v) {
1609
- console.error("Statistics error:", v);
1610
- }
1611
- return {
1612
- tool: "getStatistics",
1613
- layerName: s.title ?? t.layerId,
1614
- summary: `${a} = ${typeof m?.[a] == "number" ? m[a] : "N/A"}`,
1615
- details: {
1616
- fieldName: r,
1617
- fieldAlias: p,
1618
- statisticType: a,
1619
- statistic: m?.[a] ?? null,
1620
- summaryStatistics: m,
1621
- uniqueValues: w,
1622
- where: t.where,
1623
- spatialFilterInfo: h
1624
- }
1625
- };
1626
- };
1627
- async function Ra({
1628
- targetLayer: e,
1629
- fieldName: t,
1630
- statisticType: r,
1631
- geometryFilter: a
1632
- }, o) {
1633
- const n = Re(o, "layersAndFieldsRegistry"), { mapView: l } = F(o), s = await xa({
1634
- targetLayer: e,
1635
- fieldName: t,
1636
- statisticType: r,
1637
- mapView: l,
1638
- layersAndFieldsRegistry: n,
1639
- geometryFilter: a
1640
- });
1641
- return JSON.stringify(s, null, 2);
1642
- }
1643
- const $a = i.object({
1644
- layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
1645
- where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
1646
- distance: i.number().optional().describe("The buffer distance around the geometry."),
1647
- units: I.optional().describe("The units for the distance buffer.")
1648
- }), Ca = i.object({
1649
- point: i.object({
1650
- x: i.number().describe("X coordinate (longitude) from navigation result"),
1651
- y: i.number().describe("Y coordinate (latitude) from navigation result"),
1652
- spatialReference: i.object({
1653
- wkid: i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1654
- }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1655
- }).describe("Point coordinates from a previous navigation/geocoding result"),
1656
- distance: i.number().optional().describe("Optional buffer distance around the point."),
1657
- units: I.optional().describe("The units for the distance buffer.")
1658
- }), Ea = i.object({
1659
- targetLayer: i.object({
1660
- layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1661
- where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1662
- }),
1663
- geometryFilter: i.union([$a, Ca]).optional().describe(
1664
- "Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."
1665
- ),
1666
- fieldName: i.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
1667
- statisticType: i.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
1668
- }), Na = f(Ra, {
1669
- name: "getStatistics",
1670
- description: `Computes a single aggregate statistic (max, min, avg, sum, median, stddev, variance) for a numeric field across matching features. Also returns frequency analysis for categorical fields.
1671
-
1672
- USE THIS TOOL FOR:
1673
- - "What is the average/maximum/minimum/total [field]?" — aggregate computations
1674
- - "Most common/frequent value of [field]?" — frequency analysis
1675
- - Questions requiring a mathematical aggregation across many features
1676
-
1677
- DO NOT USE FOR:
1678
- - "How many features match X?" — use queryFeatures instead (it returns totalCount)
1679
- - "Show / list / find features" — use queryFeatures instead
1680
- - Simple counts of features matching a condition — use queryFeatures instead
1681
-
1682
- Only call this tool when the answer requires computing an aggregate (avg, max, min, sum, median, stddev) over a field's values, not just counting or listing features.`,
1683
- schema: Ea
1684
- }), Ia = async (e, t, r, a, o) => {
1685
- const n = r.map?.allLayers.find((h) => h.id === e.layerId), l = await r.whenLayerView(n), s = n.title ?? e.layerId;
1686
- let c;
1687
- if (a) {
1688
- const h = await H(a, r);
1689
- if ("error" in h)
1690
- return {
1691
- tool: "getTopFeatures",
1692
- layerName: s,
1693
- summary: "Geometry lookup failed",
1694
- details: { error: h.error }
1695
- };
1696
- if (!h.geometry)
1697
- return {
1698
- tool: "getTopFeatures",
1699
- layerName: s,
1700
- summary: "No features found for geometry filter",
1701
- details: {
1702
- error: `No features found matching: ${"where" in a ? a.where : "unknown criteria"}`
1703
- }
1704
- };
1705
- c = h.geometry;
1706
- } else o && (c = r.extent.clone());
1707
- const u = t.groupByFields && t.groupByFields.length > 0, d = n.objectIdField, p = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, d])];
1708
- try {
1709
- let h;
1710
- if (u) {
1711
- const m = new dt({
1712
- where: e.where || "1=1",
1713
- outFields: p,
1714
- orderByFields: e.orderByFields,
1715
- geometry: c,
1716
- spatialRelationship: c ? "intersects" : void 0,
1717
- distance: a?.distance,
1718
- units: a?.units,
1719
- topFilter: new pt({
1720
- topCount: t.topCount,
1721
- groupByFields: t.groupByFields,
1722
- orderByFields: t.orderByFields
1723
- })
1724
- });
1725
- h = await n.queryTopFeatures(m);
1726
- } else {
1727
- const m = n.createQuery();
1728
- m.where = K(n.definitionExpression, e.where || "1=1"), m.outFields = p.length ? p : ["*"], m.orderByFields = t.orderByFields, m.num = t.topCount, c && (m.geometry = c, m.spatialRelationship = "intersects"), a?.distance && (m.distance = a.distance), a?.units && (m.units = a.units), m.outSpatialReference = r.spatialReference;
1729
- const w = ce(l, e.outFields, o ?? !1);
1730
- try {
1731
- h = w ? await l.queryFeatures(m) : await n.queryFeatures(m);
1732
- } catch (T) {
1733
- console.warn("Client-side query failed, falling back to server:", T), h = await n.queryFeatures(m);
1734
- }
1735
- }
1736
- const y = h.features.map((m) => m.attributes[d]), { attributes: g } = Ne(n, h, r.timeZone);
1737
- return {
1738
- tool: "getTopFeatures",
1739
- layerName: s,
1740
- summary: `Top ${t.topCount} features extracted`,
1741
- details: {
1742
- topCount: t.topCount,
1743
- attributes: g,
1744
- objectIds: y,
1745
- objectIdField: d,
1746
- where: e.where,
1747
- orderByFields: t.orderByFields,
1748
- ...u && { groupByFields: t.groupByFields }
1749
- }
1750
- };
1751
- } catch (h) {
1752
- return {
1753
- tool: "getTopFeatures",
1754
- layerName: s,
1755
- summary: "Query failed",
1756
- details: { error: h instanceof Error ? h.message : String(h) }
1757
- };
1758
- }
1759
- }, ka = async ({
1760
- targetLayer: e,
1761
- topFilter: t,
1762
- geometryFilter: r,
1763
- useCurrentExtent: a
1764
- }, o) => {
1765
- const { mapView: n } = F(o), l = await Ia(e, t, n, r, a);
1766
- return JSON.stringify(l, null, 2);
1767
- }, Fa = i.object({
1768
- layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
1769
- where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
1770
- distance: i.number().optional().describe("The buffer distance around the geometry."),
1771
- units: I.optional().describe("The units for the distance buffer.")
1772
- }), za = i.object({
1773
- point: i.object({
1774
- x: i.number().describe("X coordinate (longitude) from navigation result"),
1775
- y: i.number().describe("Y coordinate (latitude) from navigation result"),
1776
- spatialReference: i.object({
1777
- wkid: i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1778
- }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1779
- }).describe("Point coordinates from a previous navigation/geocoding result"),
1780
- distance: i.number().optional().describe("Optional buffer distance around the point."),
1781
- units: I.optional().describe("The units for the distance buffer.")
1782
- }), qa = i.object({
1783
- targetLayer: i.object({
1784
- layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1785
- where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
1786
- orderByFields: i.array(i.string().describe("The field(s) and order for which to sort the resulting features.")),
1787
- outFields: i.array(
1788
- i.string().describe(
1789
- 'The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").'
1790
- ).default("*")
1791
- )
1792
- }),
1793
- geometryFilter: i.union([Fa, za]).optional().describe(
1794
- "Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."
1795
- ),
1796
- topFilter: i.object({
1797
- topCount: i.number().describe("Number of top features to return per group."),
1798
- orderByFields: i.array(
1799
- i.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")
1800
- ),
1801
- groupByFields: i.array(i.string().describe("Field(s) to group results by. Returns top N per group."))
1802
- }).required(),
1803
- useCurrentExtent: i.boolean().optional().describe(
1804
- "Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at'. Default is false (queries entire layer)."
1805
- )
1806
- }), Da = f(ka, {
1807
- name: "getTopFeatures",
1808
- description: 'Returns top N features ranked by an existing field value. Use for "highest", "lowest", "top N" questions where ranking is based on a field that already exists in the data (e.g., population, value, date, depth). orderByFields must be actual field names with ASC/DESC. Do NOT use aggregate functions like COUNT(), SUM(), AVG() - those require getStatistics.',
1809
- schema: qa
1810
- }), ee = 25, Aa = async (e, t, r, a) => {
1811
- const o = t.map?.allLayers.find((m) => m.id === e.layerId), n = await t.whenLayerView(o), l = o.title ?? e.layerId;
1812
- let s;
1813
- if (r) {
1814
- const m = await H(r, t);
1815
- if ("error" in m) {
1816
- const w = { error: m.error };
1817
- if (j(r)) {
1818
- const T = t.map?.allLayers.find((C) => C.id === r.layerId);
1819
- w.geometryLayerName = T?.title ?? T?.id, w.geometryLayerId = r.layerId, w.geometryWhere = r.where;
1820
- } else U(r) && (w.point = r.point);
1821
- return {
1822
- tool: "queryFeatures",
1823
- layerName: l,
1824
- summary: "Geometry lookup failed",
1825
- details: w
1826
- };
1827
- }
1828
- if (!m.geometry) {
1829
- const w = {};
1830
- if (j(r)) {
1831
- const T = t.map?.allLayers.find((C) => C.id === r.layerId);
1832
- w.error = `No features found matching: ${r.where}`, w.geometryLayerName = T?.title ?? T?.id, w.geometryLayerId = r.layerId, w.geometryWhere = r.where;
1833
- } else U(r) && (w.error = "Failed to create point geometry", w.point = r.point);
1834
- return {
1835
- tool: "queryFeatures",
1836
- layerName: l,
1837
- summary: "No features found for geometry filter",
1838
- details: w
1839
- };
1840
- }
1841
- s = m.geometry;
1842
- } else a && (s = t.extent.clone());
1843
- const c = ce(n, e.outFields, a ?? !1), u = o.objectIdField, d = o.createQuery();
1844
- d.where = K(o.definitionExpression, e.where || "1=1"), d.outFields = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, u])], d.orderByFields = e.orderByFields, s && (d.geometry = s, d.spatialRelationship = "intersects"), r?.distance && (d.distance = r.distance), r?.units && (d.units = r.units), d.outSpatialReference = t.spatialReference;
1845
- let p, h;
1846
- try {
1847
- p = c ? await n.queryFeatureCount(d) : await o.queryFeatureCount(d), p > 0 && p <= ee && (h = c ? await n.queryFeatures(d) : await o.queryFeatures(d));
1848
- } catch (m) {
1849
- console.warn("Client-side query failed, falling back to server:", m), p = await o.queryFeatureCount(d), p > 0 && p <= ee && (h = await o.queryFeatures(d));
1850
- }
1851
- const { objectIds: y, attributes: g } = h ? Ne(o, h, t.timeZone) : { objectIds: void 0, attributes: void 0 };
1852
- return {
1853
- tool: "queryFeatures",
1854
- layerName: l,
1855
- summary: `${p} features found`,
1856
- details: {
1857
- totalCount: p,
1858
- where: e.where,
1859
- orderByFields: e.orderByFields,
1860
- outFields: e.outFields,
1861
- ...y && { objectIds: y, objectIdField: u },
1862
- ...g && { attributes: g },
1863
- ...p > ee && {
1864
- note: `${p} features found.`
1865
- }
1866
- }
1867
- };
1868
- };
1869
- async function Pa({
1870
- targetLayer: e,
1871
- geometryFilter: t,
1872
- useCurrentExtent: r
1873
- }, a) {
1874
- const { mapView: o } = F(a), n = await Aa(e, o, t, r);
1875
- return JSON.stringify(n, null, 2);
1876
- }
1877
- const La = i.object({
1878
- layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
1879
- where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
1880
- distance: i.number().optional().describe("The buffer distance around the geometry."),
1881
- units: I.optional().describe("The units for the distance buffer.")
1882
- }), ja = i.object({
1883
- point: i.object({
1884
- x: i.number().describe("X coordinate (longitude) from navigation result"),
1885
- y: i.number().describe("Y coordinate (latitude) from navigation result"),
1886
- spatialReference: i.object({
1887
- wkid: i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1888
- }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1889
- }).describe("Point coordinates from a previous navigation/geocoding result"),
1890
- distance: i.number().optional().describe("Optional buffer distance around the point."),
1891
- units: I.optional().describe("The units for the distance buffer.")
1892
- }), Ga = i.object({
1893
- targetLayer: i.object({
1894
- layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1895
- where: i.string().describe(
1896
- "SQL-92 where clause. IMPORTANT: When using geometryFilter.point for point-in-polygon queries, set this to '1=1' to return all features that intersect the point. Only add attribute filters if the user specifically requests them in addition to the spatial query."
1897
- ),
1898
- orderByFields: i.array(i.string().describe("The field(s) and order for which to sort the resulting features.")),
1899
- outFields: i.array(
1900
- i.string().describe(
1901
- 'The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").'
1902
- ).default("*")
1903
- )
1904
- }),
1905
- geometryFilter: i.union([La, ja]).optional().describe(
1906
- "Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."
1907
- ),
1908
- useCurrentExtent: i.boolean().optional().describe(
1909
- "Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at', OR when the user refers back to features previously identified using the current extent (e.g. 'these', 'those', 'them', 'the same ones'). Default is false (queries entire layer)."
1910
- )
1911
- }), Oa = f(Pa, {
1912
- name: "queryFeatures",
1913
- description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
1914
-
1915
- USE THIS TOOL FOR:
1916
- - "Show / display / list features where..." — finding and listing features
1917
- - "How many X are Y?" — counting features that match a condition
1918
- - "Which features..." / "Find features..." — identifying specific features
1919
- - Spatial queries — finding features near/within/intersecting other features
1920
- - Any question where the user wants to SEE or COUNT matching features
1921
-
1922
- This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1923
- schema: Ga
1924
- }), Ma = [Sa, Na, Da, Oa], Bn = [la, ea, Zr], Qa = new ot(Ma, { handleToolErrors: !1 });
1925
- async function Hn(e, t) {
1926
- const { messages: r } = await Qa.invoke({ messages: e.dataExplorationMessages }, t), a = [], o = [];
1927
- for (const n of r) {
1928
- const l = n.content;
1929
- let s;
1930
- typeof l != "string" && (s = {
1931
- tool: n.name ?? "unknown",
1932
- layerName: "unknown",
1933
- summary: "Query failed",
1934
- details: { error: "Skipping non-string tool output:", raw: l }
1935
- });
1936
- try {
1937
- typeof l == "string" ? s = JSON.parse(l) : s = {
1938
- tool: n.name ?? "unknown",
1939
- layerName: "unknown",
1940
- summary: "Query failed",
1941
- details: { error: "Invalid tool output type", raw: l }
1942
- };
1943
- } catch {
1944
- s = {
1945
- tool: n.name ?? "unknown",
1946
- layerName: "unknown",
1947
- summary: "Query failed",
1948
- details: { error: l }
1949
- };
1950
- }
1951
- a.push(s), s.details && typeof s.details == "object" && "error" in s.details ? o.push(`- ${s.tool}: Error - ${String(s.details.error)}`) : o.push(`- ${s.layerName}: ${s.summary}`);
1952
- }
1953
- return await S({ text: `Finished executing layer query tool: ${o.join(", ")}` }, t), {
1954
- ...e,
1955
- dataExplorationMessages: [...e.dataExplorationMessages, ...r],
1956
- queryResponse: a,
1957
- status: "success",
1958
- summary: o.length > 0 ? Vt(o.join(`
1959
- `)) : "Query executed."
1960
- };
1961
- }
1962
- const Jn = b.Root({
1963
- ...B(),
1012
+ schema: Br
1013
+ }), Fa = y.Root({
1014
+ ...G(),
1015
+ vectorSearchLayerIds: y(),
1016
+ vectorSearchFieldResults: y(),
1017
+ layerFieldInfo: y(),
1018
+ selectedLayerId: y()
1019
+ }), _a = y.Root({
1020
+ ...G(),
1964
1021
  // internal to the help agent
1965
- helpInternalState: b({
1966
- reducer: L,
1022
+ helpInternalState: y({
1023
+ reducer: k,
1967
1024
  default: () => ({
1968
1025
  toolCallMessage: void 0
1969
1026
  })
1970
1027
  })
1971
- }), _a = (e, t) => {
1972
- const r = Array.from(e.values()).find(
1973
- ({ layerItem: n }) => n.title?.toLowerCase().includes(t.toLowerCase())
1974
- );
1975
- if (!r) {
1976
- const n = Array.from(e.values()).map((l) => l.layerItem.title).join(", ");
1977
- return `Could not find a layer matching "${t}". Available layers: ${n}`;
1978
- }
1979
- const a = Array.from(r.fieldRegistry.values()), o = a.map((n) => `- **${n.alias || n.name}** (\`${n.name}\`, ${n.type})${n.description ? `: ${n.description}` : ""}`).join(`
1980
- `);
1981
- return `**${r.layerItem.title}** has ${a.length} field(s):
1982
-
1983
- ${o}`;
1984
- }, Wa = async ({ layerTitle: e }, t) => {
1985
- const r = Re(t, "layersAndFieldsRegistry");
1986
- return _a(r, e);
1987
- }, Zn = f(Wa, {
1988
- name: "listLayerFields",
1989
- description: "Lists all fields for a given layer by title. Use ONLY when the user explicitly asks to see fields, columns, or attributes of a specific named layer. Do NOT call this tool for general help questions, capability overviews, or layer listing.",
1990
- schema: i.object({
1991
- layerTitle: i.string().describe("The title or partial title of the layer to list fields for.")
1992
- })
1993
- }), Yn = b.Root({
1994
- ...B(),
1995
- intent: b({
1028
+ }), Qa = y.Root({
1029
+ ...G(),
1030
+ intent: y({
1996
1031
  reducer: (e, t) => t
1997
1032
  }),
1998
- arcgisKnowledgeMessages: b({
1999
- reducer: Te,
1033
+ arcgisKnowledgeMessages: y({
1034
+ reducer: ee,
2000
1035
  default: () => []
2001
1036
  }),
2002
- arcgisKnowledgeToolResult: b({
1037
+ arcgisKnowledgeToolResult: y({
2003
1038
  reducer: (e, t) => t,
2004
1039
  default: () => null
2005
1040
  })
2006
- }), _ = {
2007
- conversationId: ""
2008
- };
2009
- function ue(e) {
1041
+ });
1042
+ function B(e) {
2010
1043
  const t = e.map?.allLayers.filter((r) => r.type === "knowledge-graph");
2011
1044
  if (!t || t?.length !== 1)
2012
1045
  throw new Error("The Knowledge Agent currently only supports maps with exactly one Knowledge Graph Layer.");
2013
1046
  }
2014
- function N(e) {
2015
- return !!e?.map && !("activeLinkChartLayer" in e.map);
1047
+ function x(e) {
1048
+ return !!e?.map && "activeLinkChartLayer" in e.map;
2016
1049
  }
2017
- async function J(e) {
2018
- !e || N(e) || !e.map?.diagramNodesExtent || await e.goTo(e.map.diagramNodesExtent);
1050
+ async function j(e) {
1051
+ !x(e) || !e.map.diagramNodesExtent || await e.goTo(e.map.diagramNodesExtent);
2019
1052
  }
2020
- function Z(e) {
1053
+ function N(e) {
2021
1054
  const r = e?.configurable?.context;
2022
1055
  if (!r || typeof r != "object")
2023
1056
  throw new Error("ArcgisKnowledgeAgent context missing");
2024
1057
  if (!("view" in r))
2025
1058
  throw new Error("View context missing");
2026
1059
  const a = r.view;
2027
- return a.map && !("activeLinkChartLayer" in a.map) && ue(a), {
1060
+ return a.map && !("activeLinkChartLayer" in a.map) && B(a), {
2028
1061
  view: a
2029
1062
  };
2030
1063
  }
2031
- function Xn(e) {
1064
+ function Ia(e) {
2032
1065
  const r = e?.configurable?.context;
2033
- if (Ie(e) === "knowledgeGraph")
1066
+ if (te(e) === "knowledgeGraph")
2034
1067
  return "knowledgeGraph";
2035
1068
  const o = r.view;
2036
- return N(o) ? (ue(o), "map") : "linkChart";
1069
+ return x(o) ? "linkChart" : (B(o), "map");
2037
1070
  }
2038
- async function O(e) {
1071
+ async function q(e) {
2039
1072
  const r = e?.configurable?.context;
2040
- if (Ie(e) === "knowledgeGraph")
1073
+ if (te(e) === "knowledgeGraph")
2041
1074
  return r;
2042
1075
  {
2043
1076
  const o = r.view.map;
2044
1077
  if (o && "activeLinkChartLayer" in o) {
2045
- const n = o.knowledgeGraph?.url;
2046
- if (!n)
1078
+ const i = o.knowledgeGraph?.url;
1079
+ if (!i)
2047
1080
  throw new Error("Knowledge graph url missing from link chart.");
2048
1081
  return {
2049
- knowledgeGraph: await ge(n)
1082
+ knowledgeGraph: await Y(i)
2050
1083
  };
2051
1084
  } else {
2052
- ue(r.view);
2053
- const l = (r.view.map?.allLayers.find(
2054
- (c) => c.type === "knowledge-graph"
1085
+ B(r.view);
1086
+ const s = (r.view.map?.allLayers.find(
1087
+ (l) => l.type === "knowledge-graph"
2055
1088
  )).url;
2056
- if (!l)
1089
+ if (!s)
2057
1090
  throw new Error("Knowledge graph url missing from map.");
2058
1091
  return {
2059
- knowledgeGraph: await ge(l)
1092
+ knowledgeGraph: await Y(s)
2060
1093
  };
2061
1094
  }
2062
1095
  }
2063
1096
  }
2064
- function Ie(e) {
1097
+ function te(e) {
2065
1098
  const r = e?.configurable?.context;
2066
1099
  if (!r || typeof r != "object")
2067
1100
  throw new Error("ArcgisKnowledgeAgent context missing");
@@ -2073,12 +1106,12 @@ function Ie(e) {
2073
1106
  return "view";
2074
1107
  throw new Error("ArcgisKnowledgeAgent context must have either a view or knowledgeGraph property.");
2075
1108
  }
2076
- class Va {
1109
+ class Wr {
2077
1110
  constructor(t) {
2078
- this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = de.fromDataModel(t);
1111
+ this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = W.fromDataModel(t);
2079
1112
  }
2080
1113
  }
2081
- class de {
1114
+ class W {
2082
1115
  constructor() {
2083
1116
  this.schemaType = "ArcgisGraphSchema", this.entityTypes = [], this.relationshipTypes = [], this.identifierInfo = {
2084
1117
  mappingInfo: {
@@ -2088,14 +1121,14 @@ class de {
2088
1121
  };
2089
1122
  }
2090
1123
  static fromDataModel(t) {
2091
- const r = new de();
1124
+ const r = new W();
2092
1125
  for (const a of t.entityTypes)
2093
- r.entityTypes.push(G.fromEntityType(a));
1126
+ r.entityTypes.push(A.fromEntityType(a));
2094
1127
  for (const a of t.relationshipTypes)
2095
- r.relationshipTypes.push(Ua.fromRelationshipType(a));
1128
+ r.relationshipTypes.push(Ur.fromRelationshipType(a));
2096
1129
  return r.identifierInfo = {
2097
1130
  mappingInfo: {
2098
- identifierMapsTo: Ka(
1131
+ identifierMapsTo: Hr(
2099
1132
  t.identifierInfo.identifierMappingInfo.identifierInfoType
2100
1133
  ),
2101
1134
  identifierPropertyName: t.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName
@@ -2109,19 +1142,19 @@ class de {
2109
1142
  Relationship Types: ${a}.`;
2110
1143
  }
2111
1144
  }
2112
- class G {
1145
+ class A {
2113
1146
  constructor() {
2114
1147
  this.name = "", this.properties = [];
2115
1148
  }
2116
1149
  static fromEntityType(t) {
2117
- const r = new G();
2118
- r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = Ba(t.role);
1150
+ const r = new A();
1151
+ r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = Jr(t.role);
2119
1152
  for (const a of t.properties) {
2120
1153
  const o = {
2121
1154
  name: a.name,
2122
1155
  alias: a.alias ? a.alias : void 0,
2123
1156
  fieldType: a.fieldType,
2124
- role: Ha(a.role),
1157
+ role: Xr(a.role),
2125
1158
  geometryDef: a.fieldType === "esriFieldTypeGeometry" ? {
2126
1159
  geometryType: a.geometryType ?? "esriGeometryAny",
2127
1160
  hasM: a.hasM ? a.hasM : void 0,
@@ -2133,12 +1166,12 @@ class G {
2133
1166
  return r;
2134
1167
  }
2135
1168
  }
2136
- class Ua extends G {
1169
+ class Ur extends A {
2137
1170
  constructor() {
2138
1171
  super(...arguments), this.observedEndPoints = [];
2139
1172
  }
2140
1173
  static fromRelationshipType(t) {
2141
- const r = G.fromEntityType(t);
1174
+ const r = A.fromEntityType(t);
2142
1175
  r.observedEndPoints = [];
2143
1176
  for (const a of t.endPoints)
2144
1177
  r.observedEndPoints.push({
@@ -2148,7 +1181,7 @@ class Ua extends G {
2148
1181
  return r;
2149
1182
  }
2150
1183
  }
2151
- const Ka = (e) => {
1184
+ const Hr = (e) => {
2152
1185
  switch (e) {
2153
1186
  case "esriIdentifierInfoTypeUNSPECIFIED":
2154
1187
  return "UNSPECIFIED";
@@ -2159,7 +1192,7 @@ const Ka = (e) => {
2159
1192
  default:
2160
1193
  return e;
2161
1194
  }
2162
- }, Ba = (e) => {
1195
+ }, Jr = (e) => {
2163
1196
  switch (e) {
2164
1197
  case "Regular":
2165
1198
  return "esriGraphNamedObjectRegular";
@@ -2171,7 +1204,7 @@ const Ka = (e) => {
2171
1204
  return e;
2172
1205
  }
2173
1206
  };
2174
- function Ha(e) {
1207
+ function Xr(e) {
2175
1208
  switch (e) {
2176
1209
  case "esriGraphPropertyRegular":
2177
1210
  return "Regular";
@@ -2209,418 +1242,496 @@ function Ha(e) {
2209
1242
  return "Regular";
2210
1243
  }
2211
1244
  }
2212
- function Y(e) {
2213
- return e?.configurable?.abortSignal;
1245
+ function F(e) {
1246
+ return e?.signal;
2214
1247
  }
2215
- function Ja(e, t) {
2216
- return t ? `${e}
1248
+ async function Yr(e, t) {
1249
+ const r = await L("arcgis_knowledge_cypher_query_prompt");
1250
+ return t ? `${e} ${r}
2217
1251
 
2218
1252
  Your previous attempt to generate a cypher query failed. See the details below and generate a new cypher query that avoids this error.
2219
1253
 
2220
1254
  Attempt Number: ${t.attemptCount}
2221
1255
  Execution Error: ${t.executionError}
2222
1256
  Failed Query:
2223
- ${t.failedGraphQuery}` : e;
2224
- }
2225
- async function Za(e, t, r, a) {
2226
- const { graphQuery: o, explanation: n } = await pe(e, t, r, a);
2227
- return { graphQuery: o, explanation: n };
2228
- }
2229
- async function pe(e, t, r, a, o) {
2230
- const n = {
2231
- message: Ja(e, o),
2232
- context: new Va(t)
2233
- };
2234
- _.conversationId && (n.conversationId = _.conversationId);
2235
- const l = Y(a);
2236
- await S({ text: "Attempting to generate a cypher query from your prompt..." }, a);
2237
- const s = await me(`${r}/chat`, {
1257
+ ${t.failedGraphQuery}` : `${e} ${r}`;
1258
+ }
1259
+ async function Zr(e, t, r, a) {
1260
+ const { graphQuery: o, explanation: i } = await U(e, t, r, a);
1261
+ return { graphQuery: o, explanation: i };
1262
+ }
1263
+ async function U(e, t, r, a, o) {
1264
+ const i = {
1265
+ message: await Yr(e, o),
1266
+ context: new Wr(t)
1267
+ }, s = F(a);
1268
+ await T({ text: "Attempting to generate a cypher query from your prompt..." }, a);
1269
+ const n = await J(`${r}/chat`, {
2238
1270
  method: "post",
2239
- body: JSON.stringify(n),
1271
+ body: JSON.stringify(i),
2240
1272
  headers: {
2241
1273
  "Content-Type": "application/json",
2242
- token: he.findCredential(k.getDefault().url)?.token ?? ""
1274
+ "X-Esri-Authorization": `Bearer ${H.findCredential(P.getDefault().url)?.token ?? ""}`
2243
1275
  },
2244
- signal: l
1276
+ signal: s
2245
1277
  });
2246
- if (s.httpStatus !== 200)
2247
- throw new Error(`Graph query service returned an error: ${s.httpStatus}`, {
2248
- cause: s.data
1278
+ if (n.httpStatus !== 200)
1279
+ throw new Error(`Graph query service returned an error: ${n.httpStatus}`, {
1280
+ cause: n.data
2249
1281
  });
2250
- _.conversationId || (_.conversationId = s.data.conversationId);
2251
- let c = !1;
2252
- const u = Date.now();
2253
- let d = s.data.sequenceNumber, p = "", h = "", y = 1;
2254
- for (; !c; ) {
2255
- await new Promise((m) => setTimeout(m, 1e3)), await S(
2256
- { text: `Periodically requesting status of job from ArcGIS AI Services${"...".substring(0, y)}` },
1282
+ let l = !1;
1283
+ const p = Date.now();
1284
+ let d = n.data.sequenceNumber, u = "", h = "", f = 1;
1285
+ for (; !l; ) {
1286
+ await new Promise((w) => setTimeout(w, 1e3)), await T(
1287
+ { text: `Periodically requesting status of job from ArcGIS AI Services${"...".substring(0, f)}` },
2257
1288
  a
2258
- ), y = y % 3 + 1;
2259
- const g = await me(`${r}/chat`, {
1289
+ ), f = f % 3 + 1;
1290
+ const m = await J(`${r}/chat`, {
2260
1291
  method: "post",
2261
1292
  body: JSON.stringify({
2262
- conversationId: s.data.conversationId,
2263
- inquiryId: s.data.inquiryId,
1293
+ conversationId: n.data.conversationId,
1294
+ inquiryId: n.data.inquiryId,
2264
1295
  ackSequenceNumber: d
2265
1296
  }),
2266
1297
  headers: {
2267
1298
  "Content-Type": "application/json",
2268
- token: he.findCredential(k.getDefault().url)?.token ?? ""
1299
+ "X-Esri-Authorization": `Bearer ${H.findCredential(P.getDefault().url)?.token ?? ""}`
2269
1300
  },
2270
- signal: l
1301
+ signal: s
2271
1302
  });
2272
- if (g.httpStatus !== 200)
2273
- throw new Error(`Graph query service polling returned an error: ${g.httpStatus}`, {
2274
- cause: g.data
1303
+ if (m.httpStatus !== 200)
1304
+ throw new Error(`Graph query service polling returned an error: ${m.httpStatus}`, {
1305
+ cause: m.data
2275
1306
  });
2276
- if (g.data.context?.kind) {
2277
- if (g.data.context.kind !== "GraphQueryGenerationResponse")
2278
- throw new Error(`Unexpected response from graph query service polling. Message: ${g.data.message}`, {
2279
- cause: g.data
1307
+ if (m.data.context?.kind) {
1308
+ if (m.data.context.kind !== "GraphQueryGenerationResponse")
1309
+ throw new Error(`Unexpected response from graph query service polling. Message: ${m.data.message}`, {
1310
+ cause: m.data
2280
1311
  });
2281
- p = g.data.context.graphQuery, h = g.data.message || "", c = !0;
2282
- } else if (!g.data.hasMore)
2283
- c = !0;
2284
- else if (Date.now() - u > 6e4)
1312
+ u = m.data.context.graphQuery, h = m.data.message || "", l = !0;
1313
+ } else if (!m.data.hasMore)
1314
+ l = !0;
1315
+ else if (Date.now() - p > 6e4)
2285
1316
  throw new Error("Graph query service polling timed out after 1 minute.");
2286
- d = g.data.sequenceNumber;
1317
+ d = m.data.sequenceNumber;
1318
+ }
1319
+ return { graphQuery: u, explanation: h };
1320
+ }
1321
+ function et(e, t) {
1322
+ C(e, (r) => {
1323
+ t.set(`${r.typeName}__${r.id}`, {
1324
+ id: r.id,
1325
+ typeName: r.typeName
1326
+ });
1327
+ });
1328
+ }
1329
+ function C(e, t) {
1330
+ if (!(!e || typeof e != "object")) {
1331
+ if (tt(e))
1332
+ for (const r of e.path)
1333
+ C(r, t);
1334
+ else if (rt(e))
1335
+ t(e);
1336
+ else if (Array.isArray(e))
1337
+ for (const r of e)
1338
+ C(r, t);
1339
+ else if (at(e))
1340
+ for (const r of Object.values(e.properties ?? {}))
1341
+ C(r, t);
2287
1342
  }
2288
- return { graphQuery: p, explanation: h };
2289
1343
  }
2290
- const q = 3;
2291
- function ke(e, t = 100) {
1344
+ function rt(e) {
1345
+ return !e || typeof e != "object" || Array.isArray(e) ? !1 : "id" in e && "typeName" in e;
1346
+ }
1347
+ function tt(e) {
1348
+ return !e || typeof e != "object" || Array.isArray(e) ? !1 : e && "path" in e && Array.isArray(e.path);
1349
+ }
1350
+ function at(e) {
1351
+ return !e || typeof e != "object" || Array.isArray(e) || "id" in e ? !1 : "properties" in e && typeof e.properties == "object";
1352
+ }
1353
+ function ot(e, t) {
1354
+ const r = [], a = [], o = [
1355
+ [t.dataModel.entityTypes, r],
1356
+ [t.dataModel.relationshipTypes, a]
1357
+ ];
1358
+ for (const [i, s] of o)
1359
+ for (const n of i) {
1360
+ const l = e.getMemberIdsByType(n.name);
1361
+ s.push(...l);
1362
+ }
1363
+ return { entityIds: r, relationshipIds: a };
1364
+ }
1365
+ function nt(e, t) {
1366
+ const r = { entityIds: new Array(), relationshipIds: new Array() }, a = [], i = e?.allLayers.find((l) => l.type === "knowledge-graph")?.inclusionModeDefinition;
1367
+ if (!i)
1368
+ return { allNamedTypesFullyDynamic: !0, bindParameters: r, nonDynamicTypes: a };
1369
+ const s = [
1370
+ [t.dataModel.entityTypes, r.entityIds],
1371
+ [t.dataModel.relationshipTypes, r.relationshipIds]
1372
+ ];
1373
+ let n = !0;
1374
+ for (const [l, p] of s)
1375
+ for (const d of l) {
1376
+ const u = i.namedTypeDefinitions.get(d.name);
1377
+ if (!u) {
1378
+ n = !1, a.push(d.name);
1379
+ continue;
1380
+ }
1381
+ if (!u.useAllData) {
1382
+ n = !1, a.push(d.name);
1383
+ for (const [h] of u.members || [])
1384
+ p.push(h);
1385
+ }
1386
+ }
1387
+ return { allNamedTypesFullyDynamic: n, bindParameters: r, nonDynamicTypes: a };
1388
+ }
1389
+ const $ = 3;
1390
+ function ae(e, t = 100) {
2292
1391
  const r = {};
2293
1392
  for (const a of Object.entries(e.properties ?? {})) {
2294
- const [o, n] = a;
2295
- typeof n == "string" && n.length > t ? r[o] = `${n.slice(0, t)}... (truncated, original length: ${n.length})` : r[o] = n;
1393
+ const [o, i] = a;
1394
+ typeof i == "string" && i.length > t ? r[o] = `${i.slice(0, t)}... (truncated, original length: ${i.length})` : r[o] = i;
2296
1395
  }
2297
1396
  return e.properties = r, e;
2298
1397
  }
2299
- function A(e) {
1398
+ function E(e) {
2300
1399
  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);
2301
1400
  }
2302
- const Ya = async ({
1401
+ const it = async ({
2303
1402
  kg: e,
2304
1403
  queryParams: t,
2305
1404
  targetStructure: r,
2306
1405
  targetStructureReducer: a,
2307
1406
  requestOptions: o,
2308
- queryRowLimit: n,
2309
- queryTimeoutMs: l
1407
+ queryRowLimit: i,
1408
+ queryTimeoutMs: s
2310
1409
  }) => {
2311
- let s = null, c = r;
2312
- const u = new AbortController(), d = o?.signal, p = () => {
2313
- u.abort(d?.reason);
1410
+ let n = null, l = r;
1411
+ const p = new AbortController(), d = o?.signal, u = () => {
1412
+ p.abort(d?.reason);
2314
1413
  };
2315
- d && (d.aborted ? u.abort(d.reason) : d.addEventListener("abort", p, { once: !0 }));
1414
+ d && (d.aborted ? p.abort(d.reason) : d.addEventListener("abort", u, { once: !0 }));
2316
1415
  try {
2317
- const h = await mt(e, t, o);
2318
- s = h.resultHeader;
2319
- const y = h.resultRowsStream.getReader();
2320
- let g = 0;
2321
- const m = Date.now(), w = !1;
1416
+ const h = await je(e, t, o);
1417
+ n = h.resultHeader;
1418
+ const f = h.resultRowsStream.getReader();
1419
+ let m = 0;
1420
+ const w = Date.now(), b = !1;
2322
1421
  for (; ; ) {
2323
- const { done: T, value: C } = await y.read();
2324
- if (T)
1422
+ const { done: R, value: z } = await f.read();
1423
+ if (R)
2325
1424
  break;
2326
- if (!w && l && Date.now() - m > l)
2327
- return u.abort(), { type: "timeout" };
2328
- for (const v of C) {
2329
- if (g++, n && g > n)
2330
- return u.abort(), { type: "success", rowLimitReached: !0, resultHeader: s, processedResult: c };
2331
- c = a(c, v);
1425
+ if (!b && s && Date.now() - w > s)
1426
+ return p.abort(), { type: "timeout" };
1427
+ for (const se of z) {
1428
+ if (m++, i && m > i)
1429
+ return p.abort(), { type: "success", rowLimitReached: !0, resultHeader: n, processedResult: l };
1430
+ l = a(l, se);
2332
1431
  }
2333
1432
  }
2334
1433
  } catch (h) {
2335
- return u.signal.aborted ? { type: "aborted" } : { type: "error", errorMessage: A(h), error: h };
1434
+ return p.signal.aborted ? { type: "aborted" } : { type: "error", errorMessage: E(h), error: h };
2336
1435
  } finally {
2337
- d?.removeEventListener("abort", p);
1436
+ d?.removeEventListener("abort", u);
2338
1437
  }
2339
- return { type: "success", rowLimitReached: !1, resultHeader: s, processedResult: c };
1438
+ return { type: "success", rowLimitReached: !1, resultHeader: n, processedResult: l };
2340
1439
  };
2341
- async function Fe({
1440
+ async function oe({
2342
1441
  prompt: e,
2343
- kg: t,
2344
- graphQueryServiceUrl: r,
2345
- targetStructure: a,
2346
- targetStructureReducer: o,
2347
- requestOptions: n,
2348
- queryRowLimit: l,
2349
- queryTimeoutMs: s,
2350
- config: c
1442
+ bindParameters: t,
1443
+ kg: r,
1444
+ graphQueryServiceUrl: a,
1445
+ targetStructure: o,
1446
+ targetStructureReducer: i,
1447
+ requestOptions: s,
1448
+ queryRowLimit: n,
1449
+ queryTimeoutMs: l,
1450
+ config: p
2351
1451
  }) {
2352
- let u;
2353
- for (let d = 1; d <= q; d++) {
2354
- let p;
1452
+ let d;
1453
+ for (let u = 1; u <= $; u++) {
1454
+ let h;
2355
1455
  try {
2356
- p = await pe(e, t.dataModel, r, c, u);
2357
- } catch (g) {
1456
+ h = await U(e, r.dataModel, a, p, d);
1457
+ } catch (b) {
2358
1458
  return {
2359
1459
  type: "generation-error",
2360
- errorMessage: A(g),
2361
- error: g
1460
+ errorMessage: E(b),
1461
+ error: b
2362
1462
  };
2363
1463
  }
2364
- await S(
1464
+ await T(
2365
1465
  {
2366
- text: `Attempting to execute query: ${p.graphQuery.substring(0, 500)}${p.graphQuery.length > 500 ? "..." : ""}`
1466
+ text: `Attempting to execute query: ${h.graphQuery.substring(0, 500)}${h.graphQuery.length > 500 ? "..." : ""}`
2367
1467
  },
2368
- c
1468
+ p
2369
1469
  );
2370
- const h = await Ya({
2371
- kg: t,
2372
- queryParams: new xe({
2373
- openCypherQuery: p.graphQuery
1470
+ const f = await st(h.graphQuery, t), m = await it({
1471
+ kg: r,
1472
+ queryParams: new re({
1473
+ openCypherQuery: h.graphQuery,
1474
+ bindParameters: f
2374
1475
  }),
2375
- targetStructure: a,
2376
- targetStructureReducer: o,
2377
- requestOptions: n,
2378
- queryRowLimit: l,
2379
- queryTimeoutMs: s
2380
- }), y = h.type === "aborted" ? "Query execution was aborted." : h.type === "timeout" ? "Query execution timed out." : h.type === "error" ? `Query failed with error: ${h.errorMessage}` : "";
2381
- if (h.type === "success")
1476
+ targetStructure: o,
1477
+ targetStructureReducer: i,
1478
+ requestOptions: s,
1479
+ queryRowLimit: n,
1480
+ queryTimeoutMs: l
1481
+ }), w = m.type === "aborted" ? "Query execution was aborted." : m.type === "timeout" ? "Query execution timed out." : m.type === "error" ? `Query failed with error: ${m.errorMessage}` : "";
1482
+ if (m.type === "success")
2382
1483
  return {
2383
1484
  type: "success",
2384
- graphQuery: p.graphQuery,
2385
- explanation: p.explanation,
2386
- rowLimitReached: h.rowLimitReached,
2387
- resultHeader: h.resultHeader,
2388
- processedResult: h.processedResult
1485
+ graphQuery: h.graphQuery,
1486
+ explanation: h.explanation,
1487
+ rowLimitReached: m.rowLimitReached,
1488
+ resultHeader: m.resultHeader,
1489
+ processedResult: m.processedResult
2389
1490
  };
2390
- if (h.type === "aborted")
1491
+ if (m.type === "aborted")
2391
1492
  return {
2392
1493
  type: "aborted",
2393
- errorMessage: y,
2394
- graphQuery: p.graphQuery,
2395
- explanation: p.explanation
1494
+ errorMessage: w,
1495
+ graphQuery: h.graphQuery,
1496
+ explanation: h.explanation
2396
1497
  };
2397
- if (d >= q)
2398
- return h.type === "timeout" ? {
1498
+ if (u >= $)
1499
+ return m.type === "timeout" ? {
2399
1500
  type: "timeout",
2400
- errorMessage: y,
2401
- graphQuery: p.graphQuery,
2402
- explanation: p.explanation
1501
+ errorMessage: w,
1502
+ graphQuery: h.graphQuery,
1503
+ explanation: h.explanation
2403
1504
  } : {
2404
1505
  type: "execution-error",
2405
- errorMessage: y,
2406
- error: h.error,
2407
- graphQuery: p.graphQuery,
2408
- explanation: p.explanation
1506
+ errorMessage: w,
1507
+ error: m.error,
1508
+ graphQuery: h.graphQuery,
1509
+ explanation: h.explanation
2409
1510
  };
2410
- u = {
2411
- failedGraphQuery: p.graphQuery,
2412
- executionError: y,
2413
- attemptCount: d
2414
- }, await S(
2415
- { text: `Attempt ${d} failed with error: ${y}. Retrying...` },
2416
- c
1511
+ d = {
1512
+ failedGraphQuery: h.graphQuery,
1513
+ executionError: w,
1514
+ attemptCount: u
1515
+ }, await T(
1516
+ { text: `Attempt ${u} failed with error: ${w}. Retrying...` },
1517
+ p
2417
1518
  );
2418
1519
  }
2419
1520
  throw new Error(
2420
- `Failed to execute generated cypher due to an unexpected error after ${q} attempts.`
1521
+ `Failed to execute generated cypher due to an unexpected error after ${$} attempts.`
2421
1522
  );
2422
1523
  }
2423
- const Xa = async ({
1524
+ const st = async (e, t) => {
1525
+ if (!t)
1526
+ return {};
1527
+ const { bindParameters: r, parseErrors: a } = await Qe(e);
1528
+ if (a)
1529
+ return t;
1530
+ const o = {};
1531
+ for (const i of r)
1532
+ i in t && (o[i] = t[i]);
1533
+ return o;
1534
+ }, lt = async ({
2424
1535
  kg: e,
2425
1536
  searchQuery: t,
2426
1537
  typeCategoryFilter: r,
2427
1538
  namedTypesFilter: a,
2428
1539
  searchResultLimit: o,
2429
- requestOptions: n
1540
+ requestOptions: i
2430
1541
  }) => {
2431
- const l = [];
2432
- let s = [r];
2433
- r === "both" && !e.serviceDefinition.serviceCapabilities.searchCapabilities.searchTypeFilterCapabilities.includes("esriTypeBoth") && (s = ["entity", "relationship"]);
2434
- const c = o ?? 1 / 0;
1542
+ const s = [];
1543
+ let n = [r];
1544
+ r === "both" && !e.serviceDefinition.serviceCapabilities.searchCapabilities.searchTypeFilterCapabilities.includes("esriTypeBoth") && (n = ["entity", "relationship"]);
1545
+ const l = o ?? 1 / 0;
2435
1546
  try {
2436
- for (const u of s) {
2437
- const d = c - l.length;
1547
+ for (const p of n) {
1548
+ const d = l - s.length;
2438
1549
  if (d <= 0)
2439
1550
  break;
2440
- const y = (await yt(
1551
+ const f = (await Fe(
2441
1552
  e,
2442
- new ft({
1553
+ new _e({
2443
1554
  searchQuery: t,
2444
- typeCategoryFilter: u,
1555
+ typeCategoryFilter: p,
2445
1556
  namedTypesFilter: a ?? void 0,
2446
1557
  num: d
2447
1558
  }),
2448
- n
1559
+ i
2449
1560
  )).resultRowsStream.getReader();
2450
- let g = !1;
2451
- for (; !g; ) {
2452
- const { done: m, value: w } = await y.read();
2453
- if (m) {
2454
- g = !0;
1561
+ let m = !1;
1562
+ for (; !m; ) {
1563
+ const { done: w, value: b } = await f.read();
1564
+ if (w) {
1565
+ m = !0;
2455
1566
  break;
2456
1567
  }
2457
- for (const T of w)
2458
- for (const C of T)
2459
- l.push(C);
1568
+ for (const R of b)
1569
+ for (const z of R)
1570
+ s.push(z);
2460
1571
  }
2461
1572
  }
2462
- } catch (u) {
2463
- const d = A(u);
2464
- return n?.signal?.aborted ? {
1573
+ } catch (p) {
1574
+ const d = E(p);
1575
+ return i?.signal?.aborted ? {
2465
1576
  type: "aborted",
2466
1577
  errorMessage: d,
2467
- error: u
2468
- } : { type: "error", errorMessage: d, error: u };
1578
+ error: p
1579
+ } : { type: "error", errorMessage: d, error: p };
2469
1580
  }
2470
1581
  return {
2471
1582
  type: "success",
2472
- results: l
1583
+ results: s
2473
1584
  };
2474
- };
2475
- function eo(e, t) {
2476
- D(e, (r) => {
2477
- t.set(`${r.typeName}__${r.id}`, {
2478
- id: r.id,
2479
- typeName: r.typeName
2480
- });
2481
- });
2482
- }
2483
- function D(e, t) {
2484
- if (!(!e || typeof e != "object")) {
2485
- if (ro(e))
2486
- for (const r of e.path)
2487
- D(r, t);
2488
- else if (to(e))
2489
- t(e);
2490
- else if (Array.isArray(e))
2491
- for (const r of e)
2492
- D(r, t);
2493
- else if (ao(e))
2494
- for (const r of Object.values(e.properties ?? {}))
2495
- D(r, t);
2496
- }
2497
- }
2498
- function to(e) {
2499
- return !e || typeof e != "object" || Array.isArray(e) ? !1 : "id" in e && "typeName" in e;
2500
- }
2501
- function ro(e) {
2502
- return !e || typeof e != "object" || Array.isArray(e) ? !1 : e && "path" in e && Array.isArray(e.path);
2503
- }
2504
- function ao(e) {
2505
- return !e || typeof e != "object" || Array.isArray(e) || "id" in e ? !1 : "properties" in e && typeof e.properties == "object";
2506
- }
2507
- function oo(e, t) {
2508
- const r = [];
2509
- for (const a of [...t.dataModel.entityTypes, ...t.dataModel.relationshipTypes]) {
2510
- const o = e.getMemberIdsByType(a.name);
2511
- for (const n of o)
2512
- r.push({ id: n, typeName: a.name });
1585
+ }, ne = "IMPORTANT: The generated cypher query must return entire entities and relationships ONLY.";
1586
+ async function ie({
1587
+ prompt: e,
1588
+ view: t,
1589
+ knowledgeGraph: r,
1590
+ includeReturnEntityAndRelationshipContext: a = !1
1591
+ }) {
1592
+ const o = [e];
1593
+ if (a && o.push(ne), x(t)) {
1594
+ const d = await L("arcgis_knowledge_current_lc_context"), u = ot(t.map, r);
1595
+ return o.push(d), {
1596
+ enhancedPrompt: o.join(`
1597
+
1598
+ `),
1599
+ bindParameters: u,
1600
+ allNamedTypesFullyDynamic: !1
1601
+ };
2513
1602
  }
2514
- return r;
1603
+ const i = t.map, { allNamedTypesFullyDynamic: s, bindParameters: n, nonDynamicTypes: l } = nt(
1604
+ i,
1605
+ r
1606
+ );
1607
+ if (s)
1608
+ return {
1609
+ enhancedPrompt: o.join(`
1610
+
1611
+ `),
1612
+ bindParameters: n,
1613
+ allNamedTypesFullyDynamic: !0
1614
+ };
1615
+ const p = (await L("arcgis_knowledge_current_map_context")).replaceAll(
1616
+ "{nonDynamicTypes}",
1617
+ JSON.stringify(l)
1618
+ );
1619
+ return o.push(p), {
1620
+ enhancedPrompt: o.join(`
1621
+
1622
+ `),
1623
+ bindParameters: n,
1624
+ allNamedTypesFullyDynamic: s
1625
+ };
2515
1626
  }
2516
- function no(e) {
2517
- const t = [], r = [], o = e?.allLayers.find((n) => n.type === "knowledge-graph")?.inclusionModeDefinition;
2518
- if (o?.generateAllSublayers)
2519
- return { allNamedTypesFullyDynamic: !0, idTypePairs: t, dynamicTypes: r };
2520
- for (const [n, l] of o?.namedTypeDefinitions ?? [])
2521
- if (l.useAllData)
2522
- r.push(n);
2523
- else
2524
- for (const [s] of l.members)
2525
- t.push({ id: s, typeName: n });
2526
- return { allNamedTypesFullyDynamic: !1, idTypePairs: t, dynamicTypes: r };
2527
- }
2528
- async function io(e, t, r, a, o) {
2529
- const { view: n } = a, l = await Fe({
1627
+ async function ct(e, t, r, a, o, i) {
1628
+ const { view: s } = o, n = await oe({
2530
1629
  prompt: e,
2531
- kg: t,
2532
- graphQueryServiceUrl: r,
1630
+ bindParameters: t,
1631
+ kg: r,
1632
+ graphQueryServiceUrl: a,
2533
1633
  targetStructure: /* @__PURE__ */ new Map(),
2534
- targetStructureReducer: (p, h) => {
2535
- for (const y of h)
2536
- eo(y, p);
2537
- return p;
1634
+ targetStructureReducer: (h, f) => {
1635
+ for (const m of f)
1636
+ et(m, h);
1637
+ return h;
2538
1638
  },
2539
1639
  requestOptions: {
2540
- signal: Y(o),
2541
- timeout: o?.timeout
1640
+ signal: F(i),
1641
+ timeout: i?.timeout
2542
1642
  },
2543
- config: o
1643
+ config: i
2544
1644
  });
2545
- if (l.type !== "success") {
2546
- const p = l.type === "generation-error" ? l.errorMessage : `${l.errorMessage} Cypher query: ${l.graphQuery}`;
2547
- throw new Error(`Failed to add records to the link chart. ${p}`);
1645
+ if (n.type !== "success") {
1646
+ const h = n.type === "generation-error" ? n.errorMessage : `${n.errorMessage} Cypher query: ${n.graphQuery}`;
1647
+ throw new Error(`Failed to add records to the link chart. ${h}`);
2548
1648
  }
2549
- const { graphQuery: s, explanation: c, processedResult: u } = l, d = Array.from(u.values());
2550
- return await S(
1649
+ const { graphQuery: l, explanation: p, processedResult: d } = n, u = Array.from(d.values());
1650
+ return await T(
2551
1651
  {
2552
- text: `Query Results parsed into ${d.length} unique relationships and entities. Atempting to add to link chart...`
1652
+ text: `Query Results parsed into ${u.length} unique relationships and entities. Atempting to add to link chart...`
2553
1653
  },
2554
- o
2555
- ), !N(n) && n?.map ? (await n.map.addRecords(d), await J(n), { generatedQuery: s, explanation: c, addedIdTypePairs: d }) : (await n?.map?.allLayers.find(
2556
- (h) => h.type === "knowledge-graph"
2557
- )?.addRecords(d), { generatedQuery: s, explanation: c, addedIdTypePairs: d });
2558
- }
2559
- const W = "addRecords", so = i.object({
2560
- prompt: i.string().describe("The user's inquiry into the knowledge graph that needs to be run.")
2561
- }), lo = async ({ prompt: e }, t) => {
2562
- const { knowledgeGraph: r } = await O(t), a = Z(t), { view: o } = a, l = k.getDefault().helperServices;
2563
- let s = e;
2564
- if (!N(o) && o.map) {
2565
- const c = o.map, u = await te("arcgis_knowledge_current_lc_context"), d = oo(c, r);
2566
- s = `${e}
2567
-
2568
- ${u}${JSON.stringify(d)}`;
2569
- } else if (N(o) && o.map) {
2570
- const c = o.map, { allNamedTypesFullyDynamic: u, idTypePairs: d, dynamicTypes: p } = no(c), h = await te("arcgis_knowledge_current_map_context");
2571
- if (s = `${e}
2572
-
2573
- ${h}${JSON.stringify(d)} and all entities or relationships with the the following typeNames in the array: ${JSON.stringify(p)}`, u)
2574
- return {
2575
- toolName: W,
2576
- status: "success",
2577
- summary: "No records have been added to the map because all data in the knowledge graph is contained in the map.",
2578
- details: {
2579
- generatedQuery: "N/A",
2580
- explanation: "All named types in the knowledge graph are fully dynamic and therefore all data is already contained in the map. No records have been added.",
2581
- addedIdTypePairs: []
2582
- }
2583
- };
2584
- }
1654
+ i
1655
+ ), x(s) ? (await s.map.addRecords(u), await j(s), { generatedQuery: l, explanation: p, addedIdTypePairs: u }) : (await s?.map?.allLayers.find(
1656
+ (f) => f.type === "knowledge-graph"
1657
+ )?.addRecords(u), { generatedQuery: l, explanation: p, addedIdTypePairs: u });
1658
+ }
1659
+ const M = "addRecords", pt = c.object({
1660
+ prompt: c.string().describe(
1661
+ "The user's inquiry and context required in order to generate a cypher query that will be used to add records to the link chart."
1662
+ )
1663
+ }), dt = async ({ prompt: e }, t) => {
1664
+ const { knowledgeGraph: r } = await q(t), a = N(t), { view: o } = a, s = P.getDefault().helperServices, {
1665
+ enhancedPrompt: n,
1666
+ bindParameters: l,
1667
+ allNamedTypesFullyDynamic: p
1668
+ } = await ie({
1669
+ prompt: e,
1670
+ view: o,
1671
+ knowledgeGraph: r,
1672
+ includeReturnEntityAndRelationshipContext: !0
1673
+ });
1674
+ if (p)
1675
+ return {
1676
+ toolName: M,
1677
+ status: "success",
1678
+ summary: "No records have been added to the map because all data in the knowledge graph is contained in the map.",
1679
+ details: {
1680
+ generatedQuery: "N/A",
1681
+ explanation: "All named types in the knowledge graph are fully dynamic and therefore all data is already contained in the map. No records have been added.",
1682
+ addedIdTypePairs: []
1683
+ }
1684
+ };
2585
1685
  try {
2586
- const { generatedQuery: c, explanation: u, addedIdTypePairs: d } = await io(
2587
- s,
1686
+ const { generatedQuery: d, explanation: u, addedIdTypePairs: h } = await ct(
1687
+ n,
1688
+ l,
2588
1689
  r,
2589
- `${l.aiAssistantServices.url}${l.aiAssistantServices.graphQueryAssistant}`,
1690
+ `${s.aiAssistantServices.url}${s.aiAssistantServices.graphQueryAssistant}`,
2590
1691
  a,
2591
1692
  t
2592
1693
  );
2593
1694
  return {
2594
- toolName: W,
1695
+ toolName: M,
2595
1696
  status: "success",
2596
- summary: `Records added successfully. Cypher Query used: ${c}
1697
+ summary: `Records added successfully. Cypher Query used: ${d}
2597
1698
 
2598
- Number of records added: ${d.length}`,
1699
+ Number of records added: ${h.length}`,
2599
1700
  details: {
2600
- generatedQuery: c,
1701
+ generatedQuery: d,
2601
1702
  explanation: u,
2602
- addedIdTypePairs: d
1703
+ addedIdTypePairs: h
2603
1704
  }
2604
1705
  };
2605
- } catch (c) {
2606
- const u = A(c);
2607
- return console.error(`Failed to add records to the link chart. ${u}`, c), {
2608
- toolName: W,
1706
+ } catch (d) {
1707
+ const u = E(d);
1708
+ return {
1709
+ toolName: M,
2609
1710
  status: "error",
2610
1711
  errorMessage: `Failed to add records to the link chart. ${u}`,
2611
- error: c
1712
+ error: d
2612
1713
  };
2613
1714
  }
2614
- }, ei = f(lo, {
2615
- name: W,
2616
- description: "Adds records (entities or relationships) to the current link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the records to be added to the link chart. The user should have explicitly requested to add records to the current link chart from their prompt.",
2617
- schema: so
1715
+ }, Oa = g(dt, {
1716
+ name: M,
1717
+ description: `Adds records (entities or relationships) to the current link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the records to be added to the link chart. The user should have explicitly requested to add records to the current link chart from their prompt. "add to new link chart" is not a valid prompt for this tool.
1718
+
1719
+ example prompts:
1720
+ - "add all suppliers and the parts they produce to the link chart"
1721
+ - "show me the competitors of company x and add them to the link chart"
1722
+ - "add the relationships between company x and company y to the link chart"
1723
+ - "expand all the companies"
1724
+ - "expand company x through all the buildings it owns"
1725
+ - "connect company x and company y"
1726
+ - "connect all buildings on the link chart"
1727
+ `,
1728
+ schema: pt
2618
1729
  });
2619
- async function co(e, t) {
2620
- return await t.map?.applyLayout(e), await J(t), { appliedLayout: e };
1730
+ async function ut(e, t) {
1731
+ return await t.map?.applyLayout(e), await j(t), { appliedLayout: e };
2621
1732
  }
2622
- const ae = "applyLayout", uo = i.object({
2623
- layout: i.enum([
1733
+ const _ = "applyLayout", ht = c.object({
1734
+ layout: c.enum([
2624
1735
  "organic-standard",
2625
1736
  "organic-community",
2626
1737
  "basic-grid",
@@ -2633,341 +1744,354 @@ const ae = "applyLayout", uo = i.object({
2633
1744
  ]).describe(
2634
1745
  "The layout mode to apply to the link chart. The value must be one of the following: 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"
2635
1746
  )
2636
- }), po = async ({ layout: e }, t) => {
2637
- const { view: r } = Z(t);
2638
- if (N(r))
2639
- return {
2640
- toolName: ae,
2641
- status: "error",
2642
- errorMessage: "The applyLayout tool can only be used with a LinkChartView.",
2643
- error: new Error()
2644
- };
2645
- {
2646
- const { appliedLayout: a } = await co(e, r);
1747
+ }), mt = async ({ layout: e }, t) => {
1748
+ const { view: r } = N(t);
1749
+ if (x(r)) {
1750
+ const { appliedLayout: a } = await ut(e, r);
2647
1751
  return {
2648
- toolName: ae,
1752
+ toolName: _,
2649
1753
  status: "success",
2650
1754
  summary: `Successfully applied layout: ${a}.`,
2651
1755
  details: {
2652
1756
  appliedLayout: a
2653
1757
  }
2654
1758
  };
2655
- }
2656
- }, ti = f(po, {
2657
- name: ae,
2658
- description: "Apply a diagram layout to the link chart",
2659
- schema: uo
2660
- });
2661
- async function ho(e, t) {
2662
- return t.map?.changeNonspatialDataDisplay(e), await J(t), { appliedNonspatialDataDisplayMode: e };
2663
- }
2664
- const oe = "changeNonspatialVisibility", mo = i.object({
2665
- setting: i.enum(["hidden", "visible"]).describe("The setting of nonspatial visibility")
2666
- }), yo = async ({ setting: e }, t) => {
2667
- const { view: r } = Z(t);
2668
- if (N(r))
1759
+ } else
2669
1760
  return {
2670
- toolName: oe,
1761
+ toolName: _,
2671
1762
  status: "error",
2672
- errorMessage: "The changeNonspatialVisibility tool can only be used with a LinkChartView.",
1763
+ errorMessage: "The applyLayout tool can only be used with a LinkChartView.",
2673
1764
  error: new Error()
2674
1765
  };
2675
- {
2676
- const { appliedNonspatialDataDisplayMode: a } = await ho(e, r);
1766
+ }, Ka = g(mt, {
1767
+ name: _,
1768
+ description: "Apply a diagram layout to the link chart",
1769
+ schema: ht
1770
+ });
1771
+ async function yt(e, t) {
1772
+ return t.map?.changeNonspatialDataDisplay(e), await j(t), { appliedNonspatialDataDisplayMode: e };
1773
+ }
1774
+ const Q = "changeNonspatialVisibility", gt = c.object({
1775
+ setting: c.enum(["hidden", "visible"]).describe("The setting of nonspatial visibility")
1776
+ }), ft = async ({ setting: e }, t) => {
1777
+ const { view: r } = N(t);
1778
+ if (x(r)) {
1779
+ const { appliedNonspatialDataDisplayMode: a } = await yt(e, r);
2677
1780
  return {
2678
- toolName: oe,
1781
+ toolName: Q,
2679
1782
  status: "success",
2680
1783
  summary: `Successfully applied nonspatial visibility setting: ${a}.`,
2681
1784
  details: {
2682
1785
  appliedNonspatialDataDisplayMode: a
2683
1786
  }
2684
1787
  };
2685
- }
2686
- }, ri = f(yo, {
2687
- name: oe,
1788
+ } else
1789
+ return {
1790
+ toolName: Q,
1791
+ status: "error",
1792
+ errorMessage: "The changeNonspatialVisibility tool can only be used with a LinkChartView.",
1793
+ error: new Error()
1794
+ };
1795
+ }, Va = g(ft, {
1796
+ name: Q,
2688
1797
  description: "Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",
2689
- schema: mo
1798
+ schema: gt
2690
1799
  });
2691
- async function fo(e, t, r, a, o) {
2692
- let n, l = "";
2693
- for (let s = 1; s <= q; s++) {
2694
- const { graphQuery: c, explanation: u } = await pe(
1800
+ async function wt(e, t, r, a, o) {
1801
+ let i, s = "";
1802
+ for (let n = 1; n <= $; n++) {
1803
+ const { graphQuery: l, explanation: p } = await U(
2695
1804
  e,
2696
1805
  t.dataModel,
2697
1806
  r,
2698
1807
  o,
2699
- n
1808
+ i
2700
1809
  );
2701
1810
  try {
2702
- await S({ text: `Attempting to create link chart from derived query: ${c}` }, o);
2703
- const d = await ht.fromCypherQuery(
1811
+ await T({ text: `Attempting to create link chart from derived query: ${l}` }, o);
1812
+ const d = await Ge.fromCypherQuery(
2704
1813
  t,
2705
- new xe({
2706
- openCypherQuery: c
1814
+ new re({
1815
+ openCypherQuery: l
2707
1816
  })
2708
1817
  );
2709
- await S({ text: "Link chart created successfully, loading..." }, o), await d.load();
2710
- const p = a.map;
2711
- return a.map = d, await a.when(), await Ae.whenOnce(() => !a.updating), d.entityCount === 0 && d.relationshipCount === 0 ? (a.map === d && (a.map = p), d.destroy(), {
1818
+ await T({ text: "Link chart created successfully, loading..." }, o), await d.load();
1819
+ const u = a.map;
1820
+ return a.map = d, await a.when(), await ce.whenOnce(() => !a.updating), d.entityCount === 0 && d.relationshipCount === 0 ? (a.map === d && (a.map = u), d.destroy(), {
2712
1821
  type: "error",
2713
1822
  errorMessage: `Query returned no results. Cypher Query used to create the link chart:
2714
- ${c}
1823
+ ${l}
2715
1824
 
2716
- Explanation: ${u}`
2717
- }) : (await J(a), {
1825
+ Explanation: ${p}`
1826
+ }) : (await j(a), {
2718
1827
  type: "success",
2719
- graphQuery: c,
2720
- explanation: u
1828
+ graphQuery: l,
1829
+ explanation: p
2721
1830
  });
2722
1831
  } catch (d) {
2723
- const p = A(d);
2724
- if (s >= q) {
2725
- l = p;
1832
+ const u = E(d);
1833
+ if (n >= $) {
1834
+ s = u;
2726
1835
  break;
2727
1836
  }
2728
- n = {
2729
- failedGraphQuery: c,
2730
- executionError: p,
2731
- attemptCount: s
2732
- }, await S(
2733
- { text: `Attempt ${s} to create link chart failed with error: ${p}. Retrying ...` },
1837
+ i = {
1838
+ failedGraphQuery: l,
1839
+ executionError: u,
1840
+ attemptCount: n
1841
+ }, await T(
1842
+ { text: `Attempt ${n} to create link chart failed with error: ${u}. Retrying ...` },
2734
1843
  o
2735
1844
  );
2736
1845
  }
2737
1846
  }
2738
1847
  return {
2739
1848
  type: "error",
2740
- errorMessage: `Failed to create link chart after ${q} attempts. Last error: ${l}`
1849
+ errorMessage: `Failed to create link chart after ${$} attempts. Last error: ${s}`
2741
1850
  };
2742
1851
  }
2743
- const V = "createLinkChart", go = i.object({
2744
- prompt: i.string().describe(
2745
- "The user's inquiry into the knowledge graph that needs to be transformed into a link chart visualization."
1852
+ const D = "createLinkChart", bt = c.object({
1853
+ prompt: c.string().describe(
1854
+ "The user's inquiry and context required in order to generate a cypher query that will be used to create a link chart visualization. Only include information relevant to generating a cypher query. Do not suggest entity types, relationship types or properties. Do not include limits or formatting instructions for the query results unless specifically requested by the user. The prompt should be focused on the data the user wants to see in the link chart, not how to generate it."
2746
1855
  )
2747
- }), wo = async ({ prompt: e }, t) => {
2748
- const { knowledgeGraph: r } = await O(t), { view: a } = Z(t);
2749
- if (N(a))
2750
- return {
2751
- toolName: V,
2752
- status: "error",
2753
- errorMessage: "The createLinkChart tool can only be used with a LinkChartView.",
2754
- error: new Error()
2755
- };
2756
- {
2757
- const n = k.getDefault().helperServices, l = await fo(
2758
- e,
1856
+ }), Tt = async ({ prompt: e }, t) => {
1857
+ const { knowledgeGraph: r } = await q(t), { view: a } = N(t);
1858
+ if (x(a)) {
1859
+ const i = P.getDefault().helperServices, s = await wt(
1860
+ `${e}
1861
+
1862
+ ${ne}`,
2759
1863
  r,
2760
- `${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,
1864
+ `${i.aiAssistantServices.url}${i.aiAssistantServices.graphQueryAssistant}`,
2761
1865
  a,
2762
1866
  t
2763
1867
  );
2764
- if (l.type === "error")
1868
+ if (s.type === "error")
2765
1869
  return {
2766
- toolName: V,
1870
+ toolName: D,
2767
1871
  status: "error",
2768
- errorMessage: l.errorMessage,
1872
+ errorMessage: s.errorMessage,
2769
1873
  error: new Error()
2770
1874
  };
2771
- const { graphQuery: s, explanation: c } = l;
1875
+ const { graphQuery: n, explanation: l } = s;
2772
1876
  return {
2773
- toolName: V,
1877
+ toolName: D,
2774
1878
  status: "success",
2775
1879
  summary: `Link chart created successfully. Cypher Query used to create the link chart:
2776
- ${s}
1880
+ ${n}
2777
1881
 
2778
- Explanation: ${c}`,
1882
+ Explanation: ${l}`,
2779
1883
  details: {
2780
- generatedQuery: s,
2781
- explanation: c
1884
+ generatedQuery: n,
1885
+ explanation: l
2782
1886
  }
2783
1887
  };
2784
- }
2785
- }, ai = f(wo, {
2786
- name: V,
2787
- description: "Creates a new link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the new link chart. The user should have explicitly requested the creation of a new link chart from their prompt.",
2788
- schema: go
2789
- }), ne = "queryGraphData", bo = i.object({
2790
- prompt: i.string().describe(
2791
- `The user's inquiry into the knowledge graph, from which a cypher query will be generated and executed to answer the inquiry. IMPORTANT:
2792
-
2793
- REQUEST LIMIT: If the user does not specifically request for no limits or an explicit limit to be placed on the query, or the number of rows will not be limited by e.g. the number of entity or relationship types in the graph, ensure that the generated query has a reasonable row limit (e.g. 10 rows).
2794
-
2795
- DESCRIPTIVE COLUMN NAMES: If the user's prompt does not explicitly request for specific column names in the result, ensure that the generated query has descriptive column names (using AS statements) to make the results easier to understand when displayed in a table format.`
1888
+ } else
1889
+ return {
1890
+ toolName: D,
1891
+ status: "error",
1892
+ errorMessage: "The createLinkChart tool can only be used with a LinkChartView.",
1893
+ error: new Error()
1894
+ };
1895
+ }, Ba = g(Tt, {
1896
+ name: D,
1897
+ description: "Creates a new link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the new link chart. The user should have explicitly requested the creation of a new link chart from their prompt using language like 'create new link chart' or 'add to new link chart'.",
1898
+ schema: bt
1899
+ }), I = "queryGraphData", St = c.object({
1900
+ prompt: c.string().describe(
1901
+ "The user's inquiry into the knowledge graph, from which a cypher query will be generated and executed to answer the inquiry. Only include entity types, relationship types or properties if they are provided in the user prompt or prior steps. Do not suggest entity types, relationship types or properties. Do not include limits, information on what to return, instructions on how to write the query, or formatting instructions for the query results unless specifically requested by the user."
2796
1902
  )
2797
- }), To = async ({ prompt: e }, t) => {
2798
- const { knowledgeGraph: r } = await O(t), o = k.getDefault().helperServices, n = await Fe({
1903
+ }), vt = async ({ prompt: e }, t) => {
1904
+ const { knowledgeGraph: r } = await q(t), o = P.getDefault().helperServices;
1905
+ let i = e, s = null, n = null;
1906
+ try {
1907
+ ({ view: n } = N(t));
1908
+ } catch {
1909
+ }
1910
+ n && ({ enhancedPrompt: i, bindParameters: s } = await ie({
2799
1911
  prompt: e,
1912
+ view: n,
1913
+ knowledgeGraph: r,
1914
+ includeReturnEntityAndRelationshipContext: !1
1915
+ }));
1916
+ const l = await oe({
1917
+ prompt: i,
1918
+ bindParameters: s,
2800
1919
  kg: r,
2801
1920
  graphQueryServiceUrl: `${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,
2802
1921
  targetStructure: new Array(),
2803
- targetStructureReducer: (y, g) => (y.push(g), y),
1922
+ targetStructureReducer: (b, R) => (b.push(R), b),
2804
1923
  requestOptions: {
2805
- signal: Y(t),
1924
+ signal: F(t),
2806
1925
  timeout: t?.timeout
2807
1926
  },
2808
1927
  config: t
2809
1928
  });
2810
- if (n.type !== "success") {
2811
- const y = n.type === "generation-error" ? n.errorMessage : `${n.errorMessage} Cypher query: ${n.graphQuery}`;
1929
+ if (l.type !== "success") {
1930
+ const b = l.type === "generation-error" ? l.errorMessage : `${l.errorMessage} Cypher query: ${l.graphQuery}`;
2812
1931
  return {
2813
- toolName: ne,
1932
+ toolName: I,
2814
1933
  status: "error",
2815
- errorMessage: `Failed to query the knowledge graph. ${y}`,
2816
- error: "error" in n ? n.error : null
1934
+ errorMessage: `Failed to query the knowledge graph. ${b}`,
1935
+ error: "error" in l ? l.error : null
2817
1936
  };
2818
1937
  }
2819
- const { graphQuery: l, explanation: s, processedResult: c, resultHeader: u } = n, d = u.headerKeys;
2820
- for (const y of c)
2821
- for (const g of y)
2822
- D(
2823
- g,
2824
- (m) => ke(m)
1938
+ const { graphQuery: p, explanation: d, processedResult: u, resultHeader: h } = l, f = h.headerKeys;
1939
+ for (const b of u)
1940
+ for (const R of b)
1941
+ C(
1942
+ R,
1943
+ (z) => ae(z)
2825
1944
  );
2826
- const p = 50, h = c.slice(0, p).map((y) => JSON.stringify(y));
1945
+ const m = 50, w = u.slice(0, m).map((b) => JSON.stringify(b));
2827
1946
  return {
2828
- toolName: ne,
1947
+ toolName: I,
2829
1948
  status: "success",
2830
1949
  summary: `To answer the inquiry, the following cypher query was executed against the knowledge graph:
2831
1950
 
2832
1951
  \`\`\`cypher
2833
- ${l}
1952
+ ${p}
2834
1953
  \`\`\`
2835
1954
 
2836
1955
  Query Results:
2837
- ${h.length} result(s) found.
1956
+ ${w.length} result(s) found.
2838
1957
 
2839
- Column Headers: ${d.join(", ")}
1958
+ Column Headers: ${f.join(", ")}
2840
1959
 
2841
- ${h.length > p ? `Showing top ${p} results:
1960
+ ${w.length > m ? `Showing top ${m} results:
2842
1961
 
2843
1962
  ` : `Results:
2844
1963
 
2845
- `}${h.join(`
1964
+ `}${w.join(`
2846
1965
  `)}
2847
1966
  `,
2848
1967
  details: {
2849
- generatedQuery: l,
2850
- explanation: s,
2851
- resultHeader: u,
2852
- queryResults: c
1968
+ generatedQuery: p,
1969
+ explanation: d,
1970
+ resultHeader: {
1971
+ headerKeys: f,
1972
+ exceededTransferLimit: h.exceededTransferLimit,
1973
+ outSpatialReference: h.outSpatialReference
1974
+ },
1975
+ queryResults: u
2853
1976
  }
2854
1977
  };
2855
- }, oi = f(To, {
2856
- name: ne,
1978
+ }, Wa = g(vt, {
1979
+ name: I,
2857
1980
  description: "Allows users to explore the data in their knowledge graph via cypher query. Generates and executes a cypher query based on the user's inquiry into the knowledge graph, and displays the results in the chat pane without modifying the user's link chart if any. Use this tool when the user is asking an exploratory question about their data as a whole that can be answered via cypher query, for example 'What are the top 5 suppliers by total parts cost?' or 'How many employees do we have in each department?'.",
2858
- schema: bo
2859
- }), ie = "generateCypher", vo = i.object({
2860
- prompt: i.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")
2861
- }), So = async ({ prompt: e }, t) => {
2862
- const { knowledgeGraph: r } = await O(t), o = k.getDefault().helperServices;
1981
+ schema: St
1982
+ }), O = "generateCypher", Rt = c.object({
1983
+ prompt: c.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")
1984
+ }), xt = async ({ prompt: e }, t) => {
1985
+ const { knowledgeGraph: r } = await q(t), o = P.getDefault().helperServices;
2863
1986
  try {
2864
- const { graphQuery: n, explanation: l } = await Za(
1987
+ const { graphQuery: i, explanation: s } = await Zr(
2865
1988
  e,
2866
1989
  r.dataModel,
2867
1990
  `${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,
2868
1991
  t
2869
1992
  );
2870
1993
  return {
2871
- toolName: ie,
1994
+ toolName: O,
2872
1995
  status: "success",
2873
1996
  summary: `Generated Graph Query:
2874
- ${n}
1997
+ ${i}
2875
1998
 
2876
- Explanation: ${l}`,
1999
+ Explanation: ${s}`,
2877
2000
  details: {
2878
- generatedQuery: n,
2879
- explanation: l
2001
+ generatedQuery: i,
2002
+ explanation: s
2880
2003
  }
2881
2004
  };
2882
- } catch (n) {
2883
- const l = A(n);
2005
+ } catch (i) {
2006
+ const s = E(i);
2884
2007
  return {
2885
- toolName: ie,
2008
+ toolName: O,
2886
2009
  status: "error",
2887
- errorMessage: `Failed to generate Cypher query. ${l}`,
2888
- error: n
2010
+ errorMessage: `Failed to generate Cypher query. ${s}`,
2011
+ error: i
2889
2012
  };
2890
2013
  }
2891
- }, ni = f(So, {
2892
- name: ie,
2014
+ }, Ua = g(xt, {
2015
+ name: O,
2893
2016
  description: "Generates an Open Cypher query based on the user's prompt which represents an inquiry into the data of the knowledge service and its graph database, attempting to filter based on certain conditions and traverse specified relationships. The generated query should be syntactically correct and optimized for performance.",
2894
- schema: vo
2895
- }), xo = (e) => {
2017
+ schema: Rt
2018
+ }), Ct = (e) => {
2896
2019
  const t = e.dataModel, r = /* @__PURE__ */ new Map();
2897
- for (const s of t.searchIndexes)
2898
- if (s.supportedCategory !== "esriTypeMetaEntityProvenance")
2899
- for (const [c, u] of s.searchProperties.entries()) {
2900
- const d = r.get(c) ?? /* @__PURE__ */ new Set();
2901
- u.propertyNames.forEach((p) => d.add(p)), r.set(c, d);
2020
+ for (const n of t.searchIndexes)
2021
+ if (n.supportedCategory !== "esriTypeMetaEntityProvenance")
2022
+ for (const [l, p] of n.searchProperties.entries()) {
2023
+ const d = r.get(l) ?? /* @__PURE__ */ new Set();
2024
+ p.propertyNames.forEach((u) => d.add(u)), r.set(l, d);
2902
2025
  }
2903
- const a = t.entityTypes.filter((s) => r.has(s.name)), o = t.relationshipTypes.filter((s) => r.has(s.name)), n = `Entity Types:
2904
- ${a.map(({ name: s }) => `${s}: [${Array.from(r.get(s) ?? []).join(", ")}]`).join(`
2905
- `)}`, l = `Relationship Types:
2906
- ${o.map(({ name: s }) => `${s}: [${Array.from(r.get(s) ?? []).join(", ")}]`).join(`
2026
+ const a = t.entityTypes.filter((n) => r.has(n.name)), o = t.relationshipTypes.filter((n) => r.has(n.name)), i = `Entity Types:
2027
+ ${a.map(({ name: n }) => `${n}: [${Array.from(r.get(n) ?? []).join(", ")}]`).join(`
2028
+ `)}`, s = `Relationship Types:
2029
+ ${o.map(({ name: n }) => `${n}: [${Array.from(r.get(n) ?? []).join(", ")}]`).join(`
2907
2030
  `)}`;
2908
- return `${n}
2031
+ return `${i}
2909
2032
 
2910
- ${l}`;
2033
+ ${s}`;
2911
2034
  };
2912
- async function Ro(e, t) {
2913
- const r = await te("arcgis_knowledge_lucene_generation_prompt"), a = {
2035
+ async function $t(e, t, r) {
2036
+ const a = await L("arcgis_knowledge_lucene_generation_prompt"), o = {
2914
2037
  inquiry: e,
2915
- dataModelForSearch: xo(t)
2916
- }, o = i.enum(["entity", "relationship", "both"]).describe("The graph element category to search against - entity, relationship, or both"), n = i.number().int().positive().nullable().describe(
2038
+ dataModelForSearch: Ct(t)
2039
+ }, i = c.enum(["entity", "relationship", "both"]).describe("The graph element category to search against - entity, relationship, or both"), s = c.number().int().positive().nullable().describe(
2917
2040
  "The maximum number of search results to return. Default to 10 if not specified by the user, or set to null if the user specifically requests no limits or all results."
2918
- ), l = i.array(
2919
- i.enum(
2920
- t.dataModel.entityTypes.map((u) => u.name).concat(t.dataModel.relationshipTypes.map((u) => u.name))
2041
+ ), n = c.array(
2042
+ c.enum(
2043
+ t.dataModel.entityTypes.map((d) => d.name).concat(t.dataModel.relationshipTypes.map((d) => d.name))
2921
2044
  )
2922
- ).min(1), s = i.object({
2923
- query: i.string().describe("A lucene syntax query string to be executed against the knowledge graph search API"),
2924
- typeFilters: l.nullable().describe(
2045
+ ).min(1), l = c.object({
2046
+ query: c.string().describe("A lucene syntax query string to be executed against the knowledge graph search API"),
2047
+ typeFilters: n.nullable().describe(
2925
2048
  "Nullable list of entity or relationship types from the graph to limit the search to. If set to null, search will execute against all named types with indexed properties in the graph"
2926
2049
  ),
2927
- typeCategoryFilter: o,
2928
- resultLimit: n
2050
+ typeCategoryFilter: i,
2051
+ resultLimit: s
2929
2052
  });
2930
- return await De({
2931
- promptText: r,
2932
- inputVariables: a,
2933
- schema: s
2053
+ return await le({
2054
+ promptText: a,
2055
+ inputVariables: o,
2056
+ schema: l,
2057
+ config: r
2934
2058
  });
2935
2059
  }
2936
- const se = "searchGraphData", $o = i.object({
2937
- prompt: i.string().describe(
2060
+ const K = "searchGraphData", Pt = c.object({
2061
+ prompt: c.string().describe(
2938
2062
  "The user's inquiry into the knowledge graph, from which a lucene search query will be generated and executed against the graph to return relevant results."
2939
2063
  )
2940
- }), Co = async ({ prompt: e }, t) => {
2941
- const { knowledgeGraph: r } = await O(t);
2942
- await S({ text: "Generating search query for the user inquiry" }, t);
2943
- const a = await Ro(e, r);
2944
- await S({ text: "Executing graph search with generated search query" }, t);
2945
- const o = await Xa({
2064
+ }), Et = async ({ prompt: e }, t) => {
2065
+ const { knowledgeGraph: r } = await q(t);
2066
+ await T({ text: "Generating search query for the user inquiry" }, t);
2067
+ const a = await $t(e, r, t);
2068
+ await T({ text: "Executing graph search with generated search query" }, t);
2069
+ const o = await lt({
2946
2070
  kg: r,
2947
2071
  searchQuery: a.query,
2948
2072
  typeCategoryFilter: a.typeCategoryFilter,
2949
2073
  namedTypesFilter: a.typeFilters,
2950
2074
  searchResultLimit: a.resultLimit,
2951
2075
  requestOptions: {
2952
- signal: Y(t),
2076
+ signal: F(t),
2953
2077
  timeout: t?.timeout
2954
2078
  }
2955
2079
  });
2956
2080
  if (o.type !== "success")
2957
2081
  return {
2958
- toolName: se,
2082
+ toolName: K,
2959
2083
  status: "error",
2960
2084
  errorMessage: o.errorMessage,
2961
2085
  error: "error" in o ? o.error : null
2962
2086
  };
2963
- for (const s of o.results)
2964
- D(
2965
- s,
2966
- (c) => ke(c)
2087
+ for (const n of o.results)
2088
+ C(
2089
+ n,
2090
+ (l) => ae(l)
2967
2091
  );
2968
- const n = 10, l = o.results.slice(0, n);
2092
+ const i = 10, s = o.results.slice(0, i);
2969
2093
  return {
2970
- toolName: se,
2094
+ toolName: K,
2971
2095
  status: "success",
2972
2096
  summary: `To answer the query, the following lucene query was generated and executed:
2973
2097
  Query: ${a.query}
@@ -2977,65 +2101,59 @@ const se = "searchGraphData", $o = i.object({
2977
2101
 
2978
2102
  Search Results: ${o.results.length} result(s) found.
2979
2103
 
2980
- ${o.results.length > n ? `Showing top ${n} results:
2104
+ ${o.results.length > i ? `Showing top ${i} results:
2981
2105
 
2982
- ` : ""}${l.map((s) => JSON.stringify(s)).join(`
2106
+ ` : ""}${s.map((n) => JSON.stringify(n)).join(`
2983
2107
  `)}`,
2984
2108
  details: {
2985
2109
  generatedSearchQuery: a,
2986
2110
  searchResults: o.results
2987
2111
  }
2988
2112
  };
2989
- }, ii = f(Co, {
2990
- name: se,
2991
- description: "Allows users to search the knowledge graph for text matching their inquiry, using lucene search syntax, against indexed string properties defined on their entities and relationships. Use this tool when the user asks a question about their knowledge graph data as a whole, that could be answered via lucene text search of properties stored on graph elements, e.g requiring fuzzy matching. Otherwise if the inquiry is looking for connected records (e.g. paths), data aggregations, etc explore the data via the queryGraphData tool.",
2992
- schema: $o
2113
+ }, Ha = g(Et, {
2114
+ name: K,
2115
+ description: `
2116
+ Search the knowledge graph using one or more search texts, using lucene search syntax, against indexed string properties defined on their entities and relationships. Use this tool when the user asks a question about their knowledge graph data as a whole, that could be answered via lucene text search of properties stored on graph elements, e.g requiring fuzzy matching. Otherwise if the inquiry is looking for connected records (e.g. paths), data aggregations, etc explore the data via the queryGraphData tool.
2117
+ Example prompts:
2118
+ - "Find 'Bradley'"
2119
+ - "find the person john smith"
2120
+ - "find all people named smith"
2121
+ - "Find all references to 'delayed parts shipment'"
2122
+ - "Find all reports authored by someone with the title of 'Researcher'"
2123
+ - "Find the first 5 reports where summary mentions flood zoning near Sacramento, and the organization name is the City of Sacramento Utilities, and tags containing stormwater".
2124
+ - "Search for all john smiths and show their global ids`,
2125
+ schema: Pt
2993
2126
  });
2994
2127
  export {
2995
- An as A,
2996
- Pn as B,
2997
- Ln as C,
2998
- jn as D,
2999
- Gn as E,
3000
- On as F,
3001
- de as G,
3002
- Jn as H,
3003
- Mn as I,
3004
- Qn as J,
3005
- _n as K,
3006
- Wn as L,
3007
- Vn as M,
3008
- xn as N,
3009
- Kn as O,
3010
- Bn as P,
3011
- Ma as Q,
3012
- F as R,
3013
- Un as S,
3014
- Hn as T,
3015
- ti as a,
3016
- ni as b,
3017
- ri as c,
3018
- ai as d,
3019
- ei as e,
3020
- Re as f,
3021
- te as g,
3022
- Xn as h,
3023
- O as i,
3024
- Yn as j,
3025
- Rn as k,
3026
- Zn as l,
3027
- $n as m,
3028
- Cn as n,
3029
- En as o,
3030
- Nn as p,
3031
- oi as q,
3032
- qn as r,
3033
- ii as s,
3034
- Vt as t,
3035
- In as u,
3036
- kn as v,
3037
- Fn as w,
3038
- zn as x,
3039
- $ as y,
3040
- Dn as z
2128
+ Ca as D,
2129
+ W as G,
2130
+ _a as H,
2131
+ Fa as L,
2132
+ xa as N,
2133
+ Ka as a,
2134
+ Ba as b,
2135
+ Va as c,
2136
+ Oa as d,
2137
+ L as e,
2138
+ Ia as f,
2139
+ Ua as g,
2140
+ q as h,
2141
+ Qa as i,
2142
+ Ea as j,
2143
+ za as k,
2144
+ ka as l,
2145
+ Aa as m,
2146
+ Na as n,
2147
+ qa as o,
2148
+ Ma as p,
2149
+ Wa as q,
2150
+ Da as r,
2151
+ Ha as s,
2152
+ Ie as t,
2153
+ La as u,
2154
+ Ga as v,
2155
+ ja as w,
2156
+ $a as x,
2157
+ Oe as y,
2158
+ Pa as z
3041
2159
  };