$(document).ready(function() {
   const userAgent = navigator.userAgent || navigator.vendor || window.opera;

   const isMac = /Macintosh|Mac OS X/.test(userAgent);
   const isWindows = /Windows/.test(userAgent);
   const isLinux = /Linux/.test(userAgent) && !/Android/.test(userAgent);
   const isSafari = /Safari/.test(userAgent) && !/Chrome/.test(userAgent);
   const isAndroid = /android/i.test(userAgent);

   if (window.ApplePaySession || (isMac && isSafari)) {
      $('#pay4-APPLE_PAY').closest('.payment-item').addClass('move-first');
   }  else if ((isMac && !isSafari) || isWindows || isLinux || isAndroid) {
      $('#pay4-GPAY').closest('.payment-item').addClass('move-first');
   }
});
