@arcgis/ai-components 5.2.0-next.1 → 5.2.0-next.10

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 (105) hide show
  1. package/dist/agent-utils/LLMAgent.js +22 -22
  2. package/dist/cdn/{DHOVCT6R.js → 2SJAOYZT.js} +1 -1
  3. package/dist/cdn/434TAA3J.js +2 -0
  4. package/dist/cdn/{AMP6IALT.js → 5W7S2RS4.js} +1 -1
  5. package/dist/cdn/64PJB5NU.js +2 -0
  6. package/dist/cdn/{OH64RMOR.js → 6AWNQHCO.js} +2 -2
  7. package/dist/cdn/BIV2IPHH.js +2 -0
  8. package/dist/cdn/CCY4TSBO.js +2 -0
  9. package/dist/cdn/{AO7BQHKC.js → CTSALWEP.js} +1 -1
  10. package/dist/cdn/{NAUXSHIE.js → D2N2NSRQ.js} +2 -2
  11. package/dist/cdn/{3PKJWIC3.js → D3TNNRP4.js} +1 -1
  12. package/dist/cdn/{H7422XUG.js → DOV5ZJ7M.js} +1 -1
  13. package/dist/cdn/EEUCKMU7.js +2 -0
  14. package/dist/cdn/EGHBXLNG.js +2 -0
  15. package/dist/cdn/{GSEPHN3A.js → ETRWZ3MS.js} +31 -29
  16. package/dist/cdn/{S6W6HV4T.js → EWI4V3GQ.js} +10 -10
  17. package/dist/cdn/GTLS44GI.js +2 -0
  18. package/dist/cdn/{YY2SBO3V.js → I6HNBTWY.js} +1 -1
  19. package/dist/cdn/JBHNHHWO.js +3 -0
  20. package/dist/cdn/{FX5JFRDL.js → JOFUPKIB.js} +1 -1
  21. package/dist/cdn/KUEOKIQR.js +2 -0
  22. package/dist/cdn/{FHVXO2WG.js → LKRAPK4A.js} +30 -31
  23. package/dist/cdn/{4HU7735A.js → MODWHY3R.js} +2 -2
  24. package/dist/cdn/NXKKG5TK.js +2 -0
  25. package/dist/cdn/{2AXF774U.js → OBUZ7HBN.js} +1 -1
  26. package/dist/cdn/OIVRK7HT.js +2 -0
  27. package/dist/cdn/{HB5A5R2E.js → RUURNLTP.js} +1 -1
  28. package/dist/cdn/SWOXSJ62.js +2 -0
  29. package/dist/cdn/{ZLXN7NMF.js → T537PKP4.js} +9 -7
  30. package/dist/cdn/{JY6LLOUJ.js → TSZPHE7L.js} +2 -2
  31. package/dist/cdn/VAZNJSKA.js +16 -0
  32. package/dist/cdn/{V2P4AIGG.js → VMXLYWUK.js} +1 -1
  33. package/dist/cdn/{MDVYQQUG.js → VNQN5ZQO.js} +2 -2
  34. package/dist/cdn/WIDTPVSU.js +2 -0
  35. package/dist/cdn/{P6OPJQMC.js → XER22VYQ.js} +1 -1
  36. package/dist/cdn/index.js +1 -1
  37. package/dist/cdn/main.css +1 -1
  38. package/dist/chunks/adapter.js +491 -496
  39. package/dist/chunks/arcgisKnowledgeGraph.js +3 -3
  40. package/dist/chunks/dataExplorationGraph.js +101 -94
  41. package/dist/chunks/generateLayerDescriptions.js +236 -209
  42. package/dist/chunks/helpGraph.js +4 -4
  43. package/dist/chunks/layerStylingGraph.js +10 -10
  44. package/dist/chunks/navigationGraph.js +27 -27
  45. package/dist/chunks/orchestrator.js +240 -201
  46. package/dist/chunks/slottableRequestUtils.js +3 -7
  47. package/dist/chunks/summarize_query_response_prompt.js +9 -7
  48. package/dist/components/arcgis-assistant/customElement.d.ts +15 -0
  49. package/dist/components/arcgis-assistant/customElement.js +227 -127
  50. package/dist/components/arcgis-assistant/index.js +2 -3
  51. package/dist/components/arcgis-assistant/types.d.ts +14 -1
  52. package/dist/components/arcgis-assistant-chat/customElement.d.ts +8 -2
  53. package/dist/components/arcgis-assistant-chat/customElement.js +7 -7
  54. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +4 -1
  55. package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
  56. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -1
  57. package/dist/components/arcgis-assistant-interrupt/customElement.js +13 -9
  58. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +20 -0
  59. package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
  60. package/dist/components/arcgis-assistant-message/customElement.d.ts +23 -0
  61. package/dist/components/arcgis-assistant-message/customElement.js +28 -26
  62. package/dist/components/arcgis-assistant-message/index.d.ts +1 -0
  63. package/dist/components/arcgis-assistant-message/index.js +2 -0
  64. package/dist/components/arcgis-assistant-message-block/customElement.d.ts +1 -1
  65. package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
  66. package/dist/components/arcgis-assistant-message-block/index.js +1 -0
  67. package/dist/components/arcgis-assistant-message-feedback/customElement.d.ts +4 -1
  68. package/dist/components/arcgis-assistant-message-footer/customElement.d.ts +4 -1
  69. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +8 -1
  70. package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -8
  71. package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
  72. package/dist/components/arcgis-assistant-message-log/customElement.d.ts +4 -1
  73. package/dist/components/arcgis-assistant-message-read-aloud/customElement.d.ts +4 -1
  74. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +4 -1
  75. package/dist/components/arcgis-assistant-speech-input/customElement.d.ts +6 -1
  76. package/dist/components/arcgis-assistant-suggested-prompts/customElement.d.ts +4 -1
  77. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
  78. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +4 -1
  79. package/dist/components/arcgis-assistant-user-message/customElement.js +1 -1
  80. package/dist/docs/api.json +1 -1
  81. package/dist/docs/docs.json +1 -1
  82. package/dist/docs/vscode.html-custom-data.json +1 -1
  83. package/dist/docs/web-types.json +1 -1
  84. package/dist/index.d.ts +4 -0
  85. package/dist/loader.js +6 -5
  86. package/dist/types/lumina.d.ts +10 -4
  87. package/dist/types/preact.d.ts +11 -4
  88. package/dist/types/react.d.ts +12 -4
  89. package/dist/types/stencil.d.ts +10 -4
  90. package/dist/utils/index.d.ts +85 -42
  91. package/dist/utils/index.js +22 -18
  92. package/package.json +7 -7
  93. package/dist/cdn/7BCR6TUO.js +0 -2
  94. package/dist/cdn/7GH7VSB2.js +0 -2
  95. package/dist/cdn/7PLV4QH6.js +0 -2
  96. package/dist/cdn/DDLZOMUY.js +0 -2
  97. package/dist/cdn/MH5RPXHM.js +0 -2
  98. package/dist/cdn/NVI3I46B.js +0 -2
  99. package/dist/cdn/OAVEHGB6.js +0 -2
  100. package/dist/cdn/ON2V5XI2.js +0 -3
  101. package/dist/cdn/QR54T33D.js +0 -2
  102. package/dist/cdn/SXDLXCIM.js +0 -2
  103. package/dist/cdn/USMDJUFS.js +0 -2
  104. package/dist/cdn/V5YEZSRY.js +0 -16
  105. package/dist/cdn/Y333DGV6.js +0 -2
@@ -1,56 +1,56 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import ce from "@arcgis/core/identity/IdentityManager.js";
3
3
  import k from "@arcgis/core/portal/Portal.js";
4
- import { Annotation as b, messagesStateReducer as me } from "@langchain/langgraph/web";
5
- import { n as Ne, o as x, k as U, s as S, i as ze } from "./generateLayerDescriptions.js";
4
+ import { Annotation as b, messagesStateReducer as ye } from "@langchain/langgraph/web";
5
+ import { n as ze, o as x, k as U, s as S, i as qe } from "./generateLayerDescriptions.js";
6
6
  import "@langchain/core/messages";
7
7
  import "@langchain/core/callbacks/dispatch/web";
8
8
  import "@langchain/openai";
9
- import * as qe from "@arcgis/core/core/reactiveUtils.js";
9
+ import * as De from "@arcgis/core/core/reactiveUtils.js";
10
10
  import "@arcgis/core/layers/FeatureLayer.js";
11
11
  import le from "@arcgis/core/request.js";
12
12
  import "@langchain/core/prompts";
13
13
  import { tool as f } from "@langchain/core/tools";
14
14
  import J from "@arcgis/core/config.js";
15
- import De from "@arcgis/core/Graphic.js";
16
- import { addressToLocations as Ae } from "@arcgis/core/rest/locator.js";
17
- import Le from "@arcgis/core/symbols/PictureMarkerSymbol.js";
15
+ import Ae from "@arcgis/core/Graphic.js";
16
+ import { addressToLocations as Le } from "@arcgis/core/rest/locator.js";
17
+ import Pe from "@arcgis/core/symbols/PictureMarkerSymbol.js";
18
18
  import i, { z as C } from "zod";
19
- import Pe from "@arcgis/core/geometry/Extent.js";
20
- import ye from "@arcgis/core/geometry/Point.js";
21
- import { createRenderer as je } from "@arcgis/core/smartMapping/renderers/pieChart.js";
22
- import { getSchemesByTag as Ge, getSchemes as Oe } from "@arcgis/core/smartMapping/symbology/pieChart.js";
19
+ import je from "@arcgis/core/geometry/Extent.js";
20
+ import fe from "@arcgis/core/geometry/Point.js";
21
+ import { createRenderer as Ge } from "@arcgis/core/smartMapping/renderers/pieChart.js";
22
+ import { getSchemesByTag as Oe, getSchemes as Me } from "@arcgis/core/smartMapping/symbology/pieChart.js";
23
23
  import { getBackgroundColorTheme as ue } from "@arcgis/core/views/support/colorUtils.js";
24
- import { createAgeRenderer as Me, createContinuousRenderer as Qe } from "@arcgis/core/smartMapping/renderers/color.js";
24
+ import { createAgeRenderer as Qe, createContinuousRenderer as _e } from "@arcgis/core/smartMapping/renderers/color.js";
25
25
  import { getSchemesByTag as re } from "@arcgis/core/smartMapping/symbology/color.js";
26
- import { createContinuousRenderer as _e } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
27
- import { createRenderer as We } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
28
- import { getSchemesByTag as Ve } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
29
- import { createRenderer as Ue } from "@arcgis/core/smartMapping/renderers/heatmap.js";
30
- import { getSchemesByTag as Ke } from "@arcgis/core/smartMapping/symbology/heatmap.js";
31
- import { createRenderer as Be } from "@arcgis/core/smartMapping/renderers/predominance.js";
32
- import { getSchemesByTag as He } from "@arcgis/core/smartMapping/symbology/predominance.js";
33
- import { createRenderer as Je } from "@arcgis/core/smartMapping/renderers/relationship.js";
34
- import { getSchemesByTag as Ze } from "@arcgis/core/smartMapping/symbology/relationship.js";
35
- import { createAgeRenderer as Ye, createContinuousRenderer as Xe } from "@arcgis/core/smartMapping/renderers/size.js";
36
- import { createRenderer as et } from "@arcgis/core/smartMapping/renderers/type.js";
37
- import { getSchemesByTag as tt } from "@arcgis/core/smartMapping/symbology/type.js";
38
- import { ToolNode as rt } from "@langchain/langgraph/prebuilt";
39
- import ot from "@arcgis/core/layers/support/FeatureEffect.js";
40
- import fe from "@arcgis/core/layers/support/FeatureFilter.js";
41
- import * as at from "@arcgis/core/geometry/operators/unionOperator.js";
42
- import { formatDateOnly as nt, convertDateFormatToIntlOptions as M, formatTimeOnly as it, formatDate as de } from "@arcgis/core/intl.js";
43
- import st from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
44
- import ct from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
45
- import lt from "@arcgis/core/rest/support/TopFeaturesQuery.js";
46
- import ut from "@arcgis/core/rest/support/TopFilter.js";
47
- import dt from "@arcgis/core/WebLinkChart.js";
48
- import ge from "@arcgis/core/rest/knowledgeGraph/GraphQueryStreaming.js";
26
+ import { createContinuousRenderer as We } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
27
+ import { createRenderer as Ve } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
28
+ import { getSchemesByTag as Ue } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
29
+ import { createRenderer as Ke } from "@arcgis/core/smartMapping/renderers/heatmap.js";
30
+ import { getSchemesByTag as Be } from "@arcgis/core/smartMapping/symbology/heatmap.js";
31
+ import { createRenderer as He } from "@arcgis/core/smartMapping/renderers/predominance.js";
32
+ import { getSchemesByTag as Je } from "@arcgis/core/smartMapping/symbology/predominance.js";
33
+ import { createRenderer as Ze } from "@arcgis/core/smartMapping/renderers/relationship.js";
34
+ import { getSchemesByTag as Ye } from "@arcgis/core/smartMapping/symbology/relationship.js";
35
+ import { createAgeRenderer as Xe, createContinuousRenderer as et } from "@arcgis/core/smartMapping/renderers/size.js";
36
+ import { createRenderer as tt } from "@arcgis/core/smartMapping/renderers/type.js";
37
+ import { getSchemesByTag as rt } from "@arcgis/core/smartMapping/symbology/type.js";
38
+ import { ToolNode as ot } from "@langchain/langgraph/prebuilt";
39
+ import at from "@arcgis/core/layers/support/FeatureEffect.js";
40
+ import ge from "@arcgis/core/layers/support/FeatureFilter.js";
41
+ import * as nt from "@arcgis/core/geometry/operators/unionOperator.js";
42
+ import { formatDateOnly as it, convertDateFormatToIntlOptions as M, formatTimeOnly as st, formatDate as de } from "@arcgis/core/intl.js";
43
+ import ct from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
44
+ import lt from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
45
+ import ut from "@arcgis/core/rest/support/TopFeaturesQuery.js";
46
+ import dt from "@arcgis/core/rest/support/TopFilter.js";
47
+ import pt from "@arcgis/core/WebLinkChart.js";
48
+ import we from "@arcgis/core/rest/knowledgeGraph/GraphQueryStreaming.js";
49
49
  import "@arcgis/core/views/LinkChartView.js";
50
- import { fetchKnowledgeGraph as pe, executeQueryStreaming as pt, executeSearchStreaming as ht } from "@arcgis/core/rest/knowledgeGraphService.js";
51
- import mt from "@arcgis/core/rest/knowledgeGraph/GraphSearchStreaming.js";
52
- const L = (e, t) => t ?? e, Tn = b.Root({
53
- ...Ne(),
50
+ import { fetchKnowledgeGraph as pe, executeQueryStreaming as ht, executeSearchStreaming as mt } from "@arcgis/core/rest/knowledgeGraphService.js";
51
+ import yt from "@arcgis/core/rest/knowledgeGraph/GraphSearchStreaming.js";
52
+ const L = (e, t) => t ?? e, vn = b.Root({
53
+ ...ze(),
54
54
  // internal to the navigation agent
55
55
  intent: b({
56
56
  reducer: L
@@ -69,21 +69,21 @@ const L = (e, t) => t ?? e, Tn = b.Root({
69
69
  })
70
70
  })
71
71
  });
72
- async function yt(e, t) {
72
+ async function ft(e, t) {
73
73
  const o = k.getDefault().helperServices, a = o.geocode.find((h) => h.name === "ArcGIS World Geocoding Service") ?? o.geocode[0];
74
74
  if (!a)
75
75
  throw new Error("No geocoding service found in helperServices.");
76
- const n = a.url, s = `${J.assetsPath?.endsWith("/") ? J.assetsPath : `${J.assetsPath}/`}esri/images/search/search-symbol-32.png`, u = (await Ae(n, {
76
+ const n = a.url, s = `${J.assetsPath?.endsWith("/") ? J.assetsPath : `${J.assetsPath}/`}esri/images/search/search-symbol-32.png`, u = (await Le(n, {
77
77
  address: { SingleLine: e },
78
78
  outFields: ["Match_addr"]
79
79
  }))?.[0];
80
80
  if (!u?.extent || !u.location)
81
81
  throw new Error(`Could not find location for: ${e}`);
82
- const l = new Le({
82
+ const l = new Pe({
83
83
  url: s,
84
84
  width: 24,
85
85
  height: 24
86
- }), d = new De({
86
+ }), d = new Ae({
87
87
  geometry: u.location,
88
88
  symbol: l
89
89
  });
@@ -98,28 +98,28 @@ async function yt(e, t) {
98
98
  sharedStatePatch: { lastResolvedLocation: { value: p } }
99
99
  };
100
100
  }
101
- const ft = ["mapView"];
101
+ const gt = ["mapView"];
102
102
  function $(e) {
103
103
  const r = e?.configurable?.context;
104
104
  if (!r || typeof r != "object")
105
105
  throw new Error("NavigationAgent context missing");
106
- const o = ft.filter((a) => !(a in r));
106
+ const o = gt.filter((a) => !(a in r));
107
107
  if (o.length)
108
108
  throw new Error(`NavigationAgent context missing: ${o.join(", ")}`);
109
109
  return r;
110
110
  }
111
- async function gt({ address: e }, t) {
111
+ async function wt({ address: e }, t) {
112
112
  const { mapView: r } = $(t);
113
- return await yt(e, r);
113
+ return await ft(e, r);
114
114
  }
115
- const wt = i.object({
115
+ const bt = i.object({
116
116
  address: i.string().describe("The full address or place name to locate.")
117
- }), vn = f(gt, {
117
+ }), Sn = f(wt, {
118
118
  name: "goToAddress",
119
119
  description: "Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",
120
- schema: wt
120
+ schema: bt
121
121
  });
122
- async function bt(e, t) {
122
+ async function Tt(e, t) {
123
123
  const o = t.map.bookmarks;
124
124
  if (!o || o.length === 0)
125
125
  throw new Error("No bookmarks found in the map.");
@@ -131,18 +131,18 @@ async function bt(e, t) {
131
131
  throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);
132
132
  return await t.goTo(n), { text: `Navigated to bookmark: ${e}` };
133
133
  }
134
- async function Tt({ bookmarkName: e }, t) {
134
+ async function vt({ bookmarkName: e }, t) {
135
135
  const { mapView: r } = $(t);
136
- return await Promise.resolve(bt(e, r));
136
+ return await Promise.resolve(Tt(e, r));
137
137
  }
138
- const vt = C.object({
138
+ const St = C.object({
139
139
  bookmarkName: C.string().describe("The name of the bookmark to navigate to.")
140
- }), Sn = f(Tt, {
140
+ }), xn = f(vt, {
141
141
  name: "goToBookmark",
142
142
  description: "Go to the extent of the bookmark with the given name.",
143
- schema: vt
143
+ schema: St
144
144
  });
145
- async function St(e, t, r) {
145
+ async function xt(e, t, r) {
146
146
  const o = r.map?.allLayers.find((s) => s.id === e);
147
147
  if (!o)
148
148
  return { text: `Error: Layer with id ${e} not found` };
@@ -171,20 +171,20 @@ async function St(e, t, r) {
171
171
  return console.error("Error in goToFeatures:", s), { text: `Error: ${s instanceof Error ? s.message : "Unknown error"}`, where: a };
172
172
  }
173
173
  }
174
- async function xt({ layerId: e, where: t }, r) {
174
+ async function Rt({ layerId: e, where: t }, r) {
175
175
  const { mapView: o } = $(r);
176
- return await St(e, t, o);
176
+ return await xt(e, t, o);
177
177
  }
178
- const Rt = C.object({
178
+ const $t = C.object({
179
179
  layerId: C.string().describe("The layerId of the layer to zoom to."),
180
180
  where: C.string().describe("The sql-92 where clause used to query features to zoom to")
181
- }), xn = f(xt, {
181
+ }), Rn = f(Rt, {
182
182
  name: "goToFeatures",
183
183
  description: "Go to the features that match the given filter related to the given layerId.",
184
- schema: Rt
184
+ schema: $t
185
185
  });
186
- async function $t(e) {
187
- const r = new Pe({
186
+ async function Et(e) {
187
+ const r = new je({
188
188
  xmin: -180,
189
189
  ymin: -90,
190
190
  xmax: 180,
@@ -193,14 +193,14 @@ async function $t(e) {
193
193
  }).expand(0.7);
194
194
  return await e.goTo(r), { text: "Successfully zoomed to world extent" };
195
195
  }
196
- async function Et(e, t) {
196
+ async function Ct(e, t) {
197
197
  const { mapView: r } = $(t);
198
- return await $t(r);
198
+ return await Et(r);
199
199
  }
200
- const Ct = C.object({}), Rn = f(Et, {
200
+ const Ft = C.object({}), $n = f(Ct, {
201
201
  name: "goToFullExtent",
202
202
  description: "Zooms the map to the full world extent using Esri's Geocoding Service.",
203
- schema: Ct
203
+ schema: Ft
204
204
  });
205
205
  async function It(e) {
206
206
  const r = e.map.initialViewProperties?.viewpoint?.targetGeometry;
@@ -210,16 +210,16 @@ async function It(e) {
210
210
  throw new Error("Initial extent is undefined");
211
211
  return { text: "Successfully zoomed to home extent" };
212
212
  }
213
- async function Ft(e, t) {
213
+ async function kt(e, t) {
214
214
  const { mapView: r } = $(t);
215
215
  return await It(r);
216
216
  }
217
- const kt = i.object({}), $n = f(Ft, {
217
+ const Nt = i.object({}), En = f(kt, {
218
218
  name: "goToHomeExtent",
219
219
  description: "Go to the initial web map view extent",
220
- schema: kt
220
+ schema: Nt
221
221
  });
222
- async function Nt(e, t) {
222
+ async function zt(e, t) {
223
223
  await t.when();
224
224
  const r = t.map?.allLayers.find((a) => a.id === e);
225
225
  if (!r)
@@ -227,34 +227,34 @@ async function Nt(e, t) {
227
227
  let o;
228
228
  return (r.type === "link-chart" || r.type === "knowledge-graph-sublayer") && t.map?.activeLinkChartLayer ? o = t.map.diagramNodesExtent : o = r.fullExtent, o ? (await t.goTo(o), r.visible = !0, { text: `Successfully zoomed to: ${r.title ?? ""}` }) : { text: "Layer has no defined extent. Cannot zoom to layer." };
229
229
  }
230
- async function zt({ layerId: e }, t) {
230
+ async function qt({ layerId: e }, t) {
231
231
  const { mapView: r } = $(t);
232
- return await Nt(e, r);
232
+ return await zt(e, r);
233
233
  }
234
- const qt = C.object({
234
+ const Dt = C.object({
235
235
  layerId: C.string().describe("The id of the layer to navigate to")
236
- }), En = f(zt, {
236
+ }), Cn = f(qt, {
237
237
  name: "goToLayer",
238
238
  description: "Zooms the map view to the full extent of the top matching layer.",
239
- schema: qt
239
+ schema: Dt
240
240
  });
241
- async function Dt(e, t) {
241
+ async function At(e, t) {
242
242
  return await t.goTo({ scale: e }), { text: `Successfully zoomed to: ${e}` };
243
243
  }
244
- async function At({ scale: e }, t) {
244
+ async function Lt({ scale: e }, t) {
245
245
  const { mapView: r } = $(t);
246
- return await Dt(e, r);
246
+ return await At(e, r);
247
247
  }
248
- const Lt = i.object({
248
+ const Pt = i.object({
249
249
  scale: i.number().describe("The map scale of the view to go to.")
250
- }), Cn = f(At, {
250
+ }), Fn = f(Lt, {
251
251
  name: "goToScale",
252
252
  description: "Go to the specified view scale.",
253
- schema: Lt
253
+ schema: Pt
254
254
  });
255
- async function Pt(e, t, r) {
255
+ async function jt(e, t, r) {
256
256
  const a = {
257
- target: new ye({
257
+ target: new fe({
258
258
  longitude: e.longitude,
259
259
  latitude: e.latitude,
260
260
  spatialReference: { wkid: 4326 }
@@ -266,39 +266,39 @@ async function Pt(e, t, r) {
266
266
  r?.scale !== void 0 ? `scale 1:${r.scale}` : ""
267
267
  ].filter(Boolean).join(", ")}` };
268
268
  }
269
- async function jt({
269
+ async function Gt({
270
270
  center: e,
271
271
  zoom: t,
272
272
  scale: r
273
273
  }, o) {
274
274
  const { mapView: a } = $(o);
275
- return await Pt(e, a, { zoom: t, scale: r });
275
+ return await jt(e, a, { zoom: t, scale: r });
276
276
  }
277
- const Gt = i.object({
277
+ const Ot = i.object({
278
278
  center: i.object({
279
279
  longitude: i.number().describe("The longitude (x-coordinate) of the point to navigate to."),
280
280
  latitude: i.number().describe("The latitude (y-coordinate) of the point to navigate to.")
281
281
  }),
282
282
  zoom: i.number().optional().describe("The zoom level. Higher values = more zoomed in."),
283
283
  scale: i.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
284
- }), In = f(jt, {
284
+ }), In = f(Gt, {
285
285
  name: "goToViewpoint",
286
286
  description: "Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",
287
- schema: Gt
287
+ schema: Ot
288
288
  });
289
- async function Ot(e, t) {
289
+ async function Mt(e, t) {
290
290
  return await t.goTo({ zoom: e }), { text: `Successfully zoomed to: ${e}` };
291
291
  }
292
- async function Mt({ zoom: e }, t) {
292
+ async function Qt({ zoom: e }, t) {
293
293
  const { mapView: r } = $(t);
294
- return await Ot(e, r);
294
+ return await Mt(e, r);
295
295
  }
296
- const Qt = i.object({
296
+ const _t = i.object({
297
297
  zoom: i.number().min(1).max(20).describe("The zoom level of the view to go to.")
298
- }), Fn = f(Mt, {
298
+ }), kn = f(Qt, {
299
299
  name: "goToZoom",
300
300
  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.).',
301
- schema: Qt
301
+ schema: _t
302
302
  }), he = /* @__PURE__ */ Object.assign({
303
303
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md": () => import("./arcgis_knowledge_current_lc_context.js").then((e) => e.default),
304
304
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md": () => import("./arcgis_knowledge_current_map_context.js").then((e) => e.default),
@@ -322,30 +322,30 @@ ${Object.keys(he).join(`
322
322
  `)}`);
323
323
  return await t[1]();
324
324
  }
325
- const _t = (e, t = 300) => {
325
+ const Wt = (e, t = 300) => {
326
326
  const r = e.replace(/\s+/gu, " ").replace(/[*_`#>\-]/gu, "").trim();
327
327
  return r.length > t ? `${r.slice(0, t)}...` : r;
328
- }, we = (e, t) => {
328
+ }, be = (e, t) => {
329
329
  const o = e?.configurable?.services?.[t];
330
330
  if (o == null)
331
331
  throw new Error(`${t} missing in config.configurable.services`);
332
332
  return o;
333
- }, kn = (e, t) => (r, o) => {
333
+ }, Nn = (e, t) => (r, o) => {
334
334
  const a = o?.configurable?.services;
335
335
  for (const n of e)
336
336
  if (!a?.[n])
337
337
  throw new Error(`${t} requires services.${n} to be available.`);
338
338
  return r;
339
339
  };
340
- async function Wt(e) {
340
+ async function Vt(e) {
341
341
  const { fields: t, layer: r, view: o, styleName: a, colorSchemeTags: n } = e;
342
342
  let s;
343
- return n ? s = Ge({
343
+ return n ? s = Oe({
344
344
  basemapTheme: await ue(o),
345
345
  geometryType: r.geometryType,
346
346
  includedTags: n,
347
347
  numColors: Math.min(t.length, 8)
348
- })[0] : s = Oe({
348
+ })[0] : s = Me({
349
349
  basemapTheme: await ue(o),
350
350
  geometryType: r.geometryType,
351
351
  numColors: Math.min(t.length, 8)
@@ -362,10 +362,10 @@ async function Wt(e) {
362
362
  pieChartScheme: s
363
363
  };
364
364
  }
365
- async function Vt(e) {
366
- return await je(e);
365
+ async function Ut(e) {
366
+ return await Ge(e);
367
367
  }
368
- async function Ut({
368
+ async function Kt({
369
369
  arcgisMap: e,
370
370
  arcgisMapView: t,
371
371
  layerId: r,
@@ -384,30 +384,30 @@ async function Ut({
384
384
  colorSchemeTags: a
385
385
  };
386
386
  try {
387
- const d = await Wt(l), p = await Vt(d);
387
+ const d = await Vt(l), p = await Ut(d);
388
388
  return c.renderer = p.renderer, c.visible = !0, `Chart renderer applied to layer: ${c.title ?? c.id} using fields ${o.join(", ")}`;
389
389
  } catch (d) {
390
390
  return `Error applying chart renderer: ${d instanceof Error ? d.message : String(d)}`;
391
391
  }
392
392
  }
393
- const Kt = ["mapView"];
393
+ const Bt = ["mapView"];
394
394
  function R(e) {
395
395
  const r = e?.configurable?.context;
396
396
  if (!r || typeof r != "object")
397
397
  throw new Error("LayerStylingAgent context missing");
398
- const o = Kt.filter((a) => !(a in r));
398
+ const o = Bt.filter((a) => !(a in r));
399
399
  if (o.length)
400
400
  throw new Error(`LayerStylingAgent context missing: ${o.join(", ")}`);
401
401
  return r;
402
402
  }
403
- async function Bt({
403
+ async function Ht({
404
404
  layerId: e,
405
405
  fields: t,
406
406
  colorSchemes: r,
407
407
  includeSize: o
408
408
  }, a) {
409
409
  const { mapView: n } = R(a);
410
- return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Ut({
410
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Kt({
411
411
  arcgisMap: n.map,
412
412
  arcgisMapView: n,
413
413
  layerId: e,
@@ -416,12 +416,12 @@ async function Bt({
416
416
  includeSize: o
417
417
  });
418
418
  }
419
- const Ht = i.object({
419
+ const Jt = i.object({
420
420
  layerId: i.string().describe("The id of the layer to apply the chart renderer to"),
421
421
  fields: i.array(i.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),
422
422
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
423
423
  includeSize: i.boolean().optional().describe("Whether to vary the chart size (chart-size)")
424
- }), Nn = f(Bt, {
424
+ }), zn = f(Ht, {
425
425
  name: "chart",
426
426
  description: `Label: Charts
427
427
  Description: Show the values of two or more categories as a proportion of the total using a pie chart.
@@ -434,9 +434,9 @@ const Ht = i.object({
434
434
  Keywords: pie, chart, all categories, breakdown, proportion, total, amount, how much, sum, graduated size, proportional size
435
435
  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.
436
436
  Fields: This style requires 2-8 number fields.`,
437
- schema: Ht
437
+ schema: Jt
438
438
  });
439
- function Jt(e) {
439
+ function Zt(e) {
440
440
  const { fields: t, layer: r, view: o, theme: a, colorSchemeTags: n } = e, s = t[0];
441
441
  let c;
442
442
  return n && (c = re({
@@ -454,10 +454,10 @@ function Jt(e) {
454
454
  colorScheme: c
455
455
  };
456
456
  }
457
- async function Zt(e) {
458
- return await Me(e);
457
+ async function Yt(e) {
458
+ return await Qe(e);
459
459
  }
460
- async function Yt({
460
+ async function Xt({
461
461
  arcgisMap: e,
462
462
  arcgisMapView: t,
463
463
  layerId: r,
@@ -477,20 +477,20 @@ async function Yt({
477
477
  theme: n
478
478
  };
479
479
  try {
480
- const l = Jt(u), d = await Zt(l);
480
+ const l = Zt(u), d = await Yt(l);
481
481
  return c.renderer = d.renderer, c.visible = !0, `Color-age renderer applied to layer: ${c.title ?? c.id} using fields ${o.join(", ")}`;
482
482
  } catch (l) {
483
483
  return `Error applying color-age renderer: ${l instanceof Error ? l.message : String(l)}`;
484
484
  }
485
485
  }
486
- async function Xt({
486
+ async function er({
487
487
  layerId: e,
488
488
  fields: t,
489
489
  colorSchemes: r,
490
490
  theme: o
491
491
  }, a) {
492
492
  const { mapView: n } = R(a);
493
- return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Yt({
493
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Xt({
494
494
  arcgisMap: n.map,
495
495
  arcgisMapView: n,
496
496
  layerId: e,
@@ -499,21 +499,21 @@ async function Xt({
499
499
  theme: o
500
500
  });
501
501
  }
502
- const er = i.object({
502
+ const tr = i.object({
503
503
  layerId: i.string().describe("The id of the layer to apply the color-age renderer to"),
504
504
  fields: i.array(i.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),
505
505
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
506
506
  theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
507
- }), zn = f(Xt, {
507
+ }), qn = f(er, {
508
508
  name: "color-age",
509
509
  description: `Label: Age (color)
510
510
  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.
511
511
  Keywords: since, age, how old, how long
512
512
  Example: Show the age of each feature based on its reported date.
513
513
  Fields: This style requires at least one field with a date type.`,
514
- schema: er
514
+ schema: tr
515
515
  });
516
- function tr(e) {
516
+ function rr(e) {
517
517
  const { fields: t, layer: r, view: o, colorSchemeTags: a } = e;
518
518
  let { theme: n } = e, s = t[1];
519
519
  const c = t[0];
@@ -533,10 +533,10 @@ function tr(e) {
533
533
  colorScheme: u
534
534
  };
535
535
  }
536
- async function rr(e) {
537
- return await Qe(e);
536
+ async function or(e) {
537
+ return await _e(e);
538
538
  }
539
- async function or({
539
+ async function ar({
540
540
  arcgisMap: e,
541
541
  arcgisMapView: t,
542
542
  layerId: r,
@@ -556,20 +556,20 @@ async function or({
556
556
  theme: n
557
557
  };
558
558
  try {
559
- const l = tr(u), d = await rr(l);
559
+ const l = rr(u), d = await or(l);
560
560
  return c.renderer = d.renderer, c.visible = !0, `Color renderer applied to layer: ${c.title ?? c.id} using fields ${o.join(", ")}`;
561
561
  } catch (l) {
562
562
  return `Error applying color renderer: ${l instanceof Error ? l.message : String(l)}`;
563
563
  }
564
564
  }
565
- async function ar({
565
+ async function nr({
566
566
  layerId: e,
567
567
  fields: t,
568
568
  colorSchemes: r,
569
569
  theme: o
570
570
  }, a) {
571
571
  const { mapView: n } = R(a);
572
- return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await or({
572
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await ar({
573
573
  arcgisMap: n.map,
574
574
  arcgisMapView: n,
575
575
  layerId: e,
@@ -578,21 +578,21 @@ async function ar({
578
578
  theme: o
579
579
  });
580
580
  }
581
- const nr = i.object({
581
+ const ir = i.object({
582
582
  layerId: i.string().describe("The id of the layer to apply the color renderer to"),
583
583
  fields: i.array(i.string()).describe("The field(s) to use for the color renderer"),
584
584
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
585
585
  theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
586
- }), qn = f(ar, {
586
+ }), Dn = f(nr, {
587
587
  name: "color",
588
588
  description: `Label: Counts and Amounts (color)
589
589
  Description: Vary color along a continuous color ramp to represent numeric or ranked data.
590
590
  Keywords: graduated color, choropleth, continuous color, hue, color, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease
591
591
  Example: Color each feature based on the population density.
592
592
  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.`,
593
- schema: nr
593
+ schema: ir
594
594
  });
595
- function ir(e) {
595
+ function sr(e) {
596
596
  const { fields: t, layer: r, view: o, colorSchemeTags: a, theme: n } = e;
597
597
  let s, c;
598
598
  const u = t[0];
@@ -611,10 +611,10 @@ function ir(e) {
611
611
  }
612
612
  };
613
613
  }
614
- async function sr(e) {
615
- return await _e(e);
614
+ async function cr(e) {
615
+ return await We(e);
616
616
  }
617
- async function cr({
617
+ async function lr({
618
618
  arcgisMap: e,
619
619
  arcgisMapView: t,
620
620
  layerId: r,
@@ -634,20 +634,20 @@ async function cr({
634
634
  theme: n
635
635
  };
636
636
  try {
637
- const l = ir(u), d = await sr(l);
637
+ const l = sr(u), d = await cr(l);
638
638
  return c.renderer = d.renderer, c.visible = !0, `Color-size-univariate renderer applied to layer: ${c.title ?? c.id} using fields ${o.join(", ")}`;
639
639
  } catch (l) {
640
640
  return `Error applying color-size-univariate renderer: ${l instanceof Error ? l.message : String(l)}`;
641
641
  }
642
642
  }
643
- async function lr({
643
+ async function ur({
644
644
  layerId: e,
645
645
  fields: t,
646
646
  colorSchemes: r,
647
647
  theme: o
648
648
  }, a) {
649
649
  const { mapView: n } = R(a);
650
- return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await cr({
650
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await lr({
651
651
  arcgisMap: n.map,
652
652
  arcgisMapView: n,
653
653
  layerId: e,
@@ -656,24 +656,24 @@ async function lr({
656
656
  theme: o
657
657
  });
658
658
  }
659
- const ur = i.object({
659
+ const dr = i.object({
660
660
  layerId: i.string().describe("The id of the layer to apply the color-size univariate renderer to"),
661
661
  fields: i.array(i.string()).describe("The fields to use for the color-size univariate renderer"),
662
662
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
663
663
  theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color and size ramps")
664
- }), Dn = f(lr, {
664
+ }), An = f(ur, {
665
665
  name: "color-size-univariate",
666
666
  description: `Label: Color and Size (univariate)
667
667
  Description: Vary symbol size and color based on the values of two numeric attributes.
668
668
  Keywords: continuous color, hue, color, size, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease, amount
669
669
  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.
670
670
  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.`,
671
- schema: ur
671
+ schema: dr
672
672
  });
673
- function dr(e) {
673
+ function pr(e) {
674
674
  const { fields: t, layer: r, view: o, colorSchemeTags: a } = e;
675
675
  let n;
676
- return a && (n = Ve({
676
+ return a && (n = Ue({
677
677
  includedTags: a,
678
678
  numColors: Math.min(t.length, 8)
679
679
  })[0]), {
@@ -690,10 +690,10 @@ function dr(e) {
690
690
  dotDensityScheme: n
691
691
  };
692
692
  }
693
- async function pr(e) {
694
- return await We(e);
693
+ async function hr(e) {
694
+ return await Ve(e);
695
695
  }
696
- async function hr({
696
+ async function mr({
697
697
  arcgisMap: e,
698
698
  arcgisMapView: t,
699
699
  layerId: r,
@@ -711,19 +711,19 @@ async function hr({
711
711
  colorSchemeTags: a
712
712
  };
713
713
  try {
714
- const u = dr(c), l = await pr(u);
714
+ const u = pr(c), l = await hr(u);
715
715
  return s.renderer = l.renderer, s.visible = !0, `Dot Density renderer applied to layer: ${s.title ?? s.id} using fields ${o.join(", ")}`;
716
716
  } catch (u) {
717
717
  return `Error applying dot density renderer: ${u instanceof Error ? u.message : String(u)}`;
718
718
  }
719
719
  }
720
- async function mr({
720
+ async function yr({
721
721
  layerId: e,
722
722
  fields: t,
723
723
  colorSchemes: r
724
724
  }, o) {
725
725
  const { mapView: a } = R(o);
726
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await hr({
726
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await mr({
727
727
  arcgisMap: a.map,
728
728
  arcgisMapView: a,
729
729
  layerId: e,
@@ -731,11 +731,11 @@ async function mr({
731
731
  colorSchemes: r
732
732
  });
733
733
  }
734
- const yr = i.object({
734
+ const fr = i.object({
735
735
  layerId: i.string().describe("The id of the layer to apply the dot density renderer to"),
736
736
  fields: i.array(i.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),
737
737
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
738
- }), An = f(mr, {
738
+ }), Ln = f(yr, {
739
739
  name: "dot-density",
740
740
  description: `Dot Density
741
741
  Use dot density to visualize the distribution of one attribute or compare the density of multiple attributes. This is only valid for polygon layers.
@@ -749,13 +749,13 @@ const yr = i.object({
749
749
  - Display demographic patterns within census tracts
750
750
  **Fields:** Requires 2-8 number fields.
751
751
  **Keywords:** density, how much, how many, total, number, amount`,
752
- schema: yr
752
+ schema: fr
753
753
  });
754
- function fr(e) {
754
+ function gr(e) {
755
755
  const { fields: t, layer: r, view: o, colorSchemeTags: a } = e;
756
756
  let n;
757
757
  const s = t[0];
758
- return a && (n = Ke({
758
+ return a && (n = Be({
759
759
  includedTags: a,
760
760
  basemap: o.map?.basemap || "topo"
761
761
  })[0]), {
@@ -765,10 +765,10 @@ function fr(e) {
765
765
  heatmapScheme: n
766
766
  };
767
767
  }
768
- async function gr(e) {
769
- return await Ue(e);
768
+ async function wr(e) {
769
+ return await Ke(e);
770
770
  }
771
- async function wr({
771
+ async function br({
772
772
  arcgisMap: e,
773
773
  arcgisMapView: t,
774
774
  layerId: r,
@@ -786,19 +786,19 @@ async function wr({
786
786
  colorSchemeTags: a
787
787
  };
788
788
  try {
789
- const u = fr(c), l = await gr(u);
789
+ const u = gr(c), l = await wr(u);
790
790
  return s.renderer = l.renderer, s.visible = !0, `Heatmap renderer applied to layer: ${s.title ?? s.id} using fields ${o.join(", ")}`;
791
791
  } catch (u) {
792
792
  return `Error applying heatmap renderer: ${u instanceof Error ? u.message : String(u)}`;
793
793
  }
794
794
  }
795
- async function br({
795
+ async function Tr({
796
796
  layerId: e,
797
797
  fields: t,
798
798
  colorSchemes: r
799
799
  }, o) {
800
800
  const { mapView: a } = R(o);
801
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await wr({
801
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await br({
802
802
  arcgisMap: a.map,
803
803
  arcgisMapView: a,
804
804
  layerId: e,
@@ -806,23 +806,23 @@ async function br({
806
806
  colorSchemes: r
807
807
  });
808
808
  }
809
- const Tr = i.object({
809
+ const vr = i.object({
810
810
  layerId: i.string().describe("The id of the layer to apply the heatmap renderer to"),
811
811
  fields: i.array(i.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),
812
812
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
813
- }), Ln = f(br, {
813
+ }), Pn = f(Tr, {
814
814
  name: "heatmap",
815
815
  description: `Label: Heat Map
816
816
  Description: Show areas of high density with colors that appear to glow hotter. This is only valid for point layers.
817
817
  Keywords: density, heatmap, hot spots, pattern, cluster
818
818
  Example: Create a heatmap
819
819
  Fields: This typically requires zero or one field of type number.`,
820
- schema: Tr
820
+ schema: vr
821
821
  });
822
- function vr(e) {
822
+ function Sr(e) {
823
823
  const { fields: t, layer: r, view: o, styleName: a, colorSchemeTags: n } = e;
824
824
  let s;
825
- return n && (s = He({
825
+ return n && (s = Je({
826
826
  geometryType: r.geometryType,
827
827
  includedTags: n,
828
828
  numColors: Math.min(t.length, 10)
@@ -836,10 +836,10 @@ function vr(e) {
836
836
  predominanceScheme: s
837
837
  };
838
838
  }
839
- async function Sr(e) {
840
- return await Be(e);
839
+ async function xr(e) {
840
+ return await He(e);
841
841
  }
842
- async function xr({
842
+ async function Rr({
843
843
  arcgisMap: e,
844
844
  arcgisMapView: t,
845
845
  layerId: r,
@@ -858,20 +858,20 @@ async function xr({
858
858
  colorSchemeTags: a
859
859
  };
860
860
  try {
861
- const d = vr(l), p = await Sr(d);
861
+ const d = Sr(l), p = await xr(d);
862
862
  return c.renderer = p.renderer, c.visible = !0, `Predominance renderer applied to layer: ${c.title ?? c.id} using fields ${o.join(", ")}`;
863
863
  } catch (d) {
864
864
  return `Error applying predominance renderer: ${d instanceof Error ? d.message : String(d)}`;
865
865
  }
866
866
  }
867
- async function Rr({
867
+ async function $r({
868
868
  layerId: e,
869
869
  fields: t,
870
870
  colorSchemes: r,
871
871
  includeSize: o
872
872
  }, a) {
873
873
  const { mapView: n } = R(a);
874
- return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await xr({
874
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Rr({
875
875
  arcgisMap: n.map,
876
876
  arcgisMapView: n,
877
877
  layerId: e,
@@ -880,12 +880,12 @@ async function Rr({
880
880
  includeSize: o
881
881
  });
882
882
  }
883
- const $r = i.object({
883
+ const Er = i.object({
884
884
  layerId: i.string().describe("The id of the layer to apply the predominance renderer to"),
885
885
  fields: i.array(i.string()).describe("The fields to use for the predominance renderer (competing categories)"),
886
886
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
887
887
  includeSize: i.boolean().optional().describe("Whether to include size visualization (predominance-size)")
888
- }), Pn = f(Rr, {
888
+ }), jn = f($r, {
889
889
  name: "predominance",
890
890
  description: `Label: Predominant category
891
891
  Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
@@ -898,9 +898,9 @@ const $r = i.object({
898
898
  Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top, amount, total, how much, proportional size, graduated size, sum
899
899
  Example: Show the predominant crop in each area and vary the size of each symbol based on the total of all categories.
900
900
  Fields: This style relies on 2-10 number fields.`,
901
- schema: $r
901
+ schema: Er
902
902
  });
903
- function Er(e) {
903
+ function Cr(e) {
904
904
  const { fields: t, layer: r, view: o, colorSchemeTags: a } = e;
905
905
  let n;
906
906
  const s = {
@@ -908,7 +908,7 @@ function Er(e) {
908
908
  }, c = {
909
909
  field: t[1]
910
910
  };
911
- return a && (n = Ze({
911
+ return a && (n = Ye({
912
912
  geometryType: r.geometryType,
913
913
  includedTags: a
914
914
  })[0]), {
@@ -921,8 +921,8 @@ function Er(e) {
921
921
  relationshipScheme: n
922
922
  };
923
923
  }
924
- async function Cr(e) {
925
- return await Je(e);
924
+ async function Fr(e) {
925
+ return await Ze(e);
926
926
  }
927
927
  async function Ir({
928
928
  arcgisMap: e,
@@ -942,13 +942,13 @@ async function Ir({
942
942
  colorSchemeTags: a
943
943
  };
944
944
  try {
945
- const u = Er(c), l = await Cr(u);
945
+ const u = Cr(c), l = await Fr(u);
946
946
  return s.renderer = l.renderer, s.visible = !0, `Relationship renderer applied to layer: ${s.title ?? s.id} using fields ${o.join(", ")}`;
947
947
  } catch (u) {
948
948
  return `Error applying relationship renderer: ${u instanceof Error ? u.message : String(u)}`;
949
949
  }
950
950
  }
951
- async function Fr({
951
+ async function kr({
952
952
  layerId: e,
953
953
  fields: t,
954
954
  colorSchemes: r
@@ -962,20 +962,20 @@ async function Fr({
962
962
  colorSchemes: r
963
963
  });
964
964
  }
965
- const kr = i.object({
965
+ const Nr = i.object({
966
966
  layerId: i.string().describe("The id of the layer to apply the relationship renderer to"),
967
967
  fields: i.array(i.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),
968
968
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
969
- }), jn = f(Fr, {
969
+ }), Gn = f(kr, {
970
970
  name: "relationship",
971
971
  description: `Label: Relationship
972
972
  Description: Overlays two color ramps to represent the relationship between two numeric attributes.
973
973
  Keywords: relationship, correlation, compare, related, bivariate choropleth, bivariate color
974
974
  Example: Show the relationship between tree height and carbon storage
975
975
  Fields: This style requires two number fields.`,
976
- schema: kr
976
+ schema: Nr
977
977
  });
978
- function Nr(e) {
978
+ function zr(e) {
979
979
  const { fields: t, layer: r, view: o, theme: a } = e, n = t[0];
980
980
  return {
981
981
  layer: r,
@@ -987,10 +987,10 @@ function Nr(e) {
987
987
  outlineOptimizationEnabled: !0
988
988
  };
989
989
  }
990
- async function zr(e) {
991
- return await Ye(e);
990
+ async function qr(e) {
991
+ return await Xe(e);
992
992
  }
993
- async function qr({
993
+ async function Dr({
994
994
  arcgisMap: e,
995
995
  arcgisMapView: t,
996
996
  layerId: r,
@@ -1010,20 +1010,20 @@ async function qr({
1010
1010
  theme: n
1011
1011
  };
1012
1012
  try {
1013
- const l = Nr(u), d = await zr(l);
1013
+ const l = zr(u), d = await qr(l);
1014
1014
  return c.renderer = d.renderer, c.visible = !0, `Size-age renderer applied to layer: ${c.title ?? c.id} using fields ${o.join(", ")}`;
1015
1015
  } catch (l) {
1016
1016
  return `Error applying size-age renderer: ${l instanceof Error ? l.message : String(l)}`;
1017
1017
  }
1018
1018
  }
1019
- async function Dr({
1019
+ async function Ar({
1020
1020
  layerId: e,
1021
1021
  fields: t,
1022
1022
  colorSchemes: r,
1023
1023
  theme: o
1024
1024
  }, a) {
1025
1025
  const { mapView: n } = R(a);
1026
- return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await qr({
1026
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Dr({
1027
1027
  arcgisMap: n.map,
1028
1028
  arcgisMapView: n,
1029
1029
  layerId: e,
@@ -1032,21 +1032,21 @@ async function Dr({
1032
1032
  theme: o
1033
1033
  });
1034
1034
  }
1035
- const Ar = i.object({
1035
+ const Lr = i.object({
1036
1036
  layerId: i.string().describe("The id of the layer to apply the size-age renderer to"),
1037
1037
  fields: i.array(i.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),
1038
1038
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
1039
1039
  theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
1040
- }), Gn = f(Dr, {
1040
+ }), On = f(Ar, {
1041
1041
  name: "size-age",
1042
1042
  description: `Label: Age (size)
1043
1043
  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.
1044
1044
  Keywords: since, age, how old, how long
1045
1045
  Example: Change the size of features so older features are larger than new features.
1046
1046
  Fields: This style requires at least one field with a date type.`,
1047
- schema: Ar
1047
+ schema: Lr
1048
1048
  });
1049
- function Lr(e) {
1049
+ function Pr(e) {
1050
1050
  const { fields: t, layer: r, view: o } = e;
1051
1051
  let { theme: a } = e, n = t[1];
1052
1052
  const s = t[0];
@@ -1060,10 +1060,10 @@ function Lr(e) {
1060
1060
  outlineOptimizationEnabled: !0
1061
1061
  };
1062
1062
  }
1063
- async function Pr(e) {
1064
- return await Xe(e);
1063
+ async function jr(e) {
1064
+ return await et(e);
1065
1065
  }
1066
- async function jr({
1066
+ async function Gr({
1067
1067
  arcgisMap: e,
1068
1068
  arcgisMapView: t,
1069
1069
  layerId: r,
@@ -1083,20 +1083,20 @@ async function jr({
1083
1083
  theme: n
1084
1084
  };
1085
1085
  try {
1086
- const l = Lr(u), d = await Pr(l);
1086
+ const l = Pr(u), d = await jr(l);
1087
1087
  return c.renderer = d.renderer, c.visible = !0, `Size renderer applied to layer: ${c.title ?? c.id} using fields ${o.join(", ")}`;
1088
1088
  } catch (l) {
1089
1089
  return `Error applying size renderer: ${l instanceof Error ? l.message : String(l)}`;
1090
1090
  }
1091
1091
  }
1092
- async function Gr({
1092
+ async function Or({
1093
1093
  layerId: e,
1094
1094
  fields: t,
1095
1095
  colorSchemes: r,
1096
1096
  theme: o
1097
1097
  }, a) {
1098
1098
  const { mapView: n } = R(a);
1099
- return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await jr({
1099
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Gr({
1100
1100
  arcgisMap: n.map,
1101
1101
  arcgisMapView: n,
1102
1102
  layerId: e,
@@ -1105,12 +1105,12 @@ async function Gr({
1105
1105
  theme: o
1106
1106
  });
1107
1107
  }
1108
- const Or = i.object({
1108
+ const Mr = i.object({
1109
1109
  layerId: i.string().describe("The id of the layer to apply the size renderer to"),
1110
1110
  fields: i.array(i.string()).describe("The field(s) to use for the size renderer (numeric data)"),
1111
1111
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
1112
1112
  theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
1113
- }), On = f(Gr, {
1113
+ }), Mn = f(Or, {
1114
1114
  name: "size",
1115
1115
  description: `Label: Counts and Amounts (size)
1116
1116
  Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
@@ -1123,12 +1123,12 @@ const Or = i.object({
1123
1123
  Keywords: graduated size, proportional size, classed size, how much, total, number, when
1124
1124
  Example: Vary the size of each feature based on the date a ticket was completed.
1125
1125
  Fields: This style requires a single field with a date type.`,
1126
- schema: Or
1126
+ schema: Mr
1127
1127
  });
1128
- function Mr(e) {
1128
+ function Qr(e) {
1129
1129
  const { fields: t, layer: r, view: o, colorSchemeTags: a } = e, n = t[0], s = t[1], c = t[2];
1130
1130
  let u;
1131
- return a && (u = tt({
1131
+ return a && (u = rt({
1132
1132
  geometryType: r.geometryType,
1133
1133
  includedTags: a
1134
1134
  })[0]), {
@@ -1142,10 +1142,10 @@ function Mr(e) {
1142
1142
  typeScheme: u
1143
1143
  };
1144
1144
  }
1145
- async function Qr(e) {
1146
- return await et(e);
1145
+ async function _r(e) {
1146
+ return await tt(e);
1147
1147
  }
1148
- async function _r({
1148
+ async function Wr({
1149
1149
  arcgisMap: e,
1150
1150
  arcgisMapView: t,
1151
1151
  layerId: r,
@@ -1165,20 +1165,20 @@ async function _r({
1165
1165
  theme: n
1166
1166
  };
1167
1167
  try {
1168
- const l = Mr(u), d = await Qr(l);
1168
+ const l = Qr(u), d = await _r(l);
1169
1169
  return c.renderer = d.renderer, c.visible = !0, `Type renderer applied to layer: ${c.title ?? c.id} using fields ${o.join(", ")}`;
1170
1170
  } catch (l) {
1171
1171
  return `Error applying type renderer: ${l instanceof Error ? l.message : String(l)}`;
1172
1172
  }
1173
1173
  }
1174
- async function Wr({
1174
+ async function Vr({
1175
1175
  layerId: e,
1176
1176
  fields: t,
1177
1177
  colorSchemes: r,
1178
1178
  theme: o
1179
1179
  }, a) {
1180
1180
  const { mapView: n } = R(a);
1181
- return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await _r({
1181
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Wr({
1182
1182
  arcgisMap: n.map,
1183
1183
  arcgisMapView: n,
1184
1184
  layerId: e,
@@ -1187,74 +1187,74 @@ async function Wr({
1187
1187
  theme: o
1188
1188
  });
1189
1189
  }
1190
- const Vr = i.object({
1190
+ const Ur = i.object({
1191
1191
  layerId: i.string().describe("The id of the layer to apply the type renderer to"),
1192
1192
  fields: i.array(i.string()).describe("The field(s) to use for the type renderer (categorical data)"),
1193
1193
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
1194
1194
  theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color scheme")
1195
- }), Mn = f(Wr, {
1195
+ }), Qn = f(Vr, {
1196
1196
  name: "type",
1197
1197
  description: `Label: Types (unique symbols)
1198
1198
  Description: Represent features as categories with different symbol colors or shapes. Examples include type of tree, road class, or province name.
1199
1199
  Keywords: categorical, category, type, unique, discrete, point of interest, region, group
1200
1200
  Example: Color each feature based on the region it belongs to
1201
1201
  Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,
1202
- schema: Vr
1203
- }), Qn = b.Root({
1202
+ schema: Ur
1203
+ }), _n = b.Root({
1204
1204
  ...U(),
1205
1205
  vectorSearchLayerIds: b(),
1206
1206
  vectorSearchFieldResults: b(),
1207
1207
  layerFieldInfo: b(),
1208
1208
  selectedLayerId: b()
1209
- }), _n = b.Root({
1209
+ }), Wn = b.Root({
1210
1210
  ...U(),
1211
1211
  vectorSearchLayerIds: b(),
1212
1212
  vectorSearchFieldResults: b(),
1213
1213
  layerFieldInfo: b(),
1214
1214
  queryResponse: b(),
1215
1215
  dataExplorationMessages: b({
1216
- reducer: me,
1216
+ reducer: ye,
1217
1217
  default: () => []
1218
1218
  })
1219
- }), Ur = ["mapView"];
1219
+ }), Kr = ["mapView"];
1220
1220
  function N(e) {
1221
1221
  const r = e?.configurable?.context;
1222
1222
  if (!r || typeof r != "object")
1223
1223
  throw new Error("DataExplorationAgent context missing");
1224
- const o = Ur.filter((a) => !(a in r));
1224
+ const o = Kr.filter((a) => !(a in r));
1225
1225
  if (o.length)
1226
1226
  throw new Error(`DataExplorationAgent context missing: ${o.join(", ")}`);
1227
1227
  return r;
1228
1228
  }
1229
- const Kr = (e) => {
1229
+ const Br = (e) => {
1230
1230
  const t = e.map?.allLayers.filter((o) => o.type === "feature");
1231
1231
  let r = 0;
1232
1232
  return t?.forEach((o) => {
1233
1233
  const a = o;
1234
1234
  a.featureEffect && (a.featureEffect = null, r++);
1235
1235
  }), r > 0 ? `Cleared filters from ${r} layer(s). View unchanged.` : "No active filters to clear. View unchanged.";
1236
- }, Br = async (e, t) => {
1236
+ }, Hr = async (e, t) => {
1237
1237
  const { mapView: r } = N(t);
1238
- return Kr(r);
1239
- }, Hr = f(Br, {
1238
+ return Br(r);
1239
+ }, Jr = f(Hr, {
1240
1240
  name: "clearFilters",
1241
1241
  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.",
1242
1242
  schema: i.object({})
1243
- }), Jr = async (e) => {
1243
+ }), Zr = async (e) => {
1244
1244
  e.map?.allLayers.filter((a) => a.type === "feature")?.forEach((a) => {
1245
1245
  const n = a;
1246
1246
  n.featureEffect && (n.featureEffect = null);
1247
1247
  });
1248
1248
  const o = e.map.initialViewProperties?.viewpoint?.targetGeometry;
1249
1249
  return o ? (await e.goTo(o), "Cleared all filters and returned to home extent.") : "Cleared all filters. Could not determine home extent.";
1250
- }, Zr = async (e, t) => {
1250
+ }, Yr = async (e, t) => {
1251
1251
  const { mapView: r } = N(t);
1252
- return await Jr(r);
1253
- }, Yr = f(Zr, {
1252
+ return await Zr(r);
1253
+ }, Xr = f(Yr, {
1254
1254
  name: "resetMap",
1255
1255
  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.",
1256
1256
  schema: i.object({})
1257
- });
1257
+ }), me = 5;
1258
1258
  function W(e) {
1259
1259
  return "point" in e && e.point !== void 0;
1260
1260
  }
@@ -1264,7 +1264,7 @@ function P(e) {
1264
1264
  const K = async (e, t) => {
1265
1265
  if (W(e)) {
1266
1266
  const { point: r } = e;
1267
- return { geometry: new ye({
1267
+ return { geometry: new fe({
1268
1268
  x: r.x,
1269
1269
  y: r.y,
1270
1270
  spatialReference: r.spatialReference ? { wkid: r.spatialReference.wkid } : t.spatialReference
@@ -1272,40 +1272,37 @@ const K = async (e, t) => {
1272
1272
  }
1273
1273
  if (P(e)) {
1274
1274
  const r = t.map?.allLayers.find(
1275
- (a) => a.id === e.layerId
1275
+ (n) => n.id === e.layerId
1276
1276
  );
1277
1277
  if (!r)
1278
1278
  return { error: `Could not find geometry layer with ID: ${e.layerId}` };
1279
- const o = r.title ?? r.id;
1279
+ const o = r.title ?? r.id, a = e.where?.trim() || "1=1";
1280
1280
  try {
1281
- const a = await r.queryFeatures({
1282
- where: e.where,
1281
+ const n = await r.queryFeatures({
1282
+ where: a,
1283
1283
  returnGeometry: !0,
1284
- outSpatialReference: t.spatialReference
1284
+ outSpatialReference: t.spatialReference,
1285
+ num: me + 1
1285
1286
  });
1286
- if (!a.features.length)
1287
+ if (!n.features.length)
1287
1288
  return {
1288
- error: `No features found in geometry layer "${o}" with the specified where clause: ${e.where}`
1289
+ error: `No features found in geometry layer "${o}" with the specified where clause: ${a}`
1289
1290
  };
1290
- let n;
1291
- if (a.features.length === 1) {
1292
- const s = a.features[0].geometry;
1293
- if (!s)
1294
- return { error: "The geometry of the first feature is undefined or null." };
1295
- n = s;
1296
- } else {
1297
- const s = a.features.map((u) => u.geometry), c = at.executeMany(s);
1298
- if (!c)
1299
- return { error: "Failed to create a combined geometry." };
1300
- n = c;
1301
- }
1302
- return n.spatialReference || (n.spatialReference = t.spatialReference), { geometry: n };
1303
- } catch (a) {
1304
- return { error: `Failed to query geometry: ${String(a)}` };
1291
+ if (n.features.length > me)
1292
+ return {
1293
+ error: `Geometry filter for layer "${o}" matched too many features (${n.features.length}+). Please narrow the geometry layer filter.`
1294
+ };
1295
+ const s = n.features.map((u) => u.geometry).filter((u) => !!u);
1296
+ if (!s.length)
1297
+ return { error: "No valid geometries found for the matched geometry layer features." };
1298
+ const c = s.length === 1 ? s[0] : nt.executeMany(s);
1299
+ return c ? (c.spatialReference || (c.spatialReference = t.spatialReference), { geometry: c }) : { error: "Failed to combine geometries from geometry layer." };
1300
+ } catch (n) {
1301
+ return { error: `Failed to query geometry: ${String(n)}` };
1305
1302
  }
1306
1303
  }
1307
1304
  return { error: "Invalid geometry configuration provided" };
1308
- }, Xr = async (e, t, r, o, a, n) => {
1305
+ }, eo = async (e, t, r, o, a, n) => {
1309
1306
  const s = e.map?.allLayers.find((u) => u.id === t);
1310
1307
  if (!s)
1311
1308
  return { success: !1, error: `Layer '${t}' not found.` };
@@ -1323,7 +1320,7 @@ const K = async (e, t) => {
1323
1320
  error: u instanceof Error ? u.message : String(u)
1324
1321
  };
1325
1322
  }
1326
- }, eo = async (e, t, r, o, a, n) => {
1323
+ }, to = async (e, t, r, o, a, n) => {
1327
1324
  const s = t.map?.allLayers.find(
1328
1325
  (p) => p.id === e.layerId
1329
1326
  );
@@ -1336,8 +1333,8 @@ const K = async (e, t) => {
1336
1333
  return p.error;
1337
1334
  c = p.geometry;
1338
1335
  }
1339
- if (s.featureEffect = null, s.featureEffect = new ot({
1340
- filter: new fe({
1336
+ if (s.featureEffect = null, s.featureEffect = new at({
1337
+ filter: new ge({
1341
1338
  ...e.objectIds?.length ? { objectIds: e.objectIds } : { where: e.where },
1342
1339
  geometry: c,
1343
1340
  spatialRelationship: "intersects",
@@ -1348,7 +1345,7 @@ const K = async (e, t) => {
1348
1345
  excludedEffect: o
1349
1346
  }), s.visible = !0, n)
1350
1347
  return `Applied feature effects to "${s.title ?? e.layerId}" within current map extent.`;
1351
- const u = e.objectIds?.length ? `${s.objectIdField} IN (${e.objectIds.join(",")})` : e.where, l = await Xr(
1348
+ const u = e.objectIds?.length ? `${s.objectIdField} IN (${e.objectIds.join(",")})` : e.where, l = await eo(
1352
1349
  t,
1353
1350
  e.layerId,
1354
1351
  u,
@@ -1357,7 +1354,7 @@ const K = async (e, t) => {
1357
1354
  a?.units
1358
1355
  ), d = s.title ?? e.layerId;
1359
1356
  return l.success ? `Applied feature effects to target layer "${s.title ?? e.layerId}"${a && "layerId" in a ? ` using geometry from layer "${a.layerId}"` : ""}.` : `Applied filter to "${d}" but no features matched. ${l.error}`;
1360
- }, to = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], I = i.enum(to), ro = async ({
1357
+ }, ro = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], F = i.enum(ro), oo = async ({
1361
1358
  targetLayer: e,
1362
1359
  geometryFilter: t,
1363
1360
  useCurrentExtent: r,
@@ -1365,13 +1362,13 @@ const K = async (e, t) => {
1365
1362
  excludedEffect: a = "grayscale(100%) opacity(60%) blur(2px)"
1366
1363
  }, n) => {
1367
1364
  const { mapView: s } = N(n);
1368
- return await eo(e, s, o, a, t, r);
1369
- }, oo = i.object({
1365
+ return await to(e, s, o, a, t, r);
1366
+ }, ao = i.object({
1370
1367
  layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
1371
1368
  where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
1372
1369
  distance: i.number().optional().describe("The buffer distance around the geometry."),
1373
- units: I.optional().describe("The units for the distance buffer.")
1374
- }), ao = i.object({
1370
+ units: F.optional().describe("The units for the distance buffer.")
1371
+ }), no = i.object({
1375
1372
  point: i.object({
1376
1373
  x: i.number().describe("X coordinate (longitude) from navigation result"),
1377
1374
  y: i.number().describe("Y coordinate (latitude) from navigation result"),
@@ -1380,8 +1377,8 @@ const K = async (e, t) => {
1380
1377
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1381
1378
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1382
1379
  distance: i.number().optional().describe("Optional buffer distance around the point."),
1383
- units: I.optional().describe("The units for the distance buffer.")
1384
- }), no = i.object({
1380
+ units: F.optional().describe("The units for the distance buffer.")
1381
+ }), io = i.object({
1385
1382
  targetLayer: i.object({
1386
1383
  layerId: i.string().describe("The layerId of the layer on which to set a feature effect."),
1387
1384
  where: i.string().describe("The SQL-92 where clause representing the features to emphasize."),
@@ -1389,7 +1386,7 @@ const K = async (e, t) => {
1389
1386
  "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."
1390
1387
  )
1391
1388
  }),
1392
- geometryFilter: i.union([oo, ao]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
1389
+ geometryFilter: i.union([ao, no]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
1393
1390
  useCurrentExtent: i.boolean().optional().describe(
1394
1391
  "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."
1395
1392
  ),
@@ -1399,10 +1396,10 @@ const K = async (e, t) => {
1399
1396
  excludedEffect: i.string().default("grayscale(100%) opacity(60%) blur(2px)").describe(
1400
1397
  "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."
1401
1398
  )
1402
- }), io = f(ro, {
1399
+ }), so = f(oo, {
1403
1400
  name: "setFeatureEffect",
1404
1401
  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.",
1405
- schema: no
1402
+ schema: io
1406
1403
  }), X = (e) => {
1407
1404
  if (e instanceof Date)
1408
1405
  return Number.isNaN(e.getTime()) ? null : e;
@@ -1411,23 +1408,23 @@ const K = async (e, t) => {
1411
1408
  return Number.isNaN(t.getTime()) ? null : t;
1412
1409
  }
1413
1410
  return null;
1414
- }, so = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, co = (e) => {
1411
+ }, co = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, lo = (e) => {
1415
1412
  if (typeof e == "string" && e)
1416
1413
  return e;
1417
1414
  const t = X(e);
1418
1415
  return t ? t.toISOString().slice(0, 10) : null;
1419
- }, Wn = () => {
1416
+ }, Vn = () => {
1420
1417
  const e = (/* @__PURE__ */ new Date()).getTimezoneOffset(), t = e <= 0 ? "+" : "-", r = Math.floor(Math.abs(e) / 60).toString().padStart(2, "0"), o = (Math.abs(e) % 60).toString().padStart(2, "0"), a = `${t}${r}:${o}`;
1421
1418
  return { userTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone, userTimezoneOffset: a };
1422
- }, lo = (e, t, r) => {
1419
+ }, uo = (e, t, r) => {
1423
1420
  const o = t?.toLowerCase();
1424
1421
  if (o === "date-only") {
1425
- const n = co(e);
1426
- return n ? nt(n, M("short-date")) : e;
1422
+ const n = lo(e);
1423
+ return n ? it(n, M("short-date")) : e;
1427
1424
  }
1428
1425
  if (o === "time-only") {
1429
1426
  if (typeof e == "string" && e)
1430
- return it(e, M("long-time"));
1427
+ return st(e, M("long-time"));
1431
1428
  const n = X(e);
1432
1429
  return n ? de(n, {
1433
1430
  ...M("long-time"),
@@ -1437,9 +1434,9 @@ const K = async (e, t) => {
1437
1434
  const a = X(e);
1438
1435
  return a ? de(a, {
1439
1436
  ...M("short-date-short-time"),
1440
- timeZone: so(r)
1437
+ timeZone: co(r)
1441
1438
  }) : e;
1442
- }, be = (e, t, r) => {
1439
+ }, Te = (e, t, r) => {
1443
1440
  if (e && typeof e != "function") {
1444
1441
  const o = "getField" in r && r.getField?.(e), a = o && "getFieldDomain" in r && r.getFieldDomain ? r.getFieldDomain(o.name) : null;
1445
1442
  if (a?.type === "coded-value") {
@@ -1448,7 +1445,7 @@ const K = async (e, t) => {
1448
1445
  }
1449
1446
  }
1450
1447
  return null;
1451
- }, uo = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, po = (e) => {
1448
+ }, po = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, ho = (e) => {
1452
1449
  if (e instanceof Date)
1453
1450
  return Number.isNaN(e.getTime()) ? null : e;
1454
1451
  if (typeof e == "number" && Number.isFinite(e)) {
@@ -1460,7 +1457,7 @@ const K = async (e, t) => {
1460
1457
  return Number.isNaN(t.getTime()) ? null : t;
1461
1458
  }
1462
1459
  return null;
1463
- }, ho = (e, t) => {
1460
+ }, mo = (e, t) => {
1464
1461
  if (typeof e != "number")
1465
1462
  return e;
1466
1463
  const r = {};
@@ -1470,26 +1467,26 @@ const K = async (e, t) => {
1470
1467
  } catch {
1471
1468
  return e;
1472
1469
  }
1473
- }, mo = (e, t, r) => {
1474
- const o = po(e);
1470
+ }, yo = (e, t, r) => {
1471
+ const o = ho(e);
1475
1472
  if (!o)
1476
1473
  return e;
1477
1474
  const a = {};
1478
- t.dateStyle ? a.dateStyle = t.dateStyle : (t.year && (a.year = t.year), t.month && (a.month = t.month)), t.timeStyle && (a.timeStyle = t.timeStyle), t.timeStyle && t.hour12 === "always" ? a.hour12 = !0 : t.timeStyle && t.hour12 === "never" && (a.hour12 = !1), a.timeZone = uo(r);
1475
+ t.dateStyle ? a.dateStyle = t.dateStyle : (t.year && (a.year = t.year), t.month && (a.month = t.month)), t.timeStyle && (a.timeStyle = t.timeStyle), t.timeStyle && t.hour12 === "always" ? a.hour12 = !0 : t.timeStyle && t.hour12 === "never" && (a.hour12 = !1), a.timeZone = po(r);
1479
1476
  try {
1480
1477
  return new Intl.DateTimeFormat(void 0, a).format(o);
1481
1478
  } catch {
1482
1479
  return e;
1483
1480
  }
1484
- }, Te = (e, t) => e.getFieldAlias?.(t) ?? e.fieldsIndex?.get(t)?.alias ?? e.fieldsIndex?.get(t)?.name ?? t, ve = (e, t, r, o, a) => {
1481
+ }, ve = (e, t) => e.getFieldAlias?.(t) ?? e.fieldsIndex?.get(t)?.alias ?? e.fieldsIndex?.get(t)?.name ?? t, Se = (e, t, r, o, a) => {
1485
1482
  if (r == null)
1486
1483
  return r;
1487
1484
  const s = e.getFieldConfiguration?.(t)?.fieldFormat;
1488
- return s?.type === "number" ? ho(r, s) : s?.type === "date-time" ? mo(r, s, a) : lo(r, o, a);
1489
- }, yo = (e, t, r, o) => {
1490
- const a = e.fieldsIndex?.get(t), n = be(t, r, e) ?? r;
1491
- return ve(e, t, n, a?.type, o);
1492
- }, fo = (e, t) => Te(e, t), Se = (e, t, r) => {
1485
+ return s?.type === "number" ? mo(r, s) : s?.type === "date-time" ? yo(r, s, a) : uo(r, o, a);
1486
+ }, fo = (e, t, r, o) => {
1487
+ const a = e.fieldsIndex?.get(t), n = Te(t, r, e) ?? r;
1488
+ return Se(e, t, n, a?.type, o);
1489
+ }, go = (e, t) => ve(e, t), xe = (e, t, r) => {
1493
1490
  const o = e.objectIdField, a = t.features.map(
1494
1491
  (s) => s.attributes[o]
1495
1492
  ), n = t.features.map((s) => {
@@ -1502,16 +1499,16 @@ const K = async (e, t) => {
1502
1499
  u[l.name] = d;
1503
1500
  return;
1504
1501
  }
1505
- const p = be(l.name, d, e) ?? d, h = Te(e, l.name);
1506
- u[h] = ve(e, l.name, p, l.type, r);
1502
+ const p = Te(l.name, d, e) ?? d, h = ve(e, l.name);
1503
+ u[h] = Se(e, l.name, p, l.type, r);
1507
1504
  }), u;
1508
1505
  });
1509
1506
  return { objectIds: a, attributes: n };
1510
- }, go = (e, t, r) => {
1507
+ }, wo = (e, t, r) => {
1511
1508
  const o = e.createQuery();
1512
1509
  return o.outFields = [t], o.where = r || "1=1", o.num = 1, o;
1513
- }, wo = async (e, t, r, o) => {
1514
- const a = o.map?.allLayers.find((h) => h.id === e), n = go(a, t, r.where), c = (await a.queryFeatures(n)).features[0], u = c ? c.attributes[t] : null, l = yo(a, t, u, o.timeZone), d = fo(a, t);
1510
+ }, bo = async (e, t, r, o) => {
1511
+ const a = o.map?.allLayers.find((h) => h.id === e), n = wo(a, t, r.where), c = (await a.queryFeatures(n)).features[0], u = c ? c.attributes[t] : null, l = fo(a, t, u, o.timeZone), d = go(a, t);
1515
1512
  return {
1516
1513
  tool: "getAttribute",
1517
1514
  layerName: a.title ?? e,
@@ -1524,26 +1521,26 @@ const K = async (e, t) => {
1524
1521
  }
1525
1522
  };
1526
1523
  };
1527
- async function bo({ layerId: e, fieldName: t, query: r }, o) {
1528
- const { mapView: a } = N(o), n = await wo(e, t, r, a);
1524
+ async function To({ layerId: e, fieldName: t, query: r }, o) {
1525
+ const { mapView: a } = N(o), n = await bo(e, t, r, a);
1529
1526
  return JSON.stringify(n, null, 2);
1530
1527
  }
1531
- const To = i.object({
1528
+ const vo = i.object({
1532
1529
  layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1533
1530
  fieldName: i.string().describe("The name of the field/attribute from which to get a field value."),
1534
1531
  query: i.object({
1535
1532
  where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1536
1533
  })
1537
- }), vo = f(bo, {
1534
+ }), So = f(To, {
1538
1535
  name: "getAttribute",
1539
1536
  description: "Returns an attribute value for a given feature.",
1540
- schema: To
1537
+ schema: vo
1541
1538
  }), oe = (e, t, r) => r ? e.hasAllFeaturesInView && e.availableFields === t : e.hasAllFeatures && e.availableFields === t;
1542
1539
  function V(e, t) {
1543
1540
  let r = e ?? "";
1544
1541
  return t != null && t && (r = r ? `(${r}) AND (${t})` : t), r || null;
1545
1542
  }
1546
- const So = async (e) => {
1543
+ const xo = async (e) => {
1547
1544
  const { targetLayer: t, fieldName: r, statisticType: o, mapView: a, layersAndFieldsRegistry: n, geometryFilter: s } = e, c = a.map?.allLayers.find((v) => v.id === t.layerId);
1548
1545
  if (!c)
1549
1546
  throw new Error(`Layer '${t.layerId}' not found.`);
@@ -1573,7 +1570,7 @@ const So = async (e) => {
1573
1570
  units: s.units,
1574
1571
  applied: !0
1575
1572
  });
1576
- m = new fe({
1573
+ m = new ge({
1577
1574
  geometry: v.geometry,
1578
1575
  distance: s.distance,
1579
1576
  units: s.units,
@@ -1594,16 +1591,16 @@ const So = async (e) => {
1594
1591
  ...m && { filter: m },
1595
1592
  outStatisticTypes: { include: [o] }
1596
1593
  };
1597
- y = await st(v);
1594
+ y = await ct(v);
1598
1595
  const O = ["string", "small-integer", "integer"], A = d.domain?.type === "coded-value" ? d.domain : null;
1599
- (O.includes(d.type) || A) && (g = (await ct({
1596
+ (O.includes(d.type) || A) && (g = (await lt({
1600
1597
  layer: c,
1601
1598
  useFeaturesInView: w,
1602
1599
  view: w ? a : void 0,
1603
1600
  field: r,
1604
1601
  sqlWhere: V(c.definitionExpression, t.where),
1605
1602
  ...m && { filter: m }
1606
- })).uniqueValueInfos.sort((q, ke) => ke.count - q.count).slice(0, T)), g && d.domain?.type === "coded-value" && (g = g.map((q) => ({
1603
+ })).uniqueValueInfos.sort((q, Ne) => Ne.count - q.count).slice(0, T)), g && d.domain?.type === "coded-value" && (g = g.map((q) => ({
1607
1604
  ...q,
1608
1605
  value: A ? A.getName(q.value) ?? q.value : q.value
1609
1606
  })));
@@ -1626,13 +1623,13 @@ const So = async (e) => {
1626
1623
  }
1627
1624
  };
1628
1625
  };
1629
- async function xo({
1626
+ async function Ro({
1630
1627
  targetLayer: e,
1631
1628
  fieldName: t,
1632
1629
  statisticType: r,
1633
1630
  geometryFilter: o
1634
1631
  }, a) {
1635
- const n = we(a, "layersAndFieldsRegistry"), { mapView: s } = N(a), c = await So({
1632
+ const n = be(a, "layersAndFieldsRegistry"), { mapView: s } = N(a), c = await xo({
1636
1633
  targetLayer: e,
1637
1634
  fieldName: t,
1638
1635
  statisticType: r,
@@ -1642,12 +1639,12 @@ async function xo({
1642
1639
  });
1643
1640
  return JSON.stringify(c, null, 2);
1644
1641
  }
1645
- const Ro = i.object({
1642
+ const $o = i.object({
1646
1643
  layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
1647
1644
  where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
1648
1645
  distance: i.number().optional().describe("The buffer distance around the geometry."),
1649
- units: I.optional().describe("The units for the distance buffer.")
1650
- }), $o = i.object({
1646
+ units: F.optional().describe("The units for the distance buffer.")
1647
+ }), Eo = i.object({
1651
1648
  point: i.object({
1652
1649
  x: i.number().describe("X coordinate (longitude) from navigation result"),
1653
1650
  y: i.number().describe("Y coordinate (latitude) from navigation result"),
@@ -1656,18 +1653,18 @@ const Ro = i.object({
1656
1653
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1657
1654
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1658
1655
  distance: i.number().optional().describe("Optional buffer distance around the point."),
1659
- units: I.optional().describe("The units for the distance buffer.")
1660
- }), Eo = i.object({
1656
+ units: F.optional().describe("The units for the distance buffer.")
1657
+ }), Co = i.object({
1661
1658
  targetLayer: i.object({
1662
1659
  layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1663
1660
  where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1664
1661
  }),
1665
- geometryFilter: i.union([Ro, $o]).optional().describe(
1662
+ geometryFilter: i.union([$o, Eo]).optional().describe(
1666
1663
  "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."
1667
1664
  ),
1668
1665
  fieldName: i.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
1669
1666
  statisticType: i.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
1670
- }), Co = f(xo, {
1667
+ }), Fo = f(Ro, {
1671
1668
  name: "getStatistics",
1672
1669
  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.
1673
1670
 
@@ -1682,7 +1679,7 @@ DO NOT USE FOR:
1682
1679
  - Simple counts of features matching a condition — use queryFeatures instead
1683
1680
 
1684
1681
  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.`,
1685
- schema: Eo
1682
+ schema: Co
1686
1683
  }), Io = async (e, t, r, o, a) => {
1687
1684
  const n = r.map?.allLayers.find((h) => h.id === e.layerId), s = await r.whenLayerView(n), c = n.title ?? e.layerId;
1688
1685
  let u;
@@ -1710,7 +1707,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1710
1707
  try {
1711
1708
  let h;
1712
1709
  if (l) {
1713
- const y = new lt({
1710
+ const y = new ut({
1714
1711
  where: e.where || "1=1",
1715
1712
  outFields: p,
1716
1713
  orderByFields: e.orderByFields,
@@ -1718,7 +1715,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1718
1715
  spatialRelationship: u ? "intersects" : void 0,
1719
1716
  distance: o?.distance,
1720
1717
  units: o?.units,
1721
- topFilter: new ut({
1718
+ topFilter: new dt({
1722
1719
  topCount: t.topCount,
1723
1720
  groupByFields: t.groupByFields,
1724
1721
  orderByFields: t.orderByFields
@@ -1735,7 +1732,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1735
1732
  console.warn("Client-side query failed, falling back to server:", T), h = await n.queryFeatures(y);
1736
1733
  }
1737
1734
  }
1738
- const m = h.features.map((y) => y.attributes[d]), { attributes: w } = Se(n, h, r.timeZone);
1735
+ const m = h.features.map((y) => y.attributes[d]), { attributes: w } = xe(n, h, r.timeZone);
1739
1736
  return {
1740
1737
  tool: "getTopFeatures",
1741
1738
  layerName: c,
@@ -1758,7 +1755,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1758
1755
  details: { error: h instanceof Error ? h.message : String(h) }
1759
1756
  };
1760
1757
  }
1761
- }, Fo = async ({
1758
+ }, ko = async ({
1762
1759
  targetLayer: e,
1763
1760
  topFilter: t,
1764
1761
  geometryFilter: r,
@@ -1766,12 +1763,12 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1766
1763
  }, a) => {
1767
1764
  const { mapView: n } = N(a), s = await Io(e, t, n, r, o);
1768
1765
  return JSON.stringify(s, null, 2);
1769
- }, ko = i.object({
1766
+ }, No = i.object({
1770
1767
  layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
1771
1768
  where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
1772
1769
  distance: i.number().optional().describe("The buffer distance around the geometry."),
1773
- units: I.optional().describe("The units for the distance buffer.")
1774
- }), No = i.object({
1770
+ units: F.optional().describe("The units for the distance buffer.")
1771
+ }), zo = i.object({
1775
1772
  point: i.object({
1776
1773
  x: i.number().describe("X coordinate (longitude) from navigation result"),
1777
1774
  y: i.number().describe("Y coordinate (latitude) from navigation result"),
@@ -1780,8 +1777,8 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1780
1777
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1781
1778
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1782
1779
  distance: i.number().optional().describe("Optional buffer distance around the point."),
1783
- units: I.optional().describe("The units for the distance buffer.")
1784
- }), zo = i.object({
1780
+ units: F.optional().describe("The units for the distance buffer.")
1781
+ }), qo = i.object({
1785
1782
  targetLayer: i.object({
1786
1783
  layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1787
1784
  where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
@@ -1792,7 +1789,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1792
1789
  ).default("*")
1793
1790
  )
1794
1791
  }),
1795
- geometryFilter: i.union([ko, No]).optional().describe(
1792
+ geometryFilter: i.union([No, zo]).optional().describe(
1796
1793
  "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."
1797
1794
  ),
1798
1795
  topFilter: i.object({
@@ -1805,11 +1802,11 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1805
1802
  useCurrentExtent: i.boolean().optional().describe(
1806
1803
  "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)."
1807
1804
  )
1808
- }), qo = f(Fo, {
1805
+ }), Do = f(ko, {
1809
1806
  name: "getTopFeatures",
1810
1807
  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.',
1811
- schema: zo
1812
- }), Z = 25, Do = async (e, t, r, o) => {
1808
+ schema: qo
1809
+ }), Z = 25, Ao = async (e, t, r, o) => {
1813
1810
  const a = t.map?.allLayers.find((y) => y.id === e.layerId), n = await t.whenLayerView(a), s = a.title ?? e.layerId;
1814
1811
  let c;
1815
1812
  if (r) {
@@ -1850,7 +1847,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1850
1847
  } catch (y) {
1851
1848
  console.warn("Client-side query failed, falling back to server:", y), p = await a.queryFeatureCount(d), p > 0 && p <= Z && (h = await a.queryFeatures(d));
1852
1849
  }
1853
- const { objectIds: m, attributes: w } = h ? Se(a, h, t.timeZone) : { objectIds: void 0, attributes: void 0 };
1850
+ const { objectIds: m, attributes: w } = h ? xe(a, h, t.timeZone) : { objectIds: void 0, attributes: void 0 };
1854
1851
  return {
1855
1852
  tool: "queryFeatures",
1856
1853
  layerName: s,
@@ -1868,20 +1865,20 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1868
1865
  }
1869
1866
  };
1870
1867
  };
1871
- async function Ao({
1868
+ async function Lo({
1872
1869
  targetLayer: e,
1873
1870
  geometryFilter: t,
1874
1871
  useCurrentExtent: r
1875
1872
  }, o) {
1876
- const { mapView: a } = N(o), n = await Do(e, a, t, r);
1873
+ const { mapView: a } = N(o), n = await Ao(e, a, t, r);
1877
1874
  return JSON.stringify(n, null, 2);
1878
1875
  }
1879
- const Lo = i.object({
1876
+ const Po = i.object({
1880
1877
  layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
1881
1878
  where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
1882
1879
  distance: i.number().optional().describe("The buffer distance around the geometry."),
1883
- units: I.optional().describe("The units for the distance buffer.")
1884
- }), Po = i.object({
1880
+ units: F.optional().describe("The units for the distance buffer.")
1881
+ }), jo = i.object({
1885
1882
  point: i.object({
1886
1883
  x: i.number().describe("X coordinate (longitude) from navigation result"),
1887
1884
  y: i.number().describe("Y coordinate (latitude) from navigation result"),
@@ -1890,8 +1887,8 @@ const Lo = i.object({
1890
1887
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1891
1888
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1892
1889
  distance: i.number().optional().describe("Optional buffer distance around the point."),
1893
- units: I.optional().describe("The units for the distance buffer.")
1894
- }), jo = i.object({
1890
+ units: F.optional().describe("The units for the distance buffer.")
1891
+ }), Go = i.object({
1895
1892
  targetLayer: i.object({
1896
1893
  layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1897
1894
  where: i.string().describe(
@@ -1904,13 +1901,13 @@ const Lo = i.object({
1904
1901
  ).default("*")
1905
1902
  )
1906
1903
  }),
1907
- geometryFilter: i.union([Lo, Po]).optional().describe(
1904
+ geometryFilter: i.union([Po, jo]).optional().describe(
1908
1905
  "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."
1909
1906
  ),
1910
1907
  useCurrentExtent: i.boolean().optional().describe(
1911
1908
  "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)."
1912
1909
  )
1913
- }), Go = f(Ao, {
1910
+ }), Oo = f(Lo, {
1914
1911
  name: "queryFeatures",
1915
1912
  description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
1916
1913
 
@@ -1922,10 +1919,10 @@ USE THIS TOOL FOR:
1922
1919
  - Any question where the user wants to SEE or COUNT matching features
1923
1920
 
1924
1921
  This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1925
- schema: jo
1926
- }), Oo = [vo, Co, qo, Go], Vn = [io, Yr, Hr], Mo = new rt(Oo);
1927
- async function Un(e, t) {
1928
- const { messages: r } = await Mo.invoke({ messages: e.dataExplorationMessages }, t), o = [], a = [];
1922
+ schema: Go
1923
+ }), Mo = [So, Fo, Do, Oo], Un = [so, Xr, Jr], Qo = new ot(Mo, { handleToolErrors: !1 });
1924
+ async function Kn(e, t) {
1925
+ const { messages: r } = await Qo.invoke({ messages: e.dataExplorationMessages }, t), o = [], a = [];
1929
1926
  for (const n of r) {
1930
1927
  const s = n.content;
1931
1928
  let c;
@@ -1957,13 +1954,11 @@ async function Un(e, t) {
1957
1954
  dataExplorationMessages: [...e.dataExplorationMessages, ...r],
1958
1955
  queryResponse: o,
1959
1956
  status: "success",
1960
- outputMessage: a.join(`
1961
- `),
1962
- summary: a.length > 0 ? _t(a.join(`
1957
+ summary: a.length > 0 ? Wt(a.join(`
1963
1958
  `)) : "Query executed."
1964
1959
  };
1965
1960
  }
1966
- const Kn = b.Root({
1961
+ const Bn = b.Root({
1967
1962
  ...U(),
1968
1963
  // internal to the help agent
1969
1964
  helpInternalState: b({
@@ -1972,7 +1967,7 @@ const Kn = b.Root({
1972
1967
  toolCallMessage: void 0
1973
1968
  })
1974
1969
  })
1975
- }), Qo = (e, t) => {
1970
+ }), _o = (e, t) => {
1976
1971
  const r = Array.from(e.values()).find(
1977
1972
  ({ layerItem: n }) => n.title?.toLowerCase().includes(t.toLowerCase())
1978
1973
  );
@@ -1985,22 +1980,22 @@ const Kn = b.Root({
1985
1980
  return `**${r.layerItem.title}** has ${o.length} field(s):
1986
1981
 
1987
1982
  ${a}`;
1988
- }, _o = async ({ layerTitle: e }, t) => {
1989
- const r = we(t, "layersAndFieldsRegistry");
1990
- return Qo(r, e);
1991
- }, Bn = f(_o, {
1983
+ }, Wo = async ({ layerTitle: e }, t) => {
1984
+ const r = be(t, "layersAndFieldsRegistry");
1985
+ return _o(r, e);
1986
+ }, Hn = f(Wo, {
1992
1987
  name: "listLayerFields",
1993
1988
  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.",
1994
1989
  schema: i.object({
1995
1990
  layerTitle: i.string().describe("The title or partial title of the layer to list fields for.")
1996
1991
  })
1997
- }), Hn = b.Root({
1992
+ }), Jn = b.Root({
1998
1993
  ...U(),
1999
1994
  intent: b({
2000
1995
  reducer: (e, t) => t
2001
1996
  }),
2002
1997
  arcgisKnowledgeMessages: b({
2003
- reducer: me,
1998
+ reducer: ye,
2004
1999
  default: () => []
2005
2000
  }),
2006
2001
  arcgisKnowledgeToolResult: b({
@@ -2032,16 +2027,16 @@ function H(e) {
2032
2027
  view: o
2033
2028
  };
2034
2029
  }
2035
- function Jn(e) {
2030
+ function Zn(e) {
2036
2031
  const r = e?.configurable?.context;
2037
- if (xe(e) === "knowledgeGraph")
2032
+ if (Re(e) === "knowledgeGraph")
2038
2033
  return "knowledgeGraph";
2039
2034
  const a = r.view;
2040
2035
  return z(a) ? (ae(a), "map") : "linkChart";
2041
2036
  }
2042
2037
  async function G(e) {
2043
2038
  const r = e?.configurable?.context;
2044
- if (xe(e) === "knowledgeGraph")
2039
+ if (Re(e) === "knowledgeGraph")
2045
2040
  return r;
2046
2041
  {
2047
2042
  const a = r.view.map;
@@ -2065,7 +2060,7 @@ async function G(e) {
2065
2060
  }
2066
2061
  }
2067
2062
  }
2068
- function xe(e) {
2063
+ function Re(e) {
2069
2064
  const r = e?.configurable?.context;
2070
2065
  if (!r || typeof r != "object")
2071
2066
  throw new Error("ArcgisKnowledgeAgent context missing");
@@ -2077,7 +2072,7 @@ function xe(e) {
2077
2072
  return "view";
2078
2073
  throw new Error("ArcgisKnowledgeAgent context must have either a view or knowledgeGraph property.");
2079
2074
  }
2080
- class Wo {
2075
+ class Vo {
2081
2076
  constructor(t) {
2082
2077
  this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = ne.fromDataModel(t);
2083
2078
  }
@@ -2096,10 +2091,10 @@ class ne {
2096
2091
  for (const o of t.entityTypes)
2097
2092
  r.entityTypes.push(j.fromEntityType(o));
2098
2093
  for (const o of t.relationshipTypes)
2099
- r.relationshipTypes.push(Vo.fromRelationshipType(o));
2094
+ r.relationshipTypes.push(Uo.fromRelationshipType(o));
2100
2095
  return r.identifierInfo = {
2101
2096
  mappingInfo: {
2102
- identifierMapsTo: Uo(
2097
+ identifierMapsTo: Ko(
2103
2098
  t.identifierInfo.identifierMappingInfo.identifierInfoType
2104
2099
  ),
2105
2100
  identifierPropertyName: t.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName
@@ -2119,13 +2114,13 @@ class j {
2119
2114
  }
2120
2115
  static fromEntityType(t) {
2121
2116
  const r = new j();
2122
- r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = Ko(t.role);
2117
+ r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = Bo(t.role);
2123
2118
  for (const o of t.properties) {
2124
2119
  const a = {
2125
2120
  name: o.name,
2126
2121
  alias: o.alias ? o.alias : void 0,
2127
2122
  fieldType: o.fieldType,
2128
- role: Bo(o.role),
2123
+ role: Ho(o.role),
2129
2124
  geometryDef: o.fieldType === "esriFieldTypeGeometry" ? {
2130
2125
  geometryType: o.geometryType ?? "esriGeometryAny",
2131
2126
  hasM: o.hasM ? o.hasM : void 0,
@@ -2137,7 +2132,7 @@ class j {
2137
2132
  return r;
2138
2133
  }
2139
2134
  }
2140
- class Vo extends j {
2135
+ class Uo extends j {
2141
2136
  constructor() {
2142
2137
  super(...arguments), this.observedEndPoints = [];
2143
2138
  }
@@ -2152,7 +2147,7 @@ class Vo extends j {
2152
2147
  return r;
2153
2148
  }
2154
2149
  }
2155
- const Uo = (e) => {
2150
+ const Ko = (e) => {
2156
2151
  switch (e) {
2157
2152
  case "esriIdentifierInfoTypeUNSPECIFIED":
2158
2153
  return "UNSPECIFIED";
@@ -2163,7 +2158,7 @@ const Uo = (e) => {
2163
2158
  default:
2164
2159
  return e;
2165
2160
  }
2166
- }, Ko = (e) => {
2161
+ }, Bo = (e) => {
2167
2162
  switch (e) {
2168
2163
  case "Regular":
2169
2164
  return "esriGraphNamedObjectRegular";
@@ -2175,7 +2170,7 @@ const Uo = (e) => {
2175
2170
  return e;
2176
2171
  }
2177
2172
  };
2178
- function Bo(e) {
2173
+ function Ho(e) {
2179
2174
  switch (e) {
2180
2175
  case "esriGraphPropertyRegular":
2181
2176
  return "Regular";
@@ -2213,7 +2208,7 @@ function Bo(e) {
2213
2208
  return "Regular";
2214
2209
  }
2215
2210
  }
2216
- function Ho(e, t) {
2211
+ function Jo(e, t) {
2217
2212
  return t ? `${e}
2218
2213
 
2219
2214
  Your previous attempt to generate a cypher query failed. See the details below and generate a new cypher query that avoids this error.
@@ -2223,7 +2218,7 @@ Execution Error: ${t.executionError}
2223
2218
  Failed Query:
2224
2219
  ${t.failedGraphQuery}` : e;
2225
2220
  }
2226
- async function Jo(e, t, r, o) {
2221
+ async function Zo(e, t, r, o) {
2227
2222
  const { graphQuery: a, explanation: n } = await ie(e, t, r, o);
2228
2223
  return `Generated Graph Query:
2229
2224
  ${a}
@@ -2232,8 +2227,8 @@ Explanation: ${n}`;
2232
2227
  }
2233
2228
  async function ie(e, t, r, o, a) {
2234
2229
  const n = {
2235
- message: Ho(e, a),
2236
- context: new Wo(t)
2230
+ message: Jo(e, a),
2231
+ context: new Vo(t)
2237
2232
  };
2238
2233
  Q.conversationId && (n.conversationId = Q.conversationId), await S({ text: "Attempting to generate a cypher query from your prompt..." }, o);
2239
2234
  const s = await le(`${r}/chat`, {
@@ -2283,8 +2278,8 @@ async function ie(e, t, r, o, a) {
2283
2278
  }
2284
2279
  return { graphQuery: d, explanation: p };
2285
2280
  }
2286
- const F = 3;
2287
- function Re(e, t = 100) {
2281
+ const I = 3;
2282
+ function $e(e, t = 100) {
2288
2283
  const r = {};
2289
2284
  for (const o of Object.entries(e.properties ?? {})) {
2290
2285
  const [a, n] = o;
@@ -2295,7 +2290,7 @@ function Re(e, t = 100) {
2295
2290
  function se(e) {
2296
2291
  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);
2297
2292
  }
2298
- const Zo = async ({
2293
+ const Yo = async ({
2299
2294
  kg: e,
2300
2295
  queryParams: t,
2301
2296
  targetStructure: r,
@@ -2310,7 +2305,7 @@ const Zo = async ({
2310
2305
  };
2311
2306
  d && (d.aborted ? l.abort(d.reason) : d.addEventListener("abort", p, { once: !0 }));
2312
2307
  try {
2313
- const h = await pt(e, t, a);
2308
+ const h = await ht(e, t, a);
2314
2309
  c = h.resultHeader;
2315
2310
  const m = h.resultRowsStream.getReader();
2316
2311
  let w = 0;
@@ -2334,7 +2329,7 @@ const Zo = async ({
2334
2329
  }
2335
2330
  return { type: "success", rowLimitReached: !1, resultHeader: c, processedResult: u };
2336
2331
  };
2337
- async function $e({
2332
+ async function Ee({
2338
2333
  prompt: e,
2339
2334
  kg: t,
2340
2335
  graphQueryServiceUrl: r,
@@ -2346,7 +2341,7 @@ async function $e({
2346
2341
  config: u
2347
2342
  }) {
2348
2343
  let l;
2349
- for (let d = 1; d <= F; d++) {
2344
+ for (let d = 1; d <= I; d++) {
2350
2345
  let p;
2351
2346
  try {
2352
2347
  p = await ie(e, t.dataModel, r, u, l);
@@ -2363,9 +2358,9 @@ async function $e({
2363
2358
  },
2364
2359
  u
2365
2360
  );
2366
- const h = await Zo({
2361
+ const h = await Yo({
2367
2362
  kg: t,
2368
- queryParams: new ge({
2363
+ queryParams: new we({
2369
2364
  openCypherQuery: p.graphQuery
2370
2365
  }),
2371
2366
  targetStructure: o,
@@ -2390,7 +2385,7 @@ async function $e({
2390
2385
  graphQuery: p.graphQuery,
2391
2386
  explanation: p.explanation
2392
2387
  };
2393
- if (d >= F)
2388
+ if (d >= I)
2394
2389
  return h.type === "timeout" ? {
2395
2390
  type: "timeout",
2396
2391
  errorMessage: m,
@@ -2413,10 +2408,10 @@ async function $e({
2413
2408
  );
2414
2409
  }
2415
2410
  throw new Error(
2416
- `Failed to execute generated cypher due to an unexpected error after ${F} attempts.`
2411
+ `Failed to execute generated cypher due to an unexpected error after ${I} attempts.`
2417
2412
  );
2418
2413
  }
2419
- const Yo = async ({
2414
+ const Xo = async ({
2420
2415
  kg: e,
2421
2416
  searchQuery: t,
2422
2417
  typeCategoryFilter: r,
@@ -2433,9 +2428,9 @@ const Yo = async ({
2433
2428
  const d = u - s.length;
2434
2429
  if (d <= 0)
2435
2430
  break;
2436
- const m = (await ht(
2431
+ const m = (await mt(
2437
2432
  e,
2438
- new mt({
2433
+ new yt({
2439
2434
  searchQuery: t,
2440
2435
  typeCategoryFilter: l,
2441
2436
  namedTypesFilter: o ?? void 0,
@@ -2465,7 +2460,7 @@ const Yo = async ({
2465
2460
  results: s
2466
2461
  };
2467
2462
  };
2468
- function Xo(e, t) {
2463
+ function ea(e, t) {
2469
2464
  D(e, (r) => {
2470
2465
  t.set(`${r.typeName}__${r.id}`, {
2471
2466
  id: r.id,
@@ -2475,29 +2470,29 @@ function Xo(e, t) {
2475
2470
  }
2476
2471
  function D(e, t) {
2477
2472
  if (!(!e || typeof e != "object")) {
2478
- if (ta(e))
2473
+ if (ra(e))
2479
2474
  for (const r of e.path)
2480
2475
  D(r, t);
2481
- else if (ea(e))
2476
+ else if (ta(e))
2482
2477
  t(e);
2483
2478
  else if (Array.isArray(e))
2484
2479
  for (const r of e)
2485
2480
  D(r, t);
2486
- else if (ra(e))
2481
+ else if (oa(e))
2487
2482
  for (const r of Object.values(e.properties ?? {}))
2488
2483
  D(r, t);
2489
2484
  }
2490
2485
  }
2491
- function ea(e) {
2486
+ function ta(e) {
2492
2487
  return !e || typeof e != "object" || Array.isArray(e) ? !1 : "id" in e && "typeName" in e;
2493
2488
  }
2494
- function ta(e) {
2489
+ function ra(e) {
2495
2490
  return !e || typeof e != "object" || Array.isArray(e) ? !1 : e && "path" in e && Array.isArray(e.path);
2496
2491
  }
2497
- function ra(e) {
2492
+ function oa(e) {
2498
2493
  return !e || typeof e != "object" || Array.isArray(e) || "id" in e ? !1 : "properties" in e && typeof e.properties == "object";
2499
2494
  }
2500
- function oa(e, t) {
2495
+ function aa(e, t) {
2501
2496
  const r = [];
2502
2497
  for (const o of [...t.dataModel.entityTypes, ...t.dataModel.relationshipTypes]) {
2503
2498
  const a = e.getMemberIdsByType(o.name);
@@ -2506,7 +2501,7 @@ function oa(e, t) {
2506
2501
  }
2507
2502
  return r;
2508
2503
  }
2509
- function aa(e) {
2504
+ function na(e) {
2510
2505
  const t = [], r = [], a = e?.allLayers.find((n) => n.type === "knowledge-graph")?.inclusionModeDefinition;
2511
2506
  if (a?.generateAllSublayers)
2512
2507
  return { allNamedTypesFullyDynamic: !0, idTypePairs: t, dynamicTypes: r };
@@ -2518,15 +2513,15 @@ function aa(e) {
2518
2513
  t.push({ id: c, typeName: n });
2519
2514
  return { allNamedTypesFullyDynamic: !1, idTypePairs: t, dynamicTypes: r };
2520
2515
  }
2521
- async function na(e, t, r, o, a) {
2522
- const { view: n } = o, s = await $e({
2516
+ async function ia(e, t, r, o, a) {
2517
+ const { view: n } = o, s = await Ee({
2523
2518
  prompt: e,
2524
2519
  kg: t,
2525
2520
  graphQueryServiceUrl: r,
2526
2521
  targetStructure: /* @__PURE__ */ new Map(),
2527
2522
  targetStructureReducer: (p, h) => {
2528
2523
  for (const m of h)
2529
- Xo(m, p);
2524
+ ea(m, p);
2530
2525
  return p;
2531
2526
  },
2532
2527
  requestOptions: {
@@ -2555,26 +2550,26 @@ ${c}
2555
2550
 
2556
2551
  Explanation: ${u}`);
2557
2552
  }
2558
- const Ee = "addRecords", ia = i.object({
2553
+ const Ce = "addRecords", sa = i.object({
2559
2554
  prompt: i.string().describe("The user's inquiry into the knowledge graph that needs to be run.")
2560
- }), sa = async ({ prompt: e }, t) => {
2555
+ }), ca = async ({ prompt: e }, t) => {
2561
2556
  const { knowledgeGraph: r } = await G(t), o = H(t), { view: a } = o, s = k.getDefault().helperServices;
2562
2557
  let c = e;
2563
- if (z(a)) {
2564
- const l = a.map, { allNamedTypesFullyDynamic: d, idTypePairs: p, dynamicTypes: h } = aa(l), m = await Y("arcgis_knowledge_current_map_context");
2558
+ if (!z(a) && a.map) {
2559
+ const l = a.map, d = await Y("arcgis_knowledge_current_lc_context"), p = aa(l, r);
2560
+ c = `${e}
2561
+
2562
+ ${d}${JSON.stringify(p)}`;
2563
+ } else {
2564
+ const l = a.map, { allNamedTypesFullyDynamic: d, idTypePairs: p, dynamicTypes: h } = na(l), m = await Y("arcgis_knowledge_current_map_context");
2565
2565
  if (c = `${e}
2566
2566
 
2567
2567
  ${m}${JSON.stringify(p)} and all entities or relationships with the the following typeNames in the array: ${JSON.stringify(h)}`, d)
2568
2568
  throw new Error(
2569
2569
  "No records have been added to the map because all data in the knowledge graph is contained in the map."
2570
2570
  );
2571
- } else {
2572
- const l = a.map, d = await Y("arcgis_knowledge_current_lc_context"), p = oa(l, r);
2573
- c = `${e}
2574
-
2575
- ${d}${JSON.stringify(p)}`;
2576
2571
  }
2577
- const u = await na(
2572
+ const u = await ia(
2578
2573
  c,
2579
2574
  r,
2580
2575
  `${s.aiAssistantServices.url}${s.aiAssistantServices.graphQueryAssistant}`,
@@ -2582,19 +2577,19 @@ ${d}${JSON.stringify(p)}`;
2582
2577
  t
2583
2578
  );
2584
2579
  return {
2585
- toolName: Ee,
2580
+ toolName: Ce,
2586
2581
  status: "success",
2587
2582
  summary: u
2588
2583
  };
2589
- }, Zn = f(sa, {
2590
- name: Ee,
2584
+ }, Yn = f(ca, {
2585
+ name: Ce,
2591
2586
  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.",
2592
- schema: ia
2587
+ schema: sa
2593
2588
  });
2594
- async function ca(e, t) {
2589
+ async function la(e, t) {
2595
2590
  return await t.map?.applyLayout(e), await B(t), `Successfully applied layout: ${e}.`;
2596
2591
  }
2597
- const ee = "applyLayout", la = i.object({
2592
+ const ee = "applyLayout", ua = i.object({
2598
2593
  layout: i.enum([
2599
2594
  "organic-standard",
2600
2595
  "organic-community",
@@ -2608,7 +2603,7 @@ const ee = "applyLayout", la = i.object({
2608
2603
  ]).describe(
2609
2604
  "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"
2610
2605
  )
2611
- }), ua = async ({ layout: e }, t) => {
2606
+ }), da = async ({ layout: e }, t) => {
2612
2607
  const { view: r } = H(t);
2613
2608
  if (z(r))
2614
2609
  return {
@@ -2618,24 +2613,24 @@ const ee = "applyLayout", la = i.object({
2618
2613
  error: new Error()
2619
2614
  };
2620
2615
  {
2621
- const o = await ca(e, r);
2616
+ const o = await la(e, r);
2622
2617
  return {
2623
2618
  toolName: ee,
2624
2619
  status: "success",
2625
2620
  summary: o
2626
2621
  };
2627
2622
  }
2628
- }, Yn = f(ua, {
2623
+ }, Xn = f(da, {
2629
2624
  name: ee,
2630
2625
  description: "Apply a diagram layout to the link chart",
2631
- schema: la
2626
+ schema: ua
2632
2627
  });
2633
- async function da(e, t) {
2628
+ async function pa(e, t) {
2634
2629
  return t.map?.changeNonspatialDataDisplay(e), await B(t), `Successfully applied nonspatial visibility setting: ${e}.`;
2635
2630
  }
2636
- const te = "changeNonspatialVisibility", pa = i.object({
2631
+ const te = "changeNonspatialVisibility", ha = i.object({
2637
2632
  setting: i.enum(["hidden", "visible"]).describe("The setting of nonspatial visibility")
2638
- }), ha = async ({ setting: e }, t) => {
2633
+ }), ma = async ({ setting: e }, t) => {
2639
2634
  const { view: r } = H(t);
2640
2635
  if (z(r))
2641
2636
  return {
@@ -2645,21 +2640,21 @@ const te = "changeNonspatialVisibility", pa = i.object({
2645
2640
  error: new Error()
2646
2641
  };
2647
2642
  {
2648
- const o = await da(e, r);
2643
+ const o = await pa(e, r);
2649
2644
  return {
2650
2645
  toolName: te,
2651
2646
  status: "success",
2652
2647
  summary: o
2653
2648
  };
2654
2649
  }
2655
- }, Xn = f(ha, {
2650
+ }, ei = f(ma, {
2656
2651
  name: te,
2657
2652
  description: "Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",
2658
- schema: pa
2653
+ schema: ha
2659
2654
  });
2660
- async function ma(e, t, r, o, a) {
2655
+ async function ya(e, t, r, o, a) {
2661
2656
  let n;
2662
- for (let s = 1; s <= F; s++) {
2657
+ for (let s = 1; s <= I; s++) {
2663
2658
  const { graphQuery: c, explanation: u } = await ie(
2664
2659
  e,
2665
2660
  t.dataModel,
@@ -2669,15 +2664,15 @@ async function ma(e, t, r, o, a) {
2669
2664
  );
2670
2665
  try {
2671
2666
  await S({ text: `Attempting to create link chart from derived query: ${c}` }, a);
2672
- const l = await dt.fromCypherQuery(
2667
+ const l = await pt.fromCypherQuery(
2673
2668
  t,
2674
- new ge({
2669
+ new we({
2675
2670
  openCypherQuery: c
2676
2671
  })
2677
2672
  );
2678
2673
  await S({ text: "Link chart created successfully, loading..." }, a), await l.load();
2679
2674
  const d = o.map;
2680
- return o.map = l, await o.when(), await qe.whenOnce(() => !o.updating), l.entityCount === 0 && l.relationshipCount === 0 ? (o.map === l && (o.map = d), l.destroy(), {
2675
+ return o.map = l, await o.when(), await De.whenOnce(() => !o.updating), l.entityCount === 0 && l.relationshipCount === 0 ? (o.map === l && (o.map = d), l.destroy(), {
2681
2676
  type: "error",
2682
2677
  message: `Query returned no results. Cypher Query used to create the link chart:
2683
2678
  ${c}
@@ -2692,9 +2687,9 @@ Explanation: ${u}`
2692
2687
  });
2693
2688
  } catch (l) {
2694
2689
  const d = l instanceof Error ? l.message : String(l);
2695
- if (s >= F)
2690
+ if (s >= I)
2696
2691
  throw new Error(
2697
- `Failed to create link chart after ${F} attempts. Last error: ${d}`
2692
+ `Failed to create link chart after ${I} attempts. Last error: ${d}`
2698
2693
  );
2699
2694
  n = {
2700
2695
  failedGraphQuery: c,
@@ -2706,13 +2701,13 @@ Explanation: ${u}`
2706
2701
  );
2707
2702
  }
2708
2703
  }
2709
- throw new Error(`Failed to create link chart after ${F} attempts.`);
2704
+ throw new Error(`Failed to create link chart after ${I} attempts.`);
2710
2705
  }
2711
- const _ = "createLinkChart", ya = i.object({
2706
+ const _ = "createLinkChart", fa = i.object({
2712
2707
  prompt: i.string().describe(
2713
2708
  "The user's inquiry into the knowledge graph that needs to be transformed into a link chart visualization."
2714
2709
  )
2715
- }), fa = async ({ prompt: e }, t) => {
2710
+ }), ga = async ({ prompt: e }, t) => {
2716
2711
  const { knowledgeGraph: r } = await G(t), { view: o } = H(t);
2717
2712
  if (z(o))
2718
2713
  return {
@@ -2722,7 +2717,7 @@ const _ = "createLinkChart", ya = i.object({
2722
2717
  error: new Error()
2723
2718
  };
2724
2719
  {
2725
- const n = k.getDefault().helperServices, s = await ma(
2720
+ const n = k.getDefault().helperServices, s = await ya(
2726
2721
  e,
2727
2722
  r,
2728
2723
  `${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,
@@ -2740,11 +2735,11 @@ const _ = "createLinkChart", ya = i.object({
2740
2735
  summary: s.message
2741
2736
  };
2742
2737
  }
2743
- }, ei = f(fa, {
2738
+ }, ti = f(ga, {
2744
2739
  name: _,
2745
2740
  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.",
2746
- schema: ya
2747
- }), Ce = "queryGraphData", ga = i.object({
2741
+ schema: fa
2742
+ }), Fe = "queryGraphData", wa = i.object({
2748
2743
  prompt: i.string().describe(
2749
2744
  `The user's inquiry into the knowledge graph, from which a cypher query will be generated and executed to answer the inquiry. IMPORTANT:
2750
2745
 
@@ -2752,8 +2747,8 @@ REQUEST LIMIT: If the user does not specifically request for no limits or an exp
2752
2747
 
2753
2748
  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.`
2754
2749
  )
2755
- }), wa = async ({ prompt: e }, t) => {
2756
- const { knowledgeGraph: r } = await G(t), a = k.getDefault().helperServices, n = await $e({
2750
+ }), ba = async ({ prompt: e }, t) => {
2751
+ const { knowledgeGraph: r } = await G(t), a = k.getDefault().helperServices, n = await Ee({
2757
2752
  prompt: e,
2758
2753
  kg: r,
2759
2754
  graphQueryServiceUrl: `${a.aiAssistantServices.url}${a.aiAssistantServices.graphQueryAssistant}`,
@@ -2774,11 +2769,11 @@ DESCRIPTIVE COLUMN NAMES: If the user's prompt does not explicitly request for s
2774
2769
  for (const m of h)
2775
2770
  D(
2776
2771
  m,
2777
- (w) => Re(w)
2772
+ (w) => $e(w)
2778
2773
  );
2779
2774
  const d = 50, p = c.slice(0, d).map((h) => JSON.stringify(h));
2780
2775
  return {
2781
- toolName: Ce,
2776
+ toolName: Fe,
2782
2777
  status: "success",
2783
2778
  summary: `To answer the inquiry, the following cypher query was executed against the knowledge graph:
2784
2779
 
@@ -2804,14 +2799,14 @@ ${p.length > d ? `Showing top ${d} results:
2804
2799
  queryResults: c
2805
2800
  }
2806
2801
  };
2807
- }, ti = f(wa, {
2808
- name: Ce,
2802
+ }, ri = f(ba, {
2803
+ name: Fe,
2809
2804
  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?'.",
2810
- schema: ga
2811
- }), Ie = "generateCypher", ba = i.object({
2805
+ schema: wa
2806
+ }), Ie = "generateCypher", Ta = i.object({
2812
2807
  prompt: i.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")
2813
- }), Ta = async ({ prompt: e }, t) => {
2814
- const { knowledgeGraph: r } = await G(t), a = k.getDefault().helperServices, n = await Jo(
2808
+ }), va = async ({ prompt: e }, t) => {
2809
+ const { knowledgeGraph: r } = await G(t), a = k.getDefault().helperServices, n = await Zo(
2815
2810
  e,
2816
2811
  r.dataModel,
2817
2812
  `${a.aiAssistantServices.url}${a.aiAssistantServices.graphQueryAssistant}`,
@@ -2822,11 +2817,11 @@ ${p.length > d ? `Showing top ${d} results:
2822
2817
  status: "success",
2823
2818
  summary: n
2824
2819
  };
2825
- }, ri = f(Ta, {
2820
+ }, oi = f(va, {
2826
2821
  name: Ie,
2827
2822
  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.",
2828
- schema: ba
2829
- }), va = (e) => {
2823
+ schema: Ta
2824
+ }), Sa = (e) => {
2830
2825
  const t = e.dataModel, r = /* @__PURE__ */ new Map();
2831
2826
  for (const c of t.searchIndexes)
2832
2827
  if (c.supportedCategory !== "esriTypeMetaEntityProvenance")
@@ -2843,10 +2838,10 @@ ${a.map(({ name: c }) => `${c}: [${Array.from(r.get(c) ?? []).join(", ")}]`).joi
2843
2838
 
2844
2839
  ${s}`;
2845
2840
  };
2846
- async function Sa(e, t) {
2841
+ async function xa(e, t) {
2847
2842
  const r = await Y("arcgis_knowledge_lucene_generation_prompt"), o = {
2848
2843
  inquiry: e,
2849
- dataModelForSearch: va(t)
2844
+ dataModelForSearch: Sa(t)
2850
2845
  }, a = i.enum(["entity", "relationship", "both"]).describe("The graph element category to search against - entity, relationship, or both"), n = i.number().int().positive().nullable().describe(
2851
2846
  "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."
2852
2847
  ), s = i.array(
@@ -2861,22 +2856,22 @@ async function Sa(e, t) {
2861
2856
  typeCategoryFilter: a,
2862
2857
  resultLimit: n
2863
2858
  });
2864
- return await ze({
2859
+ return await qe({
2865
2860
  promptText: r,
2866
2861
  inputVariables: o,
2867
2862
  schema: c
2868
2863
  });
2869
2864
  }
2870
- const Fe = "searchGraphData", xa = i.object({
2865
+ const ke = "searchGraphData", Ra = i.object({
2871
2866
  prompt: i.string().describe(
2872
2867
  "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."
2873
2868
  )
2874
- }), Ra = async ({ prompt: e }, t) => {
2869
+ }), $a = async ({ prompt: e }, t) => {
2875
2870
  const { knowledgeGraph: r } = await G(t);
2876
2871
  await S({ text: "Generating search query for the user inquiry" }, t);
2877
- const o = await Sa(e, r);
2872
+ const o = await xa(e, r);
2878
2873
  await S({ text: "Executing graph search with generated search query" }, t);
2879
- const a = await Yo({
2874
+ const a = await Xo({
2880
2875
  kg: r,
2881
2876
  searchQuery: o.query,
2882
2877
  typeCategoryFilter: o.typeCategoryFilter,
@@ -2894,11 +2889,11 @@ const Fe = "searchGraphData", xa = i.object({
2894
2889
  for (const c of a.results)
2895
2890
  D(
2896
2891
  c,
2897
- (u) => Re(u)
2892
+ (u) => $e(u)
2898
2893
  );
2899
2894
  const n = 10, s = a.results.slice(0, n);
2900
2895
  return {
2901
- toolName: Fe,
2896
+ toolName: ke,
2902
2897
  status: "success",
2903
2898
  summary: `To answer the query, the following lucene query was generated and executed:
2904
2899
  Query: ${o.query}
@@ -2919,56 +2914,56 @@ const Fe = "searchGraphData", xa = i.object({
2919
2914
  }
2920
2915
  }
2921
2916
  };
2922
- }, oi = f(Ra, {
2923
- name: Fe,
2917
+ }, ai = f($a, {
2918
+ name: ke,
2924
2919
  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.",
2925
- schema: xa
2920
+ schema: Ra
2926
2921
  });
2927
2922
  export {
2928
- zn as A,
2929
- qn as B,
2930
- Dn as C,
2931
- An as D,
2932
- Ln as E,
2933
- Pn as F,
2923
+ qn as A,
2924
+ Dn as B,
2925
+ An as C,
2926
+ Ln as D,
2927
+ Pn as E,
2928
+ jn as F,
2934
2929
  ne as G,
2935
- Kn as H,
2936
- jn as I,
2937
- Gn as J,
2938
- On as K,
2939
- Mn as L,
2940
- Qn as M,
2941
- Tn as N,
2942
- Wn as O,
2943
- Vn as P,
2944
- Oo as Q,
2930
+ Bn as H,
2931
+ Gn as I,
2932
+ On as J,
2933
+ Mn as K,
2934
+ Qn as L,
2935
+ _n as M,
2936
+ vn as N,
2937
+ Vn as O,
2938
+ Un as P,
2939
+ Mo as Q,
2945
2940
  N as R,
2946
- _n as S,
2947
- Un as T,
2948
- Yn as a,
2949
- ri as b,
2950
- Xn as c,
2951
- ei as d,
2952
- Zn as e,
2953
- we as f,
2941
+ Wn as S,
2942
+ Kn as T,
2943
+ Xn as a,
2944
+ oi as b,
2945
+ ei as c,
2946
+ ti as d,
2947
+ Yn as e,
2948
+ be as f,
2954
2949
  Y as g,
2955
- Jn as h,
2950
+ Zn as h,
2956
2951
  G as i,
2957
- Hn as j,
2958
- vn as k,
2959
- Bn as l,
2960
- Sn as m,
2961
- xn as n,
2962
- Rn as o,
2963
- $n as p,
2964
- ti as q,
2965
- kn as r,
2966
- oi as s,
2967
- _t as t,
2968
- En as u,
2969
- Cn as v,
2952
+ Jn as j,
2953
+ Sn as k,
2954
+ Hn as l,
2955
+ xn as m,
2956
+ Rn as n,
2957
+ $n as o,
2958
+ En as p,
2959
+ ri as q,
2960
+ Nn as r,
2961
+ ai as s,
2962
+ Wt as t,
2963
+ Cn as u,
2964
+ Fn as v,
2970
2965
  In as w,
2971
- Fn as x,
2966
+ kn as x,
2972
2967
  $ as y,
2973
- Nn as z
2968
+ zn as z
2974
2969
  };