@arcgis/coding-components 4.34.0-next.21 → 4.34.0-next.22

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 (82) hide show
  1. package/dist/addons/arcade-coding-assistant/temporary-strings.d.ts +18 -3
  2. package/dist/addons.js +21 -20
  3. package/dist/cdn/{ZM4PE572.js → 3T7OQXNE.js} +2 -2
  4. package/dist/cdn/44VVRFTE.js +6 -0
  5. package/dist/cdn/{RK2DRTIK.js → 4TLKNQNU.js} +2 -2
  6. package/dist/cdn/{3D4I7ZIH.js → 5OK75RZV.js} +2 -2
  7. package/dist/cdn/{AMWSSI6Z.js → 5ZNJB57X.js} +2 -2
  8. package/dist/cdn/{4I55HTRW.js → 626RWGHR.js} +2 -2
  9. package/dist/cdn/{FT3O4I6P.js → 652I3LAU.js} +2 -2
  10. package/dist/cdn/{4FGPQQ2A.js → 7GZ5LC6N.js} +2 -2
  11. package/dist/cdn/{DES4FCYE.js → 7U7UESMA.js} +2 -2
  12. package/dist/cdn/{V4Y6OY32.js → A3RBF2MM.js} +1 -1
  13. package/dist/cdn/{T6QGH7YS.js → ARBW6DDF.js} +2 -2
  14. package/dist/cdn/{AD6BSLAM.js → CYSYN6DE.js} +1 -1
  15. package/dist/cdn/{P7WXJALE.js → D534VR5B.js} +2 -2
  16. package/dist/cdn/{2MBS54CP.js → DLP34HWH.js} +2 -2
  17. package/dist/cdn/{T7TBIZIA.js → EVVFBCW3.js} +2 -2
  18. package/dist/cdn/{CK4ZO3NV.js → FYT3LIXY.js} +2 -2
  19. package/dist/cdn/{N3TJ3VAW.js → GC7QZLF3.js} +2 -2
  20. package/dist/cdn/{JZ3AKIKL.js → GXKGSF2Z.js} +2 -2
  21. package/dist/cdn/{WQI5U62H.js → IBLC2OAN.js} +2 -2
  22. package/dist/cdn/{S22HBPCN.js → JLT5YYFI.js} +2 -2
  23. package/dist/cdn/{AWIFVV3B.js → KYVP6WS5.js} +2 -2
  24. package/dist/cdn/{2OY2OOHB.js → LRWISWPF.js} +2 -2
  25. package/dist/cdn/{GCKT6QGO.js → NCW2HFRK.js} +2 -2
  26. package/dist/cdn/{7BH6A67O.js → NU5I62SS.js} +1 -1
  27. package/dist/cdn/{4RVJX5WW.js → NUR2A4CI.js} +2 -2
  28. package/dist/cdn/{4DWQHJO3.js → OQQ3HAHE.js} +2 -2
  29. package/dist/cdn/{GSBW6FVS.js → PDP6ZA7L.js} +1 -1
  30. package/dist/cdn/{MWPPYTAZ.js → POQ3CBR6.js} +2 -2
  31. package/dist/cdn/{AXYFA76H.js → PVYVTTIG.js} +2 -2
  32. package/dist/cdn/{HXOGCC2Y.js → QNAKKYTV.js} +2 -2
  33. package/dist/cdn/{D2XTCFJF.js → SSRAS4G2.js} +6 -5
  34. package/dist/cdn/{JUPBFVGO.js → TSOMG7YT.js} +2 -2
  35. package/dist/cdn/{W7IU44PK.js → TXGQ74MM.js} +2 -2
  36. package/dist/cdn/{MHHNM6IR.js → V2JVXF45.js} +2 -2
  37. package/dist/cdn/{LFWH37K6.js → V36HZMIH.js} +2 -2
  38. package/dist/cdn/{PML43ZG4.js → VZXVZQHL.js} +2 -2
  39. package/dist/cdn/{7OW3V2VS.js → WVSVCZSW.js} +2 -2
  40. package/dist/cdn/{OO6NPCQP.js → XBP2L3PE.js} +3 -3
  41. package/dist/cdn/{APPIAUW3.js → XVVZUXBY.js} +2 -2
  42. package/dist/cdn/{RUQSKYNM.js → ZGWSWBPR.js} +2 -2
  43. package/dist/cdn/{D6HEWBPW.js → ZZ5VO6AZ.js} +1 -1
  44. package/dist/cdn/assets/code-editor/sql-expr.worker.js +36809 -36752
  45. package/dist/cdn/index.js +2 -2
  46. package/dist/chunks/arcade-defaults.js +2 -2
  47. package/dist/chunks/arcade-executor.js +1 -1
  48. package/dist/chunks/arcade-mode.js +1 -1
  49. package/dist/chunks/arcade-service-accessors.js +1 -1
  50. package/dist/chunks/editor.js +1 -1
  51. package/dist/chunks/fields.js +1 -1
  52. package/dist/chunks/language-defaults-base.js +4 -3
  53. package/dist/chunks/markdown.js +1 -1
  54. package/dist/chunks/monaco-importer.js +64 -44
  55. package/dist/chunks/runtime.js +1 -1
  56. package/dist/chunks/setup-monaco.js +1 -1
  57. package/dist/chunks/sql-expr-contribution.js +1 -1
  58. package/dist/chunks/sql-expr-defaults.js +1 -1
  59. package/dist/chunks/sql-expr-mode.js +1 -1
  60. package/dist/chunks/useT9n.js +1 -1
  61. package/dist/components/arcgis-arcade-coding-assistant/customElement.d.ts +3 -8
  62. package/dist/components/arcgis-arcade-coding-assistant/customElement.js +208 -147
  63. package/dist/components/arcgis-arcade-coding-assistant/functional.d.ts +17 -11
  64. package/dist/components/arcgis-arcade-coding-assistant/index.d.ts +5 -2
  65. package/dist/components/arcgis-arcade-coding-assistant/index.js +5 -2
  66. package/dist/components/arcgis-arcade-coding-assistant/types.d.ts +36 -0
  67. package/dist/components/arcgis-arcade-editor/customElement.js +1 -1
  68. package/dist/components/arcgis-arcade-results/customElement.js +1 -1
  69. package/dist/components/arcgis-arcade-suggestions/customElement.js +1 -1
  70. package/dist/components/arcgis-code-editor/customElement.js +1 -1
  71. package/dist/components/arcgis-editor-variables/customElement.js +1 -1
  72. package/dist/components/arcgis-language-api-panel/customElement.js +1 -1
  73. package/dist/components/arcgis-sql-expression-editor/customElement.js +1 -1
  74. package/dist/components/arcgis-sql-expression-fields/customElement.js +1 -1
  75. package/dist/docs/api.json +2 -2
  76. package/dist/docs/docs.json +2 -2
  77. package/dist/docs/web-types.json +1 -1
  78. package/dist/index.js +1 -1
  79. package/dist/loader.js +4 -4
  80. package/dist/utils/utilities.d.ts +1 -1
  81. package/package.json +6 -6
  82. package/dist/cdn/UPGWCEYX.js +0 -4
@@ -1,24 +1,25 @@
1
- import { c as q } from "../../chunks/runtime.js";
2
- import { html as n } from "lit-html";
3
- import { nothing as P, LitElement as V } from "@arcgis/lumina";
4
- import { ref as _, createRef as D } from "lit/directives/ref.js";
5
- import j from "@arcgis/core/identity/IdentityManager.js";
6
- import { u as z } from "../../chunks/useT9n.js";
7
- import { b as O } from "../../chunks/arcade-defaults.js";
8
- import { css as U } from "@lit/reactive-element/css-tag.js";
1
+ import { c as U } from "../../chunks/runtime.js";
2
+ import { html as c } from "lit-html";
3
+ import { nothing as F, LitElement as _ } from "@arcgis/lumina";
4
+ import { ref as N, createRef as V } from "lit/directives/ref.js";
5
+ import D from "@arcgis/core/identity/IdentityManager.js";
6
+ import { u as B } from "../../chunks/useT9n.js";
7
+ import { b as z } from "../../chunks/arcade-defaults.js";
8
+ import { css as H } from "@lit/reactive-element/css-tag.js";
9
9
  import "lit";
10
- import S from "@arcgis/core/request.js";
11
- import { a as N, e as B } from "../../chunks/monaco-importer.js";
12
- import { repeat as H } from "lit-html/directives/repeat.js";
10
+ import T from "@arcgis/core/request.js";
11
+ import { a as L, e as O } from "../../chunks/monaco-importer.js";
12
+ import { repeat as j } from "lit-html/directives/repeat.js";
13
13
  import "@arcgis/components-utils";
14
- import { unsafeHTML as y } from "lit/directives/unsafe-html.js";
14
+ import { unsafeHTML as S } from "lit/directives/unsafe-html.js";
15
15
  import W from "@arcgis/core/layers/FeatureLayer.js";
16
- import G from "@arcgis/core/Graphic.js";
16
+ import Q from "@arcgis/core/Graphic.js";
17
+ import { b as G } from "../../chunks/language-defaults-base.js";
17
18
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
18
19
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
19
- v4.34.0-next.21 */
20
- const Q = U`:host(:not([closed])){flex:1 0 auto;border-inline-start:var(--arcgis-coding-components-border);box-sizing:border-box;max-width:var(--arcgis-coding-components-side-panel-max-w);width:var(--arcgis-coding-components-side-panel-w);.response-actions{display:flex;align-items:center;padding:.5rem;gap:.5rem}.response-actions>div{display:flex;gap:.5rem}.prompt-list calcite-list-item{margin-block-end:.5rem;border-radius:var(--calcite-corner-radius-round);--calcite-color-border-3: transparent;overflow:hidden}.feedback-content{padding:1rem;display:flex;flex-direction:column;gap:.75rem}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: auto;--calcite-sheet-min-height: auto}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-list-item:focus calcite-button{position:relative;top:-2px}.prompt-list calcite-list-item:last-of-type{margin-block-end:0}calcite-list{--calcite-color-foreground-1: transparent;background-color:transparent}calcite-list-item{--calcite-color-foreground-1: white}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}.type-suggestion{--calcite-color-foreground-1: var(--calcite-color-foreground-current);--calcite-color-text-3: var(--calcite-color-text-2);--calcite-icon-color: var(--calcite-color-brand)}.type-history{--calcite-icon-color: var(--calcite-color-text-2)}.type-response{--calcite-icon-color: var(--calcite-color-brand);--calcite-font-family: monospace}.block-response{align-self:flex-start;margin-block-end:4rem;border-block-end:0;--calcite-block-text-color: var(--calcite-color-brand)}calcite-list-item calcite-button{margin-inline-end:.25rem}.type-docs{--calcite-color-foreground-1: var(--calcite-color-foreground-3);--calcite-icon-color: var(--calcite-color-text-1)}.type-error{--calcite-icon-color: var(--calcite-color-status-danger);--calcite-font-family: monospace;border:1px solid var(--calcite-color-status-danger)}#thumbs-up{margin-inline-start:auto;--calcite-icon-color: var(--calcite-color-border-input)}#thumbs-down{--calcite-icon-color: var(--calcite-color-border-input)}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}.no-space-block,.no-space-block[open]{margin:0}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;flex-direction:column;background:#fff;border-radius:var(--calcite-corner-radius-round);margin:.75rem;width:calc(100% - 1.5rem);overflow:hidden;max-width:calc(100% - 1.5rem);--calcite-color-border-input: transparent;--calcite-text-area-divider-color: transparent;position:sticky;align-self:flex-end;box-shadow:var(--calcite-shadow-sm);flex:none}.text-area-wrapper calcite-button:last-of-type{margin-inline-start:auto;align-self:flex-end}calcite-text-area{height:auto;min-height:5.75rem;overflow:hidden;border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-tooltip{--calcite-tooltip-z-index: 1000}.standalone-list{margin:1rem;width:calc(100% - 2rem)}.result-disclaimer{display:block;width:24rem;max-width:90%;margin:1rem auto;text-align:center;line-height:1.125rem;font-size:.875rem;font-style:italic}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}.break-spaces{white-space:break-spaces}.feedback-button-container{margin-inline-start:auto;gap:0}.info-heading{font-size:var(--calcite-font-size-1);color:var(--calcite-color-text-1)}.welcome-display-graphic{width:100%;height:6rem;background:var(--calcite-color-foreground-current);position:relative;display:flex;align-items:center;justify-content:center;--calcite-icon-color: var(--calcite-color-brand)}.unstyled-shell{position:unset;inset:unset;display:unset;block-size:unset;inline-size:unset}.suggestion-chips{--calcite-chip-background-color: var(--calcite-color-foreground-current);--calcite-chip-text-color: var(--calcite-color-brand);calcite-chip{cursor:pointer}}#result-block{calcite-card-group{--calcite-card-group-gap: 1.25rem}calcite-card{--calcite-card-corner-radius: var(--calcite-corner-radius-round);--calcite-card-background-color: white;--calcite-card-border-color: transparent;width:100%}.positioned-code-content{display:flex;flex-direction:row;padding:.25rem .5rem;gap:.5rem}calcite-card [slot=title] calcite-chip{margin-block-start:.25rem}.code-response-wrapper{position:relative;background:var(--calcite-color-foreground-2);border-radius:var(--calcite-corner-radius-round)}.prior-prompt{margin:.25rem 0 .75rem;max-width:90%;padding:0}pre{font-size:12px;margin:0;padding:0;overflow-x:auto;font-family:Fira Mono,Consolas,Menlo,monospace;display:block;max-height:12rem;position:relative}code{display:block;margin:0;padding:0 1rem}.code-collapse{margin-inline-start:auto}}}:host([closed]){display:none}`;
21
- function R(i) {
20
+ v4.34.0-next.22 */
21
+ const J = H`:host(:not([closed])){flex:1 0 auto;border-inline-start:var(--arcgis-coding-components-border);box-sizing:border-box;max-width:var(--arcgis-coding-components-side-panel-max-w);width:var(--arcgis-coding-components-side-panel-w);.response-actions{display:flex;align-items:center;padding:.5rem;gap:.5rem}.response-actions>div{display:flex;gap:.5rem}.prompt-list calcite-list-item{margin-block-end:.5rem;border-radius:var(--calcite-corner-radius-round);--calcite-color-border-3: transparent;overflow:hidden}.feedback-content{padding:1rem;display:flex;flex-direction:column;gap:.75rem}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: auto;--calcite-sheet-min-height: auto}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-list-item:focus calcite-button{position:relative;top:-2px}.prompt-list calcite-list-item:last-of-type{margin-block-end:0}calcite-list{--calcite-color-foreground-1: transparent;background-color:transparent}calcite-list-item{--calcite-color-foreground-1: white}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}.type-suggestion{--calcite-color-foreground-1: var(--calcite-color-foreground-current);--calcite-color-text-3: var(--calcite-color-text-2);--calcite-icon-color: var(--calcite-color-brand)}.type-history{--calcite-icon-color: var(--calcite-color-text-2)}.type-response{--calcite-icon-color: var(--calcite-color-brand);--calcite-font-family: monospace}.block-response{align-self:flex-start;margin-block-end:4rem;border-block-end:0;--calcite-block-text-color: var(--calcite-color-brand)}calcite-list-item calcite-button{margin-inline-end:.25rem}.type-docs{--calcite-color-foreground-1: var(--calcite-color-foreground-3);--calcite-icon-color: var(--calcite-color-text-1)}.type-error{--calcite-icon-color: var(--calcite-color-status-danger);--calcite-font-family: monospace;border:1px solid var(--calcite-color-status-danger)}#thumbs-up{margin-inline-start:auto;--calcite-icon-color: var(--calcite-color-border-input)}#thumbs-down{--calcite-icon-color: var(--calcite-color-border-input)}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}.no-space-block,.no-space-block[open]{margin:0}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;flex-direction:column;background:#fff;border-radius:var(--calcite-corner-radius-round);margin:.75rem;width:calc(100% - 1.5rem);overflow:hidden;max-width:calc(100% - 1.5rem);--calcite-color-border-input: transparent;--calcite-text-area-divider-color: transparent;position:sticky;align-self:flex-end;box-shadow:var(--calcite-shadow-sm);flex:none}.text-area-wrapper calcite-button:last-of-type{margin-inline-start:auto;align-self:flex-end}calcite-text-area{height:auto;min-height:5.75rem;overflow:hidden;border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-tooltip{--calcite-tooltip-z-index: 1000}.standalone-list{margin:1rem;width:calc(100% - 2rem)}.result-disclaimer{display:block;width:24rem;max-width:90%;margin:1rem auto;text-align:center;line-height:1.125rem;font-size:.875rem;font-style:italic}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}.break-spaces{white-space:break-spaces}.feedback-button-container{margin-inline-start:auto;gap:0}.info-heading{font-size:var(--calcite-font-size-1);color:var(--calcite-color-text-1)}.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-chips{--calcite-chip-background-color: var(--calcite-color-foreground-current);--calcite-chip-text-color: var(--calcite-color-brand);calcite-chip{cursor:pointer}}.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-background-color: white;--calcite-card-border-color: transparent;width:100%}.positioned-code-content{flex-direction:row;gap:.5rem;display:flex;padding:.5rem}calcite-card [slot=title] 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{margin:.25rem 0 .75rem;max-width:95%;overflow-y:hidden;overflow-x:auto;padding:0}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}.code-collapse{margin-inline-start:auto}.copy-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}}:host([closed]){display:none}`;
22
+ function E(i) {
22
23
  if (!i)
23
24
  return;
24
25
  const e = i.indexOf('{"error":');
@@ -31,132 +32,131 @@ function R(i) {
31
32
  return;
32
33
  }
33
34
  }
34
- async function J(i) {
35
- const { baseUrl: e, skillId: t, message: a, authToken: c, previousConversationId: o, context: r } = i, s = t ? `${e}/skills/${t}/chat` : `${e}/chat`, d = [], l = {
35
+ async function Y(i) {
36
+ const { baseUrl: e, skillId: t, message: a, authToken: s, previousConversationId: o, context: l } = i, r = t ? `${e}/skills/${t}/chat` : `${e}/chat`, n = [], d = {
36
37
  message: a,
37
- context: r
38
+ context: l
38
39
  };
39
- o && (l.conversation_id = o);
40
- let m;
40
+ o && (d.conversation_id = o);
41
+ let g;
41
42
  try {
42
- m = await S(s, {
43
+ g = await T(r, {
43
44
  method: "post",
44
45
  headers: {
45
46
  "Content-Type": "application/json",
46
- token: c
47
+ token: s
47
48
  },
48
- body: JSON.stringify(l),
49
+ body: JSON.stringify(d),
49
50
  responseType: "json"
50
51
  });
51
- } catch (f) {
52
- const b = f?.details?.rawResponse || f?.message || String(f), v = R(b), g = new Error(
53
- `Failed to send message: ${a}. Response: ${b}`
52
+ } catch (v) {
53
+ const y = v?.details?.rawResponse || v?.message || String(v), w = E(y), k = new Error(
54
+ `Failed to send message: ${a}. Response: ${y}`
54
55
  );
55
- throw v && (g.arcadeAssistantError = v), g;
56
+ throw w && (k.arcadeAssistantError = w), k;
56
57
  }
57
- const p = m.data;
58
- if (!p.hasMore)
58
+ const h = g.data;
59
+ if (!h.hasMore)
59
60
  throw new Error("Expected hasMore to be true");
60
- d.push(p);
61
- const T = p.conversationId, M = p.inquiryId;
62
- let w = p.sequenceNumber;
63
- async function F() {
64
- let f = 0;
65
- const b = 25;
66
- for (; f < b; ) {
67
- await new Promise((h) => setTimeout(h, 1e3));
68
- const v = L(T, w, M);
69
- let g;
61
+ n.push(h);
62
+ const m = h.conversationId, $ = h.inquiryId;
63
+ let p = h.sequenceNumber;
64
+ async function x() {
65
+ let v = 0;
66
+ const y = 25;
67
+ for (; v < y; ) {
68
+ await new Promise((b) => setTimeout(b, 1e3));
69
+ const w = K(m, p, $);
70
+ let k;
70
71
  try {
71
- g = await S(s, {
72
+ k = await T(r, {
72
73
  method: "post",
73
74
  headers: {
74
75
  "Content-Type": "application/json",
75
- token: c
76
+ token: s
76
77
  },
77
- body: JSON.stringify(v),
78
+ body: JSON.stringify(w),
78
79
  responseType: "json"
79
80
  });
80
- } catch (h) {
81
- const x = h?.details?.rawResponse || h?.message || String(h), $ = R(x), A = new Error(
82
- `Polling failed. Response: ${x}`
81
+ } catch (b) {
82
+ const R = b?.details?.rawResponse || b?.message || String(b), I = E(R), C = new Error(
83
+ `Polling failed. Response: ${R}`
83
84
  );
84
- throw $ && (A.arcadeAssistantError = $), A;
85
+ throw I && (C.arcadeAssistantError = I), C;
85
86
  }
86
- const u = g.data;
87
- if (u.context && u.context.kind === "ArcgisErrorAsContext" && u.context.error) {
88
- const h = new Error(
89
- u.context.error.message || "ArcGIS Assistant error"
87
+ const f = k.data;
88
+ if (f.context && f.context.kind === "ArcgisErrorAsContext" && f.context.error) {
89
+ const b = new Error(
90
+ f.context.error.message || "ArcGIS Assistant error"
90
91
  );
91
- throw h.arcadeAssistantError = { message: u.context.error.message ?? "ArcGIS Assistant error" }, h;
92
+ throw b.arcadeAssistantError = { message: f.context.error.message ?? "ArcGIS Assistant error" }, b;
92
93
  }
93
- if (d.push(u), w = u.sequenceNumber, f++, !u.hasMore)
94
+ if (n.push(f), p = f.sequenceNumber, v++, !f.hasMore)
94
95
  break;
95
96
  }
96
- if (f === b)
97
+ if (v === y)
97
98
  throw new Error("Request timed out");
98
99
  }
99
- return await F(), d;
100
+ return await x(), n;
100
101
  }
101
- function L(i, e, t) {
102
+ function K(i, e, t) {
102
103
  return {
103
104
  conversationId: i,
104
105
  inquiryId: t,
105
106
  ackSequenceNumber: e
106
107
  };
107
108
  }
108
- const Y = (i) => {
109
- const e = i.value.length, t = 72, a = 180, c = i.offsetWidth, r = Math.max(1, Math.floor(c / 8)), s = Math.ceil(e / r), d = t + (s - 2) * 24;
110
- i.style.setProperty("--calcite-text-area-min-height", `${Math.min(d, a)}px`);
109
+ const X = (i) => {
110
+ const e = i.value.length, t = 72, a = 180, s = i.offsetWidth, l = Math.max(1, Math.floor(s / 8)), r = Math.ceil(e / l), n = t + (r - 2) * 24;
111
+ i.style.setProperty("--calcite-text-area-min-height", `${Math.min(n, a)}px`);
111
112
  };
112
- function K({ messages: i }) {
113
- return n`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${i.beta ?? "Beta"}>${i.beta ?? "Beta"}</calcite-chip>`;
113
+ function Z({ messages: i }) {
114
+ return c`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${i.beta ?? "Beta"}>${i.beta ?? "Beta"}</calcite-chip>`;
114
115
  }
115
- function X({ popoverContent: i }) {
116
- return n`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer overlay-positioning=fixed label=legal-disclaimer placement=bottom auto-close>${i}</calcite-popover>`;
116
+ function ee({ popoverContent: i }) {
117
+ return c`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer overlay-positioning=fixed label=legal-disclaimer placement=bottom auto-close>${i}</calcite-popover>`;
117
118
  }
118
- function Z({ errorMessage: i }) {
119
- return n`<calcite-input-message id=error-message status=invalid slot=footer-start icon=exclamation-mark-triangle scale=m>${i}</calcite-input-message>`;
119
+ function te({ errorMessage: i }) {
120
+ return c`<calcite-input-message id=error-message status=invalid slot=footer-start icon=exclamation-mark-triangle scale=m>${i}</calcite-input-message>`;
120
121
  }
121
- function ee({ active: i, setActive: e, messages: t }) {
122
- return n`<calcite-alert slot=alerts .open=${i} placement=bottom kind=success icon=check-circle-f auto-close @calciteAlertClose=${() => e(!1)} label=confirmation-alert><div slot=message>${t.expressionapplied ?? "Expression applied to editor."}</div></calcite-alert>`;
122
+ function ie({ active: i, setActive: e, messages: t }) {
123
+ return c`<calcite-alert slot=alerts .open=${i} placement=bottom kind=success icon=check-circle-f auto-close @calciteAlertClose=${() => e(!1)} .label=${t.expressionapplied ?? "Expression applied"}><div slot=message>${t.expressionapplied ?? "Expression applied to editor."}</div></calcite-alert>`;
123
124
  }
124
- function te({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult: a, textAreaRef: c, question: o, errorMessage: r, setErrorMessage: s, submitQuestion: d, messages: l, mode: m }) {
125
- return n`<div class="text-area-wrapper"><calcite-text-area resize=vertical .readOnly=${i || e} class="styled-text-area" .placeholder=${l.askaquestion ?? `Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${o} @calciteTextAreaInput=${(p) => {
126
- Y(p.target), t(p.target.value);
127
- }} ${_(c)}>${r && Z({ errorMessage: r }) || ""}</calcite-text-area><div class="response-actions" slot=footer-end><calcite-button round kind=neutral .hidden=${m !== "refine"} icon-start=arrow-left appearance=solid .disabled=${i} @click=${async () => {
125
+ function ae({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult: a, textAreaRef: s, question: o, errorMessage: l, setErrorMessage: r, submitQuestion: n, messages: d, mode: g }) {
126
+ return c`<div class="text-area-wrapper"><calcite-text-area resize=vertical .readOnly=${i || e} class="styled-text-area" .placeholder=${d.askaquestion ?? `Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${o} @calciteTextAreaInput=${(h) => {
127
+ X(h.target), t(h.target.value);
128
+ }} ${N(s)}>${l && te({ errorMessage: l }) || ""}</calcite-text-area><div class="response-actions" slot=footer-end><calcite-button round kind=neutral .hidden=${g !== "refine"} icon-start=arrow-left appearance=solid .disabled=${i} @click=${async () => {
128
129
  a(!1), t("");
129
- }}>${l.startover ?? "Start Over"}</calcite-button><calcite-button round icon-end=effects appearance=solid .loading=${i} .disabled=${i} @click=${async () => {
130
- s(o ? "" : l.enteraprompt ?? "Please enter a prompt"), await d();
131
- }}>${m === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}</calcite-button></div></div>`;
130
+ }}>${d.startover ?? "Start Over"}</calcite-button><calcite-button round icon-end=effects appearance=solid .loading=${i} .disabled=${i} @click=${async () => {
131
+ r(o ? "" : d.enteraprompt ?? "Please enter a prompt"), await n();
132
+ }}>${g === "prompt" ? d.ask ?? "Generate" : d.refine ?? "Refine"}</calcite-button></div></div>`;
132
133
  }
133
- function ie({ open: i, setOpen: e, messages: t, feedbackValue: a, setFeedbackValue: c, feedbackText: o, setFeedbackText: r, onSubmit: s }) {
134
- return n`<calcite-sheet class="feedback-sheet" .label=${t.feedback ?? "Feedback"} slot=sheets display-mode=float position=block-end .open=${i} @calciteSheetClose=${() => e(!1)}><calcite-panel .heading=${t.providefeedback ?? "Provide feedback"} .description=${t.experiencehelps ?? "Your experience helps guide future improvements"}><div class="feedback-content"><calcite-label>${t.experiencehelpful ?? "Was the assistant helpful?"}<calcite-segmented-control scale=l><calcite-segmented-control-item icon-start=thumbs-up .checked=${a === "good"} @click=${() => c("good")}></calcite-segmented-control-item><calcite-segmented-control-item icon-start=thumbs-down .checked=${a === "bad"} @click=${() => c("bad")}></calcite-segmented-control-item></calcite-segmented-control></calcite-label><calcite-label>${t.describeexperience ?? "Describe your experience"}<calcite-text-area resize=vertical .value=${o} @calciteTextAreaInput=${(d) => r(d.target.value)}></calcite-text-area></calcite-label></div><calcite-button slot=footer width=full @click=${s}>${t.submitfeedback ?? "Submit Feedback"}</calcite-button></calcite-panel></calcite-sheet>`;
134
+ const oe = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-statement", se = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement";
135
+ function ce({ setOpen: i, messages: e, feedback: t, setFeedback: a, onSubmit: s }) {
136
+ return c`<calcite-sheet class="feedback-sheet" .label=${e.feedback ?? "Feedback"} slot=sheets display-mode=float position=block-end .open=${t.active} @calciteSheetClose=${() => i(!1)}><calcite-panel .heading=${e.providefeedback ?? "Provide feedback"} .description=${e.experiencehelps ?? "Your experience helps guide future improvements"}><div class="feedback-content"><calcite-label>${e.experiencehelpful ?? "Was the assistant helpful?"}<calcite-segmented-control scale=l><calcite-segmented-control-item icon-start=thumbs-up .checked=${t.value === "good"} @click=${() => a({ ...t, value: "good" })}></calcite-segmented-control-item><calcite-segmented-control-item icon-start=thumbs-down .checked=${t.value === "bad"} @click=${() => a({ ...t, value: "bad" })}></calcite-segmented-control-item></calcite-segmented-control></calcite-label><calcite-label>${e.describeexperience ?? "Describe your experience"}<calcite-text-area resize=vertical .value=${t.text} @calciteTextAreaInput=${(o) => a({ ...t, text: o.target.value })}></calcite-text-area></calcite-label><calcite-label layout=inline scale=s><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${(o) => {
137
+ a({ ...t, termsAccepted: o.target.checked });
138
+ }}></calcite-checkbox><span>${S(e.agreement?.replace("{EsriPrivacyStatement}", `<calcite-link href=${oe} target="_blank">${e.esriprivacystatement ?? "Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}", `<calcite-link href=${se} target="_blank">${e.supplement ?? "Supplement"}</calcite-link>`))}</span></calcite-label></div><calcite-button slot=footer width=full @click=${s} .disabled=${!t.termsAccepted || t.submitting} .loading=${t.submitting}>${e.submitfeedback ?? "Submit Feedback"}</calcite-button></calcite-panel></calcite-sheet>`;
135
139
  }
136
- function C({ assistantsEnabled: i, messages: e, slot: t }) {
137
- return n`<calcite-block label=info slot=${t ?? P} expanded><calcite-chip .label=${e.new ?? "new"} kind=brand>${e.new}</calcite-chip><h1 class="info-heading">${e.introducing}</h1><p>${e.capabilities}</p>${!i && n`<p>${y(e.useofassistant?.replace("{aiassistants}", `<strong>${e.aiassistants ?? "Ai Assistants"}</strong>`))}<calcite-link href=https://doc.arcgis.com/en/arcgis-online/administer/configure-assistants.htm target=_blank icon-end=launch-2>${e.opensettings ?? "Open Settings"}</calcite-link></p>` || ""}</calcite-block>`;
140
+ function M({ assistantsEnabled: i, messages: e, slot: t, assistantHelpUrl: a, helpTopicUrl: s }) {
141
+ return c`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${t ?? F} expanded class="info-block"><calcite-chip .label=${e.new ?? "new"} kind=brand>${e.new}</calcite-chip><h1 class="info-heading">${e.introducing}</h1><p>${e.capabilities}</p>${i ? c`<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>${S((e.seedocumentation ?? "Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}", `<calcite-link href=${s} target="_blank">${e.documentation ?? "documentation"}</calcite-link>`))}</p>` : c`<p>${S(e.useofassistant?.replace("{aiassistants}", `<strong>${e.aiassistants ?? "Ai Assistants"}</strong>`))}<calcite-link .href=${a} target=_blank icon-end=launch-2>${e.opensettings ?? "Open Settings"}</calcite-link></p>`}</calcite-block>`;
138
142
  }
139
- function ae({ messages: i, onProceed: e, onExit: t }) {
140
- return n`<calcite-scrim></calcite-scrim><calcite-dialog close-disabled placement=top .heading=${i.welcome} slot=dialogs open width-scale=m id=welcome-dialog><div class="welcome-display-graphic" slot=content-top><calcite-chip scale=l icon=effects label=effects></calcite-chip></div><calcite-notice scale=s open width=full><div slot=title>${i.beforeyougetstarted}</div></calcite-notice>&bull; ${i.maybeincorrect} <br><br><span>${y(`&bull; ${i.pleasereadhelp.replace("{helpTopic}", `<calcite-link href="https://doc.arcgis.com/en/arcgis-online/help/arcade-assistant.htm" target="_blank">${i.helptopic}</calcite-link>`)}`)}</span><br><div slot=content-bottom>${y(i.consultprivacy.replace(
141
- "{privacyStatement}",
142
- // TODO get correct link
143
- `<calcite-link href="https://www.esri.com/en-us/privacy/arcgis-online-privacy-statement" target="_blank">${i.privacyStatement}</calcite-link>`
144
- ).replace("{privacySupplement}", `<calcite-link href="https://www.esri.com/en-us/privacy/arcgis-online-privacy-supplement" target="_blank">${i.privacySupplement}</calcite-link>`))}</div><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${i.proceed}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${i.exit}</calcite-button></calcite-dialog>`;
143
+ function re({ messages: i, onProceed: e, onExit: t, helpTopicUrl: a }) {
144
+ return c`<calcite-dialog close-disabled placement=top .heading=${i.welcome} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${i.beforeyougetstarted}</h3><ul><li>${i.maybeincorrect}</li><li>${S(i.pleasereadhelp.replace("{helpTopic}", `<calcite-link href=${a} target="_blank">${i.helptopic}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${i.proceed}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${i.exit}</calcite-button></calcite-dialog>`;
145
145
  }
146
- function se({ messages: i, suggestions: e, onSuggestionClick: t }) {
147
- return n`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block><calcite-chip-group .label=${i.promptsuggestions} class="suggestion-chips">${H(e, (a) => a, (a) => n`<calcite-chip .label=${i.promptsuggestion} .value=${a} icon=effects @click=${() => t?.(a)}>${a}</calcite-chip>`)}</calcite-chip-group></calcite-block>`;
146
+ function ne({ messages: i, suggestions: e, onSuggestionClick: t }) {
147
+ return c`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block><calcite-chip-group .label=${i.promptsuggestions} class="suggestion-chips">${j(e, (a) => a, (a) => c`<calcite-chip .label=${i.promptsuggestion} .value=${a} icon=effects @click=${() => t?.(a)}>${a}</calcite-chip>`)}</calcite-chip-group></calcite-block>`;
148
148
  }
149
- function ce({ hidden: i = !1, expanded: e = !1, messages: t, cards: a, heading: c, collapsible: o = !1, showEffectsIcon: r = !1 }) {
150
- return n`<calcite-block .hidden=${i} id=result-block .heading=${c ?? t.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .collapsible=${o}>${r && n`<calcite-chip label slot=content-start icon=effects kind=brand></calcite-chip>` || ""}<calcite-card-group .label=${t.assistantresponses}>${a.map((s, d) => n`<calcite-card><div slot=title><div class="prior-prompt">${s.priorPrompt}</div><div class="code-response-wrapper"><div class="positioned-code-content">${s.chips?.map((l) => n`<calcite-chip .label=${l.label} .scale=${l.scale ?? "s"} .appearance=${l.appearance ?? "outline"} .icon=${l.icon}>${l.label}</calcite-chip>`)}</div><pre><code>${s.code}</code></pre></div></div><div slot=footer-start><calcite-button round icon-start=plus appearance=outline-fill class="add-to-editor-button" @click=${s.onAddToEditor}>${t.addtoeditor ?? "Add to editor"}</calcite-button><calcite-button round icon-start=copy-to-clipboard kind=neutral @click=${() => s.onCopy(d)}>${s.copySuccessIndex === d ? t.copied ?? "copied" : ""}</calcite-button></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup} scale=s icon=thumbs-up @click=${s.onThumbsUp}></calcite-action><calcite-action .text=${t.thumbsdown} scale=s icon=thumbs-down @click=${s.onThumbsDown}></calcite-action></div></calcite-card>`)}</calcite-card-group></calcite-block>`;
149
+ function le({ hidden: i = !1, expanded: e = !1, messages: t, cards: a, heading: s, collapsible: o = !1, showEffectsIcon: l = !1, editorInsertMode: r = "add", setEditorInsertMode: n }) {
150
+ const d = r === "replace", g = d ? t.replaceineditor ?? "Replace in editor" : t.addtoeditor ?? "Add to editor", h = d ? t.addtoeditor ?? "Add to editor" : t.replaceineditor ?? "Replace in editor";
151
+ return c`<calcite-block .hidden=${i} id=result-block .heading=${s ?? t.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .collapsible=${o}>${l && c`<calcite-chip label slot=content-start icon=effects kind=brand></calcite-chip>` || ""}<calcite-card-group .label=${t.assistantresponses}>${a.map((m, $) => c`<calcite-card><div slot=heading><div class="prior-prompt">${m.priorPrompt}</div></div><div><div class="code-response-wrapper"><div class="positioned-code-content">${m.chips?.map((p, x) => c`${p.tooltip && c`<calcite-tooltip .referenceElement=${`response-chip-${p.conversationId}-${x}`}>${p.tooltip}</calcite-tooltip>` || ""}<calcite-chip .label=${p.label} .scale=${p.scale ?? "s"} .appearance=${p.appearance ?? "outline"} .icon=${p.icon} .id=${`response-chip-${p.conversationId}-${x}`}>${p.label}</calcite-chip>`)}</div><code>${m.code}</code></div></div><div slot=footer-start><calcite-split-button primary-text=${g ?? F} appearance=outline-fill class="add-to-editor-button" @calciteSplitButtonPrimaryClick=${() => m.onAddToEditor()} overlay-positioning=fixed><calcite-dropdown-item @calciteDropdownItemSelect=${() => {
152
+ n?.(d ? "add" : "replace");
153
+ }}>${h}</calcite-dropdown-item></calcite-split-button><calcite-button round icon-start=copy-to-clipboard kind=neutral @click=${() => m.onCopy($)} class="copy-button">${m.copySuccessIndex === $ ? t.copied ?? "copied" : ""}</calcite-button></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup} scale=s icon=thumbs-up @click=${m.onThumbsUp}></calcite-action><calcite-action .text=${t.thumbsdown} scale=s icon=thumbs-down @click=${m.onThumbsDown}></calcite-action></div></calcite-card>`)}</calcite-card-group></calcite-block>`;
151
154
  }
152
- const k = {
155
+ const u = {
153
156
  welcome: "Welcome to the new assistant experience",
154
157
  beforeyougetstarted: "Before you get started be aware:",
155
158
  maybeincorrect: "AI generated code may occasionally be incorrect or biased. Review carefully.",
156
- pleasereadhelp: "Please read the Arcade Assistant (beta) overview {helpTopic} for more details.",
157
- consultprivacy: "Consult the {privacyStatement} and {privacySupplement}.",
158
- privacyStatement: "privacy statement",
159
- privacySupplement: "privacy supplement",
159
+ pleasereadhelp: "Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.",
160
160
  proceed: "Proceed",
161
161
  exit: "Exit",
162
162
  promptsuggestions: "Prompt suggestions",
@@ -167,8 +167,26 @@ const k = {
167
167
  thumbsdown: "Thumbs down",
168
168
  refine: "Refine",
169
169
  startover: "Start over",
170
- helptopic: "help topic"
171
- }, oe = "arcade_generation", re = "ArcadeCodeRequest", ne = "visualization", le = "ArcadeAssistant", de = [
170
+ helptopic: "help topic",
171
+ agreement: "I agree to the {EsriPrivacyStatement} (and {Supplement}).",
172
+ esriprivacystatement: "Esri Privacy Statement",
173
+ supplement: "Supplement",
174
+ disclaimerpt2: "AI-generated content may be inaccurate. Review before using.",
175
+ replaceineditor: "Replace in editor",
176
+ keepinmind: "Keep in mind the following:",
177
+ beconsise: "Be concise, but also clear in your request",
178
+ avoidambiguity: "Avoid ambiguity and vagueness",
179
+ documentation: "documentation",
180
+ useexamples: "Use examples to clarify your request",
181
+ moredetails: "You do not need to use exact field names in your instructions, but more detail is generally better",
182
+ seedocumentation: "Please see the {documentation} for more information, including limitations and additional resources.",
183
+ assistantinformation: "Assistant information",
184
+ profilecontextlabel: "Profile context: {profileName}",
185
+ layercontextlabel: "Layer context: {layerName}",
186
+ numlayers: "{numLayers} {layerOrLayers}",
187
+ numlayersplural: "layers",
188
+ numlayerssingular: "layer"
189
+ }, de = "arcade_generation", pe = "ArcadeCodeRequest", A = "visualization", ue = "ArcadeAssistant", he = [
172
190
  "your_comments",
173
191
  "user_evaluation",
174
192
  "question",
@@ -179,33 +197,42 @@ const k = {
179
197
  "context",
180
198
  "extras"
181
199
  ];
182
- let E = [], I = !0;
183
- class pe extends V {
200
+ let P = [], q = !0;
201
+ class me extends _ {
184
202
  constructor() {
185
- super(...arguments), this.textAreaRef = D(), this.messages = z(), this._feedbackService = void 0, this.handleFeedbackButton = (e, t) => {
186
- this.feedback.active && this.feedback.value === e ? this.feedback = { active: !1, value: void 0, text: "", item: void 0 } : this.feedback = { ...this.feedback, active: !0, value: e, item: t };
203
+ super(...arguments), this.textAreaRef = V(), this.messages = B(), this._feedbackService = void 0, this.handleFeedbackButton = (e, t) => {
204
+ this.feedback = { ...this.feedback, active: !0, value: e, item: t };
187
205
  }, this.handleFeedbackSheetClose = () => {
188
- this.feedback = { active: !1, value: void 0, text: "", item: void 0 };
206
+ this.feedback = {
207
+ active: !1,
208
+ value: void 0,
209
+ text: "",
210
+ item: void 0,
211
+ submitting: !1,
212
+ termsAccepted: !1
213
+ };
189
214
  }, this.handleFeedbackSubmit = async () => {
215
+ this.feedback = { ...this.feedback, submitting: !0 };
190
216
  const e = await this.ensureFeedbackService();
191
217
  if (!e) {
192
218
  this.handleFeedbackSheetClose();
193
219
  return;
194
220
  }
195
- const t = this.getModel(), a = t ? await this.getProfileAndMetadata(t.uri) : void 0, c = {
221
+ const t = this.getModel(), a = t ? await this.getProfileAndMetadata(t.uri) : void 0, s = {
196
222
  user_evaluation: this.feedback.value,
197
223
  your_comments: this.feedback.text || void 0,
198
224
  question: this.question,
199
225
  answer: this.feedback.item?.script ?? "",
200
226
  useragent: navigator.userAgent,
201
- _source: le,
227
+ _source: ue,
202
228
  version: this.appVersion ?? "",
203
229
  context: a ? JSON.stringify(a) : "",
204
230
  extras: a?.profileName ?? "",
205
- conversation_id: this.feedback.item?.conversationId ?? ""
231
+ conversation_id: this.feedback.item?.conversationId ?? "",
232
+ privacy_statement: this.feedback.termsAccepted ? "I_agree" : ""
206
233
  };
207
234
  try {
208
- await e.applyEdits({ addFeatures: [new G({ attributes: c })] });
235
+ await e.applyEdits({ addFeatures: [new Q({ attributes: s })] });
209
236
  } catch (o) {
210
237
  console.error("Error submitting feedback:", o);
211
238
  }
@@ -216,21 +243,41 @@ class pe extends V {
216
243
  this.question = e;
217
244
  }, this.onSuggestionClick = (e) => {
218
245
  this.textAreaRef.value && (this.textAreaRef.value.value = e, this.textAreaRef.value.setFocus(), this.setQuestion(e));
219
- }, this.isViewingResult = !1, this.confirmationActive = !1, this.isSubmitting = !1, this.errorMessage = void 0, this.question = "", this.history = [], this.feedback = { active: !1, value: void 0, text: "", item: void 0 }, this.copySucessIndex = -1, this.splashActive = !0, this.assistantsEnabled = !1, this.closed = !1;
246
+ }, this.isViewingResult = !1, this.confirmationActive = !1, this.isSubmitting = !1, this.errorMessage = void 0, this.question = "", this.history = [], this.feedback = {
247
+ active: !1,
248
+ value: void 0,
249
+ text: "",
250
+ item: void 0,
251
+ termsAccepted: !1,
252
+ submitting: !1
253
+ }, this.copySuccessIndex = -1, this.splashActive = !0, this.editorInsertMode = "add", this.helpBase = "", this.assistantsEnabled = !1, this.closed = !1;
220
254
  }
221
255
  static {
222
- this.properties = { isViewingResult: 16, confirmationActive: 16, isSubmitting: 16, errorMessage: 16, question: 16, history: 16, feedback: 16, copySucessIndex: 16, splashActive: 16, closePanel: 0, insertText: 0, assistantsEnabled: 5, layer: [1, { type: Object }], orgBaseUrl: 1, serviceUrl: 1, closed: 7, editorRef: 0, feedbackServiceUrl: 1, appVersion: 1 };
256
+ this.properties = { isViewingResult: 16, confirmationActive: 16, isSubmitting: 16, errorMessage: 16, question: 16, history: 16, feedback: 16, copySuccessIndex: 16, splashActive: 16, editorInsertMode: 16, closePanel: 0, insertText: 0, helpBase: 1, assistantsEnabled: 5, layer: [1, { type: Object }], orgBaseUrl: 1, serviceUrl: 1, closed: 7, editorRef: 0, feedbackServiceUrl: 1, appVersion: 1 };
223
257
  }
224
258
  static {
225
- this.styles = Q;
259
+ this.styles = J;
260
+ }
261
+ get disclaimerComment() {
262
+ return `// ${this.messages.disclaimercomment}
263
+ // ${u.disclaimerpt2}`;
264
+ }
265
+ get assistantHelpUrl() {
266
+ return `${this.helpBase ?? "https://doc.arcgis.com/en/arcgis-online/"}administer/configure-assistants.htm`;
267
+ }
268
+ get helpTopicUrl() {
269
+ return `${this.helpBase ?? "https://doc.arcgis.com/en/arcgis-online/"}create-maps/arcade-assistant.htm`;
226
270
  }
227
271
  async destroy() {
228
272
  }
229
273
  connectedCallback() {
230
- super.connectedCallback(), this.history = E, this.splashActive = I;
274
+ super.connectedCallback(), this.history = P, this.splashActive = q;
231
275
  }
232
276
  disconnectedCallback() {
233
- super.disconnectedCallback(), E = this.history, I = this.splashActive;
277
+ super.disconnectedCallback(), P = this.history, q = this.splashActive, this.copySuccessTimer && (clearTimeout(this.copySuccessTimer), this.copySuccessTimer = void 0);
278
+ }
279
+ setFeedbackState(e) {
280
+ this.feedback = e;
234
281
  }
235
282
  async ensureFeedbackService() {
236
283
  if (this._feedbackService)
@@ -239,7 +286,7 @@ class pe extends V {
239
286
  return;
240
287
  const e = new W({ url: this.feedbackServiceUrl });
241
288
  await e.load();
242
- const t = de.filter((a) => !e.fields.some((c) => c.name === a));
289
+ const t = he.filter((a) => !e.fields.some((s) => s.name === a));
243
290
  if (t.length > 0) {
244
291
  console.error(`Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);
245
292
  return;
@@ -256,27 +303,29 @@ class pe extends V {
256
303
  const e = await this.getToken(), t = this.getModel();
257
304
  if (!t)
258
305
  return;
259
- const { profileName: a, metadata: c } = await this.getProfileAndMetadata(t.uri), r = (await J({
306
+ const { profileName: a, metadata: s, layerName: o } = await this.getProfileAndMetadata(t.uri), r = (await Y({
260
307
  baseUrl: this.serviceUrl,
261
- skillId: oe,
308
+ skillId: de,
262
309
  message: this.question,
263
310
  authToken: e,
264
311
  context: {
265
- kind: re,
312
+ kind: pe,
266
313
  context: {
267
314
  profile_name: a,
268
- metadata: c
315
+ metadata: s
269
316
  }
270
317
  }
271
- })).find((s) => s.context?.kind === "ArcadeCodeResponse");
318
+ })).find((n) => n.context?.kind === "ArcadeCodeResponse");
272
319
  if (!r)
273
320
  return;
274
321
  r.context?.kind === "ArcadeCodeResponse" && (this.history.unshift({
275
322
  script: r?.context?.arcadeCode?.code,
323
+ formattedScript: L(r?.context?.arcadeCode?.code ?? ""),
276
324
  error: void 0,
277
325
  question: this.question,
278
326
  profile: a,
279
- conversationId: r.conversationId
327
+ conversationId: r.conversationId,
328
+ layerName: o ?? void 0
280
329
  }), this.isViewingResult = !0, this.errorMessage = void 0);
281
330
  } catch (e) {
282
331
  typeof e == "object" && e && "arcadeAssistantError" in e ? this.errorMessage = e.arcadeAssistantError.message || this.messages.erroroccurred || "An error occurred." : e instanceof Error ? this.errorMessage = this.messages.erroroccurred ?? "An error occurred." : this.errorMessage = this.messages.erroroccurred || "An error occurred.", console.error("Error in Arcade Assistant:", e);
@@ -286,57 +335,69 @@ class pe extends V {
286
335
  }
287
336
  }
288
337
  async getToken() {
289
- const { token: e } = await j.getCredential(this.orgBaseUrl);
338
+ const { token: e } = await D.getCredential(this.orgBaseUrl);
290
339
  return e;
291
340
  }
292
341
  async getProfileAndMetadata(e) {
293
- let t = ne;
294
- const a = O.getEditorProfileForModel(e);
342
+ let t = A;
343
+ const a = z.getEditorProfileForModel(e);
295
344
  a?.loaded || await a?.loadSource();
296
- const c = this.editorRef.profile;
297
- c && "id" in c && (t = c.id);
298
- const o = a?.definition?.variables?.find((s) => s.type === "feature");
299
- let r = [];
300
- return o?.definition && "fields" in o.definition && (r = o.definition.fields.map((s) => ({
301
- name: s.name,
302
- type: s.type,
303
- alias: s.alias
304
- }))), { profileName: t, metadata: r };
345
+ const s = this.editorRef.profile;
346
+ s && "id" in s && (t = s.id);
347
+ const o = a?.definition?.variables?.find((n) => n.type === "feature");
348
+ let l = [], r;
349
+ return o?.definition && "fields" in o.definition && (l = o.definition.fields.map((n) => ({
350
+ name: n.name,
351
+ type: n.type,
352
+ alias: n.alias
353
+ })), G(o?.definition) && (r = o.definition.title)), { profileName: t, metadata: l, layerName: r };
305
354
  }
306
355
  render() {
307
- return this.closed ? null : this.assistantsEnabled ? n`<calcite-flow><calcite-flow-item .selected=${!this.isViewingResult} closable .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${K({ messages: this.messages })}${X({ popoverContent: C({ assistantsEnabled: this.assistantsEnabled, messages: this.messages }) })}<calcite-shell class="unstyled-shell">${this.splashActive && ae({ messages: { ...k, ...this.messages }, onProceed: () => {
356
+ return this.closed ? null : this.assistantsEnabled ? c`<calcite-flow><calcite-flow-item .selected=${!this.isViewingResult} closable .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.splashActive && c`<calcite-scrim></calcite-scrim>` || ""}${Z({ messages: this.messages })}${ee({ popoverContent: M({ assistantsEnabled: this.assistantsEnabled, messages: { ...this.messages, ...u }, assistantHelpUrl: this.assistantHelpUrl, helpTopicUrl: this.helpTopicUrl }) })}<calcite-shell class="unstyled-shell">${this.splashActive && re({ messages: { ...u, ...this.messages }, onProceed: () => {
308
357
  this.splashActive = !1;
309
- }, onExit: (e) => this.closePanel && this.closePanel(e) }) || ""}${ee({ active: this.confirmationActive, setActive: (e) => this.confirmationActive = e, messages: this.messages })}${te({ isDisabled: this.isSubmitting, isReadOnly: !1, setQuestion: this.setQuestion, setIsViewingResult: (e) => this.isViewingResult = e, mode: this.isViewingResult ? "refine" : "prompt", textAreaRef: this.textAreaRef, question: this.question, errorMessage: this.errorMessage, setErrorMessage: (e) => this.errorMessage = e, submitQuestion: this.submitQuestion.bind(this), messages: { ...k, ...this.messages } })}<calcite-block-group label="interactive blocks">${!this.isViewingResult && !this.isSubmitting && se({ messages: { ...this.messages, ...k }, suggestions: ["Round value to one decimal place", 'Return "Yes" if value > 10'], onSuggestionClick: this.onSuggestionClick }) || ""}<calcite-block .hidden=${!this.isSubmitting} .heading=${this.messages.generatingresponse ?? "Generating response..."}></calcite-block>${ce({ expanded: this.isViewingResult || this.history.length > 0, messages: { ...this.messages, ...k }, collapsible: !0, showEffectsIcon: this.isViewingResult, cards: this.history.reduce((e, t, a) => (!t.script || this.isViewingResult && a > 0 || (e.push({
358
+ }, helpTopicUrl: this.helpTopicUrl, onExit: (e) => this.closePanel && this.closePanel(e) }) || ""}${ie({ active: this.confirmationActive, setActive: (e) => this.confirmationActive = e, messages: this.messages })}${ae({ isDisabled: this.isSubmitting, isReadOnly: !1, setQuestion: this.setQuestion, setIsViewingResult: (e) => this.isViewingResult = e, mode: this.isViewingResult ? "refine" : "prompt", textAreaRef: this.textAreaRef, question: this.question, errorMessage: this.errorMessage, setErrorMessage: (e) => this.errorMessage = e, submitQuestion: this.submitQuestion.bind(this), messages: { ...u, ...this.messages } })}<calcite-block-group label="interactive blocks">${!this.isViewingResult && !this.isSubmitting && ne({ messages: { ...this.messages, ...u }, suggestions: ["Round value to one decimal place", 'Return "Yes" if value > 10'], onSuggestionClick: this.onSuggestionClick }) || ""}<calcite-block .hidden=${!this.isSubmitting} .heading=${this.messages.generatingresponse ?? "Generating response..."}></calcite-block>${le({ expanded: this.isViewingResult || this.history.length > 0, messages: { ...this.messages, ...u }, collapsible: !0, showEffectsIcon: this.isViewingResult, editorInsertMode: this.editorInsertMode, setEditorInsertMode: (e) => this.editorInsertMode = e, cards: this.history.reduce((e, t, a) => (!t.script || this.isViewingResult && a > 0 || (e.push({
310
359
  priorPrompt: t.question,
311
- code: N(t.script ?? "") || t.error || "",
360
+ code: t.formattedScript || t.error || "",
312
361
  chips: [
313
362
  // TODO implement profile and layer chips
314
- // {
315
- // label: item.profile ?? defaultProfile,
316
- // icon: "map-information",
317
- // appearance: "outline",
318
- // scale: "s",
319
- // },
320
- // { label: "1 layer", icon: "layer", appearance: "outline", scale: "s" },
363
+ {
364
+ label: t.profile ?? A,
365
+ icon: "map-information",
366
+ appearance: "outline",
367
+ scale: "s",
368
+ conversationId: t.conversationId ?? "",
369
+ tooltip: u.profilecontextlabel.replace("{profileName}", t.profile ?? A)
370
+ },
371
+ ...t.layerName ? [
372
+ {
373
+ label: u.numlayers.replace("{numLayers}", "1").replace("{layerOrLayers}", u.numlayerssingular),
374
+ icon: "layer",
375
+ appearance: "outline",
376
+ scale: "s",
377
+ conversationId: t.conversationId ?? "",
378
+ tooltip: u.layercontextlabel.replace("{layerName}", t.layerName ?? "No layer")
379
+ }
380
+ ] : []
321
381
  ],
322
382
  onAddToEditor: () => {
323
- B(this.editorRef.editorInstance, t.script ?? "", this.messages.disclaimercomment ?? "Expression generated by ArcGIS Arcade Assistant (beta)");
383
+ O(this.editorRef.editorInstance, t.formattedScript ?? "", this.editorInsertMode, this.disclaimerComment);
324
384
  },
325
- onCopy: (c) => {
326
- const o = t.script ?? "";
385
+ onCopy: (s) => {
386
+ const o = t.formattedScript ? `${this.disclaimerComment}
387
+ ${t.formattedScript}` : "";
327
388
  o && navigator.clipboard.writeText(o).then(() => {
328
- this.copySucessIndex = c, setTimeout(() => {
329
- this.copySucessIndex = -1;
389
+ this.copySuccessIndex = s, this.copySuccessTimer && clearTimeout(this.copySuccessTimer), this.copySuccessTimer = window.setTimeout(() => {
390
+ this.copySuccessIndex = -1, this.copySuccessTimer = void 0;
330
391
  }, 1500);
331
392
  });
332
393
  },
333
394
  onThumbsUp: () => this.handleFeedbackButton("good", t),
334
395
  onThumbsDown: () => this.handleFeedbackButton("bad", t),
335
- copySuccessIndex: this.copySucessIndex
336
- }), this.isViewingResult), e), []), heading: this.isViewingResult ? this.messages.besteffort ?? "Here's the assistant's best effort" : this.messages.recentprompts ?? "Recent prompts", hidden: this.isViewingResult ? !this.isViewingResult : !1 })}</calcite-block-group><span class="result-disclaimer">${this.messages.reviewcodedisclaimer ?? "Review AI-generated code for accuracy, coherence, and relevance before using it."}</span>${this.feedback.active ? ie({ open: this.feedback.active, setOpen: this.handleFeedbackSheetClose, messages: this.messages, feedbackValue: this.feedback.value ?? "good", setFeedbackValue: (e) => this.feedback = { ...this.feedback, value: e }, feedbackText: this.feedback.text ?? "", setFeedbackText: (e) => this.feedback = { ...this.feedback, text: e }, onSubmit: this.handleFeedbackSubmit }) : null}</calcite-shell></calcite-flow-item></calcite-flow>` : n`<calcite-flow><calcite-flow-item .selected=${!this.isViewingResult} closable .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${C({ slot: "content-top", messages: this.messages, assistantsEnabled: this.assistantsEnabled })}</calcite-flow-item></calcite-flow>`;
396
+ copySuccessIndex: this.copySuccessIndex
397
+ }), this.isViewingResult), e), []), heading: this.isViewingResult ? this.messages.besteffort ?? "Here's the assistant's best effort" : this.messages.recentprompts ?? "Recent prompts", hidden: this.isViewingResult ? !this.isViewingResult : !1 })}</calcite-block-group>${this.feedback.active ? ce({ setOpen: this.handleFeedbackSheetClose, messages: { ...this.messages, ...u }, onSubmit: this.handleFeedbackSubmit, feedback: this.feedback, setFeedback: this.setFeedbackState.bind(this) }) : null}</calcite-shell></calcite-flow-item></calcite-flow>` : c`<calcite-flow><calcite-flow-item .selected=${!this.isViewingResult} closable .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${M({ slot: "content-top", messages: { ...this.messages, ...u }, assistantsEnabled: this.assistantsEnabled, assistantHelpUrl: this.assistantHelpUrl, helpTopicUrl: this.helpTopicUrl })}</calcite-flow-item></calcite-flow>`;
337
398
  }
338
399
  }
339
- q("arcgis-arcade-coding-assistant", pe);
400
+ U("arcgis-arcade-coding-assistant", me);
340
401
  export {
341
- pe as ArcgisArcadeCodingAssistant
402
+ me as ArcgisArcadeCodingAssistant
342
403
  };