@arcgis/coding-components 5.2.0-next.37 → 5.2.0-next.39
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/cdn/{7UTCJERR.js → 3GRKKTYQ.js} +1 -1
- package/dist/cdn/{NCMXRX7O.js → 4QNMR5NW.js} +1 -1
- package/dist/cdn/{RAQ6HDUB.js → 4V5NFGNR.js} +1 -1
- package/dist/cdn/{O6L3YJ7J.js → 5K5DDG2C.js} +1 -1
- package/dist/cdn/{3EOAL7MF.js → 7SURDYX4.js} +1 -1
- package/dist/cdn/BHSILWSL.js +2 -0
- package/dist/cdn/{P22DALGG.js → CQGO2II3.js} +1 -1
- package/dist/cdn/EMQBDJQ3.js +12 -0
- package/dist/cdn/{T5PTHYE5.js → F6Z5WEDU.js} +1 -1
- package/dist/cdn/{NVWQE3SF.js → FWPYCHBG.js} +1 -1
- package/dist/cdn/{VEOKKZ5A.js → GK3HVDQS.js} +1 -1
- package/dist/cdn/{6R2FXATY.js → GYUNPBTY.js} +1 -1
- package/dist/cdn/HEBBVPMA.js +4 -0
- package/dist/cdn/HLQUADW2.js +2 -0
- package/dist/cdn/{YTISJUMJ.js → IFX7ICOO.js} +1 -1
- package/dist/cdn/J4I4EROF.js +2 -0
- package/dist/cdn/K24YQANH.js +2 -0
- package/dist/cdn/{H46YVJ4O.js → L3GFDKCY.js} +1 -1
- package/dist/cdn/{DD277QPZ.js → NQ5VM5Q4.js} +1 -1
- package/dist/cdn/{7RQSIZ7E.js → OVFMBZUS.js} +1 -1
- package/dist/cdn/{PJBI5XFD.js → PNEPKSPT.js} +1 -1
- package/dist/cdn/{76VHPECE.js → PO76ZDMR.js} +1 -1
- package/dist/cdn/{MFDNJU3K.js → PPBXN5AK.js} +1 -1
- package/dist/cdn/{BGTP5CFY.js → STFE2ZCD.js} +1 -1
- package/dist/cdn/{GTE3KXNK.js → TQ47LLD6.js} +1 -1
- package/dist/cdn/{JLYAOSQM.js → V4NV6D3P.js} +1 -1
- package/dist/cdn/V54TNFNK.js +2 -0
- package/dist/cdn/{TUQ7FMSM.js → WAAXG4WA.js} +1 -1
- package/dist/cdn/{DTRK3XAL.js → WC3ODJHV.js} +1 -1
- package/dist/cdn/{PPCC4HZ7.js → WU3OQFNP.js} +1 -1
- package/dist/cdn/X7ATUFY6.js +2 -0
- package/dist/cdn/{QL6XH6JU.js → YC4IAUAP.js} +1 -1
- package/dist/cdn/YX3K5MMD.js +2 -0
- package/dist/cdn/{EYE5UNR2.js → ZRBCALQH.js} +1 -1
- package/dist/cdn/{BCXSPP2P.js → ZVA7RR25.js} +1 -1
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/components/arcgis-arcade-coding-assistant/customElement.js +194 -175
- package/dist/components/arcgis-code-editor-shell/customElement.js +1 -1
- package/dist/components/arcgis-code-viewer/customElement.js +5 -4
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +5 -5
- package/dist/cdn/5RWI53UM.js +0 -2
- package/dist/cdn/B73HLERI.js +0 -2
- package/dist/cdn/DLHM6CVW.js +0 -4
- package/dist/cdn/N55NA6XU.js +0 -2
- package/dist/cdn/NP37C536.js +0 -2
- package/dist/cdn/OHGKRQIT.js +0 -2
- package/dist/cdn/S4UOB65K.js +0 -2
- package/dist/cdn/XSKI5PRU.js +0 -2
- package/dist/cdn/ZJADYRM6.js +0 -12
- /package/dist/cdn/{VGOFAQ7A.js → BFPEJYVB.js} +0 -0
- /package/dist/cdn/{ECNI2A4K.js → XEK22IDA.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
2
|
import { c as ae } from "../../chunks/runtime.js";
|
|
3
3
|
import { css as se, html as d } from "lit";
|
|
4
|
-
import { nothing as
|
|
4
|
+
import { nothing as P, safeClassMap as ne, LitElement as re } from "@arcgis/lumina";
|
|
5
5
|
import { ref as ce, createRef as le } from "lit/directives/ref.js";
|
|
6
6
|
import de from "@arcgis/core/identity/IdentityManager.js";
|
|
7
7
|
import { u as pe } from "../../chunks/useT9n.js";
|
|
@@ -11,7 +11,7 @@ import { e as ue, a as he } from "../../chunks/utilities.js";
|
|
|
11
11
|
import { repeat as X } from "lit/directives/repeat.js";
|
|
12
12
|
import "@arcgis/toolkit/function";
|
|
13
13
|
import { generateGuid as me } from "@arcgis/toolkit/string";
|
|
14
|
-
import { unsafeHTML as
|
|
14
|
+
import { unsafeHTML as T } from "lit/directives/unsafe-html.js";
|
|
15
15
|
import fe from "@arcgis/core/layers/FeatureLayer.js";
|
|
16
16
|
import U from "@arcgis/core/config.js";
|
|
17
17
|
import L from "@arcgis/core/Graphic.js";
|
|
@@ -20,17 +20,17 @@ import { getDeclaredVoxelMembers as be, getDeclaredPixelMembers as ge } from "@a
|
|
|
20
20
|
import { s as ve } from "../../chunks/fields.js";
|
|
21
21
|
import { f as Z, m as ee, n as ye } from "../../chunks/utils.js";
|
|
22
22
|
import we from "@arcgis/core/core/Accessor.js";
|
|
23
|
-
import { property as
|
|
23
|
+
import { property as b, subclass as $e } from "@arcgis/core/core/accessorSupport/decorators.js";
|
|
24
24
|
const xe = se`:host(:not([closed])){container-type:size;--calcite-block-border-color: var(--calcite-color-transparent);box-sizing:border-box;.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}@container (max-width: 380px){.hidden-below-380{display:none}}@container (min-width: 380px){.hidden-above-380{display:none}}.gaps{display:flex;gap:.25rem}.align-inline-end{margin-inline-start:auto}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.feedback-content{padding:var(--calcite-spacing-sm);display:flex;flex-direction:column;max-height:75cqb;overflow-y:auto;>*{margin-block-end:.5rem}>*:last-child,.terms-label{margin-block-end:0}calcite-text-area{--calcite-text-area-min-height: 4rem}calcite-notice{margin-block-start:0}}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: 100%;--calcite-sheet-min-height: auto}.feedback-footer{display:flex;justify-content:flex-end;gap:.5rem;width:100%}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}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-dialog{--calcite-dialog-content-space: initial;--calcite-dialog-size-y: initial}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}calcite-list-item calcite-button{margin-inline-end:.25rem}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}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;flex-direction:column}calcite-text-area{height:auto;overflow:hidden;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}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}.contained-popover-or-tooltip{--calcite-popover-max-size-x: 100%;--calcite-tooltip-max-size-x: 100%}.info-heading{font-size:var(--calcite-font-size-0);color:var(--calcite-color-text-1);margin:0}.info-heading-row{display:flex;align-items:center;gap:var(--calcite-spacing-sm);flex-wrap:wrap}.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)}.suggestions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs);flex-wrap:wrap}.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-border-color: transparent;width:100%}.positioned-code-content{display:flex;flex-direction:row;gap:.5rem;padding:.5rem}calcite-card [slot=heading] 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}.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)}.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}.contained{max-width:100%;max-height:100%;max-width:100cqi;max-height:75cqb;overflow-y:auto}.submission-notice{--calcite-notice-border-color: transparent;margin-block:0;width:100%;--calcite-font-size-relative-base: var(--calcite-font-size--2)}.border-block-end{border-block-end:1px solid var(--calcite-color-border-3)}.round-top{border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0}}:host([closed]){display:none}`;
|
|
25
25
|
class A extends Error {
|
|
26
26
|
constructor({
|
|
27
27
|
message: e,
|
|
28
28
|
code: t,
|
|
29
29
|
subCode: o,
|
|
30
|
-
details:
|
|
30
|
+
details: s,
|
|
31
31
|
source: n
|
|
32
32
|
}) {
|
|
33
|
-
super(e), this.name = "ArcadeAssistantError", this.code = t, this.subCode = o, this.details =
|
|
33
|
+
super(e), this.name = "ArcadeAssistantError", this.code = t, this.subCode = o, this.details = s, this.source = n;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
function O(i) {
|
|
@@ -47,52 +47,52 @@ function O(i) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
async function ke(i) {
|
|
50
|
-
const { baseUrl: e, skillId: t, message: o, authToken:
|
|
50
|
+
const { baseUrl: e, skillId: t, message: o, authToken: s, previousConversationId: n, context: r } = i, p = t ? `${e}/skills/${t}/chat` : `${e}/chat`, c = [], a = {
|
|
51
51
|
message: o,
|
|
52
|
-
context:
|
|
52
|
+
context: r
|
|
53
53
|
};
|
|
54
|
-
n && (
|
|
54
|
+
n && (a.conversation_id = n);
|
|
55
55
|
let u;
|
|
56
56
|
try {
|
|
57
57
|
u = await N(p, {
|
|
58
58
|
method: "post",
|
|
59
59
|
headers: {
|
|
60
60
|
"Content-Type": "application/json",
|
|
61
|
-
token:
|
|
61
|
+
token: s
|
|
62
62
|
},
|
|
63
|
-
body: JSON.stringify(
|
|
63
|
+
body: JSON.stringify(a),
|
|
64
64
|
responseType: "json"
|
|
65
65
|
});
|
|
66
|
-
} catch (
|
|
67
|
-
const
|
|
68
|
-
throw
|
|
66
|
+
} catch (g) {
|
|
67
|
+
const v = g, x = v.details?.rawResponse || v.message || String(g), S = O(x);
|
|
68
|
+
throw S ? new A(S) : g;
|
|
69
69
|
}
|
|
70
70
|
const l = u.data;
|
|
71
|
-
|
|
72
|
-
const
|
|
71
|
+
c.push(l);
|
|
72
|
+
const m = l.conversationId, k = l.inquiryId;
|
|
73
73
|
let $ = l.sequenceNumber;
|
|
74
|
-
async function
|
|
75
|
-
let
|
|
76
|
-
const
|
|
77
|
-
for (;
|
|
78
|
-
await new Promise((
|
|
79
|
-
const x = Se(
|
|
80
|
-
let
|
|
74
|
+
async function I() {
|
|
75
|
+
let g = 0;
|
|
76
|
+
const v = 100;
|
|
77
|
+
for (; g < v; ) {
|
|
78
|
+
await new Promise((C) => setTimeout(C, 1e3));
|
|
79
|
+
const x = Se(m, $, k);
|
|
80
|
+
let S;
|
|
81
81
|
try {
|
|
82
|
-
|
|
82
|
+
S = await N(p, {
|
|
83
83
|
method: "post",
|
|
84
84
|
headers: {
|
|
85
85
|
"Content-Type": "application/json",
|
|
86
|
-
token:
|
|
86
|
+
token: s
|
|
87
87
|
},
|
|
88
88
|
body: JSON.stringify(x),
|
|
89
89
|
responseType: "json"
|
|
90
90
|
});
|
|
91
|
-
} catch (
|
|
92
|
-
const q =
|
|
93
|
-
throw _ ? new A(_) :
|
|
91
|
+
} catch (C) {
|
|
92
|
+
const q = C, oe = q.details?.rawResponse || q.message || String(C), _ = O(oe);
|
|
93
|
+
throw _ ? new A(_) : C;
|
|
94
94
|
}
|
|
95
|
-
const y =
|
|
95
|
+
const y = S.data;
|
|
96
96
|
if (y.context?.kind === "ArcgisErrorAsContext" && y.context.error)
|
|
97
97
|
throw new A({
|
|
98
98
|
message: y.context.error.message || "ArcGIS Assistant error",
|
|
@@ -101,32 +101,32 @@ async function ke(i) {
|
|
|
101
101
|
details: y.context.error.details,
|
|
102
102
|
source: "polling-response"
|
|
103
103
|
});
|
|
104
|
-
if (
|
|
104
|
+
if (c.push(y), $ = y.sequenceNumber, g++, !y.hasMore)
|
|
105
105
|
break;
|
|
106
106
|
}
|
|
107
|
-
if (
|
|
107
|
+
if (g === v)
|
|
108
108
|
throw new A({
|
|
109
109
|
message: "Request timed out",
|
|
110
110
|
code: "TIMEOUT",
|
|
111
111
|
source: "polling"
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
-
const
|
|
114
|
+
const E = 120 * 1e3;
|
|
115
115
|
return await Promise.race([
|
|
116
|
-
|
|
116
|
+
I(),
|
|
117
117
|
new Promise(
|
|
118
|
-
(
|
|
119
|
-
() =>
|
|
118
|
+
(g, v) => setTimeout(
|
|
119
|
+
() => v(
|
|
120
120
|
new A({
|
|
121
121
|
message: "Request timed out",
|
|
122
122
|
code: "TIMEOUT",
|
|
123
123
|
source: "hard-timeout"
|
|
124
124
|
})
|
|
125
125
|
),
|
|
126
|
-
|
|
126
|
+
E
|
|
127
127
|
)
|
|
128
128
|
)
|
|
129
|
-
]),
|
|
129
|
+
]), c;
|
|
130
130
|
}
|
|
131
131
|
function Se(i, e, t) {
|
|
132
132
|
return {
|
|
@@ -135,13 +135,13 @@ function Se(i, e, t) {
|
|
|
135
135
|
ackSequenceNumber: e
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function Ce(i) {
|
|
139
139
|
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" ? "Request timed out. Try again by re-asking the same question or rephrasing it." : i.message;
|
|
140
140
|
}
|
|
141
|
-
const
|
|
142
|
-
const e = i.value.length, t = 72, o = 180,
|
|
143
|
-
i.style.setProperty("--calcite-text-area-min-height", `${Math.min(
|
|
144
|
-
}, Ie = ({ promptValidationMessage: i, errorMessage: e, contextTooBig: t, contextReducedNoticeDismissed: o, setContextReducedNoticeDismissed:
|
|
141
|
+
const Ae = ({ notices: i }) => i.length ? d`<div class="border-block-end">${X(i, (e) => e.id ?? e.title, (e) => d`<calcite-notice class="submission-notice" .icon=${e.icon} .kind=${e.kind} scale=s open .closable=${e.closable} @calciteNoticeClose=${() => e.onClose?.()}><div slot=title>${e.title}</div>${e.message && d`<div slot=message>${e.message}</div>` || ""}${e.actionLinkMessage && e.onAction && d`<calcite-link slot=link @click=${() => e.onAction?.()}>${e.actionLinkMessage}</calcite-link>` || ""}</calcite-notice>`)}</div>` : null, Te = (i) => {
|
|
142
|
+
const e = i.value.length, t = 72, o = 180, s = i.offsetWidth, r = Math.max(1, Math.floor(s / 8)), p = Math.ceil(e / r), c = t + (p - 2) * 24;
|
|
143
|
+
i.style.setProperty("--calcite-text-area-min-height", `${Math.min(c, o)}px`);
|
|
144
|
+
}, Ie = ({ promptValidationMessage: i, errorMessage: e, contextTooBig: t, contextReducedNoticeDismissed: o, setContextReducedNoticeDismissed: s, setErrorMessage: n, messages: r }) => {
|
|
145
145
|
const p = [];
|
|
146
146
|
if (i && p.push({
|
|
147
147
|
id: "prompt-validation",
|
|
@@ -157,15 +157,15 @@ const Ce = ({ notices: i }) => i.length ? d`<div class="border-block-end">${X(i,
|
|
|
157
157
|
closable: !0,
|
|
158
158
|
onClose: () => n(void 0)
|
|
159
159
|
}), t && !o) {
|
|
160
|
-
const
|
|
160
|
+
const c = r.contextreduced ?? "Context reduced", a = r.contextreducedmessage ?? "The editor profile is too large for the assistant. It has been reduced in the assistant in order to ensure a successful request.";
|
|
161
161
|
p.push({
|
|
162
162
|
id: "context-reduced",
|
|
163
163
|
kind: "warning",
|
|
164
164
|
icon: "exclamation-mark-triangle",
|
|
165
|
-
title:
|
|
166
|
-
message:
|
|
165
|
+
title: c,
|
|
166
|
+
message: a,
|
|
167
167
|
closable: !0,
|
|
168
|
-
onClose: () =>
|
|
168
|
+
onClose: () => s(!0)
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
return p;
|
|
@@ -177,7 +177,7 @@ function Re({ popoverContent: i, messages: e }) {
|
|
|
177
177
|
return d`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer .label=${e.legaldisclaimer ?? "Legal disclaimer"} placement=bottom auto-close focus-trap-disabled><div class="contained">${i}</div></calcite-popover>`;
|
|
178
178
|
}
|
|
179
179
|
function Fe({ errorMessage: i, slot: e }) {
|
|
180
|
-
return d`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e ??
|
|
180
|
+
return d`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e ?? P}>${i}</calcite-input-message></div>`;
|
|
181
181
|
}
|
|
182
182
|
function Me({ active: i, setActive: e, messages: t }) {
|
|
183
183
|
return d`<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>`;
|
|
@@ -185,104 +185,104 @@ function Me({ active: i, setActive: e, messages: t }) {
|
|
|
185
185
|
function Ve({ context: i, messages: e }) {
|
|
186
186
|
return i ? d`<div class="gaps">${i.profileId && d`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button scale=s></calcite-button>` || ""}</div>` : null;
|
|
187
187
|
}
|
|
188
|
-
function Pe({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult: o, textAreaRef:
|
|
189
|
-
const
|
|
190
|
-
promptValidationMessage:
|
|
191
|
-
errorMessage:
|
|
192
|
-
contextTooBig:
|
|
193
|
-
contextReducedNoticeDismissed:
|
|
194
|
-
setContextReducedNoticeDismissed:
|
|
188
|
+
function Pe({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult: o, textAreaRef: s, question: n, errorMessage: r, setErrorMessage: p, promptValidationMessage: c, setPromptValidationMessage: a, submitQuestion: u, messages: l, mode: m, assistantRef: k, context: $, contextReducedNoticeDismissed: I, setContextReducedNoticeDismissed: E }) {
|
|
189
|
+
const g = $?.contextTooLarge ?? !1, v = Ie({
|
|
190
|
+
promptValidationMessage: c,
|
|
191
|
+
errorMessage: r,
|
|
192
|
+
contextTooBig: g,
|
|
193
|
+
contextReducedNoticeDismissed: I,
|
|
194
|
+
setContextReducedNoticeDismissed: E,
|
|
195
195
|
setErrorMessage: p,
|
|
196
196
|
messages: l
|
|
197
197
|
});
|
|
198
|
-
return d`<div class="text-area-wrapper">${
|
|
198
|
+
return d`<div class="text-area-wrapper">${Ae({ notices: v })}<calcite-text-area scale=s resize=vertical .readOnly=${i || e} class=${ne(v.length ? "submission-text-area" : "submission-text-area round-top")} .placeholder=${l.askaquestion ?? `Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${(x) => {
|
|
199
199
|
Te(x.target), t(x.target.value);
|
|
200
|
-
}} ${ce(
|
|
200
|
+
}} ${ce(s)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${$ && Ve({ context: $, messages: l }) || ""}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${m !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid scale=s .disabled=${i} @click=${async () => {
|
|
201
201
|
o(!1), t("");
|
|
202
|
-
}} .label=${l.startover ?? "Start Over"} class="hidden-above-380" id=small-start-over-button></calcite-button><calcite-tooltip reference-element=small-start-over-button placement=top-start class="hidden-above-380">${l.startover ?? "Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${
|
|
202
|
+
}} .label=${l.startover ?? "Start Over"} class="hidden-above-380" id=small-start-over-button></calcite-button><calcite-tooltip reference-element=small-start-over-button placement=top-start class="hidden-above-380">${l.startover ?? "Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${m !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${i} @click=${async () => {
|
|
203
203
|
o(!1), t("");
|
|
204
204
|
}} class="hidden-below-380" scale=s>${l.startover ?? "Start Over"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${i} .disabled=${i} @click=${async () => {
|
|
205
205
|
if (p(""), !n) {
|
|
206
|
-
|
|
206
|
+
a(l.enteraprompt ?? "Please enter a prompt");
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
|
-
|
|
210
|
-
}} class="hidden-below-380">${
|
|
209
|
+
a(void 0), await u();
|
|
210
|
+
}} class="hidden-below-380">${m === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${i} .disabled=${i} id=small-submit-button @click=${async () => {
|
|
211
211
|
if (p(""), !n) {
|
|
212
|
-
|
|
212
|
+
a(l.enteraprompt ?? "Please enter a prompt");
|
|
213
213
|
return;
|
|
214
214
|
}
|
|
215
|
-
|
|
216
|
-
}} class="hidden-above-380" .label=${
|
|
215
|
+
a(void 0), await u();
|
|
216
|
+
}} class="hidden-above-380" .label=${m === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}></calcite-button><calcite-tooltip reference-element=small-submit-button placement=top-start class="hidden-above-380">${m === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}</calcite-tooltip></div></div></div></calcite-text-area></div>`;
|
|
217
217
|
}
|
|
218
218
|
const qe = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement", _e = "https://www.esri.com/en-us/privacy/privacy-statements";
|
|
219
|
-
function De({ setOpen: i, messages: e, feedback: t, learnMoreUrl: o, setFeedback:
|
|
220
|
-
return t.active ? d`<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.submitfeedback ?? "Submit feedback to Esri"} scale=s><div class="feedback-content"><calcite-text-area scale=s resize=vertical .value=${t.text} @calciteTextAreaInput=${(
|
|
221
|
-
|
|
222
|
-
}} .disabled=${t.submitting}></calcite-checkbox><span>${
|
|
219
|
+
function De({ setOpen: i, messages: e, feedback: t, learnMoreUrl: o, setFeedback: s, onSubmit: n }) {
|
|
220
|
+
return t.active ? d`<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.submitfeedback ?? "Submit feedback to Esri"} scale=s><div class="feedback-content"><calcite-text-area scale=s resize=vertical .value=${t.text} @calciteTextAreaInput=${(r) => s({ ...t, text: r.target.value })} .disabled=${t.submitting} .placeholder=${e.donotincludepersonalinfo ?? "Do not include personal or sensitive information"} rows=3></calcite-text-area><calcite-label layout=inline scale=s class="terms-label"><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${(r) => {
|
|
221
|
+
s({ ...t, termsAccepted: r.target.checked });
|
|
222
|
+
}} .disabled=${t.submitting}></calcite-checkbox><span>${T((e.agreement ?? "I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}", `<calcite-link href=${_e} target="_blank">${e.esriprivacystatement ?? "Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}", `<calcite-link href=${qe} target="_blank">${e.supplement ?? "Supplement"}</calcite-link>`))}</span></calcite-label><calcite-notice scale=s open closable><span slot=message>${T((e.feedbackhelps ?? "Your feedback will be used to improve Esri products and services. {LearnMore} about how this data is used.").replace("{LearnMore}", `<calcite-link href=${o} target="_blank">${e.learnmore ?? "Learn more"}</calcite-link>`))}</span></calcite-notice></div><div slot=footer class="feedback-footer"><calcite-button kind=neutral appearance=outline @click=${() => i(!1)} .disabled=${t.submitting}>${e.cancel ?? "Cancel"}</calcite-button><calcite-button @click=${n} .disabled=${!t.termsAccepted || t.submitting} .loading=${t.submitting} data-testid=submit-feedback-button>${e.submit ?? "Submit"}</calcite-button></div></calcite-panel></calcite-sheet>` : null;
|
|
223
223
|
}
|
|
224
224
|
function z({ promptingEnabled: i, messages: e, slot: t, helpTopicUrl: o }) {
|
|
225
|
-
return d`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${t ??
|
|
225
|
+
return d`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${t ?? P} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing ?? "Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new ?? "New"} kind=brand scale=s>${e.new ?? "New"}</calcite-chip></div>${i ? d`<p>${e.capabilities ?? "The assistant uses artificial intelligence to generate Arcade expressions."}</p><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>${T((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>` : d`<p>${e.useofassistant ?? "The assistant uses artificial intelligence to generate Arcade expressions. To enable Arcade Assistant (beta), the following must be true:"}</p><ul><li>${e.enabledinorg ?? "AI assistants are enabled in the organization settings"}</li><li>${e.enabledbetaapps ?? "Beta apps and capabilities are not blocked"}</li><li>${e.enabledroleprivilege ?? "Your role privilege allows you to use AI assistants"}</li></ul>`}</calcite-block>`;
|
|
226
226
|
}
|
|
227
227
|
function Ne({ messages: i, onProceed: e, onExit: t, helpTopicUrl: o }) {
|
|
228
|
-
return d`<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>${
|
|
228
|
+
return d`<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>${T((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>`;
|
|
229
229
|
}
|
|
230
230
|
function Ue({ messages: i, suggestions: e, onSuggestionClick: t }) {
|
|
231
231
|
return d`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map((o) => d`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${i.promptsuggestion} class="suggestion-button" @click=${() => t?.(o)}>${o}</calcite-button>`)}</div></calcite-block>`;
|
|
232
232
|
}
|
|
233
233
|
const B = 200;
|
|
234
|
-
function j({ hidden: i = !1, expanded: e = !1, messages: t, cards: o, heading:
|
|
235
|
-
return d`<calcite-block .hidden=${i} id=result-block .heading=${
|
|
234
|
+
function j({ hidden: i = !1, expanded: e = !1, messages: t, cards: o, heading: s, collapsible: n = !1, showEffectsIcon: r = !1, onCopyCode: p, standalone: c }) {
|
|
235
|
+
return d`<calcite-block .hidden=${i} id=result-block .heading=${s ?? t.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${r && d`<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"}>${X(o, (a) => a.conversationId, (a) => d`<calcite-card><div slot=heading><div class="prior-prompt"><span>${a.priorPrompt.length > B ? `${a.priorPrompt.slice(0, B)}...` : a.priorPrompt}</span><calcite-action icon=duplicate scale=s slot=actions-end class="copy-prompt-button" text .id=${`copy-prompt-${a.conversationId}-${c ? "standalone" : "list"}`} @click=${(u) => {
|
|
236
236
|
const l = u.currentTarget;
|
|
237
|
-
navigator.clipboard.writeText(
|
|
237
|
+
navigator.clipboard.writeText(a.priorPrompt).then(() => {
|
|
238
238
|
l.setAttribute("data-copied", "true"), setTimeout(() => l.removeAttribute("data-copied"), 1500);
|
|
239
239
|
});
|
|
240
|
-
}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${
|
|
240
|
+
}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${a.conversationId}-${c ? "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}-${c ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard ?? "Copy prompt to clipboard"}</calcite-tooltip></div>${a.message && c && d`<div class="response-error-container">${Fe({ 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 && !c && d`<calcite-tooltip .referenceElement=${`response-chip-${a.conversationId}-error`} placement=top-start>${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>` || ""}${Le({ card: a, messages: t })}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><arcgis-code-viewer language=arcade round>${a.code}</arcgis-code-viewer></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button class="add-to-editor-button hidden-above-380" @click=${() => a.onAddToEditor("add")} scale=s icon-start=plus round .label=${t.addtoeditor ?? "Add to editor"} .id=${`add-to-editor-button-${a.conversationId}-${c ? "standalone" : "list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start>${t.addtoeditor ?? "Add to editor"}</calcite-tooltip><calcite-button class="add-to-editor-button hidden-below-380" @click=${() => a.onAddToEditor("add")} 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}-${c ? "standalone" : "list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${a.conversationId}-${c ? "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=${(u) => {
|
|
241
241
|
const l = u.currentTarget;
|
|
242
|
-
p(
|
|
242
|
+
p(a.code).then(() => {
|
|
243
243
|
l.setAttribute("data-copied", "true"), setTimeout(() => l.removeAttribute("data-copied"), 1500);
|
|
244
244
|
});
|
|
245
|
-
}} class="response-secondary-action-button" .id=${`copy-response-${
|
|
245
|
+
}} class="response-secondary-action-button" .id=${`copy-response-${a.conversationId}-${c ? "standalone" : "list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${a.conversationId}-${c ? "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}-${c ? "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}-${c ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${a.conversationId}-${c ? "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}-${c ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start><span>${t.unhelpful ?? "Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`;
|
|
246
246
|
}
|
|
247
247
|
const Le = ({ card: i, messages: e }) => {
|
|
248
|
-
const t = me(), o = `response-chip-profile-${i.conversationId}-${t}`,
|
|
249
|
-
return d`<calcite-tooltip .referenceElement=${o} placement=top-start class="contained-popover-or-tooltip">${
|
|
248
|
+
const t = me(), o = `response-chip-profile-${i.conversationId}-${t}`, s = (e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId);
|
|
249
|
+
return d`<calcite-tooltip .referenceElement=${o} placement=top-start class="contained-popover-or-tooltip">${s}</calcite-tooltip><calcite-chip .label=${i.profileId} scale=s appearance=outline icon=map-information id=${o ?? P}>${i.profileId}</calcite-chip>`;
|
|
250
250
|
}, H = (i) => i.type === "featureSet";
|
|
251
251
|
function te(i) {
|
|
252
252
|
return i && i !== "dataCatalogDatastore" ? i : void 0;
|
|
253
253
|
}
|
|
254
|
-
const
|
|
254
|
+
const R = (i) => {
|
|
255
255
|
if (!ye(i))
|
|
256
256
|
return [];
|
|
257
257
|
const e = [];
|
|
258
258
|
return i.relationships?.forEach((t) => {
|
|
259
259
|
e.push(t.toJSON());
|
|
260
260
|
}), e;
|
|
261
|
-
},
|
|
261
|
+
}, F = (i) => i.length > 0 ? { relationships: i } : {}, Oe = (i) => ve(i).map((e) => ({
|
|
262
262
|
alias: e.alias,
|
|
263
263
|
name: e.name,
|
|
264
264
|
type: e.type,
|
|
265
265
|
...e.domain ? { domain: e.domain } : {}
|
|
266
|
-
})),
|
|
266
|
+
})), M = (i) => i ? { fields: Oe(i) } : { fields: [] };
|
|
267
267
|
async function G(i) {
|
|
268
|
-
const e = await i.loadSource(), t = ee(e) && e.isTable, o =
|
|
268
|
+
const e = await i.loadSource(), t = ee(e) && e.isTable, o = R(e);
|
|
269
269
|
return {
|
|
270
270
|
name: i.name,
|
|
271
271
|
type: "featureSet",
|
|
272
272
|
isTable: t,
|
|
273
|
-
...
|
|
274
|
-
...
|
|
273
|
+
...M(e?.fields),
|
|
274
|
+
...F(o)
|
|
275
275
|
};
|
|
276
276
|
}
|
|
277
277
|
async function ie(i) {
|
|
278
278
|
switch (i.type) {
|
|
279
279
|
case "feature": {
|
|
280
|
-
const t = await i.loadSource(), o =
|
|
280
|
+
const t = await i.loadSource(), o = R(t);
|
|
281
281
|
return {
|
|
282
282
|
name: i.name,
|
|
283
283
|
type: i.type,
|
|
284
|
-
...
|
|
285
|
-
...
|
|
284
|
+
...M(t?.fields),
|
|
285
|
+
...F(o)
|
|
286
286
|
};
|
|
287
287
|
}
|
|
288
288
|
case "featureSet": {
|
|
@@ -291,17 +291,17 @@ async function ie(i) {
|
|
|
291
291
|
name: i.name,
|
|
292
292
|
type: "featureSet",
|
|
293
293
|
...o ? { isTable: o } : {},
|
|
294
|
-
...
|
|
295
|
-
...R(
|
|
294
|
+
...M(t?.fields),
|
|
295
|
+
...F(R(t))
|
|
296
296
|
};
|
|
297
297
|
}
|
|
298
298
|
case "featureSetCollection": {
|
|
299
|
-
const t = await i.loadSource(), o = t?.layers.filter(H) ?? [],
|
|
299
|
+
const t = await i.loadSource(), o = t?.layers.filter(H) ?? [], s = t?.tables.filter(H) ?? [], n = await Promise.all(o.map(G)), r = await Promise.all(s.map(G));
|
|
300
300
|
return {
|
|
301
301
|
name: i.name,
|
|
302
302
|
type: "featureSetCollection",
|
|
303
303
|
layers: n,
|
|
304
|
-
tables:
|
|
304
|
+
tables: r
|
|
305
305
|
};
|
|
306
306
|
}
|
|
307
307
|
case "dictionary": {
|
|
@@ -388,7 +388,7 @@ function je(i) {
|
|
|
388
388
|
const e = new TextEncoder().encode(i).length;
|
|
389
389
|
return Math.ceil(e / 3.5);
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function V(i) {
|
|
392
392
|
return je(JSON.stringify(i));
|
|
393
393
|
}
|
|
394
394
|
function He(i) {
|
|
@@ -442,60 +442,60 @@ function He(i) {
|
|
|
442
442
|
};
|
|
443
443
|
}
|
|
444
444
|
function Ge(i) {
|
|
445
|
-
const e = i.variables, t = e.length, o = e.find((n) => n.name === "$feature") ?? e.find((n) => n.type === "feature") ?? e[0],
|
|
445
|
+
const e = i.variables, t = e.length, o = e.find((n) => n.name === "$feature") ?? e.find((n) => n.type === "feature") ?? e[0], s = o ? [o] : [];
|
|
446
446
|
return {
|
|
447
|
-
context: { variables:
|
|
448
|
-
wasReduced: t !==
|
|
447
|
+
context: { variables: s },
|
|
448
|
+
wasReduced: t !== s.length,
|
|
449
449
|
reducedToVariableName: o?.name
|
|
450
450
|
};
|
|
451
451
|
}
|
|
452
452
|
function Je(i) {
|
|
453
|
-
return
|
|
453
|
+
return V(i) > Be;
|
|
454
454
|
}
|
|
455
|
-
var Qe = Object.defineProperty, We = Object.getOwnPropertyDescriptor,
|
|
456
|
-
for (var
|
|
457
|
-
(
|
|
458
|
-
return o &&
|
|
455
|
+
var Qe = Object.defineProperty, We = Object.getOwnPropertyDescriptor, f = (i, e, t, o) => {
|
|
456
|
+
for (var s = o > 1 ? void 0 : o ? We(e, t) : e, n = i.length - 1, r; n >= 0; n--)
|
|
457
|
+
(r = i[n]) && (s = (o ? r(e, t, s) : r(s)) || s);
|
|
458
|
+
return o && s && Qe(e, t, s), s;
|
|
459
459
|
};
|
|
460
460
|
let h = class extends we {
|
|
461
461
|
constructor(i) {
|
|
462
462
|
super(i), this.viewMode = "prompt", this.confirmationActive = !1, this.contextReducedNoticeDismissed = !1, this.splashActive = !0, this.isSubmitting = !1, this.question = "", this.history = [], this.feedback = { active: !1 };
|
|
463
463
|
}
|
|
464
464
|
};
|
|
465
|
-
|
|
466
|
-
|
|
465
|
+
f([
|
|
466
|
+
b()
|
|
467
467
|
], h.prototype, "viewMode", 2);
|
|
468
|
-
|
|
469
|
-
|
|
468
|
+
f([
|
|
469
|
+
b()
|
|
470
470
|
], h.prototype, "confirmationActive", 2);
|
|
471
|
-
|
|
472
|
-
|
|
471
|
+
f([
|
|
472
|
+
b()
|
|
473
473
|
], h.prototype, "contextReducedNoticeDismissed", 2);
|
|
474
|
-
|
|
475
|
-
|
|
474
|
+
f([
|
|
475
|
+
b()
|
|
476
476
|
], h.prototype, "splashActive", 2);
|
|
477
|
-
|
|
478
|
-
|
|
477
|
+
f([
|
|
478
|
+
b()
|
|
479
479
|
], h.prototype, "isSubmitting", 2);
|
|
480
|
-
|
|
481
|
-
|
|
480
|
+
f([
|
|
481
|
+
b()
|
|
482
482
|
], h.prototype, "errorMessage", 2);
|
|
483
|
-
|
|
484
|
-
|
|
483
|
+
f([
|
|
484
|
+
b()
|
|
485
485
|
], h.prototype, "promptValidationMessage", 2);
|
|
486
|
-
|
|
487
|
-
|
|
486
|
+
f([
|
|
487
|
+
b()
|
|
488
488
|
], h.prototype, "question", 2);
|
|
489
|
-
|
|
490
|
-
|
|
489
|
+
f([
|
|
490
|
+
b()
|
|
491
491
|
], h.prototype, "history", 2);
|
|
492
|
-
|
|
493
|
-
|
|
492
|
+
f([
|
|
493
|
+
b()
|
|
494
494
|
], h.prototype, "feedback", 2);
|
|
495
|
-
|
|
496
|
-
|
|
495
|
+
f([
|
|
496
|
+
b()
|
|
497
497
|
], h.prototype, "context", 2);
|
|
498
|
-
h =
|
|
498
|
+
h = f([
|
|
499
499
|
$e("ArcadeAssistantViewState")
|
|
500
500
|
], h);
|
|
501
501
|
const Ye = "arcade_generation", Ke = "ArcadeCodeRequest", Q = "visualization", W = "ArcadeAssistant", Xe = [
|
|
@@ -530,19 +530,30 @@ class Ze extends re {
|
|
|
530
530
|
return;
|
|
531
531
|
}
|
|
532
532
|
let t = !1, o;
|
|
533
|
-
this.viewState.feedback.item.
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
533
|
+
if (this.viewState.feedback.item.isCurrentResult && this.viewState.viewMode === "result") {
|
|
534
|
+
const m = this.viewState.context ?? await this.getProfileAndMetadata(this.getModel()?.uri ?? ""), k = this.viewState.feedback.item.contextSnapshot;
|
|
535
|
+
o = {
|
|
536
|
+
...m,
|
|
537
|
+
// while we use the full profileContext, we want to use the snapshotted context for the editor code and diagnostics,
|
|
538
|
+
// that way if the user has edited the code since the result was generated, we don't log their edits, but rather the code that was used to generate the result.
|
|
539
|
+
editor_code: k?.editor_code ?? "",
|
|
540
|
+
diagnostics: k?.diagnostics
|
|
541
|
+
}, t = !0;
|
|
542
|
+
} else
|
|
543
|
+
o = this.viewState.feedback.item.contextSnapshot;
|
|
544
|
+
const s = U.applicationName;
|
|
545
|
+
!s && !this.appVersion && w("warn", this, "esriConfig.applicationName is not set. Consider setting it to help identify the application version in feedback.");
|
|
546
|
+
const { value: n, text: r, termsAccepted: p, item: { question: c, formattedScript: a, conversationId: u } } = this.viewState.feedback, l = {
|
|
537
547
|
user_evaluation: n,
|
|
538
|
-
your_comments:
|
|
539
|
-
question:
|
|
540
|
-
answer: this.
|
|
548
|
+
your_comments: r || void 0,
|
|
549
|
+
question: c ?? "",
|
|
550
|
+
answer: this.encodeForFeedback(a),
|
|
541
551
|
useragent: navigator.userAgent,
|
|
542
552
|
_source: W,
|
|
543
|
-
version: this.appVersion ||
|
|
553
|
+
version: this.appVersion || s || "NOT_SET",
|
|
544
554
|
context: o ? JSON.stringify({
|
|
545
555
|
...o,
|
|
556
|
+
editor_code: this.encodeForFeedback(o.editor_code),
|
|
546
557
|
/** Indicates whether the context is a snapshot or the full context */
|
|
547
558
|
isSnapshot: !t
|
|
548
559
|
}) : "",
|
|
@@ -552,8 +563,8 @@ class Ze extends re {
|
|
|
552
563
|
};
|
|
553
564
|
try {
|
|
554
565
|
await e.applyEdits({ addFeatures: [new L({ attributes: l })] });
|
|
555
|
-
} catch (
|
|
556
|
-
w("error", this, "Error submitting feedback.", { detail: { error:
|
|
566
|
+
} catch (m) {
|
|
567
|
+
w("error", this, "Error submitting feedback.", { detail: { error: m } });
|
|
557
568
|
}
|
|
558
569
|
this.handleFeedbackSheetClose();
|
|
559
570
|
}, this.handleClose = (e) => {
|
|
@@ -613,8 +624,8 @@ class Ze extends re {
|
|
|
613
624
|
this.manager.onLifecycle(() => {
|
|
614
625
|
e();
|
|
615
626
|
const t = D.onModelContextDidChange(async () => {
|
|
616
|
-
e().catch((
|
|
617
|
-
w("error", this, "Error setting context.", { detail: { error:
|
|
627
|
+
e().catch((s) => {
|
|
628
|
+
w("error", this, "Error setting context.", { detail: { error: s } });
|
|
618
629
|
});
|
|
619
630
|
});
|
|
620
631
|
return { remove: () => {
|
|
@@ -630,10 +641,17 @@ class Ze extends re {
|
|
|
630
641
|
return {
|
|
631
642
|
...e,
|
|
632
643
|
metadata: t,
|
|
633
|
-
estimatedTokens:
|
|
644
|
+
estimatedTokens: V(t)
|
|
634
645
|
};
|
|
635
646
|
}
|
|
636
|
-
|
|
647
|
+
withEditorState(e, t) {
|
|
648
|
+
return {
|
|
649
|
+
...e,
|
|
650
|
+
editor_code: t?.getValue() ?? this.getModel()?.getValue() ?? "",
|
|
651
|
+
diagnostics: this.diagnostics
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
encodeForFeedback(e) {
|
|
637
655
|
return encodeURIComponent(e ?? "");
|
|
638
656
|
}
|
|
639
657
|
updateViewState(e) {
|
|
@@ -660,7 +678,7 @@ class Ze extends re {
|
|
|
660
678
|
return;
|
|
661
679
|
const e = new fe({ url: this.feedbackServiceUrl });
|
|
662
680
|
await e.load();
|
|
663
|
-
const t = Xe.filter((o) => !e.fields.some((
|
|
681
|
+
const t = Xe.filter((o) => !e.fields.some((s) => s.name === o));
|
|
664
682
|
if (t.length > 0) {
|
|
665
683
|
w("error", this, `Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);
|
|
666
684
|
return;
|
|
@@ -673,28 +691,28 @@ class Ze extends re {
|
|
|
673
691
|
let t;
|
|
674
692
|
try {
|
|
675
693
|
t = await this.ensureFeedbackService();
|
|
676
|
-
} catch (
|
|
677
|
-
w("error", this, "Error initializing feedback service for interaction logging.", { detail: { error:
|
|
694
|
+
} catch (r) {
|
|
695
|
+
w("error", this, "Error initializing feedback service for interaction logging.", { detail: { error: r } });
|
|
678
696
|
return;
|
|
679
697
|
}
|
|
680
698
|
if (!t)
|
|
681
699
|
return;
|
|
682
|
-
const o = U.applicationName,
|
|
700
|
+
const o = U.applicationName, s = e.contextSnapshot, n = {
|
|
683
701
|
question: e.question,
|
|
684
|
-
answer: this.
|
|
702
|
+
answer: this.encodeForFeedback(e.answer),
|
|
685
703
|
useragent: navigator.userAgent,
|
|
686
704
|
_source: W,
|
|
687
705
|
version: this.appVersion || o || "NOT_SET",
|
|
688
706
|
// we send the snapshotted context in the automatic logging, rather than the full context, to avoid accidentally logging sensitive information that may be in the full context.
|
|
689
|
-
context:
|
|
690
|
-
extras:
|
|
707
|
+
context: s ? JSON.stringify({ ...s, isSnapshot: !0 }) : "",
|
|
708
|
+
extras: s?.profileId ?? "",
|
|
691
709
|
conversation_id: e.conversationId ?? "",
|
|
692
710
|
privacy_statement: ""
|
|
693
711
|
};
|
|
694
712
|
try {
|
|
695
713
|
await t.applyEdits({ addFeatures: [new L({ attributes: n })] });
|
|
696
|
-
} catch (
|
|
697
|
-
w("error", this, "Error logging arcade assistant question/answer interaction.", { detail: { error:
|
|
714
|
+
} catch (r) {
|
|
715
|
+
w("error", this, "Error logging arcade assistant question/answer interaction.", { detail: { error: r } });
|
|
698
716
|
}
|
|
699
717
|
}
|
|
700
718
|
getModel() {
|
|
@@ -707,29 +725,29 @@ class Ze extends re {
|
|
|
707
725
|
this.updateViewState({ isSubmitting: !0, errorMessage: void 0 });
|
|
708
726
|
let t, o;
|
|
709
727
|
try {
|
|
710
|
-
const
|
|
711
|
-
if (!
|
|
728
|
+
const s = this.getModel();
|
|
729
|
+
if (!s || !this.serviceUrl)
|
|
712
730
|
return;
|
|
713
|
-
const n = this.viewState.context ?? await this.getProfileAndMetadata(
|
|
714
|
-
t = this.createFeedbackContextSnapshot(
|
|
715
|
-
const
|
|
731
|
+
const n = this.viewState.context ?? await this.getProfileAndMetadata(s.uri), r = this.withEditorState(n, s);
|
|
732
|
+
t = this.createFeedbackContextSnapshot(r);
|
|
733
|
+
const p = await this.getToken(), c = await ke({
|
|
716
734
|
baseUrl: this.serviceUrl,
|
|
717
735
|
skillId: Ye,
|
|
718
736
|
message: e,
|
|
719
|
-
authToken:
|
|
737
|
+
authToken: p,
|
|
720
738
|
context: {
|
|
721
739
|
kind: Ke,
|
|
722
740
|
context: {
|
|
723
|
-
profile_id:
|
|
724
|
-
metadata: [
|
|
725
|
-
editor_code:
|
|
726
|
-
...
|
|
741
|
+
profile_id: r.profileId,
|
|
742
|
+
metadata: [r.metadata],
|
|
743
|
+
editor_code: r.editor_code,
|
|
744
|
+
...r.diagnostics?.length ? { diagnostics: r.diagnostics } : {}
|
|
727
745
|
}
|
|
728
746
|
}
|
|
729
747
|
});
|
|
730
|
-
o =
|
|
731
|
-
const
|
|
732
|
-
if (!
|
|
748
|
+
o = c?.[0]?.conversationId;
|
|
749
|
+
const a = c.find((u) => u.context?.kind === "ArcadeCodeResponse");
|
|
750
|
+
if (!a) {
|
|
733
751
|
await this.logInteractionToFeedbackService({
|
|
734
752
|
question: e,
|
|
735
753
|
answer: "No ArcadeCodeResponse returned.",
|
|
@@ -738,39 +756,40 @@ class Ze extends re {
|
|
|
738
756
|
});
|
|
739
757
|
return;
|
|
740
758
|
}
|
|
741
|
-
if (
|
|
742
|
-
const
|
|
759
|
+
if (a.context?.kind === "ArcadeCodeResponse") {
|
|
760
|
+
const u = this.createFeedbackContextSnapshot(r), l = he(a?.context?.arcadeCode?.code ?? "");
|
|
743
761
|
this.updateViewState({
|
|
744
762
|
history: [
|
|
745
763
|
{
|
|
746
|
-
script:
|
|
747
|
-
formattedScript:
|
|
764
|
+
script: a?.context?.arcadeCode?.code,
|
|
765
|
+
formattedScript: l,
|
|
748
766
|
error: void 0,
|
|
749
767
|
question: e,
|
|
750
768
|
profile: n.profileId,
|
|
751
|
-
conversationId:
|
|
752
|
-
|
|
753
|
-
|
|
769
|
+
conversationId: a.conversationId,
|
|
770
|
+
isCurrentResult: !0,
|
|
771
|
+
contextSnapshot: u,
|
|
772
|
+
...a.message ? { message: a.message } : {}
|
|
754
773
|
},
|
|
755
|
-
...this.viewState.history
|
|
774
|
+
...this.viewState.history.map((m) => ({ ...m, isCurrentResult: !1 }))
|
|
756
775
|
],
|
|
757
776
|
viewMode: "result",
|
|
758
777
|
errorMessage: void 0
|
|
759
778
|
}), await this.logInteractionToFeedbackService({
|
|
760
779
|
question: e,
|
|
761
|
-
answer:
|
|
780
|
+
answer: l,
|
|
762
781
|
contextSnapshot: t,
|
|
763
|
-
conversationId:
|
|
782
|
+
conversationId: a.conversationId
|
|
764
783
|
});
|
|
765
784
|
}
|
|
766
|
-
} catch (
|
|
767
|
-
const n =
|
|
785
|
+
} catch (s) {
|
|
786
|
+
const n = s instanceof Error && s.name === "ArcadeAssistantError" ? Ce(s) || this.messages.erroroccurred || "An error occurred." : this.messages.erroroccurred || "An error occurred.";
|
|
768
787
|
this.updateViewState({ errorMessage: n }), await this.logInteractionToFeedbackService({
|
|
769
788
|
question: e,
|
|
770
789
|
answer: n,
|
|
771
790
|
contextSnapshot: t,
|
|
772
791
|
conversationId: o
|
|
773
|
-
}), w("error", this, "Error submitting question", { detail: { error:
|
|
792
|
+
}), w("error", this, "Error submitting question", { detail: { error: s } });
|
|
774
793
|
} finally {
|
|
775
794
|
this.updateViewState({ isSubmitting: !1 });
|
|
776
795
|
}
|
|
@@ -783,13 +802,13 @@ class Ze extends re {
|
|
|
783
802
|
let t = Q;
|
|
784
803
|
const o = D.getEditorProfileForModel(e);
|
|
785
804
|
o?.loaded || await o?.loadSource();
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
const n = o ? await ze(o) : { variables: [] },
|
|
805
|
+
const s = this.editorRef.profile;
|
|
806
|
+
s && "id" in s && (t = s.id);
|
|
807
|
+
const n = o ? await ze(o) : { variables: [] }, r = Je(n), p = r ? Ge(n) : void 0, a = p ? p.context : n, u = V(a);
|
|
789
808
|
return {
|
|
790
809
|
profileId: t,
|
|
791
|
-
metadata:
|
|
792
|
-
contextTooLarge:
|
|
810
|
+
metadata: a,
|
|
811
|
+
contextTooLarge: r,
|
|
793
812
|
reducedToVariableName: p?.reducedToVariableName,
|
|
794
813
|
estimatedTokens: u
|
|
795
814
|
};
|