import {
  selectAll_default
} from "./chunk-I6Y4O3RR.js";

// dom/uiUtils.js
function isURL(path) {
  const checkpath = path.toLowerCase();
  if (checkpath.startsWith("https://") || checkpath.startsWith("http://") || checkpath.startsWith("ftp://")) return true;
}
function makeGenomeDropDown(div, genomes) {
  const g_row = div.append("div");
  const select = g_row.append("select").style("border-radius", "5px").style("padding", "5px 10px").style("margin", "1px 20px 1px 10px");
  for (const n in genomes) {
    select.append("option").text(n);
  }
  return select;
}
function makeTextInput(div, placeholder, size) {
  const text = div.append("input").attr("type", "text").attr("size", size || 50).style("border-radius", "5px").style("padding", "5px 20px").style("margin", "1px 20px 1px 10px");
  if (placeholder) {
    text.attr("placeholder", placeholder);
  }
  return text;
}
function makeTextAreaInput(args) {
  const textarea = args.div.append("textarea").attr("rows", args.rows || "5").attr("cols", args.cols || "70").style("border-radius", "5px").attr("placeholder", args.placeholder || "");
  return textarea;
}
function makeFileUpload(div) {
  const upload = div.append("input").attr("type", "file").property("position", "relative").style("margin", "1px 20px 1px 10px").style("justify-content", "left");
  return upload;
}
function makeBtn(args) {
  const btn = args.div.append("button").html(args.text).style("color", args.color || "black").style("background-color", args.backgroundColor || "#F2F2F2").style("border", args.border || "2px solid #999").style("padding", args.padding || "5px 10px").style("cursor", "pointer");
  return btn;
}
function makePrompt(div, text) {
  const prompt = div.append("div").style("display", "inline-block").style("margin", "15px").style("place-items", "center left").html(text);
  return prompt;
}
function makeResetBtn(div, obj, selector) {
  const reset = makeBtn({
    div,
    text: "&#8634;",
    backgroundColor: "white",
    color: "grey",
    padding: "0px 6px 1px 6px"
  });
  reset.style("font-size", "1.5em").style("display", "inline-block").attr("type", "reset").on("click", async () => {
    selectAll_default(selector).property("value", "");
    if (obj.data) {
      obj.data = typeof obj.data == "string" ? "" : Array.isArray(obj.data) ? [] : {};
    }
  });
  return reset;
}

export {
  isURL,
  makeGenomeDropDown,
  makeTextInput,
  makeTextAreaInput,
  makeFileUpload,
  makeBtn,
  makePrompt,
  makeResetBtn
};
//# sourceMappingURL=chunk-5EBRF6Z7.js.map
