@dotbep/core 0.2.8 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import oe from "jszip";
2
- import { z as a, ZodError as He } from "zod";
3
- const Ye = a.enum([
2
+ import { z as a, ZodError as Ve } from "zod";
3
+ const He = a.enum([
4
4
  "appointing-party",
5
5
  "lead-appointed-party",
6
6
  "appointed-party"
7
- ]), Qe = a.enum(["video", "document"]), et = a.enum(["zone", "location"]), tt = a.enum(["LR", "TB"]), Us = a.enum(["start", "end", "process", "decision", "automation"]), st = a.enum(["info", "warning", "blocking"]), nt = a.enum([
7
+ ]), Ye = a.enum(["video", "document"]), Qe = a.enum(["zone", "location"]), et = a.enum(["LR", "TB"]), Ds = a.enum(["start", "end", "process", "decision", "automation"]), tt = a.enum(["info", "warning", "blocking"]), st = a.enum([
8
8
  "roles",
9
9
  "members",
10
10
  "teams",
@@ -44,31 +44,31 @@ const Ye = a.enum([
44
44
  roleId: a.string(),
45
45
  description: a.string().optional(),
46
46
  bepEditor: a.boolean().optional()
47
- }).describe("A project participant identified by email. Each member holds one role, which determines their responsibilities across workflow steps."), it = a.object({
47
+ }).describe("A project participant identified by email. Each member holds one role, which determines their responsibilities across workflow steps."), nt = a.object({
48
48
  id: a.string().min(1).describe("Must comply with the naming convention token pattern."),
49
49
  name: a.string().min(1),
50
- isoRole: Ye,
50
+ isoRole: He,
51
51
  description: a.string().optional(),
52
52
  disciplineIds: a.array(a.string()).optional(),
53
53
  representativeEmail: a.email().optional().describe("ref Member.email"),
54
54
  memberEmails: a.array(a.email()).optional()
55
- }).describe("A company or discipline group participating in the project. Teams group members under an ISO role and can be assigned RACI responsibilities at the workflow level."), pe = it.refine((n) => !n.representativeEmail || (n.memberEmails ?? []).includes(n.representativeEmail), {
55
+ }).describe("A company or discipline group participating in the project. Teams group members under an ISO role and can be assigned RACI responsibilities at the workflow level."), pe = nt.refine((s) => !s.representativeEmail || (s.memberEmails ?? []).includes(s.representativeEmail), {
56
56
  message: "representativeEmail must be included in memberEmails.",
57
57
  path: ["representativeEmail"]
58
- }), ot = a.enum([
58
+ }), it = a.enum([
59
59
  "project",
60
60
  "team",
61
61
  "discipline",
62
62
  "assetType",
63
63
  "lbsZone",
64
64
  "lbsLocation"
65
- ]), rt = a.discriminatedUnion("type", [
66
- a.object({ type: a.literal("field"), token: ot, pattern: a.string().optional() }),
65
+ ]), ot = a.discriminatedUnion("type", [
66
+ a.object({ type: a.literal("field"), token: it, pattern: a.string().optional() }),
67
67
  a.object({ type: a.literal("sequence"), padding: a.number().int().min(1).optional() })
68
68
  ]), he = a.object({
69
69
  delimiter: a.string().min(1),
70
- segments: a.array(rt).min(1)
71
- }).describe("A structured rule for generating deliverable names. Specifies a delimiter and a sequence of segments that are joined to produce consistent, parseable file names.").refine((n) => n.segments.filter((e) => e.type === "sequence").length <= 1, {
70
+ segments: a.array(ot).min(1)
71
+ }).describe("A structured rule for generating deliverable names. Specifies a delimiter and a sequence of segments that are joined to produce consistent, parseable file names.").refine((s) => s.segments.filter((e) => e.type === "sequence").length <= 1, {
72
72
  message: "segments can contain at most one sequence.",
73
73
  path: ["segments"]
74
74
  }), ge = a.object({
@@ -81,13 +81,13 @@ const Ye = a.enum([
81
81
  date: a.iso.date(),
82
82
  phaseId: a.string(),
83
83
  description: a.string().optional()
84
- }).describe("A named deadline within a phase. Anchors deliverables and information requirements to a specific date in the project timeline."), at = a.object({
84
+ }).describe("A named deadline within a phase. Anchors deliverables and information requirements to a specific date in the project timeline."), rt = a.object({
85
85
  id: a.string().min(1).describe("Used in deliverables nomenclature."),
86
86
  name: a.string().min(1),
87
- type: et,
87
+ type: Qe,
88
88
  description: a.string().optional(),
89
89
  lbsNodeIds: a.array(a.string()).optional().describe("ref LBSNode.id[]")
90
- }).describe("A spatial or functional subdivision of the project. LBS nodes form a hierarchy that scopes deliverables to specific spatial or functional areas."), be = at.refine((n) => !(n.lbsNodeIds ?? []).includes(n.id), {
90
+ }).describe("A spatial or functional subdivision of the project. LBS nodes form a hierarchy that scopes deliverables to specific spatial or functional areas."), be = rt.refine((s) => !(s.lbsNodeIds ?? []).includes(s.id), {
91
91
  message: "A node cannot reference itself in lbsNodeIds.",
92
92
  path: ["lbsNodeIds"]
93
93
  }), we = a.object({
@@ -142,10 +142,10 @@ const Ye = a.enum([
142
142
  description: a.string().min(1).describe("Describe what this handler checks and what decision it produces: what condition or business rule it evaluates and where that data comes from."),
143
143
  payload: a.array(L).optional().describe("Fields consumed from instance context and passed to the handler."),
144
144
  output: a.array(L).describe("Fields the handler must return. Guards on outgoing edges reference these.")
145
- }).describe("A system-executed node in a workflow. Runs a handler automatically, produces a typed output, and must be followed by a decision node that branches on that output."), dt = a.object({
145
+ }).describe("A system-executed node in a workflow. Runs a handler automatically, produces a typed output, and must be followed by a decision node that branches on that output."), at = a.object({
146
146
  hours: a.number().positive(),
147
147
  effectId: a.string().min(1).describe("ref FlowEffect.id")
148
- }).describe("A time-based escalation on a process or automation node. Fires a declared effect if the node has not been advanced within the given number of hours."), lt = a.object({
148
+ }).describe("A time-based escalation on a process or automation node. Fires a declared effect if the node has not been advanced within the given number of hours."), dt = a.object({
149
149
  responsibleRoleIds: a.array(a.string()).optional().describe("ref Role.id[]"),
150
150
  accountableRoleIds: a.array(a.string()).optional().describe("ref Role.id[]"),
151
151
  consultedRoleIds: a.array(a.string()).optional().describe("ref Role.id[]"),
@@ -158,46 +158,46 @@ const Ye = a.enum([
158
158
  accountableEmails: a.array(a.string()).optional().describe("ref Member.email[]"),
159
159
  consultedEmails: a.array(a.string()).optional().describe("ref Member.email[]"),
160
160
  informedEmails: a.array(a.string()).optional().describe("ref Member.email[]")
161
- }), Ae = a.object({
162
- timeouts: a.array(dt).optional()
163
- }), ct = a.object({
161
+ }), je = a.object({
162
+ timeouts: a.array(at).optional()
163
+ }), lt = a.object({
164
164
  type: a.literal("start")
165
- }), ft = a.object({
165
+ }), ct = a.object({
166
166
  type: a.literal("end")
167
- }), ut = a.object({
167
+ }), ft = a.object({
168
168
  type: a.literal("decision"),
169
169
  label: a.string().min(1)
170
- }), mt = a.object({
170
+ }), ut = a.object({
171
171
  type: a.literal("automation"),
172
172
  automationId: a.string().min(1).describe("ref FlowAutomation.id")
173
- }).extend(Ae.shape), pt = a.object({
173
+ }).extend(je.shape), mt = a.object({
174
174
  type: a.literal("process"),
175
175
  actionId: a.string().optional().describe("ref Action.id"),
176
176
  workflowId: a.string().optional().describe("ref Workflow.id — spawns child instances of this workflow when the node is entered."),
177
177
  blocking: a.boolean().optional().describe("If true, waits for all spawned child instances to complete before accepting outgoing transitions.")
178
- }).extend(lt.shape).extend(Ae.shape).refine((n) => !!n.actionId != !!n.workflowId, {
178
+ }).extend(dt.shape).extend(je.shape).refine((s) => !!s.actionId != !!s.workflowId, {
179
179
  message: "process nodes require exactly one of actionId or workflowId.",
180
180
  path: ["actionId"]
181
- }).refine((n) => !n.blocking || !!n.workflowId, {
181
+ }).refine((s) => !s.blocking || !!s.workflowId, {
182
182
  message: "blocking requires workflowId to be set.",
183
183
  path: ["blocking"]
184
184
  }).refine(
185
- (n) => (n.responsibleRoleIds?.length ?? 0) > 0 || (n.responsibleTeamIds?.length ?? 0) > 0 || (n.responsibleEmails?.length ?? 0) > 0,
185
+ (s) => (s.responsibleRoleIds?.length ?? 0) > 0 || (s.responsibleTeamIds?.length ?? 0) > 0 || (s.responsibleEmails?.length ?? 0) > 0,
186
186
  {
187
187
  message: "process nodes require at least one responsible (role, team, or email).",
188
188
  path: ["responsibleRoleIds"]
189
189
  }
190
- ), ht = a.union([
190
+ ), pt = a.union([
191
+ lt,
191
192
  ct,
192
193
  ft,
193
194
  ut,
194
- mt,
195
- pt
196
- ]).describe("A node in a workflow diagram used to describe steps."), gt = a.object({
195
+ mt
196
+ ]).describe("A node in a workflow diagram used to describe steps."), ht = a.object({
197
197
  field: a.string().min(1),
198
198
  operator: a.enum(["eq", "neq", "gt", "lt", "contains", "exists"]),
199
199
  value: a.union([a.string(), a.number(), a.boolean()]).optional()
200
- }).refine((n) => n.operator === "exists" || n.value !== void 0, {
200
+ }).refine((s) => s.operator === "exists" || s.value !== void 0, {
201
201
  message: 'value is required when operator is not "exists".',
202
202
  path: ["value"]
203
203
  }), ee = a.object({
@@ -205,22 +205,22 @@ const Ye = a.enum([
205
205
  to: a.string().describe("ref FlowNode key"),
206
206
  label: a.string().optional(),
207
207
  effectIds: a.array(a.string().min(1)).optional().describe("ref FlowEffect.id[]")
208
- }).refine((n) => n.from !== n.to, {
208
+ }).refine((s) => s.from !== s.to, {
209
209
  message: "A flow edge cannot point from a node to itself.",
210
210
  path: ["to"]
211
- }), yt = ee.extend({
211
+ }), gt = ee.extend({
212
212
  triggerEventId: a.string().min(1).describe("ref FlowEvent.id — the event that fires this transition")
213
- }), bt = ee.extend({
214
- guard: gt.describe("Condition evaluated against the instance context to determine which path to take.")
215
- }), wt = ee, vt = a.union([yt, bt, wt]), It = a.object({
216
- direction: tt.default("LR"),
217
- nodes: a.record(a.string(), ht),
218
- edges: a.record(a.string(), vt)
219
- }).superRefine((n, e) => {
220
- const t = Object.entries(n.nodes), s = t.filter(([, r]) => r.type === "start").length, i = t.filter(([, r]) => r.type === "end").length;
221
- s !== 1 && e.addIssue({
213
+ }), yt = ee.extend({
214
+ guard: ht.describe("Condition evaluated against the instance context to determine which path to take.")
215
+ }), bt = ee, wt = a.union([gt, yt, bt]), vt = a.object({
216
+ direction: et.default("LR"),
217
+ nodes: a.record(a.string(), pt),
218
+ edges: a.record(a.string(), wt)
219
+ }).superRefine((s, e) => {
220
+ const t = Object.entries(s.nodes), n = t.filter(([, r]) => r.type === "start").length, i = t.filter(([, r]) => r.type === "end").length;
221
+ n !== 1 && e.addIssue({
222
222
  code: "custom",
223
- message: `Diagram must have exactly one start node (found ${s}).`,
223
+ message: `Diagram must have exactly one start node (found ${n}).`,
224
224
  path: ["nodes"]
225
225
  }), i !== 1 && e.addIssue({
226
226
  code: "custom",
@@ -228,7 +228,7 @@ const Ye = a.enum([
228
228
  path: ["nodes"]
229
229
  });
230
230
  const o = {};
231
- for (const [r, d] of Object.entries(n.edges))
231
+ for (const [r, d] of Object.entries(s.edges))
232
232
  o[d.from] ??= [], o[d.from].push({ edgeId: r, toKey: d.to });
233
233
  for (const [r, d] of t) {
234
234
  const l = o[r] ?? [];
@@ -236,7 +236,7 @@ const Ye = a.enum([
236
236
  code: "custom",
237
237
  message: `automation node must have exactly one outgoing edge (found ${l.length}).`,
238
238
  path: ["nodes", r]
239
- }) : n.nodes[l[0].toKey]?.type !== "decision" && e.addIssue({
239
+ }) : s.nodes[l[0].toKey]?.type !== "decision" && e.addIssue({
240
240
  code: "custom",
241
241
  message: "automation node must connect directly to a decision node.",
242
242
  path: ["nodes", r]
@@ -246,8 +246,8 @@ const Ye = a.enum([
246
246
  path: ["nodes", r]
247
247
  });
248
248
  }
249
- for (const [r, d] of Object.entries(n.edges)) {
250
- const l = n.nodes[d.from];
249
+ for (const [r, d] of Object.entries(s.edges)) {
250
+ const l = s.nodes[d.from];
251
251
  if (!l) continue;
252
252
  const c = "triggerEventId" in d, u = "guard" in d;
253
253
  l.type === "start" && (c || u) && e.addIssue({
@@ -272,17 +272,17 @@ const Ye = a.enum([
272
272
  path: ["edges", r, "guard"]
273
273
  });
274
274
  }
275
- }).describe("The visual and structural definition of a workflow."), je = a.object({
275
+ }).describe("The visual and structural definition of a workflow."), Ae = a.object({
276
276
  id: a.uuid(),
277
277
  name: a.string().min(1),
278
278
  description: a.string().optional(),
279
279
  example: a.string().optional().describe("Narrative example showcasing one cycle of this workflow."),
280
280
  trackedAssetTypeId: a.string().optional().describe("ref AssetType.id"),
281
- diagram: It
281
+ diagram: vt
282
282
  }).describe("A reusable process definition associated with one or more BIM uses. Describes the ordered steps, responsibilities, and transitions that govern how work is carried out."), Oe = a.object({
283
283
  id: a.uuid(),
284
284
  name: a.string().min(1),
285
- type: Qe,
285
+ type: Ye,
286
286
  url: a.string().min(1),
287
287
  description: a.string().optional()
288
288
  }).describe("Supporting material attached to the BEP, such as a reference document or instructional video."), _e = a.object({
@@ -303,7 +303,7 @@ const Ye = a.enum([
303
303
  id: a.string().min(1),
304
304
  name: a.string().min(1),
305
305
  checklist: a.array(a.string()).optional()
306
- }).describe("An information detail level assigned to model elements in LOIN requirements. Specifies the non-geometric properties required of a model element at a given milestone."), Et = a.object({
306
+ }).describe("An information detail level assigned to model elements in LOIN requirements. Specifies the non-geometric properties required of a model element at a given milestone."), It = a.object({
307
307
  milestoneId: a.string(),
308
308
  lodId: a.string().min(1),
309
309
  loiId: a.string().min(1),
@@ -312,22 +312,22 @@ const Ye = a.enum([
312
312
  id: a.uuid(),
313
313
  element: a.string().min(1),
314
314
  disciplineId: a.string(),
315
- milestones: a.array(Et).optional()
315
+ milestones: a.array(It).optional()
316
316
  }).describe("An information requirement for a model element. Declares what geometric detail and information properties are required for a specific model element and discipline across project milestones."), Fe = a.object({
317
317
  id: a.uuid(),
318
318
  message: a.string().min(1),
319
319
  memberEmail: a.email(),
320
320
  createdAt: a.iso.datetime()
321
- }).describe("A timestamped comment left by a project member on the BEP."), Nt = a.object({
321
+ }).describe("A timestamped comment left by a project member on the BEP."), Et = a.object({
322
322
  id: a.uuid(),
323
- entity: nt.nullable().describe("null = BEP-level flag"),
323
+ entity: st.nullable().describe("null = BEP-level flag"),
324
324
  entityId: a.string().nullable(),
325
- severity: st,
325
+ severity: tt,
326
326
  message: a.string().min(1),
327
327
  generatedAt: a.iso.datetime()
328
- }).describe("A diagnostic message attached to the BEP or one of its entities. Indicates an issue or observation with a severity level that guides the author."), Ce = Nt.refine((n) => n.entity === null == (n.entityId === null), {
328
+ }).describe("A diagnostic message attached to the BEP or one of its entities. Indicates an issue or observation with a severity level that guides the author."), Ce = Et.refine((s) => s.entity === null == (s.entityId === null), {
329
329
  message: "entity and entityId must both be null (BEP-level) or both be non-null (entity-level)."
330
- }), St = a.object({
330
+ }), Nt = a.object({
331
331
  id: a.uuid(),
332
332
  description: a.string().optional(),
333
333
  lbsNodeId: a.string().optional(),
@@ -340,7 +340,7 @@ const Ye = a.enum([
340
340
  predecessorId: a.string().optional(),
341
341
  url: a.url().optional(),
342
342
  resolverId: a.string().min(1).optional()
343
- }).describe("A formal output committed by a team at a milestone. Defines what must be delivered, in what format, by whom, and by when."), De = St.refine((n) => !n.predecessorId || n.predecessorId !== n.id, {
343
+ }).describe("A formal output committed by a team at a milestone. Defines what must be delivered, in what format, by whom, and by when."), De = Nt.refine((s) => !s.predecessorId || s.predecessorId !== s.id, {
344
344
  message: "predecessorId cannot reference the deliverable itself.",
345
345
  path: ["predecessorId"]
346
346
  }), Le = a.object({
@@ -350,19 +350,15 @@ const Ye = a.enum([
350
350
  }).describe("A runtime configuration entry for handlers. Used to store credentials, endpoints, or other runtime settings without hardcoding them."), Ue = a.object({
351
351
  id: a.string().min(1).describe('Human-readable slug, e.g. "google-sheet"'),
352
352
  name: a.string().min(1),
353
- description: a.string().min(1).describe("Describe what external data this fetches, from where, and what format it returns: which service or API it calls, what credentials it needs, and the shape of the raw payload it returns so the runtime developer and adapter author know what to expect."),
353
+ description: a.string().min(1).describe("Describe what external data this fetches, from where, and what format it returns: which service or API it calls, what credentials it needs, and the shape of the raw payload it returns."),
354
354
  envKeys: a.array(a.string().min(1)).describe("ref EnvVar.key[] — env vars required by this resolver handler.")
355
355
  }).describe("A server-side handler declared in the BEP bundle that authenticates against an external service, fetches data, and returns a raw payload for a live resource."), ze = a.object({
356
- id: a.string().min(1).describe('Human-readable slug, e.g. "discipline-progress"'),
357
- name: a.string().min(1),
358
- description: a.string().min(1).describe("Describe the input format (resolver output shape), the transformation applied, and the output format (lens-compatible shape) so the runtime developer can implement the correct mapping.")
359
- }).describe("A transformation function declared in the BEP bundle that converts resolver output into a compatible format."), Ze = a.object({
360
356
  id: a.uuid(),
361
357
  name: a.string().min(1),
362
358
  description: a.string().min(1).describe("Describe what this data source represents in the project context: what information it holds, how it is used in the BEP, and who or what system produces it."),
363
359
  url: a.url(),
364
360
  resolverId: a.string().min(1).optional().describe("ref Resolver.id")
365
- }).describe("A reference to an external data source that is fetched at runtime. The BEP does not store the data — it only declares where it lives and how to access it using a resolver."), zs = a.object({
361
+ }).describe("A reference to an external data source that is fetched at runtime. The BEP does not store the data — it only declares where it lives and how to access it using a resolver."), Ls = a.object({
366
362
  project: fe,
367
363
  deliverableNamingConvention: he.optional(),
368
364
  roles: a.array(ue),
@@ -383,9 +379,8 @@ const Ye = a.enum([
383
379
  automations: a.array(Te),
384
380
  env: a.array(Le),
385
381
  resolvers: a.array(Ue),
386
- adapters: a.array(ze),
387
- remoteData: a.array(Ze),
388
- workflows: a.array(je),
382
+ remoteData: a.array(ze),
383
+ workflows: a.array(Ae),
389
384
  guides: a.array(_e),
390
385
  annexes: a.array(Oe),
391
386
  standards: a.array(Be),
@@ -401,46 +396,46 @@ const Ye = a.enum([
401
396
  author: a.email().describe("ref Member.email"),
402
397
  description: a.string().min(1),
403
398
  diff: a.string().nullable().describe("Relative path to inverse diff (RFC 6902). null on v0.0.")
404
- }), kt = a.discriminatedUnion("type", [
399
+ }), St = a.discriminatedUnion("type", [
405
400
  re.extend({ type: a.literal("patch") }),
406
401
  re.extend({
407
402
  type: a.literal("version"),
408
403
  approvedBy: a.array(a.email()).describe("ref Member.email[]")
409
404
  })
410
- ]), Zs = a.object({
405
+ ]), Us = a.object({
411
406
  current: a.string().regex(/^\d+\.\d+$/).describe('Current version in "{major}.{minor}" format.'),
412
- versions: a.array(kt)
407
+ versions: a.array(St)
413
408
  });
414
- function B(n) {
415
- return n.roles ??= [], n.members ??= [], n.teams ??= [], n.phases ??= [], n.milestones ??= [], n.lbs ??= [], n.disciplines ??= [], n.extensions ??= [], n.assetTypes ??= [], n.softwares ??= [], n.objectives ??= [], n.bimUses ??= [], n.actions ??= [], n.events ??= [], n.effects ??= [], n.workflows ??= [], n.guides ??= [], n.annexes ??= [], n.standards ??= [], n.lods ??= [], n.lois ??= [], n.loin ??= [], n.deliverables ??= [], n.notes ??= [], n.flags ??= [], n.env ??= [], n.automations ??= [], n.resolvers ??= [], n.remoteData ??= [], n.adapters ??= [], n;
409
+ function B(s) {
410
+ return s.roles ??= [], s.members ??= [], s.teams ??= [], s.phases ??= [], s.milestones ??= [], s.lbs ??= [], s.disciplines ??= [], s.extensions ??= [], s.assetTypes ??= [], s.softwares ??= [], s.objectives ??= [], s.bimUses ??= [], s.actions ??= [], s.events ??= [], s.effects ??= [], s.workflows ??= [], s.guides ??= [], s.annexes ??= [], s.standards ??= [], s.lods ??= [], s.lois ??= [], s.loin ??= [], s.deliverables ??= [], s.notes ??= [], s.flags ??= [], s.env ??= [], s.automations ??= [], s.resolvers ??= [], s.remoteData ??= [], s;
416
411
  }
417
- const $t = "-", Rt = "^[A-Z0-9]{3}$";
418
- function Tt(n, e) {
412
+ const kt = "-", $t = "^[A-Z0-9]{3}$";
413
+ function Rt(s, e) {
419
414
  if (e) {
420
- const t = e.segments.find((s) => s.type === "field" && s.token === n);
415
+ const t = e.segments.find((n) => n.type === "field" && n.token === s);
421
416
  if (t?.type === "field" && t.pattern) return t.pattern;
422
417
  }
423
- return Rt;
418
+ return $t;
424
419
  }
425
- function x(n, e, t) {
426
- const s = t?.delimiter ?? $t, i = Tt(n, t);
427
- return new RegExp(i).test(e) ? e.includes(s) ? `"${e}" contains the naming delimiter "${s}"` : null : `"${e}" does not match naming pattern ${i} for token "${n}"`;
420
+ function x(s, e, t) {
421
+ const n = t?.delimiter ?? kt, i = Rt(s, t);
422
+ return new RegExp(i).test(e) ? e.includes(n) ? `"${e}" contains the naming delimiter "${n}"` : null : `"${e}" does not match naming pattern ${i} for token "${s}"`;
428
423
  }
429
- function At(n, e) {
430
- const t = [], s = (i, o) => {
424
+ function Tt(s, e) {
425
+ const t = [], n = (i, o) => {
431
426
  const r = x(i, o, e);
432
427
  r && t.push(r);
433
428
  };
434
- s("project", n.project.code);
435
- for (const i of n.teams) s("team", i.id);
436
- for (const i of n.disciplines) s("discipline", i.id);
437
- for (const i of n.assetTypes) s("assetType", i.id);
438
- for (const i of n.lbs) s(i.type === "zone" ? "lbsZone" : "lbsLocation", i.id);
429
+ n("project", s.project.code);
430
+ for (const i of s.teams) n("team", i.id);
431
+ for (const i of s.disciplines) n("discipline", i.id);
432
+ for (const i of s.assetTypes) n("assetType", i.id);
433
+ for (const i of s.lbs) n(i.type === "zone" ? "lbsZone" : "lbsLocation", i.id);
439
434
  return t;
440
435
  }
441
436
  class jt {
442
- constructor(e, t, s, i, o) {
443
- this.getItem = e, this.setItem = t, this.schema = s, this.validate = i, this.getBep = o;
437
+ constructor(e, t, n, i, o) {
438
+ this.getItem = e, this.setItem = t, this.schema = n, this.validate = i, this.getBep = o;
444
439
  }
445
440
  getItem;
446
441
  setItem;
@@ -453,13 +448,13 @@ class jt {
453
448
  update(e) {
454
449
  const t = this.schema.parse({ ...this.getItem(), ...e });
455
450
  if (this.validate && this.getBep) {
456
- const s = this.validate(t, this.getBep());
457
- if (s.length) throw new Error(s.join("; "));
451
+ const n = this.validate(t, this.getBep());
452
+ if (n.length) throw new Error(n.join("; "));
458
453
  }
459
454
  return this.setItem(t), t;
460
455
  }
461
456
  }
462
- const Je = [
457
+ const Ze = [
463
458
  // roles
464
459
  { entity: "members", references: "roles", inField: "roleId" },
465
460
  // members
@@ -499,29 +494,29 @@ const Je = [
499
494
  // lbs (self-referential)
500
495
  { entity: "lbs", references: "lbs", inField: "lbsNodeIds", array: !0 }
501
496
  ];
502
- function Ot(n, e, t) {
503
- return Je.filter((s) => s.references === e).flatMap((s) => t[s.entity].filter((o) => {
504
- const r = o[s.inField];
505
- return s.array ? Array.isArray(r) && r.includes(n) : r === n;
497
+ function At(s, e, t) {
498
+ return Ze.filter((n) => n.references === e).flatMap((n) => t[n.entity].filter((o) => {
499
+ const r = o[n.inField];
500
+ return n.array ? Array.isArray(r) && r.includes(s) : r === s;
506
501
  }).map((o) => {
507
502
  const r = o.id ?? o.email ?? "?";
508
- return `${String(s.entity)}["${r}"].${String(s.inField)}`;
503
+ return `${String(n.entity)}["${r}"].${String(n.inField)}`;
509
504
  }));
510
505
  }
511
- function ae(n, e, t) {
512
- return Je.filter((s) => s.entity === e).flatMap((s) => {
513
- const i = n[s.inField];
506
+ function ae(s, e, t) {
507
+ return Ze.filter((n) => n.entity === e).flatMap((n) => {
508
+ const i = s[n.inField];
514
509
  if (i == null || i === "") return [];
515
- const o = s.array ? i : [i], r = t[s.references];
516
- return o.filter((d) => !r.some((l) => (l.id ?? l.email) === d)).map((d) => `${String(s.references)}["${d}"] not found`);
510
+ const o = n.array ? i : [i], r = t[n.references];
511
+ return o.filter((d) => !r.some((l) => (l.id ?? l.email) === d)).map((d) => `${String(n.references)}["${d}"] not found`);
517
512
  });
518
513
  }
519
- function K(n) {
520
- return n instanceof He ? n.issues.map((e) => (e.path.length ? e.path.join(".") + ": " : "") + e.message).join("; ") : n.message;
514
+ function K(s) {
515
+ return s instanceof Ve ? s.issues.map((e) => (e.path.length ? e.path.join(".") + ": " : "") + e.message).join("; ") : s.message;
521
516
  }
522
517
  class y {
523
- constructor(e, t, s) {
524
- this.getItems = e, this.getBep = t, this.config = s, this.idField = s.idField ?? "id";
518
+ constructor(e, t, n) {
519
+ this.getItems = e, this.getBep = t, this.config = n, this.idField = n.idField ?? "id";
525
520
  }
526
521
  getItems;
527
522
  getBep;
@@ -534,15 +529,15 @@ class y {
534
529
  return this.getItems();
535
530
  }
536
531
  get(e) {
537
- const t = [], s = [];
532
+ const t = [], n = [];
538
533
  for (const i of e) {
539
534
  const o = this.getItems().find((r) => this.getId(r) === i);
540
- o ? t.push(o) : s.push({ id: i, error: `Not found: ${i}` });
535
+ o ? t.push(o) : n.push({ id: i, error: `Not found: ${i}` });
541
536
  }
542
- return { succeeded: t, failed: s };
537
+ return { succeeded: t, failed: n };
543
538
  }
544
539
  add(e) {
545
- const t = [], s = [];
540
+ const t = [], n = [];
546
541
  for (const i of e) {
547
542
  const o = { ...i };
548
543
  this.config.autoId && !o[this.idField] && (o[this.idField] = globalThis.crypto.randomUUID());
@@ -557,22 +552,22 @@ class y {
557
552
  if (c.length) throw new Error(c.join("; "));
558
553
  this.getItems().push(d), t.push(d);
559
554
  } catch (d) {
560
- s.push({ id: r, error: K(d) });
555
+ n.push({ id: r, error: K(d) });
561
556
  }
562
557
  }
563
- return { succeeded: t, failed: s };
558
+ return { succeeded: t, failed: n };
564
559
  }
565
560
  update(e) {
566
- const t = [], s = [];
561
+ const t = [], n = [];
567
562
  for (const i of e) {
568
563
  const o = String(i[this.idField]), r = this.getItems(), d = r.findIndex((c) => this.getId(c) === o);
569
564
  if (d === -1) {
570
- s.push({ id: o, error: `Not found: ${o}` });
565
+ n.push({ id: o, error: `Not found: ${o}` });
571
566
  continue;
572
567
  }
573
568
  const l = ae(i, this.config.key, this.getBep());
574
569
  if (l.length) {
575
- s.push({ id: o, error: l.join("; ") });
570
+ n.push({ id: o, error: l.join("; ") });
576
571
  continue;
577
572
  }
578
573
  try {
@@ -580,31 +575,31 @@ class y {
580
575
  if (u.length) throw new Error(u.join("; "));
581
576
  r[d] = c, t.push(r[d]);
582
577
  } catch (c) {
583
- s.push({ id: o, error: K(c) });
578
+ n.push({ id: o, error: K(c) });
584
579
  }
585
580
  }
586
- return { succeeded: t, failed: s };
581
+ return { succeeded: t, failed: n };
587
582
  }
588
583
  remove(e) {
589
- const t = [], s = [];
584
+ const t = [], n = [];
590
585
  for (const i of e) {
591
586
  const o = this.getItems(), r = o.findIndex((d) => this.getId(d) === i);
592
587
  if (r === -1) {
593
- s.push({ id: i, error: `Not found: ${i}` });
588
+ n.push({ id: i, error: `Not found: ${i}` });
594
589
  continue;
595
590
  }
596
591
  try {
597
- const d = Ot(i, this.config.key, this.getBep());
592
+ const d = At(i, this.config.key, this.getBep());
598
593
  if (d.length) throw new Error(`Referenced by: ${d.join(", ")}`);
599
594
  this.config.beforeRemove?.(i, this.getBep()), o.splice(r, 1), t.push(i);
600
595
  } catch (d) {
601
- s.push({ id: i, error: K(d) });
596
+ n.push({ id: i, error: K(d) });
602
597
  }
603
598
  }
604
- return { succeeded: t, failed: s };
599
+ return { succeeded: t, failed: n };
605
600
  }
606
601
  }
607
- class _t extends y {
602
+ class Ot extends y {
608
603
  constructor(e) {
609
604
  super(
610
605
  () => e().actions,
@@ -613,8 +608,8 @@ class _t extends y {
613
608
  key: "actions",
614
609
  schema: ke,
615
610
  autoId: !0,
616
- beforeRemove: (t, s) => {
617
- for (const i of s.workflows)
611
+ beforeRemove: (t, n) => {
612
+ for (const i of n.workflows)
618
613
  for (const [o, r] of Object.entries(i.diagram.nodes))
619
614
  if (r.type === "process" && r.actionId === t)
620
615
  throw new Error(`Referenced by: workflows["${i.id}"].diagram.nodes["${o}"].actionId`);
@@ -623,19 +618,7 @@ class _t extends y {
623
618
  );
624
619
  }
625
620
  }
626
- class Bt extends y {
627
- constructor(e) {
628
- super(
629
- () => e().adapters,
630
- e,
631
- {
632
- key: "adapters",
633
- schema: ze
634
- }
635
- );
636
- }
637
- }
638
- class Mt extends y {
621
+ class _t extends y {
639
622
  constructor(e) {
640
623
  super(
641
624
  () => e().annexes,
@@ -648,7 +631,7 @@ class Mt extends y {
648
631
  );
649
632
  }
650
633
  }
651
- class xt extends y {
634
+ class Bt extends y {
652
635
  constructor(e) {
653
636
  super(
654
637
  () => e().effects,
@@ -656,8 +639,8 @@ class xt extends y {
656
639
  {
657
640
  key: "effects",
658
641
  schema: Re,
659
- beforeRemove: (t, s) => {
660
- for (const i of s.workflows) {
642
+ beforeRemove: (t, n) => {
643
+ for (const i of n.workflows) {
661
644
  for (const [o, r] of Object.entries(i.diagram.nodes))
662
645
  if ((r.type === "process" || r.type === "automation") && r.timeouts?.some((d) => d.effectId === t))
663
646
  throw new Error(`Referenced by: workflows["${i.id}"].diagram.nodes["${o}"].timeouts[].effectId`);
@@ -670,7 +653,7 @@ class xt extends y {
670
653
  );
671
654
  }
672
655
  }
673
- class Pt extends y {
656
+ class Mt extends y {
674
657
  constructor(e) {
675
658
  super(
676
659
  () => e().automations,
@@ -678,8 +661,8 @@ class Pt extends y {
678
661
  {
679
662
  key: "automations",
680
663
  schema: Te,
681
- beforeRemove: (t, s) => {
682
- for (const i of s.workflows)
664
+ beforeRemove: (t, n) => {
665
+ for (const i of n.workflows)
683
666
  for (const [o, r] of Object.entries(i.diagram.nodes))
684
667
  if (r.type === "automation" && r.automationId === t)
685
668
  throw new Error(`Referenced by: workflows["${i.id}"].diagram.nodes["${o}"].automationId`);
@@ -688,7 +671,7 @@ class Pt extends y {
688
671
  );
689
672
  }
690
673
  }
691
- class Ft extends y {
674
+ class xt extends y {
692
675
  constructor(e) {
693
676
  super(
694
677
  () => e().env,
@@ -701,7 +684,7 @@ class Ft extends y {
701
684
  );
702
685
  }
703
686
  }
704
- class Ct extends y {
687
+ class Pt extends y {
705
688
  constructor(e) {
706
689
  super(
707
690
  () => e().events,
@@ -709,8 +692,8 @@ class Ct extends y {
709
692
  {
710
693
  key: "events",
711
694
  schema: $e,
712
- beforeRemove: (t, s) => {
713
- for (const i of s.workflows)
695
+ beforeRemove: (t, n) => {
696
+ for (const i of n.workflows)
714
697
  for (const [o, r] of Object.entries(i.diagram.edges))
715
698
  if ("triggerEventId" in r && r.triggerEventId === t)
716
699
  throw new Error(`Referenced by: workflows["${i.id}"].diagram.edges["${o}"].trigger`);
@@ -719,42 +702,42 @@ class Ct extends y {
719
702
  );
720
703
  }
721
704
  }
722
- function C(n) {
705
+ function C(s) {
723
706
  const e = /* @__PURE__ */ new Map();
724
- for (const t of n)
725
- for (const s of t.lbsNodeIds ?? [])
726
- e.set(s, t.id);
707
+ for (const t of s)
708
+ for (const n of t.lbsNodeIds ?? [])
709
+ e.set(n, t.id);
727
710
  return e;
728
711
  }
729
- function te(n) {
712
+ function te(s) {
730
713
  const e = /* @__PURE__ */ new Set();
731
- for (const t of n)
732
- for (const s of t.lbsNodeIds ?? []) e.add(s);
733
- return new Set(n.map((t) => t.id).filter((t) => !e.has(t)));
714
+ for (const t of s)
715
+ for (const n of t.lbsNodeIds ?? []) e.add(n);
716
+ return new Set(s.map((t) => t.id).filter((t) => !e.has(t)));
734
717
  }
735
- function Ke(n, e) {
736
- if (!n) return { zoneCode: "XXX", locationCode: "XXX" };
737
- const t = new Map(e.map((d) => [d.id, d])), s = C(e), i = te(e), o = t.get(n);
718
+ function Je(s, e) {
719
+ if (!s) return { zoneCode: "XXX", locationCode: "XXX" };
720
+ const t = new Map(e.map((d) => [d.id, d])), n = C(e), i = te(e), o = t.get(s);
738
721
  if (!o) return { zoneCode: "XXX", locationCode: "XXX" };
739
722
  if (i.has(o.id)) return { zoneCode: "ZZZ", locationCode: "ZZZ" };
740
723
  if (o.type === "zone") return { zoneCode: o.id, locationCode: "ZZZ" };
741
- let r = s.get(o.id);
724
+ let r = n.get(o.id);
742
725
  for (; r; ) {
743
726
  const d = t.get(r);
744
727
  if (!d) break;
745
728
  if (d.type === "zone" && !i.has(d.id))
746
729
  return { zoneCode: d.id, locationCode: o.id };
747
- r = s.get(r);
730
+ r = n.get(r);
748
731
  }
749
732
  return { zoneCode: "ZZZ", locationCode: o.id };
750
733
  }
751
- function Dt(n) {
752
- const e = [], t = new Map(n.map((d) => [d.id, d])), s = te(n);
753
- for (const d of s) {
734
+ function Ft(s) {
735
+ const e = [], t = new Map(s.map((d) => [d.id, d])), n = te(s);
736
+ for (const d of n) {
754
737
  const l = t.get(d);
755
738
  l && l.type !== "zone" && e.push(`Root node "${d}" must be of type "zone".`);
756
739
  }
757
- for (const d of n)
740
+ for (const d of s)
758
741
  if (d.type === "location")
759
742
  for (const l of d.lbsNodeIds ?? [])
760
743
  t.get(l)?.type === "zone" && e.push(`Node "${d.id}" (location) cannot have a zone child ("${l}").`);
@@ -768,39 +751,39 @@ function Dt(n) {
768
751
  return e.push(`Cycle detected in LBS tree at node "${d}".`), !0;
769
752
  return o.delete(d), !1;
770
753
  }
771
- for (const d of n)
754
+ for (const d of s)
772
755
  i.has(d.id) || r(d.id);
773
756
  return e;
774
757
  }
775
- function W(n) {
758
+ function W(s) {
776
759
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
777
- for (const s of n) {
778
- const i = (t.get(s.responsibleId) ?? 0) + 1;
779
- t.set(s.responsibleId, i), e.set(s.id, i);
760
+ for (const n of s) {
761
+ const i = (t.get(n.responsibleId) ?? 0) + 1;
762
+ t.set(n.responsibleId, i), e.set(n.id, i);
780
763
  }
781
764
  return e;
782
765
  }
783
766
  const F = "XXX";
784
- function qe(n, e, t, s, i) {
785
- const { zoneCode: o, locationCode: r } = Ke(n.lbsNodeId, s);
767
+ function Ke(s, e, t, n, i) {
768
+ const { zoneCode: o, locationCode: r } = Je(s.lbsNodeId, n);
786
769
  if (!i) {
787
- const l = String(t.get(n.id) ?? 0).padStart(3, "0");
788
- return [e, n.responsibleId, o, r, n.assetTypeId, n.disciplineId, l].join("-");
770
+ const l = String(t.get(s.id) ?? 0).padStart(3, "0");
771
+ return [e, s.responsibleId, o, r, s.assetTypeId, s.disciplineId, l].join("-");
789
772
  }
790
773
  return i.segments.map((l) => {
791
774
  if (l.type === "sequence") {
792
775
  const c = l.padding ?? 3;
793
- return String(t.get(n.id) ?? 0).padStart(c, "0");
776
+ return String(t.get(s.id) ?? 0).padStart(c, "0");
794
777
  }
795
778
  switch (l.token) {
796
779
  case "project":
797
780
  return e || F;
798
781
  case "team":
799
- return n.responsibleId || F;
782
+ return s.responsibleId || F;
800
783
  case "discipline":
801
- return n.disciplineId || F;
784
+ return s.disciplineId || F;
802
785
  case "assetType":
803
- return n.assetTypeId || F;
786
+ return s.assetTypeId || F;
804
787
  case "lbsZone":
805
788
  return o;
806
789
  case "lbsLocation":
@@ -808,14 +791,14 @@ function qe(n, e, t, s, i) {
808
791
  }
809
792
  }).join(i.delimiter);
810
793
  }
811
- function We(n, e, t, s) {
812
- const i = W(n);
813
- return new Map(n.map((o) => [
794
+ function qe(s, e, t, n) {
795
+ const i = W(s);
796
+ return new Map(s.map((o) => [
814
797
  o.id,
815
- qe(o, e, i, t, s)
798
+ Ke(o, e, i, t, n)
816
799
  ]));
817
800
  }
818
- class Lt {
801
+ class Ct {
819
802
  constructor(e) {
820
803
  this.getBep = e;
821
804
  }
@@ -829,19 +812,19 @@ class Lt {
829
812
  * Returns null if the deliverable id is not found.
830
813
  */
831
814
  getCode(e) {
832
- const t = this.getBep(), s = t.deliverables.find((o) => o.id === e);
833
- if (!s) return null;
815
+ const t = this.getBep(), n = t.deliverables.find((o) => o.id === e);
816
+ if (!n) return null;
834
817
  const i = W(t.deliverables);
835
- return qe(s, t.project.code, i, t.lbs, t.deliverableNamingConvention);
818
+ return Ke(n, t.project.code, i, t.lbs, t.deliverableNamingConvention);
836
819
  }
837
820
  /** Builds the complete map of deliverable.id → nomenclature code. */
838
821
  buildCodeMap() {
839
822
  const e = this.getBep();
840
- return We(e.deliverables, e.project.code, e.lbs, e.deliverableNamingConvention);
823
+ return qe(e.deliverables, e.project.code, e.lbs, e.deliverableNamingConvention);
841
824
  }
842
825
  }
843
- class Ut extends y {
844
- constructor(e, t, s, i, o) {
826
+ class Dt extends y {
827
+ constructor(e, t, n, i, o) {
845
828
  super(
846
829
  () => e().deliverables,
847
830
  e,
@@ -850,14 +833,14 @@ class Ut extends y {
850
833
  schema: De,
851
834
  autoId: !0
852
835
  }
853
- ), this.getTeams = t, this.getAssetTypes = s, this.getLBSNodes = i, this.getMilestones = o;
836
+ ), this.getTeams = t, this.getAssetTypes = n, this.getLBSNodes = i, this.getMilestones = o;
854
837
  }
855
838
  getTeams;
856
839
  getAssetTypes;
857
840
  getLBSNodes;
858
841
  getMilestones;
859
842
  listResolved() {
860
- const e = this.getBep(), t = We(e.deliverables, e.project.code, e.lbs), s = new Map(this.getTeams().listResolved().map((l) => [l.id, l])), i = new Map(this.getAssetTypes().listResolved().map((l) => [l.id, l])), o = new Map(this.getLBSNodes().listResolved().map((l) => [l.id, l])), r = new Map(this.getMilestones().listResolved().map((l) => [l.id, l])), d = /* @__PURE__ */ new Map();
843
+ const e = this.getBep(), t = qe(e.deliverables, e.project.code, e.lbs), n = new Map(this.getTeams().listResolved().map((l) => [l.id, l])), i = new Map(this.getAssetTypes().listResolved().map((l) => [l.id, l])), o = new Map(this.getLBSNodes().listResolved().map((l) => [l.id, l])), r = new Map(this.getMilestones().listResolved().map((l) => [l.id, l])), d = /* @__PURE__ */ new Map();
861
844
  for (const l of e.deliverables) {
862
845
  const c = r.get(l.milestoneId) ?? null;
863
846
  d.set(l.id, {
@@ -867,8 +850,8 @@ class Ut extends y {
867
850
  lbsNode: l.lbsNodeId ? o.get(l.lbsNodeId) ?? null : null,
868
851
  discipline: e.disciplines.find((u) => u.id === l.disciplineId) ?? null,
869
852
  assetType: i.get(l.assetTypeId) ?? null,
870
- extensions: (l.extensionIds ?? []).map((u) => e.extensions.find((m) => m.id === u)).filter(Boolean),
871
- responsible: s.get(l.responsibleId) ?? null,
853
+ extensions: (l.extensionIds ?? []).map((u) => e.extensions.find((f) => f.id === u)).filter(Boolean),
854
+ responsible: n.get(l.responsibleId) ?? null,
872
855
  milestone: c,
873
856
  predecessor: null
874
857
  });
@@ -881,7 +864,7 @@ class Ut extends y {
881
864
  return [...d.values()];
882
865
  }
883
866
  }
884
- class zt extends y {
867
+ class Lt extends y {
885
868
  constructor(e) {
886
869
  super(
887
870
  () => e().flags,
@@ -894,7 +877,7 @@ class zt extends y {
894
877
  );
895
878
  }
896
879
  }
897
- class Zt extends y {
880
+ class Ut extends y {
898
881
  constructor(e, t) {
899
882
  super(
900
883
  () => e().notes,
@@ -915,7 +898,7 @@ class Zt extends y {
915
898
  }));
916
899
  }
917
900
  }
918
- class Jt extends y {
901
+ class zt extends y {
919
902
  constructor(e, t) {
920
903
  super(
921
904
  () => e().bimUses,
@@ -924,13 +907,13 @@ class Jt extends y {
924
907
  key: "bimUses",
925
908
  schema: Se,
926
909
  autoId: !0,
927
- validate: (s, i) => {
910
+ validate: (n, i) => {
928
911
  const o = [];
929
- for (const r of s.objectiveIds ?? [])
912
+ for (const r of n.objectiveIds ?? [])
930
913
  i.objectives.some((d) => d.id === r) || o.push(`objectives["${r}"] not found`);
931
- for (const r of s.milestoneIds ?? [])
914
+ for (const r of n.milestoneIds ?? [])
932
915
  i.milestones.some((d) => d.id === r) || o.push(`milestones["${r}"] not found`);
933
- for (const r of s.workflowIds ?? [])
916
+ for (const r of n.workflowIds ?? [])
934
917
  i.workflows.some((d) => d.id === r) || o.push(`workflows["${r}"] not found`);
935
918
  return o;
936
919
  }
@@ -939,19 +922,19 @@ class Jt extends y {
939
922
  }
940
923
  getWorkflows;
941
924
  listResolved() {
942
- const e = this.getBep(), t = new Map(this.getWorkflows().listResolved().map((s) => [s.id, s]));
943
- return e.bimUses.map((s) => ({
944
- ...s,
945
- objectives: (s.objectiveIds ?? []).map((i) => e.objectives.find((o) => o.id === i)).filter(Boolean),
946
- milestones: (s.milestoneIds ?? []).map((i) => {
925
+ const e = this.getBep(), t = new Map(this.getWorkflows().listResolved().map((n) => [n.id, n]));
926
+ return e.bimUses.map((n) => ({
927
+ ...n,
928
+ objectives: (n.objectiveIds ?? []).map((i) => e.objectives.find((o) => o.id === i)).filter(Boolean),
929
+ milestones: (n.milestoneIds ?? []).map((i) => {
947
930
  const o = e.milestones.find((r) => r.id === i);
948
931
  return o ? { ...o, phase: e.phases.find((r) => r.id === o.phaseId) ?? null } : null;
949
932
  }).filter(Boolean),
950
- workflows: (s.workflowIds ?? []).map((i) => t.get(i)).filter(Boolean)
933
+ workflows: (n.workflowIds ?? []).map((i) => t.get(i)).filter(Boolean)
951
934
  }));
952
935
  }
953
936
  }
954
- class Kt extends y {
937
+ class Zt extends y {
955
938
  constructor(e) {
956
939
  super(
957
940
  () => e().disciplines,
@@ -959,15 +942,15 @@ class Kt extends y {
959
942
  {
960
943
  key: "disciplines",
961
944
  schema: we,
962
- validate: (t, s) => {
963
- const i = x("discipline", t.id, s.deliverableNamingConvention);
945
+ validate: (t, n) => {
946
+ const i = x("discipline", t.id, n.deliverableNamingConvention);
964
947
  return i ? [i] : [];
965
948
  }
966
949
  }
967
950
  );
968
951
  }
969
952
  }
970
- class qt extends y {
953
+ class Jt extends y {
971
954
  constructor(e) {
972
955
  super(
973
956
  () => e().guides,
@@ -983,11 +966,11 @@ class qt extends y {
983
966
  const e = this.getBep();
984
967
  return e.guides.map((t) => ({
985
968
  ...t,
986
- annexes: (t.annexIds ?? []).map((s) => e.annexes.find((i) => i.id === s)).filter(Boolean)
969
+ annexes: (t.annexIds ?? []).map((n) => e.annexes.find((i) => i.id === n)).filter(Boolean)
987
970
  }));
988
971
  }
989
972
  }
990
- class Wt extends y {
973
+ class Kt extends y {
991
974
  constructor(e) {
992
975
  super(
993
976
  () => e().lods,
@@ -995,15 +978,15 @@ class Wt extends y {
995
978
  {
996
979
  key: "lods",
997
980
  schema: Me,
998
- beforeRemove: (t, s) => {
999
- for (const i of s.loin)
981
+ beforeRemove: (t, n) => {
982
+ for (const i of n.loin)
1000
983
  if (i.milestones?.find((r) => r.lodId === t)) throw new Error(`Referenced by: loin["${i.id}"].milestones[lodId=${t}]`);
1001
984
  }
1002
985
  }
1003
986
  );
1004
987
  }
1005
988
  }
1006
- class Gt extends y {
989
+ class qt extends y {
1007
990
  constructor(e) {
1008
991
  super(
1009
992
  () => e().lois,
@@ -1011,15 +994,15 @@ class Gt extends y {
1011
994
  {
1012
995
  key: "lois",
1013
996
  schema: xe,
1014
- beforeRemove: (t, s) => {
1015
- for (const i of s.loin)
997
+ beforeRemove: (t, n) => {
998
+ for (const i of n.loin)
1016
999
  if (i.milestones?.find((r) => r.loiId === t)) throw new Error(`Referenced by: loin["${i.id}"].milestones[loiId=${t}]`);
1017
1000
  }
1018
1001
  }
1019
1002
  );
1020
1003
  }
1021
1004
  }
1022
- class Xt extends y {
1005
+ class Wt extends y {
1023
1006
  constructor(e) {
1024
1007
  super(
1025
1008
  () => e().loin,
@@ -1028,102 +1011,102 @@ class Xt extends y {
1028
1011
  key: "loin",
1029
1012
  schema: Pe,
1030
1013
  autoId: !0,
1031
- validate: (t, s) => {
1014
+ validate: (t, n) => {
1032
1015
  const i = [];
1033
1016
  for (const o of t.milestones ?? [])
1034
- s.milestones.some((r) => r.id === o.milestoneId) || i.push(`milestones["${o.milestoneId}"] not found`), s.lods.some((r) => r.id === o.lodId) || i.push(`lods[${o.lodId}] not found`), s.lois.some((r) => r.id === o.loiId) || i.push(`lois[${o.loiId}] not found`);
1017
+ n.milestones.some((r) => r.id === o.milestoneId) || i.push(`milestones["${o.milestoneId}"] not found`), n.lods.some((r) => r.id === o.lodId) || i.push(`lods[${o.lodId}] not found`), n.lois.some((r) => r.id === o.loiId) || i.push(`lois[${o.loiId}] not found`);
1035
1018
  return i;
1036
1019
  }
1037
1020
  }
1038
1021
  );
1039
1022
  }
1040
1023
  addMilestones(e) {
1041
- const t = [], s = [];
1024
+ const t = [], n = [];
1042
1025
  for (const i of e) {
1043
1026
  const o = this.getBep().loin.find((c) => c.id === i.loinId);
1044
1027
  if (!o) {
1045
- s.push({ loinId: i.loinId, error: `Not found: ${i.loinId}` });
1028
+ n.push({ loinId: i.loinId, error: `Not found: ${i.loinId}` });
1046
1029
  continue;
1047
1030
  }
1048
1031
  const r = i.milestones.find((c) => (o.milestones ?? []).some((u) => u.milestoneId === c.milestoneId));
1049
1032
  if (r) {
1050
- s.push({ loinId: i.loinId, error: `Milestone "${r.milestoneId}" already exists. Use updateMilestones to modify it.` });
1033
+ n.push({ loinId: i.loinId, error: `Milestone "${r.milestoneId}" already exists. Use updateMilestones to modify it.` });
1051
1034
  continue;
1052
1035
  }
1053
1036
  const d = [...o.milestones ?? [], ...i.milestones], l = this.update([{ id: i.loinId, milestones: d }]);
1054
1037
  if (l.failed.length > 0) {
1055
- s.push({ loinId: i.loinId, error: l.failed[0].error });
1038
+ n.push({ loinId: i.loinId, error: l.failed[0].error });
1056
1039
  continue;
1057
1040
  }
1058
1041
  t.push({ loinId: i.loinId, element: o.element, addedMilestones: i.milestones.map((c) => c.milestoneId) });
1059
1042
  }
1060
- return { succeeded: t, failed: s };
1043
+ return { succeeded: t, failed: n };
1061
1044
  }
1062
1045
  updateMilestones(e) {
1063
- const t = [], s = [];
1046
+ const t = [], n = [];
1064
1047
  for (const i of e) {
1065
- const o = this.getBep().loin.find((m) => m.id === i.loinId);
1048
+ const o = this.getBep().loin.find((f) => f.id === i.loinId);
1066
1049
  if (!o) {
1067
- s.push({ loinId: i.loinId, error: `Not found: ${i.loinId}` });
1050
+ n.push({ loinId: i.loinId, error: `Not found: ${i.loinId}` });
1068
1051
  continue;
1069
1052
  }
1070
- const r = i.milestones.find((m) => !(o.milestones ?? []).some((f) => f.milestoneId === m.milestoneId));
1053
+ const r = i.milestones.find((f) => !(o.milestones ?? []).some((m) => m.milestoneId === f.milestoneId));
1071
1054
  if (r) {
1072
- s.push({ loinId: i.loinId, error: `Milestone "${r.milestoneId}" not found. Use addMilestones to create it.` });
1055
+ n.push({ loinId: i.loinId, error: `Milestone "${r.milestoneId}" not found. Use addMilestones to create it.` });
1073
1056
  continue;
1074
1057
  }
1075
- const d = new Map(o.milestones.map((m) => [m.milestoneId, { lodId: m.lodId, loiId: m.loiId, idsPath: m.idsPath }])), l = (o.milestones ?? []).map((m) => {
1076
- const f = i.milestones.find((p) => p.milestoneId === m.milestoneId);
1077
- return f ? { ...m, ...f } : m;
1058
+ const d = new Map(o.milestones.map((f) => [f.milestoneId, { lodId: f.lodId, loiId: f.loiId, idsPath: f.idsPath }])), l = (o.milestones ?? []).map((f) => {
1059
+ const m = i.milestones.find((p) => p.milestoneId === f.milestoneId);
1060
+ return m ? { ...f, ...m } : f;
1078
1061
  }), c = this.update([{ id: i.loinId, milestones: l }]);
1079
1062
  if (c.failed.length > 0) {
1080
- s.push({ loinId: i.loinId, error: c.failed[0].error });
1063
+ n.push({ loinId: i.loinId, error: c.failed[0].error });
1081
1064
  continue;
1082
1065
  }
1083
- const u = this.getBep().loin.find((m) => m.id === i.loinId);
1066
+ const u = this.getBep().loin.find((f) => f.id === i.loinId);
1084
1067
  t.push({
1085
1068
  loinId: i.loinId,
1086
1069
  element: o.element,
1087
- milestones: i.milestones.map((m) => {
1088
- const f = u.milestones.find((g) => g.milestoneId === m.milestoneId), p = d.get(m.milestoneId);
1089
- return { milestoneId: m.milestoneId, before: p, after: { lodId: f.lodId, loiId: f.loiId, idsPath: f.idsPath } };
1070
+ milestones: i.milestones.map((f) => {
1071
+ const m = u.milestones.find((g) => g.milestoneId === f.milestoneId), p = d.get(f.milestoneId);
1072
+ return { milestoneId: f.milestoneId, before: p, after: { lodId: m.lodId, loiId: m.loiId, idsPath: m.idsPath } };
1090
1073
  })
1091
1074
  });
1092
1075
  }
1093
- return { succeeded: t, failed: s };
1076
+ return { succeeded: t, failed: n };
1094
1077
  }
1095
1078
  removeMilestones(e) {
1096
- const t = [], s = [];
1079
+ const t = [], n = [];
1097
1080
  for (const i of e) {
1098
1081
  const o = this.getBep().loin.find((d) => d.id === i.loinId);
1099
1082
  if (!o) {
1100
- s.push({ loinId: i.loinId, error: `Not found: ${i.loinId}` });
1083
+ n.push({ loinId: i.loinId, error: `Not found: ${i.loinId}` });
1101
1084
  continue;
1102
1085
  }
1103
1086
  const r = i.milestoneIds.filter((d) => !(o.milestones ?? []).some((l) => l.milestoneId === d));
1104
1087
  if (r.length > 0) {
1105
- s.push({ loinId: i.loinId, error: `Milestones not found in this LOIN: ${r.join(", ")}` });
1088
+ n.push({ loinId: i.loinId, error: `Milestones not found in this LOIN: ${r.join(", ")}` });
1106
1089
  continue;
1107
1090
  }
1108
1091
  o.milestones = (o.milestones ?? []).filter((d) => !i.milestoneIds.includes(d.milestoneId)), t.push({ loinId: i.loinId, element: o.element, removedMilestones: i.milestoneIds });
1109
1092
  }
1110
- return { succeeded: t, failed: s };
1093
+ return { succeeded: t, failed: n };
1111
1094
  }
1112
1095
  listResolved() {
1113
1096
  const e = this.getBep();
1114
1097
  return e.loin.map((t) => ({
1115
1098
  ...t,
1116
- discipline: e.disciplines.find((s) => s.id === t.disciplineId) ?? null,
1117
- milestones: (t.milestones ?? []).map((s) => ({
1118
- ...s,
1119
- milestone: e.milestones.find((i) => i.id === s.milestoneId) ?? null,
1120
- lod: e.lods.find((i) => i.id === s.lodId) ?? null,
1121
- loi: e.lois.find((i) => i.id === s.loiId) ?? null
1099
+ discipline: e.disciplines.find((n) => n.id === t.disciplineId) ?? null,
1100
+ milestones: (t.milestones ?? []).map((n) => ({
1101
+ ...n,
1102
+ milestone: e.milestones.find((i) => i.id === n.milestoneId) ?? null,
1103
+ lod: e.lods.find((i) => i.id === n.lodId) ?? null,
1104
+ loi: e.lois.find((i) => i.id === n.loiId) ?? null
1122
1105
  }))
1123
1106
  }));
1124
1107
  }
1125
1108
  }
1126
- class Vt extends y {
1109
+ class Gt extends y {
1127
1110
  constructor(e) {
1128
1111
  super(
1129
1112
  () => e().assetTypes,
@@ -1131,8 +1114,8 @@ class Vt extends y {
1131
1114
  {
1132
1115
  key: "assetTypes",
1133
1116
  schema: Ie,
1134
- validate: (t, s) => {
1135
- const i = x("assetType", t.id, s.deliverableNamingConvention);
1117
+ validate: (t, n) => {
1118
+ const i = x("assetType", t.id, n.deliverableNamingConvention);
1136
1119
  return i ? [i] : [];
1137
1120
  }
1138
1121
  }
@@ -1142,11 +1125,11 @@ class Vt extends y {
1142
1125
  const e = this.getBep();
1143
1126
  return e.assetTypes.map((t) => ({
1144
1127
  ...t,
1145
- extensions: (t.extensionIds ?? []).map((s) => e.extensions.find((i) => i.id === s)).filter(Boolean)
1128
+ extensions: (t.extensionIds ?? []).map((n) => e.extensions.find((i) => i.id === n)).filter(Boolean)
1146
1129
  }));
1147
1130
  }
1148
1131
  }
1149
- class Ht extends y {
1132
+ class Xt extends y {
1150
1133
  constructor(e) {
1151
1134
  super(
1152
1135
  () => e().extensions,
@@ -1158,7 +1141,7 @@ class Ht extends y {
1158
1141
  );
1159
1142
  }
1160
1143
  }
1161
- class Yt extends y {
1144
+ class Vt extends y {
1162
1145
  constructor(e) {
1163
1146
  super(
1164
1147
  () => e().roles,
@@ -1167,9 +1150,9 @@ class Yt extends y {
1167
1150
  key: "roles",
1168
1151
  schema: ue,
1169
1152
  autoId: !0,
1170
- beforeRemove: (t, s) => {
1153
+ beforeRemove: (t, n) => {
1171
1154
  const i = ["responsibleRoleIds", "accountableRoleIds", "consultedRoleIds", "informedRoleIds"];
1172
- for (const o of s.workflows)
1155
+ for (const o of n.workflows)
1173
1156
  for (const [r, d] of Object.entries(o.diagram.nodes))
1174
1157
  if (d.type === "process") {
1175
1158
  for (const l of i)
@@ -1181,7 +1164,7 @@ class Yt extends y {
1181
1164
  );
1182
1165
  }
1183
1166
  }
1184
- class Qt extends y {
1167
+ class Ht extends y {
1185
1168
  constructor(e) {
1186
1169
  super(
1187
1170
  () => e().lbs,
@@ -1189,10 +1172,10 @@ class Qt extends y {
1189
1172
  {
1190
1173
  key: "lbs",
1191
1174
  schema: be,
1192
- validate: (t, s) => {
1193
- const i = [], o = t.type === "zone" ? "lbsZone" : "lbsLocation", r = x(o, t.id, s.deliverableNamingConvention);
1175
+ validate: (t, n) => {
1176
+ const i = [], o = t.type === "zone" ? "lbsZone" : "lbsLocation", r = x(o, t.id, n.deliverableNamingConvention);
1194
1177
  if (r && i.push(r), t.type === "location" && t.lbsNodeIds?.length) {
1195
- const d = new Map(s.lbs.map((l) => [l.id, l]));
1178
+ const d = new Map(n.lbs.map((l) => [l.id, l]));
1196
1179
  for (const l of t.lbsNodeIds ?? [])
1197
1180
  d.get(l)?.type === "zone" && i.push(`Node "${t.id}" (location) cannot have a zone child ("${l}").`);
1198
1181
  }
@@ -1202,25 +1185,25 @@ class Qt extends y {
1202
1185
  );
1203
1186
  }
1204
1187
  listResolved() {
1205
- const e = this.getBep(), t = C(e.lbs), s = te(e.lbs), i = new Map(e.lbs.map((o) => [o.id, o]));
1188
+ const e = this.getBep(), t = C(e.lbs), n = te(e.lbs), i = new Map(e.lbs.map((o) => [o.id, o]));
1206
1189
  return e.lbs.map((o) => {
1207
1190
  const r = t.get(o.id), d = r ? i.get(r) : void 0;
1208
1191
  return {
1209
1192
  ...o,
1210
- isRoot: s.has(o.id),
1193
+ isRoot: n.has(o.id),
1211
1194
  parent: d ? { id: d.id, name: d.name, type: d.type } : null,
1212
1195
  children: (o.lbsNodeIds ?? []).map((l) => i.get(l)).filter(Boolean)
1213
1196
  };
1214
1197
  });
1215
1198
  }
1216
1199
  addNodes(e) {
1217
- const t = this.getBep(), s = [], i = [];
1200
+ const t = this.getBep(), n = [], i = [];
1218
1201
  for (const o of e) {
1219
1202
  if (!o.parentId && o.type !== "zone") {
1220
1203
  i.push({ input: o, error: 'Root nodes (no parentId) must be type "zone".' });
1221
1204
  continue;
1222
1205
  }
1223
- if (o.parentId && !t.lbs.find((m) => m.id === o.parentId)) {
1206
+ if (o.parentId && !t.lbs.find((f) => f.id === o.parentId)) {
1224
1207
  i.push({ input: o, error: `No LBS node found with ID "${o.parentId}".` });
1225
1208
  continue;
1226
1209
  }
@@ -1230,18 +1213,18 @@ class Qt extends y {
1230
1213
  continue;
1231
1214
  }
1232
1215
  let c;
1233
- r && (c = t.lbs.find((m) => m.id === r), c && (c.lbsNodeIds ??= [], c.lbsNodeIds.push(o.id)));
1216
+ r && (c = t.lbs.find((f) => f.id === r), c && (c.lbsNodeIds ??= [], c.lbsNodeIds.push(o.id)));
1234
1217
  const u = this.validateTree();
1235
1218
  if (u.length > 0) {
1236
- t.lbs.splice(t.lbs.findIndex((m) => m.id === o.id), 1), c?.lbsNodeIds && (c.lbsNodeIds = c.lbsNodeIds.filter((m) => m !== o.id)), i.push({ input: o, error: u.join("; ") });
1219
+ t.lbs.splice(t.lbs.findIndex((f) => f.id === o.id), 1), c?.lbsNodeIds && (c.lbsNodeIds = c.lbsNodeIds.filter((f) => f !== o.id)), i.push({ input: o, error: u.join("; ") });
1237
1220
  continue;
1238
1221
  }
1239
- s.push({ ...t.lbs.find((m) => m.id === o.id), parentId: r ?? null });
1222
+ n.push({ ...t.lbs.find((f) => f.id === o.id), parentId: r ?? null });
1240
1223
  }
1241
- return { succeeded: s, failed: i };
1224
+ return { succeeded: n, failed: i };
1242
1225
  }
1243
1226
  updateNodes(e) {
1244
- const t = this.getBep(), s = [], i = [];
1227
+ const t = this.getBep(), n = [], i = [];
1245
1228
  for (const o of e) {
1246
1229
  if (o.parentId && !t.lbs.find((h) => h.id === o.parentId)) {
1247
1230
  i.push({ id: o.id, error: `No LBS node found with ID "${o.parentId}".` });
@@ -1256,7 +1239,7 @@ class Qt extends y {
1256
1239
  i.push({ id: o.id, error: u.failed[0].error });
1257
1240
  continue;
1258
1241
  }
1259
- const m = { name: r.name, type: r.type, description: r.description, parentId: d }, f = t.lbs.find((h) => h.id === o.id);
1242
+ const f = { name: r.name, type: r.type, description: r.description, parentId: d }, m = t.lbs.find((h) => h.id === o.id);
1260
1243
  if (l !== void 0) {
1261
1244
  for (const h of t.lbs)
1262
1245
  h.lbsNodeIds?.includes(o.id) && (h.lbsNodeIds = h.lbsNodeIds.filter((b) => b !== o.id));
@@ -1267,32 +1250,32 @@ class Qt extends y {
1267
1250
  }
1268
1251
  const p = this.validateTree();
1269
1252
  if (p.length > 0) {
1270
- if (f.name = m.name, f.type = m.type, m.description !== void 0 ? f.description = m.description : delete f.description, l !== void 0) {
1253
+ if (m.name = f.name, m.type = f.type, f.description !== void 0 ? m.description = f.description : delete m.description, l !== void 0) {
1271
1254
  for (const h of t.lbs)
1272
1255
  h.lbsNodeIds?.includes(o.id) && (h.lbsNodeIds = h.lbsNodeIds.filter((b) => b !== o.id));
1273
- if (m.parentId) {
1274
- const h = t.lbs.find((b) => b.id === m.parentId);
1256
+ if (f.parentId) {
1257
+ const h = t.lbs.find((b) => b.id === f.parentId);
1275
1258
  h && (h.lbsNodeIds ??= [], h.lbsNodeIds.push(o.id));
1276
1259
  }
1277
1260
  }
1278
1261
  i.push({ id: o.id, error: p.join("; ") });
1279
1262
  continue;
1280
1263
  }
1281
- const g = C(t.lbs).get(f.id) ?? null;
1282
- s.push({ id: o.id, before: m, after: { name: f.name, type: f.type, description: f.description, parentId: g } });
1264
+ const g = C(t.lbs).get(m.id) ?? null;
1265
+ n.push({ id: o.id, before: f, after: { name: m.name, type: m.type, description: m.description, parentId: g } });
1283
1266
  }
1284
- return { succeeded: s, failed: i };
1267
+ return { succeeded: n, failed: i };
1285
1268
  }
1286
1269
  /** Resolves zone and location codes for nomenclature given a node id. */
1287
1270
  resolveCodes(e) {
1288
- return Ke(e, this.list());
1271
+ return Je(e, this.list());
1289
1272
  }
1290
1273
  /** Validates the full LBS tree and returns a list of structural errors. */
1291
1274
  validateTree() {
1292
- return Dt(this.list());
1275
+ return Ft(this.list());
1293
1276
  }
1294
1277
  }
1295
- class es extends y {
1278
+ class Yt extends y {
1296
1279
  constructor(e) {
1297
1280
  super(
1298
1281
  () => e().members,
@@ -1307,66 +1290,66 @@ class es extends y {
1307
1290
  listResolved() {
1308
1291
  const e = this.getBep();
1309
1292
  return e.members.map((t) => {
1310
- const s = e.teams.find((i) => (i.memberEmails ?? []).includes(t.email));
1293
+ const n = e.teams.find((i) => (i.memberEmails ?? []).includes(t.email));
1311
1294
  return {
1312
1295
  ...t,
1313
1296
  role: e.roles.find((i) => i.id === t.roleId) ?? null,
1314
- team: s ? { id: s.id, name: s.name } : null,
1315
- isRepresentative: s?.representativeEmail === t.email
1297
+ team: n ? { id: n.id, name: n.name } : null,
1298
+ isRepresentative: n?.representativeEmail === t.email
1316
1299
  };
1317
1300
  });
1318
1301
  }
1319
1302
  addToTeam(e) {
1320
- const t = [], s = [];
1303
+ const t = [], n = [];
1321
1304
  for (const i of e) {
1322
- const r = this.getBep().teams.find((f) => f.id === i.teamId);
1305
+ const r = this.getBep().teams.find((m) => m.id === i.teamId);
1323
1306
  if (!r) {
1324
- s.push({ input: i, error: `Team not found: ${i.teamId}` });
1307
+ n.push({ input: i, error: `Team not found: ${i.teamId}` });
1325
1308
  continue;
1326
1309
  }
1327
1310
  const { teamId: d, isRepresentative: l, ...c } = i, u = this.add([c]);
1328
1311
  if (u.failed.length > 0) {
1329
- s.push({ input: i, error: u.failed[0].error });
1312
+ n.push({ input: i, error: u.failed[0].error });
1330
1313
  continue;
1331
1314
  }
1332
1315
  r.memberEmails ??= [], r.memberEmails.includes(i.email) || r.memberEmails.push(i.email), l && (r.representativeEmail = i.email);
1333
- const m = this.listResolved().find((f) => f.email === i.email);
1334
- t.push(m);
1316
+ const f = this.listResolved().find((m) => m.email === i.email);
1317
+ t.push(f);
1335
1318
  }
1336
- return { succeeded: t, failed: s };
1319
+ return { succeeded: t, failed: n };
1337
1320
  }
1338
1321
  updateInTeam(e) {
1339
- const t = [], s = [];
1322
+ const t = [], n = [];
1340
1323
  for (const i of e) {
1341
1324
  const o = this.getBep(), { teamId: r, isRepresentative: d, ...l } = i;
1342
- if (r !== void 0 && !o.teams.find((m) => m.id === r)) {
1343
- s.push({ email: i.email, error: `Team not found: ${r}` });
1325
+ if (r !== void 0 && !o.teams.find((f) => f.id === r)) {
1326
+ n.push({ email: i.email, error: `Team not found: ${r}` });
1344
1327
  continue;
1345
1328
  }
1346
1329
  const c = this.update([l]);
1347
1330
  if (c.failed.length > 0) {
1348
- s.push({ email: i.email, error: c.failed[0].error });
1331
+ n.push({ email: i.email, error: c.failed[0].error });
1349
1332
  continue;
1350
1333
  }
1351
1334
  if (r !== void 0) {
1352
- const m = o.teams.find((p) => p.id === r), f = o.teams.find((p) => (p.memberEmails ?? []).includes(i.email));
1353
- f && f.id !== r && (f.memberEmails = (f.memberEmails ?? []).filter((p) => p !== i.email), f.representativeEmail === i.email && (f.representativeEmail = void 0)), m.memberEmails ??= [], m.memberEmails.includes(i.email) || m.memberEmails.push(i.email);
1335
+ const f = o.teams.find((p) => p.id === r), m = o.teams.find((p) => (p.memberEmails ?? []).includes(i.email));
1336
+ m && m.id !== r && (m.memberEmails = (m.memberEmails ?? []).filter((p) => p !== i.email), m.representativeEmail === i.email && (m.representativeEmail = void 0)), f.memberEmails ??= [], f.memberEmails.includes(i.email) || f.memberEmails.push(i.email);
1354
1337
  }
1355
1338
  if (d !== void 0) {
1356
- const m = o.teams.find((f) => (f.memberEmails ?? []).includes(i.email));
1357
- m && (m.representativeEmail = d ? i.email : m.representativeEmail === i.email ? void 0 : m.representativeEmail);
1339
+ const f = o.teams.find((m) => (m.memberEmails ?? []).includes(i.email));
1340
+ f && (f.representativeEmail = d ? i.email : f.representativeEmail === i.email ? void 0 : f.representativeEmail);
1358
1341
  }
1359
- const u = this.listResolved().find((m) => m.email === i.email);
1342
+ const u = this.listResolved().find((f) => f.email === i.email);
1360
1343
  t.push({ email: i.email, after: u });
1361
1344
  }
1362
- return { succeeded: t, failed: s };
1345
+ return { succeeded: t, failed: n };
1363
1346
  }
1364
1347
  removeFromBep(e) {
1365
- const t = [], s = [];
1348
+ const t = [], n = [];
1366
1349
  for (const i of e) {
1367
1350
  const o = this.getBep(), r = this.listResolved().find((l) => l.email === i);
1368
1351
  if (!r) {
1369
- s.push({ email: i, error: `Not found: ${i}` });
1352
+ n.push({ email: i, error: `Not found: ${i}` });
1370
1353
  continue;
1371
1354
  }
1372
1355
  for (const l of o.teams)
@@ -1377,15 +1360,15 @@ class es extends y {
1377
1360
  const l = o.teams.find((c) => c.id === r.team.id);
1378
1361
  l && (l.memberEmails ??= [], l.memberEmails.includes(i) || l.memberEmails.push(i), r.isRepresentative && (l.representativeEmail = i));
1379
1362
  }
1380
- s.push({ email: i, error: d.failed[0].error });
1363
+ n.push({ email: i, error: d.failed[0].error });
1381
1364
  continue;
1382
1365
  }
1383
1366
  t.push(r);
1384
1367
  }
1385
- return { succeeded: t, failed: s };
1368
+ return { succeeded: t, failed: n };
1386
1369
  }
1387
1370
  }
1388
- class ts extends y {
1371
+ class Qt extends y {
1389
1372
  constructor(e) {
1390
1373
  super(
1391
1374
  () => e().milestones,
@@ -1394,8 +1377,8 @@ class ts extends y {
1394
1377
  key: "milestones",
1395
1378
  schema: ye,
1396
1379
  autoId: !0,
1397
- beforeRemove: (t, s) => {
1398
- for (const i of s.loin)
1380
+ beforeRemove: (t, n) => {
1381
+ for (const i of n.loin)
1399
1382
  if (i.milestones?.find((r) => r.milestoneId === t)) throw new Error(`Referenced by: loin["${i.id}"].milestones[milestoneId="${t}"]`);
1400
1383
  }
1401
1384
  }
@@ -1405,11 +1388,11 @@ class ts extends y {
1405
1388
  const e = this.getBep();
1406
1389
  return e.milestones.map((t) => ({
1407
1390
  ...t,
1408
- phase: e.phases.find((s) => s.id === t.phaseId) ?? null
1391
+ phase: e.phases.find((n) => n.id === t.phaseId) ?? null
1409
1392
  }));
1410
1393
  }
1411
1394
  }
1412
- class ss extends y {
1395
+ class es extends y {
1413
1396
  constructor(e) {
1414
1397
  super(
1415
1398
  () => e().objectives,
@@ -1422,7 +1405,7 @@ class ss extends y {
1422
1405
  );
1423
1406
  }
1424
1407
  }
1425
- class ns extends y {
1408
+ class ts extends y {
1426
1409
  constructor(e) {
1427
1410
  super(
1428
1411
  () => e().phases,
@@ -1435,20 +1418,20 @@ class ns extends y {
1435
1418
  );
1436
1419
  }
1437
1420
  }
1438
- class is extends y {
1421
+ class ss extends y {
1439
1422
  constructor(e) {
1440
1423
  super(
1441
1424
  () => e().remoteData,
1442
1425
  e,
1443
1426
  {
1444
1427
  key: "remoteData",
1445
- schema: Ze,
1428
+ schema: ze,
1446
1429
  autoId: !0
1447
1430
  }
1448
1431
  );
1449
1432
  }
1450
1433
  }
1451
- class os extends y {
1434
+ class ns extends y {
1452
1435
  constructor(e) {
1453
1436
  super(
1454
1437
  () => e().resolvers,
@@ -1456,15 +1439,15 @@ class os extends y {
1456
1439
  {
1457
1440
  key: "resolvers",
1458
1441
  schema: Ue,
1459
- beforeRemove: (t, s) => {
1460
- const i = s.remoteData.find((o) => o.resolverId === t);
1442
+ beforeRemove: (t, n) => {
1443
+ const i = n.remoteData.find((o) => o.resolverId === t);
1461
1444
  if (i) throw new Error(`Referenced by: remoteData["${i.id}"].resolverId`);
1462
1445
  }
1463
1446
  }
1464
1447
  );
1465
1448
  }
1466
1449
  }
1467
- class rs extends y {
1450
+ class is extends y {
1468
1451
  constructor(e, t) {
1469
1452
  super(
1470
1453
  () => e().softwares,
@@ -1480,11 +1463,11 @@ class rs extends y {
1480
1463
  const e = new Map(this.getAssetTypes().listResolved().map((t) => [t.id, t]));
1481
1464
  return this.getBep().softwares.map((t) => ({
1482
1465
  ...t,
1483
- assetTypes: (t.assetTypeIds ?? []).map((s) => e.get(s)).filter(Boolean)
1466
+ assetTypes: (t.assetTypeIds ?? []).map((n) => e.get(n)).filter(Boolean)
1484
1467
  }));
1485
1468
  }
1486
1469
  }
1487
- class as extends y {
1470
+ class os extends y {
1488
1471
  constructor(e, t) {
1489
1472
  super(
1490
1473
  () => e().standards,
@@ -1500,13 +1483,13 @@ class as extends y {
1500
1483
  * Union with AddInput<Standard> satisfies the base class contract.
1501
1484
  */
1502
1485
  add(e) {
1503
- const t = e.map((s) => {
1486
+ const t = e.map((n) => {
1504
1487
  const i = `standards/${globalThis.crypto.randomUUID()}.md`;
1505
- if ("content" in s) {
1506
- const { content: o, ...r } = s;
1488
+ if ("content" in n) {
1489
+ const { content: o, ...r } = n;
1507
1490
  return this.getZip().file(i, o), { ...r, contentPath: i };
1508
1491
  }
1509
- return this.getZip().file(i, ""), { ...s, contentPath: i };
1492
+ return this.getZip().file(i, ""), { ...n, contentPath: i };
1510
1493
  });
1511
1494
  return super.add(t);
1512
1495
  }
@@ -1514,29 +1497,29 @@ class as extends y {
1514
1497
  remove(e) {
1515
1498
  const t = new Map(
1516
1499
  e.map((i) => [i, this.list().find((o) => o.id === i)?.contentPath]).filter((i) => i[1] !== void 0)
1517
- ), s = super.remove(e);
1518
- for (const i of s.succeeded) {
1500
+ ), n = super.remove(e);
1501
+ for (const i of n.succeeded) {
1519
1502
  const o = t.get(i);
1520
1503
  o && this.getZip().remove(o);
1521
1504
  }
1522
- return s;
1505
+ return n;
1523
1506
  }
1524
1507
  /** Returns the markdown text content of the given standard. */
1525
1508
  async getContent(e) {
1526
1509
  const t = this.list().find((i) => i.id === e);
1527
1510
  if (!t) throw new Error(`Standard not found: ${e}`);
1528
- const s = this.getZip().file(t.contentPath);
1529
- if (!s) throw new Error(`Content file not found: ${t.contentPath}`);
1530
- return s.async("string");
1511
+ const n = this.getZip().file(t.contentPath);
1512
+ if (!n) throw new Error(`Content file not found: ${t.contentPath}`);
1513
+ return n.async("string");
1531
1514
  }
1532
1515
  /** Writes new markdown text content for the given standard. */
1533
1516
  setContent(e, t) {
1534
- const s = this.list().find((i) => i.id === e);
1535
- if (!s) throw new Error(`Standard not found: ${e}`);
1536
- this.getZip().file(s.contentPath, t);
1517
+ const n = this.list().find((i) => i.id === e);
1518
+ if (!n) throw new Error(`Standard not found: ${e}`);
1519
+ this.getZip().file(n.contentPath, t);
1537
1520
  }
1538
1521
  }
1539
- class ds extends y {
1522
+ class rs extends y {
1540
1523
  constructor(e, t) {
1541
1524
  super(
1542
1525
  () => e().teams,
@@ -1544,12 +1527,12 @@ class ds extends y {
1544
1527
  {
1545
1528
  key: "teams",
1546
1529
  schema: pe,
1547
- validate: (s, i) => {
1548
- const o = [], r = x("team", s.id, i.deliverableNamingConvention);
1549
- return r && o.push(r), s.representativeEmail && !(s.memberEmails ?? []).includes(s.representativeEmail) && o.push(`representativeEmail "${s.representativeEmail}" is not a member of this team`), o;
1530
+ validate: (n, i) => {
1531
+ const o = [], r = x("team", n.id, i.deliverableNamingConvention);
1532
+ return r && o.push(r), n.representativeEmail && !(n.memberEmails ?? []).includes(n.representativeEmail) && o.push(`representativeEmail "${n.representativeEmail}" is not a member of this team`), o;
1550
1533
  },
1551
- beforeRemove: (s, i) => {
1552
- if (i.project.clientId === s)
1534
+ beforeRemove: (n, i) => {
1535
+ if (i.project.clientId === n)
1553
1536
  throw new Error("Referenced by: project.clientId");
1554
1537
  }
1555
1538
  }
@@ -1557,97 +1540,97 @@ class ds extends y {
1557
1540
  }
1558
1541
  getMembers;
1559
1542
  listResolved() {
1560
- const e = this.getBep(), t = new Map(this.getMembers().listResolved().map((s) => [s.email, s]));
1561
- return e.teams.map((s) => ({
1562
- ...s,
1563
- representative: t.get(s.representativeEmail ?? "") ?? null,
1564
- members: (s.memberEmails ?? []).map((i) => t.get(i)).filter(Boolean),
1565
- disciplines: (s.disciplineIds ?? []).map((i) => e.disciplines.find((o) => o.id === i)).filter(Boolean)
1543
+ const e = this.getBep(), t = new Map(this.getMembers().listResolved().map((n) => [n.email, n]));
1544
+ return e.teams.map((n) => ({
1545
+ ...n,
1546
+ representative: t.get(n.representativeEmail ?? "") ?? null,
1547
+ members: (n.memberEmails ?? []).map((i) => t.get(i)).filter(Boolean),
1548
+ disciplines: (n.disciplineIds ?? []).map((i) => e.disciplines.find((o) => o.id === i)).filter(Boolean)
1566
1549
  }));
1567
1550
  }
1568
1551
  }
1569
- function ls(n, e, t) {
1570
- const s = [];
1571
- for (const [l, c] of Object.entries(n.nodes))
1552
+ function as(s, e, t) {
1553
+ const n = [];
1554
+ for (const [l, c] of Object.entries(s.nodes))
1572
1555
  if (c.type === "process") {
1573
- c.actionId && !e.actions.some((u) => u.id === c.actionId) && s.push(`actions["${c.actionId}"] not found (node: ${l})`);
1556
+ c.actionId && !e.actions.some((u) => u.id === c.actionId) && n.push(`actions["${c.actionId}"] not found (node: ${l})`);
1574
1557
  for (const u of ["responsibleRoleIds", "accountableRoleIds", "consultedRoleIds", "informedRoleIds"])
1575
- for (const m of c[u] ?? [])
1576
- e.roles.some((f) => f.id === m) || s.push(`roles["${m}"] not found (node: ${l}.${u})`);
1558
+ for (const f of c[u] ?? [])
1559
+ e.roles.some((m) => m.id === f) || n.push(`roles["${f}"] not found (node: ${l}.${u})`);
1577
1560
  }
1578
- for (const [l, c] of Object.entries(n.edges)) {
1579
- n.nodes[c.from] || s.push(`edge "${l}": from node "${c.from}" not found`), n.nodes[c.to] || s.push(`edge "${l}": to node "${c.to}" not found`), "triggerEventId" in c && !e.events.some((u) => u.id === c.triggerEventId) && s.push(`events["${c.triggerEventId}"] not found (edge: ${l})`);
1561
+ for (const [l, c] of Object.entries(s.edges)) {
1562
+ s.nodes[c.from] || n.push(`edge "${l}": from node "${c.from}" not found`), s.nodes[c.to] || n.push(`edge "${l}": to node "${c.to}" not found`), "triggerEventId" in c && !e.events.some((u) => u.id === c.triggerEventId) && n.push(`events["${c.triggerEventId}"] not found (edge: ${l})`);
1580
1563
  for (const u of c.effectIds ?? [])
1581
- e.effects.some((m) => m.id === u) || s.push(`effects["${u}"] not found (edge: ${l})`);
1564
+ e.effects.some((f) => f.id === u) || n.push(`effects["${u}"] not found (edge: ${l})`);
1582
1565
  }
1583
- for (const [l, c] of Object.entries(n.nodes))
1584
- if (c.type === "automation" && !e.automations.some((u) => u.id === c.automationId) && s.push(`automations["${c.automationId}"] not found (node: ${l})`), c.type === "process" && c.workflowId && (c.workflowId === t ? s.push(`node "${l}" references its own workflow — would cause infinite recursion`) : e.workflows.some((u) => u.id === c.workflowId) || s.push(`workflows["${c.workflowId}"] not found (node: ${l})`)), (c.type === "process" || c.type === "automation") && c.timeouts)
1566
+ for (const [l, c] of Object.entries(s.nodes))
1567
+ if (c.type === "automation" && !e.automations.some((u) => u.id === c.automationId) && n.push(`automations["${c.automationId}"] not found (node: ${l})`), c.type === "process" && c.workflowId && (c.workflowId === t ? n.push(`node "${l}" references its own workflow — would cause infinite recursion`) : e.workflows.some((u) => u.id === c.workflowId) || n.push(`workflows["${c.workflowId}"] not found (node: ${l})`)), (c.type === "process" || c.type === "automation") && c.timeouts)
1585
1568
  for (const u of c.timeouts)
1586
- e.effects.some((m) => m.id === u.effectId) || s.push(`effects["${u.effectId}"] not found (node: ${l}.timeouts)`);
1587
- const i = Object.keys(n.nodes), o = new Set(Object.values(n.edges).map((l) => l.to)), r = new Set(Object.values(n.edges).map((l) => l.from));
1569
+ e.effects.some((f) => f.id === u.effectId) || n.push(`effects["${u.effectId}"] not found (node: ${l}.timeouts)`);
1570
+ const i = Object.keys(s.nodes), o = new Set(Object.values(s.edges).map((l) => l.to)), r = new Set(Object.values(s.edges).map((l) => l.from));
1588
1571
  for (const l of i)
1589
- n.nodes[l].type !== "start" && (o.has(l) || s.push(`node "${l}" is unreachable — no edges point to it`));
1572
+ s.nodes[l].type !== "start" && (o.has(l) || n.push(`node "${l}" is unreachable — no edges point to it`));
1590
1573
  for (const l of i)
1591
- n.nodes[l].type !== "end" && (r.has(l) || s.push(`node "${l}" has no outgoing edges — workflow would get stuck here`));
1574
+ s.nodes[l].type !== "end" && (r.has(l) || n.push(`node "${l}" has no outgoing edges — workflow would get stuck here`));
1592
1575
  const d = {};
1593
- for (const l of Object.keys(n.edges)) {
1594
- const c = n.edges[l];
1576
+ for (const l of Object.keys(s.edges)) {
1577
+ const c = s.edges[l];
1595
1578
  d[c.to] ??= [], d[c.to].push(l);
1596
1579
  }
1597
- for (const [l, c] of Object.entries(n.nodes)) {
1580
+ for (const [l, c] of Object.entries(s.nodes)) {
1598
1581
  if (c.type !== "decision") continue;
1599
1582
  const u = /* @__PURE__ */ new Set();
1600
- for (const m of d[l] ?? []) {
1601
- const f = n.edges[m], p = n.nodes[f.from];
1583
+ for (const f of d[l] ?? []) {
1584
+ const m = s.edges[f], p = s.nodes[m.from];
1602
1585
  if (p) {
1603
1586
  if (p.type === "automation") {
1604
1587
  const g = e.automations.find((h) => h.id === p.automationId);
1605
1588
  for (const h of g?.output ?? []) u.add(h.key);
1606
1589
  }
1607
- if (p.type === "process" && "triggerEventId" in f) {
1608
- const g = e.events.find((h) => h.id === f.triggerEventId);
1590
+ if (p.type === "process" && "triggerEventId" in m) {
1591
+ const g = e.events.find((h) => h.id === m.triggerEventId);
1609
1592
  for (const h of g?.payload ?? []) u.add(h.key);
1610
1593
  }
1611
1594
  }
1612
1595
  }
1613
1596
  if (u.size !== 0)
1614
- for (const [m, f] of Object.entries(n.edges))
1615
- f.from === l && "guard" in f && (u.has(f.guard.field) || s.push(`guard field "${f.guard.field}" on edge "${m}" is not declared in any direct predecessor's output or payload (node: ${l})`));
1597
+ for (const [f, m] of Object.entries(s.edges))
1598
+ m.from === l && "guard" in m && (u.has(m.guard.field) || n.push(`guard field "${m.guard.field}" on edge "${f}" is not declared in any direct predecessor's output or payload (node: ${l})`));
1616
1599
  }
1617
- return s;
1600
+ return n;
1618
1601
  }
1619
- class cs extends y {
1620
- constructor(e, t, s) {
1602
+ class ds extends y {
1603
+ constructor(e, t, n) {
1621
1604
  super(
1622
1605
  () => e().workflows,
1623
1606
  e,
1624
1607
  {
1625
1608
  key: "workflows",
1626
- schema: je,
1609
+ schema: Ae,
1627
1610
  autoId: !0,
1628
- validate: (i, o) => ls(i.diagram, o, i.id)
1611
+ validate: (i, o) => as(i.diagram, o, i.id)
1629
1612
  }
1630
- ), this.getMembers = t, this.getTeams = s;
1613
+ ), this.getMembers = t, this.getTeams = n;
1631
1614
  }
1632
1615
  getMembers;
1633
1616
  getTeams;
1634
1617
  getRaciMatrix() {
1635
- const e = this.getBep(), t = [], s = /* @__PURE__ */ new Set(), i = this.getMembers().listResolved(), o = this.getTeams().listResolved(), r = (l) => (l ?? []).flatMap((c) => {
1618
+ const e = this.getBep(), t = [], n = /* @__PURE__ */ new Set(), i = this.getMembers().listResolved(), o = this.getTeams().listResolved(), r = (l) => (l ?? []).flatMap((c) => {
1636
1619
  const u = e.roles.find((p) => p.id === c);
1637
1620
  if (!u) return [];
1638
- s.add(c);
1639
- const m = i.filter((p) => p.role?.id === c), f = o.find((p) => p.members.some((g) => g.role?.id === c)) ?? null;
1640
- return [{ role: u, members: m, team: f }];
1621
+ n.add(c);
1622
+ const f = i.filter((p) => p.role?.id === c), m = o.find((p) => p.members.some((g) => g.role?.id === c)) ?? null;
1623
+ return [{ role: u, members: f, team: m }];
1641
1624
  });
1642
1625
  for (const l of e.workflows)
1643
1626
  for (const [c, u] of Object.entries(l.diagram.nodes)) {
1644
1627
  if (u.type !== "process") continue;
1645
- const m = u.actionId ? e.actions.find((f) => f.id === u.actionId) : void 0;
1628
+ const f = u.actionId ? e.actions.find((m) => m.id === u.actionId) : void 0;
1646
1629
  t.push({
1647
1630
  workflow: { id: l.id, name: l.name },
1648
1631
  nodeId: c,
1649
- label: m?.name ?? c,
1650
- ...m?.description ? { description: m.description } : {},
1632
+ label: f?.name ?? c,
1633
+ ...f?.description ? { description: f.description } : {},
1651
1634
  ...u.actionId ? { actionId: u.actionId } : {},
1652
1635
  responsible: r(u.responsibleRoleIds),
1653
1636
  accountable: r(u.accountableRoleIds),
@@ -1655,23 +1638,23 @@ class cs extends y {
1655
1638
  informed: r(u.informedRoleIds)
1656
1639
  });
1657
1640
  }
1658
- return { roles: [...s].map((l) => e.roles.find((c) => c.id === l)).filter(Boolean), rows: t };
1641
+ return { roles: [...n].map((l) => e.roles.find((c) => c.id === l)).filter(Boolean), rows: t };
1659
1642
  }
1660
1643
  getRaciMatrixForWorkflow(e) {
1661
- const t = this.getRaciMatrix(), s = t.rows.filter((o) => o.workflow.id === e), i = new Set(
1662
- s.flatMap((o) => [...o.responsible, ...o.accountable, ...o.consulted, ...o.informed].map((r) => r.role.id))
1644
+ const t = this.getRaciMatrix(), n = t.rows.filter((o) => o.workflow.id === e), i = new Set(
1645
+ n.flatMap((o) => [...o.responsible, ...o.accountable, ...o.consulted, ...o.informed].map((r) => r.role.id))
1663
1646
  );
1664
- return { roles: t.roles.filter((o) => i.has(o.id)), rows: s };
1647
+ return { roles: t.roles.filter((o) => i.has(o.id)), rows: n };
1665
1648
  }
1666
1649
  getConsolidatedRaciMatrix() {
1667
- const e = this.getRaciMatrix(), t = /* @__PURE__ */ new Map(), s = (r, d) => {
1650
+ const e = this.getRaciMatrix(), t = /* @__PURE__ */ new Map(), n = (r, d) => {
1668
1651
  const l = new Map(r.map((c) => [c.role.id, { ...c, members: [...c.members] }]));
1669
1652
  for (const c of d)
1670
1653
  if (!l.has(c.role.id))
1671
1654
  l.set(c.role.id, { ...c, members: [...c.members] });
1672
1655
  else {
1673
- const u = l.get(c.role.id), m = new Set(u.members.map((f) => f.email));
1674
- for (const f of c.members) m.has(f.email) || u.members.push(f);
1656
+ const u = l.get(c.role.id), f = new Set(u.members.map((m) => m.email));
1657
+ for (const m of c.members) f.has(m.email) || u.members.push(m);
1675
1658
  }
1676
1659
  return [...l.values()];
1677
1660
  };
@@ -1681,7 +1664,7 @@ class cs extends y {
1681
1664
  t.set(d, { ...r, workflow: { id: "", name: "" } });
1682
1665
  else {
1683
1666
  const l = t.get(d);
1684
- l.responsible = s(l.responsible, r.responsible), l.accountable = s(l.accountable, r.accountable), l.consulted = s(l.consulted, r.consulted), l.informed = s(l.informed, r.informed);
1667
+ l.responsible = n(l.responsible, r.responsible), l.accountable = n(l.accountable, r.accountable), l.consulted = n(l.consulted, r.consulted), l.informed = n(l.informed, r.informed);
1685
1668
  }
1686
1669
  }
1687
1670
  const i = [...t.values()], o = new Set(
@@ -1692,14 +1675,14 @@ class cs extends y {
1692
1675
  listResolved() {
1693
1676
  const e = this.getBep();
1694
1677
  return e.workflows.map((t) => {
1695
- const s = {};
1678
+ const n = {};
1696
1679
  for (const [i, o] of Object.entries(t.diagram.nodes)) {
1697
1680
  const r = (d) => ({
1698
1681
  roles: (d ?? []).map((l) => e.roles.find((c) => c.id === l)).filter(Boolean),
1699
1682
  teams: [],
1700
1683
  members: []
1701
1684
  });
1702
- s[i] = {
1685
+ n[i] = {
1703
1686
  type: o.type,
1704
1687
  label: o.type === "decision" ? o.label : void 0,
1705
1688
  timeouts: o.type === "process" || o.type === "automation" ? o.timeouts : void 0,
@@ -1715,58 +1698,58 @@ class cs extends y {
1715
1698
  }
1716
1699
  return {
1717
1700
  ...t,
1718
- diagram: { ...t.diagram, nodes: s }
1701
+ diagram: { ...t.diagram, nodes: n }
1719
1702
  };
1720
1703
  });
1721
1704
  }
1722
1705
  }
1723
- var fs = /* @__PURE__ */ (function() {
1724
- var n = function(e, t) {
1725
- return n = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(s, i) {
1726
- s.__proto__ = i;
1727
- } || function(s, i) {
1728
- for (var o in i) i.hasOwnProperty(o) && (s[o] = i[o]);
1729
- }, n(e, t);
1706
+ var ls = /* @__PURE__ */ (function() {
1707
+ var s = function(e, t) {
1708
+ return s = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
1709
+ n.__proto__ = i;
1710
+ } || function(n, i) {
1711
+ for (var o in i) i.hasOwnProperty(o) && (n[o] = i[o]);
1712
+ }, s(e, t);
1730
1713
  };
1731
1714
  return function(e, t) {
1732
- n(e, t);
1733
- function s() {
1715
+ s(e, t);
1716
+ function n() {
1734
1717
  this.constructor = e;
1735
1718
  }
1736
- e.prototype = t === null ? Object.create(t) : (s.prototype = t.prototype, new s());
1719
+ e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
1737
1720
  };
1738
- })(), us = Object.prototype.hasOwnProperty;
1739
- function G(n, e) {
1740
- return us.call(n, e);
1721
+ })(), cs = Object.prototype.hasOwnProperty;
1722
+ function G(s, e) {
1723
+ return cs.call(s, e);
1741
1724
  }
1742
- function X(n) {
1743
- if (Array.isArray(n)) {
1744
- for (var e = new Array(n.length), t = 0; t < e.length; t++)
1725
+ function X(s) {
1726
+ if (Array.isArray(s)) {
1727
+ for (var e = new Array(s.length), t = 0; t < e.length; t++)
1745
1728
  e[t] = "" + t;
1746
1729
  return e;
1747
1730
  }
1748
1731
  if (Object.keys)
1749
- return Object.keys(n);
1750
- var s = [];
1751
- for (var i in n)
1752
- G(n, i) && s.push(i);
1753
- return s;
1754
- }
1755
- function R(n) {
1756
- switch (typeof n) {
1732
+ return Object.keys(s);
1733
+ var n = [];
1734
+ for (var i in s)
1735
+ G(s, i) && n.push(i);
1736
+ return n;
1737
+ }
1738
+ function R(s) {
1739
+ switch (typeof s) {
1757
1740
  case "object":
1758
- return JSON.parse(JSON.stringify(n));
1741
+ return JSON.parse(JSON.stringify(s));
1759
1742
  //Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5
1760
1743
  case "undefined":
1761
1744
  return null;
1762
1745
  //this is how JSON.stringify behaves for array items
1763
1746
  default:
1764
- return n;
1747
+ return s;
1765
1748
  }
1766
1749
  }
1767
- function V(n) {
1768
- for (var e = 0, t = n.length, s; e < t; ) {
1769
- if (s = n.charCodeAt(e), s >= 48 && s <= 57) {
1750
+ function V(s) {
1751
+ for (var e = 0, t = s.length, n; e < t; ) {
1752
+ if (n = s.charCodeAt(e), n >= 48 && n <= 57) {
1770
1753
  e++;
1771
1754
  continue;
1772
1755
  }
@@ -1774,207 +1757,207 @@ function V(n) {
1774
1757
  }
1775
1758
  return !0;
1776
1759
  }
1777
- function j(n) {
1778
- return n.indexOf("/") === -1 && n.indexOf("~") === -1 ? n : n.replace(/~/g, "~0").replace(/\//g, "~1");
1760
+ function A(s) {
1761
+ return s.indexOf("/") === -1 && s.indexOf("~") === -1 ? s : s.replace(/~/g, "~0").replace(/\//g, "~1");
1779
1762
  }
1780
- function Ge(n) {
1781
- return n.replace(/~1/g, "/").replace(/~0/g, "~");
1763
+ function We(s) {
1764
+ return s.replace(/~1/g, "/").replace(/~0/g, "~");
1782
1765
  }
1783
- function H(n) {
1784
- if (n === void 0)
1766
+ function H(s) {
1767
+ if (s === void 0)
1785
1768
  return !0;
1786
- if (n) {
1787
- if (Array.isArray(n)) {
1788
- for (var e = 0, t = n.length; e < t; e++)
1789
- if (H(n[e]))
1769
+ if (s) {
1770
+ if (Array.isArray(s)) {
1771
+ for (var e = 0, t = s.length; e < t; e++)
1772
+ if (H(s[e]))
1790
1773
  return !0;
1791
- } else if (typeof n == "object") {
1792
- for (var s = X(n), i = s.length, o = 0; o < i; o++)
1793
- if (H(n[s[o]]))
1774
+ } else if (typeof s == "object") {
1775
+ for (var n = X(s), i = n.length, o = 0; o < i; o++)
1776
+ if (H(s[n[o]]))
1794
1777
  return !0;
1795
1778
  }
1796
1779
  }
1797
1780
  return !1;
1798
1781
  }
1799
- function de(n, e) {
1800
- var t = [n];
1801
- for (var s in e) {
1802
- var i = typeof e[s] == "object" ? JSON.stringify(e[s], null, 2) : e[s];
1803
- typeof i < "u" && t.push(s + ": " + i);
1782
+ function de(s, e) {
1783
+ var t = [s];
1784
+ for (var n in e) {
1785
+ var i = typeof e[n] == "object" ? JSON.stringify(e[n], null, 2) : e[n];
1786
+ typeof i < "u" && t.push(n + ": " + i);
1804
1787
  }
1805
1788
  return t.join(`
1806
1789
  `);
1807
1790
  }
1808
- var Xe = (
1791
+ var Ge = (
1809
1792
  /** @class */
1810
- (function(n) {
1811
- fs(e, n);
1812
- function e(t, s, i, o, r) {
1813
- var d = this.constructor, l = n.call(this, de(t, { name: s, index: i, operation: o, tree: r })) || this;
1814
- return l.name = s, l.index = i, l.operation = o, l.tree = r, Object.setPrototypeOf(l, d.prototype), l.message = de(t, { name: s, index: i, operation: o, tree: r }), l;
1793
+ (function(s) {
1794
+ ls(e, s);
1795
+ function e(t, n, i, o, r) {
1796
+ var d = this.constructor, l = s.call(this, de(t, { name: n, index: i, operation: o, tree: r })) || this;
1797
+ return l.name = n, l.index = i, l.operation = o, l.tree = r, Object.setPrototypeOf(l, d.prototype), l.message = de(t, { name: n, index: i, operation: o, tree: r }), l;
1815
1798
  }
1816
1799
  return e;
1817
1800
  })(Error)
1818
- ), E = Xe, ms = R, M = {
1819
- add: function(n, e, t) {
1820
- return n[e] = this.value, { newDocument: t };
1801
+ ), E = Ge, fs = R, M = {
1802
+ add: function(s, e, t) {
1803
+ return s[e] = this.value, { newDocument: t };
1821
1804
  },
1822
- remove: function(n, e, t) {
1823
- var s = n[e];
1824
- return delete n[e], { newDocument: t, removed: s };
1805
+ remove: function(s, e, t) {
1806
+ var n = s[e];
1807
+ return delete s[e], { newDocument: t, removed: n };
1825
1808
  },
1826
- replace: function(n, e, t) {
1827
- var s = n[e];
1828
- return n[e] = this.value, { newDocument: t, removed: s };
1809
+ replace: function(s, e, t) {
1810
+ var n = s[e];
1811
+ return s[e] = this.value, { newDocument: t, removed: n };
1829
1812
  },
1830
- move: function(n, e, t) {
1831
- var s = U(t, this.path);
1832
- s && (s = R(s));
1813
+ move: function(s, e, t) {
1814
+ var n = U(t, this.path);
1815
+ n && (n = R(n));
1833
1816
  var i = O(t, { op: "remove", path: this.from }).removed;
1834
- return O(t, { op: "add", path: this.path, value: i }), { newDocument: t, removed: s };
1817
+ return O(t, { op: "add", path: this.path, value: i }), { newDocument: t, removed: n };
1835
1818
  },
1836
- copy: function(n, e, t) {
1837
- var s = U(t, this.from);
1838
- return O(t, { op: "add", path: this.path, value: R(s) }), { newDocument: t };
1819
+ copy: function(s, e, t) {
1820
+ var n = U(t, this.from);
1821
+ return O(t, { op: "add", path: this.path, value: R(n) }), { newDocument: t };
1839
1822
  },
1840
- test: function(n, e, t) {
1841
- return { newDocument: t, test: P(n[e], this.value) };
1823
+ test: function(s, e, t) {
1824
+ return { newDocument: t, test: P(s[e], this.value) };
1842
1825
  },
1843
- _get: function(n, e, t) {
1844
- return this.value = n[e], { newDocument: t };
1826
+ _get: function(s, e, t) {
1827
+ return this.value = s[e], { newDocument: t };
1845
1828
  }
1846
- }, ps = {
1847
- add: function(n, e, t) {
1848
- return V(e) ? n.splice(e, 0, this.value) : n[e] = this.value, { newDocument: t, index: e };
1829
+ }, us = {
1830
+ add: function(s, e, t) {
1831
+ return V(e) ? s.splice(e, 0, this.value) : s[e] = this.value, { newDocument: t, index: e };
1849
1832
  },
1850
- remove: function(n, e, t) {
1851
- var s = n.splice(e, 1);
1852
- return { newDocument: t, removed: s[0] };
1833
+ remove: function(s, e, t) {
1834
+ var n = s.splice(e, 1);
1835
+ return { newDocument: t, removed: n[0] };
1853
1836
  },
1854
- replace: function(n, e, t) {
1855
- var s = n[e];
1856
- return n[e] = this.value, { newDocument: t, removed: s };
1837
+ replace: function(s, e, t) {
1838
+ var n = s[e];
1839
+ return s[e] = this.value, { newDocument: t, removed: n };
1857
1840
  },
1858
1841
  move: M.move,
1859
1842
  copy: M.copy,
1860
1843
  test: M.test,
1861
1844
  _get: M._get
1862
1845
  };
1863
- function U(n, e) {
1846
+ function U(s, e) {
1864
1847
  if (e == "")
1865
- return n;
1848
+ return s;
1866
1849
  var t = { op: "_get", path: e };
1867
- return O(n, t), t.value;
1850
+ return O(s, t), t.value;
1868
1851
  }
1869
- function O(n, e, t, s, i, o) {
1870
- if (t === void 0 && (t = !1), s === void 0 && (s = !0), i === void 0 && (i = !0), o === void 0 && (o = 0), t && (typeof t == "function" ? t(e, 0, n, e.path) : z(e, 0)), e.path === "") {
1871
- var r = { newDocument: n };
1852
+ function O(s, e, t, n, i, o) {
1853
+ if (t === void 0 && (t = !1), n === void 0 && (n = !0), i === void 0 && (i = !0), o === void 0 && (o = 0), t && (typeof t == "function" ? t(e, 0, s, e.path) : z(e, 0)), e.path === "") {
1854
+ var r = { newDocument: s };
1872
1855
  if (e.op === "add")
1873
1856
  return r.newDocument = e.value, r;
1874
1857
  if (e.op === "replace")
1875
- return r.newDocument = e.value, r.removed = n, r;
1858
+ return r.newDocument = e.value, r.removed = s, r;
1876
1859
  if (e.op === "move" || e.op === "copy")
1877
- return r.newDocument = U(n, e.from), e.op === "move" && (r.removed = n), r;
1860
+ return r.newDocument = U(s, e.from), e.op === "move" && (r.removed = s), r;
1878
1861
  if (e.op === "test") {
1879
- if (r.test = P(n, e.value), r.test === !1)
1880
- throw new E("Test operation failed", "TEST_OPERATION_FAILED", o, e, n);
1881
- return r.newDocument = n, r;
1862
+ if (r.test = P(s, e.value), r.test === !1)
1863
+ throw new E("Test operation failed", "TEST_OPERATION_FAILED", o, e, s);
1864
+ return r.newDocument = s, r;
1882
1865
  } else {
1883
1866
  if (e.op === "remove")
1884
- return r.removed = n, r.newDocument = null, r;
1867
+ return r.removed = s, r.newDocument = null, r;
1885
1868
  if (e.op === "_get")
1886
- return e.value = n, r;
1869
+ return e.value = s, r;
1887
1870
  if (t)
1888
- throw new E("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", o, e, n);
1871
+ throw new E("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", o, e, s);
1889
1872
  return r;
1890
1873
  }
1891
1874
  } else {
1892
- s || (n = R(n));
1893
- var d = e.path || "", l = d.split("/"), c = n, u = 1, m = l.length, f = void 0, p = void 0, g = void 0;
1875
+ n || (s = R(s));
1876
+ var d = e.path || "", l = d.split("/"), c = s, u = 1, f = l.length, m = void 0, p = void 0, g = void 0;
1894
1877
  for (typeof t == "function" ? g = t : g = z; ; ) {
1895
- if (p = l[u], p && p.indexOf("~") != -1 && (p = Ge(p)), i && (p == "__proto__" || p == "prototype" && u > 0 && l[u - 1] == "constructor"))
1878
+ if (p = l[u], p && p.indexOf("~") != -1 && (p = We(p)), i && (p == "__proto__" || p == "prototype" && u > 0 && l[u - 1] == "constructor"))
1896
1879
  throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");
1897
- if (t && f === void 0 && (c[p] === void 0 ? f = l.slice(0, u).join("/") : u == m - 1 && (f = e.path), f !== void 0 && g(e, 0, n, f)), u++, Array.isArray(c)) {
1880
+ if (t && m === void 0 && (c[p] === void 0 ? m = l.slice(0, u).join("/") : u == f - 1 && (m = e.path), m !== void 0 && g(e, 0, s, m)), u++, Array.isArray(c)) {
1898
1881
  if (p === "-")
1899
1882
  p = c.length;
1900
1883
  else {
1901
1884
  if (t && !V(p))
1902
- throw new E("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index", "OPERATION_PATH_ILLEGAL_ARRAY_INDEX", o, e, n);
1885
+ throw new E("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index", "OPERATION_PATH_ILLEGAL_ARRAY_INDEX", o, e, s);
1903
1886
  V(p) && (p = ~~p);
1904
1887
  }
1905
- if (u >= m) {
1888
+ if (u >= f) {
1906
1889
  if (t && e.op === "add" && p > c.length)
1907
- throw new E("The specified index MUST NOT be greater than the number of elements in the array", "OPERATION_VALUE_OUT_OF_BOUNDS", o, e, n);
1908
- var r = ps[e.op].call(e, c, p, n);
1890
+ throw new E("The specified index MUST NOT be greater than the number of elements in the array", "OPERATION_VALUE_OUT_OF_BOUNDS", o, e, s);
1891
+ var r = us[e.op].call(e, c, p, s);
1909
1892
  if (r.test === !1)
1910
- throw new E("Test operation failed", "TEST_OPERATION_FAILED", o, e, n);
1893
+ throw new E("Test operation failed", "TEST_OPERATION_FAILED", o, e, s);
1911
1894
  return r;
1912
1895
  }
1913
- } else if (u >= m) {
1914
- var r = M[e.op].call(e, c, p, n);
1896
+ } else if (u >= f) {
1897
+ var r = M[e.op].call(e, c, p, s);
1915
1898
  if (r.test === !1)
1916
- throw new E("Test operation failed", "TEST_OPERATION_FAILED", o, e, n);
1899
+ throw new E("Test operation failed", "TEST_OPERATION_FAILED", o, e, s);
1917
1900
  return r;
1918
1901
  }
1919
- if (c = c[p], t && u < m && (!c || typeof c != "object"))
1920
- throw new E("Cannot perform operation at the desired path", "OPERATION_PATH_UNRESOLVABLE", o, e, n);
1902
+ if (c = c[p], t && u < f && (!c || typeof c != "object"))
1903
+ throw new E("Cannot perform operation at the desired path", "OPERATION_PATH_UNRESOLVABLE", o, e, s);
1921
1904
  }
1922
1905
  }
1923
1906
  }
1924
- function Z(n, e, t, s, i) {
1925
- if (s === void 0 && (s = !0), i === void 0 && (i = !0), t && !Array.isArray(e))
1907
+ function Z(s, e, t, n, i) {
1908
+ if (n === void 0 && (n = !0), i === void 0 && (i = !0), t && !Array.isArray(e))
1926
1909
  throw new E("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
1927
- s || (n = R(n));
1910
+ n || (s = R(s));
1928
1911
  for (var o = new Array(e.length), r = 0, d = e.length; r < d; r++)
1929
- o[r] = O(n, e[r], t, !0, i, r), n = o[r].newDocument;
1930
- return o.newDocument = n, o;
1931
- }
1932
- function hs(n, e, t) {
1933
- var s = O(n, e);
1934
- if (s.test === !1)
1935
- throw new E("Test operation failed", "TEST_OPERATION_FAILED", t, e, n);
1936
- return s.newDocument;
1937
- }
1938
- function z(n, e, t, s) {
1939
- if (typeof n != "object" || n === null || Array.isArray(n))
1940
- throw new E("Operation is not an object", "OPERATION_NOT_AN_OBJECT", e, n, t);
1941
- if (M[n.op]) {
1942
- if (typeof n.path != "string")
1943
- throw new E("Operation `path` property is not a string", "OPERATION_PATH_INVALID", e, n, t);
1944
- if (n.path.indexOf("/") !== 0 && n.path.length > 0)
1945
- throw new E('Operation `path` property must start with "/"', "OPERATION_PATH_INVALID", e, n, t);
1946
- if ((n.op === "move" || n.op === "copy") && typeof n.from != "string")
1947
- throw new E("Operation `from` property is not present (applicable in `move` and `copy` operations)", "OPERATION_FROM_REQUIRED", e, n, t);
1948
- if ((n.op === "add" || n.op === "replace" || n.op === "test") && n.value === void 0)
1949
- throw new E("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_REQUIRED", e, n, t);
1950
- if ((n.op === "add" || n.op === "replace" || n.op === "test") && H(n.value))
1951
- throw new E("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED", e, n, t);
1912
+ o[r] = O(s, e[r], t, !0, i, r), s = o[r].newDocument;
1913
+ return o.newDocument = s, o;
1914
+ }
1915
+ function ms(s, e, t) {
1916
+ var n = O(s, e);
1917
+ if (n.test === !1)
1918
+ throw new E("Test operation failed", "TEST_OPERATION_FAILED", t, e, s);
1919
+ return n.newDocument;
1920
+ }
1921
+ function z(s, e, t, n) {
1922
+ if (typeof s != "object" || s === null || Array.isArray(s))
1923
+ throw new E("Operation is not an object", "OPERATION_NOT_AN_OBJECT", e, s, t);
1924
+ if (M[s.op]) {
1925
+ if (typeof s.path != "string")
1926
+ throw new E("Operation `path` property is not a string", "OPERATION_PATH_INVALID", e, s, t);
1927
+ if (s.path.indexOf("/") !== 0 && s.path.length > 0)
1928
+ throw new E('Operation `path` property must start with "/"', "OPERATION_PATH_INVALID", e, s, t);
1929
+ if ((s.op === "move" || s.op === "copy") && typeof s.from != "string")
1930
+ throw new E("Operation `from` property is not present (applicable in `move` and `copy` operations)", "OPERATION_FROM_REQUIRED", e, s, t);
1931
+ if ((s.op === "add" || s.op === "replace" || s.op === "test") && s.value === void 0)
1932
+ throw new E("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_REQUIRED", e, s, t);
1933
+ if ((s.op === "add" || s.op === "replace" || s.op === "test") && H(s.value))
1934
+ throw new E("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED", e, s, t);
1952
1935
  if (t) {
1953
- if (n.op == "add") {
1954
- var i = n.path.split("/").length, o = s.split("/").length;
1936
+ if (s.op == "add") {
1937
+ var i = s.path.split("/").length, o = n.split("/").length;
1955
1938
  if (i !== o + 1 && i !== o)
1956
- throw new E("Cannot perform an `add` operation at the desired path", "OPERATION_PATH_CANNOT_ADD", e, n, t);
1957
- } else if (n.op === "replace" || n.op === "remove" || n.op === "_get") {
1958
- if (n.path !== s)
1959
- throw new E("Cannot perform the operation at a path that does not exist", "OPERATION_PATH_UNRESOLVABLE", e, n, t);
1960
- } else if (n.op === "move" || n.op === "copy") {
1961
- var r = { op: "_get", path: n.from, value: void 0 }, d = Ve([r], t);
1939
+ throw new E("Cannot perform an `add` operation at the desired path", "OPERATION_PATH_CANNOT_ADD", e, s, t);
1940
+ } else if (s.op === "replace" || s.op === "remove" || s.op === "_get") {
1941
+ if (s.path !== n)
1942
+ throw new E("Cannot perform the operation at a path that does not exist", "OPERATION_PATH_UNRESOLVABLE", e, s, t);
1943
+ } else if (s.op === "move" || s.op === "copy") {
1944
+ var r = { op: "_get", path: s.from, value: void 0 }, d = Xe([r], t);
1962
1945
  if (d && d.name === "OPERATION_PATH_UNRESOLVABLE")
1963
- throw new E("Cannot perform the operation from a path that does not exist", "OPERATION_FROM_UNRESOLVABLE", e, n, t);
1946
+ throw new E("Cannot perform the operation from a path that does not exist", "OPERATION_FROM_UNRESOLVABLE", e, s, t);
1964
1947
  }
1965
1948
  }
1966
- } else throw new E("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", e, n, t);
1949
+ } else throw new E("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", e, s, t);
1967
1950
  }
1968
- function Ve(n, e, t) {
1951
+ function Xe(s, e, t) {
1969
1952
  try {
1970
- if (!Array.isArray(n))
1953
+ if (!Array.isArray(s))
1971
1954
  throw new E("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
1972
1955
  if (e)
1973
- Z(R(e), R(n), t || !0);
1956
+ Z(R(e), R(s), t || !0);
1974
1957
  else {
1975
1958
  t = t || z;
1976
- for (var s = 0; s < n.length; s++)
1977
- t(n[s], s, e, void 0);
1959
+ for (var n = 0; n < s.length; n++)
1960
+ t(s[n], n, e, void 0);
1978
1961
  }
1979
1962
  } catch (i) {
1980
1963
  if (i instanceof E)
@@ -1982,215 +1965,215 @@ function Ve(n, e, t) {
1982
1965
  throw i;
1983
1966
  }
1984
1967
  }
1985
- function P(n, e) {
1986
- if (n === e)
1968
+ function P(s, e) {
1969
+ if (s === e)
1987
1970
  return !0;
1988
- if (n && e && typeof n == "object" && typeof e == "object") {
1989
- var t = Array.isArray(n), s = Array.isArray(e), i, o, r;
1990
- if (t && s) {
1991
- if (o = n.length, o != e.length)
1971
+ if (s && e && typeof s == "object" && typeof e == "object") {
1972
+ var t = Array.isArray(s), n = Array.isArray(e), i, o, r;
1973
+ if (t && n) {
1974
+ if (o = s.length, o != e.length)
1992
1975
  return !1;
1993
1976
  for (i = o; i-- !== 0; )
1994
- if (!P(n[i], e[i]))
1977
+ if (!P(s[i], e[i]))
1995
1978
  return !1;
1996
1979
  return !0;
1997
1980
  }
1998
- if (t != s)
1981
+ if (t != n)
1999
1982
  return !1;
2000
- var d = Object.keys(n);
1983
+ var d = Object.keys(s);
2001
1984
  if (o = d.length, o !== Object.keys(e).length)
2002
1985
  return !1;
2003
1986
  for (i = o; i-- !== 0; )
2004
1987
  if (!e.hasOwnProperty(d[i]))
2005
1988
  return !1;
2006
1989
  for (i = o; i-- !== 0; )
2007
- if (r = d[i], !P(n[r], e[r]))
1990
+ if (r = d[i], !P(s[r], e[r]))
2008
1991
  return !1;
2009
1992
  return !0;
2010
1993
  }
2011
- return n !== n && e !== e;
1994
+ return s !== s && e !== e;
2012
1995
  }
2013
- const gs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1996
+ const ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2014
1997
  __proto__: null,
2015
1998
  JsonPatchError: E,
2016
1999
  _areEquals: P,
2017
2000
  applyOperation: O,
2018
2001
  applyPatch: Z,
2019
- applyReducer: hs,
2020
- deepClone: ms,
2002
+ applyReducer: ms,
2003
+ deepClone: fs,
2021
2004
  getValueByPointer: U,
2022
- validate: Ve,
2005
+ validate: Xe,
2023
2006
  validator: z
2024
2007
  }, Symbol.toStringTag, { value: "Module" }));
2025
- var se = /* @__PURE__ */ new WeakMap(), ys = (
2008
+ var se = /* @__PURE__ */ new WeakMap(), hs = (
2026
2009
  /** @class */
2027
2010
  /* @__PURE__ */ (function() {
2028
- function n(e) {
2011
+ function s(e) {
2029
2012
  this.observers = /* @__PURE__ */ new Map(), this.obj = e;
2030
2013
  }
2031
- return n;
2014
+ return s;
2032
2015
  })()
2033
- ), bs = (
2016
+ ), gs = (
2034
2017
  /** @class */
2035
2018
  /* @__PURE__ */ (function() {
2036
- function n(e, t) {
2019
+ function s(e, t) {
2037
2020
  this.callback = e, this.observer = t;
2038
2021
  }
2039
- return n;
2022
+ return s;
2040
2023
  })()
2041
2024
  );
2042
- function ws(n) {
2043
- return se.get(n);
2025
+ function ys(s) {
2026
+ return se.get(s);
2044
2027
  }
2045
- function vs(n, e) {
2046
- return n.observers.get(e);
2028
+ function bs(s, e) {
2029
+ return s.observers.get(e);
2047
2030
  }
2048
- function Is(n, e) {
2049
- n.observers.delete(e.callback);
2031
+ function ws(s, e) {
2032
+ s.observers.delete(e.callback);
2050
2033
  }
2051
- function Es(n, e) {
2034
+ function vs(s, e) {
2052
2035
  e.unobserve();
2053
2036
  }
2054
- function Ns(n, e) {
2055
- var t = [], s, i = ws(n);
2037
+ function Is(s, e) {
2038
+ var t = [], n, i = ys(s);
2056
2039
  if (!i)
2057
- i = new ys(n), se.set(n, i);
2040
+ i = new hs(s), se.set(s, i);
2058
2041
  else {
2059
- var o = vs(i, e);
2060
- s = o && o.observer;
2042
+ var o = bs(i, e);
2043
+ n = o && o.observer;
2061
2044
  }
2062
- if (s)
2063
- return s;
2064
- if (s = {}, i.value = R(n), e) {
2065
- s.callback = e, s.next = null;
2045
+ if (n)
2046
+ return n;
2047
+ if (n = {}, i.value = R(s), e) {
2048
+ n.callback = e, n.next = null;
2066
2049
  var r = function() {
2067
- Y(s);
2050
+ Y(n);
2068
2051
  }, d = function() {
2069
- clearTimeout(s.next), s.next = setTimeout(r);
2052
+ clearTimeout(n.next), n.next = setTimeout(r);
2070
2053
  };
2071
2054
  typeof window < "u" && (window.addEventListener("mouseup", d), window.addEventListener("keyup", d), window.addEventListener("mousedown", d), window.addEventListener("keydown", d), window.addEventListener("change", d));
2072
2055
  }
2073
- return s.patches = t, s.object = n, s.unobserve = function() {
2074
- Y(s), clearTimeout(s.next), Is(i, s), typeof window < "u" && (window.removeEventListener("mouseup", d), window.removeEventListener("keyup", d), window.removeEventListener("mousedown", d), window.removeEventListener("keydown", d), window.removeEventListener("change", d));
2075
- }, i.observers.set(e, new bs(e, s)), s;
2056
+ return n.patches = t, n.object = s, n.unobserve = function() {
2057
+ Y(n), clearTimeout(n.next), ws(i, n), typeof window < "u" && (window.removeEventListener("mouseup", d), window.removeEventListener("keyup", d), window.removeEventListener("mousedown", d), window.removeEventListener("keydown", d), window.removeEventListener("change", d));
2058
+ }, i.observers.set(e, new gs(e, n)), n;
2076
2059
  }
2077
- function Y(n, e) {
2060
+ function Y(s, e) {
2078
2061
  e === void 0 && (e = !1);
2079
- var t = se.get(n.object);
2080
- ne(t.value, n.object, n.patches, "", e), n.patches.length && Z(t.value, n.patches);
2081
- var s = n.patches;
2082
- return s.length > 0 && (n.patches = [], n.callback && n.callback(s)), s;
2062
+ var t = se.get(s.object);
2063
+ ne(t.value, s.object, s.patches, "", e), s.patches.length && Z(t.value, s.patches);
2064
+ var n = s.patches;
2065
+ return n.length > 0 && (s.patches = [], s.callback && s.callback(n)), n;
2083
2066
  }
2084
- function ne(n, e, t, s, i) {
2085
- if (e !== n) {
2067
+ function ne(s, e, t, n, i) {
2068
+ if (e !== s) {
2086
2069
  typeof e.toJSON == "function" && (e = e.toJSON());
2087
- for (var o = X(e), r = X(n), d = !1, l = r.length - 1; l >= 0; l--) {
2088
- var c = r[l], u = n[c];
2070
+ for (var o = X(e), r = X(s), d = !1, l = r.length - 1; l >= 0; l--) {
2071
+ var c = r[l], u = s[c];
2089
2072
  if (G(e, c) && !(e[c] === void 0 && u !== void 0 && Array.isArray(e) === !1)) {
2090
- var m = e[c];
2091
- typeof u == "object" && u != null && typeof m == "object" && m != null && Array.isArray(u) === Array.isArray(m) ? ne(u, m, t, s + "/" + j(c), i) : u !== m && (i && t.push({ op: "test", path: s + "/" + j(c), value: R(u) }), t.push({ op: "replace", path: s + "/" + j(c), value: R(m) }));
2092
- } else Array.isArray(n) === Array.isArray(e) ? (i && t.push({ op: "test", path: s + "/" + j(c), value: R(u) }), t.push({ op: "remove", path: s + "/" + j(c) }), d = !0) : (i && t.push({ op: "test", path: s, value: n }), t.push({ op: "replace", path: s, value: e }));
2073
+ var f = e[c];
2074
+ typeof u == "object" && u != null && typeof f == "object" && f != null && Array.isArray(u) === Array.isArray(f) ? ne(u, f, t, n + "/" + A(c), i) : u !== f && (i && t.push({ op: "test", path: n + "/" + A(c), value: R(u) }), t.push({ op: "replace", path: n + "/" + A(c), value: R(f) }));
2075
+ } else Array.isArray(s) === Array.isArray(e) ? (i && t.push({ op: "test", path: n + "/" + A(c), value: R(u) }), t.push({ op: "remove", path: n + "/" + A(c) }), d = !0) : (i && t.push({ op: "test", path: n, value: s }), t.push({ op: "replace", path: n, value: e }));
2093
2076
  }
2094
2077
  if (!(!d && o.length == r.length))
2095
2078
  for (var l = 0; l < o.length; l++) {
2096
2079
  var c = o[l];
2097
- !G(n, c) && e[c] !== void 0 && t.push({ op: "add", path: s + "/" + j(c), value: R(e[c]) });
2080
+ !G(s, c) && e[c] !== void 0 && t.push({ op: "add", path: n + "/" + A(c), value: R(e[c]) });
2098
2081
  }
2099
2082
  }
2100
2083
  }
2101
- function Q(n, e, t) {
2084
+ function Q(s, e, t) {
2102
2085
  t === void 0 && (t = !1);
2103
- var s = [];
2104
- return ne(n, e, s, "", t), s;
2086
+ var n = [];
2087
+ return ne(s, e, n, "", t), n;
2105
2088
  }
2106
- const Ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2089
+ const Es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2107
2090
  __proto__: null,
2108
2091
  compare: Q,
2109
2092
  generate: Y,
2110
- observe: Ns,
2111
- unobserve: Es
2093
+ observe: Is,
2094
+ unobserve: vs
2112
2095
  }, Symbol.toStringTag, { value: "Module" }));
2113
- Object.assign({}, gs, Ss, {
2114
- JsonPatchError: Xe,
2096
+ Object.assign({}, ps, Es, {
2097
+ JsonPatchError: Ge,
2115
2098
  deepClone: R,
2116
- escapePathComponent: j,
2117
- unescapePathComponent: Ge
2099
+ escapePathComponent: A,
2100
+ unescapePathComponent: We
2118
2101
  });
2119
- function I(n, e, t) {
2120
- return { key: n, getId: (s) => e(s), getLabel: (s) => t(s) };
2121
- }
2122
- const ks = [
2123
- I("roles", (n) => n.id, (n) => n.name),
2124
- I("members", (n) => n.email, (n) => `${n.name} (${n.email})`),
2125
- I("teams", (n) => n.id, (n) => `${n.id} — ${n.name}`),
2126
- I("phases", (n) => n.id, (n) => n.name),
2127
- I("milestones", (n) => n.id, (n) => n.name),
2128
- I("lbs", (n) => n.id, (n) => `${n.id} — ${n.name} (${n.type})`),
2129
- I("disciplines", (n) => n.id, (n) => `${n.id} — ${n.name}`),
2130
- I("extensions", (n) => n.id, (n) => n.id),
2131
- I("assetTypes", (n) => n.id, (n) => `${n.id} — ${n.name}`),
2132
- I("softwares", (n) => n.id, (n) => n.name),
2133
- I("objectives", (n) => n.id, (n) => n.description),
2134
- I("bimUses", (n) => n.id, (n) => n.name),
2135
- I("actions", (n) => n.id, (n) => n.name),
2136
- I("events", (n) => n.id, (n) => n.name),
2137
- I("effects", (n) => n.id, (n) => n.name),
2138
- I("automations", (n) => n.id, (n) => n.name),
2139
- I("workflows", (n) => n.id, (n) => n.name),
2140
- I("guides", (n) => n.id, (n) => n.name),
2141
- I("annexes", (n) => n.id, (n) => n.name),
2142
- I("standards", (n) => n.id, (n) => n.name),
2143
- I("lods", (n) => String(n.id), (n) => `${n.id} — ${n.name}`),
2144
- I("lois", (n) => String(n.id), (n) => `${n.id} — ${n.name}`),
2145
- I("loin", (n) => n.id, (n) => n.element),
2146
- I("deliverables", (n) => n.id, (n) => n.description ?? n.id),
2147
- I("notes", (n) => n.id, (n) => n.message),
2148
- I("env", (n) => n.key, (n) => n.key)
2102
+ function I(s, e, t) {
2103
+ return { key: s, getId: (n) => e(n), getLabel: (n) => t(n) };
2104
+ }
2105
+ const Ns = [
2106
+ I("roles", (s) => s.id, (s) => s.name),
2107
+ I("members", (s) => s.email, (s) => `${s.name} (${s.email})`),
2108
+ I("teams", (s) => s.id, (s) => `${s.id} — ${s.name}`),
2109
+ I("phases", (s) => s.id, (s) => s.name),
2110
+ I("milestones", (s) => s.id, (s) => s.name),
2111
+ I("lbs", (s) => s.id, (s) => `${s.id} — ${s.name} (${s.type})`),
2112
+ I("disciplines", (s) => s.id, (s) => `${s.id} — ${s.name}`),
2113
+ I("extensions", (s) => s.id, (s) => s.id),
2114
+ I("assetTypes", (s) => s.id, (s) => `${s.id} — ${s.name}`),
2115
+ I("softwares", (s) => s.id, (s) => s.name),
2116
+ I("objectives", (s) => s.id, (s) => s.description),
2117
+ I("bimUses", (s) => s.id, (s) => s.name),
2118
+ I("actions", (s) => s.id, (s) => s.name),
2119
+ I("events", (s) => s.id, (s) => s.name),
2120
+ I("effects", (s) => s.id, (s) => s.name),
2121
+ I("automations", (s) => s.id, (s) => s.name),
2122
+ I("workflows", (s) => s.id, (s) => s.name),
2123
+ I("guides", (s) => s.id, (s) => s.name),
2124
+ I("annexes", (s) => s.id, (s) => s.name),
2125
+ I("standards", (s) => s.id, (s) => s.name),
2126
+ I("lods", (s) => String(s.id), (s) => `${s.id} — ${s.name}`),
2127
+ I("lois", (s) => String(s.id), (s) => `${s.id} — ${s.name}`),
2128
+ I("loin", (s) => s.id, (s) => s.element),
2129
+ I("deliverables", (s) => s.id, (s) => s.description ?? s.id),
2130
+ I("notes", (s) => s.id, (s) => s.message),
2131
+ I("env", (s) => s.key, (s) => s.key)
2149
2132
  ];
2150
- function $s(n, e, t, s) {
2151
- const i = new Map(n.map((r) => [t(r), r])), o = new Map(e.map((r) => [t(r), r]));
2133
+ function Ss(s, e, t, n) {
2134
+ const i = new Map(s.map((r) => [t(r), r])), o = new Map(e.map((r) => [t(r), r]));
2152
2135
  return {
2153
- added: e.filter((r) => !i.has(t(r))).map(s),
2154
- removed: n.filter((r) => !o.has(t(r))).map(s),
2136
+ added: e.filter((r) => !i.has(t(r))).map(n),
2137
+ removed: s.filter((r) => !o.has(t(r))).map(n),
2155
2138
  modified: e.filter((r) => {
2156
2139
  const d = i.get(t(r));
2157
2140
  return d !== void 0 && JSON.stringify(d) !== JSON.stringify(r);
2158
- }).map(s)
2141
+ }).map(n)
2159
2142
  };
2160
2143
  }
2161
- function Rs(n, e) {
2144
+ function ks(s, e) {
2162
2145
  let t = null;
2163
- JSON.stringify(n.project) !== JSON.stringify(e.project) && (t = { changed: !0, fields: Object.keys({ ...n.project, ...e.project }).filter((r) => {
2164
- const d = n.project[r], l = e.project[r];
2146
+ JSON.stringify(s.project) !== JSON.stringify(e.project) && (t = { changed: !0, fields: Object.keys({ ...s.project, ...e.project }).filter((r) => {
2147
+ const d = s.project[r], l = e.project[r];
2165
2148
  return JSON.stringify(d) !== JSON.stringify(l);
2166
2149
  }) });
2167
- const s = {};
2168
- for (const { key: o, getId: r, getLabel: d } of ks) {
2169
- const l = e[o] ?? [], c = n[o] ?? [], u = $s(l, c, r, d);
2170
- (u.added.length || u.removed.length || u.modified.length) && (s[o] = u);
2150
+ const n = {};
2151
+ for (const { key: o, getId: r, getLabel: d } of Ns) {
2152
+ const l = e[o] ?? [], c = s[o] ?? [], u = Ss(l, c, r, d);
2153
+ (u.added.length || u.removed.length || u.modified.length) && (n[o] = u);
2171
2154
  }
2172
- const i = [...t ? ["project"] : [], ...Object.keys(s)];
2173
- return { project: t, sections: s, changedKeys: i };
2155
+ const i = [...t ? ["project"] : [], ...Object.keys(n)];
2156
+ return { project: t, sections: n, changedKeys: i };
2174
2157
  }
2175
2158
  class k {
2176
- constructor(e, t, s) {
2177
- this.getBep = e, this.setBep = t, this.getZip = s;
2159
+ constructor(e, t, n) {
2160
+ this.getBep = e, this.setBep = t, this.getZip = n;
2178
2161
  }
2179
2162
  getBep;
2180
2163
  setBep;
2181
2164
  getZip;
2182
2165
  // ─── Version helpers ──────────────────────────────────────────────────────
2183
2166
  static parseVersion(e) {
2184
- const [t, s] = e.split(".").map(Number);
2185
- return { major: t, minor: s };
2167
+ const [t, n] = e.split(".").map(Number);
2168
+ return { major: t, minor: n };
2186
2169
  }
2187
2170
  static compareVersions(e, t) {
2188
- const s = k.parseVersion(e), i = k.parseVersion(t);
2189
- return s.major !== i.major ? s.major - i.major : s.minor - i.minor;
2171
+ const n = k.parseVersion(e), i = k.parseVersion(t);
2172
+ return n.major !== i.major ? n.major - i.major : n.minor - i.minor;
2190
2173
  }
2191
2174
  static bumpVersion(e, t) {
2192
- const [s, i] = e.split(".").map(Number);
2193
- return t === "version" ? `${s + 1}.0` : `${s}.${i + 1}`;
2175
+ const [n, i] = e.split(".").map(Number);
2176
+ return t === "version" ? `${n + 1}.0` : `${n}.${i + 1}`;
2194
2177
  }
2195
2178
  // ─── Zip helpers ──────────────────────────────────────────────────────────
2196
2179
  async readChangelog() {
@@ -2207,17 +2190,17 @@ class k {
2207
2190
  * snapshot, saves changelog/standards/{id}/v{version}.md.
2208
2191
  */
2209
2192
  async snapshotChangedStandards(e, t) {
2210
- const s = this.getZip();
2193
+ const n = this.getZip();
2211
2194
  for (const i of e.standards) {
2212
- const o = s.file(i.contentPath);
2195
+ const o = n.file(i.contentPath);
2213
2196
  if (!o) continue;
2214
- const r = await o.async("string"), d = `changelog/standards/${i.id}/`, l = Object.keys(s.files).filter((u) => u.startsWith(d) && u.endsWith(".md") && u.slice(d.length).startsWith("v")).map((u) => u.slice(d.length + 1, -3));
2197
+ const r = await o.async("string"), d = `changelog/standards/${i.id}/`, l = Object.keys(n.files).filter((u) => u.startsWith(d) && u.endsWith(".md") && u.slice(d.length).startsWith("v")).map((u) => u.slice(d.length + 1, -3));
2215
2198
  let c = null;
2216
2199
  if (l.length > 0) {
2217
- const u = l.sort((f, p) => k.compareVersions(p, f))[0], m = s.file(`${d}v${u}.md`);
2218
- m && (c = await m.async("string"));
2200
+ const u = l.sort((m, p) => k.compareVersions(p, m))[0], f = n.file(`${d}v${u}.md`);
2201
+ f && (c = await f.async("string"));
2219
2202
  }
2220
- c !== r && s.file(`${d}v${t}.md`, r);
2203
+ c !== r && n.file(`${d}v${t}.md`, r);
2221
2204
  }
2222
2205
  }
2223
2206
  /**
@@ -2226,11 +2209,11 @@ class k {
2226
2209
  */
2227
2210
  async snapshotBaseStandards(e) {
2228
2211
  const t = this.getZip();
2229
- for (const s of e.standards) {
2230
- const i = t.file(s.contentPath);
2212
+ for (const n of e.standards) {
2213
+ const i = t.file(n.contentPath);
2231
2214
  if (!i) continue;
2232
2215
  const o = await i.async("string");
2233
- t.file(`baseline/standards/${s.id}.md`, o);
2216
+ t.file(`baseline/standards/${n.id}.md`, o);
2234
2217
  }
2235
2218
  }
2236
2219
  /**
@@ -2239,12 +2222,12 @@ class k {
2239
2222
  * Falls back to the current file if no snapshot exists (content never changed).
2240
2223
  */
2241
2224
  async resolveStandardContent(e, t) {
2242
- const s = this.getZip(), i = `changelog/standards/${e.id}/`, o = Object.keys(s.files).filter((d) => d.startsWith(i) && d.endsWith(".md") && d.slice(i.length).startsWith("v")).map((d) => d.slice(i.length + 1, -3)).filter((d) => k.compareVersions(d, t) <= 0).sort((d, l) => k.compareVersions(l, d));
2225
+ const n = this.getZip(), i = `changelog/standards/${e.id}/`, o = Object.keys(n.files).filter((d) => d.startsWith(i) && d.endsWith(".md") && d.slice(i.length).startsWith("v")).map((d) => d.slice(i.length + 1, -3)).filter((d) => k.compareVersions(d, t) <= 0).sort((d, l) => k.compareVersions(l, d));
2243
2226
  if (o.length === 0) {
2244
- const d = s.file(e.contentPath);
2227
+ const d = n.file(e.contentPath);
2245
2228
  return d ? d.async("string") : null;
2246
2229
  }
2247
- const r = s.file(`${i}v${o[0]}.md`);
2230
+ const r = n.file(`${i}v${o[0]}.md`);
2248
2231
  return r ? r.async("string") : null;
2249
2232
  }
2250
2233
  // ─── Public API ───────────────────────────────────────────────────────────
@@ -2255,7 +2238,7 @@ class k {
2255
2238
  return (await this.readChangelog())?.versions ?? [];
2256
2239
  }
2257
2240
  async commit(e, t = !1) {
2258
- const s = this.getZip(), i = this.getBep(), o = await this.readChangelog(), r = await this.readBaseline(), d = (/* @__PURE__ */ new Date()).toISOString();
2241
+ const n = this.getZip(), i = this.getBep(), o = await this.readChangelog(), r = await this.readBaseline(), d = (/* @__PURE__ */ new Date()).toISOString();
2259
2242
  if (!r) throw new Error("No baseline found — create a BEP with Bep.create() or open one with Bep.open()");
2260
2243
  if (e.type === "version") {
2261
2244
  const g = e.approvedBy.filter((h) => !i.members.some((b) => b.email === h));
@@ -2263,11 +2246,11 @@ class k {
2263
2246
  }
2264
2247
  if (!t && !await this.hasPendingChanges())
2265
2248
  throw new Error("No pending changes since last commit");
2266
- const l = o?.current ?? "0.0", c = k.bumpVersion(l, e.type), u = `changelog/v${c}.diff.json`, m = Q(i, r), f = e.type === "patch" ? { version: c, type: "patch", date: d, author: e.author, description: e.description, diff: u } : { version: c, type: "version", date: d, author: e.author, description: e.description, approvedBy: e.approvedBy, diff: u }, p = {
2249
+ const l = o?.current ?? "0.0", c = k.bumpVersion(l, e.type), u = `changelog/v${c}.diff.json`, f = Q(i, r), m = e.type === "patch" ? { version: c, type: "patch", date: d, author: e.author, description: e.description, diff: u } : { version: c, type: "version", date: d, author: e.author, description: e.description, approvedBy: e.approvedBy, diff: u }, p = {
2267
2250
  current: c,
2268
- versions: [...o?.versions ?? [], f]
2251
+ versions: [...o?.versions ?? [], m]
2269
2252
  };
2270
- return s.file(u, JSON.stringify(m, null, 2)), await this.snapshotChangedStandards(i, c), s.file("baseline/bep.json", JSON.stringify(i, null, 2)), await this.snapshotBaseStandards(i), s.file("changelog.json", JSON.stringify(p, null, 2)), f;
2253
+ return n.file(u, JSON.stringify(f, null, 2)), await this.snapshotChangedStandards(i, c), n.file("baseline/bep.json", JSON.stringify(i, null, 2)), await this.snapshotBaseStandards(i), n.file("changelog.json", JSON.stringify(p, null, 2)), m;
2271
2254
  }
2272
2255
  /**
2273
2256
  * Reconstructs the BEP state at the given version (read-only).
@@ -2278,13 +2261,13 @@ class k {
2278
2261
  if (!t) throw new Error("No changelog found — call commit() first");
2279
2262
  if (e === t.current)
2280
2263
  return JSON.parse(JSON.stringify(this.getBep()));
2281
- const s = t.versions.findIndex((r) => r.version === e);
2282
- if (s === -1) {
2264
+ const n = t.versions.findIndex((r) => r.version === e);
2265
+ if (n === -1) {
2283
2266
  const r = this.getZip().file(`changelog/v${e}.json`);
2284
2267
  if (!r) throw new Error(`Version not found: ${e}`);
2285
2268
  return B(JSON.parse(await r.async("string")));
2286
2269
  }
2287
- if (t.versions[s].diff === null) {
2270
+ if (t.versions[n].diff === null) {
2288
2271
  const r = this.getZip().file(`changelog/v${e}.json`);
2289
2272
  if (!r) throw new Error(`Missing terminus: changelog/v${e}.json`);
2290
2273
  return B(JSON.parse(await r.async("string")));
@@ -2301,14 +2284,14 @@ class k {
2301
2284
  }
2302
2285
  /** Returns the RFC 6902 diff and standards summary between two versions. */
2303
2286
  async compare(e, t) {
2304
- const [s, i, o] = await Promise.all([
2287
+ const [n, i, o] = await Promise.all([
2305
2288
  this.get(e),
2306
2289
  this.get(t),
2307
2290
  this.readChangelog()
2308
- ]), r = Q(s, i), d = new Set(s.standards.map((h) => h.id)), l = new Set(i.standards.map((h) => h.id)), c = i.standards.filter((h) => !d.has(h.id)).map((h) => ({ id: h.id, name: h.name })), u = s.standards.filter((h) => !l.has(h.id)).map((h) => ({ id: h.id, name: h.name })), f = (o?.versions ?? []).filter((h) => k.compareVersions(h.version, e) > 0 && k.compareVersions(h.version, t) <= 0).map((h) => h.version), p = this.getZip(), g = (await Promise.all(
2291
+ ]), r = Q(n, i), d = new Set(n.standards.map((h) => h.id)), l = new Set(i.standards.map((h) => h.id)), c = i.standards.filter((h) => !d.has(h.id)).map((h) => ({ id: h.id, name: h.name })), u = n.standards.filter((h) => !l.has(h.id)).map((h) => ({ id: h.id, name: h.name })), m = (o?.versions ?? []).filter((h) => k.compareVersions(h.version, e) > 0 && k.compareVersions(h.version, t) <= 0).map((h) => h.version), p = this.getZip(), g = (await Promise.all(
2309
2292
  i.standards.filter((h) => d.has(h.id)).map(async (h) => {
2310
2293
  const b = (await Promise.all(
2311
- f.map(async ($) => p.file(`changelog/standards/${h.id}/v${$}.md`) !== null ? $ : null)
2294
+ m.map(async ($) => p.file(`changelog/standards/${h.id}/v${$}.md`) !== null ? $ : null)
2312
2295
  )).filter(($) => $ !== null);
2313
2296
  return b.length > 0 ? { id: h.id, name: h.name, changedIn: b } : null;
2314
2297
  })
@@ -2322,9 +2305,9 @@ class k {
2322
2305
  async discard() {
2323
2306
  const e = this.getZip(), t = await this.readBaseline();
2324
2307
  if (!t) throw new Error("No baseline found — call commit() first");
2325
- const s = new Set(t.standards.map((i) => i.id));
2308
+ const n = new Set(t.standards.map((i) => i.id));
2326
2309
  for (const i of this.getBep().standards)
2327
- s.has(i.id) || e.remove(i.contentPath);
2310
+ n.has(i.id) || e.remove(i.contentPath);
2328
2311
  for (const i of t.standards) {
2329
2312
  const o = e.file(`baseline/standards/${i.id}.md`);
2330
2313
  if (!o) continue;
@@ -2338,10 +2321,10 @@ class k {
2338
2321
  * version and immediately commits it as a new version.
2339
2322
  */
2340
2323
  async revert(e, t) {
2341
- const s = this.getZip(), i = await this.get(e);
2324
+ const n = this.getZip(), i = await this.get(e);
2342
2325
  for (const o of i.standards) {
2343
2326
  const r = await this.resolveStandardContent(o, e);
2344
- r !== null && s.file(o.contentPath, r);
2327
+ r !== null && n.file(o.contentPath, r);
2345
2328
  }
2346
2329
  return this.setBep(i), this.commit(t);
2347
2330
  }
@@ -2352,12 +2335,12 @@ class k {
2352
2335
  async status() {
2353
2336
  const e = this.getZip(), t = await this.readBaseline();
2354
2337
  if (!t) return { hasPendingChanges: !1, project: null, sections: {}, changedKeys: [], standards: [] };
2355
- const s = this.getBep(), i = Rs(s, t), o = [], r = new Map(t.standards.map((c) => [c.id, c])), d = new Set(s.standards.map((c) => c.id));
2356
- for (const c of s.standards)
2338
+ const n = this.getBep(), i = ks(n, t), o = [], r = new Map(t.standards.map((c) => [c.id, c])), d = new Set(n.standards.map((c) => c.id));
2339
+ for (const c of n.standards)
2357
2340
  if (!r.has(c.id))
2358
2341
  o.push({ id: c.id, name: c.name, status: "added" });
2359
2342
  else {
2360
- const u = JSON.stringify(r.get(c.id)) !== JSON.stringify(c), m = e.file(`baseline/standards/${c.id}.md`), f = e.file(c.contentPath), p = m ? await m.async("string") : "", g = f ? await f.async("string") : "";
2343
+ const u = JSON.stringify(r.get(c.id)) !== JSON.stringify(c), f = e.file(`baseline/standards/${c.id}.md`), m = e.file(c.contentPath), p = f ? await f.async("string") : "", g = m ? await m.async("string") : "";
2361
2344
  u ? o.push({ id: c.id, name: c.name, status: "modified" }) : p !== g && o.push({ id: c.id, name: c.name, status: "content-modified" });
2362
2345
  }
2363
2346
  for (const c of t.standards)
@@ -2370,7 +2353,7 @@ class k {
2370
2353
  }
2371
2354
  /** Returns all versions sorted ascending, with author/approvedBy resolved to { email, name } objects. */
2372
2355
  async listResolved() {
2373
- const [e, t] = await Promise.all([this.list(), this.current()]), s = this.getBep().members;
2356
+ const [e, t] = await Promise.all([this.list(), this.current()]), n = this.getBep().members;
2374
2357
  return e.sort((i, o) => k.compareVersions(i.version, o.version)).map((i) => ({
2375
2358
  version: i.version,
2376
2359
  type: i.type,
@@ -2378,11 +2361,11 @@ class k {
2378
2361
  description: i.description,
2379
2362
  diff: i.diff,
2380
2363
  isCurrent: i.version === t,
2381
- author: i.author ? { email: i.author, name: s.find((o) => o.email === i.author)?.name ?? null } : null,
2364
+ author: i.author ? { email: i.author, name: n.find((o) => o.email === i.author)?.name ?? null } : null,
2382
2365
  ...i.type === "version" ? {
2383
2366
  approvedBy: i.approvedBy.map((o) => ({
2384
2367
  email: o,
2385
- name: s.find((r) => r.email === o)?.name ?? null
2368
+ name: n.find((r) => r.email === o)?.name ?? null
2386
2369
  }))
2387
2370
  } : {}
2388
2371
  }));
@@ -2400,14 +2383,14 @@ class k {
2400
2383
  * deletes all subsequent diffs, standard snapshots, and changelog entries.
2401
2384
  */
2402
2385
  async reset(e) {
2403
- const t = this.getZip(), s = await this.readChangelog();
2404
- if (!s) throw new Error("No changelog found");
2405
- const i = s.versions.find((c) => c.version === e), o = !!this.getZip().file(`changelog/v${e}.json`);
2386
+ const t = this.getZip(), n = await this.readChangelog();
2387
+ if (!n) throw new Error("No changelog found");
2388
+ const i = n.versions.find((c) => c.version === e), o = !!this.getZip().file(`changelog/v${e}.json`);
2406
2389
  if (!i && !o)
2407
2390
  throw new Error(`Version not found: ${e}`);
2408
- if (e === s.current)
2391
+ if (e === n.current)
2409
2392
  throw new Error(`Already at version ${e}`);
2410
- const r = s.versions.filter((c) => k.compareVersions(c.version, e) > 0), d = await this.get(e);
2393
+ const r = n.versions.filter((c) => k.compareVersions(c.version, e) > 0), d = await this.get(e);
2411
2394
  for (const c of d.standards) {
2412
2395
  const u = await this.resolveStandardContent(c, e);
2413
2396
  u !== null && t.file(c.contentPath, u);
@@ -2418,7 +2401,7 @@ class k {
2418
2401
  const l = JSON.stringify(d, null, 2);
2419
2402
  t.file("changelog.json", JSON.stringify({
2420
2403
  current: e,
2421
- versions: s.versions.filter((c) => k.compareVersions(c.version, e) <= 0)
2404
+ versions: n.versions.filter((c) => k.compareVersions(c.version, e) <= 0)
2422
2405
  }, null, 2)), t.file("bep.json", l), t.file("baseline/bep.json", l), this.setBep(d);
2423
2406
  }
2424
2407
  /**
@@ -2427,15 +2410,15 @@ class k {
2427
2410
  * newBase must be in X.0 format and greater than the current version.
2428
2411
  */
2429
2412
  async squash(e) {
2430
- const t = this.getZip(), s = await this.readChangelog();
2431
- if (!s) throw new Error("No changelog found");
2413
+ const t = this.getZip(), n = await this.readChangelog();
2414
+ if (!n) throw new Error("No changelog found");
2432
2415
  if (!/^\d+\.0$/.test(e.newBase))
2433
2416
  throw new Error(`newBase must be in X.0 format (e.g. "2.0"), got "${e.newBase}"`);
2434
- if (k.compareVersions(e.newBase, s.current) <= 0)
2435
- throw new Error(`newBase "${e.newBase}" must be greater than current version "${s.current}"`);
2417
+ if (k.compareVersions(e.newBase, n.current) <= 0)
2418
+ throw new Error(`newBase "${e.newBase}" must be greater than current version "${n.current}"`);
2436
2419
  const i = this.getBep(), o = e.approvedBy.filter((d) => !i.members.some((l) => l.email === d));
2437
2420
  if (o.length) throw new Error(`Members not found: ${o.join(", ")}`);
2438
- for (const d of s.versions)
2421
+ for (const d of n.versions)
2439
2422
  d.diff && t.remove(d.diff);
2440
2423
  Object.keys(t.files).filter((d) => /^changelog\/v[\d.]+\.json$/.test(d)).forEach((d) => t.remove(d)), Object.keys(t.files).filter((d) => d.startsWith("changelog/standards/") && d.endsWith(".md")).forEach((d) => t.remove(d)), t.file(`changelog/v${e.newBase}.json`, JSON.stringify(i, null, 2));
2441
2424
  for (const d of i.standards) {
@@ -2473,68 +2456,68 @@ class q {
2473
2456
  this.getZip().file(this.path, e);
2474
2457
  }
2475
2458
  }
2476
- const Ts = 10;
2477
- function As(n, e) {
2478
- const t = e[n.field];
2479
- switch (n.operator) {
2459
+ const $s = 10;
2460
+ function Rs(s, e) {
2461
+ const t = e[s.field];
2462
+ switch (s.operator) {
2480
2463
  case "exists":
2481
2464
  return t != null;
2482
2465
  case "eq":
2483
- return t === n.value;
2466
+ return t === s.value;
2484
2467
  case "neq":
2485
- return t !== n.value;
2468
+ return t !== s.value;
2486
2469
  case "gt":
2487
- return typeof t == "number" && typeof n.value == "number" && t > n.value;
2470
+ return typeof t == "number" && typeof s.value == "number" && t > s.value;
2488
2471
  case "lt":
2489
- return typeof t == "number" && typeof n.value == "number" && t < n.value;
2472
+ return typeof t == "number" && typeof s.value == "number" && t < s.value;
2490
2473
  case "contains":
2491
- return typeof t == "string" && typeof n.value == "string" || Array.isArray(t) ? t.includes(n.value) : !1;
2474
+ return typeof t == "string" && typeof s.value == "string" || Array.isArray(t) ? t.includes(s.value) : !1;
2492
2475
  default:
2493
2476
  return !1;
2494
2477
  }
2495
2478
  }
2496
- function js(n, e, t, s) {
2497
- const o = n.workflows.find((f) => f.id === t)?.diagram.nodes[e];
2479
+ function Ts(s, e, t, n) {
2480
+ const o = s.workflows.find((m) => m.id === t)?.diagram.nodes[e];
2498
2481
  if (!o || o.type !== "process") return !0;
2499
2482
  const r = !!(o.responsibleRoleIds?.length || o.responsibleTeamIds?.length || o.responsibleEmails?.length), d = !!(o.accountableRoleIds?.length || o.accountableTeamIds?.length || o.accountableEmails?.length);
2500
2483
  if (!r && !d) return !0;
2501
- const c = n.members.find((f) => f.email === s)?.roleId, u = new Set(n.teams.filter((f) => (f.memberEmails ?? []).includes(s)).map((f) => f.id)), m = (f, p, g) => {
2502
- if (g?.includes(s)) return !0;
2503
- const h = !!f?.length, b = !!p?.length;
2504
- return b && h ? !!c && f.includes(c) && p.some(($) => u.has($)) : b ? p.some(($) => u.has($)) : h ? !!c && f.includes(c) : !1;
2484
+ const c = s.members.find((m) => m.email === n)?.roleId, u = new Set(s.teams.filter((m) => (m.memberEmails ?? []).includes(n)).map((m) => m.id)), f = (m, p, g) => {
2485
+ if (g?.includes(n)) return !0;
2486
+ const h = !!m?.length, b = !!p?.length;
2487
+ return b && h ? !!c && m.includes(c) && p.some(($) => u.has($)) : b ? p.some(($) => u.has($)) : h ? !!c && m.includes(c) : !1;
2505
2488
  };
2506
- return r && m(o.responsibleRoleIds, o.responsibleTeamIds, o.responsibleEmails) || d && m(o.accountableRoleIds, o.accountableTeamIds, o.accountableEmails);
2489
+ return r && f(o.responsibleRoleIds, o.responsibleTeamIds, o.responsibleEmails) || d && f(o.accountableRoleIds, o.accountableTeamIds, o.accountableEmails);
2507
2490
  }
2508
- const Os = { string: "string", number: "number", boolean: "boolean" };
2509
- function _s(n, e, t) {
2510
- const s = n.events.find((d) => d.id === e);
2511
- if (!s?.payload?.length) return [];
2491
+ const js = { string: "string", number: "number", boolean: "boolean" };
2492
+ function As(s, e, t) {
2493
+ const n = s.events.find((d) => d.id === e);
2494
+ if (!n?.payload?.length) return [];
2512
2495
  const i = [], o = t ?? {};
2513
- for (const d of s.payload) {
2496
+ for (const d of n.payload) {
2514
2497
  const l = o[d.key];
2515
2498
  if (l == null)
2516
2499
  d.required && i.push({ field: d.key, reason: "missing" });
2517
2500
  else {
2518
- const c = Os[d.type];
2501
+ const c = js[d.type];
2519
2502
  c && typeof l !== c && i.push({ field: d.key, reason: "wrong_type" });
2520
2503
  }
2521
2504
  }
2522
- const r = new Set(s.payload.map((d) => d.key));
2505
+ const r = new Set(n.payload.map((d) => d.key));
2523
2506
  for (const d of Object.keys(o))
2524
2507
  r.has(d) || i.push({ field: d, reason: "unknown_field" });
2525
2508
  return i;
2526
2509
  }
2527
- function Bs(n, e) {
2528
- return !(!("triggerEventId" in n) || n.triggerEventId !== e.eventId);
2510
+ function Os(s, e) {
2511
+ return !(!("triggerEventId" in s) || s.triggerEventId !== e.eventId);
2529
2512
  }
2530
- function Ms(n, e, t, s, i) {
2531
- const o = n.workflows.find((m) => m.id === e);
2513
+ function _s(s, e, t, n, i) {
2514
+ const o = s.workflows.find((f) => f.id === e);
2532
2515
  if (!o) return null;
2533
2516
  const r = Object.keys(o.diagram.nodes).find(
2534
- (m) => o.diagram.nodes[m].type === "start"
2517
+ (f) => o.diagram.nodes[f].type === "start"
2535
2518
  );
2536
2519
  if (!r) return null;
2537
- const d = Object.entries(o.diagram.edges).find(([, m]) => m.from === r), l = d?.[1].to ?? r, c = d ? (d[1].effectIds ?? []).map((m) => ({ effectId: m, fromEdgeId: d[0] })) : [], u = (/* @__PURE__ */ new Date()).toISOString();
2520
+ const d = Object.entries(o.diagram.edges).find(([, f]) => f.from === r), l = d?.[1].to ?? r, c = d ? (d[1].effectIds ?? []).map((f) => ({ effectId: f, fromEdgeId: d[0] })) : [], u = (/* @__PURE__ */ new Date()).toISOString();
2538
2521
  return {
2539
2522
  instance: {
2540
2523
  id: globalThis.crypto.randomUUID(),
@@ -2546,38 +2529,38 @@ function Ms(n, e, t, s, i) {
2546
2529
  history: [],
2547
2530
  createdAt: u,
2548
2531
  updatedAt: u,
2549
- initiatedBy: s
2532
+ initiatedBy: n
2550
2533
  },
2551
2534
  startEffects: c
2552
2535
  };
2553
2536
  }
2554
- function le(n, e, t, s) {
2537
+ function le(s, e, t, n) {
2555
2538
  if (e.status !== "active")
2556
2539
  return { ok: !1, error: "INSTANCE_NOT_ACTIVE" };
2557
- if (!s?.skipRaci && !js(n, e.currentNodeId, e.workflowId, t.actor))
2540
+ if (!n?.skipRaci && !Ts(s, e.currentNodeId, e.workflowId, t.actor))
2558
2541
  return { ok: !1, error: "UNAUTHORIZED" };
2559
- const i = n.workflows.find((N) => N.id === e.workflowId);
2542
+ const i = s.workflows.find((N) => N.id === e.workflowId);
2560
2543
  if (!i) return { ok: !1, error: "NO_MATCHING_EDGE" };
2561
2544
  const { nodes: o, edges: r } = i.diagram;
2562
2545
  let d = e.currentNodeId;
2563
- const l = [], c = [], u = [], m = Object.entries(r).filter(
2564
- ([, N]) => N.from === d && Bs(N, t)
2546
+ const l = [], c = [], u = [], f = Object.entries(r).filter(
2547
+ ([, N]) => N.from === d && Os(N, t)
2565
2548
  );
2566
- if (m.length === 0) return { ok: !1, error: "NO_MATCHING_EDGE" };
2567
- if (m.length > 1) return { ok: !1, error: "AMBIGUOUS_TRANSITION" };
2568
- const [f, p] = m[0];
2549
+ if (f.length === 0) return { ok: !1, error: "NO_MATCHING_EDGE" };
2550
+ if (f.length > 1) return { ok: !1, error: "AMBIGUOUS_TRANSITION" };
2551
+ const [m, p] = f[0];
2569
2552
  if ("triggerEventId" in p) {
2570
- const N = _s(n, p.triggerEventId, t.payload);
2553
+ const N = As(s, p.triggerEventId, t.payload);
2571
2554
  if (N.length > 0) return { ok: !1, error: "INVALID_PAYLOAD", payloadErrors: N };
2572
2555
  }
2573
- l.push(ce(f, d, p.to, t)), c.push(...(p.effectIds ?? []).map((N) => ({ effectId: N, fromEdgeId: f }))), u.push({ edgeId: f, fromNodeId: d, toNodeId: p.to }), d = p.to;
2556
+ l.push(ce(m, d, p.to, t)), c.push(...(p.effectIds ?? []).map((N) => ({ effectId: N, fromEdgeId: m }))), u.push({ edgeId: m, fromNodeId: d, toNodeId: p.to }), d = p.to;
2574
2557
  let g = 0;
2575
2558
  for (; o[d]?.type === "decision"; ) {
2576
- if (++g > Ts) return { ok: !1, error: "DECISION_LOOP" };
2577
- const N = Object.entries(r).filter(([, v]) => v.from !== d || !("guard" in v) ? !1 : As(v.guard, t.payload ?? {}));
2559
+ if (++g > $s) return { ok: !1, error: "DECISION_LOOP" };
2560
+ const N = Object.entries(r).filter(([, v]) => v.from !== d || !("guard" in v) ? !1 : Rs(v.guard, t.payload ?? {}));
2578
2561
  if (N.length === 0) break;
2579
- const [A, w] = N[0];
2580
- l.push(ce(A, d, w.to, t, !0)), c.push(...(w.effectIds ?? []).map((v) => ({ effectId: v, fromEdgeId: A }))), u.push({ edgeId: A, fromNodeId: d, toNodeId: w.to }), d = w.to;
2562
+ const [j, w] = N[0];
2563
+ l.push(ce(j, d, w.to, t, !0)), c.push(...(w.effectIds ?? []).map((v) => ({ effectId: v, fromEdgeId: j }))), u.push({ edgeId: j, fromNodeId: d, toNodeId: w.to }), d = w.to;
2581
2564
  }
2582
2565
  const h = o[d], b = h?.type === "end" ? "completed" : "active", $ = {
2583
2566
  ...e,
@@ -2588,28 +2571,28 @@ function le(n, e, t, s) {
2588
2571
  }, T = h?.type === "automation" && h.automationId ? { nodeId: d, automationId: h.automationId } : void 0;
2589
2572
  return { ok: !0, instance: $, transitionsApplied: u, effectsToFire: c, automationNodePending: T };
2590
2573
  }
2591
- function xs(n, e, t) {
2592
- const s = n.workflows.find((w) => w.id === e.workflowId), { nodes: i, edges: o } = s.diagram, r = i[e.currentNodeId], l = n.members.find((w) => w.email === t)?.roleId, c = new Set(
2593
- n.teams.filter((w) => (w.memberEmails ?? []).includes(t)).map((w) => w.id)
2574
+ function Bs(s, e, t) {
2575
+ const n = s.workflows.find((w) => w.id === e.workflowId), { nodes: i, edges: o } = n.diagram, r = i[e.currentNodeId], l = s.members.find((w) => w.email === t)?.roleId, c = new Set(
2576
+ s.teams.filter((w) => (w.memberEmails ?? []).includes(t)).map((w) => w.id)
2594
2577
  ), u = (w) => (w ?? []).flatMap((v) => {
2595
- const S = n.roles.find((_) => _.id === v);
2578
+ const S = s.roles.find((_) => _.id === v);
2596
2579
  return S ? [{ id: S.id, name: S.name }] : [];
2597
- }), m = (w) => (w ?? []).flatMap((v) => {
2598
- const S = n.teams.find((_) => _.id === v);
2580
+ }), f = (w) => (w ?? []).flatMap((v) => {
2581
+ const S = s.teams.find((_) => _.id === v);
2599
2582
  return S ? [{ id: S.id, name: S.name }] : [];
2600
- }), f = (w, v, S) => ({
2583
+ }), m = (w, v, S) => ({
2601
2584
  roles: u(w),
2602
- teams: m(v),
2585
+ teams: f(v),
2603
2586
  emails: S ?? []
2604
2587
  }), p = (w, v, S) => {
2605
2588
  if (S?.includes(t)) return !0;
2606
2589
  const _ = !!w?.length, ie = !!v?.length;
2607
2590
  return ie && _ ? !!l && w.includes(l) && v.some((J) => c.has(J)) : ie ? v.some((J) => c.has(J)) : _ ? !!l && w.includes(l) : !1;
2608
- }, g = r.type === "process" ? r : null, h = !!(g?.responsibleRoleIds?.length || g?.responsibleTeamIds?.length || g?.responsibleEmails?.length), b = !!(g?.accountableRoleIds?.length || g?.accountableTeamIds?.length || g?.accountableEmails?.length), $ = !h && !b || h && p(g?.responsibleRoleIds, g?.responsibleTeamIds, g?.responsibleEmails) || b && p(g?.accountableRoleIds, g?.accountableTeamIds, g?.accountableEmails), T = (w) => (n.events.find((v) => v.id === w)?.payload ?? []).map((v) => ({
2591
+ }, g = r.type === "process" ? r : null, h = !!(g?.responsibleRoleIds?.length || g?.responsibleTeamIds?.length || g?.responsibleEmails?.length), b = !!(g?.accountableRoleIds?.length || g?.accountableTeamIds?.length || g?.accountableEmails?.length), $ = !h && !b || h && p(g?.responsibleRoleIds, g?.responsibleTeamIds, g?.responsibleEmails) || b && p(g?.accountableRoleIds, g?.accountableTeamIds, g?.accountableEmails), T = (w) => (s.events.find((v) => v.id === w)?.payload ?? []).map((v) => ({
2609
2592
  key: v.key,
2610
2593
  type: v.type,
2611
2594
  required: v.required
2612
- })), N = [], A = [];
2595
+ })), N = [], j = [];
2613
2596
  for (const [w, v] of Object.entries(o)) {
2614
2597
  if (v.from !== e.currentNodeId || !("triggerEventId" in v)) continue;
2615
2598
  const S = v.triggerEventId;
@@ -2618,11 +2601,11 @@ function xs(n, e, t) {
2618
2601
  label: v.label ?? S,
2619
2602
  emits: S,
2620
2603
  requiredPayload: T(S)
2621
- }) : A.push({
2604
+ }) : j.push({
2622
2605
  edgeId: w,
2623
2606
  label: v.label ?? S,
2624
2607
  reason: "UNAUTHORIZED",
2625
- required: f(
2608
+ required: m(
2626
2609
  [...g?.responsibleRoleIds ?? [], ...g?.accountableRoleIds ?? []],
2627
2610
  [...g?.responsibleTeamIds ?? [], ...g?.accountableTeamIds ?? []],
2628
2611
  [...g?.responsibleEmails ?? [], ...g?.accountableEmails ?? []]
@@ -2636,33 +2619,33 @@ function xs(n, e, t) {
2636
2619
  label: e.currentNodeId
2637
2620
  },
2638
2621
  availableTransitions: N,
2639
- blockedTransitions: A,
2622
+ blockedTransitions: j,
2640
2623
  raci: {
2641
- responsible: f(g?.responsibleRoleIds, g?.responsibleTeamIds, g?.responsibleEmails),
2642
- accountable: f(g?.accountableRoleIds, g?.accountableTeamIds, g?.accountableEmails),
2643
- consulted: f(g?.consultedRoleIds, g?.consultedTeamIds, g?.consultedEmails),
2644
- informed: f(g?.informedRoleIds, g?.informedTeamIds, g?.informedEmails)
2624
+ responsible: m(g?.responsibleRoleIds, g?.responsibleTeamIds, g?.responsibleEmails),
2625
+ accountable: m(g?.accountableRoleIds, g?.accountableTeamIds, g?.accountableEmails),
2626
+ consulted: m(g?.consultedRoleIds, g?.consultedTeamIds, g?.consultedEmails),
2627
+ informed: m(g?.informedRoleIds, g?.informedTeamIds, g?.informedEmails)
2645
2628
  },
2646
2629
  isTerminal: r.type === "end"
2647
2630
  };
2648
2631
  }
2649
- function ce(n, e, t, s, i) {
2632
+ function ce(s, e, t, n, i) {
2650
2633
  return {
2651
2634
  id: globalThis.crypto.randomUUID(),
2652
- edgeId: n,
2635
+ edgeId: s,
2653
2636
  fromNodeId: e,
2654
2637
  toNodeId: t,
2655
- trigger: s,
2656
- actor: s.actor,
2638
+ trigger: n,
2639
+ actor: n.actor,
2657
2640
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2658
2641
  ...i ? { auto: !0 } : {}
2659
2642
  };
2660
2643
  }
2661
- class Ps {
2644
+ class Ms {
2662
2645
  instances = /* @__PURE__ */ new Map();
2663
2646
  async listInstances(e) {
2664
2647
  let t = [...this.instances.values()];
2665
- return e?.workflowId && (t = t.filter((s) => s.workflowId === e.workflowId)), e?.status && (t = t.filter((s) => s.status === e.status)), e?.trackedAssetTypeId && (t = t.filter((s) => s.trackedAsset.assetTypeId === e.trackedAssetTypeId)), e?.trackedAssetId && (t = t.filter((s) => s.trackedAsset.id === e.trackedAssetId)), t;
2648
+ return e?.workflowId && (t = t.filter((n) => n.workflowId === e.workflowId)), e?.status && (t = t.filter((n) => n.status === e.status)), e?.trackedAssetTypeId && (t = t.filter((n) => n.trackedAsset.assetTypeId === e.trackedAssetTypeId)), e?.trackedAssetId && (t = t.filter((n) => n.trackedAsset.id === e.trackedAssetId)), t;
2666
2649
  }
2667
2650
  async getInstance(e) {
2668
2651
  return this.instances.get(e) ?? null;
@@ -2674,18 +2657,18 @@ class Ps {
2674
2657
  this.instances.delete(e);
2675
2658
  }
2676
2659
  }
2677
- function Fs(n) {
2678
- if (n == null) return "Unknown error";
2679
- if (typeof n == "string") return n;
2680
- const e = n, t = typeof e.name == "string" ? e.name : "Error", s = typeof e.message == "string" ? e.message : void 0;
2681
- if (s !== void 0) return s ? `${t}: ${s}` : t;
2660
+ function xs(s) {
2661
+ if (s == null) return "Unknown error";
2662
+ if (typeof s == "string") return s;
2663
+ const e = s, t = typeof e.name == "string" ? e.name : "Error", n = typeof e.message == "string" ? e.message : void 0;
2664
+ if (n !== void 0) return n ? `${t}: ${n}` : t;
2682
2665
  try {
2683
- return String(n);
2666
+ return String(s);
2684
2667
  } catch {
2685
2668
  return "Unknown error";
2686
2669
  }
2687
2670
  }
2688
- class Cs {
2671
+ class Ps {
2689
2672
  getBep;
2690
2673
  getHistoricalBep;
2691
2674
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -2709,7 +2692,7 @@ class Cs {
2709
2692
  * Returns `this` for chaining.
2710
2693
  */
2711
2694
  init(e) {
2712
- return this.runtime = e.runtime, this.storage = e.storage ?? new Ps(), this.skipRaci = e.events?.skipRaci ?? !1, this;
2695
+ return this.runtime = e.runtime, this.storage = e.storage ?? new Ms(), this.skipRaci = e.events?.skipRaci ?? !1, this;
2713
2696
  }
2714
2697
  // ─── Lifecycle listeners ─────────────────────────────────────────────────────
2715
2698
  /** Fires after every successful emit() — all listeners run concurrently. */
@@ -2734,9 +2717,9 @@ class Cs {
2734
2717
  * Records the current BEP version on the instance for historical resolution.
2735
2718
  * Returns null if the workflowId does not exist or has no start node.
2736
2719
  */
2737
- async createInstance(e, t, s) {
2720
+ async createInstance(e, t, n) {
2738
2721
  this._assertInit();
2739
- const i = this.getBep(), r = Ms(i, e, t, s, "unversioned");
2722
+ const i = this.getBep(), r = _s(i, e, t, n, "unversioned");
2740
2723
  if (!r) return null;
2741
2724
  const { instance: d, startEffects: l } = r;
2742
2725
  for (const c of l)
@@ -2756,21 +2739,21 @@ class Cs {
2756
2739
  */
2757
2740
  async emit(e, t) {
2758
2741
  this._assertInit();
2759
- const s = await this.storage.getInstance(e);
2760
- if (!s) return { ok: !1, error: "NO_MATCHING_EDGE" };
2761
- const i = await this._resolveBep(s.bepVersion);
2762
- let o = le(i, s, t, { skipRaci: this.skipRaci });
2742
+ const n = await this.storage.getInstance(e);
2743
+ if (!n) return { ok: !1, error: "NO_MATCHING_EDGE" };
2744
+ const i = await this._resolveBep(n.bepVersion);
2745
+ let o = le(i, n, t, { skipRaci: this.skipRaci });
2763
2746
  if (!o.ok) return { ok: !1, error: o.error, payloadErrors: o.payloadErrors };
2764
2747
  const r = [...o.transitionsApplied ?? []], d = [];
2765
2748
  let l = o.instance;
2766
- for (const m of o.effectsToFire ?? [])
2767
- d.push(await this._executeEffect(l, m));
2749
+ for (const f of o.effectsToFire ?? [])
2750
+ d.push(await this._executeEffect(l, f));
2768
2751
  const c = 10;
2769
2752
  let u = 0;
2770
2753
  for (; o.automationNodePending && u++ < c; ) {
2771
- const { automationId: m } = o.automationNodePending, { eventId: f, ...p } = await this._executeAutomationNode(l, m);
2754
+ const { automationId: f } = o.automationNodePending, { eventId: m, ...p } = await this._executeAutomationNode(l, f);
2772
2755
  if (o = le(i, l, {
2773
- eventId: f,
2756
+ eventId: m,
2774
2757
  actor: "_system",
2775
2758
  softwareId: "_system",
2776
2759
  payload: p
@@ -2797,19 +2780,19 @@ class Cs {
2797
2780
  */
2798
2781
  async getInstances(e) {
2799
2782
  this._assertInit();
2800
- const { pendingActionFor: t, ...s } = e ?? {}, i = await this.storage.listInstances(s);
2783
+ const { pendingActionFor: t, ...n } = e ?? {}, i = await this.storage.listInstances(n);
2801
2784
  if (!t) return i;
2802
2785
  const o = this.getBep(), r = o.members.find((d) => d.email === t);
2803
2786
  return r ? i.filter((d) => {
2804
- const l = o.workflows.find((f) => f.id === d.workflowId);
2787
+ const l = o.workflows.find((m) => m.id === d.workflowId);
2805
2788
  if (!l) return !1;
2806
2789
  const c = l.diagram.nodes[d.currentNodeId];
2807
2790
  if (!c) return !1;
2808
- const u = c.type === "process" ? c : null, m = [
2791
+ const u = c.type === "process" ? c : null, f = [
2809
2792
  ...u?.responsibleRoleIds ?? [],
2810
2793
  ...u?.accountableRoleIds ?? []
2811
2794
  ];
2812
- return m.length === 0 || m.includes(r.roleId);
2795
+ return f.length === 0 || f.includes(r.roleId);
2813
2796
  }) : [];
2814
2797
  }
2815
2798
  /**
@@ -2818,10 +2801,10 @@ class Cs {
2818
2801
  */
2819
2802
  async getNodeConfig(e, t) {
2820
2803
  this._assertInit();
2821
- const s = await this.storage.getInstance(e);
2822
- if (!s) return null;
2823
- const i = await this._resolveBep(s.bepVersion);
2824
- return xs(i, s, t);
2804
+ const n = await this.storage.getInstance(e);
2805
+ if (!n) return null;
2806
+ const i = await this._resolveBep(n.bepVersion);
2807
+ return Bs(i, n, t);
2825
2808
  }
2826
2809
  async deleteInstance(e) {
2827
2810
  this._assertInit(), await this.storage.deleteInstance(e);
@@ -2832,17 +2815,10 @@ class Cs {
2832
2815
  */
2833
2816
  async getRemoteData(e) {
2834
2817
  this._assertInit();
2835
- const s = this.getBep().remoteData.find((i) => i.id === e);
2836
- if (!s) throw new Error(`Remote data "${e}" not found in BEP`);
2837
- if (!s.resolverId) throw new Error(`Remote data "${e}" has no resolver assigned`);
2838
- return this.runtime._runResolver(s.resolverId, s.url);
2839
- }
2840
- /**
2841
- * Runs an adapter to transform data into a lens-compatible format.
2842
- * Throws if the adapterId has no registered handler.
2843
- */
2844
- useAdapter(e, t) {
2845
- return this._assertInit(), this.runtime._runAdapter(e, t);
2818
+ const n = this.getBep().remoteData.find((i) => i.id === e);
2819
+ if (!n) throw new Error(`Remote data "${e}" not found in BEP`);
2820
+ if (!n.resolverId) throw new Error(`Remote data "${e}" has no resolver assigned`);
2821
+ return this.runtime._runResolver(n.resolverId, n.url);
2846
2822
  }
2847
2823
  // ─── Internal ────────────────────────────────────────────────────────────────
2848
2824
  _assertInit() {
@@ -2853,11 +2829,11 @@ class Cs {
2853
2829
  return this.getHistoricalBep && e !== "unversioned" ? this.getHistoricalBep(e) : this.getBep();
2854
2830
  }
2855
2831
  async _fire(e, ...t) {
2856
- await Promise.allSettled(e.map((s) => s(...t)));
2832
+ await Promise.allSettled(e.map((n) => n(...t)));
2857
2833
  }
2858
2834
  _resolveFromHistory(e, t) {
2859
- for (let s = t.length - 1; s >= 0; s--) {
2860
- const i = t[s].trigger.payload ?? {};
2835
+ for (let n = t.length - 1; n >= 0; n--) {
2836
+ const i = t[n].trigger.payload ?? {};
2861
2837
  if (e in i) return i[e];
2862
2838
  }
2863
2839
  }
@@ -2877,65 +2853,64 @@ class Cs {
2877
2853
  try {
2878
2854
  return await d(e, l), { effectId: t.effectId, fromEdgeId: t.fromEdgeId, status: "executed" };
2879
2855
  } catch (c) {
2880
- const u = { effectId: t.effectId, fromEdgeId: t.fromEdgeId, status: "failed", error: Fs(c) };
2856
+ const u = { effectId: t.effectId, fromEdgeId: t.fromEdgeId, status: "failed", error: xs(c) };
2881
2857
  return await this._fire(this.effectFailedListeners, e, u), u;
2882
2858
  }
2883
2859
  }
2884
2860
  }
2885
- function Js(n, e) {
2861
+ function zs(s, e) {
2886
2862
  const t = /* @__PURE__ */ new Map();
2887
- for (const s of n) {
2888
- const i = [e(s)].flat();
2863
+ for (const n of s) {
2864
+ const i = [e(n)].flat();
2889
2865
  for (const o of i)
2890
- t.has(o) || t.set(o, []), t.get(o).push(s);
2866
+ t.has(o) || t.set(o, []), t.get(o).push(n);
2891
2867
  }
2892
- return Array.from(t.entries()).map(([s, i]) => ({ key: s, rows: i }));
2868
+ return Array.from(t.entries()).map(([n, i]) => ({ key: n, rows: i }));
2893
2869
  }
2894
- function Ks(n, e = "responsible", t = {}) {
2895
- const { topologicalSort: s = !1 } = t, i = (f) => `_${f}`, o = "#444444", r = Object.entries(n.nodes), d = r.find(([, f]) => f.type === "start")?.[0], l = r.find(([, f]) => f.type === "end")?.[0];
2870
+ function Zs(s, e = "responsible", t = {}) {
2871
+ const { topologicalSort: n = !1 } = t, i = (m) => `_${m}`, o = "#444444", r = Object.entries(s.nodes), d = r.find(([, m]) => m.type === "start")?.[0], l = r.find(([, m]) => m.type === "end")?.[0];
2896
2872
  let c;
2897
- if (s && d) {
2898
- const f = /* @__PURE__ */ new Set(), p = [d], g = [];
2873
+ if (n && d) {
2874
+ const m = /* @__PURE__ */ new Set(), p = [d], g = [];
2899
2875
  for (; p.length; ) {
2900
2876
  const h = p.shift();
2901
- if (!f.has(h)) {
2902
- f.add(h), g.push(h);
2903
- for (const b of Object.values(n.edges))
2904
- b.from === h && !f.has(b.to) && p.push(b.to);
2877
+ if (!m.has(h)) {
2878
+ m.add(h), g.push(h);
2879
+ for (const b of Object.values(s.edges))
2880
+ b.from === h && !m.has(b.to) && p.push(b.to);
2905
2881
  }
2906
2882
  }
2907
2883
  for (const [h] of r)
2908
- f.has(h) || g.push(h);
2884
+ m.has(h) || g.push(h);
2909
2885
  c = g;
2910
2886
  } else {
2911
- const f = r.map(([p]) => p).filter((p) => p !== d && p !== l);
2887
+ const m = r.map(([p]) => p).filter((p) => p !== d && p !== l);
2912
2888
  c = [
2913
2889
  ...d ? [d] : [],
2914
- ...f,
2890
+ ...m,
2915
2891
  ...l ? [l] : []
2916
2892
  ];
2917
2893
  }
2918
- const u = [`flowchart ${n.direction}`];
2919
- for (const f of c) {
2920
- const p = n.nodes[f];
2894
+ const u = [`flowchart ${s.direction}`];
2895
+ for (const m of c) {
2896
+ const p = s.nodes[m];
2921
2897
  if (!p) continue;
2922
- const g = p.type === "start" || p.type === "end", b = (p.type === "decision" ? p.label ?? f : p.action?.name ?? p.automation?.name ?? "").replace(/"/g, "&quot;"), $ = g || p.type === "decision" ? [] : p[e].roles.map((A) => A.name), T = $.length > 0 ? `"<b>${$.join(" · ")}</b><br/>${b}"` : `"${b || f}"`;
2923
- g ? u.push(` ${i(f)}([${b || p.type.toUpperCase()}])`) : p.type === "decision" ? u.push(` ${i(f)}{${T}}`) : p.type === "automation" ? u.push(` ${i(f)}[[${T}]]`) : u.push(` ${i(f)}(${T})`);
2898
+ const g = p.type === "start" || p.type === "end", b = (p.type === "decision" ? p.label ?? m : p.action?.name ?? p.automation?.name ?? "").replace(/"/g, "&quot;"), $ = g || p.type === "decision" ? [] : p[e].roles.map((j) => j.name), T = $.length > 0 ? `"<b>${$.join(" · ")}</b><br/>${b}"` : `"${b || m}"`;
2899
+ g ? u.push(` ${i(m)}([${b || p.type.toUpperCase()}])`) : p.type === "decision" ? u.push(` ${i(m)}{${T}}`) : p.type === "automation" ? u.push(` ${i(m)}[[${T}]]`) : u.push(` ${i(m)}(${T})`);
2924
2900
  const N = p[e].roles[0]?.color ?? o;
2925
- g ? u.push(` style ${i(f)} fill:#2962FF,stroke:none`) : u.push(` style ${i(f)} fill:none,stroke:${N},stroke-width:3px`);
2901
+ g ? u.push(` style ${i(m)} fill:#2962FF,stroke:none`) : u.push(` style ${i(m)} fill:none,stroke:${N},stroke-width:3px`);
2926
2902
  }
2927
- const m = s ? c.flatMap((f) => Object.values(n.edges).filter((p) => p.from === f)) : Object.values(n.edges);
2928
- for (const f of m)
2929
- f.label ? u.push(` ${i(f.from)} -->|${f.label}| ${i(f.to)}`) : u.push(` ${i(f.from)} --> ${i(f.to)}`);
2903
+ const f = n ? c.flatMap((m) => Object.values(s.edges).filter((p) => p.from === m)) : Object.values(s.edges);
2904
+ for (const m of f)
2905
+ m.label ? u.push(` ${i(m.from)} -->|${m.label}| ${i(m.to)}`) : u.push(` ${i(m.from)} --> ${i(m.to)}`);
2930
2906
  return u.join(`
2931
2907
  `);
2932
2908
  }
2933
- class qs {
2909
+ class Js {
2934
2910
  env;
2935
2911
  effects = {};
2936
2912
  automations = {};
2937
2913
  resolvers = {};
2938
- adapters = {};
2939
2914
  constructor({ env: e = {} } = {}) {
2940
2915
  this.env = e;
2941
2916
  }
@@ -2948,26 +2923,17 @@ class qs {
2948
2923
  resolver(e, t) {
2949
2924
  return this.resolvers[e] = t, this;
2950
2925
  }
2951
- adapter(e, t) {
2952
- return this.adapters[e] = t, this;
2953
- }
2954
2926
  /** @internal Called by Engine.getRemoteData — keeps env encapsulated inside the Runtime. */
2955
2927
  _runResolver(e, t) {
2956
- const s = this.resolvers[e];
2957
- if (!s) throw new Error(`No handler declared for resolver "${e}"`);
2958
- return s(t, this.env);
2959
- }
2960
- /** @internal Called by Engine.useAdapter — keeps handler lookup inside the Runtime. */
2961
- _runAdapter(e, t) {
2962
- const s = this.adapters[e];
2963
- if (!s) throw new Error(`No handler declared for adapter "${e}"`);
2964
- return s(t);
2928
+ const n = this.resolvers[e];
2929
+ if (!n) throw new Error(`No handler declared for resolver "${e}"`);
2930
+ return n(t, this.env);
2965
2931
  }
2966
2932
  }
2967
2933
  class D {
2968
2934
  constructor(e, t) {
2969
2935
  this._data = e, this._zip = t;
2970
- const s = () => this._data;
2936
+ const n = () => this._data;
2971
2937
  this.project = new jt(
2972
2938
  () => this._data.project,
2973
2939
  (i) => {
@@ -2978,17 +2944,17 @@ class D {
2978
2944
  const r = [], d = x("project", i.code, o.deliverableNamingConvention);
2979
2945
  return d && r.push(d), i.clientId && !o.teams.some((l) => l.id === i.clientId) && r.push(`teams["${i.clientId}"] not found`), r;
2980
2946
  },
2981
- s
2982
- ), this.actions = new _t(s), this.adapters = new Bt(s), this.annexes = new Mt(s), this.env = new Ft(s), this.events = new Ct(s), this.effects = new xt(s), this.automations = new Pt(s), this.bimUses = new Jt(s, () => this.workflows), this.disciplines = new Kt(s), this.guides = new qt(s), this.lods = new Wt(s), this.lois = new Gt(s), this.loin = new Xt(s), this.lbsNodes = new Qt(s), this.assetTypes = new Vt(s), this.extensions = new Ht(s), this.roles = new Yt(s), this.members = new es(s), this.milestones = new ts(s), this.objectives = new ss(s), this.phases = new ns(s), this.remoteData = new is(s), this.resolvers = new os(s), this.softwares = new rs(s, () => this.assetTypes), this.standards = new as(s, () => this._zip), this.teams = new ds(s, () => this.members), this.workflows = new cs(s, () => this.members, () => this.teams), this.deliverables = new Ut(s, () => this.teams, () => this.assetTypes, () => this.lbsNodes, () => this.milestones), this.notes = new Zt(s, () => this.members), this.flags = new zt(s), this.engine = new Cs(
2947
+ n
2948
+ ), this.actions = new Ot(n), this.annexes = new _t(n), this.env = new xt(n), this.events = new Pt(n), this.effects = new Bt(n), this.automations = new Mt(n), this.bimUses = new zt(n, () => this.workflows), this.disciplines = new Zt(n), this.guides = new Jt(n), this.lods = new Kt(n), this.lois = new qt(n), this.loin = new Wt(n), this.lbsNodes = new Ht(n), this.assetTypes = new Gt(n), this.extensions = new Xt(n), this.roles = new Vt(n), this.members = new Yt(n), this.milestones = new Qt(n), this.objectives = new es(n), this.phases = new ts(n), this.remoteData = new ss(n), this.resolvers = new ns(n), this.softwares = new is(n, () => this.assetTypes), this.standards = new os(n, () => this._zip), this.teams = new rs(n, () => this.members), this.workflows = new ds(n, () => this.members, () => this.teams), this.deliverables = new Dt(n, () => this.teams, () => this.assetTypes, () => this.lbsNodes, () => this.milestones), this.notes = new Ut(n, () => this.members), this.flags = new Lt(n), this.engine = new Ps(
2983
2949
  () => this._data,
2984
2950
  (i) => this.history.get(i)
2985
2951
  ), this.history = new k(
2986
- s,
2952
+ n,
2987
2953
  (i) => {
2988
2954
  this._data = i;
2989
2955
  },
2990
2956
  () => this._zip
2991
- ), this.nomenclature = new Lt(s), this.memory = new q("memory.md", () => this._zip), this.skill = new q("skills/bep-authoring/SKILL.md", () => this._zip), this.icon = new q("icon.svg", () => this._zip);
2957
+ ), this.nomenclature = new Ct(n), this.memory = new q("memory.md", () => this._zip), this.skill = new q("skills/bep-authoring/SKILL.md", () => this._zip), this.icon = new q("icon.svg", () => this._zip);
2992
2958
  }
2993
2959
  _data;
2994
2960
  _zip;
@@ -2996,7 +2962,6 @@ class D {
2996
2962
  project;
2997
2963
  // ─── Entities ─────────────────────────────────────────────────────────────
2998
2964
  actions;
2999
- adapters;
3000
2965
  annexes;
3001
2966
  deliverables;
3002
2967
  effects;
@@ -3046,9 +3011,9 @@ class D {
3046
3011
  * fully operational after open(). Idempotent — existing files are untouched.
3047
3012
  */
3048
3013
  static async open(e) {
3049
- const t = await oe.loadAsync(e), s = t.file("bep.json");
3050
- if (!s) throw new Error("Invalid .bep file: missing bep.json");
3051
- const i = await s.async("string"), o = B(JSON.parse(i));
3014
+ const t = await oe.loadAsync(e), n = t.file("bep.json");
3015
+ if (!n) throw new Error("Invalid .bep file: missing bep.json");
3016
+ const i = await n.async("string"), o = B(JSON.parse(i));
3052
3017
  return await D._initialize(o, t), new D(o, t);
3053
3018
  }
3054
3019
  /**
@@ -3064,11 +3029,11 @@ class D {
3064
3029
  */
3065
3030
  static async _initialize(e, t) {
3066
3031
  t.file("memory.md") || t.file("memory.md", ""), t.file("skills/bep-authoring/SKILL.md") || t.file("skills/bep-authoring/SKILL.md", "");
3067
- for (const s of e.standards)
3068
- t.file(s.contentPath) || t.file(s.contentPath, "");
3032
+ for (const n of e.standards)
3033
+ t.file(n.contentPath) || t.file(n.contentPath, "");
3069
3034
  if (!t.file("baseline/bep.json")) {
3070
- const s = JSON.stringify(e, null, 2);
3071
- t.file("baseline/bep.json", s), t.file("changelog/v0.0.json", s);
3035
+ const n = JSON.stringify(e, null, 2);
3036
+ t.file("baseline/bep.json", n), t.file("changelog/v0.0.json", n);
3072
3037
  for (const i of e.standards) {
3073
3038
  const o = await t.file(i.contentPath).async("string");
3074
3039
  t.file(`baseline/standards/${i.id}.md`, o), t.file(`changelog/standards/${i.id}/v0.0.md`, o);
@@ -3105,8 +3070,8 @@ class D {
3105
3070
  flags: [],
3106
3071
  env: [],
3107
3072
  automations: []
3108
- }), s = new oe(), i = JSON.stringify(t, null, 2);
3109
- return s.file("memory.md", ""), s.file("skills/bep-authoring/SKILL.md", ""), s.file("baseline/bep.json", i), s.file("changelog/v0.0.json", i), new D(t, s);
3073
+ }), n = new oe(), i = JSON.stringify(t, null, 2);
3074
+ return n.file("memory.md", ""), n.file("skills/bep-authoring/SKILL.md", ""), n.file("baseline/bep.json", i), n.file("changelog/v0.0.json", i), new D(t, n);
3110
3075
  }
3111
3076
  // ─── Accessors ────────────────────────────────────────────────────────────
3112
3077
  get data() {
@@ -3122,9 +3087,9 @@ class D {
3122
3087
  delete this._data.deliverableNamingConvention;
3123
3088
  return;
3124
3089
  }
3125
- const t = he.parse(e), s = At(this._data, t);
3126
- if (s.length) throw new Error(`Naming convention incompatible with existing data:
3127
- ${s.join(`
3090
+ const t = he.parse(e), n = Tt(this._data, t);
3091
+ if (n.length) throw new Error(`Naming convention incompatible with existing data:
3092
+ ${n.join(`
3128
3093
  `)}`);
3129
3094
  this._data.deliverableNamingConvention = t;
3130
3095
  }
@@ -3139,8 +3104,8 @@ ${s.join(`
3139
3104
  listSkills() {
3140
3105
  const e = /* @__PURE__ */ new Set();
3141
3106
  return this._zip.forEach((t) => {
3142
- const s = t.match(/^skills\/([^/]+)\/SKILL\.md$/);
3143
- s && e.add(s[1]);
3107
+ const n = t.match(/^skills\/([^/]+)\/SKILL\.md$/);
3108
+ n && e.add(n[1]);
3144
3109
  }), [...e];
3145
3110
  }
3146
3111
  /** Returns the SKILL.md content for the given skill, or null if it does not exist. */
@@ -3154,26 +3119,26 @@ ${s.join(`
3154
3119
  }
3155
3120
  /** Returns the names of all resource files for the given skill. */
3156
3121
  listSkillResources(e) {
3157
- const t = `skills/${e}/resources/`, s = [];
3122
+ const t = `skills/${e}/resources/`, n = [];
3158
3123
  return this._zip.forEach((i) => {
3159
- i.startsWith(t) && i !== t && s.push(i.slice(t.length));
3160
- }), s;
3124
+ i.startsWith(t) && i !== t && n.push(i.slice(t.length));
3125
+ }), n;
3161
3126
  }
3162
3127
  /** Returns the content of a resource file for the given skill, or null if it does not exist. */
3163
3128
  async getSkillResource(e, t) {
3164
- const s = this._zip.file(`skills/${e}/resources/${t}`);
3165
- return s ? s.async("string") : null;
3129
+ const n = this._zip.file(`skills/${e}/resources/${t}`);
3130
+ return n ? n.async("string") : null;
3166
3131
  }
3167
3132
  /** Writes a resource file for the given skill, creating it if needed. */
3168
- async setSkillResource(e, t, s) {
3169
- this._zip.file(`skills/${e}/resources/${t}`, s);
3133
+ async setSkillResource(e, t, n) {
3134
+ this._zip.file(`skills/${e}/resources/${t}`, n);
3170
3135
  }
3171
3136
  /** Removes a skill's SKILL.md and all its resources from the archive. No-op if not found. */
3172
3137
  removeSkill(e) {
3173
- const t = `skills/${e}/`, s = [];
3138
+ const t = `skills/${e}/`, n = [];
3174
3139
  this._zip.forEach((i) => {
3175
- i.startsWith(t) && s.push(i);
3176
- }), s.forEach((i) => this._zip.remove(i));
3140
+ i.startsWith(t) && n.push(i);
3141
+ }), n.forEach((i) => this._zip.remove(i));
3177
3142
  }
3178
3143
  /** Removes a single resource file from a skill. No-op if not found. */
3179
3144
  removeSkillResource(e, t) {
@@ -3191,14 +3156,13 @@ ${s.join(`
3191
3156
  */
3192
3157
  generateRuntimeTypes() {
3193
3158
  const e = (f) => f === "url" ? "string" : f, t = (f) => ` /** ${f} */
3194
- `, s = (f) => `{ ${f.map((p) => `${p.key}${p.required ? "" : "?"}: ${e(p.type)}`).join("; ")} }`, i = (f) => !f.payload || f.payload.length === 0 ? "() => void" : `(payload: ${s(f.payload)}) => void`, o = (f) => {
3195
- const p = f.payload && f.payload.length > 0 ? `payload: ${s(f.payload)}` : "", g = f.output.length === 0 ? "{ eventId: string }" : `{ eventId: string; ${f.output.map((h) => `${h.key}${h.required ? "" : "?"}: ${e(h.type)}`).join("; ")} }`;
3196
- return `(${p}) => ${g}`;
3197
- }, r = (f) => f.envKeys.length === 0 ? "(url: string) => unknown" : `(url: string, env: ${`{ ${f.envKeys.map((g) => `${g}: string`).join("; ")} }`}) => unknown`, d = this._data.effects.length ? this._data.effects.map((f) => `${t(f.description)} '${f.id}': ${i(f)}`).join(`
3159
+ `, n = (f) => `{ ${f.map((m) => `${m.key}${m.required ? "" : "?"}: ${e(m.type)}`).join("; ")} }`, i = (f) => !f.payload || f.payload.length === 0 ? "() => void" : `(payload: ${n(f.payload)}) => void`, o = (f) => {
3160
+ const m = f.payload && f.payload.length > 0 ? `payload: ${n(f.payload)}` : "", p = f.output.length === 0 ? "{ eventId: string }" : `{ eventId: string; ${f.output.map((g) => `${g.key}${g.required ? "" : "?"}: ${e(g.type)}`).join("; ")} }`;
3161
+ return `(${m}) => ${p}`;
3162
+ }, r = (f) => f.envKeys.length === 0 ? "(url: string) => unknown" : `(url: string, env: ${`{ ${f.envKeys.map((p) => `${p}: string`).join("; ")} }`}) => unknown`, d = this._data.effects.length ? this._data.effects.map((f) => `${t(f.description)} '${f.id}': ${i(f)}`).join(`
3198
3163
  `) : " [key: string]: () => void", l = this._data.automations.length ? this._data.automations.map((f) => `${t(f.description)} '${f.id}': ${o(f)}`).join(`
3199
3164
  `) : " [key: string]: () => { eventId: string }", c = this._data.resolvers.length ? this._data.resolvers.map((f) => `${t(f.description)} '${f.id}': ${r(f)}`).join(`
3200
- `) : " [key: string]: (url: string) => unknown", u = this._data.adapters.length ? this._data.adapters.map((f) => `${t(f.description)} '${f.id}': (data: unknown) => unknown`).join(`
3201
- `) : " [key: string]: (data: unknown) => unknown", m = this._data.env.length ? this._data.env.map((f) => `${t(f.description)} ${f.key}: string`).join(`
3165
+ `) : " [key: string]: (url: string) => unknown", u = this._data.env.length ? this._data.env.map((f) => `${t(f.description)} ${f.key}: string`).join(`
3202
3166
  `) : " [key: string]: string";
3203
3167
  return [
3204
3168
  "// Generated by bep.generateRuntimeTypes() — do not edit manually",
@@ -3221,16 +3185,10 @@ ${s.join(`
3221
3185
  c,
3222
3186
  "}",
3223
3187
  "",
3224
- "// ─── Adapters ─────────────────────────────────────────────────────────────────",
3225
- "",
3226
- "export interface BepAdapters {",
3227
- u,
3228
- "}",
3229
- "",
3230
3188
  "// ─── Env ──────────────────────────────────────────────────────────────────────",
3231
3189
  "",
3232
3190
  "export interface BepEnv {",
3233
- m,
3191
+ u,
3234
3192
  "}",
3235
3193
  "",
3236
3194
  "// ─── Combined ─────────────────────────────────────────────────────────────────",
@@ -3239,7 +3197,6 @@ ${s.join(`
3239
3197
  " effects: BepEffects",
3240
3198
  " automations: BepAutomations",
3241
3199
  " resolvers: BepResolvers",
3242
- " adapters: BepAdapters",
3243
3200
  " env: BepEnv",
3244
3201
  "}",
3245
3202
  ""
@@ -3258,124 +3215,122 @@ ${s.join(`
3258
3215
  }
3259
3216
  export {
3260
3217
  ke as ActionSchema,
3261
- _t as Actions,
3262
- ze as AdapterSchema,
3263
- Bt as Adapters,
3218
+ Ot as Actions,
3264
3219
  Oe as AnnexSchema,
3265
- Qe as AnnexType,
3266
- Mt as Annexes,
3220
+ Ye as AnnexType,
3221
+ _t as Annexes,
3267
3222
  Ie as AssetTypeSchema,
3268
- Vt as AssetTypes,
3269
- Pt as Automations,
3270
- zs as BEPSchema,
3223
+ Gt as AssetTypes,
3224
+ Mt as Automations,
3225
+ Ls as BEPSchema,
3271
3226
  re as BEPVersionBase,
3272
- kt as BEPVersionSchema,
3227
+ St as BEPVersionSchema,
3273
3228
  Se as BIMUseSchema,
3274
- Jt as BIMUses,
3229
+ zt as BIMUses,
3275
3230
  D as Bep,
3276
- Zs as ChangelogSchema,
3277
- $t as DEFAULT_DELIMITER,
3278
- Rt as DEFAULT_TOKEN_PATTERN,
3279
- St as DeliverableBaseSchema,
3231
+ Us as ChangelogSchema,
3232
+ kt as DEFAULT_DELIMITER,
3233
+ $t as DEFAULT_TOKEN_PATTERN,
3234
+ Nt as DeliverableBaseSchema,
3280
3235
  De as DeliverableSchema,
3281
- Ut as Deliverables,
3236
+ Dt as Deliverables,
3282
3237
  we as DisciplineSchema,
3283
- Kt as Disciplines,
3284
- gt as EdgeGuardSchema,
3285
- xt as Effects,
3286
- Cs as Engine,
3238
+ Zt as Disciplines,
3239
+ ht as EdgeGuardSchema,
3240
+ Bt as Effects,
3241
+ Ps as Engine,
3287
3242
  y as Entity,
3288
- Ft as Env,
3243
+ xt as Env,
3289
3244
  Le as EnvVarSchema,
3290
- Ct as Events,
3245
+ Pt as Events,
3291
3246
  ve as ExtensionSchema,
3292
- Ht as Extensions,
3293
- Nt as FlagBaseSchema,
3294
- nt as FlagEntityType,
3247
+ Xt as Extensions,
3248
+ Et as FlagBaseSchema,
3249
+ st as FlagEntityType,
3295
3250
  Ce as FlagSchema,
3296
- st as FlagSeverity,
3297
- zt as Flags,
3298
- mt as FlowAutomationNodeSchema,
3251
+ tt as FlagSeverity,
3252
+ Lt as Flags,
3253
+ ut as FlowAutomationNodeSchema,
3299
3254
  Te as FlowAutomationSchema,
3300
- bt as FlowDecisionEdgeSchema,
3301
- ut as FlowDecisionNodeSchema,
3302
- It as FlowDiagramSchema,
3303
- wt as FlowDirectEdgeSchema,
3304
- tt as FlowDirection,
3305
- vt as FlowEdgeSchema,
3255
+ yt as FlowDecisionEdgeSchema,
3256
+ ft as FlowDecisionNodeSchema,
3257
+ vt as FlowDiagramSchema,
3258
+ bt as FlowDirectEdgeSchema,
3259
+ et as FlowDirection,
3260
+ wt as FlowEdgeSchema,
3306
3261
  Re as FlowEffectSchema,
3307
- ft as FlowEndNodeSchema,
3262
+ ct as FlowEndNodeSchema,
3308
3263
  $e as FlowEventSchema,
3309
- ht as FlowNodeSchema,
3264
+ pt as FlowNodeSchema,
3310
3265
  L as FlowPayloadFieldSchema,
3311
- pt as FlowProcessNodeSchema,
3312
- ct as FlowStartNodeSchema,
3313
- yt as FlowTransitionEdgeSchema,
3266
+ mt as FlowProcessNodeSchema,
3267
+ lt as FlowStartNodeSchema,
3268
+ gt as FlowTransitionEdgeSchema,
3314
3269
  _e as GuideSchema,
3315
- qt as Guides,
3270
+ Jt as Guides,
3316
3271
  k as History,
3317
- Ye as ISORole,
3318
- at as LBSNodeBaseSchema,
3272
+ He as ISORole,
3273
+ rt as LBSNodeBaseSchema,
3319
3274
  be as LBSNodeSchema,
3320
- et as LBSNodeType,
3321
- Qt as LBSNodes,
3275
+ Qe as LBSNodeType,
3276
+ Ht as LBSNodes,
3322
3277
  Me as LODSchema,
3323
- Wt as LODs,
3324
- Xt as LOINEntity,
3325
- Et as LOINMilestoneSchema,
3278
+ Kt as LODs,
3279
+ Wt as LOINEntity,
3280
+ It as LOINMilestoneSchema,
3326
3281
  Pe as LOINSchema,
3327
3282
  xe as LOISchema,
3328
- Gt as LOIs,
3283
+ qt as LOIs,
3329
3284
  me as MemberSchema,
3330
- es as Members,
3331
- Ps as MemoryStorage,
3285
+ Yt as Members,
3286
+ Ms as MemoryStorage,
3332
3287
  ye as MilestoneSchema,
3333
- ts as Milestones,
3288
+ Qt as Milestones,
3334
3289
  he as NamingConventionSchema,
3335
- rt as NamingSegmentSchema,
3336
- ot as NamingTokenSchema,
3337
- dt as NodeTimeoutSchema,
3338
- Us as NodeType,
3339
- Lt as Nomenclature,
3290
+ ot as NamingSegmentSchema,
3291
+ it as NamingTokenSchema,
3292
+ at as NodeTimeoutSchema,
3293
+ Ds as NodeType,
3294
+ Ct as Nomenclature,
3340
3295
  Fe as NoteSchema,
3341
- Zt as Notes,
3296
+ Ut as Notes,
3342
3297
  Ne as ObjectiveSchema,
3343
- ss as Objectives,
3298
+ es as Objectives,
3344
3299
  ge as PhaseSchema,
3345
- ns as Phases,
3300
+ ts as Phases,
3346
3301
  fe as ProjectSchema,
3347
- is as RemoteDataEntity,
3348
- Ze as RemoteDataSchema,
3302
+ ss as RemoteDataEntity,
3303
+ ze as RemoteDataSchema,
3349
3304
  Ue as ResolverSchema,
3350
- os as Resolvers,
3305
+ ns as Resolvers,
3351
3306
  ue as RoleSchema,
3352
- Yt as Roles,
3353
- qs as Runtime,
3307
+ Vt as Roles,
3308
+ Js as Runtime,
3354
3309
  jt as Singleton,
3355
3310
  Ee as SoftwareSchema,
3356
- rs as Softwares,
3311
+ is as Softwares,
3357
3312
  Be as StandardSchema,
3358
- as as Standards,
3359
- it as TeamBaseSchema,
3313
+ os as Standards,
3314
+ nt as TeamBaseSchema,
3360
3315
  pe as TeamSchema,
3361
- ds as Teams,
3316
+ rs as Teams,
3362
3317
  q as TextFile,
3363
- je as WorkflowSchema,
3364
- cs as Workflows,
3365
- ks as arrayDefs,
3366
- We as buildCodeMap,
3318
+ Ae as WorkflowSchema,
3319
+ ds as Workflows,
3320
+ Ns as arrayDefs,
3321
+ qe as buildCodeMap,
3367
3322
  W as buildConsecutivoMap,
3368
3323
  C as buildParentMap,
3369
- Rs as diffBep,
3370
- $s as diffEntities,
3371
- Ks as flowDiagramToMermaid,
3372
- qe as getNomenCode,
3324
+ ks as diffBep,
3325
+ Ss as diffEntities,
3326
+ Zs as flowDiagramToMermaid,
3327
+ Ke as getNomenCode,
3373
3328
  te as getRootIds,
3374
- Tt as getTokenPattern,
3375
- Js as groupRaciRows,
3329
+ Rt as getTokenPattern,
3330
+ zs as groupRaciRows,
3376
3331
  B as normalizeBep,
3377
- Ke as resolveLBSCodes,
3378
- At as validateAllTokens,
3379
- Dt as validateLBS,
3332
+ Je as resolveLBSCodes,
3333
+ Tt as validateAllTokens,
3334
+ Ft as validateLBS,
3380
3335
  x as validateTokenValue
3381
3336
  };