{"version":3,"file":"focus-visible-supuXXMI.js","sources":["../../../../node_modules/.pnpm/@ionic+core@8.4.1/node_modules/@ionic/core/components/focus-visible.js"],"sourcesContent":["/*!\n * (C) Ionic http://ionicframework.com - MIT License\n */\nconst ION_FOCUSED = 'ion-focused';\nconst ION_FOCUSABLE = 'ion-focusable';\nconst FOCUS_KEYS = [\n 'Tab',\n 'ArrowDown',\n 'Space',\n 'Escape',\n ' ',\n 'Shift',\n 'Enter',\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'Home',\n 'End',\n];\nconst startFocusVisible = (rootEl) => {\n let currentFocus = [];\n let keyboardMode = true;\n const ref = rootEl ? rootEl.shadowRoot : document;\n const root = rootEl ? rootEl : document.body;\n const setFocus = (elements) => {\n currentFocus.forEach((el) => el.classList.remove(ION_FOCUSED));\n elements.forEach((el) => el.classList.add(ION_FOCUSED));\n currentFocus = elements;\n };\n const pointerDown = () => {\n keyboardMode = false;\n setFocus([]);\n };\n const onKeydown = (ev) => {\n keyboardMode = FOCUS_KEYS.includes(ev.key);\n if (!keyboardMode) {\n setFocus([]);\n }\n };\n const onFocusin = (ev) => {\n if (keyboardMode && ev.composedPath !== undefined) {\n const toFocus = ev.composedPath().filter((el) => {\n // TODO(FW-2832): type\n if (el.classList) {\n return el.classList.contains(ION_FOCUSABLE);\n }\n return false;\n });\n setFocus(toFocus);\n }\n };\n const onFocusout = () => {\n if (ref.activeElement === root) {\n setFocus([]);\n }\n };\n ref.addEventListener('keydown', onKeydown);\n ref.addEventListener('focusin', onFocusin);\n ref.addEventListener('focusout', onFocusout);\n ref.addEventListener('touchstart', pointerDown, { passive: true });\n ref.addEventListener('mousedown', pointerDown);\n const destroy = () => {\n ref.removeEventListener('keydown', onKeydown);\n ref.removeEventListener('focusin', onFocusin);\n ref.removeEventListener('focusout', onFocusout);\n ref.removeEventListener('touchstart', pointerDown);\n ref.removeEventListener('mousedown', pointerDown);\n };\n return {\n destroy,\n setFocus,\n };\n};\n\nexport { startFocusVisible };\n"],"names":["ION_FOCUSED","ION_FOCUSABLE","FOCUS_KEYS","startFocusVisible","rootEl","currentFocus","keyboardMode","ref","root","setFocus","elements","el","pointerDown","onKeydown","ev","onFocusin","toFocus","onFocusout"],"mappings":"AAAA;AAAA;AAAA,GAGA,MAAMA,EAAc,cACdC,EAAgB,gBAChBC,EAAa,CACf,MACA,YACA,QACA,SACA,IACA,QACA,QACA,YACA,aACA,UACA,OACA,KACJ,EACMC,EAAqBC,GAAW,CAClC,IAAIC,EAAe,CAAE,EACjBC,EAAe,GACnB,MAAMC,EAAMH,EAASA,EAAO,WAAa,SACnCI,EAAOJ,GAAkB,SAAS,KAClCK,EAAYC,GAAa,CAC3BL,EAAa,QAASM,GAAOA,EAAG,UAAU,OAAOX,CAAW,CAAC,EAC7DU,EAAS,QAASC,GAAOA,EAAG,UAAU,IAAIX,CAAW,CAAC,EACtDK,EAAeK,CAClB,EACKE,EAAc,IAAM,CACtBN,EAAe,GACfG,EAAS,CAAA,CAAE,CACd,EACKI,EAAaC,GAAO,CACtBR,EAAeJ,EAAW,SAASY,EAAG,GAAG,EACpCR,GACDG,EAAS,CAAA,CAAE,CAElB,EACKM,EAAaD,GAAO,CACtB,GAAIR,GAAgBQ,EAAG,eAAiB,OAAW,CAC/C,MAAME,EAAUF,EAAG,aAAc,EAAC,OAAQH,GAElCA,EAAG,UACIA,EAAG,UAAU,SAASV,CAAa,EAEvC,EACV,EACDQ,EAASO,CAAO,CAC5B,CACK,EACKC,EAAa,IAAM,CACjBV,EAAI,gBAAkBC,GACtBC,EAAS,CAAA,CAAE,CAElB,EACD,OAAAF,EAAI,iBAAiB,UAAWM,CAAS,EACzCN,EAAI,iBAAiB,UAAWQ,CAAS,EACzCR,EAAI,iBAAiB,WAAYU,CAAU,EAC3CV,EAAI,iBAAiB,aAAcK,EAAa,CAAE,QAAS,GAAM,EACjEL,EAAI,iBAAiB,YAAaK,CAAW,EAQtC,CACH,QARY,IAAM,CAClBL,EAAI,oBAAoB,UAAWM,CAAS,EAC5CN,EAAI,oBAAoB,UAAWQ,CAAS,EAC5CR,EAAI,oBAAoB,WAAYU,CAAU,EAC9CV,EAAI,oBAAoB,aAAcK,CAAW,EACjDL,EAAI,oBAAoB,YAAaK,CAAW,CACnD,EAGG,SAAAH,CACH,CACL","x_google_ignoreList":[0]}