@cardenelabs/dragon 0.40.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.
package/dist/node.cjs ADDED
@@ -0,0 +1,2946 @@
1
+ 'use strict';
2
+
3
+ var promises = require('fs/promises');
4
+
5
+ // src/node.ts
6
+
7
+ // src/field-messages.ts
8
+ var TYPES_JA = {
9
+ string: "\u6587\u5B57\u5217\u306B\u3059\u308B",
10
+ integer: "\u6574\u6570\u306B\u3059\u308B",
11
+ number: "\u6570\u306B\u3059\u308B",
12
+ object: "\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306B\u3059\u308B",
13
+ array: "\u914D\u5217\u306B\u3059\u308B",
14
+ boolean: "true \u304B false \u306B\u3059\u308B",
15
+ null: "null \u306B\u3059\u308B"
16
+ };
17
+ var TYPES_EN = {
18
+ string: "Use a string",
19
+ integer: "Use an integer",
20
+ number: "Use a number",
21
+ object: "Use an object",
22
+ array: "Use an array",
23
+ boolean: "Use true or false",
24
+ null: "Use null"
25
+ };
26
+ var plural = (count, word) => `${count} ${word}${count === 1 ? "" : "s"}`;
27
+ var ja = {
28
+ additionalProperties: (key) => `${key} \u3068\u3044\u3046\u6B04\u306F\u66F8\u3051\u306A\u3044`,
29
+ required: (key) => `${key} \u306E\u6B04\u304C\u8981\u308B`,
30
+ enum: (values) => `${values.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,
31
+ type: (type) => TYPES_JA[type] ?? `${type} \u306B\u3059\u308B`,
32
+ minLength: (limit) => `${limit} \u5B57\u4EE5\u4E0A\u66F8\u304F`,
33
+ pattern: (forbidden) => forbidden ? `${forbidden.space ? "\u7A7A\u767D\u3068 " : ""}${forbidden.chars.join(" ")} \u306F\u4F7F\u3048\u306A\u3044` : "\u4F7F\u3048\u306A\u3044\u5B57\u304C\u5165\u3063\u3066\u3044\u308B",
34
+ minItems: (limit) => `${limit} \u3064\u4EE5\u4E0A\u66F8\u304F`,
35
+ minimum: (limit) => `${limit} \u4EE5\u4E0A\u306B\u3059\u308B`,
36
+ const: (value) => `${value} \u306B\u3059\u308B`,
37
+ 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",
38
+ 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`,
39
+ kindOnly: (types, kind) => `${types.join(" \u3068 ")} \u306E\u51FA\u6765\u4E8B\u306F kind \u304C ${kind} \u306E\u6642\u3060\u3051\u66F8\u3051\u308B`,
40
+ hex: (min, max) => `0 \u304B\u3089 9 \u3068 a \u304B\u3089 f \u306E\u5B57\u3067 ${min} \u304B\u3089 ${max} \u5B57\u306B\u3059\u308B`,
41
+ 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",
42
+ oneOf: "\u66F8\u3051\u308B\u5F62\u306E\u3069\u308C\u304B 1 \u3064\u3060\u3051\u306B\u5408\u308F\u305B\u308B",
43
+ discriminator: (tag, values) => `${tag} \u306F ${values.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,
44
+ newer: (version, tool) => `\u7248 ${version} \u306E\u56F3\u306F\u3001\u3053\u306E\u9053\u5177 (\u7248 ${tool}) \u3088\u308A\u65B0\u3057\u3044\u306E\u3067\u8AAD\u3081\u306A\u3044\u3002\u9053\u5177\u3092\u65B0\u3057\u304F\u3059\u308B`
45
+ };
46
+ var en = {
47
+ additionalProperties: (key) => `The ${key} field is not allowed`,
48
+ required: (key) => `The ${key} field is required`,
49
+ enum: (values) => `Use one of ${values.join(" / ")}`,
50
+ type: (type) => TYPES_EN[type] ?? `Use ${type}`,
51
+ minLength: (limit) => `Write at least ${plural(limit, "character")}`,
52
+ pattern: (forbidden) => forbidden ? `Cannot contain ${forbidden.space ? "spaces or " : ""}${forbidden.chars.join(" ")}` : "Contains characters that are not allowed",
53
+ minItems: (limit) => `Write at least ${plural(limit, "item")}`,
54
+ minimum: (limit) => `Use ${limit} or greater`,
55
+ const: (value) => `Use ${value}`,
56
+ not: (allowed) => allowed ? `The ${allowed.field} field is allowed only when kind is ${allowed.kind}` : "This combination of fields is not allowed",
57
+ reserved: (names) => `${names.join(" and ")} name the start and end marks of a state diagram and cannot be box ids`,
58
+ kindOnly: (types, kind) => `${types.join(" and ")} events are allowed only when kind is ${kind}`,
59
+ hex: (min, max) => `Use ${min} to ${max} characters of 0-9 and a-f`,
60
+ anyOf: (fields) => fields.length > 0 ? `Write one of the ${fields.join(" or ")} fields` : "Does not match any of the allowed shapes",
61
+ oneOf: "Match exactly one of the allowed shapes",
62
+ discriminator: (tag, values) => `${tag} is one of ${values.join(" / ")}`,
63
+ newer: (version, tool) => `Version ${version} diagrams are newer than this tool (version ${tool}) and cannot be read. Update the tool`
64
+ };
65
+ var FIELD_MESSAGES = { ja, en };
66
+
67
+ // src/schemas/validate-diagram.js
68
+ function ucs2length(str) {
69
+ let length = 0;
70
+ for (const _ of str) length++;
71
+ return length;
72
+ }
73
+ var validate_diagram_default = validate10;
74
+ 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" } }};
75
+ var func2 = Object.prototype.hasOwnProperty;
76
+ var func3 = ucs2length;
77
+ var schema28 = { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] };
78
+ var pattern0 = new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$", "u");
79
+ function validate11(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
80
+ let vErrors = null;
81
+ let errors = 0;
82
+ if (data && typeof data == "object" && !Array.isArray(data)) {
83
+ if (data.id === void 0) {
84
+ const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property 'id'" };
85
+ if (vErrors === null) {
86
+ vErrors = [err0];
87
+ } else {
88
+ vErrors.push(err0);
89
+ }
90
+ errors++;
91
+ }
92
+ if (data.name === void 0) {
93
+ const err1 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "name" }, message: "must have required property 'name'" };
94
+ if (vErrors === null) {
95
+ vErrors = [err1];
96
+ } else {
97
+ vErrors.push(err1);
98
+ }
99
+ errors++;
100
+ }
101
+ for (const key0 in data) {
102
+ if (!(key0 === "id" || key0 === "name" || key0 === "note" || key0 === "color" || key0 === "icon")) {
103
+ const err2 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
104
+ if (vErrors === null) {
105
+ vErrors = [err2];
106
+ } else {
107
+ vErrors.push(err2);
108
+ }
109
+ errors++;
110
+ }
111
+ }
112
+ if (data.id !== void 0) {
113
+ let data0 = data.id;
114
+ if (typeof data0 === "string") {
115
+ if (!pattern0.test(data0)) {
116
+ const err3 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
117
+ if (vErrors === null) {
118
+ vErrors = [err3];
119
+ } else {
120
+ vErrors.push(err3);
121
+ }
122
+ errors++;
123
+ }
124
+ } else {
125
+ const err4 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
126
+ if (vErrors === null) {
127
+ vErrors = [err4];
128
+ } else {
129
+ vErrors.push(err4);
130
+ }
131
+ errors++;
132
+ }
133
+ }
134
+ if (data.name !== void 0) {
135
+ let data1 = data.name;
136
+ if (typeof data1 === "string") {
137
+ if (func3(data1) < 1) {
138
+ const err5 = { instancePath: instancePath + "/name", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
139
+ if (vErrors === null) {
140
+ vErrors = [err5];
141
+ } else {
142
+ vErrors.push(err5);
143
+ }
144
+ errors++;
145
+ }
146
+ } else {
147
+ const err6 = { instancePath: instancePath + "/name", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
148
+ if (vErrors === null) {
149
+ vErrors = [err6];
150
+ } else {
151
+ vErrors.push(err6);
152
+ }
153
+ errors++;
154
+ }
155
+ }
156
+ if (data.note !== void 0) {
157
+ let data2 = data.note;
158
+ if (typeof data2 === "string") {
159
+ if (func3(data2) < 1) {
160
+ const err7 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
161
+ if (vErrors === null) {
162
+ vErrors = [err7];
163
+ } else {
164
+ vErrors.push(err7);
165
+ }
166
+ errors++;
167
+ }
168
+ } else {
169
+ const err8 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
170
+ if (vErrors === null) {
171
+ vErrors = [err8];
172
+ } else {
173
+ vErrors.push(err8);
174
+ }
175
+ errors++;
176
+ }
177
+ }
178
+ if (data.color !== void 0) {
179
+ let data3 = data.color;
180
+ if (!(data3 === "blue" || data3 === "amber" || data3 === "green" || data3 === "violet" || data3 === "rose" || data3 === "slate" || data3 === "coin")) {
181
+ 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" };
182
+ if (vErrors === null) {
183
+ vErrors = [err9];
184
+ } else {
185
+ vErrors.push(err9);
186
+ }
187
+ errors++;
188
+ }
189
+ }
190
+ if (data.icon !== void 0) {
191
+ let data4 = data.icon;
192
+ if (typeof data4 === "string") {
193
+ if (func3(data4) < 1) {
194
+ const err10 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
195
+ if (vErrors === null) {
196
+ vErrors = [err10];
197
+ } else {
198
+ vErrors.push(err10);
199
+ }
200
+ errors++;
201
+ }
202
+ } else {
203
+ const err11 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
204
+ if (vErrors === null) {
205
+ vErrors = [err11];
206
+ } else {
207
+ vErrors.push(err11);
208
+ }
209
+ errors++;
210
+ }
211
+ }
212
+ } else {
213
+ const err12 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
214
+ if (vErrors === null) {
215
+ vErrors = [err12];
216
+ } else {
217
+ vErrors.push(err12);
218
+ }
219
+ errors++;
220
+ }
221
+ validate11.errors = vErrors;
222
+ return errors === 0;
223
+ }
224
+ function validate13(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
225
+ let vErrors = null;
226
+ let errors = 0;
227
+ if (data && typeof data == "object" && !Array.isArray(data)) {
228
+ if (data.id === void 0) {
229
+ const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property 'id'" };
230
+ if (vErrors === null) {
231
+ vErrors = [err0];
232
+ } else {
233
+ vErrors.push(err0);
234
+ }
235
+ errors++;
236
+ }
237
+ if (data.name === void 0) {
238
+ const err1 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "name" }, message: "must have required property 'name'" };
239
+ if (vErrors === null) {
240
+ vErrors = [err1];
241
+ } else {
242
+ vErrors.push(err1);
243
+ }
244
+ errors++;
245
+ }
246
+ for (const key0 in data) {
247
+ if (!(key0 === "id" || key0 === "name" || key0 === "sub" || key0 === "color" || key0 === "icon" || key0 === "region")) {
248
+ const err2 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
249
+ if (vErrors === null) {
250
+ vErrors = [err2];
251
+ } else {
252
+ vErrors.push(err2);
253
+ }
254
+ errors++;
255
+ }
256
+ }
257
+ if (data.id !== void 0) {
258
+ let data0 = data.id;
259
+ if (typeof data0 === "string") {
260
+ if (!pattern0.test(data0)) {
261
+ const err3 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
262
+ if (vErrors === null) {
263
+ vErrors = [err3];
264
+ } else {
265
+ vErrors.push(err3);
266
+ }
267
+ errors++;
268
+ }
269
+ } else {
270
+ const err4 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
271
+ if (vErrors === null) {
272
+ vErrors = [err4];
273
+ } else {
274
+ vErrors.push(err4);
275
+ }
276
+ errors++;
277
+ }
278
+ }
279
+ if (data.name !== void 0) {
280
+ let data1 = data.name;
281
+ if (typeof data1 === "string") {
282
+ if (func3(data1) < 1) {
283
+ const err5 = { instancePath: instancePath + "/name", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
284
+ if (vErrors === null) {
285
+ vErrors = [err5];
286
+ } else {
287
+ vErrors.push(err5);
288
+ }
289
+ errors++;
290
+ }
291
+ } else {
292
+ const err6 = { instancePath: instancePath + "/name", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
293
+ if (vErrors === null) {
294
+ vErrors = [err6];
295
+ } else {
296
+ vErrors.push(err6);
297
+ }
298
+ errors++;
299
+ }
300
+ }
301
+ if (data.sub !== void 0) {
302
+ let data2 = data.sub;
303
+ if (typeof data2 === "string") {
304
+ if (func3(data2) < 1) {
305
+ const err7 = { instancePath: instancePath + "/sub", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
306
+ if (vErrors === null) {
307
+ vErrors = [err7];
308
+ } else {
309
+ vErrors.push(err7);
310
+ }
311
+ errors++;
312
+ }
313
+ } else {
314
+ const err8 = { instancePath: instancePath + "/sub", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
315
+ if (vErrors === null) {
316
+ vErrors = [err8];
317
+ } else {
318
+ vErrors.push(err8);
319
+ }
320
+ errors++;
321
+ }
322
+ }
323
+ if (data.color !== void 0) {
324
+ let data3 = data.color;
325
+ if (!(data3 === "blue" || data3 === "amber" || data3 === "green" || data3 === "violet" || data3 === "rose" || data3 === "slate" || data3 === "coin")) {
326
+ 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" };
327
+ if (vErrors === null) {
328
+ vErrors = [err9];
329
+ } else {
330
+ vErrors.push(err9);
331
+ }
332
+ errors++;
333
+ }
334
+ }
335
+ if (data.icon !== void 0) {
336
+ let data4 = data.icon;
337
+ if (typeof data4 === "string") {
338
+ if (func3(data4) < 1) {
339
+ const err10 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
340
+ if (vErrors === null) {
341
+ vErrors = [err10];
342
+ } else {
343
+ vErrors.push(err10);
344
+ }
345
+ errors++;
346
+ }
347
+ } else {
348
+ const err11 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
349
+ if (vErrors === null) {
350
+ vErrors = [err11];
351
+ } else {
352
+ vErrors.push(err11);
353
+ }
354
+ errors++;
355
+ }
356
+ }
357
+ if (data.region !== void 0) {
358
+ let data5 = data.region;
359
+ if (typeof data5 === "string") {
360
+ if (!pattern0.test(data5)) {
361
+ const err12 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
362
+ if (vErrors === null) {
363
+ vErrors = [err12];
364
+ } else {
365
+ vErrors.push(err12);
366
+ }
367
+ errors++;
368
+ }
369
+ } else {
370
+ const err13 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
371
+ if (vErrors === null) {
372
+ vErrors = [err13];
373
+ } else {
374
+ vErrors.push(err13);
375
+ }
376
+ errors++;
377
+ }
378
+ }
379
+ } else {
380
+ const err14 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
381
+ if (vErrors === null) {
382
+ vErrors = [err14];
383
+ } else {
384
+ vErrors.push(err14);
385
+ }
386
+ errors++;
387
+ }
388
+ validate13.errors = vErrors;
389
+ return errors === 0;
390
+ }
391
+ function validate15(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
392
+ let vErrors = null;
393
+ let errors = 0;
394
+ if (data && typeof data == "object" && !Array.isArray(data)) {
395
+ if (data.title === void 0) {
396
+ const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "title" }, message: "must have required property 'title'" };
397
+ if (vErrors === null) {
398
+ vErrors = [err0];
399
+ } else {
400
+ vErrors.push(err0);
401
+ }
402
+ errors++;
403
+ }
404
+ if (data.fields === void 0) {
405
+ const err1 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "fields" }, message: "must have required property 'fields'" };
406
+ if (vErrors === null) {
407
+ vErrors = [err1];
408
+ } else {
409
+ vErrors.push(err1);
410
+ }
411
+ errors++;
412
+ }
413
+ for (const key0 in data) {
414
+ if (!(key0 === "title" || key0 === "fields")) {
415
+ const err2 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
416
+ if (vErrors === null) {
417
+ vErrors = [err2];
418
+ } else {
419
+ vErrors.push(err2);
420
+ }
421
+ errors++;
422
+ }
423
+ }
424
+ if (data.title !== void 0) {
425
+ let data0 = data.title;
426
+ if (typeof data0 === "string") {
427
+ if (func3(data0) < 1) {
428
+ const err3 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
429
+ if (vErrors === null) {
430
+ vErrors = [err3];
431
+ } else {
432
+ vErrors.push(err3);
433
+ }
434
+ errors++;
435
+ }
436
+ } else {
437
+ const err4 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
438
+ if (vErrors === null) {
439
+ vErrors = [err4];
440
+ } else {
441
+ vErrors.push(err4);
442
+ }
443
+ errors++;
444
+ }
445
+ }
446
+ if (data.fields !== void 0) {
447
+ let data1 = data.fields;
448
+ if (Array.isArray(data1)) {
449
+ if (data1.length < 1) {
450
+ const err5 = { instancePath: instancePath + "/fields", schemaPath: "#/properties/fields/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
451
+ if (vErrors === null) {
452
+ vErrors = [err5];
453
+ } else {
454
+ vErrors.push(err5);
455
+ }
456
+ errors++;
457
+ }
458
+ const len0 = data1.length;
459
+ for (let i0 = 0; i0 < len0; i0++) {
460
+ let data2 = data1[i0];
461
+ if (typeof data2 === "string") {
462
+ if (func3(data2) < 1) {
463
+ const err6 = { instancePath: instancePath + "/fields/" + i0, schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
464
+ if (vErrors === null) {
465
+ vErrors = [err6];
466
+ } else {
467
+ vErrors.push(err6);
468
+ }
469
+ errors++;
470
+ }
471
+ } else {
472
+ const err7 = { instancePath: instancePath + "/fields/" + i0, schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
473
+ if (vErrors === null) {
474
+ vErrors = [err7];
475
+ } else {
476
+ vErrors.push(err7);
477
+ }
478
+ errors++;
479
+ }
480
+ }
481
+ } else {
482
+ const err8 = { instancePath: instancePath + "/fields", schemaPath: "#/properties/fields/type", keyword: "type", params: { type: "array" }, message: "must be array" };
483
+ if (vErrors === null) {
484
+ vErrors = [err8];
485
+ } else {
486
+ vErrors.push(err8);
487
+ }
488
+ errors++;
489
+ }
490
+ }
491
+ } else {
492
+ const err9 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
493
+ if (vErrors === null) {
494
+ vErrors = [err9];
495
+ } else {
496
+ vErrors.push(err9);
497
+ }
498
+ errors++;
499
+ }
500
+ validate15.errors = vErrors;
501
+ return errors === 0;
502
+ }
503
+ 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" } } }] };
504
+ var pattern11 = new RegExp("^[0-9a-f]{4,40}$", "u");
505
+ var schema48 = { "properties": { "kind": { "enum": ["envelope", "tag", "coin", "none"] }}};
506
+ function validate19(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
507
+ let vErrors = null;
508
+ let errors = 0;
509
+ const _errs1 = errors;
510
+ let valid0 = true;
511
+ const _errs2 = errors;
512
+ if (data && typeof data == "object" && !Array.isArray(data)) {
513
+ if (data.kind === void 0 && ("kind")) {
514
+ const err0 = {};
515
+ if (vErrors === null) {
516
+ vErrors = [err0];
517
+ } else {
518
+ vErrors.push(err0);
519
+ }
520
+ errors++;
521
+ } else {
522
+ if (data.kind !== void 0) {
523
+ if ("tag" !== data.kind) {
524
+ const err1 = {};
525
+ if (vErrors === null) {
526
+ vErrors = [err1];
527
+ } else {
528
+ vErrors.push(err1);
529
+ }
530
+ errors++;
531
+ }
532
+ }
533
+ }
534
+ }
535
+ var _valid0 = _errs2 === errors;
536
+ errors = _errs1;
537
+ if (vErrors !== null) {
538
+ if (_errs1) {
539
+ vErrors.length = _errs1;
540
+ } else {
541
+ vErrors = null;
542
+ }
543
+ }
544
+ let ifClause0;
545
+ if (_valid0) {
546
+ const _errs4 = errors;
547
+ if (data && typeof data == "object" && !Array.isArray(data)) {
548
+ if (data.text === void 0) {
549
+ const err2 = { instancePath, schemaPath: "#/then/required", keyword: "required", params: { missingProperty: "text" }, message: "must have required property 'text'" };
550
+ if (vErrors === null) {
551
+ vErrors = [err2];
552
+ } else {
553
+ vErrors.push(err2);
554
+ }
555
+ errors++;
556
+ }
557
+ }
558
+ var _valid0 = _errs4 === errors;
559
+ valid0 = _valid0;
560
+ ifClause0 = "then";
561
+ } else {
562
+ const _errs5 = errors;
563
+ const _errs6 = errors;
564
+ const _errs7 = errors;
565
+ if (data && typeof data == "object" && !Array.isArray(data)) {
566
+ if (data.text === void 0 && ("text")) {
567
+ const err3 = {};
568
+ if (vErrors === null) {
569
+ vErrors = [err3];
570
+ } else {
571
+ vErrors.push(err3);
572
+ }
573
+ errors++;
574
+ }
575
+ }
576
+ var valid2 = _errs7 === errors;
577
+ if (valid2) {
578
+ const err4 = { instancePath, schemaPath: "#/else/not", keyword: "not", params: {}, message: "must NOT be valid" };
579
+ if (vErrors === null) {
580
+ vErrors = [err4];
581
+ } else {
582
+ vErrors.push(err4);
583
+ }
584
+ errors++;
585
+ } else {
586
+ errors = _errs6;
587
+ if (vErrors !== null) {
588
+ if (_errs6) {
589
+ vErrors.length = _errs6;
590
+ } else {
591
+ vErrors = null;
592
+ }
593
+ }
594
+ }
595
+ var _valid0 = _errs5 === errors;
596
+ valid0 = _valid0;
597
+ ifClause0 = "else";
598
+ }
599
+ if (!valid0) {
600
+ const err5 = { instancePath, schemaPath: "#/if", keyword: "if", params: { failingKeyword: ifClause0 }, message: 'must match "' + ifClause0 + '" schema' };
601
+ if (vErrors === null) {
602
+ vErrors = [err5];
603
+ } else {
604
+ vErrors.push(err5);
605
+ }
606
+ errors++;
607
+ }
608
+ if (data && typeof data == "object" && !Array.isArray(data)) {
609
+ if (data.kind === void 0) {
610
+ const err6 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "kind" }, message: "must have required property 'kind'" };
611
+ if (vErrors === null) {
612
+ vErrors = [err6];
613
+ } else {
614
+ vErrors.push(err6);
615
+ }
616
+ errors++;
617
+ }
618
+ for (const key0 in data) {
619
+ if (!(key0 === "kind" || key0 === "text")) {
620
+ const err7 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
621
+ if (vErrors === null) {
622
+ vErrors = [err7];
623
+ } else {
624
+ vErrors.push(err7);
625
+ }
626
+ errors++;
627
+ }
628
+ }
629
+ if (data.kind !== void 0) {
630
+ let data1 = data.kind;
631
+ if (!(data1 === "envelope" || data1 === "tag" || data1 === "coin" || data1 === "none")) {
632
+ 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" };
633
+ if (vErrors === null) {
634
+ vErrors = [err8];
635
+ } else {
636
+ vErrors.push(err8);
637
+ }
638
+ errors++;
639
+ }
640
+ }
641
+ if (data.text !== void 0) {
642
+ let data2 = data.text;
643
+ if (typeof data2 === "string") {
644
+ if (func3(data2) < 1) {
645
+ const err9 = { instancePath: instancePath + "/text", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
646
+ if (vErrors === null) {
647
+ vErrors = [err9];
648
+ } else {
649
+ vErrors.push(err9);
650
+ }
651
+ errors++;
652
+ }
653
+ } else {
654
+ const err10 = { instancePath: instancePath + "/text", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
655
+ if (vErrors === null) {
656
+ vErrors = [err10];
657
+ } else {
658
+ vErrors.push(err10);
659
+ }
660
+ errors++;
661
+ }
662
+ }
663
+ } else {
664
+ const err11 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
665
+ if (vErrors === null) {
666
+ vErrors = [err11];
667
+ } else {
668
+ vErrors.push(err11);
669
+ }
670
+ errors++;
671
+ }
672
+ validate19.errors = vErrors;
673
+ return errors === 0;
674
+ }
675
+ function validate18(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
676
+ let vErrors = null;
677
+ let errors = 0;
678
+ if (data && typeof data == "object" && !Array.isArray(data)) {
679
+ if (data.type === void 0) {
680
+ const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
681
+ if (vErrors === null) {
682
+ vErrors = [err0];
683
+ } else {
684
+ vErrors.push(err0);
685
+ }
686
+ errors++;
687
+ }
688
+ const tag0 = data.type;
689
+ if (typeof tag0 == "string") {
690
+ if (tag0 === "edge") {
691
+ if (data && typeof data == "object" && !Array.isArray(data)) {
692
+ if (data.type === void 0) {
693
+ const err1 = { instancePath, schemaPath: "#/oneOf/0/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
694
+ if (vErrors === null) {
695
+ vErrors = [err1];
696
+ } else {
697
+ vErrors.push(err1);
698
+ }
699
+ errors++;
700
+ }
701
+ if (data.from === void 0) {
702
+ const err2 = { instancePath, schemaPath: "#/oneOf/0/required", keyword: "required", params: { missingProperty: "from" }, message: "must have required property 'from'" };
703
+ if (vErrors === null) {
704
+ vErrors = [err2];
705
+ } else {
706
+ vErrors.push(err2);
707
+ }
708
+ errors++;
709
+ }
710
+ if (data.to === void 0) {
711
+ const err3 = { instancePath, schemaPath: "#/oneOf/0/required", keyword: "required", params: { missingProperty: "to" }, message: "must have required property 'to'" };
712
+ if (vErrors === null) {
713
+ vErrors = [err3];
714
+ } else {
715
+ vErrors.push(err3);
716
+ }
717
+ errors++;
718
+ }
719
+ if (data.carry === void 0) {
720
+ const err4 = { instancePath, schemaPath: "#/oneOf/0/required", keyword: "required", params: { missingProperty: "carry" }, message: "must have required property 'carry'" };
721
+ if (vErrors === null) {
722
+ vErrors = [err4];
723
+ } else {
724
+ vErrors.push(err4);
725
+ }
726
+ errors++;
727
+ }
728
+ for (const key0 in data) {
729
+ if (!(key0 === "type" || key0 === "from" || key0 === "to" || key0 === "label" || key0 === "carry" || key0 === "labelSide")) {
730
+ const err5 = { instancePath, schemaPath: "#/oneOf/0/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
731
+ if (vErrors === null) {
732
+ vErrors = [err5];
733
+ } else {
734
+ vErrors.push(err5);
735
+ }
736
+ errors++;
737
+ }
738
+ }
739
+ if (data.type !== void 0) {
740
+ if ("edge" !== data.type) {
741
+ const err6 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/0/properties/type/const", keyword: "const", params: { allowedValue: "edge" }, message: "must be equal to constant" };
742
+ if (vErrors === null) {
743
+ vErrors = [err6];
744
+ } else {
745
+ vErrors.push(err6);
746
+ }
747
+ errors++;
748
+ }
749
+ }
750
+ if (data.from !== void 0) {
751
+ let data1 = data.from;
752
+ if (typeof data1 === "string") {
753
+ if (!pattern0.test(data1)) {
754
+ const err7 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
755
+ if (vErrors === null) {
756
+ vErrors = [err7];
757
+ } else {
758
+ vErrors.push(err7);
759
+ }
760
+ errors++;
761
+ }
762
+ } else {
763
+ const err8 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
764
+ if (vErrors === null) {
765
+ vErrors = [err8];
766
+ } else {
767
+ vErrors.push(err8);
768
+ }
769
+ errors++;
770
+ }
771
+ }
772
+ if (data.to !== void 0) {
773
+ let data2 = data.to;
774
+ if (typeof data2 === "string") {
775
+ if (!pattern0.test(data2)) {
776
+ const err9 = { instancePath: instancePath + "/to", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
777
+ if (vErrors === null) {
778
+ vErrors = [err9];
779
+ } else {
780
+ vErrors.push(err9);
781
+ }
782
+ errors++;
783
+ }
784
+ } else {
785
+ const err10 = { instancePath: instancePath + "/to", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
786
+ if (vErrors === null) {
787
+ vErrors = [err10];
788
+ } else {
789
+ vErrors.push(err10);
790
+ }
791
+ errors++;
792
+ }
793
+ }
794
+ if (data.label !== void 0) {
795
+ let data3 = data.label;
796
+ if (typeof data3 === "string") {
797
+ if (func3(data3) < 1) {
798
+ const err11 = { instancePath: instancePath + "/label", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
799
+ if (vErrors === null) {
800
+ vErrors = [err11];
801
+ } else {
802
+ vErrors.push(err11);
803
+ }
804
+ errors++;
805
+ }
806
+ } else {
807
+ const err12 = { instancePath: instancePath + "/label", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
808
+ if (vErrors === null) {
809
+ vErrors = [err12];
810
+ } else {
811
+ vErrors.push(err12);
812
+ }
813
+ errors++;
814
+ }
815
+ }
816
+ if (data.carry !== void 0) {
817
+ if (!validate19(data.carry, { instancePath: instancePath + "/carry", parentData: data, parentDataProperty: "carry", rootData })) {
818
+ vErrors = vErrors === null ? validate19.errors : vErrors.concat(validate19.errors);
819
+ errors = vErrors.length;
820
+ }
821
+ }
822
+ if (data.labelSide !== void 0) {
823
+ let data5 = data.labelSide;
824
+ if (!(data5 === "above" || data5 === "below" || data5 === "left" || data5 === "right")) {
825
+ 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" };
826
+ if (vErrors === null) {
827
+ vErrors = [err13];
828
+ } else {
829
+ vErrors.push(err13);
830
+ }
831
+ errors++;
832
+ }
833
+ }
834
+ } else {
835
+ const err14 = { instancePath, schemaPath: "#/oneOf/0/type", keyword: "type", params: { type: "object" }, message: "must be object" };
836
+ if (vErrors === null) {
837
+ vErrors = [err14];
838
+ } else {
839
+ vErrors.push(err14);
840
+ }
841
+ errors++;
842
+ }
843
+ } else if (tag0 === "action") {
844
+ if (data && typeof data == "object" && !Array.isArray(data)) {
845
+ if (data.type === void 0) {
846
+ const err15 = { instancePath, schemaPath: "#/oneOf/1/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
847
+ if (vErrors === null) {
848
+ vErrors = [err15];
849
+ } else {
850
+ vErrors.push(err15);
851
+ }
852
+ errors++;
853
+ }
854
+ if (data.box === void 0) {
855
+ const err16 = { instancePath, schemaPath: "#/oneOf/1/required", keyword: "required", params: { missingProperty: "box" }, message: "must have required property 'box'" };
856
+ if (vErrors === null) {
857
+ vErrors = [err16];
858
+ } else {
859
+ vErrors.push(err16);
860
+ }
861
+ errors++;
862
+ }
863
+ if (data.label === void 0) {
864
+ const err17 = { instancePath, schemaPath: "#/oneOf/1/required", keyword: "required", params: { missingProperty: "label" }, message: "must have required property 'label'" };
865
+ if (vErrors === null) {
866
+ vErrors = [err17];
867
+ } else {
868
+ vErrors.push(err17);
869
+ }
870
+ errors++;
871
+ }
872
+ for (const key1 in data) {
873
+ if (!(key1 === "type" || key1 === "box" || key1 === "label")) {
874
+ const err18 = { instancePath, schemaPath: "#/oneOf/1/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" };
875
+ if (vErrors === null) {
876
+ vErrors = [err18];
877
+ } else {
878
+ vErrors.push(err18);
879
+ }
880
+ errors++;
881
+ }
882
+ }
883
+ if (data.type !== void 0) {
884
+ if ("action" !== data.type) {
885
+ const err19 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/1/properties/type/const", keyword: "const", params: { allowedValue: "action" }, message: "must be equal to constant" };
886
+ if (vErrors === null) {
887
+ vErrors = [err19];
888
+ } else {
889
+ vErrors.push(err19);
890
+ }
891
+ errors++;
892
+ }
893
+ }
894
+ if (data.box !== void 0) {
895
+ let data7 = data.box;
896
+ if (typeof data7 === "string") {
897
+ if (!pattern0.test(data7)) {
898
+ const err20 = { instancePath: instancePath + "/box", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
899
+ if (vErrors === null) {
900
+ vErrors = [err20];
901
+ } else {
902
+ vErrors.push(err20);
903
+ }
904
+ errors++;
905
+ }
906
+ } else {
907
+ const err21 = { instancePath: instancePath + "/box", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
908
+ if (vErrors === null) {
909
+ vErrors = [err21];
910
+ } else {
911
+ vErrors.push(err21);
912
+ }
913
+ errors++;
914
+ }
915
+ }
916
+ if (data.label !== void 0) {
917
+ let data8 = data.label;
918
+ if (typeof data8 === "string") {
919
+ if (func3(data8) < 1) {
920
+ const err22 = { instancePath: instancePath + "/label", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
921
+ if (vErrors === null) {
922
+ vErrors = [err22];
923
+ } else {
924
+ vErrors.push(err22);
925
+ }
926
+ errors++;
927
+ }
928
+ } else {
929
+ const err23 = { instancePath: instancePath + "/label", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
930
+ if (vErrors === null) {
931
+ vErrors = [err23];
932
+ } else {
933
+ vErrors.push(err23);
934
+ }
935
+ errors++;
936
+ }
937
+ }
938
+ } else {
939
+ const err24 = { instancePath, schemaPath: "#/oneOf/1/type", keyword: "type", params: { type: "object" }, message: "must be object" };
940
+ if (vErrors === null) {
941
+ vErrors = [err24];
942
+ } else {
943
+ vErrors.push(err24);
944
+ }
945
+ errors++;
946
+ }
947
+ } else if (tag0 === "swap") {
948
+ if (data && typeof data == "object" && !Array.isArray(data)) {
949
+ if (data.type === void 0) {
950
+ const err25 = { instancePath, schemaPath: "#/oneOf/2/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
951
+ if (vErrors === null) {
952
+ vErrors = [err25];
953
+ } else {
954
+ vErrors.push(err25);
955
+ }
956
+ errors++;
957
+ }
958
+ if (data.box === void 0) {
959
+ const err26 = { instancePath, schemaPath: "#/oneOf/2/required", keyword: "required", params: { missingProperty: "box" }, message: "must have required property 'box'" };
960
+ if (vErrors === null) {
961
+ vErrors = [err26];
962
+ } else {
963
+ vErrors.push(err26);
964
+ }
965
+ errors++;
966
+ }
967
+ if (data.text === void 0) {
968
+ const err27 = { instancePath, schemaPath: "#/oneOf/2/required", keyword: "required", params: { missingProperty: "text" }, message: "must have required property 'text'" };
969
+ if (vErrors === null) {
970
+ vErrors = [err27];
971
+ } else {
972
+ vErrors.push(err27);
973
+ }
974
+ errors++;
975
+ }
976
+ for (const key2 in data) {
977
+ if (!(key2 === "type" || key2 === "box" || key2 === "text")) {
978
+ const err28 = { instancePath, schemaPath: "#/oneOf/2/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key2 }, message: "must NOT have additional properties" };
979
+ if (vErrors === null) {
980
+ vErrors = [err28];
981
+ } else {
982
+ vErrors.push(err28);
983
+ }
984
+ errors++;
985
+ }
986
+ }
987
+ if (data.type !== void 0) {
988
+ if ("swap" !== data.type) {
989
+ const err29 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/2/properties/type/const", keyword: "const", params: { allowedValue: "swap" }, message: "must be equal to constant" };
990
+ if (vErrors === null) {
991
+ vErrors = [err29];
992
+ } else {
993
+ vErrors.push(err29);
994
+ }
995
+ errors++;
996
+ }
997
+ }
998
+ if (data.box !== void 0) {
999
+ let data10 = data.box;
1000
+ if (typeof data10 === "string") {
1001
+ if (!pattern0.test(data10)) {
1002
+ const err30 = { instancePath: instancePath + "/box", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
1003
+ if (vErrors === null) {
1004
+ vErrors = [err30];
1005
+ } else {
1006
+ vErrors.push(err30);
1007
+ }
1008
+ errors++;
1009
+ }
1010
+ } else {
1011
+ const err31 = { instancePath: instancePath + "/box", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1012
+ if (vErrors === null) {
1013
+ vErrors = [err31];
1014
+ } else {
1015
+ vErrors.push(err31);
1016
+ }
1017
+ errors++;
1018
+ }
1019
+ }
1020
+ if (data.text !== void 0) {
1021
+ let data11 = data.text;
1022
+ if (typeof data11 === "string") {
1023
+ if (func3(data11) < 1) {
1024
+ const err32 = { instancePath: instancePath + "/text", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
1025
+ if (vErrors === null) {
1026
+ vErrors = [err32];
1027
+ } else {
1028
+ vErrors.push(err32);
1029
+ }
1030
+ errors++;
1031
+ }
1032
+ } else {
1033
+ const err33 = { instancePath: instancePath + "/text", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1034
+ if (vErrors === null) {
1035
+ vErrors = [err33];
1036
+ } else {
1037
+ vErrors.push(err33);
1038
+ }
1039
+ errors++;
1040
+ }
1041
+ }
1042
+ } else {
1043
+ const err34 = { instancePath, schemaPath: "#/oneOf/2/type", keyword: "type", params: { type: "object" }, message: "must be object" };
1044
+ if (vErrors === null) {
1045
+ vErrors = [err34];
1046
+ } else {
1047
+ vErrors.push(err34);
1048
+ }
1049
+ errors++;
1050
+ }
1051
+ } else if (tag0 === "commit") {
1052
+ if (data && typeof data == "object" && !Array.isArray(data)) {
1053
+ if (data.type === void 0) {
1054
+ const err35 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
1055
+ if (vErrors === null) {
1056
+ vErrors = [err35];
1057
+ } else {
1058
+ vErrors.push(err35);
1059
+ }
1060
+ errors++;
1061
+ }
1062
+ if (data.id === void 0) {
1063
+ const err36 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property 'id'" };
1064
+ if (vErrors === null) {
1065
+ vErrors = [err36];
1066
+ } else {
1067
+ vErrors.push(err36);
1068
+ }
1069
+ errors++;
1070
+ }
1071
+ if (data.branch === void 0) {
1072
+ const err37 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "branch" }, message: "must have required property 'branch'" };
1073
+ if (vErrors === null) {
1074
+ vErrors = [err37];
1075
+ } else {
1076
+ vErrors.push(err37);
1077
+ }
1078
+ errors++;
1079
+ }
1080
+ for (const key3 in data) {
1081
+ if (!(key3 === "type" || key3 === "id" || key3 === "branch" || key3 === "copy" || key3 === "merge" || key3 === "hash" || key3 === "note")) {
1082
+ const err38 = { instancePath, schemaPath: "#/oneOf/3/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" };
1083
+ if (vErrors === null) {
1084
+ vErrors = [err38];
1085
+ } else {
1086
+ vErrors.push(err38);
1087
+ }
1088
+ errors++;
1089
+ }
1090
+ }
1091
+ if (data.type !== void 0) {
1092
+ if ("commit" !== data.type) {
1093
+ const err39 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/3/properties/type/const", keyword: "const", params: { allowedValue: "commit" }, message: "must be equal to constant" };
1094
+ if (vErrors === null) {
1095
+ vErrors = [err39];
1096
+ } else {
1097
+ vErrors.push(err39);
1098
+ }
1099
+ errors++;
1100
+ }
1101
+ }
1102
+ if (data.id !== void 0) {
1103
+ let data13 = data.id;
1104
+ if (typeof data13 === "string") {
1105
+ if (!pattern0.test(data13)) {
1106
+ const err40 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
1107
+ if (vErrors === null) {
1108
+ vErrors = [err40];
1109
+ } else {
1110
+ vErrors.push(err40);
1111
+ }
1112
+ errors++;
1113
+ }
1114
+ } else {
1115
+ const err41 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1116
+ if (vErrors === null) {
1117
+ vErrors = [err41];
1118
+ } else {
1119
+ vErrors.push(err41);
1120
+ }
1121
+ errors++;
1122
+ }
1123
+ }
1124
+ if (data.branch !== void 0) {
1125
+ let data14 = data.branch;
1126
+ if (typeof data14 === "string") {
1127
+ if (!pattern0.test(data14)) {
1128
+ const err42 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
1129
+ if (vErrors === null) {
1130
+ vErrors = [err42];
1131
+ } else {
1132
+ vErrors.push(err42);
1133
+ }
1134
+ errors++;
1135
+ }
1136
+ } else {
1137
+ const err43 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1138
+ if (vErrors === null) {
1139
+ vErrors = [err43];
1140
+ } else {
1141
+ vErrors.push(err43);
1142
+ }
1143
+ errors++;
1144
+ }
1145
+ }
1146
+ if (data.copy !== void 0) {
1147
+ let data15 = data.copy;
1148
+ if (typeof data15 === "string") {
1149
+ if (!pattern0.test(data15)) {
1150
+ const err44 = { instancePath: instancePath + "/copy", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
1151
+ if (vErrors === null) {
1152
+ vErrors = [err44];
1153
+ } else {
1154
+ vErrors.push(err44);
1155
+ }
1156
+ errors++;
1157
+ }
1158
+ } else {
1159
+ const err45 = { instancePath: instancePath + "/copy", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1160
+ if (vErrors === null) {
1161
+ vErrors = [err45];
1162
+ } else {
1163
+ vErrors.push(err45);
1164
+ }
1165
+ errors++;
1166
+ }
1167
+ }
1168
+ if (data.merge !== void 0) {
1169
+ let data16 = data.merge;
1170
+ if (typeof data16 === "string") {
1171
+ if (!pattern0.test(data16)) {
1172
+ const err46 = { instancePath: instancePath + "/merge", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
1173
+ if (vErrors === null) {
1174
+ vErrors = [err46];
1175
+ } else {
1176
+ vErrors.push(err46);
1177
+ }
1178
+ errors++;
1179
+ }
1180
+ } else {
1181
+ const err47 = { instancePath: instancePath + "/merge", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1182
+ if (vErrors === null) {
1183
+ vErrors = [err47];
1184
+ } else {
1185
+ vErrors.push(err47);
1186
+ }
1187
+ errors++;
1188
+ }
1189
+ }
1190
+ if (data.hash !== void 0) {
1191
+ let data17 = data.hash;
1192
+ if (typeof data17 === "string") {
1193
+ if (!pattern11.test(data17)) {
1194
+ 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}$"' };
1195
+ if (vErrors === null) {
1196
+ vErrors = [err48];
1197
+ } else {
1198
+ vErrors.push(err48);
1199
+ }
1200
+ errors++;
1201
+ }
1202
+ } else {
1203
+ const err49 = { instancePath: instancePath + "/hash", schemaPath: "#/definitions/hash/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1204
+ if (vErrors === null) {
1205
+ vErrors = [err49];
1206
+ } else {
1207
+ vErrors.push(err49);
1208
+ }
1209
+ errors++;
1210
+ }
1211
+ }
1212
+ if (data.note !== void 0) {
1213
+ let data18 = data.note;
1214
+ if (typeof data18 === "string") {
1215
+ if (func3(data18) < 1) {
1216
+ const err50 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
1217
+ if (vErrors === null) {
1218
+ vErrors = [err50];
1219
+ } else {
1220
+ vErrors.push(err50);
1221
+ }
1222
+ errors++;
1223
+ }
1224
+ } else {
1225
+ const err51 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1226
+ if (vErrors === null) {
1227
+ vErrors = [err51];
1228
+ } else {
1229
+ vErrors.push(err51);
1230
+ }
1231
+ errors++;
1232
+ }
1233
+ }
1234
+ } else {
1235
+ const err52 = { instancePath, schemaPath: "#/oneOf/3/type", keyword: "type", params: { type: "object" }, message: "must be object" };
1236
+ if (vErrors === null) {
1237
+ vErrors = [err52];
1238
+ } else {
1239
+ vErrors.push(err52);
1240
+ }
1241
+ errors++;
1242
+ }
1243
+ } else if (tag0 === "branch") {
1244
+ if (data && typeof data == "object" && !Array.isArray(data)) {
1245
+ if (data.type === void 0) {
1246
+ const err53 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
1247
+ if (vErrors === null) {
1248
+ vErrors = [err53];
1249
+ } else {
1250
+ vErrors.push(err53);
1251
+ }
1252
+ errors++;
1253
+ }
1254
+ if (data.branch === void 0) {
1255
+ const err54 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "branch" }, message: "must have required property 'branch'" };
1256
+ if (vErrors === null) {
1257
+ vErrors = [err54];
1258
+ } else {
1259
+ vErrors.push(err54);
1260
+ }
1261
+ errors++;
1262
+ }
1263
+ if (data.from === void 0) {
1264
+ const err55 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "from" }, message: "must have required property 'from'" };
1265
+ if (vErrors === null) {
1266
+ vErrors = [err55];
1267
+ } else {
1268
+ vErrors.push(err55);
1269
+ }
1270
+ errors++;
1271
+ }
1272
+ for (const key4 in data) {
1273
+ if (!(key4 === "type" || key4 === "branch" || key4 === "from")) {
1274
+ const err56 = { instancePath, schemaPath: "#/oneOf/4/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key4 }, message: "must NOT have additional properties" };
1275
+ if (vErrors === null) {
1276
+ vErrors = [err56];
1277
+ } else {
1278
+ vErrors.push(err56);
1279
+ }
1280
+ errors++;
1281
+ }
1282
+ }
1283
+ if (data.type !== void 0) {
1284
+ if ("branch" !== data.type) {
1285
+ const err57 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/4/properties/type/const", keyword: "const", params: { allowedValue: "branch" }, message: "must be equal to constant" };
1286
+ if (vErrors === null) {
1287
+ vErrors = [err57];
1288
+ } else {
1289
+ vErrors.push(err57);
1290
+ }
1291
+ errors++;
1292
+ }
1293
+ }
1294
+ if (data.branch !== void 0) {
1295
+ let data20 = data.branch;
1296
+ if (typeof data20 === "string") {
1297
+ if (!pattern0.test(data20)) {
1298
+ const err58 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
1299
+ if (vErrors === null) {
1300
+ vErrors = [err58];
1301
+ } else {
1302
+ vErrors.push(err58);
1303
+ }
1304
+ errors++;
1305
+ }
1306
+ } else {
1307
+ const err59 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1308
+ if (vErrors === null) {
1309
+ vErrors = [err59];
1310
+ } else {
1311
+ vErrors.push(err59);
1312
+ }
1313
+ errors++;
1314
+ }
1315
+ }
1316
+ if (data.from !== void 0) {
1317
+ let data21 = data.from;
1318
+ if (typeof data21 === "string") {
1319
+ if (!pattern0.test(data21)) {
1320
+ const err60 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
1321
+ if (vErrors === null) {
1322
+ vErrors = [err60];
1323
+ } else {
1324
+ vErrors.push(err60);
1325
+ }
1326
+ errors++;
1327
+ }
1328
+ } else {
1329
+ const err61 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1330
+ if (vErrors === null) {
1331
+ vErrors = [err61];
1332
+ } else {
1333
+ vErrors.push(err61);
1334
+ }
1335
+ errors++;
1336
+ }
1337
+ }
1338
+ } else {
1339
+ const err62 = { instancePath, schemaPath: "#/oneOf/4/type", keyword: "type", params: { type: "object" }, message: "must be object" };
1340
+ if (vErrors === null) {
1341
+ vErrors = [err62];
1342
+ } else {
1343
+ vErrors.push(err62);
1344
+ }
1345
+ errors++;
1346
+ }
1347
+ } else if (tag0 === "strip") {
1348
+ const _errs71 = errors;
1349
+ let valid27 = false;
1350
+ const _errs72 = errors;
1351
+ if (data && typeof data == "object" && !Array.isArray(data)) {
1352
+ if (data.value === void 0) {
1353
+ const err63 = { instancePath, schemaPath: "#/oneOf/5/anyOf/0/required", keyword: "required", params: { missingProperty: "value" }, message: "must have required property 'value'" };
1354
+ if (vErrors === null) {
1355
+ vErrors = [err63];
1356
+ } else {
1357
+ vErrors.push(err63);
1358
+ }
1359
+ errors++;
1360
+ }
1361
+ }
1362
+ var _valid0 = _errs72 === errors;
1363
+ valid27 = valid27 || _valid0;
1364
+ if (!valid27) {
1365
+ const _errs73 = errors;
1366
+ if (data && typeof data == "object" && !Array.isArray(data)) {
1367
+ if (data.tag === void 0) {
1368
+ const err64 = { instancePath, schemaPath: "#/oneOf/5/anyOf/1/required", keyword: "required", params: { missingProperty: "tag" }, message: "must have required property 'tag'" };
1369
+ if (vErrors === null) {
1370
+ vErrors = [err64];
1371
+ } else {
1372
+ vErrors.push(err64);
1373
+ }
1374
+ errors++;
1375
+ }
1376
+ }
1377
+ var _valid0 = _errs73 === errors;
1378
+ valid27 = valid27 || _valid0;
1379
+ }
1380
+ if (!valid27) {
1381
+ const err65 = { instancePath, schemaPath: "#/oneOf/5/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
1382
+ if (vErrors === null) {
1383
+ vErrors = [err65];
1384
+ } else {
1385
+ vErrors.push(err65);
1386
+ }
1387
+ errors++;
1388
+ } else {
1389
+ errors = _errs71;
1390
+ if (vErrors !== null) {
1391
+ if (_errs71) {
1392
+ vErrors.length = _errs71;
1393
+ } else {
1394
+ vErrors = null;
1395
+ }
1396
+ }
1397
+ }
1398
+ if (data && typeof data == "object" && !Array.isArray(data)) {
1399
+ if (data.type === void 0) {
1400
+ const err66 = { instancePath, schemaPath: "#/oneOf/5/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
1401
+ if (vErrors === null) {
1402
+ vErrors = [err66];
1403
+ } else {
1404
+ vErrors.push(err66);
1405
+ }
1406
+ errors++;
1407
+ }
1408
+ if (data.field === void 0) {
1409
+ const err67 = { instancePath, schemaPath: "#/oneOf/5/required", keyword: "required", params: { missingProperty: "field" }, message: "must have required property 'field'" };
1410
+ if (vErrors === null) {
1411
+ vErrors = [err67];
1412
+ } else {
1413
+ vErrors.push(err67);
1414
+ }
1415
+ errors++;
1416
+ }
1417
+ for (const key5 in data) {
1418
+ if (!(key5 === "type" || key5 === "field" || key5 === "value" || key5 === "tag")) {
1419
+ const err68 = { instancePath, schemaPath: "#/oneOf/5/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key5 }, message: "must NOT have additional properties" };
1420
+ if (vErrors === null) {
1421
+ vErrors = [err68];
1422
+ } else {
1423
+ vErrors.push(err68);
1424
+ }
1425
+ errors++;
1426
+ }
1427
+ }
1428
+ if (data.type !== void 0) {
1429
+ if ("strip" !== data.type) {
1430
+ const err69 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/5/properties/type/const", keyword: "const", params: { allowedValue: "strip" }, message: "must be equal to constant" };
1431
+ if (vErrors === null) {
1432
+ vErrors = [err69];
1433
+ } else {
1434
+ vErrors.push(err69);
1435
+ }
1436
+ errors++;
1437
+ }
1438
+ }
1439
+ if (data.field !== void 0) {
1440
+ let data23 = data.field;
1441
+ if (typeof data23 === "string") {
1442
+ if (func3(data23) < 1) {
1443
+ const err70 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
1444
+ if (vErrors === null) {
1445
+ vErrors = [err70];
1446
+ } else {
1447
+ vErrors.push(err70);
1448
+ }
1449
+ errors++;
1450
+ }
1451
+ } else {
1452
+ const err71 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1453
+ if (vErrors === null) {
1454
+ vErrors = [err71];
1455
+ } else {
1456
+ vErrors.push(err71);
1457
+ }
1458
+ errors++;
1459
+ }
1460
+ }
1461
+ if (data.value !== void 0) {
1462
+ let data24 = data.value;
1463
+ if (typeof data24 === "string") {
1464
+ if (func3(data24) < 1) {
1465
+ const err72 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
1466
+ if (vErrors === null) {
1467
+ vErrors = [err72];
1468
+ } else {
1469
+ vErrors.push(err72);
1470
+ }
1471
+ errors++;
1472
+ }
1473
+ } else {
1474
+ const err73 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1475
+ if (vErrors === null) {
1476
+ vErrors = [err73];
1477
+ } else {
1478
+ vErrors.push(err73);
1479
+ }
1480
+ errors++;
1481
+ }
1482
+ }
1483
+ if (data.tag !== void 0) {
1484
+ let data25 = data.tag;
1485
+ if (typeof data25 === "string") {
1486
+ if (func3(data25) < 1) {
1487
+ const err74 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
1488
+ if (vErrors === null) {
1489
+ vErrors = [err74];
1490
+ } else {
1491
+ vErrors.push(err74);
1492
+ }
1493
+ errors++;
1494
+ }
1495
+ } else {
1496
+ const err75 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1497
+ if (vErrors === null) {
1498
+ vErrors = [err75];
1499
+ } else {
1500
+ vErrors.push(err75);
1501
+ }
1502
+ errors++;
1503
+ }
1504
+ }
1505
+ } else {
1506
+ const err76 = { instancePath, schemaPath: "#/oneOf/5/type", keyword: "type", params: { type: "object" }, message: "must be object" };
1507
+ if (vErrors === null) {
1508
+ vErrors = [err76];
1509
+ } else {
1510
+ vErrors.push(err76);
1511
+ }
1512
+ errors++;
1513
+ }
1514
+ } else {
1515
+ const err77 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "mapping", tag: "type", tagValue: tag0 }, message: 'value of tag "type" must be in oneOf' };
1516
+ if (vErrors === null) {
1517
+ vErrors = [err77];
1518
+ } else {
1519
+ vErrors.push(err77);
1520
+ }
1521
+ errors++;
1522
+ }
1523
+ } else {
1524
+ const err78 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "tag", tag: "type", tagValue: tag0 }, message: 'tag "type" must be string' };
1525
+ if (vErrors === null) {
1526
+ vErrors = [err78];
1527
+ } else {
1528
+ vErrors.push(err78);
1529
+ }
1530
+ errors++;
1531
+ }
1532
+ } else {
1533
+ const err79 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
1534
+ if (vErrors === null) {
1535
+ vErrors = [err79];
1536
+ } else {
1537
+ vErrors.push(err79);
1538
+ }
1539
+ errors++;
1540
+ }
1541
+ validate18.errors = vErrors;
1542
+ return errors === 0;
1543
+ }
1544
+ function validate17(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
1545
+ let vErrors = null;
1546
+ let errors = 0;
1547
+ if (data && typeof data == "object" && !Array.isArray(data)) {
1548
+ if (data.title === void 0) {
1549
+ const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "title" }, message: "must have required property 'title'" };
1550
+ if (vErrors === null) {
1551
+ vErrors = [err0];
1552
+ } else {
1553
+ vErrors.push(err0);
1554
+ }
1555
+ errors++;
1556
+ }
1557
+ if (data.body === void 0) {
1558
+ const err1 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "body" }, message: "must have required property 'body'" };
1559
+ if (vErrors === null) {
1560
+ vErrors = [err1];
1561
+ } else {
1562
+ vErrors.push(err1);
1563
+ }
1564
+ errors++;
1565
+ }
1566
+ if (data.events === void 0) {
1567
+ const err2 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "events" }, message: "must have required property 'events'" };
1568
+ if (vErrors === null) {
1569
+ vErrors = [err2];
1570
+ } else {
1571
+ vErrors.push(err2);
1572
+ }
1573
+ errors++;
1574
+ }
1575
+ for (const key0 in data) {
1576
+ if (!(key0 === "title" || key0 === "body" || key0 === "code" || key0 === "events")) {
1577
+ const err3 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
1578
+ if (vErrors === null) {
1579
+ vErrors = [err3];
1580
+ } else {
1581
+ vErrors.push(err3);
1582
+ }
1583
+ errors++;
1584
+ }
1585
+ }
1586
+ if (data.title !== void 0) {
1587
+ let data0 = data.title;
1588
+ if (typeof data0 === "string") {
1589
+ if (func3(data0) < 1) {
1590
+ const err4 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
1591
+ if (vErrors === null) {
1592
+ vErrors = [err4];
1593
+ } else {
1594
+ vErrors.push(err4);
1595
+ }
1596
+ errors++;
1597
+ }
1598
+ } else {
1599
+ const err5 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1600
+ if (vErrors === null) {
1601
+ vErrors = [err5];
1602
+ } else {
1603
+ vErrors.push(err5);
1604
+ }
1605
+ errors++;
1606
+ }
1607
+ }
1608
+ if (data.body !== void 0) {
1609
+ let data1 = data.body;
1610
+ if (typeof data1 === "string") {
1611
+ if (func3(data1) < 1) {
1612
+ const err6 = { instancePath: instancePath + "/body", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
1613
+ if (vErrors === null) {
1614
+ vErrors = [err6];
1615
+ } else {
1616
+ vErrors.push(err6);
1617
+ }
1618
+ errors++;
1619
+ }
1620
+ } else {
1621
+ const err7 = { instancePath: instancePath + "/body", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1622
+ if (vErrors === null) {
1623
+ vErrors = [err7];
1624
+ } else {
1625
+ vErrors.push(err7);
1626
+ }
1627
+ errors++;
1628
+ }
1629
+ }
1630
+ if (data.code !== void 0) {
1631
+ let data2 = data.code;
1632
+ if (typeof data2 === "string") {
1633
+ if (func3(data2) < 1) {
1634
+ const err8 = { instancePath: instancePath + "/code", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
1635
+ if (vErrors === null) {
1636
+ vErrors = [err8];
1637
+ } else {
1638
+ vErrors.push(err8);
1639
+ }
1640
+ errors++;
1641
+ }
1642
+ } else {
1643
+ const err9 = { instancePath: instancePath + "/code", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1644
+ if (vErrors === null) {
1645
+ vErrors = [err9];
1646
+ } else {
1647
+ vErrors.push(err9);
1648
+ }
1649
+ errors++;
1650
+ }
1651
+ }
1652
+ if (data.events !== void 0) {
1653
+ let data3 = data.events;
1654
+ if (Array.isArray(data3)) {
1655
+ const len0 = data3.length;
1656
+ for (let i0 = 0; i0 < len0; i0++) {
1657
+ if (!validate18(data3[i0], { instancePath: instancePath + "/events/" + i0, parentData: data3, parentDataProperty: i0, rootData })) {
1658
+ vErrors = vErrors === null ? validate18.errors : vErrors.concat(validate18.errors);
1659
+ errors = vErrors.length;
1660
+ }
1661
+ }
1662
+ } else {
1663
+ const err10 = { instancePath: instancePath + "/events", schemaPath: "#/properties/events/type", keyword: "type", params: { type: "array" }, message: "must be array" };
1664
+ if (vErrors === null) {
1665
+ vErrors = [err10];
1666
+ } else {
1667
+ vErrors.push(err10);
1668
+ }
1669
+ errors++;
1670
+ }
1671
+ }
1672
+ } else {
1673
+ const err11 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
1674
+ if (vErrors === null) {
1675
+ vErrors = [err11];
1676
+ } else {
1677
+ vErrors.push(err11);
1678
+ }
1679
+ errors++;
1680
+ }
1681
+ validate17.errors = vErrors;
1682
+ return errors === 0;
1683
+ }
1684
+ function validate23(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
1685
+ let vErrors = null;
1686
+ let errors = 0;
1687
+ if (data && typeof data == "object" && !Array.isArray(data)) {
1688
+ if (data.lifelines === void 0) {
1689
+ const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "lifelines" }, message: "must have required property 'lifelines'" };
1690
+ if (vErrors === null) {
1691
+ vErrors = [err0];
1692
+ } else {
1693
+ vErrors.push(err0);
1694
+ }
1695
+ errors++;
1696
+ }
1697
+ for (const key0 in data) {
1698
+ if (!(key0 === "lifelines")) {
1699
+ const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
1700
+ if (vErrors === null) {
1701
+ vErrors = [err1];
1702
+ } else {
1703
+ vErrors.push(err1);
1704
+ }
1705
+ errors++;
1706
+ }
1707
+ }
1708
+ if (data.lifelines !== void 0) {
1709
+ let data0 = data.lifelines;
1710
+ if (Array.isArray(data0)) {
1711
+ if (data0.length < 1) {
1712
+ const err2 = { instancePath: instancePath + "/lifelines", schemaPath: "#/properties/lifelines/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
1713
+ if (vErrors === null) {
1714
+ vErrors = [err2];
1715
+ } else {
1716
+ vErrors.push(err2);
1717
+ }
1718
+ errors++;
1719
+ }
1720
+ const len0 = data0.length;
1721
+ for (let i0 = 0; i0 < len0; i0++) {
1722
+ let data1 = data0[i0];
1723
+ if (typeof data1 === "string") {
1724
+ if (!pattern0.test(data1)) {
1725
+ const err3 = { instancePath: instancePath + "/lifelines/" + i0, schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
1726
+ if (vErrors === null) {
1727
+ vErrors = [err3];
1728
+ } else {
1729
+ vErrors.push(err3);
1730
+ }
1731
+ errors++;
1732
+ }
1733
+ } else {
1734
+ const err4 = { instancePath: instancePath + "/lifelines/" + i0, schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1735
+ if (vErrors === null) {
1736
+ vErrors = [err4];
1737
+ } else {
1738
+ vErrors.push(err4);
1739
+ }
1740
+ errors++;
1741
+ }
1742
+ }
1743
+ } else {
1744
+ const err5 = { instancePath: instancePath + "/lifelines", schemaPath: "#/properties/lifelines/type", keyword: "type", params: { type: "array" }, message: "must be array" };
1745
+ if (vErrors === null) {
1746
+ vErrors = [err5];
1747
+ } else {
1748
+ vErrors.push(err5);
1749
+ }
1750
+ errors++;
1751
+ }
1752
+ }
1753
+ } else {
1754
+ const err6 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
1755
+ if (vErrors === null) {
1756
+ vErrors = [err6];
1757
+ } else {
1758
+ vErrors.push(err6);
1759
+ }
1760
+ errors++;
1761
+ }
1762
+ validate23.errors = vErrors;
1763
+ return errors === 0;
1764
+ }
1765
+ function validate26(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
1766
+ let vErrors = null;
1767
+ let errors = 0;
1768
+ if (data && typeof data == "object" && !Array.isArray(data)) {
1769
+ if (data.from === void 0) {
1770
+ const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "from" }, message: "must have required property 'from'" };
1771
+ if (vErrors === null) {
1772
+ vErrors = [err0];
1773
+ } else {
1774
+ vErrors.push(err0);
1775
+ }
1776
+ errors++;
1777
+ }
1778
+ if (data.to === void 0) {
1779
+ const err1 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "to" }, message: "must have required property 'to'" };
1780
+ if (vErrors === null) {
1781
+ vErrors = [err1];
1782
+ } else {
1783
+ vErrors.push(err1);
1784
+ }
1785
+ errors++;
1786
+ }
1787
+ for (const key0 in data) {
1788
+ if (!(key0 === "from" || key0 === "to" || key0 === "label")) {
1789
+ const err2 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
1790
+ if (vErrors === null) {
1791
+ vErrors = [err2];
1792
+ } else {
1793
+ vErrors.push(err2);
1794
+ }
1795
+ errors++;
1796
+ }
1797
+ }
1798
+ if (data.from !== void 0) {
1799
+ let data0 = data.from;
1800
+ if (typeof data0 === "string") {
1801
+ if (!pattern0.test(data0)) {
1802
+ const err3 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
1803
+ if (vErrors === null) {
1804
+ vErrors = [err3];
1805
+ } else {
1806
+ vErrors.push(err3);
1807
+ }
1808
+ errors++;
1809
+ }
1810
+ } else {
1811
+ const err4 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1812
+ if (vErrors === null) {
1813
+ vErrors = [err4];
1814
+ } else {
1815
+ vErrors.push(err4);
1816
+ }
1817
+ errors++;
1818
+ }
1819
+ }
1820
+ if (data.to !== void 0) {
1821
+ let data1 = data.to;
1822
+ if (typeof data1 === "string") {
1823
+ if (!pattern0.test(data1)) {
1824
+ const err5 = { instancePath: instancePath + "/to", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
1825
+ if (vErrors === null) {
1826
+ vErrors = [err5];
1827
+ } else {
1828
+ vErrors.push(err5);
1829
+ }
1830
+ errors++;
1831
+ }
1832
+ } else {
1833
+ const err6 = { instancePath: instancePath + "/to", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1834
+ if (vErrors === null) {
1835
+ vErrors = [err6];
1836
+ } else {
1837
+ vErrors.push(err6);
1838
+ }
1839
+ errors++;
1840
+ }
1841
+ }
1842
+ if (data.label !== void 0) {
1843
+ let data2 = data.label;
1844
+ if (typeof data2 === "string") {
1845
+ if (func3(data2) < 1) {
1846
+ const err7 = { instancePath: instancePath + "/label", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
1847
+ if (vErrors === null) {
1848
+ vErrors = [err7];
1849
+ } else {
1850
+ vErrors.push(err7);
1851
+ }
1852
+ errors++;
1853
+ }
1854
+ } else {
1855
+ const err8 = { instancePath: instancePath + "/label", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1856
+ if (vErrors === null) {
1857
+ vErrors = [err8];
1858
+ } else {
1859
+ vErrors.push(err8);
1860
+ }
1861
+ errors++;
1862
+ }
1863
+ }
1864
+ } else {
1865
+ const err9 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
1866
+ if (vErrors === null) {
1867
+ vErrors = [err9];
1868
+ } else {
1869
+ vErrors.push(err9);
1870
+ }
1871
+ errors++;
1872
+ }
1873
+ validate26.errors = vErrors;
1874
+ return errors === 0;
1875
+ }
1876
+ function validate25(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
1877
+ let vErrors = null;
1878
+ let errors = 0;
1879
+ if (data && typeof data == "object" && !Array.isArray(data)) {
1880
+ if (data.paths === void 0) {
1881
+ const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "paths" }, message: "must have required property 'paths'" };
1882
+ if (vErrors === null) {
1883
+ vErrors = [err0];
1884
+ } else {
1885
+ vErrors.push(err0);
1886
+ }
1887
+ errors++;
1888
+ }
1889
+ for (const key0 in data) {
1890
+ if (!(key0 === "paths")) {
1891
+ const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
1892
+ if (vErrors === null) {
1893
+ vErrors = [err1];
1894
+ } else {
1895
+ vErrors.push(err1);
1896
+ }
1897
+ errors++;
1898
+ }
1899
+ }
1900
+ if (data.paths !== void 0) {
1901
+ let data0 = data.paths;
1902
+ if (Array.isArray(data0)) {
1903
+ if (data0.length < 1) {
1904
+ const err2 = { instancePath: instancePath + "/paths", schemaPath: "#/properties/paths/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
1905
+ if (vErrors === null) {
1906
+ vErrors = [err2];
1907
+ } else {
1908
+ vErrors.push(err2);
1909
+ }
1910
+ errors++;
1911
+ }
1912
+ const len0 = data0.length;
1913
+ for (let i0 = 0; i0 < len0; i0++) {
1914
+ if (!validate26(data0[i0], { instancePath: instancePath + "/paths/" + i0, parentData: data0, parentDataProperty: i0, rootData })) {
1915
+ vErrors = vErrors === null ? validate26.errors : vErrors.concat(validate26.errors);
1916
+ errors = vErrors.length;
1917
+ }
1918
+ }
1919
+ } else {
1920
+ const err3 = { instancePath: instancePath + "/paths", schemaPath: "#/properties/paths/type", keyword: "type", params: { type: "array" }, message: "must be array" };
1921
+ if (vErrors === null) {
1922
+ vErrors = [err3];
1923
+ } else {
1924
+ vErrors.push(err3);
1925
+ }
1926
+ errors++;
1927
+ }
1928
+ }
1929
+ } else {
1930
+ const err4 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
1931
+ if (vErrors === null) {
1932
+ vErrors = [err4];
1933
+ } else {
1934
+ vErrors.push(err4);
1935
+ }
1936
+ errors++;
1937
+ }
1938
+ validate25.errors = vErrors;
1939
+ return errors === 0;
1940
+ }
1941
+ function validate30(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
1942
+ let vErrors = null;
1943
+ let errors = 0;
1944
+ if (data && typeof data == "object" && !Array.isArray(data)) {
1945
+ if (data.id === void 0) {
1946
+ const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property 'id'" };
1947
+ if (vErrors === null) {
1948
+ vErrors = [err0];
1949
+ } else {
1950
+ vErrors.push(err0);
1951
+ }
1952
+ errors++;
1953
+ }
1954
+ for (const key0 in data) {
1955
+ if (!(key0 === "id" || key0 === "note")) {
1956
+ const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
1957
+ if (vErrors === null) {
1958
+ vErrors = [err1];
1959
+ } else {
1960
+ vErrors.push(err1);
1961
+ }
1962
+ errors++;
1963
+ }
1964
+ }
1965
+ if (data.id !== void 0) {
1966
+ let data0 = data.id;
1967
+ if (typeof data0 === "string") {
1968
+ if (!pattern0.test(data0)) {
1969
+ const err2 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
1970
+ if (vErrors === null) {
1971
+ vErrors = [err2];
1972
+ } else {
1973
+ vErrors.push(err2);
1974
+ }
1975
+ errors++;
1976
+ }
1977
+ } else {
1978
+ const err3 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1979
+ if (vErrors === null) {
1980
+ vErrors = [err3];
1981
+ } else {
1982
+ vErrors.push(err3);
1983
+ }
1984
+ errors++;
1985
+ }
1986
+ }
1987
+ if (data.note !== void 0) {
1988
+ let data1 = data.note;
1989
+ if (typeof data1 === "string") {
1990
+ if (func3(data1) < 1) {
1991
+ const err4 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
1992
+ if (vErrors === null) {
1993
+ vErrors = [err4];
1994
+ } else {
1995
+ vErrors.push(err4);
1996
+ }
1997
+ errors++;
1998
+ }
1999
+ } else {
2000
+ const err5 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2001
+ if (vErrors === null) {
2002
+ vErrors = [err5];
2003
+ } else {
2004
+ vErrors.push(err5);
2005
+ }
2006
+ errors++;
2007
+ }
2008
+ }
2009
+ } else {
2010
+ const err6 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2011
+ if (vErrors === null) {
2012
+ vErrors = [err6];
2013
+ } else {
2014
+ vErrors.push(err6);
2015
+ }
2016
+ errors++;
2017
+ }
2018
+ validate30.errors = vErrors;
2019
+ return errors === 0;
2020
+ }
2021
+ function validate29(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
2022
+ let vErrors = null;
2023
+ let errors = 0;
2024
+ if (data && typeof data == "object" && !Array.isArray(data)) {
2025
+ if (data.branches === void 0) {
2026
+ const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "branches" }, message: "must have required property 'branches'" };
2027
+ if (vErrors === null) {
2028
+ vErrors = [err0];
2029
+ } else {
2030
+ vErrors.push(err0);
2031
+ }
2032
+ errors++;
2033
+ }
2034
+ for (const key0 in data) {
2035
+ if (!(key0 === "branches")) {
2036
+ const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
2037
+ if (vErrors === null) {
2038
+ vErrors = [err1];
2039
+ } else {
2040
+ vErrors.push(err1);
2041
+ }
2042
+ errors++;
2043
+ }
2044
+ }
2045
+ if (data.branches !== void 0) {
2046
+ let data0 = data.branches;
2047
+ if (Array.isArray(data0)) {
2048
+ if (data0.length < 1) {
2049
+ const err2 = { instancePath: instancePath + "/branches", schemaPath: "#/properties/branches/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
2050
+ if (vErrors === null) {
2051
+ vErrors = [err2];
2052
+ } else {
2053
+ vErrors.push(err2);
2054
+ }
2055
+ errors++;
2056
+ }
2057
+ const len0 = data0.length;
2058
+ for (let i0 = 0; i0 < len0; i0++) {
2059
+ if (!validate30(data0[i0], { instancePath: instancePath + "/branches/" + i0, parentData: data0, parentDataProperty: i0, rootData })) {
2060
+ vErrors = vErrors === null ? validate30.errors : vErrors.concat(validate30.errors);
2061
+ errors = vErrors.length;
2062
+ }
2063
+ }
2064
+ } else {
2065
+ const err3 = { instancePath: instancePath + "/branches", schemaPath: "#/properties/branches/type", keyword: "type", params: { type: "array" }, message: "must be array" };
2066
+ if (vErrors === null) {
2067
+ vErrors = [err3];
2068
+ } else {
2069
+ vErrors.push(err3);
2070
+ }
2071
+ errors++;
2072
+ }
2073
+ }
2074
+ } else {
2075
+ const err4 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2076
+ if (vErrors === null) {
2077
+ vErrors = [err4];
2078
+ } else {
2079
+ vErrors.push(err4);
2080
+ }
2081
+ errors++;
2082
+ }
2083
+ validate29.errors = vErrors;
2084
+ return errors === 0;
2085
+ }
2086
+ function validate10(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
2087
+ let vErrors = null;
2088
+ let errors = 0;
2089
+ const _errs1 = errors;
2090
+ let valid0 = true;
2091
+ const _errs2 = errors;
2092
+ if (data && typeof data == "object" && !Array.isArray(data)) {
2093
+ if (data.kind === void 0 && ("kind")) {
2094
+ const err0 = {};
2095
+ if (vErrors === null) {
2096
+ vErrors = [err0];
2097
+ } else {
2098
+ vErrors.push(err0);
2099
+ }
2100
+ errors++;
2101
+ } else {
2102
+ if (data.kind !== void 0) {
2103
+ if ("sequence" !== data.kind) {
2104
+ const err1 = {};
2105
+ if (vErrors === null) {
2106
+ vErrors = [err1];
2107
+ } else {
2108
+ vErrors.push(err1);
2109
+ }
2110
+ errors++;
2111
+ }
2112
+ }
2113
+ }
2114
+ }
2115
+ var _valid0 = _errs2 === errors;
2116
+ errors = _errs1;
2117
+ if (vErrors !== null) {
2118
+ if (_errs1) {
2119
+ vErrors.length = _errs1;
2120
+ } else {
2121
+ vErrors = null;
2122
+ }
2123
+ }
2124
+ let ifClause0;
2125
+ if (_valid0) {
2126
+ const _errs4 = errors;
2127
+ if (data && typeof data == "object" && !Array.isArray(data)) {
2128
+ if (data.sequence === void 0) {
2129
+ const err2 = { instancePath, schemaPath: "#/then/required", keyword: "required", params: { missingProperty: "sequence" }, message: "must have required property 'sequence'" };
2130
+ if (vErrors === null) {
2131
+ vErrors = [err2];
2132
+ } else {
2133
+ vErrors.push(err2);
2134
+ }
2135
+ errors++;
2136
+ }
2137
+ if (data.boxes !== void 0) {
2138
+ let data1 = data.boxes;
2139
+ if (Array.isArray(data1)) {
2140
+ if (data1.length < 1) {
2141
+ const err3 = { instancePath: instancePath + "/boxes", schemaPath: "#/then/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
2142
+ if (vErrors === null) {
2143
+ vErrors = [err3];
2144
+ } else {
2145
+ vErrors.push(err3);
2146
+ }
2147
+ errors++;
2148
+ }
2149
+ }
2150
+ }
2151
+ if (data.steps !== void 0) {
2152
+ let data2 = data.steps;
2153
+ if (Array.isArray(data2)) {
2154
+ const len0 = data2.length;
2155
+ for (let i0 = 0; i0 < len0; i0++) {
2156
+ let data3 = data2[i0];
2157
+ if (data3 && typeof data3 == "object" && !Array.isArray(data3)) {
2158
+ if (data3.events !== void 0) {
2159
+ let data4 = data3.events;
2160
+ if (Array.isArray(data4)) {
2161
+ const len1 = data4.length;
2162
+ for (let i1 = 0; i1 < len1; i1++) {
2163
+ let data5 = data4[i1];
2164
+ if (data5 && typeof data5 == "object" && !Array.isArray(data5)) {
2165
+ if (data5.type !== void 0) {
2166
+ let data6 = data5.type;
2167
+ const _errs12 = errors;
2168
+ const _errs13 = errors;
2169
+ if (!(data6 === "commit" || data6 === "branch")) {
2170
+ const err4 = {};
2171
+ if (vErrors === null) {
2172
+ vErrors = [err4];
2173
+ } else {
2174
+ vErrors.push(err4);
2175
+ }
2176
+ errors++;
2177
+ }
2178
+ var valid10 = _errs13 === errors;
2179
+ if (valid10) {
2180
+ 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" };
2181
+ if (vErrors === null) {
2182
+ vErrors = [err5];
2183
+ } else {
2184
+ vErrors.push(err5);
2185
+ }
2186
+ errors++;
2187
+ } else {
2188
+ errors = _errs12;
2189
+ if (vErrors !== null) {
2190
+ if (_errs12) {
2191
+ vErrors.length = _errs12;
2192
+ } else {
2193
+ vErrors = null;
2194
+ }
2195
+ }
2196
+ }
2197
+ }
2198
+ }
2199
+ }
2200
+ }
2201
+ }
2202
+ }
2203
+ }
2204
+ }
2205
+ }
2206
+ if (data.state !== void 0) {
2207
+ const err6 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
2208
+ if (vErrors === null) {
2209
+ vErrors = [err6];
2210
+ } else {
2211
+ vErrors.push(err6);
2212
+ }
2213
+ errors++;
2214
+ }
2215
+ if (data.git !== void 0) {
2216
+ const err7 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
2217
+ if (vErrors === null) {
2218
+ vErrors = [err7];
2219
+ } else {
2220
+ vErrors.push(err7);
2221
+ }
2222
+ errors++;
2223
+ }
2224
+ }
2225
+ var _valid0 = _errs4 === errors;
2226
+ valid0 = _valid0;
2227
+ ifClause0 = "then";
2228
+ } else {
2229
+ const _errs20 = errors;
2230
+ const _errs21 = errors;
2231
+ let valid13 = true;
2232
+ const _errs22 = errors;
2233
+ if (data && typeof data == "object" && !Array.isArray(data)) {
2234
+ if (data.kind === void 0 && ("kind")) {
2235
+ const err8 = {};
2236
+ if (vErrors === null) {
2237
+ vErrors = [err8];
2238
+ } else {
2239
+ vErrors.push(err8);
2240
+ }
2241
+ errors++;
2242
+ } else {
2243
+ if (data.kind !== void 0) {
2244
+ if ("state" !== data.kind) {
2245
+ const err9 = {};
2246
+ if (vErrors === null) {
2247
+ vErrors = [err9];
2248
+ } else {
2249
+ vErrors.push(err9);
2250
+ }
2251
+ errors++;
2252
+ }
2253
+ }
2254
+ }
2255
+ }
2256
+ var _valid1 = _errs22 === errors;
2257
+ errors = _errs21;
2258
+ if (vErrors !== null) {
2259
+ if (_errs21) {
2260
+ vErrors.length = _errs21;
2261
+ } else {
2262
+ vErrors = null;
2263
+ }
2264
+ }
2265
+ let ifClause1;
2266
+ if (_valid1) {
2267
+ const _errs24 = errors;
2268
+ if (data && typeof data == "object" && !Array.isArray(data)) {
2269
+ if (data.boxes !== void 0) {
2270
+ let data10 = data.boxes;
2271
+ if (Array.isArray(data10)) {
2272
+ if (data10.length < 1) {
2273
+ const err10 = { instancePath: instancePath + "/boxes", schemaPath: "#/else/then/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
2274
+ if (vErrors === null) {
2275
+ vErrors = [err10];
2276
+ } else {
2277
+ vErrors.push(err10);
2278
+ }
2279
+ errors++;
2280
+ }
2281
+ const len2 = data10.length;
2282
+ for (let i2 = 0; i2 < len2; i2++) {
2283
+ let data11 = data10[i2];
2284
+ if (data11 && typeof data11 == "object" && !Array.isArray(data11)) {
2285
+ if (data11.id !== void 0) {
2286
+ let data12 = data11.id;
2287
+ const _errs28 = errors;
2288
+ const _errs29 = errors;
2289
+ if (!(data12 === "start" || data12 === "finish")) {
2290
+ const err11 = {};
2291
+ if (vErrors === null) {
2292
+ vErrors = [err11];
2293
+ } else {
2294
+ vErrors.push(err11);
2295
+ }
2296
+ errors++;
2297
+ }
2298
+ var valid19 = _errs29 === errors;
2299
+ if (valid19) {
2300
+ const err12 = { instancePath: instancePath + "/boxes/" + i2 + "/id", schemaPath: "#/else/then/properties/boxes/items/properties/id/not", keyword: "not", params: {}, message: "must NOT be valid" };
2301
+ if (vErrors === null) {
2302
+ vErrors = [err12];
2303
+ } else {
2304
+ vErrors.push(err12);
2305
+ }
2306
+ errors++;
2307
+ } else {
2308
+ errors = _errs28;
2309
+ if (vErrors !== null) {
2310
+ if (_errs28) {
2311
+ vErrors.length = _errs28;
2312
+ } else {
2313
+ vErrors = null;
2314
+ }
2315
+ }
2316
+ }
2317
+ }
2318
+ }
2319
+ }
2320
+ }
2321
+ }
2322
+ if (data.steps !== void 0) {
2323
+ let data13 = data.steps;
2324
+ if (Array.isArray(data13)) {
2325
+ const len3 = data13.length;
2326
+ for (let i3 = 0; i3 < len3; i3++) {
2327
+ let data14 = data13[i3];
2328
+ if (data14 && typeof data14 == "object" && !Array.isArray(data14)) {
2329
+ if (data14.events !== void 0) {
2330
+ let data15 = data14.events;
2331
+ if (Array.isArray(data15)) {
2332
+ const len4 = data15.length;
2333
+ for (let i4 = 0; i4 < len4; i4++) {
2334
+ let data16 = data15[i4];
2335
+ if (data16 && typeof data16 == "object" && !Array.isArray(data16)) {
2336
+ if (data16.type !== void 0) {
2337
+ let data17 = data16.type;
2338
+ const _errs36 = errors;
2339
+ const _errs37 = errors;
2340
+ if (!(data17 === "commit" || data17 === "branch")) {
2341
+ const err13 = {};
2342
+ if (vErrors === null) {
2343
+ vErrors = [err13];
2344
+ } else {
2345
+ vErrors.push(err13);
2346
+ }
2347
+ errors++;
2348
+ }
2349
+ var valid27 = _errs37 === errors;
2350
+ if (valid27) {
2351
+ 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" };
2352
+ if (vErrors === null) {
2353
+ vErrors = [err14];
2354
+ } else {
2355
+ vErrors.push(err14);
2356
+ }
2357
+ errors++;
2358
+ } else {
2359
+ errors = _errs36;
2360
+ if (vErrors !== null) {
2361
+ if (_errs36) {
2362
+ vErrors.length = _errs36;
2363
+ } else {
2364
+ vErrors = null;
2365
+ }
2366
+ }
2367
+ }
2368
+ }
2369
+ }
2370
+ }
2371
+ }
2372
+ }
2373
+ }
2374
+ }
2375
+ }
2376
+ }
2377
+ if (data.git !== void 0) {
2378
+ const err15 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
2379
+ if (vErrors === null) {
2380
+ vErrors = [err15];
2381
+ } else {
2382
+ vErrors.push(err15);
2383
+ }
2384
+ errors++;
2385
+ }
2386
+ }
2387
+ var _valid1 = _errs24 === errors;
2388
+ valid13 = _valid1;
2389
+ ifClause1 = "then";
2390
+ } else {
2391
+ const _errs41 = errors;
2392
+ const _errs42 = errors;
2393
+ let valid29 = true;
2394
+ const _errs43 = errors;
2395
+ if (data && typeof data == "object" && !Array.isArray(data)) {
2396
+ if (data.kind === void 0 && ("kind")) {
2397
+ const err16 = {};
2398
+ if (vErrors === null) {
2399
+ vErrors = [err16];
2400
+ } else {
2401
+ vErrors.push(err16);
2402
+ }
2403
+ errors++;
2404
+ } else {
2405
+ if (data.kind !== void 0) {
2406
+ if ("git" !== data.kind) {
2407
+ const err17 = {};
2408
+ if (vErrors === null) {
2409
+ vErrors = [err17];
2410
+ } else {
2411
+ vErrors.push(err17);
2412
+ }
2413
+ errors++;
2414
+ }
2415
+ }
2416
+ }
2417
+ }
2418
+ var _valid2 = _errs43 === errors;
2419
+ errors = _errs42;
2420
+ if (vErrors !== null) {
2421
+ if (_errs42) {
2422
+ vErrors.length = _errs42;
2423
+ } else {
2424
+ vErrors = null;
2425
+ }
2426
+ }
2427
+ let ifClause2;
2428
+ if (_valid2) {
2429
+ const _errs45 = errors;
2430
+ if (data && typeof data == "object" && !Array.isArray(data)) {
2431
+ if (data.git === void 0) {
2432
+ const err18 = { instancePath, schemaPath: "#/else/else/then/required", keyword: "required", params: { missingProperty: "git" }, message: "must have required property 'git'" };
2433
+ if (vErrors === null) {
2434
+ vErrors = [err18];
2435
+ } else {
2436
+ vErrors.push(err18);
2437
+ }
2438
+ errors++;
2439
+ }
2440
+ if (data.state !== void 0) {
2441
+ const err19 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
2442
+ if (vErrors === null) {
2443
+ vErrors = [err19];
2444
+ } else {
2445
+ vErrors.push(err19);
2446
+ }
2447
+ errors++;
2448
+ }
2449
+ if (data.regions !== void 0) {
2450
+ const err20 = { instancePath: instancePath + "/regions", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
2451
+ if (vErrors === null) {
2452
+ vErrors = [err20];
2453
+ } else {
2454
+ vErrors.push(err20);
2455
+ }
2456
+ errors++;
2457
+ }
2458
+ }
2459
+ var _valid2 = _errs45 === errors;
2460
+ valid29 = _valid2;
2461
+ ifClause2 = "then";
2462
+ } else {
2463
+ const _errs52 = errors;
2464
+ if (data && typeof data == "object" && !Array.isArray(data)) {
2465
+ if (data.boxes !== void 0) {
2466
+ let data22 = data.boxes;
2467
+ if (Array.isArray(data22)) {
2468
+ if (data22.length < 1) {
2469
+ 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" };
2470
+ if (vErrors === null) {
2471
+ vErrors = [err21];
2472
+ } else {
2473
+ vErrors.push(err21);
2474
+ }
2475
+ errors++;
2476
+ }
2477
+ }
2478
+ }
2479
+ if (data.steps !== void 0) {
2480
+ let data23 = data.steps;
2481
+ if (Array.isArray(data23)) {
2482
+ const len5 = data23.length;
2483
+ for (let i5 = 0; i5 < len5; i5++) {
2484
+ let data24 = data23[i5];
2485
+ if (data24 && typeof data24 == "object" && !Array.isArray(data24)) {
2486
+ if (data24.events !== void 0) {
2487
+ let data25 = data24.events;
2488
+ if (Array.isArray(data25)) {
2489
+ const len6 = data25.length;
2490
+ for (let i6 = 0; i6 < len6; i6++) {
2491
+ let data26 = data25[i6];
2492
+ if (data26 && typeof data26 == "object" && !Array.isArray(data26)) {
2493
+ if (data26.type !== void 0) {
2494
+ let data27 = data26.type;
2495
+ const _errs60 = errors;
2496
+ const _errs61 = errors;
2497
+ if (!(data27 === "commit" || data27 === "branch")) {
2498
+ const err22 = {};
2499
+ if (vErrors === null) {
2500
+ vErrors = [err22];
2501
+ } else {
2502
+ vErrors.push(err22);
2503
+ }
2504
+ errors++;
2505
+ }
2506
+ var valid42 = _errs61 === errors;
2507
+ if (valid42) {
2508
+ 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" };
2509
+ if (vErrors === null) {
2510
+ vErrors = [err23];
2511
+ } else {
2512
+ vErrors.push(err23);
2513
+ }
2514
+ errors++;
2515
+ } else {
2516
+ errors = _errs60;
2517
+ if (vErrors !== null) {
2518
+ if (_errs60) {
2519
+ vErrors.length = _errs60;
2520
+ } else {
2521
+ vErrors = null;
2522
+ }
2523
+ }
2524
+ }
2525
+ }
2526
+ }
2527
+ }
2528
+ }
2529
+ }
2530
+ }
2531
+ }
2532
+ }
2533
+ }
2534
+ if (data.state !== void 0) {
2535
+ const err24 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
2536
+ if (vErrors === null) {
2537
+ vErrors = [err24];
2538
+ } else {
2539
+ vErrors.push(err24);
2540
+ }
2541
+ errors++;
2542
+ }
2543
+ if (data.git !== void 0) {
2544
+ const err25 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
2545
+ if (vErrors === null) {
2546
+ vErrors = [err25];
2547
+ } else {
2548
+ vErrors.push(err25);
2549
+ }
2550
+ errors++;
2551
+ }
2552
+ }
2553
+ var _valid2 = _errs52 === errors;
2554
+ valid29 = _valid2;
2555
+ ifClause2 = "else";
2556
+ }
2557
+ if (!valid29) {
2558
+ const err26 = { instancePath, schemaPath: "#/else/else/if", keyword: "if", params: { failingKeyword: ifClause2 }, message: 'must match "' + ifClause2 + '" schema' };
2559
+ if (vErrors === null) {
2560
+ vErrors = [err26];
2561
+ } else {
2562
+ vErrors.push(err26);
2563
+ }
2564
+ errors++;
2565
+ }
2566
+ var _valid1 = _errs41 === errors;
2567
+ valid13 = _valid1;
2568
+ ifClause1 = "else";
2569
+ }
2570
+ if (!valid13) {
2571
+ const err27 = { instancePath, schemaPath: "#/else/if", keyword: "if", params: { failingKeyword: ifClause1 }, message: 'must match "' + ifClause1 + '" schema' };
2572
+ if (vErrors === null) {
2573
+ vErrors = [err27];
2574
+ } else {
2575
+ vErrors.push(err27);
2576
+ }
2577
+ errors++;
2578
+ }
2579
+ if (data && typeof data == "object" && !Array.isArray(data)) {
2580
+ if (data.sequence !== void 0) {
2581
+ const err28 = { instancePath: instancePath + "/sequence", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
2582
+ if (vErrors === null) {
2583
+ vErrors = [err28];
2584
+ } else {
2585
+ vErrors.push(err28);
2586
+ }
2587
+ errors++;
2588
+ }
2589
+ }
2590
+ var _valid0 = _errs20 === errors;
2591
+ valid0 = _valid0;
2592
+ ifClause0 = "else";
2593
+ }
2594
+ if (!valid0) {
2595
+ const err29 = { instancePath, schemaPath: "#/if", keyword: "if", params: { failingKeyword: ifClause0 }, message: 'must match "' + ifClause0 + '" schema' };
2596
+ if (vErrors === null) {
2597
+ vErrors = [err29];
2598
+ } else {
2599
+ vErrors.push(err29);
2600
+ }
2601
+ errors++;
2602
+ }
2603
+ if (data && typeof data == "object" && !Array.isArray(data)) {
2604
+ if (data.version === void 0) {
2605
+ const err30 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "version" }, message: "must have required property 'version'" };
2606
+ if (vErrors === null) {
2607
+ vErrors = [err30];
2608
+ } else {
2609
+ vErrors.push(err30);
2610
+ }
2611
+ errors++;
2612
+ }
2613
+ if (data.kind === void 0) {
2614
+ const err31 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "kind" }, message: "must have required property 'kind'" };
2615
+ if (vErrors === null) {
2616
+ vErrors = [err31];
2617
+ } else {
2618
+ vErrors.push(err31);
2619
+ }
2620
+ errors++;
2621
+ }
2622
+ if (data.title === void 0) {
2623
+ const err32 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "title" }, message: "must have required property 'title'" };
2624
+ if (vErrors === null) {
2625
+ vErrors = [err32];
2626
+ } else {
2627
+ vErrors.push(err32);
2628
+ }
2629
+ errors++;
2630
+ }
2631
+ if (data.boxes === void 0) {
2632
+ const err33 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "boxes" }, message: "must have required property 'boxes'" };
2633
+ if (vErrors === null) {
2634
+ vErrors = [err33];
2635
+ } else {
2636
+ vErrors.push(err33);
2637
+ }
2638
+ errors++;
2639
+ }
2640
+ if (data.steps === void 0) {
2641
+ const err34 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "steps" }, message: "must have required property 'steps'" };
2642
+ if (vErrors === null) {
2643
+ vErrors = [err34];
2644
+ } else {
2645
+ vErrors.push(err34);
2646
+ }
2647
+ errors++;
2648
+ }
2649
+ for (const key0 in data) {
2650
+ if (!func2.call(schema11.properties, key0)) {
2651
+ const err35 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
2652
+ if (vErrors === null) {
2653
+ vErrors = [err35];
2654
+ } else {
2655
+ vErrors.push(err35);
2656
+ }
2657
+ errors++;
2658
+ }
2659
+ }
2660
+ if (data.version !== void 0) {
2661
+ let data31 = data.version;
2662
+ if (!(typeof data31 == "number" && (!(data31 % 1) && !isNaN(data31)) && isFinite(data31))) {
2663
+ const err36 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
2664
+ if (vErrors === null) {
2665
+ vErrors = [err36];
2666
+ } else {
2667
+ vErrors.push(err36);
2668
+ }
2669
+ errors++;
2670
+ }
2671
+ if (typeof data31 == "number" && isFinite(data31)) {
2672
+ if (data31 < 1 || isNaN(data31)) {
2673
+ const err37 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
2674
+ if (vErrors === null) {
2675
+ vErrors = [err37];
2676
+ } else {
2677
+ vErrors.push(err37);
2678
+ }
2679
+ errors++;
2680
+ }
2681
+ }
2682
+ }
2683
+ if (data.kind !== void 0) {
2684
+ let data32 = data.kind;
2685
+ if (!(data32 === "sequence" || data32 === "architecture" || data32 === "state" || data32 === "git")) {
2686
+ 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" };
2687
+ if (vErrors === null) {
2688
+ vErrors = [err38];
2689
+ } else {
2690
+ vErrors.push(err38);
2691
+ }
2692
+ errors++;
2693
+ }
2694
+ }
2695
+ if (data.title !== void 0) {
2696
+ let data33 = data.title;
2697
+ if (typeof data33 === "string") {
2698
+ if (func3(data33) < 1) {
2699
+ const err39 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
2700
+ if (vErrors === null) {
2701
+ vErrors = [err39];
2702
+ } else {
2703
+ vErrors.push(err39);
2704
+ }
2705
+ errors++;
2706
+ }
2707
+ } else {
2708
+ const err40 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2709
+ if (vErrors === null) {
2710
+ vErrors = [err40];
2711
+ } else {
2712
+ vErrors.push(err40);
2713
+ }
2714
+ errors++;
2715
+ }
2716
+ }
2717
+ if (data.view !== void 0) {
2718
+ let data34 = data.view;
2719
+ if (!(data34 === "fixed" || data34 === "follow")) {
2720
+ 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" };
2721
+ if (vErrors === null) {
2722
+ vErrors = [err41];
2723
+ } else {
2724
+ vErrors.push(err41);
2725
+ }
2726
+ errors++;
2727
+ }
2728
+ }
2729
+ if (data.regions !== void 0) {
2730
+ let data35 = data.regions;
2731
+ if (Array.isArray(data35)) {
2732
+ const len7 = data35.length;
2733
+ for (let i7 = 0; i7 < len7; i7++) {
2734
+ if (!validate11(data35[i7], { instancePath: instancePath + "/regions/" + i7, parentData: data35, parentDataProperty: i7, rootData })) {
2735
+ vErrors = vErrors === null ? validate11.errors : vErrors.concat(validate11.errors);
2736
+ errors = vErrors.length;
2737
+ }
2738
+ }
2739
+ } else {
2740
+ const err42 = { instancePath: instancePath + "/regions", schemaPath: "#/properties/regions/type", keyword: "type", params: { type: "array" }, message: "must be array" };
2741
+ if (vErrors === null) {
2742
+ vErrors = [err42];
2743
+ } else {
2744
+ vErrors.push(err42);
2745
+ }
2746
+ errors++;
2747
+ }
2748
+ }
2749
+ if (data.boxes !== void 0) {
2750
+ let data37 = data.boxes;
2751
+ if (Array.isArray(data37)) {
2752
+ const len8 = data37.length;
2753
+ for (let i8 = 0; i8 < len8; i8++) {
2754
+ if (!validate13(data37[i8], { instancePath: instancePath + "/boxes/" + i8, parentData: data37, parentDataProperty: i8, rootData })) {
2755
+ vErrors = vErrors === null ? validate13.errors : vErrors.concat(validate13.errors);
2756
+ errors = vErrors.length;
2757
+ }
2758
+ }
2759
+ } else {
2760
+ const err43 = { instancePath: instancePath + "/boxes", schemaPath: "#/properties/boxes/type", keyword: "type", params: { type: "array" }, message: "must be array" };
2761
+ if (vErrors === null) {
2762
+ vErrors = [err43];
2763
+ } else {
2764
+ vErrors.push(err43);
2765
+ }
2766
+ errors++;
2767
+ }
2768
+ }
2769
+ if (data.strip !== void 0) {
2770
+ if (!validate15(data.strip, { instancePath: instancePath + "/strip", parentData: data, parentDataProperty: "strip", rootData })) {
2771
+ vErrors = vErrors === null ? validate15.errors : vErrors.concat(validate15.errors);
2772
+ errors = vErrors.length;
2773
+ }
2774
+ }
2775
+ if (data.steps !== void 0) {
2776
+ let data40 = data.steps;
2777
+ if (Array.isArray(data40)) {
2778
+ if (data40.length < 1) {
2779
+ const err44 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
2780
+ if (vErrors === null) {
2781
+ vErrors = [err44];
2782
+ } else {
2783
+ vErrors.push(err44);
2784
+ }
2785
+ errors++;
2786
+ }
2787
+ const len9 = data40.length;
2788
+ for (let i9 = 0; i9 < len9; i9++) {
2789
+ if (!validate17(data40[i9], { instancePath: instancePath + "/steps/" + i9, parentData: data40, parentDataProperty: i9, rootData })) {
2790
+ vErrors = vErrors === null ? validate17.errors : vErrors.concat(validate17.errors);
2791
+ errors = vErrors.length;
2792
+ }
2793
+ }
2794
+ } else {
2795
+ const err45 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/type", keyword: "type", params: { type: "array" }, message: "must be array" };
2796
+ if (vErrors === null) {
2797
+ vErrors = [err45];
2798
+ } else {
2799
+ vErrors.push(err45);
2800
+ }
2801
+ errors++;
2802
+ }
2803
+ }
2804
+ if (data.sequence !== void 0) {
2805
+ if (!validate23(data.sequence, { instancePath: instancePath + "/sequence", parentData: data, parentDataProperty: "sequence", rootData })) {
2806
+ vErrors = vErrors === null ? validate23.errors : vErrors.concat(validate23.errors);
2807
+ errors = vErrors.length;
2808
+ }
2809
+ }
2810
+ if (data.state !== void 0) {
2811
+ if (!validate25(data.state, { instancePath: instancePath + "/state", parentData: data, parentDataProperty: "state", rootData })) {
2812
+ vErrors = vErrors === null ? validate25.errors : vErrors.concat(validate25.errors);
2813
+ errors = vErrors.length;
2814
+ }
2815
+ }
2816
+ if (data.git !== void 0) {
2817
+ if (!validate29(data.git, { instancePath: instancePath + "/git", parentData: data, parentDataProperty: "git", rootData })) {
2818
+ vErrors = vErrors === null ? validate29.errors : vErrors.concat(validate29.errors);
2819
+ errors = vErrors.length;
2820
+ }
2821
+ }
2822
+ } else {
2823
+ const err46 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2824
+ if (vErrors === null) {
2825
+ vErrors = [err46];
2826
+ } else {
2827
+ vErrors.push(err46);
2828
+ }
2829
+ errors++;
2830
+ }
2831
+ validate10.errors = vErrors;
2832
+ return errors === 0;
2833
+ }
2834
+ var STATE_ENDS = ["start", "finish"];
2835
+
2836
+ // src/schema.ts
2837
+ var EVENT_TYPES = ["edge", "action", "swap", "strip", "commit", "branch"];
2838
+ var ABSENT = "#/definitions/absent/not";
2839
+ var ABSENT_KINDS = { regions: "sequence / architecture / state" };
2840
+ var NOT_ALLOWED = {
2841
+ carry: { field: "text", kind: "tag" }
2842
+ };
2843
+ var RESERVED_ID = /\/boxes\/items\/properties\/id\/not$/u;
2844
+ var GIT_EVENT = /\/events\/items\/properties\/type\/not$/u;
2845
+ var GIT_EVENTS = ["commit", "branch"];
2846
+ var escape = (key) => key.replaceAll("~", "~0").replaceAll("/", "~1");
2847
+ var HEX = /^\^\[0-9a-f\]\{(\d+),(\d+)\}\$$/u;
2848
+ function forbiddenOf(pattern) {
2849
+ const inside = /^\^\[\^(.+)\]\+\$$/u.exec(pattern)?.[1];
2850
+ if (inside === void 0) return void 0;
2851
+ const chars = inside.match(/\\.|[^\\]/gu) ?? [];
2852
+ return { space: chars.includes("\\s"), chars: chars.filter((char) => char !== "\\s").map((char) => char.replace(/^\\/u, "")) };
2853
+ }
2854
+ var branchesOf = (anyOf, errors) => errors.filter(
2855
+ (error) => error !== anyOf && error.schemaPath.startsWith(`${anyOf.schemaPath}/`) && (error.instancePath === anyOf.instancePath || error.instancePath.startsWith(`${anyOf.instancePath}/`))
2856
+ );
2857
+ function toFieldError(error, errors, m) {
2858
+ const params = error.params;
2859
+ const at = error.instancePath;
2860
+ switch (error.keyword) {
2861
+ case "additionalProperties": {
2862
+ const key = String(params.additionalProperty);
2863
+ return { pointer: `${at}/${escape(key)}`, message: m.additionalProperties(key) };
2864
+ }
2865
+ case "required": {
2866
+ const key = String(params.missingProperty);
2867
+ return { pointer: `${at}/${escape(key)}`, message: m.required(key) };
2868
+ }
2869
+ case "not": {
2870
+ if (RESERVED_ID.test(error.schemaPath)) return { pointer: at, message: m.reserved(STATE_ENDS) };
2871
+ if (GIT_EVENT.test(error.schemaPath)) return { pointer: at, message: m.kindOnly(GIT_EVENTS, "git") };
2872
+ const last = at.slice(at.lastIndexOf("/") + 1);
2873
+ if (error.schemaPath === ABSENT) return { pointer: at, message: m.not({ field: last, kind: ABSENT_KINDS[last] ?? last }) };
2874
+ const allowed = NOT_ALLOWED[last];
2875
+ return { pointer: allowed ? `${at}/${allowed.field}` : at, message: m.not(allowed) };
2876
+ }
2877
+ case "anyOf": {
2878
+ const branches = branchesOf(error, errors);
2879
+ const missing = branches.every((branch) => branch.keyword === "required") ? branches.map((branch) => String(branch.params.missingProperty)) : [];
2880
+ return { pointer: at, message: m.anyOf(missing) };
2881
+ }
2882
+ case "discriminator": {
2883
+ const tag = String(params.tag);
2884
+ return { pointer: `${at}/${escape(tag)}`, message: m.discriminator(tag, EVENT_TYPES) };
2885
+ }
2886
+ case "enum":
2887
+ return { pointer: at, message: m.enum(params.allowedValues.map(String)) };
2888
+ case "type":
2889
+ return { pointer: at, message: m.type(String(params.type)) };
2890
+ case "minLength":
2891
+ return { pointer: at, message: m.minLength(Number(params.limit)) };
2892
+ case "pattern": {
2893
+ const hex = HEX.exec(String(params.pattern));
2894
+ return { pointer: at, message: hex ? m.hex(Number(hex[1]), Number(hex[2])) : m.pattern(forbiddenOf(String(params.pattern))) };
2895
+ }
2896
+ case "minItems":
2897
+ return { pointer: at, message: m.minItems(Number(params.limit)) };
2898
+ case "minimum":
2899
+ return { pointer: at, message: m.minimum(Number(params.limit)) };
2900
+ case "const":
2901
+ return { pointer: at, message: m.const(String(params.allowedValue)) };
2902
+ case "oneOf":
2903
+ return { pointer: at, message: m.oneOf };
2904
+ default:
2905
+ return { pointer: at, message: error.message ?? error.keyword };
2906
+ }
2907
+ }
2908
+ function validateDiagram(input, options = {}) {
2909
+ if (validate_diagram_default(input)) return { ok: true };
2910
+ const all = validate_diagram_default.errors ?? [];
2911
+ const inBranch = new Set(all.filter((error) => error.keyword === "anyOf").flatMap((anyOf) => branchesOf(anyOf, all)));
2912
+ const m = FIELD_MESSAGES[options.lang ?? "ja"];
2913
+ const errors = all.filter((error) => error.keyword !== "if" && !inBranch.has(error)).map((error) => toFieldError(error, all, m));
2914
+ return { ok: false, errors };
2915
+ }
2916
+
2917
+ // src/version.ts
2918
+ var FORMAT_VERSION = 1;
2919
+ function newerThanTool(input) {
2920
+ if (typeof input !== "object" || input === null) return void 0;
2921
+ const version = input.version;
2922
+ return typeof version === "number" && version > FORMAT_VERSION ? version : void 0;
2923
+ }
2924
+ var newerError = (version, lang) => ({
2925
+ pointer: "/version",
2926
+ message: FIELD_MESSAGES[lang].newer(version, FORMAT_VERSION)
2927
+ });
2928
+ function readDiagram(input, options = {}) {
2929
+ const newer = newerThanTool(input);
2930
+ if (newer !== void 0) return { ok: false, errors: [newerError(newer, options.lang ?? "ja")] };
2931
+ const checked = validateDiagram(input, options);
2932
+ if (!checked.ok) return checked;
2933
+ return { ok: true, diagram: input, warnings: [] };
2934
+ }
2935
+
2936
+ // src/node.ts
2937
+ async function migrateFile(path) {
2938
+ const input = JSON.parse(await promises.readFile(path, "utf8"));
2939
+ const read = readDiagram(input);
2940
+ if (!read.ok) throw new Error(`${path} \u3092\u79FB\u305B\u306A\u3044: ${read.errors.map((error) => `${error.pointer} ${error.message}`).join(" / ")}`);
2941
+ return { changed: false, from: read.diagram.version, to: FORMAT_VERSION };
2942
+ }
2943
+
2944
+ exports.migrateFile = migrateFile;
2945
+ //# sourceMappingURL=node.cjs.map
2946
+ //# sourceMappingURL=node.cjs.map