@arcgis/ai-components 5.1.0-next.81 → 5.1.0-next.83

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 (31) hide show
  1. package/dist/cdn/{GSEGZJ2U.js → 3IWT4SEI.js} +1 -1
  2. package/dist/cdn/{IYLX4KLL.js → 4MLHX7X5.js} +1 -1
  3. package/dist/cdn/{NZTAURVH.js → 4QKZJOZQ.js} +1 -1
  4. package/dist/cdn/{7D3KRFRW.js → 5EBQQWWP.js} +1 -1
  5. package/dist/cdn/{YOLORAVJ.js → 5X7SWXRN.js} +1 -1
  6. package/dist/cdn/{CR5GDB2W.js → 6LFDWHQ4.js} +1 -1
  7. package/dist/cdn/{OHB3YTG3.js → 7FHVX2LD.js} +1 -1
  8. package/dist/cdn/{QEBCABHW.js → AAOF7JQT.js} +1 -1
  9. package/dist/cdn/{ACMQ664C.js → FFQBDX6W.js} +1 -1
  10. package/dist/cdn/{6A5IHRUY.js → FMWLET2P.js} +1 -1
  11. package/dist/cdn/{X3SVW3JR.js → FZWNOKWO.js} +1 -1
  12. package/dist/cdn/{DLK4CKE7.js → GLO6QOGW.js} +1 -1
  13. package/dist/cdn/{XJWSEQSD.js → KJFC3ZEP.js} +1 -1
  14. package/dist/cdn/{L5PC6LYN.js → MDPF56RC.js} +1 -1
  15. package/dist/cdn/{NRZLZXVM.js → NY6TBJUU.js} +1 -1
  16. package/dist/cdn/{AZPRVQJ2.js → OFWYCHDQ.js} +1 -1
  17. package/dist/cdn/{DIC46EXQ.js → QTH2DYCO.js} +1 -1
  18. package/dist/cdn/{FTOVBHTS.js → QUVGX4PA.js} +1 -1
  19. package/dist/cdn/{JQMZAGMT.js → SNXQTZ5B.js} +1 -1
  20. package/dist/cdn/{GQXFIVIF.js → UWXD5PFQ.js} +1 -1
  21. package/dist/cdn/{BLMTWLPY.js → VSZNNBU6.js} +1 -1
  22. package/dist/cdn/{2LINEOKU.js → XMI2K6YV.js} +1 -1
  23. package/dist/cdn/{T4WSSOQP.js → XUCS7JNA.js} +1 -1
  24. package/dist/cdn/index.js +1 -1
  25. package/dist/components/arcgis-assistant/customElement.js +29 -29
  26. package/dist/components/arcgis-assistant-message-content/customElement.js +5 -5
  27. package/dist/docs/api.json +1 -1
  28. package/dist/docs/docs.json +1 -1
  29. package/dist/docs/web-types.json +1 -1
  30. package/package.json +8 -8
  31. /package/dist/cdn/{ZR7D7RIM.js → AKEZZ3RP.js} +0 -0
@@ -2,10 +2,10 @@
2
2
  import { c as _ } from "../../chunks/runtime.js";
3
3
  import { css as w, html as n } from "lit";
4
4
  import E from "@arcgis/core/core/Collection.js";
5
- import { whenOnce as C, watch as $, when as k } from "@arcgis/core/core/reactiveUtils.js";
5
+ import { whenOnce as k, watch as C, when as $ } from "@arcgis/core/core/reactiveUtils.js";
6
6
  import S from "@arcgis/core/portal/Portal.js";
7
7
  import { LitElement as I, createEvent as l } from "@arcgis/lumina";
8
- import { createRef as b, ref as f } from "lit/directives/ref.js";
8
+ import { createRef as f, ref as b } from "lit/directives/ref.js";
9
9
  import { Orchestrator as L } from "@arcgis/ai-orchestrator";
10
10
  import P from "@arcgis/core/core/Accessor.js";
11
11
  import { property as u, subclass as R } from "@arcgis/core/core/accessorSupport/decorators.js";
@@ -13,14 +13,14 @@ import { u as x } from "../../chunks/useT9n.js";
13
13
  import { rethrowError as M } from "@arcgis/toolkit/log";
14
14
  import { g as O } from "../../chunks/utils2.js";
15
15
  const A = w`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%)}.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%}.suggested-prompts{display:block;padding:var(--calcite-spacing-md);max-width:100%;box-sizing:border-box}`;
16
- var z = Object.defineProperty, V = Object.getOwnPropertyDescriptor, h = (g, e, t, i) => {
17
- for (var s = i > 1 ? void 0 : i ? V(e, t) : e, r = g.length - 1, a; r >= 0; r--)
18
- (a = g[r]) && (s = (i ? a(e, t, s) : a(s)) || s);
16
+ var z = Object.defineProperty, V = Object.getOwnPropertyDescriptor, h = (p, e, t, i) => {
17
+ for (var s = i > 1 ? void 0 : i ? V(e, t) : e, r = p.length - 1, a; r >= 0; r--)
18
+ (a = p[r]) && (s = (i ? a(e, t, s) : a(s)) || s);
19
19
  return i && s && z(e, t, s), s;
20
20
  };
21
21
  let o = class extends P {
22
- constructor(g) {
23
- super(g), this.view = null, this.loading = !1, this.processing = !1, this.processingStep = "";
22
+ constructor(p) {
23
+ super(p), this.view = null, this.loading = !1, this.processing = !1, this.processingStep = "";
24
24
  }
25
25
  async load() {
26
26
  this._set("loading", !0);
@@ -34,14 +34,14 @@ let o = class extends P {
34
34
  this.orchestrator?.dispose(), super.destroy();
35
35
  }
36
36
  async _initialize() {
37
- this.removeHandles(), await Promise.all([this.portal.load(), this.view?.when()]), this.view && await C(() => !this.view.updating), this._set(
37
+ this.removeHandles(), await Promise.all([this.portal.load(), this.view?.when()]), this.view && await k(() => !this.view.updating), this._set(
38
38
  "orchestrator",
39
39
  await L.init({
40
40
  agents: [...this.agents],
41
41
  view: this.view ?? void 0
42
42
  })
43
43
  ), this.addHandles([
44
- $(
44
+ C(
45
45
  () => [this.view, this.agents],
46
46
  () => {
47
47
  this._initialize();
@@ -52,14 +52,14 @@ let o = class extends P {
52
52
  clearChatHistory() {
53
53
  this.orchestrator?.newConversation();
54
54
  }
55
- async *ask(g, e) {
55
+ async *ask(p, e) {
56
56
  if (!this.orchestrator)
57
57
  throw new Error("Orchestrator not initialized yet.");
58
58
  this._set("processing", !0), this._set("processingStep", "");
59
59
  const t = [];
60
60
  let i;
61
61
  try {
62
- const s = this.orchestrator.ask(g);
62
+ const s = this.orchestrator.ask(p);
63
63
  for await (const r of s) {
64
64
  const a = r.runId;
65
65
  if (e?.aborted) {
@@ -72,8 +72,8 @@ let o = class extends P {
72
72
  break;
73
73
  }
74
74
  case "completed": {
75
- const c = r.result, p = !!c.content.length, m = !!i?.length;
76
- if (!p && !m) {
75
+ const c = r.result, g = !!c.content.length, m = !!i?.length;
76
+ if (!g && !m) {
77
77
  yield { type: "completed", error: "Could not process the request.", log: t, runId: a };
78
78
  return;
79
79
  }
@@ -87,18 +87,18 @@ let o = class extends P {
87
87
  break;
88
88
  }
89
89
  case "interrupt": {
90
- const { kind: c, message: p, metadata: m } = r.interrupt, d = Array.isArray(m) ? m.filter((v) => typeof v == "string") : [], y = (() => {
90
+ const { kind: c, message: g, metadata: m } = r.interrupt, d = Array.isArray(m) ? m.filter((v) => typeof v == "string") : [], y = (() => {
91
91
  switch (c) {
92
92
  case "booleanChoice":
93
- return { type: "boolean-choice", message: p, options: d };
93
+ return { type: "boolean-choice", message: g, options: d };
94
94
  case "singleSelection":
95
- return { type: "single-select", message: p, options: d };
95
+ return { type: "single-select", message: g, options: d };
96
96
  case "multipleSelection":
97
- return { type: "multi-select", message: p, options: d };
97
+ return { type: "multi-select", message: g, options: d };
98
98
  case "textInput":
99
- return { type: "text-input", message: p };
99
+ return { type: "text-input", message: g };
100
100
  default:
101
- return { type: c, message: p, options: d };
101
+ return { type: c, message: g, options: d };
102
102
  }
103
103
  })();
104
104
  this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload: y, runId: a };
@@ -153,7 +153,7 @@ o = h([
153
153
  const j = "Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.", H = "Embeddings not found for this web map.", B = "https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings";
154
154
  class D extends I {
155
155
  constructor() {
156
- super(...arguments), this._messages = x({ blocking: !0 }), this.#e = b(), this.#n = b(), this.#t = b(), this.#s = null, this.#o = /* @__PURE__ */ new Map(), this.#r = S.getDefault(), this.#i = (e) => {
156
+ super(...arguments), this._messages = x({ blocking: !0 }), this.#e = f(), this.#n = f(), this.#t = f(), this.#s = null, this.#o = /* @__PURE__ */ new Map(), this.#r = S.getDefault(), this.#i = (e) => {
157
157
  e.stopPropagation(), this.cancelInterrupt();
158
158
  }, this.#a = (e) => {
159
159
  e.stopPropagation();
@@ -173,7 +173,7 @@ class D extends I {
173
173
  e.stopPropagation();
174
174
  const t = e.detail;
175
175
  this.arcgisFeedback.emit(t);
176
- }, this.#g = (e) => {
176
+ }, this.#p = (e) => {
177
177
  e.stopPropagation();
178
178
  const t = e.detail;
179
179
  this._inputValue = t.prompt, this.arcgisPromptSelect.emit(t);
@@ -196,8 +196,8 @@ class D extends I {
196
196
  #l;
197
197
  #c;
198
198
  #h;
199
- #g;
200
- async #p() {
199
+ #p;
200
+ async #g() {
201
201
  try {
202
202
  const e = O(this.el, this.referenceElement);
203
203
  await e?.componentOnReady();
@@ -279,17 +279,17 @@ class D extends I {
279
279
  }
280
280
  loaded() {
281
281
  this.manager.onLifecycle(() => {
282
- this.#e.value?.addEventListener("arcgisPromptSelect", this.#g), this.#e.value?.addEventListener("arcgisSubmit", this.#l), this.#e.value?.addEventListener("arcgisCancel", this.#c), this.#e.value?.addEventListener("arcgisFeedback", this.#h);
283
- const e = k(() => !!this._interrupt && !!this.#t.value, () => {
282
+ this.#e.value?.addEventListener("arcgisPromptSelect", this.#p), this.#e.value?.addEventListener("arcgisSubmit", this.#l), this.#e.value?.addEventListener("arcgisCancel", this.#c), this.#e.value?.addEventListener("arcgisFeedback", this.#h);
283
+ const e = $(() => !!this._interrupt && !!this.#t.value, () => {
284
284
  const t = this.#t.value;
285
285
  t.removeEventListener("arcgisSubmit", this.#a), t.removeEventListener("arcgisCancel", this.#i), t.addEventListener("arcgisSubmit", this.#a, { once: !0 }), t.addEventListener("arcgisCancel", this.#i, { once: !0 });
286
286
  });
287
287
  return queueMicrotask(() => {
288
- this.#p().then((t) => {
288
+ this.#g().then((t) => {
289
289
  t ? this.arcgisReady.emit() : this._error && this.arcgisError.emit(new Error(this._error));
290
290
  });
291
291
  }), () => {
292
- e.remove(), this.#e.value?.removeEventListener("arcgisPromptSelect", this.#g), this.#t.value?.removeEventListener("arcgisSubmit", this.#a), this.#t.value?.removeEventListener("arcgisCancel", this.#i), this.#e.value?.removeEventListener("arcgisSubmit", this.#l), this.#e.value?.removeEventListener("arcgisCancel", this.#c), this.#e.value?.removeEventListener("arcgisFeedback", this.#h), this._orchestratorController?.destroy(), this._orchestratorController = null;
292
+ e.remove(), this.#e.value?.removeEventListener("arcgisPromptSelect", this.#p), this.#t.value?.removeEventListener("arcgisSubmit", this.#a), this.#t.value?.removeEventListener("arcgisCancel", this.#i), this.#e.value?.removeEventListener("arcgisSubmit", this.#l), this.#e.value?.removeEventListener("arcgisCancel", this.#c), this.#e.value?.removeEventListener("arcgisFeedback", this.#h), this._orchestratorController?.destroy(), this._orchestratorController = null;
293
293
  };
294
294
  });
295
295
  }
@@ -297,7 +297,7 @@ class D extends I {
297
297
  this.#s?.abort(), this._interrupt = null, this.messages.removeAll(), this._error = null, this._inputValue = "";
298
298
  }
299
299
  _renderEntryMessage() {
300
- return this._interrupt ? n`<slot name=interrupt><arcgis-assistant-interrupt .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${f(this.#t)}></arcgis-assistant-interrupt></slot>` : this._error ? this._renderErrorNotice() : this.entryMessage ? this.messages.length > 0 ? null : n`<calcite-notice open kind=info closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>` : n`<slot name=entry-message></slot>`;
300
+ return this._interrupt ? n`<slot name=interrupt><arcgis-assistant-interrupt .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${b(this.#t)}></arcgis-assistant-interrupt></slot>` : this._error ? this._renderErrorNotice() : this.entryMessage ? this.messages.length > 0 ? null : n`<calcite-notice open kind=info closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>` : n`<slot name=entry-message></slot>`;
301
301
  }
302
302
  _renderErrorNotice() {
303
303
  return this._error ? n`<calcite-notice closable slot=entry-message open kind=danger icon width=full>${this._error === j ? n`<div slot=message>${H}</div><calcite-link slot=link .href=${B} target=_blank title="Learn about web map embeddings">Read more</calcite-link>` : n`<div slot=message>${this._error}</div>`}</calcite-notice>` : null;
@@ -306,7 +306,7 @@ class D extends I {
306
306
  return this.suggestedPrompts?.length ? n`<div class="suggested-prompts-container"><arcgis-assistant-suggested-prompts class="suggested-prompts" .prompts=${this.suggestedPrompts}></arcgis-assistant-suggested-prompts></div>` : null;
307
307
  }
308
308
  render() {
309
- return n`<calcite-panel .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} ${f(this.#e)}><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}><slot name=message-starter slot=message-starter></slot><slot name=messages slot=messages>${this.messages.map((e) => e.role === "assistant" ? n`<arcgis-assistant-message .message=${e} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled}></arcgis-assistant-message>` : n`<arcgis-assistant-user-message .message=${e} .user=${this._user}></arcgis-assistant-user-message>`)}</slot><slot name=message-loading slot=message-loading><arcgis-assistant-message-loading .loading=${this.awaitingResponse} .loadingMessage=${this.awaitingResponseStep}></arcgis-assistant-message-loading></slot></arcgis-assistant-chat></div>${this._renderSuggestedPrompts()}<div class="footer-container" slot=footer>${this._renderEntryMessage()}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse} .arcgisSubmit=${this.arcgisSubmit} .arcgisCancel=${this.arcgisCancel} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} ${f(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 ? "circle-stop" : "send"} @click=${() => {
309
+ return n`<calcite-panel .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} ${b(this.#e)}><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}><slot name=message-starter slot=message-starter></slot><slot name=messages slot=messages>${this.messages.map((e) => e.role === "assistant" ? n`<arcgis-assistant-message .message=${e} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled}></arcgis-assistant-message>` : n`<arcgis-assistant-user-message .message=${e} .user=${this._user}></arcgis-assistant-user-message>`)}</slot><slot name=message-loading slot=message-loading><arcgis-assistant-message-loading .loading=${this.awaitingResponse} .loadingMessage=${this.awaitingResponseStep}></arcgis-assistant-message-loading></slot></arcgis-assistant-chat></div>${this._renderSuggestedPrompts()}<div class="footer-container" slot=footer>${this._renderEntryMessage()}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} ${b(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 ? "circle-stop" : "send"} @click=${() => {
310
310
  this.#n.value?.submitMessage();
311
311
  }} round>${this.awaitingResponse ? this._messages.stopButtonLabel : this._messages.askButtonLabel}</calcite-button></slot></arcgis-assistant-chat-entry></slot><slot name=footer-content></slot></div></calcite-panel>`;
312
312
  }
@@ -1,11 +1,11 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
2
  import { c as o } from "../../chunks/runtime.js";
3
3
  import { css as r, html as t } from "lit";
4
- import { LitElement as c, createEvent as i, nothing as l } from "@arcgis/lumina";
4
+ import { LitElement as l, createEvent as c, nothing as i } from "@arcgis/lumina";
5
5
  const m = r`.content,.blocks{display:flex;flex-direction:column;gap:var(--calcite-spacing-sm)}.error-notice{padding:var(--calcite-spacing-sm)}`, n = "message";
6
- class g extends c {
6
+ class g extends l {
7
7
  constructor() {
8
- super(...arguments), this.arcgisSlottableRequest = i({ cancelable: !1 });
8
+ super(...arguments), this.arcgisSlottableRequest = c({ cancelable: !1 });
9
9
  }
10
10
  static {
11
11
  this.properties = { message: 0 };
@@ -40,14 +40,14 @@ class g extends c {
40
40
  }));
41
41
  }
42
42
  _renderBlock(e, s) {
43
- return t`<slot name=${this._getBlockSlotName(s) ?? l}><arcgis-assistant-message-block .block=${e}></arcgis-assistant-message-block></slot>`;
43
+ return t`<slot name=${this._getBlockSlotName(s) ?? i}><arcgis-assistant-message-block .block=${e}></arcgis-assistant-message-block></slot>`;
44
44
  }
45
45
  _renderBlocks() {
46
46
  const e = this.message?.blocks ?? [];
47
47
  return e.length ? t`<div class="blocks">${e.map((s, a) => this._renderBlock(s, a))}</div>` : null;
48
48
  }
49
49
  _renderDefaultContent() {
50
- return this.message?.error ? t`<calcite-notice class="error-notice" open icon kind=warning width=auto><div slot=message>${this.message.error}</div></calcite-notice>` : t`<arcgis-assistant-message-text .content=${this.message?.content}></arcgis-assistant-message-text>`;
50
+ return this.message?.error ? t`<calcite-notice class="error-notice" open icon kind=warning width=full><div slot=message>${this.message.error}</div></calcite-notice>` : t`<arcgis-assistant-message-text .content=${this.message?.content}></arcgis-assistant-message-text>`;
51
51
  }
52
52
  _renderContent() {
53
53
  return t`<div class="content"><slot name=${n}>${this._renderDefaultContent()}</slot>${this._renderBlocks()}</div>`;