import { Document as l } from "./accelbyte-widgets709.mjs";
import { composeNode as N, composeEmptyNode as h } from "./accelbyte-widgets738.mjs";
import { resolveEnd as k } from "./accelbyte-widgets713.mjs";
import { resolveProps as u } from "./accelbyte-widgets739.mjs";
function y(d, a, { offset: i, start: m, value: o, end: n }, c) {
  const f = Object.assign({ _directives: a }, d), t = new l(void 0, f), r = {
    atRoot: !0,
    directives: t.directives,
    options: t.options,
    schema: t.schema
  }, e = u(m, {
    indicator: "doc-start",
    next: o ?? (n == null ? void 0 : n[0]),
    offset: i,
    onError: c,
    startOnNewline: !0
  });
  e.found && (t.directives.docStart = !0, o && (o.type === "block-map" || o.type === "block-seq") && !e.hasNewline && c(e.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), t.contents = o ? N(r, o, e, c) : h(r, e.end, m, null, e, c);
  const p = t.contents.range[2], s = k(n, p, !1, c);
  return s.comment && (t.comment = s.comment), t.range = [i, p, s.offset], t;
}
export {
  y as composeDoc
};
