var D = Object.defineProperty;
var m = (r, e) => D(r, "name", { value: e, configurable: !0 });
import { GraphQLNonNull as u, GraphQLList as f } from "graphql";
import { C as E } from "./codemirror.es.js";
import { g as N, a as T, b as g, c as h, d as C, e as p } from "./SchemaReference.es.js";
import "./info-addon.es.js";
import "./codemirror.es2.js";
import "./forEachState.es.js";
E.registerHelper("info", "graphql", (r, e) => {
  var d;
  if (!e.schema || !r.state)
    return;
  const { kind: n, step: a } = r.state, i = N(e.schema, r.state);
  if (n === "Field" && a === 0 && i.fieldDef || n === "AliasedField" && a === 2 && i.fieldDef || n === "ObjectField" && a === 0 && i.fieldDef) {
    const c = document.createElement("div");
    c.className = "CodeMirror-info-header", M(c, i, e);
    const t = document.createElement("div");
    return t.append(c), s(t, e, i.fieldDef), t;
  }
  if (n === "Directive" && a === 1 && i.directiveDef) {
    const c = document.createElement("div");
    c.className = "CodeMirror-info-header", x(c, i, e);
    const t = document.createElement("div");
    return t.append(c), s(t, e, i.directiveDef), t;
  }
  if (n === "Argument" && a === 0 && i.argDef) {
    const c = document.createElement("div");
    c.className = "CodeMirror-info-header", F(c, i, e);
    const t = document.createElement("div");
    return t.append(c), s(t, e, i.argDef), t;
  }
  if (n === "EnumValue" && (!((d = i.enumValue) === null || d === void 0) && d.description)) {
    const c = document.createElement("div");
    c.className = "CodeMirror-info-header", L(c, i, e);
    const t = document.createElement("div");
    return t.append(c), s(t, e, i.enumValue), t;
  }
  if (n === "NamedType" && i.type && i.type.description) {
    const c = document.createElement("div");
    c.className = "CodeMirror-info-header", o(c, i, e, i.type);
    const t = document.createElement("div");
    return t.append(c), s(t, e, i.type), t;
  }
});
function M(r, e, d) {
  y(r, e, d), v(r, e, d, e.type);
}
m(M, "renderField");
function y(r, e, d) {
  var n;
  const a = ((n = e.fieldDef) === null || n === void 0 ? void 0 : n.name) || "";
  l(r, a, "field-name", d, T(e));
}
m(y, "renderQualifiedField");
function x(r, e, d) {
  var n;
  const a = "@" + (((n = e.directiveDef) === null || n === void 0 ? void 0 : n.name) || "");
  l(r, a, "directive-name", d, g(e));
}
m(x, "renderDirective");
function F(r, e, d) {
  var n;
  const a = ((n = e.argDef) === null || n === void 0 ? void 0 : n.name) || "";
  l(r, a, "arg-name", d, h(e)), v(r, e, d, e.inputType);
}
m(F, "renderArg");
function L(r, e, d) {
  var n;
  const a = ((n = e.enumValue) === null || n === void 0 ? void 0 : n.name) || "";
  o(r, e, d, e.inputType), l(r, "."), l(r, a, "enum-value", d, C(e));
}
m(L, "renderEnumValue");
function v(r, e, d, n) {
  const a = document.createElement("span");
  a.className = "type-name-pill", n instanceof u ? (o(a, e, d, n.ofType), l(a, "!")) : n instanceof f ? (l(a, "["), o(a, e, d, n.ofType), l(a, "]")) : l(a, (n == null ? void 0 : n.name) || "", "type-name", d, p(e, n)), r.append(a);
}
m(v, "renderTypeAnnotation");
function o(r, e, d, n) {
  n instanceof u ? (o(r, e, d, n.ofType), l(r, "!")) : n instanceof f ? (l(r, "["), o(r, e, d, n.ofType), l(r, "]")) : l(r, (n == null ? void 0 : n.name) || "", "type-name", d, p(e, n));
}
m(o, "renderType");
function s(r, e, d) {
  const { description: n } = d;
  if (n) {
    const a = document.createElement("div");
    a.className = "info-description", e.renderDescription ? a.innerHTML = e.renderDescription(n) : a.append(document.createTextNode(n)), r.append(a);
  }
  R(r, e, d);
}
m(s, "renderDescription");
function R(r, e, d) {
  const n = d.deprecationReason;
  if (n) {
    const a = document.createElement("div");
    a.className = "info-deprecation", r.append(a);
    const i = document.createElement("span");
    i.className = "info-deprecation-label", i.append(document.createTextNode("Deprecated")), a.append(i);
    const c = document.createElement("div");
    c.className = "info-deprecation-reason", e.renderDescription ? c.innerHTML = e.renderDescription(n) : c.append(document.createTextNode(n)), a.append(c);
  }
}
m(R, "renderDeprecation");
function l(r, e, d = "", n = { onClick: null }, a = null) {
  if (d) {
    const { onClick: i } = n;
    let c;
    i ? (c = document.createElement("a"), c.href = "javascript:void 0", c.addEventListener("click", (t) => {
      t.preventDefault(), i(a, t);
    })) : c = document.createElement("span"), c.className = d, c.append(document.createTextNode(e)), r.append(c);
  } else
    r.append(document.createTextNode(e));
}
m(l, "text");
//# sourceMappingURL=info.es.js.map
