{"ast":null,"code":"import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';\nvar focusVisibleAttributeName = 'data-focusvisible-polyfill';\nvar rule = \":focus:not([\" + focusVisibleAttributeName + \"]){outline: none;}\";\n\nvar modality = function modality(insertRule) {\n  insertRule(rule);\n\n  if (!canUseDOM) {\n    return;\n  }\n\n  var hadKeyboardEvent = true;\n  var hadFocusVisibleRecently = false;\n  var hadFocusVisibleRecentlyTimeout = null;\n  var inputTypesWhitelist = {\n    text: true,\n    search: true,\n    url: true,\n    tel: true,\n    email: true,\n    password: true,\n    number: true,\n    date: true,\n    month: true,\n    week: true,\n    time: true,\n    datetime: true,\n    'datetime-local': true\n  };\n\n  function isValidFocusTarget(el) {\n    if (el && el !== document && el.nodeName !== 'HTML' && el.nodeName !== 'BODY' && 'classList' in el && 'contains' in el.classList) {\n      return true;\n    }\n\n    return false;\n  }\n\n  function focusTriggersKeyboardModality(el) {\n    var type = el.type;\n    var tagName = el.tagName;\n    var isReadOnly = el.readOnly;\n\n    if (tagName === 'INPUT' && inputTypesWhitelist[type] && !isReadOnly) {\n      return true;\n    }\n\n    if (tagName === 'TEXTAREA' && !isReadOnly) {\n      return true;\n    }\n\n    if (el.isContentEditable) {\n      return true;\n    }\n\n    return false;\n  }\n\n  function addFocusVisibleAttribute(el) {\n    if (el.hasAttribute(focusVisibleAttributeName)) {\n      return;\n    }\n\n    el.setAttribute(focusVisibleAttributeName, true);\n  }\n\n  function removeFocusVisibleAttribute(el) {\n    el.removeAttribute(focusVisibleAttributeName);\n  }\n\n  function removeAllFocusVisibleAttributes() {\n    var list = document.querySelectorAll(\"[\" + focusVisibleAttributeName + \"]\");\n\n    for (var i = 0; i < list.length; i += 1) {\n      removeFocusVisibleAttribute(list[i]);\n    }\n  }\n\n  function onKeyDown(e) {\n    if (e.key !== 'Tab' && (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)) {\n      return;\n    }\n\n    if (isValidFocusTarget(document.activeElement)) {\n      addFocusVisibleAttribute(document.activeElement);\n    }\n\n    hadKeyboardEvent = true;\n  }\n\n  function onPointerDown(e) {\n    if (hadKeyboardEvent === true) {\n      removeAllFocusVisibleAttributes();\n    }\n\n    hadKeyboardEvent = false;\n  }\n\n  function onFocus(e) {\n    if (!isValidFocusTarget(e.target)) {\n      return;\n    }\n\n    if (hadKeyboardEvent || focusTriggersKeyboardModality(e.target)) {\n      addFocusVisibleAttribute(e.target);\n    }\n  }\n\n  function onBlur(e) {\n    if (!isValidFocusTarget(e.target)) {\n      return;\n    }\n\n    if (e.target.hasAttribute(focusVisibleAttributeName)) {\n      hadFocusVisibleRecently = true;\n      window.clearTimeout(hadFocusVisibleRecentlyTimeout);\n      hadFocusVisibleRecentlyTimeout = window.setTimeout(function () {\n        hadFocusVisibleRecently = false;\n        window.clearTimeout(hadFocusVisibleRecentlyTimeout);\n      }, 100);\n      removeFocusVisibleAttribute(e.target);\n    }\n  }\n\n  function onVisibilityChange(e) {\n    if (document.visibilityState === 'hidden') {\n      if (hadFocusVisibleRecently) {\n        hadKeyboardEvent = true;\n      }\n\n      addInitialPointerMoveListeners();\n    }\n  }\n\n  function addInitialPointerMoveListeners() {\n    document.addEventListener('mousemove', onInitialPointerMove);\n    document.addEventListener('mousedown', onInitialPointerMove);\n    document.addEventListener('mouseup', onInitialPointerMove);\n    document.addEventListener('pointermove', onInitialPointerMove);\n    document.addEventListener('pointerdown', onInitialPointerMove);\n    document.addEventListener('pointerup', onInitialPointerMove);\n    document.addEventListener('touchmove', onInitialPointerMove);\n    document.addEventListener('touchstart', onInitialPointerMove);\n    document.addEventListener('touchend', onInitialPointerMove);\n  }\n\n  function removeInitialPointerMoveListeners() {\n    document.removeEventListener('mousemove', onInitialPointerMove);\n    document.removeEventListener('mousedown', onInitialPointerMove);\n    document.removeEventListener('mouseup', onInitialPointerMove);\n    document.removeEventListener('pointermove', onInitialPointerMove);\n    document.removeEventListener('pointerdown', onInitialPointerMove);\n    document.removeEventListener('pointerup', onInitialPointerMove);\n    document.removeEventListener('touchmove', onInitialPointerMove);\n    document.removeEventListener('touchstart', onInitialPointerMove);\n    document.removeEventListener('touchend', onInitialPointerMove);\n  }\n\n  function onInitialPointerMove(e) {\n    if (e.target.nodeName === 'HTML') {\n      return;\n    }\n\n    hadKeyboardEvent = false;\n    removeInitialPointerMoveListeners();\n  }\n\n  document.addEventListener('keydown', onKeyDown, true);\n  document.addEventListener('mousedown', onPointerDown, true);\n  document.addEventListener('pointerdown', onPointerDown, true);\n  document.addEventListener('touchstart', onPointerDown, true);\n  document.addEventListener('focus', onFocus, true);\n  document.addEventListener('blur', onBlur, true);\n  document.addEventListener('visibilitychange', onVisibilityChange, true);\n  addInitialPointerMoveListeners();\n};\n\nexport default modality;","map":{"version":3,"sources":["/Users/nishan/Desktop/oss/responsive-breakpoints/example/node_modules/react-native-web/dist/exports/StyleSheet/modality.js"],"names":["canUseDOM","focusVisibleAttributeName","rule","modality","insertRule","hadKeyboardEvent","hadFocusVisibleRecently","hadFocusVisibleRecentlyTimeout","inputTypesWhitelist","text","search","url","tel","email","password","number","date","month","week","time","datetime","isValidFocusTarget","el","document","nodeName","classList","focusTriggersKeyboardModality","type","tagName","isReadOnly","readOnly","isContentEditable","addFocusVisibleAttribute","hasAttribute","setAttribute","removeFocusVisibleAttribute","removeAttribute","removeAllFocusVisibleAttributes","list","querySelectorAll","i","length","onKeyDown","e","key","metaKey","altKey","ctrlKey","shiftKey","activeElement","onPointerDown","onFocus","target","onBlur","window","clearTimeout","setTimeout","onVisibilityChange","visibilityState","addInitialPointerMoveListeners","addEventListener","onInitialPointerMove","removeInitialPointerMoveListeners","removeEventListener"],"mappings":"AAmBA,SAASA,SAAT,QAA0B,+BAA1B;AACA,IAAIC,yBAAyB,GAAG,4BAAhC;AACA,IAAIC,IAAI,GAAG,iBAAiBD,yBAAjB,GAA6C,oBAAxD;;AAEA,IAAIE,QAAQ,GAAG,SAASA,QAAT,CAAkBC,UAAlB,EAA8B;AAC3CA,EAAAA,UAAU,CAACF,IA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AAEDnB,IAAAA,gBAAgB,GAAG,KAAnB;AACAyD,IAAAA,iCAAiC;AAClC;;AAEDvC,EAAAA,QAAQ,CAACqC,gBAAT,CAA0B,SAA1B,EAAqClB,SAArC,EAAgD,IAAhD;AACAnB,EAAAA,QAAQ,CAACqC,gBAAT,CAA0B,WAA1B,EAAuCV,aAAvC,EAAsD,IAAtD;AACA3B,EAAAA,QAAQ,CAACqC,gBAAT,CAA0B,aAA1B,EAAyCV,aAAzC,EAAwD,IAAxD;AACA3B,EAAAA,QAAQ,CAACqC,gBAAT,CAA0B,YAA1B,EAAwCV,aAAxC,EAAuD,IAAvD;AACA3B,EAAAA,QAAQ,CAACqC,gBAAT,CAA0B,OAA1B,EAAmCT,OAAnC,EAA4C,IAA5C;AACA5B,EAAAA,QAAQ,CAACqC,gBAAT,CAA0B,MAA1B,EAAkCP,MAAlC,EAA0C,IAA1C;AACA9B,EAAAA,QAAQ,CAACqC,gBAAT,CAA0B,kBAA1B,EAA8CH,kBAA9C,EAAkE,IAAlE;AACAE,EAAAA,8BAA8B;AAC/B,CA9PD;;AAgQA,eAAexD,QAAf","sourcesContent":["/**\n * Adapts focus styles based on the user's active input modality (i.e., how\n * they are interacting with the UI right now).\n *\n * Focus styles are only relevant when using the keyboard to interact with the\n * page. If we only show the focus ring when relevant, we can avoid user\n * confusion without compromising accessibility.\n *\n * The script uses two heuristics to determine whether the keyboard is being used:\n *\n * 1. a keydown event occurred immediately before a focus event;\n * 2. a focus event happened on an element which requires keyboard interaction (e.g., a text field);\n *\n * This software or document includes material copied from or derived from https://github.com/WICG/focus-visible.\n * Copyright © 2018 W3C® (MIT, ERCIM, Keio, Beihang).\n * W3C Software Notice and License: https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n *\n * \n */\nimport { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';\nvar focusVisibleAttributeName = 'data-focusvisible-polyfill';\nvar rule = \":focus:not([\" + focusVisibleAttributeName + \"]){outline: none;}\";\n\nvar modality = function modality(insertRule) {\n  insertRule(rule);\n\n  if (!canUseDOM) {\n    return;\n  }\n\n  var hadKeyboardEvent = true;\n  var hadFocusVisibleRecently = false;\n  var hadFocusVisibleRecentlyTimeout = null;\n  var inputTypesWhitelist = {\n    text: true,\n    search: true,\n    url: true,\n    tel: true,\n    email: true,\n    password: true,\n    number: true,\n    date: true,\n    month: true,\n    week: true,\n    time: true,\n    datetime: true,\n    'datetime-local': true\n  };\n  /**\n   * Helper function for legacy browsers and iframes which sometimes focus\n   * elements like document, body, and non-interactive SVG.\n   */\n\n  function isValidFocusTarget(el) {\n    if (el && el !== document && el.nodeName !== 'HTML' && el.nodeName !== 'BODY' && 'classList' in el && 'contains' in el.classList) {\n      return true;\n    }\n\n    return false;\n  }\n  /**\n   * Computes whether the given element should automatically trigger the\n   * `focus-visible` attribute being added, i.e. whether it should always match\n   * `:focus-visible` when focused.\n   */\n\n\n  function focusTriggersKeyboardModality(el) {\n    var type = el.type;\n    var tagName = el.tagName;\n    var isReadOnly = el.readOnly;\n\n    if (tagName === 'INPUT' && inputTypesWhitelist[type] && !isReadOnly) {\n      return true;\n    }\n\n    if (tagName === 'TEXTAREA' && !isReadOnly) {\n      return true;\n    }\n\n    if (el.isContentEditable) {\n      return true;\n    }\n\n    return false;\n  }\n  /**\n   * Add the `focus-visible` attribute to the given element if it was not added by\n   * the author.\n   */\n\n\n  function addFocusVisibleAttribute(el) {\n    if (el.hasAttribute(focusVisibleAttributeName)) {\n      return;\n    }\n\n    el.setAttribute(focusVisibleAttributeName, true);\n  }\n  /**\n   * Remove the `focus-visible` attribute from the given element if it was not\n   * originally added by the author.\n   */\n\n\n  function removeFocusVisibleAttribute(el) {\n    el.removeAttribute(focusVisibleAttributeName);\n  }\n  /**\n   * Remove the `focus-visible` attribute from all elements in the document.\n   */\n\n\n  function removeAllFocusVisibleAttributes() {\n    var list = document.querySelectorAll(\"[\" + focusVisibleAttributeName + \"]\");\n\n    for (var i = 0; i < list.length; i += 1) {\n      removeFocusVisibleAttribute(list[i]);\n    }\n  }\n  /**\n   * Treat `keydown` as a signal that the user is in keyboard modality.\n   * Apply `focus-visible` to any current active element and keep track\n   * of our keyboard modality state with `hadKeyboardEvent`.\n   */\n\n\n  function onKeyDown(e) {\n    if (e.key !== 'Tab' && (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)) {\n      return;\n    }\n\n    if (isValidFocusTarget(document.activeElement)) {\n      addFocusVisibleAttribute(document.activeElement);\n    }\n\n    hadKeyboardEvent = true;\n  }\n  /**\n   * If at any point a user clicks with a pointing device, ensure that we change\n   * the modality away from keyboard.\n   * This avoids the situation where a user presses a key on an already focused\n   * element, and then clicks on a different element, focusing it with a\n   * pointing device, while we still think we're in keyboard modality.\n   * It also avoids the situation where a user presses on an element within a\n   * previously keyboard-focused element (i.e., `e.target` is not the previously\n   * focused element, but one of its descendants) and we need to remove the\n   * focus ring because a `blur` event doesn't occur.\n   */\n\n\n  function onPointerDown(e) {\n    if (hadKeyboardEvent === true) {\n      removeAllFocusVisibleAttributes();\n    }\n\n    hadKeyboardEvent = false;\n  }\n  /**\n   * On `focus`, add the `focus-visible` attribute to the target if:\n   * - the target received focus as a result of keyboard navigation, or\n   * - the event target is an element that will likely require interaction\n   *   via the keyboard (e.g. a text box)\n   */\n\n\n  function onFocus(e) {\n    // Prevent IE from focusing the document or HTML element.\n    if (!isValidFocusTarget(e.target)) {\n      return;\n    }\n\n    if (hadKeyboardEvent || focusTriggersKeyboardModality(e.target)) {\n      addFocusVisibleAttribute(e.target);\n    }\n  }\n  /**\n   * On `blur`, remove the `focus-visible` attribute from the target.\n   */\n\n\n  function onBlur(e) {\n    if (!isValidFocusTarget(e.target)) {\n      return;\n    }\n\n    if (e.target.hasAttribute(focusVisibleAttributeName)) {\n      // To detect a tab/window switch, we look for a blur event followed\n      // rapidly by a visibility change.\n      // If we don't see a visibility change within 100ms, it's probably a\n      // regular focus change.\n      hadFocusVisibleRecently = true;\n      window.clearTimeout(hadFocusVisibleRecentlyTimeout);\n      hadFocusVisibleRecentlyTimeout = window.setTimeout(function () {\n        hadFocusVisibleRecently = false;\n        window.clearTimeout(hadFocusVisibleRecentlyTimeout);\n      }, 100);\n      removeFocusVisibleAttribute(e.target);\n    }\n  }\n  /**\n   * If the user changes tabs, keep track of whether or not the previously\n   * focused element had the focus-visible attribute.\n   */\n\n\n  function onVisibilityChange(e) {\n    if (document.visibilityState === 'hidden') {\n      // If the tab becomes active again, the browser will handle calling focus\n      // on the element (Safari actually calls it twice).\n      // If this tab change caused a blur on an element with focus-visible,\n      // re-apply the attribute when the user switches back to the tab.\n      if (hadFocusVisibleRecently) {\n        hadKeyboardEvent = true;\n      }\n\n      addInitialPointerMoveListeners();\n    }\n  }\n  /**\n   * Add a group of listeners to detect usage of any pointing devices.\n   * These listeners will be added when the polyfill first loads, and anytime\n   * the window is blurred, so that they are active when the window regains\n   * focus.\n   */\n\n\n  function addInitialPointerMoveListeners() {\n    document.addEventListener('mousemove', onInitialPointerMove);\n    document.addEventListener('mousedown', onInitialPointerMove);\n    document.addEventListener('mouseup', onInitialPointerMove);\n    document.addEventListener('pointermove', onInitialPointerMove);\n    document.addEventListener('pointerdown', onInitialPointerMove);\n    document.addEventListener('pointerup', onInitialPointerMove);\n    document.addEventListener('touchmove', onInitialPointerMove);\n    document.addEventListener('touchstart', onInitialPointerMove);\n    document.addEventListener('touchend', onInitialPointerMove);\n  }\n\n  function removeInitialPointerMoveListeners() {\n    document.removeEventListener('mousemove', onInitialPointerMove);\n    document.removeEventListener('mousedown', onInitialPointerMove);\n    document.removeEventListener('mouseup', onInitialPointerMove);\n    document.removeEventListener('pointermove', onInitialPointerMove);\n    document.removeEventListener('pointerdown', onInitialPointerMove);\n    document.removeEventListener('pointerup', onInitialPointerMove);\n    document.removeEventListener('touchmove', onInitialPointerMove);\n    document.removeEventListener('touchstart', onInitialPointerMove);\n    document.removeEventListener('touchend', onInitialPointerMove);\n  }\n  /**\n   * When the polfyill first loads, assume the user is in keyboard modality.\n   * If any event is received from a pointing device (e.g. mouse, pointer,\n   * touch), turn off keyboard modality.\n   * This accounts for situations where focus enters the page from the URL bar.\n   */\n\n\n  function onInitialPointerMove(e) {\n    // Work around a Safari quirk that fires a mousemove on <html> whenever the\n    // window blurs, even if you're tabbing out of the page. ¯\\_(ツ)_/¯\n    if (e.target.nodeName === 'HTML') {\n      return;\n    }\n\n    hadKeyboardEvent = false;\n    removeInitialPointerMoveListeners();\n  }\n\n  document.addEventListener('keydown', onKeyDown, true);\n  document.addEventListener('mousedown', onPointerDown, true);\n  document.addEventListener('pointerdown', onPointerDown, true);\n  document.addEventListener('touchstart', onPointerDown, true);\n  document.addEventListener('focus', onFocus, true);\n  document.addEventListener('blur', onBlur, true);\n  document.addEventListener('visibilitychange', onVisibilityChange, true);\n  addInitialPointerMoveListeners();\n};\n\nexport default modality;"]},"metadata":{},"sourceType":"module"}