{"version":3,"sources":["webpack:///./app/javascript/waitUntilReady.js","webpack:///./app/javascript/packs/copy.js"],"names":["waitUntilReady","Promise","resolve","document","readyState","addEventListener","then","copyElementContainer","querySelector","copyLinkButton","copyLinkToast","event","preventDefault","copyLink","animateToast","copyContent","dataset","url","tempInput","createElement","type","value","style","opacity","appendChild","select","execCommand","removeChild","classList","remove","add","setInterval"],"mappings":"4FAeC,IAAMA,EAAiB,IAAIC,SAAQ,SAAAC,GACN,YAAxBC,SAASC,WACXF,IAEAC,SAASE,iBAAiB,mBAAoBH,MAInCF,O,6BCvBf,YAEAA,EAAeM,MAAK,WAClB,IAAMC,EAAuBJ,SAASK,cAAc,wBAC9CC,EAAiBN,SAASK,cAAc,qBACxCE,EAAgBP,SAASK,cAAc,oBAEzCD,GAAwBE,IAC1BA,EAAeJ,iBAAiB,SAAS,SAACM,GACxCA,EAAMC,iBACNC,IACAC,OAGFL,EAAeJ,iBAAiB,YAAY,SAACM,GAC3CA,EAAMC,iBACNC,IACAC,QAIJ,IAAMD,EAAW,WACf,IAAMN,EAAuBJ,SAASK,cAAc,wBAE9CO,EADcZ,SAASK,cAAc,qBACXQ,QAAQC,IAClCC,EAAYf,SAASgB,cAAc,SACzCD,EAAUE,KAAO,OACjBF,EAAUG,MAAQN,EAClBG,EAAUI,MAAMC,QAAU,MAC1BhB,EAAqBiB,YAAYN,GACjCA,EAAUO,SACVtB,SAASuB,YAAY,QACrBnB,EAAqBoB,YAAYT,IAG7BJ,EAAe,WACnBJ,EAAckB,UAAUC,OAAO,UAC/BnB,EAAckB,UAAUC,OAAO,aAC/BnB,EAAckB,UAAUE,IAAI,eAC5BC,aAAY,WACVrB,EAAckB,UAAUC,OAAO,eAC/BnB,EAAckB,UAAUE,IAAI,eAC3B,SAxCP9B","file":"js/10-635b298cb7f5ec41b043.chunk.js","sourcesContent":["/**\n * A Promise that resolves when the DOMContentLoaded event fires or when the\n * document readyState is no longer 'loading'.\n *\n * This is useful in situations when code should execute as soon as it is loaded\n * and the DOM is ready, but won't be loaded before DOMContentLoaded event fires\n * (e.g. an js chunk loading aync).\n *\n * the DOMContentLoaded event only fires once. Any DOMContentLoaded event\n * listeners registered after the event fires will not be handled.\n *\n * Example:\n *\n * waitUntilReady.then(() => console.log(\"DOMContentLoaded!\"));\n */\n const waitUntilReady = new Promise(resolve => {\n if (document.readyState !== 'loading') {\n resolve()\n } else {\n document.addEventListener('DOMContentLoaded', resolve)\n }\n})\n\nexport default waitUntilReady\n","import waitUntilReady from '../waitUntilReady'\n\nwaitUntilReady.then(() =>{\n const copyElementContainer = document.querySelector(\".copy-link-container\");\n const copyLinkButton = document.querySelector(\".copy-link-button\");\n const copyLinkToast = document.querySelector('#copy-link-toast');\n\n if (copyElementContainer && copyLinkButton) {\n copyLinkButton.addEventListener(\"click\", (event) => {\n event.preventDefault();\n copyLink();\n animateToast();\n });\n\n copyLinkButton.addEventListener(\"touchend\", (event) => {\n event.preventDefault();\n copyLink();\n animateToast();\n });\n }\n\n const copyLink = () => {\n const copyElementContainer = document.querySelector(\".copy-link-container\");\n const copyElement = document.querySelector(\".copy-link-button\");\n const copyContent = copyElement.dataset.url;\n const tempInput = document.createElement(\"input\");\n tempInput.type = \"text\";\n tempInput.value = copyContent;\n tempInput.style.opacity = \"0.0\";\n copyElementContainer.appendChild(tempInput);\n tempInput.select();\n document.execCommand(\"copy\");\n copyElementContainer.removeChild(tempInput);\n }\n\n const animateToast = () => {\n copyLinkToast.classList.remove(\"hidden\");\n copyLinkToast.classList.remove(\"opacity-0\");\n copyLinkToast.classList.add(\"opacity-100\");\n setInterval(() => {\n copyLinkToast.classList.remove(\"opacity-100\");\n copyLinkToast.classList.add(\"opacity-0\");\n }, 3500);\n }\n})();\n"],"sourceRoot":""}