{"version":3,"file":"index.cjs","sources":["../../src/dom/alertDialog.js","../../src/dom/index.js","../../src/dom/forceBlur.js"],"sourcesContent":["/* global document, HTMLElement */\n\nconst alertDialog = (message) => {\n    const dialog = document.createElement('dialog');\n    document.body.append(dialog);\n\n    const itemsToInsert = Array.isArray(message) ? message : [message];\n\n    for (const item of itemsToInsert) {\n        if (item instanceof HTMLElement) {\n            dialog.append(item);\n        } else if (typeof item?.innerHTML === 'string') {\n            const div = document.createElement('div');\n            div.innerHTML = item.innerHTML;\n            const children = div.children;\n            for (const child of children) {\n                dialog.append(child);\n            }\n        } else {\n            const textNode = document.createTextNode(item);\n            dialog.append(textNode);\n        }\n    }\n\n    dialog.addEventListener(\n        'click',\n        function (evt) {\n            if (evt.target === dialog) {\n                dialog.close();\n            }\n        }\n    );\n\n    dialog.showModal();\n};\n\nexport { alertDialog };\n","import { alertDialog } from './alertDialog.js';\nimport { forceBlur } from './forceBlur.js';\n\nconst dom = {\n    alertDialog,\n    forceBlur\n};\n\nexport { dom };\n","/* global document */\n\nconst timeoutAsync = function (ms) {\n    return new Promise((resolve) => { setTimeout(resolve, ms); });\n};\n\nconst forceBlur = async function () {\n    const input = document.createElement('input');\n    input.style.position = 'absolute';\n    input.style.visibility = 'hidden';\n    input.style.opacity = '0';\n\n    document.body.append(input);\n    input.focus();\n    await timeoutAsync(0);\n    document.body.remove(input);\n};\n\nexport { forceBlur };\n"],"names":["dom","alertDialog","message","dialog","document","createElement","body","append","itemsToInsert","Array","isArray","item","HTMLElement","innerHTML","div","children","child","textNode","createTextNode","addEventListener","evt","target","close","showModal","forceBlur","async","input","style","position","visibility","opacity","focus","ms","Promise","resolve","setTimeout","remove"],"mappings":";AAEA,MCCMA,IAAM,CACRC,YDFiBC,UACjB,MAAMC,OAASC,SAASC,cAAc;AACtCD,SAASE,KAAKC,OAAOJ;AAErB,MAAMK,cAAgBC,MAAMC,QAAQR,SAAWA,QAAU,CAACA;AAE1D,IAAK,MAAMS,QAAQH,cACf,GAAIG,gBAAgBC,YAChBT,OAAOI,OAAOI;KACX,GAA+B,iBAApBA,MAAME,UAAwB,CAC5C,MAAMC,IAAMV,SAASC,cAAc;AACnCS,IAAID,UAAYF,KAAKE;AACrB,MAAME,SAAWD,IAAIC;AACrB,IAAK,MAAMC,SAASD,SAChBZ,OAAOI,OAAOS,MAEtB,KAAO,CACH,MAAMC,SAAWb,SAASc,eAAeP;AACzCR,OAAOI,OAAOU,SAClB,CAGJd,OAAOgB,iBACH,QACA,SAAUC,KACFA,IAAIC,SAAWlB,QACfA,OAAOmB,OAEf;AAGJnB,OAAOoB,aC5BPC,UCCcC,iBACd,MAAMC,MAAQtB,SAASC,cAAc;AACrCqB,MAAMC,MAAMC,SAAW;AACvBF,MAAMC,MAAME,WAAa;AACzBH,MAAMC,MAAMG,QAAU;AAEtB1B,SAASE,KAAKC,OAAOmB;AACrBA,MAAMK;MAXqBC,GAYR,EAXZ,IAAIC,QAASC,UAAcC,WAAWD,QAASF;AADrC,IAAUA;AAa3B5B,SAASE,KAAK8B,OAAOV,MACzB;"}