@arcgis/portal-components 5.2.0-next.91 → 5.2.0-next.94

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,21 +1,21 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { c as Fe } from "../../chunks/runtime.js";
3
- import { LitElement as Oe, createEvent as Le } from "@arcgis/lumina";
4
- import { css as je, render as Ve, html as v } from "lit";
2
+ import { c as Oe } from "../../chunks/runtime.js";
3
+ import { LitElement as Le, createEvent as je } from "@arcgis/lumina";
4
+ import { css as Ve, render as Be, html as v } from "lit";
5
5
  import { createRef as E, ref as k } from "lit/directives/ref.js";
6
- import { u as Be } from "../../chunks/useT9n.js";
7
- import { NodeInterrupt as be, Annotation as h, StateGraph as N, START as P, END as w } from "@langchain/langgraph/web";
8
- import { sendTraceMessage as g, invokeStructuredPrompt as b, sendUXSuggestion as J, createAgentRuntimeStateWithSharedState as G, createChatModel as _, getEmbeddings as Ke } from "@arcgis/ai-components/utils/index.js";
6
+ import { u as Ke } from "../../chunks/useT9n.js";
7
+ import { NodeInterrupt as Ie, Annotation as h, StateGraph as N, START as G, END as w } from "@langchain/langgraph/web";
8
+ import { sendTraceMessage as p, invokeStructuredPrompt as b, sendUXSuggestion as J, createAgentRuntimeStateWithSharedState as P, createChatModel as _, getEmbeddings as Qe } from "@arcgis/ai-components/utils/index.js";
9
9
  import s from "zod";
10
- import { a as Qe, c as We, q as Je } from "../../chunks/groups2.js";
10
+ import { a as We, c as Je, q as _e } from "../../chunks/groups2.js";
11
11
  import Z from "@arcgis/core/identity/IdentityManager.js";
12
12
  import ee from "@arcgis/core/request.js";
13
- import { a as U, t as _e, b as Q } from "../../chunks/functionalities.js";
13
+ import { a as U, t as Ye, b as Q } from "../../chunks/functionalities.js";
14
14
  import { ChatPromptTemplate as Y } from "@langchain/core/prompts";
15
- import { tool as Ie } from "@langchain/core/tools";
16
- import { s as Ye, a as He } from "../../chunks/item.js";
17
- import { g as Xe, e as Ze, i as et, c as tt, a as at } from "../../chunks/groups.js";
18
- import nt from "@arcgis/core/portal/Portal.js";
15
+ import { tool as xe } from "@langchain/core/tools";
16
+ import { s as He, a as Xe } from "../../chunks/item.js";
17
+ import { g as Ze, e as et, i as tt, c as at, a as nt } from "../../chunks/groups.js";
18
+ import ot from "@arcgis/core/portal/Portal.js";
19
19
  const Se = (e) => {
20
20
  const { portal: t, user: a } = e ?? {};
21
21
  return !!e && !!t && !!a;
@@ -24,7 +24,7 @@ function x(e) {
24
24
  if (!Se(e))
25
25
  throw new Error("Invalid context: PortalAssistantContext with portal and user is required.");
26
26
  }
27
- const ot = `
27
+ const rt = `
28
28
  Write a concise, friendly success message for adding members to a group.
29
29
 
30
30
  Rules:
@@ -39,9 +39,9 @@ Added members:
39
39
 
40
40
  Not added members:
41
41
  {notAddedMembers}
42
- `, rt = (e) => e.map((t) => `"${t}"`).join(", "), st = s.object({
42
+ `, st = (e) => e.map((t) => `"${t}"`).join(", "), it = s.object({
43
43
  successMessage: s.string().default("")
44
- }), te = "portal-group-creation", ae = "approveAddMembers", it = async (e, t) => {
44
+ }), te = "portal-group-creation", ae = "approveAddMembers", ct = async (e, t) => {
45
45
  if (e.intentParams.intent !== "addMembers")
46
46
  return {
47
47
  status: "success",
@@ -53,7 +53,7 @@ Not added members:
53
53
  status: "success",
54
54
  outputMessage: "Create a group first, then add members using @mention usernames."
55
55
  };
56
- const n = e.intentParams.memberInfo.memberIdentifiers.map((m) => m.trim()).filter(Boolean);
56
+ const n = e.intentParams.memberInfo.memberIdentifiers.map((g) => g.trim()).filter(Boolean);
57
57
  if (!n.length)
58
58
  return {
59
59
  status: "success",
@@ -61,12 +61,12 @@ Not added members:
61
61
  };
62
62
  const r = `The following member(s) will be added to the newly created group:
63
63
 
64
- ${n.map((m) => `- **@${m}**`).join(`
64
+ ${n.map((g) => `- **@${g}**`).join(`
65
65
  `)}
66
66
 
67
67
  Do you want to continue?`, { hitlResponse: i } = t?.configurable ?? {};
68
68
  if (i?.agentId !== te || i.id !== ae) {
69
- const m = {
69
+ const g = {
70
70
  agentId: te,
71
71
  id: ae,
72
72
  kind: "booleanChoice",
@@ -77,45 +77,45 @@ Do you want to continue?`, { hitlResponse: i } = t?.configurable ?? {};
77
77
  members: [...n]
78
78
  }
79
79
  };
80
- throw new be(m);
80
+ throw new Ie(g);
81
81
  }
82
82
  if (i.payload !== !0)
83
83
  return {
84
84
  status: "success",
85
85
  outputMessage: "Okay, I cancelled adding members to the group."
86
86
  };
87
- await g(
88
- { text: `Adding members ${rt(n)}...`, agentName: "group-creation" },
87
+ await p(
88
+ { text: `Adding members ${st(n)}...`, agentName: "group-creation" },
89
89
  t
90
90
  );
91
91
  const u = t?.configurable?.context;
92
92
  x(u);
93
- const { result: c, error: d } = await Qe(u.portal, a, n);
93
+ const { result: c, error: d } = await We(u.portal, a, n);
94
94
  if (d || !c)
95
95
  return {
96
96
  status: "success",
97
97
  outputMessage: "I could not add members to that group. Please confirm group access and user accounts, then try again."
98
98
  };
99
- const { addedUsernames: l, notAddedUsers: p } = c;
99
+ const { addedUsernames: l, notAddedUsers: m } = c;
100
100
  try {
101
101
  const f = (await b({
102
- promptText: ot,
103
- schema: st,
102
+ promptText: rt,
103
+ schema: it,
104
104
  modelTier: "fast",
105
105
  inputVariables: {
106
106
  addedMembers: l.join(", "),
107
107
  notAddedMembers: JSON.stringify(
108
- p.map((y) => ({ username: y.username, reason: y.error.message }))
108
+ m.map((y) => ({ username: y.username, reason: y.error.message }))
109
109
  )
110
110
  }
111
111
  })).successMessage;
112
112
  if (f)
113
113
  return { status: "success", outputMessage: f };
114
- } catch (m) {
115
- console.error("Error generating add-members success message:", m);
114
+ } catch (g) {
115
+ console.error("Error generating add-members success message:", g);
116
116
  }
117
117
  return {};
118
- }, ct = `
118
+ }, ut = `
119
119
  Write a concise, friendly success message after creating a portal group.
120
120
 
121
121
  Rules:
@@ -126,7 +126,7 @@ Rules:
126
126
 
127
127
  Group title:
128
128
  {groupTitle}
129
- `, ut = `
129
+ `, lt = `
130
130
  Write a concise, friendly failure message after an attempt to create a portal group.
131
131
 
132
132
  Rules:
@@ -141,11 +141,11 @@ Group title:
141
141
 
142
142
  Failure reason:
143
143
  {failureReason}
144
- `, ne = "portal-group-creation", oe = "approveCreateGroup", lt = s.object({
144
+ `, ne = "portal-group-creation", oe = "approveCreateGroup", dt = s.object({
145
145
  successMessage: s.string().default("")
146
- }), dt = s.object({
146
+ }), pt = s.object({
147
147
  failureMessage: s.string().default("")
148
- }), pt = async (e, t) => {
148
+ }), mt = async (e, t) => {
149
149
  if (e.intentParams.intent !== "create")
150
150
  return {
151
151
  status: "success",
@@ -170,36 +170,36 @@ Failure reason:
170
170
  access: "private"
171
171
  }
172
172
  };
173
- throw new be(d);
173
+ throw new Ie(d);
174
174
  }
175
175
  if (o.payload !== !0)
176
176
  return {
177
177
  status: "success",
178
178
  outputMessage: `Okay, I cancelled creating **${a}**.`
179
179
  };
180
- await g({ text: `Creating group "${a}"...`, agentName: "group-creation" }, t);
180
+ await p({ text: `Creating group "${a}"...`, agentName: "group-creation" }, t);
181
181
  const r = t?.configurable?.context;
182
182
  x(r);
183
- const { result: i, error: u } = await We(r.portal, {
183
+ const { result: i, error: u } = await Je(r.portal, {
184
184
  title: a,
185
185
  access: "private"
186
186
  });
187
187
  if (u || !i) {
188
188
  const d = u?.message?.trim() || "No additional details were provided.";
189
189
  try {
190
- const p = (await b({
191
- promptText: ut,
192
- schema: dt,
190
+ const m = (await b({
191
+ promptText: lt,
192
+ schema: pt,
193
193
  modelTier: "fast",
194
194
  inputVariables: {
195
195
  groupTitle: a,
196
196
  failureReason: d
197
197
  }
198
198
  })).failureMessage.trim();
199
- if (p)
199
+ if (m)
200
200
  return {
201
201
  status: "success",
202
- outputMessage: p
202
+ outputMessage: m
203
203
  };
204
204
  } catch (l) {
205
205
  console.error("Error generating create-group failure message:", l);
@@ -212,8 +212,8 @@ Failure reason:
212
212
  const c = i.id;
213
213
  try {
214
214
  const l = (await b({
215
- promptText: ct,
216
- schema: lt,
215
+ promptText: ut,
216
+ schema: dt,
217
217
  modelTier: "fast",
218
218
  inputVariables: {
219
219
  groupTitle: a
@@ -244,7 +244,7 @@ Failure reason:
244
244
  ).join(" ").trim();
245
245
  }
246
246
  return "";
247
- }, mt = `
247
+ }, gt = `
248
248
  You classify whether a user is asking to create a new ArcGIS Portal group or add members to an existing group.
249
249
 
250
250
  Rules:
@@ -270,16 +270,16 @@ Examples:
270
270
 
271
271
  User message:
272
272
  {userMessage}
273
- `, gt = s.object({
273
+ `, ht = s.object({
274
274
  intent: s.enum(["clarify", "create", "addMembers"]).default("clarify"),
275
275
  title: s.string().default(""),
276
276
  memberIdentifiers: s.array(s.string()).default([]),
277
277
  clarifyMessage: s.string().default("")
278
- }), ht = async (e, t) => {
279
- await g({ text: "Thinking about groups...", agentName: "group-creation" }, t);
278
+ }), ft = async (e, t) => {
279
+ await p({ text: "Thinking about groups...", agentName: "group-creation" }, t);
280
280
  const a = I(e.agentExecutionContext.messages).trim(), n = await b({
281
- promptText: mt,
282
- schema: gt,
281
+ promptText: gt,
282
+ schema: ht,
283
283
  modelTier: "default",
284
284
  inputVariables: { userMessage: a }
285
285
  }), o = n.title.trim(), r = n.memberIdentifiers.filter(Boolean), i = n.clarifyMessage.trim(), u = n.intent === "create" && !!o, c = n.intent === "addMembers" && r.length > 0;
@@ -288,7 +288,7 @@ User message:
288
288
  status: "success",
289
289
  outputMessage: !u && !c ? i : ""
290
290
  };
291
- }, ft = [
291
+ }, yt = [
292
292
  "general",
293
293
  "about",
294
294
  "homePage",
@@ -312,54 +312,54 @@ User message:
312
312
  "openData",
313
313
  "hub",
314
314
  "orgExtensions"
315
- ], yt = ["newItem", "createLayer", "developerCredentials"], wt = ["favorites", "group", "living-atlas", "org"], vt = ["featured", "my", "organization"], bt = ["licenses", "members", "overview", "reports", "settings", "status"], It = s.object({
315
+ ], wt = ["newItem", "createLayer", "developerCredentials"], vt = ["favorites", "group", "living-atlas", "org"], bt = ["featured", "my", "organization"], It = ["licenses", "members", "overview", "reports", "settings", "status"], xt = s.object({
316
316
  destinationType: s.literal("portal-content"),
317
- hash: s.enum(wt).optional(),
317
+ hash: s.enum(vt).optional(),
318
318
  queryParams: s.object({
319
- newItem: s.enum(yt).optional()
319
+ newItem: s.enum(wt).optional()
320
320
  }).optional()
321
321
  }), St = s.object({
322
322
  destinationType: s.literal("portal-groups"),
323
- hash: s.enum(vt).optional()
324
- }), xt = s.object({
323
+ hash: s.enum(bt).optional()
324
+ }), Tt = s.object({
325
325
  destinationType: s.literal("portal-org"),
326
- hash: s.enum(bt).optional(),
326
+ hash: s.enum(It).optional(),
327
327
  queryParams: s.object({
328
- tab: s.enum(ft).optional(),
328
+ tab: s.enum(yt).optional(),
329
329
  section: s.string().optional(),
330
330
  subsection: s.string().optional(),
331
331
  period: s.string().optional(),
332
332
  startTime: s.string().optional(),
333
333
  endTime: s.string().optional()
334
334
  }).optional()
335
- }), Tt = s.object({
335
+ }), Mt = s.object({
336
336
  destinationType: s.literal("portal-item"),
337
337
  itemId: s.string().trim().min(1)
338
- }), Mt = s.object({
338
+ }), Ct = s.object({
339
339
  destinationType: s.literal("portal-group"),
340
340
  groupId: s.string().trim().min(1)
341
- }), Ct = s.object({
341
+ }), At = s.object({
342
342
  destinationType: s.union([
343
343
  s.literal("portal-gallery"),
344
344
  s.literal("portal-map-viewer"),
345
345
  s.literal("portal-notebooks"),
346
346
  s.literal("portal-scene-viewer")
347
347
  ])
348
- }), At = s.union([
349
- It,
350
- St,
348
+ }), Nt = s.union([
351
349
  xt,
350
+ St,
352
351
  Tt,
353
352
  Mt,
354
- Ct
355
- ]), xe = "portal-navigation", F = async (e, t) => {
353
+ Ct,
354
+ At
355
+ ]), Te = "portal-navigation", F = async (e, t) => {
356
356
  const a = t?.configurable?.context;
357
- !Se(a) || !a.navigationTargetMap?.[e.destinationType] || await J({ type: xe, data: { ...e } }, t);
358
- }, Nt = async (e, t) => {
357
+ !Se(a) || !a.navigationTargetMap?.[e.destinationType] || await J({ type: Te, data: { ...e } }, t);
358
+ }, Gt = async (e, t) => {
359
359
  const a = e.createdGroupId ?? e.agentExecutionContext.sharedState.createdGroupId?.value;
360
- return a ? (await g({ text: "Preparing navigation...", agentName: "group-creation" }, t), await F({ destinationType: "portal-group", groupId: a }, t), {}) : {};
361
- }, re = (e, t) => t ?? e, Te = h.Root({
362
- ...G(),
360
+ return a ? (await p({ text: "Preparing navigation...", agentName: "group-creation" }, t), await F({ destinationType: "portal-group", groupId: a }, t), {}) : {};
361
+ }, re = (e, t) => t ?? e, Me = h.Root({
362
+ ...P(),
363
363
  // * Shared state between nodes (but not persisted to the agent execution context)
364
364
  /** Parameters related to the user's intent for group creation actions */
365
365
  intentParams: h({ reducer: re, default: () => ({ intent: "clarify" }) }),
@@ -368,7 +368,7 @@ User message:
368
368
  * we still need it here to also share between nodes
369
369
  */
370
370
  createdGroupId: h({ reducer: re, default: () => "" })
371
- }), Pt = () => new N(Te).addNode("detectGroupCreationIntent", ht).addNode("createPortalGroup", pt).addNode("addMembersToPortalGroup", it).addNode("suggestCreatedGroupNavigation", Nt).addEdge(P, "detectGroupCreationIntent").addConditionalEdges("detectGroupCreationIntent", (t) => {
371
+ }), Pt = () => new N(Me).addNode("detectGroupCreationIntent", ft).addNode("createPortalGroup", mt).addNode("addMembersToPortalGroup", ct).addNode("suggestCreatedGroupNavigation", Gt).addEdge(G, "detectGroupCreationIntent").addConditionalEdges("detectGroupCreationIntent", (t) => {
372
372
  switch (t.intentParams.intent) {
373
373
  case "create":
374
374
  return "createPortalGroup";
@@ -377,41 +377,41 @@ User message:
377
377
  default:
378
378
  return w;
379
379
  }
380
- }).addEdge("createPortalGroup", "suggestCreatedGroupNavigation").addEdge("addMembersToPortalGroup", "suggestCreatedGroupNavigation").addEdge("suggestCreatedGroupNavigation", w), Gt = String.raw`- **portal-group-creation** - Portal group creation assistant:
380
+ }).addEdge("createPortalGroup", "suggestCreatedGroupNavigation").addEdge("addMembersToPortalGroup", "suggestCreatedGroupNavigation").addEdge("suggestCreatedGroupNavigation", w), qt = String.raw`- **portal-group-creation** - Portal group creation assistant:
381
381
  - creates a new ArcGIS Portal group for the signed-in user
382
382
  - adds users to the newly created group using @mention usernames
383
- `, qt = {
383
+ `, Et = {
384
384
  id: "portal-group-creation",
385
385
  name: "Portal Group Creation",
386
- description: Gt,
386
+ description: qt,
387
387
  createGraph: Pt,
388
- workspace: Te
389
- }, Me = "portalDocAssistantMemory", Et = () => ({ conversationId: "" }), kt = (e) => {
390
- const t = e?.[Me]?.value;
388
+ workspace: Me
389
+ }, Ce = "portalDocAssistantMemory", kt = () => ({ conversationId: "" }), zt = (e) => {
390
+ const t = e?.[Ce]?.value;
391
391
  if (!t || typeof t != "object")
392
- return Et();
392
+ return kt();
393
393
  const a = t;
394
394
  return {
395
395
  conversationId: typeof a.conversationId == "string" ? a.conversationId : ""
396
396
  };
397
- }, zt = (e) => ({
398
- [Me]: { value: e }
399
- }), $t = {
397
+ }, $t = (e) => ({
398
+ [Ce]: { value: e }
399
+ }), Dt = {
400
400
  pipeline: {
401
401
  follow_up: { allow: !1 }
402
402
  }
403
403
  };
404
- function Dt(e) {
404
+ function Rt(e) {
405
405
  return {
406
406
  kind: "DocAIAssistantRequest",
407
407
  filters: {
408
- ...$t,
408
+ ...Dt,
409
409
  persona: { persona: e }
410
410
  }
411
411
  };
412
412
  }
413
- const Rt = "https://www.arcgis.com/sharing/rest";
414
- async function Ut({
413
+ const Ut = "https://www.arcgis.com/sharing/rest";
414
+ async function Ft({
415
415
  portal: e,
416
416
  question: t,
417
417
  persona: a,
@@ -421,18 +421,18 @@ async function Ut({
421
421
  skillId: i
422
422
  }) {
423
423
  i ??= "doc_ai_assistant";
424
- const u = Dt(a), c = await Ft({
424
+ const u = Rt(a), c = await Ot({
425
425
  portal: e,
426
426
  skillId: i,
427
427
  message: t,
428
428
  options: { context: u, previousConversationId: n, useProdDocAssistant: o, signal: r }
429
429
  });
430
430
  return {
431
- reply: Ot(c, i),
431
+ reply: Lt(c, i),
432
432
  conversationId: c[0]?.conversationId ?? ""
433
433
  };
434
434
  }
435
- async function Ft({
435
+ async function Ot({
436
436
  portal: e,
437
437
  skillId: t,
438
438
  message: a,
@@ -440,7 +440,7 @@ async function Ft({
440
440
  }) {
441
441
  const o = e.helperServices.aiAssistantServices.url, i = `${n.useProdDocAssistant ? "https://aiservices-beta.arcgis.com" : o}/skills/${t}/chat`, c = {
442
442
  "Content-Type": "application/json",
443
- token: n.useProdDocAssistant ? (await Z.getCredential(Rt, { oAuthPopupConfirmation: !1 })).token : Z.findCredential(e.url)?.token ?? ""
443
+ token: n.useProdDocAssistant ? (await Z.getCredential(Ut, { oAuthPopupConfirmation: !1 })).token : Z.findCredential(e.url)?.token ?? ""
444
444
  }, d = await ee(i, {
445
445
  method: "post",
446
446
  body: JSON.stringify({
@@ -455,26 +455,26 @@ async function Ft({
455
455
  throw new Error(`Doc assistant chat failed (${d.httpStatus})`, {
456
456
  cause: d.data
457
457
  });
458
- const l = d.data, p = [l], { conversationId: m, inquiryId: f } = l, y = async (M, q) => {
458
+ const l = d.data, m = [l], { conversationId: g, inquiryId: f } = l, y = async (M, q) => {
459
459
  if (!q)
460
460
  return;
461
- await _e(500);
462
- const T = await ee(i, {
461
+ await Ye(500);
462
+ const S = await ee(i, {
463
463
  method: "post",
464
- body: JSON.stringify({ conversationId: m, inquiryId: f, ackSequenceNumber: M }),
464
+ body: JSON.stringify({ conversationId: g, inquiryId: f, ackSequenceNumber: M }),
465
465
  headers: c,
466
466
  signal: n.signal
467
467
  });
468
- if (T.httpStatus !== 200)
469
- throw new Error(`Doc assistant poll failed (${T.httpStatus})`, {
470
- cause: T.data
468
+ if (S.httpStatus !== 200)
469
+ throw new Error(`Doc assistant poll failed (${S.httpStatus})`, {
470
+ cause: S.data
471
471
  });
472
- const C = T.data;
473
- p.push(C), await y(C.sequenceNumber, C.hasMore);
472
+ const C = S.data;
473
+ m.push(C), await y(C.sequenceNumber, C.hasMore);
474
474
  };
475
- return l.hasMore && await y(l.sequenceNumber, l.hasMore), p;
475
+ return l.hasMore && await y(l.sequenceNumber, l.hasMore), m;
476
476
  }
477
- function Ot(e, t) {
477
+ function Lt(e, t) {
478
478
  switch (t) {
479
479
  case "doc_chat":
480
480
  return e.find((a) => a.message != null)?.message ?? "";
@@ -492,10 +492,10 @@ function Ot(e, t) {
492
492
  return U(t);
493
493
  }
494
494
  }
495
- const Lt = async (e, t) => {
495
+ const jt = async (e, t) => {
496
496
  const a = performance.now();
497
497
  try {
498
- await g({ text: "Asking documentation assistant...", agentName: "doc-assistant" }, t);
498
+ await p({ text: "Asking documentation assistant...", agentName: "doc-assistant" }, t);
499
499
  const n = I(e.agentExecutionContext.messages).trim();
500
500
  if (!n)
501
501
  return {
@@ -504,7 +504,7 @@ const Lt = async (e, t) => {
504
504
  };
505
505
  const o = t?.configurable?.context;
506
506
  x(o);
507
- const r = kt(e.agentExecutionContext.sharedState), { reply: i, conversationId: u } = await Ut({
507
+ const r = zt(e.agentExecutionContext.sharedState), { reply: i, conversationId: u } = await Ft({
508
508
  portal: o.portal,
509
509
  question: n,
510
510
  previousConversationId: r.conversationId || void 0,
@@ -515,7 +515,7 @@ const Lt = async (e, t) => {
515
515
  return {
516
516
  status: "success",
517
517
  outputMessage: i.trim() || "I could not retrieve a response from the documentation assistant.",
518
- sharedStatePatch: zt({
518
+ sharedStatePatch: $t({
519
519
  conversationId: u || r.conversationId
520
520
  })
521
521
  };
@@ -526,7 +526,7 @@ const Lt = async (e, t) => {
526
526
  durationMs: Number((performance.now() - a).toFixed(1))
527
527
  });
528
528
  }
529
- }, Ce = Ie(
529
+ }, Ae = xe(
530
530
  async ({ groupTitle: e }, t) => {
531
531
  const a = e.trim();
532
532
  if (!a)
@@ -534,7 +534,7 @@ const Lt = async (e, t) => {
534
534
  const n = t?.configurable?.context;
535
535
  x(n);
536
536
  try {
537
- return (await Je(n.portal, { query: `title:${a}`, num: 1 }))?.results[0]?.id || null;
537
+ return (await _e(n.portal, { query: `title:${a}`, num: 1 }))?.results[0]?.id || null;
538
538
  } catch (o) {
539
539
  return console.error("Error searching for portal group by title:", o), null;
540
540
  }
@@ -546,14 +546,14 @@ const Lt = async (e, t) => {
546
546
  groupTitle: s.string().describe("The portal group title to resolve to a group id.")
547
547
  })
548
548
  }
549
- ), Ae = Ie(
549
+ ), Ne = xe(
550
550
  async ({ itemTitle: e }, t) => {
551
551
  const a = e.trim();
552
552
  if (!a)
553
553
  return null;
554
554
  const n = t?.configurable?.context;
555
555
  x(n);
556
- const { result: o, error: r } = await Ye(n.portal, a, { num: 1 });
556
+ const { result: o, error: r } = await He(n.portal, a, { num: 1 });
557
557
  return r && console.error("Error searching for portal item by title:", r), o?.results[0]?.id || null;
558
558
  },
559
559
  {
@@ -571,7 +571,7 @@ function A(e, t = "#") {
571
571
  const n = e.match(new RegExp(`\\${t}([^\\s"']+)`, "u"));
572
572
  return n?.[1] ? n[1].trim() : null;
573
573
  }
574
- function jt(e) {
574
+ function Vt(e) {
575
575
  const t = Q(e).flatMap((a) => {
576
576
  const n = a, o = e[a], r = [
577
577
  n,
@@ -587,11 +587,11 @@ function jt(e) {
587
587
  });
588
588
  return Object.fromEntries(t);
589
589
  }
590
- function Vt(e) {
590
+ function Bt(e) {
591
591
  return Object.entries(e).map(([t, { description: a, hints: n }]) => ` - ${t}: ${a} (hints: ${n.join(", ")})`).join(`
592
592
  `);
593
593
  }
594
- const Bt = {
594
+ const Kt = {
595
595
  // Example prompt: "Take me to my content"
596
596
  "portal-content": {
597
597
  description: "The main content page of the portal.",
@@ -725,13 +725,13 @@ const Bt = {
725
725
  }
726
726
  }
727
727
  }
728
- }, Ne = jt(Bt), Kt = Q(Ne), Qt = Vt(Ne), Wt = `
728
+ }, Ge = Vt(Kt), Qt = Q(Ge), Wt = Bt(Ge), Jt = `
729
729
  You decide whether the assistant response should include a navigation action to ArcGIS Portal.
730
730
 
731
731
  Given the user question and assistant response:
732
732
  - Decide if a navigation action would help the user complete the task.
733
733
  - If yes, choose one destinationType:
734
- ${Qt}
734
+ ${Wt}
735
735
 
736
736
  Rules:
737
737
  - Only suggest navigation when you are highly confident the destination will help complete the user's task.
@@ -756,37 +756,37 @@ Assistant response:
756
756
  {response}
757
757
  `, se = s.object({
758
758
  shouldSuggestNavigation: s.boolean().default(!1),
759
- destinationType: s.enum(["none", ...Kt]).default("none"),
759
+ destinationType: s.enum(["none", ...Qt]).default("none"),
760
760
  itemId: s.string().default(""),
761
761
  groupId: s.string().default(""),
762
762
  confidence: s.number().min(0).max(1).default(0)
763
763
  });
764
764
  let ie;
765
- async function Jt() {
765
+ async function _t() {
766
766
  return ie ??= _({ modelTier: "fast" }), await ie;
767
767
  }
768
- const _t = async (e, t) => {
768
+ const Yt = async (e, t) => {
769
769
  const a = performance.now();
770
770
  try {
771
- await g({ text: "Extracting navigation intent...", agentName: "doc-assistant" }, t);
771
+ await p({ text: "Extracting navigation intent...", agentName: "doc-assistant" }, t);
772
772
  const n = e.outputMessage.trim();
773
773
  if (!n)
774
774
  return {};
775
- const o = I(e.agentExecutionContext.messages).trim(), r = await Y.fromTemplate(Wt).format({
775
+ const o = I(e.agentExecutionContext.messages).trim(), r = await Y.fromTemplate(Jt).format({
776
776
  question: o,
777
777
  response: n
778
- }), u = (await Jt()).withStructuredOutput(se), c = se.parse(await u.invoke(r));
778
+ }), u = (await _t()).withStructuredOutput(se), c = se.parse(await u.invoke(r));
779
779
  if (!c.shouldSuggestNavigation || c.destinationType === "none")
780
780
  return {};
781
781
  if (c.destinationType === "portal-item" && !c.itemId) {
782
782
  const l = A(o, "#");
783
- l && (c.itemId = await Ae.invoke({ itemTitle: l }, t) ?? "");
783
+ l && (c.itemId = await Ne.invoke({ itemTitle: l }, t) ?? "");
784
784
  }
785
785
  if (c.destinationType === "portal-group" && !c.groupId) {
786
786
  const l = A(o, "$") ?? A(o, "#");
787
- l && (c.groupId = await Ce.invoke({ groupTitle: l }, t) ?? "");
787
+ l && (c.groupId = await Ae.invoke({ groupTitle: l }, t) ?? "");
788
788
  }
789
- const d = Yt(c);
789
+ const d = Ht(c);
790
790
  return d ? (await F(d, t), {}) : {};
791
791
  } finally {
792
792
  console.info("[arcgis-portal-ai-assistant] node timing", {
@@ -796,7 +796,7 @@ const _t = async (e, t) => {
796
796
  });
797
797
  }
798
798
  };
799
- function Yt({
799
+ function Ht({
800
800
  destinationType: e,
801
801
  itemId: t,
802
802
  groupId: a
@@ -822,7 +822,7 @@ function Yt({
822
822
  case "portal-content-new-item-developer-credentials":
823
823
  return {
824
824
  queryParams: {
825
- newItem: Ht[e]
825
+ newItem: Xt[e]
826
826
  },
827
827
  destinationType: "portal-content"
828
828
  };
@@ -830,11 +830,11 @@ function Yt({
830
830
  case "portal-content-group":
831
831
  case "portal-content-living-atlas":
832
832
  case "portal-content-organization":
833
- return { destinationType: "portal-content", hash: Xt[e] };
833
+ return { destinationType: "portal-content", hash: Zt[e] };
834
834
  case "portal-groups-featured":
835
835
  case "portal-groups-my":
836
836
  case "portal-groups-organization":
837
- return { destinationType: "portal-groups", hash: Zt[e] };
837
+ return { destinationType: "portal-groups", hash: ea[e] };
838
838
  case "portal-org-security-custom-sign-in":
839
839
  case "portal-org-security-logins":
840
840
  case "portal-org-security-change-login-provider":
@@ -846,7 +846,7 @@ function Yt({
846
846
  hash: "settings",
847
847
  queryParams: {
848
848
  tab: "security",
849
- subsection: ea[e]
849
+ subsection: ta[e]
850
850
  }
851
851
  };
852
852
  case "portal-item":
@@ -859,20 +859,20 @@ function Yt({
859
859
  return U(e);
860
860
  }
861
861
  }
862
- const Ht = {
862
+ const Xt = {
863
863
  "portal-content-new-item": "newItem",
864
864
  "portal-content-new-item-feature-layer": "createLayer",
865
865
  "portal-content-new-item-developer-credentials": "developerCredentials"
866
- }, Xt = {
866
+ }, Zt = {
867
867
  "portal-content-favorites": "favorites",
868
868
  "portal-content-group": "group",
869
869
  "portal-content-living-atlas": "living-atlas",
870
870
  "portal-content-organization": "org"
871
- }, Zt = {
871
+ }, ea = {
872
872
  "portal-groups-featured": "featured",
873
873
  "portal-groups-my": "my",
874
874
  "portal-groups-organization": "organization"
875
- }, ea = {
875
+ }, ta = {
876
876
  "portal-org-security-custom-sign-in": "customSignInSection",
877
877
  "portal-org-security-logins": "loginsSection",
878
878
  "portal-org-security-change-login-provider": "changeLoginProviderSection",
@@ -880,30 +880,30 @@ const Ht = {
880
880
  "portal-org-security-multifactor-enforcement": "multifactorEnforcementSection",
881
881
  "portal-org-security-multifactor-designated-admins": "multifactorDesignatedAdminsSection"
882
882
  }, Pe = h.Root({
883
- ...G()
884
- }), ta = () => new N(Pe).addNode("answerDocQuestion", Lt).addNode("extractNavigationIntent", _t).addEdge(P, "answerDocQuestion").addEdge("answerDocQuestion", "extractNavigationIntent").addEdge("extractNavigationIntent", w), aa = String.raw`- **portal-doc-assistant** - General ArcGIS documentation and Portal help assistant:
883
+ ...P()
884
+ }), aa = () => new N(Pe).addNode("answerDocQuestion", jt).addNode("extractNavigationIntent", Yt).addEdge(G, "answerDocQuestion").addEdge("answerDocQuestion", "extractNavigationIntent").addEdge("extractNavigationIntent", w), na = String.raw`- **portal-doc-assistant** - General ArcGIS documentation and Portal help assistant:
885
885
  - answers general ArcGIS, Portal, Enterprise, and JavaScript SDK questions
886
886
  - acts as a fallback when specialized agents are not applicable
887
- `, na = {
887
+ `, oa = {
888
888
  id: "portal-doc-assistant",
889
889
  name: "Portal Doc Assistant",
890
- description: aa,
891
- createGraph: ta,
890
+ description: na,
891
+ createGraph: aa,
892
892
  workspace: Pe
893
- }, oa = () => ({ latestGroupId: null, memory: {} }), O = (e) => {
893
+ }, ra = () => ({ latestGroupId: null, memory: {} }), O = (e) => {
894
894
  const t = e?.agentExecutionContext.sharedState.portalGroupSummaryMemory?.value;
895
- return t ? { latestGroupId: t.latestGroupId, memory: t.memory } : oa();
896
- }, Ge = `
895
+ return t ? { latestGroupId: t.latestGroupId, memory: t.memory } : ra();
896
+ }, qe = `
897
897
  Shared markdown formatting rules:
898
898
  - Use clear markdown headings (##) to separate sections.
899
899
  - Use concise bullet points for lists of facts, counts, or signals.
900
900
  - Emphasize key metrics with bold labels (for example: **Recent items:** 4).
901
901
  - Keep wording direct and analytical; avoid filler language but make sure the language is friendly.
902
902
  - Do not include raw internal IDs unless explicitly requested.
903
- `, ra = `
903
+ `, sa = `
904
904
  You answer follow-up questions about ArcGIS group analytics.
905
905
 
906
- ${Ge}
906
+ ${qe}
907
907
 
908
908
  Ground your answer in the provided group analytics summary and context.
909
909
  If the answer is not available from the provided context, state that clearly and suggest what to check next.
@@ -925,14 +925,14 @@ Group full context:
925
925
 
926
926
  Question:
927
927
  {question}
928
- `, sa = async (e, t) => {
929
- await g({ text: "Answering group follow-up...", agentName: "group-analytics" }, t);
928
+ `, ia = async (e, t) => {
929
+ await p({ text: "Answering group follow-up...", agentName: "group-analytics" }, t);
930
930
  const a = O(e), n = e.groupSummaryGroupId ?? a.latestGroupId, o = n ? a.memory[n] : void 0, r = e.groupSummaryQuestion || I(e.agentExecutionContext.messages);
931
931
  return o ? {
932
932
  status: "success",
933
933
  outputMessage: (await b({
934
- promptText: ra,
935
- schema: ia,
934
+ promptText: sa,
935
+ schema: ca,
936
936
  modelTier: "default",
937
937
  inputVariables: {
938
938
  summary: o.summary,
@@ -944,10 +944,10 @@ Question:
944
944
  status: "success",
945
945
  outputMessage: "I do not have group analytics context yet. Ask me to analyze a group first with analyze group <group id>."
946
946
  };
947
- }, ia = s.object({
947
+ }, ca = s.object({
948
948
  answer: s.string(),
949
949
  isRelevant: s.boolean()
950
- }), ca = `
950
+ }), ua = `
951
951
  Classify the user's request for ArcGIS Portal group analytics.
952
952
 
953
953
  Rules:
@@ -976,18 +976,18 @@ hasAnalyticsContext:
976
976
 
977
977
  User message:
978
978
  {userMessage}
979
- `, ua = async (e, t) => {
980
- await g({ text: "Analyzing group-analytics intent...", agentName: "group-analytics" }, t);
981
- const a = I(e.agentExecutionContext.messages), n = !!O(e).latestGroupId, o = await Y.fromTemplate(ca).format({
979
+ `, la = async (e, t) => {
980
+ await p({ text: "Analyzing group-analytics intent...", agentName: "group-analytics" }, t);
981
+ const a = I(e.agentExecutionContext.messages), n = !!O(e).latestGroupId, o = await Y.fromTemplate(ua).format({
982
982
  userMessage: a,
983
983
  hasAnalyticsContext: String(n)
984
984
  }), i = (await _({ modelTier: "fast" })).withStructuredOutput(ce), u = ce.parse(await i.invoke(o));
985
985
  let c = u.groupId;
986
986
  if ((u.intent === "summarize" || u.intent === "navigation") && !c) {
987
987
  const y = A(a, "$");
988
- y && (c = await Ce.invoke({ groupTitle: y }, t) ?? "");
988
+ y && (c = await Ae.invoke({ groupTitle: y }, t) ?? "");
989
989
  }
990
- const { intent: d, question: l } = u, p = d === "summarize" && !c, m = d === "followUp" && !(l ?? "").trim(), f = d === "clarify" || p || m;
990
+ const { intent: d, question: l } = u, m = d === "summarize" && !c, g = d === "followUp" && !(l ?? "").trim(), f = d === "clarify" || m || g;
991
991
  return {
992
992
  groupSummaryIntent: f ? "clarify" : d,
993
993
  groupSummaryGroupId: c || null,
@@ -999,19 +999,19 @@ User message:
999
999
  intent: s.enum(["summarize", "followUp", "navigation", "clarify"]),
1000
1000
  groupId: s.string().default(""),
1001
1001
  question: s.string().default("")
1002
- }), la = async (e, t) => {
1002
+ }), da = async (e, t) => {
1003
1003
  const a = O(e), n = e.groupSummaryGroupId ?? a.latestGroupId;
1004
- return await g({ text: "Preparing navigation...", agentName: "group-analytics" }, t), await F(
1004
+ return await p({ text: "Preparing navigation...", agentName: "group-analytics" }, t), await F(
1005
1005
  n ? { destinationType: "portal-group", groupId: n } : { destinationType: "portal-groups" },
1006
1006
  t
1007
1007
  ), { status: "success" };
1008
1008
  };
1009
- function qe({ timestamp: e, now: t, windowMs: a }) {
1009
+ function Ee({ timestamp: e, now: t, windowMs: a }) {
1010
1010
  return e ? t - e <= a : !1;
1011
1011
  }
1012
- const da = 720 * 60 * 60 * 1e3;
1013
- function pa(e) {
1014
- const t = Xe(e);
1012
+ const pa = 720 * 60 * 60 * 1e3;
1013
+ function ma(e) {
1014
+ const t = Ze(e);
1015
1015
  return {
1016
1016
  id: e.id ?? "",
1017
1017
  title: e.title ?? "",
@@ -1024,10 +1024,10 @@ function pa(e) {
1024
1024
  modified: e.modified?.getTime(),
1025
1025
  isInvitationOnly: e.isInvitationOnly,
1026
1026
  sourceSignals: {
1027
- capabilities: at(e),
1028
- membershipAccess: tt(e),
1029
- isOpenData: et(e),
1030
- isDistributedCollaborationGroup: Ze(e),
1027
+ capabilities: nt(e),
1028
+ membershipAccess: at(e),
1029
+ isOpenData: tt(e),
1030
+ isDistributedCollaborationGroup: et(e),
1031
1031
  orgId: t.orgId,
1032
1032
  hiddenMembers: t.hiddenMembers,
1033
1033
  isViewOnly: t.isViewOnly,
@@ -1036,7 +1036,7 @@ function pa(e) {
1036
1036
  }
1037
1037
  };
1038
1038
  }
1039
- async function ma(e) {
1039
+ async function ga(e) {
1040
1040
  const t = { owner: e.owner ?? "", admins: [], users: [] };
1041
1041
  try {
1042
1042
  return await e.fetchMembers();
@@ -1044,7 +1044,7 @@ async function ma(e) {
1044
1044
  return console.warn("Unable to fetch group members for analytics context", a), t;
1045
1045
  }
1046
1046
  }
1047
- function ga(e) {
1047
+ function ha(e) {
1048
1048
  return e.map((t) => ({
1049
1049
  id: t.id ?? "",
1050
1050
  title: t.title ?? "Untitled",
@@ -1054,43 +1054,43 @@ function ga(e) {
1054
1054
  modified: t.modified?.getTime()
1055
1055
  }));
1056
1056
  }
1057
- function ha(e, t) {
1057
+ function fa(e, t) {
1058
1058
  return e.filter(
1059
- (a) => a.modified ? qe({ timestamp: a.modified, now: t, windowMs: da }) : !1
1059
+ (a) => a.modified ? Ee({ timestamp: a.modified, now: t, windowMs: pa }) : !1
1060
1060
  );
1061
1061
  }
1062
- function fa(e) {
1062
+ function ya(e) {
1063
1063
  const t = /* @__PURE__ */ new Map();
1064
1064
  for (const a of e)
1065
1065
  t.set(a.type, (t.get(a.type) ?? 0) + 1);
1066
1066
  return [...t.entries()].sort((a, n) => n[1] - a[1] || a[0].localeCompare(n[0])).slice(0, 6).map(([a, n]) => ({ type: a, count: n }));
1067
1067
  }
1068
- async function ya(e) {
1069
- const t = await e.queryItems({ num: 20, sortField: "modified", sortOrder: "desc" }), a = ga(t.results), n = Date.now();
1068
+ async function wa(e) {
1069
+ const t = await e.queryItems({ num: 20, sortField: "modified", sortOrder: "desc" }), a = ha(t.results), n = Date.now();
1070
1070
  return {
1071
1071
  total: t.total,
1072
1072
  topItems: a,
1073
- recentlyModifiedItems: ha(a, n),
1074
- topItemTypes: fa(a)
1073
+ recentlyModifiedItems: fa(a, n),
1074
+ topItemTypes: ya(a)
1075
1075
  };
1076
1076
  }
1077
- async function wa(e, t) {
1077
+ async function va(e, t) {
1078
1078
  if (!t)
1079
1079
  return { error: { code: "missingGroupId", message: "Group id is required." } };
1080
1080
  try {
1081
1081
  const n = (await e.queryGroups({ query: `id:${t}`, num: 1 })).results[0];
1082
1082
  if (!n)
1083
1083
  return { error: { code: "groupNotFound", message: `No group found for id: ${t}` } };
1084
- const o = pa(n), r = await ma(n), i = await ya(n);
1084
+ const o = ma(n), r = await ga(n), i = await wa(n);
1085
1085
  return { result: { group: o, members: r, items: i } };
1086
1086
  } catch (a) {
1087
1087
  return console.error("Error fetching portal group analytics context:", a), { error: { code: "unhandledError" } };
1088
1088
  }
1089
1089
  }
1090
- const va = `
1090
+ const ba = `
1091
1091
  You summarize ArcGIS Portal groups based on structured context and deterministic activity signals.
1092
1092
 
1093
- ${Ge}
1093
+ ${qe}
1094
1094
 
1095
1095
  Output format requirements:
1096
1096
  - Return concise markdown with clear sections in this order:
@@ -1126,24 +1126,24 @@ Group context:
1126
1126
 
1127
1127
  Deterministic signals:
1128
1128
  {deterministicSignals}
1129
- `, ba = 2160 * 60 * 60 * 1e3, Ia = async (e, t) => {
1129
+ `, Ia = 2160 * 60 * 60 * 1e3, xa = async (e, t) => {
1130
1130
  const a = e.groupSummaryGroupId;
1131
1131
  if (!a)
1132
1132
  return {
1133
1133
  status: "success",
1134
1134
  outputMessage: 'Please clarify with analyze group <group id>, analyze group $<title>, or analyze group $"<title with spaces>".'
1135
1135
  };
1136
- await g({ text: `Analyzing group ${a}...`, agentName: "group-analytics" }, t);
1136
+ await p({ text: `Analyzing group ${a}...`, agentName: "group-analytics" }, t);
1137
1137
  const n = t?.configurable?.context;
1138
1138
  x(n);
1139
- const { result: o, error: r } = await wa(n.portal, a);
1139
+ const { result: o, error: r } = await va(n.portal, a);
1140
1140
  if (r || !o)
1141
- return await g({ text: "Failed to fetch group context", agentName: "group-analytics" }, t), {
1141
+ return await p({ text: "Failed to fetch group context", agentName: "group-analytics" }, t), {
1142
1142
  status: "success",
1143
1143
  outputMessage: "Unable to retrieve group context for analytics."
1144
1144
  };
1145
- const { group: i, items: u } = o, c = Date.now(), d = i.modified, l = d ? qe({ timestamp: d, now: c, windowMs: ba }) : !1, p = u.recentlyModifiedItems.length, m = p > 0, f = l || m, y = await b({
1146
- promptText: va,
1145
+ const { group: i, items: u } = o, c = Date.now(), d = i.modified, l = d ? Ee({ timestamp: d, now: c, windowMs: Ia }) : !1, m = u.recentlyModifiedItems.length, g = m > 0, f = l || g, y = await b({
1146
+ promptText: ba,
1147
1147
  schema: Sa,
1148
1148
  modelTier: "default",
1149
1149
  inputVariables: {
@@ -1151,14 +1151,14 @@ Deterministic signals:
1151
1151
  deterministicSignals: JSON.stringify({
1152
1152
  isGroupActive: f,
1153
1153
  isGroupRecentlyModified: l,
1154
- hasRecentlyAddedOrUpdatedContent: m,
1155
- recentItemCount: p
1154
+ hasRecentlyAddedOrUpdatedContent: g,
1155
+ recentItemCount: m
1156
1156
  })
1157
1157
  }
1158
- }), { followUpQuestions: M, summary: q } = y, T = O(e), C = {
1158
+ }), { followUpQuestions: M, summary: q } = y, S = O(e), C = {
1159
1159
  latestGroupId: a,
1160
1160
  memory: {
1161
- ...T.memory,
1161
+ ...S.memory,
1162
1162
  [a]: { summary: q, followUpQuestions: M, fullContext: o }
1163
1163
  }
1164
1164
  };
@@ -1170,8 +1170,8 @@ Deterministic signals:
1170
1170
  }, Sa = s.object({
1171
1171
  summary: s.string(),
1172
1172
  followUpQuestions: s.array(s.string()).default([])
1173
- }), L = (e, t) => t ?? e, Ee = h.Root({
1174
- ...G(),
1173
+ }), L = (e, t) => t ?? e, ke = h.Root({
1174
+ ...P(),
1175
1175
  groupSummaryIntent: h({
1176
1176
  reducer: L,
1177
1177
  default: () => "clarify"
@@ -1184,24 +1184,24 @@ Deterministic signals:
1184
1184
  reducer: L,
1185
1185
  default: () => ""
1186
1186
  })
1187
- }), xa = () => new N(Ee).addNode("detectGroupSummaryIntent", ua).addNode("summarizePortalGroup", Ia).addNode("answerGroupSummaryFollowUp", sa).addNode("suggestGroupSummaryNavigation", la).addEdge(P, "detectGroupSummaryIntent").addConditionalEdges("detectGroupSummaryIntent", (t) => t.groupSummaryIntent === "summarize" ? "summarizePortalGroup" : t.groupSummaryIntent === "followUp" ? "answerGroupSummaryFollowUp" : t.groupSummaryIntent === "navigation" ? "suggestGroupSummaryNavigation" : w).addEdge("summarizePortalGroup", w).addEdge("answerGroupSummaryFollowUp", w).addEdge("suggestGroupSummaryNavigation", w), Ta = String.raw`- **portal-group-analytics** - Portal group analytics assistant:
1187
+ }), Ta = () => new N(ke).addNode("detectGroupSummaryIntent", la).addNode("summarizePortalGroup", xa).addNode("answerGroupSummaryFollowUp", ia).addNode("suggestGroupSummaryNavigation", da).addEdge(G, "detectGroupSummaryIntent").addConditionalEdges("detectGroupSummaryIntent", (t) => t.groupSummaryIntent === "summarize" ? "summarizePortalGroup" : t.groupSummaryIntent === "followUp" ? "answerGroupSummaryFollowUp" : t.groupSummaryIntent === "navigation" ? "suggestGroupSummaryNavigation" : w).addEdge("summarizePortalGroup", w).addEdge("answerGroupSummaryFollowUp", w).addEdge("suggestGroupSummaryNavigation", w), Ma = String.raw`- **portal-group-analytics** - Portal group analytics assistant:
1188
1188
  - summarizes ArcGIS portal groups from group context and sourceJSON details
1189
1189
  - answers follow-up questions grounded in the summarized group
1190
1190
  - suggests navigation to groups when relevant
1191
- `, Ma = {
1191
+ `, Ca = {
1192
1192
  id: "portal-group-analytics",
1193
1193
  name: "Portal Group Analytics",
1194
- description: Ta,
1195
- createGraph: xa,
1196
- workspace: Ee
1197
- }, Ca = () => ({ latestItemId: null, memory: {} }), H = (e) => {
1194
+ description: Ma,
1195
+ createGraph: Ta,
1196
+ workspace: ke
1197
+ }, Aa = () => ({ latestItemId: null, memory: {} }), H = (e) => {
1198
1198
  const t = e?.agentExecutionContext.sharedState.portalItemAnalyticsSummaryMemory?.value;
1199
- return t ? { latestItemId: t.latestItemId, memory: t.memory } : Ca();
1199
+ return t ? { latestItemId: t.latestItemId, memory: t.memory } : Aa();
1200
1200
  }, ue = s.object({
1201
1201
  intent: s.enum(["summarize", "followUp", "clarify"]),
1202
1202
  itemId: s.string().default(""),
1203
1203
  question: s.string().default("")
1204
- }), Aa = s.object({ summary: s.string(), followUpQuestions: s.array(s.string()).default([]) }), Na = s.object({ answer: s.string(), isRelevant: s.boolean() }), Pa = `
1204
+ }), Na = s.object({ summary: s.string(), followUpQuestions: s.array(s.string()).default([]) }), Ga = s.object({ answer: s.string(), isRelevant: s.boolean() }), Pa = `
1205
1205
  You answer follow-up questions about an ArcGIS item.
1206
1206
 
1207
1207
  Ground your answer in the provided item context.
@@ -1221,14 +1221,14 @@ Item full context
1221
1221
 
1222
1222
  Question:
1223
1223
  {question}
1224
- `, Ga = async (e, t) => {
1225
- await g({ text: "Answering follow-up...", agentName: "analytics" }, t);
1224
+ `, qa = async (e, t) => {
1225
+ await p({ text: "Answering follow-up...", agentName: "analytics" }, t);
1226
1226
  const a = H(e), n = e.analyticsItemId ?? a.latestItemId, o = n ? a.memory[n] : void 0, r = e.analyticsQuestion || I(e.agentExecutionContext.messages);
1227
1227
  return o ? {
1228
1228
  status: "success",
1229
1229
  outputMessage: (await b({
1230
1230
  promptText: Pa,
1231
- schema: Na,
1231
+ schema: Ga,
1232
1232
  modelTier: "default",
1233
1233
  inputVariables: {
1234
1234
  summary: o.summary,
@@ -1240,7 +1240,7 @@ Question:
1240
1240
  status: "success",
1241
1241
  outputMessage: "I don't have enough information yet. Please ask me to summarize the item first using summarize item <item id>."
1242
1242
  };
1243
- }, qa = `
1243
+ }, Ea = `
1244
1244
  Classify the user analytics request.
1245
1245
 
1246
1246
  Rules:
@@ -1270,16 +1270,16 @@ hasSummaryContext:
1270
1270
 
1271
1271
  User message:
1272
1272
  {userMessage}
1273
- `, Ea = async (e, t) => {
1274
- await g({ text: "Analyzing intent...", agentName: "analytics" }, t);
1275
- const a = I(e.agentExecutionContext.messages), n = !!H(e).latestItemId, o = await Y.fromTemplate(qa).format({
1273
+ `, ka = async (e, t) => {
1274
+ await p({ text: "Analyzing intent...", agentName: "analytics" }, t);
1275
+ const a = I(e.agentExecutionContext.messages), n = !!H(e).latestItemId, o = await Y.fromTemplate(Ea).format({
1276
1276
  userMessage: a,
1277
1277
  hasSummaryContext: String(n)
1278
1278
  }), i = (await _({ modelTier: "fast" })).withStructuredOutput(ue), u = ue.parse(await i.invoke(o));
1279
1279
  let c = u.itemId;
1280
1280
  if (u.intent === "summarize" && !c) {
1281
1281
  const y = A(a, "#");
1282
- y && (c = await Ae.invoke({ itemTitle: y }, t) ?? "");
1282
+ y && (c = await Ne.invoke({ itemTitle: y }, t) ?? "");
1283
1283
  }
1284
1284
  const { intent: d, question: l } = u, f = d === "clarify" || d === "summarize" && !c || d === "followUp" && !l;
1285
1285
  return {
@@ -1290,7 +1290,7 @@ User message:
1290
1290
  status: "success",
1291
1291
  outputMessage: f ? 'Please clarify with summarize item <item id>, summarize item #<title>, or summarize item #"<title with spaces>".' : ""
1292
1292
  };
1293
- }, ka = `
1293
+ }, za = `
1294
1294
  You are a item summary tool for ArcGIS. Your job is to summarize an item's info based on the provided context.
1295
1295
  Summary rules:
1296
1296
  - The summary should be concise markdown, make sure to format the output nicely so it's easy to read.
@@ -1305,41 +1305,41 @@ Do not include internal identifiers.
1305
1305
  If the user asks for a detailed summary, you may expand the response up to 300 words.
1306
1306
  Item context:
1307
1307
  {context}
1308
- `, za = async (e, t) => {
1308
+ `, $a = async (e, t) => {
1309
1309
  const a = e.analyticsItemId;
1310
1310
  if (!a)
1311
1311
  return {
1312
1312
  status: "success",
1313
1313
  outputMessage: 'Please clarify with summarize item <item id>, summarize item #<title>, or summarize item #"<title with spaces>".'
1314
1314
  };
1315
- await g({ text: `Summarizing item ${a}...`, agentName: "analytics" }, t);
1315
+ await p({ text: `Summarizing item ${a}...`, agentName: "analytics" }, t);
1316
1316
  const n = t?.configurable?.context;
1317
1317
  x(n);
1318
- const { portal: o, user: r } = n, { result: i, error: u } = await He(r, o, a);
1318
+ const { portal: o, user: r } = n, { result: i, error: u } = await Xe(r, o, a);
1319
1319
  if (u || !i)
1320
- return await g({ text: "Failed to get item context for summarization", agentName: "analytics" }, t), {
1320
+ return await p({ text: "Failed to get item context for summarization", agentName: "analytics" }, t), {
1321
1321
  status: "success",
1322
1322
  outputMessage: "Unable to retrieve item context for summarization."
1323
1323
  };
1324
1324
  const { context: c } = i, d = await b({
1325
- promptText: ka,
1326
- schema: Aa,
1325
+ promptText: za,
1326
+ schema: Na,
1327
1327
  modelTier: "default",
1328
1328
  inputVariables: { context: JSON.stringify(c) }
1329
- }), { followUpQuestions: l, summary: p } = d, m = H(e), f = {
1329
+ }), { followUpQuestions: l, summary: m } = d, g = H(e), f = {
1330
1330
  latestItemId: a,
1331
1331
  memory: {
1332
- ...m.memory,
1333
- [a]: { summary: p, followUpQuestions: l, fullContext: c }
1332
+ ...g.memory,
1333
+ [a]: { summary: m, followUpQuestions: l, fullContext: c }
1334
1334
  }
1335
1335
  };
1336
1336
  return l.length && await J({ type: "suggested-prompts", data: { prompts: l } }, t), {
1337
1337
  status: "success",
1338
- outputMessage: p,
1338
+ outputMessage: m,
1339
1339
  sharedStatePatch: { portalItemAnalyticsSummaryMemory: { value: f } }
1340
1340
  };
1341
- }, j = (e, t) => t ?? e, ke = h.Root({
1342
- ...G(),
1341
+ }, j = (e, t) => t ?? e, ze = h.Root({
1342
+ ...P(),
1343
1343
  // States shared only across nodes in the graph, not between invocations
1344
1344
  analyticsIntent: h({
1345
1345
  reducer: j,
@@ -1353,159 +1353,26 @@ Item context:
1353
1353
  reducer: j,
1354
1354
  default: () => ""
1355
1355
  })
1356
- }), $a = () => new N(ke).addNode("detectAnalyticsIntent", Ea).addNode("summarizePortalItem", za).addNode("answerAnalyticsFollowUp", Ga).addEdge(P, "detectAnalyticsIntent").addConditionalEdges("detectAnalyticsIntent", (t) => t.analyticsIntent === "summarize" ? "summarizePortalItem" : t.analyticsIntent === "followUp" ? "answerAnalyticsFollowUp" : w).addEdge("summarizePortalItem", w).addEdge("answerAnalyticsFollowUp", w), Da = String.raw`- **portal-item-analytics** - Portal item analytics assistant:
1356
+ }), Da = () => new N(ze).addNode("detectAnalyticsIntent", ka).addNode("summarizePortalItem", $a).addNode("answerAnalyticsFollowUp", qa).addEdge(G, "detectAnalyticsIntent").addConditionalEdges("detectAnalyticsIntent", (t) => t.analyticsIntent === "summarize" ? "summarizePortalItem" : t.analyticsIntent === "followUp" ? "answerAnalyticsFollowUp" : w).addEdge("summarizePortalItem", w).addEdge("answerAnalyticsFollowUp", w), Ra = String.raw`- **portal-item-analytics** - Portal item analytics assistant:
1357
1357
  - answers questions about one specific ArcGIS portal item when item context is present
1358
1358
  - summarizes item details, metadata, and context grounded in that item
1359
1359
  - suggests follow-up prompts grounded in the same item
1360
1360
  - use for item-specific requests, not for gallery browsing, featured content, or opening Map Viewer
1361
- `, Ra = {
1361
+ `, Ua = {
1362
1362
  id: "portal-item-analytics",
1363
1363
  name: "Portal Item Analytics",
1364
- description: Da,
1365
- createGraph: $a,
1366
- workspace: ke
1367
- }, Ua = {
1368
- schemaVersion: "1.0",
1369
- capabilities: [
1370
- {
1371
- id: "my-content",
1372
- title: "My content",
1373
- description: "Browse, discover, search, and filter ArcGIS content—including maps, apps, datasets, and other items—that you own or can access.",
1374
- hints: ["view my content", "show my content", "my content"],
1375
- platforms: ["online", "enterprise"],
1376
- resolutions: {
1377
- navigate: {
1378
- routeKey: "content"
1379
- }
1380
- }
1381
- },
1382
- {
1383
- id: "create-feature-layer",
1384
- title: "Create feature layer",
1385
- description: "Generate an editable feature layer by copying fields from templates or existing layers.",
1386
- hints: ["add a feature layer", "make a feature layer", "generate a feature layer"],
1387
- platforms: ["online", "enterprise"],
1388
- resolutions: {
1389
- navigate: {
1390
- routeKey: "content"
1391
- }
1392
- }
1393
- },
1394
- {
1395
- id: "create-folder",
1396
- title: "Create folder",
1397
- description: "Create a new folder in your ArcGIS content to organize your items.",
1398
- hints: ["create a folder", "make a folder", "set up a folder", "new folder"],
1399
- platforms: ["online", "enterprise"],
1400
- resolutions: {
1401
- navigate: {
1402
- routeKey: "content"
1403
- }
1404
- }
1405
- }
1406
- ]
1407
- }, Fa = {
1408
- schemaVersion: "1.0",
1409
- capabilities: [
1410
- {
1411
- id: "my groups",
1412
- title: "My groups",
1413
- description: "Browse, discover, search, and filter ArcGIS content collections—including maps, apps, datasets, and other items—that you own, belong to, or can access.",
1414
- hints: ["view my groups", "show my groups", "my groups"],
1415
- platforms: ["online", "enterprise"],
1416
- resolutions: {
1417
- navigate: {
1418
- routeKey: "groups"
1419
- }
1420
- }
1421
- },
1422
- {
1423
- id: "create-group",
1424
- title: "Create group",
1425
- description: "Create a new ArcGIS Portal group owned by the signed-in user.",
1426
- hints: ["create a group", "make a group", "set up a group", "new group"],
1427
- platforms: ["online", "enterprise"],
1428
- resolutions: {
1429
- navigate: {
1430
- routeKey: "groups"
1431
- }
1432
- }
1433
- },
1434
- {
1435
- id: "featured-groups",
1436
- title: "Featured groups",
1437
- description: "Browse, discover, search, and filter ArcGIS content collections—including maps, apps, datasets, and other items—that organization administrators choose to highlight in ArcGIS.",
1438
- hints: ["view featured groups", "show featured groups", "highlighted groups", "top groups"],
1439
- platforms: ["online", "enterprise"],
1440
- resolutions: {
1441
- navigate: {
1442
- routeKey: "groups",
1443
- hash: "featured"
1444
- }
1445
- }
1446
- },
1447
- {
1448
- id: "organization-groups",
1449
- title: "Organization groups",
1450
- description: "Browse, discover, search, and filter ArcGIS content collections—including maps, apps, datasets, and other items—that are specific to your organization in ArcGIS.",
1451
- hints: ["view organization groups", "show organization groups"],
1452
- platforms: ["online", "enterprise"],
1453
- resolutions: {
1454
- navigate: {
1455
- routeKey: "groups",
1456
- hash: "organization"
1457
- }
1458
- }
1459
- }
1460
- ]
1461
- }, Oa = {
1462
- schemaVersion: "1.0",
1463
- capabilities: [
1464
- {
1465
- id: "org-config-mfa",
1466
- title: "Multifactor Authentication (MFA)",
1467
- description: "Configure organization-level multifactor authentication (MFA) settings. Administrators can enable MFA for ArcGIS logins, allow recovery codes for members, view MFA adoption status, enforce MFA requirements for all members, manage the MFA exemption list, and designate administrators who can troubleshoot MFA issues.",
1468
- hints: ["config MFA", "set up MFA"],
1469
- platforms: ["online", "enterprise"],
1470
- resolutions: {
1471
- navigate: {
1472
- routeKey: "organization",
1473
- queryParams: {
1474
- tab: "security"
1475
- },
1476
- hash: "settings"
1477
- }
1478
- }
1479
- }
1480
- ]
1481
- }, La = {
1482
- "contentRouteRegistry.ts": Ua,
1483
- "groupsRouteRegistry.ts": Fa,
1484
- "orgSettingsRouteRegistry.ts": Oa
1485
- };
1486
- function le(e) {
1487
- const t = [], a = /* @__PURE__ */ new Set();
1488
- for (const [n, o] of Object.entries(e))
1489
- for (const r of o.capabilities) {
1490
- if (a.has(r.id))
1491
- throw new Error(`${n}: duplicate capability id "${r.id}" across registries`);
1492
- a.add(r.id), t.push(r);
1493
- }
1494
- return t;
1495
- }
1496
- let z;
1497
- function S(e) {
1498
- return e ? z = le({ customCapabilities: e }) : z || (z = le(La)), z;
1499
- }
1500
- const ja = /^(?:take me to|navigate to|go to|show me|open)\s+(?:the\s+)?/u;
1364
+ description: Ra,
1365
+ createGraph: Da,
1366
+ workspace: ze
1367
+ }, Fa = /^(?:take me to|navigate to|go to|show me|open)\s+(?:the\s+)?/u;
1501
1368
  function R(e) {
1502
- return e.toLowerCase().replace(/[^a-z0-9]+/gu, " ").trim().replace(ja, "").trim();
1369
+ return e.toLowerCase().replace(/[^a-z0-9]+/gu, " ").trim().replace(Fa, "").trim();
1503
1370
  }
1504
- const Va = s.object({
1371
+ const Oa = s.object({
1505
1372
  capabilityIds: s.array(s.string()).default([]),
1506
1373
  confidence: s.number().min(0).max(1).default(0),
1507
1374
  reason: s.string().default("")
1508
- }), de = 0.8, Ba = String.raw`You select Portal navigation capabilities for a user's request.
1375
+ }), le = 0.8, La = String.raw`You select Portal navigation capabilities for a user's request.
1509
1376
 
1510
1377
  Select only capability IDs from the supplied candidates. Return an empty array when none fit.
1511
1378
  A named surface is required: do not select a capability on another Portal surface.
@@ -1515,17 +1382,20 @@ User request:
1515
1382
  {userRequest}
1516
1383
 
1517
1384
  Candidates:
1518
- {candidates}`, Ka = async (e, t) => {
1385
+ {candidates}`, ja = async (e, t) => {
1519
1386
  if (e.outputMessage || e.targets.length === 0)
1520
1387
  return {};
1521
- const a = I(e.agentExecutionContext.messages).trim(), n = Qa(a, e);
1388
+ const a = I(e.agentExecutionContext.messages).trim(), n = Va(a, e);
1522
1389
  if (n.length === 1)
1523
- return console.info("[arcgis-portal-ai-assistant] navigation capability selection:", {
1390
+ return await p(
1391
+ { text: `Selected navigation capability by exact match: ${n[0]}`, agentName: "navigation" },
1392
+ t
1393
+ ), console.info("[arcgis-portal-ai-assistant] navigation capability selection:", {
1524
1394
  method: "exact-match",
1525
1395
  request: a,
1526
1396
  selectedCapabilityIds: n
1527
1397
  }), { chosenCapabilityIds: n };
1528
- await g({ text: "Choosing a navigation destination...", agentName: "navigation" }, t);
1398
+ await p({ text: "Choosing a navigation destination...", agentName: "navigation" }, t);
1529
1399
  const o = JSON.stringify(
1530
1400
  e.targets.map(({ capability: r, keywordScore: i, semanticScore: u }) => ({
1531
1401
  id: r.id,
@@ -1538,31 +1408,40 @@ Candidates:
1538
1408
  );
1539
1409
  try {
1540
1410
  const r = await b({
1541
- promptText: Ba,
1542
- schema: Va,
1411
+ promptText: La,
1412
+ schema: Oa,
1543
1413
  modelTier: "fast",
1544
1414
  inputVariables: { candidates: o, userRequest: a }
1545
1415
  }), i = new Set(e.targets.map(({ capability: c }) => c.id)), u = r.capabilityIds.filter((c) => i.has(c));
1546
- return console.info("[arcgis-portal-ai-assistant] navigation capability selection:", {
1416
+ return await p(
1417
+ {
1418
+ text: `Navigation selection: ${u.join(", ") || "none"} (confidence: ${r.confidence.toFixed(2)}, reason: ${r.reason})`,
1419
+ agentName: "navigation"
1420
+ },
1421
+ t
1422
+ ), console.info("[arcgis-portal-ai-assistant] navigation capability selection:", {
1547
1423
  confidence: r.confidence,
1548
1424
  method: "structured-model",
1549
1425
  reason: r.reason,
1550
1426
  request: a,
1551
1427
  selectedCapabilityIds: u
1552
- }), r.confidence < de ? {
1428
+ }), r.confidence < le ? {
1553
1429
  chosenCapabilityIds: [],
1554
1430
  status: "failed",
1555
- summary: `Navigation selection confidence ${r.confidence} is below the required ${de}; defer to the Portal Doc Assistant.`
1431
+ summary: `Navigation selection confidence ${r.confidence} is below the required ${le}; defer to the Portal Doc Assistant.`
1556
1432
  } : { chosenCapabilityIds: u };
1557
1433
  } catch {
1558
- return console.info("[arcgis-portal-ai-assistant] navigation capability selection:", {
1434
+ return await p(
1435
+ { text: "Navigation selection model unavailable; using retrieval order.", agentName: "navigation" },
1436
+ t
1437
+ ), console.info("[arcgis-portal-ai-assistant] navigation capability selection:", {
1559
1438
  method: "structured-model-unavailable",
1560
1439
  request: a,
1561
1440
  selectedCapabilityIds: []
1562
1441
  }), { chosenCapabilityIds: [] };
1563
1442
  }
1564
1443
  };
1565
- function Qa(e, t) {
1444
+ function Va(e, t) {
1566
1445
  const a = R(e);
1567
1446
  return t.targets.filter(
1568
1447
  ({ capability: n }) => [n.title, ...n.hints].some(
@@ -1570,11 +1449,11 @@ function Qa(e, t) {
1570
1449
  )
1571
1450
  ).map(({ capability: n }) => n.id);
1572
1451
  }
1573
- const ze = /* @__PURE__ */ new Set(["1d", "7d", "14d", "30d", "3m", "6m"]), Wa = s.object({
1452
+ const $e = /* @__PURE__ */ new Set(["1d", "7d", "14d", "30d", "3m", "6m"]), Ba = s.object({
1574
1453
  period: s.string(),
1575
1454
  startTime: s.string(),
1576
1455
  endTime: s.string()
1577
- }), Ja = String.raw`Extract temporal filters for an ArcGIS storage-credits query.
1456
+ }), Ka = String.raw`Extract temporal filters for an ArcGIS storage-credits query.
1578
1457
 
1579
1458
  Return JSON only with these optional string fields:
1580
1459
  - period
@@ -1600,14 +1479,14 @@ Now UTC:
1600
1479
 
1601
1480
  User request:
1602
1481
  {userRequest}`;
1603
- async function _a(e, t = /* @__PURE__ */ new Date()) {
1482
+ async function Qa(e, t = /* @__PURE__ */ new Date()) {
1604
1483
  const a = e.trim();
1605
1484
  if (!a)
1606
1485
  return {};
1607
1486
  try {
1608
1487
  const n = await b({
1609
- promptText: Ja,
1610
- schema: Wa,
1488
+ promptText: Ka,
1489
+ schema: Ba,
1611
1490
  modelTier: "fast",
1612
1491
  inputVariables: {
1613
1492
  nowEpochMs: String(t.getTime()),
@@ -1615,19 +1494,19 @@ async function _a(e, t = /* @__PURE__ */ new Date()) {
1615
1494
  userRequest: a
1616
1495
  }
1617
1496
  });
1618
- return Ya(n, t);
1497
+ return Wa(n, t);
1619
1498
  } catch (n) {
1620
1499
  return console.error(n), {};
1621
1500
  }
1622
1501
  }
1623
- function Ya(e, t = /* @__PURE__ */ new Date()) {
1624
- const a = pe(e.startTime), n = pe(e.endTime), o = Ha(e.period);
1502
+ function Wa(e, t = /* @__PURE__ */ new Date()) {
1503
+ const a = de(e.startTime), n = de(e.endTime), o = Ja(e.period);
1625
1504
  if (o) {
1626
1505
  if (a !== void 0 && n !== void 0 && a < n)
1627
1506
  return { period: o, startTime: String(a), endTime: String(n) };
1628
- const r = ze.has(o);
1629
- if (!r || n !== void 0 && !Za(n, t.getTime())) {
1630
- const u = n ?? t.getTime(), c = Xa(o, new Date(u));
1507
+ const r = $e.has(o);
1508
+ if (!r || n !== void 0 && !Ya(n, t.getTime())) {
1509
+ const u = n ?? t.getTime(), c = _a(o, new Date(u));
1631
1510
  if (c !== void 0)
1632
1511
  return {
1633
1512
  period: o,
@@ -1643,7 +1522,7 @@ function Ya(e, t = /* @__PURE__ */ new Date()) {
1643
1522
  }
1644
1523
  return a !== void 0 && n !== void 0 && a < n ? { startTime: String(a), endTime: String(n) } : a !== void 0 ? { startTime: String(a), endTime: String(t.getTime()) } : {};
1645
1524
  }
1646
- function Ha(e) {
1525
+ function Ja(e) {
1647
1526
  const t = e?.trim().match(/^(\d+)\s*([dwm])$/iu);
1648
1527
  if (!t)
1649
1528
  return;
@@ -1653,12 +1532,12 @@ function Ha(e) {
1653
1532
  const n = t[2].toLowerCase();
1654
1533
  if (n === "w") {
1655
1534
  const o = a * 7;
1656
- if (ze.has(`${o}d`))
1535
+ if ($e.has(`${o}d`))
1657
1536
  return `${o}d`;
1658
1537
  }
1659
1538
  return `${a}${n}`;
1660
1539
  }
1661
- function Xa(e, t) {
1540
+ function _a(e, t) {
1662
1541
  const a = e.match(/^(\d+)([dwm])$/u);
1663
1542
  if (!a)
1664
1543
  return;
@@ -1673,38 +1552,167 @@ function Xa(e, t) {
1673
1552
  const r = new Date(t.getTime());
1674
1553
  return r.setUTCMonth(r.getUTCMonth() - n), r.getTime();
1675
1554
  }
1676
- function pe(e) {
1555
+ function de(e) {
1677
1556
  if (!e)
1678
1557
  return;
1679
1558
  const t = Number.parseInt(e, 10);
1680
1559
  if (!(!Number.isFinite(t) || t <= 0))
1681
1560
  return t;
1682
1561
  }
1683
- function Za(e, t) {
1562
+ function Ya(e, t) {
1684
1563
  const a = new Date(e), n = new Date(t);
1685
1564
  return a.getUTCFullYear() === n.getUTCFullYear() && a.getUTCMonth() === n.getUTCMonth() && a.getUTCDate() === n.getUTCDate();
1686
1565
  }
1687
- async function en(e, t, a) {
1688
- const n = S().find((r) => r.id === e);
1566
+ const Ha = {
1567
+ schemaVersion: "1.0",
1568
+ capabilities: [
1569
+ {
1570
+ id: "my-content",
1571
+ title: "My content",
1572
+ description: "Browse, discover, search, and filter ArcGIS content—including maps, apps, datasets, and other items—that you own or can access.",
1573
+ hints: ["view my content", "show my content", "my content"],
1574
+ platforms: ["online", "enterprise"],
1575
+ resolutions: {
1576
+ navigate: {
1577
+ routeKey: "content"
1578
+ }
1579
+ }
1580
+ },
1581
+ {
1582
+ id: "create-feature-layer",
1583
+ title: "Create feature layer",
1584
+ description: "Generate an editable feature layer by copying fields from templates or existing layers.",
1585
+ hints: ["add a feature layer", "make a feature layer", "generate a feature layer"],
1586
+ platforms: ["online", "enterprise"],
1587
+ resolutions: {
1588
+ navigate: {
1589
+ routeKey: "content"
1590
+ }
1591
+ }
1592
+ },
1593
+ {
1594
+ id: "create-folder",
1595
+ title: "Create folder",
1596
+ description: "Create a new folder in your ArcGIS content to organize your items.",
1597
+ hints: ["create a folder", "make a folder", "set up a folder", "new folder"],
1598
+ platforms: ["online", "enterprise"],
1599
+ resolutions: {
1600
+ navigate: {
1601
+ routeKey: "content"
1602
+ }
1603
+ }
1604
+ }
1605
+ ]
1606
+ }, Xa = {
1607
+ schemaVersion: "1.0",
1608
+ capabilities: [
1609
+ {
1610
+ id: "my groups",
1611
+ title: "My groups",
1612
+ description: "Browse, discover, search, and filter ArcGIS content collections—including maps, apps, datasets, and other items—that you own, belong to, or can access.",
1613
+ hints: ["view my groups", "show my groups", "my groups"],
1614
+ platforms: ["online", "enterprise"],
1615
+ resolutions: {
1616
+ navigate: {
1617
+ routeKey: "groups"
1618
+ }
1619
+ }
1620
+ },
1621
+ {
1622
+ id: "create-group",
1623
+ title: "Create group",
1624
+ description: "Create a new ArcGIS Portal group owned by the signed-in user.",
1625
+ hints: ["create a group", "make a group", "set up a group", "new group"],
1626
+ platforms: ["online", "enterprise"],
1627
+ resolutions: {
1628
+ navigate: {
1629
+ routeKey: "groups"
1630
+ }
1631
+ }
1632
+ },
1633
+ {
1634
+ id: "featured-groups",
1635
+ title: "Featured groups",
1636
+ description: "Browse, discover, search, and filter ArcGIS content collections—including maps, apps, datasets, and other items—that organization administrators choose to highlight in ArcGIS.",
1637
+ hints: ["view featured groups", "show featured groups", "highlighted groups", "top groups"],
1638
+ platforms: ["online", "enterprise"],
1639
+ resolutions: {
1640
+ navigate: {
1641
+ routeKey: "groups",
1642
+ hash: "featured"
1643
+ }
1644
+ }
1645
+ },
1646
+ {
1647
+ id: "organization-groups",
1648
+ title: "Organization groups",
1649
+ description: "Browse, discover, search, and filter ArcGIS content collections—including maps, apps, datasets, and other items—that are specific to your organization in ArcGIS.",
1650
+ hints: ["view organization groups", "show organization groups"],
1651
+ platforms: ["online", "enterprise"],
1652
+ resolutions: {
1653
+ navigate: {
1654
+ routeKey: "groups",
1655
+ hash: "organization"
1656
+ }
1657
+ }
1658
+ }
1659
+ ]
1660
+ }, Za = {
1661
+ schemaVersion: "1.0",
1662
+ capabilities: [
1663
+ {
1664
+ id: "org-config-mfa",
1665
+ title: "Multifactor Authentication (MFA)",
1666
+ description: "Configure organization-level multifactor authentication (MFA) settings. Administrators can enable MFA for ArcGIS logins, allow recovery codes for members, view MFA adoption status, enforce MFA requirements for all members, manage the MFA exemption list, and designate administrators who can troubleshoot MFA issues.",
1667
+ hints: ["config MFA", "set up MFA"],
1668
+ platforms: ["online", "enterprise"],
1669
+ resolutions: {
1670
+ navigate: {
1671
+ routeKey: "organization",
1672
+ queryParams: {
1673
+ tab: "security"
1674
+ },
1675
+ hash: "settings"
1676
+ }
1677
+ }
1678
+ }
1679
+ ]
1680
+ }, en = {
1681
+ "contentRouteRegistry.ts": Ha,
1682
+ "groupsRouteRegistry.ts": Xa,
1683
+ "orgSettingsRouteRegistry.ts": Za
1684
+ };
1685
+ function pe(e) {
1686
+ const t = [], a = /* @__PURE__ */ new Set();
1687
+ for (const [n, o] of Object.entries(e))
1688
+ for (const r of o.capabilities) {
1689
+ if (a.has(r.id))
1690
+ throw new Error(`${n}: duplicate capability id "${r.id}" across registries`);
1691
+ a.add(r.id), t.push(r);
1692
+ }
1693
+ return t;
1694
+ }
1695
+ let z;
1696
+ function T(e) {
1697
+ return e ? z = pe({ customCapabilities: e }) : z || (z = pe(en)), z;
1698
+ }
1699
+ async function tn(e, t, a) {
1700
+ const n = T().find((r) => r.id === e);
1689
1701
  if (!n)
1690
1702
  return;
1691
- const o = await an(tn(n), a);
1692
- return o && on(o, t) ? { capability: n, target: o } : void 0;
1703
+ const o = await nn(an(n), a);
1704
+ return o && rn(o, t) ? { capability: n, target: o } : void 0;
1693
1705
  }
1694
- function tn(e) {
1706
+ function an(e) {
1695
1707
  const { hash: t, queryParams: a, routeKey: n } = e.resolutions.navigate;
1696
1708
  switch (n) {
1697
1709
  case "content":
1698
- switch (e.id) {
1699
- case "my-content":
1700
- return { destinationType: "portal-content" };
1701
- case "create-feature-layer":
1702
- return { destinationType: "portal-content" };
1703
- case "create-folder":
1704
- return { destinationType: "portal-content" };
1705
- default:
1706
- return { destinationType: "portal-content" };
1707
- }
1710
+ return {
1711
+ destinationType: "portal-content",
1712
+ hash: t,
1713
+ queryParams: a,
1714
+ buttonLabel: e.buttonLabel
1715
+ };
1708
1716
  case "groups":
1709
1717
  if (t === "featured")
1710
1718
  return { destinationType: "portal-groups", hash: "featured" };
@@ -1729,10 +1737,10 @@ function tn(e) {
1729
1737
  return;
1730
1738
  }
1731
1739
  }
1732
- async function an(e, t) {
1733
- if (!e || !t || !nn(e))
1740
+ async function nn(e, t) {
1741
+ if (!e || !t || !on(e))
1734
1742
  return e;
1735
- const a = await _a(t);
1743
+ const a = await Qa(t);
1736
1744
  if (!a.period && !a.startTime && !a.endTime)
1737
1745
  return e;
1738
1746
  const n = {
@@ -1743,13 +1751,13 @@ async function an(e, t) {
1743
1751
  };
1744
1752
  return { ...e, queryParams: n };
1745
1753
  }
1746
- function nn(e) {
1754
+ function on(e) {
1747
1755
  return e.destinationType === "portal-org" && e.hash === "status";
1748
1756
  }
1749
- function on(e, t) {
1757
+ function rn(e, t) {
1750
1758
  return !t || !!t[e.destinationType];
1751
1759
  }
1752
- const rn = async (e, t) => {
1760
+ const sn = async (e, t) => {
1753
1761
  if (e.outputMessage || e.status === "failed")
1754
1762
  return {};
1755
1763
  const a = e.targets.find(({ capability: r }) => e.chosenCapabilityIds.includes(r.id)) ?? e.targets[0];
@@ -1760,8 +1768,8 @@ const rn = async (e, t) => {
1760
1768
  status: "success",
1761
1769
  summary: "Navigation could not find a matching capability; route another agent if appropriate."
1762
1770
  };
1763
- const n = me(e), o = await en(a.capability.id, void 0, n);
1764
- return o ? (await g({ text: "Preparing navigation...", agentName: "navigation" }, t), await F(o.target, t), {
1771
+ const n = me(e), o = await tn(a.capability.id, void 0, n);
1772
+ return o ? (await p({ text: "Preparing navigation...", agentName: "navigation" }, t), await F(o.target, t), {
1765
1773
  outputMessage: e.chosenCapabilityIds.length ? a.capability.description : `The closest place to start is ${a.capability.title}. Click the button below to open it.`,
1766
1774
  status: "success",
1767
1775
  summary: `Navigation suggested ${a.capability.id}${e.retrievalDegraded ? " using keyword-only retrieval" : ""}.`,
@@ -1776,14 +1784,14 @@ const rn = async (e, t) => {
1776
1784
  function me(e) {
1777
1785
  return I(e.agentExecutionContext.messages) || e.agentExecutionContext.userRequest;
1778
1786
  }
1779
- async function $e(e) {
1780
- return e.length === 0 ? [] : (await nt.getDefault().load(), await Ke(e));
1787
+ async function De(e) {
1788
+ return e.length === 0 ? [] : (await ot.getDefault().load(), await Qe(e));
1781
1789
  }
1782
- const sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1790
+ const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1783
1791
  __proto__: null,
1784
- generateEmbeddings: $e
1792
+ generateEmbeddings: De
1785
1793
  }, Symbol.toStringTag, { value: "Module" }));
1786
- function cn(e) {
1794
+ function un(e) {
1787
1795
  const t = [], a = `${e.title}. ${e.description}`;
1788
1796
  a.trim().length > 0 && t.push({ field: "summary", text: a });
1789
1797
  const n = e.hints;
@@ -1793,20 +1801,20 @@ function cn(e) {
1793
1801
  return t;
1794
1802
  }
1795
1803
  let $, X, D = 0;
1796
- async function un(e = {}) {
1804
+ async function ln(e = {}) {
1797
1805
  const t = D;
1798
- return $ ??= dn(e.embed ?? pn).then((a) => (t === D && (X = a), a)).catch((a) => {
1806
+ return $ ??= pn(e.embed ?? mn).then((a) => (t === D && (X = a), a)).catch((a) => {
1799
1807
  throw t === D && ($ = void 0), a;
1800
1808
  }), await $;
1801
1809
  }
1802
- function ln() {
1810
+ function dn() {
1803
1811
  return X;
1804
1812
  }
1805
1813
  function ge() {
1806
1814
  D += 1, X = void 0, $ = void 0;
1807
1815
  }
1808
- async function dn(e) {
1809
- const t = mn(), a = await e(t.map((n) => n.text));
1816
+ async function pn(e) {
1817
+ const t = gn(), a = await e(t.map((n) => n.text));
1810
1818
  if (a.length !== t.length)
1811
1819
  throw new Error(`Expected ${t.length} vectors, got ${a.length}`);
1812
1820
  return t.map((n, o) => ({
@@ -1814,33 +1822,33 @@ async function dn(e) {
1814
1822
  vector: a[o]
1815
1823
  }));
1816
1824
  }
1817
- async function pn(e) {
1818
- const { generateEmbeddings: t } = await Promise.resolve().then(() => sn);
1825
+ async function mn(e) {
1826
+ const { generateEmbeddings: t } = await Promise.resolve().then(() => cn);
1819
1827
  return await t(e);
1820
1828
  }
1821
- function mn() {
1822
- return S().flatMap(
1823
- (e) => cn(e).map(({ field: t, text: a }) => ({
1829
+ function gn() {
1830
+ return T().flatMap(
1831
+ (e) => un(e).map(({ field: t, text: a }) => ({
1824
1832
  capabilityId: e.id,
1825
1833
  field: t,
1826
1834
  text: a
1827
1835
  }))
1828
1836
  );
1829
1837
  }
1830
- const he = 1.2, fe = 0.75, gn = 60, hn = 0.65, V = {
1838
+ const he = 1.2, fe = 0.75, hn = 60, fn = 0.65, V = {
1831
1839
  description: 1,
1832
1840
  hint: 2,
1833
1841
  title: 3
1834
1842
  };
1835
1843
  let W;
1836
- function fn() {
1844
+ function yn() {
1837
1845
  W = void 0;
1838
1846
  }
1839
- async function yn(e, t = {}) {
1840
- const a = In(De(e));
1847
+ async function wn(e, t = {}) {
1848
+ const a = xn(Re(e));
1841
1849
  let n = [], o = !1, r;
1842
1850
  if (e.trim()) {
1843
- const i = t.loadEmbeddings, u = ln();
1851
+ const i = t.loadEmbeddings, u = dn();
1844
1852
  if (!i && !u)
1845
1853
  o = !0, r = "Capability embeddings are still loading.";
1846
1854
  else
@@ -1864,13 +1872,13 @@ async function yn(e, t = {}) {
1864
1872
  ...r ? { degradedReason: r } : {},
1865
1873
  // RRF combines ranks rather than raw scores because BM25 and cosine
1866
1874
  // similarity are on different scales.
1867
- matches: xn(a, n, t.topN ?? 5)
1875
+ matches: Tn(a, n, t.topN ?? 5)
1868
1876
  };
1869
1877
  }
1870
- function wn() {
1871
- return W ??= vn(S()), W;
1878
+ function vn() {
1879
+ return W ??= bn(T()), W;
1872
1880
  }
1873
- function vn(e) {
1881
+ function bn(e) {
1874
1882
  const t = /* @__PURE__ */ new Map(), a = e.map((n) => {
1875
1883
  const o = /* @__PURE__ */ new Map();
1876
1884
  B(o, n.title, V.title), B(o, n.description, V.description);
@@ -1880,7 +1888,7 @@ function vn(e) {
1880
1888
  t.set(r, (t.get(r) ?? 0) + 1);
1881
1889
  return {
1882
1890
  capability: n,
1883
- length: bn(o),
1891
+ length: In(o),
1884
1892
  termFrequencies: o
1885
1893
  };
1886
1894
  });
@@ -1891,28 +1899,28 @@ function vn(e) {
1891
1899
  };
1892
1900
  }
1893
1901
  function B(e, t, a) {
1894
- for (const n of De(t))
1902
+ for (const n of Re(t))
1895
1903
  e.set(n, (e.get(n) ?? 0) + a);
1896
1904
  }
1897
- function bn(e) {
1905
+ function In(e) {
1898
1906
  return [...e.values()].reduce((t, a) => t + a, 0);
1899
1907
  }
1900
- function De(e) {
1908
+ function Re(e) {
1901
1909
  return e.toLowerCase().split(/[^a-z0-9]+/u).filter(Boolean);
1902
1910
  }
1903
- function In(e) {
1904
- const t = wn(), a = new Set(e), n = t.documents.length;
1911
+ function xn(e) {
1912
+ const t = vn(), a = new Set(e), n = t.documents.length;
1905
1913
  return t.documents.map(({ capability: o, length: r, termFrequencies: i }) => {
1906
1914
  let u = 0;
1907
1915
  for (const c of a) {
1908
1916
  const d = i.get(c), l = t.documentFrequency.get(c);
1909
1917
  if (!d || !l)
1910
1918
  continue;
1911
- const p = Math.log(1 + (n - l + 0.5) / (l + 0.5)), m = he * (1 - fe + fe * (r / t.averageDocumentLength));
1912
- u += p * (d * (he + 1) / (d + m));
1919
+ const m = Math.log(1 + (n - l + 0.5) / (l + 0.5)), g = he * (1 - fe + fe * (r / t.averageDocumentLength));
1920
+ u += m * (d * (he + 1) / (d + g));
1913
1921
  }
1914
1922
  return { capability: o, score: u };
1915
- }).filter(({ score: o }) => o > 0).sort(Re);
1923
+ }).filter(({ score: o }) => o > 0).sort(Ue);
1916
1924
  }
1917
1925
  function ye(e, t) {
1918
1926
  const a = /* @__PURE__ */ new Map();
@@ -1923,11 +1931,11 @@ function ye(e, t) {
1923
1931
  const i = a.get(o.capabilityId);
1924
1932
  (i === void 0 || r > i) && a.set(o.capabilityId, r);
1925
1933
  }
1926
- const n = new Map(S().map((o) => [o.id, o]));
1934
+ const n = new Map(T().map((o) => [o.id, o]));
1927
1935
  return [...a.entries()].flatMap(([o, r]) => {
1928
1936
  const i = n.get(o);
1929
- return i && r >= hn ? [{ capability: i, score: r }] : [];
1930
- }).sort(Re);
1937
+ return i && r >= fn ? [{ capability: i, score: r }] : [];
1938
+ }).sort(Ue);
1931
1939
  }
1932
1940
  function Sn(e, t) {
1933
1941
  if (e.length === 0 || e.length !== t.length)
@@ -1939,30 +1947,36 @@ function Sn(e, t) {
1939
1947
  return r === 0 ? void 0 : a / r;
1940
1948
  }
1941
1949
  async function we(e) {
1942
- const [t] = await $e([e]);
1950
+ const [t] = await De([e]);
1943
1951
  if (!t)
1944
1952
  throw new Error("Expected one query embedding.");
1945
1953
  return t;
1946
1954
  }
1947
- function xn(e, t, a) {
1955
+ function Tn(e, t, a) {
1948
1956
  const n = /* @__PURE__ */ new Map();
1949
1957
  return ve(n, e, "keyword"), ve(n, t, "semantic"), [...n.values()].sort((o, r) => r.score !== o.score ? r.score - o.score : (r.semanticScore ?? 0) !== (o.semanticScore ?? 0) ? (r.semanticScore ?? 0) - (o.semanticScore ?? 0) : (r.keywordScore ?? 0) !== (o.keywordScore ?? 0) ? (r.keywordScore ?? 0) - (o.keywordScore ?? 0) : o.capability.id.localeCompare(r.capability.id)).slice(0, Math.max(0, a));
1950
1958
  }
1951
1959
  function ve(e, t, a) {
1952
1960
  for (const [n, { capability: o, score: r }] of t.entries()) {
1953
1961
  const i = n + 1, u = e.get(o.id) ?? { capability: o, score: 0 };
1954
- u.score += 1 / (gn + i), a === "keyword" ? (u.keywordRank = i, u.keywordScore = r) : (u.semanticRank = i, u.semanticScore = r), e.set(o.id, u);
1962
+ u.score += 1 / (hn + i), a === "keyword" ? (u.keywordRank = i, u.keywordScore = r) : (u.semanticRank = i, u.semanticScore = r), e.set(o.id, u);
1955
1963
  }
1956
1964
  }
1957
- function Re(e, t) {
1965
+ function Ue(e, t) {
1958
1966
  return t.score - e.score || e.capability.id.localeCompare(t.capability.id);
1959
1967
  }
1960
- const Tn = async (e, t) => {
1961
- await g({ text: "Finding a place to navigate...", agentName: "navigation" }, t);
1968
+ const Mn = async (e, t) => {
1969
+ await p({ text: "Finding a place to navigate...", agentName: "navigation" }, t);
1962
1970
  const a = I(e.agentExecutionContext.messages).trim();
1963
1971
  try {
1964
- const n = await yn(a, { topN: 5 });
1965
- return console.table(
1972
+ const n = await wn(a, { topN: 5 });
1973
+ return await p(
1974
+ {
1975
+ text: `Navigation candidates: ${An(n.matches)}`,
1976
+ agentName: "navigation"
1977
+ },
1978
+ t
1979
+ ), console.table(
1966
1980
  n.matches.map(({ capability: o, keywordRank: r, keywordScore: i, semanticRank: u, semanticScore: c, score: d }) => ({
1967
1981
  capability: o.title,
1968
1982
  fusedScore: d,
@@ -1974,7 +1988,7 @@ const Tn = async (e, t) => {
1974
1988
  ), n.degradedReason && console.info("[arcgis-portal-ai-assistant] navigation semantic search:", n.degradedReason), {
1975
1989
  chosenCapabilityIds: [],
1976
1990
  retrievalDegraded: n.degradedReason ?? "",
1977
- targets: Mn(a, n.matches)
1991
+ targets: Cn(a, n.matches)
1978
1992
  };
1979
1993
  } catch {
1980
1994
  return {
@@ -1985,7 +1999,7 @@ const Tn = async (e, t) => {
1985
1999
  };
1986
2000
  }
1987
2001
  };
1988
- function Mn(e, t) {
2002
+ function Cn(e, t) {
1989
2003
  const a = R(e), n = t.filter(
1990
2004
  ({ capability: r }) => [r.title, ...r.hints].some(
1991
2005
  (i) => R(i) === a
@@ -1996,34 +2010,45 @@ function Mn(e, t) {
1996
2010
  const [o] = n;
1997
2011
  return [o, ...t.filter((r) => r !== o)];
1998
2012
  }
1999
- const K = (e, t) => t ?? e, Ue = h.Root({
2000
- ...G(),
2013
+ function An(e) {
2014
+ return e.map(
2015
+ ({ capability: t, keywordScore: a, semanticScore: n }) => `${t.title} (keyword: ${be(a)}, semantic: ${be(n)})`
2016
+ ).join("; ") || "none";
2017
+ }
2018
+ function be(e) {
2019
+ return e?.toFixed(3) ?? "none";
2020
+ }
2021
+ const K = (e, t) => t ?? e, Fe = h.Root({
2022
+ ...P(),
2001
2023
  chosenCapabilityIds: h({ reducer: K, default: () => [] }),
2002
2024
  // Empty when hybrid keyword-and-semantic retrieval succeeds; otherwise
2003
2025
  // contains the semantic-search failure reason for response diagnostics.
2004
2026
  retrievalDegraded: h({ reducer: K, default: () => "" }),
2005
2027
  targets: h({ reducer: K, default: () => [] })
2006
- }), Cn = () => new N(Ue).addNode("retrieveNavigationTargets", Tn).addNode("chooseNavigationTargets", Ka).addNode("respondWithNavigation", rn).addEdge(P, "retrieveNavigationTargets").addEdge("retrieveNavigationTargets", "chooseNavigationTargets").addEdge("chooseNavigationTargets", "respondWithNavigation").addEdge("respondWithNavigation", w);
2007
- function An() {
2008
- const e = S().map(({ hints: t, title: a }) => t[0] ?? a).join(", ");
2009
- return String.raw`- **portal-navigation** - Portal page navigation assistant:
2010
- - routes requests to open, show, or navigate to a Portal page, including creation-flow pages
2011
- - falls back to the closest Portal page where a workflow starts when another agent cannot perform the action
2012
- - handles short navigation follow-ups after asking the user to open a page
2013
- - capability examples: ${e}
2014
- - do not use for general "how do I" questions unless the user explicitly asks to reach a page
2015
- `;
2016
- }
2017
- const Nn = {
2028
+ }), Nn = () => new N(Fe).addNode("retrieveNavigationTargets", Mn).addNode("chooseNavigationTargets", ja).addNode("respondWithNavigation", sn).addEdge(G, "retrieveNavigationTargets").addEdge("retrieveNavigationTargets", "chooseNavigationTargets").addEdge("chooseNavigationTargets", "respondWithNavigation").addEdge("respondWithNavigation", w);
2029
+ function Gn() {
2030
+ return String.raw`- **Navigation** — Takes the user to the portal page or app that fulfills their request. Presenting the button COMPLETES the request — no follow-up step is needed.
2031
+
2032
+ Route here for **navigation intent** ("take me to the map viewer", "open content", "where is X?") and for **action intent** ("publish a scene layer", "create a web map", "share this item") — for an action, Navigation takes the user to the page where that workflow starts. Navigation searches the capability registry itself, so don't rule it out because a page isn't named here.
2033
+
2034
+ If Navigation just asked the user for a missing value (such as an item id), route the user's short follow-up answer — often just an id like "797f6c0d300a4ddc87a8ae14cd2eeb8e" — back here so it can finish.
2035
+
2036
+ Do NOT route here for:
2037
+ - An action another agent actually performs — e.g. "create group" is EXECUTED by group agent. Route it here only when the user explicitly asks to navigate ("take me to create group")
2038
+ - Requests that mix navigation with a question or explanation ("take me there and explain how") → use Help
2039
+
2040
+ Do not dispatch Navigation again for the same request in the same turn: once it has responded, the task is done.`;
2041
+ }
2042
+ const Pn = {
2018
2043
  id: "navigation",
2019
2044
  name: "Portal Navigation",
2020
2045
  get description() {
2021
- return An();
2046
+ return Gn();
2022
2047
  },
2023
- createGraph: Cn,
2024
- workspace: Ue
2025
- }, Pn = je`:host{height:100%;border-width:1px;border-style:solid;border-color:var(--calcite-color-border-3);display:block;width:100%;--tw-shadow: 0 1px 6px -1px rgba(0, 0, 0, .16), 0 1px 2px -1px rgba(0, 0, 0, .08);--tw-shadow-colored: 0 1px 6px -1px var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.chat-entry{display:flex;flex-direction:column;gap:.75rem;width:100%}.chat-actions{display:flex;justify-content:flex-end;gap:.5rem}.header-actions{display:flex;gap:.5rem;padding-inline-start:.75rem}.navigation-block{display:flex;flex-direction:column;align-items:stretch;gap:.35rem;margin-top:.5rem}.navigation-button{width:100%;margin-block:.25rem}.navigation-block-description{font-size:.75rem;color:var(--calcite-color-text-3)}`;
2026
- function Gn(e, t) {
2048
+ createGraph: Nn,
2049
+ workspace: Fe
2050
+ }, qn = Ve`:host{height:100%;border-width:1px;border-style:solid;border-color:var(--calcite-color-border-3);display:block;width:100%;--tw-shadow: 0 1px 6px -1px rgba(0, 0, 0, .16), 0 1px 2px -1px rgba(0, 0, 0, .08);--tw-shadow-colored: 0 1px 6px -1px var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.chat-entry{display:flex;flex-direction:column;gap:.75rem;width:100%}.chat-actions{display:flex;justify-content:flex-end;gap:.5rem}.header-actions{display:flex;gap:.5rem;padding-inline-start:.75rem}.navigation-block{display:flex;flex-direction:column;align-items:stretch;gap:.35rem;margin-top:.5rem}.navigation-button{width:100%;margin-block:.25rem}.navigation-block-description{font-size:.75rem;color:var(--calcite-color-text-3)}`;
2051
+ function En(e, t) {
2027
2052
  if (!t)
2028
2053
  return;
2029
2054
  const { destinationType: a } = e;
@@ -2048,11 +2073,11 @@ function Gn(e, t) {
2048
2073
  return U(a);
2049
2074
  }
2050
2075
  }
2051
- function qn(e) {
2052
- const t = At.safeParse(e);
2076
+ function kn(e) {
2077
+ const t = Nt.safeParse(e);
2053
2078
  return t.success ? t.data : void 0;
2054
2079
  }
2055
- function En(e, t) {
2080
+ function zn(e, t) {
2056
2081
  const a = t.navigation;
2057
2082
  switch (e.destinationType) {
2058
2083
  case "portal-content":
@@ -2097,21 +2122,21 @@ function En(e, t) {
2097
2122
  return U(e);
2098
2123
  }
2099
2124
  }
2100
- class kn extends Oe {
2125
+ class $n extends Le {
2101
2126
  constructor() {
2102
- super(), this.t9n = Be({ blocking: !0 }), this.assistantEl = E(), this.formEl = E(), this.voiceInputEl = E(), this.inputEl = E(), this.navigationSlotElements = /* @__PURE__ */ new Map(), this.handleSlottableRequest = (t) => {
2127
+ super(), this.t9n = Ke({ blocking: !0 }), this.assistantEl = E(), this.formEl = E(), this.voiceInputEl = E(), this.inputEl = E(), this.navigationSlotElements = /* @__PURE__ */ new Map(), this.handleSlottableRequest = (t) => {
2103
2128
  const a = t.detail, n = a.data?.block;
2104
2129
  if (!n)
2105
2130
  return;
2106
2131
  const o = this.getNavigationAction(n);
2107
2132
  o && this.upsertNavigationSlotElement(a.slotName, o);
2108
- }, this.inputText = "", this.showVoiceInput = !0, this.isListening = !1, this.isVoiceInputDisabled = !1, this.interrupt = null, this.autoDestroyDisabled = !1, this.defaultClosed = !1, this.useProdDocAssistant = !1, this.arcgisPortalNavigationRequest = Le(), S();
2133
+ }, this.inputText = "", this.showVoiceInput = !0, this.isListening = !1, this.isVoiceInputDisabled = !1, this.interrupt = null, this.autoDestroyDisabled = !1, this.defaultClosed = !1, this.useProdDocAssistant = !1, this.arcgisPortalNavigationRequest = je(), T();
2109
2134
  }
2110
2135
  static {
2111
2136
  this.properties = { inputText: 16, showVoiceInput: 16, isListening: 16, isVoiceInputDisabled: 16, interrupt: 16, autoDestroyDisabled: 5, portal: 0, user: 0, config: 0, navigationTargetMap: 0, disabledAgents: 0, defaultClosed: 5, navigationCapabilities: 0, useProdDocAssistant: 5 };
2112
2137
  }
2113
2138
  static {
2114
- this.styles = Pn;
2139
+ this.styles = qn;
2115
2140
  }
2116
2141
  async load() {
2117
2142
  await this.refreshCapabilityEmbeddings();
@@ -2127,23 +2152,23 @@ class kn extends Oe {
2127
2152
  }
2128
2153
  async refreshCapabilityEmbeddings() {
2129
2154
  try {
2130
- S(this.navigationCapabilities), fn(), ge(), await un();
2155
+ T(this.navigationCapabilities), yn(), ge(), await ln();
2131
2156
  } catch (t) {
2132
2157
  console.warn("[arcgis-portal-ai-assistant] embeddings warm-up failed:", t);
2133
2158
  }
2134
2159
  }
2135
2160
  getNavigationAction(t) {
2136
- if (t?.type !== xe)
2161
+ if (t?.type !== Te)
2137
2162
  return;
2138
- const a = t.data, n = qn(a);
2163
+ const a = t.data, n = kn(a);
2139
2164
  if (!n)
2140
2165
  return;
2141
- const o = Gn(a, this.navigationTargetMap);
2166
+ const o = En(a, this.navigationTargetMap);
2142
2167
  if (o)
2143
2168
  return {
2144
2169
  href: o,
2145
2170
  targetDetail: a,
2146
- label: a?.buttonLabel || En(n, this.t9n)
2171
+ label: a?.buttonLabel || zn(n, this.t9n)
2147
2172
  };
2148
2173
  }
2149
2174
  upsertNavigationSlotElement(t, a) {
@@ -2152,7 +2177,7 @@ class kn extends Oe {
2152
2177
  return;
2153
2178
  const o = `navigation:${t}`;
2154
2179
  let r = this.navigationSlotElements.get(o);
2155
- r || (r = document.createElement("div"), r.slot = t, this.navigationSlotElements.set(o, r), n.append(r)), Ve(v`<div><calcite-button class="navigation-button" appearance=outline width=full .href=${a.href} icon-end=launch @click=${(i) => {
2180
+ r || (r = document.createElement("div"), r.slot = t, this.navigationSlotElements.set(o, r), n.append(r)), Be(v`<div><calcite-button class="navigation-button" appearance=outline width=full .href=${a.href} icon-end=launch @click=${(i) => {
2156
2181
  i.preventDefault(), this.arcgisPortalNavigationRequest.emit({
2157
2182
  href: a.href,
2158
2183
  targetDetail: a.targetDetail
@@ -2173,8 +2198,8 @@ class kn extends Oe {
2173
2198
  });
2174
2199
  }} ${k(this.assistantEl)}><div slot=header-actions-start class="header-actions"><calcite-icon icon=effects></calcite-icon></div><form slot=chat-entry class="chat-entry" @submit=${(l) => {
2175
2200
  l.preventDefault();
2176
- const p = a.trim();
2177
- p && (this.assistantEl.value?.submitMessage(p), this.inputText = "");
2201
+ const m = a.trim();
2202
+ m && (this.assistantEl.value?.submitMessage(m), this.inputText = "");
2178
2203
  }} ${k(this.formEl)}><arcgis-portal-mentionable-text-area .portal=${n} .user=${o} rows=3 .popoverListLabel=${t.mentionEntities} .placeholder=${t.placeholder} .value=${a} @arcgisUserMentionableTextAreaKeyDown=${({ detail: l }) => {
2179
2204
  l.key === "Enter" && !l.shiftKey && (l.preventDefault(), this.formEl.value?.requestSubmit());
2180
2205
  }} @arcgisUserMentionableTextAreaChange=${({ detail: l }) => {
@@ -2191,14 +2216,14 @@ class kn extends Oe {
2191
2216
  this.isVoiceInputDisabled = !0;
2192
2217
  const l = this.voiceInputEl.value;
2193
2218
  u ? await l?.stopListening() : await l?.startListening();
2194
- }}></calcite-button>` || ""}<calcite-button type=submit icon-start=send round .disabled=${!a.trim()} .label=${t.send}>${t.send}</calcite-button></div></form>${this.isAgentEnabled("itemAnalytics") && v`<arcgis-assistant-agent .agent=${Ra} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("groupCreation") && v`<arcgis-assistant-agent .agent=${qt} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("docAssistant") && v`<arcgis-assistant-agent .agent=${na} .context=${{ portal: n, user: o, navigationTargetMap: r, useProdDocAssistant: d }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("groupAnalytics") && v`<arcgis-assistant-agent .agent=${Ma} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("navigation") && v`<arcgis-assistant-agent .agent=${Nn} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.interrupt && v`<arcgis-portal-ai-assistant-interrupt slot=interrupt .type=${this.interrupt.type} .message=${this.interrupt.message} .options=${this.interrupt.options} @arcgisSubmit=${({ detail: l }) => {
2219
+ }}></calcite-button>` || ""}<calcite-button type=submit icon-start=send round .disabled=${!a.trim()} .label=${t.send}>${t.send}</calcite-button></div></form>${this.isAgentEnabled("itemAnalytics") && v`<arcgis-assistant-agent .agent=${Ua} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("groupCreation") && v`<arcgis-assistant-agent .agent=${Et} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("docAssistant") && v`<arcgis-assistant-agent .agent=${oa} .context=${{ portal: n, user: o, navigationTargetMap: r, useProdDocAssistant: d }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("groupAnalytics") && v`<arcgis-assistant-agent .agent=${Ca} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("navigation") && v`<arcgis-assistant-agent .agent=${Pn} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.interrupt && v`<arcgis-portal-ai-assistant-interrupt slot=interrupt .type=${this.interrupt.type} .message=${this.interrupt.message} .options=${this.interrupt.options} @arcgisSubmit=${({ detail: l }) => {
2195
2220
  this.assistantEl.value?.submitInterrupt(l);
2196
2221
  }} @arcgisCancel=${() => {
2197
2222
  this.assistantEl.value?.cancelInterrupt();
2198
2223
  }}></arcgis-portal-ai-assistant-interrupt>` || ""}</arcgis-assistant>`;
2199
2224
  }
2200
2225
  }
2201
- Fe("arcgis-portal-ai-assistant", kn);
2226
+ Oe("arcgis-portal-ai-assistant", $n);
2202
2227
  export {
2203
- kn as ArcgisPortalAiAssistant
2228
+ $n as ArcgisPortalAiAssistant
2204
2229
  };