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