@viritura/score-engine 0.2.1-next.39 → 0.2.1-next.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -602,9 +602,9 @@ function parseChordSymbolText(input, position) {
602
602
 
603
603
  // packages/core/src/operations/lyricExtenders.ts
604
604
  init_define_import_meta_env();
605
- function durationBeats(duration) {
606
- let base = DURATION_BEATS[duration.base], dots = 1;
607
- for (let index = 0; index < (duration.dots ?? 0); index++) dots += 0.5 ** (index + 1);
605
+ function durationBeats(duration2) {
606
+ let base = DURATION_BEATS[duration2.base], dots = 1;
607
+ for (let index = 0; index < (duration2.dots ?? 0); index++) dots += 0.5 ** (index + 1);
608
608
  return base * dots;
609
609
  }
610
610
  function quantityBeats(quantity) {
@@ -614,7 +614,7 @@ function walkTimedContent(content, startBeat, scale, partIndex, sequenceIndex, v
614
614
  let cursor = startBeat;
615
615
  for (let item of content) {
616
616
  if (item.type === "event") {
617
- let duration = durationBeats(item.duration) * scale;
617
+ let duration2 = durationBeats(item.duration) * scale;
618
618
  output.push({
619
619
  event: item,
620
620
  partIndex,
@@ -623,10 +623,10 @@ function walkTimedContent(content, startBeat, scale, partIndex, sequenceIndex, v
623
623
  staff,
624
624
  measureIndex,
625
625
  startBeat: cursor,
626
- durationBeats: duration,
626
+ durationBeats: duration2,
627
627
  rest: isRest(item),
628
628
  ordinal: ordinal.value++
629
- }), cursor += duration;
629
+ }), cursor += duration2;
630
630
  continue;
631
631
  }
632
632
  if (item.type === "space") {
@@ -2231,9 +2231,9 @@ function interpolateBeatAnchors(bounds, beat, endX) {
2231
2231
 
2232
2232
  // packages/score-engine/src/buildInfo.ts
2233
2233
  init_define_import_meta_env();
2234
- var PACKAGE_VERSION = "0.2.1-next.39", BUNDLE_WORKER_FILE = "score-engine.worker.js";
2234
+ var PACKAGE_VERSION = "0.2.1-next.41", BUNDLE_WORKER_FILE = "score-engine.worker.js";
2235
2235
  function buildCommit() {
2236
- return "c83a57c32642a6e875c34211c98b01efcc8f3132";
2236
+ return "715e88d4c5a7118150857b4e89598e4560d44b58";
2237
2237
  }
2238
2238
  function bundledAssetBase() {
2239
2239
  let moduleUrl = import.meta.url;
@@ -9202,7 +9202,7 @@ function validate371(data, { instancePath = "", parentData, parentDataProperty,
9202
9202
  }
9203
9203
  validate371.evaluated = { props: !0, dynamicProps: !1, dynamicItems: !1 };
9204
9204
  var measureGlobalExtensions = validate401;
9205
- var schema378 = { type: "object", description: "Unified tempo marking. BPM and value must occur together; without them an explicit swing instruction is required.", properties: { bpm: { type: "number", exclusiveMinimum: 0 }, value: { type: "object", required: ["base"], properties: { base: { type: "string", enum: ["duplexMaxima", "maxima", "longa", "breve", "whole", "half", "quarter", "eighth", "16th", "32nd", "64th", "128th", "256th", "512th", "1024th", "2048th", "4096th"] }, dots: { type: "integer", minimum: 0 } }, additionalProperties: !1 }, location: { type: "object", required: ["fraction"], properties: { fraction: { type: "array", prefixItems: [{ type: "integer", minimum: 0, maximum: 9007199254740991 }, { type: "integer", minimum: 1, maximum: 9007199254740991 }], items: !1, minItems: 2, maxItems: 2 } }, additionalProperties: !1 }, swing: { $ref: "#/$defs/swing" }, text: { $ref: "#/$defs/text-content" }, showMetronomeMark: { type: "boolean" }, showText: { type: "boolean" }, manualOffset: { $ref: "#/$defs/sp-delta" }, avoidCollisions: { type: "boolean" } }, oneOf: [{ required: ["bpm", "value"] }, { required: ["swing"], not: { anyOf: [{ required: ["bpm"] }, { required: ["value"] }] } }], additionalProperties: !1 }, schema379 = { description: "Explicit rhythm instruction, independent of the metronome beat unit. Omission means inherit; straight explicitly resets swing.", oneOf: [{ type: "object", required: ["mode"], properties: { mode: { const: "straight", type: "string" } }, additionalProperties: !1 }, { type: "object", required: ["mode", "subdivision", "ratio"], properties: { mode: { const: "swing", type: "string" }, subdivision: { type: "string", enum: ["eighth", "16th"] }, ratio: { type: "array", items: { type: "integer", minimum: 1, maximum: 9007199254740991 }, minItems: 2, maxItems: 2, description: "Exact positive long:short ratio, not a percentage or a guessed source value." } }, additionalProperties: !1 }] };
9205
+ var schema378 = { type: "object", description: "Unified tempo marking. BPM and value occur together; BPM-free markings carry explicit swing or nonempty cosmetic text.", properties: { bpm: { type: "number", exclusiveMinimum: 0 }, value: { type: "object", required: ["base"], properties: { base: { type: "string", enum: ["duplexMaxima", "maxima", "longa", "breve", "whole", "half", "quarter", "eighth", "16th", "32nd", "64th", "128th", "256th", "512th", "1024th", "2048th", "4096th"] }, dots: { type: "integer", minimum: 0 } }, additionalProperties: !1 }, location: { type: "object", required: ["fraction"], properties: { fraction: { type: "array", prefixItems: [{ type: "integer", minimum: 0, maximum: 9007199254740991 }, { type: "integer", minimum: 1, maximum: 9007199254740991 }], items: !1, minItems: 2, maxItems: 2 } }, additionalProperties: !1 }, swing: { $ref: "#/$defs/swing" }, text: { $ref: "#/$defs/text-content" }, showMetronomeMark: { type: "boolean" }, showText: { type: "boolean" }, manualOffset: { $ref: "#/$defs/sp-delta" }, avoidCollisions: { type: "boolean" } }, oneOf: [{ required: ["bpm", "value"] }, { required: ["swing"], not: { anyOf: [{ required: ["bpm"] }, { required: ["value"] }] } }, { required: ["text"], properties: { text: { minItems: 1 } }, not: { anyOf: [{ required: ["bpm"] }, { required: ["value"] }, { required: ["swing"] }] } }], additionalProperties: !1 }, schema379 = { description: "Explicit rhythm instruction, independent of the metronome beat unit. Omission means inherit; straight explicitly resets swing.", oneOf: [{ type: "object", required: ["mode"], properties: { mode: { const: "straight", type: "string" } }, additionalProperties: !1 }, { type: "object", required: ["mode", "subdivision", "ratio"], properties: { mode: { const: "swing", type: "string" }, subdivision: { type: "string", enum: ["eighth", "16th"] }, ratio: { type: "array", items: { type: "integer", minimum: 1, maximum: 9007199254740991 }, minItems: 2, maxItems: 2, description: "Exact positive long:short ratio, not a percentage or a guessed source value." } }, additionalProperties: !1 }] };
9206
9206
  var schema382 = { type: "object", description: "Inline text formatting. Omitted fields inherit the owning text role's style.", properties: { font: { type: "string", enum: ["serif", "sans-serif", "monospace"] }, size: { type: "number", exclusiveMinimum: 0, maximum: 12, description: "Relative size as a multiple of the owning text role's resolved size (the CSS 'em' equivalent), not an absolute point size. Distinct from text-style.size, which counts staff spaces for a whole role." }, weight: { oneOf: [{ type: "string", enum: ["normal", "bold"] }, { type: "number", minimum: 1, maximum: 1e3 }] }, fontStyle: { type: "string", enum: ["normal", "italic", "oblique"] }, decorations: { type: "array", description: "Line decorations applied together. A set rather than a single value, because both MusicXML and Finale treat underline, overline and strikethrough as independent.", items: { type: "string", enum: ["underline", "overline", "strikethrough"] }, uniqueItems: !0, minItems: 1 }, enclosure: { type: "string", enum: ["box", "circle"] }, color: { type: "string", pattern: "^#[0-9a-fA-F]{6}$" } }, additionalProperties: !1 };
9207
9207
  function validate404(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
9208
9208
  let vErrors = null, errors = 0, evaluated0 = validate404.evaluated;
@@ -9796,297 +9796,364 @@ function validate402(data, { instancePath = "", parentData, parentDataProperty,
9796
9796
  vErrors === null ? vErrors = [err6] : vErrors.push(err6), errors++;
9797
9797
  }
9798
9798
  var _valid0 = _errs3 === errors;
9799
- if (_valid0 && valid0 ? (valid0 = !1, passing0 = [passing0, 1]) : _valid0 && (valid0 = !0, passing0 = 1), valid0)
9799
+ if (_valid0 && valid0)
9800
+ valid0 = !1, passing0 = [passing0, 1];
9801
+ else {
9802
+ _valid0 && (valid0 = !0, passing0 = 1);
9803
+ let _errs9 = errors, _errs10 = errors, _errs11 = errors, _errs12 = errors, valid4 = !1, _errs13 = errors;
9804
+ if (data && typeof data == "object" && !Array.isArray(data)) {
9805
+ let missing2;
9806
+ if (data.bpm === void 0 && (missing2 = "bpm")) {
9807
+ let err7 = {};
9808
+ vErrors === null ? vErrors = [err7] : vErrors.push(err7), errors++;
9809
+ }
9810
+ }
9811
+ var _valid2 = _errs13 === errors;
9812
+ valid4 = valid4 || _valid2;
9813
+ let _errs14 = errors;
9814
+ if (data && typeof data == "object" && !Array.isArray(data)) {
9815
+ let missing3;
9816
+ if (data.value === void 0 && (missing3 = "value")) {
9817
+ let err8 = {};
9818
+ vErrors === null ? vErrors = [err8] : vErrors.push(err8), errors++;
9819
+ }
9820
+ }
9821
+ var _valid2 = _errs14 === errors;
9822
+ valid4 = valid4 || _valid2;
9823
+ let _errs15 = errors;
9824
+ if (data && typeof data == "object" && !Array.isArray(data)) {
9825
+ let missing4;
9826
+ if (data.swing === void 0 && (missing4 = "swing")) {
9827
+ let err9 = {};
9828
+ vErrors === null ? vErrors = [err9] : vErrors.push(err9), errors++;
9829
+ }
9830
+ }
9831
+ var _valid2 = _errs15 === errors;
9832
+ if (valid4 = valid4 || _valid2, valid4)
9833
+ errors = _errs12, vErrors !== null && (_errs12 ? vErrors.length = _errs12 : vErrors = null);
9834
+ else {
9835
+ let err10 = {};
9836
+ vErrors === null ? vErrors = [err10] : vErrors.push(err10), errors++;
9837
+ }
9838
+ var valid3 = _errs11 === errors;
9839
+ if (valid3) {
9840
+ let err11 = { instancePath, schemaPath: "#/oneOf/2/not", keyword: "not", params: {}, message: "must NOT be valid" };
9841
+ vErrors === null ? vErrors = [err11] : vErrors.push(err11), errors++;
9842
+ } else
9843
+ errors = _errs10, vErrors !== null && (_errs10 ? vErrors.length = _errs10 : vErrors = null);
9844
+ if (data && typeof data == "object" && !Array.isArray(data)) {
9845
+ if (data.text === void 0) {
9846
+ let err12 = { instancePath, schemaPath: "#/oneOf/2/required", keyword: "required", params: { missingProperty: "text" }, message: "must have required property 'text'" };
9847
+ vErrors === null ? vErrors = [err12] : vErrors.push(err12), errors++;
9848
+ }
9849
+ if (data.text !== void 0) {
9850
+ let data0 = data.text;
9851
+ if (Array.isArray(data0) && data0.length < 1) {
9852
+ let err13 = { instancePath: instancePath + "/text", schemaPath: "#/oneOf/2/properties/text/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
9853
+ vErrors === null ? vErrors = [err13] : vErrors.push(err13), errors++;
9854
+ }
9855
+ }
9856
+ }
9857
+ var _valid0 = _errs9 === errors;
9858
+ if (_valid0 && valid0)
9859
+ valid0 = !1, passing0 = [passing0, 2];
9860
+ else if (_valid0) {
9861
+ valid0 = !0, passing0 = 2;
9862
+ var props0 = {};
9863
+ props0.text = !0;
9864
+ }
9865
+ }
9866
+ if (valid0)
9800
9867
  errors = _errs1, vErrors !== null && (_errs1 ? vErrors.length = _errs1 : vErrors = null);
9801
9868
  else {
9802
- let err7 = { instancePath, schemaPath: "#/oneOf", keyword: "oneOf", params: { passingSchemas: passing0 }, message: "must match exactly one schema in oneOf" };
9803
- vErrors === null ? vErrors = [err7] : vErrors.push(err7), errors++;
9869
+ let err14 = { instancePath, schemaPath: "#/oneOf", keyword: "oneOf", params: { passingSchemas: passing0 }, message: "must match exactly one schema in oneOf" };
9870
+ vErrors === null ? vErrors = [err14] : vErrors.push(err14), errors++;
9804
9871
  }
9805
9872
  if (data && typeof data == "object" && !Array.isArray(data)) {
9806
9873
  for (let key0 in data)
9807
9874
  if (!func1.call(schema378.properties, key0)) {
9808
- let err8 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
9809
- vErrors === null ? vErrors = [err8] : vErrors.push(err8), errors++;
9875
+ let err15 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
9876
+ vErrors === null ? vErrors = [err15] : vErrors.push(err15), errors++;
9810
9877
  }
9811
9878
  if (data.bpm !== void 0) {
9812
- let data0 = data.bpm;
9813
- if (typeof data0 == "number") {
9814
- if (data0 <= 0 || isNaN(data0)) {
9815
- let err9 = { instancePath: instancePath + "/bpm", schemaPath: "#/properties/bpm/exclusiveMinimum", keyword: "exclusiveMinimum", params: { comparison: ">", limit: 0 }, message: "must be > 0" };
9816
- vErrors === null ? vErrors = [err9] : vErrors.push(err9), errors++;
9879
+ let data1 = data.bpm;
9880
+ if (typeof data1 == "number") {
9881
+ if (data1 <= 0 || isNaN(data1)) {
9882
+ let err16 = { instancePath: instancePath + "/bpm", schemaPath: "#/properties/bpm/exclusiveMinimum", keyword: "exclusiveMinimum", params: { comparison: ">", limit: 0 }, message: "must be > 0" };
9883
+ vErrors === null ? vErrors = [err16] : vErrors.push(err16), errors++;
9817
9884
  }
9818
9885
  } else {
9819
- let err10 = { instancePath: instancePath + "/bpm", schemaPath: "#/properties/bpm/type", keyword: "type", params: { type: "number" }, message: "must be number" };
9820
- vErrors === null ? vErrors = [err10] : vErrors.push(err10), errors++;
9886
+ let err17 = { instancePath: instancePath + "/bpm", schemaPath: "#/properties/bpm/type", keyword: "type", params: { type: "number" }, message: "must be number" };
9887
+ vErrors === null ? vErrors = [err17] : vErrors.push(err17), errors++;
9821
9888
  }
9822
9889
  }
9823
9890
  if (data.value !== void 0) {
9824
- let data1 = data.value;
9825
- if (data1 && typeof data1 == "object" && !Array.isArray(data1)) {
9826
- if (data1.base === void 0) {
9827
- let err11 = { instancePath: instancePath + "/value", schemaPath: "#/properties/value/required", keyword: "required", params: { missingProperty: "base" }, message: "must have required property 'base'" };
9828
- vErrors === null ? vErrors = [err11] : vErrors.push(err11), errors++;
9891
+ let data2 = data.value;
9892
+ if (data2 && typeof data2 == "object" && !Array.isArray(data2)) {
9893
+ if (data2.base === void 0) {
9894
+ let err18 = { instancePath: instancePath + "/value", schemaPath: "#/properties/value/required", keyword: "required", params: { missingProperty: "base" }, message: "must have required property 'base'" };
9895
+ vErrors === null ? vErrors = [err18] : vErrors.push(err18), errors++;
9829
9896
  }
9830
- for (let key1 in data1)
9897
+ for (let key1 in data2)
9831
9898
  if (!(key1 === "base" || key1 === "dots")) {
9832
- let err12 = { instancePath: instancePath + "/value", schemaPath: "#/properties/value/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" };
9833
- vErrors === null ? vErrors = [err12] : vErrors.push(err12), errors++;
9899
+ let err19 = { instancePath: instancePath + "/value", schemaPath: "#/properties/value/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" };
9900
+ vErrors === null ? vErrors = [err19] : vErrors.push(err19), errors++;
9834
9901
  }
9835
- if (data1.base !== void 0) {
9836
- let data2 = data1.base;
9837
- if (typeof data2 != "string") {
9838
- let err13 = { instancePath: instancePath + "/value/base", schemaPath: "#/properties/value/properties/base/type", keyword: "type", params: { type: "string" }, message: "must be string" };
9839
- vErrors === null ? vErrors = [err13] : vErrors.push(err13), errors++;
9902
+ if (data2.base !== void 0) {
9903
+ let data3 = data2.base;
9904
+ if (typeof data3 != "string") {
9905
+ let err20 = { instancePath: instancePath + "/value/base", schemaPath: "#/properties/value/properties/base/type", keyword: "type", params: { type: "string" }, message: "must be string" };
9906
+ vErrors === null ? vErrors = [err20] : vErrors.push(err20), errors++;
9840
9907
  }
9841
- if (!(data2 === "duplexMaxima" || data2 === "maxima" || data2 === "longa" || data2 === "breve" || data2 === "whole" || data2 === "half" || data2 === "quarter" || data2 === "eighth" || data2 === "16th" || data2 === "32nd" || data2 === "64th" || data2 === "128th" || data2 === "256th" || data2 === "512th" || data2 === "1024th" || data2 === "2048th" || data2 === "4096th")) {
9842
- let err14 = { instancePath: instancePath + "/value/base", schemaPath: "#/properties/value/properties/base/enum", keyword: "enum", params: { allowedValues: schema378.properties.value.properties.base.enum }, message: "must be equal to one of the allowed values" };
9843
- vErrors === null ? vErrors = [err14] : vErrors.push(err14), errors++;
9908
+ if (!(data3 === "duplexMaxima" || data3 === "maxima" || data3 === "longa" || data3 === "breve" || data3 === "whole" || data3 === "half" || data3 === "quarter" || data3 === "eighth" || data3 === "16th" || data3 === "32nd" || data3 === "64th" || data3 === "128th" || data3 === "256th" || data3 === "512th" || data3 === "1024th" || data3 === "2048th" || data3 === "4096th")) {
9909
+ let err21 = { instancePath: instancePath + "/value/base", schemaPath: "#/properties/value/properties/base/enum", keyword: "enum", params: { allowedValues: schema378.properties.value.properties.base.enum }, message: "must be equal to one of the allowed values" };
9910
+ vErrors === null ? vErrors = [err21] : vErrors.push(err21), errors++;
9844
9911
  }
9845
9912
  }
9846
- if (data1.dots !== void 0) {
9847
- let data3 = data1.dots;
9848
- if (!(typeof data3 == "number" && !(data3 % 1) && !isNaN(data3))) {
9849
- let err15 = { instancePath: instancePath + "/value/dots", schemaPath: "#/properties/value/properties/dots/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
9850
- vErrors === null ? vErrors = [err15] : vErrors.push(err15), errors++;
9913
+ if (data2.dots !== void 0) {
9914
+ let data4 = data2.dots;
9915
+ if (!(typeof data4 == "number" && !(data4 % 1) && !isNaN(data4))) {
9916
+ let err22 = { instancePath: instancePath + "/value/dots", schemaPath: "#/properties/value/properties/dots/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
9917
+ vErrors === null ? vErrors = [err22] : vErrors.push(err22), errors++;
9851
9918
  }
9852
- if (typeof data3 == "number" && (data3 < 0 || isNaN(data3))) {
9853
- let err16 = { instancePath: instancePath + "/value/dots", schemaPath: "#/properties/value/properties/dots/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
9854
- vErrors === null ? vErrors = [err16] : vErrors.push(err16), errors++;
9919
+ if (typeof data4 == "number" && (data4 < 0 || isNaN(data4))) {
9920
+ let err23 = { instancePath: instancePath + "/value/dots", schemaPath: "#/properties/value/properties/dots/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
9921
+ vErrors === null ? vErrors = [err23] : vErrors.push(err23), errors++;
9855
9922
  }
9856
9923
  }
9857
9924
  } else {
9858
- let err17 = { instancePath: instancePath + "/value", schemaPath: "#/properties/value/type", keyword: "type", params: { type: "object" }, message: "must be object" };
9859
- vErrors === null ? vErrors = [err17] : vErrors.push(err17), errors++;
9925
+ let err24 = { instancePath: instancePath + "/value", schemaPath: "#/properties/value/type", keyword: "type", params: { type: "object" }, message: "must be object" };
9926
+ vErrors === null ? vErrors = [err24] : vErrors.push(err24), errors++;
9860
9927
  }
9861
9928
  }
9862
9929
  if (data.location !== void 0) {
9863
- let data4 = data.location;
9864
- if (data4 && typeof data4 == "object" && !Array.isArray(data4)) {
9865
- if (data4.fraction === void 0) {
9866
- let err18 = { instancePath: instancePath + "/location", schemaPath: "#/properties/location/required", keyword: "required", params: { missingProperty: "fraction" }, message: "must have required property 'fraction'" };
9867
- vErrors === null ? vErrors = [err18] : vErrors.push(err18), errors++;
9930
+ let data5 = data.location;
9931
+ if (data5 && typeof data5 == "object" && !Array.isArray(data5)) {
9932
+ if (data5.fraction === void 0) {
9933
+ let err25 = { instancePath: instancePath + "/location", schemaPath: "#/properties/location/required", keyword: "required", params: { missingProperty: "fraction" }, message: "must have required property 'fraction'" };
9934
+ vErrors === null ? vErrors = [err25] : vErrors.push(err25), errors++;
9868
9935
  }
9869
- for (let key2 in data4)
9936
+ for (let key2 in data5)
9870
9937
  if (key2 !== "fraction") {
9871
- let err19 = { instancePath: instancePath + "/location", schemaPath: "#/properties/location/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key2 }, message: "must NOT have additional properties" };
9872
- vErrors === null ? vErrors = [err19] : vErrors.push(err19), errors++;
9938
+ let err26 = { instancePath: instancePath + "/location", schemaPath: "#/properties/location/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key2 }, message: "must NOT have additional properties" };
9939
+ vErrors === null ? vErrors = [err26] : vErrors.push(err26), errors++;
9873
9940
  }
9874
- if (data4.fraction !== void 0) {
9875
- let data5 = data4.fraction;
9876
- if (Array.isArray(data5)) {
9877
- if (data5.length > 2) {
9878
- let err20 = { instancePath: instancePath + "/location/fraction", schemaPath: "#/properties/location/properties/fraction/maxItems", keyword: "maxItems", params: { limit: 2 }, message: "must NOT have more than 2 items" };
9879
- vErrors === null ? vErrors = [err20] : vErrors.push(err20), errors++;
9941
+ if (data5.fraction !== void 0) {
9942
+ let data6 = data5.fraction;
9943
+ if (Array.isArray(data6)) {
9944
+ if (data6.length > 2) {
9945
+ let err27 = { instancePath: instancePath + "/location/fraction", schemaPath: "#/properties/location/properties/fraction/maxItems", keyword: "maxItems", params: { limit: 2 }, message: "must NOT have more than 2 items" };
9946
+ vErrors === null ? vErrors = [err27] : vErrors.push(err27), errors++;
9880
9947
  }
9881
- if (data5.length < 2) {
9882
- let err21 = { instancePath: instancePath + "/location/fraction", schemaPath: "#/properties/location/properties/fraction/minItems", keyword: "minItems", params: { limit: 2 }, message: "must NOT have fewer than 2 items" };
9883
- vErrors === null ? vErrors = [err21] : vErrors.push(err21), errors++;
9948
+ if (data6.length < 2) {
9949
+ let err28 = { instancePath: instancePath + "/location/fraction", schemaPath: "#/properties/location/properties/fraction/minItems", keyword: "minItems", params: { limit: 2 }, message: "must NOT have fewer than 2 items" };
9950
+ vErrors === null ? vErrors = [err28] : vErrors.push(err28), errors++;
9884
9951
  }
9885
- let len0 = data5.length;
9952
+ let len0 = data6.length;
9886
9953
  if (len0 > 0) {
9887
- let data6 = data5[0];
9888
- if (!(typeof data6 == "number" && !(data6 % 1) && !isNaN(data6))) {
9889
- let err22 = { instancePath: instancePath + "/location/fraction/0", schemaPath: "#/properties/location/properties/fraction/prefixItems/0/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
9890
- vErrors === null ? vErrors = [err22] : vErrors.push(err22), errors++;
9954
+ let data7 = data6[0];
9955
+ if (!(typeof data7 == "number" && !(data7 % 1) && !isNaN(data7))) {
9956
+ let err29 = { instancePath: instancePath + "/location/fraction/0", schemaPath: "#/properties/location/properties/fraction/prefixItems/0/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
9957
+ vErrors === null ? vErrors = [err29] : vErrors.push(err29), errors++;
9891
9958
  }
9892
- if (typeof data6 == "number") {
9893
- if (data6 > 9007199254740991 || isNaN(data6)) {
9894
- let err23 = { instancePath: instancePath + "/location/fraction/0", schemaPath: "#/properties/location/properties/fraction/prefixItems/0/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" };
9895
- vErrors === null ? vErrors = [err23] : vErrors.push(err23), errors++;
9959
+ if (typeof data7 == "number") {
9960
+ if (data7 > 9007199254740991 || isNaN(data7)) {
9961
+ let err30 = { instancePath: instancePath + "/location/fraction/0", schemaPath: "#/properties/location/properties/fraction/prefixItems/0/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" };
9962
+ vErrors === null ? vErrors = [err30] : vErrors.push(err30), errors++;
9896
9963
  }
9897
- if (data6 < 0 || isNaN(data6)) {
9898
- let err24 = { instancePath: instancePath + "/location/fraction/0", schemaPath: "#/properties/location/properties/fraction/prefixItems/0/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
9899
- vErrors === null ? vErrors = [err24] : vErrors.push(err24), errors++;
9964
+ if (data7 < 0 || isNaN(data7)) {
9965
+ let err31 = { instancePath: instancePath + "/location/fraction/0", schemaPath: "#/properties/location/properties/fraction/prefixItems/0/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
9966
+ vErrors === null ? vErrors = [err31] : vErrors.push(err31), errors++;
9900
9967
  }
9901
9968
  }
9902
9969
  }
9903
9970
  if (len0 > 1) {
9904
- let data7 = data5[1];
9905
- if (!(typeof data7 == "number" && !(data7 % 1) && !isNaN(data7))) {
9906
- let err25 = { instancePath: instancePath + "/location/fraction/1", schemaPath: "#/properties/location/properties/fraction/prefixItems/1/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
9907
- vErrors === null ? vErrors = [err25] : vErrors.push(err25), errors++;
9971
+ let data8 = data6[1];
9972
+ if (!(typeof data8 == "number" && !(data8 % 1) && !isNaN(data8))) {
9973
+ let err32 = { instancePath: instancePath + "/location/fraction/1", schemaPath: "#/properties/location/properties/fraction/prefixItems/1/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
9974
+ vErrors === null ? vErrors = [err32] : vErrors.push(err32), errors++;
9908
9975
  }
9909
- if (typeof data7 == "number") {
9910
- if (data7 > 9007199254740991 || isNaN(data7)) {
9911
- let err26 = { instancePath: instancePath + "/location/fraction/1", schemaPath: "#/properties/location/properties/fraction/prefixItems/1/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" };
9912
- vErrors === null ? vErrors = [err26] : vErrors.push(err26), errors++;
9976
+ if (typeof data8 == "number") {
9977
+ if (data8 > 9007199254740991 || isNaN(data8)) {
9978
+ let err33 = { instancePath: instancePath + "/location/fraction/1", schemaPath: "#/properties/location/properties/fraction/prefixItems/1/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" };
9979
+ vErrors === null ? vErrors = [err33] : vErrors.push(err33), errors++;
9913
9980
  }
9914
- if (data7 < 1 || isNaN(data7)) {
9915
- let err27 = { instancePath: instancePath + "/location/fraction/1", schemaPath: "#/properties/location/properties/fraction/prefixItems/1/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
9916
- vErrors === null ? vErrors = [err27] : vErrors.push(err27), errors++;
9981
+ if (data8 < 1 || isNaN(data8)) {
9982
+ let err34 = { instancePath: instancePath + "/location/fraction/1", schemaPath: "#/properties/location/properties/fraction/prefixItems/1/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
9983
+ vErrors === null ? vErrors = [err34] : vErrors.push(err34), errors++;
9917
9984
  }
9918
9985
  }
9919
9986
  }
9920
- if (!(data5.length <= 2)) {
9921
- let err28 = { instancePath: instancePath + "/location/fraction", schemaPath: "#/properties/location/properties/fraction/items", keyword: "items", params: { limit: 2 }, message: "must NOT have more than 2 items" };
9922
- vErrors === null ? vErrors = [err28] : vErrors.push(err28), errors++;
9987
+ if (!(data6.length <= 2)) {
9988
+ let err35 = { instancePath: instancePath + "/location/fraction", schemaPath: "#/properties/location/properties/fraction/items", keyword: "items", params: { limit: 2 }, message: "must NOT have more than 2 items" };
9989
+ vErrors === null ? vErrors = [err35] : vErrors.push(err35), errors++;
9923
9990
  }
9924
9991
  } else {
9925
- let err29 = { instancePath: instancePath + "/location/fraction", schemaPath: "#/properties/location/properties/fraction/type", keyword: "type", params: { type: "array" }, message: "must be array" };
9926
- vErrors === null ? vErrors = [err29] : vErrors.push(err29), errors++;
9992
+ let err36 = { instancePath: instancePath + "/location/fraction", schemaPath: "#/properties/location/properties/fraction/type", keyword: "type", params: { type: "array" }, message: "must be array" };
9993
+ vErrors === null ? vErrors = [err36] : vErrors.push(err36), errors++;
9927
9994
  }
9928
9995
  }
9929
9996
  } else {
9930
- let err30 = { instancePath: instancePath + "/location", schemaPath: "#/properties/location/type", keyword: "type", params: { type: "object" }, message: "must be object" };
9931
- vErrors === null ? vErrors = [err30] : vErrors.push(err30), errors++;
9997
+ let err37 = { instancePath: instancePath + "/location", schemaPath: "#/properties/location/type", keyword: "type", params: { type: "object" }, message: "must be object" };
9998
+ vErrors === null ? vErrors = [err37] : vErrors.push(err37), errors++;
9932
9999
  }
9933
10000
  }
9934
10001
  if (data.swing !== void 0) {
9935
- let data8 = data.swing, _errs30 = errors, valid8 = !1, passing1 = null, _errs31 = errors;
9936
- if (data8 && typeof data8 == "object" && !Array.isArray(data8)) {
9937
- if (data8.mode === void 0) {
9938
- let err31 = { instancePath: instancePath + "/swing", schemaPath: "#/$defs/swing/oneOf/0/required", keyword: "required", params: { missingProperty: "mode" }, message: "must have required property 'mode'" };
9939
- vErrors === null ? vErrors = [err31] : vErrors.push(err31), errors++;
10002
+ let data9 = data.swing, _errs38 = errors, valid11 = !1, passing1 = null, _errs39 = errors;
10003
+ if (data9 && typeof data9 == "object" && !Array.isArray(data9)) {
10004
+ if (data9.mode === void 0) {
10005
+ let err38 = { instancePath: instancePath + "/swing", schemaPath: "#/$defs/swing/oneOf/0/required", keyword: "required", params: { missingProperty: "mode" }, message: "must have required property 'mode'" };
10006
+ vErrors === null ? vErrors = [err38] : vErrors.push(err38), errors++;
9940
10007
  }
9941
- for (let key3 in data8)
10008
+ for (let key3 in data9)
9942
10009
  if (key3 !== "mode") {
9943
- let err32 = { instancePath: instancePath + "/swing", schemaPath: "#/$defs/swing/oneOf/0/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" };
9944
- vErrors === null ? vErrors = [err32] : vErrors.push(err32), errors++;
10010
+ let err39 = { instancePath: instancePath + "/swing", schemaPath: "#/$defs/swing/oneOf/0/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" };
10011
+ vErrors === null ? vErrors = [err39] : vErrors.push(err39), errors++;
9945
10012
  }
9946
- if (data8.mode !== void 0) {
9947
- let data9 = data8.mode;
9948
- if (typeof data9 != "string") {
9949
- let err33 = { instancePath: instancePath + "/swing/mode", schemaPath: "#/$defs/swing/oneOf/0/properties/mode/type", keyword: "type", params: { type: "string" }, message: "must be string" };
9950
- vErrors === null ? vErrors = [err33] : vErrors.push(err33), errors++;
10013
+ if (data9.mode !== void 0) {
10014
+ let data10 = data9.mode;
10015
+ if (typeof data10 != "string") {
10016
+ let err40 = { instancePath: instancePath + "/swing/mode", schemaPath: "#/$defs/swing/oneOf/0/properties/mode/type", keyword: "type", params: { type: "string" }, message: "must be string" };
10017
+ vErrors === null ? vErrors = [err40] : vErrors.push(err40), errors++;
9951
10018
  }
9952
- if (data9 !== "straight") {
9953
- let err34 = { instancePath: instancePath + "/swing/mode", schemaPath: "#/$defs/swing/oneOf/0/properties/mode/const", keyword: "const", params: { allowedValue: "straight" }, message: "must be equal to constant" };
9954
- vErrors === null ? vErrors = [err34] : vErrors.push(err34), errors++;
10019
+ if (data10 !== "straight") {
10020
+ let err41 = { instancePath: instancePath + "/swing/mode", schemaPath: "#/$defs/swing/oneOf/0/properties/mode/const", keyword: "const", params: { allowedValue: "straight" }, message: "must be equal to constant" };
10021
+ vErrors === null ? vErrors = [err41] : vErrors.push(err41), errors++;
9955
10022
  }
9956
10023
  }
9957
10024
  } else {
9958
- let err35 = { instancePath: instancePath + "/swing", schemaPath: "#/$defs/swing/oneOf/0/type", keyword: "type", params: { type: "object" }, message: "must be object" };
9959
- vErrors === null ? vErrors = [err35] : vErrors.push(err35), errors++;
10025
+ let err42 = { instancePath: instancePath + "/swing", schemaPath: "#/$defs/swing/oneOf/0/type", keyword: "type", params: { type: "object" }, message: "must be object" };
10026
+ vErrors === null ? vErrors = [err42] : vErrors.push(err42), errors++;
9960
10027
  }
9961
- var _valid2 = _errs31 === errors;
9962
- if (_valid2) {
9963
- valid8 = !0, passing1 = 0;
9964
- var props0 = !0;
10028
+ var _valid3 = _errs39 === errors;
10029
+ if (_valid3) {
10030
+ valid11 = !0, passing1 = 0;
10031
+ var props1 = !0;
9965
10032
  }
9966
- let _errs36 = errors;
9967
- if (data8 && typeof data8 == "object" && !Array.isArray(data8)) {
9968
- if (data8.mode === void 0) {
9969
- let err36 = { instancePath: instancePath + "/swing", schemaPath: "#/$defs/swing/oneOf/1/required", keyword: "required", params: { missingProperty: "mode" }, message: "must have required property 'mode'" };
9970
- vErrors === null ? vErrors = [err36] : vErrors.push(err36), errors++;
10033
+ let _errs44 = errors;
10034
+ if (data9 && typeof data9 == "object" && !Array.isArray(data9)) {
10035
+ if (data9.mode === void 0) {
10036
+ let err43 = { instancePath: instancePath + "/swing", schemaPath: "#/$defs/swing/oneOf/1/required", keyword: "required", params: { missingProperty: "mode" }, message: "must have required property 'mode'" };
10037
+ vErrors === null ? vErrors = [err43] : vErrors.push(err43), errors++;
9971
10038
  }
9972
- if (data8.subdivision === void 0) {
9973
- let err37 = { instancePath: instancePath + "/swing", schemaPath: "#/$defs/swing/oneOf/1/required", keyword: "required", params: { missingProperty: "subdivision" }, message: "must have required property 'subdivision'" };
9974
- vErrors === null ? vErrors = [err37] : vErrors.push(err37), errors++;
10039
+ if (data9.subdivision === void 0) {
10040
+ let err44 = { instancePath: instancePath + "/swing", schemaPath: "#/$defs/swing/oneOf/1/required", keyword: "required", params: { missingProperty: "subdivision" }, message: "must have required property 'subdivision'" };
10041
+ vErrors === null ? vErrors = [err44] : vErrors.push(err44), errors++;
9975
10042
  }
9976
- if (data8.ratio === void 0) {
9977
- let err38 = { instancePath: instancePath + "/swing", schemaPath: "#/$defs/swing/oneOf/1/required", keyword: "required", params: { missingProperty: "ratio" }, message: "must have required property 'ratio'" };
9978
- vErrors === null ? vErrors = [err38] : vErrors.push(err38), errors++;
10043
+ if (data9.ratio === void 0) {
10044
+ let err45 = { instancePath: instancePath + "/swing", schemaPath: "#/$defs/swing/oneOf/1/required", keyword: "required", params: { missingProperty: "ratio" }, message: "must have required property 'ratio'" };
10045
+ vErrors === null ? vErrors = [err45] : vErrors.push(err45), errors++;
9979
10046
  }
9980
- for (let key4 in data8)
10047
+ for (let key4 in data9)
9981
10048
  if (!(key4 === "mode" || key4 === "subdivision" || key4 === "ratio")) {
9982
- let err39 = { instancePath: instancePath + "/swing", schemaPath: "#/$defs/swing/oneOf/1/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key4 }, message: "must NOT have additional properties" };
9983
- vErrors === null ? vErrors = [err39] : vErrors.push(err39), errors++;
10049
+ let err46 = { instancePath: instancePath + "/swing", schemaPath: "#/$defs/swing/oneOf/1/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key4 }, message: "must NOT have additional properties" };
10050
+ vErrors === null ? vErrors = [err46] : vErrors.push(err46), errors++;
9984
10051
  }
9985
- if (data8.mode !== void 0) {
9986
- let data10 = data8.mode;
9987
- if (typeof data10 != "string") {
9988
- let err40 = { instancePath: instancePath + "/swing/mode", schemaPath: "#/$defs/swing/oneOf/1/properties/mode/type", keyword: "type", params: { type: "string" }, message: "must be string" };
9989
- vErrors === null ? vErrors = [err40] : vErrors.push(err40), errors++;
10052
+ if (data9.mode !== void 0) {
10053
+ let data11 = data9.mode;
10054
+ if (typeof data11 != "string") {
10055
+ let err47 = { instancePath: instancePath + "/swing/mode", schemaPath: "#/$defs/swing/oneOf/1/properties/mode/type", keyword: "type", params: { type: "string" }, message: "must be string" };
10056
+ vErrors === null ? vErrors = [err47] : vErrors.push(err47), errors++;
9990
10057
  }
9991
- if (data10 !== "swing") {
9992
- let err41 = { instancePath: instancePath + "/swing/mode", schemaPath: "#/$defs/swing/oneOf/1/properties/mode/const", keyword: "const", params: { allowedValue: "swing" }, message: "must be equal to constant" };
9993
- vErrors === null ? vErrors = [err41] : vErrors.push(err41), errors++;
10058
+ if (data11 !== "swing") {
10059
+ let err48 = { instancePath: instancePath + "/swing/mode", schemaPath: "#/$defs/swing/oneOf/1/properties/mode/const", keyword: "const", params: { allowedValue: "swing" }, message: "must be equal to constant" };
10060
+ vErrors === null ? vErrors = [err48] : vErrors.push(err48), errors++;
9994
10061
  }
9995
10062
  }
9996
- if (data8.subdivision !== void 0) {
9997
- let data11 = data8.subdivision;
9998
- if (typeof data11 != "string") {
9999
- let err42 = { instancePath: instancePath + "/swing/subdivision", schemaPath: "#/$defs/swing/oneOf/1/properties/subdivision/type", keyword: "type", params: { type: "string" }, message: "must be string" };
10000
- vErrors === null ? vErrors = [err42] : vErrors.push(err42), errors++;
10063
+ if (data9.subdivision !== void 0) {
10064
+ let data12 = data9.subdivision;
10065
+ if (typeof data12 != "string") {
10066
+ let err49 = { instancePath: instancePath + "/swing/subdivision", schemaPath: "#/$defs/swing/oneOf/1/properties/subdivision/type", keyword: "type", params: { type: "string" }, message: "must be string" };
10067
+ vErrors === null ? vErrors = [err49] : vErrors.push(err49), errors++;
10001
10068
  }
10002
- if (!(data11 === "eighth" || data11 === "16th")) {
10003
- let err43 = { instancePath: instancePath + "/swing/subdivision", schemaPath: "#/$defs/swing/oneOf/1/properties/subdivision/enum", keyword: "enum", params: { allowedValues: schema379.oneOf[1].properties.subdivision.enum }, message: "must be equal to one of the allowed values" };
10004
- vErrors === null ? vErrors = [err43] : vErrors.push(err43), errors++;
10069
+ if (!(data12 === "eighth" || data12 === "16th")) {
10070
+ let err50 = { instancePath: instancePath + "/swing/subdivision", schemaPath: "#/$defs/swing/oneOf/1/properties/subdivision/enum", keyword: "enum", params: { allowedValues: schema379.oneOf[1].properties.subdivision.enum }, message: "must be equal to one of the allowed values" };
10071
+ vErrors === null ? vErrors = [err50] : vErrors.push(err50), errors++;
10005
10072
  }
10006
10073
  }
10007
- if (data8.ratio !== void 0) {
10008
- let data12 = data8.ratio;
10009
- if (Array.isArray(data12)) {
10010
- if (data12.length > 2) {
10011
- let err44 = { instancePath: instancePath + "/swing/ratio", schemaPath: "#/$defs/swing/oneOf/1/properties/ratio/maxItems", keyword: "maxItems", params: { limit: 2 }, message: "must NOT have more than 2 items" };
10012
- vErrors === null ? vErrors = [err44] : vErrors.push(err44), errors++;
10074
+ if (data9.ratio !== void 0) {
10075
+ let data13 = data9.ratio;
10076
+ if (Array.isArray(data13)) {
10077
+ if (data13.length > 2) {
10078
+ let err51 = { instancePath: instancePath + "/swing/ratio", schemaPath: "#/$defs/swing/oneOf/1/properties/ratio/maxItems", keyword: "maxItems", params: { limit: 2 }, message: "must NOT have more than 2 items" };
10079
+ vErrors === null ? vErrors = [err51] : vErrors.push(err51), errors++;
10013
10080
  }
10014
- if (data12.length < 2) {
10015
- let err45 = { instancePath: instancePath + "/swing/ratio", schemaPath: "#/$defs/swing/oneOf/1/properties/ratio/minItems", keyword: "minItems", params: { limit: 2 }, message: "must NOT have fewer than 2 items" };
10016
- vErrors === null ? vErrors = [err45] : vErrors.push(err45), errors++;
10081
+ if (data13.length < 2) {
10082
+ let err52 = { instancePath: instancePath + "/swing/ratio", schemaPath: "#/$defs/swing/oneOf/1/properties/ratio/minItems", keyword: "minItems", params: { limit: 2 }, message: "must NOT have fewer than 2 items" };
10083
+ vErrors === null ? vErrors = [err52] : vErrors.push(err52), errors++;
10017
10084
  }
10018
- let len2 = data12.length;
10085
+ let len2 = data13.length;
10019
10086
  for (let i0 = 0; i0 < len2; i0++) {
10020
- let data13 = data12[i0];
10021
- if (!(typeof data13 == "number" && !(data13 % 1) && !isNaN(data13))) {
10022
- let err46 = { instancePath: instancePath + "/swing/ratio/" + i0, schemaPath: "#/$defs/swing/oneOf/1/properties/ratio/items/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
10023
- vErrors === null ? vErrors = [err46] : vErrors.push(err46), errors++;
10087
+ let data14 = data13[i0];
10088
+ if (!(typeof data14 == "number" && !(data14 % 1) && !isNaN(data14))) {
10089
+ let err53 = { instancePath: instancePath + "/swing/ratio/" + i0, schemaPath: "#/$defs/swing/oneOf/1/properties/ratio/items/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
10090
+ vErrors === null ? vErrors = [err53] : vErrors.push(err53), errors++;
10024
10091
  }
10025
- if (typeof data13 == "number") {
10026
- if (data13 > 9007199254740991 || isNaN(data13)) {
10027
- let err47 = { instancePath: instancePath + "/swing/ratio/" + i0, schemaPath: "#/$defs/swing/oneOf/1/properties/ratio/items/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" };
10028
- vErrors === null ? vErrors = [err47] : vErrors.push(err47), errors++;
10092
+ if (typeof data14 == "number") {
10093
+ if (data14 > 9007199254740991 || isNaN(data14)) {
10094
+ let err54 = { instancePath: instancePath + "/swing/ratio/" + i0, schemaPath: "#/$defs/swing/oneOf/1/properties/ratio/items/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" };
10095
+ vErrors === null ? vErrors = [err54] : vErrors.push(err54), errors++;
10029
10096
  }
10030
- if (data13 < 1 || isNaN(data13)) {
10031
- let err48 = { instancePath: instancePath + "/swing/ratio/" + i0, schemaPath: "#/$defs/swing/oneOf/1/properties/ratio/items/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
10032
- vErrors === null ? vErrors = [err48] : vErrors.push(err48), errors++;
10097
+ if (data14 < 1 || isNaN(data14)) {
10098
+ let err55 = { instancePath: instancePath + "/swing/ratio/" + i0, schemaPath: "#/$defs/swing/oneOf/1/properties/ratio/items/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
10099
+ vErrors === null ? vErrors = [err55] : vErrors.push(err55), errors++;
10033
10100
  }
10034
10101
  }
10035
10102
  }
10036
10103
  } else {
10037
- let err49 = { instancePath: instancePath + "/swing/ratio", schemaPath: "#/$defs/swing/oneOf/1/properties/ratio/type", keyword: "type", params: { type: "array" }, message: "must be array" };
10038
- vErrors === null ? vErrors = [err49] : vErrors.push(err49), errors++;
10104
+ let err56 = { instancePath: instancePath + "/swing/ratio", schemaPath: "#/$defs/swing/oneOf/1/properties/ratio/type", keyword: "type", params: { type: "array" }, message: "must be array" };
10105
+ vErrors === null ? vErrors = [err56] : vErrors.push(err56), errors++;
10039
10106
  }
10040
10107
  }
10041
10108
  } else {
10042
- let err50 = { instancePath: instancePath + "/swing", schemaPath: "#/$defs/swing/oneOf/1/type", keyword: "type", params: { type: "object" }, message: "must be object" };
10043
- vErrors === null ? vErrors = [err50] : vErrors.push(err50), errors++;
10109
+ let err57 = { instancePath: instancePath + "/swing", schemaPath: "#/$defs/swing/oneOf/1/type", keyword: "type", params: { type: "object" }, message: "must be object" };
10110
+ vErrors === null ? vErrors = [err57] : vErrors.push(err57), errors++;
10044
10111
  }
10045
- var _valid2 = _errs36 === errors;
10046
- if (_valid2 && valid8 ? (valid8 = !1, passing1 = [passing1, 1]) : _valid2 && (valid8 = !0, passing1 = 1, props0 !== !0 && (props0 = !0)), valid8)
10047
- errors = _errs30, vErrors !== null && (_errs30 ? vErrors.length = _errs30 : vErrors = null);
10112
+ var _valid3 = _errs44 === errors;
10113
+ if (_valid3 && valid11 ? (valid11 = !1, passing1 = [passing1, 1]) : _valid3 && (valid11 = !0, passing1 = 1, props1 !== !0 && (props1 = !0)), valid11)
10114
+ errors = _errs38, vErrors !== null && (_errs38 ? vErrors.length = _errs38 : vErrors = null);
10048
10115
  else {
10049
- let err51 = { instancePath: instancePath + "/swing", schemaPath: "#/$defs/swing/oneOf", keyword: "oneOf", params: { passingSchemas: passing1 }, message: "must match exactly one schema in oneOf" };
10050
- vErrors === null ? vErrors = [err51] : vErrors.push(err51), errors++;
10116
+ let err58 = { instancePath: instancePath + "/swing", schemaPath: "#/$defs/swing/oneOf", keyword: "oneOf", params: { passingSchemas: passing1 }, message: "must match exactly one schema in oneOf" };
10117
+ vErrors === null ? vErrors = [err58] : vErrors.push(err58), errors++;
10051
10118
  }
10052
10119
  }
10053
10120
  if (data.text !== void 0 && (validate403(data.text, { instancePath: instancePath + "/text", parentData: data, parentDataProperty: "text", rootData, dynamicAnchors }) || (vErrors = vErrors === null ? validate403.errors : vErrors.concat(validate403.errors), errors = vErrors.length)), data.showMetronomeMark !== void 0 && typeof data.showMetronomeMark != "boolean") {
10054
- let err52 = { instancePath: instancePath + "/showMetronomeMark", schemaPath: "#/properties/showMetronomeMark/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" };
10055
- vErrors === null ? vErrors = [err52] : vErrors.push(err52), errors++;
10121
+ let err59 = { instancePath: instancePath + "/showMetronomeMark", schemaPath: "#/properties/showMetronomeMark/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" };
10122
+ vErrors === null ? vErrors = [err59] : vErrors.push(err59), errors++;
10056
10123
  }
10057
10124
  if (data.showText !== void 0 && typeof data.showText != "boolean") {
10058
- let err53 = { instancePath: instancePath + "/showText", schemaPath: "#/properties/showText/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" };
10059
- vErrors === null ? vErrors = [err53] : vErrors.push(err53), errors++;
10125
+ let err60 = { instancePath: instancePath + "/showText", schemaPath: "#/properties/showText/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" };
10126
+ vErrors === null ? vErrors = [err60] : vErrors.push(err60), errors++;
10060
10127
  }
10061
10128
  if (data.manualOffset !== void 0) {
10062
- let data17 = data.manualOffset;
10063
- if (Array.isArray(data17)) {
10064
- if (data17.length > 2) {
10065
- let err54 = { instancePath: instancePath + "/manualOffset", schemaPath: "#/$defs/sp-delta/maxItems", keyword: "maxItems", params: { limit: 2 }, message: "must NOT have more than 2 items" };
10066
- vErrors === null ? vErrors = [err54] : vErrors.push(err54), errors++;
10129
+ let data18 = data.manualOffset;
10130
+ if (Array.isArray(data18)) {
10131
+ if (data18.length > 2) {
10132
+ let err61 = { instancePath: instancePath + "/manualOffset", schemaPath: "#/$defs/sp-delta/maxItems", keyword: "maxItems", params: { limit: 2 }, message: "must NOT have more than 2 items" };
10133
+ vErrors === null ? vErrors = [err61] : vErrors.push(err61), errors++;
10067
10134
  }
10068
- if (data17.length < 2) {
10069
- let err55 = { instancePath: instancePath + "/manualOffset", schemaPath: "#/$defs/sp-delta/minItems", keyword: "minItems", params: { limit: 2 }, message: "must NOT have fewer than 2 items" };
10070
- vErrors === null ? vErrors = [err55] : vErrors.push(err55), errors++;
10135
+ if (data18.length < 2) {
10136
+ let err62 = { instancePath: instancePath + "/manualOffset", schemaPath: "#/$defs/sp-delta/minItems", keyword: "minItems", params: { limit: 2 }, message: "must NOT have fewer than 2 items" };
10137
+ vErrors === null ? vErrors = [err62] : vErrors.push(err62), errors++;
10071
10138
  }
10072
- let len3 = data17.length;
10139
+ let len3 = data18.length;
10073
10140
  for (let i1 = 0; i1 < len3; i1++)
10074
- if (typeof data17[i1] != "number") {
10075
- let err56 = { instancePath: instancePath + "/manualOffset/" + i1, schemaPath: "#/$defs/sp-delta/items/type", keyword: "type", params: { type: "number" }, message: "must be number" };
10076
- vErrors === null ? vErrors = [err56] : vErrors.push(err56), errors++;
10141
+ if (typeof data18[i1] != "number") {
10142
+ let err63 = { instancePath: instancePath + "/manualOffset/" + i1, schemaPath: "#/$defs/sp-delta/items/type", keyword: "type", params: { type: "number" }, message: "must be number" };
10143
+ vErrors === null ? vErrors = [err63] : vErrors.push(err63), errors++;
10077
10144
  }
10078
10145
  } else {
10079
- let err57 = { instancePath: instancePath + "/manualOffset", schemaPath: "#/$defs/sp-delta/type", keyword: "type", params: { type: "array" }, message: "must be array" };
10080
- vErrors === null ? vErrors = [err57] : vErrors.push(err57), errors++;
10146
+ let err64 = { instancePath: instancePath + "/manualOffset", schemaPath: "#/$defs/sp-delta/type", keyword: "type", params: { type: "array" }, message: "must be array" };
10147
+ vErrors === null ? vErrors = [err64] : vErrors.push(err64), errors++;
10081
10148
  }
10082
10149
  }
10083
10150
  if (data.avoidCollisions !== void 0 && typeof data.avoidCollisions != "boolean") {
10084
- let err58 = { instancePath: instancePath + "/avoidCollisions", schemaPath: "#/properties/avoidCollisions/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" };
10085
- vErrors === null ? vErrors = [err58] : vErrors.push(err58), errors++;
10151
+ let err65 = { instancePath: instancePath + "/avoidCollisions", schemaPath: "#/properties/avoidCollisions/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" };
10152
+ vErrors === null ? vErrors = [err65] : vErrors.push(err65), errors++;
10086
10153
  }
10087
10154
  } else {
10088
- let err59 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
10089
- vErrors === null ? vErrors = [err59] : vErrors.push(err59), errors++;
10155
+ let err66 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
10156
+ vErrors === null ? vErrors = [err66] : vErrors.push(err66), errors++;
10090
10157
  }
10091
10158
  return validate402.errors = vErrors, errors === 0;
10092
10159
  }
@@ -15610,7 +15677,10 @@ function parseVendorTempos(raw, viritura) {
15610
15677
  value: parseTempoNoteValue(instruction.value),
15611
15678
  swing: instruction.swing === void 0 ? void 0 : parseSwing(instruction.swing)
15612
15679
  };
15613
- if (!instruction.swing) throw new Error("A BPM-free tempo requires an explicit swing instruction.");
15680
+ if (!instruction.swing) {
15681
+ if (!instruction.text?.length) throw new Error("A BPM-free tempo requires swing or nonempty text.");
15682
+ return { ...presentation, text: instruction.text };
15683
+ }
15614
15684
  return { ...presentation, swing: parseSwing(instruction.swing) };
15615
15685
  });
15616
15686
  }
@@ -16589,8 +16659,8 @@ function parseVideoMedia(raw) {
16589
16659
  typeof contentHash == "string" && contentHash.length > 0 && (media.contentHash = contentHash);
16590
16660
  let demoSourceId = raw?.demoSourceId;
16591
16661
  typeof demoSourceId == "string" && demoSourceId.length > 0 && (media.demoSourceId = demoSourceId);
16592
- let duration = raw?.durationSeconds;
16593
- return typeof duration == "number" && Number.isFinite(duration) && duration > 0 && (media.durationSeconds = duration), media;
16662
+ let duration2 = raw?.durationSeconds;
16663
+ return typeof duration2 == "number" && Number.isFinite(duration2) && duration2 > 0 && (media.durationSeconds = duration2), media;
16594
16664
  }
16595
16665
  function parseRootVideoSync(rootX) {
16596
16666
  let raw = rootX?.viritura?.videoSync;
@@ -17083,7 +17153,7 @@ function buildTempoMap(globalMeasures, holds) {
17083
17153
  if (gm.tempos && gm.tempos.length > 0) {
17084
17154
  for (let tempo of gm.tempos) {
17085
17155
  if (tempo.bpm === void 0) continue;
17086
- let beatOffset = tempo.location ? tempo.location.fraction[0] / tempo.location.fraction[1] * mBeats : 0, qpm = effectiveQpm(tempo.bpm, tempo.value.base, tempo.value.dots);
17156
+ let beatOffset = tempo.location ? posBeats(tempo.location.fraction) : 0, qpm = effectiveQpm(tempo.bpm, tempo.value.base, tempo.value.dots);
17087
17157
  changes.push({ beatOffset, qpm });
17088
17158
  }
17089
17159
  changes.sort((a, b) => a.beatOffset - b.beatOffset);
@@ -17116,10 +17186,10 @@ function buildTempoModel(globalMeasures, holds) {
17116
17186
  nominalTime && (currentTime = { count: nominalTime.count, unit: nominalTime.unit });
17117
17187
  let mBeats = measureBeatsFromTime(gm.time ?? currentTime);
17118
17188
  if (measureStartBeats.push(cumBeats), gm.tempos && gm.tempos.length > 0) {
17119
- let sorted = [...gm.tempos].sort((a, b) => tempoBeat(a, mBeats) - tempoBeat(b, mBeats));
17189
+ let sorted = [...gm.tempos].sort((a, b) => tempoBeat(a) - tempoBeat(b));
17120
17190
  for (let tempo of sorted) {
17121
17191
  if (tempo.bpm === void 0) continue;
17122
- let startBeat = cumBeats + tempoBeat(tempo, mBeats), qpm = effectiveQpm(tempo.bpm, tempo.value.base, tempo.value.dots);
17192
+ let startBeat = cumBeats + tempoBeat(tempo), qpm = effectiveQpm(tempo.bpm, tempo.value.base, tempo.value.dots);
17123
17193
  regions.push({ startBeat, endBeat: 1 / 0, startBpm: qpm, endBpm: qpm });
17124
17194
  }
17125
17195
  }
@@ -17173,8 +17243,8 @@ function resolveGradualEndBeat(end, fromIdx, globalMeasures, measureStartBeats,
17173
17243
  if (start !== void 0)
17174
17244
  return start + posBeats(end.position.fraction);
17175
17245
  }
17176
- function tempoBeat(tempo, mBeats) {
17177
- return tempo.location ? tempo.location.fraction[0] / tempo.location.fraction[1] * mBeats : 0;
17246
+ function tempoBeat(tempo) {
17247
+ return tempo.location ? posBeats(tempo.location.fraction) : 0;
17178
17248
  }
17179
17249
 
17180
17250
  // packages/midi/src/cadenzaTiming.ts
@@ -17214,14 +17284,14 @@ function playbackGlobalMeasures(score, measureOrder) {
17214
17284
  let activeBeats = 4, activeTime = { count: 4, unit: 4 }, activeTempo = {
17215
17285
  bpm: DEFAULT_BPM,
17216
17286
  value: { base: "quarter" }
17217
- }, resolved = score.global.measures.map((original, measureIndex) => {
17218
- original.time && (activeTime = original.time);
17287
+ }, inheritedTempos = [], resolved = score.global.measures.map((original, measureIndex) => {
17288
+ inheritedTempos.push(activeTempo), original.time && (activeTime = original.time);
17219
17289
  let measure = {
17220
17290
  ...original,
17221
17291
  time: { ...activeTime },
17222
- tempos: original.tempos?.some((tempo) => !tempo.location || tempo.location.fraction[0] === 0) ? original.tempos : [{ ...activeTempo, location: { fraction: [0, 1] } }, ...original.tempos ?? []]
17223
- };
17224
- if (original.tempos?.length && (activeTempo = [...original.tempos].sort(
17292
+ tempos: original.tempos
17293
+ }, metronomicTempos = original.tempos?.filter((tempo) => tempo.bpm !== void 0);
17294
+ if (metronomicTempos?.length && (activeTempo = [...metronomicTempos].sort(
17225
17295
  (a, b) => (a.location?.fraction[0] ?? 0) / (a.location?.fraction[1] ?? 1) - (b.location?.fraction[0] ?? 0) / (b.location?.fraction[1] ?? 1)
17226
17296
  ).at(-1)), measure.time && (activeBeats = measure.time.count * 4 / measure.time.unit), measureIndex === 0 && measure.number === 0) {
17227
17297
  let pickupBeats = writtenMeasureBeats(score, measureIndex, 0);
@@ -17247,7 +17317,13 @@ function playbackGlobalMeasures(score, measureOrder) {
17247
17317
  }
17248
17318
  };
17249
17319
  });
17250
- return measureOrder.map((index) => resolved[index]);
17320
+ return measureOrder.map((index, expandedIndex) => {
17321
+ let measure = resolved[index];
17322
+ return expandedIndex === 0 || index === measureOrder[expandedIndex - 1] + 1 || measure.tempos?.some((tempo) => tempo.bpm !== void 0 && (!tempo.location || tempo.location.fraction[0] === 0)) ? measure : {
17323
+ ...measure,
17324
+ tempos: [{ ...inheritedTempos[index], location: { fraction: [0, 1] } }, ...measure.tempos ?? []]
17325
+ };
17326
+ });
17251
17327
  }
17252
17328
  function suppressCadenzaFermataHolds(measures, holds) {
17253
17329
  return holds.map(
@@ -17617,9 +17693,9 @@ function compileChordPlayback(score, includeGlobalChords = !0) {
17617
17693
  function realizeChordPlayback(program, measureOrder, timing) {
17618
17694
  let notes = [], pitches = [], startBeat = 0, occurrence = 0, finish = (endBeat) => {
17619
17695
  if (endBeat <= startBeat) return;
17620
- let startTime = timing.model.timeAtBeat(startBeat), duration = timing.model.timeAtBeat(endBeat) - startTime;
17696
+ let startTime = timing.model.timeAtBeat(startBeat), duration2 = timing.model.timeAtBeat(endBeat) - startTime;
17621
17697
  for (let pitch of pitches)
17622
- notes.push({ id: `${CHORDS_PART_ID}:${occurrence}:${pitch}`, pitch, startTime, duration });
17698
+ notes.push({ id: `${CHORDS_PART_ID}:${occurrence}:${pitch}`, pitch, startTime, duration: duration2 });
17623
17699
  occurrence++;
17624
17700
  };
17625
17701
  for (let expandedIndex = 0; expandedIndex < measureOrder.length; expandedIndex++) {
@@ -17688,9 +17764,9 @@ var WHOLE_DURATIONS = {
17688
17764
  "512th": 1 / 512,
17689
17765
  "1024th": 1 / 1024
17690
17766
  };
17691
- function durationValue(duration) {
17692
- let base = WHOLE_DURATIONS[duration.base] ?? 0, value = base;
17693
- for (let dot = 0; dot < (duration.dots ?? 0); dot++) value += base / 2 ** (dot + 1);
17767
+ function durationValue(duration2) {
17768
+ let base = WHOLE_DURATIONS[duration2.base] ?? 0, value = base;
17769
+ for (let dot = 0; dot < (duration2.dots ?? 0); dot++) value += base / 2 ** (dot + 1);
17694
17770
  return value;
17695
17771
  }
17696
17772
  function contentInfo(content, scale = 1) {
@@ -17699,8 +17775,8 @@ function contentInfo(content, scale = 1) {
17699
17775
  if (item.type === "event") {
17700
17776
  let sounding = !!item.notes?.length || !!item.kitNotes?.length;
17701
17777
  sounding && (active = !0, onset ??= cursor);
17702
- let duration = durationValue(item.duration) * scale;
17703
- return cursor += duration, {
17778
+ let duration2 = durationValue(item.duration) * scale;
17779
+ return cursor += duration2, {
17704
17780
  duration: item.duration,
17705
17781
  sounding
17706
17782
  };
@@ -17710,13 +17786,13 @@ function contentInfo(content, scale = 1) {
17710
17786
  return nested.active && (active = !0, onset ??= cursor + nested.onset), cursor += nested.duration, { type: item.type, inner: item.inner, outer: item.outer, content: nested.signature };
17711
17787
  }
17712
17788
  if (item.type === "tremolo") {
17713
- let duration = durationValue(item.outer.duration) * item.outer.multiple * scale;
17714
- return item.content.some((event) => !!event.notes?.length || !!event.kitNotes?.length) && (active = !0, onset ??= cursor), cursor += duration, { type: item.type, outer: item.outer, content: item.content.map((event) => event.duration) };
17789
+ let duration2 = durationValue(item.outer.duration) * item.outer.multiple * scale;
17790
+ return item.content.some((event) => !!event.notes?.length || !!event.kitNotes?.length) && (active = !0, onset ??= cursor), cursor += duration2, { type: item.type, outer: item.outer, content: item.content.map((event) => event.duration) };
17715
17791
  }
17716
17792
  if (item.type === "grace") return { type: item.type, content: item.content.map((event) => event.duration) };
17717
17793
  if (item.type === "space") {
17718
- let duration = (item.duration[1] === 0 ? 0 : item.duration[0] / item.duration[1]) * scale;
17719
- return cursor += duration, { type: item.type, duration: item.duration };
17794
+ let duration2 = (item.duration[1] === 0 ? 0 : item.duration[0] / item.duration[1]) * scale;
17795
+ return cursor += duration2, { type: item.type, duration: item.duration };
17720
17796
  }
17721
17797
  return {};
17722
17798
  }), active, onset, duration: cursor };
@@ -18058,8 +18134,8 @@ function resolveVoiceLegato(a) {
18058
18134
  if (!bucket || bucket.length === 0) return;
18059
18135
  let onset = Math.max(
18060
18136
  0,
18061
- a.model.timeAtBeat(a.measureStartBeat + a.beatOffset) + timingHumanize(a.measureStartTime, a.beatOffset, a.partIndex)
18062
- ), nextDur = a.model.secondsForBeats(a.measureStartBeat + a.beatOffset, a.beats);
18137
+ (a.soundingOnset ?? a.model.timeAtBeat(a.measureStartBeat + a.beatOffset)) + timingHumanize(a.measureStartTime, a.beatOffset, a.partIndex)
18138
+ ), nextDur = a.soundingDuration ?? a.model.secondsForBeats(a.measureStartBeat + a.beatOffset, a.beats);
18063
18139
  resolveLegato(bucket, a.out, onset, nextDur, a.notes);
18064
18140
  }
18065
18141
 
@@ -18738,6 +18814,107 @@ function laneForScope(program, partIndex, staff, voice) {
18738
18814
  return program.lanes.get(id) ?? program.lanes.values().next().value;
18739
18815
  }
18740
18816
 
18817
+ // packages/midi/src/rhythmRealization/index.ts
18818
+ init_define_import_meta_env();
18819
+ var EPS3 = 1e-9;
18820
+ function duration(d) {
18821
+ return DURATION_BEATS[d.base] * (d.dots ? 2 - 2 ** -d.dots : 1);
18822
+ }
18823
+ function itemBeats(item) {
18824
+ switch (item.type) {
18825
+ case "event":
18826
+ return duration(item.duration);
18827
+ case "space":
18828
+ return item.duration[0] * 4 / item.duration[1];
18829
+ case "tuplet":
18830
+ case "tremolo":
18831
+ return duration(item.outer.duration) * item.outer.multiple;
18832
+ case "grace":
18833
+ return 0;
18834
+ }
18835
+ }
18836
+ function eligible(item, sequence) {
18837
+ return item?.type === "event" && !item.duration.dots && (item.staff === void 0 || item.staff === (sequence.staff ?? 1)) && item.markings?.tremolo === void 0 && item.markings?.trill === void 0;
18838
+ }
18839
+ function swingAt(anchors, beat) {
18840
+ let result = { mode: "straight" };
18841
+ for (let anchor of anchors) {
18842
+ if (anchor.beat > beat + EPS3) break;
18843
+ result = anchor.swing;
18844
+ }
18845
+ return result;
18846
+ }
18847
+ function containsGrace(content) {
18848
+ return content.some((item) => item.type === "grace" || item.type === "tuplet" && containsGrace(item.content));
18849
+ }
18850
+ function compileSequence(sequence, anchors, metricOffset, measureBeats3, holdBeats) {
18851
+ let timings = /* @__PURE__ */ new Map();
18852
+ if (sequence.fullMeasure || containsGrace(sequence.content)) return timings;
18853
+ let cursor = 0;
18854
+ for (let index = 0; index < sequence.content.length; index++) {
18855
+ let first = sequence.content[index], second = sequence.content[index + 1], swing2 = swingAt(anchors, cursor), beats = itemBeats(first), pairEnd = cursor + 2 * beats;
18856
+ if (swing2.mode === "swing" && eligible(first, sequence) && eligible(second, sequence) && first.duration.base === swing2.subdivision && second.duration.base === swing2.subdivision && Math.abs((cursor + metricOffset) / (2 * beats) - Math.round((cursor + metricOffset) / (2 * beats))) < EPS3 && pairEnd <= measureBeats3 + EPS3 && !holdBeats.some((beat) => beat > cursor + EPS3 && beat < pairEnd - EPS3) && !anchors.some((anchor) => anchor.beat > cursor + EPS3 && anchor.beat < pairEnd - EPS3)) {
18857
+ let split = cursor + 2 * beats * swing2.ratio[0] / (swing2.ratio[0] + swing2.ratio[1]);
18858
+ timings.set(first, { start: cursor, end: split, pairStart: cursor, pairEnd }), timings.set(second, { start: split, end: pairEnd, pairStart: cursor, pairEnd });
18859
+ }
18860
+ cursor += beats;
18861
+ }
18862
+ return timings;
18863
+ }
18864
+ function compileRhythmProgram(score) {
18865
+ let indices = score.global.measures.map((_, index) => index), playbackMeasures = playbackGlobalMeasures(score, indices), holds = buildHoldSchedule(score, indices, score.global.measures), inherited = { mode: "straight" }, anchorsByMeasure = score.global.measures.map((measure) => {
18866
+ let anchors = [{ beat: -1 / 0, swing: inherited }], ordered = (measure.tempos ?? []).map((tempo, index) => ({
18867
+ tempo,
18868
+ index,
18869
+ beat: (tempo.location?.fraction[0] ?? 0) * 4 / (tempo.location?.fraction[1] ?? 1)
18870
+ })).sort((a, b) => a.beat - b.beat || a.index - b.index);
18871
+ for (let { tempo, beat } of ordered)
18872
+ if (tempo.swing) {
18873
+ if (tempo.swing.mode === "swing" && !tempo.swing.ratio.every((value) => Number.isSafeInteger(value) && value > 0))
18874
+ throw new Error("Swing ratios must be positive safe integers.");
18875
+ inherited = tempo.swing, anchors.push({ beat, swing: inherited });
18876
+ }
18877
+ return anchors;
18878
+ }), sequences = /* @__PURE__ */ new Map(), diagnostics = [];
18879
+ return score.parts.forEach((part, partIndex) => {
18880
+ let staffMeters = resolvePartStaffMeterTable(part, score.global.measures);
18881
+ part.measures.forEach((measure, measureIndex) => {
18882
+ let anchors = anchorsByMeasure[measureIndex];
18883
+ if (!anchors) return;
18884
+ let time = resolveActiveTime(score.global.measures, measureIndex), playbackTime = playbackMeasures[measureIndex].time, measureBeats3 = playbackTime.count * 4 / playbackTime.unit, metricOffset = measureIndex === 0 && score.global.measures[0].number === 0 ? time.count * 4 / time.unit - measureBeats3 : 0, diagnosed = /* @__PURE__ */ new Set(), hasSwing = [
18885
+ 0,
18886
+ ...anchors.map((anchor) => anchor.beat).filter((beat) => beat > 0 && beat < measureBeats3)
18887
+ ].some((beat) => swingAt(anchors, beat).mode === "swing");
18888
+ for (let sequence of measure.sequences) {
18889
+ let staff = sequence.staff ?? 1;
18890
+ if (staffMeters[measureIndex]?.has(staff)) {
18891
+ !diagnosed.has(staff) && hasSwing && (diagnostics.push({
18892
+ code: "swing-staff-meter-unsupported",
18893
+ source: { partIndex, measureIndex, staff },
18894
+ message: `Swing left literal in part ${partIndex}, measure ${measureIndex}, staff ${staff}: local staff meters are not supported.`,
18895
+ playbackLaneIds: []
18896
+ }), diagnosed.add(staff));
18897
+ continue;
18898
+ }
18899
+ time.display !== "senzaMisura" && sequences.set(
18900
+ sequence,
18901
+ compileSequence(
18902
+ sequence,
18903
+ anchors,
18904
+ metricOffset,
18905
+ measureBeats3,
18906
+ (holds[measureIndex] ?? []).map((hold) => hold.atBeat)
18907
+ )
18908
+ );
18909
+ }
18910
+ });
18911
+ }), { sequences, diagnostics };
18912
+ }
18913
+ function realizeRhythmEvent(timings, event, start, beats, span) {
18914
+ let timing = timings?.get(event);
18915
+ return !timing || span && (timing.pairStart < span.startBeat - EPS3 || timing.pairEnd > span.endBeat + EPS3) ? { start, beats } : { start: timing.start, beats: timing.end - timing.start };
18916
+ }
18917
+
18741
18918
  // packages/midi/src/timeline.ts
18742
18919
  var GM_DRUM_CHANNEL = 9;
18743
18920
  function noteToMidi(note) {
@@ -18778,7 +18955,7 @@ function generateTimeline(inputScore, options) {
18778
18955
  let expandedGlobal = playbackGlobalMeasures(score, measureOrder), holdSchedule = suppressCadenzaFermataHolds(
18779
18956
  expandedGlobal,
18780
18957
  buildHoldSchedule(score, measureOrder, globalMeasures)
18781
- ), { tempoMap } = buildTempoMap(expandedGlobal, holdSchedule), tempoBuild = buildTempoModel(expandedGlobal, holdSchedule), { model, measureStartTimes, measureStartBeats } = tempoBuild, timing = { tempoMap, measureStartTimes, model, measureStartBeats, playedSpans: spans }, allEvents = [], partChannels = allocatePartChannels(score.parts);
18958
+ ), { tempoMap } = buildTempoMap(expandedGlobal, holdSchedule), tempoBuild = buildTempoModel(expandedGlobal, holdSchedule), { model, measureStartTimes, measureStartBeats } = tempoBuild, rhythm = compileRhythmProgram(score), timing = { tempoMap, measureStartTimes, model, measureStartBeats, playedSpans: spans, rhythm }, allEvents = [], partChannels = allocatePartChannels(score.parts);
18782
18959
  for (let partIdx = 0; partIdx < score.parts.length; partIdx++)
18783
18960
  processPart(
18784
18961
  score,
@@ -18806,14 +18983,19 @@ function generateTimeline(inputScore, options) {
18806
18983
  { model, measureStartBeats, measureOrder },
18807
18984
  options?.instrumentPrograms,
18808
18985
  options?.partPrograms
18809
- ), diagnostics = [...assignPhysicalMidiChannels(allEvents, score), ...instrumentDiagnostics];
18986
+ ), diagnostics = [
18987
+ ...assignPhysicalMidiChannels(allEvents, score),
18988
+ ...instrumentDiagnostics,
18989
+ ...rhythm.diagnostics
18990
+ ];
18991
+ for (let diagnostic of diagnostics) options?.onDiagnostic?.(diagnostic);
18810
18992
  allEvents.sort(compareEvents);
18811
- let duration = model.timeAtBeat(tempoBuild.totalBeats), measureTimeSignatures = measureOrder.map((origIdx) => {
18993
+ let duration2 = model.timeAtBeat(tempoBuild.totalBeats), measureTimeSignatures = measureOrder.map((origIdx) => {
18812
18994
  let ts = resolveActiveTime(globalMeasures, origIdx);
18813
18995
  return { count: ts.count, unit: ts.unit };
18814
18996
  }), result = {
18815
18997
  events: allEvents,
18816
- duration,
18998
+ duration: duration2,
18817
18999
  tempoMap,
18818
19000
  measureStartTimes,
18819
19001
  model,
@@ -18986,7 +19168,7 @@ function processPart(score, partIdx, options, partChannels, timing, measureOrder
18986
19168
  let lane = laneForSequence(dynamicProgram, partIdx, seq, seqIdx);
18987
19169
  ctx.sequenceStaff = seq.staff ?? 1, ctx.sequenceVoice = lane.voice, ctx.dynamicsEnvelope = lane.envelope, ctx.playbackLaneId = lane.id;
18988
19170
  let effectiveStaffMeter = staffMeterTable[origMeasureIdx]?.get(ctx.sequenceStaff);
18989
- ctx.timeSig = effectiveStaffMeter ? effectiveStaffMeter.timeSignature : activeTime, ctx.staffMeterRatio = staffMeterRatioAt(staffMeterTable, origMeasureIdx, ctx.sequenceStaff);
19171
+ ctx.timeSig = effectiveStaffMeter ? effectiveStaffMeter.timeSignature : activeTime, ctx.staffMeterRatio = staffMeterRatioAt(staffMeterTable, origMeasureIdx, ctx.sequenceStaff), ctx.rhythm = timing.rhythm.sequences.get(seq);
18990
19172
  let firstNewEvent = allEvents.length;
18991
19173
  processSequence(ctx, seq, measureStartTime, measureHolds, measureSpq), stampPlaybackLane(allEvents, firstNewEvent, lane.id), stampPendingLane(ctx, lane.id);
18992
19174
  });
@@ -19023,7 +19205,11 @@ function processScopedNoteEvent(ctx, event, measureStartTime, beatOffset, tuplet
19023
19205
  event,
19024
19206
  measureStartTime,
19025
19207
  beatOffset,
19026
- dynamicVelocityAt(ctx, measureStartTime, beatOffset),
19208
+ dynamicVelocityAt(
19209
+ ctx,
19210
+ measureStartTime,
19211
+ realizeRhythmEvent(ctx.rhythm, event, beatOffset, durationBeats4(event.duration) * tupletRatio, ctx.playedSpan).start
19212
+ ),
19027
19213
  tupletRatio
19028
19214
  );
19029
19215
  return stampPlaybackLane(ctx.out, firstNewEvent, lane.id), stampPendingLane(ctx, lane.id), ctx.dynamicsEnvelope = previousEnvelope, ctx.playbackLaneId = previousLaneId, beats;
@@ -19050,13 +19236,13 @@ function processContentItem(ctx, item, measureStartTime, beatOffset, tupletRatio
19050
19236
  return 0;
19051
19237
  }
19052
19238
  }
19053
- function resolveFermataDuration(ctx, event, naturalDurationSec, beatOffset) {
19239
+ function resolveFermataDuration(ctx, event, naturalDurationSec, beatOffset, soundingBeatOffset = beatOffset) {
19054
19240
  if (event.fermata && event.fermata.duration !== "none" && ctx.fermataGroups.length > 0) {
19055
19241
  let globalBeatOffset = beatOffset * ctx.staffMeterRatio, group = ctx.fermataGroups.find(
19056
19242
  (g) => globalBeatOffset >= g.startBeat - 1e-9 && globalBeatOffset < g.spanEndBeat - 1e-9
19057
19243
  );
19058
19244
  if (group) {
19059
- let startTime = eventTime(ctx, beatOffset), resumeTime = ctx.model.timeAtBeat(ctx.measureStartBeat + group.insertBeat);
19245
+ let startTime = eventTime(ctx, soundingBeatOffset), resumeTime = ctx.model.timeAtBeat(ctx.measureStartBeat + group.insertBeat);
19060
19246
  return { durationSec: Math.max(naturalDurationSec, resumeTime - startTime), durationScale: 1, held: !0 };
19061
19247
  }
19062
19248
  }
@@ -19077,6 +19263,7 @@ function processNoteEvent(ctx, event, measureStartTime, beatOffset, baseVelocity
19077
19263
  if (!beatInPlayedSpan(beatOffset * ctx.staffMeterRatio, ctx.playedSpan)) return beats;
19078
19264
  if (isRest(event))
19079
19265
  return flushVoiceLegato(ctx.pendingLegato, ctx.voiceKey, ctx.out), beats;
19266
+ let realized = realizeRhythmEvent(ctx.rhythm, event, beatOffset, beats, ctx.playedSpan), startTime = eventTime(ctx, realized.start), naturalDurationSec = eventSeconds(ctx, realized.start, realized.beats);
19080
19267
  resolveVoiceLegato({
19081
19268
  map: ctx.pendingLegato,
19082
19269
  voiceKey: ctx.voiceKey,
@@ -19087,15 +19274,17 @@ function processNoteEvent(ctx, event, measureStartTime, beatOffset, baseVelocity
19087
19274
  measureStartTime,
19088
19275
  beatOffset,
19089
19276
  beats,
19090
- notes: event.notes ?? []
19277
+ notes: event.notes ?? [],
19278
+ soundingOnset: startTime,
19279
+ soundingDuration: naturalDurationSec
19091
19280
  });
19092
19281
  let specialBeats = tryProcessSpecialEvent(ctx, event, measureStartTime, beatOffset, baseVelocity, beats);
19093
19282
  if (specialBeats !== null) return specialBeats;
19094
- let startTime = eventTime(ctx, beatOffset), timingOffset = timingHumanize(measureStartTime, beatOffset, partIndex), naturalDurationSec = eventSeconds(ctx, beatOffset, beats), {
19283
+ let timingOffset = timingHumanize(measureStartTime, beatOffset, partIndex), {
19095
19284
  durationSec,
19096
19285
  durationScale,
19097
19286
  held: fermataHeld
19098
- } = resolveFermataDuration(ctx, event, naturalDurationSec, beatOffset), velocity = Math.min(
19287
+ } = resolveFermataDuration(ctx, event, naturalDurationSec, beatOffset, realized.start), velocity = Math.min(
19099
19288
  127,
19100
19289
  Math.max(
19101
19290
  1,