import { isIosDevice } from '../deviceDetection/deviceDetection.mjs';

/*
  This is a hack to make ios devices register `click` on document.
    Ios document doesn't have `click`. It has `touch` and because of that we can't addEventListener('click') to document.
    So we add `ios-click` class to html root element and in css we add {cursor: pointer} so ios devices know that document is clickable element.
*/
function addClickClassToDocumentOnIos() {
  if (isIosDevice()) {
    document.documentElement.classList.add('ios-click');
  }
}
function removeClickClassFromDocumentOnIos() {
  if (isIosDevice()) {
    document.documentElement.classList.remove('ios-click');
  }
}
function isServerSide() {
  return typeof window === 'undefined';
}
function isBrowser() {
  return !isServerSide();
}
function stopPropagation(event) {
  event.stopPropagation();
  event.preventDefault();
  if (event.nativeEvent && event.nativeEvent.stopImmediatePropagation) {
    event.nativeEvent.stopImmediatePropagation();
  }
}

export { addClickClassToDocumentOnIos, isBrowser, isServerSide, removeClickClassFromDocumentOnIos, stopPropagation };
//# sourceMappingURL=documentIosClick.mjs.map
