import { longestStreak as s } from "../../../../../longest-streak@3.1.0/node_modules/longest-streak/index.es.js";
import { formatCodeAsIndented as l } from "../util/format-code-as-indented.es.js";
import { checkFence as x } from "../util/check-fence.es.js";
function F(n, i, e, u) {
  const m = x(e), t = n.value || "", f = m === "`" ? "GraveAccent" : "Tilde";
  if (l(n, e)) {
    const o = e.enter("codeIndented"), v = e.indentLines(t, p);
    return o(), v;
  }
  const r = e.createTracker(u), a = m.repeat(Math.max(s(t, m) + 1, 3)), d = e.enter("codeFenced");
  let c = r.move(a);
  if (n.lang) {
    const o = e.enter(`codeFencedLang${f}`);
    c += r.move(
      e.safe(n.lang, {
        before: c,
        after: " ",
        encode: ["`"],
        ...r.current()
      })
    ), o();
  }
  if (n.lang && n.meta) {
    const o = e.enter(`codeFencedMeta${f}`);
    c += r.move(" "), c += r.move(
      e.safe(n.meta, {
        before: c,
        after: `
`,
        encode: ["`"],
        ...r.current()
      })
    ), o();
  }
  return c += r.move(`
`), t && (c += r.move(t + `
`)), c += r.move(a), d(), c;
}
function p(n, i, e) {
  return (e ? "" : "    ") + n;
}
export {
  F as code
};
//# sourceMappingURL=code.es.js.map
