@arcgis/ai-components 5.2.0-next.11 → 5.2.0-next.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/agent-utils/LLMAgent.js +1 -0
  2. package/dist/cdn/{EBISDZ5H.js → 4UDYY3HL.js} +1 -1
  3. package/dist/cdn/{ERL2CB2Y.js → 55R6J3FL.js} +5 -5
  4. package/dist/cdn/ADYIXCSG.js +2 -0
  5. package/dist/cdn/CAECQD75.js +2 -0
  6. package/dist/cdn/{34SG44C3.js → CE6VDP2D.js} +1 -1
  7. package/dist/cdn/{T43LEBBE.js → CFVVQXPJ.js} +18 -18
  8. package/dist/cdn/CI3QSFPS.js +2 -0
  9. package/dist/cdn/DEAYZ3MK.js +2 -0
  10. package/dist/cdn/{Z2G7MP5L.js → DSVMXDPZ.js} +1 -1
  11. package/dist/cdn/{YLN2BZ5J.js → E2HENO3T.js} +1 -1
  12. package/dist/cdn/{JLKGS6Y5.js → ET453NAD.js} +1 -1
  13. package/dist/cdn/FWU6DFIB.js +2 -0
  14. package/dist/cdn/GPYYAQVI.js +2 -0
  15. package/dist/cdn/JN744CAW.js +2 -0
  16. package/dist/cdn/K475UT3E.js +2 -0
  17. package/dist/cdn/KWTJAVWV.js +2 -0
  18. package/dist/cdn/{5CV7R5IS.js → LREQ3XAW.js} +1 -1
  19. package/dist/cdn/M3SWPT3M.js +2 -0
  20. package/dist/cdn/MAV3DW27.js +4 -0
  21. package/dist/cdn/MRLTR3UO.js +16 -0
  22. package/dist/cdn/PB2ODJC7.js +2 -0
  23. package/dist/cdn/{QCSN44H4.js → QSA4T3BU.js} +1 -1
  24. package/dist/cdn/RMLXVQZ5.js +2 -0
  25. package/dist/cdn/SBHLUL3Q.js +2 -0
  26. package/dist/cdn/{R56X6ZKR.js → SRSFESAD.js} +1 -1
  27. package/dist/cdn/SWBER53G.js +3 -0
  28. package/dist/cdn/WH6QQK6N.js +2 -0
  29. package/dist/cdn/XBW4MWQR.js +2 -0
  30. package/dist/cdn/Z7UWJ4AI.js +3 -0
  31. package/dist/cdn/ZOSUDIJH.js +2 -0
  32. package/dist/cdn/ZPLFFLPF.js +2 -0
  33. package/dist/cdn/agent-utils/index.js +1 -1
  34. package/dist/cdn/index.js +1 -1
  35. package/dist/chunks/adapter.js +169 -168
  36. package/dist/chunks/arcgisKnowledgeGraph.js +3 -2
  37. package/dist/chunks/dataExplorationGraph.js +3 -2
  38. package/dist/chunks/generateLayerDescriptions.js +180 -178
  39. package/dist/chunks/helpGraph.js +3 -2
  40. package/dist/chunks/layerStylingGraph.js +1 -0
  41. package/dist/chunks/navigationGraph.js +3 -2
  42. package/dist/chunks/orchestrator.js +49 -48
  43. package/dist/chunks/toolCallResponse.js +10 -9
  44. package/dist/components/arcgis-assistant/customElement.js +54 -48
  45. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +3 -2
  46. package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -0
  47. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +4 -3
  48. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -0
  49. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -0
  50. package/dist/docs/api.json +1 -1
  51. package/dist/docs/docs.json +1 -1
  52. package/dist/docs/web-types.json +1 -1
  53. package/package.json +4 -4
  54. package/dist/cdn/24QNMEFG.js +0 -2
  55. package/dist/cdn/3NBDVZ2I.js +0 -2
  56. package/dist/cdn/53NTYC4I.js +0 -2
  57. package/dist/cdn/AZGGTNA3.js +0 -2
  58. package/dist/cdn/B7WJFBOZ.js +0 -2
  59. package/dist/cdn/DZ2QWNUA.js +0 -3
  60. package/dist/cdn/F6QHMKF5.js +0 -2
  61. package/dist/cdn/H2CHHGGH.js +0 -2
  62. package/dist/cdn/HWKDNS4K.js +0 -4
  63. package/dist/cdn/IMQ4TVHF.js +0 -16
  64. package/dist/cdn/IRZDTYO2.js +0 -2
  65. package/dist/cdn/KHXUWZHB.js +0 -2
  66. package/dist/cdn/LIFK3QSD.js +0 -2
  67. package/dist/cdn/O3EN27N5.js +0 -2
  68. package/dist/cdn/PBO6FZN6.js +0 -2
  69. package/dist/cdn/Q3ZW4FYA.js +0 -3
  70. package/dist/cdn/UPEEHMSY.js +0 -2
  71. package/dist/cdn/WAIFKDR3.js +0 -2
  72. package/dist/cdn/XON27U6U.js +0 -2
  73. package/dist/cdn/YUKR4AZW.js +0 -2
@@ -1,34 +1,36 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { c as $ } from "../../chunks/runtime.js";
3
- import { css as C, html as l } from "lit";
4
- import I from "@arcgis/core/core/Collection.js";
5
- import { whenOnce as P, watch as A, when as x } from "@arcgis/core/core/reactiveUtils.js";
6
- import L from "@arcgis/core/portal/Portal.js";
7
- import { LitElement as R, createEvent as g, nothing as k } from "@arcgis/lumina";
3
+ import { css as I, html as l } from "lit";
4
+ import C from "@arcgis/core/core/Collection.js";
5
+ import { whenOnce as P, watch as A, when as L } from "@arcgis/core/core/reactiveUtils.js";
6
+ import x from "@arcgis/core/portal/Portal.js";
7
+ import { LitElement as R, createEvent as p, nothing as k } from "@arcgis/lumina";
8
+ import * as M from "@arcgis/toolkit/log";
8
9
  import { rethrowError as O } from "@arcgis/toolkit/log";
9
10
  import { createRef as _, ref as v } from "lit/directives/ref.js";
10
- import { u as M } from "../../chunks/useT9n.js";
11
- import { O as D } from "../../chunks/orchestrator.js";
11
+ import { u as D } from "../../chunks/useT9n.js";
12
+ import { O as T } from "../../chunks/orchestrator.js";
12
13
  import "@langchain/core/callbacks/dispatch/web";
13
14
  import "@langchain/core/prompts";
14
15
  import "@langchain/openai";
15
- import T from "@arcgis/core/identity/IdentityManager.js";
16
+ import N from "@arcgis/core/identity/IdentityManager.js";
17
+ import "@arcgis/toolkit/string";
16
18
  import "@arcgis/core/config.js";
17
19
  import "@langchain/core/messages";
18
20
  import "@arcgis/core/layers/FeatureLayer.js";
19
21
  import "../../chunks/generateLayerDescriptions.js";
20
22
  import "@langchain/langgraph/web";
21
- import N from "@arcgis/core/core/Accessor.js";
23
+ import z from "@arcgis/core/core/Accessor.js";
22
24
  import { property as b, subclass as B } from "@arcgis/core/core/accessorSupport/decorators.js";
23
25
  import { g as V } from "../../chunks/utils3.js";
24
26
  import { g as w } from "../../chunks/slottableRequestUtils.js";
25
- const z = C`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%);--calcite-panel-content-bottom-space: 0}.footer-container{display:flex;flex-direction:column;flex:1 1 0;gap:var(--calcite-spacing-md)}.content-container{display:flex;flex-direction:column;flex:1 1 0;min-height:0;position:relative;overflow:auto}.suggested-prompts-container{display:flex;justify-content:center;width:100%;background:var(--calcite-panel-background-color, var(--calcite-color-background))}.suggested-prompts{display:block;padding:var(--calcite-spacing-md);max-width:100%;box-sizing:border-box}.error-notice{padding:var(--calcite-spacing-sm)}.interrupt-waiting-message{font-style:italic;color:var(--calcite-color-text-2)}`;
26
- var H = Object.defineProperty, j = Object.getOwnPropertyDescriptor, m = (c, t, e, i) => {
27
- for (var r = i > 1 ? void 0 : i ? j(t, e) : t, n = c.length - 1, s; n >= 0; n--)
27
+ const q = I`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%);--calcite-panel-content-bottom-space: 0}.footer-container{display:flex;flex-direction:column;flex:1 1 0;gap:var(--calcite-spacing-md)}.content-container{display:flex;flex-direction:column;flex:1 1 0;min-height:0;position:relative;overflow:auto}.suggested-prompts-container{display:flex;justify-content:center;width:100%;background:var(--calcite-panel-background-color, var(--calcite-color-background))}.suggested-prompts{display:block;padding:var(--calcite-spacing-md);max-width:100%;box-sizing:border-box}.error-notice{padding:var(--calcite-spacing-sm)}.interrupt-waiting-message{font-style:italic;color:var(--calcite-color-text-2)}`;
28
+ var H = Object.defineProperty, U = Object.getOwnPropertyDescriptor, m = (c, t, e, i) => {
29
+ for (var r = i > 1 ? void 0 : i ? U(t, e) : t, n = c.length - 1, s; n >= 0; n--)
28
30
  (s = c[n]) && (r = (i ? s(t, e, r) : s(r)) || r);
29
31
  return i && r && H(t, e, r), r;
30
32
  };
31
- const q = async (c) => await new Promise((t) => setTimeout(t, c));
33
+ const j = async (c) => await new Promise((t) => setTimeout(t, c));
32
34
  async function* F(c, {
33
35
  chunkSize: t = 5,
34
36
  // chars per "token"
@@ -37,7 +39,7 @@ async function* F(c, {
37
39
  } = {}) {
38
40
  let i = 0;
39
41
  for (; i < c.length; )
40
- yield c.slice(i, i + t), i += t, await q(e);
42
+ yield c.slice(i, i + t), i += t, await j(e);
41
43
  }
42
44
  async function* E(c, t, e, i) {
43
45
  for await (const r of F(c)) {
@@ -48,7 +50,7 @@ async function* E(c, t, e, i) {
48
50
  yield { type: "block-data", blockType: "text", data: { content: r }, runId: t };
49
51
  }
50
52
  }
51
- let d = class extends N {
53
+ let d = class extends z {
52
54
  constructor(c) {
53
55
  super(c), this.view = null, this.loading = !1, this.processing = !1, this.processingStep = "";
54
56
  }
@@ -66,7 +68,7 @@ let d = class extends N {
66
68
  async _initialize() {
67
69
  this.removeHandles(), await Promise.all([this.portal.load(), this.view?.when()]), this.view && await P(() => !this.view.updating), this._set(
68
70
  "orchestrator",
69
- await D.init({
71
+ await T.init({
70
72
  agents: [...this.agents],
71
73
  view: this.view ?? void 0
72
74
  })
@@ -104,8 +106,8 @@ let d = class extends N {
104
106
  yield { type: "completed", error: "No response received.", log: e, runId: s };
105
107
  return;
106
108
  }
107
- const p = a.content;
108
- if (yield { type: "block-start", blockType: "text", runId: s }, yield* E(p, s, e, t), yield { type: "block-end", blockType: "text", runId: s }, h)
109
+ const g = a.content;
110
+ if (yield { type: "block-start", blockType: "text", runId: s }, yield* E(g, s, e, t), yield { type: "block-end", blockType: "text", runId: s }, h)
109
111
  for (const f of i) {
110
112
  if (t?.aborted) {
111
113
  yield { type: "cancelled", log: e, runId: s };
@@ -119,7 +121,7 @@ let d = class extends N {
119
121
  yield { type: "block-data", blockType: u, data: y, runId: s };
120
122
  yield { type: "block-end", blockType: u, runId: s };
121
123
  }
122
- yield { type: "completed", response: p, blocks: i, log: e, runId: s };
124
+ yield { type: "completed", response: g, blocks: i, log: e, runId: s };
123
125
  return;
124
126
  }
125
127
  case "ux-suggestion": {
@@ -128,18 +130,18 @@ let d = class extends N {
128
130
  break;
129
131
  }
130
132
  case "interrupt": {
131
- const { kind: a, message: o, metadata: h } = n.interrupt, p = Array.isArray(h) ? h.filter((u) => typeof u == "string") : [], f = (() => {
133
+ const { kind: a, message: o, metadata: h } = n.interrupt, g = Array.isArray(h) ? h.filter((u) => typeof u == "string") : [], f = (() => {
132
134
  switch (a) {
133
135
  case "booleanChoice":
134
- return { type: "boolean-choice", message: o, options: p };
136
+ return { type: "boolean-choice", message: o, options: g };
135
137
  case "singleSelection":
136
- return { type: "single-select", message: o, options: p };
138
+ return { type: "single-select", message: o, options: g };
137
139
  case "multipleSelection":
138
- return { type: "multi-select", message: o, options: p };
140
+ return { type: "multi-select", message: o, options: g };
139
141
  case "textInput":
140
142
  return { type: "text-input", message: o };
141
143
  default:
142
- return { type: a, message: o, options: p };
144
+ return { type: a, message: o, options: g };
143
145
  }
144
146
  })();
145
147
  this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload: f, runId: s };
@@ -194,10 +196,10 @@ m([
194
196
  d = m([
195
197
  B("OrchestratorController")
196
198
  ], d);
197
- const G = "Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.", U = "Embeddings not found for this web map.", W = "https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings";
198
- class Y extends R {
199
+ const G = "Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.", W = "Embeddings not found for this web map.", Y = "https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings";
200
+ class J extends R {
199
201
  constructor() {
200
- super(...arguments), this._messages = M({ blocking: !0 }), this.#t = _(), this.#n = _(), this.#s = _(), this.#e = null, this.#o = /* @__PURE__ */ new Map(), this.#i = L.getDefault(), this.#r = (t) => {
202
+ super(...arguments), this._messages = D({ blocking: !0 }), this.#t = _(), this.#n = _(), this.#s = _(), this.#e = null, this.#o = /* @__PURE__ */ new Map(), this.#i = x.getDefault(), this.#r = (t) => {
201
203
  t.stopPropagation(), this.cancelInterrupt();
202
204
  }, this.#a = (t) => {
203
205
  t.stopPropagation();
@@ -217,19 +219,19 @@ class Y extends R {
217
219
  t.stopPropagation();
218
220
  const e = t.detail;
219
221
  this.arcgisFeedback.emit(e);
220
- }, this.#p = (t) => {
222
+ }, this.#g = (t) => {
221
223
  t.stopPropagation();
222
224
  const e = t.detail;
223
225
  this._inputValue = e.prompt, this.arcgisPromptSelect.emit(e);
224
- }, this.#g = (t) => {
226
+ }, this.#p = (t) => {
225
227
  this.arcgisSlottableRequest.emit(t.detail);
226
- }, this._orchestratorController = null, this._interrupt = null, this._interruptDetails = [], this._error = null, this._inputValue = "", this._isAnswering = !1, this._canceling = !1, this.messages = new I([]), this.referenceElement = null, this.suggestedPrompts = [], this.feedbackEnabled = !1, this.keepSuggestedPrompts = !1, this.logEnabled = !1, this.copyEnabled = !1, this.voiceInputEnabled = !1, this.readAloudEnabled = !1, this.assistantAvatarEnabled = !1, this.arcgisCancel = g(), this.arcgisError = g(), this.arcgisFeedback = g(), this.arcgisInterrupt = g(), this.arcgisInterruptCancel = g(), this.arcgisInterruptSubmit = g(), this.arcgisPromptSelect = g(), this.arcgisReady = g(), this.arcgisSubmit = g(), this.arcgisSlottableRequest = g({ bubbles: !1, composed: !1 }), this.arcgisResponse = g();
228
+ }, this._orchestratorController = null, this._interrupt = null, this._interruptDetails = [], this._error = null, this._inputValue = "", this._isAnswering = !1, this._canceling = !1, this.messages = new C([]), this.referenceElement = null, this.suggestedPrompts = [], this.feedbackEnabled = !1, this.keepSuggestedPrompts = !1, this.logEnabled = !1, this.copyEnabled = !1, this.voiceInputEnabled = !1, this.readAloudEnabled = !1, this.assistantAvatarEnabled = !1, this.arcgisCancel = p(), this.arcgisError = p(), this.arcgisFeedback = p(), this.arcgisInterrupt = p(), this.arcgisInterruptCancel = p(), this.arcgisInterruptSubmit = p(), this.arcgisPromptSelect = p(), this.arcgisReady = p(), this.arcgisSubmit = p(), this.arcgisSlottableRequest = p({ bubbles: !1, composed: !1 }), this.arcgisResponse = p();
227
229
  }
228
230
  static {
229
- this.properties = { _orchestratorController: 16, _interrupt: 16, _interruptDetails: 16, _error: 16, _inputValue: 16, _isAnswering: 16, _canceling: 16, _user: 16, awaitingResponse: 32, awaitingResponseStep: 32, interrupt: 32, messages: 0, orchestrator: 32, entryMessage: 1, heading: 1, description: 1, referenceElement: 1, suggestedPrompts: 0, feedbackEnabled: 5, keepSuggestedPrompts: 5, logEnabled: 5, copyEnabled: 5, voiceInputEnabled: 5, readAloudEnabled: 5, assistantAvatarEnabled: 5 };
231
+ this.properties = { _orchestratorController: 16, _interrupt: 16, _interruptDetails: 16, _error: 16, _inputValue: 16, _isAnswering: 16, _signedInUserId: 16, _canceling: 16, _isSignedIn: 16, _user: 16, awaitingResponse: 32, awaitingResponseStep: 32, interrupt: 32, messages: 0, orchestrator: 32, entryMessage: 1, heading: 1, description: 1, referenceElement: 1, suggestedPrompts: 0, feedbackEnabled: 5, keepSuggestedPrompts: 5, logEnabled: 5, copyEnabled: 5, voiceInputEnabled: 5, readAloudEnabled: 5, assistantAvatarEnabled: 5 };
230
232
  }
231
233
  static {
232
- this.styles = z;
234
+ this.styles = q;
233
235
  }
234
236
  #t;
235
237
  #n;
@@ -242,14 +244,14 @@ class Y extends R {
242
244
  #l;
243
245
  #c;
244
246
  #h;
245
- #p;
246
247
  #g;
248
+ #p;
247
249
  async #d() {
248
250
  try {
249
251
  const t = V(this.el, this.referenceElement);
250
252
  await t?.componentOnReady();
251
253
  const e = [...this.#o.values()];
252
- return e.length ? (this._orchestratorController = new d({
254
+ return e.length ? (this._orchestratorController?.destroy(), this._orchestratorController = new d({
253
255
  agents: e,
254
256
  portal: this.#i,
255
257
  view: t?.view
@@ -258,6 +260,9 @@ class Y extends R {
258
260
  return this._error = t?.message ?? "Error initializing orchestrator.", O(this)(t), !1;
259
261
  }
260
262
  }
263
+ get _isSignedIn() {
264
+ return !!this.#i?.user || !!this._signedInUserId;
265
+ }
261
266
  get _user() {
262
267
  return this.#i?.user?.fullName || this.#i?.user?.username;
263
268
  }
@@ -315,14 +320,14 @@ class Y extends R {
315
320
  case "block-data": {
316
321
  if (s?.role !== "assistant" || s?.id !== n)
317
322
  break;
318
- const a = [...s.blocks ?? []], o = a[a.length - 1], { blockType: h, data: p } = r;
323
+ const a = [...s.blocks ?? []], o = a[a.length - 1], { blockType: h, data: g } = r;
319
324
  if (o?.type !== h || !o.isPending)
320
325
  break;
321
326
  if (h === "text") {
322
- const f = typeof o.data?.content == "string" ? o.data.content : "", u = typeof p?.content == "string" ? p.content : "";
327
+ const f = typeof o.data?.content == "string" ? o.data.content : "", u = typeof g?.content == "string" ? g.content : "";
323
328
  a[a.length - 1] = { ...o, data: { ...o.data, content: f + u } };
324
329
  } else
325
- a[a.length - 1] = { ...o, data: { ...o.data, ...p ?? {} } };
330
+ a[a.length - 1] = { ...o, data: { ...o.data, ...g ?? {} } };
326
331
  this.messages.splice(-1, 1, { ...s, blocks: a });
327
332
  break;
328
333
  }
@@ -382,8 +387,8 @@ class Y extends R {
382
387
  }
383
388
  loaded() {
384
389
  this.manager.onLifecycle(() => {
385
- this.#t.value?.addEventListener("arcgisPromptSelect", this.#p), this.#t.value?.addEventListener("arcgisSubmit", this.#l), this.#t.value?.addEventListener("arcgisCancel", this.#c), this.#t.value?.addEventListener("arcgisFeedback", this.#h);
386
- const t = x(() => !!this._interrupt && !!this.#s.value, () => {
390
+ this.#t.value?.addEventListener("arcgisPromptSelect", this.#g), this.#t.value?.addEventListener("arcgisSubmit", this.#l), this.#t.value?.addEventListener("arcgisCancel", this.#c), this.#t.value?.addEventListener("arcgisFeedback", this.#h);
391
+ const t = L(() => !!this._interrupt && !!this.#s.value, () => {
387
392
  const i = this.#s.value;
388
393
  i.removeEventListener("arcgisSubmit", this.#a), i.removeEventListener("arcgisCancel", this.#r), i.addEventListener("arcgisSubmit", this.#a, { once: !0 }), i.addEventListener("arcgisCancel", this.#r, { once: !0 });
389
394
  }), e = this.messages.on("after-add", (i) => {
@@ -395,36 +400,37 @@ class Y extends R {
395
400
  i ? this.arcgisReady.emit() : this._error && this.arcgisError.emit(new Error(this._error));
396
401
  });
397
402
  }), () => {
398
- t.remove(), e.remove(), this.#t.value?.removeEventListener("arcgisPromptSelect", this.#p), this.#s.value?.removeEventListener("arcgisSubmit", this.#a), this.#s.value?.removeEventListener("arcgisCancel", this.#r), this.#t.value?.removeEventListener("arcgisSubmit", this.#l), this.#t.value?.removeEventListener("arcgisCancel", this.#c), this.#t.value?.removeEventListener("arcgisFeedback", this.#h), this._orchestratorController?.destroy(), this._orchestratorController = null;
403
+ t.remove(), e.remove(), this.#t.value?.removeEventListener("arcgisPromptSelect", this.#g), this.#s.value?.removeEventListener("arcgisSubmit", this.#a), this.#s.value?.removeEventListener("arcgisCancel", this.#r), this.#t.value?.removeEventListener("arcgisSubmit", this.#l), this.#t.value?.removeEventListener("arcgisCancel", this.#c), this.#t.value?.removeEventListener("arcgisFeedback", this.#h), this._orchestratorController?.destroy(), this._orchestratorController = null;
399
404
  };
400
405
  });
401
406
  }
402
407
  _reset() {
403
- this._orchestratorController?.cancel(), this.#e?.abort(), this._interrupt = null, this.messages.removeAll(), this._error = null, this._inputValue = "";
408
+ this._orchestratorController?.cancel(), this.#e?.abort(), this._interrupt = null, this.messages.removeAll(), this._error = null, this._inputValue = "", this._signedInUserId = void 0;
404
409
  }
405
410
  _renderEntryMessage() {
406
- return !this._user ? this._renderSignInNotice() : this._error ? this._renderErrorNotice() : this.entryMessage ? this.messages.length > 0 ? null : l`<calcite-notice open kind=brand closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>` : l`<slot name=entry-message></slot>`;
411
+ return this._isSignedIn ? this._error ? this._renderErrorNotice() : this.entryMessage ? this.messages.length > 0 ? null : l`<calcite-notice open kind=brand closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>` : l`<slot name=entry-message></slot>` : this._renderSignInNotice();
407
412
  }
408
413
  _renderSignInNotice() {
409
414
  const t = this.#i;
410
415
  return l`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message>You need to sign in to use the assistant chat.</div>${t ? l`<calcite-link slot=link @click=${async () => {
411
416
  try {
412
- await T.getCredential(t.url), this._error = null, await this.#d(), this.arcgisReady.emit();
417
+ const e = await N.getCredential(`${t.url}/sharing`);
418
+ this._signedInUserId = e.userId, this._error = null, this.requestUpdate(), await this.#d() ? this.arcgisReady.emit() : this._error && this.arcgisError.emit(new Error(this._error));
413
419
  } catch (e) {
414
- console.error("Error signing in:", e);
420
+ this._error = e?.message ?? "Error signing in.", this.arcgisError.emit(new Error(this._error)), M.log("error", this, "Error signing in:", { detail: { error: e } });
415
421
  }
416
422
  }} target=_blank title="Sign in to ArcGIS Online">Sign in</calcite-link>` : l`<div slot=link>No portal information available</div>`}</calcite-notice>`;
417
423
  }
418
424
  _renderErrorNotice() {
419
- return this._error ? l`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error === G ? l`<div slot=message>${U}</div><calcite-link slot=link .href=${W} target=_blank title="Learn about web map embeddings">Read more</calcite-link>` : l`<div slot=message>${this._error}</div>`}</calcite-notice>` : null;
425
+ return this._error ? l`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error === G ? l`<div slot=message>${W}</div><calcite-link slot=link .href=${Y} target=_blank title="Learn about web map embeddings">Read more</calcite-link>` : l`<div slot=message>${this._error}</div>`}</calcite-notice>` : null;
420
426
  }
421
427
  render() {
422
- return l`<calcite-panel .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} ${v(this.#t)}><slot name=header-actions-start slot=header-actions-start></slot><slot name=header-actions-end slot=header-actions-end></slot><div class="content-container"><arcgis-assistant-chat .loading=${this.awaitingResponse} .messages=${this.messages} .interrupt=${this._interrupt}><slot name=message-starter slot=message-starter></slot><slot name=messages slot=messages>${this.messages.map((t) => t.role === "assistant" ? l`<arcgis-assistant-message .message=${t} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#g} .assistantAvatarEnabled=${this.assistantAvatarEnabled}>${t.blocks?.map((e, i) => l`<slot name=${w(t.id, i) ?? k} slot=${w(t.id, i) ?? k}><arcgis-assistant-message-block .block=${e}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>` : l`<arcgis-assistant-user-message .message=${t} .user=${this._user}></arcgis-assistant-user-message>`)}</slot>${this._interrupt ? l`<div slot=message-loading><div class="interrupt-waiting-message">waiting for user input...</div> // TODO: use t9n strings</div>` : l`<slot name=message-loading slot=message-loading><arcgis-assistant-message-loading .loading=${this.awaitingResponse} .loadingMessage=${this.awaitingResponseStep} .assistantAvatarEnabled=${this.assistantAvatarEnabled} .interrupts=${this._interruptDetails}></arcgis-assistant-message-loading></slot>`}</arcgis-assistant-chat></div>${this._interrupt ? l`<arcgis-assistant-interrupt slot=content-bottom .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${v(this.#s)}></arcgis-assistant-interrupt>` : this.suggestedPrompts?.length ? l`<div class="suggested-prompts-container" slot=content-bottom><arcgis-assistant-suggested-prompts class="suggested-prompts" .prompts=${this.suggestedPrompts}></arcgis-assistant-suggested-prompts></div>` : null}<div class="footer-container" slot=footer>${this._renderEntryMessage()}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse || this._isAnswering} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} .disabled=${this._canceling || !this._user || !!this._interrupt} ${v(this.#n)}><slot name=entry-actions-start slot=entry-actions-start></slot><slot name=entry-actions-end slot=entry-actions-end><calcite-button .iconStart=${this.awaitingResponse || this._isAnswering ? "circle-stop" : "send"} @click=${() => {
428
+ return l`<calcite-panel .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} ${v(this.#t)}><slot name=header-actions-start slot=header-actions-start></slot><slot name=header-actions-end slot=header-actions-end></slot><div class="content-container"><arcgis-assistant-chat .loading=${this.awaitingResponse} .messages=${this.messages} .interrupt=${this._interrupt}><slot name=message-starter slot=message-starter></slot><slot name=messages slot=messages>${this.messages.map((t) => t.role === "assistant" ? l`<arcgis-assistant-message .message=${t} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#p} .assistantAvatarEnabled=${this.assistantAvatarEnabled}>${t.blocks?.map((e, i) => l`<slot name=${w(t.id, i) ?? k} slot=${w(t.id, i) ?? k}><arcgis-assistant-message-block .block=${e}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>` : l`<arcgis-assistant-user-message .message=${t} .user=${this._user}></arcgis-assistant-user-message>`)}</slot>${this._interrupt ? l`<div slot=message-loading><div class="interrupt-waiting-message">waiting for user input...</div></div>` : l`<slot name=message-loading slot=message-loading><arcgis-assistant-message-loading .loading=${this.awaitingResponse} .loadingMessage=${this.awaitingResponseStep} .assistantAvatarEnabled=${this.assistantAvatarEnabled} .interrupts=${this._interruptDetails}></arcgis-assistant-message-loading></slot>`}</arcgis-assistant-chat></div>${this._interrupt ? l`<slot name=interrupt><arcgis-assistant-interrupt slot=content-bottom .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${v(this.#s)}></arcgis-assistant-interrupt></slot>` : this.suggestedPrompts?.length ? l`<div class="suggested-prompts-container" slot=content-bottom><arcgis-assistant-suggested-prompts class="suggested-prompts" .prompts=${this.suggestedPrompts}></arcgis-assistant-suggested-prompts></div>` : null}<div class="footer-container" slot=footer>${this._renderEntryMessage()}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse || this._isAnswering} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} .disabled=${this._canceling || !this._isSignedIn || !!this._interrupt} ${v(this.#n)}><slot name=entry-actions-start slot=entry-actions-start></slot><slot name=entry-actions-end slot=entry-actions-end><calcite-button .iconStart=${this.awaitingResponse || this._isAnswering ? "circle-stop" : "send"} @click=${() => {
423
429
  this.#n.value?.submitMessage();
424
430
  }} round>${this.awaitingResponse || this._isAnswering ? this._messages.stopButtonLabel : this._messages.askButtonLabel}</calcite-button></slot></arcgis-assistant-chat-entry></slot><slot name=footer-content></slot></div></calcite-panel>`;
425
431
  }
426
432
  }
427
- $("arcgis-assistant", Y);
433
+ $("arcgis-assistant", J);
428
434
  export {
429
- Y as ArcgisAssistant
435
+ J as ArcgisAssistant
430
436
  };
@@ -5,6 +5,7 @@ import "@langchain/langgraph/web";
5
5
  import "../../chunks/adapter.js";
6
6
  import "@arcgis/core/identity/IdentityManager.js";
7
7
  import "@arcgis/core/portal/Portal.js";
8
+ import "@arcgis/toolkit/string";
8
9
  import "../../chunks/generateLayerDescriptions.js";
9
10
  import "@langchain/core/messages";
10
11
  import "@langchain/core/callbacks/dispatch/web";
@@ -19,7 +20,7 @@ import "zod";
19
20
  import { D as r } from "../../chunks/dataExplorationGraph.js";
20
21
  import "@arcgis/core/views/LinkChartView.js";
21
22
  import "@arcgis/core/rest/knowledgeGraphService.js";
22
- import { r as a, a as o } from "../../chunks/utils2.js";
23
+ import { r as o, a } from "../../chunks/utils2.js";
23
24
  class s extends i {
24
25
  constructor() {
25
26
  super(...arguments), this.agent = r;
@@ -34,7 +35,7 @@ class s extends i {
34
35
  return { mapView: this.#t };
35
36
  }
36
37
  load() {
37
- this.#t = a(this, "arcgis-assistant-data-exploration-agent"), o(this);
38
+ this.#t = o(this, "arcgis-assistant-data-exploration-agent"), a(this);
38
39
  }
39
40
  }
40
41
  t("arcgis-assistant-data-exploration-agent", s);
@@ -5,6 +5,7 @@ import "@langchain/langgraph/web";
5
5
  import "../../chunks/adapter.js";
6
6
  import "@arcgis/core/identity/IdentityManager.js";
7
7
  import "@arcgis/core/portal/Portal.js";
8
+ import "@arcgis/toolkit/string";
8
9
  import "../../chunks/generateLayerDescriptions.js";
9
10
  import "@langchain/core/messages";
10
11
  import "@langchain/core/callbacks/dispatch/web";
@@ -5,6 +5,7 @@ import "@langchain/langgraph/web";
5
5
  import "../../chunks/adapter.js";
6
6
  import "@arcgis/core/identity/IdentityManager.js";
7
7
  import "@arcgis/core/portal/Portal.js";
8
+ import "@arcgis/toolkit/string";
8
9
  import "../../chunks/generateLayerDescriptions.js";
9
10
  import "@langchain/core/messages";
10
11
  import "@langchain/core/callbacks/dispatch/web";
@@ -22,7 +23,7 @@ import "@arcgis/core/smartMapping/statistics/uniqueValues.js";
22
23
  import { A as o } from "../../chunks/arcgisKnowledgeGraph.js";
23
24
  import { b as s, a as n } from "../../chunks/utils2.js";
24
25
  import { fetchKnowledgeGraph as a } from "@arcgis/core/rest/knowledgeGraphService.js";
25
- class c extends i {
26
+ class p extends i {
26
27
  constructor() {
27
28
  super(...arguments), this.agent = o;
28
29
  }
@@ -63,7 +64,7 @@ class c extends i {
63
64
  this.#e = s(this) ?? void 0, n(this);
64
65
  }
65
66
  }
66
- r("arcgis-assistant-knowledge-agent", c);
67
+ r("arcgis-assistant-knowledge-agent", p);
67
68
  export {
68
- c as ArcgisAssistantKnowledgeAgent
69
+ p as ArcgisAssistantKnowledgeAgent
69
70
  };
@@ -5,6 +5,7 @@ import "@langchain/langgraph/web";
5
5
  import "../../chunks/adapter.js";
6
6
  import "@arcgis/core/identity/IdentityManager.js";
7
7
  import "@arcgis/core/portal/Portal.js";
8
+ import "@arcgis/toolkit/string";
8
9
  import "../../chunks/generateLayerDescriptions.js";
9
10
  import "@langchain/core/messages";
10
11
  import "@langchain/core/callbacks/dispatch/web";
@@ -6,6 +6,7 @@ import "@langchain/langgraph/web";
6
6
  import "../../chunks/adapter.js";
7
7
  import "@arcgis/core/identity/IdentityManager.js";
8
8
  import "@arcgis/core/portal/Portal.js";
9
+ import "@arcgis/toolkit/string";
9
10
  import "../../chunks/generateLayerDescriptions.js";
10
11
  import "@langchain/core/messages";
11
12
  import "@langchain/core/callbacks/dispatch/web";