{"version":3,"file":"configurator.min.js","sources":["https:\/\/moodle.sonsbeekmedia.nl\/caie_39\/mod\/teachingtools\/amd\/src\/configurator.js"],"sourcesContent":["\/\/ This file is part of Moodle - http:\/\/moodle.org\/\n\/\/\n\/\/ Moodle is free software: you can redistribute it and\/or modify\n\/\/ it under the terms of the GNU General Public License as published by\n\/\/ the Free Software Foundation, either version 3 of the License, or\n\/\/ (at your option) any later version.\n\/\/\n\/\/ Moodle is distributed in the hope that it will be useful,\n\/\/ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\/\/ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\/\/ GNU General Public License for more details.\n\/\/\n\/\/ You should have received a copy of the GNU General Public License\n\/\/ along with Moodle. If not, see .\n\n\/**\n * Configurator controls.\n *\n * @module mod_teachingtools\/configurator\n * @copyright 2023 Sonsbeek Media\n * @author Bas Brands \n * @license http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n *\/\n\nconst toggleConfigurator = (configuratorid) => {\n const configuratorContent = document.getElementById(configuratorid);\n let status = configuratorContent.classList.contains('active');\n if (status) {\n configuratorContent.classList.remove('active');\n configuratorContent.setAttribute('aria-hidden', 'true');\n } else {\n configuratorContent.classList.add('active');\n configuratorContent.classList.remove('tabhidden');\n configuratorContent.setAttribute('aria-hidden', 'false');\n \/\/ Find the first focusable element and set focus.\n const focusable = configuratorContent.querySelector('.nav-link');\n if (focusable) {\n setTimeout(() => {\n if (configuratorContent.classList.contains('active')) {\n focusable.focus();\n }\n }, 500);\n }\n }\n setTimeout(() => {\n if (!configuratorContent.classList.contains('active')) {\n configuratorContent.classList.add('tabhidden');\n }\n }, 500);\n};\n\n\/**\n * Show the teaching tool full screen.\n *\n *\n *\/\n const init = () => {\n const toolWrapper = document.querySelector('[data-region=\"toolwrapper\"]');\n if (!toolWrapper) {\n return;\n }\n if (toolWrapper.dataset.configuratorInitialised) {\n return;\n }\n document.addEventListener('click', (e) => {\n if (e.target.closest('[data-action=\"configurator\"]')) {\n const configuratorButton = e.target.closest('[data-action=\"configurator\"]');\n toggleConfigurator(configuratorButton.dataset.target);\n }\n if (e.target.closest('[data-dismiss=\"configurator\"]')) {\n const configuratorButton = e.target.closest('[data-dismiss=\"configurator\"]');\n toggleConfigurator(configuratorButton.dataset.target);\n }\n });\n toolWrapper.dataset.configuratorInitialised = true;\n};\n\nexport default {\n init: init\n};"],"names":["toggleConfigurator","configuratorid","configuratorContent","document","getElementById","classList","contains","remove","setAttribute","add","focusable","querySelector","setTimeout","focus","init","toolWrapper","dataset","configuratorInitialised","addEventListener","e","target","closest","configuratorButton"],"mappings":";;;;;;;;;MAwBMA,mBAAsBC,uBAClBC,oBAAsBC,SAASC,eAAeH,mBACvCC,oBAAoBG,UAAUC,SAAS,UAEhDJ,oBAAoBG,UAAUE,OAAO,UACrCL,oBAAoBM,aAAa,cAAe,YAC7C,CACHN,oBAAoBG,UAAUI,IAAI,UAClCP,oBAAoBG,UAAUE,OAAO,aACrCL,oBAAoBM,aAAa,cAAe,eAE1CE,UAAYR,oBAAoBS,cAAc,aAChDD,WACAE,YAAW,KACHV,oBAAoBG,UAAUC,SAAS,WACvCI,UAAUG,UAEf,KAGXD,YAAW,KACFV,oBAAoBG,UAAUC,SAAS,WACxCJ,oBAAoBG,UAAUI,IAAI,eAEvC,mBA6BQ,CACXK,KAtBU,WACJC,YAAcZ,SAASQ,cAAc,+BACtCI,cAGDA,YAAYC,QAAQC,0BAGxBd,SAASe,iBAAiB,SAAUC,OAC5BA,EAAEC,OAAOC,QAAQ,gCAAiC,OAC5CC,mBAAqBH,EAAEC,OAAOC,QAAQ,gCAC5CrB,mBAAmBsB,mBAAmBN,QAAQI,WAE9CD,EAAEC,OAAOC,QAAQ,iCAAkC,OAC7CC,mBAAqBH,EAAEC,OAAOC,QAAQ,iCAC5CrB,mBAAmBsB,mBAAmBN,QAAQI,YAGtDL,YAAYC,QAAQC,yBAA0B"}