import{dF as h,dG as p,r as f,cV as E,d0 as S}from"./index-0698dbe6.js";function g(t,a,e,s,c){const[r,i]=f.useState(()=>c&&e?e(t).matches:s?s(t).matches:a);return E(()=>{if(!e)return;const o=e(t),n=()=>{i(o.matches)};return n(),o.addEventListener("change",n),()=>{o.removeEventListener("change",n)}},[t,e]),r}const v={...S},d=v.useSyncExternalStore;function w(t,a,e,s,c){const r=f.useCallback(()=>a,[a]),i=f.useMemo(()=>{if(c&&e)return()=>e(t).matches;if(s!==null){const{matches:u}=s(t);return()=>u}return r},[r,t,s,c,e]),[o,n]=f.useMemo(()=>{if(e===null)return[r,()=>()=>{}];const u=e(t);return[()=>u.matches,m=>(u.addEventListener("change",m),()=>{u.removeEventListener("change",m)})]},[r,e,t]);return d(n,o,i)}function L(t,a={}){const e=h(),s=typeof window<"u"&&typeof window.matchMedia<"u",{defaultMatches:c=!1,matchMedia:r=s?window.matchMedia:null,ssrMatchMedia:i=null,noSsr:o=!1}=p({name:"MuiUseMediaQuery",props:a,theme:e});let n=typeof t=="function"?t(e):t;return n=n.replace(/^@media( ?)/m,""),(d!==void 0?w:g)(n,c,r,i,o)}export{L as u};
