@arcgis/coding-components 4.34.0-next.80 → 4.34.0-next.82
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.
- package/dist/addons.js +1 -1
- package/dist/cdn/{TOMZIMG4.js → 2XI5HQG4.js} +1 -1
- package/dist/cdn/{FPRNXDBG.js → 3JK3BSPG.js} +2 -2
- package/dist/cdn/{QK7Q73XT.js → 4R26FJ2J.js} +2 -2
- package/dist/cdn/{W57KGVCU.js → 5KHKPMWJ.js} +2 -2
- package/dist/cdn/{4Y73AMXU.js → 6H6IBNAO.js} +2 -2
- package/dist/cdn/{VF4PFPHZ.js → AXYAWWJX.js} +2 -2
- package/dist/cdn/{G74PDVWS.js → BTR2WLZW.js} +1 -1
- package/dist/cdn/{4JMUV552.js → BZO7LHM2.js} +1 -1
- package/dist/cdn/{JVYVRBLC.js → DOXOXR5M.js} +2 -2
- package/dist/cdn/{EAMGHNH6.js → E3BGVWOJ.js} +2 -2
- package/dist/cdn/{WVFNCCMI.js → E54BEF33.js} +2 -2
- package/dist/cdn/{ZVIG4Y47.js → F3DFSE7Y.js} +2 -2
- package/dist/cdn/{2OS5X2XC.js → FE5VK3OI.js} +2 -2
- package/dist/cdn/{AQGYQUOQ.js → GMPZRGRO.js} +2 -2
- package/dist/cdn/{SCCNGSHM.js → GSKAS4W7.js} +2 -2
- package/dist/cdn/{2UYT4AIE.js → IJ7RS7OY.js} +2 -2
- package/dist/cdn/{PCK6VLVO.js → IVFZ7VQI.js} +2 -2
- package/dist/cdn/{AKPGUPVV.js → IY66GFJC.js} +2 -2
- package/dist/cdn/JIBYYQXS.js +6 -0
- package/dist/cdn/{YVIJYACH.js → JSHH33LU.js} +2 -2
- package/dist/cdn/{HRVU4WAP.js → JTK63CBV.js} +2 -2
- package/dist/cdn/{7IK425QK.js → K2TQPBTY.js} +2 -2
- package/dist/cdn/{U5WTJRL5.js → KLL2MHSX.js} +2 -2
- package/dist/cdn/{DLD53SME.js → L4OCMXM5.js} +2 -2
- package/dist/cdn/{REAEPLBS.js → M26IELRG.js} +2 -2
- package/dist/cdn/{YZNUF5RC.js → QSCFRYNH.js} +2 -2
- package/dist/cdn/{QUHAMH5S.js → QUSM7CUX.js} +1 -1
- package/dist/cdn/{OIP2MDAO.js → RTD7TCGZ.js} +2 -2
- package/dist/cdn/{SANE7NL4.js → SDA3GAWE.js} +2 -2
- package/dist/cdn/{HJFJB5HU.js → STOGMESR.js} +2 -2
- package/dist/cdn/{ZW47SU7N.js → SU2ZF27O.js} +1 -1
- package/dist/cdn/{LMNF6SPV.js → T3GRNXMR.js} +2 -2
- package/dist/cdn/{H2C3XTHM.js → U4OZGUNN.js} +2 -2
- package/dist/cdn/{7TB3DLFW.js → VHDR64H6.js} +1 -1
- package/dist/cdn/{EYGND5IK.js → WSLTUX3Q.js} +2 -2
- package/dist/cdn/{W6VLAWVY.js → XEBFZH7G.js} +2 -2
- package/dist/cdn/{MBU4K7CX.js → XLQDFADS.js} +31 -27
- package/dist/cdn/{QNK3SEAV.js → XXI6CZY3.js} +1 -1
- package/dist/cdn/{PLEGSLPL.js → YL5WFZFT.js} +4 -4
- package/dist/cdn/{JMV65XQ6.js → Z4PQQLNI.js} +2 -2
- package/dist/cdn/{NTXSDHBS.js → ZBFXBYVE.js} +2 -2
- package/dist/cdn/{WEUONTWC.js → ZKRRGED3.js} +2 -2
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +41151 -40966
- package/dist/cdn/index.js +2 -2
- package/dist/chunks/arcade-defaults.js +1 -1
- package/dist/chunks/arcade-executor.js +1 -1
- package/dist/chunks/arcade-mode.js +1 -1
- package/dist/chunks/arcade-service-accessors.js +1 -1
- package/dist/chunks/editor.js +1 -1
- package/dist/chunks/fields.js +1 -1
- package/dist/chunks/language-defaults-base.js +1 -1
- package/dist/chunks/markdown.js +23 -19
- package/dist/chunks/monaco-importer.js +1 -1
- package/dist/chunks/runtime.js +1 -1
- package/dist/chunks/setup-monaco.js +1 -1
- package/dist/chunks/sql-expr-contribution.js +1 -1
- package/dist/chunks/sql-expr-defaults.js +1 -1
- package/dist/chunks/sql-expr-mode.js +1 -1
- package/dist/chunks/useT9n.js +1 -1
- package/dist/components/arcgis-arcade-coding-assistant/customElement.js +135 -176
- package/dist/components/arcgis-arcade-coding-assistant/functional.d.ts +87 -38
- package/dist/components/arcgis-arcade-editor/customElement.js +1 -1
- package/dist/components/arcgis-arcade-results/customElement.js +1 -1
- package/dist/components/arcgis-arcade-suggestions/customElement.js +1 -1
- package/dist/components/arcgis-code-editor/customElement.js +1 -1
- package/dist/components/arcgis-editor-variables/customElement.js +1 -1
- package/dist/components/arcgis-language-api-panel/customElement.js +1 -1
- package/dist/components/arcgis-sql-expression-editor/customElement.js +1 -1
- package/dist/components/arcgis-sql-expression-fields/customElement.js +1 -1
- package/dist/docs/api.json +2 -2
- package/dist/docs/docs.json +2 -2
- package/dist/docs/web-types.json +1 -1
- package/dist/index.js +1 -1
- package/dist/loader.js +1 -1
- package/package.json +5 -5
- package/dist/cdn/ERV3IHVW.js +0 -6
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { nothing as
|
|
3
|
-
import { ref as L, createRef as
|
|
4
|
-
import
|
|
5
|
-
import { u as
|
|
1
|
+
import { c as O } from "../../chunks/runtime.js";
|
|
2
|
+
import { nothing as w, LitElement as H } from "@arcgis/lumina";
|
|
3
|
+
import { ref as L, createRef as V } from "lit/directives/ref.js";
|
|
4
|
+
import B from "@arcgis/core/identity/IdentityManager.js";
|
|
5
|
+
import { u as j } from "../../chunks/useT9n.js";
|
|
6
6
|
import { b as I } from "../../chunks/arcade-defaults.js";
|
|
7
|
-
import { css as
|
|
8
|
-
import
|
|
9
|
-
import { e as
|
|
10
|
-
import { repeat as
|
|
7
|
+
import { css as W, html as c } from "lit";
|
|
8
|
+
import T from "@arcgis/core/request.js";
|
|
9
|
+
import { e as Q, a as G } from "../../chunks/monaco-importer.js";
|
|
10
|
+
import { repeat as q } from "lit/directives/repeat.js";
|
|
11
11
|
import "@arcgis/toolkit/function";
|
|
12
|
-
import { generateGuid as
|
|
13
|
-
import { unsafeHTML as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { b as
|
|
12
|
+
import { generateGuid as J } from "@arcgis/toolkit/string";
|
|
13
|
+
import { unsafeHTML as $ } from "lit/directives/unsafe-html.js";
|
|
14
|
+
import Y from "@arcgis/core/layers/FeatureLayer.js";
|
|
15
|
+
import K from "@arcgis/core/Graphic.js";
|
|
16
|
+
import { b as X } from "../../chunks/language-defaults-base.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.
|
|
20
|
-
const
|
|
21
|
-
class
|
|
19
|
+
v4.34.0-next.82 */
|
|
20
|
+
const Z = W`:host(:not([closed])){--calcite-block-border-color: var(--calcite-color-transparent);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);.submission-actions-wrapper{display:flex;flex-direction:column;width:100%;gap:.75rem}.submission-actions{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}.gaps{display:flex;gap:.25rem}.align-inline-end{margin-inline-start:auto}.action .error-display{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.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;max-height:30vh;overflow-y:auto}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: 100%;--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;margin-block:0}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;border-radius:var(--calcite-corner-radius-round);margin:.75rem;overflow:hidden;--calcite-color-border-input: transparent;position:sticky;box-shadow:var(--calcite-shadow-sm);flex:none}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-button{font-weight:var(--calcite-font-weight-medium)}.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{display:flex;flex-direction:row;gap:.5rem;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{display:flex;flex-direction:row;padding:0;overflow-y:hidden;overflow-x:auto;margin:.25rem 0 .75rem;align-items:center;max-width:100%;span{overflow-x:auto;overflow-y:hidden}}.copy-feedback{display:none}.copy-prompt-button{align-self:flex-start;margin-inline-start:auto}.response-secondary-action-button[data-copied]+.copy-feedback,.copy-prompt-button[data-copied]+.copy-feedback{display:block;span{padding:.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-color-text--2);font-weight:var(--calcite-font-weight-medium)}}.copy-prompt-button[data-copied]~.copy-tooltip,.response-secondary-action-button[data-copied]~.copy-tooltip{display:none}code{white-space:pre;font-size:12px;margin:0;overflow-x:auto;font-family:Fira Mono,Consolas,Menlo,monospace;display:block;max-height:12rem;position:relative;padding:.5rem}.code-collapse{margin-inline-start:auto}.response-secondary-action-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}.collapsible-code{padding:.5rem}.collapsible-code summary{cursor:pointer;font-weight:500;color:var(--calcite-color-brand);outline:none;padding:.25rem 0}.collapsible-code[open] summary{color:var(--calcite-color-text-2)}.collapsible-error{padding:.5rem}.collapsible-error summary{cursor:pointer;font-weight:500;color:var(--calcite-color-status-danger);outline:none;padding:.25rem 0}.collapsible-error[open] summary{color:var(--calcite-color-text-2)}.response-error-container{padding:.5rem;background:color-mix(in srgb,var(--calcite-color-status-warning) 10%,transparent);border-radius:var(--calcite-corner-radius-round);margin:1rem 0;font-size:var(--calcite-font-size--2);--calcite-input-message-icon-color: var(--calcite-color-status-warning)}.response-error-chip{--calcite-internal-chip-background-color: var(--calcite-color-status-warning);--calcite-chip-icon-color: var(--calcite-color-foreground-1);--calcite-chip-border-color: var(--calcite-color-transparent)}.feedback-actions{gap:unset}}:host([closed]){display:none}`;
|
|
21
|
+
class y extends Error {
|
|
22
22
|
constructor({
|
|
23
23
|
message: e,
|
|
24
24
|
code: t,
|
|
25
25
|
subCode: o,
|
|
26
|
-
details:
|
|
26
|
+
details: r,
|
|
27
27
|
source: n
|
|
28
28
|
}) {
|
|
29
|
-
super(e), this.name = "ArcadeAssistantError", this.code = t, this.subCode = o, this.details =
|
|
29
|
+
super(e), this.name = "ArcadeAssistantError", this.code = t, this.subCode = o, this.details = r, this.source = n;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function R(i) {
|
|
33
33
|
if (!i)
|
|
34
34
|
return;
|
|
35
35
|
const e = i.indexOf('{"error":');
|
|
@@ -42,200 +42,159 @@ function T(i) {
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
async function
|
|
46
|
-
const { baseUrl: e, skillId: t, message: o, authToken:
|
|
45
|
+
async function ee(i) {
|
|
46
|
+
const { baseUrl: e, skillId: t, message: o, authToken: r, previousConversationId: n, context: u } = i, d = t ? `${e}/skills/${t}/chat` : `${e}/chat`, s = [], h = {
|
|
47
47
|
message: o,
|
|
48
|
-
context:
|
|
48
|
+
context: u
|
|
49
49
|
};
|
|
50
|
-
n && (
|
|
50
|
+
n && (h.conversation_id = n);
|
|
51
51
|
let a;
|
|
52
52
|
try {
|
|
53
|
-
a = await
|
|
53
|
+
a = await T(d, {
|
|
54
54
|
method: "post",
|
|
55
55
|
headers: {
|
|
56
56
|
"Content-Type": "application/json",
|
|
57
|
-
token:
|
|
57
|
+
token: r
|
|
58
58
|
},
|
|
59
|
-
body: JSON.stringify(
|
|
59
|
+
body: JSON.stringify(h),
|
|
60
60
|
responseType: "json"
|
|
61
61
|
});
|
|
62
|
-
} catch (
|
|
63
|
-
const
|
|
64
|
-
throw
|
|
62
|
+
} catch (f) {
|
|
63
|
+
const b = f, k = b.details?.rawResponse || b.message || String(f), g = R(k);
|
|
64
|
+
throw g ? new y(g) : f;
|
|
65
65
|
}
|
|
66
66
|
const l = a.data;
|
|
67
67
|
s.push(l);
|
|
68
|
-
const p = l.conversationId,
|
|
69
|
-
let
|
|
70
|
-
async function
|
|
71
|
-
let
|
|
72
|
-
const
|
|
73
|
-
for (;
|
|
68
|
+
const p = l.conversationId, F = l.inquiryId;
|
|
69
|
+
let A = l.sequenceNumber;
|
|
70
|
+
async function D() {
|
|
71
|
+
let f = 0;
|
|
72
|
+
const b = 25;
|
|
73
|
+
for (; f < b; ) {
|
|
74
74
|
await new Promise((v) => setTimeout(v, 1e3));
|
|
75
|
-
const
|
|
76
|
-
let
|
|
75
|
+
const k = te(p, A, F);
|
|
76
|
+
let g;
|
|
77
77
|
try {
|
|
78
|
-
|
|
78
|
+
g = await T(d, {
|
|
79
79
|
method: "post",
|
|
80
80
|
headers: {
|
|
81
81
|
"Content-Type": "application/json",
|
|
82
|
-
token:
|
|
82
|
+
token: r
|
|
83
83
|
},
|
|
84
|
-
body: JSON.stringify(
|
|
84
|
+
body: JSON.stringify(k),
|
|
85
85
|
responseType: "json"
|
|
86
86
|
});
|
|
87
87
|
} catch (v) {
|
|
88
|
-
const
|
|
89
|
-
throw
|
|
88
|
+
const C = v, z = C.details?.rawResponse || C.message || String(v), S = R(z);
|
|
89
|
+
throw S ? new y(S) : v;
|
|
90
90
|
}
|
|
91
|
-
const
|
|
92
|
-
if (
|
|
93
|
-
throw new
|
|
94
|
-
message:
|
|
95
|
-
code:
|
|
96
|
-
subCode:
|
|
97
|
-
details:
|
|
91
|
+
const m = g.data;
|
|
92
|
+
if (m.context && m.context.kind === "ArcgisErrorAsContext" && m.context.error)
|
|
93
|
+
throw new y({
|
|
94
|
+
message: m.context.error.message || "ArcGIS Assistant error",
|
|
95
|
+
code: m.context.error.code,
|
|
96
|
+
subCode: m.context.error.subCode,
|
|
97
|
+
details: m.context.error.details,
|
|
98
98
|
source: "polling-response"
|
|
99
99
|
});
|
|
100
|
-
if (s.push(
|
|
100
|
+
if (s.push(m), A = m.sequenceNumber, f++, !m.hasMore)
|
|
101
101
|
break;
|
|
102
102
|
}
|
|
103
|
-
if (
|
|
104
|
-
throw new
|
|
103
|
+
if (f === b)
|
|
104
|
+
throw new y({
|
|
105
105
|
message: "Request timed out",
|
|
106
106
|
code: "TIMEOUT",
|
|
107
107
|
source: "polling"
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
const
|
|
110
|
+
const _ = 2 * 60 * 1e3;
|
|
111
111
|
return await Promise.race([
|
|
112
|
-
|
|
112
|
+
D(),
|
|
113
113
|
new Promise(
|
|
114
|
-
(
|
|
115
|
-
() =>
|
|
116
|
-
new
|
|
114
|
+
(f, b) => setTimeout(
|
|
115
|
+
() => b(
|
|
116
|
+
new y({
|
|
117
117
|
message: "Request timed out",
|
|
118
118
|
code: "TIMEOUT",
|
|
119
119
|
source: "hard-timeout"
|
|
120
120
|
})
|
|
121
121
|
),
|
|
122
|
-
|
|
122
|
+
_
|
|
123
123
|
)
|
|
124
124
|
)
|
|
125
125
|
]), s;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function te(i, e, t) {
|
|
128
128
|
return {
|
|
129
129
|
conversationId: i,
|
|
130
130
|
inquiryId: t,
|
|
131
131
|
ackSequenceNumber: e
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function ie(i) {
|
|
135
135
|
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;
|
|
136
136
|
}
|
|
137
|
-
const
|
|
138
|
-
const e = i.value.length, t = 72, o = 180,
|
|
137
|
+
const oe = (i) => {
|
|
138
|
+
const e = i.value.length, t = 72, o = 180, r = i.offsetWidth, u = Math.max(1, Math.floor(r / 8)), d = Math.ceil(e / u), s = t + (d - 2) * 24;
|
|
139
139
|
i.style.setProperty("--calcite-text-area-min-height", `${Math.min(s, o)}px`);
|
|
140
140
|
};
|
|
141
|
-
function
|
|
142
|
-
return
|
|
141
|
+
function ae({ messages: i }) {
|
|
142
|
+
return c`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${i.beta ?? "Beta"}>${i.beta ?? "Beta"}</calcite-chip>`;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
return
|
|
144
|
+
function se({ popoverContent: i }) {
|
|
145
|
+
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>`;
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
return
|
|
147
|
+
function U({ errorMessage: i, slot: e }) {
|
|
148
|
+
return c`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e ?? w}>${i}</calcite-input-message></div>`;
|
|
149
149
|
}
|
|
150
150
|
function ce({ active: i, setActive: e, messages: t }) {
|
|
151
|
-
return
|
|
151
|
+
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>`;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
return i ?
|
|
153
|
+
function re({ context: i, messages: e }) {
|
|
154
|
+
return i ? c`<div class="gaps">${i.profileName && c`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel ?? "Profile context: {profileName}").replace("{profileName}", i.profileName)} reference-element=profile-context-button class="context-popover"><p>${(e.profilecontextlabel ?? "Profile context: {profileName}").replace("{profileName}", i.profileName)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button></calcite-button>` || ""}${i.layerName && c`<calcite-popover auto-close placement=top .label=${(e.layercontextlabel ?? "Layer context: {layerName}").replace("{layerName}", i.layerName)} reference-element=layer-context-button class="context-popover"><p>${(e.layercontextlabel ?? "Layer context: {layerName}").replace("{layerName}", i.layerName)}</p></calcite-popover><calcite-button round kind=neutral icon-start=layers id=layer-context-button></calcite-button>` || ""}</div>` : null;
|
|
155
155
|
}
|
|
156
|
-
function
|
|
157
|
-
return
|
|
158
|
-
|
|
159
|
-
}} ${L(
|
|
156
|
+
function ne({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult: o, textAreaRef: r, question: n, errorMessage: u, setErrorMessage: d, submitQuestion: s, messages: h, mode: a, context: l }) {
|
|
157
|
+
return c`<div class="text-area-wrapper"><calcite-text-area resize=vertical .readOnly=${i || e} class="styled-text-area" .placeholder=${h.askaquestion ?? `Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${(p) => {
|
|
158
|
+
oe(p.target), t(p.target.value);
|
|
159
|
+
}} ${L(r)}><div class="submission-actions-wrapper" slot=footer-start>${u && U({ errorMessage: u, slot: "footer-start" }) || ""}<div class="submission-actions">${re({ context: l, messages: h })}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${a !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${i} @click=${async () => {
|
|
160
160
|
o(!1), t("");
|
|
161
|
-
}}>${
|
|
162
|
-
d(n ? "" :
|
|
163
|
-
}}>${a === "prompt" ?
|
|
161
|
+
}}>${h.startover ?? "Start Over"}</calcite-button><calcite-button round icon-end=effects appearance=solid .loading=${i} .disabled=${i} @click=${async () => {
|
|
162
|
+
d(n ? "" : h.enteraprompt ?? "Please enter a prompt"), await s();
|
|
163
|
+
}}>${a === "prompt" ? h.ask ?? "Generate" : h.refine ?? "Refine"}</calcite-button></div></div></div></calcite-text-area></div>`;
|
|
164
164
|
}
|
|
165
|
-
const
|
|
166
|
-
function
|
|
167
|
-
return t.active ?
|
|
165
|
+
const le = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-statement", de = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement";
|
|
166
|
+
function pe({ setOpen: i, messages: e, feedback: t, setFeedback: o, onSubmit: r }) {
|
|
167
|
+
return t.active ? 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=${() => o({ ...t, value: "good" })}></calcite-segmented-control-item><calcite-segmented-control-item icon-start=thumbs-down .checked=${t.value === "bad"} @click=${() => o({ ...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=${(n) => o({ ...t, text: n.target.value })}></calcite-text-area></calcite-label><calcite-label layout=inline scale=s><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${(n) => {
|
|
168
168
|
o({ ...t, termsAccepted: n.target.checked });
|
|
169
|
-
}}></calcite-checkbox><span>${
|
|
169
|
+
}}></calcite-checkbox><span>${$((e.agreement ?? "I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}", `<calcite-link href=${le} target="_blank">${e.esriprivacystatement ?? "Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}", `<calcite-link href=${de} target="_blank">${e.supplement ?? "Supplement"}</calcite-link>`))}</span></calcite-label></div><calcite-button slot=footer width=full @click=${r} .disabled=${!t.termsAccepted || t.submitting} .loading=${t.submitting}>${e.submitfeedback ?? "Submit Feedback"}</calcite-button></calcite-panel></calcite-sheet>` : null;
|
|
170
170
|
}
|
|
171
|
-
function
|
|
172
|
-
return
|
|
171
|
+
function E({ assistantsEnabled: i, messages: e, slot: t, assistantHelpUrl: o, helpTopicUrl: r }) {
|
|
172
|
+
return c`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${t ?? w} expanded class="info-block"><calcite-chip .label=${e.new ?? "New"} kind=brand>${e.new ?? "New"}</calcite-chip><h1 class="info-heading">${e.introducing ?? "Introducing Arcade Assistant (beta)"}</h1><p>${e.capabilities ?? "The assistant uses artificial intelligence to generate Arcade expressions."}</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>${$((e.seedocumentation ?? "Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}", `<calcite-link href=${r} target="_blank">${e.documentation ?? "documentation"}</calcite-link>`))}</p>` : c`<p>${$(e.useofassistant?.replace("{aiassistants}", `<strong>${e.aiassistants ?? "Ai Assistants"}</strong>`))}<calcite-link .href=${o} target=_blank icon-end=launch-2>${e.opensettings ?? "Open Settings"}</calcite-link></p>`}</calcite-block>`;
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
return
|
|
174
|
+
function ue({ messages: i, onProceed: e, onExit: t, helpTopicUrl: o }) {
|
|
175
|
+
return c`<calcite-dialog close-disabled placement=top .heading=${i.welcome ?? "Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${i.beforeyougetstarted ?? "Before you get started be aware:"}</h3><ul><li>${i.maybeincorrect ?? "AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${$((i.pleasereadhelp ?? "Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.").replace("{helpTopic}", `<calcite-link href=${o} target="_blank">${i.helptopic ?? "help topic"}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${i.proceed ?? "Proceed"}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${i.exit ?? "Exit"}</calcite-button></calcite-dialog>`;
|
|
176
176
|
}
|
|
177
|
-
function
|
|
178
|
-
return
|
|
177
|
+
function he({ messages: i, suggestions: e, onSuggestionClick: t }) {
|
|
178
|
+
return c`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block><calcite-chip-group class="suggestions" .label=${i.promptsuggestions ?? "Prompt Suggestions"}>${q(e, (o) => o, (o) => c`<calcite-button round appearance=outline-fill kind=neutral .label=${i.promptsuggestion} class="suggestion-button" @click=${() => t?.(o)}>${o}</calcite-button>`)}</calcite-chip-group></calcite-block>`;
|
|
179
179
|
}
|
|
180
|
-
function
|
|
181
|
-
const
|
|
182
|
-
return
|
|
180
|
+
function N({ hidden: i = !1, expanded: e = !1, messages: t, cards: o, heading: r, collapsible: n = !1, showEffectsIcon: u = !1, onCopyCode: d, standalone: s }) {
|
|
181
|
+
const h = t.addtoeditor ?? "Add to editor";
|
|
182
|
+
return c`<calcite-block .hidden=${i} id=result-block .heading=${r ?? t.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${u && c`<calcite-chip .label=${t.assistantresponses ?? "Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>` || ""}<calcite-card-group .label=${t.assistantresponses ?? "Assistant responses"}>${q(o, (a) => a.conversationId, (a) => c`<calcite-card><div slot=heading><div class="prior-prompt"><span>${a.priorPrompt}</span><calcite-action icon=duplicate scale=s slot=actions-end class="copy-prompt-button" text .id=${`copy-prompt-${a.conversationId}-${s ? "standalone" : "list"}`} @click=${(l) => {
|
|
183
183
|
const p = l.currentTarget;
|
|
184
184
|
navigator.clipboard.writeText(a.priorPrompt).then(() => {
|
|
185
185
|
p.setAttribute("data-copied", "true"), setTimeout(() => p.removeAttribute("data-copied"), 1500);
|
|
186
186
|
});
|
|
187
|
-
}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard}</calcite-tooltip></div>${a.message && s &&
|
|
188
|
-
const p =
|
|
189
|
-
return
|
|
190
|
-
})}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><code>${a.code}</code></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button primary-text=${
|
|
187
|
+
}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard ?? "Copy prompt to clipboard"}</calcite-tooltip></div>${a.message && s && c`<div class="response-error-container">${U({ errorMessage: a.message })}</div>` || ""}</div><div><div class="code-response-wrapper"><div class="positioned-code-content"><calcite-chip-group .label=${t.responsecontext ?? "Response Context"} scale=s>${a.message && !s && c`<calcite-tooltip .referenceElement=${`response-chip-${a.conversationId}-error`} placement=top-start overlay-positioning=fixed>${a.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${a.conversationId}-error`} .label=${t.error ?? "Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>` || ""}${a.chips?.map((l) => {
|
|
188
|
+
const p = J();
|
|
189
|
+
return c`${l.tooltip && c`<calcite-tooltip .referenceElement=${`response-chip-${l.conversationId}-${p}`} placement=top-start overlay-positioning=fixed>${l.tooltip}</calcite-tooltip>` || ""}<calcite-chip .label=${l.label} .scale=${l.scale ?? "s"} .appearance=${l.appearance ?? "outline"} .icon=${l.icon} .id=${`response-chip-${l.conversationId}-${p}`}>${l.label}</calcite-chip>`;
|
|
190
|
+
})}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><code>${a.code}</code></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button primary-text=${h ?? w} class="add-to-editor-button" @click=${() => a.onAddToEditor("add")} overlay-positioning=fixed scale=s icon-start=plus round>${t.addtoeditor ?? "Add to editor"}</calcite-button><calcite-button round icon-start=file-code kind=neutral scale=s @click=${() => a.onAddToEditor("replace")} class="response-secondary-action-button" .id=${`replace-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start><span>${t.replaceineditor ?? "Replace all code in editor"}</span></calcite-tooltip><calcite-button round icon-start=copy-to-clipboard kind=neutral scale=s @click=${(l) => {
|
|
191
191
|
const p = l.currentTarget;
|
|
192
192
|
d(a.code).then(() => {
|
|
193
193
|
p.setAttribute("data-copied", "true"), setTimeout(() => p.removeAttribute("data-copied"), 1500);
|
|
194
194
|
});
|
|
195
|
-
}} class="response-secondary-action-button" .id=${`copy-response-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-response-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${t.copytoclipboard}</calcite-tooltip></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup} scale=s icon=thumbs-up @click=${a.onThumbsUp} .id=${`thumbs-up-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start><span>${t.helpful ?? "Helpful"}</span></calcite-tooltip><calcite-action .text=${t.thumbsdown} scale=s icon=thumbs-down @click=${a.onThumbsDown} .id=${`thumbs-down-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start><span>${t.unhelpful ?? "Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`;
|
|
195
|
+
}} class="response-secondary-action-button" .id=${`copy-response-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-response-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${t.copytoclipboard ?? "Copy code to clipboard"}</calcite-tooltip></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup ?? "Thumbs up"} scale=s icon=thumbs-up @click=${a.onThumbsUp} .id=${`thumbs-up-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start><span>${t.helpful ?? "Helpful"}</span></calcite-tooltip><calcite-action .text=${t.thumbsdown ?? "Thumbs down"} scale=s icon=thumbs-down @click=${a.onThumbsDown} .id=${`thumbs-down-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start><span>${t.unhelpful ?? "Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`;
|
|
196
196
|
}
|
|
197
|
-
const
|
|
198
|
-
welcome: "Welcome to the new assistant experience",
|
|
199
|
-
beforeyougetstarted: "Before you get started be aware:",
|
|
200
|
-
maybeincorrect: "AI generated code may occasionally be incorrect or biased. Review carefully.",
|
|
201
|
-
pleasereadhelp: "Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.",
|
|
202
|
-
proceed: "Proceed",
|
|
203
|
-
exit: "Exit",
|
|
204
|
-
promptsuggestions: "Prompt suggestions",
|
|
205
|
-
promptsuggestion: "Prompt suggestion",
|
|
206
|
-
assistantresponses: "Assistant responses",
|
|
207
|
-
collapse: "Collapse",
|
|
208
|
-
thumbsup: "Thumbs up",
|
|
209
|
-
thumbsdown: "Thumbs down",
|
|
210
|
-
refine: "Refine",
|
|
211
|
-
startover: "Start over",
|
|
212
|
-
helptopic: "help topic",
|
|
213
|
-
agreement: "I agree to the {EsriPrivacyStatement} (and {Supplement}).",
|
|
214
|
-
esriprivacystatement: "Esri Privacy Statement",
|
|
215
|
-
supplement: "Supplement",
|
|
216
|
-
disclaimerpt2: "AI-generated content may be inaccurate. Review before using.",
|
|
217
|
-
replaceineditor: "Replace all code in editor",
|
|
218
|
-
keepinmind: "Keep in mind the following:",
|
|
219
|
-
beconsise: "Be concise, but also clear in your request",
|
|
220
|
-
avoidambiguity: "Avoid ambiguity and vagueness",
|
|
221
|
-
documentation: "documentation",
|
|
222
|
-
useexamples: "Use examples to clarify your request",
|
|
223
|
-
moredetails: "You do not need to use exact field names in your instructions, but more detail is generally better",
|
|
224
|
-
seedocumentation: "Please see the {documentation} for more information, including limitations and additional resources.",
|
|
225
|
-
assistantinformation: "Assistant information",
|
|
226
|
-
profilecontextlabel: "Profile context: {profileName}",
|
|
227
|
-
layercontextlabel: "Layer context: {layerName}",
|
|
228
|
-
numlayers: "{numLayers} {layerOrLayers}",
|
|
229
|
-
numlayersplural: "layers",
|
|
230
|
-
numlayerssingular: "layer",
|
|
231
|
-
responsecontext: "Response context",
|
|
232
|
-
error: "Error",
|
|
233
|
-
copytoclipboard: "Copy code to clipboard",
|
|
234
|
-
copyprompttoclipboard: "Copy prompt to clipboard",
|
|
235
|
-
copiedsuccessfully: "Copied successfully",
|
|
236
|
-
helpful: "Helpful",
|
|
237
|
-
unhelpful: "Unhelpful"
|
|
238
|
-
}, fe = "arcade_generation", be = "ArcadeCodeRequest", w = "visualization", ge = "ArcadeAssistant", ye = [
|
|
197
|
+
const me = "arcade_generation", fe = "ArcadeCodeRequest", x = "visualization", be = "ArcadeAssistant", ge = [
|
|
239
198
|
"your_comments",
|
|
240
199
|
"user_evaluation",
|
|
241
200
|
"question",
|
|
@@ -246,10 +205,10 @@ const u = {
|
|
|
246
205
|
"context",
|
|
247
206
|
"extras"
|
|
248
207
|
];
|
|
249
|
-
let M = [],
|
|
250
|
-
class ve extends
|
|
208
|
+
let M = [], P = !0;
|
|
209
|
+
class ve extends H {
|
|
251
210
|
constructor() {
|
|
252
|
-
super(...arguments), this.textAreaRef =
|
|
211
|
+
super(...arguments), this.textAreaRef = V(), this.messages = j(), this._feedbackService = void 0, this.handleFeedbackButton = (e, t) => {
|
|
253
212
|
this.feedback = { active: !0, value: e, item: t, termsAccepted: !1, text: "", submitting: !1 };
|
|
254
213
|
}, this.handleFeedbackSheetClose = () => {
|
|
255
214
|
this.feedback = {
|
|
@@ -264,7 +223,7 @@ class ve extends V {
|
|
|
264
223
|
this.handleFeedbackSheetClose();
|
|
265
224
|
return;
|
|
266
225
|
}
|
|
267
|
-
const t = this.getModel(), o = t ? await this.getProfileAndMetadata(t.uri) : void 0,
|
|
226
|
+
const t = this.getModel(), o = t ? await this.getProfileAndMetadata(t.uri) : void 0, r = {
|
|
268
227
|
user_evaluation: this.feedback.value,
|
|
269
228
|
your_comments: this.feedback.text || void 0,
|
|
270
229
|
question: this.feedback.item?.question ?? "",
|
|
@@ -276,7 +235,7 @@ class ve extends V {
|
|
|
276
235
|
*/
|
|
277
236
|
answer: encodeURIComponent(this.feedback.item?.formattedScript ?? ""),
|
|
278
237
|
useragent: navigator.userAgent,
|
|
279
|
-
_source:
|
|
238
|
+
_source: be,
|
|
280
239
|
version: this.appVersion ?? "",
|
|
281
240
|
context: o ? JSON.stringify(o) : "",
|
|
282
241
|
extras: o?.profileName ?? "",
|
|
@@ -284,7 +243,7 @@ class ve extends V {
|
|
|
284
243
|
privacy_statement: this.feedback.termsAccepted ? "I_agree" : ""
|
|
285
244
|
};
|
|
286
245
|
try {
|
|
287
|
-
await e.applyEdits({ addFeatures: [new
|
|
246
|
+
await e.applyEdits({ addFeatures: [new K({ attributes: r })] });
|
|
288
247
|
} catch (n) {
|
|
289
248
|
console.error("Error submitting feedback:", n);
|
|
290
249
|
}
|
|
@@ -303,11 +262,11 @@ class ve extends V {
|
|
|
303
262
|
this.properties = { isViewingResult: 16, confirmationActive: 16, isSubmitting: 16, errorMessage: 16, question: 16, history: 16, feedback: 16, splashActive: 16, context: 16, historyCards: 16, closePanel: 0, insertText: 0, helpBase: 1, assistantsEnabled: 5, layer: [1, { type: Object }], portalUrl: 1, serviceUrl: 1, closed: 7, editorRef: 0, feedbackServiceUrl: 1, appVersion: 1 };
|
|
304
263
|
}
|
|
305
264
|
static {
|
|
306
|
-
this.styles =
|
|
265
|
+
this.styles = Z;
|
|
307
266
|
}
|
|
308
267
|
get disclaimerComment() {
|
|
309
268
|
return `// ${this.messages.disclaimercomment}
|
|
310
|
-
// ${
|
|
269
|
+
// ${this.messages.disclaimerpt2 ?? "AI-generated content may be inaccurate. Review before using."}`;
|
|
311
270
|
}
|
|
312
271
|
get assistantHelpUrl() {
|
|
313
272
|
return `${this.helpBase ?? "https://doc.arcgis.com/en/arcgis-online/"}administer/configure-assistants.htm`;
|
|
@@ -342,10 +301,10 @@ class ve extends V {
|
|
|
342
301
|
e.has("history") && (this.historyCards = this.getHistoryCards());
|
|
343
302
|
}
|
|
344
303
|
connectedCallback() {
|
|
345
|
-
super.connectedCallback(), this.history = M, this.splashActive =
|
|
304
|
+
super.connectedCallback(), this.history = M, this.splashActive = P;
|
|
346
305
|
}
|
|
347
306
|
disconnectedCallback() {
|
|
348
|
-
super.disconnectedCallback(), M = this.history,
|
|
307
|
+
super.disconnectedCallback(), M = this.history, P = this.splashActive, this.copySuccessTimer && (clearTimeout(this.copySuccessTimer), this.copySuccessTimer = void 0);
|
|
349
308
|
}
|
|
350
309
|
getHistoryCards() {
|
|
351
310
|
return this.history.reduce((e, t) => (!t.script || (e.push({
|
|
@@ -353,26 +312,26 @@ class ve extends V {
|
|
|
353
312
|
code: t.formattedScript || t.error || "",
|
|
354
313
|
chips: [
|
|
355
314
|
{
|
|
356
|
-
label: t.profile ??
|
|
315
|
+
label: t.profile ?? x,
|
|
357
316
|
icon: "map-information",
|
|
358
317
|
appearance: "outline",
|
|
359
318
|
scale: "s",
|
|
360
319
|
conversationId: t.conversationId ?? "",
|
|
361
|
-
tooltip:
|
|
320
|
+
tooltip: (this.messages.profilecontextlabel ?? "Profile context: {profileName}").replace("{profileName}", t.profile ?? x)
|
|
362
321
|
},
|
|
363
322
|
...t.layerName ? [
|
|
364
323
|
{
|
|
365
|
-
label:
|
|
324
|
+
label: (this.messages.numlayers ?? "{numLayers} {layerOrLayers}").replace("{numLayers}", "1").replace("{layerOrLayers}", this.messages.numlayerssingular ?? "layer"),
|
|
366
325
|
icon: "layer",
|
|
367
326
|
appearance: "outline",
|
|
368
327
|
scale: "s",
|
|
369
328
|
conversationId: t.conversationId ?? "",
|
|
370
|
-
tooltip:
|
|
329
|
+
tooltip: (this.messages.layercontextlabel ?? "Layer context: {layerName}").replace("{layerName}", t.layerName ?? "No layer")
|
|
371
330
|
}
|
|
372
331
|
] : []
|
|
373
332
|
],
|
|
374
333
|
onAddToEditor: (o) => {
|
|
375
|
-
|
|
334
|
+
Q(this.editorRef.editorInstance, t.formattedScript ?? "", o, this.disclaimerComment);
|
|
376
335
|
},
|
|
377
336
|
onThumbsUp: () => this.handleFeedbackButton("good", t),
|
|
378
337
|
onThumbsDown: () => this.handleFeedbackButton("bad", t),
|
|
@@ -388,9 +347,9 @@ class ve extends V {
|
|
|
388
347
|
return this._feedbackService;
|
|
389
348
|
if (!this.feedbackServiceUrl)
|
|
390
349
|
return;
|
|
391
|
-
const e = new
|
|
350
|
+
const e = new Y({ url: this.feedbackServiceUrl });
|
|
392
351
|
await e.load();
|
|
393
|
-
const t =
|
|
352
|
+
const t = ge.filter((o) => !e.fields.some((r) => r.name === o));
|
|
394
353
|
if (t.length > 0) {
|
|
395
354
|
console.error(`Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);
|
|
396
355
|
return;
|
|
@@ -407,16 +366,16 @@ class ve extends V {
|
|
|
407
366
|
const e = await this.getToken(), t = this.getModel();
|
|
408
367
|
if (!t)
|
|
409
368
|
return;
|
|
410
|
-
const { profileName: o, metadata:
|
|
369
|
+
const { profileName: o, metadata: r, layerName: n } = await this.getProfileAndMetadata(t.uri), d = (await ee({
|
|
411
370
|
baseUrl: this.serviceUrl,
|
|
412
|
-
skillId:
|
|
371
|
+
skillId: me,
|
|
413
372
|
message: this.question,
|
|
414
373
|
authToken: e,
|
|
415
374
|
context: {
|
|
416
|
-
kind:
|
|
375
|
+
kind: fe,
|
|
417
376
|
context: {
|
|
418
377
|
profile_name: o,
|
|
419
|
-
metadata:
|
|
378
|
+
metadata: r
|
|
420
379
|
}
|
|
421
380
|
}
|
|
422
381
|
})).find((s) => s.context?.kind === "ArcadeCodeResponse");
|
|
@@ -425,7 +384,7 @@ class ve extends V {
|
|
|
425
384
|
d.context?.kind === "ArcadeCodeResponse" && (this.history = [
|
|
426
385
|
{
|
|
427
386
|
script: d?.context?.arcadeCode?.code,
|
|
428
|
-
formattedScript:
|
|
387
|
+
formattedScript: G(d?.context?.arcadeCode?.code ?? ""),
|
|
429
388
|
error: void 0,
|
|
430
389
|
question: this.question,
|
|
431
390
|
profile: o,
|
|
@@ -436,29 +395,29 @@ class ve extends V {
|
|
|
436
395
|
...this.history
|
|
437
396
|
], this.isViewingResult = !0, this.errorMessage = void 0);
|
|
438
397
|
} catch (e) {
|
|
439
|
-
e instanceof Error && e.name === "ArcadeAssistantError" ? this.errorMessage =
|
|
398
|
+
e instanceof Error && e.name === "ArcadeAssistantError" ? this.errorMessage = ie(e) || this.messages.erroroccurred || "An error occurred." : this.errorMessage = this.messages.erroroccurred || "An error occurred.", console.error("Error in Arcade Assistant:", e);
|
|
440
399
|
} finally {
|
|
441
400
|
this.isSubmitting = !1;
|
|
442
401
|
}
|
|
443
402
|
}
|
|
444
403
|
}
|
|
445
404
|
async getToken() {
|
|
446
|
-
const { token: e } = await
|
|
405
|
+
const { token: e } = await B.getCredential(this.portalUrl);
|
|
447
406
|
return e;
|
|
448
407
|
}
|
|
449
408
|
async getProfileAndMetadata(e) {
|
|
450
|
-
let t =
|
|
409
|
+
let t = x;
|
|
451
410
|
const o = I.getEditorProfileForModel(e);
|
|
452
411
|
o?.loaded || await o?.loadSource();
|
|
453
|
-
const
|
|
454
|
-
|
|
412
|
+
const r = this.editorRef.profile;
|
|
413
|
+
r && "id" in r && (t = r.id);
|
|
455
414
|
const n = o?.definition?.variables?.find((s) => s.type === "feature");
|
|
456
|
-
let
|
|
457
|
-
return n?.definition && "fields" in n.definition && (
|
|
415
|
+
let u = [], d;
|
|
416
|
+
return n?.definition && "fields" in n.definition && (u = n.definition.fields.map((s) => ({
|
|
458
417
|
name: s.name,
|
|
459
418
|
type: s.type,
|
|
460
419
|
alias: s.alias
|
|
461
|
-
})),
|
|
420
|
+
})), X(n?.definition) && (d = n.definition.title)), { profileName: t, metadata: u, layerName: d };
|
|
462
421
|
}
|
|
463
422
|
onCopyCode(e) {
|
|
464
423
|
const t = e ? `${this.disclaimerComment}
|
|
@@ -466,11 +425,11 @@ ${e}` : "";
|
|
|
466
425
|
return navigator.clipboard.writeText(t);
|
|
467
426
|
}
|
|
468
427
|
render() {
|
|
469
|
-
return this.closed ? null : this.assistantsEnabled ?
|
|
428
|
+
return this.closed ? null : this.assistantsEnabled ? c`<calcite-flow><calcite-flow-item closable .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.splashActive && c`<calcite-scrim></calcite-scrim>` || ""}${ae({ messages: this.messages })}${se({ popoverContent: E({ assistantsEnabled: this.assistantsEnabled, messages: this.messages, assistantHelpUrl: this.assistantHelpUrl, helpTopicUrl: this.usingTheAssitantDocUrl }) })}<calcite-shell class="unstyled-shell">${this.splashActive && ue({ messages: this.messages, onProceed: () => {
|
|
470
429
|
this.splashActive = !1;
|
|
471
|
-
}, helpTopicUrl: this.assistantOverviewDocUrl, onExit: (e) => this.closePanel && this.closePanel(e) }) || ""}${ce({ active: this.confirmationActive, setActive: (e) => this.confirmationActive = e, messages: this.messages })}${
|
|
430
|
+
}, helpTopicUrl: this.assistantOverviewDocUrl, onExit: (e) => this.closePanel && this.closePanel(e) }) || ""}${ce({ 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: this.messages, context: this.context })}<calcite-block-group label="interactive blocks">${!this.isViewingResult && !this.isSubmitting && he({ messages: this.messages, 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>${N({
|
|
472
431
|
expanded: this.isViewingResult,
|
|
473
|
-
messages:
|
|
432
|
+
messages: this.messages,
|
|
474
433
|
collapsible: !0,
|
|
475
434
|
showEffectsIcon: !0,
|
|
476
435
|
/** Only show the latest history card */
|
|
@@ -479,9 +438,9 @@ ${e}` : "";
|
|
|
479
438
|
hidden: this.isSubmitting || !this.isViewingResult,
|
|
480
439
|
onCopyCode: this.onCopyCode.bind(this),
|
|
481
440
|
standalone: !0
|
|
482
|
-
})}${
|
|
441
|
+
})}${N({
|
|
483
442
|
expanded: !this.isViewingResult,
|
|
484
|
-
messages:
|
|
443
|
+
messages: this.messages,
|
|
485
444
|
collapsible: !0,
|
|
486
445
|
/**
|
|
487
446
|
* When the user is viewing the latest result, we display the first history card
|
|
@@ -493,10 +452,10 @@ ${e}` : "";
|
|
|
493
452
|
heading: this.messages.recentprompts ?? "Recent prompts",
|
|
494
453
|
hidden: this.isSubmitting || this.history.length === 0,
|
|
495
454
|
onCopyCode: this.onCopyCode.bind(this)
|
|
496
|
-
})}</calcite-block-group>${this.feedback.active ?
|
|
455
|
+
})}</calcite-block-group>${this.feedback.active ? pe({ setOpen: this.handleFeedbackSheetClose, messages: this.messages, 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}>${E({ slot: "content-top", messages: this.messages, assistantsEnabled: this.assistantsEnabled, assistantHelpUrl: this.assistantHelpUrl, helpTopicUrl: this.usingTheAssitantDocUrl })}</calcite-flow-item></calcite-flow>`;
|
|
497
456
|
}
|
|
498
457
|
}
|
|
499
|
-
|
|
458
|
+
O("arcgis-arcade-coding-assistant", ve);
|
|
500
459
|
export {
|
|
501
460
|
ve as ArcgisArcadeCodingAssistant
|
|
502
461
|
};
|