@cardenelabs/dragon 0.39.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +39 -1
  2. package/dist/cli.cjs +1921 -429
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/cli.js +1926 -434
  5. package/dist/cli.js.map +1 -1
  6. package/dist/export.cjs +1718 -353
  7. package/dist/export.cjs.map +1 -1
  8. package/dist/export.d.cts +1 -1
  9. package/dist/export.d.ts +1 -1
  10. package/dist/export.js +1723 -358
  11. package/dist/export.js.map +1 -1
  12. package/dist/index.cjs +1835 -342
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +5 -15
  15. package/dist/index.d.ts +5 -15
  16. package/dist/index.js +1836 -342
  17. package/dist/index.js.map +1 -1
  18. package/dist/{ink-Cg-v6XSG.d.cts → ink-B_7OXxtb.d.cts} +27 -2
  19. package/dist/{ink-Cg-v6XSG.d.ts → ink-B_7OXxtb.d.ts} +27 -2
  20. package/dist/node.cjs +2946 -0
  21. package/dist/node.cjs.map +1 -0
  22. package/dist/node.d.cts +9 -0
  23. package/dist/node.d.ts +9 -0
  24. package/dist/node.js +2944 -0
  25. package/dist/node.js.map +1 -0
  26. package/dist/player.global.js +2 -2
  27. package/package.json +11 -1
  28. package/src/field-messages.ts +8 -0
  29. package/src/index.ts +5 -2
  30. package/src/layout/git.ts +728 -0
  31. package/src/look/values.ts +40 -1
  32. package/src/messages.ts +47 -4
  33. package/src/node.ts +23 -0
  34. package/src/parser.ts +142 -7
  35. package/src/printer.ts +16 -4
  36. package/src/render/git.ts +161 -0
  37. package/src/render/parts.ts +1 -1
  38. package/src/render/svg.ts +26 -1
  39. package/src/schema.ts +47 -13
  40. package/src/schemas/diagram.schema.json +75 -8
  41. package/src/schemas/validate-diagram.js +1 -1
  42. package/src/timeline.ts +18 -3
  43. package/src/version.ts +1 -20
  44. package/src/words.ts +19 -3
package/dist/export.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { mkdirSync, writeFileSync, rmSync, readFileSync } from 'fs';
2
- import { join, dirname } from 'path';
2
+ import { join as join$1, dirname } from 'path';
3
3
  import { createRequire } from 'module';
4
4
  import { readFile } from 'fs/promises';
5
5
 
@@ -264,7 +264,11 @@ var TYPE = {
264
264
  stepTitle: text(15, 700),
265
265
  stepBody: text(13.5, 500),
266
266
  stepNo: text(13, 700, "mono"),
267
- button: text(14, 700)
267
+ button: text(14, 700),
268
+ /** 枝分かれの図 (#3164) の、丸の中の commit の名札と、丸の外に添える hash と一言 */
269
+ gitId: text(11, 700),
270
+ gitHash: text(10.5, 600, "mono"),
271
+ gitNote: text(10.5, 650)
268
272
  };
269
273
  var LOOK = {
270
274
  /** 部品どうしの最小の隙間 */
@@ -308,6 +312,41 @@ var LOOK = {
308
312
  done: { r: 6.5, inset: 13 },
309
313
  pastLabel: 0.85
310
314
  },
315
+ /**
316
+ * 枝分かれの図 (#3164)。見本帳の試作 (`scenes/git.js`) の寸法を写す。
317
+ * commit は列ごとに `pitch` ずつ右へ並べ、一番上でない帯の commit は列の半分だけ右へずらす。`x0` は最初の列の真ん中の x の下限、
318
+ * `textGap` は隣の列の hash と一言の間に空ける最小の隙間。`r` は丸の半径、`orphan` はどの札からも辿れなくなった commit の点線の丸の半径。
319
+ * `topLine` と `line` は帯の上端から丸を並べる線まで (一番上の帯と、それより下の帯)、`topBelow` と `below` は線から帯の下端まで。
320
+ * `bare` は線の名前を下に置かない帯の、線から帯の下端まで。
321
+ * hash と一言は一番上の帯では丸の上に、ほかの帯では丸の下に置き、`above` と `under` は丸の真ん中から丸に近い行の基準線まで、`lineStep` は行の間。
322
+ * 札は丸の上に段を重ねて置き、`tagTop` と `tag` は丸の真ん中から 1 段目の札の真ん中まで (一番上の帯と、ほかの帯)、`row` は札の段の間。
323
+ * 札の段が 2 段より多い commit がある帯は、多い段の分だけ線を下げる。
324
+ * `turn` は枝へ分かれる線と枝から入る線が曲がり終えて横へ進むまでの長さ、`samples` は曲がりを区切る点の数、`boxGap` は commit の並びと箱の間。
325
+ * `labelUnder` はほかの帯で、丸の真ん中から線の名前の札の上端まで。`colors` は帯の色を上から配る順
326
+ */
327
+ git: {
328
+ x0: 120,
329
+ pitch: 90,
330
+ textGap: 12,
331
+ r: 12,
332
+ orphan: 13.5,
333
+ topLine: 120,
334
+ line: 90,
335
+ topBelow: 30,
336
+ below: 82,
337
+ bare: 62,
338
+ above: 18,
339
+ under: 27,
340
+ lineStep: 13,
341
+ tagTop: 58,
342
+ tag: 30,
343
+ row: 22,
344
+ turn: 60,
345
+ samples: 12,
346
+ boxGap: 24,
347
+ labelUnder: 50,
348
+ colors: ["blue", "violet", "green", "amber", "rose"]
349
+ },
311
350
  /** `bend` は線の曲がりを丸める半径 (#3171) */
312
351
  edge: { inset: 3, arrow: 6, arrowHalf: 3.5, parallel: 5, ghostDash: 5, flowDash: 9, bend: 12 },
313
352
  /** `touch` は線の名前と、同じ時刻に見えている段の番号の丸の間に空ける最小の隙間 (#3175) */
@@ -326,7 +365,7 @@ var LOOK = {
326
365
  * `trail` は状態遷移図の帯の最後の、通った状態の点 (#3171)。`r` は点の半径、`step` は点の中心どうしの間、`now` は変わった値の欄の名前の横の点の半径と、名前からの離れ
327
366
  */
328
367
  strip: { h: 72, line: 44, pad: 12, icon: 24, titleX: 44, fieldGap: 22, sepInset: 14, tagGap: 6, tagH: 15, tagPadX: 7, nameY: 22, valueY: 43, trail: { r: 5.4, step: 16 }, now: { r: 3, gap: 7 } },
329
- stroke: { slot: 1.2, hair: 1, edge: 1.7, edgeOn: 2.25, arrow: 1.5, flow: 1.3, halo: 7, on: 1.75, glyph: 2, lifeline: 1.2, envelope: 1.5, badgeRing: 1.5, path: 1.6, end: 1.6, done: 1.2, trail: 1.2 },
368
+ stroke: { git: 2.25, gitOrphan: 1.5, slot: 1.2, hair: 1, edge: 1.7, edgeOn: 2.25, arrow: 1.5, flow: 1.3, halo: 7, on: 1.75, glyph: 2, lifeline: 1.2, envelope: 1.5, badgeRing: 1.5, path: 1.6, end: 1.6, done: 1.2, trail: 1.2 },
330
369
  shadow: { near: 0.8, far: 4, nearY: 1, farY: 3 },
331
370
  mini: { w: 168, pad: 8, title: 14, inset: 12, radius: 10 },
332
371
  /**
@@ -941,7 +980,7 @@ function arrange(diagram, groups, slots, rooms) {
941
980
  const headerW = Math.max(0, ...headers.map((h) => h ? h.w + R.inset * 2 : 0));
942
981
  const colLeft = [];
943
982
  for (let c = 0; c < columnCount; c++) colLeft.push(c === 0 ? margin + (headerW > 0 ? headerW : R.pad) : colLeft[c - 1] + colW[c - 1] + between[c - 1]);
944
- const center = (c) => colLeft[c] + colW[c] / 2;
983
+ const center2 = (c) => colLeft[c] + colW[c] / 2;
945
984
  const looped = new Set(edges.filter(({ edge: edge2 }) => edge2.from === edge2.to).map(({ edge: edge2 }) => edge2.from));
946
985
  const loopRows = new Set([...looped].flatMap((id) => {
947
986
  const slot = slots.get(id);
@@ -961,7 +1000,7 @@ function arrange(diagram, groups, slots, rooms) {
961
1000
  const slot = slots.get(id);
962
1001
  const source = diagram.boxes.find((b) => b.id === id);
963
1002
  const w = widths.get(id) ?? B.minW;
964
- const cx = center(slot.col);
1003
+ const cx = center2(slot.col);
965
1004
  const y = top + rowTop[slot.row];
966
1005
  boxes.push({
967
1006
  id,
@@ -1184,6 +1223,494 @@ function grow(layout, groups, slots, rooms) {
1184
1223
  }
1185
1224
  return grown;
1186
1225
  }
1226
+ var STATE_ENDS = ["start", "finish"];
1227
+ var HEAD = "HEAD";
1228
+
1229
+ // src/layout/git.ts
1230
+ var isGitLayout = (layout) => layout.kind === "git";
1231
+ function walk(diagram) {
1232
+ const branches = (diagram.git?.branches ?? []).map((b) => b.id);
1233
+ const lane = (id) => {
1234
+ if (!branches.includes(id)) branches.push(id);
1235
+ };
1236
+ for (const step of diagram.steps) for (const e of step.events) if (e.type === "commit" || e.type === "branch") lane(e.branch);
1237
+ const tips = new Map(branches.map((b) => [b, null]));
1238
+ let headAt = null;
1239
+ let attached = null;
1240
+ const made = [];
1241
+ const byId = /* @__PURE__ */ new Map();
1242
+ const links = [];
1243
+ const moves = [];
1244
+ const tags = [];
1245
+ const rows = /* @__PURE__ */ new Map();
1246
+ const most = /* @__PURE__ */ new Map();
1247
+ const shown = /* @__PURE__ */ new Map();
1248
+ const names = [...branches, HEAD];
1249
+ const at2 = new Map(names.map((n) => [n, []]));
1250
+ const heads = [];
1251
+ const visible2 = (ref) => ref === HEAD ? attached === null ? headAt : null : tips.get(ref) ?? null;
1252
+ const freeRow = (commit2) => {
1253
+ const list = rows.get(commit2) ?? [];
1254
+ const free = list.indexOf(null);
1255
+ return free < 0 ? list.length : free;
1256
+ };
1257
+ const settle = (step, event, change, lineFor) => {
1258
+ const before = new Map(names.map((n) => [n, visible2(n)]));
1259
+ const headBefore = headAt;
1260
+ change();
1261
+ const changed = names.filter((n) => before.get(n) !== visible2(n));
1262
+ const leaving = changed.map((ref) => {
1263
+ const slot = shown.get(ref);
1264
+ if (slot) {
1265
+ rows.get(slot.commit)[slot.row] = null;
1266
+ shown.delete(ref);
1267
+ }
1268
+ return { ref, slot };
1269
+ });
1270
+ for (const { ref, slot } of leaving) {
1271
+ const from = slot ?? (ref === HEAD && headBefore !== null ? { commit: headBefore, row: freeRow(headBefore) } : void 0);
1272
+ const target = visible2(ref);
1273
+ let to;
1274
+ if (target !== null) {
1275
+ to = { commit: target, row: freeRow(target) };
1276
+ const list = rows.get(target) ?? [];
1277
+ list[to.row] = ref;
1278
+ rows.set(target, list);
1279
+ most.set(target, Math.max(most.get(target) ?? 0, list.filter((r) => r !== null).length));
1280
+ shown.set(ref, to);
1281
+ }
1282
+ moves.push({ ref, step, event, ...from ? { from } : {}, ...to ? { to } : {}, line: ref === lineFor });
1283
+ }
1284
+ };
1285
+ const prune = (step, event) => {
1286
+ const reach = /* @__PURE__ */ new Set();
1287
+ const stack = [...tips.values(), headAt].filter((c) => c !== null);
1288
+ while (stack.length > 0) {
1289
+ const id = stack.pop();
1290
+ if (reach.has(id)) continue;
1291
+ reach.add(id);
1292
+ stack.push(...byId.get(id)?.parents ?? []);
1293
+ }
1294
+ for (const c of made) if (!reach.has(c.id) && c.orphan === void 0) c.orphan = { step, event };
1295
+ };
1296
+ diagram.steps.forEach((step, s) => {
1297
+ step.events.forEach((e, k) => {
1298
+ if (e.type === "commit") commit(e, s, k);
1299
+ else if (e.type === "branch") {
1300
+ if (!byId.has(e.from)) return;
1301
+ if (laneOf(e.from) !== e.branch) links.push({ kind: "branch", from: e.from, to: e.branch, step: s, event: k });
1302
+ settle(s, k, () => {
1303
+ tips.set(e.branch, e.from);
1304
+ attached = e.branch;
1305
+ headAt = e.from;
1306
+ });
1307
+ } else if (e.type === "edge") {
1308
+ const ref = e.from;
1309
+ if (ref !== HEAD && !tips.has(ref) || !byId.has(e.to)) return;
1310
+ settle(
1311
+ s,
1312
+ k,
1313
+ () => {
1314
+ if (ref === HEAD) {
1315
+ attached = null;
1316
+ headAt = e.to;
1317
+ return;
1318
+ }
1319
+ tips.set(ref, e.to);
1320
+ if (attached === ref) headAt = e.to;
1321
+ else if (attached === null && headAt === e.to) attached = ref;
1322
+ },
1323
+ ref
1324
+ );
1325
+ } else return;
1326
+ prune(s, k);
1327
+ });
1328
+ for (const n of names) at2.get(n)?.push(n === HEAD ? headAt : tips.get(n) ?? null);
1329
+ heads.push(attached);
1330
+ for (const n of names) {
1331
+ const slot = shown.get(n);
1332
+ if (slot) tags.push({ ref: n, step: s, slot });
1333
+ }
1334
+ });
1335
+ function laneOf(id) {
1336
+ return byId.get(id)?.branch;
1337
+ }
1338
+ function commit(e, s, k) {
1339
+ if (byId.has(e.id)) return;
1340
+ const copy = e.copy !== void 0 && byId.has(e.copy) ? e.copy : void 0;
1341
+ const base = copy !== void 0 && attached === null && headAt !== null ? headAt : tips.get(e.branch) ?? null;
1342
+ const joined = e.merge !== void 0 && e.merge !== e.branch ? tips.get(e.merge) ?? void 0 : void 0;
1343
+ const parents = [...new Set([base, joined].filter((c2) => c2 !== null && c2 !== void 0))];
1344
+ const c = {
1345
+ id: e.id,
1346
+ branch: e.branch,
1347
+ parents,
1348
+ ...joined !== void 0 && joined !== base ? { joined } : {},
1349
+ ...copy !== void 0 ? { copy } : {},
1350
+ ...e.hash !== void 0 ? { hash: e.hash } : {},
1351
+ ...e.note !== void 0 ? { note: e.note } : {},
1352
+ step: s,
1353
+ event: k
1354
+ };
1355
+ made.push(c);
1356
+ byId.set(c.id, c);
1357
+ for (const p of parents) links.push({ kind: "parent", from: p, to: c.id, step: s, event: k });
1358
+ if (copy !== void 0) links.push({ kind: "copy", from: copy, to: c.id, step: s, event: k });
1359
+ const first = attached === null && headAt === null;
1360
+ settle(s, k, () => {
1361
+ if (copy === void 0) {
1362
+ tips.set(e.branch, c.id);
1363
+ if (attached === e.branch) headAt = c.id;
1364
+ } else if (attached === null) headAt = c.id;
1365
+ if (first) {
1366
+ attached = e.branch;
1367
+ headAt = c.id;
1368
+ }
1369
+ });
1370
+ }
1371
+ const refs = names.map((name) => ({ name, at: at2.get(name) ?? [], ...name === HEAD ? { attached: heads } : {} }));
1372
+ return { branches, made, links, moves, refs, tags, rows: most };
1373
+ }
1374
+ function cubic(p0, c1, c2, p3) {
1375
+ const n = LOOK.git.samples;
1376
+ return Array.from({ length: n }, (_, k) => {
1377
+ const t = (k + 1) / n;
1378
+ const u = 1 - t;
1379
+ const at2 = (i) => u * u * u * p0[i] + 3 * u * u * t * c1[i] + 3 * u * t * t * c2[i] + t * t * t * p3[i];
1380
+ return [at2(0), at2(1)];
1381
+ });
1382
+ }
1383
+ function elbow(from, to) {
1384
+ if (Math.abs(from[1] - to[1]) < 0.5) return [from, to];
1385
+ return from[1] > to[1] ? [from, [from[0], to[1]], to] : [from, [to[0], from[1]], to];
1386
+ }
1387
+ function fork(p, tx, ty) {
1388
+ const sign = ty > p.cy ? 1 : -1;
1389
+ const p0 = [p.cx, p.cy + sign * p.r];
1390
+ const turn = Math.max(0, Math.min(LOOK.git.turn, tx - p.cx));
1391
+ const p3 = [p.cx + turn, ty];
1392
+ const curve = cubic(p0, [p0[0], p0[1] + (ty - p0[1]) * 0.7], [p.cx + turn * 0.2, ty], p3);
1393
+ return [p0, ...curve, ...tx > p3[0] ? [[tx, ty]] : []];
1394
+ }
1395
+ function join(p, c) {
1396
+ const sign = c.cy < p.cy ? 1 : -1;
1397
+ const p0 = [p.cx + p.r, p.cy];
1398
+ const p3 = [c.cx, c.cy + sign * c.r];
1399
+ const turn = Math.max(0, Math.min(LOOK.git.turn, c.cx - p0[0]));
1400
+ const h = [c.cx - turn, p.cy];
1401
+ const curve = cubic(h, [c.cx - turn * 0.2, p.cy], [c.cx, p3[1] + (p.cy - p3[1]) * 0.7], p3);
1402
+ return [p0, ...h[0] > p0[0] ? [h] : [], ...curve];
1403
+ }
1404
+ function copyLine(p, c) {
1405
+ if (Math.abs(p.cy - c.cy) < 0.5) {
1406
+ const top = p.cy - p.r;
1407
+ const lift = LOOK.git.turn * 0.7;
1408
+ return [[p.cx, top], ...cubic([p.cx, top], [p.cx, top - lift], [c.cx, top - lift], [c.cx, top])];
1409
+ }
1410
+ const sign = c.cy < p.cy ? -1 : 1;
1411
+ const p0 = [p.cx, p.cy + sign * p.r];
1412
+ const p3 = [c.cx, c.cy - sign * c.r];
1413
+ const mid = (p3[1] - p0[1]) * 0.5;
1414
+ return [p0, ...cubic(p0, [p0[0], p0[1] + mid], [p3[0], p3[1] - mid], p3)];
1415
+ }
1416
+ function layoutGit(diagram) {
1417
+ const { margin, gap, box: B, region: R, git: G, carrier: C } = LOOK;
1418
+ const walked = walk(diagram);
1419
+ const notes = new Map((diagram.git?.branches ?? []).map((b) => [b.id, b.note]));
1420
+ const laneIndex = new Map(walked.branches.map((id, i) => [id, i]));
1421
+ const colorOf2 = (branch) => G.colors[(laneIndex.get(branch) ?? 0) % G.colors.length];
1422
+ const col = /* @__PURE__ */ new Map();
1423
+ const laneLast = /* @__PURE__ */ new Map();
1424
+ for (const c of walked.made) {
1425
+ const k = Math.max(0, ...c.parents.map((p) => (col.get(p) ?? -1) + 1), (laneLast.get(c.branch) ?? -1) + 1);
1426
+ col.set(c.id, k);
1427
+ laneLast.set(c.branch, k);
1428
+ }
1429
+ const linesOf = (c) => [
1430
+ ...c.hash !== void 0 ? [{ text: c.hash, style: TYPE.gitHash }] : [],
1431
+ ...c.note !== void 0 ? [{ text: c.note, style: TYPE.gitNote }] : []
1432
+ ];
1433
+ const textW = (c) => Math.max(0, ...linesOf(c).map((line) => textWidth(line.text, line.style)));
1434
+ const tagW = (ref) => textWidth(ref, hasWide(ref) ? TYPE.carrierJa : TYPE.carrier) + C.tagPadX * 2;
1435
+ const refWidth = Math.max(0, ...walked.refs.map((r) => tagW(r.name)));
1436
+ const pitch = Math.max(G.pitch, ...walked.made.map((c) => textW(c) + G.textGap), refWidth + G.textGap);
1437
+ const headers = walked.branches.map((id) => ({ w: Math.max(R.icon, textWidth(id, TYPE.regionName), textWidth(notes.get(id) ?? "", TYPE.regionNote)) }));
1438
+ const headerRight = margin + R.inset + Math.max(0, ...headers.map((h) => h.w));
1439
+ const firstHalf = Math.max(G.r, ...walked.made.filter((c) => col.get(c.id) === 0 && laneIndex.get(c.branch) === 0).map((c) => textW(c) / 2), refWidth / 2);
1440
+ const x0 = Math.max(G.x0, headerRight + gap + firstHalf);
1441
+ const named = new Set(
1442
+ walked.moves.flatMap((mv) => {
1443
+ const source = diagram.steps[mv.step]?.events[mv.event];
1444
+ return mv.line && mv.to && source?.type === "edge" && source.label !== void 0 ? [walked.made.find((c) => c.id === mv.to?.commit)?.branch ?? ""] : [];
1445
+ })
1446
+ );
1447
+ const extraRows = (branch) => Math.max(0, ...walked.made.filter((c) => c.branch === branch).map((c) => (walked.rows.get(c.id) ?? 0) - 2)) * G.row;
1448
+ const topText = walked.made.some((c) => laneIndex.get(c.branch) === 0 && linesOf(c).length > 0);
1449
+ const lanes = [];
1450
+ let y = margin;
1451
+ walked.branches.forEach((id, i) => {
1452
+ const top = i === 0;
1453
+ const tagBase = top && topText ? G.tagTop : G.tag;
1454
+ const line = y + (top ? G.topLine - (G.tagTop - tagBase) : G.line) + extraRows(id);
1455
+ const h = line - y + (top ? G.topBelow : named.has(id) ? G.below : G.bare);
1456
+ lanes.push({ id, x: margin, y, w: 0, h, line, color: colorOf2(id), tagBase });
1457
+ y += h + R.gap;
1458
+ });
1459
+ const lanesBottom = y - R.gap;
1460
+ const laneOf = new Map(lanes.map((l) => [l.id, l]));
1461
+ const commits = walked.made.map((c) => {
1462
+ const lane = laneOf.get(c.branch);
1463
+ const isTop = laneIndex.get(c.branch) === 0;
1464
+ const cx = x0 + pitch * (col.get(c.id) ?? 0) + (isTop ? 0 : pitch / 2);
1465
+ const cy = lane.line;
1466
+ const lines = linesOf(c);
1467
+ const baselines = lines.map((_, k) => isTop ? cy - G.above - (lines.length - 1 - k) * G.lineStep : cy + G.under + k * G.lineStep);
1468
+ const boxes2 = lines.map((line, k) => textBox(line.text, cx, baselines[k], line.style, "middle"));
1469
+ const text2 = boxes2.length === 0 ? void 0 : { ...union(boxes2), lines: lines.map((line) => line.text), baselines };
1470
+ const color = c.copy !== void 0 ? colorOf2(walked.made.find((m) => m.id === c.copy)?.branch ?? c.branch) : colorOf2(c.branch);
1471
+ return {
1472
+ id: c.id,
1473
+ branch: c.branch,
1474
+ color,
1475
+ cx,
1476
+ cy,
1477
+ r: G.r,
1478
+ step: c.step,
1479
+ event: c.event,
1480
+ parents: c.parents,
1481
+ ...c.copy !== void 0 ? { copy: c.copy } : {},
1482
+ ...c.hash !== void 0 ? { hash: c.hash } : {},
1483
+ ...c.note !== void 0 ? { note: c.note } : {},
1484
+ ...text2 ? { text: text2 } : {},
1485
+ ...c.orphan ? { orphan: c.orphan.step, orphanEvent: c.orphan.event } : {}
1486
+ };
1487
+ });
1488
+ const placed = new Map(commits.map((c) => [c.id, c]));
1489
+ const links = walked.links.flatMap((l) => {
1490
+ const from = placed.get(l.from);
1491
+ if (!from) return [];
1492
+ if (l.kind === "branch") {
1493
+ if (!walked.made.some((c) => c.branch === l.to)) return [];
1494
+ const lane = laneOf.get(l.to);
1495
+ return [{ ...l, points: fork(from, from.cx + G.turn, lane.line), color: colorOf2(l.to) }];
1496
+ }
1497
+ const to = placed.get(l.to);
1498
+ const made = walked.made.find((m) => m.id === l.to);
1499
+ let points;
1500
+ if (l.kind === "copy") points = copyLine(from, to);
1501
+ else if (Math.abs(from.cy - to.cy) < 0.5) points = [[from.cx + from.r, from.cy], [to.cx - to.r, to.cy]];
1502
+ else if (made?.joined === l.from) points = join(from, to);
1503
+ else points = fork(from, to.cx - to.r, to.cy);
1504
+ return [{ ...l, points, color: to.color }];
1505
+ });
1506
+ const tagRect = (ref, slot) => {
1507
+ const c = placed.get(slot.commit);
1508
+ const base = laneOf.get(c.branch)?.tagBase ?? G.tag;
1509
+ const w = tagW(ref);
1510
+ return { x: c.cx - w / 2, y: c.cy - base - slot.row * G.row - C.tagH / 2, w, h: C.tagH };
1511
+ };
1512
+ const center2 = (r) => [r.x + r.w / 2, r.y + r.h / 2];
1513
+ const moves = walked.moves.map((m) => {
1514
+ const from = m.from ? tagRect(m.ref, m.from) : void 0;
1515
+ const to = m.to ? tagRect(m.ref, m.to) : void 0;
1516
+ const source = diagram.steps[m.step]?.events[m.event];
1517
+ const carried = m.line && source?.type === "edge" && source.carry.kind !== "none" && !(source.carry.kind === "tag" && source.carry.text === source.from);
1518
+ return {
1519
+ ref: m.ref,
1520
+ step: m.step,
1521
+ event: m.event,
1522
+ ...from ? { from } : {},
1523
+ ...to ? { to } : {},
1524
+ ...m.to ? { target: m.to.commit } : {},
1525
+ ...carried ? { carried: true } : {},
1526
+ ...m.line && from && to ? { line: elbow(center2(from), center2(to)) } : {},
1527
+ color: "slate"
1528
+ };
1529
+ });
1530
+ const tags = walked.tags.map((t) => ({ ...tagRect(t.ref, t.slot), ref: t.ref, step: t.step }));
1531
+ const colors = boxColors(diagram);
1532
+ const right = Math.max(
1533
+ x0,
1534
+ ...commits.flatMap((c) => [c.cx + c.r, ...c.text ? [c.text.x + c.text.w] : []]),
1535
+ ...tags.map((t) => t.x + t.w),
1536
+ ...moves.flatMap((m) => [m.from, m.to].flatMap((r) => r ? [r.x + r.w] : []))
1537
+ );
1538
+ const boxX = right + G.boxGap;
1539
+ const firstCy = (lanes[1] ?? lanes[0])?.line ?? margin + B.h / 2;
1540
+ const boxes = diagram.boxes.map((b, i) => {
1541
+ const w = boxWidth(diagram, b.id, true);
1542
+ const cy = firstCy + i * (B.h + gap);
1543
+ return {
1544
+ id: b.id,
1545
+ name: b.name,
1546
+ ...b.sub !== void 0 ? { sub: b.sub } : {},
1547
+ ...b.icon !== void 0 ? { icon: b.icon } : {},
1548
+ color: colors.get(b.id) ?? "slate",
1549
+ x: boxX,
1550
+ y: cy - B.h / 2,
1551
+ w,
1552
+ h: B.h,
1553
+ cx: boxX + w / 2,
1554
+ cy
1555
+ };
1556
+ });
1557
+ const regions = lanes.map((lane, i) => {
1558
+ const note = notes.get(lane.id);
1559
+ return {
1560
+ id: lane.id,
1561
+ lines: [lane.id],
1562
+ ...note !== void 0 ? { note } : {},
1563
+ icon: "branch",
1564
+ color: lane.color,
1565
+ x: lane.x,
1566
+ y: lane.y,
1567
+ w: 0,
1568
+ h: lane.h,
1569
+ header: { x: lane.x + R.inset, y: lane.y + R.inset, w: headers[i]?.w ?? 0, h: R.nameY - R.inset + (note !== void 0 ? R.line : 0) + gap / 2 }
1570
+ };
1571
+ });
1572
+ const layout = {
1573
+ kind: "git",
1574
+ width: 0,
1575
+ height: 0,
1576
+ regions,
1577
+ boxes,
1578
+ lifelines: [],
1579
+ edges: [],
1580
+ labels: [],
1581
+ actions: [],
1582
+ badges: [],
1583
+ paths: [],
1584
+ ends: [],
1585
+ lanes,
1586
+ commits,
1587
+ links,
1588
+ tags,
1589
+ refs: walked.refs,
1590
+ moves
1591
+ };
1592
+ layout.badges = badgesOf(diagram, layout);
1593
+ layout.labels = labelsOf(diagram, layout);
1594
+ const contentRight = Math.max(right, ...boxes.map((b) => b.x + b.w), ...layout.labels.map((l) => l.x + l.w)) + R.pad;
1595
+ const width = Math.max(contentRight + margin, stripNeed(diagram) + margin * 2);
1596
+ for (const region of regions) region.w = width - margin * 2;
1597
+ for (const lane of lanes) lane.w = width - margin * 2;
1598
+ const bottom = Math.max(lanesBottom, ...boxes.map((b) => b.y + b.h), ...layout.labels.map((l) => l.y + l.h));
1599
+ const strip2 = layoutStrip(diagram, margin, bottom + gap, width - margin * 2);
1600
+ layout.width = width;
1601
+ layout.height = (strip2 ? strip2.y + strip2.h : bottom) + margin;
1602
+ if (strip2) layout.strip = strip2;
1603
+ layout.badges = badgesOf(diagram, layout);
1604
+ return layout;
1605
+ }
1606
+ function union(rects) {
1607
+ const x = Math.min(...rects.map((r) => r.x));
1608
+ const y = Math.min(...rects.map((r) => r.y));
1609
+ return { x, y, w: Math.max(...rects.map((r) => r.x + r.w)) - x, h: Math.max(...rects.map((r) => r.y + r.h)) - y };
1610
+ }
1611
+ function firstMark(layout, step) {
1612
+ const marks = [
1613
+ ...layout.links.filter((l) => l.step === step && l.kind !== "copy").map((l) => ({ event: l.event, points: l.points, color: l.color })),
1614
+ ...layout.moves.flatMap((m) => {
1615
+ const target = layout.commits.find((c) => c.id === m.target);
1616
+ return m.step === step && m.line && target ? [{ event: m.event, target, color: target.color }] : [];
1617
+ })
1618
+ ].sort((a, b) => a.event - b.event);
1619
+ return marks[0];
1620
+ }
1621
+ function besideCommit(c, taken, avoid) {
1622
+ const { r, inset } = LOOK.badge;
1623
+ const d = c.r + inset + r;
1624
+ const apart = r * 2 + inset;
1625
+ const spots = [
1626
+ [c.cx + d, c.cy],
1627
+ [c.cx, c.cy + d],
1628
+ [c.cx - d, c.cy],
1629
+ [c.cx, c.cy - d]
1630
+ ];
1631
+ return spots.find((p) => taken.every(([x, y]) => Math.hypot(p[0] - x, p[1] - y) >= apart) && avoid.every((a) => gapBetween(badgeRect(p), a) >= LOOK.label.touch));
1632
+ }
1633
+ function clearOnPath(points, taken, avoid) {
1634
+ const { r, inset, along: start, short } = LOOK.badge;
1635
+ const length = pathLength(points);
1636
+ const first = length < short ? Math.min(r + 1, length / 2) : start;
1637
+ const apart = r * 2 + inset;
1638
+ for (let d = first; d <= length; d += 1) {
1639
+ const p = along(points, d);
1640
+ const rect = badgeRect(p);
1641
+ if (taken.every(([x, y]) => Math.hypot(p[0] - x, p[1] - y) >= apart) && avoid.every((a) => gapBetween(rect, a) >= LOOK.label.touch)) return p;
1642
+ }
1643
+ return void 0;
1644
+ }
1645
+ function badgesOf(diagram, layout) {
1646
+ const { inset } = LOOK.badge;
1647
+ const taken = [];
1648
+ const all = [...layout.links.map((l) => l.points), ...layout.moves.flatMap((m) => m.line ? [m.line] : [])];
1649
+ const out = [];
1650
+ const avoid = [
1651
+ ...layout.tags,
1652
+ ...layout.commits.flatMap((c) => [{ x: c.cx - c.r, y: c.cy - c.r, w: c.r * 2, h: c.r * 2 }, ...c.text ? [c.text] : []])
1653
+ ];
1654
+ diagram.steps.forEach((step, s) => {
1655
+ const mark = firstMark(layout, s);
1656
+ const near = mark?.target ? besideCommit(mark.target, taken, avoid) : void 0;
1657
+ if (mark && (mark.points || near)) {
1658
+ const points = mark.points;
1659
+ const point = near ?? (points ? clearOnPath(points, taken, avoid) ?? badgeOnPath(points, taken, all.filter((p) => p !== points)) : [0, 0]);
1660
+ taken.push(point);
1661
+ out.push({ step: s, x: point[0], y: point[1], color: mark.color });
1662
+ return;
1663
+ }
1664
+ const box = step.events.flatMap((e) => e.type === "swap" || e.type === "action" ? [e.box] : []).map((id) => layout.boxes.find((b) => b.id === id))[0];
1665
+ if (box) {
1666
+ out.push({ step: s, x: box.x, y: box.y, color: box.color });
1667
+ return;
1668
+ }
1669
+ if (layout.strip && step.events.some((e) => e.type === "strip")) {
1670
+ out.push({ step: s, x: layout.strip.x + inset, y: layout.strip.y + inset, color: "slate" });
1671
+ return;
1672
+ }
1673
+ const tip = layout.commits.find((c) => c.id === layout.refs[0]?.at[s]);
1674
+ const spot = tip ? besideCommit(tip, taken, avoid) : void 0;
1675
+ if (tip && spot) {
1676
+ taken.push(spot);
1677
+ out.push({ step: s, x: spot[0], y: spot[1], color: tip.color });
1678
+ return;
1679
+ }
1680
+ const before = out[out.length - 1];
1681
+ const lane = layout.lanes[0];
1682
+ out.push(before ? { ...before, step: s } : { step: s, x: (lane?.x ?? 0) + (lane?.w ?? 0) - inset - LOOK.badge.r, y: (lane?.y ?? 0) + inset + LOOK.badge.r, color: lane?.color ?? "slate" });
1683
+ });
1684
+ return replaceSameSpot(out);
1685
+ }
1686
+ function labelsOf(diagram, layout) {
1687
+ const G = LOOK.git;
1688
+ const labels = [];
1689
+ const circles = layout.commits.map((c) => ({ x: c.cx - c.r, y: c.cy - c.r, w: c.r * 2, h: c.r * 2 }));
1690
+ const texts = layout.commits.flatMap((c) => c.text ? [c.text] : []);
1691
+ const headers = layout.regions.map((r) => r.header);
1692
+ for (const move of layout.moves) {
1693
+ const source = diagram.steps[move.step]?.events[move.event];
1694
+ if (source?.type !== "edge" || source.label === void 0 || !move.line) continue;
1695
+ const target = layout.commits.find((c) => c.id === source.to);
1696
+ if (!target) continue;
1697
+ const top = layout.lanes[0]?.id === target.branch;
1698
+ const w = textWidth(source.label, hasWide(source.label) ? TYPE.labelJa : TYPE.label) + LOOK.label.padX * 2;
1699
+ const [mx] = move.line.reduce((sum, p) => [sum[0] + p[0] / move.line.length, 0], [0, 0]);
1700
+ const rows = Math.max(0, ...layout.tags.filter((t) => t.step === move.step && Math.abs(t.x + t.w / 2 - target.cx) < 0.5).map((t) => target.cy - t.y));
1701
+ const side2 = source.labelSide ?? (top ? "above" : "below");
1702
+ const base = source.labelSide !== void 0 ? void 0 : top ? { x: mx - w / 2, y: target.cy - Math.max(rows, (layout.lanes[0]?.tagBase ?? G.tag) + LOOK.carrier.tagH / 2) - LOOK.label.soft - LOOK.label.h } : { x: mx - w / 2, y: target.cy + G.labelUnder };
1703
+ const seen = layout.badges.filter((b) => b.step <= move.step).map((b) => badgeRect([b.x, b.y]));
1704
+ const tags = layout.tags.filter((t) => t.step === move.step);
1705
+ labels.push(
1706
+ placeLabel(
1707
+ { step: move.step, event: move.event, text: source.label, points: move.line, color: move.color, side: side2, ...base ? { base } : {} },
1708
+ { hard: [...circles, ...layout.boxes], soft: [...texts, ...tags, ...headers, ...labels.filter((l) => l.step === move.step)], touch: seen }
1709
+ )
1710
+ );
1711
+ }
1712
+ return labels;
1713
+ }
1187
1714
 
1188
1715
  // src/layout/sequence.ts
1189
1716
  function layoutSequence(diagram) {
@@ -1338,7 +1865,6 @@ function badges(diagram, layout) {
1338
1865
  });
1339
1866
  return replaceSameSpot(placed);
1340
1867
  }
1341
- var STATE_ENDS = ["start", "finish"];
1342
1868
 
1343
1869
  // src/layout/state.ts
1344
1870
  var isEnd = (id) => STATE_ENDS.includes(id);
@@ -1394,7 +1920,7 @@ function layoutState(diagram, lang) {
1394
1920
  }
1395
1921
  const colLeft = [];
1396
1922
  for (let c = 0; c < columnCount; c++) colLeft.push(c === 0 ? margin : colLeft[c - 1] + colW[c - 1] + between[c - 1]);
1397
- const center = (c) => colLeft[c] + colW[c] / 2;
1923
+ const center2 = (c) => colLeft[c] + colW[c] / 2;
1398
1924
  const isGhost = (id) => ghosts.includes(id);
1399
1925
  const enteringFrom = new Set(notTaken.filter((p) => isGhost(p.to) && !isGhost(p.from) && !isEnd(p.from)).map((p) => p.from));
1400
1926
  const notes = [words.sideNote, ...enteringFrom.size > 0 ? [words.sideFrom(enteringFrom.size)] : []];
@@ -1424,7 +1950,7 @@ function layoutState(diagram, lang) {
1424
1950
  };
1425
1951
  const boxes = walked.map((id) => {
1426
1952
  const s = slot.get(id);
1427
- return boxOf(id, center(s.col), rowY(s.row), false);
1953
+ return boxOf(id, center2(s.col), rowY(s.row), false);
1428
1954
  });
1429
1955
  for (const box of boxes) placeSlot(box, carriedIn.get(box.id), doneSide);
1430
1956
  const byId = new Map(boxes.map((b) => [b.id, b]));
@@ -1669,6 +2195,8 @@ var ja = {
1669
2195
  const: (value) => `${value} \u306B\u3059\u308B`,
1670
2196
  not: (allowed) => allowed ? `${allowed.field} \u306E\u6B04\u306F kind \u304C ${allowed.kind} \u306E\u6642\u3060\u3051\u66F8\u3051\u308B` : "\u3053\u306E\u6B04\u306E\u7D44\u307F\u5408\u308F\u305B\u306F\u66F8\u3051\u306A\u3044",
1671
2197
  reserved: (names) => `${names.join(" \u3068 ")} \u306F\u72B6\u614B\u9077\u79FB\u56F3\u306E\u59CB\u307E\u308A\u3068\u7D42\u308F\u308A\u306E\u5370\u306E\u540D\u524D\u3067\u3001\u7BB1\u306E\u540D\u672D\u306B\u4F7F\u3048\u306A\u3044`,
2198
+ kindOnly: (types, kind) => `${types.join(" \u3068 ")} \u306E\u51FA\u6765\u4E8B\u306F kind \u304C ${kind} \u306E\u6642\u3060\u3051\u66F8\u3051\u308B`,
2199
+ hex: (min, max) => `0 \u304B\u3089 9 \u3068 a \u304B\u3089 f \u306E\u5B57\u3067 ${min} \u304B\u3089 ${max} \u5B57\u306B\u3059\u308B`,
1672
2200
  anyOf: (fields) => fields.length > 0 ? `${fields.join(" \u304B ")} \u306E${fields.length === 2 ? "\u3069\u3061\u3089\u304B" : "\u3069\u308C\u304B"}\u306E\u6B04\u304C\u8981\u308B` : "\u66F8\u3051\u308B\u5F62\u306E\u3069\u308C\u306B\u3082\u5408\u308F\u306A\u3044",
1673
2201
  oneOf: "\u66F8\u3051\u308B\u5F62\u306E\u3069\u308C\u304B 1 \u3064\u3060\u3051\u306B\u5408\u308F\u305B\u308B",
1674
2202
  discriminator: (tag, values) => `${tag} \u306F ${values.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,
@@ -1686,6 +2214,8 @@ var en = {
1686
2214
  const: (value) => `Use ${value}`,
1687
2215
  not: (allowed) => allowed ? `The ${allowed.field} field is allowed only when kind is ${allowed.kind}` : "This combination of fields is not allowed",
1688
2216
  reserved: (names) => `${names.join(" and ")} name the start and end marks of a state diagram and cannot be box ids`,
2217
+ kindOnly: (types, kind) => `${types.join(" and ")} events are allowed only when kind is ${kind}`,
2218
+ hex: (min, max) => `Use ${min} to ${max} characters of 0-9 and a-f`,
1689
2219
  anyOf: (fields) => fields.length > 0 ? `Write one of the ${fields.join(" or ")} fields` : "Does not match any of the allowed shapes",
1690
2220
  oneOf: "Match exactly one of the allowed shapes",
1691
2221
  discriminator: (tag, values) => `${tag} is one of ${values.join(" / ")}`,
@@ -1700,10 +2230,10 @@ function ucs2length(str) {
1700
2230
  return length;
1701
2231
  }
1702
2232
  var validate_diagram_default = validate10;
1703
- var schema11 = { "properties": { "version": { "description": "\u5F62\u5F0F\u306E\u7248", "type": "integer", "minimum": 1 }, "kind": { "description": "\u56F3\u306E\u7A2E\u985E", "enum": ["sequence", "architecture", "state"] }, "title": { "$ref": "#/definitions/text" }, "view": { "description": "\u898B\u305B\u65B9\u3002\u66F8\u304B\u306A\u3051\u308C\u3070\u5B57\u306E\u5927\u304D\u3055\u3067\u9078\u3076\u3002fixed \u306F\u5168\u4F53\u3092\u6B62\u3081\u3066\u4E2D\u3060\u3051\u52D5\u304B\u3057\u3001follow \u306F\u5BC4\u3063\u3066\u52D5\u304B\u3057\u5168\u4F53\u56F3\u3067\u4ECA\u3069\u3053\u304B\u3092\u793A\u3059", "enum": ["fixed", "follow"] }, "regions": { "type": "array", "items": { "$ref": "#/definitions/region" } }, "boxes": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/box" } }, "strip": { "$ref": "#/definitions/strip" }, "steps": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/step" } }, "sequence": { "$ref": "#/definitions/sequence" }, "state": { "$ref": "#/definitions/state" } }};
2233
+ var schema11 = { "properties": { "version": { "description": "\u5F62\u5F0F\u306E\u7248", "type": "integer", "minimum": 1 }, "kind": { "description": "\u56F3\u306E\u7A2E\u985E", "enum": ["sequence", "architecture", "state", "git"] }, "title": { "$ref": "#/definitions/text" }, "view": { "description": "\u898B\u305B\u65B9\u3002\u66F8\u304B\u306A\u3051\u308C\u3070\u5B57\u306E\u5927\u304D\u3055\u3067\u9078\u3076\u3002fixed \u306F\u5168\u4F53\u3092\u6B62\u3081\u3066\u4E2D\u3060\u3051\u52D5\u304B\u3057\u3001follow \u306F\u5BC4\u3063\u3066\u52D5\u304B\u3057\u5168\u4F53\u56F3\u3067\u4ECA\u3069\u3053\u304B\u3092\u793A\u3059", "enum": ["fixed", "follow"] }, "regions": { "type": "array", "items": { "$ref": "#/definitions/region" } }, "boxes": { "type": "array", "items": { "$ref": "#/definitions/box" } }, "strip": { "$ref": "#/definitions/strip" }, "steps": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/step" } }, "sequence": { "$ref": "#/definitions/sequence" }, "state": { "$ref": "#/definitions/state" }, "git": { "$ref": "#/definitions/git" } }};
1704
2234
  var func2 = Object.prototype.hasOwnProperty;
1705
2235
  var func3 = ucs2length;
1706
- var schema17 = { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] };
2236
+ var schema28 = { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] };
1707
2237
  var pattern0 = new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$", "u");
1708
2238
  function validate11(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
1709
2239
  let vErrors = null;
@@ -1807,7 +2337,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
1807
2337
  if (data.color !== void 0) {
1808
2338
  let data3 = data.color;
1809
2339
  if (!(data3 === "blue" || data3 === "amber" || data3 === "green" || data3 === "violet" || data3 === "rose" || data3 === "slate" || data3 === "coin")) {
1810
- const err9 = { instancePath: instancePath + "/color", schemaPath: "#/definitions/color/enum", keyword: "enum", params: { allowedValues: schema17.enum }, message: "must be equal to one of the allowed values" };
2340
+ const err9 = { instancePath: instancePath + "/color", schemaPath: "#/definitions/color/enum", keyword: "enum", params: { allowedValues: schema28.enum }, message: "must be equal to one of the allowed values" };
1811
2341
  if (vErrors === null) {
1812
2342
  vErrors = [err9];
1813
2343
  } else {
@@ -1952,7 +2482,7 @@ function validate13(data, { instancePath = "", parentData, parentDataProperty, r
1952
2482
  if (data.color !== void 0) {
1953
2483
  let data3 = data.color;
1954
2484
  if (!(data3 === "blue" || data3 === "amber" || data3 === "green" || data3 === "violet" || data3 === "rose" || data3 === "slate" || data3 === "coin")) {
1955
- const err9 = { instancePath: instancePath + "/color", schemaPath: "#/definitions/color/enum", keyword: "enum", params: { allowedValues: schema17.enum }, message: "must be equal to one of the allowed values" };
2485
+ const err9 = { instancePath: instancePath + "/color", schemaPath: "#/definitions/color/enum", keyword: "enum", params: { allowedValues: schema28.enum }, message: "must be equal to one of the allowed values" };
1956
2486
  if (vErrors === null) {
1957
2487
  vErrors = [err9];
1958
2488
  } else {
@@ -2129,8 +2659,9 @@ function validate15(data, { instancePath = "", parentData, parentDataProperty, r
2129
2659
  validate15.errors = vErrors;
2130
2660
  return errors === 0;
2131
2661
  }
2132
- var schema33 = { "oneOf": [{ "description": "\u7DDA\u3002\u904B\u3076\u7269\u3092\u8F09\u305B\u3066\u9001\u308B\u5074\u304B\u3089\u53D7\u3051\u308B\u5074\u3078\u8D70\u308B", "type": "object", "additionalProperties": false, "required": ["type", "from", "to", "carry"], "properties": { "type": { "const": "edge" }, "from": { "$ref": "#/definitions/id" }, "to": { "$ref": "#/definitions/id" }, "label": { "$ref": "#/definitions/text" }, "carry": { "$ref": "#/definitions/carry" }, "labelSide": { "description": "\u7DDA\u306E\u540D\u524D\u3092\u7F6E\u304F\u5074 (\u5BC4\u305B\u306E\u6307\u793A)", "enum": ["above", "below", "left", "right"] } } }, { "description": "\u7BB1\u306E\u4E2D\u306E\u51E6\u7406", "type": "object", "additionalProperties": false, "required": ["type", "box", "label"], "properties": { "type": { "const": "action" }, "box": { "$ref": "#/definitions/id" }, "label": { "$ref": "#/definitions/text" } } }, { "description": "\u7BB1\u306E\u4E0B\u306E\u5C0F\u3055\u306A\u5B57\u306E\u66F8\u304D\u63DB\u3048", "type": "object", "additionalProperties": false, "required": ["type", "box", "text"], "properties": { "type": { "const": "swap" }, "box": { "$ref": "#/definitions/id" }, "text": { "$ref": "#/definitions/text" } } }, { "description": "\u4E2D\u8EAB\u306E\u5E2F\u306E\u6B04\u306E\u5024\u3068\u672D", "type": "object", "additionalProperties": false, "required": ["type", "field"], "anyOf": [{ "required": ["value"] }, { "required": ["tag"] }], "properties": { "type": { "const": "strip" }, "field": { "$ref": "#/definitions/text" }, "value": { "$ref": "#/definitions/text" }, "tag": { "$ref": "#/definitions/text" } } }] };
2133
- var schema37 = { "properties": { "kind": { "enum": ["envelope", "tag", "coin", "none"] }}};
2662
+ var schema44 = { "oneOf": [{ "description": "\u7DDA\u3002\u904B\u3076\u7269\u3092\u8F09\u305B\u3066\u9001\u308B\u5074\u304B\u3089\u53D7\u3051\u308B\u5074\u3078\u8D70\u308B", "type": "object", "additionalProperties": false, "required": ["type", "from", "to", "carry"], "properties": { "type": { "const": "edge" }, "from": { "$ref": "#/definitions/id" }, "to": { "$ref": "#/definitions/id" }, "label": { "$ref": "#/definitions/text" }, "carry": { "$ref": "#/definitions/carry" }, "labelSide": { "description": "\u7DDA\u306E\u540D\u524D\u3092\u7F6E\u304F\u5074 (\u5BC4\u305B\u306E\u6307\u793A)", "enum": ["above", "below", "left", "right"] } } }, { "description": "\u7BB1\u306E\u4E2D\u306E\u51E6\u7406", "type": "object", "additionalProperties": false, "required": ["type", "box", "label"], "properties": { "type": { "const": "action" }, "box": { "$ref": "#/definitions/id" }, "label": { "$ref": "#/definitions/text" } } }, { "description": "\u7BB1\u306E\u4E0B\u306E\u5C0F\u3055\u306A\u5B57\u306E\u66F8\u304D\u63DB\u3048", "type": "object", "additionalProperties": false, "required": ["type", "box", "text"], "properties": { "type": { "const": "swap" }, "box": { "$ref": "#/definitions/id" }, "text": { "$ref": "#/definitions/text" } } }, { "description": "commit \u3092\u7A4D\u3080\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u3002\u7A4D\u3093\u3060\u679D\u306E\u672D\u3068\u3001\u305D\u306E\u679D\u3092\u6307\u3059 HEAD \u304C\u9032\u3080\u3002\u5F53\u3066\u76F4\u3057 (copy) \u306F\u679D\u306E\u672D\u3092\u52D5\u304B\u3055\u305A\u3001merge commit (merge) \u306F\u53D6\u308A\u8FBC\u3080\u679D\u306E\u5148\u7AEF\u3082\u89AA\u306B\u6301\u3064", "type": "object", "additionalProperties": false, "required": ["type", "id", "branch"], "properties": { "type": { "const": "commit" }, "id": { "$ref": "#/definitions/id" }, "branch": { "$ref": "#/definitions/id" }, "copy": { "$ref": "#/definitions/id" }, "merge": { "$ref": "#/definitions/id" }, "hash": { "$ref": "#/definitions/hash" }, "note": { "$ref": "#/definitions/text" } } }, { "description": "\u679D\u3092\u5207\u308B\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u3002\u679D\u306E\u672D\u3092 from \u306E commit \u3078\u7F6E\u304D\u3001HEAD \u3092\u305D\u306E\u679D\u3078\u79FB\u3059", "type": "object", "additionalProperties": false, "required": ["type", "branch", "from"], "properties": { "type": { "const": "branch" }, "branch": { "$ref": "#/definitions/id" }, "from": { "$ref": "#/definitions/id" } } }, { "description": "\u4E2D\u8EAB\u306E\u5E2F\u306E\u6B04\u306E\u5024\u3068\u672D", "type": "object", "additionalProperties": false, "required": ["type", "field"], "anyOf": [{ "required": ["value"] }, { "required": ["tag"] }], "properties": { "type": { "const": "strip" }, "field": { "$ref": "#/definitions/text" }, "value": { "$ref": "#/definitions/text" }, "tag": { "$ref": "#/definitions/text" } } }] };
2663
+ var pattern11 = new RegExp("^[0-9a-f]{4,40}$", "u");
2664
+ var schema48 = { "properties": { "kind": { "enum": ["envelope", "tag", "coin", "none"] }}};
2134
2665
  function validate19(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
2135
2666
  let vErrors = null;
2136
2667
  let errors = 0;
@@ -2257,7 +2788,7 @@ function validate19(data, { instancePath = "", parentData, parentDataProperty, r
2257
2788
  if (data.kind !== void 0) {
2258
2789
  let data1 = data.kind;
2259
2790
  if (!(data1 === "envelope" || data1 === "tag" || data1 === "coin" || data1 === "none")) {
2260
- const err8 = { instancePath: instancePath + "/kind", schemaPath: "#/properties/kind/enum", keyword: "enum", params: { allowedValues: schema37.properties.kind.enum }, message: "must be equal to one of the allowed values" };
2791
+ const err8 = { instancePath: instancePath + "/kind", schemaPath: "#/properties/kind/enum", keyword: "enum", params: { allowedValues: schema48.properties.kind.enum }, message: "must be equal to one of the allowed values" };
2261
2792
  if (vErrors === null) {
2262
2793
  vErrors = [err8];
2263
2794
  } else {
@@ -2450,7 +2981,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2450
2981
  if (data.labelSide !== void 0) {
2451
2982
  let data5 = data.labelSide;
2452
2983
  if (!(data5 === "above" || data5 === "below" || data5 === "left" || data5 === "right")) {
2453
- const err13 = { instancePath: instancePath + "/labelSide", schemaPath: "#/oneOf/0/properties/labelSide/enum", keyword: "enum", params: { allowedValues: schema33.oneOf[0].properties.labelSide.enum }, message: "must be equal to one of the allowed values" };
2984
+ const err13 = { instancePath: instancePath + "/labelSide", schemaPath: "#/oneOf/0/properties/labelSide/enum", keyword: "enum", params: { allowedValues: schema44.oneOf[0].properties.labelSide.enum }, message: "must be equal to one of the allowed values" };
2454
2985
  if (vErrors === null) {
2455
2986
  vErrors = [err13];
2456
2987
  } else {
@@ -2676,13 +3207,10 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2676
3207
  }
2677
3208
  errors++;
2678
3209
  }
2679
- } else if (tag0 === "strip") {
2680
- const _errs39 = errors;
2681
- let valid15 = false;
2682
- const _errs40 = errors;
3210
+ } else if (tag0 === "commit") {
2683
3211
  if (data && typeof data == "object" && !Array.isArray(data)) {
2684
- if (data.value === void 0) {
2685
- const err35 = { instancePath, schemaPath: "#/oneOf/3/anyOf/0/required", keyword: "required", params: { missingProperty: "value" }, message: "must have required property 'value'" };
3212
+ if (data.type === void 0) {
3213
+ const err35 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
2686
3214
  if (vErrors === null) {
2687
3215
  vErrors = [err35];
2688
3216
  } else {
@@ -2690,76 +3218,60 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2690
3218
  }
2691
3219
  errors++;
2692
3220
  }
2693
- }
2694
- var _valid0 = _errs40 === errors;
2695
- valid15 = valid15 || _valid0;
2696
- if (!valid15) {
2697
- const _errs41 = errors;
2698
- if (data && typeof data == "object" && !Array.isArray(data)) {
2699
- if (data.tag === void 0) {
2700
- const err36 = { instancePath, schemaPath: "#/oneOf/3/anyOf/1/required", keyword: "required", params: { missingProperty: "tag" }, message: "must have required property 'tag'" };
2701
- if (vErrors === null) {
2702
- vErrors = [err36];
2703
- } else {
2704
- vErrors.push(err36);
2705
- }
2706
- errors++;
2707
- }
2708
- }
2709
- var _valid0 = _errs41 === errors;
2710
- valid15 = valid15 || _valid0;
2711
- }
2712
- if (!valid15) {
2713
- const err37 = { instancePath, schemaPath: "#/oneOf/3/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
2714
- if (vErrors === null) {
2715
- vErrors = [err37];
2716
- } else {
2717
- vErrors.push(err37);
2718
- }
2719
- errors++;
2720
- } else {
2721
- errors = _errs39;
2722
- if (vErrors !== null) {
2723
- if (_errs39) {
2724
- vErrors.length = _errs39;
2725
- } else {
2726
- vErrors = null;
2727
- }
2728
- }
2729
- }
2730
- if (data && typeof data == "object" && !Array.isArray(data)) {
2731
- if (data.type === void 0) {
2732
- const err38 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
3221
+ if (data.id === void 0) {
3222
+ const err36 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property 'id'" };
2733
3223
  if (vErrors === null) {
2734
- vErrors = [err38];
3224
+ vErrors = [err36];
2735
3225
  } else {
2736
- vErrors.push(err38);
3226
+ vErrors.push(err36);
2737
3227
  }
2738
3228
  errors++;
2739
3229
  }
2740
- if (data.field === void 0) {
2741
- const err39 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "field" }, message: "must have required property 'field'" };
3230
+ if (data.branch === void 0) {
3231
+ const err37 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "branch" }, message: "must have required property 'branch'" };
2742
3232
  if (vErrors === null) {
2743
- vErrors = [err39];
3233
+ vErrors = [err37];
2744
3234
  } else {
2745
- vErrors.push(err39);
3235
+ vErrors.push(err37);
2746
3236
  }
2747
3237
  errors++;
2748
3238
  }
2749
3239
  for (const key3 in data) {
2750
- if (!(key3 === "type" || key3 === "field" || key3 === "value" || key3 === "tag")) {
2751
- const err40 = { instancePath, schemaPath: "#/oneOf/3/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" };
3240
+ if (!(key3 === "type" || key3 === "id" || key3 === "branch" || key3 === "copy" || key3 === "merge" || key3 === "hash" || key3 === "note")) {
3241
+ const err38 = { instancePath, schemaPath: "#/oneOf/3/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" };
2752
3242
  if (vErrors === null) {
2753
- vErrors = [err40];
3243
+ vErrors = [err38];
2754
3244
  } else {
2755
- vErrors.push(err40);
3245
+ vErrors.push(err38);
2756
3246
  }
2757
3247
  errors++;
2758
3248
  }
2759
3249
  }
2760
3250
  if (data.type !== void 0) {
2761
- if ("strip" !== data.type) {
2762
- const err41 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/3/properties/type/const", keyword: "const", params: { allowedValue: "strip" }, message: "must be equal to constant" };
3251
+ if ("commit" !== data.type) {
3252
+ const err39 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/3/properties/type/const", keyword: "const", params: { allowedValue: "commit" }, message: "must be equal to constant" };
3253
+ if (vErrors === null) {
3254
+ vErrors = [err39];
3255
+ } else {
3256
+ vErrors.push(err39);
3257
+ }
3258
+ errors++;
3259
+ }
3260
+ }
3261
+ if (data.id !== void 0) {
3262
+ let data13 = data.id;
3263
+ if (typeof data13 === "string") {
3264
+ if (!pattern0.test(data13)) {
3265
+ const err40 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
3266
+ if (vErrors === null) {
3267
+ vErrors = [err40];
3268
+ } else {
3269
+ vErrors.push(err40);
3270
+ }
3271
+ errors++;
3272
+ }
3273
+ } else {
3274
+ const err41 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2763
3275
  if (vErrors === null) {
2764
3276
  vErrors = [err41];
2765
3277
  } else {
@@ -2768,11 +3280,11 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2768
3280
  errors++;
2769
3281
  }
2770
3282
  }
2771
- if (data.field !== void 0) {
2772
- let data13 = data.field;
2773
- if (typeof data13 === "string") {
2774
- if (func3(data13) < 1) {
2775
- const err42 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
3283
+ if (data.branch !== void 0) {
3284
+ let data14 = data.branch;
3285
+ if (typeof data14 === "string") {
3286
+ if (!pattern0.test(data14)) {
3287
+ const err42 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
2776
3288
  if (vErrors === null) {
2777
3289
  vErrors = [err42];
2778
3290
  } else {
@@ -2781,7 +3293,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2781
3293
  errors++;
2782
3294
  }
2783
3295
  } else {
2784
- const err43 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3296
+ const err43 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2785
3297
  if (vErrors === null) {
2786
3298
  vErrors = [err43];
2787
3299
  } else {
@@ -2790,11 +3302,11 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2790
3302
  errors++;
2791
3303
  }
2792
3304
  }
2793
- if (data.value !== void 0) {
2794
- let data14 = data.value;
2795
- if (typeof data14 === "string") {
2796
- if (func3(data14) < 1) {
2797
- const err44 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
3305
+ if (data.copy !== void 0) {
3306
+ let data15 = data.copy;
3307
+ if (typeof data15 === "string") {
3308
+ if (!pattern0.test(data15)) {
3309
+ const err44 = { instancePath: instancePath + "/copy", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
2798
3310
  if (vErrors === null) {
2799
3311
  vErrors = [err44];
2800
3312
  } else {
@@ -2803,7 +3315,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2803
3315
  errors++;
2804
3316
  }
2805
3317
  } else {
2806
- const err45 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3318
+ const err45 = { instancePath: instancePath + "/copy", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2807
3319
  if (vErrors === null) {
2808
3320
  vErrors = [err45];
2809
3321
  } else {
@@ -2812,11 +3324,11 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2812
3324
  errors++;
2813
3325
  }
2814
3326
  }
2815
- if (data.tag !== void 0) {
2816
- let data15 = data.tag;
2817
- if (typeof data15 === "string") {
2818
- if (func3(data15) < 1) {
2819
- const err46 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
3327
+ if (data.merge !== void 0) {
3328
+ let data16 = data.merge;
3329
+ if (typeof data16 === "string") {
3330
+ if (!pattern0.test(data16)) {
3331
+ const err46 = { instancePath: instancePath + "/merge", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
2820
3332
  if (vErrors === null) {
2821
3333
  vErrors = [err46];
2822
3334
  } else {
@@ -2825,7 +3337,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2825
3337
  errors++;
2826
3338
  }
2827
3339
  } else {
2828
- const err47 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3340
+ const err47 = { instancePath: instancePath + "/merge", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2829
3341
  if (vErrors === null) {
2830
3342
  vErrors = [err47];
2831
3343
  } else {
@@ -2834,48 +3346,363 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2834
3346
  errors++;
2835
3347
  }
2836
3348
  }
3349
+ if (data.hash !== void 0) {
3350
+ let data17 = data.hash;
3351
+ if (typeof data17 === "string") {
3352
+ if (!pattern11.test(data17)) {
3353
+ const err48 = { instancePath: instancePath + "/hash", schemaPath: "#/definitions/hash/pattern", keyword: "pattern", params: { pattern: "^[0-9a-f]{4,40}$" }, message: 'must match pattern "^[0-9a-f]{4,40}$"' };
3354
+ if (vErrors === null) {
3355
+ vErrors = [err48];
3356
+ } else {
3357
+ vErrors.push(err48);
3358
+ }
3359
+ errors++;
3360
+ }
3361
+ } else {
3362
+ const err49 = { instancePath: instancePath + "/hash", schemaPath: "#/definitions/hash/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3363
+ if (vErrors === null) {
3364
+ vErrors = [err49];
3365
+ } else {
3366
+ vErrors.push(err49);
3367
+ }
3368
+ errors++;
3369
+ }
3370
+ }
3371
+ if (data.note !== void 0) {
3372
+ let data18 = data.note;
3373
+ if (typeof data18 === "string") {
3374
+ if (func3(data18) < 1) {
3375
+ const err50 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
3376
+ if (vErrors === null) {
3377
+ vErrors = [err50];
3378
+ } else {
3379
+ vErrors.push(err50);
3380
+ }
3381
+ errors++;
3382
+ }
3383
+ } else {
3384
+ const err51 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3385
+ if (vErrors === null) {
3386
+ vErrors = [err51];
3387
+ } else {
3388
+ vErrors.push(err51);
3389
+ }
3390
+ errors++;
3391
+ }
3392
+ }
2837
3393
  } else {
2838
- const err48 = { instancePath, schemaPath: "#/oneOf/3/type", keyword: "type", params: { type: "object" }, message: "must be object" };
3394
+ const err52 = { instancePath, schemaPath: "#/oneOf/3/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2839
3395
  if (vErrors === null) {
2840
- vErrors = [err48];
3396
+ vErrors = [err52];
2841
3397
  } else {
2842
- vErrors.push(err48);
3398
+ vErrors.push(err52);
2843
3399
  }
2844
3400
  errors++;
2845
3401
  }
2846
- } else {
2847
- const err49 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "mapping", tag: "type", tagValue: tag0 }, message: 'value of tag "type" must be in oneOf' };
2848
- if (vErrors === null) {
2849
- vErrors = [err49];
3402
+ } else if (tag0 === "branch") {
3403
+ if (data && typeof data == "object" && !Array.isArray(data)) {
3404
+ if (data.type === void 0) {
3405
+ const err53 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
3406
+ if (vErrors === null) {
3407
+ vErrors = [err53];
3408
+ } else {
3409
+ vErrors.push(err53);
3410
+ }
3411
+ errors++;
3412
+ }
3413
+ if (data.branch === void 0) {
3414
+ const err54 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "branch" }, message: "must have required property 'branch'" };
3415
+ if (vErrors === null) {
3416
+ vErrors = [err54];
3417
+ } else {
3418
+ vErrors.push(err54);
3419
+ }
3420
+ errors++;
3421
+ }
3422
+ if (data.from === void 0) {
3423
+ const err55 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "from" }, message: "must have required property 'from'" };
3424
+ if (vErrors === null) {
3425
+ vErrors = [err55];
3426
+ } else {
3427
+ vErrors.push(err55);
3428
+ }
3429
+ errors++;
3430
+ }
3431
+ for (const key4 in data) {
3432
+ if (!(key4 === "type" || key4 === "branch" || key4 === "from")) {
3433
+ const err56 = { instancePath, schemaPath: "#/oneOf/4/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key4 }, message: "must NOT have additional properties" };
3434
+ if (vErrors === null) {
3435
+ vErrors = [err56];
3436
+ } else {
3437
+ vErrors.push(err56);
3438
+ }
3439
+ errors++;
3440
+ }
3441
+ }
3442
+ if (data.type !== void 0) {
3443
+ if ("branch" !== data.type) {
3444
+ const err57 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/4/properties/type/const", keyword: "const", params: { allowedValue: "branch" }, message: "must be equal to constant" };
3445
+ if (vErrors === null) {
3446
+ vErrors = [err57];
3447
+ } else {
3448
+ vErrors.push(err57);
3449
+ }
3450
+ errors++;
3451
+ }
3452
+ }
3453
+ if (data.branch !== void 0) {
3454
+ let data20 = data.branch;
3455
+ if (typeof data20 === "string") {
3456
+ if (!pattern0.test(data20)) {
3457
+ const err58 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
3458
+ if (vErrors === null) {
3459
+ vErrors = [err58];
3460
+ } else {
3461
+ vErrors.push(err58);
3462
+ }
3463
+ errors++;
3464
+ }
3465
+ } else {
3466
+ const err59 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3467
+ if (vErrors === null) {
3468
+ vErrors = [err59];
3469
+ } else {
3470
+ vErrors.push(err59);
3471
+ }
3472
+ errors++;
3473
+ }
3474
+ }
3475
+ if (data.from !== void 0) {
3476
+ let data21 = data.from;
3477
+ if (typeof data21 === "string") {
3478
+ if (!pattern0.test(data21)) {
3479
+ const err60 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
3480
+ if (vErrors === null) {
3481
+ vErrors = [err60];
3482
+ } else {
3483
+ vErrors.push(err60);
3484
+ }
3485
+ errors++;
3486
+ }
3487
+ } else {
3488
+ const err61 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3489
+ if (vErrors === null) {
3490
+ vErrors = [err61];
3491
+ } else {
3492
+ vErrors.push(err61);
3493
+ }
3494
+ errors++;
3495
+ }
3496
+ }
2850
3497
  } else {
2851
- vErrors.push(err49);
3498
+ const err62 = { instancePath, schemaPath: "#/oneOf/4/type", keyword: "type", params: { type: "object" }, message: "must be object" };
3499
+ if (vErrors === null) {
3500
+ vErrors = [err62];
3501
+ } else {
3502
+ vErrors.push(err62);
3503
+ }
3504
+ errors++;
2852
3505
  }
2853
- errors++;
2854
- }
2855
- } else {
2856
- const err50 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "tag", tag: "type", tagValue: tag0 }, message: 'tag "type" must be string' };
2857
- if (vErrors === null) {
2858
- vErrors = [err50];
2859
- } else {
2860
- vErrors.push(err50);
2861
- }
2862
- errors++;
2863
- }
2864
- } else {
2865
- const err51 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2866
- if (vErrors === null) {
2867
- vErrors = [err51];
2868
- } else {
2869
- vErrors.push(err51);
2870
- }
2871
- errors++;
2872
- }
2873
- validate18.errors = vErrors;
2874
- return errors === 0;
2875
- }
2876
- function validate17(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
2877
- let vErrors = null;
2878
- let errors = 0;
3506
+ } else if (tag0 === "strip") {
3507
+ const _errs71 = errors;
3508
+ let valid27 = false;
3509
+ const _errs72 = errors;
3510
+ if (data && typeof data == "object" && !Array.isArray(data)) {
3511
+ if (data.value === void 0) {
3512
+ const err63 = { instancePath, schemaPath: "#/oneOf/5/anyOf/0/required", keyword: "required", params: { missingProperty: "value" }, message: "must have required property 'value'" };
3513
+ if (vErrors === null) {
3514
+ vErrors = [err63];
3515
+ } else {
3516
+ vErrors.push(err63);
3517
+ }
3518
+ errors++;
3519
+ }
3520
+ }
3521
+ var _valid0 = _errs72 === errors;
3522
+ valid27 = valid27 || _valid0;
3523
+ if (!valid27) {
3524
+ const _errs73 = errors;
3525
+ if (data && typeof data == "object" && !Array.isArray(data)) {
3526
+ if (data.tag === void 0) {
3527
+ const err64 = { instancePath, schemaPath: "#/oneOf/5/anyOf/1/required", keyword: "required", params: { missingProperty: "tag" }, message: "must have required property 'tag'" };
3528
+ if (vErrors === null) {
3529
+ vErrors = [err64];
3530
+ } else {
3531
+ vErrors.push(err64);
3532
+ }
3533
+ errors++;
3534
+ }
3535
+ }
3536
+ var _valid0 = _errs73 === errors;
3537
+ valid27 = valid27 || _valid0;
3538
+ }
3539
+ if (!valid27) {
3540
+ const err65 = { instancePath, schemaPath: "#/oneOf/5/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
3541
+ if (vErrors === null) {
3542
+ vErrors = [err65];
3543
+ } else {
3544
+ vErrors.push(err65);
3545
+ }
3546
+ errors++;
3547
+ } else {
3548
+ errors = _errs71;
3549
+ if (vErrors !== null) {
3550
+ if (_errs71) {
3551
+ vErrors.length = _errs71;
3552
+ } else {
3553
+ vErrors = null;
3554
+ }
3555
+ }
3556
+ }
3557
+ if (data && typeof data == "object" && !Array.isArray(data)) {
3558
+ if (data.type === void 0) {
3559
+ const err66 = { instancePath, schemaPath: "#/oneOf/5/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
3560
+ if (vErrors === null) {
3561
+ vErrors = [err66];
3562
+ } else {
3563
+ vErrors.push(err66);
3564
+ }
3565
+ errors++;
3566
+ }
3567
+ if (data.field === void 0) {
3568
+ const err67 = { instancePath, schemaPath: "#/oneOf/5/required", keyword: "required", params: { missingProperty: "field" }, message: "must have required property 'field'" };
3569
+ if (vErrors === null) {
3570
+ vErrors = [err67];
3571
+ } else {
3572
+ vErrors.push(err67);
3573
+ }
3574
+ errors++;
3575
+ }
3576
+ for (const key5 in data) {
3577
+ if (!(key5 === "type" || key5 === "field" || key5 === "value" || key5 === "tag")) {
3578
+ const err68 = { instancePath, schemaPath: "#/oneOf/5/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key5 }, message: "must NOT have additional properties" };
3579
+ if (vErrors === null) {
3580
+ vErrors = [err68];
3581
+ } else {
3582
+ vErrors.push(err68);
3583
+ }
3584
+ errors++;
3585
+ }
3586
+ }
3587
+ if (data.type !== void 0) {
3588
+ if ("strip" !== data.type) {
3589
+ const err69 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/5/properties/type/const", keyword: "const", params: { allowedValue: "strip" }, message: "must be equal to constant" };
3590
+ if (vErrors === null) {
3591
+ vErrors = [err69];
3592
+ } else {
3593
+ vErrors.push(err69);
3594
+ }
3595
+ errors++;
3596
+ }
3597
+ }
3598
+ if (data.field !== void 0) {
3599
+ let data23 = data.field;
3600
+ if (typeof data23 === "string") {
3601
+ if (func3(data23) < 1) {
3602
+ const err70 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
3603
+ if (vErrors === null) {
3604
+ vErrors = [err70];
3605
+ } else {
3606
+ vErrors.push(err70);
3607
+ }
3608
+ errors++;
3609
+ }
3610
+ } else {
3611
+ const err71 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3612
+ if (vErrors === null) {
3613
+ vErrors = [err71];
3614
+ } else {
3615
+ vErrors.push(err71);
3616
+ }
3617
+ errors++;
3618
+ }
3619
+ }
3620
+ if (data.value !== void 0) {
3621
+ let data24 = data.value;
3622
+ if (typeof data24 === "string") {
3623
+ if (func3(data24) < 1) {
3624
+ const err72 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
3625
+ if (vErrors === null) {
3626
+ vErrors = [err72];
3627
+ } else {
3628
+ vErrors.push(err72);
3629
+ }
3630
+ errors++;
3631
+ }
3632
+ } else {
3633
+ const err73 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3634
+ if (vErrors === null) {
3635
+ vErrors = [err73];
3636
+ } else {
3637
+ vErrors.push(err73);
3638
+ }
3639
+ errors++;
3640
+ }
3641
+ }
3642
+ if (data.tag !== void 0) {
3643
+ let data25 = data.tag;
3644
+ if (typeof data25 === "string") {
3645
+ if (func3(data25) < 1) {
3646
+ const err74 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
3647
+ if (vErrors === null) {
3648
+ vErrors = [err74];
3649
+ } else {
3650
+ vErrors.push(err74);
3651
+ }
3652
+ errors++;
3653
+ }
3654
+ } else {
3655
+ const err75 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3656
+ if (vErrors === null) {
3657
+ vErrors = [err75];
3658
+ } else {
3659
+ vErrors.push(err75);
3660
+ }
3661
+ errors++;
3662
+ }
3663
+ }
3664
+ } else {
3665
+ const err76 = { instancePath, schemaPath: "#/oneOf/5/type", keyword: "type", params: { type: "object" }, message: "must be object" };
3666
+ if (vErrors === null) {
3667
+ vErrors = [err76];
3668
+ } else {
3669
+ vErrors.push(err76);
3670
+ }
3671
+ errors++;
3672
+ }
3673
+ } else {
3674
+ const err77 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "mapping", tag: "type", tagValue: tag0 }, message: 'value of tag "type" must be in oneOf' };
3675
+ if (vErrors === null) {
3676
+ vErrors = [err77];
3677
+ } else {
3678
+ vErrors.push(err77);
3679
+ }
3680
+ errors++;
3681
+ }
3682
+ } else {
3683
+ const err78 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "tag", tag: "type", tagValue: tag0 }, message: 'tag "type" must be string' };
3684
+ if (vErrors === null) {
3685
+ vErrors = [err78];
3686
+ } else {
3687
+ vErrors.push(err78);
3688
+ }
3689
+ errors++;
3690
+ }
3691
+ } else {
3692
+ const err79 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
3693
+ if (vErrors === null) {
3694
+ vErrors = [err79];
3695
+ } else {
3696
+ vErrors.push(err79);
3697
+ }
3698
+ errors++;
3699
+ }
3700
+ validate18.errors = vErrors;
3701
+ return errors === 0;
3702
+ }
3703
+ function validate17(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
3704
+ let vErrors = null;
3705
+ let errors = 0;
2879
3706
  if (data && typeof data == "object" && !Array.isArray(data)) {
2880
3707
  if (data.title === void 0) {
2881
3708
  const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "title" }, message: "must have required property 'title'" };
@@ -3270,6 +4097,151 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
3270
4097
  validate25.errors = vErrors;
3271
4098
  return errors === 0;
3272
4099
  }
4100
+ function validate30(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
4101
+ let vErrors = null;
4102
+ let errors = 0;
4103
+ if (data && typeof data == "object" && !Array.isArray(data)) {
4104
+ if (data.id === void 0) {
4105
+ const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property 'id'" };
4106
+ if (vErrors === null) {
4107
+ vErrors = [err0];
4108
+ } else {
4109
+ vErrors.push(err0);
4110
+ }
4111
+ errors++;
4112
+ }
4113
+ for (const key0 in data) {
4114
+ if (!(key0 === "id" || key0 === "note")) {
4115
+ const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
4116
+ if (vErrors === null) {
4117
+ vErrors = [err1];
4118
+ } else {
4119
+ vErrors.push(err1);
4120
+ }
4121
+ errors++;
4122
+ }
4123
+ }
4124
+ if (data.id !== void 0) {
4125
+ let data0 = data.id;
4126
+ if (typeof data0 === "string") {
4127
+ if (!pattern0.test(data0)) {
4128
+ const err2 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
4129
+ if (vErrors === null) {
4130
+ vErrors = [err2];
4131
+ } else {
4132
+ vErrors.push(err2);
4133
+ }
4134
+ errors++;
4135
+ }
4136
+ } else {
4137
+ const err3 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
4138
+ if (vErrors === null) {
4139
+ vErrors = [err3];
4140
+ } else {
4141
+ vErrors.push(err3);
4142
+ }
4143
+ errors++;
4144
+ }
4145
+ }
4146
+ if (data.note !== void 0) {
4147
+ let data1 = data.note;
4148
+ if (typeof data1 === "string") {
4149
+ if (func3(data1) < 1) {
4150
+ const err4 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
4151
+ if (vErrors === null) {
4152
+ vErrors = [err4];
4153
+ } else {
4154
+ vErrors.push(err4);
4155
+ }
4156
+ errors++;
4157
+ }
4158
+ } else {
4159
+ const err5 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
4160
+ if (vErrors === null) {
4161
+ vErrors = [err5];
4162
+ } else {
4163
+ vErrors.push(err5);
4164
+ }
4165
+ errors++;
4166
+ }
4167
+ }
4168
+ } else {
4169
+ const err6 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
4170
+ if (vErrors === null) {
4171
+ vErrors = [err6];
4172
+ } else {
4173
+ vErrors.push(err6);
4174
+ }
4175
+ errors++;
4176
+ }
4177
+ validate30.errors = vErrors;
4178
+ return errors === 0;
4179
+ }
4180
+ function validate29(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
4181
+ let vErrors = null;
4182
+ let errors = 0;
4183
+ if (data && typeof data == "object" && !Array.isArray(data)) {
4184
+ if (data.branches === void 0) {
4185
+ const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "branches" }, message: "must have required property 'branches'" };
4186
+ if (vErrors === null) {
4187
+ vErrors = [err0];
4188
+ } else {
4189
+ vErrors.push(err0);
4190
+ }
4191
+ errors++;
4192
+ }
4193
+ for (const key0 in data) {
4194
+ if (!(key0 === "branches")) {
4195
+ const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
4196
+ if (vErrors === null) {
4197
+ vErrors = [err1];
4198
+ } else {
4199
+ vErrors.push(err1);
4200
+ }
4201
+ errors++;
4202
+ }
4203
+ }
4204
+ if (data.branches !== void 0) {
4205
+ let data0 = data.branches;
4206
+ if (Array.isArray(data0)) {
4207
+ if (data0.length < 1) {
4208
+ const err2 = { instancePath: instancePath + "/branches", schemaPath: "#/properties/branches/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
4209
+ if (vErrors === null) {
4210
+ vErrors = [err2];
4211
+ } else {
4212
+ vErrors.push(err2);
4213
+ }
4214
+ errors++;
4215
+ }
4216
+ const len0 = data0.length;
4217
+ for (let i0 = 0; i0 < len0; i0++) {
4218
+ if (!validate30(data0[i0], { instancePath: instancePath + "/branches/" + i0, parentData: data0, parentDataProperty: i0, rootData })) {
4219
+ vErrors = vErrors === null ? validate30.errors : vErrors.concat(validate30.errors);
4220
+ errors = vErrors.length;
4221
+ }
4222
+ }
4223
+ } else {
4224
+ const err3 = { instancePath: instancePath + "/branches", schemaPath: "#/properties/branches/type", keyword: "type", params: { type: "array" }, message: "must be array" };
4225
+ if (vErrors === null) {
4226
+ vErrors = [err3];
4227
+ } else {
4228
+ vErrors.push(err3);
4229
+ }
4230
+ errors++;
4231
+ }
4232
+ }
4233
+ } else {
4234
+ const err4 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
4235
+ if (vErrors === null) {
4236
+ vErrors = [err4];
4237
+ } else {
4238
+ vErrors.push(err4);
4239
+ }
4240
+ errors++;
4241
+ }
4242
+ validate29.errors = vErrors;
4243
+ return errors === 0;
4244
+ }
3273
4245
  function validate10(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
3274
4246
  let vErrors = null;
3275
4247
  let errors = 0;
@@ -3311,11 +4283,9 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
3311
4283
  let ifClause0;
3312
4284
  if (_valid0) {
3313
4285
  const _errs4 = errors;
3314
- const _errs5 = errors;
3315
- const _errs6 = errors;
3316
4286
  if (data && typeof data == "object" && !Array.isArray(data)) {
3317
- if (data.state === void 0 && ("state")) {
3318
- const err2 = {};
4287
+ if (data.sequence === void 0) {
4288
+ const err2 = { instancePath, schemaPath: "#/then/required", keyword: "required", params: { missingProperty: "sequence" }, message: "must have required property 'sequence'" };
3319
4289
  if (vErrors === null) {
3320
4290
  vErrors = [err2];
3321
4291
  } else {
@@ -3323,147 +4293,181 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
3323
4293
  }
3324
4294
  errors++;
3325
4295
  }
3326
- }
3327
- var valid2 = _errs6 === errors;
3328
- if (valid2) {
3329
- const err3 = { instancePath, schemaPath: "#/then/not", keyword: "not", params: {}, message: "must NOT be valid" };
3330
- if (vErrors === null) {
3331
- vErrors = [err3];
3332
- } else {
3333
- vErrors.push(err3);
4296
+ if (data.boxes !== void 0) {
4297
+ let data1 = data.boxes;
4298
+ if (Array.isArray(data1)) {
4299
+ if (data1.length < 1) {
4300
+ const err3 = { instancePath: instancePath + "/boxes", schemaPath: "#/then/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
4301
+ if (vErrors === null) {
4302
+ vErrors = [err3];
4303
+ } else {
4304
+ vErrors.push(err3);
4305
+ }
4306
+ errors++;
4307
+ }
4308
+ }
3334
4309
  }
3335
- errors++;
3336
- } else {
3337
- errors = _errs5;
3338
- if (vErrors !== null) {
3339
- if (_errs5) {
3340
- vErrors.length = _errs5;
3341
- } else {
3342
- vErrors = null;
4310
+ if (data.steps !== void 0) {
4311
+ let data2 = data.steps;
4312
+ if (Array.isArray(data2)) {
4313
+ const len0 = data2.length;
4314
+ for (let i0 = 0; i0 < len0; i0++) {
4315
+ let data3 = data2[i0];
4316
+ if (data3 && typeof data3 == "object" && !Array.isArray(data3)) {
4317
+ if (data3.events !== void 0) {
4318
+ let data4 = data3.events;
4319
+ if (Array.isArray(data4)) {
4320
+ const len1 = data4.length;
4321
+ for (let i1 = 0; i1 < len1; i1++) {
4322
+ let data5 = data4[i1];
4323
+ if (data5 && typeof data5 == "object" && !Array.isArray(data5)) {
4324
+ if (data5.type !== void 0) {
4325
+ let data6 = data5.type;
4326
+ const _errs12 = errors;
4327
+ const _errs13 = errors;
4328
+ if (!(data6 === "commit" || data6 === "branch")) {
4329
+ const err4 = {};
4330
+ if (vErrors === null) {
4331
+ vErrors = [err4];
4332
+ } else {
4333
+ vErrors.push(err4);
4334
+ }
4335
+ errors++;
4336
+ }
4337
+ var valid10 = _errs13 === errors;
4338
+ if (valid10) {
4339
+ const err5 = { instancePath: instancePath + "/steps/" + i0 + "/events/" + i1 + "/type", schemaPath: "#/definitions/plainSteps/items/properties/events/items/properties/type/not", keyword: "not", params: {}, message: "must NOT be valid" };
4340
+ if (vErrors === null) {
4341
+ vErrors = [err5];
4342
+ } else {
4343
+ vErrors.push(err5);
4344
+ }
4345
+ errors++;
4346
+ } else {
4347
+ errors = _errs12;
4348
+ if (vErrors !== null) {
4349
+ if (_errs12) {
4350
+ vErrors.length = _errs12;
4351
+ } else {
4352
+ vErrors = null;
4353
+ }
4354
+ }
4355
+ }
4356
+ }
4357
+ }
4358
+ }
4359
+ }
4360
+ }
4361
+ }
4362
+ }
3343
4363
  }
3344
4364
  }
3345
- }
3346
- if (data && typeof data == "object" && !Array.isArray(data)) {
3347
- if (data.sequence === void 0) {
3348
- const err4 = { instancePath, schemaPath: "#/then/required", keyword: "required", params: { missingProperty: "sequence" }, message: "must have required property 'sequence'" };
4365
+ if (data.state !== void 0) {
4366
+ const err6 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
3349
4367
  if (vErrors === null) {
3350
- vErrors = [err4];
4368
+ vErrors = [err6];
3351
4369
  } else {
3352
- vErrors.push(err4);
4370
+ vErrors.push(err6);
3353
4371
  }
3354
4372
  errors++;
3355
4373
  }
3356
- }
3357
- var _valid0 = _errs4 === errors;
3358
- valid0 = _valid0;
3359
- ifClause0 = "then";
3360
- } else {
3361
- const _errs7 = errors;
3362
- const _errs8 = errors;
3363
- const _errs9 = errors;
3364
- if (data && typeof data == "object" && !Array.isArray(data)) {
3365
- if (data.sequence === void 0 && ("sequence")) {
3366
- const err5 = {};
4374
+ if (data.git !== void 0) {
4375
+ const err7 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
3367
4376
  if (vErrors === null) {
3368
- vErrors = [err5];
4377
+ vErrors = [err7];
3369
4378
  } else {
3370
- vErrors.push(err5);
4379
+ vErrors.push(err7);
3371
4380
  }
3372
4381
  errors++;
3373
4382
  }
3374
4383
  }
3375
- var valid3 = _errs9 === errors;
3376
- if (valid3) {
3377
- const err6 = { instancePath, schemaPath: "#/else/not", keyword: "not", params: {}, message: "must NOT be valid" };
3378
- if (vErrors === null) {
3379
- vErrors = [err6];
3380
- } else {
3381
- vErrors.push(err6);
3382
- }
3383
- errors++;
3384
- } else {
3385
- errors = _errs8;
3386
- if (vErrors !== null) {
3387
- if (_errs8) {
3388
- vErrors.length = _errs8;
3389
- } else {
3390
- vErrors = null;
3391
- }
3392
- }
3393
- }
3394
- const _errs10 = errors;
3395
- let valid4 = true;
3396
- const _errs11 = errors;
4384
+ var _valid0 = _errs4 === errors;
4385
+ valid0 = _valid0;
4386
+ ifClause0 = "then";
4387
+ } else {
4388
+ const _errs20 = errors;
4389
+ const _errs21 = errors;
4390
+ let valid13 = true;
4391
+ const _errs22 = errors;
3397
4392
  if (data && typeof data == "object" && !Array.isArray(data)) {
3398
4393
  if (data.kind === void 0 && ("kind")) {
3399
- const err7 = {};
4394
+ const err8 = {};
3400
4395
  if (vErrors === null) {
3401
- vErrors = [err7];
4396
+ vErrors = [err8];
3402
4397
  } else {
3403
- vErrors.push(err7);
4398
+ vErrors.push(err8);
3404
4399
  }
3405
4400
  errors++;
3406
4401
  } else {
3407
4402
  if (data.kind !== void 0) {
3408
4403
  if ("state" !== data.kind) {
3409
- const err8 = {};
4404
+ const err9 = {};
3410
4405
  if (vErrors === null) {
3411
- vErrors = [err8];
4406
+ vErrors = [err9];
3412
4407
  } else {
3413
- vErrors.push(err8);
4408
+ vErrors.push(err9);
3414
4409
  }
3415
4410
  errors++;
3416
4411
  }
3417
4412
  }
3418
4413
  }
3419
4414
  }
3420
- var _valid1 = _errs11 === errors;
3421
- errors = _errs10;
4415
+ var _valid1 = _errs22 === errors;
4416
+ errors = _errs21;
3422
4417
  if (vErrors !== null) {
3423
- if (_errs10) {
3424
- vErrors.length = _errs10;
4418
+ if (_errs21) {
4419
+ vErrors.length = _errs21;
3425
4420
  } else {
3426
4421
  vErrors = null;
3427
4422
  }
3428
4423
  }
3429
4424
  let ifClause1;
3430
4425
  if (_valid1) {
3431
- const _errs13 = errors;
4426
+ const _errs24 = errors;
3432
4427
  if (data && typeof data == "object" && !Array.isArray(data)) {
3433
4428
  if (data.boxes !== void 0) {
3434
- let data2 = data.boxes;
3435
- if (Array.isArray(data2)) {
3436
- const len0 = data2.length;
3437
- for (let i0 = 0; i0 < len0; i0++) {
3438
- let data3 = data2[i0];
3439
- if (data3 && typeof data3 == "object" && !Array.isArray(data3)) {
3440
- if (data3.id !== void 0) {
3441
- let data4 = data3.id;
3442
- const _errs17 = errors;
3443
- const _errs18 = errors;
3444
- if (!(data4 === "start" || data4 === "finish")) {
3445
- const err9 = {};
4429
+ let data10 = data.boxes;
4430
+ if (Array.isArray(data10)) {
4431
+ if (data10.length < 1) {
4432
+ const err10 = { instancePath: instancePath + "/boxes", schemaPath: "#/else/then/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
4433
+ if (vErrors === null) {
4434
+ vErrors = [err10];
4435
+ } else {
4436
+ vErrors.push(err10);
4437
+ }
4438
+ errors++;
4439
+ }
4440
+ const len2 = data10.length;
4441
+ for (let i2 = 0; i2 < len2; i2++) {
4442
+ let data11 = data10[i2];
4443
+ if (data11 && typeof data11 == "object" && !Array.isArray(data11)) {
4444
+ if (data11.id !== void 0) {
4445
+ let data12 = data11.id;
4446
+ const _errs28 = errors;
4447
+ const _errs29 = errors;
4448
+ if (!(data12 === "start" || data12 === "finish")) {
4449
+ const err11 = {};
3446
4450
  if (vErrors === null) {
3447
- vErrors = [err9];
4451
+ vErrors = [err11];
3448
4452
  } else {
3449
- vErrors.push(err9);
4453
+ vErrors.push(err11);
3450
4454
  }
3451
4455
  errors++;
3452
4456
  }
3453
- var valid10 = _errs18 === errors;
3454
- if (valid10) {
3455
- const err10 = { instancePath: instancePath + "/boxes/" + i0 + "/id", schemaPath: "#/else/then/properties/boxes/items/properties/id/not", keyword: "not", params: {}, message: "must NOT be valid" };
4457
+ var valid19 = _errs29 === errors;
4458
+ if (valid19) {
4459
+ const err12 = { instancePath: instancePath + "/boxes/" + i2 + "/id", schemaPath: "#/else/then/properties/boxes/items/properties/id/not", keyword: "not", params: {}, message: "must NOT be valid" };
3456
4460
  if (vErrors === null) {
3457
- vErrors = [err10];
4461
+ vErrors = [err12];
3458
4462
  } else {
3459
- vErrors.push(err10);
4463
+ vErrors.push(err12);
3460
4464
  }
3461
4465
  errors++;
3462
4466
  } else {
3463
- errors = _errs17;
4467
+ errors = _errs28;
3464
4468
  if (vErrors !== null) {
3465
- if (_errs17) {
3466
- vErrors.length = _errs17;
4469
+ if (_errs28) {
4470
+ vErrors.length = _errs28;
3467
4471
  } else {
3468
4472
  vErrors = null;
3469
4473
  }
@@ -3474,241 +4478,449 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
3474
4478
  }
3475
4479
  }
3476
4480
  }
4481
+ if (data.steps !== void 0) {
4482
+ let data13 = data.steps;
4483
+ if (Array.isArray(data13)) {
4484
+ const len3 = data13.length;
4485
+ for (let i3 = 0; i3 < len3; i3++) {
4486
+ let data14 = data13[i3];
4487
+ if (data14 && typeof data14 == "object" && !Array.isArray(data14)) {
4488
+ if (data14.events !== void 0) {
4489
+ let data15 = data14.events;
4490
+ if (Array.isArray(data15)) {
4491
+ const len4 = data15.length;
4492
+ for (let i4 = 0; i4 < len4; i4++) {
4493
+ let data16 = data15[i4];
4494
+ if (data16 && typeof data16 == "object" && !Array.isArray(data16)) {
4495
+ if (data16.type !== void 0) {
4496
+ let data17 = data16.type;
4497
+ const _errs36 = errors;
4498
+ const _errs37 = errors;
4499
+ if (!(data17 === "commit" || data17 === "branch")) {
4500
+ const err13 = {};
4501
+ if (vErrors === null) {
4502
+ vErrors = [err13];
4503
+ } else {
4504
+ vErrors.push(err13);
4505
+ }
4506
+ errors++;
4507
+ }
4508
+ var valid27 = _errs37 === errors;
4509
+ if (valid27) {
4510
+ const err14 = { instancePath: instancePath + "/steps/" + i3 + "/events/" + i4 + "/type", schemaPath: "#/definitions/plainSteps/items/properties/events/items/properties/type/not", keyword: "not", params: {}, message: "must NOT be valid" };
4511
+ if (vErrors === null) {
4512
+ vErrors = [err14];
4513
+ } else {
4514
+ vErrors.push(err14);
4515
+ }
4516
+ errors++;
4517
+ } else {
4518
+ errors = _errs36;
4519
+ if (vErrors !== null) {
4520
+ if (_errs36) {
4521
+ vErrors.length = _errs36;
4522
+ } else {
4523
+ vErrors = null;
4524
+ }
4525
+ }
4526
+ }
4527
+ }
4528
+ }
4529
+ }
4530
+ }
4531
+ }
4532
+ }
4533
+ }
4534
+ }
4535
+ }
4536
+ if (data.git !== void 0) {
4537
+ const err15 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
4538
+ if (vErrors === null) {
4539
+ vErrors = [err15];
4540
+ } else {
4541
+ vErrors.push(err15);
4542
+ }
4543
+ errors++;
4544
+ }
3477
4545
  }
3478
- var _valid1 = _errs13 === errors;
3479
- valid4 = _valid1;
4546
+ var _valid1 = _errs24 === errors;
4547
+ valid13 = _valid1;
3480
4548
  ifClause1 = "then";
3481
4549
  } else {
3482
- const _errs19 = errors;
3483
- const _errs20 = errors;
3484
- const _errs21 = errors;
4550
+ const _errs41 = errors;
4551
+ const _errs42 = errors;
4552
+ let valid29 = true;
4553
+ const _errs43 = errors;
3485
4554
  if (data && typeof data == "object" && !Array.isArray(data)) {
3486
- if (data.state === void 0 && ("state")) {
3487
- const err11 = {};
4555
+ if (data.kind === void 0 && ("kind")) {
4556
+ const err16 = {};
3488
4557
  if (vErrors === null) {
3489
- vErrors = [err11];
4558
+ vErrors = [err16];
3490
4559
  } else {
3491
- vErrors.push(err11);
4560
+ vErrors.push(err16);
3492
4561
  }
3493
4562
  errors++;
4563
+ } else {
4564
+ if (data.kind !== void 0) {
4565
+ if ("git" !== data.kind) {
4566
+ const err17 = {};
4567
+ if (vErrors === null) {
4568
+ vErrors = [err17];
4569
+ } else {
4570
+ vErrors.push(err17);
4571
+ }
4572
+ errors++;
4573
+ }
4574
+ }
3494
4575
  }
3495
4576
  }
3496
- var valid11 = _errs21 === errors;
3497
- if (valid11) {
3498
- const err12 = { instancePath, schemaPath: "#/else/else/not", keyword: "not", params: {}, message: "must NOT be valid" };
3499
- if (vErrors === null) {
3500
- vErrors = [err12];
4577
+ var _valid2 = _errs43 === errors;
4578
+ errors = _errs42;
4579
+ if (vErrors !== null) {
4580
+ if (_errs42) {
4581
+ vErrors.length = _errs42;
3501
4582
  } else {
3502
- vErrors.push(err12);
4583
+ vErrors = null;
3503
4584
  }
3504
- errors++;
4585
+ }
4586
+ let ifClause2;
4587
+ if (_valid2) {
4588
+ const _errs45 = errors;
4589
+ if (data && typeof data == "object" && !Array.isArray(data)) {
4590
+ if (data.git === void 0) {
4591
+ const err18 = { instancePath, schemaPath: "#/else/else/then/required", keyword: "required", params: { missingProperty: "git" }, message: "must have required property 'git'" };
4592
+ if (vErrors === null) {
4593
+ vErrors = [err18];
4594
+ } else {
4595
+ vErrors.push(err18);
4596
+ }
4597
+ errors++;
4598
+ }
4599
+ if (data.state !== void 0) {
4600
+ const err19 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
4601
+ if (vErrors === null) {
4602
+ vErrors = [err19];
4603
+ } else {
4604
+ vErrors.push(err19);
4605
+ }
4606
+ errors++;
4607
+ }
4608
+ if (data.regions !== void 0) {
4609
+ const err20 = { instancePath: instancePath + "/regions", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
4610
+ if (vErrors === null) {
4611
+ vErrors = [err20];
4612
+ } else {
4613
+ vErrors.push(err20);
4614
+ }
4615
+ errors++;
4616
+ }
4617
+ }
4618
+ var _valid2 = _errs45 === errors;
4619
+ valid29 = _valid2;
4620
+ ifClause2 = "then";
3505
4621
  } else {
3506
- errors = _errs20;
3507
- if (vErrors !== null) {
3508
- if (_errs20) {
3509
- vErrors.length = _errs20;
3510
- } else {
3511
- vErrors = null;
4622
+ const _errs52 = errors;
4623
+ if (data && typeof data == "object" && !Array.isArray(data)) {
4624
+ if (data.boxes !== void 0) {
4625
+ let data22 = data.boxes;
4626
+ if (Array.isArray(data22)) {
4627
+ if (data22.length < 1) {
4628
+ const err21 = { instancePath: instancePath + "/boxes", schemaPath: "#/else/else/else/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
4629
+ if (vErrors === null) {
4630
+ vErrors = [err21];
4631
+ } else {
4632
+ vErrors.push(err21);
4633
+ }
4634
+ errors++;
4635
+ }
4636
+ }
4637
+ }
4638
+ if (data.steps !== void 0) {
4639
+ let data23 = data.steps;
4640
+ if (Array.isArray(data23)) {
4641
+ const len5 = data23.length;
4642
+ for (let i5 = 0; i5 < len5; i5++) {
4643
+ let data24 = data23[i5];
4644
+ if (data24 && typeof data24 == "object" && !Array.isArray(data24)) {
4645
+ if (data24.events !== void 0) {
4646
+ let data25 = data24.events;
4647
+ if (Array.isArray(data25)) {
4648
+ const len6 = data25.length;
4649
+ for (let i6 = 0; i6 < len6; i6++) {
4650
+ let data26 = data25[i6];
4651
+ if (data26 && typeof data26 == "object" && !Array.isArray(data26)) {
4652
+ if (data26.type !== void 0) {
4653
+ let data27 = data26.type;
4654
+ const _errs60 = errors;
4655
+ const _errs61 = errors;
4656
+ if (!(data27 === "commit" || data27 === "branch")) {
4657
+ const err22 = {};
4658
+ if (vErrors === null) {
4659
+ vErrors = [err22];
4660
+ } else {
4661
+ vErrors.push(err22);
4662
+ }
4663
+ errors++;
4664
+ }
4665
+ var valid42 = _errs61 === errors;
4666
+ if (valid42) {
4667
+ const err23 = { instancePath: instancePath + "/steps/" + i5 + "/events/" + i6 + "/type", schemaPath: "#/definitions/plainSteps/items/properties/events/items/properties/type/not", keyword: "not", params: {}, message: "must NOT be valid" };
4668
+ if (vErrors === null) {
4669
+ vErrors = [err23];
4670
+ } else {
4671
+ vErrors.push(err23);
4672
+ }
4673
+ errors++;
4674
+ } else {
4675
+ errors = _errs60;
4676
+ if (vErrors !== null) {
4677
+ if (_errs60) {
4678
+ vErrors.length = _errs60;
4679
+ } else {
4680
+ vErrors = null;
4681
+ }
4682
+ }
4683
+ }
4684
+ }
4685
+ }
4686
+ }
4687
+ }
4688
+ }
4689
+ }
4690
+ }
4691
+ }
3512
4692
  }
4693
+ if (data.state !== void 0) {
4694
+ const err24 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
4695
+ if (vErrors === null) {
4696
+ vErrors = [err24];
4697
+ } else {
4698
+ vErrors.push(err24);
4699
+ }
4700
+ errors++;
4701
+ }
4702
+ if (data.git !== void 0) {
4703
+ const err25 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
4704
+ if (vErrors === null) {
4705
+ vErrors = [err25];
4706
+ } else {
4707
+ vErrors.push(err25);
4708
+ }
4709
+ errors++;
4710
+ }
4711
+ }
4712
+ var _valid2 = _errs52 === errors;
4713
+ valid29 = _valid2;
4714
+ ifClause2 = "else";
4715
+ }
4716
+ if (!valid29) {
4717
+ const err26 = { instancePath, schemaPath: "#/else/else/if", keyword: "if", params: { failingKeyword: ifClause2 }, message: 'must match "' + ifClause2 + '" schema' };
4718
+ if (vErrors === null) {
4719
+ vErrors = [err26];
4720
+ } else {
4721
+ vErrors.push(err26);
3513
4722
  }
4723
+ errors++;
3514
4724
  }
3515
- var _valid1 = _errs19 === errors;
3516
- valid4 = _valid1;
4725
+ var _valid1 = _errs41 === errors;
4726
+ valid13 = _valid1;
3517
4727
  ifClause1 = "else";
3518
4728
  }
3519
- if (!valid4) {
3520
- const err13 = { instancePath, schemaPath: "#/else/if", keyword: "if", params: { failingKeyword: ifClause1 }, message: 'must match "' + ifClause1 + '" schema' };
4729
+ if (!valid13) {
4730
+ const err27 = { instancePath, schemaPath: "#/else/if", keyword: "if", params: { failingKeyword: ifClause1 }, message: 'must match "' + ifClause1 + '" schema' };
3521
4731
  if (vErrors === null) {
3522
- vErrors = [err13];
4732
+ vErrors = [err27];
3523
4733
  } else {
3524
- vErrors.push(err13);
4734
+ vErrors.push(err27);
3525
4735
  }
3526
4736
  errors++;
3527
4737
  }
3528
- var _valid0 = _errs7 === errors;
4738
+ if (data && typeof data == "object" && !Array.isArray(data)) {
4739
+ if (data.sequence !== void 0) {
4740
+ const err28 = { instancePath: instancePath + "/sequence", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
4741
+ if (vErrors === null) {
4742
+ vErrors = [err28];
4743
+ } else {
4744
+ vErrors.push(err28);
4745
+ }
4746
+ errors++;
4747
+ }
4748
+ }
4749
+ var _valid0 = _errs20 === errors;
3529
4750
  valid0 = _valid0;
3530
4751
  ifClause0 = "else";
3531
4752
  }
3532
4753
  if (!valid0) {
3533
- const err14 = { instancePath, schemaPath: "#/if", keyword: "if", params: { failingKeyword: ifClause0 }, message: 'must match "' + ifClause0 + '" schema' };
4754
+ const err29 = { instancePath, schemaPath: "#/if", keyword: "if", params: { failingKeyword: ifClause0 }, message: 'must match "' + ifClause0 + '" schema' };
3534
4755
  if (vErrors === null) {
3535
- vErrors = [err14];
4756
+ vErrors = [err29];
3536
4757
  } else {
3537
- vErrors.push(err14);
4758
+ vErrors.push(err29);
3538
4759
  }
3539
4760
  errors++;
3540
4761
  }
3541
4762
  if (data && typeof data == "object" && !Array.isArray(data)) {
3542
4763
  if (data.version === void 0) {
3543
- const err15 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "version" }, message: "must have required property 'version'" };
4764
+ const err30 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "version" }, message: "must have required property 'version'" };
3544
4765
  if (vErrors === null) {
3545
- vErrors = [err15];
4766
+ vErrors = [err30];
3546
4767
  } else {
3547
- vErrors.push(err15);
4768
+ vErrors.push(err30);
3548
4769
  }
3549
4770
  errors++;
3550
4771
  }
3551
4772
  if (data.kind === void 0) {
3552
- const err16 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "kind" }, message: "must have required property 'kind'" };
4773
+ const err31 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "kind" }, message: "must have required property 'kind'" };
3553
4774
  if (vErrors === null) {
3554
- vErrors = [err16];
4775
+ vErrors = [err31];
3555
4776
  } else {
3556
- vErrors.push(err16);
4777
+ vErrors.push(err31);
3557
4778
  }
3558
4779
  errors++;
3559
4780
  }
3560
4781
  if (data.title === void 0) {
3561
- const err17 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "title" }, message: "must have required property 'title'" };
4782
+ const err32 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "title" }, message: "must have required property 'title'" };
3562
4783
  if (vErrors === null) {
3563
- vErrors = [err17];
4784
+ vErrors = [err32];
3564
4785
  } else {
3565
- vErrors.push(err17);
4786
+ vErrors.push(err32);
3566
4787
  }
3567
4788
  errors++;
3568
4789
  }
3569
4790
  if (data.boxes === void 0) {
3570
- const err18 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "boxes" }, message: "must have required property 'boxes'" };
4791
+ const err33 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "boxes" }, message: "must have required property 'boxes'" };
3571
4792
  if (vErrors === null) {
3572
- vErrors = [err18];
4793
+ vErrors = [err33];
3573
4794
  } else {
3574
- vErrors.push(err18);
4795
+ vErrors.push(err33);
3575
4796
  }
3576
4797
  errors++;
3577
4798
  }
3578
4799
  if (data.steps === void 0) {
3579
- const err19 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "steps" }, message: "must have required property 'steps'" };
4800
+ const err34 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "steps" }, message: "must have required property 'steps'" };
3580
4801
  if (vErrors === null) {
3581
- vErrors = [err19];
4802
+ vErrors = [err34];
3582
4803
  } else {
3583
- vErrors.push(err19);
4804
+ vErrors.push(err34);
3584
4805
  }
3585
4806
  errors++;
3586
4807
  }
3587
4808
  for (const key0 in data) {
3588
4809
  if (!func2.call(schema11.properties, key0)) {
3589
- const err20 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
4810
+ const err35 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
3590
4811
  if (vErrors === null) {
3591
- vErrors = [err20];
4812
+ vErrors = [err35];
3592
4813
  } else {
3593
- vErrors.push(err20);
4814
+ vErrors.push(err35);
3594
4815
  }
3595
4816
  errors++;
3596
4817
  }
3597
4818
  }
3598
4819
  if (data.version !== void 0) {
3599
- let data5 = data.version;
3600
- if (!(typeof data5 == "number" && (!(data5 % 1) && !isNaN(data5)) && isFinite(data5))) {
3601
- const err21 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
4820
+ let data31 = data.version;
4821
+ if (!(typeof data31 == "number" && (!(data31 % 1) && !isNaN(data31)) && isFinite(data31))) {
4822
+ const err36 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
3602
4823
  if (vErrors === null) {
3603
- vErrors = [err21];
4824
+ vErrors = [err36];
3604
4825
  } else {
3605
- vErrors.push(err21);
4826
+ vErrors.push(err36);
3606
4827
  }
3607
4828
  errors++;
3608
4829
  }
3609
- if (typeof data5 == "number" && isFinite(data5)) {
3610
- if (data5 < 1 || isNaN(data5)) {
3611
- const err22 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
4830
+ if (typeof data31 == "number" && isFinite(data31)) {
4831
+ if (data31 < 1 || isNaN(data31)) {
4832
+ const err37 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
3612
4833
  if (vErrors === null) {
3613
- vErrors = [err22];
4834
+ vErrors = [err37];
3614
4835
  } else {
3615
- vErrors.push(err22);
4836
+ vErrors.push(err37);
3616
4837
  }
3617
4838
  errors++;
3618
4839
  }
3619
4840
  }
3620
4841
  }
3621
4842
  if (data.kind !== void 0) {
3622
- let data6 = data.kind;
3623
- if (!(data6 === "sequence" || data6 === "architecture" || data6 === "state")) {
3624
- const err23 = { instancePath: instancePath + "/kind", schemaPath: "#/properties/kind/enum", keyword: "enum", params: { allowedValues: schema11.properties.kind.enum }, message: "must be equal to one of the allowed values" };
4843
+ let data32 = data.kind;
4844
+ if (!(data32 === "sequence" || data32 === "architecture" || data32 === "state" || data32 === "git")) {
4845
+ const err38 = { instancePath: instancePath + "/kind", schemaPath: "#/properties/kind/enum", keyword: "enum", params: { allowedValues: schema11.properties.kind.enum }, message: "must be equal to one of the allowed values" };
3625
4846
  if (vErrors === null) {
3626
- vErrors = [err23];
4847
+ vErrors = [err38];
3627
4848
  } else {
3628
- vErrors.push(err23);
4849
+ vErrors.push(err38);
3629
4850
  }
3630
4851
  errors++;
3631
4852
  }
3632
4853
  }
3633
4854
  if (data.title !== void 0) {
3634
- let data7 = data.title;
3635
- if (typeof data7 === "string") {
3636
- if (func3(data7) < 1) {
3637
- const err24 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
4855
+ let data33 = data.title;
4856
+ if (typeof data33 === "string") {
4857
+ if (func3(data33) < 1) {
4858
+ const err39 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
3638
4859
  if (vErrors === null) {
3639
- vErrors = [err24];
4860
+ vErrors = [err39];
3640
4861
  } else {
3641
- vErrors.push(err24);
4862
+ vErrors.push(err39);
3642
4863
  }
3643
4864
  errors++;
3644
4865
  }
3645
4866
  } else {
3646
- const err25 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
4867
+ const err40 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3647
4868
  if (vErrors === null) {
3648
- vErrors = [err25];
4869
+ vErrors = [err40];
3649
4870
  } else {
3650
- vErrors.push(err25);
4871
+ vErrors.push(err40);
3651
4872
  }
3652
4873
  errors++;
3653
4874
  }
3654
4875
  }
3655
4876
  if (data.view !== void 0) {
3656
- let data8 = data.view;
3657
- if (!(data8 === "fixed" || data8 === "follow")) {
3658
- const err26 = { instancePath: instancePath + "/view", schemaPath: "#/properties/view/enum", keyword: "enum", params: { allowedValues: schema11.properties.view.enum }, message: "must be equal to one of the allowed values" };
4877
+ let data34 = data.view;
4878
+ if (!(data34 === "fixed" || data34 === "follow")) {
4879
+ const err41 = { instancePath: instancePath + "/view", schemaPath: "#/properties/view/enum", keyword: "enum", params: { allowedValues: schema11.properties.view.enum }, message: "must be equal to one of the allowed values" };
3659
4880
  if (vErrors === null) {
3660
- vErrors = [err26];
4881
+ vErrors = [err41];
3661
4882
  } else {
3662
- vErrors.push(err26);
4883
+ vErrors.push(err41);
3663
4884
  }
3664
4885
  errors++;
3665
4886
  }
3666
4887
  }
3667
4888
  if (data.regions !== void 0) {
3668
- let data9 = data.regions;
3669
- if (Array.isArray(data9)) {
3670
- const len1 = data9.length;
3671
- for (let i1 = 0; i1 < len1; i1++) {
3672
- if (!validate11(data9[i1], { instancePath: instancePath + "/regions/" + i1, parentData: data9, parentDataProperty: i1, rootData })) {
4889
+ let data35 = data.regions;
4890
+ if (Array.isArray(data35)) {
4891
+ const len7 = data35.length;
4892
+ for (let i7 = 0; i7 < len7; i7++) {
4893
+ if (!validate11(data35[i7], { instancePath: instancePath + "/regions/" + i7, parentData: data35, parentDataProperty: i7, rootData })) {
3673
4894
  vErrors = vErrors === null ? validate11.errors : vErrors.concat(validate11.errors);
3674
4895
  errors = vErrors.length;
3675
4896
  }
3676
4897
  }
3677
4898
  } else {
3678
- const err27 = { instancePath: instancePath + "/regions", schemaPath: "#/properties/regions/type", keyword: "type", params: { type: "array" }, message: "must be array" };
4899
+ const err42 = { instancePath: instancePath + "/regions", schemaPath: "#/properties/regions/type", keyword: "type", params: { type: "array" }, message: "must be array" };
3679
4900
  if (vErrors === null) {
3680
- vErrors = [err27];
4901
+ vErrors = [err42];
3681
4902
  } else {
3682
- vErrors.push(err27);
4903
+ vErrors.push(err42);
3683
4904
  }
3684
4905
  errors++;
3685
4906
  }
3686
4907
  }
3687
4908
  if (data.boxes !== void 0) {
3688
- let data11 = data.boxes;
3689
- if (Array.isArray(data11)) {
3690
- if (data11.length < 1) {
3691
- const err28 = { instancePath: instancePath + "/boxes", schemaPath: "#/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
3692
- if (vErrors === null) {
3693
- vErrors = [err28];
3694
- } else {
3695
- vErrors.push(err28);
3696
- }
3697
- errors++;
3698
- }
3699
- const len2 = data11.length;
3700
- for (let i2 = 0; i2 < len2; i2++) {
3701
- if (!validate13(data11[i2], { instancePath: instancePath + "/boxes/" + i2, parentData: data11, parentDataProperty: i2, rootData })) {
4909
+ let data37 = data.boxes;
4910
+ if (Array.isArray(data37)) {
4911
+ const len8 = data37.length;
4912
+ for (let i8 = 0; i8 < len8; i8++) {
4913
+ if (!validate13(data37[i8], { instancePath: instancePath + "/boxes/" + i8, parentData: data37, parentDataProperty: i8, rootData })) {
3702
4914
  vErrors = vErrors === null ? validate13.errors : vErrors.concat(validate13.errors);
3703
4915
  errors = vErrors.length;
3704
4916
  }
3705
4917
  }
3706
4918
  } else {
3707
- const err29 = { instancePath: instancePath + "/boxes", schemaPath: "#/properties/boxes/type", keyword: "type", params: { type: "array" }, message: "must be array" };
4919
+ const err43 = { instancePath: instancePath + "/boxes", schemaPath: "#/properties/boxes/type", keyword: "type", params: { type: "array" }, message: "must be array" };
3708
4920
  if (vErrors === null) {
3709
- vErrors = [err29];
4921
+ vErrors = [err43];
3710
4922
  } else {
3711
- vErrors.push(err29);
4923
+ vErrors.push(err43);
3712
4924
  }
3713
4925
  errors++;
3714
4926
  }
@@ -3720,30 +4932,30 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
3720
4932
  }
3721
4933
  }
3722
4934
  if (data.steps !== void 0) {
3723
- let data14 = data.steps;
3724
- if (Array.isArray(data14)) {
3725
- if (data14.length < 1) {
3726
- const err30 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
4935
+ let data40 = data.steps;
4936
+ if (Array.isArray(data40)) {
4937
+ if (data40.length < 1) {
4938
+ const err44 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
3727
4939
  if (vErrors === null) {
3728
- vErrors = [err30];
4940
+ vErrors = [err44];
3729
4941
  } else {
3730
- vErrors.push(err30);
4942
+ vErrors.push(err44);
3731
4943
  }
3732
4944
  errors++;
3733
4945
  }
3734
- const len3 = data14.length;
3735
- for (let i3 = 0; i3 < len3; i3++) {
3736
- if (!validate17(data14[i3], { instancePath: instancePath + "/steps/" + i3, parentData: data14, parentDataProperty: i3, rootData })) {
4946
+ const len9 = data40.length;
4947
+ for (let i9 = 0; i9 < len9; i9++) {
4948
+ if (!validate17(data40[i9], { instancePath: instancePath + "/steps/" + i9, parentData: data40, parentDataProperty: i9, rootData })) {
3737
4949
  vErrors = vErrors === null ? validate17.errors : vErrors.concat(validate17.errors);
3738
4950
  errors = vErrors.length;
3739
4951
  }
3740
4952
  }
3741
4953
  } else {
3742
- const err31 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/type", keyword: "type", params: { type: "array" }, message: "must be array" };
4954
+ const err45 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/type", keyword: "type", params: { type: "array" }, message: "must be array" };
3743
4955
  if (vErrors === null) {
3744
- vErrors = [err31];
4956
+ vErrors = [err45];
3745
4957
  } else {
3746
- vErrors.push(err31);
4958
+ vErrors.push(err45);
3747
4959
  }
3748
4960
  errors++;
3749
4961
  }
@@ -3760,12 +4972,18 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
3760
4972
  errors = vErrors.length;
3761
4973
  }
3762
4974
  }
4975
+ if (data.git !== void 0) {
4976
+ if (!validate29(data.git, { instancePath: instancePath + "/git", parentData: data, parentDataProperty: "git", rootData })) {
4977
+ vErrors = vErrors === null ? validate29.errors : vErrors.concat(validate29.errors);
4978
+ errors = vErrors.length;
4979
+ }
4980
+ }
3763
4981
  } else {
3764
- const err32 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
4982
+ const err46 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
3765
4983
  if (vErrors === null) {
3766
- vErrors = [err32];
4984
+ vErrors = [err46];
3767
4985
  } else {
3768
- vErrors.push(err32);
4986
+ vErrors.push(err46);
3769
4987
  }
3770
4988
  errors++;
3771
4989
  }
@@ -3774,17 +4992,17 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
3774
4992
  }
3775
4993
 
3776
4994
  // src/schema.ts
3777
- var EVENT_TYPES = ["edge", "action", "swap", "strip"];
3778
- var ROOT_NOT_ALLOWED = {
3779
- "#/else/not": { field: "sequence", kind: "sequence" },
3780
- "#/then/not": { field: "state", kind: "state" },
3781
- "#/else/else/not": { field: "state", kind: "state" }
3782
- };
4995
+ var EVENT_TYPES = ["edge", "action", "swap", "strip", "commit", "branch"];
4996
+ var ABSENT = "#/definitions/absent/not";
4997
+ var ABSENT_KINDS = { regions: "sequence / architecture / state" };
3783
4998
  var NOT_ALLOWED = {
3784
4999
  carry: { field: "text", kind: "tag" }
3785
5000
  };
3786
5001
  var RESERVED_ID = /\/boxes\/items\/properties\/id\/not$/u;
5002
+ var GIT_EVENT = /\/events\/items\/properties\/type\/not$/u;
5003
+ var GIT_EVENTS = ["commit", "branch"];
3787
5004
  var escape = (key) => key.replaceAll("~", "~0").replaceAll("/", "~1");
5005
+ var HEX = /^\^\[0-9a-f\]\{(\d+),(\d+)\}\$$/u;
3788
5006
  function forbiddenOf(pattern) {
3789
5007
  const inside = /^\^\[\^(.+)\]\+\$$/u.exec(pattern)?.[1];
3790
5008
  if (inside === void 0) return void 0;
@@ -3808,7 +5026,10 @@ function toFieldError(error, errors, m) {
3808
5026
  }
3809
5027
  case "not": {
3810
5028
  if (RESERVED_ID.test(error.schemaPath)) return { pointer: at2, message: m.reserved(STATE_ENDS) };
3811
- const allowed = at2 === "" ? ROOT_NOT_ALLOWED[error.schemaPath] : NOT_ALLOWED[at2.slice(at2.lastIndexOf("/") + 1)];
5029
+ if (GIT_EVENT.test(error.schemaPath)) return { pointer: at2, message: m.kindOnly(GIT_EVENTS, "git") };
5030
+ const last = at2.slice(at2.lastIndexOf("/") + 1);
5031
+ if (error.schemaPath === ABSENT) return { pointer: at2, message: m.not({ field: last, kind: ABSENT_KINDS[last] ?? last }) };
5032
+ const allowed = NOT_ALLOWED[last];
3812
5033
  return { pointer: allowed ? `${at2}/${allowed.field}` : at2, message: m.not(allowed) };
3813
5034
  }
3814
5035
  case "anyOf": {
@@ -3826,8 +5047,10 @@ function toFieldError(error, errors, m) {
3826
5047
  return { pointer: at2, message: m.type(String(params.type)) };
3827
5048
  case "minLength":
3828
5049
  return { pointer: at2, message: m.minLength(Number(params.limit)) };
3829
- case "pattern":
3830
- return { pointer: at2, message: m.pattern(forbiddenOf(String(params.pattern))) };
5050
+ case "pattern": {
5051
+ const hex2 = HEX.exec(String(params.pattern));
5052
+ return { pointer: at2, message: hex2 ? m.hex(Number(hex2[1]), Number(hex2[2])) : m.pattern(forbiddenOf(String(params.pattern))) };
5053
+ }
3831
5054
  case "minItems":
3832
5055
  return { pointer: at2, message: m.minItems(Number(params.limit)) };
3833
5056
  case "minimum":
@@ -3875,7 +5098,15 @@ function plan(step) {
3875
5098
  let arrived;
3876
5099
  let changes = 0;
3877
5100
  step.events.forEach((event, e) => {
3878
- if (event.type === "edge") {
5101
+ if (event.type === "commit" || event.type === "branch") {
5102
+ const a = cursor;
5103
+ const b = a + MOTION.draw;
5104
+ out.edges.push({ event: e, a, b, carries: false, coin: false, named: false });
5105
+ cursor = a + MOTION.stagger;
5106
+ arrived = b;
5107
+ changes = 0;
5108
+ out.busy = Math.max(out.busy, b);
5109
+ } else if (event.type === "edge") {
3879
5110
  const carries = event.carry.kind !== "none";
3880
5111
  const a = cursor;
3881
5112
  const b = a + (carries ? MOTION.drawCarry : MOTION.draw);
@@ -3920,7 +5151,9 @@ function buildTimeline(diagram) {
3920
5151
  for (const edge2 of p.edges) {
3921
5152
  const a = span.start + edge2.a;
3922
5153
  edges.push({ step: s, event: edge2.event, start: a, drawn: span.start + edge2.b, end: span.end });
3923
- if (edge2.carries) departures.push({ step: s, event: edge2.event, who: edge2.coin ? "coin" : "main", a, b: span.start + edge2.b });
5154
+ const event = diagram.steps[s]?.events[edge2.event];
5155
+ const own = diagram.kind === "git" && event?.type === "edge" && event.carry.kind === "tag" && event.carry.text === event.from;
5156
+ if (edge2.carries && !own) departures.push({ step: s, event: edge2.event, who: edge2.coin ? "coin" : "main", a, b: span.start + edge2.b });
3924
5157
  if (edge2.named) named.push({ step: s, event: edge2.event, start: a + MOTION.labelDelay, end: span.end });
3925
5158
  }
3926
5159
  named.forEach((label2, k) => {
@@ -4400,6 +5633,123 @@ function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map(
4400
5633
  return parts.join("");
4401
5634
  }
4402
5635
 
5636
+ // src/render/git.ts
5637
+ var r12 = (v) => Math.round(v * 100) / 100;
5638
+ var center = (r) => [r.x + r.w / 2, r.y + r.h / 2];
5639
+ function tagShape(text2, sh) {
5640
+ const C = LOOK.carrier;
5641
+ const ja2 = hasWide(text2);
5642
+ const w = textWidth(text2, ja2 ? TYPE.carrierJa : TYPE.carrier) + C.tagPadX * 2;
5643
+ return `<rect class="dg-car" x="${r12(-w / 2)}" y="${ -18 / 2}" width="${r12(w)}" height="${C.tagH}" rx="${C.tagH / 2}" ${sh}/><text class="dg-car-t${ja2 ? " dg-car-tj" : ""}" y="${LOOK.baseline.carrier}" text-anchor="middle">${esc(text2)}</text>`;
5644
+ }
5645
+ function drawGit(layout, diagram, timeline, ctx) {
5646
+ const { m } = ctx;
5647
+ const G = LOOK.git;
5648
+ const timeOf = (step, event) => timeline.edges.find((t) => t.step === step && t.event === event);
5649
+ const links = layout.links.map((l) => {
5650
+ const time = timeOf(l.step, l.event);
5651
+ if (!time) return "";
5652
+ ctx.traces.push({ from: l.from, to: l.to, points: l.points, shown: [[time.start, Number.POSITIVE_INFINITY]] });
5653
+ const d = pathOf(l.points);
5654
+ if (l.kind === "copy") return `<g style="${cs(l.color)}"><path class="dg-git-cp dg-a" d="${d}" style="${m.vis(time.start, m.last)}"/></g>`;
5655
+ const kf = m.kf([
5656
+ [0, { opacity: 0, "stroke-dashoffset": 1 }],
5657
+ [time.start, { opacity: 0, "stroke-dashoffset": 1 }, EASE.inOut],
5658
+ [time.start + 0.05, { opacity: 1 }],
5659
+ [time.drawn, { "stroke-dashoffset": 0 }],
5660
+ [m.last, { opacity: 1, "stroke-dashoffset": 0 }, EASE.inOut],
5661
+ [m.total, { opacity: 0, "stroke-dashoffset": 0 }]
5662
+ ]);
5663
+ return `<g style="${cs(l.color)}"><path class="dg-git-l dg-a" pathLength="1" d="${d}" style="${kf}"/></g>`;
5664
+ }).join("");
5665
+ const commits = layout.commits.map((c) => {
5666
+ const at2 = timeOf(c.step, c.event)?.drawn ?? 0;
5667
+ const ring = { x: c.cx - c.r, y: c.cy - c.r, w: c.r * 2, h: c.r * 2 };
5668
+ ctx.ink.push({ text: c.id, rect: ring, shown: [[at2, Number.POSITIVE_INFINITY]], boxed: true });
5669
+ const lines2 = (c.text?.lines ?? []).map((line, k) => {
5670
+ const hash = k === 0 && c.hash !== void 0;
5671
+ const baseline = c.text?.baselines[k] ?? c.cy;
5672
+ return write(ctx.ink, hash ? "dg-git-h" : "dg-git-n", c.cx, baseline, line, hash ? TYPE.gitHash : TYPE.gitNote, [[at2, Number.POSITIVE_INFINITY]], "middle");
5673
+ }).join("");
5674
+ const id = `<text class="dg-git-id" x="${r12(c.cx)}" y="${r12(c.cy + LOOK.baseline.badge)}" text-anchor="middle">${esc(c.id)}</text>`;
5675
+ const node = `<g class="dg-popc dg-a" style="${m.pop(at2)}"><circle class="dg-git-c" cx="${r12(c.cx)}" cy="${r12(c.cy)}" r="${c.r}" ${ctx.sh}/>${id}</g>`;
5676
+ const text2 = lines2 === "" ? "" : `<g class="dg-a" style="${m.vis(at2)}">${lines2}</g>`;
5677
+ const orphanAt = c.orphan === void 0 ? void 0 : timeOf(c.orphan, c.orphanEvent ?? 0)?.drawn;
5678
+ const orphan = orphanAt === void 0 ? "" : `<g class="dg-a" data-orphan="${esc(c.id)}" style="${m.vis(orphanAt, m.last, { f: 0.5 })}"><circle class="dg-git-old" cx="${r12(c.cx)}" cy="${r12(c.cy)}" r="${G.orphan}"/><text class="dg-git-oldl" x="${r12(c.cx)}" y="${r12(c.cy + LOOK.baseline.badge)}" text-anchor="middle">${esc(c.id)}</text></g>`;
5679
+ return `<g data-commit="${esc(c.id)}" style="${cs(c.color)}">${node}${text2}${orphan}</g>`;
5680
+ }).join("");
5681
+ const lines = layout.moves.flatMap((mv) => {
5682
+ const time = timeOf(mv.step, mv.event);
5683
+ if (!mv.line || !time) return [];
5684
+ const end = timeline.steps[mv.step].end;
5685
+ ctx.traces.push({ from: mv.ref, to: mv.target ?? mv.ref, points: mv.line, shown: [[time.start, end + 0.4]] });
5686
+ const kf = m.kf([
5687
+ [0, { opacity: 0, "stroke-dashoffset": 1 }],
5688
+ [time.start, { opacity: 0, "stroke-dashoffset": 1 }, EASE.inOut],
5689
+ [time.start + 0.05, { opacity: 1 }],
5690
+ [time.drawn, { "stroke-dashoffset": 0 }],
5691
+ [end, { opacity: 1 }, EASE.inOut],
5692
+ [end + 0.4, { opacity: 0 }],
5693
+ [m.total, { opacity: 0, "stroke-dashoffset": 0 }]
5694
+ ]);
5695
+ return [`<g style="${cs(mv.color)}"><path class="dg-e-on dg-a" pathLength="1" d="${pathOf(mv.line)}" style="${kf}"/></g>`];
5696
+ }).join("");
5697
+ const carried = timeline.carriers.flatMap((t) => {
5698
+ const mv = layout.moves.find((x) => x.step === t.step && x.event === t.event && x.line);
5699
+ const source = diagram.steps[t.step]?.events[t.event];
5700
+ if (!mv?.line || source?.type !== "edge") return [];
5701
+ const edge2 = { step: t.step, event: t.event, from: mv.ref, to: mv.target ?? mv.ref, points: mv.line, color: mv.color, carry: source.carry };
5702
+ return [carrier(edge2, { ...t, start: t.depart, end: t.arrive + MOTION.fade }, ctx)];
5703
+ }).join("");
5704
+ const refs = [...new Set(layout.moves.map((mv) => mv.ref))];
5705
+ const tags = refs.map((ref) => tagMotion(ref, layout.moves.filter((mv) => mv.ref === ref), timeOf, ctx)).join("") + carried;
5706
+ return { links, lines, commits, tags };
5707
+ }
5708
+ function tagMotion(ref, list, timeOf, ctx) {
5709
+ const { m } = ctx;
5710
+ const points = [];
5711
+ const fades = [[0, { opacity: 0 }]];
5712
+ let on = false;
5713
+ let rest;
5714
+ const leave = (t) => {
5715
+ if (rest) ctx.ink.push({ text: ref, rect: rest.rect, shown: [[rest.since, t]], boxed: true });
5716
+ rest = void 0;
5717
+ };
5718
+ for (const mv of list) {
5719
+ const time = timeOf(mv.step, mv.event);
5720
+ if (!time) continue;
5721
+ const { start: a, drawn: b } = time;
5722
+ const from = mv.from ? center(mv.from) : void 0;
5723
+ const to = mv.to ? center(mv.to) : void 0;
5724
+ leave(a);
5725
+ if (mv.carried && from && to && on) {
5726
+ points.push([a + MOTION.fade, from[0], from[1]], [b - MOTION.fade, to[0], to[1]]);
5727
+ fades.push([a, { opacity: 1 }, EASE.inOut], [a + MOTION.fade, { opacity: 0 }], [b - MOTION.fade, { opacity: 0 }, EASE.out], [b, { opacity: 1 }]);
5728
+ rest = { rect: mv.to, since: b };
5729
+ continue;
5730
+ }
5731
+ if (from) points.push([a, from[0], from[1]]);
5732
+ if (to) points.push([b, to[0], to[1]]);
5733
+ if (to && !on) {
5734
+ const show = from ? a : b - MOTION.fade;
5735
+ fades.push([show, { opacity: 0 }, EASE.out], [show + MOTION.fade, { opacity: 1 }]);
5736
+ on = true;
5737
+ } else if (!to && on) {
5738
+ fades.push([b, { opacity: 1 }, EASE.inOut], [b + MOTION.untilFade, { opacity: 0 }]);
5739
+ on = false;
5740
+ }
5741
+ if (mv.to) rest = { rect: mv.to, since: b };
5742
+ }
5743
+ leave(Number.POSITIVE_INFINITY);
5744
+ if (points.length === 0) return "";
5745
+ const first = points[0];
5746
+ const last = points[points.length - 1];
5747
+ if (on) fades.push([m.last, { opacity: 1 }, EASE.inOut], [m.total, { opacity: 0 }]);
5748
+ else fades.push([m.total, { opacity: 0 }]);
5749
+ const style = m.move([[0, first[1], first[2]], ...points, [m.total, last[1], last[2]]], fades);
5750
+ return `<g class="dg-a" data-ref="${esc(ref)}" style="${style}">${tagShape(ref, ctx.sh)}</g>`;
5751
+ }
5752
+
4403
5753
  // src/render/motion.ts
4404
5754
  var r2 = (v) => Math.round(v * 100) / 100;
4405
5755
  var Motion = class {
@@ -4570,6 +5920,14 @@ var PART_CSS = [
4570
5920
  `.dg-mark{${font(TYPE.regionNote)};fill:var(--mute)}`,
4571
5921
  `.dg-done{fill:var(--ink);stroke:var(--surf);stroke-width:${S.done}}`,
4572
5922
  `.dg-done-ck{fill:none;stroke:var(--surf);stroke-width:${S.glyph};stroke-linecap:round;stroke-linejoin:round}`,
5923
+ `.dg-git-l{fill:none;stroke:var(--c);stroke-width:${S.git};stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1 2}`,
5924
+ `.dg-git-cp{fill:none;stroke:var(--c);stroke-width:${S.gitOrphan};stroke-linecap:round;stroke-dasharray:3 3;stroke-opacity:.7}`,
5925
+ `.dg-git-c{fill:var(--surf);stroke:var(--c);stroke-width:${S.git}}`,
5926
+ `.dg-git-id{${font(TYPE.gitId)};fill:var(--ct)}`,
5927
+ `.dg-git-h{${font(TYPE.gitHash)};fill:var(--mute)}`,
5928
+ `.dg-git-n{${font(TYPE.gitNote)};fill:var(--ink2)}`,
5929
+ `.dg-git-old{fill:var(--surf);stroke:var(--c);stroke-width:${S.gitOrphan};stroke-dasharray:3 3;stroke-opacity:.6}`,
5930
+ `.dg-git-oldl{${font(TYPE.gitId)};fill:var(--ct);opacity:.55}`,
4573
5931
  ".dg-vp-bg{fill:var(--bg)}",
4574
5932
  ".dg-vp-frame{fill:none;stroke:var(--hair)}",
4575
5933
  ".dg-hd-bg{fill:var(--bg)}",
@@ -4676,6 +6034,13 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], tr
4676
6034
  const arrivals = new Map((timeline.states ?? []).flatMap((s) => s.lit[0] ? [[s.box, s.lit[0].start]] : []));
4677
6035
  if (layout.strip) L.band.push(strip(layout.strip, fieldChanges(diagram, timeline, layout), ctx, isState, arrivals));
4678
6036
  for (const line of layout.lifelines) L.base.push(lifeline(line.x, line.y1, line.y2));
6037
+ if (isGitLayout(layout)) {
6038
+ const git = drawGit(layout, diagram, timeline, ctx);
6039
+ L.base.push(git.links);
6040
+ L.lit.push(git.lines);
6041
+ L.node.push(git.commits);
6042
+ L.top.push(git.tags);
6043
+ }
4679
6044
  for (const e of layout.edges) {
4680
6045
  const time = timeline.edges.find((t) => t.step === e.step && t.event === e.event);
4681
6046
  if (!time) continue;
@@ -4714,14 +6079,14 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], tr
4714
6079
  const css = `.dg-${id}{${FONT_VARS};--T:${timeline.total}s;${paletteVars(palette, theme)}}${PART_CSS}${m.frames.join("")}`;
4715
6080
  return `<svg xmlns="http://www.w3.org/2000/svg" class="dg dg-${id}" viewBox="0 0 ${Math.ceil(view.w)} ${Math.ceil(view.h)}" width="${Math.ceil(view.w)}" height="${Math.ceil(view.h)}" role="img" aria-label="${esc(diagram.title)}" data-dragon="figure" data-view="${follow ? "follow" : "fixed"}"><style>${css}</style><defs>${shadow}</defs>${view.body}</svg>`;
4716
6081
  }
4717
- function union(rects) {
6082
+ function union2(rects) {
4718
6083
  const x = Math.min(...rects.map((r) => r.x));
4719
6084
  const y = Math.min(...rects.map((r) => r.y));
4720
6085
  return { x, y, w: Math.max(...rects.map((r) => r.x + r.w)) - x, h: Math.max(...rects.map((r) => r.y + r.h)) - y };
4721
6086
  }
4722
6087
  function focusOf(layout, diagram, step) {
4723
6088
  const rects = focusParts(layout, diagram, step);
4724
- return rects.length === 0 ? void 0 : union(rects);
6089
+ return rects.length === 0 ? void 0 : union2(rects);
4725
6090
  }
4726
6091
  function badgeFocus(badge2, parts, vw, vh) {
4727
6092
  const room = LOOK.badge.r + LOOK.follow.badgeRoom;
@@ -4729,7 +6094,7 @@ function badgeFocus(badge2, parts, vw, vh) {
4729
6094
  const away = (p) => Math.hypot(Math.max(0, p.x - bx, bx - p.x - p.w), Math.max(0, p.y - by, by - p.y - p.h));
4730
6095
  let held = { x: bx - room, y: by - room, w: room * 2, h: room * 2 };
4731
6096
  for (const p of [...parts].sort((a, b) => away(a) - away(b))) {
4732
- const next = union([held, p]);
6097
+ const next = union2([held, p]);
4733
6098
  if (next.w <= vw && next.h <= vh) held = next;
4734
6099
  }
4735
6100
  return held;
@@ -4827,7 +6192,7 @@ function renderDiagram(input, options = {}) {
4827
6192
  const read = readDiagram(input, { lang });
4828
6193
  if (!read.ok) throw new Error(FIGURE_TEXT[lang].cannotDraw(read.errors.map((e) => `${e.pointer} ${e.message}`).join(" / ")));
4829
6194
  const diagram = read.diagram;
4830
- const layout = diagram.kind === "sequence" ? layoutSequence(diagram) : diagram.kind === "state" ? layoutState(diagram, lang) : layoutArchitecture(diagram);
6195
+ const layout = diagram.kind === "sequence" ? layoutSequence(diagram) : diagram.kind === "state" ? layoutState(diagram, lang) : diagram.kind === "git" ? layoutGit(diagram) : layoutArchitecture(diagram);
4831
6196
  return renderLayout(diagram, layout, buildTimeline(diagram), options);
4832
6197
  }
4833
6198
  function renderLayout(diagram, layout, timeline, options = {}) {
@@ -4864,7 +6229,7 @@ var pad = (n) => String(n).padStart(2, "0");
4864
6229
  var stepNo = (step, count) => `${pad(step + 1)}/${pad(count)}`;
4865
6230
  var require_ = createRequire(import.meta.url);
4866
6231
  var SCRIPTS = {
4867
- "/mediabunny.js": join(dirname(require_.resolve("mediabunny")), "mediabunny.min.mjs"),
6232
+ "/mediabunny.js": join$1(dirname(require_.resolve("mediabunny")), "mediabunny.min.mjs"),
4868
6233
  "/gifenc.js": require_.resolve("gifenc/dist/gifenc.esm.js")
4869
6234
  };
4870
6235
  var SCALE = 2;
@@ -5086,7 +6451,7 @@ async function fontFaces(chars) {
5086
6451
  const faces = await Promise.all(
5087
6452
  PACKAGES.flatMap(({ family, name }) => {
5088
6453
  const base = dirname(require_2.resolve(`@fontsource-variable/${name}/unicode.json`));
5089
- const table = JSON.parse(readFileSync(join(base, "unicode.json"), "utf8"));
6454
+ const table = JSON.parse(readFileSync(join$1(base, "unicode.json"), "utf8"));
5090
6455
  return Object.entries(table).map(async ([key, list]) => {
5091
6456
  const span = ranges(list);
5092
6457
  const own = chars.filter((char) => {
@@ -5094,7 +6459,7 @@ async function fontFaces(chars) {
5094
6459
  return span.some(([from, to]) => code >= from && code <= to);
5095
6460
  });
5096
6461
  if (!own.length) return "";
5097
- const file = join(base, "files", `${name}-${key.replace(/[[\]]/g, "")}-wght-normal.woff2`);
6462
+ const file = join$1(base, "files", `${name}-${key.replace(/[[\]]/g, "")}-wght-normal.woff2`);
5098
6463
  const woff2 = await subsetFont(await readFile(file), own.join(""), { targetFormat: "woff2", variationAxes: { wght: WEIGHT } });
5099
6464
  const unicode = own.map((char) => hex(char.codePointAt(0) ?? 0)).join(",");
5100
6465
  return `@font-face{font-family:"${family}";font-style:normal;font-display:block;font-weight:${WEIGHT.min} ${WEIGHT.max};src:url(data:font/woff2;base64,${woff2.toString("base64")}) format("woff2");unicode-range:${unicode}}`;
@@ -5186,7 +6551,7 @@ function writeOutputs(outDir, name, outputs) {
5186
6551
  const files = {};
5187
6552
  try {
5188
6553
  for (const [format, data] of outputs) {
5189
- const path2 = join(outDir, `${name}.${format}`);
6554
+ const path2 = join$1(outDir, `${name}.${format}`);
5190
6555
  writeFileSync(path2, data);
5191
6556
  files[format] = path2;
5192
6557
  }