mandioca-tabs-mcp 0.2.14 → 0.2.16

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 +741 -153
  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
  });
@@ -20549,8 +20704,19 @@ var init_piano = __esm({
20549
20704
  });
20550
20705
 
20551
20706
  // packages/editor/src/loudness.ts
20707
+ var MUESTRAS_POR_TRAMO, MUESTRAS_POR_TRAMO_DEL_PICO, FASES_BS1770, COEFICIENTES, GANANCIA_MAXIMA;
20552
20708
  var init_loudness = __esm({
20553
20709
  "packages/editor/src/loudness.ts"() {
20710
+ MUESTRAS_POR_TRAMO = 1 << 18;
20711
+ MUESTRAS_POR_TRAMO_DEL_PICO = 1 << 14;
20712
+ FASES_BS1770 = [
20713
+ [0.001708984375, 0.010986328125, -0.0196533203125, 0.033203125, -0.0594482421875, 0.1373291015625, 0.97216796875, -0.102294921875, 0.047607421875, -0.026611328125, 0.014892578125, -0.00830078125],
20714
+ [-0.0291748046875, 0.029296875, -0.0517578125, 0.089111328125, -0.16650390625, 0.465087890625, 0.77978515625, -0.2003173828125, 0.1015625, -0.0582275390625, 0.0330810546875, -0.0189208984375],
20715
+ [-0.0189208984375, 0.0330810546875, -0.0582275390625, 0.1015625, -0.2003173828125, 0.77978515625, 0.465087890625, -0.16650390625, 0.089111328125, -0.0517578125, 0.029296875, -0.0291748046875],
20716
+ [-0.00830078125, 0.014892578125, -0.026611328125, 0.047607421875, -0.102294921875, 0.97216796875, 0.1373291015625, -0.0594482421875, 0.033203125, -0.0196533203125, 0.010986328125, 0.001708984375]
20717
+ ];
20718
+ COEFICIENTES = Float64Array.from({ length: 48 }, (_, i2) => FASES_BS1770[i2 % 4][Math.floor(i2 / 4)]);
20719
+ GANANCIA_MAXIMA = Math.max(...FASES_BS1770.map((fase) => fase.reduce((s, c) => s + Math.abs(c), 0)));
20554
20720
  }
20555
20721
  });
20556
20722
 
@@ -20780,7 +20946,7 @@ function notasDeLaPista(indice, pistaId) {
20780
20946
  if (!compasId) continue;
20781
20947
  for (const figura of indice.figuras(compasId)) {
20782
20948
  for (const nota of indice.notas(figura.id)) {
20783
- salida.push({ id: nota.id, cuerda: nota.datos.cuerda });
20949
+ salida.push({ id: nota.id, cuerda: nota.datos.cuerda, figuraId: figura.id });
20784
20950
  }
20785
20951
  }
20786
20952
  }
@@ -20817,11 +20983,15 @@ function quitarCuerda(documento, indice, pistaId, donde) {
20817
20983
  const todas = notasDeLaPista(indice, pistaId);
20818
20984
  const aBorrar = todas.filter((n) => n.cuerda === cuerdaQueSeVa);
20819
20985
  const aRenumerar = donde === "grave" ? todas.filter((n) => n.cuerda > 1) : [];
20986
+ const quedan = /* @__PURE__ */ new Map();
20987
+ for (const n of todas) quedan.set(n.figuraId, (quedan.get(n.figuraId) ?? 0) + (n.cuerda === cuerdaQueSeVa ? 0 : 1));
20820
20988
  documento.doc.transact(() => {
20821
20989
  for (const nota of aBorrar) documento.notas.delete(nota.id);
20822
20990
  for (const nota of aRenumerar) {
20823
20991
  documento.notas.get(nota.id)?.set("cuerda", nota.cuerda - 1);
20824
20992
  }
20993
+ for (const [figuraId, cuantas] of quedan)
20994
+ if (cuantas === 0) documento.figuras.get(figuraId)?.set("esSilencio", true);
20825
20995
  documento.pistas.get(pistaId)?.set("afinacion", nuevaAfinacion);
20826
20996
  });
20827
20997
  return { hecho: true, cuerdas: nuevaAfinacion.length, notasBorradas: aBorrar.length };
@@ -88453,7 +88623,7 @@ function prepararMusicXml(xml) {
88453
88623
  });
88454
88624
  if (atributosMovidos) {
88455
88625
  correcciones.push(
88456
- `${atributosMovidos} cambios de clave, armadura o comp\xE1s escritos antes de la barra pasaron al comp\xE1s siguiente.`
88626
+ `${atributosMovidos} cambios de clave, armadura o comp\xE1s escritos entre las notas se pusieron al principio del comp\xE1s donde rigen.`
88457
88627
  );
88458
88628
  }
88459
88629
  if (acordesSeparados) {
@@ -88474,6 +88644,17 @@ function prepararMusicXml(xml) {
88474
88644
  });
88475
88645
  });
88476
88646
  if (juntados) correcciones.push(`${juntados} indicaciones de texto en varios renglones se juntaron en una.`);
88647
+ let silabas2 = 0;
88648
+ salida = salida.replace(/<lyric\b[^>]*>[\s\S]*?<\/lyric>/g, (lyric) => {
88649
+ const tipo = /<syllabic>\s*(\w+)\s*<\/syllabic>/.exec(lyric)?.[1];
88650
+ if (tipo !== "begin" && tipo !== "middle") return lyric;
88651
+ return lyric.replace(/(<text\b[^>]*>)([\s\S]*?)(<\/text>)/, (m, a, texto4, b) => {
88652
+ if (texto4.trimEnd().endsWith("-")) return m;
88653
+ silabas2++;
88654
+ return `${a}${texto4.trimEnd()}-${b}`;
88655
+ });
88656
+ });
88657
+ if (silabas2) correcciones.push(`${silabas2} s\xEDlabas unidas de la letra se marcaron con su guion.`);
88477
88658
  let tempos = 0;
88478
88659
  salida = salida.replace(/<metronome\b[^>]*>[\s\S]*?<\/metronome>/g, (met) => {
88479
88660
  const unidad = /<beat-unit>\s*([\w-]+)\s*<\/beat-unit>/.exec(met)?.[1];
@@ -88507,6 +88688,16 @@ function rearmar(parte, compases, nuevos) {
88507
88688
  });
88508
88689
  return salida + parte.slice(cursor);
88509
88690
  }
88691
+ function tiempoAl(pedazo) {
88692
+ let t = 0;
88693
+ for (const m of pedazo.matchAll(/<(note|backup|forward)\b[\s\S]*?<\/\1>/g)) {
88694
+ const dur = entero(m[0], /<duration>\s*(\d+)\s*<\/duration>/) ?? 0;
88695
+ if (m[1] === "backup") t -= dur;
88696
+ else if (m[1] === "forward") t += dur;
88697
+ else if (!/<chord\s*\/>/.test(m[0]) && !/<grace\b/.test(m[0])) t += dur;
88698
+ }
88699
+ return t;
88700
+ }
88510
88701
  function moverAtributosDeFinDeCompas(parte) {
88511
88702
  const compases = compasesDe(parte);
88512
88703
  let cuantos = 0;
@@ -88516,15 +88707,18 @@ function moverAtributosDeFinDeCompas(parte) {
88516
88707
  const primeraNota = contenido.search(/<note\b/);
88517
88708
  if (primeraNota >= 0) {
88518
88709
  let llevar = "";
88519
- contenido = contenido.slice(0, primeraNota) + contenido.slice(primeraNota).replace(/<attributes\b[^>]*>([\s\S]*?)<\/attributes>/g, (bloque, adentro) => {
88710
+ let alPrincipio = "";
88711
+ const despues = contenido.slice(primeraNota);
88712
+ contenido = contenido.slice(0, primeraNota) + despues.replace(/<attributes\b[^>]*>([\s\S]*?)<\/attributes>/g, (bloque, adentro, donde) => {
88520
88713
  const hijos = adentro.match(HIJO_QUE_SE_MUEVE);
88521
88714
  if (!hijos) return bloque;
88522
88715
  cuantos += hijos.length;
88523
- llevar += hijos.join("");
88716
+ if (tiempoAl(despues.slice(0, donde)) <= 0) alPrincipio += hijos.join("");
88717
+ else llevar += hijos.join("");
88524
88718
  const resto = adentro.replace(HIJO_QUE_SE_MUEVE, "");
88525
88719
  return resto.trim() ? `<attributes>${resto}</attributes>` : "";
88526
88720
  });
88527
- const entra2 = arrastre;
88721
+ const entra2 = arrastre + alPrincipio;
88528
88722
  arrastre = llevar;
88529
88723
  return (entra2 ? `<attributes>${entra2}</attributes>` : "") + contenido;
88530
88724
  }
@@ -88759,6 +88953,13 @@ var init_musicxmlEntrada = __esm({
88759
88953
  });
88760
88954
 
88761
88955
  // packages/io/src/importarGp.ts
88956
+ function piezaDeBateria(pista, numero2) {
88957
+ if (numero2 < 0) return null;
88958
+ const delArchivo = pista.percussionArticulations ?? [];
88959
+ const midi = numero2 < delArchivo.length ? delArchivo[numero2].outputMidiNumber : SALIDA_DE_ID_GP[numero2] ?? numero2;
88960
+ const buscada = PARIENTE_GM[midi] ?? midi;
88961
+ return KIT.find((p) => p.midi === buscada)?.indice ?? null;
88962
+ }
88762
88963
  function importarGp(bytes, opciones = {}) {
88763
88964
  const xml = textoMusicXml(bytes);
88764
88965
  if (xml === null) {
@@ -88803,18 +89004,21 @@ function importarScore(score, opciones = {}, datos = {}) {
88803
89004
  "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."
88804
89005
  );
88805
89006
  }
89007
+ const saltosEscritos = saltosDelTexto(score);
88806
89008
  const idsDeCompasMaestro = score.masterBars.map(
88807
89009
  (maestro) => documento.agregarCompasMaestro(normalizarCompasMaestro({
88808
89010
  numerador: maestro.timeSignatureNumerator,
88809
89011
  denominador: maestro.timeSignatureDenominator,
88810
- tonalidad: numeroDeTonalidad(maestro.keySignature),
89012
+ tonalidad: numeroDeTonalidad(tonalidadDeConcierto(score, maestro.index)),
88811
89013
  // ⚠️ El ensayo de un MusicXML (`<rehearsal>A</rehearsal>`) llena sólo `section.marker`;
88812
89014
  // `text` queda vacío y las letras A, B, C… se perdían todas. Un `.gp` trae las dos y
88813
89015
  // manda el texto, como siempre.
88814
89016
  seccion: maestro.section?.text || maestro.section?.marker || "",
88815
- // Solo interesa el cambio de tempo que arranca en este compás; los que caen
88816
- // en el medio son F02 y todavía no tienen dónde ir.
88817
- tempo: maestro.tempoAutomations?.[0]?.value ?? null,
89017
+ // El cambio de tempo que arranca EN este compás. Los que caen a mitad van a su figura
89018
+ // (ver `temposAMitad` abajo).
89019
+ // ⛔ (2026-11-10) Antes era `tempoAutomations[0]` sin mirar dónde caía: un 140 a mitad
89020
+ // del compás 2 se aplicaba desde su principio y la primera mitad sonaba a 140.
89021
+ tempo: maestro.tempoAutomations?.find((a) => a.ratioPosition <= 1e-6)?.value ?? null,
88818
89022
  repiteDesdeAca: maestro.isRepeatStart,
88819
89023
  repiteVeces: maestro.repeatCount,
88820
89024
  // ⚠️ Novena pérdida silenciosa de la misma familia: 2 de los 15 `.gp` de Daniel
@@ -88842,7 +89046,7 @@ function importarScore(score, opciones = {}, datos = {}) {
88842
89046
  //
88843
89047
  // ★ El nombre y no el número, además, porque acá es una LISTA y se lee: un
88844
89048
  // `["JumpDalSegnoAlCoda"]` en el documento dice algo; un `[10]` no.
88845
- direcciones: maestro.directions ? [...maestro.directions].map(
89049
+ direcciones: maestro.directions ? [...saltosEscritos.precisos.get(maestro.index) ?? maestro.directions].map(
88846
89050
  (d) => _barrel_exports$4.Direction[d] ?? String(d)
88847
89051
  ) : []
88848
89052
  }))
@@ -88853,7 +89057,7 @@ function importarScore(score, opciones = {}, datos = {}) {
88853
89057
  const id2 = idsDeCompasMaestro[i2];
88854
89058
  if (id2 !== void 0 && i2 > 0) documento.ponerSaltoDeRenglon(id2, true);
88855
89059
  }
88856
- const letrasDobles = { cuantas: 0 };
89060
+ const letrasDobles = { cuantas: 0, versosDeMas: 0 };
88857
89061
  const tipoDelPentagrama = (p) => p.isPercussion ? "percusion" : p.tuning.length === 0 ? "altura" : "trastes";
88858
89062
  for (const pista of score.tracks) {
88859
89063
  if (pista.staves.length === 0) {
@@ -88868,6 +89072,8 @@ function importarScore(score, opciones = {}, datos = {}) {
88868
89072
  const nombreCortoDePista = variosPentagramas ? `${pista.shortName ?? ""} ${numeroDePentagrama + 1}`.trim() : pista.shortName ?? "";
88869
89073
  const pentagramaEnLaPista = unInstrumento ? numeroDePentagrama : 0;
88870
89074
  const tipo = tipoDelPentagrama(pentagrama);
89075
+ const sinPieza = /* @__PURE__ */ new Map();
89076
+ const articulacionDe = (n) => piezaDeBateria(pista, n.percussionArticulation);
88871
89077
  const idPista = unInstrumento && idDelInstrumento || documento.agregarPista({
88872
89078
  tipo,
88873
89079
  nombre: nombreDePista,
@@ -88945,7 +89151,7 @@ function importarScore(score, opciones = {}, datos = {}) {
88945
89151
  // ★ Acá viene la letra. En la canción de Daniel cada sílaba está escrita
88946
89152
  // como texto del golpe, que es como se hace en la práctica en Guitar Pro.
88947
89153
  // Sin este campo, importar y exportar la borraba sin decir nada.
88948
- texto: textoDelGolpe(golpe, letrasDobles),
89154
+ texto: saltosEscritos.textos.has(golpe) ? "" : textoDelGolpe(golpe, letrasDobles),
88949
89155
  // ═══════════════════════════════════════════════════════════════════
88950
89156
  // ⛔⛔ LOS CIFRADOS DE ACORDE SE PERDÍAN TODOS (2026-11-09)
88951
89157
  // ═══════════════════════════════════════════════════════════════════
@@ -89003,6 +89209,11 @@ function importarScore(score, opciones = {}, datos = {}) {
89003
89209
  })
89004
89210
  );
89005
89211
  for (const nota of golpe.notes) {
89212
+ if (tipo === "percusion" && articulacionDe(nota) === null) {
89213
+ const n = nota.percussionArticulation;
89214
+ sinPieza.set(n, (sinPieza.get(n) ?? 0) + 1);
89215
+ continue;
89216
+ }
89006
89217
  documento.agregarNota(
89007
89218
  normalizarNota({
89008
89219
  figuraId: idFigura,
@@ -89025,7 +89236,7 @@ function importarScore(score, opciones = {}, datos = {}) {
89025
89236
  // `percussionArticulation`, que es lo que `proyectar` le pone. Así la ida y la
89026
89237
  // vuelta son simétricas: lo que se exporta se vuelve a importar idéntico.
89027
89238
  altura: tipo === "altura" ? nota.calculateRealValue(false, false) : null,
89028
- articulacion: tipo === "percusion" ? nota.percussionArticulation : null,
89239
+ articulacion: tipo === "percusion" ? articulacionDe(nota) : null,
89029
89240
  ligadaAAnterior: nota.isTieDestination,
89030
89241
  muerta: nota.isDead,
89031
89242
  fantasma: nota.isGhost,
@@ -89042,6 +89253,8 @@ function importarScore(score, opciones = {}, datos = {}) {
89042
89253
  deslizamientoEntrada: nota.slideInType,
89043
89254
  deslizamientoSalida: nota.slideOutType,
89044
89255
  armonico: nota.harmonicType,
89256
+ // El natural se recalcula del traste al proyectar: se guarda sólo si es otro.
89257
+ armonicoValor: nota.harmonicType !== _barrel_exports$4.HarmonicType.None && nota.harmonicType !== _barrel_exports$4.HarmonicType.Natural ? nota.harmonicValue : 0,
89045
89258
  // ── Los signos de Guitar Pro, a nivel de nota ──────────────────
89046
89259
  acento: nota.accentuated,
89047
89260
  ligaduraDeExpresion: nota.isSlurDestination || nota.slurDestination !== null,
@@ -89077,6 +89290,12 @@ function importarScore(score, opciones = {}, datos = {}) {
89077
89290
  }
89078
89291
  }
89079
89292
  }
89293
+ if (sinPieza.size > 0) {
89294
+ const total = [...sinPieza.values()].reduce((a, b) => a + b, 0);
89295
+ avisos.push(
89296
+ `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.`
89297
+ );
89298
+ }
89080
89299
  }
89081
89300
  }
89082
89301
  if (letrasDobles.cuantas > 0) {
@@ -89084,6 +89303,11 @@ function importarScore(score, opciones = {}, datos = {}) {
89084
89303
  `${letrasDobles.cuantas} golpe(s) tra\xEDan letra Y un texto libre: se guard\xF3 la letra. Tabs lleva un solo texto por golpe.`
89085
89304
  );
89086
89305
  }
89306
+ if (letrasDobles.versosDeMas > 0) {
89307
+ avisos.push(
89308
+ `${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.`
89309
+ );
89310
+ }
89087
89311
  const audioEmbebido = importarAudioYSync(score, documento, idsDeCompasMaestro, avisos);
89088
89312
  return { documento, avisos, ...audioEmbebido ? { audioEmbebido } : {} };
89089
89313
  }
@@ -89128,11 +89352,43 @@ function importarAudioYSync(score, documento, idsDeCompasMaestro, avisos) {
89128
89352
  }
89129
89353
  return { fuenteId, bytes };
89130
89354
  }
89355
+ function saltosDelTexto(score) {
89356
+ const precisos = /* @__PURE__ */ new Map();
89357
+ const textos = /* @__PURE__ */ new Set();
89358
+ for (const pista of score.tracks)
89359
+ for (const pentagrama of pista.staves)
89360
+ for (const barra of pentagrama.bars) {
89361
+ const maestro = score.masterBars[barra.index];
89362
+ if (!maestro?.directions) continue;
89363
+ for (const voz of barra.voices)
89364
+ for (const golpe of voz.beats) {
89365
+ const regla = golpe.text ? SALTO_POR_TEXTO[claveDeSalto(golpe.text)] : void 0;
89366
+ if (!regla) continue;
89367
+ const actuales = precisos.get(maestro.index) ?? new Set(maestro.directions);
89368
+ if (!actuales.has(regla[0]) && !actuales.has(regla[1])) continue;
89369
+ actuales.delete(regla[0]);
89370
+ actuales.add(regla[1]);
89371
+ precisos.set(maestro.index, actuales);
89372
+ textos.add(golpe);
89373
+ }
89374
+ }
89375
+ return { precisos, textos };
89376
+ }
89377
+ function tonalidadDeConcierto(score, indice) {
89378
+ const pentagramas = score.tracks.flatMap((t) => t.staves).filter((s) => !s.isPercussion);
89379
+ const llano = pentagramas.find((s) => !s.displayTranspositionPitch && s.bars[indice]);
89380
+ if (llano) return llano.bars[indice].keySignature;
89381
+ const primero = pentagramas.find((s) => s.bars[indice]);
89382
+ if (!primero) return score.masterBars[indice]?.keySignature ?? 0;
89383
+ return armaduraDeConcierto(primero.bars[indice].keySignature, primero.displayTranspositionPitch);
89384
+ }
89131
89385
  function numeroDeTonalidad(armadura) {
89132
89386
  return armadura;
89133
89387
  }
89134
89388
  function textoDelGolpe(golpe, letrasDobles) {
89135
- const letra = (golpe.lyrics ?? []).find((l) => l && l.trim()) ?? "";
89389
+ const versos = golpe.lyrics ?? [];
89390
+ const letra = versos[0]?.trim() ? versos[0] : "";
89391
+ if (versos.slice(1).some((v) => v && v.trim())) letrasDobles.versosDeMas++;
89136
89392
  const libre = golpe.text ?? "";
89137
89393
  if (letra && libre && letra !== libre) letrasDobles.cuantas++;
89138
89394
  return letra || libre;
@@ -89170,24 +89426,107 @@ function ortografiaDe(ortografia, parte, pentagrama, compas, tic, nota) {
89170
89426
  const base = `${parte}|${pentagrama}|${compas}|${tic}|`;
89171
89427
  return ortografia.get(base + nota.calculateRealValue(false, false)) ?? ortografia.get(base + (nota.octave * 12 + nota.tone));
89172
89428
  }
89429
+ var SALIDA_DE_ID_GP, PARIENTE_GM, DIR, SALTO_POR_TEXTO, claveDeSalto;
89173
89430
  var init_importarGp = __esm({
89174
89431
  "packages/io/src/importarGp.ts"() {
89175
89432
  init_alphaTab();
89176
89433
  init_src2();
89434
+ init_src2();
89177
89435
  init_musicxmlEntrada();
89436
+ SALIDA_DE_ID_GP = {
89437
+ 31: 40,
89438
+ 83: 53,
89439
+ 84: 53,
89440
+ 91: 38,
89441
+ 92: 46,
89442
+ 93: 51,
89443
+ 94: 51,
89444
+ 95: 55,
89445
+ 96: 52,
89446
+ 97: 49,
89447
+ 98: 57,
89448
+ 99: 56,
89449
+ 100: 56,
89450
+ 101: 56,
89451
+ 102: 56,
89452
+ 103: 56,
89453
+ 104: 60,
89454
+ 105: 60,
89455
+ 106: 61,
89456
+ 107: 61,
89457
+ 108: 64,
89458
+ 109: 64,
89459
+ 110: 63,
89460
+ 111: 54,
89461
+ 112: 54,
89462
+ 113: 54,
89463
+ 114: 43,
89464
+ 115: 49,
89465
+ 116: 49,
89466
+ 117: 69,
89467
+ 118: 70,
89468
+ 119: 70,
89469
+ 120: 70,
89470
+ 122: 82,
89471
+ 123: 53,
89472
+ 124: 62,
89473
+ 125: 62,
89474
+ 126: 59,
89475
+ 127: 59
89476
+ };
89477
+ PARIENTE_GM = {
89478
+ 35: 36,
89479
+ // bombo acústico → bombo
89480
+ 40: 38,
89481
+ // caja eléctrica → caja
89482
+ 43: 41,
89483
+ // tom de piso agudo → tom de piso
89484
+ 47: 45,
89485
+ // tom medio grave → tom medio
89486
+ 50: 48,
89487
+ // tom muy agudo → tom agudo
89488
+ 57: 49,
89489
+ // crash 2 → crash
89490
+ 59: 51
89491
+ // ride 2 → ride
89492
+ };
89493
+ DIR = _barrel_exports$4.Direction;
89494
+ SALTO_POR_TEXTO = {
89495
+ dsalcoda: [DIR.JumpDalSegno, DIR.JumpDalSegnoAlCoda],
89496
+ dsalcoda2: [DIR.JumpDalSegno, DIR.JumpDalSegnoAlDoubleCoda],
89497
+ dsalfine: [DIR.JumpDalSegno, DIR.JumpDalSegnoAlFine],
89498
+ dssalcoda: [DIR.JumpDalSegno, DIR.JumpDalSegnoSegnoAlCoda],
89499
+ dssalfine: [DIR.JumpDalSegno, DIR.JumpDalSegnoSegnoAlFine],
89500
+ dss: [DIR.JumpDalSegno, DIR.JumpDalSegnoSegno],
89501
+ dcalcoda: [DIR.JumpDaCapo, DIR.JumpDaCapoAlCoda],
89502
+ dcalcoda2: [DIR.JumpDaCapo, DIR.JumpDaCapoAlDoubleCoda],
89503
+ dcalfine: [DIR.JumpDaCapo, DIR.JumpDaCapoAlFine],
89504
+ ds: [DIR.JumpDalSegno, DIR.JumpDalSegno],
89505
+ dc: [DIR.JumpDaCapo, DIR.JumpDaCapo],
89506
+ tocoda: [DIR.JumpDaCoda, DIR.JumpDaCoda],
89507
+ tocoda2: [DIR.JumpDaCoda, DIR.JumpDaDoubleCoda],
89508
+ fine: [DIR.TargetFine, DIR.TargetFine]
89509
+ };
89510
+ claveDeSalto = (texto4) => texto4.toLowerCase().replace(/dals*segno/g, "ds").replace(/das*capo/g, "dc").replace(/[^a-z0-9]/g, "");
89178
89511
  }
89179
89512
  });
89180
89513
 
89181
89514
  // packages/io/src/archivoMtabs.ts
89182
89515
  function formatoQueNecesita(documento) {
89183
89516
  for (const pista of documento.pistas.values()) {
89184
- const pentagramas = pista.get("pentagramas");
89185
- if (typeof pentagramas === "number" && pentagramas > 1) return 5;
89186
89517
  const transposicion = pista.get("transposicion");
89187
- if (typeof transposicion === "number" && transposicion !== 0) return 5;
89518
+ if (typeof transposicion === "number" && transposicion !== 0) return 6;
89519
+ }
89520
+ for (const nota of documento.notas.values()) {
89521
+ const v = nota.get("armonicoValor");
89522
+ if (typeof v === "number" && v !== 0) return 6;
89188
89523
  }
89189
89524
  for (const figura of documento.figuras.values()) {
89190
- if (figura.get("octava") !== void 0 || figura.get("tempo") !== void 0) return 5;
89525
+ if (figura.get("octava") !== void 0 || figura.get("tempo") !== void 0) return 6;
89526
+ }
89527
+ for (const pista of documento.pistas.values()) {
89528
+ const pentagramas = pista.get("pentagramas");
89529
+ if (typeof pentagramas === "number" && pentagramas > 1) return 5;
89191
89530
  }
89192
89531
  return 4;
89193
89532
  }
@@ -89234,6 +89573,9 @@ function desempaquetar(bytes) {
89234
89573
  } catch {
89235
89574
  throw new ArchivoIlegible("El manifiesto del archivo est\xE1 da\xF1ado.");
89236
89575
  }
89576
+ if (!manifiesto || typeof manifiesto !== "object") {
89577
+ throw new ArchivoIlegible("El manifiesto del archivo est\xE1 da\xF1ado.");
89578
+ }
89237
89579
  if (!Number.isFinite(manifiesto.formato) || manifiesto.formato > VERSION_DEL_FORMATO) {
89238
89580
  throw new ArchivoIlegible(
89239
89581
  `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.`
@@ -89267,7 +89609,7 @@ var init_archivoMtabs = __esm({
89267
89609
  "packages/io/src/archivoMtabs.ts"() {
89268
89610
  init_esm();
89269
89611
  init_src2();
89270
- VERSION_DEL_FORMATO = 5;
89612
+ VERSION_DEL_FORMATO = 6;
89271
89613
  MANIFIESTO = "mandioca.json";
89272
89614
  DOCUMENTO = "documento.ydoc";
89273
89615
  CARPETA_DE_AUDIO = "audio/";
@@ -89338,7 +89680,7 @@ function gruposDeTresillo(beats) {
89338
89680
  continue;
89339
89681
  }
89340
89682
  let j = i2;
89341
- while (j + 1 < beats.length && beats[j + 1].tupletNumerator === b.tupletNumerator && beats[j + 1].tupletDenominator === b.tupletDenominator)
89683
+ 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))
89342
89684
  j++;
89343
89685
  abren.add(i2);
89344
89686
  cierran.add(j);
@@ -89346,6 +89688,16 @@ function gruposDeTresillo(beats) {
89346
89688
  }
89347
89689
  return { abren, cierran };
89348
89690
  }
89691
+ function saltosDelCompas(master) {
89692
+ const s = [];
89693
+ for (const [direccion, salto] of SALTOS) {
89694
+ if (!master?.directions?.has(direccion)) continue;
89695
+ s.push('<direction placement="above">', "<direction-type>");
89696
+ s.push(salto.simbolo ? `<${salto.simbolo}/>` : `<words>${escapar(salto.texto ?? "")}</words>`);
89697
+ s.push("</direction-type>", `<sound ${salto.sonido}/>`, "</direction>");
89698
+ }
89699
+ return s;
89700
+ }
89349
89701
  function nombreDeFigura(duracion) {
89350
89702
  return NOMBRE_DE_LA_FIGURA2.get(duracion) ?? "quarter";
89351
89703
  }
@@ -89370,6 +89722,8 @@ function posicionDePercusion(staffLine) {
89370
89722
  }
89371
89723
  function escribirNota(note, beat, staff, opciones) {
89372
89724
  const s = ["<note>"];
89725
+ const esAdorno = beat.graceType !== _barrel_exports$4.GraceType.None;
89726
+ if (esAdorno) s.push(beat.graceType === _barrel_exports$4.GraceType.BeforeBeat ? "<grace/>" : '<grace slash="yes"/>');
89373
89727
  if (opciones.esAcorde) s.push("<chord/>");
89374
89728
  const esGolpeDeKit = staff.isPercussion && note.percussionArticulation >= 0;
89375
89729
  if (esGolpeDeKit) {
@@ -89391,7 +89745,7 @@ function escribirNota(note, beat, staff, opciones) {
89391
89745
  s.push(`<octave>${octava}</octave>`);
89392
89746
  s.push("</pitch>");
89393
89747
  }
89394
- s.push(`<duration>${opciones.duracion}</duration>`);
89748
+ if (!esAdorno) s.push(`<duration>${opciones.duracion}</duration>`);
89395
89749
  if (note.isTieDestination) s.push('<tie type="stop"/>');
89396
89750
  if (note.isTieOrigin) s.push('<tie type="start"/>');
89397
89751
  const idDeInstrumento = opciones.instrumentos.get(note.percussionArticulation);
@@ -89422,8 +89776,17 @@ function escribirNota(note, beat, staff, opciones) {
89422
89776
  tecnica.push(`<string>${staff.tuning.length - note.string + 1}</string>`);
89423
89777
  tecnica.push(`<fret>${note.fret}</fret>`);
89424
89778
  }
89425
- if (note.isHammerPullOrigin) tecnica.push('<hammer-on type="start">H</hammer-on>');
89426
- if (note.hammerPullOrigin !== null) tecnica.push('<pull-off type="stop">P</pull-off>');
89779
+ const ligado = (desde, hasta) => hasta >= desde ? "hammer-on" : "pull-off";
89780
+ const origen = note.hammerPullOrigin;
89781
+ if (origen !== null) {
89782
+ const nombre = ligado(origen.fret, note.fret);
89783
+ tecnica.push(`<${nombre} type="stop"/>`);
89784
+ }
89785
+ const destino = note.hammerPullDestination;
89786
+ if (note.isHammerPullOrigin && destino) {
89787
+ const nombre = ligado(note.fret, destino.fret);
89788
+ tecnica.push(`<${nombre} type="start">${nombre === "hammer-on" ? "H" : "P"}</${nombre}>`);
89789
+ }
89427
89790
  if (note.harmonicType !== _barrel_exports$4.HarmonicType.None) tecnica.push("<harmonic/>");
89428
89791
  if (beat.isPalmMute) tecnica.push("<other-technical>palm-mute</other-technical>");
89429
89792
  if (beat.isLetRing) tecnica.push("<other-technical>let-ring</other-technical>");
@@ -89447,9 +89810,14 @@ function letraDelGolpe(beat) {
89447
89810
  const s = [];
89448
89811
  beat.lyrics.forEach((verso, i2) => {
89449
89812
  if (!verso) return;
89813
+ const sigue = verso.endsWith("-") && verso.length > 1;
89814
+ let anterior = beat.previousBeat;
89815
+ while (anterior && !anterior.lyrics?.[i2]) anterior = anterior.previousBeat;
89816
+ const viene = !!anterior?.lyrics?.[i2]?.endsWith("-");
89817
+ const silabico = sigue ? viene ? "middle" : "begin" : viene ? "end" : "single";
89450
89818
  s.push(`<lyric number="${i2 + 1}">`);
89451
- s.push("<syllabic>single</syllabic>");
89452
- s.push(...elemento("text", verso));
89819
+ s.push(`<syllabic>${silabico}</syllabic>`);
89820
+ s.push(...elemento("text", sigue ? verso.slice(0, -1) : verso));
89453
89821
  s.push("</lyric>");
89454
89822
  });
89455
89823
  return s;
@@ -89535,7 +89903,7 @@ function exportarMusicXml(score) {
89535
89903
  for (let indiceDeCompas2 = 0; indiceDeCompas2 < cantidadDeCompases; indiceDeCompas2++) {
89536
89904
  const master = score.masterBars[indiceDeCompas2];
89537
89905
  l.push(`<measure number="${indiceDeCompas2 + 1}">`);
89538
- const fifths = master?.keySignature ?? 0;
89906
+ const fifths = (pentagramas[0]?.bars[indiceDeCompas2] ?? pentagramas[0]?.bars[0])?.keySignature ?? master?.keySignature ?? 0;
89539
89907
  const modo = master?.keySignatureType === _barrel_exports$4.KeySignatureType.Minor ? "minor" : "major";
89540
89908
  const armadura = `${fifths}/${modo}`;
89541
89909
  const numerador = master?.timeSignatureNumerator ?? 4;
@@ -89590,10 +89958,15 @@ function exportarMusicXml(score) {
89590
89958
  clavesAnteriores = firmaDeClaves;
89591
89959
  }
89592
89960
  if (cambios.length > 0) l.push("<attributes>", ...cambios, "</attributes>");
89593
- if (master?.isRepeatStart) {
89961
+ const casilla = master?.alternateEndings ?? 0;
89962
+ const casillaAntes = score.masterBars[indiceDeCompas2 - 1]?.alternateEndings ?? 0;
89963
+ const casillaDespues = score.masterBars[indiceDeCompas2 + 1]?.alternateEndings ?? 0;
89964
+ const numerosDeCasilla = [0, 1, 2, 3, 4, 5, 6, 7].filter((b) => casilla & 1 << b).map((b) => b + 1).join(", ");
89965
+ if (master?.isRepeatStart || casilla && casilla !== casillaAntes) {
89594
89966
  l.push('<barline location="left">');
89595
- l.push("<bar-style>heavy-light</bar-style>");
89596
- l.push('<repeat direction="forward"/>');
89967
+ if (master?.isRepeatStart) l.push("<bar-style>heavy-light</bar-style>");
89968
+ if (casilla && casilla !== casillaAntes) l.push(`<ending number="${numerosDeCasilla}" type="start"/>`);
89969
+ if (master?.isRepeatStart) l.push('<repeat direction="forward"/>');
89597
89970
  l.push("</barline>");
89598
89971
  }
89599
89972
  if (master?.section?.text || master?.section?.marker)
@@ -89604,8 +89977,14 @@ function exportarMusicXml(score) {
89604
89977
  "</direction-type>",
89605
89978
  "</direction>"
89606
89979
  );
89607
- if (indiceDeCompas2 === 0 && score.tempo) {
89608
- const bpm = Math.round(score.tempo);
89980
+ l.push(...saltosDelCompas(master));
89981
+ const ticsDelCompas = DIVISIONES_POR_NEGRA * 4 * numerador / denominador;
89982
+ const tempos = (master?.tempoAutomations ?? []).map((a) => ({ bpm: a.value, desde: a.ratioPosition }));
89983
+ if (indiceDeCompas2 === 0 && score.tempo && !tempos.some((t) => t.desde <= 1e-6))
89984
+ tempos.unshift({ bpm: score.tempo, desde: 0 });
89985
+ for (const t of tempos) {
89986
+ const bpm = Math.round(t.bpm);
89987
+ const offset = Math.round(t.desde * ticsDelCompas);
89609
89988
  l.push(
89610
89989
  '<direction placement="above">',
89611
89990
  "<direction-type>",
@@ -89614,6 +89993,7 @@ function exportarMusicXml(score) {
89614
89993
  `<per-minute>${bpm}</per-minute>`,
89615
89994
  "</metronome>",
89616
89995
  "</direction-type>",
89996
+ ...offset > 0 ? [`<offset>${offset}</offset>`] : [],
89617
89997
  `<sound tempo="${bpm}"/>`,
89618
89998
  "</direction>"
89619
89999
  );
@@ -89632,7 +90012,7 @@ function exportarMusicXml(score) {
89632
90012
  let avance = 0;
89633
90013
  voice.beats.forEach((beat, i2) => {
89634
90014
  const duracion = beat.displayDuration;
89635
- avance += duracion;
90015
+ if (beat.graceType === _barrel_exports$4.GraceType.None) avance += duracion;
89636
90016
  if (beat.isRest || beat.notes.length === 0) {
89637
90017
  l.push(...escribirSilencio2(beat, duracion, indiceDeVoz + 1, numeroDePentagrama));
89638
90018
  return;
@@ -89658,10 +90038,14 @@ function exportarMusicXml(score) {
89658
90038
  hayAlgoEscrito = true;
89659
90039
  });
89660
90040
  }
89661
- if (master?.isRepeatEnd || master?.isDoubleBar) {
90041
+ const cierraCasilla = casilla !== 0 && casilla !== casillaDespues;
90042
+ if (master?.isRepeatEnd || master?.isDoubleBar || cierraCasilla) {
89662
90043
  l.push('<barline location="right">');
89663
- l.push(`<bar-style>${master.isRepeatEnd ? "light-heavy" : "light-light"}</bar-style>`);
89664
- if (master.isRepeatEnd)
90044
+ if (master?.isRepeatEnd || master?.isDoubleBar)
90045
+ l.push(`<bar-style>${master.isRepeatEnd ? "light-heavy" : "light-light"}</bar-style>`);
90046
+ if (cierraCasilla)
90047
+ l.push(`<ending number="${numerosDeCasilla}" type="${master?.isRepeatEnd ? "stop" : "discontinue"}"/>`);
90048
+ if (master?.isRepeatEnd)
89665
90049
  l.push(`<repeat direction="backward" times="${Math.max(2, master.repeatCount)}"/>`);
89666
90050
  l.push("</barline>");
89667
90051
  }
@@ -89706,7 +90090,7 @@ function exportarMusicXmlComprimido(score) {
89706
90090
  { mtime: FECHA_FIJA_DEL_ZIP }
89707
90091
  );
89708
90092
  }
89709
- var DIVISIONES_POR_NEGRA, FECHA_FIJA_DEL_ZIP, PASOS, NOMBRE_DE_LA_FIGURA2, ALTERACION_POR_MODO;
90093
+ var DIVISIONES_POR_NEGRA, FECHA_FIJA_DEL_ZIP, PASOS, NOMBRE_DE_LA_FIGURA2, ALTERACION_POR_MODO, D, SALTOS;
89710
90094
  var init_musicxml = __esm({
89711
90095
  "packages/io/src/musicxml.ts"() {
89712
90096
  init_alphaTab();
@@ -89736,6 +90120,28 @@ var init_musicxml = __esm({
89736
90120
  [256, "256th"]
89737
90121
  ]);
89738
90122
  ALTERACION_POR_MODO = { 2: 0, 3: 1, 4: 2, 5: -1, 6: -2 };
90123
+ D = _barrel_exports$4.Direction;
90124
+ SALTOS = [
90125
+ [D.TargetSegno, { simbolo: "segno", sonido: 'segno="segno"' }],
90126
+ [D.TargetSegnoSegno, { simbolo: "segno", sonido: 'segno="segno2"' }],
90127
+ [D.TargetCoda, { simbolo: "coda", sonido: 'coda="coda"' }],
90128
+ [D.TargetDoubleCoda, { simbolo: "coda", sonido: 'coda="coda2"' }],
90129
+ [D.TargetFine, { texto: "Fine", sonido: 'fine="yes"' }],
90130
+ [D.JumpDaCapo, { texto: "D.C.", sonido: 'dacapo="yes"' }],
90131
+ [D.JumpDaCapoAlCoda, { texto: "D.C. al Coda", sonido: 'dacapo="yes"' }],
90132
+ [D.JumpDaCapoAlDoubleCoda, { texto: "D.C. al Coda 2", sonido: 'dacapo="yes"' }],
90133
+ [D.JumpDaCapoAlFine, { texto: "D.C. al Fine", sonido: 'dacapo="yes"' }],
90134
+ [D.JumpDalSegno, { texto: "D.S.", sonido: 'dalsegno="segno"' }],
90135
+ [D.JumpDalSegnoAlCoda, { texto: "D.S. al Coda", sonido: 'dalsegno="segno"' }],
90136
+ [D.JumpDalSegnoAlDoubleCoda, { texto: "D.S. al Coda 2", sonido: 'dalsegno="segno"' }],
90137
+ [D.JumpDalSegnoAlFine, { texto: "D.S. al Fine", sonido: 'dalsegno="segno"' }],
90138
+ [D.JumpDalSegnoSegno, { texto: "D.S.S.", sonido: 'dalsegno="segno2"' }],
90139
+ [D.JumpDalSegnoSegnoAlCoda, { texto: "D.S.S. al Coda", sonido: 'dalsegno="segno2"' }],
90140
+ [D.JumpDalSegnoSegnoAlDoubleCoda, { texto: "D.S.S. al Coda 2", sonido: 'dalsegno="segno2"' }],
90141
+ [D.JumpDalSegnoSegnoAlFine, { texto: "D.S.S. al Fine", sonido: 'dalsegno="segno2"' }],
90142
+ [D.JumpDaCoda, { texto: "To Coda", sonido: 'tocoda="coda"' }],
90143
+ [D.JumpDaDoubleCoda, { texto: "To Coda 2", sonido: 'tocoda="coda2"' }]
90144
+ ];
89739
90145
  }
89740
90146
  });
89741
90147
 
@@ -89849,7 +90255,7 @@ var init_src4 = __esm({
89849
90255
  });
89850
90256
 
89851
90257
  // apps/mcp/src/obra.ts
89852
- import { readFile, writeFile } from "node:fs/promises";
90258
+ import { readFile, rename, writeFile } from "node:fs/promises";
89853
90259
  import { extname, basename } from "node:path";
89854
90260
  function reconciliarGrabaciones(obra) {
89855
90261
  const fichas = new Set(obra.documento.fuentesDeAudioEnOrden().map((f) => f.id));
@@ -89944,6 +90350,9 @@ function abrirEnBlanco(opciones = {}) {
89944
90350
  };
89945
90351
  return alAbrirLaObra(abierta);
89946
90352
  }
90353
+ function salaDeLaObraAdoptada() {
90354
+ return abierta && abierta.origen.clase === "pesta\xF1a" ? abierta.origen.sala : null;
90355
+ }
89947
90356
  function idDeLaObraActiva() {
89948
90357
  if (!abierta || abierta.origen.clase !== "pesta\xF1a") return null;
89949
90358
  if (!laPesta\u00F1aSigueViva()) return null;
@@ -89992,7 +90401,9 @@ async function guardar(rutaPedida) {
89992
90401
  fuentes: obra.fuentes,
89993
90402
  guardado: (/* @__PURE__ */ new Date()).toISOString()
89994
90403
  });
89995
- await writeFile(ruta, paquete);
90404
+ const parcial = `${ruta}.guardando`;
90405
+ await writeFile(parcial, paquete);
90406
+ await rename(parcial, ruta);
89996
90407
  const fichas = new Set(obra.documento.fuentesDeAudioEnOrden().map((f) => f.id));
89997
90408
  const conBytes = new Set(obra.grabaciones.map((g) => g.fuenteId));
89998
90409
  const mudas = [...fichas].filter((id2) => !conBytes.has(id2)).length;
@@ -90072,7 +90483,7 @@ var VERSION_DEL_CONECTOR;
90072
90483
  var init_version = __esm({
90073
90484
  "apps/mcp/src/version.ts"() {
90074
90485
  "use strict";
90075
- VERSION_DEL_CONECTOR = true ? "0.2.14" : null;
90486
+ VERSION_DEL_CONECTOR = true ? "0.2.16" : null;
90076
90487
  }
90077
90488
  });
90078
90489
 
@@ -90086,6 +90497,7 @@ __export(puente_exports, {
90086
90497
  PUERTO_POR_OMISION: () => PUERTO_POR_OMISION,
90087
90498
  SALA_DE_LA_OBRA: () => SALA_DE_LA_OBRA,
90088
90499
  SALA_DE_PEDIDOS: () => SALA_DE_PEDIDOS,
90500
+ SALA_OCIOSA_MS: () => SALA_OCIOSA_MS,
90089
90501
  abrirPuente: () => abrirPuente,
90090
90502
  buscarLaPesta\u00F1a: () => buscarLaPesta\u00F1a,
90091
90503
  cerrarPuente: () => cerrarPuente,
@@ -90114,12 +90526,14 @@ function envoltorioDe(doc) {
90114
90526
  envoltoriosPorDoc.set(doc, nuevo);
90115
90527
  return nuevo;
90116
90528
  }
90117
- function origenPermitido(origen) {
90529
+ function origenPermitido(origen, puertoDelPuente = PUERTO_POR_OMISION) {
90118
90530
  if (origen === void 0) return true;
90119
90531
  if (ORIGENES_DE_TABS.includes(origen)) return true;
90120
90532
  try {
90121
90533
  const u = new URL(origen);
90122
- return (u.protocol === "http:" || u.protocol === "https:") && ["localhost", "127.0.0.1", "[::1]"].includes(u.hostname);
90534
+ const local = (u.protocol === "http:" || u.protocol === "https:") && ["localhost", "127.0.0.1", "[::1]"].includes(u.hostname);
90535
+ if (!local) return false;
90536
+ return puertoDelPuente !== PUERTO_DEL_CONECTOR || PUERTOS_LOCALES_DE_TABS.includes(u.port);
90123
90537
  } catch {
90124
90538
  return false;
90125
90539
  }
@@ -90392,8 +90806,28 @@ function abrirDeVerdad(puerto) {
90392
90806
  const apuntarLaEtiqueta = (sala) => apuntarLaEtiquetaDe(idDeLaSala(sala));
90393
90807
  const sincronizadas = /* @__PURE__ */ new Set();
90394
90808
  const deLaSala = (sala) => [...conexiones].filter(([, s]) => s === sala).map(([c]) => c);
90809
+ const relojesDeSalas = /* @__PURE__ */ new Map();
90810
+ const noSoltarla = (sala) => {
90811
+ const reloj = relojesDeSalas.get(sala);
90812
+ if (reloj) clearTimeout(reloj);
90813
+ relojesDeSalas.delete(sala);
90814
+ };
90815
+ const soltarSiSigueVacia = (sala) => {
90816
+ relojesDeSalas.delete(sala);
90817
+ if (sala === SALA_DE_LA_OBRA || sala === SALA_DE_PEDIDOS) return;
90818
+ if (deLaSala(sala).length > 0 || salaDeLaObraAdoptada() === sala) return;
90819
+ const doc = docs.get(sala);
90820
+ docs.delete(sala);
90821
+ sincronizadas.delete(sala);
90822
+ doc?.destroy();
90823
+ };
90395
90824
  const olvidarSiQuedoVacia = (sala) => {
90396
- if (deLaSala(sala).length === 0) sincronizadas.delete(sala);
90825
+ if (deLaSala(sala).length > 0) return;
90826
+ sincronizadas.delete(sala);
90827
+ noSoltarla(sala);
90828
+ const reloj = setTimeout(() => soltarSiSigueVacia(sala), SALA_OCIOSA_MS);
90829
+ reloj.unref?.();
90830
+ relojesDeSalas.set(sala, reloj);
90397
90831
  };
90398
90832
  const escuchar = (sala, doc) => {
90399
90833
  doc.on("update", (cambio, origen) => {
@@ -90412,7 +90846,7 @@ function abrirDeVerdad(puerto) {
90412
90846
  const servidor2 = new import_websocket_server.default({
90413
90847
  server: http,
90414
90848
  // Ver `origenPermitido`: una página de otro sitio recibe un 401 y no llega a la obra.
90415
- verifyClient: ({ origin }) => origenPermitido(origin || void 0)
90849
+ verifyClient: ({ origin }) => origenPermitido(origin || void 0, puerto)
90416
90850
  });
90417
90851
  servidor2.on("error", () => {
90418
90852
  });
@@ -90424,8 +90858,15 @@ function abrirDeVerdad(puerto) {
90424
90858
  );
90425
90859
  });
90426
90860
  servidor2.on("connection", (conexion, peticion) => {
90427
- const pedida = decodeURIComponent((peticion.url ?? "").replace(/^\/+/, "").split("?")[0] ?? "");
90861
+ let pedida;
90862
+ try {
90863
+ pedida = decodeURIComponent((peticion.url ?? "").replace(/^\/+/, "").split("?")[0] ?? "");
90864
+ } catch {
90865
+ conexion.close(1008, "sala mal escrita");
90866
+ return;
90867
+ }
90428
90868
  const sala = salaValida(pedida) ? pedida : SALA_DE_LA_OBRA;
90869
+ noSoltarla(sala);
90429
90870
  const doc = docDeLaSala(sala);
90430
90871
  if (esDeObra(sala) && deLaSala(sala).length > 0) {
90431
90872
  conexion.close(4001, "Ya hay otra pesta\xF1a conectada a la IA. Descon\xE9ctala antes de conectar \xE9sta.");
@@ -90519,8 +90960,14 @@ function abrirDeVerdad(puerto) {
90519
90960
  // separa la vida del buzón de la del documento. Ver el bloque del índice.
90520
90961
  pedidosDe: (id2) => docs.get(salaDelBuzonDe(id2)),
90521
90962
  escuchanPedidosDe: (id2) => deLaSala(salaDelBuzonDe(id2)).length,
90963
+ oyentesDe: (canal) => {
90964
+ for (const [sala, doc] of docs) if (doc === canal) return deLaSala(sala).length;
90965
+ return 0;
90966
+ },
90522
90967
  cerrar: () => new Promise((listo) => {
90523
90968
  clearInterval(latidoDelPuente);
90969
+ for (const reloj of relojesDeSalas.values()) clearTimeout(reloj);
90970
+ relojesDeSalas.clear();
90524
90971
  for (const c of conexiones.keys()) c.close();
90525
90972
  conexiones.clear();
90526
90973
  mostrador.clear();
@@ -90574,7 +91021,7 @@ async function pedirALaPesta\u00F1a(herramienta, argumentos = {}, msDelAcuse = E
90574
91021
  const p = exigirPesta\u00F1a();
90575
91022
  const canal = await canalDePedidos(p, herramienta);
90576
91023
  const mapa = canal.getMap("pedidos");
90577
- const id2 = `p${siguienteId += 1}`;
91024
+ const id2 = `p${INSTANCIA}-${siguienteId += 1}`;
90578
91025
  try {
90579
91026
  return await new Promise((resolver, rechazar) => {
90580
91027
  let acusado = false;
@@ -90589,7 +91036,7 @@ async function pedirALaPesta\u00F1a(herramienta, argumentos = {}, msDelAcuse = E
90589
91036
  }, msDelAcuse);
90590
91037
  let desdeCuandoNoHayNadie = null;
90591
91038
  const latido = setInterval(() => {
90592
- if (p.pesta\u00F1as() > 0) {
91039
+ if (p.oyentesDe(canal) > 0) {
90593
91040
  desdeCuandoNoHayNadie = null;
90594
91041
  return;
90595
91042
  }
@@ -90632,7 +91079,7 @@ async function pedirALaPesta\u00F1a(herramienta, argumentos = {}, msDelAcuse = E
90632
91079
  canal.transact(() => mapa.delete(id2));
90633
91080
  }
90634
91081
  }
90635
- 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;
91082
+ var envoltoriosPorDoc, SINCRONIZAR, PRESENCIA, SALA_DE_LA_OBRA, SALA_DE_PEDIDOS, PUERTO_POR_OMISION, ORIGENES_DE_TABS, PUERTOS_LOCALES_DE_TABS, PUERTO_DEL_CONECTOR, 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, SALA_OCIOSA_MS, MARGEN_PARA_QUE_ENTRE_MS;
90636
91083
  var init_puente = __esm({
90637
91084
  "apps/mcp/src/puente.ts"() {
90638
91085
  "use strict";
@@ -90656,6 +91103,8 @@ var init_puente = __esm({
90656
91103
  "https://mandioca-tabs.entelequia.workers.dev",
90657
91104
  ...(process.env["MANDIOCA_TABS_ORIGENES"] ?? "").split(",").map((o) => o.trim().replace(/\/+$/, "")).filter(Boolean)
90658
91105
  ];
91106
+ PUERTOS_LOCALES_DE_TABS = ["5173", "4173"];
91107
+ PUERTO_DEL_CONECTOR = 5183;
90659
91108
  puente = null;
90660
91109
  reclamado = false;
90661
91110
  ESPERA_POR_LA_PESTA\u00D1A = 3500;
@@ -90666,10 +91115,12 @@ var init_puente = __esm({
90666
91115
  );
90667
91116
  abriendo = null;
90668
91117
  siguienteId = 0;
91118
+ INSTANCIA = `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
90669
91119
  ESPERA_DEL_ACUSE_MS = Number(process.env["MANDIOCA_TABS_ACUSE_MS"] ?? 5e3);
90670
91120
  LATIDO_MS = 250;
90671
91121
  LATIDO_DEL_PUENTE_MS = 1e4;
90672
91122
  AUSENCIA_PARA_DARLA_POR_IDA_MS = 2e3;
91123
+ SALA_OCIOSA_MS = Number(process.env["MANDIOCA_TABS_SALA_OCIOSA_MS"] ?? 10 * 6e4);
90673
91124
  MARGEN_PARA_QUE_ENTRE_MS = 750;
90674
91125
  }
90675
91126
  });
@@ -97994,6 +98445,48 @@ var init_estilo = __esm({
97994
98445
  });
97995
98446
 
97996
98447
  // packages/projection/src/proyectar.ts
98448
+ function silenciosQueLlenan(tics) {
98449
+ const valores = [];
98450
+ let quedan = tics;
98451
+ for (const valor of [1, 2, 4, 8, 16, 32, 64]) {
98452
+ const dura = 3840 / valor;
98453
+ while (quedan >= dura) {
98454
+ valores.push(valor);
98455
+ quedan -= dura;
98456
+ }
98457
+ }
98458
+ return valores;
98459
+ }
98460
+ function valorDeArmonicoNatural(traste) {
98461
+ switch (traste) {
98462
+ case 2:
98463
+ return 2.4;
98464
+ case 3:
98465
+ return 3.2;
98466
+ case 4:
98467
+ case 5:
98468
+ case 7:
98469
+ case 9:
98470
+ case 12:
98471
+ case 16:
98472
+ case 17:
98473
+ case 19:
98474
+ case 24:
98475
+ return traste;
98476
+ case 8:
98477
+ return 8.2;
98478
+ case 10:
98479
+ return 9.6;
98480
+ case 14:
98481
+ case 15:
98482
+ return 14.7;
98483
+ case 21:
98484
+ case 22:
98485
+ return 21.7;
98486
+ default:
98487
+ return 12;
98488
+ }
98489
+ }
97997
98490
  function canalesDeLasPistas(tipos) {
97998
98491
  const libres = Array.from({ length: 16 }, (_, i2) => i2).filter((c) => c !== 9);
97999
98492
  const conAltura = tipos.filter((t) => t !== "percusion").length;
@@ -98147,20 +98640,24 @@ function proyectar(documento, opciones = {}) {
98147
98640
  cantidadDeVoces = Math.max(cantidadDeVoces, datos2.voz + 1);
98148
98641
  }
98149
98642
  }
98643
+ const deLaPista = [...compasesPorPista.entries()].filter(([clave]) => clave.startsWith(`${idPista}|`)).map(([, mapa]) => mapa);
98150
98644
  const acordesEscritos = [];
98151
98645
  maestros.forEach((m, indiceDeCompas2) => {
98152
- const id2 = porMaestro.get(m.id);
98153
- for (const { datos: f } of id2 ? figurasPorCompas.get(id2) ?? [] : []) {
98154
- if (f.acorde) {
98155
- acordesEscritos.push({ compas: indiceDeCompas2, tiempo: f.tiempo, nombre: f.acorde });
98646
+ for (const mapa of deLaPista) {
98647
+ const id2 = mapa.get(m.id);
98648
+ for (const { datos: f } of id2 ? figurasPorCompas.get(id2) ?? [] : []) {
98649
+ if (f.acorde) {
98650
+ acordesEscritos.push({ compas: indiceDeCompas2, tiempo: f.tiempo, nombre: f.acorde });
98651
+ }
98156
98652
  }
98157
98653
  }
98158
98654
  });
98655
+ acordesEscritos.sort((a, b) => a.compas - b.compas || a.tiempo - b.tiempo);
98159
98656
  const acordeVigente = buscadorDeAcorde(acordesEscritos);
98160
98657
  maestros.forEach((maestro, indiceDeCompas2) => {
98161
98658
  const barra = new _barrel_exports$4.Bar();
98162
98659
  pentagrama.addBar(barra);
98163
- barra.keySignature = maestro.datos.tonalidad;
98660
+ barra.keySignature = armaduraEscrita(maestro.datos.tonalidad, pista.transposicion ?? 0);
98164
98661
  barra.simileMark = maestro.datos.repiteAnterior;
98165
98662
  const idCompas = porMaestro.get(maestro.id);
98166
98663
  const figuras = idCompas ? figurasPorCompas.get(idCompas) ?? [] : [];
@@ -98170,8 +98667,8 @@ function proyectar(documento, opciones = {}) {
98170
98667
  barra.clefOttava = datosDelCompas.claveOctava;
98171
98668
  }
98172
98669
  const ticsDelCompas = 960 * 4 * maestro.datos.numerador / maestro.datos.denominador;
98173
- for (const { datos: figura } of figuras) {
98174
- if (!figura.pedal) continue;
98670
+ 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);
98671
+ for (const figura of conPedal) {
98175
98672
  const marcador = new _barrel_exports$4.SustainPedalMarker();
98176
98673
  marcador.ratioPosition = ticsDelCompas > 0 ? figura.tiempo / ticsDelCompas : 0;
98177
98674
  marcador.pedalType = figura.pedal - 1;
@@ -98181,7 +98678,17 @@ function proyectar(documento, opciones = {}) {
98181
98678
  const voz = new _barrel_exports$4.Voice();
98182
98679
  barra.addVoice(voz);
98183
98680
  const deEstaVoz = figuras.filter((f) => f.datos.voz === indiceDeVoz).sort((a, b) => a.datos.tiempo - b.datos.tiempo);
98681
+ let posicion = 0;
98184
98682
  for (const { id: idFigura, datos: figura } of deEstaVoz) {
98683
+ if (!figura.adorno && figura.tiempo - posicion >= 30) {
98684
+ for (const valor of silenciosQueLlenan(figura.tiempo - Math.round(posicion))) {
98685
+ const silencio = new _barrel_exports$4.Beat();
98686
+ silencio.duration = valor;
98687
+ voz.addBeat(silencio);
98688
+ }
98689
+ posicion = figura.tiempo;
98690
+ }
98691
+ posicion += figura.adorno ? 0 : ticsExactosDeFigura(figura);
98185
98692
  const golpe = new _barrel_exports$4.Beat();
98186
98693
  golpe.duration = figura.valor;
98187
98694
  golpe.dots = figura.puntillos;
@@ -98270,6 +98777,8 @@ function proyectar(documento, opciones = {}) {
98270
98777
  notaAlphaTab.slideInType = nota.deslizamientoEntrada;
98271
98778
  notaAlphaTab.slideOutType = nota.deslizamientoSalida;
98272
98779
  notaAlphaTab.harmonicType = nota.armonico;
98780
+ if (nota.armonico)
98781
+ notaAlphaTab.harmonicValue = nota.armonicoValor || (nota.armonico === _barrel_exports$4.HarmonicType.Natural ? valorDeArmonicoNatural(nota.traste) : 12);
98273
98782
  notaAlphaTab.vibrato = nota.anchoDeVibrato;
98274
98783
  notaAlphaTab.accentuated = nota.acento;
98275
98784
  notaAlphaTab.isLeftHandTapped = nota.tappingIzquierda;
@@ -122522,6 +123031,68 @@ var EMPTY_COMPLETION_RESULT = {
122522
123031
  }
122523
123032
  };
122524
123033
 
123034
+ // apps/mcp/src/anotaciones.ts
123035
+ var LEEN = /* @__PURE__ */ new Set([
123036
+ "acorde_en_el_cursor",
123037
+ "acordes_de_la_obra",
123038
+ "afinaciones_disponibles",
123039
+ "ajustes_de_video",
123040
+ "atajos_del_programa",
123041
+ "audios_rechazados_por_largos",
123042
+ "captura",
123043
+ "direcciones_disponibles",
123044
+ "efectos_disponibles",
123045
+ "estado_de_la_conexion",
123046
+ "estado_de_la_obra",
123047
+ "estilo_de_la_obra",
123048
+ "estructura_de_la_obra",
123049
+ "formas_de_bend",
123050
+ "formatos_de_exportacion",
123051
+ "instrumentos_disponibles",
123052
+ "leer_compases",
123053
+ "leer_curva_de_bend",
123054
+ "leer_letra",
123055
+ "letra_estacionada",
123056
+ "letra_sincronizada",
123057
+ "matices_disponibles",
123058
+ "obras_conectadas",
123059
+ "obras_recientes",
123060
+ "piezas_de_bateria",
123061
+ "precision_del_alineador",
123062
+ "que_hace_un_control",
123063
+ "secciones_de_la_obra",
123064
+ "signos_de_una_nota",
123065
+ "signos_disponibles",
123066
+ "variantes_disponibles"
123067
+ ]);
123068
+ var BORRAN = /* @__PURE__ */ new Set([
123069
+ "borrar_compas",
123070
+ "borrar_compases_desde",
123071
+ "borrar_compases_hasta",
123072
+ "borrar_figura",
123073
+ "borrar_grabacion",
123074
+ "borrar_notas",
123075
+ "borrar_pista",
123076
+ "cortar_pasaje",
123077
+ "desanclar_todo",
123078
+ "olvidar_reciente",
123079
+ "quitar_cuerda",
123080
+ "quitar_grabacion",
123081
+ "quitar_silaba",
123082
+ // Pisan un archivo del disco si se les pide (`pisar`), y eso no tiene «deshacer».
123083
+ "guardar_obra",
123084
+ "guardar_grabacion",
123085
+ "guardar_letra",
123086
+ "exportar",
123087
+ "exportar_audio",
123088
+ "exportar_pdf",
123089
+ "exportar_video"
123090
+ ]);
123091
+ function anotacionesDe(nombre) {
123092
+ if (LEEN.has(nombre)) return { readOnlyHint: true, openWorldHint: false };
123093
+ return { readOnlyHint: false, destructiveHint: BORRAN.has(nombre), openWorldHint: false };
123094
+ }
123095
+
122525
123096
  // apps/mcp/src/herramientas/documento.ts
122526
123097
  init_src2();
122527
123098
  init_src3();
@@ -122593,7 +123164,16 @@ function duracionDesde(figura, puntillos) {
122593
123164
  return { valor: figura, puntillos: puntillos ?? 0 };
122594
123165
  }
122595
123166
  function ticsDelGolpe(indice, pistaId, compas, voz, golpe, tics, pentagrama = 0) {
122596
- if (tics !== void 0) return tics;
123167
+ if (tics !== void 0) {
123168
+ const maestro = indice.compasMaestro(compas);
123169
+ const largo = maestro ? 3840 * maestro.datos.numerador / maestro.datos.denominador : 3840;
123170
+ if (!Number.isInteger(tics) || tics < 0 || tics >= largo) {
123171
+ throw new ProblemaConLaObra(
123172
+ `${tics} tics queda fuera del comp\xE1s ${compas + 1}, que mide ${largo} (de 0 a ${largo - 1}; 960 por negra).`
123173
+ );
123174
+ }
123175
+ return tics;
123176
+ }
122597
123177
  if (golpe === void 0) return 0;
122598
123178
  const compasId = indice.compasId(pistaId, compas, pentagrama);
122599
123179
  const figuras = indice.figuras(compasId, voz);
@@ -122642,7 +123222,7 @@ function segundaParaLeer(texto4, marcas) {
122642
123222
  // apps/mcp/src/herramientas/documento.ts
122643
123223
  var unaNota = {
122644
123224
  compas: external_exports.number().int().min(1).max(9999),
122645
- 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."),
123225
+ 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."),
122646
123226
  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)."),
122647
123227
  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`."),
122648
123228
  golpe: external_exports.number().int().min(1).max(999).optional(),
@@ -122917,7 +123497,7 @@ function registrarHerramientasDelDocumento(servidor2) {
122917
123497
  title: "Leer un pasaje",
122918
123498
  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.",
122919
123499
  inputSchema: {
122920
- 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."),
123500
+ 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."),
122921
123501
  hasta: external_exports.number().int().min(1).max(9999).optional().describe("\xDAltimo comp\xE1s, incluido. Por omisi\xF3n, el mismo que `desde`."),
122922
123502
  pista: external_exports.number().int().min(1).max(999).optional().describe("Cu\xE1l pista. Por omisi\xF3n, todas.")
122923
123503
  }
@@ -122974,7 +123554,7 @@ function registrarHerramientasDelDocumento(servidor2) {
122974
123554
  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.",
122975
123555
  inputSchema: {
122976
123556
  pista: external_exports.number().int().min(1).max(999).optional(),
122977
- 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."),
123557
+ 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."),
122978
123558
  puntillos: external_exports.number().int().min(0).max(2).optional(),
122979
123559
  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.")
122980
123560
  }
@@ -122984,62 +123564,69 @@ function registrarHerramientasDelDocumento(servidor2) {
122984
123564
  empezarUnPaso();
122985
123565
  const duracion = duracionDesde(figura, puntillos);
122986
123566
  const escritas = [];
122987
- for (const nota of notas) {
122988
- const indice = indexar(documento);
122989
- const volcado = volcar(documento);
122990
- const laPista = pistaDelMusico(pista ?? 1, volcado, documento);
122991
- const pistaId = laPista.id;
122992
- const compas = indiceDeCompas(nota.compas, indice);
122993
- const voz = (nota.voz ?? 1) - 1;
122994
- const pentagrama = pentagramaDelMusico(nota.pentagrama, indice, pistaId, pista ?? 1);
122995
- const tiempo = ticsDelGolpe(indice, pistaId, compas, voz, nota.golpe, nota.tics, pentagrama);
122996
- const nombrada = comoSeEscribeLaNota(laPista.tipo, laPista.nombre, pista ?? 1, nota);
122997
- if (nombrada.clase === "altura") {
122998
- const resultado2 = escribirAltura(
122999
- documento,
123000
- indice,
123001
- cursorEn(indice, pistaId, compas, voz, tiempo, 1, pentagrama),
123002
- nombrada.altura,
123003
- duracion ? { duracion } : {}
123004
- );
123005
- if (!resultado2) {
123006
- throw new ProblemaConLaObra(
123007
- `No se pudo escribir la altura ${nombrada.altura} en el comp\xE1s ${nota.compas} de la pista ${pista ?? 1} \xAB${laPista.nombre}\xBB.`
123567
+ const laPista = pistaDelMusico(pista ?? 1, volcar(documento), documento);
123568
+ const pistaId = laPista.id;
123569
+ try {
123570
+ for (const nota of notas) {
123571
+ const indice = indexar(documento);
123572
+ const compas = indiceDeCompas(nota.compas, indice);
123573
+ const voz = (nota.voz ?? 1) - 1;
123574
+ const pentagrama = pentagramaDelMusico(nota.pentagrama, indice, pistaId, pista ?? 1);
123575
+ const tiempo = ticsDelGolpe(indice, pistaId, compas, voz, nota.golpe, nota.tics, pentagrama);
123576
+ const nombrada = comoSeEscribeLaNota(laPista.tipo, laPista.nombre, pista ?? 1, nota);
123577
+ if (nombrada.clase === "altura") {
123578
+ const resultado2 = escribirAltura(
123579
+ documento,
123580
+ indice,
123581
+ cursorEn(indice, pistaId, compas, voz, tiempo, 1, pentagrama),
123582
+ nombrada.altura,
123583
+ duracion ? { duracion } : {}
123008
123584
  );
123585
+ if (!resultado2) {
123586
+ throw new ProblemaConLaObra(
123587
+ `No se pudo escribir la altura ${nombrada.altura} en el comp\xE1s ${nota.compas} de la pista ${pista ?? 1} \xAB${laPista.nombre}\xBB.`
123588
+ );
123589
+ }
123590
+ escritas.push(`c${nota.compas} altura ${nombrada.altura}`);
123591
+ continue;
123009
123592
  }
123010
- escritas.push(`c${nota.compas} altura ${nombrada.altura}`);
123011
- continue;
123012
- }
123013
- if (nombrada.clase === "percusion") {
123014
- const resultado2 = escribirPercusion(
123593
+ if (nombrada.clase === "percusion") {
123594
+ const resultado2 = escribirPercusion(
123595
+ documento,
123596
+ indice,
123597
+ cursorEn(indice, pistaId, compas, voz, tiempo, 1, pentagrama),
123598
+ nombrada.articulacion,
123599
+ duracion ? { duracion } : {}
123600
+ );
123601
+ if (!resultado2) {
123602
+ throw new ProblemaConLaObra(
123603
+ `No se pudo escribir \xAB${nombrada.nombre}\xBB en el comp\xE1s ${nota.compas} de la pista ${pista ?? 1} \xAB${laPista.nombre}\xBB.`
123604
+ );
123605
+ }
123606
+ escritas.push(`c${nota.compas} ${nombrada.nombre}`);
123607
+ continue;
123608
+ }
123609
+ const resultado = escribirTraste(
123015
123610
  documento,
123016
123611
  indice,
123017
- cursorEn(indice, pistaId, compas, voz, tiempo, 1, pentagrama),
123018
- nombrada.articulacion,
123612
+ cursorEn(indice, pistaId, compas, voz, tiempo, nombrada.cuerda, pentagrama),
123613
+ nombrada.cuerda,
123614
+ nombrada.traste,
123019
123615
  duracion ? { duracion } : {}
123020
123616
  );
123021
- if (!resultado2) {
123617
+ if (!resultado) {
123022
123618
  throw new ProblemaConLaObra(
123023
- `No se pudo escribir \xAB${nombrada.nombre}\xBB en el comp\xE1s ${nota.compas} de la pista ${pista ?? 1} \xAB${laPista.nombre}\xBB.`
123619
+ `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.`
123024
123620
  );
123025
123621
  }
123026
- escritas.push(`c${nota.compas} ${nombrada.nombre}`);
123027
- continue;
123622
+ escritas.push(`c${nota.compas} cuerda ${nombrada.cuerda} traste ${nombrada.traste}`);
123028
123623
  }
123029
- const resultado = escribirTraste(
123030
- documento,
123031
- indice,
123032
- cursorEn(indice, pistaId, compas, voz, tiempo, nombrada.cuerda, pentagrama),
123033
- nombrada.cuerda,
123034
- nombrada.traste,
123035
- duracion ? { duracion } : {}
123624
+ } catch (e) {
123625
+ if (escritas.length > 0) documento.historial().undo();
123626
+ const motivo = e instanceof Error ? e.message : String(e);
123627
+ throw new ProblemaConLaObra(
123628
+ escritas.length > 0 ? `${motivo} No se escribi\xF3 ninguna nota de esta tanda: las ${escritas.length} anteriores se deshicieron.` : motivo
123036
123629
  );
123037
- if (!resultado) {
123038
- throw new ProblemaConLaObra(
123039
- `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.`
123040
- );
123041
- }
123042
- escritas.push(`c${nota.compas} cuerda ${nombrada.cuerda} traste ${nombrada.traste}`);
123043
123630
  }
123044
123631
  return texto2({ escritas: escritas.length, detalle: escritas });
123045
123632
  }
@@ -123058,11 +123645,10 @@ function registrarHerramientasDelDocumento(servidor2) {
123058
123645
  const { documento } = obraAbierta();
123059
123646
  empezarUnPaso();
123060
123647
  let borradas = 0;
123648
+ const laPista = pistaDelMusico(pista ?? 1, volcar(documento), documento);
123649
+ const pistaId = laPista.id;
123061
123650
  for (const nota of notas) {
123062
123651
  const indice = indexar(documento);
123063
- const volcado = volcar(documento);
123064
- const laPista = pistaDelMusico(pista ?? 1, volcado, documento);
123065
- const pistaId = laPista.id;
123066
123652
  const compas = indiceDeCompas(nota.compas, indice);
123067
123653
  const voz = (nota.voz ?? 1) - 1;
123068
123654
  const pentagrama = pentagramaDelMusico(nota.pentagrama, indice, pistaId, pista ?? 1);
@@ -123323,8 +123909,8 @@ function registrarHerramientasDelPuente(servidor2) {
123323
123909
  title: "Cambiar c\xF3mo se ve la partitura",
123324
123910
  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.",
123325
123911
  inputSchema: {
123326
- vista: external_exports.enum(["renglones", "horizontal", "hoja"], { error: (i2) => `\xAB${i2.input}\xBB no es una vista: renglones, horizontal u hoja.` }).optional(),
123327
- pistas: external_exports.enum(["una", "todas"], { error: (i2) => `\xAB${i2.input}\xBB no dice cu\xE1ntas pistas: una o todas.` }).optional(),
123912
+ 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(),
123913
+ 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(),
123328
123914
  /**
123329
123915
  * ★ Los valores son EXACTAMENTE los que ofrece el menú: «los que entren» (−1) y 1, 2,
123330
123916
  * 3, 4, 5, 6, 8, 10, 12. No es una lista caprichosa, es la que el músico puede
@@ -123396,7 +123982,7 @@ function registrarHerramientasDelPuente(servidor2) {
123396
123982
  compas: external_exports.number().int().min(1).max(9999).describe("El primer comp\xE1s, contando desde 1."),
123397
123983
  hasta: external_exports.number().int().min(1).max(9999).optional().describe("El \xFAltimo comp\xE1s, incluido."),
123398
123984
  golpe: external_exports.number().int().min(1).optional().describe("Empezar en un golpe concreto del primer comp\xE1s, en vez de en su comienzo."),
123399
- 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.")
123985
+ 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.")
123400
123986
  }
123401
123987
  },
123402
123988
  async (args2) => texto3(await pedirALaPesta\u00F1a("seleccionar", args2))
@@ -123476,7 +124062,7 @@ function registrarHerramientasDelPuente(servidor2) {
123476
124062
  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.",
123477
124063
  inputSchema: {
123478
124064
  puesto: external_exports.boolean().optional().describe("true lo pone, false lo saca. Sin esto, alterna."),
123479
- 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(
124065
+ 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(
123480
124066
  "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."
123481
124067
  )
123482
124068
  }
@@ -123569,7 +124155,7 @@ function registrarHerramientasDelPuente(servidor2) {
123569
124155
  silenciada: external_exports.boolean().optional(),
123570
124156
  enSolo: external_exports.boolean().optional(),
123571
124157
  visible: external_exports.boolean().optional().describe("Mostrarla u ocultarla en el pliego."),
123572
- 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."),
124158
+ 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."),
123573
124159
  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.")
123574
124160
  }
123575
124161
  },
@@ -123787,7 +124373,7 @@ function registrarHerramientasDelPuente(servidor2) {
123787
124373
  title: "El volumen general de la escucha",
123788
124374
  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.",
123789
124375
  inputSchema: {
123790
- 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.")
124376
+ 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.")
123791
124377
  }
123792
124378
  },
123793
124379
  async (args2) => texto3(await pedirALaPesta\u00F1a("volumen_general", args2))
@@ -124107,7 +124693,7 @@ function registrarHerramientasDeSignos(servidor2) {
124107
124693
  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.",
124108
124694
  inputSchema: {
124109
124695
  compas: external_exports.number().int().min(1).max(9999),
124110
- 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."),
124696
+ 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."),
124111
124697
  golpe: external_exports.number().int().min(1).max(999).optional(),
124112
124698
  tics: external_exports.number().int().min(0).max(99999).optional(),
124113
124699
  pista: external_exports.number().int().min(1).max(999).optional(),
@@ -124209,7 +124795,7 @@ function registrarHerramientasDeDuraciones(servidor2) {
124209
124795
  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.",
124210
124796
  inputSchema: {
124211
124797
  ...DONDE,
124212
- direccion: external_exports.enum(["mas-larga", "mas-corta"], { error: (i2) => `\xAB${i2.input}\xBB no es una direcci\xF3n: mas-larga o mas-corta.` })
124798
+ 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.` })
124213
124799
  }
124214
124800
  },
124215
124801
  ({ direccion, ...donde }) => {
@@ -124664,7 +125250,7 @@ function registrarHerramientasDeEstructura(servidor2) {
124664
125250
  {
124665
125251
  title: "Agregar compases al final",
124666
125252
  description: "Alarga la obra. Los compases nuevos heredan la cifra de comp\xE1s del \xFAltimo.",
124667
- 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.` }) }
125253
+ 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.` }) }
124668
125254
  },
124669
125255
  ({ cuantos }) => {
124670
125256
  const { documento } = obraAbierta();
@@ -124678,8 +125264,8 @@ function registrarHerramientasDeEstructura(servidor2) {
124678
125264
  title: "Insertar un comp\xE1s",
124679
125265
  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.",
124680
125266
  inputSchema: {
124681
- 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."),
124682
- 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.")
125267
+ 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."),
125268
+ 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.")
124683
125269
  }
124684
125270
  },
124685
125271
  ({ despuesDel, antesDel }) => {
@@ -125230,7 +125816,7 @@ function registrarHerramientasDeMusica(servidor2) {
125230
125816
  inputSchema: {
125231
125817
  ...RANGO,
125232
125818
  hasta: external_exports.number().int().min(1).max(9999),
125233
- 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.` })
125819
+ 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.` })
125234
125820
  }
125235
125821
  },
125236
125822
  ({ semitonos, ...donde }) => {
@@ -125250,7 +125836,7 @@ function registrarHerramientasDeMusica(servidor2) {
125250
125836
  {
125251
125837
  title: "Deshacer",
125252
125838
  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.",
125253
- 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() }
125839
+ 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() }
125254
125840
  },
125255
125841
  ({ pasos }) => {
125256
125842
  const { documento } = obraAbierta();
@@ -125269,7 +125855,7 @@ function registrarHerramientasDeMusica(servidor2) {
125269
125855
  {
125270
125856
  title: "Rehacer",
125271
125857
  description: "Vuelve adelante lo que se deshizo.",
125272
- 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() }
125858
+ 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() }
125273
125859
  },
125274
125860
  ({ pasos }) => {
125275
125861
  const { documento } = obraAbierta();
@@ -125418,7 +126004,7 @@ function registrarHerramientasDeMusica(servidor2) {
125418
126004
  golpe: external_exports.number().int().min(1).max(999).optional(),
125419
126005
  pista: external_exports.number().int().min(1).max(999).optional(),
125420
126006
  voz: external_exports.number().int().min(1).max(4).optional(),
125421
- 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."),
126007
+ 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."),
125422
126008
  puntillos: external_exports.number().int().min(0).max(2).optional()
125423
126009
  }
125424
126010
  },
@@ -125503,8 +126089,8 @@ function registrarHerramientasDeMusica(servidor2) {
125503
126089
  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.",
125504
126090
  inputSchema: {
125505
126091
  ...RANGO,
125506
- 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(),
125507
- hacia: external_exports.enum(["arriba", "abajo"], { error: (i2) => `\xAB${i2.input}\xBB no es una direcci\xF3n: arriba o abajo.` })
126092
+ 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(),
126093
+ 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.` })
125508
126094
  }
125509
126095
  },
125510
126096
  ({ hacia, ...donde }) => {
@@ -125572,7 +126158,7 @@ function registrarHerramientasDeMusica(servidor2) {
125572
126158
  title: "La letra alineada contra la grabaci\xF3n",
125573
126159
  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.",
125574
126160
  inputSchema: {
125575
- 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."),
126161
+ 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."),
125576
126162
  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.")
125577
126163
  }
125578
126164
  },
@@ -125600,7 +126186,7 @@ function registrarHerramientasDeMusica(servidor2) {
125600
126186
  title: "Corregir una s\xEDlaba de la letra sincronizada",
125601
126187
  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.",
125602
126188
  inputSchema: {
125603
- 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`."),
126189
+ 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`."),
125604
126190
  texto: external_exports.string().optional(),
125605
126191
  desde: external_exports.number().optional().describe("En qu\xE9 segundo empieza a cantarse."),
125606
126192
  hasta: external_exports.number().optional().describe("En qu\xE9 segundo termina."),
@@ -125643,7 +126229,7 @@ function registrarHerramientasDeMusica(servidor2) {
125643
126229
  title: "Copiar una s\xEDlaba a otro instante",
125644
126230
  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.",
125645
126231
  inputSchema: {
125646
- 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.` }),
126232
+ 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.` }),
125647
126233
  desde: external_exports.number().describe("En qu\xE9 segundo empieza la copia."),
125648
126234
  hasta: external_exports.number().optional().describe("En qu\xE9 segundo termina. Por omisi\xF3n, dura lo mismo que la original.")
125649
126235
  }
@@ -125668,7 +126254,7 @@ function registrarHerramientasDeMusica(servidor2) {
125668
126254
  title: "Partir una s\xEDlaba en dos",
125669
126255
  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.",
125670
126256
  inputSchema: {
125671
- 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`."),
126257
+ 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`."),
125672
126258
  izquierda: external_exports.string().describe("El texto que queda en la primera."),
125673
126259
  derecha: external_exports.string().describe("El texto de la nueva.")
125674
126260
  }
@@ -125688,8 +126274,8 @@ function registrarHerramientasDeMusica(servidor2) {
125688
126274
  title: "Sacar una s\xEDlaba de la letra sincronizada",
125689
126275
  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.",
125690
126276
  inputSchema: {
125691
- 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`."),
125692
- 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.")
126277
+ 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`."),
126278
+ 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.")
125693
126279
  }
125694
126280
  },
125695
126281
  ({ silaba, hasta }) => {
@@ -125732,7 +126318,7 @@ function registrarHerramientasDeMusica(servidor2) {
125732
126318
  campo: external_exports.string().describe(`Cu\xE1l: ${Object.keys(VARIANTES).join(", ")}. De \`variantes_disponibles\`.`),
125733
126319
  variante: external_exports.string().describe("El nombre de la variante, de `variantes_disponibles`."),
125734
126320
  compas: external_exports.number().int().min(1).max(9999),
125735
- 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.` }),
126321
+ 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.` }),
125736
126322
  golpe: external_exports.number().int().min(1).max(999).optional(),
125737
126323
  tics: external_exports.number().int().min(0).max(99999).optional(),
125738
126324
  pista: external_exports.number().int().min(1).max(999).optional(),
@@ -126284,6 +126870,8 @@ function crearServidor() {
126284
126870
  { name: NOMBRE, version: VERSION },
126285
126871
  { instructions: INSTRUCCIONES }
126286
126872
  );
126873
+ const registrar = servidor2.registerTool.bind(servidor2);
126874
+ servidor2.registerTool = ((nombre, config2, cb) => registrar(nombre, { ...config2, annotations: { ...anotacionesDe(nombre), ...config2.annotations } }, cb));
126287
126875
  registrarHerramientasDelDocumento(servidor2);
126288
126876
  registrarHerramientasDelPuente(servidor2);
126289
126877
  registrarHerramientasDeSignos(servidor2);