@arcgis/ai-components 5.2.0-next.87 → 5.2.0-next.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,19 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { c as q } from "../../chunks/runtime.js";
3
- import { LitElement as L } from "@arcgis/lumina";
4
- import { b as M, i as W } from "../../chunks/utils2.js";
5
- import F from "@arcgis/core/portal/PortalItem.js";
3
+ import { LitElement as M } from "@arcgis/lumina";
4
+ import { b as W, i as L } from "../../chunks/utils2.js";
5
+ import C from "@arcgis/core/portal/PortalItem.js";
6
6
  import j from "@arcgis/core/portal/Portal.js";
7
7
  import { property as n, subclass as l } from "@arcgis/core/core/accessorSupport/decorators.js";
8
8
  import { BaseAgent as G } from "../../agent-utils/BaseAgent.js";
9
9
  import b from "@arcgis/core/core/Error.js";
10
10
  import { z as c } from "zod";
11
11
  import { c as B } from "../../chunks/graph.js";
12
- import S from "@arcgis/core/core/Accessor.js";
13
- import { LLMAgent as Z } from "../../agent-utils/LLMAgent.js";
14
- import { PromptTemplate as z } from "@langchain/core/prompts";
12
+ import T from "@arcgis/core/core/Accessor.js";
13
+ import { LLMAgent as z } from "../../agent-utils/LLMAgent.js";
14
+ import { PromptTemplate as Z } from "@langchain/core/prompts";
15
15
  import { Annotation as x } from "@langchain/langgraph";
16
- import { b as H, d as V } from "../../chunks/state.js";
16
+ import { b as H, d as U } from "../../chunks/state.js";
17
17
  import "@arcgis/core/identity/IdentityManager.js";
18
18
  import "@arcgis/core/request.js";
19
19
  import "@langchain/langgraph/web";
@@ -25,26 +25,26 @@ import "@langchain/openai";
25
25
  import "@arcgis/core/config.js";
26
26
  import "@arcgis/core/core/reactiveUtils.js";
27
27
  import "@arcgis/core/layers/FeatureLayer.js";
28
- import { a as U } from "../../chunks/baseAgentState.js";
29
- var K = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, f = (e, t, r, s) => {
30
- for (var o = s > 1 ? void 0 : s ? Q(t, r) : t, a = e.length - 1, i; a >= 0; a--)
31
- (i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
32
- return s && o && K(t, r, o), o;
28
+ import { a as V } from "../../chunks/baseAgentState.js";
29
+ var K = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, f = (t, e, r, s) => {
30
+ for (var o = s > 1 ? void 0 : s ? Q(e, r) : e, a = t.length - 1, i; a >= 0; a--)
31
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
32
+ return s && o && K(e, r, o), o;
33
33
  };
34
- let p = class extends S {
34
+ let p = class extends T {
35
35
  //#region Lifecycle
36
- constructor(e) {
37
- super(e);
36
+ constructor(t) {
37
+ super(t);
38
38
  }
39
39
  //#endregion
40
40
  //#region Public Methods
41
- static fromJSON(e) {
41
+ static fromJSON(t) {
42
42
  return new p({
43
- id: e.id,
44
- sourceAnchorId: e.source_anchor_id,
45
- sourceNodeId: e.source_node_id,
46
- targetAnchorId: e.target_anchor_id,
47
- targetNodeId: e.target_node_id
43
+ id: t.id,
44
+ sourceAnchorId: t.source_anchor_id,
45
+ sourceNodeId: t.source_node_id,
46
+ targetAnchorId: t.target_anchor_id,
47
+ targetNodeId: t.target_node_id
48
48
  });
49
49
  }
50
50
  //#endregion
@@ -67,31 +67,31 @@ f([
67
67
  p = f([
68
68
  l("Edge")
69
69
  ], p);
70
- var X = Object.defineProperty, Y = Object.getOwnPropertyDescriptor, v = (e, t, r, s) => {
71
- for (var o = s > 1 ? void 0 : s ? Y(t, r) : t, a = e.length - 1, i; a >= 0; a--)
72
- (i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
73
- return s && o && X(t, r, o), o;
70
+ var X = Object.defineProperty, Y = Object.getOwnPropertyDescriptor, v = (t, e, r, s) => {
71
+ for (var o = s > 1 ? void 0 : s ? Y(e, r) : e, a = t.length - 1, i; a >= 0; a--)
72
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
73
+ return s && o && X(e, r, o), o;
74
74
  };
75
- let m = class extends S {
75
+ let m = class extends T {
76
76
  //#region Lifecycle
77
- constructor(e) {
78
- super(e);
77
+ constructor(t) {
78
+ super(t);
79
79
  }
80
80
  //#endregion
81
81
  //#region Public Methods
82
82
  async load() {
83
83
  return await Promise.resolve(this);
84
84
  }
85
- compile(e) {
85
+ compile(t) {
86
86
  return {
87
87
  runtimeNode: this.createRuntimeNode(),
88
- edges: e.outgoingEdges.map((t) => ({
88
+ edges: t.outgoingEdges.map((e) => ({
89
89
  from: this.id,
90
- to: t.targetNodeId
90
+ to: e.targetNodeId
91
91
  }))
92
92
  };
93
93
  }
94
- static fromJSON(e) {
94
+ static fromJSON(t) {
95
95
  throw new Error("BaseNode is abstract and cannot be instantiated directly.");
96
96
  }
97
97
  //#endregion
@@ -110,144 +110,144 @@ v([
110
110
  m = v([
111
111
  l("BaseNode")
112
112
  ], m);
113
- function C(e) {
114
- const t = new Set(e.required), r = Object.fromEntries(
115
- Object.entries(e.properties).map(([s, o]) => {
116
- const a = I(o);
117
- return [s, t.has(s) ? a : a.optional()];
113
+ function I(t) {
114
+ const e = new Set(t.required), r = Object.fromEntries(
115
+ Object.entries(t.properties).map(([s, o]) => {
116
+ const a = $(o);
117
+ return [s, e.has(s) ? a : a.optional()];
118
118
  })
119
119
  );
120
120
  return c.object(r);
121
121
  }
122
- function I(e) {
123
- let t;
124
- switch (e.type) {
122
+ function $(t) {
123
+ let e;
124
+ switch (t.type) {
125
125
  case "array":
126
- t = c.array(e.items ? I(e.items) : c.unknown());
126
+ e = c.array(t.items ? $(t.items) : c.unknown());
127
127
  break;
128
128
  case "boolean":
129
- t = c.boolean();
129
+ e = c.boolean();
130
130
  break;
131
131
  case "number":
132
- t = c.number();
132
+ e = c.number();
133
133
  break;
134
134
  case "object":
135
- t = C({
136
- properties: e.properties ?? {},
137
- required: e.required
135
+ e = I({
136
+ properties: t.properties ?? {},
137
+ required: t.required
138
138
  });
139
139
  break;
140
140
  case "string":
141
- t = e.enum?.length ? c.enum(e.enum) : c.string();
141
+ e = t.enum?.length ? c.enum(t.enum) : c.string();
142
142
  break;
143
143
  }
144
- return e.description ? t.describe(e.description) : t;
144
+ return t.description ? e.describe(t.description) : e;
145
145
  }
146
146
  const k = /* @__PURE__ */ new Map([
147
147
  [
148
- "clearFilters",
148
+ "clear_filters",
149
149
  async () => (await import("../../agents/tools/filter/clearFilters/adapter.js")).clearFiltersTool
150
150
  ],
151
151
  [
152
- "resetMap",
152
+ "reset_map",
153
153
  async () => (await import("../../agents/tools/filter/resetMap/adapter.js")).resetMapTool
154
154
  ],
155
155
  [
156
- "setFeatureEffect",
156
+ "set_feature_effect",
157
157
  async () => (await import("../../agents/tools/filter/setFeatureEffect/adapter.js")).setFeatureEffectTool
158
158
  ],
159
159
  [
160
- "listLayerFields",
160
+ "list_layer_fields",
161
161
  async () => (await import("../../agents/tools/help/listFields/adapter.js")).listLayerFieldsTool
162
162
  ],
163
163
  [
164
- "goToAddress",
164
+ "go_to_address",
165
165
  async () => (await import("../../agents/tools/navigation/goToAddress/adapter.js")).goToAddressTool
166
166
  ],
167
167
  [
168
- "goToBookmark",
168
+ "go_to_bookmark",
169
169
  async () => (await import("../../agents/tools/navigation/goToBookmark/adapter.js")).goToBookmarkTool
170
170
  ],
171
171
  [
172
- "goToFeatures",
172
+ "go_to_features",
173
173
  async () => (await import("../../agents/tools/navigation/goToFeatures/adapter.js")).goToFeaturesTool
174
174
  ],
175
175
  [
176
- "goToFullExtent",
176
+ "go_to_full_extent",
177
177
  async () => (await import("../../agents/tools/navigation/goToFullExtent/adapter.js")).goToFullExtentTool
178
178
  ],
179
179
  [
180
- "goToHomeExtent",
180
+ "go_to_home_extent",
181
181
  async () => (await import("../../agents/tools/navigation/goToHomeExtent/adapter.js")).goToHomeExtentTool
182
182
  ],
183
183
  [
184
- "goToLayer",
184
+ "go_to_layer",
185
185
  async () => (await import("../../agents/tools/navigation/goToLayer/adapter.js")).goToLayerTool
186
186
  ],
187
187
  [
188
- "goToScale",
188
+ "go_to_scale",
189
189
  async () => (await import("../../agents/tools/navigation/goToScale/adapter.js")).goToScaleTool
190
190
  ],
191
191
  [
192
- "goToViewpoint",
192
+ "go_to_viewpoint",
193
193
  async () => (await import("../../agents/tools/navigation/goToViewpoint/adapter.js")).goToViewpointTool
194
194
  ],
195
195
  [
196
- "goToZoom",
196
+ "go_to_zoom",
197
197
  async () => (await import("../../agents/tools/navigation/goToZoom/adapter.js")).goToZoomTool
198
198
  ],
199
199
  [
200
- "findRelevantFields",
200
+ "find_relevant_fields",
201
201
  async () => (await import("../../agents/tools/search/findRelevantFields/adapter.js")).findRelevantFieldsTool
202
202
  ],
203
203
  [
204
- "findRelevantLayers",
204
+ "find_relevant_layers",
205
205
  async () => (await import("../../agents/tools/search/findRelevantLayers/adapter.js")).findRelevantLayersTool
206
206
  ],
207
207
  [
208
- "getAttribute",
208
+ "get_attribute",
209
209
  async () => (await import("../../agents/tools/query/getAttribute/adapter.js")).getAttributeTool
210
210
  ],
211
211
  [
212
- "getStatistics",
212
+ "get_statistics",
213
213
  async () => (await import("../../agents/tools/query/getStatistics/adapter.js")).getStatisticsTool
214
214
  ],
215
215
  [
216
- "getTopFeatures",
216
+ "get_top_features",
217
217
  async () => (await import("../../agents/tools/query/getTopFeatures/adapter.js")).getTopFeaturesTool
218
218
  ],
219
219
  [
220
- "queryFeatures",
220
+ "query_features",
221
221
  async () => (await import("../../agents/tools/query/queryFeatures/adapter.js")).queryFeaturesTool
222
222
  ]
223
223
  ]);
224
- async function ee(e) {
225
- const t = k.get(e);
226
- if (!t)
227
- throw new Error(`ArcGIS tool is not supported in the browser runtime: ${e}`);
228
- return await t();
224
+ async function tt(t) {
225
+ const e = k.get(t);
226
+ if (!e)
227
+ throw new Error(`ArcGIS tool is not supported in the browser runtime: ${t}`);
228
+ return await e();
229
229
  }
230
- var te = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, N = (e, t, r, s) => {
231
- for (var o = s > 1 ? void 0 : s ? oe(t, r) : t, a = e.length - 1, i; a >= 0; a--)
232
- (i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
233
- return s && o && te(t, r, o), o;
230
+ var et = Object.defineProperty, ot = Object.getOwnPropertyDescriptor, N = (t, e, r, s) => {
231
+ for (var o = s > 1 ? void 0 : s ? ot(e, r) : e, a = t.length - 1, i; a >= 0; a--)
232
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
233
+ return s && o && et(e, r, o), o;
234
234
  };
235
- let d = class extends S {
235
+ let d = class extends T {
236
236
  //#region Lifecycle
237
- constructor(e) {
238
- super(e), this.type = "arcgis-tool";
237
+ constructor(t) {
238
+ super(t), this.type = "arcgis-tool";
239
239
  }
240
240
  //#endregion
241
241
  //#region Public Methods
242
242
  async createRuntimeTools() {
243
243
  if (!this.name)
244
244
  throw new Error("ArcgisTool name is required");
245
- return [await ee(this.name)];
245
+ return [await tt(this.name)];
246
246
  }
247
- static fromJSON(e) {
247
+ static fromJSON(t) {
248
248
  return new d({
249
- name: e.name,
250
- requireApproval: e.require_approval
249
+ name: t.name,
250
+ requireApproval: t.require_approval
251
251
  });
252
252
  }
253
253
  //#endregion
@@ -264,25 +264,25 @@ N([
264
264
  d = N([
265
265
  l("ArcgisTool")
266
266
  ], d);
267
- var re = Object.defineProperty, se = Object.getOwnPropertyDescriptor, $ = (e) => {
268
- throw TypeError(e);
269
- }, y = (e, t, r, s) => {
270
- for (var o = s > 1 ? void 0 : s ? se(t, r) : t, a = e.length - 1, i; a >= 0; a--)
271
- (i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
272
- return s && o && re(t, r, o), o;
273
- }, ae = (e, t, r) => t.has(e) || $("Cannot " + r), ie = (e, t, r) => t.has(e) ? $("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), ne = (e, t, r) => (ae(e, t, "access private method"), r), T, J;
267
+ var rt = Object.defineProperty, st = Object.getOwnPropertyDescriptor, J = (t) => {
268
+ throw TypeError(t);
269
+ }, w = (t, e, r, s) => {
270
+ for (var o = s > 1 ? void 0 : s ? st(e, r) : e, a = t.length - 1, i; a >= 0; a--)
271
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
272
+ return s && o && rt(e, r, o), o;
273
+ }, at = (t, e, r) => e.has(t) || J("Cannot " + r), it = (t, e, r) => e.has(t) ? J("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), nt = (t, e, r) => (at(t, e, "access private method"), r), S, R;
274
274
  let u = class extends m {
275
275
  //#region Lifecycle
276
- constructor(e) {
277
- super(e), ie(this, T), this.type = "agent-node";
276
+ constructor(t) {
277
+ super(t), it(this, S), this.type = "agent-node";
278
278
  }
279
279
  //#endregion
280
280
  //#region Public Methods
281
281
  createRuntimeNode() {
282
- let e;
283
- return async (t, r) => {
284
- e ??= ne(this, T, J).call(this);
285
- const o = await (await e).run(t, r), a = this.outputSchema?.safeParse(o);
282
+ let t;
283
+ return async (e, r) => {
284
+ t ??= nt(this, S, R).call(this);
285
+ const o = await (await t).run(e, r), a = this.outputSchema?.safeParse(o);
286
286
  if (a && !a.success)
287
287
  throw a.error;
288
288
  const i = a?.data, O = i ?? o.outputMessage;
@@ -297,14 +297,14 @@ let u = class extends m {
297
297
  };
298
298
  };
299
299
  }
300
- compile(e) {
301
- const t = e.outgoingEdges[0]?.targetNodeId;
300
+ compile(t) {
301
+ const e = t.outgoingEdges[0]?.targetNodeId;
302
302
  return {
303
303
  runtimeNode: this.createRuntimeNode(),
304
304
  edges: [
305
305
  {
306
306
  from: this.id,
307
- decide: (r) => r.status === "failed" ? void 0 : t
307
+ decide: (r) => r.status === "failed" ? void 0 : e
308
308
  }
309
309
  ],
310
310
  schemas: [
@@ -314,86 +314,86 @@ let u = class extends m {
314
314
  ]
315
315
  };
316
316
  }
317
- static fromJSON(e) {
318
- const t = new u({
319
- id: e.id,
320
- label: e.label,
321
- prompt: e.prompt?.content,
317
+ static fromJSON(t) {
318
+ const e = new u({
319
+ id: t.id,
320
+ label: t.label,
321
+ prompt: t.prompt?.content,
322
322
  type: "agent-node"
323
323
  });
324
- return e.structured_output && (t.outputSchema = C(e.structured_output)), t.tools = e.tools?.filter((r) => r.type === "arcgis_tool").map((r) => d.fromJSON(r)), t;
324
+ return t.structured_output && (e.outputSchema = I(t.structured_output)), e.tools = t.tools?.filter((r) => r.type === "arcgis_tool").map((r) => d.fromJSON(r)), e;
325
325
  }
326
326
  //#endregion
327
327
  };
328
- T = /* @__PURE__ */ new WeakSet();
329
- J = async function() {
330
- const e = this.prompt;
331
- if (!e?.trim())
328
+ S = /* @__PURE__ */ new WeakSet();
329
+ R = async function() {
330
+ const t = this.prompt;
331
+ if (!t?.trim())
332
332
  throw new Error(`WebAgent agent node "${this.id}" requires a prompt.`);
333
- const t = [];
333
+ const e = [];
334
334
  if (this.tools)
335
335
  for (const r of this.tools) {
336
336
  const s = await r.createRuntimeTools();
337
- t.push(...s);
337
+ e.push(...s);
338
338
  }
339
- return new Z({
339
+ return new z({
340
340
  name: this.id,
341
341
  // TODO: change to label
342
342
  outputSchema: this.outputSchema,
343
- prompt: e,
344
- tools: t
343
+ prompt: t,
344
+ tools: e
345
345
  });
346
346
  };
347
- y([
347
+ w([
348
348
  n()
349
349
  ], u.prototype, "type", 2);
350
- y([
350
+ w([
351
351
  n()
352
352
  ], u.prototype, "prompt", 2);
353
- y([
353
+ w([
354
354
  n()
355
355
  ], u.prototype, "outputSchema", 2);
356
- y([
356
+ w([
357
357
  n()
358
358
  ], u.prototype, "tools", 2);
359
- u = y([
359
+ u = w([
360
360
  l("AgentNode")
361
361
  ], u);
362
- var ce = Object.defineProperty, pe = Object.getOwnPropertyDescriptor, A = (e, t, r, s) => {
363
- for (var o = s > 1 ? void 0 : s ? pe(t, r) : t, a = e.length - 1, i; a >= 0; a--)
364
- (i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
365
- return s && o && ce(t, r, o), o;
362
+ var ct = Object.defineProperty, pt = Object.getOwnPropertyDescriptor, A = (t, e, r, s) => {
363
+ for (var o = s > 1 ? void 0 : s ? pt(e, r) : e, a = t.length - 1, i; a >= 0; a--)
364
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
365
+ return s && o && ct(e, r, o), o;
366
366
  };
367
367
  let h = class extends m {
368
368
  //#region Lifecycle
369
- constructor(e) {
370
- super(e), this.type = "end-message-node";
369
+ constructor(t) {
370
+ super(t), this.type = "end-message-node";
371
371
  }
372
372
  //#endregion
373
373
  //#region Public Methods
374
374
  createRuntimeNode() {
375
- return async (e) => {
376
- const t = await z.fromTemplate(this.message, { templateFormat: "mustache" }).format(e);
375
+ return async (t) => {
376
+ const e = await Z.fromTemplate(this.message, { templateFormat: "mustache" }).format(t);
377
377
  return {
378
- outputMessage: t,
378
+ outputMessage: e,
379
379
  status: "success",
380
- summary: t
380
+ summary: e
381
381
  };
382
382
  };
383
383
  }
384
- compile(e) {
384
+ compile(t) {
385
385
  return {
386
386
  runtimeNode: this.createRuntimeNode(),
387
387
  edges: []
388
388
  };
389
389
  }
390
- static fromJSON(e) {
391
- const t = new h({
392
- id: e.id,
393
- label: e.label,
390
+ static fromJSON(t) {
391
+ const e = new h({
392
+ id: t.id,
393
+ label: t.label,
394
394
  type: "end-message-node"
395
395
  });
396
- return t.message = e.message, t;
396
+ return e.message = t.message, e;
397
397
  }
398
398
  //#endregion
399
399
  //#region Private Methods
@@ -408,25 +408,25 @@ A([
408
408
  h = A([
409
409
  l("EndMessageNode")
410
410
  ], h);
411
- var me = Object.defineProperty, ue = Object.getOwnPropertyDescriptor, R = (e, t, r, s) => {
412
- for (var o = s > 1 ? void 0 : s ? ue(t, r) : t, a = e.length - 1, i; a >= 0; a--)
413
- (i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
414
- return s && o && me(t, r, o), o;
411
+ var mt = Object.defineProperty, ut = Object.getOwnPropertyDescriptor, D = (t, e, r, s) => {
412
+ for (var o = s > 1 ? void 0 : s ? ut(e, r) : e, a = t.length - 1, i; a >= 0; a--)
413
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
414
+ return s && o && mt(e, r, o), o;
415
415
  };
416
- let w = class extends m {
416
+ let _ = class extends m {
417
417
  //#region Lifecycle
418
- constructor(e) {
419
- super(e), this.type = "start-node";
418
+ constructor(t) {
419
+ super(t), this.type = "start-node";
420
420
  }
421
421
  //#endregion
422
422
  //#region Public Methods
423
423
  createRuntimeNode() {
424
- return (e) => ({ question: e.agentExecutionContext.userRequest });
424
+ return (t) => ({ question: t.agentExecutionContext.userRequest });
425
425
  }
426
- static fromJSON(e) {
427
- return new w({
428
- id: e.id,
429
- label: e.label,
426
+ static fromJSON(t) {
427
+ return new _({
428
+ id: t.id,
429
+ label: t.label,
430
430
  type: "start-node"
431
431
  });
432
432
  }
@@ -434,68 +434,68 @@ let w = class extends m {
434
434
  //#region Private Methods
435
435
  //#endregion
436
436
  };
437
- R([
437
+ D([
438
438
  n()
439
- ], w.prototype, "type", 2);
440
- w = R([
439
+ ], _.prototype, "type", 2);
440
+ _ = D([
441
441
  l("StartNode")
442
- ], w);
443
- function de(e) {
444
- switch (e.type) {
442
+ ], _);
443
+ function dt(t) {
444
+ switch (t.type) {
445
445
  case "agent_node":
446
- return u.fromJSON(e);
446
+ return u.fromJSON(t);
447
447
  case "end_message_node":
448
- return h.fromJSON(e);
448
+ return h.fromJSON(t);
449
449
  case "start_node":
450
- return w.fromJSON(e);
450
+ return _.fromJSON(t);
451
451
  default:
452
- throw new Error(`WebAgent node "${e.id}" uses unsupported type "${e.type}".`);
452
+ throw new Error(`WebAgent node "${t.id}" uses unsupported type "${t.type}".`);
453
453
  }
454
454
  }
455
- function le(e = {}) {
456
- const t = Object.keys(e);
457
- if (H(t), t.includes("nodes"))
455
+ function lt(t = {}) {
456
+ const e = Object.keys(t);
457
+ if (H(e), e.includes("nodes"))
458
458
  throw new Error("node state cannot define reserved field: nodes.");
459
- const r = V(e);
459
+ const r = U(t);
460
460
  return x.Root({
461
461
  ...r,
462
462
  nodes: x({
463
463
  reducer: (s, o) => ({ ...s, ...o }),
464
464
  default: () => ({})
465
465
  }),
466
- ...U()
466
+ ...V()
467
467
  });
468
468
  }
469
- function D(e) {
470
- const t = /* @__PURE__ */ new Set();
471
- for (const s of e)
469
+ function F(t) {
470
+ const e = /* @__PURE__ */ new Set();
471
+ for (const s of t)
472
472
  for (const o of Object.keys(s.shape ?? {}))
473
- o !== "nodes" && t.add(o);
474
- const r = Object.fromEntries([...t].map((s) => [s, void 0]));
475
- return le(r);
473
+ o !== "nodes" && e.add(o);
474
+ const r = Object.fromEntries([...e].map((s) => [s, void 0]));
475
+ return lt(r);
476
476
  }
477
477
  class P {
478
478
  //#endregion Private Properties
479
479
  //#region Lifecycle
480
- constructor(t, r, s) {
481
- this.sourceJSON = t, this.edges = r, this.nodes = s, this._loaded = !1;
480
+ constructor(e, r, s) {
481
+ this.sourceJSON = e, this.edges = r, this.nodes = s, this._loaded = !1;
482
482
  }
483
483
  //#endregion Lifecycle
484
484
  //#region Public Methods
485
- static fromJSON(t) {
485
+ static fromJSON(e) {
486
486
  return new P(
487
- t,
488
- t.graph.edges.map((r) => p.fromJSON(r)),
489
- t.graph.nodes.map((r) => de(r))
487
+ e,
488
+ e.graph.edges.map((r) => p.fromJSON(r)),
489
+ e.graph.nodes.map((r) => dt(r))
490
490
  );
491
491
  }
492
492
  async load() {
493
- return this._loadPromise ??= Promise.all(this.nodes.map(async (t) => await t.load())).then(() => {
493
+ return this._loadPromise ??= Promise.all(this.nodes.map(async (e) => await e.load())).then(() => {
494
494
  this._loaded = !0;
495
495
  }), await this._loadPromise, this;
496
496
  }
497
497
  getSchemas() {
498
- const t = Object.fromEntries(
498
+ const e = Object.fromEntries(
499
499
  this._getNodeCompilations().flatMap((s, o) => {
500
500
  const a = this.nodes[o];
501
501
  return s.schemas?.map((i) => [a.id, i]) ?? [];
@@ -503,16 +503,16 @@ class P {
503
503
  );
504
504
  return [c.object({
505
505
  loopCounts: c.record(c.string(), c.number()).optional(),
506
- nodes: c.object(t).partial().optional(),
506
+ nodes: c.object(e).partial().optional(),
507
507
  question: c.string().optional()
508
508
  })];
509
509
  }
510
510
  generate() {
511
511
  this._assertLoaded(), this._nodeCompilations = void 0;
512
- const t = this._getNodeCompilations(), r = D(this.getSchemas()), s = this.nodes.find((i) => i.type === "start-node")?.id, o = {}, a = [];
512
+ const e = this._getNodeCompilations(), r = F(this.getSchemas()), s = this.nodes.find((i) => i.type === "start-node")?.id, o = {}, a = [];
513
513
  for (const [i, O] of this.nodes.entries()) {
514
- const _ = t[i];
515
- _ && (_.runtimeNode && (o[O.id] = _.runtimeNode), a.push(..._.edges));
514
+ const y = e[i];
515
+ y && (y.runtimeNode && (o[O.id] = y.runtimeNode), a.push(...y.edges));
516
516
  }
517
517
  return {
518
518
  createGraph: () => B(o, a, r, { entryNode: s }),
@@ -527,25 +527,25 @@ class P {
527
527
  }
528
528
  _getNodeCompilations() {
529
529
  return this._assertLoaded(), this._nodeCompilations ??= this.nodes.map(
530
- (t) => t.compile({
531
- outgoingEdges: this.edges.filter((r) => r.sourceNodeId === t.id)
530
+ (e) => e.compile({
531
+ outgoingEdges: this.edges.filter((r) => r.sourceNodeId === e.id)
532
532
  })
533
533
  );
534
534
  }
535
535
  //#endregion Private Methods
536
536
  }
537
- var he = Object.defineProperty, ge = Object.getOwnPropertyDescriptor, E = (e, t, r, s) => {
538
- for (var o = s > 1 ? void 0 : s ? ge(t, r) : t, a = e.length - 1, i; a >= 0; a--)
539
- (i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
540
- return s && o && he(t, r, o), o;
537
+ var ht = Object.defineProperty, gt = Object.getOwnPropertyDescriptor, E = (t, e, r, s) => {
538
+ for (var o = s > 1 ? void 0 : s ? gt(e, r) : e, a = t.length - 1, i; a >= 0; a--)
539
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
540
+ return s && o && ht(e, r, o), o;
541
541
  };
542
- const fe = () => {
542
+ const ft = () => {
543
543
  throw new Error("WebAgent must be loaded before it can run.");
544
544
  };
545
545
  let g = class extends G {
546
546
  //#region Lifecycle
547
- constructor(e) {
548
- super(e);
547
+ constructor(t) {
548
+ super(t);
549
549
  }
550
550
  //#endregion
551
551
  //#region Public Methods
@@ -556,32 +556,32 @@ let g = class extends G {
556
556
  } catch (r) {
557
557
  throw new b("web-agent:load-portal-item", "Failed to load portal item", { error: r });
558
558
  }
559
- const t = await this.portalItem.fetchData();
560
- if (this.sourceJSON = t, !this.portalItem.title)
559
+ const e = await this.portalItem.fetchData();
560
+ if (this.sourceJSON = e, !this.portalItem.title)
561
561
  throw new b("web-agent:missing-title", "The portal item is missing a title");
562
562
  }
563
563
  if (!this.sourceJSON)
564
564
  throw new b("web-agent:missing-source-json", "The source JSON is missing");
565
565
  if (!this.sourceJSON.description)
566
566
  throw new b("web-agent:missing-description", "The source JSON is missing a description");
567
- const e = P.fromJSON(this.sourceJSON);
568
- return await e.load(), this._runtime = e, this.description = this.sourceJSON.description, this.name = this.portalItem?.title ?? `web-agent-${Date.now()}`, this.generate(), this;
567
+ const t = P.fromJSON(this.sourceJSON);
568
+ return await t.load(), this._runtime = t, this.description = this.sourceJSON.description, this.name = this.portalItem?.title ?? `web-agent-${Date.now()}`, this.generate(), this;
569
569
  }
570
570
  getSchemas() {
571
571
  return this._runtime?.getSchemas() ?? [];
572
572
  }
573
573
  generate() {
574
574
  if (!this._runtime) {
575
- this._set("workspace", D([])), this._set("createGraph", fe);
575
+ this._set("workspace", F([])), this._set("createGraph", ft);
576
576
  return;
577
577
  }
578
- const { createGraph: e, workspace: t } = this._runtime.generate();
579
- this._set("workspace", t), this._set("createGraph", e);
578
+ const { createGraph: t, workspace: e } = this._runtime.generate();
579
+ this._set("workspace", e), this._set("createGraph", t);
580
580
  }
581
581
  //#endregion
582
582
  };
583
583
  E([
584
- n({ type: F })
584
+ n({ type: C })
585
585
  ], g.prototype, "portalItem", 2);
586
586
  E([
587
587
  n()
@@ -589,29 +589,29 @@ E([
589
589
  g = E([
590
590
  l("WebAgent")
591
591
  ], g);
592
- class we extends L {
592
+ class _t extends M {
593
593
  static {
594
594
  this.properties = { agent: 0, context: 0, itemId: 1, workflow: 0 };
595
595
  }
596
- #e;
596
+ #t;
597
597
  async getContext() {
598
- return M(this.context) ? await this.context() : this.context;
598
+ return W(this.context) ? await this.context() : this.context;
599
599
  }
600
600
  async load() {
601
- let t;
601
+ let e;
602
602
  if (this.itemId) {
603
603
  const r = j.getDefault();
604
- t = new g({ portalItem: new F({ id: this.itemId, portal: r }) });
605
- } else this.workflow && (t = new g({ sourceJSON: this.workflow }));
606
- if (t && (await t.load(), this.agent = t.registration), !this.agent)
604
+ e = new g({ portalItem: new C({ id: this.itemId, portal: r }) });
605
+ } else this.workflow && (e = new g({ sourceJSON: this.workflow }));
606
+ if (e && (await e.load(), this.agent = e.registration), !this.agent)
607
607
  throw new Error("Failed to initialize the assistant agent because the agent registration is missing.");
608
- this.#e = W(this);
608
+ this.#t = L(this);
609
609
  }
610
610
  disconnectedCallback() {
611
- this.#e?.unregister(this.agent.id), super.disconnectedCallback();
611
+ this.#t?.unregister(this.agent.id), super.disconnectedCallback();
612
612
  }
613
613
  }
614
- q("arcgis-assistant-agent", we);
614
+ q("arcgis-assistant-agent", _t);
615
615
  export {
616
- we as ArcgisAssistantAgent
616
+ _t as ArcgisAssistantAgent
617
617
  };