import { stream as r } from "../utils/stream.js";
class a {
  constructor(e, s, t) {
    var n;
    this.elements = e, this.outerScope = s, this.caseInsensitive = (n = t == null ? void 0 : t.caseInsensitive) !== null && n !== void 0 ? n : !1;
  }
  getAllElements() {
    return this.outerScope ? this.elements.concat(this.outerScope.getAllElements()) : this.elements;
  }
  getElement(e) {
    const s = this.caseInsensitive ? this.elements.find((t) => t.name.toLowerCase() === e.toLowerCase()) : this.elements.find((t) => t.name === e);
    if (s)
      return s;
    if (this.outerScope)
      return this.outerScope.getElement(e);
  }
}
class u {
  constructor(e, s, t) {
    var n;
    this.elements = /* @__PURE__ */ new Map(), this.caseInsensitive = (n = t == null ? void 0 : t.caseInsensitive) !== null && n !== void 0 ? n : !1;
    for (const i of e) {
      const o = this.caseInsensitive ? i.name.toLowerCase() : i.name;
      this.elements.set(o, i);
    }
    this.outerScope = s;
  }
  getElement(e) {
    const s = this.caseInsensitive ? e.toLowerCase() : e, t = this.elements.get(s);
    if (t)
      return t;
    if (this.outerScope)
      return this.outerScope.getElement(e);
  }
  getAllElements() {
    let e = r(this.elements.values());
    return this.outerScope && (e = e.concat(this.outerScope.getAllElements())), e;
  }
}
export {
  u as MapScope,
  a as StreamScope
};
