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

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 +25 -0
  2. package/dist/addons/arcade-coding-assistant/useArcadeAssistant.d.ts +8 -0
  3. package/dist/addons.js +32 -24
  4. package/dist/cdn/{5MJ6OCXW.js → 2MBS54CP.js} +2 -2
  5. package/dist/cdn/{DTQI2YNL.js → 2OY2OOHB.js} +2 -2
  6. package/dist/cdn/{HZ736LSE.js → 3D4I7ZIH.js} +2 -2
  7. package/dist/cdn/4DWQHJO3.js +4 -0
  8. package/dist/cdn/{ETGXYFDH.js → 4FGPQQ2A.js} +2 -2
  9. package/dist/cdn/{GEPPK2KM.js → 4I55HTRW.js} +2 -2
  10. package/dist/cdn/{SV2I7E4T.js → 4RVJX5WW.js} +2 -2
  11. package/dist/cdn/{K772MGDL.js → 7BH6A67O.js} +1 -1
  12. package/dist/cdn/{4KPG4EZR.js → 7OW3V2VS.js} +2 -2
  13. package/dist/cdn/{ZY3GSTCF.js → AD6BSLAM.js} +1 -1
  14. package/dist/cdn/{EPRGELI2.js → AMWSSI6Z.js} +2 -2
  15. package/dist/cdn/{63BBC3VB.js → APPIAUW3.js} +2 -2
  16. package/dist/cdn/AWIFVV3B.js +4 -0
  17. package/dist/cdn/{HYB234PM.js → AXYFA76H.js} +2 -2
  18. package/dist/cdn/{IMTR2WF4.js → CK4ZO3NV.js} +2 -2
  19. package/dist/cdn/{COFAYLCM.js → D2XTCFJF.js} +4 -4
  20. package/dist/cdn/{MJ6BGN2Z.js → D6HEWBPW.js} +1 -1
  21. package/dist/cdn/{OYQNFJYV.js → DES4FCYE.js} +2 -2
  22. package/dist/cdn/{B6WGMTJM.js → FT3O4I6P.js} +2 -2
  23. package/dist/cdn/{HQCDMOT4.js → GCKT6QGO.js} +2 -2
  24. package/dist/cdn/{HW3L5Z2O.js → GSBW6FVS.js} +1 -1
  25. package/dist/cdn/{DPUOX5U2.js → HXOGCC2Y.js} +2 -2
  26. package/dist/cdn/{B675FOE5.js → JUPBFVGO.js} +2 -2
  27. package/dist/cdn/{LDNGUQKH.js → JZ3AKIKL.js} +2 -2
  28. package/dist/cdn/{3VTVCVWK.js → LFWH37K6.js} +2 -2
  29. package/dist/cdn/{EQ263JIA.js → MHHNM6IR.js} +2 -2
  30. package/dist/cdn/{35MNEKXS.js → MWPPYTAZ.js} +2 -2
  31. package/dist/cdn/{PHSJYUKP.js → N3TJ3VAW.js} +2 -2
  32. package/dist/cdn/{EBAB6Z7D.js → OO6NPCQP.js} +2 -2
  33. package/dist/cdn/{DYVV7BMI.js → P7WXJALE.js} +2 -2
  34. package/dist/cdn/{H3AOOCUQ.js → PML43ZG4.js} +2 -2
  35. package/dist/cdn/{SJCBFNAF.js → RK2DRTIK.js} +2 -2
  36. package/dist/cdn/{LVTZL6CJ.js → RUQSKYNM.js} +2 -2
  37. package/dist/cdn/{66HHSXAC.js → S22HBPCN.js} +2 -2
  38. package/dist/cdn/{FECUZT65.js → T6QGH7YS.js} +2 -2
  39. package/dist/cdn/{ZP7HITSD.js → T7TBIZIA.js} +2 -2
  40. package/dist/cdn/UPGWCEYX.js +4 -0
  41. package/dist/cdn/{53T47RFW.js → V4Y6OY32.js} +1 -1
  42. package/dist/cdn/{JVRARS6T.js → W7IU44PK.js} +2 -2
  43. package/dist/cdn/{AJEAVY5R.js → WQI5U62H.js} +2 -2
  44. package/dist/cdn/{BR6G5324.js → ZM4PE572.js} +2 -2
  45. package/dist/cdn/assets/code-editor/sql-expr.worker.js +58147 -57403
  46. package/dist/cdn/index.js +2 -2
  47. package/dist/chunks/arcade-defaults.js +1 -1
  48. package/dist/chunks/arcade-executor.js +1 -1
  49. package/dist/chunks/arcade-mode.js +1 -1
  50. package/dist/chunks/arcade-service-accessors.js +1 -1
  51. package/dist/chunks/editor.js +1 -1
  52. package/dist/chunks/fields.js +1 -1
  53. package/dist/chunks/language-defaults-base.js +1 -1
  54. package/dist/chunks/markdown.js +1 -1
  55. package/dist/chunks/monaco-importer.js +1 -1
  56. package/dist/chunks/runtime.js +1 -1
  57. package/dist/chunks/setup-monaco.js +1 -1
  58. package/dist/chunks/sql-expr-contribution.js +1 -1
  59. package/dist/chunks/sql-expr-defaults.js +1 -1
  60. package/dist/chunks/sql-expr-mode.js +1 -1
  61. package/dist/chunks/useT9n.js +1 -1
  62. package/dist/components/arcgis-arcade-coding-assistant/customElement.d.ts +2 -0
  63. package/dist/components/arcgis-arcade-coding-assistant/customElement.js +212 -156
  64. package/dist/components/arcgis-arcade-coding-assistant/functional.d.ts +46 -4
  65. package/dist/components/arcgis-arcade-coding-assistant/index.d.ts +10 -5
  66. package/dist/components/arcgis-arcade-coding-assistant/index.js +10 -5
  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 +5 -5
  76. package/dist/docs/docs.json +5 -5
  77. package/dist/docs/web-types.json +1 -1
  78. package/dist/index.js +1 -1
  79. package/dist/loader.js +1 -1
  80. package/package.json +5 -5
  81. package/dist/cdn/LWNFDMZO.js +0 -4
  82. package/dist/cdn/R4LX2QTT.js +0 -5
@@ -1,136 +1,174 @@
1
- import { c as V } from "../../chunks/runtime.js";
1
+ import { c as q } from "../../chunks/runtime.js";
2
2
  import { html as n } from "lit-html";
3
- import { LitElement as T, safeClassMap as F } from "@arcgis/lumina";
4
- import { ref as I, createRef as D } from "lit/directives/ref.js";
5
- import P from "@arcgis/core/identity/IdentityManager.js";
6
- import { u as j } from "../../chunks/useT9n.js";
7
- import { b as N } from "../../chunks/arcade-defaults.js";
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
8
  import { css as U } from "@lit/reactive-element/css-tag.js";
9
9
  import "lit";
10
- import $ from "@arcgis/core/request.js";
11
- import { a as A, e as R } from "../../chunks/monaco-importer.js";
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";
12
13
  import "@arcgis/components-utils";
13
- import _ from "@arcgis/core/layers/FeatureLayer.js";
14
- import z from "@arcgis/core/Graphic.js";
15
- import { unsafeHTML as H } from "lit/directives/unsafe-html.js";
14
+ import { unsafeHTML as y } from "lit/directives/unsafe-html.js";
15
+ import W from "@arcgis/core/layers/FeatureLayer.js";
16
+ import G from "@arcgis/core/Graphic.js";
16
17
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
17
18
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
18
- v4.34.0-next.2 */
19
- const O = 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)}:host([closed]){display:none}.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:4px;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:4px 4px 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:2rem auto .25rem;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)}`;
20
- function S(i) {
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) {
21
22
  if (!i)
22
23
  return;
23
24
  const e = i.indexOf('{"error":');
24
25
  if (e !== -1)
25
26
  try {
26
- const t = i.slice(e), s = JSON.parse(t);
27
- if (s && typeof s == "object" && s.error)
28
- return s.error;
27
+ const t = i.slice(e), a = JSON.parse(t);
28
+ if (a && typeof a == "object" && a.error)
29
+ return a.error;
29
30
  } catch {
30
31
  return;
31
32
  }
32
33
  }
33
- async function Q(i) {
34
- const { baseUrl: e, skillId: t, message: s, authToken: o, previousConversationId: c, context: r } = i, a = t ? `${e}/skills/${t}/chat` : `${e}/chat`, l = [], d = {
35
- message: s,
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 = {
36
+ message: a,
36
37
  context: r
37
38
  };
38
- c && (d.conversation_id = c);
39
- let f;
39
+ o && (l.conversation_id = o);
40
+ let m;
40
41
  try {
41
- f = await $(a, {
42
+ m = await S(s, {
42
43
  method: "post",
43
44
  headers: {
44
45
  "Content-Type": "application/json",
45
- token: o
46
+ token: c
46
47
  },
47
- body: JSON.stringify(d),
48
+ body: JSON.stringify(l),
48
49
  responseType: "json"
49
50
  });
50
- } catch (h) {
51
- const b = h?.details?.rawResponse || h?.message || String(h), k = S(b), g = new Error(
52
- `Failed to send message: ${s}. Response: ${b}`
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}`
53
54
  );
54
- throw k && (g.arcadeAssistantError = k), g;
55
+ throw v && (g.arcadeAssistantError = v), g;
55
56
  }
56
- const m = f.data;
57
- if (!m.hasMore)
57
+ const p = m.data;
58
+ if (!p.hasMore)
58
59
  throw new Error("Expected hasMore to be true");
59
- l.push(m);
60
- const E = m.conversationId, M = m.inquiryId;
61
- let y = m.sequenceNumber;
62
- async function q() {
63
- let h = 0;
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;
64
65
  const b = 25;
65
- for (; h < b; ) {
66
- await new Promise((u) => setTimeout(u, 1e3));
67
- const k = B(E, y, M);
66
+ for (; f < b; ) {
67
+ await new Promise((h) => setTimeout(h, 1e3));
68
+ const v = L(T, w, M);
68
69
  let g;
69
70
  try {
70
- g = await $(a, {
71
+ g = await S(s, {
71
72
  method: "post",
72
73
  headers: {
73
74
  "Content-Type": "application/json",
74
- token: o
75
+ token: c
75
76
  },
76
- body: JSON.stringify(k),
77
+ body: JSON.stringify(v),
77
78
  responseType: "json"
78
79
  });
79
- } catch (u) {
80
- const v = u?.details?.rawResponse || u?.message || String(u), x = S(v), w = new Error(
81
- `Polling failed. Response: ${v}`
80
+ } catch (h) {
81
+ const x = h?.details?.rawResponse || h?.message || String(h), $ = R(x), A = new Error(
82
+ `Polling failed. Response: ${x}`
82
83
  );
83
- throw x && (w.arcadeAssistantError = x), w;
84
+ throw $ && (A.arcadeAssistantError = $), A;
84
85
  }
85
- const p = g.data;
86
- if (p.context && p.context.kind === "ArcgisErrorAsContext" && p.context.error)
87
- throw new Error(
88
- p.context.error.message || "ArcGIS Assistant error"
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"
89
90
  );
90
- if (l.push(p), y = p.sequenceNumber, h++, !p.hasMore)
91
+ throw h.arcadeAssistantError = { message: u.context.error.message ?? "ArcGIS Assistant error" }, h;
92
+ }
93
+ if (d.push(u), w = u.sequenceNumber, f++, !u.hasMore)
91
94
  break;
92
95
  }
93
- if (h === b)
96
+ if (f === b)
94
97
  throw new Error("Request timed out");
95
98
  }
96
- return await q(), l;
99
+ return await F(), d;
97
100
  }
98
- function B(i, e, t) {
101
+ function L(i, e, t) {
99
102
  return {
100
103
  conversationId: i,
101
104
  inquiryId: t,
102
105
  ackSequenceNumber: e
103
106
  };
104
107
  }
105
- const L = (i) => {
106
- const e = i.value.length, t = 72, s = 180, o = i.offsetWidth, r = Math.max(1, Math.floor(o / 8)), a = Math.ceil(e / r), l = t + (a - 2) * 24;
107
- i.style.setProperty("--calcite-text-area-min-height", `${Math.min(l, s)}px`);
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`);
108
111
  };
109
- function W({ messages: i }) {
112
+ function K({ messages: i }) {
110
113
  return n`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${i.beta ?? "Beta"}>${i.beta ?? "Beta"}</calcite-chip>`;
111
114
  }
112
- function G({ messages: i }) {
113
- return n`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-tooltip reference-element=legal-disclaimer>${i.legaldisclaimer}</calcite-tooltip>`;
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>`;
114
117
  }
115
- function J({ errorMessage: i }) {
118
+ function Z({ errorMessage: i }) {
116
119
  return n`<calcite-input-message id=error-message status=invalid slot=footer-start icon=exclamation-mark-triangle scale=m>${i}</calcite-input-message>`;
117
120
  }
118
- function Y({ active: i, setActive: e, messages: t }) {
121
+ function ee({ active: i, setActive: e, messages: t }) {
119
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>`;
120
123
  }
121
- function K({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult: s, textAreaRef: o, question: c, errorMessage: r, setErrorMessage: a, submitQuestion: l, messages: d }) {
122
- return n`<div class="text-area-wrapper"><calcite-text-area resize=none .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=${c} @calciteTextAreaInput=${(f) => {
123
- L(f.target), t(f.target.value);
124
- }} ${I(o)}>${r && J({ errorMessage: r }) || ""}</calcite-text-area><div class="response-actions">${e ? n`<calcite-button round appearance=outline-fill icon-start=speech-bubble-plus @click=${() => {
125
- t(""), s(!1);
126
- }}>${d.askagain || "Ask again"}</calcite-button>` : n`<calcite-button alignment=end round icon-end=effects appearance=solid .loading=${i} .disabled=${i} @click=${async () => {
127
- a(c ? "" : d.enteraprompt ?? "Please enter a prompt"), await l();
128
- }}>${d.ask || "Ask"}</calcite-button>`}</div></div>`;
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 () => {
128
+ 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>`;
132
+ }
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>`;
135
+ }
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>`;
138
+ }
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>`;
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>`;
129
148
  }
130
- function X({ open: i, setOpen: e, messages: t, feedbackValue: s, setFeedbackValue: o, feedbackText: c, setFeedbackText: r, onSubmit: a }) {
131
- 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=${s === "good"} @click=${() => o("good")}></calcite-segmented-control-item><calcite-segmented-control-item icon-start=thumbs-down .checked=${s === "bad"} @click=${() => o("bad")}></calcite-segmented-control-item></calcite-segmented-control></calcite-label><calcite-label>${t.describeexperience ?? "Describe your experience"}<calcite-text-area resize=vertical .value=${c} @calciteTextAreaInput=${(l) => r(l.target.value)}></calcite-text-area></calcite-label></div><calcite-button slot=footer width=full @click=${a}>${t.submitfeedback ?? "Submit Feedback"}</calcite-button></calcite-panel></calcite-sheet>`;
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>`;
132
151
  }
133
- const Z = "arcade_generation", ee = "ArcadeCodeRequest", te = "visualization", ie = "ArcadeAssistant", se = [
152
+ const k = {
153
+ welcome: "Welcome to the new assistant experience",
154
+ beforeyougetstarted: "Before you get started be aware:",
155
+ 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",
160
+ proceed: "Proceed",
161
+ exit: "Exit",
162
+ promptsuggestions: "Prompt suggestions",
163
+ promptsuggestion: "Prompt suggestion",
164
+ assistantresponses: "Assistant responses",
165
+ collapse: "Collapse",
166
+ thumbsup: "Thumbs up",
167
+ thumbsdown: "Thumbs down",
168
+ refine: "Refine",
169
+ startover: "Start over",
170
+ helptopic: "help topic"
171
+ }, oe = "arcade_generation", re = "ArcadeCodeRequest", ne = "visualization", le = "ArcadeAssistant", de = [
134
172
  "your_comments",
135
173
  "user_evaluation",
136
174
  "question",
@@ -141,146 +179,164 @@ const Z = "arcade_generation", ee = "ArcadeCodeRequest", te = "visualization", i
141
179
  "context",
142
180
  "extras"
143
181
  ];
144
- let C = [];
145
- class ae extends T {
182
+ let E = [], I = !0;
183
+ class pe extends V {
146
184
  constructor() {
147
- super(...arguments), this.textAreaRef = D(), this.messages = j(), this.feedbackService = void 0, this.handleFeedbackButton = (e) => {
148
- this.feedbackValue === e && this.feedbackActive ? (this.feedbackActive = !1, this.feedbackValue = void 0, this.feedbackText = "") : (this.feedbackValue = e, this.feedbackActive = !0);
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 };
149
187
  }, this.handleFeedbackSheetClose = () => {
150
- this.feedbackActive = !1, this.feedbackValue = void 0, this.feedbackText = "";
188
+ this.feedback = { active: !1, value: void 0, text: "", item: void 0 };
151
189
  }, this.handleFeedbackSubmit = async () => {
152
- if (this.feedbackValue) {
153
- if (this.feedbackServiceUrl) {
154
- if (!this.feedbackService) {
155
- const c = new _({
156
- url: this.feedbackServiceUrl
157
- });
158
- await c.load();
159
- const r = c.fields, a = [];
160
- if (se.forEach((l) => {
161
- r.some((d) => d.name === l) || a.push(l);
162
- }), a.length > 0) {
163
- console.error(`Missing the following fields in feedback service: ${a.join(", ")}.
164
- Feedback will not be logged.`), this.handleFeedbackSheetClose();
165
- return;
166
- }
167
- this.feedbackService = c;
168
- }
169
- const e = this.getModel(), t = e ? await this.getProfileAndMetadata(e.uri) : void 0, s = {
170
- user_evaluation: this.feedbackValue,
171
- your_comments: this.feedbackText,
172
- question: this.question,
173
- answer: this.history[0]?.script ?? "",
174
- useragent: navigator.userAgent,
175
- _source: ie,
176
- version: this.appVersion ?? "",
177
- // TODO: this comes from app
178
- context: t ? JSON.stringify(t) : "",
179
- extras: t?.profileName ?? ""
180
- }, o = new z({
181
- attributes: s
182
- });
183
- try {
184
- await this.feedbackService?.applyEdits({
185
- addFeatures: [o]
186
- });
187
- } catch (c) {
188
- console.error("Error submitting feedback:", c);
189
- }
190
- }
190
+ const e = await this.ensureFeedbackService();
191
+ if (!e) {
191
192
  this.handleFeedbackSheetClose();
193
+ return;
192
194
  }
195
+ const t = this.getModel(), a = t ? await this.getProfileAndMetadata(t.uri) : void 0, c = {
196
+ user_evaluation: this.feedback.value,
197
+ your_comments: this.feedback.text || void 0,
198
+ question: this.question,
199
+ answer: this.feedback.item?.script ?? "",
200
+ useragent: navigator.userAgent,
201
+ _source: le,
202
+ version: this.appVersion ?? "",
203
+ context: a ? JSON.stringify(a) : "",
204
+ extras: a?.profileName ?? "",
205
+ conversation_id: this.feedback.item?.conversationId ?? ""
206
+ };
207
+ try {
208
+ await e.applyEdits({ addFeatures: [new G({ attributes: c })] });
209
+ } catch (o) {
210
+ console.error("Error submitting feedback:", o);
211
+ }
212
+ this.handleFeedbackSheetClose();
193
213
  }, this.handleClose = (e) => {
194
214
  this.closed = !0, this.closePanel?.(e);
195
215
  }, this.setQuestion = (e) => {
196
216
  this.question = e;
197
- }, this.isViewingResult = !1, this.confirmationActive = !1, this.isDisabled = !1, this.errorMessage = void 0, this.question = "", this.history = [], this.feedbackActive = !1, this.feedbackValue = void 0, this.feedbackText = "", this.copySuccess = !1, this.assistantsEnabled = !1, this.closed = !1;
217
+ }, this.onSuggestionClick = (e) => {
218
+ 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;
198
220
  }
199
221
  static {
200
- this.properties = { isViewingResult: 16, confirmationActive: 16, isDisabled: 16, errorMessage: 16, question: 16, history: 16, feedbackActive: 16, feedbackValue: 16, feedbackText: 16, copySuccess: 16, closePanel: 0, insertText: 0, assistantsEnabled: 5, layer: [1, { type: Object }], orgBaseUrl: 1, serviceUrl: 1, closed: 7, editorRef: 0, feedbackServiceUrl: 1, appVersion: 1 };
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 };
201
223
  }
202
224
  static {
203
- this.styles = O;
225
+ this.styles = Q;
204
226
  }
205
227
  async destroy() {
206
228
  }
207
229
  connectedCallback() {
208
- super.connectedCallback(), this.history = C;
230
+ super.connectedCallback(), this.history = E, this.splashActive = I;
209
231
  }
210
232
  disconnectedCallback() {
211
- super.disconnectedCallback(), C = this.history;
233
+ super.disconnectedCallback(), E = this.history, I = this.splashActive;
234
+ }
235
+ async ensureFeedbackService() {
236
+ if (this._feedbackService)
237
+ return this._feedbackService;
238
+ if (!this.feedbackServiceUrl)
239
+ return;
240
+ const e = new W({ url: this.feedbackServiceUrl });
241
+ await e.load();
242
+ const t = de.filter((a) => !e.fields.some((c) => c.name === a));
243
+ if (t.length > 0) {
244
+ console.error(`Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);
245
+ return;
246
+ }
247
+ return this._feedbackService = e, e;
212
248
  }
213
249
  getModel() {
214
250
  return this.editorRef.editorInstance?.getModel();
215
251
  }
216
252
  async submitQuestion() {
217
253
  if (this.question) {
218
- this.isDisabled = !0;
254
+ this.isSubmitting = !0;
219
255
  try {
220
256
  const e = await this.getToken(), t = this.getModel();
221
257
  if (!t)
222
258
  return;
223
- const { profileName: s, metadata: o } = await this.getProfileAndMetadata(t.uri), r = (await Q({
259
+ const { profileName: a, metadata: c } = await this.getProfileAndMetadata(t.uri), r = (await J({
224
260
  baseUrl: this.serviceUrl,
225
- skillId: Z,
261
+ skillId: oe,
226
262
  message: this.question,
227
263
  authToken: e,
228
264
  context: {
229
- kind: ee,
265
+ kind: re,
230
266
  context: {
231
- profile_name: s,
232
- metadata: o
267
+ profile_name: a,
268
+ metadata: c
233
269
  }
234
270
  }
235
- })).find((a) => a.context?.kind === "ArcadeCodeResponse");
271
+ })).find((s) => s.context?.kind === "ArcadeCodeResponse");
236
272
  if (!r)
237
273
  return;
238
274
  r.context?.kind === "ArcadeCodeResponse" && (this.history.unshift({
239
275
  script: r?.context?.arcadeCode?.code,
240
276
  error: void 0,
241
- question: this.question
277
+ question: this.question,
278
+ profile: a,
279
+ conversationId: r.conversationId
242
280
  }), this.isViewingResult = !0, this.errorMessage = void 0);
243
281
  } catch (e) {
244
282
  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);
245
283
  } finally {
246
- this.isDisabled = !1;
284
+ this.isSubmitting = !1;
247
285
  }
248
286
  }
249
287
  }
250
288
  async getToken() {
251
- const { token: e } = await P.getCredential(this.orgBaseUrl);
289
+ const { token: e } = await j.getCredential(this.orgBaseUrl);
252
290
  return e;
253
291
  }
254
292
  async getProfileAndMetadata(e) {
255
- let t = te;
256
- const s = N.getEditorProfileForModel(e);
257
- s?.loaded || await s?.loadSource();
258
- const o = this.editorRef.profile;
259
- o && "id" in o && (t = o.id);
260
- const c = s?.definition?.variables?.find((a) => a.type === "feature");
293
+ let t = ne;
294
+ const a = O.getEditorProfileForModel(e);
295
+ 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");
261
299
  let r = [];
262
- return c?.definition && "fields" in c.definition && (r = c.definition.fields.map((a) => ({
263
- name: a.name,
264
- type: a.type,
265
- alias: a.alias
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
266
304
  }))), { profileName: t, metadata: r };
267
305
  }
268
306
  render() {
269
- 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}>${W({ messages: this.messages })}${G({ messages: this.messages })}${Y({ active: this.confirmationActive, setActive: (e) => this.confirmationActive = e, messages: this.messages })}${K({ isDisabled: this.isDisabled, isReadOnly: this.isViewingResult, setQuestion: this.setQuestion, setIsViewingResult: (e) => this.isViewingResult = e, textAreaRef: this.textAreaRef, question: this.question, errorMessage: this.errorMessage, setErrorMessage: (e) => this.errorMessage = e, submitQuestion: this.submitQuestion.bind(this), messages: this.messages })}<calcite-block .hidden=${!this.isDisabled} .heading=${this.messages.generatingresponse ?? "Generating response..."}></calcite-block>${this.isViewingResult && n`<calcite-block class="block-response" icon-start=effects .heading=${this.messages.besteffort ?? "Here's the assistant's best effort"} expanded><calcite-list class="prompt-list" .label=${this.messages.promptlist ?? "Prompt list"}><calcite-list-item expanded class=${F(this.history[0]?.error ? "type-error" : "type-response")} .label=${A(this.history[0]?.script ?? "") || this.history[0]?.error} @calciteListItemSelect=${() => {
270
- R(this.editorRef.editorInstance, this.history[0]?.script ?? "", this.messages.disclaimercomment ?? "Expression generated by ArcGIS Arcade Assistant (beta)"), this.isViewingResult = !1, this.setQuestion("");
271
- }}><code slot=content><pre class="break-spaces">${A(this.history[0]?.script ?? "")}</pre></code></calcite-list-item></calcite-list><div class="response-actions"><calcite-button icon-start=plus round kind=brand @click=${() => {
272
- R(this.editorRef.editorInstance, this.history[0]?.script ?? "", this.messages.disclaimercomment ?? "Expression generated by ArcGIS Arcade Assistant (beta)"), this.isViewingResult = !1, this.setQuestion("");
273
- }}>${this.messages.addtoeditor ?? "Add to editor"}</calcite-button><calcite-button id=copy-to-clipboard icon-start=${this.copySuccess ? "check" : "copy-to-clipboard"} round kind=neutral @click=${async () => {
274
- const e = this.history[0]?.script ?? "";
275
- e && (await navigator.clipboard.writeText(e), this.copySuccess = !0, setTimeout(() => {
276
- this.copySuccess = !1;
277
- }, 1500));
278
- }}>${this.copySuccess ? this.messages.copied ?? "Copied!" : ""}</calcite-button><div class="feedback-button-container" id=feedback-buttons><calcite-button id=thumbs-up icon-start=thumbs-up appearance=transparent @click=${() => this.handleFeedbackButton("good")}></calcite-button><calcite-button id=thumbs-down appearance=transparent icon-start=thumbs-down @click=${() => this.handleFeedbackButton("bad")}></calcite-button><calcite-tooltip reference-element=feedback-buttons>${this.messages.providefeedback ?? "Provide feedback"}</calcite-tooltip></div></div><span class="result-disclaimer">${this.messages.reviewcodedisclaimer ?? "Review AI-generated code for accuracy, coherence, and relevance before using it."}</span></calcite-block>` || ""}<calcite-block .hidden=${this.isViewingResult || this.isDisabled || this.history.length < 1} .disabled=${this.isViewingResult || this.isDisabled || this.history.length < 1} class="no-space-block" collapsible .expanded=${this.history.length > 0} .heading=${this.messages.recentprompts ?? "Recent prompts"}><calcite-list class="prompt-list" .label=${this.messages.historylist ?? "History list"}>${this.history.map((e) => n`<calcite-list-item class="type-history" .label=${e.question} @calciteListItemSelect=${() => {
279
- this.errorMessage = "", this.setQuestion(e.question), this.textAreaRef.value?.setFocus();
280
- }}><calcite-icon icon=recent scale=s slot=content-end></calcite-icon></calcite-list-item>`)}</calcite-list></calcite-block>${this.feedbackActive ? n`<calcite-shell>${X({ open: this.feedbackActive, setOpen: this.handleFeedbackSheetClose, messages: this.messages, feedbackValue: this.feedbackValue ?? "good", setFeedbackValue: (e) => this.feedbackValue = e, feedbackText: this.feedbackText ?? "", setFeedbackText: (e) => this.feedbackText = e, onSubmit: this.handleFeedbackSubmit })}</calcite-shell>` : null}${!this.isViewingResult && n`<span class="result-disclaimer">${this.messages.aigenerated} ${this.messages.seeterms}</span>` || ""}</calcite-flow-item></calcite-flow>` : n`<calcite-flow><calcite-flow-item .selected=${!this.isViewingResult} closable .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}><calcite-block label=info slot=content-top expanded><calcite-chip .label=${this.messages.new ?? "new"} kind=brand>${this.messages.new}</calcite-chip><h1 class="info-heading">${this.messages.introducing}</h1><p>${this.messages.capabilities}</p><p>${H(this.messages.useofassistant?.replace("{aiassistants}", `<strong>${this.messages.aiassistants ?? "Ai Assistants"}</strong>`))}</p></calcite-block></calcite-flow-item></calcite-flow>`;
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: () => {
308
+ 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({
310
+ priorPrompt: t.question,
311
+ code: N(t.script ?? "") || t.error || "",
312
+ chips: [
313
+ // 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" },
321
+ ],
322
+ onAddToEditor: () => {
323
+ B(this.editorRef.editorInstance, t.script ?? "", this.messages.disclaimercomment ?? "Expression generated by ArcGIS Arcade Assistant (beta)");
324
+ },
325
+ onCopy: (c) => {
326
+ const o = t.script ?? "";
327
+ o && navigator.clipboard.writeText(o).then(() => {
328
+ this.copySucessIndex = c, setTimeout(() => {
329
+ this.copySucessIndex = -1;
330
+ }, 1500);
331
+ });
332
+ },
333
+ onThumbsUp: () => this.handleFeedbackButton("good", t),
334
+ 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>`;
281
337
  }
282
338
  }
283
- V("arcgis-arcade-coding-assistant", ae);
339
+ q("arcgis-arcade-coding-assistant", pe);
284
340
  export {
285
- ae as ArcgisArcadeCodingAssistant
341
+ pe as ArcgisArcadeCodingAssistant
286
342
  };
@@ -1,4 +1,5 @@
1
1
  import { JsxNode } from '@arcgis/lumina';
2
+ import { temporaryStrings as TempStrings } from '../../addons/arcade-coding-assistant/temporary-strings.js';
2
3
  import { Ref } from 'lit/directives/ref.js';
3
4
  declare const strings: (value: {
4
5
  arcadeassistant: string;
@@ -90,8 +91,8 @@ declare const strings: (value: {
90
91
  export declare function AboutDisplay({ messages }: {
91
92
  messages: Partial<ReturnType<typeof strings>>;
92
93
  }): JsxNode;
93
- export declare function DisclaimerDisplay({ messages }: {
94
- messages: Partial<ReturnType<typeof strings>>;
94
+ export declare function DisclaimerDisplay({ popoverContent }: {
95
+ popoverContent: JsxNode;
95
96
  }): JsxNode;
96
97
  export declare function ErrorDisplay({ errorMessage }: {
97
98
  errorMessage?: string;
@@ -101,7 +102,7 @@ export declare function ConfirmationDisplay({ active, setActive, messages, }: {
101
102
  setActive: (e: boolean) => void;
102
103
  messages: Partial<ReturnType<typeof strings>>;
103
104
  }): JsxNode;
104
- export declare function SubmissionDisplay({ isDisabled, isReadOnly, setQuestion, setIsViewingResult, textAreaRef, question, errorMessage, setErrorMessage, submitQuestion, messages, }: {
105
+ export declare function SubmissionDisplay({ isDisabled, isReadOnly, setQuestion, setIsViewingResult, textAreaRef, question, errorMessage, setErrorMessage, submitQuestion, messages, mode, }: {
105
106
  isDisabled: boolean;
106
107
  isReadOnly: boolean;
107
108
  setQuestion: (e: string) => void;
@@ -111,7 +112,8 @@ export declare function SubmissionDisplay({ isDisabled, isReadOnly, setQuestion,
111
112
  errorMessage?: string;
112
113
  setErrorMessage: (e: string) => void;
113
114
  submitQuestion: () => Promise<void>;
114
- messages: Partial<ReturnType<typeof strings>>;
115
+ messages: Partial<ReturnType<typeof strings>> & typeof TempStrings;
116
+ mode: "prompt" | "refine";
115
117
  }): JsxNode;
116
118
  export declare function FeedbackSheetDisplay({ open, setOpen, messages, feedbackValue, setFeedbackValue, feedbackText, setFeedbackText, onSubmit, }: {
117
119
  open: boolean;
@@ -123,4 +125,44 @@ export declare function FeedbackSheetDisplay({ open, setOpen, messages, feedback
123
125
  setFeedbackText: (val: string) => void;
124
126
  onSubmit: () => void;
125
127
  }): JsxNode;
128
+ export declare function InfoDisplay({ assistantsEnabled, messages, slot, }: {
129
+ assistantsEnabled: boolean;
130
+ messages: Partial<ReturnType<typeof strings>>;
131
+ slot?: HTMLCalciteBlockElement["slot"];
132
+ }): JsxNode;
133
+ export declare function SplashDisplay({ messages, onProceed, onExit, }: {
134
+ messages: Partial<ReturnType<typeof strings>> & typeof TempStrings;
135
+ onProceed: () => void;
136
+ onExit: (e: Event) => void;
137
+ }): JsxNode;
138
+ export declare function PromptSuggestionsDisplay({ messages, suggestions, onSuggestionClick, }: {
139
+ suggestions: string[];
140
+ onSuggestionClick: (value: string) => void;
141
+ messages: Partial<ReturnType<typeof strings>> & typeof TempStrings;
142
+ }): JsxNode;
143
+ export interface ResponseDisplayCardChip {
144
+ label: string;
145
+ icon?: string;
146
+ scale?: "l" | "m" | "s";
147
+ appearance?: "outline-fill" | "outline" | "solid";
148
+ }
149
+ export interface ResponseDisplayCard {
150
+ priorPrompt: string;
151
+ code: string;
152
+ chips?: ResponseDisplayCardChip[];
153
+ onAddToEditor: () => void;
154
+ onCopy: (index: number) => void;
155
+ onThumbsUp: () => void;
156
+ onThumbsDown: () => void;
157
+ copySuccessIndex?: number;
158
+ }
159
+ export declare function ResponseDisplay({ hidden, expanded, messages, cards, heading, collapsible, showEffectsIcon, }: {
160
+ hidden?: boolean;
161
+ expanded?: boolean;
162
+ heading?: string;
163
+ messages: Partial<ReturnType<typeof strings>> & typeof TempStrings;
164
+ cards: ResponseDisplayCard[];
165
+ showEffectsIcon?: boolean;
166
+ collapsible?: boolean;
167
+ }): JsxNode;
126
168
  export {};