PageSourceSearch

https://saasrock.com/assets/focus-management-C8sj6Fjc.js

js saasrock.com collected 2026-10-03 23:10:27 UTC 3,281 bytes, 1 lines download raw bytes

1import{r as f,e as E,u as x,l as h,o as y,i as A}from"./keyboard-CUKk1vEI.js";let m=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),S=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var p=(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[e.AutoFocus=64]="AutoFocus",e))(p||{}),I=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(I||{}),M=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(M||{});function b(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(m)).sort((t,r)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(r.tabIndex||Number.MAX_SAFE_INTEGER)))}function w(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(S)).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 _(e,t=0){var r;return e===((r=h(e))==null?void 0:r.body)?!1:x(t,{0(){return e.matches(m)},1(){let n=e;for(;n!==null;){if(n.matches(m))return!0;n=n.parentElement}return!1}})}function D(e){y().nextFrame(()=>{let t=E(e);t&&A(t)&&!_(t,0)&&T(e)})}var P=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(P||{});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 T(e){e?.focus({preventScroll:!0})}let g=["textarea","input"].join(",");function L(e){var t,r;return(r=(t=e?.matches)==null?void 0:t.call(e,g))!=null?r:!1}function G(e,t=r=>r){return e.slice().sort((r,n)=>{let i=t(r),s=t(n);if(i===null||s===null)return 0;let u=i.compareDocumentPosition(s);return u&Node.DOCUMENT_POSITION_FOLLOWING?-1:u&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function U(e,t,r=e===null?document.body:f(e)){return K(b(r),t,{relativeTo:e})}function K(e,t,{sorted:r=!0,relativeTo:n=null,skipElements:i=[]}={}){let s=Array.isArray(e)?e.length>0?f(e[0]):document:f(e),u=Array.isArray(e)?r?G(e):e:t&64?w(e):b(e);i.length>0&&u.length>1&&(u=u.filter(o=>!i.some(c=>c!=null&&"current"in c?c?.current===o:c===o))),n=n??s?.activeElement;let v=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),N=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,u.indexOf(n))-1;if(t&4)return Math.max(0,u.indexOf(n))+1;if(t&8)return u.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),F=t&32?{preventScroll:!0}:{},d=0,a=u.length,l;do{if(d>=a||d+a<=0)return 0;let o=N+d;if(t&16)o=(o+a)%a;else{if(o<0)return 3;if(o>=a)return 1}l=u[o],l?.focus(F),d+=v}while(l!==E(l));return t&6&&L(l)&&l.select(),2}export{I as A,m as E,G,_ as H,O as I,D as K,U as R,p as T,K as v,T as w,b as x};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.