@arcgis/coding-components 4.33.0-next.159 → 4.33.0-next.160

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 (81) hide show
  1. package/dist/addons/arcade-coding-assistant/chat-helper.d.ts +1 -0
  2. package/dist/addons.js +1 -1
  3. package/dist/cdn/{PWL3LLFK.js → 2NSAO3BQ.js} +2 -2
  4. package/dist/cdn/{AFEL3H6J.js → 2QXCR5YU.js} +2 -2
  5. package/dist/cdn/{HNCYN2JT.js → 2ZQA5JD2.js} +2 -2
  6. package/dist/cdn/{DWHBPDYP.js → 3YCYG4KW.js} +2 -2
  7. package/dist/cdn/{5SNVZH4G.js → 4PDW3HA6.js} +1 -1
  8. package/dist/cdn/{GP5ZRQRC.js → 5NADOAQD.js} +2 -2
  9. package/dist/cdn/{ICD2DOTW.js → 6WSKB3LZ.js} +2 -2
  10. package/dist/cdn/{OPJJALI4.js → 72TQWGCF.js} +2 -2
  11. package/dist/cdn/{MROWFPLE.js → CNMOWAL7.js} +2 -2
  12. package/dist/cdn/{QMCEWN5I.js → CPMRD2UC.js} +2 -2
  13. package/dist/cdn/{2S4UQAUQ.js → DKPJFLB7.js} +2 -2
  14. package/dist/cdn/{CQRTFEI4.js → E5FQ6V7E.js} +2 -2
  15. package/dist/cdn/{CKB7MPWZ.js → FBJ5GSV5.js} +2 -2
  16. package/dist/cdn/{2N3K2DTA.js → FEBRJ4AG.js} +2 -2
  17. package/dist/cdn/{2O5RPSXV.js → GG57GV3Z.js} +2 -2
  18. package/dist/cdn/{XGKSQ37I.js → H6GZE5GV.js} +1 -1
  19. package/dist/cdn/{F2UFY3RX.js → HA22JR2C.js} +2 -2
  20. package/dist/cdn/{AQGWSXEM.js → HCNSKBQ2.js} +1 -1
  21. package/dist/cdn/{IPPUV6EE.js → HZOWMCAR.js} +4 -4
  22. package/dist/cdn/{ILF5Q6DK.js → J7AJUDB4.js} +2 -2
  23. package/dist/cdn/{BKAX43XK.js → MG33KLLO.js} +2 -2
  24. package/dist/cdn/{PBM6WNXJ.js → NCZTUBOY.js} +2 -2
  25. package/dist/cdn/{OUFLMSN5.js → PFS4N2ZF.js} +2 -2
  26. package/dist/cdn/{P3PNT4CY.js → PJMN2B75.js} +2 -2
  27. package/dist/cdn/{KRIIXM7I.js → QG5A2NJ5.js} +2 -2
  28. package/dist/cdn/{V7SC4CIM.js → QSNKNLXX.js} +2 -2
  29. package/dist/cdn/{YQ57PCM5.js → R2ZFLZIE.js} +2 -2
  30. package/dist/cdn/{W4BTM2ZK.js → RB2HX4BV.js} +2 -2
  31. package/dist/cdn/SZIDTVM5.js +6 -0
  32. package/dist/cdn/{X6FMPCMO.js → TDDM42QP.js} +2 -2
  33. package/dist/cdn/{6WWFCVZB.js → TDPYCZYH.js} +2 -2
  34. package/dist/cdn/{WYDZSWHV.js → TG7W2MUK.js} +2 -2
  35. package/dist/cdn/{G4BNUVHU.js → U33YFCJ3.js} +2 -2
  36. package/dist/cdn/{WAATIDDH.js → U4DVUCWU.js} +1 -1
  37. package/dist/cdn/{FPH6NDHK.js → U5AA63OY.js} +2 -2
  38. package/dist/cdn/{4SV5TVK4.js → UXT2NSH4.js} +2 -2
  39. package/dist/cdn/{BYYHEISS.js → VMXI4ZR6.js} +2 -2
  40. package/dist/cdn/{VXOLFZKS.js → WLEU7HWL.js} +2 -2
  41. package/dist/cdn/{ZQ3NYHSG.js → XN2VBWAB.js} +2 -2
  42. package/dist/cdn/{IQBUSAE6.js → Y6C5EOVW.js} +2 -2
  43. package/dist/cdn/{TKXDIBWX.js → ZVQ3IJZB.js} +1 -1
  44. package/dist/cdn/assets/code-editor/sql-expr.worker.js +12781 -12760
  45. package/dist/cdn/index.js +2 -2
  46. package/dist/chunks/arcade-defaults.js +1 -1
  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 +1 -1
  53. package/dist/chunks/markdown.js +1 -1
  54. package/dist/chunks/monaco-importer.js +1 -1
  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 -1
  62. package/dist/components/arcgis-arcade-coding-assistant/customElement.js +225 -182
  63. package/dist/components/arcgis-arcade-coding-assistant/functional.d.ts +16 -8
  64. package/dist/components/arcgis-arcade-coding-assistant/index.d.ts +1 -1
  65. package/dist/components/arcgis-arcade-coding-assistant/index.js +1 -1
  66. package/dist/components/arcgis-arcade-coding-assistant/types.d.ts +9 -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 +1 -1
  80. package/package.json +5 -5
  81. package/dist/cdn/LYA74LSW.js +0 -6
@@ -1,7 +1,7 @@
1
1
  import { JsxNode } from '@arcgis/lumina';
2
- import { temporaryStrings as TempStrings } from '../../addons/arcade-coding-assistant/temporary-strings.js';
2
+ import { temporaryStrings as TempStrings } from '../../addons/arcade-coding-assistant/temporary-strings';
3
3
  import { Ref } from 'lit/directives/ref.js';
4
- import { FeedbackState } from './types';
4
+ import { Context, FeedbackState } from './types';
5
5
  declare const strings: (value: {
6
6
  arcadeassistant: string;
7
7
  beta: string;
@@ -95,15 +95,20 @@ export declare function AboutDisplay({ messages }: {
95
95
  export declare function DisclaimerDisplay({ popoverContent }: {
96
96
  popoverContent: JsxNode;
97
97
  }): JsxNode;
98
- export declare function ErrorDisplay({ errorMessage }: {
99
- errorMessage?: string;
98
+ export declare function ErrorDisplay({ errorMessage, slot }: {
99
+ errorMessage: JsxNode | string;
100
+ slot?: string;
100
101
  }): JsxNode;
101
102
  export declare function ConfirmationDisplay({ active, setActive, messages, }: {
102
103
  active: boolean;
103
104
  setActive: (e: boolean) => void;
104
105
  messages: Partial<ReturnType<typeof strings>>;
105
106
  }): JsxNode;
106
- export declare function SubmissionDisplay({ isDisabled, isReadOnly, setQuestion, setIsViewingResult, textAreaRef, question, errorMessage, setErrorMessage, submitQuestion, messages, mode, }: {
107
+ export declare function ContextDisplay({ context, messages, }: {
108
+ context?: Context;
109
+ messages: Partial<ReturnType<typeof strings>> & typeof TempStrings;
110
+ }): JsxNode;
111
+ export declare function SubmissionDisplay({ isDisabled, isReadOnly, setQuestion, setIsViewingResult, textAreaRef, question, errorMessage, setErrorMessage, submitQuestion, messages, mode, context, }: {
107
112
  isDisabled: boolean;
108
113
  isReadOnly: boolean;
109
114
  setQuestion: (e: string) => void;
@@ -115,6 +120,7 @@ export declare function SubmissionDisplay({ isDisabled, isReadOnly, setQuestion,
115
120
  submitQuestion: () => Promise<void>;
116
121
  messages: Partial<ReturnType<typeof strings>> & typeof TempStrings;
117
122
  mode: "prompt" | "refine";
123
+ context?: Context;
118
124
  }): JsxNode;
119
125
  export declare function FeedbackSheetDisplay({ setOpen, messages, feedback, setFeedback, onSubmit, }: {
120
126
  setOpen: (open: boolean) => void;
@@ -153,14 +159,15 @@ export interface ResponseDisplayCardChip {
153
159
  export interface ResponseDisplayCard {
154
160
  priorPrompt: string;
155
161
  code: string;
162
+ message?: string;
156
163
  chips?: ResponseDisplayCardChip[];
157
164
  onAddToEditor: () => void;
158
- onCopy: (index: number) => void;
165
+ onCopy: (index: string) => void;
159
166
  onThumbsUp: () => void;
160
167
  onThumbsDown: () => void;
161
- copySuccessIndex?: number;
168
+ conversationId: string;
162
169
  }
163
- export declare function ResponseDisplay({ hidden, expanded, messages, cards, heading, collapsible, showEffectsIcon, editorInsertMode, setEditorInsertMode, }: {
170
+ export declare function ResponseDisplay({ hidden, expanded, messages, cards, heading, collapsible, showEffectsIcon, editorInsertMode, setEditorInsertMode, copySuccessConversationId, }: {
164
171
  hidden?: boolean;
165
172
  expanded?: boolean;
166
173
  heading?: string;
@@ -170,5 +177,6 @@ export declare function ResponseDisplay({ hidden, expanded, messages, cards, hea
170
177
  collapsible?: boolean;
171
178
  editorInsertMode?: "add" | "replace";
172
179
  setEditorInsertMode?: (mode: "add" | "replace") => void;
180
+ copySuccessConversationId?: string;
173
181
  }): JsxNode;
174
182
  export {};
@@ -3,8 +3,8 @@ import "@esri/calcite-components/components/calcite-action";
3
3
  import "@esri/calcite-components/components/calcite-popover";
4
4
  import "@esri/calcite-components/components/calcite-input-message";
5
5
  import "@esri/calcite-components/components/calcite-alert";
6
- import "@esri/calcite-components/components/calcite-text-area";
7
6
  import "@esri/calcite-components/components/calcite-button";
7
+ import "@esri/calcite-components/components/calcite-text-area";
8
8
  import "@esri/calcite-components/components/calcite-sheet";
9
9
  import "@esri/calcite-components/components/calcite-panel";
10
10
  import "@esri/calcite-components/components/calcite-label";
@@ -3,8 +3,8 @@ import "@esri/calcite-components/components/calcite-action";
3
3
  import "@esri/calcite-components/components/calcite-popover";
4
4
  import "@esri/calcite-components/components/calcite-input-message";
5
5
  import "@esri/calcite-components/components/calcite-alert";
6
- import "@esri/calcite-components/components/calcite-text-area";
7
6
  import "@esri/calcite-components/components/calcite-button";
7
+ import "@esri/calcite-components/components/calcite-text-area";
8
8
  import "@esri/calcite-components/components/calcite-sheet";
9
9
  import "@esri/calcite-components/components/calcite-panel";
10
10
  import "@esri/calcite-components/components/calcite-label";
@@ -1,3 +1,4 @@
1
+ /// <reference types="@arcgis/core/interfaces.d.ts" />
1
2
  export type Feedback = {
2
3
  user_evaluation?: "bad" | "good";
3
4
  your_comments?: string;
@@ -33,4 +34,12 @@ export type HistoryItem = {
33
34
  conversationId?: string;
34
35
  formattedScript?: string;
35
36
  layerName?: string;
37
+ message?: string;
38
+ };
39
+ export type Context = {
40
+ /** profileName and metadata are passed to backend */
41
+ profileName: string;
42
+ metadata: Partial<__esri.Field>[];
43
+ /** used for the context display buttons / chips */
44
+ layerName?: nullish | string;
36
45
  };
@@ -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.33/esri/copyright.txt for details.
19
- v4.33.0-next.159 */
19
+ v4.33.0-next.160 */
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.33/esri/copyright.txt for details.
11
- v4.33.0-next.159 */
11
+ v4.33.0-next.160 */
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.33/esri/copyright.txt for details.
12
- v4.33.0-next.159 */
12
+ v4.33.0-next.160 */
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.33/esri/copyright.txt for details.
12
- v4.33.0-next.159 */
12
+ v4.33.0-next.160 */
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.33/esri/copyright.txt for details.
10
- v4.33.0-next.159 */
10
+ v4.33.0-next.160 */
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.33/esri/copyright.txt for details.
13
- v4.33.0-next.159 */
13
+ v4.33.0-next.160 */
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.33/esri/copyright.txt for details.
12
- v4.33.0-next.159 */
12
+ v4.33.0-next.160 */
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.33/esri/copyright.txt for details.
10
- v4.33.0-next.159 */
10
+ v4.33.0-next.160 */
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-13T04:37:11",
2
+ "timestamp": "2025-06-14T04:36:57",
3
3
  "compiler": {
4
4
  "name": "@arcgis/lumina-compiler",
5
- "version": "4.33.0-next.159",
5
+ "version": "4.33.0-next.160",
6
6
  "typescriptVersion": "5.8.3"
7
7
  },
8
8
  "schemaVersion": "1.0.0",
@@ -1,8 +1,8 @@
1
1
  {
2
- "timestamp": "2025-06-13T04:37:11",
2
+ "timestamp": "2025-06-14T04:36:57",
3
3
  "compiler": {
4
4
  "name": "@arcgis/lumina-compiler",
5
- "version": "4.33.0-next.159",
5
+ "version": "4.33.0-next.160",
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.33.0-next.159",
4
+ "version": "4.33.0-next.160",
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.33/esri/copyright.txt for details.
6
- v4.33.0-next.159 */
6
+ v4.33.0-next.160 */
7
7
  const a = s, r = t;
8
8
  export {
9
9
  c as arcade,
package/dist/loader.js CHANGED
@@ -2,7 +2,7 @@ import { r as e } from "./chunks/runtime.js";
2
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.33/esri/copyright.txt for details.
5
- v4.33.0-next.159 */
5
+ v4.33.0-next.160 */
6
6
  const o = s(e, {
7
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"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/coding-components",
3
- "version": "4.33.0-next.159",
3
+ "version": "4.33.0-next.160",
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,10 +39,10 @@
39
39
  ],
40
40
  "license": "SEE LICENSE IN LICENSE.md",
41
41
  "dependencies": {
42
- "@arcgis/arcade-languageservice": "4.33.0-next.159",
43
- "@arcgis/components-utils": "4.33.0-next.159",
44
- "@arcgis/languages-api-utils": "4.33.0-next.159",
45
- "@arcgis/lumina": "4.33.0-next.159",
42
+ "@arcgis/arcade-languageservice": "4.33.0-next.160",
43
+ "@arcgis/components-utils": "4.33.0-next.160",
44
+ "@arcgis/languages-api-utils": "4.33.0-next.160",
45
+ "@arcgis/lumina": "4.33.0-next.160",
46
46
  "monaco-editor": "^0.52.0",
47
47
  "tslib": "^2.8.1",
48
48
  "vscode-languageserver-types": "^3.17.5"
@@ -1,6 +0,0 @@
1
- /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
- See https://js.arcgis.com/4.33/esri/copyright.txt for details.
3
- v4.33.0-next.159 */
4
- import{a as J}from"./F2UFY3RX.js";import b from"./YQ57PCM5.js";import{a as B,b as z}from"./IQBUSAE6.js";import{a as H}from"./HNCYN2JT.js";import"./X6FMPCMO.js";import a from"./KRIIXM7I.js";import"./XGKSQ37I.js";import{i as L,j as D}from"./IPPUV6EE.js";import"./2N3K2DTA.js";import{A as R,C as O,a as q,b as c,c as P,d as I,p as _,q as F,r as N,y as V}from"./G4BNUVHU.js";import"./AQGWSXEM.js";import"./ZQ3NYHSG.js";import"./WAATIDDH.js";export default $arcgis.t(([te,Y,ie,se,{a:Q},j])=>{var $=class extends N{constructor(e){if(super(e),this.it=I,e.type!==_.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===I||e==null)return this._t=void 0,this.it=e;if(e===P)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:[]}}};$.directiveName="unsafeHTML",$.resultType=1;var w=F($);var ae=q`:host(:not([closed])){flex:1 0 auto;border-inline-start:var(--arcgis-coding-components-border);box-sizing:border-box;max-width:var(--arcgis-coding-components-side-panel-max-w);width:var(--arcgis-coding-components-side-panel-w);.response-actions{display:flex;align-items:center;padding:.5rem;gap:.5rem}.response-actions>div{display:flex;gap:.5rem}.prompt-list calcite-list-item{margin-block-end:.5rem;border-radius:var(--calcite-corner-radius-round);--calcite-color-border-3: transparent;overflow:hidden}.feedback-content{padding:1rem;display:flex;flex-direction:column;gap:.75rem}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: auto;--calcite-sheet-min-height: auto}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-list-item:focus calcite-button{position:relative;top:-2px}.prompt-list calcite-list-item:last-of-type{margin-block-end:0}calcite-list{--calcite-color-foreground-1: transparent;background-color:transparent}calcite-list-item{--calcite-color-foreground-1: white}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}.type-suggestion{--calcite-color-foreground-1: var(--calcite-color-foreground-current);--calcite-color-text-3: var(--calcite-color-text-2);--calcite-icon-color: var(--calcite-color-brand)}.type-history{--calcite-icon-color: var(--calcite-color-text-2)}.type-response{--calcite-icon-color: var(--calcite-color-brand);--calcite-font-family: monospace}.block-response{align-self:flex-start;margin-block-end:4rem;border-block-end:0;--calcite-block-text-color: var(--calcite-color-brand)}calcite-list-item calcite-button{margin-inline-end:.25rem}.type-docs{--calcite-color-foreground-1: var(--calcite-color-foreground-3);--calcite-icon-color: var(--calcite-color-text-1)}.type-error{--calcite-icon-color: var(--calcite-color-status-danger);--calcite-font-family: monospace;border:1px solid var(--calcite-color-status-danger)}#thumbs-up{margin-inline-start:auto;--calcite-icon-color: var(--calcite-color-border-input)}#thumbs-down{--calcite-icon-color: var(--calcite-color-border-input)}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}.no-space-block,.no-space-block[open]{margin:0}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;flex-direction:column;background:#fff;border-radius:var(--calcite-corner-radius-round);margin:.75rem;width:calc(100% - 1.5rem);overflow:hidden;max-width:calc(100% - 1.5rem);--calcite-color-border-input: transparent;--calcite-text-area-divider-color: transparent;position:sticky;align-self:flex-end;box-shadow:var(--calcite-shadow-sm);flex:none}.text-area-wrapper calcite-button:last-of-type{margin-inline-start:auto;align-self:flex-end}calcite-text-area{height:auto;min-height:5.75rem;overflow:hidden;border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-tooltip{--calcite-tooltip-z-index: 1000}.standalone-list{margin:1rem;width:calc(100% - 2rem)}.result-disclaimer{display:block;width:24rem;max-width:90%;margin:1rem auto;text-align:center;line-height:1.125rem;font-size:.875rem;font-style:italic}calcite-flow{height:100%}calcite-popover calcite-list{--calcite-list-background-color: transparent;--calcite-input-border-color: transparent}calcite-popover calcite-list calcite-filter{--calcite-spacing-sm: 0}.break-spaces{white-space:break-spaces}.feedback-button-container{margin-inline-start:auto;gap:0}.info-heading{font-size:var(--calcite-font-size-1);color:var(--calcite-color-text-1)}.unstyled-h3{margin:unset;font-size:var(--calcite-font-size-md)}.unstyled-shell{position:unset;inset:unset;display:unset;block-size:unset;inline-size:unset}.suggestion-chips{--calcite-chip-background-color: var(--calcite-color-foreground-current);--calcite-chip-text-color: var(--calcite-color-brand);calcite-chip{cursor:pointer}}.info-block{max-width:450px}#result-block{calcite-card-group{--calcite-card-group-gap: 1.25rem}calcite-card{--calcite-card-corner-radius: var(--calcite-corner-radius-round);--calcite-card-background-color: white;--calcite-card-border-color: transparent;width:100%}.positioned-code-content{flex-direction:row;gap:.5rem;display:flex;padding:.5rem}calcite-card [slot=title] calcite-chip{margin-block-start:.25rem}.code-response-wrapper{position:relative;background:var(--calcite-color-foreground-2);border-radius:var(--calcite-corner-radius-round);margin-top:-1.5rem}.prior-prompt{margin:.25rem 0 .75rem;max-width:95%;overflow-y:hidden;overflow-x:auto;padding:0}code{white-space:pre;font-size:12px;margin:0;overflow-x:auto;font-family:Fira Mono,Consolas,Menlo,monospace;display:block;max-height:12rem;position:relative;padding:.5rem}.code-collapse{margin-inline-start:auto}.copy-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}}:host([closed]){display:none}`,y=class extends Error{constructor({message:e,code:t,subCode:s,details:o,source:a}){super(e),this.name="ArcadeAssistantError",this.code=t,this.subCode=s,this.details=o,this.source=a}};function G(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 oe(i){let{baseUrl:e,skillId:t,message:s,authToken:o,previousConversationId:a,context:r}=i,n=t?`${e}/skills/${t}/chat`:`${e}/chat`,l=[],d={message:s,context:r};a&&(d.conversation_id=a);let f;try{f=await Y(n,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(d),responseType:"json"})}catch(b){let v=b,T=v.details?.rawResponse||v.message||String(b),k=G(T);throw k?new y(k):b}let g=f.data;l.push(g);let m=g.conversationId,S=g.inquiryId,p=g.sequenceNumber;async function A(){let b=0,v=25;for(;b<v;){await new Promise(x=>setTimeout(x,1e3));let T=ce(m,p,S),k;try{k=await Y(n,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(T),responseType:"json"})}catch(x){let E=x,ee=E.details?.rawResponse||E.message||String(x),U=G(ee);throw U?new y(U):x}let h=k.data;if(h.context&&h.context.kind==="ArcgisErrorAsContext"&&h.context.error)throw new y({message:h.context.error.message||"ArcGIS Assistant error",code:h.context.error.code,subCode:h.context.error.subCode,details:h.context.error.details,source:"polling-response"});if(l.push(h),p=h.sequenceNumber,b++,!h.hasMore)break}if(b===v)throw new y({message:"Request timed out",code:"TIMEOUT",source:"polling"})}let Z=2*60*1e3;return await Promise.race([A(),new Promise((b,v)=>setTimeout(()=>v(new y({message:"Request timed out",code:"TIMEOUT",source:"hard-timeout"})),Z))]),l}function ce(i,e,t){return{conversationId:i,inquiryId:t,ackSequenceNumber:e}}function re(i){return i.message.match(/Error in prompt shield/u)?"I'm having trouble with this request. Try again by rephrasing the question.":i.code==="TIMEOUT"?"I'm having trouble with this request. Try again by re-asking the same question or rephrasing it.":i.message}var ne=i=>{let e=i.value.length,t=72,s=180,o=i.offsetWidth,a=Math.max(1,Math.floor(o/8)),r=Math.ceil(e/a),n=t+(r-2)*24;i.style.setProperty("--calcite-text-area-min-height",`${Math.min(n,s)}px`)};function le({messages:i}){return c`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${i.beta??"Beta"}>${i.beta??"Beta"}</calcite-chip>`}function de({popoverContent:i}){return c`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer overlay-positioning=fixed label=legal-disclaimer placement=bottom auto-close>${i}</calcite-popover>`}function pe({errorMessage:i}){return c`<calcite-input-message id=error-message status=invalid slot=footer-start icon=exclamation-mark-triangle scale=m>${i}</calcite-input-message>`}function ue({active:i,setActive:e,messages:t}){return c`<calcite-alert slot=alerts .open=${i} placement=bottom kind=success icon=check-circle-f auto-close @calciteAlertClose=${()=>e(!1)} .label=${t.expressionapplied??"Expression applied"}><div slot=message>${t.expressionapplied??"Expression applied to editor."}</div></calcite-alert>`}function me({isDisabled:i,isReadOnly:e,setQuestion:t,setIsViewingResult:s,textAreaRef:o,question:a,errorMessage:r,setErrorMessage:n,submitQuestion:l,messages:d,mode:f}){return c`<div class="text-area-wrapper"><calcite-text-area resize=vertical .readOnly=${i||e} class="styled-text-area" .placeholder=${d.askaquestion??`Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${a} @calciteTextAreaInput=${g=>{ne(g.target),t(g.target.value)}} ${z(o)}>${r&&pe({errorMessage:r})||""}</calcite-text-area><div class="response-actions" slot=footer-end><calcite-button round kind=neutral .hidden=${f!=="refine"} icon-start=arrow-left appearance=solid .disabled=${i} @click=${async()=>{s(!1),t("")}}>${d.startover??"Start Over"}</calcite-button><calcite-button round icon-end=effects appearance=solid .loading=${i} .disabled=${i} @click=${async()=>{n(a?"":d.enteraprompt??"Please enter a prompt"),await l()}}>${f==="prompt"?d.ask??"Generate":d.refine??"Refine"}</calcite-button></div></div>`}var he="https://www.esri.com/en-us/privacy/privacy-statements/privacy-statement",ge="https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement";function be({setOpen:i,messages:e,feedback:t,setFeedback:s,onSubmit:o}){return c`<calcite-sheet class="feedback-sheet" .label=${e.feedback??"Feedback"} slot=sheets display-mode=float position=block-end .open=${t.active} @calciteSheetClose=${()=>i(!1)}><calcite-panel .heading=${e.providefeedback??"Provide feedback"} .description=${e.experiencehelps??"Your experience helps guide future improvements"}><div class="feedback-content"><calcite-label>${e.experiencehelpful??"Was the assistant helpful?"}<calcite-segmented-control scale=l><calcite-segmented-control-item icon-start=thumbs-up .checked=${t.value==="good"} @click=${()=>s({...t,value:"good"})}></calcite-segmented-control-item><calcite-segmented-control-item icon-start=thumbs-down .checked=${t.value==="bad"} @click=${()=>s({...t,value:"bad"})}></calcite-segmented-control-item></calcite-segmented-control></calcite-label><calcite-label>${e.describeexperience??"Describe your experience"}<calcite-text-area resize=vertical .value=${t.text} @calciteTextAreaInput=${a=>s({...t,text:a.target.value})}></calcite-text-area></calcite-label><calcite-label layout=inline scale=s><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${a=>{s({...t,termsAccepted:a.target.checked})}}></calcite-checkbox><span>${w(e.agreement?.replace("{EsriPrivacyStatement}",`<calcite-link href=${he} target="_blank">${e.esriprivacystatement??"Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}",`<calcite-link href=${ge} target="_blank">${e.supplement??"Supplement"}</calcite-link>`))}</span></calcite-label></div><calcite-button slot=footer width=full @click=${o} .disabled=${!t.termsAccepted||t.submitting} .loading=${t.submitting}>${e.submitfeedback??"Submit Feedback"}</calcite-button></calcite-panel></calcite-sheet>`}function W({assistantsEnabled:i,messages:e,slot:t,assistantHelpUrl:s,helpTopicUrl:o}){return c`<calcite-block .label=${e.assistantinformation??"Assistant information"} slot=${t??R} expanded class="info-block"><calcite-chip .label=${e.new??"new"} kind=brand>${e.new}</calcite-chip><h1 class="info-heading">${e.introducing}</h1><p>${e.capabilities}</p>${i?c`<p>${e.keepinmind??"Keep in mind the following:"}<ul><li>${e.beconsise??"Be concise, but also clear in your request"}</li><li>${e.avoidambiguity??"Avoid ambiguity and vagueness"}</li><li>${e.moredetails??"you do not need to use exact field names in your instructions, but more detail is generally better"}</li></ul>${w((e.seedocumentation??"Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}",`<calcite-link href=${o} target="_blank">${e.documentation??"documentation"}</calcite-link>`))}</p>`:c`<p>${w(e.useofassistant?.replace("{aiassistants}",`<strong>${e.aiassistants??"Ai Assistants"}</strong>`))}<calcite-link .href=${s} target=_blank icon-end=launch-2>${e.opensettings??"Open Settings"}</calcite-link></p>`}</calcite-block>`}function fe({messages:i,onProceed:e,onExit:t,helpTopicUrl:s}){return c`<calcite-dialog close-disabled placement=top .heading=${i.welcome} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${i.beforeyougetstarted}</h3><ul><li>${i.maybeincorrect}</li><li>${w(i.pleasereadhelp.replace("{helpTopic}",`<calcite-link href=${s} target="_blank">${i.helptopic}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${i.proceed}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${i.exit}</calcite-button></calcite-dialog>`}function ve({messages:i,suggestions:e,onSuggestionClick:t}){return c`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block><calcite-chip-group .label=${i.promptsuggestions} class="suggestion-chips">${J(e,s=>s,s=>c`<calcite-chip .label=${i.promptsuggestion} .value=${s} icon=effects @click=${()=>t?.(s)}>${s}</calcite-chip>`)}</calcite-chip-group></calcite-block>`}function ye({hidden:i=!1,expanded:e=!1,messages:t,cards:s,heading:o,collapsible:a=!1,showEffectsIcon:r=!1,editorInsertMode:n="add",setEditorInsertMode:l}){let d=n==="replace",f=d?t.replaceineditor??"Replace in editor":t.addtoeditor??"Add to editor",g=d?t.addtoeditor??"Add to editor":t.replaceineditor??"Replace in editor";return c`<calcite-block .hidden=${i} id=result-block .heading=${o??t.besteffort??"Here is the assistant's best effort"} .expanded=${e} .collapsible=${a}>${r&&c`<calcite-chip label slot=content-start icon=effects kind=brand></calcite-chip>`||""}<calcite-card-group .label=${t.assistantresponses}>${s.map((m,S)=>c`<calcite-card><div slot=heading><div class="prior-prompt">${m.priorPrompt}</div></div><div><div class="code-response-wrapper"><div class="positioned-code-content">${m.chips?.map((p,A)=>c`${p.tooltip&&c`<calcite-tooltip .referenceElement=${`response-chip-${p.conversationId}-${A}`}>${p.tooltip}</calcite-tooltip>`||""}<calcite-chip .label=${p.label} .scale=${p.scale??"s"} .appearance=${p.appearance??"outline"} .icon=${p.icon} .id=${`response-chip-${p.conversationId}-${A}`}>${p.label}</calcite-chip>`)}</div><code>${m.code}</code></div></div><div slot=footer-start><calcite-split-button primary-text=${f??R} appearance=outline-fill class="add-to-editor-button" @calciteSplitButtonPrimaryClick=${()=>m.onAddToEditor()} overlay-positioning=fixed><calcite-dropdown-item @calciteDropdownItemSelect=${()=>{l?.(d?"add":"replace")}}>${g}</calcite-dropdown-item></calcite-split-button><calcite-button round icon-start=copy-to-clipboard kind=neutral @click=${()=>m.onCopy(S)} class="copy-button">${m.copySuccessIndex===S?t.copied??"copied":""}</calcite-button></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup} scale=s icon=thumbs-up @click=${m.onThumbsUp}></calcite-action><calcite-action .text=${t.thumbsdown} scale=s icon=thumbs-down @click=${m.onThumbsDown}></calcite-action></div></calcite-card>`)}</calcite-card-group></calcite-block>`}var u={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:"Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.",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",agreement:"I agree to the {EsriPrivacyStatement} (and {Supplement}).",esriprivacystatement:"Esri Privacy Statement",supplement:"Supplement",disclaimerpt2:"AI-generated content may be inaccurate. Review before using.",replaceineditor:"Replace in editor",keepinmind:"Keep in mind the following:",beconsise:"Be concise, but also clear in your request",avoidambiguity:"Avoid ambiguity and vagueness",documentation:"documentation",useexamples:"Use examples to clarify your request",moredetails:"You do not need to use exact field names in your instructions, but more detail is generally better",seedocumentation:"Please see the {documentation} for more information, including limitations and additional resources.",assistantinformation:"Assistant information",profilecontextlabel:"Profile context: {profileName}",layercontextlabel:"Layer context: {layerName}",numlayers:"{numLayers} {layerOrLayers}",numlayersplural:"layers",numlayerssingular:"layer"},ke="arcade_generation",xe="ArcadeCodeRequest",C="visualization",$e="ArcadeAssistant",we=["your_comments","user_evaluation","question","answer","useragent","_source","version","context","extras"],K=[],X=!0,M=class extends V{constructor(){super(...arguments),this.textAreaRef=B(),this.messages=H(),this._feedbackService=void 0,this.handleFeedbackButton=(e,t)=>{this.feedback={...this.feedback,active:!0,value:e,item:t}},this.handleFeedbackSheetClose=()=>{this.feedback={active:!1,value:void 0,text:"",item:void 0,submitting:!1,termsAccepted:!1}},this.handleFeedbackSubmit=async()=>{this.feedback={...this.feedback,submitting:!0};let e=await this.ensureFeedbackService();if(!e){this.handleFeedbackSheetClose();return}let t=this.getModel(),s=t?await this.getProfileAndMetadata(t.uri):void 0,o={user_evaluation:this.feedback.value,your_comments:this.feedback.text||void 0,question:this.question,answer:this.feedback.item?.script??"",useragent:navigator.userAgent,_source:$e,version:this.appVersion??"",context:s?JSON.stringify(s):"",extras:s?.profileName??"",conversation_id:this.feedback.item?.conversationId??"",privacy_statement:this.feedback.termsAccepted?"I_agree":""};try{await e.applyEdits({addFeatures:[new se({attributes:o})]})}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,termsAccepted:!1,submitting:!1},this.copySuccessIndex=-1,this.splashActive=!0,this.editorInsertMode="add",this.helpBase="",this.assistantsEnabled=!1,this.closed=!1}static{this.properties={isViewingResult:16,confirmationActive:16,isSubmitting:16,errorMessage:16,question:16,history:16,feedback:16,copySuccessIndex:16,splashActive:16,editorInsertMode:16,closePanel:0,insertText:0,helpBase:1,assistantsEnabled:5,layer:[1,{type:Object}],orgBaseUrl:1,serviceUrl:1,closed:7,editorRef:0,feedbackServiceUrl:1,appVersion:1}}static{this.styles=ae}get disclaimerComment(){return`// ${this.messages.disclaimercomment}
5
- // ${u.disclaimerpt2}`}get assistantHelpUrl(){return`${this.helpBase??"https://doc.arcgis.com/en/arcgis-online/"}administer/configure-assistants.htm`}get helpTopicUrl(){return`${this.helpBase??"https://doc.arcgis.com/en/arcgis-online/"}create-maps/arcade-assistant.htm`}async destroy(){}connectedCallback(){super.connectedCallback(),this.history=K,this.splashActive=X}disconnectedCallback(){super.disconnectedCallback(),K=this.history,X=this.splashActive,this.copySuccessTimer&&(clearTimeout(this.copySuccessTimer),this.copySuccessTimer=void 0)}setFeedbackState(e){this.feedback=e}async ensureFeedbackService(){if(this._feedbackService)return this._feedbackService;if(!this.feedbackServiceUrl)return;let e=new ie({url:this.feedbackServiceUrl});await e.load();let t=we.filter(s=>!e.fields.some(o=>o.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:o,layerName:a}=await this.getProfileAndMetadata(t.uri),r=(await oe({baseUrl:this.serviceUrl,skillId:ke,message:this.question,authToken:e,context:{kind:xe,context:{profile_name:s,metadata:o}}})).find(n=>n.context?.kind==="ArcadeCodeResponse");if(!r)return;r.context?.kind==="ArcadeCodeResponse"&&(this.history.unshift({script:r?.context?.arcadeCode?.code,formattedScript:D(r?.context?.arcadeCode?.code??""),error:void 0,question:this.question,profile:s,conversationId:r.conversationId,layerName:a??void 0}),this.isViewingResult=!0,this.errorMessage=void 0)}catch(e){e instanceof Error&&e.name==="ArcadeAssistantError"?this.errorMessage=re(e)||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 te.getCredential(this.orgBaseUrl);return e}async getProfileAndMetadata(e){let t=C,s=j.getEditorProfileForModel(e);s?.loaded||await s?.loadSource();let o=this.editorRef.profile;o&&"id"in o&&(t=o.id);let a=s?.definition?.variables?.find(l=>l.type==="feature"),r=[],n;return a?.definition&&"fields"in a.definition&&(r=a.definition.fields.map(l=>({name:l.name,type:l.type,alias:l.alias})),Q(a?.definition)&&(n=a.definition.title)),{profileName:t,metadata:r,layerName:n}}render(){return this.closed?null:this.assistantsEnabled?c`<calcite-flow><calcite-flow-item .selected=${!this.isViewingResult} closable .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.splashActive&&c`<calcite-scrim></calcite-scrim>`||""}${le({messages:this.messages})}${de({popoverContent:W({assistantsEnabled:this.assistantsEnabled,messages:{...this.messages,...u},assistantHelpUrl:this.assistantHelpUrl,helpTopicUrl:this.helpTopicUrl})})}<calcite-shell class="unstyled-shell">${this.splashActive&&fe({messages:{...u,...this.messages},onProceed:()=>{this.splashActive=!1},helpTopicUrl:this.helpTopicUrl,onExit:e=>this.closePanel&&this.closePanel(e)})||""}${ue({active:this.confirmationActive,setActive:e=>this.confirmationActive=e,messages:this.messages})}${me({isDisabled:this.isSubmitting,isReadOnly:!1,setQuestion:this.setQuestion,setIsViewingResult:e=>this.isViewingResult=e,mode:this.isViewingResult?"refine":"prompt",textAreaRef:this.textAreaRef,question:this.question,errorMessage:this.errorMessage,setErrorMessage:e=>this.errorMessage=e,submitQuestion:this.submitQuestion.bind(this),messages:{...u,...this.messages}})}<calcite-block-group label="interactive blocks">${!this.isViewingResult&&!this.isSubmitting&&ve({messages:{...this.messages,...u},suggestions:["Round value to one decimal place",'Return "Yes" if value > 10'],onSuggestionClick:this.onSuggestionClick})||""}<calcite-block .hidden=${!this.isSubmitting} .heading=${this.messages.generatingresponse??"Generating response..."}></calcite-block>${ye({expanded:this.isViewingResult||this.history.length>0,messages:{...this.messages,...u},collapsible:!0,showEffectsIcon:this.isViewingResult,editorInsertMode:this.editorInsertMode,setEditorInsertMode:e=>this.editorInsertMode=e,cards:this.history.reduce((e,t,s)=>(!t.script||this.isViewingResult&&s>0||(e.push({priorPrompt:t.question,code:t.formattedScript||t.error||"",chips:[{label:t.profile??C,icon:"map-information",appearance:"outline",scale:"s",conversationId:t.conversationId??"",tooltip:u.profilecontextlabel.replace("{profileName}",t.profile??C)},...t.layerName?[{label:u.numlayers.replace("{numLayers}","1").replace("{layerOrLayers}",u.numlayerssingular),icon:"layer",appearance:"outline",scale:"s",conversationId:t.conversationId??"",tooltip:u.layercontextlabel.replace("{layerName}",t.layerName??"No layer")}]:[]],onAddToEditor:()=>{L(this.editorRef.editorInstance,t.formattedScript??"",this.editorInsertMode,this.disclaimerComment)},onCopy:o=>{let a=t.formattedScript?`${this.disclaimerComment}
6
- ${t.formattedScript}`:"";a&&navigator.clipboard.writeText(a).then(()=>{this.copySuccessIndex=o,this.copySuccessTimer&&clearTimeout(this.copySuccessTimer),this.copySuccessTimer=window.setTimeout(()=>{this.copySuccessIndex=-1,this.copySuccessTimer=void 0},1500)})},onThumbsUp:()=>this.handleFeedbackButton("good",t),onThumbsDown:()=>this.handleFeedbackButton("bad",t),copySuccessIndex:this.copySuccessIndex}),this.isViewingResult),e),[]),heading:this.isViewingResult?this.messages.besteffort??"Here's the assistant's best effort":this.messages.recentprompts??"Recent prompts",hidden:this.isViewingResult?!this.isViewingResult:!1})}</calcite-block-group>${this.feedback.active?be({setOpen:this.handleFeedbackSheetClose,messages:{...this.messages,...u},onSubmit:this.handleFeedbackSubmit,feedback:this.feedback,setFeedback:this.setFeedbackState.bind(this)}):null}</calcite-shell></calcite-flow-item></calcite-flow>`:c`<calcite-flow><calcite-flow-item .selected=${!this.isViewingResult} closable .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${W({slot:"content-top",messages:{...this.messages,...u},assistantsEnabled:this.assistantsEnabled,assistantHelpUrl:this.assistantHelpUrl,helpTopicUrl:this.helpTopicUrl})}</calcite-flow-item></calcite-flow>`}};O("arcgis-arcade-coding-assistant",M);return M},"identity/IdentityManager","request","layers/FeatureLayer","Graphic",a,b)