@nice2dev/erp-adapter 1.4.4 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/omniverk.mjs CHANGED
@@ -1,16 +1,16 @@
1
- import { objectFileKind as _e, endsWithAny as te, arrayFileKind as Be, i18nFileKind as ze, itemsFileKind as Oe, jsonFileKind as Ae, jsonValuesEqual as Le, keepTextFormat as Je, parseJsonText as _, patchJsonText as Me, stringifyJsonText as de } from "@nice2dev/ui-forms/studio";
2
- const V = (e) => typeof e == "object" && e !== null && !Array.isArray(e), G = (e) => typeof e == "string" && e ? e : void 0, U = (e) => Object.fromEntries(Object.entries(e).filter(([, i]) => i !== void 0)), He = _e({
1
+ import { objectFileKind as _e, endsWithAny as Z, arrayFileKind as Be, i18nFileKind as ze, itemsFileKind as Oe, jsonFileKind as Ae, scriptsFileKind as Je, jsonValuesEqual as Le, keepTextFormat as He, parseJsonText as _, patchJsonText as Me, stringifyJsonText as ae } from "@nice2dev/ui-forms/studio";
2
+ const V = (e) => typeof e == "object" && e !== null && !Array.isArray(e), G = (e) => typeof e == "string" && e ? e : void 0, U = (e) => Object.fromEntries(Object.entries(e).filter(([, i]) => i !== void 0)), Ze = _e({
3
3
  id: "manifest",
4
4
  label: "Manifest",
5
5
  labelKey: "devStudio.kind.manifest",
6
6
  icon: "file",
7
7
  editor: "manifest",
8
- match: te(".manifest.json")
8
+ match: Z(".manifest.json")
9
9
  }), De = [
10
10
  ["dataType", "type"],
11
11
  ["isRequired", "required"]
12
- ], le = "$aliases";
13
- function Ze(e) {
12
+ ], ce = "$aliases";
13
+ function Ye(e) {
14
14
  if (!V(e))
15
15
  return e;
16
16
  const i = De.filter(([o, n]) => !(o in e) && n in e);
@@ -21,41 +21,41 @@ function Ze(e) {
21
21
  const s = i.find(([, r]) => r === o);
22
22
  t[s ? s[0] : o] = n;
23
23
  }
24
- return t[le] = i.map(([, o]) => o), t;
24
+ return t[ce] = i.map(([, o]) => o), t;
25
25
  }
26
- function Ye(e) {
27
- if (!V(e) || !Array.isArray(e[le]))
26
+ function Xe(e) {
27
+ if (!V(e) || !Array.isArray(e[ce]))
28
28
  return e;
29
- const i = e[le], t = {};
29
+ const i = e[ce], t = {};
30
30
  for (const [o, n] of Object.entries(e)) {
31
- if (o === le)
31
+ if (o === ce)
32
32
  continue;
33
33
  const s = De.find(([r, l]) => r === o && i.includes(l));
34
34
  t[s ? s[1] : o] = n;
35
35
  }
36
36
  return t;
37
37
  }
38
- const Se = (e, i) => V(e) && Array.isArray(e.fields) ? { ...e, fields: e.fields.map(i) } : e, Xe = (() => {
38
+ const Se = (e, i) => V(e) && Array.isArray(e.fields) ? { ...e, fields: e.fields.map(i) } : e, Qe = (() => {
39
39
  const e = Be({
40
40
  id: "entities",
41
41
  label: "Entities",
42
42
  labelKey: "devStudio.kind.entities",
43
43
  icon: "database",
44
44
  editor: "entities",
45
- match: te(".entities.json"),
45
+ match: Z(".entities.json"),
46
46
  property: "entities",
47
47
  itemKey: "name"
48
48
  });
49
49
  return {
50
50
  ...e,
51
- decode: (i, t) => e.decode(i, t).map((o) => Se(o, Ze)),
51
+ decode: (i, t) => e.decode(i, t).map((o) => Se(o, Ye)),
52
52
  encode: (i, t, o) => e.encode(
53
- i.map((n) => Se(n, Ye)),
53
+ i.map((n) => Se(n, Xe)),
54
54
  t,
55
55
  o
56
56
  )
57
57
  };
58
- })(), Qe = ze(), ge = {
58
+ })(), et = ze(), ge = {
59
59
  input: "textInput",
60
60
  text: "textInput",
61
61
  textarea: "textArea",
@@ -68,7 +68,7 @@ const Se = (e, i) => V(e) && Array.isArray(e.fields) ? { ...e, fields: e.fields.
68
68
  lookup: "select",
69
69
  select: "select"
70
70
  };
71
- function et(e) {
71
+ function tt(e) {
72
72
  const i = e.columns.map((t) => ({
73
73
  field: String(t.field ?? ""),
74
74
  header: String(t.displayName ?? t.header ?? t.label ?? t.field ?? "")
@@ -104,15 +104,15 @@ function Ke(e, i) {
104
104
  displayName: "displayName" in i || e.name !== i.name ? e.name : void 0,
105
105
  entityName: s ?? i.entityName,
106
106
  columns: o.map((m) => {
107
- const b = n.find((T) => T.field === m.field);
107
+ const b = n.find((N) => N.field === m.field);
108
108
  if (!b)
109
109
  return { field: m.field, displayName: m.header ?? m.field };
110
- const C = r(b), j = m.header ?? m.field;
111
- return b[C] === void 0 && j === m.field ? b : { ...b, [C]: j };
110
+ const C = r(b), k = m.header ?? m.field;
111
+ return b[C] === void 0 && k === m.field ? b : { ...b, [C]: k };
112
112
  })
113
113
  });
114
114
  }
115
- function tt(e) {
115
+ function it(e) {
116
116
  const i = [];
117
117
  return e.tabs.forEach((o, n) => {
118
118
  i.push({
@@ -172,56 +172,56 @@ function tt(e) {
172
172
  };
173
173
  }
174
174
  function Fe(e, i) {
175
- var d, m, b, C, j;
175
+ var d, m, b, C, k;
176
176
  const t = i.tabs ?? [], o = t.flatMap(
177
- (T) => (T.sections ?? []).flatMap((I) => I.controls ?? [])
177
+ (N) => (N.sections ?? []).flatMap((E) => E.controls ?? [])
178
178
  ), n = [];
179
179
  let s = null, r = null;
180
180
  const l = () => (s || (s = { name: "Main", displayName: e.name, sections: [] }, n.push(s)), r || (r = { name: "Details", displayName: "Details", controls: [] }, s.sections.push(r)), r);
181
- for (const T of e.rows ?? [])
182
- for (const I of T.cells) {
183
- const c = I.props ?? {};
184
- if (I.controlType === "heading" && (c.level === 2 || c.level === 3)) {
185
- const x = G(c.name) ?? String(c.text ?? "").replace(/\s+/g, "");
181
+ for (const N of e.rows ?? [])
182
+ for (const E of N.cells) {
183
+ const c = E.props ?? {};
184
+ if (E.controlType === "heading" && (c.level === 2 || c.level === 3)) {
185
+ const I = G(c.name) ?? String(c.text ?? "").replace(/\s+/g, "");
186
186
  if (c.level === 2)
187
- s = { ...t.find((k) => k.name === x) ?? {}, name: x, displayName: String(c.text ?? x), sections: [] }, n.push(s), r = null;
187
+ s = { ...t.find((S) => S.name === I) ?? {}, name: I, displayName: String(c.text ?? I), sections: [] }, n.push(s), r = null;
188
188
  else {
189
189
  s || (s = { name: "Main", displayName: e.name, sections: [] }, n.push(s));
190
- const D = t.flatMap((S) => S.sections ?? []).find((S) => S.name === x);
191
- r = { ...D ? Object.fromEntries(Object.entries(D).filter(([S]) => S !== "controls")) : {}, name: x, displayName: String(c.text ?? x), controls: [] }, s.sections.push(r);
190
+ const D = t.flatMap((j) => j.sections ?? []).find((j) => j.name === I);
191
+ r = { ...D ? Object.fromEntries(Object.entries(D).filter(([j]) => j !== "controls")) : {}, name: I, displayName: String(c.text ?? I), controls: [] }, s.sections.push(r);
192
192
  }
193
193
  continue;
194
194
  }
195
- const v = ((m = (d = I.bindings) == null ? void 0 : d.value) == null ? void 0 : m.field) ?? G(c.field);
195
+ const v = ((m = (d = E.bindings) == null ? void 0 : d.value) == null ? void 0 : m.field) ?? G(c.field);
196
196
  if (!v)
197
197
  continue;
198
- const f = o.find((x) => x.field === v), E = f && ge[String(f.type)] === I.controlType ? f.type : ((b = Object.entries(ge).find(([, x]) => x === I.controlType)) == null ? void 0 : b[0]) ?? "input", A = U({
198
+ const f = o.find((I) => I.field === v), x = f && ge[String(f.type)] === E.controlType ? f.type : ((b = Object.entries(ge).find(([, I]) => I === E.controlType)) == null ? void 0 : b[0]) ?? "input", A = U({
199
199
  ...f ?? {},
200
200
  field: v,
201
- type: E,
201
+ type: x,
202
202
  label: c.label !== void 0 ? String(c.label) : f == null ? void 0 : f.label,
203
- colSpan: (f == null ? void 0 : f.colSpan) !== void 0 || I.colSpan !== 6 ? I.colSpan : void 0,
203
+ colSpan: (f == null ? void 0 : f.colSpan) !== void 0 || E.colSpan !== 6 ? E.colSpan : void 0,
204
204
  required: c.required === !0 ? !0 : (f == null ? void 0 : f.required) === !0 ? !1 : f == null ? void 0 : f.required
205
205
  });
206
206
  l().controls.push(A);
207
207
  }
208
- const y = n.map((T) => {
209
- const I = t.find((c) => c.name === T.name);
210
- return I ? { ...I, ...T } : T;
208
+ const y = n.map((N) => {
209
+ const E = t.find((c) => c.name === N.name);
210
+ return E ? { ...E, ...N } : N;
211
211
  });
212
212
  return U({
213
213
  ...i,
214
214
  displayName: "displayName" in i || e.name !== i.name ? e.name : void 0,
215
- entityName: ((j = (C = e.dataSources) == null ? void 0 : C.find((T) => T.type === "entity")) == null ? void 0 : j.entity) ?? i.entityName,
215
+ entityName: ((k = (C = e.dataSources) == null ? void 0 : C.find((N) => N.type === "entity")) == null ? void 0 : k.entity) ?? i.entityName,
216
216
  tabs: y
217
217
  });
218
218
  }
219
- const it = (e) => {
219
+ const nt = (e) => {
220
220
  const i = String(e.type ?? "").toLowerCase();
221
221
  return i === "list" && typeof e.entityName == "string" && Array.isArray(e.columns) && e.columns.length > 0 ? "List" : i === "form" && typeof e.entityName == "string" && Array.isArray(e.tabs) ? "Form" : null;
222
222
  };
223
- function nt(e, i) {
224
- const t = V(e) ? e : {}, o = G(t.name) ?? G(t.id) ?? `#${i}`, n = G(t.displayName) ?? o, s = it(t);
223
+ function st(e, i) {
224
+ const t = V(e) ? e : {}, o = G(t.name) ?? G(t.id) ?? `#${i}`, n = G(t.displayName) ?? o, s = nt(t);
225
225
  if (!s)
226
226
  return {
227
227
  key: o,
@@ -229,10 +229,10 @@ function nt(e, i) {
229
229
  source: e,
230
230
  rawReason: String(t.type ?? (t.viewJson ? "viewJson" : "unknown"))
231
231
  };
232
- const r = s === "List" ? et(t) : tt(t), l = s === "List" ? Ke(r, t) : Fe(r, t);
232
+ const r = s === "List" ? tt(t) : it(t), l = s === "List" ? Ke(r, t) : Fe(r, t);
233
233
  return Le(l, e) ? { key: o, label: n, definition: r, source: e } : { key: o, label: n, source: e, rawReason: `${s} (round-trip)` };
234
234
  }
235
- function st(e) {
235
+ function ot(e) {
236
236
  if (!e.definition)
237
237
  return e.source;
238
238
  const i = V(e.source) ? e.source : { name: e.definition.id };
@@ -246,19 +246,19 @@ function st(e) {
246
246
  name: i.name ?? e.definition.id
247
247
  });
248
248
  }
249
- const ot = Oe({
249
+ const at = Oe({
250
250
  id: "views",
251
251
  label: "Views",
252
252
  labelKey: "devStudio.kind.views",
253
253
  icon: "grid",
254
254
  editor: "views",
255
- match: te(".views.json"),
255
+ match: Z(".views.json"),
256
256
  property: "views",
257
257
  itemKey: "name",
258
- toItem: nt,
259
- fromItem: st
258
+ toItem: st,
259
+ fromItem: ot
260
260
  });
261
- function at(e) {
261
+ function rt(e) {
262
262
  const i = e.steps ?? [], t = e.connections ?? [];
263
263
  return {
264
264
  id: String(e.name),
@@ -307,14 +307,14 @@ function Pe(e, i) {
307
307
  })
308
308
  });
309
309
  }
310
- function rt(e, i) {
310
+ function lt(e, i) {
311
311
  const t = V(e) ? e : {}, o = G(t.name) ?? `#${i}`, n = G(t.displayName) ?? o, s = t.steps;
312
312
  if (!(Array.isArray(t.connections) && Array.isArray(s) && s.every((y) => V(y) && typeof y.state == "string")))
313
313
  return { key: o, label: n, source: e, rawReason: G(t.triggerType) ?? "automation" };
314
- const l = at(t);
314
+ const l = rt(t);
315
315
  return Le(Pe(l, t), e) ? { key: o, label: n, definition: l, source: e } : { key: o, label: n, source: e, rawReason: "state machine (round-trip)" };
316
316
  }
317
- function lt(e) {
317
+ function ct(e) {
318
318
  if (!e.definition)
319
319
  return e.source;
320
320
  const i = V(e.source) ? e.source : { name: e.definition.id };
@@ -323,19 +323,19 @@ function lt(e) {
323
323
  name: i.name ?? e.definition.id
324
324
  });
325
325
  }
326
- const ct = Oe({
326
+ const dt = Oe({
327
327
  id: "workflows",
328
328
  label: "Workflows",
329
329
  labelKey: "devStudio.kind.workflows",
330
330
  icon: "git-branch",
331
331
  editor: "workflows",
332
- match: te(".workflows.json"),
332
+ match: Z(".workflows.json"),
333
333
  property: "workflows",
334
334
  itemKey: "name",
335
- toItem: rt,
336
- fromItem: lt
335
+ toItem: lt,
336
+ fromItem: ct
337
337
  });
338
- function dt(e) {
338
+ function pt(e) {
339
339
  const i = V(e) ? e : {};
340
340
  return {
341
341
  permissions: (i.permissions ?? []).map(
@@ -355,7 +355,7 @@ function dt(e) {
355
355
  )
356
356
  };
357
357
  }
358
- function pt(e, i) {
358
+ function mt(e, i) {
359
359
  const t = V(e) ? e : {}, o = t.permissions ?? [], n = t.permissionGroups ?? [];
360
360
  return {
361
361
  ...t,
@@ -374,23 +374,23 @@ function pt(e, i) {
374
374
  })
375
375
  };
376
376
  }
377
- const mt = Ae({
377
+ const ut = Ae({
378
378
  id: "permissions",
379
379
  label: "Permissions",
380
380
  labelKey: "devStudio.kind.permissions",
381
381
  icon: "shield",
382
382
  editor: "permissions",
383
- match: te(".permissions.json"),
384
- select: dt,
385
- assign: pt,
383
+ match: Z(".permissions.json"),
384
+ select: pt,
385
+ assign: mt,
386
386
  arrayKey: (e) => e === "/permissions" ? "code" : e === "/permissionGroups" ? "name" : void 0
387
- }), ut = Ae({
387
+ }), ft = Ae({
388
388
  id: "seeds",
389
389
  label: "Seed data",
390
390
  labelKey: "devStudio.kind.seeds",
391
391
  icon: "database",
392
392
  editor: "seeds",
393
- match: te(".seeds.json"),
393
+ match: Z(".seeds.json"),
394
394
  select: (e) => {
395
395
  const i = V(e) ? e : {};
396
396
  if (!V(i.seeds) || i.demoSeeds !== void 0 && !V(i.demoSeeds))
@@ -399,7 +399,7 @@ const mt = Ae({
399
399
  },
400
400
  assign: (e, i) => U({ ...V(e) ? e : {}, seeds: i.seeds, demoSeeds: i.demoSeeds }),
401
401
  arrayKey: () => "Id"
402
- }), ft = {
402
+ }), yt = {
403
403
  id: "script",
404
404
  label: "Script",
405
405
  labelKey: "devStudio.kind.script",
@@ -408,23 +408,28 @@ const mt = Ae({
408
408
  match: (e) => /(^|\/)(services|scripts|jobs|handlers)\/[^/]+\.(js|ts|cs)$/i.test(e) || /\.cs$/i.test(e),
409
409
  decode: (e) => e[0].text,
410
410
  encode: (e, i) => ({
411
- files: [{ path: i[0].path, text: Je(e, i[0].text) }]
411
+ files: [{ path: i[0].path, text: He(e, i[0].text) }]
412
412
  })
413
- }, yt = [
414
- He,
415
- Xe,
413
+ }, gt = Je({
414
+ match: Z(".scripts.json"),
415
+ property: "scripts",
416
+ phasesProperty: "scripts"
417
+ }), ht = [
418
+ Ze,
416
419
  Qe,
417
- ot,
418
- ct,
419
- mt,
420
+ et,
421
+ at,
422
+ dt,
420
423
  ut,
421
- ft
422
- ], gt = (e, i) => i, z = (e) => ({
424
+ ft,
425
+ gt,
426
+ yt
427
+ ], wt = (e, i) => i, z = (e) => ({
423
428
  type: "array",
424
429
  title: e,
425
430
  items: { type: "string" }
426
431
  });
427
- function ht(e = gt, i = {}) {
432
+ function vt(e = wt, i = {}) {
428
433
  const t = (s, r) => e(`devStudio.omniverk.${s}`, r), o = {
429
434
  type: "object",
430
435
  properties: {
@@ -804,7 +809,7 @@ function ht(e = gt, i = {}) {
804
809
  }
805
810
  return n;
806
811
  }
807
- const W = "Custom.", Ne = "Core", wt = {
812
+ const W = "Custom.", Ne = "Core", $t = {
808
813
  string: "string",
809
814
  varchar: "string",
810
815
  nvarchar: "string",
@@ -834,7 +839,7 @@ const W = "Custom.", Ne = "Core", wt = {
834
839
  enum: "enum",
835
840
  guid: "Guid",
836
841
  uuid: "Guid"
837
- }, vt = [
842
+ }, bt = [
838
843
  "string",
839
844
  "text",
840
845
  "int",
@@ -848,7 +853,7 @@ const W = "Custom.", Ne = "Core", wt = {
848
853
  "json",
849
854
  "enum",
850
855
  "Guid"
851
- ], $t = {
856
+ ], kt = {
852
857
  ł: "l",
853
858
  Ł: "L",
854
859
  ß: "ss",
@@ -857,11 +862,11 @@ const W = "Custom.", Ne = "Core", wt = {
857
862
  ø: "o",
858
863
  Ø: "O"
859
864
  };
860
- function bt(e) {
861
- return [...e.normalize("NFD")].map((i) => $t[i] ?? (new RegExp("\\p{Mn}", "u").test(i) ? "" : i)).join("").normalize("NFC");
865
+ function St(e) {
866
+ return [...e.normalize("NFD")].map((i) => kt[i] ?? (new RegExp("\\p{Mn}", "u").test(i) ? "" : i)).join("").normalize("NFC");
862
867
  }
863
868
  function P(e) {
864
- const i = bt(e ?? "").split(/[^A-Za-z0-9]+/).filter(Boolean).map((t) => t[0].toUpperCase() + t.slice(1)).join("");
869
+ const i = St(e ?? "").split(/[^A-Za-z0-9]+/).filter(Boolean).map((t) => t[0].toUpperCase() + t.slice(1)).join("");
865
870
  return /^[0-9]/.test(i) ? `M${i}` : i;
866
871
  }
867
872
  const je = (e) => e !== e.toLowerCase() && e === e.toUpperCase();
@@ -870,7 +875,7 @@ function he(e) {
870
875
  (i, t) => t > 0 && je(i) && !je(e[t - 1]) ? `_${i.toLowerCase()}` : i.toLowerCase()
871
876
  ).join("");
872
877
  }
873
- function kt(e) {
878
+ function Nt(e) {
874
879
  return (e.startsWith(W) ? e.slice(W.length) : e.split(".").pop() ?? e).toLowerCase().replace(/[^a-z0-9_-]+/g, "") || "module";
875
880
  }
876
881
  async function Re(e) {
@@ -886,7 +891,7 @@ async function Ve(e, i) {
886
891
  const t = `custom_${e}_${he(i)}`;
887
892
  return t.length <= 63 ? t : `${t.slice(0, 54)}_${ke(await Re(t)).slice(0, 8)}`;
888
893
  }
889
- function St(e, i) {
894
+ function jt(e, i) {
890
895
  const t = new Set([...i].map((o) => o.toLowerCase()));
891
896
  for (let o = 1; o < 100; o++) {
892
897
  const n = o === 1 ? e : `${e}${o}`;
@@ -900,7 +905,7 @@ const ne = (e) => e.name.toLowerCase() === "id", q = (e) => {
900
905
  return (((i = e.displayName) == null ? void 0 : i.trim()) || e.name).trim();
901
906
  };
902
907
  function se(e) {
903
- return e.isForeignKey ? "Guid" : wt[String(e.dataType ?? "").trim().toLowerCase()] ?? "string";
908
+ return e.isForeignKey ? "Guid" : $t[String(e.dataType ?? "").trim().toLowerCase()] ?? "string";
904
909
  }
905
910
  function pe(e) {
906
911
  if (e.isForeignKey)
@@ -925,7 +930,7 @@ function pe(e) {
925
930
  return ["Text", "input"];
926
931
  }
927
932
  }
928
- const Nt = {
933
+ const Tt = {
929
934
  lookup: "EntitySelect",
930
935
  textarea: "Textarea",
931
936
  number: "number",
@@ -934,7 +939,7 @@ const Nt = {
934
939
  date: "date",
935
940
  datetime: "datetime"
936
941
  };
937
- function jt(e) {
942
+ function Et(e) {
938
943
  var o;
939
944
  const i = [];
940
945
  (!((o = e.name) != null && o.trim()) || P(e.name).length === 0) && i.push("The module needs a name with letters or digits."), e.entities.length === 0 && i.push("The module has no entities — add at least one.");
@@ -956,10 +961,10 @@ function jt(e) {
956
961
  }
957
962
  return i;
958
963
  }
959
- const Tt = (e) => e.toISOString().replace(/\.(\d{3})Z$/, ".$10000Z"), Y = (e) => de(e, { finalNewline: !1 }), J = (e, i) => ({
964
+ const xt = (e) => e.toISOString().replace(/\.(\d{3})Z$/, ".$10000Z"), X = (e) => ae(e, { finalNewline: !1 }), J = (e, i) => ({
960
965
  icon: { name: e, package: "@nice2dev/icons", style: i }
961
966
  });
962
- function Et(e) {
967
+ function It(e) {
963
968
  const i = e && /^Ntd[A-Z]/.test(e), t = e && /^[A-Z]\w*Icon$/.test(e);
964
969
  return {
965
970
  module: {
@@ -982,24 +987,24 @@ function Et(e) {
982
987
  workflowStates: {}
983
988
  };
984
989
  }
985
- async function xt(e, i = {}) {
986
- var E, A, x, D;
987
- const t = jt(e);
990
+ async function Ct(e, i = {}) {
991
+ var x, A, I, D;
992
+ const t = Et(e);
988
993
  if (t.length > 0)
989
994
  return { problems: t };
990
995
  const o = e.name.toLowerCase().startsWith(W.toLowerCase()), n = P(
991
996
  o ? e.name.slice(W.length) : e.name
992
- ), s = St(
997
+ ), s = jt(
993
998
  W + n,
994
999
  i.existingPackageNames ?? /* @__PURE__ */ new Set()
995
- ), r = s.slice(W.length), l = r.toLowerCase(), y = `${s}.${Ne}`, d = o ? r : e.name.trim(), m = ((E = e.description) == null ? void 0 : E.trim()) || void 0, b = e.entities.map((k) => ({ ...k, name: P(k.name) })), C = e.views !== !1, j = e.permissions !== !1, T = [.../* @__PURE__ */ new Set(["en", "pl", ...e.locales ?? []])], I = e.icon ?? "widgets", c = [], v = [
1000
+ ), r = s.slice(W.length), l = r.toLowerCase(), y = `${s}.${Ne}`, d = o ? r : e.name.trim(), m = ((x = e.description) == null ? void 0 : x.trim()) || void 0, b = e.entities.map((S) => ({ ...S, name: P(S.name) })), C = e.views !== !1, k = e.permissions !== !1, N = [.../* @__PURE__ */ new Set(["en", "pl", ...e.locales ?? []])], E = e.icon ?? "widgets", c = [], v = [
996
1001
  `${l}.entities.json`,
997
1002
  ...C ? [`${l}.views.json`] : [],
998
- ...j ? [`${l}.permissions.json`] : []
1003
+ ...k ? [`${l}.permissions.json`] : []
999
1004
  ];
1000
1005
  c.push({
1001
1006
  path: `${l}.manifest.json`,
1002
- text: Y({
1007
+ text: X({
1003
1008
  packageName: s,
1004
1009
  version: "1.0.0",
1005
1010
  displayName: d,
@@ -1007,56 +1012,56 @@ async function xt(e, i = {}) {
1007
1012
  author: "OmniVerk Module Builder",
1008
1013
  license: "Proprietary",
1009
1014
  category: ((A = e.category) == null ? void 0 : A.trim()) || "Custom",
1010
- icon: I,
1011
- exportedAt: Tt((i.now ?? (() => /* @__PURE__ */ new Date()))()),
1015
+ icon: E,
1016
+ exportedAt: xt((i.now ?? (() => /* @__PURE__ */ new Date()))()),
1012
1017
  modules: [
1013
1018
  {
1014
1019
  name: Ne,
1015
1020
  displayName: d,
1016
1021
  description: e.description ?? d,
1017
- icon: I,
1022
+ icon: E,
1018
1023
  parts: v
1019
1024
  }
1020
1025
  ],
1021
1026
  dependencies: ["Core.Users"],
1022
- i18n: T.map((k) => `${l}.${k}.i18n.json`),
1027
+ i18n: N.map((S) => `${l}.${S}.i18n.json`),
1023
1028
  ...e.ownerTenantId ? { ownerTenantId: e.ownerTenantId } : {},
1024
1029
  ...e.sourceDefinitionId ? { sourceDefinitionId: e.sourceDefinitionId } : {}
1025
1030
  })
1026
1031
  });
1027
1032
  const f = [];
1028
- for (const k of b) {
1029
- const S = [{ name: "Id", displayName: "ID", dataType: "Guid", isPrimaryKey: !0 }];
1030
- for (const $ of k.fields.filter((O) => !ne(O))) {
1033
+ for (const S of b) {
1034
+ const j = [{ name: "Id", displayName: "ID", dataType: "Guid", isPrimaryKey: !0 }];
1035
+ for (const $ of S.fields.filter((O) => !ne(O))) {
1031
1036
  const O = se($), a = {
1032
1037
  name: P($.name),
1033
1038
  displayName: q($),
1034
1039
  dataType: O
1035
1040
  };
1036
- O === "string" && (a.maxLength = $.maxLength && $.maxLength > 0 ? $.maxLength : 200), $.isRequired && (a.isRequired = !0), $.isUnique && (a.isUnique = !0), ($.isIndexed || $.isForeignKey) && (a.isIndexed = !0), $.isForeignKey && (a.isForeignKey = !0, $.referencedEntity && (a.referencedEntity = P($.referencedEntity))), (x = $.defaultValue) != null && x.trim() && (a.defaultValue = $.defaultValue), (D = $.description) != null && D.trim() && (a.description = $.description), S.push(a);
1041
+ O === "string" && (a.maxLength = $.maxLength && $.maxLength > 0 ? $.maxLength : 200), $.isRequired && (a.isRequired = !0), $.isUnique && (a.isUnique = !0), ($.isIndexed || $.isForeignKey) && (a.isIndexed = !0), $.isForeignKey && (a.isForeignKey = !0, $.referencedEntity && (a.referencedEntity = P($.referencedEntity))), (I = $.defaultValue) != null && I.trim() && (a.defaultValue = $.defaultValue), (D = $.description) != null && D.trim() && (a.description = $.description), j.push(a);
1037
1042
  }
1038
1043
  f.push({
1039
- id: await qe(s, k.name),
1040
- name: k.name,
1041
- displayName: q(k),
1042
- tableName: await Ve(l, k.name),
1043
- description: k.description ?? q(k),
1044
- entityIcon: k.icon ?? "table_rows",
1044
+ id: await qe(s, S.name),
1045
+ name: S.name,
1046
+ displayName: q(S),
1047
+ tableName: await Ve(l, S.name),
1048
+ description: S.description ?? q(S),
1049
+ entityIcon: S.icon ?? "table_rows",
1045
1050
  isAudited: !0,
1046
1051
  isSoftDeleteEnabled: !1,
1047
- fields: S
1052
+ fields: j
1048
1053
  });
1049
1054
  }
1050
1055
  if (c.push({
1051
1056
  path: `${l}.entities.json`,
1052
- text: Y({ moduleName: y, version: "1.0.0", entities: f })
1057
+ text: X({ moduleName: y, version: "1.0.0", entities: f })
1053
1058
  }), C) {
1054
- const k = ($) => {
1059
+ const S = ($) => {
1055
1060
  const O = b.find((p) => p.name === P($)), a = O == null ? void 0 : O.fields.find(
1056
1061
  (p) => !ne(p) && !p.isForeignKey && se(p) === "string"
1057
1062
  );
1058
1063
  return a ? P(a.name) : "Name";
1059
- }, S = [];
1064
+ }, j = [];
1060
1065
  for (const $ of b) {
1061
1066
  const O = $.fields.filter((u) => !ne(u)), a = O.filter((u) => !["text", "json"].includes(se(u))).slice(0, 6), p = (a.length ? a : [O[0]]).map((u) => ({
1062
1067
  field: P(u.name),
@@ -1066,15 +1071,15 @@ async function xt(e, i = {}) {
1066
1071
  ...u.isForeignKey && u.referencedEntity ? { referencedEntity: P(u.referencedEntity) } : {}
1067
1072
  })), g = O.filter((u) => ["string", "text"].includes(se(u))).map((u) => P(u.name)), h = O.map((u) => ({
1068
1073
  field: P(u.name),
1069
- type: Nt[pe(u)[1]] ?? "TextInput",
1074
+ type: Tt[pe(u)[1]] ?? "TextInput",
1070
1075
  label: q(u),
1071
1076
  ...u.isRequired ? { required: !0 } : {},
1072
1077
  ...u.isForeignKey && u.referencedEntity ? {
1073
1078
  entity: P(u.referencedEntity),
1074
- displayField: k(u.referencedEntity)
1079
+ displayField: S(u.referencedEntity)
1075
1080
  } : {}
1076
1081
  }));
1077
- S.push({
1082
+ j.push({
1078
1083
  id: `vw-${l}-${he($.name)}-list`,
1079
1084
  name: `${$.name}List`,
1080
1085
  displayName: q($),
@@ -1088,7 +1093,7 @@ async function xt(e, i = {}) {
1088
1093
  allowEdit: !0,
1089
1094
  allowDelete: !0
1090
1095
  });
1091
- const N = O.map((u) => {
1096
+ const T = O.map((u) => {
1092
1097
  const w = pe(u)[1];
1093
1098
  return {
1094
1099
  field: P(u.name),
@@ -1099,7 +1104,7 @@ async function xt(e, i = {}) {
1099
1104
  ...u.isForeignKey && u.referencedEntity ? { entity: P(u.referencedEntity) } : {}
1100
1105
  };
1101
1106
  });
1102
- S.push({
1107
+ j.push({
1103
1108
  id: `vw-${l}-${he($.name)}-form`,
1104
1109
  name: `${$.name}Form`,
1105
1110
  displayName: q($),
@@ -1110,37 +1115,37 @@ async function xt(e, i = {}) {
1110
1115
  {
1111
1116
  name: "Main",
1112
1117
  displayName: q($),
1113
- sections: [{ name: "Details", displayName: "Details", controls: N }]
1118
+ sections: [{ name: "Details", displayName: "Details", controls: T }]
1114
1119
  }
1115
1120
  ]
1116
1121
  });
1117
1122
  }
1118
1123
  c.push({
1119
1124
  path: `${l}.views.json`,
1120
- text: Y({ moduleName: y, version: "1.0.0", views: S })
1125
+ text: X({ moduleName: y, version: "1.0.0", views: j })
1121
1126
  });
1122
1127
  }
1123
- if (j) {
1124
- const k = (O) => `${r}.${O}`, S = (O, a) => ({
1125
- code: k(O),
1128
+ if (k) {
1129
+ const S = (O) => `${r}.${O}`, j = (O, a) => ({
1130
+ code: S(O),
1126
1131
  name: `${d} — ${a}`,
1127
1132
  description: `${a}: ${d}`
1128
1133
  }), $ = (O, a, ...p) => ({
1129
1134
  name: `${W}${r} ${O}`,
1130
1135
  description: `${d} — ${a}`,
1131
- permissions: p.map(k)
1136
+ permissions: p.map(S)
1132
1137
  });
1133
1138
  c.push({
1134
1139
  path: `${l}.permissions.json`,
1135
- text: Y({
1140
+ text: X({
1136
1141
  moduleName: y,
1137
1142
  version: "1.0.0",
1138
1143
  permissions: [
1139
- S("Read", "view records"),
1140
- S("Create", "add records"),
1141
- S("Edit", "edit records"),
1142
- S("Delete", "delete records"),
1143
- S("Admin", "administer the module")
1144
+ j("Read", "view records"),
1145
+ j("Create", "add records"),
1146
+ j("Edit", "edit records"),
1147
+ j("Delete", "delete records"),
1148
+ j("Admin", "administer the module")
1144
1149
  ],
1145
1150
  permissionGroups: [
1146
1151
  $("Viewer", "read only", "Read"),
@@ -1150,25 +1155,25 @@ async function xt(e, i = {}) {
1150
1155
  })
1151
1156
  });
1152
1157
  }
1153
- for (const k of T) {
1154
- const S = {
1158
+ for (const S of N) {
1159
+ const j = {
1155
1160
  "module.displayName": d,
1156
1161
  "module.description": m ?? d
1157
1162
  };
1158
1163
  for (const $ of b) {
1159
- S[`entity.${$.name}.displayName`] = q($);
1164
+ j[`entity.${$.name}.displayName`] = q($);
1160
1165
  for (const O of $.fields.filter((a) => !ne(a)))
1161
- S[`field.${$.name}.${P(O.name)}.displayName`] = q(O);
1162
- C && (S[`view.${$.name}List.displayName`] = q($), S[`view.${$.name}Form.displayName`] = q($), S[`view.${$.name}Form.tab.Main`] = q($), S[`view.${$.name}Form.section.Details`] = k === "pl" ? "Szczegóły" : "Details");
1166
+ j[`field.${$.name}.${P(O.name)}.displayName`] = q(O);
1167
+ C && (j[`view.${$.name}List.displayName`] = q($), j[`view.${$.name}Form.displayName`] = q($), j[`view.${$.name}Form.tab.Main`] = q($), j[`view.${$.name}Form.section.Details`] = S === "pl" ? "Szczegóły" : "Details");
1163
1168
  }
1164
1169
  c.push({
1165
- path: `${l}.${k}.i18n.json`,
1166
- text: Y({ moduleName: s, locale: k, version: "1.0.0", translations: S })
1170
+ path: `${l}.${S}.i18n.json`,
1171
+ text: X({ moduleName: s, locale: S, version: "1.0.0", translations: j })
1167
1172
  });
1168
1173
  }
1169
- return e.iconConfig !== !1 && c.push({ path: `${l}.iconconfig.json`, text: Y(Et(e.icon)) }), { package: { packageName: s, folder: `Custom/${r}`, files: c }, problems: [] };
1174
+ return e.iconConfig !== !1 && c.push({ path: `${l}.iconconfig.json`, text: X(It(e.icon)) }), { package: { packageName: s, folder: `Custom/${r}`, files: c }, problems: [] };
1170
1175
  }
1171
- function It(e) {
1176
+ function Ot(e) {
1172
1177
  const i = (t) => typeof t == "string" && t ? t : void 0;
1173
1178
  return {
1174
1179
  name: e.name,
@@ -1203,83 +1208,83 @@ const H = (e) => typeof e == "object" && e !== null && !Array.isArray(e);
1203
1208
  function we(e, i) {
1204
1209
  return typeof e == "string" ? i(e) : Array.isArray(e) ? e.map((t) => we(t, i)) : H(e) ? Object.fromEntries(Object.entries(e).map(([t, o]) => [t, we(o, i)])) : e;
1205
1210
  }
1206
- const Ct = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
1207
- async function Ot(e, i) {
1211
+ const At = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
1212
+ async function Lt(e, i) {
1208
1213
  const t = e.find(
1209
1214
  (c) => !c.path.includes("/") && c.path.toLowerCase().endsWith(".manifest.json")
1210
1215
  );
1211
1216
  if (!t)
1212
1217
  throw new Error("The module has no manifest.");
1213
- const o = _(t.text).value, n = String(o.packageName ?? ""), s = t.path.slice(0, -14), r = i.id, l = kt(r), y = (c) => c.startsWith(W) ? c.slice(W.length) : c.split(".").pop() ?? c, d = y(n), m = y(r), b = (c) => c.startsWith(`${s}.`) ? `${l}${c.slice(s.length)}` : c, C = new Map(e.map((c) => [c.path, b(c.path)])), j = /* @__PURE__ */ new Map();
1218
+ const o = _(t.text).value, n = String(o.packageName ?? ""), s = t.path.slice(0, -14), r = i.id, l = Nt(r), y = (c) => c.startsWith(W) ? c.slice(W.length) : c.split(".").pop() ?? c, d = y(n), m = y(r), b = (c) => c.startsWith(`${s}.`) ? `${l}${c.slice(s.length)}` : c, C = new Map(e.map((c) => [c.path, b(c.path)])), k = /* @__PURE__ */ new Map();
1214
1219
  for (const c of e.filter((v) => v.path.toLowerCase().endsWith(".permissions.json")))
1215
1220
  try {
1216
1221
  const v = _(c.text).value;
1217
1222
  for (const f of H(v) && Array.isArray(v.permissions) ? v.permissions : []) {
1218
- const E = typeof f.code == "string" ? f.code : "";
1219
- E.startsWith(`${d}.`) && j.set(E, `${m}${E.slice(d.length)}`);
1223
+ const x = typeof f.code == "string" ? f.code : "";
1224
+ x.startsWith(`${d}.`) && k.set(x, `${m}${x.slice(d.length)}`);
1220
1225
  }
1221
1226
  } catch {
1222
1227
  }
1223
- const T = (c) => n && (c === n || c.startsWith(`${n}.`) || c.startsWith(`${n} `)) ? r + c.slice(n.length) : j.get(c) ?? C.get(c) ?? c, I = [];
1228
+ const N = (c) => n && (c === n || c.startsWith(`${n}.`) || c.startsWith(`${n} `)) ? r + c.slice(n.length) : k.get(c) ?? C.get(c) ?? c, E = [];
1224
1229
  for (const c of e) {
1225
1230
  if (c.path.startsWith(".revisions/"))
1226
1231
  continue;
1227
1232
  const v = b(c.path);
1228
1233
  if (!c.path.toLowerCase().endsWith(".json")) {
1229
- I.push({ path: v, text: c.text });
1234
+ E.push({ path: v, text: c.text });
1230
1235
  continue;
1231
1236
  }
1232
1237
  let f;
1233
1238
  try {
1234
1239
  f = _(c.text).value;
1235
1240
  } catch {
1236
- I.push({ path: v, text: c.text });
1241
+ E.push({ path: v, text: c.text });
1237
1242
  continue;
1238
1243
  }
1239
- let E = we(f, T);
1240
- if (c === t && H(E)) {
1241
- const { sourceDefinitionId: A, ...x } = E;
1242
- E = {
1243
- ...x,
1244
+ let x = we(f, N);
1245
+ if (c === t && H(x)) {
1246
+ const { sourceDefinitionId: A, ...I } = x;
1247
+ x = {
1248
+ ...I,
1244
1249
  packageName: r,
1245
1250
  ...i.name ? { displayName: i.name } : {},
1246
1251
  ...i.packageId ? { category: i.packageId } : {}
1247
1252
  };
1248
1253
  }
1249
- if (c.path.toLowerCase().endsWith(".entities.json") && H(E) && Array.isArray(E.entities)) {
1254
+ if (c.path.toLowerCase().endsWith(".entities.json") && H(x) && Array.isArray(x.entities)) {
1250
1255
  const A = [];
1251
- for (const x of E.entities) {
1252
- if (!H(x) || typeof x.name != "string") {
1253
- A.push(x);
1256
+ for (const I of x.entities) {
1257
+ if (!H(I) || typeof I.name != "string") {
1258
+ A.push(I);
1254
1259
  continue;
1255
1260
  }
1256
1261
  A.push({
1257
- ...x,
1258
- ...typeof x.id == "string" && Ct.test(x.id) ? { id: await qe(r, x.name) } : {},
1259
- ...typeof x.tableName == "string" ? { tableName: await Ve(l, x.name) } : {}
1262
+ ...I,
1263
+ ...typeof I.id == "string" && At.test(I.id) ? { id: await qe(r, I.name) } : {},
1264
+ ...typeof I.tableName == "string" ? { tableName: await Ve(l, I.name) } : {}
1260
1265
  });
1261
1266
  }
1262
- E = { ...E, entities: A };
1267
+ x = { ...x, entities: A };
1263
1268
  }
1264
- i.name && /\.en\.i18n\.json$/i.test(c.path) && H(E) && H(E.translations) && typeof E.translations["module.displayName"] == "string" && (E = {
1265
- ...E,
1266
- translations: { ...E.translations, "module.displayName": i.name }
1267
- }), I.push({ path: v, text: Me(c.text, E) });
1269
+ i.name && /\.en\.i18n\.json$/i.test(c.path) && H(x) && H(x.translations) && typeof x.translations["module.displayName"] == "string" && (x = {
1270
+ ...x,
1271
+ translations: { ...x.translations, "module.displayName": i.name }
1272
+ }), E.push({ path: v, text: Me(c.text, x) });
1268
1273
  }
1269
1274
  return {
1270
1275
  id: r,
1271
1276
  packageId: i.packageId ?? o.category,
1272
- files: I
1277
+ files: E
1273
1278
  };
1274
1279
  }
1275
- const K = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Q = (e, i) => K(e) && Array.isArray(e[i]) ? e[i] : [], oe = (e, i) => e.toLowerCase().endsWith(i), ve = (e) => !e.includes("/"), At = /[ąćęłńóśźżĄĆĘŁŃÓŚŹŻ]/, Lt = [
1280
+ const K = (e) => typeof e == "object" && e !== null && !Array.isArray(e), ee = (e, i) => K(e) && Array.isArray(e[i]) ? e[i] : [], oe = (e, i) => e.toLowerCase().endsWith(i), ve = (e) => !e.includes("/"), Mt = /[ąćęłńóśźżĄĆĘŁŃÓŚŹŻ]/, Dt = [
1276
1281
  "ING Bank Śląski",
1277
1282
  "Bank Śląski",
1278
1283
  "BOŚ",
1279
1284
  "e-Zamówienia",
1280
1285
  "eZamówienia",
1281
1286
  "Plataforma de Contratación del Sector Público"
1282
- ], ae = (e) => At.test(Lt.reduce((i, t) => i.split(t).join(""), e)), Mt = /* @__PURE__ */ new Set([
1287
+ ], re = (e) => Mt.test(Dt.reduce((i, t) => i.split(t).join(""), e)), Kt = /* @__PURE__ */ new Set([
1283
1288
  "module",
1284
1289
  "entity",
1285
1290
  "field",
@@ -1288,8 +1293,8 @@ const K = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Q = (e
1288
1293
  "nav",
1289
1294
  "action",
1290
1295
  "tutorial"
1291
- ]), Dt = /* @__PURE__ */ new Set(["int", "int32", "int64", "long", "integer"]);
1292
- function Kt(e) {
1296
+ ]), Ft = /* @__PURE__ */ new Set(["int", "int32", "int64", "long", "integer"]);
1297
+ function Pt(e) {
1293
1298
  for (let i = 0; i < e.length; i++) {
1294
1299
  const t = e.charCodeAt(i);
1295
1300
  if (t >= 55296 && t <= 56319 || t >= 9728 && t <= 10175)
@@ -1303,7 +1308,7 @@ function Te(e) {
1303
1308
  const i = K(e.translations) ? e.translations : K(e.keys) ? e.keys : void 0;
1304
1309
  return i ? Object.entries(i) : [];
1305
1310
  }
1306
- const Ee = /^(.*)\.([a-z]{2,3}(?:-[A-Za-z]{2,4})?)\.i18n\.json$/i, Ft = /* @__PURE__ */ new Set([
1311
+ const Ee = /^(.*)\.([a-z]{2,3}(?:-[A-Za-z]{2,4})?)\.i18n\.json$/i, Rt = /* @__PURE__ */ new Set([
1307
1312
  "hotel.views.json",
1308
1313
  "restaurant.views.json",
1309
1314
  "backup-dr.views.json",
@@ -1312,9 +1317,9 @@ const Ee = /^(.*)\.([a-z]{2,3}(?:-[A-Za-z]{2,4})?)\.i18n\.json$/i, Ft = /* @__PU
1312
1317
  "shelf_management.views.json",
1313
1318
  "psa.views.json"
1314
1319
  ]);
1315
- function Pt(e, i = {}) {
1320
+ function qt(e, i = {}) {
1316
1321
  const t = new Set(
1317
- [...i.legacyListViewFiles ?? Ft].map(
1322
+ [...i.legacyListViewFiles ?? Rt].map(
1318
1323
  (c) => c.toLowerCase()
1319
1324
  )
1320
1325
  ), o = [], n = (c) => {
@@ -1357,31 +1362,31 @@ function Pt(e, i = {}) {
1357
1362
  messageKey: "devStudio.issue.iconconfigMissing"
1358
1363
  });
1359
1364
  for (const { file: c, value: v } of y) {
1360
- const f = K(v) ? v.module : void 0, E = K(f) ? f.icon : void 0, A = [
1365
+ const f = K(v) ? v.module : void 0, x = K(f) ? f.icon : void 0, A = [
1361
1366
  ...K(f) ? [] : ["module"],
1362
- ...K(f) && !K(E) ? ["module.icon"] : [],
1363
- ...K(E) && !("name" in E) ? ["module.icon.name"] : [],
1364
- ...K(E) && !("package" in E) ? ["module.icon.package"] : [],
1367
+ ...K(f) && !K(x) ? ["module.icon"] : [],
1368
+ ...K(x) && !("name" in x) ? ["module.icon.name"] : [],
1369
+ ...K(x) && !("package" in x) ? ["module.icon.package"] : [],
1365
1370
  ...["views", "permissions", "workflowStates"].filter(
1366
- (x) => !K(v) || !(x in v)
1371
+ (I) => !K(v) || !(I in v)
1367
1372
  )
1368
1373
  ];
1369
- for (const x of A)
1374
+ for (const I of A)
1370
1375
  n({
1371
1376
  code: "iconconfig.structure",
1372
- message: `The icon config needs "${x}".`,
1377
+ message: `The icon config needs "${I}".`,
1373
1378
  messageKey: "devStudio.issue.iconconfigStructure",
1374
- params: { field: x },
1379
+ params: { field: I },
1375
1380
  path: c.path,
1376
- pointer: `/${x.split(".").join("/")}`
1381
+ pointer: `/${I.split(".").join("/")}`
1377
1382
  });
1378
1383
  }
1379
1384
  const d = [], m = [];
1380
1385
  for (const { file: c, value: v } of r(".entities.json")) {
1381
1386
  if (!K(v) || !("entities" in v))
1382
1387
  continue;
1383
- const f = [], E = v.entities;
1384
- if (!Array.isArray(E) || E.length === 0) {
1388
+ const f = [], x = v.entities;
1389
+ if (!Array.isArray(x) || x.length === 0) {
1385
1390
  n({
1386
1391
  code: "entities.empty",
1387
1392
  message: "The file has no entities.",
@@ -1391,51 +1396,51 @@ function Pt(e, i = {}) {
1391
1396
  });
1392
1397
  continue;
1393
1398
  }
1394
- E.forEach((A, x) => {
1395
- const D = `/entities/${x}`, k = K(A) && typeof A.name == "string" ? A.name : void 0;
1396
- if (k ? d.push(k) : n({
1399
+ x.forEach((A, I) => {
1400
+ const D = `/entities/${I}`, S = K(A) && typeof A.name == "string" ? A.name : void 0;
1401
+ if (S ? d.push(S) : n({
1397
1402
  code: "entities.name",
1398
- message: `Entity #${x + 1} has no name.`,
1403
+ message: `Entity #${I + 1} has no name.`,
1399
1404
  messageKey: "devStudio.issue.entitiesName",
1400
- params: { n: x + 1 },
1405
+ params: { n: I + 1 },
1401
1406
  path: c.path,
1402
1407
  pointer: D
1403
1408
  }), !K(A) || !Array.isArray(A.fields)) {
1404
1409
  n({
1405
1410
  code: "entities.fields",
1406
- message: `Entity ${k ?? `#${x + 1}`} has no fields array.`,
1411
+ message: `Entity ${S ?? `#${I + 1}`} has no fields array.`,
1407
1412
  messageKey: "devStudio.issue.entitiesFields",
1408
- params: { name: k ?? `#${x + 1}` },
1413
+ params: { name: S ?? `#${I + 1}` },
1409
1414
  path: c.path,
1410
1415
  pointer: D
1411
1416
  });
1412
1417
  return;
1413
1418
  }
1414
- K(A) && typeof A.displayName == "string" && ae(A.displayName) && n({
1419
+ K(A) && typeof A.displayName == "string" && re(A.displayName) && n({
1415
1420
  code: "labels.polish",
1416
- message: `Entity ${k}: the display name "${A.displayName}" is Polish — seed labels are English, Polish goes to the .pl bundle.`,
1421
+ message: `Entity ${S}: the display name "${A.displayName}" is Polish — seed labels are English, Polish goes to the .pl bundle.`,
1417
1422
  messageKey: "devStudio.issue.polishEntity",
1418
- params: { name: k ?? "", text: A.displayName },
1423
+ params: { name: S ?? "", text: A.displayName },
1419
1424
  path: c.path,
1420
1425
  pointer: `${D}/displayName`
1421
- }), A.fields.forEach((S, $) => {
1422
- if (!K(S))
1426
+ }), A.fields.forEach((j, $) => {
1427
+ if (!K(j))
1423
1428
  return;
1424
- const O = typeof S.name == "string" ? S.name : void 0, a = `${D}/fields/${$}`;
1425
- k && O && S.isPrimaryKey !== !0 && m.push(`field.${k}.${O}`);
1426
- const p = typeof S.dataType == "string" ? S.dataType.replace(/\?+$/, "") : void 0;
1427
- p === void 0 && typeof S.type == "string" && f.push({ name: `${k}.${O}`, pointer: `${a}/type` }), p && Dt.has(p.toLowerCase()) && (O === "Id" || S.isForeignKey === !0) && n({
1429
+ const O = typeof j.name == "string" ? j.name : void 0, a = `${D}/fields/${$}`;
1430
+ S && O && j.isPrimaryKey !== !0 && m.push(`field.${S}.${O}`);
1431
+ const p = typeof j.dataType == "string" ? j.dataType.replace(/\?+$/, "") : void 0;
1432
+ p === void 0 && typeof j.type == "string" && f.push({ name: `${S}.${O}`, pointer: `${a}/type` }), p && Ft.has(p.toLowerCase()) && (O === "Id" || j.isForeignKey === !0) && n({
1428
1433
  code: "entities.keyNotGuid",
1429
- message: `${k}.${O} is ${p}: keys must be Guid (every row's Id is a uuid).`,
1434
+ message: `${S}.${O} is ${p}: keys must be Guid (every row's Id is a uuid).`,
1430
1435
  messageKey: "devStudio.issue.keyNotGuid",
1431
- params: { name: `${k}.${O}`, type: p },
1436
+ params: { name: `${S}.${O}`, type: p },
1432
1437
  path: c.path,
1433
1438
  pointer: `${a}/dataType`
1434
- }), typeof S.displayName == "string" && ae(S.displayName) && n({
1439
+ }), typeof j.displayName == "string" && re(j.displayName) && n({
1435
1440
  code: "labels.polish",
1436
- message: `${k}.${O}: the display name "${S.displayName}" is Polish — seed labels are English.`,
1441
+ message: `${S}.${O}: the display name "${j.displayName}" is Polish — seed labels are English.`,
1437
1442
  messageKey: "devStudio.issue.polishField",
1438
- params: { name: `${k}.${O}`, text: S.displayName },
1443
+ params: { name: `${S}.${O}`, text: j.displayName },
1439
1444
  path: c.path,
1440
1445
  pointer: `${a}/displayName`
1441
1446
  });
@@ -1472,109 +1477,109 @@ function Pt(e, i = {}) {
1472
1477
  });
1473
1478
  continue;
1474
1479
  }
1475
- Q(v, "views").forEach((f, E) => {
1480
+ ee(v, "views").forEach((f, x) => {
1476
1481
  if (!K(f))
1477
1482
  return;
1478
- const A = `/views/${E}`, x = typeof f.name == "string" ? f.name : "(unnamed)";
1483
+ const A = `/views/${x}`, I = typeof f.name == "string" ? f.name : "(unnamed)";
1479
1484
  typeof f.name == "string" && b.push(f.name), typeof f.type == "string" && f.type.toLowerCase() === "list" && !t.has(c.path.toLowerCase()) && (typeof f.entityName != "string" || !f.entityName.trim() ? n({
1480
1485
  code: "views.listEntity",
1481
- message: `List view ${x} needs a top-level "entityName".`,
1486
+ message: `List view ${I} needs a top-level "entityName".`,
1482
1487
  messageKey: "devStudio.issue.listEntity",
1483
- params: { name: x },
1488
+ params: { name: I },
1484
1489
  path: c.path,
1485
1490
  pointer: A
1486
1491
  }) : (!Array.isArray(f.columns) || f.columns.length === 0) && n({
1487
1492
  code: "views.listColumns",
1488
- message: `List view ${x} needs non-empty top-level "columns".`,
1493
+ message: `List view ${I} needs non-empty top-level "columns".`,
1489
1494
  messageKey: "devStudio.issue.listColumns",
1490
- params: { name: x },
1495
+ params: { name: I },
1491
1496
  path: c.path,
1492
1497
  pointer: A
1493
1498
  }));
1494
1499
  const D = [[f, "displayName", A]];
1495
- Q(f, "columns").forEach((k, S) => {
1500
+ ee(f, "columns").forEach((S, j) => {
1496
1501
  for (const $ of ["header", "displayName", "label"])
1497
- D.push([k, $, `${A}/columns/${S}`]);
1498
- }), Q(f, "tabs").forEach((k, S) => {
1499
- D.push([k, "displayName", `${A}/tabs/${S}`]), Q(k, "sections").forEach(($, O) => {
1500
- D.push([$, "displayName", `${A}/tabs/${S}/sections/${O}`]), Q($, "controls").forEach(
1501
- (a, p) => D.push([a, "label", `${A}/tabs/${S}/sections/${O}/controls/${p}`])
1502
+ D.push([S, $, `${A}/columns/${j}`]);
1503
+ }), ee(f, "tabs").forEach((S, j) => {
1504
+ D.push([S, "displayName", `${A}/tabs/${j}`]), ee(S, "sections").forEach(($, O) => {
1505
+ D.push([$, "displayName", `${A}/tabs/${j}/sections/${O}`]), ee($, "controls").forEach(
1506
+ (a, p) => D.push([a, "label", `${A}/tabs/${j}/sections/${O}/controls/${p}`])
1502
1507
  );
1503
1508
  });
1504
1509
  });
1505
- for (const [k, S, $] of D) {
1506
- const O = K(k) ? k[S] : void 0;
1507
- typeof O == "string" && ae(O) && n({
1510
+ for (const [S, j, $] of D) {
1511
+ const O = K(S) ? S[j] : void 0;
1512
+ typeof O == "string" && re(O) && n({
1508
1513
  code: "labels.polish",
1509
- message: `View ${x}: "${O}" is Polish — seed labels are English.`,
1514
+ message: `View ${I}: "${O}" is Polish — seed labels are English.`,
1510
1515
  messageKey: "devStudio.issue.polishView",
1511
- params: { name: x, text: O },
1516
+ params: { name: I, text: O },
1512
1517
  path: c.path,
1513
- pointer: `${$}/${S}`
1518
+ pointer: `${$}/${j}`
1514
1519
  });
1515
1520
  }
1516
1521
  });
1517
1522
  }
1518
- const C = s.filter((c) => ve(c.file.path) && Ee.test(c.file.path)), j = /* @__PURE__ */ new Map();
1523
+ const C = s.filter((c) => ve(c.file.path) && Ee.test(c.file.path)), k = /* @__PURE__ */ new Map();
1519
1524
  for (const c of C) {
1520
- const [, v, f] = Ee.exec(c.file.path), E = j.get(v) ?? /* @__PURE__ */ new Map();
1521
- E.set(f.toLowerCase(), c), j.set(v, E);
1525
+ const [, v, f] = Ee.exec(c.file.path), x = k.get(v) ?? /* @__PURE__ */ new Map();
1526
+ x.set(f.toLowerCase(), c), k.set(v, x);
1522
1527
  }
1523
- const T = new Set(
1524
- [...j.keys()].map((c) => c.split(".")[0]).filter((c) => !Mt.has(c))
1525
- ), I = /* @__PURE__ */ new Set();
1526
- for (const [c, v] of j) {
1527
- const f = v.get("en"), E = v.get("pl"), A = (x) => new Set(Te(x == null ? void 0 : x.value).map(([D]) => D));
1528
- if (f && !E && n({
1528
+ const N = new Set(
1529
+ [...k.keys()].map((c) => c.split(".")[0]).filter((c) => !Kt.has(c))
1530
+ ), E = /* @__PURE__ */ new Set();
1531
+ for (const [c, v] of k) {
1532
+ const f = v.get("en"), x = v.get("pl"), A = (I) => new Set(Te(I == null ? void 0 : I.value).map(([D]) => D));
1533
+ if (f && !x && n({
1529
1534
  code: "i18n.polishMissing",
1530
1535
  message: `${c}.en.i18n.json needs a .pl.i18n.json sibling (English and Polish are mandatory).`,
1531
1536
  messageKey: "devStudio.issue.polishBundleMissing",
1532
1537
  params: { group: c },
1533
1538
  path: f.file.path
1534
- }), E && !f && n({
1539
+ }), x && !f && n({
1535
1540
  code: "i18n.englishMissing",
1536
1541
  message: `${c}.pl.i18n.json needs an .en.i18n.json baseline.`,
1537
1542
  messageKey: "devStudio.issue.englishBundleMissing",
1538
1543
  params: { group: c },
1539
- path: E.file.path
1540
- }), f && E) {
1541
- const x = A(f), D = A(E), k = [...x].filter(($) => !D.has($)), S = [...D].filter(($) => !x.has($));
1542
- k.length && n({
1544
+ path: x.file.path
1545
+ }), f && x) {
1546
+ const I = A(f), D = A(x), S = [...I].filter(($) => !D.has($)), j = [...D].filter(($) => !I.has($));
1547
+ S.length && n({
1543
1548
  code: "i18n.keyMissing",
1544
- message: `${E.file.path} is missing ${k.length} key(s) of English: ${k.slice(0, 10).join(", ")}`,
1549
+ message: `${x.file.path} is missing ${S.length} key(s) of English: ${S.slice(0, 10).join(", ")}`,
1545
1550
  messageKey: "devStudio.issue.keysMissingPl",
1546
1551
  params: {
1547
- path: E.file.path,
1548
- count: k.length,
1549
- keys: k.slice(0, 10).join(", ")
1552
+ path: x.file.path,
1553
+ count: S.length,
1554
+ keys: S.slice(0, 10).join(", ")
1550
1555
  },
1551
- path: E.file.path
1552
- }), S.length && n({
1556
+ path: x.file.path
1557
+ }), j.length && n({
1553
1558
  code: "i18n.keyMissing",
1554
- message: `${f.file.path} is missing ${S.length} key(s) of Polish: ${S.slice(0, 10).join(", ")}`,
1559
+ message: `${f.file.path} is missing ${j.length} key(s) of Polish: ${j.slice(0, 10).join(", ")}`,
1555
1560
  messageKey: "devStudio.issue.keysMissingEn",
1556
1561
  params: {
1557
1562
  path: f.file.path,
1558
- count: S.length,
1559
- keys: S.slice(0, 10).join(", ")
1563
+ count: j.length,
1564
+ keys: j.slice(0, 10).join(", ")
1560
1565
  },
1561
1566
  path: f.file.path
1562
1567
  });
1563
1568
  }
1564
- for (const [x, D] of v) {
1565
- const k = Te(D.value), S = k.filter(([$]) => T.has($.split(".")[0])).map(([$]) => $);
1566
- if (S.length && n({
1569
+ for (const [I, D] of v) {
1570
+ const S = Te(D.value), j = S.filter(([$]) => N.has($.split(".")[0])).map(([$]) => $);
1571
+ if (j.length && n({
1567
1572
  severity: "warning",
1568
1573
  code: "i18n.fileKey",
1569
- message: `${D.file.path}: nothing reads keys named after the bundle file — use module./entity./field./view. keys (${S.slice(0, 5).join(", ")}).`,
1574
+ message: `${D.file.path}: nothing reads keys named after the bundle file — use module./entity./field./view. keys (${j.slice(0, 5).join(", ")}).`,
1570
1575
  messageKey: "devStudio.issue.fileKey",
1571
- params: { path: D.file.path, keys: S.slice(0, 5).join(", ") },
1576
+ params: { path: D.file.path, keys: j.slice(0, 5).join(", ") },
1572
1577
  path: D.file.path
1573
- }), x === "en")
1574
- for (const [$, O] of k) {
1575
- I.add($);
1578
+ }), I === "en")
1579
+ for (const [$, O] of S) {
1580
+ E.add($);
1576
1581
  const a = $.split(".")[0];
1577
- ["module", "entity", "field", "view"].includes(a) && typeof O == "string" && ae(O) && n({
1582
+ ["module", "entity", "field", "view"].includes(a) && typeof O == "string" && re(O) && n({
1578
1583
  code: "i18n.polishInEnglish",
1579
1584
  message: `${D.file.path}: ${$} = "${O}" — the English bundle is the English UI.`,
1580
1585
  messageKey: "devStudio.issue.polishInEnglish",
@@ -1591,7 +1596,7 @@ function Pt(e, i = {}) {
1591
1596
  ...m.map((f) => `${f}.displayName`),
1592
1597
  ...b.map((f) => `view.${f}.displayName`)
1593
1598
  ].filter(
1594
- (f) => !I.has(f) && !(f.startsWith("field.") && I.has(`${f.slice(0, -12)}.label`))
1599
+ (f) => !E.has(f) && !(f.startsWith("field.") && E.has(`${f.slice(0, -12)}.label`))
1595
1600
  );
1596
1601
  v.length && n({
1597
1602
  code: "i18n.labelMissing",
@@ -1601,38 +1606,38 @@ function Pt(e, i = {}) {
1601
1606
  });
1602
1607
  }
1603
1608
  for (const { file: c, value: v } of s)
1604
- ce(
1609
+ de(
1605
1610
  v,
1606
1611
  void 0,
1607
1612
  "",
1608
- (f, E, A) => n({
1613
+ (f, x, A) => n({
1609
1614
  code: "icons.emoji",
1610
- message: `${E} = "${A}": icon fields take an Ntd* name and column headers are words, never emoji.`,
1615
+ message: `${x} = "${A}": icon fields take an Ntd* name and column headers are words, never emoji.`,
1611
1616
  messageKey: "devStudio.issue.iconsEmoji",
1612
- params: { key: E, text: A },
1617
+ params: { key: x, text: A },
1613
1618
  path: c.path,
1614
1619
  pointer: f
1615
1620
  })
1616
1621
  );
1617
1622
  return o;
1618
1623
  }
1619
- function ce(e, i, t, o) {
1624
+ function de(e, i, t, o) {
1620
1625
  if (Array.isArray(e)) {
1621
- e.forEach((n, s) => ce(n, i, `${t}/${s}`, o));
1626
+ e.forEach((n, s) => de(n, i, `${t}/${s}`, o));
1622
1627
  return;
1623
1628
  }
1624
1629
  if (K(e))
1625
1630
  for (const [n, s] of Object.entries(e)) {
1626
1631
  const r = `${t}/${n}`;
1627
- if ((n === "icon" || n === "iconName" || n === "entityIcon" || n === "name" && i === "icon" || i === "cardIcon" || (n === "header" || n === "displayName" && i === "columns")) && typeof s == "string" && Kt(s) && o(r, n, s), n === "optionsJson" && typeof s == "string")
1632
+ if ((n === "icon" || n === "iconName" || n === "entityIcon" || n === "name" && i === "icon" || i === "cardIcon" || (n === "header" || n === "displayName" && i === "columns")) && typeof s == "string" && Pt(s) && o(r, n, s), n === "optionsJson" && typeof s == "string")
1628
1633
  try {
1629
- ce(JSON.parse(s), "optionsJson", r, o);
1634
+ de(JSON.parse(s), "optionsJson", r, o);
1630
1635
  } catch {
1631
1636
  }
1632
- ce(s, n, r, o);
1637
+ de(s, n, r, o);
1633
1638
  }
1634
1639
  }
1635
- function Rt(e, i = {}) {
1640
+ function Vt(e, i = {}) {
1636
1641
  const t = [], o = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
1637
1642
  for (const r of e)
1638
1643
  for (const l of r.files) {
@@ -1649,7 +1654,7 @@ function Rt(e, i = {}) {
1649
1654
  o.set(d, [...o.get(d) ?? [], r.location]);
1650
1655
  }
1651
1656
  if (oe(l.path, ".entities.json") && r.group) {
1652
- for (const d of Q(y, "entities"))
1657
+ for (const d of ee(y, "entities"))
1653
1658
  if (K(d) && typeof d.name == "string" && d.name) {
1654
1659
  const m = `${r.group}/${d.name}`.toLowerCase(), b = n.get(m) ?? [];
1655
1660
  b.includes(r.location) || n.set(m, [...b, r.location]);
@@ -1675,7 +1680,7 @@ function Rt(e, i = {}) {
1675
1680
  });
1676
1681
  return t;
1677
1682
  }
1678
- const ee = (e) => typeof e == "object" && e !== null && !Array.isArray(e), X = (e) => typeof e == "string" && e ? e : void 0, qt = /* @__PURE__ */ new Set([
1683
+ const te = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Q = (e) => typeof e == "string" && e ? e : void 0, Ut = /* @__PURE__ */ new Set([
1679
1684
  "slug",
1680
1685
  "category",
1681
1686
  "subCategory",
@@ -1694,26 +1699,26 @@ function Ue(e) {
1694
1699
  }
1695
1700
  function We(e) {
1696
1701
  const i = {};
1697
- for (const [t, o] of Object.entries(ee(e) ? e : {}))
1698
- ee(o) && (i[t] = { ...o, name: String(o.name ?? "") });
1702
+ for (const [t, o] of Object.entries(te(e) ? e : {}))
1703
+ te(o) && (i[t] = { ...o, name: String(o.name ?? "") });
1699
1704
  return i;
1700
1705
  }
1701
- function Vt(e, i) {
1702
- const t = ee(e) ? e : {}, o = Object.fromEntries(Object.entries(t).filter(([n]) => !qt.has(n)));
1706
+ function Wt(e, i) {
1707
+ const t = te(e) ? e : {}, o = Object.fromEntries(Object.entries(t).filter(([n]) => !Ut.has(n)));
1703
1708
  return {
1704
1709
  id: String(t.slug ?? ""),
1705
- category: X(t.category),
1706
- subCategory: X(t.subCategory),
1707
- parentId: X(t.parentSlug),
1708
- icon: X(t.icon),
1710
+ category: Q(t.category),
1711
+ subCategory: Q(t.subCategory),
1712
+ parentId: Q(t.parentSlug),
1713
+ icon: Q(t.icon),
1709
1714
  sortOrder: typeof t.sortOrder == "number" ? t.sortOrder : void 0,
1710
1715
  tags: Ue(t.tags),
1711
1716
  translations: We(t.translations),
1712
- modules: (Array.isArray(t.modules) ? t.modules : []).filter(ee).map((n) => ({
1717
+ modules: (Array.isArray(t.modules) ? t.modules : []).filter(te).map((n) => ({
1713
1718
  moduleId: String(n.packageName ?? ""),
1714
1719
  required: n.required === !0,
1715
- condition: X(n.condition),
1716
- description: X(n.description)
1720
+ condition: Q(n.condition),
1721
+ description: Q(n.description)
1717
1722
  })),
1718
1723
  ...Object.keys(o).length ? { extra: o } : {},
1719
1724
  ...i ? { readOnly: i } : {}
@@ -1722,7 +1727,7 @@ function Vt(e, i) {
1722
1727
  const $e = (e) => Object.fromEntries(Object.entries(e).filter(([, i]) => i !== void 0));
1723
1728
  function xe(e, i) {
1724
1729
  var l;
1725
- const t = ee(i) ? i : {}, o = (Array.isArray(t.modules) ? t.modules : []).filter(ee), s = JSON.stringify(Ue(t.tags) ?? []) === JSON.stringify(e.tags ?? []) ? t.tags : (l = e.tags) != null && l.length ? typeof t.tags == "string" ? e.tags.join(",") : e.tags : void 0, r = (y) => {
1730
+ const t = te(i) ? i : {}, o = (Array.isArray(t.modules) ? t.modules : []).filter(te), s = JSON.stringify(Ue(t.tags) ?? []) === JSON.stringify(e.tags ?? []) ? t.tags : (l = e.tags) != null && l.length ? typeof t.tags == "string" ? e.tags.join(",") : e.tags : void 0, r = (y) => {
1726
1731
  const d = o.find((m) => m.packageName === y.moduleId);
1727
1732
  return $e({
1728
1733
  ...d,
@@ -1778,7 +1783,7 @@ function Ie(e, i = "en") {
1778
1783
  readOnly: e.source === "seed" || e.source === "code"
1779
1784
  };
1780
1785
  }
1781
- function Ut(e) {
1786
+ function Gt(e) {
1782
1787
  const i = e.extra ?? {};
1783
1788
  return {
1784
1789
  slug: e.id,
@@ -1798,17 +1803,17 @@ function Ut(e) {
1798
1803
  ...typeof i.defaultLanguage == "string" ? { defaultLanguage: i.defaultLanguage } : {}
1799
1804
  };
1800
1805
  }
1801
- const F = (...e) => e.filter(Boolean).join("/"), Wt = (e) => e.slice(0, Math.max(0, e.lastIndexOf("/"))), Gt = (e) => e.slice(e.lastIndexOf("/") + 1), me = (e) => typeof e == "object" && e !== null && !Array.isArray(e), ie = (e) => typeof e == "string" && e ? e : void 0, _t = /* @__PURE__ */ new Set(["bin", "obj", "node_modules"]), ue = (e) => e.startsWith(".") || _t.has(e), Bt = /^wizard-templates-.+\.seed\.json$/i, zt = /^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(\d{3})Z$/;
1806
+ const F = (...e) => e.filter(Boolean).join("/"), _t = (e) => e.slice(0, Math.max(0, e.lastIndexOf("/"))), Bt = (e) => e.slice(e.lastIndexOf("/") + 1), me = (e) => typeof e == "object" && e !== null && !Array.isArray(e), ie = (e) => typeof e == "string" && e ? e : void 0, zt = /* @__PURE__ */ new Set(["bin", "obj", "node_modules"]), ue = (e) => e.startsWith(".") || zt.has(e), Jt = /^wizard-templates-.+\.seed\.json$/i, Ht = /^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(\d{3})Z$/;
1802
1807
  function fe(e) {
1803
1808
  const i = (t, o = 2) => String(t).padStart(o, "0");
1804
1809
  return `${e.getUTCFullYear()}${i(e.getUTCMonth() + 1)}${i(e.getUTCDate())}T${i(e.getUTCHours())}${i(e.getUTCMinutes())}${i(e.getUTCSeconds())}${i(e.getUTCMilliseconds(), 3)}Z`;
1805
1810
  }
1806
- function Jt(e) {
1807
- const i = zt.exec(e);
1811
+ function Zt(e) {
1812
+ const i = Ht.exec(e);
1808
1813
  return i ? Date.UTC(+i[1], +i[2] - 1, +i[3], +i[4], +i[5], +i[6], +i[7]) : void 0;
1809
1814
  }
1810
- const Ht = (e, i) => F(Wt(e), ".revisions", `${Gt(e)}.${i}`), Zt = (e) => e.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "custom";
1811
- function ni(e) {
1815
+ const Yt = (e, i) => F(_t(e), ".revisions", `${Bt(e)}.${i}`), Xt = (e) => e.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "custom";
1816
+ function oi(e) {
1812
1817
  const { roots: i } = e, t = e.revisions !== !1, o = e.now ?? (() => /* @__PURE__ */ new Date()), n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
1813
1818
  let r = null;
1814
1819
  const l = (a) => {
@@ -1831,7 +1836,7 @@ function ni(e) {
1831
1836
  return {};
1832
1837
  }
1833
1838
  }
1834
- function m(a, p, g, h, N) {
1839
+ function m(a, p, g, h, T) {
1835
1840
  const u = ie(h.packageName) ?? (p || a.id);
1836
1841
  return {
1837
1842
  workspaceId: a.id,
@@ -1842,15 +1847,15 @@ function ni(e) {
1842
1847
  version: ie(h.version),
1843
1848
  location: p,
1844
1849
  readOnly: a.readOnly,
1845
- files: N,
1850
+ files: T,
1846
1851
  search: `${p} ${g}`
1847
1852
  };
1848
1853
  }
1849
1854
  async function b(a) {
1850
1855
  const p = /* @__PURE__ */ new Map(), g = async (h) => {
1851
- const N = await a.fs.list(h), u = N.filter((w) => w.kind === "file" && w.name.toLowerCase().endsWith(".manifest.json")).map((w) => w.name).sort()[0];
1856
+ const T = await a.fs.list(h), u = T.filter((w) => w.kind === "file" && w.name.toLowerCase().endsWith(".manifest.json")).map((w) => w.name).sort()[0];
1852
1857
  if (u) {
1853
- const w = N.filter((M) => M.kind === "file").map((M) => M.name), L = m(
1858
+ const w = T.filter((M) => M.kind === "file").map((M) => M.name), L = m(
1854
1859
  a,
1855
1860
  h,
1856
1861
  u,
@@ -1859,55 +1864,55 @@ function ni(e) {
1859
1864
  );
1860
1865
  p.has(L.id.toLowerCase()) || (p.set(L.id.toLowerCase(), { ref: L, dir: h }), s.set(`${a.id}:${L.id.toLowerCase()}`, h));
1861
1866
  }
1862
- for (const w of N)
1867
+ for (const w of T)
1863
1868
  w.kind === "directory" && !ue(w.name) && !(h === "" && w.name === C(a)) && await g(F(h, w.name));
1864
1869
  };
1865
1870
  return await g(""), p;
1866
1871
  }
1867
- const C = (a) => a.templatesDir === !1 ? void 0 : a.templatesDir ?? "Templates", j = (a) => {
1868
- n.delete(a.id), k.clear();
1869
- }, T = (a) => {
1872
+ const C = (a) => a.templatesDir === !1 ? void 0 : a.templatesDir ?? "Templates", k = (a) => {
1873
+ n.delete(a.id), S.clear();
1874
+ }, N = (a) => {
1870
1875
  let p = n.get(a.id);
1871
1876
  return p || (p = b(a), n.set(a.id, p), p.catch(() => n.delete(a.id))), p;
1872
1877
  };
1873
- async function I(a) {
1874
- const p = l(a.workspaceId), g = await T(p), h = s.get(`${p.id}:${a.id.toLowerCase()}`), N = g.get(a.id.toLowerCase()) ?? (h === void 0 ? void 0 : [...g.values()].find((u) => u.dir === h));
1875
- if (!N)
1878
+ async function E(a) {
1879
+ const p = l(a.workspaceId), g = await N(p), h = s.get(`${p.id}:${a.id.toLowerCase()}`), T = g.get(a.id.toLowerCase()) ?? (h === void 0 ? void 0 : [...g.values()].find((u) => u.dir === h));
1880
+ if (!T)
1876
1881
  throw new Error(`Module "${a.id}" is not in "${p.label}"`);
1877
- return { root: p, module: N };
1882
+ return { root: p, module: T };
1878
1883
  }
1879
1884
  async function c(a, p) {
1880
- const g = [], h = async (N, u) => {
1881
- const w = await a.list(F(p, N));
1885
+ const g = [], h = async (T, u) => {
1886
+ const w = await a.list(F(p, T));
1882
1887
  if (!(u && w.some((L) => L.kind === "file" && L.name.toLowerCase().endsWith(".manifest.json"))))
1883
1888
  for (const L of w)
1884
- L.kind === "file" ? g.push(F(N, L.name)) : ue(L.name) || await h(F(N, L.name), !0);
1889
+ L.kind === "file" ? g.push(F(T, L.name)) : ue(L.name) || await h(F(T, L.name), !0);
1885
1890
  };
1886
1891
  return await h("", !1), g.sort();
1887
1892
  }
1888
1893
  async function v(a, p, g, h) {
1889
- t && await a.write(Ht(p, h), g);
1894
+ t && await a.write(Yt(p, h), g);
1890
1895
  }
1891
1896
  async function f(a, p) {
1892
- const g = [], h = async (N) => {
1893
- const u = await a.list(F(p, N));
1897
+ const g = [], h = async (T) => {
1898
+ const u = await a.list(F(p, T));
1894
1899
  for (const w of u)
1895
1900
  if (w.kind === "directory" && w.name === ".revisions")
1896
- for (const L of await a.list(F(p, N, w.name))) {
1901
+ for (const L of await a.list(F(p, T, w.name))) {
1897
1902
  const M = /^(.*)\.(\d{8}T\d{9}Z)$/.exec(L.name);
1898
1903
  L.kind === "file" && M && g.push({
1899
- path: F(N, M[1]),
1904
+ path: F(T, M[1]),
1900
1905
  stamp: M[2],
1901
- at: F(N, ".revisions", L.name)
1906
+ at: F(T, ".revisions", L.name)
1902
1907
  });
1903
1908
  }
1904
- else w.kind === "directory" && !ue(w.name) && await h(F(N, w.name));
1909
+ else w.kind === "directory" && !ue(w.name) && await h(F(T, w.name));
1905
1910
  };
1906
1911
  return await h(""), g;
1907
1912
  }
1908
- async function E(a) {
1913
+ async function x(a) {
1909
1914
  const p = C(a);
1910
- return p ? (await a.fs.list(p)).filter((g) => g.kind === "file" && Bt.test(g.name)).map((g) => F(p, g.name)).sort() : [];
1915
+ return p ? (await a.fs.list(p)).filter((g) => g.kind === "file" && Jt.test(g.name)).map((g) => F(p, g.name)).sort() : [];
1911
1916
  }
1912
1917
  async function A(a, p) {
1913
1918
  const g = await a.fs.read(p);
@@ -1916,7 +1921,7 @@ function ni(e) {
1916
1921
  const h = _(g.text).value;
1917
1922
  return { text: g.text, entries: Array.isArray(h) ? h : [] };
1918
1923
  }
1919
- const x = {
1924
+ const I = {
1920
1925
  arrayKey: (a) => a === "" ? "slug" : a.endsWith("/modules") ? "packageName" : void 0
1921
1926
  };
1922
1927
  async function D(a, p, g, h) {
@@ -1926,24 +1931,24 @@ function ni(e) {
1926
1931
  }
1927
1932
  await a.fs.write(
1928
1933
  p,
1929
- g ? Me(g, h, x) : de(h)
1934
+ g ? Me(g, h, I) : ae(h)
1930
1935
  );
1931
1936
  }
1932
- const k = /* @__PURE__ */ new Map();
1933
- function S(a, p) {
1937
+ const S = /* @__PURE__ */ new Map();
1938
+ function j(a, p) {
1934
1939
  const g = `${a.id}:${p.dir}`;
1935
- let h = k.get(g);
1940
+ let h = S.get(g);
1936
1941
  if (!h) {
1937
- const N = (p.ref.files ?? []).filter((u) => /\.(manifest|entities)\.json$/i.test(u));
1942
+ const T = (p.ref.files ?? []).filter((u) => /\.(manifest|entities)\.json$/i.test(u));
1938
1943
  h = Promise.all(
1939
- N.map(async (u) => {
1944
+ T.map(async (u) => {
1940
1945
  var w;
1941
1946
  return {
1942
1947
  path: u,
1943
1948
  text: ((w = await a.fs.read(F(p.dir, u))) == null ? void 0 : w.text) ?? ""
1944
1949
  };
1945
1950
  })
1946
- ).then((u) => ({ location: p.dir, group: p.dir.split("/")[0], files: u })), k.set(g, h);
1951
+ ).then((u) => ({ location: p.dir, group: p.dir.split("/")[0], files: u })), S.set(g, h);
1947
1952
  }
1948
1953
  return h;
1949
1954
  }
@@ -1953,7 +1958,7 @@ function ni(e) {
1953
1958
  }
1954
1959
  const O = {
1955
1960
  invalidate() {
1956
- n.clear(), k.clear(), r = null;
1961
+ n.clear(), S.clear(), r = null;
1957
1962
  },
1958
1963
  async listWorkspaces() {
1959
1964
  return i.map((a) => ({
@@ -1966,35 +1971,35 @@ function ni(e) {
1966
1971
  },
1967
1972
  async listModules(a) {
1968
1973
  const p = i.findIndex((u) => u.id === a), g = l(a);
1969
- j(g);
1970
- const h = await T(g), N = await Promise.all(
1971
- i.slice(0, p).map(async (u) => ({ r: u, modules: await T(u) }))
1974
+ k(g);
1975
+ const h = await N(g), T = await Promise.all(
1976
+ i.slice(0, p).map(async (u) => ({ r: u, modules: await N(u) }))
1972
1977
  );
1973
1978
  return [...h.values()].map(({ ref: u }) => {
1974
- const w = N.find((L) => L.modules.has(u.id.toLowerCase()));
1979
+ const w = T.find((L) => L.modules.has(u.id.toLowerCase()));
1975
1980
  return w ? { ...u, shadowedBy: w.r.id } : u;
1976
1981
  }).sort((u, w) => u.id.localeCompare(w.id));
1977
1982
  },
1978
1983
  async readModule(a) {
1979
- const { root: p, module: g } = await I(a), h = await c(p.fs, g.dir), N = [];
1984
+ const { root: p, module: g } = await E(a), h = await c(p.fs, g.dir), T = [];
1980
1985
  for (const u of h) {
1981
1986
  const w = await p.fs.read(F(g.dir, u));
1982
- w && N.push({
1987
+ w && T.push({
1983
1988
  path: u,
1984
1989
  text: w.text,
1985
1990
  version: w.version,
1986
1991
  ...p.readOnly ? { readOnly: !0 } : {}
1987
1992
  });
1988
1993
  }
1989
- return N;
1994
+ return T;
1990
1995
  },
1991
1996
  async writeModule(a, p) {
1992
- const { module: g } = await I(a), h = y(a.workspaceId), N = /* @__PURE__ */ new Map(), u = [];
1997
+ const { module: g } = await E(a), h = y(a.workspaceId), T = /* @__PURE__ */ new Map(), u = [];
1993
1998
  for (const M of p) {
1994
- if (M.path.split("/").some((Z) => Z === ".." || Z === "" || Z.startsWith(".")))
1999
+ if (M.path.split("/").some((Y) => Y === ".." || Y === "" || Y.startsWith(".")))
1995
2000
  throw new Error(`Refusing to write outside the module: ${M.path}`);
1996
2001
  const R = await h.fs.read(F(g.dir, M.path));
1997
- N.set(M.path, R);
2002
+ T.set(M.path, R);
1998
2003
  const B = M.baseVersion;
1999
2004
  (B === void 0 ? R !== null && M.type === "write" : (R == null ? void 0 : R.version) !== B) && u.push({ path: M.path, ...R ? { currentVersion: R.version } : {} });
2000
2005
  }
@@ -2002,10 +2007,10 @@ function ni(e) {
2002
2007
  return { ok: !1, conflicts: u };
2003
2008
  const w = fe(o()), L = {};
2004
2009
  for (const M of p) {
2005
- const R = F(g.dir, M.path), B = N.get(M.path);
2010
+ const R = F(g.dir, M.path), B = T.get(M.path);
2006
2011
  B && await v(h.fs, R, B.text, w), M.type === "write" ? L[M.path] = await h.fs.write(R, M.text) : await h.fs.remove(R);
2007
2012
  }
2008
- return j(h), { ok: !0, versions: L, revision: w };
2013
+ return k(h), { ok: !0, versions: L, revision: w };
2009
2014
  },
2010
2015
  async createModule(a) {
2011
2016
  var u;
@@ -2015,32 +2020,32 @@ function ni(e) {
2015
2020
  );
2016
2021
  if ((await p.fs.list(h)).length > 0)
2017
2022
  throw new Error(`The folder ${h} is not empty`);
2018
- if ((await T(p)).has(a.id.toLowerCase()))
2023
+ if ((await N(p)).has(a.id.toLowerCase()))
2019
2024
  throw new Error(`"${a.id}" already exists in ${p.label}`);
2020
2025
  for (const w of a.files)
2021
2026
  await p.fs.write(F(h, w.path), w.text);
2022
- j(p);
2023
- const N = (await T(p)).get(a.id.toLowerCase());
2024
- if (!N)
2027
+ k(p);
2028
+ const T = (await N(p)).get(a.id.toLowerCase());
2029
+ if (!T)
2025
2030
  throw new Error(`The new module ${a.id} has no manifest naming it`);
2026
- return N.ref;
2031
+ return T.ref;
2027
2032
  },
2028
2033
  async deleteModule(a) {
2029
- const { module: p } = await I(a), g = y(a.workspaceId);
2030
- await g.fs.removeDir(p.dir), s.delete(`${g.id}:${a.id.toLowerCase()}`), j(g);
2034
+ const { module: p } = await E(a), g = y(a.workspaceId);
2035
+ await g.fs.removeDir(p.dir), s.delete(`${g.id}:${a.id.toLowerCase()}`), k(g);
2031
2036
  },
2032
2037
  async listTemplates() {
2033
2038
  const a = /* @__PURE__ */ new Map(), p = [];
2034
2039
  for (const g of i)
2035
- for (const h of await E(g)) {
2036
- let N;
2040
+ for (const h of await x(g)) {
2041
+ let T;
2037
2042
  try {
2038
- N = (await A(g, h)).entries;
2043
+ T = (await A(g, h)).entries;
2039
2044
  } catch {
2040
2045
  continue;
2041
2046
  }
2042
- for (const u of N) {
2043
- const w = Vt(u, g.readOnly);
2047
+ for (const u of T) {
2048
+ const w = Wt(u, g.readOnly);
2044
2049
  w.id && !a.has(w.id.toLowerCase()) && (a.set(w.id.toLowerCase(), { rootId: g.id, path: h }), p.push(w));
2045
2050
  }
2046
2051
  }
@@ -2049,22 +2054,22 @@ function ni(e) {
2049
2054
  async saveTemplate(a, p) {
2050
2055
  const g = (p == null ? void 0 : p.previousId) ?? a.id, h = await $(g);
2051
2056
  if (h) {
2052
- const N = y(h.rootId), { text: u, entries: w } = await A(N, h.path), L = w.findIndex(
2057
+ const T = y(h.rootId), { text: u, entries: w } = await A(T, h.path), L = w.findIndex(
2053
2058
  (R) => me(R) && String(R.slug ?? "").toLowerCase() === g.toLowerCase()
2054
2059
  ), M = [...w];
2055
2060
  M[L < 0 ? M.length : L] = xe(
2056
2061
  a,
2057
2062
  L < 0 ? void 0 : w[L]
2058
- ), await D(N, h.path, u, M);
2063
+ ), await D(T, h.path, u, M);
2059
2064
  } else {
2060
- const N = i.find((M) => !M.readOnly && C(M));
2061
- if (!N)
2065
+ const T = i.find((M) => !M.readOnly && C(M));
2066
+ if (!T)
2062
2067
  throw new Error("No writable folder holds templates");
2063
2068
  const u = F(
2064
- C(N),
2065
- `wizard-templates-${Zt(a.category ?? "custom")}.seed.json`
2066
- ), { text: w, entries: L } = await A(N, u);
2067
- await D(N, u, w, [...L, xe(a)]);
2069
+ C(T),
2070
+ `wizard-templates-${Xt(a.category ?? "custom")}.seed.json`
2071
+ ), { text: w, entries: L } = await A(T, u);
2072
+ await D(T, u, w, [...L, xe(a)]);
2068
2073
  }
2069
2074
  return r = null, { ...a, extra: a.extra };
2070
2075
  },
@@ -2072,65 +2077,65 @@ function ni(e) {
2072
2077
  const p = await $(a);
2073
2078
  if (!p)
2074
2079
  return;
2075
- const g = y(p.rootId), { text: h, entries: N } = await A(g, p.path);
2080
+ const g = y(p.rootId), { text: h, entries: T } = await A(g, p.path);
2076
2081
  await D(
2077
2082
  g,
2078
2083
  p.path,
2079
2084
  h,
2080
- N.filter(
2085
+ T.filter(
2081
2086
  (u) => !(me(u) && String(u.slug ?? "").toLowerCase() === a.toLowerCase())
2082
2087
  )
2083
2088
  ), r = null;
2084
2089
  },
2085
2090
  async validate(a, p) {
2086
- const g = l(a.workspaceId), h = [...(await T(g)).values()], N = await Promise.all(
2087
- h.filter((L) => L.ref.id.toLowerCase() !== a.id.toLowerCase()).map((L) => S(g, L))
2091
+ const g = l(a.workspaceId), h = [...(await N(g)).values()], T = await Promise.all(
2092
+ h.filter((L) => L.ref.id.toLowerCase() !== a.id.toLowerCase()).map((L) => j(g, L))
2088
2093
  ), u = h.find((L) => L.ref.id.toLowerCase() === a.id.toLowerCase()), w = (u == null ? void 0 : u.dir) ?? a.id;
2089
- return Rt(
2090
- [...N, { location: w, group: w.split("/")[0], files: p }],
2094
+ return Vt(
2095
+ [...T, { location: w, group: w.split("/")[0], files: p }],
2091
2096
  {
2092
2097
  knownDuplicates: e.knownDuplicates
2093
2098
  }
2094
2099
  ).filter((L) => L.message.split(/[ ,]+/).includes(w));
2095
2100
  },
2096
2101
  async listRevisions(a, p) {
2097
- const { root: g, module: h } = await I(a), N = (await f(g.fs, h.dir)).filter(
2102
+ const { root: g, module: h } = await E(a), T = (await f(g.fs, h.dir)).filter(
2098
2103
  (w) => !p || w.path === p
2099
2104
  ), u = /* @__PURE__ */ new Map();
2100
- for (const w of N)
2105
+ for (const w of T)
2101
2106
  u.set(w.stamp, [...u.get(w.stamp) ?? [], w.path]);
2102
2107
  return [...u].map(([w, L]) => ({
2103
2108
  id: w,
2104
- timestamp: Jt(w) ?? 0,
2109
+ timestamp: Zt(w) ?? 0,
2105
2110
  summary: L.sort().join(", "),
2106
2111
  ...p ? { path: p } : {}
2107
2112
  })).sort((w, L) => L.timestamp - w.timestamp);
2108
2113
  },
2109
2114
  async readRevision(a, p, g) {
2110
2115
  var L;
2111
- const { root: h, module: N } = await I(a), u = (await f(h.fs, N.dir)).filter(
2116
+ const { root: h, module: T } = await E(a), u = (await f(h.fs, T.dir)).filter(
2112
2117
  (M) => M.stamp === p && (!g || M.path === g)
2113
2118
  );
2114
2119
  if (u.length === 0)
2115
2120
  throw new Error(`Unknown revision "${p}"`);
2116
2121
  const w = {};
2117
2122
  for (const M of u)
2118
- w[M.path] = ((L = await h.fs.read(F(N.dir, M.at))) == null ? void 0 : L.text) ?? "";
2123
+ w[M.path] = ((L = await h.fs.read(F(T.dir, M.at))) == null ? void 0 : L.text) ?? "";
2119
2124
  return g ? w[g] : JSON.stringify(w, null, 2);
2120
2125
  },
2121
2126
  async rollback(a, p, g) {
2122
2127
  var L;
2123
- const { module: h } = await I(a), N = y(a.workspaceId), u = (await f(N.fs, h.dir)).filter(
2128
+ const { module: h } = await E(a), T = y(a.workspaceId), u = (await f(T.fs, h.dir)).filter(
2124
2129
  (M) => M.stamp === p && (!g || M.path === g)
2125
2130
  );
2126
2131
  if (u.length === 0)
2127
2132
  throw new Error(`Unknown revision "${p}"`);
2128
2133
  const w = fe(o());
2129
2134
  for (const M of u) {
2130
- const R = F(h.dir, M.path), B = ((L = await N.fs.read(F(h.dir, M.at))) == null ? void 0 : L.text) ?? "", Z = await N.fs.read(R);
2131
- Z && await v(N.fs, R, Z.text, w), await N.fs.write(R, B);
2135
+ const R = F(h.dir, M.path), B = ((L = await T.fs.read(F(h.dir, M.at))) == null ? void 0 : L.text) ?? "", Y = await T.fs.read(R);
2136
+ Y && await v(T.fs, R, Y.text, w), await T.fs.write(R, B);
2132
2137
  }
2133
- j(N);
2138
+ k(T);
2134
2139
  }
2135
2140
  };
2136
2141
  return O;
@@ -2140,12 +2145,12 @@ class ye extends Error {
2140
2145
  super(i), this.status = t, this.body = o, this.name = "OmniVerkRestError";
2141
2146
  }
2142
2147
  }
2143
- const Yt = new TextDecoder("utf-8", { ignoreBOM: !0 });
2144
- function Xt(e) {
2148
+ const Qt = new TextDecoder("utf-8", { ignoreBOM: !0 });
2149
+ function ei(e) {
2145
2150
  const i = atob(e), t = new Uint8Array(i.length);
2146
2151
  for (let o = 0; o < i.length; o++)
2147
2152
  t[o] = i.charCodeAt(o);
2148
- return Yt.decode(t);
2153
+ return Qt.decode(t);
2149
2154
  }
2150
2155
  function Ce(e) {
2151
2156
  const i = new TextEncoder().encode(e);
@@ -2154,36 +2159,36 @@ function Ce(e) {
2154
2159
  t += String.fromCharCode(...i.subarray(o, o + 32768));
2155
2160
  return btoa(t);
2156
2161
  }
2157
- function Qt(e) {
2162
+ function ti(e) {
2158
2163
  let i = 2166136261;
2159
2164
  for (let t = 0; t < e.length; t++)
2160
2165
  i = Math.imul(i ^ e.charCodeAt(t), 16777619);
2161
2166
  return `${e.length}:${(i >>> 0).toString(16)}`;
2162
2167
  }
2163
- function si(e = {}) {
2168
+ function ai(e = {}) {
2164
2169
  const i = (e.baseUrl ?? "/api").replace(/\/+$/, ""), t = e.fetch ?? ((d, m) => globalThis.fetch(d, m)), o = e.language ?? "en", n = encodeURIComponent;
2165
2170
  async function s(d, m, b, C = "json") {
2166
- const j = typeof e.headers == "function" ? await e.headers() : e.headers ?? {}, T = await t(`${i}${m}`, {
2171
+ const k = typeof e.headers == "function" ? await e.headers() : e.headers ?? {}, N = await t(`${i}${m}`, {
2167
2172
  method: d,
2168
2173
  credentials: e.credentials ?? "same-origin",
2169
2174
  headers: {
2170
2175
  Accept: C === "json" ? "application/json" : "text/plain, application/json",
2171
2176
  ...b === void 0 ? {} : { "Content-Type": "application/json" },
2172
- ...j
2177
+ ...k
2173
2178
  },
2174
2179
  ...b === void 0 ? {} : { body: JSON.stringify(b) }
2175
- }), I = await T.text();
2176
- let c = I;
2177
- if (C === "json" || !T.ok)
2180
+ }), E = await N.text();
2181
+ let c = E;
2182
+ if (C === "json" || !N.ok)
2178
2183
  try {
2179
- c = I ? JSON.parse(I) : void 0;
2184
+ c = E ? JSON.parse(E) : void 0;
2180
2185
  } catch {
2181
- c = I;
2186
+ c = E;
2182
2187
  }
2183
- if (!T.ok)
2188
+ if (!N.ok)
2184
2189
  throw new ye(
2185
- `${d} ${m}: ${T.status} ${T.statusText}`,
2186
- T.status,
2190
+ `${d} ${m}: ${N.status} ${N.statusText}`,
2191
+ N.status,
2187
2192
  c
2188
2193
  );
2189
2194
  return c;
@@ -2204,15 +2209,15 @@ function si(e = {}) {
2204
2209
  )).map((b) => Ie(b, o));
2205
2210
  },
2206
2211
  async saveTemplate(d, m) {
2207
- const b = (m == null ? void 0 : m.previousId) ?? d.id, C = Ut(d);
2208
- let j;
2212
+ const b = (m == null ? void 0 : m.previousId) ?? d.id, C = Gt(d);
2213
+ let k;
2209
2214
  if ((m == null ? void 0 : m.previousId) === void 0)
2210
- j = await s(
2215
+ k = await s(
2211
2216
  "GET",
2212
2217
  `/module-templates/${n(d.id)}?lang=${n(o)}`
2213
2218
  ).then(
2214
2219
  () => !0,
2215
- (I) => I instanceof ye && I.status === 404 ? !1 : Promise.reject(I)
2220
+ (E) => E instanceof ye && E.status === 404 ? !1 : Promise.reject(E)
2216
2221
  ) ? await s(
2217
2222
  "PUT",
2218
2223
  `/module-templates/${n(d.id)}?lang=${n(o)}`,
@@ -2223,97 +2228,97 @@ function si(e = {}) {
2223
2228
  throw new Error(
2224
2229
  "The OmniVerk API keeps a template's slug: save it as a new template instead."
2225
2230
  );
2226
- j = await s(
2231
+ k = await s(
2227
2232
  "PUT",
2228
2233
  `/module-templates/${n(b)}?lang=${n(o)}`,
2229
2234
  C
2230
2235
  );
2231
2236
  }
2232
- return Ie(j, o);
2237
+ return Ie(k, o);
2233
2238
  },
2234
2239
  async deleteTemplate(d) {
2235
2240
  await s("DELETE", `/module-templates/${n(d)}`);
2236
2241
  }
2237
2242
  };
2238
2243
  if ((e.mode ?? "manifest-only") === "manifest-only") {
2239
- const d = "seed", m = /* @__PURE__ */ new Map(), b = (j) => {
2240
- var T, I;
2241
- return ((T = m.get(j)) == null ? void 0 : T.manifestFile) ?? `${(I = j.split(".").pop()) == null ? void 0 : I.toLowerCase()}.manifest.json`;
2242
- }, C = async (j) => {
2243
- const T = await s("GET", `/module-manifests/${n(j)}`), I = de(T, { finalNewline: !1 });
2244
- return { path: b(j), text: I, version: Qt(I) };
2244
+ const d = "seed", m = /* @__PURE__ */ new Map(), b = (k) => {
2245
+ var N, E;
2246
+ return ((N = m.get(k)) == null ? void 0 : N.manifestFile) ?? `${(E = k.split(".").pop()) == null ? void 0 : E.toLowerCase()}.manifest.json`;
2247
+ }, C = async (k) => {
2248
+ const N = await s("GET", `/module-manifests/${n(k)}`), E = ae(N, { finalNewline: !1 });
2249
+ return { path: b(k), text: E, version: ti(E) };
2245
2250
  };
2246
2251
  return {
2247
2252
  async listWorkspaces() {
2248
2253
  return [{ id: d, label: e.workspaceLabel ?? "Seed/Modules" }];
2249
2254
  },
2250
2255
  async listModules() {
2251
- const j = await s("GET", "/module-manifests");
2252
- return m.clear(), (j ?? []).map((T) => (m.set(T.packageName, T), {
2256
+ const k = await s("GET", "/module-manifests");
2257
+ return m.clear(), (k ?? []).map((N) => (m.set(N.packageName, N), {
2253
2258
  workspaceId: d,
2254
- id: T.packageName,
2259
+ id: N.packageName,
2255
2260
  // the package is the manifest's category, as in the `files` mode and OmniVerk's own
2256
2261
  // trees (1.3.14); the first folder only while the API does not list the category
2257
- packageId: T.category || T.path.split("/")[0] || void 0,
2258
- label: T.packageName,
2259
- location: T.path,
2260
- files: [T.manifestFile],
2261
- search: T.path,
2262
+ packageId: N.category || N.path.split("/")[0] || void 0,
2263
+ label: N.packageName,
2264
+ location: N.path,
2265
+ files: [N.manifestFile],
2266
+ search: N.path,
2262
2267
  // only the manifest: the checks and the preview do not count what is not given
2263
2268
  contents: "manifest"
2264
2269
  }));
2265
2270
  },
2266
- async readModule(j) {
2267
- return [await C(j.id)];
2271
+ async readModule(k) {
2272
+ return [await C(k.id)];
2268
2273
  },
2269
- async writeModule(j, T) {
2270
- const I = b(j.id), c = T.find((x) => x.path !== I || x.type !== "write");
2274
+ async writeModule(k, N) {
2275
+ const E = b(k.id), c = N.find((I) => I.path !== E || I.type !== "write");
2271
2276
  if (c)
2272
2277
  throw new Error(
2273
2278
  `This OmniVerk API stores only the manifest; "${c.path}" was not saved.`
2274
2279
  );
2275
- const v = T[0];
2280
+ const v = N[0];
2276
2281
  if (!v || v.type !== "write")
2277
2282
  return { ok: !0, versions: {} };
2278
- const f = await C(j.id);
2283
+ const f = await C(k.id);
2279
2284
  if (v.baseVersion !== void 0 && v.baseVersion !== f.version)
2280
- return { ok: !1, conflicts: [{ path: I, currentVersion: f.version }] };
2281
- const E = await s(
2285
+ return { ok: !1, conflicts: [{ path: E, currentVersion: f.version }] };
2286
+ const x = await s(
2282
2287
  "PUT",
2283
- `/module-manifests/${n(j.id)}`,
2288
+ `/module-manifests/${n(k.id)}`,
2284
2289
  {
2285
2290
  manifest: _(v.text).value
2286
2291
  }
2287
- ), A = await C(j.id);
2292
+ ), A = await C(k.id);
2288
2293
  return {
2289
2294
  ok: !0,
2290
- versions: { [I]: A.version },
2291
- ...E != null && E.revision ? { revision: E.revision } : {}
2295
+ versions: { [E]: A.version },
2296
+ ...x != null && x.revision ? { revision: x.revision } : {}
2292
2297
  };
2293
2298
  },
2294
- async listRevisions(j) {
2299
+ async listRevisions(k) {
2295
2300
  return (await s(
2296
2301
  "GET",
2297
- `/module-manifests/${n(j.id)}/revisions`
2298
- ) ?? []).map((I) => ({
2299
- id: I.id,
2300
- timestamp: Date.parse(I.at) || 0,
2301
- path: b(j.id),
2302
- ...I.sizeBytes !== void 0 ? { summary: `${I.sizeBytes} B` } : {}
2302
+ `/module-manifests/${n(k.id)}/revisions`
2303
+ ) ?? []).map((E) => ({
2304
+ id: E.id,
2305
+ timestamp: Date.parse(E.at) || 0,
2306
+ path: b(k.id),
2307
+ ...E.sizeBytes !== void 0 ? { summary: `${E.sizeBytes} B` } : {}
2303
2308
  }));
2304
2309
  },
2305
- async readRevision(j, T) {
2310
+ async readRevision(k, N) {
2306
2311
  return s(
2307
2312
  "GET",
2308
- `/module-manifests/${n(j.id)}/revisions/${n(T)}`,
2313
+ `/module-manifests/${n(k.id)}/revisions/${n(N)}`,
2309
2314
  void 0,
2310
2315
  "text"
2311
2316
  );
2312
2317
  },
2313
- async rollback(j, T) {
2318
+ async rollback(k, N) {
2314
2319
  await s(
2315
2320
  "POST",
2316
- `/module-manifests/${n(j.id)}/revisions/${n(T)}/rollback`
2321
+ `/module-manifests/${n(k.id)}/revisions/${n(N)}/rollback`
2317
2322
  );
2318
2323
  },
2319
2324
  ...r
@@ -2334,7 +2339,7 @@ function si(e = {}) {
2334
2339
  const m = await s("GET", l(d));
2335
2340
  return ((m == null ? void 0 : m.files) ?? []).map((b) => ({
2336
2341
  path: b.path,
2337
- text: Xt(b.content),
2342
+ text: ei(b.content),
2338
2343
  ...b.version ? { version: b.version } : {},
2339
2344
  ...b.readOnly ? { readOnly: !0 } : {}
2340
2345
  }));
@@ -2347,12 +2352,12 @@ function si(e = {}) {
2347
2352
  l(d),
2348
2353
  {
2349
2354
  changes: m.map(
2350
- (j) => j.type === "write" ? {
2355
+ (k) => k.type === "write" ? {
2351
2356
  type: "write",
2352
- path: j.path,
2353
- content: Ce(j.text),
2354
- baseVersion: j.baseVersion
2355
- } : { type: "delete", path: j.path, baseVersion: j.baseVersion }
2357
+ path: k.path,
2358
+ content: Ce(k.text),
2359
+ baseVersion: k.baseVersion
2360
+ } : { type: "delete", path: k.path, baseVersion: k.baseVersion }
2356
2361
  )
2357
2362
  }
2358
2363
  );
@@ -2363,7 +2368,7 @@ function si(e = {}) {
2363
2368
  };
2364
2369
  } catch (C) {
2365
2370
  if (C instanceof ye && C.status === 409)
2366
- return { ok: !1, conflicts: ((b = C.body) == null ? void 0 : b.conflicts) ?? m.map((T) => ({ path: T.path })) };
2371
+ return { ok: !1, conflicts: ((b = C.body) == null ? void 0 : b.conflicts) ?? m.map((N) => ({ path: N.path })) };
2367
2372
  throw C;
2368
2373
  }
2369
2374
  },
@@ -2411,7 +2416,7 @@ function si(e = {}) {
2411
2416
  ...r
2412
2417
  };
2413
2418
  }
2414
- const ei = [
2419
+ const ii = [
2415
2420
  "en",
2416
2421
  "pl",
2417
2422
  "de",
@@ -2440,11 +2445,11 @@ const ei = [
2440
2445
  } catch {
2441
2446
  return { path: i.path, value: {} };
2442
2447
  }
2443
- }, ti = (e) => {
2448
+ }, ni = (e) => {
2444
2449
  var i;
2445
2450
  return ((i = be(e)) == null ? void 0 : i.path.replace(/\.manifest\.json$/i, "")) ?? "module";
2446
2451
  };
2447
- function oi(e = {}) {
2452
+ function ri(e = {}) {
2448
2453
  const i = e.t ?? ((s, r) => r), t = (s, r) => i(`devStudio.omniverk.${s}`, r), o = {
2449
2454
  type: "object",
2450
2455
  properties: {
@@ -2453,7 +2458,7 @@ function oi(e = {}) {
2453
2458
  dataType: {
2454
2459
  type: "string",
2455
2460
  title: t("field.dataType", "Data type"),
2456
- enum: [...vt]
2461
+ enum: [...bt]
2457
2462
  },
2458
2463
  maxLength: { type: "integer", title: t("field.maxLength", "Max length") },
2459
2464
  isRequired: { type: "boolean", title: t("field.isRequired", "Required") },
@@ -2484,21 +2489,21 @@ function oi(e = {}) {
2484
2489
  };
2485
2490
  return {
2486
2491
  id: "omniverk",
2487
- kinds: yt,
2488
- manifestSections: ht(i, { scripting: e.scripting }),
2492
+ kinds: ht,
2493
+ manifestSections: vt(i, { scripting: e.scripting }),
2489
2494
  entities: { entityMetaSchema: n, fieldSchema: o },
2490
- locales: e.locales ?? ei,
2495
+ locales: e.locales ?? ii,
2491
2496
  requiredLocales: ["en", "pl"],
2492
2497
  moduleId: (s) => {
2493
2498
  var l;
2494
2499
  const r = (l = be(s)) == null ? void 0 : l.value.packageName;
2495
2500
  return typeof r == "string" && r ? r : void 0;
2496
2501
  },
2497
- validateModule: (s) => Pt(s),
2502
+ validateModule: (s) => qt(s),
2498
2503
  generateModule: async (s, { existingIds: r }) => {
2499
- const l = await xt(
2504
+ const l = await Ct(
2500
2505
  {
2501
- ...It(s),
2506
+ ...Ot(s),
2502
2507
  iconConfig: e.iconConfig,
2503
2508
  ownerTenantId: e.ownerTenantId
2504
2509
  },
@@ -2513,10 +2518,34 @@ function oi(e = {}) {
2513
2518
  files: l.package.files
2514
2519
  };
2515
2520
  },
2516
- duplicateModule: (s, r) => Ot(s, r),
2521
+ duplicateModule: (s, r) => Lt(s, r),
2522
+ scripts: {
2523
+ categories: [
2524
+ "calculation",
2525
+ "formatting",
2526
+ "integration",
2527
+ "maintenance",
2528
+ "reporting",
2529
+ "utility",
2530
+ "validation"
2531
+ ],
2532
+ phases: ["preInstall", "postInstall", "preUninstall", "postUninstall", "migrations"]
2533
+ },
2517
2534
  newFile: (s, { files: r }) => {
2518
2535
  var C;
2519
- const l = ti(r), y = ((C = be(r)) == null ? void 0 : C.value) ?? {}, d = `${String(y.packageName ?? l)}.Core`, b = {
2536
+ const l = ni(r), y = ((C = be(r)) == null ? void 0 : C.value) ?? {};
2537
+ if (s === "scripts") {
2538
+ let k = `${l}.scripts.json`;
2539
+ for (let E = 2; r.some((c) => c.path === k); E++)
2540
+ k = `${l}.${E}.scripts.json`;
2541
+ const N = {
2542
+ moduleName: String(y.packageName ?? l),
2543
+ version: "1.0.0",
2544
+ scripts: []
2545
+ };
2546
+ return { path: k, text: ae(N) };
2547
+ }
2548
+ const d = `${String(y.packageName ?? l)}.Core`, b = {
2520
2549
  entities: ["entities.json", { moduleName: d, version: "1.0.0", entities: [] }],
2521
2550
  views: ["views.json", { moduleName: d, version: "1.0.0", views: [] }],
2522
2551
  workflows: ["workflows.json", { moduleName: d, version: "1.0.0", workflows: [] }],
@@ -2526,7 +2555,7 @@ function oi(e = {}) {
2526
2555
  ],
2527
2556
  seeds: ["seeds.json", { moduleName: d, version: "1.0.0", seeds: {} }]
2528
2557
  }[s];
2529
- return b ? { path: `${l}.${b[0]}`, text: de(b[1]) } : void 0;
2558
+ return b ? { path: `${l}.${b[0]}`, text: ae(b[1]) } : void 0;
2530
2559
  },
2531
2560
  templateSchema: {
2532
2561
  type: "object",
@@ -2550,7 +2579,7 @@ function oi(e = {}) {
2550
2579
  }
2551
2580
  };
2552
2581
  }
2553
- function ai(e = {}) {
2582
+ function li(e = {}) {
2554
2583
  let i = 0;
2555
2584
  const t = /* @__PURE__ */ new Map();
2556
2585
  for (const [n, s] of Object.entries(e))
@@ -2589,10 +2618,10 @@ function ai(e = {}) {
2589
2618
  };
2590
2619
  }
2591
2620
  const Ge = () => typeof window > "u" ? void 0 : window.showDirectoryPicker;
2592
- function ri() {
2621
+ function ci() {
2593
2622
  return typeof Ge() == "function";
2594
2623
  }
2595
- async function li(e = {}) {
2624
+ async function di(e = {}) {
2596
2625
  const i = Ge();
2597
2626
  if (!i)
2598
2627
  throw new Error("This browser cannot open folders (File System Access API).");
@@ -2601,8 +2630,8 @@ async function li(e = {}) {
2601
2630
  ...e.id ? { id: e.id } : {}
2602
2631
  });
2603
2632
  }
2604
- const re = (e) => typeof e == "object" && e !== null && (e.name === "NotFoundError" || e.name === "TypeMismatchError");
2605
- function ci(e) {
2633
+ const le = (e) => typeof e == "object" && e !== null && (e.name === "NotFoundError" || e.name === "TypeMismatchError");
2634
+ function pi(e) {
2606
2635
  const i = new TextDecoder("utf-8", { ignoreBOM: !0 });
2607
2636
  async function t(r, l = !1) {
2608
2637
  let y = e;
@@ -2610,7 +2639,7 @@ function ci(e) {
2610
2639
  try {
2611
2640
  y = await y.getDirectoryHandle(d, { create: l });
2612
2641
  } catch (m) {
2613
- if (re(m))
2642
+ if (le(m))
2614
2643
  return null;
2615
2644
  throw m;
2616
2645
  }
@@ -2627,7 +2656,7 @@ function ci(e) {
2627
2656
  try {
2628
2657
  return await m.getFileHandle(d, { create: l });
2629
2658
  } catch (b) {
2630
- if (re(b))
2659
+ if (le(b))
2631
2660
  return null;
2632
2661
  throw b;
2633
2662
  }
@@ -2660,7 +2689,7 @@ function ci(e) {
2660
2689
  try {
2661
2690
  await (d == null ? void 0 : d.removeEntry(y));
2662
2691
  } catch (m) {
2663
- if (!re(m))
2692
+ if (!le(m))
2664
2693
  throw m;
2665
2694
  }
2666
2695
  },
@@ -2669,7 +2698,7 @@ function ci(e) {
2669
2698
  try {
2670
2699
  await (d == null ? void 0 : d.removeEntry(y, { recursive: !0 }));
2671
2700
  } catch (m) {
2672
- if (!re(m))
2701
+ if (!le(m))
2673
2702
  throw m;
2674
2703
  }
2675
2704
  }
@@ -2677,43 +2706,44 @@ function ci(e) {
2677
2706
  }
2678
2707
  export {
2679
2708
  W as OMNIVERK_CUSTOM_PREFIX,
2680
- vt as OMNIVERK_DATA_TYPES,
2681
- Ft as OMNIVERK_LEGACY_LIST_VIEW_FILES,
2682
- ei as OMNIVERK_LOCALES,
2709
+ bt as OMNIVERK_DATA_TYPES,
2710
+ Rt as OMNIVERK_LEGACY_LIST_VIEW_FILES,
2711
+ ii as OMNIVERK_LOCALES,
2683
2712
  ye as OmniVerkRestError,
2684
- xt as buildOmniVerkModule,
2685
- ci as createDirectoryHandleFileSystem,
2686
- ai as createMemorySeedFileSystem,
2687
- si as createOmniVerkRestProvider,
2688
- oi as createOmniVerkStudioPreset,
2689
- ni as createSeedFolderProvider,
2690
- Ot as duplicateOmniVerkModule,
2691
- ri as isSeedFolderPickerSupported,
2692
- Xe as omniverkEntitiesKind,
2693
- yt as omniverkFileKinds,
2694
- kt as omniverkFilePrefix,
2695
- Qe as omniverkI18nKind,
2696
- He as omniverkManifestKind,
2697
- ht as omniverkManifestSections,
2713
+ Ct as buildOmniVerkModule,
2714
+ pi as createDirectoryHandleFileSystem,
2715
+ li as createMemorySeedFileSystem,
2716
+ ai as createOmniVerkRestProvider,
2717
+ ri as createOmniVerkStudioPreset,
2718
+ oi as createSeedFolderProvider,
2719
+ Lt as duplicateOmniVerkModule,
2720
+ ci as isSeedFolderPickerSupported,
2721
+ Qe as omniverkEntitiesKind,
2722
+ ht as omniverkFileKinds,
2723
+ Nt as omniverkFilePrefix,
2724
+ et as omniverkI18nKind,
2725
+ Ze as omniverkManifestKind,
2726
+ vt as omniverkManifestSections,
2698
2727
  P as omniverkPascalIdentifier,
2699
- mt as omniverkPermissionsKind,
2728
+ ut as omniverkPermissionsKind,
2700
2729
  fe as omniverkRevisionStamp,
2701
- ft as omniverkScriptKind,
2702
- ut as omniverkSeedsKind,
2703
- It as omniverkSpecFromStudio,
2730
+ yt as omniverkScriptKind,
2731
+ gt as omniverkScriptsKind,
2732
+ ft as omniverkSeedsKind,
2733
+ Ot as omniverkSpecFromStudio,
2704
2734
  qe as omniverkStableId,
2705
2735
  Ve as omniverkTableName,
2706
2736
  Ie as omniverkTemplateFromDto,
2707
- Vt as omniverkTemplateFromEntry,
2737
+ Wt as omniverkTemplateFromEntry,
2708
2738
  xe as omniverkTemplateToEntry,
2709
- Ut as omniverkTemplateToInput,
2710
- st as omniverkViewFromItem,
2711
- nt as omniverkViewItem,
2712
- ot as omniverkViewsKind,
2713
- lt as omniverkWorkflowFromItem,
2714
- rt as omniverkWorkflowItem,
2715
- ct as omniverkWorkflowsKind,
2716
- li as pickSeedDirectory,
2717
- Pt as validateOmniVerkModule,
2718
- Rt as validateOmniVerkWorkspace
2739
+ Gt as omniverkTemplateToInput,
2740
+ ot as omniverkViewFromItem,
2741
+ st as omniverkViewItem,
2742
+ at as omniverkViewsKind,
2743
+ ct as omniverkWorkflowFromItem,
2744
+ lt as omniverkWorkflowItem,
2745
+ dt as omniverkWorkflowsKind,
2746
+ di as pickSeedDirectory,
2747
+ qt as validateOmniVerkModule,
2748
+ Vt as validateOmniVerkWorkspace
2719
2749
  };