From 2d41d5ec06c54e8914fb9db572b3183664a915cb Mon Sep 17 00:00:00 2001 From: Matt Davidson Date: Fri, 20 Oct 2023 16:53:26 -0400 Subject: [PATCH] Update massactionblock.min.js.map --- amd/build/massactionblock.min.js.map | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amd/build/massactionblock.min.js.map b/amd/build/massactionblock.min.js.map index ef6ada5..762f89c 100644 --- a/amd/build/massactionblock.min.js.map +++ b/amd/build/massactionblock.min.js.map @@ -1 +1 @@ -{"version":3,"file":"massactionblock.min.js","sources":["../src/massactionblock.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 * Main module for the massaction block.\n *\n * @module block_massaction/massactionblock\n * @copyright 2022 ISB Bayern\n * @author Philipp Memmel\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport * as checkboxmanager from 'block_massaction/checkboxmanager';\nimport * as Str from 'core/str';\nimport Log from 'core/log';\nimport Notification from 'core/notification';\nimport Pending from 'core/pending';\nimport {getCurrentCourseEditor} from 'core_courseformat/courseeditor';\nimport {disableStickyFooter} from 'core/sticky-footer';\n\nexport const usedMoodleCssClasses = {\n ACTIVITY_ITEM: '.activity-item',\n SECTION_NAME: 'sectionname',\n MODULE_ID_PREFIX: 'module-',\n BOX_ID_PREFIX: 'cmCheckbox'\n};\n\nexport const cssIds = {\n BLOCK_CONTENT: 'block-massaction',\n SELECT_ALL_LINK: 'block-massaction-control-selectall',\n DESELECT_ALL_LINK: 'block-massaction-control-deselectall',\n HIDE_LINK: 'block-massaction-action-hide',\n SHOW_LINK: 'block-massaction-action-show',\n MAKE_AVAILABLE_LINK: 'block-massaction-action-makeavailable',\n DUPLICATE_LINK: 'block-massaction-action-duplicate',\n DELETE_LINK: 'block-massaction-action-delete',\n SHOW_DESCRIPTION_LINK: 'block-massaction-action-showdescription',\n HIDE_DESCRIPTION_LINK: 'block-massaction-action-hidedescription',\n CONTENT_CHANGED_NOTIFICATION_LINK: 'block-massaction-action-contentchangednotification',\n MOVELEFT_LINK: 'block-massaction-action-moveleft',\n MOVERIGHT_LINK: 'block-massaction-action-moveright',\n MOVETO_ICON_LINK: 'block-massaction-action-moveto',\n DUPLICATETO_ICON_LINK: 'block-massaction-action-duplicateto',\n DUPLICATE_TO_COURSE_ICON_LINK: 'block-massaction-action-duplicatetocourse',\n SECTION_SELECT: 'block-massaction-control-section-list-select',\n MOVETO_SELECT: 'block-massaction-control-section-list-moveto',\n DUPLICATETO_SELECT: 'block-massaction-control-section-list-duplicateto',\n HIDDEN_FIELD_REQUEST_INFORMATION: 'block-massaction-control-request',\n ACTION_FORM: 'block-massaction-control-form',\n};\n\nexport const constants = {\n SECTION_SELECT_DESCRIPTION_VALUE: 'description',\n SECTION_NUMBER_ALL_PLACEHOLDER: 'all',\n};\n\nconst actions = {\n HIDE: 'hide',\n SHOW: 'show',\n MAKE_AVAILABLE: 'makeavailable',\n DUPLICATE: 'duplicate',\n DELETE: 'delete',\n SHOW_DESCRIPTION: 'showdescription',\n HIDE_DESCRIPTION: 'hidedescription',\n MOVE_LEFT: 'moveleft',\n MOVE_RIGHT: 'moveright',\n CONTENT_CHANGED_NOTIFICATION: 'contentchangednotification',\n MOVE_TO: 'moveto',\n DUPLICATE_TO: 'duplicateto',\n DUPLICATE_TO_COURSE: 'duplicatetocourse',\n};\n\n/**\n * Initialize the mass-action block.\n */\nexport const init = async() => {\n const pendingPromise = new Pending('block_massaction/init');\n\n const editor = getCurrentCourseEditor();\n // As soon as courseeditor is available, do some initial setup.\n editor.stateManager.getInitialPromise()\n .then(() => {\n // Initialize the checkbox manager.\n checkboxmanager.initCheckboxManager();\n\n // Enable bulk editing state.\n editor.dispatch('bulkEnable', true);\n\n // Remove sticky footer.\n disableStickyFooter();\n\n return true;\n })\n .then(() => {\n // Show module tools by removing the classes that hides them.\n let elem;\n for (elem of document.getElementsByClassName(\"bulk-hidden\")) {\n elem.classList.remove(\"bulk-hidden\");\n }\n\n for (elem of document.querySelectorAll('[data-inplaceeditablelink]')) {\n elem.classList.remove(\"d-none\");\n }\n return true;\n })\n .catch(error => Log.debug(error));\n\n document.getElementById(cssIds.SELECT_ALL_LINK)?.addEventListener('click',\n () => checkboxmanager.setSectionSelection(true, constants.SECTION_NUMBER_ALL_PLACEHOLDER), false);\n\n document.getElementById(cssIds.DESELECT_ALL_LINK)?.addEventListener('click',\n () => checkboxmanager.setSectionSelection(false, constants.SECTION_NUMBER_ALL_PLACEHOLDER), false);\n\n document.getElementById(cssIds.HIDE_LINK)?.addEventListener('click',\n () => submitAction(actions.HIDE), false);\n\n document.getElementById(cssIds.SHOW_LINK)?.addEventListener('click',\n () => submitAction(actions.SHOW), false);\n\n document.getElementById(cssIds.MAKE_AVAILABLE_LINK)?.addEventListener('click',\n () => submitAction(actions.MAKE_AVAILABLE), false);\n\n document.getElementById(cssIds.DUPLICATE_LINK)?.addEventListener('click',\n () => submitAction(actions.DUPLICATE), false);\n\n document.getElementById(cssIds.DELETE_LINK)?.addEventListener('click',\n () => submitAction(actions.DELETE), false);\n\n document.getElementById(cssIds.SHOW_DESCRIPTION_LINK)?.addEventListener('click',\n () => submitAction(actions.SHOW_DESCRIPTION), false);\n\n document.getElementById(cssIds.HIDE_DESCRIPTION_LINK)?.addEventListener('click',\n () => submitAction(actions.HIDE_DESCRIPTION), false);\n\n document.getElementById(cssIds.CONTENT_CHANGED_NOTIFICATION_LINK)?.addEventListener('click',\n () => submitAction(actions.CONTENT_CHANGED_NOTIFICATION), false);\n\n document.getElementById(cssIds.MOVELEFT_LINK)?.addEventListener('click',\n () => submitAction(actions.MOVE_LEFT), false);\n\n document.getElementById(cssIds.MOVERIGHT_LINK)?.addEventListener('click',\n () => submitAction(actions.MOVE_RIGHT), false);\n\n document.getElementById(cssIds.MOVETO_ICON_LINK)?.addEventListener('click',\n () => submitAction(actions.MOVE_TO), false);\n\n document.getElementById(cssIds.DUPLICATETO_ICON_LINK)?.addEventListener('click',\n () => submitAction(actions.DUPLICATE_TO), false);\n\n document.getElementById(cssIds.DUPLICATE_TO_COURSE_ICON_LINK)?.addEventListener('click',\n () => submitAction(actions.DUPLICATE_TO_COURSE), false);\n\n pendingPromise.resolve();\n};\n\n/**\n * Submit the selected action to server.\n *\n * @param {string} action\n * @return {boolean} true if action was successful, false otherwise\n */\nconst submitAction = (action) => {\n const submitData = {\n 'action': action,\n 'moduleIds': []\n };\n\n submitData.moduleIds = checkboxmanager.getSelectedModIds();\n\n // Verify that at least one checkbox is checked.\n if (submitData.moduleIds.length === 0) {\n displayError(Str.get_string('noitemselected', 'block_massaction'));\n return false;\n }\n\n // Prep the submission.\n switch (action) {\n case actions.HIDE:\n case actions.SHOW:\n case actions.MAKE_AVAILABLE:\n case actions.DUPLICATE:\n case actions.DUPLICATE_TO_COURSE:\n case actions.CONTENT_CHANGED_NOTIFICATION:\n case actions.MOVE_LEFT:\n case actions.MOVE_RIGHT:\n case actions.DELETE:\n case actions.SHOW_DESCRIPTION:\n case actions.HIDE_DESCRIPTION:\n break;\n\n case actions.MOVE_TO:\n // Get the target section.\n submitData.moveToTarget = document.getElementById(cssIds.MOVETO_SELECT).value;\n if (submitData.moveToTarget.trim() === '') {\n displayError(Str.get_string('nomovingtargetselected', 'block_massaction'));\n return false;\n }\n break;\n\n case actions.DUPLICATE_TO:\n // Get the target section.\n submitData.duplicateToTarget = document.getElementById(cssIds.DUPLICATETO_SELECT).value;\n if (submitData.duplicateToTarget.trim() === '') {\n displayError(Str.get_string('nomovingtargetselected', 'block_massaction'));\n return false;\n }\n break;\n default:\n displayError('Unknown action: ' + action + '. Coding error.');\n return false;\n }\n // Set the form value and submit.\n document.getElementById(cssIds.HIDDEN_FIELD_REQUEST_INFORMATION).value = JSON.stringify(submitData);\n document.getElementById(cssIds.ACTION_FORM).submit();\n return true;\n};\n\nconst displayError = (errorText) => {\n Promise.resolve([Str.get_string('error', 'core'), errorText, Str.get_string('back', 'core')])\n .then(text => Notification.alert(text[0], text[1], text[2]))\n .catch(error => Log.debug(error));\n};\n"],"names":["_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","_interopRequireWildcard","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","checkboxmanager","Str","_log","_notification","_pending","_exports","usedMoodleCssClasses","ACTIVITY_ITEM","SECTION_NAME","MODULE_ID_PREFIX","BOX_ID_PREFIX","cssIds","BLOCK_CONTENT","SELECT_ALL_LINK","DESELECT_ALL_LINK","HIDE_LINK","SHOW_LINK","MAKE_AVAILABLE_LINK","DUPLICATE_LINK","DELETE_LINK","SHOW_DESCRIPTION_LINK","HIDE_DESCRIPTION_LINK","CONTENT_CHANGED_NOTIFICATION_LINK","MOVELEFT_LINK","MOVERIGHT_LINK","MOVETO_ICON_LINK","DUPLICATETO_ICON_LINK","DUPLICATE_TO_COURSE_ICON_LINK","SECTION_SELECT","MOVETO_SELECT","DUPLICATETO_SELECT","HIDDEN_FIELD_REQUEST_INFORMATION","ACTION_FORM","constants","SECTION_SELECT_DESCRIPTION_VALUE","SECTION_NUMBER_ALL_PLACEHOLDER","actions","init","async","_document$getElementB","_document$getElementB2","_document$getElementB3","_document$getElementB4","_document$getElementB5","_document$getElementB6","_document$getElementB7","_document$getElementB8","_document$getElementB9","_document$getElementB10","_document$getElementB11","_document$getElementB12","_document$getElementB13","_document$getElementB14","_document$getElementB15","pendingPromise","Pending","editor","getCurrentCourseEditor","stateManager","getInitialPromise","then","initCheckboxManager","dispatch","disableStickyFooter","elem","document","getElementsByClassName","classList","remove","querySelectorAll","catch","error","Log","debug","getElementById","addEventListener","setSectionSelection","submitAction","resolve","action","submitData","moduleIds","getSelectedModIds","length","displayError","get_string","moveToTarget","value","trim","duplicateToTarget","JSON","stringify","submit","errorText","Promise","text","Notification","alert"],"mappings":"wSA4BmC,SAAAA,uBAAAC,YAAAA,KAAAA,IAAAC,WAAAD,KAAAE,QAAAF,KAAA,SAAAG,yBAAAC,mCAAAC,wBAAAC,sBAAAD,QAAAE,qBAAAF,eAAAF,kCAAAC,oBAAAA,YAAAG,iBAAAD,oBAAAF,aAAA,SAAAI,wBAAAR,IAAAI,iBAAAA,aAAAJ,KAAAA,IAAAC,kBAAAD,cAAAA,sBAAAA,wBAAAA,WAAAE,QAAAF,SAAAS,MAAAN,yBAAAC,gBAAAK,OAAAA,MAAAC,IAAAV,YAAAS,MAAAE,IAAAX,SAAAY,UAAAC,sBAAAC,OAAAC,gBAAAD,OAAAE,iCAAAC,OAAAjB,mBAAAiB,KAAAH,OAAAI,UAAAC,eAAAC,KAAApB,IAAAiB,UAAAI,KAAAR,sBAAAC,OAAAE,yBAAAhB,IAAAiB,UAAAI,OAAAA,KAAAV,KAAAU,KAAAC,KAAAR,OAAAC,eAAAH,OAAAK,IAAAI,MAAAT,OAAAK,KAAAjB,IAAAiB,YAAAL,OAAAV,QAAAF,IAAAS,OAAAA,MAAAa,IAAAtB,IAAAY,QAAAA;;;;;;;;mJAJnCW,gBAAAf,wBAAAe,iBACAC,IAAAhB,wBAAAgB,KACAC,KAAA1B,uBAAA0B,MACAC,cAAA3B,uBAAA2B,eACAC,SAAA5B,uBAAA4B,UASEC,SAAAC,qBALkC,CAChCC,cAAe,iBACfC,aAAc,cACdC,iBAAkB,UAClBC,cAAe,cAGZ,MAAMC,OAAS,CAClBC,cAAe,mBACfC,gBAAiB,qCACjBC,kBAAmB,uCACnBC,UAAW,+BACXC,UAAW,+BACXC,oBAAqB,wCACrBC,eAAgB,oCAChBC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mC,MAAQC,sBAAaC,MAAMF,KAAK,GAAIA,KAAK,GAAIA,KAAK,MACvDzB,OAAMC,OAASC,aAAIC,MAAMF,QAAO,CACvC"} \ No newline at end of file +{"version":3,"file":"massactionblock.min.js","sources":["../src/massactionblock.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 * Main module for the massaction block.\n *\n * @module block_massaction/massactionblock\n * @copyright 2022 ISB Bayern\n * @author Philipp Memmel\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport * as checkboxmanager from 'block_massaction/checkboxmanager';\nimport * as Str from 'core/str';\nimport Log from 'core/log';\nimport Notification from 'core/notification';\nimport Pending from 'core/pending';\nimport {getCurrentCourseEditor} from 'core_courseformat/courseeditor';\nimport {disableStickyFooter} from 'core/sticky-footer';\n\nexport const usedMoodleCssClasses = {\n ACTIVITY_ITEM: '.activity-item',\n SECTION_NAME: 'sectionname',\n MODULE_ID_PREFIX: 'module-',\n BOX_ID_PREFIX: 'cmCheckbox'\n};\n\nexport const cssIds = {\n BLOCK_CONTENT: 'block-massaction',\n SELECT_ALL_LINK: 'block-massaction-control-selectall',\n DESELECT_ALL_LINK: 'block-massaction-control-deselectall',\n HIDE_LINK: 'block-massaction-action-hide',\n SHOW_LINK: 'block-massaction-action-show',\n MAKE_AVAILABLE_LINK: 'block-massaction-action-makeavailable',\n DUPLICATE_LINK: 'block-massaction-action-duplicate',\n DELETE_LINK: 'block-massaction-action-delete',\n SHOW_DESCRIPTION_LINK: 'block-massaction-action-showdescription',\n HIDE_DESCRIPTION_LINK: 'block-massaction-action-hidedescription',\n CONTENT_CHANGED_NOTIFICATION_LINK: 'block-massaction-action-contentchangednotification',\n MOVELEFT_LINK: 'block-massaction-action-moveleft',\n MOVERIGHT_LINK: 'block-massaction-action-moveright',\n MOVETO_ICON_LINK: 'block-massaction-action-moveto',\n DUPLICATETO_ICON_LINK: 'block-massaction-action-duplicateto',\n DUPLICATE_TO_COURSE_ICON_LINK: 'block-massaction-action-duplicatetocourse',\n SECTION_SELECT: 'block-massaction-control-section-list-select',\n MOVETO_SELECT: 'block-massaction-control-section-list-moveto',\n DUPLICATETO_SELECT: 'block-massaction-control-section-list-duplicateto',\n HIDDEN_FIELD_REQUEST_INFORMATION: 'block-massaction-control-request',\n ACTION_FORM: 'block-massaction-control-form',\n};\n\nexport const constants = {\n SECTION_SELECT_DESCRIPTION_VALUE: 'description',\n SECTION_NUMBER_ALL_PLACEHOLDER: 'all',\n};\n\nconst actions = {\n HIDE: 'hide',\n SHOW: 'show',\n MAKE_AVAILABLE: 'makeavailable',\n DUPLICATE: 'duplicate',\n DELETE: 'delete',\n SHOW_DESCRIPTION: 'showdescription',\n HIDE_DESCRIPTION: 'hidedescription',\n MOVE_LEFT: 'moveleft',\n MOVE_RIGHT: 'moveright',\n CONTENT_CHANGED_NOTIFICATION: 'contentchangednotification',\n MOVE_TO: 'moveto',\n DUPLICATE_TO: 'duplicateto',\n DUPLICATE_TO_COURSE: 'duplicatetocourse',\n};\n\n/**\n * Initialize the mass-action block.\n */\nexport const init = async() => {\n const pendingPromise = new Pending('block_massaction/init');\n\n const editor = getCurrentCourseEditor();\n // As soon as courseeditor is available, do some initial setup.\n editor.stateManager.getInitialPromise()\n .then(() => {\n // Initialize the checkbox manager.\n checkboxmanager.initCheckboxManager();\n\n // Enable bulk editing state.\n editor.dispatch('bulkEnable', true);\n\n // Remove sticky footer.\n disableStickyFooter();\n\n return true;\n })\n .then(() => {\n // Show module tools by removing the classes that hides them.\n let elem;\n for (elem of document.getElementsByClassName(\"bulk-hidden\")) {\n elem.classList.remove(\"bulk-hidden\");\n }\n\n for (elem of document.querySelectorAll('[data-inplaceeditablelink]')) {\n elem.classList.remove(\"d-none\");\n }\n return true;\n })\n .catch(error => Log.debug(error));\n\n document.getElementById(cssIds.SELECT_ALL_LINK)?.addEventListener('click',\n () => checkboxmanager.setSectionSelection(true, constants.SECTION_NUMBER_ALL_PLACEHOLDER), false);\n\n document.getElementById(cssIds.DESELECT_ALL_LINK)?.addEventListener('click',\n () => checkboxmanager.setSectionSelection(false, constants.SECTION_NUMBER_ALL_PLACEHOLDER), false);\n\n document.getElementById(cssIds.HIDE_LINK)?.addEventListener('click',\n () => submitAction(actions.HIDE), false);\n\n document.getElementById(cssIds.SHOW_LINK)?.addEventListener('click',\n () => submitAction(actions.SHOW), false);\n\n document.getElementById(cssIds.MAKE_AVAILABLE_LINK)?.addEventListener('click',\n () => submitAction(actions.MAKE_AVAILABLE), false);\n\n document.getElementById(cssIds.DUPLICATE_LINK)?.addEventListener('click',\n () => submitAction(actions.DUPLICATE), false);\n\n document.getElementById(cssIds.DELETE_LINK)?.addEventListener('click',\n () => submitAction(actions.DELETE), false);\n\n document.getElementById(cssIds.SHOW_DESCRIPTION_LINK)?.addEventListener('click',\n () => submitAction(actions.SHOW_DESCRIPTION), false);\n\n document.getElementById(cssIds.HIDE_DESCRIPTION_LINK)?.addEventListener('click',\n () => submitAction(actions.HIDE_DESCRIPTION), false);\n\n document.getElementById(cssIds.CONTENT_CHANGED_NOTIFICATION_LINK)?.addEventListener('click',\n () => submitAction(actions.CONTENT_CHANGED_NOTIFICATION), false);\n\n document.getElementById(cssIds.MOVELEFT_LINK)?.addEventListener('click',\n () => submitAction(actions.MOVE_LEFT), false);\n\n document.getElementById(cssIds.MOVERIGHT_LINK)?.addEventListener('click',\n () => submitAction(actions.MOVE_RIGHT), false);\n\n document.getElementById(cssIds.MOVETO_ICON_LINK)?.addEventListener('click',\n () => submitAction(actions.MOVE_TO), false);\n\n document.getElementById(cssIds.DUPLICATETO_ICON_LINK)?.addEventListener('click',\n () => submitAction(actions.DUPLICATE_TO), false);\n\n document.getElementById(cssIds.DUPLICATE_TO_COURSE_ICON_LINK)?.addEventListener('click',\n () => submitAction(actions.DUPLICATE_TO_COURSE), false);\n\n pendingPromise.resolve();\n};\n\n/**\n * Submit the selected action to server.\n *\n * @param {string} action\n * @return {boolean} true if action was successful, false otherwise\n */\nconst submitAction = (action) => {\n const submitData = {\n 'action': action,\n 'moduleIds': []\n };\n\n submitData.moduleIds = checkboxmanager.getSelectedModIds();\n\n // Verify that at least one checkbox is checked.\n if (submitData.moduleIds.length === 0) {\n displayError(Str.get_string('noitemselected', 'block_massaction'));\n return false;\n }\n\n // Prep the submission.\n switch (action) {\n case actions.HIDE:\n case actions.SHOW:\n case actions.MAKE_AVAILABLE:\n case actions.DUPLICATE:\n case actions.DUPLICATE_TO_COURSE:\n case actions.CONTENT_CHANGED_NOTIFICATION:\n case actions.MOVE_LEFT:\n case actions.MOVE_RIGHT:\n case actions.DELETE:\n case actions.SHOW_DESCRIPTION:\n case actions.HIDE_DESCRIPTION:\n break;\n\n case actions.MOVE_TO:\n // Get the target section.\n submitData.moveToTarget = document.getElementById(cssIds.MOVETO_SELECT).value;\n if (submitData.moveToTarget.trim() === '') {\n displayError(Str.get_string('nomovingtargetselected', 'block_massaction'));\n return false;\n }\n break;\n\n case actions.DUPLICATE_TO:\n // Get the target section.\n submitData.duplicateToTarget = document.getElementById(cssIds.DUPLICATETO_SELECT).value;\n if (submitData.duplicateToTarget.trim() === '') {\n displayError(Str.get_string('nomovingtargetselected', 'block_massaction'));\n return false;\n }\n break;\n default:\n displayError('Unknown action: ' + action + '. Coding error.');\n return false;\n }\n // Set the form value and submit.\n document.getElementById(cssIds.HIDDEN_FIELD_REQUEST_INFORMATION).value = JSON.stringify(submitData);\n document.getElementById(cssIds.ACTION_FORM).submit();\n return true;\n};\n\nconst displayError = (errorText) => {\n Promise.resolve([Str.get_string('error', 'core'), errorText, Str.get_string('back', 'core')])\n .then(text => Notification.alert(text[0], text[1], text[2]))\n .catch(error => Log.debug(error));\n};\n"],"names":["ACTIVITY_ITEM","SECTION_NAME","MODULE_ID_PREFIX","BOX_ID_PREFIX","cssIds","BLOCK_CONTENT","SELECT_ALL_LINK","DESELECT_ALL_LINK","HIDE_LINK","SHOW_LINK","MAKE_AVAILABLE_LINK","DUPLICATE_LINK","DELETE_LINK","SHOW_DESCRIPTION_LINK","HIDE_DESCRIPTION_LINK","CONTENT_CHANGED_NOTIFICATION_LINK","MOVELEFT_LINK","MOVERIGHT_LINK","MOVETO_ICON_LINK","DUPLICATETO_ICON_LINK","DUPLICATE_TO_COURSE_ICON_LINK","SECTION_SELECT","MOVETO_SELECT","DUPLICATETO_SELECT","HIDDEN_FIELD_REQUEST_INFORMATION","ACTION_FORM","constants","SECTION_SELECT_DESCRIPTION_VALUE","SECTION_NUMBER_ALL_PLACEHOLDER","actions","async","pendingPromise","Pending","editor","stateManager","getInitialPromise","then","checkboxmanager","initCheckboxManager","dispatch","elem","document","getElementsByClassName","classList","remove","querySelectorAll","catch","error","Log","debug","getElementById","addEventListener","setSectionSelection","submitAction","resolve","action","submitData","moduleIds","getSelectedModIds","length","displayError","Str","get_string","moveToTarget","value","trim","duplicateToTarget","JSON","stringify","submit","errorText","Promise","text","Notification","alert"],"mappings":";;;;;;;;2YAgCoC,CAChCA,cAAe,iBACfC,aAAc,cACdC,iBAAkB,UAClBC,cAAe,oBAGNC,OAAS,CAClBC,cAAe,mBACfC,gBAAiB,qCACjBC,kBAAmB,uCACnBC,UAAW,+BACXC,UAAW,+BACXC,oBAAqB,wCACrBC,eAAgB,oCAChBC,YAAa,iCACbC,sBAAuB,0CACvBC,sBAAuB,0CACvBC,kCAAmC,qDACnCC,cAAe,mCACfC,eAAgB,oCAChBC,iBAAkB,iCAClBC,sBAAuB,sCACvBC,8BAA+B,4CAC/BC,eAAgB,+CAChBC,cAAe,+CACfC,mBAAoB,oDACpBC,iCAA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