base-screen 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/README.md +12 -5
  2. package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-workbench-callbacks.d.ts +2 -0
  3. package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-workbench-controller.d.ts +73 -16
  4. package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-workbench-panel.d.ts +41 -0
  5. package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-panel-controller.d.ts +62 -0
  6. package/dist/_internal/engine/browser/controllers/designer-size-tier-controller.d.ts +60 -0
  7. package/dist/_internal/engine/browser/controllers/panel/designer-material-group-navigation-controller.d.ts +2 -0
  8. package/dist/_internal/engine/browser/controllers/panel/designer-panel-controller.d.ts +2 -0
  9. package/dist/_internal/engine/browser/controllers/panel/designer-panel-inspector-controller.d.ts +6 -0
  10. package/dist/_internal/engine/browser/controllers/panel/designer-panel-material-controller.d.ts +1 -0
  11. package/dist/_internal/engine/browser/controllers/workbench/designer-panel-layout-controller.d.ts +22 -1
  12. package/dist/_internal/engine/browser/controllers/workbench/designer-workbench-controller.d.ts +5 -0
  13. package/dist/_internal/engine/browser/controllers/workbench/designer-workbench-tabs-controller.d.ts +1 -0
  14. package/dist/_internal/engine/browser/dom/workspace/designer-workspace-markup.d.ts +2 -0
  15. package/dist/_internal/engine/browser/dom/workspace/designer-workspace-skeleton.d.ts +7 -0
  16. package/dist/_internal/engine/browser/dom/workspace/designer-workspace.d.ts +1 -1
  17. package/dist/_internal/engine/common/ui-text/designer-blueprint-ui-text.d.ts +1 -0
  18. package/dist/_internal/engine/common/ui-text/designer-ui-text.d.ts +5 -1
  19. package/dist/_internal/engine/designer-blueprint-workbench-panel-C2MoZwKA.js +3548 -0
  20. package/dist/_internal/engine/designer-dataset-controller-CPytVNBK.js +4426 -0
  21. package/dist/_internal/engine/designer-element/runtime/designer-element-rendering.d.ts +7 -0
  22. package/dist/_internal/engine/designer-element/runtime/designer-element-skeleton.d.ts +14 -0
  23. package/dist/_internal/engine/designer-element/runtime/designer-element-state.d.ts +12 -2
  24. package/dist/_internal/engine/designer-left-panel-groups-dom-WMsH33zw.js +573 -0
  25. package/dist/_internal/engine/designer-ui-primitives-CH4RNiMa.js +2155 -0
  26. package/dist/_internal/engine/host-resource-selection-5Cf_gclK.js +2188 -0
  27. package/dist/_internal/engine/index.js +4944 -17147
  28. package/dist/_internal/renderer/index.js +266 -216
  29. package/dist/_internal/renderer/viewer/viewer-skeleton.d.ts +10 -0
  30. package/dist/_internal/renderer/viewer/viewer-variable-controller.d.ts +2 -0
  31. package/dist/_internal/renderer/viewer/viewer.d.ts +8 -0
  32. package/dist/_internal/sdk/auto-register.js +7 -7
  33. package/dist/_internal/sdk/designer-auto-register.js +2 -2
  34. package/dist/_internal/sdk/designer.d.ts +6 -0
  35. package/dist/_internal/sdk/designer.js +11 -1
  36. package/dist/_internal/sdk/index.d.ts +1 -1
  37. package/dist/_internal/sdk/index.js +6 -6
  38. package/dist/authoring-EcyK2YVN.js +103 -0
  39. package/dist/authoring-EcyK2YVN.js.map +1 -0
  40. package/dist/auto-register.js +12 -10
  41. package/dist/auto-register.js.map +1 -1
  42. package/dist/contracts.js +5 -4
  43. package/dist/contracts.js.map +1 -1
  44. package/dist/{contrast-B4TH-dvm.js → contrast-CZFqj1I5.js} +23 -23
  45. package/dist/{contrast-B4TH-dvm.js.map → contrast-CZFqj1I5.js.map} +1 -1
  46. package/dist/core.js +10 -8
  47. package/dist/core.js.map +1 -1
  48. package/dist/designer-Byw45cUM.js +21 -0
  49. package/dist/designer-Byw45cUM.js.map +1 -0
  50. package/dist/designer-auto-register.js +5 -3
  51. package/dist/designer-auto-register.js.map +1 -1
  52. package/dist/designer-blueprint-workbench-panel-C2MoZwKA-CbXkv78O.js +3517 -0
  53. package/dist/designer-blueprint-workbench-panel-C2MoZwKA-CbXkv78O.js.map +1 -0
  54. package/dist/designer-dataset-controller-CPytVNBK-DWL3SRTP.js +4354 -0
  55. package/dist/designer-dataset-controller-CPytVNBK-DWL3SRTP.js.map +1 -0
  56. package/dist/designer-left-panel-groups-dom-WMsH33zw-B9pl8loh.js +557 -0
  57. package/dist/designer-left-panel-groups-dom-WMsH33zw-B9pl8loh.js.map +1 -0
  58. package/dist/designer-ui-primitives-CH4RNiMa-BNXQwJPZ.js +2146 -0
  59. package/dist/designer-ui-primitives-CH4RNiMa-BNXQwJPZ.js.map +1 -0
  60. package/dist/designer.js +5 -3
  61. package/dist/{dist-CR13A2Yb.js → dist-BHTClwId.js} +4785 -16808
  62. package/dist/dist-BHTClwId.js.map +1 -0
  63. package/dist/{dist-CAdGDmU3.js → dist-DfAV2jGI.js} +277 -227
  64. package/dist/dist-DfAV2jGI.js.map +1 -0
  65. package/dist/editor-descriptor-schema-Be30Wv8w.js +190 -0
  66. package/dist/editor-descriptor-schema-Be30Wv8w.js.map +1 -0
  67. package/dist/engine.js +4 -2
  68. package/dist/hierarchy-BQZrZWbC.js +86 -0
  69. package/dist/hierarchy-BQZrZWbC.js.map +1 -0
  70. package/dist/host-resource-selection-5Cf_gclK-Sv4Z8UXS.js +2141 -0
  71. package/dist/host-resource-selection-5Cf_gclK-Sv4Z8UXS.js.map +1 -0
  72. package/dist/index.js +11 -9
  73. package/dist/{manager-Bhqi_KmD.js → manager-B2CZ2b5I.js} +2 -2
  74. package/dist/{manager-Bhqi_KmD.js.map → manager-B2CZ2b5I.js.map} +1 -1
  75. package/dist/material-BPlvEmDi.js +12 -0
  76. package/dist/material-BPlvEmDi.js.map +1 -0
  77. package/dist/material-auto-register.d.ts +1 -0
  78. package/dist/material-auto-register.js +16 -0
  79. package/dist/material-auto-register.js.map +1 -0
  80. package/dist/{material-definition-BJ4ujhuj.js → material-definition-B9xCZcD-.js} +2 -2
  81. package/dist/{material-definition-BJ4ujhuj.js.map → material-definition-B9xCZcD-.js.map} +1 -1
  82. package/dist/{material-manifest-LdgIkzgH.js → material-manifest-bsGl6vZZ.js} +70 -256
  83. package/dist/material-manifest-bsGl6vZZ.js.map +1 -0
  84. package/dist/material.js +3 -2
  85. package/dist/parse-B0hwp_yj.js +264 -0
  86. package/dist/parse-B0hwp_yj.js.map +1 -0
  87. package/dist/plugin-core.js +3 -2
  88. package/dist/plugin-manager.js +1 -1
  89. package/dist/{plugin-package-BfZLl3ru.js → plugin-package-BT-pCoTt.js} +3 -3
  90. package/dist/{plugin-package-BfZLl3ru.js.map → plugin-package-BT-pCoTt.js.map} +1 -1
  91. package/dist/{plugin-registration-CYtTqIxF.js → plugin-registration-BjS_CXJU.js} +2 -2
  92. package/dist/{plugin-registration-CYtTqIxF.js.map → plugin-registration-BjS_CXJU.js.map} +1 -1
  93. package/dist/plugin-sdk.js +3 -3
  94. package/dist/{plugins-DRaykV9c.js → plugins-B9bwk-t6.js} +2 -2
  95. package/dist/{plugins-DRaykV9c.js.map → plugins-B9bwk-t6.js.map} +1 -1
  96. package/dist/plugins.js +5 -5
  97. package/dist/renderer.js +1 -1
  98. package/dist/runtime-dispatch-Dt9fhcI5.js +360 -0
  99. package/dist/runtime-dispatch-Dt9fhcI5.js.map +1 -0
  100. package/dist/{src-Bm7u11mN-BPS5TRsq.js → src-Bm7u11mN-BMeb9fvV.js} +40 -39
  101. package/dist/{src-Bm7u11mN-BPS5TRsq.js.map → src-Bm7u11mN-BMeb9fvV.js.map} +1 -1
  102. package/dist/{material-2XmHe-aH.js → text-BVzTcUas.js} +44 -52
  103. package/dist/text-BVzTcUas.js.map +1 -0
  104. package/dist/value-ref-y4_YKUP5.js +278 -0
  105. package/dist/value-ref-y4_YKUP5.js.map +1 -0
  106. package/dist/{viewer-CrJupI8I-D2BtwLsA.js → viewer-CrJupI8I-DZZfdHXr.js} +5 -5
  107. package/dist/{viewer-CrJupI8I-D2BtwLsA.js.map → viewer-CrJupI8I-DZZfdHXr.js.map} +1 -1
  108. package/dist/viewer-auto-register.js +2 -2
  109. package/dist/viewer.js +2 -2
  110. package/package.json +17 -18
  111. package/dist/_internal/react/components.d.ts +0 -32
  112. package/dist/_internal/react/index.d.ts +0 -14
  113. package/dist/_internal/react/index.js +0 -215
  114. package/dist/_internal/vue/components.d.ts +0 -36
  115. package/dist/_internal/vue/global-styles.d.ts +0 -10
  116. package/dist/_internal/vue/index.d.ts +0 -14
  117. package/dist/_internal/vue/index.js +0 -290
  118. package/dist/designer-xtN0h7PL.js +0 -11
  119. package/dist/designer-xtN0h7PL.js.map +0 -1
  120. package/dist/dist-CAdGDmU3.js.map +0 -1
  121. package/dist/dist-CR13A2Yb.js.map +0 -1
  122. package/dist/material-2XmHe-aH.js.map +0 -1
  123. package/dist/material-manifest-LdgIkzgH.js.map +0 -1
  124. package/dist/parse-CYwxTDJU.js +0 -364
  125. package/dist/parse-CYwxTDJU.js.map +0 -1
  126. package/dist/react.d.ts +0 -1
  127. package/dist/react.js +0 -213
  128. package/dist/react.js.map +0 -1
  129. package/dist/value-ref-Z0o70Vy6.js +0 -716
  130. package/dist/value-ref-Z0o70Vy6.js.map +0 -1
  131. package/dist/vue.d.ts +0 -1
  132. package/dist/vue.js +0 -288
  133. package/dist/vue.js.map +0 -1
@@ -0,0 +1,4426 @@
1
+ import { M as e, d as t, j as n, l as r, r as i, s as a, u as o } from "./host-resource-selection-5Cf_gclK.js";
2
+ import { _ as s, a as c, c as l, d as u, h as d, i as f, m as p, n as m, o as h, r as g, s as _, u as v, y } from "./designer-ui-primitives-CH4RNiMa.js";
3
+ import { validateScreenHostResourceBinding as b } from "@base-screen/core";
4
+ import "@base-screen/plugin-core";
5
+ import { MAX_DATASET_ROWS as x, derivedDataSourceId as ee, evaluateScreenDatasetParameters as S, parseScreenDatasetDefinition as C, parseScreenDatasetEntries as te, parseScreenDatasetGroups as w, parseScreenJsonValue as T, parseScreenTabularDataset as E, readScreenComponentDataBinding as D, readScreenComponentValueRef as O, readScreenDocumentDataSources as ne, readScreenVariableRecord as re } from "@base-screen/contracts";
6
+ //#region src/browser/controllers/dataset/designer-data-flow-scroll-sync.ts
7
+ var ie = "[data-ds-section]", ae = {
8
+ value: "source",
9
+ source: "source",
10
+ "host-link": "source",
11
+ preview: "preview",
12
+ authoring: "preview"
13
+ }, oe = class {
14
+ onStepChange;
15
+ #e;
16
+ #t;
17
+ #n;
18
+ #r;
19
+ constructor(e) {
20
+ this.onStepChange = e;
21
+ }
22
+ bind(e) {
23
+ let t = e.querySelector(".designer-inspector-data-flow-content"), n = e.querySelector(".designer-inspector-data-flow");
24
+ if (t === null || n === null) {
25
+ this.clear();
26
+ return;
27
+ }
28
+ if (this.#e === t) {
29
+ this.handleScroll();
30
+ return;
31
+ }
32
+ this.disconnectListener(), this.#e = t;
33
+ let r = () => this.handleScroll();
34
+ t.addEventListener("scroll", r, { passive: !0 }), this.#t = r, this.handleScroll();
35
+ }
36
+ beginProgrammaticScroll(e) {
37
+ this.#n = e, this.#r !== void 0 && globalThis.clearTimeout(this.#r), this.#r = globalThis.setTimeout(() => {
38
+ this.#n = void 0, this.#r = void 0, this.handleScroll();
39
+ }, 700);
40
+ }
41
+ clear() {
42
+ this.disconnectListener(), this.#r !== void 0 && (globalThis.clearTimeout(this.#r), this.#r = void 0), this.#n = void 0;
43
+ }
44
+ handleScroll() {
45
+ let e = this.#e;
46
+ if (e === void 0) return;
47
+ let t = [...e.querySelectorAll(ie)];
48
+ if (t.length === 0) return;
49
+ let n = e.scrollTop + e.clientHeight >= e.scrollHeight - 10 ? e.scrollTop + e.clientHeight : e.scrollTop + Math.min(e.clientHeight * .25, 80), r = "source";
50
+ for (let e of t) {
51
+ if (e.offsetTop > n) break;
52
+ let t = ae[e.dataset.dsSection];
53
+ t !== void 0 && (r = t);
54
+ }
55
+ this.emitStep(r);
56
+ }
57
+ emitStep(e) {
58
+ (this.#n === void 0 || e === this.#n) && this.onStepChange(e);
59
+ }
60
+ disconnectListener() {
61
+ this.#e !== void 0 && this.#t !== void 0 && this.#e.removeEventListener("scroll", this.#t), this.#t = void 0, this.#e = void 0;
62
+ }
63
+ };
64
+ //#endregion
65
+ //#region src/browser/controllers/dataset/designer-data-source-authoring.ts
66
+ function se(e, t) {
67
+ if (t === void 0) return null;
68
+ if (t.dataSource?.type === "dataset") return {
69
+ source: t.dataSource,
70
+ instanceId: void 0,
71
+ instance: void 0
72
+ };
73
+ let n = O(t);
74
+ if (n === null || n.kind !== "data-source-field" || e === void 0) return null;
75
+ let r = ne(e).find((e) => e.id === n.dataSourceId);
76
+ if (r === void 0 || r.source.kind !== "dataset") return null;
77
+ let i = {};
78
+ for (let [e, t] of Object.entries(r.params)) {
79
+ let n = ue(t);
80
+ n !== void 0 && (i[e] = n);
81
+ }
82
+ return {
83
+ source: {
84
+ type: "dataset",
85
+ datasetId: r.source.datasetId,
86
+ params: i,
87
+ binding: D(t)
88
+ },
89
+ instanceId: r.id,
90
+ instance: r
91
+ };
92
+ }
93
+ function ce(e, t, n, r = []) {
94
+ let i = {};
95
+ for (let n of e.parameters) {
96
+ let e = t.params[n.name];
97
+ e === void 0 ? n.defaultValue !== void 0 && (i[n.name] = {
98
+ kind: "inline",
99
+ value: n.defaultValue
100
+ }) : i[n.name] = e;
101
+ }
102
+ let a = n == null ? fe(e, r) : Object.fromEntries(Object.entries(n.fields).map(([e, t]) => [e, [...t]]));
103
+ return {
104
+ datasetId: e.datasetId,
105
+ params: i,
106
+ fields: a
107
+ };
108
+ }
109
+ function le(e) {
110
+ return e.kind === "variable" ? {
111
+ kind: "variable",
112
+ variableId: e.variableId
113
+ } : {
114
+ kind: "inline",
115
+ value: e.value
116
+ };
117
+ }
118
+ function ue(e) {
119
+ if (e.kind === "variable") return {
120
+ kind: "variable",
121
+ variableId: e.variableId
122
+ };
123
+ if (e.kind === "inline") return {
124
+ kind: "literal",
125
+ value: e.value
126
+ };
127
+ }
128
+ function de(e, t, n = []) {
129
+ let r = t?.type === "dataset" && t.datasetId === e.datasetId, i = {};
130
+ for (let n of e.parameters) {
131
+ let e = r ? t.params[n.name] : void 0;
132
+ e === void 0 ? n.defaultValue !== void 0 && (i[n.name] = {
133
+ kind: "inline",
134
+ value: n.defaultValue
135
+ }) : i[n.name] = le(e);
136
+ }
137
+ let a = r ? Object.fromEntries(Object.entries(t.binding?.fields ?? {}).map(([e, t]) => [e, [...t]])) : {};
138
+ return r || Object.assign(a, fe(e, n)), {
139
+ datasetId: e.datasetId,
140
+ params: i,
141
+ fields: a
142
+ };
143
+ }
144
+ function fe(e, t) {
145
+ let n = {}, r = /* @__PURE__ */ new Set();
146
+ for (let i of t) {
147
+ let t = e.fields.filter((e) => i.valueTypes.includes(e.valueType)), a = [];
148
+ if (i.maxFields === 1) {
149
+ let e = t.find((e) => !r.has(e.id)) ?? t[0];
150
+ e !== void 0 && (a = [e.id]);
151
+ } else a = i.id === "columns" ? t.slice(0, i.maxFields).map((e) => e.id) : t.filter((e) => !r.has(e.id)).slice(0, i.minFields).map((e) => e.id);
152
+ if (a.length >= i.minFields) {
153
+ n[i.id] = a;
154
+ for (let e of a) r.add(e);
155
+ }
156
+ }
157
+ return n;
158
+ }
159
+ function pe(e, t) {
160
+ if (t.valueType === "boolean" && e instanceof HTMLInputElement) return e.checked;
161
+ if (t.valueType === "number") {
162
+ if (e.value.trim() === "") return;
163
+ let t = Number(e.value);
164
+ return Number.isFinite(t) ? t : void 0;
165
+ }
166
+ return e.value;
167
+ }
168
+ function me(e) {
169
+ let t = e?.manifest.dataCapabilities ?? [];
170
+ return [
171
+ "none",
172
+ ...t.includes("static") ? ["static"] : [],
173
+ ...t.includes("variable") ? ["variable"] : [],
174
+ ...t.includes("dataset") ? ["dataset"] : [],
175
+ ...t.includes("host-resource") ? ["host-resource"] : []
176
+ ];
177
+ }
178
+ function he(e, t, n) {
179
+ return t === "" ? e : {
180
+ ...e,
181
+ params: {
182
+ ...e.params,
183
+ [t]: n
184
+ }
185
+ };
186
+ }
187
+ function ge(e, t, n) {
188
+ let r = e.fields[t.id] ?? [], i = r.includes(n) ? r.filter((e) => e !== n) : t.maxFields === 1 ? [n] : r.length < t.maxFields ? [...r, n] : r;
189
+ return {
190
+ ...e,
191
+ fields: {
192
+ ...e.fields,
193
+ [t.id]: i
194
+ }
195
+ };
196
+ }
197
+ function _e(e, t, n, r, i = []) {
198
+ let a;
199
+ try {
200
+ a = JSON.parse(t);
201
+ } catch {
202
+ return A("CORE_COMMAND_INVALID", y.dataSource.staticInvalid);
203
+ }
204
+ let o = T(a);
205
+ if (!o.ok || n?.kind === "scalar" && typeof o.value !== n.valueType) return A("CORE_COMMAND_INVALID", y.dataSource.staticInvalid);
206
+ if (n?.kind === "tabular") {
207
+ let t = E(o.value);
208
+ if (!t.ok) return t;
209
+ let n = b(r ?? null, t.value.fields, i);
210
+ return n.ok ? k(Oe(e, {
211
+ type: "static",
212
+ value: t.value,
213
+ ...r === void 0 ? {} : { binding: r }
214
+ })) : n;
215
+ }
216
+ return k(Oe(e, {
217
+ type: "static",
218
+ value: o.value
219
+ }));
220
+ }
221
+ function ve(e) {
222
+ let t = ye(e.document, e.descriptor, e.draft);
223
+ if (!t.ok) return t;
224
+ let n = e.roles.length === 0 ? null : { fields: e.draft.fields }, r = b(n, e.descriptor.fields, e.roles);
225
+ if (!r.ok) return r;
226
+ let i = e.document.dataSources ?? [], a = e.preferredInstanceId === void 0 ? void 0 : i.find((t) => t.id === e.preferredInstanceId), o = a !== void 0 && a.source.kind === "dataset" && a.source.datasetId === e.descriptor.datasetId ? a : i.find((t) => t.source.kind === "dataset" && t.source.datasetId === e.descriptor.datasetId && xe(t.params, e.draft.params)), s = o?.id ?? Ce(i, e.componentId), c = {
227
+ ...o ?? {
228
+ id: s,
229
+ name: e.descriptor.name
230
+ },
231
+ id: s,
232
+ name: o?.name ?? e.descriptor.name,
233
+ source: {
234
+ kind: "dataset",
235
+ datasetId: e.descriptor.datasetId
236
+ },
237
+ params: e.draft.params
238
+ }, l = o === void 0 ? [...i, c] : i.map((e) => e.id === s ? c : e), u = e.document.components.find((t) => t.id === e.componentId), d = u === void 0 ? null : O(u), f = d?.kind === "data-source-field" ? d.dataSourceId : void 0, p = [{
239
+ type: "replace-data-sources",
240
+ dataSources: l
241
+ }, {
242
+ type: "update-components",
243
+ componentIds: [e.componentId],
244
+ patch: {
245
+ dataSource: null,
246
+ dataValue: {
247
+ kind: "data-source-field",
248
+ dataSourceId: s,
249
+ path: []
250
+ },
251
+ dataBinding: n
252
+ }
253
+ }];
254
+ return f !== void 0 && f !== s && i.some((e) => e.id === f) && !be(e.document, e.componentId, f) && p.push({
255
+ type: "replace-data-sources",
256
+ dataSources: l.filter((e) => e.id !== f)
257
+ }), k({ commands: p });
258
+ }
259
+ function ye(e, t, n) {
260
+ for (let r of t.parameters) {
261
+ let t = n.params[r.name];
262
+ if (t === void 0 && r.required || t?.kind === "variable" && !e.variables.some((e) => e.id === t.variableId)) return A("HOST_DATASET_PARAMETER_INVALID", y.dataset.incomplete);
263
+ }
264
+ let r = {};
265
+ for (let [e, i] of Object.entries(n.params)) {
266
+ let n = t.parameters.find((t) => t.name === e);
267
+ if (n === void 0) return A("HOST_DATASET_PARAMETER_INVALID", y.dataset.incomplete);
268
+ r[e] = i.kind === "inline" ? i.value : we(n);
269
+ }
270
+ let i = S(t.parameters, r);
271
+ return i.ok ? k(null) : i;
272
+ }
273
+ function be(e, t, n) {
274
+ for (let r of e.components) {
275
+ if (r.id === t) continue;
276
+ let e = O(r);
277
+ if (e?.kind === "data-source-field" && e.dataSourceId === n) return !0;
278
+ }
279
+ for (let t of e.variables) {
280
+ let e = re(t).value;
281
+ if (e.kind === "data-source-field" && e.dataSourceId === n) return !0;
282
+ }
283
+ return !1;
284
+ }
285
+ function xe(e, t) {
286
+ let n = /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)]);
287
+ for (let r of n) if (Se(e[r]) !== Se(t[r])) return !1;
288
+ return !0;
289
+ }
290
+ function Se(e) {
291
+ return e === void 0 ? "missing" : e.kind === "inline" ? `inline:${JSON.stringify(e.value)}` : e.kind === "variable" ? `variable:${e.variableId}` : `field:${e.dataSourceId}:${e.path.join(".")}`;
292
+ }
293
+ function Ce(e, t) {
294
+ let n = `data-source-${t}`, r = new Set(e.map((e) => e.id));
295
+ if (!r.has(n)) return n;
296
+ for (let e = 2; e < 1e3; e += 1) {
297
+ let t = `${n}-${e}`;
298
+ if (!r.has(t)) return t;
299
+ }
300
+ return `${n}-${Date.now()}`;
301
+ }
302
+ function we(e) {
303
+ return e.allowedValues?.[0] ?? e.defaultValue ?? (e.valueType === "number" ? e.minimum ?? 0 : e.valueType === "boolean" ? !1 : e.valueType === "date" ? "2000-01-01" : "");
304
+ }
305
+ function Te(e, t) {
306
+ let n = e.components.find((e) => e.id === t), r = [{
307
+ type: "update-components",
308
+ componentIds: [t],
309
+ patch: {
310
+ dataSource: null,
311
+ dataValue: null,
312
+ dataBinding: null
313
+ }
314
+ }], i = n === void 0 ? null : O(n);
315
+ if (i?.kind === "data-source-field") {
316
+ let n = i.dataSourceId, a = e.components.some((e) => {
317
+ if (e.id === t) return !1;
318
+ let r = O(e);
319
+ return r?.kind === "data-source-field" && r.dataSourceId === n;
320
+ }), o = e.variables.some((e) => {
321
+ let t = re(e);
322
+ return t.value.kind === "data-source-field" && t.value.dataSourceId === n;
323
+ }), s = e.dataSources ?? [];
324
+ !a && !o && s.some((e) => e.id === n) && r.push({
325
+ type: "replace-data-sources",
326
+ dataSources: s.filter((e) => e.id !== n)
327
+ });
328
+ }
329
+ return k({ commands: r });
330
+ }
331
+ function Ee(e, t, n) {
332
+ return e.variables.some((e) => e.id === n) ? k(Oe(t, {
333
+ type: "variable",
334
+ variableId: n
335
+ })) : A("CORE_COMMAND_INVALID", y.dataset.incomplete);
336
+ }
337
+ function De(e, t) {
338
+ return e?.parameters.find((e) => e.name === t)?.defaultValue ?? null;
339
+ }
340
+ function Oe(e, t) {
341
+ return { commands: [{
342
+ type: "update-components",
343
+ componentIds: [e],
344
+ patch: {
345
+ dataSource: t,
346
+ dataValue: null
347
+ }
348
+ }] };
349
+ }
350
+ function k(e) {
351
+ return {
352
+ ok: !0,
353
+ value: e,
354
+ diagnostics: []
355
+ };
356
+ }
357
+ function A(e, t) {
358
+ return {
359
+ ok: !1,
360
+ diagnostics: [{
361
+ severity: "error",
362
+ code: e,
363
+ path: [],
364
+ message: t
365
+ }]
366
+ };
367
+ }
368
+ var ke = class {
369
+ callbacks;
370
+ #e;
371
+ #t;
372
+ #n;
373
+ #r = 0;
374
+ #i = 0;
375
+ #a = "";
376
+ #o;
377
+ #s;
378
+ #c = [];
379
+ #l = [];
380
+ #u;
381
+ #d;
382
+ #f = !1;
383
+ #p;
384
+ #m;
385
+ constructor(e) {
386
+ this.callbacks = e;
387
+ }
388
+ get query() {
389
+ return this.#a;
390
+ }
391
+ get groups() {
392
+ return this.#l;
393
+ }
394
+ get groupId() {
395
+ return this.#u;
396
+ }
397
+ updateGroup(e) {
398
+ e === this.#u || e !== void 0 && !this.#l.some((t) => t.id === e) || (this.#u = e, this.#c = [], this.#s = void 0, this.#o = void 0, this.list(void 0));
399
+ }
400
+ get cursor() {
401
+ return this.#s;
402
+ }
403
+ get items() {
404
+ return this.#c;
405
+ }
406
+ get status() {
407
+ return this.#p ?? (this.callbacks.getPort() === void 0 ? "unavailable" : "ready");
408
+ }
409
+ get error() {
410
+ return this.#m;
411
+ }
412
+ retry() {
413
+ this.#m = void 0, this.#p = this.callbacks.getPort() === void 0 ? "unavailable" : "loading", this.list(void 0);
414
+ }
415
+ ensureList() {
416
+ this.#g(), !this.#f && this.#d === void 0 && this.loadGroups(), (this.#c.length === 0 || this.#o !== this.#a) && this.list(void 0);
417
+ }
418
+ updateQuery(e) {
419
+ e !== this.#a && (this.#a = e, this.#s = void 0, this.#g(), this.#n = setTimeout(() => {
420
+ this.#n = void 0, this.list(void 0);
421
+ }, 180));
422
+ }
423
+ loadMore() {
424
+ this.#n === void 0 && this.#s !== void 0 && this.list(this.#s);
425
+ }
426
+ async describe(e) {
427
+ let t = this.callbacks.getPort();
428
+ if (t === void 0) {
429
+ this.callbacks.setFeedback(y.dataset.unavailable);
430
+ return;
431
+ }
432
+ this.#t?.abort();
433
+ let n = new AbortController();
434
+ this.#t = n;
435
+ let r = ++this.#i;
436
+ this.callbacks.setFeedback(y.dataset.describeLoading);
437
+ let i;
438
+ try {
439
+ i = await t.describe({
440
+ datasetId: e,
441
+ signal: n.signal
442
+ });
443
+ } catch {
444
+ !n.signal.aborted && r === this.#i && this.callbacks.setFeedback(y.dataset.describeFailed);
445
+ return;
446
+ }
447
+ if (n.signal.aborted || r !== this.#i) return;
448
+ if (!i.ok) {
449
+ this.callbacks.report(i.diagnostics), this.callbacks.setFeedback(y.dataset.describeFailed);
450
+ return;
451
+ }
452
+ let a = C(i.value);
453
+ if (!a.ok) {
454
+ this.callbacks.report(a.diagnostics), this.callbacks.setFeedback(y.dataset.describeFailed);
455
+ return;
456
+ }
457
+ if (a.value.datasetId !== e) {
458
+ this.callbacks.setFeedback(y.dataset.describeFailed);
459
+ return;
460
+ }
461
+ return a.value;
462
+ }
463
+ clear() {
464
+ this.#g(), this.#d?.abort(), this.#d = void 0, this.#l = [], this.#u = void 0, this.#f = !1, this.#e?.abort(), this.#t?.abort(), this.#a = "", this.#o = void 0, this.#s = void 0, this.#c = [], this.#r++, this.#i++, this.#m = void 0, this.#p = void 0;
465
+ }
466
+ async list(e) {
467
+ let t = this.callbacks.getPort();
468
+ if (t === void 0) {
469
+ this.#h("unavailable", void 0), this.callbacks.setFeedback(y.dataset.unavailable);
470
+ return;
471
+ }
472
+ this.#e?.abort();
473
+ let n = new AbortController();
474
+ this.#e = n;
475
+ let r = ++this.#r;
476
+ this.#h("loading", void 0), this.callbacks.setFeedback(y.dataset.loading);
477
+ let i;
478
+ try {
479
+ i = await t.list({
480
+ query: this.#a,
481
+ ...this.#u === void 0 ? {} : { groupId: this.#u },
482
+ ...e === void 0 ? {} : { cursor: e },
483
+ limit: 50,
484
+ signal: n.signal
485
+ });
486
+ } catch {
487
+ !n.signal.aborted && r === this.#r && (this.#h("error", y.dataset.loadFailed), this.callbacks.setFeedback(y.dataset.loadFailed));
488
+ return;
489
+ }
490
+ if (n.signal.aborted || r !== this.#r) return;
491
+ if (!i.ok) {
492
+ this.callbacks.report(i.diagnostics), this.#h("error", i.diagnostics[0]?.code ?? y.dataset.loadFailed), this.callbacks.setFeedback(y.dataset.loadFailed);
493
+ return;
494
+ }
495
+ let a = te(i.value);
496
+ if (!a.ok) {
497
+ this.callbacks.report(a.diagnostics), this.#h("error", a.diagnostics[0]?.code ?? y.dataset.loadFailed), this.callbacks.setFeedback(y.dataset.loadFailed);
498
+ return;
499
+ }
500
+ this.#p = "ready", this.#m = void 0, this.#c = e === void 0 ? a.value.items : [...this.#c, ...a.value.items], this.#s = a.value.nextCursor, this.#o = this.#a, this.callbacks.setFeedback(y.dataset.shown(this.#c.length)), (this.callbacks.renderResults ?? this.callbacks.render)();
501
+ }
502
+ #h(e, t) {
503
+ this.#p = e, this.#m = t, this.callbacks.renderResults?.();
504
+ }
505
+ #g() {
506
+ this.#n !== void 0 && (clearTimeout(this.#n), this.#n = void 0);
507
+ }
508
+ async loadGroups() {
509
+ let e = this.callbacks.getPort();
510
+ if (e?.groups === void 0) {
511
+ this.#f = !0;
512
+ return;
513
+ }
514
+ let t = new AbortController();
515
+ this.#d = t;
516
+ let n = setTimeout(() => t.abort(), 15e3);
517
+ try {
518
+ let n = await e.groups({ signal: t.signal });
519
+ if (t.signal.aborted || this.#d !== t) return;
520
+ if (!n.ok) {
521
+ this.callbacks.report(n.diagnostics);
522
+ return;
523
+ }
524
+ let r = w(n.value);
525
+ if (!r.ok) {
526
+ this.callbacks.report(r.diagnostics);
527
+ return;
528
+ }
529
+ this.#l = r.value, this.#f = !0, this.callbacks.render();
530
+ } catch {
531
+ t.signal.aborted || this.callbacks.setFeedback(y.dataset.loadFailed);
532
+ } finally {
533
+ clearTimeout(n), this.#d === t && (this.#d = void 0);
534
+ }
535
+ }
536
+ }, Ae = [
537
+ 10,
538
+ 20,
539
+ 50,
540
+ 100
541
+ ];
542
+ function je(e) {
543
+ return Ae.includes(e) ? e : 10;
544
+ }
545
+ function Me(e, t, n) {
546
+ let r = je(n), i = Math.max(1, Math.ceil(e / r)), a = Math.min(Math.max(0, Math.trunc(t)), i - 1), o = a * r;
547
+ return {
548
+ page: a,
549
+ pageSize: r,
550
+ pages: i,
551
+ start: o,
552
+ end: Math.min(o + r, e)
553
+ };
554
+ }
555
+ //#endregion
556
+ //#region src/browser/controllers/dataset/designer-dataset-controller-context.ts
557
+ var Ne = class {
558
+ descriptor;
559
+ draft;
560
+ mode = "none";
561
+ variableSourceId = "";
562
+ staticDraft = "null";
563
+ staticValue = null;
564
+ staticBinding;
565
+ staticTab = "table";
566
+ staticPage = 0;
567
+ staticPageSize = 10;
568
+ workbenchOpen = !1;
569
+ catalogOpen = !1;
570
+ sourcePickerTab = "dataset";
571
+ variableQuery = "";
572
+ feedbackText = "";
573
+ draftDirty = !1;
574
+ confirmClose = !1;
575
+ preview = j();
576
+ activeStep = "source";
577
+ authoring = Pe();
578
+ previewController;
579
+ previewGeneration = 0;
580
+ autoApplyTimer;
581
+ focusedComponentId = null;
582
+ syncedDataSource;
583
+ datasetInstanceId = null;
584
+ syncedInstanceId = null;
585
+ bindingOpenRoleId = null;
586
+ parameterInlineMemory = /* @__PURE__ */ new Map();
587
+ groupOpenOverrides = /* @__PURE__ */ new Map();
588
+ panel;
589
+ feedback;
590
+ reset() {
591
+ this.descriptor = void 0, this.draft = void 0, this.mode = "none", this.variableSourceId = "", this.staticDraft = "null", this.staticValue = null, this.staticBinding = void 0, this.staticTab = "table", this.staticPage = 0, this.staticPageSize = 10, this.workbenchOpen = !1, this.catalogOpen = !1, this.sourcePickerTab = "dataset", this.variableQuery = "", this.feedbackText = "", this.draftDirty = !1, this.confirmClose = !1, this.preview = j(), this.clearAutoApply(), this.activeStep = "source", this.authoring = Pe(), this.focusedComponentId = null, this.syncedDataSource = void 0, this.datasetInstanceId = null, this.syncedInstanceId = null, this.bindingOpenRoleId = null, this.parameterInlineMemory.clear(), this.groupOpenOverrides.clear();
592
+ }
593
+ clearAutoApply() {
594
+ this.autoApplyTimer !== void 0 && (clearTimeout(this.autoApplyTimer), this.autoApplyTimer = void 0);
595
+ }
596
+ };
597
+ function Pe() {
598
+ return {
599
+ editorMode: "visual",
600
+ filterConfigured: !1,
601
+ loadingDisabled: !1,
602
+ controlled: !1,
603
+ refreshStrategy: "manual",
604
+ refreshInterval: 30
605
+ };
606
+ }
607
+ function j(e = !1) {
608
+ return {
609
+ status: "idle",
610
+ tab: "response",
611
+ message: "",
612
+ open: e
613
+ };
614
+ }
615
+ //#endregion
616
+ //#region src/browser/dom/dataset/designer-dataset-types.ts
617
+ function M(e, t) {
618
+ return e === void 0 || t === void 0 ? 0 : e.parameters.filter((e) => e.required && t.params[e.name] === void 0).length;
619
+ }
620
+ //#endregion
621
+ //#region src/browser/dom/dataset/designer-data-panel-notice.ts
622
+ function Fe(e) {
623
+ if (e.state === "failed") return {
624
+ tone: "danger",
625
+ text: y.data.notice.failed,
626
+ icon: "x-circle",
627
+ retry: !0
628
+ };
629
+ if (e.state === "readonly") return {
630
+ tone: "neutral",
631
+ text: y.data.notice.readonly,
632
+ icon: "lock-open",
633
+ retry: !1
634
+ };
635
+ if (e.state === "unavailable") {
636
+ let t = y.data.notice.unavailable;
637
+ return {
638
+ tone: "warning",
639
+ text: e.reason === "port-missing" ? t.portMissing : e.reason === "instance-missing" ? t.instanceMissing : t.denied,
640
+ retry: !1
641
+ };
642
+ }
643
+ }
644
+ function Ie(e, t) {
645
+ let n = e.createElement("div");
646
+ return n.className = "designer-data-panel-notice", n.dataset.dataPanelNotice = "true", Re(e, n, t), n;
647
+ }
648
+ function Le(e, t) {
649
+ for (let n of e.querySelectorAll("[data-data-panel-notice]")) Re(n.ownerDocument, n, t);
650
+ }
651
+ function Re(e, t, n) {
652
+ t.replaceChildren();
653
+ let r = Fe(n);
654
+ if (r === void 0) {
655
+ delete t.dataset.state;
656
+ return;
657
+ }
658
+ t.dataset.state = n.state;
659
+ let i = e.createElement("div");
660
+ if (i.className = "designer-data-notice", i.dataset.dataNoticeTone = r.tone, i.setAttribute("role", "status"), r.icon !== void 0) {
661
+ let t = e.createElement("span");
662
+ t.className = "designer-data-notice-icon", t.innerHTML = d(r.icon), i.appendChild(t);
663
+ }
664
+ let a = e.createElement("span");
665
+ if (a.className = "designer-data-notice-text", a.textContent = r.text, i.appendChild(a), r.retry) {
666
+ let t = m(e, {
667
+ className: "designer-data-notice-retry",
668
+ text: y.data.notice.retry
669
+ });
670
+ t.dataset.datasetAction = "retry-link", i.appendChild(t);
671
+ }
672
+ t.appendChild(i);
673
+ }
674
+ //#endregion
675
+ //#region src/browser/dom/value-ref/designer-value-ref-types.ts
676
+ function ze(e, t) {
677
+ return e === "inline" ? t.tab.inline : e === "variable" ? t.tab.variable : t.tab.field;
678
+ }
679
+ function Be(e, t, n) {
680
+ if (e === null) return {
681
+ badge: "",
682
+ label: n.placeholder
683
+ };
684
+ if (e.kind === "variable") {
685
+ let r = t.variables.find((t) => t.id === e.variableId);
686
+ return {
687
+ badge: n.tab.variable,
688
+ label: r?.name ?? e.variableId
689
+ };
690
+ }
691
+ if (e.kind === "data-source-field") {
692
+ let r = t.fields?.find((t) => t.dataSourceId === e.dataSourceId && Ue(t.path, e.path));
693
+ return {
694
+ badge: n.tab.field,
695
+ label: r?.label ?? e.dataSourceId
696
+ };
697
+ }
698
+ let r = t.inlineViews?.find((t) => t.value === e.value);
699
+ return {
700
+ badge: n.tab.inline,
701
+ label: r?.label ?? We(e.value)
702
+ };
703
+ }
704
+ function Ve(e, t) {
705
+ let n = [];
706
+ if (e.allowedKinds.includes("inline")) {
707
+ let r = e.inlineViews ?? [];
708
+ if (r.length === 0) {
709
+ let r = e.current, i = r !== null && r.kind === "inline" ? r.value : null;
710
+ n.push({
711
+ id: "inline:current",
712
+ kind: "inline",
713
+ label: We(i),
714
+ badge: t.tab.inline,
715
+ value: {
716
+ kind: "inline",
717
+ value: i
718
+ }
719
+ });
720
+ }
721
+ for (let e of r) n.push({
722
+ id: `inline:${e.id}`,
723
+ kind: "inline",
724
+ label: e.label,
725
+ badge: t.tab.inline,
726
+ value: {
727
+ kind: "inline",
728
+ value: e.value
729
+ }
730
+ });
731
+ }
732
+ if (e.allowedKinds.includes("variable")) for (let r of e.variables) n.push({
733
+ id: `variable:${r.id}`,
734
+ kind: "variable",
735
+ label: r.name,
736
+ badge: t.tab.variable,
737
+ value: {
738
+ kind: "variable",
739
+ variableId: r.id
740
+ }
741
+ });
742
+ if (e.allowedKinds.includes("data-source-field")) {
743
+ let r = new Set(e.excludedDataSourceIds ?? []);
744
+ for (let i of e.fields ?? []) r.has(i.dataSourceId) || n.push({
745
+ id: `field:${i.dataSourceId}:${i.path.join(".")}`,
746
+ kind: "data-source-field",
747
+ label: i.label,
748
+ badge: t.tab.field,
749
+ value: {
750
+ kind: "data-source-field",
751
+ dataSourceId: i.dataSourceId,
752
+ path: [...i.path]
753
+ }
754
+ });
755
+ }
756
+ return n;
757
+ }
758
+ function He(e, t) {
759
+ let n = t.trim().toLowerCase();
760
+ return n.length === 0 ? e : e.filter((e) => e.label.toLowerCase().includes(n) || e.badge.toLowerCase().includes(n));
761
+ }
762
+ function Ue(e, t) {
763
+ return e.length === t.length && e.every((e, n) => e === t[n]);
764
+ }
765
+ function We(e) {
766
+ return e === null ? "null" : typeof e == "string" ? e.length > 32 ? `${e.slice(0, 32)}…` : e : typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? `[${e.length}]` : "{…}";
767
+ }
768
+ //#endregion
769
+ //#region src/browser/dom/value-ref/designer-value-ref-summary-dom.ts
770
+ function Ge(t, n, r, i) {
771
+ let a = Be(n, r, i), o = t.createElement("span");
772
+ o.className = "designer-value-ref-summary", a.badge.length > 0 && e(o, {
773
+ text: a.badge,
774
+ tone: "neutral",
775
+ className: "designer-value-ref-badge",
776
+ dataset: { valueRefBadge: n?.kind ?? "none" }
777
+ });
778
+ let s = t.createElement("span");
779
+ return s.className = "designer-value-ref-label", s.textContent = a.label, o.appendChild(s), o;
780
+ }
781
+ //#endregion
782
+ //#region src/browser/dom/value-ref/designer-value-ref-picker-dom.ts
783
+ function Ke(e) {
784
+ let t = e.ownerDocument, r = e.text, i = m(t, {
785
+ ariaLabel: e.ariaLabel,
786
+ className: "designer-value-ref-trigger"
787
+ });
788
+ i.dataset.valueRefTrigger = e.controlKey, i.dataset.dsControl = e.controlKey, i.setAttribute("aria-haspopup", "dialog"), i.setAttribute("aria-expanded", "false");
789
+ let a = t.createElement("span");
790
+ a.className = "designer-visually-hidden", a.dataset.valueRefLive = "true", a.setAttribute("aria-live", "polite");
791
+ let o = t.createElement("div");
792
+ o.className = "designer-value-ref-field", o.append(i, a), y();
793
+ let s, l, u, d = 0, f = [], p = "", h, g;
794
+ function _() {
795
+ return He(Ve(e.input, r), p);
796
+ }
797
+ function y() {
798
+ i.replaceChildren(Ge(t, e.input.current, e.input, r));
799
+ }
800
+ function b(e) {
801
+ if (s !== void 0) {
802
+ e && l?.focus();
803
+ return;
804
+ }
805
+ s = C();
806
+ let n = s;
807
+ ee().appendChild(s), S(), i.setAttribute("aria-expanded", "true");
808
+ let r = (e) => {
809
+ let t = e.composedPath();
810
+ t.includes(n) || t.includes(i) || x(!1);
811
+ }, a = () => S();
812
+ t.addEventListener("pointerdown", r, !0), t.defaultView?.addEventListener("scroll", a, !0), t.defaultView?.addEventListener("resize", a), g = () => {
813
+ t.removeEventListener("pointerdown", r, !0), t.defaultView?.removeEventListener("scroll", a, !0), t.defaultView?.removeEventListener("resize", a);
814
+ }, s.addEventListener("keydown", ne), e ? l?.focus() : u?.focus();
815
+ }
816
+ function x(e) {
817
+ s?.remove(), s = void 0, l = void 0, u = void 0, p = "", g?.(), g = void 0, i.setAttribute("aria-expanded", "false"), e && i.focus();
818
+ }
819
+ function ee() {
820
+ if (e.popoverHost !== void 0) return e.popoverHost;
821
+ let n = i.closest(".designer");
822
+ if (n instanceof HTMLElement) {
823
+ let e = n.querySelector("[data-designer-overlay-host]");
824
+ if (e !== null) return e;
825
+ let r = t.createElement("div");
826
+ return r.dataset.designerOverlayHost = "true", r.className = "designer-overlay-host", r.style.position = "fixed", r.style.inset = "0", r.style.pointerEvents = "none", n.appendChild(r), r;
827
+ }
828
+ return i.offsetParent instanceof HTMLElement ? i.offsetParent : t.body;
829
+ }
830
+ function S() {
831
+ if (s === void 0) return;
832
+ let t = (e.anchor ?? i).getBoundingClientRect();
833
+ s.style.position = "fixed", s.style.left = `${Math.round(t.left)}px`, s.style.top = `${Math.round(t.bottom + 4)}px`, s.style.minWidth = `${Math.round(Math.min(t.width, 360))}px`, s.style.pointerEvents = "auto";
834
+ }
835
+ function C() {
836
+ let n = t.createElement("div");
837
+ n.className = "designer-value-ref-popover", n.dataset.valueRefPopover = "true", n.setAttribute("role", "dialog"), n.setAttribute("aria-label", r.placeholder), n.setAttribute("aria-modal", "false");
838
+ let i = e.input.allowedKinds;
839
+ if (n.dataset.valueRefKinds = i.join(" "), i.length > 1) {
840
+ let a = v(t, {
841
+ ariaLabel: r.placeholder,
842
+ className: "designer-value-ref-tabs",
843
+ items: i.map((e) => ({
844
+ className: "designer-value-ref-tab",
845
+ dataset: { valueRefTab: e },
846
+ label: te(e),
847
+ value: e
848
+ })),
849
+ selected: qe(e.input.current)
850
+ });
851
+ for (let e of a.buttons.values()) e.addEventListener("click", () => {
852
+ p = "", l !== void 0 && (l.value = ""), w();
853
+ });
854
+ n.appendChild(a.element);
855
+ }
856
+ l = c(t, {
857
+ type: "search",
858
+ className: "designer-value-ref-search",
859
+ ariaLabel: r.search,
860
+ placeholder: r.search
861
+ }), l.dataset.valueRefSearch = "true", l.addEventListener("input", () => {
862
+ let e = l?.value ?? "";
863
+ h !== void 0 && clearTimeout(h), h = setTimeout(() => {
864
+ p = e, w();
865
+ }, 180);
866
+ }), n.appendChild(l), u = t.createElement("div"), u.className = "designer-value-ref-list", u.setAttribute("role", "listbox"), u.tabIndex = -1, n.appendChild(u);
867
+ let a = t.createElement("div");
868
+ a.className = "designer-value-ref-footer";
869
+ let o = m(t, { text: r.manage });
870
+ return o.dataset.valueRefManage = "true", o.addEventListener("click", () => {
871
+ e.onManage?.(), x(!0);
872
+ }), a.appendChild(o), n.appendChild(a), w(), n;
873
+ }
874
+ function te(e) {
875
+ return e === "inline" ? r.tab.inline : e === "variable" ? r.tab.variable : r.tab.field;
876
+ }
877
+ function w() {
878
+ if (u !== void 0) {
879
+ if (f = _(), d = Math.min(d, Math.max(f.length - 1, 0)), u.replaceChildren(), f.length === 0) {
880
+ let t = p.trim().length > 0, i = t ? [{
881
+ label: r.clearSearch,
882
+ dataset: { valueRefClearSearch: "true" }
883
+ }] : e.allowCreateVariable === !0 ? [{
884
+ label: r.createVariable,
885
+ dataset: { valueRefCreate: "true" }
886
+ }] : [], { element: a, actionButtons: o } = n(u, {
887
+ title: t ? r.emptySearch : r.emptyVariables,
888
+ actions: i
889
+ });
890
+ a.dataset.valueRefEmpty = t ? "search" : "items";
891
+ let s = o[0];
892
+ s !== void 0 && (s.title = t ? r.emptySearch : r.emptyVariables, s.addEventListener("click", () => {
893
+ t ? (p = "", l !== void 0 && (l.value = ""), w(), l?.focus()) : (e.onCreateVariable?.(), x(!0));
894
+ })), u.removeAttribute("aria-activedescendant");
895
+ return;
896
+ }
897
+ f.forEach((n, i) => {
898
+ let a = t.createElement("button");
899
+ a.type = "button", a.className = "designer-value-ref-option", a.id = Je(n.id), a.dataset.valueRefOption = n.id, a.setAttribute("role", "option"), a.setAttribute("aria-selected", String(T(n))), a.appendChild(Ge(t, n.value, e.input, r)), a.addEventListener("click", () => E(n)), i === d && (a.dataset.active = "true"), u.appendChild(a);
900
+ }), u.setAttribute("aria-activedescendant", Je(f[d].id));
901
+ }
902
+ }
903
+ function T(t) {
904
+ let n = e.input.current;
905
+ return n === null || n.kind !== t.value.kind ? !1 : n.kind === "variable" && t.value.kind === "variable" ? n.variableId === t.value.variableId : n.kind === "data-source-field" && t.value.kind === "data-source-field" ? n.dataSourceId === t.value.dataSourceId && n.path.join(".") === t.value.path.join(".") : n.kind === "inline" && t.value.kind === "inline" && n.value === t.value.value;
906
+ }
907
+ function E(t) {
908
+ let n = D(t);
909
+ x(!0), a.textContent = r.selected(n), e.onSelect(t.value);
910
+ }
911
+ function D(e) {
912
+ return `${ze(e.kind, r)} ${e.label}`;
913
+ }
914
+ function O(e) {
915
+ if (f.length !== 0) {
916
+ d = (d + e + f.length) % f.length;
917
+ for (let [e, t] of [...u?.children ?? []].entries()) t instanceof HTMLElement && t.dataset.valueRefOption !== void 0 && (t.dataset.active = String(e === d));
918
+ u !== void 0 && u.setAttribute("aria-activedescendant", Je(f[d].id));
919
+ }
920
+ }
921
+ function ne(e) {
922
+ switch (e.key) {
923
+ case "ArrowDown":
924
+ e.preventDefault(), O(1);
925
+ return;
926
+ case "ArrowUp":
927
+ e.preventDefault(), O(-1);
928
+ return;
929
+ case "Home":
930
+ e.preventDefault(), d = 0, O(0);
931
+ return;
932
+ case "End":
933
+ e.preventDefault(), d = f.length - 1, O(0);
934
+ return;
935
+ case "Enter": {
936
+ let t = f[d];
937
+ if (t === void 0) return;
938
+ e.preventDefault(), E(t);
939
+ return;
940
+ }
941
+ case "Escape":
942
+ e.preventDefault(), x(!0);
943
+ return;
944
+ case "Tab":
945
+ x(!1);
946
+ return;
947
+ default: return;
948
+ }
949
+ }
950
+ return i.addEventListener("click", () => {
951
+ s === void 0 ? b(!0) : x(!0);
952
+ }), i.addEventListener("keydown", (e) => {
953
+ (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), b(!0));
954
+ }), {
955
+ element: o,
956
+ dispose: () => {
957
+ h !== void 0 && clearTimeout(h), g?.(), s?.remove(), s = void 0, i.replaceChildren(), o.replaceChildren();
958
+ }
959
+ };
960
+ }
961
+ function qe(e) {
962
+ return e?.kind;
963
+ }
964
+ function Je(e) {
965
+ return `designer-value-ref-option-${e.replace(/[^A-Za-z0-9_-]/g, "-")}`;
966
+ }
967
+ //#endregion
968
+ //#region src/browser/dom/value-ref/designer-value-ref-picker-mount.ts
969
+ function Ye(e) {
970
+ return Ke(e);
971
+ }
972
+ function Xe(e, t, n = []) {
973
+ return {
974
+ allowedKinds: ["variable"],
975
+ current: e,
976
+ variables: t,
977
+ excludedDataSourceIds: n
978
+ };
979
+ }
980
+ //#endregion
981
+ //#region src/browser/dom/dataset/designer-data-group-dom.ts
982
+ function Ze(e, t) {
983
+ return `${e}:${t}`;
984
+ }
985
+ function Qe(e, t, n, r) {
986
+ return e.get(Ze(t, n)) ?? r;
987
+ }
988
+ function N(e, t) {
989
+ let n = e.ownerDocument, r = n.createElement("details");
990
+ r.className = "designer-data-group", r.dataset.detailsGroup = e.group, r.dataset.dsGroupSection = e.section, e.readonlyHint === !0 && (r.dataset.readonlyHint = "true");
991
+ let i = Qe(e.overrides, e.section, e.group, e.defaultOpen);
992
+ r.open = i;
993
+ let a = i;
994
+ r.addEventListener("toggle", () => {
995
+ r.open !== a && (a = r.open, e.onToggle?.(e.section, e.group, r.open));
996
+ });
997
+ let o = n.createElement("summary");
998
+ o.className = "designer-data-group-summary";
999
+ let s = n.createElement("span");
1000
+ s.className = "designer-data-group-caret", s.dataset.groupCaret = "true", s.setAttribute("aria-hidden", "true"), s.innerHTML = d("chevron-right");
1001
+ let c = n.createElement("span");
1002
+ c.className = "designer-data-group-title", c.textContent = e.title;
1003
+ let l = n.createElement("span");
1004
+ if (l.className = "designer-data-group-summary-text", l.dataset.detailsGroupSummary = e.group, l.textContent = e.summary, o.append(s, c, l), e.action !== void 0) {
1005
+ let t = e.action;
1006
+ t.classList.add("designer-data-group-action"), t.addEventListener("click", (e) => e.preventDefault()), o.appendChild(t);
1007
+ }
1008
+ let u = n.createElement("div");
1009
+ return u.className = "designer-data-group-content", u.append(...t), r.append(o, u), r;
1010
+ }
1011
+ //#endregion
1012
+ //#region src/browser/dom/dataset/designer-dataset-binding.ts
1013
+ function $e(e, t, n) {
1014
+ if (n.length === 0) return !0;
1015
+ for (let r of n) {
1016
+ let n = t?.fields[r.id] ?? [];
1017
+ if (n.length < r.minFields || n.length > r.maxFields || new Set(n).size !== n.length || n.some((t) => {
1018
+ let n = e.fields.find((e) => e.id === t);
1019
+ return n === void 0 || !r.valueTypes.includes(n.valueType);
1020
+ })) return !1;
1021
+ }
1022
+ return !0;
1023
+ }
1024
+ //#endregion
1025
+ //#region src/browser/dom/dataset/designer-dataset-catalog-dom.ts
1026
+ function et(e) {
1027
+ let t = e.panel.ownerDocument, n = t.createElement("section");
1028
+ n.className = "designer-host-connection", n.dataset.dsSection = "host-link", n.dataset.inspectorSearchSection = "true", n.dataset.inspectorSearchText = [
1029
+ y.dataSource.hostConnection,
1030
+ y.dataSource.datasetCatalog,
1031
+ y.dataSource.dataQuery,
1032
+ y.dataSource.variablesChannel
1033
+ ].join(" ");
1034
+ let r = t.createElement("div");
1035
+ r.className = "designer-host-connection-statuses", r.append(...it(t, e.link));
1036
+ let i = e.surface === "workbench" ? [r] : [];
1037
+ if (n.appendChild(N({
1038
+ ownerDocument: t,
1039
+ section: "host-link",
1040
+ group: "host-link",
1041
+ title: y.data.groups.hostLink,
1042
+ summary: tt(e),
1043
+ defaultOpen: nt(e.link) || rt(e.link),
1044
+ overrides: e.groupOpenOverrides,
1045
+ onToggle: e.onToggleGroup
1046
+ }, i)), nt(e.link)) {
1047
+ let e = t.createElement("p");
1048
+ e.className = "designer-host-connection-hint", e.textContent = y.dataSource.linkUnavailableHint, n.appendChild(e);
1049
+ }
1050
+ if (rt(e.link)) {
1051
+ let e = m(t, { text: y.dataSource.linkRetry });
1052
+ e.dataset.datasetAction = "retry-link", n.appendChild(e);
1053
+ }
1054
+ return n;
1055
+ }
1056
+ function tt(e) {
1057
+ let t = [
1058
+ e.link.catalog,
1059
+ e.link.query,
1060
+ e.link.variables
1061
+ ], n = t.filter((e) => e.status === "ready").length;
1062
+ return y.data.groups.channelsReady(n, t.length);
1063
+ }
1064
+ function nt(e) {
1065
+ return [
1066
+ e.catalog,
1067
+ e.query,
1068
+ e.variables
1069
+ ].every((e) => e.status === "unavailable");
1070
+ }
1071
+ function rt(e) {
1072
+ return [
1073
+ e.catalog,
1074
+ e.query,
1075
+ e.variables
1076
+ ].some((e) => e.status === "error");
1077
+ }
1078
+ function it(e, t) {
1079
+ return [
1080
+ ot(e, y.dataSource.datasetCatalog, t.catalog),
1081
+ ot(e, y.dataSource.dataQuery, t.query),
1082
+ ot(e, y.dataSource.variablesChannel, t.variables)
1083
+ ];
1084
+ }
1085
+ function at(e, t) {
1086
+ let n = e.createElement("div");
1087
+ n.className = "designer-dataset-health", n.dataset.datasetHealth = "true", n.setAttribute("aria-label", y.dataSource.hostConnection);
1088
+ for (let [r, i] of [
1089
+ [y.dataSource.datasetCatalogShort, t.catalog],
1090
+ [y.dataSource.dataQueryShort, t.query],
1091
+ [y.dataSource.variablesChannelShort, t.variables]
1092
+ ]) {
1093
+ let t = e.createElement("span");
1094
+ t.className = "designer-dataset-health-item", t.dataset.linkStatus = i.status, t.dataset.state = i.status === "ready" ? "ready" : i.status === "loading" ? "loading" : i.status === "error" ? "error" : "na";
1095
+ let a = i.detail === void 0 || i.detail === "" ? "" : ` · ${i.detail}`, o = `${r} · ${st(i.status)}${a}`;
1096
+ t.title = o, t.setAttribute("aria-label", o);
1097
+ let s = e.createElement("i");
1098
+ s.setAttribute("aria-hidden", "true"), t.append(s, r), n.appendChild(t);
1099
+ }
1100
+ return n;
1101
+ }
1102
+ function ot(e, t, n) {
1103
+ let r = e.createElement("span");
1104
+ r.className = "designer-host-connection-status", r.dataset.connected = String(n.status === "ready"), r.dataset.linkStatus = n.status;
1105
+ let i = e.createElement("i");
1106
+ i.setAttribute("aria-hidden", "true");
1107
+ let a = e.createElement("span"), o = n.detail === void 0 || n.detail === "" ? "" : ` · ${n.detail}`;
1108
+ return a.textContent = `${t} · ${st(n.status)}${o}`, r.dataset.tip = a.textContent, r.append(i, a), r;
1109
+ }
1110
+ function st(e) {
1111
+ return e === "ready" ? y.dataSource.linkReady : e === "loading" ? y.dataSource.linkLoading : e === "error" ? y.dataSource.linkError : y.dataSource.linkUnavailable;
1112
+ }
1113
+ function ct(e) {
1114
+ let t = e.panel.ownerDocument, n = t.createElement("section");
1115
+ n.className = "designer-dataset-browser designer-dataset-picker-placeholder", n.dataset.dsSection = "source", n.dataset.datasetPickerPlaceholder = "true", n.dataset.inspectorSearchSection = "true", n.dataset.inspectorSearchText = y.dataset.select;
1116
+ let r = t.createElement("p");
1117
+ r.className = "designer-empty-state", r.textContent = y.dataSource.pickerPlaceholder;
1118
+ let i = m(t, { text: y.dataSource.sourceChange });
1119
+ return i.dataset.datasetChange = "true", n.append(r, i), n;
1120
+ }
1121
+ function lt(e) {
1122
+ let t = e.panel.ownerDocument.createElement("section");
1123
+ t.className = "designer-dataset-browser", t.dataset.dsSection = "source", t.dataset.inspectorSearchSection = "true", t.dataset.inspectorSearchText = [
1124
+ y.dataset.select,
1125
+ y.dataset.search,
1126
+ ...e.items.flatMap((e) => [e.name, e.description ?? ""])
1127
+ ].join(" ");
1128
+ let n = e.panel.ownerDocument.createElement("h4");
1129
+ n.textContent = y.dataset.select;
1130
+ let r = c(e.panel.ownerDocument, {
1131
+ ariaLabel: y.dataset.search,
1132
+ placeholder: y.dataset.search,
1133
+ type: "search",
1134
+ value: e.query
1135
+ });
1136
+ r.dataset.datasetQuery = "true", t.append(n);
1137
+ let i = ut(e);
1138
+ return i !== void 0 && t.appendChild(i), t.append(r, dt(e)), t;
1139
+ }
1140
+ function ut(e) {
1141
+ if (e.groups === void 0 || e.groups.length === 0) return;
1142
+ let t = e.panel.ownerDocument, n = e.groupId ?? "", r = _(t, {
1143
+ ariaLabel: y.dataset.group,
1144
+ className: "designer-source-sheet-group",
1145
+ options: [{
1146
+ label: y.dataset.allGroups,
1147
+ selected: n === "",
1148
+ value: ""
1149
+ }, ...e.groups.map((e) => ({
1150
+ label: e.name,
1151
+ selected: e.id === n,
1152
+ value: e.id
1153
+ }))],
1154
+ value: n
1155
+ });
1156
+ return r.dataset.datasetGroup = "true", p(r).element;
1157
+ }
1158
+ function dt(e) {
1159
+ let t = e.panel.ownerDocument, n = t.createElement("div");
1160
+ n.className = "designer-dataset-list", n.dataset.datasetResults = "true";
1161
+ let r = ft(e);
1162
+ if (r === void 0) for (let r of e.items) n.appendChild(mt(t, r, e.descriptor));
1163
+ else for (let e of pt(r)) {
1164
+ let r = t.createElement("p");
1165
+ r.className = "designer-empty-state", r.textContent = e, n.appendChild(r);
1166
+ }
1167
+ if (e.cursor !== void 0) {
1168
+ let e = m(t, { text: y.dataset.loadMore });
1169
+ e.dataset.datasetLoadMore = "true", n.appendChild(e);
1170
+ }
1171
+ return n;
1172
+ }
1173
+ function ft(e) {
1174
+ if (!(e.items.length > 0)) return e.catalogAvailable ? e.query.trim() === "" ? "empty" : "no-match" : "unavailable";
1175
+ }
1176
+ function pt(e) {
1177
+ return e === "unavailable" ? [y.dataset.unavailable, y.dataset.unavailableHint] : [e === "no-match" ? y.dataset.noMatch : y.dataset.empty];
1178
+ }
1179
+ function mt(e, t, n) {
1180
+ let r = n?.datasetId === t.datasetId, i = m(e, {
1181
+ ariaLabel: t.description === null ? t.name : t.name + ":" + t.description,
1182
+ className: "designer-dataset-item",
1183
+ pressed: r
1184
+ });
1185
+ i.dataset.datasetResourceId = t.datasetId;
1186
+ let a = e.createElement("span");
1187
+ a.className = "designer-dataset-item-glyph", a.setAttribute("aria-hidden", "true"), a.innerHTML = d("table");
1188
+ let o = e.createElement("span");
1189
+ o.className = "designer-dataset-item-copy";
1190
+ let s = e.createElement("span");
1191
+ s.className = "designer-dataset-item-name-line";
1192
+ let c = e.createElement("strong");
1193
+ if (c.textContent = t.name, s.appendChild(c), r) {
1194
+ let t = e.createElement("span");
1195
+ t.className = "designer-dataset-item-current", t.textContent = y.dataset.currentTag, s.appendChild(t);
1196
+ }
1197
+ let l = e.createElement("small");
1198
+ if (l.className = "designer-dataset-item-key", l.textContent = t.datasetId, o.append(s, l), t.description !== null && t.description.length > 0) {
1199
+ let n = e.createElement("small");
1200
+ n.className = "designer-dataset-item-description", n.textContent = t.description, o.appendChild(n);
1201
+ }
1202
+ let u = e.createElement("span");
1203
+ return u.className = "designer-dataset-item-action", u.textContent = r ? "" : y.dataset.use, i.append(a, o, u), i;
1204
+ }
1205
+ //#endregion
1206
+ //#region src/browser/dom/designer-date-field-dom.ts
1207
+ var ht = 42, gt = 16;
1208
+ function _t(e, t) {
1209
+ let n = e.ownerDocument, r = n.createElement("span");
1210
+ r.className = "designer-date-field";
1211
+ let i = n.createElement("span");
1212
+ i.className = "designer-date-field-anchor";
1213
+ let a = n.createElement("button");
1214
+ a.type = "button", a.className = "designer-date-field-trigger", a.setAttribute("aria-haspopup", "dialog"), a.setAttribute("aria-expanded", "false"), a.setAttribute("aria-label", y.calendar.open(t.label)), a.innerHTML = d("calendar");
1215
+ let o = n.createElement("section");
1216
+ o.className = "designer-calendar-popover", o.setAttribute("role", "dialog"), o.setAttribute("aria-label", t.label), o.hidden = !0, e.classList.add("designer-date-field-input");
1217
+ let s = e.parentElement;
1218
+ s !== null && s.insertBefore(r, e), i.append(e, a), r.append(i, o);
1219
+ let c = n.createElement("span");
1220
+ c.className = "designer-calendar-title";
1221
+ let l = n.createElement("header");
1222
+ l.className = "designer-calendar-head";
1223
+ let u = vt(n, "chevron-left", y.calendar.previousMonth), f = vt(n, "chevron-right", y.calendar.nextMonth);
1224
+ l.append(u, c, f);
1225
+ let p = n.createElement("div");
1226
+ p.className = "designer-calendar-weekdays", p.setAttribute("aria-hidden", "true");
1227
+ for (let e of y.calendar.weekdays) {
1228
+ let t = n.createElement("span");
1229
+ t.textContent = e, p.appendChild(t);
1230
+ }
1231
+ let m = n.createElement("div");
1232
+ m.className = "designer-calendar-grid", m.setAttribute("role", "grid"), m.setAttribute("aria-label", t.label);
1233
+ let h = n.createElement("footer");
1234
+ h.className = "designer-calendar-foot";
1235
+ let g = n.createElement("button");
1236
+ g.type = "button", g.className = "designer-calendar-action", g.textContent = y.calendar.today;
1237
+ let _ = n.createElement("span");
1238
+ _.className = "designer-calendar-foot-value", h.append(g, _), o.append(l, p, m, h);
1239
+ let v = P(e.value), b = {
1240
+ year: (v ?? /* @__PURE__ */ new Date()).getFullYear(),
1241
+ month: (v ?? /* @__PURE__ */ new Date()).getMonth()
1242
+ }, x = () => {
1243
+ _.textContent = v === void 0 ? y.calendar.unset : F(v);
1244
+ }, ee = () => {
1245
+ let e = v === void 0 ? "" : F(v), t = yt();
1246
+ for (let n of m.querySelectorAll("[data-calendar-day]")) {
1247
+ let r = n.dataset.calendarDay ?? "";
1248
+ n.dataset.selected = String(r === e), n.dataset.today = String(r === F(t)), n.tabIndex = r === e || e === "" && n.dataset.inView === "true" ? 0 : -1;
1249
+ }
1250
+ x();
1251
+ }, S = () => {
1252
+ c.textContent = y.calendar.monthTitle(b.year, b.month + 1);
1253
+ let e = (new Date(b.year, b.month, 1).getDay() + 6) % 7, t = new Date(b.year, b.month, 1 - e);
1254
+ m.replaceChildren();
1255
+ for (let e = 0; e < ht; e++) {
1256
+ let r = new Date(t.getFullYear(), t.getMonth(), t.getDate() + e), i = n.createElement("button");
1257
+ i.type = "button", i.className = "designer-calendar-day", i.dataset.calendarDay = F(r), i.dataset.inView = String(r.getMonth() === b.month), i.dataset.outside = String(r.getMonth() !== b.month), i.setAttribute("aria-label", F(r)), i.textContent = String(r.getDate()), m.appendChild(i);
1258
+ }
1259
+ ee();
1260
+ }, C = (e) => {
1261
+ m.querySelector(`[data-calendar-day="${F(e)}"]`)?.focus({ preventScroll: !0 });
1262
+ }, te = (e) => {
1263
+ if (v = e, e.getFullYear() !== b.year || e.getMonth() !== b.month) {
1264
+ b = {
1265
+ year: e.getFullYear(),
1266
+ month: e.getMonth()
1267
+ }, S();
1268
+ return;
1269
+ }
1270
+ ee();
1271
+ }, w = () => {
1272
+ e.value = v === void 0 ? "" : F(v), e.dispatchEvent(new Event("change", {
1273
+ bubbles: !0,
1274
+ composed: !0
1275
+ }));
1276
+ }, T = () => {
1277
+ let t = P(e.value);
1278
+ t !== void 0 && (v = t);
1279
+ let i = v ?? /* @__PURE__ */ new Date();
1280
+ b = {
1281
+ year: i.getFullYear(),
1282
+ month: i.getMonth()
1283
+ }, o.hidden = !1, a.setAttribute("aria-expanded", "true"), r.dataset.open = "true", S();
1284
+ let s = a.getBoundingClientRect(), c = n.defaultView;
1285
+ c !== null && (o.dataset.side = c.innerHeight - s.bottom < o.offsetHeight + gt && s.top > o.offsetHeight + gt ? "top" : "bottom"), C(i);
1286
+ }, E = (e) => {
1287
+ o.hidden = !0, a.setAttribute("aria-expanded", "false"), r.dataset.open = "false", e && a.focus({ preventScroll: !0 });
1288
+ };
1289
+ a.addEventListener("click", () => {
1290
+ o.hidden ? T() : E(!0);
1291
+ }), a.addEventListener("keydown", (e) => {
1292
+ e.key === "ArrowDown" && o.hidden && (e.preventDefault(), T());
1293
+ }), u.addEventListener("click", () => {
1294
+ let e = new Date(b.year, b.month - 1, 1);
1295
+ b = {
1296
+ year: e.getFullYear(),
1297
+ month: e.getMonth()
1298
+ }, S();
1299
+ }), f.addEventListener("click", () => {
1300
+ let e = new Date(b.year, b.month + 1, 1);
1301
+ b = {
1302
+ year: e.getFullYear(),
1303
+ month: e.getMonth()
1304
+ }, S();
1305
+ }), g.addEventListener("click", () => {
1306
+ let e = yt();
1307
+ te(e), w(), C(e);
1308
+ }), m.addEventListener("click", (e) => {
1309
+ let t = e.target?.closest("[data-calendar-day]");
1310
+ if (t == null) return;
1311
+ let n = P(t.dataset.calendarDay ?? "");
1312
+ n !== void 0 && (te(n), w(), C(n));
1313
+ }), m.addEventListener("keydown", (e) => {
1314
+ let t = e.target?.closest("[data-calendar-day]");
1315
+ if (t == null) return;
1316
+ let n = P(t.dataset.calendarDay ?? "");
1317
+ if (n === void 0) return;
1318
+ let r = e.key === "ArrowLeft" ? -1 : e.key === "ArrowRight" ? 1 : e.key === "ArrowUp" ? -7 : e.key === "ArrowDown" ? 7 : 0;
1319
+ if (r !== 0) {
1320
+ e.preventDefault();
1321
+ let t = new Date(n.getFullYear(), n.getMonth(), n.getDate() + r);
1322
+ (t.getMonth() !== b.month || t.getFullYear() !== b.year) && (b = {
1323
+ year: t.getFullYear(),
1324
+ month: t.getMonth()
1325
+ }, S()), C(t);
1326
+ return;
1327
+ }
1328
+ if (e.key === "PageUp" || e.key === "PageDown") {
1329
+ e.preventDefault();
1330
+ let t = (e.key === "PageUp" ? -1 : 1) * (e.shiftKey ? 12 : 1), r = new Date(n.getFullYear(), n.getMonth() + t, 1), i = new Date(r.getFullYear(), r.getMonth() + 1, 0).getDate(), a = new Date(r.getFullYear(), r.getMonth(), Math.min(n.getDate(), i));
1331
+ b = {
1332
+ year: r.getFullYear(),
1333
+ month: r.getMonth()
1334
+ }, S(), C(a);
1335
+ return;
1336
+ }
1337
+ if (e.key === "Home" || e.key === "End") {
1338
+ e.preventDefault();
1339
+ let t = new Date(b.year, b.month + 1, 0).getDate();
1340
+ C(new Date(b.year, b.month, e.key === "Home" ? 1 : t));
1341
+ }
1342
+ }), e.addEventListener("change", () => {
1343
+ let t = P(e.value);
1344
+ if (t === void 0) {
1345
+ e.value = v === void 0 ? "" : F(v);
1346
+ return;
1347
+ }
1348
+ v = t, b = {
1349
+ year: t.getFullYear(),
1350
+ month: t.getMonth()
1351
+ }, o.hidden || S();
1352
+ }), e.addEventListener("keydown", (e) => {
1353
+ e.key === "ArrowDown" && o.hidden && (e.preventDefault(), T());
1354
+ }), o.addEventListener("keydown", (e) => {
1355
+ e.key === "Escape" && (e.preventDefault(), E(!0));
1356
+ });
1357
+ let D = (t) => {
1358
+ if (!r.isConnected) {
1359
+ e.ownerDocument.removeEventListener("pointerdown", D, !0);
1360
+ return;
1361
+ }
1362
+ if (o.hidden) return;
1363
+ let n = t.composedPath()[0] ?? t.target;
1364
+ n instanceof Node && r.contains(n) || E(!1);
1365
+ };
1366
+ return e.ownerDocument.addEventListener("pointerdown", D, !0), S(), {
1367
+ element: r,
1368
+ open: T,
1369
+ close: () => E(!1),
1370
+ dispose: () => {
1371
+ e.ownerDocument.removeEventListener("pointerdown", D, !0), o.remove();
1372
+ }
1373
+ };
1374
+ }
1375
+ function vt(e, t, n) {
1376
+ let r = e.createElement("button");
1377
+ return r.type = "button", r.className = "designer-calendar-nav", r.setAttribute("aria-label", n), r.innerHTML = d(t), r;
1378
+ }
1379
+ function P(e) {
1380
+ let t = /^(\d{4})[/.-](\d{1,2})[/.-](\d{1,2})$/.exec(e.trim());
1381
+ if (t === null) return;
1382
+ let n = Number(t[1]), r = Number(t[2]), i = Number(t[3]), a = new Date(n, r - 1, i);
1383
+ if (a.getFullYear() === n && a.getMonth() === r - 1 && a.getDate() === i) return a;
1384
+ }
1385
+ function F(e) {
1386
+ let t = (e) => e < 10 ? `0${e}` : String(e);
1387
+ return `${e.getFullYear()}-${t(e.getMonth() + 1)}-${t(e.getDate())}`;
1388
+ }
1389
+ function yt() {
1390
+ let e = /* @__PURE__ */ new Date();
1391
+ return e.setHours(0, 0, 0, 0), e;
1392
+ }
1393
+ //#endregion
1394
+ //#region src/browser/dom/dataset/designer-dataset-config-controls.ts
1395
+ function bt(e, t, n, r) {
1396
+ let i = t.parameters.find((e) => e.name === n), a = i.valueType === "boolean" ? l(e, { ariaLabel: y.dataset.parameterValueLabel(i.label) }) : c(e, {
1397
+ ariaLabel: y.dataset.parameterValueLabel(i.label),
1398
+ appearance: i.valueType === "number" ? "number" : "text",
1399
+ ...i.valueType === "date" ? { placeholder: y.dataset.parameterDatePlaceholder } : {},
1400
+ ...i.minimum === void 0 ? {} : { min: i.minimum },
1401
+ ...i.maximum === void 0 ? {} : { max: i.maximum }
1402
+ });
1403
+ return a.dataset.valueRefInline = `parameter:${i.name}`, a.dataset.datasetParameter = i.name, wt(a, i, r), a.required = i.required, i.maxLength !== void 0 && (a.maxLength = i.maxLength), i.valueType === "date" ? _t(a, { label: i.label }).element : a;
1404
+ }
1405
+ function xt(e, t, n) {
1406
+ let r = e.createElement("section");
1407
+ r.tabIndex = -1, r.className = "designer-dataset-config-section", r.dataset.inspectorSearchSection = "true", n !== void 0 && (r.dataset.workbenchSection = n);
1408
+ let i = e.createElement("h4");
1409
+ return i.className = "designer-inspector-section-title", i.textContent = t, r.appendChild(i), r;
1410
+ }
1411
+ function St(e, t, n) {
1412
+ let r = e.createElement("div");
1413
+ return r.className = "designer-dataset-actions", r.append(Ct(e, "apply", y.dataSource.apply("dataset"), t || !n, "primary"), Ct(e, "refresh", y.dataset.refresh, t, "ghost")), r;
1414
+ }
1415
+ function Ct(e, t, n, r, i) {
1416
+ let a = m(e, {
1417
+ disabled: r,
1418
+ text: n
1419
+ });
1420
+ return a.dataset.datasetAction = t, a.dataset.variant = i, a;
1421
+ }
1422
+ function wt(e, t, n) {
1423
+ let r = n !== void 0 && n.kind === "inline" ? n.value : t.defaultValue;
1424
+ if (e instanceof HTMLInputElement && t.valueType === "boolean") {
1425
+ e.checked = r === !0, e.value = String(e.checked);
1426
+ return;
1427
+ }
1428
+ e.value = String(r ?? "");
1429
+ }
1430
+ //#endregion
1431
+ //#region src/browser/dom/dataset/designer-dataset-config-dom.ts
1432
+ var I = /* @__PURE__ */ new WeakMap();
1433
+ function Tt(e) {
1434
+ let t = I.get(e);
1435
+ if (t !== void 0) {
1436
+ for (let e of t) e();
1437
+ I.delete(e);
1438
+ }
1439
+ }
1440
+ function Et(e) {
1441
+ for (let t of e.querySelectorAll("[data-ds-section]")) Tt(t);
1442
+ }
1443
+ function Dt(e, t) {
1444
+ let n = I.get(e);
1445
+ n === void 0 ? I.set(e, [t]) : n.push(t);
1446
+ }
1447
+ function Ot(e) {
1448
+ return e.querySelector(".designer-inspector-section-title")?.remove(), e;
1449
+ }
1450
+ function kt(e) {
1451
+ let t = e.roles.flatMap((t) => {
1452
+ let n = e.draft?.fields[t.id] ?? [];
1453
+ if (n.length === 0) return [];
1454
+ let r = n.map((t) => e.descriptor.fields.find((e) => e.id === t)?.label ?? t);
1455
+ return [`${y.dataset.bindingRole(t.id)} ${r.join("、")}`];
1456
+ });
1457
+ return t.length === 0 ? y.data.groups.mappingEmpty : t.join(" · ");
1458
+ }
1459
+ var At = {
1460
+ ...y.data.ref,
1461
+ tab: {
1462
+ ...y.data.ref.tab,
1463
+ inline: y.dataset.literal
1464
+ }
1465
+ };
1466
+ function jt(e) {
1467
+ let t = e.panel.ownerDocument, n = t.createElement("div");
1468
+ n.dataset.datasetDescriptor = "true", n.dataset.dsSection = "source", n.className = "designer-dataset-descriptor";
1469
+ let r = e.groupOpenOverrides ?? /* @__PURE__ */ new Map(), i = M(e.descriptor, e.draft);
1470
+ return n.append(N({
1471
+ ownerDocument: t,
1472
+ section: "source",
1473
+ group: "source",
1474
+ title: y.data.groups.source,
1475
+ summary: e.descriptor.name,
1476
+ defaultOpen: !0,
1477
+ overrides: r,
1478
+ onToggle: e.onToggleGroup
1479
+ }, [Nt(t, e)]), N({
1480
+ ownerDocument: t,
1481
+ section: "source",
1482
+ group: "mapping",
1483
+ title: y.data.groups.mapping,
1484
+ summary: kt(e),
1485
+ defaultOpen: !0,
1486
+ overrides: r,
1487
+ onToggle: e.onToggleGroup,
1488
+ action: Mt(t, e)
1489
+ }, [Ot(Lt(t, e))]), N({
1490
+ ownerDocument: t,
1491
+ section: "source",
1492
+ group: "parameters",
1493
+ title: y.data.groups.parameters,
1494
+ summary: i > 0 ? y.dataSource.parametersSummary(e.descriptor.parameters.length, i) : y.dataSource.parametersFilled(e.descriptor.parameters.length),
1495
+ defaultOpen: i > 0,
1496
+ overrides: r,
1497
+ onToggle: e.onToggleGroup
1498
+ }, [Ot(Ft(t, e))])), e.descriptor.parameters.length === 0 && n.querySelector("[data-details-group=\"parameters\"]")?.remove(), e.includeActions !== !1 && n.appendChild(St(n.ownerDocument, !e.resourceAvailable, $e(e.descriptor, e.draft, e.roles))), n;
1499
+ }
1500
+ function Mt(e, t) {
1501
+ let n = m(e, {
1502
+ className: "designer-dataset-auto-match",
1503
+ disabled: t.roles.length === 0 || t.descriptor.fields.length === 0,
1504
+ text: y.dataset.autoMatch
1505
+ });
1506
+ return n.dataset.datasetAutoMatch = "true", n;
1507
+ }
1508
+ function Nt(e, t) {
1509
+ let n = t.descriptor, r = e.createElement("section");
1510
+ r.className = "designer-dataset-summary", r.dataset.workbenchSection = "source", r.dataset.inspectorSearchSection = "true", r.tabIndex = -1;
1511
+ let i = e.createElement("div");
1512
+ i.className = "designer-dataset-summary-header";
1513
+ let a = e.createElement("span");
1514
+ a.className = "designer-dataset-summary-mark", a.setAttribute("aria-hidden", "true"), a.innerHTML = d("table");
1515
+ let o = e.createElement("div");
1516
+ o.className = "designer-dataset-summary-copy";
1517
+ let s = e.createElement("div");
1518
+ s.className = "designer-dataset-summary-name-line";
1519
+ let c = e.createElement("strong");
1520
+ c.className = "designer-dataset-summary-title", c.textContent = n.name;
1521
+ let l = e.createElement("span");
1522
+ l.className = "designer-dataset-summary-kind", l.textContent = y.dataset.kindBadge, s.append(c, l);
1523
+ let u = e.createElement("span");
1524
+ u.className = "designer-dataset-summary-key", u.dataset.datasetSourceKey = "true", u.textContent = n.datasetId, u.title = n.datasetId, o.append(s, u);
1525
+ let f = m(e, {
1526
+ size: "compact",
1527
+ text: y.dataSource.sourceChange,
1528
+ variant: "ghost"
1529
+ });
1530
+ if (f.dataset.datasetChange = "true", i.append(a, o, f), r.appendChild(i), n.description !== null && n.description.length > 0) {
1531
+ let t = e.createElement("p");
1532
+ t.className = "designer-dataset-description", t.textContent = n.description, r.appendChild(t);
1533
+ }
1534
+ return Pt(e, r, t), t.surface === "inspector" && r.appendChild(at(e, t.link)), r;
1535
+ }
1536
+ function Pt(e, t, n) {
1537
+ let r = n.instances ?? [], i = n.selectedInstanceId ?? null;
1538
+ if (r.length === 0 && i === null) return;
1539
+ let a = o(e, {
1540
+ label: y.dataset.instance,
1541
+ className: "designer-dataset-instance",
1542
+ controlClassName: "designer-dataset-instance-control"
1543
+ }), s = _(e, { options: [{
1544
+ value: "",
1545
+ label: y.dataset.instanceAuto,
1546
+ selected: i === null
1547
+ }, ...r.map((e) => ({
1548
+ value: e.id,
1549
+ label: e.name === e.id ? e.id : `${e.name} · ${e.id}`,
1550
+ selected: e.id === i
1551
+ }))] });
1552
+ s.dataset.datasetInstanceSelect = "", a.control.appendChild(p(s).element);
1553
+ let c = e.createElement("p");
1554
+ c.className = "designer-dataset-instance-hint", c.textContent = y.dataset.instanceHint, a.field.appendChild(c), t.appendChild(a.field);
1555
+ }
1556
+ function Ft(e, t) {
1557
+ let n = xt(e, y.dataSource.requestTitle, "parameters");
1558
+ if (t.descriptor.parameters.length === 0) {
1559
+ let t = e.createElement("p");
1560
+ t.className = "designer-empty-state", t.textContent = y.dataset.noParameters, n.appendChild(t);
1561
+ }
1562
+ for (let r of t.descriptor.parameters) {
1563
+ let i = It(t.draft, r.name), a = i !== null && i.kind === "variable" ? "variable" : "inline", o = r.required && i === null ? y.dataSource.parameterRequired(r.label) : "", s = e.createElement("div");
1564
+ s.className = "designer-dataset-parameter", s.dataset.datasetParameterRow = r.name;
1565
+ let c = e.createElement("div");
1566
+ c.className = "designer-dataset-parameter-head";
1567
+ let l = e.createElement("span");
1568
+ if (l.className = "designer-dataset-parameter-label", l.textContent = r.label, r.required) {
1569
+ let t = e.createElement("span");
1570
+ t.className = "designer-field-required", t.setAttribute("aria-hidden", "true"), t.textContent = "*", l.appendChild(t);
1571
+ }
1572
+ let { element: u, buttons: d } = h(e, {
1573
+ ariaLabel: y.dataset.parameterModeLabel(r.label),
1574
+ className: "designer-dataset-parameter-mode",
1575
+ selected: a,
1576
+ options: [{
1577
+ value: "inline",
1578
+ label: y.dataset.literal,
1579
+ className: "designer-dataset-parameter-mode-option",
1580
+ dataset: { datasetParameterMode: "inline" }
1581
+ }, {
1582
+ value: "variable",
1583
+ label: y.dataset.variable,
1584
+ className: "designer-dataset-parameter-mode-option",
1585
+ dataset: { datasetParameterMode: "variable" }
1586
+ }]
1587
+ }), p = d.get("inline"), m = d.get("variable");
1588
+ c.append(l, u);
1589
+ let g = e.createElement("div");
1590
+ g.className = "designer-dataset-parameter-control", g.dataset.datasetParameterControl = r.name, g.dataset.mode = a, o !== "" && (g.dataset.invalid = "true");
1591
+ let _ = Ye({
1592
+ ownerDocument: e,
1593
+ text: At,
1594
+ input: Xe(i, t.variables),
1595
+ controlKey: `parameter:${r.name}`,
1596
+ ariaLabel: y.dataset.parameterVariableLabel(r.label),
1597
+ anchor: g,
1598
+ popoverHost: t.overlayHost,
1599
+ onSelect: (e) => t.onSelectParameter?.(r.name, e)
1600
+ });
1601
+ if (Dt(n, _.dispose), a === "inline") {
1602
+ let n = bt(e, t.descriptor, r.name, i ?? void 0);
1603
+ r.required && n.querySelector("input, select, textarea")?.setAttribute("aria-required", "true"), g.appendChild(n);
1604
+ }
1605
+ if (g.appendChild(_.element), a === "variable") {
1606
+ let n = f(e, {
1607
+ className: "designer-dataset-parameter-clear",
1608
+ icon: "close",
1609
+ label: y.dataset.parameterClearVariable(r.label)
1610
+ });
1611
+ n.dataset.datasetParameterClear = r.name, n.addEventListener("click", () => {
1612
+ t.onSelectParameter?.(r.name, {
1613
+ kind: "inline",
1614
+ value: null
1615
+ });
1616
+ }), g.appendChild(n);
1617
+ }
1618
+ if (s.append(c, g), o !== "") {
1619
+ let t = e.createElement("span");
1620
+ t.className = "designer-field-message designer-dataset-parameter-error", t.id = `designer-dataset-parameter-error-${r.name.replace(/[^A-Za-z0-9_-]/g, "-")}`, t.dataset.datasetParameterError = "true", t.setAttribute("role", "alert"), t.textContent = o;
1621
+ let n = g.querySelector("input, select, textarea");
1622
+ n !== null && (n.setAttribute("aria-invalid", "true"), n.setAttribute("aria-describedby", t.id)), s.appendChild(t);
1623
+ }
1624
+ p.addEventListener("click", () => {
1625
+ a !== "inline" && t.onSelectParameter?.(r.name, {
1626
+ kind: "inline",
1627
+ value: null
1628
+ });
1629
+ }), m.addEventListener("click", () => {
1630
+ _.element.querySelector("[data-value-ref-trigger]")?.click();
1631
+ }), n.appendChild(s);
1632
+ }
1633
+ return n;
1634
+ }
1635
+ function It(e, t) {
1636
+ return e?.params[t] ?? null;
1637
+ }
1638
+ function Lt(e, t) {
1639
+ let n = xt(e, y.dataset.binding, "mapping");
1640
+ if (t.roles.length === 0) {
1641
+ let t = e.createElement("p");
1642
+ t.className = "designer-empty-state", t.textContent = y.dataset.noBinding, n.appendChild(t);
1643
+ }
1644
+ for (let r of t.roles) n.appendChild(Rt(e, t.descriptor, r, t.draft, t.bindingOpenRoleId ?? null));
1645
+ return n;
1646
+ }
1647
+ function Rt(e, t, n, r, i) {
1648
+ let a = e.createElement("div");
1649
+ a.className = "designer-dataset-binding-role", a.dataset.datasetBindingRole = n.id;
1650
+ let o = e.createElement("strong");
1651
+ o.className = "designer-dataset-binding-label", o.textContent = y.dataset.bindingRole(n.id);
1652
+ let s = r?.fields[n.id] ?? [], c = e.createElement("div");
1653
+ c.className = "designer-dataset-field-list", c.setAttribute("role", "group"), c.setAttribute("aria-label", y.dataset.bindingRole(n.id));
1654
+ let l = t.fields.filter((e) => n.valueTypes.includes(e.valueType));
1655
+ if (n.maxFields === 1) {
1656
+ let t = _(e, {
1657
+ ariaLabel: y.dataset.bindingRole(n.id),
1658
+ className: "designer-dataset-binding-select",
1659
+ options: [{
1660
+ label: y.dataset.selectField,
1661
+ selected: s.length === 0,
1662
+ value: ""
1663
+ }, ...l.map((e) => ({
1664
+ label: `${e.label} · ${e.valueType}`,
1665
+ selected: s.includes(e.id),
1666
+ value: e.id
1667
+ }))],
1668
+ value: s[0] ?? ""
1669
+ });
1670
+ t.dataset.datasetBindingRole = n.id, c.appendChild(p(t).element);
1671
+ } else c.appendChild(zt(e, n.id, l, s, n.maxFields, i === n.id));
1672
+ if (l.length === 0) {
1673
+ let t = e.createElement("p");
1674
+ t.className = "designer-empty-state", t.textContent = y.dataset.noCompatibleFields, c.appendChild(t);
1675
+ }
1676
+ return a.append(o, c), a;
1677
+ }
1678
+ function zt(e, t, n, r, i, a) {
1679
+ let o = y.dataset.bindingRole(t), s = r.length >= i, c = n.filter((e) => r.includes(e.id)), l = e.createElement("div");
1680
+ l.className = "designer-bind-field";
1681
+ let u = m(e, {
1682
+ ariaLabel: y.dataset.bindingToggle(o),
1683
+ className: "designer-bind-trigger"
1684
+ });
1685
+ u.dataset.datasetBindingTrigger = t, u.setAttribute("aria-haspopup", "listbox"), u.setAttribute("aria-expanded", String(a));
1686
+ let f = e.createElement("span");
1687
+ if (f.className = "designer-bind-chips", c.length === 0) {
1688
+ let t = e.createElement("span");
1689
+ t.className = "designer-bind-placeholder", t.textContent = y.dataset.bindingPlaceholder, f.appendChild(t);
1690
+ } else for (let n of c) {
1691
+ let r = e.createElement("span");
1692
+ r.className = "designer-bind-chip", r.append(n.label);
1693
+ let i = e.createElement("span");
1694
+ i.className = "designer-bind-chip-x", i.dataset.datasetBindingChipRole = t, i.dataset.datasetBindingChipField = n.id, i.setAttribute("aria-hidden", "true"), i.innerHTML = d("close"), r.appendChild(i), f.appendChild(r);
1695
+ }
1696
+ let p = e.createElement("span");
1697
+ p.className = "designer-bind-count", p.dataset.datasetBindingCount = t, p.dataset.atLimit = String(s), p.textContent = y.dataset.bindingCount(r.length, i);
1698
+ let h = e.createElement("span");
1699
+ h.className = "designer-bind-caret", h.innerHTML = d("chevron-down"), u.append(f, p, h);
1700
+ let g = e.createElement("div");
1701
+ g.className = "designer-bind-menu", g.dataset.datasetBindingMenu = t, g.hidden = !a;
1702
+ let _ = e.createElement("div");
1703
+ _.className = "designer-bind-options", _.setAttribute("role", "listbox"), _.setAttribute("aria-multiselectable", "true"), _.setAttribute("aria-label", o);
1704
+ for (let a of n) _.appendChild(Vt(e, t, a, r, i));
1705
+ let v = e.createElement("div");
1706
+ v.className = "designer-bind-foot", v.dataset.datasetBindingHint = t, v.dataset.atLimit = String(s), v.textContent = s ? y.dataset.bindingAtLimit : y.dataset.bindingLimitHint(i);
1707
+ let b = e.createElement("div");
1708
+ return b.className = "designer-bind-actions", b.append(Bt(e, t, "select-all", n.length > i ? y.dataset.bindingSelectMaximum : y.dataset.bindingSelectAll, r.length === Math.min(n.length, i)), Bt(e, t, "clear", y.dataset.bindingClear, r.length === 0)), g.append(_, b, v), l.append(u, g), l;
1709
+ }
1710
+ function Bt(e, t, n, r, i = !1) {
1711
+ let a = m(e, {
1712
+ className: "designer-dataset-binding-role-action",
1713
+ disabled: i,
1714
+ text: r
1715
+ });
1716
+ return a.dataset.datasetBindingRoleAction = n, a.dataset.datasetBindingRoleId = t, a;
1717
+ }
1718
+ function Vt(e, t, n, r, i) {
1719
+ let a = r.includes(n.id), o = e.createElement("button");
1720
+ o.type = "button", o.className = "designer-bind-option", o.dataset.datasetBindingRoleId = t, o.dataset.datasetBindingField = n.id, o.setAttribute("role", "option"), o.setAttribute("aria-selected", String(a)), o.disabled = !a && r.length >= i;
1721
+ let s = e.createElement("span");
1722
+ s.className = "designer-bind-check", s.innerHTML = d("check");
1723
+ let c = e.createElement("span");
1724
+ c.className = "designer-bind-label", c.textContent = n.label;
1725
+ let l = e.createElement("span");
1726
+ return l.className = "designer-bind-type", l.textContent = n.valueType, o.append(s, c, l), o;
1727
+ }
1728
+ //#endregion
1729
+ //#region src/browser/dom/dataset/designer-dataset-authoring-dom.ts
1730
+ function Ht(e, t = "all") {
1731
+ let n = e.panel.ownerDocument.createElement("section");
1732
+ n.className = "designer-dataset-authoring", n.dataset.datasetAuthoring = "true", n.dataset.dsSection = "authoring", n.dataset.authoringPart = t, n.dataset.inspectorSearchSection = "true";
1733
+ let r = e.panel.ownerDocument.createElement("h4");
1734
+ r.className = "designer-inspector-section-title", r.textContent = y.dataSource.authoringTitle;
1735
+ let i = h(e.panel.ownerDocument, {
1736
+ ariaLabel: y.dataSource.authoringTitle,
1737
+ selected: e.authoring.editorMode,
1738
+ options: [{
1739
+ value: "visual",
1740
+ label: y.dataSource.visualEditor,
1741
+ dataset: { datasetEditorMode: "visual" }
1742
+ }, {
1743
+ value: "code",
1744
+ label: y.dataSource.codeEditor,
1745
+ dataset: {
1746
+ datasetAuthoringAction: "open-code-editor",
1747
+ datasetEditorMode: "code"
1748
+ }
1749
+ }]
1750
+ }).element, a = e.panel.ownerDocument.createElement("div");
1751
+ a.className = "designer-dataset-authoring-row";
1752
+ let o = e.panel.ownerDocument.createElement("span");
1753
+ o.className = "designer-dataset-authoring-status", o.textContent = e.authoring.filterConfigured ? y.dataSource.configured : y.dataSource.filterUnset, a.append(Gt(e.panel.ownerDocument, y.dataSource.filter, y.dataSource.filterHint), o, Wt(e.panel.ownerDocument, "configure-filter", y.dataSource.filterConfigure));
1754
+ let s = e.panel.ownerDocument.createElement("div");
1755
+ s.className = "designer-dataset-authoring-settings", s.setAttribute("role", "group"), s.setAttribute("aria-label", y.dataSource.advancedSettings), e.surface === "workbench" ? s.append(Kt(e, "loadingDisabled", y.dataSource.loadingState, e.authoring.loadingDisabled), Kt(e, "controlled", y.dataSource.controlledMode, e.authoring.controlled), qt(e)) : s.append(Ut(e));
1756
+ let c = e.panel.ownerDocument.createElement("div");
1757
+ return c.className = "designer-dataset-authoring-actions", c.append(Wt(e.panel.ownerDocument, "copy-data", y.dataSource.copyData, e.preview.rawValue === void 0, y.dataSource.copyDataHint)), t !== "footer" && c.appendChild(Wt(e.panel.ownerDocument, "fullscreen-edit", y.dataSource.fullscreenEdit)), e.surface === "inspector" && t === "all" ? (n.appendChild(N({
1758
+ ownerDocument: e.panel.ownerDocument,
1759
+ section: "authoring",
1760
+ group: "refresh",
1761
+ title: y.dataSource.advancedSettings,
1762
+ summary: `${L(e)} \u00b7 ${y.data.groups.editInWorkbench}`,
1763
+ readonlyHint: !0,
1764
+ defaultOpen: !1,
1765
+ overrides: e.groupOpenOverrides ?? /* @__PURE__ */ new Map(),
1766
+ onToggle: e.onToggleGroup
1767
+ }, [
1768
+ i,
1769
+ a,
1770
+ c,
1771
+ s
1772
+ ])), n) : (t !== "footer" && n.append(r, i, a, c), t !== "editor" && n.appendChild(e.dataValue?.kind === "data-source-field" ? N({
1773
+ ownerDocument: e.panel.ownerDocument,
1774
+ section: "authoring",
1775
+ group: "refresh",
1776
+ title: y.data.groups.refresh,
1777
+ summary: e.surface === "inspector" ? `${L(e)} \u00b7 ${y.data.groups.editInWorkbench}` : L(e),
1778
+ readonlyHint: e.surface === "inspector",
1779
+ defaultOpen: !1,
1780
+ overrides: e.groupOpenOverrides ?? /* @__PURE__ */ new Map(),
1781
+ onToggle: e.onToggleGroup
1782
+ }, [s]) : s), n);
1783
+ }
1784
+ function Ut(e) {
1785
+ let t = e.panel.ownerDocument, n = t.createElement("div");
1786
+ n.className = "designer-dataset-instance-facts", n.dataset.instanceFacts = "true";
1787
+ let r = [[y.dataSource.refreshStrategyLabel, L(e)], [y.data.groups.source, e.instance?.name ?? y.data.groups.sourceEmpty]];
1788
+ for (let [e, i] of r) {
1789
+ let r = t.createElement("div");
1790
+ r.className = "designer-dataset-instance-fact";
1791
+ let a = t.createElement("span");
1792
+ a.className = "designer-dataset-instance-fact-label", a.textContent = e;
1793
+ let o = t.createElement("span");
1794
+ o.className = "designer-dataset-instance-fact-value", o.textContent = i, r.append(a, o), n.appendChild(r);
1795
+ }
1796
+ let i = m(t);
1797
+ return i.dataset.datasetAction = "open-instance", i.dataset.editInWorkbench = "true", i.dataset.instanceId = e.instance?.id ?? "", e.instance?.status === "missing" ? (i.dataset.instanceMissing = "true", i.textContent = y.data.groups.instanceMissing, i.title = y.data.groups.instanceMissingHint) : e.instance?.status === "pending" ? (i.dataset.instancePending = "true", i.disabled = !0, i.textContent = y.data.groups.pendingApply) : i.textContent = y.data.groups.editInWorkbench, n.appendChild(i), n;
1798
+ }
1799
+ function L(e) {
1800
+ let t = e.instance?.updatePolicy;
1801
+ return t === void 0 ? y.data.groups.refreshManual : t.mode === "once" ? y.data.groups.refreshOnce : t.mode === "auto" ? y.data.groups.refreshEvery(t.intervalSeconds ?? 30) : y.data.groups.refreshManual;
1802
+ }
1803
+ function Wt(e, t, n, r = !1, i) {
1804
+ if (t === "copy-data" || t === "fullscreen-edit") {
1805
+ let a = f(e, {
1806
+ ariaLabel: r && i !== void 0 ? `${n} · ${i}` : n,
1807
+ className: "designer-dataset-authoring-icon-action",
1808
+ disabled: r,
1809
+ icon: t === "copy-data" ? "copy" : "fit",
1810
+ label: n,
1811
+ tip: r && i !== void 0 ? i : n,
1812
+ variant: "ghost"
1813
+ });
1814
+ return a.dataset.datasetAuthoringAction = t, a;
1815
+ }
1816
+ let a = m(e, {
1817
+ disabled: r,
1818
+ text: n
1819
+ });
1820
+ return a.dataset.datasetAuthoringAction = t, a;
1821
+ }
1822
+ function Gt(e, t, n) {
1823
+ let r = e.createElement("span");
1824
+ return r.className = "designer-dataset-authoring-label", r.textContent = t, r.setAttribute("data-tip", n), r;
1825
+ }
1826
+ function Kt(e, n, r, i) {
1827
+ let { field: a, input: o } = t(e.panel.ownerDocument, {
1828
+ ariaLabel: r,
1829
+ checked: i,
1830
+ className: "designer-dataset-authoring-checkbox",
1831
+ control: "checkbox",
1832
+ label: r,
1833
+ labelClassName: "designer-dataset-authoring-setting-label"
1834
+ });
1835
+ return o.dataset.datasetAuthoringSetting = n, o.value = String(i), a;
1836
+ }
1837
+ function qt(e) {
1838
+ let t = e.panel.ownerDocument, n = t.createElement("div");
1839
+ n.className = "designer-dataset-refresh-controls", n.setAttribute("role", "group"), n.setAttribute("aria-label", y.dataSource.refreshStrategyLabel);
1840
+ let r = t.createElement("label");
1841
+ r.className = "designer-dataset-authoring-setting-row";
1842
+ let i = t.createElement("span");
1843
+ i.className = "designer-dataset-authoring-setting-label", i.textContent = y.dataSource.refreshStrategyLabel;
1844
+ let a = _(t, {
1845
+ ariaLabel: y.dataSource.refreshStrategyLabel,
1846
+ options: [
1847
+ ["once", y.dataSource.refreshOnce],
1848
+ ["manual", y.dataSource.manualRefresh],
1849
+ ["auto", y.dataSource.refreshAuto]
1850
+ ].map(([t, n]) => ({
1851
+ label: n,
1852
+ selected: e.authoring.refreshStrategy === t,
1853
+ value: t
1854
+ })),
1855
+ value: e.authoring.refreshStrategy
1856
+ });
1857
+ a.dataset.datasetAuthoringSetting = "refreshStrategy", r.append(i, p(a).element);
1858
+ let o = t.createElement("label");
1859
+ o.className = "designer-dataset-authoring-setting-row", o.dataset.disabled = String(e.authoring.refreshStrategy !== "auto");
1860
+ let s = t.createElement("span");
1861
+ s.className = "designer-dataset-authoring-setting-label", s.textContent = y.dataSource.refreshIntervalLabel;
1862
+ let l = t.createElement("span");
1863
+ l.className = "designer-dataset-refresh-interval-control";
1864
+ let u = c(t, {
1865
+ appearance: "number",
1866
+ ariaLabel: `${y.dataSource.refreshIntervalLabel} · ${y.dataSource.refreshInterval}`,
1867
+ className: "designer-number-input",
1868
+ disabled: e.authoring.refreshStrategy !== "auto",
1869
+ max: 3600,
1870
+ min: 1,
1871
+ step: 1,
1872
+ value: String(e.authoring.refreshInterval)
1873
+ });
1874
+ u.dataset.datasetAuthoringSetting = "refreshInterval";
1875
+ let d = t.createElement("span");
1876
+ return d.textContent = y.dataSource.refreshInterval, d.setAttribute("aria-hidden", "true"), l.append(u, d), o.append(s, l), n.append(r, o), n;
1877
+ }
1878
+ function Jt(e) {
1879
+ return e.refreshStrategy === "once" ? y.dataSource.refreshOnceNotice : e.refreshStrategy === "auto" ? y.dataSource.refreshAutoNotice : y.dataSource.refreshManualNotice;
1880
+ }
1881
+ //#endregion
1882
+ //#region src/browser/dom/dataset/designer-dataset-preview-dom.ts
1883
+ function Yt(e, t) {
1884
+ let n = e.createElement("aside");
1885
+ n.className = "designer-data-workbench-preview", n.dataset.designerScrollScope = `data-workbench-preview:${t.scrollScope}:${t.preview.tab}`, n.dataset.workbenchSection = "preview", n.dataset.dsSection = "preview", n.dataset.inspectorSearchSection = "true", n.dataset.inspectorSearchText = [
1886
+ y.dataSource.responseTitle,
1887
+ y.dataSource.previewRaw,
1888
+ y.dataSource.previewConsumer,
1889
+ y.dataSource.previewRequest
1890
+ ].join(" "), n.tabIndex = -1, n.dataset.open = String(t.preview.open), n.dataset.status = t.preview.status;
1891
+ let r = e.createElement("div");
1892
+ r.className = "designer-data-preview-tabs", r.setAttribute("role", "tablist");
1893
+ for (let [n, i] of [
1894
+ ["response", y.dataSource.previewRaw],
1895
+ ["consumer", y.dataSource.previewConsumer],
1896
+ ["request", y.dataSource.previewRequest]
1897
+ ]) {
1898
+ let a = e.createElement("button");
1899
+ a.type = "button", a.dataset.datasetPreviewTab = n, a.setAttribute("role", "tab"), a.setAttribute("aria-selected", String(t.preview.tab === n)), a.textContent = i, r.appendChild(a);
1900
+ }
1901
+ let i = e.createElement("div");
1902
+ if (i.className = "designer-data-preview-toolbar", i.appendChild(r), t.preview.testedAt !== void 0) {
1903
+ let n = e.createElement("span");
1904
+ n.className = "designer-data-preview-time", n.textContent = y.dataSource.previewUpdatedAt(t.preview.testedAt), i.appendChild(n);
1905
+ }
1906
+ let a = e.createElement("div");
1907
+ if (a.className = "designer-data-preview-content", a.setAttribute("role", "tabpanel"), t.preview.status === "loading") a.appendChild($t(e));
1908
+ else if (t.preview.status === "error") a.appendChild(en(e, t.preview.message || y.dataSource.responseFailed));
1909
+ else if (t.preview.tab === "request") a.appendChild(ln(e, {
1910
+ datasetId: t.draft?.datasetId,
1911
+ params: t.draft?.params,
1912
+ fields: t.draft?.fields
1913
+ }, `data-workbench-preview-json:${t.scrollScope}:${t.preview.tab}`));
1914
+ else {
1915
+ let n = t.preview.tab === "response" ? t.preview.rawValue : t.preview.consumerValue;
1916
+ a.appendChild(n === void 0 ? Zt(e, t) : tn(e, n, `data-workbench-preview-value:${t.scrollScope}:${t.preview.tab}`, t.descriptor));
1917
+ }
1918
+ let o = M(t.descriptor, t.draft), s = o > 0 && t.preview.status === "ready" ? (() => {
1919
+ let t = e.createElement("p");
1920
+ return t.className = "designer-data-response-warning", t.setAttribute("role", "status"), t.textContent = y.dataSource.responseWarning(o), t;
1921
+ })() : void 0, c = s === void 0 ? [i, a] : [
1922
+ s,
1923
+ i,
1924
+ a
1925
+ ];
1926
+ return n.appendChild(N({
1927
+ ownerDocument: e,
1928
+ section: "preview",
1929
+ group: "preview",
1930
+ title: y.dataSource.responseTitle,
1931
+ summary: Xt(t),
1932
+ defaultOpen: t.surface === "inspector",
1933
+ overrides: t.groupOpenOverrides,
1934
+ onToggle: t.onToggleGroup
1935
+ }, c)), n;
1936
+ }
1937
+ function Xt(e) {
1938
+ return e.preview.status === "loading" ? y.dataSource.testing : e.preview.status === "error" ? y.dataSource.responseFailed : e.preview.status === "ready" && e.preview.message || y.dataSource.responseIdle;
1939
+ }
1940
+ function Zt(e, t) {
1941
+ let n = e.createElement("div");
1942
+ n.className = "designer-data-preview-empty";
1943
+ let r = e.createElement("div"), i = e.createElement("span");
1944
+ i.className = "designer-data-preview-empty-icon", i.setAttribute("aria-hidden", "true"), i.innerHTML = d("table");
1945
+ let a = e.createElement("strong");
1946
+ a.textContent = y.dataSource.previewIdle;
1947
+ let o = e.createElement("p");
1948
+ o.textContent = y.dataSource.previewIdleHint, r.append(i, a, o);
1949
+ let s = Qt(t);
1950
+ if (s !== "") {
1951
+ let t = e.createElement("span");
1952
+ t.className = "designer-data-preview-empty-params", t.dataset.datasetParamSummary = "true", t.textContent = s, t.title = s, r.appendChild(t);
1953
+ }
1954
+ return n.appendChild(r), n;
1955
+ }
1956
+ function Qt(e) {
1957
+ let t = e.descriptor, n = e.draft;
1958
+ return t === void 0 || n === void 0 ? "" : t.parameters.map((t) => {
1959
+ let r = n.params[t.name];
1960
+ return r === void 0 ? y.dataSource.parameterUnfilledShort : r.kind === "variable" ? e.variables.find((e) => e.id === r.variableId)?.name ?? y.dataSource.parameterUnfilledShort : r.kind === "inline" ? String(r.value ?? "") : t.label;
1961
+ }).join(" · ");
1962
+ }
1963
+ function $t(e) {
1964
+ let t = e.createElement("div");
1965
+ t.className = "designer-data-preview-skeleton", t.setAttribute("aria-label", y.dataSource.previewLoading);
1966
+ for (let n = 0; n < 5; n += 1) {
1967
+ let n = e.createElement("div");
1968
+ n.className = "designer-data-preview-skeleton-row";
1969
+ for (let t of [
1970
+ "1.35fr",
1971
+ "0.8fr",
1972
+ "0.55fr"
1973
+ ]) {
1974
+ let r = e.createElement("span");
1975
+ r.style.gridColumn = t, n.appendChild(r);
1976
+ }
1977
+ t.appendChild(n);
1978
+ }
1979
+ return t;
1980
+ }
1981
+ function en(e, t) {
1982
+ let n = e.createElement("div");
1983
+ n.className = "designer-data-preview-error", n.setAttribute("role", "alert"), n.dataset.datasetPreviewError = "true";
1984
+ let r = e.createElement("strong");
1985
+ r.textContent = y.dataSource.responseFailed;
1986
+ let i = e.createElement("p");
1987
+ return i.textContent = t, n.append(r, i), n;
1988
+ }
1989
+ function tn(e, t, n, r) {
1990
+ let i = sn(t);
1991
+ if (i === void 0) return ln(e, t, n);
1992
+ let a = e.createElement("div");
1993
+ a.className = "designer-data-preview-table-wrap", a.dataset.designerScrollScope = n;
1994
+ let o = e.createElement("table"), s = [...new Set(i.flatMap((e) => Object.keys(e)))].slice(0, 12), c = i.slice(0, 20), l = e.createElement("thead"), u = e.createElement("tr"), d = e.createElement("th");
1995
+ d.className = "designer-data-preview-index", d.scope = "col", d.textContent = "#", u.appendChild(d);
1996
+ for (let t of s) {
1997
+ let n = e.createElement("th");
1998
+ n.scope = "col", n.textContent = nn(r, t), rn(r, t, c) && (n.className = "designer-data-preview-num"), u.appendChild(n);
1999
+ }
2000
+ l.appendChild(u);
2001
+ let f = e.createElement("tbody");
2002
+ for (let [t, n] of c.entries()) {
2003
+ let i = e.createElement("tr"), a = e.createElement("td");
2004
+ a.className = "designer-data-preview-index", a.textContent = String(t + 1).padStart(2, "0"), i.appendChild(a);
2005
+ for (let t of s) {
2006
+ let a = e.createElement("td"), o = n[t];
2007
+ a.textContent = an(o);
2008
+ let s = a.textContent;
2009
+ s !== "—" && (a.title = s), rn(r, t, c) && (a.className = "designer-data-preview-num"), i.appendChild(a);
2010
+ }
2011
+ f.appendChild(i);
2012
+ }
2013
+ return o.append(l, f), a.appendChild(o), a;
2014
+ }
2015
+ function nn(e, t) {
2016
+ return e?.fields.find((e) => e.id === t)?.label ?? t;
2017
+ }
2018
+ function rn(e, t, n) {
2019
+ let r = e?.fields.find((e) => e.id === t);
2020
+ if (r !== void 0) return r.valueType === "number";
2021
+ let i = n.map((e) => e[t]).filter((e) => e !== void 0);
2022
+ return i.length > 0 && i.every((e) => typeof e == "number");
2023
+ }
2024
+ function an(e) {
2025
+ return e == null || e === "" ? "—" : typeof e == "number" ? on(e) : typeof e == "string" ? e : JSON.stringify(e);
2026
+ }
2027
+ function on(e) {
2028
+ let [t = "", n] = String(e).split("."), r = t.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
2029
+ return n === void 0 ? r : `${r}.${n}`;
2030
+ }
2031
+ function sn(e) {
2032
+ if (Array.isArray(e) && e.every(cn)) return e;
2033
+ if (cn(e) && Array.isArray(e.rows) && e.rows.every(cn)) return e.rows;
2034
+ }
2035
+ function cn(e) {
2036
+ return typeof e == "object" && !!e && !Array.isArray(e);
2037
+ }
2038
+ function ln(e, t, n) {
2039
+ let r = e.createElement("pre");
2040
+ return r.dataset.designerScrollScope = n, r.textContent = JSON.stringify(t, null, 2), r;
2041
+ }
2042
+ //#endregion
2043
+ //#region src/browser/dom/dataset/designer-dataset-sections.ts
2044
+ function un(e) {
2045
+ let t = e.descriptor;
2046
+ if (t !== void 0) return {
2047
+ panel: e.panel,
2048
+ descriptor: t,
2049
+ draft: e.draft,
2050
+ roles: e.roles,
2051
+ variables: e.variables,
2052
+ resourceAvailable: e.resourceAvailable,
2053
+ bindingOpenRoleId: e.bindingOpenRoleId ?? null,
2054
+ includeActions: !1,
2055
+ overlayHost: e.overlayHost,
2056
+ onSelectParameter: e.onSelectParameter,
2057
+ link: e.link,
2058
+ surface: e.surface,
2059
+ instance: e.instance,
2060
+ instances: e.datasetInstances,
2061
+ selectedInstanceId: e.selectedDatasetInstanceId,
2062
+ groupOpenOverrides: e.groupOpenOverrides,
2063
+ onToggleGroup: e.onToggleGroup
2064
+ };
2065
+ }
2066
+ function R(e, t) {
2067
+ if (e === "value") return;
2068
+ if (e === "host-link") return et(t);
2069
+ if (e === "preview") return Yt(t.panel.ownerDocument, t);
2070
+ if (e === "authoring") return Ht(t);
2071
+ if (t.surface === "inspector") {
2072
+ if (t.descriptor === void 0) return ct(t);
2073
+ } else if (t.catalogOpen || t.descriptor === void 0) return lt(t);
2074
+ let n = un(t);
2075
+ return n === void 0 ? void 0 : jt(n);
2076
+ }
2077
+ //#endregion
2078
+ //#region src/browser/dom/dataset/designer-data-section-diff.ts
2079
+ function dn(e) {
2080
+ let t = e.dataValue;
2081
+ if (t === null || t.kind !== "data-source-field") return ["value"];
2082
+ let n = ["value", "source"];
2083
+ return (e.surface === "workbench" || fn(e)) && n.push("host-link"), n.push("preview", "authoring"), n;
2084
+ }
2085
+ function fn(e) {
2086
+ return [
2087
+ e.link.catalog,
2088
+ e.link.query,
2089
+ e.link.variables
2090
+ ].some((e) => e.status !== "ready");
2091
+ }
2092
+ function pn(e, t) {
2093
+ switch (e) {
2094
+ case "value": return V([
2095
+ t.mode,
2096
+ t.availableModes,
2097
+ t.resourceAvailable,
2098
+ t.catalogAvailable
2099
+ ]);
2100
+ case "source": return V([
2101
+ (t.groups ?? []).map((e) => [e.id, e.name]),
2102
+ t.groupId ?? null,
2103
+ t.catalogOpen,
2104
+ t.catalogAvailable,
2105
+ t.descriptor?.datasetId ?? null,
2106
+ t.draft ?? null,
2107
+ t.bindingOpenRoleId ?? null,
2108
+ t.roles.map((e) => [
2109
+ e.id,
2110
+ e.minFields,
2111
+ e.maxFields,
2112
+ e.valueTypes
2113
+ ]),
2114
+ t.variables.map((e) => [e.id, e.name]),
2115
+ t.catalogOpen ? "catalog" : [
2116
+ t.link.catalog.status,
2117
+ t.link.query.status,
2118
+ t.link.variables.status
2119
+ ]
2120
+ ]);
2121
+ case "preview": return V([
2122
+ t.preview.status,
2123
+ t.preview.tab,
2124
+ t.preview.open,
2125
+ t.preview.message,
2126
+ xn(t)
2127
+ ]);
2128
+ case "authoring": return V([
2129
+ t.authoring,
2130
+ t.dirty,
2131
+ t.surface
2132
+ ]);
2133
+ default: return V([
2134
+ t.link.catalog.status,
2135
+ t.link.query.status,
2136
+ t.link.variables.status,
2137
+ t.link.catalog.detail ?? null,
2138
+ t.link.query.detail ?? null,
2139
+ t.link.variables.detail ?? null
2140
+ ]);
2141
+ }
2142
+ }
2143
+ function mn(e, t) {
2144
+ if (e.querySelector("[data-ds-section]") === null) return;
2145
+ let n = dn(t), r = gn(e, n), i = bn(e, n), a = null;
2146
+ for (let r = n.length - 1; r >= 0; r--) {
2147
+ let o = n[r], s = z(e, o), c = pn(o, t);
2148
+ if (o === "value") {
2149
+ s !== null && (s.dataset.dsContentKey = c, B(s), a = s);
2150
+ continue;
2151
+ }
2152
+ if (s === null) {
2153
+ let e = R(o, t);
2154
+ e !== void 0 && (e.dataset.dsContentKey = c, B(e), i.insertBefore(e, a), a = e);
2155
+ continue;
2156
+ }
2157
+ if (s.dataset.dsContentKey !== c) {
2158
+ let e = R(o, t);
2159
+ if (e !== void 0) {
2160
+ e.dataset.dsContentKey = c, B(e), Tt(s), s.replaceWith(e), a = e;
2161
+ continue;
2162
+ }
2163
+ s.dataset.dsContentKey = c;
2164
+ }
2165
+ a = s;
2166
+ }
2167
+ for (let t of [...e.querySelectorAll("[data-ds-section]")]) {
2168
+ let e = t.dataset.dsSection;
2169
+ e !== void 0 && n.includes(e) || (Tt(t), t.remove());
2170
+ }
2171
+ _n(e, r, n);
2172
+ }
2173
+ function hn(e, t) {
2174
+ for (let n of e.querySelectorAll("[data-ds-section]")) {
2175
+ let e = n.dataset.dsSection;
2176
+ e !== void 0 && (n.dataset.dsContentKey = pn(e, t), B(n));
2177
+ }
2178
+ }
2179
+ function gn(e, t) {
2180
+ let n = e.ownerDocument, r = n?.activeElement;
2181
+ if (r == null || r === n?.body || !e.contains(r)) return {
2182
+ section: void 0,
2183
+ control: void 0,
2184
+ index: -1,
2185
+ insideRoot: !1
2186
+ };
2187
+ let i = r.closest("[data-ds-section]")?.dataset.dsSection;
2188
+ return {
2189
+ section: i,
2190
+ control: yn(r),
2191
+ index: i === void 0 ? -1 : t.indexOf(i),
2192
+ insideRoot: !0
2193
+ };
2194
+ }
2195
+ function _n(e, t, n) {
2196
+ if (!t.insideRoot) return;
2197
+ let r = [...e.querySelectorAll("[data-ds-section]")];
2198
+ if (r.length === 0) return;
2199
+ if (t.section !== void 0 && t.control !== void 0) {
2200
+ let n = vn(e, t.section, t.control);
2201
+ if (n !== null) {
2202
+ n.focus();
2203
+ return;
2204
+ }
2205
+ }
2206
+ if (t.section !== void 0) {
2207
+ let n = z(e, t.section);
2208
+ if (n !== null) {
2209
+ let e = n.querySelector("[data-ds-focusable]");
2210
+ if (e !== null) {
2211
+ e.focus();
2212
+ return;
2213
+ }
2214
+ n.tabIndex = -1, n.focus();
2215
+ return;
2216
+ }
2217
+ }
2218
+ let i = t.index >= 0 ? t.index : Math.min(n.length - 1, 0), a = r[Math.min(i, r.length - 1)];
2219
+ if (a !== void 0) {
2220
+ a.tabIndex = -1, a.focus();
2221
+ return;
2222
+ }
2223
+ e.tabIndex = -1, e.focus();
2224
+ }
2225
+ function z(e, t) {
2226
+ return e.querySelector(`[data-ds-section="${t}"]`);
2227
+ }
2228
+ function vn(e, t, n) {
2229
+ let r = z(e, t);
2230
+ if (r === null) return null;
2231
+ for (let e of r.querySelectorAll("button, input, select, textarea, [tabindex]")) if (yn(e) === n) return e;
2232
+ return null;
2233
+ }
2234
+ function yn(e) {
2235
+ let t = e.dataset.dsControl;
2236
+ return t === void 0 ? e.dataset.datasetAction ?? e.dataset.datasetPreviewTab ?? e.dataset.datasetParameter ?? e.dataset.datasetBindingTrigger ?? e.dataset.datasetBindingRole ?? e.dataset.datasetEditorMode ?? e.dataset.datasetAuthoringAction ?? e.dataset.dataSourceModeSelect ?? void 0 : t;
2237
+ }
2238
+ function B(e) {
2239
+ for (let t of e.querySelectorAll("button, input, select, textarea, [tabindex]")) t.dataset.dsFocusable = "true";
2240
+ e.tabIndex = -1;
2241
+ }
2242
+ function bn(e, t) {
2243
+ for (let n of t) {
2244
+ let t = z(e, n);
2245
+ if (t?.parentElement != null) return t.parentElement;
2246
+ }
2247
+ return e.querySelector(".designer-inspector-data-flow-content") ?? e;
2248
+ }
2249
+ function xn(e) {
2250
+ let t = e.preview.rawValue;
2251
+ if (typeof t != "object" || !t || Array.isArray(t)) return t === void 0 ? "none" : "scalar";
2252
+ let n = t.rows, r = t.fields;
2253
+ return `${Array.isArray(n) ? n.length : 0}:${Array.isArray(r) ? r.length : 0}`;
2254
+ }
2255
+ function V(e) {
2256
+ if (e === null) return "null";
2257
+ if (Array.isArray(e)) return `[${e.map(V).join(",")}]`;
2258
+ if (typeof e == "object") {
2259
+ let t = e;
2260
+ return `{${Object.keys(t).sort().map((e) => `${JSON.stringify(e)}:${V(t[e])}`).join(",")}}`;
2261
+ }
2262
+ return JSON.stringify(e) ?? "undefined";
2263
+ }
2264
+ //#endregion
2265
+ //#region src/browser/dom/dataset/designer-data-state.ts
2266
+ function Sn(e) {
2267
+ return e.configured ? e.unavailable === void 0 ? e.readonly === void 0 ? e.loading === !0 ? { state: "loading" } : e.failure === void 0 ? e.empty === !0 ? { state: "empty" } : { state: "ready" } : {
2268
+ state: "failed",
2269
+ diagnosticCode: e.failure
2270
+ } : {
2271
+ state: "readonly",
2272
+ reason: e.readonly
2273
+ } : {
2274
+ state: "unavailable",
2275
+ reason: e.unavailable
2276
+ } : { state: "unconfigured" };
2277
+ }
2278
+ function Cn(e, t) {
2279
+ let n = e.dataset;
2280
+ n !== void 0 && (n.state = t.state, t.reason === void 0 ? delete n.stateReason : n.stateReason = t.reason);
2281
+ }
2282
+ //#endregion
2283
+ //#region src/browser/dom/static-data/designer-static-data-controls.ts
2284
+ function wn(e, t) {
2285
+ let n = t.descriptor;
2286
+ if (n?.kind !== "scalar") return o(e, { label: "" }).field;
2287
+ let i = n.valueType === "string" ? y.dataSource.staticScalarString : n.valueType === "number" ? y.dataSource.staticScalarNumber : y.dataSource.staticScalarBoolean;
2288
+ if (n.valueType === "boolean") {
2289
+ let a = r(e, { label: i }), o = g(e, {
2290
+ ariaLabel: i,
2291
+ checked: t.value === !0
2292
+ });
2293
+ return o.dataset.staticScalar = n.valueType, a.appendChild(o), a;
2294
+ }
2295
+ let a = n.valueType === "string" && n.multiline === !0, s = o(e, {
2296
+ label: i,
2297
+ ...a ? {
2298
+ tagName: "span",
2299
+ stacked: !0
2300
+ } : {}
2301
+ }), l = a ? u(e, {
2302
+ ariaLabel: i,
2303
+ value: String(t.value ?? "")
2304
+ }) : c(e, {
2305
+ ariaLabel: i,
2306
+ type: n.valueType === "number" ? "number" : "text",
2307
+ value: String(t.value ?? "")
2308
+ });
2309
+ return l.dataset.staticScalar = n.valueType, s.control.appendChild(l), s.field;
2310
+ }
2311
+ function Tn(e, t) {
2312
+ let n = o(e, {
2313
+ label: y.dataSource.staticValue,
2314
+ tagName: "span",
2315
+ stacked: !0,
2316
+ className: "designer-data-source-static"
2317
+ }), r = u(e, {
2318
+ ariaLabel: y.dataSource.staticValue,
2319
+ value: t
2320
+ });
2321
+ return r.dataset.dataSourceStatic = "true", n.control.appendChild(r), n.field;
2322
+ }
2323
+ function En(e, t, n, r) {
2324
+ let i = H(e, `tab-${t}`, n);
2325
+ return i.setAttribute("aria-pressed", String(r)), i;
2326
+ }
2327
+ function H(e, t, n, r) {
2328
+ let i = m(e, {
2329
+ text: n,
2330
+ ...r === void 0 ? {} : { variant: r }
2331
+ });
2332
+ return i.dataset.staticAction = t, i;
2333
+ }
2334
+ function Dn(e, t, n, r) {
2335
+ let i = f(e, {
2336
+ className: "designer-static-page-button",
2337
+ icon: r,
2338
+ label: n
2339
+ });
2340
+ return i.dataset.staticAction = t, i;
2341
+ }
2342
+ function On(e, t, n, r) {
2343
+ let i = H(e, t, r);
2344
+ return i.dataset.staticIndex = String(n), i;
2345
+ }
2346
+ function kn(e, t, n, r, i = !1) {
2347
+ let a = H(e, `binding-${n}`, r);
2348
+ return a.dataset.staticBindingRole = t, a.disabled = i, a;
2349
+ }
2350
+ function An(e, t) {
2351
+ if (t === void 0) return y.dataset.bindingNone;
2352
+ let n = e.roles.flatMap((n) => {
2353
+ let r = e.binding?.fields[n.id] ?? [];
2354
+ return r.length === 0 ? [] : [`${y.dataset.bindingRole(n.id)}:${r.map((e) => t.fields.find((t) => t.id === e)?.label ?? e).join("、")}`];
2355
+ });
2356
+ return n.length === 0 ? y.dataset.bindingNone : n.join(";");
2357
+ }
2358
+ //#endregion
2359
+ //#region src/browser/dom/static-data/designer-static-data-table-dom.ts
2360
+ function jn(e, t, n) {
2361
+ let r = e.createElement("section");
2362
+ r.className = "designer-static-bindings";
2363
+ for (let i of t.roles) {
2364
+ let a = e.createElement("div");
2365
+ a.className = "designer-dataset-binding-role", a.dataset.staticBindingRoleContainer = i.id;
2366
+ let o = e.createElement("div");
2367
+ o.className = "designer-dataset-binding-heading";
2368
+ let s = e.createElement("strong");
2369
+ s.textContent = y.dataset.bindingRole(i.id);
2370
+ let c = t.binding?.fields[i.id] ?? [], l = e.createElement("span");
2371
+ l.textContent = y.dataset.selectedFields(c.length), o.append(s, l);
2372
+ let u = n.fields.filter((e) => i.valueTypes.includes(e.valueType)), d = e.createElement("p");
2373
+ d.className = "designer-dataset-binding-hint", d.textContent = y.dataset.bindingHint(i.minFields, i.maxFields);
2374
+ let f = e.createElement("div");
2375
+ if (f.className = "designer-dataset-field-list", f.setAttribute("role", "group"), f.setAttribute("aria-label", y.dataset.bindingRole(i.id)), i.maxFields === 1) {
2376
+ let t = _(e, {
2377
+ ariaLabel: y.dataset.bindingRole(i.id),
2378
+ className: "designer-dataset-binding-select",
2379
+ options: [{
2380
+ label: y.dataset.selectField,
2381
+ selected: c.length === 0,
2382
+ value: ""
2383
+ }, ...u.map((e) => ({
2384
+ label: `${e.label} · ${e.valueType}`,
2385
+ selected: c.includes(e.id),
2386
+ value: e.id
2387
+ }))],
2388
+ value: c[0] ?? ""
2389
+ });
2390
+ t.dataset.staticBindingRole = i.id, f.appendChild(p(t).element);
2391
+ } else {
2392
+ let t = e.createElement("div");
2393
+ t.className = "designer-dataset-binding-role-actions", t.append(kn(e, i.id, "select-all", u.length > i.maxFields ? y.dataset.bindingSelectMaximum : y.dataset.bindingSelectAll, c.length === Math.min(u.length, i.maxFields)), kn(e, i.id, "clear", y.dataset.bindingClear, c.length === 0)), o.appendChild(t);
2394
+ for (let t of u) f.appendChild(Mn(e, i.id, t, c, i.maxFields));
2395
+ }
2396
+ if (u.length === 0) {
2397
+ let t = e.createElement("p");
2398
+ t.className = "designer-empty-state", t.textContent = y.dataset.noCompatibleFields, f.appendChild(t);
2399
+ }
2400
+ a.append(o, d, f), r.appendChild(a);
2401
+ }
2402
+ return r;
2403
+ }
2404
+ function Mn(e, t, n, r, i) {
2405
+ let a = r.includes(n.id), o = e.createElement("button");
2406
+ o.type = "button", o.className = "designer-dataset-field-option", o.dataset.staticBindingRole = t, o.dataset.staticBindingField = n.id, o.setAttribute("aria-pressed", String(a)), o.disabled = !a && r.length >= i;
2407
+ let s = e.createElement("span");
2408
+ s.className = "designer-field-label-text", s.textContent = n.label;
2409
+ let c = e.createElement("small");
2410
+ return c.textContent = n.valueType, o.append(s, c), o;
2411
+ }
2412
+ function Nn(e, t, n, r, i) {
2413
+ let a = e.createElement("section");
2414
+ a.className = "designer-static-rows", i !== void 0 && (a.dataset.designerScrollScope = `static-rows:${i}`);
2415
+ let o = e.createElement("h4");
2416
+ o.textContent = y.dataSource.staticRows;
2417
+ let s = e.createElement("table"), l = e.createElement("thead"), u = e.createElement("tr");
2418
+ t.fields.forEach((t) => {
2419
+ let n = e.createElement("th");
2420
+ n.textContent = t.label, u.appendChild(n);
2421
+ }), u.appendChild(e.createElement("th")), l.appendChild(u);
2422
+ let d = e.createElement("tbody"), f = Me(t.rows.length, n, r);
2423
+ t.rows.slice(f.start, f.end).forEach((n, r) => {
2424
+ let i = f.start + r, a = e.createElement("tr");
2425
+ t.fields.forEach((t) => {
2426
+ let r = e.createElement("td"), o = c(e, { value: n[t.id] === null || n[t.id] === void 0 ? "" : String(n[t.id]) });
2427
+ o.dataset.staticCellRow = String(i), o.dataset.staticCellField = t.id, r.appendChild(o), a.appendChild(r);
2428
+ });
2429
+ let o = e.createElement("td");
2430
+ o.appendChild(On(e, "row-remove", i, y.dataSource.staticRemoveRow)), a.appendChild(o), d.appendChild(a);
2431
+ }), s.append(l, d);
2432
+ let p = e.createElement("footer");
2433
+ p.className = "designer-static-rows-footer";
2434
+ let m = e.createElement("nav");
2435
+ m.className = "designer-static-pagination", m.setAttribute("aria-label", y.dataSource.staticPagination);
2436
+ let h = _(e, {
2437
+ ariaLabel: y.dataSource.staticRowsPerPage,
2438
+ options: Ae.map((e) => ({
2439
+ label: y.dataSource.staticRowsPerPageOption(e),
2440
+ selected: e === f.pageSize,
2441
+ value: String(e)
2442
+ })),
2443
+ value: String(f.pageSize)
2444
+ });
2445
+ h.dataset.staticPageSize = "true";
2446
+ let g = e.createElement("span");
2447
+ g.className = "designer-static-page-status", g.textContent = y.dataSource.staticPage(f.page + 1, f.pages);
2448
+ let v = Dn(e, "page-previous", y.dataSource.staticPreviousPage, "chevron-left");
2449
+ v.toggleAttribute("disabled", f.page === 0);
2450
+ let b = Dn(e, "page-next", y.dataSource.staticNextPage, "chevron-right");
2451
+ return b.toggleAttribute("disabled", f.page >= f.pages - 1), m.append(h, v, g, b), p.append(H(e, "row-add", y.dataSource.staticAddRow), m), a.append(o, s, p), a;
2452
+ }
2453
+ //#endregion
2454
+ //#region src/browser/dom/static-data/designer-static-data-dom.ts
2455
+ function Pn(e) {
2456
+ let t = e.ownerDocument, n = t.createElement("section");
2457
+ n.className = "designer-data-source-editor", n.dataset.inspectorSearchSection = "true";
2458
+ let r = t.createElement("h4");
2459
+ if (r.className = "designer-inspector-section-title", r.textContent = y.dataSource.staticTitle, n.appendChild(r), e.descriptor?.kind === "scalar") return n.appendChild(wn(t, e)), n;
2460
+ if (e.descriptor?.kind !== "tabular") return n.appendChild(Tn(t, e.jsonDraft)), n;
2461
+ let i = E(e.value), a = t.createElement("div");
2462
+ if (a.className = "designer-static-data-tabs designer-static-inline-tabs", a.append(En(t, "table", y.dataSource.staticForm, e.tab === "table"), En(t, "advanced", y.dataSource.staticAdvanced, e.tab === "advanced")), n.appendChild(a), e.tab === "advanced" || !i.ok) n.appendChild(Tn(t, e.jsonDraft));
2463
+ else {
2464
+ let r = t.createElement("div");
2465
+ r.className = "designer-static-tabular-summary";
2466
+ let a = t.createElement("strong");
2467
+ a.textContent = y.dataSource.staticTabularSummary(i.value.fields.length, i.value.rows.length);
2468
+ let o = t.createElement("small");
2469
+ o.textContent = An(e, i.value), r.append(a, o), n.append(r, Nn(t, i.value, e.page, e.pageSize, e.scrollScope));
2470
+ }
2471
+ return n;
2472
+ }
2473
+ function Fn(e) {
2474
+ let t = e.ownerDocument.createElement("section");
2475
+ t.className = "designer-data-source-editor designer-static-inline-mapping", t.dataset.inspectorSearchSection = "true";
2476
+ let n = e.ownerDocument.createElement("h4");
2477
+ n.className = "designer-inspector-section-title", n.textContent = y.dataSource.mappingStep;
2478
+ let r = E(e.value);
2479
+ if (t.appendChild(n), !r.ok) {
2480
+ let n = e.ownerDocument.createElement("p");
2481
+ return n.className = "designer-empty-state", n.textContent = y.dataSource.staticInvalid, t.appendChild(n), t;
2482
+ }
2483
+ return t.appendChild(jn(e.ownerDocument, e, r.value)), t;
2484
+ }
2485
+ function In(e) {
2486
+ let t = e.ownerDocument.createElement("aside");
2487
+ t.className = "designer-data-workbench-preview designer-static-inline-preview", t.dataset.workbenchSection = "preview";
2488
+ let n = e.ownerDocument.createElement("header"), r = e.ownerDocument.createElement("h4");
2489
+ r.textContent = y.dataSource.responseTitle;
2490
+ let i = E(e.value), a = e.ownerDocument.createElement("span");
2491
+ a.dataset.status = i.ok ? "ready" : "error", a.textContent = i.ok ? y.dataSource.staticTabularSummary(i.value.fields.length, i.value.rows.length) : y.dataSource.staticInvalid, n.append(r, a);
2492
+ let o = e.ownerDocument.createElement("pre");
2493
+ return o.dataset.staticPreviewValue = "true", e.scrollScope !== void 0 && (o.dataset.designerScrollScope = `static-preview:${e.scrollScope}`), o.textContent = JSON.stringify(i.ok ? i.value.rows.slice(0, 8) : e.value, null, 2), t.append(n, o), t;
2494
+ }
2495
+ //#endregion
2496
+ //#region src/browser/dom/dataset/designer-data-entry-dom.ts
2497
+ function Ln(e) {
2498
+ if (e === "static") return "inline";
2499
+ if (e === "variable") return "variable";
2500
+ if (e === "dataset" || e === "host-resource") return "source";
2501
+ }
2502
+ function Rn(e) {
2503
+ let t = Ln(e.mode);
2504
+ return [
2505
+ zn(e, "inline", "static", t),
2506
+ zn(e, "variable", "variable", t),
2507
+ Bn(e, t)
2508
+ ];
2509
+ }
2510
+ function zn(e, t, n, r) {
2511
+ let i = e.availableModes.includes(n);
2512
+ return {
2513
+ entry: t,
2514
+ mode: n,
2515
+ selected: r === t,
2516
+ disabled: !i,
2517
+ ...i ? {} : { reason: Vn(t).disabled }
2518
+ };
2519
+ }
2520
+ function Bn(e, t) {
2521
+ let n = e.availableModes.includes("dataset"), r = e.availableModes.includes("host-resource"), i = y.data.entry.source;
2522
+ if (!n && !r) return {
2523
+ entry: "source",
2524
+ mode: "dataset",
2525
+ selected: t === "source",
2526
+ disabled: !0,
2527
+ reason: i.disabled
2528
+ };
2529
+ let a = n ? "dataset" : "host-resource", o = a === "dataset" && !e.resourceAvailable;
2530
+ return {
2531
+ entry: "source",
2532
+ mode: a,
2533
+ selected: t === "source",
2534
+ disabled: o,
2535
+ ...o ? { reason: i.portMissing } : {}
2536
+ };
2537
+ }
2538
+ function Vn(e) {
2539
+ return e === "inline" ? y.data.entry.inline : e === "variable" ? y.data.entry.variable : y.data.entry.source;
2540
+ }
2541
+ function Hn(e) {
2542
+ return [
2543
+ y.data.entry.legend,
2544
+ y.data.panel.emptyTitle,
2545
+ ...e.map((e) => {
2546
+ let t = Vn(e.entry);
2547
+ return `${t.title} ${t.description} ${e.reason ?? t.disabled}`;
2548
+ })
2549
+ ].join(" ");
2550
+ }
2551
+ function Un(e) {
2552
+ return e === "none" ? "empty" : "configured";
2553
+ }
2554
+ function Wn(e, t) {
2555
+ let n = e.createElement("div");
2556
+ n.className = "designer-data-entry-guide", n.dataset.dataEntryGroup = "true", n.dataset.dataEntryLayout = "empty", n.setAttribute("role", "radiogroup"), n.setAttribute("aria-label", y.data.panel.emptyTitle);
2557
+ for (let r of t) n.appendChild(Gn(e, r));
2558
+ return n;
2559
+ }
2560
+ function Gn(e, t) {
2561
+ let n = Vn(t.entry), r = e.createElement("button");
2562
+ r.type = "button", r.className = "designer-data-entry-guide-row", r.dataset.dataEntry = t.entry, r.dataset.dataEntryMode = t.mode, r.dataset.dsControl = `data-entry:${t.entry}`, r.setAttribute("role", "radio"), r.setAttribute("aria-checked", String(t.selected)), r.tabIndex = t.disabled ? -1 : 0, t.selected && (r.dataset.datasetMode = t.mode), t.disabled && (r.disabled = !0, r.setAttribute("aria-disabled", "true"));
2563
+ let i = e.createElement("span");
2564
+ i.className = "designer-data-entry-guide-title", i.textContent = n.title;
2565
+ let a = e.createElement("span");
2566
+ a.className = "designer-data-entry-guide-copy";
2567
+ let o = e.createElement("span");
2568
+ if (o.className = "designer-data-entry-guide-description", o.textContent = n.description, a.appendChild(o), t.disabled && t.reason !== void 0) {
2569
+ let n = e.createElement("span");
2570
+ n.className = "designer-data-entry-guide-reason", n.textContent = t.reason, a.appendChild(n);
2571
+ }
2572
+ if (r.append(i, a), !t.disabled) {
2573
+ let t = e.createElement("span");
2574
+ t.className = "designer-data-entry-guide-disclosure", t.setAttribute("aria-hidden", "true"), t.innerHTML = d("chevron-right"), r.appendChild(t);
2575
+ }
2576
+ return r;
2577
+ }
2578
+ //#endregion
2579
+ //#region src/browser/dom/dataset/designer-dataset-primitives.ts
2580
+ function U(e, t, n, r, i = !1) {
2581
+ let a = m(e, {
2582
+ disabled: i,
2583
+ text: n
2584
+ });
2585
+ return a.dataset.datasetAction = t, r !== void 0 && (a.dataset.variant = r), a;
2586
+ }
2587
+ function Kn(e, t) {
2588
+ let n = e.createElement("div");
2589
+ n.className = "designer-dataset-actions designer-dataset-status-bar", n.dataset.datasetStatusBar = "true";
2590
+ let r = e.createElement("span");
2591
+ r.className = "designer-dataset-status", r.dataset.datasetStatus = "true", r.dataset.state = t.state, r.setAttribute("role", "status"), r.setAttribute("aria-live", "polite");
2592
+ let i = e.createElement("i");
2593
+ i.className = "designer-dataset-status-dot", i.dataset.state = t.state, i.setAttribute("aria-hidden", "true");
2594
+ let a = e.createElement("span");
2595
+ a.dataset.datasetStatusText = "true", a.textContent = t.text, r.append(i, a);
2596
+ let o = m(e, {
2597
+ className: "designer-dataset-undo",
2598
+ text: y.dataSource.undo
2599
+ });
2600
+ o.dataset.datasetAction = "undo", o.hidden = !t.canUndo, o.disabled = !t.canUndo;
2601
+ let s = m(e, {
2602
+ disabled: t.actionDisabled,
2603
+ text: t.actionLabel
2604
+ });
2605
+ return s.dataset.datasetAction = t.action, s.dataset.variant = "request", n.append(r, o, s), n;
2606
+ }
2607
+ function qn(e, t) {
2608
+ for (let n of e.querySelectorAll("[data-dataset-status-bar]")) {
2609
+ let e = n.querySelector("[data-dataset-status]");
2610
+ e !== null && (e.dataset.state = t.state);
2611
+ let r = n.querySelector(".designer-dataset-status-dot");
2612
+ r !== null && (r.dataset.state = t.state);
2613
+ let i = n.querySelector("[data-dataset-status-text]");
2614
+ i !== null && (i.textContent = t.text);
2615
+ let a = n.querySelector("[data-dataset-action=\"undo\"]");
2616
+ a !== null && (a.hidden = !t.canUndo, a.disabled = !t.canUndo);
2617
+ let o = n.querySelector("[data-dataset-action=\"test\"], [data-dataset-action=\"sync\"], [data-dataset-action=\"apply\"]");
2618
+ o !== null && (o.dataset.datasetAction = t.action, o.textContent = t.actionLabel, o.disabled = t.actionDisabled);
2619
+ }
2620
+ }
2621
+ function Jn(e, t) {
2622
+ for (let n of e.querySelectorAll("[data-dataset-apply-bar]")) Yn(n.ownerDocument, n, t);
2623
+ }
2624
+ function Yn(e, t, n) {
2625
+ if (t.replaceChildren(), n.dirty) {
2626
+ let n = e.createElement("span");
2627
+ n.className = "designer-dataset-apply-dirty", n.dataset.datasetApplyDirty = "true", n.append(Xn(e), Zn(e)), t.appendChild(n);
2628
+ }
2629
+ t.appendChild(Qn(e, n));
2630
+ }
2631
+ function Xn(e) {
2632
+ let t = e.createElement("i");
2633
+ return t.className = "designer-dataset-apply-dirty-dot", t.setAttribute("aria-hidden", "true"), t;
2634
+ }
2635
+ function Zn(e) {
2636
+ let t = e.createElement("span");
2637
+ return t.textContent = y.data.panel.dirty, t;
2638
+ }
2639
+ function Qn(e, t) {
2640
+ let n = m(e, {
2641
+ disabled: t.disabled,
2642
+ text: t.label
2643
+ });
2644
+ return n.dataset.datasetAction = "apply", n.dataset.variant = "apply", n.dataset.state = t.dirty ? "dirty" : "applied", n;
2645
+ }
2646
+ function $n(e) {
2647
+ let t = e.dirty;
2648
+ return {
2649
+ label: t ? y.data.panel.apply : y.data.panel.applied,
2650
+ disabled: !t || e.blocked,
2651
+ dirty: t
2652
+ };
2653
+ }
2654
+ //#endregion
2655
+ //#region src/browser/dom/dataset/designer-dataset-flow-dom.ts
2656
+ function er(e) {
2657
+ let t = e.panel.ownerDocument, n = t.createElement("section");
2658
+ n.className = "designer-data-source-type", n.dataset.dsSection = "value", n.tabIndex = -1;
2659
+ let r = Rn({
2660
+ mode: e.mode,
2661
+ availableModes: e.availableModes,
2662
+ resourceAvailable: e.resourceAvailable
2663
+ });
2664
+ n.dataset.inspectorSearchSection = "true", n.dataset.inspectorSearchText = Hn(r);
2665
+ let i = Un(e.mode);
2666
+ if (n.dataset.dataEntryLayout = i, i === "empty") {
2667
+ n.dataset.workbenchSection = "source";
2668
+ let e = t.createElement("h3");
2669
+ e.className = "designer-inspector-section-title", e.textContent = y.data.panel.emptyTitle;
2670
+ let i = t.createElement("p");
2671
+ return i.className = "designer-data-entry-hint", i.textContent = y.data.panel.emptyHint, n.append(e, Wn(t, r), i), n;
2672
+ }
2673
+ let a = tr(t, e);
2674
+ return a === null ? (n.dataset.inspectorSearchText = "", n) : (n.dataset.inspectorSearchText = [
2675
+ y.dataSource.sourceBinding,
2676
+ y.dataSource.sourceKind(e.mode),
2677
+ y.dataSource.sourceKindChange
2678
+ ].join(" "), n.appendChild(a), n);
2679
+ }
2680
+ function tr(e, t) {
2681
+ if (t.mode !== "static" && t.mode !== "variable" || rr(t.availableModes).length < 2) return null;
2682
+ let n = e.createElement("div");
2683
+ n.className = "designer-dataset-source-binding", n.dataset.sourceKindRow = "true";
2684
+ let r = e.createElement("span");
2685
+ r.className = "designer-dataset-source-binding-label", r.textContent = y.dataSource.sourceBinding;
2686
+ let i = e.createElement("span");
2687
+ i.className = "designer-dataset-source-binding-value", i.textContent = y.dataSource.sourceKind(t.mode);
2688
+ let a = m(e, {
2689
+ className: "designer-dataset-source-change",
2690
+ size: "compact",
2691
+ text: y.dataSource.sourceKindChange,
2692
+ variant: "ghost"
2693
+ });
2694
+ return a.dataset.sourceKindChange = "true", n.append(r, i, a), n;
2695
+ }
2696
+ var nr = [
2697
+ "static",
2698
+ "variable",
2699
+ "dataset"
2700
+ ];
2701
+ function rr(e) {
2702
+ return nr.filter((t) => e.includes(t));
2703
+ }
2704
+ function ir(e) {
2705
+ return Pn(sr(e));
2706
+ }
2707
+ function ar(e) {
2708
+ if (e.hostResourceSelectionAvailable !== !0) return;
2709
+ let t = m(e.panel.ownerDocument, { text: y.dataSource.hostResourceSelect });
2710
+ return t.dataset.datasetAction = "select-host-resource", t;
2711
+ }
2712
+ function or(e) {
2713
+ let t = e.panel.ownerDocument, n = t.createElement("section");
2714
+ n.className = "designer-data-source-variable";
2715
+ let r = o(t, { label: y.dataset.selectVariable }), i = _(t, {
2716
+ ariaLabel: y.dataset.selectVariable,
2717
+ options: [{
2718
+ label: y.dataset.selectVariable,
2719
+ selected: e.variableSourceId === void 0,
2720
+ value: ""
2721
+ }, ...e.variables.map((t) => ({
2722
+ label: t.name,
2723
+ selected: t.id === e.variableSourceId,
2724
+ value: t.id
2725
+ }))],
2726
+ value: e.variableSourceId ?? ""
2727
+ });
2728
+ return i.dataset.dataVariableSource = "true", r.control.appendChild(p(i).element), n.appendChild(r.field), n;
2729
+ }
2730
+ function sr(e) {
2731
+ return {
2732
+ ownerDocument: e.panel.ownerDocument,
2733
+ descriptor: e.staticDescriptor,
2734
+ value: e.staticValue,
2735
+ binding: e.staticBinding,
2736
+ jsonDraft: e.staticDraft,
2737
+ tab: e.staticTab,
2738
+ page: e.staticPage,
2739
+ pageSize: e.staticPageSize,
2740
+ roles: e.roles,
2741
+ scrollScope: e.scrollScope
2742
+ };
2743
+ }
2744
+ function cr(e) {
2745
+ let t = e.panel.ownerDocument, n = t.createElement("section");
2746
+ if (n.className = "designer-dataset-section designer-inspector-data-flow", n.dataset.datasetSection = "true", n.dataset.dataFlowLayout = "continuous", n.dataset.inspectorSearchSection = "true", e.mode === "host-resource") {
2747
+ let r = t.createElement("div");
2748
+ r.className = "designer-inspector-data-flow-content", r.dataset.designerScrollScope = `data-source:${e.scrollScope}`;
2749
+ let i = t.createElement("p");
2750
+ i.className = "designer-host-resource-summary", i.dataset.hostResourceSummary = "true", i.textContent = e.hostResource === void 0 ? y.dataSource.hostResourceManaged : y.dataSource.hostResourceSummary(e.hostResource.resourceType, e.hostResource.resourceId), r.append(er(e), i);
2751
+ let a = ar(e);
2752
+ return a !== void 0 && r.appendChild(a), n.appendChild(r), n;
2753
+ }
2754
+ n.dataset.activeStep = gr(e.activeStep);
2755
+ let r = t.createElement("div");
2756
+ return r.className = "designer-inspector-data-flow-content", r.dataset.designerScrollScope = `data-source:${e.scrollScope}`, lr(r, e), n.appendChild(r), n;
2757
+ }
2758
+ function lr(e, t) {
2759
+ if (e.appendChild(er(t)), t.mode !== "none") {
2760
+ if (t.mode === "static") {
2761
+ hr(e, t);
2762
+ return;
2763
+ }
2764
+ if (t.mode === "variable") {
2765
+ e.appendChild(or(t)), e.appendChild(Kn(e.ownerDocument, W(t))), dr(e);
2766
+ return;
2767
+ }
2768
+ for (let n of dn(t)) n !== "value" && e.appendChild(fr(n, t));
2769
+ e.appendChild(Kn(e.ownerDocument, W(t))), dr(e);
2770
+ }
2771
+ }
2772
+ function ur(e) {
2773
+ if (e === void 0) return 0;
2774
+ if (Array.isArray(e)) return e.length;
2775
+ if (typeof e == "object" && e) {
2776
+ let t = e.rows;
2777
+ if (Array.isArray(t)) return t.length;
2778
+ }
2779
+ return e === null ? 0 : 1;
2780
+ }
2781
+ function W(e) {
2782
+ if (e.mode !== "dataset") return {
2783
+ state: e.dirty ? "dirty" : "synced",
2784
+ text: e.dirty ? y.dataSource.draft : y.dataSource.synced,
2785
+ action: "apply",
2786
+ actionLabel: e.dirty ? y.data.panel.apply : y.data.panel.applied,
2787
+ actionDisabled: !e.dirty,
2788
+ canUndo: e.canUndo === !0
2789
+ };
2790
+ let t = M(e.descriptor, e.draft), n = e.preview.status === "loading", r = e.preview.status === "ready", i = e.preview.status === "error", a = n || t > 0 || e.descriptor === void 0 || !e.resourceAvailable, o, s, c, l = "test";
2791
+ return n ? (o = "loading", s = y.dataSource.testing, c = y.dataSource.testing) : t > 0 ? (o = "invalid", s = y.dataSource.parametersUnfilled(t), c = y.dataSource.test) : i ? (o = "error", s = y.dataSource.responseFailed, c = y.dataSource.retry) : r ? (o = "ready", s = y.dataSource.syncedRows(ur(e.preview.rawValue)), c = y.dataset.refresh) : e.dirty ? (o = "dirty", s = y.dataSource.draft, l = "sync", c = y.dataSource.sync) : (o = "synced", s = y.dataSource.synced, c = y.dataSource.test), {
2792
+ state: o,
2793
+ text: s,
2794
+ actionLabel: c,
2795
+ actionDisabled: a,
2796
+ action: l,
2797
+ canUndo: e.canUndo === !0
2798
+ };
2799
+ }
2800
+ function dr(e) {
2801
+ let t = e.querySelector(".designer-dataset-actions");
2802
+ if (t === null) return;
2803
+ let n = () => {
2804
+ let n = t.getBoundingClientRect().height;
2805
+ if (n <= 0) return !1;
2806
+ if (e.style.paddingBottom = "0", e.querySelector(".designer-dataset-actions-spacer")?.remove(), e.scrollHeight > e.clientHeight + 1) {
2807
+ let r = e.ownerDocument.createElement("div");
2808
+ r.className = "designer-dataset-actions-spacer", r.style.height = `${Math.ceil(n)}px`, r.setAttribute("aria-hidden", "true"), t.after(r);
2809
+ }
2810
+ return !0;
2811
+ }, r = 0, i = () => {
2812
+ n() || (r += 1, r < 20 && typeof requestAnimationFrame == "function" && requestAnimationFrame(i));
2813
+ };
2814
+ if (typeof requestAnimationFrame == "function" ? requestAnimationFrame(i) : n(), typeof ResizeObserver == "function") {
2815
+ let e = new ResizeObserver(() => n());
2816
+ e.observe(t), t.addEventListener("DOMNodeRemovedFromDocument", () => e.disconnect(), { once: !0 }), t.isConnected || e.disconnect();
2817
+ }
2818
+ }
2819
+ function fr(e, t) {
2820
+ let n = mr(e, t);
2821
+ if (e === "authoring") {
2822
+ n.classList.add("designer-inspector-advanced-settings"), n.dataset.workbenchSection = "refresh", n.tabIndex = -1;
2823
+ let e = n.querySelector(".designer-inspector-section-title");
2824
+ e !== null && (e.textContent = y.dataSource.advancedSettings);
2825
+ }
2826
+ return n;
2827
+ }
2828
+ function pr(e) {
2829
+ let t = e.descriptor, n = e.mode === "dataset" && t !== void 0 ? !e.resourceAvailable || !$e(t, e.draft, e.roles) : !1;
2830
+ return $n({
2831
+ dirty: e.dirty,
2832
+ blocked: n
2833
+ });
2834
+ }
2835
+ function mr(e, t) {
2836
+ let n = R(e, t);
2837
+ if (n === void 0) throw Error(`DATASET_SECTION_UNAVAILABLE:${e}`);
2838
+ return n;
2839
+ }
2840
+ function hr(e, t) {
2841
+ let n = sr(t);
2842
+ if (e.appendChild(ir(t)), t.staticDescriptor?.kind === "tabular") {
2843
+ let t = Fn(n);
2844
+ t.dataset.workbenchSection = "mapping", t.tabIndex = -1;
2845
+ let r = In(n);
2846
+ r.tabIndex = -1, e.append(t, r);
2847
+ }
2848
+ let r = ar(t);
2849
+ r !== void 0 && e.appendChild(r), e.appendChild(Kn(e.ownerDocument, W(t))), dr(e);
2850
+ }
2851
+ function gr(e) {
2852
+ return e === "mapping" || e === "preview" ? e : "source";
2853
+ }
2854
+ //#endregion
2855
+ //#region src/browser/dom/dataset/designer-source-sheet-dom.ts
2856
+ var _r = [
2857
+ "dataset",
2858
+ "variable",
2859
+ "fixed"
2860
+ ];
2861
+ function vr(e) {
2862
+ let t = e.panel.ownerDocument, n = t.createElement("div");
2863
+ n.className = "designer-source-sheet-layer", n.dataset.sourceSheet = "true";
2864
+ let r = t.createElement("section");
2865
+ r.className = "designer-source-sheet", r.setAttribute("role", "dialog"), r.setAttribute("aria-modal", "true"), r.setAttribute("aria-labelledby", "designer-source-sheet-title"), r.tabIndex = -1;
2866
+ let i = t.createElement("header");
2867
+ i.className = "designer-source-sheet-head";
2868
+ let a = t.createElement("div"), o = t.createElement("h2");
2869
+ o.id = "designer-source-sheet-title", o.textContent = y.dataSource.pickerTitle, a.append(o);
2870
+ let s = t.createElement("button");
2871
+ s.type = "button", s.className = "designer-source-sheet-close", s.dataset.sourceSheetClose = "true", s.setAttribute("aria-label", y.dataSource.pickerClose), s.innerHTML = d("close"), i.append(a, s);
2872
+ let c = t.createElement("div");
2873
+ c.className = "designer-source-sheet-tabs", c.setAttribute("role", "tablist"), c.setAttribute("aria-label", y.dataSource.pickerTabsLabel);
2874
+ let l = new Map(Rn({
2875
+ mode: e.mode,
2876
+ availableModes: e.availableModes,
2877
+ resourceAvailable: e.resourceAvailable
2878
+ }).map((e) => [e.entry, e])), u = {
2879
+ dataset: "source",
2880
+ variable: "variable",
2881
+ fixed: "inline"
2882
+ };
2883
+ for (let n of _r) {
2884
+ let r = t.createElement("button");
2885
+ r.type = "button", r.dataset.sourceSheetTab = n, r.setAttribute("role", "tab"), r.setAttribute("aria-selected", String(e.sourcePickerTab === n)), r.tabIndex = e.sourcePickerTab === n ? 0 : -1;
2886
+ let i = l.get(u[n]);
2887
+ r.disabled = i?.disabled === !0, i?.reason !== void 0 && (r.title = i.reason), r.textContent = y.dataSource.pickerTab(n), c.appendChild(r);
2888
+ }
2889
+ let f = t.createElement("div");
2890
+ f.className = "designer-source-sheet-tools";
2891
+ let p = t.createElement("div");
2892
+ p.className = "designer-source-sheet-scroll", p.setAttribute("role", "tabpanel");
2893
+ let m = e.sourcePickerTab === "fixed" ? xr(e) : "";
2894
+ if (e.sourcePickerTab === "fixed") f.hidden = !0, p.appendChild(Sr(t, m));
2895
+ else {
2896
+ if (f.appendChild(yr(t, e)), e.sourcePickerTab === "dataset") {
2897
+ let t = ut(e);
2898
+ t !== void 0 && f.appendChild(t);
2899
+ }
2900
+ p.appendChild(e.sourcePickerTab === "variable" ? br(e) : dt(e));
2901
+ }
2902
+ return r.append(i, c, f, p, Cr(t, e, m)), n.appendChild(r), n;
2903
+ }
2904
+ function yr(e, t) {
2905
+ let n = e.createElement("label");
2906
+ n.className = "designer-source-sheet-search";
2907
+ let r = e.createElement("span");
2908
+ r.className = "designer-source-sheet-search-glyph", r.setAttribute("aria-hidden", "true"), r.innerHTML = d("search");
2909
+ let i = t.sourcePickerTab === "variable", a = c(e, {
2910
+ type: "search",
2911
+ className: "designer-source-sheet-search-input",
2912
+ ariaLabel: i ? y.dataSource.pickerSearchVariable : y.dataSource.pickerSearchDataset,
2913
+ placeholder: i ? y.dataSource.pickerSearchVariable : y.dataSource.pickerSearchDataset,
2914
+ value: i ? t.variableQuery : t.query
2915
+ });
2916
+ return a.autocomplete = "off", i ? a.dataset.datasetVariableQuery = "true" : a.dataset.datasetQuery = "true", n.append(r, a), n;
2917
+ }
2918
+ function br(e) {
2919
+ let t = e.panel.ownerDocument, n = t.createElement("div");
2920
+ n.className = "designer-source-sheet-list", n.dataset.sourceSheetVariables = "true";
2921
+ let r = e.variableQuery.trim().toLowerCase(), i = e.variables.filter((e) => r === "" || e.name.toLowerCase().includes(r)), a = t.createElement("p");
2922
+ a.className = "designer-empty-state", a.dataset.sourceSheetVariableEmpty = "true", a.textContent = e.variables.length === 0 ? y.dataSource.pickerNoVariables : y.dataSource.pickerNoVariableMatch, a.hidden = i.length > 0;
2923
+ for (let r of i) {
2924
+ let i = t.createElement("button");
2925
+ i.type = "button", i.className = "designer-source-sheet-item", i.dataset.sourceSheetVariable = r.id, i.setAttribute("aria-pressed", String(e.mode === "variable" && e.variableSourceId === r.id));
2926
+ let a = t.createElement("span");
2927
+ a.className = "designer-source-sheet-item-glyph", a.setAttribute("aria-hidden", "true"), a.innerHTML = d("variable");
2928
+ let o = t.createElement("span");
2929
+ o.className = "designer-source-sheet-item-copy";
2930
+ let s = t.createElement("strong");
2931
+ s.textContent = r.name;
2932
+ let c = t.createElement("small");
2933
+ c.textContent = `{{ ${r.id} }}`, o.append(s, c), i.append(a, o), n.appendChild(i);
2934
+ }
2935
+ return n.appendChild(a), n;
2936
+ }
2937
+ function xr(e) {
2938
+ let t = e.staticDraft.trim();
2939
+ if (t !== "" && t !== "null") return e.staticDraft;
2940
+ let n = e.preview.rawValue;
2941
+ return typeof n == "object" && n && !Array.isArray(n) && Array.isArray(n.fields) && Array.isArray(n.rows) ? JSON.stringify(n, null, 2) : e.staticDraft;
2942
+ }
2943
+ function Sr(e, t) {
2944
+ let n = e.createElement("div");
2945
+ n.className = "designer-source-sheet-fixed";
2946
+ let r = e.createElement("div");
2947
+ r.className = "designer-source-sheet-fixed-toolbar";
2948
+ let i = e.createElement("span");
2949
+ i.textContent = y.dataSource.pickerFixedFormat;
2950
+ let a = e.createElement("button");
2951
+ a.type = "button", a.className = "designer-source-sheet-link", a.dataset.sourceSheetFormat = "true", a.textContent = y.dataSource.pickerFixedFormatAction, r.append(i, a);
2952
+ let o = u(e, {
2953
+ className: "designer-source-sheet-fixed-area",
2954
+ ariaLabel: y.dataSource.pickerFixedAria,
2955
+ value: t
2956
+ });
2957
+ return o.dataset.sourceSheetFixed = "true", o.spellcheck = !1, n.append(r, o), n;
2958
+ }
2959
+ function Cr(e, t, n) {
2960
+ let r = e.createElement("footer");
2961
+ r.className = "designer-source-sheet-foot";
2962
+ let i = e.createElement("span");
2963
+ i.className = "designer-source-sheet-note", i.dataset.sourceSheetNote = "true";
2964
+ let a = e.createElement("div");
2965
+ if (a.className = "designer-source-sheet-actions", t.sourcePickerTab === "fixed") {
2966
+ let r = wr(n, t.staticDescriptor);
2967
+ i.textContent = r.note, i.dataset.tone = r.ok ? "ok" : "error";
2968
+ let o = e.createElement("button");
2969
+ o.type = "button", o.className = "designer-source-sheet-primary", o.dataset.sourceSheetApplyFixed = "true", o.textContent = y.dataSource.pickerFixedApply, o.disabled = !r.ok, a.appendChild(o);
2970
+ } else {
2971
+ i.textContent = t.sourcePickerTab === "variable" ? y.dataSource.pickerVariableCount(t.variables.length) : y.dataSource.pickerDatasetCount(t.items.length);
2972
+ let n = e.createElement("button");
2973
+ n.type = "button", n.className = "designer-source-sheet-link", n.dataset.sourceSheetClose = "true", n.textContent = y.dataSource.pickerCloseAction, a.appendChild(n);
2974
+ }
2975
+ return r.append(i, a), r;
2976
+ }
2977
+ function wr(e, t) {
2978
+ let n = e.trim();
2979
+ if (n === "") return {
2980
+ ok: !1,
2981
+ note: y.dataSource.pickerFixedEmpty
2982
+ };
2983
+ let r;
2984
+ try {
2985
+ r = JSON.parse(n);
2986
+ } catch {
2987
+ return {
2988
+ ok: !1,
2989
+ note: y.dataSource.pickerFixedInvalid
2990
+ };
2991
+ }
2992
+ if (t?.kind === "tabular") {
2993
+ let e = E(r);
2994
+ return e.ok ? {
2995
+ ok: !0,
2996
+ note: y.dataSource.pickerFixedValid(e.value.rows.length, e.value.fields.length)
2997
+ } : {
2998
+ ok: !1,
2999
+ note: e.diagnostics[0]?.message ?? y.dataSource.pickerFixedInvalid
3000
+ };
3001
+ }
3002
+ return t?.kind === "scalar" && typeof r !== t.valueType ? {
3003
+ ok: !1,
3004
+ note: y.dataSource.pickerFixedScalar(t.valueType)
3005
+ } : {
3006
+ ok: !0,
3007
+ note: y.dataSource.pickerFixedAny
3008
+ };
3009
+ }
3010
+ //#endregion
3011
+ //#region src/browser/dom/dataset/designer-dataset-dom.ts
3012
+ function Tr(e) {
3013
+ let { panel: t } = e;
3014
+ Et(t), t.replaceChildren();
3015
+ let n = t.ownerDocument.createElement("section");
3016
+ n.className = "designer-data-source-panel", n.dataset.dataSourcePanel = "true", n.dataset.inspectorSearchSection = "true", n.appendChild(Ie(t.ownerDocument, e.dataState));
3017
+ let r = cr(e);
3018
+ n.appendChild(r);
3019
+ let i = t.ownerDocument.createElement("p");
3020
+ i.className = "designer-data-source-feedback", i.dataset.datasetFeedback = "true", i.setAttribute("role", "status"), i.setAttribute("aria-live", "polite"), i.textContent = e.feedback;
3021
+ let a = r.querySelector(".designer-inspector-data-flow-content"), o = a?.querySelector(".designer-dataset-actions");
3022
+ o == null ? (a ?? n).appendChild(i) : o.before(i), t.appendChild(n);
3023
+ let s = t.closest(".properties") ?? t;
3024
+ for (let e of s.querySelectorAll("[data-source-sheet]")) e.remove();
3025
+ return e.catalogOpen && e.surface === "inspector" && s.appendChild(vr(e)), { feedback: i };
3026
+ }
3027
+ function Er(e) {
3028
+ let t = e.panel.ownerDocument, n = t.createElement("div");
3029
+ n.className = "designer-data-workbench-shell", n.dataset.datasetWorkbench = "true", n.dataset.inspectorSearchSection = "true", n.dataset.inspectorSearchText = [
3030
+ e.descriptor?.name ?? y.dataSource.workbench,
3031
+ y.dataSource.sourceStep,
3032
+ y.dataSource.mappingStep,
3033
+ y.dataSource.transformStep,
3034
+ y.dataSource.previewStep,
3035
+ y.dataSource.refreshStep
3036
+ ].join(" ");
3037
+ let r = t.createElement("header");
3038
+ r.className = "designer-workbench-header";
3039
+ let i = t.createElement("div");
3040
+ i.appendChild(U(t, "close-workbench", y.dataSource.backToCanvas));
3041
+ let a = t.createElement("span");
3042
+ a.className = "designer-workbench-identity";
3043
+ let o = t.createElement("h3");
3044
+ o.textContent = e.descriptor?.name ?? y.dataSource.workbench;
3045
+ let s = t.createElement("span");
3046
+ s.className = "designer-workbench-draft", s.dataset.dirty = String(e.dirty), s.textContent = e.dirty ? y.dataSource.draft : y.dataSource.synced, a.append(o, s), i.appendChild(a);
3047
+ let c = t.createElement("div");
3048
+ c.className = "designer-workbench-actions", c.append(U(t, "toggle-preview", e.preview.open ? y.dataSource.previewClose : y.dataSource.previewOpen, "preview-toggle"), U(t, "test", e.preview.status === "loading" ? y.dataSource.testing : y.dataSource.test, void 0, e.descriptor === void 0 || !e.resourceAvailable || e.preview.status === "loading"), U(t, "apply", y.dataSource.apply("dataset"), "primary", !e.dirty || e.descriptor === void 0 || !e.resourceAvailable)), r.append(i, c);
3049
+ let l = Or(t, e.confirmClose), u = t.createElement("nav");
3050
+ u.className = "designer-data-workbench-steps", u.dataset.inspectorSearchSection = "true", u.dataset.inspectorSearchText = [
3051
+ y.dataSource.sourceStep,
3052
+ y.dataSource.mappingStep,
3053
+ y.dataSource.transformStep,
3054
+ y.dataSource.previewStep,
3055
+ y.dataSource.refreshStep
3056
+ ].join(" "), u.setAttribute("aria-label", y.dataSource.workbench);
3057
+ for (let [n, r, i] of [
3058
+ [
3059
+ "source",
3060
+ y.dataSource.sourceStep,
3061
+ "available"
3062
+ ],
3063
+ [
3064
+ "mapping",
3065
+ y.dataSource.mappingStep,
3066
+ e.descriptor === void 0 ? "pending" : "available"
3067
+ ],
3068
+ [
3069
+ "transform",
3070
+ y.dataSource.transformStep,
3071
+ "unavailable"
3072
+ ],
3073
+ [
3074
+ "preview",
3075
+ y.dataSource.previewStep,
3076
+ e.descriptor === void 0 ? "pending" : "available"
3077
+ ],
3078
+ [
3079
+ "refresh",
3080
+ y.dataSource.refreshStep,
3081
+ "available"
3082
+ ]
3083
+ ]) {
3084
+ let a = t.createElement("button");
3085
+ a.type = "button", a.dataset.workbenchStep = n, a.dataset.state = i === "available" && e.activeStep === n ? "current" : i, a.setAttribute("aria-current", e.activeStep === n ? "step" : "false"), a.disabled = i === "pending" || i === "unavailable", a.textContent = r, u.appendChild(a);
3086
+ }
3087
+ let d = t.createElement("main");
3088
+ d.className = "designer-static-data-content", d.dataset.designerScrollScope = `data-workbench-editor:${e.scrollScope}`, d.appendChild(Dr("host-link", e)), d.appendChild(Dr("source", e)), e.descriptor !== void 0 && d.append(Dr("authoring", e), kr(t, "transform", y.dataSource.transformStep, y.dataSource.transformUnavailable), kr(t, "refresh", y.dataSource.refreshStep, Jt(e.authoring)));
3089
+ let f = Dr("preview", e), p = t.createElement("div");
3090
+ return p.className = "designer-data-workbench-grid", p.append(u, d, f), n.dataset.kind = "dataset", n.dataset.inspectorPane = "data", n.append(r, l, p), n;
3091
+ }
3092
+ function Dr(e, t) {
3093
+ let n = R(e, t);
3094
+ if (n === void 0) throw Error(`DATASET_SECTION_UNAVAILABLE:${e}`);
3095
+ return n;
3096
+ }
3097
+ function Or(e, t) {
3098
+ let n = e.createElement("section");
3099
+ n.className = "designer-workbench-confirm", n.hidden = !t, n.dataset.datasetDiscardConfirm = "true";
3100
+ let r = e.createElement("span"), i = e.createElement("strong");
3101
+ i.textContent = y.dataSource.discardTitle;
3102
+ let a = e.createElement("small");
3103
+ a.textContent = y.dataSource.discardDetail, r.append(i, a);
3104
+ let o = e.createElement("span");
3105
+ return o.append(U(e, "keep-editing", y.dataSource.keepEditing), U(e, "discard-workbench", y.dataSource.discard, "danger")), n.append(r, o), n;
3106
+ }
3107
+ function kr(e, t, n, r) {
3108
+ let i = e.createElement("section");
3109
+ i.className = "designer-dataset-config-section designer-data-workbench-notice", i.dataset.workbenchSection = t, i.dataset.inspectorSearchSection = "true", i.dataset.inspectorSearchText = `${n} ${r}`, i.tabIndex = -1;
3110
+ let a = e.createElement("h4");
3111
+ a.textContent = n;
3112
+ let o = e.createElement("p");
3113
+ return o.textContent = r, i.append(a, o), i;
3114
+ }
3115
+ //#endregion
3116
+ //#region src/browser/controllers/dataset/designer-dataset-instance-view.ts
3117
+ function Ar(e, t) {
3118
+ if (t === null || t.kind !== "data-source-field") return;
3119
+ let n = t.dataSourceId, r = ne(e ?? Mr()).find((e) => e.id === n);
3120
+ return r === void 0 ? {
3121
+ id: n,
3122
+ name: n,
3123
+ sourceKind: void 0,
3124
+ updatePolicy: void 0,
3125
+ processorId: void 0,
3126
+ status: "missing"
3127
+ } : {
3128
+ id: r.id,
3129
+ name: r.name,
3130
+ sourceKind: r.source.kind,
3131
+ updatePolicy: r.updatePolicy,
3132
+ processorId: r.processorId,
3133
+ status: "document"
3134
+ };
3135
+ }
3136
+ function jr(e, t) {
3137
+ return (e?.dataSources ?? []).filter((e) => e.source.kind === "dataset" && e.source.datasetId === t).map((e) => ({
3138
+ id: e.id,
3139
+ name: e.name,
3140
+ sourceKind: e.source.kind,
3141
+ updatePolicy: e.updatePolicy,
3142
+ processorId: e.processorId,
3143
+ status: "document"
3144
+ }));
3145
+ }
3146
+ function Mr() {
3147
+ return {
3148
+ canvas: {
3149
+ width: 0,
3150
+ height: 0,
3151
+ backgroundColor: "transparent"
3152
+ },
3153
+ components: [],
3154
+ variables: [],
3155
+ blueprint: { relations: [] }
3156
+ };
3157
+ }
3158
+ //#endregion
3159
+ //#region src/browser/controllers/dataset/designer-dataset-effective-value.ts
3160
+ function Nr(e, t) {
3161
+ return e === void 0 ? t.valueRef : O(e) ?? t.valueRef;
3162
+ }
3163
+ function Pr(e, t, n) {
3164
+ let r = Ar(e, t);
3165
+ if (r === void 0) return;
3166
+ if (r.status === "document") return r;
3167
+ let i = n.instance;
3168
+ return i !== void 0 && t !== null && t.kind === "data-source-field" && i.id === t.dataSourceId ? {
3169
+ id: i.id,
3170
+ name: i.name,
3171
+ sourceKind: i.sourceKind,
3172
+ updatePolicy: void 0,
3173
+ processorId: void 0,
3174
+ status: "pending"
3175
+ } : r;
3176
+ }
3177
+ //#endregion
3178
+ //#region src/browser/controllers/dataset/designer-dataset-surface-controller.ts
3179
+ function Fr(e) {
3180
+ let t = e.callbacks.preserveScrollContinuity;
3181
+ if (t !== void 0) {
3182
+ t(() => Ir(e));
3183
+ return;
3184
+ }
3185
+ Ir(e);
3186
+ }
3187
+ function Ir(e) {
3188
+ let t = e.state.panel;
3189
+ if (t === void 0) return;
3190
+ let n = Rr(t), r = K(e, t, "inspector"), i = Tr(r);
3191
+ e.state.feedback = i.feedback;
3192
+ let o = e.currentEntry()?.manifest, s = t.querySelector(".designer-inspector-data-flow-content") ?? t, c = t.ownerDocument.createElement("div");
3193
+ a(c, o?.editorDescriptor?.data, {
3194
+ document: e.callbacks.getDocument(),
3195
+ interaction: e.callbacks.getInteraction(),
3196
+ catalog: e.callbacks.getCatalog(),
3197
+ getDatasetFields: () => ii(e)
3198
+ });
3199
+ let l = s.querySelector(".designer-dataset-actions"), u = s.querySelector("[data-ds-section=\"preview\"]") ?? l;
3200
+ if (u !== null) {
3201
+ for (; c.firstChild !== null;) u.before(c.firstChild);
3202
+ dr(s);
3203
+ } else for (; c.firstChild !== null;) s.appendChild(c.firstChild);
3204
+ Zr(e, K(e, t, "workbench")), hn(t, r);
3205
+ let d = e.callbacks.getWorkbenchHost?.();
3206
+ d !== void 0 && hn(d, K(e, t, "workbench")), e.dataFlowScrollSync.bind(t), Cn(t, r.dataState), Le(t, r.dataState), n !== void 0 && t.querySelector(`[data-data-entry="${n}"]`)?.focus({ preventScroll: !0 });
3207
+ }
3208
+ function Lr(e) {
3209
+ let t = e.state.panel;
3210
+ if (t === void 0) return;
3211
+ let n = K(e, t, "inspector");
3212
+ Jn(t, pr(n)), qn(t, W(n));
3213
+ }
3214
+ function Rr(e) {
3215
+ let t = e.getRootNode()?.activeElement;
3216
+ if (t != null && t !== e) return t.closest("[data-data-entry]")?.dataset.dataEntry;
3217
+ }
3218
+ function zr(e) {
3219
+ let t = e.currentComponent()?.dataSource ?? null, n = t !== null || e.state.mode !== "none";
3220
+ if (!n) return { configured: !1 };
3221
+ let r = Br(e, t), i = e.currentComponent()?.status.locked === !0 ? "locked" : void 0, a = e.catalogController.status === "loading" || e.state.preview.status === "loading", o = Vr(e), s = Hr(e.state.preview);
3222
+ return {
3223
+ configured: n,
3224
+ ...r === void 0 ? {} : { unavailable: r },
3225
+ ...i === void 0 ? {} : { readonly: i },
3226
+ ...a ? { loading: a } : {},
3227
+ ...o === void 0 ? {} : { failure: o },
3228
+ ...s ? { empty: s } : {}
3229
+ };
3230
+ }
3231
+ function Br(e, t) {
3232
+ let n = e.state.mode, r = t?.type === "dataset" || n === "dataset", i = t?.type === "variable" || n === "variable", a = t?.type === "host-resource" || n === "host-resource";
3233
+ if (r) return e.callbacks.getCatalogPort() === void 0 ? "port-missing" : e.state.draft !== void 0 && e.state.descriptor === void 0 ? "instance-missing" : void 0;
3234
+ if (i) return e.callbacks.getHostCatalogPort?.() === void 0 ? "port-missing" : void 0;
3235
+ if (a) return e.callbacks.getResourcePort() === void 0 ? "port-missing" : void 0;
3236
+ }
3237
+ function Vr(e) {
3238
+ if (e.state.preview.status === "error") return e.state.preview.message;
3239
+ if (e.catalogController.status === "error") return "catalog";
3240
+ }
3241
+ function Hr(e) {
3242
+ if (e.status !== "ready" || e.rawValue === void 0) return !1;
3243
+ let t = e.rawValue;
3244
+ if (typeof t != "object" || !t || Array.isArray(t)) return !1;
3245
+ let n = t.rows;
3246
+ return Array.isArray(n) && n.length === 0;
3247
+ }
3248
+ function G(e, t) {
3249
+ let n = e.state.panel;
3250
+ if (n === void 0) return;
3251
+ let r = e.callbacks.getWorkbenchHost?.();
3252
+ for (let t of [n, r]) {
3253
+ if (t === void 0) continue;
3254
+ let r = K(e, n, Jr(t, n));
3255
+ mn(t, r), Le(t, r.dataState), Jn(t, pr(r)), qn(t, W(r));
3256
+ }
3257
+ Cn(n, K(e, n, "inspector").dataState), t?.();
3258
+ }
3259
+ function Ur(e) {
3260
+ let t = e.state.bindingOpenRoleId;
3261
+ if (t === null) return;
3262
+ e.state.bindingOpenRoleId = null;
3263
+ let n = e.state.panel;
3264
+ for (let r of [n, e.callbacks.getWorkbenchHost?.()]) {
3265
+ if (r === void 0) continue;
3266
+ for (let e of r.querySelectorAll("[data-dataset-binding-menu]")) e.dataset.datasetBindingMenu === t && (e.hidden = !0, e.parentElement?.querySelector("[data-dataset-binding-trigger]")?.setAttribute("aria-expanded", "false"));
3267
+ if (n === void 0) continue;
3268
+ let i = r.querySelector("[data-ds-section=\"source\"]");
3269
+ i !== null && (i.dataset.dsContentKey = pn("source", K(e, n, Jr(r, n))));
3270
+ }
3271
+ }
3272
+ function Wr(e) {
3273
+ let t = e.state.panel;
3274
+ if (t === void 0) return;
3275
+ let n = K(e, t, "inspector"), r = [typeof t.closest == "function" ? t.closest(".properties") ?? t : t, e.callbacks.getWorkbenchHost?.()];
3276
+ for (let e of r) for (let t of e?.querySelectorAll("[data-dataset-results]") ?? []) t.replaceWith(dt(n));
3277
+ G(e);
3278
+ }
3279
+ function Gr(e) {
3280
+ e.cancelPreview(), e.state.preview = j(e.state.preview.open), G(e), e.catalogController.retry();
3281
+ }
3282
+ function Kr(e, t) {
3283
+ let n = t === "mapping" || t === "preview" ? t : "source";
3284
+ if (n === e.state.activeStep) return;
3285
+ e.state.activeStep = n;
3286
+ let r = e.state.panel?.querySelector(".designer-inspector-data-flow");
3287
+ r && (r.dataset.activeStep = n);
3288
+ let i = e.state.panel?.querySelector(".designer-inspector-data-flow-progress");
3289
+ if (i) for (let e of i.querySelectorAll("[data-dataset-workbench-target]")) {
3290
+ let t = e.dataset.datasetWorkbenchTarget === n;
3291
+ e.setAttribute("aria-current", t ? "step" : "false");
3292
+ }
3293
+ }
3294
+ function qr(e) {
3295
+ let t = e.state;
3296
+ if (t.mode === "static") return { valueRef: {
3297
+ kind: "inline",
3298
+ value: t.staticValue
3299
+ } };
3300
+ if (t.mode === "variable") return { valueRef: {
3301
+ kind: "variable",
3302
+ variableId: t.variableSourceId
3303
+ } };
3304
+ if (t.mode !== "dataset") return { valueRef: null };
3305
+ let n = e.currentComponent();
3306
+ if (n === void 0) return { valueRef: null };
3307
+ let r = ee(n.id);
3308
+ return {
3309
+ valueRef: {
3310
+ kind: "data-source-field",
3311
+ dataSourceId: r,
3312
+ path: []
3313
+ },
3314
+ instance: t.descriptor === void 0 ? void 0 : {
3315
+ id: r,
3316
+ name: t.descriptor.name,
3317
+ sourceKind: "dataset"
3318
+ }
3319
+ };
3320
+ }
3321
+ function Jr(e, t) {
3322
+ return e === t ? "inspector" : "workbench";
3323
+ }
3324
+ function K(e, t, n) {
3325
+ let r = e.currentComponent()?.dataSource, a = e.currentComponent(), o = qr(e), s = Nr(a, o);
3326
+ return {
3327
+ panel: t,
3328
+ surface: n,
3329
+ dataValue: s,
3330
+ instance: Pr(e.callbacks.getDocument(), s, o),
3331
+ datasetInstances: e.state.descriptor === void 0 ? [] : jr(e.callbacks.getDocument(), e.state.descriptor.datasetId),
3332
+ selectedDatasetInstanceId: e.state.datasetInstanceId,
3333
+ groupOpenOverrides: e.state.groupOpenOverrides,
3334
+ onToggleGroup: (t, n, r) => {
3335
+ e.state.groupOpenOverrides.set(`${t}:${n}`, r);
3336
+ },
3337
+ scrollScope: JSON.stringify([
3338
+ e.state.focusedComponentId,
3339
+ e.state.mode,
3340
+ e.state.staticTab,
3341
+ e.state.staticPage,
3342
+ e.state.staticPageSize,
3343
+ e.state.catalogOpen,
3344
+ e.state.descriptor?.datasetId ?? null
3345
+ ]),
3346
+ mode: e.state.mode,
3347
+ availableModes: ri(e),
3348
+ dataState: Sn(zr(e)),
3349
+ ...r?.type === "host-resource" ? { hostResource: {
3350
+ resourceType: r.resourceType,
3351
+ resourceId: r.resourceId
3352
+ } } : {},
3353
+ variableSourceId: r?.type === "variable" ? r.variableId : e.state.variableSourceId,
3354
+ staticDraft: e.state.staticDraft,
3355
+ staticDescriptor: e.currentEntry()?.manifest.staticData,
3356
+ staticValue: e.state.staticValue,
3357
+ staticBinding: e.state.staticBinding,
3358
+ staticTab: e.state.staticTab,
3359
+ staticPage: e.state.staticPage,
3360
+ staticPageSize: e.state.staticPageSize,
3361
+ query: e.catalogController.query,
3362
+ groups: e.catalogController.groups,
3363
+ ...e.catalogController.groupId === void 0 ? {} : { groupId: e.catalogController.groupId },
3364
+ catalogOpen: e.state.catalogOpen,
3365
+ sourcePickerTab: e.state.sourcePickerTab,
3366
+ variableQuery: e.state.variableQuery,
3367
+ items: e.catalogController.items,
3368
+ cursor: e.catalogController.cursor,
3369
+ descriptor: e.state.descriptor,
3370
+ draft: e.state.draft,
3371
+ roles: e.currentEntry()?.manifest.dataBinding?.roles ?? [],
3372
+ variables: (e.callbacks.getDocument()?.variables ?? []).map(({ id: e, name: t }) => ({
3373
+ id: e,
3374
+ name: t
3375
+ })),
3376
+ catalogAvailable: e.callbacks.getCatalogPort() !== void 0,
3377
+ resourceAvailable: e.callbacks.getCatalogPort() !== void 0,
3378
+ hostResourceSelectionAvailable: e.callbacks.isHostResourceSelectionButtonVisible?.() === !0 && a !== void 0 && !("dataValue" in a) && i(e.currentEntry()?.manifest),
3379
+ link: ni(e),
3380
+ bindingOpenRoleId: e.state.bindingOpenRoleId,
3381
+ feedback: e.state.feedbackText,
3382
+ dirty: Xr(e, r ?? null),
3383
+ canUndo: e.callbacks.canUndo?.() ?? !1,
3384
+ confirmClose: e.state.confirmClose,
3385
+ preview: e.state.preview,
3386
+ activeStep: e.state.activeStep,
3387
+ authoring: e.state.authoring,
3388
+ ...Yr(e)
3389
+ };
3390
+ }
3391
+ function Yr(e) {
3392
+ let t = e.callbacks.getOverlayHost?.();
3393
+ return {
3394
+ ...t === void 0 ? {} : { overlayHost: t },
3395
+ onSelectParameter: (t, n) => e.setParameterValueRef(t, n)
3396
+ };
3397
+ }
3398
+ function Xr(e, t) {
3399
+ let n = e.state.mode;
3400
+ return n === "dataset" ? e.state.draftDirty : n === "static" ? t?.type !== "static" || JSON.stringify(t.value) !== JSON.stringify(e.state.staticValue) || JSON.stringify(t.binding ?? null) !== JSON.stringify(e.state.staticBinding ?? null) || e.state.staticDraft !== JSON.stringify(e.state.staticValue, null, 2) : n === "variable" ? t?.type !== "variable" || t.variableId !== e.state.variableSourceId : !1;
3401
+ }
3402
+ function Zr(e, t) {
3403
+ let n = e.callbacks.getWorkbenchHost?.();
3404
+ if (n === void 0) return;
3405
+ let r = n.closest(".designer");
3406
+ if (Et(n), n.replaceChildren(), !e.state.workbenchOpen || t.mode !== "dataset" || t.descriptor === void 0) {
3407
+ n.hidden = !0, n.removeAttribute("role"), n.removeAttribute("aria-modal"), n.removeAttribute("tabindex"), r !== null && delete r.dataset.dataWorkbenchOpen;
3408
+ return;
3409
+ }
3410
+ n.hidden = !1, n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "true"), n.setAttribute("aria-label", y.dataSource.workbench), n.tabIndex = -1, n.appendChild(Er(t)), r !== null && (r.dataset.dataWorkbenchOpen = "true");
3411
+ }
3412
+ function Qr(e, t) {
3413
+ e.state.activeStep = t, t === "preview" && (e.state.preview = {
3414
+ ...e.state.preview,
3415
+ open: !0
3416
+ }), e.dataFlowScrollSync.beginProgrammaticScroll(t), e.renderSurface();
3417
+ let n = e.state.panel?.querySelector(`[data-workbench-section="${t}"]`) ?? e.callbacks.getWorkbenchHost?.()?.querySelector(`[data-workbench-section="${t}"]`);
3418
+ n?.scrollIntoView({
3419
+ behavior: "smooth",
3420
+ block: "start"
3421
+ }), n?.focus({ preventScroll: !0 });
3422
+ }
3423
+ function $r(e) {
3424
+ let t = e.callbacks.getWorkbenchHost?.();
3425
+ (t?.querySelector("[data-dataset-action=\"close-workbench\"]") ?? t)?.focus({ preventScroll: !0 });
3426
+ }
3427
+ function ei(e) {
3428
+ e.state.panel?.querySelector("[data-dataset-authoring-action=\"fullscreen-edit\"]")?.focus({ preventScroll: !0 });
3429
+ }
3430
+ function ti(e, t, n, r) {
3431
+ let i = t === "dataset" ? "[data-dataset-binding-field]" : "[data-static-binding-field]", a = t === "dataset" ? "data-dataset-binding-role-id" : "data-static-binding-role", o = t === "dataset" ? "data-dataset-binding-field" : "data-static-binding-field", s = [e.callbacks.getWorkbenchHost?.(), e.state.panel];
3432
+ for (let e of s) {
3433
+ let t = [...e?.querySelectorAll(i) ?? []].find((e) => e.getAttribute(a) === n && e.getAttribute(o) === r);
3434
+ if (t !== void 0) {
3435
+ t.focus({ preventScroll: !0 });
3436
+ return;
3437
+ }
3438
+ }
3439
+ }
3440
+ function ni(e) {
3441
+ let t = e.callbacks.getCatalogPort(), n = e.state.preview, r = e.catalogController.error;
3442
+ return {
3443
+ catalog: t === void 0 ? { status: "unavailable" } : {
3444
+ status: e.catalogController.status,
3445
+ ...r === void 0 ? {} : { detail: r }
3446
+ },
3447
+ query: t === void 0 ? { status: "unavailable" } : n.status === "loading" ? { status: "loading" } : n.status === "error" ? {
3448
+ status: "error",
3449
+ detail: n.message
3450
+ } : { status: "ready" },
3451
+ variables: e.callbacks.getHostCatalogPort?.() === void 0 ? { status: "unavailable" } : { status: "ready" }
3452
+ };
3453
+ }
3454
+ function ri(e) {
3455
+ return me(e.currentEntry());
3456
+ }
3457
+ function ii(e) {
3458
+ return e.state.descriptor?.fields.map((e) => ({
3459
+ id: e.id,
3460
+ label: e.label
3461
+ })) ?? [];
3462
+ }
3463
+ function ai(e) {
3464
+ e.dataFlowScrollSync.clear();
3465
+ let t = e.callbacks.getWorkbenchHost?.();
3466
+ if (t !== void 0) {
3467
+ t.hidden = !0, Et(t), t.replaceChildren();
3468
+ let e = t.closest(".designer");
3469
+ e !== null && delete e.dataset.dataWorkbenchOpen;
3470
+ }
3471
+ e.state.panel = void 0, e.state.feedback = void 0;
3472
+ }
3473
+ function oi(e, t) {
3474
+ e.state.feedbackText = t, e.state.feedback !== void 0 && (e.state.feedback.textContent = t);
3475
+ }
3476
+ function si(e) {
3477
+ return e === "source" || e === "mapping" || e === "transform" || e === "preview" || e === "refresh";
3478
+ }
3479
+ //#endregion
3480
+ //#region src/browser/controllers/dataset/designer-dataset-draft-controller.ts
3481
+ var ci = 300;
3482
+ function li(e) {
3483
+ return M(e.state.descriptor, e.state.draft);
3484
+ }
3485
+ function ui(e) {
3486
+ e.state.mode === "dataset" && (e.state.clearAutoApply(), e.state.autoApplyTimer = setTimeout(() => {
3487
+ e.state.autoApplyTimer = void 0, !(e.state.mode !== "dataset" || !e.state.draftDirty) && (li(e) > 0 || q(e, { auto: !0 }));
3488
+ }, ci));
3489
+ }
3490
+ function di(e, t) {
3491
+ if (!Oi(e).includes(t)) return;
3492
+ if (e.state.clearAutoApply(), e.state.mode = t, e.state.groupOpenOverrides.clear(), e.state.parameterInlineMemory.clear(), e.state.activeStep = "source", e.state.workbenchOpen = !1, e.state.feedbackText = "", e.state.confirmClose = !1, t === "static" && e.currentComponent()?.dataSource?.type !== "static" && e.restoreStaticExample(), t !== "dataset") {
3493
+ e.catalogController.clear(), e.renderSurface();
3494
+ return;
3495
+ }
3496
+ let n = e.currentComponent()?.dataSource;
3497
+ n?.type === "dataset" && e.state.descriptor?.datasetId !== n.datasetId ? (e.state.catalogOpen = !1, e.renderSurface(), fi(e, n.datasetId, { autoApply: !0 })) : (e.state.catalogOpen = e.state.descriptor === void 0, e.renderSurface()), e.catalogController.ensureList();
3498
+ }
3499
+ async function fi(e, t, n = {}) {
3500
+ if (!Oi(e).includes("dataset")) return;
3501
+ let r = e.currentComponent()?.id, i = e.currentComponent(), a = se(e.callbacks.getDocument(), i), o = await e.catalogController.describe(t);
3502
+ if (o === void 0 || e.currentComponent()?.id !== r || !Oi(e).includes("dataset")) return;
3503
+ let s = e.currentEntry()?.manifest.dataBinding?.roles ?? [], c = a?.source.datasetId === t, l = c ? a?.instance : void 0;
3504
+ e.state.descriptor = o, e.state.datasetInstanceId = c ? a?.instanceId ?? null : null, e.state.draft = l !== void 0 && l.source.kind === "dataset" ? ce(o, l, i?.dataBinding, s) : de(o, c ? a?.source ?? null : null, s), e.state.parameterInlineMemory.clear(), e.state.mode = "dataset", e.state.catalogOpen = !1, e.state.draftDirty = Si(e), e.state.preview = j(), e.state.activeStep = "source", e.state.feedbackText = "", e.renderSurface(), n.autoApply === !0 && e.state.draftDirty && ui(e);
3505
+ }
3506
+ function pi(e, t) {
3507
+ let n = e.callbacks.getDocument(), r = e.state.descriptor, i = e.state.draft;
3508
+ if (n !== void 0 && r !== void 0 && i !== void 0) {
3509
+ if (t === null) e.state.datasetInstanceId = null;
3510
+ else {
3511
+ let a = (n.dataSources ?? []).find((e) => e.id === t && e.source.kind === "dataset" && e.source.datasetId === r.datasetId);
3512
+ if (a === void 0) return;
3513
+ e.state.datasetInstanceId = a.id, e.state.draft = {
3514
+ ...i,
3515
+ params: { ...a.params }
3516
+ };
3517
+ }
3518
+ e.state.feedbackText = "", e.state.draftDirty = Si(e), e.renderSurface(), q(e);
3519
+ }
3520
+ }
3521
+ function q(e, t = {}) {
3522
+ if (e.state.mode === "host-resource") return;
3523
+ e.state.clearAutoApply();
3524
+ let n = e.currentComponent(), r = e.callbacks.getDocument();
3525
+ if (n === void 0 || r === void 0) return;
3526
+ let i;
3527
+ if (e.state.mode === "none") i = Te(r, n.id);
3528
+ else if (e.state.mode === "static") {
3529
+ let t = e.currentEntry();
3530
+ i = _e(n.id, e.state.staticDraft, t?.manifest.staticData, e.state.staticBinding, t?.manifest.dataBinding?.roles ?? []);
3531
+ } else if (e.state.mode === "variable") i = Ee(r, n.id, e.state.variableSourceId);
3532
+ else {
3533
+ let t = e.state.descriptor, a = e.state.draft;
3534
+ if (t === void 0 || a === void 0) {
3535
+ e.setFeedback(y.dataset.incomplete);
3536
+ return;
3537
+ }
3538
+ i = ve({
3539
+ document: r,
3540
+ componentId: n.id,
3541
+ descriptor: t,
3542
+ draft: a,
3543
+ roles: e.currentEntry()?.manifest.dataBinding?.roles ?? [],
3544
+ ...e.state.datasetInstanceId === null ? {} : { preferredInstanceId: e.state.datasetInstanceId }
3545
+ });
3546
+ }
3547
+ if (!i.ok) {
3548
+ e.callbacks.report(i.diagnostics), e.setFeedback(i.diagnostics[0]?.message ?? y.dataset.incomplete);
3549
+ return;
3550
+ }
3551
+ let a = e.callbacks.executeTransaction(i.value);
3552
+ if (!a.ok) {
3553
+ e.callbacks.report(a.diagnostics);
3554
+ return;
3555
+ }
3556
+ let o = a.value.components.find((e) => e.id === n.id), s = o === void 0 ? null : O(o);
3557
+ e.state.datasetInstanceId = s?.kind === "data-source-field" ? s.dataSourceId : null, t.auto !== !0 && e.setFeedback(""), e.state.draftDirty = !1, e.state.confirmClose = !1, e.state.activeStep = "source", e.renderSurface();
3558
+ }
3559
+ function mi(e) {
3560
+ let t = e.currentComponent(), n = t?.id ?? null, r = se(e.callbacks.getDocument(), t), i = r?.source ?? t?.dataSource, a = r?.instanceId ?? null;
3561
+ if (n === e.state.focusedComponentId && ki(i, e.state.syncedDataSource) && a === e.state.syncedInstanceId) {
3562
+ e.state.syncedDataSource = i, e.state.syncedInstanceId = a, e.state.datasetInstanceId = a;
3563
+ return;
3564
+ }
3565
+ let o = n === e.state.focusedComponentId, s = o ? e.state.activeStep : "source", c = o ? e.state.authoring : Pe();
3566
+ if (e.state.focusedComponentId = n, e.state.clearAutoApply(), e.state.syncedDataSource = i, e.state.syncedInstanceId = a, e.state.datasetInstanceId = a, e.state.feedbackText = "", e.state.draftDirty = !1, e.state.confirmClose = !1, o || (e.state.workbenchOpen = !1), e.cancelPreview(), e.state.preview = j(), e.state.activeStep = s, e.state.authoring = c, i?.type === "static") {
3567
+ e.state.mode = "static", e.state.staticDraft = JSON.stringify(i.value, null, 2), e.state.staticValue = i.value, e.state.staticBinding = i.binding, e.state.staticPage = 0, e.state.descriptor = void 0, e.state.draft = void 0, e.state.catalogOpen = !1;
3568
+ return;
3569
+ }
3570
+ if (i?.type === "host-resource") {
3571
+ e.state.mode = "host-resource", e.state.descriptor = void 0, e.state.draft = void 0, e.state.catalogOpen = !1;
3572
+ return;
3573
+ }
3574
+ if (i?.type === "dataset") {
3575
+ if (e.state.mode = "dataset", e.state.catalogOpen = !1, !Oi(e).includes("dataset")) {
3576
+ e.state.descriptor = void 0, e.state.draft = void 0;
3577
+ return;
3578
+ }
3579
+ if (e.state.descriptor?.datasetId === i.datasetId) {
3580
+ let n = e.currentEntry()?.manifest.dataBinding?.roles ?? [];
3581
+ e.state.draft = r?.instance !== void 0 && r.instance.source.kind === "dataset" ? ce(e.state.descriptor, r.instance, t?.dataBinding, n) : de(e.state.descriptor, i, n);
3582
+ return;
3583
+ }
3584
+ return e.state.descriptor = void 0, e.state.draft = void 0, { datasetId: i.datasetId };
3585
+ }
3586
+ if (i?.type === "variable") {
3587
+ e.state.mode = "variable", e.state.variableSourceId = i.variableId, e.state.descriptor = void 0, e.state.draft = void 0, e.state.catalogOpen = !1;
3588
+ return;
3589
+ }
3590
+ e.state.mode = "none", e.state.variableSourceId = "", e.state.descriptor = void 0, e.state.draft = void 0, e.state.catalogOpen = !1;
3591
+ }
3592
+ function hi(e, t) {
3593
+ let n = e.currentEntry()?.manifest.dataBinding?.roles.find((e) => e.id === t.dataset.datasetBindingRoleId), r = t.dataset.datasetBindingField;
3594
+ e.state.draft !== void 0 && n !== void 0 && r !== void 0 && (e.state.draft = ge(e.state.draft, n, r), J(e, ["source", "preview"], () => e.restoreBindingFieldFocus("dataset", n.id, r)));
3595
+ }
3596
+ function gi(e, t) {
3597
+ let n = e.currentEntry()?.manifest.dataBinding?.roles.find((e) => e.id === t.dataset.datasetBindingRoleId);
3598
+ if (e.state.draft === void 0 || e.state.descriptor === void 0 || n === void 0) return;
3599
+ let r = e.state.descriptor.fields.filter((e) => n.valueTypes.includes(e.valueType)).slice(0, n.maxFields).map((e) => e.id);
3600
+ e.state.draft = {
3601
+ ...e.state.draft,
3602
+ fields: {
3603
+ ...e.state.draft.fields,
3604
+ [n.id]: t.dataset.datasetBindingRoleAction === "clear" ? [] : r
3605
+ }
3606
+ }, J(e);
3607
+ }
3608
+ function _i(e) {
3609
+ let t = e.state.descriptor;
3610
+ if (e.state.draft === void 0 || t === void 0) return;
3611
+ let n = fe(t, e.currentEntry()?.manifest.dataBinding?.roles ?? []);
3612
+ e.state.draft = {
3613
+ ...e.state.draft,
3614
+ fields: n
3615
+ }, J(e);
3616
+ }
3617
+ function vi(e, t, n) {
3618
+ if (t === "" || e.state.draft === void 0) return;
3619
+ let r = e.state.draft.params[t];
3620
+ r?.kind === "inline" && e.state.parameterInlineMemory.set(t, r.value);
3621
+ let i = e.state.parameterInlineMemory.get(t), a = n.kind === "inline" && n.value === null ? {
3622
+ kind: "inline",
3623
+ value: i === void 0 ? De(e.state.descriptor, t) : i
3624
+ } : n;
3625
+ Ei(r, a) || (e.state.draft = he(e.state.draft, t, a), J(e, ["source", "preview"], () => Y(e, a.kind === "inline" ? `[data-value-ref-inline="parameter:${t}"]` : `[data-value-ref-trigger="parameter:${t}"]`, a.kind === "inline" ? "caret-end" : "keep")));
3626
+ }
3627
+ function yi(e, t) {
3628
+ let n = t.dataset.valueRefInline;
3629
+ if (n === void 0 || e.state.draft === void 0 || e.state.descriptor === void 0) return;
3630
+ let r = bi(n), i = e.state.descriptor.parameters.find((e) => e.name === r);
3631
+ if (i === void 0) return;
3632
+ let a = pe(t, i);
3633
+ a !== void 0 && (e.state.draft = he(e.state.draft, r, {
3634
+ kind: "inline",
3635
+ value: a
3636
+ }), J(e, ["source", "preview"], () => Y(e, `[data-value-ref-inline="${n}"]`, "caret-end")));
3637
+ }
3638
+ function bi(e) {
3639
+ return e.startsWith("parameter:") ? e.slice(10) : e;
3640
+ }
3641
+ function xi(e, t) {
3642
+ let n = t.dataset.datasetBindingRole;
3643
+ if (n === void 0 || e.state.draft === void 0) return;
3644
+ let r = t.value || t.selectedOptions[0]?.value || "";
3645
+ e.state.draft = {
3646
+ ...e.state.draft,
3647
+ fields: {
3648
+ ...e.state.draft.fields,
3649
+ [n]: r === "" ? [] : [r]
3650
+ }
3651
+ }, J(e, ["source", "preview"], () => Y(e, `[data-dataset-binding-role="${n}"]`));
3652
+ }
3653
+ function J(e, t = ["source", "preview"], n) {
3654
+ e.state.draftDirty = Si(e), e.state.confirmClose = !1, e.state.preview = {
3655
+ ...j(e.state.preview.open),
3656
+ tab: e.state.preview.tab
3657
+ }, G(e, n), e.state.mode === "dataset" && ui(e);
3658
+ }
3659
+ function Y(e, t, n = "keep") {
3660
+ let r = (e.state.workbenchOpen ? e.callbacks.getWorkbenchHost?.() : e.state.panel)?.querySelector(t);
3661
+ if (r == null || ((r.closest(".designer-select-control")?.querySelector(".designer-select-trigger") ?? r).focus({ preventScroll: !0 }), n !== "caret-end" || !(r instanceof HTMLInputElement)) || r.type === "number") return;
3662
+ let i = r.value.length;
3663
+ r.setSelectionRange(i, i);
3664
+ }
3665
+ function Si(e) {
3666
+ let t = e.currentComponent(), n = se(e.callbacks.getDocument(), t), r = n?.source ?? t?.dataSource, i = e.state.draft;
3667
+ if (r?.type !== "dataset" || i === void 0) return i !== void 0;
3668
+ if (r.datasetId !== i.datasetId) return !0;
3669
+ let a = (e.currentEntry()?.manifest.dataBinding?.roles ?? []).length === 0 ? null : { fields: i.fields };
3670
+ return !(n?.instance === void 0 ? wi(r.params) === Ti(i.params) : Ci(n.instance.params) === Ci(i.params)) || JSON.stringify(t?.dataBinding ?? r.binding) !== JSON.stringify(a);
3671
+ }
3672
+ function Ci(e) {
3673
+ return JSON.stringify(Object.keys(e).sort().map((t) => [t, e[t]]));
3674
+ }
3675
+ function wi(e) {
3676
+ let t = Object.keys(e).sort().map((t) => [t, ue(le(e[t])) ?? null]);
3677
+ return JSON.stringify(t);
3678
+ }
3679
+ function Ti(e) {
3680
+ let t = Object.keys(e).sort().map((t) => [t, ue(e[t]) ?? null]);
3681
+ return JSON.stringify(t);
3682
+ }
3683
+ function Ei(e, t) {
3684
+ return e === void 0 || e.kind !== t.kind ? !1 : e.kind === "variable" && t.kind === "variable" ? e.variableId === t.variableId : e.kind === "inline" && t.kind === "inline" && JSON.stringify(e.value) === JSON.stringify(t.value);
3685
+ }
3686
+ function Di(e) {
3687
+ e.state.clearAutoApply();
3688
+ let t = e.currentComponent()?.dataSource, n = e.state.descriptor;
3689
+ t?.type === "dataset" && n !== void 0 && (e.state.draft = de(n, t, e.currentEntry()?.manifest.dataBinding?.roles ?? [])), e.state.draftDirty = !1, e.state.parameterInlineMemory.clear(), e.cancelPreview(), e.state.preview = j();
3690
+ }
3691
+ function Oi(e) {
3692
+ return me(e.currentEntry()).filter((t) => t !== "dataset" || e.callbacks.getCatalogPort() !== void 0);
3693
+ }
3694
+ function ki(e, t) {
3695
+ return JSON.stringify(e) === JSON.stringify(t);
3696
+ }
3697
+ //#endregion
3698
+ //#region src/browser/controllers/dataset/designer-dataset-preview-controller.ts
3699
+ function Ai(e, t) {
3700
+ e.state.preview = {
3701
+ ...e.state.preview,
3702
+ tab: t
3703
+ }, G(e);
3704
+ }
3705
+ async function ji(e) {
3706
+ let t = e.state.descriptor, n = e.state.draft, r = e.currentComponent(), i = e.callbacks.getCatalogPort();
3707
+ if (t === void 0 || n === void 0 || r === void 0 || i === void 0) return;
3708
+ e.cancelPreview();
3709
+ let a = new AbortController(), o = e.state.previewGeneration;
3710
+ e.state.previewController = a, e.state.preview = {
3711
+ ...j(!0),
3712
+ status: "loading",
3713
+ tab: e.state.preview.tab === "request" ? "response" : e.state.preview.tab,
3714
+ message: y.dataSource.previewLoading
3715
+ }, e.renderSurface();
3716
+ let s, c = new Promise((t) => {
3717
+ s = setTimeout(() => {
3718
+ o === e.state.previewGeneration && !a.signal.aborted && (a.abort(), X(e)), t(void 0);
3719
+ }, 15e3);
3720
+ });
3721
+ try {
3722
+ let t = await Promise.race([i.describe({
3723
+ datasetId: n.datasetId,
3724
+ signal: a.signal
3725
+ }), c]);
3726
+ if (t === void 0 || a.signal.aborted || o !== e.state.previewGeneration) return;
3727
+ if (!t.ok) {
3728
+ e.callbacks.report(t.diagnostics), X(e);
3729
+ return;
3730
+ }
3731
+ let s = C(t.value);
3732
+ if (!s.ok || s.value.datasetId !== n.datasetId) {
3733
+ X(e);
3734
+ return;
3735
+ }
3736
+ let l = await Promise.race([Mi(e, n, a), c]);
3737
+ if (a.signal.aborted || o !== e.state.previewGeneration) return;
3738
+ if (l === void 0) {
3739
+ e.state.previewController = void 0, e.state.preview = {
3740
+ ...j(!0),
3741
+ status: "error",
3742
+ message: y.dataSource.testVariableUnavailable
3743
+ }, e.state.feedbackText = e.state.preview.message, e.renderSurface();
3744
+ return;
3745
+ }
3746
+ let u = S(s.value.parameters, l);
3747
+ if (!u.ok) {
3748
+ X(e);
3749
+ return;
3750
+ }
3751
+ let d = Date.now(), f = await Promise.race([i.query({
3752
+ dataSourceId: Ii(r),
3753
+ datasetId: n.datasetId,
3754
+ params: u.value
3755
+ }, { signal: a.signal }), c]);
3756
+ if (a.signal.aborted || o !== e.state.previewGeneration || (e.state.previewController = void 0, f === void 0)) return;
3757
+ if (!f.ok) {
3758
+ e.callbacks.report(f.diagnostics), X(e);
3759
+ return;
3760
+ }
3761
+ let p = T(f.value, { maxBytes: 1048576 });
3762
+ if (!p.ok) {
3763
+ e.callbacks.report(p.diagnostics), X(e);
3764
+ return;
3765
+ }
3766
+ let m = Ni(e, p.value);
3767
+ if (!m.ok) {
3768
+ e.callbacks.report(m.diagnostics), X(e);
3769
+ return;
3770
+ }
3771
+ e.state.preview = {
3772
+ status: "ready",
3773
+ tab: e.state.preview.tab,
3774
+ rawValue: p.value,
3775
+ consumerValue: m.value,
3776
+ message: y.dataSource.testReadyWithDuration(Li(p.value), Math.max(0, Date.now() - d)),
3777
+ testedAt: (/* @__PURE__ */ new Date()).toLocaleTimeString(),
3778
+ open: !0
3779
+ }, e.state.feedbackText = "", e.renderSurface();
3780
+ } catch {
3781
+ !a.signal.aborted && o === e.state.previewGeneration && (e.state.previewController = void 0, X(e));
3782
+ } finally {
3783
+ s !== void 0 && clearTimeout(s);
3784
+ }
3785
+ }
3786
+ async function Mi(e, t, n) {
3787
+ let r = {}, i = e.callbacks.getDocument(), a = /* @__PURE__ */ new Map();
3788
+ for (let [e, n] of Object.entries(t.params)) {
3789
+ if (n.kind === "inline") {
3790
+ r[e] = n.value;
3791
+ continue;
3792
+ }
3793
+ if (n.kind !== "variable") return;
3794
+ let t = i?.variables.find((e) => e.id === n.variableId), o = i === void 0 || t === void 0 ? void 0 : s(i, t);
3795
+ if (o?.type === "static") {
3796
+ r[e] = o.initialValue;
3797
+ continue;
3798
+ }
3799
+ if (o === void 0) return;
3800
+ a.set(e, o);
3801
+ }
3802
+ if (a.size === 0) return r;
3803
+ let o = e.callbacks.getHostCatalogPort?.();
3804
+ if (o === void 0) return;
3805
+ let c = [...new Map([...a.values()].map((e) => [e.id, e])).values()], l;
3806
+ try {
3807
+ let e = new Promise((e) => {
3808
+ l = setTimeout(() => {
3809
+ n.abort(), e(void 0);
3810
+ }, 15e3);
3811
+ }), t = Promise.all(c.map(async (e) => ({
3812
+ variable: e,
3813
+ result: await o.resolve({
3814
+ sourceId: e.sourceId,
3815
+ params: {},
3816
+ purpose: "authoring-preview",
3817
+ signal: n.signal
3818
+ })
3819
+ }))), i = await Promise.race([t, e]);
3820
+ if (i === void 0 || n.signal.aborted) return;
3821
+ let s = /* @__PURE__ */ new Map();
3822
+ for (let { variable: e, result: t } of i) {
3823
+ if (!t.ok) return;
3824
+ let n = T(t.value, { maxBytes: 1048576 });
3825
+ if (!n.ok) return;
3826
+ s.set(e.id, n.value);
3827
+ }
3828
+ for (let [e, t] of a) {
3829
+ let n = s.get(t.id);
3830
+ if (n === void 0) return;
3831
+ r[e] = n;
3832
+ }
3833
+ } catch {
3834
+ return;
3835
+ } finally {
3836
+ l !== void 0 && clearTimeout(l);
3837
+ }
3838
+ return r;
3839
+ }
3840
+ function Ni(e, t) {
3841
+ let n = e.currentEntry(), r = n?.manifest.dataBinding?.roles ?? [];
3842
+ if (r.length === 0 || n?.tabularDataAdapter === void 0) return {
3843
+ ok: !0,
3844
+ value: t,
3845
+ diagnostics: []
3846
+ };
3847
+ let i = E(t);
3848
+ if (!i.ok) return i;
3849
+ let a = b({ fields: e.state.draft?.fields ?? {} }, i.value.fields, r);
3850
+ if (!a.ok) return a;
3851
+ try {
3852
+ let e = n.tabularDataAdapter.adapt({
3853
+ dataset: i.value,
3854
+ fields: a.value.fields
3855
+ });
3856
+ return e.ok ? T(e.value, { maxBytes: 1048576 }) : e;
3857
+ } catch {
3858
+ return {
3859
+ ok: !1,
3860
+ diagnostics: [{
3861
+ severity: "error",
3862
+ code: "HOST_DATASET_ADAPTER_FAILED",
3863
+ path: [],
3864
+ message: y.dataSource.testFailed
3865
+ }]
3866
+ };
3867
+ }
3868
+ }
3869
+ function X(e) {
3870
+ e.state.preview = {
3871
+ ...j(!0),
3872
+ status: "error",
3873
+ message: y.dataSource.testFailed
3874
+ }, e.state.feedbackText = e.state.preview.message, e.renderSurface();
3875
+ }
3876
+ function Pi(e) {
3877
+ e.state.previewGeneration++, e.state.previewController?.abort(), e.state.previewController = void 0;
3878
+ }
3879
+ async function Fi(e) {
3880
+ let t = e.state.preview.rawValue;
3881
+ if (e.callbacks.requestAuthoringAction?.("copy-data", { value: JSON.stringify(t ?? null) }), t === void 0) {
3882
+ e.setFeedback(y.dataSource.copyDataUnavailable);
3883
+ return;
3884
+ }
3885
+ let n = !1;
3886
+ try {
3887
+ n = await e.callbacks.copyText?.(JSON.stringify(t, null, 2)) ?? !1;
3888
+ } catch {
3889
+ n = !1;
3890
+ }
3891
+ e.setFeedback(n ? y.dataSource.copyDataSuccess : y.dataSource.copyDataFailed);
3892
+ }
3893
+ function Ii(e) {
3894
+ let t = O(e);
3895
+ return t?.kind === "data-source-field" ? t.dataSourceId : e.id;
3896
+ }
3897
+ function Li(e) {
3898
+ if (Array.isArray(e)) return e.length;
3899
+ if (typeof e == "object" && e && !Array.isArray(e)) {
3900
+ let t = e.rows;
3901
+ if (Array.isArray(t)) return t.length;
3902
+ }
3903
+ return e === null ? 0 : 1;
3904
+ }
3905
+ //#endregion
3906
+ //#region src/browser/controllers/dataset/designer-static-cell.ts
3907
+ function Ri(e, t, n) {
3908
+ let r = e.trim();
3909
+ if (r === "") return n ? null : void 0;
3910
+ if (t === "string" || t === "date") return t === "date" && !zi(r) ? void 0 : e;
3911
+ if (t === "number") {
3912
+ let e = Number(r);
3913
+ return Number.isFinite(e) ? e : void 0;
3914
+ }
3915
+ if (/^true$/i.test(r)) return !0;
3916
+ if (/^false$/i.test(r)) return !1;
3917
+ }
3918
+ function zi(e) {
3919
+ return /^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{1,3})?)?(?:Z|[+-]\d{2}:\d{2})?)?$/.test(e) && Number.isFinite(Date.parse(e));
3920
+ }
3921
+ //#endregion
3922
+ //#region src/browser/controllers/dataset/designer-static-table-controller.ts
3923
+ function Bi(e, t) {
3924
+ e.state.staticValue = t, e.state.staticDraft = JSON.stringify(t, null, 2), e.setFeedback("");
3925
+ }
3926
+ function Z(e) {
3927
+ let t = E(e.state.staticValue);
3928
+ return t.ok ? t.value : void 0;
3929
+ }
3930
+ function Vi(e, t, n = !0) {
3931
+ let r = E(t);
3932
+ if (!r.ok) {
3933
+ e.callbacks.report(r.diagnostics), e.setFeedback(Ji(e, r.diagnostics[0]));
3934
+ return;
3935
+ }
3936
+ e.state.staticValue = r.value, e.state.staticDraft = JSON.stringify(r.value, null, 2), e.state.staticPage = Me(r.value.rows.length, e.state.staticPage, e.state.staticPageSize).page, e.setFeedback(""), n ? e.renderSurface() : Ui(e, r.value);
3937
+ }
3938
+ function Hi(e, t, n, r, i = !0) {
3939
+ let a = Z(e), o = a?.fields.find((e) => e.id === n), s = a?.rows[t];
3940
+ if (a === void 0 || o === void 0 || s === void 0) return;
3941
+ let c = Ri(r, o.valueType, o.nullable === !0);
3942
+ if (c === void 0) {
3943
+ e.setFeedback(`rows.${t}.${n}:${y.panel.enterValidValue}`);
3944
+ return;
3945
+ }
3946
+ Vi(e, {
3947
+ fields: a.fields,
3948
+ rows: a.rows.map((e, r) => r === t ? {
3949
+ ...e,
3950
+ [n]: c
3951
+ } : e)
3952
+ }, i);
3953
+ }
3954
+ function Ui(e, t) {
3955
+ let n = JSON.stringify(t.rows.slice(0, 8), null, 2), r = [e.state.panel, e.callbacks.getWorkbenchHost?.()];
3956
+ for (let e of r) for (let t of e?.querySelectorAll("[data-static-preview-value]") ?? []) t.textContent = n;
3957
+ }
3958
+ function Wi(e) {
3959
+ let t = Z(e);
3960
+ if (t === void 0 || t.rows.length >= x) return;
3961
+ let n = Object.fromEntries(t.fields.map((t) => [t.id, t.nullable === !0 ? null : qi(e, t.valueType)]));
3962
+ e.state.staticPage = Math.floor(t.rows.length / e.state.staticPageSize), Vi(e, {
3963
+ fields: t.fields,
3964
+ rows: [...t.rows, n]
3965
+ });
3966
+ }
3967
+ function Gi(e, t) {
3968
+ let n = Z(e);
3969
+ n !== void 0 && n.rows[t] !== void 0 && Vi(e, {
3970
+ fields: n.fields,
3971
+ rows: n.rows.filter((e, n) => n !== t)
3972
+ });
3973
+ }
3974
+ function Ki(e, t = !0) {
3975
+ let n = e.currentEntry()?.manifest, r = n?.defaultData ?? null;
3976
+ e.state.staticValue = r, e.state.staticDraft = JSON.stringify(r, null, 2), e.state.staticBinding = n?.staticData?.kind === "tabular" ? n.staticData.defaultBinding : void 0, e.state.staticPage = 0, e.state.feedbackText = "", t && e.renderSurface();
3977
+ }
3978
+ function qi(e, t) {
3979
+ return t === "number" ? 0 : t === "boolean" ? !1 : t === "date" ? "1970-01-01" : "";
3980
+ }
3981
+ function Ji(e, t) {
3982
+ if (t === void 0) return y.dataSource.staticInvalid;
3983
+ let n = t.path.join(".");
3984
+ return n === "" ? t.message : `${n}:${t.message}`;
3985
+ }
3986
+ //#endregion
3987
+ //#region src/browser/controllers/dataset/designer-static-data-events.ts
3988
+ function Yi(e, t) {
3989
+ if (t.dataset.dataSourceStatic !== void 0) return e.state.staticDraft = t.value, $i(e), !0;
3990
+ if (t.dataset.staticScalar !== void 0) {
3991
+ if (t.dataset.staticScalar === "number") {
3992
+ let n = Number(t.value);
3993
+ if (!Number.isFinite(n)) return !0;
3994
+ Bi(e, n);
3995
+ } else t.dataset.staticScalar === "string" && Bi(e, t.value);
3996
+ return !0;
3997
+ }
3998
+ return t.dataset.staticCellRow !== void 0 && (Hi(e, Number(t.dataset.staticCellRow), t.dataset.staticCellField ?? "", t.value, !1), !0);
3999
+ }
4000
+ function Xi(e, t) {
4001
+ let n = t.closest("[data-static-binding-field]");
4002
+ if (n !== null) {
4003
+ let t = e.currentEntry()?.manifest.dataBinding?.roles.find((e) => e.id === n.dataset.staticBindingRole), r = n.dataset.staticBindingField;
4004
+ if (t !== void 0 && r !== void 0) {
4005
+ let n = e.state.staticBinding?.fields[t.id] ?? [], i = n.includes(r) ? n.filter((e) => e !== r) : n.length < t.maxFields ? [...n, r] : n;
4006
+ e.state.staticBinding = { fields: {
4007
+ ...e.state.staticBinding?.fields,
4008
+ [t.id]: i
4009
+ } }, e.renderSurface(), e.restoreBindingFieldFocus("static", t.id, r);
4010
+ }
4011
+ return !0;
4012
+ }
4013
+ let r = t.closest("[data-static-action]");
4014
+ return r !== null && (Qi(e, r), !0);
4015
+ }
4016
+ function Zi(e, t) {
4017
+ if (t.dataset.staticScalar === "boolean" && t instanceof HTMLInputElement) return Bi(e, t.checked), !0;
4018
+ if (t.dataset.staticPageSize !== void 0 && t instanceof HTMLSelectElement) return e.state.staticPageSize = je(Number(t.value)), e.state.staticPage = 0, e.renderSurface(), !0;
4019
+ if (t.dataset.staticCellRow !== void 0 && t instanceof HTMLInputElement) return Hi(e, Number(t.dataset.staticCellRow), t.dataset.staticCellField ?? "", t.value, !1), !0;
4020
+ if (t.dataset.staticBindingRole !== void 0 && t instanceof HTMLSelectElement) {
4021
+ let n = t.dataset.staticBindingRole, r = t.multiple ? [...t.selectedOptions].map((e) => e.value) : t.value === "" ? [] : [t.value];
4022
+ return e.state.staticBinding = { fields: {
4023
+ ...e.state.staticBinding?.fields,
4024
+ [n]: r
4025
+ } }, e.renderSurface(), !0;
4026
+ }
4027
+ return !1;
4028
+ }
4029
+ function Qi(e, t) {
4030
+ let n = t.dataset.staticAction;
4031
+ if (n === "apply") {
4032
+ e.apply();
4033
+ return;
4034
+ }
4035
+ if (n === "tab-table" || n === "tab-advanced") {
4036
+ e.state.staticTab = n === "tab-table" ? "table" : "advanced", e.renderSurface();
4037
+ return;
4038
+ }
4039
+ if (n === "row-add") {
4040
+ Wi(e);
4041
+ return;
4042
+ }
4043
+ if (n === "page-previous" || n === "page-next") {
4044
+ let t = Z(e)?.rows.length ?? 0, r = e.state.staticPage + (n === "page-next" ? 1 : -1);
4045
+ e.state.staticPage = Me(t, r, e.state.staticPageSize).page, e.renderSurface();
4046
+ return;
4047
+ }
4048
+ if (n === "binding-select-all" || n === "binding-clear") {
4049
+ let r = e.currentEntry()?.manifest.dataBinding?.roles.find((e) => e.id === t.dataset.staticBindingRole), i = Z(e);
4050
+ if (r !== void 0 && i !== void 0) {
4051
+ let t = n === "binding-clear" ? [] : i.fields.filter((e) => r.valueTypes.includes(e.valueType)).slice(0, r.maxFields).map((e) => e.id);
4052
+ e.state.staticBinding = { fields: {
4053
+ ...e.state.staticBinding?.fields,
4054
+ [r.id]: t
4055
+ } }, e.renderSurface();
4056
+ }
4057
+ return;
4058
+ }
4059
+ let r = Number(t.dataset.staticIndex);
4060
+ Number.isInteger(r) && n === "row-remove" && Gi(e, r);
4061
+ }
4062
+ function $i(e) {
4063
+ let t;
4064
+ try {
4065
+ t = JSON.parse(e.state.staticDraft);
4066
+ } catch {
4067
+ e.setFeedback(y.dataSource.staticInvalid);
4068
+ return;
4069
+ }
4070
+ let n = T(t);
4071
+ if (!n.ok) {
4072
+ e.setFeedback(Ji(e, n.diagnostics[0]));
4073
+ return;
4074
+ }
4075
+ let r = e.currentEntry()?.manifest.staticData;
4076
+ if (r?.kind === "scalar" && typeof n.value !== r.valueType) {
4077
+ e.setFeedback(y.dataSource.staticInvalid);
4078
+ return;
4079
+ }
4080
+ if (r?.kind === "tabular") {
4081
+ let t = E(n.value);
4082
+ if (!t.ok) {
4083
+ e.setFeedback(Ji(e, t.diagnostics[0]));
4084
+ return;
4085
+ }
4086
+ e.state.staticValue = t.value;
4087
+ } else e.state.staticValue = n.value;
4088
+ e.setFeedback("");
4089
+ }
4090
+ //#endregion
4091
+ //#region src/browser/controllers/dataset/designer-dataset-events.ts
4092
+ function ea(e, t) {
4093
+ return !(t instanceof HTMLInputElement) && !(t instanceof HTMLTextAreaElement) ? !1 : Yi(e, t) ? (Lr(e), !0) : t.dataset.datasetVariableQuery === void 0 ? t.dataset.sourceSheetFixed === void 0 ? t.dataset.datasetQuery !== void 0 && (e.catalogController.updateQuery(t.value), !0) : (e.state.staticDraft = t.value, $(e, t.value), !0) : (e.state.variableQuery = t.value, ga(e), !0);
4094
+ }
4095
+ function ta(e, t) {
4096
+ if (Xi(e, t)) return !0;
4097
+ (t.closest("[data-value-ref-trigger]") !== null || t.closest("[data-dataset-binding-trigger]") !== null) && e.state.clearAutoApply();
4098
+ let n = t.closest("[data-data-entry]");
4099
+ if (n !== null) return na(e, n), !0;
4100
+ let r = t.closest("[data-data-source-mode]")?.dataset.dataSourceMode;
4101
+ if (r !== void 0) return di(e, r), !0;
4102
+ if (t.closest("[data-dataset-auto-match]") !== null) return _i(e), !0;
4103
+ let i = t.closest("[data-source-sheet-tab]");
4104
+ if (i !== null) {
4105
+ let t = i.dataset.sourceSheetTab;
4106
+ return t !== void 0 && t !== e.state.sourcePickerTab && (e.state.sourcePickerTab = t, e.state.catalogOpen = !0, e.renderSurface(), sa(e, t)), !0;
4107
+ }
4108
+ if (t.closest("[data-source-sheet-close]") !== null || t.classList?.contains("designer-source-sheet-layer") === !0) return ua(e), !0;
4109
+ let a = t.closest("[data-source-sheet-variable]");
4110
+ if (a?.dataset.sourceSheetVariable !== void 0) return fa(e, a.dataset.sourceSheetVariable), !0;
4111
+ if (t.closest("[data-source-sheet-apply-fixed]") !== null) return ma(e), !0;
4112
+ if (t.closest("[data-source-sheet-format]") !== null) return ha(e), !0;
4113
+ if (t.closest("[data-dataset-change]") !== null || t.closest("[data-source-kind-change]") !== null) return da(e), !0;
4114
+ if (t.closest("[data-dataset-load-more]") !== null) return e.catalogController.loadMore(), !0;
4115
+ let o = t.closest("[data-dataset-binding-chip-field]");
4116
+ if (o !== null) {
4117
+ let t = o.dataset.datasetBindingChipField, n = o.closest(".designer-bind-field")?.querySelector(`[data-dataset-binding-field="${t}"]`);
4118
+ return n != null && hi(e, n), !0;
4119
+ }
4120
+ let s = t.closest("[data-dataset-binding-trigger]");
4121
+ if (s !== null) {
4122
+ let t = s.dataset.datasetBindingTrigger ?? null;
4123
+ return e.state.bindingOpenRoleId = e.state.bindingOpenRoleId === t ? null : t, G(e, () => Y(e, t === null ? "[data-dataset-binding-trigger]" : `[data-dataset-binding-trigger="${t}"]`)), !0;
4124
+ }
4125
+ let c = t.closest("[data-dataset-binding-field]");
4126
+ if (c !== null) return hi(e, c), !0;
4127
+ e.state.bindingOpenRoleId !== null && t.closest("[data-dataset-binding-role]")?.dataset.datasetBindingRole !== e.state.bindingOpenRoleId && Ur(e);
4128
+ let l = t.closest("[data-dataset-binding-role-action]");
4129
+ if (l !== null) return gi(e, l), !0;
4130
+ let u = t.closest("[data-dataset-preview-tab]")?.dataset.datasetPreviewTab;
4131
+ if (u === "response" || u === "consumer" || u === "request") return Ai(e, u), !0;
4132
+ let d = t.closest("[data-workbench-step]")?.dataset.workbenchStep;
4133
+ if (si(d)) return e.focusWorkbenchSection(d), !0;
4134
+ let f = t.closest("[data-dataset-editor-mode]")?.dataset.datasetEditorMode;
4135
+ if (f === "visual" || f === "code") return e.state.authoring = {
4136
+ ...e.state.authoring,
4137
+ editorMode: f
4138
+ }, f === "code" && e.callbacks.requestAuthoringAction?.("open-code-editor"), G(e), !0;
4139
+ let p = t.closest("[data-dataset-authoring-action]")?.dataset.datasetAuthoringAction;
4140
+ return p === void 0 ? oa(e, t) : (p === "copy-data" ? e.copyPreviewData() : p === "fullscreen-edit" ? (e.state.workbenchOpen = !0, e.state.confirmClose = !1, e.callbacks.requestAuthoringAction?.(p), e.renderSurface(), e.focusDataWorkbench()) : e.callbacks.requestAuthoringAction?.(p), !0);
4141
+ }
4142
+ function na(e, t) {
4143
+ let n = t.dataset.dataEntry, r = t.dataset.dataEntryMode;
4144
+ n !== void 0 && r !== void 0 && (!t.disabled && t.getAttribute("aria-checked") !== "true" && di(e, r), ra(e, n));
4145
+ }
4146
+ function ra(e, t) {
4147
+ e.state.panel?.querySelector(`[data-data-entry="${t}"]`)?.focus({ preventScroll: !0 });
4148
+ }
4149
+ function ia(e) {
4150
+ if (e === "ArrowRight" || e === "ArrowDown") return "next";
4151
+ if (e === "ArrowLeft" || e === "ArrowUp") return "previous";
4152
+ if (e === "Home") return "first";
4153
+ if (e === "End") return "last";
4154
+ }
4155
+ function aa(e, t, n) {
4156
+ let r = [...t.closest("[data-data-entry-group]")?.querySelectorAll("[data-data-entry]") ?? []].filter((e) => !e.disabled), i = r.indexOf(t);
4157
+ if (i === -1 || r.length === 0) return;
4158
+ let a = n === "first" ? 0 : n === "last" ? r.length - 1 : (i + (n === "next" ? 1 : -1) + r.length) % r.length, o = r[Math.min(Math.max(a, 0), r.length - 1)];
4159
+ if (o === void 0 || o === t) {
4160
+ ra(e, t.dataset.dataEntry ?? "");
4161
+ return;
4162
+ }
4163
+ na(e, o);
4164
+ }
4165
+ function oa(e, t) {
4166
+ let n = t.closest("[data-dataset-action]"), r = n?.dataset.datasetAction;
4167
+ if (r === "select-step") {
4168
+ e.state.confirmClose = !1;
4169
+ let t = n?.dataset.datasetWorkbenchTarget, r = si(t) ? t : "source";
4170
+ return e.focusWorkbenchSection(r), r === "source" && e.state.mode === "dataset" && e.catalogController.ensureList(), !0;
4171
+ }
4172
+ if (r === "open-workbench") {
4173
+ e.state.workbenchOpen = !0, e.state.confirmClose = !1;
4174
+ let t = n?.dataset.datasetWorkbenchTarget;
4175
+ return e.state.activeStep = si(t) ? t : "source", e.state.activeStep === "preview" && (e.state.preview = {
4176
+ ...e.state.preview,
4177
+ open: !0
4178
+ }), e.renderSurface(), e.focusDataWorkbench(), !0;
4179
+ }
4180
+ if (r === "close-workbench") return _a(e);
4181
+ if (r === "keep-editing") return e.state.confirmClose = !1, e.renderSurface(), !0;
4182
+ if (r === "discard-workbench") return e.restoreDatasetDraft(), e.state.workbenchOpen = !1, e.state.confirmClose = !1, e.renderSurface(), e.restoreFullscreenActionFocus(), !0;
4183
+ if (r === "toggle-preview") return e.state.preview = {
4184
+ ...e.state.preview,
4185
+ open: !e.state.preview.open
4186
+ }, e.renderSurface(), !0;
4187
+ if (r === "apply" || r === "sync") return e.apply(), !0;
4188
+ if (r === "test") return e.testDatasetDraft(), !0;
4189
+ if (r === "undo") return e.callbacks.undo?.(), !0;
4190
+ if (r === "retry-link") return Gr(e), !0;
4191
+ if (r === "select-host-resource") {
4192
+ let t = e.currentComponent();
4193
+ return t !== void 0 && e.callbacks.requestHostResourceSelection?.(t.id, t.type), !0;
4194
+ }
4195
+ if (r === "open-instance") return e.state.workbenchOpen = !0, e.state.confirmClose = !1, e.renderSurface(), e.focusDataWorkbench(), !0;
4196
+ if (r === "refresh") return e.callbacks.refresh(e.callbacks.getInteraction().focusedComponentId ?? void 0), !0;
4197
+ let i = t.closest("[data-dataset-resource-id]");
4198
+ return i?.dataset.datasetResourceId !== void 0 && (fi(e, i.dataset.datasetResourceId, { autoApply: !0 }), !0);
4199
+ }
4200
+ function Q(e) {
4201
+ let t = e.state.panel?.getRootNode?.();
4202
+ return typeof ShadowRoot > "u" || !(t instanceof ShadowRoot) ? null : t.querySelector("[data-source-sheet]");
4203
+ }
4204
+ function sa(e, t) {
4205
+ Q(e)?.querySelector(`[data-source-sheet-tab="${t}"]`)?.focus({ preventScroll: !0 });
4206
+ }
4207
+ function ca(e) {
4208
+ sa(e, e.state.sourcePickerTab);
4209
+ }
4210
+ function la(e, t) {
4211
+ let n = Q(e)?.querySelector("[data-source-sheet]");
4212
+ if (n == null) return !1;
4213
+ let r = [...n.querySelectorAll("button:not(:disabled), input, textarea, select, [tabindex]:not([tabindex=\"-1\"])")].filter((e) => e.getClientRects().length > 0);
4214
+ if (r.length === 0) return !1;
4215
+ let i = r[0], a = r[r.length - 1], o = n.getRootNode().activeElement, s = o !== null && n.contains(o);
4216
+ return t.shiftKey && (!s || o === i) ? (t.preventDefault(), a.focus(), !0) : !t.shiftKey && (!s || o === a) && (t.preventDefault(), i.focus(), !0);
4217
+ }
4218
+ function ua(e) {
4219
+ if (!e.state.catalogOpen) return;
4220
+ e.state.catalogOpen = !1, e.renderSurface();
4221
+ let t = e.state.mode === "static" || e.state.mode === "variable" ? "[data-source-kind-change]" : "[data-dataset-change]";
4222
+ e.state.panel?.querySelector(t)?.focus({ preventScroll: !0 });
4223
+ }
4224
+ function da(e) {
4225
+ e.state.catalogOpen = !0, e.state.sourcePickerTab = e.state.mode === "variable" ? "variable" : e.state.mode === "static" ? "fixed" : "dataset", e.renderSurface(), e.catalogController.ensureList(), ca(e);
4226
+ }
4227
+ function fa(e, t) {
4228
+ e.state.mode !== "variable" && di(e, "variable"), e.state.variableSourceId = t, e.state.draftDirty = !0, e.state.catalogOpen = !1, q(e);
4229
+ }
4230
+ function pa(e) {
4231
+ return Q(e)?.querySelector("[data-source-sheet-fixed]") ?? null;
4232
+ }
4233
+ function $(e, t) {
4234
+ let n = Q(e);
4235
+ if (n === null) return;
4236
+ let r = wr(t, e.currentEntry()?.manifest.staticData), i = n.querySelector("[data-source-sheet-note]");
4237
+ i !== null && (i.textContent = r.note, i.dataset.tone = r.ok ? "ok" : "error");
4238
+ let a = n.querySelector("[data-source-sheet-apply-fixed]");
4239
+ a !== null && (a.disabled = !r.ok);
4240
+ }
4241
+ function ma(e) {
4242
+ let t = pa(e);
4243
+ if (t === null) return;
4244
+ if (!wr(t.value, e.currentEntry()?.manifest.staticData).ok) {
4245
+ $(e, t.value);
4246
+ return;
4247
+ }
4248
+ let n = e.state.mode, r = e.currentEntry()?.manifest.staticData;
4249
+ if (e.state.staticDraft = t.value, e.state.staticBinding === void 0 && r?.kind === "tabular" && r.defaultBinding !== void 0 && (e.state.staticBinding = r.defaultBinding), e.state.mode = "static", q(e), e.currentComponent()?.dataSource?.type === "static") {
4250
+ e.state.catalogOpen = !1, e.renderSurface();
4251
+ return;
4252
+ }
4253
+ e.state.mode = n;
4254
+ let i = Q(e)?.querySelector("[data-source-sheet-note]");
4255
+ i != null && (i.textContent = e.state.feedbackText || y.dataSource.staticInvalid, i.dataset.tone = "error"), e.renderSurface();
4256
+ }
4257
+ function ha(e) {
4258
+ let t = pa(e);
4259
+ if (t !== null) try {
4260
+ t.value = JSON.stringify(JSON.parse(t.value), null, 2), e.state.staticDraft = t.value, $(e, t.value);
4261
+ } catch {
4262
+ $(e, t.value);
4263
+ }
4264
+ }
4265
+ function ga(e) {
4266
+ let t = Q(e);
4267
+ if (t === null) return;
4268
+ let n = e.state.variableQuery.trim().toLowerCase(), r = 0;
4269
+ for (let e of t.querySelectorAll("[data-source-sheet-variable]")) {
4270
+ let t = e.querySelector("strong")?.textContent ?? "", i = n === "" || t.toLowerCase().includes(n);
4271
+ e.hidden = !i, i && (r += 1);
4272
+ }
4273
+ let i = t.querySelector("[data-source-sheet-variable-empty]");
4274
+ i !== null && (i.hidden = r > 0);
4275
+ }
4276
+ function _a(e) {
4277
+ return e.state.mode === "dataset" && e.state.draftDirty ? (e.state.confirmClose = !0, e.renderSurface(), !0) : (e.state.workbenchOpen = !1, e.state.confirmClose = !1, e.renderSurface(), e.restoreFullscreenActionFocus(), !0);
4278
+ }
4279
+ function va(e, t) {
4280
+ return !(t instanceof HTMLInputElement) && !(t instanceof HTMLSelectElement) && !(t instanceof HTMLTextAreaElement) ? !1 : t.dataset.dataSourceModeSelect !== void 0 && t instanceof HTMLSelectElement ? (di(e, t.value), !0) : t.dataset.datasetGroup !== void 0 && t instanceof HTMLSelectElement ? (e.catalogController.updateGroup(t.value || void 0), !0) : t.dataset.dataVariableSource !== void 0 && t instanceof HTMLSelectElement ? (e.state.variableSourceId = t.value, e.state.draftDirty = !0, e.renderSurface(), !0) : Zi(e, t) ? (Lr(e), !0) : t.dataset.datasetAuthoringSetting === void 0 ? t.dataset.datasetInstanceSelect !== void 0 && t instanceof HTMLSelectElement ? (pi(e, t.value === "" ? null : t.value), !0) : t.dataset.valueRefInline === void 0 ? t.dataset.datasetBindingRole !== void 0 && t instanceof HTMLSelectElement && (xi(e, t), !0) : ((t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement) && yi(e, t), !0) : (ya(e, t.dataset.datasetAuthoringSetting, t), !0);
4281
+ }
4282
+ function ya(e, t, n) {
4283
+ let r;
4284
+ if (t === "loadingDisabled" || t === "controlled") {
4285
+ if (!(n instanceof HTMLInputElement)) return;
4286
+ r = n.checked, e.state.authoring = {
4287
+ ...e.state.authoring,
4288
+ [t]: n.checked
4289
+ };
4290
+ } else if (t === "refreshStrategy") {
4291
+ if (!(n instanceof HTMLSelectElement)) return;
4292
+ let t = n.value === "auto" || n.value === "manual" ? n.value : "once";
4293
+ r = t, e.state.authoring = {
4294
+ ...e.state.authoring,
4295
+ refreshStrategy: t
4296
+ };
4297
+ } else if (t === "refreshInterval") {
4298
+ let t = Number(n.value);
4299
+ if (!Number.isFinite(t)) return;
4300
+ r = Math.min(3600, Math.max(1, Math.round(t))), e.state.authoring = {
4301
+ ...e.state.authoring,
4302
+ refreshInterval: r
4303
+ };
4304
+ } else return;
4305
+ e.callbacks.requestAuthoringAction?.("update-settings", {
4306
+ setting: t,
4307
+ value: r
4308
+ }), e.renderSurface();
4309
+ }
4310
+ function ba(e, t) {
4311
+ if (t.key === "Escape" && e.state.catalogOpen) return t.preventDefault(), ua(e), !0;
4312
+ if (t.key === "Tab" && e.state.catalogOpen && la(e, t)) return !0;
4313
+ if (t.key === "Escape" && e.state.bindingOpenRoleId !== null) return t.preventDefault(), e.state.bindingOpenRoleId = null, G(e), !0;
4314
+ if (t.key === "Backspace") {
4315
+ let n = t.target, r = n instanceof Element ? n.closest("[data-dataset-binding-trigger]") : null;
4316
+ if (r !== null) {
4317
+ let n = r.querySelectorAll("[data-dataset-binding-chip-field]"), i = n[n.length - 1];
4318
+ if (i !== void 0) {
4319
+ t.preventDefault();
4320
+ let n = i.closest(".designer-bind-field"), r = i.dataset.datasetBindingChipField, a = n?.querySelector(`[data-dataset-binding-field="${r}"]`);
4321
+ a != null && hi(e, a);
4322
+ }
4323
+ return !0;
4324
+ }
4325
+ }
4326
+ if (t.key === "Escape" && e.state.workbenchOpen) return t.preventDefault(), e.state.mode === "dataset" && e.state.draftDirty ? (e.state.confirmClose = !0, e.renderSurface()) : _a(e), !0;
4327
+ let n = ia(t.key);
4328
+ if (n !== void 0) {
4329
+ let r = t.target instanceof Element ? t.target.closest("[data-data-entry]") : null;
4330
+ if (r !== null) return t.preventDefault(), aa(e, r, n), !0;
4331
+ }
4332
+ if (t.key !== "Enter" || t.isComposing) return !1;
4333
+ let r = t.target;
4334
+ return (r instanceof HTMLInputElement || r instanceof HTMLSelectElement) && (r.dataset.valueRefInline !== void 0 || r.dataset.datasetBindingRole !== void 0) && (t.preventDefault(), e.apply(), !0);
4335
+ }
4336
+ //#endregion
4337
+ //#region src/browser/controllers/dataset/designer-dataset-controller.ts
4338
+ var xa = class {
4339
+ #e = new Ne();
4340
+ #t;
4341
+ #n;
4342
+ constructor(e) {
4343
+ let t = new oe((e) => Kr(this.#n, e));
4344
+ this.#t = new ke({
4345
+ getPort: e.getCatalogPort,
4346
+ report: e.report,
4347
+ setFeedback: (e) => oi(this.#n, e),
4348
+ render: () => this.renderSurface(),
4349
+ renderResults: () => Wr(this.#n)
4350
+ }), this.#n = {
4351
+ callbacks: e,
4352
+ state: this.#e,
4353
+ catalogController: this.#t,
4354
+ dataFlowScrollSync: t,
4355
+ currentComponent: () => {
4356
+ let t = e.getInteraction().focusedComponentId;
4357
+ return e.getDocument()?.components.find((e) => e.id === t);
4358
+ },
4359
+ currentEntry: () => {
4360
+ let t = e.getInteraction().focusedComponentId, n = e.getDocument()?.components.find((e) => e.id === t);
4361
+ return n === void 0 ? void 0 : e.getCatalog()?.get(n.type);
4362
+ },
4363
+ renderSurface: () => this.renderSurface(),
4364
+ setFeedback: (e) => oi(this.#n, e),
4365
+ cancelPreview: () => Pi(this.#n),
4366
+ restoreStaticExample: (e) => Ki(this.#n, e),
4367
+ apply: () => q(this.#n),
4368
+ restoreDatasetDraft: () => Di(this.#n),
4369
+ setParameterValueRef: (e, t) => vi(this.#n, e, t),
4370
+ focusWorkbenchSection: (e) => Qr(this.#n, e),
4371
+ testDatasetDraft: () => ji(this.#n),
4372
+ copyPreviewData: () => Fi(this.#n),
4373
+ focusDataWorkbench: () => $r(this.#n),
4374
+ restoreFullscreenActionFocus: () => ei(this.#n),
4375
+ restoreBindingFieldFocus: (e, t, n) => ti(this.#n, e, t, n)
4376
+ };
4377
+ }
4378
+ render(e) {
4379
+ if (ai(this.#n), this.#n.currentComponent() === void 0) {
4380
+ e !== void 0 && e.replaceChildren(y.dataPanelEmpty);
4381
+ return;
4382
+ }
4383
+ let t = mi(this.#n);
4384
+ me(this.#n.currentEntry()).includes("dataset") || this.#t.clear(), e !== void 0 && (this.#e.panel = e, this.renderSurface(), this.#e.mode === "dataset" && (this.#t.ensureList(), t !== void 0 && fi(this.#n, t.datasetId)));
4385
+ }
4386
+ getFocusedDatasetFields() {
4387
+ return this.#e.descriptor?.fields.map((e) => ({
4388
+ id: e.id,
4389
+ label: e.label
4390
+ })) ?? [];
4391
+ }
4392
+ clear() {
4393
+ this.#t.clear(), ai(this.#n), Pi(this.#n), this.#e.reset();
4394
+ }
4395
+ onInput(e) {
4396
+ return ea(this.#n, e);
4397
+ }
4398
+ onClick(e) {
4399
+ return ta(this.#n, e);
4400
+ }
4401
+ onChange(e) {
4402
+ return va(this.#n, e);
4403
+ }
4404
+ onKeyDown(e) {
4405
+ return ba(this.#n, e);
4406
+ }
4407
+ setParameterValueRef(e, t) {
4408
+ vi(this.#n, e, t);
4409
+ }
4410
+ get descriptor() {
4411
+ return this.#e.descriptor;
4412
+ }
4413
+ get mode() {
4414
+ return this.#e.mode;
4415
+ }
4416
+ get authoring() {
4417
+ return this.#e.authoring;
4418
+ }
4419
+ renderSurface() {
4420
+ Fr(this.#n);
4421
+ }
4422
+ };
4423
+ //#endregion
4424
+ export { xa as DesignerDatasetController };
4425
+
4426
+ //# sourceMappingURL=designer-dataset-controller-CPytVNBK.js.map