{"version":3,"file":"getFocusableIn.mjs","names":["isFocusable","getFocusableIn","node","_node$ownerDocument","treeWalker","ownerDocument","createTreeWalker","NodeFilter","SHOW_ELEMENT","ownerSVGElement","FILTER_REJECT","FILTER_ACCEPT","result","currentNode","push","nextNode"],"sources":["../../src/focus-lock/getFocusableIn.ts"],"sourcesContent":["import { isFocusable } from './isFocusable';\n\nexport const getFocusableIn = (node: HTMLElement) => {\n  const treeWalker = node?.ownerDocument?.createTreeWalker(node, NodeFilter.SHOW_ELEMENT, (node) =>\n    'ownerSVGElement' in node && node.ownerSVGElement\n      ? NodeFilter.FILTER_REJECT\n      : NodeFilter.FILTER_ACCEPT,\n  );\n\n  const result: HTMLElement[] = [];\n\n  if (!treeWalker) return result;\n  if (isFocusable(treeWalker.currentNode)) {\n    result.push(treeWalker.currentNode as HTMLElement);\n  }\n  while (treeWalker.nextNode() !== null) {\n    if (isFocusable(treeWalker.currentNode)) {\n      result.push(treeWalker.currentNode as HTMLElement);\n    }\n  }\n\n  return result;\n};\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,mBAAe;AAE3C,OAAO,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,IAAiB,EAAK;EAAA,IAAAC,mBAAA;EACnD,IAAMC,UAAU,GAAGF,IAAI,aAAJA,IAAI,wBAAAC,mBAAA,GAAJD,IAAI,CAAEG,aAAa,cAAAF,mBAAA,uBAAnBA,mBAAA,CAAqBG,gBAAgB,CAACJ,IAAI,EAAEK,UAAU,CAACC,YAAY,EAAE,UAACN,IAAI;IAAA,OAC3F,iBAAiB,IAAIA,IAAI,IAAIA,IAAI,CAACO,eAAe,GAC7CF,UAAU,CAACG,aAAa,GACxBH,UAAU,CAACI,aAAa;EAAA,EAC7B;EAED,IAAMC,MAAqB,GAAG,EAAE;EAEhC,IAAI,CAACR,UAAU,EAAE,OAAOQ,MAAM;EAC9B,IAAIZ,WAAW,CAACI,UAAU,CAACS,WAAW,CAAC,EAAE;IACvCD,MAAM,CAACE,IAAI,CAACV,UAAU,CAACS,WAAW,CAAgB;EACpD;EACA,OAAOT,UAAU,CAACW,QAAQ,EAAE,KAAK,IAAI,EAAE;IACrC,IAAIf,WAAW,CAACI,UAAU,CAACS,WAAW,CAAC,EAAE;MACvCD,MAAM,CAACE,IAAI,CAACV,UAAU,CAACS,WAAW,CAAgB;IACpD;EACF;EAEA,OAAOD,MAAM;AACf,CAAC"}