@arcgis/ai-components 5.2.0-next.0 → 5.2.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-utils/LLMAgent.js +22 -22
- package/dist/cdn/{DHOVCT6R.js → 2SJAOYZT.js} +1 -1
- package/dist/cdn/434TAA3J.js +2 -0
- package/dist/cdn/{AMP6IALT.js → 5W7S2RS4.js} +1 -1
- package/dist/cdn/64PJB5NU.js +2 -0
- package/dist/cdn/{OH64RMOR.js → 6AWNQHCO.js} +2 -2
- package/dist/cdn/BIV2IPHH.js +2 -0
- package/dist/cdn/CCY4TSBO.js +2 -0
- package/dist/cdn/{AO7BQHKC.js → CTSALWEP.js} +1 -1
- package/dist/cdn/{NAUXSHIE.js → D2N2NSRQ.js} +2 -2
- package/dist/cdn/{3PKJWIC3.js → D3TNNRP4.js} +1 -1
- package/dist/cdn/{H7422XUG.js → DOV5ZJ7M.js} +1 -1
- package/dist/cdn/EEUCKMU7.js +2 -0
- package/dist/cdn/EGHBXLNG.js +2 -0
- package/dist/cdn/{N2VQD46V.js → ETRWZ3MS.js} +31 -29
- package/dist/cdn/{QDO2AO53.js → EWI4V3GQ.js} +10 -10
- package/dist/cdn/{6MAINSY5.js → FL4W4VYN.js} +0 -1
- package/dist/cdn/GTLS44GI.js +2 -0
- package/dist/cdn/{SZOVY2QU.js → I6HNBTWY.js} +1 -1
- package/dist/cdn/JBHNHHWO.js +3 -0
- package/dist/cdn/{FX5JFRDL.js → JOFUPKIB.js} +1 -1
- package/dist/cdn/KUEOKIQR.js +2 -0
- package/dist/cdn/LKRAPK4A.js +165 -0
- package/dist/cdn/{6R6AY3D3.js → MODWHY3R.js} +2 -2
- package/dist/cdn/NXKKG5TK.js +2 -0
- package/dist/cdn/{2AXF774U.js → OBUZ7HBN.js} +1 -1
- package/dist/cdn/OIVRK7HT.js +2 -0
- package/dist/cdn/{HB5A5R2E.js → RUURNLTP.js} +1 -1
- package/dist/cdn/SWOXSJ62.js +2 -0
- package/dist/cdn/{LBVX2JYG.js → T537PKP4.js} +10 -7
- package/dist/cdn/{Y67XAMT4.js → TSZPHE7L.js} +2 -2
- package/dist/cdn/VAZNJSKA.js +16 -0
- package/dist/cdn/{V2P4AIGG.js → VMXLYWUK.js} +1 -1
- package/dist/cdn/{FB5DRKEB.js → VNQN5ZQO.js} +2 -2
- package/dist/cdn/WIDTPVSU.js +2 -0
- package/dist/cdn/{GM3QP65I.js → X2ZDYHCG.js} +18 -5
- package/dist/cdn/{P6OPJQMC.js → XER22VYQ.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/main.css +1 -1
- package/dist/chunks/adapter.js +527 -522
- package/dist/chunks/arcgisKnowledgeGraph.js +3 -3
- package/dist/chunks/dataExplorationGraph.js +135 -119
- package/dist/chunks/data_explore_query_prompt.js +18 -5
- package/dist/chunks/generateLayerDescriptions.js +236 -209
- package/dist/chunks/helpGraph.js +4 -4
- package/dist/chunks/intent_prompt.js +0 -1
- package/dist/chunks/layerStylingGraph.js +10 -10
- package/dist/chunks/navigationGraph.js +27 -27
- package/dist/chunks/orchestrator.js +240 -201
- package/dist/chunks/slottableRequestUtils.js +3 -7
- package/dist/chunks/summarize_query_response_prompt.js +10 -7
- package/dist/components/arcgis-assistant/customElement.d.ts +15 -0
- package/dist/components/arcgis-assistant/customElement.js +227 -127
- package/dist/components/arcgis-assistant/index.js +2 -3
- package/dist/components/arcgis-assistant/types.d.ts +14 -1
- package/dist/components/arcgis-assistant-chat/customElement.d.ts +8 -2
- package/dist/components/arcgis-assistant-chat/customElement.js +7 -7
- package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
- package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-interrupt/customElement.js +13 -9
- package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +20 -0
- package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
- package/dist/components/arcgis-assistant-message/customElement.d.ts +23 -0
- package/dist/components/arcgis-assistant-message/customElement.js +28 -26
- package/dist/components/arcgis-assistant-message/index.d.ts +1 -0
- package/dist/components/arcgis-assistant-message/index.js +2 -0
- package/dist/components/arcgis-assistant-message-block/customElement.d.ts +1 -1
- package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
- package/dist/components/arcgis-assistant-message-block/index.js +1 -0
- package/dist/components/arcgis-assistant-message-feedback/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-message-footer/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +8 -1
- package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -8
- package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
- package/dist/components/arcgis-assistant-message-log/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-message-read-aloud/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-message-text/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-speech-input/customElement.d.ts +6 -1
- package/dist/components/arcgis-assistant-suggested-prompts/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
- package/dist/components/arcgis-assistant-user-message/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-user-message/customElement.js +1 -1
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/loader.js +6 -5
- package/dist/types/lumina.d.ts +10 -4
- package/dist/types/preact.d.ts +11 -4
- package/dist/types/react.d.ts +12 -4
- package/dist/types/stencil.d.ts +10 -4
- package/dist/utils/index.d.ts +85 -42
- package/dist/utils/index.js +22 -18
- package/package.json +7 -7
- package/dist/cdn/7BCR6TUO.js +0 -2
- package/dist/cdn/7GH7VSB2.js +0 -2
- package/dist/cdn/7PLV4QH6.js +0 -2
- package/dist/cdn/DDLZOMUY.js +0 -2
- package/dist/cdn/EF453FJ2.js +0 -3
- package/dist/cdn/METXWS7V.js +0 -166
- package/dist/cdn/MH5RPXHM.js +0 -2
- package/dist/cdn/NVI3I46B.js +0 -2
- package/dist/cdn/OAVEHGB6.js +0 -2
- package/dist/cdn/QR54T33D.js +0 -2
- package/dist/cdn/SXDLXCIM.js +0 -2
- package/dist/cdn/U3QQW6VA.js +0 -16
- package/dist/cdn/USMDJUFS.js +0 -2
- package/dist/cdn/Y333DGV6.js +0 -2
package/dist/chunks/adapter.js
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
2
|
import ce from "@arcgis/core/identity/IdentityManager.js";
|
|
3
|
-
import
|
|
4
|
-
import { Annotation as b, messagesStateReducer as
|
|
5
|
-
import { n as
|
|
3
|
+
import k from "@arcgis/core/portal/Portal.js";
|
|
4
|
+
import { Annotation as b, messagesStateReducer as ye } from "@langchain/langgraph/web";
|
|
5
|
+
import { n as ze, o as x, k as U, s as S, i as qe } from "./generateLayerDescriptions.js";
|
|
6
6
|
import "@langchain/core/messages";
|
|
7
7
|
import "@langchain/core/callbacks/dispatch/web";
|
|
8
8
|
import "@langchain/openai";
|
|
9
|
-
import * as
|
|
9
|
+
import * as De from "@arcgis/core/core/reactiveUtils.js";
|
|
10
10
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
11
11
|
import le from "@arcgis/core/request.js";
|
|
12
12
|
import "@langchain/core/prompts";
|
|
13
13
|
import { tool as f } from "@langchain/core/tools";
|
|
14
14
|
import J from "@arcgis/core/config.js";
|
|
15
|
-
import
|
|
16
|
-
import { addressToLocations as
|
|
17
|
-
import
|
|
15
|
+
import Ae from "@arcgis/core/Graphic.js";
|
|
16
|
+
import { addressToLocations as Le } from "@arcgis/core/rest/locator.js";
|
|
17
|
+
import Pe from "@arcgis/core/symbols/PictureMarkerSymbol.js";
|
|
18
18
|
import i, { z as C } from "zod";
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import { createRenderer as
|
|
22
|
-
import { getSchemesByTag as
|
|
19
|
+
import je from "@arcgis/core/geometry/Extent.js";
|
|
20
|
+
import fe from "@arcgis/core/geometry/Point.js";
|
|
21
|
+
import { createRenderer as Ge } from "@arcgis/core/smartMapping/renderers/pieChart.js";
|
|
22
|
+
import { getSchemesByTag as Oe, getSchemes as Me } from "@arcgis/core/smartMapping/symbology/pieChart.js";
|
|
23
23
|
import { getBackgroundColorTheme as ue } from "@arcgis/core/views/support/colorUtils.js";
|
|
24
|
-
import { createAgeRenderer as
|
|
24
|
+
import { createAgeRenderer as Qe, createContinuousRenderer as _e } from "@arcgis/core/smartMapping/renderers/color.js";
|
|
25
25
|
import { getSchemesByTag as re } from "@arcgis/core/smartMapping/symbology/color.js";
|
|
26
|
-
import { createContinuousRenderer as
|
|
27
|
-
import { createRenderer as
|
|
28
|
-
import { getSchemesByTag as
|
|
29
|
-
import { createRenderer as
|
|
30
|
-
import { getSchemesByTag as
|
|
31
|
-
import { createRenderer as
|
|
32
|
-
import { getSchemesByTag as
|
|
33
|
-
import { createRenderer as
|
|
34
|
-
import { getSchemesByTag as
|
|
35
|
-
import { createAgeRenderer as
|
|
36
|
-
import { createRenderer as
|
|
37
|
-
import { getSchemesByTag as
|
|
38
|
-
import { ToolNode as
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import * as
|
|
42
|
-
import { formatDateOnly as
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
import
|
|
48
|
-
import
|
|
26
|
+
import { createContinuousRenderer as We } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
|
|
27
|
+
import { createRenderer as Ve } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
|
|
28
|
+
import { getSchemesByTag as Ue } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
|
|
29
|
+
import { createRenderer as Ke } from "@arcgis/core/smartMapping/renderers/heatmap.js";
|
|
30
|
+
import { getSchemesByTag as Be } from "@arcgis/core/smartMapping/symbology/heatmap.js";
|
|
31
|
+
import { createRenderer as He } from "@arcgis/core/smartMapping/renderers/predominance.js";
|
|
32
|
+
import { getSchemesByTag as Je } from "@arcgis/core/smartMapping/symbology/predominance.js";
|
|
33
|
+
import { createRenderer as Ze } from "@arcgis/core/smartMapping/renderers/relationship.js";
|
|
34
|
+
import { getSchemesByTag as Ye } from "@arcgis/core/smartMapping/symbology/relationship.js";
|
|
35
|
+
import { createAgeRenderer as Xe, createContinuousRenderer as et } from "@arcgis/core/smartMapping/renderers/size.js";
|
|
36
|
+
import { createRenderer as tt } from "@arcgis/core/smartMapping/renderers/type.js";
|
|
37
|
+
import { getSchemesByTag as rt } from "@arcgis/core/smartMapping/symbology/type.js";
|
|
38
|
+
import { ToolNode as ot } from "@langchain/langgraph/prebuilt";
|
|
39
|
+
import at from "@arcgis/core/layers/support/FeatureEffect.js";
|
|
40
|
+
import ge from "@arcgis/core/layers/support/FeatureFilter.js";
|
|
41
|
+
import * as nt from "@arcgis/core/geometry/operators/unionOperator.js";
|
|
42
|
+
import { formatDateOnly as it, convertDateFormatToIntlOptions as M, formatTimeOnly as st, formatDate as de } from "@arcgis/core/intl.js";
|
|
43
|
+
import ct from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
|
|
44
|
+
import lt from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
|
|
45
|
+
import ut from "@arcgis/core/rest/support/TopFeaturesQuery.js";
|
|
46
|
+
import dt from "@arcgis/core/rest/support/TopFilter.js";
|
|
47
|
+
import pt from "@arcgis/core/WebLinkChart.js";
|
|
48
|
+
import we from "@arcgis/core/rest/knowledgeGraph/GraphQueryStreaming.js";
|
|
49
49
|
import "@arcgis/core/views/LinkChartView.js";
|
|
50
|
-
import { fetchKnowledgeGraph as pe, executeQueryStreaming as
|
|
51
|
-
import
|
|
52
|
-
const L = (e, t) => t ?? e,
|
|
53
|
-
...
|
|
50
|
+
import { fetchKnowledgeGraph as pe, executeQueryStreaming as ht, executeSearchStreaming as mt } from "@arcgis/core/rest/knowledgeGraphService.js";
|
|
51
|
+
import yt from "@arcgis/core/rest/knowledgeGraph/GraphSearchStreaming.js";
|
|
52
|
+
const L = (e, t) => t ?? e, vn = b.Root({
|
|
53
|
+
...ze(),
|
|
54
54
|
// internal to the navigation agent
|
|
55
55
|
intent: b({
|
|
56
56
|
reducer: L
|
|
@@ -69,21 +69,21 @@ const L = (e, t) => t ?? e, Tn = b.Root({
|
|
|
69
69
|
})
|
|
70
70
|
})
|
|
71
71
|
});
|
|
72
|
-
async function
|
|
73
|
-
const o =
|
|
72
|
+
async function ft(e, t) {
|
|
73
|
+
const o = k.getDefault().helperServices, a = o.geocode.find((h) => h.name === "ArcGIS World Geocoding Service") ?? o.geocode[0];
|
|
74
74
|
if (!a)
|
|
75
75
|
throw new Error("No geocoding service found in helperServices.");
|
|
76
|
-
const n = a.url, s = `${J.assetsPath?.endsWith("/") ? J.assetsPath : `${J.assetsPath}/`}esri/images/search/search-symbol-32.png`, u = (await
|
|
76
|
+
const n = a.url, s = `${J.assetsPath?.endsWith("/") ? J.assetsPath : `${J.assetsPath}/`}esri/images/search/search-symbol-32.png`, u = (await Le(n, {
|
|
77
77
|
address: { SingleLine: e },
|
|
78
78
|
outFields: ["Match_addr"]
|
|
79
79
|
}))?.[0];
|
|
80
80
|
if (!u?.extent || !u.location)
|
|
81
81
|
throw new Error(`Could not find location for: ${e}`);
|
|
82
|
-
const l = new
|
|
82
|
+
const l = new Pe({
|
|
83
83
|
url: s,
|
|
84
84
|
width: 24,
|
|
85
85
|
height: 24
|
|
86
|
-
}), d = new
|
|
86
|
+
}), d = new Ae({
|
|
87
87
|
geometry: u.location,
|
|
88
88
|
symbol: l
|
|
89
89
|
});
|
|
@@ -98,28 +98,28 @@ async function yt(e, t) {
|
|
|
98
98
|
sharedStatePatch: { lastResolvedLocation: { value: p } }
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
const
|
|
101
|
+
const gt = ["mapView"];
|
|
102
102
|
function $(e) {
|
|
103
103
|
const r = e?.configurable?.context;
|
|
104
104
|
if (!r || typeof r != "object")
|
|
105
105
|
throw new Error("NavigationAgent context missing");
|
|
106
|
-
const o =
|
|
106
|
+
const o = gt.filter((a) => !(a in r));
|
|
107
107
|
if (o.length)
|
|
108
108
|
throw new Error(`NavigationAgent context missing: ${o.join(", ")}`);
|
|
109
109
|
return r;
|
|
110
110
|
}
|
|
111
|
-
async function
|
|
111
|
+
async function wt({ address: e }, t) {
|
|
112
112
|
const { mapView: r } = $(t);
|
|
113
|
-
return await
|
|
113
|
+
return await ft(e, r);
|
|
114
114
|
}
|
|
115
|
-
const
|
|
115
|
+
const bt = i.object({
|
|
116
116
|
address: i.string().describe("The full address or place name to locate.")
|
|
117
|
-
}), Sn = f(
|
|
117
|
+
}), Sn = f(wt, {
|
|
118
118
|
name: "goToAddress",
|
|
119
119
|
description: "Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",
|
|
120
|
-
schema:
|
|
120
|
+
schema: bt
|
|
121
121
|
});
|
|
122
|
-
async function
|
|
122
|
+
async function Tt(e, t) {
|
|
123
123
|
const o = t.map.bookmarks;
|
|
124
124
|
if (!o || o.length === 0)
|
|
125
125
|
throw new Error("No bookmarks found in the map.");
|
|
@@ -131,50 +131,60 @@ async function bt(e, t) {
|
|
|
131
131
|
throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);
|
|
132
132
|
return await t.goTo(n), { text: `Navigated to bookmark: ${e}` };
|
|
133
133
|
}
|
|
134
|
-
async function
|
|
134
|
+
async function vt({ bookmarkName: e }, t) {
|
|
135
135
|
const { mapView: r } = $(t);
|
|
136
|
-
return await Promise.resolve(
|
|
136
|
+
return await Promise.resolve(Tt(e, r));
|
|
137
137
|
}
|
|
138
138
|
const St = C.object({
|
|
139
139
|
bookmarkName: C.string().describe("The name of the bookmark to navigate to.")
|
|
140
|
-
}),
|
|
140
|
+
}), xn = f(vt, {
|
|
141
141
|
name: "goToBookmark",
|
|
142
142
|
description: "Go to the extent of the bookmark with the given name.",
|
|
143
143
|
schema: St
|
|
144
144
|
});
|
|
145
|
-
async function
|
|
146
|
-
const o = r.map?.allLayers.find((
|
|
145
|
+
async function xt(e, t, r) {
|
|
146
|
+
const o = r.map?.allLayers.find((s) => s.id === e);
|
|
147
147
|
if (!o)
|
|
148
148
|
return { text: `Error: Layer with id ${e} not found` };
|
|
149
|
-
const a = o.createQuery();
|
|
150
|
-
|
|
149
|
+
const a = t?.trim() ? t : "1=1", n = o.createQuery();
|
|
150
|
+
n.where = a;
|
|
151
151
|
try {
|
|
152
|
-
const { extent:
|
|
153
|
-
if (
|
|
154
|
-
return { text: `No features found in ${o.title} matching: ${
|
|
155
|
-
if (
|
|
156
|
-
await r.goTo(
|
|
152
|
+
const { extent: s, count: c } = await o.queryExtent(n);
|
|
153
|
+
if (c === 0)
|
|
154
|
+
return { text: `No features found in ${o.title} matching: ${a}`, where: a };
|
|
155
|
+
if (s)
|
|
156
|
+
await r.goTo(s);
|
|
157
157
|
else
|
|
158
|
-
return { text: `Error: Unable to determine extent for ${o.title}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
return { text: `Error: Unable to determine extent for ${o.title}`, where: a };
|
|
159
|
+
const u = {
|
|
160
|
+
layerId: e,
|
|
161
|
+
layerTitle: o.title ?? e,
|
|
162
|
+
where: a,
|
|
163
|
+
count: c
|
|
164
|
+
};
|
|
165
|
+
return {
|
|
166
|
+
text: `Successfully zoomed to ${c} feature(s) in ${o.title} matching: ${a}`,
|
|
167
|
+
where: a,
|
|
168
|
+
sharedStatePatch: { lastNavigatedFeatures: { value: u } }
|
|
169
|
+
};
|
|
170
|
+
} catch (s) {
|
|
171
|
+
return console.error("Error in goToFeatures:", s), { text: `Error: ${s instanceof Error ? s.message : "Unknown error"}`, where: a };
|
|
162
172
|
}
|
|
163
173
|
}
|
|
164
|
-
async function
|
|
174
|
+
async function Rt({ layerId: e, where: t }, r) {
|
|
165
175
|
const { mapView: o } = $(r);
|
|
166
|
-
return await
|
|
176
|
+
return await xt(e, t, o);
|
|
167
177
|
}
|
|
168
|
-
const
|
|
178
|
+
const $t = C.object({
|
|
169
179
|
layerId: C.string().describe("The layerId of the layer to zoom to."),
|
|
170
180
|
where: C.string().describe("The sql-92 where clause used to query features to zoom to")
|
|
171
|
-
}),
|
|
181
|
+
}), Rn = f(Rt, {
|
|
172
182
|
name: "goToFeatures",
|
|
173
183
|
description: "Go to the features that match the given filter related to the given layerId.",
|
|
174
|
-
schema:
|
|
184
|
+
schema: $t
|
|
175
185
|
});
|
|
176
|
-
async function
|
|
177
|
-
const r = new
|
|
186
|
+
async function Et(e) {
|
|
187
|
+
const r = new je({
|
|
178
188
|
xmin: -180,
|
|
179
189
|
ymin: -90,
|
|
180
190
|
xmax: 180,
|
|
@@ -183,14 +193,14 @@ async function $t(e) {
|
|
|
183
193
|
}).expand(0.7);
|
|
184
194
|
return await e.goTo(r), { text: "Successfully zoomed to world extent" };
|
|
185
195
|
}
|
|
186
|
-
async function
|
|
196
|
+
async function Ct(e, t) {
|
|
187
197
|
const { mapView: r } = $(t);
|
|
188
|
-
return await
|
|
198
|
+
return await Et(r);
|
|
189
199
|
}
|
|
190
|
-
const
|
|
200
|
+
const Ft = C.object({}), $n = f(Ct, {
|
|
191
201
|
name: "goToFullExtent",
|
|
192
202
|
description: "Zooms the map to the full world extent using Esri's Geocoding Service.",
|
|
193
|
-
schema:
|
|
203
|
+
schema: Ft
|
|
194
204
|
});
|
|
195
205
|
async function It(e) {
|
|
196
206
|
const r = e.map.initialViewProperties?.viewpoint?.targetGeometry;
|
|
@@ -204,12 +214,12 @@ async function kt(e, t) {
|
|
|
204
214
|
const { mapView: r } = $(t);
|
|
205
215
|
return await It(r);
|
|
206
216
|
}
|
|
207
|
-
const
|
|
217
|
+
const Nt = i.object({}), En = f(kt, {
|
|
208
218
|
name: "goToHomeExtent",
|
|
209
219
|
description: "Go to the initial web map view extent",
|
|
210
|
-
schema:
|
|
220
|
+
schema: Nt
|
|
211
221
|
});
|
|
212
|
-
async function
|
|
222
|
+
async function zt(e, t) {
|
|
213
223
|
await t.when();
|
|
214
224
|
const r = t.map?.allLayers.find((a) => a.id === e);
|
|
215
225
|
if (!r)
|
|
@@ -217,34 +227,34 @@ async function Nt(e, t) {
|
|
|
217
227
|
let o;
|
|
218
228
|
return (r.type === "link-chart" || r.type === "knowledge-graph-sublayer") && t.map?.activeLinkChartLayer ? o = t.map.diagramNodesExtent : o = r.fullExtent, o ? (await t.goTo(o), r.visible = !0, { text: `Successfully zoomed to: ${r.title ?? ""}` }) : { text: "Layer has no defined extent. Cannot zoom to layer." };
|
|
219
229
|
}
|
|
220
|
-
async function
|
|
230
|
+
async function qt({ layerId: e }, t) {
|
|
221
231
|
const { mapView: r } = $(t);
|
|
222
|
-
return await
|
|
232
|
+
return await zt(e, r);
|
|
223
233
|
}
|
|
224
|
-
const
|
|
234
|
+
const Dt = C.object({
|
|
225
235
|
layerId: C.string().describe("The id of the layer to navigate to")
|
|
226
|
-
}),
|
|
236
|
+
}), Cn = f(qt, {
|
|
227
237
|
name: "goToLayer",
|
|
228
238
|
description: "Zooms the map view to the full extent of the top matching layer.",
|
|
229
|
-
schema:
|
|
239
|
+
schema: Dt
|
|
230
240
|
});
|
|
231
|
-
async function
|
|
241
|
+
async function At(e, t) {
|
|
232
242
|
return await t.goTo({ scale: e }), { text: `Successfully zoomed to: ${e}` };
|
|
233
243
|
}
|
|
234
|
-
async function
|
|
244
|
+
async function Lt({ scale: e }, t) {
|
|
235
245
|
const { mapView: r } = $(t);
|
|
236
|
-
return await
|
|
246
|
+
return await At(e, r);
|
|
237
247
|
}
|
|
238
|
-
const
|
|
248
|
+
const Pt = i.object({
|
|
239
249
|
scale: i.number().describe("The map scale of the view to go to.")
|
|
240
|
-
}),
|
|
250
|
+
}), Fn = f(Lt, {
|
|
241
251
|
name: "goToScale",
|
|
242
252
|
description: "Go to the specified view scale.",
|
|
243
|
-
schema:
|
|
253
|
+
schema: Pt
|
|
244
254
|
});
|
|
245
|
-
async function
|
|
255
|
+
async function jt(e, t, r) {
|
|
246
256
|
const a = {
|
|
247
|
-
target: new
|
|
257
|
+
target: new fe({
|
|
248
258
|
longitude: e.longitude,
|
|
249
259
|
latitude: e.latitude,
|
|
250
260
|
spatialReference: { wkid: 4326 }
|
|
@@ -256,39 +266,39 @@ async function Pt(e, t, r) {
|
|
|
256
266
|
r?.scale !== void 0 ? `scale 1:${r.scale}` : ""
|
|
257
267
|
].filter(Boolean).join(", ")}` };
|
|
258
268
|
}
|
|
259
|
-
async function
|
|
269
|
+
async function Gt({
|
|
260
270
|
center: e,
|
|
261
271
|
zoom: t,
|
|
262
272
|
scale: r
|
|
263
273
|
}, o) {
|
|
264
274
|
const { mapView: a } = $(o);
|
|
265
|
-
return await
|
|
275
|
+
return await jt(e, a, { zoom: t, scale: r });
|
|
266
276
|
}
|
|
267
|
-
const
|
|
277
|
+
const Ot = i.object({
|
|
268
278
|
center: i.object({
|
|
269
279
|
longitude: i.number().describe("The longitude (x-coordinate) of the point to navigate to."),
|
|
270
280
|
latitude: i.number().describe("The latitude (y-coordinate) of the point to navigate to.")
|
|
271
281
|
}),
|
|
272
282
|
zoom: i.number().optional().describe("The zoom level. Higher values = more zoomed in."),
|
|
273
283
|
scale: i.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
|
|
274
|
-
}), In = f(
|
|
284
|
+
}), In = f(Gt, {
|
|
275
285
|
name: "goToViewpoint",
|
|
276
286
|
description: "Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",
|
|
277
|
-
schema:
|
|
287
|
+
schema: Ot
|
|
278
288
|
});
|
|
279
|
-
async function
|
|
289
|
+
async function Mt(e, t) {
|
|
280
290
|
return await t.goTo({ zoom: e }), { text: `Successfully zoomed to: ${e}` };
|
|
281
291
|
}
|
|
282
|
-
async function
|
|
292
|
+
async function Qt({ zoom: e }, t) {
|
|
283
293
|
const { mapView: r } = $(t);
|
|
284
|
-
return await
|
|
294
|
+
return await Mt(e, r);
|
|
285
295
|
}
|
|
286
|
-
const
|
|
296
|
+
const _t = i.object({
|
|
287
297
|
zoom: i.number().min(1).max(20).describe("The zoom level of the view to go to.")
|
|
288
|
-
}), kn = f(
|
|
298
|
+
}), kn = f(Qt, {
|
|
289
299
|
name: "goToZoom",
|
|
290
300
|
description: 'Go to the specified zoom level. If input is generic (e.g. "zoom in", then only zoom to the next appropriate level - increase level for zooming in and decrease for zooming out.).',
|
|
291
|
-
schema:
|
|
301
|
+
schema: _t
|
|
292
302
|
}), he = /* @__PURE__ */ Object.assign({
|
|
293
303
|
"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md": () => import("./arcgis_knowledge_current_lc_context.js").then((e) => e.default),
|
|
294
304
|
"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md": () => import("./arcgis_knowledge_current_map_context.js").then((e) => e.default),
|
|
@@ -312,30 +322,30 @@ ${Object.keys(he).join(`
|
|
|
312
322
|
`)}`);
|
|
313
323
|
return await t[1]();
|
|
314
324
|
}
|
|
315
|
-
const
|
|
325
|
+
const Wt = (e, t = 300) => {
|
|
316
326
|
const r = e.replace(/\s+/gu, " ").replace(/[*_`#>\-]/gu, "").trim();
|
|
317
327
|
return r.length > t ? `${r.slice(0, t)}...` : r;
|
|
318
|
-
},
|
|
328
|
+
}, be = (e, t) => {
|
|
319
329
|
const o = e?.configurable?.services?.[t];
|
|
320
330
|
if (o == null)
|
|
321
331
|
throw new Error(`${t} missing in config.configurable.services`);
|
|
322
332
|
return o;
|
|
323
|
-
},
|
|
333
|
+
}, Nn = (e, t) => (r, o) => {
|
|
324
334
|
const a = o?.configurable?.services;
|
|
325
335
|
for (const n of e)
|
|
326
336
|
if (!a?.[n])
|
|
327
337
|
throw new Error(`${t} requires services.${n} to be available.`);
|
|
328
338
|
return r;
|
|
329
339
|
};
|
|
330
|
-
async function
|
|
340
|
+
async function Vt(e) {
|
|
331
341
|
const { fields: t, layer: r, view: o, styleName: a, colorSchemeTags: n } = e;
|
|
332
342
|
let s;
|
|
333
|
-
return n ? s =
|
|
343
|
+
return n ? s = Oe({
|
|
334
344
|
basemapTheme: await ue(o),
|
|
335
345
|
geometryType: r.geometryType,
|
|
336
346
|
includedTags: n,
|
|
337
347
|
numColors: Math.min(t.length, 8)
|
|
338
|
-
})[0] : s =
|
|
348
|
+
})[0] : s = Me({
|
|
339
349
|
basemapTheme: await ue(o),
|
|
340
350
|
geometryType: r.geometryType,
|
|
341
351
|
numColors: Math.min(t.length, 8)
|
|
@@ -352,10 +362,10 @@ async function Wt(e) {
|
|
|
352
362
|
pieChartScheme: s
|
|
353
363
|
};
|
|
354
364
|
}
|
|
355
|
-
async function
|
|
356
|
-
return await
|
|
365
|
+
async function Ut(e) {
|
|
366
|
+
return await Ge(e);
|
|
357
367
|
}
|
|
358
|
-
async function
|
|
368
|
+
async function Kt({
|
|
359
369
|
arcgisMap: e,
|
|
360
370
|
arcgisMapView: t,
|
|
361
371
|
layerId: r,
|
|
@@ -374,30 +384,30 @@ async function Ut({
|
|
|
374
384
|
colorSchemeTags: a
|
|
375
385
|
};
|
|
376
386
|
try {
|
|
377
|
-
const d = await
|
|
387
|
+
const d = await Vt(l), p = await Ut(d);
|
|
378
388
|
return c.renderer = p.renderer, c.visible = !0, `Chart renderer applied to layer: ${c.title ?? c.id} using fields ${o.join(", ")}`;
|
|
379
389
|
} catch (d) {
|
|
380
390
|
return `Error applying chart renderer: ${d instanceof Error ? d.message : String(d)}`;
|
|
381
391
|
}
|
|
382
392
|
}
|
|
383
|
-
const
|
|
393
|
+
const Bt = ["mapView"];
|
|
384
394
|
function R(e) {
|
|
385
395
|
const r = e?.configurable?.context;
|
|
386
396
|
if (!r || typeof r != "object")
|
|
387
397
|
throw new Error("LayerStylingAgent context missing");
|
|
388
|
-
const o =
|
|
398
|
+
const o = Bt.filter((a) => !(a in r));
|
|
389
399
|
if (o.length)
|
|
390
400
|
throw new Error(`LayerStylingAgent context missing: ${o.join(", ")}`);
|
|
391
401
|
return r;
|
|
392
402
|
}
|
|
393
|
-
async function
|
|
403
|
+
async function Ht({
|
|
394
404
|
layerId: e,
|
|
395
405
|
fields: t,
|
|
396
406
|
colorSchemes: r,
|
|
397
407
|
includeSize: o
|
|
398
408
|
}, a) {
|
|
399
409
|
const { mapView: n } = R(a);
|
|
400
|
-
return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await
|
|
410
|
+
return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Kt({
|
|
401
411
|
arcgisMap: n.map,
|
|
402
412
|
arcgisMapView: n,
|
|
403
413
|
layerId: e,
|
|
@@ -406,12 +416,12 @@ async function Bt({
|
|
|
406
416
|
includeSize: o
|
|
407
417
|
});
|
|
408
418
|
}
|
|
409
|
-
const
|
|
419
|
+
const Jt = i.object({
|
|
410
420
|
layerId: i.string().describe("The id of the layer to apply the chart renderer to"),
|
|
411
421
|
fields: i.array(i.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),
|
|
412
422
|
colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
|
|
413
423
|
includeSize: i.boolean().optional().describe("Whether to vary the chart size (chart-size)")
|
|
414
|
-
}),
|
|
424
|
+
}), zn = f(Ht, {
|
|
415
425
|
name: "chart",
|
|
416
426
|
description: `Label: Charts
|
|
417
427
|
Description: Show the values of two or more categories as a proportion of the total using a pie chart.
|
|
@@ -424,9 +434,9 @@ const Ht = i.object({
|
|
|
424
434
|
Keywords: pie, chart, all categories, breakdown, proportion, total, amount, how much, sum, graduated size, proportional size
|
|
425
435
|
Example: Show the total number of homes built in each decade using a pie chart for each feature and vary the size of each chart based on the total of all categories.
|
|
426
436
|
Fields: This style requires 2-8 number fields.`,
|
|
427
|
-
schema:
|
|
437
|
+
schema: Jt
|
|
428
438
|
});
|
|
429
|
-
function
|
|
439
|
+
function Zt(e) {
|
|
430
440
|
const { fields: t, layer: r, view: o, theme: a, colorSchemeTags: n } = e, s = t[0];
|
|
431
441
|
let c;
|
|
432
442
|
return n && (c = re({
|
|
@@ -444,10 +454,10 @@ function Jt(e) {
|
|
|
444
454
|
colorScheme: c
|
|
445
455
|
};
|
|
446
456
|
}
|
|
447
|
-
async function
|
|
448
|
-
return await
|
|
457
|
+
async function Yt(e) {
|
|
458
|
+
return await Qe(e);
|
|
449
459
|
}
|
|
450
|
-
async function
|
|
460
|
+
async function Xt({
|
|
451
461
|
arcgisMap: e,
|
|
452
462
|
arcgisMapView: t,
|
|
453
463
|
layerId: r,
|
|
@@ -467,20 +477,20 @@ async function Yt({
|
|
|
467
477
|
theme: n
|
|
468
478
|
};
|
|
469
479
|
try {
|
|
470
|
-
const l =
|
|
480
|
+
const l = Zt(u), d = await Yt(l);
|
|
471
481
|
return c.renderer = d.renderer, c.visible = !0, `Color-age renderer applied to layer: ${c.title ?? c.id} using fields ${o.join(", ")}`;
|
|
472
482
|
} catch (l) {
|
|
473
483
|
return `Error applying color-age renderer: ${l instanceof Error ? l.message : String(l)}`;
|
|
474
484
|
}
|
|
475
485
|
}
|
|
476
|
-
async function
|
|
486
|
+
async function er({
|
|
477
487
|
layerId: e,
|
|
478
488
|
fields: t,
|
|
479
489
|
colorSchemes: r,
|
|
480
490
|
theme: o
|
|
481
491
|
}, a) {
|
|
482
492
|
const { mapView: n } = R(a);
|
|
483
|
-
return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await
|
|
493
|
+
return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Xt({
|
|
484
494
|
arcgisMap: n.map,
|
|
485
495
|
arcgisMapView: n,
|
|
486
496
|
layerId: e,
|
|
@@ -489,21 +499,21 @@ async function Xt({
|
|
|
489
499
|
theme: o
|
|
490
500
|
});
|
|
491
501
|
}
|
|
492
|
-
const
|
|
502
|
+
const tr = i.object({
|
|
493
503
|
layerId: i.string().describe("The id of the layer to apply the color-age renderer to"),
|
|
494
504
|
fields: i.array(i.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),
|
|
495
505
|
colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
|
|
496
506
|
theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
|
|
497
|
-
}),
|
|
507
|
+
}), qn = f(er, {
|
|
498
508
|
name: "color-age",
|
|
499
509
|
description: `Label: Age (color)
|
|
500
510
|
Description: Use colors along a continuous color ramp to represent the age of features. Age reflects the length of time from a start date to an end date.
|
|
501
511
|
Keywords: since, age, how old, how long
|
|
502
512
|
Example: Show the age of each feature based on its reported date.
|
|
503
513
|
Fields: This style requires at least one field with a date type.`,
|
|
504
|
-
schema:
|
|
514
|
+
schema: tr
|
|
505
515
|
});
|
|
506
|
-
function
|
|
516
|
+
function rr(e) {
|
|
507
517
|
const { fields: t, layer: r, view: o, colorSchemeTags: a } = e;
|
|
508
518
|
let { theme: n } = e, s = t[1];
|
|
509
519
|
const c = t[0];
|
|
@@ -523,10 +533,10 @@ function tr(e) {
|
|
|
523
533
|
colorScheme: u
|
|
524
534
|
};
|
|
525
535
|
}
|
|
526
|
-
async function
|
|
527
|
-
return await
|
|
536
|
+
async function or(e) {
|
|
537
|
+
return await _e(e);
|
|
528
538
|
}
|
|
529
|
-
async function
|
|
539
|
+
async function ar({
|
|
530
540
|
arcgisMap: e,
|
|
531
541
|
arcgisMapView: t,
|
|
532
542
|
layerId: r,
|
|
@@ -546,20 +556,20 @@ async function or({
|
|
|
546
556
|
theme: n
|
|
547
557
|
};
|
|
548
558
|
try {
|
|
549
|
-
const l =
|
|
559
|
+
const l = rr(u), d = await or(l);
|
|
550
560
|
return c.renderer = d.renderer, c.visible = !0, `Color renderer applied to layer: ${c.title ?? c.id} using fields ${o.join(", ")}`;
|
|
551
561
|
} catch (l) {
|
|
552
562
|
return `Error applying color renderer: ${l instanceof Error ? l.message : String(l)}`;
|
|
553
563
|
}
|
|
554
564
|
}
|
|
555
|
-
async function
|
|
565
|
+
async function nr({
|
|
556
566
|
layerId: e,
|
|
557
567
|
fields: t,
|
|
558
568
|
colorSchemes: r,
|
|
559
569
|
theme: o
|
|
560
570
|
}, a) {
|
|
561
571
|
const { mapView: n } = R(a);
|
|
562
|
-
return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await
|
|
572
|
+
return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await ar({
|
|
563
573
|
arcgisMap: n.map,
|
|
564
574
|
arcgisMapView: n,
|
|
565
575
|
layerId: e,
|
|
@@ -568,21 +578,21 @@ async function ar({
|
|
|
568
578
|
theme: o
|
|
569
579
|
});
|
|
570
580
|
}
|
|
571
|
-
const
|
|
581
|
+
const ir = i.object({
|
|
572
582
|
layerId: i.string().describe("The id of the layer to apply the color renderer to"),
|
|
573
583
|
fields: i.array(i.string()).describe("The field(s) to use for the color renderer"),
|
|
574
584
|
colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
|
|
575
585
|
theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
|
|
576
|
-
}),
|
|
586
|
+
}), Dn = f(nr, {
|
|
577
587
|
name: "color",
|
|
578
588
|
description: `Label: Counts and Amounts (color)
|
|
579
589
|
Description: Vary color along a continuous color ramp to represent numeric or ranked data.
|
|
580
590
|
Keywords: graduated color, choropleth, continuous color, hue, color, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease
|
|
581
591
|
Example: Color each feature based on the population density.
|
|
582
592
|
Fields: This style requires a single field with a number type. A second number field may be specified for normalizing the value of the first field.`,
|
|
583
|
-
schema:
|
|
593
|
+
schema: ir
|
|
584
594
|
});
|
|
585
|
-
function
|
|
595
|
+
function sr(e) {
|
|
586
596
|
const { fields: t, layer: r, view: o, colorSchemeTags: a, theme: n } = e;
|
|
587
597
|
let s, c;
|
|
588
598
|
const u = t[0];
|
|
@@ -601,10 +611,10 @@ function ir(e) {
|
|
|
601
611
|
}
|
|
602
612
|
};
|
|
603
613
|
}
|
|
604
|
-
async function
|
|
605
|
-
return await
|
|
614
|
+
async function cr(e) {
|
|
615
|
+
return await We(e);
|
|
606
616
|
}
|
|
607
|
-
async function
|
|
617
|
+
async function lr({
|
|
608
618
|
arcgisMap: e,
|
|
609
619
|
arcgisMapView: t,
|
|
610
620
|
layerId: r,
|
|
@@ -624,20 +634,20 @@ async function cr({
|
|
|
624
634
|
theme: n
|
|
625
635
|
};
|
|
626
636
|
try {
|
|
627
|
-
const l =
|
|
637
|
+
const l = sr(u), d = await cr(l);
|
|
628
638
|
return c.renderer = d.renderer, c.visible = !0, `Color-size-univariate renderer applied to layer: ${c.title ?? c.id} using fields ${o.join(", ")}`;
|
|
629
639
|
} catch (l) {
|
|
630
640
|
return `Error applying color-size-univariate renderer: ${l instanceof Error ? l.message : String(l)}`;
|
|
631
641
|
}
|
|
632
642
|
}
|
|
633
|
-
async function
|
|
643
|
+
async function ur({
|
|
634
644
|
layerId: e,
|
|
635
645
|
fields: t,
|
|
636
646
|
colorSchemes: r,
|
|
637
647
|
theme: o
|
|
638
648
|
}, a) {
|
|
639
649
|
const { mapView: n } = R(a);
|
|
640
|
-
return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await
|
|
650
|
+
return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await lr({
|
|
641
651
|
arcgisMap: n.map,
|
|
642
652
|
arcgisMapView: n,
|
|
643
653
|
layerId: e,
|
|
@@ -646,24 +656,24 @@ async function lr({
|
|
|
646
656
|
theme: o
|
|
647
657
|
});
|
|
648
658
|
}
|
|
649
|
-
const
|
|
659
|
+
const dr = i.object({
|
|
650
660
|
layerId: i.string().describe("The id of the layer to apply the color-size univariate renderer to"),
|
|
651
661
|
fields: i.array(i.string()).describe("The fields to use for the color-size univariate renderer"),
|
|
652
662
|
colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
|
|
653
663
|
theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color and size ramps")
|
|
654
|
-
}),
|
|
664
|
+
}), An = f(ur, {
|
|
655
665
|
name: "color-size-univariate",
|
|
656
666
|
description: `Label: Color and Size (univariate)
|
|
657
667
|
Description: Vary symbol size and color based on the values of two numeric attributes.
|
|
658
668
|
Keywords: continuous color, hue, color, size, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease, amount
|
|
659
669
|
Example: Color each feature based on the percentage of the population that owns a home and vary the size of each point based on total population.
|
|
660
670
|
Fields: This style requires at least two fields: one determining the color of each feature, the other determining the size of each feature. Each field may be normalized by an additional normalization field.`,
|
|
661
|
-
schema:
|
|
671
|
+
schema: dr
|
|
662
672
|
});
|
|
663
|
-
function
|
|
673
|
+
function pr(e) {
|
|
664
674
|
const { fields: t, layer: r, view: o, colorSchemeTags: a } = e;
|
|
665
675
|
let n;
|
|
666
|
-
return a && (n =
|
|
676
|
+
return a && (n = Ue({
|
|
667
677
|
includedTags: a,
|
|
668
678
|
numColors: Math.min(t.length, 8)
|
|
669
679
|
})[0]), {
|
|
@@ -680,10 +690,10 @@ function dr(e) {
|
|
|
680
690
|
dotDensityScheme: n
|
|
681
691
|
};
|
|
682
692
|
}
|
|
683
|
-
async function
|
|
684
|
-
return await
|
|
693
|
+
async function hr(e) {
|
|
694
|
+
return await Ve(e);
|
|
685
695
|
}
|
|
686
|
-
async function
|
|
696
|
+
async function mr({
|
|
687
697
|
arcgisMap: e,
|
|
688
698
|
arcgisMapView: t,
|
|
689
699
|
layerId: r,
|
|
@@ -701,19 +711,19 @@ async function hr({
|
|
|
701
711
|
colorSchemeTags: a
|
|
702
712
|
};
|
|
703
713
|
try {
|
|
704
|
-
const u =
|
|
714
|
+
const u = pr(c), l = await hr(u);
|
|
705
715
|
return s.renderer = l.renderer, s.visible = !0, `Dot Density renderer applied to layer: ${s.title ?? s.id} using fields ${o.join(", ")}`;
|
|
706
716
|
} catch (u) {
|
|
707
717
|
return `Error applying dot density renderer: ${u instanceof Error ? u.message : String(u)}`;
|
|
708
718
|
}
|
|
709
719
|
}
|
|
710
|
-
async function
|
|
720
|
+
async function yr({
|
|
711
721
|
layerId: e,
|
|
712
722
|
fields: t,
|
|
713
723
|
colorSchemes: r
|
|
714
724
|
}, o) {
|
|
715
725
|
const { mapView: a } = R(o);
|
|
716
|
-
return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await
|
|
726
|
+
return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await mr({
|
|
717
727
|
arcgisMap: a.map,
|
|
718
728
|
arcgisMapView: a,
|
|
719
729
|
layerId: e,
|
|
@@ -721,11 +731,11 @@ async function mr({
|
|
|
721
731
|
colorSchemes: r
|
|
722
732
|
});
|
|
723
733
|
}
|
|
724
|
-
const
|
|
734
|
+
const fr = i.object({
|
|
725
735
|
layerId: i.string().describe("The id of the layer to apply the dot density renderer to"),
|
|
726
736
|
fields: i.array(i.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),
|
|
727
737
|
colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
|
|
728
|
-
}),
|
|
738
|
+
}), Ln = f(yr, {
|
|
729
739
|
name: "dot-density",
|
|
730
740
|
description: `Dot Density
|
|
731
741
|
Use dot density to visualize the distribution of one attribute or compare the density of multiple attributes. This is only valid for polygon layers.
|
|
@@ -739,13 +749,13 @@ const yr = i.object({
|
|
|
739
749
|
- Display demographic patterns within census tracts
|
|
740
750
|
**Fields:** Requires 2-8 number fields.
|
|
741
751
|
**Keywords:** density, how much, how many, total, number, amount`,
|
|
742
|
-
schema:
|
|
752
|
+
schema: fr
|
|
743
753
|
});
|
|
744
|
-
function
|
|
754
|
+
function gr(e) {
|
|
745
755
|
const { fields: t, layer: r, view: o, colorSchemeTags: a } = e;
|
|
746
756
|
let n;
|
|
747
757
|
const s = t[0];
|
|
748
|
-
return a && (n =
|
|
758
|
+
return a && (n = Be({
|
|
749
759
|
includedTags: a,
|
|
750
760
|
basemap: o.map?.basemap || "topo"
|
|
751
761
|
})[0]), {
|
|
@@ -755,10 +765,10 @@ function fr(e) {
|
|
|
755
765
|
heatmapScheme: n
|
|
756
766
|
};
|
|
757
767
|
}
|
|
758
|
-
async function
|
|
759
|
-
return await
|
|
768
|
+
async function wr(e) {
|
|
769
|
+
return await Ke(e);
|
|
760
770
|
}
|
|
761
|
-
async function
|
|
771
|
+
async function br({
|
|
762
772
|
arcgisMap: e,
|
|
763
773
|
arcgisMapView: t,
|
|
764
774
|
layerId: r,
|
|
@@ -776,19 +786,19 @@ async function wr({
|
|
|
776
786
|
colorSchemeTags: a
|
|
777
787
|
};
|
|
778
788
|
try {
|
|
779
|
-
const u =
|
|
789
|
+
const u = gr(c), l = await wr(u);
|
|
780
790
|
return s.renderer = l.renderer, s.visible = !0, `Heatmap renderer applied to layer: ${s.title ?? s.id} using fields ${o.join(", ")}`;
|
|
781
791
|
} catch (u) {
|
|
782
792
|
return `Error applying heatmap renderer: ${u instanceof Error ? u.message : String(u)}`;
|
|
783
793
|
}
|
|
784
794
|
}
|
|
785
|
-
async function
|
|
795
|
+
async function Tr({
|
|
786
796
|
layerId: e,
|
|
787
797
|
fields: t,
|
|
788
798
|
colorSchemes: r
|
|
789
799
|
}, o) {
|
|
790
800
|
const { mapView: a } = R(o);
|
|
791
|
-
return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await
|
|
801
|
+
return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await br({
|
|
792
802
|
arcgisMap: a.map,
|
|
793
803
|
arcgisMapView: a,
|
|
794
804
|
layerId: e,
|
|
@@ -796,23 +806,23 @@ async function br({
|
|
|
796
806
|
colorSchemes: r
|
|
797
807
|
});
|
|
798
808
|
}
|
|
799
|
-
const
|
|
809
|
+
const vr = i.object({
|
|
800
810
|
layerId: i.string().describe("The id of the layer to apply the heatmap renderer to"),
|
|
801
811
|
fields: i.array(i.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),
|
|
802
812
|
colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
|
|
803
|
-
}),
|
|
813
|
+
}), Pn = f(Tr, {
|
|
804
814
|
name: "heatmap",
|
|
805
815
|
description: `Label: Heat Map
|
|
806
816
|
Description: Show areas of high density with colors that appear to glow hotter. This is only valid for point layers.
|
|
807
817
|
Keywords: density, heatmap, hot spots, pattern, cluster
|
|
808
818
|
Example: Create a heatmap
|
|
809
819
|
Fields: This typically requires zero or one field of type number.`,
|
|
810
|
-
schema:
|
|
820
|
+
schema: vr
|
|
811
821
|
});
|
|
812
822
|
function Sr(e) {
|
|
813
823
|
const { fields: t, layer: r, view: o, styleName: a, colorSchemeTags: n } = e;
|
|
814
824
|
let s;
|
|
815
|
-
return n && (s =
|
|
825
|
+
return n && (s = Je({
|
|
816
826
|
geometryType: r.geometryType,
|
|
817
827
|
includedTags: n,
|
|
818
828
|
numColors: Math.min(t.length, 10)
|
|
@@ -826,10 +836,10 @@ function Sr(e) {
|
|
|
826
836
|
predominanceScheme: s
|
|
827
837
|
};
|
|
828
838
|
}
|
|
829
|
-
async function
|
|
830
|
-
return await
|
|
839
|
+
async function xr(e) {
|
|
840
|
+
return await He(e);
|
|
831
841
|
}
|
|
832
|
-
async function
|
|
842
|
+
async function Rr({
|
|
833
843
|
arcgisMap: e,
|
|
834
844
|
arcgisMapView: t,
|
|
835
845
|
layerId: r,
|
|
@@ -848,20 +858,20 @@ async function xr({
|
|
|
848
858
|
colorSchemeTags: a
|
|
849
859
|
};
|
|
850
860
|
try {
|
|
851
|
-
const d = Sr(l), p = await
|
|
861
|
+
const d = Sr(l), p = await xr(d);
|
|
852
862
|
return c.renderer = p.renderer, c.visible = !0, `Predominance renderer applied to layer: ${c.title ?? c.id} using fields ${o.join(", ")}`;
|
|
853
863
|
} catch (d) {
|
|
854
864
|
return `Error applying predominance renderer: ${d instanceof Error ? d.message : String(d)}`;
|
|
855
865
|
}
|
|
856
866
|
}
|
|
857
|
-
async function
|
|
867
|
+
async function $r({
|
|
858
868
|
layerId: e,
|
|
859
869
|
fields: t,
|
|
860
870
|
colorSchemes: r,
|
|
861
871
|
includeSize: o
|
|
862
872
|
}, a) {
|
|
863
873
|
const { mapView: n } = R(a);
|
|
864
|
-
return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await
|
|
874
|
+
return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Rr({
|
|
865
875
|
arcgisMap: n.map,
|
|
866
876
|
arcgisMapView: n,
|
|
867
877
|
layerId: e,
|
|
@@ -870,12 +880,12 @@ async function Rr({
|
|
|
870
880
|
includeSize: o
|
|
871
881
|
});
|
|
872
882
|
}
|
|
873
|
-
const
|
|
883
|
+
const Er = i.object({
|
|
874
884
|
layerId: i.string().describe("The id of the layer to apply the predominance renderer to"),
|
|
875
885
|
fields: i.array(i.string()).describe("The fields to use for the predominance renderer (competing categories)"),
|
|
876
886
|
colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
|
|
877
887
|
includeSize: i.boolean().optional().describe("Whether to include size visualization (predominance-size)")
|
|
878
|
-
}),
|
|
888
|
+
}), jn = f($r, {
|
|
879
889
|
name: "predominance",
|
|
880
890
|
description: `Label: Predominant category
|
|
881
891
|
Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
|
|
@@ -888,9 +898,9 @@ const $r = i.object({
|
|
|
888
898
|
Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top, amount, total, how much, proportional size, graduated size, sum
|
|
889
899
|
Example: Show the predominant crop in each area and vary the size of each symbol based on the total of all categories.
|
|
890
900
|
Fields: This style relies on 2-10 number fields.`,
|
|
891
|
-
schema:
|
|
901
|
+
schema: Er
|
|
892
902
|
});
|
|
893
|
-
function
|
|
903
|
+
function Cr(e) {
|
|
894
904
|
const { fields: t, layer: r, view: o, colorSchemeTags: a } = e;
|
|
895
905
|
let n;
|
|
896
906
|
const s = {
|
|
@@ -898,7 +908,7 @@ function Er(e) {
|
|
|
898
908
|
}, c = {
|
|
899
909
|
field: t[1]
|
|
900
910
|
};
|
|
901
|
-
return a && (n =
|
|
911
|
+
return a && (n = Ye({
|
|
902
912
|
geometryType: r.geometryType,
|
|
903
913
|
includedTags: a
|
|
904
914
|
})[0]), {
|
|
@@ -911,8 +921,8 @@ function Er(e) {
|
|
|
911
921
|
relationshipScheme: n
|
|
912
922
|
};
|
|
913
923
|
}
|
|
914
|
-
async function
|
|
915
|
-
return await
|
|
924
|
+
async function Fr(e) {
|
|
925
|
+
return await Ze(e);
|
|
916
926
|
}
|
|
917
927
|
async function Ir({
|
|
918
928
|
arcgisMap: e,
|
|
@@ -932,7 +942,7 @@ async function Ir({
|
|
|
932
942
|
colorSchemeTags: a
|
|
933
943
|
};
|
|
934
944
|
try {
|
|
935
|
-
const u =
|
|
945
|
+
const u = Cr(c), l = await Fr(u);
|
|
936
946
|
return s.renderer = l.renderer, s.visible = !0, `Relationship renderer applied to layer: ${s.title ?? s.id} using fields ${o.join(", ")}`;
|
|
937
947
|
} catch (u) {
|
|
938
948
|
return `Error applying relationship renderer: ${u instanceof Error ? u.message : String(u)}`;
|
|
@@ -952,20 +962,20 @@ async function kr({
|
|
|
952
962
|
colorSchemes: r
|
|
953
963
|
});
|
|
954
964
|
}
|
|
955
|
-
const
|
|
965
|
+
const Nr = i.object({
|
|
956
966
|
layerId: i.string().describe("The id of the layer to apply the relationship renderer to"),
|
|
957
967
|
fields: i.array(i.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),
|
|
958
968
|
colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
|
|
959
|
-
}),
|
|
969
|
+
}), Gn = f(kr, {
|
|
960
970
|
name: "relationship",
|
|
961
971
|
description: `Label: Relationship
|
|
962
972
|
Description: Overlays two color ramps to represent the relationship between two numeric attributes.
|
|
963
973
|
Keywords: relationship, correlation, compare, related, bivariate choropleth, bivariate color
|
|
964
974
|
Example: Show the relationship between tree height and carbon storage
|
|
965
975
|
Fields: This style requires two number fields.`,
|
|
966
|
-
schema:
|
|
976
|
+
schema: Nr
|
|
967
977
|
});
|
|
968
|
-
function
|
|
978
|
+
function zr(e) {
|
|
969
979
|
const { fields: t, layer: r, view: o, theme: a } = e, n = t[0];
|
|
970
980
|
return {
|
|
971
981
|
layer: r,
|
|
@@ -977,10 +987,10 @@ function Nr(e) {
|
|
|
977
987
|
outlineOptimizationEnabled: !0
|
|
978
988
|
};
|
|
979
989
|
}
|
|
980
|
-
async function
|
|
981
|
-
return await
|
|
990
|
+
async function qr(e) {
|
|
991
|
+
return await Xe(e);
|
|
982
992
|
}
|
|
983
|
-
async function
|
|
993
|
+
async function Dr({
|
|
984
994
|
arcgisMap: e,
|
|
985
995
|
arcgisMapView: t,
|
|
986
996
|
layerId: r,
|
|
@@ -1000,20 +1010,20 @@ async function qr({
|
|
|
1000
1010
|
theme: n
|
|
1001
1011
|
};
|
|
1002
1012
|
try {
|
|
1003
|
-
const l =
|
|
1013
|
+
const l = zr(u), d = await qr(l);
|
|
1004
1014
|
return c.renderer = d.renderer, c.visible = !0, `Size-age renderer applied to layer: ${c.title ?? c.id} using fields ${o.join(", ")}`;
|
|
1005
1015
|
} catch (l) {
|
|
1006
1016
|
return `Error applying size-age renderer: ${l instanceof Error ? l.message : String(l)}`;
|
|
1007
1017
|
}
|
|
1008
1018
|
}
|
|
1009
|
-
async function
|
|
1019
|
+
async function Ar({
|
|
1010
1020
|
layerId: e,
|
|
1011
1021
|
fields: t,
|
|
1012
1022
|
colorSchemes: r,
|
|
1013
1023
|
theme: o
|
|
1014
1024
|
}, a) {
|
|
1015
1025
|
const { mapView: n } = R(a);
|
|
1016
|
-
return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await
|
|
1026
|
+
return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Dr({
|
|
1017
1027
|
arcgisMap: n.map,
|
|
1018
1028
|
arcgisMapView: n,
|
|
1019
1029
|
layerId: e,
|
|
@@ -1022,21 +1032,21 @@ async function Dr({
|
|
|
1022
1032
|
theme: o
|
|
1023
1033
|
});
|
|
1024
1034
|
}
|
|
1025
|
-
const
|
|
1035
|
+
const Lr = i.object({
|
|
1026
1036
|
layerId: i.string().describe("The id of the layer to apply the size-age renderer to"),
|
|
1027
1037
|
fields: i.array(i.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),
|
|
1028
1038
|
colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
|
|
1029
1039
|
theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
|
|
1030
|
-
}),
|
|
1040
|
+
}), On = f(Ar, {
|
|
1031
1041
|
name: "size-age",
|
|
1032
1042
|
description: `Label: Age (size)
|
|
1033
1043
|
Description: Vary symbol sizes along a continuous ramp to represent the age of features. Age reflects the length of time from a start date to an end date.
|
|
1034
1044
|
Keywords: since, age, how old, how long
|
|
1035
1045
|
Example: Change the size of features so older features are larger than new features.
|
|
1036
1046
|
Fields: This style requires at least one field with a date type.`,
|
|
1037
|
-
schema:
|
|
1047
|
+
schema: Lr
|
|
1038
1048
|
});
|
|
1039
|
-
function
|
|
1049
|
+
function Pr(e) {
|
|
1040
1050
|
const { fields: t, layer: r, view: o } = e;
|
|
1041
1051
|
let { theme: a } = e, n = t[1];
|
|
1042
1052
|
const s = t[0];
|
|
@@ -1050,10 +1060,10 @@ function Lr(e) {
|
|
|
1050
1060
|
outlineOptimizationEnabled: !0
|
|
1051
1061
|
};
|
|
1052
1062
|
}
|
|
1053
|
-
async function
|
|
1054
|
-
return await
|
|
1063
|
+
async function jr(e) {
|
|
1064
|
+
return await et(e);
|
|
1055
1065
|
}
|
|
1056
|
-
async function
|
|
1066
|
+
async function Gr({
|
|
1057
1067
|
arcgisMap: e,
|
|
1058
1068
|
arcgisMapView: t,
|
|
1059
1069
|
layerId: r,
|
|
@@ -1073,20 +1083,20 @@ async function jr({
|
|
|
1073
1083
|
theme: n
|
|
1074
1084
|
};
|
|
1075
1085
|
try {
|
|
1076
|
-
const l =
|
|
1086
|
+
const l = Pr(u), d = await jr(l);
|
|
1077
1087
|
return c.renderer = d.renderer, c.visible = !0, `Size renderer applied to layer: ${c.title ?? c.id} using fields ${o.join(", ")}`;
|
|
1078
1088
|
} catch (l) {
|
|
1079
1089
|
return `Error applying size renderer: ${l instanceof Error ? l.message : String(l)}`;
|
|
1080
1090
|
}
|
|
1081
1091
|
}
|
|
1082
|
-
async function
|
|
1092
|
+
async function Or({
|
|
1083
1093
|
layerId: e,
|
|
1084
1094
|
fields: t,
|
|
1085
1095
|
colorSchemes: r,
|
|
1086
1096
|
theme: o
|
|
1087
1097
|
}, a) {
|
|
1088
1098
|
const { mapView: n } = R(a);
|
|
1089
|
-
return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await
|
|
1099
|
+
return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Gr({
|
|
1090
1100
|
arcgisMap: n.map,
|
|
1091
1101
|
arcgisMapView: n,
|
|
1092
1102
|
layerId: e,
|
|
@@ -1095,12 +1105,12 @@ async function Gr({
|
|
|
1095
1105
|
theme: o
|
|
1096
1106
|
});
|
|
1097
1107
|
}
|
|
1098
|
-
const
|
|
1108
|
+
const Mr = i.object({
|
|
1099
1109
|
layerId: i.string().describe("The id of the layer to apply the size renderer to"),
|
|
1100
1110
|
fields: i.array(i.string()).describe("The field(s) to use for the size renderer (numeric data)"),
|
|
1101
1111
|
colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
|
|
1102
1112
|
theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
|
|
1103
|
-
}),
|
|
1113
|
+
}), Mn = f(Or, {
|
|
1104
1114
|
name: "size",
|
|
1105
1115
|
description: `Label: Counts and Amounts (size)
|
|
1106
1116
|
Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
|
|
@@ -1113,12 +1123,12 @@ const Or = i.object({
|
|
|
1113
1123
|
Keywords: graduated size, proportional size, classed size, how much, total, number, when
|
|
1114
1124
|
Example: Vary the size of each feature based on the date a ticket was completed.
|
|
1115
1125
|
Fields: This style requires a single field with a date type.`,
|
|
1116
|
-
schema:
|
|
1126
|
+
schema: Mr
|
|
1117
1127
|
});
|
|
1118
|
-
function
|
|
1128
|
+
function Qr(e) {
|
|
1119
1129
|
const { fields: t, layer: r, view: o, colorSchemeTags: a } = e, n = t[0], s = t[1], c = t[2];
|
|
1120
1130
|
let u;
|
|
1121
|
-
return a && (u =
|
|
1131
|
+
return a && (u = rt({
|
|
1122
1132
|
geometryType: r.geometryType,
|
|
1123
1133
|
includedTags: a
|
|
1124
1134
|
})[0]), {
|
|
@@ -1132,10 +1142,10 @@ function Mr(e) {
|
|
|
1132
1142
|
typeScheme: u
|
|
1133
1143
|
};
|
|
1134
1144
|
}
|
|
1135
|
-
async function
|
|
1136
|
-
return await
|
|
1145
|
+
async function _r(e) {
|
|
1146
|
+
return await tt(e);
|
|
1137
1147
|
}
|
|
1138
|
-
async function
|
|
1148
|
+
async function Wr({
|
|
1139
1149
|
arcgisMap: e,
|
|
1140
1150
|
arcgisMapView: t,
|
|
1141
1151
|
layerId: r,
|
|
@@ -1155,20 +1165,20 @@ async function _r({
|
|
|
1155
1165
|
theme: n
|
|
1156
1166
|
};
|
|
1157
1167
|
try {
|
|
1158
|
-
const l =
|
|
1168
|
+
const l = Qr(u), d = await _r(l);
|
|
1159
1169
|
return c.renderer = d.renderer, c.visible = !0, `Type renderer applied to layer: ${c.title ?? c.id} using fields ${o.join(", ")}`;
|
|
1160
1170
|
} catch (l) {
|
|
1161
1171
|
return `Error applying type renderer: ${l instanceof Error ? l.message : String(l)}`;
|
|
1162
1172
|
}
|
|
1163
1173
|
}
|
|
1164
|
-
async function
|
|
1174
|
+
async function Vr({
|
|
1165
1175
|
layerId: e,
|
|
1166
1176
|
fields: t,
|
|
1167
1177
|
colorSchemes: r,
|
|
1168
1178
|
theme: o
|
|
1169
1179
|
}, a) {
|
|
1170
1180
|
const { mapView: n } = R(a);
|
|
1171
|
-
return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await
|
|
1181
|
+
return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Wr({
|
|
1172
1182
|
arcgisMap: n.map,
|
|
1173
1183
|
arcgisMapView: n,
|
|
1174
1184
|
layerId: e,
|
|
@@ -1177,74 +1187,74 @@ async function Wr({
|
|
|
1177
1187
|
theme: o
|
|
1178
1188
|
});
|
|
1179
1189
|
}
|
|
1180
|
-
const
|
|
1190
|
+
const Ur = i.object({
|
|
1181
1191
|
layerId: i.string().describe("The id of the layer to apply the type renderer to"),
|
|
1182
1192
|
fields: i.array(i.string()).describe("The field(s) to use for the type renderer (categorical data)"),
|
|
1183
1193
|
colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
|
|
1184
1194
|
theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color scheme")
|
|
1185
|
-
}),
|
|
1195
|
+
}), Qn = f(Vr, {
|
|
1186
1196
|
name: "type",
|
|
1187
1197
|
description: `Label: Types (unique symbols)
|
|
1188
1198
|
Description: Represent features as categories with different symbol colors or shapes. Examples include type of tree, road class, or province name.
|
|
1189
1199
|
Keywords: categorical, category, type, unique, discrete, point of interest, region, group
|
|
1190
1200
|
Example: Color each feature based on the region it belongs to
|
|
1191
1201
|
Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,
|
|
1192
|
-
schema:
|
|
1193
|
-
}),
|
|
1202
|
+
schema: Ur
|
|
1203
|
+
}), _n = b.Root({
|
|
1194
1204
|
...U(),
|
|
1195
1205
|
vectorSearchLayerIds: b(),
|
|
1196
1206
|
vectorSearchFieldResults: b(),
|
|
1197
1207
|
layerFieldInfo: b(),
|
|
1198
1208
|
selectedLayerId: b()
|
|
1199
|
-
}),
|
|
1209
|
+
}), Wn = b.Root({
|
|
1200
1210
|
...U(),
|
|
1201
1211
|
vectorSearchLayerIds: b(),
|
|
1202
1212
|
vectorSearchFieldResults: b(),
|
|
1203
1213
|
layerFieldInfo: b(),
|
|
1204
1214
|
queryResponse: b(),
|
|
1205
1215
|
dataExplorationMessages: b({
|
|
1206
|
-
reducer:
|
|
1216
|
+
reducer: ye,
|
|
1207
1217
|
default: () => []
|
|
1208
1218
|
})
|
|
1209
|
-
}),
|
|
1219
|
+
}), Kr = ["mapView"];
|
|
1210
1220
|
function N(e) {
|
|
1211
1221
|
const r = e?.configurable?.context;
|
|
1212
1222
|
if (!r || typeof r != "object")
|
|
1213
1223
|
throw new Error("DataExplorationAgent context missing");
|
|
1214
|
-
const o =
|
|
1224
|
+
const o = Kr.filter((a) => !(a in r));
|
|
1215
1225
|
if (o.length)
|
|
1216
1226
|
throw new Error(`DataExplorationAgent context missing: ${o.join(", ")}`);
|
|
1217
1227
|
return r;
|
|
1218
1228
|
}
|
|
1219
|
-
const
|
|
1229
|
+
const Br = (e) => {
|
|
1220
1230
|
const t = e.map?.allLayers.filter((o) => o.type === "feature");
|
|
1221
1231
|
let r = 0;
|
|
1222
1232
|
return t?.forEach((o) => {
|
|
1223
1233
|
const a = o;
|
|
1224
1234
|
a.featureEffect && (a.featureEffect = null, r++);
|
|
1225
1235
|
}), r > 0 ? `Cleared filters from ${r} layer(s). View unchanged.` : "No active filters to clear. View unchanged.";
|
|
1226
|
-
},
|
|
1236
|
+
}, Hr = async (e, t) => {
|
|
1227
1237
|
const { mapView: r } = N(t);
|
|
1228
|
-
return
|
|
1229
|
-
},
|
|
1238
|
+
return Br(r);
|
|
1239
|
+
}, Jr = f(Hr, {
|
|
1230
1240
|
name: "clearFilters",
|
|
1231
1241
|
description: "Clears all feature effects/filters from the map but does NOT change the current view. Use when user says 'clear filters', 'reset filters', 'remove filters', 'show all features', or wants to remove emphasis without navigating anywhere.",
|
|
1232
1242
|
schema: i.object({})
|
|
1233
|
-
}),
|
|
1243
|
+
}), Zr = async (e) => {
|
|
1234
1244
|
e.map?.allLayers.filter((a) => a.type === "feature")?.forEach((a) => {
|
|
1235
1245
|
const n = a;
|
|
1236
1246
|
n.featureEffect && (n.featureEffect = null);
|
|
1237
1247
|
});
|
|
1238
1248
|
const o = e.map.initialViewProperties?.viewpoint?.targetGeometry;
|
|
1239
1249
|
return o ? (await e.goTo(o), "Cleared all filters and returned to home extent.") : "Cleared all filters. Could not determine home extent.";
|
|
1240
|
-
},
|
|
1250
|
+
}, Yr = async (e, t) => {
|
|
1241
1251
|
const { mapView: r } = N(t);
|
|
1242
|
-
return await
|
|
1243
|
-
},
|
|
1252
|
+
return await Zr(r);
|
|
1253
|
+
}, Xr = f(Yr, {
|
|
1244
1254
|
name: "resetMap",
|
|
1245
1255
|
description: "Clears all feature effects/filters from the map AND zooms to the home extent (initial map view). Use when user says 'reset map', 'reset the map', 'start over', or wants to both clear filters and return to the initial view.",
|
|
1246
1256
|
schema: i.object({})
|
|
1247
|
-
});
|
|
1257
|
+
}), me = 5;
|
|
1248
1258
|
function W(e) {
|
|
1249
1259
|
return "point" in e && e.point !== void 0;
|
|
1250
1260
|
}
|
|
@@ -1254,7 +1264,7 @@ function P(e) {
|
|
|
1254
1264
|
const K = async (e, t) => {
|
|
1255
1265
|
if (W(e)) {
|
|
1256
1266
|
const { point: r } = e;
|
|
1257
|
-
return { geometry: new
|
|
1267
|
+
return { geometry: new fe({
|
|
1258
1268
|
x: r.x,
|
|
1259
1269
|
y: r.y,
|
|
1260
1270
|
spatialReference: r.spatialReference ? { wkid: r.spatialReference.wkid } : t.spatialReference
|
|
@@ -1262,40 +1272,37 @@ const K = async (e, t) => {
|
|
|
1262
1272
|
}
|
|
1263
1273
|
if (P(e)) {
|
|
1264
1274
|
const r = t.map?.allLayers.find(
|
|
1265
|
-
(
|
|
1275
|
+
(n) => n.id === e.layerId
|
|
1266
1276
|
);
|
|
1267
1277
|
if (!r)
|
|
1268
1278
|
return { error: `Could not find geometry layer with ID: ${e.layerId}` };
|
|
1269
|
-
const o = r.title ?? r.id;
|
|
1279
|
+
const o = r.title ?? r.id, a = e.where?.trim() || "1=1";
|
|
1270
1280
|
try {
|
|
1271
|
-
const
|
|
1272
|
-
where:
|
|
1281
|
+
const n = await r.queryFeatures({
|
|
1282
|
+
where: a,
|
|
1273
1283
|
returnGeometry: !0,
|
|
1274
|
-
outSpatialReference: t.spatialReference
|
|
1284
|
+
outSpatialReference: t.spatialReference,
|
|
1285
|
+
num: me + 1
|
|
1275
1286
|
});
|
|
1276
|
-
if (!
|
|
1287
|
+
if (!n.features.length)
|
|
1277
1288
|
return {
|
|
1278
|
-
error: `No features found in geometry layer "${o}" with the specified where clause: ${
|
|
1289
|
+
error: `No features found in geometry layer "${o}" with the specified where clause: ${a}`
|
|
1279
1290
|
};
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
}
|
|
1292
|
-
return n.spatialReference || (n.spatialReference = t.spatialReference), { geometry: n };
|
|
1293
|
-
} catch (a) {
|
|
1294
|
-
return { error: `Failed to query geometry: ${String(a)}` };
|
|
1291
|
+
if (n.features.length > me)
|
|
1292
|
+
return {
|
|
1293
|
+
error: `Geometry filter for layer "${o}" matched too many features (${n.features.length}+). Please narrow the geometry layer filter.`
|
|
1294
|
+
};
|
|
1295
|
+
const s = n.features.map((u) => u.geometry).filter((u) => !!u);
|
|
1296
|
+
if (!s.length)
|
|
1297
|
+
return { error: "No valid geometries found for the matched geometry layer features." };
|
|
1298
|
+
const c = s.length === 1 ? s[0] : nt.executeMany(s);
|
|
1299
|
+
return c ? (c.spatialReference || (c.spatialReference = t.spatialReference), { geometry: c }) : { error: "Failed to combine geometries from geometry layer." };
|
|
1300
|
+
} catch (n) {
|
|
1301
|
+
return { error: `Failed to query geometry: ${String(n)}` };
|
|
1295
1302
|
}
|
|
1296
1303
|
}
|
|
1297
1304
|
return { error: "Invalid geometry configuration provided" };
|
|
1298
|
-
},
|
|
1305
|
+
}, eo = async (e, t, r, o, a, n) => {
|
|
1299
1306
|
const s = e.map?.allLayers.find((u) => u.id === t);
|
|
1300
1307
|
if (!s)
|
|
1301
1308
|
return { success: !1, error: `Layer '${t}' not found.` };
|
|
@@ -1313,7 +1320,7 @@ const K = async (e, t) => {
|
|
|
1313
1320
|
error: u instanceof Error ? u.message : String(u)
|
|
1314
1321
|
};
|
|
1315
1322
|
}
|
|
1316
|
-
},
|
|
1323
|
+
}, to = async (e, t, r, o, a, n) => {
|
|
1317
1324
|
const s = t.map?.allLayers.find(
|
|
1318
1325
|
(p) => p.id === e.layerId
|
|
1319
1326
|
);
|
|
@@ -1326,8 +1333,8 @@ const K = async (e, t) => {
|
|
|
1326
1333
|
return p.error;
|
|
1327
1334
|
c = p.geometry;
|
|
1328
1335
|
}
|
|
1329
|
-
if (s.featureEffect = null, s.featureEffect = new
|
|
1330
|
-
filter: new
|
|
1336
|
+
if (s.featureEffect = null, s.featureEffect = new at({
|
|
1337
|
+
filter: new ge({
|
|
1331
1338
|
...e.objectIds?.length ? { objectIds: e.objectIds } : { where: e.where },
|
|
1332
1339
|
geometry: c,
|
|
1333
1340
|
spatialRelationship: "intersects",
|
|
@@ -1338,7 +1345,7 @@ const K = async (e, t) => {
|
|
|
1338
1345
|
excludedEffect: o
|
|
1339
1346
|
}), s.visible = !0, n)
|
|
1340
1347
|
return `Applied feature effects to "${s.title ?? e.layerId}" within current map extent.`;
|
|
1341
|
-
const u = e.objectIds?.length ? `${s.objectIdField} IN (${e.objectIds.join(",")})` : e.where, l = await
|
|
1348
|
+
const u = e.objectIds?.length ? `${s.objectIdField} IN (${e.objectIds.join(",")})` : e.where, l = await eo(
|
|
1342
1349
|
t,
|
|
1343
1350
|
e.layerId,
|
|
1344
1351
|
u,
|
|
@@ -1347,7 +1354,7 @@ const K = async (e, t) => {
|
|
|
1347
1354
|
a?.units
|
|
1348
1355
|
), d = s.title ?? e.layerId;
|
|
1349
1356
|
return l.success ? `Applied feature effects to target layer "${s.title ?? e.layerId}"${a && "layerId" in a ? ` using geometry from layer "${a.layerId}"` : ""}.` : `Applied filter to "${d}" but no features matched. ${l.error}`;
|
|
1350
|
-
},
|
|
1357
|
+
}, ro = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], F = i.enum(ro), oo = async ({
|
|
1351
1358
|
targetLayer: e,
|
|
1352
1359
|
geometryFilter: t,
|
|
1353
1360
|
useCurrentExtent: r,
|
|
@@ -1355,13 +1362,13 @@ const K = async (e, t) => {
|
|
|
1355
1362
|
excludedEffect: a = "grayscale(100%) opacity(60%) blur(2px)"
|
|
1356
1363
|
}, n) => {
|
|
1357
1364
|
const { mapView: s } = N(n);
|
|
1358
|
-
return await
|
|
1359
|
-
},
|
|
1365
|
+
return await to(e, s, o, a, t, r);
|
|
1366
|
+
}, ao = i.object({
|
|
1360
1367
|
layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
|
|
1361
1368
|
where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
|
|
1362
1369
|
distance: i.number().optional().describe("The buffer distance around the geometry."),
|
|
1363
|
-
units:
|
|
1364
|
-
}),
|
|
1370
|
+
units: F.optional().describe("The units for the distance buffer.")
|
|
1371
|
+
}), no = i.object({
|
|
1365
1372
|
point: i.object({
|
|
1366
1373
|
x: i.number().describe("X coordinate (longitude) from navigation result"),
|
|
1367
1374
|
y: i.number().describe("Y coordinate (latitude) from navigation result"),
|
|
@@ -1370,8 +1377,8 @@ const K = async (e, t) => {
|
|
|
1370
1377
|
}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
|
|
1371
1378
|
}).describe("Point coordinates from a previous navigation/geocoding result"),
|
|
1372
1379
|
distance: i.number().optional().describe("Optional buffer distance around the point."),
|
|
1373
|
-
units:
|
|
1374
|
-
}),
|
|
1380
|
+
units: F.optional().describe("The units for the distance buffer.")
|
|
1381
|
+
}), io = i.object({
|
|
1375
1382
|
targetLayer: i.object({
|
|
1376
1383
|
layerId: i.string().describe("The layerId of the layer on which to set a feature effect."),
|
|
1377
1384
|
where: i.string().describe("The SQL-92 where clause representing the features to emphasize."),
|
|
@@ -1379,7 +1386,7 @@ const K = async (e, t) => {
|
|
|
1379
1386
|
"Array of objectIds from a previous query result. Use this instead of a where clause when the query returned objectIds (e.g. top N results). If provided, takes precedence over where clause."
|
|
1380
1387
|
)
|
|
1381
1388
|
}),
|
|
1382
|
-
geometryFilter: i.union([
|
|
1389
|
+
geometryFilter: i.union([ao, no]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
|
|
1383
1390
|
useCurrentExtent: i.boolean().optional().describe(
|
|
1384
1391
|
"Set to true when the previous query used the current map extent as a spatial filter. This ensures the feature effect applies only to features visible in the current view. Default is false."
|
|
1385
1392
|
),
|
|
@@ -1389,10 +1396,10 @@ const K = async (e, t) => {
|
|
|
1389
1396
|
excludedEffect: i.string().default("grayscale(100%) opacity(60%) blur(2px)").describe(
|
|
1390
1397
|
"The effect applied to features that do not meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified."
|
|
1391
1398
|
)
|
|
1392
|
-
}),
|
|
1399
|
+
}), so = f(oo, {
|
|
1393
1400
|
name: "setFeatureEffect",
|
|
1394
1401
|
description: "Sets a feature effect on a given layer with given filter parameters and feature effects to emphasize certain features that meet a filter requirement. If no feature effect information is provided, then use the default effect provided.",
|
|
1395
|
-
schema:
|
|
1402
|
+
schema: io
|
|
1396
1403
|
}), X = (e) => {
|
|
1397
1404
|
if (e instanceof Date)
|
|
1398
1405
|
return Number.isNaN(e.getTime()) ? null : e;
|
|
@@ -1401,23 +1408,23 @@ const K = async (e, t) => {
|
|
|
1401
1408
|
return Number.isNaN(t.getTime()) ? null : t;
|
|
1402
1409
|
}
|
|
1403
1410
|
return null;
|
|
1404
|
-
},
|
|
1411
|
+
}, co = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, lo = (e) => {
|
|
1405
1412
|
if (typeof e == "string" && e)
|
|
1406
1413
|
return e;
|
|
1407
1414
|
const t = X(e);
|
|
1408
1415
|
return t ? t.toISOString().slice(0, 10) : null;
|
|
1409
|
-
},
|
|
1416
|
+
}, Vn = () => {
|
|
1410
1417
|
const e = (/* @__PURE__ */ new Date()).getTimezoneOffset(), t = e <= 0 ? "+" : "-", r = Math.floor(Math.abs(e) / 60).toString().padStart(2, "0"), o = (Math.abs(e) % 60).toString().padStart(2, "0"), a = `${t}${r}:${o}`;
|
|
1411
1418
|
return { userTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone, userTimezoneOffset: a };
|
|
1412
|
-
},
|
|
1419
|
+
}, uo = (e, t, r) => {
|
|
1413
1420
|
const o = t?.toLowerCase();
|
|
1414
1421
|
if (o === "date-only") {
|
|
1415
|
-
const n =
|
|
1416
|
-
return n ?
|
|
1422
|
+
const n = lo(e);
|
|
1423
|
+
return n ? it(n, M("short-date")) : e;
|
|
1417
1424
|
}
|
|
1418
1425
|
if (o === "time-only") {
|
|
1419
1426
|
if (typeof e == "string" && e)
|
|
1420
|
-
return
|
|
1427
|
+
return st(e, M("long-time"));
|
|
1421
1428
|
const n = X(e);
|
|
1422
1429
|
return n ? de(n, {
|
|
1423
1430
|
...M("long-time"),
|
|
@@ -1427,9 +1434,9 @@ const K = async (e, t) => {
|
|
|
1427
1434
|
const a = X(e);
|
|
1428
1435
|
return a ? de(a, {
|
|
1429
1436
|
...M("short-date-short-time"),
|
|
1430
|
-
timeZone:
|
|
1437
|
+
timeZone: co(r)
|
|
1431
1438
|
}) : e;
|
|
1432
|
-
},
|
|
1439
|
+
}, Te = (e, t, r) => {
|
|
1433
1440
|
if (e && typeof e != "function") {
|
|
1434
1441
|
const o = "getField" in r && r.getField?.(e), a = o && "getFieldDomain" in r && r.getFieldDomain ? r.getFieldDomain(o.name) : null;
|
|
1435
1442
|
if (a?.type === "coded-value") {
|
|
@@ -1438,7 +1445,7 @@ const K = async (e, t) => {
|
|
|
1438
1445
|
}
|
|
1439
1446
|
}
|
|
1440
1447
|
return null;
|
|
1441
|
-
},
|
|
1448
|
+
}, po = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, ho = (e) => {
|
|
1442
1449
|
if (e instanceof Date)
|
|
1443
1450
|
return Number.isNaN(e.getTime()) ? null : e;
|
|
1444
1451
|
if (typeof e == "number" && Number.isFinite(e)) {
|
|
@@ -1450,7 +1457,7 @@ const K = async (e, t) => {
|
|
|
1450
1457
|
return Number.isNaN(t.getTime()) ? null : t;
|
|
1451
1458
|
}
|
|
1452
1459
|
return null;
|
|
1453
|
-
},
|
|
1460
|
+
}, mo = (e, t) => {
|
|
1454
1461
|
if (typeof e != "number")
|
|
1455
1462
|
return e;
|
|
1456
1463
|
const r = {};
|
|
@@ -1460,26 +1467,26 @@ const K = async (e, t) => {
|
|
|
1460
1467
|
} catch {
|
|
1461
1468
|
return e;
|
|
1462
1469
|
}
|
|
1463
|
-
},
|
|
1464
|
-
const o =
|
|
1470
|
+
}, yo = (e, t, r) => {
|
|
1471
|
+
const o = ho(e);
|
|
1465
1472
|
if (!o)
|
|
1466
1473
|
return e;
|
|
1467
1474
|
const a = {};
|
|
1468
|
-
t.dateStyle ? a.dateStyle = t.dateStyle : (t.year && (a.year = t.year), t.month && (a.month = t.month)), t.timeStyle && (a.timeStyle = t.timeStyle), t.timeStyle && t.hour12 === "always" ? a.hour12 = !0 : t.timeStyle && t.hour12 === "never" && (a.hour12 = !1), a.timeZone =
|
|
1475
|
+
t.dateStyle ? a.dateStyle = t.dateStyle : (t.year && (a.year = t.year), t.month && (a.month = t.month)), t.timeStyle && (a.timeStyle = t.timeStyle), t.timeStyle && t.hour12 === "always" ? a.hour12 = !0 : t.timeStyle && t.hour12 === "never" && (a.hour12 = !1), a.timeZone = po(r);
|
|
1469
1476
|
try {
|
|
1470
1477
|
return new Intl.DateTimeFormat(void 0, a).format(o);
|
|
1471
1478
|
} catch {
|
|
1472
1479
|
return e;
|
|
1473
1480
|
}
|
|
1474
|
-
},
|
|
1481
|
+
}, ve = (e, t) => e.getFieldAlias?.(t) ?? e.fieldsIndex?.get(t)?.alias ?? e.fieldsIndex?.get(t)?.name ?? t, Se = (e, t, r, o, a) => {
|
|
1475
1482
|
if (r == null)
|
|
1476
1483
|
return r;
|
|
1477
1484
|
const s = e.getFieldConfiguration?.(t)?.fieldFormat;
|
|
1478
|
-
return s?.type === "number" ?
|
|
1479
|
-
},
|
|
1480
|
-
const a = e.fieldsIndex?.get(t), n =
|
|
1485
|
+
return s?.type === "number" ? mo(r, s) : s?.type === "date-time" ? yo(r, s, a) : uo(r, o, a);
|
|
1486
|
+
}, fo = (e, t, r, o) => {
|
|
1487
|
+
const a = e.fieldsIndex?.get(t), n = Te(t, r, e) ?? r;
|
|
1481
1488
|
return Se(e, t, n, a?.type, o);
|
|
1482
|
-
},
|
|
1489
|
+
}, go = (e, t) => ve(e, t), xe = (e, t, r) => {
|
|
1483
1490
|
const o = e.objectIdField, a = t.features.map(
|
|
1484
1491
|
(s) => s.attributes[o]
|
|
1485
1492
|
), n = t.features.map((s) => {
|
|
@@ -1492,16 +1499,16 @@ const K = async (e, t) => {
|
|
|
1492
1499
|
u[l.name] = d;
|
|
1493
1500
|
return;
|
|
1494
1501
|
}
|
|
1495
|
-
const p =
|
|
1502
|
+
const p = Te(l.name, d, e) ?? d, h = ve(e, l.name);
|
|
1496
1503
|
u[h] = Se(e, l.name, p, l.type, r);
|
|
1497
1504
|
}), u;
|
|
1498
1505
|
});
|
|
1499
1506
|
return { objectIds: a, attributes: n };
|
|
1500
|
-
},
|
|
1507
|
+
}, wo = (e, t, r) => {
|
|
1501
1508
|
const o = e.createQuery();
|
|
1502
1509
|
return o.outFields = [t], o.where = r || "1=1", o.num = 1, o;
|
|
1503
|
-
},
|
|
1504
|
-
const a = o.map?.allLayers.find((h) => h.id === e), n =
|
|
1510
|
+
}, bo = async (e, t, r, o) => {
|
|
1511
|
+
const a = o.map?.allLayers.find((h) => h.id === e), n = wo(a, t, r.where), c = (await a.queryFeatures(n)).features[0], u = c ? c.attributes[t] : null, l = fo(a, t, u, o.timeZone), d = go(a, t);
|
|
1505
1512
|
return {
|
|
1506
1513
|
tool: "getAttribute",
|
|
1507
1514
|
layerName: a.title ?? e,
|
|
@@ -1514,27 +1521,27 @@ const K = async (e, t) => {
|
|
|
1514
1521
|
}
|
|
1515
1522
|
};
|
|
1516
1523
|
};
|
|
1517
|
-
async function
|
|
1518
|
-
const { mapView: a } = N(o), n = await
|
|
1524
|
+
async function To({ layerId: e, fieldName: t, query: r }, o) {
|
|
1525
|
+
const { mapView: a } = N(o), n = await bo(e, t, r, a);
|
|
1519
1526
|
return JSON.stringify(n, null, 2);
|
|
1520
1527
|
}
|
|
1521
|
-
const
|
|
1528
|
+
const vo = i.object({
|
|
1522
1529
|
layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
|
|
1523
1530
|
fieldName: i.string().describe("The name of the field/attribute from which to get a field value."),
|
|
1524
1531
|
query: i.object({
|
|
1525
1532
|
where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
|
|
1526
1533
|
})
|
|
1527
|
-
}), So = f(
|
|
1534
|
+
}), So = f(To, {
|
|
1528
1535
|
name: "getAttribute",
|
|
1529
1536
|
description: "Returns an attribute value for a given feature.",
|
|
1530
|
-
schema:
|
|
1537
|
+
schema: vo
|
|
1531
1538
|
}), oe = (e, t, r) => r ? e.hasAllFeaturesInView && e.availableFields === t : e.hasAllFeatures && e.availableFields === t;
|
|
1532
1539
|
function V(e, t) {
|
|
1533
1540
|
let r = e ?? "";
|
|
1534
1541
|
return t != null && t && (r = r ? `(${r}) AND (${t})` : t), r || null;
|
|
1535
1542
|
}
|
|
1536
|
-
const
|
|
1537
|
-
const { targetLayer: t, fieldName: r, statisticType: o, mapView: a, layersAndFieldsRegistry: n, geometryFilter: s } = e, c = a.map?.allLayers.find((
|
|
1543
|
+
const xo = async (e) => {
|
|
1544
|
+
const { targetLayer: t, fieldName: r, statisticType: o, mapView: a, layersAndFieldsRegistry: n, geometryFilter: s } = e, c = a.map?.allLayers.find((v) => v.id === t.layerId);
|
|
1538
1545
|
if (!c)
|
|
1539
1546
|
throw new Error(`Layer '${t.layerId}' not found.`);
|
|
1540
1547
|
const u = await a.whenLayerView(c), d = n.get(t.layerId)?.fieldRegistry.get(r), p = d?.alias;
|
|
@@ -1542,10 +1549,10 @@ const vo = async (e) => {
|
|
|
1542
1549
|
throw new Error(`Field '${r}' not found.`);
|
|
1543
1550
|
let h, m;
|
|
1544
1551
|
if (s) {
|
|
1545
|
-
const
|
|
1546
|
-
if ("error" in
|
|
1547
|
-
throw new Error(
|
|
1548
|
-
if (!
|
|
1552
|
+
const v = await K(s, a);
|
|
1553
|
+
if ("error" in v)
|
|
1554
|
+
throw new Error(v.error);
|
|
1555
|
+
if (!v.geometry)
|
|
1549
1556
|
throw P(s) ? new Error(`No features found matching: ${s.where}`) : new Error("Failed to create geometry");
|
|
1550
1557
|
if (P(s)) {
|
|
1551
1558
|
const O = a.map?.allLayers.find((A) => A.id === s.layerId);
|
|
@@ -1563,8 +1570,8 @@ const vo = async (e) => {
|
|
|
1563
1570
|
units: s.units,
|
|
1564
1571
|
applied: !0
|
|
1565
1572
|
});
|
|
1566
|
-
m = new
|
|
1567
|
-
geometry:
|
|
1573
|
+
m = new ge({
|
|
1574
|
+
geometry: v.geometry,
|
|
1568
1575
|
distance: s.distance,
|
|
1569
1576
|
units: s.units,
|
|
1570
1577
|
spatialRelationship: "intersects"
|
|
@@ -1575,7 +1582,7 @@ const vo = async (e) => {
|
|
|
1575
1582
|
const T = 10;
|
|
1576
1583
|
if (d.type !== "geometry" && d.type !== "oid" && d.type !== "global-id")
|
|
1577
1584
|
try {
|
|
1578
|
-
const
|
|
1585
|
+
const v = {
|
|
1579
1586
|
layer: c,
|
|
1580
1587
|
useFeaturesInView: w,
|
|
1581
1588
|
view: w ? a : void 0,
|
|
@@ -1584,21 +1591,21 @@ const vo = async (e) => {
|
|
|
1584
1591
|
...m && { filter: m },
|
|
1585
1592
|
outStatisticTypes: { include: [o] }
|
|
1586
1593
|
};
|
|
1587
|
-
y = await
|
|
1594
|
+
y = await ct(v);
|
|
1588
1595
|
const O = ["string", "small-integer", "integer"], A = d.domain?.type === "coded-value" ? d.domain : null;
|
|
1589
|
-
(O.includes(d.type) || A) && (g = (await
|
|
1596
|
+
(O.includes(d.type) || A) && (g = (await lt({
|
|
1590
1597
|
layer: c,
|
|
1591
1598
|
useFeaturesInView: w,
|
|
1592
1599
|
view: w ? a : void 0,
|
|
1593
1600
|
field: r,
|
|
1594
1601
|
sqlWhere: V(c.definitionExpression, t.where),
|
|
1595
1602
|
...m && { filter: m }
|
|
1596
|
-
})).uniqueValueInfos.sort((q,
|
|
1603
|
+
})).uniqueValueInfos.sort((q, Ne) => Ne.count - q.count).slice(0, T)), g && d.domain?.type === "coded-value" && (g = g.map((q) => ({
|
|
1597
1604
|
...q,
|
|
1598
1605
|
value: A ? A.getName(q.value) ?? q.value : q.value
|
|
1599
1606
|
})));
|
|
1600
|
-
} catch (
|
|
1601
|
-
console.error("Statistics error:",
|
|
1607
|
+
} catch (v) {
|
|
1608
|
+
console.error("Statistics error:", v);
|
|
1602
1609
|
}
|
|
1603
1610
|
return {
|
|
1604
1611
|
tool: "getStatistics",
|
|
@@ -1616,13 +1623,13 @@ const vo = async (e) => {
|
|
|
1616
1623
|
}
|
|
1617
1624
|
};
|
|
1618
1625
|
};
|
|
1619
|
-
async function
|
|
1626
|
+
async function Ro({
|
|
1620
1627
|
targetLayer: e,
|
|
1621
1628
|
fieldName: t,
|
|
1622
1629
|
statisticType: r,
|
|
1623
1630
|
geometryFilter: o
|
|
1624
1631
|
}, a) {
|
|
1625
|
-
const n =
|
|
1632
|
+
const n = be(a, "layersAndFieldsRegistry"), { mapView: s } = N(a), c = await xo({
|
|
1626
1633
|
targetLayer: e,
|
|
1627
1634
|
fieldName: t,
|
|
1628
1635
|
statisticType: r,
|
|
@@ -1632,12 +1639,12 @@ async function xo({
|
|
|
1632
1639
|
});
|
|
1633
1640
|
return JSON.stringify(c, null, 2);
|
|
1634
1641
|
}
|
|
1635
|
-
const
|
|
1642
|
+
const $o = i.object({
|
|
1636
1643
|
layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
|
|
1637
1644
|
where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
|
|
1638
1645
|
distance: i.number().optional().describe("The buffer distance around the geometry."),
|
|
1639
|
-
units:
|
|
1640
|
-
}),
|
|
1646
|
+
units: F.optional().describe("The units for the distance buffer.")
|
|
1647
|
+
}), Eo = i.object({
|
|
1641
1648
|
point: i.object({
|
|
1642
1649
|
x: i.number().describe("X coordinate (longitude) from navigation result"),
|
|
1643
1650
|
y: i.number().describe("Y coordinate (latitude) from navigation result"),
|
|
@@ -1646,18 +1653,18 @@ const Ro = i.object({
|
|
|
1646
1653
|
}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
|
|
1647
1654
|
}).describe("Point coordinates from a previous navigation/geocoding result"),
|
|
1648
1655
|
distance: i.number().optional().describe("Optional buffer distance around the point."),
|
|
1649
|
-
units:
|
|
1650
|
-
}),
|
|
1656
|
+
units: F.optional().describe("The units for the distance buffer.")
|
|
1657
|
+
}), Co = i.object({
|
|
1651
1658
|
targetLayer: i.object({
|
|
1652
1659
|
layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
|
|
1653
1660
|
where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
|
|
1654
1661
|
}),
|
|
1655
|
-
geometryFilter: i.union([
|
|
1662
|
+
geometryFilter: i.union([$o, Eo]).optional().describe(
|
|
1656
1663
|
"Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."
|
|
1657
1664
|
),
|
|
1658
1665
|
fieldName: i.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
|
|
1659
1666
|
statisticType: i.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
|
|
1660
|
-
}),
|
|
1667
|
+
}), Fo = f(Ro, {
|
|
1661
1668
|
name: "getStatistics",
|
|
1662
1669
|
description: `Computes a single aggregate statistic (max, min, avg, sum, median, stddev, variance) for a numeric field across matching features. Also returns frequency analysis for categorical fields.
|
|
1663
1670
|
|
|
@@ -1672,7 +1679,7 @@ DO NOT USE FOR:
|
|
|
1672
1679
|
- Simple counts of features matching a condition — use queryFeatures instead
|
|
1673
1680
|
|
|
1674
1681
|
Only call this tool when the answer requires computing an aggregate (avg, max, min, sum, median, stddev) over a field's values, not just counting or listing features.`,
|
|
1675
|
-
schema:
|
|
1682
|
+
schema: Co
|
|
1676
1683
|
}), Io = async (e, t, r, o, a) => {
|
|
1677
1684
|
const n = r.map?.allLayers.find((h) => h.id === e.layerId), s = await r.whenLayerView(n), c = n.title ?? e.layerId;
|
|
1678
1685
|
let u;
|
|
@@ -1700,7 +1707,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1700
1707
|
try {
|
|
1701
1708
|
let h;
|
|
1702
1709
|
if (l) {
|
|
1703
|
-
const y = new
|
|
1710
|
+
const y = new ut({
|
|
1704
1711
|
where: e.where || "1=1",
|
|
1705
1712
|
outFields: p,
|
|
1706
1713
|
orderByFields: e.orderByFields,
|
|
@@ -1708,7 +1715,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1708
1715
|
spatialRelationship: u ? "intersects" : void 0,
|
|
1709
1716
|
distance: o?.distance,
|
|
1710
1717
|
units: o?.units,
|
|
1711
|
-
topFilter: new
|
|
1718
|
+
topFilter: new dt({
|
|
1712
1719
|
topCount: t.topCount,
|
|
1713
1720
|
groupByFields: t.groupByFields,
|
|
1714
1721
|
orderByFields: t.orderByFields
|
|
@@ -1725,7 +1732,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1725
1732
|
console.warn("Client-side query failed, falling back to server:", T), h = await n.queryFeatures(y);
|
|
1726
1733
|
}
|
|
1727
1734
|
}
|
|
1728
|
-
const m = h.features.map((y) => y.attributes[d]), { attributes: w } =
|
|
1735
|
+
const m = h.features.map((y) => y.attributes[d]), { attributes: w } = xe(n, h, r.timeZone);
|
|
1729
1736
|
return {
|
|
1730
1737
|
tool: "getTopFeatures",
|
|
1731
1738
|
layerName: c,
|
|
@@ -1756,12 +1763,12 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1756
1763
|
}, a) => {
|
|
1757
1764
|
const { mapView: n } = N(a), s = await Io(e, t, n, r, o);
|
|
1758
1765
|
return JSON.stringify(s, null, 2);
|
|
1759
|
-
},
|
|
1766
|
+
}, No = i.object({
|
|
1760
1767
|
layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
|
|
1761
1768
|
where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
|
|
1762
1769
|
distance: i.number().optional().describe("The buffer distance around the geometry."),
|
|
1763
|
-
units:
|
|
1764
|
-
}),
|
|
1770
|
+
units: F.optional().describe("The units for the distance buffer.")
|
|
1771
|
+
}), zo = i.object({
|
|
1765
1772
|
point: i.object({
|
|
1766
1773
|
x: i.number().describe("X coordinate (longitude) from navigation result"),
|
|
1767
1774
|
y: i.number().describe("Y coordinate (latitude) from navigation result"),
|
|
@@ -1770,8 +1777,8 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1770
1777
|
}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
|
|
1771
1778
|
}).describe("Point coordinates from a previous navigation/geocoding result"),
|
|
1772
1779
|
distance: i.number().optional().describe("Optional buffer distance around the point."),
|
|
1773
|
-
units:
|
|
1774
|
-
}),
|
|
1780
|
+
units: F.optional().describe("The units for the distance buffer.")
|
|
1781
|
+
}), qo = i.object({
|
|
1775
1782
|
targetLayer: i.object({
|
|
1776
1783
|
layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
|
|
1777
1784
|
where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
|
|
@@ -1782,7 +1789,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1782
1789
|
).default("*")
|
|
1783
1790
|
)
|
|
1784
1791
|
}),
|
|
1785
|
-
geometryFilter: i.union([
|
|
1792
|
+
geometryFilter: i.union([No, zo]).optional().describe(
|
|
1786
1793
|
"Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."
|
|
1787
1794
|
),
|
|
1788
1795
|
topFilter: i.object({
|
|
@@ -1791,15 +1798,15 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1791
1798
|
i.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")
|
|
1792
1799
|
),
|
|
1793
1800
|
groupByFields: i.array(i.string().describe("Field(s) to group results by. Returns top N per group."))
|
|
1794
|
-
}),
|
|
1801
|
+
}).required(),
|
|
1795
1802
|
useCurrentExtent: i.boolean().optional().describe(
|
|
1796
1803
|
"Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at'. Default is false (queries entire layer)."
|
|
1797
1804
|
)
|
|
1798
|
-
}),
|
|
1805
|
+
}), Do = f(ko, {
|
|
1799
1806
|
name: "getTopFeatures",
|
|
1800
1807
|
description: 'Returns top N features ranked by an existing field value. Use for "highest", "lowest", "top N" questions where ranking is based on a field that already exists in the data (e.g., population, value, date, depth). orderByFields must be actual field names with ASC/DESC. Do NOT use aggregate functions like COUNT(), SUM(), AVG() - those require getStatistics.',
|
|
1801
|
-
schema:
|
|
1802
|
-
}), Z = 25,
|
|
1808
|
+
schema: qo
|
|
1809
|
+
}), Z = 25, Ao = async (e, t, r, o) => {
|
|
1803
1810
|
const a = t.map?.allLayers.find((y) => y.id === e.layerId), n = await t.whenLayerView(a), s = a.title ?? e.layerId;
|
|
1804
1811
|
let c;
|
|
1805
1812
|
if (r) {
|
|
@@ -1840,7 +1847,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1840
1847
|
} catch (y) {
|
|
1841
1848
|
console.warn("Client-side query failed, falling back to server:", y), p = await a.queryFeatureCount(d), p > 0 && p <= Z && (h = await a.queryFeatures(d));
|
|
1842
1849
|
}
|
|
1843
|
-
const { objectIds: m, attributes: w } = h ?
|
|
1850
|
+
const { objectIds: m, attributes: w } = h ? xe(a, h, t.timeZone) : { objectIds: void 0, attributes: void 0 };
|
|
1844
1851
|
return {
|
|
1845
1852
|
tool: "queryFeatures",
|
|
1846
1853
|
layerName: s,
|
|
@@ -1858,20 +1865,20 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1858
1865
|
}
|
|
1859
1866
|
};
|
|
1860
1867
|
};
|
|
1861
|
-
async function
|
|
1868
|
+
async function Lo({
|
|
1862
1869
|
targetLayer: e,
|
|
1863
1870
|
geometryFilter: t,
|
|
1864
1871
|
useCurrentExtent: r
|
|
1865
1872
|
}, o) {
|
|
1866
|
-
const { mapView: a } = N(o), n = await
|
|
1873
|
+
const { mapView: a } = N(o), n = await Ao(e, a, t, r);
|
|
1867
1874
|
return JSON.stringify(n, null, 2);
|
|
1868
1875
|
}
|
|
1869
|
-
const
|
|
1876
|
+
const Po = i.object({
|
|
1870
1877
|
layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
|
|
1871
1878
|
where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
|
|
1872
1879
|
distance: i.number().optional().describe("The buffer distance around the geometry."),
|
|
1873
|
-
units:
|
|
1874
|
-
}),
|
|
1880
|
+
units: F.optional().describe("The units for the distance buffer.")
|
|
1881
|
+
}), jo = i.object({
|
|
1875
1882
|
point: i.object({
|
|
1876
1883
|
x: i.number().describe("X coordinate (longitude) from navigation result"),
|
|
1877
1884
|
y: i.number().describe("Y coordinate (latitude) from navigation result"),
|
|
@@ -1880,8 +1887,8 @@ const Lo = i.object({
|
|
|
1880
1887
|
}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
|
|
1881
1888
|
}).describe("Point coordinates from a previous navigation/geocoding result"),
|
|
1882
1889
|
distance: i.number().optional().describe("Optional buffer distance around the point."),
|
|
1883
|
-
units:
|
|
1884
|
-
}),
|
|
1890
|
+
units: F.optional().describe("The units for the distance buffer.")
|
|
1891
|
+
}), Go = i.object({
|
|
1885
1892
|
targetLayer: i.object({
|
|
1886
1893
|
layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
|
|
1887
1894
|
where: i.string().describe(
|
|
@@ -1894,13 +1901,13 @@ const Lo = i.object({
|
|
|
1894
1901
|
).default("*")
|
|
1895
1902
|
)
|
|
1896
1903
|
}),
|
|
1897
|
-
geometryFilter: i.union([
|
|
1904
|
+
geometryFilter: i.union([Po, jo]).optional().describe(
|
|
1898
1905
|
"Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."
|
|
1899
1906
|
),
|
|
1900
1907
|
useCurrentExtent: i.boolean().optional().describe(
|
|
1901
1908
|
"Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at', OR when the user refers back to features previously identified using the current extent (e.g. 'these', 'those', 'them', 'the same ones'). Default is false (queries entire layer)."
|
|
1902
1909
|
)
|
|
1903
|
-
}),
|
|
1910
|
+
}), Oo = f(Lo, {
|
|
1904
1911
|
name: "queryFeatures",
|
|
1905
1912
|
description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
|
|
1906
1913
|
|
|
@@ -1912,10 +1919,10 @@ USE THIS TOOL FOR:
|
|
|
1912
1919
|
- Any question where the user wants to SEE or COUNT matching features
|
|
1913
1920
|
|
|
1914
1921
|
This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
|
|
1915
|
-
schema:
|
|
1916
|
-
}),
|
|
1917
|
-
async function
|
|
1918
|
-
const { messages: r } = await
|
|
1922
|
+
schema: Go
|
|
1923
|
+
}), Mo = [So, Fo, Do, Oo], Un = [so, Xr, Jr], Qo = new ot(Mo, { handleToolErrors: !1 });
|
|
1924
|
+
async function Kn(e, t) {
|
|
1925
|
+
const { messages: r } = await Qo.invoke({ messages: e.dataExplorationMessages }, t), o = [], a = [];
|
|
1919
1926
|
for (const n of r) {
|
|
1920
1927
|
const s = n.content;
|
|
1921
1928
|
let c;
|
|
@@ -1942,18 +1949,16 @@ async function Un(e, t) {
|
|
|
1942
1949
|
}
|
|
1943
1950
|
o.push(c), c.details && typeof c.details == "object" && "error" in c.details ? a.push(`- ${c.tool}: Error - ${String(c.details.error)}`) : a.push(`- ${c.layerName}: ${c.summary}`);
|
|
1944
1951
|
}
|
|
1945
|
-
return await
|
|
1952
|
+
return await S({ text: `Finished executing layer query tool: ${a.join(", ")}` }, t), {
|
|
1946
1953
|
...e,
|
|
1947
1954
|
dataExplorationMessages: [...e.dataExplorationMessages, ...r],
|
|
1948
1955
|
queryResponse: o,
|
|
1949
1956
|
status: "success",
|
|
1950
|
-
|
|
1951
|
-
`),
|
|
1952
|
-
summary: a.length > 0 ? _t(a.join(`
|
|
1957
|
+
summary: a.length > 0 ? Wt(a.join(`
|
|
1953
1958
|
`)) : "Query executed."
|
|
1954
1959
|
};
|
|
1955
1960
|
}
|
|
1956
|
-
const
|
|
1961
|
+
const Bn = b.Root({
|
|
1957
1962
|
...U(),
|
|
1958
1963
|
// internal to the help agent
|
|
1959
1964
|
helpInternalState: b({
|
|
@@ -1962,7 +1967,7 @@ const Kn = b.Root({
|
|
|
1962
1967
|
toolCallMessage: void 0
|
|
1963
1968
|
})
|
|
1964
1969
|
})
|
|
1965
|
-
}),
|
|
1970
|
+
}), _o = (e, t) => {
|
|
1966
1971
|
const r = Array.from(e.values()).find(
|
|
1967
1972
|
({ layerItem: n }) => n.title?.toLowerCase().includes(t.toLowerCase())
|
|
1968
1973
|
);
|
|
@@ -1975,22 +1980,22 @@ const Kn = b.Root({
|
|
|
1975
1980
|
return `**${r.layerItem.title}** has ${o.length} field(s):
|
|
1976
1981
|
|
|
1977
1982
|
${a}`;
|
|
1978
|
-
},
|
|
1979
|
-
const r =
|
|
1980
|
-
return
|
|
1981
|
-
},
|
|
1983
|
+
}, Wo = async ({ layerTitle: e }, t) => {
|
|
1984
|
+
const r = be(t, "layersAndFieldsRegistry");
|
|
1985
|
+
return _o(r, e);
|
|
1986
|
+
}, Hn = f(Wo, {
|
|
1982
1987
|
name: "listLayerFields",
|
|
1983
1988
|
description: "Lists all fields for a given layer by title. Use ONLY when the user explicitly asks to see fields, columns, or attributes of a specific named layer. Do NOT call this tool for general help questions, capability overviews, or layer listing.",
|
|
1984
1989
|
schema: i.object({
|
|
1985
1990
|
layerTitle: i.string().describe("The title or partial title of the layer to list fields for.")
|
|
1986
1991
|
})
|
|
1987
|
-
}),
|
|
1992
|
+
}), Jn = b.Root({
|
|
1988
1993
|
...U(),
|
|
1989
1994
|
intent: b({
|
|
1990
1995
|
reducer: (e, t) => t
|
|
1991
1996
|
}),
|
|
1992
1997
|
arcgisKnowledgeMessages: b({
|
|
1993
|
-
reducer:
|
|
1998
|
+
reducer: ye,
|
|
1994
1999
|
default: () => []
|
|
1995
2000
|
}),
|
|
1996
2001
|
arcgisKnowledgeToolResult: b({
|
|
@@ -2022,16 +2027,16 @@ function H(e) {
|
|
|
2022
2027
|
view: o
|
|
2023
2028
|
};
|
|
2024
2029
|
}
|
|
2025
|
-
function
|
|
2030
|
+
function Zn(e) {
|
|
2026
2031
|
const r = e?.configurable?.context;
|
|
2027
|
-
if (
|
|
2032
|
+
if (Re(e) === "knowledgeGraph")
|
|
2028
2033
|
return "knowledgeGraph";
|
|
2029
2034
|
const a = r.view;
|
|
2030
2035
|
return z(a) ? (ae(a), "map") : "linkChart";
|
|
2031
2036
|
}
|
|
2032
2037
|
async function G(e) {
|
|
2033
2038
|
const r = e?.configurable?.context;
|
|
2034
|
-
if (
|
|
2039
|
+
if (Re(e) === "knowledgeGraph")
|
|
2035
2040
|
return r;
|
|
2036
2041
|
{
|
|
2037
2042
|
const a = r.view.map;
|
|
@@ -2055,7 +2060,7 @@ async function G(e) {
|
|
|
2055
2060
|
}
|
|
2056
2061
|
}
|
|
2057
2062
|
}
|
|
2058
|
-
function
|
|
2063
|
+
function Re(e) {
|
|
2059
2064
|
const r = e?.configurable?.context;
|
|
2060
2065
|
if (!r || typeof r != "object")
|
|
2061
2066
|
throw new Error("ArcgisKnowledgeAgent context missing");
|
|
@@ -2067,7 +2072,7 @@ function xe(e) {
|
|
|
2067
2072
|
return "view";
|
|
2068
2073
|
throw new Error("ArcgisKnowledgeAgent context must have either a view or knowledgeGraph property.");
|
|
2069
2074
|
}
|
|
2070
|
-
class
|
|
2075
|
+
class Vo {
|
|
2071
2076
|
constructor(t) {
|
|
2072
2077
|
this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = ne.fromDataModel(t);
|
|
2073
2078
|
}
|
|
@@ -2086,10 +2091,10 @@ class ne {
|
|
|
2086
2091
|
for (const o of t.entityTypes)
|
|
2087
2092
|
r.entityTypes.push(j.fromEntityType(o));
|
|
2088
2093
|
for (const o of t.relationshipTypes)
|
|
2089
|
-
r.relationshipTypes.push(
|
|
2094
|
+
r.relationshipTypes.push(Uo.fromRelationshipType(o));
|
|
2090
2095
|
return r.identifierInfo = {
|
|
2091
2096
|
mappingInfo: {
|
|
2092
|
-
identifierMapsTo:
|
|
2097
|
+
identifierMapsTo: Ko(
|
|
2093
2098
|
t.identifierInfo.identifierMappingInfo.identifierInfoType
|
|
2094
2099
|
),
|
|
2095
2100
|
identifierPropertyName: t.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName
|
|
@@ -2109,13 +2114,13 @@ class j {
|
|
|
2109
2114
|
}
|
|
2110
2115
|
static fromEntityType(t) {
|
|
2111
2116
|
const r = new j();
|
|
2112
|
-
r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role =
|
|
2117
|
+
r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = Bo(t.role);
|
|
2113
2118
|
for (const o of t.properties) {
|
|
2114
2119
|
const a = {
|
|
2115
2120
|
name: o.name,
|
|
2116
2121
|
alias: o.alias ? o.alias : void 0,
|
|
2117
2122
|
fieldType: o.fieldType,
|
|
2118
|
-
role:
|
|
2123
|
+
role: Ho(o.role),
|
|
2119
2124
|
geometryDef: o.fieldType === "esriFieldTypeGeometry" ? {
|
|
2120
2125
|
geometryType: o.geometryType ?? "esriGeometryAny",
|
|
2121
2126
|
hasM: o.hasM ? o.hasM : void 0,
|
|
@@ -2127,7 +2132,7 @@ class j {
|
|
|
2127
2132
|
return r;
|
|
2128
2133
|
}
|
|
2129
2134
|
}
|
|
2130
|
-
class
|
|
2135
|
+
class Uo extends j {
|
|
2131
2136
|
constructor() {
|
|
2132
2137
|
super(...arguments), this.observedEndPoints = [];
|
|
2133
2138
|
}
|
|
@@ -2142,7 +2147,7 @@ class Vo extends j {
|
|
|
2142
2147
|
return r;
|
|
2143
2148
|
}
|
|
2144
2149
|
}
|
|
2145
|
-
const
|
|
2150
|
+
const Ko = (e) => {
|
|
2146
2151
|
switch (e) {
|
|
2147
2152
|
case "esriIdentifierInfoTypeUNSPECIFIED":
|
|
2148
2153
|
return "UNSPECIFIED";
|
|
@@ -2153,7 +2158,7 @@ const Uo = (e) => {
|
|
|
2153
2158
|
default:
|
|
2154
2159
|
return e;
|
|
2155
2160
|
}
|
|
2156
|
-
},
|
|
2161
|
+
}, Bo = (e) => {
|
|
2157
2162
|
switch (e) {
|
|
2158
2163
|
case "Regular":
|
|
2159
2164
|
return "esriGraphNamedObjectRegular";
|
|
@@ -2165,7 +2170,7 @@ const Uo = (e) => {
|
|
|
2165
2170
|
return e;
|
|
2166
2171
|
}
|
|
2167
2172
|
};
|
|
2168
|
-
function
|
|
2173
|
+
function Ho(e) {
|
|
2169
2174
|
switch (e) {
|
|
2170
2175
|
case "esriGraphPropertyRegular":
|
|
2171
2176
|
return "Regular";
|
|
@@ -2203,7 +2208,7 @@ function Bo(e) {
|
|
|
2203
2208
|
return "Regular";
|
|
2204
2209
|
}
|
|
2205
2210
|
}
|
|
2206
|
-
function
|
|
2211
|
+
function Jo(e, t) {
|
|
2207
2212
|
return t ? `${e}
|
|
2208
2213
|
|
|
2209
2214
|
Your previous attempt to generate a cypher query failed. See the details below and generate a new cypher query that avoids this error.
|
|
@@ -2213,7 +2218,7 @@ Execution Error: ${t.executionError}
|
|
|
2213
2218
|
Failed Query:
|
|
2214
2219
|
${t.failedGraphQuery}` : e;
|
|
2215
2220
|
}
|
|
2216
|
-
async function
|
|
2221
|
+
async function Zo(e, t, r, o) {
|
|
2217
2222
|
const { graphQuery: a, explanation: n } = await ie(e, t, r, o);
|
|
2218
2223
|
return `Generated Graph Query:
|
|
2219
2224
|
${a}
|
|
@@ -2222,16 +2227,16 @@ Explanation: ${n}`;
|
|
|
2222
2227
|
}
|
|
2223
2228
|
async function ie(e, t, r, o, a) {
|
|
2224
2229
|
const n = {
|
|
2225
|
-
message:
|
|
2226
|
-
context: new
|
|
2230
|
+
message: Jo(e, a),
|
|
2231
|
+
context: new Vo(t)
|
|
2227
2232
|
};
|
|
2228
|
-
Q.conversationId && (n.conversationId = Q.conversationId), await
|
|
2233
|
+
Q.conversationId && (n.conversationId = Q.conversationId), await S({ text: "Attempting to generate a cypher query from your prompt..." }, o);
|
|
2229
2234
|
const s = await le(`${r}/chat`, {
|
|
2230
2235
|
method: "post",
|
|
2231
2236
|
body: JSON.stringify(n),
|
|
2232
2237
|
headers: {
|
|
2233
2238
|
"Content-Type": "application/json",
|
|
2234
|
-
token: ce.findCredential(
|
|
2239
|
+
token: ce.findCredential(k.getDefault().url)?.token ?? ""
|
|
2235
2240
|
}
|
|
2236
2241
|
});
|
|
2237
2242
|
if (s.httpStatus !== 200)
|
|
@@ -2243,7 +2248,7 @@ async function ie(e, t, r, o, a) {
|
|
|
2243
2248
|
const u = Date.now();
|
|
2244
2249
|
let l = s.data.sequenceNumber, d = "", p = "", h = 1;
|
|
2245
2250
|
for (; !c; ) {
|
|
2246
|
-
await new Promise((w) => setTimeout(w, 1e3)), await
|
|
2251
|
+
await new Promise((w) => setTimeout(w, 1e3)), await S(
|
|
2247
2252
|
{ text: `Periodically requesting status of job from ArcGIS AI Services${"...".substring(0, h)}` },
|
|
2248
2253
|
o
|
|
2249
2254
|
), h = h % 3 + 1;
|
|
@@ -2256,7 +2261,7 @@ async function ie(e, t, r, o, a) {
|
|
|
2256
2261
|
}),
|
|
2257
2262
|
headers: {
|
|
2258
2263
|
"Content-Type": "application/json",
|
|
2259
|
-
token: ce.findCredential(
|
|
2264
|
+
token: ce.findCredential(k.getDefault().url)?.token ?? ""
|
|
2260
2265
|
}
|
|
2261
2266
|
});
|
|
2262
2267
|
if (m.httpStatus !== 200)
|
|
@@ -2273,8 +2278,8 @@ async function ie(e, t, r, o, a) {
|
|
|
2273
2278
|
}
|
|
2274
2279
|
return { graphQuery: d, explanation: p };
|
|
2275
2280
|
}
|
|
2276
|
-
const
|
|
2277
|
-
function
|
|
2281
|
+
const I = 3;
|
|
2282
|
+
function $e(e, t = 100) {
|
|
2278
2283
|
const r = {};
|
|
2279
2284
|
for (const o of Object.entries(e.properties ?? {})) {
|
|
2280
2285
|
const [a, n] = o;
|
|
@@ -2285,7 +2290,7 @@ function Re(e, t = 100) {
|
|
|
2285
2290
|
function se(e) {
|
|
2286
2291
|
return typeof e != "object" || e === null ? String(e) : "details" in e && typeof e.details == "object" && e.details !== null && "errorMessage" in e.details && typeof e.details.errorMessage == "string" ? e.details.errorMessage : "message" in e && typeof e.message == "string" ? e.message : String(e);
|
|
2287
2292
|
}
|
|
2288
|
-
const
|
|
2293
|
+
const Yo = async ({
|
|
2289
2294
|
kg: e,
|
|
2290
2295
|
queryParams: t,
|
|
2291
2296
|
targetStructure: r,
|
|
@@ -2300,7 +2305,7 @@ const Zo = async ({
|
|
|
2300
2305
|
};
|
|
2301
2306
|
d && (d.aborted ? l.abort(d.reason) : d.addEventListener("abort", p, { once: !0 }));
|
|
2302
2307
|
try {
|
|
2303
|
-
const h = await
|
|
2308
|
+
const h = await ht(e, t, a);
|
|
2304
2309
|
c = h.resultHeader;
|
|
2305
2310
|
const m = h.resultRowsStream.getReader();
|
|
2306
2311
|
let w = 0;
|
|
@@ -2311,10 +2316,10 @@ const Zo = async ({
|
|
|
2311
2316
|
break;
|
|
2312
2317
|
if (!g && s && Date.now() - y > s)
|
|
2313
2318
|
return l.abort(), { type: "timeout" };
|
|
2314
|
-
for (const
|
|
2319
|
+
for (const v of E) {
|
|
2315
2320
|
if (w++, n && w > n)
|
|
2316
2321
|
return l.abort(), { type: "success", rowLimitReached: !0, resultHeader: c, processedResult: u };
|
|
2317
|
-
u = o(u,
|
|
2322
|
+
u = o(u, v);
|
|
2318
2323
|
}
|
|
2319
2324
|
}
|
|
2320
2325
|
} catch (h) {
|
|
@@ -2324,7 +2329,7 @@ const Zo = async ({
|
|
|
2324
2329
|
}
|
|
2325
2330
|
return { type: "success", rowLimitReached: !1, resultHeader: c, processedResult: u };
|
|
2326
2331
|
};
|
|
2327
|
-
async function
|
|
2332
|
+
async function Ee({
|
|
2328
2333
|
prompt: e,
|
|
2329
2334
|
kg: t,
|
|
2330
2335
|
graphQueryServiceUrl: r,
|
|
@@ -2336,7 +2341,7 @@ async function $e({
|
|
|
2336
2341
|
config: u
|
|
2337
2342
|
}) {
|
|
2338
2343
|
let l;
|
|
2339
|
-
for (let d = 1; d <=
|
|
2344
|
+
for (let d = 1; d <= I; d++) {
|
|
2340
2345
|
let p;
|
|
2341
2346
|
try {
|
|
2342
2347
|
p = await ie(e, t.dataModel, r, u, l);
|
|
@@ -2347,15 +2352,15 @@ async function $e({
|
|
|
2347
2352
|
error: w
|
|
2348
2353
|
};
|
|
2349
2354
|
}
|
|
2350
|
-
await
|
|
2355
|
+
await S(
|
|
2351
2356
|
{
|
|
2352
2357
|
text: `Attempting to execute query: ${p.graphQuery.substring(0, 500)}${p.graphQuery.length > 500 ? "..." : ""}`
|
|
2353
2358
|
},
|
|
2354
2359
|
u
|
|
2355
2360
|
);
|
|
2356
|
-
const h = await
|
|
2361
|
+
const h = await Yo({
|
|
2357
2362
|
kg: t,
|
|
2358
|
-
queryParams: new
|
|
2363
|
+
queryParams: new we({
|
|
2359
2364
|
openCypherQuery: p.graphQuery
|
|
2360
2365
|
}),
|
|
2361
2366
|
targetStructure: o,
|
|
@@ -2380,7 +2385,7 @@ async function $e({
|
|
|
2380
2385
|
graphQuery: p.graphQuery,
|
|
2381
2386
|
explanation: p.explanation
|
|
2382
2387
|
};
|
|
2383
|
-
if (d >=
|
|
2388
|
+
if (d >= I)
|
|
2384
2389
|
return h.type === "timeout" ? {
|
|
2385
2390
|
type: "timeout",
|
|
2386
2391
|
errorMessage: m,
|
|
@@ -2397,16 +2402,16 @@ async function $e({
|
|
|
2397
2402
|
failedGraphQuery: p.graphQuery,
|
|
2398
2403
|
executionError: m,
|
|
2399
2404
|
attemptCount: d
|
|
2400
|
-
}, await
|
|
2405
|
+
}, await S(
|
|
2401
2406
|
{ text: `Attempt ${d} failed with error: ${m}. Retrying...` },
|
|
2402
2407
|
u
|
|
2403
2408
|
);
|
|
2404
2409
|
}
|
|
2405
2410
|
throw new Error(
|
|
2406
|
-
`Failed to execute generated cypher due to an unexpected error after ${
|
|
2411
|
+
`Failed to execute generated cypher due to an unexpected error after ${I} attempts.`
|
|
2407
2412
|
);
|
|
2408
2413
|
}
|
|
2409
|
-
const
|
|
2414
|
+
const Xo = async ({
|
|
2410
2415
|
kg: e,
|
|
2411
2416
|
searchQuery: t,
|
|
2412
2417
|
typeCategoryFilter: r,
|
|
@@ -2423,9 +2428,9 @@ const Yo = async ({
|
|
|
2423
2428
|
const d = u - s.length;
|
|
2424
2429
|
if (d <= 0)
|
|
2425
2430
|
break;
|
|
2426
|
-
const m = (await
|
|
2431
|
+
const m = (await mt(
|
|
2427
2432
|
e,
|
|
2428
|
-
new
|
|
2433
|
+
new yt({
|
|
2429
2434
|
searchQuery: t,
|
|
2430
2435
|
typeCategoryFilter: l,
|
|
2431
2436
|
namedTypesFilter: o ?? void 0,
|
|
@@ -2455,7 +2460,7 @@ const Yo = async ({
|
|
|
2455
2460
|
results: s
|
|
2456
2461
|
};
|
|
2457
2462
|
};
|
|
2458
|
-
function
|
|
2463
|
+
function ea(e, t) {
|
|
2459
2464
|
D(e, (r) => {
|
|
2460
2465
|
t.set(`${r.typeName}__${r.id}`, {
|
|
2461
2466
|
id: r.id,
|
|
@@ -2465,29 +2470,29 @@ function Xo(e, t) {
|
|
|
2465
2470
|
}
|
|
2466
2471
|
function D(e, t) {
|
|
2467
2472
|
if (!(!e || typeof e != "object")) {
|
|
2468
|
-
if (
|
|
2473
|
+
if (ra(e))
|
|
2469
2474
|
for (const r of e.path)
|
|
2470
2475
|
D(r, t);
|
|
2471
|
-
else if (
|
|
2476
|
+
else if (ta(e))
|
|
2472
2477
|
t(e);
|
|
2473
2478
|
else if (Array.isArray(e))
|
|
2474
2479
|
for (const r of e)
|
|
2475
2480
|
D(r, t);
|
|
2476
|
-
else if (
|
|
2481
|
+
else if (oa(e))
|
|
2477
2482
|
for (const r of Object.values(e.properties ?? {}))
|
|
2478
2483
|
D(r, t);
|
|
2479
2484
|
}
|
|
2480
2485
|
}
|
|
2481
|
-
function
|
|
2486
|
+
function ta(e) {
|
|
2482
2487
|
return !e || typeof e != "object" || Array.isArray(e) ? !1 : "id" in e && "typeName" in e;
|
|
2483
2488
|
}
|
|
2484
|
-
function
|
|
2489
|
+
function ra(e) {
|
|
2485
2490
|
return !e || typeof e != "object" || Array.isArray(e) ? !1 : e && "path" in e && Array.isArray(e.path);
|
|
2486
2491
|
}
|
|
2487
|
-
function
|
|
2492
|
+
function oa(e) {
|
|
2488
2493
|
return !e || typeof e != "object" || Array.isArray(e) || "id" in e ? !1 : "properties" in e && typeof e.properties == "object";
|
|
2489
2494
|
}
|
|
2490
|
-
function
|
|
2495
|
+
function aa(e, t) {
|
|
2491
2496
|
const r = [];
|
|
2492
2497
|
for (const o of [...t.dataModel.entityTypes, ...t.dataModel.relationshipTypes]) {
|
|
2493
2498
|
const a = e.getMemberIdsByType(o.name);
|
|
@@ -2496,7 +2501,7 @@ function oa(e, t) {
|
|
|
2496
2501
|
}
|
|
2497
2502
|
return r;
|
|
2498
2503
|
}
|
|
2499
|
-
function
|
|
2504
|
+
function na(e) {
|
|
2500
2505
|
const t = [], r = [], a = e?.allLayers.find((n) => n.type === "knowledge-graph")?.inclusionModeDefinition;
|
|
2501
2506
|
if (a?.generateAllSublayers)
|
|
2502
2507
|
return { allNamedTypesFullyDynamic: !0, idTypePairs: t, dynamicTypes: r };
|
|
@@ -2508,15 +2513,15 @@ function aa(e) {
|
|
|
2508
2513
|
t.push({ id: c, typeName: n });
|
|
2509
2514
|
return { allNamedTypesFullyDynamic: !1, idTypePairs: t, dynamicTypes: r };
|
|
2510
2515
|
}
|
|
2511
|
-
async function
|
|
2512
|
-
const { view: n } = o, s = await
|
|
2516
|
+
async function ia(e, t, r, o, a) {
|
|
2517
|
+
const { view: n } = o, s = await Ee({
|
|
2513
2518
|
prompt: e,
|
|
2514
2519
|
kg: t,
|
|
2515
2520
|
graphQueryServiceUrl: r,
|
|
2516
2521
|
targetStructure: /* @__PURE__ */ new Map(),
|
|
2517
2522
|
targetStructureReducer: (p, h) => {
|
|
2518
2523
|
for (const m of h)
|
|
2519
|
-
|
|
2524
|
+
ea(m, p);
|
|
2520
2525
|
return p;
|
|
2521
2526
|
},
|
|
2522
2527
|
requestOptions: {
|
|
@@ -2530,7 +2535,7 @@ async function na(e, t, r, o, a) {
|
|
|
2530
2535
|
throw new Error(`Failed to add records to the link chart. ${p}`);
|
|
2531
2536
|
}
|
|
2532
2537
|
const { graphQuery: c, explanation: u, processedResult: l } = s, d = Array.from(l.values());
|
|
2533
|
-
return await
|
|
2538
|
+
return await S(
|
|
2534
2539
|
{
|
|
2535
2540
|
text: `Query Results parsed into ${d.length} unique relationships and entities. Atempting to add to link chart...`
|
|
2536
2541
|
},
|
|
@@ -2545,26 +2550,26 @@ ${c}
|
|
|
2545
2550
|
|
|
2546
2551
|
Explanation: ${u}`);
|
|
2547
2552
|
}
|
|
2548
|
-
const
|
|
2553
|
+
const Ce = "addRecords", sa = i.object({
|
|
2549
2554
|
prompt: i.string().describe("The user's inquiry into the knowledge graph that needs to be run.")
|
|
2550
|
-
}),
|
|
2551
|
-
const { knowledgeGraph: r } = await G(t), o = H(t), { view: a } = o, s =
|
|
2555
|
+
}), ca = async ({ prompt: e }, t) => {
|
|
2556
|
+
const { knowledgeGraph: r } = await G(t), o = H(t), { view: a } = o, s = k.getDefault().helperServices;
|
|
2552
2557
|
let c = e;
|
|
2553
|
-
if (z(a)) {
|
|
2554
|
-
const l = a.map,
|
|
2558
|
+
if (!z(a) && a.map) {
|
|
2559
|
+
const l = a.map, d = await Y("arcgis_knowledge_current_lc_context"), p = aa(l, r);
|
|
2560
|
+
c = `${e}
|
|
2561
|
+
|
|
2562
|
+
${d}${JSON.stringify(p)}`;
|
|
2563
|
+
} else {
|
|
2564
|
+
const l = a.map, { allNamedTypesFullyDynamic: d, idTypePairs: p, dynamicTypes: h } = na(l), m = await Y("arcgis_knowledge_current_map_context");
|
|
2555
2565
|
if (c = `${e}
|
|
2556
2566
|
|
|
2557
2567
|
${m}${JSON.stringify(p)} and all entities or relationships with the the following typeNames in the array: ${JSON.stringify(h)}`, d)
|
|
2558
2568
|
throw new Error(
|
|
2559
2569
|
"No records have been added to the map because all data in the knowledge graph is contained in the map."
|
|
2560
2570
|
);
|
|
2561
|
-
} else {
|
|
2562
|
-
const l = a.map, d = await Y("arcgis_knowledge_current_lc_context"), p = oa(l, r);
|
|
2563
|
-
c = `${e}
|
|
2564
|
-
|
|
2565
|
-
${d}${JSON.stringify(p)}`;
|
|
2566
2571
|
}
|
|
2567
|
-
const u = await
|
|
2572
|
+
const u = await ia(
|
|
2568
2573
|
c,
|
|
2569
2574
|
r,
|
|
2570
2575
|
`${s.aiAssistantServices.url}${s.aiAssistantServices.graphQueryAssistant}`,
|
|
@@ -2572,19 +2577,19 @@ ${d}${JSON.stringify(p)}`;
|
|
|
2572
2577
|
t
|
|
2573
2578
|
);
|
|
2574
2579
|
return {
|
|
2575
|
-
toolName:
|
|
2580
|
+
toolName: Ce,
|
|
2576
2581
|
status: "success",
|
|
2577
2582
|
summary: u
|
|
2578
2583
|
};
|
|
2579
|
-
},
|
|
2580
|
-
name:
|
|
2584
|
+
}, Yn = f(ca, {
|
|
2585
|
+
name: Ce,
|
|
2581
2586
|
description: "Adds records (entities or relationships) to the current link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the records to be added to the link chart. The user should have explicitly requested to add records to the current link chart from their prompt.",
|
|
2582
|
-
schema:
|
|
2587
|
+
schema: sa
|
|
2583
2588
|
});
|
|
2584
|
-
async function
|
|
2589
|
+
async function la(e, t) {
|
|
2585
2590
|
return await t.map?.applyLayout(e), await B(t), `Successfully applied layout: ${e}.`;
|
|
2586
2591
|
}
|
|
2587
|
-
const ee = "applyLayout",
|
|
2592
|
+
const ee = "applyLayout", ua = i.object({
|
|
2588
2593
|
layout: i.enum([
|
|
2589
2594
|
"organic-standard",
|
|
2590
2595
|
"organic-community",
|
|
@@ -2598,7 +2603,7 @@ const ee = "applyLayout", la = i.object({
|
|
|
2598
2603
|
]).describe(
|
|
2599
2604
|
"The layout mode to apply to the link chart. The value must be one of the following: organic-standard, organic-community, basic-grid, hierarchical-bottom-to-top, radial-root-centric, tree-left-to-right, geographic-organic-standard, chronological-mono-timeline, chronological-multi-timeline"
|
|
2600
2605
|
)
|
|
2601
|
-
}),
|
|
2606
|
+
}), da = async ({ layout: e }, t) => {
|
|
2602
2607
|
const { view: r } = H(t);
|
|
2603
2608
|
if (z(r))
|
|
2604
2609
|
return {
|
|
@@ -2608,24 +2613,24 @@ const ee = "applyLayout", la = i.object({
|
|
|
2608
2613
|
error: new Error()
|
|
2609
2614
|
};
|
|
2610
2615
|
{
|
|
2611
|
-
const o = await
|
|
2616
|
+
const o = await la(e, r);
|
|
2612
2617
|
return {
|
|
2613
2618
|
toolName: ee,
|
|
2614
2619
|
status: "success",
|
|
2615
2620
|
summary: o
|
|
2616
2621
|
};
|
|
2617
2622
|
}
|
|
2618
|
-
},
|
|
2623
|
+
}, Xn = f(da, {
|
|
2619
2624
|
name: ee,
|
|
2620
2625
|
description: "Apply a diagram layout to the link chart",
|
|
2621
|
-
schema:
|
|
2626
|
+
schema: ua
|
|
2622
2627
|
});
|
|
2623
|
-
async function
|
|
2628
|
+
async function pa(e, t) {
|
|
2624
2629
|
return t.map?.changeNonspatialDataDisplay(e), await B(t), `Successfully applied nonspatial visibility setting: ${e}.`;
|
|
2625
2630
|
}
|
|
2626
|
-
const te = "changeNonspatialVisibility",
|
|
2631
|
+
const te = "changeNonspatialVisibility", ha = i.object({
|
|
2627
2632
|
setting: i.enum(["hidden", "visible"]).describe("The setting of nonspatial visibility")
|
|
2628
|
-
}),
|
|
2633
|
+
}), ma = async ({ setting: e }, t) => {
|
|
2629
2634
|
const { view: r } = H(t);
|
|
2630
2635
|
if (z(r))
|
|
2631
2636
|
return {
|
|
@@ -2635,21 +2640,21 @@ const te = "changeNonspatialVisibility", pa = i.object({
|
|
|
2635
2640
|
error: new Error()
|
|
2636
2641
|
};
|
|
2637
2642
|
{
|
|
2638
|
-
const o = await
|
|
2643
|
+
const o = await pa(e, r);
|
|
2639
2644
|
return {
|
|
2640
2645
|
toolName: te,
|
|
2641
2646
|
status: "success",
|
|
2642
2647
|
summary: o
|
|
2643
2648
|
};
|
|
2644
2649
|
}
|
|
2645
|
-
},
|
|
2650
|
+
}, ei = f(ma, {
|
|
2646
2651
|
name: te,
|
|
2647
2652
|
description: "Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",
|
|
2648
|
-
schema:
|
|
2653
|
+
schema: ha
|
|
2649
2654
|
});
|
|
2650
|
-
async function
|
|
2655
|
+
async function ya(e, t, r, o, a) {
|
|
2651
2656
|
let n;
|
|
2652
|
-
for (let s = 1; s <=
|
|
2657
|
+
for (let s = 1; s <= I; s++) {
|
|
2653
2658
|
const { graphQuery: c, explanation: u } = await ie(
|
|
2654
2659
|
e,
|
|
2655
2660
|
t.dataModel,
|
|
@@ -2658,16 +2663,16 @@ async function ma(e, t, r, o, a) {
|
|
|
2658
2663
|
n
|
|
2659
2664
|
);
|
|
2660
2665
|
try {
|
|
2661
|
-
await
|
|
2662
|
-
const l = await
|
|
2666
|
+
await S({ text: `Attempting to create link chart from derived query: ${c}` }, a);
|
|
2667
|
+
const l = await pt.fromCypherQuery(
|
|
2663
2668
|
t,
|
|
2664
|
-
new
|
|
2669
|
+
new we({
|
|
2665
2670
|
openCypherQuery: c
|
|
2666
2671
|
})
|
|
2667
2672
|
);
|
|
2668
|
-
await
|
|
2673
|
+
await S({ text: "Link chart created successfully, loading..." }, a), await l.load();
|
|
2669
2674
|
const d = o.map;
|
|
2670
|
-
return o.map = l, await o.when(), await
|
|
2675
|
+
return o.map = l, await o.when(), await De.whenOnce(() => !o.updating), l.entityCount === 0 && l.relationshipCount === 0 ? (o.map === l && (o.map = d), l.destroy(), {
|
|
2671
2676
|
type: "error",
|
|
2672
2677
|
message: `Query returned no results. Cypher Query used to create the link chart:
|
|
2673
2678
|
${c}
|
|
@@ -2682,27 +2687,27 @@ Explanation: ${u}`
|
|
|
2682
2687
|
});
|
|
2683
2688
|
} catch (l) {
|
|
2684
2689
|
const d = l instanceof Error ? l.message : String(l);
|
|
2685
|
-
if (s >=
|
|
2690
|
+
if (s >= I)
|
|
2686
2691
|
throw new Error(
|
|
2687
|
-
`Failed to create link chart after ${
|
|
2692
|
+
`Failed to create link chart after ${I} attempts. Last error: ${d}`
|
|
2688
2693
|
);
|
|
2689
2694
|
n = {
|
|
2690
2695
|
failedGraphQuery: c,
|
|
2691
2696
|
executionError: d,
|
|
2692
2697
|
attemptCount: s
|
|
2693
|
-
}, await
|
|
2698
|
+
}, await S(
|
|
2694
2699
|
{ text: `Attempt ${s} to create link chart failed with error: ${d}. Retrying ...` },
|
|
2695
2700
|
a
|
|
2696
2701
|
);
|
|
2697
2702
|
}
|
|
2698
2703
|
}
|
|
2699
|
-
throw new Error(`Failed to create link chart after ${
|
|
2704
|
+
throw new Error(`Failed to create link chart after ${I} attempts.`);
|
|
2700
2705
|
}
|
|
2701
|
-
const _ = "createLinkChart",
|
|
2706
|
+
const _ = "createLinkChart", fa = i.object({
|
|
2702
2707
|
prompt: i.string().describe(
|
|
2703
2708
|
"The user's inquiry into the knowledge graph that needs to be transformed into a link chart visualization."
|
|
2704
2709
|
)
|
|
2705
|
-
}),
|
|
2710
|
+
}), ga = async ({ prompt: e }, t) => {
|
|
2706
2711
|
const { knowledgeGraph: r } = await G(t), { view: o } = H(t);
|
|
2707
2712
|
if (z(o))
|
|
2708
2713
|
return {
|
|
@@ -2712,7 +2717,7 @@ const _ = "createLinkChart", ya = i.object({
|
|
|
2712
2717
|
error: new Error()
|
|
2713
2718
|
};
|
|
2714
2719
|
{
|
|
2715
|
-
const n =
|
|
2720
|
+
const n = k.getDefault().helperServices, s = await ya(
|
|
2716
2721
|
e,
|
|
2717
2722
|
r,
|
|
2718
2723
|
`${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,
|
|
@@ -2730,11 +2735,11 @@ const _ = "createLinkChart", ya = i.object({
|
|
|
2730
2735
|
summary: s.message
|
|
2731
2736
|
};
|
|
2732
2737
|
}
|
|
2733
|
-
},
|
|
2738
|
+
}, ti = f(ga, {
|
|
2734
2739
|
name: _,
|
|
2735
2740
|
description: "Creates a new link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the new link chart. The user should have explicitly requested the creation of a new link chart from their prompt.",
|
|
2736
|
-
schema:
|
|
2737
|
-
}),
|
|
2741
|
+
schema: fa
|
|
2742
|
+
}), Fe = "queryGraphData", wa = i.object({
|
|
2738
2743
|
prompt: i.string().describe(
|
|
2739
2744
|
`The user's inquiry into the knowledge graph, from which a cypher query will be generated and executed to answer the inquiry. IMPORTANT:
|
|
2740
2745
|
|
|
@@ -2742,8 +2747,8 @@ REQUEST LIMIT: If the user does not specifically request for no limits or an exp
|
|
|
2742
2747
|
|
|
2743
2748
|
DESCRIPTIVE COLUMN NAMES: If the user's prompt does not explicitly request for specific column names in the result, ensure that the generated query has descriptive column names (using AS statements) to make the results easier to understand when displayed in a table format.`
|
|
2744
2749
|
)
|
|
2745
|
-
}),
|
|
2746
|
-
const { knowledgeGraph: r } = await G(t), a =
|
|
2750
|
+
}), ba = async ({ prompt: e }, t) => {
|
|
2751
|
+
const { knowledgeGraph: r } = await G(t), a = k.getDefault().helperServices, n = await Ee({
|
|
2747
2752
|
prompt: e,
|
|
2748
2753
|
kg: r,
|
|
2749
2754
|
graphQueryServiceUrl: `${a.aiAssistantServices.url}${a.aiAssistantServices.graphQueryAssistant}`,
|
|
@@ -2764,11 +2769,11 @@ DESCRIPTIVE COLUMN NAMES: If the user's prompt does not explicitly request for s
|
|
|
2764
2769
|
for (const m of h)
|
|
2765
2770
|
D(
|
|
2766
2771
|
m,
|
|
2767
|
-
(w) =>
|
|
2772
|
+
(w) => $e(w)
|
|
2768
2773
|
);
|
|
2769
2774
|
const d = 50, p = c.slice(0, d).map((h) => JSON.stringify(h));
|
|
2770
2775
|
return {
|
|
2771
|
-
toolName:
|
|
2776
|
+
toolName: Fe,
|
|
2772
2777
|
status: "success",
|
|
2773
2778
|
summary: `To answer the inquiry, the following cypher query was executed against the knowledge graph:
|
|
2774
2779
|
|
|
@@ -2794,14 +2799,14 @@ ${p.length > d ? `Showing top ${d} results:
|
|
|
2794
2799
|
queryResults: c
|
|
2795
2800
|
}
|
|
2796
2801
|
};
|
|
2797
|
-
},
|
|
2798
|
-
name:
|
|
2802
|
+
}, ri = f(ba, {
|
|
2803
|
+
name: Fe,
|
|
2799
2804
|
description: "Allows users to explore the data in their knowledge graph via cypher query. Generates and executes a cypher query based on the user's inquiry into the knowledge graph, and displays the results in the chat pane without modifying the user's link chart if any. Use this tool when the user is asking an exploratory question about their data as a whole that can be answered via cypher query, for example 'What are the top 5 suppliers by total parts cost?' or 'How many employees do we have in each department?'.",
|
|
2800
|
-
schema:
|
|
2801
|
-
}), Ie = "generateCypher",
|
|
2805
|
+
schema: wa
|
|
2806
|
+
}), Ie = "generateCypher", Ta = i.object({
|
|
2802
2807
|
prompt: i.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")
|
|
2803
|
-
}),
|
|
2804
|
-
const { knowledgeGraph: r } = await G(t), a =
|
|
2808
|
+
}), va = async ({ prompt: e }, t) => {
|
|
2809
|
+
const { knowledgeGraph: r } = await G(t), a = k.getDefault().helperServices, n = await Zo(
|
|
2805
2810
|
e,
|
|
2806
2811
|
r.dataModel,
|
|
2807
2812
|
`${a.aiAssistantServices.url}${a.aiAssistantServices.graphQueryAssistant}`,
|
|
@@ -2812,10 +2817,10 @@ ${p.length > d ? `Showing top ${d} results:
|
|
|
2812
2817
|
status: "success",
|
|
2813
2818
|
summary: n
|
|
2814
2819
|
};
|
|
2815
|
-
},
|
|
2820
|
+
}, oi = f(va, {
|
|
2816
2821
|
name: Ie,
|
|
2817
2822
|
description: "Generates an Open Cypher query based on the user's prompt which represents an inquiry into the data of the knowledge service and its graph database, attempting to filter based on certain conditions and traverse specified relationships. The generated query should be syntactically correct and optimized for performance.",
|
|
2818
|
-
schema:
|
|
2823
|
+
schema: Ta
|
|
2819
2824
|
}), Sa = (e) => {
|
|
2820
2825
|
const t = e.dataModel, r = /* @__PURE__ */ new Map();
|
|
2821
2826
|
for (const c of t.searchIndexes)
|
|
@@ -2833,7 +2838,7 @@ ${a.map(({ name: c }) => `${c}: [${Array.from(r.get(c) ?? []).join(", ")}]`).joi
|
|
|
2833
2838
|
|
|
2834
2839
|
${s}`;
|
|
2835
2840
|
};
|
|
2836
|
-
async function
|
|
2841
|
+
async function xa(e, t) {
|
|
2837
2842
|
const r = await Y("arcgis_knowledge_lucene_generation_prompt"), o = {
|
|
2838
2843
|
inquiry: e,
|
|
2839
2844
|
dataModelForSearch: Sa(t)
|
|
@@ -2851,22 +2856,22 @@ async function va(e, t) {
|
|
|
2851
2856
|
typeCategoryFilter: a,
|
|
2852
2857
|
resultLimit: n
|
|
2853
2858
|
});
|
|
2854
|
-
return await
|
|
2859
|
+
return await qe({
|
|
2855
2860
|
promptText: r,
|
|
2856
2861
|
inputVariables: o,
|
|
2857
2862
|
schema: c
|
|
2858
2863
|
});
|
|
2859
2864
|
}
|
|
2860
|
-
const ke = "searchGraphData",
|
|
2865
|
+
const ke = "searchGraphData", Ra = i.object({
|
|
2861
2866
|
prompt: i.string().describe(
|
|
2862
2867
|
"The user's inquiry into the knowledge graph, from which a lucene search query will be generated and executed against the graph to return relevant results."
|
|
2863
2868
|
)
|
|
2864
|
-
}),
|
|
2869
|
+
}), $a = async ({ prompt: e }, t) => {
|
|
2865
2870
|
const { knowledgeGraph: r } = await G(t);
|
|
2866
|
-
await
|
|
2867
|
-
const o = await
|
|
2868
|
-
await
|
|
2869
|
-
const a = await
|
|
2871
|
+
await S({ text: "Generating search query for the user inquiry" }, t);
|
|
2872
|
+
const o = await xa(e, r);
|
|
2873
|
+
await S({ text: "Executing graph search with generated search query" }, t);
|
|
2874
|
+
const a = await Xo({
|
|
2870
2875
|
kg: r,
|
|
2871
2876
|
searchQuery: o.query,
|
|
2872
2877
|
typeCategoryFilter: o.typeCategoryFilter,
|
|
@@ -2884,7 +2889,7 @@ const ke = "searchGraphData", xa = i.object({
|
|
|
2884
2889
|
for (const c of a.results)
|
|
2885
2890
|
D(
|
|
2886
2891
|
c,
|
|
2887
|
-
(u) =>
|
|
2892
|
+
(u) => $e(u)
|
|
2888
2893
|
);
|
|
2889
2894
|
const n = 10, s = a.results.slice(0, n);
|
|
2890
2895
|
return {
|
|
@@ -2909,56 +2914,56 @@ const ke = "searchGraphData", xa = i.object({
|
|
|
2909
2914
|
}
|
|
2910
2915
|
}
|
|
2911
2916
|
};
|
|
2912
|
-
},
|
|
2917
|
+
}, ai = f($a, {
|
|
2913
2918
|
name: ke,
|
|
2914
2919
|
description: "Allows users to search the knowledge graph for text matching their inquiry, using lucene search syntax, against indexed string properties defined on their entities and relationships. Use this tool when the user asks a question about their knowledge graph data as a whole, that could be answered via lucene text search of properties stored on graph elements, e.g requiring fuzzy matching. Otherwise if the inquiry is looking for connected records (e.g. paths), data aggregations, etc explore the data via the queryGraphData tool.",
|
|
2915
|
-
schema:
|
|
2920
|
+
schema: Ra
|
|
2916
2921
|
});
|
|
2917
2922
|
export {
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2923
|
+
qn as A,
|
|
2924
|
+
Dn as B,
|
|
2925
|
+
An as C,
|
|
2926
|
+
Ln as D,
|
|
2927
|
+
Pn as E,
|
|
2928
|
+
jn as F,
|
|
2924
2929
|
ne as G,
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2930
|
+
Bn as H,
|
|
2931
|
+
Gn as I,
|
|
2932
|
+
On as J,
|
|
2933
|
+
Mn as K,
|
|
2934
|
+
Qn as L,
|
|
2935
|
+
_n as M,
|
|
2936
|
+
vn as N,
|
|
2937
|
+
Vn as O,
|
|
2938
|
+
Un as P,
|
|
2939
|
+
Mo as Q,
|
|
2935
2940
|
N as R,
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2941
|
+
Wn as S,
|
|
2942
|
+
Kn as T,
|
|
2943
|
+
Xn as a,
|
|
2944
|
+
oi as b,
|
|
2945
|
+
ei as c,
|
|
2946
|
+
ti as d,
|
|
2947
|
+
Yn as e,
|
|
2948
|
+
be as f,
|
|
2944
2949
|
Y as g,
|
|
2945
|
-
|
|
2950
|
+
Zn as h,
|
|
2946
2951
|
G as i,
|
|
2947
|
-
|
|
2952
|
+
Jn as j,
|
|
2948
2953
|
Sn as k,
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2954
|
+
Hn as l,
|
|
2955
|
+
xn as m,
|
|
2956
|
+
Rn as n,
|
|
2957
|
+
$n as o,
|
|
2958
|
+
En as p,
|
|
2959
|
+
ri as q,
|
|
2960
|
+
Nn as r,
|
|
2961
|
+
ai as s,
|
|
2962
|
+
Wt as t,
|
|
2963
|
+
Cn as u,
|
|
2964
|
+
Fn as v,
|
|
2960
2965
|
In as w,
|
|
2961
2966
|
kn as x,
|
|
2962
2967
|
$ as y,
|
|
2963
|
-
|
|
2968
|
+
zn as z
|
|
2964
2969
|
};
|