@airalogy/aimd-recorder 1.23.0 → 1.24.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 (81) hide show
  1. package/README.md +19 -0
  2. package/README.zh-CN.md +19 -0
  3. package/dist/{AimdCodeField-BN_0UQMx.js → AimdCodeField-CPjcXY4D.js} +1 -1
  4. package/dist/{AimdDnaSequenceField-JzxsGmRf.js → AimdDnaSequenceField-Dz-IONoA.js} +5 -4
  5. package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-v82TdP_I.js → AimdEditor.vue_vue_type_style_index_0_lang-JAD--qFs.js} +23 -3
  6. package/dist/{AimdEntityRefField-O0FwJDC0.js → AimdEntityRefField-BE0s2o5T.js} +10 -10
  7. package/dist/{AimdMarkdownField-Dd6M3zOI.js → AimdMarkdownField-BeD2t9JY.js} +19 -19
  8. package/dist/{AimdMarkdownNoteField-DCkJg80X.js → AimdMarkdownNoteField-DIgGEYpj.js} +13 -13
  9. package/dist/{_commonjsHelpers-B5RozER-.js → _commonjsHelpers-ByX85dGu.js} +12 -19
  10. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  11. package/dist/aimd-recorder.css +1 -1
  12. package/dist/{arc-Bw7VOW6S.js → arc-CLJJdrm0.js} +1 -1
  13. package/dist/{architectureDiagram-3BPJPVTR-B4RdL02h.js → architectureDiagram-3BPJPVTR-BizrFPnS.js} +3 -3
  14. package/dist/{blockDiagram-GPEHLZMM-B5skMgx6.js → blockDiagram-GPEHLZMM-IHDih8JW.js} +4 -4
  15. package/dist/{c4Diagram-AAUBKEIU-DDxL4a7C.js → c4Diagram-AAUBKEIU-BQtg8m_M.js} +2 -2
  16. package/dist/{channel-CQ1fnqoz.js → channel-D8q7AX1Z.js} +1 -1
  17. package/dist/{chunk-2J33WTMH-B08Yr5NK.js → chunk-2J33WTMH-C24lbKon.js} +1 -1
  18. package/dist/{chunk-4BX2VUAB-CyCffaPa.js → chunk-4BX2VUAB-1m_lB_xe.js} +1 -1
  19. package/dist/{chunk-55IACEB6-CztHyBOI.js → chunk-55IACEB6-BE5Nj-sd.js} +1 -1
  20. package/dist/{chunk-727SXJPM-CEVNkjmn.js → chunk-727SXJPM-Cg-Xw_d_.js} +5 -5
  21. package/dist/{chunk-AQP2D5EJ-C9t9hFOg.js → chunk-AQP2D5EJ-BvRpPCiY.js} +3 -3
  22. package/dist/{chunk-FMBD7UC4-ulCTg3qb.js → chunk-FMBD7UC4-D_44MTsg.js} +1 -1
  23. package/dist/{chunk-ND2GUHAM-D4Cbj52r.js → chunk-ND2GUHAM-tVBIo4LA.js} +1 -1
  24. package/dist/{chunk-QZHKN3VN-Rpw3UPGi.js → chunk-QZHKN3VN-B91HYLks.js} +1 -1
  25. package/dist/{classDiagram-v2-Q7XG4LA2-D8dNLFoj.js → classDiagram-4FO5ZUOK-CkejvTAN.js} +2 -2
  26. package/dist/{classDiagram-4FO5ZUOK-D8dNLFoj.js → classDiagram-v2-Q7XG4LA2-CkejvTAN.js} +2 -2
  27. package/dist/components.js +3662 -3465
  28. package/dist/composables.js +104 -103
  29. package/dist/{cose-bilkent-S5V4N54A-CzjADqxr.js → cose-bilkent-S5V4N54A-CNcuriOF.js} +2 -2
  30. package/dist/{dagre-BM42HDAG-C79MwQe7.js → dagre-BM42HDAG-DMqFGafq.js} +3 -3
  31. package/dist/{diagram-2AECGRRQ-DaQ7DMBK.js → diagram-2AECGRRQ-Cksd3pP3.js} +2 -2
  32. package/dist/{diagram-5GNKFQAL-BpWKnfL3.js → diagram-5GNKFQAL-SVjLnDJG.js} +3 -3
  33. package/dist/{diagram-KO2AKTUF-CedxET4p.js → diagram-KO2AKTUF-DfNIAG6w.js} +2 -2
  34. package/dist/{diagram-LMA3HP47-FKe9tb0g.js → diagram-LMA3HP47-DPOyCMGB.js} +2 -2
  35. package/dist/{diagram-OG6HWLK6-Bmb8IKvp.js → diagram-OG6HWLK6-BDURmT37.js} +3 -3
  36. package/dist/{erDiagram-TEJ5UH35-Chalz_c9.js → erDiagram-TEJ5UH35-N991qII9.js} +4 -4
  37. package/dist/{flowDiagram-I6XJVG4X-DPelWotf.js → flowDiagram-I6XJVG4X-BABRFuk-.js} +6 -6
  38. package/dist/{ganttDiagram-6RSMTGT7-o_Jm8a5l.js → ganttDiagram-6RSMTGT7-BMDnK96S.js} +3 -3
  39. package/dist/{gitGraphDiagram-PVQCEYII-BiwDVfiM.js → gitGraphDiagram-PVQCEYII-cEvL7Dss.js} +3 -3
  40. package/dist/{graph-_GsibXVP.js → graph-BA09aCvZ.js} +1 -1
  41. package/dist/index.js +118 -112
  42. package/dist/{infoDiagram-5YYISTIA-CaVHW6oJ.js → infoDiagram-5YYISTIA-DpC1Zthd.js} +1 -1
  43. package/dist/{ishikawaDiagram-YF4QCWOH--qCCMUuo.js → ishikawaDiagram-YF4QCWOH-CMEt_f-x.js} +1 -1
  44. package/dist/{journeyDiagram-JHISSGLW-BsT-p1ex.js → journeyDiagram-JHISSGLW-C0Qw169C.js} +4 -4
  45. package/dist/{kanban-definition-UN3LZRKU-oCTOaobR.js → kanban-definition-UN3LZRKU-caROmSUy.js} +2 -2
  46. package/dist/{layout-CAhsv4x8.js → layout-CH65__O4.js} +2 -2
  47. package/dist/{linear-CumggsyF.js → linear-B1VXpcsy.js} +1 -1
  48. package/dist/{mermaid.core-D4wVfZ2X.js → mermaid.core-Cbmwvfvk.js} +35 -35
  49. package/dist/{mindmap-definition-RKZ34NQL-NTgweVec.js → mindmap-definition-RKZ34NQL-DpTR5ilS.js} +3 -3
  50. package/dist/{pieDiagram-4H26LBE5-C1UJkrIn.js → pieDiagram-4H26LBE5-Cb_KrmWC.js} +3 -3
  51. package/dist/{quadrantDiagram-W4KKPZXB-rCJc8QbP.js → quadrantDiagram-W4KKPZXB-B5_NswmK.js} +2 -2
  52. package/dist/record.js +77 -72
  53. package/dist/{requirementDiagram-4Y6WPE33-BzHGaPaB.js → requirementDiagram-4Y6WPE33-OFwfat5D.js} +3 -3
  54. package/dist/{sankeyDiagram-5OEKKPKP-B--uus9e.js → sankeyDiagram-5OEKKPKP-BaawdZEE.js} +1 -1
  55. package/dist/{sequenceDiagram-3UESZ5HK-D7javnYQ.js → sequenceDiagram-3UESZ5HK-DLv8X8ef.js} +3 -3
  56. package/dist/{stateDiagram-AJRCARHV-DPsstQ8f.js → stateDiagram-AJRCARHV-B6F3wrsd.js} +4 -4
  57. package/dist/{stateDiagram-v2-BHNVJYJU-BhhRcq6R.js → stateDiagram-v2-BHNVJYJU-BcNEoshv.js} +2 -2
  58. package/dist/{timeline-definition-PNZ67QCA-DgnJrK74.js → timeline-definition-PNZ67QCA-CvdHJ4eQ.js} +2 -2
  59. package/dist/useCodeBlockRendering-D2viVPtA.js +3158 -0
  60. package/dist/useFieldRendering-Co4DOOvL.js +1120 -0
  61. package/dist/{index-CGb0O6x4.js → useVarHelpers-Du2obGza.js} +1663 -849
  62. package/dist/validation-oyqyD7Jp.js +5601 -0
  63. package/dist/{vennDiagram-CIIHVFJN-D1Q51ENl.js → vennDiagram-CIIHVFJN-U0GlQDjX.js} +1 -1
  64. package/dist/{wardleyDiagram-YWT4CUSO-DMfLoeaa.js → wardleyDiagram-YWT4CUSO-CzF_KMcn.js} +2 -2
  65. package/dist/{xychartDiagram-2RQKCTM6-DzF8t-UA.js → xychartDiagram-2RQKCTM6-Cljki2Vk.js} +2 -2
  66. package/package.json +5 -3
  67. package/src/__tests__/record-validation.test.ts +378 -0
  68. package/src/__tests__/recorder-wysiwyg-field-host.test.ts +26 -0
  69. package/src/components/AimdRecorder.vue +176 -5
  70. package/src/components/AimdRecorderEditor.vue +28 -1
  71. package/src/components/AimdRecorderWysiwygFieldHost.vue +4 -0
  72. package/src/components/AimdRecorderWysiwygSurface.vue +135 -4
  73. package/src/components/AimdVarTableField.vue +38 -21
  74. package/src/components/recorderMilkdownPlugin.ts +7 -0
  75. package/src/index.ts +12 -0
  76. package/src/locales.ts +30 -0
  77. package/src/record/index.ts +14 -0
  78. package/src/record/validation.ts +772 -0
  79. package/src/styles/recorder.css +32 -0
  80. package/src/types.ts +41 -0
  81. package/dist/useCodeBlockRendering-f5pBgZ96.js +0 -5083
@@ -0,0 +1,1120 @@
1
+ import { reactive as z } from "vue";
2
+ import { f as q, a0 as re, R as ne, b1 as oe, b2 as ie, b3 as se, b4 as ae, m as ce, a3 as le, b5 as ue, b6 as fe, a4 as D, X as L, _ as de, B as me, z as pe, ae as ge, b7 as B, H, q as ye, ag as we, G as be, b0 as he } from "./useVarHelpers-Du2obGza.js";
3
+ import { p as Ae } from "./useCodeBlockRendering-D2viVPtA.js";
4
+ function x(e) {
5
+ return typeof e == "string" && e.trim() ? e.trim() : void 0;
6
+ }
7
+ function _e(e) {
8
+ const t = /* @__PURE__ */ new Map();
9
+ for (const r of e.connectors ?? [])
10
+ for (const [n, i] of Object.entries(r.connectors))
11
+ t.set(n, i);
12
+ return t;
13
+ }
14
+ function Te(e) {
15
+ const t = /* @__PURE__ */ new Map();
16
+ for (const r of e.collectors ?? [])
17
+ for (const [n, i] of Object.entries(r.collectors))
18
+ t.set(n, i);
19
+ return t;
20
+ }
21
+ function Ee(e, t) {
22
+ const r = e.var_definitions?.find((f) => f.id === t), n = x(r?.kwargs?.collector);
23
+ if (!r || !n) return null;
24
+ const i = Te(e).get(n);
25
+ if (!i) return null;
26
+ const s = _e(e).get(i.connector);
27
+ if (!s) return null;
28
+ const c = String(r.type ?? "").replace(/\s+/g, "");
29
+ return {
30
+ collector: i,
31
+ connector: s,
32
+ field: r,
33
+ fieldKey: `var:${t}`,
34
+ isList: /^(?:list|List)\[Observation\[/.test(c),
35
+ isSeries: /^ObservationSeriesRef\[/.test(c)
36
+ };
37
+ }
38
+ function Se(e, t) {
39
+ if (e == null || e === "") return t;
40
+ if (typeof e != "string")
41
+ throw new Error("Collector observed_at must be an ISO 8601 string");
42
+ const r = new Date(e);
43
+ if (Number.isNaN(r.getTime()))
44
+ throw new Error("Collector observed_at must be a valid ISO 8601 timestamp");
45
+ return r.toISOString();
46
+ }
47
+ function Oe(e) {
48
+ return !!(e && typeof e == "object" && !Array.isArray(e) && Object.prototype.hasOwnProperty.call(e, "value"));
49
+ }
50
+ function ve(e, t) {
51
+ const r = (/* @__PURE__ */ new Date()).toISOString(), n = Oe(e) ? e : { value: e }, i = x(n.unit) ?? x(t.field.kwargs?.unit), s = x(n.quality), c = x(n.device_id);
52
+ return {
53
+ value: n.value,
54
+ observed_at: Se(n.observed_at, r),
55
+ received_at: r,
56
+ source: {
57
+ kind: "collector",
58
+ connector: t.connector.id,
59
+ collector: t.collector.id,
60
+ ...c ? { device_id: c } : {}
61
+ },
62
+ ...i ? { unit: i } : {},
63
+ ...s ? { quality: s } : {},
64
+ ...typeof n.sequence == "number" && Number.isFinite(n.sequence) ? { sequence: n.sequence } : {},
65
+ ...n.metadata && typeof n.metadata == "object" && !Array.isArray(n.metadata) ? { metadata: { ...n.metadata } } : {}
66
+ };
67
+ }
68
+ function xe(e, t, r, n) {
69
+ const i = (/* @__PURE__ */ new Date()).toISOString(), s = x(r.field.kwargs?.unit), c = x(n);
70
+ return {
71
+ value: e,
72
+ observed_at: i,
73
+ received_at: i,
74
+ source: {
75
+ kind: "manual",
76
+ collector: r.collector.id,
77
+ reason: t.trim(),
78
+ ...c ? { actor_id: c } : {}
79
+ },
80
+ ...s ? { unit: s } : {}
81
+ };
82
+ }
83
+ function W(e) {
84
+ return Array.isArray(e) ? e.length : e == null ? 0 : 1;
85
+ }
86
+ function Fe(e, t) {
87
+ return new Promise((r) => {
88
+ if (t.aborted) {
89
+ r();
90
+ return;
91
+ }
92
+ const n = setTimeout(r, e);
93
+ t.addEventListener("abort", () => {
94
+ clearTimeout(n), r();
95
+ }, { once: !0 });
96
+ });
97
+ }
98
+ function X(e) {
99
+ return e instanceof Error ? e.message : String(e);
100
+ }
101
+ function je(e) {
102
+ return e.replace(/\s+/g, "").match(/Observation\[(.+?)\]/)?.[1] ?? "str";
103
+ }
104
+ function mt(e, t) {
105
+ const r = je(e).toLowerCase();
106
+ if (r === "str" || r === "string") return { ok: !0, value: t };
107
+ if (r === "int" || r === "integer")
108
+ return /^[+-]?\d+$/.test(t.trim()) ? { ok: !0, value: Number.parseInt(t.trim(), 10) } : { ok: !1 };
109
+ if (["float", "number", "decimal"].includes(r)) {
110
+ const n = Number(t.trim());
111
+ return t.trim() && Number.isFinite(n) ? { ok: !0, value: n } : { ok: !1 };
112
+ }
113
+ if (r === "bool" || r === "boolean") {
114
+ const n = t.trim().toLowerCase();
115
+ return ["true", "1", "yes"].includes(n) ? { ok: !0, value: !0 } : ["false", "0", "no"].includes(n) ? { ok: !0, value: !1 } : { ok: !1 };
116
+ }
117
+ try {
118
+ return { ok: !0, value: JSON.parse(t) };
119
+ } catch {
120
+ return { ok: !1 };
121
+ }
122
+ }
123
+ function pt(e) {
124
+ const t = z({}), r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
125
+ let s = 0;
126
+ function c(o) {
127
+ return Ee(e.fields(), o);
128
+ }
129
+ function f(o) {
130
+ const a = t[o];
131
+ if (a) return a;
132
+ const u = z({
133
+ status: "idle",
134
+ sampleCount: W(e.record.var[o])
135
+ });
136
+ return t[o] = u, u;
137
+ }
138
+ function d(o, a) {
139
+ Object.assign(f(o), a);
140
+ }
141
+ function p(o, a) {
142
+ const u = c(o);
143
+ if (!u) return;
144
+ const m = e.record.var[o], g = u.isList ? [...Array.isArray(m) ? m : [], a] : a;
145
+ e.onChange(o, g), d(o, {
146
+ lastObservedAt: a.observed_at,
147
+ sampleCount: W(g)
148
+ });
149
+ }
150
+ async function h(o) {
151
+ if (n.has(o.collector.id)) return !0;
152
+ const a = e.requestPermission();
153
+ if (!a) return !0;
154
+ d(o.field.id, { status: "waiting_for_permission", error: void 0 });
155
+ const u = await a({
156
+ connector: o.connector,
157
+ collector: o.collector,
158
+ fieldKey: o.fieldKey,
159
+ record: q(e.record)
160
+ });
161
+ return u === "record" && n.add(o.collector.id), u === !0 || u === "once" || u === "record";
162
+ }
163
+ async function T(o, a) {
164
+ const u = e.providers()?.[o.connector.id];
165
+ if (!u) throw new Error(`No Collector provider is registered for ${o.connector.id}`);
166
+ const m = await u.read({
167
+ connector: o.connector,
168
+ collector: o.collector,
169
+ fieldKey: o.fieldKey,
170
+ record: q(e.record),
171
+ signal: a
172
+ });
173
+ a.aborted || p(o.field.id, ve(m, o));
174
+ }
175
+ async function E(o) {
176
+ const a = c(o);
177
+ if (!a || r.has(o) || i.has(o)) return;
178
+ if (a.collector.mode === "stream" || a.isSeries) {
179
+ d(o, { status: "unsupported", error: void 0 });
180
+ return;
181
+ }
182
+ if (!e.providers()?.[a.connector.id]) {
183
+ d(o, { status: "error", error: "provider_unavailable" });
184
+ return;
185
+ }
186
+ const u = s;
187
+ i.add(o);
188
+ try {
189
+ const g = await h(a);
190
+ if (u !== s) return;
191
+ if (!g) {
192
+ d(o, { status: "error", error: "permission_denied" });
193
+ return;
194
+ }
195
+ } catch (g) {
196
+ const O = X(g);
197
+ d(o, { status: "error", error: O }), e.onError?.(O);
198
+ return;
199
+ } finally {
200
+ i.delete(o);
201
+ }
202
+ const m = new AbortController();
203
+ r.set(o, m), d(o, { status: "connecting", error: void 0 });
204
+ try {
205
+ if (a.collector.mode === "snapshot") {
206
+ await T(a, m.signal), d(o, { status: "completed" });
207
+ return;
208
+ }
209
+ d(o, { status: "collecting" });
210
+ const g = a.collector.interval_ms ?? 1e3;
211
+ for (; !m.signal.aborted && (await T(a, m.signal), !m.signal.aborted); )
212
+ await Fe(g, m.signal);
213
+ d(o, { status: "completed" });
214
+ } catch (g) {
215
+ if (!m.signal.aborted) {
216
+ const O = X(g);
217
+ d(o, { status: "error", error: O }), e.onError?.(O);
218
+ }
219
+ } finally {
220
+ r.get(o) === m && r.delete(o);
221
+ }
222
+ }
223
+ function _(o) {
224
+ const a = r.get(o);
225
+ a && (d(o, { status: "stopping" }), a.abort());
226
+ }
227
+ function S(o) {
228
+ s += 1, i.clear();
229
+ for (const a of r.values()) a.abort();
230
+ r.clear();
231
+ for (const a of Object.values(t))
232
+ ["connecting", "collecting", "stopping", "waiting_for_permission"].includes(a.status) && (a.status = "completed");
233
+ o?.resetPermissions && n.clear();
234
+ }
235
+ function v(o, a, u) {
236
+ const m = c(o);
237
+ return !m || !m.collector.manual_fallback || !u.trim() ? !1 : (p(o, xe(a, u, m, e.actorId())), d(o, { status: "completed", error: void 0 }), !0);
238
+ }
239
+ function F(o) {
240
+ const a = c(o);
241
+ return !!(a && e.providers()?.[a.connector.id]);
242
+ }
243
+ function l(o) {
244
+ return r.has(o);
245
+ }
246
+ return {
247
+ states: t,
248
+ getState: f,
249
+ resolveBinding: c,
250
+ hasProvider: F,
251
+ isRunning: l,
252
+ start: E,
253
+ stop: _,
254
+ stopAll: S,
255
+ writeManual: v
256
+ };
257
+ }
258
+ function A(e) {
259
+ return e !== null && typeof e == "object" && !Array.isArray(e);
260
+ }
261
+ function Ve(e) {
262
+ return A(e) && Object.keys(e).length === 0;
263
+ }
264
+ function Q(e, t) {
265
+ for (const r of t) {
266
+ const n = e[r];
267
+ if (typeof n == "string" && n.trim())
268
+ return n.trim();
269
+ }
270
+ }
271
+ function Y(e) {
272
+ if (typeof e == "string" && e.trim())
273
+ return e.trim();
274
+ if (A(e))
275
+ return Q(e, [
276
+ "error_message",
277
+ "errorMessage",
278
+ "message",
279
+ "detail",
280
+ "reason"
281
+ ]);
282
+ }
283
+ function Z(e) {
284
+ const t = [e], r = (n) => {
285
+ A(n) && (t.push(n.data), t.push(n.result), A(n.data) && t.push(n.data.result), A(n.result) && t.push(n.result.data));
286
+ };
287
+ return r(e), A(e) && (r(e.data), r(e.result)), t;
288
+ }
289
+ function De(e) {
290
+ if (typeof e == "string" && e.trim()) return e.trim();
291
+ if (!A(e)) return "";
292
+ const t = e.name ?? e.id;
293
+ return typeof t == "string" && t.trim() ? t.trim() : "";
294
+ }
295
+ function M(e) {
296
+ return Array.isArray(e) ? new Set(e.map(De).filter(Boolean)) : /* @__PURE__ */ new Set();
297
+ }
298
+ function ee(e) {
299
+ if (!A(e)) return [];
300
+ const t = e.dependent_fields;
301
+ return Array.isArray(t) ? t.map((r) => typeof r == "string" ? r.trim() : "").filter(Boolean) : [];
302
+ }
303
+ function Me(e) {
304
+ return A(e) ? (Array.isArray(e.assigned_fields) ? e.assigned_fields : Array.isArray(e.assignedFields) ? e.assignedFields : []).map((r) => typeof r == "string" ? r.trim() : "").filter(Boolean) : [];
305
+ }
306
+ function ke(e) {
307
+ if (!A(e)) return "manual";
308
+ const t = e.mode;
309
+ return typeof t == "string" && t.trim() ? t.trim() : "manual";
310
+ }
311
+ function gt(e) {
312
+ return e === "auto" || e === "auto_first" || e === "auto_force" || e === "manual" || e === "manual_readonly" || e === "auto_readonly" ? e : "manual";
313
+ }
314
+ function yt(e) {
315
+ return e === "auto_readonly" || e === "manual_readonly";
316
+ }
317
+ function Re(e) {
318
+ return {
319
+ var: M(e?.var),
320
+ varTable: M(e?.var_table),
321
+ step: M(e?.step),
322
+ check: M(e?.check)
323
+ };
324
+ }
325
+ function Ne(e, t = {}) {
326
+ const r = e.trim();
327
+ if (r.includes(".")) {
328
+ const [n, ...i] = r.split(".");
329
+ return `var_table:${n}:${i.join(".")}`;
330
+ }
331
+ return t.varTable?.has(r) ? `var_table:${r}` : t.step?.has(r) ? `step:${r}` : t.check?.has(r) ? `check:${r}` : `var:${r}`;
332
+ }
333
+ function wt(e, t) {
334
+ if (!e || typeof e != "object" || Array.isArray(e))
335
+ return [];
336
+ const r = Re(t);
337
+ return Object.entries(e).flatMap(([n, i]) => {
338
+ const s = n.trim();
339
+ if (!s) return [];
340
+ const c = A(i) ? i : {}, f = ke(c), d = ee(c);
341
+ return [.../* @__PURE__ */ new Set([
342
+ s,
343
+ ...Me(c)
344
+ ])].map((h) => ({
345
+ assignedField: h,
346
+ fieldKey: Ne(h, r),
347
+ mode: f,
348
+ dependentFields: d,
349
+ assigner: c
350
+ }));
351
+ });
352
+ }
353
+ function k(e) {
354
+ if (e !== "") {
355
+ if (Array.isArray(e))
356
+ return e.map((r) => k(r)).filter((r) => r !== void 0 && !Ve(r));
357
+ if (A(e)) {
358
+ const t = oe(e);
359
+ return ie(t) ? t : Object.fromEntries(
360
+ Object.entries(e).map(([n, i]) => [n, k(i)]).filter(([, n]) => n !== void 0)
361
+ );
362
+ }
363
+ return e;
364
+ }
365
+ }
366
+ function Ce(e) {
367
+ const t = k(e);
368
+ return A(t) ? t : {};
369
+ }
370
+ function Le(e, t) {
371
+ if (Object.prototype.hasOwnProperty.call(e.var, t)) return e.var[t];
372
+ if (Object.prototype.hasOwnProperty.call(e.step, t)) return e.step[t];
373
+ if (Object.prototype.hasOwnProperty.call(e.check, t)) return e.check[t];
374
+ if (Object.prototype.hasOwnProperty.call(e.quiz, t)) return e.quiz[t];
375
+ if (t.includes(".")) {
376
+ const [r, ...n] = t.split("."), i = n.join("."), s = e.var[r];
377
+ if (Array.isArray(s) && i)
378
+ return s.map((c) => A(c) ? c[i] : void 0);
379
+ }
380
+ }
381
+ function bt(e, t) {
382
+ const r = Array.isArray(t?.dependentFields) ? t.dependentFields : ee(t);
383
+ return r.length === 0 ? Ce(e.var) : Object.fromEntries(
384
+ r.map((n) => [n, k(Le(e, n))]).filter(([, n]) => n !== void 0)
385
+ );
386
+ }
387
+ function ht(e) {
388
+ const t = Z(e);
389
+ for (const r of t) {
390
+ if (!A(r)) continue;
391
+ const n = r.assigned_fields;
392
+ if (A(n)) return n;
393
+ const i = r.assignedFields;
394
+ if (A(i)) return i;
395
+ }
396
+ return {};
397
+ }
398
+ function At(e) {
399
+ const t = Z(e);
400
+ for (const r of t) {
401
+ if (!A(r)) continue;
402
+ const n = r.success, i = r.status;
403
+ if (n === !1 || n === "false" || i === "error" || i === "failed")
404
+ return Q(r, [
405
+ "error_message",
406
+ "errorMessage",
407
+ "message",
408
+ "detail",
409
+ "reason",
410
+ "output"
411
+ ]) ?? Y(r.error) ?? Y(r.exception) ?? "Assigner failed";
412
+ }
413
+ }
414
+ function _t(e, t) {
415
+ let r = !1;
416
+ for (const [n, i] of Object.entries(t)) {
417
+ const s = n.trim();
418
+ if (s) {
419
+ if (s.includes(".")) {
420
+ const [c, ...f] = s.split("."), d = f.join("."), p = e.var[c];
421
+ if (Array.isArray(p) && d) {
422
+ Array.isArray(i) ? p.forEach((h, T) => {
423
+ A(h) && T < i.length && (h[d] = i[T]);
424
+ }) : p.forEach((h) => {
425
+ A(h) && (h[d] = i);
426
+ }), r = !0;
427
+ continue;
428
+ }
429
+ }
430
+ if (Object.prototype.hasOwnProperty.call(e.step, s)) {
431
+ e.step[s] = re(i), r = !0;
432
+ continue;
433
+ }
434
+ if (Object.prototype.hasOwnProperty.call(e.check, s)) {
435
+ e.check[s] = ne(i), r = !0;
436
+ continue;
437
+ }
438
+ e.var[s] = i, r = !0;
439
+ }
440
+ }
441
+ return r;
442
+ }
443
+ function Tt(e, t) {
444
+ const r = `${e}:`;
445
+ return t.startsWith(r) ? t.slice(r.length) : t;
446
+ }
447
+ function ze(e) {
448
+ if (typeof window > "u")
449
+ return !1;
450
+ const t = window.getComputedStyle(e), r = t.overflowY || t.overflow, n = t.overflowX || t.overflow, i = /(auto|scroll|overlay)/.test(r) && e.scrollHeight > e.clientHeight, s = /(auto|scroll|overlay)/.test(n) && e.scrollWidth > e.clientWidth;
451
+ return i || s;
452
+ }
453
+ function $e(e, t) {
454
+ const r = [], n = /* @__PURE__ */ new Set(), i = (s) => {
455
+ let c = s;
456
+ for (; c && c !== document.body; )
457
+ !n.has(c) && ze(c) && (n.add(c), r.push({
458
+ element: c,
459
+ top: c.scrollTop,
460
+ left: c.scrollLeft
461
+ })), c = c.parentElement;
462
+ };
463
+ return i(t), i(e), r.length ? r : void 0;
464
+ }
465
+ function Et(e) {
466
+ if (typeof document > "u" || !e)
467
+ return null;
468
+ const t = document.activeElement;
469
+ if (!(t instanceof HTMLElement) || !e.contains(t))
470
+ return null;
471
+ const r = t.dataset.recFocusKey;
472
+ if (!r)
473
+ return null;
474
+ const n = { key: r };
475
+ return (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement) && (n.selectionStart = t.selectionStart, n.selectionEnd = t.selectionEnd, n.selectionDirection = t.selectionDirection), n.scrollTargets = $e(e, t), n.windowScrollX = window.scrollX, n.windowScrollY = window.scrollY, n;
476
+ }
477
+ function St(e, t) {
478
+ if (!t || !e)
479
+ return;
480
+ const r = e.querySelectorAll("[data-rec-focus-key]");
481
+ let n = null;
482
+ for (let i = 0; i < r.length; i += 1)
483
+ if (r[i].dataset.recFocusKey === t.key) {
484
+ n = r[i];
485
+ break;
486
+ }
487
+ if (n) {
488
+ try {
489
+ n.focus({ preventScroll: !0 });
490
+ } catch {
491
+ n.focus();
492
+ }
493
+ if ((n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement) && t.selectionStart != null && t.selectionEnd != null)
494
+ try {
495
+ n.setSelectionRange(
496
+ t.selectionStart,
497
+ t.selectionEnd,
498
+ t.selectionDirection ?? void 0
499
+ );
500
+ } catch {
501
+ }
502
+ for (const i of t.scrollTargets ?? [])
503
+ i.element.scrollTop = i.top, i.element.scrollLeft = i.left;
504
+ typeof window < "u" && window.scrollTo(t.windowScrollX ?? window.scrollX, t.windowScrollY ?? window.scrollY);
505
+ }
506
+ }
507
+ const Pe = [
508
+ {
509
+ pattern: /\b(?:import|export|class|new|async|await|yield|throw|try|catch|switch|while|for|do)\b/,
510
+ message: "contains unsupported control-flow or module syntax"
511
+ },
512
+ {
513
+ pattern: /=>/,
514
+ message: "does not allow arrow functions"
515
+ },
516
+ {
517
+ pattern: /\b(?:window|document|globalThis|self|fetch|XMLHttpRequest|WebSocket|Function|eval|setTimeout|setInterval)\b/,
518
+ message: "uses blocked runtime globals"
519
+ },
520
+ {
521
+ pattern: /\b(?:__proto__|prototype|constructor|this)\b/,
522
+ message: "uses blocked object metaprogramming features"
523
+ },
524
+ {
525
+ pattern: /\bMath\s*\.\s*random\b/,
526
+ message: "must not use randomness"
527
+ },
528
+ {
529
+ pattern: /\bDate\b/,
530
+ message: "must not use time-dependent APIs"
531
+ }
532
+ ], Ie = {
533
+ ImportDeclaration: "contains unsupported control-flow or module syntax",
534
+ ImportExpression: "contains unsupported control-flow or module syntax",
535
+ ExportNamedDeclaration: "contains unsupported control-flow or module syntax",
536
+ ExportDefaultDeclaration: "contains unsupported control-flow or module syntax",
537
+ ExportAllDeclaration: "contains unsupported control-flow or module syntax",
538
+ ClassDeclaration: "contains unsupported control-flow or module syntax",
539
+ ClassExpression: "contains unsupported control-flow or module syntax",
540
+ NewExpression: "contains unsupported control-flow or module syntax",
541
+ ArrowFunctionExpression: "does not allow arrow functions",
542
+ AwaitExpression: "contains unsupported control-flow or module syntax",
543
+ YieldExpression: "contains unsupported control-flow or module syntax",
544
+ ThrowStatement: "contains unsupported control-flow or module syntax",
545
+ TryStatement: "contains unsupported control-flow or module syntax",
546
+ SwitchStatement: "contains unsupported control-flow or module syntax",
547
+ WhileStatement: "contains unsupported control-flow or module syntax",
548
+ ForStatement: "contains unsupported control-flow or module syntax",
549
+ ForInStatement: "contains unsupported control-flow or module syntax",
550
+ ForOfStatement: "contains unsupported control-flow or module syntax",
551
+ DoWhileStatement: "contains unsupported control-flow or module syntax"
552
+ }, qe = /* @__PURE__ */ new Set([
553
+ "window",
554
+ "document",
555
+ "globalThis",
556
+ "self",
557
+ "fetch",
558
+ "XMLHttpRequest",
559
+ "WebSocket",
560
+ "Function",
561
+ "eval",
562
+ "setTimeout",
563
+ "setInterval"
564
+ ]), Be = /* @__PURE__ */ new Set([
565
+ "__proto__",
566
+ "prototype",
567
+ "constructor"
568
+ ]);
569
+ function $(e, t) {
570
+ if (!(!e || typeof e != "object")) {
571
+ t(e);
572
+ for (const r of Object.keys(e)) {
573
+ if (r === "type" || r === "start" || r === "end") continue;
574
+ const n = e[r];
575
+ if (Array.isArray(n))
576
+ for (const i of n)
577
+ i && typeof i.type == "string" && $(i, t);
578
+ else n && typeof n == "object" && typeof n.type == "string" && $(n, t);
579
+ }
580
+ }
581
+ }
582
+ function J(e, t) {
583
+ if (qe.has(e))
584
+ throw new Error(`client assigner "${t}" uses blocked runtime globals`);
585
+ if (Be.has(e))
586
+ throw new Error(`client assigner "${t}" uses blocked object metaprogramming features`);
587
+ if (e === "Date")
588
+ throw new Error(`client assigner "${t}" must not use time-dependent APIs`);
589
+ }
590
+ function He(e, t) {
591
+ let r;
592
+ try {
593
+ r = Ae(e, {
594
+ ecmaVersion: 2022,
595
+ sourceType: "script"
596
+ });
597
+ } catch {
598
+ throw new Error(`client assigner "${t}" contains invalid JavaScript syntax`);
599
+ }
600
+ let n = 0, i = !1;
601
+ if ($(r, (s) => {
602
+ const c = Ie[s.type];
603
+ if (c)
604
+ throw new Error(`client assigner "${t}" ${c}`);
605
+ if (s.type === "FunctionDeclaration" || s.type === "FunctionExpression") {
606
+ if (n++, s.async)
607
+ throw new Error(`client assigner "${t}" contains unsupported control-flow or module syntax`);
608
+ if (s.generator)
609
+ throw new Error(`client assigner "${t}" contains unsupported control-flow or module syntax`);
610
+ }
611
+ if (s.type === "ReturnStatement" && (i = !0), s.type === "ThisExpression")
612
+ throw new Error(`client assigner "${t}" uses blocked object metaprogramming features`);
613
+ if (s.type === "Identifier" && J(s.name, t), s.type === "MemberExpression" && s.computed && s.property?.type === "Literal" && typeof s.property.value == "string" && J(s.property.value, t), s.type === "MemberExpression" && !s.computed && s.object?.type === "Identifier" && s.object.name === "Math" && s.property?.type === "Identifier" && s.property.name === "random")
614
+ throw new Error(`client assigner "${t}" must not use randomness`);
615
+ }), n !== 1)
616
+ throw new Error(`client assigner "${t}" must contain exactly one function definition`);
617
+ if (!i)
618
+ throw new Error(`client assigner "${t}" must return an object containing assigned field values`);
619
+ }
620
+ function We(e, t) {
621
+ if ((e.match(/\bfunction\b/g) ?? []).length !== 1)
622
+ throw new Error(`client assigner "${t}" must contain exactly one function definition`);
623
+ for (const { pattern: n, message: i } of Pe)
624
+ if (n.test(e))
625
+ throw new Error(`client assigner "${t}" ${i}`);
626
+ if (!/\breturn\b/.test(e))
627
+ throw new Error(`client assigner "${t}" must return an object containing assigned field values`);
628
+ He(e, t);
629
+ }
630
+ const G = /* @__PURE__ */ new Map(), Xe = Object.freeze({
631
+ abs: Math.abs,
632
+ ceil: Math.ceil,
633
+ floor: Math.floor,
634
+ max: Math.max,
635
+ min: Math.min,
636
+ pow: Math.pow,
637
+ round: Math.round,
638
+ trunc: Math.trunc
639
+ }), Ye = Object.freeze({
640
+ entries: Object.entries,
641
+ fromEntries: Object.fromEntries,
642
+ keys: Object.keys,
643
+ values: Object.values
644
+ }), Je = Object.freeze({
645
+ isArray: Array.isArray
646
+ }), Ge = Object.freeze({
647
+ parse: JSON.parse,
648
+ stringify: JSON.stringify
649
+ });
650
+ function R(e) {
651
+ return !!e && typeof e == "object" && !Array.isArray(e);
652
+ }
653
+ function N(e) {
654
+ return Array.isArray(e) ? e.map((t) => N(t)) : R(e) ? Object.fromEntries(
655
+ Object.entries(e).map(([t, r]) => [t, N(r)])
656
+ ) : e;
657
+ }
658
+ function P(e, t) {
659
+ if (Object.is(e, t))
660
+ return !0;
661
+ if (Array.isArray(e) && Array.isArray(t))
662
+ return e.length !== t.length ? !1 : e.every((r, n) => P(r, t[n]));
663
+ if (R(e) && R(t)) {
664
+ const r = Object.keys(e), n = Object.keys(t);
665
+ return r.length !== n.length ? !1 : r.every((i) => i in t && P(e[i], t[i]));
666
+ }
667
+ return !1;
668
+ }
669
+ function te(e) {
670
+ return e === null || typeof e > "u" ? !1 : typeof e == "string" ? e.trim().length > 0 : !0;
671
+ }
672
+ function Ue(e) {
673
+ if (typeof e == "number")
674
+ return Number.isFinite(e) ? e : void 0;
675
+ if (typeof e == "string" && e.trim()) {
676
+ const t = Number(e);
677
+ return Number.isFinite(t) ? t : void 0;
678
+ }
679
+ }
680
+ function Ke(e, t) {
681
+ return t ? se(t.type) && Ue(e) === void 0 ? !1 : ae(e, t.type, t.kwargs) === null : !0;
682
+ }
683
+ function Qe(e, t, r) {
684
+ return te(t) && Ke(t, r?.[e]);
685
+ }
686
+ function Ze(e, t) {
687
+ const r = /* @__PURE__ */ new Set();
688
+ for (const n of e.dependent_fields) {
689
+ const i = t.get(n);
690
+ i && i !== e.id && r.add(i);
691
+ }
692
+ return r;
693
+ }
694
+ function et(e) {
695
+ const t = new Map(e.map((c) => [c.id, c])), r = /* @__PURE__ */ new Map();
696
+ for (const c of e)
697
+ for (const f of c.assigned_fields)
698
+ r.set(f, c.id);
699
+ const n = /* @__PURE__ */ new Set(), i = [];
700
+ function s(c) {
701
+ if (!n.has(c.id)) {
702
+ n.add(c.id);
703
+ for (const f of Ze(c, r)) {
704
+ const d = t.get(f);
705
+ d && s(d);
706
+ }
707
+ i.push(c);
708
+ }
709
+ }
710
+ for (const c of e)
711
+ s(c);
712
+ return i;
713
+ }
714
+ function tt(e, t) {
715
+ return e.assigned_fields.every((r) => !te(t[r]));
716
+ }
717
+ function rt(e, t, r) {
718
+ return e.dependent_fields.every((n) => Qe(n, t[n], r?.fieldDefinitions));
719
+ }
720
+ function nt(e) {
721
+ const t = G.get(e.function_source);
722
+ if (t)
723
+ return t;
724
+ We(e.function_source, e.id);
725
+ const n = new Function(
726
+ "__math__",
727
+ "__object__",
728
+ "__array__",
729
+ "__json__",
730
+ `"use strict";
731
+ const Math = __math__;
732
+ const Object = __object__;
733
+ const Array = __array__;
734
+ const JSON = __json__;
735
+ const window = undefined;
736
+ const document = undefined;
737
+ const globalThis = undefined;
738
+ const self = undefined;
739
+ const fetch = undefined;
740
+ const XMLHttpRequest = undefined;
741
+ const WebSocket = undefined;
742
+ const Function = undefined;
743
+ const setTimeout = undefined;
744
+ const setInterval = undefined;
745
+ const Date = undefined;
746
+ return (${e.function_source});
747
+ `
748
+ )(
749
+ Xe,
750
+ Ye,
751
+ Je,
752
+ Ge
753
+ );
754
+ if (typeof n != "function")
755
+ throw new Error(`client assigner "${e.id}" did not compile to a callable function`);
756
+ return G.set(e.function_source, n), n;
757
+ }
758
+ function ot(e, t) {
759
+ const r = nt(e), n = Object.fromEntries(
760
+ e.dependent_fields.map((f) => [f, N(t[f])])
761
+ ), i = r(n);
762
+ if (!R(i))
763
+ throw new Error(`client assigner "${e.id}" must return an object`);
764
+ const s = e.assigned_fields.filter((f) => !(f in i));
765
+ if (s.length > 0)
766
+ throw new Error(`client assigner "${e.id}" is missing assigned fields: ${s.join(", ")}`);
767
+ const c = Object.keys(i).filter((f) => !e.assigned_fields.includes(f));
768
+ if (c.length > 0)
769
+ throw new Error(`client assigner "${e.id}" returned fields not declared in assigned_fields: ${c.join(", ")}`);
770
+ return Object.fromEntries(
771
+ e.assigned_fields.map((f) => [f, N(i[f])])
772
+ );
773
+ }
774
+ function it(e, t, r) {
775
+ if (e.length === 0)
776
+ return { changed: !1, changedFields: [] };
777
+ const n = new Set(r?.triggerIds ?? []), i = /* @__PURE__ */ new Set();
778
+ for (const s of et(e)) {
779
+ if (!rt(s, t, r) || !n.has(s.id) && (s.mode === "manual" || s.mode === "auto_first" && !tt(s, t)))
780
+ continue;
781
+ const f = ot(s, t);
782
+ for (const [d, p] of Object.entries(f))
783
+ P(t[d], p) || (t[d] = p, i.add(d));
784
+ }
785
+ return {
786
+ changed: i.size > 0,
787
+ changedFields: Array.from(i)
788
+ };
789
+ }
790
+ function Ot(e) {
791
+ const {
792
+ readonly: t,
793
+ clientAssigners: r,
794
+ fieldDefinitions: n,
795
+ localRecord: i,
796
+ onError: s,
797
+ emitRecordUpdate: c,
798
+ scheduleInlineRebuild: f
799
+ } = e;
800
+ function d(E) {
801
+ if (t() || r.value.length === 0)
802
+ return !1;
803
+ try {
804
+ return it(r.value, i.var, {
805
+ ...E,
806
+ fieldDefinitions: n?.()
807
+ }).changed;
808
+ } catch (_) {
809
+ const S = _ instanceof Error ? _.message : String(_);
810
+ return s(`Client assigner error: ${S}`), !1;
811
+ }
812
+ }
813
+ function p() {
814
+ return d();
815
+ }
816
+ function h(E) {
817
+ const _ = d({ triggerIds: [E] });
818
+ return _ && (c(), f()), _;
819
+ }
820
+ function T(E) {
821
+ const _ = E?.length ? E : r.value.filter((v) => v.mode === "manual").map((v) => v.id);
822
+ if (_.length === 0)
823
+ return !1;
824
+ const S = d({ triggerIds: _ });
825
+ return S && (c(), f()), S;
826
+ }
827
+ return {
828
+ runClientAssigners: d,
829
+ applyCurrentClientAssigners: p,
830
+ triggerClientAssigner: h,
831
+ triggerManualClientAssigners: T
832
+ };
833
+ }
834
+ function st(e, t, r, n, i, s) {
835
+ return {
836
+ fieldType: e,
837
+ fieldKey: t,
838
+ node: r,
839
+ value: n,
840
+ defaultVNode: i,
841
+ readonly: s.readonly,
842
+ locale: s.locale,
843
+ messages: s.messages,
844
+ record: s.record,
845
+ fieldMeta: s.fieldMeta,
846
+ fieldState: s.fieldState
847
+ };
848
+ }
849
+ function vt(e, t, r, n, i, s) {
850
+ const c = st(e, t, r, n, i, s), f = s.fieldAdapters?.[e], p = (f ? f(c) : void 0) ?? i;
851
+ return s.wrapField ? s.wrapField(t, e, p) : p;
852
+ }
853
+ const U = /* @__PURE__ */ new WeakMap();
854
+ let K = 0;
855
+ function at(e) {
856
+ const t = U.get(e);
857
+ if (t)
858
+ return t;
859
+ const r = `vt-row-${K}`;
860
+ return K += 1, U.set(e, r), r;
861
+ }
862
+ function xt(e) {
863
+ if (Array.isArray(e.columns) && e.columns.length > 0) return e.columns;
864
+ const t = e.definition?.subvars;
865
+ return t && typeof t == "object" ? Object.keys(t) : [];
866
+ }
867
+ function Ft(e) {
868
+ const {
869
+ readonly: t,
870
+ localRecord: r,
871
+ markRecordChanged: n,
872
+ scheduleInlineRebuild: i,
873
+ emitTableAddRow: s,
874
+ emitTableRemoveRow: c
875
+ } = e;
876
+ let f = null, d = null, p = null, h = null, T = null, E = null, _ = null;
877
+ function S(y, b) {
878
+ const w = le(r.var[y], b);
879
+ return r.var[y] = w, w;
880
+ }
881
+ function v(y, b) {
882
+ S(y, b).push(ce(b)), n({ rebuild: !0, runClientAssigners: !0 }), s({ tableName: y, columns: b });
883
+ }
884
+ function F(y, b, w, j) {
885
+ const V = S(y, j);
886
+ if (b === w || b < 0 || w < 0 || b >= V.length || w >= V.length)
887
+ return;
888
+ const I = V.splice(b, 1)[0];
889
+ V.splice(w, 0, I), E = at(I), _ && clearTimeout(_), _ = setTimeout(() => {
890
+ E = null, _ = null, i();
891
+ }, 520), n({ rebuild: !0, runClientAssigners: !0 });
892
+ }
893
+ function l(y, b, w) {
894
+ const j = S(y, w);
895
+ j.length <= 1 || (j.splice(b, 1), n({ rebuild: !0, runClientAssigners: !0 }), c({ tableName: y, rowIndex: b, columns: w }));
896
+ }
897
+ function o() {
898
+ d && (d.classList.remove("aimd-rec-inline-table__row--drag-over"), d = null), p && (p.classList.remove("aimd-rec-inline-table__drag-handle--dragging"), p = null), h && (h.classList.remove("aimd-rec-inline-table__row--dragging-source"), h = null), T && (T.classList.remove("aimd-rec-inline-table__table--dragging"), T = null);
899
+ }
900
+ function a(y) {
901
+ const b = y instanceof HTMLTableRowElement ? y : null;
902
+ d !== b && (d && d.classList.remove("aimd-rec-inline-table__row--drag-over"), d = b, d?.classList.add("aimd-rec-inline-table__row--drag-over"));
903
+ }
904
+ function u(y, b, w) {
905
+ t() || (f = { tableName: y, rowIndex: b }, p = w.currentTarget instanceof HTMLElement ? w.currentTarget : null, h = p?.closest("tr"), T = p?.closest("table"), p?.classList.add("aimd-rec-inline-table__drag-handle--dragging"), h?.classList.add("aimd-rec-inline-table__row--dragging-source"), T?.classList.add("aimd-rec-inline-table__table--dragging"), w.dataTransfer && (w.dataTransfer.effectAllowed = "move", w.dataTransfer.setData("text/plain", `${y}:${b}`)));
906
+ }
907
+ function m(y, b, w) {
908
+ if (!(!f || f.tableName !== y)) {
909
+ if (w.preventDefault(), w.dataTransfer && (w.dataTransfer.dropEffect = "move"), f.rowIndex === b) {
910
+ a(null);
911
+ return;
912
+ }
913
+ a(w.currentTarget);
914
+ }
915
+ }
916
+ function g(y, b, w, j) {
917
+ if (!f || f.tableName !== y) {
918
+ o(), f = null;
919
+ return;
920
+ }
921
+ j.preventDefault();
922
+ const { rowIndex: V } = f;
923
+ o(), f = null, F(y, V, b, w);
924
+ }
925
+ function O() {
926
+ o(), f = null;
927
+ }
928
+ function C() {
929
+ return E;
930
+ }
931
+ return {
932
+ ensureVarTableRows: S,
933
+ addVarTableRow: v,
934
+ moveVarTableRow: F,
935
+ removeVarTableRow: l,
936
+ startVarTableRowDrag: u,
937
+ handleVarTableRowDragOver: m,
938
+ handleVarTableRowDrop: g,
939
+ endVarTableRowDrag: O,
940
+ getSettlingVarTableRowKey: C
941
+ };
942
+ }
943
+ function ct(e) {
944
+ if (!e) return [];
945
+ if (Array.isArray(e.examples))
946
+ return e.examples.filter((r) => r != null);
947
+ const t = e.example;
948
+ return t == null ? [] : [t];
949
+ }
950
+ function lt(e) {
951
+ return e === "auto_force" || e === "auto_readonly" || e === "manual_readonly";
952
+ }
953
+ function jt(e) {
954
+ const t = z({});
955
+ function r(l, o, a) {
956
+ const u = e.wrapField();
957
+ return u ? u(l, o, a) : a;
958
+ }
959
+ function n(l) {
960
+ const o = e.fieldState()?.[l], a = [];
961
+ return o?.validationError && a.push("aimd-rec-inline--error"), o?.loading && a.push("aimd-rec-inline--loading"), a;
962
+ }
963
+ function i(l) {
964
+ if (e.readonly()) return !0;
965
+ const o = e.fieldMeta()?.[l], a = e.fieldState()?.[l];
966
+ return !!(o?.disabled || a?.disabled || lt(o?.assigner?.mode));
967
+ }
968
+ function s() {
969
+ const l = e.now();
970
+ if (l instanceof Date) return Number.isNaN(l.getTime()) ? /* @__PURE__ */ new Date() : l;
971
+ if (typeof l == "string" || typeof l == "number") {
972
+ const o = new Date(l);
973
+ if (!Number.isNaN(o.getTime())) return o;
974
+ }
975
+ return /* @__PURE__ */ new Date();
976
+ }
977
+ function c(l, o) {
978
+ return he(o, e.typePlugins());
979
+ }
980
+ function f(l, o, a) {
981
+ return {
982
+ type: o || "str",
983
+ normalizedType: D(o),
984
+ fieldKey: a,
985
+ node: l,
986
+ fieldMeta: e.fieldMeta()?.[a],
987
+ currentUserName: e.currentUserName(),
988
+ now: e.now()
989
+ };
990
+ }
991
+ function d(l, o, a, u, m) {
992
+ return {
993
+ ...f(l, o, a),
994
+ value: u,
995
+ inputKind: m
996
+ };
997
+ }
998
+ function p(l, o, a) {
999
+ const u = l.definition?.defaultRaw?.trim();
1000
+ if (!u)
1001
+ return null;
1002
+ const m = D(o);
1003
+ return m === "int" || m === "integer" || H(o, {
1004
+ inputType: e.fieldMeta()?.[a]?.inputType,
1005
+ codeLanguage: e.fieldMeta()?.[a]?.codeLanguage,
1006
+ kwargs: l.definition?.kwargs,
1007
+ fieldMeta: e.fieldMeta()?.[a],
1008
+ typePlugin: c(a, o)
1009
+ }) !== "number" || typeof l.definition?.default != "number" || !u.includes(".") || String(l.definition.default) === u ? null : {
1010
+ display: u,
1011
+ expectedValue: l.definition.default
1012
+ };
1013
+ }
1014
+ function h(l, o, a, u, m, g) {
1015
+ const O = t[l], C = we(u), y = c(g, a);
1016
+ if (O) {
1017
+ if (m === "number" && Object.is(C, O.expectedValue))
1018
+ return O.display;
1019
+ delete t[l];
1020
+ }
1021
+ return y?.getDisplayValue ? y.getDisplayValue(
1022
+ d(o, a, g, u, m)
1023
+ ) : be(u, m, { type: a, typePlugin: y });
1024
+ }
1025
+ function T(l) {
1026
+ l in t && delete t[l];
1027
+ }
1028
+ function E(l, o) {
1029
+ t[l] = o;
1030
+ }
1031
+ function _(l, o, a) {
1032
+ const u = c(a, o);
1033
+ if (u?.getInitialValue)
1034
+ return u.getInitialValue(f(l, o, a));
1035
+ const m = D(o);
1036
+ if (l.definition && Object.prototype.hasOwnProperty.call(l.definition, "default"))
1037
+ return m === "dnasequence" ? L(l.definition.default) : l.definition.default;
1038
+ const g = H(o, {
1039
+ inputType: e.fieldMeta()?.[a]?.inputType,
1040
+ codeLanguage: e.fieldMeta()?.[a]?.codeLanguage,
1041
+ kwargs: l.definition?.kwargs,
1042
+ fieldMeta: e.fieldMeta()?.[a],
1043
+ typePlugin: u
1044
+ });
1045
+ return g === "boolean-select" || B(o) && g !== "scalar-list" && g !== "checkbox" ? null : g === "checkbox" ? !1 : g === "scalar-list" ? [] : g === "dna" ? L(void 0) : m === "currenttime" ? ye(s()) : m === "username" && typeof e.currentUserName() == "string" ? e.currentUserName() : "";
1046
+ }
1047
+ function S(l, o, a, u, m) {
1048
+ const g = c(a, o);
1049
+ if (g?.normalizeValue)
1050
+ return g.normalizeValue(
1051
+ d(l, o, a, u, m)
1052
+ );
1053
+ const O = D(o);
1054
+ return m === "dna" || O === "dnasequence" ? L(u) : m === "scalar-list" ? de(
1055
+ pe(u),
1056
+ me(o) ?? "string"
1057
+ ) : m === "boolean-select" ? u === null || typeof u > "u" || u === "" ? null : ge(u) : B(o) && m !== "checkbox" && (u === null || typeof u > "u" || u === "") ? null : u;
1058
+ }
1059
+ function v(l, o) {
1060
+ const a = l.definition?.kwargs?.placeholder;
1061
+ if (typeof a == "string" && a.trim())
1062
+ return a.trim();
1063
+ const u = ct(o), [m] = u.length > 0 ? u : ue(l.definition);
1064
+ if (m != null && typeof m != "object")
1065
+ return fe(m);
1066
+ }
1067
+ function F(l) {
1068
+ if (typeof l == "string" && l.trim())
1069
+ return l.trim();
1070
+ if (!l || typeof l != "object" || Array.isArray(l))
1071
+ return null;
1072
+ const o = l;
1073
+ return typeof o.id == "string" && o.id.trim() ? o.id : null;
1074
+ }
1075
+ return {
1076
+ varInputDisplayOverrides: t,
1077
+ maybeWrap: r,
1078
+ fieldStateClasses: n,
1079
+ isFieldDisabled: i,
1080
+ resolveNowDate: s,
1081
+ getTypePlugin: c,
1082
+ getVarInitialDisplayOverride: p,
1083
+ getVarDisplayValue: h,
1084
+ clearVarInputDisplayOverride: T,
1085
+ setVarInputDisplayOverride: E,
1086
+ getVarInitialValue: _,
1087
+ normalizeVarValue: S,
1088
+ getVarPlaceholder: v,
1089
+ getAimdId: F
1090
+ };
1091
+ }
1092
+ export {
1093
+ At as A,
1094
+ _t as a,
1095
+ bt as b,
1096
+ st as c,
1097
+ Et as d,
1098
+ ht as e,
1099
+ Ne as f,
1100
+ ee as g,
1101
+ Re as h,
1102
+ ke as i,
1103
+ Tt as j,
1104
+ Ee as k,
1105
+ je as l,
1106
+ xt as m,
1107
+ at as n,
1108
+ yt as o,
1109
+ Ce as p,
1110
+ k as q,
1111
+ gt as r,
1112
+ mt as s,
1113
+ wt as t,
1114
+ vt as u,
1115
+ St as v,
1116
+ Ot as w,
1117
+ pt as x,
1118
+ jt as y,
1119
+ Ft as z
1120
+ };