import { createDeleteButton } from "./../_shared/plugin-toolbar/create-delete-button.js";
import { createSettingsButton } from "./../_shared/plugin-toolbar/create-settings-button.js";
import { createSeparator } from "./../_shared/plugin-toolbar/separator/create-separator.js";
import { getCollapsibleListInSelection } from "./../_shared/resolvers/get-collapsible-list-in-selection.js";
import { FLOATING_PLUGIN_TOOLBAR } from "./../toolbars-v3/index.js";
import { COLLAPSIBLE_LIST_SETTINGS_MODAL_ID } from "./consts.js";
import { CollapsibleListSettingsModal } from "./modals/settings-modals.js";
const getToolbarButtons = (config, services) => {
  const typedConfig = config;
  const settingsButton = createSettingsButton({
    modalId: COLLAPSIBLE_LIST_SETTINGS_MODAL_ID,
    showLabel: true,
    attributes: {
      selectedNode: getCollapsibleListInSelection
    },
    command: ({ referenceElement, attributes: { selectedNode } }) => {
      services.modals.togglePluginPanel({
        id: COLLAPSIBLE_LIST_SETTINGS_MODAL_ID,
        Component: CollapsibleListSettingsModal,
        componentProps: {
          nodeId: selectedNode.attrs.id,
          isQapageDataEnabled: !!typedConfig?.isQapageData
        },
        isMobile: services.context.isMobile,
        positioning: {
          referenceElement: referenceElement?.closest(`[data-hook~=${FLOATING_PLUGIN_TOOLBAR}]`) ?? referenceElement,
          placement: "right-start"
        },
        focusReturnElement: referenceElement
      });
    }
  });
  const separator = createSeparator();
  const deleteButton = createDeleteButton({
    attributes: {
      selectedNode: getCollapsibleListInSelection
    }
  });
  if (services.context.environment === "wixel") {
    return [settingsButton, deleteButton];
  }
  return [settingsButton, separator, deleteButton];
};
export {
  getToolbarButtons
};
//# sourceMappingURL=get-toolbar-buttons.js.map
