@arcgis/ai-components 5.2.0-next.26 → 5.2.0-next.28

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.
@@ -1,6 +1,6 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import pe from "@arcgis/core/identity/IdentityManager.js";
3
- import k from "@arcgis/core/portal/Portal.js";
3
+ import N from "@arcgis/core/portal/Portal.js";
4
4
  import { Annotation as T, messagesStateReducer as be } from "@langchain/langgraph/web";
5
5
  import "@arcgis/toolkit/string";
6
6
  import { k as Pe, j as H, i as Ae } from "./generateLayerDescriptions.js";
@@ -29,8 +29,8 @@ import { createContinuousRenderer as Ue } from "@arcgis/core/smartMapping/render
29
29
  import { createRenderer as Ke } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
30
30
  import { getSchemesByTag as He } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
31
31
  import { createRenderer as Je } from "@arcgis/core/smartMapping/renderers/heatmap.js";
32
- import { getSchemesByTag as Ze } from "@arcgis/core/smartMapping/symbology/heatmap.js";
33
- import { createRenderer as Ye } from "@arcgis/core/smartMapping/renderers/predominance.js";
32
+ import { getSchemesByTag as Ye } from "@arcgis/core/smartMapping/symbology/heatmap.js";
33
+ import { createRenderer as Ze } from "@arcgis/core/smartMapping/renderers/predominance.js";
34
34
  import { getSchemesByTag as Xe } from "@arcgis/core/smartMapping/symbology/predominance.js";
35
35
  import { createRenderer as et } from "@arcgis/core/smartMapping/renderers/relationship.js";
36
36
  import { getSchemesByTag as tt } from "@arcgis/core/smartMapping/symbology/relationship.js";
@@ -52,7 +52,7 @@ import "@arcgis/core/views/LinkChartView.js";
52
52
  import { fetchKnowledgeGraph as fe, executeQueryStreaming as ft, executeSearchStreaming as gt } from "@arcgis/core/rest/knowledgeGraphService.js";
53
53
  import wt from "@arcgis/core/rest/knowledgeGraph/GraphSearchStreaming.js";
54
54
  import { getBindParametersFromCypherQuery as bt } from "@arcgis/core/applications/KnowledgeStudio/generalSharedKgUtils.js";
55
- const L = (e, t) => t ?? e, zn = T.Root({
55
+ const L = (e, t) => t ?? e, In = T.Root({
56
56
  ...Pe(),
57
57
  // internal to the navigation agent
58
58
  intent: T({
@@ -73,7 +73,7 @@ const L = (e, t) => t ?? e, zn = T.Root({
73
73
  })
74
74
  });
75
75
  async function Tt(e, t) {
76
- const a = k.getDefault().helperServices, o = a.geocode.find((m) => m.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
76
+ const a = N.getDefault().helperServices, o = a.geocode.find((m) => m.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
77
77
  if (!o)
78
78
  throw new Error("No geocoding service found in helperServices.");
79
79
  const n = o.url, l = `${X.assetsPath?.endsWith("/") ? X.assetsPath : `${X.assetsPath}/`}esri/images/search/search-symbol-32.png`, c = (await Ge(n, {
@@ -117,7 +117,7 @@ async function vt({ address: e }, t) {
117
117
  }
118
118
  const xt = s.object({
119
119
  address: s.string().describe("The full address or place name to locate.")
120
- }), In = f(vt, {
120
+ }), Dn = f(vt, {
121
121
  name: "goToAddress",
122
122
  description: "Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",
123
123
  schema: xt
@@ -140,7 +140,7 @@ async function $t({ bookmarkName: e }, t) {
140
140
  }
141
141
  const Ct = E.object({
142
142
  bookmarkName: E.string().describe("The name of the bookmark to navigate to.")
143
- }), Dn = f($t, {
143
+ }), zn = f($t, {
144
144
  name: "goToBookmark",
145
145
  description: "Go to the extent of the bookmark with the given name.",
146
146
  schema: Ct
@@ -178,15 +178,17 @@ async function Ft({ layerId: e, where: t }, r) {
178
178
  const { mapView: a } = C(r);
179
179
  return await Et(e, t, a);
180
180
  }
181
- const kt = E.object({
181
+ const Nt = E.object({
182
182
  layerId: E.string().describe("The layerId of the layer to zoom to."),
183
- where: E.string().describe("The sql-92 where clause used to query features to zoom to")
183
+ where: E.string().describe(
184
+ "ArcGIS SQL-92 WHERE expression used for `query.where` on the selected layer. Use only fields from that layer and return a boolean filter expression (for example comparisons, LIKE, IN, BETWEEN, IS NULL, AND/OR/NOT). Do NOT include subqueries/nested SELECT, JOIN, GROUP BY, HAVING, ORDER BY, or semicolons."
185
+ )
184
186
  }), Pn = f(Ft, {
185
187
  name: "goToFeatures",
186
188
  description: "Go to the features that match the given filter related to the given layerId.",
187
- schema: kt
189
+ schema: Nt
188
190
  });
189
- async function Nt(e) {
191
+ async function kt(e) {
190
192
  const r = new Me({
191
193
  xmin: -180,
192
194
  ymin: -90,
@@ -198,14 +200,14 @@ async function Nt(e) {
198
200
  }
199
201
  async function qt(e, t) {
200
202
  const { mapView: r } = C(t);
201
- return await Nt(r);
203
+ return await kt(r);
202
204
  }
203
- const zt = E.object({}), An = f(qt, {
205
+ const It = E.object({}), An = f(qt, {
204
206
  name: "goToFullExtent",
205
207
  description: "Zooms the map to the full world extent using Esri's Geocoding Service.",
206
- schema: zt
208
+ schema: It
207
209
  });
208
- async function It(e) {
210
+ async function Dt(e) {
209
211
  const r = e.map.initialViewProperties?.viewpoint?.targetGeometry;
210
212
  if (r)
211
213
  await e.goTo(r);
@@ -213,11 +215,11 @@ async function It(e) {
213
215
  throw new Error("Initial extent is undefined");
214
216
  return { text: "Successfully zoomed to home extent" };
215
217
  }
216
- async function Dt(e, t) {
218
+ async function zt(e, t) {
217
219
  const { mapView: r } = C(t);
218
- return await It(r);
220
+ return await Dt(r);
219
221
  }
220
- const Pt = s.object({}), Ln = f(Dt, {
222
+ const Pt = s.object({}), Ln = f(zt, {
221
223
  name: "goToHomeExtent",
222
224
  description: "Go to the initial web map view extent",
223
225
  schema: Pt
@@ -369,7 +371,7 @@ async function Ht(e) {
369
371
  async function Jt(e) {
370
372
  return await Qe(e);
371
373
  }
372
- async function Zt({
374
+ async function Yt({
373
375
  arcgisMap: e,
374
376
  arcgisMapView: t,
375
377
  layerId: r,
@@ -394,12 +396,12 @@ async function Zt({
394
396
  return `Error applying chart renderer: ${d instanceof Error ? d.message : String(d)}`;
395
397
  }
396
398
  }
397
- const Yt = ["mapView"];
399
+ const Zt = ["mapView"];
398
400
  function $(e) {
399
401
  const r = e?.configurable?.context;
400
402
  if (!r || typeof r != "object")
401
403
  throw new Error("LayerStylingAgent context missing");
402
- const a = Yt.filter((o) => !(o in r));
404
+ const a = Zt.filter((o) => !(o in r));
403
405
  if (a.length)
404
406
  throw new Error(`LayerStylingAgent context missing: ${a.join(", ")}`);
405
407
  return r;
@@ -411,7 +413,7 @@ async function Xt({
411
413
  includeSize: a
412
414
  }, o) {
413
415
  const { mapView: n } = $(o);
414
- return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Zt({
416
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Yt({
415
417
  arcgisMap: n.map,
416
418
  arcgisMapView: n,
417
419
  layerId: e,
@@ -759,7 +761,7 @@ function Sr(e) {
759
761
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
760
762
  let n;
761
763
  const l = t[0];
762
- return o && (n = Ze({
764
+ return o && (n = Ye({
763
765
  includedTags: o,
764
766
  basemap: a.map?.basemap || "topo"
765
767
  })[0]), {
@@ -841,7 +843,7 @@ function Cr(e) {
841
843
  };
842
844
  }
843
845
  async function Er(e) {
844
- return await Ye(e);
846
+ return await Ze(e);
845
847
  }
846
848
  async function Fr({
847
849
  arcgisMap: e,
@@ -868,7 +870,7 @@ async function Fr({
868
870
  return `Error applying predominance renderer: ${d instanceof Error ? d.message : String(d)}`;
869
871
  }
870
872
  }
871
- async function kr({
873
+ async function Nr({
872
874
  layerId: e,
873
875
  fields: t,
874
876
  colorSchemes: r,
@@ -884,12 +886,12 @@ async function kr({
884
886
  includeSize: a
885
887
  });
886
888
  }
887
- const Nr = s.object({
889
+ const kr = s.object({
888
890
  layerId: s.string().describe("The id of the layer to apply the predominance renderer to"),
889
891
  fields: s.array(s.string()).describe("The fields to use for the predominance renderer (competing categories)"),
890
892
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
891
893
  includeSize: s.boolean().optional().describe("Whether to include size visualization (predominance-size)")
892
- }), Hn = f(kr, {
894
+ }), Hn = f(Nr, {
893
895
  name: "predominance",
894
896
  description: `Label: Predominant category
895
897
  Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
@@ -902,7 +904,7 @@ const Nr = s.object({
902
904
  Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top, amount, total, how much, proportional size, graduated size, sum
903
905
  Example: Show the predominant crop in each area and vary the size of each symbol based on the total of all categories.
904
906
  Fields: This style relies on 2-10 number fields.`,
905
- schema: Nr
907
+ schema: kr
906
908
  });
907
909
  function qr(e) {
908
910
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
@@ -925,10 +927,10 @@ function qr(e) {
925
927
  relationshipScheme: n
926
928
  };
927
929
  }
928
- async function zr(e) {
930
+ async function Ir(e) {
929
931
  return await et(e);
930
932
  }
931
- async function Ir({
933
+ async function Dr({
932
934
  arcgisMap: e,
933
935
  arcgisMapView: t,
934
936
  layerId: r,
@@ -946,19 +948,19 @@ async function Ir({
946
948
  colorSchemeTags: o
947
949
  };
948
950
  try {
949
- const c = qr(i), u = await zr(c);
951
+ const c = qr(i), u = await Ir(c);
950
952
  return l.renderer = u.renderer, l.visible = !0, `Relationship renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
951
953
  } catch (c) {
952
954
  return `Error applying relationship renderer: ${c instanceof Error ? c.message : String(c)}`;
953
955
  }
954
956
  }
955
- async function Dr({
957
+ async function zr({
956
958
  layerId: e,
957
959
  fields: t,
958
960
  colorSchemes: r
959
961
  }, a) {
960
962
  const { mapView: o } = $(a);
961
- return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await Ir({
963
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await Dr({
962
964
  arcgisMap: o.map,
963
965
  arcgisMapView: o,
964
966
  layerId: e,
@@ -970,7 +972,7 @@ const Pr = s.object({
970
972
  layerId: s.string().describe("The id of the layer to apply the relationship renderer to"),
971
973
  fields: s.array(s.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),
972
974
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
973
- }), Jn = f(Dr, {
975
+ }), Jn = f(zr, {
974
976
  name: "relationship",
975
977
  description: `Label: Relationship
976
978
  Description: Overlays two color ramps to represent the relationship between two numeric attributes.
@@ -1041,7 +1043,7 @@ const Or = s.object({
1041
1043
  fields: s.array(s.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),
1042
1044
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
1043
1045
  theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
1044
- }), Zn = f(Gr, {
1046
+ }), Yn = f(Gr, {
1045
1047
  name: "size-age",
1046
1048
  description: `Label: Age (size)
1047
1049
  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.
@@ -1114,7 +1116,7 @@ const Vr = s.object({
1114
1116
  fields: s.array(s.string()).describe("The field(s) to use for the size renderer (numeric data)"),
1115
1117
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
1116
1118
  theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
1117
- }), Yn = f(Wr, {
1119
+ }), Zn = f(Wr, {
1118
1120
  name: "size",
1119
1121
  description: `Label: Counts and Amounts (size)
1120
1122
  Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
@@ -1220,17 +1222,17 @@ Fields: This style requires a single field which may be a string, number, or dat
1220
1222
  reducer: be,
1221
1223
  default: () => []
1222
1224
  })
1223
- }), Zr = ["mapView"];
1224
- function N(e) {
1225
+ }), Yr = ["mapView"];
1226
+ function k(e) {
1225
1227
  const r = e?.configurable?.context;
1226
1228
  if (!r || typeof r != "object")
1227
1229
  throw new Error("DataExplorationAgent context missing");
1228
- const a = Zr.filter((o) => !(o in r));
1230
+ const a = Yr.filter((o) => !(o in r));
1229
1231
  if (a.length)
1230
1232
  throw new Error(`DataExplorationAgent context missing: ${a.join(", ")}`);
1231
1233
  return r;
1232
1234
  }
1233
- const Yr = (e) => {
1235
+ const Zr = (e) => {
1234
1236
  const t = e.map?.allLayers.filter((a) => a.type === "feature");
1235
1237
  let r = 0;
1236
1238
  return t?.forEach((a) => {
@@ -1238,8 +1240,8 @@ const Yr = (e) => {
1238
1240
  o.featureEffect && (o.featureEffect = null, r++);
1239
1241
  }), r > 0 ? `Cleared filters from ${r} layer(s). View unchanged.` : "No active filters to clear. View unchanged.";
1240
1242
  }, Xr = async (e, t) => {
1241
- const { mapView: r } = N(t);
1242
- return Yr(r);
1243
+ const { mapView: r } = k(t);
1244
+ return Zr(r);
1243
1245
  }, ea = f(Xr, {
1244
1246
  name: "clearFilters",
1245
1247
  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.",
@@ -1252,7 +1254,7 @@ const Yr = (e) => {
1252
1254
  const a = e.map.initialViewProperties?.viewpoint?.targetGeometry;
1253
1255
  return a ? (await e.goTo(a), "Cleared all filters and returned to home extent.") : "Cleared all filters. Could not determine home extent.";
1254
1256
  }, ra = async (e, t) => {
1255
- const { mapView: r } = N(t);
1257
+ const { mapView: r } = k(t);
1256
1258
  return await ta(r);
1257
1259
  }, aa = f(ra, {
1258
1260
  name: "resetMap",
@@ -1365,7 +1367,7 @@ const J = async (e, t) => {
1365
1367
  includedEffect: a = "drop-shadow(2px, 2px, 2px, gray)",
1366
1368
  excludedEffect: o = "grayscale(100%) opacity(60%) blur(2px)"
1367
1369
  }, n) => {
1368
- const { mapView: l } = N(n);
1370
+ const { mapView: l } = k(n);
1369
1371
  return await na(e, l, a, o, t, r);
1370
1372
  }, la = s.object({
1371
1373
  layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
@@ -1545,7 +1547,7 @@ const J = async (e, t) => {
1545
1547
  };
1546
1548
  };
1547
1549
  async function Ra({ layerId: e, fieldName: t, query: r }, a) {
1548
- const { mapView: o } = N(a), n = await xa(e, t, r, o);
1550
+ const { mapView: o } = k(a), n = await xa(e, t, r, o);
1549
1551
  return JSON.stringify(n, null, 2);
1550
1552
  }
1551
1553
  const $a = s.object({
@@ -1628,9 +1630,9 @@ const Ea = async (e) => {
1628
1630
  field: r,
1629
1631
  sqlWhere: K(i.definitionExpression, t.where),
1630
1632
  ...w && { filter: w }
1631
- })).uniqueValueInfos.sort((z, De) => De.count - z.count).slice(0, b)), g && d.domain?.type === "coded-value" && (g = g.map((z) => ({
1632
- ...z,
1633
- value: A ? A.getName(z.value) ?? z.value : z.value
1633
+ })).uniqueValueInfos.sort((I, ze) => ze.count - I.count).slice(0, b)), g && d.domain?.type === "coded-value" && (g = g.map((I) => ({
1634
+ ...I,
1635
+ value: A ? A.getName(I.value) ?? I.value : I.value
1634
1636
  })));
1635
1637
  } catch (S) {
1636
1638
  console.error("Statistics error:", S);
@@ -1657,7 +1659,7 @@ async function Fa({
1657
1659
  statisticType: r,
1658
1660
  geometryFilter: a
1659
1661
  }, o) {
1660
- const n = xe(o, "layersAndFieldsRegistry"), { mapView: l } = N(o), i = await Ea({
1662
+ const n = xe(o, "layersAndFieldsRegistry"), { mapView: l } = k(o), i = await Ea({
1661
1663
  targetLayer: e,
1662
1664
  fieldName: t,
1663
1665
  statisticType: r,
@@ -1667,12 +1669,12 @@ async function Fa({
1667
1669
  });
1668
1670
  return JSON.stringify(i, null, 2);
1669
1671
  }
1670
- const ka = s.object({
1672
+ const Na = s.object({
1671
1673
  layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
1672
1674
  where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
1673
1675
  distance: s.number().optional().describe("The buffer distance around the geometry."),
1674
1676
  units: F.optional().describe("The units for the distance buffer.")
1675
- }), Na = s.object({
1677
+ }), ka = s.object({
1676
1678
  point: s.object({
1677
1679
  x: s.number().describe("X coordinate (longitude) from navigation result"),
1678
1680
  y: s.number().describe("Y coordinate (latitude) from navigation result"),
@@ -1687,12 +1689,12 @@ const ka = s.object({
1687
1689
  layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
1688
1690
  where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1689
1691
  }),
1690
- geometryFilter: s.union([ka, Na]).optional().describe(
1692
+ geometryFilter: s.union([Na, ka]).optional().describe(
1691
1693
  "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."
1692
1694
  ),
1693
1695
  fieldName: s.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
1694
1696
  statisticType: s.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
1695
- }), za = f(Fa, {
1697
+ }), Ia = f(Fa, {
1696
1698
  name: "getStatistics",
1697
1699
  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.
1698
1700
 
@@ -1708,7 +1710,7 @@ DO NOT USE FOR:
1708
1710
 
1709
1711
  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.`,
1710
1712
  schema: qa
1711
- }), Ia = (e) => e.flatMap((t) => t.split(",")).map((t) => t.trim()).map((t) => t.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((t) => !!t), Da = async (e, t, r, a, o) => {
1713
+ }), Da = (e) => e.flatMap((t) => t.split(",")).map((t) => t.trim()).map((t) => t.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((t) => !!t), za = async (e, t, r, a, o) => {
1712
1714
  const n = r.map?.allLayers.find((m) => m.id === e.layerId), l = await r.whenLayerView(n), i = n.title ?? e.layerId;
1713
1715
  let c;
1714
1716
  if (a) {
@@ -1754,7 +1756,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1754
1756
  const y = n.createQuery();
1755
1757
  y.where = K(n.definitionExpression, e.where || "1=1"), y.outFields = p.length ? p : ["*"], y.orderByFields = t.orderByFields, y.returnGeometry = !1, y.num = t.topCount, c && (y.geometry = c, y.spatialRelationship = "intersects"), a?.distance && (y.distance = a.distance), a?.units && (y.units = a.units), y.outSpatialReference = r.spatialReference;
1756
1758
  const g = [
1757
- .../* @__PURE__ */ new Set([...e.outFields, ...Ia(t.orderByFields)])
1759
+ .../* @__PURE__ */ new Set([...e.outFields, ...Da(t.orderByFields)])
1758
1760
  ], b = le(l, g, o ?? !1);
1759
1761
  try {
1760
1762
  m = b ? await l.queryFeatures(y) : await n.queryFeatures(y);
@@ -1791,7 +1793,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1791
1793
  geometryFilter: r,
1792
1794
  useCurrentExtent: a
1793
1795
  }, o) => {
1794
- const { mapView: n } = N(o), l = await Da(e, t, n, r, a);
1796
+ const { mapView: n } = k(o), l = await za(e, t, n, r, a);
1795
1797
  return JSON.stringify(l, null, 2);
1796
1798
  }, Aa = s.object({
1797
1799
  layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
@@ -1902,7 +1904,7 @@ async function Qa({
1902
1904
  geometryFilter: t,
1903
1905
  useCurrentExtent: r
1904
1906
  }, a) {
1905
- const { mapView: o } = N(a), n = await Ma(e, o, t, r);
1907
+ const { mapView: o } = k(a), n = await Ma(e, o, t, r);
1906
1908
  return JSON.stringify(n, null, 2);
1907
1909
  }
1908
1910
  const _a = s.object({
@@ -1952,7 +1954,7 @@ USE THIS TOOL FOR:
1952
1954
 
1953
1955
  This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1954
1956
  schema: Va
1955
- }), Ua = [Ca, za, Ga, Ba], ai = [da, aa, ea], Ka = new it(Ua, { handleToolErrors: !1 });
1957
+ }), Ua = [Ca, Ia, Ga, Ba], ai = [da, aa, ea], Ka = new it(Ua, { handleToolErrors: !1 });
1956
1958
  async function oi(e, t) {
1957
1959
  const { messages: r } = await Ka.invoke({ messages: e.dataExplorationMessages }, t), a = [], o = [];
1958
1960
  for (const n of r) {
@@ -2043,7 +2045,7 @@ function ce(e) {
2043
2045
  function q(e) {
2044
2046
  return !!e?.map && !("activeLinkChartLayer" in e.map);
2045
2047
  }
2046
- async function Z(e) {
2048
+ async function Y(e) {
2047
2049
  !e || q(e) || !e.map?.diagramNodesExtent || await e.goTo(e.map.diagramNodesExtent);
2048
2050
  }
2049
2051
  function O(e) {
@@ -2059,14 +2061,14 @@ function O(e) {
2059
2061
  }
2060
2062
  function li(e) {
2061
2063
  const r = e?.configurable?.context;
2062
- if (ke(e) === "knowledgeGraph")
2064
+ if (Ne(e) === "knowledgeGraph")
2063
2065
  return "knowledgeGraph";
2064
2066
  const o = r.view;
2065
2067
  return q(o) ? (ce(o), "map") : "linkChart";
2066
2068
  }
2067
2069
  async function M(e) {
2068
2070
  const r = e?.configurable?.context;
2069
- if (ke(e) === "knowledgeGraph")
2071
+ if (Ne(e) === "knowledgeGraph")
2070
2072
  return r;
2071
2073
  {
2072
2074
  const o = r.view.map;
@@ -2090,7 +2092,7 @@ async function M(e) {
2090
2092
  }
2091
2093
  }
2092
2094
  }
2093
- function ke(e) {
2095
+ function Ne(e) {
2094
2096
  const r = e?.configurable?.context;
2095
2097
  if (!r || typeof r != "object")
2096
2098
  throw new Error("ArcgisKnowledgeAgent context missing");
@@ -2102,7 +2104,7 @@ function ke(e) {
2102
2104
  return "view";
2103
2105
  throw new Error("ArcgisKnowledgeAgent context must have either a view or knowledgeGraph property.");
2104
2106
  }
2105
- class Za {
2107
+ class Ya {
2106
2108
  constructor(t) {
2107
2109
  this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = ue.fromDataModel(t);
2108
2110
  }
@@ -2121,7 +2123,7 @@ class ue {
2121
2123
  for (const a of t.entityTypes)
2122
2124
  r.entityTypes.push(G.fromEntityType(a));
2123
2125
  for (const a of t.relationshipTypes)
2124
- r.relationshipTypes.push(Ya.fromRelationshipType(a));
2126
+ r.relationshipTypes.push(Za.fromRelationshipType(a));
2125
2127
  return r.identifierInfo = {
2126
2128
  mappingInfo: {
2127
2129
  identifierMapsTo: Xa(
@@ -2162,7 +2164,7 @@ class G {
2162
2164
  return r;
2163
2165
  }
2164
2166
  }
2165
- class Ya extends G {
2167
+ class Za extends G {
2166
2168
  constructor() {
2167
2169
  super(...arguments), this.observedEndPoints = [];
2168
2170
  }
@@ -2238,7 +2240,7 @@ function to(e) {
2238
2240
  return "Regular";
2239
2241
  }
2240
2242
  }
2241
- function Y(e) {
2243
+ function Z(e) {
2242
2244
  return e?.signal;
2243
2245
  }
2244
2246
  async function ro(e, t) {
@@ -2259,15 +2261,15 @@ async function ao(e, t, r, a) {
2259
2261
  async function de(e, t, r, a, o) {
2260
2262
  const n = {
2261
2263
  message: await ro(e, o),
2262
- context: new Za(t)
2263
- }, l = Y(a);
2264
+ context: new Ya(t)
2265
+ }, l = Z(a);
2264
2266
  await x({ text: "Attempting to generate a cypher query from your prompt..." }, a);
2265
2267
  const i = await me(`${r}/chat`, {
2266
2268
  method: "post",
2267
2269
  body: JSON.stringify(n),
2268
2270
  headers: {
2269
2271
  "Content-Type": "application/json",
2270
- token: pe.findCredential(k.getDefault().url)?.token ?? ""
2272
+ token: pe.findCredential(N.getDefault().url)?.token ?? ""
2271
2273
  },
2272
2274
  signal: l
2273
2275
  });
@@ -2292,7 +2294,7 @@ async function de(e, t, r, a, o) {
2292
2294
  }),
2293
2295
  headers: {
2294
2296
  "Content-Type": "application/json",
2295
- token: pe.findCredential(k.getDefault().url)?.token ?? ""
2297
+ token: pe.findCredential(N.getDefault().url)?.token ?? ""
2296
2298
  },
2297
2299
  signal: l
2298
2300
  });
@@ -2315,26 +2317,26 @@ async function de(e, t, r, a, o) {
2315
2317
  return { graphQuery: p, explanation: m };
2316
2318
  }
2317
2319
  function oo(e, t) {
2318
- I(e, (r) => {
2320
+ D(e, (r) => {
2319
2321
  t.set(`${r.typeName}__${r.id}`, {
2320
2322
  id: r.id,
2321
2323
  typeName: r.typeName
2322
2324
  });
2323
2325
  });
2324
2326
  }
2325
- function I(e, t) {
2327
+ function D(e, t) {
2326
2328
  if (!(!e || typeof e != "object")) {
2327
2329
  if (io(e))
2328
2330
  for (const r of e.path)
2329
- I(r, t);
2331
+ D(r, t);
2330
2332
  else if (no(e))
2331
2333
  t(e);
2332
2334
  else if (Array.isArray(e))
2333
2335
  for (const r of e)
2334
- I(r, t);
2336
+ D(r, t);
2335
2337
  else if (so(e))
2336
2338
  for (const r of Object.values(e.properties ?? {}))
2337
- I(r, t);
2339
+ D(r, t);
2338
2340
  }
2339
2341
  }
2340
2342
  function no(e) {
@@ -2382,8 +2384,8 @@ function co(e, t) {
2382
2384
  }
2383
2385
  return { allNamedTypesFullyDynamic: i, bindParameters: r, nonDynamicTypes: a };
2384
2386
  }
2385
- const D = 3;
2386
- function Ne(e, t = 100) {
2387
+ const z = 3;
2388
+ function ke(e, t = 100) {
2387
2389
  const r = {};
2388
2390
  for (const a of Object.entries(e.properties ?? {})) {
2389
2391
  const [o, n] = a;
@@ -2446,7 +2448,7 @@ async function qe({
2446
2448
  config: u
2447
2449
  }) {
2448
2450
  let d;
2449
- for (let p = 1; p <= D; p++) {
2451
+ for (let p = 1; p <= z; p++) {
2450
2452
  let m;
2451
2453
  try {
2452
2454
  m = await de(e, r.dataModel, a, u, d);
@@ -2491,7 +2493,7 @@ async function qe({
2491
2493
  graphQuery: m.graphQuery,
2492
2494
  explanation: m.explanation
2493
2495
  };
2494
- if (p >= D)
2496
+ if (p >= z)
2495
2497
  return h.type === "timeout" ? {
2496
2498
  type: "timeout",
2497
2499
  errorMessage: y,
@@ -2514,7 +2516,7 @@ async function qe({
2514
2516
  );
2515
2517
  }
2516
2518
  throw new Error(
2517
- `Failed to execute generated cypher due to an unexpected error after ${D} attempts.`
2519
+ `Failed to execute generated cypher due to an unexpected error after ${z} attempts.`
2518
2520
  );
2519
2521
  }
2520
2522
  const po = async (e, t) => {
@@ -2578,15 +2580,15 @@ const po = async (e, t) => {
2578
2580
  type: "success",
2579
2581
  results: l
2580
2582
  };
2581
- }, ze = "IMPORTANT: The generated cypher query must return entire entities and relationships ONLY.";
2582
- async function Ie({
2583
+ }, Ie = "IMPORTANT: The generated cypher query must return entire entities and relationships ONLY.";
2584
+ async function De({
2583
2585
  prompt: e,
2584
2586
  view: t,
2585
2587
  knowledgeGraph: r,
2586
2588
  includeReturnEntityAndRelationshipContext: a = !1
2587
2589
  }) {
2588
2590
  const o = [e];
2589
- if (a && o.push(ze), !q(t) && t.map) {
2591
+ if (a && o.push(Ie), !q(t) && t.map) {
2590
2592
  const d = await B("arcgis_knowledge_current_lc_context"), p = lo(t.map, r);
2591
2593
  return o.push(d), {
2592
2594
  enhancedPrompt: o.join(`
@@ -2633,7 +2635,7 @@ async function ho(e, t, r, a, o, n) {
2633
2635
  return m;
2634
2636
  },
2635
2637
  requestOptions: {
2636
- signal: Y(n),
2638
+ signal: Z(n),
2637
2639
  timeout: n?.timeout
2638
2640
  },
2639
2641
  config: n
@@ -2648,7 +2650,7 @@ async function ho(e, t, r, a, o, n) {
2648
2650
  text: `Query Results parsed into ${p.length} unique relationships and entities. Atempting to add to link chart...`
2649
2651
  },
2650
2652
  n
2651
- ), !q(l) && l?.map ? (await l.map.addRecords(p), await Z(l), { generatedQuery: c, explanation: u, addedIdTypePairs: p }) : (await l?.map?.allLayers.find(
2653
+ ), !q(l) && l?.map ? (await l.map.addRecords(p), await Y(l), { generatedQuery: c, explanation: u, addedIdTypePairs: p }) : (await l?.map?.allLayers.find(
2652
2654
  (w) => w.type === "knowledge-graph"
2653
2655
  )?.addRecords(p), { generatedQuery: c, explanation: u, addedIdTypePairs: p });
2654
2656
  }
@@ -2657,11 +2659,11 @@ const W = "addRecords", yo = s.object({
2657
2659
  "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."
2658
2660
  )
2659
2661
  }), fo = async ({ prompt: e }, t) => {
2660
- const { knowledgeGraph: r } = await M(t), a = O(t), { view: o } = a, l = k.getDefault().helperServices, {
2662
+ const { knowledgeGraph: r } = await M(t), a = O(t), { view: o } = a, l = N.getDefault().helperServices, {
2661
2663
  enhancedPrompt: i,
2662
2664
  bindParameters: c,
2663
2665
  allNamedTypesFullyDynamic: u
2664
- } = await Ie({
2666
+ } = await De({
2665
2667
  prompt: e,
2666
2668
  view: o,
2667
2669
  knowledgeGraph: r,
@@ -2724,7 +2726,7 @@ Number of records added: ${m.length}`,
2724
2726
  schema: yo
2725
2727
  });
2726
2728
  async function go(e, t) {
2727
- return await t.map?.applyLayout(e), await Z(t), { appliedLayout: e };
2729
+ return await t.map?.applyLayout(e), await Y(t), { appliedLayout: e };
2728
2730
  }
2729
2731
  const re = "applyLayout", wo = s.object({
2730
2732
  layout: s.enum([
@@ -2766,7 +2768,7 @@ const re = "applyLayout", wo = s.object({
2766
2768
  schema: wo
2767
2769
  });
2768
2770
  async function To(e, t) {
2769
- return t.map?.changeNonspatialDataDisplay(e), await Z(t), { appliedNonspatialDataDisplayMode: e };
2771
+ return t.map?.changeNonspatialDataDisplay(e), await Y(t), { appliedNonspatialDataDisplayMode: e };
2770
2772
  }
2771
2773
  const ae = "changeNonspatialVisibility", So = s.object({
2772
2774
  setting: s.enum(["hidden", "visible"]).describe("The setting of nonspatial visibility")
@@ -2797,7 +2799,7 @@ const ae = "changeNonspatialVisibility", So = s.object({
2797
2799
  });
2798
2800
  async function xo(e, t, r, a, o) {
2799
2801
  let n, l = "";
2800
- for (let i = 1; i <= D; i++) {
2802
+ for (let i = 1; i <= z; i++) {
2801
2803
  const { graphQuery: c, explanation: u } = await de(
2802
2804
  e,
2803
2805
  t.dataModel,
@@ -2821,14 +2823,14 @@ async function xo(e, t, r, a, o) {
2821
2823
  ${c}
2822
2824
 
2823
2825
  Explanation: ${u}`
2824
- }) : (await Z(a), {
2826
+ }) : (await Y(a), {
2825
2827
  type: "success",
2826
2828
  graphQuery: c,
2827
2829
  explanation: u
2828
2830
  });
2829
2831
  } catch (d) {
2830
2832
  const p = P(d);
2831
- if (i >= D) {
2833
+ if (i >= z) {
2832
2834
  l = p;
2833
2835
  break;
2834
2836
  }
@@ -2844,7 +2846,7 @@ Explanation: ${u}`
2844
2846
  }
2845
2847
  return {
2846
2848
  type: "error",
2847
- errorMessage: `Failed to create link chart after ${D} attempts. Last error: ${l}`
2849
+ errorMessage: `Failed to create link chart after ${z} attempts. Last error: ${l}`
2848
2850
  };
2849
2851
  }
2850
2852
  const V = "createLinkChart", Ro = s.object({
@@ -2861,10 +2863,10 @@ const V = "createLinkChart", Ro = s.object({
2861
2863
  error: new Error()
2862
2864
  };
2863
2865
  {
2864
- const n = k.getDefault().helperServices, l = await xo(
2866
+ const n = N.getDefault().helperServices, l = await xo(
2865
2867
  `${e}
2866
2868
 
2867
- ${ze}`,
2869
+ ${Ie}`,
2868
2870
  r,
2869
2871
  `${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,
2870
2872
  a,
@@ -2900,13 +2902,13 @@ Explanation: ${c}`,
2900
2902
  "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."
2901
2903
  )
2902
2904
  }), Eo = async ({ prompt: e }, t) => {
2903
- const { knowledgeGraph: r } = await M(t), o = k.getDefault().helperServices;
2905
+ const { knowledgeGraph: r } = await M(t), o = N.getDefault().helperServices;
2904
2906
  let n = e, l = null, i = null;
2905
2907
  try {
2906
2908
  ({ view: i } = O(t));
2907
2909
  } catch {
2908
2910
  }
2909
- i && ({ enhancedPrompt: n, bindParameters: l } = await Ie({
2911
+ i && ({ enhancedPrompt: n, bindParameters: l } = await De({
2910
2912
  prompt: e,
2911
2913
  view: i,
2912
2914
  knowledgeGraph: r,
@@ -2920,7 +2922,7 @@ Explanation: ${c}`,
2920
2922
  targetStructure: new Array(),
2921
2923
  targetStructureReducer: (g, b) => (g.push(b), g),
2922
2924
  requestOptions: {
2923
- signal: Y(t),
2925
+ signal: Z(t),
2924
2926
  timeout: t?.timeout
2925
2927
  },
2926
2928
  config: t
@@ -2937,9 +2939,9 @@ Explanation: ${c}`,
2937
2939
  const { graphQuery: u, explanation: d, processedResult: p, resultHeader: m } = c, w = m.headerKeys;
2938
2940
  for (const g of p)
2939
2941
  for (const b of g)
2940
- I(
2942
+ D(
2941
2943
  b,
2942
- (v) => Ne(v)
2944
+ (v) => ke(v)
2943
2945
  );
2944
2946
  const h = 50, y = p.slice(0, h).map((g) => JSON.stringify(g));
2945
2947
  return {
@@ -2976,8 +2978,8 @@ ${y.length > h ? `Showing top ${h} results:
2976
2978
  schema: Co
2977
2979
  }), ne = "generateCypher", Fo = s.object({
2978
2980
  prompt: s.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")
2979
- }), ko = async ({ prompt: e }, t) => {
2980
- const { knowledgeGraph: r } = await M(t), o = k.getDefault().helperServices;
2981
+ }), No = async ({ prompt: e }, t) => {
2982
+ const { knowledgeGraph: r } = await M(t), o = N.getDefault().helperServices;
2981
2983
  try {
2982
2984
  const { graphQuery: n, explanation: l } = await ao(
2983
2985
  e,
@@ -3006,11 +3008,11 @@ Explanation: ${l}`,
3006
3008
  error: n
3007
3009
  };
3008
3010
  }
3009
- }, hi = f(ko, {
3011
+ }, hi = f(No, {
3010
3012
  name: ne,
3011
3013
  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.",
3012
3014
  schema: Fo
3013
- }), No = (e) => {
3015
+ }), ko = (e) => {
3014
3016
  const t = e.dataModel, r = /* @__PURE__ */ new Map();
3015
3017
  for (const i of t.searchIndexes)
3016
3018
  if (i.supportedCategory !== "esriTypeMetaEntityProvenance")
@@ -3030,7 +3032,7 @@ ${l}`;
3030
3032
  async function qo(e, t, r) {
3031
3033
  const a = await B("arcgis_knowledge_lucene_generation_prompt"), o = {
3032
3034
  inquiry: e,
3033
- dataModelForSearch: No(t)
3035
+ dataModelForSearch: ko(t)
3034
3036
  }, 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(
3035
3037
  "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."
3036
3038
  ), i = s.array(
@@ -3052,11 +3054,11 @@ async function qo(e, t, r) {
3052
3054
  config: r
3053
3055
  });
3054
3056
  }
3055
- const ie = "searchGraphData", zo = s.object({
3057
+ const ie = "searchGraphData", Io = s.object({
3056
3058
  prompt: s.string().describe(
3057
3059
  "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."
3058
3060
  )
3059
- }), Io = async ({ prompt: e }, t) => {
3061
+ }), Do = async ({ prompt: e }, t) => {
3060
3062
  const { knowledgeGraph: r } = await M(t);
3061
3063
  await x({ text: "Generating search query for the user inquiry" }, t);
3062
3064
  const a = await qo(e, r, t);
@@ -3068,7 +3070,7 @@ const ie = "searchGraphData", zo = s.object({
3068
3070
  namedTypesFilter: a.typeFilters,
3069
3071
  searchResultLimit: a.resultLimit,
3070
3072
  requestOptions: {
3071
- signal: Y(t),
3073
+ signal: Z(t),
3072
3074
  timeout: t?.timeout
3073
3075
  }
3074
3076
  });
@@ -3080,9 +3082,9 @@ const ie = "searchGraphData", zo = s.object({
3080
3082
  error: "error" in o ? o.error : null
3081
3083
  };
3082
3084
  for (const i of o.results)
3083
- I(
3085
+ D(
3084
3086
  i,
3085
- (c) => Ne(c)
3087
+ (c) => ke(c)
3086
3088
  );
3087
3089
  const n = 10, l = o.results.slice(0, n);
3088
3090
  return {
@@ -3105,7 +3107,7 @@ const ie = "searchGraphData", zo = s.object({
3105
3107
  searchResults: o.results
3106
3108
  }
3107
3109
  };
3108
- }, yi = f(Io, {
3110
+ }, yi = f(Do, {
3109
3111
  name: ie,
3110
3112
  description: `
3111
3113
  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.
@@ -3117,7 +3119,7 @@ const ie = "searchGraphData", zo = s.object({
3117
3119
  - "Find all reports authored by someone with the title of 'Researcher'"
3118
3120
  - "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".
3119
3121
  - "Search for all john smiths and show their global ids`,
3120
- schema: zo
3122
+ schema: Io
3121
3123
  });
3122
3124
  export {
3123
3125
  Wn as A,
@@ -3129,15 +3131,15 @@ export {
3129
3131
  ue as G,
3130
3132
  ni as H,
3131
3133
  Jn as I,
3132
- Zn as J,
3133
- Yn as K,
3134
+ Yn as J,
3135
+ Zn as K,
3134
3136
  Xn as L,
3135
3137
  ei as M,
3136
- zn as N,
3138
+ In as N,
3137
3139
  ri as O,
3138
3140
  ai as P,
3139
3141
  Ua as Q,
3140
- N as R,
3142
+ k as R,
3141
3143
  ti as S,
3142
3144
  oi as T,
3143
3145
  ui as a,
@@ -3150,9 +3152,9 @@ export {
3150
3152
  li as h,
3151
3153
  M as i,
3152
3154
  si as j,
3153
- In as k,
3155
+ Dn as k,
3154
3156
  ii as l,
3155
- Dn as m,
3157
+ zn as m,
3156
3158
  Pn as n,
3157
3159
  An as o,
3158
3160
  Ln as p,