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