{"version":3,"file":"documentIosClick.mjs","sources":["../../../src/common/domHelpers/documentIosClick.ts"],"sourcesContent":["import { SyntheticEvent } from 'react';\n\nimport { isIosDevice } from '../deviceDetection';\n\n/*\n  This is a hack to make ios devices register `click` on document.\n\tIos document doesn't have `click`. It has `touch` and because of that we can't addEventListener('click') to document.\n\tSo 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.\n*/\n\nexport function addClickClassToDocumentOnIos() {\n  if (isIosDevice()) {\n    document.documentElement.classList.add('ios-click');\n  }\n}\n\nexport function removeClickClassFromDocumentOnIos() {\n  if (isIosDevice()) {\n    document.documentElement.classList.remove('ios-click');\n  }\n}\n\nexport function isServerSide(): boolean {\n  return typeof window === 'undefined';\n}\n\nexport function isBrowser(): boolean {\n  return !isServerSide();\n}\n\nexport function stopPropagation(event: SyntheticEvent) {\n  event.stopPropagation();\n  event.preventDefault();\n  if (event.nativeEvent && event.nativeEvent.stopImmediatePropagation) {\n    event.nativeEvent.stopImmediatePropagation();\n  }\n}\n"],"names":["addClickClassToDocumentOnIos","isIosDevice","document","documentElement","classList","add","removeClickClassFromDocumentOnIos","remove","isServerSide","window","isBrowser","stopPropagation","event","preventDefault","nativeEvent","stopImmediatePropagation"],"mappings":";;AAIA;;;;AAIE;SAEcA,4BAA4BA,GAAA;EAC1C,IAAIC,WAAW,EAAE,EAAE;IACjBC,QAAQ,CAACC,eAAe,CAACC,SAAS,CAACC,GAAG,CAAC,WAAW,CAAC;AACrD,EAAA;AACF;SAEgBC,iCAAiCA,GAAA;EAC/C,IAAIL,WAAW,EAAE,EAAE;IACjBC,QAAQ,CAACC,eAAe,CAACC,SAAS,CAACG,MAAM,CAAC,WAAW,CAAC;AACxD,EAAA;AACF;SAEgBC,YAAYA,GAAA;EAC1B,OAAO,OAAOC,MAAM,KAAK,WAAW;AACtC;SAEgBC,SAASA,GAAA;EACvB,OAAO,CAACF,YAAY,EAAE;AACxB;AAEM,SAAUG,eAAeA,CAACC,KAAqB,EAAA;EACnDA,KAAK,CAACD,eAAe,EAAE;EACvBC,KAAK,CAACC,cAAc,EAAE;EACtB,IAAID,KAAK,CAACE,WAAW,IAAIF,KAAK,CAACE,WAAW,CAACC,wBAAwB,EAAE;AACnEH,IAAAA,KAAK,CAACE,WAAW,CAACC,wBAAwB,EAAE;AAC9C,EAAA;AACF;;;;"}