UNPKG

pipilan

Version:

Generate music based on conventions from Central Javanese gamelan.

2,834 lines 108 kB
var He = Object.defineProperty;
var _e = (g, n, t) => n in g ? He(g, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : g[n] = t;
var C = (g, n, t) => (_e(g, typeof n != "symbol" ? n + "" : n, t), t), Se = (g, n, t) => {
  if (!n.has(g))
    throw TypeError("Cannot " + t);
};
var oe = (g, n, t) => {
  if (n.has(g))
    throw TypeError("Cannot add the same private member more than once");
  n instanceof WeakSet ? n.add(g) : n.set(g, t);
};
var V = (g, n, t) => (Se(g, n, "access private method"), t);
const v = {
  // pin (rest)
  PIN: { name: "PIN", note: 0, octave: 0, kepatihan: ".", kepatihan2: "F", range: "none" },
  KETHUK: { name: "+", note: 0, octave: 0, kepatihan: "+", kepatihan2: "-", range: "kethuk" },
  KEMPYANG: { name: "-", note: 0, octave: 0, kepatihan: "0", kepatihan2: "0", range: "kempyang" },
  // gong range
  // G1 : {name: 'G1', note: 1, octave: -1, kepatihan: '1', kepatihan2:'Q', range:'gong'},
  // G2 : {name: 'G2', note: 2, octave: -1, kepatihan: '2', kepatihan2:'W', range:'gong'},
  // G3 : {name: 'G3', note: 3, octave: -1, kepatihan: '3', kepatihan2:'E', range:'gong'},
  // G4 : {name: 'G4', note: 4, octave: -1, kepatihan: '4', kepatihan2:'R', range:'gong'},
  // G5 : {name: 'G5', note: 5, octave: -1, kepatihan: '5', kepatihan2:'T', range:'gong'},
  // G6 : {name: 'G6', note: 6, octave: -1, kepatihan: '6', kepatihan2:'Y', range:'gong'},
  // G7 : {name: 'G7', note: 7, octave: -1, kepatihan: '7', kepatihan2:'U', range:'gong'},
  // sub range
  S1: { name: "S1", note: 1, octave: 0, kepatihan: "81", kepatihan2: "ZQ", range: "lowest" },
  S2: { name: "S2", note: 2, octave: 0, kepatihan: "82", kepatihan2: "ZW", range: "lowest" },
  S3: { name: "S3", note: 3, octave: 0, kepatihan: "83", kepatihan2: "ZE", range: "lowest" },
  S4: { name: "S4", note: 4, octave: 0, kepatihan: "84", kepatihan2: "ZR", range: "lowest" },
  S5: { name: "S5", note: 5, octave: 0, kepatihan: "85", kepatihan2: "ZT", range: "lowest" },
  S6: { name: "S6", note: 6, octave: 0, kepatihan: "86", kepatihan2: "ZY", range: "lowest" },
  S7: { name: "S7", note: 7, octave: 0, kepatihan: "87", kepatihan2: "ZU", range: "lowest" },
  // low range
  L1: { name: "L1", note: 1, octave: 1, kepatihan: "q", kepatihan2: "AQ", range: "low" },
  L2: { name: "L2", note: 2, octave: 1, kepatihan: "w", kepatihan2: "AW", range: "low" },
  L3: { name: "L3", note: 3, octave: 1, kepatihan: "e", kepatihan2: "AE", range: "low" },
  L4: { name: "L4", note: 4, octave: 1, kepatihan: "r", kepatihan2: "AR", range: "low" },
  L5: { name: "L5", note: 5, octave: 1, kepatihan: "t", kepatihan2: "AT", range: "low" },
  L6: { name: "L6", note: 6, octave: 1, kepatihan: "y", kepatihan2: "AY", range: "low" },
  L7: { name: "L7", note: 7, octave: 1, kepatihan: "u", kepatihan2: "AU", range: "low" },
  // medium range
  M1: { name: "M1", note: 1, octave: 2, kepatihan: "1", kepatihan2: "Q", range: "medium" },
  M2: { name: "M2", note: 2, octave: 2, kepatihan: "2", kepatihan2: "W", range: "medium" },
  M3: { name: "M3", note: 3, octave: 2, kepatihan: "3", kepatihan2: "E", range: "medium" },
  M4: { name: "M4", note: 4, octave: 2, kepatihan: "4", kepatihan2: "R", range: "medium" },
  M5: { name: "M5", note: 5, octave: 2, kepatihan: "5", kepatihan2: "T", range: "medium" },
  M6: { name: "M6", note: 6, octave: 2, kepatihan: "6", kepatihan2: "Y", range: "medium" },
  M7: { name: "M7", note: 7, octave: 2, kepatihan: "7", kepatihan2: "U", range: "medium" },
  // high range
  H1: { name: "H1", note: 1, octave: 3, kepatihan: "!", kepatihan2: "SQ", range: "high" },
  H2: { name: "H2", note: 2, octave: 3, kepatihan: "@", kepatihan2: "SW", range: "high" },
  H3: { name: "H3", note: 3, octave: 3, kepatihan: "#", kepatihan2: "SE", range: "high" },
  H4: { name: "H4", note: 4, octave: 3, kepatihan: "$", kepatihan2: "SR", range: "high" },
  H5: { name: "H5", note: 5, octave: 3, kepatihan: "%", kepatihan2: "ST", range: "high" },
  H6: { name: "H6", note: 6, octave: 3, kepatihan: "^", kepatihan2: "SY", range: "high" },
  H7: { name: "H7", note: 7, octave: 3, kepatihan: "&", kepatihan2: "SU", range: "high" },
  // upper range
  U1: { name: "U1", note: 1, octave: 4, kepatihan: "91", kepatihan2: "XQ", range: "highest" },
  U2: { name: "U2", note: 2, octave: 4, kepatihan: "92", kepatihan2: "XW", range: "highest" },
  U3: { name: "U3", note: 3, octave: 4, kepatihan: "93", kepatihan2: "XE", range: "highest" },
  U4: { name: "U4", note: 4, octave: 4, kepatihan: "94", kepatihan2: "XR", range: "highest" },
  U5: { name: "U5", note: 5, octave: 4, kepatihan: "95", kepatihan2: "XT", range: "highest" },
  U6: { name: "U6", note: 6, octave: 4, kepatihan: "96", kepatihan2: "XY", range: "highest" },
  U7: { name: "U7", note: 7, octave: 4, kepatihan: "97", kepatihan2: "XU", range: "highest" },
  //* kendhang
  // kepatihan does not accomodate a second line of kendhang notation, so the kepatihan2 entries are duplicates
  T: { name: "t", note: 0, octave: 0, kepatihan: "I", kepatihan2: "I", range: "kendhang" },
  O: { name: "o", note: 0, octave: 0, kepatihan: "O", kepatihan2: "O", range: "kendhang" },
  K: { name: "k", note: 0, octave: 0, kepatihan: "K", kepatihan2: "K", range: "kendhang" },
  P: { name: "p", note: 0, octave: 0, kepatihan: "P", kepatihan2: "P", range: "kendhang" },
  B: { name: "b", note: 0, octave: 0, kepatihan: "B", kepatihan2: "B", range: "kendhang" }
}, Ee = function(g, n = "name", t = "kepatihan") {
  let e = Object.values(v).find((a) => a[n] === g);
  return e ? e[t] : !1;
};
class Ae {
  constructor(n) {
    Object.assign(this, n);
  }
}
for (let g in v)
  globalThis[g] = v[g];
v.G6, v.S6, v.S7, v.L1, v.L2, v.L3, v.L4, v.L5, v.L6, v.L7, v.M1, v.M2, v.M3, v.M4, v.M5, v.M6, v.M7, v.H1, v.H2, v.H3, v.H4, v.H5, v.H6, v.H7, v.U1, v.U2, v.U3, v.U4, v.U5, v.U6, v.U7;
const Ce = {
  bonang: {
    //revert to layout below once ranges in instrumentDefinitions have been sorted -- this is a quick fix!
    slendro: [L1, L2, L3, L5, L6, M1, M2, M3, M5, M6, H1, H2],
    pelog: [L1, L2, L3, L4, L5, L6, L7, M1, M2, M3, M4, M5, M6, M7],
    // slendro:[M6, M5, M3, M2, H1, H2,
    //           M1, L2, L3, L5, L6, L1],
    // pelog:[M4, M6, M5, M3, M2, M1, M7,
    //           L7, L1, L2, L3, L5, L6, L4],
    jogja: {
      slendro: [
        M6,
        M5,
        M3,
        M2,
        H1,
        M1,
        L2,
        L3,
        L5,
        L6
      ],
      pelog: [
        M4,
        M6,
        M5,
        M3,
        M2,
        M1,
        M7,
        L7,
        L1,
        L2,
        L3,
        L5,
        L6,
        L4
      ]
    }
  },
  saron: {
    slendro: [L6, M1, M2, M3, M5, M6, H1],
    pelog: [M1, M2, M3, M4, M5, M6, M7],
    sanga: {
      //pelog version exists in the RCM gamelan..
      slendro: [L6, M1, M2, M3, M5, M6, H1, H2, H3],
      pelog: [M1, M2, M3, M4, M5, M6, M7]
    },
    jogja: {
      slendro: [M1, M2, M3, M5, M6, H1]
    }
  },
  gender: {
    // pelog must later be divided into barang, nem for barung & panerus
    panembung: {
      slendro: [L6, M1, M2, M3, M5, M6, H1],
      pelog: [M1, M2, M3, M4, M5, M6, M7]
    },
    barung: {
      slendro: [S6, L1, L2, L3, L5, L6, M1, M2, M3, M5, M6, H1, H2, H3],
      pelog: {
        barang: [S6, S7, L2, L3, L5, L6, L7, M2, M3, M5, M6, M7, H2, H3],
        nem: [S6, L1, L2, L3, L5, L6, M1, M2, M3, M5, M6, M7, H1, H2, H3]
      }
    }
  },
  gambang: {
    // slendro: ["S6","L1", "L2", "L3", "L5", "L6", "M1", "M2", "M3", "M5", "M6", "H1", "H2", "H3", "H5", "H6", "U1", "U2", "U3", "U5"],
    // pelog: ["S6", "S7", "L1", "L2", "L3", "L5", "L6", "L7", "M1", "M2", "M3", "M5", "M6", "M7", "H1", "H2", "H3", "H5", "H6", "H7", "U1", "U2", "U3", "U5"]
    slendro: [S6, L1, L2, L3, L5, L6, M1, M2, M3, M5, M6, H1, H2, H3, H5, H6, U1, U2, U3, U5],
    pelog: {
      barang: [S6, S7, L2, L3, L5, L6, L7, M2, M3, M5, M6, M7, H2, H3, H5, H6, U2, U3, U5],
      nem: [S6, L1, L2, L3, L5, L6, M1, M2, M3, M5, M6, M7, H1, H2, H3, H5, H6, U1, U2, U3, U5]
    }
  },
  kethuk: {
    // jogja? and engkuk kemong..but we don't need more options for now.
    slendro: [L2, H1],
    pelog: [S6, M6]
  },
  kemong_engkuk: {
    slendro: [L6, M1]
  },
  kenong: {
    //variations abound, surely..this isn't really a concrete layout
    //revert to layout below (or not?)
    slendro: [M2, M3, M5, M6, H1, H2],
    pelog: [M2, M3, M4, M5, M6, M7, H1, H2]
    // slendro:  [M6, M5, M3, M2, H1, H2],
    // pelog:    [M6, M5, M3, M2, M7, H1, H2]
  },
  kempul: {
    //generic version. variations abound, surely..
    slendro: [M3, M5, M6, H1, H2],
    pelog: [M3, M4, M5, M6, M7, H1, H2]
  },
  gong: {
    //temporary, includes suwukan 2 for now
    slendro: [S6, L2],
    pelog: [S6, L2]
  }
}, $e = {
  pelog: {
    S1: 48.84,
    S2: 50.16,
    S3: 51.52,
    S4: 53.36,
    S5: 54.73,
    S6: 57.84,
    S7: 59.51,
    L1: 61.83,
    L2: 63.16,
    L3: 64.52,
    L4: 67.36,
    L5: 68.73,
    L6: 69.84,
    L7: 71.51,
    M1: 73.86,
    M2: 75.11,
    M3: 76.61,
    M4: 79.58,
    M5: 80.86,
    M6: 81.92,
    M7: 83.68,
    H1: 85.86,
    H2: 87.11,
    H3: 88.61,
    H4: 91.58,
    H5: 92.86,
    H6: 93.92,
    H7: 95.68,
    U1: 97.84,
    U2: 99.51,
    U3: 100.84,
    U4: 102.16,
    U5: 103.52,
    U6: 105.36,
    U7: 106.73
  },
  slendro: {
    S1: 48.84,
    S2: 50.16,
    S3: 51.52,
    S4: 53.36,
    S5: 54.73,
    S6: 57.84,
    S7: 60.24,
    L1: 60.25,
    L2: 62.67,
    L3: 65.1,
    L4: 67.36,
    L5: 67.36,
    L6: 69.84,
    L7: 72.24,
    M1: 72.24,
    M2: 74.67,
    M3: 77.1,
    M4: 79.36,
    M5: 79.36,
    M6: 81.84,
    M7: 84.24,
    H1: 84.24,
    H2: 86.67,
    H3: 89.1,
    H4: 91.36,
    H5: 91.36,
    H6: 93.84,
    H7: 96.24,
    U1: 96.24,
    U2: 98.67,
    U3: 101.1,
    U4: 103.36,
    U5: 103.36,
    U6: 105.84,
    U7: 108.24
  }
};
function le() {
  return {
    async: !1,
    breaks: !1,
    extensions: null,
    gfm: !0,
    hooks: null,
    pedantic: !1,
    renderer: null,
    silent: !1,
    tokenizer: null,
    walkTokens: null
  };
}
let X = le();
function fe(g) {
  X = g;
}
const me = /[&<>"']/, Be = new RegExp(me.source, "g"), ke = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, Re = new RegExp(ke.source, "g"), Pe = {
  "&": "&amp;",
  "<": "&lt;",
  ">": "&gt;",
  '"': "&quot;",
  "'": "&#39;"
}, ce = (g) => Pe[g];
function R(g, n) {
  if (n) {
    if (me.test(g))
      return g.replace(Be, ce);
  } else if (ke.test(g))
    return g.replace(Re, ce);
  return g;
}
const ze = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
function Ue(g) {
  return g.replace(ze, (n, t) => (t = t.toLowerCase(), t === "colon" ? ":" : t.charAt(0) === "#" ? t.charAt(1) === "x" ? String.fromCharCode(parseInt(t.substring(2), 16)) : String.fromCharCode(+t.substring(1)) : ""));
}
const Ie = /(^|[^\[])\^/g;
function S(g, n) {
  g = typeof g == "string" ? g : g.source, n = n || "";
  const t = {
    replace: (e, a) => (a = typeof a == "object" && "source" in a ? a.source : a, a = a.replace(Ie, "$1"), g = g.replace(e, a), t),
    getRegex: () => new RegExp(g, n)
  };
  return t;
}
function pe(g) {
  try {
    g = encodeURI(g).replace(/%25/g, "%");
  } catch {
    return null;
  }
  return g;
}
const ne = { exec: () => null };
function ge(g, n) {
  const t = g.replace(/\|/g, (r, s, h) => {
    let p = !1, M = s;
    for (; --M >= 0 && h[M] === "\\"; )
      p = !p;
    return p ? "|" : " |";
  }), e = t.split(/ \|/);
  let a = 0;
  if (e[0].trim() || e.shift(), e.length > 0 && !e[e.length - 1].trim() && e.pop(), n)
    if (e.length > n)
      e.splice(n);
    else
      for (; e.length < n; )
        e.push("");
  for (; a < e.length; a++)
    e[a] = e[a].trim().replace(/\\\|/g, "|");
  return e;
}
function ee(g, n, t) {
  const e = g.length;
  if (e === 0)
    return "";
  let a = 0;
  for (; a < e; ) {
    const r = g.charAt(e - a - 1);
    if (r === n && !t)
      a++;
    else if (r !== n && t)
      a++;
    else
      break;
  }
  return g.slice(0, e - a);
}
function De(g, n) {
  if (g.indexOf(n[1]) === -1)
    return -1;
  let t = 0;
  for (let e = 0; e < g.length; e++)
    if (g[e] === "\\")
      e++;
    else if (g[e] === n[0])
      t++;
    else if (g[e] === n[1] && (t--, t < 0))
      return e;
  return -1;
}
function de(g, n, t, e) {
  const a = n.href, r = n.title ? R(n.title) : null, s = g[1].replace(/\\([\[\]])/g, "$1");
  if (g[0].charAt(0) !== "!") {
    e.state.inLink = !0;
    const h = {
      type: "link",
      raw: t,
      href: a,
      title: r,
      text: s,
      tokens: e.inlineTokens(s)
    };
    return e.state.inLink = !1, h;
  }
  return {
    type: "image",
    raw: t,
    href: a,
    title: r,
    text: R(s)
  };
}
function Ne(g, n) {
  const t = g.match(/^(\s+)(?:```)/);
  if (t === null)
    return n;
  const e = t[1];
  return n.split(`
`).map((a) => {
    const r = a.match(/^\s+/);
    if (r === null)
      return a;
    const [s] = r;
    return s.length >= e.length ? a.slice(e.length) : a;
  }).join(`
`);
}
class ae {
  constructor(n) {
    C(this, "options");
    // TODO: Fix this rules type
    C(this, "rules");
    C(this, "lexer");
    this.options = n || X;
  }
  space(n) {
    const t = this.rules.block.newline.exec(n);
    if (t && t[0].length > 0)
      return {
        type: "space",
        raw: t[0]
      };
  }
  code(n) {
    const t = this.rules.block.code.exec(n);
    if (t) {
      const e = t[0].replace(/^ {1,4}/gm, "");
      return {
        type: "code",
        raw: t[0],
        codeBlockStyle: "indented",
        text: this.options.pedantic ? e : ee(e, `
`)
      };
    }
  }
  fences(n) {
    const t = this.rules.block.fences.exec(n);
    if (t) {
      const e = t[0], a = Ne(e, t[3] || "");
      return {
        type: "code",
        raw: e,
        lang: t[2] ? t[2].trim().replace(this.rules.inline._escapes, "$1") : t[2],
        text: a
      };
    }
  }
  heading(n) {
    const t = this.rules.block.heading.exec(n);
    if (t) {
      let e = t[2].trim();
      if (/#$/.test(e)) {
        const a = ee(e, "#");
        (this.options.pedantic || !a || / $/.test(a)) && (e = a.trim());
      }
      return {
        type: "heading",
        raw: t[0],
        depth: t[1].length,
        text: e,
        tokens: this.lexer.inline(e)
      };
    }
  }
  hr(n) {
    const t = this.rules.block.hr.exec(n);
    if (t)
      return {
        type: "hr",
        raw: t[0]
      };
  }
  blockquote(n) {
    const t = this.rules.block.blockquote.exec(n);
    if (t) {
      const e = ee(t[0].replace(/^ *>[ \t]?/gm, ""), `
`), a = this.lexer.state.top;
      this.lexer.state.top = !0;
      const r = this.lexer.blockTokens(e);
      return this.lexer.state.top = a, {
        type: "blockquote",
        raw: t[0],
        tokens: r,
        text: e
      };
    }
  }
  list(n) {
    let t = this.rules.block.list.exec(n);
    if (t) {
      let e = t[1].trim();
      const a = e.length > 1, r = {
        type: "list",
        raw: "",
        ordered: a,
        start: a ? +e.slice(0, -1) : "",
        loose: !1,
        items: []
      };
      e = a ? `\\d{1,9}\\${e.slice(-1)}` : `\\${e}`, this.options.pedantic && (e = a ? e : "[*+-]");
      const s = new RegExp(`^( {0,3}${e})((?:[	 ][^\\n]*)?(?:\\n|$))`);
      let h = "", p = "", M = !1;
      for (; n; ) {
        let d = !1;
        if (!(t = s.exec(n)) || this.rules.block.hr.test(n))
          break;
        h = t[0], n = n.substring(h.length);
        let x = t[2].split(`
`, 1)[0].replace(/^\t+/, (l) => " ".repeat(3 * l.length)), w = n.split(`
`, 1)[0], _ = 0;
        this.options.pedantic ? (_ = 2, p = x.trimStart()) : (_ = t[2].search(/[^ ]/), _ = _ > 4 ? 1 : _, p = x.slice(_), _ += t[1].length);
        let i = !1;
        if (!x && /^ *$/.test(w) && (h += w + `
`, n = n.substring(w.length + 1), d = !0), !d) {
          const l = new RegExp(`^ {0,${Math.min(3, _ - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`), c = new RegExp(`^ {0,${Math.min(3, _ - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), m = new RegExp(`^ {0,${Math.min(3, _ - 1)}}(?:\`\`\`|~~~)`), L = new RegExp(`^ {0,${Math.min(3, _ - 1)}}#`);
          for (; n; ) {
            const k = n.split(`
`, 1)[0];
            if (w = k, this.options.pedantic && (w = w.replace(/^ {1,4}(?=( {4})*[^ ])/g, "  ")), m.test(w) || L.test(w) || l.test(w) || c.test(n))
              break;
            if (w.search(/[^ ]/) >= _ || !w.trim())
              p += `
` + w.slice(_);
            else {
              if (i || x.search(/[^ ]/) >= 4 || m.test(x) || L.test(x) || c.test(x))
                break;
              p += `
` + w;
            }
            !i && !w.trim() && (i = !0), h += k + `
`, n = n.substring(k.length + 1), x = w.slice(_);
          }
        }
        r.loose || (M ? r.loose = !0 : /\n *\n *$/.test(h) && (M = !0));
        let o = null, u;
        this.options.gfm && (o = /^\[[ xX]\] /.exec(p), o && (u = o[0] !== "[ ] ", p = p.replace(/^\[[ xX]\] +/, ""))), r.items.push({
          type: "list_item",
          raw: h,
          task: !!o,
          checked: u,
          loose: !1,
          text: p,
          tokens: []
        }), r.raw += h;
      }
      r.items[r.items.length - 1].raw = h.trimEnd(), r.items[r.items.length - 1].text = p.trimEnd(), r.raw = r.raw.trimEnd();
      for (let d = 0; d < r.items.length; d++)
        if (this.lexer.state.top = !1, r.items[d].tokens = this.lexer.blockTokens(r.items[d].text, []), !r.loose) {
          const x = r.items[d].tokens.filter((_) => _.type === "space"), w = x.length > 0 && x.some((_) => /\n.*\n/.test(_.raw));
          r.loose = w;
        }
      if (r.loose)
        for (let d = 0; d < r.items.length; d++)
          r.items[d].loose = !0;
      return r;
    }
  }
  html(n) {
    const t = this.rules.block.html.exec(n);
    if (t)
      return {
        type: "html",
        block: !0,
        raw: t[0],
        pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
        text: t[0]
      };
  }
  def(n) {
    const t = this.rules.block.def.exec(n);
    if (t) {
      const e = t[1].toLowerCase().replace(/\s+/g, " "), a = t[2] ? t[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline._escapes, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline._escapes, "$1") : t[3];
      return {
        type: "def",
        tag: e,
        raw: t[0],
        href: a,
        title: r
      };
    }
  }
  table(n) {
    const t = this.rules.block.table.exec(n);
    if (t) {
      if (!/[:|]/.test(t[2]))
        return;
      const e = {
        type: "table",
        raw: t[0],
        header: ge(t[1]).map((a) => ({ text: a, tokens: [] })),
        align: t[2].replace(/^\||\| *$/g, "").split("|"),
        rows: t[3] && t[3].trim() ? t[3].replace(/\n[ \t]*$/, "").split(`
`) : []
      };
      if (e.header.length === e.align.length) {
        let a = e.align.length, r, s, h, p;
        for (r = 0; r < a; r++) {
          const M = e.align[r];
          M && (/^ *-+: *$/.test(M) ? e.align[r] = "right" : /^ *:-+: *$/.test(M) ? e.align[r] = "center" : /^ *:-+ *$/.test(M) ? e.align[r] = "left" : e.align[r] = null);
        }
        for (a = e.rows.length, r = 0; r < a; r++)
          e.rows[r] = ge(e.rows[r], e.header.length).map((M) => ({ text: M, tokens: [] }));
        for (a = e.header.length, s = 0; s < a; s++)
          e.header[s].tokens = this.lexer.inline(e.header[s].text);
        for (a = e.rows.length, s = 0; s < a; s++)
          for (p = e.rows[s], h = 0; h < p.length; h++)
            p[h].tokens = this.lexer.inline(p[h].text);
        return e;
      }
    }
  }
  lheading(n) {
    const t = this.rules.block.lheading.exec(n);
    if (t)
      return {
        type: "heading",
        raw: t[0],
        depth: t[2].charAt(0) === "=" ? 1 : 2,
        text: t[1],
        tokens: this.lexer.inline(t[1])
      };
  }
  paragraph(n) {
    const t = this.rules.block.paragraph.exec(n);
    if (t) {
      const e = t[1].charAt(t[1].length - 1) === `
` ? t[1].slice(0, -1) : t[1];
      return {
        type: "paragraph",
        raw: t[0],
        text: e,
        tokens: this.lexer.inline(e)
      };
    }
  }
  text(n) {
    const t = this.rules.block.text.exec(n);
    if (t)
      return {
        type: "text",
        raw: t[0],
        text: t[0],
        tokens: this.lexer.inline(t[0])
      };
  }
  escape(n) {
    const t = this.rules.inline.escape.exec(n);
    if (t)
      return {
        type: "escape",
        raw: t[0],
        text: R(t[1])
      };
  }
  tag(n) {
    const t = this.rules.inline.tag.exec(n);
    if (t)
      return !this.lexer.state.inLink && /^<a /i.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && /^<\/a>/i.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
        type: "html",
        raw: t[0],
        inLink: this.lexer.state.inLink,
        inRawBlock: this.lexer.state.inRawBlock,
        block: !1,
        text: t[0]
      };
  }
  link(n) {
    const t = this.rules.inline.link.exec(n);
    if (t) {
      const e = t[2].trim();
      if (!this.options.pedantic && /^</.test(e)) {
        if (!/>$/.test(e))
          return;
        const s = ee(e.slice(0, -1), "\\");
        if ((e.length - s.length) % 2 === 0)
          return;
      } else {
        const s = De(t[2], "()");
        if (s > -1) {
          const p = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
          t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, p).trim(), t[3] = "";
        }
      }
      let a = t[2], r = "";
      if (this.options.pedantic) {
        const s = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(a);
        s && (a = s[1], r = s[3]);
      } else
        r = t[3] ? t[3].slice(1, -1) : "";
      return a = a.trim(), /^</.test(a) && (this.options.pedantic && !/>$/.test(e) ? a = a.slice(1) : a = a.slice(1, -1)), de(t, {
        href: a && a.replace(this.rules.inline._escapes, "$1"),
        title: r && r.replace(this.rules.inline._escapes, "$1")
      }, t[0], this.lexer);
    }
  }
  reflink(n, t) {
    let e;
    if ((e = this.rules.inline.reflink.exec(n)) || (e = this.rules.inline.nolink.exec(n))) {
      let a = (e[2] || e[1]).replace(/\s+/g, " ");
      if (a = t[a.toLowerCase()], !a) {
        const r = e[0].charAt(0);
        return {
          type: "text",
          raw: r,
          text: r
        };
      }
      return de(e, a, e[0], this.lexer);
    }
  }
  emStrong(n, t, e = "") {
    let a = this.rules.inline.emStrong.lDelim.exec(n);
    if (!a || a[3] && e.match(/[\p{L}\p{N}]/u))
      return;
    if (!(a[1] || a[2] || "") || !e || this.rules.inline.punctuation.exec(e)) {
      const s = [...a[0]].length - 1;
      let h, p, M = s, d = 0;
      const x = a[0][0] === "*" ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
      for (x.lastIndex = 0, t = t.slice(-1 * n.length + s); (a = x.exec(t)) != null; ) {
        if (h = a[1] || a[2] || a[3] || a[4] || a[5] || a[6], !h)
          continue;
        if (p = [...h].length, a[3] || a[4]) {
          M += p;
          continue;
        } else if ((a[5] || a[6]) && s % 3 && !((s + p) % 3)) {
          d += p;
          continue;
        }
        if (M -= p, M > 0)
          continue;
        p = Math.min(p, p + M + d);
        const w = [...a[0]][0].length, _ = n.slice(0, s + a.index + w + p);
        if (Math.min(s, p) % 2) {
          const o = _.slice(1, -1);
          return {
            type: "em",
            raw: _,
            text: o,
            tokens: this.lexer.inlineTokens(o)
          };
        }
        const i = _.slice(2, -2);
        return {
          type: "strong",
          raw: _,
          text: i,
          tokens: this.lexer.inlineTokens(i)
        };
      }
    }
  }
  codespan(n) {
    const t = this.rules.inline.code.exec(n);
    if (t) {
      let e = t[2].replace(/\n/g, " ");
      const a = /[^ ]/.test(e), r = /^ /.test(e) && / $/.test(e);
      return a && r && (e = e.substring(1, e.length - 1)), e = R(e, !0), {
        type: "codespan",
        raw: t[0],
        text: e
      };
    }
  }
  br(n) {
    const t = this.rules.inline.br.exec(n);
    if (t)
      return {
        type: "br",
        raw: t[0]
      };
  }
  del(n) {
    const t = this.rules.inline.del.exec(n);
    if (t)
      return {
        type: "del",
        raw: t[0],
        text: t[2],
        tokens: this.lexer.inlineTokens(t[2])
      };
  }
  autolink(n) {
    const t = this.rules.inline.autolink.exec(n);
    if (t) {
      let e, a;
      return t[2] === "@" ? (e = R(t[1]), a = "mailto:" + e) : (e = R(t[1]), a = e), {
        type: "link",
        raw: t[0],
        text: e,
        href: a,
        tokens: [
          {
            type: "text",
            raw: e,
            text: e
          }
        ]
      };
    }
  }
  url(n) {
    let t;
    if (t = this.rules.inline.url.exec(n)) {
      let e, a;
      if (t[2] === "@")
        e = R(t[0]), a = "mailto:" + e;
      else {
        let r;
        do
          r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])[0];
        while (r !== t[0]);
        e = R(t[0]), t[1] === "www." ? a = "http://" + t[0] : a = t[0];
      }
      return {
        type: "link",
        raw: t[0],
        text: e,
        href: a,
        tokens: [
          {
            type: "text",
            raw: e,
            text: e
          }
        ]
      };
    }
  }
  inlineText(n) {
    const t = this.rules.inline.text.exec(n);
    if (t) {
      let e;
      return this.lexer.state.inRawBlock ? e = t[0] : e = R(t[0]), {
        type: "text",
        raw: t[0],
        text: e
      };
    }
  }
}
const b = {
  newline: /^(?: *(?:\n|$))+/,
  code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
  fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
  hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
  heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
  blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
  list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
  html: "^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",
  def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
  table: ne,
  lheading: /^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
  // regex template, placeholders will be replaced according to different paragraph
  // interruption rules of commonmark and the original markdown spec:
  _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
  text: /^[^\n]+/
};
b._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
b._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
b.def = S(b.def).replace("label", b._label).replace("title", b._title).getRegex();
b.bullet = /(?:[*+-]|\d{1,9}[.)])/;
b.listItemStart = S(/^( *)(bull) */).replace("bull", b.bullet).getRegex();
b.list = S(b.list).replace(/bull/g, b.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + b.def.source + ")").getRegex();
b._tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
b._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
b.html = S(b.html, "i").replace("comment", b._comment).replace("tag", b._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
b.lheading = S(b.lheading).replace(/bull/g, b.bullet).getRegex();
b.paragraph = S(b._paragraph).replace("hr", b.hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", b._tag).getRegex();
b.blockquote = S(b.blockquote).replace("paragraph", b.paragraph).getRegex();
b.normal = { ...b };
b.gfm = {
  ...b.normal,
  table: "^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
  // Cells
};
b.gfm.table = S(b.gfm.table).replace("hr", b.hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", b._tag).getRegex();
b.gfm.paragraph = S(b._paragraph).replace("hr", b.hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", b.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", b._tag).getRegex();
b.pedantic = {
  ...b.normal,
  html: S(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", b._comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
  def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
  heading: /^(#{1,6})(.*)(?:\n+|$)/,
  fences: ne,
  lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
  paragraph: S(b.normal._paragraph).replace("hr", b.hr).replace("heading", ` *#{1,6} *[^
]`).replace("lheading", b.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
};
const f = {
  escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
  autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
  url: ne,
  tag: "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",
  link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
  reflink: /^!?\[(label)\]\[(ref)\]/,
  nolink: /^!?\[(ref)\](?:\[\])?/,
  reflinkSearch: "reflink|nolink(?!\\()",
  emStrong: {
    lDelim: /^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,
    //         (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left.  (5) and (6) can be either Left or Right.
    //         | Skip orphan inside strong      | Consume to delim | (1) #***              | (2) a***#, a***                    | (3) #***a, ***a                  | (4) ***#                 | (5) #***#                         | (6) a***a
    rDelimAst: /^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,
    rDelimUnd: /^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/
    // ^- Not allowed for _
  },
  code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
  br: /^( {2,}|\\)\n(?!\s*$)/,
  del: ne,
  text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
  punctuation: /^((?![*_])[\spunctuation])/
};
f._punctuation = "\\p{P}$+<=>`^|~";
f.punctuation = S(f.punctuation, "u").replace(/punctuation/g, f._punctuation).getRegex();
f.blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
f.anyPunctuation = /\\[punct]/g;
f._escapes = /\\([punct])/g;
f._comment = S(b._comment).replace("(?:-->|$)", "-->").getRegex();
f.emStrong.lDelim = S(f.emStrong.lDelim, "u").replace(/punct/g, f._punctuation).getRegex();
f.emStrong.rDelimAst = S(f.emStrong.rDelimAst, "gu").replace(/punct/g, f._punctuation).getRegex();
f.emStrong.rDelimUnd = S(f.emStrong.rDelimUnd, "gu").replace(/punct/g, f._punctuation).getRegex();
f.anyPunctuation = S(f.anyPunctuation, "gu").replace(/punct/g, f._punctuation).getRegex();
f._escapes = S(f._escapes, "gu").replace(/punct/g, f._punctuation).getRegex();
f._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
f._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
f.autolink = S(f.autolink).replace("scheme", f._scheme).replace("email", f._email).getRegex();
f._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
f.tag = S(f.tag).replace("comment", f._comment).replace("attribute", f._attribute).getRegex();
f._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
f._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
f._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
f.link = S(f.link).replace("label", f._label).replace("href", f._href).replace("title", f._title).getRegex();
f.reflink = S(f.reflink).replace("label", f._label).replace("ref", b._label).getRegex();
f.nolink = S(f.nolink).replace("ref", b._label).getRegex();
f.reflinkSearch = S(f.reflinkSearch, "g").replace("reflink", f.reflink).replace("nolink", f.nolink).getRegex();
f.normal = { ...f };
f.pedantic = {
  ...f.normal,
  strong: {
    start: /^__|\*\*/,
    middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
    endAst: /\*\*(?!\*)/g,
    endUnd: /__(?!_)/g
  },
  em: {
    start: /^_|\*/,
    middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
    endAst: /\*(?!\*)/g,
    endUnd: /_(?!_)/g
  },
  link: S(/^!?\[(label)\]\((.*?)\)/).replace("label", f._label).getRegex(),
  reflink: S(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", f._label).getRegex()
};
f.gfm = {
  ...f.normal,
  escape: S(f.escape).replace("])", "~|])").getRegex(),
  _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
  url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
  _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
  del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
  text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
};
f.gfm.url = S(f.gfm.url, "i").replace("email", f.gfm._extended_email).getRegex();
f.breaks = {
  ...f.gfm,
  br: S(f.br).replace("{2,}", "*").getRegex(),
  text: S(f.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
};
class N {
  constructor(n) {
    C(this, "tokens");
    C(this, "options");
    C(this, "state");
    C(this, "tokenizer");
    C(this, "inlineQueue");
    this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = n || X, this.options.tokenizer = this.options.tokenizer || new ae(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
      inLink: !1,
      inRawBlock: !1,
      top: !0
    };
    const t = {
      block: b.normal,
      inline: f.normal
    };
    this.options.pedantic ? (t.block = b.pedantic, t.inline = f.pedantic) : this.options.gfm && (t.block = b.gfm, this.options.breaks ? t.inline = f.breaks : t.inline = f.gfm), this.tokenizer.rules = t;
  }
  /**
   * Expose Rules
   */
  static get rules() {
    return {
      block: b,
      inline: f
    };
  }
  /**
   * Static Lex Method
   */
  static lex(n, t) {
    return new N(t).lex(n);
  }
  /**
   * Static Lex Inline Method
   */
  static lexInline(n, t) {
    return new N(t).inlineTokens(n);
  }
  /**
   * Preprocessing
   */
  lex(n) {
    n = n.replace(/\r\n|\r/g, `
`), this.blockTokens(n, this.tokens);
    let t;
    for (; t = this.inlineQueue.shift(); )
      this.inlineTokens(t.src, t.tokens);
    return this.tokens;
  }
  blockTokens(n, t = []) {
    this.options.pedantic ? n = n.replace(/\t/g, "    ").replace(/^ +$/gm, "") : n = n.replace(/^( *)(\t+)/gm, (h, p, M) => p + "    ".repeat(M.length));
    let e, a, r, s;
    for (; n; )
      if (!(this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((h) => (e = h.call({ lexer: this }, n, t)) ? (n = n.substring(e.raw.length), t.push(e), !0) : !1))) {
        if (e = this.tokenizer.space(n)) {
          n = n.substring(e.raw.length), e.raw.length === 1 && t.length > 0 ? t[t.length - 1].raw += `
` : t.push(e);
          continue;
        }
        if (e = this.tokenizer.code(n)) {
          n = n.substring(e.raw.length), a = t[t.length - 1], a && (a.type === "paragraph" || a.type === "text") ? (a.raw += `
` + e.raw, a.text += `
` + e.text, this.inlineQueue[this.inlineQueue.length - 1].src = a.text) : t.push(e);
          continue;
        }
        if (e = this.tokenizer.fences(n)) {
          n = n.substring(e.raw.length), t.push(e);
          continue;
        }
        if (e = this.tokenizer.heading(n)) {
          n = n.substring(e.raw.length), t.push(e);
          continue;
        }
        if (e = this.tokenizer.hr(n)) {
          n = n.substring(e.raw.length), t.push(e);
          continue;
        }
        if (e = this.tokenizer.blockquote(n)) {
          n = n.substring(e.raw.length), t.push(e);
          continue;
        }
        if (e = this.tokenizer.list(n)) {
          n = n.substring(e.raw.length), t.push(e);
          continue;
        }
        if (e = this.tokenizer.html(n)) {
          n = n.substring(e.raw.length), t.push(e);
          continue;
        }
        if (e = this.tokenizer.def(n)) {
          n = n.substring(e.raw.length), a = t[t.length - 1], a && (a.type === "paragraph" || a.type === "text") ? (a.raw += `
` + e.raw, a.text += `
` + e.raw, this.inlineQueue[this.inlineQueue.length - 1].src = a.text) : this.tokens.links[e.tag] || (this.tokens.links[e.tag] = {
            href: e.href,
            title: e.title
          });
          continue;
        }
        if (e = this.tokenizer.table(n)) {
          n = n.substring(e.raw.length), t.push(e);
          continue;
        }
        if (e = this.tokenizer.lheading(n)) {
          n = n.substring(e.raw.length), t.push(e);
          continue;
        }
        if (r = n, this.options.extensions && this.options.extensions.startBlock) {
          let h = 1 / 0;
          const p = n.slice(1);
          let M;
          this.options.extensions.startBlock.forEach((d) => {
            M = d.call({ lexer: this }, p), typeof M == "number" && M >= 0 && (h = Math.min(h, M));
          }), h < 1 / 0 && h >= 0 && (r = n.substring(0, h + 1));
        }
        if (this.state.top && (e = this.tokenizer.paragraph(r))) {
          a = t[t.length - 1], s && a.type === "paragraph" ? (a.raw += `
` + e.raw, a.text += `
` + e.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = a.text) : t.push(e), s = r.length !== n.length, n = n.substring(e.raw.length);
          continue;
        }
        if (e = this.tokenizer.text(n)) {
          n = n.substring(e.raw.length), a = t[t.length - 1], a && a.type === "text" ? (a.raw += `
` + e.raw, a.text += `
` + e.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = a.text) : t.push(e);
          continue;
        }
        if (n) {
          const h = "Infinite loop on byte: " + n.charCodeAt(0);
          if (this.options.silent) {
            console.error(h);
            break;
          } else
            throw new Error(h);
        }
      }
    return this.state.top = !0, t;
  }
  inline(n, t = []) {
    return this.inlineQueue.push({ src: n, tokens: t }), t;
  }
  /**
   * Lexing/Compiling
   */
  inlineTokens(n, t = []) {
    let e, a, r, s = n, h, p, M;
    if (this.tokens.links) {
      const d = Object.keys(this.tokens.links);
      if (d.length > 0)
        for (; (h = this.tokenizer.rules.inline.reflinkSearch.exec(s)) != null; )
          d.includes(h[0].slice(h[0].lastIndexOf("[") + 1, -1)) && (s = s.slice(0, h.index) + "[" + "a".repeat(h[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
    }
    for (; (h = this.tokenizer.rules.inline.blockSkip.exec(s)) != null; )
      s = s.slice(0, h.index) + "[" + "a".repeat(h[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
    for (; (h = this.tokenizer.rules.inline.anyPunctuation.exec(s)) != null; )
      s = s.slice(0, h.index) + "++" + s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
    for (; n; )
      if (p || (M = ""), p = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((d) => (e = d.call({ lexer: this }, n, t)) ? (n = n.substring(e.raw.length), t.push(e), !0) : !1))) {
        if (e = this.tokenizer.escape(n)) {
          n = n.substring(e.raw.length), t.push(e);
          continue;
        }
        if (e = this.tokenizer.tag(n)) {
          n = n.substring(e.raw.length), a = t[t.length - 1], a && e.type === "text" && a.type === "text" ? (a.raw += e.raw, a.text += e.text) : t.push(e);
          continue;
        }
        if (e = this.tokenizer.link(n)) {
          n = n.substring(e.raw.length), t.push(e);
          continue;
        }
        if (e = this.tokenizer.reflink(n, this.tokens.links)) {
          n = n.substring(e.raw.length), a = t[t.length - 1], a && e.type === "text" && a.type === "text" ? (a.raw += e.raw, a.text += e.text) : t.push(e);
          continue;
        }
        if (e = this.tokenizer.emStrong(n, s, M)) {
          n = n.substring(e.raw.length), t.push(e);
          continue;
        }
        if (e = this.tokenizer.codespan(n)) {
          n = n.substring(e.raw.length), t.push(e);
          continue;
        }
        if (e = this.tokenizer.br(n)) {
          n = n.substring(e.raw.length), t.push(e);
          continue;
        }
        if (e = this.tokenizer.del(n)) {
          n = n.substring(e.raw.length), t.push(e);
          continue;
        }
        if (e = this.tokenizer.autolink(n)) {
          n = n.substring(e.raw.length), t.push(e);
          continue;
        }
        if (!this.state.inLink && (e = this.tokenizer.url(n))) {
          n = n.substring(e.raw.length), t.push(e);
          continue;
        }
        if (r = n, this.options.extensions && this.options.extensions.startInline) {
          let d = 1 / 0;
          const x = n.slice(1);
          let w;
          this.options.extensions.startInline.forEach((_) => {
            w = _.call({ lexer: this }, x), typeof w == "number" && w >= 0 && (d = Math.min(d, w));
          }), d < 1 / 0 && d >= 0 && (r = n.substring(0, d + 1));
        }
        if (e = this.tokenizer.inlineText(r)) {
          n = n.substring(e.raw.length), e.raw.slice(-1) !== "_" && (M = e.raw.slice(-1)), p = !0, a = t[t.length - 1], a && a.type === "text" ? (a.raw += e.raw, a.text += e.text) : t.push(e);
          continue;
        }
        if (n) {
          const d = "Infinite loop on byte: " + n.charCodeAt(0);
          if (this.options.silent) {
            console.error(d);
            break;
          } else
            throw new Error(d);
        }
      }
    return t;
  }
}
class se {
  constructor(n) {
    C(this, "options");
    this.options = n || X;
  }
  code(n, t, e) {
    var r;
    const a = (r = (t || "").match(/^\S*/)) == null ? void 0 : r[0];
    return n = n.replace(/\n$/, "") + `
`, a ? '<pre><code class="language-' + R(a) + '">' + (e ? n : R(n, !0)) + `</code></pre>
` : "<pre><code>" + (e ? n : R(n, !0)) + `</code></pre>
`;
  }
  blockquote(n) {
    return `<blockquote>
${n}</blockquote>
`;
  }
  html(n, t) {
    return n;
  }
  heading(n, t, e) {
    return `<h${t}>${n}</h${t}>
`;
  }
  hr() {
    return `<hr>
`;
  }
  list(n, t, e) {
    const a = t ? "ol" : "ul", r = t && e !== 1 ? ' start="' + e + '"' : "";
    return "<" + a + r + `>
` + n + "</" + a + `>
`;
  }
  listitem(n, t, e) {
    return `<li>${n}</li>
`;
  }
  checkbox(n) {
    return "<input " + (n ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
  }
  paragraph(n) {
    return `<p>${n}</p>
`;
  }
  table(n, t) {
    return t && (t = `<tbody>${t}</tbody>`), `<table>
<thead>
` + n + `</thead>
` + t + `</table>
`;
  }
  tablerow(n) {
    return `<tr>
${n}</tr>
`;
  }
  tablecell(n, t) {
    const e = t.header ? "th" : "td";
    return (t.align ? `<${e} align="${t.align}">` : `<${e}>`) + n + `</${e}>
`;
  }
  /**
   * span level renderer
   */
  strong(n) {
    return `<strong>${n}</strong>`;
  }
  em(n) {
    return `<em>${n}</em>`;
  }
  codespan(n) {
    return `<code>${n}</code>`;
  }
  br() {
    return "<br>";
  }
  del(n) {
    return `<del>${n}</del>`;
  }
  link(n, t, e) {
    const a = pe(n);
    if (a === null)
      return e;
    n = a;
    let r = '<a href="' + n + '"';
    return t && (r += ' title="' + t + '"'), r += ">" + e + "</a>", r;
  }
  image(n, t, e) {
    const a = pe(n);
    if (a === null)
      return e;
    n = a;
    let r = `<img src="${n}" alt="${e}"`;
    return t && (r += ` title="${t}"`), r += ">", r;
  }
  text(n) {
    return n;
  }
}
class he {
  // no need for block level renderers
  strong(n) {
    return n;
  }
  em(n) {
    return n;
  }
  codespan(n) {
    return n;
  }
  del(n) {
    return n;
  }
  html(n) {
    return n;
  }
  text(n) {
    return n;
  }
  link(n, t, e) {
    return "" + e;
  }
  image(n, t, e) {
    return "" + e;
  }
  br() {
    return "";
  }
}
class O {
  constructor(n) {
    C(this, "options");
    C(this, "renderer");
    C(this, "textRenderer");
    this.options = n || X, this.options.renderer = this.options.renderer || new se(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.textRenderer = new he();
  }
  /**
   * Static Parse Method
   */
  static parse(n, t) {
    return new O(t).parse(n);
  }
  /**
   * Static Parse Inline Method
   */
  static parseInline(n, t) {
    return new O(t).parseInline(n);
  }
  /**
   * Parse Loop
   */
  parse(n, t = !0) {
    let e = "";
    for (let a = 0; a < n.length; a++) {
      const r = n[a];
      if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[r.type]) {
        const s = r, h = this.options.extensions.renderers[s.type].call({ parser: this }, s);
        if (h !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(s.type)) {
          e += h || "";
          continue;
        }
      }
      switch (r.type) {
        case "space":
          continue;
        case "hr": {
          e += this.renderer.hr();
          continue;
        }
        case "heading": {
          const s = r;
          e += this.renderer.heading(this.parseInline(s.tokens), s.depth, Ue(this.parseInline(s.tokens, this.textRenderer)));
          continue;
        }
        case "code": {
          const s = r;
          e += this.renderer.code(s.text, s.lang, !!s.escaped);
          continue;
        }
        case "table": {
          const s = r;
          let h = "", p = "";
          for (let d = 0; d < s.header.length; d++)
            p += this.renderer.tablecell(this.parseInline(s.header[d].tokens), { header: !0, align: s.align[d] });
          h += this.renderer.tablerow(p);
          let M = "";
          for (let d = 0; d < s.rows.length; d++) {
            const x = s.rows[d];
            p = "";
            for (let w = 0; w < x.length; w++)
              p += this.renderer.tablecell(this.parseInline(x[w].tokens), { header: !1, align: s.align[w] });
            M += this.renderer.tablerow(p);
          }
          e += this.renderer.table(h, M);
          continue;
        }
        case "blockquote": {
          const s = r, h = this.parse(s.tokens);
          e += this.renderer.blockquote(h);
          continue;
        }
        case "list": {
          const s = r, h = s.ordered, p = s.start, M = s.loose;
          let d = "";
          for (let x = 0; x < s.items.length; x++) {
            const w = s.items[x], _ = w.checked, i = w.task;
            let o = "";
            if (w.task) {
              const u = this.renderer.checkbox(!!_);
              M ? w.tokens.length > 0 && w.tokens[0].type === "paragraph" ? (w.tokens[0].text = u + " " + w.tokens[0].text, w.tokens[0].tokens && w.tokens[0].tokens.length > 0 && w.tokens[0].tokens[0].type === "text" && (w.tokens[0].tokens[0].text = u + " " + w.tokens[0].tokens[0].text)) : w.tokens.unshift({
                type: "text",
                text: u + " "
              }) : o += u + " ";
            }
            o += this.parse(w.tokens, M), d += this.renderer.listitem(o, i, !!_);
          }
          e += this.renderer.list(d, h, p);
          continue;
        }
        case "html": {
          const s = r;
          e += this.renderer.html(s.text, s.block);
          continue;
        }
        case "paragraph": {
          const s = r;
          e += this.renderer.paragraph(this.parseInline(s.tokens));
          continue;
        }
        case "text": {
          let s = r, h = s.tokens ? this.parseInline(s.tokens) : s.text;
          for (; a + 1 < n.length && n[a + 1].type === "text"; )
            s = n[++a], h += `
` + (s.tokens ? this.parseInline(s.tokens) : s.text);
          e += t ? this.renderer.paragraph(h) : h;
          continue;
        }
        default: {
          const s = 'Token with "' + r.type + '" type was not found.';
          if (this.options.silent)
            return console.error(s), "";
          throw new Error(s);
        }
      }
    }
    return e;
  }
  /**
   * Parse Inline Tokens
   */
  parseInline(n, t) {
    t = t || this.renderer;
    let e = "";
    for (let a = 0; a < n.length; a++) {
      const r = n[a];
      if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[r.type]) {
        const s = this.options.extensions.renderers[r.type].call({ parser: this }, r);
        if (s !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(r.type)) {
          e += s || "";
          continue;
        }
      }
      switch (r.type) {
        case "escape": {
          const s = r;
          e += t.text(s.text);
          break;
        }
        case "html": {
          const s = r;
          e += t.html(s.text);
          break;
        }
        case "link": {
          const s = r;
          e += t.link(s.href, s.title, this.parseInline(s.tokens, t));
          break;
        }
        case "image": {
          const s = r;
          e += t.image(s.href, s.title, s.text);
          break;
        }
        case "strong": {
          const s = r;
          e += t.strong(this.parseInline(s.tokens, t));
          break;
        }
        case "em": {
          const s = r;
          e += t.em(this.parseInline(s.tokens, t));
          break;
        }
        case "codespan": {
          const s = r;
          e += t.codespan(s.text);
          break;
        }
        case "br": {
          e += t.br();
          break;
        }
        case "del": {
          const s = r;
          e += t.del(this.parseInline(s.tokens, t));
          break;
        }
        case "text": {
          const s = r;
          e += t.text(s.text);
          break;
        }
        default: {
          const s = 'Token with "' + r.type + '" type was not found.';
          if (this.options.silent)
            return console.error(s), "";
          throw new Error(s);
        }
      }
    }
    return e;
  }
}
class F {
  constructor(n) {
    C(this, "options");
    this.options = n || X;
  }
  /**
   * Process markdown before marked
   */
  preprocess(n) {
    return n;
  }
  /**
   * Process HTML after marked is finished
   */
  postprocess(n) {
    return n;
  }
}
C(F, "passThroughHooks", /* @__PURE__ */ new Set([
  "preprocess",
  "postprocess"
]));
var W, ie, re, Me;
class Oe {
  constructor(...n) {
    oe(this, W);
    oe(this, re);
    C(this, "defaults", le());
    C(this, "options", this.setOptions);
    C(this, "parse", V(this, W, ie).call(this, N.lex, O.parse));
    C(this, "parseInline", V(this, W, ie).call(this, N.lexInline, O.parseInline));
    C(this, "Parser", O);
    C(this, "Renderer", se);
    C(this, "TextRenderer", he);
    C(this, "Lexer", N);
    C(this, "Tokenizer", ae);
    C(this, "Hooks", F);
    this.use(...n);
  }
  /**
   * Run callback for every token
   */
  walkTokens(n, t) {
    var a, r;
    let e = [];
    for (const s of n)
      switch (e = e.concat(t.call(this, s)), s.type) {
        case "table": {
          const h = s;
          for (const p of h.header)
            e = e.concat(this.walkTokens(p.tokens, t));
          for (const p of h.rows)
            for (const M of p)
              e = e.concat(this.walkTokens(M.tokens, t));
          break;
        }
        case "list": {
          const h = s;
          e = e.concat(this.walkTokens(h.items, t));
          break;
        }
        default: {
          const h = s;
          (r = (a = this.defaults.extensions) == null ? void 0 : a.childTokens) != null && r[h.type] ? this.defaults.extensions.childTokens[h.type].forEach((p) => {
            e = e.concat(this.walkTokens(h[p], t));
          }) : h.tokens && (e = e.concat(this.walkTokens(h.tokens, t)));
        }
      }
    return e;
  }
  use(...n) {
    const t = this.defaults.extensions || { renderers: {}, childTokens: {} };
    return n.forEach((e) => {
      const a = { ...e };
      if (a.async = this.defaults.async || a.async || !1, e.extensions && (e.extensions.forEach((r) => {
        if (!r.name)
          throw new Error("extension name required");
        if ("renderer" in r) {
          const s = t.renderers[r.name];
          s ? t.renderers[r.name] = function(...h) {
            let p = r.renderer.apply(this, h);
            return p === !1 && (p = s.apply(this, h)), p;
          } : t.renderers[r.name] = r.renderer;
        }
        if ("tokenizer" in r) {
          if (!r.level || r.level !== "block" && r.level !== "inline")
            throw new Error("extension level must be 'block' or 'inline'");
          const s = t[r.level];
          s ? s.unshift(r.tokenizer) : t[r.level] = [r.tokenizer], r.start && (r.level === "block" ? t.startBlock ? t.startBlock.push(r.start) : t.startBlock = [r.start] : r.level === "inline" && (t.startInline ? t.startInline.push(r.start) : t.startInline = [r.start]));
        }
        "childTokens" in r && r.childTokens && (t.childTokens[r.name] = r.childTokens);
      }), a.extensions = t), e.renderer) {
        const r = this.defaults.renderer || new se(this.defaults);
        for (const s in e.renderer) {
          const h = e.renderer[s], p = s, M = r[p];
          r[p] = (...d) => {
            let x = h.apply(r, d);
            return x === !1 && (x = M.apply(r, d)), x || "";
          };
        }
        a.renderer = r;
      }
      if (e.tokenizer) {
        const r = this.defaults.tokenizer || new ae(this.defaults);
        for (const s in e.tokenizer) {
          const h = e.tokenizer[s], p = s, M = r[p];
          r[p] = (...d) => {
            let x = h.apply(r, d);
            return x === !1 && (x = M.apply(r, d)), x;
          };
        }
        a.tokenizer = r;
      }
      if (e.hooks) {
        const r = this.defaults.hooks || new F();
        for (const s in e.hooks) {
          const h = e.hooks[s], p = s, M = r[p];
          F.passThroughHooks.has(s) ? r[p] = (d) => {
            if (this.defaults.async)
              return Promise.resolve(h.call(r, d)).then((w) => M.call(r, w));
            const x = h.call(r, d);
            return M.call(r, x);
          } : r[p] = (...d) => {
            let x = h.apply(r, d);
            return x === !1 && (x = M.apply(r, d)), x;
          };
        }
        a.hooks = r;
      }
      if (e.walkTokens) {
        const r = this.defaults.walkTokens, s = e.walkTokens;
        a.walkTokens = function(h) {
          let p = [];
          return p.push(s.call(this, h)), r && (p = p.concat(r.call(this, h))), p;
        };
      }
      this.defaults = { ...this.defaults, ...a };
    }), this;
  }
  setOptions(n) {
    return this.defaults = { ...this.defaults, ...n }, this;
  }
  lexer(n, t) {
    return N.lex(n, t ?? this.defaults);
  }
  parser(n, t) {
    return O.parse(n, t ?? this.defaults);
  }
}
W = new WeakSet(), ie = function(n, t) {
  return (e, a) => {
    const r = { ...a }, s = { ...this.defaults, ...r };
    this.defaults.async === !0 && r.async === !1 && (s.silent || console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."), s.async = !0);
    const h = V(this, re, Me).call(this, !!s.silent, !!s.async);
    if (typeof e > "u" || e === null)
      return h(new Error("marked(): input parameter is undefined or null"));
    if (typeof e != "string")
      return h(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
    if (s.hooks && (s.hooks.options = s), s.async)
      return Promise.resolve(s.hooks ? s.hooks.preprocess(e) : e).then((p) => n(p, s)).then((p) => s.walkTokens ? Promise.all(this.walkTokens(p, s.walkTokens)).then(() => p) : p).then((p) => t(p, s)).then((p) => s.hooks ? s.hooks.postprocess(p) : p).catch(h);
    try {
      s.hooks && (e = s.hooks.preprocess(e));
      const p = n(e, s);
      s.walkTokens && this.walkTokens(p, s.walkTokens);
      let M = t(p, s);
      return s.hooks && (M = s.hooks.postprocess(M)), M;
    } catch (p) {
      return h(p);
    }
  };
}, re = new WeakSet(), Me = function(n, t) {
  return (e) => {
    if (e.message += `
Please report this to https://github.com/markedjs/marked.`, n) {
      const a = "<p>An error occurred:</p><pre>" + R(e.message + "", !0) + "</pre>";
      return t ? Promise.resolve(a) : a;
    }
    if (t)
      return Promise.reject(e);
    throw e;
  };
};
const K = new Oe();
function E(g, n) {
  return K.parse(g, n);
}
E.options = E.setOptions = function(g) {
  return K.setOptions(g), E.defaults = K.defaults, fe(E.defaults), E;
};
E.getDefaults = le;
E.defaults = X;
E.use = function(...g) {
  return K.use(...g), E.defaults = K.defaults, fe(E.defaults), E;
};
E.walkTokens = function(g, n) {
  return K.walkTokens(g, n);
};
E.parseInline = K.parseInline;
E.Parser = O;
E.parser = O.parse;
E.Renderer = se;
E.TextRenderer = he;
E.Lexer = N;
E.lexer = N.lex;
E.Tokenizer = ae;
E.Hooks = F;
E.parse = E;
E.options;
E.setOptions;
E.use;
E.walkTokens;
E.parseInline;
O.parse;
N.lex;
const y = {
  bonang: {
    name: "bonang"
  },
  saron: {
    name: "saron"
  },
  kendang: {
    name: "kendhang"
  },
  elaborating: {
    name: "elaborating instruments"
  },
  balungan: {
    name: "balungan instruments"
  },
  punctuating: {
    name: "punctuating instruments"
  },
  drum: {
    name: "drums"
  },
  soft: {
    name: "soft instruments"
  },
  loud: {
    name: "loud instruments"
  },
  pencon: {
    name: "gong-style instruments"
  },
  wilah: {
    name: "keyed instruments"
  }
}, qe = {
  bonang_barung: {
    name: "Bonang Barung",
    // alt:'A wooden frame approximately two meters long holds two rows of medium-sized bronze kettle-shaped gongs with raised bosses on their centre. Each row contains six or seven gongs depending on the scale used.',
    alt: "A wooden frame approximately two meters long holds two rows of medium-sized bronze kettle-shaped gongs with raised bosses on their centre. Each row contains six or seven gongs depending on the scale used.",
    alternatives: "",
    family: [y.bonang, y.elaborating, y.loud, y.wilah],
    alternatives: [],
    links: [{ url: "https://en.wikipedia.org/wiki/Bonang", name: "Bonang on Wikipedia" }],
    description: E.parse(`The bonang is a set of gong-chimes mounted on a wooden frame. The bonang barung is often thought of as the melodic leader of the loud-style set of gamelan instruments, playing the notes of the main melody before anyone else.
  
Although this instrument is usually played by one person, in older gamelan ensembles, similar instruments can be shared by two players facing each other.  For this reason, the pitch of the lower octave of gongs run from left to right, and the top octave is placed in the opposite order.`)
  },
  bonang_panerus: {
    name: "Bonang Panerus",
    family: [y.bonang, y.elaborating, y.loud, y.wilah],
    alternatives: [],
    alt: "A wooden frame approximately two meters long holds two rows of small bronze kettle-shaped gongs with raised bosses on their centre. Each row contains six or seven gongs depending on the scale used.",
    description: "<p>The two rows of gongs featured on the bonang panerus are the smallest of the bonang-type instruments. The pitch range of the bonang panerus is an octave above the bonang barung.</p><p> The bonang panerus can be used to fill in the gaps between the notes of the bonang barung to create a smooth texture.</p>"
  },
  saron_demung: {
    name: "Saron Demung",
    family: [y.saron, y.balungan, y.loud, y.wilah],
    alternatives: ["Demung"],
    techniques: ["mbalung"],
    description: "The demung is the largest and lowest-pitched of the saron-style instruments. It is usually used to play a central melody called the balungan, but can also be used to play interlocking patterns.",
    alt: "The saron demung has a wooden frame just under a meter wide, half a meter tall, and a quarter of a meter deep, with seven bronze keys played with a wooden mallet. The keys are numbered as follows: low 6, 1, 2, 3, 5, 6, high 1."
  },
  saron_barung: {
    name: "Saron Barung",
    alt: "The saron barung is a medium-sized keyed instrument has a wooden frame approximately a meter wide, half a meter tall, and a quarter of a meter deep, with seven bronze keys played with a wooden mallet. The keys are numbered as follows: low 6, 1, 2, 3, 5, 6, high 1.",
    family: [y.saron, y.balungan, y.loud, y.wilah],
    techniques: ["mbalung", "nyacah", "nacah", "imbal"],
    alternatives: ["Saron"],
    description: "The saron barung is a medium-pitched keyed instrument.  In traditional gamelan music, it can be used to play a central melody (balungan), or interlocking and elaborating parts."
  },
  saron_sanga: {
    name: "Saron Sanga",
    family: [y.saron, y.balungan, y.loud, y.wilah, y.elaborating],
    techniques: ["mbalung", "nyacah", "nacah", "imbal"],
    alternatives: ["Saron Wayang"],
    alt: "The saron sanga is a medium-sized keyed instrument. It has a wooden frame approximately a meter wide, half a meter tall, and a quarter of a meter deep, with nine bronze keys played with a wooden mallet. The keys are numbered as follows: low 6, 1, 2, 3, 5, 6, high 1.",
    description: '<p>The saron sanga is also known as the saron wayang because of its associations with wayang kulit (shadow puppet theatre).  The word sanga means "nine", indicating the number of keys found on this version of the instrument.</p><p>The saron sanga has the same pitch range as the saron barung, adding a high 2 and 3 at the upper end of the slendro scale. The extra keys help enable a style of playing called "nyacah", which is a type of fast, partly improvised melody that flows toward key points in a musical structure.</p> <p>This saron sanga is usually only found in the slendro tuning. Its pelog counterpart is a regular saron barung with seven keys.</p>'
  },
  kendang: {
    name: "Kendhang",
    family: [y.drum],
    alternatives: ["Kendhang"],
    description: "<p>The set of drums here are called the kendhang ageng (large drum) and ketipung (small drum).</p>  <p>To set them apart from other types of kendhang, they are called kendhang dua in Indonesian or kendhang kalih in Javanese. Both of these names literally mean 'two drums'.</p> <p>The drums are usually played together by one person. In older style gamelan ensembles like the Gamelan Carabalen, these drums were shared between two people.</p>",
    Notation: "Javanese drumming notation uses letters to represent the various strokes:<ul><li>t: tak</li><li>o: tong</li><li>k: ket</li><li>p: dung</li><li>b: dha</li></ul>",
    alt: "The kendang are a set of barrel-shaped drums with animal skin stretched tightly on both heads, played with the hands."
  },
  saron_panerus: {
    name: "Saron Panerus",
    alternatives: ["Peking"],
    alt: "The saron panerus is the smallest of the keyed instruments. It has a wooden frame just over half a meter wide, half a meter tall, and a quarter of a meter deep, with seven bronze keys played with a wooden mallet. The keys are numbered as follows: low 6, 1, 2, 3, 5, 6, high 1.",
    family: [y.saron, y.balungan, y.elaborating, y.loud, y.wilah],
    description: "The saron panerus (also known as 'peking') is the highest-pitched of the saron instruments. The saron panerus plays denser patterns than the saron barung and demung."
  },
  gender_panembung: {
    name: "Slenthem",
    family: [y.soft, y.balungan, y.wilah],
    alt: "The slenthem is a bass instrument, featuring seven flat bronze keys suspended over metal tubes, which act as resonators, and held together with a wooden frame.",
    alternatives: [],
    description: "The slenthem is borrowed from the soft-style set of instruments, and provides a bass part that fits closely with the notes played on the saron instruments."
  },
  kethuk: {
    name: "Kempyang / Kethuk",
    family: [y.punctuating, y.loud, y.pencon],
    alternatives: [],
    alt: "The kempyang and kethuk are two small gongs, mounted horizontally on a small wooden frame.  The kempyang is a small high-pitched gong, and the kethuk is a slightly larger low-pitched gong.",
    description: "The kethuk plays the part of an off-beat pulse in most gamelan pieces. In certain sections, it is accompanied by the higher pitched kempyang."
  },
  kempul: {
    name: "Kempul & Gongs",
    family: [y.punctuating, y.loud, y.pencon],
    alternatives: [],
    alt: "The kempul are a set of large bronze gongs hanging from a wooden frame featuring ornate carvings of a serpent or dragon.  The lowest of these gongs is called the gong agung, and it is black with a shiny bronze boss in the centre.",
    description: "The kempul are a set of hanging gongs that mark out key points in gamelan pieces, in alternation with the kenong."
  },
  gong: {
    name: "Gongs",
    family: [y.punctuating, y.loud, y.pencon],
    alternatives: [],
    description: ""
  },
  kenong: {
    name: "Kenong",
    family: [y.punctuating, y.loud, y.pencon],
    alternatives: [],
    alt: "The kenong are a set of horizontally mounted gongs, with a raised boss in the centre.",
    description: "The kenong are a set of gongs that are mounted horizontally.  They resemble large versions of the bonang, and are used to mark key points in gamelan pieces in alternation with the kempul."
  }
}, je = function(g, n = {}) {
  document.dispatchEvent(new CustomEvent(g, {
    detail: n,
    bubbles: !0,
    cancelable: !0,
    composed: !1
  }));
};
function Ze(g) {
  if (g.__esModule)
    return g;
  var n = g.default;
  if (typeof n == "function") {
    var t = function e() {
      return this instanceof e ? Reflect.construct(n, arguments, this.constructor) : n.apply(this, arguments);
    };
    t.prototype = n.prototype;
  } else
    t = {};
  return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(g).forEach(function(e) {
    var a = Object.getOwnPropertyDescriptor(g, e);
    Object.defineProperty(t, e, a.get ? a : {
      enumerable: !0,
      get: function() {
        return g[e];
      }
    });
  }), t;
}
var Ke = { exports: {} };
const Xe = {}, Ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: Xe
}, Symbol.toStringTag, { value: "Module" })), Qe = /* @__PURE__ */ Ze(Ge);
(function(g) {
  function n(i) {
    this.mode = e.MODE_8BIT_BYTE, this.data = i, this.parsedData = [];
    for (var o = 0, u = this.data.length; o < u; o++) {
      var l = [], c = this.data.charCodeAt(o);
      c > 65536 ? (l[0] = 240 | (c & 1835008) >>> 18, l[1] = 128 | (c & 258048) >>> 12, l[2] = 128 | (c & 4032) >>> 6, l[3] = 128 | c & 63) : c > 2048 ? (l[0] = 224 | (c & 61440) >>> 12, l[1] = 128 | (c & 4032) >>> 6, l[2] = 128 | c & 63) : c > 128 ? (l[0] = 192 | (c & 1984) >>> 6, l[1] = 128 | c & 63) : l[0] = c, this.parsedData.push(l);
    }
    this.parsedData = Array.prototype.concat.apply([], this.parsedData), this.parsedData.length != this.data.length && (this.parsedData.unshift(191), this.parsedData.unshift(187), this.parsedData.unshift(239));
  }
  n.prototype = {
    getLength: function(i) {
      return this.parsedData.length;
    },
    write: function(i) {
      for (var o = 0, u = this.parsedData.length; o < u; o++)
        i.put(this.parsedData[o], 8);
    }
  };
  function t(i, o) {
    this.typeNumber = i, this.errorCorrectLevel = o, this.modules = null, this.moduleCount = 0, this.dataCache = null, this.dataList = [];
  }
  t.prototype = { addData: function(i) {
    var o = new n(i);
    this.dataList.push(o), this.dataCache = null;
  }, isDark: function(i, o) {
    if (i < 0 || this.moduleCount <= i || o < 0 || this.moduleCount <= o)
      throw new Error(i + "," + o);
    return this.modules[i][o];
  }, getModuleCount: function() {
    return this.moduleCount;
  }, make: function() {
    this.makeImpl(!1, this.getBestMaskPattern());
  }, makeImpl: function(i, o) {
    this.moduleCount = this.typeNumber * 4 + 17, this.modules = new Array(this.moduleCount);
    for (var u = 0; u < this.moduleCount; u++) {
      this.modules[u] = new Array(this.moduleCount);
      for (var l = 0; l < this.moduleCount; l++)
        this.modules[u][l] = null;
    }
    this.setupPositionProbePattern(0, 0), this.setupPositionProbePattern(this.moduleCount - 7, 0), this.setupPositionProbePattern(0, this.moduleCount - 7), this.setupPositionAdjustPattern(), this.setupTimingPattern(), this.setupTypeInfo(i, o), this.typeNumber >= 7 && this.setupTypeNumber(i), this.dataCache == null && (this.dataCache = t.createData(this.typeNumber, this.errorCorrectLevel, this.dataList)), this.mapData(this.dataCache, o);
  }, setupPositionProbePattern: function(i, o) {
    for (var u = -1; u <= 7; u++)
      if (!(i + u <= -1 || this.moduleCount <= i + u))
        for (var l = -1; l <= 7; l++)
          o + l <= -1 || this.moduleCount <= o + l || (0 <= u && u <= 6 && (l == 0 || l == 6) || 0 <= l && l <= 6 && (u == 0 || u == 6) || 2 <= u && u <= 4 && 2 <= l && l <= 4 ? this.modules[i + u][o + l] = !0 : this.modules[i + u][o + l] = !1);
  }, getBestMaskPattern: function() {
    for (var i = 0, o = 0, u = 0; u < 8; u++) {
      this.makeImpl(!0, u);
      var l = s.getLostPoint(this);
      (u == 0 || i > l) && (i = l, o = u);
    }
    return o;
  }, createMovieClip: function(i, o, u) {
    var l = i.createEmptyMovieClip(o, u), c = 1;
    this.make();
    for (var m = 0; m < this.modules.length; m++)
      for (var L = m * c, k = 0; k < this.modules[m].length; k++) {
        var T = k * c, A = this.modules[m][k];
        A && (l.beginFill(0, 100), l.moveTo(T, L), l.lineTo(T + c, L), l.lineTo(T + c, L + c), l.lineTo(T, L + c), l.endFill());
      }
    return l;
  }, setupTimingPattern: function() {
    for (var i = 8; i < this.moduleCount - 8; i++)
      this.modules[i][6] == null && (this.modules[i][6] = i % 2 == 0);
    for (var o = 8; o < this.moduleCount - 8; o++)
      this.modules[6][o] == null && (this.modules[6][o] = o % 2 == 0);
  }, setupPositionAdjustPattern: function() {
    for (var i = s.getPatternPosition(this.typeNumber), o = 0; o < i.length; o++)
      for (var u = 0; u < i.length; u++) {
        var l = i[o], c = i[u];
        if (this.modules[l][c] == null)
          for (var m = -2; m <= 2; m++)
            for (var L = -2; L <= 2; L++)
              m == -2 || m == 2 || L == -2 || L == 2 || m == 0 && L == 0 ? this.modules[l + m][c + L] = !0 : this.modules[l + m][c + L] = !1;
      }
  }, setupTypeNumber: function(i) {
    for (var o = s.getBCHTypeNumber(this.typeNumber), u = 0; u < 18; u++) {
      var l = !i && (o >> u & 1) == 1;
      this.modules[Math.floor(u / 3)][u % 3 + this.moduleCount - 8 - 3] = l;
    }
    for (var u = 0; u < 18; u++) {
      var l = !i && (o >> u & 1) == 1;
      this.modules[u % 3 + this.moduleCount - 8 - 3][Math.floor(u / 3)] = l;
    }
  }, setupTypeInfo: function(i, o) {
    for (var u = this.errorCorrectLevel << 3 | o, l = s.getBCHTypeInfo(u), c = 0; c < 15; c++) {
      var m = !i && (l >> c & 1) == 1;
      c < 6 ? this.modules[c][8] = m : c < 8 ? this.modules[c + 1][8] = m : this.modules[this.moduleCount - 15 + c][8] = m;
    }
    for (var c = 0; c < 15; c++) {
      var m = !i && (l >> c & 1) == 1;
      c < 8 ? this.modules[8][this.moduleCount - c - 1] = m : c < 9 ? this.modules[8][15 - c - 1 + 1] = m : this.modules[8][15 - c - 1] = m;
    }
    this.modules[this.moduleCount - 8][8] = !i;
  }, mapData: function(i, o) {
    for (var u = -1, l = this.moduleCount - 1, c = 7, m = 0, L = this.moduleCount - 1; L > 0; L -= 2)
      for (L == 6 && L--; ; ) {
        for (var k = 0; k < 2; k++)
          if (this.modules[l][L - k] == null) {
            var T = !1;
            m < i.length && (T = (i[m] >>> c & 1) == 1);
            var A = s.getMask(o, l, L - k);
            A && (T = !T), this.modules[l][L - k] = T, c--, c == -1 && (m++, c = 7);
          }
        if (l += u, l < 0 || this.moduleCount <= l) {
          l -= u, u = -u;
          break;
        }
      }
  } }, t.PAD0 = 236, t.PAD1 = 17, t.createData = function(i, o, u) {
    for (var l = d.getRSBlocks(i, o), c = new x(), m = 0; m < u.length; m++) {
      var L = u[m];
      c.put(L.mode, 4), c.put(L.getLength(), s.getLengthInBits(L.mode, i)), L.write(c);
    }
    for (var k = 0, m = 0; m < l.length; m++)
      k += l[m].dataCount;
    if (c.getLengthInBits() > k * 8)
      throw new Error("code length overflow. (" + c.getLengthInBits() + ">" + k * 8 + ")");
    for (c.getLengthInBits() + 4 <= k * 8 && c.put(0, 4); c.getLengthInBits() % 8 != 0; )
      c.putBit(!1);
    for (; !(c.getLengthInBits() >= k * 8 || (c.put(t.PAD0, 8), c.getLengthInBits() >= k * 8)); )
      c.put(t.PAD1, 8);
    return t.createBytes(c, l);
  }, t.createBytes = function(i, o) {
    for (var u = 0, l = 0, c = 0, m = new Array(o.length), L = new Array(o.length), k = 0; k < o.length; k++) {
      var T = o[k].dataCount, A = o[k].totalCount - T;
      l = Math.max(l, T), c = Math.max(c, A), m[k] = new Array(T);
      for (var H = 0; H < m[k].length; H++)
        m[k][H] = 255 & i.buffer[H + u];
      u += T;
      var P = s.getErrorCorrectPolynomial(A), I = new M(m[k], P.getLength() - 1), q = I.mod(P);
      L[k] = new Array(P.getLength() - 1);
      for (var H = 0; H < L[k].length; H++) {
        var Z = H + q.getLength() - L[k].length;
        L[k][H] = Z >= 0 ? q.get(Z) : 0;
      }
    }
    for (var $ = 0, H = 0; H < o.length; H++)
      $ += o[H].totalCount;
    for (var j = new Array($), D = 0, H = 0; H < l; H++)
      for (var k = 0; k < o.length; k++)
        H < m[k].length && (j[D++] = m[k][H]);
    for (var H = 0; H < c; H++)
      for (var k = 0; k < o.length; k++)
        H < L[k].length && (j[D++] = L[k][H]);
    return j;
  };
  for (var e = { MODE_NUMBER: 1, MODE_ALPHA_NUM: 2, MODE_8BIT_BYTE: 4, MODE_KANJI: 8 }, a = { L: 1, M: 0, Q: 3, H: 2 }, r = { PATTERN000: 0, PATTERN001: 1, PATTERN010: 2, PATTERN011: 3, PATTERN100: 4, PATTERN101: 5, PATTERN110: 6, PATTERN111: 7 }, s = { PATTERN_POSITION_TABLE: [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], G15: 1335, G18: 7973, G15_MASK: 21522, getBCHTypeInfo: function(i) {
    for (var o = i << 10; s.getBCHDigit(o) - s.getBCHDigit(s.G15) >= 0; )
      o ^= s.G15 << s.getBCHDigit(o) - s.getBCHDigit(s.G15);
    return (i << 10 | o) ^ s.G15_MASK;
  }, getBCHTypeNumber: function(i) {
    for (var o = i << 12; s.getBCHDigit(o) - s.getBCHDigit(s.G18) >= 0; )
      o ^= s.G18 << s.getBCHDigit(o) - s.getBCHDigit(s.G18);
    return i << 12 | o;
  }, getBCHDigit: function(i) {
    for (var o = 0; i != 0; )
      o++, i >>>= 1;
    return o;
  }, getPatternPosition: function(i) {
    return s.PATTERN_POSITION_TABLE[i - 1];
  }, getMask: function(i, o, u) {
    switch (i) {
      case r.PATTERN000:
        return (o + u) % 2 == 0;
      case r.PATTERN001:
        return o % 2 == 0;
      case r.PATTERN010:
        return u % 3 == 0;
      case r.PATTERN011:
        return (o + u) % 3 == 0;
      case r.PATTERN100:
        return (Math.floor(o / 2) + Math.floor(u / 3)) % 2 == 0;
      case r.PATTERN101:
        return o * u % 2 + o * u % 3 == 0;
      case r.PATTERN110:
        return (o * u % 2 + o * u % 3) % 2 == 0;
      case r.PATTERN111:
        return (o * u % 3 + (o + u) % 2) % 2 == 0;
      default:
        throw new Error("bad maskPattern:" + i);
    }
  }, getErrorCorrectPolynomial: function(i) {
    for (var o = new M([1], 0), u = 0; u < i; u++)
      o = o.multiply(new M([1, h.gexp(u)], 0));
    return o;
  }, getLengthInBits: function(i, o) {
    if (1 <= o && o < 10)
      switch (i) {
        case e.MODE_NUMBER:
          return 10;
        case e.MODE_ALPHA_NUM:
          return 9;
        case e.MODE_8BIT_BYTE:
          return 8;
        case e.MODE_KANJI:
          return 8;
        default:
          throw new Error("mode:" + i);
      }
    else if (o < 27)
      switch (i) {
        case e.MODE_NUMBER:
          return 12;
        case e.MODE_ALPHA_NUM:
          return 11;
        case e.MODE_8BIT_BYTE:
          return 16;
        case e.MODE_KANJI:
          return 10;
        default:
          throw new Error("mode:" + i);
      }
    else if (o < 41)
      switch (i) {
        case e.MODE_NUMBER:
          return 14;
        case e.MODE_ALPHA_NUM:
          return 13;
        case e.MODE_8BIT_BYTE:
          return 16;
        case e.MODE_KANJI:
          return 12;
        default:
          throw new Error("mode:" + i);
      }
    else
      throw new Error("type:" + o);
  }, getLostPoint: function(i) {
    for (var o = i.getModuleCount(), u = 0, l = 0; l < o; l++)
      for (var c = 0; c < o; c++) {
        for (var m = 0, L = i.isDark(l, c), k = -1; k <= 1; k++)
          if (!(l + k < 0 || o <= l + k))
            for (var T = -1; T <= 1; T++)
              c + T < 0 || o <= c + T || k == 0 && T == 0 || L == i.isDark(l + k, c + T) && m++;
        m > 5 && (u += 3 + m - 5);
      }
    for (var l = 0; l < o - 1; l++)
      for (var c = 0; c < o - 1; c++) {
        var A = 0;
        i.isDark(l, c) && A++, i.isDark(l + 1, c) && A++, i.isDark(l, c + 1) && A++, i.isDark(l + 1, c + 1) && A++, (A == 0 || A == 4) && (u += 3);
      }
    for (var l = 0; l < o; l++)
      for (var c = 0; c < o - 6; c++)
        i.isDark(l, c) && !i.isDark(l, c + 1) && i.isDark(l, c + 2) && i.isDark(l, c + 3) && i.isDark(l, c + 4) && !i.isDark(l, c + 5) && i.isDark(l, c + 6) && (u += 40);
    for (var c = 0; c < o; c++)
      for (var l = 0; l < o - 6; l++)
        i.isDark(l, c) && !i.isDark(l + 1, c) && i.isDark(l + 2, c) && i.isDark(l + 3, c) && i.isDark(l + 4, c) && !i.isDark(l + 5, c) && i.isDark(l + 6, c) && (u += 40);
    for (var H = 0, c = 0; c < o; c++)
      for (var l = 0; l < o; l++)
        i.isDark(l, c) && H++;
    var P = Math.abs(100 * H / o / o - 50) / 5;
    return u += P * 10, u;
  } }, h = { glog: function(i) {
    if (i < 1)
      throw new Error("glog(" + i + ")");
    return h.LOG_TABLE[i];
  }, gexp: function(i) {
    for (; i < 0; )
      i += 255;
    for (; i >= 256; )
      i -= 255;
    return h.EXP_TABLE[i];
  }, EXP_TABLE: new Array(256), LOG_TABLE: new Array(256) }, p = 0; p < 8; p++)
    h.EXP_TABLE[p] = 1 << p;
  for (var p = 8; p < 256; p++)
    h.EXP_TABLE[p] = h.EXP_TABLE[p - 4] ^ h.EXP_TABLE[p - 5] ^ h.EXP_TABLE[p - 6] ^ h.EXP_TABLE[p - 8];
  for (var p = 0; p < 255; p++)
    h.LOG_TABLE[h.EXP_TABLE[p]] = p;
  function M(i, o) {
    if (i.length == null)
      throw new Error(i.length + "/" + o);
    for (var u = 0; u < i.length && i[u] == 0; )
      u++;
    this.num = new Array(i.length - u + o);
    for (var l = 0; l < i.length - u; l++)
      this.num[l] = i[l + u];
  }
  M.prototype = { get: function(i) {
    return this.num[i];
  }, getLength: function() {
    return this.num.length;
  }, multiply: function(i) {
    for (var o = new Array(this.getLength() + i.getLength() - 1), u = 0; u < this.getLength(); u++)
      for (var l = 0; l < i.getLength(); l++)
        o[u + l] ^= h.gexp(h.glog(this.get(u)) + h.glog(i.get(l)));
    return new M(o, 0);
  }, mod: function(i) {
    if (this.getLength() - i.getLength() < 0)
      return this;
    for (var o = h.glog(this.get(0)) - h.glog(i.get(0)), u = new Array(this.getLength()), l = 0; l < this.getLength(); l++)
      u[l] = this.get(l);
    for (var l = 0; l < i.getLength(); l++)
      u[l] ^= h.gexp(h.glog(i.get(l)) + o);
    return new M(u, 0).mod(i);
  } };
  function d(i, o) {
    this.totalCount = i, this.dataCount = o;
  }
  d.RS_BLOCK_TABLE = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]], d.getRSBlocks = function(i, o) {
    var u = d.getRsBlockTable(i, o);
    if (u == null)
      throw new Error("bad rs block @ typeNumber:" + i + "/errorCorrectLevel:" + o);
    for (var l = u.length / 3, c = [], m = 0; m < l; m++)
      for (var L = u[m * 3 + 0], k = u[m * 3 + 1], T = u[m * 3 + 2], A = 0; A < L; A++)
        c.push(new d(k, T));
    return c;
  }, d.getRsBlockTable = function(i, o) {
    switch (o) {
      case a.L:
        return d.RS_BLOCK_TABLE[(i - 1) * 4 + 0];
      case a.M:
        return d.RS_BLOCK_TABLE[(i - 1) * 4 + 1];
      case a.Q:
        return d.RS_BLOCK_TABLE[(i - 1) * 4 + 2];
      case a.H:
        return d.RS_BLOCK_TABLE[(i - 1) * 4 + 3];
      default:
        return;
    }
  };
  function x() {
    this.buffer = [], this.length = 0;
  }
  x.prototype = { get: function(i) {
    var o = Math.floor(i / 8);
    return (this.buffer[o] >>> 7 - i % 8 & 1) == 1;
  }, put: function(i, o) {
    for (var u = 0; u < o; u++)
      this.putBit((i >>> o - u - 1 & 1) == 1);
  }, getLengthInBits: function() {
    return this.length;
  }, putBit: function(i) {
    var o = Math.floor(this.length / 8);
    this.buffer.length <= o && this.buffer.push(0), i && (this.buffer[o] |= 128 >>> this.length % 8), this.length++;
  } };
  var w = [[17, 14, 11, 7], [32, 26, 20, 14], [53, 42, 32, 24], [78, 62, 46, 34], [106, 84, 60, 44], [134, 106, 74, 58], [154, 122, 86, 64], [192, 152, 108, 84], [230, 180, 130, 98], [271, 213, 151, 119], [321, 251, 177, 137], [367, 287, 203, 155], [425, 331, 241, 177], [458, 362, 258, 194], [520, 412, 292, 220], [586, 450, 322, 250], [644, 504, 364, 280], [718, 560, 394, 310], [792, 624, 442, 338], [858, 666, 482, 382], [929, 711, 509, 403], [1003, 779, 565, 439], [1091, 857, 611, 461], [1171, 911, 661, 511], [1273, 997, 715, 535], [1367, 1059, 751, 593], [1465, 1125, 805, 625], [1528, 1190, 868, 658], [1628, 1264, 908, 698], [1732, 1370, 982, 742], [1840, 1452, 1030, 790], [1952, 1538, 1112, 842], [2068, 1628, 1168, 898], [2188, 1722, 1228, 958], [2303, 1809, 1283, 983], [2431, 1911, 1351, 1051], [2563, 1989, 1423, 1093], [2699, 2099, 1499, 1139], [2809, 2213, 1579, 1219], [2953, 2331, 1663, 1273]];
  function _(i) {
    if (this.options = {
      padding: 4,
      width: 256,
      height: 256,
      typeNumber: 4,
      color: "#000000",
      background: "#ffffff",
      ecl: "M"
    }, typeof i == "string" && (i = {
      content: i
    }), i)
      for (var o in i)
        this.options[o] = i[o];
    if (typeof this.options.content != "string")
      throw new Error("Expected 'content' as string!");
    if (this.options.content.length === 0)
      throw new Error("Expected 'content' to be non-empty!");
    if (!(this.options.padding >= 0))
      throw new Error("Expected 'padding' value to be non-negative!");
    if (!(this.options.width > 0) || !(this.options.height > 0))
      throw new Error("Expected 'width' or 'height' value to be higher than zero!");
    function u(T) {
      switch (T) {
        case "L":
          return a.L;
        case "M":
          return a.M;
        case "Q":
          return a.Q;
        case "H":
          return a.H;
        default:
          throw new Error("Unknwon error correction level: " + T);
      }
    }
    function l(T, A) {
      for (var H = c(T), P = 1, I = 0, q = 0, Z = w.length; q <= Z; q++) {
        var $ = w[q];
        if (!$)
          throw new Error("Content too long: expected " + I + " but got " + H);
        switch (A) {
          case "L":
            I = $[0];
            break;
          case "M":
            I = $[1];
            break;
          case "Q":
            I = $[2];
            break;
          case "H":
            I = $[3];
            break;
          default:
            throw new Error("Unknwon error correction level: " + A);
        }
        if (H <= I)
          break;
        P++;
      }
      if (P > w.length)
        throw new Error("Content too long");
      return P;
    }
    function c(T) {
      var A = encodeURI(T).toString().replace(/\%[0-9a-fA-F]{2}/g, "a");
      return A.length + (A.length != T ? 3 : 0);
    }
    var m = this.options.content, L = l(m, this.options.ecl), k = u(this.options.ecl);
    this.qrcode = new t(L, k), this.qrcode.addData(m), this.qrcode.make();
  }
  _.prototype.svg = function(i) {
    var o = this.options || {}, u = this.qrcode.modules;
    typeof i > "u" && (i = { container: o.container || "svg" });
    for (var l = typeof o.pretty < "u" ? !!o.pretty : !0, c = l ? "  " : "", m = l ? `\r
` : "", L = o.width, k = o.height, T = u.length, A = L / (T + 2 * o.padding), H = k / (T + 2 * o.padding), P = typeof o.join < "u" ? !!o.join : !1, I = typeof o.swap < "u" ? !!o.swap : !1, q = typeof o.xmlDeclaration < "u" ? !!o.xmlDeclaration : !0, Z = typeof o.predefined < "u" ? !!o.predefined : !1, $ = Z ? c + '<defs><path id="qrmodule" d="M0 0 h' + H + " v" + A + ' H0 z" style="fill:' + o.color + ';shape-rendering:crispEdges;" /></defs>' + m : "", j = c + '<rect x="0" y="0" width="' + L + '" height="' + k + '" style="fill:' + o.background + ';shape-rendering:crispEdges;"/>' + m, D = "", ue = "", Y = 0; Y < T; Y++)
      for (var J = 0; J < T; J++) {
        var ve = u[J][Y];
        if (ve) {
          var z = J * A + o.padding * A, U = Y * H + o.padding * H;
          if (I) {
            var Te = z;
            z = U, U = Te;
          }
          if (P) {
            var G = A + z, Q = H + U;
            z = Number.isInteger(z) ? Number(z) : z.toFixed(2), U = Number.isInteger(U) ? Number(U) : U.toFixed(2), G = Number.isInteger(G) ? Number(G) : G.toFixed(2), Q = Number.isInteger(Q) ? Number(Q) : Q.toFixed(2), ue += "M" + z + "," + U + " V" + Q + " H" + G + " V" + U + " H" + z + " Z ";
          } else
            Z ? D += c + '<use x="' + z.toString() + '" y="' + U.toString() + '" href="#qrmodule" />' + m : D += c + '<rect x="' + z.toString() + '" y="' + U.toString() + '" width="' + A + '" height="' + H + '" style="fill:' + o.color + ';shape-rendering:crispEdges;"/>' + m;
        }
      }
    P && (D = c + '<path x="0" y="0" style="fill:' + o.color + ';shape-rendering:crispEdges;" d="' + ue + '" />');
    var B = "";
    switch (i.container) {
      case "svg":
        q && (B += '<?xml version="1.0" standalone="yes"?>' + m), B += '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="' + L + '" height="' + k + '">' + m, B += $ + j + D, B += "</svg>";
        break;
      case "svg-viewbox":
        q && (B += '<?xml version="1.0" standalone="yes"?>' + m), B += '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 ' + L + " " + k + '">' + m, B += $ + j + D, B += "</svg>";
        break;
      case "g":
        B += '<g width="' + L + '" height="' + k + '">' + m, B += $ + j + D, B += "</g>";
        break;
      default:
        B += ($ + j + D).replace(/^\s+/, "");
        break;
    }
    return B;
  }, _.prototype.save = function(i, o) {
    var u = this.svg();
    typeof o != "function" && (o = function(c, m) {
    });
    try {
      var l = Qe;
      l.writeFile(i, u, o);
    } catch (c) {
      o(c);
    }
  }, g.exports = _;
})(Ke);
function Fe(g, n = ["-", "+", "n", "p", "g"]) {
  let t = [], e = "";
  for (let a = 0; a < g.length; a++) {
    let r = g.charAt(a);
    n.includes(r) || n.length === 0 && !/\d/.test(r) ? (e.length > 0 && !e.endsWith("/") && (t.push(e), e = ""), e += r) : r === "/" ? e += r : /\d|\./.test(r) ? (e += r, a < g.length - 1 && g.charAt(a + 1) !== "/" && (t.push(e), e = "")) : (e += r, a < g.length - 1 && !n.includes(g.charAt(a + 1)) && g.charAt(a + 1) !== "/" && (t.push(e), e = ""));
  }
  return e.length > 0 && t.push(e), t;
}
const lt = function(g) {
  let n = {}, t = g.match(/\[([^\]]+)\]\(([^\)]+)\)/g);
  return t && t.forEach((e) => {
    let a = e.match(/\[([^\]]+)\]/)[1], r = e.match(/\(([^\)]+)\)/)[1];
    n[a] = r;
  }), n;
};
function We(g, n = 1) {
  return 6e4 / g / n;
}
const Ye = {
  position: "0:0:0",
  count: 0,
  pos: 0,
  loop: !0,
  playing: !1,
  bpm: 120,
  ramping: !1,
  rampTarget: 120,
  rampIncrement: [4, 2],
  update: function() {
    this.count++, this.ramping && (this.bpm < this.rampTarget ? (document.querySelectorAll(".sequencer__bpm.on").forEach((n) => {
      n.classList.add("current");
    }), this.bpm += this.rampIncrement[0]) : this.bpm > this.rampTarget ? (this.bpm -= this.rampIncrement[1], document.querySelectorAll(".sequencer__bpm.on").forEach((n) => {
      n.classList.add("current");
    })) : (this.ramping = !1, document.querySelectorAll(".sequencer__bpm.on").forEach((n) => {
      n.classList.remove("current");
    })));
    let g = [Math.floor(this.count / 4), this.count % 4, 0];
    this.position = g.join(":"), this.pos = this.count % 16, je("transport", this);
  },
  schedule: function() {
    this.current = setTimeout(() => {
      this.update(), this.loop ? this.schedule() : this.playing = !1;
    }, We(this.bpm));
  },
  stop: function() {
    this.loop = !1, this.playing = !1, clearTimeout(this.current);
  },
  start: function() {
    window.Tone && Tone.start(), this.loop = !0, this.update(), this.schedule(), this.playing = !0;
  },
  toggle: function() {
    this.playing ? this.stop() : this.start();
  },
  ramp: function(g) {
    this.ramping = !0, this.rampTarget = g;
  }
};
function Je(g, n = v) {
  return Object.values(n).find((e) => e.kepatihan === g).kepatihan2;
}
const Ve = {
  bonang_barung: "bb",
  saron_sanga: "ss",
  bonang_panerus: "bp",
  saron_panerus: "sp",
  saron_barung: "sb",
  saron_demung: "sd",
  gambang: "gk",
  slenthem: "sl",
  kempul: "kp",
  kethuk: "kt",
  kenong: "kn",
  gong: "gg",
  kendhang: "kd"
}, be = {
  solo: {
    bonang: {
      slendro: ["L1", "L2", "L3", "L5", "L6", "M1", "M2", "M3", "M5", "M6", "H1", "H2"],
      pelog: [
        "L1",
        "L2",
        "L3",
        "L4",
        "L5",
        "L6",
        "L7",
        "M1",
        "M2",
        "M3",
        "M4",
        "M5",
        "M6",
        "M7"
      ]
    },
    bonang_barung: {
      slendro: ["L1", "L2", "L3", "L5", "L6", "M1", "M2", "M3", "M5", "M6", "H1", "H2"],
      pelog: [
        "L1",
        "L2",
        "L3",
        "L4",
        "L5",
        "L6",
        "L7",
        "M1",
        "M2",
        "M3",
        "M4",
        "M5",
        "M6",
        "M7"
      ]
    },
    bonang_panerus: {
      slendro: ["L1", "L2", "L3", "L5", "L6", "M1", "M2", "M3", "M5", "M6", "H1", "H2"],
      pelog: [
        "L1",
        "L2",
        "L3",
        "L4",
        "L5",
        "L6",
        "L7",
        "M1",
        "M2",
        "M3",
        "M4",
        "M5",
        "M6",
        "M7"
      ]
    },
    gambang: {
      slendro: ["S6", "L1", "L2", "L3", "L5", "L6", "M1", "M2", "M3", "M5", "M6", "H1", "H2", "H3", "H5", "H6", "U1", "U2", "U3", "U5"],
      pelog: ["S6", "S7", "L1", "L2", "L3", "L5", "L6", "L7", "M1", "M2", "M3", "M5", "M6", "M7", "H1", "H2", "H3", "H5", "H6", "H7", "U1", "U2", "U3", "U5"]
    },
    gender: {
      slendro: ["S6", "L1", "L2", "L3", "L5", "L6", "M1", "M2", "M3", "M5", "M6", "H1", "H2", "H3"],
      pelog: ["S6", "S7", "L1", "L2", "L3", "L5", "L6", "L7", "M1", "M2", "M3", "M5", "M6", "M7", "H1", "H2", "H3"]
    },
    gender_barung: {
      slendro: ["S6", "L1", "L2", "L3", "L5", "L6", "M1", "M2", "M3", "M5", "M6", "H1", "H2", "H3"],
      pelog: ["S6", "S7", "L1", "L2", "L3", "L5", "L6", "L7", "M1", "M2", "M3", "M5", "M6", "M7", "H1", "H2", "H3"]
    },
    gender_panembung: {
      slendro: ["L6", "M1", "M2", "M3", "M5", "M6", "H1"],
      pelog: ["M1", "M2", "M3", "M4", "M5", "M6", "M7"]
    },
    gender_panerus: {
      slendro: ["S6", "L1", "L2", "L3", "L5", "L6", "M1", "M2", "M3", "M5", "M6", "H1", "H2", "H3"],
      pelog: ["S6", "S7", "L1", "L2", "L3", "L5", "L6", "L7", "M1", "M2", "M3", "M5", "M6", "M7", "H1", "H2", "H3"]
    },
    kecer: {
      slendro: ["X1", "X2", "O1", "O2"],
      pelog: ["X1", "X2", "O1", "O2"]
    },
    kempul: {
      slendro: ["M2", "M3", "M5", "M6", "H1", "H2"],
      pelog: ["M2", "M3", "M4", "M5", "M6", "M7", "H1", "H2"]
    },
    kenong: {
      slendro: ["M2", "M3", "M5", "M6", "H1", "H2"],
      pelog: ["M2", "M3", "M4", "M5", "M6", "M7", "H1", "H2"]
    },
    kendhang: {
      slendro: ["T", "O", "K", "P", "B"],
      pelog: ["T", "O", "K", "P", "B"]
    },
    kethuk: {
      slendro: ["L2", "H1"],
      pelog: ["S6", "M6"]
    },
    gong: {
      slendro: ["S6", "L2"],
      pelog: ["S6", "L2"]
    },
    saron: {
      slendro: ["L6", "M1", "M2", "M3", "M5", "M6", "H1"],
      pelog: ["M1", "M2", "M3", "M4", "M5", "M6", "M7"]
    },
    saron_barung: {
      slendro: ["L6", "M1", "M2", "M3", "M5", "M6", "H1"],
      pelog: ["M1", "M2", "M3", "M4", "M5", "M6", "M7"]
    },
    saron_sanga: {
      slendro: ["L6", "M1", "M2", "M3", "M5", "M6", "H1", "H2", "H3"],
      pelog: ["M1", "M2", "M3", "M4", "M5", "M6", "M7"]
    },
    saron_demung: {
      slendro: ["L6", "M1", "M2", "M3", "M5", "M6", "H1"],
      pelog: ["M1", "M2", "M3", "M4", "M5", "M6", "M7"]
    },
    saron_panerus: {
      slendro: ["L6", "M1", "M2", "M3", "M5", "M6", "H1"],
      pelog: ["M1", "M2", "M3", "M4", "M5", "M6", "M7"]
    },
    saron_panerus: {
      slendro: ["L6", "M1", "M2", "M3", "M5", "M6", "H1"],
      pelog: ["M1", "M2", "M3", "M4", "M5", "M6", "M7"]
    },
    slenthem: {
      slendro: ["L6", "M1", "M2", "M3", "M5", "M6", "H1"],
      pelog: ["M1", "M2", "M3", "M4", "M5", "M6", "M7"]
    }
  },
  jogja: {
    bonang: {
      slendro: ["L2", "L3", "L5", "L6", "M1", "M2", "M3", "M5", "M6", "H1"],
      pelog: [
        "L1",
        "L2",
        "L3",
        "L4",
        "L5",
        "L6",
        "L7",
        "M1",
        "M2",
        "M3",
        "M4",
        "M5",
        "M6",
        "M7"
      ]
    },
    bonang_barung: {
      slendro: ["L1", "L2", "L3", "L5", "L6", "M1", "M2", "M3", "M5", "M6", "H1", "H2"],
      pelog: [
        "L1",
        "L2",
        "L3",
        "L4",
        "L5",
        "L6",
        "L7",
        "M1",
        "M2",
        "M3",
        "M4",
        "M5",
        "M6",
        "M7"
      ]
    },
    bonang_panerus: {
      slendro: ["L2", "L3", "L5", "L6", "M1", "M2", "M3", "M5", "M6", "H1"],
      pelog: [
        "L1",
        "L2",
        "L3",
        "L4",
        "L5",
        "L6",
        "L7",
        "M1",
        "M2",
        "M3",
        "M4",
        "M5",
        "M6",
        "M7"
      ]
    },
    gambang: {
      slendro: ["S6", "L1", "L2", "L3", "L5", "L6", "M1", "M2", "M3", "M5", "M6", "H1", "H2", "H3", "H5", "H6", "U1", "U2", "U3", "U5"],
      pelog: ["S6", "S7", "L1", "L2", "L3", "L5", "L6", "L7", "M1", "M2", "M3", "M5", "M6", "M7", "H1", "H2", "H3", "H5", "H6", "H7", "U1", "U2", "U3", "U5"]
    },
    gender: {
      slendro: ["S6", "L1", "L2", "L3", "L5", "L6", "M1", "M2", "M3", "M5", "M6", "H1", "H2", "H3"],
      pelog: ["S6", "S7", "L1", "L2", "L3", "L5", "L6", "L7", "M1", "M2", "M3", "M5", "M6", "M7", "H1", "H2", "H3"]
    },
    gender_barung: {
      slendro: ["S6", "L1", "L2", "L3", "L5", "L6", "M1", "M2", "M3", "M5", "M6", "H1", "H2", "H3"],
      pelog: ["S6", "S7", "L1", "L2", "L3", "L5", "L6", "L7", "M1", "M2", "M3", "M5", "M6", "M7", "H1", "H2", "H3"]
    },
    gender_panembung: {
      slendro: ["L6", "M1", "M2", "M3", "M5", "M6", "H1"],
      pelog: ["M1", "M2", "M3", "M4", "M5", "M6", "M7"]
    },
    gender_panerus: {
      slendro: ["S6", "L1", "L2", "L3", "L5", "L6", "M1", "M2", "M3", "M5", "M6", "H1", "H2", "H3"],
      pelog: ["S6", "S7", "L1", "L2", "L3", "L5", "L6", "L7", "M1", "M2", "M3", "M5", "M6", "M7", "H1", "H2", "H3"]
    },
    kethuk: {
      slendro: ["L2", "M6"],
      pelog: ["S6", "M6"]
    },
    kendhang: {
      slendro: ["T", "O", "K", "P", "B"],
      pelog: ["T", "O", "K", "P", "B"]
    },
    kecer: {
      slendro: ["X1", "X2", "O1", "O2"],
      pelog: ["X1", "X2", "O1", "O2"]
    },
    saron: {
      slendro: ["L6", "M1", "M2", "M3", "M5", "M6"],
      pelog: ["M1", "M2", "M3", "M4", "M5", "M6", "M7"]
    },
    saron_barung: {
      slendro: ["L6", "M1", "M2", "M3", "M5", "M6"],
      pelog: ["M1", "M2", "M3", "M4", "M5", "M6", "M7"]
    },
    saron_sanga: {
      slendro: ["L6", "M1", "M2", "M3", "M5", "M6", "H1", "H2", "H3"],
      pelog: ["M1", "M2", "M3", "M4", "M5", "M6", "M7"]
    },
    saron_demung: {
      slendro: ["L6", "M1", "M2", "M3", "M5", "M6"],
      pelog: ["M1", "M2", "M3", "M4", "M5", "M6", "M7"]
    },
    saron_panerus: {
      slendro: ["L6", "M1", "M2", "M3", "M5", "M6"],
      pelog: ["M1", "M2", "M3", "M4", "M5", "M6", "M7"]
    },
    gong: {
      slendro: ["S6", "L2"],
      pelog: ["S6", "L2"]
    },
    kempul: {
      slendro: ["M2", "M3", "M5", "M6", "H1", "H2"],
      pelog: ["M2", "M3", "M4", "M5", "M6", "M7", "H1", "H2"]
    },
    kenong: {
      slendro: ["M2", "M3", "M5", "M6", "H1", "H2"],
      pelog: ["M2", "M3", "M4", "M5", "M6", "M7", "H1", "H2"]
    },
    slenthem: {
      slendro: ["L6", "M1", "M2", "M3", "M5", "M6", "H1"],
      pelog: ["M1", "M2", "M3", "M4", "M5", "M6", "M7"]
    }
  }
}, et = function(n) {
  let t = n.split(" "), e = [];
  for (let a = 0; a < t.length; a++) {
    let r = Math.floor(a / 4);
    a % 4 == 0 && e.push([]);
    let s = document.createElement("span");
    s.innerHTML = t[a], e[r].push(s);
  }
  return e;
};
function te(g, n, t = v) {
  return Object.values(t).find((a) => a.note == g && a.octave == n);
}
const tt = function(g, n = "slendro", t = "any", e = be.solo, a = v) {
  let r = Object.values(a).find((d) => d.name === g);
  if (!r)
    return !1;
  let s = r.octave, h = r.note;
  if (t == "any") {
    let d = te(h, s + 1);
    return d ? d.name : (d = te(h, s - 1), d ? d.name : !1);
  }
  let p = te(h, s + 1);
  return p && e[t][n].includes(p.name) ? p.name : (p = te(h, s - 1), e[t][n].includes(p.name) ? p.name : !1);
};
class nt {
  constructor(n = [], t = 16, e = 1, a = "", r = "", s = "") {
    if (this.pattern = n, n.length == 0)
      for (let h = 0; h < t; h++)
        this.pattern.push(".");
  }
  getVal(n) {
    return this.arr[n];
  }
  getLength() {
    return this.pattern.length;
  }
  setVal(n, t) {
    this.pattern[n] = t;
  }
  getPattern() {
    return this.pattern;
  }
  setPattern(n) {
    this.pattern = n;
  }
}
class at {
  constructor(n = {}) {
    this.sequences = n;
  }
}
class we extends HTMLSpanElement {
  constructor() {
    super();
  }
}
class Le extends HTMLElement {
  constructor() {
    super();
  }
  // render(){
  //   console.log('p',this.children)
  //   this.innerHTML=this.innerText;
  // }
}
class ye extends HTMLSpanElement {
  constructor() {
    super();
  }
}
const st = "1.0.6";
class xe extends HTMLElement {
  constructor() {
    super();
  }
  connectedCallback() {
    this.render();
  }
  render() {
    const n = document.createElement("table");
    n.classList.add("notation-table");
    const t = document.createElement("tbody");
    n.appendChild(t);
    const e = Array.from(this.children);
    for (let a = 0; a < e.length; a++) {
      const r = e[a];
      if (r.tagName.toLowerCase() === "em") {
        const s = e[a + 1], h = document.createElement("tr"), p = document.createElement("td");
        if (p.textContent = r.textContent, h.appendChild(p), s && s.tagName.toLowerCase() === "notation-note") {
          const M = document.createElement("td");
          M.classList.add("testClass");
          const d = s.cloneNode(!0);
          M.appendChild(d), h.appendChild(M), a++;
        }
        t.appendChild(h);
      }
    }
    this.innerHTML = "", this.appendChild(n);
  }
}
const rt = function(g) {
  document.createElement("table"), g.querySelectorAll("li").forEach((t) => {
    document.createElement("tr");
    let e = Array.from(t.querySelectorAll("*")).filter((a) => a.tagName.toLowerCase().startsWith("notation-"));
    console.log(e);
  });
}, ht = {
  getGembyang: tt,
  notation: v,
  layouts: Ce,
  Note: Ae,
  midiNotes: $e,
  parseNotationString: Fe,
  family: y,
  info: qe,
  getSecondLineCharacter: Je,
  abbreviations: Ve,
  instrumentRanges: be,
  splitBalungan: et,
  convert: Ee,
  transport: Ye,
  replaceNotationTable: rt,
  Collection: at,
  Sequence: nt,
  Notation: we,
  Sequencer: Le,
  NoteElement: ye,
  NotationTable: xe
}, ot = "background: brown; color: gold; font-size:20px;padding:2rem;";
console.log("%c꧁ Pipilan.js ꧂", ot);
console.log(`Running Pipilan v.${st}`);
window.customElements.define("pipilan-notation", we, { extends: "span" });
window.customElements.define("pipilan-note", ye, { extends: "span" });
window.customElements.define("notation-note", Le);
window.customElements.define("notation-table", xe);
export {
  at as Collection,
  we as Notation,
  Ae as Note,
  ye as NoteElement,
  ht as Pipilan,
  nt as Sequence,
  Le as Sequencer,
  Ve as abbreviations,
  Ee as convert,
  y as family,
  tt as getGembyang,
  Je as getSecondLineCharacter,
  qe as info,
  be as instrumentRanges,
  Ce as layouts,
  $e as midiNotes,
  v as notation,
  lt as parseNameSequence,
  Fe as parseNotationString,
  rt as replaceNotationTable,
  et as splitBalungan,
  Ye as transport
};