import{eY as m,ep as h,r as l,cU as y,fd as g}from"./index-aa586041.js";function Q(n,r,e,s,c){const[t,d]=l.useState(()=>c&&e?e(n).matches:s?s(n).matches:r);return y(()=>{if(!e)return;const o=e(n),a=()=>{d(o.matches)};return a(),o.addEventListener("change",a),()=>{o.removeEventListener("change",a)}},[n,e]),t}const v={...g},f=v.useSyncExternalStore;function E(n,r,e,s,c){const t=l.useCallback(()=>r,[r]),d=l.useMemo(()=>{if(c&&e)return()=>e(n).matches;if(s!==null){const{matches:i}=s(n);return()=>i}return t},[t,n,s,c,e]),[o,a]=l.useMemo(()=>{if(e===null)return[t,()=>()=>{}];const i=e(n);return[()=>i.matches,u=>(i.addEventListener("change",u),()=>{i.removeEventListener("change",u)})]},[t,e,n]);return f(a,o,d)}function S(n={}){const{themeId:r}=n;return function(s,c={}){let t=m();t&&r&&(t=t[r]||t);const d=typeof window<"u"&&typeof window.matchMedia<"u",{defaultMatches:o=!1,matchMedia:a=d?window.matchMedia:null,ssrMatchMedia:p=null,noSsr:i=!1}=h({name:"MuiUseMediaQuery",props:c,theme:t});let u=typeof s=="function"?s(t):s;return u=u.replace(/^@media( ?)/m,""),u.includes("print")&&console.warn(["MUI: You have provided a `print` query to the `useMediaQuery` hook.","Using the print media query to modify print styles can lead to unexpected results.","Consider using the `displayPrint` field in the `sx` prop instead.","More information about `displayPrint` on our docs: https://mui.com/system/display/#display-in-print."].join(`
`)),(f!==void 0?E:Q)(u,o,a,p,i)}}const x=S();export{S as a,x as u};
