function k(p, { flow: u, indicator: b, next: l, offset: y, onError: t, startOnNewline: A }) {
  let N = !1, a = A, s = A, c = "", r = "", T = !1, S = !1, f = !1, n = null, o = null, m = null, h = null, i = null;
  for (const e of p)
    switch (f && (e.type !== "space" && e.type !== "newline" && e.type !== "comma" && t(e.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), f = !1), e.type) {
      case "space":
        !u && a && b !== "doc-start" && e.source[0] === "	" && t(e, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), s = !0;
        break;
      case "comment": {
        s || t(e, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
        const g = e.source.substring(1) || " ";
        c ? c += r + g : c = g, r = "", a = !1;
        break;
      }
      case "newline":
        a ? c ? c += e.source : N = !0 : r += e.source, a = !0, T = !0, (n || o) && (S = !0), s = !0;
        break;
      case "anchor":
        n && t(e, "MULTIPLE_ANCHORS", "A node can have at most one anchor"), e.source.endsWith(":") && t(e.offset + e.source.length - 1, "BAD_ALIAS", "Anchor ending in : is ambiguous", !0), n = e, i === null && (i = e.offset), a = !1, s = !1, f = !0;
        break;
      case "tag": {
        o && t(e, "MULTIPLE_TAGS", "A node can have at most one tag"), o = e, i === null && (i = e.offset), a = !1, s = !1, f = !0;
        break;
      }
      case b:
        (n || o) && t(e, "BAD_PROP_ORDER", `Anchors and tags must be after the ${e.source} indicator`), h && t(e, "UNEXPECTED_TOKEN", `Unexpected ${e.source} in ${u ?? "collection"}`), h = e, a = !1, s = !1;
        break;
      case "comma":
        if (u) {
          m && t(e, "UNEXPECTED_TOKEN", `Unexpected , in ${u}`), m = e, a = !1, s = !1;
          break;
        }
      default:
        t(e, "UNEXPECTED_TOKEN", `Unexpected ${e.type} token`), a = !1, s = !1;
    }
  const d = p[p.length - 1], _ = d ? d.offset + d.source.length : y;
  return f && l && l.type !== "space" && l.type !== "newline" && l.type !== "comma" && (l.type !== "scalar" || l.source !== "") && t(l.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), {
    comma: m,
    found: h,
    spaceBefore: N,
    comment: c,
    hasNewline: T,
    hasNewlineAfterProp: S,
    anchor: n,
    tag: o,
    end: _,
    start: i ?? _
  };
}
export {
  k as resolveProps
};
