@arcgis/coding-components 5.1.0-next.87 → 5.1.0-next.89
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/3VRELPEF.js +2 -0
- package/dist/cdn/4B64NBIM.js +2 -0
- package/dist/cdn/5DAIGIIS.js +2 -0
- package/dist/cdn/6EKA3H3N.js +2 -0
- package/dist/cdn/6G5URSC7.js +2 -0
- package/dist/cdn/{BVNLUX5A.js → 6HL5GBWZ.js} +1 -1
- package/dist/cdn/7B33SKQD.js +2 -0
- package/dist/cdn/{GJMI6M3I.js → BA546EMZ.js} +1 -1
- package/dist/cdn/{2PRSVBDA.js → BKBBI4SA.js} +1 -1
- package/dist/cdn/BQISDYES.js +2 -0
- package/dist/cdn/E3TJIEWT.js +2 -0
- package/dist/cdn/FEYQMPLI.js +2 -0
- package/dist/cdn/GLJQQLP2.js +2 -0
- package/dist/cdn/{4I7VT4LW.js → I22MLDO4.js} +1 -1
- package/dist/cdn/ID3QICBM.js +4 -0
- package/dist/cdn/IIER7Z56.js +2 -0
- package/dist/cdn/{LWXQURWG.js → ILQJDTTW.js} +1 -1
- package/dist/cdn/JIBWBXDI.js +3 -0
- package/dist/cdn/{KEROXLGY.js → JT3FBAVQ.js} +1 -1
- package/dist/cdn/KA5TX72B.js +64 -0
- package/dist/cdn/MC6EICRD.js +2 -0
- package/dist/cdn/MJ7MJPGA.js +2 -0
- package/dist/cdn/MTIHPCIF.js +2 -0
- package/dist/cdn/N75AXIUZ.js +2 -0
- package/dist/cdn/NEIT2PGG.js +2 -0
- package/dist/cdn/{N7KYUPBV.js → NK5J27LM.js} +1 -1
- package/dist/cdn/NKJUJKFG.js +2 -0
- package/dist/cdn/NZDJGAT2.js +2 -0
- package/dist/cdn/{JHVMGSI2.js → OI3DH7N2.js} +1 -1
- package/dist/cdn/QMNQFBIA.js +4 -0
- package/dist/cdn/{INPMAY4D.js → SM3MA3KP.js} +1 -1
- package/dist/cdn/SMAQD57G.js +2 -0
- package/dist/cdn/{6XDEGPYR.js → UOQZCTHQ.js} +1 -1
- package/dist/cdn/{QOX2FNYP.js → VA6SZILK.js} +1 -1
- package/dist/cdn/VKNLGQFU.js +2 -0
- package/dist/cdn/{YLJUOSJJ.js → XBM4ZDJT.js} +1 -1
- package/dist/cdn/YVF4PPDB.js +2 -0
- package/dist/cdn/assets/arcade-debugger-console/t9n/messages.en.json +1 -0
- package/dist/cdn/assets/arcade-debugger-output/t9n/messages.en.json +1 -0
- package/dist/cdn/assets/arcade-editor/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/ArcadeDebuggerPreviewTabsState.js +178 -0
- package/dist/chunks/arcade-executor.js +76 -67
- package/dist/chunks/arcade-service-accessors.js +2 -2
- package/dist/chunks/colorize.js +9 -9
- package/dist/chunks/debugger-value-components.js +275 -0
- package/dist/chunks/debugger-value-styles.js +171 -0
- package/dist/chunks/functional.js +83 -0
- package/dist/chunks/setup-monaco-theme.js +1 -1
- package/dist/chunks/utilities.js +44 -34
- package/dist/components/arcgis-arcade-debugger-console/customElement.js +201 -0
- package/dist/components/arcgis-arcade-debugger-console/index.js +11 -0
- package/dist/components/arcgis-arcade-debugger-output/customElement.js +42 -0
- package/dist/components/arcgis-arcade-debugger-output/index.js +5 -0
- package/dist/components/arcgis-arcade-editor/customElement.d.ts +34 -1
- package/dist/components/arcgis-arcade-editor/customElement.js +639 -111
- package/dist/components/arcgis-arcade-editor/index.js +2 -0
- package/dist/components/arcgis-arcade-results/customElement.js +52 -155
- package/dist/components/arcgis-code-editor/customElement.js +1 -1
- package/dist/components/arcgis-code-editor-shell/customElement.d.ts +2 -1
- package/dist/components/arcgis-code-editor-shell/customElement.js +17 -8
- package/dist/components/arcgis-code-viewer/customElement.d.ts +28 -1
- package/dist/components/arcgis-code-viewer/customElement.js +65 -52
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +5 -3
- package/dist/types/lumina.d.ts +2 -2
- package/dist/types/preact.d.ts +2 -2
- package/dist/types/react.d.ts +2 -2
- package/dist/types/stencil.d.ts +2 -2
- package/dist/utils/arcade-executor.d.ts +2 -1
- package/package.json +5 -5
- package/dist/cdn/3GNGWLOI.js +0 -2
- package/dist/cdn/3UZ3JCYW.js +0 -4
- package/dist/cdn/43A7UCSS.js +0 -2
- package/dist/cdn/4Y64BGY2.js +0 -2
- package/dist/cdn/BGQRJR32.js +0 -2
- package/dist/cdn/CPJ4MNMY.js +0 -2
- package/dist/cdn/G2Z2DNVW.js +0 -2
- package/dist/cdn/ISAWP6I3.js +0 -2
- package/dist/cdn/IVNVT7UT.js +0 -2
- package/dist/cdn/KD7MZWFX.js +0 -2
- package/dist/cdn/MSV4QVR2.js +0 -2
- package/dist/cdn/PX32GRG7.js +0 -2
- package/dist/cdn/QRXX4WHP.js +0 -3
- package/dist/cdn/T4G2IY4F.js +0 -2
- package/dist/cdn/TTOHS2DV.js +0 -11
- package/dist/cdn/VUYXKN7I.js +0 -2
- package/dist/cdn/YMEY2NOQ.js +0 -4
|
@@ -1,91 +1,504 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import { g as
|
|
3
|
-
import { css as
|
|
4
|
-
import {
|
|
5
|
-
import "
|
|
6
|
-
import "
|
|
7
|
-
import "
|
|
8
|
-
import "
|
|
9
|
-
import "
|
|
10
|
-
import "
|
|
11
|
-
import "
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
const
|
|
22
|
-
const { aiAssistantsEnabled: e } =
|
|
23
|
-
return e === void 0 ? (
|
|
24
|
-
},
|
|
2
|
+
import { g as q, c as W } from "../../chunks/runtime.js";
|
|
3
|
+
import { css as Q, html as l, nothing as F } from "lit";
|
|
4
|
+
import { i as X } from "../../chunks/monaco-importer.js";
|
|
5
|
+
import { LitElement as K, createEvent as O, safeClassMap as x } from "@arcgis/lumina";
|
|
6
|
+
import { generateGuid as Y } from "@arcgis/toolkit/string";
|
|
7
|
+
import { D as J, e as U, i as L } from "../../chunks/arcade-executor.js";
|
|
8
|
+
import { s as Z, a as ee } from "../../chunks/arcade-service-accessors.js";
|
|
9
|
+
import { b as P } from "../../chunks/arcade-defaults.js";
|
|
10
|
+
import { u as te } from "../../chunks/useT9n.js";
|
|
11
|
+
import { createRef as se, ref as ie } from "lit/directives/ref.js";
|
|
12
|
+
import { load as ae } from "@arcgis/lumina/controllers";
|
|
13
|
+
import j from "@arcgis/core/identity/IdentityManager.js";
|
|
14
|
+
import { log as ne, rethrowError as g } from "@arcgis/toolkit/log";
|
|
15
|
+
import { watch as T } from "@arcgis/core/core/reactiveUtils.js";
|
|
16
|
+
import f from "@arcgis/core/core/Accessor.js";
|
|
17
|
+
import { property as o, subclass as m } from "@arcgis/core/core/accessorSupport/decorators.js";
|
|
18
|
+
import { A as N } from "../../chunks/ArcadeDebuggerPreviewTabsState.js";
|
|
19
|
+
import { r as oe } from "../../chunks/utilities.js";
|
|
20
|
+
import { Range as z, KeyCode as re } from "monaco-editor";
|
|
21
|
+
const ce = Q`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}.main-action-bar{calcite-action-group{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group calcite-action{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group 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)}}.bottom-action-bar.is-collapsed{border-bottom:0}`, H = "https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0", p = (t, e) => ne(t, "Arcade Assistant", e), le = (t) => {
|
|
22
|
+
const { aiAssistantsEnabled: e } = t;
|
|
23
|
+
return e === void 0 ? (p("warn", "`areAiAssistantsEnabled` is not defined in the organizations settings."), !1) : e;
|
|
24
|
+
}, de = (t) => !(!t || !("id" in t)), ue = async (t) => (await j.getCredential(t, { oAuthPopupConfirmation: !1 })).token, he = async (t) => {
|
|
25
25
|
try {
|
|
26
|
-
return !!await
|
|
26
|
+
return !!await j.checkSignInStatus(t);
|
|
27
27
|
} catch {
|
|
28
|
-
return
|
|
28
|
+
return p("warn", "User is not signed in."), !1;
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
async function
|
|
32
|
-
portalUrl:
|
|
31
|
+
async function ge({
|
|
32
|
+
portalUrl: t,
|
|
33
33
|
profile: e
|
|
34
34
|
}) {
|
|
35
|
-
if (!
|
|
36
|
-
return
|
|
37
|
-
const
|
|
38
|
-
if (!await
|
|
35
|
+
if (!de(e))
|
|
36
|
+
return p("warn", "Addon initialization failed. Reason: unsupported profile."), { shouldRender: !1 };
|
|
37
|
+
const s = t.replace(/\/sharing\/rest(\/.*)?$/iu, "").replace(/\/$/u, "");
|
|
38
|
+
if (!await he(s))
|
|
39
39
|
return { shouldRender: !1 };
|
|
40
|
-
const
|
|
41
|
-
fetch(
|
|
42
|
-
fetch(
|
|
43
|
-
fetch(
|
|
44
|
-
]), [
|
|
45
|
-
if (
|
|
40
|
+
const a = await ue(t), r = `${s}/sharing/rest/portals/self?f=json&token=${a}`, n = `${s}/sharing/rest/portals/self/settings?f=json&token=${a}`, d = `${s}/sharing/rest/portals/self/signinSettings?f=json&token=${a}`, w = await Promise.allSettled([
|
|
41
|
+
fetch(r, { credentials: "include" }).then((S) => S.json()),
|
|
42
|
+
fetch(n, { credentials: "include" }).then((S) => S.json()),
|
|
43
|
+
fetch(d, { credentials: "include" }).then((S) => S.json())
|
|
44
|
+
]), [E, R, C] = w, A = E.status === "fulfilled" ? E.value : (p("warn", `Failed to fetch selfUrl. Reason: ${E.reason}.`), {}), M = R.status === "fulfilled" ? R.value : (p("warn", `Failed to fetch settingsUrl. Reason: ${R.reason}.`), {}), G = C.status === "fulfilled" ? C.value : (p("warn", `Failed to fetch signinSettingsUrl. Reason: ${C.reason}.`), {});
|
|
45
|
+
if (A.isPortal)
|
|
46
46
|
return { shouldRender: !1 };
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
49
|
-
return
|
|
50
|
-
let
|
|
51
|
-
|
|
47
|
+
const k = A.helpBase || "";
|
|
48
|
+
if (!M)
|
|
49
|
+
return p("warn", "Settings response is not available."), { shouldRender: !1 };
|
|
50
|
+
let I = le(M);
|
|
51
|
+
G.blockBetaApps === !0 && (p(
|
|
52
52
|
"warn",
|
|
53
53
|
"Arcade Assistant is blocked by the organization settings. To enable it, do not block beta apps in the organization settings."
|
|
54
|
-
),
|
|
55
|
-
const
|
|
56
|
-
return
|
|
54
|
+
), I = !1), A?.user?.privileges?.includes("portal:user:useAIAssistants") || (p("warn", "User does not have the required privileges to use AI Assistants."), I = !1);
|
|
55
|
+
const B = A?.helperServices?.aiAssistantServices?.url;
|
|
56
|
+
return B ? {
|
|
57
57
|
shouldRender: !0,
|
|
58
|
-
serviceUrl:
|
|
59
|
-
helpBase:
|
|
60
|
-
assistantsEnabled:
|
|
61
|
-
feedbackServiceUrl:
|
|
58
|
+
serviceUrl: B,
|
|
59
|
+
helpBase: k,
|
|
60
|
+
assistantsEnabled: I,
|
|
61
|
+
feedbackServiceUrl: H
|
|
62
62
|
} : {
|
|
63
63
|
shouldRender: !0,
|
|
64
64
|
assistantsEnabled: !1,
|
|
65
|
-
helpBase:
|
|
66
|
-
feedbackServiceUrl:
|
|
65
|
+
helpBase: k,
|
|
66
|
+
feedbackServiceUrl: H
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
var pe = Object.defineProperty, be = Object.getOwnPropertyDescriptor, _ = (t, e, s, i) => {
|
|
70
|
+
for (var a = i > 1 ? void 0 : i ? be(e, s) : e, r = t.length - 1, n; r >= 0; r--)
|
|
71
|
+
(n = t[r]) && (a = (i ? n(e, s, a) : n(a)) || a);
|
|
72
|
+
return i && a && pe(e, s, a), a;
|
|
73
|
+
};
|
|
74
|
+
const V = 100;
|
|
75
|
+
let u = class extends f {
|
|
76
|
+
constructor(t) {
|
|
77
|
+
super(t), this.collectionItems = [], this.errorMessage = "", this.expanded = !1, this.requestId = 0, this.status = "idle", this.visibleChildCount = V;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
_([
|
|
81
|
+
o()
|
|
82
|
+
], u.prototype, "collectionItems", 2);
|
|
83
|
+
_([
|
|
84
|
+
o()
|
|
85
|
+
], u.prototype, "errorMessage", 2);
|
|
86
|
+
_([
|
|
87
|
+
o()
|
|
88
|
+
], u.prototype, "expanded", 2);
|
|
89
|
+
_([
|
|
90
|
+
o()
|
|
91
|
+
], u.prototype, "requestId", 2);
|
|
92
|
+
_([
|
|
93
|
+
o()
|
|
94
|
+
], u.prototype, "schemaValue", 2);
|
|
95
|
+
_([
|
|
96
|
+
o()
|
|
97
|
+
], u.prototype, "status", 2);
|
|
98
|
+
_([
|
|
99
|
+
o()
|
|
100
|
+
], u.prototype, "visibleChildCount", 2);
|
|
101
|
+
u = _([
|
|
102
|
+
m("ArcadeDebuggerLazyTreeNodeState")
|
|
103
|
+
], u);
|
|
104
|
+
let D = class extends f {
|
|
105
|
+
constructor(t) {
|
|
106
|
+
super(t), this.generation = 0, this.nodes = /* @__PURE__ */ new Map();
|
|
107
|
+
}
|
|
108
|
+
reset() {
|
|
109
|
+
this.generation += 1, this.destroyNodes();
|
|
110
|
+
}
|
|
111
|
+
ensureNode(t, e = !1, s) {
|
|
112
|
+
const i = this.nodes.get(t);
|
|
113
|
+
if (i)
|
|
114
|
+
return i;
|
|
115
|
+
const a = new u();
|
|
116
|
+
return a.expanded = e, this.nodes.set(t, a), e && s && this.loadNode(t, s), a;
|
|
117
|
+
}
|
|
118
|
+
setExpanded(t, e, s) {
|
|
119
|
+
const i = this.ensureNode(t, e, s);
|
|
120
|
+
if (i.expanded === e) {
|
|
121
|
+
e && s && this.loadNode(t, s);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
i.expanded = e, e && s && this.loadNode(t, s);
|
|
125
|
+
}
|
|
126
|
+
showMore(t, e) {
|
|
127
|
+
const s = this.ensureNode(t);
|
|
128
|
+
s.visibleChildCount >= e || (s.visibleChildCount = Math.min(e, s.visibleChildCount + V));
|
|
129
|
+
}
|
|
130
|
+
loadNode(t, e) {
|
|
131
|
+
switch (e.kind) {
|
|
132
|
+
case "collection":
|
|
133
|
+
this.runLoad(t, e.load, (s, i) => {
|
|
134
|
+
s.collectionItems = i;
|
|
135
|
+
});
|
|
136
|
+
return;
|
|
137
|
+
case "schema":
|
|
138
|
+
this.runLoad(t, e.load, (s, i) => {
|
|
139
|
+
s.schemaValue = i;
|
|
140
|
+
});
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
runLoad(t, e, s) {
|
|
145
|
+
const i = this.nodes.get(t);
|
|
146
|
+
if (!i || i.status === "loading" || i.status === "loaded")
|
|
147
|
+
return;
|
|
148
|
+
const a = this.generation, r = i.requestId + 1;
|
|
149
|
+
i.requestId = r, i.status = "loading", i.errorMessage = "", i.schemaValue = void 0, i.collectionItems = [], e().then((n) => {
|
|
150
|
+
const d = this.nodes.get(t);
|
|
151
|
+
!d || this.generation !== a || d.requestId !== r || (s(d, n), d.status = "loaded");
|
|
152
|
+
}).catch(() => {
|
|
153
|
+
const n = this.nodes.get(t);
|
|
154
|
+
!n || this.generation !== a || n.requestId !== r || (n.status = "error");
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
destroyNodes() {
|
|
158
|
+
for (const t of this.nodes.values())
|
|
159
|
+
t.destroy();
|
|
160
|
+
this.nodes.clear();
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
D = _([
|
|
164
|
+
m("ArcadeDebuggerLazyTreeState")
|
|
165
|
+
], D);
|
|
166
|
+
var _e = Object.defineProperty, fe = Object.getOwnPropertyDescriptor, c = (t, e, s, i) => {
|
|
167
|
+
for (var a = i > 1 ? void 0 : i ? fe(e, s) : e, r = t.length - 1, n; r >= 0; r--)
|
|
168
|
+
(n = t[r]) && (a = (i ? n(e, s, a) : n(a)) || a);
|
|
169
|
+
return i && a && _e(e, s, a), a;
|
|
170
|
+
};
|
|
171
|
+
let b = class extends f {
|
|
172
|
+
constructor(t) {
|
|
173
|
+
super(t), this.phase = "idle", this.sessionId = 0, this.consoleLogs = [], this.hasExecuted = !1;
|
|
174
|
+
}
|
|
175
|
+
get isExecuting() {
|
|
176
|
+
return this.phase === "running" || this.phase === "debug-running" || this.phase === "debug-paused";
|
|
177
|
+
}
|
|
178
|
+
get isDebugging() {
|
|
179
|
+
return this.phase === "debug-running" || this.phase === "debug-paused";
|
|
180
|
+
}
|
|
181
|
+
get isPaused() {
|
|
182
|
+
return this.phase === "debug-paused";
|
|
183
|
+
}
|
|
184
|
+
get runResult() {
|
|
185
|
+
return this.result?.resultType === "run" ? this.result.result : void 0;
|
|
186
|
+
}
|
|
187
|
+
get debugResult() {
|
|
188
|
+
return this.result?.resultType === "debug" ? this.result.result : void 0;
|
|
189
|
+
}
|
|
190
|
+
addConsoleLog(t) {
|
|
191
|
+
this.consoleLogs = [...this.consoleLogs, t];
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
c([
|
|
195
|
+
o()
|
|
196
|
+
], b.prototype, "phase", 2);
|
|
197
|
+
c([
|
|
198
|
+
o()
|
|
199
|
+
], b.prototype, "mode", 2);
|
|
200
|
+
c([
|
|
201
|
+
o()
|
|
202
|
+
], b.prototype, "sessionId", 2);
|
|
203
|
+
c([
|
|
204
|
+
o()
|
|
205
|
+
], b.prototype, "result", 2);
|
|
206
|
+
c([
|
|
207
|
+
o()
|
|
208
|
+
], b.prototype, "consoleLogs", 2);
|
|
209
|
+
c([
|
|
210
|
+
o()
|
|
211
|
+
], b.prototype, "hasExecuted", 2);
|
|
212
|
+
b = c([
|
|
213
|
+
m("ArcadeDebuggerExecutionModel")
|
|
214
|
+
], b);
|
|
215
|
+
let y = class extends f {
|
|
216
|
+
constructor(t) {
|
|
217
|
+
super(t), this.breakpoints = [];
|
|
218
|
+
}
|
|
219
|
+
setBreakpoints(t) {
|
|
220
|
+
this.breakpoints = Array.from(new Set(t)).sort((e, s) => e - s);
|
|
221
|
+
}
|
|
222
|
+
toggleBreakpoint(t) {
|
|
223
|
+
const e = new Set(this.breakpoints);
|
|
224
|
+
e.has(t) ? e.delete(t) : e.add(t), this.setBreakpoints(e);
|
|
225
|
+
}
|
|
226
|
+
clearBreakpoints() {
|
|
227
|
+
this.breakpoints = [];
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
c([
|
|
231
|
+
o()
|
|
232
|
+
], y.prototype, "breakpoints", 2);
|
|
233
|
+
y = c([
|
|
234
|
+
m("ArcadeDebuggerSessionModel")
|
|
235
|
+
], y);
|
|
236
|
+
let v = class extends f {
|
|
237
|
+
constructor(t) {
|
|
238
|
+
super(t), this.openedPanel = "output", this.showPanel = !1;
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
c([
|
|
242
|
+
o()
|
|
243
|
+
], v.prototype, "openedPanel", 2);
|
|
244
|
+
c([
|
|
245
|
+
o()
|
|
246
|
+
], v.prototype, "showPanel", 2);
|
|
247
|
+
v = c([
|
|
248
|
+
m("ArcadeDebuggerUiModel")
|
|
249
|
+
], v);
|
|
250
|
+
let $ = class extends f {
|
|
251
|
+
constructor(t) {
|
|
252
|
+
super(t);
|
|
253
|
+
}
|
|
254
|
+
get line() {
|
|
255
|
+
return this.pausedState?.line;
|
|
256
|
+
}
|
|
257
|
+
clearPausedState() {
|
|
258
|
+
this.lastPausedState = this.pausedState, this.pausedState = void 0;
|
|
259
|
+
}
|
|
260
|
+
reset() {
|
|
261
|
+
this.pausedState = void 0, this.lastPausedState = void 0;
|
|
262
|
+
}
|
|
263
|
+
setPausedState(t) {
|
|
264
|
+
this.pausedState = t, this.lastPausedState = t;
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
c([
|
|
268
|
+
o()
|
|
269
|
+
], $.prototype, "pausedState", 2);
|
|
270
|
+
c([
|
|
271
|
+
o()
|
|
272
|
+
], $.prototype, "lastPausedState", 2);
|
|
273
|
+
$ = c([
|
|
274
|
+
m("ArcadeDebuggerPausedFrameModel")
|
|
275
|
+
], $);
|
|
276
|
+
let h = class extends f {
|
|
277
|
+
constructor(t) {
|
|
278
|
+
super(t), this.execution = new b(), this.lazyTreeState = new D(), this.pausedFrame = new $(), this.previewTabsState = new N(), this.session = new y(), this.ui = new v();
|
|
279
|
+
}
|
|
280
|
+
get breakpoints() {
|
|
281
|
+
return this.session.breakpoints;
|
|
282
|
+
}
|
|
283
|
+
get debuggerBreakpoints() {
|
|
284
|
+
return this.session.breakpoints.map((t) => ({ line: t }));
|
|
285
|
+
}
|
|
286
|
+
get consoleLogs() {
|
|
287
|
+
return this.execution.consoleLogs;
|
|
288
|
+
}
|
|
289
|
+
get debug() {
|
|
290
|
+
if (!(!this.pausedFrame.pausedState && !this.pausedFrame.lastPausedState))
|
|
291
|
+
return {
|
|
292
|
+
pausedState: this.pausedFrame.pausedState,
|
|
293
|
+
lastPausedState: this.pausedFrame.lastPausedState
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
get debugResult() {
|
|
297
|
+
return this.execution.debugResult;
|
|
298
|
+
}
|
|
299
|
+
get debuggerLine() {
|
|
300
|
+
return this.pausedFrame.pausedState?.line;
|
|
301
|
+
}
|
|
302
|
+
get executionState() {
|
|
303
|
+
return this.pausedFrame.pausedState;
|
|
304
|
+
}
|
|
305
|
+
get hasExecuted() {
|
|
306
|
+
return this.execution.hasExecuted;
|
|
307
|
+
}
|
|
308
|
+
get isDebugging() {
|
|
309
|
+
return this.execution.isDebugging;
|
|
310
|
+
}
|
|
311
|
+
get isExecuting() {
|
|
312
|
+
return this.execution.isExecuting;
|
|
313
|
+
}
|
|
314
|
+
get isPaused() {
|
|
315
|
+
return this.execution.isPaused;
|
|
316
|
+
}
|
|
317
|
+
get mode() {
|
|
318
|
+
return this.execution.mode;
|
|
319
|
+
}
|
|
320
|
+
get openedPanel() {
|
|
321
|
+
return this.ui.openedPanel;
|
|
322
|
+
}
|
|
323
|
+
get outputRenderer() {
|
|
324
|
+
if (this.execution.result)
|
|
325
|
+
return this.execution.result.resultType === "debug" ? "debugger" : "legacy";
|
|
326
|
+
}
|
|
327
|
+
get phase() {
|
|
328
|
+
return this.execution.phase;
|
|
329
|
+
}
|
|
330
|
+
get result() {
|
|
331
|
+
return this.execution.result;
|
|
332
|
+
}
|
|
333
|
+
get runResult() {
|
|
334
|
+
return this.execution.runResult;
|
|
335
|
+
}
|
|
336
|
+
get sessionId() {
|
|
337
|
+
return this.execution.sessionId;
|
|
338
|
+
}
|
|
339
|
+
get showPanel() {
|
|
340
|
+
return this.ui.showPanel;
|
|
341
|
+
}
|
|
342
|
+
addConsoleLog(t) {
|
|
343
|
+
this.execution.addConsoleLog(t);
|
|
344
|
+
}
|
|
345
|
+
clearBreakpoints() {
|
|
346
|
+
this.session.clearBreakpoints();
|
|
347
|
+
}
|
|
348
|
+
clearForMissingTestData() {
|
|
349
|
+
this.stopDebug({ hidePanel: !0 }), this.execution.hasExecuted = !1, this.execution.result = void 0;
|
|
350
|
+
}
|
|
351
|
+
closePanel() {
|
|
352
|
+
this.ui.showPanel = !1;
|
|
353
|
+
}
|
|
354
|
+
completeDebug(t) {
|
|
355
|
+
this.execution.mode = "debug", this.execution.result = { resultType: "debug", result: t }, this.execution.phase = "completed", this.ui.openedPanel = "output", this.pausedFrame.reset(), this.resetTransientDebuggerState();
|
|
356
|
+
}
|
|
357
|
+
completeRun(t) {
|
|
358
|
+
this.execution.mode = "run", this.execution.result = { resultType: "run", result: t }, this.execution.phase = "completed", this.pausedFrame.reset(), this.resetTransientDebuggerState();
|
|
359
|
+
}
|
|
360
|
+
continueDebug() {
|
|
361
|
+
const t = this.pausedFrame.pausedState?.continue;
|
|
362
|
+
t && (this.execution.phase = "debug-running", this.pausedFrame.clearPausedState(), t.resolve());
|
|
363
|
+
}
|
|
364
|
+
disableDebugger() {
|
|
365
|
+
this.stopDebug({ hidePanel: !0 }), this.clearBreakpoints();
|
|
366
|
+
}
|
|
367
|
+
fail(t) {
|
|
368
|
+
this.completeRun(t);
|
|
369
|
+
}
|
|
370
|
+
pauseDebug(t) {
|
|
371
|
+
const e = this.pausedFrame.pausedState ?? this.pausedFrame.lastPausedState;
|
|
372
|
+
this.syncPausedState(e, t), this.pausedFrame.setPausedState(t), this.execution.phase = "debug-paused";
|
|
373
|
+
}
|
|
374
|
+
reset() {
|
|
375
|
+
this.execution.phase = "idle", this.execution.mode = void 0, this.execution.result = void 0, this.execution.consoleLogs = [], this.execution.hasExecuted = !1, this.execution.sessionId = 0, this.ui.openedPanel = "output", this.ui.showPanel = !1, this.pausedFrame.reset(), this.session.clearBreakpoints(), this.replaceTransientDebuggerState();
|
|
376
|
+
}
|
|
377
|
+
resetDebug() {
|
|
378
|
+
this.stopDebug({ hidePanel: !1 }), this.execution.result = void 0, this.execution.consoleLogs = [], this.ui.openedPanel = "debug-console";
|
|
379
|
+
}
|
|
380
|
+
disconnect() {
|
|
381
|
+
this.stopDebug({ hidePanel: !0 });
|
|
382
|
+
}
|
|
383
|
+
setBreakpoints(t) {
|
|
384
|
+
this.session.setBreakpoints(t);
|
|
385
|
+
}
|
|
386
|
+
setPanel(t) {
|
|
387
|
+
this.execution.hasExecuted && (this.ui.openedPanel = t, this.ui.showPanel = !0);
|
|
388
|
+
}
|
|
389
|
+
startDebug() {
|
|
390
|
+
return this.execution.mode = "debug", this.execution.phase = "debug-running", this.execution.hasExecuted = !0, this.execution.result = void 0, this.execution.consoleLogs = [], this.ui.openedPanel = "debug-console", this.ui.showPanel = !0, this.execution.sessionId += 1, this.pausedFrame.reset(), this.replaceTransientDebuggerState(), this.execution.sessionId;
|
|
391
|
+
}
|
|
392
|
+
startRun() {
|
|
393
|
+
return this.execution.mode = "run", this.execution.phase = "running", this.execution.hasExecuted = !0, this.execution.result = void 0, this.execution.consoleLogs = [], this.ui.openedPanel = "output", this.ui.showPanel = !0, this.execution.sessionId += 1, this.pausedFrame.reset(), this.replaceTransientDebuggerState(), this.execution.sessionId;
|
|
394
|
+
}
|
|
395
|
+
stopDebug({ hidePanel: t = !0, invalidateSession: e = !0 } = {}) {
|
|
396
|
+
const s = this.pausedFrame.pausedState?.continue;
|
|
397
|
+
e && (this.execution.sessionId += 1), this.execution.phase = this.execution.hasExecuted ? "completed" : "idle", this.pausedFrame.reset(), this.resetTransientDebuggerState(), t && (this.ui.showPanel = !1), this.ui.openedPanel === "debug-console" && (this.ui.openedPanel = "output"), s?.resolve();
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Resets transient debugger state (paused line, lazy tree state, preview tabs state).
|
|
401
|
+
* If the paused state has changed, also invalidates all preview tabs to ensure they are reloaded when next opened.
|
|
402
|
+
*/
|
|
403
|
+
syncPausedState(t, e) {
|
|
404
|
+
this.lazyTreeState.reset(), t && e && t !== e && this.previewTabsState.invalidateAll(), this.pausedLine = e?.line;
|
|
405
|
+
}
|
|
406
|
+
toggleBreakpoint(t) {
|
|
407
|
+
this.session.toggleBreakpoint(t);
|
|
408
|
+
}
|
|
409
|
+
togglePanel(t) {
|
|
410
|
+
if (this.execution.hasExecuted) {
|
|
411
|
+
if (t == null) {
|
|
412
|
+
this.ui.showPanel = !this.ui.showPanel;
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
if (this.ui.openedPanel === t && this.ui.showPanel) {
|
|
416
|
+
this.ui.showPanel = !1;
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
this.setPanel(t);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
resetTransientDebuggerState() {
|
|
423
|
+
this.pausedLine = void 0, this.lazyTreeState.reset(), this.previewTabsState.clear();
|
|
424
|
+
}
|
|
425
|
+
replaceTransientDebuggerState() {
|
|
426
|
+
this.pausedLine = void 0, this.lazyTreeState = new D(), this.previewTabsState = new N();
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
c([
|
|
430
|
+
o()
|
|
431
|
+
], h.prototype, "execution", 2);
|
|
432
|
+
c([
|
|
433
|
+
o()
|
|
434
|
+
], h.prototype, "lazyTreeState", 2);
|
|
435
|
+
c([
|
|
436
|
+
o()
|
|
437
|
+
], h.prototype, "pausedLine", 2);
|
|
438
|
+
c([
|
|
439
|
+
o()
|
|
440
|
+
], h.prototype, "pausedFrame", 2);
|
|
441
|
+
c([
|
|
442
|
+
o()
|
|
443
|
+
], h.prototype, "previewTabsState", 2);
|
|
444
|
+
c([
|
|
445
|
+
o()
|
|
446
|
+
], h.prototype, "session", 2);
|
|
447
|
+
c([
|
|
448
|
+
o()
|
|
449
|
+
], h.prototype, "ui", 2);
|
|
450
|
+
h = c([
|
|
451
|
+
m("ArcadeDebuggerStore")
|
|
452
|
+
], h);
|
|
453
|
+
const me = {
|
|
454
|
+
glyphMargin: !0,
|
|
455
|
+
lineNumbersMinChars: 1
|
|
456
|
+
};
|
|
457
|
+
class Se extends K {
|
|
70
458
|
constructor() {
|
|
71
|
-
super(...arguments), this._codeEditorElt =
|
|
72
|
-
window.open(
|
|
73
|
-
}, this._toggleSidePanel = (e) => {
|
|
74
|
-
|
|
459
|
+
super(...arguments), this._codeEditorElt = se(), this._componentReadyDefer = Promise.withResolvers(), this._disposables = [], this._editorProfilePromise = Promise.resolve(void 0), this._debuggerState = new h(), this.messages = te(), this._modelId = Y(), this._openArcadeHelp = () => {
|
|
460
|
+
window.open(J, "Arcade Help");
|
|
461
|
+
}, this._decorations = void 0, this._monacoEditor = ae(X), this._editorOptions = {}, this._toggleSidePanel = (e) => {
|
|
462
|
+
e.currentTarget instanceof HTMLElement && this._setOpenedSidePanel(e.currentTarget.dataset.panelName ?? "none");
|
|
463
|
+
}, this._closeSidePanel = () => {
|
|
464
|
+
this._setOpenedSidePanel("none");
|
|
465
|
+
}, this._updateBreakpointsDecorations = () => {
|
|
466
|
+
const e = this.editorInstance;
|
|
467
|
+
if (!e)
|
|
75
468
|
return;
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
469
|
+
const s = this._debuggerState.breakpoints.map((i) => ({
|
|
470
|
+
range: new z(i, 1, i, 1),
|
|
471
|
+
options: {
|
|
472
|
+
isWholeLine: !0,
|
|
473
|
+
glyphMarginClassName: "arcgis-code-editor__breakpoint-glyph"
|
|
474
|
+
}
|
|
475
|
+
}));
|
|
476
|
+
this._decorations?.clear(), this._decorations = e.createDecorationsCollection(s);
|
|
477
|
+
}, this._clearDebuggerDecorations = () => {
|
|
478
|
+
this._decorations?.clear(), this._decorations = void 0, this._debuggerPausedLineDecoration?.clear(), this._debuggerPausedLineDecoration = void 0;
|
|
479
|
+
}, this._debuggerPausedLineDecoration = void 0, this._preparingArcade = !1, this._arcadeAssistantRemoteState = { shouldRender: !1 }, this.enableDebugger = !1, this.hideDocumentationActions = !1, this.hideSideBar = !1, this.openedSidePanel = "none", this.script = "", this.sideActionBarExpanded = !1, this.arcgisDiagnosticsChange = O({ bubbles: !1 }), this.arcgisScriptChange = O({ bubbles: !1 });
|
|
79
480
|
}
|
|
80
481
|
static {
|
|
81
|
-
this.properties = { _apiLibrary: 16,
|
|
482
|
+
this.properties = { _apiLibrary: 16, _editorProfile: 16, _preparingArcade: 16, _arcadeAssistantRemoteState: 16, editorInstance: 32, editorOptions: 0, enableDebugger: 5, hideDocumentationActions: 5, hideSideBar: 5, messageOverrides: 0, openedSidePanel: 3, profile: 0, script: 1, sideActionBarExpanded: 7, snippets: 0, suggestions: 0, testData: 0, customPanels: 0, arcadeAssistant: 0 };
|
|
82
483
|
}
|
|
83
484
|
static {
|
|
84
|
-
this.styles = [
|
|
485
|
+
this.styles = [ce];
|
|
486
|
+
}
|
|
487
|
+
get _usesBottomExecutionDrawer() {
|
|
488
|
+
return this.enableDebugger && !!this.testData;
|
|
85
489
|
}
|
|
86
490
|
get editorInstance() {
|
|
87
491
|
return this._codeEditorElt.value?.editorInstance;
|
|
88
492
|
}
|
|
493
|
+
get editorOptions() {
|
|
494
|
+
return {
|
|
495
|
+
...me,
|
|
496
|
+
...this._editorOptions
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
set editorOptions(e) {
|
|
500
|
+
this._editorOptions = e ?? {};
|
|
501
|
+
}
|
|
89
502
|
async getTestResult() {
|
|
90
503
|
if (!this.testData)
|
|
91
504
|
return { type: "error", value: "Missing test data", error: null };
|
|
@@ -93,43 +506,120 @@ class X extends k {
|
|
|
93
506
|
if (!e)
|
|
94
507
|
return { type: "error", value: "Missing editor profile", error: null };
|
|
95
508
|
await this._componentReadyDefer.promise;
|
|
96
|
-
const
|
|
97
|
-
return
|
|
509
|
+
const s = this._codeEditorElt.value?.value, i = await U(e.definition, s, this.testData, { mode: "run" });
|
|
510
|
+
return L(i) ? i : { type: "error", value: "Unexpected debug result", error: null };
|
|
98
511
|
}
|
|
99
512
|
async setFocus() {
|
|
100
513
|
await this._componentReadyDefer.promise, await this._codeEditorElt.value?.setFocus();
|
|
101
514
|
}
|
|
102
515
|
async load() {
|
|
103
|
-
const e =
|
|
104
|
-
|
|
516
|
+
const e = q("./assets");
|
|
517
|
+
Z(e), await this._updateDataModelDeps(), await this._updateArcadeAssistantRemoteState(), this.manager.onLifecycle(() => (this.hasUpdated && this._connectMonacoCustomizations().catch(g(this)), () => {
|
|
518
|
+
for (; this._disposables.length; )
|
|
519
|
+
this._disposables.pop()?.dispose();
|
|
520
|
+
this._connectMonacoCustomizationsPromise = void 0, this._executeScriptAction = void 0, this._clearDebuggerDecorations(), this._debuggerState.disconnect();
|
|
521
|
+
}));
|
|
105
522
|
}
|
|
106
523
|
willUpdate(e) {
|
|
107
|
-
(e.has("messages") || e.has("profile")) && this._updateDataModelDeps(), e.has("testData") && this._testDataChanged(), e.has("snippets") &&
|
|
524
|
+
(e.has("messages") || e.has("profile")) && this._updateDataModelDeps(), e.has("testData") && this._testDataChanged(), e.has("enableDebugger") && !this.enableDebugger && this._debuggerState.disableDebugger(), e.has("snippets") && P.updateApiContextForModel(this._modelId, {
|
|
108
525
|
snippets: this.snippets
|
|
109
526
|
}), e.has("arcadeAssistant") && this._updateArcadeAssistantRemoteState();
|
|
110
527
|
}
|
|
111
528
|
async loaded() {
|
|
112
|
-
this._componentReadyDefer.resolve(), await this._updateApiLibrary();
|
|
113
|
-
|
|
114
|
-
|
|
529
|
+
this._componentReadyDefer.resolve(), await this._updateApiLibrary(), await this._connectMonacoCustomizations(), await this._codeEditorElt.value?.setFocus();
|
|
530
|
+
}
|
|
531
|
+
_setOpenedSidePanel(e) {
|
|
532
|
+
this.openedSidePanel = e === this.openedSidePanel ? "none" : e;
|
|
533
|
+
}
|
|
534
|
+
async _connectMonacoCustomizations() {
|
|
535
|
+
if (this._disposables.length || this._connectMonacoCustomizationsPromise)
|
|
536
|
+
return await this._connectMonacoCustomizationsPromise;
|
|
537
|
+
this._connectMonacoCustomizationsPromise = (async () => {
|
|
538
|
+
if (await this.updateComplete, !this.isConnected || this._disposables.length)
|
|
539
|
+
return;
|
|
540
|
+
const e = await ee();
|
|
541
|
+
if (!this.isConnected || this._disposables.length)
|
|
542
|
+
return;
|
|
543
|
+
this._disposables.push(e.onDiagnosticsChange((d) => !this._preparingArcade && this.arcgisDiagnosticsChange.emit(d.diagnostics))), this.testData && !this._executeScriptAction && this._addExecuteScriptAction();
|
|
544
|
+
const s = T(() => this._debuggerState.breakpoints, () => this._updateBreakpointsDecorations(), { sync: !0 }), i = T(() => this._debuggerState.debuggerLine, () => this._updateDebuggerPausedLineDecoration(), { sync: !0 }), a = T(() => this._debuggerState.consoleLogs.length, () => this.requestUpdate(), { sync: !0 });
|
|
545
|
+
this._disposables.push({ dispose: () => s.remove() }, { dispose: () => i.remove() }, { dispose: () => a.remove() });
|
|
546
|
+
const r = this.editorInstance?.onMouseDown((d) => this._onEditorMouseDown(d));
|
|
547
|
+
r && this._disposables.push(r);
|
|
548
|
+
const n = this.editorInstance?.onDidChangeModelContent((d) => this._onEditorModelContentChange(d));
|
|
549
|
+
n && this._disposables.push(n), this._updateBreakpointsDecorations(), this._updateDebuggerPausedLineDecoration();
|
|
550
|
+
})();
|
|
551
|
+
try {
|
|
552
|
+
await this._connectMonacoCustomizationsPromise;
|
|
553
|
+
} finally {
|
|
554
|
+
this._connectMonacoCustomizationsPromise = void 0;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
_onEditorMouseDown(e) {
|
|
558
|
+
if (!this.enableDebugger || ![
|
|
559
|
+
this._monacoEditor.MouseTargetType.GUTTER_GLYPH_MARGIN,
|
|
560
|
+
this._monacoEditor.MouseTargetType.GUTTER_LINE_NUMBERS,
|
|
561
|
+
this._monacoEditor.MouseTargetType.GUTTER_LINE_DECORATIONS
|
|
562
|
+
].includes(e.target.type))
|
|
563
|
+
return;
|
|
564
|
+
const s = e.target.position?.lineNumber;
|
|
565
|
+
s && this._debuggerState.toggleBreakpoint(s);
|
|
566
|
+
}
|
|
567
|
+
_onEditorModelContentChange(e) {
|
|
568
|
+
if (!this.enableDebugger || !this._debuggerState.breakpoints.length || e.isFlush)
|
|
569
|
+
return;
|
|
570
|
+
const s = oe(this._debuggerState.breakpoints, e.changes);
|
|
571
|
+
s.length === this._debuggerState.breakpoints.length && s.every((i, a) => i === this._debuggerState.breakpoints[a]) || this._debuggerState.setBreakpoints(s);
|
|
115
572
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
573
|
+
_updateDebuggerPausedLineDecoration() {
|
|
574
|
+
const e = this.editorInstance;
|
|
575
|
+
if (!e)
|
|
576
|
+
return;
|
|
577
|
+
this._debuggerPausedLineDecoration?.clear();
|
|
578
|
+
const s = this._debuggerState.debuggerLine;
|
|
579
|
+
s != null ? this._debuggerPausedLineDecoration = e.createDecorationsCollection([
|
|
580
|
+
{
|
|
581
|
+
range: new z(s, 1, s, 1),
|
|
582
|
+
options: {
|
|
583
|
+
isWholeLine: !0,
|
|
584
|
+
className: "arcgis-code-editor__debugger-paused-line",
|
|
585
|
+
glyphMarginClassName: "arcgis-code-editor__debugger-paused-glyph",
|
|
586
|
+
marginClassName: "arcgis-code-editor__debugger-paused-line arcgis-code-editor__debugger-paused-margin"
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
]) : this._debuggerPausedLineDecoration = void 0;
|
|
590
|
+
}
|
|
591
|
+
_continueDebugSession() {
|
|
592
|
+
this._debuggerState.continueDebug();
|
|
593
|
+
}
|
|
594
|
+
_stopDebugSession({ hideExecutionPanel: e = !0 } = {}) {
|
|
595
|
+
this._debuggerState.stopDebug({ hidePanel: e });
|
|
596
|
+
}
|
|
597
|
+
_resetDebugSession() {
|
|
598
|
+
this._debuggerState.resetDebug(), this._executeScript("debug").catch(g(this));
|
|
599
|
+
}
|
|
600
|
+
async _handleDebugPause(e, s, i) {
|
|
601
|
+
if (!this._debuggerState.isDebugging || e !== this._debuggerState.sessionId)
|
|
602
|
+
return;
|
|
603
|
+
const a = Promise.withResolvers();
|
|
604
|
+
return this._debuggerState.pauseDebug({
|
|
605
|
+
line: s.line,
|
|
606
|
+
result: i,
|
|
607
|
+
continue: a
|
|
608
|
+
}), await a.promise;
|
|
119
609
|
}
|
|
120
610
|
async _updateDataModelDeps() {
|
|
121
611
|
await this._updateEditorProfile(), await this._updateApiLibrary();
|
|
122
612
|
}
|
|
123
613
|
_testDataChanged() {
|
|
124
|
-
!this.testData && this._executeScriptAction && (this._disposeSafely(this._executeScriptAction), this._executeScriptAction = void 0), this.testData && !this._executeScriptAction && this._addExecuteScriptAction(), this.
|
|
614
|
+
!this.testData && this._executeScriptAction && (this._disposeSafely(this._executeScriptAction), this._executeScriptAction = void 0), this.testData && !this._executeScriptAction && this._addExecuteScriptAction(), !this.testData && this.enableDebugger && this._debuggerState.clearForMissingTestData(), this._debuggerState.showPanel && this._executeScript("run").catch(g(this));
|
|
125
615
|
}
|
|
126
616
|
async _updateEditorProfile() {
|
|
127
617
|
this._preparingArcade = !0;
|
|
128
618
|
try {
|
|
129
|
-
await
|
|
619
|
+
await P.setProfileForModel(this._modelId, this.profile, {
|
|
130
620
|
locale: this.messages._t9nLocale,
|
|
131
621
|
snippets: this.snippets
|
|
132
|
-
}), this._editorProfile =
|
|
622
|
+
}), this._editorProfile = P.getEditorProfileForModel(this._modelId);
|
|
133
623
|
} catch {
|
|
134
624
|
this._editorProfile = void 0;
|
|
135
625
|
} finally {
|
|
@@ -137,26 +627,45 @@ class X extends k {
|
|
|
137
627
|
}
|
|
138
628
|
}
|
|
139
629
|
async _updateApiLibrary() {
|
|
140
|
-
this._apiLibrary = await
|
|
630
|
+
this._apiLibrary = await P.getApiLibraryForModel(this._modelId);
|
|
631
|
+
}
|
|
632
|
+
_setExecutionPanel(e) {
|
|
633
|
+
this._debuggerState.togglePanel(e);
|
|
141
634
|
}
|
|
142
|
-
async _executeScript() {
|
|
143
|
-
const
|
|
144
|
-
if (!this._codeEditorElt.value || !
|
|
635
|
+
async _executeScript(e) {
|
|
636
|
+
const s = this.testData;
|
|
637
|
+
if (!this._codeEditorElt.value || !s)
|
|
145
638
|
return;
|
|
146
|
-
const
|
|
147
|
-
if (!
|
|
148
|
-
this.
|
|
639
|
+
const i = e === "debug" ? this._debuggerState.startDebug() : this._debuggerState.startRun(), a = await this._editorProfilePromise;
|
|
640
|
+
if (!a) {
|
|
641
|
+
this._debuggerState.fail({ type: "error", value: "Missing editor profile", error: null });
|
|
149
642
|
return;
|
|
150
643
|
}
|
|
151
|
-
|
|
644
|
+
setTimeout(() => {
|
|
152
645
|
(async () => {
|
|
153
|
-
const
|
|
154
|
-
|
|
646
|
+
const r = this._codeEditorElt.value?.value, n = {
|
|
647
|
+
mode: e,
|
|
648
|
+
console: (w) => this._debuggerState.addConsoleLog(w),
|
|
649
|
+
breakpoints: e === "debug" ? this._debuggerState.debuggerBreakpoints : void 0
|
|
650
|
+
};
|
|
651
|
+
e === "debug" && (n.onDebugPause = this._handleDebugPause.bind(this, i));
|
|
652
|
+
const d = await U(a.definition, r, s, n);
|
|
653
|
+
if (i === this._debuggerState.sessionId) {
|
|
654
|
+
if (e === "debug") {
|
|
655
|
+
if (L(d)) {
|
|
656
|
+
this._debuggerState.fail(d);
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
this._debuggerState.completeDebug(d);
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
L(d) ? this._debuggerState.completeRun(d) : this._debuggerState.fail({ type: "error", value: "Unexpected debug result", error: null });
|
|
663
|
+
}
|
|
155
664
|
})();
|
|
156
665
|
}, 0);
|
|
157
666
|
}
|
|
158
667
|
_toggleShowExecutionPanel() {
|
|
159
|
-
this.
|
|
668
|
+
this._debuggerState.togglePanel();
|
|
160
669
|
}
|
|
161
670
|
_toggleSideActionBarExpanded() {
|
|
162
671
|
this.sideActionBarExpanded = !this.sideActionBarExpanded;
|
|
@@ -165,58 +674,58 @@ class X extends k {
|
|
|
165
674
|
e.stopPropagation(), this.script = e.detail, this.arcgisScriptChange.emit(e.detail);
|
|
166
675
|
}
|
|
167
676
|
_insertAsSnippet(e) {
|
|
168
|
-
this._codeEditorElt.value?.insertSnippet(e.detail).catch(
|
|
677
|
+
this._codeEditorElt.value?.insertSnippet(e.detail).catch(g(this));
|
|
169
678
|
}
|
|
170
679
|
_insertAsText(e) {
|
|
171
680
|
this._insertText(e.detail);
|
|
172
681
|
}
|
|
173
682
|
_insertText(e) {
|
|
174
|
-
this._codeEditorElt.value?.insertText(e).catch(
|
|
683
|
+
this._codeEditorElt.value?.insertText(e).catch(g(this));
|
|
175
684
|
}
|
|
176
685
|
_onResultPanelChange(e) {
|
|
177
|
-
const
|
|
178
|
-
this.
|
|
686
|
+
const s = e.currentTarget;
|
|
687
|
+
this._debuggerState.setPanel(s.openedResultPanel);
|
|
179
688
|
}
|
|
180
689
|
_onExecutionPanelClose() {
|
|
181
|
-
this.
|
|
690
|
+
this._debuggerState.closePanel();
|
|
182
691
|
}
|
|
183
692
|
_addExecuteScriptAction() {
|
|
184
693
|
const e = this.editorInstance?.addAction({
|
|
185
694
|
// An unique identifier for the action.
|
|
186
695
|
id: "run-script",
|
|
187
696
|
label: "Run Arcade Expression",
|
|
188
|
-
keybindings: [
|
|
697
|
+
keybindings: [re.F5],
|
|
189
698
|
contextMenuGroupId: "code",
|
|
190
699
|
contextMenuOrder: 1,
|
|
191
700
|
run: () => {
|
|
192
|
-
this.testData && this._executeScript().catch(
|
|
701
|
+
this.testData && this._executeScript("run").catch(g(this));
|
|
193
702
|
}
|
|
194
703
|
});
|
|
195
704
|
e && (this._executeScriptAction = e, this._disposables.push(e));
|
|
196
705
|
}
|
|
197
706
|
_disposeSafely(e) {
|
|
198
|
-
const
|
|
199
|
-
|
|
707
|
+
const s = this._disposables.indexOf(e);
|
|
708
|
+
s !== -1 && this._disposables.splice(s, 1), e.dispose();
|
|
200
709
|
}
|
|
201
710
|
async _updateArcadeAssistantRemoteState() {
|
|
202
|
-
this.arcadeAssistant && (this._arcadeAssistantRemoteState = await
|
|
711
|
+
this.arcadeAssistant && (this._arcadeAssistantRemoteState = await ge({
|
|
203
712
|
...this.arcadeAssistant,
|
|
204
713
|
profile: this.profile
|
|
205
714
|
}));
|
|
206
715
|
}
|
|
207
716
|
renderMainActionBar() {
|
|
208
|
-
return this.testData ?
|
|
209
|
-
this._executeScript().catch(
|
|
210
|
-
}}></calcite-action>${this.
|
|
717
|
+
return this.enableDebugger || !this.testData ? null : l`<calcite-action-bar class="main-action-bar" layout=horizontal scale=s expanded expand-disabled slot=top-action-bar><calcite-action-group scale=s><calcite-action .text=${this.messages.run ?? ""} text-enabled icon=play scale=s .loading=${this._preparingArcade} @click=${() => {
|
|
718
|
+
this._executeScript("run").catch(g(this));
|
|
719
|
+
}}></calcite-action>${this._debuggerState.result ? l`<calcite-action .text=${this.messages.lastresults ?? ""} .active=${this._debuggerState.showPanel} text-enabled icon=access-string-results icon-flip-rtl scale=s @click=${this._toggleShowExecutionPanel}></calcite-action>` : null}</calcite-action-group></calcite-action-bar>`;
|
|
211
720
|
}
|
|
212
721
|
renderMainPanel() {
|
|
213
|
-
return
|
|
722
|
+
return l`<arcgis-code-editor slot=editor .editorOptions=${this.editorOptions} .language=${P.languageId} .value=${this.script ?? ""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${ie(this._codeEditorElt)}></arcgis-code-editor>`;
|
|
214
723
|
}
|
|
215
|
-
renderAction({ id: e, label:
|
|
216
|
-
return
|
|
724
|
+
renderAction({ id: e, label: s, icon: i, active: a, panelName: r, iconFlipRtl: n = !1, onClick: d = this._toggleSidePanel }) {
|
|
725
|
+
return l`<calcite-action id=${e ?? F} .text=${s} .textEnabled=${this.sideActionBarExpanded} .icon=${i} .active=${a} @click=${d} data-panel-name=${r ?? F} .iconFlipRtl=${n}></calcite-action>${!this.sideActionBarExpanded && l`<calcite-tooltip .referenceElement=${e}><span>${s}</span></calcite-tooltip>` || ""}`;
|
|
217
726
|
}
|
|
218
727
|
renderSideActionBar() {
|
|
219
|
-
return this.hideSideBar ? null :
|
|
728
|
+
return this.hideSideBar ? null : l`<calcite-action-bar slot=side-action-bar class="side-action-bar" .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action-group>${this.renderAction({
|
|
220
729
|
id: "profile-variables-action",
|
|
221
730
|
label: this.messages.profilevariables ?? "",
|
|
222
731
|
icon: "profile-variables",
|
|
@@ -260,28 +769,47 @@ class X extends k {
|
|
|
260
769
|
if (this.hideSideBar)
|
|
261
770
|
return null;
|
|
262
771
|
const { openedSidePanel: e } = this;
|
|
263
|
-
return
|
|
772
|
+
return l`<arcgis-language-api-panel slot=side-panel class=${x(e === "api" ? "" : "hidden")} .loading=${this._preparingArcade} .apiLibrary=${this._apiLibrary} .hideDocumentationActions=${this.hideDocumentationActions} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none .closed=${e !== "api"}></arcgis-language-api-panel><arcgis-editor-variables slot=side-panel class=${x(e === "variables" ? "" : "hidden")} .loading=${this._preparingArcade} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none .variable=${this._editorProfile} .closed=${e !== "variables"} .messageOverrides=${{ profileempty: this.messages.profileempty }}></arcgis-editor-variables>${this.suggestions?.length && l`<arcgis-arcade-suggestions slot=side-panel class=${x(e === "suggestions" ? "" : "hidden")} .closed=${e !== "suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none></arcgis-arcade-suggestions>` || ""}${this.arcadeAssistant && this._arcadeAssistantRemoteState.shouldRender && l`<arcgis-arcade-coding-assistant slot=side-panel class=${x(e === "arcade-assistant" ? "" : "hidden")} .closed=${e !== "arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._closeSidePanel} .portalUrl=${this.arcadeAssistant.portalUrl} .serviceUrl=${"serviceUrl" in this._arcadeAssistantRemoteState ? this._arcadeAssistantRemoteState.serviceUrl : void 0} .helpBase=${this._arcadeAssistantRemoteState.helpBase} .assistantsEnabled=${this._arcadeAssistantRemoteState.assistantsEnabled} .feedbackServiceUrl=${this._arcadeAssistantRemoteState.feedbackServiceUrl} .editorRef=${this.el} .appVersion=${this.arcadeAssistant.appVersion} .disableQuestionAnswerLogging=${this.arcadeAssistant.disableQuestionAnswerLogging}></arcgis-arcade-coding-assistant>` || ""}${this.customPanels?.map((s) => l`<calcite-flow slot=side-panel class=${x(e === s.id ? "" : "hidden")}>${s?.useFlows ? s.renderer?.({
|
|
264
773
|
closePanel: this._toggleSidePanel,
|
|
265
774
|
insertText: this._insertText.bind(this),
|
|
266
|
-
closed: e !==
|
|
775
|
+
closed: e !== s.id,
|
|
267
776
|
/** pass this.el instead of "this" as it is what actually gets attached to the dom */
|
|
268
777
|
editorRef: this.el
|
|
269
|
-
}) :
|
|
778
|
+
}) : l`<calcite-flow-item .heading=${s.name} heading-level=2 closable .closed=${e !== s.id} @calciteFlowItemClose=${this._toggleSidePanel} .description=${s.description}>${s.renderer?.({
|
|
270
779
|
closePanel: this._toggleSidePanel,
|
|
271
780
|
insertText: this._insertText.bind(this),
|
|
272
|
-
closed: e !==
|
|
781
|
+
closed: e !== s.id,
|
|
273
782
|
/** pass this.el instead of "this" as it is what actually gets attached to the dom */
|
|
274
783
|
editorRef: this.el
|
|
275
784
|
})}</calcite-flow-item>`}</calcite-flow>`)}`;
|
|
276
785
|
}
|
|
277
786
|
renderResultsPanel() {
|
|
278
|
-
|
|
787
|
+
if (this._usesBottomExecutionDrawer)
|
|
788
|
+
return this.renderBottomExecutionBody();
|
|
789
|
+
if (!this._debuggerState.showPanel)
|
|
790
|
+
return null;
|
|
791
|
+
const e = this._debuggerState.openedPanel === "debug-console" ? "output" : this._debuggerState.openedPanel;
|
|
792
|
+
return l`<arcgis-arcade-results slot=results-panel .openedResultPanel=${e} .loading=${this._debuggerState.isExecuting} .result=${this._debuggerState.runResult} .consoleLogs=${this._debuggerState.consoleLogs} @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange} @arcgisInternalClosePanel=${this._onExecutionPanelClose}></arcgis-arcade-results>`;
|
|
793
|
+
}
|
|
794
|
+
renderBottomExecutionBody() {
|
|
795
|
+
const { showPanel: e, openedPanel: s, debugResult: i, isExecuting: a, mode: r } = this._debuggerState;
|
|
796
|
+
return e ? s === "debug-console" ? l`<arcgis-arcade-debugger-console slot=results-panel .modelId=${this._modelId} .debuggerStore=${this._debuggerState}></arcgis-arcade-debugger-console>` : s === "output" && r === "debug" ? l`<arcgis-arcade-debugger-output slot=results-panel .debuggerStore=${this._debuggerState} .result=${i}></arcgis-arcade-debugger-output>` : l`<arcgis-arcade-results slot=results-panel class="bottom-results" .openedResultPanel=${s} .loading=${s === "console" && this._debuggerState.isPaused ? !1 : a} .result=${this._debuggerState.runResult} .consoleLogs=${this._debuggerState.consoleLogs} hide-header @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange}></arcgis-arcade-results>` : null;
|
|
797
|
+
}
|
|
798
|
+
renderBottomActionBar() {
|
|
799
|
+
if (!this._usesBottomExecutionDrawer)
|
|
800
|
+
return null;
|
|
801
|
+
const { showPanel: e, hasExecuted: s, openedPanel: i, isDebugging: a, isPaused: r, isExecuting: n } = this._debuggerState;
|
|
802
|
+
return l`<calcite-action-bar slot=bottom-action-bar class=${`main-action-bar bottom-action-bar ${e ? "" : "is-collapsed"}`} layout=horizontal scale=s expand-disabled><calcite-action-group scale=s>${a ? l`<calcite-action .text=${this.messages.continue ?? "Continue"} icon=forward scale=s .disabled=${!r} @click=${this._continueDebugSession}></calcite-action><calcite-action .text=${this.messages.reset ?? "Reset"} icon=reset scale=s @click=${this._resetDebugSession}></calcite-action><calcite-action .text=${this.messages.stop ?? "Stop"} icon=circle-stop scale=s @click=${() => this._stopDebugSession()}></calcite-action>` : l`<calcite-action .text=${this.messages.run ?? ""} text-enabled icon=play scale=s .loading=${this._preparingArcade || n} @click=${() => {
|
|
803
|
+
this._executeScript("run").catch(g(this));
|
|
804
|
+
}}></calcite-action><calcite-action .text=${this.messages.runanddebug ?? "Run and Debug"} text-enabled icon=debug-script scale=s .loading=${this._preparingArcade || n} @click=${() => {
|
|
805
|
+
this._executeScript("debug").catch(g(this));
|
|
806
|
+
}}></calcite-action>`}</calcite-action-group>${s ? l`<calcite-action-group scale=s><calcite-action .active=${i === "output" && e} .text=${this.messages.output ?? "Output"} text-enabled scale=s icon=list-show-all icon-flip-rtl @click=${() => this._setExecutionPanel("output")}></calcite-action><calcite-action .active=${i === "console" && e} .text=${this.messages.console ?? "Console"} text-enabled scale=s icon=console icon-flip-rtl @click=${() => this._setExecutionPanel("console")}></calcite-action><calcite-action .active=${i === "log" && e} .text=${this.messages.log ?? "Log"} text-enabled scale=s icon=list icon-flip-rtl @click=${() => this._setExecutionPanel("log")}></calcite-action><calcite-action .active=${i === "debug-console" && e} .text=${this.messages.debugconsole ?? "Debug Console"} text-enabled scale=s icon=debug-script icon-flip-rtl .disabled=${this._debuggerState.mode !== "debug"} @click=${() => this._setExecutionPanel("debug-console")}></calcite-action></calcite-action-group>` : null}${e ? l`<calcite-action-group scale=s><calcite-action .text=${this.messages.close ?? "Close"} scale=s icon=x icon-flip-rtl @click=${this._onExecutionPanelClose}></calcite-action></calcite-action-group>` : null}</calcite-action-bar>`;
|
|
279
807
|
}
|
|
280
808
|
render() {
|
|
281
|
-
return
|
|
809
|
+
return l`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderBottomActionBar()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`;
|
|
282
810
|
}
|
|
283
811
|
}
|
|
284
|
-
|
|
812
|
+
W("arcgis-arcade-editor", Se);
|
|
285
813
|
export {
|
|
286
|
-
|
|
814
|
+
Se as ArcgisArcadeEditor
|
|
287
815
|
};
|