
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5b24908e-af64-5771-8367-1c4890fd594e")}catch(e){}}();
import{e as h,u as b,b as x,l as F}from"./keyboard-CaEu2o0u.js";import{r as p}from"./index-D6da9p6-.js";function f(e){return h.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let d=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var w=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(w||{}),y=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(y||{}),S=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(S||{});function m(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(d)).sort((t,r)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(r.tabIndex||Number.MAX_SAFE_INTEGER)))}var O=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(O||{});function A(e,t=0){var r;return e===((r=f(e))==null?void 0:r.body)?!1:b(t,{0(){return e.matches(d)},1(){let n=e;for(;n!==null;){if(n.matches(d))return!0;n=n.parentElement}return!1}})}function K(e){let t=f(e);x().nextFrame(()=>{t&&!A(t.activeElement,0)&&I(e)})}var M=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(M||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function I(e){e?.focus({preventScroll:!0})}let P=["textarea","input"].join(",");function L(e){var t,r;return(r=(t=e?.matches)==null?void 0:t.call(e,P))!=null?r:!1}function D(e,t=r=>r){return e.slice().sort((r,n)=>{let l=t(r),s=t(n);if(l===null||s===null)return 0;let o=l.compareDocumentPosition(s);return o&Node.DOCUMENT_POSITION_FOLLOWING?-1:o&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function G(e,t){return T(m(),t,{relativeTo:e})}function T(e,t,{sorted:r=!0,relativeTo:n=null,skipElements:l=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,o=Array.isArray(e)?r?D(e):e:m(e);l.length>0&&o.length>1&&(o=o.filter(u=>!l.includes(u))),n=n??s.activeElement;let E=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),v=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,o.indexOf(n))-1;if(t&4)return Math.max(0,o.indexOf(n))+1;if(t&8)return o.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),N=t&32?{preventScroll:!0}:{},c=0,a=o.length,i;do{if(c>=a||c+a<=0)return 0;let u=v+c;if(t&16)u=(u+a)%a;else{if(u<0)return 3;if(u>=a)return 1}i=o[u],i?.focus(N),c+=E}while(i!==s.activeElement);return t&6&&L(i)&&i.select(),2}function R(){let e=p.useRef(!1);return F(()=>(e.current=!0,()=>{e.current=!1}),[]),e}export{K as D,D as I,w as M,y as N,T as O,O as T,G as _,R as a,m as f,A as h,f as o,I as y};
//# sourceMappingURL=use-is-mounted-BaHv16bB.js.map

//# debugId=5b24908e-af64-5771-8367-1c4890fd594e
