@nice2dev/ui-forms 1.4.4 → 1.4.5

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/studio.mjs CHANGED
@@ -1,7 +1,138 @@
1
- var ae = Object.defineProperty;
2
- var ce = (e, t, n) => t in e ? ae(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var q = (e, t, n) => ce(e, typeof t != "symbol" ? t + "" : t, n);
4
- const H = {
1
+ var me = Object.defineProperty;
2
+ var he = (e, t, n) => t in e ? me(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var G = (e, t, n) => he(e, typeof t != "symbol" ? t + "" : t, n);
4
+ const T = () => ({
5
+ version: 1,
6
+ sections: [],
7
+ folders: [],
8
+ placement: {}
9
+ }), Ge = (e, t) => `${e}:${t}`, P = ".studio.json", ye = /^([^/]+?)\.(manifest|entities|views|workflows|permissions|rbac|seeds|datasources|scripts)\.json$/i, ge = (e) => !e.includes("/") && e.toLowerCase().endsWith(P);
10
+ function Ye(e) {
11
+ const t = e.find((n) => ge(n.path));
12
+ if (t)
13
+ return t.path;
14
+ for (const n of e) {
15
+ const s = ye.exec(n.path);
16
+ if (s)
17
+ return `${s[1]}${P}`;
18
+ }
19
+ return `module${P}`;
20
+ }
21
+ const E = (e) => typeof e == "object" && e !== null && !Array.isArray(e), b = (e) => typeof e == "string" && e ? e : void 0;
22
+ function He(e) {
23
+ if (!e)
24
+ return T();
25
+ let t;
26
+ try {
27
+ t = JSON.parse(e.replace(/^\uFEFF/, ""));
28
+ } catch {
29
+ return T();
30
+ }
31
+ if (!E(t))
32
+ return T();
33
+ const n = (Array.isArray(t.sections) ? t.sections : []).filter(E).map((o) => ({ id: b(o.id), label: b(o.label) ?? b(o.id) })).filter((o) => !!o.id && !!o.label), s = (Array.isArray(t.folders) ? t.folders : []).filter(E).map((o) => ({
34
+ id: b(o.id),
35
+ label: b(o.label) ?? b(o.id),
36
+ group: b(o.group),
37
+ ...b(o.parent) ? { parent: b(o.parent) } : {},
38
+ ...b(o.section) ? { section: b(o.section) } : {}
39
+ })).filter((o) => !!o.id && !!o.label && !!o.group), i = {};
40
+ if (E(t.placement))
41
+ for (const [o, c] of Object.entries(t.placement)) {
42
+ if (!E(c))
43
+ continue;
44
+ const l = {};
45
+ b(c.section) && (l.section = b(c.section)), b(c.folder) && (l.folder = b(c.folder)), typeof c.order == "number" && Number.isFinite(c.order) && (l.order = c.order), (l.section || l.folder || l.order !== void 0) && (i[o] = l);
46
+ }
47
+ return { version: 1, sections: n, folders: s, placement: i };
48
+ }
49
+ const Ze = (e) => e.sections.length === 0 && e.folders.length === 0 && Object.keys(e.placement).length === 0;
50
+ function Qe(e, t) {
51
+ const n = JSON.stringify(e, null, 2) + `
52
+ `;
53
+ return t != null && t.includes(`\r
54
+ `) ? n.replace(/\n/g, `\r
55
+ `) : n;
56
+ }
57
+ const be = (e) => e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "item";
58
+ function ee(e, t) {
59
+ const n = be(e);
60
+ let s = n;
61
+ for (let i = 2; t.has(s); i++)
62
+ s = `${n}-${i}`;
63
+ return s;
64
+ }
65
+ function et(e, t) {
66
+ const n = ee(t, new Set(e.sections.map((s) => s.id)));
67
+ return { layout: { ...e, sections: [...e.sections, { id: n, label: t }] }, id: n };
68
+ }
69
+ function tt(e, t) {
70
+ const n = ee(t.label, new Set(e.folders.map((i) => i.id))), s = { id: n, label: t.label, group: t.group };
71
+ return t.parent && (s.parent = t.parent), t.section && (s.section = t.section), { layout: { ...e, folders: [...e.folders, s] }, id: n };
72
+ }
73
+ function nt(e, t, n) {
74
+ return t.kind === "section" ? { ...e, sections: e.sections.map((s) => s.id === t.id ? { ...s, label: n } : s) } : { ...e, folders: e.folders.map((s) => s.id === t.id ? { ...s, label: n } : s) };
75
+ }
76
+ function st(e, t) {
77
+ const n = {};
78
+ if (t.kind === "folder") {
79
+ const s = e.folders.find((i) => i.id === t.id);
80
+ for (const [i, o] of Object.entries(e.placement))
81
+ n[i] = o.folder === t.id ? { ...o, folder: s == null ? void 0 : s.parent } : o, n[i].folder || delete n[i].folder;
82
+ return {
83
+ ...e,
84
+ folders: e.folders.filter((i) => i.id !== t.id).map((i) => i.parent === t.id ? { ...i, parent: s == null ? void 0 : s.parent } : i).map((i) => {
85
+ if (!i.parent) {
86
+ const { parent: o, ...c } = i;
87
+ return c;
88
+ }
89
+ return i;
90
+ }),
91
+ placement: D(n)
92
+ };
93
+ }
94
+ for (const [s, i] of Object.entries(e.placement))
95
+ if (i.section === t.id) {
96
+ const { section: o, ...c } = i;
97
+ n[s] = c;
98
+ } else
99
+ n[s] = i;
100
+ return {
101
+ ...e,
102
+ sections: e.sections.filter((s) => s.id !== t.id),
103
+ folders: e.folders.map((s) => {
104
+ if (s.section === t.id) {
105
+ const { section: i, ...o } = s;
106
+ return o;
107
+ }
108
+ return s;
109
+ }),
110
+ placement: D(n)
111
+ };
112
+ }
113
+ function D(e) {
114
+ const t = {};
115
+ for (const [n, s] of Object.entries(e))
116
+ (s.section || s.folder || s.order !== void 0) && (t[n] = s);
117
+ return t;
118
+ }
119
+ function it(e, t, n) {
120
+ var o;
121
+ const s = (o = e.placement[t]) == null ? void 0 : o.order, i = {};
122
+ if (n.folder) {
123
+ i.folder = n.folder;
124
+ const c = e.folders.find((l) => l.id === n.folder);
125
+ c != null && c.section && (i.section = c.section);
126
+ } else n.section && (i.section = n.section);
127
+ return s !== void 0 && (i.order = s), { ...e, placement: D({ ...e.placement, [t]: i }) };
128
+ }
129
+ function rt(e, t, n) {
130
+ if (t === n || !e.placement[t])
131
+ return e;
132
+ const s = { ...e.placement, [n]: e.placement[t] };
133
+ return delete s[t], { ...e, placement: s };
134
+ }
135
+ const te = "\uFEFF", ne = {
5
136
  bom: !1,
6
137
  eol: `
7
138
  `,
@@ -9,98 +140,98 @@ const H = {
9
140
  finalNewline: !0,
10
141
  colonSpace: !0
11
142
  };
12
- function C(e) {
143
+ function z(e) {
13
144
  const t = e.charCodeAt(0) === 65279, n = e.includes(`\r
14
145
  `) ? `\r
15
146
  ` : `
16
147
  `;
17
- let i = H.indent;
18
- const r = e.split(/\r?\n/);
19
- for (let c = 1; c < r.length; c++) {
20
- const d = /^([ \t]+)\S/.exec(r[c]);
21
- if (d) {
22
- i = d[1];
148
+ let s = ne.indent;
149
+ const i = e.split(/\r?\n/);
150
+ for (let c = 1; c < i.length; c++) {
151
+ const l = /^([ \t]+)\S/.exec(i[c]);
152
+ if (l) {
153
+ s = l[1];
23
154
  break;
24
155
  }
25
156
  }
26
- const a = /"\s*:(\s?)/.exec(e);
157
+ const o = /"\s*:(\s?)/.exec(e);
27
158
  return {
28
159
  bom: t,
29
160
  eol: n,
30
- indent: i,
161
+ indent: s,
31
162
  finalNewline: /\n$/.test(e),
32
- colonSpace: a ? a[1] !== "" : !0
163
+ colonSpace: o ? o[1] !== "" : !0
33
164
  };
34
165
  }
35
- function E(e) {
36
- const t = C(e);
166
+ function I(e) {
167
+ const t = z(e);
37
168
  return { value: JSON.parse(t.bom ? e.slice(1) : e), format: t };
38
169
  }
39
- function k(e, t) {
40
- const n = { ...H, ...t }, i = j(e, n, "");
41
- return (n.bom ? "\uFEFF" : "") + i + (n.finalNewline ? n.eol : "");
170
+ function v(e, t) {
171
+ const n = { ...ne, ...t }, s = O(e, n, "");
172
+ return (n.bom ? te : "") + s + (n.finalNewline ? n.eol : "");
42
173
  }
43
- function le(e, t) {
174
+ function we(e, t) {
44
175
  if (t === void 0)
45
176
  return e;
46
177
  let n = t.includes(`\r
47
178
  `) ? e.replace(/\r?\n/g, `\r
48
179
  `) : e;
49
- return t.charCodeAt(0) === 65279 && n.charCodeAt(0) !== 65279 && (n = "\uFEFF" + n), n;
180
+ return t.charCodeAt(0) === 65279 && n.charCodeAt(0) !== 65279 && (n = te + n), n;
50
181
  }
51
- function I(e, t) {
182
+ function M(e, t) {
52
183
  if (e === t)
53
184
  return !0;
54
185
  if (typeof e != typeof t || e === null || t === null || typeof e != "object" || Array.isArray(e) !== Array.isArray(t))
55
186
  return !1;
56
187
  if (Array.isArray(e)) {
57
- const a = t;
58
- return e.length === a.length && e.every((c, d) => I(c, a[d]));
188
+ const o = t;
189
+ return e.length === o.length && e.every((c, l) => M(c, o[l]));
59
190
  }
60
- const n = e, i = t, r = Object.keys(n);
61
- return r.length !== Object.keys(i).length ? !1 : r.every(
62
- (a) => Object.prototype.hasOwnProperty.call(i, a) && I(n[a], i[a])
191
+ const n = e, s = t, i = Object.keys(n);
192
+ return i.length !== Object.keys(s).length ? !1 : i.every(
193
+ (o) => Object.prototype.hasOwnProperty.call(s, o) && M(n[o], s[o])
63
194
  );
64
195
  }
65
- function X(e, t, n) {
66
- return de(e, t, n).text;
196
+ function se(e, t, n) {
197
+ return ke(e, t, n).text;
67
198
  }
68
- function de(e, t, n) {
69
- const i = C(e), r = (s) => ({
70
- text: k(t, i),
199
+ function ke(e, t, n) {
200
+ const s = z(e), i = (r) => ({
201
+ text: v(t, s),
71
202
  exact: !1,
72
- reason: s
203
+ reason: r
73
204
  });
74
- let a;
205
+ let o;
75
206
  try {
76
- a = new fe(e).parseDocument();
77
- } catch (s) {
78
- return r(s instanceof Error ? s.message : String(s));
207
+ o = new ve(e).parseDocument();
208
+ } catch (r) {
209
+ return i(r instanceof Error ? r.message : String(r));
79
210
  }
80
- if (T(a))
81
- return r("duplicate keys");
82
- const c = [], d = {
211
+ if (C(o))
212
+ return i("duplicate keys");
213
+ const c = [], l = {
83
214
  text: e,
84
- format: i,
215
+ format: s,
85
216
  edits: c,
86
217
  options: n,
87
218
  compact: !e.trimEnd().includes(`
88
219
  `)
89
220
  };
90
- U(d, a, t, "", !1);
91
- const u = ue(e, c);
221
+ q(l, o, t, "", !1);
222
+ const u = $e(e, c);
92
223
  try {
93
- const s = JSON.parse(i.bom ? u.slice(1) : u);
94
- if (!I(s, t))
95
- return r("patch did not read back");
224
+ const r = JSON.parse(s.bom ? u.slice(1) : u);
225
+ if (!M(r, t))
226
+ return i("patch did not read back");
96
227
  } catch {
97
- return r("patch was not valid JSON");
228
+ return i("patch was not valid JSON");
98
229
  }
99
230
  return { text: u, exact: !0 };
100
231
  }
101
- class fe {
232
+ class ve {
102
233
  constructor(t) {
103
- q(this, "pos", 0);
234
+ G(this, "pos", 0);
104
235
  this.text = t;
105
236
  }
106
237
  parseDocument() {
@@ -124,12 +255,12 @@ class fe {
124
255
  const n = this.pos;
125
256
  if (t === '"')
126
257
  return { kind: "scalar", start: n, end: this.stringEnd(), value: JSON.parse(this.slice(n)) };
127
- const i = /^(?:-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null)/.exec(
258
+ const s = /^(?:-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null)/.exec(
128
259
  this.text.slice(n, n + 64)
129
260
  );
130
- if (!i)
261
+ if (!s)
131
262
  throw new Error(`Unexpected token at ${n}`);
132
- return this.pos = n + i[0].length, { kind: "scalar", start: n, end: this.pos, value: JSON.parse(i[0]) };
263
+ return this.pos = n + s[0].length, { kind: "scalar", start: n, end: this.pos, value: JSON.parse(s[0]) };
133
264
  }
134
265
  slice(t) {
135
266
  return this.text.slice(t, this.pos);
@@ -153,17 +284,17 @@ class fe {
153
284
  return { kind: "object", start: t, end: ++this.pos, members: n };
154
285
  for (; ; ) {
155
286
  this.ws();
156
- const i = this.pos;
287
+ const s = this.pos;
157
288
  if (this.text[this.pos] !== '"')
158
289
  throw new Error(`Expected a key at ${this.pos}`);
159
- const r = JSON.parse(this.text.slice(i, this.stringEnd()));
290
+ const i = JSON.parse(this.text.slice(s, this.stringEnd()));
160
291
  if (this.ws(), this.text[this.pos] !== ":")
161
292
  throw new Error(`Expected ':' at ${this.pos}`);
162
- this.pos++, n.push({ key: r, start: i, value: this.value() }), this.ws();
163
- const a = this.text[this.pos++];
164
- if (a === "}")
293
+ this.pos++, n.push({ key: i, start: s, value: this.value() }), this.ws();
294
+ const o = this.text[this.pos++];
295
+ if (o === "}")
165
296
  return { kind: "object", start: t, end: this.pos, members: n };
166
- if (a !== ",")
297
+ if (o !== ",")
167
298
  throw new Error(`Expected ',' or '}' at ${this.pos - 1}`);
168
299
  }
169
300
  }
@@ -173,277 +304,277 @@ class fe {
173
304
  return { kind: "array", start: t, end: ++this.pos, items: n };
174
305
  for (; ; ) {
175
306
  n.push(this.value()), this.ws();
176
- const i = this.text[this.pos++];
177
- if (i === "]")
307
+ const s = this.text[this.pos++];
308
+ if (s === "]")
178
309
  return { kind: "array", start: t, end: this.pos, items: n };
179
- if (i !== ",")
310
+ if (s !== ",")
180
311
  throw new Error(`Expected ',' or ']' at ${this.pos - 1}`);
181
312
  }
182
313
  }
183
314
  }
184
- function T(e) {
315
+ function C(e) {
185
316
  if (e.kind === "object") {
186
317
  const t = /* @__PURE__ */ new Set();
187
318
  for (const n of e.members) {
188
- if (t.has(n.key) || T(n.value))
319
+ if (t.has(n.key) || C(n.value))
189
320
  return !0;
190
321
  t.add(n.key);
191
322
  }
192
323
  } else if (e.kind === "array")
193
- return e.items.some(T);
324
+ return e.items.some(C);
194
325
  return !1;
195
326
  }
196
- function M(e) {
327
+ function F(e) {
197
328
  if (e.kind === "scalar")
198
329
  return e.value;
199
330
  if (e.kind === "array")
200
- return e.items.map(M);
331
+ return e.items.map(F);
201
332
  const t = {};
202
333
  for (const n of e.members)
203
- t[n.key] = M(n.value);
334
+ t[n.key] = F(n.value);
204
335
  return t;
205
336
  }
206
- function j(e, t, n) {
337
+ function O(e, t, n) {
207
338
  if (e === null || typeof e != "object")
208
339
  return e === void 0 ? "null" : JSON.stringify(e);
209
- const i = n + t.indent, r = t.colonSpace ? ": " : ":";
340
+ const s = n + t.indent, i = t.colonSpace ? ": " : ":";
210
341
  if (Array.isArray(e))
211
- return e.length === 0 ? "[]" : `[${t.eol}${e.map((c) => i + j(c, t, i)).join(`,${t.eol}`)}${t.eol}${n}]`;
212
- const a = Object.entries(e).filter(
342
+ return e.length === 0 ? "[]" : `[${t.eol}${e.map((c) => s + O(c, t, s)).join(`,${t.eol}`)}${t.eol}${n}]`;
343
+ const o = Object.entries(e).filter(
213
344
  ([, c]) => c !== void 0
214
345
  );
215
- return a.length === 0 ? "{}" : `{${t.eol}${a.map(([c, d]) => `${i}${JSON.stringify(c)}${r}${j(d, t, i)}`).join(`,${t.eol}`)}${t.eol}${n}}`;
346
+ return o.length === 0 ? "{}" : `{${t.eol}${o.map(([c, l]) => `${s}${JSON.stringify(c)}${i}${O(l, t, s)}`).join(`,${t.eol}`)}${t.eol}${n}}`;
216
347
  }
217
- function O(e, t, n = !1) {
348
+ function A(e, t, n = !1) {
218
349
  if (e === null || typeof e != "object")
219
350
  return e === void 0 ? "null" : JSON.stringify(e);
220
- const i = t.colonSpace ? ": " : ":", r = n ? "," : ", ";
351
+ const s = t.colonSpace ? ": " : ":", i = n ? "," : ", ";
221
352
  if (Array.isArray(e))
222
- return `[${e.map((d) => O(d, t, n)).join(r)}]`;
223
- const a = Object.entries(e).filter(
224
- ([, d]) => d !== void 0
353
+ return `[${e.map((l) => A(l, t, n)).join(i)}]`;
354
+ const o = Object.entries(e).filter(
355
+ ([, l]) => l !== void 0
225
356
  ), c = n ? "" : " ";
226
- return a.length === 0 ? "{}" : `{${c}${a.map(([d, u]) => `${JSON.stringify(d)}${i}${O(u, t, n)}`).join(r)}${c}}`;
357
+ return o.length === 0 ? "{}" : `{${c}${o.map(([l, u]) => `${JSON.stringify(l)}${s}${A(u, t, n)}`).join(i)}${c}}`;
227
358
  }
228
- const Y = (e) => e.compact ? "," : ", ";
229
- function ue(e, t) {
359
+ const ie = (e) => e.compact ? "," : ", ";
360
+ function $e(e, t) {
230
361
  let n = e;
231
- for (const i of [...t].sort((r, a) => a.start - r.start))
232
- n = n.slice(0, i.start) + i.text + n.slice(i.end);
362
+ for (const s of [...t].sort((i, o) => o.start - i.start))
363
+ n = n.slice(0, s.start) + s.text + n.slice(s.end);
233
364
  return n;
234
365
  }
235
- function x(e, t) {
236
- var i;
366
+ function J(e, t) {
367
+ var s;
237
368
  const n = e.lastIndexOf(`
238
369
  `, t - 1) + 1;
239
- return ((i = /^[ \t]*/.exec(e.slice(n, t))) == null ? void 0 : i[0]) ?? "";
370
+ return ((s = /^[ \t]*/.exec(e.slice(n, t))) == null ? void 0 : s[0]) ?? "";
240
371
  }
241
- function Z(e, t) {
372
+ function re(e, t) {
242
373
  return !e.slice(t.start, t.end).includes(`
243
374
  `);
244
375
  }
245
- function V(e, t, n) {
246
- return e.compact ? !0 : t.kind === "scalar" || (t.kind === "object" ? t.members.length === 0 : t.items.length === 0) ? n : Z(e.text, t);
376
+ function W(e, t, n) {
377
+ return e.compact ? !0 : t.kind === "scalar" || (t.kind === "object" ? t.members.length === 0 : t.items.length === 0) ? n : re(e.text, t);
247
378
  }
248
- function N(e, t, n, i) {
249
- const r = V(e, t, i);
379
+ function x(e, t, n, s) {
380
+ const i = W(e, t, s);
250
381
  e.edits.push({
251
382
  start: t.start,
252
383
  end: t.end,
253
- text: r ? O(n, e.format, e.compact) : j(n, e.format, x(e.text, t.start))
384
+ text: i ? A(n, e.format, e.compact) : O(n, e.format, J(e.text, t.start))
254
385
  });
255
386
  }
256
- const Q = (e) => typeof e == "object" && e !== null && !Array.isArray(e);
257
- function U(e, t, n, i, r) {
387
+ const oe = (e) => typeof e == "object" && e !== null && !Array.isArray(e);
388
+ function q(e, t, n, s, i) {
258
389
  if (t.kind === "scalar") {
259
390
  if (t.value === n)
260
391
  return;
261
- N(e, t, n, r);
392
+ x(e, t, n, i);
262
393
  return;
263
394
  }
264
- I(M(t), n) || (t.kind === "object" && Q(n) ? pe(e, t, n, i, r) : t.kind === "array" && Array.isArray(n) ? ye(e, t, n, i, r) : N(e, t, n, r));
395
+ M(F(t), n) || (t.kind === "object" && oe(n) ? Se(e, t, n, s, i) : t.kind === "array" && Array.isArray(n) ? Ae(e, t, n, s, i) : x(e, t, n, i));
265
396
  }
266
- function ee(e, t, n) {
267
- return n !== void 0 ? x(e.text, n) : x(e.text, t.start) + e.format.indent;
397
+ function ae(e, t, n) {
398
+ return n !== void 0 ? J(e.text, n) : J(e.text, t.start) + e.format.indent;
268
399
  }
269
- function pe(e, t, n, i, r) {
270
- var l;
271
- const a = V(e, t, r), c = t.members.filter(
400
+ function Se(e, t, n, s, i) {
401
+ var d;
402
+ const o = W(e, t, i), c = t.members.filter(
272
403
  (f) => Object.prototype.hasOwnProperty.call(n, f.key) && n[f.key] !== void 0
273
- ), d = Object.keys(n).filter(
404
+ ), l = Object.keys(n).filter(
274
405
  (f) => n[f] !== void 0 && !t.members.some((h) => h.key === f)
275
406
  );
276
407
  if (c.length === 0 && t.members.length > 0) {
277
- N(e, t, n, r);
408
+ x(e, t, n, i);
278
409
  return;
279
410
  }
280
411
  for (const f of c)
281
- U(e, f.value, n[f.key], `${i}/${we(f.key)}`, a);
282
- if (te(
412
+ q(e, f.value, n[f.key], `${s}/${Ne(f.key)}`, o);
413
+ if (ce(
283
414
  e,
284
415
  t.members.map((f) => ({ start: f.start, end: f.value.end })),
285
416
  t.members.map((f) => c.includes(f))
286
- ), d.length === 0)
417
+ ), l.length === 0)
287
418
  return;
288
419
  const u = e.format.colonSpace ? ": " : ":";
289
- if (a) {
290
- const f = d.map(
291
- (h) => `${JSON.stringify(h)}${u}${O(n[h], e.format, e.compact)}`
420
+ if (o) {
421
+ const f = l.map(
422
+ (h) => `${JSON.stringify(h)}${u}${A(n[h], e.format, e.compact)}`
292
423
  );
293
- se(e, t, c.length > 0 ? c[c.length - 1].value.end : void 0, f);
424
+ de(e, t, c.length > 0 ? c[c.length - 1].value.end : void 0, f);
294
425
  return;
295
426
  }
296
- const s = ee(e, t, (l = t.members[0]) == null ? void 0 : l.start), o = d.map(
297
- (f) => `${s}${JSON.stringify(f)}${u}${j(n[f], e.format, s)}`
427
+ const r = ae(e, t, (d = t.members[0]) == null ? void 0 : d.start), a = l.map(
428
+ (f) => `${r}${JSON.stringify(f)}${u}${O(n[f], e.format, r)}`
298
429
  );
299
- ne(e, t, c.length > 0 ? c[c.length - 1].value.end : void 0, o);
430
+ le(e, t, c.length > 0 ? c[c.length - 1].value.end : void 0, a);
300
431
  }
301
- const me = ["name", "id", "code", "key", "slug", "state", "Id"];
302
- function he(e, t, n, i) {
303
- var u, s;
304
- const r = [...n, ...i];
305
- if (r.length === 0 || !r.every(Q))
432
+ const je = ["name", "id", "code", "key", "slug", "state", "Id"];
433
+ function Oe(e, t, n, s) {
434
+ var u, r;
435
+ const i = [...n, ...s];
436
+ if (i.length === 0 || !i.every(oe))
306
437
  return;
307
- const a = (o, l) => {
308
- const f = o.map((h) => h[l]);
438
+ const o = (a, d) => {
439
+ const f = a.map((h) => h[d]);
309
440
  return f.every((h) => typeof h == "string" || typeof h == "number") && new Set(f).size === f.length;
310
- }, c = (s = (u = e.options) == null ? void 0 : u.arrayKey) == null ? void 0 : s.call(u, t);
311
- return (c ? [c] : me).find((o) => a(n, o) && a(i, o));
441
+ }, c = (r = (u = e.options) == null ? void 0 : u.arrayKey) == null ? void 0 : r.call(u, t);
442
+ return (c ? [c] : je).find((a) => o(n, a) && o(s, a));
312
443
  }
313
- function ye(e, t, n, i, r) {
444
+ function Ae(e, t, n, s, i) {
314
445
  var g;
315
- const a = V(e, t, r), c = t.items.map(M), d = he(e, i, c, n), u = (p) => p[d], s = d !== void 0 ? c.map((p) => {
446
+ const o = W(e, t, i), c = t.items.map(F), l = Oe(e, s, c, n), u = (p) => p[l], r = l !== void 0 ? c.map((p) => {
316
447
  const m = u(p);
317
- return n.findIndex((b) => u(b) === m);
318
- }) : be(c, n);
448
+ return n.findIndex((w) => u(w) === m);
449
+ }) : Ee(c, n);
319
450
  {
320
- const p = new Set(s.filter((m) => m >= 0));
321
- for (let m = 0; m < s.length; m++) {
322
- if (s[m] >= 0)
451
+ const p = new Set(r.filter((m) => m >= 0));
452
+ for (let m = 0; m < r.length; m++) {
453
+ if (r[m] >= 0)
323
454
  continue;
324
- let b = -1;
455
+ let w = -1;
325
456
  for (let y = m - 1; y >= 0; y--)
326
- if (s[y] >= 0) {
327
- b = s[y];
457
+ if (r[y] >= 0) {
458
+ w = r[y];
328
459
  break;
329
460
  }
330
- let v = n.length;
331
- for (let y = m + 1; y < s.length; y++)
332
- if (s[y] >= 0) {
333
- v = s[y];
461
+ let $ = n.length;
462
+ for (let y = m + 1; y < r.length; y++)
463
+ if (r[y] >= 0) {
464
+ $ = r[y];
334
465
  break;
335
466
  }
336
- for (let y = b + 1; y < v; y++)
467
+ for (let y = w + 1; y < $; y++)
337
468
  if (!p.has(y)) {
338
- s[m] = y, p.add(y);
469
+ r[m] = y, p.add(y);
339
470
  break;
340
471
  }
341
472
  }
342
473
  }
343
- const o = s.filter((p) => p >= 0);
344
- if (o.some((p, m) => m > 0 && p < o[m - 1])) {
345
- N(e, t, n, r);
474
+ const a = r.filter((p) => p >= 0);
475
+ if (a.some((p, m) => m > 0 && p < a[m - 1])) {
476
+ x(e, t, n, i);
346
477
  return;
347
478
  }
348
- if (o.length === 0 && t.items.length > 0) {
349
- N(e, t, n, r);
479
+ if (a.length === 0 && t.items.length > 0) {
480
+ x(e, t, n, i);
350
481
  return;
351
482
  }
352
483
  t.items.forEach((p, m) => {
353
- s[m] >= 0 && U(e, p, n[s[m]], `${i}/${s[m]}`, a);
354
- }), te(
484
+ r[m] >= 0 && q(e, p, n[r[m]], `${s}/${r[m]}`, o);
485
+ }), ce(
355
486
  e,
356
487
  t.items.map((p) => ({ start: p.start, end: p.end })),
357
- s.map((p) => p >= 0)
488
+ r.map((p) => p >= 0)
358
489
  );
359
- const l = t.items.length > 0 && t.items.every((p) => p.kind !== "scalar" && Z(e.text, p)), f = ee(e, t, (g = t.items[0]) == null ? void 0 : g.start), h = /* @__PURE__ */ new Map();
490
+ const d = t.items.length > 0 && t.items.every((p) => p.kind !== "scalar" && re(e.text, p)), f = ae(e, t, (g = t.items[0]) == null ? void 0 : g.start), h = /* @__PURE__ */ new Map();
360
491
  n.forEach((p, m) => {
361
- if (s.includes(m))
492
+ if (r.includes(m))
362
493
  return;
363
- let b;
364
- for (let $ = t.items.length - 1; $ >= 0; $--)
365
- if (s[$] >= 0 && s[$] < m) {
366
- b = $;
494
+ let w;
495
+ for (let S = t.items.length - 1; S >= 0; S--)
496
+ if (r[S] >= 0 && r[S] < m) {
497
+ w = S;
367
498
  break;
368
499
  }
369
- const v = a ? O(p, e.format, e.compact) : l ? `${f}${O(p, e.format)}` : `${f}${j(p, e.format, f)}`, y = h.get(b) ?? [];
370
- y.push(v), h.set(b, y);
500
+ const $ = o ? A(p, e.format, e.compact) : d ? `${f}${A(p, e.format)}` : `${f}${O(p, e.format, f)}`, y = h.get(w) ?? [];
501
+ y.push($), h.set(w, y);
371
502
  });
372
503
  for (const [p, m] of h) {
373
- const b = p === void 0 ? void 0 : t.items[p].end;
374
- if (p === void 0 && o.length > 0) {
375
- const v = t.items[s.findIndex(($) => $ >= 0)], y = a ? Y(e) : `,${e.format.eol}`;
504
+ const w = p === void 0 ? void 0 : t.items[p].end;
505
+ if (p === void 0 && a.length > 0) {
506
+ const $ = t.items[r.findIndex((S) => S >= 0)], y = o ? ie(e) : `,${e.format.eol}`;
376
507
  e.edits.push({
377
- start: v.start,
378
- end: v.start,
379
- text: a ? m.join(y) + y : m.join(y).trimStart() + y + f
508
+ start: $.start,
509
+ end: $.start,
510
+ text: o ? m.join(y) + y : m.join(y).trimStart() + y + f
380
511
  });
381
512
  continue;
382
513
  }
383
- a ? se(e, t, b, m) : ne(e, t, b, m);
514
+ o ? de(e, t, w, m) : le(e, t, w, m);
384
515
  }
385
516
  }
386
- const ge = 4e6;
387
- function be(e, t) {
388
- const n = e.length, i = t.length;
389
- if (n * i > ge)
390
- return e.map((o, l) => l < i ? l : -1);
391
- const r = e.map((o) => JSON.stringify(o)), a = t.map((o) => JSON.stringify(o)), c = Array.from({ length: n + 1 }, () => new Uint32Array(i + 1));
392
- for (let o = n - 1; o >= 0; o--)
393
- for (let l = i - 1; l >= 0; l--)
394
- c[o][l] = r[o] === a[l] ? c[o + 1][l + 1] + 1 : Math.max(c[o + 1][l], c[o][l + 1]);
395
- const d = new Array(n).fill(-1);
396
- let u = 0, s = 0;
397
- for (; u < n && s < i; )
398
- r[u] === a[s] ? d[u++] = s++ : c[u + 1][s] >= c[u][s + 1] ? u++ : s++;
399
- return d;
517
+ const Ke = 4e6;
518
+ function Ee(e, t) {
519
+ const n = e.length, s = t.length;
520
+ if (n * s > Ke)
521
+ return e.map((a, d) => d < s ? d : -1);
522
+ const i = e.map((a) => JSON.stringify(a)), o = t.map((a) => JSON.stringify(a)), c = Array.from({ length: n + 1 }, () => new Uint32Array(s + 1));
523
+ for (let a = n - 1; a >= 0; a--)
524
+ for (let d = s - 1; d >= 0; d--)
525
+ c[a][d] = i[a] === o[d] ? c[a + 1][d + 1] + 1 : Math.max(c[a + 1][d], c[a][d + 1]);
526
+ const l = new Array(n).fill(-1);
527
+ let u = 0, r = 0;
528
+ for (; u < n && r < s; )
529
+ i[u] === o[r] ? l[u++] = r++ : c[u + 1][r] >= c[u][r + 1] ? u++ : r++;
530
+ return l;
400
531
  }
401
- function te(e, t, n) {
402
- for (let i = 0; i < t.length; i++) {
403
- if (n[i])
532
+ function ce(e, t, n) {
533
+ for (let s = 0; s < t.length; s++) {
534
+ if (n[s])
404
535
  continue;
405
- let r = i;
406
- for (; r + 1 < t.length && !n[r + 1]; )
407
- r++;
408
- r + 1 < t.length ? e.edits.push({ start: t[i].start, end: t[r + 1].start, text: "" }) : i > 0 ? e.edits.push({ start: t[i - 1].end, end: t[r].end, text: "" }) : e.edits.push({ start: t[i].start, end: t[r].end, text: "" }), i = r;
536
+ let i = s;
537
+ for (; i + 1 < t.length && !n[i + 1]; )
538
+ i++;
539
+ i + 1 < t.length ? e.edits.push({ start: t[s].start, end: t[i + 1].start, text: "" }) : s > 0 ? e.edits.push({ start: t[s - 1].end, end: t[i].end, text: "" }) : e.edits.push({ start: t[s].start, end: t[i].end, text: "" }), s = i;
409
540
  }
410
541
  }
411
- function ne(e, t, n, i) {
412
- const r = e.format.eol;
542
+ function le(e, t, n, s) {
543
+ const i = e.format.eol;
413
544
  if (n !== void 0) {
414
- e.edits.push({ start: n, end: n, text: `,${r}${i.join(`,${r}`)}` });
545
+ e.edits.push({ start: n, end: n, text: `,${i}${s.join(`,${i}`)}` });
415
546
  return;
416
547
  }
417
- const a = t.end - 1;
548
+ const o = t.end - 1;
418
549
  if ((t.kind === "object" ? t.members.length : t.items.length) === 0)
419
550
  e.edits.push({
420
551
  start: t.start + 1,
421
- end: a,
422
- text: `${r}${i.join(`,${r}`)}${r}${x(e.text, t.start)}`
552
+ end: o,
553
+ text: `${i}${s.join(`,${i}`)}${i}${J(e.text, t.start)}`
423
554
  });
424
555
  else {
425
- const d = t.kind === "object" ? t.members[0].start : t.items[0].start;
426
- e.edits.push({ start: d, end: d, text: `${i.join(`,${r}`).trimStart()}` });
556
+ const l = t.kind === "object" ? t.members[0].start : t.items[0].start;
557
+ e.edits.push({ start: l, end: l, text: `${s.join(`,${i}`).trimStart()}` });
427
558
  }
428
559
  }
429
- function se(e, t, n, i) {
430
- const r = Y(e);
560
+ function de(e, t, n, s) {
561
+ const i = ie(e);
431
562
  if (n !== void 0) {
432
- e.edits.push({ start: n, end: n, text: `${r}${i.join(r)}` });
563
+ e.edits.push({ start: n, end: n, text: `${i}${s.join(i)}` });
433
564
  return;
434
565
  }
435
- const a = t.kind === "object" && !e.compact ? " " : "";
566
+ const o = t.kind === "object" && !e.compact ? " " : "";
436
567
  e.edits.push({
437
568
  start: t.start + 1,
438
569
  end: t.end - 1,
439
- text: `${a}${i.join(r)}${a}`
570
+ text: `${o}${s.join(i)}${o}`
440
571
  });
441
572
  }
442
- function we(e) {
573
+ function Ne(e) {
443
574
  return e.replace(/~/g, "~0").replace(/\//g, "~1");
444
575
  }
445
- const K = (e) => e.slice(e.lastIndexOf("/") + 1), ke = (e) => e.charCodeAt(0) === 65279 ? e.slice(1) : e;
446
- function R(e) {
576
+ const K = (e) => e.slice(e.lastIndexOf("/") + 1), Ie = (e) => e.charCodeAt(0) === 65279 ? e.slice(1) : e;
577
+ function B(e) {
447
578
  return {
448
579
  id: e.id,
449
580
  label: e.label,
@@ -452,19 +583,19 @@ function R(e) {
452
583
  match: e.match,
453
584
  editor: e.editor,
454
585
  decode(t, n) {
455
- return e.select(E(t[0].text).value, n);
586
+ return e.select(I(t[0].text).value, n);
456
587
  },
457
- encode(t, n, i) {
458
- const r = n[0].text, a = E(r).value, c = e.assign(a, t, i);
588
+ encode(t, n, s) {
589
+ const i = n[0].text, o = I(i).value, c = e.assign(o, t, s);
459
590
  return {
460
591
  files: [
461
- { path: n[0].path, text: X(r, c, { arrayKey: e.arrayKey }) }
592
+ { path: n[0].path, text: se(i, c, { arrayKey: e.arrayKey }) }
462
593
  ]
463
594
  };
464
595
  }
465
596
  };
466
597
  }
467
- const F = R({
598
+ const R = B({
468
599
  id: "json",
469
600
  label: "JSON",
470
601
  labelKey: "devStudio.kind.json",
@@ -473,7 +604,7 @@ const F = R({
473
604
  editor: "json",
474
605
  select: (e) => e,
475
606
  assign: (e, t) => t
476
- }), P = {
607
+ }), U = {
477
608
  id: "text",
478
609
  label: "Text",
479
610
  labelKey: "devStudio.kind.text",
@@ -482,87 +613,87 @@ const F = R({
482
613
  editor: "text",
483
614
  decode: (e) => e[0].text,
484
615
  encode: (e, t) => ({
485
- files: [{ path: t[0].path, text: le(e, t[0].text) }]
616
+ files: [{ path: t[0].path, text: we(e, t[0].text) }]
486
617
  })
487
618
  };
488
- function ve(e, t) {
489
- return e.find((n) => n.match(t)) ?? (F.match(t) ? F : P);
619
+ function xe(e, t) {
620
+ return e.find((n) => n.match(t)) ?? (R.match(t) ? R : U);
490
621
  }
491
- function $e(e, t, n) {
492
- for (const i of [F, P])
493
- if (i.match(e.path))
622
+ function Me(e, t, n) {
623
+ for (const s of [R, U])
624
+ if (s.match(e.path))
494
625
  try {
495
- const r = i.decode([e], n);
626
+ const i = s.decode([e], n);
496
627
  return {
497
- key: `${i.id}:${e.path}`,
498
- kind: i,
628
+ key: `${s.id}:${e.path}`,
629
+ kind: s,
499
630
  paths: [e.path],
500
631
  label: K(e.path),
501
- model: r,
632
+ model: i,
502
633
  error: t
503
634
  };
504
635
  } catch {
505
636
  }
506
637
  return {
507
638
  key: `text:${e.path}`,
508
- kind: P,
639
+ kind: U,
509
640
  paths: [e.path],
510
641
  label: K(e.path),
511
642
  model: e.text,
512
643
  error: t
513
644
  };
514
645
  }
515
- function Se(e, t, n, i) {
516
- var d, u;
517
- const r = e.encode(t, n, i), a = new Map(n.map((s) => [s.path, s.text])), c = ((d = r.files.find((s) => a.get(s.path) !== s.text)) == null ? void 0 : d.path) ?? ((u = r.deleted) == null ? void 0 : u.find((s) => a.has(s)));
646
+ function Fe(e, t, n, s) {
647
+ var l, u;
648
+ const i = e.encode(t, n, s), o = new Map(n.map((r) => [r.path, r.text])), c = ((l = i.files.find((r) => o.get(r.path) !== r.text)) == null ? void 0 : l.path) ?? ((u = i.deleted) == null ? void 0 : u.find((r) => o.has(r)));
518
649
  if (c !== void 0)
519
650
  throw new Error(`${K(c)} would not be stored as it is`);
520
651
  }
521
- function Ce(e, t, n) {
522
- const i = /* @__PURE__ */ new Map();
523
- for (const a of t) {
524
- const c = ve(e, a.path), d = c.group ? c.group(a.path) : a.path, u = `${c.id}:${d}`, s = i.get(u) ?? { kind: c, group: d, files: [] };
525
- s.files.push(a), i.set(u, s);
652
+ function ot(e, t, n) {
653
+ const s = /* @__PURE__ */ new Map();
654
+ for (const o of t) {
655
+ const c = xe(e, o.path), l = c.group ? c.group(o.path) : o.path, u = `${c.id}:${l}`, r = s.get(u) ?? { kind: c, group: l, files: [] };
656
+ r.files.push(o), s.set(u, r);
526
657
  }
527
- const r = [];
528
- for (const [a, { kind: c, group: d, files: u }] of i) {
529
- const s = u.map((l) => l.path).sort(), o = K(c.group ? d : s[0]);
658
+ const i = [];
659
+ for (const [o, { kind: c, group: l, files: u }] of s) {
660
+ const r = u.map((d) => d.path).sort(), a = K(c.group ? l : r[0]);
530
661
  try {
531
- const l = c.decode(u, n);
532
- Se(c, l, u, n), r.push({ key: a, kind: c, paths: s, label: o, model: l });
533
- } catch (l) {
534
- const f = l instanceof Error ? l.message : String(l);
662
+ const d = c.decode(u, n);
663
+ Fe(c, d, u, n), i.push({ key: o, kind: c, paths: r, label: a, model: d });
664
+ } catch (d) {
665
+ const f = d instanceof Error ? d.message : String(d);
535
666
  for (const h of u)
536
- r.push($e(h, f, n));
667
+ i.push(Me(h, f, n));
537
668
  }
538
669
  }
539
- return r.sort((a, c) => a.label.localeCompare(c.label));
670
+ return i.sort((o, c) => o.label.localeCompare(c.label));
540
671
  }
541
- function Ve(e, t, n, i) {
542
- const r = n.filter((u) => e.paths.includes(u.path)), a = e.kind.encode(t, r, i), c = new Map(n.map((u) => [u.path, u])), d = [];
543
- for (const u of a.files) {
544
- const s = c.get(u.path);
545
- s && s.text === u.text || d.push({ type: "write", path: u.path, text: u.text, baseVersion: s == null ? void 0 : s.version });
672
+ function at(e, t, n, s) {
673
+ const i = n.filter((u) => e.paths.includes(u.path)), o = e.kind.encode(t, i, s), c = new Map(n.map((u) => [u.path, u])), l = [];
674
+ for (const u of o.files) {
675
+ const r = c.get(u.path);
676
+ r && r.text === u.text || l.push({ type: "write", path: u.path, text: u.text, baseVersion: r == null ? void 0 : r.version });
546
677
  }
547
- for (const u of a.deleted ?? []) {
548
- const s = c.get(u);
549
- s && d.push({ type: "delete", path: u, baseVersion: s.version });
678
+ for (const u of o.deleted ?? []) {
679
+ const r = c.get(u);
680
+ r && l.push({ type: "delete", path: u, baseVersion: r.version });
550
681
  }
551
- return d;
682
+ return l;
552
683
  }
553
- function je(e, t) {
684
+ function Je(e, t) {
554
685
  try {
555
- return JSON.parse(ke(e));
686
+ return JSON.parse(Ie(e));
556
687
  } catch {
557
688
  return t;
558
689
  }
559
690
  }
560
- const w = (e) => typeof e == "object" && e !== null && !Array.isArray(e), S = (...e) => (t) => {
691
+ const k = (e) => typeof e == "object" && e !== null && !Array.isArray(e), j = (...e) => (t) => {
561
692
  const n = t.toLowerCase();
562
- return e.some((i) => n.endsWith(i.toLowerCase()));
693
+ return e.some((s) => n.endsWith(s.toLowerCase()));
563
694
  };
564
- function J(e) {
565
- return R({
695
+ function L(e) {
696
+ return B({
566
697
  id: e.id,
567
698
  label: e.label,
568
699
  labelKey: e.labelKey,
@@ -572,130 +703,130 @@ function J(e) {
572
703
  select: (t) => {
573
704
  if (Array.isArray(t))
574
705
  return t;
575
- const n = w(t) ? t[e.property] : void 0;
706
+ const n = k(t) ? t[e.property] : void 0;
576
707
  return Array.isArray(n) ? n : [];
577
708
  },
578
- assign: (t, n) => Array.isArray(t) ? n : w(t) && !(e.property in t) && n.length === 0 ? t : { ...w(t) ? t : {}, [e.property]: n },
709
+ assign: (t, n) => Array.isArray(t) ? n : k(t) && !(e.property in t) && n.length === 0 ? t : { ...k(t) ? t : {}, [e.property]: n },
579
710
  arrayKey: e.itemKey ? () => e.itemKey : void 0
580
711
  });
581
712
  }
582
- function ie(e) {
583
- const t = J(e);
713
+ function fe(e) {
714
+ const t = L(e);
584
715
  return {
585
716
  ...t,
586
- decode: (n, i) => t.decode(n, i).map((r, a) => e.toItem(r, a)),
587
- encode: (n, i, r) => t.encode(
588
- n.map((a) => e.fromItem(a)),
589
- i,
590
- r
717
+ decode: (n, s) => t.decode(n, s).map((i, o) => e.toItem(i, o)),
718
+ encode: (n, s, i) => t.encode(
719
+ n.map((o) => e.fromItem(o)),
720
+ s,
721
+ i
591
722
  )
592
723
  };
593
724
  }
594
- function re(e) {
595
- return R({
725
+ function ue(e) {
726
+ return B({
596
727
  ...e,
597
- select: (t) => w(t) ? t : {},
728
+ select: (t) => k(t) ? t : {},
598
729
  assign: (t, n) => n
599
730
  });
600
731
  }
601
- const Oe = /^(.*)\.([a-z]{2,3}(?:-[A-Za-z]{2,4})?)\.i18n\.json$/i, Ke = (e) => {
602
- const t = Oe.exec(e);
732
+ const Le = /^(.*)\.([a-z]{2,3}(?:-[A-Za-z]{2,4})?)\.i18n\.json$/i, Te = (e) => {
733
+ const t = Le.exec(e);
603
734
  return t ? { group: t[1], locale: t[2] } : null;
604
- }, D = (e) => w(e) && Object.values(e).every((t) => typeof t == "string");
605
- function Ae(e) {
606
- if (w(e)) {
735
+ }, V = (e) => k(e) && Object.values(e).every((t) => typeof t == "string");
736
+ function Pe(e) {
737
+ if (k(e)) {
607
738
  for (const t of ["translations", "keys"])
608
739
  if (t in e) {
609
- if (D(e[t]))
740
+ if (V(e[t]))
610
741
  return e[t];
611
742
  throw new Error(`"${t}" is not a flat map of texts`);
612
743
  }
613
- if (D(e))
744
+ if (V(e))
614
745
  return e;
615
746
  }
616
747
  throw new Error("no translations in this file");
617
748
  }
618
- function z(e, t) {
619
- return w(e) ? w(e.translations) ? { ...e, translations: t } : w(e.keys) ? { ...e, keys: t } : D(e) ? t : { ...e, translations: t } : { translations: t };
749
+ function Y(e, t) {
750
+ return k(e) ? k(e.translations) ? { ...e, translations: t } : k(e.keys) ? { ...e, keys: t } : V(e) ? t : { ...e, translations: t } : { translations: t };
620
751
  }
621
- function Ee(e = {}) {
622
- const t = e.parse ?? Ke, n = e.pathFor ?? ((i, r) => `${i}.${r}.i18n.json`);
752
+ function De(e = {}) {
753
+ const t = e.parse ?? Te, n = e.pathFor ?? ((s, i) => `${s}.${i}.i18n.json`);
623
754
  return {
624
755
  id: e.id ?? "i18n",
625
756
  label: e.label ?? "Translations",
626
757
  labelKey: e.labelKey ?? "devStudio.kind.i18n",
627
758
  icon: "globe",
628
759
  editor: "i18n",
629
- match: (i) => t(i) !== null,
630
- group: (i) => {
631
- var r;
632
- return ((r = t(i)) == null ? void 0 : r.group) ?? i;
760
+ match: (s) => t(s) !== null,
761
+ group: (s) => {
762
+ var i;
763
+ return ((i = t(s)) == null ? void 0 : i.group) ?? s;
633
764
  },
634
- decode(i) {
635
- const r = {};
636
- for (const a of i) {
637
- const c = t(a.path);
638
- c && (r[c.locale] = { ...Ae(E(a.text).value) });
765
+ decode(s) {
766
+ const i = {};
767
+ for (const o of s) {
768
+ const c = t(o.path);
769
+ c && (i[c.locale] = { ...Pe(I(o.text).value) });
639
770
  }
640
- return r;
771
+ return i;
641
772
  },
642
- encode(i, r) {
643
- const a = /* @__PURE__ */ new Map();
773
+ encode(s, i) {
774
+ const o = /* @__PURE__ */ new Map();
644
775
  let c = "";
645
- for (const o of r) {
646
- const l = t(o.path);
647
- l && (a.set(l.locale, o), c = l.group);
776
+ for (const a of i) {
777
+ const d = t(a.path);
778
+ d && (o.set(d.locale, a), c = d.group);
648
779
  }
649
- const d = a.get("en") ?? r[0], u = [];
650
- for (const [o, l] of Object.entries(i)) {
651
- const f = a.get(o);
780
+ const l = o.get("en") ?? i[0], u = [];
781
+ for (const [a, d] of Object.entries(s)) {
782
+ const f = o.get(a);
652
783
  if (f) {
653
- const g = E(f.text).value;
784
+ const g = I(f.text).value;
654
785
  u.push({
655
786
  path: f.path,
656
- text: X(f.text, z(g, l))
787
+ text: se(f.text, Y(g, d))
657
788
  });
658
789
  continue;
659
790
  }
660
- const h = n(c || K((d == null ? void 0 : d.path) ?? "module"), o);
661
- if (d) {
662
- const g = E(d.text).value, p = w(g) && "locale" in g ? { ...g, locale: o } : g;
791
+ const h = n(c || K((l == null ? void 0 : l.path) ?? "module"), a);
792
+ if (l) {
793
+ const g = I(l.text).value, p = k(g) && "locale" in g ? { ...g, locale: a } : g;
663
794
  u.push({
664
795
  path: h,
665
- text: k(
666
- z(p, l),
667
- C(d.text)
796
+ text: v(
797
+ Y(p, d),
798
+ z(l.text)
668
799
  )
669
800
  });
670
801
  } else
671
- u.push({ path: h, text: k({ locale: o, translations: l }) });
802
+ u.push({ path: h, text: v({ locale: a, translations: d }) });
672
803
  }
673
- const s = [...a.entries()].filter(([o]) => !(o in i)).map(([, o]) => o.path);
674
- return { files: u, deleted: s };
804
+ const r = [...o.entries()].filter(([a]) => !(a in s)).map(([, a]) => a.path);
805
+ return { files: u, deleted: r };
675
806
  }
676
807
  };
677
808
  }
678
- const A = (e) => JSON.parse(JSON.stringify(e));
679
- function Ue(e) {
809
+ const N = (e) => JSON.parse(JSON.stringify(e));
810
+ function ct(e) {
680
811
  const t = e.revisions !== !1;
681
812
  let n = 0;
682
- const i = e.workspaces.map((s) => ({
813
+ const s = e.workspaces.map((r) => ({
683
814
  meta: {
684
- id: s.id,
685
- label: s.label,
686
- description: s.description,
687
- icon: s.icon,
688
- readOnly: s.readOnly
815
+ id: r.id,
816
+ label: r.label,
817
+ description: r.description,
818
+ icon: r.icon,
819
+ readOnly: r.readOnly
689
820
  },
690
- packages: new Map((s.packages ?? []).map((o) => [o.id, { ...o, workspaceId: s.id }])),
821
+ packages: new Map((r.packages ?? []).map((a) => [a.id, { ...a, workspaceId: r.id }])),
691
822
  modules: new Map(
692
- s.modules.map((o) => [
693
- o.id,
823
+ r.modules.map((a) => [
824
+ a.id,
694
825
  {
695
- ...o,
826
+ ...a,
696
827
  files: new Map(
697
- Object.entries(o.files).map(
698
- ([l, f]) => [l, { text: f, version: ++n }]
828
+ Object.entries(a.files).map(
829
+ ([d, f]) => [d, { text: f, version: ++n }]
699
830
  )
700
831
  ),
701
832
  revisions: []
@@ -703,135 +834,135 @@ function Ue(e) {
703
834
  ])
704
835
  )
705
836
  }));
706
- let r = (e.templates ?? []).map((s) => A(s));
707
- const a = (s) => {
708
- const o = i.find((l) => l.meta.id === s);
709
- if (!o)
710
- throw new Error(`Unknown workspace "${s}"`);
711
- return o;
712
- }, c = (s) => {
713
- const o = a(s.workspaceId).modules.get(s.id);
714
- if (!o)
715
- throw new Error(`Unknown module "${s.id}"`);
716
- return o;
717
- }, d = (s, o) => ({
718
- workspaceId: s,
719
- id: o.id,
720
- packageId: o.packageId,
721
- label: o.label ?? o.id,
722
- description: o.description,
723
- icon: o.icon,
724
- version: o.version,
725
- readOnly: o.readOnly || a(s).meta.readOnly,
726
- files: [...o.files.keys()].sort()
727
- }), u = (s, o) => ({
728
- path: s,
729
- text: o.text,
730
- version: String(o.version)
837
+ let i = (e.templates ?? []).map((r) => N(r));
838
+ const o = (r) => {
839
+ const a = s.find((d) => d.meta.id === r);
840
+ if (!a)
841
+ throw new Error(`Unknown workspace "${r}"`);
842
+ return a;
843
+ }, c = (r) => {
844
+ const a = o(r.workspaceId).modules.get(r.id);
845
+ if (!a)
846
+ throw new Error(`Unknown module "${r.id}"`);
847
+ return a;
848
+ }, l = (r, a) => ({
849
+ workspaceId: r,
850
+ id: a.id,
851
+ packageId: a.packageId,
852
+ label: a.label ?? a.id,
853
+ description: a.description,
854
+ icon: a.icon,
855
+ version: a.version,
856
+ readOnly: a.readOnly || o(r).meta.readOnly,
857
+ files: [...a.files.keys()].sort()
858
+ }), u = (r, a) => ({
859
+ path: r,
860
+ text: a.text,
861
+ version: String(a.version)
731
862
  });
732
863
  return {
733
864
  async listWorkspaces() {
734
- return i.map((s) => ({ ...s.meta }));
865
+ return s.map((r) => ({ ...r.meta }));
735
866
  },
736
- async listModules(s) {
737
- return [...a(s).modules.values()].map((l) => d(s, l));
867
+ async listModules(r) {
868
+ return [...o(r).modules.values()].map((d) => l(r, d));
738
869
  },
739
- async listPackages(s) {
740
- const o = a(s), l = [...o.packages.values()], f = [...new Set([...o.modules.values()].map((h) => h.packageId).filter(Boolean))].filter((h) => !o.packages.has(h)).map((h) => ({ id: h, workspaceId: s, label: h, derived: !0 }));
741
- return [...l, ...f];
870
+ async listPackages(r) {
871
+ const a = o(r), d = [...a.packages.values()], f = [...new Set([...a.modules.values()].map((h) => h.packageId).filter(Boolean))].filter((h) => !a.packages.has(h)).map((h) => ({ id: h, workspaceId: r, label: h, derived: !0 }));
872
+ return [...d, ...f];
742
873
  },
743
- async readModule(s) {
744
- return [...c(s).files.entries()].map(([l, f]) => u(l, f));
874
+ async readModule(r) {
875
+ return [...c(r).files.entries()].map(([d, f]) => u(d, f));
745
876
  },
746
- async writeModule(s, o) {
747
- const l = c(s);
748
- if (l.readOnly || a(s.workspaceId).meta.readOnly)
749
- throw new Error(`Module "${s.id}" is read-only`);
750
- const f = o.filter((p) => p.baseVersion !== void 0).filter((p) => {
751
- const m = l.files.get(p.path);
877
+ async writeModule(r, a) {
878
+ const d = c(r);
879
+ if (d.readOnly || o(r.workspaceId).meta.readOnly)
880
+ throw new Error(`Module "${r.id}" is read-only`);
881
+ const f = a.filter((p) => p.baseVersion !== void 0).filter((p) => {
882
+ const m = d.files.get(p.path);
752
883
  return m ? String(m.version) !== p.baseVersion : !1;
753
884
  }).map((p) => {
754
885
  var m;
755
- return { path: p.path, currentVersion: String((m = l.files.get(p.path)) == null ? void 0 : m.version) };
886
+ return { path: p.path, currentVersion: String((m = d.files.get(p.path)) == null ? void 0 : m.version) };
756
887
  });
757
888
  if (f.length > 0)
758
889
  return { ok: !1, conflicts: f };
759
890
  let h;
760
891
  if (t) {
761
892
  const p = {};
762
- for (const [m, b] of l.files)
763
- p[m] = b.text;
764
- h = `r${++n}`, l.revisions.unshift({
893
+ for (const [m, w] of d.files)
894
+ p[m] = w.text;
895
+ h = `r${++n}`, d.revisions.unshift({
765
896
  id: h,
766
897
  timestamp: Date.now(),
767
898
  label: h,
768
- summary: o.map((m) => `${m.type} ${m.path}`).join(", "),
899
+ summary: a.map((m) => `${m.type} ${m.path}`).join(", "),
769
900
  files: p
770
901
  });
771
902
  }
772
903
  const g = {};
773
- for (const p of o)
904
+ for (const p of a)
774
905
  if (p.type === "delete")
775
- l.files.delete(p.path);
906
+ d.files.delete(p.path);
776
907
  else {
777
908
  const m = ++n;
778
- l.files.set(p.path, { text: p.text, version: m }), g[p.path] = String(m);
909
+ d.files.set(p.path, { text: p.text, version: m }), g[p.path] = String(m);
779
910
  }
780
911
  return { ok: !0, versions: g, revision: h };
781
912
  },
782
- async createModule(s) {
783
- const o = a(s.workspaceId);
784
- if (o.meta.readOnly)
785
- throw new Error(`Workspace "${s.workspaceId}" is read-only`);
786
- if (o.modules.has(s.id))
787
- throw new Error(`Module "${s.id}" already exists`);
788
- const l = {
789
- id: s.id,
790
- packageId: s.packageId,
913
+ async createModule(r) {
914
+ const a = o(r.workspaceId);
915
+ if (a.meta.readOnly)
916
+ throw new Error(`Workspace "${r.workspaceId}" is read-only`);
917
+ if (a.modules.has(r.id))
918
+ throw new Error(`Module "${r.id}" already exists`);
919
+ const d = {
920
+ id: r.id,
921
+ packageId: r.packageId,
791
922
  files: new Map(
792
- s.files.map((f) => [f.path, { text: f.text, version: ++n }])
923
+ r.files.map((f) => [f.path, { text: f.text, version: ++n }])
793
924
  ),
794
925
  revisions: []
795
926
  };
796
- return o.modules.set(s.id, l), d(s.workspaceId, l);
927
+ return a.modules.set(r.id, d), l(r.workspaceId, d);
797
928
  },
798
- async deleteModule(s) {
799
- const o = a(s.workspaceId);
800
- if (o.meta.readOnly)
801
- throw new Error(`Workspace "${s.workspaceId}" is read-only`);
802
- o.modules.delete(s.id);
929
+ async deleteModule(r) {
930
+ const a = o(r.workspaceId);
931
+ if (a.meta.readOnly)
932
+ throw new Error(`Workspace "${r.workspaceId}" is read-only`);
933
+ a.modules.delete(r.id);
803
934
  },
804
- async savePackage(s) {
805
- return a(s.workspaceId).packages.set(s.id, { ...s, derived: !1 }), { ...s, derived: !1 };
935
+ async savePackage(r) {
936
+ return o(r.workspaceId).packages.set(r.id, { ...r, derived: !1 }), { ...r, derived: !1 };
806
937
  },
807
- async deletePackage(s) {
808
- a(s.workspaceId).packages.delete(s.id);
938
+ async deletePackage(r) {
939
+ o(r.workspaceId).packages.delete(r.id);
809
940
  },
810
941
  async listTemplates() {
811
- return r.map((s) => A(s));
942
+ return i.map((r) => N(r));
812
943
  },
813
- async saveTemplate(s, o) {
814
- const l = (o == null ? void 0 : o.previousId) ?? s.id, f = A(s), h = r.findIndex((g) => g.id === l);
815
- return r = h >= 0 ? r.map((g, p) => p === h ? f : g) : [...r, f], A(f);
944
+ async saveTemplate(r, a) {
945
+ const d = (a == null ? void 0 : a.previousId) ?? r.id, f = N(r), h = i.findIndex((g) => g.id === d);
946
+ return i = h >= 0 ? i.map((g, p) => p === h ? f : g) : [...i, f], N(f);
816
947
  },
817
- async deleteTemplate(s) {
818
- r = r.filter((o) => o.id !== s);
948
+ async deleteTemplate(r) {
949
+ i = i.filter((a) => a.id !== r);
819
950
  },
820
- async listRevisions(s, o) {
821
- return c(s).revisions.filter((l) => !o || o in l.files).map(({ files: l, ...f }) => ({ ...f, ...o ? { path: o } : {} }));
951
+ async listRevisions(r, a) {
952
+ return c(r).revisions.filter((d) => !a || a in d.files).map(({ files: d, ...f }) => ({ ...f, ...a ? { path: a } : {} }));
822
953
  },
823
- async readRevision(s, o, l) {
824
- const f = c(s).revisions.find((h) => h.id === o);
954
+ async readRevision(r, a, d) {
955
+ const f = c(r).revisions.find((h) => h.id === a);
825
956
  if (!f)
826
- throw new Error(`Unknown revision "${o}"`);
827
- return l ? f.files[l] ?? "" : JSON.stringify(f.files, null, 2);
957
+ throw new Error(`Unknown revision "${a}"`);
958
+ return d ? f.files[d] ?? "" : JSON.stringify(f.files, null, 2);
828
959
  },
829
- async rollback(s, o, l) {
830
- const f = c(s), h = f.revisions.find((p) => p.id === o);
960
+ async rollback(r, a, d) {
961
+ const f = c(r), h = f.revisions.find((p) => p.id === a);
831
962
  if (!h)
832
- throw new Error(`Unknown revision "${o}"`);
833
- const g = l ? { [l]: h.files[l] } : h.files;
834
- if (!l)
963
+ throw new Error(`Unknown revision "${a}"`);
964
+ const g = d ? { [d]: h.files[d] } : h.files;
965
+ if (!d)
835
966
  for (const p of [...f.files.keys()])
836
967
  p in g || f.files.delete(p);
837
968
  for (const [p, m] of Object.entries(g))
@@ -839,30 +970,30 @@ function Ue(e) {
839
970
  },
840
971
  snapshot() {
841
972
  return {
842
- workspaces: i.map((s) => ({
843
- ...s.meta,
844
- packages: [...s.packages.values()].map(({ workspaceId: o, ...l }) => l),
845
- modules: [...s.modules.values()].map((o) => ({
846
- id: o.id,
847
- packageId: o.packageId,
848
- label: o.label,
849
- description: o.description,
850
- icon: o.icon,
851
- version: o.version,
852
- readOnly: o.readOnly,
853
- files: Object.fromEntries([...o.files.entries()].map(([l, f]) => [l, f.text]))
973
+ workspaces: s.map((r) => ({
974
+ ...r.meta,
975
+ packages: [...r.packages.values()].map(({ workspaceId: a, ...d }) => d),
976
+ modules: [...r.modules.values()].map((a) => ({
977
+ id: a.id,
978
+ packageId: a.packageId,
979
+ label: a.label,
980
+ description: a.description,
981
+ icon: a.icon,
982
+ version: a.version,
983
+ readOnly: a.readOnly,
984
+ files: Object.fromEntries([...a.files.entries()].map(([d, f]) => [d, f.text]))
854
985
  }))
855
986
  })),
856
- templates: r.map((s) => A(s)),
987
+ templates: i.map((r) => N(r)),
857
988
  revisions: t
858
989
  };
859
990
  }
860
991
  };
861
992
  }
862
- function Re(e) {
993
+ function lt(e) {
863
994
  return e;
864
995
  }
865
- function L(e, t) {
996
+ function _(e, t) {
866
997
  if (!t || e === void 0 || e === null)
867
998
  return !0;
868
999
  if (t.enum && !t.enum.includes(e))
@@ -877,70 +1008,70 @@ function L(e, t) {
877
1008
  case "boolean":
878
1009
  return typeof e == "boolean";
879
1010
  case "array":
880
- return Array.isArray(e) && (!t.items || e.every((n) => L(n, t.items)));
1011
+ return Array.isArray(e) && (!t.items || e.every((n) => _(n, t.items)));
881
1012
  case "object": {
882
1013
  if (typeof e != "object" || Array.isArray(e))
883
1014
  return !1;
884
1015
  const n = t.properties;
885
- return !n || Object.entries(e).every(([i, r]) => i in n && L(r, n[i]));
1016
+ return !n || Object.entries(e).every(([s, i]) => s in n && _(i, n[s]));
886
1017
  }
887
1018
  default:
888
1019
  return !0;
889
1020
  }
890
1021
  }
891
- function _e(e, t) {
1022
+ function dt(e, t) {
892
1023
  var c;
893
- const n = (e.fields ?? []).map((d) => d.name), i = (c = e.schema) == null ? void 0 : c.properties;
894
- if (!e.schema || !i)
1024
+ const n = (e.fields ?? []).map((l) => l.name), s = (c = e.schema) == null ? void 0 : c.properties;
1025
+ if (!e.schema || !s)
895
1026
  return { section: e, keys: n };
896
- const r = Object.entries(i).filter(
897
- ([d, u]) => !(d in t) || L(t[d], u)
898
- ), a = r.map(([d]) => d);
1027
+ const i = Object.entries(s).filter(
1028
+ ([l, u]) => !(l in t) || _(t[l], u)
1029
+ ), o = i.map(([l]) => l);
899
1030
  return {
900
1031
  section: {
901
1032
  ...e,
902
1033
  schema: {
903
1034
  ...e.schema,
904
- properties: Object.fromEntries(r),
905
- ...e.schema.required ? { required: e.schema.required.filter((d) => a.includes(d)) } : {}
1035
+ properties: Object.fromEntries(i),
1036
+ ...e.schema.required ? { required: e.schema.required.filter((l) => o.includes(l)) } : {}
906
1037
  }
907
1038
  },
908
- keys: [...a, ...n]
1039
+ keys: [...o, ...n]
909
1040
  };
910
1041
  }
911
- function qe(e) {
1042
+ function ft(e) {
912
1043
  var n;
913
1044
  const t = /* @__PURE__ */ new Set();
914
- for (const i of e) {
915
- for (const r of Object.keys(((n = i.schema) == null ? void 0 : n.properties) ?? {}))
916
- t.add(r);
917
- for (const r of i.fields ?? [])
918
- t.add(r.name);
1045
+ for (const s of e) {
1046
+ for (const i of Object.keys(((n = s.schema) == null ? void 0 : n.properties) ?? {}))
1047
+ t.add(i);
1048
+ for (const i of s.fields ?? [])
1049
+ t.add(i.name);
919
1050
  }
920
1051
  return t;
921
1052
  }
922
- function ze(e) {
1053
+ function ut(e) {
923
1054
  return e.map((t) => {
924
1055
  const n = t;
925
1056
  return {
926
1057
  name: String(n.tableName || n.name || "Entity"),
927
- columns: (Array.isArray(n.fields) ? n.fields : []).map((i) => ({
928
- name: String(i.name ?? ""),
1058
+ columns: (Array.isArray(n.fields) ? n.fields : []).map((s) => ({
1059
+ name: String(s.name ?? ""),
929
1060
  // seeds spell the type both ways (OmniVerk: `dataType`, older files: `type`)
930
- dataType: String(i.dataType ?? i.type ?? "string"),
931
- isPrimaryKey: !!i.isPrimaryKey,
932
- isForeignKey: !!(i.isForeignKey ?? i.foreignKey)
1061
+ dataType: String(s.dataType ?? s.type ?? "string"),
1062
+ isPrimaryKey: !!s.isPrimaryKey,
1063
+ isForeignKey: !!(s.isForeignKey ?? s.foreignKey)
933
1064
  }))
934
1065
  };
935
1066
  });
936
1067
  }
937
- function Be(e) {
938
- const t = e.manifest ?? {}, n = String(t.displayName || t.packageName || "Module"), i = (e.views ?? []).map((a) => ({
939
- id: `view:${a.id}`,
940
- label: a.name,
1068
+ function pt(e) {
1069
+ const t = e.manifest ?? {}, n = String(t.displayName || t.packageName || "Module"), s = (e.views ?? []).map((o) => ({
1070
+ id: `view:${o.id}`,
1071
+ label: o.name,
941
1072
  type: "view"
942
- })), r = (e.entities ?? []).map((a) => {
943
- const c = String(a.name ?? "Entity");
1073
+ })), i = (e.entities ?? []).map((o) => {
1074
+ const c = String(o.name ?? "Entity");
944
1075
  return { id: `entity:${c}`, label: c, type: "entity" };
945
1076
  });
946
1077
  return {
@@ -960,119 +1091,119 @@ function Be(e) {
960
1091
  label: n,
961
1092
  type: "module",
962
1093
  children: [
963
- ...i.length ? [{ id: "views", label: "Views", type: "group", children: i }] : [],
964
- ...r.length ? [{ id: "entities", label: "Entities", type: "group", children: r }] : []
1094
+ ...s.length ? [{ id: "views", label: "Views", type: "group", children: s }] : [],
1095
+ ...i.length ? [{ id: "entities", label: "Entities", type: "group", children: i }] : []
965
1096
  ]
966
1097
  }
967
1098
  ],
968
1099
  grants: {}
969
1100
  };
970
1101
  }
971
- const _ = re({
1102
+ const X = ue({
972
1103
  id: "manifest",
973
1104
  label: "Manifest",
974
1105
  labelKey: "devStudio.kind.manifest",
975
1106
  icon: "file",
976
1107
  editor: "manifest",
977
- match: S(".manifest.json")
978
- }), Ne = J({
1108
+ match: j(".manifest.json")
1109
+ }), Ce = L({
979
1110
  id: "entities",
980
1111
  label: "Entities",
981
1112
  labelKey: "devStudio.kind.entities",
982
1113
  icon: "database",
983
1114
  editor: "entities",
984
- match: S(".entities.json"),
1115
+ match: j(".entities.json"),
985
1116
  property: "entities",
986
1117
  itemKey: "name"
987
- }), Ie = Ee();
988
- function oe(e, t) {
989
- const n = e, i = typeof e == "object" && e !== null && typeof n.id == "string";
1118
+ }), Re = De();
1119
+ function pe(e, t) {
1120
+ const n = e, s = typeof e == "object" && e !== null && typeof n.id == "string";
990
1121
  return {
991
- key: i ? n.id : `#${t}`,
992
- label: i && n.name || (i ? n.id : `#${t + 1}`),
993
- ...i ? { definition: n } : { rawReason: "no id" },
1122
+ key: s ? n.id : `#${t}`,
1123
+ label: s && n.name || (s ? n.id : `#${t + 1}`),
1124
+ ...s ? { definition: n } : { rawReason: "no id" },
994
1125
  source: e
995
1126
  };
996
1127
  }
997
- const Me = ie({
1128
+ const Ue = fe({
998
1129
  id: "views",
999
1130
  label: "Views",
1000
1131
  labelKey: "devStudio.kind.views",
1001
1132
  icon: "grid",
1002
1133
  editor: "views",
1003
- match: S(".views.json"),
1134
+ match: j(".views.json"),
1004
1135
  property: "views",
1005
1136
  itemKey: "id",
1006
- toItem: (e, t) => oe(e, t),
1137
+ toItem: (e, t) => pe(e, t),
1007
1138
  fromItem: (e) => e.definition ?? e.source
1008
- }), xe = ie({
1139
+ }), Ve = fe({
1009
1140
  id: "workflows",
1010
1141
  label: "Workflows",
1011
1142
  labelKey: "devStudio.kind.workflows",
1012
1143
  icon: "git-branch",
1013
1144
  editor: "workflows",
1014
- match: S(".workflows.json"),
1145
+ match: j(".workflows.json"),
1015
1146
  property: "workflows",
1016
1147
  itemKey: "id",
1017
- toItem: (e, t) => oe(e, t),
1148
+ toItem: (e, t) => pe(e, t),
1018
1149
  fromItem: (e) => e.definition ?? e.source
1019
- }), Je = J({
1150
+ }), _e = L({
1020
1151
  id: "dataSources",
1021
1152
  label: "Data sources",
1022
1153
  labelKey: "devStudio.kind.dataSources",
1023
1154
  icon: "database",
1024
1155
  editor: "dataSources",
1025
- match: S(".datasources.json"),
1156
+ match: j(".datasources.json"),
1026
1157
  property: "dataSources",
1027
1158
  itemKey: "key"
1028
- }), Te = re({
1159
+ }), ze = ue({
1029
1160
  id: "rbac",
1030
1161
  label: "Access",
1031
1162
  labelKey: "devStudio.kind.rbac",
1032
1163
  icon: "shield",
1033
1164
  editor: "rbac",
1034
- match: S(".rbac.json")
1035
- }), Fe = J({
1165
+ match: j(".rbac.json")
1166
+ }), We = L({
1036
1167
  id: "hooks",
1037
1168
  label: "Lifecycle hooks",
1038
1169
  labelKey: "devStudio.kind.hooks",
1039
1170
  icon: "zap",
1040
1171
  editor: "hooks",
1041
- match: S(".hooks.json"),
1172
+ match: j(".hooks.json"),
1042
1173
  property: "bindings",
1043
1174
  itemKey: "id"
1044
- }), Pe = [
1045
- _,
1046
- Ne,
1047
- Ie,
1048
- Me,
1049
- xe,
1050
- Je,
1051
- Te,
1052
- Fe
1175
+ }), qe = [
1176
+ X,
1177
+ Ce,
1178
+ Re,
1179
+ Ue,
1180
+ Ve,
1181
+ _e,
1182
+ ze,
1183
+ We
1053
1184
  ];
1054
- function B(e) {
1185
+ function H(e) {
1055
1186
  return e.normalize("NFKD").replace(/[̀-ͯ]/g, "").replace(/ł/g, "l").replace(/Ł/g, "L").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "module";
1056
1187
  }
1057
- const W = (e) => {
1058
- const t = e.find((n) => _.match(n.path));
1059
- return t ? je(t.text, void 0) : void 0;
1188
+ const Z = (e) => {
1189
+ const t = e.find((n) => X.match(n.path));
1190
+ return t ? Je(t.text, void 0) : void 0;
1060
1191
  };
1061
- function De(e) {
1062
- const t = e.find((n) => _.match(n.path));
1192
+ function Be(e) {
1193
+ const t = e.find((n) => X.match(n.path));
1063
1194
  return t ? K(t.path).replace(/\.manifest\.json$/i, "") : "module";
1064
1195
  }
1065
- const G = (e) => Array.isArray(e.fields) ? e.fields : [], We = {
1196
+ const Q = (e) => Array.isArray(e.fields) ? e.fields : [], mt = {
1066
1197
  id: "native",
1067
- kinds: Pe,
1198
+ kinds: qe,
1068
1199
  locales: ["en", "pl", "de", "fr", "es", "uk"],
1069
1200
  requiredLocales: ["en"],
1070
1201
  moduleId: (e) => {
1071
- const t = W(e), n = (t == null ? void 0 : t.id) ?? (t == null ? void 0 : t.packageName);
1202
+ const t = Z(e), n = (t == null ? void 0 : t.id) ?? (t == null ? void 0 : t.packageName);
1072
1203
  return typeof n == "string" ? n : void 0;
1073
1204
  },
1074
1205
  validateModule: ({ files: e }) => {
1075
- const t = W(e);
1206
+ const t = Z(e);
1076
1207
  return t ? ["id", "name", "version"].filter((n) => typeof t[n] != "string" || !t[n]).map((n) => ({
1077
1208
  severity: "error",
1078
1209
  code: "manifest.required",
@@ -1090,7 +1221,7 @@ const G = (e) => Array.isArray(e.fields) ? e.fields : [], We = {
1090
1221
  ];
1091
1222
  },
1092
1223
  newFile: (e, { files: t }) => {
1093
- const n = De(t), r = {
1224
+ const n = Be(t), i = {
1094
1225
  entities: ["entities.json", { entities: [] }],
1095
1226
  views: ["views.json", { views: [] }],
1096
1227
  workflows: ["workflows.json", { workflows: [] }],
@@ -1098,16 +1229,16 @@ const G = (e) => Array.isArray(e.fields) ? e.fields : [], We = {
1098
1229
  rbac: ["rbac.json", { roles: [], actions: [], resources: [], grants: {} }],
1099
1230
  hooks: ["hooks.json", { bindings: [] }]
1100
1231
  }[e];
1101
- return r ? { path: `${n}.${r[0]}`, text: k(r[1]) } : void 0;
1232
+ return i ? { path: `${n}.${i[0]}`, text: v(i[1]) } : void 0;
1102
1233
  },
1103
1234
  generateModule: async (e, { existingIds: t }) => {
1104
- let n = B(e.name);
1105
- for (let r = 2; t.has(n); r++)
1106
- n = `${B(e.name)}-${r}`;
1107
- const i = [
1235
+ let n = H(e.name);
1236
+ for (let i = 2; t.has(n); i++)
1237
+ n = `${H(e.name)}-${i}`;
1238
+ const s = [
1108
1239
  {
1109
1240
  path: `${n}.manifest.json`,
1110
- text: k({
1241
+ text: v({
1111
1242
  id: n,
1112
1243
  name: e.name,
1113
1244
  version: "1.0.0",
@@ -1116,24 +1247,24 @@ const G = (e) => Array.isArray(e.fields) ? e.fields : [], We = {
1116
1247
  ...e.packageId ? { category: e.packageId } : {}
1117
1248
  })
1118
1249
  },
1119
- { path: `${n}.entities.json`, text: k({ entities: e.entities }) }
1250
+ { path: `${n}.entities.json`, text: v({ entities: e.entities }) }
1120
1251
  ];
1121
- for (const r of e.locales) {
1122
- const a = { "module.displayName": e.name };
1252
+ for (const i of e.locales) {
1253
+ const o = { "module.displayName": e.name };
1123
1254
  for (const c of e.entities) {
1124
- const d = String(c.name ?? "");
1125
- a[`entity.${d}.displayName`] = d;
1126
- for (const u of G(c))
1127
- a[`field.${d}.${String(u.name)}.label`] = String(u.name);
1255
+ const l = String(c.name ?? "");
1256
+ o[`entity.${l}.displayName`] = l;
1257
+ for (const u of Q(c))
1258
+ o[`field.${l}.${String(u.name)}.label`] = String(u.name);
1128
1259
  }
1129
- i.push({
1130
- path: `${n}.${r}.i18n.json`,
1131
- text: k({ locale: r, translations: a })
1260
+ s.push({
1261
+ path: `${n}.${i}.i18n.json`,
1262
+ text: v({ locale: i, translations: o })
1132
1263
  });
1133
1264
  }
1134
1265
  if (e.views) {
1135
- const r = e.entities.map((a) => {
1136
- const c = String(a.name ?? "Item");
1266
+ const i = e.entities.map((o) => {
1267
+ const c = String(o.name ?? "Item");
1137
1268
  return {
1138
1269
  id: `${c}List`,
1139
1270
  name: `${c} list`,
@@ -1150,9 +1281,9 @@ const G = (e) => Array.isArray(e.fields) ? e.fields : [], We = {
1150
1281
  controlType: "dataGrid",
1151
1282
  colSpan: 12,
1152
1283
  props: {
1153
- columns: G(a).map((d) => ({
1154
- field: String(d.name),
1155
- header: String(d.name)
1284
+ columns: Q(o).map((l) => ({
1285
+ field: String(l.name),
1286
+ header: String(l.name)
1156
1287
  }))
1157
1288
  },
1158
1289
  bindings: { data: { source: "rows", field: "" } }
@@ -1162,10 +1293,10 @@ const G = (e) => Array.isArray(e.fields) ? e.fields : [], We = {
1162
1293
  ]
1163
1294
  };
1164
1295
  });
1165
- i.push({ path: `${n}.views.json`, text: k({ views: r }) });
1296
+ s.push({ path: `${n}.views.json`, text: v({ views: i }) });
1166
1297
  }
1167
1298
  if (e.permissions) {
1168
- const r = {
1299
+ const i = {
1169
1300
  roles: [
1170
1301
  { id: "viewer", label: "Viewer" },
1171
1302
  { id: "editor", label: "Editor" },
@@ -1176,58 +1307,71 @@ const G = (e) => Array.isArray(e.fields) ? e.fields : [], We = {
1176
1307
  { id: "edit", label: "Edit" },
1177
1308
  { id: "delete", label: "Delete" }
1178
1309
  ],
1179
- resources: e.entities.map((a) => ({
1180
- id: `entity:${String(a.name)}`,
1181
- label: String(a.name),
1310
+ resources: e.entities.map((o) => ({
1311
+ id: `entity:${String(o.name)}`,
1312
+ label: String(o.name),
1182
1313
  type: "entity"
1183
1314
  })),
1184
1315
  grants: {}
1185
1316
  };
1186
- i.push({ path: `${n}.rbac.json`, text: k(r) });
1317
+ s.push({ path: `${n}.rbac.json`, text: v(i) });
1187
1318
  }
1188
- return { id: n, packageId: e.packageId, files: i };
1319
+ return { id: n, packageId: e.packageId, files: s };
1189
1320
  }
1190
1321
  };
1191
1322
  export {
1192
- J as arrayFileKind,
1193
- Ce as buildDocuments,
1194
- Ue as createMemoryStudioProvider,
1195
- Re as defineManifestSection,
1196
- Be as deriveDefaultRbac,
1197
- C as detectJsonTextFormat,
1198
- Ve as encodeDocument,
1199
- S as endsWithAny,
1200
- ze as entitiesToSchemas,
1323
+ tt as addStudioFolder,
1324
+ et as addStudioSection,
1325
+ L as arrayFileKind,
1326
+ ot as buildDocuments,
1327
+ ct as createMemoryStudioProvider,
1328
+ lt as defineManifestSection,
1329
+ pt as deriveDefaultRbac,
1330
+ z as detectJsonTextFormat,
1331
+ T as emptyStudioLayout,
1332
+ at as encodeDocument,
1333
+ j as endsWithAny,
1334
+ ut as entitiesToSchemas,
1201
1335
  K as fileName,
1202
- _e as fitManifestSection,
1203
- Ee as i18nFileKind,
1204
- ie as itemsFileKind,
1205
- F as jsonFallbackKind,
1206
- R as jsonFileKind,
1207
- L as jsonValueFitsSchema,
1208
- I as jsonValuesEqual,
1209
- le as keepTextFormat,
1210
- qe as manifestSectionKeys,
1211
- De as modulePrefix,
1212
- Je as nativeDataSourcesKind,
1213
- Ne as nativeEntitiesKind,
1214
- Pe as nativeFileKinds,
1215
- Fe as nativeHooksKind,
1216
- Ie as nativeI18nKind,
1217
- _ as nativeManifestKind,
1218
- Te as nativeRbacKind,
1219
- We as nativeStudioPreset,
1220
- Me as nativeViewsKind,
1221
- xe as nativeWorkflowsKind,
1222
- re as objectFileKind,
1223
- E as parseJsonText,
1224
- X as patchJsonText,
1225
- de as patchJsonTextDetailed,
1226
- Ae as readTranslations,
1227
- ve as resolveFileKind,
1228
- je as safeJson,
1229
- B as slugifyModuleId,
1230
- k as stringifyJsonText,
1231
- P as textFallbackKind,
1232
- z as writeTranslations
1336
+ dt as fitManifestSection,
1337
+ De as i18nFileKind,
1338
+ Ze as isEmptyStudioLayout,
1339
+ ge as isStudioLayoutPath,
1340
+ fe as itemsFileKind,
1341
+ R as jsonFallbackKind,
1342
+ B as jsonFileKind,
1343
+ _ as jsonValueFitsSchema,
1344
+ M as jsonValuesEqual,
1345
+ we as keepTextFormat,
1346
+ ft as manifestSectionKeys,
1347
+ Be as modulePrefix,
1348
+ _e as nativeDataSourcesKind,
1349
+ Ce as nativeEntitiesKind,
1350
+ qe as nativeFileKinds,
1351
+ We as nativeHooksKind,
1352
+ Re as nativeI18nKind,
1353
+ X as nativeManifestKind,
1354
+ ze as nativeRbacKind,
1355
+ mt as nativeStudioPreset,
1356
+ Ue as nativeViewsKind,
1357
+ Ve as nativeWorkflowsKind,
1358
+ ue as objectFileKind,
1359
+ I as parseJsonText,
1360
+ He as parseStudioLayout,
1361
+ se as patchJsonText,
1362
+ ke as patchJsonTextDetailed,
1363
+ it as placeStudioEntry,
1364
+ Pe as readTranslations,
1365
+ st as removeStudioLayoutNode,
1366
+ rt as renameStudioEntryRef,
1367
+ nt as renameStudioLayoutNode,
1368
+ xe as resolveFileKind,
1369
+ Je as safeJson,
1370
+ Qe as serializeStudioLayout,
1371
+ H as slugifyModuleId,
1372
+ v as stringifyJsonText,
1373
+ Ge as studioEntryRef,
1374
+ Ye as studioLayoutPath,
1375
+ U as textFallbackKind,
1376
+ Y as writeTranslations
1233
1377
  };