import { C as d } from "./codemirror.es-CVgHrv2u.js";
import "./show-hint.es-Bf9rucUA.js";
import { g as getAutocompleteSuggestions } from "./index-B10SxoeJ.js";
import { P as Position } from "./Range-BloAiAiu.js";
import "./codemirror.es2-DH2syXui.js";
d.registerHelper("hint", "graphql", (n, c) => {
  const { schema: i, externalFragments: p, autocompleteOptions: u } = c;
  if (!i)
    return;
  const s = n.getCursor(), o = n.getTokenAt(s), a = o.type !== null && /"|\w/.test(o.string[0]) ? o.start : o.end, g = new Position(s.line, a), t = {
    list: getAutocompleteSuggestions(i, n.getValue(), g, o, p, u).map((e) => {
      var l;
      return {
        text: (l = e == null ? void 0 : e.rawInsert) !== null && l !== void 0 ? l : e.label,
        type: e.type,
        description: e.documentation,
        isDeprecated: e.isDeprecated,
        deprecationReason: e.deprecationReason
      };
    }),
    from: { line: s.line, ch: a },
    to: { line: s.line, ch: o.end }
  };
  return t != null && t.list && t.list.length > 0 && (t.from = d.Pos(t.from.line, t.from.ch), t.to = d.Pos(t.to.line, t.to.ch), d.signal(n, "hasCompletion", n, t, o)), t;
});
//# sourceMappingURL=hint.es-Cu3uBY44.js.map
