Your IP : 216.73.216.95


Current Path : /var/www/ljmtc/cbt/course/amd/build/local/activitychooser/
Upload File :
Current File : /var/www/ljmtc/cbt/course/amd/build/local/activitychooser/dialogue.min.js.map

{"version":3,"sources":["../../../src/local/activitychooser/dialogue.js"],"names":["getPlugin","pluginName","showModuleHelp","carousel","moduleData","modal","showFooter","setFooter","Templates","render","help","find","selectors","regions","innerHTML","classList","add","spinnerPromise","transitionPromiseResolver","transitionPromise","Promise","resolve","contentPromise","renderForPromise","all","then","html","js","replaceNodeContents","querySelector","chooserSummary","header","focus","catch","Notification","exception","one","manageFavouriteState","modalBody","caller","partialFavourite","isFavourite","dataset","favourited","id","name","internal","Repository","unfavouriteModule","favouriteModule","registerListenerEvents","mappedModules","footerData","bodyClickListener","e","target","closest","actions","optionActions","showSummary","getBody","module","chooserOption","container","moduleName","modname","get","hasFooterContent","manageFavourite","activeSectionId","elements","activetab","getAttribute","sectionChooserOptions","getSectionChooserOptions","firstChooserOption","toggleFocusableChooserOption","initChooserOptionsKeyboardNavigation","matches","closeOption","on","allModules","modules","getModuleSelector","clearSearch","searchInput","search","value","toggleSearchResultsView","footerClickListener","footer","customfooterjs","footerjs","getBodyPromise","body","interval","pause","keyboard","addEventListener","getFooterPromise","chooserOptionsContainer","chooserOptions","querySelectorAll","Array","from","forEach","element","keyCode","enter","space","preventDefault","arrowRight","currentOption","nextOption","nextElementSibling","firstOption","firstElementChild","toFocusOption","clickErrorHandler","focusChooserOption","arrowLeft","previousOption","previousElementSibling","lastOption","lastElementChild","home","end","currentChooserOption","previousChooserOption","isFocusable","chooserOptionLink","addChooser","chooserOptionHelp","chooserOptionFavourite","tabIndex","item","fallback","renderSearchResults","searchResultsContainer","searchResultsData","templateData","length","searchQuery","searchResults","chooserContainer","chooser","clearSearchButton","searchModules","searchResultItemsContainer","searchResultItems","firstSearchResultItem","remove","setAttribute","removeAttribute","searchTerm","toLowerCase","activity","activityName","title","activityDesc","includes","push","setupKeyboardAccessibility","getModal","tab","activeSectionChooserOptions","prevActiveSectionId","relatedTarget","prevActiveSectionChooserOptions","disableFocusAllChooserOptions","allChooserOptions","displayChooser","modalPromise","sectionModules","Map","set","componentname","link","getRoot","ModalEvents","hidden","destroy"],"mappings":"wqBAwBA,OACA,OACA,OACA,OAGA,OACA,O,k+DAEMA,CAAAA,CAAS,CAAG,SAAAC,CAAU,uFAAWA,CAAX,mMAAWA,CAAX,sBAAWA,CAAX,G,CAUtBC,CAAc,CAAG,SAACC,CAAD,CAAWC,CAAX,CAAwC,IAAjBC,CAAAA,CAAiB,wDAAT,IAAS,CAE3D,GAAc,IAAV,GAAAA,CAAK,EAAa,KAAAD,CAAU,CAACE,UAAjC,CAAsD,CAClDD,CAAK,CAACE,SAAN,CAAgBC,CAAS,CAACC,MAAV,CAAiB,kDAAjB,CAAqEL,CAArE,CAAhB,CACH,CACD,GAAMM,CAAAA,CAAI,CAAGP,CAAQ,CAACQ,IAAT,CAAcC,UAAUC,OAAV,CAAkBH,IAAhC,EAAsC,CAAtC,CAAb,CACAA,CAAI,CAACI,SAAL,CAAiB,EAAjB,CACAJ,CAAI,CAACK,SAAL,CAAeC,GAAf,CAAmB,QAAnB,EAP2D,GAUrDC,CAAAA,CAAc,CAAG,yBAAmBP,CAAnB,CAVoC,CAavDQ,CAAyB,CAAG,IAb2B,CAcrDC,CAAiB,CAAG,GAAIC,CAAAA,OAAJ,CAAY,SAAAC,CAAO,CAAI,CAC7CH,CAAyB,CAAGG,CAC/B,CAFyB,CAdiC,CAmBrDC,CAAc,CAAGd,CAAS,CAACe,gBAAV,CAA2B,wCAA3B,CAAqEnB,CAArE,CAnBoC,CAsB3DgB,OAAO,CAACI,GAAR,CAAY,CAACF,CAAD,CAAiBL,CAAjB,CAAiCE,CAAjC,CAAZ,EACKM,IADL,CACU,gCAAGC,CAAH,GAAGA,IAAH,CAASC,CAAT,GAASA,EAAT,OAAkBnB,CAAAA,CAAS,CAACoB,mBAAV,CAA8BlB,CAA9B,CAAoCgB,CAApC,CAA0C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EAaH,C","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 <http://www.gnu.org/licenses/>.\n\n/**\n * A type of dialogue used as for choosing options.\n *\n * @module     core_course/local/chooser/dialogue\n * @package    core\n * @copyright  2019 Mihail Geshoski <mihail@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport $ from 'jquery';\nimport * as ModalEvents from 'core/modal_events';\nimport selectors from 'core_course/local/activitychooser/selectors';\nimport * as Templates from 'core/templates';\nimport {end, arrowLeft, arrowRight, home, enter, space} from 'core/key_codes';\nimport {addIconToContainer} from 'core/loadingicon';\nimport * as Repository from 'core_course/local/activitychooser/repository';\nimport Notification from 'core/notification';\nimport {debounce} from 'core/utils';\nconst getPlugin = pluginName => import(pluginName);\n\n/**\n * Given an event from the main module 'page' navigate to it's help section via a carousel.\n *\n * @method showModuleHelp\n * @param {jQuery} carousel Our initialized carousel to manipulate\n * @param {Object} moduleData Data of the module to carousel to\n * @param {jQuery} modal We need to figure out if the current modal has a footer.\n */\nconst showModuleHelp = (carousel, moduleData, modal = null) => {\n    // If we have a real footer then we need to change temporarily.\n    if (modal !== null && moduleData.showFooter === true) {\n        modal.setFooter(Templates.render('core_course/local/activitychooser/footer_partial', moduleData));\n    }\n    const help = carousel.find(selectors.regions.help)[0];\n    help.innerHTML = '';\n    help.classList.add('m-auto');\n\n    // Add a spinner.\n    const spinnerPromise = addIconToContainer(help);\n\n    // Used later...\n    let transitionPromiseResolver = null;\n    const transitionPromise = new Promise(resolve => {\n        transitionPromiseResolver = resolve;\n    });\n\n    // Build up the html & js ready to place into the help section.\n    const contentPromise = Templates.renderForPromise('core_course/local/activitychooser/help', moduleData);\n\n    // Wait for the content to be ready, and for the transition to be complet.\n    Promise.all([contentPromise, spinnerPromise, transitionPromise])\n        .then(([{html, js}]) => Templates.replaceNodeContents(help, html, js))\n        .then(() => {\n            help.querySelector(selectors.regions.chooserSummary.header).focus();\n            return help;\n        })\n        .catch(Notification.exception);\n\n    // Move to the next slide, and resolve the transition promise when it's done.\n    carousel.one('slid.bs.carousel', () => {\n        transitionPromiseResolver();\n    });\n    // Trigger the transition between 'pages'.\n    carousel.carousel('next');\n};\n\n/**\n * Given a user wants to change the favourite state of a module we either add or remove the status.\n * We also propergate this change across our map of modals.\n *\n * @method manageFavouriteState\n * @param {HTMLElement} modalBody The DOM node of the modal to manipulate\n * @param {HTMLElement} caller\n * @param {Function} partialFavourite Partially applied function we need to manage favourite status\n */\nconst manageFavouriteState = async(modalBody, caller, partialFavourite) => {\n    const isFavourite = caller.dataset.favourited;\n    const id = caller.dataset.id;\n    const name = caller.dataset.name;\n    const internal = caller.dataset.internal;\n    // Switch on fave or not.\n    if (isFavourite === 'true') {\n        await Repository.unfavouriteModule(name, id);\n\n        partialFavourite(internal, false, modalBody);\n    } else {\n        await Repository.favouriteModule(name, id);\n\n        partialFavourite(internal, true, modalBody);\n    }\n\n};\n\n/**\n * Register chooser related event listeners.\n *\n * @method registerListenerEvents\n * @param {Promise} modal Our modal that we are working with\n * @param {Map} mappedModules A map of all of the modules we are working with with K: mod_name V: {Object}\n * @param {Function} partialFavourite Partially applied function we need to manage favourite status\n * @param {Object} footerData Our base footer object.\n */\nconst registerListenerEvents = (modal, mappedModules, partialFavourite, footerData) => {\n    const bodyClickListener = async(e) => {\n        if (e.target.closest(selectors.actions.optionActions.showSummary)) {\n            const carousel = $(modal.getBody()[0].querySelector(selectors.regions.carousel));\n\n            const module = e.target.closest(selectors.regions.chooserOption.container);\n            const moduleName = module.dataset.modname;\n            const moduleData = mappedModules.get(moduleName);\n            // We need to know if the overall modal has a footer so we know when to show a real / vs fake footer.\n            moduleData.showFooter = modal.hasFooterContent();\n            showModuleHelp(carousel, moduleData, modal);\n        }\n\n        if (e.target.closest(selectors.actions.optionActions.manageFavourite)) {\n            const caller = e.target.closest(selectors.actions.optionActions.manageFavourite);\n            await manageFavouriteState(modal.getBody()[0], caller, partialFavourite);\n            const activeSectionId = modal.getBody()[0].querySelector(selectors.elements.activetab).getAttribute(\"href\");\n            const sectionChooserOptions = modal.getBody()[0]\n                .querySelector(selectors.regions.getSectionChooserOptions(activeSectionId));\n            const firstChooserOption = sectionChooserOptions\n                .querySelector(selectors.regions.chooserOption.container);\n            toggleFocusableChooserOption(firstChooserOption, true);\n            initChooserOptionsKeyboardNavigation(modal.getBody()[0], mappedModules, sectionChooserOptions, modal);\n        }\n\n        // From the help screen go back to the module overview.\n        if (e.target.matches(selectors.actions.closeOption)) {\n            const carousel = $(modal.getBody()[0].querySelector(selectors.regions.carousel));\n\n            // Trigger the transition between 'pages'.\n            carousel.carousel('prev');\n            carousel.on('slid.bs.carousel', () => {\n                const allModules = modal.getBody()[0].querySelector(selectors.regions.modules);\n                const caller = allModules.querySelector(selectors.regions.getModuleSelector(e.target.dataset.modname));\n                caller.focus();\n            });\n        }\n\n        // The \"clear search\" button is triggered.\n        if (e.target.closest(selectors.actions.clearSearch)) {\n            // Clear the entered search query in the search bar and hide the search results container.\n            const searchInput = modal.getBody()[0].querySelector(selectors.actions.search);\n            searchInput.value = \"\";\n            searchInput.focus();\n            toggleSearchResultsView(modal, mappedModules, searchInput.value);\n        }\n    };\n\n    // We essentially have two types of footer.\n    // A fake one that is handled within the template for chooser_help and then all of the stuff for\n    // modal.footer. We need to ensure we know exactly what type of footer we are using so we know what we\n    // need to manage. The below code handles a real footer going to a mnet carousel item.\n    const footerClickListener = async(e) => {\n        if (footerData.footer === true) {\n            const footerjs = await getPlugin(footerData.customfooterjs);\n            await footerjs.footerClickListener(e, footerData, modal);\n        }\n    };\n\n    modal.getBodyPromise()\n\n    // The return value of getBodyPromise is a jquery object containing the body NodeElement.\n    .then(body => body[0])\n\n    // Set up the carousel.\n    .then(body => {\n        $(body.querySelector(selectors.regions.carousel))\n            .carousel({\n                interval: false,\n                pause: true,\n                keyboard: false\n            });\n\n        return body;\n    })\n\n    // Add the listener for clicks on the body.\n    .then(body => {\n        body.addEventListener('click', bodyClickListener);\n        return body;\n    })\n\n    // Add a listener for an input change in the activity chooser's search bar.\n    .then(body => {\n        const searchInput = body.querySelector(selectors.actions.search);\n        // The search input is triggered.\n        searchInput.addEventListener('input', debounce(() => {\n            // Display the search results.\n            toggleSearchResultsView(modal, mappedModules, searchInput.value);\n        }, 300));\n        return body;\n    })\n\n    // Register event listeners related to the keyboard navigation controls.\n    .then(body => {\n        // Get the active chooser options section.\n        const activeSectionId = body.querySelector(selectors.elements.activetab).getAttribute(\"href\");\n        const sectionChooserOptions = body.querySelector(selectors.regions.getSectionChooserOptions(activeSectionId));\n        const firstChooserOption = sectionChooserOptions.querySelector(selectors.regions.chooserOption.container);\n\n        toggleFocusableChooserOption(firstChooserOption, true);\n        initChooserOptionsKeyboardNavigation(body, mappedModules, sectionChooserOptions, modal);\n\n        return body;\n    })\n    .catch();\n\n    modal.getFooterPromise()\n\n    // The return value of getBodyPromise is a jquery object containing the body NodeElement.\n    .then(footer => footer[0])\n    // Add the listener for clicks on the footer.\n    .then(footer => {\n        footer.addEventListener('click', footerClickListener);\n        return footer;\n    })\n    .catch();\n};\n\n/**\n * Initialise the keyboard navigation controls for the chooser options.\n *\n * @method initChooserOptionsKeyboardNavigation\n * @param {HTMLElement} body Our modal that we are working with\n * @param {Map} mappedModules A map of all of the modules we are working with with K: mod_name V: {Object}\n * @param {HTMLElement} chooserOptionsContainer The section that contains the chooser items\n * @param {Object} modal Our created modal for the section\n */\nconst initChooserOptionsKeyboardNavigation = (body, mappedModules, chooserOptionsContainer, modal = null) => {\n    const chooserOptions = chooserOptionsContainer.querySelectorAll(selectors.regions.chooserOption.container);\n\n    Array.from(chooserOptions).forEach((element) => {\n        return element.addEventListener('keydown', (e) => {\n\n            // Check for enter/ space triggers for showing the help.\n            if (e.keyCode === enter || e.keyCode === space) {\n                if (e.target.matches(selectors.actions.optionActions.showSummary)) {\n                    e.preventDefault();\n                    const module = e.target.closest(selectors.regions.chooserOption.container);\n                    const moduleName = module.dataset.modname;\n                    const moduleData = mappedModules.get(moduleName);\n                    const carousel = $(body.querySelector(selectors.regions.carousel));\n                    carousel.carousel({\n                        interval: false,\n                        pause: true,\n                        keyboard: false\n                    });\n\n                    // We need to know if the overall modal has a footer so we know when to show a real / vs fake footer.\n                    moduleData.showFooter = modal.hasFooterContent();\n                    showModuleHelp(carousel, moduleData, modal);\n                }\n            }\n\n            // Next.\n            if (e.keyCode === arrowRight) {\n                e.preventDefault();\n                const currentOption = e.target.closest(selectors.regions.chooserOption.container);\n                const nextOption = currentOption.nextElementSibling;\n                const firstOption = chooserOptionsContainer.firstElementChild;\n                const toFocusOption = clickErrorHandler(nextOption, firstOption);\n                focusChooserOption(toFocusOption, currentOption);\n            }\n\n            // Previous.\n            if (e.keyCode === arrowLeft) {\n                e.preventDefault();\n                const currentOption = e.target.closest(selectors.regions.chooserOption.container);\n                const previousOption = currentOption.previousElementSibling;\n                const lastOption = chooserOptionsContainer.lastElementChild;\n                const toFocusOption = clickErrorHandler(previousOption, lastOption);\n                focusChooserOption(toFocusOption, currentOption);\n            }\n\n            if (e.keyCode === home) {\n                e.preventDefault();\n                const currentOption = e.target.closest(selectors.regions.chooserOption.container);\n                const firstOption = chooserOptionsContainer.firstElementChild;\n                focusChooserOption(firstOption, currentOption);\n            }\n\n            if (e.keyCode === end) {\n                e.preventDefault();\n                const currentOption = e.target.closest(selectors.regions.chooserOption.container);\n                const lastOption = chooserOptionsContainer.lastElementChild;\n                focusChooserOption(lastOption, currentOption);\n            }\n        });\n    });\n};\n\n/**\n * Focus on a chooser option element and remove the previous chooser element from the focus order\n *\n * @method focusChooserOption\n * @param {HTMLElement} currentChooserOption The current chooser option element that we want to focus\n * @param {HTMLElement|null} previousChooserOption The previous focused option element\n */\nconst focusChooserOption = (currentChooserOption, previousChooserOption = null) => {\n    if (previousChooserOption !== null) {\n        toggleFocusableChooserOption(previousChooserOption, false);\n    }\n\n    toggleFocusableChooserOption(currentChooserOption, true);\n    currentChooserOption.focus();\n};\n\n/**\n * Add or remove a chooser option from the focus order.\n *\n * @method toggleFocusableChooserOption\n * @param {HTMLElement} chooserOption The chooser option element which should be added or removed from the focus order\n * @param {Boolean} isFocusable Whether the chooser element is focusable or not\n */\nconst toggleFocusableChooserOption = (chooserOption, isFocusable) => {\n    const chooserOptionLink = chooserOption.querySelector(selectors.actions.addChooser);\n    const chooserOptionHelp = chooserOption.querySelector(selectors.actions.optionActions.showSummary);\n    const chooserOptionFavourite = chooserOption.querySelector(selectors.actions.optionActions.manageFavourite);\n\n    if (isFocusable) {\n        // Set tabindex to 0 to add current chooser option element to the focus order.\n        chooserOption.tabIndex = 0;\n        chooserOptionLink.tabIndex = 0;\n        chooserOptionHelp.tabIndex = 0;\n        chooserOptionFavourite.tabIndex = 0;\n    } else {\n        // Set tabindex to -1 to remove the previous chooser option element from the focus order.\n        chooserOption.tabIndex = -1;\n        chooserOptionLink.tabIndex = -1;\n        chooserOptionHelp.tabIndex = -1;\n        chooserOptionFavourite.tabIndex = -1;\n    }\n};\n\n/**\n * Small error handling function to make sure the navigated to object exists\n *\n * @method clickErrorHandler\n * @param {HTMLElement} item What we want to check exists\n * @param {HTMLElement} fallback If we dont match anything fallback the focus\n * @return {HTMLElement}\n */\nconst clickErrorHandler = (item, fallback) => {\n    if (item !== null) {\n        return item;\n    } else {\n        return fallback;\n    }\n};\n\n/**\n * Render the search results in a defined container\n *\n * @method renderSearchResults\n * @param {HTMLElement} searchResultsContainer The container where the data should be rendered\n * @param {Object} searchResultsData Data containing the module items that satisfy the search criteria\n */\nconst renderSearchResults = async(searchResultsContainer, searchResultsData) => {\n    const templateData = {\n        'searchresultsnumber': searchResultsData.length,\n        'searchresults': searchResultsData\n    };\n    // Build up the html & js ready to place into the help section.\n    const {html, js} = await Templates.renderForPromise('core_course/local/activitychooser/search_results', templateData);\n    await Templates.replaceNodeContents(searchResultsContainer, html, js);\n};\n\n/**\n * Toggle (display/hide) the search results depending on the value of the search query\n *\n * @method toggleSearchResultsView\n * @param {Object} modal Our created modal for the section\n * @param {Map} mappedModules A map of all of the modules we are working with with K: mod_name V: {Object}\n * @param {String} searchQuery The search query\n */\nconst toggleSearchResultsView = async(modal, mappedModules, searchQuery) => {\n    const modalBody = modal.getBody()[0];\n    const searchResultsContainer = modalBody.querySelector(selectors.regions.searchResults);\n    const chooserContainer = modalBody.querySelector(selectors.regions.chooser);\n    const clearSearchButton = modalBody.querySelector(selectors.actions.clearSearch);\n\n    if (searchQuery.length > 0) { // Search query is present.\n        const searchResultsData = searchModules(mappedModules, searchQuery);\n        await renderSearchResults(searchResultsContainer, searchResultsData);\n        const searchResultItemsContainer = searchResultsContainer.querySelector(selectors.regions.searchResultItems);\n        const firstSearchResultItem = searchResultItemsContainer.querySelector(selectors.regions.chooserOption.container);\n        if (firstSearchResultItem) {\n            // Set the first result item to be focusable.\n            toggleFocusableChooserOption(firstSearchResultItem, true);\n            // Register keyboard events on the created search result items.\n            initChooserOptionsKeyboardNavigation(modalBody, mappedModules, searchResultItemsContainer, modal);\n        }\n        // Display the \"clear\" search button in the activity chooser search bar.\n        clearSearchButton.classList.remove('d-none');\n        // Hide the default chooser options container.\n        chooserContainer.setAttribute('hidden', 'hidden');\n        // Display the search results container.\n        searchResultsContainer.removeAttribute('hidden');\n    } else { // Search query is not present.\n        // Hide the \"clear\" search button in the activity chooser search bar.\n        clearSearchButton.classList.add('d-none');\n        // Hide the search results container.\n        searchResultsContainer.setAttribute('hidden', 'hidden');\n        // Display the default chooser options container.\n        chooserContainer.removeAttribute('hidden');\n    }\n};\n\n/**\n * Return the list of modules which have a name or description that matches the given search term.\n *\n * @method searchModules\n * @param {Array} modules List of available modules\n * @param {String} searchTerm The search term to match\n * @return {Array}\n */\nconst searchModules = (modules, searchTerm) => {\n    if (searchTerm === '') {\n        return modules;\n    }\n    searchTerm = searchTerm.toLowerCase();\n    const searchResults = [];\n    modules.forEach((activity) => {\n        const activityName = activity.title.toLowerCase();\n        const activityDesc = activity.help.toLowerCase();\n        if (activityName.includes(searchTerm) || activityDesc.includes(searchTerm)) {\n            searchResults.push(activity);\n        }\n    });\n\n    return searchResults;\n};\n\n/**\n * Set up our tabindex information across the chooser.\n *\n * @method setupKeyboardAccessibility\n * @param {Promise} modal Our created modal for the section\n * @param {Map} mappedModules A map of all of the built module information\n */\nconst setupKeyboardAccessibility = (modal, mappedModules) => {\n    modal.getModal()[0].tabIndex = -1;\n\n    modal.getBodyPromise().then(body => {\n        $(selectors.elements.tab).on('shown.bs.tab', (e) => {\n            const activeSectionId = e.target.getAttribute(\"href\");\n            const activeSectionChooserOptions = body[0]\n                .querySelector(selectors.regions.getSectionChooserOptions(activeSectionId));\n            const firstChooserOption = activeSectionChooserOptions\n                .querySelector(selectors.regions.chooserOption.container);\n            const prevActiveSectionId = e.relatedTarget.getAttribute(\"href\");\n            const prevActiveSectionChooserOptions = body[0]\n                .querySelector(selectors.regions.getSectionChooserOptions(prevActiveSectionId));\n\n            // Disable the focus of every chooser option in the previous active section.\n            disableFocusAllChooserOptions(prevActiveSectionChooserOptions);\n            // Enable the focus of the first chooser option in the current active section.\n            toggleFocusableChooserOption(firstChooserOption, true);\n            initChooserOptionsKeyboardNavigation(body[0], mappedModules, activeSectionChooserOptions, modal);\n        });\n        return;\n    }).catch(Notification.exception);\n};\n\n/**\n * Disable the focus of all chooser options in a specific container (section).\n *\n * @method disableFocusAllChooserOptions\n * @param {HTMLElement} sectionChooserOptions The section that contains the chooser items\n */\nconst disableFocusAllChooserOptions = (sectionChooserOptions) => {\n    const allChooserOptions = sectionChooserOptions.querySelectorAll(selectors.regions.chooserOption.container);\n    allChooserOptions.forEach((chooserOption) => {\n        toggleFocusableChooserOption(chooserOption, false);\n    });\n};\n\n/**\n * Display the module chooser.\n *\n * @method displayChooser\n * @param {Promise} modalPromise Our created modal for the section\n * @param {Array} sectionModules An array of all of the built module information\n * @param {Function} partialFavourite Partially applied function we need to manage favourite status\n * @param {Object} footerData Our base footer object.\n */\nexport const displayChooser = (modalPromise, sectionModules, partialFavourite, footerData) => {\n    // Make a map so we can quickly fetch a specific module's object for either rendering or searching.\n    const mappedModules = new Map();\n    sectionModules.forEach((module) => {\n        mappedModules.set(module.componentname + '_' + module.link, module);\n    });\n\n    // Register event listeners.\n    modalPromise.then(modal => {\n        registerListenerEvents(modal, mappedModules, partialFavourite, footerData);\n\n        // We want to focus on the first chooser option element as soon as the modal is opened.\n        setupKeyboardAccessibility(modal, mappedModules);\n\n        // We want to focus on the action select when the dialog is closed.\n        modal.getRoot().on(ModalEvents.hidden, () => {\n            modal.destroy();\n        });\n\n        return modal;\n    }).catch();\n};\n"],"file":"dialogue.min.js"}