mandioca-tabs-mcp 0.2.13 → 0.2.15

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 (2) hide show
  1. package/index.mjs +630 -148
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -12308,6 +12308,10 @@ function ordenar(mapa) {
12308
12308
  return salida;
12309
12309
  }
12310
12310
  function ticsDeFigura(figura) {
12311
+ return Math.round(ticsExactosDeFigura(figura));
12312
+ }
12313
+ function ticsExactosDeFigura(figura) {
12314
+ if (figura.adorno) return 0;
12311
12315
  let tics = TICS_POR_NEGRA * 4 / figura.valor;
12312
12316
  let agregado = tics;
12313
12317
  for (let i2 = 0; i2 < figura.puntillos; i2++) {
@@ -12317,7 +12321,7 @@ function ticsDeFigura(figura) {
12317
12321
  if (figura.tupletNumerador > 0 && figura.tupletDenominador > 0) {
12318
12322
  tics = tics * figura.tupletDenominador / figura.tupletNumerador;
12319
12323
  }
12320
- return Math.round(tics);
12324
+ return tics;
12321
12325
  }
12322
12326
  function migrarMarcasPorGrado(guardadas, pintarGradosViejo) {
12323
12327
  const salida = {};
@@ -13297,6 +13301,7 @@ function normalizarNota(crudo) {
13297
13301
  deslizamientoEntrada: numero(crudo.deslizamientoEntrada, 0),
13298
13302
  deslizamientoSalida: numero(crudo.deslizamientoSalida, 0),
13299
13303
  armonico: numero(crudo.armonico, 0),
13304
+ armonicoValor: numero(crudo.armonicoValor, 0),
13300
13305
  bend: lista(crudo.bend),
13301
13306
  // ── Los signos de Guitar Pro. Ausente = no lo tenía. ────────────────────
13302
13307
  acento: numero(crudo.acento, 0),
@@ -13790,7 +13795,7 @@ function volcar(documento) {
13790
13795
  const notas = [...notasPorFigura.get(id2) ?? []].sort((a, b) => a.cuerda - b.cuerda);
13791
13796
  totalNotasPista += notas.length;
13792
13797
  return {
13793
- voz: datos.voz,
13798
+ voz: datos.voz + 1,
13794
13799
  tiempo: datos.tiempo,
13795
13800
  duracion: nombreDeDuracion(datos),
13796
13801
  tics: ticsDeFigura(datos),
@@ -14156,6 +14161,25 @@ var init_enBlanco = __esm({
14156
14161
  }
14157
14162
  });
14158
14163
 
14164
+ // packages/model/src/armadura.ts
14165
+ function armaduraEscrita(concierto, transposicion) {
14166
+ if (!transposicion) return concierto;
14167
+ return normalizar(concierto - 7 * transposicion);
14168
+ }
14169
+ function armaduraDeConcierto(escrita, transposicion) {
14170
+ if (!transposicion) return escrita;
14171
+ return normalizar(escrita + 7 * transposicion);
14172
+ }
14173
+ var normalizar;
14174
+ var init_armadura = __esm({
14175
+ "packages/model/src/armadura.ts"() {
14176
+ normalizar = (quintas) => {
14177
+ const k = (quintas % 12 + 12) % 12;
14178
+ return k > 6 ? k - 12 : k;
14179
+ };
14180
+ }
14181
+ });
14182
+
14159
14183
  // packages/model/src/index.ts
14160
14184
  var init_src2 = __esm({
14161
14185
  "packages/model/src/index.ts"() {
@@ -14168,6 +14192,7 @@ var init_src2 = __esm({
14168
14192
  init_migrar();
14169
14193
  init_kit();
14170
14194
  init_tipos();
14195
+ init_armadura();
14171
14196
  }
14172
14197
  });
14173
14198
 
@@ -14184,7 +14209,7 @@ function posicionesEscribibles(indice, cursor) {
14184
14209
  }
14185
14210
  function cursorInicial(indice, pistaId) {
14186
14211
  const pista = pistaId !== void 0 ? indice.pista(pistaId) : indice.pistas[0];
14187
- return normalizar(indice, {
14212
+ return normalizar2(indice, {
14188
14213
  pistaId: pista?.id ?? "",
14189
14214
  compas: 0,
14190
14215
  voz: 0,
@@ -14192,7 +14217,7 @@ function cursorInicial(indice, pistaId) {
14192
14217
  cuerda: 1
14193
14218
  });
14194
14219
  }
14195
- function normalizar(indice, cursor) {
14220
+ function normalizar2(indice, cursor) {
14196
14221
  const pista = indice.pista(cursor.pistaId) ?? indice.pistas[0];
14197
14222
  const cuerdas = pista?.datos.afinacion.length ?? 6;
14198
14223
  const ultimoCompas = Math.max(0, indice.cantidadDeCompases - 1);
@@ -14345,6 +14370,50 @@ var init_dinamicas = __esm({
14345
14370
  }
14346
14371
  });
14347
14372
 
14373
+ // packages/editor/src/ligaduras.ts
14374
+ function repararLigaduras(documento, pistas, modo) {
14375
+ const indice = indexar(documento);
14376
+ let tocadas = 0;
14377
+ for (const pistaId of new Set(pistas)) {
14378
+ if (indice.pista(pistaId)?.datos.tipo !== "trastes") continue;
14379
+ const ultimas = /* @__PURE__ */ new Map();
14380
+ for (let c = 0; c < indice.cantidadDeCompases; c++) {
14381
+ const figuras = [...indice.figuras(indice.compasId(pistaId, c))].sort(
14382
+ (a, b) => a.datos.voz - b.datos.voz || a.datos.tiempo - b.datos.tiempo
14383
+ );
14384
+ for (const figura of figuras) {
14385
+ for (const nota of indice.notas(figura.id)) {
14386
+ const clave = `${figura.datos.voz}|${nota.datos.cuerda}`;
14387
+ const origen = ultimas.get(clave);
14388
+ const mapa = documento.notas.get(nota.id);
14389
+ let traste = nota.datos.traste;
14390
+ if (nota.datos.ligadaAAnterior && mapa) {
14391
+ if (origen === void 0) {
14392
+ mapa.set("ligadaAAnterior", false);
14393
+ tocadas++;
14394
+ } else if (origen !== traste) {
14395
+ if (modo === "seguir") {
14396
+ mapa.set("traste", origen);
14397
+ traste = origen;
14398
+ } else {
14399
+ mapa.set("ligadaAAnterior", false);
14400
+ }
14401
+ tocadas++;
14402
+ }
14403
+ }
14404
+ ultimas.set(clave, traste);
14405
+ }
14406
+ }
14407
+ }
14408
+ }
14409
+ return tocadas;
14410
+ }
14411
+ var init_ligaduras = __esm({
14412
+ "packages/editor/src/ligaduras.ts"() {
14413
+ init_src2();
14414
+ }
14415
+ });
14416
+
14348
14417
  // packages/editor/src/comandos.ts
14349
14418
  function masLarga(duracion) {
14350
14419
  const i2 = VALORES.indexOf(duracion.valor);
@@ -14384,7 +14453,12 @@ function escribirEnLaCuerda(documento, indice, cursor, cuerda, resolverTraste, d
14384
14453
  let notaId;
14385
14454
  if (notaExistente && figuraExistente && figuraId === figuraExistente.id) {
14386
14455
  notaId = notaExistente.id;
14387
- documento.notas.get(notaId)?.set("traste", traste);
14456
+ const mapa = documento.notas.get(notaId);
14457
+ mapa?.set("traste", traste);
14458
+ if (traste !== notaExistente.datos.traste) {
14459
+ if (notaExistente.datos.ligadaAAnterior) mapa?.set("ligadaAAnterior", false);
14460
+ repararLigaduras(documento, [cursor.pistaId], "seguir");
14461
+ }
14388
14462
  } else {
14389
14463
  notaId = documento.agregarNota(notaNueva(figuraId, cuerda, traste));
14390
14464
  }
@@ -14457,6 +14531,9 @@ function borrarPercusion(documento, indice, cursor, articulacion) {
14457
14531
  function escribirTraste(documento, indice, cursor, cuerda, traste, opciones = {}) {
14458
14532
  const tope = opciones.maxTraste ?? MAX_TRASTE;
14459
14533
  const acotado = Math.max(0, Math.min(tope, Math.round(traste)));
14534
+ const pista = indice.pista(cursor.pistaId);
14535
+ const cuerdas = pista?.datos.afinacion.length ?? 0;
14536
+ if (pista?.datos.tipo === "trastes" && (cuerda < 1 || cuerda > cuerdas || !Number.isInteger(cuerda))) return null;
14460
14537
  return escribirEnLaCuerda(
14461
14538
  documento,
14462
14539
  indice,
@@ -14514,7 +14591,7 @@ function cambiarDuracion(documento, indice, cursor, duracion, seleccion) {
14514
14591
  function retejerLosCompasesDe(documento, golpes) {
14515
14592
  const compases = /* @__PURE__ */ new Map();
14516
14593
  for (const g of golpes) compases.set(`${g.compasId} ${g.voz}`, g);
14517
- for (const { compasId, voz } of compases.values()) retejerVoz(documento, compasId, voz);
14594
+ retejerVoces(documento, compases.values());
14518
14595
  }
14519
14596
  function escalarDuracion(documento, indice, cursor, direccion, seleccion) {
14520
14597
  const golpes = golpesAlcanzados(indice, cursor, seleccion);
@@ -14554,17 +14631,31 @@ function duracionesAlcanzadas(indice, cursor, seleccion) {
14554
14631
  }
14555
14632
  return [...vistas.values()].sort((a, b) => a.valor - b.valor || a.puntillos - b.puntillos);
14556
14633
  }
14557
- function retejerVoz(documento, compasId, voz) {
14558
- const figuras = [];
14634
+ function retejerVoces(documento, voces) {
14635
+ const pedidas = /* @__PURE__ */ new Map();
14636
+ for (const v of voces) {
14637
+ const clave = `${v.compasId} ${v.voz}`;
14638
+ const ya = pedidas.get(clave);
14639
+ if (!ya) pedidas.set(clave, { desde: v.desde, figuras: [] });
14640
+ else if (v.desde !== void 0) ya.desde = ya.desde === void 0 ? v.desde : Math.min(ya.desde, v.desde);
14641
+ }
14642
+ if (pedidas.size === 0) return;
14559
14643
  for (const [id2, entidad] of documento.figuras.entries()) {
14560
- const datos = entidad.toJSON();
14561
- if (datos.compasId === compasId && datos.voz === voz) figuras.push({ id: id2, datos });
14644
+ const compasId = entidad.get("compasId");
14645
+ const voz = entidad.get("voz");
14646
+ const pedida = pedidas.get(`${compasId} ${voz}`);
14647
+ if (pedida) pedida.figuras.push({ id: id2, datos: entidad.toJSON() });
14562
14648
  }
14563
- figuras.sort((a, b) => a.datos.tiempo - b.datos.tiempo);
14564
- let tiempo = figuras[0]?.datos.tiempo ?? 0;
14565
- for (const { id: id2, datos } of figuras) {
14566
- if (datos.tiempo !== tiempo) documento.figuras.get(id2)?.set("tiempo", tiempo);
14567
- tiempo += ticsDeFigura(datos);
14649
+ for (const { desde, figuras } of pedidas.values()) {
14650
+ figuras.sort((a, b) => a.datos.tiempo - b.datos.tiempo);
14651
+ const primera = figuras.findIndex((f) => desde === void 0 || f.datos.tiempo >= desde);
14652
+ if (primera < 0) continue;
14653
+ let exacto = desde ?? figuras[primera].datos.tiempo;
14654
+ for (const { id: id2, datos } of figuras.slice(primera)) {
14655
+ const tiempo = Math.round(exacto);
14656
+ if (datos.tiempo !== tiempo) documento.figuras.get(id2)?.set("tiempo", tiempo);
14657
+ exacto += ticsExactosDeFigura(datos);
14658
+ }
14568
14659
  }
14569
14660
  }
14570
14661
  function figuraNueva(compasId, cursor, duracion) {
@@ -14610,6 +14701,7 @@ var init_comandos = __esm({
14610
14701
  "packages/editor/src/comandos.ts"() {
14611
14702
  init_dinamicas();
14612
14703
  init_src2();
14704
+ init_ligaduras();
14613
14705
  init_seleccion();
14614
14706
  DURACION_INICIAL = { valor: 4, puntillos: 0 };
14615
14707
  VALORES = [1, 2, 4, 8, 16, 32, 64];
@@ -14626,6 +14718,14 @@ var init_comandos = __esm({
14626
14718
  });
14627
14719
 
14628
14720
  // packages/editor/src/pasajes.ts
14721
+ function rellenarConSilencios(documento, compasId, voz, desde, hasta) {
14722
+ let t = desde;
14723
+ while (hasta - t >= ticsDeFigura({ valor: 64, puntillos: 0, tupletNumerador: 0, tupletDenominador: 0 })) {
14724
+ const valor = VALORES.find((v) => ticsDeFigura({ valor: v, puntillos: 0, tupletNumerador: 0, tupletDenominador: 0 }) <= hasta - t);
14725
+ documento.agregarFigura(normalizarFigura({ compasId, voz, tiempo: t, valor, puntillos: 0, esSilencio: true }));
14726
+ t += ticsDeFigura({ valor, puntillos: 0, tupletNumerador: 0, tupletDenominador: 0 });
14727
+ }
14728
+ }
14629
14729
  function copiar(indice, seleccion) {
14630
14730
  const figuras = figurasDelPasaje(indice, seleccion);
14631
14731
  if (figuras.length === 0) return null;
@@ -14684,6 +14784,7 @@ function pegar(documento, indice, cursor, portapapeles2) {
14684
14784
  }
14685
14785
  }
14686
14786
  const aBorrar = [];
14787
+ const restos = [];
14687
14788
  for (const [compasDelTramo, tramo] of tramos) {
14688
14789
  const compasId = indice.compasId(cursor.pistaId, compasDelTramo, cursor.pentagrama);
14689
14790
  for (const figura of indice.figuras(compasId, cursor.voz)) {
@@ -14691,6 +14792,8 @@ function pegar(documento, indice, cursor, portapapeles2) {
14691
14792
  const fin = inicio + ticsDeFigura(figura.datos);
14692
14793
  if (inicio < tramo.hasta && fin > tramo.desde) {
14693
14794
  aBorrar.push({ figuraId: figura.id, notas: indice.notas(figura.id).map((n) => n.id) });
14795
+ if (inicio < tramo.desde) restos.push({ compas: compasDelTramo, desde: inicio, hasta: tramo.desde });
14796
+ if (fin > tramo.hasta) restos.push({ compas: compasDelTramo, desde: tramo.hasta, hasta: fin });
14694
14797
  }
14695
14798
  }
14696
14799
  }
@@ -14729,9 +14832,15 @@ function pegar(documento, indice, cursor, portapapeles2) {
14729
14832
  });
14730
14833
  for (const nota of notas) documento.agregarNota({ ...nota, figuraId });
14731
14834
  }
14732
- for (const compasId of compasesDestino.values()) {
14733
- if (compasId) retejerVoz(documento, compasId, cursor.voz);
14835
+ for (const resto of restos) {
14836
+ const compasId = compasesDestino.get(resto.compas);
14837
+ if (compasId) rellenarConSilencios(documento, compasId, cursor.voz, resto.desde, resto.hasta);
14734
14838
  }
14839
+ retejerVoces(
14840
+ documento,
14841
+ [...compasesDestino.values()].flatMap((compasId) => compasId ? [{ compasId, voz: cursor.voz }] : [])
14842
+ );
14843
+ repararLigaduras(documento, [cursor.pistaId], "soltar");
14735
14844
  });
14736
14845
  return true;
14737
14846
  }
@@ -14775,9 +14884,45 @@ function duplicarUltima(documento, indice, cursor, opciones = {}) {
14775
14884
  };
14776
14885
  return pegar(documento, indice, cursor, portapapeles2);
14777
14886
  }
14887
+ function origenEnElPasaje(indice, pistaId, notaId, enElPasaje) {
14888
+ const datos = enElPasaje.get(notaId);
14889
+ if (!datos) return false;
14890
+ const nota = { datos };
14891
+ const enOrden = [];
14892
+ for (let c = 0; c < indice.cantidadDeCompases; c++)
14893
+ for (const f of [...indice.figuras(indice.compasId(pistaId, c))].sort((a, b) => a.datos.tiempo - b.datos.tiempo))
14894
+ enOrden.push({ id: f.id, voz: f.datos.voz });
14895
+ const donde = enOrden.findIndex((f) => f.id === nota.datos.figuraId);
14896
+ for (let k = donde - 1; k >= 0; k--) {
14897
+ if (enOrden[k].voz !== enOrden[donde].voz) continue;
14898
+ const anterior = indice.notaEnCuerda(enOrden[k].id, nota.datos.cuerda);
14899
+ if (anterior) return enElPasaje.has(anterior.id);
14900
+ }
14901
+ return false;
14902
+ }
14778
14903
  function transponer(documento, indice, seleccion, trastes, maxTraste = MAX_TRASTE) {
14779
14904
  const figuras = figurasDelPasaje(indice, seleccion);
14905
+ const tipo = indice.pista(seleccion.pistaId)?.datos.tipo;
14906
+ if (tipo === "percusion") return { hecho: false, motivo: "no-se-transpone" };
14907
+ if (tipo === "altura") {
14908
+ const alturas = [];
14909
+ for (const figura of figuras) {
14910
+ for (const nota of indice.notas(figura.id)) {
14911
+ if (nota.datos.altura === null || nota.datos.altura === void 0) continue;
14912
+ const nueva = nota.datos.altura + trastes;
14913
+ if (nueva < 0 || nueva > 127) return { hecho: false, motivo: "fuera-del-rango" };
14914
+ alturas.push({ notaId: nota.id, altura: nueva });
14915
+ }
14916
+ }
14917
+ if (alturas.length === 0) return { hecho: false, motivo: "sin-notas" };
14918
+ documento.doc.transact(() => {
14919
+ for (const c of alturas) documento.notas.get(c.notaId)?.set("altura", c.altura);
14920
+ });
14921
+ return { hecho: true, notas: alturas.length };
14922
+ }
14780
14923
  const cambios = [];
14924
+ const enElPasaje = /* @__PURE__ */ new Map();
14925
+ for (const figura of figuras) for (const nota of indice.notas(figura.id)) enElPasaje.set(nota.id, nota.datos);
14781
14926
  for (const figura of figuras) {
14782
14927
  for (const nota of indice.notas(figura.id)) {
14783
14928
  const nuevo = nota.datos.traste + trastes;
@@ -14788,6 +14933,12 @@ function transponer(documento, indice, seleccion, trastes, maxTraste = MAX_TRAST
14788
14933
  if (cambios.length === 0) return { hecho: false, motivo: "sin-notas" };
14789
14934
  documento.doc.transact(() => {
14790
14935
  for (const cambio of cambios) documento.notas.get(cambio.notaId)?.set("traste", cambio.traste);
14936
+ for (const cambio of cambios) {
14937
+ const nota = documento.notas.get(cambio.notaId);
14938
+ if (nota?.get("ligadaAAnterior") && !origenEnElPasaje(indice, seleccion.pistaId, cambio.notaId, enElPasaje))
14939
+ nota.set("ligadaAAnterior", false);
14940
+ }
14941
+ repararLigaduras(documento, [seleccion.pistaId], "seguir");
14791
14942
  });
14792
14943
  return { hecho: true, notas: cambios.length };
14793
14944
  }
@@ -14798,17 +14949,18 @@ function borrarPasaje(documento, indice, seleccion) {
14798
14949
  id: f.id,
14799
14950
  notas: indice.notas(f.id).map((n) => n.id)
14800
14951
  }));
14801
- const compases = new Set(
14802
- figuras.map((f) => indice.compasId(seleccion.pistaId, f.compas, seleccion.pentagrama)).filter(Boolean)
14803
- );
14952
+ const desdeEn = /* @__PURE__ */ new Map();
14953
+ for (const f of figuras) {
14954
+ const compasId = indice.compasId(seleccion.pistaId, f.compas, seleccion.pentagrama);
14955
+ if (compasId) desdeEn.set(compasId, Math.min(desdeEn.get(compasId) ?? Infinity, f.tiempo));
14956
+ }
14804
14957
  documento.doc.transact(() => {
14805
14958
  for (const figura of aBorrar) {
14806
14959
  for (const notaId of figura.notas) documento.notas.delete(notaId);
14807
14960
  documento.figuras.delete(figura.id);
14808
14961
  }
14809
- for (const compasId of compases) {
14810
- if (compasId) retejerVoz(documento, compasId, seleccion.voz);
14811
- }
14962
+ retejerVoces(documento, [...desdeEn].map(([compasId, desde]) => ({ compasId, voz: seleccion.voz, desde })));
14963
+ repararLigaduras(documento, [seleccion.pistaId], "soltar");
14812
14964
  });
14813
14965
  return aBorrar.length;
14814
14966
  }
@@ -14896,6 +15048,7 @@ function borrarCompas(documento, indice, compas) {
14896
15048
  }
14897
15049
  for (const compasId of compases) documento.compases.delete(compasId);
14898
15050
  documento.compasesMaestros.delete(maestro.id);
15051
+ repararLigaduras(documento, indice.pistas.map((p) => p.id), "soltar");
14899
15052
  });
14900
15053
  return true;
14901
15054
  }
@@ -14950,6 +15103,7 @@ function borrarRango(documento, indice, desde, hasta) {
14950
15103
  }
14951
15104
  for (const compasId of compases) documento.compases.delete(compasId);
14952
15105
  for (const id2 of maestros) documento.compasesMaestros.delete(id2);
15106
+ repararLigaduras(documento, indice.pistas.map((p) => p.id), "soltar");
14953
15107
  });
14954
15108
  return maestros.length;
14955
15109
  }
@@ -14974,6 +15128,7 @@ var init_pasajes = __esm({
14974
15128
  "packages/editor/src/pasajes.ts"() {
14975
15129
  init_src2();
14976
15130
  init_comandos();
15131
+ init_ligaduras();
14977
15132
  init_seleccion();
14978
15133
  }
14979
15134
  });
@@ -20780,7 +20935,7 @@ function notasDeLaPista(indice, pistaId) {
20780
20935
  if (!compasId) continue;
20781
20936
  for (const figura of indice.figuras(compasId)) {
20782
20937
  for (const nota of indice.notas(figura.id)) {
20783
- salida.push({ id: nota.id, cuerda: nota.datos.cuerda });
20938
+ salida.push({ id: nota.id, cuerda: nota.datos.cuerda, figuraId: figura.id });
20784
20939
  }
20785
20940
  }
20786
20941
  }
@@ -20817,11 +20972,15 @@ function quitarCuerda(documento, indice, pistaId, donde) {
20817
20972
  const todas = notasDeLaPista(indice, pistaId);
20818
20973
  const aBorrar = todas.filter((n) => n.cuerda === cuerdaQueSeVa);
20819
20974
  const aRenumerar = donde === "grave" ? todas.filter((n) => n.cuerda > 1) : [];
20975
+ const quedan = /* @__PURE__ */ new Map();
20976
+ for (const n of todas) quedan.set(n.figuraId, (quedan.get(n.figuraId) ?? 0) + (n.cuerda === cuerdaQueSeVa ? 0 : 1));
20820
20977
  documento.doc.transact(() => {
20821
20978
  for (const nota of aBorrar) documento.notas.delete(nota.id);
20822
20979
  for (const nota of aRenumerar) {
20823
20980
  documento.notas.get(nota.id)?.set("cuerda", nota.cuerda - 1);
20824
20981
  }
20982
+ for (const [figuraId, cuantas] of quedan)
20983
+ if (cuantas === 0) documento.figuras.get(figuraId)?.set("esSilencio", true);
20825
20984
  documento.pistas.get(pistaId)?.set("afinacion", nuevaAfinacion);
20826
20985
  });
20827
20986
  return { hecho: true, cuerdas: nuevaAfinacion.length, notasBorradas: aBorrar.length };
@@ -21849,6 +22008,11 @@ var init_paneles = __esm({
21849
22008
  principiante: "Empieza la separaci\xF3n con la cantidad elegida. Las partes aparecen como grabaciones nuevas de la obra.",
21850
22009
  profesional: "Lanza la separaci\xF3n."
21851
22010
  },
22011
+ "audio.letra-cerrar": {
22012
+ nombre: "Cerrar la letra",
22013
+ principiante: "Cierra el panel de la letra y vuelve a la partitura. Lo escrito se queda.",
22014
+ profesional: "Cierra el panel de letra."
22015
+ },
21852
22016
  "audio.letra-cancelar": {
21853
22017
  nombre: "Cancelar la sincronizaci\xF3n",
21854
22018
  principiante: "Detiene la sincronizaci\xF3n. La letra escrita se queda y no se cambia nada en la obra.",
@@ -88448,7 +88612,7 @@ function prepararMusicXml(xml) {
88448
88612
  });
88449
88613
  if (atributosMovidos) {
88450
88614
  correcciones.push(
88451
- `${atributosMovidos} cambios de clave, armadura o comp\xE1s escritos antes de la barra pasaron al comp\xE1s siguiente.`
88615
+ `${atributosMovidos} cambios de clave, armadura o comp\xE1s escritos entre las notas se pusieron al principio del comp\xE1s donde rigen.`
88452
88616
  );
88453
88617
  }
88454
88618
  if (acordesSeparados) {
@@ -88469,6 +88633,17 @@ function prepararMusicXml(xml) {
88469
88633
  });
88470
88634
  });
88471
88635
  if (juntados) correcciones.push(`${juntados} indicaciones de texto en varios renglones se juntaron en una.`);
88636
+ let silabas2 = 0;
88637
+ salida = salida.replace(/<lyric\b[^>]*>[\s\S]*?<\/lyric>/g, (lyric) => {
88638
+ const tipo = /<syllabic>\s*(\w+)\s*<\/syllabic>/.exec(lyric)?.[1];
88639
+ if (tipo !== "begin" && tipo !== "middle") return lyric;
88640
+ return lyric.replace(/(<text\b[^>]*>)([\s\S]*?)(<\/text>)/, (m, a, texto4, b) => {
88641
+ if (texto4.trimEnd().endsWith("-")) return m;
88642
+ silabas2++;
88643
+ return `${a}${texto4.trimEnd()}-${b}`;
88644
+ });
88645
+ });
88646
+ if (silabas2) correcciones.push(`${silabas2} s\xEDlabas unidas de la letra se marcaron con su guion.`);
88472
88647
  let tempos = 0;
88473
88648
  salida = salida.replace(/<metronome\b[^>]*>[\s\S]*?<\/metronome>/g, (met) => {
88474
88649
  const unidad = /<beat-unit>\s*([\w-]+)\s*<\/beat-unit>/.exec(met)?.[1];
@@ -88502,6 +88677,16 @@ function rearmar(parte, compases, nuevos) {
88502
88677
  });
88503
88678
  return salida + parte.slice(cursor);
88504
88679
  }
88680
+ function tiempoAl(pedazo) {
88681
+ let t = 0;
88682
+ for (const m of pedazo.matchAll(/<(note|backup|forward)\b[\s\S]*?<\/\1>/g)) {
88683
+ const dur = entero(m[0], /<duration>\s*(\d+)\s*<\/duration>/) ?? 0;
88684
+ if (m[1] === "backup") t -= dur;
88685
+ else if (m[1] === "forward") t += dur;
88686
+ else if (!/<chord\s*\/>/.test(m[0]) && !/<grace\b/.test(m[0])) t += dur;
88687
+ }
88688
+ return t;
88689
+ }
88505
88690
  function moverAtributosDeFinDeCompas(parte) {
88506
88691
  const compases = compasesDe(parte);
88507
88692
  let cuantos = 0;
@@ -88511,15 +88696,18 @@ function moverAtributosDeFinDeCompas(parte) {
88511
88696
  const primeraNota = contenido.search(/<note\b/);
88512
88697
  if (primeraNota >= 0) {
88513
88698
  let llevar = "";
88514
- contenido = contenido.slice(0, primeraNota) + contenido.slice(primeraNota).replace(/<attributes\b[^>]*>([\s\S]*?)<\/attributes>/g, (bloque, adentro) => {
88699
+ let alPrincipio = "";
88700
+ const despues = contenido.slice(primeraNota);
88701
+ contenido = contenido.slice(0, primeraNota) + despues.replace(/<attributes\b[^>]*>([\s\S]*?)<\/attributes>/g, (bloque, adentro, donde) => {
88515
88702
  const hijos = adentro.match(HIJO_QUE_SE_MUEVE);
88516
88703
  if (!hijos) return bloque;
88517
88704
  cuantos += hijos.length;
88518
- llevar += hijos.join("");
88705
+ if (tiempoAl(despues.slice(0, donde)) <= 0) alPrincipio += hijos.join("");
88706
+ else llevar += hijos.join("");
88519
88707
  const resto = adentro.replace(HIJO_QUE_SE_MUEVE, "");
88520
88708
  return resto.trim() ? `<attributes>${resto}</attributes>` : "";
88521
88709
  });
88522
- const entra2 = arrastre;
88710
+ const entra2 = arrastre + alPrincipio;
88523
88711
  arrastre = llevar;
88524
88712
  return (entra2 ? `<attributes>${entra2}</attributes>` : "") + contenido;
88525
88713
  }
@@ -88754,6 +88942,13 @@ var init_musicxmlEntrada = __esm({
88754
88942
  });
88755
88943
 
88756
88944
  // packages/io/src/importarGp.ts
88945
+ function piezaDeBateria(pista, numero2) {
88946
+ if (numero2 < 0) return null;
88947
+ const delArchivo = pista.percussionArticulations ?? [];
88948
+ const midi = numero2 < delArchivo.length ? delArchivo[numero2].outputMidiNumber : SALIDA_DE_ID_GP[numero2] ?? numero2;
88949
+ const buscada = PARIENTE_GM[midi] ?? midi;
88950
+ return KIT.find((p) => p.midi === buscada)?.indice ?? null;
88951
+ }
88757
88952
  function importarGp(bytes, opciones = {}) {
88758
88953
  const xml = textoMusicXml(bytes);
88759
88954
  if (xml === null) {
@@ -88798,18 +88993,21 @@ function importarScore(score, opciones = {}, datos = {}) {
88798
88993
  "La autor\xEDa qued\xF3 sin completar: se import\xF3 como transcripci\xF3n con los datos del archivo. Hay que confirmarla antes de publicar o compartir el documento."
88799
88994
  );
88800
88995
  }
88996
+ const saltosEscritos = saltosDelTexto(score);
88801
88997
  const idsDeCompasMaestro = score.masterBars.map(
88802
88998
  (maestro) => documento.agregarCompasMaestro(normalizarCompasMaestro({
88803
88999
  numerador: maestro.timeSignatureNumerator,
88804
89000
  denominador: maestro.timeSignatureDenominator,
88805
- tonalidad: numeroDeTonalidad(maestro.keySignature),
89001
+ tonalidad: numeroDeTonalidad(tonalidadDeConcierto(score, maestro.index)),
88806
89002
  // ⚠️ El ensayo de un MusicXML (`<rehearsal>A</rehearsal>`) llena sólo `section.marker`;
88807
89003
  // `text` queda vacío y las letras A, B, C… se perdían todas. Un `.gp` trae las dos y
88808
89004
  // manda el texto, como siempre.
88809
89005
  seccion: maestro.section?.text || maestro.section?.marker || "",
88810
- // Solo interesa el cambio de tempo que arranca en este compás; los que caen
88811
- // en el medio son F02 y todavía no tienen dónde ir.
88812
- tempo: maestro.tempoAutomations?.[0]?.value ?? null,
89006
+ // El cambio de tempo que arranca EN este compás. Los que caen a mitad van a su figura
89007
+ // (ver `temposAMitad` abajo).
89008
+ // ⛔ (2026-11-10) Antes era `tempoAutomations[0]` sin mirar dónde caía: un 140 a mitad
89009
+ // del compás 2 se aplicaba desde su principio y la primera mitad sonaba a 140.
89010
+ tempo: maestro.tempoAutomations?.find((a) => a.ratioPosition <= 1e-6)?.value ?? null,
88813
89011
  repiteDesdeAca: maestro.isRepeatStart,
88814
89012
  repiteVeces: maestro.repeatCount,
88815
89013
  // ⚠️ Novena pérdida silenciosa de la misma familia: 2 de los 15 `.gp` de Daniel
@@ -88837,7 +89035,7 @@ function importarScore(score, opciones = {}, datos = {}) {
88837
89035
  //
88838
89036
  // ★ El nombre y no el número, además, porque acá es una LISTA y se lee: un
88839
89037
  // `["JumpDalSegnoAlCoda"]` en el documento dice algo; un `[10]` no.
88840
- direcciones: maestro.directions ? [...maestro.directions].map(
89038
+ direcciones: maestro.directions ? [...saltosEscritos.precisos.get(maestro.index) ?? maestro.directions].map(
88841
89039
  (d) => _barrel_exports$4.Direction[d] ?? String(d)
88842
89040
  ) : []
88843
89041
  }))
@@ -88848,7 +89046,7 @@ function importarScore(score, opciones = {}, datos = {}) {
88848
89046
  const id2 = idsDeCompasMaestro[i2];
88849
89047
  if (id2 !== void 0 && i2 > 0) documento.ponerSaltoDeRenglon(id2, true);
88850
89048
  }
88851
- const letrasDobles = { cuantas: 0 };
89049
+ const letrasDobles = { cuantas: 0, versosDeMas: 0 };
88852
89050
  const tipoDelPentagrama = (p) => p.isPercussion ? "percusion" : p.tuning.length === 0 ? "altura" : "trastes";
88853
89051
  for (const pista of score.tracks) {
88854
89052
  if (pista.staves.length === 0) {
@@ -88863,6 +89061,8 @@ function importarScore(score, opciones = {}, datos = {}) {
88863
89061
  const nombreCortoDePista = variosPentagramas ? `${pista.shortName ?? ""} ${numeroDePentagrama + 1}`.trim() : pista.shortName ?? "";
88864
89062
  const pentagramaEnLaPista = unInstrumento ? numeroDePentagrama : 0;
88865
89063
  const tipo = tipoDelPentagrama(pentagrama);
89064
+ const sinPieza = /* @__PURE__ */ new Map();
89065
+ const articulacionDe = (n) => piezaDeBateria(pista, n.percussionArticulation);
88866
89066
  const idPista = unInstrumento && idDelInstrumento || documento.agregarPista({
88867
89067
  tipo,
88868
89068
  nombre: nombreDePista,
@@ -88940,7 +89140,7 @@ function importarScore(score, opciones = {}, datos = {}) {
88940
89140
  // ★ Acá viene la letra. En la canción de Daniel cada sílaba está escrita
88941
89141
  // como texto del golpe, que es como se hace en la práctica en Guitar Pro.
88942
89142
  // Sin este campo, importar y exportar la borraba sin decir nada.
88943
- texto: textoDelGolpe(golpe, letrasDobles),
89143
+ texto: saltosEscritos.textos.has(golpe) ? "" : textoDelGolpe(golpe, letrasDobles),
88944
89144
  // ═══════════════════════════════════════════════════════════════════
88945
89145
  // ⛔⛔ LOS CIFRADOS DE ACORDE SE PERDÍAN TODOS (2026-11-09)
88946
89146
  // ═══════════════════════════════════════════════════════════════════
@@ -88998,6 +89198,11 @@ function importarScore(score, opciones = {}, datos = {}) {
88998
89198
  })
88999
89199
  );
89000
89200
  for (const nota of golpe.notes) {
89201
+ if (tipo === "percusion" && articulacionDe(nota) === null) {
89202
+ const n = nota.percussionArticulation;
89203
+ sinPieza.set(n, (sinPieza.get(n) ?? 0) + 1);
89204
+ continue;
89205
+ }
89001
89206
  documento.agregarNota(
89002
89207
  normalizarNota({
89003
89208
  figuraId: idFigura,
@@ -89020,7 +89225,7 @@ function importarScore(score, opciones = {}, datos = {}) {
89020
89225
  // `percussionArticulation`, que es lo que `proyectar` le pone. Así la ida y la
89021
89226
  // vuelta son simétricas: lo que se exporta se vuelve a importar idéntico.
89022
89227
  altura: tipo === "altura" ? nota.calculateRealValue(false, false) : null,
89023
- articulacion: tipo === "percusion" ? nota.percussionArticulation : null,
89228
+ articulacion: tipo === "percusion" ? articulacionDe(nota) : null,
89024
89229
  ligadaAAnterior: nota.isTieDestination,
89025
89230
  muerta: nota.isDead,
89026
89231
  fantasma: nota.isGhost,
@@ -89037,6 +89242,8 @@ function importarScore(score, opciones = {}, datos = {}) {
89037
89242
  deslizamientoEntrada: nota.slideInType,
89038
89243
  deslizamientoSalida: nota.slideOutType,
89039
89244
  armonico: nota.harmonicType,
89245
+ // El natural se recalcula del traste al proyectar: se guarda sólo si es otro.
89246
+ armonicoValor: nota.harmonicType !== _barrel_exports$4.HarmonicType.None && nota.harmonicType !== _barrel_exports$4.HarmonicType.Natural ? nota.harmonicValue : 0,
89040
89247
  // ── Los signos de Guitar Pro, a nivel de nota ──────────────────
89041
89248
  acento: nota.accentuated,
89042
89249
  ligaduraDeExpresion: nota.isSlurDestination || nota.slurDestination !== null,
@@ -89072,6 +89279,12 @@ function importarScore(score, opciones = {}, datos = {}) {
89072
89279
  }
89073
89280
  }
89074
89281
  }
89282
+ if (sinPieza.size > 0) {
89283
+ const total = [...sinPieza.values()].reduce((a, b) => a + b, 0);
89284
+ avisos.push(
89285
+ `La bater\xEDa "${pista.name}" trae ${total} golpe(s) de piezas que el kit todav\xEDa no tiene (n\xFAmeros ${[...sinPieza.keys()].join(", ")}): no se importaron, para no cambiarlas por otra pieza.`
89286
+ );
89287
+ }
89075
89288
  }
89076
89289
  }
89077
89290
  if (letrasDobles.cuantas > 0) {
@@ -89079,6 +89292,11 @@ function importarScore(score, opciones = {}, datos = {}) {
89079
89292
  `${letrasDobles.cuantas} golpe(s) tra\xEDan letra Y un texto libre: se guard\xF3 la letra. Tabs lleva un solo texto por golpe.`
89080
89293
  );
89081
89294
  }
89295
+ if (letrasDobles.versosDeMas > 0) {
89296
+ avisos.push(
89297
+ `${letrasDobles.versosDeMas} golpe(s) tra\xEDan letra de un segundo verso o m\xE1s: se guard\xF3 el primero. Tabs lleva un rengl\xF3n de letra.`
89298
+ );
89299
+ }
89082
89300
  const audioEmbebido = importarAudioYSync(score, documento, idsDeCompasMaestro, avisos);
89083
89301
  return { documento, avisos, ...audioEmbebido ? { audioEmbebido } : {} };
89084
89302
  }
@@ -89123,11 +89341,43 @@ function importarAudioYSync(score, documento, idsDeCompasMaestro, avisos) {
89123
89341
  }
89124
89342
  return { fuenteId, bytes };
89125
89343
  }
89344
+ function saltosDelTexto(score) {
89345
+ const precisos = /* @__PURE__ */ new Map();
89346
+ const textos = /* @__PURE__ */ new Set();
89347
+ for (const pista of score.tracks)
89348
+ for (const pentagrama of pista.staves)
89349
+ for (const barra of pentagrama.bars) {
89350
+ const maestro = score.masterBars[barra.index];
89351
+ if (!maestro?.directions) continue;
89352
+ for (const voz of barra.voices)
89353
+ for (const golpe of voz.beats) {
89354
+ const regla = golpe.text ? SALTO_POR_TEXTO[claveDeSalto(golpe.text)] : void 0;
89355
+ if (!regla) continue;
89356
+ const actuales = precisos.get(maestro.index) ?? new Set(maestro.directions);
89357
+ if (!actuales.has(regla[0]) && !actuales.has(regla[1])) continue;
89358
+ actuales.delete(regla[0]);
89359
+ actuales.add(regla[1]);
89360
+ precisos.set(maestro.index, actuales);
89361
+ textos.add(golpe);
89362
+ }
89363
+ }
89364
+ return { precisos, textos };
89365
+ }
89366
+ function tonalidadDeConcierto(score, indice) {
89367
+ const pentagramas = score.tracks.flatMap((t) => t.staves).filter((s) => !s.isPercussion);
89368
+ const llano = pentagramas.find((s) => !s.displayTranspositionPitch && s.bars[indice]);
89369
+ if (llano) return llano.bars[indice].keySignature;
89370
+ const primero = pentagramas.find((s) => s.bars[indice]);
89371
+ if (!primero) return score.masterBars[indice]?.keySignature ?? 0;
89372
+ return armaduraDeConcierto(primero.bars[indice].keySignature, primero.displayTranspositionPitch);
89373
+ }
89126
89374
  function numeroDeTonalidad(armadura) {
89127
89375
  return armadura;
89128
89376
  }
89129
89377
  function textoDelGolpe(golpe, letrasDobles) {
89130
- const letra = (golpe.lyrics ?? []).find((l) => l && l.trim()) ?? "";
89378
+ const versos = golpe.lyrics ?? [];
89379
+ const letra = versos[0]?.trim() ? versos[0] : "";
89380
+ if (versos.slice(1).some((v) => v && v.trim())) letrasDobles.versosDeMas++;
89131
89381
  const libre = golpe.text ?? "";
89132
89382
  if (letra && libre && letra !== libre) letrasDobles.cuantas++;
89133
89383
  return letra || libre;
@@ -89165,24 +89415,107 @@ function ortografiaDe(ortografia, parte, pentagrama, compas, tic, nota) {
89165
89415
  const base = `${parte}|${pentagrama}|${compas}|${tic}|`;
89166
89416
  return ortografia.get(base + nota.calculateRealValue(false, false)) ?? ortografia.get(base + (nota.octave * 12 + nota.tone));
89167
89417
  }
89418
+ var SALIDA_DE_ID_GP, PARIENTE_GM, DIR, SALTO_POR_TEXTO, claveDeSalto;
89168
89419
  var init_importarGp = __esm({
89169
89420
  "packages/io/src/importarGp.ts"() {
89170
89421
  init_alphaTab();
89171
89422
  init_src2();
89423
+ init_src2();
89172
89424
  init_musicxmlEntrada();
89425
+ SALIDA_DE_ID_GP = {
89426
+ 31: 40,
89427
+ 83: 53,
89428
+ 84: 53,
89429
+ 91: 38,
89430
+ 92: 46,
89431
+ 93: 51,
89432
+ 94: 51,
89433
+ 95: 55,
89434
+ 96: 52,
89435
+ 97: 49,
89436
+ 98: 57,
89437
+ 99: 56,
89438
+ 100: 56,
89439
+ 101: 56,
89440
+ 102: 56,
89441
+ 103: 56,
89442
+ 104: 60,
89443
+ 105: 60,
89444
+ 106: 61,
89445
+ 107: 61,
89446
+ 108: 64,
89447
+ 109: 64,
89448
+ 110: 63,
89449
+ 111: 54,
89450
+ 112: 54,
89451
+ 113: 54,
89452
+ 114: 43,
89453
+ 115: 49,
89454
+ 116: 49,
89455
+ 117: 69,
89456
+ 118: 70,
89457
+ 119: 70,
89458
+ 120: 70,
89459
+ 122: 82,
89460
+ 123: 53,
89461
+ 124: 62,
89462
+ 125: 62,
89463
+ 126: 59,
89464
+ 127: 59
89465
+ };
89466
+ PARIENTE_GM = {
89467
+ 35: 36,
89468
+ // bombo acústico → bombo
89469
+ 40: 38,
89470
+ // caja eléctrica → caja
89471
+ 43: 41,
89472
+ // tom de piso agudo → tom de piso
89473
+ 47: 45,
89474
+ // tom medio grave → tom medio
89475
+ 50: 48,
89476
+ // tom muy agudo → tom agudo
89477
+ 57: 49,
89478
+ // crash 2 → crash
89479
+ 59: 51
89480
+ // ride 2 → ride
89481
+ };
89482
+ DIR = _barrel_exports$4.Direction;
89483
+ SALTO_POR_TEXTO = {
89484
+ dsalcoda: [DIR.JumpDalSegno, DIR.JumpDalSegnoAlCoda],
89485
+ dsalcoda2: [DIR.JumpDalSegno, DIR.JumpDalSegnoAlDoubleCoda],
89486
+ dsalfine: [DIR.JumpDalSegno, DIR.JumpDalSegnoAlFine],
89487
+ dssalcoda: [DIR.JumpDalSegno, DIR.JumpDalSegnoSegnoAlCoda],
89488
+ dssalfine: [DIR.JumpDalSegno, DIR.JumpDalSegnoSegnoAlFine],
89489
+ dss: [DIR.JumpDalSegno, DIR.JumpDalSegnoSegno],
89490
+ dcalcoda: [DIR.JumpDaCapo, DIR.JumpDaCapoAlCoda],
89491
+ dcalcoda2: [DIR.JumpDaCapo, DIR.JumpDaCapoAlDoubleCoda],
89492
+ dcalfine: [DIR.JumpDaCapo, DIR.JumpDaCapoAlFine],
89493
+ ds: [DIR.JumpDalSegno, DIR.JumpDalSegno],
89494
+ dc: [DIR.JumpDaCapo, DIR.JumpDaCapo],
89495
+ tocoda: [DIR.JumpDaCoda, DIR.JumpDaCoda],
89496
+ tocoda2: [DIR.JumpDaCoda, DIR.JumpDaDoubleCoda],
89497
+ fine: [DIR.TargetFine, DIR.TargetFine]
89498
+ };
89499
+ claveDeSalto = (texto4) => texto4.toLowerCase().replace(/dals*segno/g, "ds").replace(/das*capo/g, "dc").replace(/[^a-z0-9]/g, "");
89173
89500
  }
89174
89501
  });
89175
89502
 
89176
89503
  // packages/io/src/archivoMtabs.ts
89177
89504
  function formatoQueNecesita(documento) {
89178
89505
  for (const pista of documento.pistas.values()) {
89179
- const pentagramas = pista.get("pentagramas");
89180
- if (typeof pentagramas === "number" && pentagramas > 1) return 5;
89181
89506
  const transposicion = pista.get("transposicion");
89182
- if (typeof transposicion === "number" && transposicion !== 0) return 5;
89507
+ if (typeof transposicion === "number" && transposicion !== 0) return 6;
89508
+ }
89509
+ for (const nota of documento.notas.values()) {
89510
+ const v = nota.get("armonicoValor");
89511
+ if (typeof v === "number" && v !== 0) return 6;
89183
89512
  }
89184
89513
  for (const figura of documento.figuras.values()) {
89185
- if (figura.get("octava") !== void 0 || figura.get("tempo") !== void 0) return 5;
89514
+ if (figura.get("octava") !== void 0 || figura.get("tempo") !== void 0) return 6;
89515
+ }
89516
+ for (const pista of documento.pistas.values()) {
89517
+ const pentagramas = pista.get("pentagramas");
89518
+ if (typeof pentagramas === "number" && pentagramas > 1) return 5;
89186
89519
  }
89187
89520
  return 4;
89188
89521
  }
@@ -89229,6 +89562,9 @@ function desempaquetar(bytes) {
89229
89562
  } catch {
89230
89563
  throw new ArchivoIlegible("El manifiesto del archivo est\xE1 da\xF1ado.");
89231
89564
  }
89565
+ if (!manifiesto || typeof manifiesto !== "object") {
89566
+ throw new ArchivoIlegible("El manifiesto del archivo est\xE1 da\xF1ado.");
89567
+ }
89232
89568
  if (!Number.isFinite(manifiesto.formato) || manifiesto.formato > VERSION_DEL_FORMATO) {
89233
89569
  throw new ArchivoIlegible(
89234
89570
  `Este archivo se guard\xF3 con una versi\xF3n m\xE1s nueva de Mandioca Tabs (formato ${manifiesto.formato}; esta versi\xF3n entiende hasta el ${VERSION_DEL_FORMATO}). Abrirlo igual podr\xEDa borrarte lo que esa versi\xF3n guard\xF3.`
@@ -89262,7 +89598,7 @@ var init_archivoMtabs = __esm({
89262
89598
  "packages/io/src/archivoMtabs.ts"() {
89263
89599
  init_esm();
89264
89600
  init_src2();
89265
- VERSION_DEL_FORMATO = 5;
89601
+ VERSION_DEL_FORMATO = 6;
89266
89602
  MANIFIESTO = "mandioca.json";
89267
89603
  DOCUMENTO = "documento.ydoc";
89268
89604
  CARPETA_DE_AUDIO = "audio/";
@@ -89333,7 +89669,7 @@ function gruposDeTresillo(beats) {
89333
89669
  continue;
89334
89670
  }
89335
89671
  let j = i2;
89336
- while (j + 1 < beats.length && beats[j + 1].tupletNumerator === b.tupletNumerator && beats[j + 1].tupletDenominator === b.tupletDenominator)
89672
+ while (j + 1 < beats.length && beats[j + 1].tupletNumerator === b.tupletNumerator && beats[j + 1].tupletDenominator === b.tupletDenominator && (b.tupletGroup === null || beats[j + 1].tupletGroup === b.tupletGroup))
89337
89673
  j++;
89338
89674
  abren.add(i2);
89339
89675
  cierran.add(j);
@@ -89341,6 +89677,16 @@ function gruposDeTresillo(beats) {
89341
89677
  }
89342
89678
  return { abren, cierran };
89343
89679
  }
89680
+ function saltosDelCompas(master) {
89681
+ const s = [];
89682
+ for (const [direccion, salto] of SALTOS) {
89683
+ if (!master?.directions?.has(direccion)) continue;
89684
+ s.push('<direction placement="above">', "<direction-type>");
89685
+ s.push(salto.simbolo ? `<${salto.simbolo}/>` : `<words>${escapar(salto.texto ?? "")}</words>`);
89686
+ s.push("</direction-type>", `<sound ${salto.sonido}/>`, "</direction>");
89687
+ }
89688
+ return s;
89689
+ }
89344
89690
  function nombreDeFigura(duracion) {
89345
89691
  return NOMBRE_DE_LA_FIGURA2.get(duracion) ?? "quarter";
89346
89692
  }
@@ -89365,6 +89711,8 @@ function posicionDePercusion(staffLine) {
89365
89711
  }
89366
89712
  function escribirNota(note, beat, staff, opciones) {
89367
89713
  const s = ["<note>"];
89714
+ const esAdorno = beat.graceType !== _barrel_exports$4.GraceType.None;
89715
+ if (esAdorno) s.push(beat.graceType === _barrel_exports$4.GraceType.BeforeBeat ? "<grace/>" : '<grace slash="yes"/>');
89368
89716
  if (opciones.esAcorde) s.push("<chord/>");
89369
89717
  const esGolpeDeKit = staff.isPercussion && note.percussionArticulation >= 0;
89370
89718
  if (esGolpeDeKit) {
@@ -89386,7 +89734,7 @@ function escribirNota(note, beat, staff, opciones) {
89386
89734
  s.push(`<octave>${octava}</octave>`);
89387
89735
  s.push("</pitch>");
89388
89736
  }
89389
- s.push(`<duration>${opciones.duracion}</duration>`);
89737
+ if (!esAdorno) s.push(`<duration>${opciones.duracion}</duration>`);
89390
89738
  if (note.isTieDestination) s.push('<tie type="stop"/>');
89391
89739
  if (note.isTieOrigin) s.push('<tie type="start"/>');
89392
89740
  const idDeInstrumento = opciones.instrumentos.get(note.percussionArticulation);
@@ -89417,8 +89765,17 @@ function escribirNota(note, beat, staff, opciones) {
89417
89765
  tecnica.push(`<string>${staff.tuning.length - note.string + 1}</string>`);
89418
89766
  tecnica.push(`<fret>${note.fret}</fret>`);
89419
89767
  }
89420
- if (note.isHammerPullOrigin) tecnica.push('<hammer-on type="start">H</hammer-on>');
89421
- if (note.hammerPullOrigin !== null) tecnica.push('<pull-off type="stop">P</pull-off>');
89768
+ const ligado = (desde, hasta) => hasta >= desde ? "hammer-on" : "pull-off";
89769
+ const origen = note.hammerPullOrigin;
89770
+ if (origen !== null) {
89771
+ const nombre = ligado(origen.fret, note.fret);
89772
+ tecnica.push(`<${nombre} type="stop"/>`);
89773
+ }
89774
+ const destino = note.hammerPullDestination;
89775
+ if (note.isHammerPullOrigin && destino) {
89776
+ const nombre = ligado(note.fret, destino.fret);
89777
+ tecnica.push(`<${nombre} type="start">${nombre === "hammer-on" ? "H" : "P"}</${nombre}>`);
89778
+ }
89422
89779
  if (note.harmonicType !== _barrel_exports$4.HarmonicType.None) tecnica.push("<harmonic/>");
89423
89780
  if (beat.isPalmMute) tecnica.push("<other-technical>palm-mute</other-technical>");
89424
89781
  if (beat.isLetRing) tecnica.push("<other-technical>let-ring</other-technical>");
@@ -89442,9 +89799,14 @@ function letraDelGolpe(beat) {
89442
89799
  const s = [];
89443
89800
  beat.lyrics.forEach((verso, i2) => {
89444
89801
  if (!verso) return;
89802
+ const sigue = verso.endsWith("-") && verso.length > 1;
89803
+ let anterior = beat.previousBeat;
89804
+ while (anterior && !anterior.lyrics?.[i2]) anterior = anterior.previousBeat;
89805
+ const viene = !!anterior?.lyrics?.[i2]?.endsWith("-");
89806
+ const silabico = sigue ? viene ? "middle" : "begin" : viene ? "end" : "single";
89445
89807
  s.push(`<lyric number="${i2 + 1}">`);
89446
- s.push("<syllabic>single</syllabic>");
89447
- s.push(...elemento("text", verso));
89808
+ s.push(`<syllabic>${silabico}</syllabic>`);
89809
+ s.push(...elemento("text", sigue ? verso.slice(0, -1) : verso));
89448
89810
  s.push("</lyric>");
89449
89811
  });
89450
89812
  return s;
@@ -89530,7 +89892,7 @@ function exportarMusicXml(score) {
89530
89892
  for (let indiceDeCompas2 = 0; indiceDeCompas2 < cantidadDeCompases; indiceDeCompas2++) {
89531
89893
  const master = score.masterBars[indiceDeCompas2];
89532
89894
  l.push(`<measure number="${indiceDeCompas2 + 1}">`);
89533
- const fifths = master?.keySignature ?? 0;
89895
+ const fifths = (pentagramas[0]?.bars[indiceDeCompas2] ?? pentagramas[0]?.bars[0])?.keySignature ?? master?.keySignature ?? 0;
89534
89896
  const modo = master?.keySignatureType === _barrel_exports$4.KeySignatureType.Minor ? "minor" : "major";
89535
89897
  const armadura = `${fifths}/${modo}`;
89536
89898
  const numerador = master?.timeSignatureNumerator ?? 4;
@@ -89585,10 +89947,15 @@ function exportarMusicXml(score) {
89585
89947
  clavesAnteriores = firmaDeClaves;
89586
89948
  }
89587
89949
  if (cambios.length > 0) l.push("<attributes>", ...cambios, "</attributes>");
89588
- if (master?.isRepeatStart) {
89950
+ const casilla = master?.alternateEndings ?? 0;
89951
+ const casillaAntes = score.masterBars[indiceDeCompas2 - 1]?.alternateEndings ?? 0;
89952
+ const casillaDespues = score.masterBars[indiceDeCompas2 + 1]?.alternateEndings ?? 0;
89953
+ const numerosDeCasilla = [0, 1, 2, 3, 4, 5, 6, 7].filter((b) => casilla & 1 << b).map((b) => b + 1).join(", ");
89954
+ if (master?.isRepeatStart || casilla && casilla !== casillaAntes) {
89589
89955
  l.push('<barline location="left">');
89590
- l.push("<bar-style>heavy-light</bar-style>");
89591
- l.push('<repeat direction="forward"/>');
89956
+ if (master?.isRepeatStart) l.push("<bar-style>heavy-light</bar-style>");
89957
+ if (casilla && casilla !== casillaAntes) l.push(`<ending number="${numerosDeCasilla}" type="start"/>`);
89958
+ if (master?.isRepeatStart) l.push('<repeat direction="forward"/>');
89592
89959
  l.push("</barline>");
89593
89960
  }
89594
89961
  if (master?.section?.text || master?.section?.marker)
@@ -89599,8 +89966,14 @@ function exportarMusicXml(score) {
89599
89966
  "</direction-type>",
89600
89967
  "</direction>"
89601
89968
  );
89602
- if (indiceDeCompas2 === 0 && score.tempo) {
89603
- const bpm = Math.round(score.tempo);
89969
+ l.push(...saltosDelCompas(master));
89970
+ const ticsDelCompas = DIVISIONES_POR_NEGRA * 4 * numerador / denominador;
89971
+ const tempos = (master?.tempoAutomations ?? []).map((a) => ({ bpm: a.value, desde: a.ratioPosition }));
89972
+ if (indiceDeCompas2 === 0 && score.tempo && !tempos.some((t) => t.desde <= 1e-6))
89973
+ tempos.unshift({ bpm: score.tempo, desde: 0 });
89974
+ for (const t of tempos) {
89975
+ const bpm = Math.round(t.bpm);
89976
+ const offset = Math.round(t.desde * ticsDelCompas);
89604
89977
  l.push(
89605
89978
  '<direction placement="above">',
89606
89979
  "<direction-type>",
@@ -89609,6 +89982,7 @@ function exportarMusicXml(score) {
89609
89982
  `<per-minute>${bpm}</per-minute>`,
89610
89983
  "</metronome>",
89611
89984
  "</direction-type>",
89985
+ ...offset > 0 ? [`<offset>${offset}</offset>`] : [],
89612
89986
  `<sound tempo="${bpm}"/>`,
89613
89987
  "</direction>"
89614
89988
  );
@@ -89627,7 +90001,7 @@ function exportarMusicXml(score) {
89627
90001
  let avance = 0;
89628
90002
  voice.beats.forEach((beat, i2) => {
89629
90003
  const duracion = beat.displayDuration;
89630
- avance += duracion;
90004
+ if (beat.graceType === _barrel_exports$4.GraceType.None) avance += duracion;
89631
90005
  if (beat.isRest || beat.notes.length === 0) {
89632
90006
  l.push(...escribirSilencio2(beat, duracion, indiceDeVoz + 1, numeroDePentagrama));
89633
90007
  return;
@@ -89653,10 +90027,14 @@ function exportarMusicXml(score) {
89653
90027
  hayAlgoEscrito = true;
89654
90028
  });
89655
90029
  }
89656
- if (master?.isRepeatEnd || master?.isDoubleBar) {
90030
+ const cierraCasilla = casilla !== 0 && casilla !== casillaDespues;
90031
+ if (master?.isRepeatEnd || master?.isDoubleBar || cierraCasilla) {
89657
90032
  l.push('<barline location="right">');
89658
- l.push(`<bar-style>${master.isRepeatEnd ? "light-heavy" : "light-light"}</bar-style>`);
89659
- if (master.isRepeatEnd)
90033
+ if (master?.isRepeatEnd || master?.isDoubleBar)
90034
+ l.push(`<bar-style>${master.isRepeatEnd ? "light-heavy" : "light-light"}</bar-style>`);
90035
+ if (cierraCasilla)
90036
+ l.push(`<ending number="${numerosDeCasilla}" type="${master?.isRepeatEnd ? "stop" : "discontinue"}"/>`);
90037
+ if (master?.isRepeatEnd)
89660
90038
  l.push(`<repeat direction="backward" times="${Math.max(2, master.repeatCount)}"/>`);
89661
90039
  l.push("</barline>");
89662
90040
  }
@@ -89701,7 +90079,7 @@ function exportarMusicXmlComprimido(score) {
89701
90079
  { mtime: FECHA_FIJA_DEL_ZIP }
89702
90080
  );
89703
90081
  }
89704
- var DIVISIONES_POR_NEGRA, FECHA_FIJA_DEL_ZIP, PASOS, NOMBRE_DE_LA_FIGURA2, ALTERACION_POR_MODO;
90082
+ var DIVISIONES_POR_NEGRA, FECHA_FIJA_DEL_ZIP, PASOS, NOMBRE_DE_LA_FIGURA2, ALTERACION_POR_MODO, D, SALTOS;
89705
90083
  var init_musicxml = __esm({
89706
90084
  "packages/io/src/musicxml.ts"() {
89707
90085
  init_alphaTab();
@@ -89731,6 +90109,28 @@ var init_musicxml = __esm({
89731
90109
  [256, "256th"]
89732
90110
  ]);
89733
90111
  ALTERACION_POR_MODO = { 2: 0, 3: 1, 4: 2, 5: -1, 6: -2 };
90112
+ D = _barrel_exports$4.Direction;
90113
+ SALTOS = [
90114
+ [D.TargetSegno, { simbolo: "segno", sonido: 'segno="segno"' }],
90115
+ [D.TargetSegnoSegno, { simbolo: "segno", sonido: 'segno="segno2"' }],
90116
+ [D.TargetCoda, { simbolo: "coda", sonido: 'coda="coda"' }],
90117
+ [D.TargetDoubleCoda, { simbolo: "coda", sonido: 'coda="coda2"' }],
90118
+ [D.TargetFine, { texto: "Fine", sonido: 'fine="yes"' }],
90119
+ [D.JumpDaCapo, { texto: "D.C.", sonido: 'dacapo="yes"' }],
90120
+ [D.JumpDaCapoAlCoda, { texto: "D.C. al Coda", sonido: 'dacapo="yes"' }],
90121
+ [D.JumpDaCapoAlDoubleCoda, { texto: "D.C. al Coda 2", sonido: 'dacapo="yes"' }],
90122
+ [D.JumpDaCapoAlFine, { texto: "D.C. al Fine", sonido: 'dacapo="yes"' }],
90123
+ [D.JumpDalSegno, { texto: "D.S.", sonido: 'dalsegno="segno"' }],
90124
+ [D.JumpDalSegnoAlCoda, { texto: "D.S. al Coda", sonido: 'dalsegno="segno"' }],
90125
+ [D.JumpDalSegnoAlDoubleCoda, { texto: "D.S. al Coda 2", sonido: 'dalsegno="segno"' }],
90126
+ [D.JumpDalSegnoAlFine, { texto: "D.S. al Fine", sonido: 'dalsegno="segno"' }],
90127
+ [D.JumpDalSegnoSegno, { texto: "D.S.S.", sonido: 'dalsegno="segno2"' }],
90128
+ [D.JumpDalSegnoSegnoAlCoda, { texto: "D.S.S. al Coda", sonido: 'dalsegno="segno2"' }],
90129
+ [D.JumpDalSegnoSegnoAlDoubleCoda, { texto: "D.S.S. al Coda 2", sonido: 'dalsegno="segno2"' }],
90130
+ [D.JumpDalSegnoSegnoAlFine, { texto: "D.S.S. al Fine", sonido: 'dalsegno="segno2"' }],
90131
+ [D.JumpDaCoda, { texto: "To Coda", sonido: 'tocoda="coda"' }],
90132
+ [D.JumpDaDoubleCoda, { texto: "To Coda 2", sonido: 'tocoda="coda2"' }]
90133
+ ];
89734
90134
  }
89735
90135
  });
89736
90136
 
@@ -89844,7 +90244,7 @@ var init_src4 = __esm({
89844
90244
  });
89845
90245
 
89846
90246
  // apps/mcp/src/obra.ts
89847
- import { readFile, writeFile } from "node:fs/promises";
90247
+ import { readFile, rename, writeFile } from "node:fs/promises";
89848
90248
  import { extname, basename } from "node:path";
89849
90249
  function reconciliarGrabaciones(obra) {
89850
90250
  const fichas = new Set(obra.documento.fuentesDeAudioEnOrden().map((f) => f.id));
@@ -89987,7 +90387,9 @@ async function guardar(rutaPedida) {
89987
90387
  fuentes: obra.fuentes,
89988
90388
  guardado: (/* @__PURE__ */ new Date()).toISOString()
89989
90389
  });
89990
- await writeFile(ruta, paquete);
90390
+ const parcial = `${ruta}.guardando`;
90391
+ await writeFile(parcial, paquete);
90392
+ await rename(parcial, ruta);
89991
90393
  const fichas = new Set(obra.documento.fuentesDeAudioEnOrden().map((f) => f.id));
89992
90394
  const conBytes = new Set(obra.grabaciones.map((g) => g.fuenteId));
89993
90395
  const mudas = [...fichas].filter((id2) => !conBytes.has(id2)).length;
@@ -90067,7 +90469,7 @@ var VERSION_DEL_CONECTOR;
90067
90469
  var init_version = __esm({
90068
90470
  "apps/mcp/src/version.ts"() {
90069
90471
  "use strict";
90070
- VERSION_DEL_CONECTOR = true ? "0.2.13" : null;
90472
+ VERSION_DEL_CONECTOR = true ? "0.2.15" : null;
90071
90473
  }
90072
90474
  });
90073
90475
 
@@ -90419,7 +90821,13 @@ function abrirDeVerdad(puerto) {
90419
90821
  );
90420
90822
  });
90421
90823
  servidor2.on("connection", (conexion, peticion) => {
90422
- const pedida = decodeURIComponent((peticion.url ?? "").replace(/^\/+/, "").split("?")[0] ?? "");
90824
+ let pedida;
90825
+ try {
90826
+ pedida = decodeURIComponent((peticion.url ?? "").replace(/^\/+/, "").split("?")[0] ?? "");
90827
+ } catch {
90828
+ conexion.close(1008, "sala mal escrita");
90829
+ return;
90830
+ }
90423
90831
  const sala = salaValida(pedida) ? pedida : SALA_DE_LA_OBRA;
90424
90832
  const doc = docDeLaSala(sala);
90425
90833
  if (esDeObra(sala) && deLaSala(sala).length > 0) {
@@ -90569,7 +90977,7 @@ async function pedirALaPesta\u00F1a(herramienta, argumentos = {}, msDelAcuse = E
90569
90977
  const p = exigirPesta\u00F1a();
90570
90978
  const canal = await canalDePedidos(p, herramienta);
90571
90979
  const mapa = canal.getMap("pedidos");
90572
- const id2 = `p${siguienteId += 1}`;
90980
+ const id2 = `p${INSTANCIA}-${siguienteId += 1}`;
90573
90981
  try {
90574
90982
  return await new Promise((resolver, rechazar) => {
90575
90983
  let acusado = false;
@@ -90627,7 +91035,7 @@ async function pedirALaPesta\u00F1a(herramienta, argumentos = {}, msDelAcuse = E
90627
91035
  canal.transact(() => mapa.delete(id2));
90628
91036
  }
90629
91037
  }
90630
- var envoltoriosPorDoc, SINCRONIZAR, PRESENCIA, SALA_DE_LA_OBRA, SALA_DE_PEDIDOS, PUERTO_POR_OMISION, ORIGENES_DE_TABS, puente, reclamado, ESPERA_POR_LA_PESTA\u00D1A, mostrador, casillero, TIPOS, abriendo, siguienteId, ESPERA_DEL_ACUSE_MS, LATIDO_MS, LATIDO_DEL_PUENTE_MS, AUSENCIA_PARA_DARLA_POR_IDA_MS, MARGEN_PARA_QUE_ENTRE_MS;
91038
+ var envoltoriosPorDoc, SINCRONIZAR, PRESENCIA, SALA_DE_LA_OBRA, SALA_DE_PEDIDOS, PUERTO_POR_OMISION, ORIGENES_DE_TABS, puente, reclamado, ESPERA_POR_LA_PESTA\u00D1A, mostrador, casillero, TIPOS, abriendo, siguienteId, INSTANCIA, ESPERA_DEL_ACUSE_MS, LATIDO_MS, LATIDO_DEL_PUENTE_MS, AUSENCIA_PARA_DARLA_POR_IDA_MS, MARGEN_PARA_QUE_ENTRE_MS;
90631
91039
  var init_puente = __esm({
90632
91040
  "apps/mcp/src/puente.ts"() {
90633
91041
  "use strict";
@@ -90661,6 +91069,7 @@ var init_puente = __esm({
90661
91069
  );
90662
91070
  abriendo = null;
90663
91071
  siguienteId = 0;
91072
+ INSTANCIA = `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
90664
91073
  ESPERA_DEL_ACUSE_MS = Number(process.env["MANDIOCA_TABS_ACUSE_MS"] ?? 5e3);
90665
91074
  LATIDO_MS = 250;
90666
91075
  LATIDO_DEL_PUENTE_MS = 1e4;
@@ -97989,6 +98398,48 @@ var init_estilo = __esm({
97989
98398
  });
97990
98399
 
97991
98400
  // packages/projection/src/proyectar.ts
98401
+ function silenciosQueLlenan(tics) {
98402
+ const valores = [];
98403
+ let quedan = tics;
98404
+ for (const valor of [1, 2, 4, 8, 16, 32, 64]) {
98405
+ const dura = 3840 / valor;
98406
+ while (quedan >= dura) {
98407
+ valores.push(valor);
98408
+ quedan -= dura;
98409
+ }
98410
+ }
98411
+ return valores;
98412
+ }
98413
+ function valorDeArmonicoNatural(traste) {
98414
+ switch (traste) {
98415
+ case 2:
98416
+ return 2.4;
98417
+ case 3:
98418
+ return 3.2;
98419
+ case 4:
98420
+ case 5:
98421
+ case 7:
98422
+ case 9:
98423
+ case 12:
98424
+ case 16:
98425
+ case 17:
98426
+ case 19:
98427
+ case 24:
98428
+ return traste;
98429
+ case 8:
98430
+ return 8.2;
98431
+ case 10:
98432
+ return 9.6;
98433
+ case 14:
98434
+ case 15:
98435
+ return 14.7;
98436
+ case 21:
98437
+ case 22:
98438
+ return 21.7;
98439
+ default:
98440
+ return 12;
98441
+ }
98442
+ }
97992
98443
  function canalesDeLasPistas(tipos) {
97993
98444
  const libres = Array.from({ length: 16 }, (_, i2) => i2).filter((c) => c !== 9);
97994
98445
  const conAltura = tipos.filter((t) => t !== "percusion").length;
@@ -98142,20 +98593,24 @@ function proyectar(documento, opciones = {}) {
98142
98593
  cantidadDeVoces = Math.max(cantidadDeVoces, datos2.voz + 1);
98143
98594
  }
98144
98595
  }
98596
+ const deLaPista = [...compasesPorPista.entries()].filter(([clave]) => clave.startsWith(`${idPista}|`)).map(([, mapa]) => mapa);
98145
98597
  const acordesEscritos = [];
98146
98598
  maestros.forEach((m, indiceDeCompas2) => {
98147
- const id2 = porMaestro.get(m.id);
98148
- for (const { datos: f } of id2 ? figurasPorCompas.get(id2) ?? [] : []) {
98149
- if (f.acorde) {
98150
- acordesEscritos.push({ compas: indiceDeCompas2, tiempo: f.tiempo, nombre: f.acorde });
98599
+ for (const mapa of deLaPista) {
98600
+ const id2 = mapa.get(m.id);
98601
+ for (const { datos: f } of id2 ? figurasPorCompas.get(id2) ?? [] : []) {
98602
+ if (f.acorde) {
98603
+ acordesEscritos.push({ compas: indiceDeCompas2, tiempo: f.tiempo, nombre: f.acorde });
98604
+ }
98151
98605
  }
98152
98606
  }
98153
98607
  });
98608
+ acordesEscritos.sort((a, b) => a.compas - b.compas || a.tiempo - b.tiempo);
98154
98609
  const acordeVigente = buscadorDeAcorde(acordesEscritos);
98155
98610
  maestros.forEach((maestro, indiceDeCompas2) => {
98156
98611
  const barra = new _barrel_exports$4.Bar();
98157
98612
  pentagrama.addBar(barra);
98158
- barra.keySignature = maestro.datos.tonalidad;
98613
+ barra.keySignature = armaduraEscrita(maestro.datos.tonalidad, pista.transposicion ?? 0);
98159
98614
  barra.simileMark = maestro.datos.repiteAnterior;
98160
98615
  const idCompas = porMaestro.get(maestro.id);
98161
98616
  const figuras = idCompas ? figurasPorCompas.get(idCompas) ?? [] : [];
@@ -98165,8 +98620,8 @@ function proyectar(documento, opciones = {}) {
98165
98620
  barra.clefOttava = datosDelCompas.claveOctava;
98166
98621
  }
98167
98622
  const ticsDelCompas = 960 * 4 * maestro.datos.numerador / maestro.datos.denominador;
98168
- for (const { datos: figura } of figuras) {
98169
- if (!figura.pedal) continue;
98623
+ const conPedal = figuras.map((f) => f.datos).filter((f) => f.pedal).sort((a, b) => a.tiempo - b.tiempo).filter((f, k, todas) => k === 0 || todas[k - 1].tiempo !== f.tiempo);
98624
+ for (const figura of conPedal) {
98170
98625
  const marcador = new _barrel_exports$4.SustainPedalMarker();
98171
98626
  marcador.ratioPosition = ticsDelCompas > 0 ? figura.tiempo / ticsDelCompas : 0;
98172
98627
  marcador.pedalType = figura.pedal - 1;
@@ -98176,7 +98631,17 @@ function proyectar(documento, opciones = {}) {
98176
98631
  const voz = new _barrel_exports$4.Voice();
98177
98632
  barra.addVoice(voz);
98178
98633
  const deEstaVoz = figuras.filter((f) => f.datos.voz === indiceDeVoz).sort((a, b) => a.datos.tiempo - b.datos.tiempo);
98634
+ let posicion = 0;
98179
98635
  for (const { id: idFigura, datos: figura } of deEstaVoz) {
98636
+ if (!figura.adorno && figura.tiempo - posicion >= 30) {
98637
+ for (const valor of silenciosQueLlenan(figura.tiempo - Math.round(posicion))) {
98638
+ const silencio = new _barrel_exports$4.Beat();
98639
+ silencio.duration = valor;
98640
+ voz.addBeat(silencio);
98641
+ }
98642
+ posicion = figura.tiempo;
98643
+ }
98644
+ posicion += figura.adorno ? 0 : ticsExactosDeFigura(figura);
98180
98645
  const golpe = new _barrel_exports$4.Beat();
98181
98646
  golpe.duration = figura.valor;
98182
98647
  golpe.dots = figura.puntillos;
@@ -98265,6 +98730,8 @@ function proyectar(documento, opciones = {}) {
98265
98730
  notaAlphaTab.slideInType = nota.deslizamientoEntrada;
98266
98731
  notaAlphaTab.slideOutType = nota.deslizamientoSalida;
98267
98732
  notaAlphaTab.harmonicType = nota.armonico;
98733
+ if (nota.armonico)
98734
+ notaAlphaTab.harmonicValue = nota.armonicoValor || (nota.armonico === _barrel_exports$4.HarmonicType.Natural ? valorDeArmonicoNatural(nota.traste) : 12);
98268
98735
  notaAlphaTab.vibrato = nota.anchoDeVibrato;
98269
98736
  notaAlphaTab.accentuated = nota.acento;
98270
98737
  notaAlphaTab.isLeftHandTapped = nota.tappingIzquierda;
@@ -122588,7 +123055,16 @@ function duracionDesde(figura, puntillos) {
122588
123055
  return { valor: figura, puntillos: puntillos ?? 0 };
122589
123056
  }
122590
123057
  function ticsDelGolpe(indice, pistaId, compas, voz, golpe, tics, pentagrama = 0) {
122591
- if (tics !== void 0) return tics;
123058
+ if (tics !== void 0) {
123059
+ const maestro = indice.compasMaestro(compas);
123060
+ const largo = maestro ? 3840 * maestro.datos.numerador / maestro.datos.denominador : 3840;
123061
+ if (!Number.isInteger(tics) || tics < 0 || tics >= largo) {
123062
+ throw new ProblemaConLaObra(
123063
+ `${tics} tics queda fuera del comp\xE1s ${compas + 1}, que mide ${largo} (de 0 a ${largo - 1}; 960 por negra).`
123064
+ );
123065
+ }
123066
+ return tics;
123067
+ }
122592
123068
  if (golpe === void 0) return 0;
122593
123069
  const compasId = indice.compasId(pistaId, compas, pentagrama);
122594
123070
  const figuras = indice.figuras(compasId, voz);
@@ -122637,7 +123113,7 @@ function segundaParaLeer(texto4, marcas) {
122637
123113
  // apps/mcp/src/herramientas/documento.ts
122638
123114
  var unaNota = {
122639
123115
  compas: external_exports.number().int().min(1).max(9999),
122640
- cuerda: external_exports.number().int().min(1).max(24, { error: (i2) => `\xAB${i2.input}\xBB no es una cuerda: van de 1 (la m\xE1s grave) a 24.` }).optional().describe("La cuerda, numerada desde la M\xC1S GRAVE empezando en 1. En una guitarra est\xE1ndar, 1 es el mi grave y 6 el mi agudo. Solo en pistas de tablatura."),
123116
+ cuerda: external_exports.number().int().min(1).max(24, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB no es una cuerda: van de 1 (la m\xE1s grave) a 24.` }).optional().describe("La cuerda, numerada desde la M\xC1S GRAVE empezando en 1. En una guitarra est\xE1ndar, 1 es el mi grave y 6 el mi agudo. Solo en pistas de tablatura."),
122641
123117
  altura: external_exports.number().int().min(0).max(127).optional().describe("La altura en n\xFAmero MIDI: 60 es el Do central. Solo en pistas de altura (piano, vientos, cuerdas frotadas, voz)."),
122642
123118
  pieza: external_exports.string().optional().describe("La pieza del kit: \xABBombo\xBB, \xABCaja\xBB, \xABCharles cerrado\xBB\u2026 Solo en pistas de percusi\xF3n. La lista entera la da `piezas_de_bateria`."),
122643
123119
  golpe: external_exports.number().int().min(1).max(999).optional(),
@@ -122912,7 +123388,7 @@ function registrarHerramientasDelDocumento(servidor2) {
122912
123388
  title: "Leer un pasaje",
122913
123389
  description: "La m\xFAsica de un rango de compases: cada golpe con su duraci\xF3n, y cada nota con su cuerda, su traste, su altura MIDI y sus efectos.",
122914
123390
  inputSchema: {
122915
- desde: external_exports.number().int().min(1).max(9999, { error: (i2) => `\xAB${i2.input}\xBB se pasa: va de 1 a 9999.` }).describe("Primer comp\xE1s, como lo lee el m\xFAsico."),
123391
+ desde: external_exports.number().int().min(1).max(9999, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB se pasa: va de 1 a 9999.` }).describe("Primer comp\xE1s, como lo lee el m\xFAsico."),
122916
123392
  hasta: external_exports.number().int().min(1).max(9999).optional().describe("\xDAltimo comp\xE1s, incluido. Por omisi\xF3n, el mismo que `desde`."),
122917
123393
  pista: external_exports.number().int().min(1).max(999).optional().describe("Cu\xE1l pista. Por omisi\xF3n, todas.")
122918
123394
  }
@@ -122969,7 +123445,7 @@ function registrarHerramientasDelDocumento(servidor2) {
122969
123445
  description: "Escribe notas en el golpe que se le diga. **C\xF3mo se nombra cada nota depende del tipo de la pista**: en una de tablatura (guitarra, bajo) se dan `cuerda` y `traste`; en una de altura (piano, vientos, voz) se da `altura`, el n\xFAmero MIDI. Varias notas en el mismo comp\xE1s y el mismo golpe forman un acorde. Es exactamente lo que hace el m\xFAsico en el pliego: usa el mismo comando del editor, as\xED que respeta el retejido de la voz y entra en el deshacer.",
122970
123446
  inputSchema: {
122971
123447
  pista: external_exports.number().int().min(1).max(999).optional(),
122972
- figura: external_exports.number().int().min(1).max(64, { error: (i2) => `\xAB${i2.input}\xBB no es una figura: 1 redonda, 2 blanca, 4 negra, 8 corchea, 16, 32, 64.` }).optional().describe("La duraci\xF3n: 1 redonda, 2 blanca, 4 negra, 8 corchea, 16 semicorchea, 32, 64. Por omisi\xF3n, negra."),
123448
+ figura: external_exports.number().int().min(1).max(64, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB no es una figura: 1 redonda, 2 blanca, 4 negra, 8 corchea, 16, 32, 64.` }).optional().describe("La duraci\xF3n: 1 redonda, 2 blanca, 4 negra, 8 corchea, 16 semicorchea, 32, 64. Por omisi\xF3n, negra."),
122973
123449
  puntillos: external_exports.number().int().min(0).max(2).optional(),
122974
123450
  notas: external_exports.array(external_exports.object({ ...unaNota, traste: external_exports.number().int().min(0).max(24).optional().describe("El traste. 0 es la cuerda al aire. Solo en pistas de tablatura.") })).min(1).describe("Las notas a escribir, en orden.")
122975
123451
  }
@@ -122979,62 +123455,69 @@ function registrarHerramientasDelDocumento(servidor2) {
122979
123455
  empezarUnPaso();
122980
123456
  const duracion = duracionDesde(figura, puntillos);
122981
123457
  const escritas = [];
122982
- for (const nota of notas) {
122983
- const indice = indexar(documento);
122984
- const volcado = volcar(documento);
122985
- const laPista = pistaDelMusico(pista ?? 1, volcado, documento);
122986
- const pistaId = laPista.id;
122987
- const compas = indiceDeCompas(nota.compas, indice);
122988
- const voz = (nota.voz ?? 1) - 1;
122989
- const pentagrama = pentagramaDelMusico(nota.pentagrama, indice, pistaId, pista ?? 1);
122990
- const tiempo = ticsDelGolpe(indice, pistaId, compas, voz, nota.golpe, nota.tics, pentagrama);
122991
- const nombrada = comoSeEscribeLaNota(laPista.tipo, laPista.nombre, pista ?? 1, nota);
122992
- if (nombrada.clase === "altura") {
122993
- const resultado2 = escribirAltura(
122994
- documento,
122995
- indice,
122996
- cursorEn(indice, pistaId, compas, voz, tiempo, 1, pentagrama),
122997
- nombrada.altura,
122998
- duracion ? { duracion } : {}
122999
- );
123000
- if (!resultado2) {
123001
- throw new ProblemaConLaObra(
123002
- `No se pudo escribir la altura ${nombrada.altura} en el comp\xE1s ${nota.compas} de la pista ${pista ?? 1} \xAB${laPista.nombre}\xBB.`
123458
+ const laPista = pistaDelMusico(pista ?? 1, volcar(documento), documento);
123459
+ const pistaId = laPista.id;
123460
+ try {
123461
+ for (const nota of notas) {
123462
+ const indice = indexar(documento);
123463
+ const compas = indiceDeCompas(nota.compas, indice);
123464
+ const voz = (nota.voz ?? 1) - 1;
123465
+ const pentagrama = pentagramaDelMusico(nota.pentagrama, indice, pistaId, pista ?? 1);
123466
+ const tiempo = ticsDelGolpe(indice, pistaId, compas, voz, nota.golpe, nota.tics, pentagrama);
123467
+ const nombrada = comoSeEscribeLaNota(laPista.tipo, laPista.nombre, pista ?? 1, nota);
123468
+ if (nombrada.clase === "altura") {
123469
+ const resultado2 = escribirAltura(
123470
+ documento,
123471
+ indice,
123472
+ cursorEn(indice, pistaId, compas, voz, tiempo, 1, pentagrama),
123473
+ nombrada.altura,
123474
+ duracion ? { duracion } : {}
123003
123475
  );
123476
+ if (!resultado2) {
123477
+ throw new ProblemaConLaObra(
123478
+ `No se pudo escribir la altura ${nombrada.altura} en el comp\xE1s ${nota.compas} de la pista ${pista ?? 1} \xAB${laPista.nombre}\xBB.`
123479
+ );
123480
+ }
123481
+ escritas.push(`c${nota.compas} altura ${nombrada.altura}`);
123482
+ continue;
123004
123483
  }
123005
- escritas.push(`c${nota.compas} altura ${nombrada.altura}`);
123006
- continue;
123007
- }
123008
- if (nombrada.clase === "percusion") {
123009
- const resultado2 = escribirPercusion(
123484
+ if (nombrada.clase === "percusion") {
123485
+ const resultado2 = escribirPercusion(
123486
+ documento,
123487
+ indice,
123488
+ cursorEn(indice, pistaId, compas, voz, tiempo, 1, pentagrama),
123489
+ nombrada.articulacion,
123490
+ duracion ? { duracion } : {}
123491
+ );
123492
+ if (!resultado2) {
123493
+ throw new ProblemaConLaObra(
123494
+ `No se pudo escribir \xAB${nombrada.nombre}\xBB en el comp\xE1s ${nota.compas} de la pista ${pista ?? 1} \xAB${laPista.nombre}\xBB.`
123495
+ );
123496
+ }
123497
+ escritas.push(`c${nota.compas} ${nombrada.nombre}`);
123498
+ continue;
123499
+ }
123500
+ const resultado = escribirTraste(
123010
123501
  documento,
123011
123502
  indice,
123012
- cursorEn(indice, pistaId, compas, voz, tiempo, 1, pentagrama),
123013
- nombrada.articulacion,
123503
+ cursorEn(indice, pistaId, compas, voz, tiempo, nombrada.cuerda, pentagrama),
123504
+ nombrada.cuerda,
123505
+ nombrada.traste,
123014
123506
  duracion ? { duracion } : {}
123015
123507
  );
123016
- if (!resultado2) {
123508
+ if (!resultado) {
123017
123509
  throw new ProblemaConLaObra(
123018
- `No se pudo escribir \xAB${nombrada.nombre}\xBB en el comp\xE1s ${nota.compas} de la pista ${pista ?? 1} \xAB${laPista.nombre}\xBB.`
123510
+ `No se pudo escribir el traste ${nombrada.traste} en la cuerda ${nombrada.cuerda} del comp\xE1s ${nota.compas}. La cuerda ${nombrada.cuerda} puede no existir en esa pista.`
123019
123511
  );
123020
123512
  }
123021
- escritas.push(`c${nota.compas} ${nombrada.nombre}`);
123022
- continue;
123513
+ escritas.push(`c${nota.compas} cuerda ${nombrada.cuerda} traste ${nombrada.traste}`);
123023
123514
  }
123024
- const resultado = escribirTraste(
123025
- documento,
123026
- indice,
123027
- cursorEn(indice, pistaId, compas, voz, tiempo, nombrada.cuerda, pentagrama),
123028
- nombrada.cuerda,
123029
- nombrada.traste,
123030
- duracion ? { duracion } : {}
123515
+ } catch (e) {
123516
+ if (escritas.length > 0) documento.historial().undo();
123517
+ const motivo = e instanceof Error ? e.message : String(e);
123518
+ throw new ProblemaConLaObra(
123519
+ escritas.length > 0 ? `${motivo} No se escribi\xF3 ninguna nota de esta tanda: las ${escritas.length} anteriores se deshicieron.` : motivo
123031
123520
  );
123032
- if (!resultado) {
123033
- throw new ProblemaConLaObra(
123034
- `No se pudo escribir el traste ${nombrada.traste} en la cuerda ${nombrada.cuerda} del comp\xE1s ${nota.compas}. La cuerda ${nombrada.cuerda} puede no existir en esa pista.`
123035
- );
123036
- }
123037
- escritas.push(`c${nota.compas} cuerda ${nombrada.cuerda} traste ${nombrada.traste}`);
123038
123521
  }
123039
123522
  return texto2({ escritas: escritas.length, detalle: escritas });
123040
123523
  }
@@ -123053,11 +123536,10 @@ function registrarHerramientasDelDocumento(servidor2) {
123053
123536
  const { documento } = obraAbierta();
123054
123537
  empezarUnPaso();
123055
123538
  let borradas = 0;
123539
+ const laPista = pistaDelMusico(pista ?? 1, volcar(documento), documento);
123540
+ const pistaId = laPista.id;
123056
123541
  for (const nota of notas) {
123057
123542
  const indice = indexar(documento);
123058
- const volcado = volcar(documento);
123059
- const laPista = pistaDelMusico(pista ?? 1, volcado, documento);
123060
- const pistaId = laPista.id;
123061
123543
  const compas = indiceDeCompas(nota.compas, indice);
123062
123544
  const voz = (nota.voz ?? 1) - 1;
123063
123545
  const pentagrama = pentagramaDelMusico(nota.pentagrama, indice, pistaId, pista ?? 1);
@@ -123318,8 +123800,8 @@ function registrarHerramientasDelPuente(servidor2) {
123318
123800
  title: "Cambiar c\xF3mo se ve la partitura",
123319
123801
  description: "Renglones, horizontal o en hoja, y ver una pista o todas. Sirve para se\xF1alarle algo al m\xFAsico en la maqueta donde se ve mejor.",
123320
123802
  inputSchema: {
123321
- vista: external_exports.enum(["renglones", "horizontal", "hoja"], { error: (i2) => `\xAB${i2.input}\xBB no es una vista: renglones, horizontal u hoja.` }).optional(),
123322
- pistas: external_exports.enum(["una", "todas"], { error: (i2) => `\xAB${i2.input}\xBB no dice cu\xE1ntas pistas: una o todas.` }).optional(),
123803
+ vista: external_exports.enum(["renglones", "horizontal", "hoja"], { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB no es una vista: renglones, horizontal u hoja.` }).optional(),
123804
+ pistas: external_exports.enum(["una", "todas"], { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB no dice cu\xE1ntas pistas: una o todas.` }).optional(),
123323
123805
  /**
123324
123806
  * ★ Los valores son EXACTAMENTE los que ofrece el menú: «los que entren» (−1) y 1, 2,
123325
123807
  * 3, 4, 5, 6, 8, 10, 12. No es una lista caprichosa, es la que el músico puede
@@ -123391,7 +123873,7 @@ function registrarHerramientasDelPuente(servidor2) {
123391
123873
  compas: external_exports.number().int().min(1).max(9999).describe("El primer comp\xE1s, contando desde 1."),
123392
123874
  hasta: external_exports.number().int().min(1).max(9999).optional().describe("El \xFAltimo comp\xE1s, incluido."),
123393
123875
  golpe: external_exports.number().int().min(1).optional().describe("Empezar en un golpe concreto del primer comp\xE1s, en vez de en su comienzo."),
123394
- cuerda: external_exports.number().int().min(1).max(24, { error: (i2) => `\xAB${i2.input}\xBB no es una cuerda: van de 1 (la m\xE1s grave) a 24.` }).optional().describe("La cuerda, desde la m\xE1s grave.")
123876
+ cuerda: external_exports.number().int().min(1).max(24, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB no es una cuerda: van de 1 (la m\xE1s grave) a 24.` }).optional().describe("La cuerda, desde la m\xE1s grave.")
123395
123877
  }
123396
123878
  },
123397
123879
  async (args2) => texto3(await pedirALaPesta\u00F1a("seleccionar", args2))
@@ -123471,7 +123953,7 @@ function registrarHerramientasDelPuente(servidor2) {
123471
123953
  description: "Marca el pulso mientras suena la tablatura. \u2605 Para qu\xE9 sirve: es lo que se prende para **sincronizar a o\xEDdo** \u2014 con el click puesto se escucha enseguida si la grabaci\xF3n entra antes o despu\xE9s del comp\xE1s. \u26A0\uFE0F Suena con el sintetizador de la obra, no con el audio: existe con o sin grabaci\xF3n cargada. \u26A0\uFE0F El pulso lo marca el DENOMINADOR del comp\xE1s: en 6/8 son seis clicks, no dos. \u2605 Mientras est\xE1 puesto aparece como una fila m\xE1s del mezclador, con su volumen. Sin `puesto` ni `volumen`, alterna; con s\xF3lo `volumen`, cambia el volumen y deja el metr\xF3nomo como estaba.",
123472
123954
  inputSchema: {
123473
123955
  puesto: external_exports.boolean().optional().describe("true lo pone, false lo saca. Sin esto, alterna."),
123474
- volumen: external_exports.number().int().min(0).max(16, { error: (i2) => `\xAB${i2.input}\xBB se sale de la escala del volumen, que va de 0 a 16. No es un porcentaje.` }).optional().describe(
123956
+ volumen: external_exports.number().int().min(0).max(16, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB se sale de la escala del volumen, que va de 0 a 16. No es un porcentaje.` }).optional().describe(
123475
123957
  "El volumen del click, de 0 a 16 \u2014la misma escala que `volumen_general`\u2014. Se recuerda aunque se lo saque, y no se guarda en la obra: es de quien escucha."
123476
123958
  )
123477
123959
  }
@@ -123564,7 +124046,7 @@ function registrarHerramientasDelPuente(servidor2) {
123564
124046
  silenciada: external_exports.boolean().optional(),
123565
124047
  enSolo: external_exports.boolean().optional(),
123566
124048
  visible: external_exports.boolean().optional().describe("Mostrarla u ocultarla en el pliego."),
123567
- volumen: external_exports.number().int().min(0).max(32, { error: (i2) => `\xAB${i2.input}\xBB se sale de la escala del volumen, que va de 0 a 32 (16 = como est\xE1 escrito, 32 \u2248 +6 dB). No es un porcentaje.` }).optional().describe("De 0 a 32. 16 = como est\xE1 escrito (0 dB); 32 \u2248 +6 dB."),
124049
+ volumen: external_exports.number().int().min(0).max(32, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB se sale de la escala del volumen, que va de 0 a 32 (16 = como est\xE1 escrito, 32 \u2248 +6 dB). No es un porcentaje.` }).optional().describe("De 0 a 32. 16 = como est\xE1 escrito (0 dB); 32 \u2248 +6 dB."),
123568
124050
  balance: external_exports.number().int().min(0).max(16).optional().describe("El paneo, de 0 a 16. **8 es el centro**, 0 todo a la izquierda y 16 todo a la derecha.")
123569
124051
  }
123570
124052
  },
@@ -123782,7 +124264,7 @@ function registrarHerramientasDelPuente(servidor2) {
123782
124264
  title: "El volumen general de la escucha",
123783
124265
  description: "El master del mezclador: sube o baja TODO junto, la tablatura y la grabaci\xF3n de referencia. \u26A0\uFE0F **No se guarda en la obra.** Es de quien est\xE1 escuchando ahora, igual que silenciar y el solo \u2014 subir el master no es una decisi\xF3n musical, es el volumen del cuarto. Al cerrar vuelve a su valor de arranque. \u26A0\uFE0F Va de **0 a 16**, la misma escala que el volumen de una pista: compartirla evita una tabla de traducci\xF3n, que es donde se cuela el error de conversi\xF3n.",
123784
124266
  inputSchema: {
123785
- volumen: external_exports.number().int().min(0).max(16, { error: (i2) => `\xAB${i2.input}\xBB se sale de la escala del volumen, que va de 0 a 16 (16 = como est\xE1 escrito). No es un porcentaje.` }).describe("De 0 a 16. 0 es mudo.")
124267
+ volumen: external_exports.number().int().min(0).max(16, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB se sale de la escala del volumen, que va de 0 a 16 (16 = como est\xE1 escrito). No es un porcentaje.` }).describe("De 0 a 16. 0 es mudo.")
123786
124268
  }
123787
124269
  },
123788
124270
  async (args2) => texto3(await pedirALaPesta\u00F1a("volumen_general", args2))
@@ -124102,7 +124584,7 @@ function registrarHerramientasDeSignos(servidor2) {
124102
124584
  description: "Los signos que ya est\xE1n puestos en una nota o en un golpe. Sirve para comprobar lo que se escribi\xF3 sin tener que mirar el pliego.",
124103
124585
  inputSchema: {
124104
124586
  compas: external_exports.number().int().min(1).max(9999),
124105
- cuerda: external_exports.number().int().min(1).max(24, { error: (i2) => `\xAB${i2.input}\xBB no es una cuerda: van de 1 (la m\xE1s grave) a 24.` }).describe("La cuerda, desde la m\xE1s grave empezando en 1."),
124587
+ cuerda: external_exports.number().int().min(1).max(24, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB no es una cuerda: van de 1 (la m\xE1s grave) a 24.` }).describe("La cuerda, desde la m\xE1s grave empezando en 1."),
124106
124588
  golpe: external_exports.number().int().min(1).max(999).optional(),
124107
124589
  tics: external_exports.number().int().min(0).max(99999).optional(),
124108
124590
  pista: external_exports.number().int().min(1).max(999).optional(),
@@ -124204,7 +124686,7 @@ function registrarHerramientasDeDuraciones(servidor2) {
124204
124686
  description: "Sube o baja la figura de lo escrito un escal\xF3n: de negra a blanca, de corchea a negra. Es lo que hacen las teclas + y \u2212 en el programa.",
124205
124687
  inputSchema: {
124206
124688
  ...DONDE,
124207
- direccion: external_exports.enum(["mas-larga", "mas-corta"], { error: (i2) => `\xAB${i2.input}\xBB no es una direcci\xF3n: mas-larga o mas-corta.` })
124689
+ direccion: external_exports.enum(["mas-larga", "mas-corta"], { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB no es una direcci\xF3n: mas-larga o mas-corta.` })
124208
124690
  }
124209
124691
  },
124210
124692
  ({ direccion, ...donde }) => {
@@ -124659,7 +125141,7 @@ function registrarHerramientasDeEstructura(servidor2) {
124659
125141
  {
124660
125142
  title: "Agregar compases al final",
124661
125143
  description: "Alarga la obra. Los compases nuevos heredan la cifra de comp\xE1s del \xFAltimo.",
124662
- inputSchema: { cuantos: external_exports.number().int().min(1).max(500, { error: (i2) => `\xAB${i2.input}\xBB son demasiados compases de una vez: van de 1 a 500.` }) }
125144
+ inputSchema: { cuantos: external_exports.number().int().min(1).max(500, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB son demasiados compases de una vez: van de 1 a 500.` }) }
124663
125145
  },
124664
125146
  ({ cuantos }) => {
124665
125147
  const { documento } = obraAbierta();
@@ -124673,8 +125155,8 @@ function registrarHerramientasDeEstructura(servidor2) {
124673
125155
  title: "Insertar un comp\xE1s",
124674
125156
  description: "Mete un comp\xE1s vac\xEDo al lado del que se diga, y corre el resto. \u26A0\uFE0F Hay que decir UNO de los dos: `despuesDel` o `antesDel`. \u2605 `antesDel: 1` mete un comp\xE1s **al principio de la obra**, que es lo que hace falta cuando la grabaci\xF3n entra tarde y hay que dejarle espacio antes de lo ya escrito. El comp\xE1s nuevo hereda la m\xE9trica y la armadura de su vecino, y nunca su secci\xF3n ni sus repeticiones.",
124675
125157
  inputSchema: {
124676
- despuesDel: external_exports.number().int().min(1).max(9999, { error: (i2) => `\xAB${i2.input}\xBB se pasa: los compases van de 1 a 9999.` }).optional().describe("El comp\xE1s despu\xE9s del cual insertar, como lo lee el m\xFAsico."),
124677
- antesDel: external_exports.number().int().min(1).max(9999, { error: (i2) => `\xAB${i2.input}\xBB se pasa: los compases van de 1 a 9999.` }).optional().describe("El comp\xE1s antes del cual insertar. Con 1, al principio de la obra.")
125158
+ despuesDel: external_exports.number().int().min(1).max(9999, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB se pasa: los compases van de 1 a 9999.` }).optional().describe("El comp\xE1s despu\xE9s del cual insertar, como lo lee el m\xFAsico."),
125159
+ antesDel: external_exports.number().int().min(1).max(9999, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB se pasa: los compases van de 1 a 9999.` }).optional().describe("El comp\xE1s antes del cual insertar. Con 1, al principio de la obra.")
124678
125160
  }
124679
125161
  },
124680
125162
  ({ despuesDel, antesDel }) => {
@@ -125225,7 +125707,7 @@ function registrarHerramientasDeMusica(servidor2) {
125225
125707
  inputSchema: {
125226
125708
  ...RANGO,
125227
125709
  hasta: external_exports.number().int().min(1).max(9999),
125228
- semitonos: external_exports.number().int().min(-24).max(24, { error: (i2) => `\xAB${i2.input}\xBB se pasa: se transpone entre -24 y 24 semitonos, o sea dos octavas para cada lado.` })
125710
+ semitonos: external_exports.number().int().min(-24).max(24, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB se pasa: se transpone entre -24 y 24 semitonos, o sea dos octavas para cada lado.` })
125229
125711
  }
125230
125712
  },
125231
125713
  ({ semitonos, ...donde }) => {
@@ -125245,7 +125727,7 @@ function registrarHerramientasDeMusica(servidor2) {
125245
125727
  {
125246
125728
  title: "Deshacer",
125247
125729
  description: "Vuelve atr\xE1s un paso. Es el MISMO historial que el Ctrl+Z del m\xFAsico: si \xE9l escribi\xF3 lo \xFAltimo, esto deshace lo suyo.",
125248
- inputSchema: { pasos: external_exports.number().int().min(1).max(50, { error: (i2) => `\xAB${i2.input}\xBB son demasiados pasos de una vez: van de 1 a 50.` }).optional() }
125730
+ inputSchema: { pasos: external_exports.number().int().min(1).max(50, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB son demasiados pasos de una vez: van de 1 a 50.` }).optional() }
125249
125731
  },
125250
125732
  ({ pasos }) => {
125251
125733
  const { documento } = obraAbierta();
@@ -125264,7 +125746,7 @@ function registrarHerramientasDeMusica(servidor2) {
125264
125746
  {
125265
125747
  title: "Rehacer",
125266
125748
  description: "Vuelve adelante lo que se deshizo.",
125267
- inputSchema: { pasos: external_exports.number().int().min(1).max(50, { error: (i2) => `\xAB${i2.input}\xBB son demasiados pasos de una vez: van de 1 a 50.` }).optional() }
125749
+ inputSchema: { pasos: external_exports.number().int().min(1).max(50, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB son demasiados pasos de una vez: van de 1 a 50.` }).optional() }
125268
125750
  },
125269
125751
  ({ pasos }) => {
125270
125752
  const { documento } = obraAbierta();
@@ -125413,7 +125895,7 @@ function registrarHerramientasDeMusica(servidor2) {
125413
125895
  golpe: external_exports.number().int().min(1).max(999).optional(),
125414
125896
  pista: external_exports.number().int().min(1).max(999).optional(),
125415
125897
  voz: external_exports.number().int().min(1).max(4).optional(),
125416
- figura: external_exports.number().int().min(1).max(64, { error: (i2) => `\xAB${i2.input}\xBB no es una figura: 1 redonda, 2 blanca, 4 negra, 8 corchea, 16, 32, 64.` }).optional().describe("1 redonda, 2 blanca, 4 negra\u2026 Por omisi\xF3n, negra."),
125898
+ figura: external_exports.number().int().min(1).max(64, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB no es una figura: 1 redonda, 2 blanca, 4 negra, 8 corchea, 16, 32, 64.` }).optional().describe("1 redonda, 2 blanca, 4 negra\u2026 Por omisi\xF3n, negra."),
125417
125899
  puntillos: external_exports.number().int().min(0).max(2).optional()
125418
125900
  }
125419
125901
  },
@@ -125498,8 +125980,8 @@ function registrarHerramientasDeMusica(servidor2) {
125498
125980
  description: "\u26A0\uFE0F CONSERVA EL TRASTE, NO LA ALTURA: un 5 en la 3\xAA pasa a ser un 5 en la 4\xAA, as\xED que SUENA DISTINTO. Es para cuando uno se equivoc\xF3 de cuerda y quiso escribir esos n\xFAmeros en la otra \u2014 no para pasar la misma melod\xEDa a otra posici\xF3n del m\xE1stil. Para que suene igual hay que reescribir los trastes. O se mueven todas las notas o no se mueve ninguna: si una sola no entra, no pasa nada.",
125499
125981
  inputSchema: {
125500
125982
  ...RANGO,
125501
- cuerda: external_exports.number().int().min(1).max(24, { error: (i2) => `\xAB${i2.input}\xBB no es una cuerda: van de 1 (la m\xE1s grave) a 24.` }).optional(),
125502
- hacia: external_exports.enum(["arriba", "abajo"], { error: (i2) => `\xAB${i2.input}\xBB no es una direcci\xF3n: arriba o abajo.` })
125983
+ cuerda: external_exports.number().int().min(1).max(24, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB no es una cuerda: van de 1 (la m\xE1s grave) a 24.` }).optional(),
125984
+ hacia: external_exports.enum(["arriba", "abajo"], { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB no es una direcci\xF3n: arriba o abajo.` })
125503
125985
  }
125504
125986
  },
125505
125987
  ({ hacia, ...donde }) => {
@@ -125567,7 +126049,7 @@ function registrarHerramientasDeMusica(servidor2) {
125567
126049
  title: "La letra alineada contra la grabaci\xF3n",
125568
126050
  description: "Las s\xEDlabas tal como quedaron despu\xE9s de sincronizar, con **el segundo en que cada una se canta**. Numeradas desde 1: ese n\xFAmero es el que piden `refinar_silaba`, `dividir_silaba` y `quitar_silaba`. \u26A0\uFE0F `confianza` es de la m\xE1quina: 0 quiere decir que la puso una persona y no hay duda; cuanto m\xE1s alta, m\xE1s dudosa es la hip\xF3tesis del alineador.",
125569
126051
  inputSchema: {
125570
- desde: external_exports.number().int().min(1).max(9999, { error: (i2) => `\xAB${i2.input}\xBB se pasa: va de 1 a 9999.` }).optional().describe("Desde qu\xE9 s\xEDlaba. Por omisi\xF3n, la 1."),
126052
+ desde: external_exports.number().int().min(1).max(9999, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB se pasa: va de 1 a 9999.` }).optional().describe("Desde qu\xE9 s\xEDlaba. Por omisi\xF3n, la 1."),
125571
126053
  cuantas: external_exports.number().int().min(1).max(999).optional().describe("Cu\xE1ntas traer. Por omisi\xF3n, 50: una canci\xF3n tiene entre 300 y 900.")
125572
126054
  }
125573
126055
  },
@@ -125595,7 +126077,7 @@ function registrarHerramientasDeMusica(servidor2) {
125595
126077
  title: "Corregir una s\xEDlaba de la letra sincronizada",
125596
126078
  description: "Le cambia el texto, el tiempo, o las dos cosas; con `restablecer` la devuelve a donde la hab\xEDa puesto el alineador. \u26A0\uFE0F Cambiar el texto **no toca el tiempo** \u2014corregir \xABgran\xBB por \xABgrande\xBB no cambia cu\xE1ndo se canta\u2014 y mover el tiempo no toca el texto. \u2605 Tocarla a mano le pone la confianza en 0: deja de ser una hip\xF3tesis de la m\xE1quina, y queda como puesta por una persona.",
125597
126079
  inputSchema: {
125598
- silaba: external_exports.number().int().min(1).max(9999, { error: (i2) => `\xAB${i2.input}\xBB se pasa: las s\xEDlabas van de 1 a 9999.` }).describe("Su n\xFAmero, de `letra_sincronizada`."),
126080
+ silaba: external_exports.number().int().min(1).max(9999, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB se pasa: las s\xEDlabas van de 1 a 9999.` }).describe("Su n\xFAmero, de `letra_sincronizada`."),
125599
126081
  texto: external_exports.string().optional(),
125600
126082
  desde: external_exports.number().optional().describe("En qu\xE9 segundo empieza a cantarse."),
125601
126083
  hasta: external_exports.number().optional().describe("En qu\xE9 segundo termina."),
@@ -125638,7 +126120,7 @@ function registrarHerramientasDeMusica(servidor2) {
125638
126120
  title: "Copiar una s\xEDlaba a otro instante",
125639
126121
  description: "Para un coro o una palabra que se repite y el alineador no vio: la original se queda donde est\xE1 y la copia entra en su lugar por tiempo, as\xED que los n\xFAmeros de las siguientes se corren. Es arrastrar la s\xEDlaba con Alt.",
125640
126122
  inputSchema: {
125641
- silaba: external_exports.number().int().min(1).max(9999, { error: (i2) => `\xAB${i2.input}\xBB se pasa: las s\xEDlabas van de 1 a 9999.` }),
126123
+ silaba: external_exports.number().int().min(1).max(9999, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB se pasa: las s\xEDlabas van de 1 a 9999.` }),
125642
126124
  desde: external_exports.number().describe("En qu\xE9 segundo empieza la copia."),
125643
126125
  hasta: external_exports.number().optional().describe("En qu\xE9 segundo termina. Por omisi\xF3n, dura lo mismo que la original.")
125644
126126
  }
@@ -125663,7 +126145,7 @@ function registrarHerramientasDeMusica(servidor2) {
125663
126145
  title: "Partir una s\xEDlaba en dos",
125664
126146
  description: "Cuando el alineador dej\xF3 dos s\xEDlabas pegadas en una. La nueva queda justo despu\xE9s, y el tiempo de la original se reparte entre las dos por la mitad.",
125665
126147
  inputSchema: {
125666
- silaba: external_exports.number().int().min(1).max(9999, { error: (i2) => `\xAB${i2.input}\xBB se pasa: las s\xEDlabas van de 1 a 9999.` }).describe("Su n\xFAmero, de `letra_sincronizada`."),
126148
+ silaba: external_exports.number().int().min(1).max(9999, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB se pasa: las s\xEDlabas van de 1 a 9999.` }).describe("Su n\xFAmero, de `letra_sincronizada`."),
125667
126149
  izquierda: external_exports.string().describe("El texto que queda en la primera."),
125668
126150
  derecha: external_exports.string().describe("El texto de la nueva.")
125669
126151
  }
@@ -125683,8 +126165,8 @@ function registrarHerramientasDeMusica(servidor2) {
125683
126165
  title: "Sacar una s\xEDlaba de la letra sincronizada",
125684
126166
  description: "Cuando el alineador invent\xF3 una que no se canta. \u26A0\uFE0F Saca la s\xEDlaba de la ALINEACI\xD3N, no la letra escrita en el pliego: para eso est\xE1 `poner_silaba`. Con `hasta` saca el tramo entero, de un solo paso de deshacer.",
125685
126167
  inputSchema: {
125686
- silaba: external_exports.number().int().min(1).max(9999, { error: (i2) => `\xAB${i2.input}\xBB se pasa: las s\xEDlabas van de 1 a 9999.` }).describe("Su n\xFAmero, de `letra_sincronizada`."),
125687
- hasta: external_exports.number().int().min(1).max(9999, { error: (i2) => `\xAB${i2.input}\xBB se pasa: las s\xEDlabas van de 1 a 9999.` }).optional().describe("La \xFAltima del tramo, incluida.")
126168
+ silaba: external_exports.number().int().min(1).max(9999, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB se pasa: las s\xEDlabas van de 1 a 9999.` }).describe("Su n\xFAmero, de `letra_sincronizada`."),
126169
+ hasta: external_exports.number().int().min(1).max(9999, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB se pasa: las s\xEDlabas van de 1 a 9999.` }).optional().describe("La \xFAltima del tramo, incluida.")
125688
126170
  }
125689
126171
  },
125690
126172
  ({ silaba, hasta }) => {
@@ -125727,7 +126209,7 @@ function registrarHerramientasDeMusica(servidor2) {
125727
126209
  campo: external_exports.string().describe(`Cu\xE1l: ${Object.keys(VARIANTES).join(", ")}. De \`variantes_disponibles\`.`),
125728
126210
  variante: external_exports.string().describe("El nombre de la variante, de `variantes_disponibles`."),
125729
126211
  compas: external_exports.number().int().min(1).max(9999),
125730
- cuerda: external_exports.number().int().min(1).max(24, { error: (i2) => `\xAB${i2.input}\xBB no es una cuerda: van de 1 (la m\xE1s grave) a 24.` }),
126212
+ cuerda: external_exports.number().int().min(1).max(24, { error: (i2) => i2.input === void 0 ? "Falta este dato." : `\xAB${i2.input}\xBB no es una cuerda: van de 1 (la m\xE1s grave) a 24.` }),
125731
126213
  golpe: external_exports.number().int().min(1).max(999).optional(),
125732
126214
  tics: external_exports.number().int().min(0).max(99999).optional(),
125733
126215
  pista: external_exports.number().int().min(1).max(999).optional(),