import { isPair as l, isScalar as d } from "./accelbyte-widgets711.mjs";
import { toJS as p } from "./accelbyte-widgets716.mjs";
import { YAMLMap as n } from "./accelbyte-widgets729.mjs";
import { YAMLSeq as f } from "./accelbyte-widgets731.mjs";
import { createPairs as u, resolvePairs as h } from "./accelbyte-widgets749.mjs";
class r extends f {
  constructor() {
    super(), this.add = n.prototype.add.bind(this), this.delete = n.prototype.delete.bind(this), this.get = n.prototype.get.bind(this), this.has = n.prototype.has.bind(this), this.set = n.prototype.set.bind(this), this.tag = r.tag;
  }
  toJSON(o, e) {
    if (!e)
      return super.toJSON(o);
    const s = /* @__PURE__ */ new Map();
    e != null && e.onCreate && e.onCreate(s);
    for (const t of this.items) {
      let i, m;
      if (l(t) ? (i = p(t.key, "", e), m = p(t.value, i, e)) : i = p(t, "", e), s.has(i))
        throw new Error("Ordered maps must not include duplicate keys");
      s.set(i, m);
    }
    return s;
  }
  static from(o, e, s) {
    const t = u(o, e, s), i = new this();
    return i.items = t.items, i;
  }
}
r.tag = "tag:yaml.org,2002:omap";
const k = {
  collection: "seq",
  identify: (a) => a instanceof Map,
  nodeClass: r,
  default: !1,
  tag: "tag:yaml.org,2002:omap",
  resolve(a, o) {
    const e = h(a, o), s = [];
    for (const { key: t } of e.items)
      d(t) && (s.includes(t.value) ? o(`Ordered maps must not include duplicate keys: ${t.value}`) : s.push(t.value));
    return Object.assign(new r(), e);
  },
  createNode: (a, o, e) => r.from(a, o, e)
};
export {
  r as YAMLOMap,
  k as omap
};
