@arcgis/coding-components 5.1.0-next.0 → 5.1.0-next.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/cdn/{UNTQC5M2.js → 44MLHT3A.js} +1 -1
  2. package/dist/cdn/{5JKSRJZY.js → 7YLRIYVH.js} +1 -1
  3. package/dist/cdn/{3B6KNFHK.js → BQLG62QR.js} +4 -4
  4. package/dist/cdn/{KKQIZTTK.js → F7IHWMK7.js} +1 -1
  5. package/dist/cdn/{NZY7KXAF.js → H75CMJQP.js} +1 -1
  6. package/dist/cdn/{Z56TGOZF.js → HVHTW7TF.js} +2 -2
  7. package/dist/cdn/JS62T4I5.js +4 -0
  8. package/dist/cdn/{N2FN7LBN.js → K7O73D3Q.js} +1 -1
  9. package/dist/cdn/{3YWUK77P.js → L2AQ5FXC.js} +1 -1
  10. package/dist/cdn/{DEWLD2VE.js → NXNOBP7G.js} +1 -1
  11. package/dist/cdn/{EPMYM35I.js → OPWQ5CNY.js} +1 -1
  12. package/dist/cdn/{3FSDLLYC.js → QWLPT7LO.js} +1 -1
  13. package/dist/cdn/{BYO7RLJT.js → T7GEIGWF.js} +1 -1
  14. package/dist/cdn/{QXQAIN3R.js → TDEKR2LM.js} +1 -1
  15. package/dist/cdn/TDYUEEOH.js +2 -0
  16. package/dist/cdn/WNUR7N3L.js +6 -0
  17. package/dist/cdn/XEUCI6KC.js +2 -0
  18. package/dist/cdn/{D2RP5367.js → ZGBZ6BXY.js} +1 -1
  19. package/dist/cdn/assets/code-editor/arcade.worker.js +8 -0
  20. package/dist/cdn/assets/code-editor/sql-expr.worker.js +2192 -2186
  21. package/dist/cdn/index.js +1 -1
  22. package/dist/chunks/arcade-defaults.js +84 -84
  23. package/dist/chunks/arcade-mode.js +2 -2
  24. package/dist/chunks/language-defaults-base.js +3 -2
  25. package/dist/components/arcgis-arcade-coding-assistant/customElement.js +101 -96
  26. package/dist/components/arcgis-arcade-editor/customElement.d.ts +5 -1
  27. package/dist/components/arcgis-arcade-editor/customElement.js +72 -59
  28. package/dist/components/arcgis-arcade-results/customElement.js +13 -13
  29. package/dist/docs/api.json +1 -1
  30. package/dist/docs/docs.json +1 -1
  31. package/dist/docs/vscode.html-custom-data.json +1 -1
  32. package/dist/docs/web-types.json +1 -1
  33. package/package.json +5 -5
  34. package/dist/cdn/6QWZ6LSH.js +0 -2
  35. package/dist/cdn/ASVCAO4G.js +0 -4
  36. package/dist/cdn/MY63AUW2.js +0 -2
  37. package/dist/cdn/RXNRHK3U.js +0 -6
@@ -1,6 +1,6 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
2
  import { c as Z } from "../../chunks/runtime.js";
3
- import { css as ee, html as l } from "lit";
3
+ import { css as ee, html as d } from "lit";
4
4
  import { nothing as V, safeClassMap as te, LitElement as ie } from "@arcgis/lumina";
5
5
  import { ref as oe, createRef as ae } from "lit/directives/ref.js";
6
6
  import se from "@arcgis/core/identity/IdentityManager.js";
@@ -18,7 +18,7 @@ import ue from "@arcgis/core/Graphic.js";
18
18
  import { log as x } from "@arcgis/toolkit/log";
19
19
  import { getDeclaredVoxelMembers as he, getDeclaredPixelMembers as me } from "@arcgis/core/applications/Components/arcadeEditorUtils.js";
20
20
  import { s as fe } from "../../chunks/fields.js";
21
- import { g as Y, h as be } from "../../chunks/language-defaults-base.js";
21
+ import { h as Y, j as be } from "../../chunks/language-defaults-base.js";
22
22
  import ge from "@arcgis/core/core/Accessor.js";
23
23
  import { property as f, subclass as ve } from "@arcgis/core/core/accessorSupport/decorators.js";
24
24
  const ye = ee`:host(:not([closed])){container-type:size;--calcite-block-border-color: var(--calcite-color-transparent);box-sizing:border-box;.submission-actions-wrapper{display:flex;flex-direction:column;width:100%;gap:.75rem}.submission-actions{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}@container (max-width: 380px){.hidden-below-380{display:none}}@container (min-width: 380px){.hidden-above-380{display:none}}.gaps{display:flex;gap:.25rem}.align-inline-end{margin-inline-start:auto}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.feedback-content{padding:var(--calcite-spacing-sm);display:flex;flex-direction:column;max-height:75cqb;overflow-y:auto;>*{margin-block-end:.5rem}>*:last-child,.terms-label{margin-block-end:0}calcite-text-area{--calcite-text-area-min-height: 4rem}calcite-notice{margin-block-start:0}}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: 100%;--calcite-sheet-min-height: auto}.feedback-footer{display:flex;justify-content:flex-end;gap:.5rem;width:100%}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent;margin-block:0}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}calcite-list-item calcite-button{margin-inline-end:.25rem}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;border-radius:var(--calcite-corner-radius-round);margin:.75rem;overflow:hidden;--calcite-color-border-input: transparent;position:sticky;box-shadow:var(--calcite-shadow-sm);flex:none;flex-direction:column}calcite-text-area{height:auto;overflow:hidden;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-flow{height:100%}calcite-popover calcite-list{--calcite-list-background-color: transparent;--calcite-input-border-color: transparent}calcite-popover calcite-list calcite-filter{--calcite-spacing-sm: 0}.contained-popover-or-tooltip{--calcite-popover-max-size-x: 100%;--calcite-tooltip-max-size-x: 100%}.info-heading{font-size:var(--calcite-font-size-0);color:var(--calcite-color-text-1);margin:0}.info-heading-row{display:flex;align-items:center;gap:var(--calcite-spacing-sm);flex-wrap:wrap}.unstyled-h3{margin:unset;font-size:var(--calcite-font-size-md)}.unstyled-shell{position:unset;inset:unset;display:unset;block-size:unset;inline-size:unset}.suggestion-button{font-weight:var(--calcite-font-weight-medium)}.suggestions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs);flex-wrap:wrap}.info-block{max-width:450px}#result-block{calcite-card-group{--calcite-card-group-gap: 1.25rem}calcite-card{--calcite-card-corner-radius: var(--calcite-corner-radius-round);--calcite-card-border-color: transparent;width:100%}.positioned-code-content{display:flex;flex-direction:row;gap:.5rem;padding:.5rem}calcite-card [slot=heading] calcite-chip{margin-block-start:.25rem}.code-response-wrapper{position:relative;background:var(--calcite-color-foreground-2);border-radius:var(--calcite-corner-radius-round);margin-top:-1.5rem}.prior-prompt{display:flex;flex-direction:row;padding:0;overflow-y:hidden;overflow-x:auto;margin:.25rem 0 .75rem;align-items:center;max-width:100%;span{overflow-x:auto;overflow-y:hidden}}.copy-feedback{display:none}.copy-prompt-button{align-self:flex-start;margin-inline-start:auto}.response-secondary-action-button[data-copied]+.copy-feedback,.copy-prompt-button[data-copied]+.copy-feedback{display:block;span{padding:.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-color-text--2);font-weight:var(--calcite-font-weight-medium)}}.copy-prompt-button[data-copied]~.copy-tooltip,.response-secondary-action-button[data-copied]~.copy-tooltip{display:none}code{white-space:pre;font-size:12px;margin:0;overflow-x:auto;font-family:Fira Mono,Consolas,Menlo,monospace;display:block;max-height:12rem;position:relative;padding:.5rem}.response-secondary-action-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}.collapsible-code{padding:.5rem}.collapsible-code summary{cursor:pointer;font-weight:500;color:var(--calcite-color-brand);outline:none;padding:.25rem 0}.collapsible-code[open] summary{color:var(--calcite-color-text-2)}.response-error-container{padding:.5rem;background:color-mix(in srgb,var(--calcite-color-status-warning) 10%,transparent);border-radius:var(--calcite-corner-radius-round);margin:1rem 0;font-size:var(--calcite-font-size--2);--calcite-input-message-icon-color: var(--calcite-color-status-warning)}.response-error-chip{--calcite-internal-chip-background-color: var(--calcite-color-status-warning);--calcite-chip-icon-color: var(--calcite-color-foreground-1);--calcite-chip-border-color: var(--calcite-color-transparent)}.feedback-actions{gap:unset}.contained{max-width:100%;max-height:100%;max-width:100cqi;max-height:75cqb;overflow-y:auto}.submission-notice{--calcite-notice-border-color: transparent;margin-block:0;width:100%;--calcite-font-size-relative-base: var(--calcite-font-size--2)}.border-block-end{border-block-end:1px solid var(--calcite-color-border-3)}.round-top{border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0}}:host([closed]){display:none}`;
@@ -27,10 +27,10 @@ class C extends Error {
27
27
  message: e,
28
28
  code: i,
29
29
  subCode: o,
30
- details: n,
31
- source: s
30
+ details: s,
31
+ source: n
32
32
  }) {
33
- super(e), this.name = "ArcadeAssistantError", this.code = i, this.subCode = o, this.details = n, this.source = s;
33
+ super(e), this.name = "ArcadeAssistantError", this.code = i, this.subCode = o, this.details = s, this.source = n;
34
34
  }
35
35
  }
36
36
  function U(t) {
@@ -47,18 +47,18 @@ function U(t) {
47
47
  }
48
48
  }
49
49
  async function we(t) {
50
- const { baseUrl: e, skillId: i, message: o, authToken: n, previousConversationId: s, context: r } = t, p = i ? `${e}/skills/${i}/chat` : `${e}/chat`, c = [], a = {
50
+ const { baseUrl: e, skillId: i, message: o, authToken: s, previousConversationId: n, context: r } = t, p = i ? `${e}/skills/${i}/chat` : `${e}/chat`, c = [], a = {
51
51
  message: o,
52
52
  context: r
53
53
  };
54
- s && (a.conversation_id = s);
54
+ n && (a.conversation_id = n);
55
55
  let h;
56
56
  try {
57
57
  h = await _(p, {
58
58
  method: "post",
59
59
  headers: {
60
60
  "Content-Type": "application/json",
61
- token: n
61
+ token: s
62
62
  },
63
63
  body: JSON.stringify(a),
64
64
  responseType: "json"
@@ -67,10 +67,10 @@ async function we(t) {
67
67
  const g = b, $ = g.details?.rawResponse || g.message || String(b), k = U($);
68
68
  throw k ? new C(k) : b;
69
69
  }
70
- const d = h.data;
71
- c.push(d);
72
- const y = d.conversationId, q = d.inquiryId;
73
- let w = d.sequenceNumber;
70
+ const l = h.data;
71
+ c.push(l);
72
+ const y = l.conversationId, q = l.inquiryId;
73
+ let w = l.sequenceNumber;
74
74
  async function T() {
75
75
  let b = 0;
76
76
  const g = 100;
@@ -83,7 +83,7 @@ async function we(t) {
83
83
  method: "post",
84
84
  headers: {
85
85
  "Content-Type": "application/json",
86
- token: n
86
+ token: s
87
87
  },
88
88
  body: JSON.stringify($),
89
89
  responseType: "json"
@@ -138,10 +138,10 @@ function $e(t, e, i) {
138
138
  function xe(t) {
139
139
  return t.message.match(/Error in prompt shield/u) ? "I'm having trouble with this request. Try again by rephrasing the question." : t.code === "TIMEOUT" ? "Request timed out. Try again by re-asking the same question or rephrasing it." : t.message;
140
140
  }
141
- const ke = ({ notices: t }) => t.length ? l`<div class="border-block-end">${Q(t, (e) => e.id ?? e.title, (e) => l`<calcite-notice class="submission-notice" .icon=${e.icon} .kind=${e.kind} scale=s open .closable=${e.closable} @calciteNoticeClose=${() => e.onClose?.()}><div slot=title>${e.title}</div>${e.message && l`<div slot=message>${e.message}</div>` || ""}${e.actionLinkMessage && e.onAction && l`<calcite-link slot=link @click=${() => e.onAction?.()}>${e.actionLinkMessage}</calcite-link>` || ""}</calcite-notice>`)}</div>` : null, Se = (t) => {
142
- const e = t.value.length, i = 72, o = 180, n = t.offsetWidth, r = Math.max(1, Math.floor(n / 8)), p = Math.ceil(e / r), c = i + (p - 2) * 24;
141
+ const ke = ({ notices: t }) => t.length ? d`<div class="border-block-end">${Q(t, (e) => e.id ?? e.title, (e) => d`<calcite-notice class="submission-notice" .icon=${e.icon} .kind=${e.kind} scale=s open .closable=${e.closable} @calciteNoticeClose=${() => e.onClose?.()}><div slot=title>${e.title}</div>${e.message && d`<div slot=message>${e.message}</div>` || ""}${e.actionLinkMessage && e.onAction && d`<calcite-link slot=link @click=${() => e.onAction?.()}>${e.actionLinkMessage}</calcite-link>` || ""}</calcite-notice>`)}</div>` : null, Se = (t) => {
142
+ const e = t.value.length, i = 72, o = 180, s = t.offsetWidth, r = Math.max(1, Math.floor(s / 8)), p = Math.ceil(e / r), c = i + (p - 2) * 24;
143
143
  t.style.setProperty("--calcite-text-area-min-height", `${Math.min(c, o)}px`);
144
- }, Ce = ({ promptValidationMessage: t, errorMessage: e, contextTooBig: i, contextReducedNoticeDismissed: o, setContextReducedNoticeDismissed: n, setErrorMessage: s, messages: r }) => {
144
+ }, Ce = ({ promptValidationMessage: t, errorMessage: e, contextTooBig: i, contextReducedNoticeDismissed: o, setContextReducedNoticeDismissed: s, setErrorMessage: n, messages: r }) => {
145
145
  const p = [];
146
146
  if (t && p.push({
147
147
  id: "prompt-validation",
@@ -155,7 +155,7 @@ const ke = ({ notices: t }) => t.length ? l`<div class="border-block-end">${Q(t,
155
155
  icon: "exclamation-mark-triangle",
156
156
  title: e,
157
157
  closable: !0,
158
- onClose: () => s(void 0)
158
+ onClose: () => n(void 0)
159
159
  }), i && !o) {
160
160
  const c = r.contextreduced ?? "Context reduced", a = r.contextreducedmessage ?? "The editor profile is too large for the assistant. It has been reduced in the assistant in order to ensure a successful request.";
161
161
  p.push({
@@ -165,27 +165,27 @@ const ke = ({ notices: t }) => t.length ? l`<div class="border-block-end">${Q(t,
165
165
  title: c,
166
166
  message: a,
167
167
  closable: !0,
168
- onClose: () => n(!0)
168
+ onClose: () => s(!0)
169
169
  });
170
170
  }
171
171
  return p;
172
172
  };
173
173
  function Ae({ messages: t }) {
174
- return l`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${t.beta ?? "Beta"}>${t.beta ?? "Beta"}</calcite-chip>`;
174
+ return d`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${t.beta ?? "Beta"}>${t.beta ?? "Beta"}</calcite-chip>`;
175
175
  }
176
176
  function Te({ popoverContent: t, messages: e }) {
177
- return l`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer .label=${e.legaldisclaimer ?? "Legal disclaimer"} placement=bottom auto-close focus-trap-disabled><div class="contained">${t}</div></calcite-popover>`;
177
+ return d`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer .label=${e.legaldisclaimer ?? "Legal disclaimer"} placement=bottom auto-close focus-trap-disabled><div class="contained">${t}</div></calcite-popover>`;
178
178
  }
179
179
  function Ie({ errorMessage: t, slot: e }) {
180
- return l`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e ?? V}>${t}</calcite-input-message></div>`;
180
+ return d`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e ?? V}>${t}</calcite-input-message></div>`;
181
181
  }
182
- function Ee({ active: t, setActive: e, messages: i }) {
183
- return l`<calcite-alert slot=alerts .open=${t} placement=bottom kind=success icon=check-circle-f auto-close @calciteAlertClose=${() => e(!1)} .label=${i.expressionapplied ?? "Expression applied"}><div slot=message>${i.expressionapplied ?? "Expression applied to editor."}</div></calcite-alert>`;
182
+ function Re({ active: t, setActive: e, messages: i }) {
183
+ return d`<calcite-alert slot=alerts .open=${t} placement=bottom kind=success icon=check-circle-f auto-close @calciteAlertClose=${() => e(!1)} .label=${i.expressionapplied ?? "Expression applied"}><div slot=message>${i.expressionapplied ?? "Expression applied to editor."}</div></calcite-alert>`;
184
184
  }
185
- function Re({ context: t, messages: e }) {
186
- return t ? l`<div class="gaps">${t.profileId && l`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", t.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", t.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button scale=s></calcite-button>` || ""}</div>` : null;
185
+ function Ee({ context: t, messages: e }) {
186
+ return t ? d`<div class="gaps">${t.profileId && d`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", t.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", t.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button scale=s></calcite-button>` || ""}</div>` : null;
187
187
  }
188
- function Me({ isDisabled: t, isReadOnly: e, setQuestion: i, setIsViewingResult: o, textAreaRef: n, question: s, errorMessage: r, setErrorMessage: p, promptValidationMessage: c, setPromptValidationMessage: a, submitQuestion: h, messages: d, mode: y, assistantRef: q, context: w, contextReducedNoticeDismissed: T, setContextReducedNoticeDismissed: I }) {
188
+ function Me({ isDisabled: t, isReadOnly: e, setQuestion: i, setIsViewingResult: o, textAreaRef: s, question: n, errorMessage: r, setErrorMessage: p, promptValidationMessage: c, setPromptValidationMessage: a, submitQuestion: h, messages: l, mode: y, assistantRef: q, context: w, contextReducedNoticeDismissed: T, setContextReducedNoticeDismissed: I }) {
189
189
  const b = w?.contextTooLarge ?? !1, g = Ce({
190
190
  promptValidationMessage: c,
191
191
  errorMessage: r,
@@ -193,92 +193,92 @@ function Me({ isDisabled: t, isReadOnly: e, setQuestion: i, setIsViewingResult:
193
193
  contextReducedNoticeDismissed: T,
194
194
  setContextReducedNoticeDismissed: I,
195
195
  setErrorMessage: p,
196
- messages: d
196
+ messages: l
197
197
  });
198
- return l`<div class="text-area-wrapper">${ke({ notices: g })}<calcite-text-area scale=s resize=vertical .readOnly=${t || e} class=${te(g.length ? "submission-text-area" : "submission-text-area round-top")} .placeholder=${d.askaquestion ?? `Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${s} @calciteTextAreaInput=${($) => {
198
+ return d`<div class="text-area-wrapper">${ke({ notices: g })}<calcite-text-area scale=s resize=vertical .readOnly=${t || e} class=${te(g.length ? "submission-text-area" : "submission-text-area round-top")} .placeholder=${l.askaquestion ?? `Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${($) => {
199
199
  Se($.target), i($.target.value);
200
- }} ${oe(n)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${w && Re({ context: w, messages: d }) || ""}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${y !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid scale=s .disabled=${t} @click=${async () => {
200
+ }} ${oe(s)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${w && Ee({ context: w, messages: l }) || ""}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${y !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid scale=s .disabled=${t} @click=${async () => {
201
201
  o(!1), i("");
202
- }} .label=${d.startover ?? "Start Over"} class="hidden-above-380" id=small-start-over-button></calcite-button><calcite-tooltip reference-element=small-start-over-button placement=top-start class="hidden-above-380">${d.startover ?? "Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${y !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${t} @click=${async () => {
202
+ }} .label=${l.startover ?? "Start Over"} class="hidden-above-380" id=small-start-over-button></calcite-button><calcite-tooltip reference-element=small-start-over-button placement=top-start class="hidden-above-380">${l.startover ?? "Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${y !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${t} @click=${async () => {
203
203
  o(!1), i("");
204
- }} class="hidden-below-380" scale=s>${d.startover ?? "Start Over"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${t} .disabled=${t} @click=${async () => {
205
- if (p(""), !s) {
206
- a(d.enteraprompt ?? "Please enter a prompt");
204
+ }} class="hidden-below-380" scale=s>${l.startover ?? "Start Over"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${t} .disabled=${t} @click=${async () => {
205
+ if (p(""), !n) {
206
+ a(l.enteraprompt ?? "Please enter a prompt");
207
207
  return;
208
208
  }
209
209
  a(void 0), await h();
210
- }} class="hidden-below-380">${y === "prompt" ? d.ask ?? "Generate" : d.refine ?? "Refine"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${t} .disabled=${t} @click=${async () => {
211
- if (p(""), !s) {
212
- a(d.enteraprompt ?? "Please enter a prompt");
210
+ }} class="hidden-below-380">${y === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${t} .disabled=${t} id=small-submit-button @click=${async () => {
211
+ if (p(""), !n) {
212
+ a(l.enteraprompt ?? "Please enter a prompt");
213
213
  return;
214
214
  }
215
215
  a(void 0), await h();
216
- }} class="hidden-above-380" .label=${y === "prompt" ? d.ask ?? "Generate" : d.refine ?? "Refine"}></calcite-button></div></div></div></calcite-text-area></div>`;
216
+ }} class="hidden-above-380" .label=${y === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}></calcite-button><calcite-tooltip reference-element=small-submit-button placement=top-start class="hidden-above-380">${y === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}</calcite-tooltip></div></div></div></calcite-text-area></div>`;
217
217
  }
218
218
  const Pe = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement", Ve = "https://www.esri.com/en-us/privacy/privacy-statements";
219
- function qe({ setOpen: t, messages: e, feedback: i, learnMoreUrl: o, setFeedback: n, onSubmit: s }) {
220
- return i.active ? l`<calcite-sheet class="feedback-sheet" .label=${e.feedback ?? "Feedback"} slot=sheets display-mode=float position=block-end .open=${i.active} @calciteSheetClose=${() => t(!1)}><calcite-panel .heading=${e.submitfeedback ?? "Submit feedback to Esri"} scale=s><div class="feedback-content"><calcite-text-area scale=s resize=vertical .value=${i.text} @calciteTextAreaInput=${(r) => n({ ...i, text: r.target.value })} .disabled=${i.submitting} .placeholder=${e.donotincludepersonalinfo ?? "Do not include personal or sensitive information"} rows=3></calcite-text-area><calcite-label layout=inline scale=s class="terms-label"><calcite-checkbox scale=l .checked=${i.termsAccepted} @calciteCheckboxChange=${(r) => {
221
- n({ ...i, termsAccepted: r.target.checked });
222
- }} .disabled=${i.submitting}></calcite-checkbox><span>${A((e.agreement ?? "I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}", `<calcite-link href=${Ve} target="_blank">${e.esriprivacystatement ?? "Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}", `<calcite-link href=${Pe} target="_blank">${e.supplement ?? "Supplement"}</calcite-link>`))}</span></calcite-label><calcite-notice scale=s open closable><span slot=message>${A((e.feedbackhelps ?? "Your feedback will be used to improve Esri products and services. {LearnMore} about how this data is used.").replace("{LearnMore}", `<calcite-link href=${o} target="_blank">${e.learnmore ?? "Learn more"}</calcite-link>`))}</span></calcite-notice></div><div slot=footer class="feedback-footer"><calcite-button kind=neutral appearance=outline @click=${() => t(!1)} .disabled=${i.submitting}>${e.cancel ?? "Cancel"}</calcite-button><calcite-button @click=${s} .disabled=${!i.termsAccepted || i.submitting} .loading=${i.submitting} data-testid=submit-feedback-button>${e.submit ?? "Submit"}</calcite-button></div></calcite-panel></calcite-sheet>` : null;
219
+ function qe({ setOpen: t, messages: e, feedback: i, learnMoreUrl: o, setFeedback: s, onSubmit: n }) {
220
+ return i.active ? d`<calcite-sheet class="feedback-sheet" .label=${e.feedback ?? "Feedback"} slot=sheets display-mode=float position=block-end .open=${i.active} @calciteSheetClose=${() => t(!1)}><calcite-panel .heading=${e.submitfeedback ?? "Submit feedback to Esri"} scale=s><div class="feedback-content"><calcite-text-area scale=s resize=vertical .value=${i.text} @calciteTextAreaInput=${(r) => s({ ...i, text: r.target.value })} .disabled=${i.submitting} .placeholder=${e.donotincludepersonalinfo ?? "Do not include personal or sensitive information"} rows=3></calcite-text-area><calcite-label layout=inline scale=s class="terms-label"><calcite-checkbox scale=l .checked=${i.termsAccepted} @calciteCheckboxChange=${(r) => {
221
+ s({ ...i, termsAccepted: r.target.checked });
222
+ }} .disabled=${i.submitting}></calcite-checkbox><span>${A((e.agreement ?? "I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}", `<calcite-link href=${Ve} target="_blank">${e.esriprivacystatement ?? "Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}", `<calcite-link href=${Pe} target="_blank">${e.supplement ?? "Supplement"}</calcite-link>`))}</span></calcite-label><calcite-notice scale=s open closable><span slot=message>${A((e.feedbackhelps ?? "Your feedback will be used to improve Esri products and services. {LearnMore} about how this data is used.").replace("{LearnMore}", `<calcite-link href=${o} target="_blank">${e.learnmore ?? "Learn more"}</calcite-link>`))}</span></calcite-notice></div><div slot=footer class="feedback-footer"><calcite-button kind=neutral appearance=outline @click=${() => t(!1)} .disabled=${i.submitting}>${e.cancel ?? "Cancel"}</calcite-button><calcite-button @click=${n} .disabled=${!i.termsAccepted || i.submitting} .loading=${i.submitting} data-testid=submit-feedback-button>${e.submit ?? "Submit"}</calcite-button></div></calcite-panel></calcite-sheet>` : null;
223
223
  }
224
224
  function O({ assistantsEnabled: t, messages: e, slot: i, helpTopicUrl: o }) {
225
- return l`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${i ?? V} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing ?? "Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new ?? "New"} kind=brand scale=s>${e.new ?? "New"}</calcite-chip></div>${t ? l`<p>${e.capabilities ?? "The assistant uses artificial intelligence to generate Arcade expressions."}</p><p>${e.keepinmind ?? "Keep in mind the following:"}<ul><li>${e.beconsise ?? "Be concise, but also clear in your request"}</li><li>${e.avoidambiguity ?? "Avoid ambiguity and vagueness"}</li><li>${e.moredetails ?? "you do not need to use exact field names in your instructions, but more detail is generally better"}</li></ul>${A((e.seedocumentation ?? "Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}", `<calcite-link href=${o} target="_blank">${e.documentation ?? "documentation"}</calcite-link>`))}</p>` : l`<p>${e.useofassistant ?? "The assistant uses artificial intelligence to generate Arcade expressions. To enable Arcade Assistant (beta), the following must be true:"}</p><ul><li>${e.enabledinorg ?? "AI assistants are enabled in the organization settings"}</li><li>${e.enabledbetaapps ?? "Beta apps and capabilities are not blocked"}</li><li>${e.enabledroleprivilege ?? "Your role privilege allows you to use AI assistants"}</li></ul>`}</calcite-block>`;
225
+ return d`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${i ?? V} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing ?? "Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new ?? "New"} kind=brand scale=s>${e.new ?? "New"}</calcite-chip></div>${t ? d`<p>${e.capabilities ?? "The assistant uses artificial intelligence to generate Arcade expressions."}</p><p>${e.keepinmind ?? "Keep in mind the following:"}<ul><li>${e.beconsise ?? "Be concise, but also clear in your request"}</li><li>${e.avoidambiguity ?? "Avoid ambiguity and vagueness"}</li><li>${e.moredetails ?? "you do not need to use exact field names in your instructions, but more detail is generally better"}</li></ul>${A((e.seedocumentation ?? "Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}", `<calcite-link href=${o} target="_blank">${e.documentation ?? "documentation"}</calcite-link>`))}</p>` : d`<p>${e.useofassistant ?? "The assistant uses artificial intelligence to generate Arcade expressions. To enable Arcade Assistant (beta), the following must be true:"}</p><ul><li>${e.enabledinorg ?? "AI assistants are enabled in the organization settings"}</li><li>${e.enabledbetaapps ?? "Beta apps and capabilities are not blocked"}</li><li>${e.enabledroleprivilege ?? "Your role privilege allows you to use AI assistants"}</li></ul>`}</calcite-block>`;
226
226
  }
227
227
  function Fe({ messages: t, onProceed: e, onExit: i, helpTopicUrl: o }) {
228
- return l`<calcite-dialog close-disabled placement=top .heading=${t.welcome ?? "Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${t.beforeyougetstarted ?? "Before you get started be aware:"}</h3><ul><li>${t.maybeincorrect ?? "AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${A((t.pleasereadhelp ?? "Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.").replace("{helpTopic}", `<calcite-link href=${o} target="_blank">${t.helptopic ?? "help topic"}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${t.proceed ?? "Proceed"}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${i} kind=neutral>${t.exit ?? "Exit"}</calcite-button></calcite-dialog>`;
228
+ return d`<calcite-dialog close-disabled placement=top .heading=${t.welcome ?? "Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${t.beforeyougetstarted ?? "Before you get started be aware:"}</h3><ul><li>${t.maybeincorrect ?? "AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${A((t.pleasereadhelp ?? "Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.").replace("{helpTopic}", `<calcite-link href=${o} target="_blank">${t.helptopic ?? "help topic"}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${t.proceed ?? "Proceed"}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${i} kind=neutral>${t.exit ?? "Exit"}</calcite-button></calcite-dialog>`;
229
229
  }
230
230
  function De({ messages: t, suggestions: e, onSuggestionClick: i }) {
231
- return l`<calcite-block .heading=${t.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map((o) => l`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${t.promptsuggestion} class="suggestion-button" @click=${() => i?.(o)}>${o}</calcite-button>`)}</div></calcite-block>`;
231
+ return d`<calcite-block .heading=${t.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map((o) => d`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${t.promptsuggestion} class="suggestion-button" @click=${() => i?.(o)}>${o}</calcite-button>`)}</div></calcite-block>`;
232
232
  }
233
233
  const z = 200;
234
- function L({ hidden: t = !1, expanded: e = !1, messages: i, cards: o, heading: n, collapsible: s = !1, showEffectsIcon: r = !1, onCopyCode: p, standalone: c }) {
235
- return l`<calcite-block .hidden=${t} id=result-block .heading=${n ?? i.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .collapsible=${s}>${r && l`<calcite-chip .label=${i.assistantresponses ?? "Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>` || ""}<calcite-card-group .label=${i.assistantresponses ?? "Assistant responses"}>${Q(o, (a) => a.conversationId, (a) => l`<calcite-card><div slot=heading><div class="prior-prompt"><span>${a.priorPrompt.length > z ? `${a.priorPrompt.slice(0, z)}...` : a.priorPrompt}</span><calcite-action icon=duplicate scale=s slot=actions-end class="copy-prompt-button" text .id=${`copy-prompt-${a.conversationId}-${c ? "standalone" : "list"}`} @click=${(h) => {
236
- const d = h.currentTarget;
234
+ function L({ hidden: t = !1, expanded: e = !1, messages: i, cards: o, heading: s, collapsible: n = !1, showEffectsIcon: r = !1, onCopyCode: p, standalone: c }) {
235
+ return d`<calcite-block .hidden=${t} id=result-block .heading=${s ?? i.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${r && d`<calcite-chip .label=${i.assistantresponses ?? "Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>` || ""}<calcite-card-group .label=${i.assistantresponses ?? "Assistant responses"}>${Q(o, (a) => a.conversationId, (a) => d`<calcite-card><div slot=heading><div class="prior-prompt"><span>${a.priorPrompt.length > z ? `${a.priorPrompt.slice(0, z)}...` : a.priorPrompt}</span><calcite-action icon=duplicate scale=s slot=actions-end class="copy-prompt-button" text .id=${`copy-prompt-${a.conversationId}-${c ? "standalone" : "list"}`} @click=${(h) => {
236
+ const l = h.currentTarget;
237
237
  navigator.clipboard.writeText(a.priorPrompt).then(() => {
238
- d.setAttribute("data-copied", "true"), setTimeout(() => d.removeAttribute("data-copied"), 1500);
238
+ l.setAttribute("data-copied", "true"), setTimeout(() => l.removeAttribute("data-copied"), 1500);
239
239
  });
240
- }}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${i.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${i.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${i.copyprompttoclipboard ?? "Copy prompt to clipboard"}</calcite-tooltip></div>${a.message && c && l`<div class="response-error-container">${Ie({ errorMessage: a.message })}</div>` || ""}</div><div><div class="code-response-wrapper"><div class="positioned-code-content"><calcite-chip-group .label=${i.responsecontext ?? "Response Context"} scale=s>${a.message && !c && l`<calcite-tooltip .referenceElement=${`response-chip-${a.conversationId}-error`} placement=top-start>${a.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${a.conversationId}-error`} .label=${i.error ?? "Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>` || ""}${Ne({ card: a, messages: i })}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><arcgis-code-viewer language=arcade round>${a.code}</arcgis-code-viewer></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button class="add-to-editor-button hidden-above-380" @click=${() => a.onAddToEditor("add")} scale=s icon-start=plus round .label=${i.addtoeditor ?? "Add to editor"} .id=${`add-to-editor-button-${a.conversationId}-${c ? "standalone" : "list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start>${i.addtoeditor ?? "Add to editor"}</calcite-tooltip><calcite-button class="add-to-editor-button hidden-below-380" @click=${() => a.onAddToEditor("add")} scale=s icon-start=plus round>${i.addtoeditor ?? "Add to editor"}</calcite-button><calcite-button round icon-start=file-code kind=neutral scale=s @click=${() => a.onAddToEditor("replace")} class="response-secondary-action-button" .id=${`replace-${a.conversationId}-${c ? "standalone" : "list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start><span>${i.replaceineditor ?? "Replace all code in editor"}</span></calcite-tooltip><calcite-button round icon-start=copy-to-clipboard kind=neutral scale=s @click=${(h) => {
241
- const d = h.currentTarget;
240
+ }}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${i.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${i.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${i.copyprompttoclipboard ?? "Copy prompt to clipboard"}</calcite-tooltip></div>${a.message && c && d`<div class="response-error-container">${Ie({ errorMessage: a.message })}</div>` || ""}</div><div><div class="code-response-wrapper"><div class="positioned-code-content"><calcite-chip-group .label=${i.responsecontext ?? "Response Context"} scale=s>${a.message && !c && d`<calcite-tooltip .referenceElement=${`response-chip-${a.conversationId}-error`} placement=top-start>${a.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${a.conversationId}-error`} .label=${i.error ?? "Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>` || ""}${Ne({ card: a, messages: i })}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><arcgis-code-viewer language=arcade round>${a.code}</arcgis-code-viewer></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button class="add-to-editor-button hidden-above-380" @click=${() => a.onAddToEditor("add")} scale=s icon-start=plus round .label=${i.addtoeditor ?? "Add to editor"} .id=${`add-to-editor-button-${a.conversationId}-${c ? "standalone" : "list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start>${i.addtoeditor ?? "Add to editor"}</calcite-tooltip><calcite-button class="add-to-editor-button hidden-below-380" @click=${() => a.onAddToEditor("add")} scale=s icon-start=plus round>${i.addtoeditor ?? "Add to editor"}</calcite-button><calcite-button round icon-start=file-code kind=neutral scale=s @click=${() => a.onAddToEditor("replace")} class="response-secondary-action-button" .id=${`replace-${a.conversationId}-${c ? "standalone" : "list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start><span>${i.replaceineditor ?? "Replace all code in editor"}</span></calcite-tooltip><calcite-button round icon-start=copy-to-clipboard kind=neutral scale=s @click=${(h) => {
241
+ const l = h.currentTarget;
242
242
  p(a.code).then(() => {
243
- d.setAttribute("data-copied", "true"), setTimeout(() => d.removeAttribute("data-copied"), 1500);
243
+ l.setAttribute("data-copied", "true"), setTimeout(() => l.removeAttribute("data-copied"), 1500);
244
244
  });
245
245
  }} class="response-secondary-action-button" .id=${`copy-response-${a.conversationId}-${c ? "standalone" : "list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${i.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${i.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-response-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${i.copytoclipboard ?? "Copy code to clipboard"}</calcite-tooltip></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${i.thumbsup ?? "Thumbs up"} scale=s icon=thumbs-up @click=${a.onThumbsUp} .id=${`thumbs-up-${a.conversationId}-${c ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start><span>${i.helpful ?? "Helpful"}</span></calcite-tooltip><calcite-action .text=${i.thumbsdown ?? "Thumbs down"} scale=s icon=thumbs-down @click=${a.onThumbsDown} .id=${`thumbs-down-${a.conversationId}-${c ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start><span>${i.unhelpful ?? "Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`;
246
246
  }
247
247
  const Ne = ({ card: t, messages: e }) => {
248
- const i = le(), o = `response-chip-profile-${t.conversationId}-${i}`, n = (e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", t.profileId);
249
- return l`<calcite-tooltip .referenceElement=${o} placement=top-start class="contained-popover-or-tooltip">${n}</calcite-tooltip><calcite-chip .label=${t.profileId} scale=s appearance=outline icon=map-information id=${o ?? V}>${t.profileId}</calcite-chip>`;
250
- }, B = (t) => t.type === "featureSet", E = (t) => {
248
+ const i = le(), o = `response-chip-profile-${t.conversationId}-${i}`, s = (e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", t.profileId);
249
+ return d`<calcite-tooltip .referenceElement=${o} placement=top-start class="contained-popover-or-tooltip">${s}</calcite-tooltip><calcite-chip .label=${t.profileId} scale=s appearance=outline icon=map-information id=${o ?? V}>${t.profileId}</calcite-chip>`;
250
+ }, j = (t) => t.type === "featureSet", R = (t) => {
251
251
  if (!be(t))
252
252
  return [];
253
253
  const e = [];
254
254
  return t.relationships?.forEach((i) => {
255
255
  e.push(i.toJSON());
256
256
  }), e;
257
- }, R = (t) => t.length > 0 ? { relationships: t } : {}, _e = (t) => fe(t).map((e) => ({
257
+ }, E = (t) => t.length > 0 ? { relationships: t } : {}, _e = (t) => fe(t).map((e) => ({
258
258
  alias: e.alias,
259
259
  name: e.name,
260
260
  type: e.type,
261
261
  ...e.domain ? { domain: e.domain } : {}
262
262
  })), M = (t) => t ? { fields: _e(t) } : { fields: [] };
263
- async function j(t) {
264
- const e = await t.loadSource(), i = Y(e) && e.isTable, o = E(e);
263
+ async function B(t) {
264
+ const e = await t.loadSource(), i = Y(e) && e.isTable, o = R(e);
265
265
  return {
266
266
  name: t.name,
267
267
  type: "featureSet",
268
268
  isTable: i,
269
269
  ...M(e?.fields),
270
- ...R(o)
270
+ ...E(o)
271
271
  };
272
272
  }
273
273
  async function K(t) {
274
274
  switch (t.type) {
275
275
  case "feature": {
276
- const e = await t.loadSource(), i = E(e);
276
+ const e = await t.loadSource(), i = R(e);
277
277
  return {
278
278
  name: t.name,
279
279
  type: t.type,
280
280
  ...M(e?.fields),
281
- ...R(i)
281
+ ...E(i)
282
282
  };
283
283
  }
284
284
  case "featureSet": {
@@ -288,16 +288,16 @@ async function K(t) {
288
288
  type: "featureSet",
289
289
  ...i ? { isTable: i } : {},
290
290
  ...M(e?.fields),
291
- ...R(E(e))
291
+ ...E(R(e))
292
292
  };
293
293
  }
294
294
  case "featureSetCollection": {
295
- const e = await t.loadSource(), i = e?.layers.filter(B) ?? [], o = e?.tables.filter(B) ?? [], n = await Promise.all(i.map(j)), s = await Promise.all(o.map(j));
295
+ const e = await t.loadSource(), i = e?.layers.filter(j) ?? [], o = e?.tables.filter(j) ?? [], s = await Promise.all(i.map(B)), n = await Promise.all(o.map(B));
296
296
  return {
297
297
  name: t.name,
298
298
  type: "featureSetCollection",
299
- layers: n,
300
- tables: s
299
+ layers: s,
300
+ tables: n
301
301
  };
302
302
  }
303
303
  case "dictionary": {
@@ -430,21 +430,21 @@ function Le(t) {
430
430
  variables: t.variables.map(i)
431
431
  };
432
432
  }
433
- function Be(t) {
434
- const e = t.variables, i = e.length, o = e.find((s) => s.name === "$feature") ?? e.find((s) => s.type === "feature") ?? e[0], n = o ? [o] : [];
433
+ function je(t) {
434
+ const e = t.variables, i = e.length, o = e.find((n) => n.name === "$feature") ?? e.find((n) => n.type === "feature") ?? e[0], s = o ? [o] : [];
435
435
  return {
436
- context: { variables: n },
437
- wasReduced: i !== n.length,
436
+ context: { variables: s },
437
+ wasReduced: i !== s.length,
438
438
  reducedToVariableName: o?.name
439
439
  };
440
440
  }
441
- function je(t) {
441
+ function Be(t) {
442
442
  return P(t) > Oe;
443
443
  }
444
444
  var He = Object.defineProperty, Ge = Object.getOwnPropertyDescriptor, m = (t, e, i, o) => {
445
- for (var n = o > 1 ? void 0 : o ? Ge(e, i) : e, s = t.length - 1, r; s >= 0; s--)
446
- (r = t[s]) && (n = (o ? r(e, i, n) : r(n)) || n);
447
- return o && n && He(e, i, n), n;
445
+ for (var s = o > 1 ? void 0 : o ? Ge(e, i) : e, n = t.length - 1, r; n >= 0; n--)
446
+ (r = t[n]) && (s = (o ? r(e, i, s) : r(s)) || s);
447
+ return o && s && He(e, i, s), s;
448
448
  };
449
449
  let u = class extends ge {
450
450
  constructor(t) {
@@ -518,9 +518,9 @@ class Ke extends ie {
518
518
  }
519
519
  const i = this.viewState.feedback.item.contextSnapshot, o = pe.applicationName;
520
520
  !o && !this.appVersion && x("warn", this, "esriConfig.applicationName is not set. Consider setting it to help identify the application version in feedback.");
521
- const { value: n, text: s, termsAccepted: r, item: { question: p, formattedScript: c, conversationId: a } } = this.viewState.feedback, h = {
522
- user_evaluation: n,
523
- your_comments: s || void 0,
521
+ const { value: s, text: n, termsAccepted: r, item: { question: p, formattedScript: c, conversationId: a } } = this.viewState.feedback, h = {
522
+ user_evaluation: s,
523
+ your_comments: n || void 0,
524
524
  question: p ?? "",
525
525
  /**
526
526
  * The answer may contain invalid or partial HTML, which causes the feature service's HTML sanitizer to strip or reject it.
@@ -539,8 +539,8 @@ class Ke extends ie {
539
539
  };
540
540
  try {
541
541
  await e.applyEdits({ addFeatures: [new ue({ attributes: h })] });
542
- } catch (d) {
543
- x("error", this, "Error submitting feedback.", { detail: { error: d } });
542
+ } catch (l) {
543
+ x("error", this, "Error submitting feedback.", { detail: { error: l } });
544
544
  }
545
545
  this.handleFeedbackSheetClose();
546
546
  }, this.handleClose = (e) => {
@@ -589,11 +589,16 @@ class Ke extends ie {
589
589
  };
590
590
  e().catch((i) => {
591
591
  x("error", this, "Error setting initial context.", { detail: { error: i } });
592
- }), this.manager.onLifecycle(() => ({ remove: N.onModelContextDidChange(async () => {
593
- e().catch((o) => {
594
- x("error", this, "Error setting context.", { detail: { error: o } });
592
+ }), this.manager.onLifecycle(() => {
593
+ const i = N.onModelContextDidChange(async () => {
594
+ e().catch((s) => {
595
+ x("error", this, "Error setting context.", { detail: { error: s } });
596
+ });
595
597
  });
596
- }).dispose }));
598
+ return { remove: () => {
599
+ i.dispose();
600
+ } };
601
+ });
597
602
  }
598
603
  disconnectedCallback() {
599
604
  super.disconnectedCallback(), J = this.viewState.history, W = this.viewState.splashActive, this.copySuccessTimer && (clearTimeout(this.copySuccessTimer), this.copySuccessTimer = void 0);
@@ -630,7 +635,7 @@ class Ke extends ie {
630
635
  return;
631
636
  const e = new de({ url: this.feedbackServiceUrl });
632
637
  await e.load();
633
- const i = Ye.filter((o) => !e.fields.some((n) => n.name === o));
638
+ const i = Ye.filter((o) => !e.fields.some((s) => s.name === o));
634
639
  if (i.length > 0) {
635
640
  x("error", this, `Missing the following fields in feedback service: ${i.join(", ")}. Feedback will not be logged.`);
636
641
  return;
@@ -645,9 +650,9 @@ class Ke extends ie {
645
650
  this.updateViewState({ isSubmitting: !0, errorMessage: void 0 });
646
651
  try {
647
652
  const e = await this.getToken(), i = this.getModel();
648
- if (!i)
653
+ if (!i || !this.serviceUrl)
649
654
  return;
650
- const o = this.viewState.context ?? await this.getProfileAndMetadata(i.uri), s = (await we({
655
+ const o = this.viewState.context ?? await this.getProfileAndMetadata(i.uri), n = (await we({
651
656
  baseUrl: this.serviceUrl,
652
657
  skillId: Je,
653
658
  message: this.viewState.question,
@@ -660,21 +665,21 @@ class Ke extends ie {
660
665
  }
661
666
  }
662
667
  })).find((r) => r.context?.kind === "ArcadeCodeResponse");
663
- if (!s)
668
+ if (!n)
664
669
  return;
665
- if (s.context?.kind === "ArcadeCodeResponse") {
670
+ if (n.context?.kind === "ArcadeCodeResponse") {
666
671
  const r = this.createFeedbackContextSnapshot(o);
667
672
  this.updateViewState({
668
673
  history: [
669
674
  {
670
- script: s?.context?.arcadeCode?.code,
671
- formattedScript: re(s?.context?.arcadeCode?.code ?? ""),
675
+ script: n?.context?.arcadeCode?.code,
676
+ formattedScript: re(n?.context?.arcadeCode?.code ?? ""),
672
677
  error: void 0,
673
678
  question: this.viewState.question,
674
679
  profile: o.profileId,
675
- conversationId: s.conversationId,
680
+ conversationId: n.conversationId,
676
681
  contextSnapshot: r,
677
- ...s.message ? { message: s.message } : {}
682
+ ...n.message ? { message: n.message } : {}
678
683
  },
679
684
  ...this.viewState.history
680
685
  ],
@@ -699,9 +704,9 @@ class Ke extends ie {
699
704
  let i = G;
700
705
  const o = N.getEditorProfileForModel(e);
701
706
  o?.loaded || await o?.loadSource();
702
- const n = this.editorRef.profile;
703
- n && "id" in n && (i = n.id);
704
- const s = o ? await Ue(o) : { variables: [] }, r = je(s), p = r ? Be(s) : void 0, a = p ? p.context : s, h = P(a);
707
+ const s = this.editorRef.profile;
708
+ s && "id" in s && (i = s.id);
709
+ const n = o ? await Ue(o) : { variables: [] }, r = Be(n), p = r ? je(n) : void 0, a = p ? p.context : n, h = P(a);
705
710
  return {
706
711
  profileId: i,
707
712
  metadata: a,
@@ -719,9 +724,9 @@ ${e}` : "";
719
724
  if (this.closed)
720
725
  return null;
721
726
  const e = this.viewState.viewMode === "result", i = this.getHistoryCards();
722
- return this.assistantsEnabled ? l`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.viewState.splashActive && l`<calcite-scrim></calcite-scrim>` || ""}${Ae({ messages: this.messages })}${Te({ messages: this.messages, popoverContent: O({ assistantsEnabled: this.assistantsEnabled, messages: this.messages, helpTopicUrl: this.usingTheAssitantDocUrl }) })}<calcite-shell class="unstyled-shell">${this.viewState.splashActive && Fe({ messages: this.messages, onProceed: () => {
727
+ return this.assistantsEnabled ? d`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.viewState.splashActive && d`<calcite-scrim></calcite-scrim>` || ""}${Ae({ messages: this.messages })}${Te({ messages: this.messages, popoverContent: O({ assistantsEnabled: this.assistantsEnabled, messages: this.messages, helpTopicUrl: this.usingTheAssitantDocUrl }) })}<calcite-shell class="unstyled-shell">${this.viewState.splashActive && Fe({ messages: this.messages, onProceed: () => {
723
728
  this.updateViewState({ splashActive: !1 });
724
- }, helpTopicUrl: this.assistantOverviewDocUrl, onExit: (o) => this.closePanel?.(o) }) || ""}${Ee({ active: this.viewState.confirmationActive, setActive: (o) => this.updateViewState({ confirmationActive: o }), messages: this.messages })}${Me({ isDisabled: this.viewState.isSubmitting, isReadOnly: !1, setQuestion: this.setQuestionState, setIsViewingResult: (o) => this.updateViewState({ viewMode: o ? "result" : "prompt" }), mode: e ? "refine" : "prompt", textAreaRef: this.textAreaRef, question: this.viewState.question, errorMessage: this.viewState.errorMessage, setErrorMessage: (o) => this.updateViewState({ errorMessage: o }), promptValidationMessage: this.viewState.promptValidationMessage, setPromptValidationMessage: (o) => this.updateViewState({ promptValidationMessage: o }), submitQuestion: this.submitQuestion.bind(this), assistantRef: this.el, messages: this.messages, context: this.viewState.context, contextReducedNoticeDismissed: this.viewState.contextReducedNoticeDismissed, setContextReducedNoticeDismissed: (o) => this.updateViewState({ contextReducedNoticeDismissed: o }) })}<calcite-block-group .label=${this.messages.interactiveblocks ?? "interactive blocks"}>${!e && !this.viewState.isSubmitting && De({ messages: this.messages, suggestions: [this.messages.prompsuggestion1 ?? "", this.messages.prompsuggestion2 ?? ""], onSuggestionClick: this.onSuggestionClick }) || ""}<calcite-block .hidden=${!this.viewState.isSubmitting} .heading=${this.messages.generatingresponse ?? "Generating response..."}></calcite-block>${L({
729
+ }, helpTopicUrl: this.assistantOverviewDocUrl, onExit: (o) => this.closePanel?.(o) }) || ""}${Re({ active: this.viewState.confirmationActive, setActive: (o) => this.updateViewState({ confirmationActive: o }), messages: this.messages })}${Me({ isDisabled: this.viewState.isSubmitting, isReadOnly: !1, setQuestion: this.setQuestionState, setIsViewingResult: (o) => this.updateViewState({ viewMode: o ? "result" : "prompt" }), mode: e ? "refine" : "prompt", textAreaRef: this.textAreaRef, question: this.viewState.question, errorMessage: this.viewState.errorMessage, setErrorMessage: (o) => this.updateViewState({ errorMessage: o }), promptValidationMessage: this.viewState.promptValidationMessage, setPromptValidationMessage: (o) => this.updateViewState({ promptValidationMessage: o }), submitQuestion: this.submitQuestion.bind(this), assistantRef: this.el, messages: this.messages, context: this.viewState.context, contextReducedNoticeDismissed: this.viewState.contextReducedNoticeDismissed, setContextReducedNoticeDismissed: (o) => this.updateViewState({ contextReducedNoticeDismissed: o }) })}<calcite-block-group .label=${this.messages.interactiveblocks ?? "interactive blocks"}>${!e && !this.viewState.isSubmitting && De({ messages: this.messages, suggestions: [this.messages.prompsuggestion1 ?? "", this.messages.prompsuggestion2 ?? ""], onSuggestionClick: this.onSuggestionClick }) || ""}<calcite-block .hidden=${!this.viewState.isSubmitting} .heading=${this.messages.generatingresponse ?? "Generating response..."}></calcite-block>${L({
725
730
  expanded: e,
726
731
  messages: this.messages,
727
732
  collapsible: !0,
@@ -746,7 +751,7 @@ ${e}` : "";
746
751
  heading: this.messages.recentprompts ?? "Recent prompts",
747
752
  hidden: this.viewState.isSubmitting || this.viewState.history.length === 0,
748
753
  onCopyCode: this.onCopyCode.bind(this)
749
- })}</calcite-block-group>${this.viewState.feedback.active ? qe({ setOpen: this.handleFeedbackSheetClose, messages: this.messages, onSubmit: this.handleFeedbackSubmit, feedback: this.viewState.feedback, setFeedback: this.setFeedbackState, learnMoreUrl: this.assistantOverviewDocUrl }) : null}</calcite-shell></calcite-flow-item></calcite-flow>` : l`<calcite-flow><calcite-flow-item .selected=${!e} closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${O({ slot: "content-top", messages: this.messages, assistantsEnabled: this.assistantsEnabled, helpTopicUrl: this.usingTheAssitantDocUrl })}</calcite-flow-item></calcite-flow>`;
754
+ })}</calcite-block-group>${this.viewState.feedback.active ? qe({ setOpen: this.handleFeedbackSheetClose, messages: this.messages, onSubmit: this.handleFeedbackSubmit, feedback: this.viewState.feedback, setFeedback: this.setFeedbackState, learnMoreUrl: this.assistantOverviewDocUrl }) : null}</calcite-shell></calcite-flow-item></calcite-flow>` : d`<calcite-flow><calcite-flow-item .selected=${!e} closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${O({ slot: "content-top", messages: this.messages, assistantsEnabled: this.assistantsEnabled, helpTopicUrl: this.usingTheAssitantDocUrl })}</calcite-flow-item></calcite-flow>`;
750
755
  }
751
756
  }
752
757
  Z("arcgis-arcade-coding-assistant", Ke);
@@ -31,7 +31,11 @@ import type { T9nMeta } from "@arcgis/lumina/controllers";
31
31
  * - Support for many [languages and directionality](https://developers.arcgis.com/javascript/latest/localization/)
32
32
  */
33
33
  export abstract class ArcgisArcadeEditor<T extends WithCustomPanels = object> extends LitElement {
34
- /** enables and configures the arcade assistant \@internal */
34
+ /**
35
+ * enables and configures the arcade assistant
36
+ *
37
+ * @internal
38
+ */
35
39
  accessor arcadeAssistant: ArcadeAssistantConfig | undefined;
36
40
  /**
37
41
  * Custom panels to be displayed in the side panel.