{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAKM,SAAS,yCAAc,KAAa;IACzC,IAAI,qBAAqB,OAAO,WAAW,eAAe,OAAO,OAAO,UAAU,KAAK;IACvF,IAAI,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,qBAAO,EAAE,IACnC,qBACI,OAAO,UAAU,CAAC,OAAO,OAAO,GAChC;IAGN,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,CAAC,oBACH;QAGF,IAAI,KAAK,OAAO,UAAU,CAAC;QAC3B,IAAI,WAAW,CAAC;YACd,WAAW,IAAI,OAAO;QACxB;QAEA,GAAG,WAAW,CAAC;QACf,OAAO;YACL,GAAG,cAAc,CAAC;QACpB;IACF,GAAG;QAAC;QAAoB;KAAM;IAE9B,yEAAyE;IACzE,wDAAwD;IACxD,IAAI,QAAQ,CAAA,GAAA,oCAAO;IACnB,OAAO,QAAQ,QAAQ;AACzB","sources":["packages/@adobe/react-spectrum/src/utils/useMediaQuery.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useEffect, useState} from 'react';\nimport {useIsSSR} from 'react-aria/SSRProvider';\n\nexport function useMediaQuery(query: string): boolean {\n  let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n  let [matches, setMatches] = useState(() =>\n    supportsMatchMedia\n      ? window.matchMedia(query).matches\n      : false\n  );\n\n  useEffect(() => {\n    if (!supportsMatchMedia) {\n      return;\n    }\n\n    let mq = window.matchMedia(query);\n    let onChange = (evt) => {\n      setMatches(evt.matches);\n    };\n\n    mq.addListener(onChange);\n    return () => {\n      mq.removeListener(onChange);\n    };\n  }, [supportsMatchMedia, query]);\n\n  // If in SSR, the media query should never match. Once the page hydrates,\n  // this will update and the real value will be returned.\n  let isSSR = useIsSSR();\n  return isSSR ? false : matches;\n}\n"],"names":[],"version":3,"file":"useMediaQuery.cjs.map"}