@libraz/libcantus 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/README.md +4 -0
  2. package/README_ja.md +4 -0
  3. package/dist/analyze/index.cjs +31 -7
  4. package/dist/analyze/index.cjs.map +1 -1
  5. package/dist/analyze/index.d.cts +155 -9
  6. package/dist/analyze/index.d.ts +155 -9
  7. package/dist/analyze/index.js +37 -13
  8. package/dist/{chunk-TT6PKMPR.cjs → chunk-35NBV2FT.cjs} +16 -16
  9. package/dist/{chunk-TT6PKMPR.cjs.map → chunk-35NBV2FT.cjs.map} +1 -1
  10. package/dist/{chunk-YPB3A3EY.cjs → chunk-3R3QVKY5.cjs} +314 -285
  11. package/dist/chunk-3R3QVKY5.cjs.map +1 -0
  12. package/dist/{chunk-GDKE6RQW.cjs → chunk-4R2LWV7E.cjs} +691 -413
  13. package/dist/chunk-4R2LWV7E.cjs.map +1 -0
  14. package/dist/{chunk-RVS4G4MR.cjs → chunk-76ZBTRG2.cjs} +198 -198
  15. package/dist/{chunk-RVS4G4MR.cjs.map → chunk-76ZBTRG2.cjs.map} +1 -1
  16. package/dist/{chunk-X6RJAHII.js → chunk-7KG3RTYS.js} +2 -2
  17. package/dist/{chunk-PQL7E5F6.js → chunk-AGOVW7U6.js} +1 -1
  18. package/dist/{chunk-PQL7E5F6.js.map → chunk-AGOVW7U6.js.map} +1 -1
  19. package/dist/{chunk-5KW7DNCJ.cjs → chunk-B2PW6EHN.cjs} +2423 -453
  20. package/dist/chunk-B2PW6EHN.cjs.map +1 -0
  21. package/dist/{chunk-J772DL3B.cjs → chunk-CGBADIO5.cjs} +53 -53
  22. package/dist/{chunk-J772DL3B.cjs.map → chunk-CGBADIO5.cjs.map} +1 -1
  23. package/dist/{chunk-R5VUXQMP.js → chunk-CPMB7P75.js} +1978 -8
  24. package/dist/chunk-CPMB7P75.js.map +1 -0
  25. package/dist/{chunk-VLE5R7PF.js → chunk-GNVN4PPJ.js} +1874 -8
  26. package/dist/chunk-GNVN4PPJ.js.map +1 -0
  27. package/dist/{chunk-Q6R3QAZD.cjs → chunk-IFZDWIKM.cjs} +2199 -333
  28. package/dist/chunk-IFZDWIKM.cjs.map +1 -0
  29. package/dist/{chunk-DKICR7AN.js → chunk-IPEF6NWB.js} +296 -18
  30. package/dist/chunk-IPEF6NWB.js.map +1 -0
  31. package/dist/{chunk-AWEMD747.js → chunk-M5RYMAFI.js} +3 -3
  32. package/dist/{chunk-HSY2VQXZ.js → chunk-MLBPXA4Z.js} +330 -728
  33. package/dist/chunk-MLBPXA4Z.js.map +1 -0
  34. package/dist/{chunk-H66ARFU5.js → chunk-NB25P3EH.js} +3 -3
  35. package/dist/{chunk-5JJ6EHEZ.cjs → chunk-NM7UAMC3.cjs} +62 -62
  36. package/dist/{chunk-5JJ6EHEZ.cjs.map → chunk-NM7UAMC3.cjs.map} +1 -1
  37. package/dist/{chunk-R7B5N2JK.cjs → chunk-PM4XJE2Y.cjs} +47 -47
  38. package/dist/{chunk-R7B5N2JK.cjs.map → chunk-PM4XJE2Y.cjs.map} +1 -1
  39. package/dist/{chunk-7GOKQJTQ.js → chunk-PUKJP2Z5.js} +2 -2
  40. package/dist/{chunk-QCXYKSZS.cjs → chunk-PWC4CRWT.cjs} +19 -19
  41. package/dist/{chunk-QCXYKSZS.cjs.map → chunk-PWC4CRWT.cjs.map} +1 -1
  42. package/dist/{chunk-FPBZFNCD.js → chunk-RFIBF2RR.js} +47 -18
  43. package/dist/{chunk-FPBZFNCD.js.map → chunk-RFIBF2RR.js.map} +1 -1
  44. package/dist/{chunk-XKSO2V5I.cjs → chunk-S5BKZZGM.cjs} +1 -1
  45. package/dist/{chunk-XKSO2V5I.cjs.map → chunk-S5BKZZGM.cjs.map} +1 -1
  46. package/dist/{chunk-HOHFYGKW.js → chunk-UMWZ4ZET.js} +2 -2
  47. package/dist/{chunk-XVMJO3QF.cjs → chunk-YFA7X2F6.cjs} +489 -887
  48. package/dist/chunk-YFA7X2F6.cjs.map +1 -0
  49. package/dist/{chunk-57WB2EDF.js → chunk-ZBUROTJQ.js} +3 -3
  50. package/dist/{coerce-wwdELNYS.d.ts → coerce-DP0vYu-x.d.ts} +77 -1
  51. package/dist/{coerce-CJlgULrQ.d.cts → coerce-DRERzdve.d.cts} +77 -1
  52. package/dist/core/index.cjs +5 -5
  53. package/dist/core/index.d.cts +2 -2
  54. package/dist/core/index.d.ts +2 -2
  55. package/dist/core/index.js +4 -4
  56. package/dist/generate/index.cjs +20 -8
  57. package/dist/generate/index.cjs.map +1 -1
  58. package/dist/generate/index.d.cts +87 -9
  59. package/dist/generate/index.d.ts +87 -9
  60. package/dist/generate/index.js +19 -7
  61. package/dist/{index-BaoKVVhE.d.cts → index-B9QLziDe.d.cts} +2 -2
  62. package/dist/{index-CnHQgqNh.d.ts → index-BHIUyjhZ.d.ts} +2 -2
  63. package/dist/{index-CBCP84rv.d.cts → index-BL5N2Oyz.d.cts} +1 -1
  64. package/dist/{index-D_hzxD8w.d.cts → index-BMweUlm5.d.cts} +3 -0
  65. package/dist/{index-Ci3xyows.d.ts → index-CL4b4gUQ.d.ts} +3 -0
  66. package/dist/{index-BzLNkmA7.d.cts → index-CY-3NVfy.d.cts} +486 -5
  67. package/dist/{index-CnIdP4EZ.d.ts → index-Dw2DP7vm.d.ts} +1 -1
  68. package/dist/{index-DpC-mDlV.d.ts → index-zaZdmnU4.d.ts} +486 -5
  69. package/dist/index.cjs +49 -13
  70. package/dist/index.cjs.map +1 -1
  71. package/dist/index.d.cts +10 -10
  72. package/dist/index.d.ts +10 -10
  73. package/dist/index.js +55 -19
  74. package/dist/{masks-O73Rhj5d.d.ts → masks-Cc7-MzzY.d.ts} +1 -1
  75. package/dist/{masks-C8TWLFIi.d.cts → masks-pADfTOiD.d.cts} +1 -1
  76. package/dist/model/index.cjs +12 -12
  77. package/dist/model/index.d.cts +213 -16
  78. package/dist/model/index.d.ts +213 -16
  79. package/dist/model/index.js +11 -11
  80. package/dist/{index-DTsKaPaC.d.cts → profile-CQMEqdH9.d.cts} +88 -601
  81. package/dist/{index-BUtIf2go.d.ts → profile-DLdlIpS9.d.ts} +88 -601
  82. package/dist/theory/index.cjs +5 -5
  83. package/dist/theory/index.d.cts +7 -7
  84. package/dist/theory/index.d.ts +7 -7
  85. package/dist/theory/index.js +4 -4
  86. package/dist/{index-BpWOhkkE.d.ts → types-D-XgxGvp.d.cts} +1170 -14
  87. package/dist/{index-B3WCj_Hm.d.cts → types-Dh7C064C.d.ts} +1170 -14
  88. package/package.json +6 -5
  89. package/dist/chunk-5KW7DNCJ.cjs.map +0 -1
  90. package/dist/chunk-DKICR7AN.js.map +0 -1
  91. package/dist/chunk-GDKE6RQW.cjs.map +0 -1
  92. package/dist/chunk-HSY2VQXZ.js.map +0 -1
  93. package/dist/chunk-Q6R3QAZD.cjs.map +0 -1
  94. package/dist/chunk-R5VUXQMP.js.map +0 -1
  95. package/dist/chunk-VLE5R7PF.js.map +0 -1
  96. package/dist/chunk-XVMJO3QF.cjs.map +0 -1
  97. package/dist/chunk-YPB3A3EY.cjs.map +0 -1
  98. /package/dist/{chunk-X6RJAHII.js.map → chunk-7KG3RTYS.js.map} +0 -0
  99. /package/dist/{chunk-AWEMD747.js.map → chunk-M5RYMAFI.js.map} +0 -0
  100. /package/dist/{chunk-H66ARFU5.js.map → chunk-NB25P3EH.js.map} +0 -0
  101. /package/dist/{chunk-7GOKQJTQ.js.map → chunk-PUKJP2Z5.js.map} +0 -0
  102. /package/dist/{chunk-HOHFYGKW.js.map → chunk-UMWZ4ZET.js.map} +0 -0
  103. /package/dist/{chunk-57WB2EDF.js.map → chunk-ZBUROTJQ.js.map} +0 -0
@@ -10,11 +10,11 @@
10
10
 
11
11
 
12
12
 
13
+ var _chunkYFA7X2F6cjs = require('./chunk-YFA7X2F6.cjs');
13
14
 
14
15
 
15
16
 
16
17
 
17
- var _chunkXVMJO3QFcjs = require('./chunk-XVMJO3QF.cjs');
18
18
 
19
19
 
20
20
 
@@ -34,11 +34,11 @@ var _chunkXVMJO3QFcjs = require('./chunk-XVMJO3QF.cjs');
34
34
 
35
35
 
36
36
 
37
+ var _chunkNM7UAMC3cjs = require('./chunk-NM7UAMC3.cjs');
37
38
 
38
39
 
39
40
 
40
41
 
41
- var _chunk5JJ6EHEZcjs = require('./chunk-5JJ6EHEZ.cjs');
42
42
 
43
43
 
44
44
 
@@ -68,8 +68,8 @@ var _chunk5JJ6EHEZcjs = require('./chunk-5JJ6EHEZ.cjs');
68
68
 
69
69
 
70
70
 
71
+ var _chunkB2PW6EHNcjs = require('./chunk-B2PW6EHN.cjs');
71
72
 
72
- var _chunk5KW7DNCJcjs = require('./chunk-5KW7DNCJ.cjs');
73
73
 
74
74
 
75
75
 
@@ -97,7 +97,6 @@ var _chunk5KW7DNCJcjs = require('./chunk-5KW7DNCJ.cjs');
97
97
 
98
98
 
99
99
 
100
- var _chunkQ6R3QAZDcjs = require('./chunk-Q6R3QAZD.cjs');
101
100
 
102
101
 
103
102
 
@@ -105,22 +104,23 @@ var _chunkQ6R3QAZDcjs = require('./chunk-Q6R3QAZD.cjs');
105
104
 
106
105
 
107
106
 
107
+ var _chunkIFZDWIKMcjs = require('./chunk-IFZDWIKM.cjs');
108
108
 
109
109
 
110
110
 
111
111
 
112
112
 
113
- var _chunkJ772DL3Bcjs = require('./chunk-J772DL3B.cjs');
114
113
 
115
114
 
116
- var _chunkTT6PKMPRcjs = require('./chunk-TT6PKMPR.cjs');
117
115
 
118
116
 
119
117
 
120
118
 
121
119
 
120
+ var _chunkCGBADIO5cjs = require('./chunk-CGBADIO5.cjs');
122
121
 
123
122
 
123
+ var _chunk35NBV2FTcjs = require('./chunk-35NBV2FT.cjs');
124
124
 
125
125
 
126
126
 
@@ -128,21 +128,21 @@ var _chunkTT6PKMPRcjs = require('./chunk-TT6PKMPR.cjs');
128
128
 
129
129
 
130
130
 
131
- var _chunkRVS4G4MRcjs = require('./chunk-RVS4G4MR.cjs');
132
131
 
133
132
 
134
133
 
135
134
 
136
135
 
137
136
 
138
- var _chunkR7B5N2JKcjs = require('./chunk-R7B5N2JK.cjs');
139
137
 
138
+ var _chunk76ZBTRG2cjs = require('./chunk-76ZBTRG2.cjs');
140
139
 
141
140
 
142
141
 
143
142
 
144
143
 
145
144
 
145
+ var _chunkPM4XJE2Ycjs = require('./chunk-PM4XJE2Y.cjs');
146
146
 
147
147
 
148
148
 
@@ -191,7 +191,6 @@ var _chunkR7B5N2JKcjs = require('./chunk-R7B5N2JK.cjs');
191
191
 
192
192
 
193
193
 
194
- var _chunkYPB3A3EYcjs = require('./chunk-YPB3A3EY.cjs');
195
194
 
196
195
 
197
196
 
@@ -199,6 +198,7 @@ var _chunkYPB3A3EYcjs = require('./chunk-YPB3A3EY.cjs');
199
198
 
200
199
 
201
200
 
201
+ var _chunk3R3QVKY5cjs = require('./chunk-3R3QVKY5.cjs');
202
202
 
203
203
 
204
204
 
@@ -235,7 +235,14 @@ var _chunkYPB3A3EYcjs = require('./chunk-YPB3A3EY.cjs');
235
235
 
236
236
 
237
237
 
238
- var _chunkXKSO2V5Icjs = require('./chunk-XKSO2V5I.cjs');
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+ var _chunkS5BKZZGMcjs = require('./chunk-S5BKZZGM.cjs');
239
246
 
240
247
  // src/model/interval.ts
241
248
  var INVERSION_SUM = 9;
@@ -304,7 +311,7 @@ var Interval = class _Interval {
304
311
  * @throws If the number, quality, and span do not describe the same interval.
305
312
  */
306
313
  static fromData(data) {
307
- const checked = _chunkXKSO2V5Icjs.toSpelledInterval.call(void 0, data);
314
+ const checked = _chunkS5BKZZGMcjs.toSpelledInterval.call(void 0, data);
308
315
  return new _Interval(checked.number, checked.quality, checked.semitones, checked.descending);
309
316
  }
310
317
  /**
@@ -328,7 +335,7 @@ var Interval = class _Interval {
328
335
  * interval field read on every keystroke.
329
336
  */
330
337
  static parse(name) {
331
- return _chunkXKSO2V5Icjs.unwrapParse.call(void 0, _Interval.tryParse(name));
338
+ return _chunkS5BKZZGMcjs.unwrapParse.call(void 0, _Interval.tryParse(name));
332
339
  }
333
340
  /**
334
341
  * Parse an interval name, reporting failure instead of throwing it.
@@ -347,7 +354,7 @@ var Interval = class _Interval {
347
354
  * ```
348
355
  */
349
356
  static tryParse(name) {
350
- const parsed = _chunkXKSO2V5Icjs.tryParseInterval.call(void 0, name);
357
+ const parsed = _chunkS5BKZZGMcjs.tryParseInterval.call(void 0, name);
351
358
  return parsed.ok ? { ok: true, value: _Interval.fromData(parsed.value) } : parsed;
352
359
  }
353
360
  /** Diatonic size: 1 = unison, 2 = second, ... 8 = octave, and beyond. */
@@ -403,7 +410,7 @@ var Interval = class _Interval {
403
410
  invert() {
404
411
  const numberValue = INVERSION_SUM - simpleDegree(this.#number);
405
412
  const quality = invertQuality(this.#quality);
406
- return _Interval.of(numberValue, quality, _chunkXKSO2V5Icjs.intervalSemitones.call(void 0, numberValue, quality));
413
+ return _Interval.of(numberValue, quality, _chunkS5BKZZGMcjs.intervalSemitones.call(void 0, numberValue, quality));
407
414
  }
408
415
  /**
409
416
  * The same interval taken in the opposite direction.
@@ -435,7 +442,7 @@ var Interval = class _Interval {
435
442
  * @returns True if the interval is consonant in that context.
436
443
  */
437
444
  isConsonant(twoVoice = true) {
438
- return _chunkXKSO2V5Icjs.isConsonantInterval.call(void 0, this.#semitones, twoVoice);
445
+ return _chunkS5BKZZGMcjs.isConsonantInterval.call(void 0, this.#semitones, twoVoice);
439
446
  }
440
447
  /**
441
448
  * Whether another interval is spelled identically.
@@ -491,13 +498,13 @@ function describeShape(value) {
491
498
  }
492
499
  function assertDataObject(value, name) {
493
500
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
494
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(`${name} must be an object; received ${describeShape(value)}`);
501
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(`${name} must be an object; received ${describeShape(value)}`);
495
502
  }
496
503
  return value;
497
504
  }
498
505
  function assertDataArray(value, name) {
499
506
  if (!Array.isArray(value)) {
500
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(`${name} must be an array; received ${describeShape(value)}`);
507
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(`${name} must be an array; received ${describeShape(value)}`);
501
508
  }
502
509
  return value;
503
510
  }
@@ -509,14 +516,14 @@ function assertDataObjects(value, name) {
509
516
  return items;
510
517
  }
511
518
  function assertNoteEventArray(notes, name, options) {
512
- return _chunkXKSO2V5Icjs.assertNoteEvents.call(void 0, assertDataArray(notes, name), name, options);
519
+ return _chunkS5BKZZGMcjs.assertNoteEvents.call(void 0, assertDataArray(notes, name), name, options);
513
520
  }
514
521
  function assertKeyArgument(value, name) {
515
522
  if (value === void 0 || typeof value === "string" || isKeyShaped(value)) {
516
523
  return;
517
524
  }
518
525
  const received = value === null ? "null" : typeof value === "object" ? "an object" : `a ${typeof value}`;
519
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(
526
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
520
527
  `${name} must be a Key; received ${received}. A method that also takes options takes them after the key, not in its place`
521
528
  );
522
529
  }
@@ -554,7 +561,7 @@ function copyNoteEvent(note) {
554
561
  }
555
562
  function copyTimeSignature(ts, name) {
556
563
  assertDataObject(ts, _nullishCoalesce(name, () => ( "time signature")));
557
- _chunkXKSO2V5Icjs.assertTimeSignature.call(void 0, ts, name);
564
+ _chunkS5BKZZGMcjs.assertTimeSignature.call(void 0, ts, name);
558
565
  const copy = { numerator: ts.numerator, denominator: ts.denominator };
559
566
  if (ts.grouping !== void 0) {
560
567
  copy.grouping = [...ts.grouping];
@@ -567,19 +574,19 @@ function copyPlain(value, name) {
567
574
  }
568
575
  function copyPlainAt(value, name, seen, depth) {
569
576
  if (typeof value === "number") {
570
- return _chunkXKSO2V5Icjs.assertFiniteNumber.call(void 0, value, name);
577
+ return _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, value, name);
571
578
  }
572
579
  if (typeof value === "function" || typeof value === "symbol" || typeof value === "bigint") {
573
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(`${name} must be plain data; received ${typeof value}`);
580
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(`${name} must be plain data; received ${typeof value}`);
574
581
  }
575
582
  if (typeof value !== "object" || value === null) {
576
583
  return value;
577
584
  }
578
585
  if (seen.has(value)) {
579
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(`${name} must be plain data; received a value referring to itself`);
586
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(`${name} must be plain data; received a value referring to itself`);
580
587
  }
581
588
  if (depth >= MAX_PLAIN_DEPTH) {
582
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(
589
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
583
590
  `${name} must be plain data; received a value nested more than ${MAX_PLAIN_DEPTH} levels deep`
584
591
  );
585
592
  }
@@ -617,7 +624,7 @@ function samePlain(value, other) {
617
624
  function copyNote(data) {
618
625
  assertDataObject(data, "note data");
619
626
  if (!Number.isInteger(data.letter) || data.letter < 0 || data.letter > 6) {
620
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(
627
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
621
628
  `note letter must be an integer in [0, 6]; received ${data.letter}`
622
629
  );
623
630
  }
@@ -625,7 +632,7 @@ function copyNote(data) {
625
632
  if (data.octave !== void 0) {
626
633
  copy.octave = data.octave;
627
634
  }
628
- _chunkXKSO2V5Icjs.noteToPitchClass.call(void 0, copy);
635
+ _chunkS5BKZZGMcjs.noteToPitchClass.call(void 0, copy);
629
636
  return copy;
630
637
  }
631
638
  var NATURAL_LETTER = /^[A-G]$/;
@@ -634,11 +641,11 @@ function letterNumberOf(letter) {
634
641
  return letter;
635
642
  }
636
643
  if (!NATURAL_LETTER.test(letter)) {
637
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(
638
- `Note.of takes a letter number 0..6 or a bare letter name 'C'..'B'; received ${_chunkXKSO2V5Icjs.describeRejected.call(void 0, letter)}. Use Note.parse(${_chunkXKSO2V5Icjs.describeRejected.call(void 0, letter)}) to read a note name with an accidental or an octave.`
644
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
645
+ `Note.of takes a letter number 0..6 or a bare letter name 'C'..'B'; received ${_chunkS5BKZZGMcjs.describeRejected.call(void 0, letter)}. Use Note.parse(${_chunkS5BKZZGMcjs.describeRejected.call(void 0, letter)}) to read a note name with an accidental or an octave.`
639
646
  );
640
647
  }
641
- return _chunkXKSO2V5Icjs.unwrapParse.call(void 0, _chunkXKSO2V5Icjs.tryParseNote.call(void 0, letter)).letter;
648
+ return _chunkS5BKZZGMcjs.unwrapParse.call(void 0, _chunkS5BKZZGMcjs.tryParseNote.call(void 0, letter)).letter;
642
649
  }
643
650
  var DIMINISHED_SECOND = {
644
651
  number: 2,
@@ -651,7 +658,7 @@ var DESCENDING_DIMINISHED_SECOND = {
651
658
  descending: true
652
659
  };
653
660
  function soundingOrder(note) {
654
- return note.octave === void 0 ? _chunkXKSO2V5Icjs.noteToPitchClass.call(void 0, note) : _chunkXKSO2V5Icjs.noteToMidi.call(void 0, note);
661
+ return note.octave === void 0 ? _chunkS5BKZZGMcjs.noteToPitchClass.call(void 0, note) : _chunkS5BKZZGMcjs.noteToMidi.call(void 0, note);
655
662
  }
656
663
  var Note = class _Note {
657
664
  #data;
@@ -715,7 +722,7 @@ var Note = class _Note {
715
722
  * ```
716
723
  */
717
724
  static parse(text, opts) {
718
- return _chunkXKSO2V5Icjs.unwrapParse.call(void 0, _Note.tryParse(text, opts));
725
+ return _chunkS5BKZZGMcjs.unwrapParse.call(void 0, _Note.tryParse(text, opts));
719
726
  }
720
727
  /**
721
728
  * Parse a note name, reporting failure instead of throwing it.
@@ -736,7 +743,7 @@ var Note = class _Note {
736
743
  * ```
737
744
  */
738
745
  static tryParse(name, opts) {
739
- const parsed = _chunkXKSO2V5Icjs.tryParseNote.call(void 0, name, opts);
746
+ const parsed = _chunkS5BKZZGMcjs.tryParseNote.call(void 0, name, opts);
740
747
  return parsed.ok ? { ok: true, value: new _Note(parsed.value) } : parsed;
741
748
  }
742
749
  /**
@@ -747,7 +754,7 @@ var Note = class _Note {
747
754
  * @returns The spelled note, with octave.
748
755
  */
749
756
  static fromMidi(midi, spelling = "sharp") {
750
- return new _Note(_chunkXKSO2V5Icjs.midiToNote.call(void 0, midi, spelling));
757
+ return new _Note(_chunkS5BKZZGMcjs.midiToNote.call(void 0, midi, spelling));
751
758
  }
752
759
  /**
753
760
  * Wrap an existing plain note object.
@@ -764,7 +771,7 @@ var Note = class _Note {
764
771
  * `'Bb'`. Use {@link Note.format} to write it in another notation system.
765
772
  */
766
773
  get name() {
767
- return _chunkXKSO2V5Icjs.formatNote.call(void 0, this.#data);
774
+ return _chunkS5BKZZGMcjs.formatNote.call(void 0, this.#data);
768
775
  }
769
776
  /**
770
777
  * The note name written in a notation system.
@@ -783,11 +790,11 @@ var Note = class _Note {
783
790
  * ```
784
791
  */
785
792
  format(opts) {
786
- return _chunkXKSO2V5Icjs.formatNote.call(void 0, this.#data, opts);
793
+ return _chunkS5BKZZGMcjs.formatNote.call(void 0, this.#data, opts);
787
794
  }
788
795
  /** The pitch class (0..11), ignoring octave. */
789
796
  get pitchClass() {
790
- return _chunkXKSO2V5Icjs.noteToPitchClass.call(void 0, this.#data);
797
+ return _chunkS5BKZZGMcjs.noteToPitchClass.call(void 0, this.#data);
791
798
  }
792
799
  /**
793
800
  * The MIDI number (middle C = C4 = 60).
@@ -796,9 +803,9 @@ var Note = class _Note {
796
803
  */
797
804
  get midi() {
798
805
  if (this.#data.octave === void 0) {
799
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(`note ${this.name} has no octave, so it has no MIDI number`);
806
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(`note ${this.name} has no octave, so it has no MIDI number`);
800
807
  }
801
- return _chunkXKSO2V5Icjs.noteToMidi.call(void 0, this.#data);
808
+ return _chunkS5BKZZGMcjs.noteToMidi.call(void 0, this.#data);
802
809
  }
803
810
  /** The diatonic letter number: 0..6 for C..B. */
804
811
  get letter() {
@@ -840,7 +847,7 @@ var Note = class _Note {
840
847
  * ```
841
848
  */
842
849
  frequency(tuning) {
843
- return _chunk5JJ6EHEZcjs.frequencyOf.call(void 0, this.midi, tuning);
850
+ return _chunkNM7UAMC3cjs.frequencyOf.call(void 0, this.midi, tuning);
844
851
  }
845
852
  /**
846
853
  * Transpose by a signed number of semitones, keeping the spelling.
@@ -866,7 +873,7 @@ var Note = class _Note {
866
873
  if (semitones === 0 && _optionalChain([opts, 'optionalAccess', _ => _.spelling]) === void 0) {
867
874
  return new _Note(this.#data);
868
875
  }
869
- return new _Note(_chunkXKSO2V5Icjs.transposeNote.call(void 0, this.#data, semitones, opts));
876
+ return new _Note(_chunkS5BKZZGMcjs.transposeNote.call(void 0, this.#data, semitones, opts));
870
877
  }
871
878
  /**
872
879
  * The spelled interval from this note to another.
@@ -875,7 +882,7 @@ var Note = class _Note {
875
882
  * @returns The interval, which {@link Interval.toJSON} unwraps to plain data.
876
883
  */
877
884
  intervalTo(other) {
878
- return Interval.fromData(_chunkXKSO2V5Icjs.spelledInterval.call(void 0, this.#data, other.data));
885
+ return Interval.fromData(_chunkS5BKZZGMcjs.spelledInterval.call(void 0, this.#data, other.data));
879
886
  }
880
887
  /**
881
888
  * Transpose by a spelled interval, keeping the spelling the interval names.
@@ -896,7 +903,7 @@ var Note = class _Note {
896
903
  * ```
897
904
  */
898
905
  transposeBy(interval) {
899
- return new _Note(_chunkXKSO2V5Icjs.transposeByInterval.call(void 0, this.#data, _chunkXKSO2V5Icjs.toSpelledInterval.call(void 0, interval)));
906
+ return new _Note(_chunkS5BKZZGMcjs.transposeByInterval.call(void 0, this.#data, _chunkS5BKZZGMcjs.toSpelledInterval.call(void 0, interval)));
900
907
  }
901
908
  /**
902
909
  * The same spelled note in another octave.
@@ -945,7 +952,7 @@ var Note = class _Note {
945
952
  * ```
946
953
  */
947
954
  forInstrument(instrument) {
948
- return new _Note(_chunkRVS4G4MRcjs.toWrittenPitch.call(void 0, this.#data, instrument));
955
+ return new _Note(_chunk76ZBTRG2cjs.toWrittenPitch.call(void 0, this.#data, instrument));
949
956
  }
950
957
  /**
951
958
  * The other ways this note can be spelled: the same sounding pitch written on
@@ -966,7 +973,7 @@ var Note = class _Note {
966
973
  * ```
967
974
  */
968
975
  enharmonic() {
969
- return [DIMINISHED_SECOND, DESCENDING_DIMINISHED_SECOND].map((interval) => _chunkXKSO2V5Icjs.transposeByInterval.call(void 0, this.#data, interval)).filter((note) => Math.abs(note.alter) <= _chunkXKSO2V5Icjs.MAX_NAME_ACCIDENTALS).map((note) => new _Note(note));
976
+ return [DIMINISHED_SECOND, DESCENDING_DIMINISHED_SECOND].map((interval) => _chunkS5BKZZGMcjs.transposeByInterval.call(void 0, this.#data, interval)).filter((note) => Math.abs(note.alter) <= _chunkS5BKZZGMcjs.MAX_NAME_ACCIDENTALS).map((note) => new _Note(note));
970
977
  }
971
978
  /**
972
979
  * The scale degree this note occupies in a key, counted from 1 at the tonic.
@@ -987,7 +994,7 @@ var Note = class _Note {
987
994
  * ```
988
995
  */
989
996
  degreeIn(key) {
990
- const degree = _chunkYPB3A3EYcjs.pitchToScaleDegree.call(void 0, this.pitchClass, key);
997
+ const degree = _chunk3R3QVKY5cjs.pitchToScaleDegree.call(void 0, this.pitchClass, key);
991
998
  return degree === -1 ? null : degree;
992
999
  }
993
1000
  /**
@@ -1068,8 +1075,8 @@ var Note = class _Note {
1068
1075
  function copySegment(segment) {
1069
1076
  assertDataObject(segment, "timeline segment");
1070
1077
  return {
1071
- startBeat: _chunkXKSO2V5Icjs.assertFiniteNumber.call(void 0, segment.startBeat, "timeline segment startBeat"),
1072
- endBeat: _chunkXKSO2V5Icjs.assertFiniteNumber.call(void 0, segment.endBeat, "timeline segment endBeat"),
1078
+ startBeat: _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, segment.startBeat, "timeline segment startBeat"),
1079
+ endBeat: _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, segment.endBeat, "timeline segment endBeat"),
1073
1080
  // The chord is checked by the same boundary every other chord crosses, so a
1074
1081
  // root of 25 or an interval of NaN is refused or reduced here rather than
1075
1082
  // surfacing wherever the number is finally used.
@@ -1079,12 +1086,12 @@ function copySegment(segment) {
1079
1086
  function copyKeyRegion(region) {
1080
1087
  assertDataObject(region, "key region");
1081
1088
  const copy = {
1082
- startBeat: _chunkXKSO2V5Icjs.assertFiniteNumber.call(void 0, region.startBeat, "key region startBeat"),
1083
- endBeat: _chunkXKSO2V5Icjs.assertFiniteNumber.call(void 0, region.endBeat, "key region endBeat"),
1089
+ startBeat: _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, region.startBeat, "key region startBeat"),
1090
+ endBeat: _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, region.endBeat, "key region endBeat"),
1084
1091
  // Read through the key itself, so a tonic that does not spell the region's
1085
1092
  // own root is refused here rather than spelling later notes wrongly.
1086
1093
  key: keyIdentity(toKey(region.key)),
1087
- confidence: _chunkXKSO2V5Icjs.assertFiniteNumber.call(void 0, region.confidence, "key region confidence")
1094
+ confidence: _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, region.confidence, "key region confidence")
1088
1095
  };
1089
1096
  if (region.modulation !== void 0) {
1090
1097
  copy.modulation = region.modulation;
@@ -1105,12 +1112,12 @@ function copyConfidence(confidence, segments) {
1105
1112
  }
1106
1113
  assertDataArray(confidence, "timeline segmentConfidence");
1107
1114
  if (confidence.length !== segments) {
1108
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(
1115
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
1109
1116
  `timeline segmentConfidence must hold one value per segment; received ${confidence.length} for ${segments}`
1110
1117
  );
1111
1118
  }
1112
1119
  return confidence.map(
1113
- (value, index) => _chunkXKSO2V5Icjs.assertRange.call(void 0, value, 0, 1, `timeline segmentConfidence[${index}]`)
1120
+ (value, index) => _chunkS5BKZZGMcjs.assertRange.call(void 0, value, 0, 1, `timeline segmentConfidence[${index}]`)
1114
1121
  );
1115
1122
  }
1116
1123
  function clipSpan(span, fromBeat, toBeat) {
@@ -1136,7 +1143,7 @@ var Timeline = class _Timeline {
1136
1143
  this.#segments = Object.freeze(
1137
1144
  assertDataArray(data.segments, "timeline segments").map(copySegment)
1138
1145
  );
1139
- this.#totalBeats = _chunkXKSO2V5Icjs.assertRange.call(void 0,
1146
+ this.#totalBeats = _chunkS5BKZZGMcjs.assertRange.call(void 0,
1140
1147
  data.totalBeats,
1141
1148
  0,
1142
1149
  Number.MAX_SAFE_INTEGER,
@@ -1160,7 +1167,7 @@ var Timeline = class _Timeline {
1160
1167
  * @returns The timeline.
1161
1168
  */
1162
1169
  static fromChords(spans, totalBeats, key) {
1163
- const timeline = _chunkQ6R3QAZDcjs.chordTimelineFromChords.call(void 0, spans, totalBeats);
1170
+ const timeline = _chunkIFZDWIKMcjs.chordTimelineFromChords.call(void 0, spans, totalBeats);
1164
1171
  const data = { segments: timeline.segments, totalBeats };
1165
1172
  if (key !== void 0) {
1166
1173
  data.keys = [
@@ -1184,7 +1191,7 @@ var Timeline = class _Timeline {
1184
1191
  * @returns The inferred timeline, carrying the key regions the analysis found.
1185
1192
  */
1186
1193
  static fromNotes(notes, opts) {
1187
- const { timeline, keys, segmentConfidence } = _chunkQ6R3QAZDcjs.chordTimelineFromNotes.call(void 0, notes, opts);
1194
+ const { timeline, keys, segmentConfidence } = _chunkIFZDWIKMcjs.chordTimelineFromNotes.call(void 0, notes, opts);
1188
1195
  const totalBeats = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _5 => _5.totalBeats]), () => ( spanEnd(timeline.segments, keys)));
1189
1196
  return new _Timeline({ segments: timeline.segments, totalBeats, keys, segmentConfidence });
1190
1197
  }
@@ -1203,9 +1210,9 @@ var Timeline = class _Timeline {
1203
1210
  * @throws If `beatsEach` is not a positive finite number of beats.
1204
1211
  */
1205
1212
  static fromProgression(progression, beatsEach) {
1206
- _chunkXKSO2V5Icjs.assertRange.call(void 0, beatsEach, Number.MIN_VALUE, Number.MAX_SAFE_INTEGER, "timeline beatsEach");
1213
+ _chunkS5BKZZGMcjs.assertRange.call(void 0, beatsEach, Number.MIN_VALUE, Number.MAX_SAFE_INTEGER, "timeline beatsEach");
1207
1214
  const chords = progression.chords;
1208
- const spans = chords.map((chord, index) => _chunkYPB3A3EYcjs.spanFromChord.call(void 0, chord.data, index * beatsEach));
1215
+ const spans = chords.map((chord, index) => _chunk3R3QVKY5cjs.spanFromChord.call(void 0, chord.data, index * beatsEach));
1209
1216
  const totalBeats = chords.length * beatsEach;
1210
1217
  const key = progression.key;
1211
1218
  return key === void 0 ? _Timeline.fromChords(spans, totalBeats) : _Timeline.fromChords(spans, totalBeats, key);
@@ -1231,7 +1238,7 @@ var Timeline = class _Timeline {
1231
1238
  * @throws If `beat` is not finite.
1232
1239
  */
1233
1240
  at(beat) {
1234
- const chord = _chunkQ6R3QAZDcjs.chordAtBeat.call(void 0, this.#segments, beat);
1241
+ const chord = _chunkIFZDWIKMcjs.chordAtBeat.call(void 0, this.#segments, beat);
1235
1242
  if (chord === null) {
1236
1243
  return null;
1237
1244
  }
@@ -1248,7 +1255,7 @@ var Timeline = class _Timeline {
1248
1255
  }
1249
1256
  /** The key held longest across the span, when the analysis found one. */
1250
1257
  get key() {
1251
- const prevailing = _chunkQ6R3QAZDcjs.prevailingKeyOf.call(void 0, this.#keys);
1258
+ const prevailing = _chunkIFZDWIKMcjs.prevailingKeyOf.call(void 0, this.#keys);
1252
1259
  return prevailing === null ? void 0 : toKey(prevailing);
1253
1260
  }
1254
1261
  /**
@@ -1320,7 +1327,7 @@ var Timeline = class _Timeline {
1320
1327
  * @throws If the timeline carries no key region to read the chords against.
1321
1328
  */
1322
1329
  reduce(opts) {
1323
- return _chunkXVMJO3QFcjs.reduceProgression.call(void 0, this.chordTimeline, this.#keyContext(), opts);
1330
+ return _chunkIFZDWIKMcjs.reduceProgression.call(void 0, this.chordTimeline, this.#keyContext(), opts);
1324
1331
  }
1325
1332
  /**
1326
1333
  * The cadences the harmony arrives at.
@@ -1333,7 +1340,7 @@ var Timeline = class _Timeline {
1333
1340
  * @throws If the timeline carries no key region to read the chords against.
1334
1341
  */
1335
1342
  cadences() {
1336
- return _chunkQ6R3QAZDcjs.detectCadences.call(void 0, this.chordTimeline, this.#keyContext());
1343
+ return _chunkIFZDWIKMcjs.detectCadences.call(void 0, this.chordTimeline, this.#keyContext());
1337
1344
  }
1338
1345
  /**
1339
1346
  * The keys the chords themselves imply, in time order.
@@ -1362,7 +1369,7 @@ var Timeline = class _Timeline {
1362
1369
  * ```
1363
1370
  */
1364
1371
  modulations(opts) {
1365
- return _chunkQ6R3QAZDcjs.detectModulations.call(void 0, this.#copySegments(), {
1372
+ return _chunkIFZDWIKMcjs.detectModulations.call(void 0, this.#copySegments(), {
1366
1373
  totalBeats: this.#totalBeats,
1367
1374
  ...opts
1368
1375
  }).map(copyKeyRegion);
@@ -1380,12 +1387,12 @@ var Timeline = class _Timeline {
1380
1387
  */
1381
1388
  roman(key, opts) {
1382
1389
  assertKeyArgument(key, "timeline key");
1383
- const given = key === void 0 ? void 0 : _chunkYPB3A3EYcjs.resolveKey.call(void 0, key);
1390
+ const given = key === void 0 ? void 0 : _chunk3R3QVKY5cjs.resolveKey.call(void 0, key);
1384
1391
  const keyAt = given === void 0 ? this.#resolvedKeyAt() : () => given;
1385
1392
  return this.#segments.map((segment) => ({
1386
1393
  startBeat: segment.startBeat,
1387
1394
  endBeat: segment.endBeat,
1388
- roman: _chunkQ6R3QAZDcjs.chordToRoman.call(void 0, segment.chord, keyAt(segment.startBeat), opts)
1395
+ roman: _chunkIFZDWIKMcjs.chordToRoman.call(void 0, segment.chord, keyAt(segment.startBeat), opts)
1389
1396
  }));
1390
1397
  }
1391
1398
  /**
@@ -1402,10 +1409,10 @@ var Timeline = class _Timeline {
1402
1409
  * @throws If either beat is not finite, or `toBeat` precedes `fromBeat`.
1403
1410
  */
1404
1411
  slice(fromBeat, toBeat) {
1405
- _chunkXKSO2V5Icjs.assertFiniteNumber.call(void 0, fromBeat, "timeline slice fromBeat");
1406
- _chunkXKSO2V5Icjs.assertFiniteNumber.call(void 0, toBeat, "timeline slice toBeat");
1412
+ _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, fromBeat, "timeline slice fromBeat");
1413
+ _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, toBeat, "timeline slice toBeat");
1407
1414
  if (toBeat < fromBeat) {
1408
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(
1415
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
1409
1416
  `timeline slice toBeat must not precede fromBeat; received [${fromBeat}, ${toBeat})`
1410
1417
  );
1411
1418
  }
@@ -1500,7 +1507,7 @@ var Timeline = class _Timeline {
1500
1507
  /** The `{ at, segments }` shape the analysis functions take. */
1501
1508
  get chordTimeline() {
1502
1509
  const segments = this.#copySegments();
1503
- return { at: (beat) => _chunkQ6R3QAZDcjs.chordAtBeat.call(void 0, segments, beat), segments };
1510
+ return { at: (beat) => _chunkIFZDWIKMcjs.chordAtBeat.call(void 0, segments, beat), segments };
1504
1511
  }
1505
1512
  /** A fresh copy of the segments, which is what every reader is handed. */
1506
1513
  #copySegments() {
@@ -1508,8 +1515,8 @@ var Timeline = class _Timeline {
1508
1515
  }
1509
1516
  /** The key in force at a beat, or undefined when the timeline knows none. */
1510
1517
  #keyAt(beat) {
1511
- const prevailing = _chunkQ6R3QAZDcjs.prevailingKeyOf.call(void 0, this.#keys);
1512
- return prevailing === null ? void 0 : toKey(_chunkQ6R3QAZDcjs.keyLookup.call(void 0, this.#keys, prevailing)(beat));
1518
+ const prevailing = _chunkIFZDWIKMcjs.prevailingKeyOf.call(void 0, this.#keys);
1519
+ return prevailing === null ? void 0 : toKey(_chunkIFZDWIKMcjs.keyLookup.call(void 0, this.#keys, prevailing)(beat));
1513
1520
  }
1514
1521
  /**
1515
1522
  * The key every beat of the timeline is read against, spelling and all.
@@ -1522,13 +1529,13 @@ var Timeline = class _Timeline {
1522
1529
  * would number it as the G# minor those read best as.
1523
1530
  */
1524
1531
  #resolvedKeyAt() {
1525
- const prevailing = _chunkQ6R3QAZDcjs.prevailingKeyOf.call(void 0, this.#keys);
1532
+ const prevailing = _chunkIFZDWIKMcjs.prevailingKeyOf.call(void 0, this.#keys);
1526
1533
  if (prevailing === null) {
1527
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(
1534
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
1528
1535
  "timeline carries no key; build it from notes, or pass a key to Timeline.fromChords"
1529
1536
  );
1530
1537
  }
1531
- return _chunkQ6R3QAZDcjs.keyLookup.call(void 0, this.#keys, prevailing);
1538
+ return _chunkIFZDWIKMcjs.keyLookup.call(void 0, this.#keys, prevailing);
1532
1539
  }
1533
1540
  /**
1534
1541
  * The pitch classes of that key, for the readings that want them.
@@ -1540,7 +1547,7 @@ var Timeline = class _Timeline {
1540
1547
  */
1541
1548
  #keyContext() {
1542
1549
  const keyAt = this.#resolvedKeyAt();
1543
- return (beat) => _chunkYPB3A3EYcjs.scaleOf.call(void 0, keyAt(beat));
1550
+ return (beat) => _chunk3R3QVKY5cjs.scaleOf.call(void 0, keyAt(beat));
1544
1551
  }
1545
1552
  /** Move every chord and every key region by the same step. */
1546
1553
  #moved(moveChord, moveKey) {
@@ -1642,7 +1649,7 @@ var Progression = class _Progression {
1642
1649
  */
1643
1650
  static fromSpans(spans, key) {
1644
1651
  const chords = assertDataObjects(spans, "progression spans").map(
1645
- (span) => Chord.fromData(_chunkYPB3A3EYcjs.chordFromSpan.call(void 0, span))
1652
+ (span) => Chord.fromData(_chunk3R3QVKY5cjs.chordFromSpan.call(void 0, span))
1646
1653
  );
1647
1654
  return new _Progression(chords, key);
1648
1655
  }
@@ -1870,7 +1877,7 @@ var Progression = class _Progression {
1870
1877
  */
1871
1878
  voice(opts) {
1872
1879
  const key = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _6 => _6.key]), () => ( this.#key));
1873
- return _chunkRVS4G4MRcjs.voiceProgression.call(void 0,
1880
+ return _chunk76ZBTRG2cjs.voiceProgression.call(void 0,
1874
1881
  this.#chords.map((chord) => chord.data),
1875
1882
  key === void 0 ? opts : { ...opts, key }
1876
1883
  );
@@ -1937,7 +1944,7 @@ var Progression = class _Progression {
1937
1944
  const from = this.#chords[this.#chords.length - 2];
1938
1945
  const to = this.#chords[this.#chords.length - 1];
1939
1946
  const approach = this.#chords[this.#chords.length - 3];
1940
- const cadence = from !== void 0 && to !== void 0 ? _chunkQ6R3QAZDcjs.detectCadence.call(void 0, from.data, to.data, resolved, {
1947
+ const cadence = from !== void 0 && to !== void 0 ? _chunkIFZDWIKMcjs.detectCadence.call(void 0, from.data, to.data, resolved, {
1941
1948
  ...cadenceOpts,
1942
1949
  ...approach === void 0 ? {} : { approach: approach.data },
1943
1950
  ...voicing === void 0 ? {} : { voicing: this.#closingVoicing(voicing) }
@@ -1957,7 +1964,7 @@ var Progression = class _Progression {
1957
1964
  if (voicing.length === this.#chords.length || voicing.length === 2) {
1958
1965
  return [_nullishCoalesce(voicing[voicing.length - 2], () => ( [])), _nullishCoalesce(voicing[voicing.length - 1], () => ( []))];
1959
1966
  }
1960
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(
1967
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
1961
1968
  `voicing must hold one voicing per chord (${this.#chords.length}) or the closing pair; received ${voicing.length}`
1962
1969
  );
1963
1970
  }
@@ -1967,7 +1974,7 @@ var Progression = class _Progression {
1967
1974
  * @returns One scale choice per chord in this progression.
1968
1975
  */
1969
1976
  scales() {
1970
- return _chunkR7B5N2JKcjs.scalesForChanges.call(void 0, this.#chords.map((chord) => chord.data));
1977
+ return _chunkPM4XJE2Ycjs.scalesForChanges.call(void 0, this.#chords.map((chord) => chord.data));
1971
1978
  }
1972
1979
  /**
1973
1980
  * Classify the motion at every chord change, not only the closing one.
@@ -2014,7 +2021,7 @@ var Progression = class _Progression {
2014
2021
  const approach = index >= 2 ? _optionalChain([this, 'access', _7 => _7.#chords, 'access', _8 => _8[index - 2], 'optionalAccess', _9 => _9.data]) : _optionalChain([opts, 'optionalAccess', _10 => _10.approach]);
2015
2022
  const pair = _optionalChain([opts, 'optionalAccess', _11 => _11.voicing]);
2016
2023
  found.push(
2017
- _chunkQ6R3QAZDcjs.detectCadence.call(void 0, from.data, to.data, resolved, {
2024
+ _chunkIFZDWIKMcjs.detectCadence.call(void 0, from.data, to.data, resolved, {
2018
2025
  ..._optionalChain([opts, 'optionalAccess', _12 => _12.alternatives]) === void 0 ? {} : { alternatives: opts.alternatives },
2019
2026
  ...approach === void 0 ? {} : { approach },
2020
2027
  ...pair === void 0 ? {} : { voicing: [_nullishCoalesce(pair[index - 1], () => ( [])), _nullishCoalesce(pair[index], () => ( []))] }
@@ -2051,16 +2058,16 @@ var Progression = class _Progression {
2051
2058
  const position = index < 0 ? this.#chords.length + index : index;
2052
2059
  const target = this.#chords[position];
2053
2060
  if (target === void 0) {
2054
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(
2061
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
2055
2062
  `progression has no chord at index ${index}; it holds ${this.#chords.length}`
2056
2063
  );
2057
2064
  }
2058
2065
  const key = this.#resolveKey();
2059
- const chosen = _chunk5KW7DNCJcjs.substituteChord.call(void 0, target.data, key, opts).find(
2066
+ const chosen = _chunkB2PW6EHNcjs.substituteChord.call(void 0, target.data, key, opts).find(
2060
2067
  (candidate) => candidate.type === type
2061
2068
  );
2062
2069
  if (chosen === void 0) {
2063
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(
2070
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
2064
2071
  `no ${type} substitution for ${target.symbol()} in ${key.toString()}`
2065
2072
  );
2066
2073
  }
@@ -2153,7 +2160,7 @@ var Progression = class _Progression {
2153
2160
  transposeTo(target) {
2154
2161
  const from = this.#key;
2155
2162
  if (from === void 0) {
2156
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(
2163
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
2157
2164
  "progression has no key context; attach one with withKey() before transposing to another key"
2158
2165
  );
2159
2166
  }
@@ -2196,7 +2203,7 @@ var Progression = class _Progression {
2196
2203
  assertKeyArgument(key, "progression key");
2197
2204
  const resolved = key === void 0 ? this.#key : toKey(key);
2198
2205
  if (resolved === void 0) {
2199
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(
2206
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
2200
2207
  "progression has no key context; pass a Key or attach one with withKey()"
2201
2208
  );
2202
2209
  }
@@ -2206,25 +2213,25 @@ var Progression = class _Progression {
2206
2213
 
2207
2214
  // src/model/chord.ts
2208
2215
  function hintMatches(hint, pc) {
2209
- return hint !== void 0 && pc !== void 0 && _chunkXKSO2V5Icjs.pitchClassOf.call(void 0, _chunkXKSO2V5Icjs.noteToPitchClass.call(void 0, hint)) === _chunkXKSO2V5Icjs.pitchClassOf.call(void 0, pc);
2216
+ return hint !== void 0 && pc !== void 0 && _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, _chunkS5BKZZGMcjs.noteToPitchClass.call(void 0, hint)) === _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, pc);
2210
2217
  }
2211
2218
  function transposeHintByInterval(hint, interval) {
2212
2219
  if (hint === void 0) {
2213
2220
  return void 0;
2214
2221
  }
2215
- const moved = _chunkXKSO2V5Icjs.transposeByInterval.call(void 0, hint, interval);
2222
+ const moved = _chunkS5BKZZGMcjs.transposeByInterval.call(void 0, hint, interval);
2216
2223
  return { letter: moved.letter, alter: moved.alter };
2217
2224
  }
2218
2225
  function transposeToneHintsByInterval(hints, interval) {
2219
2226
  return _optionalChain([hints, 'optionalAccess', _22 => _22.map, 'call', _23 => _23((hint) => {
2220
- const moved = _chunkXKSO2V5Icjs.transposeByInterval.call(void 0, hint, interval);
2227
+ const moved = _chunkS5BKZZGMcjs.transposeByInterval.call(void 0, hint, interval);
2221
2228
  return { letter: moved.letter, alter: moved.alter };
2222
2229
  })]);
2223
2230
  }
2224
2231
  function copyChord(data) {
2225
2232
  assertDataObject(data, "chord data");
2226
- _chunkYPB3A3EYcjs.assertChordQuality.call(void 0, data.quality);
2227
- const rootPc = _chunkXKSO2V5Icjs.pitchClassOf.call(void 0, data.rootPc);
2233
+ _chunk3R3QVKY5cjs.assertChordQuality.call(void 0, data.quality);
2234
+ const rootPc = _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, data.rootPc);
2228
2235
  const copy = {
2229
2236
  rootPc,
2230
2237
  quality: data.quality,
@@ -2232,14 +2239,14 @@ function copyChord(data) {
2232
2239
  // interval voices, spells and formats as a chord that looks real, and the
2233
2240
  // failure surfaces wherever the number is finally used.
2234
2241
  intervals: assertDataArray(data.intervals, "chord intervals").map(
2235
- (interval, index) => _chunkXKSO2V5Icjs.assertFiniteNumber.call(void 0, interval, `chord intervals[${index}]`)
2242
+ (interval, index) => _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, interval, `chord intervals[${index}]`)
2236
2243
  )
2237
2244
  };
2238
- const bassPc = data.bassPc === void 0 ? void 0 : _chunkXKSO2V5Icjs.pitchClassOf.call(void 0, data.bassPc);
2245
+ const bassPc = data.bassPc === void 0 ? void 0 : _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, data.bassPc);
2239
2246
  if (bassPc !== void 0 && bassPc !== rootPc) {
2240
2247
  copy.bassPc = bassPc;
2241
2248
  }
2242
- const tones = _chunkYPB3A3EYcjs.chordToneSpellings.call(void 0, data);
2249
+ const tones = _chunk3R3QVKY5cjs.chordToneSpellings.call(void 0, data);
2243
2250
  if (tones !== void 0) {
2244
2251
  copy.toneSpellings = tones;
2245
2252
  }
@@ -2258,8 +2265,8 @@ function deriveBassSpelling(chord, key) {
2258
2265
  }
2259
2266
  const root = chord.rootSpelling;
2260
2267
  if (root !== void 0) {
2261
- const index = chord.intervals.findIndex((i) => _chunkXKSO2V5Icjs.pitchClassOf.call(void 0, chord.rootPc + i) === bassPc);
2262
- const tone = index >= 0 ? _chunkYPB3A3EYcjs.spellChordFromRoot.call(void 0, chord, root)[index] : void 0;
2268
+ const index = chord.intervals.findIndex((i) => _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, chord.rootPc + i) === bassPc);
2269
+ const tone = index >= 0 ? _chunk3R3QVKY5cjs.spellChordFromRoot.call(void 0, chord, root)[index] : void 0;
2263
2270
  if (tone !== void 0) {
2264
2271
  return { letter: tone.letter, alter: tone.alter };
2265
2272
  }
@@ -2267,7 +2274,7 @@ function deriveBassSpelling(chord, key) {
2267
2274
  if (key === void 0) {
2268
2275
  return void 0;
2269
2276
  }
2270
- const spelled = _chunkYPB3A3EYcjs.spellPitchClass.call(void 0, bassPc, key.tonic.data, key);
2277
+ const spelled = _chunk3R3QVKY5cjs.spellPitchClass.call(void 0, bassPc, key.tonic.data, key);
2271
2278
  return { letter: spelled.letter, alter: spelled.alter };
2272
2279
  }
2273
2280
  var Chord = class _Chord {
@@ -2300,7 +2307,7 @@ var Chord = class _Chord {
2300
2307
  #dataWithKey(key) {
2301
2308
  const out = copyChord(this.#given);
2302
2309
  if (out.rootSpelling === void 0 && key !== void 0) {
2303
- out.rootSpelling = _chunkYPB3A3EYcjs.spellPitchClass.call(void 0, out.rootPc, key.tonic.data, key);
2310
+ out.rootSpelling = _chunk3R3QVKY5cjs.spellPitchClass.call(void 0, out.rootPc, key.tonic.data, key);
2304
2311
  }
2305
2312
  if (out.bassSpelling === void 0) {
2306
2313
  const bass = deriveBassSpelling(out, key);
@@ -2323,7 +2330,7 @@ var Chord = class _Chord {
2323
2330
  const bassNote = typeof bass === "string" ? Note.parse(bass) : void 0;
2324
2331
  const bassPc = bassNote !== void 0 ? bassNote.pitchClass : bass;
2325
2332
  const rootNote = typeof root === "string" ? Note.parse(root) : void 0;
2326
- const data = _chunkYPB3A3EYcjs.makeChord.call(void 0,
2333
+ const data = _chunk3R3QVKY5cjs.makeChord.call(void 0,
2327
2334
  rootNote !== void 0 ? rootNote.pitchClass : root,
2328
2335
  quality,
2329
2336
  bassPc
@@ -2389,7 +2396,7 @@ var Chord = class _Chord {
2389
2396
  * ```
2390
2397
  */
2391
2398
  static fromFiguredBass(bass, figures, key) {
2392
- return new _Chord(_chunkRVS4G4MRcjs.realizeFiguredBass.call(void 0, _chunkXKSO2V5Icjs.toNoteData.call(void 0, bass), figures, key));
2399
+ return new _Chord(_chunk76ZBTRG2cjs.realizeFiguredBass.call(void 0, _chunkS5BKZZGMcjs.toNoteData.call(void 0, bass), figures, key));
2393
2400
  }
2394
2401
  /**
2395
2402
  * Parse a lead-sheet chord symbol (e.g. `'Cmaj7'`, `'F#m7b5'`, `'C/G'`).
@@ -2412,7 +2419,7 @@ var Chord = class _Chord {
2412
2419
  * ```
2413
2420
  */
2414
2421
  static parse(symbol, opts) {
2415
- return _chunkXKSO2V5Icjs.unwrapParse.call(void 0, _Chord.tryParse(symbol, opts));
2422
+ return _chunkS5BKZZGMcjs.unwrapParse.call(void 0, _Chord.tryParse(symbol, opts));
2416
2423
  }
2417
2424
  /**
2418
2425
  * Parse a lead-sheet chord symbol, reporting failure instead of throwing it.
@@ -2435,7 +2442,7 @@ var Chord = class _Chord {
2435
2442
  * ```
2436
2443
  */
2437
2444
  static tryParse(symbol, opts) {
2438
- const parsed = _chunkYPB3A3EYcjs.tryParseChordSymbol.call(void 0, symbol, opts);
2445
+ const parsed = _chunk3R3QVKY5cjs.tryParseChordSymbol.call(void 0, symbol, opts);
2439
2446
  return parsed.ok ? { ok: true, value: new _Chord(parsed.value) } : parsed;
2440
2447
  }
2441
2448
  /**
@@ -2446,8 +2453,8 @@ var Chord = class _Chord {
2446
2453
  * @returns Ranked chord interpretations (may be empty).
2447
2454
  */
2448
2455
  static detect(pitches, opts) {
2449
- return _chunkQ6R3QAZDcjs.detectChord.call(void 0, pitches, opts).map(
2450
- (match) => new _Chord(_chunkYPB3A3EYcjs.makeChord.call(void 0, match.rootPc, match.quality, match.bassPc))
2456
+ return _chunkIFZDWIKMcjs.detectChord.call(void 0, pitches, opts).map(
2457
+ (match) => new _Chord(_chunk3R3QVKY5cjs.makeChord.call(void 0, match.rootPc, match.quality, match.bassPc))
2451
2458
  );
2452
2459
  }
2453
2460
  /**
@@ -2469,8 +2476,8 @@ var Chord = class _Chord {
2469
2476
  * ```
2470
2477
  */
2471
2478
  static detectMatches(pitches, opts) {
2472
- return _chunkQ6R3QAZDcjs.detectChord.call(void 0, pitches, opts).map((match) => ({
2473
- chord: new _Chord(_chunkYPB3A3EYcjs.makeChord.call(void 0, match.rootPc, match.quality, match.bassPc)),
2479
+ return _chunkIFZDWIKMcjs.detectChord.call(void 0, pitches, opts).map((match) => ({
2480
+ chord: new _Chord(_chunk3R3QVKY5cjs.makeChord.call(void 0, match.rootPc, match.quality, match.bassPc)),
2474
2481
  match
2475
2482
  }));
2476
2483
  }
@@ -2482,7 +2489,7 @@ var Chord = class _Chord {
2482
2489
  * @returns The top-ranked chord, or null when nothing matches.
2483
2490
  */
2484
2491
  static detectBest(pitches, opts) {
2485
- const best = _chunkQ6R3QAZDcjs.detectChordBest.call(void 0, pitches, opts);
2492
+ const best = _chunkIFZDWIKMcjs.detectChordBest.call(void 0, pitches, opts);
2486
2493
  return best === null ? null : new _Chord(best);
2487
2494
  }
2488
2495
  /** The root pitch class (0..11). */
@@ -2526,7 +2533,7 @@ var Chord = class _Chord {
2526
2533
  * ```
2527
2534
  */
2528
2535
  get spec() {
2529
- return _chunkYPB3A3EYcjs.chordSpecOf.call(void 0, this.#data);
2536
+ return _chunk3R3QVKY5cjs.chordSpecOf.call(void 0, this.#data);
2530
2537
  }
2531
2538
  /** The carried key context, if any. */
2532
2539
  get key() {
@@ -2564,7 +2571,7 @@ var Chord = class _Chord {
2564
2571
  * ```
2565
2572
  */
2566
2573
  pitchClasses(opts) {
2567
- return _chunkYPB3A3EYcjs.chordPitchClasses.call(void 0, this.#data, opts);
2574
+ return _chunk3R3QVKY5cjs.chordPitchClasses.call(void 0, this.#data, opts);
2568
2575
  }
2569
2576
  /**
2570
2577
  * Whether a pitch is one of the chord's tones, ignoring octave.
@@ -2582,7 +2589,7 @@ var Chord = class _Chord {
2582
2589
  * ```
2583
2590
  */
2584
2591
  contains(pitch) {
2585
- return _chunkYPB3A3EYcjs.isChordMember.call(void 0, pitch, this.#data);
2592
+ return _chunk3R3QVKY5cjs.isChordMember.call(void 0, pitch, this.#data);
2586
2593
  }
2587
2594
  /**
2588
2595
  * A pitch's harmonic role in the chord: root, third, fifth, sixth, or
@@ -2605,7 +2612,7 @@ var Chord = class _Chord {
2605
2612
  * ```
2606
2613
  */
2607
2614
  roleOf(pitch) {
2608
- return _chunkYPB3A3EYcjs.chordToneRole.call(void 0, pitch, this.#data);
2615
+ return _chunk3R3QVKY5cjs.chordToneRole.call(void 0, pitch, this.#data);
2609
2616
  }
2610
2617
  /**
2611
2618
  * The chord's Roman numeral in a key.
@@ -2617,7 +2624,7 @@ var Chord = class _Chord {
2617
2624
  * @throws If no key is given and none is carried.
2618
2625
  */
2619
2626
  roman(key, opts) {
2620
- return _chunkQ6R3QAZDcjs.chordToRoman.call(void 0, this.#data, this.#resolveKey(key), opts);
2627
+ return _chunkIFZDWIKMcjs.chordToRoman.call(void 0, this.#data, this.#resolveKey(key), opts);
2621
2628
  }
2622
2629
  /**
2623
2630
  * The chord's Roman numeral together with the reasoning behind it: the degree
@@ -2645,7 +2652,7 @@ var Chord = class _Chord {
2645
2652
  * ```
2646
2653
  */
2647
2654
  explain(key, opts) {
2648
- return _chunkQ6R3QAZDcjs.explainRoman.call(void 0, this.#data, this.#resolveKey(key), opts);
2655
+ return _chunkIFZDWIKMcjs.explainRoman.call(void 0, this.#data, this.#resolveKey(key), opts);
2649
2656
  }
2650
2657
  /**
2651
2658
  * The chord's harmonic function (tonic / subdominant / dominant) in a key.
@@ -2656,7 +2663,7 @@ var Chord = class _Chord {
2656
2663
  * @throws If no key is given and none is carried.
2657
2664
  */
2658
2665
  function(key) {
2659
- return _chunkQ6R3QAZDcjs.functionOf.call(void 0, this.#data, this.#resolveKey(key));
2666
+ return _chunkIFZDWIKMcjs.functionOf.call(void 0, this.#data, this.#resolveKey(key));
2660
2667
  }
2661
2668
  /**
2662
2669
  * Full functional analysis: function, borrowing, Roman numeral, and the
@@ -2676,7 +2683,7 @@ var Chord = class _Chord {
2676
2683
  * ```
2677
2684
  */
2678
2685
  analyze(key, opts) {
2679
- return _chunkQ6R3QAZDcjs.analyzeChord.call(void 0, this.#data, this.#resolveKey(key), opts);
2686
+ return _chunkIFZDWIKMcjs.analyzeChord.call(void 0, this.#data, this.#resolveKey(key), opts);
2680
2687
  }
2681
2688
  /**
2682
2689
  * Whether the chord is borrowed from the parallel mode (modal interchange).
@@ -2687,7 +2694,7 @@ var Chord = class _Chord {
2687
2694
  * @throws If no key is given and none is carried.
2688
2695
  */
2689
2696
  isBorrowed(key) {
2690
- return _chunkQ6R3QAZDcjs.isBorrowedChord.call(void 0, this.#data, this.#resolveKey(key));
2697
+ return _chunkIFZDWIKMcjs.isBorrowedChord.call(void 0, this.#data, this.#resolveKey(key));
2691
2698
  }
2692
2699
  /**
2693
2700
  * The origin of a non-diatonic chord (parallel mode or Neapolitan), or null.
@@ -2698,7 +2705,7 @@ var Chord = class _Chord {
2698
2705
  * @throws If no key is given and none is carried.
2699
2706
  */
2700
2707
  borrowedSource(key) {
2701
- return _chunkQ6R3QAZDcjs.borrowedSource.call(void 0, this.#data, this.#resolveKey(key));
2708
+ return _chunkIFZDWIKMcjs.borrowedSource.call(void 0, this.#data, this.#resolveKey(key));
2702
2709
  }
2703
2710
  /**
2704
2711
  * The chord written as the figures a bass would carry under it: `6`, `64`,
@@ -2723,7 +2730,7 @@ var Chord = class _Chord {
2723
2730
  * ```
2724
2731
  */
2725
2732
  figuredBass(key) {
2726
- return _chunkRVS4G4MRcjs.figuredBassOf.call(void 0, this.#data, this.#resolveKey(key));
2733
+ return _chunk76ZBTRG2cjs.figuredBassOf.call(void 0, this.#data, this.#resolveKey(key));
2727
2734
  }
2728
2735
  /**
2729
2736
  * The chords that can stand in for this one in a key: its tritone substitute,
@@ -2750,7 +2757,7 @@ var Chord = class _Chord {
2750
2757
  * ```
2751
2758
  */
2752
2759
  substitutions(key, opts) {
2753
- return _chunk5KW7DNCJcjs.substituteChord.call(void 0, this.#data, this.#resolveKey(key), opts);
2760
+ return _chunkB2PW6EHNcjs.substituteChord.call(void 0, this.#data, this.#resolveKey(key), opts);
2754
2761
  }
2755
2762
  /**
2756
2763
  * The modal-interchange palette of the chord's key: the parallel mode's
@@ -2775,7 +2782,7 @@ var Chord = class _Chord {
2775
2782
  * ```
2776
2783
  */
2777
2784
  modalInterchange(key) {
2778
- return _chunk5KW7DNCJcjs.modalInterchangePalette.call(void 0, this.#resolveKey(key));
2785
+ return _chunkB2PW6EHNcjs.modalInterchangePalette.call(void 0, this.#resolveKey(key));
2779
2786
  }
2780
2787
  /**
2781
2788
  * The chord rendered as a lead-sheet symbol (e.g. `'Cmaj7'`, `'F#m7'`, `'C/G'`).
@@ -2790,7 +2797,7 @@ var Chord = class _Chord {
2790
2797
  * ```
2791
2798
  */
2792
2799
  symbol(opts) {
2793
- return _chunkYPB3A3EYcjs.formatChordSymbol.call(void 0, this.#data, opts);
2800
+ return _chunk3R3QVKY5cjs.formatChordSymbol.call(void 0, this.#data, opts);
2794
2801
  }
2795
2802
  /**
2796
2803
  * Realize the chord as one MIDI pitch per voice, ascending.
@@ -2804,7 +2811,7 @@ var Chord = class _Chord {
2804
2811
  */
2805
2812
  voice(opts) {
2806
2813
  const key = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _24 => _24.key]), () => ( this.#key));
2807
- return _chunkRVS4G4MRcjs.voiceChord.call(void 0, this.#data, key === void 0 ? opts : { ...opts, key });
2814
+ return _chunk76ZBTRG2cjs.voiceChord.call(void 0, this.#data, key === void 0 ? opts : { ...opts, key });
2808
2815
  }
2809
2816
  /**
2810
2817
  * Realize the chord as a single styled voicing (`close`, `drop2`, `drop3`,
@@ -2814,7 +2821,7 @@ var Chord = class _Chord {
2814
2821
  * @returns MIDI pitches, ascending.
2815
2822
  */
2816
2823
  styledVoicing(opts) {
2817
- return _chunkRVS4G4MRcjs.voiceChordStyled.call(void 0, this.#data, opts);
2824
+ return _chunk76ZBTRG2cjs.voiceChordStyled.call(void 0, this.#data, opts);
2818
2825
  }
2819
2826
  /**
2820
2827
  * The negative-harmony mirror of the chord about the key's tonic–dominant
@@ -2827,7 +2834,7 @@ var Chord = class _Chord {
2827
2834
  */
2828
2835
  negativeHarmony(key) {
2829
2836
  const resolved = this.#resolveKey(key);
2830
- return new _Chord(_chunk5KW7DNCJcjs.negativeHarmonyMirror.call(void 0, this.#data, resolved), resolved);
2837
+ return new _Chord(_chunkB2PW6EHNcjs.negativeHarmonyMirror.call(void 0, this.#data, resolved), resolved);
2831
2838
  }
2832
2839
  /**
2833
2840
  * The V7 that tonicizes this chord: a dominant seventh a perfect fifth above
@@ -2845,7 +2852,7 @@ var Chord = class _Chord {
2845
2852
  * ```
2846
2853
  */
2847
2854
  secondaryDominant() {
2848
- return new _Chord(_chunkQ6R3QAZDcjs.secondaryDominantOf.call(void 0, this.#given), this.#key);
2855
+ return new _Chord(_chunkIFZDWIKMcjs.secondaryDominantOf.call(void 0, this.#given), this.#key);
2849
2856
  }
2850
2857
  /**
2851
2858
  * The n-th inversion: a copy whose bass is the chord tone `n` steps above the
@@ -2864,14 +2871,14 @@ var Chord = class _Chord {
2864
2871
  const intervals = data.intervals;
2865
2872
  const length = intervals.length;
2866
2873
  if (length === 0) {
2867
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)("cannot invert a chord with no intervals");
2874
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)("cannot invert a chord with no intervals");
2868
2875
  }
2869
2876
  const index = (n % length + length) % length;
2870
2877
  delete data.bassSpelling;
2871
2878
  if (index === 0) {
2872
2879
  delete data.bassPc;
2873
2880
  } else {
2874
- data.bassPc = _chunkXKSO2V5Icjs.pitchClassOf.call(void 0, data.rootPc + (_nullishCoalesce(intervals[index], () => ( 0))));
2881
+ data.bassPc = _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, data.rootPc + (_nullishCoalesce(intervals[index], () => ( 0))));
2875
2882
  }
2876
2883
  return new _Chord(data, this.#key);
2877
2884
  }
@@ -2892,8 +2899,8 @@ var Chord = class _Chord {
2892
2899
  * ```
2893
2900
  */
2894
2901
  transpose(semitones) {
2895
- const moved = _chunkYPB3A3EYcjs.transposeChord.call(void 0, this.#given, semitones);
2896
- const { rootSpelling, bassSpelling, toneSpellings } = _chunkYPB3A3EYcjs.transposeChordSpellings.call(void 0,
2902
+ const moved = _chunk3R3QVKY5cjs.transposeChord.call(void 0, this.#given, semitones);
2903
+ const { rootSpelling, bassSpelling, toneSpellings } = _chunk3R3QVKY5cjs.transposeChordSpellings.call(void 0,
2897
2904
  this.#given,
2898
2905
  semitones
2899
2906
  );
@@ -2928,8 +2935,8 @@ var Chord = class _Chord {
2928
2935
  * ```
2929
2936
  */
2930
2937
  transposeBy(interval) {
2931
- const spelled = _chunkXKSO2V5Icjs.toSpelledInterval.call(void 0, interval);
2932
- const moved = _chunkYPB3A3EYcjs.transposeChord.call(void 0, this.#given, spelled.semitones);
2938
+ const spelled = _chunkS5BKZZGMcjs.toSpelledInterval.call(void 0, interval);
2939
+ const moved = _chunk3R3QVKY5cjs.transposeChord.call(void 0, this.#given, spelled.semitones);
2933
2940
  const rootSpelling = transposeHintByInterval(this.#given.rootSpelling, spelled);
2934
2941
  const bassSpelling = transposeHintByInterval(this.#given.bassSpelling, spelled);
2935
2942
  const toneSpellings = transposeToneHintsByInterval(this.#given.toneSpellings, spelled);
@@ -2955,7 +2962,7 @@ var Chord = class _Chord {
2955
2962
  * @returns The matching scales.
2956
2963
  */
2957
2964
  scales() {
2958
- return _chunkR7B5N2JKcjs.chordScales.call(void 0, this.#data);
2965
+ return _chunkPM4XJE2Ycjs.chordScales.call(void 0, this.#data);
2959
2966
  }
2960
2967
  /**
2961
2968
  * The scales that fit over this chord, each with the tones it does not state
@@ -2977,7 +2984,7 @@ var Chord = class _Chord {
2977
2984
  * ```
2978
2985
  */
2979
2986
  scaleReport(limit) {
2980
- return _chunkR7B5N2JKcjs.chordScaleReport.call(void 0, this.#data, limit);
2987
+ return _chunkPM4XJE2Ycjs.chordScaleReport.call(void 0, this.#data, limit);
2981
2988
  }
2982
2989
  /**
2983
2990
  * The available tensions (usable non-chord, non-avoid scale tones) of a
@@ -3002,7 +3009,7 @@ var Chord = class _Chord {
3002
3009
  * ```
3003
3010
  */
3004
3011
  tensions(scaleName, opts) {
3005
- return _chunkR7B5N2JKcjs.availableTensions.call(void 0, this.#data, scaleName, opts);
3012
+ return _chunkPM4XJE2Ycjs.availableTensions.call(void 0, this.#data, scaleName, opts);
3006
3013
  }
3007
3014
  /**
3008
3015
  * The avoid notes (scale tones a semitone above a chord tone) of a scale
@@ -3026,7 +3033,7 @@ var Chord = class _Chord {
3026
3033
  * ```
3027
3034
  */
3028
3035
  avoidNotes(scaleName, opts) {
3029
- return _chunkR7B5N2JKcjs.avoidNotes.call(void 0, this.#data, scaleName, opts);
3036
+ return _chunkPM4XJE2Ycjs.avoidNotes.call(void 0, this.#data, scaleName, opts);
3030
3037
  }
3031
3038
  /**
3032
3039
  * Spell the chord tones with letter names, root first, in the key's spelling.
@@ -3057,17 +3064,17 @@ var Chord = class _Chord {
3057
3064
  if (resolved === void 0) {
3058
3065
  const root = data.rootSpelling;
3059
3066
  if (root === void 0) {
3060
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(
3067
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
3061
3068
  "chord has no key context and no root spelling; pass a Key, attach one with withKey(), or build the chord from a symbol"
3062
3069
  );
3063
3070
  }
3064
- tones = _chunkYPB3A3EYcjs.spellChordFromRoot.call(void 0, data, root);
3071
+ tones = _chunk3R3QVKY5cjs.spellChordFromRoot.call(void 0, data, root);
3065
3072
  } else {
3066
- tones = _chunkYPB3A3EYcjs.spellChord.call(void 0, data, resolved.tonic.data, resolved);
3073
+ tones = _chunk3R3QVKY5cjs.spellChord.call(void 0, data, resolved.tonic.data, resolved);
3067
3074
  }
3068
3075
  const bassPc = data.bassPc;
3069
3076
  const bass = data.bassSpelling;
3070
- if (bassPc !== void 0 && bass !== void 0 && !tones.some((tone) => _chunkXKSO2V5Icjs.pitchClassOf.call(void 0, _chunkXKSO2V5Icjs.noteToPitchClass.call(void 0, tone)) === _chunkXKSO2V5Icjs.pitchClassOf.call(void 0, bassPc))) {
3077
+ if (bassPc !== void 0 && bass !== void 0 && !tones.some((tone) => _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, _chunkS5BKZZGMcjs.noteToPitchClass.call(void 0, tone)) === _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, bassPc))) {
3071
3078
  tones = [...tones, { letter: bass.letter, alter: bass.alter }];
3072
3079
  }
3073
3080
  return tones.map((note) => new Note(note));
@@ -3101,7 +3108,7 @@ var Chord = class _Chord {
3101
3108
  * ```
3102
3109
  */
3103
3110
  span(startBeat) {
3104
- return _chunkYPB3A3EYcjs.spanFromChord.call(void 0, this.#data, startBeat);
3111
+ return _chunk3R3QVKY5cjs.spanFromChord.call(void 0, this.#data, startBeat);
3105
3112
  }
3106
3113
  /**
3107
3114
  * Whether another chord has the same root, quality, intervals, and bass.
@@ -3141,7 +3148,7 @@ var Chord = class _Chord {
3141
3148
  assertKeyArgument(key, "chord key");
3142
3149
  const resolved = key === void 0 ? this.#key : toKey(key);
3143
3150
  if (resolved === void 0) {
3144
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(
3151
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
3145
3152
  "chord has no key context; pass a Key or attach one with withKey()"
3146
3153
  );
3147
3154
  }
@@ -3151,11 +3158,11 @@ var Chord = class _Chord {
3151
3158
 
3152
3159
  // src/model/key.ts
3153
3160
  function detectedKeyMatch(match) {
3154
- const key = { ..._chunkYPB3A3EYcjs.resolveKey.call(void 0, match.key), variant: match.variant };
3161
+ const key = { ..._chunk3R3QVKY5cjs.resolveKey.call(void 0, match.key), variant: match.variant };
3155
3162
  return { ...match, key: toKey(key) };
3156
3163
  }
3157
3164
  function scaleWord(mask, isMinor) {
3158
- const name = _chunkYPB3A3EYcjs.scaleNameOfMask.call(void 0, mask);
3165
+ const name = _chunk3R3QVKY5cjs.scaleNameOfMask.call(void 0, mask);
3159
3166
  if (name === void 0) {
3160
3167
  return isMinor ? "minor" : "major";
3161
3168
  }
@@ -3170,13 +3177,13 @@ function scaleWord(mask, isMinor) {
3170
3177
  var HEPTATONIC_DEGREES = 7;
3171
3178
  var REFERENCE_TONIC = { letter: 0, alter: 0 };
3172
3179
  function bareInterval(from, to) {
3173
- return _chunkXKSO2V5Icjs.spelledInterval.call(void 0,
3180
+ return _chunkS5BKZZGMcjs.spelledInterval.call(void 0,
3174
3181
  { letter: from.letter, alter: from.alter },
3175
3182
  { letter: to.letter, alter: to.alter }
3176
3183
  );
3177
3184
  }
3178
3185
  function spelledTonicFor(scale) {
3179
- return new Note(_chunkYPB3A3EYcjs.resolveKey.call(void 0, scale).tonic);
3186
+ return new Note(_chunk3R3QVKY5cjs.resolveKey.call(void 0, scale).tonic);
3180
3187
  }
3181
3188
  function isNoteInstance(value) {
3182
3189
  if (value === null || typeof value !== "object") {
@@ -3207,28 +3214,28 @@ var Key = class _Key {
3207
3214
  */
3208
3215
  constructor(scale, tonic, variant) {
3209
3216
  assertDataObject(scale, "scale");
3210
- _chunkXKSO2V5Icjs.assertInteger.call(void 0, scale.rootPc, "scale.rootPc");
3211
- _chunkXKSO2V5Icjs.assertInteger.call(void 0, scale.modeMask12, "scale.modeMask12", 1, 4095);
3217
+ _chunkS5BKZZGMcjs.assertInteger.call(void 0, scale.rootPc, "scale.rootPc");
3218
+ _chunkS5BKZZGMcjs.assertInteger.call(void 0, scale.modeMask12, "scale.modeMask12", 1, 4095);
3212
3219
  if ((scale.modeMask12 & 1) === 0) {
3213
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)("scale.modeMask12 must include the tonic (bit 0)");
3220
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)("scale.modeMask12 must include the tonic (bit 0)");
3214
3221
  }
3215
3222
  if (!isNoteInstance(tonic)) {
3216
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(
3223
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
3217
3224
  `tonic must be the class API's Note; received ${describeTonic(tonic)}; wrap plain note data with Note.fromData, or omit the tonic to have one chosen`
3218
3225
  );
3219
3226
  }
3220
- const rootPc = _chunkXKSO2V5Icjs.pitchClassOf.call(void 0, scale.rootPc);
3227
+ const rootPc = _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, scale.rootPc);
3221
3228
  if (tonic.pitchClass !== rootPc) {
3222
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(
3229
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
3223
3230
  `tonic ${tonic.name} does not match the scale root pitch class ${rootPc}; pass a tonic that spells the scale root, or omit it to have one chosen`
3224
3231
  );
3225
3232
  }
3226
3233
  if (variant !== void 0) {
3227
- _chunkYPB3A3EYcjs.assertKeyVariant.call(void 0, variant, scale.modeMask12);
3234
+ _chunk3R3QVKY5cjs.assertKeyVariant.call(void 0, variant, scale.modeMask12);
3228
3235
  }
3229
3236
  this.#scale = { rootPc, modeMask12: scale.modeMask12 };
3230
3237
  this.#tonic = tonic;
3231
- this.#variant = _nullishCoalesce(variant, () => ( _chunkYPB3A3EYcjs.variantOfMask.call(void 0, scale.modeMask12)));
3238
+ this.#variant = _nullishCoalesce(variant, () => ( _chunk3R3QVKY5cjs.variantOfMask.call(void 0, scale.modeMask12)));
3232
3239
  }
3233
3240
  /** Preserve detection metadata while replacing its plain key with this API's Key. */
3234
3241
  static #fromMatch(match) {
@@ -3255,9 +3262,9 @@ var Key = class _Key {
3255
3262
  static major(root) {
3256
3263
  if (typeof root === "string") {
3257
3264
  const tonic = Note.parse(root);
3258
- return new _Key(_chunkYPB3A3EYcjs.majorKey.call(void 0, tonic.pitchClass), tonic);
3265
+ return new _Key(_chunk3R3QVKY5cjs.majorKey.call(void 0, tonic.pitchClass), tonic);
3259
3266
  }
3260
- const scale = _chunkYPB3A3EYcjs.majorKey.call(void 0, root);
3267
+ const scale = _chunk3R3QVKY5cjs.majorKey.call(void 0, root);
3261
3268
  return new _Key(scale, spelledTonicFor(scale));
3262
3269
  }
3263
3270
  /**
@@ -3271,9 +3278,9 @@ var Key = class _Key {
3271
3278
  static minor(root) {
3272
3279
  if (typeof root === "string") {
3273
3280
  const tonic = Note.parse(root);
3274
- return new _Key(_chunkYPB3A3EYcjs.minorKey.call(void 0, tonic.pitchClass), tonic);
3281
+ return new _Key(_chunk3R3QVKY5cjs.minorKey.call(void 0, tonic.pitchClass), tonic);
3275
3282
  }
3276
- const scale = _chunkYPB3A3EYcjs.minorKey.call(void 0, root);
3283
+ const scale = _chunk3R3QVKY5cjs.minorKey.call(void 0, root);
3277
3284
  return new _Key(scale, spelledTonicFor(scale));
3278
3285
  }
3279
3286
  /**
@@ -3289,9 +3296,9 @@ var Key = class _Key {
3289
3296
  static named(name, root) {
3290
3297
  if (typeof root === "string") {
3291
3298
  const tonic = Note.parse(root);
3292
- return new _Key(_chunkYPB3A3EYcjs.scaleByName.call(void 0, name, tonic.pitchClass), tonic);
3299
+ return new _Key(_chunk3R3QVKY5cjs.scaleByName.call(void 0, name, tonic.pitchClass), tonic);
3293
3300
  }
3294
- const scale = _chunkYPB3A3EYcjs.scaleByName.call(void 0, name, _chunkXKSO2V5Icjs.pitchClassOf.call(void 0, root));
3301
+ const scale = _chunk3R3QVKY5cjs.scaleByName.call(void 0, name, _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, root));
3295
3302
  return new _Key(scale, spelledTonicFor(scale));
3296
3303
  }
3297
3304
  /**
@@ -3326,7 +3333,7 @@ var Key = class _Key {
3326
3333
  * ```
3327
3334
  */
3328
3335
  static parse(text, opts) {
3329
- return _chunkXKSO2V5Icjs.unwrapParse.call(void 0, _Key.tryParse(text, opts));
3336
+ return _chunkS5BKZZGMcjs.unwrapParse.call(void 0, _Key.tryParse(text, opts));
3330
3337
  }
3331
3338
  /**
3332
3339
  * Parse a key name, reporting failure instead of throwing it.
@@ -3348,7 +3355,7 @@ var Key = class _Key {
3348
3355
  * ```
3349
3356
  */
3350
3357
  static tryParse(text, opts) {
3351
- const parsed = _chunkYPB3A3EYcjs.tryResolveKeyName.call(void 0, text, opts);
3358
+ const parsed = _chunk3R3QVKY5cjs.tryResolveKeyName.call(void 0, text, opts);
3352
3359
  return parsed.ok ? {
3353
3360
  ok: true,
3354
3361
  value: new _Key(parsed.value.scale, new Note(parsed.value.tonic), parsed.value.variant)
@@ -3375,7 +3382,7 @@ var Key = class _Key {
3375
3382
  * ```
3376
3383
  */
3377
3384
  static fromFifths(fifths, mode = "major") {
3378
- return _Key.#fromSpelled(_chunkYPB3A3EYcjs.keyFromFifths.call(void 0, fifths, mode));
3385
+ return _Key.#fromSpelled(_chunk3R3QVKY5cjs.keyFromFifths.call(void 0, fifths, mode));
3379
3386
  }
3380
3387
  /**
3381
3388
  * Wrap an existing `KeyScale`, synthesizing a spelled tonic when none is
@@ -3398,7 +3405,7 @@ var Key = class _Key {
3398
3405
  * @throws If the given tonic is not the scale's root pitch class.
3399
3406
  */
3400
3407
  static of(key, tonic) {
3401
- const resolved = _chunkYPB3A3EYcjs.resolveKey.call(void 0, key);
3408
+ const resolved = _chunk3R3QVKY5cjs.resolveKey.call(void 0, key);
3402
3409
  return new _Key(resolved.scale, _nullishCoalesce(tonic, () => ( new Note(resolved.tonic))), resolved.variant);
3403
3410
  }
3404
3411
  /**
@@ -3440,7 +3447,7 @@ var Key = class _Key {
3440
3447
  * @returns Ranked key matches (may be empty).
3441
3448
  */
3442
3449
  static detectMatches(pitches, opts) {
3443
- return _chunkQ6R3QAZDcjs.detectKey.call(void 0, pitches, opts).map((match) => _Key.#fromMatch(match));
3450
+ return _chunkIFZDWIKMcjs.detectKey.call(void 0, pitches, opts).map((match) => _Key.#fromMatch(match));
3444
3451
  }
3445
3452
  /**
3446
3453
  * The single best key interpretation of a pitch set.
@@ -3455,7 +3462,7 @@ var Key = class _Key {
3455
3462
  * ```
3456
3463
  */
3457
3464
  static detectBest(pitches, opts) {
3458
- const best = _chunkQ6R3QAZDcjs.detectKeyBest.call(void 0, pitches, opts);
3465
+ const best = _chunkIFZDWIKMcjs.detectKeyBest.call(void 0, pitches, opts);
3459
3466
  return best === null ? null : _Key.#fromMatch(best).key;
3460
3467
  }
3461
3468
  /**
@@ -3485,7 +3492,7 @@ var Key = class _Key {
3485
3492
  }
3486
3493
  /** Whether the scale has a minor third and no major third. */
3487
3494
  get isMinor() {
3488
- return _chunkQ6R3QAZDcjs.isMinorKey.call(void 0, this.#scale);
3495
+ return _chunkIFZDWIKMcjs.isMinorKey.call(void 0, this.#scale);
3489
3496
  }
3490
3497
  /**
3491
3498
  * The key signature as a signed count of sharps (positive) or flats
@@ -3503,7 +3510,7 @@ var Key = class _Key {
3503
3510
  * ```
3504
3511
  */
3505
3512
  get fifths() {
3506
- return _chunkYPB3A3EYcjs.keySignatureFifths.call(void 0, this.#tonic.data, this.#scale);
3513
+ return _chunk3R3QVKY5cjs.keySignatureFifths.call(void 0, this.#tonic.data, this.#scale);
3507
3514
  }
3508
3515
  /**
3509
3516
  * The built-in scale this key's mode mask is, or undefined when no built-in
@@ -3527,7 +3534,7 @@ var Key = class _Key {
3527
3534
  */
3528
3535
  get scaleName() {
3529
3536
  const mask = this.#scale.modeMask12;
3530
- return Object.keys(_chunkYPB3A3EYcjs.NAMED_SCALES).find((name) => _chunkYPB3A3EYcjs.NAMED_SCALES[name] === mask);
3537
+ return Object.keys(_chunk3R3QVKY5cjs.NAMED_SCALES).find((name) => _chunk3R3QVKY5cjs.NAMED_SCALES[name] === mask);
3531
3538
  }
3532
3539
  /** A copy of the underlying plain key data. */
3533
3540
  get data() {
@@ -3559,8 +3566,8 @@ var Key = class _Key {
3559
3566
  * ```
3560
3567
  */
3561
3568
  pitchClasses(opts) {
3562
- const order = _optionalChain([opts, 'optionalAccess', _31 => _31.order]) === void 0 ? "degree" : _chunkXKSO2V5Icjs.assertOneOf.call(void 0, opts.order, ["degree", "ascending"], "pitch-class order");
3563
- return order === "ascending" ? _chunkYPB3A3EYcjs.diatonicPitchClasses.call(void 0, this.#scale) : _chunkYPB3A3EYcjs.scaleTonesInDegreeOrder.call(void 0, this.#scale);
3569
+ const order = _optionalChain([opts, 'optionalAccess', _31 => _31.order]) === void 0 ? "degree" : _chunkS5BKZZGMcjs.assertOneOf.call(void 0, opts.order, ["degree", "ascending"], "pitch-class order");
3570
+ return order === "ascending" ? _chunk3R3QVKY5cjs.diatonicPitchClasses.call(void 0, this.#scale) : _chunk3R3QVKY5cjs.scaleTonesInDegreeOrder.call(void 0, this.#scale);
3564
3571
  }
3565
3572
  /**
3566
3573
  * The kind of pitch organisation this key's scale belongs to: the
@@ -3584,7 +3591,7 @@ var Key = class _Key {
3584
3591
  * ```
3585
3592
  */
3586
3593
  system() {
3587
- return _chunkYPB3A3EYcjs.scaleSystemOf.call(void 0, this.#scale);
3594
+ return _chunk3R3QVKY5cjs.scaleSystemOf.call(void 0, this.#scale);
3588
3595
  }
3589
3596
  /**
3590
3597
  * Whether functional (Roman-numeral) analysis describes this key.
@@ -3604,7 +3611,7 @@ var Key = class _Key {
3604
3611
  * ```
3605
3612
  */
3606
3613
  supportsFunctionalHarmony() {
3607
- return _chunkYPB3A3EYcjs.supportsFunctionalHarmony.call(void 0, this.#scale);
3614
+ return _chunk3R3QVKY5cjs.supportsFunctionalHarmony.call(void 0, this.#scale);
3608
3615
  }
3609
3616
  /**
3610
3617
  * The relative key: for a plain major or minor key, the same key signature
@@ -3628,7 +3635,7 @@ var Key = class _Key {
3628
3635
  * ```
3629
3636
  */
3630
3637
  relative() {
3631
- return _Key.#fromSpelled(_chunkYPB3A3EYcjs.relativeKeyOf.call(void 0, this.#tonic.data, this.#scale));
3638
+ return _Key.#fromSpelled(_chunk3R3QVKY5cjs.relativeKeyOf.call(void 0, this.#tonic.data, this.#scale));
3632
3639
  }
3633
3640
  /**
3634
3641
  * The parallel key: the other mode on the same tonic, which keeps this key's
@@ -3642,7 +3649,7 @@ var Key = class _Key {
3642
3649
  * ```
3643
3650
  */
3644
3651
  parallel() {
3645
- return _Key.#fromSpelled(_chunkYPB3A3EYcjs.parallelKeyOf.call(void 0, this.#tonic.data, this.#scale));
3652
+ return _Key.#fromSpelled(_chunk3R3QVKY5cjs.parallelKeyOf.call(void 0, this.#tonic.data, this.#scale));
3646
3653
  }
3647
3654
  /**
3648
3655
  * The dominant key: the key a fifth above, in the mode this key's third names.
@@ -3659,7 +3666,7 @@ var Key = class _Key {
3659
3666
  * ```
3660
3667
  */
3661
3668
  dominantKey() {
3662
- return _Key.#fromSpelled(_chunkYPB3A3EYcjs.dominantKeyOf.call(void 0, this.#tonic.data, this.#scale));
3669
+ return _Key.#fromSpelled(_chunk3R3QVKY5cjs.dominantKeyOf.call(void 0, this.#tonic.data, this.#scale));
3663
3670
  }
3664
3671
  /**
3665
3672
  * The subdominant key: the key a fifth below, in the mode this key's third
@@ -3675,7 +3682,7 @@ var Key = class _Key {
3675
3682
  * ```
3676
3683
  */
3677
3684
  subdominantKey() {
3678
- return _Key.#fromSpelled(_chunkYPB3A3EYcjs.subdominantKeyOf.call(void 0, this.#tonic.data, this.#scale));
3685
+ return _Key.#fromSpelled(_chunk3R3QVKY5cjs.subdominantKeyOf.call(void 0, this.#tonic.data, this.#scale));
3679
3686
  }
3680
3687
  /**
3681
3688
  * The same sounding key written the other way round the circle of fifths.
@@ -3693,7 +3700,7 @@ var Key = class _Key {
3693
3700
  * ```
3694
3701
  */
3695
3702
  enharmonic() {
3696
- const other = _chunkYPB3A3EYcjs.enharmonicKeyOf.call(void 0, this.#tonic.data, this.#scale);
3703
+ const other = _chunk3R3QVKY5cjs.enharmonicKeyOf.call(void 0, this.#tonic.data, this.#scale);
3697
3704
  return other === null ? null : _Key.#fromSpelled(other);
3698
3705
  }
3699
3706
  /**
@@ -3724,7 +3731,7 @@ var Key = class _Key {
3724
3731
  * ```
3725
3732
  */
3726
3733
  relatedKeys() {
3727
- return _chunkYPB3A3EYcjs.relatedKeysOf.call(void 0, this.#tonic.data, this.#scale).map(({ relation, ...spelled }) => ({
3734
+ return _chunk3R3QVKY5cjs.relatedKeysOf.call(void 0, this.#tonic.data, this.#scale).map(({ relation, ...spelled }) => ({
3728
3735
  relation,
3729
3736
  key: _Key.#fromSpelled(spelled)
3730
3737
  }));
@@ -3751,7 +3758,7 @@ var Key = class _Key {
3751
3758
  * ```
3752
3759
  */
3753
3760
  relationTo(other) {
3754
- return _chunkYPB3A3EYcjs.keyRelationBetween.call(void 0, this.toJSON(), other.toJSON());
3761
+ return _chunk3R3QVKY5cjs.keyRelationBetween.call(void 0, this.toJSON(), other.toJSON());
3755
3762
  }
3756
3763
  /**
3757
3764
  * The chords a modulation from this key into another can pivot on.
@@ -3778,7 +3785,7 @@ var Key = class _Key {
3778
3785
  */
3779
3786
  pivotsTo(other) {
3780
3787
  assertKeyArgument(other, "key");
3781
- return _chunkQ6R3QAZDcjs.pivotChords.call(void 0, this.#scale, other).map(({ chord, romanFrom, romanTo }) => ({
3788
+ return _chunkIFZDWIKMcjs.pivotChords.call(void 0, this.#scale, other).map(({ chord, romanFrom, romanTo }) => ({
3782
3789
  chord: new Chord(chord, this),
3783
3790
  romanFrom,
3784
3791
  romanTo
@@ -3800,7 +3807,7 @@ var Key = class _Key {
3800
3807
  */
3801
3808
  degree(n) {
3802
3809
  const notes = this.notes();
3803
- _chunkXKSO2V5Icjs.assertInteger.call(void 0, n, "degree", 1, notes.length);
3810
+ _chunkS5BKZZGMcjs.assertInteger.call(void 0, n, "degree", 1, notes.length);
3804
3811
  return _nullishCoalesce(notes[n - 1], () => ( this.#tonic));
3805
3812
  }
3806
3813
  /**
@@ -3851,12 +3858,12 @@ var Key = class _Key {
3851
3858
  */
3852
3859
  keyHavingTonicAsDegree(n, mode) {
3853
3860
  const resolved = _nullishCoalesce(mode, () => ( (this.isMinor ? "minor" : "major")));
3854
- const reference = _chunkYPB3A3EYcjs.spellScale.call(void 0, REFERENCE_TONIC, resolved === "minor" ? _chunkYPB3A3EYcjs.minorKey.call(void 0, 0) : _chunkYPB3A3EYcjs.majorKey.call(void 0, 0));
3855
- _chunkXKSO2V5Icjs.assertInteger.call(void 0, n, "degree", 1, reference.length);
3861
+ const reference = _chunk3R3QVKY5cjs.spellScale.call(void 0, REFERENCE_TONIC, resolved === "minor" ? _chunk3R3QVKY5cjs.minorKey.call(void 0, 0) : _chunk3R3QVKY5cjs.majorKey.call(void 0, 0));
3862
+ _chunkS5BKZZGMcjs.assertInteger.call(void 0, n, "degree", 1, reference.length);
3856
3863
  const first = reference[0];
3857
- const step = _chunkXKSO2V5Icjs.spelledInterval.call(void 0, first, reference[n - 1]);
3864
+ const step = _chunkS5BKZZGMcjs.spelledInterval.call(void 0, first, reference[n - 1]);
3858
3865
  const tonic = new Note(
3859
- _chunkXKSO2V5Icjs.transposeByInterval.call(void 0, this.#tonic.data, {
3866
+ _chunkS5BKZZGMcjs.transposeByInterval.call(void 0, this.#tonic.data, {
3860
3867
  number: step.number,
3861
3868
  quality: step.quality,
3862
3869
  // Negating a zero span yields -0, which compares unequal to 0.
@@ -3876,7 +3883,7 @@ var Key = class _Key {
3876
3883
  */
3877
3884
  static #modeOn(mode, tonic) {
3878
3885
  const rootPc = tonic.pitchClass;
3879
- return new _Key(mode === "minor" ? _chunkYPB3A3EYcjs.minorKey.call(void 0, rootPc) : _chunkYPB3A3EYcjs.majorKey.call(void 0, rootPc), tonic).#asWritten();
3886
+ return new _Key(mode === "minor" ? _chunk3R3QVKY5cjs.minorKey.call(void 0, rootPc) : _chunk3R3QVKY5cjs.majorKey.call(void 0, rootPc), tonic).#asWritten();
3880
3887
  }
3881
3888
  /**
3882
3889
  * The mode a scale degree implies, read off its diatonic triad. Scales that
@@ -3887,7 +3894,7 @@ var Key = class _Key {
3887
3894
  if (this.pitchClasses().length !== HEPTATONIC_DEGREES) {
3888
3895
  return this.isMinor ? "minor" : "major";
3889
3896
  }
3890
- const { quality } = _chunkYPB3A3EYcjs.diatonicTriad.call(void 0, n, this.#scale);
3897
+ const { quality } = _chunk3R3QVKY5cjs.diatonicTriad.call(void 0, n, this.#scale);
3891
3898
  return quality === "min" || quality === "dim" ? "minor" : "major";
3892
3899
  }
3893
3900
  /**
@@ -3911,10 +3918,10 @@ var Key = class _Key {
3911
3918
  * ```
3912
3919
  */
3913
3920
  transposeBy(interval) {
3914
- const step = _chunkXKSO2V5Icjs.toSpelledInterval.call(void 0, interval);
3921
+ const step = _chunkS5BKZZGMcjs.toSpelledInterval.call(void 0, interval);
3915
3922
  return new _Key(
3916
- { rootPc: _chunkXKSO2V5Icjs.pitchClassOf.call(void 0, this.#scale.rootPc + step.semitones), modeMask12: this.#scale.modeMask12 },
3917
- new Note(_chunkXKSO2V5Icjs.transposeByInterval.call(void 0, this.#tonic.data, step)),
3923
+ { rootPc: _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, this.#scale.rootPc + step.semitones), modeMask12: this.#scale.modeMask12 },
3924
+ new Note(_chunkS5BKZZGMcjs.transposeByInterval.call(void 0, this.#tonic.data, step)),
3918
3925
  this.#variant
3919
3926
  );
3920
3927
  }
@@ -3962,8 +3969,8 @@ var Key = class _Key {
3962
3969
  * ```
3963
3970
  */
3964
3971
  transpose(semitones) {
3965
- _chunkXKSO2V5Icjs.assertFiniteNumber.call(void 0, semitones, "semitones");
3966
- const rootPc = _chunkXKSO2V5Icjs.pitchClassOf.call(void 0, this.#scale.rootPc + Math.round(semitones));
3972
+ _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, semitones, "semitones");
3973
+ const rootPc = _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, this.#scale.rootPc + Math.round(semitones));
3967
3974
  const scale = { rootPc, modeMask12: this.#scale.modeMask12 };
3968
3975
  return new _Key(scale, this.#tonic.transpose(semitones), this.#variant).#asWritten();
3969
3976
  }
@@ -3987,9 +3994,9 @@ var Key = class _Key {
3987
3994
  if (this.#isWritten()) {
3988
3995
  return this;
3989
3996
  }
3990
- const other = _chunkYPB3A3EYcjs.enharmonicKeyOf.call(void 0, this.#tonic.data, this.#scale);
3997
+ const other = _chunk3R3QVKY5cjs.enharmonicKeyOf.call(void 0, this.#tonic.data, this.#scale);
3991
3998
  const respelled = other === null ? null : new Note(other.tonic);
3992
- return respelled === null || respelled.pitchClass !== _chunkXKSO2V5Icjs.pitchClassOf.call(void 0, this.#scale.rootPc) ? this : new _Key(this.#scale, respelled, this.#variant);
3999
+ return respelled === null || respelled.pitchClass !== _chunkS5BKZZGMcjs.pitchClassOf.call(void 0, this.#scale.rootPc) ? this : new _Key(this.#scale, respelled, this.#variant);
3993
4000
  }
3994
4001
  /**
3995
4002
  * Whether this key is spelled the way keys are actually written, which is
@@ -4003,7 +4010,7 @@ var Key = class _Key {
4003
4010
  * drawn from the mode itself disagree.
4004
4011
  */
4005
4012
  #isWritten() {
4006
- return _chunkYPB3A3EYcjs.isWrittenTonic.call(void 0, this.#tonic.data, this.#scale);
4013
+ return _chunk3R3QVKY5cjs.isWrittenTonic.call(void 0, this.#tonic.data, this.#scale);
4007
4014
  }
4008
4015
  /**
4009
4016
  * The key a transposing instrument's part is written in, for this key at
@@ -4039,7 +4046,7 @@ var Key = class _Key {
4039
4046
  * ```
4040
4047
  */
4041
4048
  forInstrument(instrument) {
4042
- const tonic = new Note(_chunkRVS4G4MRcjs.toWrittenPitch.call(void 0, this.#tonic.data, instrument));
4049
+ const tonic = new Note(_chunk76ZBTRG2cjs.toWrittenPitch.call(void 0, this.#tonic.data, instrument));
4043
4050
  return new _Key(
4044
4051
  { rootPc: tonic.pitchClass, modeMask12: this.#scale.modeMask12 },
4045
4052
  tonic,
@@ -4052,7 +4059,7 @@ var Key = class _Key {
4052
4059
  * @returns Spelled octave-less notes in scale-degree order.
4053
4060
  */
4054
4061
  notes() {
4055
- return _chunkYPB3A3EYcjs.spellScale.call(void 0, this.#tonic.data, this.#scale).map((note) => new Note(note));
4062
+ return _chunk3R3QVKY5cjs.spellScale.call(void 0, this.#tonic.data, this.#scale).map((note) => new Note(note));
4056
4063
  }
4057
4064
  /**
4058
4065
  * Alias of {@link Key.notes}.
@@ -4106,8 +4113,8 @@ var Key = class _Key {
4106
4113
  * ```
4107
4114
  */
4108
4115
  spellPitchClasses(pcs, tonic) {
4109
- const anchor = tonic === void 0 ? this.#tonic.data : _chunkXKSO2V5Icjs.toNoteData.call(void 0, tonic);
4110
- return _chunkYPB3A3EYcjs.spellPitchClasses.call(void 0, [...pcs], anchor, this.#scale).map((note) => new Note(note));
4116
+ const anchor = tonic === void 0 ? this.#tonic.data : _chunkS5BKZZGMcjs.toNoteData.call(void 0, tonic);
4117
+ return _chunk3R3QVKY5cjs.spellPitchClasses.call(void 0, [...pcs], anchor, this.#scale).map((note) => new Note(note));
4111
4118
  }
4112
4119
  /**
4113
4120
  * Build a chord on a scale degree, carrying this key as context.
@@ -4126,7 +4133,7 @@ var Key = class _Key {
4126
4133
  * an explicit `quality` for those.
4127
4134
  */
4128
4135
  chord(degree, quality) {
4129
- const data = quality === void 0 ? _chunkYPB3A3EYcjs.diatonicTriad.call(void 0, degree, this.#scale) : _chunkYPB3A3EYcjs.chordFromDegree.call(void 0, degree, quality, this.#scale);
4136
+ const data = quality === void 0 ? _chunk3R3QVKY5cjs.diatonicTriad.call(void 0, degree, this.#scale) : _chunk3R3QVKY5cjs.chordFromDegree.call(void 0, degree, quality, this.#scale);
4130
4137
  return new Chord(data, this);
4131
4138
  }
4132
4139
  /**
@@ -4139,7 +4146,7 @@ var Key = class _Key {
4139
4146
  * degrees. Use {@link Key.chord} with an explicit quality instead.
4140
4147
  */
4141
4148
  diatonicTriad(degree) {
4142
- return new Chord(_chunkYPB3A3EYcjs.diatonicTriad.call(void 0, degree, this.#scale), this);
4149
+ return new Chord(_chunk3R3QVKY5cjs.diatonicTriad.call(void 0, degree, this.#scale), this);
4143
4150
  }
4144
4151
  /**
4145
4152
  * The diatonic seventh chord on a scale degree, carrying this key as context.
@@ -4151,7 +4158,7 @@ var Key = class _Key {
4151
4158
  * degrees. Use {@link Key.chord} with an explicit quality instead.
4152
4159
  */
4153
4160
  diatonicSeventh(degree) {
4154
- return new Chord(_chunkYPB3A3EYcjs.diatonicSeventh.call(void 0, degree, this.#scale), this);
4161
+ return new Chord(_chunk3R3QVKY5cjs.diatonicSeventh.call(void 0, degree, this.#scale), this);
4155
4162
  }
4156
4163
  /**
4157
4164
  * Build the chord denoted by a Roman numeral in this key (including applied
@@ -4162,7 +4169,7 @@ var Key = class _Key {
4162
4169
  * @throws If the numeral is not valid.
4163
4170
  */
4164
4171
  roman(text) {
4165
- return new Chord(_chunkQ6R3QAZDcjs.romanToChord.call(void 0, text, this), this);
4172
+ return new Chord(_chunkIFZDWIKMcjs.romanToChord.call(void 0, text, this), this);
4166
4173
  }
4167
4174
  /**
4168
4175
  * The augmented sixth chord of a kind, built in this key.
@@ -4183,7 +4190,7 @@ var Key = class _Key {
4183
4190
  * ```
4184
4191
  */
4185
4192
  augmentedSixth(kind) {
4186
- return new Chord(_chunkQ6R3QAZDcjs.augmentedSixthChord.call(void 0, kind, keyIdentity(this)), this);
4193
+ return new Chord(_chunkIFZDWIKMcjs.augmentedSixthChord.call(void 0, kind, keyIdentity(this)), this);
4187
4194
  }
4188
4195
  /**
4189
4196
  * Build a progression from Roman numerals in this key.
@@ -4216,7 +4223,7 @@ var Key = class _Key {
4216
4223
  * @returns True if the pitch class is a scale tone.
4217
4224
  */
4218
4225
  contains(x) {
4219
- return _chunkYPB3A3EYcjs.isScaleTone.call(void 0, typeof x === "number" ? x : x.pitchClass, this.#scale);
4226
+ return _chunk3R3QVKY5cjs.isScaleTone.call(void 0, typeof x === "number" ? x : x.pitchClass, this.#scale);
4220
4227
  }
4221
4228
  /**
4222
4229
  * The nearest MIDI pitch whose pitch class is in the scale.
@@ -4235,7 +4242,7 @@ var Key = class _Key {
4235
4242
  * ```
4236
4243
  */
4237
4244
  nearestTone(pitch) {
4238
- return _chunkYPB3A3EYcjs.nearestScaleTone.call(void 0, pitch, this.#scale);
4245
+ return _chunk3R3QVKY5cjs.nearestScaleTone.call(void 0, pitch, this.#scale);
4239
4246
  }
4240
4247
  /**
4241
4248
  * The scale degree a pitch sits on, counted from 1: the tonic is degree 1.
@@ -4253,7 +4260,7 @@ var Key = class _Key {
4253
4260
  * ```
4254
4261
  */
4255
4262
  degreeOf(pitch) {
4256
- const degree = _chunkYPB3A3EYcjs.pitchToScaleDegree.call(void 0, pitch, this.#scale);
4263
+ const degree = _chunk3R3QVKY5cjs.pitchToScaleDegree.call(void 0, pitch, this.#scale);
4257
4264
  return degree === -1 ? null : degree;
4258
4265
  }
4259
4266
  /**
@@ -4300,7 +4307,7 @@ var Key = class _Key {
4300
4307
  */
4301
4308
  toString(opts) {
4302
4309
  if (_optionalChain([opts, 'optionalAccess', _32 => _32.system]) !== void 0 && opts.system !== "english") {
4303
- return _chunkXKSO2V5Icjs.formatKeyName.call(void 0,
4310
+ return _chunkS5BKZZGMcjs.formatKeyName.call(void 0,
4304
4311
  { tonic: this.#tonic.data, mode: this.isMinor ? "minor" : "major" },
4305
4312
  opts
4306
4313
  );
@@ -4317,13 +4324,13 @@ function toKey(value) {
4317
4324
  if (typeof data === "object" && data !== null) {
4318
4325
  const record = data;
4319
4326
  if (record.scale === void 0) {
4320
- const scale = _chunkYPB3A3EYcjs.toKeyScale.call(void 0, data);
4327
+ const scale = _chunk3R3QVKY5cjs.toKeyScale.call(void 0, data);
4321
4328
  return record.tonic === void 0 ? new Key(scale, spelledTonicFor(scale), record.variant) : new Key(scale, new Note(record.tonic), record.variant);
4322
4329
  }
4323
- return record.tonic === void 0 ? Key.of(_chunkYPB3A3EYcjs.toKeyScale.call(void 0, record.scale)) : Key.fromJSON(record);
4330
+ return record.tonic === void 0 ? Key.of(_chunk3R3QVKY5cjs.toKeyScale.call(void 0, record.scale)) : Key.fromJSON(record);
4324
4331
  }
4325
4332
  }
4326
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(`key must be a key name or a key/scale; received ${typeof value}`);
4333
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(`key must be a key name or a key/scale; received ${typeof value}`);
4327
4334
  }
4328
4335
  function keyIdentity(key) {
4329
4336
  return { scale: key.scale, tonic: key.tonic.data, variant: key.variant };
@@ -4351,7 +4358,7 @@ function copyMeters(meters) {
4351
4358
  }
4352
4359
  function copyTempo(tempo) {
4353
4360
  assertDataObjects(tempo, "score tempo");
4354
- _chunk5JJ6EHEZcjs.tempoAt.call(void 0, 0, tempo);
4361
+ _chunkNM7UAMC3cjs.tempoAt.call(void 0, 0, tempo);
4355
4362
  return tempo.map((event) => ({
4356
4363
  startBeat: withoutNegativeZero(event.startBeat),
4357
4364
  bpm: event.bpm
@@ -4363,7 +4370,7 @@ function copyScore(data) {
4363
4370
  notes: orderNotes(data.notes, "score notes"),
4364
4371
  // The map is validated by the same resolver every meter-aware entry point
4365
4372
  // reads its options through, so a score accepts exactly what they accept.
4366
- meters: copyMeters(_chunkXKSO2V5Icjs.resolveMeters.call(void 0, { meters: data.meters }, "score meters")),
4373
+ meters: copyMeters(_chunkS5BKZZGMcjs.resolveMeters.call(void 0, { meters: data.meters }, "score meters")),
4367
4374
  tempo: copyTempo(data.tempo)
4368
4375
  };
4369
4376
  if (data.key !== void 0) {
@@ -4396,7 +4403,7 @@ function statedKeyRegions(key, notes, totalBeats) {
4396
4403
  function scoreData(notes, opts) {
4397
4404
  const data = {
4398
4405
  notes: [...assertDataArray(notes, "score notes")],
4399
- meters: _chunkXKSO2V5Icjs.resolveMeters.call(void 0, { meters: _optionalChain([opts, 'optionalAccess', _33 => _33.meters]) }, "score meters"),
4406
+ meters: _chunkS5BKZZGMcjs.resolveMeters.call(void 0, { meters: _optionalChain([opts, 'optionalAccess', _33 => _33.meters]) }, "score meters"),
4400
4407
  tempo: tempoFrom(_optionalChain([opts, 'optionalAccess', _34 => _34.tempo]))
4401
4408
  };
4402
4409
  if (_optionalChain([opts, 'optionalAccess', _35 => _35.key]) !== void 0) {
@@ -4411,6 +4418,8 @@ var Score = class _Score {
4411
4418
  #chords;
4412
4419
  /** The key regions, made on the first member that needs them. */
4413
4420
  #regions;
4421
+ /** The reference profile asked for with no options, made on first read. */
4422
+ #profile;
4414
4423
  /**
4415
4424
  * Wrap plain score data.
4416
4425
  *
@@ -4471,8 +4480,8 @@ var Score = class _Score {
4471
4480
  static fromTicks(events, ppq, opts) {
4472
4481
  const notes = assertDataObjects(events, "score notes").map((event) => ({
4473
4482
  ...event,
4474
- startBeat: _chunk5JJ6EHEZcjs.ticksToBeats.call(void 0, event.startBeat, ppq),
4475
- durationBeat: _chunk5JJ6EHEZcjs.ticksToBeats.call(void 0, event.durationBeat, ppq)
4483
+ startBeat: _chunkNM7UAMC3cjs.ticksToBeats.call(void 0, event.startBeat, ppq),
4484
+ durationBeat: _chunkNM7UAMC3cjs.ticksToBeats.call(void 0, event.durationBeat, ppq)
4476
4485
  }));
4477
4486
  return new _Score(scoreData(notes, opts));
4478
4487
  }
@@ -4521,8 +4530,8 @@ var Score = class _Score {
4521
4530
  * @returns The score holding those notes.
4522
4531
  */
4523
4532
  slice(fromBeat, toBeat) {
4524
- _chunkXKSO2V5Icjs.assertFiniteNumber.call(void 0, fromBeat, "slice fromBeat");
4525
- _chunkXKSO2V5Icjs.assertFiniteNumber.call(void 0, toBeat, "slice toBeat");
4533
+ _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, fromBeat, "slice fromBeat");
4534
+ _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, toBeat, "slice toBeat");
4526
4535
  return this.#withNotes(
4527
4536
  this.#data.notes.filter((note) => note.startBeat >= fromBeat && note.startBeat < toBeat)
4528
4537
  );
@@ -4554,7 +4563,7 @@ var Score = class _Score {
4554
4563
  * @returns The moved score.
4555
4564
  */
4556
4565
  shift(beats) {
4557
- _chunkXKSO2V5Icjs.assertFiniteNumber.call(void 0, beats, "shift beats");
4566
+ _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, beats, "shift beats");
4558
4567
  return this.#withNotes(
4559
4568
  this.#data.notes.map((note) => ({ ...note, startBeat: note.startBeat + beats }))
4560
4569
  );
@@ -4572,7 +4581,7 @@ var Score = class _Score {
4572
4581
  * @throws If a note would leave the MIDI range.
4573
4582
  */
4574
4583
  transpose(semitones) {
4575
- _chunkXKSO2V5Icjs.assertFiniteNumber.call(void 0, semitones, "transpose semitones");
4584
+ _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, semitones, "transpose semitones");
4576
4585
  return this.#moved(
4577
4586
  this.#data.notes.map((note) => ({ ...note, pitch: note.pitch + semitones })),
4578
4587
  (key) => key.transpose(semitones)
@@ -4592,7 +4601,7 @@ var Score = class _Score {
4592
4601
  * @returns The transposed score.
4593
4602
  */
4594
4603
  transposeBy(interval) {
4595
- const step = _chunkXKSO2V5Icjs.toSpelledInterval.call(void 0, interval);
4604
+ const step = _chunkS5BKZZGMcjs.toSpelledInterval.call(void 0, interval);
4596
4605
  return this.#moved(
4597
4606
  this.#data.notes.map((note) => ({ ...note, pitch: note.pitch + step.semitones })),
4598
4607
  // Moved by the interval rather than by its semitone count, so a key taken
@@ -4603,7 +4612,7 @@ var Score = class _Score {
4603
4612
  }
4604
4613
  /** The same notes read against a different meter. */
4605
4614
  withMeters(meters) {
4606
- return new _Score({ ...this.#data, meters: _chunkXKSO2V5Icjs.resolveMeters.call(void 0, { meters }, "score meters") });
4615
+ return new _Score({ ...this.#data, meters: _chunkS5BKZZGMcjs.resolveMeters.call(void 0, { meters }, "score meters") });
4607
4616
  }
4608
4617
  /** The same notes read against a different tempo. */
4609
4618
  withTempo(tempo) {
@@ -4632,7 +4641,7 @@ var Score = class _Score {
4632
4641
  * ```
4633
4642
  */
4634
4643
  quantize(grid) {
4635
- _chunkXKSO2V5Icjs.assertRange.call(void 0, grid, Number.MIN_VALUE, Number.MAX_SAFE_INTEGER, "quantize grid");
4644
+ _chunkS5BKZZGMcjs.assertRange.call(void 0, grid, Number.MIN_VALUE, Number.MAX_SAFE_INTEGER, "quantize grid");
4636
4645
  return this.#withNotes(
4637
4646
  this.#data.notes.map((note) => ({
4638
4647
  ...note,
@@ -4653,7 +4662,7 @@ var Score = class _Score {
4653
4662
  * @returns The humanized score.
4654
4663
  */
4655
4664
  humanize(opts) {
4656
- return this.#withNotes(_chunk5KW7DNCJcjs.humanize.call(void 0, this.#data.notes, { ts: this.meterAt(0), ...opts }));
4665
+ return this.#withNotes(_chunkB2PW6EHNcjs.humanize.call(void 0, this.#data.notes, { ts: this.meterAt(0), ...opts }));
4657
4666
  }
4658
4667
  /**
4659
4668
  * The notes with ornaments added.
@@ -4666,7 +4675,7 @@ var Score = class _Score {
4666
4675
  * @returns The ornamented score.
4667
4676
  */
4668
4677
  ornament(opts) {
4669
- return this.#withNotes(_chunk5KW7DNCJcjs.ornament.call(void 0, this.#data.notes, { ts: this.meterAt(0), ...opts }));
4678
+ return this.#withNotes(_chunkB2PW6EHNcjs.ornament.call(void 0, this.#data.notes, { ts: this.meterAt(0), ...opts }));
4670
4679
  }
4671
4680
  /**
4672
4681
  * The notes placed on a groove template's slots.
@@ -4680,7 +4689,7 @@ var Score = class _Score {
4680
4689
  * @throws If the template was extracted under another meter.
4681
4690
  */
4682
4691
  groove(template) {
4683
- return this.#withNotes(_chunk5KW7DNCJcjs.applyGrooveTemplate.call(void 0, this.#data.notes, template, this.meterAt(0)));
4692
+ return this.#withNotes(_chunkB2PW6EHNcjs.applyGrooveTemplate.call(void 0, this.#data.notes, template, this.meterAt(0)));
4684
4693
  }
4685
4694
  /**
4686
4695
  * The feel of the score's own timing, as a template another score can take on.
@@ -4704,7 +4713,7 @@ var Score = class _Score {
4704
4713
  * ```
4705
4714
  */
4706
4715
  grooveTemplate(subdivision) {
4707
- return _chunk5KW7DNCJcjs.extractGrooveTemplate.call(void 0, this.#data.notes, this.meterAt(0), subdivision);
4716
+ return _chunkB2PW6EHNcjs.extractGrooveTemplate.call(void 0, this.#data.notes, this.meterAt(0), subdivision);
4708
4717
  }
4709
4718
  /**
4710
4719
  * The harmony the notes spell out, in time.
@@ -4717,7 +4726,7 @@ var Score = class _Score {
4717
4726
  * and how sure it is of each segment.
4718
4727
  */
4719
4728
  timeline(opts) {
4720
- const result = opts === void 0 ? this.#chordAnalysis() : _chunkQ6R3QAZDcjs.chordTimelineFromNotes.call(void 0, this.#data.notes, this.#analysisOptions(opts));
4729
+ const result = opts === void 0 ? this.#chordAnalysis() : _chunkIFZDWIKMcjs.chordTimelineFromNotes.call(void 0, this.#data.notes, this.#analysisOptions(opts));
4721
4730
  return Timeline.fromData({
4722
4731
  segments: result.timeline.segments,
4723
4732
  totalBeats: _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _36 => _36.totalBeats]), () => ( this.totalBeats)),
@@ -4739,7 +4748,7 @@ var Score = class _Score {
4739
4748
  if (this.#key !== void 0) {
4740
4749
  return this.#key;
4741
4750
  }
4742
- const prevailing = _chunkQ6R3QAZDcjs.prevailingKeyOf.call(void 0, this.#keyRegions());
4751
+ const prevailing = _chunkIFZDWIKMcjs.prevailingKeyOf.call(void 0, this.#keyRegions());
4743
4752
  return prevailing === null ? void 0 : toKey(prevailing);
4744
4753
  }
4745
4754
  /**
@@ -4760,7 +4769,7 @@ var Score = class _Score {
4760
4769
  if (this.#key !== void 0) {
4761
4770
  return statedKeyRegions(this.#key, this.#data.notes, _nullishCoalesce(opts.totalBeats, () => ( this.totalBeats)));
4762
4771
  }
4763
- return _chunkQ6R3QAZDcjs.keyTimelineFromNotes.call(void 0, this.#data.notes, { meters: this.#data.meters, ...opts });
4772
+ return _chunkIFZDWIKMcjs.keyTimelineFromNotes.call(void 0, this.#data.notes, { meters: this.#data.meters, ...opts });
4764
4773
  }
4765
4774
  return this.#keyRegions().map(copyKeyRegion);
4766
4775
  }
@@ -4788,7 +4797,7 @@ var Score = class _Score {
4788
4797
  * ```
4789
4798
  */
4790
4799
  detectKeys(opts) {
4791
- return _chunkQ6R3QAZDcjs.detectKeyFromNotes.call(void 0, this.#data.notes, opts).map(detectedKeyMatch);
4800
+ return _chunkIFZDWIKMcjs.detectKeyFromNotes.call(void 0, this.#data.notes, opts).map(detectedKeyMatch);
4792
4801
  }
4793
4802
  /**
4794
4803
  * The phrases the notes fall into.
@@ -4800,7 +4809,7 @@ var Score = class _Score {
4800
4809
  * @returns The phrases, in time order.
4801
4810
  */
4802
4811
  phrases(opts) {
4803
- return _chunkXVMJO3QFcjs.phrasesFromTimeline.call(void 0, this.#chordTimeline(), this.#data.notes, {
4812
+ return _chunkYFA7X2F6cjs.phrasesFromTimeline.call(void 0, this.#chordTimeline(), this.#data.notes, {
4804
4813
  meters: this.#data.meters,
4805
4814
  ...this.#key === void 0 ? {} : { key: keyIdentity(this.#key) },
4806
4815
  ...opts
@@ -4820,7 +4829,7 @@ var Score = class _Score {
4820
4829
  * @returns The cadences, heaviest first; ties keep the earlier one.
4821
4830
  */
4822
4831
  structuralCadences(opts) {
4823
- return _chunkXVMJO3QFcjs.structuralCadences.call(void 0, this.phrases(opts));
4832
+ return _chunkYFA7X2F6cjs.structuralCadences.call(void 0, this.phrases(opts));
4824
4833
  }
4825
4834
  /**
4826
4835
  * The sections the score divides into.
@@ -4829,7 +4838,7 @@ var Score = class _Score {
4829
4838
  * @returns The sections, in time order.
4830
4839
  */
4831
4840
  sections(opts) {
4832
- return _chunkXVMJO3QFcjs.sectionsFromNotes.call(void 0, this.#data.notes, { meters: this.#data.meters, ...opts });
4841
+ return _chunkYFA7X2F6cjs.sectionsFromNotes.call(void 0, this.#data.notes, { meters: this.#data.meters, ...opts });
4833
4842
  }
4834
4843
  /**
4835
4844
  * The bar-level pulse above the meter.
@@ -4842,7 +4851,7 @@ var Score = class _Score {
4842
4851
  * @returns The grouping, its downbeats, a confidence, and a rationale.
4843
4852
  */
4844
4853
  hypermeter(opts) {
4845
- return _chunkXVMJO3QFcjs.hypermeter.call(void 0, this.#data.notes, this.#data.meters, {
4854
+ return _chunkYFA7X2F6cjs.hypermeter.call(void 0, this.#data.notes, this.#data.meters, {
4846
4855
  cadenceBeats: this.#cadenceBeats(),
4847
4856
  ...opts
4848
4857
  });
@@ -4884,7 +4893,7 @@ var Score = class _Score {
4884
4893
  * ```
4885
4894
  */
4886
4895
  motifs(opts) {
4887
- return _chunkXVMJO3QFcjs.extractMotifs.call(void 0, this.#data.notes, opts);
4896
+ return _chunkIFZDWIKMcjs.extractMotifs.call(void 0, this.#data.notes, opts);
4888
4897
  }
4889
4898
  /**
4890
4899
  * The shape the melody traces.
@@ -4896,7 +4905,144 @@ var Score = class _Score {
4896
4905
  * answered for; {@link Score.voices} is what reads the polyphony as polyphony.
4897
4906
  */
4898
4907
  contour() {
4899
- return _chunkXVMJO3QFcjs.melodicContour.call(void 0, this.#data.notes);
4908
+ return _chunkIFZDWIKMcjs.melodicContour.call(void 0, this.#data.notes);
4909
+ }
4910
+ /**
4911
+ * The score's structural fingerprint: form, phrase shape, harmonic function
4912
+ * and rhythm, and how its motifs derive from one another.
4913
+ *
4914
+ * The harmony is the score's own kept chord analysis, read once whether this
4915
+ * is asked before or after {@link Score.timeline} — unless `opts.timeline`
4916
+ * gives the harmony directly, in which case the reading runs fresh through
4917
+ * {@link analyzeReference} rather than the harmony this score already holds.
4918
+ * The meter, the key and the span are the score's own and are not on offer
4919
+ * here: a caller wanting another meter reads through {@link
4920
+ * Score.withMeters}, and one wanting another key or span calls {@link
4921
+ * analyzeReference} directly.
4922
+ *
4923
+ * Asked with no options, the answer is kept and a copy of it handed back, as
4924
+ * {@link Score.timeline} keeps its own reading; asked with options, the
4925
+ * answer is read afresh and not kept.
4926
+ *
4927
+ * @param opts The harmony, the melody, and the budget; see {@link
4928
+ * ReferenceProfileOptions}. Meter, key and span are the score's own.
4929
+ * @returns The profile.
4930
+ * @example
4931
+ * ```ts
4932
+ * import { Score } from '@libraz/libcantus';
4933
+ * const triad = (pitches: number[], startBeat: number) =>
4934
+ * pitches.map((pitch) => ({ pitch, startBeat, durationBeat: 4 }));
4935
+ * const score = Score.of(
4936
+ * [
4937
+ * ...triad([60, 64, 67], 0),
4938
+ * ...triad([65, 69, 72], 4),
4939
+ * ...triad([67, 71, 74], 8),
4940
+ * ...triad([60, 64, 67], 12),
4941
+ * ],
4942
+ * { key: 'C major' },
4943
+ * );
4944
+ * score.reference().harmony.chords.map((chord) => chord.roman); // ['I', 'IV', 'V', 'I']
4945
+ * ```
4946
+ */
4947
+ reference(opts) {
4948
+ if (opts === void 0 && this.#profile !== void 0) {
4949
+ return copyPlain(this.#profile, "reference profile");
4950
+ }
4951
+ const keyed = this.#key === void 0 ? {} : { key: keyIdentity(this.#key) };
4952
+ const asked = {
4953
+ meters: this.#data.meters,
4954
+ totalBeats: this.totalBeats,
4955
+ ...keyed,
4956
+ ...opts
4957
+ };
4958
+ const profile = _optionalChain([opts, 'optionalAccess', _37 => _37.timeline]) === void 0 ? _chunkYFA7X2F6cjs.referenceFromReadings.call(void 0, this.#data.notes, this.#chordAnalysis(), asked) : _chunkYFA7X2F6cjs.analyzeReference.call(void 0, this.#data.notes, asked);
4959
+ if (opts === void 0) {
4960
+ this.#profile = profile;
4961
+ return copyPlain(profile, "reference profile");
4962
+ }
4963
+ return profile;
4964
+ }
4965
+ /**
4966
+ * The onset placement of the score's melodic line.
4967
+ *
4968
+ * A melody is one line, so a score holding several is read as its top voice,
4969
+ * as {@link Score.motifs} and {@link Score.contour} are.
4970
+ *
4971
+ * @param opts The span's end and the budget; see {@link
4972
+ * RhythmAnalysisOptions}. The meter is the score's own.
4973
+ * @returns The rhythm reading.
4974
+ * @example
4975
+ * ```ts
4976
+ * import { Score } from '@libraz/libcantus';
4977
+ * const score = Score.of([
4978
+ * { pitch: 60, startBeat: 0, durationBeat: 1 },
4979
+ * { pitch: 62, startBeat: 1, durationBeat: 1 },
4980
+ * { pitch: 64, startBeat: 2, durationBeat: 1 },
4981
+ * { pitch: 65, startBeat: 3, durationBeat: 1 },
4982
+ * ]);
4983
+ * score.rhythm().onsetDensity; // 4
4984
+ * ```
4985
+ */
4986
+ rhythm(opts) {
4987
+ return _chunkIFZDWIKMcjs.analyzeRhythm.call(void 0, this.#data.notes, {
4988
+ meters: this.#data.meters,
4989
+ totalBeats: this.totalBeats,
4990
+ ...opts
4991
+ });
4992
+ }
4993
+ /**
4994
+ * How the score's motifs derive from one another: which statement grew out
4995
+ * of which, and by what transformation.
4996
+ *
4997
+ * {@link Score.motifs} finds the cells; this reads across their occurrences
4998
+ * and names, for every statement after the first, the earlier one it most
4999
+ * plausibly grew out of. A melody is one line, so a score holding several is
5000
+ * read as its top voice, as {@link Score.motifs} is.
5001
+ *
5002
+ * @param opts Cell-length bounds and the recurrence threshold {@link
5003
+ * Score.motifs} takes, plus the variation threshold and the budget; see
5004
+ * {@link MotifGraphOptions} and {@link ExtractMotifsOptions}.
5005
+ * @returns The derivation forest.
5006
+ * @example
5007
+ * ```ts
5008
+ * import { Score } from '@libraz/libcantus';
5009
+ * const score = Score.of([
5010
+ * { pitch: 60, startBeat: 0, durationBeat: 1 },
5011
+ * { pitch: 62, startBeat: 1, durationBeat: 1 },
5012
+ * { pitch: 64, startBeat: 2, durationBeat: 1 },
5013
+ * { pitch: 60, startBeat: 3, durationBeat: 1 },
5014
+ * { pitch: 62, startBeat: 4, durationBeat: 1 },
5015
+ * { pitch: 64, startBeat: 5, durationBeat: 1 },
5016
+ * ]);
5017
+ * score.motifGraph().edges.length; // 1
5018
+ * ```
5019
+ */
5020
+ motifGraph(opts) {
5021
+ return _chunkIFZDWIKMcjs.motifGraph.call(void 0, this.#data.notes, _chunkIFZDWIKMcjs.extractMotifs.call(void 0, this.#data.notes, opts), {
5022
+ key: this.key(),
5023
+ ...opts
5024
+ });
5025
+ }
5026
+ /**
5027
+ * How this score, read as a melody, keeps to a composition plan.
5028
+ *
5029
+ * @param plan The plan the melody was written for.
5030
+ * @param opts The budget; see {@link EvaluateCompositionOptions}.
5031
+ * @returns The violations found and the fit reading; see {@link
5032
+ * evaluateComposition}.
5033
+ * @example
5034
+ * ```ts
5035
+ * import { Composer, Score } from '@libraz/libcantus';
5036
+ * const notes = [60, 62, 64, 65, 67, 65, 64, 62, 60, 62, 64, 65, 67, 65, 64, 60].map(
5037
+ * (pitch, startBeat) => ({ pitch, startBeat, durationBeat: 1 }),
5038
+ * );
5039
+ * const composer = Composer.of({ key: 'C major', seed: 5 });
5040
+ * const plan = composer.plan(Score.of(notes, { key: 'C major' }).reference());
5041
+ * composer.melody(plan).evaluate(plan).violations.some((v) => v.severity === 'error'); // false
5042
+ * ```
5043
+ */
5044
+ evaluate(plan, opts) {
5045
+ return _chunkB2PW6EHNcjs.evaluateComposition.call(void 0, this.#data.notes, plan, opts);
4900
5046
  }
4901
5047
  /**
4902
5048
  * Each note's role in the harmony sounding under it.
@@ -4920,7 +5066,7 @@ var Score = class _Score {
4920
5066
  */
4921
5067
  voices(key) {
4922
5068
  const timeline = this.#chordTimeline();
4923
- return _chunkXVMJO3QFcjs.analyzePolyphony.call(void 0, this.#data.notes, timeline.at, this.#keyContext(key));
5069
+ return _chunkYFA7X2F6cjs.analyzePolyphony.call(void 0, this.#data.notes, timeline.at, this.#keyContext(key));
4924
5070
  }
4925
5071
  /**
4926
5072
  * The notes carrying the ids the voice analysis reports them back under.
@@ -4934,7 +5080,7 @@ var Score = class _Score {
4934
5080
  * @returns One voice note per note, in the score's own time order.
4935
5081
  */
4936
5082
  voiceNotes() {
4937
- return _chunkQ6R3QAZDcjs.toVoiceNotes.call(void 0, this.#data.notes);
5083
+ return _chunkIFZDWIKMcjs.toVoiceNotes.call(void 0, this.#data.notes);
4938
5084
  }
4939
5085
  /**
4940
5086
  * Whether an instrument can play the score, and what makes it hard.
@@ -4958,14 +5104,14 @@ var Score = class _Score {
4958
5104
  * ```
4959
5105
  */
4960
5106
  playability(instrument) {
4961
- const profile = _chunkJ772DL3Bcjs.toInstrumentProfile.call(void 0, instrument);
5107
+ const profile = _chunkCGBADIO5cjs.toInstrumentProfile.call(void 0, instrument);
4962
5108
  const tempo = this.#data.tempo;
4963
- const openingBpm = _chunk5JJ6EHEZcjs.tempoAt.call(void 0, 0, tempo);
5109
+ const openingBpm = _chunkNM7UAMC3cjs.tempoAt.call(void 0, 0, tempo);
4964
5110
  if (tempo.length < 2) {
4965
- return _chunkJ772DL3Bcjs.playability.call(void 0, this.#data.notes, profile, openingBpm);
5111
+ return _chunkCGBADIO5cjs.playability.call(void 0, this.#data.notes, profile, openingBpm);
4966
5112
  }
4967
- const played = _chunk5JJ6EHEZcjs.tempoReader.call(void 0, tempo);
4968
- const evenly = _chunk5JJ6EHEZcjs.tempoReader.call(void 0, [{ startBeat: 0, bpm: openingBpm }]);
5113
+ const played = _chunkNM7UAMC3cjs.tempoReader.call(void 0, tempo);
5114
+ const evenly = _chunkNM7UAMC3cjs.tempoReader.call(void 0, [{ startBeat: 0, bpm: openingBpm }]);
4969
5115
  const restate = (beat) => evenly.beatAt(played.secondsAt(beat));
4970
5116
  const scoreBeats = /* @__PURE__ */ new Map();
4971
5117
  const evenlyPaced = this.#data.notes.map((note) => {
@@ -4977,7 +5123,7 @@ var Score = class _Score {
4977
5123
  durationBeat: restate(note.startBeat + note.durationBeat) - startBeat
4978
5124
  };
4979
5125
  });
4980
- const report = _chunkJ772DL3Bcjs.playability.call(void 0, evenlyPaced, profile, openingBpm);
5126
+ const report = _chunkCGBADIO5cjs.playability.call(void 0, evenlyPaced, profile, openingBpm);
4981
5127
  return {
4982
5128
  ...report,
4983
5129
  issues: report.issues.map((issue) => ({
@@ -4993,7 +5139,7 @@ var Score = class _Score {
4993
5139
  * @returns The index.
4994
5140
  */
4995
5141
  index(opts) {
4996
- return _chunkTT6PKMPRcjs.createNoteEventIndex.call(void 0, this.#data.notes, {
5142
+ return _chunk35NBV2FTcjs.createNoteEventIndex.call(void 0, this.#data.notes, {
4997
5143
  allowNonPositiveDuration: true,
4998
5144
  name: "score notes",
4999
5145
  ...opts
@@ -5010,7 +5156,7 @@ var Score = class _Score {
5010
5156
  * @returns Elapsed seconds from the tempo map's origin.
5011
5157
  */
5012
5158
  secondsAt(beat) {
5013
- return _chunk5JJ6EHEZcjs.beatsToSeconds.call(void 0, beat, this.#data.tempo);
5159
+ return _chunkNM7UAMC3cjs.beatsToSeconds.call(void 0, beat, this.#data.tempo);
5014
5160
  }
5015
5161
  /**
5016
5162
  * Where a beat falls in bars, read through the meter map.
@@ -5020,7 +5166,7 @@ var Score = class _Score {
5020
5166
  * reports bar -1.
5021
5167
  */
5022
5168
  barAt(beat) {
5023
- return _chunkXKSO2V5Icjs.beatToBarPosition.call(void 0, beat, this.#data.meters);
5169
+ return _chunkS5BKZZGMcjs.beatToBarPosition.call(void 0, beat, this.#data.meters);
5024
5170
  }
5025
5171
  /**
5026
5172
  * The time signature sounding at a beat.
@@ -5029,7 +5175,7 @@ var Score = class _Score {
5029
5175
  * @returns The signature in force there.
5030
5176
  */
5031
5177
  meterAt(beat) {
5032
- return _chunkXKSO2V5Icjs.meterAt.call(void 0, beat, this.#data.meters);
5178
+ return _chunkS5BKZZGMcjs.meterAt.call(void 0, beat, this.#data.meters);
5033
5179
  }
5034
5180
  /**
5035
5181
  * The score's beats as MIDI ticks, for a writer that counts in them.
@@ -5040,8 +5186,8 @@ var Score = class _Score {
5040
5186
  toTicks(ppq) {
5041
5187
  return this.#data.notes.map((note) => ({
5042
5188
  ...note,
5043
- startBeat: _chunk5JJ6EHEZcjs.beatsToTicks.call(void 0, note.startBeat, ppq),
5044
- durationBeat: _chunk5JJ6EHEZcjs.beatsToTicks.call(void 0, note.durationBeat, ppq)
5189
+ startBeat: _chunkNM7UAMC3cjs.beatsToTicks.call(void 0, note.startBeat, ppq),
5190
+ durationBeat: _chunkNM7UAMC3cjs.beatsToTicks.call(void 0, note.durationBeat, ppq)
5045
5191
  }));
5046
5192
  }
5047
5193
  /**
@@ -5114,7 +5260,7 @@ var Score = class _Score {
5114
5260
  * Score.timeline} hands all three to the class it builds.
5115
5261
  */
5116
5262
  #chordAnalysis() {
5117
- const analysis = _nullishCoalesce(this.#chords, () => ( _chunkQ6R3QAZDcjs.chordTimelineFromNotes.call(void 0, this.#data.notes, this.#analysisOptions())));
5263
+ const analysis = _nullishCoalesce(this.#chords, () => ( _chunkIFZDWIKMcjs.chordTimelineFromNotes.call(void 0, this.#data.notes, this.#analysisOptions())));
5118
5264
  this.#chords = analysis;
5119
5265
  return analysis;
5120
5266
  }
@@ -5125,13 +5271,13 @@ var Score = class _Score {
5125
5271
  * Kept on first reading for the same reason the chord timeline is.
5126
5272
  */
5127
5273
  #keyRegions() {
5128
- const regions = _nullishCoalesce(this.#regions, () => ( (this.#key === void 0 ? _chunkQ6R3QAZDcjs.keyTimelineFromNotes.call(void 0, this.#data.notes, { meters: this.#data.meters }) : statedKeyRegions(this.#key, this.#data.notes, this.totalBeats))));
5274
+ const regions = _nullishCoalesce(this.#regions, () => ( (this.#key === void 0 ? _chunkIFZDWIKMcjs.keyTimelineFromNotes.call(void 0, this.#data.notes, { meters: this.#data.meters }) : statedKeyRegions(this.#key, this.#data.notes, this.totalBeats))));
5129
5275
  this.#regions = regions;
5130
5276
  return regions;
5131
5277
  }
5132
5278
  /** Where the score's own harmony closes, as beats. */
5133
5279
  #cadenceBeats() {
5134
- return _chunkQ6R3QAZDcjs.detectCadences.call(void 0, this.#chordTimeline(), this.#keyContext(void 0)).map(
5280
+ return _chunkIFZDWIKMcjs.detectCadences.call(void 0, this.#chordTimeline(), this.#keyContext(void 0)).map(
5135
5281
  (hit) => hit.atBeat
5136
5282
  );
5137
5283
  }
@@ -5156,9 +5302,9 @@ var Score = class _Score {
5156
5302
  return keyIdentity(this.#key);
5157
5303
  }
5158
5304
  const regions = this.#keyRegions();
5159
- const prevailing = _nullishCoalesce(_chunkQ6R3QAZDcjs.prevailingKeyOf.call(void 0, regions), () => ( keyIdentity(Key.major("C"))));
5160
- const keyAt = _chunkQ6R3QAZDcjs.keyLookup.call(void 0, regions, prevailing);
5161
- return (beat) => _chunkYPB3A3EYcjs.scaleOf.call(void 0, keyAt(beat));
5305
+ const prevailing = _nullishCoalesce(_chunkIFZDWIKMcjs.prevailingKeyOf.call(void 0, regions), () => ( keyIdentity(Key.major("C"))));
5306
+ const keyAt = _chunkIFZDWIKMcjs.keyLookup.call(void 0, regions, prevailing);
5307
+ return (beat) => _chunk3R3QVKY5cjs.scaleOf.call(void 0, keyAt(beat));
5162
5308
  }
5163
5309
  };
5164
5310
  function sameNote(note, other) {
@@ -5194,7 +5340,7 @@ function copyTrack(track, index, budget) {
5194
5340
  copy.name = track.name;
5195
5341
  }
5196
5342
  if (track.role !== void 0) {
5197
- copy.role = _chunkXVMJO3QFcjs.trackRoleOf.call(void 0, track.role, `tracks[${index}].role`);
5343
+ copy.role = _chunkYFA7X2F6cjs.trackRoleOf.call(void 0, track.role, `tracks[${index}].role`);
5198
5344
  }
5199
5345
  return copy;
5200
5346
  }
@@ -5215,15 +5361,15 @@ function copySettings(settings, trackCount) {
5215
5361
  }
5216
5362
  assertDataObject(settings, "arrangement settings");
5217
5363
  const copy = {};
5218
- const meters = _chunkXKSO2V5Icjs.resolveMeters.call(void 0, { ts: settings.ts, meters: settings.meters }, "arrangement meters");
5364
+ const meters = _chunkS5BKZZGMcjs.resolveMeters.call(void 0, { ts: settings.ts, meters: settings.meters }, "arrangement meters");
5219
5365
  if (settings.ts !== void 0) {
5220
- copy.ts = copyPlain(_chunkXKSO2V5Icjs.toMeterData.call(void 0, settings.ts, "arrangement ts"), "arrangement ts");
5366
+ copy.ts = copyPlain(_chunkS5BKZZGMcjs.toMeterData.call(void 0, settings.ts, "arrangement ts"), "arrangement ts");
5221
5367
  }
5222
5368
  if (settings.meters !== void 0) {
5223
5369
  copy.meters = copyPlain(meters, "arrangement meters");
5224
5370
  }
5225
5371
  if (settings.key !== void 0) {
5226
- copy.key = _chunkYPB3A3EYcjs.resolveKey.call(void 0, settings.key);
5372
+ copy.key = _chunk3R3QVKY5cjs.resolveKey.call(void 0, settings.key);
5227
5373
  }
5228
5374
  if (settings.keys !== void 0) {
5229
5375
  copy.keys = copyKeyRegions(settings.keys);
@@ -5236,11 +5382,11 @@ function copySettings(settings, trackCount) {
5236
5382
  settings.harmonyTracks,
5237
5383
  "arrangement harmonyTracks"
5238
5384
  ).map(
5239
- (track, index) => _chunkXKSO2V5Icjs.assertInteger.call(void 0, track, `arrangement harmonyTracks[${index}]`, 0, trackCount - 1)
5385
+ (track, index) => _chunkS5BKZZGMcjs.assertInteger.call(void 0, track, `arrangement harmonyTracks[${index}]`, 0, trackCount - 1)
5240
5386
  );
5241
5387
  }
5242
5388
  if (settings.minSeverity !== void 0) {
5243
- copy.minSeverity = _chunkXKSO2V5Icjs.assertInteger.call(void 0,
5389
+ copy.minSeverity = _chunkS5BKZZGMcjs.assertInteger.call(void 0,
5244
5390
  settings.minSeverity,
5245
5391
  "arrangement minSeverity",
5246
5392
  0 /* Safe */,
@@ -5248,7 +5394,7 @@ function copySettings(settings, trackCount) {
5248
5394
  );
5249
5395
  }
5250
5396
  if (settings.pickupBeats !== void 0) {
5251
- copy.pickupBeats = _chunkXKSO2V5Icjs.assertRange.call(void 0,
5397
+ copy.pickupBeats = _chunkS5BKZZGMcjs.assertRange.call(void 0,
5252
5398
  settings.pickupBeats,
5253
5399
  0,
5254
5400
  Number.MAX_SAFE_INTEGER,
@@ -5256,7 +5402,7 @@ function copySettings(settings, trackCount) {
5256
5402
  );
5257
5403
  }
5258
5404
  if (settings.harmonicRhythm !== void 0) {
5259
- copy.harmonicRhythm = _chunkXKSO2V5Icjs.assertRange.call(void 0,
5405
+ copy.harmonicRhythm = _chunkS5BKZZGMcjs.assertRange.call(void 0,
5260
5406
  settings.harmonicRhythm,
5261
5407
  Number.MIN_VALUE,
5262
5408
  Number.MAX_SAFE_INTEGER,
@@ -5267,13 +5413,13 @@ function copySettings(settings, trackCount) {
5267
5413
  copy.profile = settings.profile;
5268
5414
  }
5269
5415
  if (settings.budget !== void 0) {
5270
- copy.budget = _chunkXKSO2V5Icjs.assertPositiveInt.call(void 0, settings.budget, "arrangement budget", Number.MAX_SAFE_INTEGER);
5416
+ copy.budget = _chunkS5BKZZGMcjs.assertPositiveInt.call(void 0, settings.budget, "arrangement budget", Number.MAX_SAFE_INTEGER);
5271
5417
  }
5272
5418
  return Object.keys(copy).length === 0 ? void 0 : copy;
5273
5419
  }
5274
5420
  function copyArrangement(data) {
5275
5421
  assertDataObject(data, "arrangement data");
5276
- const budget = _optionalChain([data, 'access', _37 => _37.settings, 'optionalAccess', _38 => _38.budget]);
5422
+ const budget = _optionalChain([data, 'access', _38 => _38.settings, 'optionalAccess', _39 => _39.budget]);
5277
5423
  const tracks = assertDataArray(data.tracks, "arrangement tracks").map(
5278
5424
  (track, index) => copyTrack(track, index, budget)
5279
5425
  );
@@ -5297,10 +5443,10 @@ function settingsFrom(setup) {
5297
5443
  const { key, meters, timeline, ...rest } = setup;
5298
5444
  const settings = { ...rest };
5299
5445
  if (key !== void 0) {
5300
- settings.key = _chunkYPB3A3EYcjs.resolveKey.call(void 0, key);
5446
+ settings.key = _chunk3R3QVKY5cjs.resolveKey.call(void 0, key);
5301
5447
  }
5302
5448
  if (meters !== void 0) {
5303
- settings.meters = _chunkXKSO2V5Icjs.resolveMeters.call(void 0, { meters }, "arrangement meters");
5449
+ settings.meters = _chunkS5BKZZGMcjs.resolveMeters.call(void 0, { meters }, "arrangement meters");
5304
5450
  }
5305
5451
  if (timeline !== void 0) {
5306
5452
  assertDataObject(timeline, "arrangement timeline");
@@ -5318,10 +5464,10 @@ function analysisOptionsOf(setup) {
5318
5464
  const { key, meters, ...rest } = setup;
5319
5465
  const opts = { ...rest };
5320
5466
  if (key !== void 0) {
5321
- opts.key = _chunkYPB3A3EYcjs.resolveKey.call(void 0, key);
5467
+ opts.key = _chunk3R3QVKY5cjs.resolveKey.call(void 0, key);
5322
5468
  }
5323
5469
  if (meters !== void 0) {
5324
- opts.meters = _chunkXKSO2V5Icjs.resolveMeters.call(void 0, { meters }, "arrangement meters");
5470
+ opts.meters = _chunkS5BKZZGMcjs.resolveMeters.call(void 0, { meters }, "arrangement meters");
5325
5471
  }
5326
5472
  return opts;
5327
5473
  }
@@ -5463,7 +5609,7 @@ var Arrangement = class _Arrangement {
5463
5609
  }
5464
5610
  copied.push({
5465
5611
  trackIndex: edit.trackIndex,
5466
- notes: copyNotes(edit.notes, `edits[${index}].notes`, _optionalChain([this, 'access', _39 => _39.#data, 'access', _40 => _40.settings, 'optionalAccess', _41 => _41.budget]))
5612
+ notes: copyNotes(edit.notes, `edits[${index}].notes`, _optionalChain([this, 'access', _40 => _40.#data, 'access', _41 => _41.settings, 'optionalAccess', _42 => _42.budget]))
5467
5613
  });
5468
5614
  }
5469
5615
  const session = this.#session().update(copied);
@@ -5488,7 +5634,7 @@ var Arrangement = class _Arrangement {
5488
5634
  * @returns One tension reading per sampled beat, in beat order.
5489
5635
  */
5490
5636
  tension(opts) {
5491
- return _chunkXVMJO3QFcjs.tensionCurveFrom.call(void 0,
5637
+ return _chunkYFA7X2F6cjs.tensionCurveFrom.call(void 0,
5492
5638
  [...this.#data.tracks],
5493
5639
  this.#session().analysis,
5494
5640
  this.#layered(analysisOptionsOf(opts))
@@ -5514,7 +5660,7 @@ var Arrangement = class _Arrangement {
5514
5660
  * tracks exceed the budget.
5515
5661
  */
5516
5662
  analyze(opts) {
5517
- return _chunkXVMJO3QFcjs.analyzeArrangement.call(void 0, [...this.#data.tracks], this.#layered(analysisOptionsOf(opts)));
5663
+ return _chunkYFA7X2F6cjs.analyzeArrangement.call(void 0, [...this.#data.tracks], this.#layered(analysisOptionsOf(opts)));
5518
5664
  }
5519
5665
  /**
5520
5666
  * The harmony the tracks spell out together, in time.
@@ -5532,6 +5678,70 @@ var Arrangement = class _Arrangement {
5532
5678
  keys: [...keys]
5533
5679
  });
5534
5680
  }
5681
+ /**
5682
+ * The arrangement's structural fingerprint: form, phrase shape, harmonic
5683
+ * function and rhythm, and how its melody's motifs derive from one another.
5684
+ *
5685
+ * The harmony reads the arrangement's own session analysis directly — the
5686
+ * tracks `settings.harmonyTracks` names, or else every track but the
5687
+ * percussion ones — so the harmony is never inferred a second time. The
5688
+ * melody is the notes of the tracks played with `role: 'melody'`, joined in
5689
+ * the order the tracks were given; an arrangement naming none reads the top
5690
+ * line of the harmony notes instead, as {@link analyzeReference} does
5691
+ * without a `melody` option. Meter, key, harmony and melody are the
5692
+ * arrangement's own and are not on offer here: a caller wanting others calls
5693
+ * {@link analyzeReference} directly, with the same notes {@link
5694
+ * Arrangement.tracks} hands out.
5695
+ *
5696
+ * @param opts The budget; see {@link ReferenceProfileOptions}.
5697
+ * @returns The profile.
5698
+ * @example
5699
+ * ```ts
5700
+ * import { Arrangement } from '@libraz/libcantus';
5701
+ * const triad = (pitches: number[], startBeat: number) =>
5702
+ * pitches.map((pitch) => ({ pitch, startBeat, durationBeat: 4 }));
5703
+ * const arrangement = Arrangement.of(
5704
+ * [
5705
+ * {
5706
+ * name: 'lead',
5707
+ * role: 'melody',
5708
+ * notes: [
5709
+ * ...triad([60, 64, 67], 0),
5710
+ * ...triad([65, 69, 72], 4),
5711
+ * ...triad([67, 71, 74], 8),
5712
+ * ...triad([60, 64, 67], 12),
5713
+ * ],
5714
+ * },
5715
+ * ],
5716
+ * { key: 'C major' },
5717
+ * );
5718
+ * arrangement.reference().harmony.chords.map((chord) => chord.roman); // ['I', 'IV', 'V', 'I']
5719
+ * ```
5720
+ */
5721
+ reference(opts) {
5722
+ const tracks = this.#data.tracks;
5723
+ const harmonyTracks = _optionalChain([this, 'access', _43 => _43.#data, 'access', _44 => _44.settings, 'optionalAccess', _45 => _45.harmonyTracks]);
5724
+ const harmony = [];
5725
+ const melody = [];
5726
+ for (let index = 0; index < tracks.length; index += 1) {
5727
+ const track = tracks[index];
5728
+ if (track === void 0) {
5729
+ continue;
5730
+ }
5731
+ if (track.role !== "drums" && (harmonyTracks === void 0 || harmonyTracks.includes(index))) {
5732
+ harmony.push(...track.notes);
5733
+ }
5734
+ if (track.role === "melody") {
5735
+ melody.push(...track.notes);
5736
+ }
5737
+ }
5738
+ return _chunkYFA7X2F6cjs.referenceFromReadings.call(void 0, harmony, this.#session().analysis, {
5739
+ meters: _optionalChain([this, 'access', _46 => _46.#data, 'access', _47 => _47.settings, 'optionalAccess', _48 => _48.meters]),
5740
+ totalBeats: this.timeline().totalBeats,
5741
+ ...melody.length === 0 ? {} : { melody },
5742
+ ...opts
5743
+ });
5744
+ }
5535
5745
  /**
5536
5746
  * Whether another arrangement holds the same tracks under the same settings.
5537
5747
  *
@@ -5556,7 +5766,7 @@ var Arrangement = class _Arrangement {
5556
5766
  }
5557
5767
  /** The open reading, analysing the tracks on the first call. */
5558
5768
  #session() {
5559
- const open = _nullishCoalesce(this.#open, () => ( _chunkXVMJO3QFcjs.createArrangementSession.call(void 0, [...this.#data.tracks], this.#analysisOptions())));
5769
+ const open = _nullishCoalesce(this.#open, () => ( _chunkYFA7X2F6cjs.createArrangementSession.call(void 0, [...this.#data.tracks], this.#analysisOptions())));
5560
5770
  this.#open = open;
5561
5771
  return open;
5562
5772
  }
@@ -5596,12 +5806,12 @@ var Arrangement = class _Arrangement {
5596
5806
  #scoreOptions() {
5597
5807
  const settings = this.#data.settings;
5598
5808
  const opts = {};
5599
- if (_optionalChain([settings, 'optionalAccess', _42 => _42.meters]) !== void 0) {
5809
+ if (_optionalChain([settings, 'optionalAccess', _49 => _49.meters]) !== void 0) {
5600
5810
  opts.meters = settings.meters;
5601
- } else if (_optionalChain([settings, 'optionalAccess', _43 => _43.ts]) !== void 0) {
5811
+ } else if (_optionalChain([settings, 'optionalAccess', _50 => _50.ts]) !== void 0) {
5602
5812
  opts.meters = settings.ts;
5603
5813
  }
5604
- if (_optionalChain([settings, 'optionalAccess', _44 => _44.key]) !== void 0) {
5814
+ if (_optionalChain([settings, 'optionalAccess', _51 => _51.key]) !== void 0) {
5605
5815
  opts.key = settings.key;
5606
5816
  }
5607
5817
  return opts;
@@ -5651,7 +5861,7 @@ function copyProfile(profile) {
5651
5861
  return percussion;
5652
5862
  }
5653
5863
  function checkedProfile(profile) {
5654
- return copyProfile(_chunkJ772DL3Bcjs.toInstrumentProfile.call(void 0, profile));
5864
+ return copyProfile(_chunkCGBADIO5cjs.toInstrumentProfile.call(void 0, profile));
5655
5865
  }
5656
5866
  var Instrument = class _Instrument {
5657
5867
  #profile;
@@ -5687,7 +5897,7 @@ var Instrument = class _Instrument {
5687
5897
  * @returns The instrument.
5688
5898
  */
5689
5899
  static guitar() {
5690
- return _Instrument.of(_chunkJ772DL3Bcjs.GUITAR_STANDARD);
5900
+ return _Instrument.of(_chunkCGBADIO5cjs.GUITAR_STANDARD);
5691
5901
  }
5692
5902
  /**
5693
5903
  * Six-string guitar in drop D: the lowest string down a tone to D2, the rest
@@ -5696,7 +5906,7 @@ var Instrument = class _Instrument {
5696
5906
  * @returns The instrument.
5697
5907
  */
5698
5908
  static guitarDropD() {
5699
- return _Instrument.of(_chunkJ772DL3Bcjs.GUITAR_DROP_D);
5909
+ return _Instrument.of(_chunkCGBADIO5cjs.GUITAR_DROP_D);
5700
5910
  }
5701
5911
  /**
5702
5912
  * Electric bass in standard tuning: E1 A1 D2 G2.
@@ -5704,7 +5914,7 @@ var Instrument = class _Instrument {
5704
5914
  * @returns The instrument.
5705
5915
  */
5706
5916
  static bass4() {
5707
- return _Instrument.of(_chunkJ772DL3Bcjs.BASS_4_STRING);
5917
+ return _Instrument.of(_chunkCGBADIO5cjs.BASS_4_STRING);
5708
5918
  }
5709
5919
  /**
5710
5920
  * Five-string bass with the low B: B0 E1 A1 D2 G2.
@@ -5717,7 +5927,7 @@ var Instrument = class _Instrument {
5717
5927
  * ```
5718
5928
  */
5719
5929
  static bass5() {
5720
- return _Instrument.of(_chunkJ772DL3Bcjs.BASS_5_STRING);
5930
+ return _Instrument.of(_chunkCGBADIO5cjs.BASS_5_STRING);
5721
5931
  }
5722
5932
  /**
5723
5933
  * Rebuild an instrument from the plain profile {@link Instrument.data} hands
@@ -5775,7 +5985,7 @@ var Instrument = class _Instrument {
5775
5985
  * ```
5776
5986
  */
5777
5987
  range() {
5778
- return _chunkJ772DL3Bcjs.rangeIn.call(void 0, this.#profile);
5988
+ return _chunkCGBADIO5cjs.rangeIn.call(void 0, this.#profile);
5779
5989
  }
5780
5990
  /**
5781
5991
  * Whether the instrument has this pitch at all.
@@ -5785,8 +5995,8 @@ var Instrument = class _Instrument {
5785
5995
  * produces it.
5786
5996
  */
5787
5997
  canSound(pitch) {
5788
- _chunkXKSO2V5Icjs.assertMidiPitch.call(void 0, pitch, "pitch");
5789
- return _chunkJ772DL3Bcjs.soundsIn.call(void 0, this.#profile, pitch);
5998
+ _chunkS5BKZZGMcjs.assertMidiPitch.call(void 0, pitch, "pitch");
5999
+ return _chunkCGBADIO5cjs.soundsIn.call(void 0, this.#profile, pitch);
5790
6000
  }
5791
6001
  /**
5792
6002
  * Every position on the neck that sounds a pitch, lowest string first.
@@ -5798,10 +6008,10 @@ var Instrument = class _Instrument {
5798
6008
  fingerings(pitch) {
5799
6009
  const profile = this.#profile;
5800
6010
  if (profile.kind !== "stringed") {
5801
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(`${profile.name} has no strings to finger`);
6011
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(`${profile.name} has no strings to finger`);
5802
6012
  }
5803
- _chunkXKSO2V5Icjs.assertMidiPitch.call(void 0, pitch, "pitch");
5804
- return _chunkJ772DL3Bcjs.fingeringsIn.call(void 0, profile, pitch);
6013
+ _chunkS5BKZZGMcjs.assertMidiPitch.call(void 0, pitch, "pitch");
6014
+ return _chunkCGBADIO5cjs.fingeringsIn.call(void 0, profile, pitch);
5805
6015
  }
5806
6016
  /**
5807
6017
  * Move a pitch by whole octaves until the instrument can sound it, which is
@@ -5818,8 +6028,8 @@ var Instrument = class _Instrument {
5818
6028
  * ```
5819
6029
  */
5820
6030
  foldIntoRange(pitch) {
5821
- _chunkXKSO2V5Icjs.assertMidiPitch.call(void 0, pitch, "pitch");
5822
- return _chunkJ772DL3Bcjs.foldIn.call(void 0, pitch, this.#profile);
6031
+ _chunkS5BKZZGMcjs.assertMidiPitch.call(void 0, pitch, "pitch");
6032
+ return _chunkCGBADIO5cjs.foldIn.call(void 0, pitch, this.#profile);
5823
6033
  }
5824
6034
  /**
5825
6035
  * The pitch this instrument sounds for a note written in its part.
@@ -5851,7 +6061,7 @@ var Instrument = class _Instrument {
5851
6061
  * ```
5852
6062
  */
5853
6063
  soundingPitch(note, transposition = this.#profile.name) {
5854
- return new Note(_chunkRVS4G4MRcjs.toSoundingPitch.call(void 0, _chunkXKSO2V5Icjs.toNoteData.call(void 0, note), transposition));
6064
+ return new Note(_chunk76ZBTRG2cjs.toSoundingPitch.call(void 0, _chunkS5BKZZGMcjs.toNoteData.call(void 0, note), transposition));
5855
6065
  }
5856
6066
  /**
5857
6067
  * Judge whether a passage can be played on this instrument, and how hard it
@@ -5877,7 +6087,7 @@ var Instrument = class _Instrument {
5877
6087
  * ```
5878
6088
  */
5879
6089
  playability(notes, bpm) {
5880
- return _chunkJ772DL3Bcjs.playability.call(void 0, notes, this.#profile, bpm);
6090
+ return _chunkCGBADIO5cjs.playability.call(void 0, notes, this.#profile, bpm);
5881
6091
  }
5882
6092
  /**
5883
6093
  * Whether another instrument is described identically.
@@ -5937,7 +6147,7 @@ function copyComplexity(complexity) {
5937
6147
  for (const dial of ["rhythmic", "harmonic", "ornament", "difficulty"]) {
5938
6148
  const value = complexity[dial];
5939
6149
  if (value !== void 0) {
5940
- copy[dial] = _chunkXKSO2V5Icjs.assertFiniteNumber.call(void 0, value, `composer complexity ${dial}`);
6150
+ copy[dial] = _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, value, `composer complexity ${dial}`);
5941
6151
  }
5942
6152
  }
5943
6153
  return copy;
@@ -5953,10 +6163,10 @@ function copyInstruments(instruments) {
5953
6163
  function copyOptions(options) {
5954
6164
  assertDataObject(options, "composer options");
5955
6165
  const copy = {
5956
- meters: _chunkXKSO2V5Icjs.resolveMeters.call(void 0, { meters: options.meters }, "composer meters")
6166
+ meters: _chunkS5BKZZGMcjs.resolveMeters.call(void 0, { meters: options.meters }, "composer meters")
5957
6167
  };
5958
6168
  if (options.key !== void 0) {
5959
- copy.key = _chunkYPB3A3EYcjs.resolveKey.call(void 0, options.key);
6169
+ copy.key = _chunk3R3QVKY5cjs.resolveKey.call(void 0, options.key);
5960
6170
  }
5961
6171
  if (options.bpm !== void 0) {
5962
6172
  copy.bpm = options.bpm;
@@ -5982,7 +6192,7 @@ function copyOptions(options) {
5982
6192
  if (options.rng !== void 0) {
5983
6193
  copy.rng = options.rng;
5984
6194
  }
5985
- const resolved = _chunk5KW7DNCJcjs.resolveContext.call(void 0, contextOf(copy));
6195
+ const resolved = _chunkB2PW6EHNcjs.resolveContext.call(void 0, contextOf(copy));
5986
6196
  copy.seed = resolved.seed;
5987
6197
  copy.algorithmVersion = resolved.algorithmVersion;
5988
6198
  return copy;
@@ -6039,8 +6249,8 @@ var Composer = class _Composer {
6039
6249
  */
6040
6250
  constructor(options) {
6041
6251
  this.#options = copyOptions(options);
6042
- this.#meters = _chunkXKSO2V5Icjs.resolveMeters.call(void 0, { meters: this.#options.meters }, "composer meters");
6043
- this.#key = this.#options.key === void 0 ? void 0 : _chunkYPB3A3EYcjs.resolveKey.call(void 0, this.#options.key);
6252
+ this.#meters = _chunkS5BKZZGMcjs.resolveMeters.call(void 0, { meters: this.#options.meters }, "composer meters");
6253
+ this.#key = this.#options.key === void 0 ? void 0 : _chunk3R3QVKY5cjs.resolveKey.call(void 0, this.#options.key);
6044
6254
  }
6045
6255
  /**
6046
6256
  * Start from a set of settings.
@@ -6097,8 +6307,8 @@ var Composer = class _Composer {
6097
6307
  progression(opts) {
6098
6308
  const key = this.#requireKey("progression");
6099
6309
  const ts = this.#unchangingMeter("progression");
6100
- const chords = _chunk5KW7DNCJcjs.generateProgression.call(void 0, { ...opts, key, ts, ctx: this.context });
6101
- return Timeline.fromChords(chords, opts.bars * _chunkXKSO2V5Icjs.beatsPerBar.call(void 0, ts), key);
6310
+ const chords = _chunkB2PW6EHNcjs.generateProgression.call(void 0, { ...opts, key, ts, ctx: this.context });
6311
+ return Timeline.fromChords(chords, opts.bars * _chunkS5BKZZGMcjs.beatsPerBar.call(void 0, ts), key);
6102
6312
  }
6103
6313
  /**
6104
6314
  * A drum part.
@@ -6117,7 +6327,7 @@ var Composer = class _Composer {
6117
6327
  * request is refused rather than answered with 4/4 bars over the change.
6118
6328
  */
6119
6329
  drums(opts) {
6120
- const hits = _chunk5KW7DNCJcjs.generateDrums.call(void 0, { ...opts, ts: this.#unchangingMeter("drums"), ctx: this.context });
6330
+ const hits = _chunkB2PW6EHNcjs.generateDrums.call(void 0, { ...opts, ts: this.#unchangingMeter("drums"), ctx: this.context });
6121
6331
  return Score.of(hits, this.#scoreOptions());
6122
6332
  }
6123
6333
  /**
@@ -6144,9 +6354,9 @@ var Composer = class _Composer {
6144
6354
  const segments = Array.isArray(source) ? source : source.segments;
6145
6355
  const key = this.#requireKey("bass");
6146
6356
  const { instrument, ...rest } = _nullishCoalesce(opts, () => ( {}));
6147
- const notes = _chunk5KW7DNCJcjs.generateBassLine.call(void 0, {
6357
+ const notes = _chunkB2PW6EHNcjs.generateBassLine.call(void 0, {
6148
6358
  ...rest,
6149
- ...instrument === void 0 ? {} : { instrument: _chunkJ772DL3Bcjs.toStringedProfile.call(void 0, instrument, "bass instrument") },
6359
+ ...instrument === void 0 ? {} : { instrument: _chunkCGBADIO5cjs.toStringedProfile.call(void 0, instrument, "bass instrument") },
6150
6360
  segments,
6151
6361
  key,
6152
6362
  ts: this.#openingMeter(),
@@ -6176,7 +6386,7 @@ var Composer = class _Composer {
6176
6386
  counterMelody(melody, opts) {
6177
6387
  const key = this.#requireKey("counterMelody");
6178
6388
  const { timeline, ...rest } = _nullishCoalesce(opts, () => ( {}));
6179
- const notes = _chunk5KW7DNCJcjs.generateCounterMelody.call(void 0, {
6389
+ const notes = _chunkB2PW6EHNcjs.generateCounterMelody.call(void 0, {
6180
6390
  ...rest,
6181
6391
  ...timeline === void 0 ? {} : { timeline: toChordTimeline(timeline) },
6182
6392
  melody: melody.notes,
@@ -6207,7 +6417,7 @@ var Composer = class _Composer {
6207
6417
  * ```
6208
6418
  */
6209
6419
  harmonize(melody, opts) {
6210
- const result = _chunk5KW7DNCJcjs.harmonizeMelody.call(void 0, {
6420
+ const result = _chunkB2PW6EHNcjs.harmonizeMelody.call(void 0, {
6211
6421
  ...opts,
6212
6422
  melody: melody.notes,
6213
6423
  ...this.#key === void 0 ? {} : { key: this.#key },
@@ -6218,7 +6428,7 @@ var Composer = class _Composer {
6218
6428
  const totalBeats = harmonizedSpan(
6219
6429
  moved.totalBeats,
6220
6430
  result.chords,
6221
- _chunkXKSO2V5Icjs.beatsPerBar.call(void 0, this.#openingMeter())
6431
+ _chunkS5BKZZGMcjs.beatsPerBar.call(void 0, this.#openingMeter())
6222
6432
  );
6223
6433
  return {
6224
6434
  chords: Timeline.fromChords(result.chords, totalBeats, result.key),
@@ -6228,6 +6438,73 @@ var Composer = class _Composer {
6228
6438
  transposeSemitones: result.transposeSemitones
6229
6439
  };
6230
6440
  }
6441
+ /**
6442
+ * A composition plan derived from a reference profile.
6443
+ *
6444
+ * The composer's key is the plan's home key unless `opts.key` names another,
6445
+ * and its seed and algorithm version are the ones the plan records, so the
6446
+ * plan is written under the same recipe as the composer's other parts.
6447
+ *
6448
+ * @param reference The reference profile to derive from.
6449
+ * @param opts Everything {@link deriveCompositionPlan} takes but the context,
6450
+ * which is the composer's.
6451
+ * @returns The plan.
6452
+ * @throws If the composer draws from a caller-held `rng`: a plan records its
6453
+ * seed, and a source cannot be written into it.
6454
+ * @example
6455
+ * ```ts
6456
+ * import { Composer, Score } from '@libraz/libcantus';
6457
+ * const notes = [60, 62, 64, 65, 67, 65, 64, 62, 60, 62, 64, 65, 67, 65, 64, 60].map(
6458
+ * (pitch, startBeat) => ({ pitch, startBeat, durationBeat: 1 }),
6459
+ * );
6460
+ * const reference = Score.of(notes, { key: 'C major' }).reference();
6461
+ * const plan = Composer.of({ key: 'D major', seed: 5 }).plan(reference);
6462
+ * plan.seed; // 5
6463
+ * plan.keys[0].scale.rootPc; // 2
6464
+ * ```
6465
+ */
6466
+ plan(reference, opts) {
6467
+ const ctx = this.context;
6468
+ if (ctx.rng !== void 0) {
6469
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
6470
+ "composer plan cannot record a caller-held rng; give the composer a seed instead"
6471
+ );
6472
+ }
6473
+ return _chunkB2PW6EHNcjs.deriveCompositionPlan.call(void 0, reference, {
6474
+ ...this.#key === void 0 ? {} : { key: this.#key },
6475
+ ...opts,
6476
+ ctx
6477
+ });
6478
+ }
6479
+ /**
6480
+ * A melody written to a composition plan.
6481
+ *
6482
+ * The plan is the reproduction recipe, so its seed and algorithm version are
6483
+ * the ones the melody is drawn under, not the composer's. The score is read
6484
+ * in the plan's meter and home key, at the composer's tempo.
6485
+ *
6486
+ * @param plan The plan to follow.
6487
+ * @param opts The budget; see {@link MelodyOptions}.
6488
+ * @returns The melody, as a score.
6489
+ * @example
6490
+ * ```ts
6491
+ * import { Composer, Score } from '@libraz/libcantus';
6492
+ * const notes = [60, 62, 64, 65, 67, 65, 64, 62, 60, 62, 64, 65, 67, 65, 64, 60].map(
6493
+ * (pitch, startBeat) => ({ pitch, startBeat, durationBeat: 1 }),
6494
+ * );
6495
+ * const composer = Composer.of({ key: 'C major', seed: 5 });
6496
+ * const plan = composer.plan(Score.of(notes, { key: 'C major' }).reference());
6497
+ * composer.melody(plan).notes.length > 0; // true
6498
+ * ```
6499
+ */
6500
+ melody(plan, opts) {
6501
+ const notes = _chunkB2PW6EHNcjs.generateMelody.call(void 0, plan, opts);
6502
+ const score = { meters: plan.meters, key: plan.keys[0] };
6503
+ if (this.#options.bpm !== void 0) {
6504
+ score.tempo = this.#options.bpm;
6505
+ }
6506
+ return Score.of(notes, score);
6507
+ }
6231
6508
  /**
6232
6509
  * Whether another composer holds the same settings.
6233
6510
  *
@@ -6280,7 +6557,7 @@ var Composer = class _Composer {
6280
6557
  */
6281
6558
  #requireKey(part) {
6282
6559
  if (this.#key === void 0) {
6283
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(
6560
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
6284
6561
  `composer ${part} needs a key for the part it writes; the composer names none \u2014 give it one, or take the key harmonize reads off a melody and pass it on with with({ key })`
6285
6562
  );
6286
6563
  }
@@ -6294,7 +6571,7 @@ var Composer = class _Composer {
6294
6571
  * reading {@link Score.humanize} and its siblings take.
6295
6572
  */
6296
6573
  #openingMeter() {
6297
- return _chunkXKSO2V5Icjs.meterAt.call(void 0, 0, this.#meters);
6574
+ return _chunkS5BKZZGMcjs.meterAt.call(void 0, 0, this.#meters);
6298
6575
  }
6299
6576
  /**
6300
6577
  * The one signature a part laid out in bars is written against.
@@ -6306,7 +6583,7 @@ var Composer = class _Composer {
6306
6583
  */
6307
6584
  #unchangingMeter(part) {
6308
6585
  if (this.#meters.length > 1) {
6309
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)(
6586
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)(
6310
6587
  `composer ${part} needs one meter for the whole part; the composer changes meter`
6311
6588
  );
6312
6589
  }
@@ -6327,7 +6604,7 @@ var Composer = class _Composer {
6327
6604
 
6328
6605
  // src/model/duration.ts
6329
6606
  function copyDuration(value) {
6330
- _chunk5JJ6EHEZcjs.durationToBeats.call(void 0, value);
6607
+ _chunkNM7UAMC3cjs.durationToBeats.call(void 0, value);
6331
6608
  if (typeof value === "string") {
6332
6609
  return { base: value, dots: 0 };
6333
6610
  }
@@ -6378,7 +6655,7 @@ var Duration = class _Duration {
6378
6655
  * {@link Duration.tieChain} for those.
6379
6656
  */
6380
6657
  static ofBeats(beats, options = {}) {
6381
- return new _Duration(_chunk5JJ6EHEZcjs.beatsToDuration.call(void 0, beats, options));
6658
+ return new _Duration(_chunkNM7UAMC3cjs.beatsToDuration.call(void 0, beats, options));
6382
6659
  }
6383
6660
  /**
6384
6661
  * Spell a length in beats as a chain of tied durations.
@@ -6402,7 +6679,7 @@ var Duration = class _Duration {
6402
6679
  * ```
6403
6680
  */
6404
6681
  static tieChain(beats, options = {}) {
6405
- return _chunk5JJ6EHEZcjs.beatsToTiedDurations.call(void 0, beats, options).map((spelled) => new _Duration(spelled));
6682
+ return _chunkNM7UAMC3cjs.beatsToTiedDurations.call(void 0, beats, options).map((spelled) => new _Duration(spelled));
6406
6683
  }
6407
6684
  /**
6408
6685
  * Wrap a plain duration, or a bare base value as shorthand for an undotted
@@ -6466,7 +6743,7 @@ var Duration = class _Duration {
6466
6743
  * ```
6467
6744
  */
6468
6745
  beats(options = {}) {
6469
- return _chunk5JJ6EHEZcjs.durationToBeats.call(void 0, this.toJSON(), options);
6746
+ return _chunkNM7UAMC3cjs.durationToBeats.call(void 0, this.toJSON(), options);
6470
6747
  }
6471
6748
  /**
6472
6749
  * Whether another duration is written identically.
@@ -6480,7 +6757,7 @@ var Duration = class _Duration {
6480
6757
  */
6481
6758
  equals(other) {
6482
6759
  const b = other.data;
6483
- return this.#base === b.base && this.#dots === b.dots && _optionalChain([this, 'access', _45 => _45.#tuplet, 'optionalAccess', _46 => _46.actual]) === _optionalChain([b, 'access', _47 => _47.tuplet, 'optionalAccess', _48 => _48.actual]) && _optionalChain([this, 'access', _49 => _49.#tuplet, 'optionalAccess', _50 => _50.normal]) === _optionalChain([b, 'access', _51 => _51.tuplet, 'optionalAccess', _52 => _52.normal]);
6760
+ return this.#base === b.base && this.#dots === b.dots && _optionalChain([this, 'access', _52 => _52.#tuplet, 'optionalAccess', _53 => _53.actual]) === _optionalChain([b, 'access', _54 => _54.tuplet, 'optionalAccess', _55 => _55.actual]) && _optionalChain([this, 'access', _56 => _56.#tuplet, 'optionalAccess', _57 => _57.normal]) === _optionalChain([b, 'access', _58 => _58.tuplet, 'optionalAccess', _59 => _59.normal]);
6484
6761
  }
6485
6762
  /**
6486
6763
  * The plain duration, for JSON serialization.
@@ -6547,7 +6824,7 @@ var Meter = class _Meter {
6547
6824
  * is ordinary, such as a meter field read on every keystroke.
6548
6825
  */
6549
6826
  static parse(text) {
6550
- return new _Meter(_chunkXKSO2V5Icjs.parseTimeSignature.call(void 0, text));
6827
+ return new _Meter(_chunkS5BKZZGMcjs.parseTimeSignature.call(void 0, text));
6551
6828
  }
6552
6829
  /**
6553
6830
  * Parse a time signature, reporting failure instead of throwing it.
@@ -6566,7 +6843,7 @@ var Meter = class _Meter {
6566
6843
  * ```
6567
6844
  */
6568
6845
  static tryParse(text) {
6569
- const parsed = _chunkXKSO2V5Icjs.tryParseTimeSignature.call(void 0, text);
6846
+ const parsed = _chunkS5BKZZGMcjs.tryParseTimeSignature.call(void 0, text);
6570
6847
  return parsed.ok ? { ok: true, value: new _Meter(parsed.value) } : parsed;
6571
6848
  }
6572
6849
  /**
@@ -6611,22 +6888,22 @@ var Meter = class _Meter {
6611
6888
  * neither is a signature whose grouping selects the additive reading.
6612
6889
  */
6613
6890
  get isCompound() {
6614
- return _chunkXKSO2V5Icjs.isCompound.call(void 0, this.#ts);
6891
+ return _chunkS5BKZZGMcjs.isCompound.call(void 0, this.#ts);
6615
6892
  }
6616
6893
  /** Length of a bar in quarter-note beats. */
6617
6894
  get beatsPerBar() {
6618
- return _chunkXKSO2V5Icjs.beatsPerBar.call(void 0, this.#ts);
6895
+ return _chunkS5BKZZGMcjs.beatsPerBar.call(void 0, this.#ts);
6619
6896
  }
6620
6897
  /** Main pulses (felt beats) in a bar: 2 in 6/8, 4 in 4/4. */
6621
6898
  get pulsesPerBar() {
6622
- return _chunkXKSO2V5Icjs.pulsesPerBar.call(void 0, this.#ts);
6899
+ return _chunkS5BKZZGMcjs.pulsesPerBar.call(void 0, this.#ts);
6623
6900
  }
6624
6901
  /**
6625
6902
  * Length of one felt beat in quarter-note beats: a quarter note in simple
6626
6903
  * meters, a dotted quarter in compound ones.
6627
6904
  */
6628
6905
  get pulseBeats() {
6629
- return _chunkXKSO2V5Icjs.pulseBeats.call(void 0, this.#ts);
6906
+ return _chunkS5BKZZGMcjs.pulseBeats.call(void 0, this.#ts);
6630
6907
  }
6631
6908
  /**
6632
6909
  * Render the signature as `'n/d'`, or as `'a+b+c/d'` when it carries an
@@ -6649,7 +6926,7 @@ var Meter = class _Meter {
6649
6926
  * ```
6650
6927
  */
6651
6928
  format(opts = {}) {
6652
- return _chunkXKSO2V5Icjs.formatTimeSignature.call(void 0, this.#ts, opts);
6929
+ return _chunkS5BKZZGMcjs.formatTimeSignature.call(void 0, this.#ts, opts);
6653
6930
  }
6654
6931
  /**
6655
6932
  * Metric weight of a position within its bar, on a 0–3 scale: 3 the
@@ -6662,7 +6939,7 @@ var Meter = class _Meter {
6662
6939
  * @throws If the position is not finite.
6663
6940
  */
6664
6941
  weightAt(beatInQuarters) {
6665
- return _chunkXKSO2V5Icjs.metricWeight.call(void 0, beatInQuarters, this.#ts);
6942
+ return _chunkS5BKZZGMcjs.metricWeight.call(void 0, beatInQuarters, this.#ts);
6666
6943
  }
6667
6944
  /**
6668
6945
  * Whether a position is metrically accented — a downbeat or a secondary
@@ -6673,7 +6950,7 @@ var Meter = class _Meter {
6673
6950
  * @throws If the position is not finite.
6674
6951
  */
6675
6952
  isStrongBeat(beatInQuarters) {
6676
- return _chunkXKSO2V5Icjs.isStrongBeat.call(void 0, beatInQuarters, this.#ts);
6953
+ return _chunkS5BKZZGMcjs.isStrongBeat.call(void 0, beatInQuarters, this.#ts);
6677
6954
  }
6678
6955
  /**
6679
6956
  * Convert a position in quarter-note beats to a bar index and in-bar offset.
@@ -6683,7 +6960,7 @@ var Meter = class _Meter {
6683
6960
  * @throws If the position is not finite.
6684
6961
  */
6685
6962
  barPositionAt(beatInQuarters) {
6686
- return _chunkXKSO2V5Icjs.beatToBarPosition.call(void 0, beatInQuarters, this.#ts);
6963
+ return _chunkS5BKZZGMcjs.beatToBarPosition.call(void 0, beatInQuarters, this.#ts);
6687
6964
  }
6688
6965
  /**
6689
6966
  * Render a position as the `bar.beat` a DAW or a score shows: 1-based bar,
@@ -6706,7 +6983,7 @@ var Meter = class _Meter {
6706
6983
  * ```
6707
6984
  */
6708
6985
  formatPosition(beatInQuarters, decimals = 2) {
6709
- return _chunkXKSO2V5Icjs.formatBarPosition.call(void 0, beatInQuarters, this.#ts, decimals);
6986
+ return _chunkS5BKZZGMcjs.formatBarPosition.call(void 0, beatInQuarters, this.#ts, decimals);
6710
6987
  }
6711
6988
  /**
6712
6989
  * Subdivide a span into equal tuplet durations — an eighth-note triplet is
@@ -6718,7 +6995,7 @@ var Meter = class _Meter {
6718
6995
  * @throws If the span is negative or `count` is not a positive integer.
6719
6996
  */
6720
6997
  tuplet(totalBeats, count) {
6721
- return _chunkXKSO2V5Icjs.tuplet.call(void 0, totalBeats, count);
6998
+ return _chunkS5BKZZGMcjs.tuplet.call(void 0, totalBeats, count);
6722
6999
  }
6723
7000
  /**
6724
7001
  * Whether another meter is the same signature, grouping included.
@@ -6736,7 +7013,7 @@ var Meter = class _Meter {
6736
7013
  if (grouping === void 0 || b.grouping === void 0) {
6737
7014
  return this.#ts.numerator === b.numerator && this.#ts.denominator === b.denominator && grouping === b.grouping;
6738
7015
  }
6739
- return this.#ts.numerator === b.numerator && this.#ts.denominator === b.denominator && grouping.length === b.grouping.length && grouping.every((entry, index) => entry === _optionalChain([b, 'access', _53 => _53.grouping, 'optionalAccess', _54 => _54[index]]));
7016
+ return this.#ts.numerator === b.numerator && this.#ts.denominator === b.denominator && grouping.length === b.grouping.length && grouping.every((entry, index) => entry === _optionalChain([b, 'access', _60 => _60.grouping, 'optionalAccess', _61 => _61[index]]));
6740
7017
  }
6741
7018
  /**
6742
7019
  * The plain time signature, for JSON serialization.
@@ -6775,7 +7052,7 @@ function copyCell(cell) {
6775
7052
  return { notes: assertNoteEventArray(cell.notes, "motif notes").map(copyNote2) };
6776
7053
  }
6777
7054
  function chordFrom(chord) {
6778
- return chord === void 0 || chord === null ? chord : _chunkYPB3A3EYcjs.toChordData.call(void 0, chord);
7055
+ return chord === void 0 || chord === null ? chord : _chunk3R3QVKY5cjs.toChordData.call(void 0, chord);
6779
7056
  }
6780
7057
  var Motif = class _Motif {
6781
7058
  #cell;
@@ -6807,7 +7084,7 @@ var Motif = class _Motif {
6807
7084
  * ```
6808
7085
  */
6809
7086
  static generate(opts) {
6810
- return new _Motif(_chunk5KW7DNCJcjs.generateMotif.call(void 0, { ...opts, chord: chordFrom(opts.chord) }));
7087
+ return new _Motif(_chunkB2PW6EHNcjs.generateMotif.call(void 0, { ...opts, chord: chordFrom(opts.chord) }));
6811
7088
  }
6812
7089
  /**
6813
7090
  * Read a run of notes as a motif.
@@ -6837,7 +7114,7 @@ var Motif = class _Motif {
6837
7114
  }
6838
7115
  /** Where the cell stops sounding, measured from its own first onset. */
6839
7116
  get totalBeats() {
6840
- return _chunk5KW7DNCJcjs.cellSpan.call(void 0, this.#cell);
7117
+ return _chunkB2PW6EHNcjs.cellSpan.call(void 0, this.#cell);
6841
7118
  }
6842
7119
  /** A copy of the underlying plain cell. */
6843
7120
  get data() {
@@ -6874,7 +7151,7 @@ var Motif = class _Motif {
6874
7151
  * ```
6875
7152
  */
6876
7153
  transform(kind, amount, key) {
6877
- return new _Motif(_chunk5KW7DNCJcjs.transformMotif.call(void 0, this.#cell, kind, amount, key));
7154
+ return new _Motif(_chunkB2PW6EHNcjs.transformMotif.call(void 0, this.#cell, kind, amount, key));
6878
7155
  }
6879
7156
  /**
6880
7157
  * The cell laid across a span and snapped to the harmony under it.
@@ -6896,7 +7173,7 @@ var Motif = class _Motif {
6896
7173
  */
6897
7174
  develop(timeline, key, bars, ts) {
6898
7175
  const chords = "chordTimeline" in timeline ? timeline.chordTimeline : timeline;
6899
- return new _Motif(_chunk5KW7DNCJcjs.developMotif.call(void 0, this.#cell, chords, key, bars, ts));
7176
+ return new _Motif(_chunkB2PW6EHNcjs.developMotif.call(void 0, this.#cell, chords, key, bars, ts));
6900
7177
  }
6901
7178
  /**
6902
7179
  * How this motif stands to another: the transformation that turns one into
@@ -6910,7 +7187,7 @@ var Motif = class _Motif {
6910
7187
  * @returns The relation, or null when the two stand in none.
6911
7188
  */
6912
7189
  relateTo(other, key) {
6913
- return _chunkXVMJO3QFcjs.relateMotifs.call(void 0, _chunkXVMJO3QFcjs.motifFromNotes.call(void 0, this.#cell.notes), _chunkXVMJO3QFcjs.motifFromNotes.call(void 0, other.notes), key);
7190
+ return _chunkIFZDWIKMcjs.relateMotifs.call(void 0, _chunkIFZDWIKMcjs.motifFromNotes.call(void 0, this.#cell.notes), _chunkIFZDWIKMcjs.motifFromNotes.call(void 0, other.notes), key);
6914
7191
  }
6915
7192
  /**
6916
7193
  * How alike two lines are, in [0, 1].
@@ -6923,7 +7200,7 @@ var Motif = class _Motif {
6923
7200
  * @returns The likeness: 1 for the same line, a transposition of it included.
6924
7201
  */
6925
7202
  similarityTo(other) {
6926
- return _chunkXVMJO3QFcjs.melodicSimilarity.call(void 0, this.#cell.notes, other.notes);
7203
+ return _chunkIFZDWIKMcjs.melodicSimilarity.call(void 0, this.#cell.notes, other.notes);
6927
7204
  }
6928
7205
  /**
6929
7206
  * The cell as a score, so it reaches the rest of the class API.
@@ -6933,7 +7210,7 @@ var Motif = class _Motif {
6933
7210
  * @returns The score holding the cell.
6934
7211
  */
6935
7212
  toScore(opts) {
6936
- return Score.of(_chunk5KW7DNCJcjs.motifToNoteEvents.call(void 0, this.#cell), opts);
7213
+ return Score.of(_chunkB2PW6EHNcjs.motifToNoteEvents.call(void 0, this.#cell), opts);
6937
7214
  }
6938
7215
  /**
6939
7216
  * Whether another motif holds the same notes in the same order.
@@ -6966,10 +7243,10 @@ var PART = "rhythm";
6966
7243
  function copyEvent(event, name) {
6967
7244
  return {
6968
7245
  position: withoutNegativeZero(
6969
- _chunkXKSO2V5Icjs.assertRange.call(void 0, event.position, 0, Number.MAX_SAFE_INTEGER, `${name}.position`)
7246
+ _chunkS5BKZZGMcjs.assertRange.call(void 0, event.position, 0, Number.MAX_SAFE_INTEGER, `${name}.position`)
6970
7247
  ),
6971
7248
  duration: withoutNegativeZero(
6972
- _chunkXKSO2V5Icjs.assertRange.call(void 0, event.duration, 0, Number.MAX_SAFE_INTEGER, `${name}.duration`)
7249
+ _chunkS5BKZZGMcjs.assertRange.call(void 0, event.duration, 0, Number.MAX_SAFE_INTEGER, `${name}.duration`)
6973
7250
  )
6974
7251
  };
6975
7252
  }
@@ -6988,13 +7265,13 @@ function spanOf(events) {
6988
7265
  }
6989
7266
  function toGrid(events) {
6990
7267
  return events.map((event) => ({
6991
- step: event.position / _chunk5KW7DNCJcjs.STEP_BEATS,
7268
+ step: event.position / _chunkB2PW6EHNcjs.STEP_BEATS,
6992
7269
  velocity: GRID_VELOCITY,
6993
7270
  source: event
6994
7271
  }));
6995
7272
  }
6996
7273
  function fromGrid(events, spanBeats) {
6997
- const positions = [...new Set(events.map((event) => event.step * _chunk5KW7DNCJcjs.STEP_BEATS))].sort(
7274
+ const positions = [...new Set(events.map((event) => event.step * _chunkB2PW6EHNcjs.STEP_BEATS))].sort(
6998
7275
  (a, b) => a - b
6999
7276
  );
7000
7277
  return positions.map((position, index) => ({
@@ -7034,8 +7311,8 @@ var Rhythm = class _Rhythm {
7034
7311
  * ```
7035
7312
  */
7036
7313
  static generate(ts, opts) {
7037
- const meter = _chunkXKSO2V5Icjs.meterAt.call(void 0, 0, _chunkXKSO2V5Icjs.toMeterData.call(void 0, ts, "ts"));
7038
- return new _Rhythm({ events: _chunk5KW7DNCJcjs.generateRhythm.call(void 0, meter, opts), ts: meter });
7314
+ const meter = _chunkS5BKZZGMcjs.meterAt.call(void 0, 0, _chunkS5BKZZGMcjs.toMeterData.call(void 0, ts, "ts"));
7315
+ return new _Rhythm({ events: _chunkB2PW6EHNcjs.generateRhythm.call(void 0, meter, opts), ts: meter });
7039
7316
  }
7040
7317
  /**
7041
7318
  * Build a pattern from onsets that already exist.
@@ -7055,7 +7332,7 @@ var Rhythm = class _Rhythm {
7055
7332
  static of(events, ts) {
7056
7333
  return new _Rhythm({
7057
7334
  events: [...assertDataArray(events, "rhythm events")],
7058
- ts: _chunkXKSO2V5Icjs.meterAt.call(void 0, 0, _chunkXKSO2V5Icjs.toMeterData.call(void 0, ts, "ts"))
7335
+ ts: _chunkS5BKZZGMcjs.meterAt.call(void 0, 0, _chunkS5BKZZGMcjs.toMeterData.call(void 0, ts, "ts"))
7059
7336
  });
7060
7337
  }
7061
7338
  /** Rebuild a pattern from the plain data {@link Rhythm.data} hands out. */
@@ -7091,7 +7368,7 @@ var Rhythm = class _Rhythm {
7091
7368
  * @returns The onset count divided by the number of bars it spans.
7092
7369
  */
7093
7370
  density() {
7094
- return _chunk5KW7DNCJcjs.rhythmDensity.call(void 0, this.#data.events, this.#data.ts);
7371
+ return _chunkB2PW6EHNcjs.rhythmDensity.call(void 0, this.#data.events, this.#data.ts);
7095
7372
  }
7096
7373
  /**
7097
7374
  * Drop the onsets carrying the least of the metre.
@@ -7106,7 +7383,7 @@ var Rhythm = class _Rhythm {
7106
7383
  * @throws If the amount is outside [0, 1].
7107
7384
  */
7108
7385
  thin(amount) {
7109
- return this.#withGrid(_chunk5KW7DNCJcjs.thin.call(void 0, toGrid(this.#data.events), amount, this.#data.ts));
7386
+ return this.#withGrid(_chunkB2PW6EHNcjs.thin.call(void 0, toGrid(this.#data.events), amount, this.#data.ts));
7110
7387
  }
7111
7388
  /**
7112
7389
  * Anticipate beats, one sixteenth early.
@@ -7125,10 +7402,10 @@ var Rhythm = class _Rhythm {
7125
7402
  */
7126
7403
  syncopate(amount, ctx) {
7127
7404
  return this.#withGrid(
7128
- _chunk5KW7DNCJcjs.syncopate.call(void 0,
7405
+ _chunkB2PW6EHNcjs.syncopate.call(void 0,
7129
7406
  toGrid(this.#data.events),
7130
7407
  { amount, ts: this.#data.ts },
7131
- _chunk5KW7DNCJcjs.resolveContext.call(void 0, ctx).part(PART)
7408
+ _chunkB2PW6EHNcjs.resolveContext.call(void 0, ctx).part(PART)
7132
7409
  )
7133
7410
  );
7134
7411
  }
@@ -7140,7 +7417,7 @@ var Rhythm = class _Rhythm {
7140
7417
  * @returns The compressed pattern.
7141
7418
  */
7142
7419
  doubleTime() {
7143
- return this.#withGrid(_chunk5KW7DNCJcjs.doubleTime.call(void 0, toGrid(this.#data.events), this.#spanSteps()));
7420
+ return this.#withGrid(_chunkB2PW6EHNcjs.doubleTime.call(void 0, toGrid(this.#data.events), this.#spanSteps()));
7144
7421
  }
7145
7422
  /**
7146
7423
  * Stretch the pattern to twice its length: everything falls half as often.
@@ -7151,7 +7428,7 @@ var Rhythm = class _Rhythm {
7151
7428
  * @returns The stretched pattern.
7152
7429
  */
7153
7430
  halfTime() {
7154
- return this.#withGrid(_chunk5KW7DNCJcjs.halfTime.call(void 0, toGrid(this.#data.events), this.#spanSteps()));
7431
+ return this.#withGrid(_chunkB2PW6EHNcjs.halfTime.call(void 0, toGrid(this.#data.events), this.#spanSteps()));
7155
7432
  }
7156
7433
  /**
7157
7434
  * Keep as much decoration as the ornament dial asks for.
@@ -7168,11 +7445,11 @@ var Rhythm = class _Rhythm {
7168
7445
  */
7169
7446
  ornamentBy(isOrnament, amount, ctx) {
7170
7447
  return this.#withGrid(
7171
- _chunk5KW7DNCJcjs.ornamentBy.call(void 0,
7448
+ _chunkB2PW6EHNcjs.ornamentBy.call(void 0,
7172
7449
  toGrid(this.#data.events),
7173
7450
  (grid) => isOrnament(grid.source),
7174
7451
  amount,
7175
- _chunk5KW7DNCJcjs.resolveContext.call(void 0, ctx).part(PART)
7452
+ _chunkB2PW6EHNcjs.resolveContext.call(void 0, ctx).part(PART)
7176
7453
  )
7177
7454
  );
7178
7455
  }
@@ -7192,12 +7469,12 @@ var Rhythm = class _Rhythm {
7192
7469
  * @throws If a dial is outside [0, 1].
7193
7470
  */
7194
7471
  deform(opts, ctx) {
7195
- const resolved = _chunk5KW7DNCJcjs.resolveContext.call(void 0, ctx);
7196
- const isOrnament = _optionalChain([opts, 'optionalAccess', _55 => _55.isOrnament]);
7472
+ const resolved = _chunkB2PW6EHNcjs.resolveContext.call(void 0, ctx);
7473
+ const isOrnament = _optionalChain([opts, 'optionalAccess', _62 => _62.isOrnament]);
7197
7474
  const options = {
7198
7475
  rhythmic: resolved.rhythmic,
7199
7476
  ornament: resolved.ornament,
7200
- rate: _optionalChain([opts, 'optionalAccess', _56 => _56.rate]),
7477
+ rate: _optionalChain([opts, 'optionalAccess', _63 => _63.rate]),
7201
7478
  spanSteps: this.#spanSteps(),
7202
7479
  ts: this.#data.ts,
7203
7480
  // The transform hands the predicate the events it was given, which carry
@@ -7205,7 +7482,7 @@ var Rhythm = class _Rhythm {
7205
7482
  // grid event the rule reads, so the field is named back here.
7206
7483
  isOrnament: isOrnament === void 0 ? void 0 : (grid) => isOrnament(grid.source)
7207
7484
  };
7208
- return this.#withGrid(_chunk5KW7DNCJcjs.deform.call(void 0, toGrid(this.#data.events), options, resolved.part(PART)));
7485
+ return this.#withGrid(_chunkB2PW6EHNcjs.deform.call(void 0, toGrid(this.#data.events), options, resolved.part(PART)));
7209
7486
  }
7210
7487
  /**
7211
7488
  * Whether one player can sustain the pattern at the context's tempo.
@@ -7219,8 +7496,8 @@ var Rhythm = class _Rhythm {
7219
7496
  * @returns True when the pattern is inside the ceiling.
7220
7497
  */
7221
7498
  withinCeiling(ctx) {
7222
- const resolved = _chunk5KW7DNCJcjs.resolveContext.call(void 0, ctx);
7223
- return _chunk5KW7DNCJcjs.withinCeiling.call(void 0, toGrid(this.#data.events), resolved.bpm, resolved.difficulty);
7499
+ const resolved = _chunkB2PW6EHNcjs.resolveContext.call(void 0, ctx);
7500
+ return _chunkB2PW6EHNcjs.withinCeiling.call(void 0, toGrid(this.#data.events), resolved.bpm, resolved.difficulty);
7224
7501
  }
7225
7502
  /**
7226
7503
  * The pattern as sounding notes at one pitch, in its own meter.
@@ -7244,7 +7521,7 @@ var Rhythm = class _Rhythm {
7244
7521
  * ```
7245
7522
  */
7246
7523
  toScore(pitch, velocity) {
7247
- return Score.of(_chunk5KW7DNCJcjs.rhythmToNoteEvents.call(void 0, this.#data.events, pitch, velocity), {
7524
+ return Score.of(_chunkB2PW6EHNcjs.rhythmToNoteEvents.call(void 0, this.#data.events, pitch, velocity), {
7248
7525
  meters: this.#data.ts
7249
7526
  });
7250
7527
  }
@@ -7268,7 +7545,7 @@ var Rhythm = class _Rhythm {
7268
7545
  }
7269
7546
  /** The pattern's span as a count of sixteenths, for the transforms. */
7270
7547
  #spanSteps() {
7271
- return spanOf(this.#data.events) / _chunk5KW7DNCJcjs.STEP_BEATS;
7548
+ return spanOf(this.#data.events) / _chunkB2PW6EHNcjs.STEP_BEATS;
7272
7549
  }
7273
7550
  /** The same meter carrying the onsets a transform returned. */
7274
7551
  #withGrid(events) {
@@ -7293,7 +7570,7 @@ var MIN_BPM = 0.1;
7293
7570
  var Tempo = class _Tempo {
7294
7571
  #bpm;
7295
7572
  constructor(bpm) {
7296
- this.#bpm = _chunkXKSO2V5Icjs.assertRange.call(void 0, bpm, MIN_BPM, MAX_BPM, "bpm");
7573
+ this.#bpm = _chunkS5BKZZGMcjs.assertRange.call(void 0, bpm, MIN_BPM, MAX_BPM, "bpm");
7297
7574
  }
7298
7575
  /**
7299
7576
  * The one-event tempo map every conversion here is measured against.
@@ -7353,7 +7630,7 @@ var Tempo = class _Tempo {
7353
7630
  * @throws If the position is not finite.
7354
7631
  */
7355
7632
  secondsAt(beat) {
7356
- return _chunk5JJ6EHEZcjs.beatsToSeconds.call(void 0, beat, this.#map);
7633
+ return _chunkNM7UAMC3cjs.beatsToSeconds.call(void 0, beat, this.#map);
7357
7634
  }
7358
7635
  /**
7359
7636
  * The position reached after a number of seconds — the inverse of
@@ -7370,7 +7647,7 @@ var Tempo = class _Tempo {
7370
7647
  * ```
7371
7648
  */
7372
7649
  beatAtSeconds(seconds) {
7373
- return _chunk5JJ6EHEZcjs.secondsToBeats.call(void 0, seconds, this.#map);
7650
+ return _chunkNM7UAMC3cjs.secondsToBeats.call(void 0, seconds, this.#map);
7374
7651
  }
7375
7652
  /**
7376
7653
  * Duration in seconds of a span of beats.
@@ -7383,7 +7660,7 @@ var Tempo = class _Tempo {
7383
7660
  * @throws If the length is negative or not finite.
7384
7661
  */
7385
7662
  secondsOf(lengthBeats) {
7386
- return _chunk5JJ6EHEZcjs.durationToSeconds.call(void 0, 0, lengthBeats, this.#map);
7663
+ return _chunkNM7UAMC3cjs.durationToSeconds.call(void 0, 0, lengthBeats, this.#map);
7387
7664
  }
7388
7665
  /**
7389
7666
  * Convert quarter-note beats to MIDI ticks, rounded to the nearest tick.
@@ -7394,7 +7671,7 @@ var Tempo = class _Tempo {
7394
7671
  * @throws If the position is not finite or `ppq` is not a positive integer.
7395
7672
  */
7396
7673
  ticksAt(beat, ppq) {
7397
- return _chunk5JJ6EHEZcjs.beatsToTicks.call(void 0, beat, ppq);
7674
+ return _chunkNM7UAMC3cjs.beatsToTicks.call(void 0, beat, ppq);
7398
7675
  }
7399
7676
  /**
7400
7677
  * Convert MIDI ticks to quarter-note beats.
@@ -7405,7 +7682,7 @@ var Tempo = class _Tempo {
7405
7682
  * @throws If `ticks` is not an integer or `ppq` is not a positive integer.
7406
7683
  */
7407
7684
  beatAtTicks(ticks, ppq) {
7408
- return _chunk5JJ6EHEZcjs.ticksToBeats.call(void 0, ticks, ppq);
7685
+ return _chunkNM7UAMC3cjs.ticksToBeats.call(void 0, ticks, ppq);
7409
7686
  }
7410
7687
  /**
7411
7688
  * Whether another tempo carries the same marking.
@@ -7465,10 +7742,10 @@ var Tuning = class _Tuning {
7465
7742
  */
7466
7743
  static of(table) {
7467
7744
  const given = assertDataObject(table, "tuning table");
7468
- _chunkXKSO2V5Icjs.assertFiniteNumber.call(void 0, given.divisions, "tuning table.divisions");
7469
- _chunkXKSO2V5Icjs.assertFiniteNumber.call(void 0, given.refFreq, "tuning table.refFreq");
7470
- _chunkXKSO2V5Icjs.assertFiniteNumber.call(void 0, given.refStep, "tuning table.refStep");
7471
- return new _Tuning(_chunk5JJ6EHEZcjs.edo.call(void 0, given.divisions, given.refFreq, given.refStep));
7745
+ _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, given.divisions, "tuning table.divisions");
7746
+ _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, given.refFreq, "tuning table.refFreq");
7747
+ _chunkS5BKZZGMcjs.assertFiniteNumber.call(void 0, given.refStep, "tuning table.refStep");
7748
+ return new _Tuning(_chunkNM7UAMC3cjs.edo.call(void 0, given.divisions, given.refFreq, given.refStep));
7472
7749
  }
7473
7750
  /**
7474
7751
  * Build an equal temperament with `divisions` divisions of the octave.
@@ -7489,7 +7766,7 @@ var Tuning = class _Tuning {
7489
7766
  * ```
7490
7767
  */
7491
7768
  static edo(divisions, refFreq, refStep) {
7492
- return new _Tuning(_chunk5JJ6EHEZcjs.edo.call(void 0, divisions, refFreq, refStep));
7769
+ return new _Tuning(_chunkNM7UAMC3cjs.edo.call(void 0, divisions, refFreq, refStep));
7493
7770
  }
7494
7771
  /**
7495
7772
  * Standard twelve-tone equal temperament, A4 (MIDI 69) = 440 Hz.
@@ -7502,7 +7779,7 @@ var Tuning = class _Tuning {
7502
7779
  * ```
7503
7780
  */
7504
7781
  static twelveTet() {
7505
- return _Tuning.of(_chunk5JJ6EHEZcjs.TWELVE_TET);
7782
+ return _Tuning.of(_chunkNM7UAMC3cjs.TWELVE_TET);
7506
7783
  }
7507
7784
  /**
7508
7785
  * Rebuild a tuning from the plain table {@link Tuning.data} hands out.
@@ -7541,7 +7818,7 @@ var Tuning = class _Tuning {
7541
7818
  * ```
7542
7819
  */
7543
7820
  static ratioToCents(numerator, denominator) {
7544
- return _chunk5JJ6EHEZcjs.ratioToCents.call(void 0, numerator, denominator);
7821
+ return _chunkNM7UAMC3cjs.ratioToCents.call(void 0, numerator, denominator);
7545
7822
  }
7546
7823
  /**
7547
7824
  * The frequency ratio an interval in cents spans, the inverse of
@@ -7559,7 +7836,7 @@ var Tuning = class _Tuning {
7559
7836
  * ```
7560
7837
  */
7561
7838
  static centsToRatio(cents) {
7562
- return _chunk5JJ6EHEZcjs.centsToRatio.call(void 0, cents);
7839
+ return _chunkNM7UAMC3cjs.centsToRatio.call(void 0, cents);
7563
7840
  }
7564
7841
  /**
7565
7842
  * Interval in cents between two frequencies.
@@ -7575,7 +7852,7 @@ var Tuning = class _Tuning {
7575
7852
  * ```
7576
7853
  */
7577
7854
  static centsBetweenFreq(a, b) {
7578
- return _chunk5JJ6EHEZcjs.centsBetweenFreq.call(void 0, a, b);
7855
+ return _chunkNM7UAMC3cjs.centsBetweenFreq.call(void 0, a, b);
7579
7856
  }
7580
7857
  /**
7581
7858
  * Cents by which a five-limit just interval departs from its 12-TET
@@ -7591,7 +7868,7 @@ var Tuning = class _Tuning {
7591
7868
  * ```
7592
7869
  */
7593
7870
  static justDeviationCents(semitoneClass) {
7594
- return _chunk5JJ6EHEZcjs.justDeviationCents.call(void 0, semitoneClass);
7871
+ return _chunkNM7UAMC3cjs.justDeviationCents.call(void 0, semitoneClass);
7595
7872
  }
7596
7873
  /** Step index whose frequency is {@link Tuning.refFreq}. */
7597
7874
  get refStep() {
@@ -7633,7 +7910,7 @@ var Tuning = class _Tuning {
7633
7910
  * ```
7634
7911
  */
7635
7912
  frequencyOf(note, tuning = this.#table) {
7636
- return _chunk5JJ6EHEZcjs.frequencyOf.call(void 0, _chunkXKSO2V5Icjs.noteToMidi.call(void 0, _chunkXKSO2V5Icjs.toNoteData.call(void 0, note)), tuning);
7913
+ return _chunkNM7UAMC3cjs.frequencyOf.call(void 0, _chunkS5BKZZGMcjs.noteToMidi.call(void 0, _chunkS5BKZZGMcjs.toNoteData.call(void 0, note)), tuning);
7637
7914
  }
7638
7915
  /**
7639
7916
  * Frequency in Hz of a step index.
@@ -7655,7 +7932,7 @@ var Tuning = class _Tuning {
7655
7932
  * ```
7656
7933
  */
7657
7934
  frequencyOfStep(step, tuning = this.#table) {
7658
- return _chunk5JJ6EHEZcjs.frequencyOf.call(void 0, step, tuning);
7935
+ return _chunkNM7UAMC3cjs.frequencyOf.call(void 0, step, tuning);
7659
7936
  }
7660
7937
  /**
7661
7938
  * Nearest step index to a frequency, the rounded inverse of
@@ -7672,7 +7949,7 @@ var Tuning = class _Tuning {
7672
7949
  * ```
7673
7950
  */
7674
7951
  nearestStep(freq, tuning = this.#table) {
7675
- return _chunk5JJ6EHEZcjs.nearestStep.call(void 0, freq, tuning);
7952
+ return _chunkNM7UAMC3cjs.nearestStep.call(void 0, freq, tuning);
7676
7953
  }
7677
7954
  /**
7678
7955
  * Step index of a frequency, unrounded.
@@ -7692,7 +7969,7 @@ var Tuning = class _Tuning {
7692
7969
  * ```
7693
7970
  */
7694
7971
  stepOf(freq, tuning = this.#table) {
7695
- return _chunk5JJ6EHEZcjs.stepOf.call(void 0, freq, tuning);
7972
+ return _chunkNM7UAMC3cjs.stepOf.call(void 0, freq, tuning);
7696
7973
  }
7697
7974
  /**
7698
7975
  * How far a frequency sits from its nearest step, in cents; positive means
@@ -7709,7 +7986,7 @@ var Tuning = class _Tuning {
7709
7986
  * ```
7710
7987
  */
7711
7988
  centsFromNearestStep(freq, tuning = this.#table) {
7712
- return _chunk5JJ6EHEZcjs.centsFromNearestStep.call(void 0, freq, tuning);
7989
+ return _chunkNM7UAMC3cjs.centsFromNearestStep.call(void 0, freq, tuning);
7713
7990
  }
7714
7991
  /**
7715
7992
  * Cents spanned by a number of steps.
@@ -7725,7 +8002,7 @@ var Tuning = class _Tuning {
7725
8002
  * ```
7726
8003
  */
7727
8004
  centsOfSteps(steps, tuning = this.#table) {
7728
- return _chunk5JJ6EHEZcjs.centsOfSteps.call(void 0, steps, tuning);
8005
+ return _chunkNM7UAMC3cjs.centsOfSteps.call(void 0, steps, tuning);
7729
8006
  }
7730
8007
  /**
7731
8008
  * Steps spanned by an interval in cents, unrounded — the inverse of
@@ -7742,7 +8019,7 @@ var Tuning = class _Tuning {
7742
8019
  * ```
7743
8020
  */
7744
8021
  stepsOfCents(cents, tuning = this.#table) {
7745
- return _chunk5JJ6EHEZcjs.stepsOfCents.call(void 0, cents, tuning);
8022
+ return _chunkNM7UAMC3cjs.stepsOfCents.call(void 0, cents, tuning);
7746
8023
  }
7747
8024
  /**
7748
8025
  * Whether another tuning divides the octave the same way from the same
@@ -7791,17 +8068,17 @@ var Tuning = class _Tuning {
7791
8068
  function copyPitches(pitches) {
7792
8069
  assertDataArray(pitches, "voicing pitches");
7793
8070
  if (pitches.length === 0) {
7794
- throw new (0, _chunkXKSO2V5Icjs.InvalidInputError)("a voicing must contain at least one pitch");
8071
+ throw new (0, _chunkS5BKZZGMcjs.InvalidInputError)("a voicing must contain at least one pitch");
7795
8072
  }
7796
- return pitches.map((pitch, index) => _chunkXKSO2V5Icjs.assertMidiPitch.call(void 0, pitch, `pitches[${index}]`));
8073
+ return pitches.map((pitch, index) => _chunkS5BKZZGMcjs.assertMidiPitch.call(void 0, pitch, `pitches[${index}]`));
7797
8074
  }
7798
8075
  function spellLine(line, key) {
7799
8076
  return line.map(
7800
- (value) => typeof value === "number" ? _chunkYPB3A3EYcjs.spellPitch.call(void 0, value, key.tonic, key) : _chunkXKSO2V5Icjs.toNoteData.call(void 0, value)
8077
+ (value) => typeof value === "number" ? _chunk3R3QVKY5cjs.spellPitch.call(void 0, value, key.tonic, key) : _chunkS5BKZZGMcjs.toNoteData.call(void 0, value)
7801
8078
  );
7802
8079
  }
7803
8080
  function lineOf(pitches, key) {
7804
- return key === void 0 ? pitches.map((pitch) => _chunkXKSO2V5Icjs.toNoteData.call(void 0, pitch)) : spellLine(pitches, key);
8081
+ return key === void 0 ? pitches.map((pitch) => _chunkS5BKZZGMcjs.toNoteData.call(void 0, pitch)) : spellLine(pitches, key);
7805
8082
  }
7806
8083
  function carriedKeyOf(chord) {
7807
8084
  if (typeof chord !== "object" || chord === null) {
@@ -7811,7 +8088,7 @@ function carriedKeyOf(chord) {
7811
8088
  return typeof key === "object" && key !== null ? key : void 0;
7812
8089
  }
7813
8090
  function withCarriedKey(chord, opts) {
7814
- if (_optionalChain([opts, 'optionalAccess', _57 => _57.key]) !== void 0) {
8091
+ if (_optionalChain([opts, 'optionalAccess', _64 => _64.key]) !== void 0) {
7815
8092
  return opts;
7816
8093
  }
7817
8094
  const key = carriedKeyOf(chord);
@@ -7857,7 +8134,7 @@ var Voicing = class _Voicing {
7857
8134
  * ```
7858
8135
  */
7859
8136
  static forChord(chord, opts) {
7860
- return new _Voicing(_chunkRVS4G4MRcjs.voiceChordStyled.call(void 0, chord, opts));
8137
+ return new _Voicing(_chunk76ZBTRG2cjs.voiceChordStyled.call(void 0, chord, opts));
7861
8138
  }
7862
8139
  /**
7863
8140
  * Realize a chord as one pitch per voice inside the voice ranges, defaulting
@@ -7881,7 +8158,7 @@ var Voicing = class _Voicing {
7881
8158
  * ```
7882
8159
  */
7883
8160
  static satb(chord, opts) {
7884
- return new _Voicing(_chunkRVS4G4MRcjs.voiceChord.call(void 0, _chunkYPB3A3EYcjs.toChordData.call(void 0, chord), withCarriedKey(chord, opts)));
8161
+ return new _Voicing(_chunk76ZBTRG2cjs.voiceChord.call(void 0, _chunk3R3QVKY5cjs.toChordData.call(void 0, chord), withCarriedKey(chord, opts)));
7885
8162
  }
7886
8163
  /**
7887
8164
  * Wrap a plain pitch array, as {@link Voicing.data} hands it out.
@@ -7909,7 +8186,7 @@ var Voicing = class _Voicing {
7909
8186
  * four-voice exercise against.
7910
8187
  */
7911
8188
  static get satbRanges() {
7912
- return _chunkRVS4G4MRcjs.SATB_RANGES.map((range) => ({ min: range.min, max: range.max }));
8189
+ return _chunk76ZBTRG2cjs.SATB_RANGES.map((range) => ({ min: range.min, max: range.max }));
7913
8190
  }
7914
8191
  /** A copy of the sounding MIDI pitches, lowest voice first. */
7915
8192
  get pitches() {
@@ -7952,7 +8229,7 @@ var Voicing = class _Voicing {
7952
8229
  */
7953
8230
  spell(key, chord) {
7954
8231
  assertKeyArgument(key, "voicing key");
7955
- return this.#spelled(_chunkYPB3A3EYcjs.resolveKey.call(void 0, key), chord).map((note) => new Note(note));
8232
+ return this.#spelled(_chunk3R3QVKY5cjs.resolveKey.call(void 0, key), chord).map((note) => new Note(note));
7956
8233
  }
7957
8234
  /**
7958
8235
  * Voice a chord to follow smoothly from this voicing.
@@ -7982,7 +8259,7 @@ var Voicing = class _Voicing {
7982
8259
  * ```
7983
8260
  */
7984
8261
  next(chord, opts) {
7985
- return new _Voicing(_chunkRVS4G4MRcjs.nextVoicing.call(void 0, this.pitches, _chunkYPB3A3EYcjs.toChordData.call(void 0, chord), withCarriedKey(chord, opts)));
8262
+ return new _Voicing(_chunk76ZBTRG2cjs.nextVoicing.call(void 0, this.pitches, _chunk3R3QVKY5cjs.toChordData.call(void 0, chord), withCarriedKey(chord, opts)));
7986
8263
  }
7987
8264
  /**
7988
8265
  * The voice-leading cost from this voicing to another: the summed absolute
@@ -7994,7 +8271,7 @@ var Voicing = class _Voicing {
7994
8271
  * voices and are therefore not comparable.
7995
8272
  */
7996
8273
  costTo(other) {
7997
- return _chunkRVS4G4MRcjs.voiceLeadingCost.call(void 0, this.pitches, other.pitches);
8274
+ return _chunk76ZBTRG2cjs.voiceLeadingCost.call(void 0, this.pitches, other.pitches);
7998
8275
  }
7999
8276
  /**
8000
8277
  * Check the motion from this voicing to another against the four-part rules,
@@ -8025,14 +8302,14 @@ var Voicing = class _Voicing {
8025
8302
  */
8026
8303
  checkTo(other, chords, key, opts) {
8027
8304
  assertKeyArgument(key, "voicing key");
8028
- const resolved = _chunkYPB3A3EYcjs.resolveKey.call(void 0, key);
8029
- const from = _chunkYPB3A3EYcjs.toChordData.call(void 0, chords[0]);
8030
- const to = _chunkYPB3A3EYcjs.toChordData.call(void 0, chords[1]);
8305
+ const resolved = _chunk3R3QVKY5cjs.resolveKey.call(void 0, key);
8306
+ const from = _chunk3R3QVKY5cjs.toChordData.call(void 0, chords[0]);
8307
+ const to = _chunk3R3QVKY5cjs.toChordData.call(void 0, chords[1]);
8031
8308
  const voicings = [
8032
- _chunkRVS4G4MRcjs.spellVoicing.call(void 0, this.pitches, from, resolved),
8033
- _chunkRVS4G4MRcjs.spellVoicing.call(void 0, other.pitches, to, resolved)
8309
+ _chunk76ZBTRG2cjs.spellVoicing.call(void 0, this.pitches, from, resolved),
8310
+ _chunk76ZBTRG2cjs.spellVoicing.call(void 0, other.pitches, to, resolved)
8034
8311
  ];
8035
- return _chunkRVS4G4MRcjs.checkPartWriting.call(void 0, voicings, [from, to], resolved, opts);
8312
+ return _chunk76ZBTRG2cjs.checkPartWriting.call(void 0, voicings, [from, to], resolved, opts);
8036
8313
  }
8037
8314
  /**
8038
8315
  * Mark this voicing, read as a written counterpoint line, against a cantus
@@ -8062,8 +8339,8 @@ var Voicing = class _Voicing {
8062
8339
  */
8063
8340
  species(cantusFirmus, species, mode, opts) {
8064
8341
  assertKeyArgument(mode, "voicing mode");
8065
- const resolved = _chunkYPB3A3EYcjs.resolveKey.call(void 0, mode);
8066
- return _chunkRVS4G4MRcjs.checkSpecies.call(void 0,
8342
+ const resolved = _chunk3R3QVKY5cjs.resolveKey.call(void 0, mode);
8343
+ return _chunk76ZBTRG2cjs.checkSpecies.call(void 0,
8067
8344
  spellLine(cantusFirmus, resolved),
8068
8345
  spellLine(this.#pitches, resolved),
8069
8346
  species,
@@ -8089,8 +8366,8 @@ var Voicing = class _Voicing {
8089
8366
  */
8090
8367
  independence(other, opts) {
8091
8368
  const { key, ...rest } = _nullishCoalesce(opts, () => ( {}));
8092
- const resolved = key === void 0 ? void 0 : _chunkYPB3A3EYcjs.resolveKey.call(void 0, key);
8093
- return _chunkYPB3A3EYcjs.voiceIndependence.call(void 0,
8369
+ const resolved = key === void 0 ? void 0 : _chunk3R3QVKY5cjs.resolveKey.call(void 0, key);
8370
+ return _chunk3R3QVKY5cjs.voiceIndependence.call(void 0,
8094
8371
  lineOf(this.#pitches, resolved),
8095
8372
  lineOf(other.pitches, resolved),
8096
8373
  rest
@@ -8106,7 +8383,8 @@ var Voicing = class _Voicing {
8106
8383
  * @param pitch The candidate MIDI pitch.
8107
8384
  * @param query The candidate's harmonic and voice-leading context.
8108
8385
  * @param opts Set `suggestions: false` to skip the search for safe
8109
- * replacements when the verdict is not safe.
8386
+ * replacements when the verdict is not safe, and `partners: true` to learn
8387
+ * which voice of this voicing, by index, raised each pairwise flag.
8110
8388
  * @returns The verdict, reason bitmask, and optional resolution guidance.
8111
8389
  * @throws If the profile is unknown, a value names no chord or key, or a
8112
8390
  * pitch is not a MIDI pitch in 0..127.
@@ -8120,7 +8398,7 @@ var Voicing = class _Voicing {
8120
8398
  * ```
8121
8399
  */
8122
8400
  safetyOf(pitch, query, opts) {
8123
- return _chunkYPB3A3EYcjs.evaluateSafety.call(void 0, { ...this.#context(query), candidatePitch: pitch }, opts);
8401
+ return _chunk3R3QVKY5cjs.evaluateSafety.call(void 0, { ...this.#context(query), candidatePitch: pitch }, opts);
8124
8402
  }
8125
8403
  /**
8126
8404
  * Enumerate the pitches placeable against these voices in a range, chord
@@ -8135,7 +8413,7 @@ var Voicing = class _Voicing {
8135
8413
  * bound is not a MIDI pitch in 0..127 or is reversed.
8136
8414
  */
8137
8415
  safePitches(query, pitchLow, pitchHigh) {
8138
- return _chunkYPB3A3EYcjs.enumerateSafePitches.call(void 0, this.#context(query), pitchLow, pitchHigh);
8416
+ return _chunk3R3QVKY5cjs.enumerateSafePitches.call(void 0, this.#context(query), pitchLow, pitchHigh);
8139
8417
  }
8140
8418
  /**
8141
8419
  * The n-th inversion of the voicing: the lowest voice taken up an octave, n
@@ -8159,7 +8437,7 @@ var Voicing = class _Voicing {
8159
8437
  * ```
8160
8438
  */
8161
8439
  invert(n) {
8162
- _chunkXKSO2V5Icjs.assertInteger.call(void 0, n, "voicing inversion", -128, 128);
8440
+ _chunkS5BKZZGMcjs.assertInteger.call(void 0, n, "voicing inversion", -128, 128);
8163
8441
  if (n === 0) {
8164
8442
  return this;
8165
8443
  }
@@ -8168,7 +8446,7 @@ var Voicing = class _Voicing {
8168
8446
  const index = n > 0 ? 0 : pitches.length - 1;
8169
8447
  const pitch = pitches[index] + (n > 0 ? 12 : -12);
8170
8448
  pitches.splice(index, 1);
8171
- pitches.push(_chunkXKSO2V5Icjs.assertMidiPitch.call(void 0, pitch, "inverted voice"));
8449
+ pitches.push(_chunkS5BKZZGMcjs.assertMidiPitch.call(void 0, pitch, "inverted voice"));
8172
8450
  pitches.sort((a, b) => a - b);
8173
8451
  }
8174
8452
  return new _Voicing(pitches);
@@ -8208,19 +8486,19 @@ var Voicing = class _Voicing {
8208
8486
  }
8209
8487
  /** Spell the voicing, by the key alone or against a chord as well. */
8210
8488
  #spelled(key, chord) {
8211
- return chord === void 0 ? spellLine(this.#pitches, key) : _chunkRVS4G4MRcjs.spellVoicing.call(void 0, this.pitches, _chunkYPB3A3EYcjs.toChordData.call(void 0, chord), key);
8489
+ return chord === void 0 ? spellLine(this.#pitches, key) : _chunk76ZBTRG2cjs.spellVoicing.call(void 0, this.pitches, _chunk3R3QVKY5cjs.toChordData.call(void 0, chord), key);
8212
8490
  }
8213
8491
  /** The safety context these voices supply, minus the candidate pitch. */
8214
8492
  #context(query) {
8215
- const previous = _optionalChain([query, 'access', _58 => _58.previous, 'optionalAccess', _59 => _59.pitches]);
8493
+ const previous = _optionalChain([query, 'access', _65 => _65.previous, 'optionalAccess', _66 => _66.pitches]);
8216
8494
  const otherVoices = this.#pitches.map((pitch, index) => {
8217
- const prevPitch = _optionalChain([previous, 'optionalAccess', _60 => _60[index]]);
8495
+ const prevPitch = _optionalChain([previous, 'optionalAccess', _67 => _67[index]]);
8218
8496
  return prevPitch === void 0 ? { pitch } : { pitch, prevPitch };
8219
8497
  });
8220
8498
  return {
8221
8499
  profile: query.profile,
8222
- chord: query.chord === null ? null : _chunkYPB3A3EYcjs.toChordData.call(void 0, query.chord),
8223
- key: _chunkYPB3A3EYcjs.resolveKey.call(void 0, query.key).scale,
8500
+ chord: query.chord === null ? null : _chunk3R3QVKY5cjs.toChordData.call(void 0, query.chord),
8501
+ key: _chunk3R3QVKY5cjs.resolveKey.call(void 0, query.key).scale,
8224
8502
  otherVoices,
8225
8503
  strongBeat: query.strongBeat,
8226
8504
  prevPitch: query.prevPitch,
@@ -8249,4 +8527,4 @@ var Voicing = class _Voicing {
8249
8527
 
8250
8528
 
8251
8529
  exports.Interval = Interval; exports.Note = Note; exports.Timeline = Timeline; exports.Progression = Progression; exports.Chord = Chord; exports.Key = Key; exports.Score = Score; exports.Arrangement = Arrangement; exports.Instrument = Instrument; exports.Composer = Composer; exports.Duration = Duration; exports.Meter = Meter; exports.Motif = Motif; exports.Rhythm = Rhythm; exports.Tempo = Tempo; exports.Tuning = Tuning; exports.Voicing = Voicing;
8252
- //# sourceMappingURL=chunk-GDKE6RQW.cjs.map
8530
+ //# sourceMappingURL=chunk-4R2LWV7E.cjs.map