@knkcs/contenthub-ui 0.3.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/testing.js CHANGED
@@ -1,37 +1,37 @@
1
- import { A as e, C as t, D as n, M as r, N as i, S as a, T as o, _ as s, b as c, f as l, g as u, h as d, i as f, j as p, n as m, o as ee, r as h, s as te, t as ne, u as re, v as ie, w as g, x as ae, y as _ } from "./heads-dBmqNcOB.js";
2
- import { Code as v, ConnectError as y } from "@connectrpc/connect";
3
- import { createHostMembers as b } from "@knkcs/anker/host";
1
+ import { C as e, D as t, E as n, F as r, M as i, N as a, P as o, S as s, T as c, _ as l, b as u, f as d, g as f, h as p, i as ee, k as m, n as h, o as te, r as g, s as ne, t as re, u as ie, v as ae, w as _, x as v, y as oe } from "./heads-BrvZ_GYT.js";
2
+ import { Code as y, ConnectError as b } from "@connectrpc/connect";
3
+ import { createHostMembers as x } from "@knkcs/anker/host";
4
4
  //#region src/testing/fixtures.ts
5
- var x = "ws_stub", S = "user_stub", C = "user_ben", w = "2026-10-01T09:00:00.000Z";
6
- function T() {
5
+ var S = "ws_stub", C = "user_stub", w = "user_ben", T = "2026-10-01T09:00:00.000Z";
6
+ function E() {
7
7
  return {
8
- userId: S,
9
- workspaceId: x,
10
- members: b([{
11
- userId: S,
8
+ userId: C,
9
+ workspaceId: S,
10
+ members: x([{
11
+ userId: C,
12
12
  displayName: "Ada Editor",
13
13
  email: "ada@example.com"
14
14
  }, {
15
- userId: C,
15
+ userId: w,
16
16
  displayName: "Ben Reviewer",
17
17
  email: "ben@example.com"
18
18
  }])
19
19
  };
20
20
  }
21
- function oe() {
21
+ function se() {
22
22
  return [{
23
23
  id: "br_author",
24
24
  name: "Being revised by the author",
25
- createTime: w,
26
- updateTime: w
25
+ createTime: T,
26
+ updateTime: T
27
27
  }, {
28
28
  id: "br_embargo",
29
29
  name: "Embargoed until publication",
30
- createTime: w,
31
- updateTime: w
30
+ createTime: T,
31
+ updateTime: T
32
32
  }];
33
33
  }
34
- function E() {
34
+ function ce() {
35
35
  return [
36
36
  {
37
37
  slug: "in_progress",
@@ -56,7 +56,7 @@ function E() {
56
56
  }
57
57
  ];
58
58
  }
59
- function se() {
59
+ function le() {
60
60
  return {
61
61
  in_progress: ["in_review", "on_hold"],
62
62
  in_review: [
@@ -68,7 +68,7 @@ function se() {
68
68
  on_hold: ["in_progress"]
69
69
  };
70
70
  }
71
- function ce() {
71
+ function ue() {
72
72
  return [
73
73
  {
74
74
  id: "cs_bgbl_270",
@@ -78,7 +78,7 @@ function ce() {
78
78
  reference: "BGBl. 2026 I Nr. 270"
79
79
  },
80
80
  state: "open",
81
- createdBy: S,
81
+ createdBy: C,
82
82
  createTime: "2026-09-30T08:00:00.000Z",
83
83
  chains: [{
84
84
  id: "chain_para_1",
@@ -111,7 +111,7 @@ function ce() {
111
111
  }],
112
112
  dependsOnChangeSetIds: [],
113
113
  status: "in_progress",
114
- assigneeIds: [S],
114
+ assigneeIds: [C],
115
115
  plannedReleases: [
116
116
  {
117
117
  id: "rls_p1_2",
@@ -171,19 +171,19 @@ function ce() {
171
171
  reference: "BGBl. 2026 I Nr. 255"
172
172
  },
173
173
  state: "open",
174
- createdBy: C,
174
+ createdBy: w,
175
175
  createTime: "2026-09-25T08:00:00.000Z",
176
176
  chains: [],
177
177
  dependsOnChangeSetIds: [],
178
178
  status: "",
179
- assigneeIds: [C],
179
+ assigneeIds: [w],
180
180
  plannedReleases: []
181
181
  },
182
182
  {
183
183
  id: "cs_correction_3",
184
184
  name: "Correction of § 3",
185
185
  state: "published",
186
- createdBy: S,
186
+ createdBy: C,
187
187
  createTime: "2026-09-01T08:00:00.000Z",
188
188
  closeTime: "2026-09-02T08:00:00.000Z",
189
189
  chains: [],
@@ -194,7 +194,7 @@ function ce() {
194
194
  }
195
195
  ];
196
196
  }
197
- function le() {
197
+ function de() {
198
198
  return [{
199
199
  id: "rc_print",
200
200
  name: "Druckprobe",
@@ -209,7 +209,7 @@ function le() {
209
209
  independent: !0
210
210
  }];
211
211
  }
212
- function ue() {
212
+ function fe() {
213
213
  return [
214
214
  {
215
215
  id: "col_bgb",
@@ -237,7 +237,7 @@ function ue() {
237
237
  }
238
238
  ];
239
239
  }
240
- function de() {
240
+ function pe() {
241
241
  return [
242
242
  {
243
243
  id: "bp_commentary",
@@ -253,7 +253,7 @@ function de() {
253
253
  }
254
254
  ];
255
255
  }
256
- function fe() {
256
+ function me() {
257
257
  return [
258
258
  {
259
259
  id: "bpr_paragraph_2",
@@ -275,7 +275,7 @@ function fe() {
275
275
  }
276
276
  ];
277
277
  }
278
- function pe() {
278
+ function he() {
279
279
  let e = (e, t) => ({
280
280
  field_type: "text",
281
281
  config: {
@@ -287,6 +287,7 @@ function pe() {
287
287
  system: !1
288
288
  }), t = {
289
289
  displayName: "Paragraph",
290
+ accessor: "paragraph",
290
291
  dated: !0,
291
292
  fields: [e("number", "Number"), e("heading", "Heading")],
292
293
  parts: {}
@@ -296,13 +297,51 @@ function pe() {
296
297
  bpr_paragraph_2: t,
297
298
  bpr_footnote_1: {
298
299
  displayName: "Footnote",
300
+ accessor: "footnote",
299
301
  dated: !0,
300
302
  fields: [e("text", "Text")],
301
303
  parts: {}
304
+ },
305
+ bpr_note_1: {
306
+ displayName: "Note",
307
+ accessor: "note",
308
+ dated: !1,
309
+ fields: [e("title", "Title")],
310
+ parts: {}
302
311
  }
303
312
  };
304
313
  }
305
314
  function D() {
315
+ let e = "2026-09-01T08:00:00.000Z";
316
+ return {
317
+ id: "content_note_1",
318
+ blueprintId: "bp_note",
319
+ blueprintReleaseId: "bpr_note_1",
320
+ collectionIds: [],
321
+ main: {
322
+ revisionId: "rev_note1_main",
323
+ data: { title: "Hinweis" },
324
+ revisionCreateTime: e
325
+ },
326
+ inForce: {
327
+ revisionId: "rev_note1_main",
328
+ data: { title: "Hinweis" },
329
+ revisionCreateTime: e,
330
+ releaseId: "rls_note1_1"
331
+ },
332
+ branches: {},
333
+ timeline: [{
334
+ ordinal: 1,
335
+ releaseId: "rls_note1_1",
336
+ kind: "revision",
337
+ revisionId: "rev_note1_main",
338
+ blueprintReleaseId: "bpr_note_1",
339
+ publishTime: e,
340
+ first: !0
341
+ }]
342
+ };
343
+ }
344
+ function ge() {
306
345
  let e = "2001-11-01T08:00:00.000Z";
307
346
  return {
308
347
  id: "content_para_3",
@@ -333,7 +372,7 @@ function D() {
333
372
  }]
334
373
  };
335
374
  }
336
- function me() {
375
+ function _e() {
337
376
  let e = "2026-09-01T08:00:00.000Z";
338
377
  return [
339
378
  {
@@ -366,7 +405,7 @@ function me() {
366
405
  blueprintId: "bp_paragraph",
367
406
  blueprintReleaseId: "bpr_paragraph_1",
368
407
  collectionIds: ["col_bgb"],
369
- assigneeIds: [S, C],
408
+ assigneeIds: [C, w],
370
409
  main: {
371
410
  revisionId: "rev_p1_main",
372
411
  data: {
@@ -433,7 +472,7 @@ function me() {
433
472
  secondParentId: "",
434
473
  blueprintReleaseId: "bpr_paragraph_1",
435
474
  createTime: "2026-09-30T09:00:00.000Z",
436
- author: S,
475
+ author: C,
437
476
  cause: "save",
438
477
  branchId: "br_para_1_b",
439
478
  changeSetId: "cs_bgbl_270",
@@ -449,7 +488,7 @@ function me() {
449
488
  secondParentId: "",
450
489
  blueprintReleaseId: "bpr_paragraph_1",
451
490
  createTime: "2026-09-30T08:30:00.000Z",
452
- author: C,
491
+ author: w,
453
492
  cause: "save",
454
493
  branchId: "br_para_1_a",
455
494
  changeSetId: "cs_bgbl_270",
@@ -465,7 +504,7 @@ function me() {
465
504
  secondParentId: "",
466
505
  blueprintReleaseId: "bpr_paragraph_1",
467
506
  createTime: e,
468
- author: S,
507
+ author: C,
469
508
  cause: "create",
470
509
  branchId: "br_para_1_main",
471
510
  changeSetId: "cs_correction_3"
@@ -549,7 +588,7 @@ function me() {
549
588
  blueprintId: "bp_paragraph",
550
589
  blueprintReleaseId: "bpr_paragraph_1",
551
590
  collectionIds: ["col_stgb"],
552
- assigneeIds: [C],
591
+ assigneeIds: [w],
553
592
  main: {
554
593
  revisionId: "rev_s211_main",
555
594
  data: {
@@ -586,7 +625,7 @@ function me() {
586
625
  }
587
626
  //#endregion
588
627
  //#region src/testing/stub-blueprint-source.ts
589
- function he(e = de(), t = fe()) {
628
+ function ve(e = pe(), t = me()) {
590
629
  return {
591
630
  async searchBlueprints({ query: t }) {
592
631
  let n = t.trim().toLocaleLowerCase();
@@ -605,37 +644,41 @@ function he(e = de(), t = fe()) {
605
644
  }
606
645
  //#endregion
607
646
  //#region src/testing/stub-client.ts
608
- function ge(e, t) {
647
+ function ye(e) {
648
+ let t = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
649
+ return t.setUTCDate(t.getUTCDate() - 1), t.toISOString().slice(0, 10);
650
+ }
651
+ function be(e, t) {
609
652
  let n = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
610
653
  return n.setUTCDate(n.getUTCDate() + t), n.toISOString().slice(0, 10);
611
654
  }
612
655
  function O(e, t, n) {
613
656
  let r = e.trim();
614
- if (r === "") throw new a(`${t} is required`);
615
- if ([...r].length > n) throw new a(`${t} is at most ${n} characters`);
616
- if (/[\u0000-\u001f\u007f]/.test(r)) throw new a(`${t} is one line of text`);
657
+ if (r === "") throw new _(`${t} is required`);
658
+ if ([...r].length > n) throw new _(`${t} is at most ${n} characters`);
659
+ if (/[\u0000-\u001f\u007f]/.test(r)) throw new _(`${t} is one line of text`);
617
660
  return r;
618
661
  }
619
- function _e(e) {
620
- if (!/^\d{4}-\d{2}-\d{2}$/.test(e.date.trim())) throw new a(`source.date "${e.date}" is not a day as YYYY-MM-DD`);
662
+ function xe(e) {
663
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(e.date.trim())) throw new _(`source.date "${e.date}" is not a day as YYYY-MM-DD`);
621
664
  return {
622
665
  date: e.date.trim(),
623
666
  reference: O(e.reference, "source.reference", 500)
624
667
  };
625
668
  }
626
- function ve(e) {
669
+ function Se(e) {
627
670
  let t = e.trim();
628
- if (t === "") throw new a("a Block Reason needs a name");
629
- if ([...t].length > 200) throw new a("a Block Reason's name is at most 200 characters");
630
- if (/[\u0000-\u001f\u007f]/.test(t)) throw new a("a Block Reason's name is one line of text");
671
+ if (t === "") throw new _("a Block Reason needs a name");
672
+ if ([...t].length > 200) throw new _("a Block Reason's name is at most 200 characters");
673
+ if (/[\u0000-\u001f\u007f]/.test(t)) throw new _("a Block Reason's name is one line of text");
631
674
  return t;
632
675
  }
633
- function ye(e) {
676
+ function Ce(e) {
634
677
  let t = O(e.name, "a Required Check's name", 200);
635
- if (e.scope !== "branch" && e.scope !== "change_set") throw new a("a Required Check's scope is Branch or Change Set");
678
+ if (e.scope !== "branch" && e.scope !== "change_set") throw new _("a Required Check's scope is Branch or Change Set");
636
679
  let n = e.blueprintAccessors.map((e) => {
637
680
  let t = e.trim();
638
- if (t === "" || [...t].length > 200 || /[\u0000-\u001f\u007f]/.test(t)) throw new a(`"${t}" is not a Blueprint accessor`);
681
+ if (t === "" || [...t].length > 200 || /[\u0000-\u001f\u007f]/.test(t)) throw new _(`"${t}" is not a Blueprint accessor`);
639
682
  return t;
640
683
  });
641
684
  return {
@@ -645,9 +688,9 @@ function ye(e) {
645
688
  independent: e.independent
646
689
  };
647
690
  }
648
- var be = "who records a Required Check can be narrowed only in authz.mode guardian: in workspace mode every member records every check (ADR 0017)", xe = "this Change Set holds work you can't see: publishing, discarding or updating all of it needs you to see every Content in it", Se = "Restricted Collections need authz.mode guardian: in workspace mode a restriction could not be enforced (ADR 0017)";
691
+ var we = "who records a Required Check can be narrowed only in authz.mode guardian: in workspace mode every member records every check (ADR 0017)", Te = "this Change Set holds work you can't see: publishing, discarding or updating all of it needs you to see every Content in it", Ee = "Restricted Collections need authz.mode guardian: in workspace mode a restriction could not be enforced (ADR 0017)";
649
692
  function k(e, t) {
650
- return new y(`${e} ${t}: not found`, v.NotFound);
693
+ return new b(`${e} ${t}: not found`, y.NotFound);
651
694
  }
652
695
  var A = (e) => structuredClone(e);
653
696
  function j(e, t = {}) {
@@ -670,25 +713,45 @@ function j(e, t = {}) {
670
713
  ...t
671
714
  };
672
715
  }
673
- function M(v = {}) {
674
- let y = v.now ?? (() => "2026-10-01T09:00:00.000Z"), b = v.userId ?? "user_stub", x = v.statuses ?? E(), S = v.statusTransitions ?? se(), C = (v.blockReasons ?? oe()).map((e) => ({ ...e })), w = (v.changeSets ?? ce()).map(A), T = (v.collections ?? ue()).map((e) => ({ ...e })), D = structuredClone(v.contents ?? me()), he = v.blueprints ?? de(), M = v.blueprintReleases ?? fe(), P = v.resolvedReleases ?? pe(), F = structuredClone(v.requiredChecks ?? le()), I = v.authzMode ?? "guardian", Ce = new Set(v.withheld ?? []), L = (e) => {
675
- if (Ce.has(e)) throw new i(xe);
676
- }, R = new Map(Object.entries(structuredClone(v.collectionGrants ?? {}))), z = new Map(Object.entries(structuredClone(v.recorders ?? {}))), we = (e) => z.get(e) ?? {
716
+ function M(y = {}) {
717
+ let b = y.now ?? (() => "2026-10-01T09:00:00.000Z"), x = y.userId ?? "user_stub", S = y.statuses ?? ce(), C = y.statusTransitions ?? le(), w = (y.blockReasons ?? se()).map((e) => ({ ...e })), T = (y.changeSets ?? ue()).map(A), E = (y.collections ?? fe()).map((e) => ({ ...e })), D = structuredClone(y.contents ?? _e()), ge = y.blueprints ?? pe(), ve = y.blueprintReleases ?? me(), M = y.resolvedReleases ?? he(), N = structuredClone(y.requiredChecks ?? de()), P = y.authzMode ?? "guardian", Oe = new Set(y.withheld ?? []), ke = (e) => {
718
+ if (Oe.has(e)) throw new r(Te);
719
+ }, F = new Map(Object.entries(structuredClone(y.collectionGrants ?? {}))), I = new Map(Object.entries(structuredClone(y.recorders ?? {}))), Ae = (e) => I.get(e) ?? {
677
720
  everyMember: !0,
678
721
  userIds: []
679
- }, Te = v.memberIds ?? ["user_stub", "user_ben"], Ee = v.admin ?? !0, De = structuredClone(v.checkResults ?? []), Oe = v.publishBlockers ?? {}, ke = v.pendingMerges ?? {}, Ae = structuredClone(v.conflicts ?? {}), B = /* @__PURE__ */ new Map(), je = /* @__PURE__ */ new Map(), V = async (e, t, n) => {
722
+ }, je = y.memberIds ?? ["user_stub", "user_ben"], Me = y.admin ?? !0, Ne = y.editingSettings ?? {
723
+ editingMode: "change_sets",
724
+ editingBlock: !1
725
+ }, L = structuredClone({
726
+ ...Ne,
727
+ forceGroup: Ne.forceGroup ?? []
728
+ }), R = structuredClone(y.editingOverrides ?? []), z = (e) => ({
729
+ editingMode: e?.editingMode ?? L.editingMode,
730
+ editingBlock: e?.editingBlock ?? L.editingBlock,
731
+ forceGroup: [...e?.forceGroup ?? L.forceGroup]
732
+ }), Pe = (e) => ({
733
+ ...structuredClone(e),
734
+ forceGroup: e.forceGroup ?? null,
735
+ effective: z(e)
736
+ }), Fe = (e) => M[e.blueprintReleaseId]?.accessor || e.blueprintId, Ie = (e) => Me || e.includes(x), Le = (e) => [...new Set(e.map((e) => O(e, "a user id", 200)))].sort(), Re = [
737
+ "direct_edits",
738
+ "change_sets",
739
+ "both"
740
+ ], ze = () => {
741
+ if (!Me) throw new ne("permission denied");
742
+ }, Be = structuredClone(y.checkResults ?? []), Ve = y.publishBlockers ?? {}, He = y.pendingMerges ?? {}, Ue = structuredClone(y.conflicts ?? {}), We = new Set(y.behind ?? []), B = /* @__PURE__ */ new Map(), Ge = /* @__PURE__ */ new Map(), V = async (e, t, n) => {
680
743
  if (!e) return n();
681
- let r = JSON.stringify(t), i = je.get(e);
744
+ let r = JSON.stringify(t), i = Ge.get(e);
682
745
  if (i) {
683
- if (i.asked !== r) throw new a(`idempotency key ${e} names another request`);
746
+ if (i.asked !== r) throw new _(`idempotency key ${e} names another request`);
684
747
  return structuredClone(i.answer);
685
748
  }
686
- let o = await n();
687
- return je.set(e, {
749
+ let a = await n();
750
+ return Ge.set(e, {
688
751
  asked: r,
689
- answer: structuredClone(o)
690
- }), o;
691
- }, Me = /* @__PURE__ */ new Map(), Ne = /* @__PURE__ */ new Map(), H = 1, U = (e) => {
752
+ answer: structuredClone(a)
753
+ }), a;
754
+ }, Ke = /* @__PURE__ */ new Map(), qe = /* @__PURE__ */ new Map(), H = 1, U = (e) => {
692
755
  let t = D.find((t) => t.id === e);
693
756
  if (!t) throw k("Content", e);
694
757
  return t;
@@ -696,8 +759,9 @@ function M(v = {}) {
696
759
  collectionIds: [...e.collectionIds].sort(),
697
760
  assigneeIds: e.assigneeIds ?? [],
698
761
  block: e.block,
699
- archiveTime: e.archiveTime
700
- }), Pe = () => y().slice(0, 10), G = (e) => P[e.blueprintReleaseId]?.dated ?? !1, K = (e) => {
762
+ archiveTime: e.archiveTime,
763
+ editingBlock: e.editingBlock
764
+ }), Je = () => b().slice(0, 10), G = (e) => M[e.blueprintReleaseId]?.dated ?? !1, K = (e) => {
701
765
  let t = [...e.revisions ?? []], n = [...Object.entries(e.branches).map(([e, t]) => ({
702
766
  ...t,
703
767
  changeSetId: e
@@ -713,7 +777,7 @@ function M(v = {}) {
713
777
  secondParentId: "",
714
778
  blueprintReleaseId: e.blueprintReleaseId,
715
779
  createTime: r.revisionCreateTime,
716
- author: b,
780
+ author: x,
717
781
  cause: "create",
718
782
  branchId: r.branchId,
719
783
  changeSetId: r.changeSetId,
@@ -724,59 +788,59 @@ function M(v = {}) {
724
788
  e.main,
725
789
  e.inForce,
726
790
  ...Object.values(e.branches)
727
- ].find((e) => e?.revisionId === t)?.data ?? e.revisions?.find((e) => e.id === t)?.data, Fe = (e, t) => {
791
+ ].find((e) => e?.revisionId === t)?.data ?? e.revisions?.find((e) => e.id === t)?.data, Ye = (e, t) => {
728
792
  let n = (e) => e == null || e === "" || Array.isArray(e) && e.length === 0;
729
793
  return (e ?? []).filter((e) => e.config.required === !0 && n(t[e.config.api_accessor])).map((e) => e.config.api_accessor);
730
794
  }, J = (e) => {
731
- if (e.archiveTime) throw new s(e.id);
732
- if (e.block && !e.block.allowedUserIds.includes(b)) throw new ie(e.id, e.block.blockReasonId);
733
- }, Ie = (e) => D.flatMap((t) => (t.edges ?? []).filter((n) => n.targetContentId === e && n.pinReleaseId === "" && t.inForce?.revisionId === n.sourceRevisionId).map((e) => ({
795
+ if (e.archiveTime) throw new l(e.id);
796
+ if (e.block && !e.block.allowedUserIds.includes(x)) throw new ae(e.id, e.block.blockReasonId);
797
+ }, Xe = (e) => D.flatMap((t) => (t.edges ?? []).filter((n) => n.targetContentId === e && n.pinReleaseId === "" && t.inForce?.revisionId === n.sourceRevisionId).map((e) => ({
734
798
  edge: { ...e },
735
799
  releaseId: t.inForce?.releaseId ?? ""
736
- }))), Le = (e, t) => e.name < t.name ? -1 : e.name > t.name ? 1 : e.id < t.id ? -1 : +(e.id > t.id), Re = (e, t) => C.some((n) => n.name === e && n.id !== t), ze = (e, t) => e.name < t.name ? -1 : e.name > t.name ? 1 : e.id < t.id ? -1 : +(e.id > t.id), Y = (e) => {
737
- let t = T.find((t) => t.id === e);
800
+ }))), Ze = (e, t) => e.name < t.name ? -1 : e.name > t.name ? 1 : e.id < t.id ? -1 : +(e.id > t.id), Qe = (e, t) => w.some((n) => n.name === e && n.id !== t), $e = (e, t) => e.name < t.name ? -1 : e.name > t.name ? 1 : e.id < t.id ? -1 : +(e.id > t.id), Y = (e) => {
801
+ let t = E.find((t) => t.id === e);
738
802
  if (!t) throw k("Collection", e);
739
803
  return t;
740
- }, Be = (e, t, n) => T.some((r) => r.parentId === e && r.name === t && r.id !== n), Ve = (e) => {
741
- if (I === "workspace") throw new n(Se);
742
- if (!Y(e).restricted) throw new a(`Collection ${e} is open: only a Restricted Collection takes grants`);
743
- let t = (R.get(e) ?? []).some((e) => e.userId === b && e.level === "owner");
744
- if (!Ee && !t) throw new te("only its owner or a workspace admin manages its grants");
745
- }, He = (e) => {
746
- if (I === "workspace") throw new ae("required_check_recorders", be);
747
- if (!Ee) throw new te("permission denied");
748
- if (e === "") throw new a("required_check_id is required");
749
- if (!F.some((t) => t.id === e)) throw k("Required Check", e);
750
- return we(e);
751
- }, Ue = async ({ changeSetId: t, branchId: n, expectedHeadId: r, data: i, fieldMask: o }) => {
752
- let s = Z(t).chains.find((e) => e.branches.some((e) => e.id === n)), c = s?.branches.find((e) => e.id === n);
753
- if (!s || !c) throw k("Branch", n);
754
- let l = U(s.contentId);
755
- if (J(l), B.has(n)) throw new a("a Pending Merge waits on this Branch: resolve or abort it first");
756
- if (r === "") throw new a("expected_head_id is required");
757
- if (c.headRevisionId !== r) throw new e({
758
- contentId: l.id,
759
- branchId: n,
760
- expectedHeadId: r,
761
- currentHeadId: c.headRevisionId
804
+ }, et = (e, t, n) => E.some((r) => r.parentId === e && r.name === t && r.id !== n), tt = (e) => {
805
+ if (P === "workspace") throw new m(Ee);
806
+ if (!Y(e).restricted) throw new _(`Collection ${e} is open: only a Restricted Collection takes grants`);
807
+ let t = (F.get(e) ?? []).some((e) => e.userId === x && e.level === "owner");
808
+ if (!Me && !t) throw new ne("only its owner or a workspace admin manages its grants");
809
+ }, nt = (t) => {
810
+ if (P === "workspace") throw new e("required_check_recorders", we);
811
+ if (!Me) throw new ne("permission denied");
812
+ if (t === "") throw new _("required_check_id is required");
813
+ if (!N.some((e) => e.id === t)) throw k("Required Check", t);
814
+ return Ae(t);
815
+ }, rt = async ({ changeSetId: e, branchId: t, expectedHeadId: n, data: r, fieldMask: a }) => {
816
+ let o = Z(e).chains.find((e) => e.branches.some((e) => e.id === t)), s = o?.branches.find((e) => e.id === t);
817
+ if (!o || !s) throw k("Branch", t);
818
+ let c = U(o.contentId);
819
+ if (J(c), B.has(t)) throw new _("a Pending Merge waits on this Branch: resolve or abort it first");
820
+ if (n === "") throw new _("expected_head_id is required");
821
+ if (s.headRevisionId !== n) throw new i({
822
+ contentId: c.id,
823
+ branchId: t,
824
+ expectedHeadId: n,
825
+ currentHeadId: s.headRevisionId
762
826
  });
763
- let u = q(l, c.headRevisionId) ?? {}, d = JSON.parse(JSON.stringify(i)), f;
764
- if (o) {
765
- let e = Object.keys(d).filter((e) => !o.includes(e));
766
- if (e.length > 0) throw new a(`data holds ${e.join(", ")}, which the mask doesn't name`);
767
- f = structuredClone(u);
768
- for (let e of o) e in d ? f[e] = d[e] : delete f[e];
769
- } else f = d;
770
- return We({
771
- changeSetId: t,
772
- chain: s,
773
- branch: c,
774
- c: l,
775
- data: f,
827
+ let l = q(c, s.headRevisionId) ?? {}, u = JSON.parse(JSON.stringify(r)), d;
828
+ if (a) {
829
+ let e = Object.keys(u).filter((e) => !a.includes(e));
830
+ if (e.length > 0) throw new _(`data holds ${e.join(", ")}, which the mask doesn't name`);
831
+ d = structuredClone(l);
832
+ for (let e of a) e in u ? d[e] = u[e] : delete d[e];
833
+ } else d = u;
834
+ return it({
835
+ changeSetId: e,
836
+ chain: o,
837
+ branch: s,
838
+ c,
839
+ data: d,
776
840
  cause: "save"
777
841
  });
778
- }, We = ({ changeSetId: e, chain: t, branch: n, c: r, data: i, cause: a, secondParentId: o = "" }) => {
779
- let s = n.id, c = `rev_stub_${H++}`, l = y();
842
+ }, it = ({ changeSetId: e, chain: t, branch: n, c: r, data: i, cause: a, secondParentId: o = "" }) => {
843
+ let s = n.id, c = `rev_stub_${H++}`, l = b();
780
844
  return r.revisions = [{
781
845
  id: c,
782
846
  contentId: r.id,
@@ -784,7 +848,7 @@ function M(v = {}) {
784
848
  secondParentId: o,
785
849
  blueprintReleaseId: r.blueprintReleaseId,
786
850
  createTime: l,
787
- author: b,
851
+ author: x,
788
852
  cause: a,
789
853
  branchId: s,
790
854
  changeSetId: e,
@@ -805,7 +869,7 @@ function M(v = {}) {
805
869
  revisionCreateTime: l,
806
870
  releaseId: ""
807
871
  };
808
- }, Ge = (e, t) => {
872
+ }, at = (e, t) => {
809
873
  let n = Z(e), r = n.chains.find((e) => e.branches.some((e) => e.id === t)), i = r?.branches.find((e) => e.id === t);
810
874
  if (!r || !i) throw k("Branch", t);
811
875
  return {
@@ -814,8 +878,8 @@ function M(v = {}) {
814
878
  branch: i,
815
879
  c: U(r.contentId)
816
880
  };
817
- }, Ke = (e, t) => {
818
- for (let n of w) for (let r of n.chains) {
881
+ }, ot = (e, t) => {
882
+ for (let n of T) for (let r of n.chains) {
819
883
  let n = r.branches.find((t) => t.id === e);
820
884
  if (!n) continue;
821
885
  let i = {
@@ -828,33 +892,33 @@ function M(v = {}) {
828
892
  fields: structuredClone(t.fields),
829
893
  merged: structuredClone(t.merged)
830
894
  };
831
- B.set(e, i), n.hasPendingMerge = !0, delete Ae[e];
895
+ B.set(e, i), n.hasPendingMerge = !0, delete Ue[e];
832
896
  return;
833
897
  }
834
898
  throw k("Branch", e);
835
- }, qe = (e) => {
899
+ }, st = (e) => {
836
900
  B.delete(e);
837
- for (let t of w) for (let n of t.chains) {
901
+ for (let t of T) for (let n of t.chains) {
838
902
  let t = n.branches.find((t) => t.id === e);
839
903
  t && (t.hasPendingMerge = !1);
840
904
  }
841
- }, Je = (e, t) => {
905
+ }, ct = (e, t) => {
842
906
  let n = t.validityPeriod;
843
907
  if (G(e)) {
844
- if (!n || !h.test(n.firstDay)) throw new a("validity_period.first_day is required for Dated Content");
845
- if (n.lastDay !== "" && (!h.test(n.lastDay) || n.lastDay < n.firstDay)) throw new a("validity_period.last_day is a day on or after first_day");
846
- } else if (n) throw new a("validity_period is refused for undated Content");
847
- let r = Fe(P[e.blueprintReleaseId]?.releaseSpec, t.releaseSpec ?? {}).map((e) => ({
908
+ if (!n || !g.test(n.firstDay)) throw new _("validity_period.first_day is required for Dated Content");
909
+ if (n.lastDay !== "" && (!g.test(n.lastDay) || n.lastDay < n.firstDay)) throw new _("validity_period.last_day is a day on or after first_day");
910
+ } else if (n) throw new _("validity_period is refused for undated Content");
911
+ let r = Ye(M[e.blueprintReleaseId]?.releaseSpec, t.releaseSpec ?? {}).map((e) => ({
848
912
  source: "fieldkit",
849
913
  code: "required",
850
914
  path: `/${e}`
851
915
  }));
852
- if (r.length > 0) throw new _("the Release Spec values break the Blueprint Release", r);
916
+ if (r.length > 0) throw new oe("the Release Spec values break the Blueprint Release", r);
853
917
  if (n && n.lastDay !== "") {
854
918
  let r = (e.timeline ?? []).filter((e) => e.validityPeriod && e.validityPeriod.lastDay !== "" && n.firstDay <= e.validityPeriod.firstDay && e.validityPeriod.lastDay <= n.lastDay && !t.supersedesReleaseIds.includes(e.releaseId)).map((e) => e.releaseId);
855
- if (r.length > 0) throw new c(e.id, r);
919
+ if (r.length > 0) throw new u(e.id, r);
856
920
  }
857
- }, Ye = (e, t) => {
921
+ }, lt = (e, t) => {
858
922
  let n = e.plannedReleases.filter((e) => e.contentId === t.id && e.proposed), r = e.plannedReleases.filter((e) => !(e.contentId === t.id && e.proposed)), i = [], a = (e, r, a) => {
859
923
  let o = n.find((t) => t.proposedForReleaseId === e.releaseId && t.splitFromReleaseId === a);
860
924
  i.push({
@@ -877,23 +941,23 @@ function M(v = {}) {
877
941
  let t = r.validityPeriod;
878
942
  t && !e.supersedesReleaseIds.includes(r.releaseId) && t.firstDay < n.firstDay && (t.lastDay === "" || t.lastDay >= n.firstDay) && (a(r, {
879
943
  firstDay: t.firstDay,
880
- lastDay: ge(n.firstDay, -1)
944
+ lastDay: be(n.firstDay, -1)
881
945
  }, ""), n.lastDay !== "" && (t.lastDay === "" || t.lastDay > n.lastDay) && a(r, {
882
- firstDay: ge(n.lastDay, 1),
946
+ firstDay: be(n.lastDay, 1),
883
947
  lastDay: t.lastDay
884
948
  }, r.releaseId));
885
949
  }
886
950
  }
887
951
  e.plannedReleases = [...r, ...i];
888
952
  }, X = (e) => {
889
- let t = w.find((t) => t.id === e);
953
+ let t = T.find((t) => t.id === e);
890
954
  if (!t) throw k("Change Set", e);
891
955
  return t;
892
956
  }, Z = (e) => {
893
957
  let t = X(e);
894
- if (t.state !== "open") throw new d(t.state);
958
+ if (t.state !== "open") throw new p(t.state);
895
959
  return t;
896
- }, Xe = (e) => x.find((t) => t.slug === e)?.name ?? e, Ze = (e, t, n = /* @__PURE__ */ new Set()) => e === t || !n.has(e) && (n.add(e), (w.find((t) => t.id === e)?.dependsOnChangeSetIds ?? []).some((e) => Ze(e, t, n))), Qe = (e) => [...e.chains.flatMap((e) => e.branches.map((t) => ({
960
+ }, ut = (e) => S.find((t) => t.slug === e)?.name ?? e, dt = (e, t, n = /* @__PURE__ */ new Set()) => e === t || !n.has(e) && (n.add(e), (T.find((t) => t.id === e)?.dependsOnChangeSetIds ?? []).some((e) => dt(e, t, n))), ft = (e) => [...e.chains.flatMap((e) => e.branches.map((t) => ({
897
961
  key: t.id,
898
962
  branchless: !1,
899
963
  contentId: e.contentId,
@@ -903,9 +967,9 @@ function M(v = {}) {
903
967
  branchless: !0,
904
968
  contentId: e.contentId,
905
969
  revision: e.revisionId
906
- }))], $e = (e) => D.find((t) => t.id === e)?.blueprintId, et = (e, t) => e.blueprintAccessors.length === 0 || e.blueprintAccessors.includes($e(t) ?? ""), tt = (e) => {
907
- let t = Qe(e), n = (t, n) => De.filter((n) => n.changeSetId === e.id && n.requiredCheckId === t.id).filter((e) => (t.scope === "change_set" ? "" : Object.keys(e.heads)[0]) === n).reverse().map(({ changeSetId: e, ...t }) => structuredClone(t)), r = (e, t, n) => {
908
- let r = n[0], i = r ? !m(r.heads, t.heads) : !1;
970
+ }))], pt = (e) => D.find((t) => t.id === e)?.blueprintId, mt = (e, t) => e.blueprintAccessors.length === 0 || e.blueprintAccessors.includes(pt(t) ?? ""), ht = (e) => {
971
+ let t = ft(e), n = (t, n) => Be.filter((n) => n.changeSetId === e.id && n.requiredCheckId === t.id).filter((e) => (t.scope === "change_set" ? "" : Object.keys(e.heads)[0]) === n).reverse().map(({ changeSetId: e, ...t }) => structuredClone(t)), r = (e, t, n) => {
972
+ let r = n[0], i = r ? !h(r.heads, t.heads) : !1;
909
973
  return {
910
974
  check: structuredClone(e),
911
975
  ...t,
@@ -914,8 +978,8 @@ function M(v = {}) {
914
978
  cleared: !!r && !i && r.outcome !== "failed"
915
979
  };
916
980
  }, i = [], a = (e, t) => e.name < t.name ? -1 : e.name > t.name ? 1 : e.id < t.id ? -1 : +(e.id > t.id);
917
- for (let e of [...F].sort(a)) {
918
- let a = t.filter((t) => et(e, t.contentId));
981
+ for (let e of [...N].sort(a)) {
982
+ let a = t.filter((t) => mt(e, t.contentId));
919
983
  if (e.scope === "change_set") {
920
984
  if (a.length === 0) continue;
921
985
  let o = Object.fromEntries(t.map((e) => [e.key, e.revision]));
@@ -935,8 +999,8 @@ function M(v = {}) {
935
999
  }, n(e, t.key)));
936
1000
  }
937
1001
  return i;
938
- }, nt = (e, t) => {
939
- let n = [], r = ne(e);
1002
+ }, gt = (e, t) => {
1003
+ let n = [], r = re(e);
940
1004
  for (let r of e.chains) for (let e of r.branches) t[e.id] !== e.headRevisionId && n.push(j("moved_head", {
941
1005
  contentId: r.contentId,
942
1006
  branchId: e.id,
@@ -947,11 +1011,18 @@ function M(v = {}) {
947
1011
  branchId: e,
948
1012
  expectedHeadId: i
949
1013
  }));
1014
+ for (let t of e.chains) for (let e of t.branches) We.has(e.id) && n.push(j("behind_base", {
1015
+ contentId: t.contentId,
1016
+ branchId: e.id
1017
+ })), B.has(e.id) && n.push(j("pending_merge", {
1018
+ contentId: t.contentId,
1019
+ branchId: e.id
1020
+ }));
950
1021
  for (let t of e.dependsOnChangeSetIds) {
951
- let e = w.find((e) => e.id === t)?.state;
1022
+ let e = T.find((e) => e.id === t)?.state;
952
1023
  e === "open" ? n.push(j("unpublished_dependency", { dependencyChangeSetId: t })) : e === "discarded" && n.push(j("discarded_dependency", { dependencyChangeSetId: t }));
953
1024
  }
954
- for (let t of tt(e)) t.cleared || n.push(j("outstanding_check", {
1025
+ for (let t of ht(e)) t.cleared || n.push(j("outstanding_check", {
955
1026
  requiredCheckId: t.check.id,
956
1027
  contentId: t.contentId,
957
1028
  branchId: t.branchId,
@@ -961,16 +1032,16 @@ function M(v = {}) {
961
1032
  let e = D.find((e) => e.id === t.contentId);
962
1033
  for (let r of t.branches) {
963
1034
  let t = e && q(e, r.headRevisionId);
964
- if (e && t) for (let i of Fe(P[e.blueprintReleaseId]?.fields, t)) n.push(j("missing_required_field", {
1035
+ if (e && t) for (let i of Ye(M[e.blueprintReleaseId]?.fields, t)) n.push(j("missing_required_field", {
965
1036
  contentId: e.id,
966
1037
  revisionId: r.headRevisionId,
967
1038
  path: `/${i}`
968
1039
  }));
969
1040
  }
970
1041
  }
971
- return [...n, ...structuredClone(Oe[e.id] ?? [])];
1042
+ return [...n, ...structuredClone(Ve[e.id] ?? [])];
972
1043
  }, Q = (e) => {
973
- let t = ne(e);
1044
+ let t = re(e);
974
1045
  return e.plannedReleases.filter((e) => !e.withheld).map((n) => ({
975
1046
  id: n.id,
976
1047
  contentId: n.contentId,
@@ -982,34 +1053,145 @@ function M(v = {}) {
982
1053
  validityPeriod: n.validityPeriod ? { ...n.validityPeriod } : void 0
983
1054
  }));
984
1055
  };
985
- for (let [e, t] of Object.entries(Ae)) t.pending && Ke(e, t);
986
- return {
1056
+ for (let [e, t] of Object.entries(Ue)) t.pending && ot(e, t);
1057
+ let _t = (e, t) => {
1058
+ for (let n of Object.keys(e)) n in t || delete e[n];
1059
+ Object.assign(e, t);
1060
+ }, vt = (e, t) => {
1061
+ let n = e.chains[0], r = n?.branches[0], i = r?.effectiveOn ?? "";
1062
+ if (!n || !r || !i) throw new _("the Direct Edit's Content is undated: no period to plan");
1063
+ let a = U(n.contentId), o = a.timeline ?? [], s = o.find((e) => e.releaseId === r.carriedReleaseId), c = s?.validityPeriod && i <= e.createTime.slice(0, 10) ? s : void 0, l = c?.validityPeriod ? { ...c.validityPeriod } : {
1064
+ firstDay: i,
1065
+ lastDay: ""
1066
+ };
1067
+ if (t !== void 0) {
1068
+ if (t !== "" && (!g.test(t) || t < l.firstDay)) throw new _("validity_last_day is YYYY-MM-DD, not before the first day");
1069
+ l.lastDay = t;
1070
+ }
1071
+ let d = o.filter((e) => e.releaseId !== c?.releaseId && e.validityPeriod && l.lastDay !== "" && l.firstDay <= e.validityPeriod.firstDay && e.validityPeriod.lastDay !== "" && e.validityPeriod.lastDay <= l.lastDay).map((e) => e.releaseId);
1072
+ if (d.length > 0) throw new u(a.id, d, !0);
1073
+ let f = [];
1074
+ !c && s?.validityPeriod && s.validityPeriod.firstDay < i && f.push({
1075
+ id: `rls_stub_${H++}`,
1076
+ contentId: a.id,
1077
+ kind: "date_only",
1078
+ branchId: "",
1079
+ revisionId: s.revisionId,
1080
+ validityPeriod: {
1081
+ firstDay: s.validityPeriod.firstDay,
1082
+ lastDay: ye(i)
1083
+ },
1084
+ supersedesReleaseIds: [s.releaseId],
1085
+ proposed: !0,
1086
+ proposedForReleaseId: s.releaseId,
1087
+ splitFromReleaseId: "",
1088
+ withheld: !1
1089
+ });
1090
+ let p = n.branches.slice(1).flatMap((e) => {
1091
+ let t = o.find((t) => t.releaseId === e.carriedReleaseId);
1092
+ return t ? [{
1093
+ releaseId: t.releaseId,
1094
+ validityPeriod: t.validityPeriod
1095
+ }] : [];
1096
+ });
1097
+ return {
1098
+ validityPeriod: l,
1099
+ correctsReleaseId: c?.releaseId ?? "",
1100
+ dateOnlyReleases: f,
1101
+ laterWordings: p
1102
+ };
1103
+ }, yt = async (e, t, n, r = {}) => {
1104
+ let i = e.id, a = e.chains[0], o = a?.branches[0];
1105
+ if (!a || !o) throw Error(`Direct Edit ${i} has no Branch`);
1106
+ let s = !!o.effectiveOn;
1107
+ if (!s && (r.validityLastDay !== void 0 || (r.carryForward ?? []).length > 0)) throw new _("validity_last_day and carry_forward are for Dated Content");
1108
+ if (e.state === "open") {
1109
+ let t = s ? vt(e, r.validityLastDay) : void 0, c = e.plannedReleases.find((e) => e.branchId === o.id && !e.proposed);
1110
+ if (c ? (n || t) && await $.updatePlannedRelease({
1111
+ changeSetId: i,
1112
+ plannedReleaseId: c.id,
1113
+ releaseSpec: n,
1114
+ validityPeriod: t?.validityPeriod
1115
+ }) : await $.planRelease({
1116
+ changeSetId: i,
1117
+ branchId: o.id,
1118
+ releaseSpec: n,
1119
+ validityPeriod: t?.validityPeriod,
1120
+ supersedesReleaseIds: t?.correctsReleaseId ? [t.correctsReleaseId] : void 0
1121
+ }), t) {
1122
+ let n = new Map((r.carryForward ?? []).map((e) => [e.releaseId, e.carry])), i = t.laterWordings.filter((e) => !n.has(e.releaseId));
1123
+ if (i.length > 0) throw new _(`carry_forward has no answer for the later wordings ${i.map((e) => e.releaseId).join(", ")}`);
1124
+ e.plannedReleases.push(...t.dateOnlyReleases);
1125
+ for (let r of a.branches.slice(1)) {
1126
+ let i = t.laterWordings.find((e) => e.releaseId === r.carriedReleaseId);
1127
+ i && n.get(i.releaseId) && e.plannedReleases.push({
1128
+ id: `rls_stub_${H++}`,
1129
+ contentId: a.contentId,
1130
+ kind: "revision",
1131
+ branchId: r.id,
1132
+ revisionId: "",
1133
+ validityPeriod: i.validityPeriod,
1134
+ supersedesReleaseIds: [i.releaseId],
1135
+ proposed: !0,
1136
+ proposedForReleaseId: i.releaseId,
1137
+ splitFromReleaseId: "",
1138
+ withheld: !1
1139
+ });
1140
+ }
1141
+ }
1142
+ }
1143
+ let c = await $.publish({
1144
+ id: i,
1145
+ reviewedHeads: {
1146
+ ...re(e),
1147
+ [o.id]: t
1148
+ }
1149
+ }), l = U(a.contentId);
1150
+ l.editingBlock?.changeSetId === i && (l.editingBlock = void 0);
1151
+ let u = l.branches[i], d = c.releases.find((e) => e.branchId === o.id), f = a.branches.length > 1;
1152
+ if (u && d && !f && l.main?.revisionId !== u.revisionId) {
1153
+ let { branchId: e, ...t } = structuredClone(u);
1154
+ l.main = t, l.inForce = {
1155
+ ...structuredClone(t),
1156
+ releaseId: d.id
1157
+ }, l.timeline = [...l.timeline ?? [], {
1158
+ ordinal: (l.timeline?.length ?? 0) + 1,
1159
+ releaseId: d.id,
1160
+ kind: "revision",
1161
+ revisionId: u.revisionId,
1162
+ blueprintReleaseId: l.blueprintReleaseId,
1163
+ publishTime: c.publishTime,
1164
+ first: !1
1165
+ }];
1166
+ }
1167
+ return c;
1168
+ }, $ = {
987
1169
  async listBlockReasons() {
988
- return [...C].sort(Le).map((e) => ({ ...e }));
1170
+ return [...w].sort(Ze).map((e) => ({ ...e }));
989
1171
  },
990
1172
  async createBlockReason({ name: e }) {
991
- let t = ve(e);
992
- if (Re(t)) throw new re(t);
1173
+ let t = Se(e);
1174
+ if (Qe(t)) throw new ie(t);
993
1175
  let n = {
994
1176
  id: `br_stub_${H++}`,
995
1177
  name: t,
996
- createTime: y(),
997
- updateTime: y()
1178
+ createTime: b(),
1179
+ updateTime: b()
998
1180
  };
999
- return C.push(n), { ...n };
1181
+ return w.push(n), { ...n };
1000
1182
  },
1001
1183
  async renameBlockReason({ id: e, name: t }) {
1002
- let n = ve(t), r = C.find((t) => t.id === e);
1184
+ let n = Se(t), r = w.find((t) => t.id === e);
1003
1185
  if (!r) throw k("Block Reason", e);
1004
- if (Re(n, e)) throw new re(n);
1005
- return r.name = n, r.updateTime = y(), { ...r };
1186
+ if (Qe(n, e)) throw new ie(n);
1187
+ return r.name = n, r.updateTime = b(), { ...r };
1006
1188
  },
1007
1189
  async deleteBlockReason({ id: e }) {
1008
- if (!C.some((t) => t.id === e)) throw k("Block Reason", e);
1009
- C = C.filter((t) => t.id !== e);
1190
+ if (!w.some((t) => t.id === e)) throw k("Block Reason", e);
1191
+ w = w.filter((t) => t.id !== e);
1010
1192
  },
1011
1193
  async listChangeSets(e = {}) {
1012
- let t = w.filter((t) => (!e.state || t.state === e.state) && (!e.assigneeId || t.assigneeIds.includes(e.assigneeId)) && (!e.contentId || t.chains.some((t) => t.contentId === e.contentId))), n = Math.min(e.pageSize || 50, 200), r = e.pageToken ? Number(e.pageToken) : 0;
1194
+ let t = T.filter((t) => (!e.state || t.state === e.state) && (!e.assigneeId || t.assigneeIds.includes(e.assigneeId)) && (!e.contentId || t.chains.some((t) => t.contentId === e.contentId)) && (!e.kind || (t.kind ?? "change_set") === e.kind) && (!e.editorId || t.editorId === e.editorId)), n = Math.min(e.pageSize || 50, 200), r = e.pageToken ? Number(e.pageToken) : 0;
1013
1195
  return {
1014
1196
  changeSets: t.slice(r, r + n).map((e) => ({
1015
1197
  ...A(e),
@@ -1021,53 +1203,53 @@ function M(v = {}) {
1021
1203
  };
1022
1204
  },
1023
1205
  async createChangeSet({ name: e, source: t }) {
1024
- let n = O(e, "name", 200), r = t ? _e(t) : void 0, i = {
1206
+ let n = O(e, "name", 200), r = t ? xe(t) : void 0, i = {
1025
1207
  id: `cs_stub_${H++}`,
1026
1208
  name: n,
1027
1209
  source: r,
1028
1210
  state: "open",
1029
- createdBy: b,
1030
- createTime: y(),
1211
+ createdBy: x,
1212
+ createTime: b(),
1031
1213
  chains: [],
1032
1214
  dependsOnChangeSetIds: [],
1033
1215
  status: "",
1034
1216
  assigneeIds: [],
1035
1217
  plannedReleases: []
1036
1218
  };
1037
- return w.unshift(i), A(i);
1219
+ return T.unshift(i), A(i);
1038
1220
  },
1039
1221
  async getChangeSet(e) {
1040
1222
  return A(X(e));
1041
1223
  },
1042
1224
  async updateChangeSet({ id: e, updateMask: t, name: n, source: r }) {
1043
1225
  let i = Z(e);
1044
- if (t.length === 0) throw new a("update_mask is required");
1045
- let o = t.includes("name") ? O(n ?? "", "name", 200) : i.name, s = i.source;
1046
- return t.includes("source") && (s = r ? _e(r) : void 0), i.name = o, i.source = s, A(i);
1226
+ if (t.length === 0) throw new _("update_mask is required");
1227
+ let a = t.includes("name") ? O(n ?? "", "name", 200) : i.name, o = i.source;
1228
+ return t.includes("source") && (o = r ? xe(r) : void 0), i.name = a, i.source = o, A(i);
1047
1229
  },
1048
1230
  async setChangeSetStatus({ id: e, expectedStatus: t, status: n }) {
1049
- let i = Z(e);
1050
- if (i.status !== t) throw new p(i.status);
1051
- if (i.status === n) return A(i);
1052
- if (!x.some((e) => e.slug === n)) throw new a(`status "${n}" is not in the workspace's catalogue`);
1053
- if (x.some((e) => e.slug === i.status) && !(S[i.status] ?? []).includes(n)) throw new r({
1054
- fromStatus: i.status,
1231
+ let r = Z(e);
1232
+ if (r.status !== t) throw new a(r.status);
1233
+ if (r.status === n) return A(r);
1234
+ if (!S.some((e) => e.slug === n)) throw new _(`status "${n}" is not in the workspace's catalogue`);
1235
+ if (S.some((e) => e.slug === r.status) && !(C[r.status] ?? []).includes(n)) throw new o({
1236
+ fromStatus: r.status,
1055
1237
  toStatus: n,
1056
- reason: `There is no transition from ${Xe(i.status)} to ${Xe(n)}.`,
1238
+ reason: `There is no transition from ${ut(r.status)} to ${ut(n)}.`,
1057
1239
  requiresPermission: !1
1058
1240
  });
1059
- return i.status = n, A(i);
1241
+ return r.status = n, A(r);
1060
1242
  },
1061
1243
  async setChangeSetAssignees({ id: e, assigneeIds: t }) {
1062
1244
  let n = X(e);
1063
- if (new Set(t).size !== t.length) throw new a("each assignee is given once");
1064
- if (t.length > 50) throw new a("at most 50 assignees");
1245
+ if (new Set(t).size !== t.length) throw new _("each assignee is given once");
1246
+ if (t.length > 50) throw new _("at most 50 assignees");
1065
1247
  return n.assigneeIds = [...t], A(n);
1066
1248
  },
1067
1249
  async addDependency({ id: e, dependsOnId: t }) {
1068
1250
  let n = Z(e), r = X(t);
1069
- if (r.state !== "open") throw new a(`Change Set ${t} is ${r.state}`);
1070
- if (Ze(t, e)) throw new a("the dependency would close a cycle");
1251
+ if (r.state !== "open") throw new _(`Change Set ${t} is ${r.state}`);
1252
+ if (dt(t, e)) throw new _("the dependency would close a cycle");
1071
1253
  return n.dependsOnChangeSetIds.includes(t) || n.dependsOnChangeSetIds.push(t), A(n);
1072
1254
  },
1073
1255
  async removeDependency({ id: e, dependsOnId: t }) {
@@ -1077,39 +1259,102 @@ function M(v = {}) {
1077
1259
  },
1078
1260
  async validatePublish({ id: e, reviewedHeads: t }) {
1079
1261
  let n = X(e);
1080
- L(e);
1081
- let r = Me.get(e);
1082
- if (r && m(r, t)) return {
1262
+ ke(e);
1263
+ let r = Ke.get(e);
1264
+ if (r && h(r, t)) return {
1083
1265
  blockers: [],
1084
1266
  releases: Q(n),
1085
1267
  published: !0
1086
1268
  };
1087
- if (n.state !== "open") throw new d(n.state);
1269
+ if (n.state !== "open") throw new p(n.state);
1088
1270
  return {
1089
- blockers: nt(n, t),
1271
+ blockers: gt(n, t),
1090
1272
  releases: Q(n),
1091
1273
  published: !1
1092
1274
  };
1093
1275
  },
1094
- async publish({ id: e, reviewedHeads: t }) {
1095
- let n = X(e);
1096
- L(e);
1097
- let r = Me.get(e);
1098
- if (r && m(r, t)) return {
1099
- changeSet: A(n),
1100
- publishTime: n.closeTime ?? y(),
1101
- releases: Q(n)
1276
+ async publish({ id: e, reviewedHeads: n }) {
1277
+ let r = X(e);
1278
+ ke(e);
1279
+ let i = Ke.get(e);
1280
+ if (i && h(i, n)) return {
1281
+ changeSet: A(r),
1282
+ publishTime: r.closeTime ?? b(),
1283
+ releases: Q(r)
1102
1284
  };
1103
- if (n.state !== "open") throw new d(n.state);
1104
- let i = nt(n, t);
1105
- if (i.length > 0) throw new o(i);
1106
- let a = Q(n);
1107
- return n.state = "published", n.closeTime = y(), Me.set(e, { ...t }), {
1108
- changeSet: A(n),
1109
- publishTime: n.closeTime,
1110
- releases: a
1285
+ if (r.state !== "open") throw new p(r.state);
1286
+ let a = gt(r, n);
1287
+ if (a.length > 0) throw new t(a);
1288
+ let o = Q(r);
1289
+ return r.state = "published", r.closeTime = b(), Ke.set(e, { ...n }), {
1290
+ changeSet: A(r),
1291
+ publishTime: r.closeTime,
1292
+ releases: o
1111
1293
  };
1112
1294
  },
1295
+ async changeValidity({ releaseId: e, validityPeriod: n, changeSetName: r, idempotencyKey: i }) {
1296
+ return V(i, [
1297
+ "changeValidity",
1298
+ e,
1299
+ n,
1300
+ r
1301
+ ], async () => {
1302
+ let i = D.find((t) => (t.timeline ?? []).some((t) => t.releaseId === e));
1303
+ if (!i) throw k("Release", e);
1304
+ J(i);
1305
+ let a = i.timeline ?? [], o = a.find((t) => t.releaseId === e);
1306
+ if (!o?.validityPeriod || !G(i)) throw new _("undated Releases carry no Validity Period");
1307
+ let { firstDay: c, lastDay: l = "" } = n;
1308
+ if (!g.test(c) || l !== "" && (!g.test(l) || l < c)) throw new _("validity_period is YYYY-MM-DD, the last day not before the first");
1309
+ let d = M[i.blueprintReleaseId]?.accessor ?? "", f = R.find((e) => e.blueprintAccessor === d);
1310
+ if (z(f).editingMode === "change_sets") throw new s(i.id, d);
1311
+ let p = a.filter((t) => t.releaseId !== e && t.validityPeriod && c <= t.validityPeriod.firstDay && (l === "" || t.validityPeriod.lastDay !== "" && t.validityPeriod.lastDay <= l)).map((e) => e.releaseId);
1312
+ if (p.length > 0) throw new u(i.id, p, !0);
1313
+ let ee = {
1314
+ id: `rls_stub_${H++}`,
1315
+ contentId: i.id,
1316
+ kind: "date_only",
1317
+ branchId: "",
1318
+ revisionId: o.revisionId,
1319
+ validityPeriod: {
1320
+ firstDay: c,
1321
+ lastDay: l
1322
+ },
1323
+ supersedesReleaseIds: [e],
1324
+ proposed: !1,
1325
+ proposedForReleaseId: "",
1326
+ splitFromReleaseId: "",
1327
+ withheld: !1
1328
+ }, m = {
1329
+ id: `cs_stub_${H++}`,
1330
+ name: r?.trim() || `Change of validity of ${i.id}`,
1331
+ state: "open",
1332
+ createdBy: x,
1333
+ createTime: b(),
1334
+ chains: [],
1335
+ dependsOnChangeSetIds: [],
1336
+ status: "",
1337
+ assigneeIds: [],
1338
+ plannedReleases: [ee]
1339
+ }, h = gt(m, {});
1340
+ if (h.length > 0) throw new t(h);
1341
+ let te = Q(m);
1342
+ return m.state = "published", m.closeTime = b(), T.unshift(m), Ke.set(m.id, {}), i.timeline = a.map((t) => t.releaseId === e ? {
1343
+ ...t,
1344
+ releaseId: ee.id,
1345
+ kind: "date_only",
1346
+ validityPeriod: {
1347
+ firstDay: c,
1348
+ lastDay: l
1349
+ },
1350
+ publishTime: m.closeTime ?? b()
1351
+ } : t), {
1352
+ changeSet: A(m),
1353
+ publishTime: m.closeTime,
1354
+ releases: te
1355
+ };
1356
+ });
1357
+ },
1113
1358
  async updateFromMain({ id: e, chainId: t, idempotencyKey: n }) {
1114
1359
  return V(n, [
1115
1360
  "updateFromMain",
@@ -1117,20 +1362,32 @@ function M(v = {}) {
1117
1362
  t
1118
1363
  ], async () => {
1119
1364
  let n = Z(e);
1120
- t || L(e);
1365
+ t || ke(e);
1121
1366
  let r = t ? n.chains.filter((e) => e.id === t) : n.chains;
1122
1367
  if (t && r.length === 0) throw k("Chain", t);
1123
- let i = structuredClone(ke[e] ?? []), a = [];
1124
- for (let e of r) for (let t of e.branches) {
1125
- let n = {
1126
- branchId: t.id,
1127
- contentId: e.contentId
1128
- }, r = Ae[t.id];
1129
- B.has(t.id) ? a.push(n) : r && (Ke(t.id, r), i.push(n));
1368
+ let i = structuredClone(He[e] ?? []), a = [], o = [];
1369
+ for (let t of r) for (let n of t.branches) {
1370
+ let r = {
1371
+ branchId: n.id,
1372
+ contentId: t.contentId
1373
+ }, s = Ue[n.id];
1374
+ if (B.has(n.id)) a.push(r);
1375
+ else if (s) ot(n.id, s), i.push(r);
1376
+ else if (We.has(n.id)) {
1377
+ let r = U(t.contentId);
1378
+ it({
1379
+ changeSetId: e,
1380
+ chain: t,
1381
+ branch: n,
1382
+ c: r,
1383
+ data: structuredClone(q(r, n.headRevisionId) ?? {}),
1384
+ cause: "merge"
1385
+ }), We.delete(n.id), o.push(n.id);
1386
+ }
1130
1387
  }
1131
1388
  return {
1132
1389
  changeSet: A(n),
1133
- mergedBranchIds: [],
1390
+ mergedBranchIds: o,
1134
1391
  conflicted: i,
1135
1392
  pending: a,
1136
1393
  endedBranchIds: []
@@ -1139,90 +1396,132 @@ function M(v = {}) {
1139
1396
  },
1140
1397
  async discardChangeSet(e) {
1141
1398
  let t = Z(e);
1142
- return L(e), t.state = "discarded", t.closeTime = y(), t.chains = [], A(t);
1399
+ return ke(e), t.state = "discarded", t.closeTime = b(), t.chains = [], A(t);
1143
1400
  },
1144
1401
  async listCheckResults(e) {
1145
- return tt(X(e));
1146
- },
1147
- async recordCheckResult({ changeSetId: t, requiredCheckId: n, heads: r, outcome: i, note: o }) {
1148
- let s = Z(t);
1149
- if (i === "waived" && o.trim() === "") throw new a("a waived result needs a note saying why");
1150
- if ([...o].length > 2e3) throw new a(`a note is at most ${l} characters`);
1151
- let c = F.find((e) => e.id === n);
1152
- if (!c) throw k("Required Check", n);
1153
- let d = we(n);
1154
- if (I === "guardian" && !d.everyMember && !d.userIds.includes(b)) throw new u(`recording results of Required Check ${n} needs its recorder relation`);
1155
- let f = Qe(s), p = Object.keys(r);
1156
- if (c.scope === "branch" && p.length !== 1) throw new a("a Branch-scope result names one head");
1157
- if (c.scope === "change_set" && p.length !== f.length) throw new a("a Change Set-scope result names every head of the Change Set");
1158
- for (let t of p) {
1159
- let n = f.find((e) => e.key === t);
1160
- if (!n) throw new a(`heads name ${t}, which this Change Set doesn't hold`);
1161
- if (n.revision !== r[t]) throw new e({
1162
- contentId: n.contentId,
1163
- branchId: n.branchless ? "" : n.key,
1164
- expectedHeadId: r[t],
1165
- currentHeadId: n.revision
1402
+ return ht(X(e));
1403
+ },
1404
+ async recordCheckResult({ changeSetId: e, requiredCheckId: t, heads: n, outcome: r, note: a }) {
1405
+ let o = Z(e);
1406
+ if (r === "waived" && a.trim() === "") throw new _("a waived result needs a note saying why");
1407
+ if ([...a].length > 2e3) throw new _(`a note is at most ${d} characters`);
1408
+ let s = N.find((e) => e.id === t);
1409
+ if (!s) throw k("Required Check", t);
1410
+ let c = Ae(t);
1411
+ if (P === "guardian" && !c.everyMember && !c.userIds.includes(x)) throw new f(`recording results of Required Check ${t} needs its recorder relation`);
1412
+ let l = ft(o), u = Object.keys(n);
1413
+ if (s.scope === "branch" && u.length !== 1) throw new _("a Branch-scope result names one head");
1414
+ if (s.scope === "change_set" && u.length !== l.length) throw new _("a Change Set-scope result names every head of the Change Set");
1415
+ for (let e of u) {
1416
+ let t = l.find((t) => t.key === e);
1417
+ if (!t) throw new _(`heads name ${e}, which this Change Set doesn't hold`);
1418
+ if (t.revision !== n[e]) throw new i({
1419
+ contentId: t.contentId,
1420
+ branchId: t.branchless ? "" : t.key,
1421
+ expectedHeadId: n[e],
1422
+ currentHeadId: t.revision
1166
1423
  });
1167
1424
  }
1168
- let m = {
1425
+ let p = {
1169
1426
  id: `cr_stub_${H++}`,
1170
- requiredCheckId: n,
1171
- heads: { ...r },
1172
- outcome: i,
1173
- note: o,
1174
- recordedBy: b,
1175
- recordTime: y()
1427
+ requiredCheckId: t,
1428
+ heads: { ...n },
1429
+ outcome: r,
1430
+ note: a,
1431
+ recordedBy: x,
1432
+ recordTime: b()
1176
1433
  };
1177
- return De.push({
1178
- ...m,
1179
- changeSetId: t
1180
- }), structuredClone(m);
1434
+ return Be.push({
1435
+ ...p,
1436
+ changeSetId: e
1437
+ }), structuredClone(p);
1438
+ },
1439
+ async getEditingSettings() {
1440
+ let e = [...R].sort((e, t) => e.blueprintAccessor < t.blueprintAccessor ? -1 : 1);
1441
+ return {
1442
+ workspace: structuredClone(L),
1443
+ overrides: e.map(Pe)
1444
+ };
1445
+ },
1446
+ async getEffectiveEditingSettings(e) {
1447
+ let t = R.find((t) => t.blueprintAccessor === e.trim());
1448
+ return {
1449
+ effective: z(t),
1450
+ editingModeOverridden: (t?.editingMode ?? null) !== null,
1451
+ editingBlockOverridden: (t?.editingBlock ?? null) !== null,
1452
+ forceGroupOverridden: (t?.forceGroup ?? null) !== null,
1453
+ callerInForceGroup: Ie(z(t).forceGroup)
1454
+ };
1455
+ },
1456
+ async setEditingSettings(e) {
1457
+ if (ze(), !Re.includes(e.editingMode)) throw new _("the workspace's editing settings need an Editing Mode");
1458
+ return L = {
1459
+ ...e,
1460
+ forceGroup: Le(e.forceGroup)
1461
+ }, structuredClone(L);
1462
+ },
1463
+ async setBlueprintEditingOverride({ blueprintAccessor: e, editingMode: t, editingBlock: n, forceGroup: r }) {
1464
+ ze();
1465
+ let i = O(e, "a Blueprint accessor", 200);
1466
+ if (t === null && n === null && r === null) throw new _(`an override of "${i}" sets the Editing Mode, the Editing Block, the Force Group or several`);
1467
+ let a = {
1468
+ blueprintAccessor: i,
1469
+ editingMode: t,
1470
+ editingBlock: n,
1471
+ forceGroup: r === null ? null : Le(r)
1472
+ };
1473
+ return R = [...R.filter((e) => e.blueprintAccessor !== i), a], Pe(a);
1474
+ },
1475
+ async deleteBlueprintEditingOverride({ blueprintAccessor: e }) {
1476
+ ze();
1477
+ let t = e.trim();
1478
+ if (!R.some((e) => e.blueprintAccessor === t)) throw k("an editing override of", t);
1479
+ R = R.filter((e) => e.blueprintAccessor !== t);
1181
1480
  },
1182
1481
  async listRequiredChecks() {
1183
1482
  let e = (e, t) => e.name < t.name ? -1 : e.name > t.name ? 1 : e.id < t.id ? -1 : +(e.id > t.id);
1184
- return structuredClone([...F].sort(e));
1483
+ return structuredClone([...N].sort(e));
1185
1484
  },
1186
1485
  async createRequiredCheck(e) {
1187
- let t = ye(e);
1188
- if (F.some((e) => e.name === t.name)) throw new g(t.name);
1189
- let n = {
1486
+ let t = Ce(e);
1487
+ if (N.some((e) => e.name === t.name)) throw new n(t.name);
1488
+ let r = {
1190
1489
  id: `rc_stub_${H++}`,
1191
1490
  ...t
1192
1491
  };
1193
- return F.push(n), structuredClone(n);
1492
+ return N.push(r), structuredClone(r);
1194
1493
  },
1195
1494
  async updateRequiredCheck({ id: e, ...t }) {
1196
- let n = ye(t), r = F.find((t) => t.id === e);
1197
- if (!r) throw k("Required Check", e);
1198
- if (F.some((t) => t.name === n.name && t.id !== e)) throw new g(n.name);
1199
- return Object.assign(r, n), structuredClone(r);
1495
+ let r = Ce(t), i = N.find((t) => t.id === e);
1496
+ if (!i) throw k("Required Check", e);
1497
+ if (N.some((t) => t.name === r.name && t.id !== e)) throw new n(r.name);
1498
+ return Object.assign(i, r), structuredClone(i);
1200
1499
  },
1201
1500
  async deleteRequiredCheck({ id: e }) {
1202
- if (!F.some((t) => t.id === e)) throw k("Required Check", e);
1203
- F = F.filter((t) => t.id !== e), z.delete(e);
1501
+ if (!N.some((t) => t.id === e)) throw k("Required Check", e);
1502
+ N = N.filter((t) => t.id !== e), I.delete(e);
1204
1503
  },
1205
1504
  async listRequiredCheckRecorders(e) {
1206
- return structuredClone(He(e));
1505
+ return structuredClone(nt(e));
1207
1506
  },
1208
1507
  async grantRequiredCheckRecorder({ requiredCheckId: e, recorder: t }) {
1209
- let n = He(e);
1508
+ let n = nt(e);
1210
1509
  if ("everyMember" in t) {
1211
- z.set(e, {
1510
+ I.set(e, {
1212
1511
  ...n,
1213
1512
  everyMember: !0
1214
1513
  });
1215
1514
  return;
1216
1515
  }
1217
- if (!Te.includes(t.userId)) throw new a(`user ${t.userId} is not a member of the workspace`);
1218
- z.set(e, {
1516
+ if (!je.includes(t.userId)) throw new _(`user ${t.userId} is not a member of the workspace`);
1517
+ I.set(e, {
1219
1518
  ...n,
1220
1519
  userIds: [.../* @__PURE__ */ new Set([...n.userIds, t.userId])].sort()
1221
1520
  });
1222
1521
  },
1223
1522
  async revokeRequiredCheckRecorder({ requiredCheckId: e, recorder: t }) {
1224
- let n = He(e);
1225
- z.set(e, "everyMember" in t ? {
1523
+ let n = nt(e);
1524
+ I.set(e, "everyMember" in t ? {
1226
1525
  ...n,
1227
1526
  everyMember: !1
1228
1527
  } : {
@@ -1233,7 +1532,7 @@ function M(v = {}) {
1233
1532
  async searchBlueprints({ query: e }) {
1234
1533
  let t = e.trim().toLocaleLowerCase();
1235
1534
  return {
1236
- blueprints: he.filter((e) => !e.archived).filter((e) => e.name.toLocaleLowerCase().includes(t)).filter((e) => M.some((t) => t.blueprintId === e.id)).map((e) => ({
1535
+ blueprints: ge.filter((e) => !e.archived).filter((e) => e.name.toLocaleLowerCase().includes(t)).filter((e) => ve.some((t) => t.blueprintId === e.id)).map((e) => ({
1237
1536
  id: e.id,
1238
1537
  name: e.name
1239
1538
  })),
@@ -1241,14 +1540,14 @@ function M(v = {}) {
1241
1540
  };
1242
1541
  },
1243
1542
  async getBlueprints(e) {
1244
- if (e.length > 1e3) throw new a(`at most ${t} Blueprint ids`);
1245
- return he.filter((t) => e.includes(t.id)).map((e) => ({
1543
+ if (e.length > 1e3) throw new _(`at most ${c} Blueprint ids`);
1544
+ return ge.filter((t) => e.includes(t.id)).map((e) => ({
1246
1545
  id: e.id,
1247
1546
  name: e.name
1248
1547
  }));
1249
1548
  },
1250
1549
  async listBlueprintReleases(e) {
1251
- return M.filter((t) => t.blueprintId === e).map((e) => ({
1550
+ return ve.filter((t) => t.blueprintId === e).map((e) => ({
1252
1551
  id: e.id,
1253
1552
  blueprintId: e.blueprintId,
1254
1553
  name: e.name ?? e.id,
@@ -1257,76 +1556,76 @@ function M(v = {}) {
1257
1556
  }));
1258
1557
  },
1259
1558
  async listCollections() {
1260
- return [...T].sort(ze).map((e) => ({ ...e }));
1559
+ return [...E].sort($e).map((e) => ({ ...e }));
1261
1560
  },
1262
1561
  async createCollection({ name: e, parentId: t = "", restricted: r = !1 }) {
1263
1562
  let i = O(e, "a Collection's name", 200);
1264
- if (t !== "" && Y(t), r && I === "workspace") throw new n(Se);
1265
- if (Be(t, i)) throw new g(i);
1563
+ if (t !== "" && Y(t), r && P === "workspace") throw new m(Ee);
1564
+ if (et(t, i)) throw new n(i);
1266
1565
  let a = {
1267
1566
  id: `col_stub_${H++}`,
1268
1567
  name: i,
1269
1568
  parentId: t,
1270
1569
  restricted: r
1271
1570
  };
1272
- return T.push(a), r && R.set(a.id, [{
1273
- userId: b,
1571
+ return E.push(a), r && F.set(a.id, [{
1572
+ userId: x,
1274
1573
  level: "owner"
1275
1574
  }]), { ...a };
1276
1575
  },
1277
1576
  async renameCollection({ id: e, name: t }) {
1278
- let n = O(t, "a Collection's name", 200), r = Y(e);
1279
- if (Be(r.parentId, n, e)) throw new g(n);
1280
- return r.name = n, { ...r };
1577
+ let r = O(t, "a Collection's name", 200), i = Y(e);
1578
+ if (et(i.parentId, r, e)) throw new n(r);
1579
+ return i.name = r, { ...i };
1281
1580
  },
1282
1581
  async moveCollection({ id: e, parentId: t }) {
1283
- let n = Y(e);
1284
- for (let n = t; n !== ""; n = Y(n).parentId) if (n === e) throw new a(`Collection ${e} can't move under itself or a Collection under it`);
1285
- if (Be(t, n.name, e)) throw new g("");
1286
- return n.parentId = t, { ...n };
1582
+ let r = Y(e);
1583
+ for (let n = t; n !== ""; n = Y(n).parentId) if (n === e) throw new _(`Collection ${e} can't move under itself or a Collection under it`);
1584
+ if (et(t, r.name, e)) throw new n("");
1585
+ return r.parentId = t, { ...r };
1287
1586
  },
1288
1587
  async removeCollection({ id: e }) {
1289
- if (Y(e), T.some((t) => t.parentId === e)) throw new a(`Collection ${e} has Collections under it: remove or move those first`);
1290
- T.splice(T.findIndex((t) => t.id === e), 1), R.delete(e);
1588
+ if (Y(e), E.some((t) => t.parentId === e)) throw new _(`Collection ${e} has Collections under it: remove or move those first`);
1589
+ E.splice(E.findIndex((t) => t.id === e), 1), F.delete(e);
1291
1590
  let t = [];
1292
1591
  for (let n of D) n.collectionIds.includes(e) && (n.collectionIds = n.collectionIds.filter((t) => t !== e), t.push(n.id));
1293
1592
  return t;
1294
1593
  },
1295
- async setCollectionRestricted({ id: e, restricted: t, acknowledgeDisclosure: r = !1 }) {
1296
- if (t && I === "workspace") throw new n(Se);
1297
- let i = Y(e);
1298
- if (i.restricted === t) return { ...i };
1299
- if (!t && !r) throw new a(`unrestricting Collection ${e} discloses its Content to every viewer: confirm it with acknowledge_disclosure`);
1300
- return i.restricted = t, t ? R.set(e, [{
1301
- userId: b,
1594
+ async setCollectionRestricted({ id: e, restricted: t, acknowledgeDisclosure: n = !1 }) {
1595
+ if (t && P === "workspace") throw new m(Ee);
1596
+ let r = Y(e);
1597
+ if (r.restricted === t) return { ...r };
1598
+ if (!t && !n) throw new _(`unrestricting Collection ${e} discloses its Content to every viewer: confirm it with acknowledge_disclosure`);
1599
+ return r.restricted = t, t ? F.set(e, [{
1600
+ userId: x,
1302
1601
  level: "owner"
1303
- }]) : R.delete(e), { ...i };
1602
+ }]) : F.delete(e), { ...r };
1304
1603
  },
1305
1604
  async listCollectionGrants(e) {
1306
- return Ve(e), structuredClone(R.get(e) ?? []).sort((e, t) => e.userId < t.userId ? -1 : +(e.userId > t.userId));
1605
+ return tt(e), structuredClone(F.get(e) ?? []).sort((e, t) => e.userId < t.userId ? -1 : +(e.userId > t.userId));
1307
1606
  },
1308
1607
  async grantCollectionAccess({ collectionId: e, userId: t, level: n }) {
1309
- if (Ve(e), n !== "viewer" && n !== "editor") throw new a("a grant is viewer or editor");
1310
- if (!Te.includes(t)) throw new a(`${t} is not a member of the workspace`);
1311
- let r = R.get(e) ?? [];
1312
- r.some((e) => e.level === "owner" && e.userId === t) || R.set(e, [...r.filter((e) => e.userId !== t), {
1608
+ if (tt(e), n !== "viewer" && n !== "editor") throw new _("a grant is viewer or editor");
1609
+ if (!je.includes(t)) throw new _(`${t} is not a member of the workspace`);
1610
+ let r = F.get(e) ?? [];
1611
+ r.some((e) => e.level === "owner" && e.userId === t) || F.set(e, [...r.filter((e) => e.userId !== t), {
1313
1612
  userId: t,
1314
1613
  level: n
1315
1614
  }]);
1316
1615
  },
1317
1616
  async revokeCollectionAccess({ collectionId: e, userId: t }) {
1318
- Ve(e), R.set(e, (R.get(e) ?? []).filter((e) => e.userId !== t || e.level === "owner"));
1617
+ tt(e), F.set(e, (F.get(e) ?? []).filter((e) => e.userId !== t || e.level === "owner"));
1319
1618
  },
1320
1619
  async listContents(e = {}) {
1321
1620
  let t = e.view ?? { kind: "main" }, n = (e.search ?? "").trim();
1322
- if (n !== "" && t.kind === "in_force") throw new a("filter.search: Editor Search covers Main and open Branch heads, never Releases");
1323
- if ([...n].length > 200) throw new a("filter.search is at most 200 characters");
1324
- if (e.collectionId && !T.some((t) => t.id === e.collectionId)) throw k("Collection", e.collectionId);
1621
+ if (n !== "" && t.kind === "in_force") throw new _("filter.search: Editor Search covers Main and open Branch heads, never Releases");
1622
+ if ([...n].length > 200) throw new _("filter.search is at most 200 characters");
1623
+ if (e.collectionId && !E.some((t) => t.id === e.collectionId)) throw k("Collection", e.collectionId);
1325
1624
  t.kind === "change_set" && X(t.changeSetId);
1326
- let r = D.filter((e) => !e.archiveTime).filter((t) => !e.collectionId || t.collectionIds.includes(e.collectionId)).filter((t) => !e.blueprintIds?.length || e.blueprintIds.includes(t.blueprintId)).filter((t) => !e.assigneeId || (t.assigneeIds ?? []).includes(e.assigneeId)).sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)).flatMap((e) => $(e, t, n)), i = Math.min(e.pageSize || 50, 200), o = e.pageToken ? Number(e.pageToken) : 0;
1625
+ let r = D.filter((e) => !e.archiveTime).filter((t) => !e.collectionId || t.collectionIds.includes(e.collectionId)).filter((t) => !e.blueprintIds?.length || e.blueprintIds.includes(t.blueprintId)).filter((t) => !e.assigneeId || (t.assigneeIds ?? []).includes(e.assigneeId)).sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)).flatMap((e) => xt(e, t, n)), i = Math.min(e.pageSize || 50, 200), a = e.pageToken ? Number(e.pageToken) : 0;
1327
1626
  return {
1328
- contents: r.slice(o, o + i),
1329
- nextPageToken: o + i < r.length ? String(o + i) : ""
1627
+ contents: r.slice(a, a + i),
1628
+ nextPageToken: a + i < r.length ? String(a + i) : ""
1330
1629
  };
1331
1630
  },
1332
1631
  async createContent({ changeSetId: e, blueprintReleaseId: t, copyFrom: n }) {
@@ -1336,13 +1635,13 @@ function M(v = {}) {
1336
1635
  if (!r || !e) throw k("copy source", JSON.stringify(n));
1337
1636
  i = structuredClone(q(r, e) ?? {}), a = t || r.blueprintReleaseId;
1338
1637
  }
1339
- let o = M.find((e) => e.id === a);
1340
- if (!o) throw new _(`Blueprint Release ${a} can't be loaded`, [{
1638
+ let o = ve.find((e) => e.id === a);
1639
+ if (!o) throw new oe(`Blueprint Release ${a} can't be loaded`, [{
1341
1640
  source: "contenthub",
1342
1641
  code: "release_not_found",
1343
1642
  path: ""
1344
1643
  }]);
1345
- if (o.refusals?.length) throw new _(`Blueprint Release ${a} can't be loaded`, o.refusals.map((e) => ({ ...e })));
1644
+ if (o.refusals?.length) throw new oe(`Blueprint Release ${a} can't be loaded`, o.refusals.map((e) => ({ ...e })));
1346
1645
  let s = H++, c = `content_stub_${s}`, l = `br_stub_${s}`, u = `rev_stub_${s}`;
1347
1646
  return D.push({
1348
1647
  id: c,
@@ -1353,7 +1652,7 @@ function M(v = {}) {
1353
1652
  branchId: l,
1354
1653
  revisionId: u,
1355
1654
  data: i,
1356
- revisionCreateTime: y()
1655
+ revisionCreateTime: b()
1357
1656
  } }
1358
1657
  }), r.chains.push({
1359
1658
  id: `chain_stub_${s}`,
@@ -1373,19 +1672,19 @@ function M(v = {}) {
1373
1672
  data: structuredClone(i),
1374
1673
  changeSetId: e,
1375
1674
  branchId: l,
1376
- revisionCreateTime: y(),
1675
+ revisionCreateTime: b(),
1377
1676
  releaseId: ""
1378
1677
  };
1379
1678
  },
1380
1679
  async saveRevision({ idempotencyKey: e, ...t }) {
1381
- if (!e) return Ue(t);
1382
- let n = JSON.stringify(t), r = Ne.get(e);
1680
+ if (!e) return rt(t);
1681
+ let n = JSON.stringify(t), r = qe.get(e);
1383
1682
  if (r) {
1384
- if (r.asked !== n) throw new a(`idempotency key ${e} names another save`);
1683
+ if (r.asked !== n) throw new _(`idempotency key ${e} names another save`);
1385
1684
  return structuredClone(r.content);
1386
1685
  }
1387
- let i = await Ue(t);
1388
- return Ne.set(e, {
1686
+ let i = await rt(t);
1687
+ return qe.set(e, {
1389
1688
  asked: n,
1390
1689
  content: structuredClone(i)
1391
1690
  }), i;
@@ -1395,30 +1694,30 @@ function M(v = {}) {
1395
1694
  kind: "change_set",
1396
1695
  changeSetId: t
1397
1696
  } : { kind: "main" };
1398
- if (n && !t) throw new a("branch_id names a Branch of a Change Set: give its change_set_id too");
1399
- let [o] = $(r, i, "");
1400
- if (!o) throw k("Content", e);
1401
- if (n && n !== o.branchId) {
1402
- let i = w.find((e) => e.id === t)?.chains.find((t) => t.contentId === e)?.branches.find((e) => e.id === n);
1697
+ if (n && !t) throw new _("branch_id names a Branch of a Change Set: give its change_set_id too");
1698
+ let [a] = xt(r, i, "");
1699
+ if (!a) throw k("Content", e);
1700
+ if (n && n !== a.branchId) {
1701
+ let i = T.find((e) => e.id === t)?.chains.find((t) => t.contentId === e)?.branches.find((e) => e.id === n);
1403
1702
  if (!i) throw k("Branch", n);
1404
- let a = K(r).find((e) => e.id === i.headRevisionId), s = a?.data ?? (r.main?.revisionId === i.headRevisionId ? r.main.data : {});
1405
- o = {
1406
- ...o,
1703
+ let o = K(r).find((e) => e.id === i.headRevisionId), s = o?.data ?? (r.main?.revisionId === i.headRevisionId ? r.main.data : {});
1704
+ a = {
1705
+ ...a,
1407
1706
  revisionId: i.headRevisionId,
1408
1707
  data: structuredClone(s),
1409
1708
  branchId: n,
1410
- revisionCreateTime: a?.createTime ?? o.revisionCreateTime
1709
+ revisionCreateTime: o?.createTime ?? a.revisionCreateTime
1411
1710
  };
1412
1711
  }
1413
- let s = P[r.blueprintReleaseId];
1712
+ let o = M[r.blueprintReleaseId];
1414
1713
  return {
1415
- content: o,
1416
- blueprintRelease: s ? structuredClone(s) : void 0,
1714
+ content: a,
1715
+ blueprintRelease: o ? structuredClone(o) : void 0,
1417
1716
  attributes: W(r)
1418
1717
  };
1419
1718
  },
1420
1719
  async getTimeline(e) {
1421
- let t = U(e), n = (e) => w.find((t) => t.id === e)?.state === "open";
1720
+ let t = U(e), n = (e) => T.find((t) => t.id === e)?.state === "open";
1422
1721
  return structuredClone({
1423
1722
  entries: t.timeline ?? [],
1424
1723
  plannedReleases: (t.plannedReleases ?? []).filter((e) => n(e.changeSetId))
@@ -1444,34 +1743,34 @@ function M(v = {}) {
1444
1743
  async compare({ revisionId: e, base: t }) {
1445
1744
  let n = D.find((t) => K(t).some((t) => t.id === e));
1446
1745
  if (!n) throw k("Revision", e);
1447
- let r = K(n), i = r.find((t) => t.id === e), o;
1448
- if (t.kind === "revision") o = t.revisionId;
1746
+ let r = K(n), i = r.find((t) => t.id === e), a;
1747
+ if (t.kind === "revision") a = t.revisionId;
1449
1748
  else if (t.kind === "main_head") {
1450
- if (!n.main) throw new a("the Content is not published: it has no Main Branch");
1451
- o = n.main.revisionId;
1452
- } else o = r.find((e) => e.branchId === t.branchId)?.parentId ?? "";
1453
- let s = r.find((e) => e.id === o);
1454
- if (!s) throw k("Revision", o);
1455
- let c = q(n, i.id) ?? {}, l = q(n, s.id) ?? {}, u = [];
1456
- for (let e of [.../* @__PURE__ */ new Set([...Object.keys(c), ...Object.keys(l)])]) e in l ? e in c ? JSON.stringify(c[e]) !== JSON.stringify(l[e]) && u.push({
1749
+ if (!n.main) throw new _("the Content is not published: it has no Main Branch");
1750
+ a = n.main.revisionId;
1751
+ } else a = r.find((e) => e.branchId === t.branchId)?.parentId ?? "";
1752
+ let o = r.find((e) => e.id === a);
1753
+ if (!o) throw k("Revision", a);
1754
+ let s = q(n, i.id) ?? {}, c = q(n, o.id) ?? {}, l = [];
1755
+ for (let e of [.../* @__PURE__ */ new Set([...Object.keys(s), ...Object.keys(c)])]) e in c ? e in s ? JSON.stringify(s[e]) !== JSON.stringify(c[e]) && l.push({
1457
1756
  path: `/${e}`,
1458
1757
  kind: "changed",
1459
- before: l[e],
1460
- after: c[e]
1461
- }) : u.push({
1758
+ before: c[e],
1759
+ after: s[e]
1760
+ }) : l.push({
1462
1761
  path: `/${e}`,
1463
1762
  kind: "removed",
1464
- before: l[e]
1465
- }) : u.push({
1763
+ before: c[e]
1764
+ }) : l.push({
1466
1765
  path: `/${e}`,
1467
1766
  kind: "added",
1468
- after: c[e]
1767
+ after: s[e]
1469
1768
  });
1470
- let d = ({ data: e, ...t }) => t;
1769
+ let u = ({ data: e, ...t }) => t;
1471
1770
  return {
1472
- base: d(s),
1473
- revision: d(i),
1474
- changes: u
1771
+ base: u(o),
1772
+ revision: u(i),
1773
+ changes: l
1475
1774
  };
1476
1775
  },
1477
1776
  async listReferences({ contentId: e, revisionId: t }) {
@@ -1492,7 +1791,7 @@ function M(v = {}) {
1492
1791
  branchId: ""
1493
1792
  })));
1494
1793
  if (!t) return i(a);
1495
- let o = D.flatMap((t) => Object.entries(t.branches).flatMap(([n, r]) => w.find((e) => e.id === n)?.state === "open" ? (t.edges ?? []).filter((t) => t.targetContentId === e && t.sourceRevisionId === r.revisionId).map((e) => ({
1794
+ let o = D.flatMap((t) => Object.entries(t.branches).flatMap(([n, r]) => T.find((e) => e.id === n)?.state === "open" ? (t.edges ?? []).filter((t) => t.targetContentId === e && t.sourceRevisionId === r.revisionId).map((e) => ({
1496
1795
  edge: { ...e },
1497
1796
  releaseId: "",
1498
1797
  changeSetId: n,
@@ -1521,113 +1820,272 @@ function M(v = {}) {
1521
1820
  },
1522
1821
  async setContentCollections({ contentId: e, collectionIds: t }) {
1523
1822
  let n = U(e), r = [...new Set(t)];
1524
- if (r.length > 100) throw new a("at most 100 Collections");
1525
- for (let e of r) if (!T.some((t) => t.id === e)) throw k("Collection", e);
1823
+ if (r.length > 100) throw new _("at most 100 Collections");
1824
+ for (let e of r) if (!E.some((t) => t.id === e)) throw k("Collection", e);
1526
1825
  return n.collectionIds = r.sort(), [...n.collectionIds];
1527
1826
  },
1528
1827
  async setContentAssignees({ contentId: e, assigneeIds: t }) {
1529
1828
  let n = U(e);
1530
- if (new Set(t).size !== t.length) throw new a("each assignee is given once");
1531
- if (t.length > 50) throw new a("at most 50 assignees");
1829
+ if (new Set(t).size !== t.length) throw new _("each assignee is given once");
1830
+ if (t.length > 50) throw new _("at most 50 assignees");
1532
1831
  return n.assigneeIds = [...t], W(n);
1533
1832
  },
1534
1833
  async blockContent({ contentId: e, blockReasonId: t, allowedUserIds: n }) {
1535
1834
  let r = U(e);
1536
- if (!C.some((e) => e.id === t)) throw k("Block Reason", t);
1537
- if (new Set(n).size !== n.length) throw new a("each allowed user is given once");
1835
+ if (!w.some((e) => e.id === t)) throw k("Block Reason", t);
1836
+ if (new Set(n).size !== n.length) throw new _("each allowed user is given once");
1538
1837
  return r.block = {
1539
1838
  blockReasonId: t,
1540
1839
  allowedUserIds: [...n],
1541
- blockedBy: b,
1542
- blockTime: y()
1840
+ blockedBy: x,
1841
+ blockTime: b()
1543
1842
  }, W(r);
1544
1843
  },
1545
1844
  async unblockContent(e) {
1546
1845
  let t = U(e);
1846
+ if (!t.block && t.editingBlock) throw new _(`Content ${e} is being edited by ${t.editingBlock.editorId} in a Direct Edit: its Editing Block can't be lifted`);
1547
1847
  return t.block = void 0, W(t);
1548
1848
  },
1549
1849
  async archiveContent(e) {
1550
1850
  let t = U(e);
1551
1851
  if (t.archiveTime) return W(t);
1552
- if (!t.main) throw new a(`Content ${e} is not published: discard its Change Set instead of archiving it`);
1553
- if (f(t.timeline ?? [], Pe())) throw new a(`Content ${e} has a Release In Force today or later: end its force first`);
1554
- return t.archiveTime = y(), W(t);
1852
+ if (!t.main) throw new _(`Content ${e} is not published: discard its Change Set instead of archiving it`);
1853
+ if (ee(t.timeline ?? [], Je())) throw new _(`Content ${e} has a Release In Force today or later: end its force first`);
1854
+ return t.archiveTime = b(), W(t);
1555
1855
  },
1556
1856
  async unarchiveContent(e) {
1557
1857
  let t = U(e);
1558
1858
  return t.archiveTime = void 0, W(t);
1559
1859
  },
1860
+ async openDirectEdit({ contentId: e, effectiveOn: t, idempotencyKey: n }) {
1861
+ return V(n, [
1862
+ "openDirectEdit",
1863
+ e,
1864
+ t
1865
+ ], async () => {
1866
+ let n = U(e), r = T.find((t) => t.kind === "direct_edit" && t.state === "open" && t.editorId === x && t.chains[0]?.contentId === e);
1867
+ if (r) {
1868
+ let [e] = xt(n, {
1869
+ kind: "change_set",
1870
+ changeSetId: r.id
1871
+ }, "");
1872
+ return {
1873
+ changeSet: A(r),
1874
+ content: e,
1875
+ reopened: !0
1876
+ };
1877
+ }
1878
+ let i = G(n);
1879
+ if (!i && t) throw new _("effective_on is refused for undated Content");
1880
+ let a = Fe(n), o = z(R.find((e) => e.blueprintAccessor === a)), c = o.editingMode;
1881
+ if (n.main && c === "change_sets") throw new s(e, a, c);
1882
+ if (n.editingBlock && n.editingBlock.editorId !== x) throw new v("editing_blocked", `Content ${e} is being edited by ${n.editingBlock.editorId} in a Direct Edit`, e, n.editingBlock.editorId);
1883
+ let l = i ? t || Je() : void 0, u = await $.startEditing({
1884
+ contentId: e,
1885
+ changeSetName: `Direct Edit of ${e}`,
1886
+ effectiveOn: l
1887
+ }), d = X(u.changeSet.id);
1888
+ d.kind = "direct_edit", d.editorId = x;
1889
+ let f = d.chains[0];
1890
+ if (l && f?.branches[0]) {
1891
+ let e = n.timeline ?? [], t = (e) => !!e.validityPeriod && e.validityPeriod.firstDay <= l && (e.validityPeriod.lastDay === "" || l <= e.validityPeriod.lastDay), r = [...e].reverse().find(t);
1892
+ f.branches[0].effectiveOn = l, f.branches[0].carriedReleaseId = r?.releaseId ?? "";
1893
+ for (let t of e) !t.validityPeriod || t.validityPeriod.firstDay <= l || f.branches.push({
1894
+ id: `br_stub_${H++}`,
1895
+ position: f.branches.length,
1896
+ kind: "carry_forward",
1897
+ headRevisionId: t.revisionId,
1898
+ effectiveOn: t.validityPeriod.firstDay,
1899
+ carriedReleaseId: t.releaseId
1900
+ });
1901
+ }
1902
+ return o.editingBlock && (n.editingBlock = {
1903
+ editorId: x,
1904
+ changeSetId: d.id,
1905
+ blockTime: b()
1906
+ }), {
1907
+ changeSet: A(d),
1908
+ content: u.content,
1909
+ reopened: !1
1910
+ };
1911
+ });
1912
+ },
1913
+ async previewDirectEditPublish({ id: e, validityLastDay: t }) {
1914
+ let n = X(e);
1915
+ if (n.kind !== "direct_edit") throw new v("not_a_direct_edit", `Change Set ${e} is not a Direct Edit`);
1916
+ return structuredClone(vt(n, t));
1917
+ },
1918
+ async publishDirectEdit({ id: e, expectedHeadId: t, releaseSpec: n, validityLastDay: r, carryForward: i, idempotencyKey: a }) {
1919
+ return V(a, [
1920
+ "publishDirectEdit",
1921
+ e,
1922
+ t,
1923
+ n,
1924
+ r,
1925
+ i
1926
+ ], async () => {
1927
+ let a = X(e);
1928
+ if (a.kind !== "direct_edit") throw new v("not_a_direct_edit", `Change Set ${e} is not a Direct Edit`);
1929
+ let o = U(a.chains[0]?.contentId ?? ""), s = {
1930
+ cs: structuredClone(a),
1931
+ c: structuredClone(o)
1932
+ };
1933
+ try {
1934
+ return await yt(a, t, n, {
1935
+ validityLastDay: r,
1936
+ carryForward: i
1937
+ });
1938
+ } catch (e) {
1939
+ throw _t(a, s.cs), _t(o, s.c), e;
1940
+ }
1941
+ });
1942
+ },
1943
+ async saveAndPublishDirectEdit({ id: e, expectedHeadId: t, data: n, fieldMask: r, releaseSpec: i, validityLastDay: a, carryForward: o, idempotencyKey: s }) {
1944
+ return V(s, [
1945
+ "saveAndPublishDirectEdit",
1946
+ e,
1947
+ t,
1948
+ n,
1949
+ r,
1950
+ i,
1951
+ a,
1952
+ o
1953
+ ], async () => {
1954
+ let s = X(e);
1955
+ if (s.kind !== "direct_edit") throw new v("not_a_direct_edit", `Change Set ${e} is not a Direct Edit`);
1956
+ let c = s.chains[0]?.branches[0];
1957
+ if (!c) throw Error(`Direct Edit ${e} has no Branch`);
1958
+ let l = U(s.chains[0]?.contentId ?? ""), u = {
1959
+ cs: structuredClone(s),
1960
+ c: structuredClone(l)
1961
+ };
1962
+ try {
1963
+ let l = await rt({
1964
+ changeSetId: e,
1965
+ branchId: c.id,
1966
+ expectedHeadId: t,
1967
+ data: n,
1968
+ fieldMask: r
1969
+ });
1970
+ return {
1971
+ content: l,
1972
+ outcome: await yt(s, l.revisionId, i, {
1973
+ validityLastDay: a,
1974
+ carryForward: o
1975
+ })
1976
+ };
1977
+ } catch (e) {
1978
+ throw _t(s, u.cs), _t(l, u.c), e;
1979
+ }
1980
+ });
1981
+ },
1982
+ async discardDirectEdit({ id: e, idempotencyKey: t }) {
1983
+ return V(t, ["discardDirectEdit", e], async () => {
1984
+ if (X(e).kind !== "direct_edit") throw new v("not_a_direct_edit", `Change Set ${e} is not a Direct Edit`);
1985
+ let t = await $.discardChangeSet(e);
1986
+ for (let t of D) t.editingBlock?.changeSetId === e && (t.editingBlock = void 0);
1987
+ return t;
1988
+ });
1989
+ },
1990
+ async forceDirectEdit({ id: e, idempotencyKey: t }) {
1991
+ return V(t, ["forceDirectEdit", e], async () => {
1992
+ let t = X(e);
1993
+ if (t.kind !== "direct_edit") throw new v("not_a_direct_edit", `Change Set ${e} is not a Direct Edit`);
1994
+ let n = t.chains[0]?.contentId ?? "", r = U(n);
1995
+ if (t.state !== "open" || r.editingBlock?.changeSetId !== e) throw new v("no_editing_block", `Change Set ${e} holds no Editing Block`);
1996
+ let i = z(R.find((e) => e.blueprintAccessor === Fe(r))).forceGroup;
1997
+ if (!Ie(i)) throw new ne(`forcing the Editing Block of Content ${n} needs the Force Group`);
1998
+ let a = T.find((e) => e.kind === "direct_edit" && e.state === "open" && e.editorId === x && e.chains[0]?.contentId === n);
1999
+ if (a) throw new v("own_direct_edit", `you have a Direct Edit of Content ${n}, ${a.id}`, n);
2000
+ let o = t.editorId ?? "";
2001
+ t.editorId = x, r.editingBlock = {
2002
+ editorId: x,
2003
+ changeSetId: e,
2004
+ blockTime: b()
2005
+ };
2006
+ let [s] = xt(r, {
2007
+ kind: "change_set",
2008
+ changeSetId: e
2009
+ }, "");
2010
+ return {
2011
+ changeSet: A(t),
2012
+ content: s,
2013
+ previousEditorId: o
2014
+ };
2015
+ });
2016
+ },
1560
2017
  async startEditing({ contentId: e, changeSetId: t, effectiveOn: n = "", changeSetName: r = "" }) {
1561
2018
  let i = U(e);
1562
- if (!i.main) throw new a(`Content ${e} is not published`);
1563
- if (J(i), G(i) && !h.test(n)) throw new a("effective_on is required for Dated Content, as YYYY-MM-DD");
1564
- if (!G(i) && n !== "") throw new a("effective_on is refused for undated Content");
1565
- let o;
2019
+ if (!i.main) throw new _(`Content ${e} is not published`);
2020
+ if (J(i), G(i) && !g.test(n)) throw new _("effective_on is required for Dated Content, as YYYY-MM-DD");
2021
+ if (!G(i) && n !== "") throw new _("effective_on is refused for undated Content");
2022
+ let a;
1566
2023
  if (t) {
1567
- if (o = Z(t), o.chains.some((t) => t.contentId === e)) throw new a(`Content ${e} already has a Chain in this Change Set`);
2024
+ if (a = Z(t), a.kind === "direct_edit") throw new v("one_branch", `Change Set ${t} is a Direct Edit`);
2025
+ if (a.chains.some((t) => t.contentId === e)) throw new _(`Content ${e} already has a Chain in this Change Set`);
1568
2026
  } else {
1569
2027
  let t = Object.values(i.main.data).filter((e) => typeof e == "string").slice(0, 2).join(" ");
1570
- o = {
2028
+ a = {
1571
2029
  id: `cs_stub_${H++}`,
1572
2030
  name: r.trim() ? O(r, "change_set_name", 200) : t || e,
1573
2031
  state: "open",
1574
- createdBy: b,
1575
- createTime: y(),
2032
+ createdBy: x,
2033
+ createTime: b(),
1576
2034
  chains: [],
1577
2035
  dependsOnChangeSetIds: [],
1578
2036
  status: "",
1579
2037
  assigneeIds: [],
1580
2038
  plannedReleases: []
1581
- }, w.unshift(o);
2039
+ }, T.unshift(a);
1582
2040
  }
1583
- let s = H++, c = `br_stub_${s}`, l = {
2041
+ let o = H++, s = `br_stub_${o}`, c = {
1584
2042
  ...structuredClone(i.main),
1585
- branchId: c
2043
+ branchId: s
1586
2044
  };
1587
- i.branches[o.id] = l, o.chains.push({
1588
- id: `chain_stub_${s}`,
2045
+ i.branches[a.id] = c, a.chains.push({
2046
+ id: `chain_stub_${o}`,
1589
2047
  contentId: e,
1590
2048
  born: !1,
1591
2049
  branches: [{
1592
- id: c,
2050
+ id: s,
1593
2051
  position: 0,
1594
2052
  kind: "editorial",
1595
- headRevisionId: l.revisionId
2053
+ headRevisionId: c.revisionId
1596
2054
  }]
1597
2055
  });
1598
- let [u] = $(i, {
2056
+ let [l] = xt(i, {
1599
2057
  kind: "change_set",
1600
- changeSetId: o.id
2058
+ changeSetId: a.id
1601
2059
  }, "");
1602
2060
  return {
1603
- changeSet: A(o),
1604
- content: u
2061
+ changeSet: A(a),
2062
+ content: l
1605
2063
  };
1606
2064
  },
1607
2065
  async previewChain({ changeSetId: e, contentId: t, effectiveOn: n, validityPeriod: r }) {
1608
2066
  Z(e);
1609
2067
  let i = U(t);
1610
- if (!i.main) throw new a(`Content ${t} is not published`);
1611
- if (!G(i)) throw new a("undated Content's Chain takes no date");
1612
- if (!h.test(n)) throw new a("effective_on is YYYY-MM-DD");
1613
- let o = i.timeline ?? [], s = o.find((e) => e.validityPeriod && e.validityPeriod.firstDay <= n && (e.validityPeriod.lastDay === "" || n <= e.validityPeriod.lastDay));
2068
+ if (!i.main) throw new _(`Content ${t} is not published`);
2069
+ if (!G(i)) throw new _("undated Content's Chain takes no date");
2070
+ if (!g.test(n)) throw new _("effective_on is YYYY-MM-DD");
2071
+ let a = i.timeline ?? [], o = a.find((e) => e.validityPeriod && e.validityPeriod.firstDay <= n && (e.validityPeriod.lastDay === "" || n <= e.validityPeriod.lastDay));
1614
2072
  return {
1615
- forkReleaseId: s?.releaseId ?? "",
1616
- carryForwardReleaseIds: o.filter((e) => e.validityPeriod && e.validityPeriod.firstDay > n).map((e) => e.releaseId),
2073
+ forkReleaseId: o?.releaseId ?? "",
2074
+ carryForwardReleaseIds: a.filter((e) => e.validityPeriod && e.validityPeriod.firstDay > n).map((e) => e.releaseId),
1617
2075
  mergesMain: !1,
1618
- cutIntoReleaseIds: s ? [s.releaseId] : [],
1619
- coveredReleaseIds: r && r.lastDay !== "" ? o.filter((e) => e.validityPeriod && e.validityPeriod.lastDay !== "" && r.firstDay <= e.validityPeriod.firstDay && e.validityPeriod.lastDay <= r.lastDay).map((e) => e.releaseId) : []
2076
+ cutIntoReleaseIds: o ? [o.releaseId] : [],
2077
+ coveredReleaseIds: r && r.lastDay !== "" ? a.filter((e) => e.validityPeriod && e.validityPeriod.lastDay !== "" && r.firstDay <= e.validityPeriod.firstDay && e.validityPeriod.lastDay <= r.lastDay).map((e) => e.releaseId) : []
1620
2078
  };
1621
2079
  },
1622
2080
  async planRepeal({ changeSetId: e, contentId: t, lastDay: n }) {
1623
2081
  Z(e);
1624
2082
  let r = U(t);
1625
- if (J(r), !G(r)) throw new a("a Repeal is for Dated Content");
1626
- if (!h.test(n)) throw new a("last_day is YYYY-MM-DD");
1627
- return rt(r, e, {
2083
+ if (J(r), !G(r)) throw new _("a Repeal is for Dated Content");
2084
+ if (!g.test(n)) throw new _("last_day is YYYY-MM-DD");
2085
+ return bt(r, e, {
1628
2086
  kind: "repeal",
1629
2087
  validityPeriod: {
1630
- firstDay: ee(r.timeline ?? [], n)?.validityPeriod?.firstDay ?? n,
2088
+ firstDay: te(r.timeline ?? [], n)?.validityPeriod?.firstDay ?? n,
1631
2089
  lastDay: n
1632
2090
  }
1633
2091
  });
@@ -1635,71 +2093,71 @@ function M(v = {}) {
1635
2093
  async planWithdrawal({ changeSetId: e, contentId: t }) {
1636
2094
  Z(e);
1637
2095
  let n = U(t);
1638
- if (J(n), G(n)) throw new a("a Withdrawal is for undated Content");
1639
- return rt(n, e, { kind: "withdrawal" });
2096
+ if (J(n), G(n)) throw new _("a Withdrawal is for undated Content");
2097
+ return bt(n, e, { kind: "withdrawal" });
1640
2098
  },
1641
2099
  async planRelease({ idempotencyKey: e, ...t }) {
1642
2100
  return V(e, ["planRelease", t], async () => {
1643
- let { changeSetId: e, branchId: n, validityPeriod: r, releaseSpec: i, supersedesReleaseIds: o } = t, { cs: s, chain: c, branch: l, c: u } = Ge(e, n);
1644
- if (J(u), l.kind !== "editorial") throw new a("only an editorial Branch's head is released");
1645
- if (s.plannedReleases.some((e) => e.branchId === n)) throw new a(`Branch ${n} is planned already`);
1646
- let d = {
2101
+ let { changeSetId: e, branchId: n, validityPeriod: r, releaseSpec: i, supersedesReleaseIds: a } = t, { cs: o, chain: s, branch: c, c: l } = at(e, n);
2102
+ if (J(l), c.kind !== "editorial") throw new _("only an editorial Branch's head is released");
2103
+ if (o.plannedReleases.some((e) => e.branchId === n)) throw new _(`Branch ${n} is planned already`);
2104
+ let u = {
1647
2105
  id: `rls_stub_${H++}`,
1648
- contentId: c.contentId,
2106
+ contentId: s.contentId,
1649
2107
  kind: "revision",
1650
2108
  branchId: n,
1651
2109
  revisionId: "",
1652
2110
  validityPeriod: r ? { ...r } : void 0,
1653
2111
  releaseSpec: structuredClone(i ?? {}),
1654
- supersedesReleaseIds: [...o ?? []],
2112
+ supersedesReleaseIds: [...a ?? []],
1655
2113
  proposed: !1,
1656
2114
  proposedForReleaseId: "",
1657
2115
  splitFromReleaseId: "",
1658
2116
  withheld: !1
1659
2117
  };
1660
- return Je(u, d), s.plannedReleases.push(d), Ye(s, u), structuredClone(d);
2118
+ return ct(l, u), o.plannedReleases.push(u), lt(o, l), structuredClone(u);
1661
2119
  });
1662
2120
  },
1663
2121
  async updatePlannedRelease({ idempotencyKey: e, ...t }) {
1664
2122
  return V(e, ["updatePlannedRelease", t], async () => {
1665
- let { changeSetId: e, plannedReleaseId: n, validityPeriod: r, releaseSpec: i, supersedesReleaseIds: o } = t, s = Z(e), c = s.plannedReleases.findIndex((e) => e.id === n);
1666
- if (c < 0) throw k("Planned Release", n);
1667
- let l = s.plannedReleases[c];
1668
- if (l.proposed) throw new a("a proposal is derived from the plans and can't be set");
1669
- let u = U(l.contentId);
1670
- J(u);
1671
- let d = {
1672
- ...structuredClone(l),
2123
+ let { changeSetId: e, plannedReleaseId: n, validityPeriod: r, releaseSpec: i, supersedesReleaseIds: a } = t, o = Z(e), s = o.plannedReleases.findIndex((e) => e.id === n);
2124
+ if (s < 0) throw k("Planned Release", n);
2125
+ let c = o.plannedReleases[s];
2126
+ if (c.proposed) throw new _("a proposal is derived from the plans and can't be set");
2127
+ let l = U(c.contentId);
2128
+ J(l);
2129
+ let u = {
2130
+ ...structuredClone(c),
1673
2131
  ...r ? { validityPeriod: { ...r } } : {},
1674
2132
  ...i ? { releaseSpec: structuredClone(i) } : {},
1675
- ...o ? { supersedesReleaseIds: [...o] } : {}
2133
+ ...a ? { supersedesReleaseIds: [...a] } : {}
1676
2134
  };
1677
- return Je(u, d), s.plannedReleases[c] = d, Ye(s, u), structuredClone(d);
2135
+ return ct(l, u), o.plannedReleases[s] = u, lt(o, l), structuredClone(u);
1678
2136
  });
1679
2137
  },
1680
2138
  async appendBranch({ idempotencyKey: e, ...t }) {
1681
2139
  return V(e, ["appendBranch", t], async () => {
1682
- let { changeSetId: e, chainId: n, effectiveOn: r } = t, i = Z(e), o = i.chains.find((e) => e.id === n);
1683
- if (!o) throw k("Chain", n);
1684
- let s = U(o.contentId);
1685
- if (o.born || !G(s)) throw new a("only a Chain on published Dated Content takes dates");
1686
- let c = o.branches.filter((e) => e.kind === "editorial").at(-1);
1687
- if (!h.test(r) || c?.effectiveOn && r <= c.effectiveOn) throw new a("effective_on is a day after the Chain's last editorial Branch's");
1688
- let l = o.branches.at(-1), u = `br_stub_${H++}`;
1689
- o.branches.push({
1690
- id: u,
1691
- position: o.branches.length,
2140
+ let { changeSetId: e, chainId: n, effectiveOn: r } = t, i = Z(e), a = i.chains.find((e) => e.id === n);
2141
+ if (!a) throw k("Chain", n);
2142
+ let o = U(a.contentId);
2143
+ if (a.born || !G(o)) throw new _("only a Chain on published Dated Content takes dates");
2144
+ let s = a.branches.filter((e) => e.kind === "editorial").at(-1);
2145
+ if (!g.test(r) || s?.effectiveOn && r <= s.effectiveOn) throw new _("effective_on is a day after the Chain's last editorial Branch's");
2146
+ let c = a.branches.at(-1), l = `br_stub_${H++}`;
2147
+ a.branches.push({
2148
+ id: l,
2149
+ position: a.branches.length,
1692
2150
  kind: "editorial",
1693
- headRevisionId: l?.headRevisionId ?? "",
2151
+ headRevisionId: c?.headRevisionId ?? "",
1694
2152
  effectiveOn: r
1695
2153
  });
1696
- let d = s.branches[e];
1697
- return d && (s.branches[e] = {
1698
- ...d,
1699
- branchId: u
2154
+ let u = o.branches[e];
2155
+ return u && (o.branches[e] = {
2156
+ ...u,
2157
+ branchId: l
1700
2158
  }), {
1701
2159
  changeSet: A(i),
1702
- branchId: u
2160
+ branchId: l
1703
2161
  };
1704
2162
  });
1705
2163
  },
@@ -1707,8 +2165,8 @@ function M(v = {}) {
1707
2165
  return V(e, ["dropChain", t], async () => {
1708
2166
  let { changeSetId: e, chainId: n } = t, r = Z(e), i = r.chains.find((e) => e.id === n);
1709
2167
  if (!i) throw k("Chain", n);
1710
- if (i.born) throw new a("the Chain of Content born in the Change Set can't be dropped: discard the Change Set");
1711
- for (let e of i.branches) qe(e.id);
2168
+ if (i.born) throw new _("the Chain of Content born in the Change Set can't be dropped: discard the Change Set");
2169
+ for (let e of i.branches) st(e.id);
1712
2170
  return r.chains = r.chains.filter((e) => e.id !== n), r.plannedReleases = r.plannedReleases.filter((e) => e.contentId !== i.contentId), delete U(i.contentId).branches[e], A(r);
1713
2171
  });
1714
2172
  },
@@ -1716,43 +2174,43 @@ function M(v = {}) {
1716
2174
  let t = B.get(e);
1717
2175
  return t ? structuredClone(t) : null;
1718
2176
  },
1719
- async resolveMerge({ idempotencyKey: t, ...n }) {
1720
- return V(t, ["resolveMerge", n], async () => {
1721
- let { changeSetId: t, branchId: r, expectedHeadId: i, resolutions: o } = n, { chain: s, branch: c, c: l } = Ge(t, r), u = B.get(r);
1722
- if (!u) throw new a(`Branch ${r} has no Pending Merge`);
1723
- if (c.headRevisionId !== i) throw new e({
1724
- contentId: l.id,
1725
- branchId: r,
1726
- expectedHeadId: i,
1727
- currentHeadId: c.headRevisionId
2177
+ async resolveMerge({ idempotencyKey: e, ...t }) {
2178
+ return V(e, ["resolveMerge", t], async () => {
2179
+ let { changeSetId: e, branchId: n, expectedHeadId: r, resolutions: a } = t, { chain: o, branch: s, c } = at(e, n), l = B.get(n);
2180
+ if (!l) throw new _(`Branch ${n} has no Pending Merge`);
2181
+ if (s.headRevisionId !== r) throw new i({
2182
+ contentId: c.id,
2183
+ branchId: n,
2184
+ expectedHeadId: r,
2185
+ currentHeadId: s.headRevisionId
1728
2186
  });
1729
- let d = o.map((e) => e.path), f = u.fields.map((e) => e.path);
1730
- if (new Set(d).size !== d.length || d.some((e) => !f.includes(e)) || f.some((e) => !d.includes(e))) throw new a("decide every field the Pending Merge lists, once");
1731
- let p = structuredClone(u.merged);
1732
- for (let e of o) {
1733
- let t = u.fields.find((t) => t.path === e.path), n = "side" in e ? e.side === "ours" ? t.ours : t.theirs : e.value, r = e.path.replace(/^\//, "");
1734
- n === void 0 ? delete p[r] : p[r] = structuredClone(n);
2187
+ let u = a.map((e) => e.path), d = l.fields.map((e) => e.path);
2188
+ if (new Set(u).size !== u.length || u.some((e) => !d.includes(e)) || d.some((e) => !u.includes(e))) throw new _("decide every field the Pending Merge lists, once");
2189
+ let f = structuredClone(l.merged);
2190
+ for (let e of a) {
2191
+ let t = l.fields.find((t) => t.path === e.path), n = "side" in e ? e.side === "ours" ? t.ours : t.theirs : e.value, r = e.path.replace(/^\//, "");
2192
+ n === void 0 ? delete f[r] : f[r] = structuredClone(n);
1735
2193
  }
1736
- let m = We({
1737
- changeSetId: t,
1738
- chain: s,
1739
- branch: c,
1740
- c: l,
1741
- data: p,
2194
+ let p = it({
2195
+ changeSetId: e,
2196
+ chain: o,
2197
+ branch: s,
2198
+ c,
2199
+ data: f,
1742
2200
  cause: "resolve",
1743
- secondParentId: u.theirsRevisionId
2201
+ secondParentId: l.theirsRevisionId
1744
2202
  });
1745
- return qe(r), m;
2203
+ return st(n), We.delete(n), p;
1746
2204
  });
1747
2205
  },
1748
2206
  async abortMerge({ idempotencyKey: e, ...t }) {
1749
2207
  return V(e, ["abortMerge", t], async () => {
1750
- if (Ge(t.changeSetId, t.branchId), !B.has(t.branchId)) throw new a(`Branch ${t.branchId} has no Pending Merge`);
1751
- qe(t.branchId);
2208
+ if (at(t.changeSetId, t.branchId), !B.has(t.branchId)) throw new _(`Branch ${t.branchId} has no Pending Merge`);
2209
+ st(t.branchId);
1752
2210
  });
1753
2211
  },
1754
2212
  async previewInForce({ contentId: e, changeSetId: t, validOn: n }) {
1755
- let r = Z(t), i = U(e), a = n || Pe(), o = r.chains.find((t) => t.contentId === e), s = (e) => !e.validityPeriod || e.validityPeriod.firstDay <= a && (e.validityPeriod.lastDay === "" || a <= e.validityPeriod.lastDay), c = r.plannedReleases.find((t) => t.contentId === e && t.kind !== "repeal" && s(t));
2213
+ let r = Z(t), i = U(e), a = n || Je(), o = r.chains.find((t) => t.contentId === e), s = (e) => !e.validityPeriod || e.validityPeriod.firstDay <= a && (e.validityPeriod.lastDay === "" || a <= e.validityPeriod.lastDay), c = r.plannedReleases.find((t) => t.contentId === e && t.kind !== "repeal" && s(t));
1756
2214
  if (c) {
1757
2215
  let e = c.branchId ? o?.branches.find((e) => e.id === c.branchId)?.headRevisionId ?? "" : c.revisionId;
1758
2216
  return {
@@ -1764,7 +2222,7 @@ function M(v = {}) {
1764
2222
  data: structuredClone(q(i, e) ?? {})
1765
2223
  };
1766
2224
  }
1767
- let l = ee(i.timeline ?? [], a);
2225
+ let l = te(i.timeline ?? [], a);
1768
2226
  return l ? {
1769
2227
  releaseId: l.releaseId,
1770
2228
  revisionId: l.revisionId,
@@ -1775,7 +2233,8 @@ function M(v = {}) {
1775
2233
  } : null;
1776
2234
  }
1777
2235
  };
1778
- function rt(e, t, n) {
2236
+ return $;
2237
+ function bt(e, t, n) {
1779
2238
  let r = {
1780
2239
  id: `rls_stub_${H++}`,
1781
2240
  contentId: e.id,
@@ -1793,10 +2252,10 @@ function M(v = {}) {
1793
2252
  plannedRelease: r
1794
2253
  }], structuredClone({
1795
2254
  plannedRelease: r,
1796
- gapReferrers: Ie(e.id)
2255
+ gapReferrers: Xe(e.id)
1797
2256
  });
1798
2257
  }
1799
- function $(e, t, n) {
2258
+ function xt(e, t, n) {
1800
2259
  let r = (t, n) => ({
1801
2260
  id: e.id,
1802
2261
  blueprintId: e.blueprintId,
@@ -1811,33 +2270,33 @@ function M(v = {}) {
1811
2270
  if (t.kind === "in_force") return e.inForce ? [r(e.inForce, { releaseId: e.inForce.releaseId })] : [];
1812
2271
  if (t.kind === "change_set") {
1813
2272
  let i = e.branches[t.changeSetId];
1814
- return !i || n && !N(i.data, n) ? [] : [r(i, {
2273
+ return !i || n && !De(i.data, n) ? [] : [r(i, {
1815
2274
  changeSetId: t.changeSetId,
1816
2275
  branchId: i.branchId
1817
2276
  })];
1818
2277
  }
1819
2278
  if (!n) return e.main ? [r(e.main, {})] : [];
1820
2279
  let i = [];
1821
- e.main && N(e.main.data, n) && i.push(r(e.main, {}));
1822
- for (let [t, a] of Object.entries(e.branches).sort(([, e], [, t]) => e.branchId < t.branchId ? -1 : 1)) w.find((e) => e.id === t)?.state === "open" && N(a.data, n) && i.push(r(a, {
2280
+ e.main && De(e.main.data, n) && i.push(r(e.main, {}));
2281
+ for (let [t, a] of Object.entries(e.branches).sort(([, e], [, t]) => e.branchId < t.branchId ? -1 : 1)) T.find((e) => e.id === t)?.state === "open" && De(a.data, n) && i.push(r(a, {
1823
2282
  changeSetId: t,
1824
2283
  branchId: a.branchId
1825
2284
  }));
1826
2285
  return i;
1827
2286
  }
1828
2287
  }
1829
- function N(e, t) {
2288
+ function De(e, t) {
1830
2289
  let n = (e) => e.toLocaleLowerCase().replace(/\s+/g, " "), r = n(t);
1831
2290
  return Object.values(e).some((e) => typeof e == "string" && n(e).includes(r));
1832
2291
  }
1833
2292
  //#endregion
1834
2293
  //#region src/testing/stub-status-source.ts
1835
- function P(e = E()) {
2294
+ function N(e = ce()) {
1836
2295
  return { async listChangeSetStatuses() {
1837
2296
  return e.map((e) => ({ ...e }));
1838
2297
  } };
1839
2298
  }
1840
2299
  //#endregion
1841
- export { w as STUB_NOW, C as STUB_OTHER_USER_ID, S as STUB_USER_ID, x as STUB_WORKSPACE_ID, he as createStubBlueprintSource, M as createStubContenthubClient, P as createStubStatusSource, oe as stubBlockReasons, j as stubBlocker, fe as stubBlueprintReleases, de as stubBlueprints, E as stubChangeSetStatuses, ce as stubChangeSets, ue as stubCollections, me as stubContents, T as stubIdentity, D as stubRepealedContent, le as stubRequiredChecks, pe as stubResolvedReleases, se as stubStatusTransitions };
2300
+ export { T as STUB_NOW, w as STUB_OTHER_USER_ID, C as STUB_USER_ID, S as STUB_WORKSPACE_ID, ve as createStubBlueprintSource, M as createStubContenthubClient, N as createStubStatusSource, se as stubBlockReasons, j as stubBlocker, me as stubBlueprintReleases, pe as stubBlueprints, ce as stubChangeSetStatuses, ue as stubChangeSets, fe as stubCollections, _e as stubContents, E as stubIdentity, ge as stubRepealedContent, de as stubRequiredChecks, he as stubResolvedReleases, le as stubStatusTransitions, D as stubUndatedContent };
1842
2301
 
1843
2302
  //# sourceMappingURL=testing.js.map