@overvis/hmi-workspace-ui 0.1.2 → 0.1.3

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 (88) hide show
  1. package/README.md +6 -4
  2. package/dist/{alarm-list-DKFio0hg.js → alarm-list-TDg7nwkn.js} +4 -4
  3. package/dist/{alarm-rule-dialog-mb4_nHRW.js → alarm-rule-dialog-DwbRtPZD.js} +10 -10
  4. package/dist/{alarm-rule-lists-CfZXTWkK.js → alarm-rule-lists-Ax7PzbQy.js} +4 -4
  5. package/dist/{alarm-rules-page-DBLSkrrG.js → alarm-rules-page-DisATKLV.js} +11 -11
  6. package/dist/{alert-dialog-D_iDv2lQ.js → alert-dialog-CskdoiGZ.js} +1 -1
  7. package/dist/{base-revision-DLF9EnGV.js → base-revision-C-tNhqGq.js} +3 -3
  8. package/dist/{breadcrumbs-D5R6Fz74.js → breadcrumbs-B5O9let7.js} +3 -3
  9. package/dist/{catalog-list-BkWosvh1.js → catalog-list-3yaB4bJD.js} +1 -1
  10. package/dist/{code-editor-DCM0KdMJ.js → code-editor-B6myrPQm.js} +2 -2
  11. package/dist/{dashboards-page-DLc11Vzu.js → dashboards-page-CoKevu-T.js} +9 -9
  12. package/dist/{de-Z2er-E5v.js → de-CPxvTPak.js} +8 -0
  13. package/dist/{diagnostic-text-CYZFPiND.js → diagnostic-text-BS4rdZcE.js} +2 -2
  14. package/dist/{dialogs-DEOg9lxy.js → dialogs-BUyPGimM.js} +6 -6
  15. package/dist/{dialogs-BX023zml.js → dialogs-CF7Baagf.js} +512 -510
  16. package/dist/{display-VYGzneE0.js → display-DmldtHdd.js} +2 -2
  17. package/dist/{editor-language-CGENZxbI.js → editor-language-8UJkvBgX.js} +1 -1
  18. package/dist/{editor-page-CaN52OQh.js → editor-page-_6TxO_iT.js} +14 -14
  19. package/dist/{en-CKPPL6bQ.js → en-DoFtc9Sn.js} +8 -0
  20. package/dist/{entity-controls-DJT47yeV.js → entity-controls-rdv-ttvP.js} +3 -3
  21. package/dist/{errors-BAWoH_5w.js → errors-BFeJfnyz.js} +2 -2
  22. package/dist/{footer-CbPMP8aq.js → footer-DZUQHVnt.js} +4 -4
  23. package/dist/host.js +28 -27
  24. package/dist/{i18n-ChjEbYEg.js → i18n-D54xfDUE.js} +5 -5
  25. package/dist/i18n.js +1 -1
  26. package/dist/index.js +45 -34
  27. package/dist/{list-page-Fa29SkaJ.js → list-page-Cz5bdD8r.js} +11 -11
  28. package/dist/{location-map-renderer-DvXIYc1Z.js → location-map-renderer-Hb5N0AYH.js} +1 -1
  29. package/dist/{notice-card-V_0K0lO0.js → notice-card-BMNjc7qi.js} +3 -3
  30. package/dist/{page-BorlLnMX.js → page-BKnwJyv5.js} +8 -8
  31. package/dist/{page-DxF7FOve.js → page-CBWLmbIE.js} +11 -11
  32. package/dist/{page-B5te_1Lc.js → page-UoQRnsm3.js} +11 -11
  33. package/dist/{panel-DuZD-cBP.js → panel-Cr3OXiRs.js} +3 -3
  34. package/dist/{pl-DVABrn5G.js → pl-DEPfFtMO.js} +8 -0
  35. package/dist/{presence-code-DsabLTZs.js → presence-code-DIKs9fBe.js} +2 -2
  36. package/dist/{query-gate-BbIo1Xrj.js → query-gate-2sU8OvEb.js} +3 -3
  37. package/dist/{quick-report-BcZsfkCZ.js → quick-report-ZvrI5Jkh.js} +3130 -3102
  38. package/dist/{retention-note-CmMeHV_u.js → retention-note-BrkxE2Wo.js} +9 -6
  39. package/dist/{retention-C7EZsq8u.js → retention-wDvnFMbN.js} +2 -2
  40. package/dist/{ru-CBRLC_xM.js → ru-Ct2zNOs8.js} +8 -0
  41. package/dist/{run-text-CDdfbKbg.js → run-text-Bmkf_u0N.js} +2 -2
  42. package/dist/{search-C6xQ_Hvo.js → search-ADhiRT_S.js} +3 -3
  43. package/dist/{sections-D_SBfVzV.js → sections-BDtBUhxn.js} +1 -1
  44. package/dist/{select-nNLG-AMz.js → select-Cpeslz01.js} +2 -2
  45. package/dist/{spinner-B-KLtBjp.js → spinner-LbVGWBQq.js} +2 -2
  46. package/dist/src/i18n/catalogs/de/api-error.d.ts +3 -0
  47. package/dist/src/i18n/catalogs/de/audit.d.ts +1 -0
  48. package/dist/src/i18n/catalogs/de/edge-program.d.ts +1 -0
  49. package/dist/src/i18n/catalogs/de/parameter.d.ts +1 -0
  50. package/dist/src/i18n/catalogs/de/starter.d.ts +2 -0
  51. package/dist/src/i18n/catalogs/de.d.ts +8 -0
  52. package/dist/src/i18n/catalogs/en/api-error.d.ts +3 -0
  53. package/dist/src/i18n/catalogs/en/audit.d.ts +1 -0
  54. package/dist/src/i18n/catalogs/en/edge-program.d.ts +1 -0
  55. package/dist/src/i18n/catalogs/en/parameter.d.ts +1 -0
  56. package/dist/src/i18n/catalogs/en/starter.d.ts +2 -0
  57. package/dist/src/i18n/catalogs/en.d.ts +8 -0
  58. package/dist/src/i18n/catalogs/pl/api-error.d.ts +3 -0
  59. package/dist/src/i18n/catalogs/pl/audit.d.ts +1 -0
  60. package/dist/src/i18n/catalogs/pl/edge-program.d.ts +1 -0
  61. package/dist/src/i18n/catalogs/pl/parameter.d.ts +1 -0
  62. package/dist/src/i18n/catalogs/pl/starter.d.ts +2 -0
  63. package/dist/src/i18n/catalogs/pl.d.ts +8 -0
  64. package/dist/src/i18n/catalogs/ru/api-error.d.ts +3 -0
  65. package/dist/src/i18n/catalogs/ru/audit.d.ts +1 -0
  66. package/dist/src/i18n/catalogs/ru/edge-program.d.ts +1 -0
  67. package/dist/src/i18n/catalogs/ru/parameter.d.ts +1 -0
  68. package/dist/src/i18n/catalogs/ru/starter.d.ts +2 -0
  69. package/dist/src/i18n/catalogs/ru.d.ts +8 -0
  70. package/dist/src/i18n/catalogs/uk/api-error.d.ts +3 -0
  71. package/dist/src/i18n/catalogs/uk/audit.d.ts +1 -0
  72. package/dist/src/i18n/catalogs/uk/edge-program.d.ts +1 -0
  73. package/dist/src/i18n/catalogs/uk/parameter.d.ts +1 -0
  74. package/dist/src/i18n/catalogs/uk/starter.d.ts +2 -0
  75. package/dist/src/i18n/catalogs/uk.d.ts +8 -0
  76. package/dist/src/version.d.ts +1 -1
  77. package/dist/src/workspace/device-presets/layout.d.ts +2 -0
  78. package/dist/src/workspace/graphics/inspector/item.d.ts +6 -6
  79. package/dist/src/workspace/local-setup-link.d.ts +3 -0
  80. package/dist/src/workspace/parameters/errors.d.ts +5 -0
  81. package/dist/src/workspace/setup/starters/starter-form.d.ts +24 -6
  82. package/dist/starter-fields-BHNS6IQe.js +678 -0
  83. package/dist/styles.css +1 -1
  84. package/dist/ui.js +6 -6
  85. package/dist/{uk-17pbVYZa.js → uk-Dbm1i2uh.js} +8 -0
  86. package/dist/{wireguard-docs-Clb-7xRY.js → wireguard-docs-DIBtCviv.js} +3 -3
  87. package/package.json +2 -2
  88. package/dist/starter-fields-7S3LmtGa.js +0 -583
@@ -0,0 +1,678 @@
1
+ import { rr as e } from "./quick-report-ZvrI5Jkh.js";
2
+ import { f as t, h as n, m as r } from "./i18n-D54xfDUE.js";
3
+ import { X as i, Y as a, jt as o, rt as s, tt as c } from "./alert-dialog-CskdoiGZ.js";
4
+ import { A as l, G as u, H as d, L as f, M as p, R as m, U as h, V as g, Y as _, a as v, c as y, n as b, o as x, r as S, z as C } from "./spinner-LbVGWBQq.js";
5
+ import { A as w, C as T, E, S as D, w as O, x as k } from "./panel-Cr3OXiRs.js";
6
+ import { r as A, t as ee } from "./alarm-rule-lists-Ax7PzbQy.js";
7
+ import { i as te } from "./run-text-Bmkf_u0N.js";
8
+ import { Fragment as ne, jsx as j, jsxs as M } from "react/jsx-runtime";
9
+ import { ChevronRightIcon as N, PlusIcon as P, Trash2Icon as F, TriangleAlertIcon as re } from "lucide-react";
10
+ import { resolveLocalized as I } from "@overvis/hmi-shared";
11
+ import { automationCommandRoles as L, automationSeverities as ie } from "@overvis/hmi-shared/automation";
12
+ import { starterPlaceholderShown as R } from "@overvis/hmi-shared/starter";
13
+ // src/workspace/setup/starters/starter-form.ts
14
+ var z = {
15
+ ms: 1,
16
+ s: 1e3,
17
+ min: 6e4,
18
+ h: 36e5
19
+ };
20
+ function B(e) {
21
+ return [...e.units ?? [e.unit]].sort((e, t) => z[t] - z[e]);
22
+ }
23
+ function V(e, t) {
24
+ let n = e.units === void 0 ? e.unit : B(e).find((e) => t % z[e] === 0) ?? e.unit;
25
+ return {
26
+ amount: String(t / z[n]),
27
+ unit: n
28
+ };
29
+ }
30
+ function H(e) {
31
+ return e === void 0 ? {
32
+ kind: "none",
33
+ roles: [],
34
+ memberIds: []
35
+ } : e.kind === "roles" ? {
36
+ kind: "roles",
37
+ roles: [...e.roles],
38
+ memberIds: []
39
+ } : {
40
+ kind: "members",
41
+ roles: [],
42
+ memberIds: [...e.userIds]
43
+ };
44
+ }
45
+ function U(e) {
46
+ switch (e.kind) {
47
+ case "number": return e.default === void 0 ? "" : String(e.default);
48
+ case "duration": return e.default === void 0 ? {
49
+ kind: "duration",
50
+ amount: "",
51
+ unit: e.unit
52
+ } : {
53
+ kind: "duration",
54
+ ...V(e, e.default)
55
+ };
56
+ case "timeOfDay":
57
+ case "severity":
58
+ case "choice": return e.default ?? "";
59
+ case "weekdays": return [...e.default ?? []];
60
+ case "recipients": return H(e.default);
61
+ case "boolean": return e.default ?? !1;
62
+ case "fileName": return e.default;
63
+ case "parameter":
64
+ case "endpoint":
65
+ case "alarmRule":
66
+ case "branch":
67
+ case "text":
68
+ case "phone": return "";
69
+ }
70
+ }
71
+ function W(e, t) {
72
+ return {
73
+ key: t,
74
+ fields: Object.fromEntries(e.map((e) => [e.name, U(e)]))
75
+ };
76
+ }
77
+ function ae(e) {
78
+ return Object.fromEntries(e.map((e) => [e.name, e.kind === "list" ? Array.from({ length: Math.max(1, e.minItems) }, (t, n) => W(e.fields, `row-${String(n)}`)) : U(e)]));
79
+ }
80
+ var oe = /^-?\d+(?:[.,]\d+)?$/u;
81
+ function G(e) {
82
+ let t = e.trim();
83
+ return oe.test(t) ? Number(t.replace(",", ".")) : null;
84
+ }
85
+ function K(e) {
86
+ let t = G(e.amount);
87
+ return t === null ? null : Math.round(t * z[e.unit]);
88
+ }
89
+ function se(e, t) {
90
+ if (t === void 0) return {
91
+ ok: !0,
92
+ value: void 0
93
+ };
94
+ if (typeof t == "boolean") return {
95
+ ok: !0,
96
+ value: t
97
+ };
98
+ if (Array.isArray(t)) return {
99
+ ok: !0,
100
+ value: [...t].sort((e, t) => e - t)
101
+ };
102
+ if (typeof t == "object") {
103
+ if (t.kind === "duration") {
104
+ if (t.amount.trim() === "") return {
105
+ ok: !0,
106
+ value: void 0
107
+ };
108
+ let e = K(t);
109
+ return e === null ? {
110
+ ok: !1,
111
+ code: "invalid"
112
+ } : {
113
+ ok: !0,
114
+ value: e
115
+ };
116
+ }
117
+ return t.kind === "none" ? {
118
+ ok: !0,
119
+ value: void 0
120
+ } : t.kind === "roles" ? t.roles.length === 0 ? {
121
+ ok: !1,
122
+ code: "required"
123
+ } : {
124
+ ok: !0,
125
+ value: {
126
+ kind: "roles",
127
+ roles: [...t.roles]
128
+ }
129
+ } : t.memberIds.length === 0 ? {
130
+ ok: !1,
131
+ code: "required"
132
+ } : {
133
+ ok: !0,
134
+ value: {
135
+ kind: "members",
136
+ userIds: [...t.memberIds]
137
+ }
138
+ };
139
+ }
140
+ if (t.trim() === "") return {
141
+ ok: !0,
142
+ value: void 0
143
+ };
144
+ if (e.kind === "number") {
145
+ let e = G(t);
146
+ return e === null ? {
147
+ ok: !1,
148
+ code: "invalid"
149
+ } : {
150
+ ok: !0,
151
+ value: e
152
+ };
153
+ }
154
+ return {
155
+ ok: !0,
156
+ value: t
157
+ };
158
+ }
159
+ function ce(e, t) {
160
+ let n = [], r = (e, t, r) => {
161
+ let i = {};
162
+ for (let a of e) {
163
+ let e = t[a.name], o = se(a, q(e));
164
+ o.ok ? o.value !== void 0 && (i[a.name] = o.value) : n.push({
165
+ path: `${r}/${a.name}`,
166
+ code: o.code,
167
+ args: {}
168
+ });
169
+ }
170
+ return i;
171
+ }, i = e.filter((n) => R(n, e, t)), a = r(i.filter((e) => e.kind !== "list"), t, "");
172
+ for (let e of i) e.kind === "list" && (a[e.name] = J(t[e.name]).map((t, n) => r(e.fields, t.fields, `/${e.name}/${String(n)}`)));
173
+ return n.length > 0 ? {
174
+ ok: !1,
175
+ problems: n
176
+ } : {
177
+ ok: !0,
178
+ values: a
179
+ };
180
+ }
181
+ function q(e) {
182
+ if (!Array.isArray(e)) return e;
183
+ let t = e, n = t.filter((e) => typeof e == "number");
184
+ return n.length === t.length ? n : void 0;
185
+ }
186
+ function J(e) {
187
+ return Array.isArray(e) ? e.filter((e) => typeof e == "object" && !!e && "key" in e) : [];
188
+ }
189
+ function le(e) {
190
+ let t = /* @__PURE__ */ new Map();
191
+ for (let n of e) {
192
+ let e = t.get(n.path) ?? [];
193
+ e.push(n), t.set(n.path, e);
194
+ }
195
+ return t;
196
+ }
197
+ // src/workspace/setup/starters/starter-fields.tsx
198
+ var ue = ["view_only", ...L], de = [
199
+ 1,
200
+ 2,
201
+ 3,
202
+ 4,
203
+ 5,
204
+ 6,
205
+ 7
206
+ ], Y = /* @__PURE__ */ new Set([
207
+ "parameter",
208
+ "weekdays",
209
+ "recipients",
210
+ "text"
211
+ ]);
212
+ function fe({ starters: e, onPick: t }) {
213
+ let r = n();
214
+ return /* @__PURE__ */ j(E, {
215
+ className: "gap-2",
216
+ children: e.map((e) => /* @__PURE__ */ M(k, {
217
+ variant: "outline",
218
+ render: /* @__PURE__ */ j("button", { type: "button" }),
219
+ className: "text-left",
220
+ onClick: () => {
221
+ t(e.id);
222
+ },
223
+ children: [/* @__PURE__ */ M(T, { children: [/* @__PURE__ */ j(w, { children: I(e.name, r) }), /* @__PURE__ */ j(O, {
224
+ className: "line-clamp-none",
225
+ children: I(e.description, r)
226
+ })] }), /* @__PURE__ */ j(D, { children: /* @__PURE__ */ j(N, { className: "size-4 text-muted-foreground" }) })]
227
+ }, e.id))
228
+ });
229
+ }
230
+ function X({ workspaceId: e, placeholders: t, values: n, onChange: r, problems: i, data: a, newKey: o }) {
231
+ let s = le(i), c = (e, t) => s.get(e)?.map((e) => Z(e, t));
232
+ return /* @__PURE__ */ j(g, { children: t.filter((e) => R(e, t, n)).map((t) => t.kind === "list" ? /* @__PURE__ */ j(he, {
233
+ workspaceId: e,
234
+ placeholder: t,
235
+ rows: J(n[t.name]),
236
+ onChange: (e, i) => {
237
+ r({
238
+ ...n,
239
+ [t.name]: e
240
+ }, i ?? `/${t.name}`);
241
+ },
242
+ data: a,
243
+ newKey: o,
244
+ problemsAt: c
245
+ }, t.name) : /* @__PURE__ */ j($, {
246
+ id: `starter-${t.name}`,
247
+ workspaceId: e,
248
+ placeholder: t,
249
+ value: q(n[t.name]),
250
+ onChange: (e) => {
251
+ r({
252
+ ...n,
253
+ [t.name]: e
254
+ }, `/${t.name}`);
255
+ },
256
+ data: a,
257
+ problems: c(`/${t.name}`, t)
258
+ }, t.name)) });
259
+ }
260
+ function Z(e, n) {
261
+ let r = (e) => {
262
+ if (e === void 0) return "";
263
+ if (n.kind === "duration" && typeof e == "number") {
264
+ let t = V(n, e);
265
+ return `${t.amount} ${Q(t.unit)}`;
266
+ }
267
+ return String(e);
268
+ }, { args: i } = e;
269
+ switch (e.code) {
270
+ case "required": return t("starter_problem_required");
271
+ case "invalid": return t("starter_problem_invalid");
272
+ case "unknown_placeholder": return t("starter_problem_unknown_placeholder");
273
+ case "out_of_range": return i.min !== void 0 && i.max !== void 0 ? t("starter_problem_out_of_range", {
274
+ min: r(i.min),
275
+ max: r(i.max)
276
+ }) : i.min === void 0 ? i.max === void 0 ? t("starter_problem_invalid") : t("starter_problem_out_of_range_max", { max: r(i.max) }) : t("starter_problem_out_of_range_min", { min: r(i.min) });
277
+ case "too_few": return t("starter_problem_too_few", { min: String(i.min ?? "") });
278
+ case "too_many": return t("starter_problem_too_many", { max: String(i.max ?? "") });
279
+ case "duplicate": return t("starter_problem_duplicate");
280
+ case "parameter_not_found": return t("starter_problem_parameter_not_found");
281
+ case "parameter_type": return i.expected === "boolean" ? t("starter_problem_parameter_type_boolean") : i.expected === "number" ? t("starter_problem_parameter_type_number") : t("starter_problem_parameter_type", { expected: String(i.expected ?? "") });
282
+ case "parameter_not_writable": return t("starter_problem_parameter_not_writable");
283
+ case "parameter_not_on_endpoint": return t("starter_problem_parameter_not_on_endpoint");
284
+ case "parameter_encoding": return t("starter_problem_parameter_encoding");
285
+ case "endpoint_not_found": return t("starter_problem_endpoint_not_found");
286
+ case "alarm_rule_not_found": return t("starter_problem_alarm_rule_not_found");
287
+ case "member_not_found": return t("starter_problem_member_not_found");
288
+ case "branch_not_found": return t("starter_problem_branch_not_found");
289
+ case "file_name_invalid": return t("starter_problem_file_name_invalid");
290
+ case "file_name_taken": return t("starter_problem_file_name_taken");
291
+ }
292
+ }
293
+ function Q(e) {
294
+ switch (e) {
295
+ case "ms": return t("starter_unit_ms");
296
+ case "s": return t("starter_unit_s");
297
+ case "min": return t("starter_unit_min");
298
+ case "h": return t("starter_unit_h");
299
+ }
300
+ }
301
+ function pe(e) {
302
+ switch (e) {
303
+ case 1: return t("report_weekday_mon");
304
+ case 2: return t("report_weekday_tue");
305
+ case 3: return t("report_weekday_wed");
306
+ case 4: return t("report_weekday_thu");
307
+ case 5: return t("report_weekday_fri");
308
+ case 6: return t("report_weekday_sat");
309
+ default: return t("report_weekday_sun");
310
+ }
311
+ }
312
+ function me() {
313
+ let e = r();
314
+ return (t) => {
315
+ switch (t) {
316
+ case "owner": return e("automation_role_owner");
317
+ case "admin": return e("automation_role_admin");
318
+ case "editor": return e("automation_role_editor");
319
+ case "operator": return e("automation_role_operator");
320
+ default: return e("automation_role_view_only");
321
+ }
322
+ };
323
+ }
324
+ function he({ workspaceId: e, placeholder: t, rows: i, onChange: a, data: s, newKey: c, problemsAt: l }) {
325
+ let d = r(), f = n(), p = `/${t.name}`, m = t.itemLabel === void 0 ? void 0 : I(t.itemLabel, f), g = (e) => m === void 0 ? d("starter_row", { number: String(e + 1) }) : `${m} ${String(e + 1)}`, _ = t.fields.filter((e) => Y.has(e.kind)), v = t.fields.filter((e) => !Y.has(e.kind)), y = (e, n) => /* @__PURE__ */ j(o, {
326
+ type: "button",
327
+ variant: "ghost",
328
+ size: "icon-sm",
329
+ "aria-label": d("starter_remove_row", { row: g(n) }),
330
+ disabled: i.length <= t.minItems,
331
+ onClick: () => {
332
+ a(i.filter((t) => t.key !== e.key));
333
+ },
334
+ children: /* @__PURE__ */ j(F, {})
335
+ }), b = (n, r, o, c = !1) => /* @__PURE__ */ j($, {
336
+ id: `starter-${t.name}-${n.key}-${o.name}`,
337
+ workspaceId: e,
338
+ placeholder: o,
339
+ ...c ? {
340
+ label: g(r),
341
+ labelHidden: c
342
+ } : {},
343
+ value: n.fields[o.name],
344
+ onChange: (e) => {
345
+ a(i.map((t) => t.key === n.key ? {
346
+ ...t,
347
+ fields: {
348
+ ...t.fields,
349
+ [o.name]: e
350
+ }
351
+ } : t), `${p}/${String(r)}/${o.name}`);
352
+ },
353
+ data: s,
354
+ problems: l(`${p}/${String(r)}/${o.name}`, o)
355
+ }, o.name), [x] = t.fields;
356
+ return /* @__PURE__ */ M(u, { children: [
357
+ /* @__PURE__ */ j(h, { children: I(t.label, f) }),
358
+ t.help === void 0 ? null : /* @__PURE__ */ j(C, { children: I(t.help, f) }),
359
+ /* @__PURE__ */ j(A, { texts: l(p, t) }),
360
+ t.fields.length === 1 && x !== void 0 ? /* @__PURE__ */ j("div", {
361
+ className: "flex flex-col gap-2",
362
+ children: i.map((e, t) => /* @__PURE__ */ M("div", {
363
+ className: "flex items-start gap-2",
364
+ children: [/* @__PURE__ */ j("div", {
365
+ className: "min-w-0 flex-1",
366
+ children: b(e, t, x, !0)
367
+ }), /* @__PURE__ */ j("div", {
368
+ className: "flex h-9 items-center",
369
+ children: y(e, t)
370
+ })]
371
+ }, e.key))
372
+ }) : /* @__PURE__ */ j("div", {
373
+ className: "flex flex-col gap-3",
374
+ children: i.map((e, t) => /* @__PURE__ */ M("div", {
375
+ className: "flex flex-col gap-3 rounded-lg border p-3",
376
+ children: [
377
+ /* @__PURE__ */ M("div", {
378
+ className: "flex items-center justify-between gap-2",
379
+ children: [/* @__PURE__ */ j("span", {
380
+ className: "font-medium",
381
+ children: g(t)
382
+ }), y(e, t)]
383
+ }),
384
+ _.map((n) => b(e, t, n)),
385
+ v.length === 0 ? null : /* @__PURE__ */ j("div", {
386
+ className: "\n grid grid-cols-1 gap-3\n sm:grid-cols-2\n ",
387
+ children: v.map((n) => b(e, t, n))
388
+ })
389
+ ]
390
+ }, e.key))
391
+ }),
392
+ /* @__PURE__ */ j("div", { children: /* @__PURE__ */ M(o, {
393
+ type: "button",
394
+ variant: "outline",
395
+ size: "sm",
396
+ disabled: i.length >= t.maxItems,
397
+ onClick: () => {
398
+ a([...i, W(t.fields, c())]);
399
+ },
400
+ children: [/* @__PURE__ */ j(P, { "data-icon": "inline-start" }), d("starter_add_row")]
401
+ }) })
402
+ ] });
403
+ }
404
+ function $({ id: t, workspaceId: o, placeholder: u, label: h, labelHidden: g = !1, value: w, onChange: T, data: E, problems: D }) {
405
+ let O = r(), k = n(), N = me(), P = "optional" in u && (u.optional ?? !1), F = h ?? I(u.label, k), L = u.help === void 0 ? void 0 : I(u.help, k), R = typeof w == "string" ? w : "", z = D !== void 0 && D.length > 0, V = P ? /* @__PURE__ */ j("span", {
406
+ className: "font-normal text-muted-foreground",
407
+ children: O("starter_optional")
408
+ }) : null, H = /* @__PURE__ */ M(d, {
409
+ htmlFor: t,
410
+ className: g ? "sr-only" : void 0,
411
+ children: [F, V]
412
+ }), U = /* @__PURE__ */ M(ne, { children: [L === void 0 ? null : /* @__PURE__ */ j(C, { children: L }), /* @__PURE__ */ j(A, { texts: D })] }), W = (e, n) => /* @__PURE__ */ M(f, {
413
+ "data-invalid": z || void 0,
414
+ children: [
415
+ H,
416
+ /* @__PURE__ */ M(l, {
417
+ id: t,
418
+ value: R,
419
+ "aria-invalid": z || void 0,
420
+ onChange: (e) => {
421
+ T(e.target.value);
422
+ },
423
+ children: [n ? /* @__PURE__ */ j(p, {
424
+ value: "",
425
+ children: O("starter_choose")
426
+ }) : null, e.map((e) => /* @__PURE__ */ j(p, {
427
+ value: e.id,
428
+ children: e.name
429
+ }, e.id))]
430
+ }),
431
+ U
432
+ ]
433
+ });
434
+ switch (u.kind) {
435
+ case "parameter": {
436
+ let n = D !== void 0 || R === "" ? null : E.parameterProblem?.(u, R), r = n == null ? D : [Z(n, u)];
437
+ return /* @__PURE__ */ j(e, {
438
+ name: t,
439
+ label: F,
440
+ labelSuffix: V,
441
+ labelHidden: g,
442
+ workspaceId: o,
443
+ value: R,
444
+ onChange: T,
445
+ preferred: (e) => E.parameterFits(u, e),
446
+ ...L === void 0 ? {} : { description: L },
447
+ invalid: r !== void 0 && r.length > 0,
448
+ errors: (r ?? []).map((e) => ({ message: e }))
449
+ });
450
+ }
451
+ case "endpoint": return W(E.endpoints, !0);
452
+ case "alarmRule": return W(E.alarmRules, !0);
453
+ case "branch": return W(E.branches, !0);
454
+ case "choice": return W(u.options.map((e) => ({
455
+ id: e.value,
456
+ name: I(e.label, k)
457
+ })), u.default === void 0);
458
+ case "severity": return W(ie.map((e) => ({
459
+ id: e,
460
+ name: te(e)
461
+ })), u.default === void 0);
462
+ case "duration": {
463
+ let e = typeof w == "object" && !Array.isArray(w) && w.kind === "duration" ? w : {
464
+ kind: "duration",
465
+ amount: "",
466
+ unit: u.unit
467
+ }, n = B(u), r = K(e), i = u.caution !== void 0 && r !== null && r < u.caution.below ? I(u.caution.text, k) : void 0, a = /* @__PURE__ */ j(v, {
468
+ id: t,
469
+ inputMode: "decimal",
470
+ value: e.amount,
471
+ "aria-invalid": z || void 0,
472
+ onChange: (t) => {
473
+ T({
474
+ ...e,
475
+ amount: t.target.value
476
+ });
477
+ }
478
+ });
479
+ return /* @__PURE__ */ M(f, {
480
+ "data-invalid": z || void 0,
481
+ children: [
482
+ H,
483
+ n.length > 1 ? /* @__PURE__ */ M("div", {
484
+ className: "flex gap-2",
485
+ children: [/* @__PURE__ */ j(b, {
486
+ className: "flex-1",
487
+ children: a
488
+ }), /* @__PURE__ */ j(l, {
489
+ "aria-label": O("starter_unit"),
490
+ value: e.unit,
491
+ onChange: (t) => {
492
+ let r = n.find((e) => e === t.target.value);
493
+ r !== void 0 && T({
494
+ ...e,
495
+ unit: r
496
+ });
497
+ },
498
+ children: n.map((e) => /* @__PURE__ */ j(p, {
499
+ value: e,
500
+ children: Q(e)
501
+ }, e))
502
+ })]
503
+ }) : /* @__PURE__ */ M(b, { children: [a, /* @__PURE__ */ j(S, {
504
+ align: "inline-end",
505
+ children: /* @__PURE__ */ j(x, { children: Q(e.unit) })
506
+ })] }),
507
+ i === void 0 ? null : /* @__PURE__ */ M(c, {
508
+ variant: "warning",
509
+ children: [/* @__PURE__ */ j(re, {}), /* @__PURE__ */ j(s, { children: i })]
510
+ }),
511
+ U
512
+ ]
513
+ });
514
+ }
515
+ case "number": {
516
+ let e = u.unit === void 0 ? "" : I(u.unit, k);
517
+ return /* @__PURE__ */ M(f, {
518
+ "data-invalid": z || void 0,
519
+ children: [
520
+ H,
521
+ /* @__PURE__ */ M(b, { children: [/* @__PURE__ */ j(v, {
522
+ id: t,
523
+ inputMode: u.integer === !0 ? "numeric" : "decimal",
524
+ value: R,
525
+ "aria-invalid": z || void 0,
526
+ onChange: (e) => {
527
+ T(e.target.value);
528
+ }
529
+ }), e === "" ? null : /* @__PURE__ */ j(S, {
530
+ align: "inline-end",
531
+ children: /* @__PURE__ */ j(x, { children: e })
532
+ })] }),
533
+ U
534
+ ]
535
+ });
536
+ }
537
+ case "timeOfDay":
538
+ case "text":
539
+ case "fileName":
540
+ case "phone": return /* @__PURE__ */ M(f, {
541
+ "data-invalid": z || void 0,
542
+ children: [
543
+ H,
544
+ /* @__PURE__ */ j(y, {
545
+ id: t,
546
+ ...u.kind === "timeOfDay" ? {
547
+ type: "time",
548
+ step: 60
549
+ } : u.kind === "text" ? { maxLength: u.maxLength } : u.kind === "phone" ? {
550
+ type: "tel",
551
+ autoComplete: "off"
552
+ } : {
553
+ maxLength: 12,
554
+ autoComplete: "off",
555
+ className: "font-mono uppercase"
556
+ },
557
+ value: R,
558
+ "aria-invalid": z || void 0,
559
+ onChange: (e) => {
560
+ T(e.target.value);
561
+ }
562
+ }),
563
+ U
564
+ ]
565
+ });
566
+ case "boolean": return /* @__PURE__ */ M(f, {
567
+ orientation: "horizontal",
568
+ "data-invalid": z || void 0,
569
+ children: [/* @__PURE__ */ j(_, {
570
+ id: t,
571
+ checked: w === !0,
572
+ onCheckedChange: (e) => {
573
+ T(e);
574
+ }
575
+ }), /* @__PURE__ */ M(m, { children: [/* @__PURE__ */ j(d, {
576
+ htmlFor: t,
577
+ children: F
578
+ }), U] })]
579
+ });
580
+ case "weekdays": return /* @__PURE__ */ M(f, {
581
+ "data-invalid": z || void 0,
582
+ children: [
583
+ /* @__PURE__ */ j(d, {
584
+ id: t,
585
+ children: F
586
+ }),
587
+ /* @__PURE__ */ j(a, {
588
+ multiple: !0,
589
+ variant: "outline",
590
+ size: "sm",
591
+ spacing: 0,
592
+ className: "w-full",
593
+ "aria-labelledby": t,
594
+ value: (Array.isArray(w) ? w : []).map(String),
595
+ onValueChange: (e) => {
596
+ T(e.map(Number).filter((e) => Number.isInteger(e) && e >= 1 && e <= 7).sort((e, t) => e - t));
597
+ },
598
+ children: de.map((e) => /* @__PURE__ */ j(i, {
599
+ value: String(e),
600
+ className: "min-w-0 flex-1 px-1",
601
+ children: pe(e)
602
+ }, e))
603
+ }),
604
+ U
605
+ ]
606
+ });
607
+ case "recipients": {
608
+ let e = typeof w == "object" && !Array.isArray(w) && w.kind !== "duration" ? w : {
609
+ kind: "none",
610
+ roles: [],
611
+ memberIds: []
612
+ };
613
+ return /* @__PURE__ */ M(f, {
614
+ "data-invalid": z || void 0,
615
+ children: [
616
+ H,
617
+ /* @__PURE__ */ M(l, {
618
+ id: t,
619
+ value: e.kind,
620
+ onChange: (t) => {
621
+ let n = [
622
+ "none",
623
+ "roles",
624
+ "members"
625
+ ].find((e) => e === t.target.value);
626
+ n !== void 0 && T({
627
+ ...e,
628
+ kind: n
629
+ });
630
+ },
631
+ children: [
632
+ P ? /* @__PURE__ */ j(p, {
633
+ value: "none",
634
+ children: O("starter_recipients_none")
635
+ }) : null,
636
+ /* @__PURE__ */ j(p, {
637
+ value: "roles",
638
+ children: O("alarm_rule_recipients_roles")
639
+ }),
640
+ /* @__PURE__ */ j(p, {
641
+ value: "members",
642
+ children: O("alarm_rule_recipients_members")
643
+ })
644
+ ]
645
+ }),
646
+ e.kind === "roles" ? /* @__PURE__ */ j("div", {
647
+ className: "flex flex-wrap gap-4",
648
+ children: ue.map((t) => /* @__PURE__ */ M("label", {
649
+ className: "flex items-center gap-2 text-sm",
650
+ children: [/* @__PURE__ */ j(_, {
651
+ checked: e.roles.includes(t),
652
+ onCheckedChange: (n) => {
653
+ let r = n ? [...e.roles, t] : e.roles.filter((e) => e !== t);
654
+ T({
655
+ ...e,
656
+ roles: r
657
+ });
658
+ }
659
+ }), N(t)]
660
+ }, t))
661
+ }) : null,
662
+ e.kind === "members" ? /* @__PURE__ */ j(ee, {
663
+ members: E.members,
664
+ value: e.memberIds,
665
+ onChange: (t) => {
666
+ T({
667
+ ...e,
668
+ memberIds: t
669
+ });
670
+ }
671
+ }) : null,
672
+ U
673
+ ]
674
+ });
675
+ }
676
+ }
677
+ }
678
+ export { ce as i, X as n, ae as r, fe as t };