function toggleDropdown(dropdownId) {
  $(".dropdown-help")
    .not("#" + dropdownId)
    .removeClass("is-visible");
  setTimeout(function () {
    $(".dropdown-help")
      .not("#" + dropdownId)
      .css("display", "none");
  }, 200);

  const dropdownHelp = $("#" + dropdownId);
  if (dropdownHelp.hasClass("is-visible")) {
    event.preventDefault();
    dropdownHelp.removeClass("is-visible");
    setTimeout(function () {
      dropdownHelp.css("display", "none");
    }, 200);
  } else {
    event.preventDefault();
    dropdownHelp.css("display", "inline-flex");
    dropdownHelp.addClass("is-visible");
  }
}

$(document).on("click", function (event) {
  if ($(event.target).closest(".help-button").length) {
    return;
  } else {
    if (!$(event.target).closest(".dropdown-help").length) {
      $(".dropdown-help").removeClass("is-visible");
      setTimeout(function () {
        $(".dropdown-help").css("display", "none");
      }, 200);
    }
  }
});
