var BAL_FOCUSED="bal-focused";var BAL_FOCUSABLE="bal-focusable";var FOCUS_KEYS=["Tab","ArrowDown","Space","Escape"," ","Shift","Enter","ArrowLeft","ArrowRight","ArrowUp","Home","End"];var startFocusVisible=function(r){var o=[];var n=true;var t=document;var u=document.body;var a=function(r){o.forEach((function(r){return r.classList.remove(BAL_FOCUSED)}));r.forEach((function(r){return r.classList.add(BAL_FOCUSED)}));o=r};var e=function(){n=false;a([])};var c=function(r){n=FOCUS_KEYS.includes(r.key);if(!n){a([])}};var f=function(r){if(n&&r.composedPath!==undefined){var o=r.composedPath().filter((function(r){if(r.classList){return r.classList.contains(BAL_FOCUSABLE)}return false}));a(o)}};var s=function(){if(t.activeElement===u){a([])}};t.addEventListener("keydown",c);t.addEventListener("focusin",f);t.addEventListener("focusout",s);t.addEventListener("touchstart",e);t.addEventListener("mousedown",e);var i=function(){t.removeEventListener("keydown",c);t.removeEventListener("focusin",f);t.removeEventListener("focusout",s);t.removeEventListener("touchstart",e);t.removeEventListener("mousedown",e)};return{destroy:i,setFocus:a}};export{FOCUS_KEYS as F,startFocusVisible as s};