@blue-labs/language 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +33 -2
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +8 -8
  5. package/dist/index.mjs +1626 -862
  6. package/dist/lib/Blue.d.ts +11 -2
  7. package/dist/lib/Blue.d.ts.map +1 -1
  8. package/dist/lib/errors/BlueError.d.ts +19 -0
  9. package/dist/lib/errors/BlueError.d.ts.map +1 -0
  10. package/dist/lib/index.d.ts +2 -0
  11. package/dist/lib/index.d.ts.map +1 -1
  12. package/dist/lib/model/Node.d.ts.map +1 -1
  13. package/dist/lib/preprocess/Preprocessor.d.ts.map +1 -1
  14. package/dist/lib/provider/RepositoryBasedNodeProvider.d.ts +2 -1
  15. package/dist/lib/provider/RepositoryBasedNodeProvider.d.ts.map +1 -1
  16. package/dist/lib/repository/RepositoryRuntime.d.ts +35 -0
  17. package/dist/lib/repository/RepositoryRuntime.d.ts.map +1 -0
  18. package/dist/lib/types/BlueContext.d.ts +11 -0
  19. package/dist/lib/types/BlueContext.d.ts.map +1 -0
  20. package/dist/lib/types/BlueIdMapper.d.ts +4 -0
  21. package/dist/lib/types/BlueIdMapper.d.ts.map +1 -0
  22. package/dist/lib/types/BlueRepository.d.ts +1 -8
  23. package/dist/lib/types/BlueRepository.d.ts.map +1 -1
  24. package/dist/lib/types/index.d.ts +3 -1
  25. package/dist/lib/types/index.d.ts.map +1 -1
  26. package/dist/lib/utils/NodePatch/patch-utils.d.ts.map +1 -1
  27. package/dist/lib/utils/NodePathAccessor.d.ts.map +1 -1
  28. package/dist/lib/utils/NodeToYaml.d.ts +9 -0
  29. package/dist/lib/utils/NodeToYaml.d.ts.map +1 -0
  30. package/dist/lib/utils/Properties.d.ts +1 -0
  31. package/dist/lib/utils/Properties.d.ts.map +1 -1
  32. package/dist/lib/utils/RepositoryVersionSerializer.d.ts +28 -0
  33. package/dist/lib/utils/RepositoryVersionSerializer.d.ts.map +1 -0
  34. package/dist/lib/utils/TypeSchemaResolver.d.ts.map +1 -1
  35. package/dist/lib/utils/repositoryVersioning/BlueContextRepositoriesParser.d.ts +4 -0
  36. package/dist/lib/utils/repositoryVersioning/BlueContextRepositoriesParser.d.ts.map +1 -0
  37. package/dist/lib/utils/repositoryVersioning/BlueContextResolver.d.ts +18 -0
  38. package/dist/lib/utils/repositoryVersioning/BlueContextResolver.d.ts.map +1 -0
  39. package/dist/lib/utils/repositoryVersioning/dropPointers.d.ts +5 -0
  40. package/dist/lib/utils/repositoryVersioning/dropPointers.d.ts.map +1 -0
  41. package/dist/lib/utils/repositoryVersioning/normalizeNodeBlueIds.d.ts +4 -0
  42. package/dist/lib/utils/repositoryVersioning/normalizeNodeBlueIds.d.ts.map +1 -0
  43. package/dist/schema/generated/blueObject.zod.d.ts +2 -2
  44. package/package.json +3 -2
  45. package/dist/lib/mapping/__tests__/schema/contract.d.ts +0 -364
  46. package/dist/lib/mapping/__tests__/schema/contract.d.ts.map +0 -1
  47. package/dist/lib/mapping/__tests__/schema/doctor.d.ts +0 -19
  48. package/dist/lib/mapping/__tests__/schema/doctor.d.ts.map +0 -1
  49. package/dist/lib/mapping/__tests__/schema/index.d.ts +0 -3389
  50. package/dist/lib/mapping/__tests__/schema/index.d.ts.map +0 -1
  51. package/dist/lib/mapping/__tests__/schema/nurse.d.ts +0 -19
  52. package/dist/lib/mapping/__tests__/schema/nurse.d.ts.map +0 -1
  53. package/dist/lib/mapping/__tests__/schema/person.d.ts +0 -15
  54. package/dist/lib/mapping/__tests__/schema/person.d.ts.map +0 -1
  55. package/dist/lib/mapping/__tests__/schema/personDictionaryExample.d.ts +0 -75
  56. package/dist/lib/mapping/__tests__/schema/personDictionaryExample.d.ts.map +0 -1
  57. package/dist/lib/mapping/__tests__/schema/personListExample.d.ts +0 -61
  58. package/dist/lib/mapping/__tests__/schema/personListExample.d.ts.map +0 -1
  59. package/dist/lib/mapping/__tests__/schema/personObjectExample.d.ts +0 -61
  60. package/dist/lib/mapping/__tests__/schema/personObjectExample.d.ts.map +0 -1
  61. package/dist/lib/mapping/__tests__/schema/personValueExample.d.ts +0 -25
  62. package/dist/lib/mapping/__tests__/schema/personValueExample.d.ts.map +0 -1
  63. package/dist/lib/mapping/__tests__/schema/x.d.ts +0 -67
  64. package/dist/lib/mapping/__tests__/schema/x.d.ts.map +0 -1
  65. package/dist/lib/mapping/__tests__/schema/x1.d.ts +0 -73
  66. package/dist/lib/mapping/__tests__/schema/x1.d.ts.map +0 -1
  67. package/dist/lib/mapping/__tests__/schema/x11.d.ts +0 -80
  68. package/dist/lib/mapping/__tests__/schema/x11.d.ts.map +0 -1
  69. package/dist/lib/mapping/__tests__/schema/x12.d.ts +0 -80
  70. package/dist/lib/mapping/__tests__/schema/x12.d.ts.map +0 -1
  71. package/dist/lib/mapping/__tests__/schema/x2.d.ts +0 -67
  72. package/dist/lib/mapping/__tests__/schema/x2.d.ts.map +0 -1
  73. package/dist/lib/mapping/__tests__/schema/x3.d.ts +0 -77
  74. package/dist/lib/mapping/__tests__/schema/x3.d.ts.map +0 -1
  75. package/dist/lib/mapping/__tests__/schema/xSubscription.d.ts +0 -10
  76. package/dist/lib/mapping/__tests__/schema/xSubscription.d.ts.map +0 -1
  77. package/dist/lib/mapping/__tests__/schema/y.d.ts +0 -990
  78. package/dist/lib/mapping/__tests__/schema/y.d.ts.map +0 -1
  79. package/dist/lib/mapping/__tests__/schema/y1.d.ts +0 -1381
  80. package/dist/lib/mapping/__tests__/schema/y1.d.ts.map +0 -1
  81. package/dist/lib/utils/__tests__/calculateCID.d.ts +0 -3
  82. package/dist/lib/utils/__tests__/calculateCID.d.ts.map +0 -1
  83. package/dist/lib/utils/limits/__tests__/TestLimits.d.ts +0 -39
  84. package/dist/lib/utils/limits/__tests__/TestLimits.d.ts.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,23 +1,88 @@
1
1
  import M from "big.js";
2
- import { isNullable as I, isNonNullable as d, jsonPrimitiveSchema as _t, isReadonlyArray as he, isJsonPrimitive as $e, isPreciseNumberString as nt } from "@blue-labs/shared-utils";
3
- import { z as h, ZodOptional as it, ZodNullable as ot, ZodReadonly as lt, ZodBranded as ct, ZodEffects as fe, ZodLazy as ge, ZodString as J, ZodNumber as Z, ZodBoolean as ue, ZodBigInt as de, ZodEnum as Kt, ZodNativeEnum as Yt, ZodIntersection as Gt, ZodUnion as zt, ZodObject as kt, ZodRecord as Jt } from "zod";
4
- import re from "bs58";
5
- import { isObject as at, isArray as xe, isString as je, omit as ut, pascal as Zt, map as Ht } from "radash";
6
- import { sha256 as Wt } from "js-sha256";
7
- import Pe from "crypto";
8
- import qt from "base32.js";
9
- import U from "js-yaml";
10
- class P extends M {
2
+ import { isNullable as I, isNonNullable as p, jsonPrimitiveSchema as cr, isReadonlyArray as Ee, isJsonPrimitive as qe, isPreciseNumberString as Et } from "@blue-labs/shared-utils";
3
+ import { z as f, ZodOptional as Nt, ZodNullable as Pt, ZodReadonly as St, ZodBranded as At, ZodEffects as Ne, ZodLazy as Pe, ZodString as ee, ZodNumber as te, ZodBoolean as Be, ZodBigInt as be, ZodEnum as ar, ZodNativeEnum as ur, ZodIntersection as dr, ZodUnion as pr, ZodObject as fr, ZodRecord as hr } from "zod";
4
+ import ae from "bs58";
5
+ import { isObject as Vt, isArray as Qe, isString as et, omit as Ct, pascal as yr, map as gr } from "radash";
6
+ import { OBJECT_CONTRACTS as C, OBJECT_MERGE_POLICY as mr, OBJECT_SCHEMA as Ir, BLUE_REPOSITORY_STATUS_STABLE as le, BLUE_REPOSITORY_STATUS_DEV as tt, validateAttributesAddedPointer as Tr, parsePointer as Rt } from "@blue-labs/repository-contract";
7
+ import { sha256 as vr } from "js-sha256";
8
+ import Le from "crypto";
9
+ import Br from "base32.js";
10
+ import W from "js-yaml";
11
+ class S extends M {
11
12
  constructor(e) {
12
13
  super(e);
13
14
  }
14
15
  }
15
- class w extends M {
16
+ class E extends M {
16
17
  constructor(e) {
17
18
  super(e);
18
19
  }
19
20
  }
20
- class Xt {
21
+ const G = "name", J = "description", Z = "type", he = "itemType", ye = "keyType", ge = "valueType", me = "value", Oe = "items", x = "blueId", De = "blue", rt = [
22
+ G,
23
+ J,
24
+ Z,
25
+ he,
26
+ ye,
27
+ ge,
28
+ me,
29
+ Oe,
30
+ x,
31
+ De
32
+ ], Ot = "Text", Dt = "Double", Mt = "Integer", xt = "Boolean", Ft = "List", $t = "Dictionary", Me = [
33
+ Ot,
34
+ Dt,
35
+ Mt,
36
+ xt
37
+ ], st = [...Me, Ft, $t], _ = "DLRQwz7MQeCrzjy9bohPNwtCxKEBbKaMK65KBrwjfG6K", L = "7pwXmXYCJtWnd348c2JQGBkm9C4renmZRwxbfaypsx5y", j = "5WNMiV9Knz63B4dVY5JtMyh3FB4FSGqv7ceScvuapdE1", U = "4EzhSubEimSQD3zrYHRtobfPPWntUuhEz8YcdxHsi12u", nt = "6aehfNAxHLC1PHHoDr3tYtFH3RWNbiWdFancJ1bypXEY", it = "G7fBT9PSod1RfHLHkpafAGBDVAJMrMhAMY51ERcyXNrj", ot = [
38
+ _,
39
+ L,
40
+ j,
41
+ U
42
+ ], X = [
43
+ ...ot,
44
+ nt,
45
+ it
46
+ ], br = Object.fromEntries(
47
+ st.map((s, e) => [s, X[e]])
48
+ ), xe = Object.fromEntries(
49
+ X.map((s, e) => [s, st[e]])
50
+ ), On = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
51
+ __proto__: null,
52
+ BASIC_TYPES: Me,
53
+ BASIC_TYPE_BLUE_IDS: ot,
54
+ BOOLEAN_TYPE: xt,
55
+ BOOLEAN_TYPE_BLUE_ID: U,
56
+ CORE_TYPES: st,
57
+ CORE_TYPE_BLUE_IDS: X,
58
+ CORE_TYPE_BLUE_ID_TO_NAME_MAP: xe,
59
+ CORE_TYPE_NAME_TO_BLUE_ID_MAP: br,
60
+ DICTIONARY_TYPE: $t,
61
+ DICTIONARY_TYPE_BLUE_ID: it,
62
+ DOUBLE_TYPE: Dt,
63
+ DOUBLE_TYPE_BLUE_ID: L,
64
+ INTEGER_TYPE: Mt,
65
+ INTEGER_TYPE_BLUE_ID: j,
66
+ LIST_TYPE: Ft,
67
+ LIST_TYPE_BLUE_ID: nt,
68
+ OBJECT_BLUE: De,
69
+ OBJECT_BLUE_ID: x,
70
+ OBJECT_CONTRACTS: C,
71
+ OBJECT_DESCRIPTION: J,
72
+ OBJECT_ITEMS: Oe,
73
+ OBJECT_ITEM_TYPE: he,
74
+ OBJECT_KEY_TYPE: ye,
75
+ OBJECT_MERGE_POLICY: mr,
76
+ OBJECT_NAME: G,
77
+ OBJECT_SCHEMA: Ir,
78
+ OBJECT_SPECIFIC_KEYS: rt,
79
+ OBJECT_TYPE: Z,
80
+ OBJECT_VALUE: me,
81
+ OBJECT_VALUE_TYPE: ge,
82
+ TEXT_TYPE: Ot,
83
+ TEXT_TYPE_BLUE_ID: _
84
+ }, Symbol.toStringTag, { value: "Module" }));
85
+ class wr {
21
86
  static get(e, t, r, n = !0) {
22
87
  if (I(t) || !t.startsWith("/"))
23
88
  throw new Error(`Invalid path: ${t}`);
@@ -113,7 +178,7 @@ class Xt {
113
178
  i = new a().setProperties(l);
114
179
  break;
115
180
  }
116
- case "contracts": {
181
+ case C: {
117
182
  const l = e.getContracts();
118
183
  i = new a().setContracts(l);
119
184
  break;
@@ -132,41 +197,9 @@ class Xt {
132
197
  }
133
198
  static link(e, t) {
134
199
  const r = t(e);
135
- return d(r) ? r : e;
200
+ return p(r) ? r : e;
136
201
  }
137
202
  }
138
- const H = "name", W = "description", ye = "type", Le = "itemType", Ue = "keyType", _e = "valueType", be = "value", Ke = "items", j = "blueId", Ye = "blue", Qt = [
139
- H,
140
- W,
141
- ye,
142
- Le,
143
- Ue,
144
- _e,
145
- be,
146
- Ke,
147
- j,
148
- Ye
149
- ], er = "Text", tr = "Double", rr = "Integer", sr = "Boolean", nr = "List", ir = "Dictionary", Ge = [
150
- er,
151
- tr,
152
- rr,
153
- sr
154
- ], dt = [...Ge, nr, ir], _ = "DLRQwz7MQeCrzjy9bohPNwtCxKEBbKaMK65KBrwjfG6K", K = "7pwXmXYCJtWnd348c2JQGBkm9C4renmZRwxbfaypsx5y", Y = "5WNMiV9Knz63B4dVY5JtMyh3FB4FSGqv7ceScvuapdE1", G = "4EzhSubEimSQD3zrYHRtobfPPWntUuhEz8YcdxHsi12u", pt = "6aehfNAxHLC1PHHoDr3tYtFH3RWNbiWdFancJ1bypXEY", ht = "G7fBT9PSod1RfHLHkpafAGBDVAJMrMhAMY51ERcyXNrj", ft = [
155
- _,
156
- K,
157
- Y,
158
- G
159
- ], le = [
160
- ...ft,
161
- pt,
162
- ht
163
- ];
164
- Object.fromEntries(
165
- dt.map((s, e) => [s, le[e]])
166
- );
167
- const gt = Object.fromEntries(
168
- le.map((s, e) => [s, dt[e]])
169
- );
170
203
  class a {
171
204
  static INTEGER = new a("Integer");
172
205
  name;
@@ -222,19 +255,19 @@ class a {
222
255
  }
223
256
  getValue() {
224
257
  const e = this.type?.getBlueId();
225
- if (d(e) && d(this.value)) {
226
- if (e === Y && typeof this.value == "string")
227
- return new w(this.value);
228
- if (e === K && typeof this.value == "string") {
229
- const t = new P(this.value), r = parseFloat(t.toString());
230
- return new P(r.toString());
231
- } else if (e === G && typeof this.value == "string")
258
+ if (p(e) && p(this.value)) {
259
+ if (e === j && typeof this.value == "string")
260
+ return new E(this.value);
261
+ if (e === L && typeof this.value == "string") {
262
+ const t = new S(this.value), r = parseFloat(t.toString());
263
+ return new S(r.toString());
264
+ } else if (e === U && typeof this.value == "string")
232
265
  return this.value.toLowerCase() === "true";
233
266
  }
234
267
  return this.value;
235
268
  }
236
269
  setValue(e) {
237
- return typeof e == "number" ? e % 1 === 0 ? this.value = new w(e.toString()) : this.value = new P(e.toString()) : this.value = e, this;
270
+ return typeof e == "number" ? e % 1 === 0 ? this.value = new E(e.toString()) : this.value = new S(e.toString()) : this.value = e, this;
238
271
  }
239
272
  getItems() {
240
273
  return this.items;
@@ -258,24 +291,30 @@ class a {
258
291
  return this.properties && delete this.properties[e], this;
259
292
  }
260
293
  getContractsProperty() {
261
- return this.properties?.contracts;
294
+ return this.properties?.[C];
262
295
  }
263
296
  getContracts() {
264
297
  return this.getContractsProperty()?.getProperties();
265
298
  }
266
299
  setContracts(e) {
267
- return I(e) ? this.removeProperty("contracts") : this.addProperty("contracts", new a().setProperties(e)), this;
300
+ return I(e) ? this.removeProperty(C) : this.addProperty(
301
+ C,
302
+ new a().setProperties(e)
303
+ ), this;
268
304
  }
269
305
  addContract(e, t) {
270
306
  const r = this.getContractsProperty();
271
- return I(r) ? this.addProperty("contracts", new a().addProperty(e, t)) : r.addProperty(e, t), this;
307
+ return I(r) ? this.addProperty(
308
+ C,
309
+ new a().addProperty(e, t)
310
+ ) : r.addProperty(e, t), this;
272
311
  }
273
312
  removeContract(e) {
274
313
  const t = this.getContractsProperty();
275
314
  if (t) {
276
315
  t.removeProperty(e);
277
316
  const r = t.getProperties();
278
- r && Object.keys(r).length === 0 && this.removeProperty("contracts");
317
+ r && Object.keys(r).length === 0 && this.removeProperty(C);
279
318
  }
280
319
  return this;
281
320
  }
@@ -305,7 +344,7 @@ class a {
305
344
  return !1;
306
345
  }
307
346
  get(e, t) {
308
- return Xt.get(this, e, t);
347
+ return wr.get(this, e, t);
309
348
  }
310
349
  getAsNode(e) {
311
350
  const t = this.get(e);
@@ -315,7 +354,7 @@ class a {
315
354
  }
316
355
  getAsInteger(e) {
317
356
  const t = this.get(e);
318
- if (t instanceof w || t instanceof P)
357
+ if (t instanceof E || t instanceof S)
319
358
  return t.toNumber();
320
359
  throw new Error(
321
360
  `Value at path ${e} is not a BigInteger or BigDecimal: ${t}`
@@ -331,7 +370,7 @@ class a {
331
370
  return `BlueNode{name='${this.name}', description='${this.description}', type=${this.type}, itemType=${this.itemType}, keyType=${this.keyType}, valueType=${this.valueType}, value=${this.value}, items=${this.items}, properties=${this.properties}, blueId='${this.blueId}', blue=${this.blue}, inlineValue=${this.inlineValue}}`;
332
371
  }
333
372
  }
334
- class me {
373
+ class Se {
335
374
  static MIN_BLUE_ID_LENGTH = 41;
336
375
  static MAX_BLUE_ID_LENGTH = 45;
337
376
  static BLUE_ID_PATTERN = /^[1-9A-HJ-NP-Za-km-z]{41,45}(?:#\d+)?$/;
@@ -342,7 +381,7 @@ class me {
342
381
  if (n < this.MIN_BLUE_ID_LENGTH || n > this.MAX_BLUE_ID_LENGTH)
343
382
  return !1;
344
383
  try {
345
- if (re.decode(r).length !== 32)
384
+ if (ae.decode(r).length !== 32)
346
385
  return !1;
347
386
  } catch {
348
387
  return !1;
@@ -357,14 +396,14 @@ class me {
357
396
  return !0;
358
397
  }
359
398
  }
360
- const Ys = h.string().max(me.MAX_BLUE_ID_LENGTH, {
399
+ const Dn = f.string().max(Se.MAX_BLUE_ID_LENGTH, {
361
400
  message: "Blue Id has a maximum length of 45 characters"
362
- }).min(me.MIN_BLUE_ID_LENGTH, {
401
+ }).min(Se.MIN_BLUE_ID_LENGTH, {
363
402
  message: "Blue Id has a minimum length of 41 characters"
364
403
  }).refine(
365
404
  (s) => {
366
405
  try {
367
- return re.decode(s), !0;
406
+ return ae.decode(s), !0;
368
407
  } catch {
369
408
  return !1;
370
409
  }
@@ -372,45 +411,45 @@ const Ys = h.string().max(me.MAX_BLUE_ID_LENGTH, {
372
411
  {
373
412
  message: "Blue Id must be a valid Base58 string"
374
413
  }
375
- ), se = h.lazy(
376
- () => h.record(h.unknown()).and(
377
- h.object({
378
- blueId: h.string().optional(),
379
- name: h.string().optional(),
380
- description: h.string().optional(),
381
- type: se.optional(),
382
- value: h.union([h.string(), h.number(), h.boolean()]).optional().nullable(),
383
- items: h.array(se).optional()
414
+ ), ue = f.lazy(
415
+ () => f.record(f.unknown()).and(
416
+ f.object({
417
+ blueId: f.string().optional(),
418
+ name: f.string().optional(),
419
+ description: f.string().optional(),
420
+ type: ue.optional(),
421
+ value: f.union([f.string(), f.number(), f.boolean()]).optional().nullable(),
422
+ items: f.array(ue).optional()
384
423
  })
385
424
  )
386
- ), we = h.object({
387
- blueId: h.string().optional(),
388
- name: h.string().optional(),
389
- description: h.string().optional(),
390
- type: se.optional()
391
- }), Gs = we.extend({
392
- value: h.string().optional()
393
- }), zs = we.extend({
394
- value: h.number().optional()
395
- }), ks = we.extend({
396
- value: h.boolean().optional()
397
- }), Js = we.extend({
398
- items: h.array(h.string()).optional()
399
- }), Zs = (s) => se.safeParse(s).success, or = (s) => d(s) && "blueId" in s && d(s.blueId), Hs = (s) => d(s) && "name" in s && d(s.name), lr = (s) => d(s) && "items" in s && d(s.items), cr = (s) => d(s) && "type" in s && d(s.type), ar = (s) => d(s) && "value" in s && d(s.value), Ws = (s, e) => s.required({ type: !0 }).safeParse(e).success, S = (s) => s instanceof M, L = (s) => S(s) && s instanceof w, De = (s) => S(s) && s instanceof P, ur = h.lazy(
400
- () => h.record(Ie)
401
- ), dr = h.lazy(
402
- () => h.union([
403
- h.array(Ie),
404
- h.array(Ie).readonly()
425
+ ), Fe = f.object({
426
+ blueId: f.string().optional(),
427
+ name: f.string().optional(),
428
+ description: f.string().optional(),
429
+ type: ue.optional()
430
+ }), Mn = Fe.extend({
431
+ value: f.string().optional()
432
+ }), xn = Fe.extend({
433
+ value: f.number().optional()
434
+ }), Fn = Fe.extend({
435
+ value: f.boolean().optional()
436
+ }), $n = Fe.extend({
437
+ items: f.array(f.string()).optional()
438
+ }), _n = (s) => ue.safeParse(s).success, Er = (s) => p(s) && "blueId" in s && p(s.blueId), Ln = (s) => p(s) && "name" in s && p(s.name), Nr = (s) => p(s) && "items" in s && p(s.items), Pr = (s) => p(s) && "type" in s && p(s.type), Sr = (s) => p(s) && "value" in s && p(s.value), jn = (s, e) => s.required({ type: !0 }).safeParse(e).success, A = (s) => s instanceof M, H = (s) => A(s) && s instanceof E, Ge = (s) => A(s) && s instanceof S, Ar = f.lazy(
439
+ () => f.record(Ae)
440
+ ), Vr = f.lazy(
441
+ () => f.union([
442
+ f.array(Ae),
443
+ f.array(Ae).readonly()
405
444
  ])
406
- ), Ie = h.lazy(
407
- () => h.union([
408
- _t,
409
- ur,
410
- dr,
411
- h.instanceof(M)
445
+ ), Ae = f.lazy(
446
+ () => f.union([
447
+ cr,
448
+ Ar,
449
+ Vr,
450
+ f.instanceof(M)
412
451
  ])
413
- ), yt = (s) => at(s) && !xe(s) && !he(s) && !S(s), mt = (s) => xe(s) || he(s), qs = (s) => mt(s) || yt(s) || S(s) || $e(s);
452
+ ), _t = (s) => Vt(s) && !Qe(s) && !Ee(s) && !A(s), Lt = (s) => Qe(s) || Ee(s), Un = (s) => Lt(s) || _t(s) || A(s) || qe(s);
414
453
  class g {
415
454
  static deserialize(e) {
416
455
  return g.handleNode(e);
@@ -420,54 +459,54 @@ class g {
420
459
  throw new Error(
421
460
  "This is not a valid JSON-like value. Found 'undefined' as a value."
422
461
  );
423
- if (yt(e)) {
462
+ if (_t(e)) {
424
463
  const t = new a(), r = {};
425
464
  return Object.entries(e).forEach(([n, i]) => {
426
465
  switch (n) {
427
- case H:
466
+ case G:
428
467
  if (i == null)
429
468
  t.setName(void 0);
430
469
  else {
431
470
  if (typeof i != "string")
432
- throw new Error(`The ${H} field must be a string.`);
471
+ throw new Error(`The ${G} field must be a string.`);
433
472
  t.setName(i);
434
473
  }
435
474
  break;
436
- case W:
475
+ case J:
437
476
  if (i == null)
438
477
  t.setDescription(void 0);
439
478
  else {
440
479
  if (typeof i != "string")
441
480
  throw new Error(
442
- `The ${W} field must be a string.`
481
+ `The ${J} field must be a string.`
443
482
  );
444
483
  t.setDescription(i);
445
484
  }
446
485
  break;
447
- case ye:
486
+ case Z:
448
487
  t.setType(g.handleNode(i));
449
488
  break;
450
- case Le:
489
+ case he:
451
490
  t.setItemType(g.handleNode(i));
452
491
  break;
453
- case Ue:
492
+ case ye:
454
493
  t.setKeyType(g.handleNode(i));
455
494
  break;
456
- case _e:
495
+ case ge:
457
496
  t.setValueType(g.handleNode(i));
458
497
  break;
459
- case be:
498
+ case me:
460
499
  t.setValue(g.handleValue(i));
461
500
  break;
462
- case j:
501
+ case x:
463
502
  if (typeof i != "string")
464
- throw new Error(`The ${j} field must be a string.`);
503
+ throw new Error(`The ${x} field must be a string.`);
465
504
  t.setBlueId(i);
466
505
  break;
467
- case Ke:
506
+ case Oe:
468
507
  t.setItems(g.handleArray(i));
469
508
  break;
470
- case Ye:
509
+ case De:
471
510
  t.setBlue(g.handleNode(i));
472
511
  break;
473
512
  default:
@@ -476,7 +515,7 @@ class g {
476
515
  }
477
516
  }), Object.keys(r).length > 0 && t.setProperties(r), t;
478
517
  } else {
479
- if (mt(e))
518
+ if (Lt(e))
480
519
  return new a().setItems(g.handleArray(e));
481
520
  {
482
521
  const t = e;
@@ -489,13 +528,13 @@ class g {
489
528
  return null;
490
529
  if (typeof e == "string")
491
530
  return e;
492
- if (typeof e == "number" || S(e))
493
- if (L(e) || Number.isSafeInteger(e)) {
494
- const t = new w(e.toString()), r = Number.MIN_SAFE_INTEGER, n = Number.MAX_SAFE_INTEGER;
495
- return t.lt(r) ? new w(r.toString()) : t.gt(n) ? new w(n.toString()) : t;
531
+ if (typeof e == "number" || A(e))
532
+ if (H(e) || Number.isSafeInteger(e)) {
533
+ const t = new E(e.toString()), r = Number.MIN_SAFE_INTEGER, n = Number.MAX_SAFE_INTEGER;
534
+ return t.lt(r) ? new E(r.toString()) : t.gt(n) ? new E(n.toString()) : t;
496
535
  } else {
497
536
  const t = parseFloat(e.toString());
498
- return new P(t.toString());
537
+ return new S(t.toString());
499
538
  }
500
539
  else if (typeof e == "boolean")
501
540
  return e;
@@ -503,7 +542,7 @@ class g {
503
542
  }
504
543
  static handleArray(e) {
505
544
  if (e != null) {
506
- if (at(e) && !Array.isArray(e))
545
+ if (Vt(e) && !Array.isArray(e))
507
546
  return [g.handleNode(e)];
508
547
  if (Array.isArray(e))
509
548
  return e.map(g.handleNode);
@@ -511,12 +550,12 @@ class g {
511
550
  }
512
551
  }
513
552
  }
514
- function pr(s) {
553
+ function Cr(s) {
515
554
  return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
516
555
  }
517
- var Ee, Xe;
518
- function hr() {
519
- return Xe || (Xe = 1, Ee = function s(e) {
556
+ var je, gt;
557
+ function Rr() {
558
+ return gt || (gt = 1, je = function s(e) {
520
559
  if (typeof e == "number" && isNaN(e))
521
560
  throw new Error("NaN is not allowed");
522
561
  if (typeof e == "number" && !isFinite(e))
@@ -527,50 +566,50 @@ function hr() {
527
566
  const i = r.length === 0 ? "" : ",";
528
567
  return `${r}${i}${s(n)}:${s(e[n])}`;
529
568
  }, "")}}`;
530
- }), Ee;
569
+ }), je;
531
570
  }
532
- var fr = hr();
533
- const gr = /* @__PURE__ */ pr(fr);
534
- class yr {
571
+ var Or = Rr();
572
+ const Dr = /* @__PURE__ */ Cr(Or);
573
+ class Je {
535
574
  static canonicalize(e) {
536
- return gr(e);
575
+ return Dr(e);
537
576
  }
538
577
  }
539
- const Se = typeof process < "u" && process.versions != null && process.versions.node != null;
540
- class ze {
578
+ const Ue = typeof process < "u" && process.versions != null && process.versions.node != null;
579
+ class lt {
541
580
  static instance;
542
581
  browserCrypto;
543
582
  constructor() {
544
583
  this.browserCrypto = this.initBrowserCrypto();
545
584
  }
546
585
  static getInstance() {
547
- return this.instance || (this.instance = new ze()), this.instance;
586
+ return this.instance || (this.instance = new lt()), this.instance;
548
587
  }
549
588
  initBrowserCrypto() {
550
- return Se ? null : "crypto" in globalThis ? globalThis.crypto : null;
589
+ return Ue ? null : "crypto" in globalThis ? globalThis.crypto : null;
551
590
  }
552
591
  hasNodeCrypto() {
553
- return Se && !!Pe && typeof Pe.createHash == "function";
592
+ return Ue && !!Le && typeof Le.createHash == "function";
554
593
  }
555
594
  getBrowserCrypto() {
556
595
  return this.browserCrypto;
557
596
  }
558
597
  getNodeCrypto() {
559
- return Se ? Pe : null;
598
+ return Ue ? Le : null;
560
599
  }
561
600
  }
562
- class mr {
563
- cryptoEnv = ze.getInstance();
601
+ class Mr {
602
+ cryptoEnv = lt.getInstance();
564
603
  applySync(e) {
565
604
  const t = this.canonicalizeInput(e), r = this.cryptoEnv.hasNodeCrypto() ? this.sha256Sync(t) : this.sha256SyncBrowser(t);
566
- return re.encode(r);
605
+ return ae.encode(r);
567
606
  }
568
607
  async apply(e) {
569
608
  const t = this.canonicalizeInput(e), r = this.cryptoEnv.hasNodeCrypto() ? this.sha256Sync(t) : await this.sha256Async(t);
570
- return re.encode(r);
609
+ return ae.encode(r);
571
610
  }
572
611
  canonicalizeInput(e) {
573
- const t = yr.canonicalize(e);
612
+ const t = Je.canonicalize(e);
574
613
  if (typeof t != "string")
575
614
  throw new Error("Canonized value must be a string");
576
615
  return t;
@@ -585,7 +624,7 @@ class mr {
585
624
  return new Uint8Array(r);
586
625
  }
587
626
  sha256SyncBrowser(e) {
588
- return new Uint8Array(Wt.arrayBuffer(e));
627
+ return new Uint8Array(vr.arrayBuffer(e));
589
628
  }
590
629
  async sha256Async(e) {
591
630
  if (this.cryptoEnv.hasNodeCrypto())
@@ -612,7 +651,7 @@ class m {
612
651
  const r = e.getValue(), n = this.handleValue(r);
613
652
  if (n !== void 0 && t === "simple")
614
653
  return n;
615
- const i = e.getItems()?.map((k) => m.get(k, t));
654
+ const i = e.getItems()?.map((Q) => m.get(Q, t));
616
655
  if (i !== void 0 && t === "simple")
617
656
  return i;
618
657
  const o = e.getName(), l = e.getDescription();
@@ -623,30 +662,30 @@ class m {
623
662
  return i;
624
663
  }
625
664
  const c = {};
626
- o !== void 0 && (c[H] = o), l !== void 0 && (c[W] = l);
665
+ o !== void 0 && (c[G] = o), l !== void 0 && (c[J] = l);
627
666
  const u = e.getType();
628
667
  if (t === "official" && r !== void 0 && u === void 0) {
629
- const k = this.inferTypeBlueId(r);
630
- k !== null && (c[ye] = { [j]: k });
631
- } else u !== void 0 && (c[ye] = m.get(u, t));
668
+ const Q = this.inferTypeBlueId(r);
669
+ Q !== null && (c[Z] = { [x]: Q });
670
+ } else u !== void 0 && (c[Z] = m.get(u, t));
632
671
  const y = e.getItemType();
633
- y !== void 0 && (c[Le] = m.get(y, t));
634
- const p = e.getKeyType();
635
- p !== void 0 && (c[Ue] = m.get(p, t));
636
- const f = e.getValueType();
637
- f !== void 0 && (c[_e] = m.get(f, t)), n !== void 0 && (c[be] = n), i !== void 0 && (c[Ke] = i);
672
+ y !== void 0 && (c[he] = m.get(y, t));
673
+ const d = e.getKeyType();
674
+ d !== void 0 && (c[ye] = m.get(d, t));
675
+ const h = e.getValueType();
676
+ h !== void 0 && (c[ge] = m.get(h, t)), n !== void 0 && (c[me] = n), i !== void 0 && (c[Oe] = i);
638
677
  const v = e.getBlueId();
639
- v !== void 0 && (c[j] = v);
640
- const O = e.getBlue();
641
- O !== void 0 && (c[Ye] = O);
642
- const z = e.getProperties();
643
- return z !== void 0 && Object.entries(z).forEach(([k, Ut]) => {
644
- c[k] = m.get(Ut, t);
678
+ v !== void 0 && (c[x] = v);
679
+ const k = e.getBlue();
680
+ k !== void 0 && (c[De] = k);
681
+ const q = e.getProperties();
682
+ return q !== void 0 && Object.entries(q).forEach(([Q, lr]) => {
683
+ c[Q] = m.get(lr, t);
645
684
  }), c;
646
685
  }
647
686
  static handleValue(e) {
648
- if (S(e)) {
649
- if (L(e)) {
687
+ if (A(e)) {
688
+ if (H(e)) {
650
689
  const t = new M(Number.MIN_SAFE_INTEGER.toString()), r = new M(Number.MAX_SAFE_INTEGER.toString());
651
690
  if (e.lt(t) || e.gt(r))
652
691
  return e.toString();
@@ -656,12 +695,12 @@ class m {
656
695
  return e;
657
696
  }
658
697
  static inferTypeBlueId(e) {
659
- return typeof e == "string" ? _ : S(e) ? L(e) ? Y : K : typeof e == "boolean" ? G : null;
698
+ return typeof e == "string" ? _ : A(e) ? H(e) ? j : L : typeof e == "boolean" ? U : null;
660
699
  }
661
700
  }
662
- const Ir = (s) => $e(s) && d(s);
701
+ const xr = (s) => qe(s) && p(s);
663
702
  class T {
664
- static INSTANCE = new T(new mr());
703
+ static INSTANCE = new T(new Mr());
665
704
  hashProvider;
666
705
  constructor(e) {
667
706
  this.hashProvider = e;
@@ -696,14 +735,14 @@ class T {
696
735
  }
697
736
  // Internal method to calculate BlueId recursively
698
737
  internalCalculate(e, t) {
699
- return Ir(e) || S(e) ? this.applyHash(e.toString(), t) : Array.isArray(e) || he(e) ? this.calculateList(e, t) : this.calculateMap(e, t);
738
+ return xr(e) || A(e) ? this.applyHash(e.toString(), t) : Array.isArray(e) || Ee(e) ? this.calculateList(e, t) : this.calculateMap(e, t);
700
739
  }
701
740
  calculateMap(e, t) {
702
- if (e[j] !== void 0)
703
- return e[j];
741
+ if (e[x] !== void 0)
742
+ return e[x];
704
743
  const n = Object.keys(e).map((o) => {
705
744
  const l = e[o];
706
- if ([H, be, W].includes(o))
745
+ if ([G, me, J].includes(o))
707
746
  return t ? [o, l] : Promise.resolve([o, l]);
708
747
  {
709
748
  const c = this.internalCalculate(l, t);
@@ -746,10 +785,10 @@ class T {
746
785
  // Method to clean the input structure by removing null or undefined values
747
786
  cleanStructure(e) {
748
787
  if (e != null) {
749
- if ($e(e) || S(e))
788
+ if (qe(e) || A(e))
750
789
  return e;
751
- if (Array.isArray(e) || he(e)) {
752
- const t = e.map((r) => this.cleanStructure(r)).filter(d);
790
+ if (Array.isArray(e) || Ee(e)) {
791
+ const t = e.map((r) => this.cleanStructure(r)).filter(p);
753
792
  return t.length > 0 ? t : void 0;
754
793
  } else if (typeof e == "object") {
755
794
  const t = {};
@@ -763,15 +802,15 @@ class T {
763
802
  }
764
803
  }
765
804
  }
766
- class Xs {
805
+ class kn {
767
806
  static convert(e) {
768
- const t = re.decode(e), r = new Uint8Array(2 + t.length);
807
+ const t = ae.decode(e), r = new Uint8Array(2 + t.length);
769
808
  r[0] = 18, r[1] = 32, r.set(t, 2);
770
809
  const n = new Uint8Array(2 + r.length);
771
- return n[0] = 1, n[1] = 85, n.set(r, 2), "b" + new qt.Encoder({ type: "rfc4648", lc: !0 }).write(n).finalize().replace(/=/g, "");
810
+ return n[0] = 1, n[1] = 85, n.set(r, 2), "b" + new Br.Encoder({ type: "rfc4648", lc: !0 }).write(n).finalize().replace(/=/g, "");
772
811
  }
773
812
  }
774
- class E {
813
+ class w {
775
814
  /**
776
815
  * Transforms a node and all its child nodes using the provided transformer function
777
816
  * @param node - The node to transform
@@ -780,30 +819,30 @@ class E {
780
819
  */
781
820
  static transform(e, t) {
782
821
  const r = t(e.clone()), n = r.getType();
783
- n !== void 0 && r.setType(E.transform(n, t));
822
+ n !== void 0 && r.setType(w.transform(n, t));
784
823
  const i = r.getItemType();
785
824
  i !== void 0 && r.setItemType(
786
- E.transform(i, t)
825
+ w.transform(i, t)
787
826
  );
788
827
  const o = r.getKeyType();
789
828
  o !== void 0 && r.setKeyType(
790
- E.transform(o, t)
829
+ w.transform(o, t)
791
830
  );
792
831
  const l = r.getValueType();
793
832
  l !== void 0 && r.setValueType(
794
- E.transform(l, t)
833
+ w.transform(l, t)
795
834
  );
796
835
  const c = r.getItems();
797
836
  if (c !== void 0) {
798
837
  const y = c.map(
799
- (p) => E.transform(p, t)
838
+ (d) => w.transform(d, t)
800
839
  );
801
840
  r.setItems(y);
802
841
  }
803
842
  const u = r.getProperties();
804
843
  if (u !== void 0) {
805
844
  const y = Object.keys(u).reduce(
806
- (p, f) => (p[f] = E.transform(u[f], t), p),
845
+ (d, h) => (d[h] = w.transform(u[h], t), d),
807
846
  {}
808
847
  );
809
848
  r.setProperties(y);
@@ -811,14 +850,14 @@ class E {
811
850
  return r;
812
851
  }
813
852
  }
814
- const D = (s) => !!s && typeof s == "object" && !Array.isArray(s) && !(s instanceof a), C = (s) => s instanceof w || s instanceof P, Tr = (s) => s.replace(/~1/g, "/").replace(/~0/g, "~");
815
- function Q(s) {
853
+ const F = (s) => !!s && typeof s == "object" && !Array.isArray(s) && !(s instanceof a), O = (s) => s instanceof E || s instanceof S, Fr = (s) => s.replace(/~1/g, "/").replace(/~0/g, "~");
854
+ function ie(s) {
816
855
  if (s === "/") return [];
817
856
  if (!s.startsWith("/"))
818
857
  throw new Error(`Path must start with '/': ${s}`);
819
- return s.split("/").slice(1).map(Tr);
858
+ return s.split("/").slice(1).map(Fr);
820
859
  }
821
- function q(s) {
860
+ function se(s) {
822
861
  if (s === "-") return -1;
823
862
  const e = typeof s == "number" ? s : parseInt(s, 10);
824
863
  if (isNaN(e))
@@ -829,7 +868,7 @@ function q(s) {
829
868
  );
830
869
  return e;
831
870
  }
832
- function It(s, e, t, r = !0) {
871
+ function jt(s, e, t, r = !0) {
833
872
  switch (e) {
834
873
  case "name":
835
874
  return t ? r ? s.getName() ?? null : s : s.getName();
@@ -853,15 +892,15 @@ function It(s, e, t, r = !0) {
853
892
  return s.getItems();
854
893
  case "properties":
855
894
  return s.getProperties();
856
- case "contracts":
895
+ case C:
857
896
  return s.getContracts();
858
897
  default:
859
898
  return;
860
899
  }
861
900
  }
862
- function Qe(s, e, t = !0) {
901
+ function mt(s, e, t = !0) {
863
902
  if (s instanceof a) {
864
- const r = It(
903
+ const r = jt(
865
904
  s,
866
905
  e,
867
906
  !0,
@@ -879,7 +918,7 @@ function Qe(s, e, t = !0) {
879
918
  "blue",
880
919
  "items",
881
920
  "properties",
882
- "contracts"
921
+ C
883
922
  ].includes(e))
884
923
  return r;
885
924
  if (/^-?\d+$/.test(e) && e !== "-") {
@@ -891,12 +930,12 @@ function Qe(s, e, t = !0) {
891
930
  }
892
931
  if (Array.isArray(s)) {
893
932
  if (e === "-") return;
894
- const r = q(e);
933
+ const r = se(e);
895
934
  return r >= 0 && r < s.length ? s[r] : void 0;
896
935
  }
897
- if (D(s)) return s[e];
936
+ if (F(s)) return s[e];
898
937
  }
899
- function ee(s, e) {
938
+ function oe(s, e) {
900
939
  if (e.length === 0)
901
940
  return {
902
941
  parent: s,
@@ -905,15 +944,15 @@ function ee(s, e) {
905
944
  };
906
945
  let t = s;
907
946
  for (let n = 0; n < e.length - 1; ++n) {
908
- const i = e[n], o = Qe(t, i);
947
+ const i = e[n], o = mt(t, i);
909
948
  if (o === void 0)
910
949
  throw new Error(`Cannot resolve '/${e.slice(0, n + 1).join("/")}'`);
911
950
  t = o;
912
951
  }
913
952
  const r = e[e.length - 1];
914
953
  if (t instanceof a) {
915
- const n = Qe(t, r, !1);
916
- if ((typeof n != "object" || n === null || C(n)) && !(n instanceof a) && !Array.isArray(n) && ["name", "description", "value", "blueId"].includes(r))
954
+ const n = mt(t, r, !1);
955
+ if ((typeof n != "object" || n === null || O(n)) && !(n instanceof a) && !Array.isArray(n) && ["name", "description", "value", "blueId"].includes(r))
917
956
  return {
918
957
  parent: t,
919
958
  key: r,
@@ -922,12 +961,12 @@ function ee(s, e) {
922
961
  }
923
962
  return Array.isArray(t) && r === "-" ? { parent: t, key: "-" } : t instanceof a && t.getItems() && r === "-" ? { parent: t, key: "-" } : {
924
963
  parent: t,
925
- key: Array.isArray(t) ? q(r) : r
964
+ key: Array.isArray(t) ? se(r) : r
926
965
  };
927
966
  }
928
- function ke(s, e) {
967
+ function ct(s, e) {
929
968
  if (s instanceof a) {
930
- const t = e, r = It(s, t, !1);
969
+ const t = e, r = jt(s, t, !1);
931
970
  if (r !== void 0 || [
932
971
  "name",
933
972
  "description",
@@ -940,7 +979,7 @@ function ke(s, e) {
940
979
  "blue",
941
980
  "items",
942
981
  "properties",
943
- "contracts"
982
+ C
944
983
  ].includes(t))
945
984
  return r;
946
985
  if (typeof e == "number" || typeof e == "string" && /^\d+$/.test(e)) {
@@ -949,25 +988,25 @@ function ke(s, e) {
949
988
  }
950
989
  return s.getProperties()?.[t];
951
990
  }
952
- return Array.isArray(s) || D(s) ? s[e] : s;
991
+ return Array.isArray(s) || F(s) ? s[e] : s;
953
992
  }
954
- function N(s) {
993
+ function P(s) {
955
994
  if (s instanceof a) return s;
956
- if (s === null || typeof s == "string" || typeof s == "number" || typeof s == "boolean" || C(s))
995
+ if (s === null || typeof s == "string" || typeof s == "number" || typeof s == "boolean" || O(s))
957
996
  return g.deserialize(s);
958
- const e = Fe(s);
997
+ const e = Ze(s);
959
998
  return g.deserialize(e);
960
999
  }
961
- function Fe(s) {
1000
+ function Ze(s) {
962
1001
  if (s === void 0) return null;
963
1002
  if (s === null || typeof s != "object") return s;
964
- if (Array.isArray(s)) return s.map(Fe);
1003
+ if (Array.isArray(s)) return s.map(Ze);
965
1004
  const e = {};
966
1005
  for (const [t, r] of Object.entries(s))
967
- e[t] = Fe(r);
1006
+ e[t] = Ze(r);
968
1007
  return e;
969
1008
  }
970
- function Je(s, e, t) {
1009
+ function at(s, e, t) {
971
1010
  if (s instanceof a) {
972
1011
  const r = e;
973
1012
  switch (r) {
@@ -979,22 +1018,22 @@ function Je(s, e, t) {
979
1018
  return;
980
1019
  case "type":
981
1020
  s.setType(
982
- t instanceof a || typeof t == "string" || t === void 0 ? t : N(t)
1021
+ t instanceof a || typeof t == "string" || t === void 0 ? t : P(t)
983
1022
  );
984
1023
  return;
985
1024
  case "itemType":
986
1025
  s.setItemType(
987
- t instanceof a || typeof t == "string" || t === void 0 ? t : N(t)
1026
+ t instanceof a || typeof t == "string" || t === void 0 ? t : P(t)
988
1027
  );
989
1028
  return;
990
1029
  case "keyType":
991
1030
  s.setKeyType(
992
- t instanceof a || typeof t == "string" || t === void 0 ? t : N(t)
1031
+ t instanceof a || typeof t == "string" || t === void 0 ? t : P(t)
993
1032
  );
994
1033
  return;
995
1034
  case "valueType":
996
1035
  s.setValueType(
997
- t instanceof a || typeof t == "string" || t === void 0 ? t : N(t)
1036
+ t instanceof a || typeof t == "string" || t === void 0 ? t : P(t)
998
1037
  );
999
1038
  return;
1000
1039
  case "value": {
@@ -1007,7 +1046,7 @@ function Je(s, e, t) {
1007
1046
  return;
1008
1047
  case "blue":
1009
1048
  s.setBlue(
1010
- t instanceof a || t === void 0 ? t : N(t)
1049
+ t instanceof a || t === void 0 ? t : P(t)
1011
1050
  );
1012
1051
  return;
1013
1052
  case "items":
@@ -1016,7 +1055,7 @@ function Je(s, e, t) {
1016
1055
  case "properties":
1017
1056
  s.setProperties(t);
1018
1057
  return;
1019
- case "contracts":
1058
+ case C:
1020
1059
  s.setContracts(t);
1021
1060
  return;
1022
1061
  default: {
@@ -1024,14 +1063,14 @@ function Je(s, e, t) {
1024
1063
  const n = s.getProperties();
1025
1064
  n && r in n && delete n[r];
1026
1065
  } else
1027
- s.getProperties() || s.setProperties({}), s.addProperty(r, t instanceof a ? t : N(t));
1066
+ s.getProperties() || s.setProperties({}), s.addProperty(r, t instanceof a ? t : P(t));
1028
1067
  return;
1029
1068
  }
1030
1069
  }
1031
1070
  }
1032
- Array.isArray(s) ? s.splice(q(e), 1) : D(s) && (t === void 0 ? delete s[e] : s[e] = t);
1071
+ Array.isArray(s) ? s.splice(se(e), 1) : F(s) && (t === void 0 ? delete s[e] : s[e] = t);
1033
1072
  }
1034
- function vr(s, e, t, r) {
1073
+ function $r(s, e, t, r) {
1035
1074
  let n = -1;
1036
1075
  if (e !== "-" && (n = typeof e == "number" ? e : parseInt(e, 10), isNaN(n)))
1037
1076
  throw new Error(
@@ -1057,16 +1096,16 @@ function vr(s, e, t, r) {
1057
1096
  } else
1058
1097
  i.splice(n, 0, t);
1059
1098
  }
1060
- function Te(s, e, t, r) {
1099
+ function Ve(s, e, t, r) {
1061
1100
  if (Array.isArray(s)) {
1062
- const n = e === "-" ? s.length : q(e);
1101
+ const n = e === "-" ? s.length : se(e);
1063
1102
  if (!r && n > s.length)
1064
1103
  throw new Error(
1065
1104
  `ADD operation failed: Target array index '${n}' is greater than array length ${s.length}. Path involving key '${e}'.`
1066
1105
  );
1067
1106
  if (n < 0 && e !== "-")
1068
1107
  throw new Error(`Invalid negative array index: ${e}`);
1069
- const i = N(t);
1108
+ const i = P(t);
1070
1109
  if (r) {
1071
1110
  if (n >= 0 && n < s.length) s[n] = i;
1072
1111
  else if (n >= s.length) {
@@ -1079,18 +1118,18 @@ function Te(s, e, t, r) {
1079
1118
  return;
1080
1119
  }
1081
1120
  if (s instanceof a) {
1082
- e === "-" || typeof e == "number" && !isNaN(e) || typeof e == "string" && /^\d+$/.test(e) ? vr(s, e, N(t), r) : Je(s, e, t);
1121
+ e === "-" || typeof e == "number" && !isNaN(e) || typeof e == "string" && /^\d+$/.test(e) ? $r(s, e, P(t), r) : at(s, e, t);
1083
1122
  return;
1084
1123
  }
1085
- if (D(s)) {
1086
- s[e] = N(t);
1124
+ if (F(s)) {
1125
+ s[e] = P(t);
1087
1126
  return;
1088
1127
  }
1089
1128
  throw new Error(`Cannot insert into parent of type ${typeof s}`);
1090
1129
  }
1091
- function br(s, e) {
1130
+ function _r(s, e) {
1092
1131
  if (Array.isArray(s)) {
1093
- const t = q(e);
1132
+ const t = se(e);
1094
1133
  t === -1 && e === "-" ? s.length > 0 && s.pop() : t >= 0 && t < s.length && s.splice(t, 1);
1095
1134
  return;
1096
1135
  }
@@ -1098,127 +1137,127 @@ function br(s, e) {
1098
1137
  if (typeof e == "number" || typeof e == "string" && /^-?\d+$/.test(e)) {
1099
1138
  const t = s.getItems();
1100
1139
  if (t) {
1101
- const r = q(e);
1140
+ const r = se(e);
1102
1141
  r === -1 && e === "-" ? t.length > 0 && t.pop() : r >= 0 && r < t.length && t.splice(r, 1), t.length === 0 && s.setItems(void 0);
1103
1142
  return;
1104
1143
  }
1105
1144
  }
1106
- Je(s, e, void 0);
1107
- } else D(s) && delete s[e];
1145
+ at(s, e, void 0);
1146
+ } else F(s) && delete s[e];
1108
1147
  }
1109
- function Oe(s) {
1148
+ function He(s) {
1110
1149
  if (s instanceof a) return s.clone();
1111
1150
  if (Array.isArray(s))
1112
- return s.map((t) => Oe(t));
1113
- if (D(s)) {
1151
+ return s.map((t) => He(t));
1152
+ if (F(s)) {
1114
1153
  const e = {};
1115
1154
  return Object.keys(s).forEach((t) => {
1116
- e[t] = Oe(s[t]);
1155
+ e[t] = He(s[t]);
1117
1156
  }), e;
1118
1157
  }
1119
1158
  return s;
1120
1159
  }
1121
- function $(s, e) {
1122
- if (s === e || s instanceof a && (s.isInlineValue() || s.getValue() !== void 0) && $(s.getValue() ?? null, e) || e instanceof a && (e.isInlineValue() || e.getValue() !== void 0) && $(s, e.getValue() ?? null))
1160
+ function Y(s, e) {
1161
+ if (s === e || s instanceof a && (s.isInlineValue() || s.getValue() !== void 0) && Y(s.getValue() ?? null, e) || e instanceof a && (e.isInlineValue() || e.getValue() !== void 0) && Y(s, e.getValue() ?? null))
1123
1162
  return !0;
1124
- if (s instanceof a && e instanceof a || C(s) && C(e) || C(s) && typeof e == "number" || typeof s == "number" && C(e))
1163
+ if (s instanceof a && e instanceof a || O(s) && O(e) || O(s) && typeof e == "number" || typeof s == "number" && O(e))
1125
1164
  return s.toString() === e.toString();
1126
1165
  if (Array.isArray(s) && Array.isArray(e))
1127
- return s.length === e.length && s.every((t, r) => $(t, e[r]));
1128
- if (D(s) && D(e)) {
1166
+ return s.length === e.length && s.every((t, r) => Y(t, e[r]));
1167
+ if (F(s) && F(e)) {
1129
1168
  const t = Object.keys(s), r = Object.keys(e);
1130
- return t.length === r.length && t.every((n) => $(s[n], e[n]));
1169
+ return t.length === r.length && t.every((n) => Y(s[n], e[n]));
1131
1170
  }
1132
1171
  return !1;
1133
1172
  }
1134
- function Tt(s, e) {
1135
- const { parent: t, key: r } = ee(s, Q(e));
1136
- return ke(t, r);
1173
+ function Ut(s, e) {
1174
+ const { parent: t, key: r } = oe(s, ie(e));
1175
+ return ct(t, r);
1137
1176
  }
1138
- function vt(s, e, t) {
1139
- const r = Q(e);
1177
+ function kt(s, e, t) {
1178
+ const r = ie(e);
1140
1179
  if (r.length === 0 && e === "/") {
1141
- const o = N(t);
1180
+ const o = P(t);
1142
1181
  s.setValue(o.getValue() ?? null), o.getItems() ? s.setItems(o.getItems()) : s.setItems(void 0);
1143
1182
  return;
1144
1183
  }
1145
- const { parent: n, key: i } = ee(s, r);
1146
- Te(n, i, t, !0);
1184
+ const { parent: n, key: i } = oe(s, r);
1185
+ Ve(n, i, t, !0);
1147
1186
  }
1148
- function wr(s, e, t) {
1149
- const r = Q(e);
1187
+ function Lr(s, e, t) {
1188
+ const r = ie(e);
1150
1189
  if (r.length === 0 && e === "/") {
1151
1190
  if (s.getItems() && Array.isArray(t)) {
1152
- const o = N(t);
1191
+ const o = P(t);
1153
1192
  o.getItems() ? (s.setItems(o.getItems()), s.setValue(null)) : (s.setValue(o.getValue() ?? null), s.setItems(void 0));
1154
1193
  } else {
1155
- const o = N(t);
1194
+ const o = P(t);
1156
1195
  s.setValue(o.getValue() ?? null), o.getItems() && s.setItems(o.getItems());
1157
1196
  }
1158
1197
  return !0;
1159
1198
  }
1160
- const { parent: n, key: i } = ee(s, r);
1161
- return Te(n, i, t, !1), !0;
1199
+ const { parent: n, key: i } = oe(s, r);
1200
+ return Ve(n, i, t, !1), !0;
1162
1201
  }
1163
- function Br(s, e, t) {
1164
- const r = Q(e);
1202
+ function jr(s, e, t) {
1203
+ const r = ie(e);
1165
1204
  if (r.length === 0 && e === "/") {
1166
- const l = N(t);
1205
+ const l = P(t);
1167
1206
  return s.setValue(l.getValue() ?? null), l.getItems() ? s.setItems(l.getItems()) : s.setItems(void 0), !0;
1168
1207
  }
1169
- const { parent: n, key: i, actualTarget: o } = ee(s, r);
1208
+ const { parent: n, key: i, actualTarget: o } = oe(s, r);
1170
1209
  if (o !== void 0 && n instanceof a)
1171
- Je(n, i, t);
1210
+ at(n, i, t);
1172
1211
  else {
1173
- const l = ke(n, i), c = Array.isArray(n) || n instanceof a && n.getItems() && (typeof i == "number" || typeof i == "string" && /^\d+$/.test(i));
1212
+ const l = ct(n, i), c = Array.isArray(n) || n instanceof a && n.getItems() && (typeof i == "number" || typeof i == "string" && /^\d+$/.test(i));
1174
1213
  if (l === void 0) {
1175
1214
  if (c)
1176
1215
  throw new Error(
1177
1216
  `REPLACE failed: Target array index '${i.toString()}' is out of bounds or does not exist at path '${e}'.`
1178
1217
  );
1179
- Te(n, i, t, !0);
1218
+ Ve(n, i, t, !0);
1180
1219
  } else
1181
- Te(n, i, t, !0);
1220
+ Ve(n, i, t, !0);
1182
1221
  }
1183
1222
  return !0;
1184
1223
  }
1185
- function bt(s, e) {
1186
- const t = Q(e);
1224
+ function Kt(s, e) {
1225
+ const t = ie(e);
1187
1226
  if (t.length === 0 && e === "/")
1188
1227
  return s.setValue(null), s.setItems(void 0), s.setProperties(void 0), !0;
1189
- const { parent: r, key: n } = ee(s, t);
1190
- return br(r, n), !0;
1228
+ const { parent: r, key: n } = oe(s, t);
1229
+ return _r(r, n), !0;
1191
1230
  }
1192
- function Nr(s, e, t) {
1193
- const r = Oe(Tt(s, e));
1194
- return vt(s, t, r), !0;
1231
+ function Ur(s, e, t) {
1232
+ const r = He(Ut(s, e));
1233
+ return kt(s, t, r), !0;
1195
1234
  }
1196
- function Pr(s, e, t) {
1197
- const r = Q(e), { parent: n, key: i } = ee(s, r), o = ke(n, i);
1235
+ function kr(s, e, t) {
1236
+ const r = ie(e), { parent: n, key: i } = oe(s, r), o = ct(n, i);
1198
1237
  if (o === void 0)
1199
1238
  throw new Error(`MOVE failed: 'from' location '${e}' does not exist.`);
1200
- return bt(s, e) ? (vt(s, t, o), !0) : !1;
1239
+ return Kt(s, e) ? (kt(s, t, o), !0) : !1;
1201
1240
  }
1202
- function Er(s, e, t) {
1203
- const r = Tt(s, e);
1241
+ function Kr(s, e, t) {
1242
+ const r = Ut(s, e);
1204
1243
  let n = t;
1205
1244
  if (r instanceof a)
1206
- if ((t === null || typeof t == "string" || typeof t == "number" || typeof t == "boolean" || C(t)) && (r.isInlineValue() || r.getValue() !== void 0)) {
1207
- if (!$(r.getValue() ?? null, t))
1245
+ if ((t === null || typeof t == "string" || typeof t == "number" || typeof t == "boolean" || O(t)) && (r.isInlineValue() || r.getValue() !== void 0)) {
1246
+ if (!Y(r.getValue() ?? null, t))
1208
1247
  throw new Error(
1209
1248
  `TEST failed at '${e}': Expected ${JSON.stringify(
1210
1249
  t
1211
1250
  )}, got ${JSON.stringify(r.getValue() ?? null)}`
1212
1251
  );
1213
1252
  return !0;
1214
- } else typeof t == "object" && !(t instanceof a) && (n = N(t));
1215
- else if (C(r) && typeof t == "number")
1216
- r instanceof w ? n = new w(t.toString()) : r instanceof P && (n = new P(t.toString()));
1217
- else if ((r === null || typeof r == "string" || typeof r == "number" || typeof r == "boolean") && C(t)) {
1253
+ } else typeof t == "object" && !(t instanceof a) && (n = P(t));
1254
+ else if (O(r) && typeof t == "number")
1255
+ r instanceof E ? n = new E(t.toString()) : r instanceof S && (n = new S(t.toString()));
1256
+ else if ((r === null || typeof r == "string" || typeof r == "number" || typeof r == "boolean") && O(t)) {
1218
1257
  const i = t;
1219
- !$(r, i.toString()) && (typeof r == "number" && parseFloat(i.toString()));
1258
+ !Y(r, i.toString()) && (typeof r == "number" && parseFloat(i.toString()));
1220
1259
  }
1221
- if (!$(r, n)) {
1260
+ if (!Y(r, n)) {
1222
1261
  const i = r instanceof a ? r.toString() : JSON.stringify(r), o = n instanceof a ? n.toString() : JSON.stringify(n);
1223
1262
  throw new Error(
1224
1263
  `TEST failed at '${e}': Expected ${o}, got ${i}`
@@ -1226,93 +1265,93 @@ function Er(s, e, t) {
1226
1265
  }
1227
1266
  return !0;
1228
1267
  }
1229
- function Sr(s, e) {
1268
+ function Yr(s, e) {
1230
1269
  switch (e.op) {
1231
1270
  case "add":
1232
- return wr(s, e.path, e.val);
1271
+ return Lr(s, e.path, e.val);
1233
1272
  case "replace":
1234
- return Br(s, e.path, e.val);
1273
+ return jr(s, e.path, e.val);
1235
1274
  case "remove":
1236
- return bt(s, e.path);
1275
+ return Kt(s, e.path);
1237
1276
  case "copy":
1238
- return Nr(s, e.from, e.path);
1277
+ return Ur(s, e.from, e.path);
1239
1278
  case "move":
1240
- return Pr(s, e.from, e.path);
1279
+ return kr(s, e.from, e.path);
1241
1280
  case "test":
1242
- return Er(s, e.path, e.val);
1281
+ return Kr(s, e.path, e.val);
1243
1282
  }
1244
1283
  }
1245
- function Qs(s, e, t = !1) {
1284
+ function Kn(s, e, t = !1) {
1246
1285
  const r = t ? s : s.clone();
1247
- return Sr(r, e), r;
1286
+ return Yr(r, e), r;
1248
1287
  }
1249
- const Ae = Symbol.for("zod-schema-annotations");
1250
- function Ar() {
1288
+ const ke = Symbol.for("zod-schema-annotations");
1289
+ function zr() {
1251
1290
  if (typeof globalThis < "u") return globalThis;
1252
1291
  if (typeof global < "u") return global;
1253
1292
  if (typeof window < "u") return window;
1254
1293
  if (typeof self < "u") return self;
1255
1294
  throw new Error("Unable to locate global object");
1256
1295
  }
1257
- function wt() {
1258
- const s = Ar();
1259
- return Ae in s || (s[Ae] = /* @__PURE__ */ new WeakMap()), s[Ae];
1296
+ function Yt() {
1297
+ const s = zr();
1298
+ return ke in s || (s[ke] = /* @__PURE__ */ new WeakMap()), s[ke];
1260
1299
  }
1261
- function ce(s, e) {
1262
- const t = wt(), r = t.get(s) || {};
1300
+ function Ie(s, e) {
1301
+ const t = Yt(), r = t.get(s) || {};
1263
1302
  return t.set(s, { ...r, ...e }), s;
1264
1303
  }
1265
- const V = (s) => wt().get(s), Vr = (s) => (e) => {
1266
- const t = V(e);
1267
- return ce(e, {
1304
+ const R = (s) => Yt().get(s), Gr = (s) => (e) => {
1305
+ const t = R(e);
1306
+ return Ie(e, {
1268
1307
  ...t,
1269
1308
  blueDescription: s
1270
1309
  });
1271
- }, Cr = (s) => {
1272
- const e = V(s);
1273
- return d(e) && je(e.blueDescription) ? e.blueDescription : null;
1274
- }, en = (s) => Vr(s)(h.string().optional()), Mr = h.union([h.string(), h.boolean()]), Dr = (s) => (e) => {
1275
- const t = V(e);
1276
- return ce(e, {
1310
+ }, Jr = (s) => {
1311
+ const e = R(s);
1312
+ return p(e) && et(e.blueDescription) ? e.blueDescription : null;
1313
+ }, Yn = (s) => Gr(s)(f.string().optional()), Zr = f.union([f.string(), f.boolean()]), Hr = (s) => (e) => {
1314
+ const t = R(e);
1315
+ return Ie(e, {
1277
1316
  ...t,
1278
1317
  blueId: s
1279
1318
  });
1280
- }, Fr = (s) => {
1281
- const e = V(s), t = Mr.safeParse(e?.blueId);
1319
+ }, Wr = (s) => {
1320
+ const e = R(s), t = Zr.safeParse(e?.blueId);
1282
1321
  return t.success ? t.data : null;
1283
- }, tn = (s) => Dr(s ?? !0)(h.string()), Or = (s) => (e) => {
1284
- const t = V(e);
1285
- return ce(e, {
1322
+ }, zn = (s) => Hr(s ?? !0)(f.string()), Xr = (s) => (e) => {
1323
+ const t = R(e);
1324
+ return Ie(e, {
1286
1325
  ...t,
1287
1326
  blueName: s
1288
1327
  });
1289
- }, Rr = (s) => {
1290
- const e = V(s);
1291
- return d(e) && je(e.blueName) ? e.blueName : null;
1292
- }, rn = (s) => {
1293
- const e = h.string().optional();
1294
- return Or(s)(e);
1295
- }, $r = () => (s) => {
1296
- const e = V(s);
1297
- return ce(s, {
1328
+ }, qr = (s) => {
1329
+ const e = R(s);
1330
+ return p(e) && et(e.blueName) ? e.blueName : null;
1331
+ }, Gn = (s) => {
1332
+ const e = f.string().optional();
1333
+ return Xr(s)(e);
1334
+ }, Qr = () => (s) => {
1335
+ const e = R(s);
1336
+ return Ie(s, {
1298
1337
  ...e,
1299
1338
  blueNode: !0
1300
1339
  });
1301
- }, xr = (s) => {
1302
- const e = V(s);
1303
- return d(e) && d(e.blueNode) && e.blueNode === !0 ? e.blueNode : null;
1304
- }, Bt = (s) => !!xr(s), sn = () => {
1305
- const s = h.instanceof(a);
1306
- return $r()(s);
1307
- }, jr = h.object({
1308
- value: h.array(h.string()).optional(),
1309
- defaultValue: h.string().optional()
1310
- }), Lr = (s) => {
1311
- const e = V(s), t = jr.passthrough().safeParse(e?.typeBlueId);
1340
+ }, es = (s) => {
1341
+ const e = R(s);
1342
+ return p(e) && p(e.blueNode) && e.blueNode === !0 ? e.blueNode : null;
1343
+ }, zt = (s) => !!es(s), Jn = () => {
1344
+ const s = f.instanceof(a);
1345
+ return Qr()(s);
1346
+ }, ts = f.object({
1347
+ value: f.array(f.string()).optional(),
1348
+ defaultValue: f.string().optional()
1349
+ }), rs = (s) => {
1350
+ const e = R(s), t = ts.passthrough().safeParse(e?.typeBlueId);
1312
1351
  return t.success ? t.data : null;
1313
- }, nn = (s) => (e) => {
1314
- const t = V(e), r = typeof s == "string" ? { value: [s] } : s;
1315
- return ce(e, {
1352
+ }, Zn = (s) => (e) => {
1353
+ const t = R(e), r = typeof s == "string" ? { value: [s] } : s;
1354
+ return Ie(e, {
1316
1355
  ...t,
1317
1356
  typeBlueId: {
1318
1357
  ...t?.typeBlueId || {},
@@ -1320,32 +1359,32 @@ const V = (s) => wt().get(s), Vr = (s) => (e) => {
1320
1359
  }
1321
1360
  });
1322
1361
  };
1323
- class ne {
1362
+ class de {
1324
1363
  static resolveBlueId(e) {
1325
- const t = Lr(e);
1364
+ const t = rs(e);
1326
1365
  if (I(t))
1327
1366
  return null;
1328
1367
  const r = t.defaultValue;
1329
- if (d(r))
1368
+ if (p(r))
1330
1369
  return r;
1331
1370
  const n = t.value?.[0];
1332
- return d(n) ? n : ne.getRepositoryBlueId(t, e);
1371
+ return p(n) ? n : de.getRepositoryBlueId(t, e);
1333
1372
  }
1334
1373
  static getRepositoryBlueId(e, t) {
1335
1374
  throw new Error("Not implemented");
1336
1375
  }
1337
1376
  }
1338
- class A {
1377
+ class V {
1339
1378
  // TODO: Enhance to support schemas associated with multiple blueIds
1340
1379
  static isTypeOf(e, t, r) {
1341
- const n = ne.resolveBlueId(t), i = e.getType()?.getBlueId();
1380
+ const n = de.resolveBlueId(t), i = e.getType()?.getBlueId();
1342
1381
  if (I(n) || I(i))
1343
1382
  return !1;
1344
1383
  if (n === i)
1345
1384
  return !0;
1346
- if (r?.checkSchemaExtensions && d(r.typeSchemaResolver)) {
1385
+ if (r?.checkSchemaExtensions && p(r.typeSchemaResolver)) {
1347
1386
  const o = r.typeSchemaResolver.resolveSchema(e);
1348
- return A.checkSchemaExtension(o, t, {
1387
+ return V.checkSchemaExtension(o, t, {
1349
1388
  typeSchemaResolver: r.typeSchemaResolver
1350
1389
  });
1351
1390
  }
@@ -1355,31 +1394,31 @@ class A {
1355
1394
  * Checks if a schema extends a base schema.
1356
1395
  */
1357
1396
  static checkSchemaExtension(e, t, r) {
1358
- if (!d(e))
1397
+ if (!p(e))
1359
1398
  return !1;
1360
- const n = A.unwrapSchema(e), i = A.unwrapSchema(t);
1361
- return d(r?.typeSchemaResolver) ? r.typeSchemaResolver.isSchemaExtendedFrom(
1399
+ const n = V.unwrapSchema(e), i = V.unwrapSchema(t);
1400
+ return p(r?.typeSchemaResolver) ? r.typeSchemaResolver.isSchemaExtendedFrom(
1362
1401
  n,
1363
1402
  i
1364
1403
  ) : !1;
1365
1404
  }
1366
1405
  static isWrapperType(e) {
1367
- return e instanceof it || e instanceof ot || e instanceof lt || e instanceof ct || e instanceof fe || e instanceof ge;
1406
+ return e instanceof Nt || e instanceof Pt || e instanceof St || e instanceof At || e instanceof Ne || e instanceof Pe;
1368
1407
  }
1369
1408
  static unwrapSchema(e) {
1370
- return Bt(e) ? e : A.isWrapperType(e) ? e instanceof fe ? A.unwrapSchema(e.innerType()) : e instanceof ge ? A.unwrapSchema(e.schema) : A.unwrapSchema(e.unwrap()) : e;
1409
+ return zt(e) ? e : V.isWrapperType(e) ? e instanceof Ne ? V.unwrapSchema(e.innerType()) : e instanceof Pe ? V.unwrapSchema(e.schema) : V.unwrapSchema(e.unwrap()) : e;
1371
1410
  }
1372
1411
  }
1373
- function et(s, e) {
1412
+ function It(s, e) {
1374
1413
  const t = s.getType();
1375
1414
  if (t === void 0)
1376
1415
  return;
1377
1416
  const r = t.getBlueId();
1378
1417
  if (r !== void 0) {
1379
- if (le.includes(
1418
+ if (X.includes(
1380
1419
  r
1381
1420
  )) {
1382
- const i = gt[r];
1421
+ const i = xe[r];
1383
1422
  return new a().setBlueId(r).setName(i);
1384
1423
  }
1385
1424
  const n = e.fetchByBlueId(r);
@@ -1397,14 +1436,14 @@ function b(s, e, t) {
1397
1436
  const r = T.calculateBlueIdSync(s), n = T.calculateBlueIdSync(e);
1398
1437
  if (r === n)
1399
1438
  return !0;
1400
- if (r && le.includes(
1439
+ if (r && X.includes(
1401
1440
  r
1402
1441
  )) {
1403
1442
  let c = e;
1404
1443
  for (; c !== void 0; ) {
1405
1444
  if (T.calculateBlueIdSync(c) === r)
1406
1445
  return !0;
1407
- c = et(c, t);
1446
+ c = It(c, t);
1408
1447
  }
1409
1448
  return !1;
1410
1449
  }
@@ -1418,48 +1457,48 @@ function b(s, e, t) {
1418
1457
  for (; l !== void 0; ) {
1419
1458
  if (T.calculateBlueIdSync(l) === n)
1420
1459
  return !0;
1421
- l = et(l, t);
1460
+ l = It(l, t);
1422
1461
  }
1423
1462
  return !1;
1424
1463
  }
1425
- function Ur(s, e) {
1426
- return ft.some((t) => {
1464
+ function ss(s, e) {
1465
+ return ot.some((t) => {
1427
1466
  const r = new a().setBlueId(t);
1428
1467
  return b(s, r, e);
1429
1468
  });
1430
1469
  }
1431
- function _r(s, e) {
1470
+ function ns(s, e) {
1432
1471
  const t = new a().setBlueId(_);
1433
1472
  return b(s, t, e);
1434
1473
  }
1435
- function Kr(s, e) {
1436
- const t = new a().setBlueId(Y);
1474
+ function is(s, e) {
1475
+ const t = new a().setBlueId(j);
1437
1476
  return b(s, t, e);
1438
1477
  }
1439
- function Yr(s, e) {
1440
- const t = new a().setBlueId(K);
1478
+ function os(s, e) {
1479
+ const t = new a().setBlueId(L);
1441
1480
  return b(s, t, e);
1442
1481
  }
1443
- function Gr(s, e) {
1444
- const t = new a().setBlueId(G);
1482
+ function ls(s, e) {
1483
+ const t = new a().setBlueId(U);
1445
1484
  return b(s, t, e);
1446
1485
  }
1447
- function Nt(s, e) {
1448
- const t = new a().setBlueId(pt);
1486
+ function Gt(s, e) {
1487
+ const t = new a().setBlueId(nt);
1449
1488
  return b(s, t, e);
1450
1489
  }
1451
- function Pt(s, e) {
1452
- const t = new a().setBlueId(ht);
1490
+ function Jt(s, e) {
1491
+ const t = new a().setBlueId(it);
1453
1492
  return b(s, t, e);
1454
1493
  }
1455
- function zr(s, e) {
1456
- return Ge.some((t) => {
1494
+ function cs(s, e) {
1495
+ return Me.some((t) => {
1457
1496
  const r = new a().setName(t);
1458
1497
  return b(s, r, e);
1459
1498
  });
1460
1499
  }
1461
- function kr(s, e) {
1462
- for (const t of Ge) {
1500
+ function as(s, e) {
1501
+ for (const t of Me) {
1463
1502
  const r = new a().setName(t);
1464
1503
  if (b(s, r, e))
1465
1504
  return t;
@@ -1468,7 +1507,7 @@ function kr(s, e) {
1468
1507
  `Cannot determine the basic type for node of type "${s.getName() || "unknown"}".`
1469
1508
  );
1470
1509
  }
1471
- class Jr {
1510
+ class us {
1472
1511
  blueIdMap = /* @__PURE__ */ new Map();
1473
1512
  nodeProvider;
1474
1513
  constructor(e = [], t) {
@@ -1479,8 +1518,8 @@ class Jr {
1479
1518
  this.registerSchema(t);
1480
1519
  }
1481
1520
  registerSchema(e) {
1482
- const t = ne.resolveBlueId(e);
1483
- if (d(t)) {
1521
+ const t = de.resolveBlueId(e);
1522
+ if (p(t)) {
1484
1523
  if (this.blueIdMap.has(t))
1485
1524
  throw new Error(`Duplicate BlueId value: ${t}`);
1486
1525
  this.blueIdMap.set(t, e);
@@ -1501,7 +1540,7 @@ class Jr {
1501
1540
  return !1;
1502
1541
  if (r === n)
1503
1542
  return !0;
1504
- if (d(this.nodeProvider))
1543
+ if (p(this.nodeProvider))
1505
1544
  try {
1506
1545
  const i = new a().setBlueId(r), o = new a().setBlueId(n);
1507
1546
  if (b(i, o, this.nodeProvider))
@@ -1513,8 +1552,8 @@ class Jr {
1513
1552
  getBlueIdForSchema(e) {
1514
1553
  if (I(e))
1515
1554
  return null;
1516
- const t = ne.resolveBlueId(e);
1517
- if (d(t))
1555
+ const t = de.resolveBlueId(e);
1556
+ if (p(t))
1518
1557
  return t;
1519
1558
  for (const [r, n] of this.blueIdMap)
1520
1559
  if (n === e || n._def === e._def)
@@ -1523,13 +1562,13 @@ class Jr {
1523
1562
  }
1524
1563
  getEffectiveBlueId(e) {
1525
1564
  const t = e.getType();
1526
- return d(t) && d(t.getBlueId()) ? t.getBlueId() : d(t) ? T.calculateBlueIdSync(t) : null;
1565
+ return p(t) && p(t.getBlueId()) ? t.getBlueId() : p(t) ? T.calculateBlueIdSync(t) : null;
1527
1566
  }
1528
1567
  getBlueIdMap() {
1529
1568
  return new Map(this.blueIdMap);
1530
1569
  }
1531
1570
  }
1532
- const B = {
1571
+ const N = {
1533
1572
  NAME: "name",
1534
1573
  DESCRIPTION: "description",
1535
1574
  TYPE: "type",
@@ -1542,7 +1581,7 @@ const B = {
1542
1581
  BLUE: "blue",
1543
1582
  ITEMS: "items"
1544
1583
  };
1545
- class Ze {
1584
+ class ut {
1546
1585
  /**
1547
1586
  * Check if a node is empty (has no fields set)
1548
1587
  */
@@ -1553,13 +1592,13 @@ class Ze {
1553
1592
  * Check if a node has only a Blue ID
1554
1593
  */
1555
1594
  static hasBlueIdOnly(e) {
1556
- return this.hasFieldsAndMayHaveFields(e, /* @__PURE__ */ new Set([B.BLUE_ID]));
1595
+ return this.hasFieldsAndMayHaveFields(e, /* @__PURE__ */ new Set([N.BLUE_ID]));
1557
1596
  }
1558
1597
  /**
1559
1598
  * Check if a node has only items
1560
1599
  */
1561
1600
  static hasItemsOnly(e) {
1562
- return this.hasFieldsAndMayHaveFields(e, /* @__PURE__ */ new Set([B.ITEMS]));
1601
+ return this.hasFieldsAndMayHaveFields(e, /* @__PURE__ */ new Set([N.ITEMS]));
1563
1602
  }
1564
1603
  /**
1565
1604
  * Check if a node is a valid value node (has a value, no properties, no items)
@@ -1568,7 +1607,7 @@ class Ze {
1568
1607
  */
1569
1608
  static isValidValueNode(e) {
1570
1609
  const t = e.getValue(), r = e.getProperties(), n = e.getItems();
1571
- return d(t) && I(r) && I(n);
1610
+ return p(t) && I(r) && I(n);
1572
1611
  }
1573
1612
  /**
1574
1613
  * Create a text node
@@ -1580,21 +1619,21 @@ class Ze {
1580
1619
  * Create an integer node
1581
1620
  */
1582
1621
  static integerNode(e) {
1583
- const t = e instanceof w ? e : new w(e.toString());
1584
- return new a().setType(new a().setBlueId(Y)).setValue(t);
1622
+ const t = e instanceof E ? e : new E(e.toString());
1623
+ return new a().setType(new a().setBlueId(j)).setValue(t);
1585
1624
  }
1586
1625
  /**
1587
1626
  * Create a double node
1588
1627
  */
1589
1628
  static doubleNode(e) {
1590
- const t = e instanceof P ? e : new P(e.toString());
1591
- return new a().setType(new a().setBlueId(K)).setValue(t);
1629
+ const t = e instanceof S ? e : new S(e.toString());
1630
+ return new a().setType(new a().setBlueId(L)).setValue(t);
1592
1631
  }
1593
1632
  /**
1594
1633
  * Create a boolean node
1595
1634
  */
1596
1635
  static booleanNode(e) {
1597
- return new a().setType(new a().setBlueId(G)).setValue(e);
1636
+ return new a().setType(new a().setBlueId(U)).setValue(e);
1598
1637
  }
1599
1638
  /**
1600
1639
  * Check if a node has exactly the specified fields
@@ -1604,8 +1643,8 @@ class Ze {
1604
1643
  * @returns true if the node matches the field requirements
1605
1644
  */
1606
1645
  static hasFieldsAndMayHaveFields(e, t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set()) {
1607
- for (const n of Object.values(B)) {
1608
- const i = d(this.getFieldValue(e, n));
1646
+ for (const n of Object.values(N)) {
1647
+ const i = p(this.getFieldValue(e, n));
1609
1648
  if (t.has(n)) {
1610
1649
  if (!i) return !1;
1611
1650
  } else if (!r.has(n)) {
@@ -1619,39 +1658,39 @@ class Ze {
1619
1658
  */
1620
1659
  static getFieldValue(e, t) {
1621
1660
  switch (t) {
1622
- case B.NAME:
1661
+ case N.NAME:
1623
1662
  return e.getName();
1624
- case B.TYPE:
1663
+ case N.TYPE:
1625
1664
  return e.getType();
1626
- case B.VALUE:
1665
+ case N.VALUE:
1627
1666
  return e.getValue();
1628
- case B.DESCRIPTION:
1667
+ case N.DESCRIPTION:
1629
1668
  return e.getDescription();
1630
- case B.PROPERTIES:
1669
+ case N.PROPERTIES:
1631
1670
  return e.getProperties();
1632
- case B.BLUE:
1671
+ case N.BLUE:
1633
1672
  return e.getBlue();
1634
- case B.ITEMS:
1673
+ case N.ITEMS:
1635
1674
  return e.getItems();
1636
- case B.KEY_TYPE:
1675
+ case N.KEY_TYPE:
1637
1676
  return e.getKeyType();
1638
- case B.VALUE_TYPE:
1677
+ case N.VALUE_TYPE:
1639
1678
  return e.getValueType();
1640
- case B.ITEM_TYPE:
1679
+ case N.ITEM_TYPE:
1641
1680
  return e.getItemType();
1642
- case B.BLUE_ID:
1681
+ case N.BLUE_ID:
1643
1682
  return e.getBlueId();
1644
1683
  default:
1645
1684
  throw new Error(`Unknown field: ${t}`);
1646
1685
  }
1647
1686
  }
1648
1687
  }
1649
- class He {
1688
+ class dt {
1650
1689
  }
1651
- class te {
1690
+ class ce {
1652
1691
  static convert(e) {
1653
- const t = new Re();
1654
- return te.traverseNode(e, "", t), t.build();
1692
+ const t = new We();
1693
+ return ce.traverseNode(e, "", t), t.build();
1655
1694
  }
1656
1695
  static traverseNode(e, t, r) {
1657
1696
  if (!e)
@@ -1664,20 +1703,20 @@ class te {
1664
1703
  if (n)
1665
1704
  for (const [c, u] of Object.entries(n)) {
1666
1705
  const y = `${t}/${c}`;
1667
- te.traverseNode(u, y, r);
1706
+ ce.traverseNode(u, y, r);
1668
1707
  }
1669
1708
  if (i)
1670
1709
  for (let c = 0; c < i.length; c++) {
1671
1710
  const u = `${t}/${c}`;
1672
- te.traverseNode(i[c], u, r);
1711
+ ce.traverseNode(i[c], u, r);
1673
1712
  }
1674
1713
  }
1675
1714
  }
1676
- function tt(s, e) {
1715
+ function Tt(s, e) {
1677
1716
  const t = s.split(e), r = [...t].reverse().findIndex((i) => i !== ""), n = r === -1 ? 0 : t.length - r;
1678
1717
  return t.slice(0, n);
1679
1718
  }
1680
- class Be extends He {
1719
+ class $e extends dt {
1681
1720
  allowedPaths;
1682
1721
  maxDepth;
1683
1722
  currentPath = [];
@@ -1728,7 +1767,7 @@ class Be extends He {
1728
1767
  * @returns True if the path matches the allowed path pattern, false otherwise
1729
1768
  */
1730
1769
  matchesAllowedPath(e, t) {
1731
- const r = tt(e, "/"), n = tt(t, "/");
1770
+ const r = Tt(e, "/"), n = Tt(t, "/");
1732
1771
  if (n.length > r.length)
1733
1772
  return !1;
1734
1773
  for (let i = 1; i < n.length; i++)
@@ -1770,7 +1809,7 @@ class Be extends He {
1770
1809
  * @returns The path limits
1771
1810
  */
1772
1811
  static withMaxDepth(e) {
1773
- const t = new Re().setMaxDepth(e);
1812
+ const t = new We().setMaxDepth(e);
1774
1813
  for (let r = 1; r <= e; r++) {
1775
1814
  const n = "/" + Array(r).fill("*").join("/");
1776
1815
  t.addPath(n);
@@ -1783,17 +1822,17 @@ class Be extends He {
1783
1822
  * @returns The path limits
1784
1823
  */
1785
1824
  static withSinglePath(e) {
1786
- return new Re().addPath(e).build();
1825
+ return new We().addPath(e).build();
1787
1826
  }
1788
1827
  /**
1789
1828
  * Creates path limits by analyzing the structure of a node.
1790
1829
  * Leaf paths (no properties and no items) are added as allowed paths.
1791
1830
  */
1792
1831
  static fromNode(e) {
1793
- return te.convert(e);
1832
+ return ce.convert(e);
1794
1833
  }
1795
1834
  }
1796
- class Re {
1835
+ class We {
1797
1836
  allowedPaths = /* @__PURE__ */ new Set();
1798
1837
  maxDepth = Number.MAX_SAFE_INTEGER;
1799
1838
  /**
@@ -1817,10 +1856,10 @@ class Re {
1817
1856
  * @returns The built PathLimits
1818
1857
  */
1819
1858
  build() {
1820
- return new Be(this.allowedPaths, this.maxDepth);
1859
+ return new $e(this.allowedPaths, this.maxDepth);
1821
1860
  }
1822
1861
  }
1823
- class Zr extends He {
1862
+ class ds extends dt {
1824
1863
  /**
1825
1864
  * Determines if a path segment should be extended - always returns true
1826
1865
  * @returns Always true
@@ -1846,7 +1885,7 @@ class Zr extends He {
1846
1885
  exitPathSegment() {
1847
1886
  }
1848
1887
  }
1849
- class Ne extends He {
1888
+ class _e extends dt {
1850
1889
  limits;
1851
1890
  /**
1852
1891
  * Creates a composite limits with the specified limit strategies
@@ -1903,20 +1942,20 @@ class Ne extends He {
1903
1942
  * @returns A new CompositeLimits instance
1904
1943
  */
1905
1944
  static of(...e) {
1906
- return new Ne(e);
1945
+ return new _e(e);
1907
1946
  }
1908
1947
  }
1909
- const R = new Zr();
1910
- class Hr {
1948
+ const K = new ds();
1949
+ class ps {
1911
1950
  blue;
1912
1951
  constructor(e) {
1913
1952
  this.blue = e;
1914
1953
  }
1915
- matchesType(e, t, r = R) {
1954
+ matchesType(e, t, r = K) {
1916
1955
  const n = t.getType();
1917
1956
  if (this.matchesImplicitStructure(e, n))
1918
1957
  return !0;
1919
- const i = Be.fromNode(t), o = Ne.of(r, i), l = this.extendAndResolve(e, o), c = this.blue.resolve(t, o);
1958
+ const i = $e.fromNode(t), o = _e.of(r, i), l = this.extendAndResolve(e, o), c = this.blue.resolve(t, o);
1920
1959
  return this.verifyMatch(l, t, o) && this.recursiveValueComparison(l, c);
1921
1960
  }
1922
1961
  /**
@@ -1946,8 +1985,8 @@ class Hr {
1946
1985
  let c = e.getProperties();
1947
1986
  c || (c = {}, e.setProperties(c));
1948
1987
  for (const [u, y] of Object.entries(i)) {
1949
- const p = c[u];
1950
- p === void 0 ? c[u] = y.clone() : this.restoreMissingStructure(p, y);
1988
+ const d = c[u];
1989
+ d === void 0 ? c[u] = y.clone() : this.restoreMissingStructure(d, y);
1951
1990
  }
1952
1991
  }
1953
1992
  const o = t.getBlueId();
@@ -1973,9 +2012,9 @@ class Hr {
1973
2012
  r
1974
2013
  );
1975
2014
  if (r && !n) {
1976
- const p = e.getType();
1977
- if (!p || !b(
1978
- p,
2015
+ const d = e.getType();
2016
+ if (!d || !b(
2017
+ d,
1979
2018
  r,
1980
2019
  this.blue.getNodeProvider()
1981
2020
  ))
@@ -1983,56 +2022,56 @@ class Hr {
1983
2022
  }
1984
2023
  const i = t.getBlueId();
1985
2024
  if (!n && i !== void 0) {
1986
- const p = e.getBlueId(), f = e.getType()?.getBlueId();
1987
- if (p !== void 0) {
1988
- if (i !== p)
2025
+ const d = e.getBlueId(), h = e.getType()?.getBlueId();
2026
+ if (d !== void 0) {
2027
+ if (i !== d)
1989
2028
  return !1;
1990
- } else if (f === void 0 || i !== f)
2029
+ } else if (h === void 0 || i !== h)
1991
2030
  return !1;
1992
2031
  }
1993
2032
  const o = t.getValue();
1994
2033
  if (o !== void 0) {
1995
- const p = e.getValue();
1996
- if (p === void 0)
2034
+ const d = e.getValue();
2035
+ if (d === void 0)
1997
2036
  return !1;
1998
- if (S(p) && S(o)) {
1999
- if (!p.eq(o))
2037
+ if (A(d) && A(o)) {
2038
+ if (!d.eq(o))
2000
2039
  return !1;
2001
- } else if (p !== o)
2040
+ } else if (d !== o)
2002
2041
  return !1;
2003
2042
  }
2004
2043
  const l = t.getItems();
2005
2044
  if (l !== void 0) {
2006
- const p = e.getItems() ?? [];
2007
- for (let f = 0; f < l.length; f++)
2008
- if (f < p.length) {
2009
- if (!this.recursiveValueComparison(p[f], l[f]))
2045
+ const d = e.getItems() ?? [];
2046
+ for (let h = 0; h < l.length; h++)
2047
+ if (h < d.length) {
2048
+ if (!this.recursiveValueComparison(d[h], l[h]))
2010
2049
  return !1;
2011
- } else if (this.hasValueInNestedStructure(l[f]))
2050
+ } else if (this.hasValueInNestedStructure(l[h]))
2012
2051
  return !1;
2013
2052
  }
2014
2053
  const c = t.getItemType();
2015
2054
  if (c !== void 0) {
2016
- const p = e.getItems() ?? [];
2017
- for (const f of p)
2018
- if (!this.recursiveValueComparison(f, c))
2055
+ const d = e.getItems() ?? [];
2056
+ for (const h of d)
2057
+ if (!this.recursiveValueComparison(h, c))
2019
2058
  return !1;
2020
2059
  }
2021
2060
  const u = t.getProperties();
2022
2061
  if (u !== void 0) {
2023
- const p = e.getProperties() ?? {};
2024
- for (const [f, v] of Object.entries(u))
2025
- if (f in p) {
2026
- if (!this.recursiveValueComparison(p[f], v))
2062
+ const d = e.getProperties() ?? {};
2063
+ for (const [h, v] of Object.entries(u))
2064
+ if (h in d) {
2065
+ if (!this.recursiveValueComparison(d[h], v))
2027
2066
  return !1;
2028
2067
  } else if (this.hasValueInNestedStructure(v))
2029
2068
  return !1;
2030
2069
  }
2031
2070
  const y = t.getValueType();
2032
2071
  if (y !== void 0) {
2033
- const p = Object.values(e.getProperties() ?? {});
2034
- for (const f of p)
2035
- if (!this.recursiveValueComparison(f, y))
2072
+ const d = Object.values(e.getProperties() ?? {});
2073
+ for (const h of d)
2074
+ if (!this.recursiveValueComparison(h, y))
2036
2075
  return !1;
2037
2076
  }
2038
2077
  return !0;
@@ -2059,7 +2098,7 @@ class Hr {
2059
2098
  * shape of the requested core list or dictionary type.
2060
2099
  */
2061
2100
  matchesImplicitStructure(e, t) {
2062
- return t === void 0 || e.getType() !== void 0 ? !1 : Nt(t, this.blue.getNodeProvider()) ? this.isImplicitListStructure(e) : Pt(t, this.blue.getNodeProvider()) ? this.isImplicitDictionaryStructure(e) : !1;
2101
+ return t === void 0 || e.getType() !== void 0 ? !1 : Gt(t, this.blue.getNodeProvider()) ? this.isImplicitListStructure(e) : Jt(t, this.blue.getNodeProvider()) ? this.isImplicitDictionaryStructure(e) : !1;
2063
2102
  }
2064
2103
  isImplicitListStructure(e) {
2065
2104
  return e.getItems() !== void 0 && e.getValue() === void 0;
@@ -2068,75 +2107,75 @@ class Hr {
2068
2107
  return e.getProperties() !== void 0 && e.getValue() === void 0;
2069
2108
  }
2070
2109
  }
2071
- const Wr = (s) => s instanceof it || s instanceof ot || s instanceof lt || s instanceof ct || s instanceof fe || s instanceof ge, qr = (s) => s instanceof J || s instanceof Z || s instanceof ue || s instanceof de;
2072
- class Et {
2110
+ const fs = (s) => s instanceof Nt || s instanceof Pt || s instanceof St || s instanceof At || s instanceof Ne || s instanceof Pe, hs = (s) => s instanceof ee || s instanceof te || s instanceof Be || s instanceof be;
2111
+ class Zt {
2073
2112
  static convertValue(e, t) {
2074
2113
  const r = e.getType()?.getBlueId(), n = e.getValue();
2075
- return I(n) ? qr(t) && Ze.isValidValueNode(e) ? this.getDefaultPrimitiveValue(t) : n : _ === r ? this.convertFromString(String(n), t) : K === r || n instanceof P ? this.convertFromBigDecimal(
2076
- new P(n?.toString()),
2114
+ return I(n) ? hs(t) && ut.isValidValueNode(e) ? this.getDefaultPrimitiveValue(t) : n : _ === r ? this.convertFromString(String(n), t) : L === r || n instanceof S ? this.convertFromBigDecimal(
2115
+ new S(n?.toString()),
2077
2116
  t
2078
- ) : Y === r || n instanceof w ? this.convertFromBigInteger(
2079
- new w(n?.toString()),
2117
+ ) : j === r || n instanceof E ? this.convertFromBigInteger(
2118
+ new E(n?.toString()),
2080
2119
  t
2081
- ) : G === r || typeof n == "boolean" ? this.convertFromBoolean(!!n, t) : this.convertFromString(String(n), t);
2120
+ ) : U === r || typeof n == "boolean" ? this.convertFromBoolean(!!n, t) : this.convertFromString(String(n), t);
2082
2121
  }
2083
2122
  static convertFromString(e, t) {
2084
- if (!t || t instanceof J || t instanceof Kt || t instanceof Yt)
2123
+ if (!t || t instanceof ee || t instanceof ar || t instanceof ur)
2085
2124
  return e;
2086
- if (t instanceof Z)
2125
+ if (t instanceof te)
2087
2126
  return Number(e);
2088
- if (t instanceof ue)
2127
+ if (t instanceof Be)
2089
2128
  return e.toLowerCase() === "true";
2090
- if (t instanceof de)
2129
+ if (t instanceof be)
2091
2130
  return BigInt(e);
2092
2131
  throw new Error(`Cannot convert String to ${t._def.typeName}`);
2093
2132
  }
2094
2133
  static convertFromBigDecimal(e, t) {
2095
- if (t instanceof Z)
2134
+ if (t instanceof te)
2096
2135
  return e.toNumber();
2097
- if (t instanceof J)
2136
+ if (t instanceof ee)
2098
2137
  return e.toString();
2099
2138
  throw new Error(`Cannot convert Number to ${t._def.typeName}`);
2100
2139
  }
2101
2140
  static convertFromBigInteger(e, t) {
2102
- if (t instanceof Z)
2141
+ if (t instanceof te)
2103
2142
  return e.toNumber();
2104
- if (t instanceof de)
2143
+ if (t instanceof be)
2105
2144
  return BigInt(e.toString());
2106
- if (t instanceof J)
2145
+ if (t instanceof ee)
2107
2146
  return e.toString();
2108
2147
  throw new Error(`Cannot convert Number to ${t._def.typeName}`);
2109
2148
  }
2110
2149
  static convertFromBoolean(e, t) {
2111
- if (!t || t instanceof ue)
2150
+ if (!t || t instanceof Be)
2112
2151
  return e;
2113
- if (t instanceof J)
2152
+ if (t instanceof ee)
2114
2153
  return e.toString();
2115
- if (t instanceof Z)
2154
+ if (t instanceof te)
2116
2155
  return Number(e);
2117
- if (t instanceof de)
2156
+ if (t instanceof be)
2118
2157
  return BigInt(e);
2119
2158
  throw new Error(`Cannot convert Boolean to ${t._def.typeName}`);
2120
2159
  }
2121
2160
  static getDefaultPrimitiveValue(e) {
2122
2161
  if (!e) return null;
2123
- if (e instanceof Z)
2162
+ if (e instanceof te)
2124
2163
  return 0;
2125
- if (e instanceof ue)
2164
+ if (e instanceof Be)
2126
2165
  return !1;
2127
- if (e instanceof J)
2166
+ if (e instanceof ee)
2128
2167
  return "";
2129
2168
  throw new Error(
2130
2169
  `Unsupported primitive type: ${e._def.typeName}`
2131
2170
  );
2132
2171
  }
2133
2172
  }
2134
- class Xr {
2173
+ class ys {
2135
2174
  convert(e, t) {
2136
- return Et.convertValue(e, t);
2175
+ return Zt.convertValue(e, t);
2137
2176
  }
2138
2177
  }
2139
- class Qr {
2178
+ class gs {
2140
2179
  constructor(e) {
2141
2180
  this.nodeToObjectConverter = e;
2142
2181
  }
@@ -2144,27 +2183,27 @@ class Qr {
2144
2183
  return this.convertFields(e, t);
2145
2184
  }
2146
2185
  convertFields(e, t) {
2147
- if (t instanceof Gt) {
2186
+ if (t instanceof dr) {
2148
2187
  const r = t._def.left, n = t._def.right, i = this.convert(e, r), o = this.convert(e, n);
2149
2188
  return { ...i, ...o };
2150
2189
  }
2151
- if (t instanceof zt)
2190
+ if (t instanceof pr)
2152
2191
  throw new Error("Union not supported");
2153
- if (t instanceof kt)
2192
+ if (t instanceof fr)
2154
2193
  return Object.keys(t.shape).reduce(
2155
2194
  (n, i) => {
2156
- const o = e.getProperties(), l = t.shape[i], c = Fr(l);
2157
- if (d(c)) {
2158
- const v = je(c) ? c : i, O = o?.[v], z = O ? T.calculateBlueIdSync(O) : void 0;
2159
- return n[i] = z, n;
2195
+ const o = e.getProperties(), l = t.shape[i], c = Wr(l);
2196
+ if (p(c)) {
2197
+ const v = et(c) ? c : i, k = o?.[v], q = k ? T.calculateBlueIdSync(k) : void 0;
2198
+ return n[i] = q, n;
2160
2199
  }
2161
- const u = Rr(l);
2162
- if (d(u)) {
2200
+ const u = qr(l);
2201
+ if (p(u)) {
2163
2202
  const v = o?.[u];
2164
2203
  return n[i] = v?.getName(), n;
2165
2204
  }
2166
- const y = Cr(l);
2167
- if (d(y)) {
2205
+ const y = Jr(l);
2206
+ if (p(y)) {
2168
2207
  const v = o?.[y];
2169
2208
  return n[i] = v?.getDescription(), n;
2170
2209
  }
@@ -2176,21 +2215,21 @@ class Qr {
2176
2215
  const v = e.getDescription();
2177
2216
  return n[i] = v, n;
2178
2217
  }
2179
- const p = o?.[i];
2180
- if (I(p))
2218
+ const d = o?.[i];
2219
+ if (I(d))
2181
2220
  return n;
2182
- const f = this.nodeToObjectConverter.convert(
2183
- p,
2221
+ const h = this.nodeToObjectConverter.convert(
2222
+ d,
2184
2223
  l
2185
2224
  );
2186
- return n[i] = f, n;
2225
+ return n[i] = h, n;
2187
2226
  },
2188
2227
  {}
2189
2228
  );
2190
2229
  throw new Error("Unknown schema type, " + t._def.typeName);
2191
2230
  }
2192
2231
  }
2193
- class es {
2232
+ class ms {
2194
2233
  constructor(e) {
2195
2234
  this.nodeToObjectConverter = e;
2196
2235
  }
@@ -2204,7 +2243,7 @@ class es {
2204
2243
  );
2205
2244
  }
2206
2245
  }
2207
- class ts {
2246
+ class Is {
2208
2247
  constructor(e) {
2209
2248
  this.nodeToObjectConverter = e;
2210
2249
  }
@@ -2218,35 +2257,35 @@ class ts {
2218
2257
  return new Set(i);
2219
2258
  }
2220
2259
  }
2221
- class rs {
2260
+ class Ts {
2222
2261
  constructor(e) {
2223
2262
  this.nodeToObjectConverter = e;
2224
2263
  }
2225
2264
  convert(e, t) {
2226
2265
  const r = t.keySchema, n = t.valueSchema, i = /* @__PURE__ */ new Map(), o = e.getName();
2227
- d(o) && i.set(H, o);
2266
+ p(o) && i.set(G, o);
2228
2267
  const l = e.getDescription();
2229
- d(l) && i.set(W, l);
2268
+ p(l) && i.set(J, l);
2230
2269
  const c = e.getProperties();
2231
- return d(c) && Object.entries(c).forEach(([u, y]) => {
2232
- const p = new a().setValue(u);
2233
- p.setType(new a().setBlueId(_));
2234
- const f = Et.convertValue(p, r), v = this.nodeToObjectConverter.convert(y, n);
2235
- i.set(f, v);
2236
- }), t instanceof Jt ? Object.fromEntries(i) : i;
2270
+ return p(c) && Object.entries(c).forEach(([u, y]) => {
2271
+ const d = new a().setValue(u);
2272
+ d.setType(new a().setBlueId(_));
2273
+ const h = Zt.convertValue(d, r), v = this.nodeToObjectConverter.convert(y, n);
2274
+ i.set(h, v);
2275
+ }), t instanceof hr ? Object.fromEntries(i) : i;
2237
2276
  }
2238
2277
  }
2239
- class ss {
2278
+ class vs {
2240
2279
  convert(e) {
2241
2280
  return m.get(e);
2242
2281
  }
2243
2282
  }
2244
- class ns {
2283
+ class Bs {
2245
2284
  convert(e) {
2246
2285
  return m.get(e);
2247
2286
  }
2248
2287
  }
2249
- class is {
2288
+ class bs {
2250
2289
  constructor(e) {
2251
2290
  this.nodeToObjectConverter = e;
2252
2291
  }
@@ -2260,70 +2299,70 @@ class is {
2260
2299
  );
2261
2300
  }
2262
2301
  }
2263
- const os = h.union([
2264
- h.literal("ZodString"),
2265
- h.literal("ZodNumber"),
2266
- h.literal("ZodBoolean"),
2267
- h.literal("ZodBigInt"),
2268
- h.literal("ZodArray"),
2269
- h.literal("ZodSet"),
2270
- h.literal("ZodMap"),
2271
- h.literal("ZodRecord"),
2272
- h.literal("ZodObject"),
2273
- h.literal("ZodEnum"),
2274
- h.literal("ZodNativeEnum"),
2275
- h.literal("ZodUnknown"),
2276
- h.literal("ZodAny"),
2277
- h.literal("ZodTuple")
2302
+ const ws = f.union([
2303
+ f.literal("ZodString"),
2304
+ f.literal("ZodNumber"),
2305
+ f.literal("ZodBoolean"),
2306
+ f.literal("ZodBigInt"),
2307
+ f.literal("ZodArray"),
2308
+ f.literal("ZodSet"),
2309
+ f.literal("ZodMap"),
2310
+ f.literal("ZodRecord"),
2311
+ f.literal("ZodObject"),
2312
+ f.literal("ZodEnum"),
2313
+ f.literal("ZodNativeEnum"),
2314
+ f.literal("ZodUnknown"),
2315
+ f.literal("ZodAny"),
2316
+ f.literal("ZodTuple")
2278
2317
  ]);
2279
- class ls {
2318
+ class Es {
2280
2319
  constructor(e) {
2281
- this.nodeToObjectConverter = e, this.registerConverters(), this.complexObjectConverter = new Qr(
2320
+ this.nodeToObjectConverter = e, this.registerConverters(), this.complexObjectConverter = new gs(
2282
2321
  this.nodeToObjectConverter
2283
2322
  );
2284
2323
  }
2285
2324
  converters = /* @__PURE__ */ new Map();
2286
2325
  complexObjectConverter;
2287
2326
  registerConverters() {
2288
- const e = new Xr(), t = new es(this.nodeToObjectConverter), r = new is(this.nodeToObjectConverter), n = new ts(this.nodeToObjectConverter), i = new rs(this.nodeToObjectConverter);
2289
- this.converters.set("ZodString", e), this.converters.set("ZodNumber", e), this.converters.set("ZodBoolean", e), this.converters.set("ZodBigInt", e), this.converters.set("ZodEnum", e), this.converters.set("ZodNativeEnum", e), this.converters.set("ZodUnknown", new ss()), this.converters.set("ZodAny", new ns()), this.converters.set("ZodArray", t), this.converters.set("ZodTuple", r), this.converters.set("ZodSet", n), this.converters.set("ZodMap", i), this.converters.set("ZodRecord", i), this.converters.set("ZodObject", this.complexObjectConverter);
2327
+ const e = new ys(), t = new ms(this.nodeToObjectConverter), r = new bs(this.nodeToObjectConverter), n = new Is(this.nodeToObjectConverter), i = new Ts(this.nodeToObjectConverter);
2328
+ this.converters.set("ZodString", e), this.converters.set("ZodNumber", e), this.converters.set("ZodBoolean", e), this.converters.set("ZodBigInt", e), this.converters.set("ZodEnum", e), this.converters.set("ZodNativeEnum", e), this.converters.set("ZodUnknown", new vs()), this.converters.set("ZodAny", new Bs()), this.converters.set("ZodArray", t), this.converters.set("ZodTuple", r), this.converters.set("ZodSet", n), this.converters.set("ZodMap", i), this.converters.set("ZodRecord", i), this.converters.set("ZodObject", this.complexObjectConverter);
2290
2329
  }
2291
2330
  getConverter(e) {
2292
2331
  const t = this.getSchemaTypeName(e);
2293
2332
  return this.converters.get(t) ?? this.complexObjectConverter;
2294
2333
  }
2295
2334
  getSchemaTypeName(e) {
2296
- if (Wr(e))
2297
- return e instanceof fe ? this.getSchemaTypeName(e.innerType()) : e instanceof ge ? this.getSchemaTypeName(e.schema) : this.getSchemaTypeName(e.unwrap());
2335
+ if (fs(e))
2336
+ return e instanceof Ne ? this.getSchemaTypeName(e.innerType()) : e instanceof Pe ? this.getSchemaTypeName(e.schema) : this.getSchemaTypeName(e.unwrap());
2298
2337
  const t = e._def.typeName;
2299
2338
  try {
2300
- return os.parse(t);
2339
+ return ws.parse(t);
2301
2340
  } catch {
2302
2341
  throw new Error(`Schema type name ${t} is not supported`);
2303
2342
  }
2304
2343
  }
2305
2344
  }
2306
- class cs {
2345
+ class Ns {
2307
2346
  constructor(e) {
2308
- this.typeSchemaResolver = e, this.converterFactory = new ls(this);
2347
+ this.typeSchemaResolver = e, this.converterFactory = new Es(this);
2309
2348
  }
2310
2349
  converterFactory;
2311
2350
  convert(e, t) {
2312
- const r = this.typeSchemaResolver?.resolveSchema(e), n = A.unwrapSchema(t);
2313
- if (Bt(n))
2351
+ const r = this.typeSchemaResolver?.resolveSchema(e), n = V.unwrapSchema(t);
2352
+ if (zt(n))
2314
2353
  return e;
2315
2354
  let i = n;
2316
- return A.checkSchemaExtension(
2355
+ return V.checkSchemaExtension(
2317
2356
  r,
2318
2357
  n,
2319
2358
  { typeSchemaResolver: this.typeSchemaResolver }
2320
- ) && d(r) && (i = r), this.convertWithType(e, i);
2359
+ ) && p(r) && (i = r), this.convertWithType(e, i);
2321
2360
  }
2322
2361
  convertWithType(e, t) {
2323
2362
  return this.converterFactory.getConverter(t).convert(e, t);
2324
2363
  }
2325
2364
  }
2326
- class St {
2365
+ class Ht {
2327
2366
  reverse(e) {
2328
2367
  const t = new a();
2329
2368
  return this.reverseNode(t, e, e.getType()), t;
@@ -2332,16 +2371,16 @@ class St {
2332
2371
  this.isIdenticalToType(t, r) || (this.reverseBasicProperties(e, t, r), this.reverseTypeReferences(e, t, r), this.reverseItems(e, t, r), this.reverseProperties(e, t, r));
2333
2372
  }
2334
2373
  isIdenticalToType(e, t) {
2335
- return d(e.getBlueId()) && d(t?.getBlueId()) && e.getBlueId() === t.getBlueId();
2374
+ return p(e.getBlueId()) && p(t?.getBlueId()) && e.getBlueId() === t.getBlueId();
2336
2375
  }
2337
2376
  reverseBasicProperties(e, t, r) {
2338
2377
  const n = t.getValue();
2339
- d(n) && (I(r) || I(r.getValue())) && e.setValue(n), d(t.getName()) && (I(r) || t.getName() !== r.getName()) && e.setName(t.getName()), d(t.getDescription()) && (I(r) || t.getDescription() !== r.getDescription()) && e.setDescription(t.getDescription()), d(t.getBlueId()) && (I(r) || t.getBlueId() !== r.getBlueId()) && e.setBlueId(t.getBlueId());
2378
+ p(n) && (I(r) || I(r.getValue())) && e.setValue(n), p(t.getName()) && (I(r) || t.getName() !== r.getName()) && e.setName(t.getName()), p(t.getDescription()) && (I(r) || t.getDescription() !== r.getDescription()) && e.setDescription(t.getDescription()), p(t.getBlueId()) && (I(r) || t.getBlueId() !== r.getBlueId()) && e.setBlueId(t.getBlueId());
2340
2379
  }
2341
2380
  reverseTypeReferences(e, t, r) {
2342
2381
  const n = (i, o) => {
2343
2382
  const l = i(t), c = r ? i(r) : void 0, u = l?.getBlueId();
2344
- d(u) && (I(c?.getBlueId()) || u !== c.getBlueId()) && o(e, new a().setBlueId(u));
2383
+ p(u) && (I(c?.getBlueId()) || u !== c.getBlueId()) && o(e, new a().setBlueId(u));
2345
2384
  };
2346
2385
  n(
2347
2386
  (i) => i.getType(),
@@ -2362,7 +2401,7 @@ class St {
2362
2401
  if (I(n))
2363
2402
  return;
2364
2403
  const i = r?.getItems(), o = [];
2365
- if (d(i) && i.length > 0) {
2404
+ if (p(i) && i.length > 0) {
2366
2405
  const c = T.calculateBlueIdSync(i);
2367
2406
  o.push(new a().setBlueId(c));
2368
2407
  }
@@ -2384,7 +2423,7 @@ class St {
2384
2423
  t,
2385
2424
  r
2386
2425
  ), u = new a();
2387
- this.reverseNode(u, l, c), Ze.isEmptyNode(u) || (i[o] = u);
2426
+ this.reverseNode(u, l, c), ut.isEmptyNode(u) || (i[o] = u);
2388
2427
  }
2389
2428
  Object.keys(i).length > 0 && e.setProperties(i);
2390
2429
  }
@@ -2404,27 +2443,27 @@ class St {
2404
2443
  */
2405
2444
  mergeNodes(e, t) {
2406
2445
  const r = e.clone(), n = t.getValue();
2407
- d(n) && r.setValue(n);
2446
+ p(n) && r.setValue(n);
2408
2447
  const i = t.getType();
2409
- d(i) && r.setType(i.clone());
2448
+ p(i) && r.setType(i.clone());
2410
2449
  const o = t.getItemType();
2411
- d(o) && r.setItemType(o.clone());
2450
+ p(o) && r.setItemType(o.clone());
2412
2451
  const l = t.getKeyType();
2413
- d(l) && r.setKeyType(l.clone());
2452
+ p(l) && r.setKeyType(l.clone());
2414
2453
  const c = t.getValueType();
2415
- d(c) && r.setValueType(c.clone());
2454
+ p(c) && r.setValueType(c.clone());
2416
2455
  const u = t.getProperties();
2417
- if (d(u)) {
2418
- const p = r.getProperties() || {};
2419
- for (const [f, v] of Object.entries(u))
2420
- p[f] = v.clone();
2421
- r.setProperties(p);
2456
+ if (p(u)) {
2457
+ const d = r.getProperties() || {};
2458
+ for (const [h, v] of Object.entries(u))
2459
+ d[h] = v.clone();
2460
+ r.setProperties(d);
2422
2461
  }
2423
2462
  const y = t.getItems();
2424
- return d(y) && r.setItems(y.map((p) => p.clone())), r;
2463
+ return p(y) && r.setItems(y.map((d) => d.clone())), r;
2425
2464
  }
2426
2465
  }
2427
- class ie extends a {
2466
+ class pe extends a {
2428
2467
  /**
2429
2468
  * Creates a new ResolvedBlueNode from a resolved BlueNode
2430
2469
  * @param resolvedNode - The fully resolved node after merge operations
@@ -2446,7 +2485,7 @@ class ie extends a {
2446
2485
  * @returns The minimal node representation
2447
2486
  */
2448
2487
  getMinimalNode() {
2449
- return new St().reverse(this);
2488
+ return new Ht().reverse(this);
2450
2489
  }
2451
2490
  getMinimalBlueId() {
2452
2491
  const e = this.getMinimalNode();
@@ -2458,7 +2497,7 @@ class ie extends a {
2458
2497
  */
2459
2498
  clone() {
2460
2499
  const e = super.clone();
2461
- return new ie(e);
2500
+ return new pe(e);
2462
2501
  }
2463
2502
  /**
2464
2503
  * Copies all properties from another BlueNode
@@ -2470,7 +2509,7 @@ class ie extends a {
2470
2509
  t !== void 0 && this.setValue(t);
2471
2510
  }
2472
2511
  }
2473
- class ae {
2512
+ class Te {
2474
2513
  /**
2475
2514
  * Fetches the first node associated with the given Blue ID
2476
2515
  * Default implementation that takes the first node from fetchByBlueId result
@@ -2483,14 +2522,57 @@ class ae {
2483
2522
  return t && t.length > 0 ? t[0] : null;
2484
2523
  }
2485
2524
  }
2486
- function as(s) {
2487
- return new class extends ae {
2525
+ function Ps(s) {
2526
+ return new class extends Te {
2488
2527
  fetchByBlueId(e) {
2489
2528
  return s(e);
2490
2529
  }
2491
2530
  }();
2492
2531
  }
2493
- class us extends ae {
2532
+ const Ke = W.types.float.options, Ss = {
2533
+ ...Ke,
2534
+ construct: (s) => {
2535
+ const e = s.replace(/_/g, "").toLowerCase();
2536
+ if (!Et(e))
2537
+ return new S(e);
2538
+ if (Ke.construct)
2539
+ return Ke.construct(s);
2540
+ }
2541
+ }, As = new W.Type("tag:yaml.org,2002:float", Ss), Ye = W.types.int.options, Vs = {
2542
+ ...Ye,
2543
+ construct: (s) => {
2544
+ let e = s;
2545
+ if (e.indexOf("_") !== -1 && (e = e.replace(/_/g, "")), !Et(e))
2546
+ return new E(e);
2547
+ if (Ye.construct)
2548
+ return Ye.construct(s);
2549
+ }
2550
+ }, Cs = new W.Type("tag:yaml.org,2002:int", Vs), Wt = W.CORE_SCHEMA.extend({
2551
+ implicit: [As, Cs]
2552
+ }), $ = (s) => {
2553
+ const e = W.load(s, { schema: Wt });
2554
+ return e === void 0 ? void 0 : e;
2555
+ }, Rs = (s) => W.dump(s, {
2556
+ schema: Wt,
2557
+ replacer: (e, t) => {
2558
+ if (A(t)) {
2559
+ if (H(t)) {
2560
+ const r = new M(Number.MIN_SAFE_INTEGER.toString()), n = new M(Number.MAX_SAFE_INTEGER.toString());
2561
+ if (t.lt(r) || t.gt(n))
2562
+ return t.toString();
2563
+ }
2564
+ return t.toNumber();
2565
+ }
2566
+ return t;
2567
+ }
2568
+ });
2569
+ class Os {
2570
+ static get(e, t = {}) {
2571
+ const { strategy: r = "official" } = t, n = m.get(e, r);
2572
+ return Rs(n);
2573
+ }
2574
+ }
2575
+ class Ds extends Te {
2494
2576
  nodeProviders;
2495
2577
  constructor(e) {
2496
2578
  super(), this.nodeProviders = e;
@@ -2517,43 +2599,7 @@ class us extends ae {
2517
2599
  return this.nodeProviders;
2518
2600
  }
2519
2601
  }
2520
- const Ve = U.types.float.options, ds = {
2521
- ...Ve,
2522
- construct: (s) => {
2523
- const e = s.replace(/_/g, "").toLowerCase();
2524
- if (!nt(e))
2525
- return new P(e);
2526
- if (Ve.construct)
2527
- return Ve.construct(s);
2528
- }
2529
- }, ps = new U.Type("tag:yaml.org,2002:float", ds), Ce = U.types.int.options, hs = {
2530
- ...Ce,
2531
- construct: (s) => {
2532
- let e = s;
2533
- if (e.indexOf("_") !== -1 && (e = e.replace(/_/g, "")), !nt(e))
2534
- return new w(e);
2535
- if (Ce.construct)
2536
- return Ce.construct(s);
2537
- }
2538
- }, fs = new U.Type("tag:yaml.org,2002:int", hs), At = U.CORE_SCHEMA.extend({
2539
- implicit: [ps, fs]
2540
- }), F = (s) => {
2541
- const e = U.load(s, { schema: At });
2542
- return e === void 0 ? void 0 : e;
2543
- }, on = (s) => U.dump(s, {
2544
- schema: At,
2545
- replacer: (e, t) => {
2546
- if (S(t)) {
2547
- if (L(t)) {
2548
- const r = new M(Number.MIN_SAFE_INTEGER.toString()), n = new M(Number.MAX_SAFE_INTEGER.toString());
2549
- if (t.lt(r) || t.gt(n))
2550
- return t.toString();
2551
- }
2552
- return t.toNumber();
2553
- }
2554
- return t;
2555
- }
2556
- }), Vt = `- type:
2602
+ const Xt = `- type:
2557
2603
  blueId: 27B7fuxQCS1VAptiCPc2RMkKoutP5qxkh3uDxZ7dr6Eo
2558
2604
  mappings:
2559
2605
  Text: DLRQwz7MQeCrzjy9bohPNwtCxKEBbKaMK65KBrwjfG6K
@@ -2564,20 +2610,20 @@ const Ve = U.types.float.options, ds = {
2564
2610
  Dictionary: G7fBT9PSod1RfHLHkpafAGBDVAJMrMhAMY51ERcyXNrj
2565
2611
  - type:
2566
2612
  blueId: FGYuTXwaoSKfZmpTysLTLsb8WzSqf43384rKZDkXhxD4
2567
- `, gs = `name: Transformation
2568
- description: TODO`, ys = `name: Infer Basic Types For Untyped Values
2613
+ `, Ms = `name: Transformation
2614
+ description: TODO`, xs = `name: Infer Basic Types For Untyped Values
2569
2615
  type:
2570
2616
  blueId: Ct1SGRGw1i47qjzm1ruiUdSZofeV6WevPTGuieVvbRS4
2571
- description: This transformation infers type details for Text, Integer, Number and Boolean.`, ms = `name: Replace Inline Types with BlueIds
2617
+ description: This transformation infers type details for Text, Integer, Number and Boolean.`, Fs = `name: Replace Inline Types with BlueIds
2572
2618
  type:
2573
2619
  blueId: Ct1SGRGw1i47qjzm1ruiUdSZofeV6WevPTGuieVvbRS4
2574
- description: This transformation replaces`, Is = [
2575
- Vt,
2576
- gs,
2577
- ys,
2578
- ms
2620
+ description: This transformation replaces`, $s = [
2621
+ Xt,
2622
+ Ms,
2623
+ xs,
2624
+ Fs
2579
2625
  ];
2580
- class Ts extends ae {
2626
+ class _s extends Te {
2581
2627
  blueIdToNodesMap = /* @__PURE__ */ new Map();
2582
2628
  constructor() {
2583
2629
  super(), this.load();
@@ -2586,8 +2632,8 @@ class Ts extends ae {
2586
2632
  return this.blueIdToNodesMap.get(e) || [];
2587
2633
  }
2588
2634
  load() {
2589
- for (const e of Is) {
2590
- const t = F(e);
2635
+ for (const e of $s) {
2636
+ const t = $(e);
2591
2637
  if (t === void 0) {
2592
2638
  console.error(`This content file is not valid YAML: ${e}`);
2593
2639
  continue;
@@ -2604,27 +2650,27 @@ class Ts extends ae {
2604
2650
  }
2605
2651
  }
2606
2652
  }
2607
- class We extends ae {
2608
- static INSTANCE = new We();
2653
+ class pt extends Te {
2654
+ static INSTANCE = new pt();
2609
2655
  nodeProvider;
2610
2656
  constructor() {
2611
- super(), this.nodeProvider = new Ts();
2657
+ super(), this.nodeProvider = new _s();
2612
2658
  }
2613
2659
  fetchByBlueId(e) {
2614
2660
  return this.nodeProvider.fetchByBlueId(e);
2615
2661
  }
2616
2662
  }
2617
- class Me {
2663
+ class ze {
2618
2664
  constructor(e, t, r) {
2619
2665
  this.blueId = e, this.content = t, this.isMultipleDocuments = r;
2620
2666
  }
2621
2667
  }
2622
- class x {
2668
+ class z {
2623
2669
  static THIS_REFERENCE_PATTERN = /^this(#\d+)?$/;
2624
2670
  static parseAndCalculateBlueId(e, t) {
2625
2671
  let r;
2626
2672
  try {
2627
- const l = F(e);
2673
+ const l = $(e);
2628
2674
  if (l === void 0)
2629
2675
  throw new Error();
2630
2676
  r = l;
@@ -2643,11 +2689,11 @@ class x {
2643
2689
  const l = g.deserialize(r), c = t(l);
2644
2690
  n = T.calculateBlueIdSync(c), i = m.get(c);
2645
2691
  }
2646
- return new Me(n, i, o);
2692
+ return new ze(n, i, o);
2647
2693
  }
2648
2694
  static parseAndCalculateBlueIdForNode(e, t) {
2649
2695
  const r = t(e), n = T.calculateBlueIdSync(r), i = m.get(r);
2650
- return new Me(n, i, !1);
2696
+ return new ze(n, i, !1);
2651
2697
  }
2652
2698
  static parseAndCalculateBlueIdForNodeList(e, t) {
2653
2699
  if (!e || e.length === 0)
@@ -2655,7 +2701,7 @@ class x {
2655
2701
  const r = e.map(t), n = T.calculateBlueIdSync(r), i = r.map(
2656
2702
  (l) => m.get(l)
2657
2703
  ), o = e.length > 1;
2658
- return new Me(n, i, o);
2704
+ return new ze(n, i, o);
2659
2705
  }
2660
2706
  static resolveThisReferences(e, t, r) {
2661
2707
  return this.resolveThisReferencesRecursive(
@@ -2706,12 +2752,12 @@ class x {
2706
2752
  }
2707
2753
  }
2708
2754
  }
2709
- class vs extends ae {
2755
+ class Ls extends Te {
2710
2756
  fetchByBlueId(e) {
2711
2757
  const t = e.split("#")[0], r = this.fetchContentByBlueId(t);
2712
2758
  if (r == null)
2713
2759
  return null;
2714
- const n = Array.isArray(r) && r.length > 1, i = x.resolveThisReferences(
2760
+ const n = Array.isArray(r) && r.length > 1, i = z.resolveThisReferences(
2715
2761
  r,
2716
2762
  t,
2717
2763
  n
@@ -2738,7 +2784,7 @@ class vs extends ae {
2738
2784
  }
2739
2785
  }
2740
2786
  }
2741
- class Ct extends vs {
2787
+ class qt extends Ls {
2742
2788
  nameToBlueIdsMap = /* @__PURE__ */ new Map();
2743
2789
  /**
2744
2790
  * Find a node by name. Throws an error if multiple nodes are found with the same name.
@@ -2782,17 +2828,17 @@ class Ct extends vs {
2782
2828
  ]);
2783
2829
  }
2784
2830
  }
2785
- const Mt = (s) => s instanceof a || Array.isArray(s) && s.every((e) => e instanceof a) ? s : xe(s) ? s.map((e) => g.deserialize(e)) : g.deserialize(s), bs = async (s) => {
2786
- const e = Mt(s);
2831
+ const Qt = (s) => s instanceof a || Array.isArray(s) && s.every((e) => e instanceof a) ? s : Qe(s) ? s.map((e) => g.deserialize(e)) : g.deserialize(s), js = async (s) => {
2832
+ const e = Qt(s);
2787
2833
  return T.calculateBlueId(e);
2788
- }, ln = (s) => {
2789
- const e = Mt(s);
2834
+ }, Hn = (s) => {
2835
+ const e = Qt(s);
2790
2836
  return T.calculateBlueIdSync(e);
2791
- }, rt = async (s) => {
2792
- if (or(s))
2837
+ }, vt = async (s) => {
2838
+ if (Er(s))
2793
2839
  return s;
2794
2840
  try {
2795
- const e = Ie.parse(s), t = await bs(e);
2841
+ const e = Ae.parse(s), t = await js(e);
2796
2842
  return {
2797
2843
  ...s,
2798
2844
  blueId: t
@@ -2800,31 +2846,31 @@ const Mt = (s) => s instanceof a || Array.isArray(s) && s.every((e) => e instanc
2800
2846
  } catch (e) {
2801
2847
  throw new Error(`Failed enriching object with Blue ID: ${e}`);
2802
2848
  }
2803
- }, cn = (s) => s?.items, an = (s) => s?.value, un = (s) => I(s) ? {} : ut(
2849
+ }, Wn = (s) => s?.items, Xn = (s) => s?.value, qn = (s) => I(s) ? {} : Ct(
2804
2850
  s,
2805
- Qt
2806
- ), dn = (s) => cr(s) ? s.type.name ?? null : ar(s) ? Zt(typeof s.value) : lr(s) ? "List" : null, ws = (s) => d(s) && Object.keys(ut(s, ["blueId"])).length > 0, pn = (s) => {
2851
+ rt
2852
+ ), Qn = (s) => Pr(s) ? s.type.name ?? null : Sr(s) ? yr(typeof s.value) : Nr(s) ? "List" : null, Us = (s) => p(s) && Object.keys(Ct(s, ["blueId"])).length > 0, ei = (s) => {
2807
2853
  try {
2808
2854
  const e = g.deserialize(s), t = m.get(e);
2809
- return se.parse(t);
2855
+ return ue.parse(t);
2810
2856
  } catch (e) {
2811
2857
  throw new Error(
2812
2858
  `Failed transforming JSON-like value to BlueObject: ${e}`
2813
2859
  );
2814
2860
  }
2815
- }, st = async (s) => {
2861
+ }, Bt = async (s) => {
2816
2862
  const {
2817
2863
  resolveFunction: e,
2818
2864
  signal: t = new AbortController().signal,
2819
2865
  omitItems: r
2820
2866
  } = s, n = s.count ?? s.items.length;
2821
- let i = await Ht(s.items, async (l) => await rt(l));
2867
+ let i = await gr(s.items, async (l) => await vt(l));
2822
2868
  const o = Math.max(i?.length - n, 0);
2823
2869
  for (let l = i.length - 1; l >= o; l--)
2824
- if (!ws(i[l])) {
2870
+ if (!Us(i[l])) {
2825
2871
  const c = await e(i[l], { signal: t });
2826
2872
  if (Array.isArray(c))
2827
- return st({
2873
+ return Bt({
2828
2874
  ...s,
2829
2875
  items: [
2830
2876
  ...i.slice(0, l),
@@ -2832,9 +2878,9 @@ const Mt = (s) => s instanceof a || Array.isArray(s) && s.every((e) => e instanc
2832
2878
  ...i.slice(l + 1)
2833
2879
  ]
2834
2880
  });
2835
- const u = await rt(c);
2881
+ const u = await vt(c);
2836
2882
  if (r?.includes(u.blueId))
2837
- return st({
2883
+ return Bt({
2838
2884
  ...s,
2839
2885
  items: [...i.slice(0, l), ...i.slice(l + 1)]
2840
2886
  });
@@ -2846,7 +2892,7 @@ const Mt = (s) => s instanceof a || Array.isArray(s) && s.every((e) => e instanc
2846
2892
  }
2847
2893
  return i;
2848
2894
  };
2849
- function pe(s) {
2895
+ function we(s) {
2850
2896
  try {
2851
2897
  const e = new URL(s);
2852
2898
  return e.protocol === "http:" || e.protocol === "https:";
@@ -2854,14 +2900,14 @@ function pe(s) {
2854
2900
  return !1;
2855
2901
  }
2856
2902
  }
2857
- class Bs {
2903
+ class ks {
2858
2904
  /**
2859
2905
  * Process a document node to infer basic types for untyped values
2860
2906
  * @param document - The document to process
2861
2907
  * @returns The processed document
2862
2908
  */
2863
2909
  process(e) {
2864
- return E.transform(e, this.inferType.bind(this));
2910
+ return w.transform(e, this.inferType.bind(this));
2865
2911
  }
2866
2912
  /**
2867
2913
  * Infer a basic type for a node
@@ -2870,10 +2916,10 @@ class Bs {
2870
2916
  */
2871
2917
  inferType(e) {
2872
2918
  const t = e.getType(), r = e.getValue();
2873
- return I(t) && d(r) && (typeof r == "string" ? e.setType(new a().setBlueId(_)) : typeof r == "bigint" || L(r) ? e.setType(new a().setBlueId(Y)) : De(r) ? e.setType(new a().setBlueId(K)) : typeof r == "boolean" && e.setType(new a().setBlueId(G))), e;
2919
+ return I(t) && p(r) && (typeof r == "string" ? e.setType(new a().setBlueId(_)) : typeof r == "bigint" || H(r) ? e.setType(new a().setBlueId(j)) : Ge(r) ? e.setType(new a().setBlueId(L)) : typeof r == "boolean" && e.setType(new a().setBlueId(U))), e;
2874
2920
  }
2875
2921
  }
2876
- class ve {
2922
+ class Ce {
2877
2923
  static MAPPINGS = "mappings";
2878
2924
  mappings = /* @__PURE__ */ new Map();
2879
2925
  /**
@@ -2883,8 +2929,8 @@ class ve {
2883
2929
  constructor(e) {
2884
2930
  if (e instanceof a) {
2885
2931
  const r = e.getProperties();
2886
- if (r && r[ve.MAPPINGS]) {
2887
- const i = r[ve.MAPPINGS].getProperties();
2932
+ if (r && r[Ce.MAPPINGS]) {
2933
+ const i = r[Ce.MAPPINGS].getProperties();
2888
2934
  i && Object.entries(i).forEach(([o, l]) => {
2889
2935
  const c = l.getValue();
2890
2936
  typeof c == "string" && this.mappings.set(o, c);
@@ -2899,7 +2945,7 @@ class ve {
2899
2945
  * @returns The processed document
2900
2946
  */
2901
2947
  process(e) {
2902
- return E.transform(e, this.transformNode.bind(this));
2948
+ return w.transform(e, this.transformNode.bind(this));
2903
2949
  }
2904
2950
  transformNode(e) {
2905
2951
  const t = e.clone();
@@ -2918,7 +2964,7 @@ class ve {
2918
2964
  }
2919
2965
  }
2920
2966
  }
2921
- class Ns {
2967
+ class Ks {
2922
2968
  /**
2923
2969
  * Process a document node to validate all inline types have been replaced
2924
2970
  * @param document - The document to process
@@ -2926,7 +2972,7 @@ class Ns {
2926
2972
  * @throws Error if any inline type values remain without BlueId mappings
2927
2973
  */
2928
2974
  process(e) {
2929
- return E.transform(e, this.validateNode.bind(this)), e;
2975
+ return w.transform(e, this.validateNode.bind(this)), e;
2930
2976
  }
2931
2977
  validateNode(e) {
2932
2978
  return this.validateTypeField(e, e.getType(), "type"), this.validateTypeField(e, e.getItemType(), "itemType"), this.validateTypeField(e, e.getKeyType(), "keyType"), this.validateTypeField(e, e.getValueType(), "valueType"), e;
@@ -2940,7 +2986,7 @@ class Ns {
2940
2986
  }
2941
2987
  }
2942
2988
  }
2943
- class qe {
2989
+ class ft {
2944
2990
  nodeProvider;
2945
2991
  strategy;
2946
2992
  /**
@@ -2949,7 +2995,7 @@ class qe {
2949
2995
  * @param strategy - The strategy to use for missing elements (defaults to THROW_EXCEPTION)
2950
2996
  */
2951
2997
  constructor(e, t) {
2952
- this.nodeProvider = oe.wrap(e), this.strategy = t || "THROW_EXCEPTION";
2998
+ this.nodeProvider = fe.wrap(e), this.strategy = t || "THROW_EXCEPTION";
2953
2999
  }
2954
3000
  /**
2955
3001
  * Extends a node with its resolved references
@@ -2967,17 +3013,17 @@ class qe {
2967
3013
  }
2968
3014
  try {
2969
3015
  const i = e.getBlueId();
2970
- if (i && !le.includes(
3016
+ if (i && !X.includes(
2971
3017
  i
2972
3018
  )) {
2973
- const f = this.fetchNode(e);
2974
- if (f && f.length > 0)
2975
- if (f.length === 1) {
2976
- const v = f[0];
3019
+ const h = this.fetchNode(e);
3020
+ if (h && h.length > 0)
3021
+ if (h.length === 1) {
3022
+ const v = h[0];
2977
3023
  this.mergeNodes(e, v);
2978
3024
  } else {
2979
- const v = f.map((z) => z.clone()), O = new a().setItems(v);
2980
- this.mergeNodes(e, O);
3025
+ const v = h.map((q) => q.clone()), k = new a().setItems(v);
3026
+ this.mergeNodes(e, k);
2981
3027
  }
2982
3028
  }
2983
3029
  const o = e.getType();
@@ -2989,14 +3035,14 @@ class qe {
2989
3035
  const u = e.getValueType();
2990
3036
  u && this.extendNode(u, t, "valueType", !0);
2991
3037
  const y = e.getProperties();
2992
- y && Object.entries(y).forEach(([f, v]) => {
2993
- this.extendNode(v, t, f, !1);
3038
+ y && Object.entries(y).forEach(([h, v]) => {
3039
+ this.extendNode(v, t, h, !1);
2994
3040
  });
2995
- const p = e.getItems();
2996
- if (p && p.length > 0) {
2997
- this.reconstructList(p);
2998
- for (let f = 0; f < p.length; f++)
2999
- this.extendNode(p[f], t, String(f), !1);
3041
+ const d = e.getItems();
3042
+ if (d && d.length > 0) {
3043
+ this.reconstructList(d);
3044
+ for (let h = 0; h < d.length; h++)
3045
+ this.extendNode(d[h], t, String(h), !1);
3000
3046
  }
3001
3047
  } finally {
3002
3048
  n || t.exitPathSegment();
@@ -3031,10 +3077,10 @@ class qe {
3031
3077
  mergeNodes(e, t) {
3032
3078
  e.setName(t.getName()), e.setDescription(t.getDescription()), e.setType(t.getType()), e.setItemType(t.getItemType()), e.setKeyType(t.getKeyType()), e.setValueType(t.getValueType());
3033
3079
  const r = t.getValue();
3034
- d(r) && e.setValue(r), e.setItems(t.getItems()), e.setProperties(t.getProperties());
3080
+ p(r) && e.setValue(r), e.setItems(t.getItems()), e.setProperties(t.getProperties());
3035
3081
  }
3036
3082
  }
3037
- class Dt {
3083
+ class ht {
3038
3084
  blueIdsCollections = [];
3039
3085
  /**
3040
3086
  * Initializes the generator with default BlueIds collections
@@ -3104,7 +3150,7 @@ ${r}`;
3104
3150
  return Object.keys(this.getAllBlueIds()).length;
3105
3151
  }
3106
3152
  }
3107
- class X {
3153
+ class ne {
3108
3154
  static DEFAULT_BLUE_BLUE_ID = "6sqUywMoBRyj9hgQxSu2nDPnqcyiSM7xu9AB9sN98YJK";
3109
3155
  processorProvider;
3110
3156
  nodeProvider;
@@ -3118,7 +3164,7 @@ class X {
3118
3164
  const { nodeProvider: t, processorProvider: r, blueIdsMappingGenerator: n } = e;
3119
3165
  if (!t)
3120
3166
  throw new Error("NodeProvider is required");
3121
- this.nodeProvider = oe.wrap(t), this.processorProvider = r || X.getStandardProvider(), this.blueIdsMappingGenerator = n || new Dt(), this.loadDefaultSimpleBlue();
3167
+ this.nodeProvider = fe.wrap(t), this.processorProvider = r || ne.getStandardProvider(), this.blueIdsMappingGenerator = n || new ht(), this.loadDefaultSimpleBlue();
3122
3168
  }
3123
3169
  /**
3124
3170
  * Preprocesses a document node
@@ -3145,9 +3191,9 @@ class X {
3145
3191
  preprocessWithOptions(e, t) {
3146
3192
  let r = e.clone(), n = r.getBlue();
3147
3193
  if (!n && t && (n = t.clone()), n) {
3148
- new qe(this.nodeProvider).extend(
3194
+ new ft(this.nodeProvider).extend(
3149
3195
  n,
3150
- Be.withSinglePath("/*")
3196
+ $e.withSinglePath("/*")
3151
3197
  );
3152
3198
  const i = n.getItems();
3153
3199
  if (i && i.length > 0) {
@@ -3162,7 +3208,7 @@ class X {
3162
3208
  }
3163
3209
  r.setBlue(void 0);
3164
3210
  }
3165
- r = new Ns().process(
3211
+ r = new Ks().process(
3166
3212
  r
3167
3213
  );
3168
3214
  }
@@ -3177,11 +3223,11 @@ class X {
3177
3223
  getProcessor(e) {
3178
3224
  const t = "27B7fuxQCS1VAptiCPc2RMkKoutP5qxkh3uDxZ7dr6Eo", r = "FGYuTXwaoSKfZmpTysLTLsb8WzSqf43384rKZDkXhxD4", n = e.getType()?.getBlueId();
3179
3225
  if (t === n)
3180
- return new ve(
3226
+ return new Ce(
3181
3227
  e
3182
3228
  );
3183
3229
  if (r === n)
3184
- return new Bs();
3230
+ return new ks();
3185
3231
  }
3186
3232
  };
3187
3233
  }
@@ -3201,40 +3247,55 @@ ${t}
3201
3247
  * Loads the default simple Blue node
3202
3248
  */
3203
3249
  loadDefaultSimpleBlue() {
3204
- const e = this.enrichDefaultBlue(Vt);
3205
3250
  try {
3206
- const t = F(e);
3251
+ const e = this.enrichDefaultBlue(Xt), t = $(e);
3207
3252
  if (t)
3208
3253
  this.defaultSimpleBlue = g.deserialize(t);
3209
3254
  else
3210
3255
  throw new Error("Failed to parse default Blue content");
3211
- } catch (t) {
3212
- throw new Error(`Error loading default Blue: ${t}`);
3256
+ } catch (e) {
3257
+ throw new Error(`Error loading default Blue: ${e}`);
3213
3258
  }
3214
3259
  }
3215
3260
  }
3216
- class Ps extends Ct {
3261
+ class yt extends qt {
3217
3262
  blueIdToContentMap = /* @__PURE__ */ new Map();
3218
3263
  blueIdToMultipleDocumentsMap = /* @__PURE__ */ new Map();
3219
3264
  preprocessor;
3220
3265
  constructor(e) {
3221
3266
  super();
3222
- const t = new X({ nodeProvider: this });
3223
- this.preprocessor = (r) => t.preprocessWithDefaultBlue(r), this.loadRepositories(e);
3267
+ const t = new ht(), r = yt.collectAliasMappings(e);
3268
+ Object.keys(r).length > 0 && t.registerBlueIds(r);
3269
+ const n = new ne({
3270
+ nodeProvider: this,
3271
+ blueIdsMappingGenerator: t
3272
+ });
3273
+ this.preprocessor = (i) => n.preprocessWithDefaultBlue(i), this.loadRepositories(e);
3274
+ }
3275
+ static collectAliasMappings(e) {
3276
+ const t = {};
3277
+ for (const r of e)
3278
+ for (const n of Object.values(r.packages))
3279
+ for (const [i, o] of Object.entries(n.aliases)) {
3280
+ const l = t[i];
3281
+ if (l && l !== o)
3282
+ throw new Error(`Conflicting alias mapping for ${i}`);
3283
+ t[i] = o;
3284
+ }
3285
+ return t;
3224
3286
  }
3225
3287
  loadRepositories(e) {
3226
3288
  for (const t of e)
3227
- if (t.contents)
3228
- for (const [r, n] of Object.entries(
3229
- t.contents
3230
- ))
3231
- this.processContent(n, r);
3289
+ Object.values(t.packages).forEach((r) => {
3290
+ for (const [n, i] of Object.entries(r.contents))
3291
+ this.processContent(i, n);
3292
+ });
3232
3293
  }
3233
3294
  processContent(e, t) {
3234
3295
  Array.isArray(e) ? this.processMultipleDocuments(e, t) : this.processSingleDocument(e, t);
3235
3296
  }
3236
3297
  processSingleDocument(e, t) {
3237
- const r = g.deserialize(e), n = x.parseAndCalculateBlueIdForNode(
3298
+ const r = g.deserialize(e), n = z.parseAndCalculateBlueIdForNode(
3238
3299
  r,
3239
3300
  this.preprocessor
3240
3301
  ), i = t || n.blueId;
@@ -3246,21 +3307,20 @@ class Ps extends Ct {
3246
3307
  const r = e.map((o) => {
3247
3308
  const l = g.deserialize(o);
3248
3309
  return this.preprocessor(l);
3249
- }), n = x.parseAndCalculateBlueIdForNodeList(
3310
+ }), n = z.parseAndCalculateBlueIdForNodeList(
3250
3311
  r,
3251
3312
  (o) => o
3252
- // Already preprocessed above
3253
3313
  ), i = t || n.blueId;
3254
3314
  this.blueIdToContentMap.set(i, n.content), this.blueIdToMultipleDocumentsMap.set(i, !0), r.forEach((o, l) => {
3255
3315
  const c = `${i}#${l}`, u = m.get(o), y = T.calculateBlueIdSync(o);
3256
3316
  this.blueIdToContentMap.set(y, u), this.blueIdToMultipleDocumentsMap.set(y, !1);
3257
- const p = o.getName();
3258
- p && this.addToNameMap(p, c);
3317
+ const d = o.getName();
3318
+ d && this.addToNameMap(d, c);
3259
3319
  });
3260
3320
  }
3261
3321
  fetchContentByBlueId(e) {
3262
3322
  const t = this.blueIdToContentMap.get(e), r = this.blueIdToMultipleDocumentsMap.get(e);
3263
- return t !== void 0 && r !== void 0 ? x.resolveThisReferences(
3323
+ return t !== void 0 && r !== void 0 ? z.resolveThisReferences(
3264
3324
  t,
3265
3325
  e,
3266
3326
  r
@@ -3280,7 +3340,7 @@ class Ps extends Ct {
3280
3340
  return this.blueIdToContentMap.has(t);
3281
3341
  }
3282
3342
  }
3283
- class oe {
3343
+ class fe {
3284
3344
  /**
3285
3345
  * Wraps a NodeProvider with a SequentialNodeProvider that includes bootstrap providers and repository definitions
3286
3346
  * @param originalProvider - The original NodeProvider to wrap
@@ -3288,15 +3348,15 @@ class oe {
3288
3348
  * @returns A wrapped NodeProvider that includes bootstrap providers and repository definitions
3289
3349
  */
3290
3350
  static wrap(e, t) {
3291
- const r = [We.INSTANCE];
3351
+ const r = [pt.INSTANCE];
3292
3352
  if (t && t.length > 0) {
3293
- const n = new Ps(t);
3353
+ const n = new yt(t);
3294
3354
  r.push(n);
3295
3355
  }
3296
- return r.push(e), new us(r);
3356
+ return r.push(e), new Ds(r);
3297
3357
  }
3298
3358
  }
3299
- class Es {
3359
+ class Ys {
3300
3360
  preprocessingAliases = /* @__PURE__ */ new Map();
3301
3361
  urlContentFetcher;
3302
3362
  /**
@@ -3320,9 +3380,9 @@ class Es {
3320
3380
  const r = e.clone();
3321
3381
  if (this.preprocessingAliases.has(t))
3322
3382
  return this.handleAliasValue(r, t);
3323
- if (me.isPotentialBlueId(t))
3383
+ if (Se.isPotentialBlueId(t))
3324
3384
  return this.handleBlueId(r, t);
3325
- throw pe(t) ? new Error(
3385
+ throw we(t) ? new Error(
3326
3386
  `URL '${t}' detected. Use the async version of this method to fetch the content.`
3327
3387
  ) : new Error(`Invalid blue value: ${t}`);
3328
3388
  }
@@ -3340,9 +3400,9 @@ class Es {
3340
3400
  const r = e.clone();
3341
3401
  if (this.preprocessingAliases.has(t))
3342
3402
  return this.handleAliasValue(r, t);
3343
- if (me.isPotentialBlueId(t))
3403
+ if (Se.isPotentialBlueId(t))
3344
3404
  return this.handleBlueId(r, t);
3345
- if (pe(t) && this.urlContentFetcher)
3405
+ if (we(t) && this.urlContentFetcher)
3346
3406
  try {
3347
3407
  const n = await this.fetchFromUrl(t);
3348
3408
  return n && r.setBlue(new a().setItems(n)), r;
@@ -3352,7 +3412,7 @@ class Es {
3352
3412
  ${n.message}`
3353
3413
  ) : n;
3354
3414
  }
3355
- else throw pe(t) ? new Error(
3415
+ else throw we(t) ? new Error(
3356
3416
  `UrlContentFetcher not provided for URL: ${t}`
3357
3417
  ) : new Error(`Invalid blue value: ${t}`);
3358
3418
  }
@@ -3438,24 +3498,24 @@ ${n.message}`
3438
3498
  return this.urlContentFetcher;
3439
3499
  }
3440
3500
  }
3441
- const Ss = {
3501
+ const zs = {
3442
3502
  fetchUrl: async (s) => {
3443
3503
  throw new Error(
3444
3504
  `You must provide a custom UrlFetchStrategy to fetch content from URL: ${s}`
3445
3505
  );
3446
3506
  }
3447
3507
  };
3448
- class As {
3508
+ class Gs {
3449
3509
  // Cache to avoid repeated network requests for the same URL
3450
3510
  cache = /* @__PURE__ */ new Map();
3451
3511
  fetchStrategy;
3452
3512
  enabled = !1;
3453
3513
  allowedDomains = [];
3454
3514
  constructor(e) {
3455
- this.fetchStrategy = e || Ss;
3515
+ this.fetchStrategy = e || zs;
3456
3516
  }
3457
3517
  validateUrl(e) {
3458
- if (!pe(e))
3518
+ if (!we(e))
3459
3519
  throw new Error(`Invalid URL: ${e}`);
3460
3520
  return !0;
3461
3521
  }
@@ -3494,7 +3554,7 @@ class As {
3494
3554
  const { data: r, contentType: n } = t;
3495
3555
  let i;
3496
3556
  if (n.includes("application/json") || n.includes("text/yaml") || n.includes("application/yaml") || n.includes("text/plain"))
3497
- i = F(r);
3557
+ i = $(r);
3498
3558
  else
3499
3559
  throw new Error(`Unsupported content type from URL: ${n}`);
3500
3560
  if (i === void 0)
@@ -3574,7 +3634,7 @@ class As {
3574
3634
  return this.allowedDomains = [], this;
3575
3635
  }
3576
3636
  }
3577
- class Vs {
3637
+ class Js {
3578
3638
  /**
3579
3639
  * Resolves a node without limits
3580
3640
  * Default implementation that uses NO_LIMITS
@@ -3583,10 +3643,10 @@ class Vs {
3583
3643
  * @returns The resolved node using NO_LIMITS
3584
3644
  */
3585
3645
  resolveWithoutLimits(e) {
3586
- return this.resolve(e, R);
3646
+ return this.resolve(e, K);
3587
3647
  }
3588
3648
  }
3589
- class Cs extends Vs {
3649
+ class Zs extends Js {
3590
3650
  mergingProcessor;
3591
3651
  nodeProvider;
3592
3652
  /**
@@ -3595,7 +3655,7 @@ class Cs extends Vs {
3595
3655
  * @param nodeProvider - The provider to use for resolving nodes
3596
3656
  */
3597
3657
  constructor(e, t) {
3598
- super(), this.mergingProcessor = e, this.nodeProvider = oe.wrap(t);
3658
+ super(), this.mergingProcessor = e, this.nodeProvider = fe.wrap(t);
3599
3659
  }
3600
3660
  /**
3601
3661
  * Merges a source node into a target node with the given limits
@@ -3605,17 +3665,17 @@ class Cs extends Vs {
3605
3665
  * @returns A new BlueNode with the merged content
3606
3666
  */
3607
3667
  merge(e, t, r) {
3608
- if (d(t.getBlue()))
3668
+ if (p(t.getBlue()))
3609
3669
  throw new Error(
3610
3670
  'Document contains "blue" attribute. Preprocess document before merging.'
3611
3671
  );
3612
3672
  let n = e;
3613
3673
  const i = t.getType();
3614
- if (d(i)) {
3674
+ if (p(i)) {
3615
3675
  const o = i.clone();
3616
- d(o.getBlueId()) && new qe(this.nodeProvider).extend(
3676
+ p(o.getBlueId()) && new ft(this.nodeProvider).extend(
3617
3677
  o,
3618
- Be.withSinglePath("/")
3678
+ $e.withSinglePath("/")
3619
3679
  );
3620
3680
  const l = this.resolve(o, r), c = t.clone().setType(l);
3621
3681
  return n = this.merge(n, o, r), this.mergeObject(n, c, r);
@@ -3636,11 +3696,11 @@ class Cs extends Vs {
3636
3696
  this.nodeProvider
3637
3697
  );
3638
3698
  const i = t.getItems();
3639
- d(i) && (n = this.mergeChildren(n, i, r));
3699
+ p(i) && (n = this.mergeChildren(n, i, r));
3640
3700
  const o = t.getProperties();
3641
- return d(o) && Object.entries(o).forEach(([l, c]) => {
3701
+ return p(o) && Object.entries(o).forEach(([l, c]) => {
3642
3702
  r.shouldMergePathSegment(l, c) && (r.enterPathSegment(l, c), n = this.mergeProperty(n, l, c, r), r.exitPathSegment());
3643
- }), d(t.getBlueId()) && (n = n.clone().setBlueId(t.getBlueId())), this.mergingProcessor.postProcess && (n = this.mergingProcessor.postProcess(
3703
+ }), p(t.getBlueId()) && (n = n.clone().setBlueId(t.getBlueId())), this.mergingProcessor.postProcess && (n = this.mergingProcessor.postProcess(
3644
3704
  n,
3645
3705
  t,
3646
3706
  this.nodeProvider
@@ -3715,10 +3775,10 @@ class Cs extends Vs {
3715
3775
  */
3716
3776
  resolve(e, t) {
3717
3777
  const r = new a(), i = this.merge(r, e, t).clone().setName(e.getName()).setDescription(e.getDescription()).setBlueId(e.getBlueId());
3718
- return new ie(i);
3778
+ return new pe(i);
3719
3779
  }
3720
3780
  }
3721
- class Ft {
3781
+ class er {
3722
3782
  mergingProcessors;
3723
3783
  /**
3724
3784
  * Creates a new SequentialMergingProcessor with the given processors
@@ -3743,14 +3803,14 @@ class Ft {
3743
3803
  return this.mergingProcessors.reduce((n, i) => i.postProcess ? i.postProcess(n, t, r) : n, e);
3744
3804
  }
3745
3805
  }
3746
- class Ot {
3806
+ class tr {
3747
3807
  process(e, t) {
3748
3808
  const r = t.getValue();
3749
- if (d(r)) {
3809
+ if (p(r)) {
3750
3810
  const n = e.getValue();
3751
3811
  if (I(n))
3752
3812
  return e.clone().setValue(r);
3753
- if (!Ms(r, n))
3813
+ if (!Hs(r, n))
3754
3814
  throw new Error(
3755
3815
  `Node values conflict. Source node value: ${r}, target node value: ${n}`
3756
3816
  );
@@ -3758,8 +3818,8 @@ class Ot {
3758
3818
  return e;
3759
3819
  }
3760
3820
  }
3761
- const Ms = (s, e) => L(s) && L(e) || De(s) && De(e) ? s.eq(e) : s === e;
3762
- class Rt {
3821
+ const Hs = (s, e) => H(s) && H(e) || Ge(s) && Ge(e) ? s.eq(e) : s === e;
3822
+ class rr {
3763
3823
  process(e, t, r) {
3764
3824
  const n = e.getType(), i = t.getType();
3765
3825
  let o = e;
@@ -3785,10 +3845,10 @@ class Rt {
3785
3845
  return o;
3786
3846
  }
3787
3847
  }
3788
- class $t {
3848
+ class sr {
3789
3849
  process(e, t, r) {
3790
3850
  const n = t.getItemType(), i = t.getType();
3791
- if (n !== void 0 && i !== void 0 && !Nt(i, r))
3851
+ if (n !== void 0 && i !== void 0 && !Gt(i, r))
3792
3852
  throw new Error("Source node with itemType must have a List type");
3793
3853
  const o = e.getItemType();
3794
3854
  let l = e;
@@ -3800,12 +3860,12 @@ class $t {
3800
3860
  o,
3801
3861
  r
3802
3862
  )) {
3803
- const p = m.get(n), f = m.get(o);
3863
+ const d = m.get(n), h = m.get(o);
3804
3864
  throw new Error(
3805
3865
  `The source item type '${JSON.stringify(
3806
- p
3866
+ d
3807
3867
  )}' is not a subtype of the target item type '${JSON.stringify(
3808
- f
3868
+ h
3809
3869
  )}'.`
3810
3870
  );
3811
3871
  }
@@ -3814,18 +3874,18 @@ class $t {
3814
3874
  const c = l.getItemType(), u = t.getItems();
3815
3875
  if (c !== void 0 && u !== void 0)
3816
3876
  for (const y of u) {
3817
- const p = y.getType();
3818
- if (p !== void 0 && !b(
3819
- p,
3877
+ const d = y.getType();
3878
+ if (d !== void 0 && !b(
3879
+ d,
3820
3880
  c,
3821
3881
  r
3822
3882
  )) {
3823
- const f = m.get(p), v = m.get(
3883
+ const h = m.get(d), v = m.get(
3824
3884
  c
3825
3885
  );
3826
3886
  throw new Error(
3827
3887
  `Item of type '${JSON.stringify(
3828
- f
3888
+ h
3829
3889
  )}' is not a subtype of the list's item type '${JSON.stringify(
3830
3890
  v
3831
3891
  )}'.`
@@ -3835,18 +3895,18 @@ class $t {
3835
3895
  return l;
3836
3896
  }
3837
3897
  }
3838
- class xt {
3898
+ class nr {
3839
3899
  process(e, t, r) {
3840
3900
  const n = t.getKeyType(), i = t.getValueType(), o = t.getType();
3841
- if ((n !== void 0 || i !== void 0) && o !== void 0 && !Pt(o, r))
3901
+ if ((n !== void 0 || i !== void 0) && o !== void 0 && !Jt(o, r))
3842
3902
  throw new Error(
3843
3903
  "Source node with keyType or valueType must have a Dictionary type"
3844
3904
  );
3845
3905
  let l = this.processKeyType(e, t, r);
3846
3906
  l = this.processValueType(l, t, r);
3847
3907
  const c = l.getKeyType(), u = l.getValueType(), y = t.getProperties();
3848
- return (c !== void 0 || u !== void 0) && y !== void 0 && Object.entries(y).forEach(([p, f]) => {
3849
- c !== void 0 && this.validateKeyType(p, c, r), u !== void 0 && this.validateValueType(f, u, r);
3908
+ return (c !== void 0 || u !== void 0) && y !== void 0 && Object.entries(y).forEach(([d, h]) => {
3909
+ c !== void 0 && this.validateKeyType(d, c, r), u !== void 0 && this.validateValueType(h, u, r);
3850
3910
  }), l;
3851
3911
  }
3852
3912
  processKeyType(e, t, r) {
@@ -3898,20 +3958,20 @@ class xt {
3898
3958
  return e;
3899
3959
  }
3900
3960
  validateBasicKeyType(e, t) {
3901
- if (!Ur(e, t))
3961
+ if (!ss(e, t))
3902
3962
  throw new Error("Dictionary key type must be a basic type");
3903
3963
  }
3904
3964
  validateKeyType(e, t, r) {
3905
- if (!_r(t, r))
3906
- if (Kr(t, r)) {
3965
+ if (!ns(t, r))
3966
+ if (is(t, r)) {
3907
3967
  const n = Number.parseInt(e, 10);
3908
3968
  if (Number.isNaN(n) || n.toString() !== e)
3909
3969
  throw new Error(`Key '${e}' is not a valid Integer.`);
3910
- } else if (Yr(t, r)) {
3970
+ } else if (os(t, r)) {
3911
3971
  const n = Number.parseFloat(e);
3912
3972
  if (Number.isNaN(n))
3913
3973
  throw new Error(`Key '${e}' is not a valid Number.`);
3914
- } else if (Gr(t, r)) {
3974
+ } else if (ls(t, r)) {
3915
3975
  if (e.toLowerCase() !== "true" && e.toLowerCase() !== "false")
3916
3976
  throw new Error(`Key '${e}' is not a valid Boolean.`);
3917
3977
  } else
@@ -3933,16 +3993,16 @@ class xt {
3933
3993
  }
3934
3994
  }
3935
3995
  }
3936
- class jt {
3996
+ class ir {
3937
3997
  process(e) {
3938
3998
  return e;
3939
3999
  }
3940
4000
  postProcess(e, t, r) {
3941
4001
  const n = e.getType();
3942
- if (n !== void 0 && zr(n, r)) {
4002
+ if (n !== void 0 && cs(n, r)) {
3943
4003
  const i = e.getItems(), o = e.getProperties();
3944
4004
  if (i !== void 0 && i.length > 0 || o !== void 0 && Object.keys(o).length > 0) {
3945
- const l = kr(
4005
+ const l = as(
3946
4006
  n,
3947
4007
  r
3948
4008
  ), c = n.getName() || "unknown";
@@ -3954,7 +4014,7 @@ class jt {
3954
4014
  return e;
3955
4015
  }
3956
4016
  }
3957
- class Lt {
4017
+ class or {
3958
4018
  process(e, t) {
3959
4019
  let r = e;
3960
4020
  const n = t.getName(), i = e.getName();
@@ -3963,32 +4023,32 @@ class Lt {
3963
4023
  return o !== void 0 && l === void 0 && (r = r.clone().setDescription(o)), r;
3964
4024
  }
3965
4025
  }
3966
- const hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4026
+ const ti = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3967
4027
  __proto__: null,
3968
- BasicTypesVerifier: jt,
3969
- DictionaryProcessor: xt,
3970
- ListProcessor: $t,
3971
- MetadataPropagator: Lt,
3972
- SequentialMergingProcessor: Ft,
3973
- TypeAssigner: Rt,
3974
- ValuePropagator: Ot
4028
+ BasicTypesVerifier: ir,
4029
+ DictionaryProcessor: nr,
4030
+ ListProcessor: sr,
4031
+ MetadataPropagator: or,
4032
+ SequentialMergingProcessor: er,
4033
+ TypeAssigner: rr,
4034
+ ValuePropagator: tr
3975
4035
  }, Symbol.toStringTag, { value: "Module" }));
3976
- function Ds() {
3977
- return new Ft([
3978
- new Ot(),
3979
- new Rt(),
3980
- new $t(),
3981
- new xt(),
3982
- new Lt(),
3983
- new jt()
4036
+ function Ws() {
4037
+ return new er([
4038
+ new tr(),
4039
+ new rr(),
4040
+ new sr(),
4041
+ new nr(),
4042
+ new or(),
4043
+ new ir()
3984
4044
  ]);
3985
4045
  }
3986
- class Fs {
4046
+ class Xs {
3987
4047
  nodeProvider;
3988
4048
  blueIdToInlineValue = /* @__PURE__ */ new Map();
3989
4049
  constructor(e) {
3990
4050
  const { nodeProvider: t, blueIdsMappingGenerator: r } = e;
3991
- this.nodeProvider = t, Object.entries(gt).forEach(([i, o]) => {
4051
+ this.nodeProvider = t, Object.entries(xe).forEach(([i, o]) => {
3992
4052
  this.blueIdToInlineValue.set(i, o);
3993
4053
  });
3994
4054
  const n = r.getAllBlueIds();
@@ -4000,7 +4060,7 @@ class Fs {
4000
4060
  * Returns a new BlueNode where all type references are restored to inline values when possible.
4001
4061
  */
4002
4062
  restore(e) {
4003
- return E.transform(
4063
+ return w.transform(
4004
4064
  e,
4005
4065
  (t) => this.restoreNode(t)
4006
4066
  );
@@ -4049,15 +4109,692 @@ class Fs {
4049
4109
  return this.blueIdToInlineValue.set(e, o), o;
4050
4110
  }
4051
4111
  }
4052
- class fn {
4112
+ class qs {
4113
+ runtimes;
4114
+ contents;
4115
+ aliases;
4116
+ constructor(e) {
4117
+ const t = [];
4118
+ for (const r of e)
4119
+ t.push(Qs(r));
4120
+ this.runtimes = t, this.contents = {}, this.aliases = {};
4121
+ for (const r of this.runtimes)
4122
+ dn(this.contents, r.contents, r.name), un(this.aliases, r.aliases, r.name);
4123
+ }
4124
+ getRuntimes() {
4125
+ return this.runtimes;
4126
+ }
4127
+ getAliases() {
4128
+ return this.aliases;
4129
+ }
4130
+ getContents() {
4131
+ return this.contents;
4132
+ }
4133
+ findRuntimeByName(e) {
4134
+ return this.runtimes.find((t) => t.name === e);
4135
+ }
4136
+ toCurrentBlueId(e) {
4137
+ for (const t of this.runtimes) {
4138
+ const r = t.toCurrentBlueIdIndex[e];
4139
+ if (r)
4140
+ return r;
4141
+ }
4142
+ return e;
4143
+ }
4144
+ getTypeAlias(e) {
4145
+ const t = this.toCurrentBlueId(e), r = xe[t];
4146
+ if (r)
4147
+ return r;
4148
+ for (const n of this.runtimes) {
4149
+ const i = n.typeAliasByCurrentBlueId[t];
4150
+ if (i)
4151
+ return i;
4152
+ }
4153
+ }
4154
+ findRuntimeByBlueId(e) {
4155
+ const t = this.toCurrentBlueId(e);
4156
+ for (const r of this.runtimes) {
4157
+ const n = r.types[t];
4158
+ if (n)
4159
+ return {
4160
+ runtime: r,
4161
+ currentBlueId: t,
4162
+ typeMeta: n,
4163
+ typeAlias: r.typeAliasByCurrentBlueId[t]
4164
+ };
4165
+ }
4166
+ }
4167
+ }
4168
+ function Qs(s) {
4169
+ const e = en(s);
4170
+ return Object.values(s.packages).forEach((t) => {
4171
+ tn(e, s, t);
4172
+ }), {
4173
+ name: s.name,
4174
+ repositoryVersions: s.repositoryVersions,
4175
+ repoVersionIndexById: e.repoVersionIndexById,
4176
+ aliases: e.aliases,
4177
+ types: e.types,
4178
+ toCurrentBlueIdIndex: e.toCurrentBlueIdIndex,
4179
+ contents: e.contents,
4180
+ schemas: e.schemas,
4181
+ currentRepoBlueId: e.currentRepoBlueId,
4182
+ typeAliasByCurrentBlueId: e.typeAliasByCurrentBlueId,
4183
+ typePackageByCurrentBlueId: e.typePackageByCurrentBlueId
4184
+ };
4185
+ }
4186
+ function en(s) {
4187
+ const e = Object.fromEntries(
4188
+ s.repositoryVersions.map((r, n) => [r, n])
4189
+ ), t = s.repositoryVersions[s.repositoryVersions.length - 1];
4190
+ return {
4191
+ aliases: {},
4192
+ types: {},
4193
+ toCurrentBlueIdIndex: {},
4194
+ contents: {},
4195
+ schemas: [],
4196
+ typeAliasByCurrentBlueId: {},
4197
+ typePackageByCurrentBlueId: {},
4198
+ packageNames: /* @__PURE__ */ new Set(),
4199
+ repoVersionIndexById: e,
4200
+ currentRepoBlueId: t
4201
+ };
4202
+ }
4203
+ function tn(s, e, t) {
4204
+ if (s.packageNames.has(t.name))
4205
+ throw new Error(`Duplicate package name detected: ${t.name}`);
4206
+ s.packageNames.add(t.name), rn(s, t), sn(s, e, t), nn(s, t), on(s, t);
4207
+ }
4208
+ function rn(s, e) {
4209
+ Object.entries(e.aliases).forEach(([t, r]) => {
4210
+ if (s.aliases[t] && s.aliases[t] !== r)
4211
+ throw new Error(`Conflicting alias mapping for ${t}`);
4212
+ s.aliases[t] = r;
4213
+ });
4214
+ }
4215
+ function sn(s, e, t) {
4216
+ Object.entries(t.typesMeta).forEach(([r, n]) => {
4217
+ if (s.types[r])
4218
+ throw new Error(`Duplicate type mapping for BlueId ${r}`);
4219
+ const i = ln(
4220
+ n,
4221
+ e,
4222
+ r,
4223
+ t.name
4224
+ );
4225
+ if (s.types[r] = i, s.typePackageByCurrentBlueId[r] = t.name, s.typeAliasByCurrentBlueId[r] = `${t.name}/${n.name}`, i.status === le && !s.toCurrentBlueIdIndex[r] && (s.toCurrentBlueIdIndex[r] = r), i.status === le)
4226
+ for (const o of i.versions) {
4227
+ const l = s.toCurrentBlueIdIndex[o.typeBlueId];
4228
+ if (l && l !== r)
4229
+ throw new Error(
4230
+ `Conflicting toCurrentBlueIdIndex mapping for ${o.typeBlueId}`
4231
+ );
4232
+ s.toCurrentBlueIdIndex[o.typeBlueId] = r;
4233
+ }
4234
+ });
4235
+ }
4236
+ function nn(s, e) {
4237
+ Object.entries(e.contents).forEach(([t, r]) => {
4238
+ s.contents[t] = r;
4239
+ });
4240
+ }
4241
+ function on(s, e) {
4242
+ s.schemas.push(...Object.values(e.schemas));
4243
+ }
4244
+ function ln(s, e, t, r) {
4245
+ if (s.status === tt)
4246
+ return cn(s, e, t, r), {
4247
+ ...s,
4248
+ versions: s.versions ? [...s.versions] : s.versions
4249
+ };
4250
+ const n = [...s.versions ?? []].sort(
4251
+ (o, l) => o.repositoryVersionIndex - l.repositoryVersionIndex
4252
+ );
4253
+ if (n.length === 0)
4254
+ throw new Error(
4255
+ `Stable type ${r}/${s.name} (${t}) must have at least one version entry`
4256
+ );
4257
+ const i = /* @__PURE__ */ new Set();
4258
+ return n.forEach((o) => {
4259
+ if (o.repositoryVersionIndex < 0 || o.repositoryVersionIndex >= e.repositoryVersions.length)
4260
+ throw new Error(
4261
+ `Invalid repositoryVersionIndex ${o.repositoryVersionIndex} for ${r}/${s.name}`
4262
+ );
4263
+ if (i.has(o.repositoryVersionIndex))
4264
+ throw new Error(
4265
+ `Duplicate repositoryVersionIndex ${o.repositoryVersionIndex} for ${r}/${s.name}`
4266
+ );
4267
+ i.add(o.repositoryVersionIndex);
4268
+ for (const l of o.attributesAdded ?? [])
4269
+ an(
4270
+ l,
4271
+ e.name,
4272
+ t,
4273
+ o.repositoryVersionIndex
4274
+ );
4275
+ }), {
4276
+ ...s,
4277
+ versions: n
4278
+ };
4279
+ }
4280
+ function cn(s, e, t, r) {
4281
+ if (s.status === tt) {
4282
+ if (s.versions && s.versions.length > 1)
4283
+ throw new Error(
4284
+ `Dev type ${r}/${s.name} (${t}) must not declare multiple versions`
4285
+ );
4286
+ if (s.versions && s.versions.length === 1) {
4287
+ const n = s.versions[0];
4288
+ if (n.repositoryVersionIndex < 0 || n.repositoryVersionIndex >= e.repositoryVersions.length)
4289
+ throw new Error(
4290
+ `Invalid repositoryVersionIndex ${n.repositoryVersionIndex} for dev type ${r}/${s.name}`
4291
+ );
4292
+ }
4293
+ }
4294
+ }
4295
+ function an(s, e, t, r) {
4296
+ try {
4297
+ Tr(s);
4298
+ } catch (n) {
4299
+ const i = n instanceof Error ? n.message : "Unknown error";
4300
+ throw new Error(
4301
+ `Invalid attributesAdded pointer '${s}' for type ${t} in repository ${e} at index ${r}: ${i}`
4302
+ );
4303
+ }
4304
+ }
4305
+ function un(s, e, t) {
4306
+ for (const [r, n] of Object.entries(e)) {
4307
+ const i = s[r];
4308
+ if (i && i !== n)
4309
+ throw new Error(
4310
+ `Conflicting alias '${r}' across repositories: '${i}' vs '${n}' (from ${t})`
4311
+ );
4312
+ s[r] = n;
4313
+ }
4314
+ }
4315
+ function dn(s, e, t) {
4316
+ for (const [r, n] of Object.entries(e)) {
4317
+ if (r in s) {
4318
+ const i = s[r];
4319
+ if (!pn(i, n))
4320
+ throw new Error(
4321
+ `Conflicting content for BlueId '${r}' across repositories (from ${t})`
4322
+ );
4323
+ continue;
4324
+ }
4325
+ s[r] = n;
4326
+ }
4327
+ }
4328
+ function pn(s, e) {
4329
+ if (s === e) return !0;
4330
+ if (s === null || e === null || typeof s != "object" || typeof e != "object") return !1;
4331
+ const t = Je.canonicalize(s), r = Je.canonicalize(e);
4332
+ return t !== void 0 && t === r;
4333
+ }
4334
+ class Re extends Error {
4335
+ code;
4336
+ details;
4337
+ constructor(e, t, r) {
4338
+ super(t), this.code = e, this.details = r && r.length > 0 ? r : [], this.name = "BlueError";
4339
+ }
4340
+ }
4341
+ const D = {
4342
+ REPO_UNKNOWN_REPO_BLUE_ID: "REPO_UNKNOWN_REPO_BLUE_ID",
4343
+ REPO_UNREPRESENTABLE_IN_TARGET_VERSION: "REPO_UNREPRESENTABLE_IN_TARGET_VERSION",
4344
+ INVALID_BLUE_CONTEXT_REPOSITORIES: "INVALID_BLUE_CONTEXT_REPOSITORIES",
4345
+ INVALID_REPOSITORY_POINTER: "INVALID_REPOSITORY_POINTER"
4346
+ }, fn = /* @__PURE__ */ new Set([
4347
+ "__proto__",
4348
+ "constructor",
4349
+ "prototype"
4350
+ ]);
4351
+ function bt(s) {
4352
+ const e = s.at(0), t = s.at(-1);
4353
+ return !e || !t ? s : e === "'" && t === "'" || e === '"' && t === '"' ? s.slice(1, -1) : s;
4354
+ }
4355
+ function hn(s, e) {
4356
+ const t = s.indexOf("=");
4357
+ if (t === -1)
4358
+ throw re(e, `Missing '=' in segment '${s.trim()}'`);
4359
+ if (s.indexOf("=", t + 1) !== -1)
4360
+ throw re(e, `Unexpected '=' in segment '${s.trim()}'`);
4361
+ const r = bt(s.slice(0, t).trim()), n = bt(s.slice(t + 1).trim());
4362
+ if (!r)
4363
+ throw re(e, "Repository name is empty");
4364
+ if (!n)
4365
+ throw re(e, `Repository BlueId is empty for '${r}'`);
4366
+ return { name: r, value: n };
4367
+ }
4368
+ function yn(s) {
4369
+ if (s.trim().length === 0)
4370
+ return /* @__PURE__ */ Object.create(null);
4371
+ const e = /* @__PURE__ */ Object.create(null);
4372
+ for (const t of s.split(",")) {
4373
+ const r = t.trim();
4374
+ if (!r)
4375
+ throw re(s, "Empty repository segment");
4376
+ const { name: n, value: i } = hn(r, s);
4377
+ mn(n, s), e[n] = i;
4378
+ }
4379
+ return e;
4380
+ }
4381
+ function gn(s) {
4382
+ return typeof s == "string" ? yn(s) : s;
4383
+ }
4384
+ function re(s, e) {
4385
+ return new Re(
4386
+ D.INVALID_BLUE_CONTEXT_REPOSITORIES,
4387
+ `Invalid BlueContext repositories value: ${e}`,
4388
+ [
4389
+ {
4390
+ code: D.INVALID_BLUE_CONTEXT_REPOSITORIES,
4391
+ message: e,
4392
+ locationPath: [],
4393
+ context: {
4394
+ rawRepositories: s,
4395
+ reason: e
4396
+ }
4397
+ }
4398
+ ]
4399
+ );
4400
+ }
4401
+ function mn(s, e) {
4402
+ if (fn.has(s))
4403
+ throw re(e, `Forbidden repository name '${s}'`);
4404
+ }
4405
+ function In(s, e) {
4406
+ const t = s.filter((n) => n.repositoryVersionIndex > e).sort((n, i) => i.repositoryVersionIndex - n.repositoryVersionIndex), r = [];
4407
+ for (const n of t) {
4408
+ const i = [...n.attributesAdded].sort(
4409
+ (o, l) => wt(l) - wt(o)
4410
+ );
4411
+ r.push(...i);
4412
+ }
4413
+ return r;
4414
+ }
4415
+ function wt(s) {
4416
+ return Rt(s).length;
4417
+ }
4418
+ const Tn = /* @__PURE__ */ new Set([...rt]), B = {
4419
+ core: "core",
4420
+ noRuntime: "no-runtime",
4421
+ noTargetContext: "no-target-context",
4422
+ representable: "representable",
4423
+ unrepresentable: "unrepresentable"
4424
+ };
4425
+ class vn {
4426
+ registry;
4427
+ targetRepoVersionIndexes;
4428
+ fallbackToCurrentInlineDefinitions;
4429
+ inliningStack = /* @__PURE__ */ new Set();
4430
+ constructor(e) {
4431
+ this.registry = e.registry, this.targetRepoVersionIndexes = e.targetRepoVersionIndexes, this.fallbackToCurrentInlineDefinitions = e.fallbackToCurrentInlineDefinitions;
4432
+ }
4433
+ transform(e) {
4434
+ return w.transform(
4435
+ e,
4436
+ (t) => this.transformNode(t)
4437
+ );
4438
+ }
4439
+ transformNode(e) {
4440
+ return this.processTypeReference(e, {
4441
+ getter: () => e.getType(),
4442
+ setter: (t) => e.setType(t),
4443
+ schemaTraversalTargets: [e]
4444
+ }), this.processTypeReference(e, {
4445
+ getter: () => e.getItemType(),
4446
+ setter: (t) => e.setItemType(t),
4447
+ schemaTraversalTargets: e.getItems() ?? []
4448
+ }), this.processTypeReference(e, {
4449
+ getter: () => e.getKeyType(),
4450
+ setter: (t) => e.setKeyType(t),
4451
+ schemaTraversalTargets: []
4452
+ }), this.processTypeReference(e, {
4453
+ getter: () => e.getValueType(),
4454
+ setter: (t) => e.setValueType(t),
4455
+ schemaTraversalTargets: this.getDictionaryValueTargets(e)
4456
+ }), e;
4457
+ }
4458
+ processTypeReference(e, t) {
4459
+ const r = t.getter(), n = r?.getBlueId();
4460
+ if (!r || !n)
4461
+ return;
4462
+ const i = this.resolveType(n);
4463
+ switch (i.kind) {
4464
+ case B.core: {
4465
+ r.setBlueId(i.blueId);
4466
+ return;
4467
+ }
4468
+ case B.representable: {
4469
+ this.applyDropPointers([r], i.dropPointers, {
4470
+ rootIsSchema: !0
4471
+ }), this.applyDropPointers(
4472
+ t.schemaTraversalTargets,
4473
+ i.dropPointers
4474
+ ), r.setBlueId(i.targetBlueId);
4475
+ return;
4476
+ }
4477
+ case B.noRuntime:
4478
+ case B.noTargetContext:
4479
+ case B.unrepresentable: {
4480
+ if (this.fallbackToCurrentInlineDefinitions) {
4481
+ this.inlineDefinition(e, t.setter, n);
4482
+ return;
4483
+ }
4484
+ throw i.kind === B.unrepresentable ? i.error : this.unrepresentableError(
4485
+ n,
4486
+ i.kind === B.noTargetContext ? `Repository '${i.runtimeName}' not provided in BlueContext.` : "Type does not belong to any declared repository.",
4487
+ i.kind === B.noTargetContext ? i.runtime : void 0,
4488
+ i.kind === B.noTargetContext ? i.meta : void 0,
4489
+ void 0,
4490
+ i.kind === B.noTargetContext ? i.typeAlias : void 0
4491
+ );
4492
+ }
4493
+ }
4494
+ }
4495
+ resolveType(e) {
4496
+ if (X.includes(e))
4497
+ return { kind: B.core, blueId: e };
4498
+ const t = this.registry.toCurrentBlueId(e), r = this.registry.getTypeAlias(t), n = this.registry.findRuntimeByBlueId(t);
4499
+ if (!n || !n.typeMeta)
4500
+ return { kind: B.noRuntime };
4501
+ const i = this.targetRepoVersionIndexes[n.runtime.name];
4502
+ if (i === void 0)
4503
+ return {
4504
+ kind: B.noTargetContext,
4505
+ currentBlueId: t,
4506
+ runtimeName: n.runtime.name,
4507
+ runtime: n.runtime,
4508
+ meta: n.typeMeta,
4509
+ typeAlias: r
4510
+ };
4511
+ const o = n.typeMeta;
4512
+ if (o.status === tt) {
4513
+ const d = n.runtime.repositoryVersions.length - 1;
4514
+ if (i !== d)
4515
+ return {
4516
+ kind: B.unrepresentable,
4517
+ currentBlueId: t,
4518
+ error: this.unrepresentableError(
4519
+ t,
4520
+ `Dev type cannot be represented at repository version index ${i}.`,
4521
+ n.runtime,
4522
+ o,
4523
+ i,
4524
+ r
4525
+ )
4526
+ };
4527
+ const h = o.versions?.[0];
4528
+ return {
4529
+ kind: B.representable,
4530
+ currentBlueId: t,
4531
+ targetBlueId: h?.typeBlueId ?? t,
4532
+ dropPointers: []
4533
+ };
4534
+ }
4535
+ const l = o.versions || [];
4536
+ if (l.length === 0)
4537
+ return {
4538
+ kind: B.unrepresentable,
4539
+ currentBlueId: t,
4540
+ error: this.unrepresentableError(
4541
+ t,
4542
+ `Stable type metadata missing versions for ${t}.`,
4543
+ n.runtime,
4544
+ o,
4545
+ i,
4546
+ r
4547
+ )
4548
+ };
4549
+ const c = l[0].repositoryVersionIndex;
4550
+ if (i < c)
4551
+ return {
4552
+ kind: B.unrepresentable,
4553
+ currentBlueId: t,
4554
+ error: this.unrepresentableError(
4555
+ t,
4556
+ `Type introduced after target repository version index ${i}.`,
4557
+ n.runtime,
4558
+ o,
4559
+ i,
4560
+ r
4561
+ )
4562
+ };
4563
+ let u = l[0].typeBlueId;
4564
+ for (const d of l)
4565
+ d.repositoryVersionIndex <= i && (u = d.typeBlueId);
4566
+ const y = o.status === le ? this.getDropPointers(o, i) : [];
4567
+ return {
4568
+ kind: B.representable,
4569
+ currentBlueId: t,
4570
+ targetBlueId: u,
4571
+ dropPointers: y
4572
+ };
4573
+ }
4574
+ getDropPointers(e, t) {
4575
+ return e.status !== le ? [] : In(e.versions, t);
4576
+ }
4577
+ applyDropPointers(e, t, r = {}) {
4578
+ if (e.length === 0 || t.length === 0)
4579
+ return;
4580
+ const n = r.rootIsSchema ?? !1;
4581
+ for (const i of t)
4582
+ for (const o of e)
4583
+ this.deletePropertyAtPointer(o, i, n);
4584
+ }
4585
+ getDictionaryValueTargets(e) {
4586
+ const t = e.getProperties();
4587
+ return t ? Object.entries(t).filter(
4588
+ ([r, n]) => n instanceof a && !Tn.has(r)
4589
+ ).map(([, r]) => r) : [];
4590
+ }
4591
+ deletePropertyAtPointer(e, t, r) {
4592
+ let n;
4593
+ try {
4594
+ n = Rt(t);
4595
+ } catch {
4596
+ throw this.invalidPointerError(t);
4597
+ }
4598
+ this.applyPointerSegments(e, n, r);
4599
+ }
4600
+ applyPointerSegments(e, t, r) {
4601
+ if (t.length === 0)
4602
+ return;
4603
+ const [n, ...i] = t;
4604
+ if (n === Z) {
4605
+ const c = e.getType();
4606
+ c && this.applyPointerSegments(c, i, !0);
4607
+ return;
4608
+ }
4609
+ if (n === he) {
4610
+ const c = e.getItemType();
4611
+ c && this.applyPointerSegments(c, i, !0);
4612
+ return;
4613
+ }
4614
+ if (n === ye) {
4615
+ const c = e.getKeyType();
4616
+ c && this.applyPointerSegments(c, i, !0);
4617
+ return;
4618
+ }
4619
+ if (n === ge) {
4620
+ const c = e.getValueType();
4621
+ c && this.applyPointerSegments(c, i, !0);
4622
+ return;
4623
+ }
4624
+ const o = e.getProperties();
4625
+ if (!o)
4626
+ return;
4627
+ if (i.length === 0) {
4628
+ if (!r || !(n in o))
4629
+ return;
4630
+ const c = { ...o };
4631
+ delete c[n], e.setProperties(c);
4632
+ return;
4633
+ }
4634
+ const l = o[n];
4635
+ l instanceof a && this.applyPointerSegments(l, i, r);
4636
+ }
4637
+ inlineDefinition(e, t, r) {
4638
+ const n = this.registry.toCurrentBlueId(r);
4639
+ if (this.inliningStack.has(n))
4640
+ throw this.unrepresentableError(
4641
+ n,
4642
+ "Cycle detected while inlining type.",
4643
+ void 0,
4644
+ void 0,
4645
+ void 0,
4646
+ void 0,
4647
+ {
4648
+ cycle: Array.from(this.inliningStack).concat(n)
4649
+ }
4650
+ );
4651
+ const i = this.registry.getContents()[n];
4652
+ if (!i)
4653
+ throw this.unrepresentableError(
4654
+ n,
4655
+ `Missing definition to inline for BlueId ${n}.`
4656
+ );
4657
+ this.inliningStack.add(n);
4658
+ try {
4659
+ const o = g.deserialize(i);
4660
+ o.setBlueId(void 0);
4661
+ const l = w.transform(
4662
+ o,
4663
+ (c) => this.transformNode(c)
4664
+ );
4665
+ return t(l), e;
4666
+ } finally {
4667
+ this.inliningStack.delete(n);
4668
+ }
4669
+ }
4670
+ invalidPointerError(e) {
4671
+ const t = `Invalid attributesAdded pointer '${e}'.`;
4672
+ return new Re(D.INVALID_REPOSITORY_POINTER, t, [
4673
+ {
4674
+ code: D.INVALID_REPOSITORY_POINTER,
4675
+ message: t,
4676
+ locationPath: [],
4677
+ context: { pointer: e }
4678
+ }
4679
+ ]);
4680
+ }
4681
+ unrepresentableError(e, t, r, n, i, o, l) {
4682
+ const c = {
4683
+ currentTypeBlueId: e,
4684
+ targetRepoVersionIndex: i,
4685
+ typeAlias: o,
4686
+ ...l
4687
+ };
4688
+ if (r && (i !== void 0 && (c.requestedRepoBlueId = r.repositoryVersions[i]), c.serverRepoBlueId = r.currentRepoBlueId), n && n.status === le) {
4689
+ const y = n.versions?.[0]?.repositoryVersionIndex;
4690
+ y !== void 0 && (c.typeIntroducedInRepoBlueId = r?.repositoryVersions[y]);
4691
+ }
4692
+ const u = {
4693
+ code: D.REPO_UNREPRESENTABLE_IN_TARGET_VERSION,
4694
+ message: t,
4695
+ locationPath: [Z],
4696
+ context: c
4697
+ };
4698
+ return new Re(
4699
+ D.REPO_UNREPRESENTABLE_IN_TARGET_VERSION,
4700
+ t,
4701
+ [u]
4702
+ );
4703
+ }
4704
+ }
4705
+ function Xe(s, e) {
4706
+ return e ? w.transform(s, (t) => (ve(
4707
+ () => t.getType(),
4708
+ (r) => t.setType(r),
4709
+ e
4710
+ ), ve(
4711
+ () => t.getItemType(),
4712
+ (r) => t.setItemType(r),
4713
+ e
4714
+ ), ve(
4715
+ () => t.getKeyType(),
4716
+ (r) => t.setKeyType(r),
4717
+ e
4718
+ ), ve(
4719
+ () => t.getValueType(),
4720
+ (r) => t.setValueType(r),
4721
+ e
4722
+ ), t)) : s;
4723
+ }
4724
+ function ve(s, e, t) {
4725
+ const r = s();
4726
+ if (!r || r.isInlineValue())
4727
+ return;
4728
+ const n = r.getBlueId();
4729
+ if (!n)
4730
+ return;
4731
+ const i = t.toCurrentBlueId(n);
4732
+ i !== n && e(r.clone().setBlueId(i));
4733
+ }
4734
+ class Bn {
4735
+ registry;
4736
+ blueIdMapper;
4737
+ constructor(e) {
4738
+ this.registry = e.registry, this.blueIdMapper = e.blueIdMapper;
4739
+ }
4740
+ transform(e, t) {
4741
+ const r = this.computeTargetRepoVersionIndexes(t);
4742
+ if (Object.keys(r).length === 0)
4743
+ return e;
4744
+ const n = Xe(e, this.blueIdMapper);
4745
+ return new vn({
4746
+ registry: this.registry,
4747
+ targetRepoVersionIndexes: r,
4748
+ fallbackToCurrentInlineDefinitions: t.fallbackToCurrentInlineDefinitions !== !1
4749
+ }).transform(n);
4750
+ }
4751
+ computeTargetRepoVersionIndexes(e) {
4752
+ const t = {};
4753
+ if (!e?.repositories)
4754
+ return t;
4755
+ const r = typeof e.repositories == "string" ? gn(e.repositories) : e.repositories;
4756
+ for (const [n, i] of Object.entries(r)) {
4757
+ const o = this.registry.findRuntimeByName(n);
4758
+ if (!o)
4759
+ continue;
4760
+ const l = o.repoVersionIndexById[i];
4761
+ if (l === void 0)
4762
+ throw this.unknownRepoBlueIdError(
4763
+ n,
4764
+ i,
4765
+ o.currentRepoBlueId
4766
+ );
4767
+ t[n] = l;
4768
+ }
4769
+ return t;
4770
+ }
4771
+ unknownRepoBlueIdError(e, t, r) {
4772
+ const n = `Unknown RepoBlueId '${t}' for repository '${e}'.`, i = {
4773
+ code: D.REPO_UNKNOWN_REPO_BLUE_ID,
4774
+ message: n,
4775
+ locationPath: [],
4776
+ context: {
4777
+ repoName: e,
4778
+ requestedRepoBlueId: t,
4779
+ serverRepoBlueId: r
4780
+ }
4781
+ };
4782
+ return new Re(D.REPO_UNKNOWN_REPO_BLUE_ID, n, [
4783
+ i
4784
+ ]);
4785
+ }
4786
+ }
4787
+ class ri {
4053
4788
  nodeProvider;
4054
4789
  typeSchemaResolver;
4055
4790
  blueDirectivePreprocessor;
4056
4791
  urlContentFetcher;
4057
4792
  blueIdsMappingGenerator;
4058
- globalLimits = R;
4793
+ globalLimits = K;
4059
4794
  mergingProcessor;
4060
4795
  repositories;
4796
+ repositoryRegistry;
4797
+ blueContextResolver;
4061
4798
  constructor(e = {}) {
4062
4799
  const {
4063
4800
  nodeProvider: t,
@@ -4066,34 +4803,50 @@ class fn {
4066
4803
  repositories: i,
4067
4804
  mergingProcessor: o
4068
4805
  } = e;
4069
- this.repositories = i;
4070
- const l = as(() => []);
4071
- if (this.nodeProvider = oe.wrap(
4806
+ this.repositories = i, this.repositoryRegistry = new qs(i ?? []), this.blueContextResolver = new Bn({
4807
+ registry: this.repositoryRegistry,
4808
+ blueIdMapper: this.repositoryRegistry
4809
+ });
4810
+ const l = Ps(() => []);
4811
+ this.nodeProvider = fe.wrap(
4072
4812
  t || l,
4073
4813
  i
4074
- ), this.typeSchemaResolver = r ?? new Jr([], { nodeProvider: this.nodeProvider }), this.typeSchemaResolver?.setNodeProvider(this.nodeProvider), this.mergingProcessor = o ?? Ds(), this.urlContentFetcher = new As(n), this.blueDirectivePreprocessor = new Es(
4814
+ ), this.typeSchemaResolver = r ?? new us([], {
4815
+ nodeProvider: this.nodeProvider
4816
+ }), this.typeSchemaResolver?.setNodeProvider(this.nodeProvider), this.mergingProcessor = o ?? Ws(), this.urlContentFetcher = new Gs(n), this.blueDirectivePreprocessor = new Ys(
4075
4817
  void 0,
4076
4818
  this.urlContentFetcher
4077
- ), this.blueIdsMappingGenerator = new Dt(), i)
4078
- for (const { schemas: c, blueIds: u } of i)
4079
- this.typeSchemaResolver?.registerSchemas(c), this.blueIdsMappingGenerator.registerBlueIds(u);
4819
+ ), this.blueIdsMappingGenerator = new ht(), this.blueIdsMappingGenerator.registerBlueIds(
4820
+ this.repositoryRegistry.getAliases()
4821
+ );
4822
+ const c = this.repositoryRegistry.getRuntimes().flatMap((u) => u.schemas);
4823
+ c.length > 0 && this.typeSchemaResolver?.registerSchemas(c);
4080
4824
  }
4081
4825
  /**
4082
4826
  * Converts a BlueNode to a JSON representation based on the specified strategy.
4083
4827
  *
4084
4828
  * @param node - The BlueNode to convert.
4085
- * @param strategy - The conversion strategy to use. See {@link NodeToMapListOrValue.get} for detailed strategy descriptions.
4829
+ * @param strategyOrOptions - The conversion strategy or options to use. See {@link NodeToMapListOrValue.get} for detailed strategy descriptions.
4086
4830
  * @returns A JSON representation of the node.
4087
4831
  */
4088
4832
  nodeToJson(e, t = "official") {
4089
- return m.get(e, t);
4833
+ const r = this.normalizeNodeToJsonOptions(t), n = r.blueContext ? this.blueContextResolver.transform(e, r.blueContext) : e;
4834
+ return m.get(n, r.format);
4835
+ }
4836
+ /**
4837
+ * Converts a BlueNode to a deterministic YAML string. Uses nodeToJson under the hood
4838
+ * and then applies stable key ordering (Blue fields first, then alpha) before dumping.
4839
+ */
4840
+ nodeToYaml(e, t = "official") {
4841
+ const r = this.normalizeNodeToJsonOptions(t), n = r.blueContext ? this.blueContextResolver.transform(e, r.blueContext) : e;
4842
+ return Os.get(n, { strategy: r.format });
4090
4843
  }
4091
4844
  nodeToSchemaOutput(e, t) {
4092
- return new cs(this.typeSchemaResolver).convert(e, t);
4845
+ return new Ns(this.typeSchemaResolver).convert(e, t);
4093
4846
  }
4094
- resolve(e, t = R) {
4847
+ resolve(e, t = K) {
4095
4848
  const r = this.combineWithGlobalLimits(t);
4096
- return new Cs(this.mergingProcessor, this.nodeProvider).resolve(e, r);
4849
+ return new Zs(this.mergingProcessor, this.nodeProvider).resolve(e, r);
4097
4850
  }
4098
4851
  /**
4099
4852
  * Wraps an already resolved (merged) BlueNode in a ResolvedBlueNode.
@@ -4104,10 +4857,10 @@ class fn {
4104
4857
  * @returns A new ResolvedBlueNode instance.
4105
4858
  */
4106
4859
  createResolvedNode(e) {
4107
- return e instanceof ie ? e : new ie(e);
4860
+ return e instanceof pe ? e : new pe(e);
4108
4861
  }
4109
4862
  reverse(e) {
4110
- return new St().reverse(e);
4863
+ return new Ht().reverse(e);
4111
4864
  }
4112
4865
  /**
4113
4866
  * Returns a copy of the provided node with any referenced types converted back to their
@@ -4117,29 +4870,33 @@ class fn {
4117
4870
  * repository-backed definitions currently known to this {@link Blue} instance.
4118
4871
  */
4119
4872
  restoreInlineTypes(e) {
4120
- return new Fs({
4873
+ return new Xs({
4121
4874
  nodeProvider: this.nodeProvider,
4122
4875
  blueIdsMappingGenerator: this.blueIdsMappingGenerator
4123
4876
  }).restore(e);
4124
4877
  }
4125
4878
  extend(e, t) {
4126
4879
  const r = this.combineWithGlobalLimits(t);
4127
- new qe(this.nodeProvider).extend(e, r);
4880
+ new ft(this.nodeProvider).extend(e, r);
4128
4881
  }
4129
4882
  jsonValueToNode(e) {
4130
- return this.preprocess(g.deserialize(e));
4883
+ const t = this.preprocess(g.deserialize(e));
4884
+ return Xe(t, this.repositoryRegistry);
4131
4885
  }
4132
4886
  async jsonValueToNodeAsync(e) {
4133
- return this.preprocessAsync(g.deserialize(e));
4887
+ const t = await this.preprocessAsync(
4888
+ g.deserialize(e)
4889
+ );
4890
+ return Xe(t, this.repositoryRegistry);
4134
4891
  }
4135
4892
  yamlToNode(e) {
4136
- const t = F(e);
4893
+ const t = $(e);
4137
4894
  if (!t)
4138
4895
  throw new Error("Failed to parse YAML to JSON");
4139
4896
  return this.jsonValueToNode(t);
4140
4897
  }
4141
4898
  async yamlToNodeAsync(e) {
4142
- const t = F(e);
4899
+ const t = $(e);
4143
4900
  if (!t)
4144
4901
  throw new Error("Failed to parse YAML to JSON");
4145
4902
  return this.jsonValueToNodeAsync(t);
@@ -4161,26 +4918,26 @@ class fn {
4161
4918
  }
4162
4919
  preprocess(e) {
4163
4920
  const t = this.blueDirectivePreprocessor.process(e);
4164
- return new X({
4921
+ return new ne({
4165
4922
  nodeProvider: this.nodeProvider,
4166
4923
  blueIdsMappingGenerator: this.blueIdsMappingGenerator
4167
4924
  }).preprocessWithDefaultBlue(t);
4168
4925
  }
4169
4926
  async preprocessAsync(e) {
4170
4927
  const t = await this.blueDirectivePreprocessor.processAsync(e);
4171
- return new X({
4928
+ return new ne({
4172
4929
  nodeProvider: this.nodeProvider,
4173
4930
  blueIdsMappingGenerator: this.blueIdsMappingGenerator
4174
4931
  }).preprocessWithDefaultBlue(t);
4175
4932
  }
4176
4933
  transform(e, t) {
4177
- return E.transform(e, t);
4934
+ return w.transform(e, t);
4178
4935
  }
4179
4936
  getNodeProvider() {
4180
4937
  return this.nodeProvider;
4181
4938
  }
4182
4939
  setNodeProvider(e) {
4183
- return this.nodeProvider = oe.wrap(
4940
+ return this.nodeProvider = fe.wrap(
4184
4941
  e,
4185
4942
  this.repositories
4186
4943
  ), this.typeSchemaResolver?.setNodeProvider(this.nodeProvider), this;
@@ -4304,7 +5061,7 @@ class fn {
4304
5061
  * @returns true if the node matches the schema type, false otherwise
4305
5062
  */
4306
5063
  isTypeOf(e, t, r) {
4307
- return A.isTypeOf(e, t, {
5064
+ return V.isTypeOf(e, t, {
4308
5065
  checkSchemaExtensions: r?.checkSchemaExtensions,
4309
5066
  typeSchemaResolver: this.typeSchemaResolver
4310
5067
  });
@@ -4317,7 +5074,7 @@ class fn {
4317
5074
  * @returns true if the node matches the type, false otherwise.
4318
5075
  */
4319
5076
  isTypeOfNode(e, t) {
4320
- return new Hr(this).matchesType(e, t, this.globalLimits);
5077
+ return new ps(this).matchesType(e, t, this.globalLimits);
4321
5078
  }
4322
5079
  /**
4323
5080
  * Sets the global limits for this Blue instance.
@@ -4327,7 +5084,7 @@ class fn {
4327
5084
  * @returns This instance for chaining
4328
5085
  */
4329
5086
  setGlobalLimits(e) {
4330
- return this.globalLimits = e ?? R, this;
5087
+ return this.globalLimits = e ?? K, this;
4331
5088
  }
4332
5089
  /**
4333
5090
  * Gets the current global limits for this Blue instance.
@@ -4337,24 +5094,30 @@ class fn {
4337
5094
  getGlobalLimits() {
4338
5095
  return this.globalLimits;
4339
5096
  }
5097
+ normalizeNodeToJsonOptions(e) {
5098
+ return typeof e == "string" ? { format: e, blueContext: void 0 } : {
5099
+ format: e?.format ?? "official",
5100
+ blueContext: e?.blueContext
5101
+ };
5102
+ }
4340
5103
  combineWithGlobalLimits(e) {
4341
- return this.globalLimits == R ? e : e == R ? this.globalLimits : Ne.of(this.globalLimits, e);
5104
+ return this.globalLimits == K ? e : e == K ? this.globalLimits : _e.of(this.globalLimits, e);
4342
5105
  }
4343
5106
  }
4344
- class gn extends Ct {
5107
+ class si extends qt {
4345
5108
  blueIdToContentMap = /* @__PURE__ */ new Map();
4346
5109
  blueIdToMultipleDocumentsMap = /* @__PURE__ */ new Map();
4347
5110
  preprocessor;
4348
5111
  constructor(e = []) {
4349
5112
  super();
4350
- const t = new X({ nodeProvider: this });
5113
+ const t = new ne({ nodeProvider: this });
4351
5114
  this.preprocessor = (r) => t.preprocessWithDefaultBlue(r), e.forEach((r) => this.processNode(r));
4352
5115
  }
4353
5116
  processNode(e) {
4354
- Ze.hasItemsOnly(e) ? this.processNodeWithItems(e) : this.processSingleNode(e);
5117
+ ut.hasItemsOnly(e) ? this.processNodeWithItems(e) : this.processSingleNode(e);
4355
5118
  }
4356
5119
  processSingleNode(e) {
4357
- const t = x.parseAndCalculateBlueIdForNode(
5120
+ const t = z.parseAndCalculateBlueIdForNode(
4358
5121
  e,
4359
5122
  this.preprocessor
4360
5123
  );
@@ -4369,7 +5132,7 @@ class gn extends Ct {
4369
5132
  const t = e.getItems();
4370
5133
  if (!t) return;
4371
5134
  this.processNodeList(t);
4372
- const r = x.parseAndCalculateBlueIdForNodeList(
5135
+ const r = z.parseAndCalculateBlueIdForNodeList(
4373
5136
  t,
4374
5137
  this.preprocessor
4375
5138
  );
@@ -4384,7 +5147,7 @@ class gn extends Ct {
4384
5147
  }
4385
5148
  fetchContentByBlueId(e) {
4386
5149
  const t = this.blueIdToContentMap.get(e), r = this.blueIdToMultipleDocumentsMap.get(e);
4387
- return t !== void 0 && r !== void 0 ? x.resolveThisReferences(
5150
+ return t !== void 0 && r !== void 0 ? z.resolveThisReferences(
4388
5151
  t,
4389
5152
  e,
4390
5153
  r
@@ -4403,7 +5166,7 @@ class gn extends Ct {
4403
5166
  */
4404
5167
  addSingleDocs(...e) {
4405
5168
  e.forEach((t) => {
4406
- const r = F(t);
5169
+ const r = $(t);
4407
5170
  if (r !== void 0) {
4408
5171
  const n = g.deserialize(r);
4409
5172
  this.processNode(n);
@@ -4446,7 +5209,7 @@ class gn extends Ct {
4446
5209
  * @param doc - The YAML document containing a list
4447
5210
  */
4448
5211
  addListAndItsItemsFromDoc(e) {
4449
- const t = F(e);
5212
+ const t = $(e);
4450
5213
  if (t !== void 0) {
4451
5214
  const n = g.deserialize(t).getItems();
4452
5215
  n && this.addListAndItsItems(n);
@@ -4468,69 +5231,70 @@ class gn extends Ct {
4468
5231
  }
4469
5232
  }
4470
5233
  export {
4471
- mr as Base58Sha256Provider,
4472
- gn as BasicNodeProvider,
4473
- fn as Blue,
5234
+ Mr as Base58Sha256Provider,
5235
+ si as BasicNodeProvider,
5236
+ ri as Blue,
4474
5237
  T as BlueIdCalculator,
4475
- Xs as BlueIdToCid,
5238
+ kn as BlueIdToCid,
4476
5239
  a as BlueNode,
4477
- A as BlueNodeTypeSchema,
4478
- yr as JsonCanonicalizer,
4479
- He as Limits,
4480
- Cs as Merger,
4481
- hn as MergingProcessors,
4482
- Vs as NodeResolver,
4483
- Ze as Nodes,
4484
- ie as ResolvedBlueNode,
4485
- Jr as TypeSchemaResolver,
4486
- Qs as applyBlueNodePatch,
4487
- we as baseBlueObjectSchema,
4488
- en as blueDescriptionField,
4489
- tn as blueIdField,
4490
- Ys as blueIdSchema,
4491
- rn as blueNameField,
4492
- sn as blueNodeField,
4493
- ks as blueObjectBooleanValueSchema,
4494
- zs as blueObjectNumberValueSchema,
4495
- se as blueObjectSchema,
4496
- Js as blueObjectStringListItemsSchema,
4497
- Gs as blueObjectStringValueSchema,
4498
- bs as calculateBlueId,
4499
- ln as calculateBlueIdSync,
4500
- rt as enrichWithBlueId,
4501
- Cr as getBlueDescriptionAnnotation,
4502
- Fr as getBlueIdAnnotation,
4503
- Rr as getBlueNameAnnotation,
4504
- xr as getBlueNodeAnnotation,
4505
- cn as getBlueObjectItems,
4506
- un as getBlueObjectProperties,
4507
- dn as getBlueObjectTypeLabel,
4508
- an as getBlueObjectValue,
4509
- Lr as getTypeBlueIdAnnotation,
4510
- or as hasBlueObjectBlueIdDefined,
4511
- lr as hasBlueObjectItemsDefined,
4512
- Hs as hasBlueObjectNameDefined,
4513
- cr as hasBlueObjectTypeDefined,
4514
- ar as hasBlueObjectValueDefined,
4515
- De as isBigDecimalNumber,
4516
- L as isBigIntegerNumber,
4517
- S as isBigNumber,
4518
- Bt as isBlueNodeSchema,
4519
- Zs as isBlueObject,
4520
- ws as isBlueObjectResolved,
4521
- Ws as isGivenBlueObjectTypeSchema,
4522
- mt as isJsonBlueArray,
4523
- yt as isJsonBlueObject,
4524
- qs as isJsonBlueValue,
4525
- pe as isUrl,
4526
- Ie as jsonBlueValueSchema,
4527
- pn as normalizeToBlueObject,
4528
- st as resolveBlueObjectItems,
4529
- Vr as withBlueDescription,
4530
- Dr as withBlueId,
4531
- Or as withBlueName,
4532
- $r as withBlueNode,
4533
- nn as withTypeBlueId,
4534
- on as yamlBlueDump,
4535
- F as yamlBlueParse
5240
+ V as BlueNodeTypeSchema,
5241
+ Je as JsonCanonicalizer,
5242
+ dt as Limits,
5243
+ Zs as Merger,
5244
+ ti as MergingProcessors,
5245
+ Js as NodeResolver,
5246
+ ut as Nodes,
5247
+ On as Properties,
5248
+ pe as ResolvedBlueNode,
5249
+ us as TypeSchemaResolver,
5250
+ Kn as applyBlueNodePatch,
5251
+ Fe as baseBlueObjectSchema,
5252
+ Yn as blueDescriptionField,
5253
+ zn as blueIdField,
5254
+ Dn as blueIdSchema,
5255
+ Gn as blueNameField,
5256
+ Jn as blueNodeField,
5257
+ Fn as blueObjectBooleanValueSchema,
5258
+ xn as blueObjectNumberValueSchema,
5259
+ ue as blueObjectSchema,
5260
+ $n as blueObjectStringListItemsSchema,
5261
+ Mn as blueObjectStringValueSchema,
5262
+ js as calculateBlueId,
5263
+ Hn as calculateBlueIdSync,
5264
+ vt as enrichWithBlueId,
5265
+ Jr as getBlueDescriptionAnnotation,
5266
+ Wr as getBlueIdAnnotation,
5267
+ qr as getBlueNameAnnotation,
5268
+ es as getBlueNodeAnnotation,
5269
+ Wn as getBlueObjectItems,
5270
+ qn as getBlueObjectProperties,
5271
+ Qn as getBlueObjectTypeLabel,
5272
+ Xn as getBlueObjectValue,
5273
+ rs as getTypeBlueIdAnnotation,
5274
+ Er as hasBlueObjectBlueIdDefined,
5275
+ Nr as hasBlueObjectItemsDefined,
5276
+ Ln as hasBlueObjectNameDefined,
5277
+ Pr as hasBlueObjectTypeDefined,
5278
+ Sr as hasBlueObjectValueDefined,
5279
+ Ge as isBigDecimalNumber,
5280
+ H as isBigIntegerNumber,
5281
+ A as isBigNumber,
5282
+ zt as isBlueNodeSchema,
5283
+ _n as isBlueObject,
5284
+ Us as isBlueObjectResolved,
5285
+ jn as isGivenBlueObjectTypeSchema,
5286
+ Lt as isJsonBlueArray,
5287
+ _t as isJsonBlueObject,
5288
+ Un as isJsonBlueValue,
5289
+ we as isUrl,
5290
+ Ae as jsonBlueValueSchema,
5291
+ ei as normalizeToBlueObject,
5292
+ Bt as resolveBlueObjectItems,
5293
+ Gr as withBlueDescription,
5294
+ Hr as withBlueId,
5295
+ Xr as withBlueName,
5296
+ Qr as withBlueNode,
5297
+ Zn as withTypeBlueId,
5298
+ Rs as yamlBlueDump,
5299
+ $ as yamlBlueParse
4536
5300
  };