import{useRef,useEffect}from"react";import{l,m as o}from"./keyboard-D0PLkOsr.js";function F(a){let{container:b,accept:d,walk:e,enabled:g=!0}=a,c=useRef(d),h=useRef(e);useEffect(()=>{c.current=d,h.current=e},[d,e]),l(()=>{if(!b||!g)return;let a=o(b);if(!a)return;let e=c.current,f=h.current,i=Object.assign(a=>e(a),{acceptNode:e}),d=a.createTreeWalker(b,NodeFilter.SHOW_ELEMENT,i,!1);for(;d.nextNode();)f(d.currentNode)},[b,g,c,h])}export{F};