var l = Object.defineProperty;
var a = (e, r) => l(e, "name", { value: r, configurable: !0 });
import { EditorView as c } from "../../../../../../@codemirror_view@6.36.4/node_modules/@codemirror/view/dist/index.js";
import { tsFacetWorker as f } from "../facet/tsFacetWorker.js";
function s(e, r, o) {
  const t = r?.typeDef?.at(0);
  if (t && e === t.fileName) {
    const n = o.state.update({
      selection: {
        anchor: t.textSpan.start,
        head: t.textSpan.start + t.textSpan.length
      }
    });
    return o.dispatch(n), !0;
  }
}
a(s, "defaultGotoHandler");
function g(e = { gotoHandler: s }) {
  return c.domEventHandlers({
    click: /* @__PURE__ */ a((r, o) => {
      const t = o.state.facet(f);
      if (!t?.worker || !e.gotoHandler || !(r.metaKey || r.ctrlKey))
        return !1;
      const n = o.posAtCoords({
        x: r.clientX,
        y: r.clientY
      });
      if (n !== null)
        return t.worker.getHover({
          path: t.path,
          pos: n
        }).then((i) => {
          i && e.gotoHandler && e.gotoHandler(t.path, i, o);
        }), !0;
    }, "click")
  });
}
a(g, "tsGotoWorker");
export {
  s as defaultGotoHandler,
  g as tsGotoWorker
};
