((Drupal, once) => {
  Drupal.behaviors.SobkiAdminNavigationLayoutBuilder = {
    attach: (context) => {
      once('sa-lb-save', '.js-layout-builder-top-bar-save', context).forEach(
        (item) => {
          item.addEventListener('click', () => {
            document.querySelector('.js-layout-builder-save').click();
          });
        },
      );

      once(
        'sa-lb-discard',
        '.js-layout-builder-top-bar-discard',
        context,
      ).forEach((item) => {
        item.addEventListener('click', () => {
          document.querySelector('.js-layout-builder-discard').click();
        });
      });
    },
  };
})(Drupal, once);
