import {
  addGeneSearchbox,
  getGEunit
} from "./chunk-SA7APTJR.js";
import {
  Menu
} from "./chunk-HYOEWQ5P.js";
import {
  TermTypes
} from "./chunk-NOEAT6CX.js";

// termdb/handlers/geneExpression.ts
var SearchHandler = class {
  init(opts) {
    this.callback = opts.callback;
    this.app = opts.app;
    const holder = opts.holder.append("div").style("padding", "10px 0px");
    const geneSearch = addGeneSearchbox({
      tip: new Menu({ padding: "0px" }),
      genome: opts.genomeObj,
      row: holder,
      searchOnly: "gene",
      callback: () => this.selectGene(geneSearch.geneSymbol)
    });
  }
  async selectGene(gene) {
    const unit = getGEunit(this.app.vocabApi);
    const name = `${gene} ${unit}`;
    if (!gene) throw new Error("No gene selected");
    this.callback({ gene, name, type: TermTypes.GENE_EXPRESSION });
  }
};

export {
  SearchHandler
};
//# sourceMappingURL=chunk-5OUTR67M.js.map
