@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,6 +1,7 @@
1
1
  import { JsxNode } from '@arcgis/lumina';
2
2
  import { temporaryStrings as TempStrings } from '../../addons/arcade-coding-assistant/temporary-strings.js';
3
3
  import { Ref } from 'lit/directives/ref.js';
4
+ import { FeedbackState } from './types';
4
5
  declare const strings: (value: {
5
6
  arcadeassistant: string;
6
7
  beta: string;
@@ -115,25 +116,25 @@ export declare function SubmissionDisplay({ isDisabled, isReadOnly, setQuestion,
115
116
  messages: Partial<ReturnType<typeof strings>> & typeof TempStrings;
116
117
  mode: "prompt" | "refine";
117
118
  }): JsxNode;
118
- export declare function FeedbackSheetDisplay({ open, setOpen, messages, feedbackValue, setFeedbackValue, feedbackText, setFeedbackText, onSubmit, }: {
119
- open: boolean;
119
+ export declare function FeedbackSheetDisplay({ setOpen, messages, feedback, setFeedback, onSubmit, }: {
120
120
  setOpen: (open: boolean) => void;
121
- messages: Partial<ReturnType<typeof strings>>;
122
- feedbackValue: "bad" | "good";
123
- setFeedbackValue: (val: "bad" | "good") => void;
124
- feedbackText: string;
125
- setFeedbackText: (val: string) => void;
121
+ messages: Partial<ReturnType<typeof strings>> & typeof TempStrings;
122
+ feedback: FeedbackState;
123
+ setFeedback: (feedback: FeedbackState) => void;
126
124
  onSubmit: () => void;
127
125
  }): JsxNode;
128
- export declare function InfoDisplay({ assistantsEnabled, messages, slot, }: {
126
+ export declare function InfoDisplay({ assistantsEnabled, messages, slot, assistantHelpUrl, helpTopicUrl, }: {
129
127
  assistantsEnabled: boolean;
130
- messages: Partial<ReturnType<typeof strings>>;
128
+ assistantHelpUrl: string;
129
+ helpTopicUrl: string;
130
+ messages: Partial<ReturnType<typeof strings>> & typeof TempStrings;
131
131
  slot?: HTMLCalciteBlockElement["slot"];
132
132
  }): JsxNode;
133
- export declare function SplashDisplay({ messages, onProceed, onExit, }: {
133
+ export declare function SplashDisplay({ messages, onProceed, onExit, helpTopicUrl, }: {
134
134
  messages: Partial<ReturnType<typeof strings>> & typeof TempStrings;
135
135
  onProceed: () => void;
136
136
  onExit: (e: Event) => void;
137
+ helpTopicUrl: string;
137
138
  }): JsxNode;
138
139
  export declare function PromptSuggestionsDisplay({ messages, suggestions, onSuggestionClick, }: {
139
140
  suggestions: string[];
@@ -143,8 +144,11 @@ export declare function PromptSuggestionsDisplay({ messages, suggestions, onSugg
143
144
  export interface ResponseDisplayCardChip {
144
145
  label: string;
145
146
  icon?: string;
147
+ tooltip?: string;
146
148
  scale?: "l" | "m" | "s";
147
149
  appearance?: "outline-fill" | "outline" | "solid";
150
+ /** need a unique id for each convo for tooltip reference-ids */
151
+ conversationId: string;
148
152
  }
149
153
  export interface ResponseDisplayCard {
150
154
  priorPrompt: string;
@@ -156,7 +160,7 @@ export interface ResponseDisplayCard {
156
160
  onThumbsDown: () => void;
157
161
  copySuccessIndex?: number;
158
162
  }
159
- export declare function ResponseDisplay({ hidden, expanded, messages, cards, heading, collapsible, showEffectsIcon, }: {
163
+ export declare function ResponseDisplay({ hidden, expanded, messages, cards, heading, collapsible, showEffectsIcon, editorInsertMode, setEditorInsertMode, }: {
160
164
  hidden?: boolean;
161
165
  expanded?: boolean;
162
166
  heading?: string;
@@ -164,5 +168,7 @@ export declare function ResponseDisplay({ hidden, expanded, messages, cards, hea
164
168
  cards: ResponseDisplayCard[];
165
169
  showEffectsIcon?: boolean;
166
170
  collapsible?: boolean;
171
+ editorInsertMode?: "add" | "replace";
172
+ setEditorInsertMode?: (mode: "add" | "replace") => void;
167
173
  }): JsxNode;
168
174
  export {};
@@ -10,16 +10,19 @@ import "@esri/calcite-components/components/calcite-panel";
10
10
  import "@esri/calcite-components/components/calcite-label";
11
11
  import "@esri/calcite-components/components/calcite-segmented-control";
12
12
  import "@esri/calcite-components/components/calcite-segmented-control-item";
13
+ import "@esri/calcite-components/components/calcite-checkbox";
13
14
  import "@esri/calcite-components/components/calcite-block";
14
15
  import "@esri/calcite-components/components/calcite-link";
15
- import "@esri/calcite-components/components/calcite-scrim";
16
16
  import "@esri/calcite-components/components/calcite-dialog";
17
- import "@esri/calcite-components/components/calcite-notice";
18
17
  import "@esri/calcite-components/components/calcite-chip-group";
19
18
  import "@esri/calcite-components/components/calcite-card-group";
20
19
  import "@esri/calcite-components/components/calcite-card";
20
+ import "@esri/calcite-components/components/calcite-tooltip";
21
+ import "@esri/calcite-components/components/calcite-split-button";
22
+ import "@esri/calcite-components/components/calcite-dropdown-item";
21
23
  import "@esri/calcite-components/components/calcite-flow";
22
24
  import "@esri/calcite-components/components/calcite-flow-item";
25
+ import "@esri/calcite-components/components/calcite-scrim";
23
26
  import "@esri/calcite-components/components/calcite-shell";
24
27
  import "@esri/calcite-components/components/calcite-block-group";
25
28
  export * from "./customElement.js";
@@ -10,16 +10,19 @@ import "@esri/calcite-components/components/calcite-panel";
10
10
  import "@esri/calcite-components/components/calcite-label";
11
11
  import "@esri/calcite-components/components/calcite-segmented-control";
12
12
  import "@esri/calcite-components/components/calcite-segmented-control-item";
13
+ import "@esri/calcite-components/components/calcite-checkbox";
13
14
  import "@esri/calcite-components/components/calcite-block";
14
15
  import "@esri/calcite-components/components/calcite-link";
15
- import "@esri/calcite-components/components/calcite-scrim";
16
16
  import "@esri/calcite-components/components/calcite-dialog";
17
- import "@esri/calcite-components/components/calcite-notice";
18
17
  import "@esri/calcite-components/components/calcite-chip-group";
19
18
  import "@esri/calcite-components/components/calcite-card-group";
20
19
  import "@esri/calcite-components/components/calcite-card";
20
+ import "@esri/calcite-components/components/calcite-tooltip";
21
+ import "@esri/calcite-components/components/calcite-split-button";
22
+ import "@esri/calcite-components/components/calcite-dropdown-item";
21
23
  import "@esri/calcite-components/components/calcite-flow";
22
24
  import "@esri/calcite-components/components/calcite-flow-item";
25
+ import "@esri/calcite-components/components/calcite-scrim";
23
26
  import "@esri/calcite-components/components/calcite-shell";
24
27
  import "@esri/calcite-components/components/calcite-block-group";
25
28
  export * from "./customElement.js";
@@ -0,0 +1,36 @@
1
+ export type Feedback = {
2
+ user_evaluation?: "bad" | "good";
3
+ your_comments?: string;
4
+ question: string;
5
+ answer: string;
6
+ useragent: string;
7
+ _source: string;
8
+ version: string;
9
+ context: string;
10
+ extras: string;
11
+ conversation_id: string;
12
+ privacy_statement: "" | "I_agree";
13
+ };
14
+ export type FeedbackState = {
15
+ /** Whether the feedback form is active */
16
+ active: boolean;
17
+ /** the selected feedback value */
18
+ value?: "bad" | "good";
19
+ /** The feedback description provided by the user */
20
+ text: string;
21
+ /** The history item associated with the feedback */
22
+ item?: HistoryItem;
23
+ /** Whether the user has accepted the privacy terms */
24
+ termsAccepted: boolean;
25
+ /** Whether the feedback is submitting */
26
+ submitting: boolean;
27
+ };
28
+ export type HistoryItem = {
29
+ script?: string;
30
+ error?: string;
31
+ question: string;
32
+ profile?: string;
33
+ conversationId?: string;
34
+ formattedScript?: string;
35
+ layerName?: string;
36
+ };
@@ -16,7 +16,7 @@ import { css as w } from "@lit/reactive-element/css-tag.js";
16
16
  import { s as y } from "../../chunks/editor.js";
17
17
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
18
18
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
19
- v4.34.0-next.21 */
19
+ v4.34.0-next.22 */
20
20
  const D = w`@layer{arcgis-arcade-editor{display:flex;flex-direction:column;position:relative;overflow:hidden;border:var(--arcgis-coding-components-border)!important;box-sizing:border-box;background-color:var(--arcgis-coding-components-background-color);height:100%;.sticky{position:sticky;top:0;z-index:10}.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1);text-align:center}.main-action-bar{border-bottom:var(--arcgis-coding-components-border)!important;flex:0 0 auto;calcite-action-group{padding-inline-end:var(--calcite-spacing-sm);calcite-action{padding-inline-end:var(--calcite-spacing-sm)}calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}calcite-action-group:last-child{border-inline-end-width:0px}calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}arcgis-arcade-results{border-top:var(--arcgis-coding-components-border)!important;box-sizing:border-box;max-height:50%;min-height:50%;margin-bottom:-1px}calcite-flow{[slot=footer]{word-break:break-word}}.hidden{display:none}}}`;
21
21
  class C extends m {
22
22
  constructor() {
@@ -8,7 +8,7 @@ import { css as L } from "@lit/reactive-element/css-tag.js";
8
8
  import { s as O } from "../../chunks/fields.js";
9
9
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
10
10
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
11
- v4.34.0-next.21 */
11
+ v4.34.0-next.22 */
12
12
  const D = L`:host{display:flex;flex-direction:column;width:100%;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);.flex-adjustable{flex:1 1 auto;overflow:hidden}.flex-row{display:flex;flex-direction:row;overflow:hidden}.flex-column{display:flex;flex-direction:column;overflow:hidden}.y-scrollable-container{overflow-y:auto;block-size:100%;background-color:var(--calcite-color-foreground-1)}header{border-bottom:1px solid var(--calcite-color-border-3);flex:0 0 auto}.ltr-container{direction:ltr}calcite-action-bar{calcite-action-group{padding-inline-end:var(--calcite-spacing-sm);calcite-action{padding-inline-end:var(--calcite-spacing-sm)}calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}calcite-action-group:last-child{border-inline-end-width:0px}calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.color-info{color:var(--calcite-color-status-info)}.color-error{color:var(--calcite-color-status-danger)}.color-success{color:var(--calcite-color-status-success)}[class*=result-value-]{font-size:var(--calcite-font-size--2);line-height:1.25rem;background-color:var(--calcite-color-foreground-1);margin:var(--calcite-spacing-md)}.console-logs-container{background-color:var(--calcite-color-foreground-1);padding:0 var(--calcite-spacing-md);font-family:var(--calcite-code-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal)}.result-value-table{table{display:block;max-width:fit-content;overflow-x:auto;border-spacing:0;border-collapse:collapse;text-align:start;white-space:nowrap;thead{background-color:var(--calcite-color-foreground-2)}tr{border-top:1px solid var(--calcite-color-border-3);border-bottom:1px solid var(--calcite-color-border-3)}th,td{border-inline-start:1px solid var(--calcite-color-border-3);border-inline-end:1px solid var(--calcite-color-border-3);text-align:start;padding:var(--calcite-spacing-xxs);.string-value{white-space:pre}}th{font-weight:var(--calcite-font-weight-medium)}}}.tree-item-label,.number-value,.string-value,.boolean-value{font-family:var(--calcite-code-family)}.tree-item-label,.value-type{color:var(--calcite-color-text-2);font-weight:var(--calcite-font-weight-normal)}.dictionary-property{color:var(--arcgis-editor-identifier)}.number-value{color:var(--arcgis-editor-number)}.string-value{color:var(--arcgis-editor-string);white-space:pre-wrap}.constant-value{color:var(--arcgis-editor-constant)}.date-value{color:var(--arcgis-editor-date)}}`, l = {
13
13
  lines: !0,
14
14
  selectionMode: "none",
@@ -9,7 +9,7 @@ import { u as b } from "../../chunks/useT9n.js";
9
9
  import { css as _ } from "@lit/reactive-element/css-tag.js";
10
10
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
11
11
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
12
- v4.34.0-next.21 */
12
+ v4.34.0-next.22 */
13
13
  function v(o) {
14
14
  return !Array.isArray(o) || !o.length ? !1 : Array.isArray(o[0].suggestions);
15
15
  }
@@ -9,7 +9,7 @@ import { load as h } from "@arcgis/lumina/controllers";
9
9
  import { Range as M, Uri as c, KeyMod as n, KeyCode as t } from "monaco-editor";
10
10
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
11
11
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
12
- v4.34.0-next.21 */
12
+ v4.34.0-next.22 */
13
13
  const x = m`@layer{/*!-----------------------------------------------------------
14
14
  * Copyright (c) Microsoft Corporation. All rights reserved.
15
15
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
@@ -7,7 +7,7 @@ import { u as f } from "../../chunks/useT9n.js";
7
7
  import { css as u } from "@lit/reactive-element/css-tag.js";
8
8
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
9
9
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
10
- v4.34.0-next.21 */
10
+ v4.34.0-next.22 */
11
11
  const m = u`:host{background-color:var(--calcite-color-foreground-1);.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.sticky{position:sticky;top:0;z-index:10}calcite-flow{height:100%}calcite-list-item-group{background-color:var(--calcite-color-foreground-2);word-break:break-word}}`;
12
12
  function g(l) {
13
13
  l.key === "Enter" && l.stopPropagation();
@@ -10,7 +10,7 @@ import { css as v } from "@lit/reactive-element/css-tag.js";
10
10
  import { s as d } from "../../chunks/sql-expr-contribution.js";
11
11
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
12
12
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
13
- v4.34.0-next.21 */
13
+ v4.34.0-next.22 */
14
14
  const y = v`:host{background-color:var(--calcite-color-foreground-1);.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.sticky{position:sticky;top:0;z-index:10}calcite-flow{height:100%}calcite-block{p:first-of-type{margin-top:0}code{font-family:var(--calcite-code-family)}pre{direction:ltr;overflow-x:auto;background-color:var(--calcite-color-foreground-2);padding:var(--calcite-spacing-sm);code{font-size:var(--calcite-font-size--2)}}}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}}`;
15
15
  class I extends f {
16
16
  constructor() {
@@ -9,7 +9,7 @@ import { css as g } from "@lit/reactive-element/css-tag.js";
9
9
  import { s as f } from "../../chunks/editor.js";
10
10
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
11
11
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
12
- v4.34.0-next.21 */
12
+ v4.34.0-next.22 */
13
13
  const _ = g`@layer{arcgis-sql-expression-editor{display:flex;flex-direction:column;position:relative;overflow:hidden;border:var(--arcgis-coding-components-border)!important;box-sizing:border-box;background-color:var(--arcgis-coding-components-background-color);height:100%}}`;
14
14
  class m extends r {
15
15
  constructor() {
@@ -7,7 +7,7 @@ import { u as m } from "../../chunks/useT9n.js";
7
7
  import { css as d } from "@lit/reactive-element/css-tag.js";
8
8
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
9
9
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
10
- v4.34.0-next.21 */
10
+ v4.34.0-next.22 */
11
11
  const h = d`:host{calcite-flow{height:100%}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}}`;
12
12
  class f extends r {
13
13
  constructor() {
@@ -1,8 +1,8 @@
1
1
  {
2
- "timestamp": "2025-06-10T04:47:34",
2
+ "timestamp": "2025-06-11T04:53:33",
3
3
  "compiler": {
4
4
  "name": "@arcgis/lumina-compiler",
5
- "version": "4.34.0-next.21",
5
+ "version": "4.34.0-next.22",
6
6
  "typescriptVersion": "5.8.3"
7
7
  },
8
8
  "schemaVersion": "1.0.0",
@@ -1,8 +1,8 @@
1
1
  {
2
- "timestamp": "2025-06-10T04:47:34",
2
+ "timestamp": "2025-06-11T04:53:33",
3
3
  "compiler": {
4
4
  "name": "@arcgis/lumina-compiler",
5
- "version": "4.34.0-next.21",
5
+ "version": "4.34.0-next.22",
6
6
  "typescriptVersion": "5.8.3"
7
7
  },
8
8
  "components": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@arcgis/coding-components",
4
- "version": "4.34.0-next.21",
4
+ "version": "4.34.0-next.22",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { a as c } from "./chunks/arcade-defaults.js";
3
3
  import { s as p } from "./chunks/sql-expr-defaults.js";
4
4
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
5
5
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
6
- v4.34.0-next.21 */
6
+ v4.34.0-next.22 */
7
7
  const a = s, r = t;
8
8
  export {
9
9
  c as arcade,
package/dist/loader.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { r as e } from "./chunks/runtime.js";
2
- import { makeDefineCustomElements as i } from "@arcgis/lumina";
2
+ import { makeDefineCustomElements as s } from "@arcgis/lumina";
3
3
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
4
4
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
5
- v4.34.0-next.21 */
6
- const o = i(e, {
7
- "arcgis-arcade-coding-assistant": [() => import("./components/arcgis-arcade-coding-assistant/customElement.js"), "appVersion,assistantsEnabled,closed,closePanel:,editorRef:,feedbackServiceUrl,insertText:,layer,orgBaseUrl,serviceUrl;destroy"],
5
+ v4.34.0-next.22 */
6
+ const o = s(e, {
7
+ "arcgis-arcade-coding-assistant": [() => import("./components/arcgis-arcade-coding-assistant/customElement.js"), "appVersion,assistantsEnabled,closed,closePanel:,editorRef:,feedbackServiceUrl,helpBase,insertText:,layer,orgBaseUrl,serviceUrl;destroy"],
8
8
  "arcgis-arcade-editor": [() => import("./components/arcgis-arcade-editor/customElement.js"), "customPanels:,editorInstance:,editorOptions:,hideDocumentationActions,hideSideBar,openedSidePanel:,profile:,script,sideActionBarExpanded,snippets:,suggestions:,testData:;getEditorInstance,getScript,getTestResult,setFocus"],
9
9
  "arcgis-arcade-results": [() => import("./components/arcgis-arcade-results/customElement.js"), "consoleLogs:,loading,openedResultPanel,result:"],
10
10
  "arcgis-arcade-suggestions": [() => import("./components/arcgis-arcade-suggestions/customElement.js"), "closed,suggestions:"],
@@ -11,6 +11,6 @@ export declare function filterCollection<T, U extends KeysOfType<T, string | und
11
11
  * Returns the url to the portal item.
12
12
  */
13
13
  export declare function portalItemPageUrl(portalItem: __esri.PortalItem | null | undefined): string;
14
- export declare function editModel(editorInstance: editor.IStandaloneCodeEditor | undefined, script: string, disclaimer?: string): void;
14
+ export declare function editModel(editorInstance: editor.IStandaloneCodeEditor | undefined, script: string, insertMode?: "add" | "replace", disclaimer?: string): void;
15
15
  export declare function formatResult(script: string): string;
16
16
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/coding-components",
3
- "version": "4.34.0-next.21",
3
+ "version": "4.34.0-next.22",
4
4
  "description": "Contains components for editing code in different languages. The currently supported languages are html, css, json, TypeScript, JavaScript, and Arcade.",
5
5
  "keywords": [
6
6
  "ArcGIS",
@@ -39,17 +39,17 @@
39
39
  ],
40
40
  "license": "SEE LICENSE IN LICENSE.md",
41
41
  "dependencies": {
42
- "@arcgis/arcade-languageservice": "4.34.0-next.21",
43
- "@arcgis/components-utils": "4.34.0-next.21",
44
- "@arcgis/languages-api-utils": "4.34.0-next.21",
45
- "@arcgis/lumina": "4.34.0-next.21",
42
+ "@arcgis/arcade-languageservice": "4.34.0-next.22",
43
+ "@arcgis/components-utils": "4.34.0-next.22",
44
+ "@arcgis/languages-api-utils": "4.34.0-next.22",
45
+ "@arcgis/lumina": "4.34.0-next.22",
46
46
  "monaco-editor": "^0.52.0",
47
47
  "tslib": "^2.8.1",
48
48
  "vscode-languageserver-types": "^3.17.5"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@arcgis/core": ">=4.34.0-next <4.35",
52
- "@esri/calcite-components": "^3.2.0"
52
+ "@esri/calcite-components": "^3.2.1"
53
53
  },
54
54
  "css.customData": [
55
55
  "dist/docs/vscode.css-custom-data.json"
@@ -1,4 +0,0 @@
1
- /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
- See https://js.arcgis.com/4.34/esri/copyright.txt for details.
3
- v4.34.0-next.21 */
4
- import{a as Q}from"./4DWQHJO3.js";import b from"./LFWH37K6.js";import{a as _,b as N}from"./FT3O4I6P.js";import{a as O}from"./S22HBPCN.js";import"./HXOGCC2Y.js";import a from"./OO6NPCQP.js";import"./GSBW6FVS.js";import{i as U,j as z}from"./D2XTCFJF.js";import"./JUPBFVGO.js";import{A as q,C as P,a as C,b as r,c as M,d as y,p as T,q as I,r as F,y as V}from"./T7TBIZIA.js";import"./V4Y6OY32.js";import"./RUQSKYNM.js";import"./7BH6A67O.js";export default $arcgis.t(([K,B,X,Z,,j])=>{var v=class extends F{constructor(e){if(super(e),this.it=y,e.type!==T.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===y||e==null)return this._t=void 0,this.it=e;if(e===M)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};v.directiveName="unsafeHTML",v.resultType=1;var w=I(v);var ee=C`: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}`;function D(i){if(!i)return;let e=i.indexOf('{"error":');if(e!==-1)try{let t=i.slice(e),s=JSON.parse(t);if(s&&typeof s=="object"&&s.error)return s.error}catch{return}}async function te(i){let{baseUrl:e,skillId:t,message:s,authToken:c,previousConversationId:a,context:n}=i,o=t?`${e}/skills/${t}/chat`:`${e}/chat`,d=[],l={message:s,context:n};a&&(l.conversation_id=a);let g;try{g=await B(o,{method:"post",headers:{"Content-Type":"application/json",token:c},body:JSON.stringify(l),responseType:"json"})}catch(m){let f=m?.details?.rawResponse||m?.message||String(m),k=D(f),b=new Error(`Failed to send message: ${s}. Response: ${f}`);throw k&&(b.arcadeAssistantError=k),b}let p=g.data;if(!p.hasMore)throw new Error("Expected hasMore to be true");d.push(p);let J=p.conversationId,W=p.inquiryId,A=p.sequenceNumber;async function Y(){let m=0,f=25;for(;m<f;){await new Promise(h=>setTimeout(h,1e3));let k=ie(J,A,W),b;try{b=await B(o,{method:"post",headers:{"Content-Type":"application/json",token:c},body:JSON.stringify(k),responseType:"json"})}catch(h){let S=h?.details?.rawResponse||h?.message||String(h),R=D(S),E=new Error(`Polling failed. Response: ${S}`);throw R&&(E.arcadeAssistantError=R),E}let u=b.data;if(u.context&&u.context.kind==="ArcgisErrorAsContext"&&u.context.error){let h=new Error(u.context.error.message||"ArcGIS Assistant error");throw h.arcadeAssistantError={message:u.context.error.message??"ArcGIS Assistant error"},h}if(d.push(u),A=u.sequenceNumber,m++,!u.hasMore)break}if(m===f)throw new Error("Request timed out")}return await Y(),d}function ie(i,e,t){return{conversationId:i,inquiryId:t,ackSequenceNumber:e}}var se=i=>{let e=i.value.length,t=72,s=180,c=i.offsetWidth,a=Math.max(1,Math.floor(c/8)),n=Math.ceil(e/a),o=t+(n-2)*24;i.style.setProperty("--calcite-text-area-min-height",`${Math.min(o,s)}px`)};function ae({messages:i}){return r`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${i.beta??"Beta"}>${i.beta??"Beta"}</calcite-chip>`}function ce({popoverContent:i}){return r`<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>`}function oe({errorMessage:i}){return r`<calcite-input-message id=error-message status=invalid slot=footer-start icon=exclamation-mark-triangle scale=m>${i}</calcite-input-message>`}function re({active:i,setActive:e,messages:t}){return r`<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>`}function ne({isDisabled:i,isReadOnly:e,setQuestion:t,setIsViewingResult:s,textAreaRef:c,question:a,errorMessage:n,setErrorMessage:o,submitQuestion:d,messages:l,mode:g}){return r`<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=${a} @calciteTextAreaInput=${p=>{se(p.target),t(p.target.value)}} ${N(c)}>${n&&oe({errorMessage:n})||""}</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()=>{s(!1),t("")}}>${l.startover??"Start Over"}</calcite-button><calcite-button round icon-end=effects appearance=solid .loading=${i} .disabled=${i} @click=${async()=>{o(a?"":l.enteraprompt??"Please enter a prompt"),await d()}}>${g==="prompt"?l.ask??"Generate":l.refine??"Refine"}</calcite-button></div></div>`}function le({open:i,setOpen:e,messages:t,feedbackValue:s,setFeedbackValue:c,feedbackText:a,setFeedbackText:n,onSubmit:o}){return r`<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=${()=>c("good")}></calcite-segmented-control-item><calcite-segmented-control-item icon-start=thumbs-down .checked=${s==="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=${a} @calciteTextAreaInput=${d=>n(d.target.value)}></calcite-text-area></calcite-label></div><calcite-button slot=footer width=full @click=${o}>${t.submitfeedback??"Submit Feedback"}</calcite-button></calcite-panel></calcite-sheet>`}function H({assistantsEnabled:i,messages:e,slot:t}){return r`<calcite-block label=info slot=${t??q} 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&&r`<p>${w(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>`}function de({messages:i,onProceed:e,onExit:t}){return r`<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>${w(`&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>${w(i.consultprivacy.replace("{privacyStatement}",`<calcite-link href="https://www.esri.com/en-us/privacy/arcgis-online-privacy-statement" target="_blank">${i.privacyStatement}</calcite-link>`).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>`}function pe({messages:i,suggestions:e,onSuggestionClick:t}){return r`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block><calcite-chip-group .label=${i.promptsuggestions} class="suggestion-chips">${Q(e,s=>s,s=>r`<calcite-chip .label=${i.promptsuggestion} .value=${s} icon=effects @click=${()=>t?.(s)}>${s}</calcite-chip>`)}</calcite-chip-group></calcite-block>`}function ue({hidden:i=!1,expanded:e=!1,messages:t,cards:s,heading:c,collapsible:a=!1,showEffectsIcon:n=!1}){return r`<calcite-block .hidden=${i} id=result-block .heading=${c??t.besteffort??"Here is the assistant's best effort"} .expanded=${e} .collapsible=${a}>${n&&r`<calcite-chip label slot=content-start icon=effects kind=brand></calcite-chip>`||""}<calcite-card-group .label=${t.assistantresponses}>${s.map((o,d)=>r`<calcite-card><div slot=title><div class="prior-prompt">${o.priorPrompt}</div><div class="code-response-wrapper"><div class="positioned-code-content">${o.chips?.map(l=>r`<calcite-chip .label=${l.label} .scale=${l.scale??"s"} .appearance=${l.appearance??"outline"} .icon=${l.icon}>${l.label}</calcite-chip>`)}</div><pre><code>${o.code}</code></pre></div></div><div slot=footer-start><calcite-button round icon-start=plus appearance=outline-fill class="add-to-editor-button" @click=${o.onAddToEditor}>${t.addtoeditor??"Add to editor"}</calcite-button><calcite-button round icon-start=copy-to-clipboard kind=neutral @click=${()=>o.onCopy(d)}>${o.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=${o.onThumbsUp}></calcite-action><calcite-action .text=${t.thumbsdown} scale=s icon=thumbs-down @click=${o.onThumbsDown}></calcite-action></div></calcite-card>`)}</calcite-card-group></calcite-block>`}var x={welcome:"Welcome to the new assistant experience",beforeyougetstarted:"Before you get started be aware:",maybeincorrect:"AI generated code may occasionally be incorrect or biased. Review carefully.",pleasereadhelp:"Please read the Arcade Assistant (beta) overview {helpTopic} for more details.",consultprivacy:"Consult the {privacyStatement} and {privacySupplement}.",privacyStatement:"privacy statement",privacySupplement:"privacy supplement",proceed:"Proceed",exit:"Exit",promptsuggestions:"Prompt suggestions",promptsuggestion:"Prompt suggestion",assistantresponses:"Assistant responses",collapse:"Collapse",thumbsup:"Thumbs up",thumbsdown:"Thumbs down",refine:"Refine",startover:"Start over",helptopic:"help topic"},he="arcade_generation",me="ArcadeCodeRequest",ge="visualization",fe="ArcadeAssistant",be=["your_comments","user_evaluation","question","answer","useragent","_source","version","context","extras"],L=[],G=!0,$=class extends V{constructor(){super(...arguments),this.textAreaRef=_(),this.messages=O(),this._feedbackService=void 0,this.handleFeedbackButton=(e,t)=>{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}},this.handleFeedbackSheetClose=()=>{this.feedback={active:!1,value:void 0,text:"",item:void 0}},this.handleFeedbackSubmit=async()=>{let e=await this.ensureFeedbackService();if(!e){this.handleFeedbackSheetClose();return}let t=this.getModel(),s=t?await this.getProfileAndMetadata(t.uri):void 0,c={user_evaluation:this.feedback.value,your_comments:this.feedback.text||void 0,question:this.question,answer:this.feedback.item?.script??"",useragent:navigator.userAgent,_source:fe,version:this.appVersion??"",context:s?JSON.stringify(s):"",extras:s?.profileName??"",conversation_id:this.feedback.item?.conversationId??""};try{await e.applyEdits({addFeatures:[new Z({attributes:c})]})}catch(a){console.error("Error submitting feedback:",a)}this.handleFeedbackSheetClose()},this.handleClose=e=>{this.closed=!0,this.closePanel?.(e)},this.setQuestion=e=>{this.question=e},this.onSuggestionClick=e=>{this.textAreaRef.value&&(this.textAreaRef.value.value=e,this.textAreaRef.value.setFocus(),this.setQuestion(e))},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}static{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}}static{this.styles=ee}async destroy(){}connectedCallback(){super.connectedCallback(),this.history=L,this.splashActive=G}disconnectedCallback(){super.disconnectedCallback(),L=this.history,G=this.splashActive}async ensureFeedbackService(){if(this._feedbackService)return this._feedbackService;if(!this.feedbackServiceUrl)return;let e=new X({url:this.feedbackServiceUrl});await e.load();let t=be.filter(s=>!e.fields.some(c=>c.name===s));if(t.length>0){console.error(`Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);return}return this._feedbackService=e,e}getModel(){return this.editorRef.editorInstance?.getModel()}async submitQuestion(){if(this.question){this.isSubmitting=!0;try{let e=await this.getToken(),t=this.getModel();if(!t)return;let{profileName:s,metadata:c}=await this.getProfileAndMetadata(t.uri),a=(await te({baseUrl:this.serviceUrl,skillId:he,message:this.question,authToken:e,context:{kind:me,context:{profile_name:s,metadata:c}}})).find(n=>n.context?.kind==="ArcadeCodeResponse");if(!a)return;a.context?.kind==="ArcadeCodeResponse"&&(this.history.unshift({script:a?.context?.arcadeCode?.code,error:void 0,question:this.question,profile:s,conversationId:a.conversationId}),this.isViewingResult=!0,this.errorMessage=void 0)}catch(e){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)}finally{this.isSubmitting=!1}}}async getToken(){let{token:e}=await K.getCredential(this.orgBaseUrl);return e}async getProfileAndMetadata(e){let t=ge,s=j.getEditorProfileForModel(e);s?.loaded||await s?.loadSource();let c=this.editorRef.profile;c&&"id"in c&&(t=c.id);let a=s?.definition?.variables?.find(o=>o.type==="feature"),n=[];return a?.definition&&"fields"in a.definition&&(n=a.definition.fields.map(o=>({name:o.name,type:o.type,alias:o.alias}))),{profileName:t,metadata:n}}render(){return this.closed?null:this.assistantsEnabled?r`<calcite-flow><calcite-flow-item .selected=${!this.isViewingResult} closable .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${ae({messages:this.messages})}${ce({popoverContent:H({assistantsEnabled:this.assistantsEnabled,messages:this.messages})})}<calcite-shell class="unstyled-shell">${this.splashActive&&de({messages:{...x,...this.messages},onProceed:()=>{this.splashActive=!1},onExit:e=>this.closePanel&&this.closePanel(e)})||""}${re({active:this.confirmationActive,setActive:e=>this.confirmationActive=e,messages:this.messages})}${ne({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:{...x,...this.messages}})}<calcite-block-group label="interactive blocks">${!this.isViewingResult&&!this.isSubmitting&&pe({messages:{...this.messages,...x},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>${ue({expanded:this.isViewingResult||this.history.length>0,messages:{...this.messages,...x},collapsible:!0,showEffectsIcon:this.isViewingResult,cards:this.history.reduce((e,t,s)=>(!t.script||this.isViewingResult&&s>0||(e.push({priorPrompt:t.question,code:z(t.script??"")||t.error||"",chips:[],onAddToEditor:()=>{U(this.editorRef.editorInstance,t.script??"",this.messages.disclaimercomment??"Expression generated by ArcGIS Arcade Assistant (beta)")},onCopy:c=>{let a=t.script??"";a&&navigator.clipboard.writeText(a).then(()=>{this.copySucessIndex=c,setTimeout(()=>{this.copySucessIndex=-1},1500)})},onThumbsUp:()=>this.handleFeedbackButton("good",t),onThumbsDown:()=>this.handleFeedbackButton("bad",t),copySuccessIndex:this.copySucessIndex}),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?le({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>`:r`<calcite-flow><calcite-flow-item .selected=${!this.isViewingResult} closable .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${H({slot:"content-top",messages:this.messages,assistantsEnabled:this.assistantsEnabled})}</calcite-flow-item></calcite-flow>`}};P("arcgis-arcade-coding-assistant",$);return $},"identity/IdentityManager","request","layers/FeatureLayer","Graphic",a,b)