@arcgis/ai-components 5.1.2 → 5.1.3

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 (41) hide show
  1. package/dist/cdn/{OP6ENMCN.js → 3OIOU4X5.js} +33 -33
  2. package/dist/cdn/{FDBWYCAB.js → 55SUMECY.js} +1 -1
  3. package/dist/cdn/{LDCC2R2F.js → 6DWGUIYM.js} +1 -1
  4. package/dist/cdn/{P6HPQKVB.js → 6DZF4SUK.js} +1 -1
  5. package/dist/cdn/{5FM4VVHX.js → 7JC5WSJ7.js} +1 -1
  6. package/dist/cdn/{M4AUVPY2.js → 7RBF233K.js} +1 -1
  7. package/dist/cdn/{EAZMMIHA.js → A3L5XUCO.js} +1 -1
  8. package/dist/cdn/{Z7PXJRBS.js → ALXKTL4A.js} +1 -1
  9. package/dist/cdn/{MVJO65W2.js → CMQAP2VT.js} +1 -1
  10. package/dist/cdn/{3J5RM5OR.js → DSVUDXFW.js} +1 -1
  11. package/dist/cdn/{W2CWLWUT.js → ECWQWIKT.js} +1 -1
  12. package/dist/cdn/{ISVBWKSB.js → GWQNHIPV.js} +1 -1
  13. package/dist/cdn/{7OS3TQPL.js → H7SEESHU.js} +1 -1
  14. package/dist/cdn/{FGHZ3THZ.js → HPB72YLY.js} +1 -1
  15. package/dist/cdn/{EDNV2EE5.js → J6PJKAER.js} +1 -1
  16. package/dist/cdn/{ORZO77HT.js → KPJSDDKW.js} +1 -1
  17. package/dist/cdn/{W6HO4D6J.js → KYL4PDIC.js} +1 -1
  18. package/dist/cdn/{676XT2OP.js → LWYPVI67.js} +1 -1
  19. package/dist/cdn/{JAKT3WYF.js → MVOTJGYZ.js} +1 -1
  20. package/dist/cdn/{FH4Q4VML.js → OTNNHN2X.js} +1 -1
  21. package/dist/cdn/{MJM2MHJW.js → PECIFJOX.js} +1 -1
  22. package/dist/cdn/{DLP5KUGG.js → QRMUKTER.js} +1 -1
  23. package/dist/cdn/{D44KMXIX.js → R3KZRXRF.js} +1 -1
  24. package/dist/cdn/{NP7T2ORP.js → RC5KZQQM.js} +1 -1
  25. package/dist/cdn/{IAPYT7SR.js → SFYRTSOL.js} +1 -1
  26. package/dist/cdn/{3FKJHYEX.js → TBIJ5A4J.js} +1 -1
  27. package/dist/cdn/{DB2C7FK7.js → TWQJEJOJ.js} +1 -1
  28. package/dist/cdn/{PAMYPORW.js → UTZRJ6E2.js} +1 -1
  29. package/dist/cdn/{B5KIGBLD.js → VSZN4LFJ.js} +1 -1
  30. package/dist/cdn/{5LNXARCS.js → W6VQSCAF.js} +1 -1
  31. package/dist/cdn/{DNBSIYGH.js → WXBGXXTZ.js} +1 -1
  32. package/dist/cdn/{AKFW3JY6.js → XMEPBFUU.js} +1 -1
  33. package/dist/cdn/{7EPO6BQA.js → YCN6TESC.js} +1 -1
  34. package/dist/cdn/agent-utils/index.js +1 -1
  35. package/dist/cdn/index.js +1 -1
  36. package/dist/chunks/adapter.js +904 -895
  37. package/dist/chunks/runtime.js +1 -1
  38. package/dist/docs/api.json +1 -1
  39. package/dist/docs/docs.json +1 -1
  40. package/dist/docs/web-types.json +1 -1
  41. package/package.json +4 -4
@@ -1,7 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
2
  import pe from "@arcgis/core/identity/IdentityManager.js";
3
3
  import k from "@arcgis/core/portal/Portal.js";
4
- import { Annotation as b, messagesStateReducer as be } from "@langchain/langgraph/web";
4
+ import { Annotation as T, messagesStateReducer as be } from "@langchain/langgraph/web";
5
5
  import "@arcgis/toolkit/string";
6
6
  import { k as De, j as H, i as Pe } from "./generateLayerDescriptions.js";
7
7
  import "@langchain/core/messages";
@@ -10,23 +10,23 @@ import "@langchain/openai";
10
10
  import X from "@arcgis/core/config.js";
11
11
  import * as Ae from "@arcgis/core/core/reactiveUtils.js";
12
12
  import "@arcgis/core/layers/FeatureLayer.js";
13
- import he from "@arcgis/core/request.js";
13
+ import me from "@arcgis/core/request.js";
14
14
  import "@langchain/core/prompts";
15
- import { tool as w } from "@langchain/core/tools";
16
- import je from "@arcgis/core/Graphic.js";
17
- import { addressToLocations as Le } from "@arcgis/core/rest/locator.js";
15
+ import { tool as g } from "@langchain/core/tools";
16
+ import Le from "@arcgis/core/Graphic.js";
17
+ import { addressToLocations as je } from "@arcgis/core/rest/locator.js";
18
18
  import Ge from "@arcgis/core/symbols/PictureMarkerSymbol.js";
19
19
  import s, { z as E } from "zod";
20
20
  import Oe from "@arcgis/core/geometry/Extent.js";
21
21
  import Te from "@arcgis/core/geometry/Point.js";
22
22
  import { createRenderer as Me } from "@arcgis/core/smartMapping/renderers/pieChart.js";
23
23
  import { getSchemesByTag as Qe, getSchemes as _e } from "@arcgis/core/smartMapping/symbology/pieChart.js";
24
- import { getBackgroundColorTheme as me } from "@arcgis/core/views/support/colorUtils.js";
25
- import { a as x, s as S } from "./index.js";
24
+ import { getBackgroundColorTheme as he } from "@arcgis/core/views/support/colorUtils.js";
25
+ import { a as R, s as x } from "./index.js";
26
26
  import { createAgeRenderer as We, createContinuousRenderer as Ve } from "@arcgis/core/smartMapping/renderers/color.js";
27
27
  import { getSchemesByTag as se } from "@arcgis/core/smartMapping/symbology/color.js";
28
- import { createContinuousRenderer as Ue } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
29
- import { createRenderer as Be } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
28
+ import { createContinuousRenderer as Be } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
29
+ import { createRenderer as Ue } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
30
30
  import { getSchemesByTag as Ke } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
31
31
  import { createRenderer as He } from "@arcgis/core/smartMapping/renderers/heatmap.js";
32
32
  import { getSchemesByTag as Je } from "@arcgis/core/smartMapping/symbology/heatmap.js";
@@ -45,37 +45,37 @@ import { formatDateOnly as lt, convertDateFormatToIntlOptions as _, formatTimeOn
45
45
  import ut from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
46
46
  import dt from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
47
47
  import pt from "@arcgis/core/rest/support/TopFeaturesQuery.js";
48
- import ht from "@arcgis/core/rest/support/TopFilter.js";
49
- import mt from "@arcgis/core/WebLinkChart.js";
48
+ import mt from "@arcgis/core/rest/support/TopFilter.js";
49
+ import ht from "@arcgis/core/WebLinkChart.js";
50
50
  import Se from "@arcgis/core/rest/knowledgeGraph/GraphQueryStreaming.js";
51
51
  import "@arcgis/core/views/LinkChartView.js";
52
52
  import { fetchKnowledgeGraph as fe, executeQueryStreaming as yt, executeSearchStreaming as ft } from "@arcgis/core/rest/knowledgeGraphService.js";
53
53
  import gt from "@arcgis/core/rest/knowledgeGraph/GraphSearchStreaming.js";
54
- const j = (e, r) => r ?? e, $n = b.Root({
54
+ const L = (e, t) => t ?? e, En = T.Root({
55
55
  ...De(),
56
56
  // internal to the navigation agent
57
- intent: b({
58
- reducer: j
57
+ intent: T({
58
+ reducer: L
59
59
  }),
60
- vectorSearchLayerResults: b({
61
- reducer: j,
60
+ vectorSearchLayerResults: T({
61
+ reducer: L,
62
62
  default: () => []
63
63
  }),
64
- vectorSearchFieldResults: b({
65
- reducer: j
64
+ vectorSearchFieldResults: T({
65
+ reducer: L
66
66
  }),
67
- navigationInternalState: b({
68
- reducer: j,
67
+ navigationInternalState: T({
68
+ reducer: L,
69
69
  default: () => ({
70
70
  toolCallMessage: void 0
71
71
  })
72
72
  })
73
73
  });
74
- async function wt(e, r) {
75
- const a = k.getDefault().helperServices, o = a.geocode.find((h) => h.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
74
+ async function wt(e, t) {
75
+ const a = k.getDefault().helperServices, o = a.geocode.find((m) => m.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
76
76
  if (!o)
77
77
  throw new Error("No geocoding service found in helperServices.");
78
- const n = o.url, l = `${X.assetsPath?.endsWith("/") ? X.assetsPath : `${X.assetsPath}/`}esri/images/search/search-symbol-32.png`, c = (await Le(n, {
78
+ const n = o.url, l = `${X.assetsPath?.endsWith("/") ? X.assetsPath : `${X.assetsPath}/`}esri/images/search/search-symbol-32.png`, c = (await je(n, {
79
79
  address: { SingleLine: e },
80
80
  outFields: ["Match_addr"]
81
81
  }))?.[0];
@@ -85,11 +85,11 @@ async function wt(e, r) {
85
85
  url: l,
86
86
  width: 24,
87
87
  height: 24
88
- }), d = new je({
88
+ }), d = new Le({
89
89
  geometry: c.location,
90
90
  symbol: u
91
91
  });
92
- r.graphics.removeAll(), r.graphics.add(d), await r.goTo(c.extent);
92
+ t.graphics.removeAll(), t.graphics.add(d), await t.goTo(c.extent);
93
93
  const p = {
94
94
  address: c.address ?? "",
95
95
  location: c.location ? c.location.toJSON() : null,
@@ -102,27 +102,27 @@ async function wt(e, r) {
102
102
  }
103
103
  const bt = ["mapView"];
104
104
  function C(e) {
105
- const t = e?.configurable?.context;
106
- if (!t || typeof t != "object")
105
+ const r = e?.configurable?.context;
106
+ if (!r || typeof r != "object")
107
107
  throw new Error("NavigationAgent context missing");
108
- const a = bt.filter((o) => !(o in t));
108
+ const a = bt.filter((o) => !(o in r));
109
109
  if (a.length)
110
110
  throw new Error(`NavigationAgent context missing: ${a.join(", ")}`);
111
- return t;
111
+ return r;
112
112
  }
113
- async function Tt({ address: e }, r) {
114
- const { mapView: t } = C(r);
115
- return await wt(e, t);
113
+ async function Tt({ address: e }, t) {
114
+ const { mapView: r } = C(t);
115
+ return await wt(e, r);
116
116
  }
117
117
  const vt = s.object({
118
118
  address: s.string().describe("The full address or place name to locate.")
119
- }), Cn = w(Tt, {
119
+ }), Fn = g(Tt, {
120
120
  name: "goToAddress",
121
121
  description: "Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",
122
122
  schema: vt
123
123
  });
124
- async function St(e, r) {
125
- const a = r.map.bookmarks;
124
+ async function St(e, t) {
125
+ const a = t.map.bookmarks;
126
126
  if (!a || a.length === 0)
127
127
  throw new Error("No bookmarks found in the map.");
128
128
  const o = a.find((l) => l.name === e);
@@ -131,31 +131,31 @@ async function St(e, r) {
131
131
  const n = o.viewpoint;
132
132
  if (!n)
133
133
  throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);
134
- return await r.goTo(n), { text: `Navigated to bookmark: ${e}` };
134
+ return await t.goTo(n), { text: `Navigated to bookmark: ${e}` };
135
135
  }
136
- async function xt({ bookmarkName: e }, r) {
137
- const { mapView: t } = C(r);
138
- return await Promise.resolve(St(e, t));
136
+ async function xt({ bookmarkName: e }, t) {
137
+ const { mapView: r } = C(t);
138
+ return await Promise.resolve(St(e, r));
139
139
  }
140
140
  const Rt = E.object({
141
141
  bookmarkName: E.string().describe("The name of the bookmark to navigate to.")
142
- }), En = w(xt, {
142
+ }), kn = g(xt, {
143
143
  name: "goToBookmark",
144
144
  description: "Go to the extent of the bookmark with the given name.",
145
145
  schema: Rt
146
146
  });
147
- async function $t(e, r, t) {
148
- const a = t.map?.allLayers.find((l) => l.id === e);
147
+ async function $t(e, t, r) {
148
+ const a = r.map?.allLayers.find((l) => l.id === e);
149
149
  if (!a)
150
150
  return { text: `Error: Layer with id ${e} not found` };
151
- const o = r?.trim() ? r : "1=1", n = a.createQuery();
151
+ const o = t?.trim() ? t : "1=1", n = a.createQuery();
152
152
  n.where = o;
153
153
  try {
154
154
  const { extent: l, count: i } = await a.queryExtent(n);
155
155
  if (i === 0)
156
156
  return { text: `No features found in ${a.title} matching: ${o}`, where: o };
157
157
  if (l)
158
- await t.goTo(l);
158
+ await r.goTo(l);
159
159
  else
160
160
  return { text: `Error: Unable to determine extent for ${a.title}`, where: o };
161
161
  const c = {
@@ -173,88 +173,88 @@ async function $t(e, r, t) {
173
173
  return console.error("Error in goToFeatures:", l), { text: `Error: ${l instanceof Error ? l.message : "Unknown error"}`, where: o };
174
174
  }
175
175
  }
176
- async function Ct({ layerId: e, where: r }, t) {
177
- const { mapView: a } = C(t);
178
- return await $t(e, r, a);
176
+ async function Ct({ layerId: e, where: t }, r) {
177
+ const { mapView: a } = C(r);
178
+ return await $t(e, t, a);
179
179
  }
180
180
  const Et = E.object({
181
181
  layerId: E.string().describe("The layerId of the layer to zoom to."),
182
182
  where: E.string().describe("The sql-92 where clause used to query features to zoom to")
183
- }), Fn = w(Ct, {
183
+ }), Nn = g(Ct, {
184
184
  name: "goToFeatures",
185
185
  description: "Go to the features that match the given filter related to the given layerId.",
186
186
  schema: Et
187
187
  });
188
188
  async function Ft(e) {
189
- const t = new Oe({
189
+ const r = new Oe({
190
190
  xmin: -180,
191
191
  ymin: -90,
192
192
  xmax: 180,
193
193
  ymax: 90,
194
194
  spatialReference: { wkid: 4326 }
195
195
  }).expand(0.7);
196
- return await e.goTo(t), { text: "Successfully zoomed to world extent" };
196
+ return await e.goTo(r), { text: "Successfully zoomed to world extent" };
197
197
  }
198
- async function kt(e, r) {
199
- const { mapView: t } = C(r);
200
- return await Ft(t);
198
+ async function kt(e, t) {
199
+ const { mapView: r } = C(t);
200
+ return await Ft(r);
201
201
  }
202
- const Nt = E.object({}), kn = w(kt, {
202
+ const Nt = E.object({}), qn = g(kt, {
203
203
  name: "goToFullExtent",
204
204
  description: "Zooms the map to the full world extent using Esri's Geocoding Service.",
205
205
  schema: Nt
206
206
  });
207
207
  async function qt(e) {
208
- const t = e.map.initialViewProperties?.viewpoint?.targetGeometry;
209
- if (t)
210
- await e.goTo(t);
208
+ const r = e.map.initialViewProperties?.viewpoint?.targetGeometry;
209
+ if (r)
210
+ await e.goTo(r);
211
211
  else
212
212
  throw new Error("Initial extent is undefined");
213
213
  return { text: "Successfully zoomed to home extent" };
214
214
  }
215
- async function It(e, r) {
216
- const { mapView: t } = C(r);
217
- return await qt(t);
215
+ async function It(e, t) {
216
+ const { mapView: r } = C(t);
217
+ return await qt(r);
218
218
  }
219
- const zt = s.object({}), Nn = w(It, {
219
+ const zt = s.object({}), In = g(It, {
220
220
  name: "goToHomeExtent",
221
221
  description: "Go to the initial web map view extent",
222
222
  schema: zt
223
223
  });
224
- async function Dt(e, r) {
225
- await r.when();
226
- const t = r.map?.allLayers.find((o) => o.id === e);
227
- if (!t)
224
+ async function Dt(e, t) {
225
+ await t.when();
226
+ const r = t.map?.allLayers.find((o) => o.id === e);
227
+ if (!r)
228
228
  return console.warn(`[goToLayer] No matching FeatureLayer found for: ${e}`), { text: `Could not find layer for: ${e}` };
229
229
  let a;
230
- return (t.type === "link-chart" || t.type === "knowledge-graph-sublayer") && r.map?.activeLinkChartLayer ? a = r.map.diagramNodesExtent : a = t.fullExtent, a ? (await r.goTo(a), t.visible = !0, { text: `Successfully zoomed to: ${t.title ?? ""}` }) : { text: "Layer has no defined extent. Cannot zoom to layer." };
230
+ return (r.type === "link-chart" || r.type === "knowledge-graph-sublayer") && t.map?.activeLinkChartLayer ? a = t.map.diagramNodesExtent : a = r.fullExtent, a ? (await t.goTo(a), r.visible = !0, { text: `Successfully zoomed to: ${r.title ?? ""}` }) : { text: "Layer has no defined extent. Cannot zoom to layer." };
231
231
  }
232
- async function Pt({ layerId: e }, r) {
233
- const { mapView: t } = C(r);
234
- return await Dt(e, t);
232
+ async function Pt({ layerId: e }, t) {
233
+ const { mapView: r } = C(t);
234
+ return await Dt(e, r);
235
235
  }
236
236
  const At = E.object({
237
237
  layerId: E.string().describe("The id of the layer to navigate to")
238
- }), qn = w(Pt, {
238
+ }), zn = g(Pt, {
239
239
  name: "goToLayer",
240
240
  description: "Zooms the map view to the full extent of the top matching layer.",
241
241
  schema: At
242
242
  });
243
- async function jt(e, r) {
244
- return await r.goTo({ scale: e }), { text: `Successfully zoomed to: ${e}` };
243
+ async function Lt(e, t) {
244
+ return await t.goTo({ scale: e }), { text: `Successfully zoomed to: ${e}` };
245
245
  }
246
- async function Lt({ scale: e }, r) {
247
- const { mapView: t } = C(r);
248
- return await jt(e, t);
246
+ async function jt({ scale: e }, t) {
247
+ const { mapView: r } = C(t);
248
+ return await Lt(e, r);
249
249
  }
250
250
  const Gt = s.object({
251
251
  scale: s.number().describe("The map scale of the view to go to.")
252
- }), In = w(Lt, {
252
+ }), Dn = g(jt, {
253
253
  name: "goToScale",
254
254
  description: "Go to the specified view scale.",
255
255
  schema: Gt
256
256
  });
257
- async function Ot(e, r, t) {
257
+ async function Ot(e, t, r) {
258
258
  const o = {
259
259
  target: new Te({
260
260
  longitude: e.longitude,
@@ -262,19 +262,19 @@ async function Ot(e, r, t) {
262
262
  spatialReference: { wkid: 4326 }
263
263
  })
264
264
  };
265
- return t?.zoom !== void 0 && (o.zoom = t.zoom), t?.scale !== void 0 && (o.scale = t.scale), await r.goTo(o), { text: `Successfully navigated to: ${[
265
+ return r?.zoom !== void 0 && (o.zoom = r.zoom), r?.scale !== void 0 && (o.scale = r.scale), await t.goTo(o), { text: `Successfully navigated to: ${[
266
266
  `(${e.latitude}°, ${e.longitude}°)`,
267
- t?.zoom !== void 0 ? `zoom ${t.zoom}` : "",
268
- t?.scale !== void 0 ? `scale 1:${t.scale}` : ""
267
+ r?.zoom !== void 0 ? `zoom ${r.zoom}` : "",
268
+ r?.scale !== void 0 ? `scale 1:${r.scale}` : ""
269
269
  ].filter(Boolean).join(", ")}` };
270
270
  }
271
271
  async function Mt({
272
272
  center: e,
273
- zoom: r,
274
- scale: t
273
+ zoom: t,
274
+ scale: r
275
275
  }, a) {
276
276
  const { mapView: o } = C(a);
277
- return await Ot(e, o, { zoom: r, scale: t });
277
+ return await Ot(e, o, { zoom: t, scale: r });
278
278
  }
279
279
  const Qt = s.object({
280
280
  center: s.object({
@@ -283,21 +283,21 @@ const Qt = s.object({
283
283
  }),
284
284
  zoom: s.number().optional().describe("The zoom level. Higher values = more zoomed in."),
285
285
  scale: s.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
286
- }), zn = w(Mt, {
286
+ }), Pn = g(Mt, {
287
287
  name: "goToViewpoint",
288
288
  description: "Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",
289
289
  schema: Qt
290
290
  });
291
- async function _t(e, r) {
292
- return await r.goTo({ zoom: e }), { text: `Successfully zoomed to: ${e}` };
291
+ async function _t(e, t) {
292
+ return await t.goTo({ zoom: e }), { text: `Successfully zoomed to: ${e}` };
293
293
  }
294
- async function Wt({ zoom: e }, r) {
295
- const { mapView: t } = C(r);
296
- return await _t(e, t);
294
+ async function Wt({ zoom: e }, t) {
295
+ const { mapView: r } = C(t);
296
+ return await _t(e, r);
297
297
  }
298
298
  const Vt = s.object({
299
299
  zoom: s.number().min(1).max(20).describe("The zoom level of the view to go to.")
300
- }), Dn = w(Wt, {
300
+ }), An = g(Wt, {
301
301
  name: "goToZoom",
302
302
  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.).',
303
303
  schema: Vt
@@ -316,48 +316,48 @@ const Vt = s.object({
316
316
  "../agents/navigation/prompts/navigation_intent_prompt.md": () => import("./navigation_intent_prompt.js").then((e) => e.default),
317
317
  "../agents/navigation/prompts/navigation_tool_prompt.md": () => import("./navigation_tool_prompt.js").then((e) => e.default)
318
318
  });
319
- async function U(e) {
320
- const r = Object.entries(ge).find(([t]) => t.endsWith(`/${e}.md`));
321
- if (!r)
319
+ async function B(e) {
320
+ const t = Object.entries(ge).find(([r]) => r.endsWith(`/${e}.md`));
321
+ if (!t)
322
322
  throw new Error(`Prompt not found: ${e}
323
323
  Available prompts:
324
324
  ${Object.keys(ge).join(`
325
325
  `)}`);
326
- return await r[1]();
326
+ return await t[1]();
327
327
  }
328
- const Ut = (e, r = 300) => {
329
- const t = e.replace(/\s+/gu, " ").replace(/[*_`#>\-]/gu, "").trim();
330
- return t.length > r ? `${t.slice(0, r)}...` : t;
331
- }, xe = (e, r) => {
332
- const a = e?.configurable?.services?.[r];
328
+ const Bt = (e, t = 300) => {
329
+ const r = e.replace(/\s+/gu, " ").replace(/[*_`#>\-]/gu, "").trim();
330
+ return r.length > t ? `${r.slice(0, t)}...` : r;
331
+ }, xe = (e, t) => {
332
+ const a = e?.configurable?.services?.[t];
333
333
  if (a == null)
334
- throw new Error(`${r} missing in config.configurable.services`);
334
+ throw new Error(`${t} missing in config.configurable.services`);
335
335
  return a;
336
- }, Pn = (e, r) => (t, a) => {
336
+ }, Ln = (e, t) => (r, a) => {
337
337
  const o = a?.configurable?.services;
338
338
  for (const n of e)
339
339
  if (!o?.[n])
340
- throw new Error(`${r} requires services.${n} to be available.`);
341
- return t;
340
+ throw new Error(`${t} requires services.${n} to be available.`);
341
+ return r;
342
342
  };
343
- async function Bt(e) {
344
- const { fields: r, layer: t, view: a, styleName: o, colorSchemeTags: n } = e;
343
+ async function Ut(e) {
344
+ const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
345
345
  let l;
346
346
  return n ? l = Qe({
347
- basemapTheme: await me(a),
348
- geometryType: t.geometryType,
347
+ basemapTheme: await he(a),
348
+ geometryType: r.geometryType,
349
349
  includedTags: n,
350
- numColors: Math.min(r.length, 8)
350
+ numColors: Math.min(t.length, 8)
351
351
  })[0] : l = _e({
352
- basemapTheme: await me(a),
353
- geometryType: t.geometryType,
354
- numColors: Math.min(r.length, 8)
352
+ basemapTheme: await he(a),
353
+ geometryType: r.geometryType,
354
+ numColors: Math.min(t.length, 8)
355
355
  }).primaryScheme, {
356
- layer: t,
356
+ layer: r,
357
357
  view: a,
358
- attributes: r.map((i) => ({
358
+ attributes: t.map((i) => ({
359
359
  field: i,
360
- label: t.fields.find((c) => c.name === i)?.alias ?? ""
360
+ label: r.fields.find((c) => c.name === i)?.alias ?? ""
361
361
  })).slice(0, 8),
362
362
  outlineOptimizationEnabled: !0,
363
363
  sizeOptimizationEnabled: !0,
@@ -370,15 +370,15 @@ async function Kt(e) {
370
370
  }
371
371
  async function Ht({
372
372
  arcgisMap: e,
373
- arcgisMapView: r,
374
- layerId: t,
373
+ arcgisMapView: t,
374
+ layerId: r,
375
375
  fields: a,
376
376
  colorSchemes: o,
377
377
  includeSize: n
378
378
  }) {
379
- const l = r, i = e?.allLayers.find((d) => d.id === t);
379
+ const l = t, i = e?.allLayers.find((d) => d.id === r);
380
380
  if (!i)
381
- return `Could not find layer for id: ${t}`;
381
+ return `Could not find layer for id: ${r}`;
382
382
  const u = {
383
383
  styleName: n ? "chart-size" : "chart",
384
384
  fields: a,
@@ -387,35 +387,35 @@ async function Ht({
387
387
  colorSchemeTags: o
388
388
  };
389
389
  try {
390
- const d = await Bt(u), p = await Kt(d);
390
+ const d = await Ut(u), p = await Kt(d);
391
391
  return i.renderer = p.renderer, i.visible = !0, `Chart renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
392
392
  } catch (d) {
393
393
  return `Error applying chart renderer: ${d instanceof Error ? d.message : String(d)}`;
394
394
  }
395
395
  }
396
396
  const Jt = ["mapView"];
397
- function R(e) {
398
- const t = e?.configurable?.context;
399
- if (!t || typeof t != "object")
397
+ function $(e) {
398
+ const r = e?.configurable?.context;
399
+ if (!r || typeof r != "object")
400
400
  throw new Error("LayerStylingAgent context missing");
401
- const a = Jt.filter((o) => !(o in t));
401
+ const a = Jt.filter((o) => !(o in r));
402
402
  if (a.length)
403
403
  throw new Error(`LayerStylingAgent context missing: ${a.join(", ")}`);
404
- return t;
404
+ return r;
405
405
  }
406
406
  async function Zt({
407
407
  layerId: e,
408
- fields: r,
409
- colorSchemes: t,
408
+ fields: t,
409
+ colorSchemes: r,
410
410
  includeSize: a
411
411
  }, o) {
412
- const { mapView: n } = R(o);
413
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await Ht({
412
+ const { mapView: n } = $(o);
413
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Ht({
414
414
  arcgisMap: n.map,
415
415
  arcgisMapView: n,
416
416
  layerId: e,
417
- fields: r,
418
- colorSchemes: t,
417
+ fields: t,
418
+ colorSchemes: r,
419
419
  includeSize: a
420
420
  });
421
421
  }
@@ -424,7 +424,7 @@ const Yt = s.object({
424
424
  fields: s.array(s.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),
425
425
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
426
426
  includeSize: s.boolean().optional().describe("Whether to vary the chart size (chart-size)")
427
- }), An = w(Zt, {
427
+ }), jn = g(Zt, {
428
428
  name: "chart",
429
429
  description: `Label: Charts
430
430
  Description: Show the values of two or more categories as a proportion of the total using a pie chart.
@@ -440,14 +440,14 @@ const Yt = s.object({
440
440
  schema: Yt
441
441
  });
442
442
  function Xt(e) {
443
- const { fields: r, layer: t, view: a, theme: o, colorSchemeTags: n } = e, l = r[0];
443
+ const { fields: t, layer: r, view: a, theme: o, colorSchemeTags: n } = e, l = t[0];
444
444
  let i;
445
445
  return n && (i = se({
446
- geometryType: t.geometryType,
446
+ geometryType: r.geometryType,
447
447
  includedTags: n,
448
448
  theme: o || "high-to-low"
449
449
  })[0]), {
450
- layer: t,
450
+ layer: r,
451
451
  view: a,
452
452
  startTime: l,
453
453
  endTime: /* @__PURE__ */ new Date(),
@@ -462,15 +462,15 @@ async function er(e) {
462
462
  }
463
463
  async function tr({
464
464
  arcgisMap: e,
465
- arcgisMapView: r,
466
- layerId: t,
465
+ arcgisMapView: t,
466
+ layerId: r,
467
467
  fields: a,
468
468
  colorSchemes: o,
469
469
  theme: n
470
470
  }) {
471
- const l = r, i = e?.allLayers.find((u) => u.id === t);
471
+ const l = t, i = e?.allLayers.find((u) => u.id === r);
472
472
  if (!i)
473
- return `Could not find layer for id: ${t}`;
473
+ return `Could not find layer for id: ${r}`;
474
474
  const c = {
475
475
  styleName: "color-age",
476
476
  fields: a,
@@ -488,17 +488,17 @@ async function tr({
488
488
  }
489
489
  async function rr({
490
490
  layerId: e,
491
- fields: r,
492
- colorSchemes: t,
491
+ fields: t,
492
+ colorSchemes: r,
493
493
  theme: a
494
494
  }, o) {
495
- const { mapView: n } = R(o);
496
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await tr({
495
+ const { mapView: n } = $(o);
496
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await tr({
497
497
  arcgisMap: n.map,
498
498
  arcgisMapView: n,
499
499
  layerId: e,
500
- fields: r,
501
- colorSchemes: t,
500
+ fields: t,
501
+ colorSchemes: r,
502
502
  theme: a
503
503
  });
504
504
  }
@@ -507,7 +507,7 @@ const ar = s.object({
507
507
  fields: s.array(s.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),
508
508
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
509
509
  theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
510
- }), jn = w(rr, {
510
+ }), Gn = g(rr, {
511
511
  name: "color-age",
512
512
  description: `Label: Age (color)
513
513
  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.
@@ -517,16 +517,16 @@ const ar = s.object({
517
517
  schema: ar
518
518
  });
519
519
  function or(e) {
520
- const { fields: r, layer: t, view: a, colorSchemeTags: o } = e;
521
- let { theme: n } = e, l = r[1];
522
- const i = r[0];
520
+ const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
521
+ let { theme: n } = e, l = t[1];
522
+ const i = t[0];
523
523
  let c;
524
524
  return o && (c = se({
525
- geometryType: t.geometryType,
525
+ geometryType: r.geometryType,
526
526
  includedTags: o,
527
527
  theme: n || "high-to-low"
528
528
  })[0]), {
529
- layer: t,
529
+ layer: r,
530
530
  view: a,
531
531
  field: i,
532
532
  normalizationField: l,
@@ -541,15 +541,15 @@ async function nr(e) {
541
541
  }
542
542
  async function ir({
543
543
  arcgisMap: e,
544
- arcgisMapView: r,
545
- layerId: t,
544
+ arcgisMapView: t,
545
+ layerId: r,
546
546
  fields: a,
547
547
  colorSchemes: o,
548
548
  theme: n
549
549
  }) {
550
- const l = r, i = e?.allLayers.find((u) => u.id === t);
550
+ const l = t, i = e?.allLayers.find((u) => u.id === r);
551
551
  if (!i)
552
- return `Could not find layer for id: ${t}`;
552
+ return `Could not find layer for id: ${r}`;
553
553
  const c = {
554
554
  styleName: "color",
555
555
  fields: a,
@@ -567,17 +567,17 @@ async function ir({
567
567
  }
568
568
  async function sr({
569
569
  layerId: e,
570
- fields: r,
571
- colorSchemes: t,
570
+ fields: t,
571
+ colorSchemes: r,
572
572
  theme: a
573
573
  }, o) {
574
- const { mapView: n } = R(o);
575
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await ir({
574
+ const { mapView: n } = $(o);
575
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await ir({
576
576
  arcgisMap: n.map,
577
577
  arcgisMapView: n,
578
578
  layerId: e,
579
- fields: r,
580
- colorSchemes: t,
579
+ fields: t,
580
+ colorSchemes: r,
581
581
  theme: a
582
582
  });
583
583
  }
@@ -586,7 +586,7 @@ const lr = s.object({
586
586
  fields: s.array(s.string()).describe("The field(s) to use for the color renderer"),
587
587
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
588
588
  theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
589
- }), Ln = w(sr, {
589
+ }), On = g(sr, {
590
590
  name: "color",
591
591
  description: `Label: Counts and Amounts (color)
592
592
  Description: Vary color along a continuous color ramp to represent numeric or ranked data.
@@ -596,15 +596,15 @@ const lr = s.object({
596
596
  schema: lr
597
597
  });
598
598
  function cr(e) {
599
- const { fields: r, layer: t, view: a, colorSchemeTags: o, theme: n } = e;
599
+ const { fields: t, layer: r, view: a, colorSchemeTags: o, theme: n } = e;
600
600
  let l, i;
601
- const c = r[0];
601
+ const c = t[0];
602
602
  return o && (i = se({
603
- geometryType: t.geometryType,
603
+ geometryType: r.geometryType,
604
604
  includedTags: o,
605
605
  theme: n || "high-to-low"
606
606
  })[0]), {
607
- layer: t,
607
+ layer: r,
608
608
  view: a,
609
609
  field: c,
610
610
  normalizationField: l,
@@ -615,19 +615,19 @@ function cr(e) {
615
615
  };
616
616
  }
617
617
  async function ur(e) {
618
- return await Ue(e);
618
+ return await Be(e);
619
619
  }
620
620
  async function dr({
621
621
  arcgisMap: e,
622
- arcgisMapView: r,
623
- layerId: t,
622
+ arcgisMapView: t,
623
+ layerId: r,
624
624
  fields: a,
625
625
  colorSchemes: o,
626
626
  theme: n
627
627
  }) {
628
- const l = r, i = e?.allLayers.find((u) => u.id === t);
628
+ const l = t, i = e?.allLayers.find((u) => u.id === r);
629
629
  if (!i)
630
- return `Could not find layer for id: ${t}`;
630
+ return `Could not find layer for id: ${r}`;
631
631
  const c = {
632
632
  styleName: "color-size-univariate",
633
633
  fields: a,
@@ -645,67 +645,67 @@ async function dr({
645
645
  }
646
646
  async function pr({
647
647
  layerId: e,
648
- fields: r,
649
- colorSchemes: t,
648
+ fields: t,
649
+ colorSchemes: r,
650
650
  theme: a
651
651
  }, o) {
652
- const { mapView: n } = R(o);
653
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await dr({
652
+ const { mapView: n } = $(o);
653
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await dr({
654
654
  arcgisMap: n.map,
655
655
  arcgisMapView: n,
656
656
  layerId: e,
657
- fields: r,
658
- colorSchemes: t,
657
+ fields: t,
658
+ colorSchemes: r,
659
659
  theme: a
660
660
  });
661
661
  }
662
- const hr = s.object({
662
+ const mr = s.object({
663
663
  layerId: s.string().describe("The id of the layer to apply the color-size univariate renderer to"),
664
664
  fields: s.array(s.string()).describe("The fields to use for the color-size univariate renderer"),
665
665
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
666
666
  theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color and size ramps")
667
- }), Gn = w(pr, {
667
+ }), Mn = g(pr, {
668
668
  name: "color-size-univariate",
669
669
  description: `Label: Color and Size (univariate)
670
670
  Description: Vary symbol size and color based on the values of two numeric attributes.
671
671
  Keywords: continuous color, hue, color, size, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease, amount
672
672
  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.
673
673
  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.`,
674
- schema: hr
674
+ schema: mr
675
675
  });
676
- function mr(e) {
677
- const { fields: r, layer: t, view: a, colorSchemeTags: o } = e;
676
+ function hr(e) {
677
+ const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
678
678
  let n;
679
679
  return o && (n = Ke({
680
680
  includedTags: o,
681
- numColors: Math.min(r.length, 8)
681
+ numColors: Math.min(t.length, 8)
682
682
  })[0]), {
683
- layer: t,
683
+ layer: r,
684
684
  view: a,
685
685
  legendOptions: {
686
686
  unit: "units"
687
687
  },
688
- attributes: r.map((l) => ({
688
+ attributes: t.map((l) => ({
689
689
  field: l,
690
- label: t.fields.find((i) => i.name === l)?.alias ?? ""
690
+ label: r.fields.find((i) => i.name === l)?.alias ?? ""
691
691
  })).slice(0, 8),
692
692
  outlineOptimizationEnabled: !0,
693
693
  dotDensityScheme: n
694
694
  };
695
695
  }
696
696
  async function yr(e) {
697
- return await Be(e);
697
+ return await Ue(e);
698
698
  }
699
699
  async function fr({
700
700
  arcgisMap: e,
701
- arcgisMapView: r,
702
- layerId: t,
701
+ arcgisMapView: t,
702
+ layerId: r,
703
703
  fields: a,
704
704
  colorSchemes: o
705
705
  }) {
706
- const n = r, l = e?.allLayers.find((c) => c.id === t);
706
+ const n = t, l = e?.allLayers.find((c) => c.id === r);
707
707
  if (!l)
708
- return `Could not find layer for id: ${t}`;
708
+ return `Could not find layer for id: ${r}`;
709
709
  const i = {
710
710
  styleName: "dot-density",
711
711
  fields: a,
@@ -714,7 +714,7 @@ async function fr({
714
714
  colorSchemeTags: o
715
715
  };
716
716
  try {
717
- const c = mr(i), u = await yr(c);
717
+ const c = hr(i), u = await yr(c);
718
718
  return l.renderer = u.renderer, l.visible = !0, `Dot Density renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
719
719
  } catch (c) {
720
720
  return `Error applying dot density renderer: ${c instanceof Error ? c.message : String(c)}`;
@@ -722,23 +722,23 @@ async function fr({
722
722
  }
723
723
  async function gr({
724
724
  layerId: e,
725
- fields: r,
726
- colorSchemes: t
725
+ fields: t,
726
+ colorSchemes: r
727
727
  }, a) {
728
- const { mapView: o } = R(a);
729
- return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await fr({
728
+ const { mapView: o } = $(a);
729
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await fr({
730
730
  arcgisMap: o.map,
731
731
  arcgisMapView: o,
732
732
  layerId: e,
733
- fields: r,
734
- colorSchemes: t
733
+ fields: t,
734
+ colorSchemes: r
735
735
  });
736
736
  }
737
737
  const wr = s.object({
738
738
  layerId: s.string().describe("The id of the layer to apply the dot density renderer to"),
739
739
  fields: s.array(s.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),
740
740
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
741
- }), On = w(gr, {
741
+ }), Qn = g(gr, {
742
742
  name: "dot-density",
743
743
  description: `Dot Density
744
744
  Use dot density to visualize the distribution of one attribute or compare the density of multiple attributes. This is only valid for polygon layers.
@@ -755,14 +755,14 @@ const wr = s.object({
755
755
  schema: wr
756
756
  });
757
757
  function br(e) {
758
- const { fields: r, layer: t, view: a, colorSchemeTags: o } = e;
758
+ const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
759
759
  let n;
760
- const l = r[0];
760
+ const l = t[0];
761
761
  return o && (n = Je({
762
762
  includedTags: o,
763
763
  basemap: a.map?.basemap || "topo"
764
764
  })[0]), {
765
- layer: t,
765
+ layer: r,
766
766
  view: a,
767
767
  field: l,
768
768
  heatmapScheme: n
@@ -773,14 +773,14 @@ async function Tr(e) {
773
773
  }
774
774
  async function vr({
775
775
  arcgisMap: e,
776
- arcgisMapView: r,
777
- layerId: t,
776
+ arcgisMapView: t,
777
+ layerId: r,
778
778
  fields: a,
779
779
  colorSchemes: o
780
780
  }) {
781
- const n = r, l = e?.allLayers.find((c) => c.id === t);
781
+ const n = t, l = e?.allLayers.find((c) => c.id === r);
782
782
  if (!l)
783
- return `Could not find layer for id: ${t}`;
783
+ return `Could not find layer for id: ${r}`;
784
784
  const i = {
785
785
  styleName: "heatmap",
786
786
  fields: a,
@@ -797,23 +797,23 @@ async function vr({
797
797
  }
798
798
  async function Sr({
799
799
  layerId: e,
800
- fields: r,
801
- colorSchemes: t
800
+ fields: t,
801
+ colorSchemes: r
802
802
  }, a) {
803
- const { mapView: o } = R(a);
804
- return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await vr({
803
+ const { mapView: o } = $(a);
804
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await vr({
805
805
  arcgisMap: o.map,
806
806
  arcgisMapView: o,
807
807
  layerId: e,
808
- fields: r,
809
- colorSchemes: t
808
+ fields: t,
809
+ colorSchemes: r
810
810
  });
811
811
  }
812
812
  const xr = s.object({
813
813
  layerId: s.string().describe("The id of the layer to apply the heatmap renderer to"),
814
814
  fields: s.array(s.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),
815
815
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
816
- }), Mn = w(Sr, {
816
+ }), _n = g(Sr, {
817
817
  name: "heatmap",
818
818
  description: `Label: Heat Map
819
819
  Description: Show areas of high density with colors that appear to glow hotter. This is only valid for point layers.
@@ -823,16 +823,16 @@ Fields: This typically requires zero or one field of type number.`,
823
823
  schema: xr
824
824
  });
825
825
  function Rr(e) {
826
- const { fields: r, layer: t, view: a, styleName: o, colorSchemeTags: n } = e;
826
+ const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
827
827
  let l;
828
828
  return n && (l = Ye({
829
- geometryType: t.geometryType,
829
+ geometryType: r.geometryType,
830
830
  includedTags: n,
831
- numColors: Math.min(r.length, 10)
831
+ numColors: Math.min(t.length, 10)
832
832
  })[0]), {
833
- layer: t,
833
+ layer: r,
834
834
  view: a,
835
- fields: r.map((i) => ({ name: i })).slice(0, 9),
835
+ fields: t.map((i) => ({ name: i })).slice(0, 9),
836
836
  outlineOptimizationEnabled: !0,
837
837
  sizeOptimizationEnabled: !0,
838
838
  includeSizeVariable: o.includes("Size"),
@@ -844,15 +844,15 @@ async function $r(e) {
844
844
  }
845
845
  async function Cr({
846
846
  arcgisMap: e,
847
- arcgisMapView: r,
848
- layerId: t,
847
+ arcgisMapView: t,
848
+ layerId: r,
849
849
  fields: a,
850
850
  colorSchemes: o,
851
851
  includeSize: n
852
852
  }) {
853
- const l = r, i = e?.allLayers.find((d) => d.id === t);
853
+ const l = t, i = e?.allLayers.find((d) => d.id === r);
854
854
  if (!i)
855
- return `Could not find layer for id: ${t}`;
855
+ return `Could not find layer for id: ${r}`;
856
856
  const u = {
857
857
  styleName: n ? "predominance-size" : "predominance",
858
858
  fields: a,
@@ -869,17 +869,17 @@ async function Cr({
869
869
  }
870
870
  async function Er({
871
871
  layerId: e,
872
- fields: r,
873
- colorSchemes: t,
872
+ fields: t,
873
+ colorSchemes: r,
874
874
  includeSize: a
875
875
  }, o) {
876
- const { mapView: n } = R(o);
877
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await Cr({
876
+ const { mapView: n } = $(o);
877
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Cr({
878
878
  arcgisMap: n.map,
879
879
  arcgisMapView: n,
880
880
  layerId: e,
881
- fields: r,
882
- colorSchemes: t,
881
+ fields: t,
882
+ colorSchemes: r,
883
883
  includeSize: a
884
884
  });
885
885
  }
@@ -888,7 +888,7 @@ const Fr = s.object({
888
888
  fields: s.array(s.string()).describe("The fields to use for the predominance renderer (competing categories)"),
889
889
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
890
890
  includeSize: s.boolean().optional().describe("Whether to include size visualization (predominance-size)")
891
- }), Qn = w(Er, {
891
+ }), Wn = g(Er, {
892
892
  name: "predominance",
893
893
  description: `Label: Predominant category
894
894
  Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
@@ -904,18 +904,18 @@ const Fr = s.object({
904
904
  schema: Fr
905
905
  });
906
906
  function kr(e) {
907
- const { fields: r, layer: t, view: a, colorSchemeTags: o } = e;
907
+ const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
908
908
  let n;
909
909
  const l = {
910
- field: r[0]
910
+ field: t[0]
911
911
  }, i = {
912
- field: r[1]
912
+ field: t[1]
913
913
  };
914
914
  return o && (n = et({
915
- geometryType: t.geometryType,
915
+ geometryType: r.geometryType,
916
916
  includedTags: o
917
917
  })[0]), {
918
- layer: t,
918
+ layer: r,
919
919
  view: a,
920
920
  field1: l,
921
921
  field2: i,
@@ -929,14 +929,14 @@ async function Nr(e) {
929
929
  }
930
930
  async function qr({
931
931
  arcgisMap: e,
932
- arcgisMapView: r,
933
- layerId: t,
932
+ arcgisMapView: t,
933
+ layerId: r,
934
934
  fields: a,
935
935
  colorSchemes: o
936
936
  }) {
937
- const n = r, l = e?.allLayers.find((c) => c.id === t);
937
+ const n = t, l = e?.allLayers.find((c) => c.id === r);
938
938
  if (!l)
939
- return `Could not find layer for id: ${t}`;
939
+ return `Could not find layer for id: ${r}`;
940
940
  const i = {
941
941
  styleName: "relationship",
942
942
  fields: a,
@@ -953,23 +953,23 @@ async function qr({
953
953
  }
954
954
  async function Ir({
955
955
  layerId: e,
956
- fields: r,
957
- colorSchemes: t
956
+ fields: t,
957
+ colorSchemes: r
958
958
  }, a) {
959
- const { mapView: o } = R(a);
960
- return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await qr({
959
+ const { mapView: o } = $(a);
960
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await qr({
961
961
  arcgisMap: o.map,
962
962
  arcgisMapView: o,
963
963
  layerId: e,
964
- fields: r,
965
- colorSchemes: t
964
+ fields: t,
965
+ colorSchemes: r
966
966
  });
967
967
  }
968
968
  const zr = s.object({
969
969
  layerId: s.string().describe("The id of the layer to apply the relationship renderer to"),
970
970
  fields: s.array(s.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),
971
971
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
972
- }), _n = w(Ir, {
972
+ }), Vn = g(Ir, {
973
973
  name: "relationship",
974
974
  description: `Label: Relationship
975
975
  Description: Overlays two color ramps to represent the relationship between two numeric attributes.
@@ -979,9 +979,9 @@ const zr = s.object({
979
979
  schema: zr
980
980
  });
981
981
  function Dr(e) {
982
- const { fields: r, layer: t, view: a, theme: o } = e, n = r[0];
982
+ const { fields: t, layer: r, view: a, theme: o } = e, n = t[0];
983
983
  return {
984
- layer: t,
984
+ layer: r,
985
985
  view: a,
986
986
  startTime: n,
987
987
  endTime: /* @__PURE__ */ new Date(),
@@ -995,15 +995,15 @@ async function Pr(e) {
995
995
  }
996
996
  async function Ar({
997
997
  arcgisMap: e,
998
- arcgisMapView: r,
999
- layerId: t,
998
+ arcgisMapView: t,
999
+ layerId: r,
1000
1000
  fields: a,
1001
1001
  colorSchemes: o,
1002
1002
  theme: n
1003
1003
  }) {
1004
- const l = r, i = e?.allLayers.find((u) => u.id === t);
1004
+ const l = t, i = e?.allLayers.find((u) => u.id === r);
1005
1005
  if (!i)
1006
- return `Could not find layer for id: ${t}`;
1006
+ return `Could not find layer for id: ${r}`;
1007
1007
  const c = {
1008
1008
  styleName: "size-age",
1009
1009
  fields: a,
@@ -1019,42 +1019,42 @@ async function Ar({
1019
1019
  return `Error applying size-age renderer: ${u instanceof Error ? u.message : String(u)}`;
1020
1020
  }
1021
1021
  }
1022
- async function jr({
1022
+ async function Lr({
1023
1023
  layerId: e,
1024
- fields: r,
1025
- colorSchemes: t,
1024
+ fields: t,
1025
+ colorSchemes: r,
1026
1026
  theme: a
1027
1027
  }, o) {
1028
- const { mapView: n } = R(o);
1029
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await Ar({
1028
+ const { mapView: n } = $(o);
1029
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Ar({
1030
1030
  arcgisMap: n.map,
1031
1031
  arcgisMapView: n,
1032
1032
  layerId: e,
1033
- fields: r,
1034
- colorSchemes: t,
1033
+ fields: t,
1034
+ colorSchemes: r,
1035
1035
  theme: a
1036
1036
  });
1037
1037
  }
1038
- const Lr = s.object({
1038
+ const jr = s.object({
1039
1039
  layerId: s.string().describe("The id of the layer to apply the size-age renderer to"),
1040
1040
  fields: s.array(s.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),
1041
1041
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
1042
1042
  theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
1043
- }), Wn = w(jr, {
1043
+ }), Bn = g(Lr, {
1044
1044
  name: "size-age",
1045
1045
  description: `Label: Age (size)
1046
1046
  Description: Vary symbol sizes along a continuous ramp to represent the age of features. Age reflects the length of time from a start date to an end date.
1047
1047
  Keywords: since, age, how old, how long
1048
1048
  Example: Change the size of features so older features are larger than new features.
1049
1049
  Fields: This style requires at least one field with a date type.`,
1050
- schema: Lr
1050
+ schema: jr
1051
1051
  });
1052
1052
  function Gr(e) {
1053
- const { fields: r, layer: t, view: a } = e;
1054
- let { theme: o } = e, n = r[1];
1055
- const l = r[0];
1053
+ const { fields: t, layer: r, view: a } = e;
1054
+ let { theme: o } = e, n = t[1];
1055
+ const l = t[0];
1056
1056
  return {
1057
- layer: t,
1057
+ layer: r,
1058
1058
  view: a,
1059
1059
  field: l,
1060
1060
  normalizationField: n,
@@ -1068,15 +1068,15 @@ async function Or(e) {
1068
1068
  }
1069
1069
  async function Mr({
1070
1070
  arcgisMap: e,
1071
- arcgisMapView: r,
1072
- layerId: t,
1071
+ arcgisMapView: t,
1072
+ layerId: r,
1073
1073
  fields: a,
1074
1074
  colorSchemes: o,
1075
1075
  theme: n
1076
1076
  }) {
1077
- const l = r, i = e?.allLayers.find((u) => u.id === t);
1077
+ const l = t, i = e?.allLayers.find((u) => u.id === r);
1078
1078
  if (!i)
1079
- return `Could not find layer for id: ${t}`;
1079
+ return `Could not find layer for id: ${r}`;
1080
1080
  const c = {
1081
1081
  styleName: "size",
1082
1082
  fields: a,
@@ -1094,17 +1094,17 @@ async function Mr({
1094
1094
  }
1095
1095
  async function Qr({
1096
1096
  layerId: e,
1097
- fields: r,
1098
- colorSchemes: t,
1097
+ fields: t,
1098
+ colorSchemes: r,
1099
1099
  theme: a
1100
1100
  }, o) {
1101
- const { mapView: n } = R(o);
1102
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await Mr({
1101
+ const { mapView: n } = $(o);
1102
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Mr({
1103
1103
  arcgisMap: n.map,
1104
1104
  arcgisMapView: n,
1105
1105
  layerId: e,
1106
- fields: r,
1107
- colorSchemes: t,
1106
+ fields: t,
1107
+ colorSchemes: r,
1108
1108
  theme: a
1109
1109
  });
1110
1110
  }
@@ -1113,7 +1113,7 @@ const _r = s.object({
1113
1113
  fields: s.array(s.string()).describe("The field(s) to use for the size renderer (numeric data)"),
1114
1114
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
1115
1115
  theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
1116
- }), Vn = w(Qr, {
1116
+ }), Un = g(Qr, {
1117
1117
  name: "size",
1118
1118
  description: `Label: Counts and Amounts (size)
1119
1119
  Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
@@ -1129,13 +1129,13 @@ const _r = s.object({
1129
1129
  schema: _r
1130
1130
  });
1131
1131
  function Wr(e) {
1132
- const { fields: r, layer: t, view: a, colorSchemeTags: o } = e, n = r[0], l = r[1], i = r[2];
1132
+ const { fields: t, layer: r, view: a, colorSchemeTags: o } = e, n = t[0], l = t[1], i = t[2];
1133
1133
  let c;
1134
1134
  return o && (c = ot({
1135
- geometryType: t.geometryType,
1135
+ geometryType: r.geometryType,
1136
1136
  includedTags: o
1137
1137
  })[0]), {
1138
- layer: t,
1138
+ layer: r,
1139
1139
  view: a,
1140
1140
  field: n,
1141
1141
  field2: l,
@@ -1148,17 +1148,17 @@ function Wr(e) {
1148
1148
  async function Vr(e) {
1149
1149
  return await at(e);
1150
1150
  }
1151
- async function Ur({
1151
+ async function Br({
1152
1152
  arcgisMap: e,
1153
- arcgisMapView: r,
1154
- layerId: t,
1153
+ arcgisMapView: t,
1154
+ layerId: r,
1155
1155
  fields: a,
1156
1156
  colorSchemes: o,
1157
1157
  theme: n
1158
1158
  }) {
1159
- const l = r, i = e?.allLayers.find((u) => u.id === t);
1159
+ const l = t, i = e?.allLayers.find((u) => u.id === r);
1160
1160
  if (!i)
1161
- return `Could not find layer for id: ${t}`;
1161
+ return `Could not find layer for id: ${r}`;
1162
1162
  const c = {
1163
1163
  styleName: "type",
1164
1164
  fields: a,
@@ -1174,19 +1174,19 @@ async function Ur({
1174
1174
  return `Error applying type renderer: ${u instanceof Error ? u.message : String(u)}`;
1175
1175
  }
1176
1176
  }
1177
- async function Br({
1177
+ async function Ur({
1178
1178
  layerId: e,
1179
- fields: r,
1180
- colorSchemes: t,
1179
+ fields: t,
1180
+ colorSchemes: r,
1181
1181
  theme: a
1182
1182
  }, o) {
1183
- const { mapView: n } = R(o);
1184
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await Ur({
1183
+ const { mapView: n } = $(o);
1184
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Br({
1185
1185
  arcgisMap: n.map,
1186
1186
  arcgisMapView: n,
1187
1187
  layerId: e,
1188
- fields: r,
1189
- colorSchemes: t,
1188
+ fields: t,
1189
+ colorSchemes: r,
1190
1190
  theme: a
1191
1191
  });
1192
1192
  }
@@ -1195,7 +1195,7 @@ const Kr = s.object({
1195
1195
  fields: s.array(s.string()).describe("The field(s) to use for the type renderer (categorical data)"),
1196
1196
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
1197
1197
  theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color scheme")
1198
- }), Un = w(Br, {
1198
+ }), Kn = g(Ur, {
1199
1199
  name: "type",
1200
1200
  description: `Label: Types (unique symbols)
1201
1201
  Description: Represent features as categories with different symbol colors or shapes. Examples include type of tree, road class, or province name.
@@ -1203,43 +1203,43 @@ Keywords: categorical, category, type, unique, discrete, point of interest, regi
1203
1203
  Example: Color each feature based on the region it belongs to
1204
1204
  Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,
1205
1205
  schema: Kr
1206
- }), Bn = b.Root({
1206
+ }), Hn = T.Root({
1207
1207
  ...H(),
1208
- vectorSearchLayerIds: b(),
1209
- vectorSearchFieldResults: b(),
1210
- layerFieldInfo: b(),
1211
- selectedLayerId: b()
1212
- }), Kn = b.Root({
1208
+ vectorSearchLayerIds: T(),
1209
+ vectorSearchFieldResults: T(),
1210
+ layerFieldInfo: T(),
1211
+ selectedLayerId: T()
1212
+ }), Jn = T.Root({
1213
1213
  ...H(),
1214
- vectorSearchLayerIds: b(),
1215
- vectorSearchFieldResults: b(),
1216
- layerFieldInfo: b(),
1217
- queryResponse: b(),
1218
- dataExplorationMessages: b({
1214
+ vectorSearchLayerIds: T(),
1215
+ vectorSearchFieldResults: T(),
1216
+ layerFieldInfo: T(),
1217
+ queryResponse: T(),
1218
+ dataExplorationMessages: T({
1219
1219
  reducer: be,
1220
1220
  default: () => []
1221
1221
  })
1222
1222
  }), Hr = ["mapView"];
1223
1223
  function N(e) {
1224
- const t = e?.configurable?.context;
1225
- if (!t || typeof t != "object")
1224
+ const r = e?.configurable?.context;
1225
+ if (!r || typeof r != "object")
1226
1226
  throw new Error("DataExplorationAgent context missing");
1227
- const a = Hr.filter((o) => !(o in t));
1227
+ const a = Hr.filter((o) => !(o in r));
1228
1228
  if (a.length)
1229
1229
  throw new Error(`DataExplorationAgent context missing: ${a.join(", ")}`);
1230
- return t;
1230
+ return r;
1231
1231
  }
1232
1232
  const Jr = (e) => {
1233
- const r = e.map?.allLayers.filter((a) => a.type === "feature");
1234
- let t = 0;
1235
- return r?.forEach((a) => {
1233
+ const t = e.map?.allLayers.filter((a) => a.type === "feature");
1234
+ let r = 0;
1235
+ return t?.forEach((a) => {
1236
1236
  const o = a;
1237
- o.featureEffect && (o.featureEffect = null, t++);
1238
- }), t > 0 ? `Cleared filters from ${t} layer(s). View unchanged.` : "No active filters to clear. View unchanged.";
1239
- }, Zr = async (e, r) => {
1240
- const { mapView: t } = N(r);
1241
- return Jr(t);
1242
- }, Yr = w(Zr, {
1237
+ o.featureEffect && (o.featureEffect = null, r++);
1238
+ }), r > 0 ? `Cleared filters from ${r} layer(s). View unchanged.` : "No active filters to clear. View unchanged.";
1239
+ }, Zr = async (e, t) => {
1240
+ const { mapView: r } = N(t);
1241
+ return Jr(r);
1242
+ }, Yr = g(Zr, {
1243
1243
  name: "clearFilters",
1244
1244
  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.",
1245
1245
  schema: s.object({})
@@ -1250,41 +1250,41 @@ const Jr = (e) => {
1250
1250
  });
1251
1251
  const a = e.map.initialViewProperties?.viewpoint?.targetGeometry;
1252
1252
  return a ? (await e.goTo(a), "Cleared all filters and returned to home extent.") : "Cleared all filters. Could not determine home extent.";
1253
- }, ea = async (e, r) => {
1254
- const { mapView: t } = N(r);
1255
- return await Xr(t);
1256
- }, ta = w(ea, {
1253
+ }, ea = async (e, t) => {
1254
+ const { mapView: r } = N(t);
1255
+ return await Xr(r);
1256
+ }, ta = g(ea, {
1257
1257
  name: "resetMap",
1258
1258
  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.",
1259
1259
  schema: s.object({})
1260
1260
  }), we = 750;
1261
- function B(e) {
1261
+ function U(e) {
1262
1262
  return "point" in e && e.point !== void 0;
1263
1263
  }
1264
- function L(e) {
1264
+ function j(e) {
1265
1265
  return "layerId" in e && e.layerId !== void 0;
1266
1266
  }
1267
- const J = async (e, r) => {
1268
- if (B(e)) {
1269
- const { point: t } = e;
1267
+ const J = async (e, t) => {
1268
+ if (U(e)) {
1269
+ const { point: r } = e;
1270
1270
  return { geometry: new Te({
1271
- x: t.x,
1272
- y: t.y,
1273
- spatialReference: t.spatialReference ? { wkid: t.spatialReference.wkid } : r.spatialReference
1271
+ x: r.x,
1272
+ y: r.y,
1273
+ spatialReference: r.spatialReference ? { wkid: r.spatialReference.wkid } : t.spatialReference
1274
1274
  }) };
1275
1275
  }
1276
- if (L(e)) {
1277
- const t = r.map?.allLayers.find(
1276
+ if (j(e)) {
1277
+ const r = t.map?.allLayers.find(
1278
1278
  (n) => n.id === e.layerId
1279
1279
  );
1280
- if (!t)
1280
+ if (!r)
1281
1281
  return { error: `Could not find geometry layer with ID: ${e.layerId}` };
1282
- const a = t.title ?? t.id, o = e.where?.trim() || "1=1";
1282
+ const a = r.title ?? r.id, o = e.where?.trim() || "1=1";
1283
1283
  try {
1284
- const n = await t.queryFeatures({
1284
+ const n = await r.queryFeatures({
1285
1285
  where: o,
1286
1286
  returnGeometry: !0,
1287
- outSpatialReference: r.spatialReference,
1287
+ outSpatialReference: t.spatialReference,
1288
1288
  num: we + 1
1289
1289
  });
1290
1290
  if (!n.features.length)
@@ -1299,18 +1299,18 @@ const J = async (e, r) => {
1299
1299
  if (!l.length)
1300
1300
  return { error: "No valid geometries found for the matched geometry layer features." };
1301
1301
  const i = l.length === 1 ? l[0] : st.executeMany(l);
1302
- return i ? (i.spatialReference || (i.spatialReference = r.spatialReference), { geometry: i }) : { error: "Failed to combine geometries from geometry layer." };
1302
+ return i ? (i.spatialReference || (i.spatialReference = t.spatialReference), { geometry: i }) : { error: "Failed to combine geometries from geometry layer." };
1303
1303
  } catch (n) {
1304
1304
  return { error: `Failed to query geometry: ${String(n)}` };
1305
1305
  }
1306
1306
  }
1307
1307
  return { error: "Invalid geometry configuration provided" };
1308
- }, ra = async (e, r, t, a, o, n) => {
1309
- const l = e.map?.allLayers.find((c) => c.id === r);
1308
+ }, ra = async (e, t, r, a, o, n) => {
1309
+ const l = e.map?.allLayers.find((c) => c.id === t);
1310
1310
  if (!l)
1311
- return { success: !1, error: `Layer '${r}' not found.` };
1311
+ return { success: !1, error: `Layer '${t}' not found.` };
1312
1312
  const i = l.createQuery();
1313
- i.where = t ?? "1=1", a && (i.geometry = a, i.spatialRelationship = "intersects", o && (i.distance = o), n && (i.units = n));
1313
+ i.where = r ?? "1=1", a && (i.geometry = a, i.spatialRelationship = "intersects", o && (i.distance = o), n && (i.units = n));
1314
1314
  try {
1315
1315
  const { extent: c, count: u } = await l.queryExtent(i);
1316
1316
  return !c || u === 0 ? {
@@ -1323,15 +1323,15 @@ const J = async (e, r) => {
1323
1323
  error: c instanceof Error ? c.message : String(c)
1324
1324
  };
1325
1325
  }
1326
- }, aa = async (e, r, t, a, o, n) => {
1327
- const l = r.map?.allLayers.find(
1326
+ }, aa = async (e, t, r, a, o, n) => {
1327
+ const l = t.map?.allLayers.find(
1328
1328
  (p) => p.id === e.layerId
1329
1329
  );
1330
1330
  if (!l)
1331
1331
  return `Could not find target layer with ID: ${e.layerId}`;
1332
1332
  let i;
1333
1333
  if (o) {
1334
- const p = await J(o, r);
1334
+ const p = await J(o, t);
1335
1335
  if ("error" in p)
1336
1336
  return p.error;
1337
1337
  i = p.geometry;
@@ -1344,12 +1344,12 @@ const J = async (e, r) => {
1344
1344
  distance: o?.distance,
1345
1345
  units: o?.units
1346
1346
  }),
1347
- includedEffect: t,
1347
+ includedEffect: r,
1348
1348
  excludedEffect: a
1349
1349
  }), l.visible = !0, n)
1350
1350
  return `Applied feature effects to "${l.title ?? e.layerId}" within current map extent.`;
1351
1351
  const c = e.objectIds?.length ? `${l.objectIdField} IN (${e.objectIds.join(",")})` : e.where, u = await ra(
1352
- r,
1352
+ t,
1353
1353
  e.layerId,
1354
1354
  c,
1355
1355
  i,
@@ -1359,13 +1359,13 @@ const J = async (e, r) => {
1359
1359
  return u.success ? `Applied feature effects to target layer "${l.title ?? e.layerId}"${o && "layerId" in o ? ` using geometry from layer "${o.layerId}"` : ""}.` : `Applied filter to "${d}" but no features matched. ${u.error}`;
1360
1360
  }, oa = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], F = s.enum(oa), na = async ({
1361
1361
  targetLayer: e,
1362
- geometryFilter: r,
1363
- useCurrentExtent: t,
1362
+ geometryFilter: t,
1363
+ useCurrentExtent: r,
1364
1364
  includedEffect: a = "drop-shadow(2px, 2px, 2px, gray)",
1365
1365
  excludedEffect: o = "grayscale(100%) opacity(60%) blur(2px)"
1366
1366
  }, n) => {
1367
1367
  const { mapView: l } = N(n);
1368
- return await aa(e, l, a, o, r, t);
1368
+ return await aa(e, l, a, o, t, r);
1369
1369
  }, ia = s.object({
1370
1370
  layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
1371
1371
  where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
@@ -1399,7 +1399,7 @@ const J = async (e, r) => {
1399
1399
  excludedEffect: s.string().default("grayscale(100%) opacity(60%) blur(2px)").describe(
1400
1400
  "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
1401
  )
1402
- }), ca = w(na, {
1402
+ }), ca = g(na, {
1403
1403
  name: "setFeatureEffect",
1404
1404
  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
1405
  schema: la
@@ -1407,20 +1407,20 @@ const J = async (e, r) => {
1407
1407
  if (e instanceof Date)
1408
1408
  return Number.isNaN(e.getTime()) ? null : e;
1409
1409
  if (typeof e == "number" && Number.isFinite(e)) {
1410
- const r = new Date(e);
1411
- return Number.isNaN(r.getTime()) ? null : r;
1410
+ const t = new Date(e);
1411
+ return Number.isNaN(t.getTime()) ? null : t;
1412
1412
  }
1413
1413
  return null;
1414
1414
  }, ua = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, da = (e) => {
1415
1415
  if (typeof e == "string" && e)
1416
1416
  return e;
1417
- const r = te(e);
1418
- return r ? r.toISOString().slice(0, 10) : null;
1419
- }, Hn = () => {
1420
- const e = (/* @__PURE__ */ new Date()).getTimezoneOffset(), r = e <= 0 ? "+" : "-", t = Math.floor(Math.abs(e) / 60).toString().padStart(2, "0"), a = (Math.abs(e) % 60).toString().padStart(2, "0"), o = `${r}${t}:${a}`;
1417
+ const t = te(e);
1418
+ return t ? t.toISOString().slice(0, 10) : null;
1419
+ }, Zn = () => {
1420
+ const e = (/* @__PURE__ */ new Date()).getTimezoneOffset(), t = e <= 0 ? "+" : "-", r = Math.floor(Math.abs(e) / 60).toString().padStart(2, "0"), a = (Math.abs(e) % 60).toString().padStart(2, "0"), o = `${t}${r}:${a}`;
1421
1421
  return { userTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone, userTimezoneOffset: o };
1422
- }, pa = (e, r, t) => {
1423
- const a = r?.toLowerCase();
1422
+ }, pa = (e, t, r) => {
1423
+ const a = t?.toLowerCase();
1424
1424
  if (a === "date-only") {
1425
1425
  const n = da(e);
1426
1426
  return n ? lt(n, _("short-date")) : e;
@@ -1437,62 +1437,62 @@ const J = async (e, r) => {
1437
1437
  const o = te(e);
1438
1438
  return o ? ye(o, {
1439
1439
  ..._("short-date-short-time"),
1440
- timeZone: ua(t)
1440
+ timeZone: ua(r)
1441
1441
  }) : e;
1442
- }, Re = (e, r, t) => {
1442
+ }, Re = (e, t, r) => {
1443
1443
  if (e && typeof e != "function") {
1444
- const a = "getField" in t && t.getField?.(e), o = a && "getFieldDomain" in t && t.getFieldDomain ? t.getFieldDomain(a.name) : null;
1444
+ const a = "getField" in r && r.getField?.(e), o = a && "getFieldDomain" in r && r.getFieldDomain ? r.getFieldDomain(a.name) : null;
1445
1445
  if (o?.type === "coded-value") {
1446
- const l = o.codedValues.find((i) => i.code === r);
1446
+ const l = o.codedValues.find((i) => i.code === t);
1447
1447
  return l ? l.name : null;
1448
1448
  }
1449
1449
  }
1450
1450
  return null;
1451
- }, ha = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, ma = (e) => {
1451
+ }, ma = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, ha = (e) => {
1452
1452
  if (e instanceof Date)
1453
1453
  return Number.isNaN(e.getTime()) ? null : e;
1454
1454
  if (typeof e == "number" && Number.isFinite(e)) {
1455
- const r = new Date(e);
1456
- return Number.isNaN(r.getTime()) ? null : r;
1455
+ const t = new Date(e);
1456
+ return Number.isNaN(t.getTime()) ? null : t;
1457
1457
  }
1458
1458
  if (typeof e == "string" && e) {
1459
- const r = new Date(e);
1460
- return Number.isNaN(r.getTime()) ? null : r;
1459
+ const t = new Date(e);
1460
+ return Number.isNaN(t.getTime()) ? null : t;
1461
1461
  }
1462
1462
  return null;
1463
- }, ya = (e, r) => {
1463
+ }, ya = (e, t) => {
1464
1464
  if (typeof e != "number")
1465
1465
  return e;
1466
- const t = {};
1467
- r.minimumFractionDigits !== void 0 && (t.minimumFractionDigits = r.minimumFractionDigits), r.maximumFractionDigits !== void 0 && (t.maximumFractionDigits = r.maximumFractionDigits), r.useGrouping === "always" ? t.useGrouping = !0 : r.useGrouping === "never" && (t.useGrouping = !1);
1466
+ const r = {};
1467
+ t.minimumFractionDigits !== void 0 && (r.minimumFractionDigits = t.minimumFractionDigits), t.maximumFractionDigits !== void 0 && (r.maximumFractionDigits = t.maximumFractionDigits), t.useGrouping === "always" ? r.useGrouping = !0 : t.useGrouping === "never" && (r.useGrouping = !1);
1468
1468
  try {
1469
- return new Intl.NumberFormat(void 0, t).format(e);
1469
+ return new Intl.NumberFormat(void 0, r).format(e);
1470
1470
  } catch {
1471
1471
  return e;
1472
1472
  }
1473
- }, fa = (e, r, t) => {
1474
- const a = ma(e);
1473
+ }, fa = (e, t, r) => {
1474
+ const a = ha(e);
1475
1475
  if (!a)
1476
1476
  return e;
1477
1477
  const o = {};
1478
- r.dateStyle ? o.dateStyle = r.dateStyle : (r.year && (o.year = r.year), r.month && (o.month = r.month)), r.timeStyle && (o.timeStyle = r.timeStyle), r.timeStyle && r.hour12 === "always" ? o.hour12 = !0 : r.timeStyle && r.hour12 === "never" && (o.hour12 = !1), o.timeZone = ha(t);
1478
+ t.dateStyle ? o.dateStyle = t.dateStyle : (t.year && (o.year = t.year), t.month && (o.month = t.month)), t.timeStyle && (o.timeStyle = t.timeStyle), t.timeStyle && t.hour12 === "always" ? o.hour12 = !0 : t.timeStyle && t.hour12 === "never" && (o.hour12 = !1), o.timeZone = ma(r);
1479
1479
  try {
1480
1480
  return new Intl.DateTimeFormat(void 0, o).format(a);
1481
1481
  } catch {
1482
1482
  return e;
1483
1483
  }
1484
- }, $e = (e, r) => e.getFieldAlias?.(r) ?? e.fieldsIndex?.get(r)?.alias ?? e.fieldsIndex?.get(r)?.name ?? r, Ce = (e, r, t, a, o) => {
1485
- if (t == null)
1486
- return t;
1487
- const l = e.getFieldConfiguration?.(r)?.fieldFormat;
1488
- return l?.type === "number" ? ya(t, l) : l?.type === "date-time" ? fa(t, l, o) : pa(t, a, o);
1489
- }, ga = (e, r, t, a) => {
1490
- const o = e.fieldsIndex?.get(r), n = Re(r, t, e) ?? t;
1491
- return Ce(e, r, n, o?.type, a);
1492
- }, wa = (e, r) => $e(e, r), Ee = (e, r, t) => {
1493
- const a = e.objectIdField, o = r.features.map(
1484
+ }, $e = (e, t) => e.getFieldAlias?.(t) ?? e.fieldsIndex?.get(t)?.alias ?? e.fieldsIndex?.get(t)?.name ?? t, Ce = (e, t, r, a, o) => {
1485
+ if (r == null)
1486
+ return r;
1487
+ const l = e.getFieldConfiguration?.(t)?.fieldFormat;
1488
+ return l?.type === "number" ? ya(r, l) : l?.type === "date-time" ? fa(r, l, o) : pa(r, a, o);
1489
+ }, ga = (e, t, r, a) => {
1490
+ const o = e.fieldsIndex?.get(t), n = Re(t, r, e) ?? r;
1491
+ return Ce(e, t, n, o?.type, a);
1492
+ }, wa = (e, t) => $e(e, t), Ee = (e, t, r) => {
1493
+ const a = e.objectIdField, o = t.features.map(
1494
1494
  (l) => l.attributes[a]
1495
- ), n = r.features.map((l) => {
1495
+ ), n = t.features.map((l) => {
1496
1496
  const i = l.attributes, c = {};
1497
1497
  return e.fields.forEach((u) => {
1498
1498
  if (!Object.hasOwn(i, u.name))
@@ -1502,30 +1502,30 @@ const J = async (e, r) => {
1502
1502
  c[u.name] = d;
1503
1503
  return;
1504
1504
  }
1505
- const p = Re(u.name, d, e) ?? d, h = $e(e, u.name);
1506
- c[h] = Ce(e, u.name, p, u.type, t);
1505
+ const p = Re(u.name, d, e) ?? d, m = $e(e, u.name);
1506
+ c[m] = Ce(e, u.name, p, u.type, r);
1507
1507
  }), c;
1508
1508
  });
1509
1509
  return { objectIds: o, attributes: n };
1510
- }, ba = (e, r, t) => {
1510
+ }, ba = (e, t, r) => {
1511
1511
  const a = e.createQuery();
1512
- return a.outFields = [r], a.where = t || "1=1", a.num = 1, a;
1513
- }, Ta = async (e, r, t, a) => {
1514
- const o = a.map?.allLayers.find((h) => h.id === e), n = ba(o, r, t.where), i = (await o.queryFeatures(n)).features[0], c = i ? i.attributes[r] : null, u = ga(o, r, c, a.timeZone), d = wa(o, r);
1512
+ return a.outFields = [t], a.where = r || "1=1", a.num = 1, a;
1513
+ }, Ta = async (e, t, r, a) => {
1514
+ const o = a.map?.allLayers.find((m) => m.id === e), n = ba(o, t, r.where), i = (await o.queryFeatures(n)).features[0], c = i ? i.attributes[t] : null, u = ga(o, t, c, a.timeZone), d = wa(o, t);
1515
1515
  return {
1516
1516
  tool: "getAttribute",
1517
1517
  layerName: o.title ?? e,
1518
1518
  summary: `${d} = ${u}`,
1519
1519
  details: {
1520
- fieldName: r,
1521
- fieldAlias: d !== r ? d : void 0,
1520
+ fieldName: t,
1521
+ fieldAlias: d !== t ? d : void 0,
1522
1522
  value: u,
1523
- where: t.where
1523
+ where: r.where
1524
1524
  }
1525
1525
  };
1526
1526
  };
1527
- async function va({ layerId: e, fieldName: r, query: t }, a) {
1528
- const { mapView: o } = N(a), n = await Ta(e, r, t, o);
1527
+ async function va({ layerId: e, fieldName: t, query: r }, a) {
1528
+ const { mapView: o } = N(a), n = await Ta(e, t, r, o);
1529
1529
  return JSON.stringify(n, null, 2);
1530
1530
  }
1531
1531
  const Sa = s.object({
@@ -1534,32 +1534,37 @@ const Sa = s.object({
1534
1534
  query: s.object({
1535
1535
  where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1536
1536
  })
1537
- }), xa = w(va, {
1537
+ }), xa = g(va, {
1538
1538
  name: "getAttribute",
1539
1539
  description: "Returns an attribute value for a given feature.",
1540
1540
  schema: Sa
1541
- }), le = (e, r, t) => t ? e.hasAllFeaturesInView && e.availableFields === r : e.hasAllFeatures && e.availableFields === r;
1542
- function K(e, r) {
1543
- let t = e ?? "";
1544
- return r != null && r && (t = t ? `(${t}) AND (${r})` : r), t || null;
1541
+ }), le = (e, t, r) => {
1542
+ if (!(r ? e.hasAllFeaturesInView : e.hasAllFeatures))
1543
+ return !1;
1544
+ const o = new Set((e.availableFields ?? []).map((n) => n.toLowerCase()));
1545
+ return o.has("*") ? !0 : t.every((n) => o.has(n.toLowerCase()));
1546
+ };
1547
+ function K(e, t) {
1548
+ let r = e ?? "";
1549
+ return t != null && t && (r = r ? `(${r}) AND (${t})` : t), r || null;
1545
1550
  }
1546
1551
  const Ra = async (e) => {
1547
- const { targetLayer: r, fieldName: t, statisticType: a, mapView: o, layersAndFieldsRegistry: n, geometryFilter: l } = e, i = o.map?.allLayers.find((v) => v.id === r.layerId);
1552
+ const { targetLayer: t, fieldName: r, statisticType: a, mapView: o, layersAndFieldsRegistry: n, geometryFilter: l } = e, i = o.map?.allLayers.find((v) => v.id === t.layerId);
1548
1553
  if (!i)
1549
- throw new Error(`Layer '${r.layerId}' not found.`);
1550
- const c = await o.whenLayerView(i), d = n.get(r.layerId)?.fieldRegistry.get(t), p = d?.alias;
1554
+ throw new Error(`Layer '${t.layerId}' not found.`);
1555
+ const c = await o.whenLayerView(i), d = n.get(t.layerId)?.fieldRegistry.get(r), p = d?.alias;
1551
1556
  if (!d)
1552
- throw new Error(`Field '${t}' not found.`);
1553
- let h, f;
1557
+ throw new Error(`Field '${r}' not found.`);
1558
+ let m, y;
1554
1559
  if (l) {
1555
1560
  const v = await J(l, o);
1556
1561
  if ("error" in v)
1557
1562
  throw new Error(v.error);
1558
1563
  if (!v.geometry)
1559
- throw L(l) ? new Error(`No features found matching: ${l.where}`) : new Error("Failed to create geometry");
1560
- if (L(l)) {
1564
+ throw j(l) ? new Error(`No features found matching: ${l.where}`) : new Error("Failed to create geometry");
1565
+ if (j(l)) {
1561
1566
  const Q = o.map?.allLayers.find((A) => A.id === l.layerId);
1562
- h = {
1567
+ m = {
1563
1568
  geometryLayerName: Q?.title ?? Q?.id,
1564
1569
  geometryLayerId: l.layerId,
1565
1570
  geometryWhere: l.where,
@@ -1567,43 +1572,43 @@ const Ra = async (e) => {
1567
1572
  units: l.units,
1568
1573
  applied: !0
1569
1574
  };
1570
- } else B(l) && (h = {
1575
+ } else U(l) && (m = {
1571
1576
  point: l.point,
1572
1577
  distance: l.distance,
1573
1578
  units: l.units,
1574
1579
  applied: !0
1575
1580
  });
1576
- f = new ve({
1581
+ y = new ve({
1577
1582
  geometry: v.geometry,
1578
1583
  distance: l.distance,
1579
1584
  units: l.units,
1580
1585
  spatialRelationship: "intersects"
1581
1586
  });
1582
1587
  }
1583
- const y = le(c, [t], !1);
1584
- let m = null, g = null;
1585
- const T = 10;
1588
+ const f = le(c, [r], !1);
1589
+ let h = null, w = null;
1590
+ const b = 10;
1586
1591
  if (d.type !== "geometry" && d.type !== "oid" && d.type !== "global-id")
1587
1592
  try {
1588
1593
  const v = {
1589
1594
  layer: i,
1590
- useFeaturesInView: y,
1591
- view: y ? o : void 0,
1592
- field: t,
1593
- sqlWhere: K(i.definitionExpression, r.where),
1594
- ...f && { filter: f },
1595
+ useFeaturesInView: f,
1596
+ view: f ? o : void 0,
1597
+ field: r,
1598
+ sqlWhere: K(i.definitionExpression, t.where),
1599
+ ...y && { filter: y },
1595
1600
  outStatisticTypes: { include: [a] }
1596
1601
  };
1597
- m = await ut(v);
1602
+ h = await ut(v);
1598
1603
  const Q = ["string", "small-integer", "integer"], A = d.domain?.type === "coded-value" ? d.domain : null;
1599
- (Q.includes(d.type) || A) && (g = (await dt({
1604
+ (Q.includes(d.type) || A) && (w = (await dt({
1600
1605
  layer: i,
1601
- useFeaturesInView: y,
1602
- view: y ? o : void 0,
1603
- field: t,
1604
- sqlWhere: K(i.definitionExpression, r.where),
1605
- ...f && { filter: f }
1606
- })).uniqueValueInfos.sort((I, ze) => ze.count - I.count).slice(0, T)), g && d.domain?.type === "coded-value" && (g = g.map((I) => ({
1606
+ useFeaturesInView: f,
1607
+ view: f ? o : void 0,
1608
+ field: r,
1609
+ sqlWhere: K(i.definitionExpression, t.where),
1610
+ ...y && { filter: y }
1611
+ })).uniqueValueInfos.sort((I, ze) => ze.count - I.count).slice(0, b)), w && d.domain?.type === "coded-value" && (w = w.map((I) => ({
1607
1612
  ...I,
1608
1613
  value: A ? A.getName(I.value) ?? I.value : I.value
1609
1614
  })));
@@ -1612,30 +1617,30 @@ const Ra = async (e) => {
1612
1617
  }
1613
1618
  return {
1614
1619
  tool: "getStatistics",
1615
- layerName: i.title ?? r.layerId,
1616
- summary: `${a} = ${typeof m?.[a] == "number" ? m[a] : "N/A"}`,
1620
+ layerName: i.title ?? t.layerId,
1621
+ summary: `${a} = ${typeof h?.[a] == "number" ? h[a] : "N/A"}`,
1617
1622
  details: {
1618
- fieldName: t,
1623
+ fieldName: r,
1619
1624
  fieldAlias: p,
1620
1625
  statisticType: a,
1621
- statistic: m?.[a] ?? null,
1622
- summaryStatistics: m,
1623
- uniqueValues: g,
1624
- where: r.where,
1625
- spatialFilterInfo: h
1626
+ statistic: h?.[a] ?? null,
1627
+ summaryStatistics: h,
1628
+ uniqueValues: w,
1629
+ where: t.where,
1630
+ spatialFilterInfo: m
1626
1631
  }
1627
1632
  };
1628
1633
  };
1629
1634
  async function $a({
1630
1635
  targetLayer: e,
1631
- fieldName: r,
1632
- statisticType: t,
1636
+ fieldName: t,
1637
+ statisticType: r,
1633
1638
  geometryFilter: a
1634
1639
  }, o) {
1635
1640
  const n = xe(o, "layersAndFieldsRegistry"), { mapView: l } = N(o), i = await Ra({
1636
1641
  targetLayer: e,
1637
- fieldName: r,
1638
- statisticType: t,
1642
+ fieldName: t,
1643
+ statisticType: r,
1639
1644
  mapView: l,
1640
1645
  layersAndFieldsRegistry: n,
1641
1646
  geometryFilter: a
@@ -1667,7 +1672,7 @@ const Ca = s.object({
1667
1672
  ),
1668
1673
  fieldName: s.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
1669
1674
  statisticType: s.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
1670
- }), ka = w($a, {
1675
+ }), ka = g($a, {
1671
1676
  name: "getStatistics",
1672
1677
  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
1678
 
@@ -1683,19 +1688,19 @@ DO NOT USE FOR:
1683
1688
 
1684
1689
  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
1690
  schema: Fa
1686
- }), Na = async (e, r, t, a, o) => {
1687
- const n = t.map?.allLayers.find((h) => h.id === e.layerId), l = await t.whenLayerView(n), i = n.title ?? e.layerId;
1691
+ }), Na = (e) => e.flatMap((t) => t.split(",")).map((t) => t.trim()).map((t) => t.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((t) => !!t), qa = async (e, t, r, a, o) => {
1692
+ const n = r.map?.allLayers.find((m) => m.id === e.layerId), l = await r.whenLayerView(n), i = n.title ?? e.layerId;
1688
1693
  let c;
1689
1694
  if (a) {
1690
- const h = await J(a, t);
1691
- if ("error" in h)
1695
+ const m = await J(a, r);
1696
+ if ("error" in m)
1692
1697
  return {
1693
1698
  tool: "getTopFeatures",
1694
1699
  layerName: i,
1695
1700
  summary: "Geometry lookup failed",
1696
- details: { error: h.error }
1701
+ details: { error: m.error }
1697
1702
  };
1698
- if (!h.geometry)
1703
+ if (!m.geometry)
1699
1704
  return {
1700
1705
  tool: "getTopFeatures",
1701
1706
  layerName: i,
@@ -1704,13 +1709,13 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1704
1709
  error: `No features found matching: ${"where" in a ? a.where : "unknown criteria"}`
1705
1710
  }
1706
1711
  };
1707
- c = h.geometry;
1708
- } else o && (c = t.extent.clone());
1709
- const u = r.groupByFields && r.groupByFields.length > 0, d = n.objectIdField, p = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, d])];
1712
+ c = m.geometry;
1713
+ } else o && (c = r.extent.clone());
1714
+ const u = t.groupByFields && t.groupByFields.length > 0, d = n.objectIdField, p = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, d])];
1710
1715
  try {
1711
- let h;
1716
+ let m;
1712
1717
  if (u) {
1713
- const m = new pt({
1718
+ const h = new pt({
1714
1719
  where: e.where || "1=1",
1715
1720
  outFields: p,
1716
1721
  orderByFields: e.orderByFields,
@@ -1718,60 +1723,62 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1718
1723
  spatialRelationship: c ? "intersects" : void 0,
1719
1724
  distance: a?.distance,
1720
1725
  units: a?.units,
1721
- topFilter: new ht({
1722
- topCount: r.topCount,
1723
- groupByFields: r.groupByFields,
1724
- orderByFields: r.orderByFields
1726
+ topFilter: new mt({
1727
+ topCount: t.topCount,
1728
+ groupByFields: t.groupByFields,
1729
+ orderByFields: t.orderByFields
1725
1730
  })
1726
1731
  });
1727
- h = await n.queryTopFeatures(m);
1732
+ m = await n.queryTopFeatures(h);
1728
1733
  } else {
1729
- const m = n.createQuery();
1730
- m.where = K(n.definitionExpression, e.where || "1=1"), m.outFields = p.length ? p : ["*"], m.orderByFields = r.orderByFields, m.num = r.topCount, c && (m.geometry = c, m.spatialRelationship = "intersects"), a?.distance && (m.distance = a.distance), a?.units && (m.units = a.units), m.outSpatialReference = t.spatialReference;
1731
- const g = le(l, e.outFields, o ?? !1);
1734
+ const h = n.createQuery();
1735
+ h.where = K(n.definitionExpression, e.where || "1=1"), h.outFields = p.length ? p : ["*"], h.orderByFields = t.orderByFields, h.returnGeometry = !1, h.num = t.topCount, c && (h.geometry = c, h.spatialRelationship = "intersects"), a?.distance && (h.distance = a.distance), a?.units && (h.units = a.units), h.outSpatialReference = r.spatialReference;
1736
+ const w = [
1737
+ .../* @__PURE__ */ new Set([...e.outFields, ...Na(t.orderByFields)])
1738
+ ], b = le(l, w, o ?? !1);
1732
1739
  try {
1733
- h = g ? await l.queryFeatures(m) : await n.queryFeatures(m);
1734
- } catch (T) {
1735
- console.warn("Client-side query failed, falling back to server:", T), h = await n.queryFeatures(m);
1740
+ m = b ? await l.queryFeatures(h) : await n.queryFeatures(h);
1741
+ } catch (S) {
1742
+ console.warn("Client-side query failed, falling back to server:", S), m = await n.queryFeatures(h);
1736
1743
  }
1737
1744
  }
1738
- const f = h.features.map((m) => m.attributes[d]), { attributes: y } = Ee(n, h, t.timeZone);
1745
+ const y = m.features.map((h) => h.attributes[d]), { attributes: f } = Ee(n, m, r.timeZone);
1739
1746
  return {
1740
1747
  tool: "getTopFeatures",
1741
1748
  layerName: i,
1742
- summary: `Top ${r.topCount} features extracted`,
1749
+ summary: `Top ${t.topCount} features extracted`,
1743
1750
  details: {
1744
- topCount: r.topCount,
1745
- attributes: y,
1746
- objectIds: f,
1751
+ topCount: t.topCount,
1752
+ attributes: f,
1753
+ objectIds: y,
1747
1754
  objectIdField: d,
1748
1755
  where: e.where,
1749
- orderByFields: r.orderByFields,
1750
- ...u && { groupByFields: r.groupByFields }
1756
+ orderByFields: t.orderByFields,
1757
+ ...u && { groupByFields: t.groupByFields }
1751
1758
  }
1752
1759
  };
1753
- } catch (h) {
1760
+ } catch (m) {
1754
1761
  return {
1755
1762
  tool: "getTopFeatures",
1756
1763
  layerName: i,
1757
1764
  summary: "Query failed",
1758
- details: { error: h instanceof Error ? h.message : String(h) }
1765
+ details: { error: m instanceof Error ? m.message : String(m) }
1759
1766
  };
1760
1767
  }
1761
- }, qa = async ({
1768
+ }, Ia = async ({
1762
1769
  targetLayer: e,
1763
- topFilter: r,
1764
- geometryFilter: t,
1770
+ topFilter: t,
1771
+ geometryFilter: r,
1765
1772
  useCurrentExtent: a
1766
1773
  }, o) => {
1767
- const { mapView: n } = N(o), l = await Na(e, r, n, t, a);
1774
+ const { mapView: n } = N(o), l = await qa(e, t, n, r, a);
1768
1775
  return JSON.stringify(l, null, 2);
1769
- }, Ia = s.object({
1776
+ }, za = s.object({
1770
1777
  layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
1771
1778
  where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
1772
1779
  distance: s.number().optional().describe("The buffer distance around the geometry."),
1773
1780
  units: F.optional().describe("The units for the distance buffer.")
1774
- }), za = s.object({
1781
+ }), Da = s.object({
1775
1782
  point: s.object({
1776
1783
  x: s.number().describe("X coordinate (longitude) from navigation result"),
1777
1784
  y: s.number().describe("Y coordinate (latitude) from navigation result"),
@@ -1781,7 +1788,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1781
1788
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1782
1789
  distance: s.number().optional().describe("Optional buffer distance around the point."),
1783
1790
  units: F.optional().describe("The units for the distance buffer.")
1784
- }), Da = s.object({
1791
+ }), Pa = s.object({
1785
1792
  targetLayer: s.object({
1786
1793
  layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
1787
1794
  where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
@@ -1792,7 +1799,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1792
1799
  ).default("*")
1793
1800
  )
1794
1801
  }),
1795
- geometryFilter: s.union([Ia, za]).optional().describe(
1802
+ geometryFilter: s.union([za, Da]).optional().describe(
1796
1803
  "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
1804
  ),
1798
1805
  topFilter: s.object({
@@ -1805,83 +1812,85 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1805
1812
  useCurrentExtent: s.boolean().optional().describe(
1806
1813
  "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
1814
  )
1808
- }), Pa = w(qa, {
1815
+ }), Aa = g(Ia, {
1809
1816
  name: "getTopFeatures",
1810
1817
  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: Da
1812
- }), ee = 25, Aa = async (e, r, t, a) => {
1813
- const o = r.map?.allLayers.find((m) => m.id === e.layerId), n = await r.whenLayerView(o), l = o.title ?? e.layerId;
1818
+ schema: Pa
1819
+ }), ee = 25, La = (e) => e.flatMap((t) => t.split(",")).map((t) => t.trim()).map((t) => t.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((t) => !!t), ja = async (e, t, r, a) => {
1820
+ const o = t.map?.allLayers.find((w) => w.id === e.layerId), n = await t.whenLayerView(o), l = o.title ?? e.layerId;
1814
1821
  let i;
1815
- if (t) {
1816
- const m = await J(t, r);
1817
- if ("error" in m) {
1818
- const g = { error: m.error };
1819
- if (L(t)) {
1820
- const T = r.map?.allLayers.find(($) => $.id === t.layerId);
1821
- g.geometryLayerName = T?.title ?? T?.id, g.geometryLayerId = t.layerId, g.geometryWhere = t.where;
1822
- } else B(t) && (g.point = t.point);
1822
+ if (r) {
1823
+ const w = await J(r, t);
1824
+ if ("error" in w) {
1825
+ const b = { error: w.error };
1826
+ if (j(r)) {
1827
+ const S = t.map?.allLayers.find((v) => v.id === r.layerId);
1828
+ b.geometryLayerName = S?.title ?? S?.id, b.geometryLayerId = r.layerId, b.geometryWhere = r.where;
1829
+ } else U(r) && (b.point = r.point);
1823
1830
  return {
1824
1831
  tool: "queryFeatures",
1825
1832
  layerName: l,
1826
1833
  summary: "Geometry lookup failed",
1827
- details: g
1834
+ details: b
1828
1835
  };
1829
1836
  }
1830
- if (!m.geometry) {
1831
- const g = {};
1832
- if (L(t)) {
1833
- const T = r.map?.allLayers.find(($) => $.id === t.layerId);
1834
- g.error = `No features found matching: ${t.where}`, g.geometryLayerName = T?.title ?? T?.id, g.geometryLayerId = t.layerId, g.geometryWhere = t.where;
1835
- } else B(t) && (g.error = "Failed to create point geometry", g.point = t.point);
1837
+ if (!w.geometry) {
1838
+ const b = {};
1839
+ if (j(r)) {
1840
+ const S = t.map?.allLayers.find((v) => v.id === r.layerId);
1841
+ b.error = `No features found matching: ${r.where}`, b.geometryLayerName = S?.title ?? S?.id, b.geometryLayerId = r.layerId, b.geometryWhere = r.where;
1842
+ } else U(r) && (b.error = "Failed to create point geometry", b.point = r.point);
1836
1843
  return {
1837
1844
  tool: "queryFeatures",
1838
1845
  layerName: l,
1839
1846
  summary: "No features found for geometry filter",
1840
- details: g
1847
+ details: b
1841
1848
  };
1842
1849
  }
1843
- i = m.geometry;
1844
- } else a && (i = r.extent.clone());
1845
- const c = le(n, e.outFields, a ?? !1), u = o.objectIdField, d = o.createQuery();
1846
- d.where = K(o.definitionExpression, e.where || "1=1"), d.outFields = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, u])], d.orderByFields = e.orderByFields, i && (d.geometry = i, d.spatialRelationship = "intersects"), t?.distance && (d.distance = t.distance), t?.units && (d.units = t.units), d.outSpatialReference = r.spatialReference;
1847
- let p, h;
1850
+ i = w.geometry;
1851
+ } else a && (i = t.extent.clone());
1852
+ const c = [
1853
+ .../* @__PURE__ */ new Set([...e.outFields, ...La(e.orderByFields)])
1854
+ ], u = le(n, c, a ?? !1), d = o.objectIdField, p = o.createQuery();
1855
+ p.where = K(o.definitionExpression, e.where || "1=1"), p.outFields = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, d])], p.orderByFields = e.orderByFields, i && (p.geometry = i, p.spatialRelationship = "intersects"), r?.distance && (p.distance = r.distance), r?.units && (p.units = r.units), p.outSpatialReference = t.spatialReference;
1856
+ let m, y;
1848
1857
  try {
1849
- p = c ? await n.queryFeatureCount(d) : await o.queryFeatureCount(d), p > 0 && p <= ee && (h = c ? await n.queryFeatures(d) : await o.queryFeatures(d));
1850
- } catch (m) {
1851
- console.warn("Client-side query failed, falling back to server:", m), p = await o.queryFeatureCount(d), p > 0 && p <= ee && (h = await o.queryFeatures(d));
1858
+ m = u ? await n.queryFeatureCount(p) : await o.queryFeatureCount(p), m > 0 && m <= ee && (y = u ? await n.queryFeatures(p) : await o.queryFeatures(p));
1859
+ } catch (w) {
1860
+ console.warn("Client-side query failed, falling back to server:", w), m = await o.queryFeatureCount(p), m > 0 && m <= ee && (y = await o.queryFeatures(p));
1852
1861
  }
1853
- const { objectIds: f, attributes: y } = h ? Ee(o, h, r.timeZone) : { objectIds: void 0, attributes: void 0 };
1862
+ const { objectIds: f, attributes: h } = y ? Ee(o, y, t.timeZone) : { objectIds: void 0, attributes: void 0 };
1854
1863
  return {
1855
1864
  tool: "queryFeatures",
1856
1865
  layerName: l,
1857
- summary: `${p} features found`,
1866
+ summary: `${m} features found`,
1858
1867
  details: {
1859
- totalCount: p,
1868
+ totalCount: m,
1860
1869
  where: e.where,
1861
1870
  orderByFields: e.orderByFields,
1862
1871
  outFields: e.outFields,
1863
- ...f && { objectIds: f, objectIdField: u },
1864
- ...y && { attributes: y },
1865
- ...p > ee && {
1866
- note: `${p} features found.`
1872
+ ...f && { objectIds: f, objectIdField: d },
1873
+ ...h && { attributes: h },
1874
+ ...m > ee && {
1875
+ note: `${m} features found.`
1867
1876
  }
1868
1877
  }
1869
1878
  };
1870
1879
  };
1871
- async function ja({
1880
+ async function Ga({
1872
1881
  targetLayer: e,
1873
- geometryFilter: r,
1874
- useCurrentExtent: t
1882
+ geometryFilter: t,
1883
+ useCurrentExtent: r
1875
1884
  }, a) {
1876
- const { mapView: o } = N(a), n = await Aa(e, o, r, t);
1885
+ const { mapView: o } = N(a), n = await ja(e, o, t, r);
1877
1886
  return JSON.stringify(n, null, 2);
1878
1887
  }
1879
- const La = s.object({
1888
+ const Oa = s.object({
1880
1889
  layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
1881
1890
  where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
1882
1891
  distance: s.number().optional().describe("The buffer distance around the geometry."),
1883
1892
  units: F.optional().describe("The units for the distance buffer.")
1884
- }), Ga = s.object({
1893
+ }), Ma = s.object({
1885
1894
  point: s.object({
1886
1895
  x: s.number().describe("X coordinate (longitude) from navigation result"),
1887
1896
  y: s.number().describe("Y coordinate (latitude) from navigation result"),
@@ -1891,7 +1900,7 @@ const La = s.object({
1891
1900
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1892
1901
  distance: s.number().optional().describe("Optional buffer distance around the point."),
1893
1902
  units: F.optional().describe("The units for the distance buffer.")
1894
- }), Oa = s.object({
1903
+ }), Qa = s.object({
1895
1904
  targetLayer: s.object({
1896
1905
  layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
1897
1906
  where: s.string().describe(
@@ -1904,13 +1913,13 @@ const La = s.object({
1904
1913
  ).default("*")
1905
1914
  )
1906
1915
  }),
1907
- geometryFilter: s.union([La, Ga]).optional().describe(
1916
+ geometryFilter: s.union([Oa, Ma]).optional().describe(
1908
1917
  "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
1918
  ),
1910
1919
  useCurrentExtent: s.boolean().optional().describe(
1911
1920
  "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
1921
  )
1913
- }), Ma = w(ja, {
1922
+ }), _a = g(Ga, {
1914
1923
  name: "queryFeatures",
1915
1924
  description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
1916
1925
 
@@ -1922,11 +1931,11 @@ USE THIS TOOL FOR:
1922
1931
  - Any question where the user wants to SEE or COUNT matching features
1923
1932
 
1924
1933
  This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1925
- schema: Oa
1926
- }), Qa = [xa, ka, Pa, Ma], Jn = [ca, ta, Yr], _a = new nt(Qa, { handleToolErrors: !1 });
1927
- async function Zn(e, r) {
1928
- const { messages: t } = await _a.invoke({ messages: e.dataExplorationMessages }, r), a = [], o = [];
1929
- for (const n of t) {
1934
+ schema: Qa
1935
+ }), Wa = [xa, ka, Aa, _a], Yn = [ca, ta, Yr], Va = new nt(Wa, { handleToolErrors: !1 });
1936
+ async function Xn(e, t) {
1937
+ const { messages: r } = await Va.invoke({ messages: e.dataExplorationMessages }, t), a = [], o = [];
1938
+ for (const n of r) {
1930
1939
  const l = n.content;
1931
1940
  let i;
1932
1941
  typeof l != "string" && (i = {
@@ -1952,63 +1961,63 @@ async function Zn(e, r) {
1952
1961
  }
1953
1962
  a.push(i), i.details && typeof i.details == "object" && "error" in i.details ? o.push(`- ${i.tool}: Error - ${String(i.details.error)}`) : o.push(`- ${i.layerName}: ${i.summary}`);
1954
1963
  }
1955
- return await S({ text: `Finished executing layer query tool: ${o.join(", ")}` }, r), {
1964
+ return await x({ text: `Finished executing layer query tool: ${o.join(", ")}` }, t), {
1956
1965
  ...e,
1957
- dataExplorationMessages: [...e.dataExplorationMessages, ...t],
1966
+ dataExplorationMessages: [...e.dataExplorationMessages, ...r],
1958
1967
  queryResponse: a,
1959
1968
  status: "success",
1960
- summary: o.length > 0 ? Ut(o.join(`
1969
+ summary: o.length > 0 ? Bt(o.join(`
1961
1970
  `)) : "Query executed."
1962
1971
  };
1963
1972
  }
1964
- const Yn = b.Root({
1973
+ const ei = T.Root({
1965
1974
  ...H(),
1966
1975
  // internal to the help agent
1967
- helpInternalState: b({
1968
- reducer: j,
1976
+ helpInternalState: T({
1977
+ reducer: L,
1969
1978
  default: () => ({
1970
1979
  toolCallMessage: void 0
1971
1980
  })
1972
1981
  })
1973
- }), Wa = (e, r) => {
1974
- const t = Array.from(e.values()).find(
1975
- ({ layerItem: n }) => n.title?.toLowerCase().includes(r.toLowerCase())
1982
+ }), Ba = (e, t) => {
1983
+ const r = Array.from(e.values()).find(
1984
+ ({ layerItem: n }) => n.title?.toLowerCase().includes(t.toLowerCase())
1976
1985
  );
1977
- if (!t) {
1986
+ if (!r) {
1978
1987
  const n = Array.from(e.values()).map((l) => l.layerItem.title).join(", ");
1979
- return `Could not find a layer matching "${r}". Available layers: ${n}`;
1988
+ return `Could not find a layer matching "${t}". Available layers: ${n}`;
1980
1989
  }
1981
- const a = Array.from(t.fieldRegistry.values()), o = a.map((n) => `- **${n.alias || n.name}** (\`${n.name}\`, ${n.type})${n.description ? `: ${n.description}` : ""}`).join(`
1990
+ const a = Array.from(r.fieldRegistry.values()), o = a.map((n) => `- **${n.alias || n.name}** (\`${n.name}\`, ${n.type})${n.description ? `: ${n.description}` : ""}`).join(`
1982
1991
  `);
1983
- return `**${t.layerItem.title}** has ${a.length} field(s):
1992
+ return `**${r.layerItem.title}** has ${a.length} field(s):
1984
1993
 
1985
1994
  ${o}`;
1986
- }, Va = async ({ layerTitle: e }, r) => {
1987
- const t = xe(r, "layersAndFieldsRegistry");
1988
- return Wa(t, e);
1989
- }, Xn = w(Va, {
1995
+ }, Ua = async ({ layerTitle: e }, t) => {
1996
+ const r = xe(t, "layersAndFieldsRegistry");
1997
+ return Ba(r, e);
1998
+ }, ti = g(Ua, {
1990
1999
  name: "listLayerFields",
1991
2000
  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.",
1992
2001
  schema: s.object({
1993
2002
  layerTitle: s.string().describe("The title or partial title of the layer to list fields for.")
1994
2003
  })
1995
- }), ei = b.Root({
2004
+ }), ri = T.Root({
1996
2005
  ...H(),
1997
- intent: b({
1998
- reducer: (e, r) => r
2006
+ intent: T({
2007
+ reducer: (e, t) => t
1999
2008
  }),
2000
- arcgisKnowledgeMessages: b({
2009
+ arcgisKnowledgeMessages: T({
2001
2010
  reducer: be,
2002
2011
  default: () => []
2003
2012
  }),
2004
- arcgisKnowledgeToolResult: b({
2005
- reducer: (e, r) => r,
2013
+ arcgisKnowledgeToolResult: T({
2014
+ reducer: (e, t) => t,
2006
2015
  default: () => null
2007
2016
  })
2008
2017
  });
2009
2018
  function ce(e) {
2010
- const r = e.map?.allLayers.filter((t) => t.type === "knowledge-graph");
2011
- if (!r || r?.length !== 1)
2019
+ const t = e.map?.allLayers.filter((r) => r.type === "knowledge-graph");
2020
+ if (!t || t?.length !== 1)
2012
2021
  throw new Error("The Knowledge Agent currently only supports maps with exactly one Knowledge Graph Layer.");
2013
2022
  }
2014
2023
  function q(e) {
@@ -2018,29 +2027,29 @@ async function Z(e) {
2018
2027
  !e || q(e) || !e.map?.diagramNodesExtent || await e.goTo(e.map.diagramNodesExtent);
2019
2028
  }
2020
2029
  function O(e) {
2021
- const t = e?.configurable?.context;
2022
- if (!t || typeof t != "object")
2030
+ const r = e?.configurable?.context;
2031
+ if (!r || typeof r != "object")
2023
2032
  throw new Error("ArcgisKnowledgeAgent context missing");
2024
- if (!("view" in t))
2033
+ if (!("view" in r))
2025
2034
  throw new Error("View context missing");
2026
- const a = t.view;
2035
+ const a = r.view;
2027
2036
  return a.map && !("activeLinkChartLayer" in a.map) && ce(a), {
2028
2037
  view: a
2029
2038
  };
2030
2039
  }
2031
- function ti(e) {
2032
- const t = e?.configurable?.context;
2040
+ function ai(e) {
2041
+ const r = e?.configurable?.context;
2033
2042
  if (Fe(e) === "knowledgeGraph")
2034
2043
  return "knowledgeGraph";
2035
- const o = t.view;
2044
+ const o = r.view;
2036
2045
  return q(o) ? (ce(o), "map") : "linkChart";
2037
2046
  }
2038
2047
  async function M(e) {
2039
- const t = e?.configurable?.context;
2048
+ const r = e?.configurable?.context;
2040
2049
  if (Fe(e) === "knowledgeGraph")
2041
- return t;
2050
+ return r;
2042
2051
  {
2043
- const o = t.view.map;
2052
+ const o = r.view.map;
2044
2053
  if (o && "activeLinkChartLayer" in o) {
2045
2054
  const n = o.knowledgeGraph?.url;
2046
2055
  if (!n)
@@ -2049,8 +2058,8 @@ async function M(e) {
2049
2058
  knowledgeGraph: await fe(n)
2050
2059
  };
2051
2060
  } else {
2052
- ce(t.view);
2053
- const l = (t.view.map?.allLayers.find(
2061
+ ce(r.view);
2062
+ const l = (r.view.map?.allLayers.find(
2054
2063
  (c) => c.type === "knowledge-graph"
2055
2064
  )).url;
2056
2065
  if (!l)
@@ -2062,20 +2071,20 @@ async function M(e) {
2062
2071
  }
2063
2072
  }
2064
2073
  function Fe(e) {
2065
- const t = e?.configurable?.context;
2066
- if (!t || typeof t != "object")
2074
+ const r = e?.configurable?.context;
2075
+ if (!r || typeof r != "object")
2067
2076
  throw new Error("ArcgisKnowledgeAgent context missing");
2068
- if ("knowledgeGraph" in t && "view" in t)
2077
+ if ("knowledgeGraph" in r && "view" in r)
2069
2078
  throw new Error("Knowledge Graph context should only have a view or knowledgeGraph, but never both.");
2070
- if ("knowledgeGraph" in t)
2079
+ if ("knowledgeGraph" in r)
2071
2080
  return "knowledgeGraph";
2072
- if ("view" in t)
2081
+ if ("view" in r)
2073
2082
  return "view";
2074
2083
  throw new Error("ArcgisKnowledgeAgent context must have either a view or knowledgeGraph property.");
2075
2084
  }
2076
- class Ua {
2077
- constructor(r) {
2078
- this.dataModel = r, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = ue.fromDataModel(r);
2085
+ class Ka {
2086
+ constructor(t) {
2087
+ this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = ue.fromDataModel(t);
2079
2088
  }
2080
2089
  }
2081
2090
  class ue {
@@ -2087,25 +2096,25 @@ class ue {
2087
2096
  }
2088
2097
  };
2089
2098
  }
2090
- static fromDataModel(r) {
2091
- const t = new ue();
2092
- for (const a of r.entityTypes)
2093
- t.entityTypes.push(G.fromEntityType(a));
2094
- for (const a of r.relationshipTypes)
2095
- t.relationshipTypes.push(Ba.fromRelationshipType(a));
2096
- return t.identifierInfo = {
2099
+ static fromDataModel(t) {
2100
+ const r = new ue();
2101
+ for (const a of t.entityTypes)
2102
+ r.entityTypes.push(G.fromEntityType(a));
2103
+ for (const a of t.relationshipTypes)
2104
+ r.relationshipTypes.push(Ha.fromRelationshipType(a));
2105
+ return r.identifierInfo = {
2097
2106
  mappingInfo: {
2098
- identifierMapsTo: Ka(
2099
- r.identifierInfo.identifierMappingInfo.identifierInfoType
2107
+ identifierMapsTo: Ja(
2108
+ t.identifierInfo.identifierMappingInfo.identifierInfoType
2100
2109
  ),
2101
- identifierPropertyName: r.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName
2110
+ identifierPropertyName: t.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName
2102
2111
  }
2103
- }, t.spatialReference = JSON.parse(JSON.stringify(r.spatialReference)), t;
2112
+ }, r.spatialReference = JSON.parse(JSON.stringify(t.spatialReference)), r;
2104
2113
  }
2105
2114
  // Generates a short summary of the types in the data model for LLM consumption.
2106
- static getDataModelTypesSummary(r) {
2107
- const t = r.entityTypes.map((o) => o.name).join(", "), a = r.relationshipTypes.map((o) => o.name).join(", ");
2108
- return `Entity Types: ${t}.
2115
+ static getDataModelTypesSummary(t) {
2116
+ const r = t.entityTypes.map((o) => o.name).join(", "), a = t.relationshipTypes.map((o) => o.name).join(", ");
2117
+ return `Entity Types: ${r}.
2109
2118
  Relationship Types: ${a}.`;
2110
2119
  }
2111
2120
  }
@@ -2113,42 +2122,42 @@ class G {
2113
2122
  constructor() {
2114
2123
  this.name = "", this.properties = [];
2115
2124
  }
2116
- static fromEntityType(r) {
2117
- const t = new G();
2118
- t.name = r.name, t.alias = r.alias ? r.alias : void 0, t.role = Ha(r.role);
2119
- for (const a of r.properties) {
2125
+ static fromEntityType(t) {
2126
+ const r = new G();
2127
+ r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = Za(t.role);
2128
+ for (const a of t.properties) {
2120
2129
  const o = {
2121
2130
  name: a.name,
2122
2131
  alias: a.alias ? a.alias : void 0,
2123
2132
  fieldType: a.fieldType,
2124
- role: Ja(a.role),
2133
+ role: Ya(a.role),
2125
2134
  geometryDef: a.fieldType === "esriFieldTypeGeometry" ? {
2126
2135
  geometryType: a.geometryType ?? "esriGeometryAny",
2127
2136
  hasM: a.hasM ? a.hasM : void 0,
2128
2137
  hasZ: a.hasZ ? a.hasZ : void 0
2129
2138
  } : void 0
2130
2139
  };
2131
- t.properties.push(o);
2140
+ r.properties.push(o);
2132
2141
  }
2133
- return t;
2142
+ return r;
2134
2143
  }
2135
2144
  }
2136
- class Ba extends G {
2145
+ class Ha extends G {
2137
2146
  constructor() {
2138
2147
  super(...arguments), this.observedEndPoints = [];
2139
2148
  }
2140
- static fromRelationshipType(r) {
2141
- const t = G.fromEntityType(r);
2142
- t.observedEndPoints = [];
2143
- for (const a of r.endPoints)
2144
- t.observedEndPoints.push({
2149
+ static fromRelationshipType(t) {
2150
+ const r = G.fromEntityType(t);
2151
+ r.observedEndPoints = [];
2152
+ for (const a of t.endPoints)
2153
+ r.observedEndPoints.push({
2145
2154
  originEntityType: a.originEntityType,
2146
2155
  destinationEntityType: a.destinationEntityType
2147
2156
  });
2148
- return t;
2157
+ return r;
2149
2158
  }
2150
2159
  }
2151
- const Ka = (e) => {
2160
+ const Ja = (e) => {
2152
2161
  switch (e) {
2153
2162
  case "esriIdentifierInfoTypeUNSPECIFIED":
2154
2163
  return "UNSPECIFIED";
@@ -2159,7 +2168,7 @@ const Ka = (e) => {
2159
2168
  default:
2160
2169
  return e;
2161
2170
  }
2162
- }, Ha = (e) => {
2171
+ }, Za = (e) => {
2163
2172
  switch (e) {
2164
2173
  case "Regular":
2165
2174
  return "esriGraphNamedObjectRegular";
@@ -2171,7 +2180,7 @@ const Ka = (e) => {
2171
2180
  return e;
2172
2181
  }
2173
2182
  };
2174
- function Ja(e) {
2183
+ function Ya(e) {
2175
2184
  switch (e) {
2176
2185
  case "esriGraphPropertyRegular":
2177
2186
  return "Regular";
@@ -2212,28 +2221,28 @@ function Ja(e) {
2212
2221
  function Y(e) {
2213
2222
  return e?.signal;
2214
2223
  }
2215
- async function Za(e, r) {
2216
- const t = await U("arcgis_knowledge_cypher_query_prompt");
2217
- return r ? `${e} ${t}
2224
+ async function Xa(e, t) {
2225
+ const r = await B("arcgis_knowledge_cypher_query_prompt");
2226
+ return t ? `${e} ${r}
2218
2227
 
2219
2228
  Your previous attempt to generate a cypher query failed. See the details below and generate a new cypher query that avoids this error.
2220
2229
 
2221
- Attempt Number: ${r.attemptCount}
2222
- Execution Error: ${r.executionError}
2230
+ Attempt Number: ${t.attemptCount}
2231
+ Execution Error: ${t.executionError}
2223
2232
  Failed Query:
2224
- ${r.failedGraphQuery}` : `${e} ${t}`;
2233
+ ${t.failedGraphQuery}` : `${e} ${r}`;
2225
2234
  }
2226
- async function Ya(e, r, t, a) {
2227
- const { graphQuery: o, explanation: n } = await de(e, r, t, a);
2235
+ async function eo(e, t, r, a) {
2236
+ const { graphQuery: o, explanation: n } = await de(e, t, r, a);
2228
2237
  return { graphQuery: o, explanation: n };
2229
2238
  }
2230
- async function de(e, r, t, a, o) {
2239
+ async function de(e, t, r, a, o) {
2231
2240
  const n = {
2232
- message: await Za(e, o),
2233
- context: new Ua(r)
2241
+ message: await Xa(e, o),
2242
+ context: new Ka(t)
2234
2243
  }, l = Y(a);
2235
- await S({ text: "Attempting to generate a cypher query from your prompt..." }, a);
2236
- const i = await he(`${t}/chat`, {
2244
+ await x({ text: "Attempting to generate a cypher query from your prompt..." }, a);
2245
+ const i = await me(`${r}/chat`, {
2237
2246
  method: "post",
2238
2247
  body: JSON.stringify(n),
2239
2248
  headers: {
@@ -2248,13 +2257,13 @@ async function de(e, r, t, a, o) {
2248
2257
  });
2249
2258
  let c = !1;
2250
2259
  const u = Date.now();
2251
- let d = i.data.sequenceNumber, p = "", h = "", f = 1;
2260
+ let d = i.data.sequenceNumber, p = "", m = "", y = 1;
2252
2261
  for (; !c; ) {
2253
- await new Promise((m) => setTimeout(m, 1e3)), await S(
2254
- { text: `Periodically requesting status of job from ArcGIS AI Services${"...".substring(0, f)}` },
2262
+ await new Promise((h) => setTimeout(h, 1e3)), await x(
2263
+ { text: `Periodically requesting status of job from ArcGIS AI Services${"...".substring(0, y)}` },
2255
2264
  a
2256
- ), f = f % 3 + 1;
2257
- const y = await he(`${t}/chat`, {
2265
+ ), y = y % 3 + 1;
2266
+ const f = await me(`${r}/chat`, {
2258
2267
  method: "post",
2259
2268
  body: JSON.stringify({
2260
2269
  conversationId: i.data.conversationId,
@@ -2267,75 +2276,75 @@ async function de(e, r, t, a, o) {
2267
2276
  },
2268
2277
  signal: l
2269
2278
  });
2270
- if (y.httpStatus !== 200)
2271
- throw new Error(`Graph query service polling returned an error: ${y.httpStatus}`, {
2272
- cause: y.data
2279
+ if (f.httpStatus !== 200)
2280
+ throw new Error(`Graph query service polling returned an error: ${f.httpStatus}`, {
2281
+ cause: f.data
2273
2282
  });
2274
- if (y.data.context?.kind) {
2275
- if (y.data.context.kind !== "GraphQueryGenerationResponse")
2276
- throw new Error(`Unexpected response from graph query service polling. Message: ${y.data.message}`, {
2277
- cause: y.data
2283
+ if (f.data.context?.kind) {
2284
+ if (f.data.context.kind !== "GraphQueryGenerationResponse")
2285
+ throw new Error(`Unexpected response from graph query service polling. Message: ${f.data.message}`, {
2286
+ cause: f.data
2278
2287
  });
2279
- p = y.data.context.graphQuery, h = y.data.message || "", c = !0;
2280
- } else if (!y.data.hasMore)
2288
+ p = f.data.context.graphQuery, m = f.data.message || "", c = !0;
2289
+ } else if (!f.data.hasMore)
2281
2290
  c = !0;
2282
2291
  else if (Date.now() - u > 6e4)
2283
2292
  throw new Error("Graph query service polling timed out after 1 minute.");
2284
- d = y.data.sequenceNumber;
2293
+ d = f.data.sequenceNumber;
2285
2294
  }
2286
- return { graphQuery: p, explanation: h };
2295
+ return { graphQuery: p, explanation: m };
2287
2296
  }
2288
- function Xa(e, r) {
2289
- z(e, (t) => {
2290
- r.set(`${t.typeName}__${t.id}`, {
2291
- id: t.id,
2292
- typeName: t.typeName
2297
+ function to(e, t) {
2298
+ z(e, (r) => {
2299
+ t.set(`${r.typeName}__${r.id}`, {
2300
+ id: r.id,
2301
+ typeName: r.typeName
2293
2302
  });
2294
2303
  });
2295
2304
  }
2296
- function z(e, r) {
2305
+ function z(e, t) {
2297
2306
  if (!(!e || typeof e != "object")) {
2298
- if (to(e))
2299
- for (const t of e.path)
2300
- z(t, r);
2301
- else if (eo(e))
2302
- r(e);
2303
- else if (Array.isArray(e))
2304
- for (const t of e)
2305
- z(t, r);
2307
+ if (ao(e))
2308
+ for (const r of e.path)
2309
+ z(r, t);
2306
2310
  else if (ro(e))
2307
- for (const t of Object.values(e.properties ?? {}))
2308
- z(t, r);
2311
+ t(e);
2312
+ else if (Array.isArray(e))
2313
+ for (const r of e)
2314
+ z(r, t);
2315
+ else if (oo(e))
2316
+ for (const r of Object.values(e.properties ?? {}))
2317
+ z(r, t);
2309
2318
  }
2310
2319
  }
2311
- function eo(e) {
2320
+ function ro(e) {
2312
2321
  return !e || typeof e != "object" || Array.isArray(e) ? !1 : "id" in e && "typeName" in e;
2313
2322
  }
2314
- function to(e) {
2323
+ function ao(e) {
2315
2324
  return !e || typeof e != "object" || Array.isArray(e) ? !1 : e && "path" in e && Array.isArray(e.path);
2316
2325
  }
2317
- function ro(e) {
2326
+ function oo(e) {
2318
2327
  return !e || typeof e != "object" || Array.isArray(e) || "id" in e ? !1 : "properties" in e && typeof e.properties == "object";
2319
2328
  }
2320
- function ao(e, r) {
2321
- const t = [], a = [], o = [
2322
- [r.dataModel.entityTypes, t],
2323
- [r.dataModel.relationshipTypes, a]
2329
+ function no(e, t) {
2330
+ const r = [], a = [], o = [
2331
+ [t.dataModel.entityTypes, r],
2332
+ [t.dataModel.relationshipTypes, a]
2324
2333
  ];
2325
2334
  for (const [n, l] of o)
2326
2335
  for (const i of n) {
2327
2336
  const c = e.getMemberIdsByType(i.name);
2328
2337
  l.push(...c);
2329
2338
  }
2330
- return { entityIds: t, relationshipIds: a };
2339
+ return { entityIds: r, relationshipIds: a };
2331
2340
  }
2332
- function oo(e, r) {
2333
- const t = { entityIds: new Array(), relationshipIds: new Array() }, a = [], n = e?.allLayers.find((c) => c.type === "knowledge-graph")?.inclusionModeDefinition;
2341
+ function io(e, t) {
2342
+ const r = { entityIds: new Array(), relationshipIds: new Array() }, a = [], n = e?.allLayers.find((c) => c.type === "knowledge-graph")?.inclusionModeDefinition;
2334
2343
  if (!n)
2335
- return { allNamedTypesFullyDynamic: !0, bindParameters: t, nonDynamicTypes: a };
2344
+ return { allNamedTypesFullyDynamic: !0, bindParameters: r, nonDynamicTypes: a };
2336
2345
  const l = [
2337
- [r.dataModel.entityTypes, t.entityIds],
2338
- [r.dataModel.relationshipTypes, t.relationshipIds]
2346
+ [t.dataModel.entityTypes, r.entityIds],
2347
+ [t.dataModel.relationshipTypes, r.relationshipIds]
2339
2348
  ];
2340
2349
  let i = !0;
2341
2350
  for (const [c, u] of l)
@@ -2347,58 +2356,58 @@ function oo(e, r) {
2347
2356
  }
2348
2357
  if (!p.useAllData) {
2349
2358
  i = !1, a.push(d.name);
2350
- for (const [h] of p.members || [])
2351
- u.push(h);
2359
+ for (const [m] of p.members || [])
2360
+ u.push(m);
2352
2361
  }
2353
2362
  }
2354
- return { allNamedTypesFullyDynamic: i, bindParameters: t, nonDynamicTypes: a };
2363
+ return { allNamedTypesFullyDynamic: i, bindParameters: r, nonDynamicTypes: a };
2355
2364
  }
2356
2365
  const D = 3;
2357
- function ke(e, r = 100) {
2358
- const t = {};
2366
+ function ke(e, t = 100) {
2367
+ const r = {};
2359
2368
  for (const a of Object.entries(e.properties ?? {})) {
2360
2369
  const [o, n] = a;
2361
- typeof n == "string" && n.length > r ? t[o] = `${n.slice(0, r)}... (truncated, original length: ${n.length})` : t[o] = n;
2370
+ typeof n == "string" && n.length > t ? r[o] = `${n.slice(0, t)}... (truncated, original length: ${n.length})` : r[o] = n;
2362
2371
  }
2363
- return e.properties = t, e;
2372
+ return e.properties = r, e;
2364
2373
  }
2365
2374
  function P(e) {
2366
2375
  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);
2367
2376
  }
2368
- const no = async ({
2377
+ const so = async ({
2369
2378
  kg: e,
2370
- queryParams: r,
2371
- targetStructure: t,
2379
+ queryParams: t,
2380
+ targetStructure: r,
2372
2381
  targetStructureReducer: a,
2373
2382
  requestOptions: o,
2374
2383
  queryRowLimit: n,
2375
2384
  queryTimeoutMs: l
2376
2385
  }) => {
2377
- let i = null, c = t;
2386
+ let i = null, c = r;
2378
2387
  const u = new AbortController(), d = o?.signal, p = () => {
2379
2388
  u.abort(d?.reason);
2380
2389
  };
2381
2390
  d && (d.aborted ? u.abort(d.reason) : d.addEventListener("abort", p, { once: !0 }));
2382
2391
  try {
2383
- const h = await yt(e, r, o);
2384
- i = h.resultHeader;
2385
- const f = h.resultRowsStream.getReader();
2386
- let y = 0;
2387
- const m = Date.now(), g = !1;
2392
+ const m = await yt(e, t, o);
2393
+ i = m.resultHeader;
2394
+ const y = m.resultRowsStream.getReader();
2395
+ let f = 0;
2396
+ const h = Date.now(), w = !1;
2388
2397
  for (; ; ) {
2389
- const { done: T, value: $ } = await f.read();
2390
- if (T)
2398
+ const { done: b, value: S } = await y.read();
2399
+ if (b)
2391
2400
  break;
2392
- if (!g && l && Date.now() - m > l)
2401
+ if (!w && l && Date.now() - h > l)
2393
2402
  return u.abort(), { type: "timeout" };
2394
- for (const v of $) {
2395
- if (y++, n && y > n)
2403
+ for (const v of S) {
2404
+ if (f++, n && f > n)
2396
2405
  return u.abort(), { type: "success", rowLimitReached: !0, resultHeader: i, processedResult: c };
2397
2406
  c = a(c, v);
2398
2407
  }
2399
2408
  }
2400
- } catch (h) {
2401
- return u.signal.aborted ? { type: "aborted" } : { type: "error", errorMessage: P(h), error: h };
2409
+ } catch (m) {
2410
+ return u.signal.aborted ? { type: "aborted" } : { type: "error", errorMessage: P(m), error: m };
2402
2411
  } finally {
2403
2412
  d?.removeEventListener("abort", p);
2404
2413
  }
@@ -2406,8 +2415,8 @@ const no = async ({
2406
2415
  };
2407
2416
  async function Ne({
2408
2417
  prompt: e,
2409
- bindParameters: r,
2410
- kg: t,
2418
+ bindParameters: t,
2419
+ kg: r,
2411
2420
  graphQueryServiceUrl: a,
2412
2421
  targetStructure: o,
2413
2422
  targetStructureReducer: n,
@@ -2418,69 +2427,69 @@ async function Ne({
2418
2427
  }) {
2419
2428
  let d;
2420
2429
  for (let p = 1; p <= D; p++) {
2421
- let h;
2430
+ let m;
2422
2431
  try {
2423
- h = await de(e, t.dataModel, a, u, d);
2424
- } catch (m) {
2432
+ m = await de(e, r.dataModel, a, u, d);
2433
+ } catch (h) {
2425
2434
  return {
2426
2435
  type: "generation-error",
2427
- errorMessage: P(m),
2428
- error: m
2436
+ errorMessage: P(h),
2437
+ error: h
2429
2438
  };
2430
2439
  }
2431
- await S(
2440
+ await x(
2432
2441
  {
2433
- text: `Attempting to execute query: ${h.graphQuery.substring(0, 500)}${h.graphQuery.length > 500 ? "..." : ""}`
2442
+ text: `Attempting to execute query: ${m.graphQuery.substring(0, 500)}${m.graphQuery.length > 500 ? "..." : ""}`
2434
2443
  },
2435
2444
  u
2436
2445
  );
2437
- const f = await no({
2438
- kg: t,
2446
+ const y = await so({
2447
+ kg: r,
2439
2448
  queryParams: new Se({
2440
- openCypherQuery: h.graphQuery,
2441
- bindParameters: r
2449
+ openCypherQuery: m.graphQuery,
2450
+ bindParameters: t
2442
2451
  }),
2443
2452
  targetStructure: o,
2444
2453
  targetStructureReducer: n,
2445
2454
  requestOptions: l,
2446
2455
  queryRowLimit: i,
2447
2456
  queryTimeoutMs: c
2448
- }), y = f.type === "aborted" ? "Query execution was aborted." : f.type === "timeout" ? "Query execution timed out." : f.type === "error" ? `Query failed with error: ${f.errorMessage}` : "";
2449
- if (f.type === "success")
2457
+ }), f = y.type === "aborted" ? "Query execution was aborted." : y.type === "timeout" ? "Query execution timed out." : y.type === "error" ? `Query failed with error: ${y.errorMessage}` : "";
2458
+ if (y.type === "success")
2450
2459
  return {
2451
2460
  type: "success",
2452
- graphQuery: h.graphQuery,
2453
- explanation: h.explanation,
2454
- rowLimitReached: f.rowLimitReached,
2455
- resultHeader: f.resultHeader,
2456
- processedResult: f.processedResult
2461
+ graphQuery: m.graphQuery,
2462
+ explanation: m.explanation,
2463
+ rowLimitReached: y.rowLimitReached,
2464
+ resultHeader: y.resultHeader,
2465
+ processedResult: y.processedResult
2457
2466
  };
2458
- if (f.type === "aborted")
2467
+ if (y.type === "aborted")
2459
2468
  return {
2460
2469
  type: "aborted",
2461
- errorMessage: y,
2462
- graphQuery: h.graphQuery,
2463
- explanation: h.explanation
2470
+ errorMessage: f,
2471
+ graphQuery: m.graphQuery,
2472
+ explanation: m.explanation
2464
2473
  };
2465
2474
  if (p >= D)
2466
- return f.type === "timeout" ? {
2475
+ return y.type === "timeout" ? {
2467
2476
  type: "timeout",
2468
- errorMessage: y,
2469
- graphQuery: h.graphQuery,
2470
- explanation: h.explanation
2477
+ errorMessage: f,
2478
+ graphQuery: m.graphQuery,
2479
+ explanation: m.explanation
2471
2480
  } : {
2472
2481
  type: "execution-error",
2473
- errorMessage: y,
2474
- error: f.error,
2475
- graphQuery: h.graphQuery,
2476
- explanation: h.explanation
2482
+ errorMessage: f,
2483
+ error: y.error,
2484
+ graphQuery: m.graphQuery,
2485
+ explanation: m.explanation
2477
2486
  };
2478
2487
  d = {
2479
- failedGraphQuery: h.graphQuery,
2480
- executionError: y,
2488
+ failedGraphQuery: m.graphQuery,
2489
+ executionError: f,
2481
2490
  attemptCount: p
2482
- }, await S(
2483
- { text: `Attempt ${p} failed with error: ${y}. Retrying...` },
2491
+ }, await x(
2492
+ { text: `Attempt ${p} failed with error: ${f}. Retrying...` },
2484
2493
  u
2485
2494
  );
2486
2495
  }
@@ -2488,43 +2497,43 @@ async function Ne({
2488
2497
  `Failed to execute generated cypher due to an unexpected error after ${D} attempts.`
2489
2498
  );
2490
2499
  }
2491
- const io = async ({
2500
+ const lo = async ({
2492
2501
  kg: e,
2493
- searchQuery: r,
2494
- typeCategoryFilter: t,
2502
+ searchQuery: t,
2503
+ typeCategoryFilter: r,
2495
2504
  namedTypesFilter: a,
2496
2505
  searchResultLimit: o,
2497
2506
  requestOptions: n
2498
2507
  }) => {
2499
2508
  const l = [];
2500
- let i = [t];
2501
- t === "both" && !e.serviceDefinition.serviceCapabilities.searchCapabilities.searchTypeFilterCapabilities.includes("esriTypeBoth") && (i = ["entity", "relationship"]);
2509
+ let i = [r];
2510
+ r === "both" && !e.serviceDefinition.serviceCapabilities.searchCapabilities.searchTypeFilterCapabilities.includes("esriTypeBoth") && (i = ["entity", "relationship"]);
2502
2511
  const c = o ?? 1 / 0;
2503
2512
  try {
2504
2513
  for (const u of i) {
2505
2514
  const d = c - l.length;
2506
2515
  if (d <= 0)
2507
2516
  break;
2508
- const f = (await ft(
2517
+ const y = (await ft(
2509
2518
  e,
2510
2519
  new gt({
2511
- searchQuery: r,
2520
+ searchQuery: t,
2512
2521
  typeCategoryFilter: u,
2513
2522
  namedTypesFilter: a ?? void 0,
2514
2523
  num: d
2515
2524
  }),
2516
2525
  n
2517
2526
  )).resultRowsStream.getReader();
2518
- let y = !1;
2519
- for (; !y; ) {
2520
- const { done: m, value: g } = await f.read();
2521
- if (m) {
2522
- y = !0;
2527
+ let f = !1;
2528
+ for (; !f; ) {
2529
+ const { done: h, value: w } = await y.read();
2530
+ if (h) {
2531
+ f = !0;
2523
2532
  break;
2524
2533
  }
2525
- for (const T of g)
2526
- for (const $ of T)
2527
- l.push($);
2534
+ for (const b of w)
2535
+ for (const S of b)
2536
+ l.push(S);
2528
2537
  }
2529
2538
  }
2530
2539
  } catch (u) {
@@ -2542,13 +2551,13 @@ const io = async ({
2542
2551
  }, qe = "IMPORTANT: The generated cypher query must return entire entities and relationships ONLY.";
2543
2552
  async function Ie({
2544
2553
  prompt: e,
2545
- view: r,
2546
- knowledgeGraph: t,
2554
+ view: t,
2555
+ knowledgeGraph: r,
2547
2556
  includeReturnEntityAndRelationshipContext: a = !1
2548
2557
  }) {
2549
2558
  const o = [e];
2550
- if (a && o.push(qe), !q(r)) {
2551
- const d = await U("arcgis_knowledge_current_lc_context"), p = ao(r.map, t);
2559
+ if (a && o.push(qe), !q(t)) {
2560
+ const d = await B("arcgis_knowledge_current_lc_context"), p = no(t.map, r);
2552
2561
  return o.push(d), {
2553
2562
  enhancedPrompt: o.join(`
2554
2563
 
@@ -2557,9 +2566,9 @@ async function Ie({
2557
2566
  allNamedTypesFullyDynamic: !1
2558
2567
  };
2559
2568
  }
2560
- const n = r.map, { allNamedTypesFullyDynamic: l, bindParameters: i, nonDynamicTypes: c } = oo(
2569
+ const n = t.map, { allNamedTypesFullyDynamic: l, bindParameters: i, nonDynamicTypes: c } = io(
2561
2570
  n,
2562
- t
2571
+ r
2563
2572
  );
2564
2573
  if (l)
2565
2574
  return {
@@ -2569,7 +2578,7 @@ async function Ie({
2569
2578
  bindParameters: i,
2570
2579
  allNamedTypesFullyDynamic: !0
2571
2580
  };
2572
- const u = (await U("arcgis_knowledge_current_map_context")).replaceAll(
2581
+ const u = (await B("arcgis_knowledge_current_map_context")).replaceAll(
2573
2582
  "{nonDynamicTypes}",
2574
2583
  JSON.stringify(c)
2575
2584
  );
@@ -2581,17 +2590,17 @@ async function Ie({
2581
2590
  allNamedTypesFullyDynamic: l
2582
2591
  };
2583
2592
  }
2584
- async function so(e, r, t, a, o, n) {
2593
+ async function co(e, t, r, a, o, n) {
2585
2594
  const { view: l } = o, i = await Ne({
2586
2595
  prompt: e,
2587
- bindParameters: r,
2588
- kg: t,
2596
+ bindParameters: t,
2597
+ kg: r,
2589
2598
  graphQueryServiceUrl: a,
2590
2599
  targetStructure: /* @__PURE__ */ new Map(),
2591
- targetStructureReducer: (h, f) => {
2592
- for (const y of f)
2593
- Xa(y, h);
2594
- return h;
2600
+ targetStructureReducer: (m, y) => {
2601
+ for (const f of y)
2602
+ to(f, m);
2603
+ return m;
2595
2604
  },
2596
2605
  requestOptions: {
2597
2606
  signal: Y(n),
@@ -2600,32 +2609,32 @@ async function so(e, r, t, a, o, n) {
2600
2609
  config: n
2601
2610
  });
2602
2611
  if (i.type !== "success") {
2603
- const h = i.type === "generation-error" ? i.errorMessage : `${i.errorMessage} Cypher query: ${i.graphQuery}`;
2604
- throw new Error(`Failed to add records to the link chart. ${h}`);
2612
+ const m = i.type === "generation-error" ? i.errorMessage : `${i.errorMessage} Cypher query: ${i.graphQuery}`;
2613
+ throw new Error(`Failed to add records to the link chart. ${m}`);
2605
2614
  }
2606
2615
  const { graphQuery: c, explanation: u, processedResult: d } = i, p = Array.from(d.values());
2607
- return await S(
2616
+ return await x(
2608
2617
  {
2609
2618
  text: `Query Results parsed into ${p.length} unique relationships and entities. Atempting to add to link chart...`
2610
2619
  },
2611
2620
  n
2612
2621
  ), !q(l) && l?.map ? (await l.map.addRecords(p), await Z(l), { generatedQuery: c, explanation: u, addedIdTypePairs: p }) : (await l?.map?.allLayers.find(
2613
- (f) => f.type === "knowledge-graph"
2622
+ (y) => y.type === "knowledge-graph"
2614
2623
  )?.addRecords(p), { generatedQuery: c, explanation: u, addedIdTypePairs: p });
2615
2624
  }
2616
- const W = "addRecords", lo = s.object({
2625
+ const W = "addRecords", uo = s.object({
2617
2626
  prompt: s.string().describe(
2618
2627
  "The user's inquiry and context required in order to generate a cypher query that will be used to add records to the link chart."
2619
2628
  )
2620
- }), co = async ({ prompt: e }, r) => {
2621
- const { knowledgeGraph: t } = await M(r), a = O(r), { view: o } = a, l = k.getDefault().helperServices, {
2629
+ }), po = async ({ prompt: e }, t) => {
2630
+ const { knowledgeGraph: r } = await M(t), a = O(t), { view: o } = a, l = k.getDefault().helperServices, {
2622
2631
  enhancedPrompt: i,
2623
2632
  bindParameters: c,
2624
2633
  allNamedTypesFullyDynamic: u
2625
2634
  } = await Ie({
2626
2635
  prompt: e,
2627
2636
  view: o,
2628
- knowledgeGraph: t,
2637
+ knowledgeGraph: r,
2629
2638
  includeReturnEntityAndRelationshipContext: !0
2630
2639
  });
2631
2640
  if (u)
@@ -2640,24 +2649,24 @@ const W = "addRecords", lo = s.object({
2640
2649
  }
2641
2650
  };
2642
2651
  try {
2643
- const { generatedQuery: d, explanation: p, addedIdTypePairs: h } = await so(
2652
+ const { generatedQuery: d, explanation: p, addedIdTypePairs: m } = await co(
2644
2653
  i,
2645
2654
  c,
2646
- t,
2655
+ r,
2647
2656
  `${l.aiAssistantServices.url}${l.aiAssistantServices.graphQueryAssistant}`,
2648
2657
  a,
2649
- r
2658
+ t
2650
2659
  );
2651
2660
  return {
2652
2661
  toolName: W,
2653
2662
  status: "success",
2654
2663
  summary: `Records added successfully. Cypher Query used: ${d}
2655
2664
 
2656
- Number of records added: ${h.length}`,
2665
+ Number of records added: ${m.length}`,
2657
2666
  details: {
2658
2667
  generatedQuery: d,
2659
2668
  explanation: p,
2660
- addedIdTypePairs: h
2669
+ addedIdTypePairs: m
2661
2670
  }
2662
2671
  };
2663
2672
  } catch (d) {
@@ -2669,7 +2678,7 @@ Number of records added: ${h.length}`,
2669
2678
  error: d
2670
2679
  };
2671
2680
  }
2672
- }, ri = w(co, {
2681
+ }, oi = g(po, {
2673
2682
  name: W,
2674
2683
  description: `Adds records (entities or relationships) to the current link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the records to be added to the link chart. The user should have explicitly requested to add records to the current link chart from their prompt. "add to new link chart" is not a valid prompt for this tool.
2675
2684
 
@@ -2682,12 +2691,12 @@ Number of records added: ${h.length}`,
2682
2691
  - "connect company x and company y"
2683
2692
  - "connect all buildings on the link chart"
2684
2693
  `,
2685
- schema: lo
2694
+ schema: uo
2686
2695
  });
2687
- async function uo(e, r) {
2688
- return await r.map?.applyLayout(e), await Z(r), { appliedLayout: e };
2696
+ async function mo(e, t) {
2697
+ return await t.map?.applyLayout(e), await Z(t), { appliedLayout: e };
2689
2698
  }
2690
- const re = "applyLayout", po = s.object({
2699
+ const re = "applyLayout", ho = s.object({
2691
2700
  layout: s.enum([
2692
2701
  "organic-standard",
2693
2702
  "organic-community",
@@ -2701,9 +2710,9 @@ const re = "applyLayout", po = s.object({
2701
2710
  ]).describe(
2702
2711
  "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"
2703
2712
  )
2704
- }), ho = async ({ layout: e }, r) => {
2705
- const { view: t } = O(r);
2706
- if (q(t))
2713
+ }), yo = async ({ layout: e }, t) => {
2714
+ const { view: r } = O(t);
2715
+ if (q(r))
2707
2716
  return {
2708
2717
  toolName: re,
2709
2718
  status: "error",
@@ -2711,7 +2720,7 @@ const re = "applyLayout", po = s.object({
2711
2720
  error: new Error()
2712
2721
  };
2713
2722
  {
2714
- const { appliedLayout: a } = await uo(e, t);
2723
+ const { appliedLayout: a } = await mo(e, r);
2715
2724
  return {
2716
2725
  toolName: re,
2717
2726
  status: "success",
@@ -2721,19 +2730,19 @@ const re = "applyLayout", po = s.object({
2721
2730
  }
2722
2731
  };
2723
2732
  }
2724
- }, ai = w(ho, {
2733
+ }, ni = g(yo, {
2725
2734
  name: re,
2726
2735
  description: "Apply a diagram layout to the link chart",
2727
- schema: po
2736
+ schema: ho
2728
2737
  });
2729
- async function mo(e, r) {
2730
- return r.map?.changeNonspatialDataDisplay(e), await Z(r), { appliedNonspatialDataDisplayMode: e };
2738
+ async function fo(e, t) {
2739
+ return t.map?.changeNonspatialDataDisplay(e), await Z(t), { appliedNonspatialDataDisplayMode: e };
2731
2740
  }
2732
- const ae = "changeNonspatialVisibility", yo = s.object({
2741
+ const ae = "changeNonspatialVisibility", go = s.object({
2733
2742
  setting: s.enum(["hidden", "visible"]).describe("The setting of nonspatial visibility")
2734
- }), fo = async ({ setting: e }, r) => {
2735
- const { view: t } = O(r);
2736
- if (q(t))
2743
+ }), wo = async ({ setting: e }, t) => {
2744
+ const { view: r } = O(t);
2745
+ if (q(r))
2737
2746
  return {
2738
2747
  toolName: ae,
2739
2748
  status: "error",
@@ -2741,7 +2750,7 @@ const ae = "changeNonspatialVisibility", yo = s.object({
2741
2750
  error: new Error()
2742
2751
  };
2743
2752
  {
2744
- const { appliedNonspatialDataDisplayMode: a } = await mo(e, t);
2753
+ const { appliedNonspatialDataDisplayMode: a } = await fo(e, r);
2745
2754
  return {
2746
2755
  toolName: ae,
2747
2756
  status: "success",
@@ -2751,30 +2760,30 @@ const ae = "changeNonspatialVisibility", yo = s.object({
2751
2760
  }
2752
2761
  };
2753
2762
  }
2754
- }, oi = w(fo, {
2763
+ }, ii = g(wo, {
2755
2764
  name: ae,
2756
2765
  description: "Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",
2757
- schema: yo
2766
+ schema: go
2758
2767
  });
2759
- async function go(e, r, t, a, o) {
2768
+ async function bo(e, t, r, a, o) {
2760
2769
  let n, l = "";
2761
2770
  for (let i = 1; i <= D; i++) {
2762
2771
  const { graphQuery: c, explanation: u } = await de(
2763
2772
  e,
2764
- r.dataModel,
2765
- t,
2773
+ t.dataModel,
2774
+ r,
2766
2775
  o,
2767
2776
  n
2768
2777
  );
2769
2778
  try {
2770
- await S({ text: `Attempting to create link chart from derived query: ${c}` }, o);
2771
- const d = await mt.fromCypherQuery(
2772
- r,
2779
+ await x({ text: `Attempting to create link chart from derived query: ${c}` }, o);
2780
+ const d = await ht.fromCypherQuery(
2781
+ t,
2773
2782
  new Se({
2774
2783
  openCypherQuery: c
2775
2784
  })
2776
2785
  );
2777
- await S({ text: "Link chart created successfully, loading..." }, o), await d.load();
2786
+ await x({ text: "Link chart created successfully, loading..." }, o), await d.load();
2778
2787
  const p = a.map;
2779
2788
  return a.map = d, await a.when(), await Ae.whenOnce(() => !a.updating), d.entityCount === 0 && d.relationshipCount === 0 ? (a.map === d && (a.map = p), d.destroy(), {
2780
2789
  type: "error",
@@ -2797,7 +2806,7 @@ Explanation: ${u}`
2797
2806
  failedGraphQuery: c,
2798
2807
  executionError: p,
2799
2808
  attemptCount: i
2800
- }, await S(
2809
+ }, await x(
2801
2810
  { text: `Attempt ${i} to create link chart failed with error: ${p}. Retrying ...` },
2802
2811
  o
2803
2812
  );
@@ -2808,12 +2817,12 @@ Explanation: ${u}`
2808
2817
  errorMessage: `Failed to create link chart after ${D} attempts. Last error: ${l}`
2809
2818
  };
2810
2819
  }
2811
- const V = "createLinkChart", wo = s.object({
2820
+ const V = "createLinkChart", To = s.object({
2812
2821
  prompt: s.string().describe(
2813
2822
  "The user's inquiry and context required in order to generate a cypher query that will be used to create a link chart visualization. Only include information relevant to generating a cypher query. Do not suggest entity types, relationship types or properties. Do not include limits or formatting instructions for the query results unless specifically requested by the user. The prompt should be focused on the data the user wants to see in the link chart, not how to generate it."
2814
2823
  )
2815
- }), bo = async ({ prompt: e }, r) => {
2816
- const { knowledgeGraph: t } = await M(r), { view: a } = O(r);
2824
+ }), vo = async ({ prompt: e }, t) => {
2825
+ const { knowledgeGraph: r } = await M(t), { view: a } = O(t);
2817
2826
  if (q(a))
2818
2827
  return {
2819
2828
  toolName: V,
@@ -2822,14 +2831,14 @@ const V = "createLinkChart", wo = s.object({
2822
2831
  error: new Error()
2823
2832
  };
2824
2833
  {
2825
- const n = k.getDefault().helperServices, l = await go(
2834
+ const n = k.getDefault().helperServices, l = await bo(
2826
2835
  `${e}
2827
2836
 
2828
2837
  ${qe}`,
2829
- t,
2838
+ r,
2830
2839
  `${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,
2831
2840
  a,
2832
- r
2841
+ t
2833
2842
  );
2834
2843
  if (l.type === "error")
2835
2844
  return {
@@ -2852,57 +2861,57 @@ Explanation: ${c}`,
2852
2861
  }
2853
2862
  };
2854
2863
  }
2855
- }, ni = w(bo, {
2864
+ }, si = g(vo, {
2856
2865
  name: V,
2857
2866
  description: "Creates a new link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the new link chart. The user should have explicitly requested the creation of a new link chart from their prompt using language like 'create new link chart' or 'add to new link chart'.",
2858
- schema: wo
2859
- }), oe = "queryGraphData", To = s.object({
2867
+ schema: To
2868
+ }), oe = "queryGraphData", So = s.object({
2860
2869
  prompt: s.string().describe(
2861
2870
  "The user's inquiry into the knowledge graph, from which a cypher query will be generated and executed to answer the inquiry. Only include entity types, relationship types or properties if they are provided in the user prompt or prior steps. Do not suggest entity types, relationship types or properties. Do not include limits, information on what to return, instructions on how to write the query, or formatting instructions for the query results unless specifically requested by the user."
2862
2871
  )
2863
- }), vo = async ({ prompt: e }, r) => {
2864
- const { knowledgeGraph: t } = await M(r), o = k.getDefault().helperServices;
2872
+ }), xo = async ({ prompt: e }, t) => {
2873
+ const { knowledgeGraph: r } = await M(t), o = k.getDefault().helperServices;
2865
2874
  let n = e, l = null, i = null;
2866
2875
  try {
2867
- ({ view: i } = O(r));
2876
+ ({ view: i } = O(t));
2868
2877
  } catch {
2869
2878
  }
2870
2879
  i && ({ enhancedPrompt: n, bindParameters: l } = await Ie({
2871
2880
  prompt: e,
2872
2881
  view: i,
2873
- knowledgeGraph: t,
2882
+ knowledgeGraph: r,
2874
2883
  includeReturnEntityAndRelationshipContext: !1
2875
2884
  }));
2876
2885
  const c = await Ne({
2877
2886
  prompt: n,
2878
2887
  bindParameters: l,
2879
- kg: t,
2888
+ kg: r,
2880
2889
  graphQueryServiceUrl: `${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,
2881
2890
  targetStructure: new Array(),
2882
- targetStructureReducer: (g, T) => (g.push(T), g),
2891
+ targetStructureReducer: (w, b) => (w.push(b), w),
2883
2892
  requestOptions: {
2884
- signal: Y(r),
2885
- timeout: r?.timeout
2893
+ signal: Y(t),
2894
+ timeout: t?.timeout
2886
2895
  },
2887
- config: r
2896
+ config: t
2888
2897
  });
2889
2898
  if (c.type !== "success") {
2890
- const g = c.type === "generation-error" ? c.errorMessage : `${c.errorMessage} Cypher query: ${c.graphQuery}`;
2899
+ const w = c.type === "generation-error" ? c.errorMessage : `${c.errorMessage} Cypher query: ${c.graphQuery}`;
2891
2900
  return {
2892
2901
  toolName: oe,
2893
2902
  status: "error",
2894
- errorMessage: `Failed to query the knowledge graph. ${g}`,
2903
+ errorMessage: `Failed to query the knowledge graph. ${w}`,
2895
2904
  error: "error" in c ? c.error : null
2896
2905
  };
2897
2906
  }
2898
- const { graphQuery: u, explanation: d, processedResult: p, resultHeader: h } = c, f = h.headerKeys;
2899
- for (const g of p)
2900
- for (const T of g)
2907
+ const { graphQuery: u, explanation: d, processedResult: p, resultHeader: m } = c, y = m.headerKeys;
2908
+ for (const w of p)
2909
+ for (const b of w)
2901
2910
  z(
2902
- T,
2903
- ($) => ke($)
2911
+ b,
2912
+ (S) => ke(S)
2904
2913
  );
2905
- const y = 50, m = p.slice(0, y).map((g) => JSON.stringify(g));
2914
+ const f = 50, h = p.slice(0, f).map((w) => JSON.stringify(w));
2906
2915
  return {
2907
2916
  toolName: oe,
2908
2917
  status: "success",
@@ -2913,38 +2922,38 @@ ${u}
2913
2922
  \`\`\`
2914
2923
 
2915
2924
  Query Results:
2916
- ${m.length} result(s) found.
2925
+ ${h.length} result(s) found.
2917
2926
 
2918
- Column Headers: ${f.join(", ")}
2927
+ Column Headers: ${y.join(", ")}
2919
2928
 
2920
- ${m.length > y ? `Showing top ${y} results:
2929
+ ${h.length > f ? `Showing top ${f} results:
2921
2930
 
2922
2931
  ` : `Results:
2923
2932
 
2924
- `}${m.join(`
2933
+ `}${h.join(`
2925
2934
  `)}
2926
2935
  `,
2927
2936
  details: {
2928
2937
  generatedQuery: u,
2929
2938
  explanation: d,
2930
- resultHeader: h,
2939
+ resultHeader: m,
2931
2940
  queryResults: p
2932
2941
  }
2933
2942
  };
2934
- }, ii = w(vo, {
2943
+ }, li = g(xo, {
2935
2944
  name: oe,
2936
2945
  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?'.",
2937
- schema: To
2938
- }), ne = "generateCypher", So = s.object({
2946
+ schema: So
2947
+ }), ne = "generateCypher", Ro = s.object({
2939
2948
  prompt: s.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")
2940
- }), xo = async ({ prompt: e }, r) => {
2941
- const { knowledgeGraph: t } = await M(r), o = k.getDefault().helperServices;
2949
+ }), $o = async ({ prompt: e }, t) => {
2950
+ const { knowledgeGraph: r } = await M(t), o = k.getDefault().helperServices;
2942
2951
  try {
2943
- const { graphQuery: n, explanation: l } = await Ya(
2952
+ const { graphQuery: n, explanation: l } = await eo(
2944
2953
  e,
2945
- t.dataModel,
2954
+ r.dataModel,
2946
2955
  `${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,
2947
- r
2956
+ t
2948
2957
  );
2949
2958
  return {
2950
2959
  toolName: ne,
@@ -2967,36 +2976,36 @@ Explanation: ${l}`,
2967
2976
  error: n
2968
2977
  };
2969
2978
  }
2970
- }, si = w(xo, {
2979
+ }, ci = g($o, {
2971
2980
  name: ne,
2972
2981
  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.",
2973
- schema: So
2974
- }), Ro = (e) => {
2975
- const r = e.dataModel, t = /* @__PURE__ */ new Map();
2976
- for (const i of r.searchIndexes)
2982
+ schema: Ro
2983
+ }), Co = (e) => {
2984
+ const t = e.dataModel, r = /* @__PURE__ */ new Map();
2985
+ for (const i of t.searchIndexes)
2977
2986
  if (i.supportedCategory !== "esriTypeMetaEntityProvenance")
2978
2987
  for (const [c, u] of i.searchProperties.entries()) {
2979
- const d = t.get(c) ?? /* @__PURE__ */ new Set();
2980
- u.propertyNames.forEach((p) => d.add(p)), t.set(c, d);
2988
+ const d = r.get(c) ?? /* @__PURE__ */ new Set();
2989
+ u.propertyNames.forEach((p) => d.add(p)), r.set(c, d);
2981
2990
  }
2982
- const a = r.entityTypes.filter((i) => t.has(i.name)), o = r.relationshipTypes.filter((i) => t.has(i.name)), n = `Entity Types:
2983
- ${a.map(({ name: i }) => `${i}: [${Array.from(t.get(i) ?? []).join(", ")}]`).join(`
2991
+ const a = t.entityTypes.filter((i) => r.has(i.name)), o = t.relationshipTypes.filter((i) => r.has(i.name)), n = `Entity Types:
2992
+ ${a.map(({ name: i }) => `${i}: [${Array.from(r.get(i) ?? []).join(", ")}]`).join(`
2984
2993
  `)}`, l = `Relationship Types:
2985
- ${o.map(({ name: i }) => `${i}: [${Array.from(t.get(i) ?? []).join(", ")}]`).join(`
2994
+ ${o.map(({ name: i }) => `${i}: [${Array.from(r.get(i) ?? []).join(", ")}]`).join(`
2986
2995
  `)}`;
2987
2996
  return `${n}
2988
2997
 
2989
2998
  ${l}`;
2990
2999
  };
2991
- async function $o(e, r, t) {
2992
- const a = await U("arcgis_knowledge_lucene_generation_prompt"), o = {
3000
+ async function Eo(e, t, r) {
3001
+ const a = await B("arcgis_knowledge_lucene_generation_prompt"), o = {
2993
3002
  inquiry: e,
2994
- dataModelForSearch: Ro(r)
3003
+ dataModelForSearch: Co(t)
2995
3004
  }, n = s.enum(["entity", "relationship", "both"]).describe("The graph element category to search against - entity, relationship, or both"), l = s.number().int().positive().nullable().describe(
2996
3005
  "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."
2997
3006
  ), i = s.array(
2998
3007
  s.enum(
2999
- r.dataModel.entityTypes.map((d) => d.name).concat(r.dataModel.relationshipTypes.map((d) => d.name))
3008
+ t.dataModel.entityTypes.map((d) => d.name).concat(t.dataModel.relationshipTypes.map((d) => d.name))
3000
3009
  )
3001
3010
  ).min(1), c = s.object({
3002
3011
  query: s.string().describe("A lucene syntax query string to be executed against the knowledge graph search API"),
@@ -3010,27 +3019,27 @@ async function $o(e, r, t) {
3010
3019
  promptText: a,
3011
3020
  inputVariables: o,
3012
3021
  schema: c,
3013
- config: t
3022
+ config: r
3014
3023
  });
3015
3024
  }
3016
- const ie = "searchGraphData", Co = s.object({
3025
+ const ie = "searchGraphData", Fo = s.object({
3017
3026
  prompt: s.string().describe(
3018
3027
  "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."
3019
3028
  )
3020
- }), Eo = async ({ prompt: e }, r) => {
3021
- const { knowledgeGraph: t } = await M(r);
3022
- await S({ text: "Generating search query for the user inquiry" }, r);
3023
- const a = await $o(e, t, r);
3024
- await S({ text: "Executing graph search with generated search query" }, r);
3025
- const o = await io({
3026
- kg: t,
3029
+ }), ko = async ({ prompt: e }, t) => {
3030
+ const { knowledgeGraph: r } = await M(t);
3031
+ await x({ text: "Generating search query for the user inquiry" }, t);
3032
+ const a = await Eo(e, r, t);
3033
+ await x({ text: "Executing graph search with generated search query" }, t);
3034
+ const o = await lo({
3035
+ kg: r,
3027
3036
  searchQuery: a.query,
3028
3037
  typeCategoryFilter: a.typeCategoryFilter,
3029
3038
  namedTypesFilter: a.typeFilters,
3030
3039
  searchResultLimit: a.resultLimit,
3031
3040
  requestOptions: {
3032
- signal: Y(r),
3033
- timeout: r?.timeout
3041
+ signal: Y(t),
3042
+ timeout: t?.timeout
3034
3043
  }
3035
3044
  });
3036
3045
  if (o.type !== "success")
@@ -3066,7 +3075,7 @@ const ie = "searchGraphData", Co = s.object({
3066
3075
  searchResults: o.results
3067
3076
  }
3068
3077
  };
3069
- }, li = w(Eo, {
3078
+ }, ui = g(ko, {
3070
3079
  name: ie,
3071
3080
  description: `
3072
3081
  Search the knowledge graph using one or more search texts, using lucene search syntax, against indexed string properties defined on their entities and relationships. Use this tool when the user asks a question about their knowledge graph data as a whole, that could be answered via lucene text search of properties stored on graph elements, e.g requiring fuzzy matching. Otherwise if the inquiry is looking for connected records (e.g. paths), data aggregations, etc explore the data via the queryGraphData tool.
@@ -3078,53 +3087,53 @@ const ie = "searchGraphData", Co = s.object({
3078
3087
  - "Find all reports authored by someone with the title of 'Researcher'"
3079
3088
  - "Find the first 5 reports where summary mentions flood zoning near Sacramento, and the organization name is the City of Sacramento Utilities, and tags containing stormwater".
3080
3089
  - "Search for all john smiths and show their global ids`,
3081
- schema: Co
3090
+ schema: Fo
3082
3091
  });
3083
3092
  export {
3084
- jn as A,
3085
- Ln as B,
3086
- Gn as C,
3087
- On as D,
3088
- Mn as E,
3089
- Qn as F,
3093
+ Gn as A,
3094
+ On as B,
3095
+ Mn as C,
3096
+ Qn as D,
3097
+ _n as E,
3098
+ Wn as F,
3090
3099
  ue as G,
3091
- Yn as H,
3092
- _n as I,
3093
- Wn as J,
3094
- Vn as K,
3095
- Un as L,
3096
- Bn as M,
3097
- $n as N,
3098
- Hn as O,
3099
- Jn as P,
3100
- Qa as Q,
3100
+ ei as H,
3101
+ Vn as I,
3102
+ Bn as J,
3103
+ Un as K,
3104
+ Kn as L,
3105
+ Hn as M,
3106
+ En as N,
3107
+ Zn as O,
3108
+ Yn as P,
3109
+ Wa as Q,
3101
3110
  N as R,
3102
- Kn as S,
3103
- Zn as T,
3104
- ai as a,
3105
- si as b,
3106
- oi as c,
3107
- ni as d,
3108
- ri as e,
3111
+ Jn as S,
3112
+ Xn as T,
3113
+ ni as a,
3114
+ ci as b,
3115
+ ii as c,
3116
+ si as d,
3117
+ oi as e,
3109
3118
  xe as f,
3110
- U as g,
3111
- ti as h,
3119
+ B as g,
3120
+ ai as h,
3112
3121
  M as i,
3113
- ei as j,
3114
- Cn as k,
3115
- Xn as l,
3116
- En as m,
3117
- Fn as n,
3118
- kn as o,
3119
- Nn as p,
3120
- ii as q,
3121
- Pn as r,
3122
- li as s,
3123
- Ut as t,
3124
- qn as u,
3125
- In as v,
3126
- zn as w,
3127
- Dn as x,
3122
+ ri as j,
3123
+ Fn as k,
3124
+ ti as l,
3125
+ kn as m,
3126
+ Nn as n,
3127
+ qn as o,
3128
+ In as p,
3129
+ li as q,
3130
+ Ln as r,
3131
+ ui as s,
3132
+ Bt as t,
3133
+ zn as u,
3134
+ Dn as v,
3135
+ Pn as w,
3136
+ An as x,
3128
3137
  C as y,
3129
- An as z
3138
+ jn as z
3130
3139
  };