@arcgis/coding-components 5.2.0-next.116 → 5.2.0-next.117
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/22WTKWX3.js +2 -0
- package/dist/cdn/{NNOHKAUR.js → 2OOUSCR2.js} +1 -1
- package/dist/cdn/3MYJY4XF.js +2 -0
- package/dist/cdn/{H4L6N7W4.js → 5E6FR6BZ.js} +1 -1
- package/dist/cdn/{CNEKU4E5.js → 62DBPVRG.js} +1 -1
- package/dist/cdn/{WBN7AYGG.js → 6DFI5ERF.js} +1 -1
- package/dist/cdn/{2SCD7KX4.js → 7557YTH2.js} +1 -1
- package/dist/cdn/{46HXMXDY.js → 7EBMAFES.js} +1 -1
- package/dist/cdn/{V4HDH7ZM.js → 7WYHXRIC.js} +1 -1
- package/dist/cdn/AGHMGL6E.js +12 -0
- package/dist/cdn/AJTKKJJT.js +2 -0
- package/dist/cdn/{E76ZT2V2.js → BDPAZMM4.js} +1 -1
- package/dist/cdn/{NE7AQ3M2.js → BXSWFHYR.js} +1 -1
- package/dist/cdn/{KJ2SRGSL.js → EZLFACAC.js} +1 -1
- package/dist/cdn/{GSCCYBOK.js → FWJIPXSM.js} +1 -1
- package/dist/cdn/{AHV3AN6P.js → GC7FFZEU.js} +1 -1
- package/dist/cdn/{AK3FYTHS.js → GY5IX3XK.js} +1 -1
- package/dist/cdn/HQFOVSNC.js +4 -0
- package/dist/cdn/HY5O2FXT.js +2 -0
- package/dist/cdn/IALRR5VH.js +2 -0
- package/dist/cdn/{LXC277WJ.js → KHS23QIL.js} +3 -3
- package/dist/cdn/{57OI3HYY.js → KLDWM65I.js} +1 -1
- package/dist/cdn/{YKJS4OIT.js → MWWXV5SO.js} +1 -1
- package/dist/cdn/{SGH4ISZJ.js → N37NWQCL.js} +1 -1
- package/dist/cdn/NULEXQA2.js +2 -0
- package/dist/cdn/ODW3NXBR.js +2 -0
- package/dist/cdn/{7CO7POPG.js → OKBXNZWB.js} +1 -1
- package/dist/cdn/{6JE7UXRZ.js → PBAJAXFT.js} +1 -1
- package/dist/cdn/PBU6VJBZ.js +2 -0
- package/dist/cdn/{2D4U4CLP.js → VFTBLPWP.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/functional.js +30 -29
- package/dist/chunks/language-defaults-base.js +30 -29
- package/dist/chunks/utilities.js +13 -12
- package/dist/chunks/utils.js +1 -0
- package/dist/components/arcgis-arcade-coding-assistant/customElement.js +65 -64
- package/dist/components/arcgis-arcade-results/customElement.js +15 -14
- package/dist/components/arcgis-arcade-suggestions/customElement.js +17 -17
- package/dist/components/arcgis-language-api-panel/customElement.js +36 -35
- package/dist/components/arcgis-sql-expression-editor/customElement.js +2 -2
- package/dist/components/arcgis-sql-layer-editor/customElement.js +1 -1
- 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 +6 -6
- package/dist/cdn/5BDVHLU3.js +0 -2
- package/dist/cdn/5KM3AKLY.js +0 -2
- package/dist/cdn/7VS5GHCL.js +0 -4
- package/dist/cdn/BHSILWSL.js +0 -2
- package/dist/cdn/G7BVWE35.js +0 -2
- package/dist/cdn/HYNFJPLU.js +0 -2
- package/dist/cdn/MXOZNCTB.js +0 -12
- package/dist/cdn/PJAIXRX6.js +0 -2
- package/dist/cdn/TQWS6NIV.js +0 -2
- package/dist/cdn/XNIZBSS5.js +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
2
|
import { c as se } from "../../chunks/runtime.js";
|
|
3
3
|
import { css as ne, html as d } from "lit";
|
|
4
|
-
import { nothing as
|
|
4
|
+
import { nothing as V, safeClassMap as re, LitElement as ce } from "@arcgis/lumina";
|
|
5
5
|
import { ref as le, createRef as de } from "lit/directives/ref.js";
|
|
6
6
|
import pe from "@arcgis/core/identity/IdentityManager.js";
|
|
7
7
|
import { u as ue } from "../../chunks/useT9n.js";
|
|
@@ -16,12 +16,12 @@ import { unsafeHTML as T } from "lit/directives/unsafe-html.js";
|
|
|
16
16
|
import be from "@arcgis/core/layers/FeatureLayer.js";
|
|
17
17
|
import z from "@arcgis/core/config.js";
|
|
18
18
|
import L from "@arcgis/core/Graphic.js";
|
|
19
|
-
import { log as
|
|
19
|
+
import { log as $ } from "@arcgis/toolkit/log";
|
|
20
20
|
import { getDeclaredVoxelMembers as ge, getDeclaredPixelMembers as ve } from "@arcgis/core/applications/Components/arcadeEditorUtils.js";
|
|
21
21
|
import { s as ye } from "../../chunks/fields.js";
|
|
22
22
|
import { l as ee, m as te, n as we } from "../../chunks/utils2.js";
|
|
23
|
-
import
|
|
24
|
-
import { property as b, subclass as
|
|
23
|
+
import xe from "@arcgis/core/core/Accessor.js";
|
|
24
|
+
import { property as b, subclass as $e } from "@arcgis/core/core/accessorSupport/decorators.js";
|
|
25
25
|
const ke = ne`: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}`;
|
|
26
26
|
class A extends Error {
|
|
27
27
|
constructor({
|
|
@@ -64,36 +64,35 @@ async function Se(i) {
|
|
|
64
64
|
body: JSON.stringify(a),
|
|
65
65
|
responseType: "json"
|
|
66
66
|
});
|
|
67
|
-
} catch (
|
|
68
|
-
const
|
|
69
|
-
throw
|
|
67
|
+
} catch (v) {
|
|
68
|
+
const g = v, w = g.details?.rawResponse || g.message || String(v), x = O(w);
|
|
69
|
+
throw x ? new A(x) : v;
|
|
70
70
|
}
|
|
71
71
|
const l = u.data;
|
|
72
72
|
c.push(l);
|
|
73
|
-
const m = l.conversationId,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
for (; g < v; ) {
|
|
73
|
+
const m = l.conversationId, k = l.inquiryId;
|
|
74
|
+
async function S() {
|
|
75
|
+
let v = l.sequenceNumber, g = 0;
|
|
76
|
+
const w = 100;
|
|
77
|
+
for (; g < w; ) {
|
|
79
78
|
await new Promise((C) => setTimeout(C, 1e3));
|
|
80
|
-
const
|
|
81
|
-
let
|
|
79
|
+
const x = Ce(m, v, k);
|
|
80
|
+
let P;
|
|
82
81
|
try {
|
|
83
|
-
|
|
82
|
+
P = await N(p, {
|
|
84
83
|
method: "post",
|
|
85
84
|
headers: {
|
|
86
85
|
"Content-Type": "application/json",
|
|
87
86
|
"X-Esri-Authorization": `Bearer ${s}`
|
|
88
87
|
},
|
|
89
|
-
body: JSON.stringify(
|
|
88
|
+
body: JSON.stringify(x),
|
|
90
89
|
responseType: "json"
|
|
91
90
|
});
|
|
92
91
|
} catch (C) {
|
|
93
92
|
const q = C, ae = q.details?.rawResponse || q.message || String(C), _ = O(ae);
|
|
94
93
|
throw _ ? new A(_) : C;
|
|
95
94
|
}
|
|
96
|
-
const y =
|
|
95
|
+
const y = P.data;
|
|
97
96
|
if (y.context?.kind === "ArcgisErrorAsContext" && y.context.error)
|
|
98
97
|
throw new A({
|
|
99
98
|
message: y.context.error.message || "ArcGIS Assistant error",
|
|
@@ -102,29 +101,29 @@ async function Se(i) {
|
|
|
102
101
|
details: y.context.error.details,
|
|
103
102
|
source: "polling-response"
|
|
104
103
|
});
|
|
105
|
-
if (c.push(y),
|
|
104
|
+
if (c.push(y), v = y.sequenceNumber, g++, !y.hasMore)
|
|
106
105
|
break;
|
|
107
106
|
}
|
|
108
|
-
if (g ===
|
|
107
|
+
if (g === w)
|
|
109
108
|
throw new A({
|
|
110
109
|
message: "Request timed out",
|
|
111
110
|
code: "TIMEOUT",
|
|
112
111
|
source: "polling"
|
|
113
112
|
});
|
|
114
113
|
}
|
|
115
|
-
const
|
|
114
|
+
const I = 120 * 1e3;
|
|
116
115
|
return await Promise.race([
|
|
117
|
-
|
|
116
|
+
S(),
|
|
118
117
|
new Promise(
|
|
119
|
-
(
|
|
120
|
-
() =>
|
|
118
|
+
(v, g) => setTimeout(
|
|
119
|
+
() => g(
|
|
121
120
|
new A({
|
|
122
121
|
message: "Request timed out",
|
|
123
122
|
code: "TIMEOUT",
|
|
124
123
|
source: "hard-timeout"
|
|
125
124
|
})
|
|
126
125
|
),
|
|
127
|
-
|
|
126
|
+
I
|
|
128
127
|
)
|
|
129
128
|
)
|
|
130
129
|
]), c;
|
|
@@ -178,7 +177,7 @@ function Fe({ popoverContent: i, messages: e }) {
|
|
|
178
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>`;
|
|
179
178
|
}
|
|
180
179
|
function Me({ errorMessage: i, slot: e }) {
|
|
181
|
-
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 ?? V}>${i}</calcite-input-message></div>`;
|
|
182
181
|
}
|
|
183
182
|
function Ve({ active: i, setActive: e, messages: t }) {
|
|
184
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>`;
|
|
@@ -186,19 +185,19 @@ function Ve({ active: i, setActive: e, messages: t }) {
|
|
|
186
185
|
function Pe({ context: i, messages: e }) {
|
|
187
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;
|
|
188
187
|
}
|
|
189
|
-
function qe({ 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:
|
|
190
|
-
const g =
|
|
188
|
+
function qe({ 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: S, contextReducedNoticeDismissed: I, setContextReducedNoticeDismissed: v }) {
|
|
189
|
+
const g = S?.contextTooLarge ?? !1, w = Ee({
|
|
191
190
|
promptValidationMessage: c,
|
|
192
191
|
errorMessage: r,
|
|
193
192
|
contextTooBig: g,
|
|
194
193
|
contextReducedNoticeDismissed: I,
|
|
195
|
-
setContextReducedNoticeDismissed:
|
|
194
|
+
setContextReducedNoticeDismissed: v,
|
|
196
195
|
setErrorMessage: p,
|
|
197
196
|
messages: l
|
|
198
197
|
});
|
|
199
|
-
return d`<div class="text-area-wrapper">${Te({ notices:
|
|
200
|
-
Ie(
|
|
201
|
-
}} ${le(s)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${
|
|
198
|
+
return d`<div class="text-area-wrapper">${Te({ notices: w })}<calcite-text-area scale=s resize=vertical .readOnly=${i || e} class=${re(w.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
|
+
Ie(x.target), t(x.target.value);
|
|
200
|
+
}} ${le(s)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${S && Pe({ context: S, 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 () => {
|
|
202
201
|
o(!1), t("");
|
|
203
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 () => {
|
|
204
203
|
o(!1), t("");
|
|
@@ -223,17 +222,17 @@ function Ne({ setOpen: i, messages: e, feedback: t, learnMoreUrl: o, setFeedback
|
|
|
223
222
|
}} .disabled=${t.submitting}></calcite-checkbox><span>${T((e.agreement ?? "I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}", `<calcite-link href=${De} target="_blank">${e.esriprivacystatement ?? "Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}", `<calcite-link href=${_e} 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;
|
|
224
223
|
}
|
|
225
224
|
function B({ promptingEnabled: i, messages: e, slot: t, helpTopicUrl: o }) {
|
|
226
|
-
return d`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${t ??
|
|
225
|
+
return d`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${t ?? V} 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>`;
|
|
227
226
|
}
|
|
228
227
|
function Ue({ messages: i, onProceed: e, onExit: t, helpTopicUrl: o }) {
|
|
229
228
|
return d`<calcite-dialog close-disabled placement=top .heading=${i.welcome ?? "Welcome to the new assistant experience"} slot=dialogs open width=s scale=s 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>`;
|
|
230
229
|
}
|
|
231
230
|
function ze({ messages: i, suggestions: e, onSuggestionClick: t }) {
|
|
232
|
-
return d`<calcite-block .heading=${i.promptsuggestions} expanded
|
|
231
|
+
return d`<calcite-block .heading=${i.promptsuggestions} expanded expandable 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>`;
|
|
233
232
|
}
|
|
234
233
|
const j = 200;
|
|
235
234
|
function H({ hidden: i = !1, expanded: e = !1, messages: t, cards: o, heading: s, collapsible: n = !1, showEffectsIcon: r = !1, onCopyCode: p, standalone: c }) {
|
|
236
|
-
return d`<calcite-block .hidden=${i} id=result-block .heading=${s ?? t.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .
|
|
235
|
+
return d`<calcite-block .hidden=${i} id=result-block .heading=${s ?? t.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .expandable=${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"}>${Z(o, (a) => a.conversationId, (a) => d`<calcite-card><div slot=heading><div class="prior-prompt"><span>${a.priorPrompt.length > j ? `${a.priorPrompt.slice(0, j)}...` : 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) => {
|
|
237
236
|
const l = u.currentTarget;
|
|
238
237
|
navigator.clipboard.writeText(a.priorPrompt).then(() => {
|
|
239
238
|
l.setAttribute("data-copied", "true"), setTimeout(() => l.removeAttribute("data-copied"), 1500);
|
|
@@ -247,43 +246,43 @@ function H({ hidden: i = !1, expanded: e = !1, messages: t, cards: o, heading: s
|
|
|
247
246
|
}
|
|
248
247
|
const Le = ({ card: i, messages: e }) => {
|
|
249
248
|
const t = fe(), o = `response-chip-profile-${i.conversationId}-${t}`, s = (e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId);
|
|
250
|
-
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 ??
|
|
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 ?? V}>${i.profileId}</calcite-chip>`;
|
|
251
250
|
}, G = (i) => i.type === "featureSet";
|
|
252
251
|
function ie(i) {
|
|
253
252
|
return i && i !== "dataCatalogDatastore" ? i : void 0;
|
|
254
253
|
}
|
|
255
|
-
const
|
|
254
|
+
const E = (i) => {
|
|
256
255
|
if (!we(i))
|
|
257
256
|
return [];
|
|
258
257
|
const e = [];
|
|
259
258
|
return i.relationships?.forEach((t) => {
|
|
260
259
|
e.push(t.toJSON());
|
|
261
260
|
}), e;
|
|
262
|
-
},
|
|
261
|
+
}, R = (i) => i.length > 0 ? { relationships: i } : {}, Oe = (i) => ye(i).map((e) => ({
|
|
263
262
|
alias: e.alias,
|
|
264
263
|
name: e.name,
|
|
265
264
|
type: e.type,
|
|
266
265
|
...e.domain ? { domain: e.domain } : {}
|
|
267
|
-
})),
|
|
266
|
+
})), F = (i) => i ? { fields: Oe(i) } : { fields: [] };
|
|
268
267
|
async function J(i) {
|
|
269
|
-
const e = await i.loadSource(), t = te(e) && e.isTable, o =
|
|
268
|
+
const e = await i.loadSource(), t = te(e) && e.isTable, o = E(e);
|
|
270
269
|
return {
|
|
271
270
|
name: i.name,
|
|
272
271
|
type: "featureSet",
|
|
273
272
|
isTable: t,
|
|
274
|
-
...
|
|
275
|
-
...
|
|
273
|
+
...F(e?.fields),
|
|
274
|
+
...R(o)
|
|
276
275
|
};
|
|
277
276
|
}
|
|
278
277
|
async function oe(i) {
|
|
279
278
|
switch (i.type) {
|
|
280
279
|
case "feature": {
|
|
281
|
-
const t = await i.loadSource(), o =
|
|
280
|
+
const t = await i.loadSource(), o = E(t);
|
|
282
281
|
return {
|
|
283
282
|
name: i.name,
|
|
284
283
|
type: i.type,
|
|
285
|
-
...
|
|
286
|
-
...
|
|
284
|
+
...F(t?.fields),
|
|
285
|
+
...R(o)
|
|
287
286
|
};
|
|
288
287
|
}
|
|
289
288
|
case "featureSet": {
|
|
@@ -292,8 +291,8 @@ async function oe(i) {
|
|
|
292
291
|
name: i.name,
|
|
293
292
|
type: "featureSet",
|
|
294
293
|
...o ? { isTable: o } : {},
|
|
295
|
-
...
|
|
296
|
-
...
|
|
294
|
+
...F(t?.fields),
|
|
295
|
+
...R(E(t))
|
|
297
296
|
};
|
|
298
297
|
}
|
|
299
298
|
case "featureSetCollection": {
|
|
@@ -389,7 +388,7 @@ function He(i) {
|
|
|
389
388
|
const e = new TextEncoder().encode(i).length;
|
|
390
389
|
return Math.ceil(e / 3.5);
|
|
391
390
|
}
|
|
392
|
-
function
|
|
391
|
+
function M(i) {
|
|
393
392
|
return He(JSON.stringify(i));
|
|
394
393
|
}
|
|
395
394
|
function Ge(i) {
|
|
@@ -451,14 +450,14 @@ function Je(i) {
|
|
|
451
450
|
};
|
|
452
451
|
}
|
|
453
452
|
function Qe(i) {
|
|
454
|
-
return
|
|
453
|
+
return M(i) > je;
|
|
455
454
|
}
|
|
456
455
|
var We = Object.defineProperty, Ye = Object.getOwnPropertyDescriptor, f = (i, e, t, o) => {
|
|
457
456
|
for (var s = o > 1 ? void 0 : o ? Ye(e, t) : e, n = i.length - 1, r; n >= 0; n--)
|
|
458
457
|
(r = i[n]) && (s = (o ? r(e, t, s) : r(s)) || s);
|
|
459
458
|
return o && s && We(e, t, s), s;
|
|
460
459
|
};
|
|
461
|
-
let h = class extends
|
|
460
|
+
let h = class extends xe {
|
|
462
461
|
constructor(i) {
|
|
463
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 };
|
|
464
463
|
}
|
|
@@ -497,7 +496,7 @@ f([
|
|
|
497
496
|
b()
|
|
498
497
|
], h.prototype, "context", 2);
|
|
499
498
|
h = f([
|
|
500
|
-
|
|
499
|
+
$e("ArcadeAssistantViewState")
|
|
501
500
|
], h);
|
|
502
501
|
const Ke = "arcade_generation", Xe = "ArcadeCodeRequest", W = "visualization", Y = "ArcadeAssistant", Ze = [
|
|
503
502
|
"your_comments",
|
|
@@ -533,19 +532,19 @@ class et extends ce {
|
|
|
533
532
|
}
|
|
534
533
|
let t = !1, o;
|
|
535
534
|
if (this.viewState.feedback.item.isCurrentResult && this.viewState.viewMode === "result") {
|
|
536
|
-
const m = this.viewState.context ?? await this.getProfileAndMetadata(this.getModel()?.uri ?? ""),
|
|
535
|
+
const m = this.viewState.context ?? await this.getProfileAndMetadata(this.getModel()?.uri ?? ""), k = this.viewState.feedback.item.contextSnapshot;
|
|
537
536
|
o = {
|
|
538
537
|
...m,
|
|
539
538
|
// while we use the full profileContext, we want to use the snapshotted context for the editor code, diagnostics and runtime
|
|
540
539
|
// 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.
|
|
541
|
-
editor_code:
|
|
542
|
-
diagnostics:
|
|
543
|
-
runtime:
|
|
540
|
+
editor_code: k?.editor_code ?? "",
|
|
541
|
+
diagnostics: k?.diagnostics,
|
|
542
|
+
runtime: k?.runtime ?? U()
|
|
544
543
|
}, t = !0;
|
|
545
544
|
} else
|
|
546
545
|
o = this.viewState.feedback.item.contextSnapshot;
|
|
547
546
|
const s = z.applicationName;
|
|
548
|
-
!s && !this.appVersion &&
|
|
547
|
+
!s && !this.appVersion && $("warn", this, "esriConfig.applicationName is not set. Consider setting it to help identify the application version in feedback.");
|
|
549
548
|
const { value: n, text: r, termsAccepted: p, item: { question: c, formattedScript: a, conversationId: u } } = this.viewState.feedback, l = {
|
|
550
549
|
user_evaluation: n,
|
|
551
550
|
your_comments: r || void 0,
|
|
@@ -553,6 +552,7 @@ class et extends ce {
|
|
|
553
552
|
answer: this.encodeForFeedback(a),
|
|
554
553
|
useragent: navigator.userAgent,
|
|
555
554
|
_source: Y,
|
|
555
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated -- TODO(6.0)
|
|
556
556
|
version: this.appVersion || s || "NOT_SET",
|
|
557
557
|
context: o ? JSON.stringify({
|
|
558
558
|
...o,
|
|
@@ -568,7 +568,7 @@ class et extends ce {
|
|
|
568
568
|
try {
|
|
569
569
|
await e.applyEdits({ addFeatures: [new L({ attributes: l })] });
|
|
570
570
|
} catch (m) {
|
|
571
|
-
|
|
571
|
+
$("error", this, "Error submitting feedback.", { detail: { error: m } });
|
|
572
572
|
}
|
|
573
573
|
this.handleFeedbackSheetClose();
|
|
574
574
|
}, this.handleClose = (e) => {
|
|
@@ -629,7 +629,7 @@ class et extends ce {
|
|
|
629
629
|
e();
|
|
630
630
|
const t = D.onModelContextDidChange(async () => {
|
|
631
631
|
e().catch((s) => {
|
|
632
|
-
|
|
632
|
+
$("error", this, "Error setting context.", { detail: { error: s } });
|
|
633
633
|
});
|
|
634
634
|
});
|
|
635
635
|
return { remove: () => {
|
|
@@ -645,7 +645,7 @@ class et extends ce {
|
|
|
645
645
|
return {
|
|
646
646
|
...e,
|
|
647
647
|
metadata: t,
|
|
648
|
-
estimatedTokens:
|
|
648
|
+
estimatedTokens: M(t)
|
|
649
649
|
};
|
|
650
650
|
}
|
|
651
651
|
withEditorState(e, t) {
|
|
@@ -685,7 +685,7 @@ class et extends ce {
|
|
|
685
685
|
await e.load();
|
|
686
686
|
const t = Ze.filter((o) => !e.fields.some((s) => s.name === o));
|
|
687
687
|
if (t.length > 0) {
|
|
688
|
-
|
|
688
|
+
$("error", this, `Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);
|
|
689
689
|
return;
|
|
690
690
|
}
|
|
691
691
|
return this._feedbackService = e, e;
|
|
@@ -697,7 +697,7 @@ class et extends ce {
|
|
|
697
697
|
try {
|
|
698
698
|
t = await this.ensureFeedbackService();
|
|
699
699
|
} catch (r) {
|
|
700
|
-
|
|
700
|
+
$("error", this, "Error initializing feedback service for interaction logging.", { detail: { error: r } });
|
|
701
701
|
return;
|
|
702
702
|
}
|
|
703
703
|
if (!t)
|
|
@@ -707,6 +707,7 @@ class et extends ce {
|
|
|
707
707
|
answer: this.encodeForFeedback(e.answer),
|
|
708
708
|
useragent: navigator.userAgent,
|
|
709
709
|
_source: Y,
|
|
710
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated -- TODO(6.0)
|
|
710
711
|
version: this.appVersion || o || "NOT_SET",
|
|
711
712
|
// 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.
|
|
712
713
|
context: s ? JSON.stringify({ ...s, isSnapshot: !0 }) : "",
|
|
@@ -718,7 +719,7 @@ class et extends ce {
|
|
|
718
719
|
try {
|
|
719
720
|
await t.applyEdits({ addFeatures: [new L({ attributes: n })] });
|
|
720
721
|
} catch (r) {
|
|
721
|
-
|
|
722
|
+
$("error", this, "Error logging arcade assistant question/answer interaction.", { detail: { error: r } });
|
|
722
723
|
}
|
|
723
724
|
}
|
|
724
725
|
getModel() {
|
|
@@ -796,7 +797,7 @@ class et extends ce {
|
|
|
796
797
|
answer: n,
|
|
797
798
|
contextSnapshot: t,
|
|
798
799
|
conversationId: o
|
|
799
|
-
}),
|
|
800
|
+
}), $("error", this, "Error submitting question", { detail: { error: s } });
|
|
800
801
|
} finally {
|
|
801
802
|
this.updateViewState({ isSubmitting: !1 });
|
|
802
803
|
}
|
|
@@ -811,7 +812,7 @@ class et extends ce {
|
|
|
811
812
|
o?.loaded || await o?.loadSource();
|
|
812
813
|
const s = this.editorRef.profile;
|
|
813
814
|
s && "id" in s && (t = s.id);
|
|
814
|
-
const n = o ? await Be(o) : { variables: [] }, r = Qe(n), p = r ? Je(n) : void 0, a = p ? p.context : n, u =
|
|
815
|
+
const n = o ? await Be(o) : { variables: [] }, r = Qe(n), p = r ? Je(n) : void 0, a = p ? p.context : n, u = M(a);
|
|
815
816
|
return {
|
|
816
817
|
profileId: t,
|
|
817
818
|
metadata: a,
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
2
|
+
import { c as h } from "../../chunks/runtime.js";
|
|
3
3
|
import { css as g, html as e } from "lit";
|
|
4
4
|
import { LitElement as f, createEvent as u, safeClassMap as o } from "@arcgis/lumina";
|
|
5
|
-
import {
|
|
5
|
+
import { uncapitalize as a } from "@arcgis/toolkit/string";
|
|
6
|
+
import { substitute as i } from "@arcgis/core/intl.js";
|
|
6
7
|
import { M as v } from "../../chunks/arcade-executor.js";
|
|
7
8
|
import { u as b } from "../../chunks/useT9n.js";
|
|
8
9
|
import { F as $, a as x, t as s, D as y, A as R, b as P } from "../../chunks/functional.js";
|
|
9
|
-
import { d as w, g as k, c as m, b as T, G as S, a as C, S as
|
|
10
|
+
import { d as w, g as k, c as m, b as T, G as S, a as C, S as p } from "../../chunks/debugger-value-styles.js";
|
|
10
11
|
import { createRef as r, ref as n } from "lit/directives/ref.js";
|
|
11
|
-
import { observeAncestorsMutation as
|
|
12
|
-
const
|
|
12
|
+
import { observeAncestorsMutation as L, unsafeGetCalciteModeName as M } from "@arcgis/toolkit/dom";
|
|
13
|
+
const I = g`:host{display:flex;flex-direction:column;width:100%;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);.flex-adjustable{flex:1 1 auto;overflow:hidden}.flex-row{display:flex;flex-direction:row;overflow:hidden}.flex-column{display:flex;flex-direction:column;overflow:hidden;min-height:0}.y-scrollable-container{overflow-y:auto;block-size:100%;background-color:var(--calcite-color-foreground-1)}header{border-bottom:1px solid var(--calcite-color-border-3);flex:0 0 auto}calcite-action-bar{calcite-action-group{padding-inline-end:var(--calcite-spacing-sm);calcite-action{padding-inline-end:var(--calcite-spacing-sm)}calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}calcite-action-group:last-child{border-inline-end-width:0px}calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.color-info{color:var(--calcite-color-status-info)}.color-error{color:var(--calcite-color-status-danger)}.color-success{color:var(--calcite-color-status-success)}[class*=result-value-]{font-size:var(--calcite-font-size--2);line-height:1.25rem;background-color:var(--calcite-color-foreground-1);margin:var(--calcite-spacing-md)}.console-logs-container{background-color:var(--calcite-color-foreground-1);padding:0 var(--calcite-spacing-md);font-family:var(--calcite-code-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal)}.result-value-table{display:flex;flex-direction:column;min-height:0;.table-scroll{overflow:auto;flex:1 1 auto;min-height:0;max-width:100%;background-color:var(--calcite-color-foreground-1)}table{min-width:max-content;border-spacing:0;border-collapse:collapse;text-align:start;white-space:nowrap;thead{background-color:var(--calcite-color-foreground-2)}tr{border-top:1px solid var(--calcite-color-border-3);border-bottom:1px solid var(--calcite-color-border-3)}th,td{border-inline-start:1px solid var(--calcite-color-border-3);border-inline-end:1px solid var(--calcite-color-border-3);text-align:start;padding:var(--calcite-spacing-xxs);.string-value{white-space:pre}}th{font-weight:var(--calcite-font-weight-medium)}}}}`, c = {
|
|
13
14
|
onClick: (d) => {
|
|
14
15
|
const t = d.currentTarget;
|
|
15
16
|
t.expanded = !t.expanded;
|
|
@@ -23,11 +24,11 @@ class F extends f {
|
|
|
23
24
|
this.properties = { consoleLogs: 0, loading: 5, openedResultPanel: 3, result: 0, executionTiming: 0, hideHeader: 5 };
|
|
24
25
|
}
|
|
25
26
|
static {
|
|
26
|
-
this.styles = [
|
|
27
|
+
this.styles = [I, k(), w];
|
|
27
28
|
}
|
|
28
29
|
load() {
|
|
29
30
|
this.manager.onLifecycle(() => {
|
|
30
|
-
const t =
|
|
31
|
+
const t = L(this.el, ["class"], this.updateTheme.bind(this));
|
|
31
32
|
return this.updateTheme(), () => t();
|
|
32
33
|
});
|
|
33
34
|
}
|
|
@@ -45,7 +46,7 @@ class F extends f {
|
|
|
45
46
|
this.arcgisInternalClosePanel.emit();
|
|
46
47
|
}
|
|
47
48
|
updateTheme() {
|
|
48
|
-
|
|
49
|
+
M(this.el) === "dark" ? this.elementInternals.states.add(m) : this.elementInternals.states.delete(m);
|
|
49
50
|
}
|
|
50
51
|
renderConsolePanel() {
|
|
51
52
|
return this.openedResultPanel !== "console" ? null : this.loading && !this.consoleLogs?.length ? e`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading ?? "loading"}></calcite-loader>` : e`<div class="console-logs-container">${this.consoleLogs?.length ? this.consoleLogs.map((t) => e`<p dir=auto>${t}</p>`) : e`<p dir=auto>${this.messages.consolemessage}</p>`}</div>`;
|
|
@@ -56,18 +57,18 @@ class F extends f {
|
|
|
56
57
|
if (this.loading)
|
|
57
58
|
return e`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading ?? "loading"}></calcite-loader>`;
|
|
58
59
|
const t = this.result?.type === "error" ? "color-error" : "color-success", l = this.executionTiming ?? this.result;
|
|
59
|
-
return e`<calcite-list .label=${this.messages.results ?? "Results"}>${l ? e`<calcite-list-item .label=${i(this.messages.lastexecutionformat, {
|
|
60
|
+
return e`<calcite-list .label=${this.messages.results ?? "Results"}>${l ? e`<calcite-list-item .label=${i(this.messages.lastexecutionformat ?? "Last execution {timeStamp}", {
|
|
60
61
|
timeStamp: new Intl.DateTimeFormat(this.messages._t9nLocale, {
|
|
61
62
|
dateStyle: "medium",
|
|
62
63
|
timeStyle: "medium"
|
|
63
64
|
}).format(l.timeStamp)
|
|
64
|
-
})}><calcite-icon slot=content-start icon=information scale=s class=${o(t)}></calcite-icon></calcite-list-item><calcite-list-item .label=${i(this.messages.compilationtimeformat, {
|
|
65
|
+
})}><calcite-icon slot=content-start icon=information scale=s class=${o(t)}></calcite-icon></calcite-list-item><calcite-list-item .label=${i(this.messages.compilationtimeformat ?? "Compilation {time}", {
|
|
65
66
|
time: new Intl.NumberFormat(this.messages._t9nLocale, {
|
|
66
67
|
style: "unit",
|
|
67
68
|
unit: "millisecond",
|
|
68
69
|
maximumFractionDigits: 2
|
|
69
70
|
}).format(l.compilationTime ?? 0)
|
|
70
|
-
})}><calcite-icon slot=content-start icon=information scale=s class=${o(t)}></calcite-icon></calcite-list-item><calcite-list-item .label=${i(this.messages.executiontimeformat, {
|
|
71
|
+
})}><calcite-icon slot=content-start icon=information scale=s class=${o(t)}></calcite-icon></calcite-list-item><calcite-list-item .label=${i(this.messages.executiontimeformat ?? "Execution {time}", {
|
|
71
72
|
time: new Intl.NumberFormat(this.messages._t9nLocale, {
|
|
72
73
|
style: "unit",
|
|
73
74
|
unit: "millisecond",
|
|
@@ -85,7 +86,7 @@ class F extends f {
|
|
|
85
86
|
return e`<div class="result-value-simple flex-adjustable">${i(this.messages.executionerrorformat ?? "", { message: this.result.value })}</div>`;
|
|
86
87
|
case "null":
|
|
87
88
|
case "unknown":
|
|
88
|
-
return e`<div class="result-value-simple">${
|
|
89
|
+
return e`<div class="result-value-simple">${p({ type: this.result.type, value: a(this.result.type) })}</div>`;
|
|
89
90
|
case "text":
|
|
90
91
|
case "number":
|
|
91
92
|
case "date":
|
|
@@ -93,7 +94,7 @@ class F extends f {
|
|
|
93
94
|
case "time":
|
|
94
95
|
case "boolean": {
|
|
95
96
|
const { type: t, value: l } = C(this.result);
|
|
96
|
-
return e`<div class="result-value-simple"><bdi class="value-type">${a(this.result.type)}: </bdi>${
|
|
97
|
+
return e`<div class="result-value-simple"><bdi class="value-type">${a(this.result.type)}: </bdi>${p({ type: t, value: l })}</div>`;
|
|
97
98
|
}
|
|
98
99
|
case "array": {
|
|
99
100
|
const l = (this.result.value ?? []).slice(0, v);
|
|
@@ -120,7 +121,7 @@ class F extends f {
|
|
|
120
121
|
return e`${this.hideHeader ? null : e`<header class="flex-row"><calcite-action-bar class="flex-adjustable" layout=horizontal scale=s expanded expand-toggle-disabled><calcite-action-group scale=s><calcite-action .active=${this.openedResultPanel === "output"} .text=${this.messages.output ?? ""} text-enabled scale=s icon=list-show-all icon-flip-rtl @click=${this._switchResultPanel} data-panel-name=output ${n(this.outputRef)}></calcite-action><calcite-action .active=${this.openedResultPanel === "console"} .text=${this.messages.console ?? ""} text-enabled scale=s icon=console icon-flip-rtl @click=${this._switchResultPanel} data-panel-name=console ${n(this.consoleRef)}></calcite-action><calcite-action .active=${this.openedResultPanel === "log"} .text=${this.messages.log ?? ""} text-enabled scale=s icon=list icon-flip-rtl @click=${this._switchResultPanel} data-panel-name=log ${n(this.logRef)}></calcite-action></calcite-action-group></calcite-action-bar><calcite-action scale=s icon=x .text=${this.messages.close ?? ""} @click=${this._emitClose}></calcite-action></header>`}<article class="flex-adjustable">${this.loading ? e`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading ?? "Loading"}></calcite-loader>` : e`<div class="flex-column y-scrollable-container">${this.renderOutputPanel()}${this.renderConsolePanel()}${this.renderLogPanel()}</div>`}</article>`;
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
|
-
|
|
124
|
+
h("arcgis-arcade-results", F);
|
|
124
125
|
export {
|
|
125
126
|
F as ArcgisArcadeResults
|
|
126
127
|
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
2
|
+
import { c as d } from "../../chunks/runtime.js";
|
|
3
3
|
import { ref as l } from "lit/directives/ref.js";
|
|
4
|
-
import { css as
|
|
5
|
-
import {
|
|
6
|
-
import { LitElement as h, createEvent as
|
|
7
|
-
import { g as
|
|
4
|
+
import { css as g, html as s, nothing as r } from "lit";
|
|
5
|
+
import { focusElement as c, getClosestElement as u } from "@arcgis/toolkit/dom";
|
|
6
|
+
import { LitElement as h, createEvent as a } from "@arcgis/lumina";
|
|
7
|
+
import { g as n, o as m, a as f } from "../../chunks/colorize.js";
|
|
8
8
|
import { f as p } from "../../chunks/utilities.js";
|
|
9
9
|
import { c as b } from "../../chunks/markdown.js";
|
|
10
10
|
import { u as _ } from "../../chunks/useT9n.js";
|
|
11
11
|
function v(o) {
|
|
12
12
|
return !Array.isArray(o) || !o.length ? !1 : Array.isArray(o[0].suggestions);
|
|
13
13
|
}
|
|
14
|
-
const S =
|
|
15
|
-
class
|
|
14
|
+
const S = g`:host{background-color:var(--calcite-color-foreground-1);.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.sticky{position:sticky;top:0;z-index:10}calcite-flow{height:100%}calcite-block{p:first-of-type{margin-top:0}code{font-family:var(--calcite-code-family)}pre{direction:ltr;overflow-x:auto;background-color:var(--calcite-color-foreground-2);padding:var(--calcite-spacing-sm);code{font-size:var(--calcite-font-size--2)}}}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}calcite-flow{[slot=footer]{word-break:break-word}}}`;
|
|
15
|
+
class w extends h {
|
|
16
16
|
constructor() {
|
|
17
|
-
super(...arguments), this._beforeBack =
|
|
18
|
-
this._selectedSuggestion = void 0;
|
|
19
|
-
}, this.messages = _(), this._colorizeStyle = "", this._filterValue = "", this.closed = !1, this.arcgisInternalClosePanel =
|
|
17
|
+
super(...arguments), this._beforeBack = () => new Promise((e) => {
|
|
18
|
+
this._selectedSuggestion = void 0, e();
|
|
19
|
+
}), this.messages = _(), this._colorizeStyle = "", this._filterValue = "", this.closed = !1, this.arcgisInternalClosePanel = a({ bubbles: !1, composed: !1 }), this.arcgisInternalItemSelected = a({ bubbles: !1, composed: !1 });
|
|
20
20
|
}
|
|
21
21
|
static {
|
|
22
22
|
this.properties = { _colorizeStyle: 16, _filterValue: 16, _selectedSuggestion: 16, suggestions: 0, closed: 5 };
|
|
@@ -25,7 +25,7 @@ class $ extends h {
|
|
|
25
25
|
this.styles = S;
|
|
26
26
|
}
|
|
27
27
|
load() {
|
|
28
|
-
this._colorizeStyle =
|
|
28
|
+
this._colorizeStyle = n(), this._themeChangedListener = m(() => this._colorizeStyle = n());
|
|
29
29
|
}
|
|
30
30
|
willUpdate(e) {
|
|
31
31
|
e.has("suggestions") && this.suggestionsPropChanged();
|
|
@@ -42,11 +42,11 @@ class $ extends h {
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
this._flowObserver || (this._flowObserver = new MutationObserver(() => {
|
|
45
|
-
|
|
45
|
+
c(u(e.querySelector("calcite-flow-item:last-child") ?? e, "calcite-input"));
|
|
46
46
|
}), this._flowObserver.observe(e, { attributes: !0, attributeFilter: ["id"], childList: !0 }));
|
|
47
47
|
}
|
|
48
48
|
_updateFilterValue(e) {
|
|
49
|
-
this._filterValue = e
|
|
49
|
+
this._filterValue = e;
|
|
50
50
|
}
|
|
51
51
|
_emitItemSelected(e, t) {
|
|
52
52
|
const i = e;
|
|
@@ -69,13 +69,13 @@ class $ extends h {
|
|
|
69
69
|
}
|
|
70
70
|
renderSuggestionFlowItem() {
|
|
71
71
|
const e = this._selectedSuggestion;
|
|
72
|
-
return e ? s`<calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .beforeBack=${this._beforeBack} selected><calcite-button width=half slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${(t) => this._emitItemSelected(t, e)} data-item=${e ?? r} ${l(
|
|
72
|
+
return e ? s`<calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .beforeBack=${this._beforeBack} selected><calcite-button width=half slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${(t) => this._emitItemSelected(t, e)} data-item=${e ?? r} ${l(c)}>${this.messages.insert}</calcite-button><calcite-block expanded .heading=${e.label} .description=${e.description}><div .innerHTML=${b(e.documentation) ?? ""}></div><pre><code ${l(this._colorizeCode)}></code></pre></calcite-block></calcite-flow-item>` : null;
|
|
73
73
|
}
|
|
74
74
|
render() {
|
|
75
|
-
return this.closed ? null : s`<style>${this._colorizeStyle}</style><calcite-flow ${l(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedSuggestion}><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m></calcite-input><calcite-list .label=${this.messages.suggestions ?? "Suggestions"}>${this.renderSuggestionGroups()}</calcite-list></calcite-flow-item>${this.renderSuggestionFlowItem()}</calcite-flow>`;
|
|
75
|
+
return this.closed ? null : s`<style>${this._colorizeStyle}</style><calcite-flow ${l(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedSuggestion}><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${(e) => this._updateFilterValue(e.currentTarget.value)} class="sticky" scale=m></calcite-input><calcite-list .label=${this.messages.suggestions ?? "Suggestions"}>${this.renderSuggestionGroups()}</calcite-list></calcite-flow-item>${this.renderSuggestionFlowItem()}</calcite-flow>`;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
d("arcgis-arcade-suggestions", w);
|
|
79
79
|
export {
|
|
80
|
-
|
|
80
|
+
w as ArcgisArcadeSuggestions
|
|
81
81
|
};
|